@nolwenture/formik-jsonschema-form 2.0.2 → 3.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/dist/cjs/common/types/index.js +2 -0
- package/dist/cjs/index.js +15 -5
- package/dist/cjs/v3/codemod/bindings.js +124 -0
- package/dist/cjs/v3/codemod/cli.js +89 -0
- package/dist/cjs/v3/codemod/migrate.js +21 -0
- package/dist/cjs/v3/codemod/package.js +5 -0
- package/dist/cjs/v3/codemod/slots.js +27 -0
- package/dist/cjs/v3/codemod/transform.js +61 -0
- package/dist/cjs/v3/document/fromDocument.js +50 -0
- package/dist/cjs/v3/document/index.js +9 -0
- package/dist/cjs/v3/document/render.js +22 -0
- package/dist/cjs/v3/raw/compat/v2utils.js +39 -0
- package/dist/cjs/v3/raw/core/arrays.js +55 -0
- package/dist/cjs/v3/raw/core/choiceStyle.js +14 -0
- package/dist/cjs/v3/raw/core/conditionals.js +88 -0
- package/dist/cjs/v3/raw/core/dates.js +74 -0
- package/dist/cjs/v3/raw/core/defaults.js +31 -0
- package/dist/cjs/v3/raw/core/enums.js +37 -0
- package/dist/cjs/v3/raw/core/initialValues.js +68 -0
- package/dist/cjs/v3/raw/core/issues.js +42 -0
- package/dist/cjs/v3/raw/core/json.js +58 -0
- package/dist/cjs/v3/raw/core/merge.js +51 -0
- package/dist/cjs/v3/raw/core/paths.js +88 -0
- package/dist/cjs/v3/raw/core/policies/fileUploadView.js +4 -0
- package/dist/cjs/v3/raw/core/policies/optionalNumberInitial.js +7 -0
- package/dist/cjs/v3/raw/core/policies/storedFormats.js +5 -0
- package/dist/cjs/v3/raw/core/refs.js +104 -0
- package/dist/cjs/v3/raw/core/schemaType.js +75 -0
- package/dist/cjs/v3/raw/core/titles.js +30 -0
- package/dist/cjs/v3/raw/core/trail.js +18 -0
- package/dist/cjs/v3/raw/core/uiProps.js +72 -0
- package/dist/cjs/v3/raw/core/uiSchema.js +56 -0
- package/dist/cjs/v3/raw/dom/bind.js +84 -0
- package/dist/cjs/v3/raw/dom/build.js +27 -0
- package/dist/cjs/v3/raw/dom/controller.js +87 -0
- package/dist/cjs/v3/raw/dom/core.js +67 -0
- package/dist/cjs/v3/raw/dom/delegate.js +31 -0
- package/dist/cjs/v3/raw/dom/effects.js +67 -0
- package/dist/cjs/v3/raw/dom/elements.js +88 -0
- package/dist/cjs/v3/raw/dom/emitter.js +47 -0
- package/dist/cjs/v3/raw/dom/nodes.js +25 -0
- package/dist/cjs/v3/raw/dom/render.js +122 -0
- package/dist/cjs/v3/raw/dom/upload.js +186 -0
- package/dist/cjs/v3/raw/i18n/en.js +47 -0
- package/dist/cjs/v3/raw/i18n/fi.js +44 -0
- package/dist/cjs/v3/raw/i18n/index.js +14 -0
- package/dist/cjs/v3/raw/index.js +98 -0
- package/dist/cjs/v3/raw/model/classes.js +9 -0
- package/dist/cjs/v3/raw/model/form/actions.js +154 -0
- package/dist/cjs/v3/raw/model/form/any.js +27 -0
- package/dist/cjs/v3/raw/model/form/appearance.js +32 -0
- package/dist/cjs/v3/raw/model/form/array.js +69 -0
- package/dist/cjs/v3/raw/model/form/choice.js +74 -0
- package/dist/cjs/v3/raw/model/form/chrome.js +65 -0
- package/dist/cjs/v3/raw/model/form/componentTable.js +148 -0
- package/dist/cjs/v3/raw/model/form/date.js +53 -0
- package/dist/cjs/v3/raw/model/form/dispatch.js +119 -0
- package/dist/cjs/v3/raw/model/form/iconData.js +19 -0
- package/dist/cjs/v3/raw/model/form/icons.js +10 -0
- package/dist/cjs/v3/raw/model/form/index.js +43 -0
- package/dist/cjs/v3/raw/model/form/leaf.js +99 -0
- package/dist/cjs/v3/raw/model/form/markup.js +46 -0
- package/dist/cjs/v3/raw/model/form/object.js +105 -0
- package/dist/cjs/v3/raw/model/form/parts.js +26 -0
- package/dist/cjs/v3/raw/model/form/searchable.js +81 -0
- package/dist/cjs/v3/raw/model/form/templated.js +22 -0
- package/dist/cjs/v3/raw/model/form/upload.js +88 -0
- package/dist/cjs/v3/raw/model/styledChains.js +43 -0
- package/dist/cjs/v3/raw/model/view/build.js +165 -0
- package/dist/cjs/v3/raw/model/view/fields.js +102 -0
- package/dist/cjs/v3/raw/model/view/index.js +10 -0
- package/dist/cjs/v3/raw/model/view/markup.js +62 -0
- package/dist/cjs/v3/raw/model/view/toVNode.js +67 -0
- package/dist/cjs/v3/raw/model/view/values.js +58 -0
- package/dist/cjs/v3/raw/model/vnode.js +21 -0
- package/dist/cjs/v3/raw/sanitize/index.js +10 -0
- package/dist/cjs/v3/raw/sanitize/sanitizeHtml.js +128 -0
- package/dist/cjs/v3/raw/serialize/toDOM.js +150 -0
- package/dist/cjs/v3/raw/serialize/toString.js +58 -0
- package/dist/cjs/v3/raw/store/createStore.js +133 -0
- package/dist/cjs/v3/raw/styles/color.js +112 -0
- package/dist/cjs/v3/raw/styles/colorNames.js +30 -0
- package/dist/cjs/v3/raw/styles/defaultStyles.js +114 -0
- package/dist/cjs/v3/raw/styles/index.js +24 -0
- package/dist/cjs/v3/raw/styles/themeToCssVars.js +60 -0
- package/dist/cjs/v3/raw/styles/vars.js +28 -0
- package/dist/cjs/v3/raw/validation/arrays.js +78 -0
- package/dist/cjs/v3/raw/validation/conditions.js +63 -0
- package/dist/cjs/v3/raw/validation/index.js +182 -0
- package/dist/cjs/v3/raw/validation/keywords.js +113 -0
- package/dist/cjs/v3/raw/validation/messages.js +14 -0
- package/dist/cjs/v3/raw/validation/patterns.js +74 -0
- package/dist/cjs/v3/react/chain.js +7 -0
- package/dist/cjs/v3/react/compat.js +11 -0
- package/dist/cjs/v3/react/componentsProp.js +23 -0
- package/dist/cjs/v3/react/defined.js +6 -0
- package/dist/cjs/v3/react/ejs/EJSField.js +75 -0
- package/dist/cjs/v3/react/ejs/index.js +8 -0
- package/dist/cjs/v3/react/form/components.js +105 -0
- package/dist/cjs/v3/react/form/fields.js +75 -0
- package/dist/cjs/v3/react/form/host.js +100 -0
- package/dist/cjs/{Form/FormRegistry.js → v3/react/form/registry.js} +6 -7
- package/dist/cjs/v3/react/form/root.js +42 -0
- package/dist/cjs/v3/react/form/runtime.js +117 -0
- package/dist/cjs/v3/react/form/templates.js +58 -0
- package/dist/cjs/v3/react/form/upload.js +173 -0
- package/dist/cjs/v3/react/form/uploadContexts.js +27 -0
- package/dist/cjs/v3/react/form/useSetDefault.js +21 -0
- package/dist/cjs/v3/react/hostCore.js +59 -0
- package/dist/cjs/v3/react/index.js +45 -0
- package/dist/cjs/v3/react/selector.js +17 -0
- package/dist/cjs/v3/react/slots.js +19 -0
- package/dist/cjs/v3/react/toReact.js +63 -0
- package/dist/cjs/v3/react/view/components.js +63 -0
- package/dist/cjs/v3/react/view/fields.js +46 -0
- package/dist/cjs/v3/react/view/host.js +36 -0
- package/dist/cjs/v3/react/view/registry.js +20 -0
- package/dist/cjs/v3/react/view/root.js +37 -0
- package/dist/cjs/v3/react/view/templates.js +50 -0
- package/dist/esm/common/types/index.js +2 -0
- package/dist/esm/index.js +8 -5
- package/dist/esm/v3/document/fromDocument.js +46 -0
- package/dist/esm/v3/document/index.js +4 -0
- package/dist/esm/v3/document/render.js +18 -0
- package/dist/esm/v3/raw/compat/v2utils.js +15 -0
- package/dist/esm/v3/raw/core/arrays.js +49 -0
- package/dist/esm/v3/raw/core/choiceStyle.js +10 -0
- package/dist/esm/v3/raw/core/conditionals.js +82 -0
- package/dist/esm/v3/raw/core/dates.js +66 -0
- package/dist/esm/v3/raw/core/defaults.js +25 -0
- package/dist/esm/v3/raw/core/enums.js +32 -0
- package/dist/esm/v3/raw/core/initialValues.js +65 -0
- package/dist/esm/v3/raw/core/issues.js +36 -0
- package/dist/esm/v3/raw/core/json.js +49 -0
- package/dist/esm/v3/raw/core/merge.js +47 -0
- package/dist/esm/v3/raw/core/paths.js +79 -0
- package/dist/esm/v3/raw/core/policies/fileUploadView.js +1 -0
- package/dist/esm/v3/raw/core/policies/optionalNumberInitial.js +3 -0
- package/dist/esm/v3/raw/core/policies/storedFormats.js +2 -0
- package/dist/esm/v3/raw/core/refs.js +97 -0
- package/dist/esm/v3/raw/core/schemaType.js +68 -0
- package/dist/esm/v3/raw/core/titles.js +25 -0
- package/dist/esm/v3/raw/core/trail.js +14 -0
- package/dist/esm/v3/raw/core/uiProps.js +68 -0
- package/dist/esm/v3/raw/core/uiSchema.js +47 -0
- package/dist/esm/v3/raw/dom/bind.js +80 -0
- package/dist/esm/v3/raw/dom/build.js +23 -0
- package/dist/esm/v3/raw/dom/controller.js +83 -0
- package/dist/esm/v3/raw/dom/core.js +63 -0
- package/dist/esm/v3/raw/dom/delegate.js +25 -0
- package/dist/esm/v3/raw/dom/effects.js +62 -0
- package/dist/esm/v3/raw/dom/elements.js +84 -0
- package/dist/esm/v3/raw/dom/emitter.js +43 -0
- package/dist/esm/v3/raw/dom/nodes.js +20 -0
- package/dist/esm/v3/raw/dom/render.js +118 -0
- package/dist/esm/v3/raw/dom/upload.js +182 -0
- package/dist/esm/v3/raw/i18n/en.js +44 -0
- package/dist/esm/v3/raw/i18n/fi.js +41 -0
- package/dist/esm/v3/raw/i18n/index.js +9 -0
- package/dist/esm/v3/raw/index.js +33 -0
- package/dist/esm/v3/raw/model/classes.js +5 -0
- package/dist/esm/v3/raw/model/form/actions.js +150 -0
- package/dist/esm/v3/raw/model/form/any.js +23 -0
- package/dist/esm/v3/raw/model/form/appearance.js +27 -0
- package/dist/esm/v3/raw/model/form/array.js +65 -0
- package/dist/esm/v3/raw/model/form/choice.js +65 -0
- package/dist/esm/v3/raw/model/form/chrome.js +58 -0
- package/dist/esm/v3/raw/model/form/componentTable.js +145 -0
- package/dist/esm/v3/raw/model/form/date.js +48 -0
- package/dist/esm/v3/raw/model/form/dispatch.js +114 -0
- package/dist/esm/v3/raw/model/form/iconData.js +16 -0
- package/dist/esm/v3/raw/model/form/icons.js +6 -0
- package/dist/esm/v3/raw/model/form/index.js +32 -0
- package/dist/esm/v3/raw/model/form/leaf.js +89 -0
- package/dist/esm/v3/raw/model/form/markup.js +35 -0
- package/dist/esm/v3/raw/model/form/object.js +100 -0
- package/dist/esm/v3/raw/model/form/parts.js +21 -0
- package/dist/esm/v3/raw/model/form/searchable.js +76 -0
- package/dist/esm/v3/raw/model/form/templated.js +17 -0
- package/dist/esm/v3/raw/model/form/upload.js +81 -0
- package/dist/esm/v3/raw/model/styledChains.js +40 -0
- package/dist/esm/v3/raw/model/view/build.js +158 -0
- package/dist/esm/v3/raw/model/view/fields.js +90 -0
- package/dist/esm/v3/raw/model/view/index.js +6 -0
- package/dist/esm/v3/raw/model/view/markup.js +48 -0
- package/dist/esm/v3/raw/model/view/toVNode.js +63 -0
- package/dist/esm/v3/raw/model/view/values.js +50 -0
- package/dist/esm/v3/raw/model/vnode.js +13 -0
- package/dist/esm/v3/raw/sanitize/index.js +2 -0
- package/dist/esm/v3/raw/sanitize/sanitizeHtml.js +119 -0
- package/dist/esm/v3/raw/serialize/toDOM.js +145 -0
- package/dist/esm/v3/raw/serialize/toString.js +52 -0
- package/dist/esm/v3/raw/store/createStore.js +126 -0
- package/dist/esm/v3/raw/styles/color.js +104 -0
- package/dist/esm/v3/raw/styles/colorNames.js +27 -0
- package/dist/esm/v3/raw/styles/defaultStyles.js +111 -0
- package/dist/esm/v3/raw/styles/index.js +14 -0
- package/dist/esm/v3/raw/styles/themeToCssVars.js +55 -0
- package/dist/esm/v3/raw/styles/vars.js +24 -0
- package/dist/esm/v3/raw/validation/arrays.js +40 -0
- package/dist/esm/v3/raw/validation/conditions.js +60 -0
- package/dist/esm/v3/raw/validation/index.js +146 -0
- package/dist/esm/v3/raw/validation/keywords.js +73 -0
- package/dist/esm/v3/raw/validation/messages.js +10 -0
- package/dist/esm/v3/raw/validation/patterns.js +68 -0
- package/dist/esm/v3/react/chain.js +4 -0
- package/dist/esm/v3/react/compat.js +8 -0
- package/dist/esm/v3/react/componentsProp.js +18 -0
- package/dist/esm/v3/react/defined.js +2 -0
- package/dist/esm/v3/react/ejs/EJSField.js +67 -0
- package/dist/esm/v3/react/ejs/index.js +3 -0
- package/dist/esm/v3/react/form/components.js +101 -0
- package/dist/esm/v3/react/form/fields.js +70 -0
- package/dist/esm/v3/react/form/host.js +95 -0
- package/dist/esm/{Form/FormRegistry.js → v3/react/form/registry.js} +5 -3
- package/dist/esm/v3/react/form/root.js +38 -0
- package/dist/esm/v3/react/form/runtime.js +113 -0
- package/dist/esm/v3/react/form/templates.js +55 -0
- package/dist/esm/v3/react/form/upload.js +168 -0
- package/dist/esm/v3/react/form/uploadContexts.js +24 -0
- package/dist/esm/v3/react/form/useSetDefault.js +17 -0
- package/dist/esm/v3/react/hostCore.js +52 -0
- package/dist/esm/v3/react/index.js +18 -0
- package/dist/esm/v3/react/selector.js +13 -0
- package/dist/esm/v3/react/slots.js +15 -0
- package/dist/esm/v3/react/toReact.js +58 -0
- package/dist/esm/v3/react/view/components.js +59 -0
- package/dist/esm/v3/react/view/fields.js +43 -0
- package/dist/esm/v3/react/view/host.js +32 -0
- package/dist/esm/v3/react/view/registry.js +16 -0
- package/dist/esm/v3/react/view/root.js +33 -0
- package/dist/esm/v3/react/view/templates.js +47 -0
- package/dist/types/common/types/Form.d.ts +9 -32
- package/dist/types/common/types/Utils.d.ts +11 -0
- package/dist/types/common/types/index.d.ts +2 -0
- package/dist/types/index.d.ts +6 -4
- package/dist/types/v3/codemod/bindings.d.ts +18 -0
- package/dist/types/v3/codemod/cli.d.ts +2 -0
- package/dist/types/v3/codemod/migrate.d.ts +8 -0
- package/dist/types/v3/codemod/package.d.ts +2 -0
- package/dist/types/v3/codemod/slots.d.ts +13 -0
- package/dist/types/v3/codemod/transform.d.ts +29 -0
- package/dist/types/v3/document/fromDocument.d.ts +22 -0
- package/dist/types/v3/document/index.d.ts +4 -0
- package/dist/types/v3/document/render.d.ts +11 -0
- package/dist/types/v3/raw/compat/v2utils.d.ts +14 -0
- package/dist/types/v3/raw/core/arrays.d.ts +22 -0
- package/dist/types/v3/raw/core/choiceStyle.d.ts +4 -0
- package/dist/types/v3/raw/core/conditionals.d.ts +6 -0
- package/dist/types/v3/raw/core/dates.d.ts +8 -0
- package/dist/types/v3/raw/core/defaults.d.ts +15 -0
- package/dist/types/v3/raw/core/enums.d.ts +18 -0
- package/dist/types/v3/raw/core/initialValues.d.ts +12 -0
- package/dist/types/v3/raw/core/issues.d.ts +17 -0
- package/dist/types/v3/raw/core/json.d.ts +52 -0
- package/dist/types/v3/raw/core/merge.d.ts +6 -0
- package/dist/types/v3/raw/core/paths.d.ts +17 -0
- package/dist/types/v3/raw/core/policies/fileUploadView.d.ts +2 -0
- package/dist/types/v3/raw/core/policies/optionalNumberInitial.d.ts +4 -0
- package/dist/types/v3/raw/core/policies/storedFormats.d.ts +4 -0
- package/dist/types/v3/raw/core/refs.d.ts +41 -0
- package/dist/types/v3/raw/core/schemaType.d.ts +16 -0
- package/dist/types/v3/raw/core/titles.d.ts +2 -0
- package/dist/types/v3/raw/core/trail.d.ts +5 -0
- package/dist/types/v3/raw/core/uiProps.d.ts +12 -0
- package/dist/types/v3/raw/core/uiSchema.d.ts +19 -0
- package/dist/types/v3/raw/dom/bind.d.ts +2 -0
- package/dist/types/v3/raw/dom/build.d.ts +10 -0
- package/dist/types/v3/raw/dom/controller.d.ts +37 -0
- package/dist/types/v3/raw/dom/core.d.ts +43 -0
- package/dist/types/v3/raw/dom/delegate.d.ts +18 -0
- package/dist/types/v3/raw/dom/effects.d.ts +18 -0
- package/dist/types/v3/raw/dom/elements.d.ts +17 -0
- package/dist/types/v3/raw/dom/emitter.d.ts +8 -0
- package/dist/types/v3/raw/dom/nodes.d.ts +3 -0
- package/dist/types/v3/raw/dom/render.d.ts +2 -0
- package/dist/types/v3/raw/dom/types.d.ts +112 -0
- package/dist/types/v3/raw/dom/upload.d.ts +16 -0
- package/dist/types/v3/raw/i18n/en.d.ts +42 -0
- package/dist/types/v3/raw/i18n/fi.d.ts +2 -0
- package/dist/types/v3/raw/i18n/index.d.ts +9 -0
- package/dist/types/v3/raw/index.d.ts +43 -0
- package/dist/types/v3/raw/model/classes.d.ts +2 -0
- package/dist/types/v3/raw/model/form/actions.d.ts +41 -0
- package/dist/types/v3/raw/model/form/any.d.ts +5 -0
- package/dist/types/v3/raw/model/form/appearance.d.ts +9 -0
- package/dist/types/v3/raw/model/form/array.d.ts +4 -0
- package/dist/types/v3/raw/model/form/choice.d.ts +16 -0
- package/dist/types/v3/raw/model/form/chrome.d.ts +20 -0
- package/dist/types/v3/raw/model/form/componentTable.d.ts +2 -0
- package/dist/types/v3/raw/model/form/date.d.ts +13 -0
- package/dist/types/v3/raw/model/form/dispatch.d.ts +13 -0
- package/dist/types/v3/raw/model/form/iconData.d.ts +4 -0
- package/dist/types/v3/raw/model/form/icons.d.ts +2 -0
- package/dist/types/v3/raw/model/form/index.d.ts +38 -0
- package/dist/types/v3/raw/model/form/leaf.d.ts +29 -0
- package/dist/types/v3/raw/model/form/markup.d.ts +39 -0
- package/dist/types/v3/raw/model/form/object.d.ts +9 -0
- package/dist/types/v3/raw/model/form/parts.d.ts +10 -0
- package/dist/types/v3/raw/model/form/searchable.d.ts +5 -0
- package/dist/types/v3/raw/model/form/templated.d.ts +14 -0
- package/dist/types/v3/raw/model/form/types.d.ts +179 -0
- package/dist/types/v3/raw/model/form/upload.d.ts +28 -0
- package/dist/types/v3/raw/model/host.d.ts +46 -0
- package/dist/types/v3/raw/model/styledChains.d.ts +1 -0
- package/dist/types/v3/raw/model/view/build.d.ts +21 -0
- package/dist/types/v3/raw/model/view/fields.d.ts +31 -0
- package/dist/types/v3/raw/model/view/index.d.ts +6 -0
- package/dist/types/v3/raw/model/view/markup.d.ts +39 -0
- package/dist/types/v3/raw/model/view/toVNode.d.ts +3 -0
- package/dist/types/v3/raw/model/view/types.d.ts +109 -0
- package/dist/types/v3/raw/model/view/values.d.ts +10 -0
- package/dist/types/v3/raw/model/vnode.d.ts +24 -0
- package/dist/types/v3/raw/sanitize/index.d.ts +2 -0
- package/dist/types/v3/raw/sanitize/sanitizeHtml.d.ts +30 -0
- package/dist/types/v3/raw/serialize/toDOM.d.ts +14 -0
- package/dist/types/v3/raw/serialize/toString.d.ts +4 -0
- package/dist/types/v3/raw/store/createStore.d.ts +39 -0
- package/dist/types/v3/raw/styles/color.d.ts +15 -0
- package/dist/types/v3/raw/styles/colorNames.d.ts +1 -0
- package/dist/types/v3/raw/styles/defaultStyles.d.ts +1 -0
- package/dist/types/v3/raw/styles/index.d.ts +8 -0
- package/dist/types/v3/raw/styles/themeToCssVars.d.ts +4 -0
- package/dist/types/v3/raw/styles/vars.d.ts +43 -0
- package/dist/types/v3/raw/validation/arrays.d.ts +16 -0
- package/dist/types/v3/raw/validation/conditions.d.ts +10 -0
- package/dist/types/v3/raw/validation/index.d.ts +30 -0
- package/dist/types/v3/raw/validation/keywords.d.ts +10 -0
- package/dist/types/v3/raw/validation/messages.d.ts +8 -0
- package/dist/types/v3/raw/validation/patterns.d.ts +8 -0
- package/dist/types/v3/react/chain.d.ts +1 -0
- package/dist/types/v3/react/compat.d.ts +4 -0
- package/dist/types/v3/react/componentsProp.d.ts +5 -0
- package/dist/types/v3/react/defined.d.ts +1 -0
- package/dist/types/v3/react/ejs/EJSField.d.ts +14 -0
- package/dist/types/v3/react/ejs/index.d.ts +1 -0
- package/dist/types/v3/react/form/components.d.ts +3 -0
- package/dist/types/v3/react/form/fields.d.ts +8 -0
- package/dist/types/v3/react/form/host.d.ts +9 -0
- package/dist/types/v3/react/form/registry.d.ts +46 -0
- package/dist/types/v3/react/form/root.d.ts +32 -0
- package/dist/types/v3/react/form/runtime.d.ts +3 -0
- package/dist/types/v3/react/form/templates.d.ts +1 -0
- package/dist/types/v3/react/form/upload.d.ts +3 -0
- package/dist/types/v3/react/form/uploadContexts.d.ts +34 -0
- package/dist/types/v3/react/form/useSetDefault.d.ts +5 -0
- package/dist/types/v3/react/hostCore.d.ts +24 -0
- package/dist/types/v3/react/index.d.ts +23 -0
- package/dist/types/v3/react/selector.d.ts +10 -0
- package/dist/types/v3/react/slots.d.ts +4 -0
- package/dist/types/v3/react/toReact.d.ts +10 -0
- package/dist/types/v3/react/view/components.d.ts +8 -0
- package/dist/types/v3/react/view/fields.d.ts +4 -0
- package/dist/types/v3/react/view/host.d.ts +6 -0
- package/dist/types/v3/react/view/registry.d.ts +34 -0
- package/dist/types/v3/react/view/root.d.ts +32 -0
- package/dist/types/v3/react/view/templates.d.ts +15 -0
- package/package.json +97 -11
- package/styles.css +187 -0
- package/dist/cjs/Form/Form.js +0 -38
- package/dist/cjs/Form/components/Clickable.js +0 -11
- package/dist/cjs/Form/components/ErrorMessage.js +0 -23
- package/dist/cjs/Form/components/FieldInfo.js +0 -144
- package/dist/cjs/Form/components/FieldInput.js +0 -86
- package/dist/cjs/Form/components/Form.js +0 -52
- package/dist/cjs/Form/components/Icon.js +0 -5
- package/dist/cjs/Form/components/RequiredIndicator.js +0 -9
- package/dist/cjs/Form/components/index.js +0 -58
- package/dist/cjs/Form/fields/AnyField/AnyField.js +0 -30
- package/dist/cjs/Form/fields/AnyField/index.js +0 -38
- package/dist/cjs/Form/fields/AnyField/styledComponents.js +0 -6
- package/dist/cjs/Form/fields/ArrayField/ArrayField.js +0 -130
- package/dist/cjs/Form/fields/ArrayField/index.js +0 -38
- package/dist/cjs/Form/fields/ArrayField/styledComponents.js +0 -22
- package/dist/cjs/Form/fields/BooleanField/BooleanField.js +0 -26
- package/dist/cjs/Form/fields/BooleanField/index.js +0 -38
- package/dist/cjs/Form/fields/BooleanField/styledComponents.js +0 -18
- package/dist/cjs/Form/fields/DateField/DateField.js +0 -26
- package/dist/cjs/Form/fields/DateField/DateInput.js +0 -121
- package/dist/cjs/Form/fields/DateField/dateParsing.js +0 -68
- package/dist/cjs/Form/fields/DateField/index.js +0 -42
- package/dist/cjs/Form/fields/DateField/styledComponents.js +0 -60
- package/dist/cjs/Form/fields/FileUploadField/FileUploadField.js +0 -69
- package/dist/cjs/Form/fields/FileUploadField/FileUploadFieldInput.js +0 -21
- package/dist/cjs/Form/fields/FileUploadField/index.js +0 -41
- package/dist/cjs/Form/fields/FileUploadField/styledComponents.js +0 -63
- package/dist/cjs/Form/fields/FilesUploadField/FilesUploadField.js +0 -102
- package/dist/cjs/Form/fields/FilesUploadField/FilesUploadFieldInput.js +0 -174
- package/dist/cjs/Form/fields/FilesUploadField/index.js +0 -41
- package/dist/cjs/Form/fields/FilesUploadField/styledComponents.js +0 -217
- package/dist/cjs/Form/fields/MultipleChoiceField/MultipleChoiceField.js +0 -35
- package/dist/cjs/Form/fields/MultipleChoiceField/MultipleChoiceFieldInput.js +0 -40
- package/dist/cjs/Form/fields/MultipleChoiceField/index.js +0 -41
- package/dist/cjs/Form/fields/MultipleChoiceField/styledComponents.js +0 -24
- package/dist/cjs/Form/fields/NullField/NullField.js +0 -15
- package/dist/cjs/Form/fields/NullField/index.js +0 -37
- package/dist/cjs/Form/fields/NumberField/NumberField.js +0 -16
- package/dist/cjs/Form/fields/NumberField/index.js +0 -38
- package/dist/cjs/Form/fields/NumberField/styledComponents.js +0 -6
- package/dist/cjs/Form/fields/ObjectField/ObjectField.js +0 -190
- package/dist/cjs/Form/fields/ObjectField/ObjectFieldSection.js +0 -17
- package/dist/cjs/Form/fields/ObjectField/index.js +0 -41
- package/dist/cjs/Form/fields/ObjectField/styledComponents.js +0 -50
- package/dist/cjs/Form/fields/ObjectField/types.js +0 -10
- package/dist/cjs/Form/fields/RadioField/RadioField.js +0 -19
- package/dist/cjs/Form/fields/RadioField/RadioFieldInput.js +0 -11
- package/dist/cjs/Form/fields/RadioField/index.js +0 -41
- package/dist/cjs/Form/fields/RadioField/styledComponents.js +0 -78
- package/dist/cjs/Form/fields/SchemaField/SchemaField.js +0 -38
- package/dist/cjs/Form/fields/SchemaField/index.js +0 -37
- package/dist/cjs/Form/fields/SearchableMultiTagSelectField/SearchableMultiTagSelectField.js +0 -20
- package/dist/cjs/Form/fields/SearchableMultiTagSelectField/SearchableMultiTagSelectFieldInput.js +0 -27
- package/dist/cjs/Form/fields/SearchableMultiTagSelectField/index.js +0 -41
- package/dist/cjs/Form/fields/SearchableMultiTagSelectField/styledComponents.js +0 -71
- package/dist/cjs/Form/fields/SearchableSelectField/SearchableSelectField.js +0 -147
- package/dist/cjs/Form/fields/SearchableSelectField/index.js +0 -40
- package/dist/cjs/Form/fields/SearchableSelectField/styledComponents.js +0 -53
- package/dist/cjs/Form/fields/StringField/StringField.js +0 -44
- package/dist/cjs/Form/fields/StringField/index.js +0 -37
- package/dist/cjs/Form/fields/StringField/styledComponents.js +0 -6
- package/dist/cjs/Form/fields/TextAreaField/TextAreaField.js +0 -21
- package/dist/cjs/Form/fields/TextAreaField/index.js +0 -38
- package/dist/cjs/Form/fields/TextAreaField/styledComponents.js +0 -17
- package/dist/cjs/Form/fields/ToggleField/ToggleField.js +0 -19
- package/dist/cjs/Form/fields/ToggleField/ToggleFieldInput.js +0 -11
- package/dist/cjs/Form/fields/ToggleField/index.js +0 -41
- package/dist/cjs/Form/fields/ToggleField/styledComponents.js +0 -58
- package/dist/cjs/Form/fields/index.js +0 -93
- package/dist/cjs/Form/hooks/index.js +0 -17
- package/dist/cjs/Form/hooks/useSetDefault.js +0 -32
- package/dist/cjs/Form/index.js +0 -26
- package/dist/cjs/Form/styles/common.js +0 -259
- package/dist/cjs/Form/templates/ArrayFieldTemplate/ArrayFieldTemplate.js +0 -36
- package/dist/cjs/Form/templates/ArrayFieldTemplate/index.js +0 -38
- package/dist/cjs/Form/templates/ArrayFieldTemplate/styledComponents.js +0 -28
- package/dist/cjs/Form/templates/CollapsibleObjectFieldTemplate/CollapsibleObjectFieldTemplate.js +0 -41
- package/dist/cjs/Form/templates/CollapsibleObjectFieldTemplate/index.js +0 -38
- package/dist/cjs/Form/templates/CollapsibleObjectFieldTemplate/styledComponents.js +0 -55
- package/dist/cjs/Form/templates/FieldTemplate/FieldTemplate.js +0 -28
- package/dist/cjs/Form/templates/FieldTemplate/index.js +0 -37
- package/dist/cjs/Form/templates/ObjectFieldTemplate/ObjectFieldTemplate.js +0 -32
- package/dist/cjs/Form/templates/ObjectFieldTemplate/index.js +0 -38
- package/dist/cjs/Form/templates/ObjectFieldTemplate/styledComponents.js +0 -57
- package/dist/cjs/Form/templates/index.js +0 -55
- package/dist/cjs/Form/types/index.js +0 -17
- package/dist/cjs/FormView/FormView.js +0 -36
- package/dist/cjs/FormView/FormViewRegistry.js +0 -19
- package/dist/cjs/FormView/components/Field.js +0 -131
- package/dist/cjs/FormView/components/Form.js +0 -9
- package/dist/cjs/FormView/components/Icon.js +0 -7
- package/dist/cjs/FormView/components/index.js +0 -56
- package/dist/cjs/FormView/fields/AnyField.js +0 -26
- package/dist/cjs/FormView/fields/ArrayField.js +0 -32
- package/dist/cjs/FormView/fields/BooleanField.js +0 -33
- package/dist/cjs/FormView/fields/DateField.js +0 -12
- package/dist/cjs/FormView/fields/EJSField.js +0 -39
- package/dist/cjs/FormView/fields/FileUploadField.js +0 -7
- package/dist/cjs/FormView/fields/FilesUploadField.js +0 -7
- package/dist/cjs/FormView/fields/MultipleChoiceField.js +0 -30
- package/dist/cjs/FormView/fields/NullField.js +0 -14
- package/dist/cjs/FormView/fields/NumberField.js +0 -12
- package/dist/cjs/FormView/fields/ObjectField/ObjectField.js +0 -57
- package/dist/cjs/FormView/fields/ObjectField/ObjectFieldSection.js +0 -11
- package/dist/cjs/FormView/fields/ObjectField/index.js +0 -41
- package/dist/cjs/FormView/fields/ObjectField/styledComponents.js +0 -6
- package/dist/cjs/FormView/fields/RadioField.js +0 -15
- package/dist/cjs/FormView/fields/SchemaField.js +0 -38
- package/dist/cjs/FormView/fields/SearchableMultiTagSelectField.js +0 -14
- package/dist/cjs/FormView/fields/SearchableSelectField.js +0 -13
- package/dist/cjs/FormView/fields/StringField.js +0 -24
- package/dist/cjs/FormView/fields/TextAreaField.js +0 -18
- package/dist/cjs/FormView/fields/ToggleField.js +0 -15
- package/dist/cjs/FormView/fields/index.js +0 -81
- package/dist/cjs/FormView/index.js +0 -25
- package/dist/cjs/FormView/templates/ArrayFieldTemplate/ArrayFieldTemplate.js +0 -20
- package/dist/cjs/FormView/templates/ArrayFieldTemplate/index.js +0 -38
- package/dist/cjs/FormView/templates/ArrayFieldTemplate/styledComponents.js +0 -15
- package/dist/cjs/FormView/templates/FieldTemplate/FieldTemplate.js +0 -18
- package/dist/cjs/FormView/templates/FieldTemplate/index.js +0 -37
- package/dist/cjs/FormView/templates/ObjectFieldTemplate/ObjectFieldTemplate.js +0 -30
- package/dist/cjs/FormView/templates/ObjectFieldTemplate/index.js +0 -38
- package/dist/cjs/FormView/templates/ObjectFieldTemplate/styledComponents.js +0 -65
- package/dist/cjs/FormView/templates/index.js +0 -52
- package/dist/cjs/common/FileUploadContext.js +0 -15
- package/dist/cjs/common/FilesUploadContext.js +0 -14
- package/dist/cjs/common/constants.js +0 -13
- package/dist/cjs/common/index.js +0 -20
- package/dist/cjs/utils/createInitialValues.js +0 -38
- package/dist/cjs/utils/createValidationSchema.js +0 -397
- package/dist/cjs/utils/deepOverlap.js +0 -18
- package/dist/cjs/utils/extractUiSchema.js +0 -22
- package/dist/cjs/utils/getEnums.js +0 -56
- package/dist/cjs/utils/getHiddenProperties.js +0 -11
- package/dist/cjs/utils/getStyle.js +0 -21
- package/dist/cjs/utils/getTitleAndDescription.js +0 -19
- package/dist/cjs/utils/getTypes.js +0 -60
- package/dist/cjs/utils/immutablySwapItems.js +0 -10
- package/dist/cjs/utils/index.js +0 -31
- package/dist/cjs/utils/mergeSchemas.js +0 -30
- package/dist/cjs/utils/orderAdditionalProperties.js +0 -12
- package/dist/cjs/utils/orderByUiSchema.js +0 -29
- package/dist/cjs/utils/resolveSchema.js +0 -117
- package/dist/cjs/utils/setTitleValues.js +0 -25
- package/dist/cjs/utils/solveReferences.js +0 -25
- package/dist/esm/Form/Form.js +0 -34
- package/dist/esm/Form/components/Clickable.js +0 -7
- package/dist/esm/Form/components/ErrorMessage.js +0 -16
- package/dist/esm/Form/components/FieldInfo.js +0 -140
- package/dist/esm/Form/components/FieldInput.js +0 -50
- package/dist/esm/Form/components/Form.js +0 -13
- package/dist/esm/Form/components/Icon.js +0 -2
- package/dist/esm/Form/components/RequiredIndicator.js +0 -6
- package/dist/esm/Form/components/index.js +0 -22
- package/dist/esm/Form/fields/AnyField/AnyField.js +0 -26
- package/dist/esm/Form/fields/AnyField/index.js +0 -2
- package/dist/esm/Form/fields/AnyField/styledComponents.js +0 -3
- package/dist/esm/Form/fields/ArrayField/ArrayField.js +0 -126
- package/dist/esm/Form/fields/ArrayField/index.js +0 -2
- package/dist/esm/Form/fields/ArrayField/styledComponents.js +0 -16
- package/dist/esm/Form/fields/BooleanField/BooleanField.js +0 -22
- package/dist/esm/Form/fields/BooleanField/index.js +0 -2
- package/dist/esm/Form/fields/BooleanField/styledComponents.js +0 -15
- package/dist/esm/Form/fields/DateField/DateField.js +0 -22
- package/dist/esm/Form/fields/DateField/DateInput.js +0 -117
- package/dist/esm/Form/fields/DateField/dateParsing.js +0 -62
- package/dist/esm/Form/fields/DateField/index.js +0 -3
- package/dist/esm/Form/fields/DateField/styledComponents.js +0 -54
- package/dist/esm/Form/fields/FileUploadField/FileUploadField.js +0 -65
- package/dist/esm/Form/fields/FileUploadField/FileUploadFieldInput.js +0 -17
- package/dist/esm/Form/fields/FileUploadField/index.js +0 -5
- package/dist/esm/Form/fields/FileUploadField/styledComponents.js +0 -57
- package/dist/esm/Form/fields/FilesUploadField/FilesUploadField.js +0 -98
- package/dist/esm/Form/fields/FilesUploadField/FilesUploadFieldInput.js +0 -137
- package/dist/esm/Form/fields/FilesUploadField/index.js +0 -5
- package/dist/esm/Form/fields/FilesUploadField/styledComponents.js +0 -211
- package/dist/esm/Form/fields/MultipleChoiceField/MultipleChoiceField.js +0 -31
- package/dist/esm/Form/fields/MultipleChoiceField/MultipleChoiceFieldInput.js +0 -36
- package/dist/esm/Form/fields/MultipleChoiceField/index.js +0 -5
- package/dist/esm/Form/fields/MultipleChoiceField/styledComponents.js +0 -18
- package/dist/esm/Form/fields/NullField/NullField.js +0 -11
- package/dist/esm/Form/fields/NullField/index.js +0 -1
- package/dist/esm/Form/fields/NumberField/NumberField.js +0 -12
- package/dist/esm/Form/fields/NumberField/index.js +0 -2
- package/dist/esm/Form/fields/NumberField/styledComponents.js +0 -3
- package/dist/esm/Form/fields/ObjectField/ObjectField.js +0 -186
- package/dist/esm/Form/fields/ObjectField/ObjectFieldSection.js +0 -13
- package/dist/esm/Form/fields/ObjectField/index.js +0 -5
- package/dist/esm/Form/fields/ObjectField/styledComponents.js +0 -47
- package/dist/esm/Form/fields/ObjectField/types.js +0 -7
- package/dist/esm/Form/fields/RadioField/RadioField.js +0 -15
- package/dist/esm/Form/fields/RadioField/RadioFieldInput.js +0 -7
- package/dist/esm/Form/fields/RadioField/index.js +0 -5
- package/dist/esm/Form/fields/RadioField/styledComponents.js +0 -75
- package/dist/esm/Form/fields/SchemaField/SchemaField.js +0 -34
- package/dist/esm/Form/fields/SchemaField/index.js +0 -1
- package/dist/esm/Form/fields/SearchableMultiTagSelectField/SearchableMultiTagSelectField.js +0 -16
- package/dist/esm/Form/fields/SearchableMultiTagSelectField/SearchableMultiTagSelectFieldInput.js +0 -23
- package/dist/esm/Form/fields/SearchableMultiTagSelectField/index.js +0 -5
- package/dist/esm/Form/fields/SearchableMultiTagSelectField/styledComponents.js +0 -68
- package/dist/esm/Form/fields/SearchableSelectField/SearchableSelectField.js +0 -143
- package/dist/esm/Form/fields/SearchableSelectField/index.js +0 -4
- package/dist/esm/Form/fields/SearchableSelectField/styledComponents.js +0 -50
- package/dist/esm/Form/fields/StringField/StringField.js +0 -40
- package/dist/esm/Form/fields/StringField/index.js +0 -1
- package/dist/esm/Form/fields/StringField/styledComponents.js +0 -3
- package/dist/esm/Form/fields/TextAreaField/TextAreaField.js +0 -17
- package/dist/esm/Form/fields/TextAreaField/index.js +0 -2
- package/dist/esm/Form/fields/TextAreaField/styledComponents.js +0 -11
- package/dist/esm/Form/fields/ToggleField/ToggleField.js +0 -15
- package/dist/esm/Form/fields/ToggleField/ToggleFieldInput.js +0 -7
- package/dist/esm/Form/fields/ToggleField/index.js +0 -5
- package/dist/esm/Form/fields/ToggleField/styledComponents.js +0 -55
- package/dist/esm/Form/fields/index.js +0 -57
- package/dist/esm/Form/hooks/index.js +0 -1
- package/dist/esm/Form/hooks/useSetDefault.js +0 -28
- package/dist/esm/Form/index.js +0 -7
- package/dist/esm/Form/styles/common.js +0 -256
- package/dist/esm/Form/templates/ArrayFieldTemplate/ArrayFieldTemplate.js +0 -32
- package/dist/esm/Form/templates/ArrayFieldTemplate/index.js +0 -2
- package/dist/esm/Form/templates/ArrayFieldTemplate/styledComponents.js +0 -24
- package/dist/esm/Form/templates/CollapsibleObjectFieldTemplate/CollapsibleObjectFieldTemplate.js +0 -37
- package/dist/esm/Form/templates/CollapsibleObjectFieldTemplate/index.js +0 -2
- package/dist/esm/Form/templates/CollapsibleObjectFieldTemplate/styledComponents.js +0 -51
- package/dist/esm/Form/templates/FieldTemplate/FieldTemplate.js +0 -24
- package/dist/esm/Form/templates/FieldTemplate/index.js +0 -1
- package/dist/esm/Form/templates/ObjectFieldTemplate/ObjectFieldTemplate.js +0 -28
- package/dist/esm/Form/templates/ObjectFieldTemplate/index.js +0 -2
- package/dist/esm/Form/templates/ObjectFieldTemplate/styledComponents.js +0 -53
- package/dist/esm/Form/templates/index.js +0 -19
- package/dist/esm/Form/types/index.js +0 -1
- package/dist/esm/FormView/FormView.js +0 -29
- package/dist/esm/FormView/FormViewRegistry.js +0 -13
- package/dist/esm/FormView/components/Field.js +0 -123
- package/dist/esm/FormView/components/Form.js +0 -6
- package/dist/esm/FormView/components/Icon.js +0 -4
- package/dist/esm/FormView/components/index.js +0 -17
- package/dist/esm/FormView/fields/AnyField.js +0 -22
- package/dist/esm/FormView/fields/ArrayField.js +0 -28
- package/dist/esm/FormView/fields/BooleanField.js +0 -29
- package/dist/esm/FormView/fields/DateField.js +0 -8
- package/dist/esm/FormView/fields/EJSField.js +0 -32
- package/dist/esm/FormView/fields/FileUploadField.js +0 -3
- package/dist/esm/FormView/fields/FilesUploadField.js +0 -3
- package/dist/esm/FormView/fields/MultipleChoiceField.js +0 -26
- package/dist/esm/FormView/fields/NullField.js +0 -10
- package/dist/esm/FormView/fields/NumberField.js +0 -8
- package/dist/esm/FormView/fields/ObjectField/ObjectField.js +0 -53
- package/dist/esm/FormView/fields/ObjectField/ObjectFieldSection.js +0 -7
- package/dist/esm/FormView/fields/ObjectField/index.js +0 -5
- package/dist/esm/FormView/fields/ObjectField/styledComponents.js +0 -3
- package/dist/esm/FormView/fields/RadioField.js +0 -11
- package/dist/esm/FormView/fields/SchemaField.js +0 -34
- package/dist/esm/FormView/fields/SearchableMultiTagSelectField.js +0 -10
- package/dist/esm/FormView/fields/SearchableSelectField.js +0 -9
- package/dist/esm/FormView/fields/StringField.js +0 -20
- package/dist/esm/FormView/fields/TextAreaField.js +0 -14
- package/dist/esm/FormView/fields/ToggleField.js +0 -11
- package/dist/esm/FormView/fields/index.js +0 -45
- package/dist/esm/FormView/index.js +0 -6
- package/dist/esm/FormView/templates/ArrayFieldTemplate/ArrayFieldTemplate.js +0 -16
- package/dist/esm/FormView/templates/ArrayFieldTemplate/index.js +0 -2
- package/dist/esm/FormView/templates/ArrayFieldTemplate/styledComponents.js +0 -11
- package/dist/esm/FormView/templates/FieldTemplate/FieldTemplate.js +0 -14
- package/dist/esm/FormView/templates/FieldTemplate/index.js +0 -1
- package/dist/esm/FormView/templates/ObjectFieldTemplate/ObjectFieldTemplate.js +0 -26
- package/dist/esm/FormView/templates/ObjectFieldTemplate/index.js +0 -2
- package/dist/esm/FormView/templates/ObjectFieldTemplate/styledComponents.js +0 -58
- package/dist/esm/FormView/templates/index.js +0 -16
- package/dist/esm/common/FileUploadContext.js +0 -12
- package/dist/esm/common/FilesUploadContext.js +0 -11
- package/dist/esm/common/constants.js +0 -10
- package/dist/esm/common/index.js +0 -4
- package/dist/esm/utils/createInitialValues.js +0 -35
- package/dist/esm/utils/createValidationSchema.js +0 -361
- package/dist/esm/utils/deepOverlap.js +0 -14
- package/dist/esm/utils/extractUiSchema.js +0 -18
- package/dist/esm/utils/getEnums.js +0 -51
- package/dist/esm/utils/getHiddenProperties.js +0 -7
- package/dist/esm/utils/getStyle.js +0 -18
- package/dist/esm/utils/getTitleAndDescription.js +0 -14
- package/dist/esm/utils/getTypes.js +0 -53
- package/dist/esm/utils/immutablySwapItems.js +0 -7
- package/dist/esm/utils/index.js +0 -15
- package/dist/esm/utils/mergeSchemas.js +0 -26
- package/dist/esm/utils/orderAdditionalProperties.js +0 -9
- package/dist/esm/utils/orderByUiSchema.js +0 -26
- package/dist/esm/utils/resolveSchema.js +0 -112
- package/dist/esm/utils/setTitleValues.js +0 -21
- package/dist/esm/utils/solveReferences.js +0 -22
- package/dist/types/Form/Form.d.ts +0 -2
- package/dist/types/Form/FormRegistry.d.ts +0 -3
- package/dist/types/Form/components/Clickable.d.ts +0 -15
- package/dist/types/Form/components/ErrorMessage.d.ts +0 -3
- package/dist/types/Form/components/FieldInfo.d.ts +0 -10
- package/dist/types/Form/components/FieldInput.d.ts +0 -19
- package/dist/types/Form/components/Form.d.ts +0 -6
- package/dist/types/Form/components/Icon.d.ts +0 -1
- package/dist/types/Form/components/RequiredIndicator.d.ts +0 -1
- package/dist/types/Form/components/index.d.ts +0 -249
- package/dist/types/Form/fields/AnyField/AnyField.d.ts +0 -2
- package/dist/types/Form/fields/AnyField/index.d.ts +0 -2
- package/dist/types/Form/fields/AnyField/styledComponents.d.ts +0 -3
- package/dist/types/Form/fields/ArrayField/ArrayField.d.ts +0 -2
- package/dist/types/Form/fields/ArrayField/index.d.ts +0 -2
- package/dist/types/Form/fields/ArrayField/styledComponents.d.ts +0 -13
- package/dist/types/Form/fields/BooleanField/BooleanField.d.ts +0 -2
- package/dist/types/Form/fields/BooleanField/index.d.ts +0 -2
- package/dist/types/Form/fields/BooleanField/styledComponents.d.ts +0 -3
- package/dist/types/Form/fields/DateField/DateField.d.ts +0 -2
- package/dist/types/Form/fields/DateField/DateInput.d.ts +0 -17
- package/dist/types/Form/fields/DateField/dateParsing.d.ts +0 -9
- package/dist/types/Form/fields/DateField/index.d.ts +0 -3
- package/dist/types/Form/fields/DateField/styledComponents.d.ts +0 -4
- package/dist/types/Form/fields/FileUploadField/FileUploadField.d.ts +0 -2
- package/dist/types/Form/fields/FileUploadField/FileUploadFieldInput.d.ts +0 -25
- package/dist/types/Form/fields/FileUploadField/index.d.ts +0 -17
- package/dist/types/Form/fields/FileUploadField/styledComponents.d.ts +0 -11
- package/dist/types/Form/fields/FilesUploadField/FilesUploadField.d.ts +0 -2
- package/dist/types/Form/fields/FilesUploadField/FilesUploadFieldInput.d.ts +0 -42
- package/dist/types/Form/fields/FilesUploadField/index.d.ts +0 -37
- package/dist/types/Form/fields/FilesUploadField/styledComponents.d.ts +0 -32
- package/dist/types/Form/fields/MultipleChoiceField/MultipleChoiceField.d.ts +0 -2
- package/dist/types/Form/fields/MultipleChoiceField/MultipleChoiceFieldInput.d.ts +0 -17
- package/dist/types/Form/fields/MultipleChoiceField/index.d.ts +0 -22
- package/dist/types/Form/fields/MultipleChoiceField/styledComponents.d.ts +0 -16
- package/dist/types/Form/fields/NullField/NullField.d.ts +0 -2
- package/dist/types/Form/fields/NullField/index.d.ts +0 -1
- package/dist/types/Form/fields/NumberField/NumberField.d.ts +0 -2
- package/dist/types/Form/fields/NumberField/index.d.ts +0 -2
- package/dist/types/Form/fields/NumberField/styledComponents.d.ts +0 -1
- package/dist/types/Form/fields/ObjectField/ObjectField.d.ts +0 -2
- package/dist/types/Form/fields/ObjectField/ObjectFieldSection.d.ts +0 -3
- package/dist/types/Form/fields/ObjectField/index.d.ts +0 -20
- package/dist/types/Form/fields/ObjectField/styledComponents.d.ts +0 -15
- package/dist/types/Form/fields/ObjectField/types.d.ts +0 -19
- package/dist/types/Form/fields/RadioField/RadioField.d.ts +0 -2
- package/dist/types/Form/fields/RadioField/RadioFieldInput.d.ts +0 -11
- package/dist/types/Form/fields/RadioField/index.d.ts +0 -22
- package/dist/types/Form/fields/RadioField/styledComponents.d.ts +0 -16
- package/dist/types/Form/fields/SchemaField/SchemaField.d.ts +0 -2
- package/dist/types/Form/fields/SchemaField/index.d.ts +0 -1
- package/dist/types/Form/fields/SearchableMultiTagSelectField/SearchableMultiTagSelectField.d.ts +0 -2
- package/dist/types/Form/fields/SearchableMultiTagSelectField/SearchableMultiTagSelectFieldInput.d.ts +0 -11
- package/dist/types/Form/fields/SearchableMultiTagSelectField/index.d.ts +0 -21
- package/dist/types/Form/fields/SearchableMultiTagSelectField/styledComponents.d.ts +0 -15
- package/dist/types/Form/fields/SearchableSelectField/SearchableSelectField.d.ts +0 -2
- package/dist/types/Form/fields/SearchableSelectField/index.d.ts +0 -2
- package/dist/types/Form/fields/SearchableSelectField/styledComponents.d.ts +0 -22
- package/dist/types/Form/fields/SearchableSelectField/types.d.ts +0 -25
- package/dist/types/Form/fields/StringField/StringField.d.ts +0 -2
- package/dist/types/Form/fields/StringField/index.d.ts +0 -1
- package/dist/types/Form/fields/StringField/styledComponents.d.ts +0 -3
- package/dist/types/Form/fields/TextAreaField/TextAreaField.d.ts +0 -2
- package/dist/types/Form/fields/TextAreaField/index.d.ts +0 -2
- package/dist/types/Form/fields/TextAreaField/styledComponents.d.ts +0 -5
- package/dist/types/Form/fields/ToggleField/ToggleField.d.ts +0 -2
- package/dist/types/Form/fields/ToggleField/ToggleFieldInput.d.ts +0 -6
- package/dist/types/Form/fields/ToggleField/index.d.ts +0 -13
- package/dist/types/Form/fields/ToggleField/styledComponents.d.ts +0 -7
- package/dist/types/Form/fields/index.d.ts +0 -191
- package/dist/types/Form/hooks/index.d.ts +0 -1
- package/dist/types/Form/hooks/useSetDefault.d.ts +0 -2
- package/dist/types/Form/index.d.ts +0 -8
- package/dist/types/Form/styles/common.d.ts +0 -2
- package/dist/types/Form/templates/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +0 -2
- package/dist/types/Form/templates/ArrayFieldTemplate/index.d.ts +0 -2
- package/dist/types/Form/templates/ArrayFieldTemplate/styledComponents.d.ts +0 -30
- package/dist/types/Form/templates/CollapsibleObjectFieldTemplate/CollapsibleObjectFieldTemplate.d.ts +0 -2
- package/dist/types/Form/templates/CollapsibleObjectFieldTemplate/index.d.ts +0 -2
- package/dist/types/Form/templates/CollapsibleObjectFieldTemplate/styledComponents.d.ts +0 -36
- package/dist/types/Form/templates/FieldTemplate/FieldTemplate.d.ts +0 -2
- package/dist/types/Form/templates/FieldTemplate/index.d.ts +0 -1
- package/dist/types/Form/templates/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +0 -2
- package/dist/types/Form/templates/ObjectFieldTemplate/index.d.ts +0 -2
- package/dist/types/Form/templates/ObjectFieldTemplate/styledComponents.d.ts +0 -27
- package/dist/types/Form/templates/index.d.ts +0 -57
- package/dist/types/Form/types/FormRegistryContext.d.ts +0 -23
- package/dist/types/Form/types/index.d.ts +0 -1
- package/dist/types/FormView/FormView.d.ts +0 -4
- package/dist/types/FormView/FormViewRegistry.d.ts +0 -3
- package/dist/types/FormView/components/Field.d.ts +0 -35
- package/dist/types/FormView/components/Form.d.ts +0 -1
- package/dist/types/FormView/components/Icon.d.ts +0 -1
- package/dist/types/FormView/components/index.d.ts +0 -53
- package/dist/types/FormView/fields/AnyField.d.ts +0 -2
- package/dist/types/FormView/fields/ArrayField.d.ts +0 -2
- package/dist/types/FormView/fields/BooleanField.d.ts +0 -2
- package/dist/types/FormView/fields/DateField.d.ts +0 -2
- package/dist/types/FormView/fields/EJSField.d.ts +0 -2
- package/dist/types/FormView/fields/FileUploadField.d.ts +0 -2
- package/dist/types/FormView/fields/FilesUploadField.d.ts +0 -2
- package/dist/types/FormView/fields/MultipleChoiceField.d.ts +0 -2
- package/dist/types/FormView/fields/NullField.d.ts +0 -2
- package/dist/types/FormView/fields/NumberField.d.ts +0 -2
- package/dist/types/FormView/fields/ObjectField/ObjectField.d.ts +0 -2
- package/dist/types/FormView/fields/ObjectField/ObjectFieldSection.d.ts +0 -7
- package/dist/types/FormView/fields/ObjectField/index.d.ts +0 -8
- package/dist/types/FormView/fields/ObjectField/styledComponents.d.ts +0 -2
- package/dist/types/FormView/fields/RadioField.d.ts +0 -2
- package/dist/types/FormView/fields/SchemaField.d.ts +0 -2
- package/dist/types/FormView/fields/SearchableMultiTagSelectField.d.ts +0 -2
- package/dist/types/FormView/fields/SearchableSelectField.d.ts +0 -2
- package/dist/types/FormView/fields/StringField.d.ts +0 -2
- package/dist/types/FormView/fields/TextAreaField.d.ts +0 -2
- package/dist/types/FormView/fields/ToggleField.d.ts +0 -2
- package/dist/types/FormView/fields/index.d.ts +0 -9
- package/dist/types/FormView/index.d.ts +0 -7
- package/dist/types/FormView/templates/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +0 -2
- package/dist/types/FormView/templates/ArrayFieldTemplate/index.d.ts +0 -2
- package/dist/types/FormView/templates/ArrayFieldTemplate/styledComponents.d.ts +0 -10
- package/dist/types/FormView/templates/FieldTemplate/FieldTemplate.d.ts +0 -2
- package/dist/types/FormView/templates/FieldTemplate/index.d.ts +0 -1
- package/dist/types/FormView/templates/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +0 -2
- package/dist/types/FormView/templates/ObjectFieldTemplate/index.d.ts +0 -2
- package/dist/types/FormView/templates/ObjectFieldTemplate/styledComponents.d.ts +0 -10
- package/dist/types/FormView/templates/index.d.ts +0 -23
- package/dist/types/FormView/types/FormViewRegistryContext.d.ts +0 -21
- package/dist/types/FormView/types/index.d.ts +0 -1
- package/dist/types/common/FileUploadContext.d.ts +0 -18
- package/dist/types/common/FilesUploadContext.d.ts +0 -17
- package/dist/types/common/constants.d.ts +0 -10
- package/dist/types/common/index.d.ts +0 -4
- package/dist/types/styles/types.d.ts +0 -216
- package/dist/types/utils/createInitialValues.d.ts +0 -7
- package/dist/types/utils/createValidationSchema.d.ts +0 -31
- package/dist/types/utils/deepOverlap.d.ts +0 -1
- package/dist/types/utils/extractUiSchema.d.ts +0 -9
- package/dist/types/utils/getEnums.d.ts +0 -30
- package/dist/types/utils/getHiddenProperties.d.ts +0 -2
- package/dist/types/utils/getStyle.d.ts +0 -5
- package/dist/types/utils/getTitleAndDescription.d.ts +0 -12
- package/dist/types/utils/getTypes.d.ts +0 -5
- package/dist/types/utils/immutablySwapItems.d.ts +0 -1
- package/dist/types/utils/index.d.ts +0 -15
- package/dist/types/utils/mergeSchemas.d.ts +0 -1
- package/dist/types/utils/orderAdditionalProperties.d.ts +0 -2
- package/dist/types/utils/orderByUiSchema.d.ts +0 -2
- package/dist/types/utils/resolveSchema.d.ts +0 -4
- package/dist/types/utils/setTitleValues.d.ts +0 -1
- package/dist/types/utils/solveReferences.d.ts +0 -10
- /package/dist/cjs/{Form/fields/SearchableSelectField/types.js → common/types/Utils.js} +0 -0
- /package/dist/cjs/{styles → v3/raw/dom}/types.js +0 -0
- /package/dist/cjs/{Form/types/FormRegistryContext.js → v3/raw/model/form/types.js} +0 -0
- /package/dist/cjs/{FormView/types/FormViewRegistryContext.js → v3/raw/model/host.js} +0 -0
- /package/dist/cjs/{FormView/types/index.js → v3/raw/model/view/types.js} +0 -0
- /package/dist/esm/{Form/fields/SearchableSelectField/types.js → common/types/Utils.js} +0 -0
- /package/dist/esm/{styles → v3/raw/dom}/types.js +0 -0
- /package/dist/esm/{Form/types/FormRegistryContext.js → v3/raw/model/form/types.js} +0 -0
- /package/dist/esm/{FormView/types/FormViewRegistryContext.js → v3/raw/model/host.js} +0 -0
- /package/dist/esm/{FormView/types/index.js → v3/raw/model/view/types.js} +0 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { isPlainObject } from "../../core/json";
|
|
2
|
+
import { filterUiProps } from "../../core/uiProps";
|
|
3
|
+
import { extractUiSchema } from "../../core/uiSchema";
|
|
4
|
+
import { h } from "../vnode";
|
|
5
|
+
import { reactText, textOf } from "../view/values";
|
|
6
|
+
import { formChrome } from "./chrome";
|
|
7
|
+
import { iconMarkup } from "./icons";
|
|
8
|
+
import { fc, fieldTemplateMarkup } from "./markup";
|
|
9
|
+
import { templated } from "./templated";
|
|
10
|
+
/** 2.x FilesUploadField: the files of a stored value (uploaded, so progress 100). */
|
|
11
|
+
export const filesOf = (value) => Array.isArray(value)
|
|
12
|
+
? value.filter(isPlainObject).map((f) => ({ name: reactText(f.name), id: f.id ?? null, progressId: String(f.id), mimeType: typeof f.mimeType === "string" ? f.mimeType : undefined, size: typeof f.size === "number" ? f.size : undefined }))
|
|
13
|
+
: [];
|
|
14
|
+
const field = (ctx, p, content) => templated(ctx, "FieldTemplate", p, fieldTemplateMarkup(formChrome(ctx, p), content), content);
|
|
15
|
+
const progressStyle = (n) => `--fjsf-progress:${Math.max(0, Math.min(100, Number(n) || 0))}%`;
|
|
16
|
+
export const fileUploadMarkup = (ctx, p, s) => {
|
|
17
|
+
const props = { ...p, data: { "data-fjsf-object": p.name }, kind: "file" };
|
|
18
|
+
const ui = p.ui ?? {};
|
|
19
|
+
const inputProps = extractUiSchema(ui).props ?? {};
|
|
20
|
+
const remove = isPlainObject(ui["ui:removeButton"]) ? ui["ui:removeButton"] : undefined;
|
|
21
|
+
const removeStyle = ["color:red", "font-weight:bold", filterUiProps({ style: remove?.props?.style ?? {} }).attrs.style].filter(Boolean).join(";");
|
|
22
|
+
const name = reactText(s.uploadedFile?.name);
|
|
23
|
+
// Q-FU-1: a readOnly single upload can neither choose, upload nor remove (2.x ignored readOnly here).
|
|
24
|
+
const readOnly = p.schema?.readOnly === true;
|
|
25
|
+
const item = s.uploadedFile && s.value
|
|
26
|
+
? fc(["FileUploadFieldFileItemContainer"], {}, h("span", {}, name), s.progress === 100
|
|
27
|
+
? inputProps?.removeButton?.hidden || readOnly
|
|
28
|
+
? null
|
|
29
|
+
: { ...fc(["FileUploadFieldRemoveButton"], { ...filterUiProps({ ...(remove?.props ?? {}), style: undefined }).attrs, type: "button", style: removeStyle }, textOf(remove?.content) ?? "X"), on: { click: { type: "fileRemove" } } }
|
|
30
|
+
: fc(["FileUploadFieldProgressBarContainer"], {}, fc(["FileUploadFieldProgressBar"], { style: progressStyle(s.progress) }), fc(["FileUploadFieldProgressText"], {}, `${s.progress}%`)))
|
|
31
|
+
: null;
|
|
32
|
+
const content = fc(["FileUploadFieldContainer"], {}, h("div", {}, { ...fc(["FileUploadFieldFileUploadButton"], { type: "button", disabled: readOnly || undefined }, reactText(ui["ui:uploadButtonText"]) || "Choose File"), on: { click: { type: "filePick", id: p.name, locked: readOnly } } }, { ...fc(["FileUploadFieldHiddenFileInput"], { id: p.name, name: p.name, type: "file", disabled: readOnly || undefined }), on: readOnly ? {} : { change: { type: "fileChosen" } } }, !s.value ? fc(["FileUploadFieldFileInfoText"], {}, reactText(ui["ui:infoText"]) || "No file chosen") : null), item);
|
|
33
|
+
return field(ctx, props, [content]);
|
|
34
|
+
};
|
|
35
|
+
/** 2.x getFileIcon: the icon of a MIME type. */
|
|
36
|
+
const ICON_BY_TYPE = [
|
|
37
|
+
["pdf", "FaFilePdf"], ["audio", "FaFileAudio"], ["image", "FaFileImage"], ["csv", "FaFileCsv"], ["wordprocessingml.document", "FaFileWord"], ["msword", "FaFileWord"],
|
|
38
|
+
["vnd.ms-excel", "FaFileExcel"], ["vnd.openxmlformats-officedocument.spreadsheetml.sheet", "FaFileExcel"], ["vnd.ms-powerpoint", "FaFilePowerpoint"],
|
|
39
|
+
["vnd.openxmlformats-officedocument.presentationml.presentation", "FaFilePowerpoint"], ["javascript", "FaFileCode"], ["html", "FaFileCode"], ["css", "FaFileCode"],
|
|
40
|
+
];
|
|
41
|
+
const iconFor = (mime) => ICON_BY_TYPE.find(([key]) => mime.includes(key))?.[1] ?? "FaFile";
|
|
42
|
+
export const filesLocalization = (ctx, ui) => ({
|
|
43
|
+
deleteFileAriaLabel: "Delete this file", infoText: "Drag and drop file(s) here", orText: "or", uploadButtonText: "Upload file",
|
|
44
|
+
fileInfoText: "Supported formats: PNG, JPG, PDF | Maximum size: 25MB", infoTextSingle: undefined, removeButton: undefined,
|
|
45
|
+
...(isPlainObject(ctx.formLocalization?.fields?.FilesUploadField) ? ctx.formLocalization.fields.FilesUploadField : {}),
|
|
46
|
+
...(isPlainObject(ui?.["ui:localization"]) ? ui["ui:localization"] : {}),
|
|
47
|
+
});
|
|
48
|
+
export const filesUploadMarkup = (ctx, p, s) => {
|
|
49
|
+
const readOnly = p.schema?.readOnly === true;
|
|
50
|
+
if (readOnly && (!Array.isArray(s.value) || s.value.length === 0))
|
|
51
|
+
return null; // 2.x returned null
|
|
52
|
+
const props = { ...p, data: { "data-fjsf-object": p.name }, kind: "files" };
|
|
53
|
+
const ip = extractUiSchema(p.ui).props ?? {};
|
|
54
|
+
const l = filesLocalization(ctx, p.ui);
|
|
55
|
+
const multiple = ip.allowMultipleFiles ?? true;
|
|
56
|
+
const hideUpload = (!multiple && s.files.length > 0) || readOnly;
|
|
57
|
+
const info = multiple ? l.infoText : l.infoTextSingle;
|
|
58
|
+
const file = (f) => s.progress[f.progressId] === 100
|
|
59
|
+
? fc(["UploadedFileItemContainer"], {}, fc(["UploadedFileInfoContainer"], {}, ip.fileTypeIcon?.hidden ? null : fc(["FileTypeIcon"], {}, iconMarkup(iconFor(f.mimeType ?? ""))), fc(["UploadedFileName"], {}, f.name, ip.fileSize?.hidden ? null : fc(["FileSize"], {}, ` | ${f.size ? (f.size / (1024 * 1024)).toFixed(3) : "?"} MB`))), !ip.removeButton?.hidden && !readOnly && f.id
|
|
60
|
+
? { ...fc(["RemoveButton"], { "aria-label": reactText(l.deleteFileAriaLabel) || "Delete file", type: "button", ...filterUiProps(l.removeButton?.props ?? {}).attrs }, textOf(l.removeButton?.content) ?? iconMarkup("FaTrash", "fjsf-RemoveButtonIcon")), on: { click: { type: "filesRemove", progressId: f.progressId } } }
|
|
61
|
+
: null)
|
|
62
|
+
: fc(["FileItemContainer"], {}, fc(["UploadingFileName"], {}, f.name), fc(["ProgressBarContainer"], {}, fc(["ProgressBar"], { style: progressStyle(s.progress[f.progressId]) })));
|
|
63
|
+
const browse = (names, extra = {}) => ({ ...fc(names, { "aria-label": reactText(l.uploadButtonText) || "Browse files", ...extra }, reactText(l.uploadButtonText) || "Browse files"), on: { click: { type: "filePick", id: p.name, locked: readOnly } } });
|
|
64
|
+
const accept = Array.isArray(ip.acceptedFiletypes) ? ip.acceptedFiletypes.join(",") : typeof ip.acceptedFiletypes === "string" ? ip.acceptedFiletypes : undefined;
|
|
65
|
+
const content = {
|
|
66
|
+
...fc(["FileUploadFieldContainer"], {}, s.dragging && !hideUpload ? fc(["DragOverlay"], {}, reactText(info)) : null, s.files.map((f) => fc(["UploadedFileWrapper"], {}, file(f))), s.files.length === 0
|
|
67
|
+
? [
|
|
68
|
+
ip.uploadIcon?.hidden ? null : iconMarkup("FaCloudUploadAlt", "fjsf-UploadIcon"),
|
|
69
|
+
info ? fc(["InfoText"], {}, reactText(info)) : null,
|
|
70
|
+
fc(["Divider"], {}, fc(["DividerText"], {}, reactText(l.orText) || "or")),
|
|
71
|
+
browse(["FileUploadButton"], { type: "button", disabled: readOnly || undefined }),
|
|
72
|
+
l.fileInfoText ? fc(["FileInfoText"], {}, reactText(l.fileInfoText)) : null,
|
|
73
|
+
]
|
|
74
|
+
: [
|
|
75
|
+
info && !hideUpload ? fc(["InfoText"], {}, `${reactText(info)} ${reactText(l.orText) || "or"} `, browse(["FileUploadText"])) : null,
|
|
76
|
+
l.fileInfoText && !hideUpload ? fc(["FileInfoTextMinimized"], {}, reactText(l.fileInfoText)) : null,
|
|
77
|
+
], hideUpload ? null : { ...fc(["HiddenFileInput"], { multiple: multiple || undefined, accept, id: p.name, name: p.name, type: "file", disabled: readOnly || undefined }), on: { change: { type: "filesChosen" } } }),
|
|
78
|
+
on: { dragenter: { type: "filesDrag", enter: true }, dragleave: { type: "filesDrag", enter: false }, dragover: { type: "filesDrag" }, drop: { type: "filesDrop" } },
|
|
79
|
+
};
|
|
80
|
+
return field(ctx, props, [content]);
|
|
81
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// GENERATED by src/v3/__styles__/generate.test.tsx (`npm run styles`) from the 2.x styled-components: do not edit.
|
|
2
|
+
// P7 (§4.3): a 2.x styled component that extends another carries its bases' classes too, bases first.
|
|
3
|
+
export const STYLED_CHAINS = {
|
|
4
|
+
"fjsf-AnyFieldWrapper": ["fjsf-CommonFieldWrapper", "fjsf-AnyFieldWrapper"],
|
|
5
|
+
"fjsf-ArrayFieldAddButton": ["fjsf-ObjectFieldButton", "fjsf-ArrayFieldButton", "fjsf-ArrayFieldAddButton"],
|
|
6
|
+
"fjsf-ArrayFieldButton": ["fjsf-ObjectFieldButton", "fjsf-ArrayFieldButton"],
|
|
7
|
+
"fjsf-ArrayFieldDownButton": ["fjsf-ObjectFieldButton", "fjsf-ArrayFieldButton", "fjsf-ArrayFieldLineButton", "fjsf-ArrayFieldDownButton"],
|
|
8
|
+
"fjsf-ArrayFieldItem": ["fjsf-ObjectFieldItem", "fjsf-ArrayFieldItem"],
|
|
9
|
+
"fjsf-ArrayFieldLineButton": ["fjsf-ObjectFieldButton", "fjsf-ArrayFieldButton", "fjsf-ArrayFieldLineButton"],
|
|
10
|
+
"fjsf-ArrayFieldRemoveButton": ["fjsf-ObjectFieldButton", "fjsf-ArrayFieldButton", "fjsf-ArrayFieldLineButton", "fjsf-ArrayFieldRemoveButton"],
|
|
11
|
+
"fjsf-ArrayFieldUpButton": ["fjsf-ObjectFieldButton", "fjsf-ArrayFieldButton", "fjsf-ArrayFieldLineButton", "fjsf-ArrayFieldUpButton"],
|
|
12
|
+
"fjsf-BooleanFieldWrapper": ["fjsf-CommonCheckboxStyles", "fjsf-BooleanFieldWrapper"],
|
|
13
|
+
"fjsf-CollapsibleObjectFieldTemplateTitle": ["fjsf-ObjectFieldTemplateTitle", "fjsf-CollapsibleObjectFieldTemplateTitle"],
|
|
14
|
+
"fjsf-MultipleChoiceFieldContainer": ["fjsf-CommonCheckboxStyles", "fjsf-RadioFieldContainer", "fjsf-MultipleChoiceFieldContainer"],
|
|
15
|
+
"fjsf-MultipleChoiceFieldElement": ["fjsf-RadioFieldElement", "fjsf-MultipleChoiceFieldElement"],
|
|
16
|
+
"fjsf-MultipleChoiceFieldInputElement": ["fjsf-FieldInput", "fjsf-RadioFieldInputElement", "fjsf-MultipleChoiceFieldInputElement"],
|
|
17
|
+
"fjsf-MultipleChoiceFieldLabel": ["fjsf-RadioFieldLabel", "fjsf-MultipleChoiceFieldLabel"],
|
|
18
|
+
"fjsf-ObjectFieldAddButton": ["fjsf-ObjectFieldButton", "fjsf-ObjectFieldAddButton"],
|
|
19
|
+
"fjsf-ObjectFieldDownButton": ["fjsf-ObjectFieldButton", "fjsf-ObjectFieldDownButton"],
|
|
20
|
+
"fjsf-ObjectFieldRemoveButton": ["fjsf-ObjectFieldButton", "fjsf-ObjectFieldRemoveButton"],
|
|
21
|
+
"fjsf-ObjectFieldUpButton": ["fjsf-ObjectFieldButton", "fjsf-ObjectFieldUpButton"],
|
|
22
|
+
"fjsf-ObjectFieldWrapper": ["fjsf-CommonFieldWrapper", "fjsf-ObjectFieldWrapper"],
|
|
23
|
+
"fjsf-RadioFieldContainer": ["fjsf-CommonCheckboxStyles", "fjsf-RadioFieldContainer"],
|
|
24
|
+
"fjsf-RadioFieldInputElement": ["fjsf-FieldInput", "fjsf-RadioFieldInputElement"],
|
|
25
|
+
"fjsf-RadioFieldLabelFalse": ["fjsf-RadioFieldLabel", "fjsf-RadioFieldLabelFalse"],
|
|
26
|
+
"fjsf-RadioFieldLabelTrue": ["fjsf-RadioFieldLabel", "fjsf-RadioFieldLabelTrue"],
|
|
27
|
+
"fjsf-SearchableMultiTagSelectFieldContainer": ["fjsf-CommonFieldWrapper", "fjsf-SearchableMultiTagSelectFieldContainer"],
|
|
28
|
+
"fjsf-SearchableMultiTagSelectFieldInputElement": ["fjsf-FieldInput", "fjsf-SearchableMultiTagSelectFieldInputElement"],
|
|
29
|
+
"fjsf-SearchableSelectFieldContainer": ["fjsf-SearchableMultiTagSelectFieldSearchContainer", "fjsf-SearchableSelectFieldContainer"],
|
|
30
|
+
"fjsf-SearchableSelectFieldDropdownContainer": ["fjsf-SearchableMultiTagSelectFieldOptionList", "fjsf-SearchableSelectFieldDropdownContainer"],
|
|
31
|
+
"fjsf-SearchableSelectFieldInputElement": ["fjsf-FieldInput", "fjsf-SearchableSelectFieldInputElement"],
|
|
32
|
+
"fjsf-SearchableSelectFieldListExpand": ["fjsf-SearchableMultiTagSelectFieldOptionListItem", "fjsf-SearchableSelectFieldListExpand"],
|
|
33
|
+
"fjsf-SearchableSelectFieldListOption": ["fjsf-SearchableMultiTagSelectFieldOptionListItem", "fjsf-SearchableSelectFieldListOption"],
|
|
34
|
+
"fjsf-SearchableSelectFieldNotFound": ["fjsf-SearchableMultiTagSelectFieldOptionListItem", "fjsf-SearchableSelectFieldNotFound"],
|
|
35
|
+
"fjsf-SelectFieldInput": ["fjsf-FieldInput", "fjsf-SelectFieldInput"],
|
|
36
|
+
"fjsf-SelectFieldInputWrapper": ["fjsf-CommonFieldWrapper", "fjsf-SelectFieldInputWrapper"],
|
|
37
|
+
"fjsf-StringFieldWrapper": ["fjsf-CommonFieldWrapper", "fjsf-StringFieldWrapper"],
|
|
38
|
+
"fjsf-TextAreaFieldInput": ["fjsf-FieldInput", "fjsf-TextAreaFieldInput"],
|
|
39
|
+
"fjsf-ToggleFieldInputElement": ["fjsf-FieldInput", "fjsf-ToggleFieldInputElement"],
|
|
40
|
+
};
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { EnumsTypes, getEnums } from "../../core/enums";
|
|
2
|
+
import { ignoreIssues, issue } from "../../core/issues";
|
|
3
|
+
import { isPlainObject, PROTOTYPE_KEYS } from "../../core/json";
|
|
4
|
+
import { getIn } from "../../core/paths";
|
|
5
|
+
import { FILE_UPLOAD_VIEW } from "../../core/policies/fileUploadView";
|
|
6
|
+
import { resolveRefs } from "../../core/refs";
|
|
7
|
+
import { mayEnter } from "../../core/trail";
|
|
8
|
+
import { resolveSchema } from "../../core/conditionals";
|
|
9
|
+
import { getSchemaType, guessType } from "../../core/schemaType";
|
|
10
|
+
import { extractUiSchema, orderByUiSchema } from "../../core/uiSchema";
|
|
11
|
+
import { booleanField, chrome, choicesField, fieldAttrs, nullField, slotField, textAreaField, textField } from "./fields";
|
|
12
|
+
import { reactAttr, reactText } from "./values";
|
|
13
|
+
const COMPONENT_TYPES = {
|
|
14
|
+
array: "ArrayField", boolean: "BooleanField", integer: "NumberField", number: "NumberField",
|
|
15
|
+
object: "ObjectField", string: "StringField", null: "NullField", any: "AnyField",
|
|
16
|
+
};
|
|
17
|
+
const BUILT_IN = new Set([...Object.values(COMPONENT_TYPES), "DateField", "FilesUploadField", "FileUploadField",
|
|
18
|
+
"MultipleChoiceField", "RadioField", "SearchableSelectField", "SearchableMultiTagSelectField", "TextAreaField", "ToggleField"]);
|
|
19
|
+
/** 2.x FormView SchemaField: resolve refs, pick the field (ui:field, then type), render it. */
|
|
20
|
+
export const schemaField = (name, given, givenUi, ctx, kindProp, chain = [], trail = []) => {
|
|
21
|
+
// SEC-REF-2 / SEC-REN-1: properties are rendered eagerly, so a $ref already being expanded
|
|
22
|
+
// above is a cycle (2.x hung). Array items are bounded by the data and start a new chain.
|
|
23
|
+
const ref = isPlainObject(given) && typeof given.$ref === "string" ? given.$ref : undefined;
|
|
24
|
+
if (ref && chain.includes(ref)) {
|
|
25
|
+
ctx.sink(issue("REF_CYCLE", name, ref));
|
|
26
|
+
return nullField(name, given, givenUi, "error");
|
|
27
|
+
}
|
|
28
|
+
const nextChain = ref ? [...chain, ref] : chain;
|
|
29
|
+
const { schema, uiSchema: ui } = given === undefined
|
|
30
|
+
? { schema: undefined, uiSchema: givenUi }
|
|
31
|
+
: resolveRefs(given, givenUi, { definitions: ctx.definitions, defs: ctx.defs, uiSchemaDefinitions: ctx.uiDefinitions, sink: ctx.sink, path: name });
|
|
32
|
+
const field = extractUiSchema(ui).field;
|
|
33
|
+
let component;
|
|
34
|
+
// A component `ui:field` (2.x: `typeof field === "function"`) is provided by the host.
|
|
35
|
+
if (typeof field === "function")
|
|
36
|
+
return slotField(name, schema, ui, "", nextChain);
|
|
37
|
+
if (typeof field === "string" && ctx.customFields.includes(field))
|
|
38
|
+
return slotField(name, schema, ui, field, nextChain);
|
|
39
|
+
if (typeof field === "string" && BUILT_IN.has(field))
|
|
40
|
+
component = field;
|
|
41
|
+
else {
|
|
42
|
+
let type = getSchemaType(schema);
|
|
43
|
+
if (Array.isArray(type))
|
|
44
|
+
type = type[0];
|
|
45
|
+
component = COMPONENT_TYPES[type || "any"];
|
|
46
|
+
if (!component) {
|
|
47
|
+
ctx.sink(issue("SCHEMA_UNSUPPORTED_TYPE", name, String(type)));
|
|
48
|
+
return { render: "unsupported", text: '!!! Unsupported field "" !!!' };
|
|
49
|
+
}
|
|
50
|
+
// A built-in the host replaced (`fields: {StringField: Mine}`) renders the host's field.
|
|
51
|
+
if (ctx.customFields.includes(component))
|
|
52
|
+
return slotField(name, schema, ui, component, nextChain);
|
|
53
|
+
}
|
|
54
|
+
return componentField(component, name, schema, ui, ctx, kindProp, nextChain, trail);
|
|
55
|
+
};
|
|
56
|
+
/** One built-in field by name (2.x `FormViewFields.X`), without the SchemaField dispatch. */
|
|
57
|
+
export const componentField = (component, name, schema, ui, ctx, kindProp, nextChain = [], trail = []) => {
|
|
58
|
+
switch (component) {
|
|
59
|
+
case "ObjectField":
|
|
60
|
+
// BUG-110: an object schema that contains itself, or nests too deep, is cut with a code
|
|
61
|
+
if (!mayEnter(schema, trail, ctx.sink, name))
|
|
62
|
+
return nullField(name, schema, ui, "error");
|
|
63
|
+
return objectField(name, schema, ui, ctx, nextChain, [...trail, schema]);
|
|
64
|
+
case "ArrayField": return arrayField(name, schema, ui, ctx, kindProp);
|
|
65
|
+
case "SearchableMultiTagSelectField": return arrayField(name, schema, ui, ctx, "searchable-multi");
|
|
66
|
+
case "NumberField":
|
|
67
|
+
case "StringField": return textField(name, schema, ui, kindProp, ctx);
|
|
68
|
+
case "DateField": return textField(name, schema, ui, "date", ctx);
|
|
69
|
+
case "SearchableSelectField": return textField(name, schema, ui, "searchable", ctx);
|
|
70
|
+
case "TextAreaField": return textAreaField(name, schema, ui, ctx);
|
|
71
|
+
case "BooleanField": return booleanField(name, schema, ui, kindProp ?? "boolean", ctx);
|
|
72
|
+
case "RadioField": return booleanField(name, schema, ui, "radio", ctx);
|
|
73
|
+
case "ToggleField": return booleanField(name, schema, ui, "toggle", ctx);
|
|
74
|
+
case "MultipleChoiceField": return choicesField(name, schema, ui, ctx);
|
|
75
|
+
case "NullField": return nullField(name, schema, ui);
|
|
76
|
+
case "AnyField": return anyField(name, schema, ui, ctx);
|
|
77
|
+
case "SchemaField": return schemaField(name, schema, ui, ctx, kindProp, nextChain, trail);
|
|
78
|
+
default: return fileUploadField(name, component, ctx); // FileUploadField / FilesUploadField
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
// Q-FV-2: 2.x FormView returned the bare string "TODO" for both file fields.
|
|
82
|
+
const fileUploadField = (name, component, ctx) => {
|
|
83
|
+
if (ctx.fileUploadView === "todo")
|
|
84
|
+
return { render: "plain", text: "TODO" };
|
|
85
|
+
ctx.sink(issue("FIELD_UNKNOWN", name, component));
|
|
86
|
+
return { render: "none" };
|
|
87
|
+
};
|
|
88
|
+
const child = (name, key) => (name ? `${name}.${key}` : key);
|
|
89
|
+
const objectField = (name, schema, ui, ctx, chain, trail) => {
|
|
90
|
+
const [resolved] = resolveSchema(schema, getIn(ctx.values, name));
|
|
91
|
+
const properties = (isPlainObject(resolved.properties) ? resolved.properties : {});
|
|
92
|
+
const node = (key) => {
|
|
93
|
+
if (PROTOTYPE_KEYS.has(key)) {
|
|
94
|
+
ctx.sink(issue("KEY_REJECTED", child(name, key)));
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
if (!(key in properties) || !Object.prototype.hasOwnProperty.call(properties, key))
|
|
98
|
+
return undefined;
|
|
99
|
+
const s = properties[key];
|
|
100
|
+
if (!s)
|
|
101
|
+
return undefined; // 2.x ObjectField: a falsy property schema (`false`) is not rendered; `true` is an untyped field
|
|
102
|
+
return schemaField(child(name, key), (isPlainObject(s) ? s : {}), ui?.[key], ctx, undefined, chain, trail);
|
|
103
|
+
};
|
|
104
|
+
const props = (key) => ({ key, name: child(name, key), schema: isPlainObject(properties[key]) ? properties[key] : {}, uiSchema: ui?.[key] });
|
|
105
|
+
const children = [];
|
|
106
|
+
const childFields = [];
|
|
107
|
+
for (const entry of orderByUiSchema(ui?.["ui:order"], Object.keys(properties))) {
|
|
108
|
+
if (typeof entry === "string") {
|
|
109
|
+
const n = node(entry);
|
|
110
|
+
if (n) {
|
|
111
|
+
children.push(n);
|
|
112
|
+
childFields.push(props(entry));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else if (entry && Array.isArray(entry.fields)) {
|
|
116
|
+
const built = entry.fields.map((k) => [k, node(k)]).filter((pair) => !!pair[1]);
|
|
117
|
+
children.push({ render: "section", title: String(entry.title ?? ""), children: built.map(([, n]) => n) });
|
|
118
|
+
childFields.push({ section: String(entry.title ?? ""), fields: built.map(([k]) => props(k)) });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const base = chrome(name, "object", schema, ui, ctx.sink);
|
|
122
|
+
return { render: "object", ...base, attrs: { ...base.attrs, "data-fjsf-object": name || "ROOT", "data-fjsf-level": String(name ? name.split(".").length : 0) }, children, childFields, chain };
|
|
123
|
+
};
|
|
124
|
+
const arrayField = (name, schema, ui, ctx, kindProp) => {
|
|
125
|
+
const value = getIn(ctx.values, name);
|
|
126
|
+
const kind = kindProp ?? (schema?.anyOf === undefined ? "array" : getEnums({ schema }, ctx.sink, name)?.type === EnumsTypes.MULTI_SELECT ? "multi-enum" : "enum");
|
|
127
|
+
const additional = schema?.additionalItems;
|
|
128
|
+
// 2.x renders object items with additionalItems; v3 falls back to a single `items` schema (Q-FV-1).
|
|
129
|
+
const objectItemSchema = typeof additional === "boolean" ? {} : isPlainObject(additional) ? additional : isPlainObject(schema?.items) ? schema.items : undefined;
|
|
130
|
+
const enums = getEnums({ schema: additional ? (isPlainObject(additional) ? additional : {}) : schema }, ctx.sink, name);
|
|
131
|
+
const label = (item) => (enums !== undefined ? reactText(enums.values.find((e) => e?.const === item)?.title ?? "") : reactText(item));
|
|
132
|
+
// BUG-109: a non-array value is shown as one plain item (2.x: `items.map` crashed); falsy shows nothing.
|
|
133
|
+
const values = Array.isArray(value) ? value : value && !isPlainObject(value) ? [value] : [];
|
|
134
|
+
const items = values.map((item, index) => item !== null && typeof item === "object"
|
|
135
|
+
? { node: schemaField(`${name}[${index}]`, objectItemSchema, ui?.[index] || ui?.items, ctx) }
|
|
136
|
+
: { keyword: reactAttr(item), text: label(item) });
|
|
137
|
+
return { render: "array", ...chrome(name, kind, schema, ui, ctx.sink), items, values };
|
|
138
|
+
};
|
|
139
|
+
const anyField = (name, schema, ui, ctx) => {
|
|
140
|
+
const value = getIn(ctx.values, name);
|
|
141
|
+
const type = value !== undefined ? guessType(value) : "string";
|
|
142
|
+
const extra = type === "object" ? { additionalProperties: {} } : type === "array" ? { additionalItems: {} } : {};
|
|
143
|
+
const enriched = { ...(schema || {}), type, ...extra };
|
|
144
|
+
return { render: "any", path: name, attrs: fieldAttrs(name, "any", schema), type, child: schemaField(name, enriched, ui, ctx) };
|
|
145
|
+
};
|
|
146
|
+
/** The build context for a form whose root schema/uiSchema carry the definitions. */
|
|
147
|
+
export const createViewContext = (schema, uiSchema, values, options = {}) => ({
|
|
148
|
+
values,
|
|
149
|
+
customFields: options.customFields ?? [],
|
|
150
|
+
formLocalization: options.formLocalization,
|
|
151
|
+
sink: options.sink ?? ignoreIssues,
|
|
152
|
+
fileUploadView: options.fileUploadView ?? FILE_UPLOAD_VIEW,
|
|
153
|
+
definitions: ((isPlainObject(schema) && isPlainObject(schema.definitions) ? schema.definitions : undefined) ?? {}),
|
|
154
|
+
defs: (isPlainObject(schema) && isPlainObject(schema.$defs) ? schema.$defs : undefined),
|
|
155
|
+
uiDefinitions: uiSchema?.definitions,
|
|
156
|
+
});
|
|
157
|
+
/** Root entry: the whole read-only view-model of a form. */
|
|
158
|
+
export const buildViewNode = (schema, uiSchema, values, options = {}) => schemaField("", schema, uiSchema ?? {}, createViewContext(schema, uiSchema, values, options));
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { EnumsTypes, getEnums } from "../../core/enums";
|
|
2
|
+
import { getIn } from "../../core/paths";
|
|
3
|
+
import { getSchemaType } from "../../core/schemaType";
|
|
4
|
+
import { en } from "../../i18n/en";
|
|
5
|
+
import { isPlainObject } from "../../core/json";
|
|
6
|
+
import { filterUiProps } from "../../core/uiProps";
|
|
7
|
+
import { extractUiSchema } from "../../core/uiSchema";
|
|
8
|
+
import { descriptionOf, reactAttr, reactText, titleOf } from "./values";
|
|
9
|
+
/** Instrumentation attributes of a field wrapper (2.x getInstrumentationAttributes; FormView never sets required/hidden). */
|
|
10
|
+
export const fieldAttrs = (name, kind, schema) => ({
|
|
11
|
+
"data-fjsf-path": name,
|
|
12
|
+
...(kind ? { "data-fjsf-kind": kind } : {}),
|
|
13
|
+
...(schema?.readOnly ? { "data-fjsf-readonly": "true" } : {}),
|
|
14
|
+
});
|
|
15
|
+
/** 2.x templates spread `ui:props.{wrapper,title,description}`; v3 keeps the D5 allowlist of them. */
|
|
16
|
+
export const elementProps = (ui, path, sink) => {
|
|
17
|
+
const props = extractUiSchema(ui).props;
|
|
18
|
+
const pick = (key) => (isPlainObject(props) && props[key] !== undefined ? filterUiProps(props[key], path, sink).attrs : {});
|
|
19
|
+
return { wrapperAttrs: pick("wrapper"), titleAttrs: pick("title"), descriptionAttrs: pick("description") };
|
|
20
|
+
};
|
|
21
|
+
export const chrome = (name, kind, schema, ui, sink) => {
|
|
22
|
+
const { wrapperAttrs, titleAttrs, descriptionAttrs } = elementProps(ui, name, sink);
|
|
23
|
+
return {
|
|
24
|
+
path: name,
|
|
25
|
+
// 2.x order: the wrapper props first, the library's instrumentation wins.
|
|
26
|
+
attrs: { ...wrapperAttrs, ...fieldAttrs(name, kind, schema) },
|
|
27
|
+
titleAttrs,
|
|
28
|
+
descriptionAttrs,
|
|
29
|
+
title: titleOf(ui, schema, name),
|
|
30
|
+
description: descriptionOf(ui, schema),
|
|
31
|
+
schema,
|
|
32
|
+
ui,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
const enumsOf = (schema, ctx, name) => getEnums({ schema }, ctx.sink, name);
|
|
36
|
+
/** StringField / NumberField / DateField / SearchableSelectField: the value as text (enum consts as titles). */
|
|
37
|
+
export const textField = (name, schema, ui, kind, ctx) => {
|
|
38
|
+
let value = getIn(ctx.values, name);
|
|
39
|
+
const enums = enumsOf(schema, ctx, name);
|
|
40
|
+
if (enums !== undefined)
|
|
41
|
+
value = enums.values.find((e) => e.const === value)?.title ?? value;
|
|
42
|
+
const t = getSchemaType(schema);
|
|
43
|
+
const resolvedKind = kind ?? (enums !== undefined ? "enum" : t === "number" || t === "integer" ? "number" : "string");
|
|
44
|
+
return { render: "text", ...chrome(name, resolvedKind, schema, ui, ctx.sink), text: reactText(value), keyword: reactAttr(value) };
|
|
45
|
+
};
|
|
46
|
+
export const textAreaField = (name, schema, ui, ctx) => ({
|
|
47
|
+
render: "textarea",
|
|
48
|
+
...chrome(name, "textarea", schema, ui, ctx.sink),
|
|
49
|
+
text: reactText(getIn(ctx.values, name)),
|
|
50
|
+
});
|
|
51
|
+
/** BooleanField / RadioField / ToggleField: a check mark and a label. */
|
|
52
|
+
export const booleanField = (name, schema, ui, kind, ctx) => {
|
|
53
|
+
const value = getIn(ctx.values, name);
|
|
54
|
+
const raw = extractUiSchema(ui).label;
|
|
55
|
+
const label = raw !== null && typeof raw === "object" ? (value === true ? raw.true : value === false ? raw.false : undefined) : typeof raw === "string" ? raw : undefined;
|
|
56
|
+
const loc = ctx.formLocalization?.fields?.BooleanField ?? {};
|
|
57
|
+
const selected = value === true;
|
|
58
|
+
const fallback = selected ? loc.selectedLabel ?? en["view.boolean.selected"] : loc.notSelectedLabel ?? en["view.boolean.notSelected"];
|
|
59
|
+
return {
|
|
60
|
+
render: "boolean",
|
|
61
|
+
...chrome(name, kind, schema, ui, ctx.sink),
|
|
62
|
+
selected,
|
|
63
|
+
label: reactText(label !== undefined ? label : fallback),
|
|
64
|
+
value,
|
|
65
|
+
uiLabel: label,
|
|
66
|
+
selectedLabel: loc.selectedLabel,
|
|
67
|
+
notSelectedLabel: loc.notSelectedLabel,
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
/** MultipleChoiceField: every option with a check mark when selected (`onlyShowSelected` filters). */
|
|
71
|
+
export const choicesField = (name, schema, ui, ctx) => {
|
|
72
|
+
const value = getIn(ctx.values, name);
|
|
73
|
+
const enums = enumsOf(schema, ctx, name);
|
|
74
|
+
const all = (enums?.values ?? []).map((e) => ({
|
|
75
|
+
value: reactAttr(e?.const) ?? "",
|
|
76
|
+
title: reactText(e?.title),
|
|
77
|
+
selected: Array.isArray(value) ? value.includes(e?.const) : value === e?.const,
|
|
78
|
+
const: e?.const,
|
|
79
|
+
}));
|
|
80
|
+
const onlySelected = extractUiSchema(ui).onlyShowSelected;
|
|
81
|
+
const kind = enums?.type === EnumsTypes.MULTI_SELECT ? "multi-enum" : "enum";
|
|
82
|
+
return { render: "choices", ...chrome(name, kind, schema, ui, ctx.sink), options: onlySelected ? all.filter((o) => o.selected) : all };
|
|
83
|
+
};
|
|
84
|
+
export const nullField = (name, schema, ui, kind = "null") => ({ render: "null", ...chrome(name, kind, schema, ui) });
|
|
85
|
+
export const slotField = (name, schema, ui, field, chain = []) => ({
|
|
86
|
+
render: "slot",
|
|
87
|
+
...chrome(name, "custom", schema, ui),
|
|
88
|
+
field,
|
|
89
|
+
chain,
|
|
90
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { toString } from "../../serialize/toString";
|
|
2
|
+
import { h } from "../vnode";
|
|
3
|
+
import { buildViewNode } from "./build";
|
|
4
|
+
import { toVNode } from "./toVNode";
|
|
5
|
+
export const renderViewToString = (schema, uiSchema, values, options = {}) => toString(h("div", { class: "fjsf-view-FormWrapper" }, h("div", { class: "fjsf-view-Form" }, toVNode(buildViewNode(schema, uiSchema, values, options)))));
|
|
6
|
+
export { buildViewNode };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { choiceStyle } from "../../core/choiceStyle";
|
|
2
|
+
import { h, withHost } from "../vnode";
|
|
3
|
+
/** 2.x FormView styled primitives in `registry.components` and their tags. */
|
|
4
|
+
export const VIEW_PRIMITIVES = {
|
|
5
|
+
ArrayFieldItem: "div", BooleanFieldWrapper: "div", EJSFieldValue: "div", FieldDescription: "div", FieldTitle: "label",
|
|
6
|
+
FieldWrapper: "div", Form: "div", Icon: "div", MultipleChoiceFieldWrapper: "div", ObjectFieldSectionTitle: "legend",
|
|
7
|
+
ObjectFieldSectionWrapper: "fieldset", ObjectFieldTemplateTitle: "div", ObjectFieldTemplateWrapper: "div",
|
|
8
|
+
StringFieldValue: "div", TextAreaValue: "div",
|
|
9
|
+
};
|
|
10
|
+
/** Override-only keys: `undefined` by default, read before their fallback (2.x getComponents). */
|
|
11
|
+
export const VIEW_OVERRIDE_ONLY = ["ArrayFieldTemplateDescription", "ArrayFieldTemplateTitle", "ArrayFieldTemplateWrapper", "ObjectFieldTemplateDescription"];
|
|
12
|
+
export const viewClass = (name) => `fjsf-view-${name}`;
|
|
13
|
+
/** A registry component element; its default is the first name in the chain that has one. */
|
|
14
|
+
export const component = (names, attrs, ...children) => {
|
|
15
|
+
const name = names.find((n) => n in VIEW_PRIMITIVES);
|
|
16
|
+
// A `className` from ui:props joins the library class (2.x: styled-components merged it).
|
|
17
|
+
const cls = typeof attrs.class === "string" && attrs.class ? `${viewClass(name)} ${attrs.class}` : viewClass(name);
|
|
18
|
+
const { class: _own, ...rest } = attrs;
|
|
19
|
+
return withHost(h(VIEW_PRIMITIVES[name], { class: cls, ...rest }, ...children), { kind: "component", names });
|
|
20
|
+
};
|
|
21
|
+
/** A composite registry component (2.x function components): an override gets `props` (and `children`). */
|
|
22
|
+
export const composite = (name, props, content, ...markup) => withHost(h("#fragment", {}, ...markup), { kind: "component", names: [name], props, ...(content ? { children: content } : {}) });
|
|
23
|
+
/** FormView FieldTemplate: wrapper, title <label for>, description, content. */
|
|
24
|
+
export const fieldTemplateMarkup = (c, content) => component(["FieldWrapper"], c.attrs, c.title ? component(["FieldTitle"], { ...c.titleAttrs, for: c.path }, c.title) : null, c.description ? component(["FieldDescription"], { ...c.descriptionAttrs }, c.description) : null, ...content);
|
|
25
|
+
export const objectTemplateMarkup = (c, content) => component(["ObjectFieldTemplateWrapper"], c.attrs, c.title ? component(["ObjectFieldTemplateTitle"], { ...c.titleAttrs }, c.title) : null, c.description ? component(["ObjectFieldTemplateDescription", "FieldDescription"], { ...c.descriptionAttrs }, c.description) : null, ...content);
|
|
26
|
+
/** 2.x ArrayFieldTemplate: array names first, then the object/field fallbacks; the title keeps `for`. */
|
|
27
|
+
export const arrayTemplateMarkup = (c, content) => component(["ArrayFieldTemplateWrapper", "ObjectFieldTemplateWrapper"], c.attrs, c.title ? component(["ArrayFieldTemplateTitle", "ObjectFieldTemplateTitle"], { ...c.titleAttrs, for: c.path }, c.title) : null, c.description ? component(["ArrayFieldTemplateDescription", "FieldDescription"], { ...c.descriptionAttrs }, c.description) : null, ...content);
|
|
28
|
+
/** ObjectFieldSection (a `ui:order` group): fieldset + legend. */
|
|
29
|
+
export const sectionMarkup = (title, content) => composite("ObjectFieldSection", { title }, content, component(["ObjectFieldSectionWrapper"], { "data-fjsf-section": title }, component(["ObjectFieldSectionTitle"], {}, title), ...content));
|
|
30
|
+
/** The root: FormWrapper > components.Form. */
|
|
31
|
+
export const formShellMarkup = (className, content) => h("div", { class: "fjsf-view-FormWrapper" }, component(["Form"], className ? { class: className } : {}, ...content));
|
|
32
|
+
// MultipleChoice* are the Form components 2.x FormView reuses (styled(RadioField*) chains).
|
|
33
|
+
const CHOICE = {
|
|
34
|
+
container: "fjsf-CommonCheckboxStyles fjsf-RadioFieldContainer fjsf-MultipleChoiceFieldContainer",
|
|
35
|
+
element: "fjsf-RadioFieldElement fjsf-MultipleChoiceFieldElement",
|
|
36
|
+
label: "fjsf-RadioFieldLabel fjsf-MultipleChoiceFieldLabel",
|
|
37
|
+
};
|
|
38
|
+
/** The check mark FormView draws for a selected value (2.x: react-icons FaCheck, an <svg>). */
|
|
39
|
+
export const checkIconMarkup = (className = viewClass("SelectedIcon")) => h("svg", { class: className, viewBox: "0 0 512 512", "aria-hidden": "true", focusable: "false" }, h("path", { d: "M173.9 439.4L7.5 273c-10-10-10-26.2 0-36.2l36.2-36.2c10-10 26.2-10 36.2 0L192 312.7 432.1 72.6c10-10 26.2-10 36.2 0l36.2 36.2c10 10 10 26.2 0 36.2l-294.4 294.4c-10 10-26.2 10-36.2 0z" }));
|
|
40
|
+
/** `unselected`: the wrapper of the "not selected" state (2.x BooleanFieldValue used `Selected` there too, Field.tsx:167). */
|
|
41
|
+
const mark = (selected, label, unselected = "NotSelected") => selected
|
|
42
|
+
? h("div", { class: viewClass("Selected") }, h("div", { class: viewClass("SelectedBox") }, checkIconMarkup()), h("span", { class: CHOICE.label }, label))
|
|
43
|
+
: h("div", { class: viewClass(unselected) }, h("div", { class: viewClass("NotSelectedBox") }), h("span", { class: CHOICE.label }, label));
|
|
44
|
+
/** BooleanFieldValue's default markup. */
|
|
45
|
+
export const booleanValueMarkup = (selected, label) => h("div", { class: viewClass("BooleanFieldValue") }, mark(selected, label, "Selected"));
|
|
46
|
+
/** MultipleChoiceFieldValue's default markup. */
|
|
47
|
+
/** `style`: the ui:style layout keyword (2.x getStyle on the container). */
|
|
48
|
+
export const choicesValueMarkup = (options, style) => h("div", { class: viewClass("MultipleChoiceFieldWrapper") }, h("div", { class: CHOICE.container, ...choiceStyle(style) }, options.map((o) => h("label", { class: CHOICE.element, "data-fjsf-enum-value-view": o.value }, mark(o.selected, o.title)))));
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { extractUiSchema } from "../../core/uiSchema";
|
|
2
|
+
import { h, withHost } from "../vnode";
|
|
3
|
+
import { arrayTemplateMarkup, booleanValueMarkup, choicesValueMarkup, component, composite, fieldTemplateMarkup, objectTemplateMarkup, sectionMarkup, } from "./markup";
|
|
4
|
+
/** The 2.x template props: the field props plus the data attributes the field passes. */
|
|
5
|
+
const templateProps = (node) => ({
|
|
6
|
+
...Object.fromEntries(Object.entries(node.attrs)
|
|
7
|
+
.filter(([k]) => k === "data-fjsf-kind" || k === "data-fjsf-object" || k === "data-fjsf-level")
|
|
8
|
+
// 2.x ObjectField passed the level as a number.
|
|
9
|
+
.map(([k, v]) => [k, k === "data-fjsf-level" ? Number(v) : v])),
|
|
10
|
+
name: node.path,
|
|
11
|
+
schema: node.schema,
|
|
12
|
+
uiSchema: node.ui,
|
|
13
|
+
});
|
|
14
|
+
const templated = (template, node, markup, children, extra = {}) => {
|
|
15
|
+
const override = node.ui?.["ui:template"];
|
|
16
|
+
// A fragment carries the template mark, so the markup's root keeps its own (component) mark: a slot on
|
|
17
|
+
// FieldWrapper / ObjectFieldTemplateWrapper still applies when the template is the default.
|
|
18
|
+
return withHost(h("#fragment", {}, markup), { kind: "template", template, ...(typeof override === "string" ? { override } : {}), props: templateProps(node), children, ...extra });
|
|
19
|
+
};
|
|
20
|
+
const fieldTemplate = (node, ...content) => templated("FieldTemplate", node, fieldTemplateMarkup(node, content), content);
|
|
21
|
+
const childVNode = (c) => (c.render === "section" ? sectionMarkup(c.title, c.children.map(toVNode)) : toVNode(c));
|
|
22
|
+
export const toVNode = (node) => {
|
|
23
|
+
switch (node.render) {
|
|
24
|
+
case "object": {
|
|
25
|
+
const content = node.children.map(childVNode);
|
|
26
|
+
return templated("ObjectFieldTemplate", node, objectTemplateMarkup(node, content), content, { childFields: node.childFields, chain: node.chain });
|
|
27
|
+
}
|
|
28
|
+
case "array": {
|
|
29
|
+
const items = node.items.map((item) => component(["ArrayFieldItem"], {}, "node" in item ? toVNode(item.node) : h("div", { "data-keyword": item.keyword }, item.text)));
|
|
30
|
+
return templated("ArrayFieldTemplate", node, arrayTemplateMarkup(node, items), items, { items: node.values, itemNodes: items });
|
|
31
|
+
}
|
|
32
|
+
case "text":
|
|
33
|
+
return fieldTemplate(node, component(["StringFieldValue"], { "data-keyword": node.keyword }, node.text));
|
|
34
|
+
case "textarea":
|
|
35
|
+
return fieldTemplate(node, component(["TextAreaValue"], {}, node.text));
|
|
36
|
+
case "boolean": {
|
|
37
|
+
const props = { name: node.path, value: node.value, label: node.uiLabel, selectedLabel: node.selectedLabel, notSelectedLabel: node.notSelectedLabel };
|
|
38
|
+
return fieldTemplate(node, component(["BooleanFieldWrapper"], {}, composite("BooleanFieldValue", props, undefined, booleanValueMarkup(node.selected, node.label))));
|
|
39
|
+
}
|
|
40
|
+
case "choices": {
|
|
41
|
+
const { props: inputProps, style } = extractUiSchema(node.ui);
|
|
42
|
+
const props = {
|
|
43
|
+
inputProps, name: node.path, style,
|
|
44
|
+
values: node.options.map((o) => ({ const: o.const, title: o.title, selected: o.selected })),
|
|
45
|
+
};
|
|
46
|
+
return fieldTemplate(node, composite("MultipleChoiceFieldValue", props, undefined, choicesValueMarkup(node.options, style)));
|
|
47
|
+
}
|
|
48
|
+
case "null":
|
|
49
|
+
return fieldTemplate(node);
|
|
50
|
+
case "slot": {
|
|
51
|
+
const markup = fieldTemplateMarkup(node, [h("div", { "data-fjsf-slot": node.path, "data-fjsf-field": node.field })]);
|
|
52
|
+
return withHost(markup, { kind: "field", field: node.field, props: { "data-fjsf-kind": "custom", name: node.path, schema: node.schema, uiSchema: node.ui }, chain: node.chain });
|
|
53
|
+
}
|
|
54
|
+
case "any":
|
|
55
|
+
return h("div", node.attrs, h("select", {}, ["array", "boolean", "integer", "number", "object", "string", "null", "any"].map((t) => h("option", { value: t, selected: t === node.type }, t))), toVNode(node.child));
|
|
56
|
+
case "unsupported":
|
|
57
|
+
return h("p", { style: "color:red" }, node.text);
|
|
58
|
+
case "plain":
|
|
59
|
+
return node.text;
|
|
60
|
+
case "none":
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { isPlainObject } from "../../core/json";
|
|
2
|
+
import { h, withHost } from "../vnode";
|
|
3
|
+
/**
|
|
4
|
+
* A React element (`$$typeof`) in a uiSchema text: kept for the React layer (2.x UiSchema allows ReactNode).
|
|
5
|
+
* In RAW DOM (S6) the host's own value is a DOM node, drawn by toDOM.
|
|
6
|
+
*/
|
|
7
|
+
const elementLike = (value) => typeof value === "object" && value !== null && ("$$typeof" in value || (typeof value.nodeType === "number" && typeof value.cloneNode === "function"));
|
|
8
|
+
const hostValue = (value) => withHost(h("#fragment", {}), { kind: "value", value });
|
|
9
|
+
/** Text React renders for a child value. */
|
|
10
|
+
export const reactText = (value) => {
|
|
11
|
+
if (typeof value === "string")
|
|
12
|
+
return value;
|
|
13
|
+
if (typeof value === "number")
|
|
14
|
+
return Number.isNaN(value) ? "NaN" : String(value);
|
|
15
|
+
if (Array.isArray(value))
|
|
16
|
+
return value.map(reactText).join("");
|
|
17
|
+
return ""; // boolean, null, undefined: nothing; plain object: 2.x crashed
|
|
18
|
+
};
|
|
19
|
+
/** Attribute value React writes for a data-* attribute, or undefined (omitted). */
|
|
20
|
+
export const reactAttr = (value) => {
|
|
21
|
+
if (value === undefined || value === null)
|
|
22
|
+
return undefined;
|
|
23
|
+
if (isPlainObject(value))
|
|
24
|
+
return undefined; // 2.x crashed on this value
|
|
25
|
+
if (Array.isArray(value))
|
|
26
|
+
return value.map((v) => (v === null || v === undefined ? "" : String(v))).join(",");
|
|
27
|
+
return String(value);
|
|
28
|
+
};
|
|
29
|
+
/** 2.x getTitle (getTitleAndDescription.ts) for a field: ui:title > title > last path segment. */
|
|
30
|
+
/** A uiSchema text (help, info content): a string, a React element kept for the host, or undefined. */
|
|
31
|
+
export const textOf = (value) => {
|
|
32
|
+
if (elementLike(value))
|
|
33
|
+
return hostValue(value);
|
|
34
|
+
return value ? reactText(value) || undefined : undefined;
|
|
35
|
+
};
|
|
36
|
+
export const titleOf = (uiSchema, schema, name) => {
|
|
37
|
+
if (uiSchema?.["ui:options"]?.hideTitle)
|
|
38
|
+
return undefined;
|
|
39
|
+
const segments = name.split(".");
|
|
40
|
+
const title = uiSchema?.["ui:title"] || schema?.title || segments[segments.length - 1];
|
|
41
|
+
if (elementLike(title))
|
|
42
|
+
return hostValue(title);
|
|
43
|
+
return typeof title === "string" && title ? title : title ? reactText(title) || undefined : undefined;
|
|
44
|
+
};
|
|
45
|
+
export const descriptionOf = (uiSchema, schema) => {
|
|
46
|
+
const d = uiSchema?.["ui:options"]?.description || uiSchema?.["ui:description"] || schema?.description;
|
|
47
|
+
if (elementLike(d))
|
|
48
|
+
return hostValue(d);
|
|
49
|
+
return d ? reactText(d) || undefined : undefined;
|
|
50
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const h = (tag, attrs = {}, ...children) => ({
|
|
2
|
+
tag,
|
|
3
|
+
attrs,
|
|
4
|
+
children: children.flat(),
|
|
5
|
+
});
|
|
6
|
+
/** The same node, marked with the extension point that produced it (ignored by toString). */
|
|
7
|
+
export const withHost = (node, host) => ({ ...node, host });
|
|
8
|
+
/** The same node with event descriptors (merged over existing ones). */
|
|
9
|
+
export const withOn = (node, on) => ({ ...node, on: { ...node.on, ...on } });
|
|
10
|
+
/** Where a React template puts its children; serialises to nothing. */
|
|
11
|
+
export const hole = (name) => ({ tag: "#hole", attrs: {}, children: [], host: { kind: "hole", ...(name ? { name } : {}) } });
|
|
12
|
+
/** Joins class names, skipping empty parts. */
|
|
13
|
+
export const cx = (...names) => names.filter(Boolean).join(" ") || undefined;
|