Skip to content

Commit

Permalink
update: improve RJS form
Browse files Browse the repository at this point in the history
  • Loading branch information
k0stik committed Jul 29, 2024
1 parent f20e5b9 commit 43f989b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 1 addition & 2 deletions dist/other/rjsf/templates/ArrayFieldTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ export default function ArrayFieldTemplate(props) {
return (React.createElement(Stack, { spacing: 1, className: "ArrayFieldTemplate" },
React.createElement(ArrayFieldTitleTemplate, { idSchema: idSchema, title: uiOptions.title || title, schema: schema, uiSchema: uiSchema, required: required, registry: registry }),
React.createElement(ArrayFieldDescriptionTemplate, { idSchema: idSchema, description: uiOptions.description || schema.description, schema: schema, uiSchema: uiSchema, registry: registry }),
items &&
items.map(({ key, ...itemProps }) => (React.createElement(ArrayFieldItemTemplate, { key: key, ...itemProps }))),
items ? (React.createElement(Stack, { spacing: 1, className: "ArrayFieldTemplateItems" }, items.map(({ key, ...itemProps }) => (React.createElement(ArrayFieldItemTemplate, { key: key, ...itemProps }))))) : null,
canAdd && (React.createElement(Grid, { container: true, justifyContent: "flex-end" },
React.createElement(Grid, { item: true },
React.createElement(Box, { mt: 2 },
Expand Down
13 changes: 9 additions & 4 deletions src/other/rjsf/templates/ArrayFieldTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,15 @@ export default function ArrayFieldTemplate<
uiSchema={uiSchema}
registry={registry}
/>
{items &&
items.map(({ key, ...itemProps }: ArrayFieldTemplateItemType<T, S, F>) => (
<ArrayFieldItemTemplate key={key} {...itemProps} />
))}

{items ? (
<Stack spacing={1} className="ArrayFieldTemplateItems">
{items.map(({ key, ...itemProps }: ArrayFieldTemplateItemType<T, S, F>) => (
<ArrayFieldItemTemplate key={key} {...itemProps} />
))}
</Stack>
) : null}

{canAdd && (
<Grid container justifyContent="flex-end">
<Grid item>
Expand Down

0 comments on commit 43f989b

Please sign in to comment.