Finish bridge generalization
This commit is contained in:
parent
cb7a3a08dc
commit
cca8d03988
93 changed files with 634 additions and 2085 deletions
|
|
@ -21,14 +21,15 @@ export const Edit: FC<EditProps> = ({ service, row }) => {
|
|||
} = serviceConfig;
|
||||
const updateFieldNames = fields.map((val) => val.name);
|
||||
const updateAction = generateUpdateAction({ entity, table, fields });
|
||||
const updateValues = Object.fromEntries(
|
||||
Object.entries(row).filter(([key]) => updateFieldNames.includes(key)),
|
||||
);
|
||||
updateValues.id = row.id;
|
||||
const initialState = {
|
||||
message: null,
|
||||
errors: {},
|
||||
values: Object.fromEntries(
|
||||
Object.entries(row).filter(([key]) => updateFieldNames.includes(key)),
|
||||
),
|
||||
values: updateValues,
|
||||
};
|
||||
console.log("initialState", initialState);
|
||||
const [formState, formAction] = useFormState(updateAction, initialState);
|
||||
|
||||
return (
|
||||
|
|
@ -40,11 +41,11 @@ export const Edit: FC<EditProps> = ({ service, row }) => {
|
|||
>
|
||||
<Grid container direction="row" rowSpacing={3} columnSpacing={2}>
|
||||
{fields.map((field) => (
|
||||
<Grid item xs={field.size ?? 6}>
|
||||
<Grid key={field.name} item xs={field.size ?? 6}>
|
||||
<TextField
|
||||
key={field.name}
|
||||
name={field.name}
|
||||
label={field.label}
|
||||
lines={field.lines ?? 1}
|
||||
required={field.required ?? false}
|
||||
formState={formState}
|
||||
helperText={field.helperText}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue