@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,79 @@
|
|
|
1
|
+
// Path handling for the RAW core (§2.4). Internal paths are segment arrays; the
|
|
2
|
+
// Formik string form (`a[0].b`) is derived. No formik import: its getIn would pull
|
|
3
|
+
// React into RAW. Prototype keys are never traversed (SEC-8 / SEC-FMK-5).
|
|
4
|
+
import { hasOwn, PROTOTYPE_KEYS } from "./json";
|
|
5
|
+
/** Splits a Formik/lodash path string: `a.b[0].c` -> ["a", "b", 0, "c"]. */
|
|
6
|
+
export const toPath = (path) => {
|
|
7
|
+
if (Array.isArray(path))
|
|
8
|
+
return path;
|
|
9
|
+
if (path === "")
|
|
10
|
+
return [];
|
|
11
|
+
const segments = [];
|
|
12
|
+
path.replace(/\[(\d+)\]|\[["']([^"']*)["']\]|([^.[\]]+)/g, (_m, index, quoted, plain) => {
|
|
13
|
+
if (index !== undefined)
|
|
14
|
+
segments.push(Number(index));
|
|
15
|
+
else
|
|
16
|
+
segments.push(quoted !== undefined ? quoted : plain);
|
|
17
|
+
return "";
|
|
18
|
+
});
|
|
19
|
+
return segments;
|
|
20
|
+
};
|
|
21
|
+
/** Formik string form of a path: ["a", 0, "b"] -> "a[0].b"; root is "". */
|
|
22
|
+
export const toFormikPath = (path) => path.reduce((acc, segment) => {
|
|
23
|
+
if (typeof segment === "number")
|
|
24
|
+
return `${acc}[${segment}]`;
|
|
25
|
+
return acc === "" ? segment : `${acc}.${segment}`;
|
|
26
|
+
}, "");
|
|
27
|
+
export const isPrototypeKey = (key) => PROTOTYPE_KEYS.has(key);
|
|
28
|
+
/** A key the Formik string form cannot address without changing its meaning (Q-FMK-4). */
|
|
29
|
+
export const isAmbiguousKey = (key) => /[.[\]]/.test(key);
|
|
30
|
+
/** Reads a value; undefined when any step is missing, wrong-typed or a prototype key. */
|
|
31
|
+
export const getIn = (value, path) => {
|
|
32
|
+
let current = value;
|
|
33
|
+
for (const segment of toPath(path)) {
|
|
34
|
+
if (current === null || typeof current !== "object")
|
|
35
|
+
return undefined;
|
|
36
|
+
const key = String(segment);
|
|
37
|
+
if (isPrototypeKey(key) || !hasOwn(current, key))
|
|
38
|
+
return undefined;
|
|
39
|
+
current = current[key];
|
|
40
|
+
}
|
|
41
|
+
return current;
|
|
42
|
+
};
|
|
43
|
+
/** Formik/lodash: a missing container becomes an array when the next key is a non-negative integer. */
|
|
44
|
+
const isIndex = (segment) => typeof segment === "number" || /^(0|[1-9]\d*)$/.test(segment);
|
|
45
|
+
const cloneContainer = (value, nextSegment) => {
|
|
46
|
+
if (Array.isArray(value))
|
|
47
|
+
return value.slice();
|
|
48
|
+
if (value !== null && typeof value === "object")
|
|
49
|
+
return { ...value };
|
|
50
|
+
return isIndex(nextSegment) ? [] : {};
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Immutable write. Returns the original value unchanged when the path contains a
|
|
54
|
+
* prototype key (the caller reports KEY_REJECTED). Wrong-typed intermediate values
|
|
55
|
+
* are replaced by a fresh container, like Formik's setIn.
|
|
56
|
+
*/
|
|
57
|
+
export const setIn = (value, path, next) => {
|
|
58
|
+
const segments = toPath(path);
|
|
59
|
+
if (segments.length === 0)
|
|
60
|
+
return next;
|
|
61
|
+
if (segments.some((s) => typeof s === "string" && isPrototypeKey(s)))
|
|
62
|
+
return value;
|
|
63
|
+
const write = (current, index) => {
|
|
64
|
+
const segment = segments[index];
|
|
65
|
+
const container = cloneContainer(current, segment);
|
|
66
|
+
const key = String(segment);
|
|
67
|
+
if (index === segments.length - 1) {
|
|
68
|
+
if (next === undefined && !Array.isArray(container))
|
|
69
|
+
delete container[key];
|
|
70
|
+
else
|
|
71
|
+
container[key] = next;
|
|
72
|
+
return container;
|
|
73
|
+
}
|
|
74
|
+
const child = hasOwn(current, key) ? current[key] : undefined;
|
|
75
|
+
container[key] = write(child, index + 1);
|
|
76
|
+
return container;
|
|
77
|
+
};
|
|
78
|
+
return write(value, 0);
|
|
79
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const FILE_UPLOAD_VIEW = "todo";
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { hasOwn, isPlainObject, PROTOTYPE_KEYS } from "./json";
|
|
2
|
+
import { ignoreIssues, issue } from "./issues";
|
|
3
|
+
import { mergeSchemas } from "./merge";
|
|
4
|
+
/** Maximum alias hops / nested expansions of the same chain (plan §5.2 SEC-9). */
|
|
5
|
+
export const MAX_REF_DEPTH = 32;
|
|
6
|
+
const decode = (segment) => {
|
|
7
|
+
let s = segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
8
|
+
try {
|
|
9
|
+
s = decodeURIComponent(s);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
// keep the raw segment when it is not valid percent-encoding
|
|
13
|
+
}
|
|
14
|
+
return s;
|
|
15
|
+
};
|
|
16
|
+
/** Parses `#/definitions/a~1b` style pointers; undefined for anything else. */
|
|
17
|
+
export const parseRef = (ref) => {
|
|
18
|
+
const match = /^#\/(definitions|\$defs)\/(.+)$/.exec(ref);
|
|
19
|
+
if (!match)
|
|
20
|
+
return undefined;
|
|
21
|
+
return { root: match[1], segments: match[2].split("/").map(decode) };
|
|
22
|
+
};
|
|
23
|
+
const walk = (container, segments) => {
|
|
24
|
+
let current = container;
|
|
25
|
+
for (const segment of segments) {
|
|
26
|
+
if (PROTOTYPE_KEYS.has(segment) || !hasOwn(current, segment))
|
|
27
|
+
return undefined;
|
|
28
|
+
current = current[segment];
|
|
29
|
+
}
|
|
30
|
+
return current;
|
|
31
|
+
};
|
|
32
|
+
/** uiSchema definitions are keyed without the intermediate `properties` segments (2.x mapping). */
|
|
33
|
+
const uiTarget = (ui, segments) => walk(ui, segments.filter((s) => s !== "properties"));
|
|
34
|
+
/**
|
|
35
|
+
* Resolves the `$ref` of one schema node. Never throws: unsupported, missing,
|
|
36
|
+
* cyclic or too deep references produce an issue and a schema without `$ref`.
|
|
37
|
+
*/
|
|
38
|
+
export const resolveRefs = (schema, uiSchema, ctx) => {
|
|
39
|
+
const sink = ctx.sink ?? ignoreIssues;
|
|
40
|
+
if (!isPlainObject(schema) || typeof schema.$ref !== "string")
|
|
41
|
+
return { schema, uiSchema };
|
|
42
|
+
const visited = new Set();
|
|
43
|
+
let current = schema;
|
|
44
|
+
let ui = uiSchema ?? {};
|
|
45
|
+
let depth = 0;
|
|
46
|
+
while (isPlainObject(current) && typeof current.$ref === "string") {
|
|
47
|
+
const ref = current.$ref;
|
|
48
|
+
const { $ref: _drop, ...rest } = current;
|
|
49
|
+
if (visited.has(ref)) {
|
|
50
|
+
sink(issue("REF_CYCLE", ctx.path, ref));
|
|
51
|
+
return { schema: rest, uiSchema: ui };
|
|
52
|
+
}
|
|
53
|
+
if (depth >= MAX_REF_DEPTH) {
|
|
54
|
+
sink(issue("REF_DEPTH_EXCEEDED", ctx.path, ref));
|
|
55
|
+
return { schema: rest, uiSchema: ui };
|
|
56
|
+
}
|
|
57
|
+
visited.add(ref);
|
|
58
|
+
depth += 1;
|
|
59
|
+
const pointer = parseRef(ref);
|
|
60
|
+
if (!pointer) {
|
|
61
|
+
sink(issue("REF_UNSUPPORTED", ctx.path, ref));
|
|
62
|
+
return { schema: rest, uiSchema: ui };
|
|
63
|
+
}
|
|
64
|
+
const source = pointer.root === "definitions" ? ctx.definitions : ctx.defs;
|
|
65
|
+
const target = walk(source, pointer.segments);
|
|
66
|
+
if (!isPlainObject(target)) {
|
|
67
|
+
sink(issue("REF_NOT_FOUND", ctx.path, ref));
|
|
68
|
+
return { schema: rest, uiSchema: ui };
|
|
69
|
+
}
|
|
70
|
+
const uiDefinition = pointer.root === "definitions" ? uiTarget(ctx.uiSchemaDefinitions, pointer.segments) : undefined;
|
|
71
|
+
ui = mergeSchemas(isPlainObject(uiDefinition) ? uiDefinition : {}, ui);
|
|
72
|
+
current = mergeSchemas(target, rest);
|
|
73
|
+
if (!hasOwn(target, "$ref"))
|
|
74
|
+
delete current.$ref;
|
|
75
|
+
}
|
|
76
|
+
return { schema: current, uiSchema: ui };
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* 2.x-compatible signature (src/utils/solveReferences.ts): `definitions` is the
|
|
80
|
+
* root `definitions`. `$defs` is read from the same object when given via ctx.
|
|
81
|
+
*/
|
|
82
|
+
export const solveReferences = (schema, definitions, uiSchema, uiSchemaDefinitions, options = {}) => resolveRefs(schema, uiSchema, { ...options, definitions, uiSchemaDefinitions });
|
|
83
|
+
/** Q-REF-5 (kept, documented): only `properties` are inspected. Cycle-safe (Q-PP-3). */
|
|
84
|
+
export const hasReferences = (schema, seen = new Set()) => {
|
|
85
|
+
const properties = isPlainObject(schema) ? schema.properties : undefined;
|
|
86
|
+
if (!isPlainObject(properties) || seen.has(schema))
|
|
87
|
+
return false;
|
|
88
|
+
seen.add(schema);
|
|
89
|
+
return Object.keys(properties).some((key) => {
|
|
90
|
+
const value = properties[key];
|
|
91
|
+
if (!isPlainObject(value))
|
|
92
|
+
return false;
|
|
93
|
+
if (value.properties)
|
|
94
|
+
return hasReferences(value, seen);
|
|
95
|
+
return Object.keys(value).includes("$ref");
|
|
96
|
+
});
|
|
97
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { isSchemaObject } from "./json";
|
|
2
|
+
/** Same answer as 2.x getTypes.getSchemaType for every input 2.x accepted. */
|
|
3
|
+
export const getSchemaType = (schema) => {
|
|
4
|
+
if (!isSchemaObject(schema))
|
|
5
|
+
return undefined;
|
|
6
|
+
const { type } = schema;
|
|
7
|
+
if (!type && schema.const)
|
|
8
|
+
return guessType(schema.const);
|
|
9
|
+
if (!type && schema.enum)
|
|
10
|
+
return "string";
|
|
11
|
+
if (!type && (schema.properties || schema.additionalProperties))
|
|
12
|
+
return "object";
|
|
13
|
+
if (Array.isArray(type) && type.length === 2 && type.includes("null"))
|
|
14
|
+
return type.find((t) => t !== "null");
|
|
15
|
+
return type;
|
|
16
|
+
};
|
|
17
|
+
/** 2.x guessType (getTypes.ts), unchanged: used for `const` type guessing. */
|
|
18
|
+
export const guessType = (value) => {
|
|
19
|
+
if (Array.isArray(value))
|
|
20
|
+
return "array";
|
|
21
|
+
if (typeof value === "string")
|
|
22
|
+
return "string";
|
|
23
|
+
if (value === null)
|
|
24
|
+
return "null";
|
|
25
|
+
if (typeof value === "boolean")
|
|
26
|
+
return "boolean";
|
|
27
|
+
if (!isNaN(value))
|
|
28
|
+
return "number";
|
|
29
|
+
if (typeof value === "object")
|
|
30
|
+
return "object";
|
|
31
|
+
return "string";
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* v3 normalisation used by initial values and validation: always one type plus a
|
|
35
|
+
* nullable flag; "any" when nothing can be inferred (never a throw).
|
|
36
|
+
*/
|
|
37
|
+
export const normaliseType = (schema) => {
|
|
38
|
+
if (!isSchemaObject(schema))
|
|
39
|
+
return { type: "any", nullable: false };
|
|
40
|
+
const raw = schema.type;
|
|
41
|
+
if (Array.isArray(raw)) {
|
|
42
|
+
const nonNull = raw.filter((t) => t !== "null");
|
|
43
|
+
return { type: nonNull[0] ?? (raw.length ? "null" : "any"), nullable: raw.includes("null") };
|
|
44
|
+
}
|
|
45
|
+
if (raw)
|
|
46
|
+
return { type: raw, nullable: false };
|
|
47
|
+
if (schema.const !== undefined)
|
|
48
|
+
return { type: guessType(schema.const), nullable: false };
|
|
49
|
+
if (schema.enum && schema.enum.length > 0) {
|
|
50
|
+
const kinds = new Set(schema.enum.map((v) => (v === null ? "null" : guessType(v))));
|
|
51
|
+
return { type: kinds.size === 1 ? [...kinds][0] : "any", nullable: kinds.has("null") };
|
|
52
|
+
}
|
|
53
|
+
if (schema.properties || schema.additionalProperties)
|
|
54
|
+
return { type: "object", nullable: false };
|
|
55
|
+
if (schema.items || schema.additionalItems)
|
|
56
|
+
return { type: "array", nullable: false };
|
|
57
|
+
return { type: "any", nullable: false };
|
|
58
|
+
};
|
|
59
|
+
/** Default value used when an item or property is created (2.x getDefaultValueForType). */
|
|
60
|
+
export const defaultValueForType = (type) => {
|
|
61
|
+
if (type && !Array.isArray(type)) {
|
|
62
|
+
if (type === "array")
|
|
63
|
+
return [];
|
|
64
|
+
if (type === "object")
|
|
65
|
+
return {};
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// setTitleValues and immutablySwapItems ported from 2.x. setTitleValues no longer
|
|
2
|
+
// throws when the stored value at `name` is not an array (2.x: `getIn(...)[index]`).
|
|
3
|
+
import { getIn } from "./paths";
|
|
4
|
+
// Replaces ${key} placeholders in a collapsible title with the item's values.
|
|
5
|
+
export const setTitleValues = (name, title, defaultTitle, values) => {
|
|
6
|
+
const match = name.match(/^([a-zA-Z_$][\w[\].$]*)\[(\d+)\]$/);
|
|
7
|
+
const base = match ? match[1] : name;
|
|
8
|
+
const index = match ? parseInt(match[2], 10) : -1;
|
|
9
|
+
const container = getIn(values, base);
|
|
10
|
+
const itemValues = match ? (Array.isArray(container) ? container[index] : undefined) : container;
|
|
11
|
+
const fallbackName = base.split(".").slice(-1)[0];
|
|
12
|
+
return title.replace(/\$\{([\w$.:]+)\}/g, (placeholder) => {
|
|
13
|
+
const key = placeholder.slice(2, -1);
|
|
14
|
+
const value = itemValues ? getIn(itemValues, key) : undefined;
|
|
15
|
+
if (key === "index")
|
|
16
|
+
return (index + 1).toString();
|
|
17
|
+
return value ? String(value) : defaultTitle || fallbackName;
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
export function immutablySwapItems(items, firstIndex, secondIndex) {
|
|
21
|
+
const results = items.slice();
|
|
22
|
+
results[firstIndex] = items[secondIndex];
|
|
23
|
+
results[secondIndex] = items[firstIndex];
|
|
24
|
+
return results;
|
|
25
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { issue } from "./issues";
|
|
2
|
+
import { MAX_SCHEMA_DEPTH } from "./json";
|
|
3
|
+
/** True when `node` may be expanded below `trail`; otherwise reports REF_CYCLE or REF_DEPTH_EXCEEDED and returns false. */
|
|
4
|
+
export const mayEnter = (node, trail, sink, path) => {
|
|
5
|
+
if (trail.includes(node)) {
|
|
6
|
+
sink(issue("REF_CYCLE", path || undefined));
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
if (trail.length >= MAX_SCHEMA_DEPTH) {
|
|
10
|
+
sink(issue("REF_DEPTH_EXCEEDED", path || undefined));
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
return true;
|
|
14
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { issue } from "./issues";
|
|
2
|
+
import { isPlainObject } from "./json";
|
|
3
|
+
/** Allowed keys (React names) and the HTML attribute each becomes. */
|
|
4
|
+
const KEYS = {
|
|
5
|
+
placeholder: "placeholder", autoComplete: "autocomplete", inputMode: "inputmode", min: "min", max: "max", step: "step",
|
|
6
|
+
maxLength: "maxlength", className: "class", title: "title", id: "id", tabIndex: "tabindex", disabled: "disabled", readOnly: "readonly",
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Style properties (camelCase) allowed in `style`: typography, colour, box and flex/grid layout.
|
|
10
|
+
* Not allowed: positioning (`position`, `inset`, `top`..., `zIndex`), `background(-image)`,
|
|
11
|
+
* `content`, `transform`, `filter`, anything with `url(`, `expression(` or `javascript:` (provisional).
|
|
12
|
+
*/
|
|
13
|
+
export const STYLE_PROPERTIES = new Set([
|
|
14
|
+
"color", "backgroundColor", "opacity", "fontFamily", "fontSize", "fontStyle", "fontWeight", "lineHeight", "letterSpacing",
|
|
15
|
+
"textAlign", "textDecoration", "textTransform", "whiteSpace", "wordBreak", "overflowWrap", "verticalAlign",
|
|
16
|
+
"display", "boxSizing", "width", "minWidth", "maxWidth", "height", "minHeight", "maxHeight", "overflow",
|
|
17
|
+
"margin", "marginTop", "marginRight", "marginBottom", "marginLeft", "padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft",
|
|
18
|
+
"border", "borderTop", "borderRight", "borderBottom", "borderLeft", "borderColor", "borderStyle", "borderWidth", "borderRadius",
|
|
19
|
+
"flex", "flexDirection", "flexWrap", "flexGrow", "flexShrink", "flexBasis", "alignItems", "alignSelf", "justifyContent", "gap",
|
|
20
|
+
"rowGap", "columnGap", "gridTemplateColumns", "gridColumn", "gridRow", "breakInside", "breakBefore", "breakAfter",
|
|
21
|
+
"pageBreakInside", "pageBreakBefore", "pageBreakAfter",
|
|
22
|
+
]);
|
|
23
|
+
const UNSAFE_VALUE = /url\s*\(|expression\s*\(|javascript:|@import|[<>{};\\]/i;
|
|
24
|
+
const kebab = (name) => name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
|
|
25
|
+
const primitive = (v) => typeof v === "string" || typeof v === "number" || typeof v === "boolean";
|
|
26
|
+
const styleOf = (style, rejected) => {
|
|
27
|
+
if (!isPlainObject(style)) {
|
|
28
|
+
rejected.push("style");
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
const rules = [];
|
|
32
|
+
for (const [name, value] of Object.entries(style)) {
|
|
33
|
+
if (STYLE_PROPERTIES.has(name) && (typeof value === "string" || typeof value === "number") && !UNSAFE_VALUE.test(String(value)))
|
|
34
|
+
rules.push(`${kebab(name)}:${value}`);
|
|
35
|
+
else
|
|
36
|
+
rejected.push(`style.${name}`);
|
|
37
|
+
}
|
|
38
|
+
return rules.length ? rules.join(";") : undefined;
|
|
39
|
+
};
|
|
40
|
+
/** `{attrs, rejected}`: HTML attributes for a library element; rejected keys are reported on `sink`. */
|
|
41
|
+
export const filterUiProps = (uiProps, path = "", sink) => {
|
|
42
|
+
const attrs = {};
|
|
43
|
+
const rejected = [];
|
|
44
|
+
if (uiProps === undefined || uiProps === null)
|
|
45
|
+
return { attrs, rejected };
|
|
46
|
+
if (!isPlainObject(uiProps))
|
|
47
|
+
rejected.push("(not an object)");
|
|
48
|
+
else {
|
|
49
|
+
for (const [key, value] of Object.entries(uiProps)) {
|
|
50
|
+
const isData = /^data-[a-z0-9-]+$/i.test(key) && !/^data-(fjsf-|keyword$)/i.test(key);
|
|
51
|
+
const isAria = /^aria-[a-z]+$/i.test(key);
|
|
52
|
+
if (key === "style") {
|
|
53
|
+
const css = styleOf(value, rejected);
|
|
54
|
+
if (css)
|
|
55
|
+
attrs.style = css;
|
|
56
|
+
}
|
|
57
|
+
else if ((isData || isAria || Object.prototype.hasOwnProperty.call(KEYS, key)) && primitive(value)) {
|
|
58
|
+
attrs[isData || isAria ? key.toLowerCase() : KEYS[key]] = value;
|
|
59
|
+
}
|
|
60
|
+
else
|
|
61
|
+
rejected.push(key);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (sink)
|
|
65
|
+
for (const key of rejected)
|
|
66
|
+
sink(issue("PROP_REJECTED", path, key));
|
|
67
|
+
return { attrs, rejected };
|
|
68
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { isPlainObject } from "./json";
|
|
2
|
+
/** Flattens `ui:*` keys (prefix removed) and `ui:options` into one object (2.x semantics). */
|
|
3
|
+
export const extractUiSchema = (ui = {}) => {
|
|
4
|
+
const schema = isPlainObject(ui) ? { ...ui } : {};
|
|
5
|
+
if (schema.props !== undefined)
|
|
6
|
+
schema["ui:props"] = { ...(schema["ui:props"] ?? {}), ...(schema.props ?? {}) };
|
|
7
|
+
const { "ui:options": options = {}, ...rest } = schema;
|
|
8
|
+
const result = {};
|
|
9
|
+
for (const key of Object.keys(rest))
|
|
10
|
+
result[key.replace("ui:", "")] = rest[key];
|
|
11
|
+
return { ...result, ...(isPlainObject(options) ? options : {}) };
|
|
12
|
+
};
|
|
13
|
+
const fieldsOf = (order) => order.flatMap((entry) => (typeof entry === "string" ? entry : entry?.fields ?? []));
|
|
14
|
+
export const getHiddenProperties = (order, properties) => {
|
|
15
|
+
if (!Array.isArray(order) || order.includes("*"))
|
|
16
|
+
return [];
|
|
17
|
+
const listed = fieldsOf(order);
|
|
18
|
+
return properties.filter((key) => !listed.includes(key));
|
|
19
|
+
};
|
|
20
|
+
export function orderByUiSchema(order, allProperties) {
|
|
21
|
+
if (order === undefined || allProperties === undefined)
|
|
22
|
+
return allProperties;
|
|
23
|
+
if (!Array.isArray(order))
|
|
24
|
+
return allProperties;
|
|
25
|
+
if (!order.includes("*"))
|
|
26
|
+
return order;
|
|
27
|
+
const unique = [...new Set(order)];
|
|
28
|
+
const listed = fieldsOf(unique);
|
|
29
|
+
const result = [];
|
|
30
|
+
for (const entry of unique) {
|
|
31
|
+
if (entry === "*")
|
|
32
|
+
result.push(...allProperties.filter((p) => !listed.includes(p)));
|
|
33
|
+
else
|
|
34
|
+
result.push(entry);
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
export function orderAdditionalProperties(order, values) {
|
|
39
|
+
if (!Array.isArray(order) || order.length === 0)
|
|
40
|
+
return values;
|
|
41
|
+
const relevant = fieldsOf(order).filter((item) => values.includes(item) || item === "*");
|
|
42
|
+
return orderByUiSchema(relevant, values);
|
|
43
|
+
}
|
|
44
|
+
export const getTitle = ({ title, uiSchema, schema, name }) => uiSchema?.["ui:options"]?.hideTitle
|
|
45
|
+
? undefined
|
|
46
|
+
: title || uiSchema?.["ui:title"] || schema?.title || name?.split(".")[name.split(".").length - 1];
|
|
47
|
+
export const getDescription = ({ description, uiSchema, schema }) => description || uiSchema?.["ui:options"]?.description || uiSchema?.["ui:description"] || schema?.description;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { controlEvent, delegate, isTextControl } from "./delegate";
|
|
2
|
+
export const bindEvents = (core, target) => {
|
|
3
|
+
const undelegate = delegate(target, core.records, (on, event, el) => {
|
|
4
|
+
switch (event.type) {
|
|
5
|
+
case "input":
|
|
6
|
+
case "change": {
|
|
7
|
+
if (!on.change)
|
|
8
|
+
break;
|
|
9
|
+
if (isTextControl(el)) {
|
|
10
|
+
// React's onChange: `input` or `change`, once per new value
|
|
11
|
+
const value = el.value;
|
|
12
|
+
if (core.tracked.get(el) === value)
|
|
13
|
+
break;
|
|
14
|
+
core.tracked.set(el, value);
|
|
15
|
+
core.dispatch(on.change, { value });
|
|
16
|
+
}
|
|
17
|
+
else if (event.type === "change" && !core.uploads.handle(on.change, event, el))
|
|
18
|
+
core.dispatch(on.change, controlEvent(el));
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
case "focusout": {
|
|
22
|
+
// React's onBlur is focusout: it also fires on a container when focus leaves one of its controls
|
|
23
|
+
const related = event.relatedTarget;
|
|
24
|
+
if (on.focusout)
|
|
25
|
+
core.dispatch(on.focusout, { leftContainer: !related || !el.contains(related) });
|
|
26
|
+
else if (on.blur)
|
|
27
|
+
core.dispatch(on.blur, { value: event.target?.value });
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
case "focusin":
|
|
31
|
+
if (on.focus)
|
|
32
|
+
core.dispatch(on.focus);
|
|
33
|
+
break;
|
|
34
|
+
case "paste":
|
|
35
|
+
if (on.paste) {
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
core.dispatch(on.paste, { value: event.clipboardData?.getData("text")?.trim() ?? "" });
|
|
38
|
+
}
|
|
39
|
+
break;
|
|
40
|
+
case "mousedown":
|
|
41
|
+
if (on.mousedown)
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
break;
|
|
44
|
+
case "keydown":
|
|
45
|
+
// Q-SEL-2: Enter in a search input never submits the form (the document listener still selects).
|
|
46
|
+
if (on.keydown?.type === "preventEnter" && event.key === "Enter")
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
break;
|
|
49
|
+
case "click":
|
|
50
|
+
if (!on.click)
|
|
51
|
+
break;
|
|
52
|
+
if (el.tagName === "A" || on.click.type === "preventDefault")
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
if (on.click.type !== "preventDefault" && !core.uploads.handle(on.click, event, el))
|
|
55
|
+
core.dispatch(on.click);
|
|
56
|
+
break;
|
|
57
|
+
case "submit":
|
|
58
|
+
if (on.submit) {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
void core.store.submitForm().catch((error) => globalThis.console?.warn?.("fjsf: an unhandled error was caught from submit", error));
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
63
|
+
default: {
|
|
64
|
+
// dragenter / dragleave / dragover / drop: the files upload
|
|
65
|
+
const action = on[event.type];
|
|
66
|
+
if (action)
|
|
67
|
+
core.uploads.handle(action, event, el);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
// 2.x listened on the document while a searchable dropdown was open; one listener per controller here.
|
|
72
|
+
const doc = target.ownerDocument;
|
|
73
|
+
// Q-SEL-1: only the open select whose container holds the key's target (the focused one) reacts.
|
|
74
|
+
const onKey = (e) => [...core.keyActions.values()].filter(({ el }) => el.contains(e.target)).forEach(({ action }) => core.dispatch(action, { keyName: e.key }));
|
|
75
|
+
doc.addEventListener("keydown", onKey);
|
|
76
|
+
return () => {
|
|
77
|
+
undelegate();
|
|
78
|
+
doc.removeEventListener("keydown", onKey);
|
|
79
|
+
};
|
|
80
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createFormContext, formField, formShell } from "../model/form";
|
|
2
|
+
import { buildViewNode } from "../model/view";
|
|
3
|
+
import { formShellMarkup } from "../model/view/markup";
|
|
4
|
+
import { toVNode } from "../model/view/toVNode";
|
|
5
|
+
export const buildTree = (schema, uiSchema, state, ui, o, sink) => {
|
|
6
|
+
const customFields = Object.keys(o.fields ?? {});
|
|
7
|
+
if (o.mode === "view") {
|
|
8
|
+
const view = buildViewNode(schema, uiSchema ?? {}, state.values, { customFields, formLocalization: o.formLocalization, sink, fileUploadView: o.fileUploadView });
|
|
9
|
+
return { tree: formShellMarkup(o.className, [toVNode(view)]) };
|
|
10
|
+
}
|
|
11
|
+
const ctx = createFormContext(schema, uiSchema, { values: state.values, errors: state.errors, touched: state.touched, submitting: state.isSubmitting }, {
|
|
12
|
+
customFields,
|
|
13
|
+
formLocalization: o.formLocalization ?? {},
|
|
14
|
+
formOptions: o.formOptions ?? {},
|
|
15
|
+
locale: o.locale,
|
|
16
|
+
ui,
|
|
17
|
+
hideUnmarkedAdditionalProperties: o.hideUnmarkedAdditionalProperties,
|
|
18
|
+
orderable: !!o.orderable,
|
|
19
|
+
sink,
|
|
20
|
+
});
|
|
21
|
+
const content = formField(ctx, { name: "", schema, ui: uiSchema ?? {} }, []);
|
|
22
|
+
return { tree: formShell(content, { className: o.className, hideSubmit: !!o.hideSubmit, submitting: state.isSubmitting }), ctx };
|
|
23
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { bindEvents } from "./bind";
|
|
2
|
+
import { createCore } from "./core";
|
|
3
|
+
import { renderCore } from "./render";
|
|
4
|
+
export class FormController {
|
|
5
|
+
core;
|
|
6
|
+
unbind;
|
|
7
|
+
unsubscribe;
|
|
8
|
+
destroyed = false;
|
|
9
|
+
constructor(init) {
|
|
10
|
+
this.core = createCore(init, (core) => renderCore(core, this));
|
|
11
|
+
const { ui: _ui, ...state } = init.state ?? {};
|
|
12
|
+
if (Object.keys(state).length)
|
|
13
|
+
this.core.store.setState(state);
|
|
14
|
+
this.unsubscribe = this.core.store.subscribe(() => this.core.schedule());
|
|
15
|
+
}
|
|
16
|
+
/** The RAW store (the state adapter): values, errors, touched, isSubmitting, submitCount. */
|
|
17
|
+
get store() {
|
|
18
|
+
return this.core.store;
|
|
19
|
+
}
|
|
20
|
+
/** Draws the form into `target` and binds its events; idempotent per target. */
|
|
21
|
+
mount(target) {
|
|
22
|
+
if (this.destroyed || this.core.target === target)
|
|
23
|
+
return;
|
|
24
|
+
this.unbind?.();
|
|
25
|
+
this.core.target = target;
|
|
26
|
+
this.unbind = bindEvents(this.core, target);
|
|
27
|
+
this.core.render();
|
|
28
|
+
}
|
|
29
|
+
/** New schema / uiSchema / values / options; the form is redrawn (in place). */
|
|
30
|
+
update(partial) {
|
|
31
|
+
const core = this.core;
|
|
32
|
+
if ("schema" in partial)
|
|
33
|
+
core.schema = partial.schema;
|
|
34
|
+
if ("uiSchema" in partial)
|
|
35
|
+
core.uiSchema = partial.uiSchema;
|
|
36
|
+
if (partial.options)
|
|
37
|
+
core.options = { ...core.options, ...partial.options };
|
|
38
|
+
if ("schema" in partial || "uiSchema" in partial)
|
|
39
|
+
core.reported.clear();
|
|
40
|
+
if ("values" in partial)
|
|
41
|
+
core.act(() => core.store.setValues(partial.values, false));
|
|
42
|
+
core.schedule();
|
|
43
|
+
}
|
|
44
|
+
/** Removes every listener (the document one too) and stops the uploads' timers; idempotent. */
|
|
45
|
+
destroy() {
|
|
46
|
+
if (this.destroyed)
|
|
47
|
+
return;
|
|
48
|
+
this.destroyed = true;
|
|
49
|
+
this.unbind?.();
|
|
50
|
+
this.unsubscribe();
|
|
51
|
+
this.core.uploads.destroy();
|
|
52
|
+
this.core.emitter.clear();
|
|
53
|
+
this.core.target = undefined;
|
|
54
|
+
this.core.keyActions.clear();
|
|
55
|
+
}
|
|
56
|
+
getState() {
|
|
57
|
+
return { ...this.core.store.getState(), ui: this.core.ui };
|
|
58
|
+
}
|
|
59
|
+
/** The VNode tree of the last render: what every serialiser draws (toString / toDOM / toReact). */
|
|
60
|
+
getViewModel() {
|
|
61
|
+
return this.core.tree;
|
|
62
|
+
}
|
|
63
|
+
/** The 2.x error map of `values`; without values, of the current ones, which then become the errors. */
|
|
64
|
+
async validate(values) {
|
|
65
|
+
const errors = await this.core.store.validateForm(values);
|
|
66
|
+
if (values === undefined)
|
|
67
|
+
this.core.store.setState({ errors });
|
|
68
|
+
return errors;
|
|
69
|
+
}
|
|
70
|
+
/** What the submit button does: touch all, validate, then `submit` and `options.onSubmit` when valid. */
|
|
71
|
+
submit() {
|
|
72
|
+
return this.core.store.submitForm().catch((error) => globalThis.console?.warn?.("fjsf: an unhandled error was caught from submit", error));
|
|
73
|
+
}
|
|
74
|
+
on(type, handler) {
|
|
75
|
+
return this.core.emitter.on(type, handler);
|
|
76
|
+
}
|
|
77
|
+
off(type, handler) {
|
|
78
|
+
this.core.emitter.off(type, handler);
|
|
79
|
+
}
|
|
80
|
+
once(type, handler) {
|
|
81
|
+
return this.core.emitter.once(type, handler);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { createStore } from "../store/createStore";
|
|
2
|
+
import { createEmitter } from "./emitter";
|
|
3
|
+
import { openPicker, runAction } from "./effects";
|
|
4
|
+
import { createUploads } from "./upload";
|
|
5
|
+
const warn = (what) => (error) => globalThis.console?.warn?.(`fjsf: ${what}`, error);
|
|
6
|
+
export const createCore = (init, render) => {
|
|
7
|
+
const core = {
|
|
8
|
+
schema: init.schema,
|
|
9
|
+
uiSchema: init.uiSchema,
|
|
10
|
+
options: init.options ?? {},
|
|
11
|
+
ui: init.state?.ui ?? {},
|
|
12
|
+
emitter: createEmitter(),
|
|
13
|
+
records: new WeakMap(),
|
|
14
|
+
tracked: new WeakMap(),
|
|
15
|
+
keyActions: new Map(),
|
|
16
|
+
seen: new Set(),
|
|
17
|
+
reported: new Set(),
|
|
18
|
+
scrolled: new Map(),
|
|
19
|
+
slotProps: new Map(),
|
|
20
|
+
scheduled: false,
|
|
21
|
+
};
|
|
22
|
+
core.emit = (event) => core.emitter.emit(event);
|
|
23
|
+
core.act = (update) => void update().catch(warn("a state update failed"));
|
|
24
|
+
core.render = () => render(core);
|
|
25
|
+
core.schedule = () => {
|
|
26
|
+
if (core.scheduled || !core.target)
|
|
27
|
+
return;
|
|
28
|
+
core.scheduled = true;
|
|
29
|
+
queueMicrotask(() => {
|
|
30
|
+
core.scheduled = false;
|
|
31
|
+
core.render();
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
core.element = (id) => [...(core.target?.querySelectorAll("[id]") ?? [])].find((el) => el.id === id);
|
|
35
|
+
core.store = createStore({
|
|
36
|
+
initialValues: init.values ?? {},
|
|
37
|
+
validationSchema: core.options.validationSchema,
|
|
38
|
+
validateOnChange: core.options.validateOnChange,
|
|
39
|
+
validateOnBlur: core.options.validateOnBlur,
|
|
40
|
+
onValidated: (errors) => core.emit({ type: "validate", errors }),
|
|
41
|
+
onSubmit: (values) => {
|
|
42
|
+
core.emit({ type: "submit", values });
|
|
43
|
+
return core.options.onSubmit?.(values);
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
core.uploads = createUploads({
|
|
47
|
+
uploads: () => core.options.uploads,
|
|
48
|
+
values: () => core.store.getState().values,
|
|
49
|
+
setValue: (path, value) => core.act(() => core.store.setFieldValue(path, value)),
|
|
50
|
+
rerender: core.schedule,
|
|
51
|
+
pick: (id) => core.element(id)?.click(),
|
|
52
|
+
});
|
|
53
|
+
core.dispatch = (action, event = {}) => runAction({
|
|
54
|
+
store: core.store,
|
|
55
|
+
ui: () => core.ui,
|
|
56
|
+
setUi: (ui) => ((core.ui = ui), core.schedule()),
|
|
57
|
+
emit: core.emit,
|
|
58
|
+
askKey: core.options.askKey ?? (() => (typeof globalThis.prompt === "function" ? globalThis.prompt("Give key") : null)),
|
|
59
|
+
picker: (id) => openPicker(core.element(id)),
|
|
60
|
+
failed: warn("an action failed"),
|
|
61
|
+
}, action, event);
|
|
62
|
+
return core;
|
|
63
|
+
};
|