-
Notifications
You must be signed in to change notification settings - Fork 374
feat: Adds support for additional fields in UIOptions #4240
feat: Adds support for additional fields in UIOptions #4240
Conversation
|
This isn't directly related to this PR, but I'm curious how fieldsets and order work together? |
a-b-r-o-w-n
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that when processing ui options, we take additionalFields and merge that into the schema and ui options so that
{
SomeKind: {
additionalFields: [{ name: 'newField', field: SomeFieldWidget, description: 'some description' }]
}
}becomes
// schema
{
SomeKind: {
properties: {
// ... other properties
newField: { type: 'string' }
}
}
}
// ui options
{
SomeKind: {
properties: {
newField: {
description: 'some description'
}
}
}
}I'm not sure about modifying the schema, but I think this approach would work nicely with the ui options. What do you think?
Composer/packages/adaptive-form/src/components/fields/AdditionalField.tsx
Outdated
Show resolved
Hide resolved
Composer/packages/adaptive-form/src/components/fields/FieldSets.tsx
Outdated
Show resolved
Hide resolved
Composer/packages/adaptive-form/src/components/fields/ObjectArrayField.tsx
Outdated
Show resolved
Hide resolved
Composer/packages/adaptive-form/src/components/fields/ObjectField.tsx
Outdated
Show resolved
Hide resolved
Composer/packages/adaptive-form/src/utils/__tests__/getOrderedProperties.test.ts
Outdated
Show resolved
Hide resolved
Currently, the the ui order take priority over the order provided in the fieldset. Not sure if I like that behavior. Thoughts? |
a-b-r-o-w-n
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one suggestion.
* feat: Add additional fields to UIOptions * update file reference * lint * Delete PivotFieldsets.tsx * removed additionalFields option * removed additional fields ui option * added additional field * updated form row * lint * changed properties to union type * fixed build errors * resolved test issues * lint * removed AdditionalField type * fix test
Description
Adds the ability to add additional fields to the Adaptive Form. To add an additional field, developers only have to add a new property with the
additionalFieldoption set totrueand afieldoverride to thepropertiesoption in the UIOptions. The<ObjectField />will recognize the new field and add it to the schema.Order
Additional fields can be included in the UI Option order override by adding the additional field's
nameto the order array. Note, the additional field'snamecan not exist as a property name in the schema.Field sets
Additional fields can also be included in field sets by adding the additional field's
nameto thefieldsarray in the field set.Task Item
Closes #4208