-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Feat/custom template per field #4352
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
Feat/custom template per field #4352
Conversation
@lucasmcht Also, can you fix the type errors in the themes? |
…ucasmcht/react-jsonschema-form into feat/custom-template-per-field
@lucasmcht Some of your tests are failing |
@lucasmcht Please fix the tests so that we can merge this. Thanks |
@lucasmcht are you able to do the final bits so that we can merge your work? |
@heath-freenome Yes I just need to find some bandwith and I'll finish the feature, I'll finish it this week or the next |
@lucasmcht still waiting for you to finish this... Note that soon we will be merging in our rjsf-v6 branch to main and starting a beta, so the sooner you complete this the better |
@heath-freenome Should be fixed now. Sorry for the delay. |
@lucasmcht Looks like you are using something more modern than our babel supports. The pipeline is failing |
@heath-freenome Is it better now ? |
@lucasmcht was it really Node 14?! We are dropping support for it in the |
Fixes #3695 (Rework of PR #3881) and #1680
Reasons for making this change
Currently, to per-field customize the template, it is necessary to send the function/class of the component in the uiSchema, breaking the JSON nature of the uiSchema. It's not possible to provide just the registration key.
This pull request includes updates to the
@rjsf/utils
package to allow for per-field customization using string keys from theRegistry
, as well as updates to the documentation to reflect these changes. Additionally, it simplifies the types in the codebase by introducing a newRJSFBaseProps
type.Feature Enhancements
packages/utils/src/getTemplate.ts
: UpdatedgetTemplate()
to allow per-field customization using string keys from theRegistry
.Documentation Updates
packages/docs/docs/advanced-customization/custom-templates.md
: Updated to include examples of specifying templates using both components and string values from theRegistry
.Type Simplification
packages/utils/src/types.ts
: IntroducedRJSFBaseProps
to simplify and consolidate the properties passed to various template components. This change affects multiple type definitions, includingErrorListProps
,FieldErrorProps
,FieldHelpProps
,FieldTemplateProps
, and others.Checklist
npx nx run-many --target=build --exclude=@rjsf/docs && npm run test:update
to update snapshots, if needed.