Skip to content

feat(form): improve collection fields #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

miguelgrc
Copy link
Collaborator

@miguelgrc miguelgrc commented Apr 1, 2025

Closes #19

Improvements for collection fields, new collapsible setting and some other (mostly visual) changes

Functional changes:

  • Layer and Accordion fields now work out of the box (no need to add them inside arrays)
  • When adding a second element inside of an array/layer/accordion, an object will be automatically added and both the existing and the new elements will be moved inside the object. After deleting an element from inside one of these collection fields, if there is only one more element left, the object will be removed and the element will be moved directly under the collection field. This makes it more intuitive for users and requires less steps.
  • Added a collapsible common setting (for all fields). When enabled the field will be collapsed and only the title will be displayed until expanded.
  • Disabled renaming on the items field inside array/layer/accordion as it was causing issues with the uiSchema updates. It didn't make a lot of sense to have this option anyway.
  • Fixed tooltips not displaying correctly inside layer fields.

Visual changes:

  • Improved styling for layers, accordions, objects and nested objects. Modified paddings, buttons and added icon for readonly layers to indicate that it will open in a modal. It all looks more uniform and polished now.
  • Improved error messages, they now show up as a tag using a less bright red color.
  • Objects now expand automatically in the schema tree when an element is dropped inside. Unfortunately this doesn't happen with arrays as of now as it is not at all straightforward to make it work (to be checked in automatically expand arrays when dropping items inside #126)
  • When renaming a field, the current name is now auto-selected
  • Fixed rich editor latex rendering in preview mode

_uiPath = [...uiSchemaPath, "items"];
schema.items = schema.items || {};

if (Object.keys(schema.items).length === 1) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to test better (on me)

@miguelgrc miguelgrc force-pushed the improve-collections branch from 31ca5eb to 492bd58 Compare May 28, 2025 11:20
bordered={false}
style={{ whiteSpace: "normal", height: "auto", marginTop: 5 }}
>
{(!!rawHelp && help) || (!!rawErrors && renderFieldErrors())}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve collection fields
2 participants