fix: get triggers up to spec
This commit is contained in:
parent
b07c0e180a
commit
0b28e7f98a
22 changed files with 347 additions and 95 deletions
|
|
@ -47,6 +47,8 @@ const ETable = ({
|
|||
setEditing,
|
||||
stripeWhen,
|
||||
disableRowEdit,
|
||||
groupBy,
|
||||
sortBy,
|
||||
createText = 'Add override'
|
||||
}) => {
|
||||
const [editingId, setEditingId] = useState(null)
|
||||
|
|
@ -102,6 +104,8 @@ const ETable = ({
|
|||
const canAdd = !forceDisable && !editingId && !disableAdd && !adding
|
||||
const showTable = adding || data.length !== 0
|
||||
|
||||
const innerData = sortBy ? R.sortWith(sortBy)(data) : data
|
||||
|
||||
const ctxValue = {
|
||||
elements,
|
||||
enableEdit,
|
||||
|
|
@ -159,24 +163,33 @@ const ETable = ({
|
|||
</Form>
|
||||
</Formik>
|
||||
)}
|
||||
{data.map((it, idx) => (
|
||||
<Formik
|
||||
key={it.id ?? idx}
|
||||
enableReinitialize
|
||||
initialValues={it}
|
||||
onReset={onReset}
|
||||
validationSchema={validationSchema}
|
||||
onSubmit={innerSave}>
|
||||
<Form>
|
||||
<ERow
|
||||
editing={editingId === it.id}
|
||||
disabled={
|
||||
forceDisable || (editingId && editingId !== it.id)
|
||||
}
|
||||
/>
|
||||
</Form>
|
||||
</Formik>
|
||||
))}
|
||||
{innerData.map((it, idx) => {
|
||||
const nextElement = innerData[idx + 1]
|
||||
const isLastOfGroup =
|
||||
groupBy &&
|
||||
nextElement &&
|
||||
nextElement[groupBy] !== it[groupBy]
|
||||
|
||||
return (
|
||||
<Formik
|
||||
key={it.id ?? idx}
|
||||
enableReinitialize
|
||||
initialValues={it}
|
||||
onReset={onReset}
|
||||
validationSchema={validationSchema}
|
||||
onSubmit={innerSave}>
|
||||
<Form>
|
||||
<ERow
|
||||
lastOfGroup={isLastOfGroup}
|
||||
editing={editingId === it.id}
|
||||
disabled={
|
||||
forceDisable || (editingId && editingId !== it.id)
|
||||
}
|
||||
/>
|
||||
</Form>
|
||||
</Formik>
|
||||
)
|
||||
})}
|
||||
</TBody>
|
||||
</Table>
|
||||
</>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue