@gravity-ui/dynamic-forms 5.18.0 → 5.19.0
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/build/cjs/lib/unstable/core/Entity/Entity.js +78 -0
- package/build/cjs/lib/unstable/core/Entity/index.js +5 -0
- package/build/cjs/lib/unstable/core/Entity/types.js +2 -0
- package/build/cjs/lib/unstable/core/Entity/utils.js +40 -0
- package/build/cjs/lib/unstable/core/SchemaRenderer/SchemaRenderer.js +12 -0
- package/build/cjs/lib/unstable/core/SchemaRenderer/index.js +5 -0
- package/build/cjs/lib/unstable/core/constants.js +28 -0
- package/build/cjs/lib/unstable/core/index.js +15 -0
- package/build/cjs/lib/unstable/core/types/components.js +2 -0
- package/build/cjs/lib/unstable/core/types/config.js +2 -0
- package/build/cjs/lib/unstable/core/types/helpers.js +2 -0
- package/build/cjs/lib/unstable/core/types/index.js +8 -0
- package/build/cjs/lib/unstable/core/types/schema.js +2 -0
- package/build/cjs/lib/unstable/core/types/validation.js +2 -0
- package/build/cjs/lib/unstable/core/types/values.js +2 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/constants.js +4 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/hooks/index.js +7 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/hooks/useEntitiesState.js +25 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/hooks/useSchemaRendererMutators.js +17 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/index.js +10 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/async-validation/async-validation.js +35 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/async-validation/index.js +5 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/async-validation/types.js +2 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/external-errors/external-errors.js +60 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/external-errors/index.js +5 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/external-errors/types.js +2 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/index.js +16 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/schema-mutators/index.js +5 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/schema-mutators/schema-mutators.js +81 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/schema-mutators/types.js +2 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/trigger-fields/index.js +5 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/trigger-fields/trigger-fields.js +12 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/trigger-fields/types.js +2 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/types.js +2 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/useSchemaRenderer.js +86 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/utils/common.js +11 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/utils/get-ajv-validate.js +39 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/utils/get-validate.js +67 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/utils/index.js +7 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/utils/process-ajv-error.js +51 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/utils/process-ajv-validate-errors.js +43 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/utils/process-entity-parameters-error.js +36 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/utils/process-errors-state.js +17 -0
- package/build/cjs/lib/unstable/core/utils/common.js +180 -0
- package/build/cjs/lib/unstable/core/utils/index.js +4 -0
- package/build/cjs/lib/unstable/kit/Accordeon.js +31 -0
- package/build/cjs/lib/unstable/kit/Any.js +21 -0
- package/build/cjs/lib/unstable/kit/ArrayBase.css +23 -0
- package/build/cjs/lib/unstable/kit/ArrayBase.js +101 -0
- package/build/cjs/lib/unstable/kit/MultiSelect.css +6 -0
- package/build/cjs/lib/unstable/kit/MultiSelect.js +66 -0
- package/build/cjs/lib/unstable/kit/ObjectBase.css +10 -0
- package/build/cjs/lib/unstable/kit/ObjectBase.js +71 -0
- package/build/cjs/lib/unstable/kit/Row.css +73 -0
- package/build/cjs/lib/unstable/kit/Row.js +50 -0
- package/build/cjs/lib/unstable/kit/Text.js +259 -0
- package/build/cjs/lib/unstable/kit/components/ArrayRemoveButton/ArrayRemoveButton.js +29 -0
- package/build/cjs/lib/unstable/kit/components/ArrayRemoveButton/index.js +5 -0
- package/build/cjs/lib/unstable/kit/components/ControlError/ControlError.css +33 -0
- package/build/cjs/lib/unstable/kit/components/ControlError/ControlError.js +15 -0
- package/build/cjs/lib/unstable/kit/components/ControlError/index.js +5 -0
- package/build/cjs/lib/unstable/kit/components/HTMLContent/HTMLContent.js +11 -0
- package/build/cjs/lib/unstable/kit/components/HTMLContent/index.js +5 -0
- package/build/cjs/lib/unstable/kit/components/index.js +9 -0
- package/build/cjs/lib/unstable/kit/config.js +68 -0
- package/build/cjs/lib/unstable/kit/constants/config.js +62 -0
- package/build/cjs/lib/unstable/kit/constants/index.js +6 -0
- package/build/cjs/lib/unstable/kit/controls/ArrayBase/ArrayBase.js +46 -0
- package/build/cjs/lib/unstable/kit/controls/ArrayBase/index.js +4 -0
- package/build/cjs/lib/unstable/kit/controls/Checkbox/Checkbox.css +5 -0
- package/build/cjs/lib/unstable/kit/controls/Checkbox/Checkbox.js +16 -0
- package/build/cjs/lib/unstable/kit/controls/Checkbox/index.js +5 -0
- package/build/cjs/lib/unstable/kit/controls/CheckboxGroup/CheckboxGroup.css +3 -0
- package/build/cjs/lib/unstable/kit/controls/CheckboxGroup/CheckboxGroup.js +37 -0
- package/build/cjs/lib/unstable/kit/controls/CheckboxGroup/index.js +5 -0
- package/build/cjs/lib/unstable/kit/controls/ColorPicker/ColorPicker.js +24 -0
- package/build/cjs/lib/unstable/kit/controls/ColorPicker/index.js +5 -0
- package/build/cjs/lib/unstable/kit/controls/DateInput/DateInput.css +3 -0
- package/build/cjs/lib/unstable/kit/controls/DateInput/DateInput.js +55 -0
- package/build/cjs/lib/unstable/kit/controls/DateInput/index.js +5 -0
- package/build/cjs/lib/unstable/kit/controls/MultiSelect/MultiSelect.js +35 -0
- package/build/cjs/lib/unstable/kit/controls/MultiSelect/index.js +5 -0
- package/build/cjs/lib/unstable/kit/controls/NumberBase/Number.js +12 -0
- package/build/cjs/lib/unstable/kit/controls/NumberBase/index.js +5 -0
- package/build/cjs/lib/unstable/kit/controls/ObjectBase/ObjectBase.js +33 -0
- package/build/cjs/lib/unstable/kit/controls/ObjectBase/index.js +5 -0
- package/build/cjs/lib/unstable/kit/controls/Password/Password.js +12 -0
- package/build/cjs/lib/unstable/kit/controls/Password/index.js +5 -0
- package/build/cjs/lib/unstable/kit/controls/RadioGroup/RadioGroup.css +3 -0
- package/build/cjs/lib/unstable/kit/controls/RadioGroup/RadioGroup.js +24 -0
- package/build/cjs/lib/unstable/kit/controls/RadioGroup/index.js +5 -0
- package/build/cjs/lib/unstable/kit/controls/RangeSlider/RangeSlider.css +3 -0
- package/build/cjs/lib/unstable/kit/controls/RangeSlider/RangeSlider.js +33 -0
- package/build/cjs/lib/unstable/kit/controls/RangeSlider/index.js +5 -0
- package/build/cjs/lib/unstable/kit/controls/Select/Select.js +32 -0
- package/build/cjs/lib/unstable/kit/controls/Select/index.js +5 -0
- package/build/cjs/lib/unstable/kit/controls/Slider/Slider.css +3 -0
- package/build/cjs/lib/unstable/kit/controls/Slider/Slider.js +19 -0
- package/build/cjs/lib/unstable/kit/controls/Slider/index.js +5 -0
- package/build/cjs/lib/unstable/kit/controls/StringBase/StringBase.js +12 -0
- package/build/cjs/lib/unstable/kit/controls/StringBase/index.js +5 -0
- package/build/cjs/lib/unstable/kit/controls/Switch/Switch.css +5 -0
- package/build/cjs/lib/unstable/kit/controls/Switch/Switch.js +16 -0
- package/build/cjs/lib/unstable/kit/controls/Switch/index.js +5 -0
- package/build/cjs/lib/unstable/kit/controls/TextArea/TextArea.js +12 -0
- package/build/cjs/lib/unstable/kit/controls/TextArea/index.js +5 -0
- package/build/cjs/lib/unstable/kit/controls/index.js +35 -0
- package/build/cjs/lib/unstable/kit/styles/functions.css +0 -0
- package/build/cjs/lib/unstable/kit/styles/variables.css +0 -0
- package/build/cjs/lib/unstable/kit/utils/cn.js +6 -0
- package/build/cjs/lib/unstable/kit/utils/common.js +27 -0
- package/build/cjs/lib/unstable/kit/utils/index.js +11 -0
- package/build/cjs/lib/unstable/kit/wrappers/Row/Row.css +27 -0
- package/build/cjs/lib/unstable/kit/wrappers/Row/Row.js +34 -0
- package/build/cjs/lib/unstable/kit/wrappers/Row/index.js +5 -0
- package/build/cjs/lib/unstable/kit/wrappers/Transparent/Transparent.css +6 -0
- package/build/cjs/lib/unstable/kit/wrappers/Transparent/Transparent.js +15 -0
- package/build/cjs/lib/unstable/kit/wrappers/Transparent/index.js +5 -0
- package/build/cjs/lib/unstable/kit/wrappers/index.js +7 -0
- package/build/cjs/unstable.js +10 -0
- package/build/esm/lib/unstable/core/Entity/Entity.d.ts +10 -0
- package/build/esm/lib/unstable/core/Entity/Entity.js +74 -0
- package/build/esm/lib/unstable/core/Entity/index.d.ts +2 -0
- package/build/esm/lib/unstable/core/Entity/index.js +1 -0
- package/build/esm/lib/unstable/core/Entity/types.d.ts +27 -0
- package/build/esm/lib/unstable/core/Entity/types.js +1 -0
- package/build/esm/lib/unstable/core/Entity/utils.d.ts +3 -0
- package/build/esm/lib/unstable/core/Entity/utils.js +35 -0
- package/build/esm/lib/unstable/core/SchemaRenderer/SchemaRenderer.d.ts +5 -0
- package/build/esm/lib/unstable/core/SchemaRenderer/SchemaRenderer.js +8 -0
- package/build/esm/lib/unstable/core/SchemaRenderer/index.d.ts +1 -0
- package/build/esm/lib/unstable/core/SchemaRenderer/index.js +1 -0
- package/build/esm/lib/unstable/core/constants.d.ts +22 -0
- package/build/esm/lib/unstable/core/constants.js +25 -0
- package/build/esm/lib/unstable/core/index.d.ts +5 -0
- package/build/esm/lib/unstable/core/index.js +4 -0
- package/build/esm/lib/unstable/core/types/components.d.ts +29 -0
- package/build/esm/lib/unstable/core/types/components.js +1 -0
- package/build/esm/lib/unstable/core/types/config.d.ts +36 -0
- package/build/esm/lib/unstable/core/types/config.js +1 -0
- package/build/esm/lib/unstable/core/types/helpers.d.ts +18 -0
- package/build/esm/lib/unstable/core/types/helpers.js +1 -0
- package/build/esm/lib/unstable/core/types/index.d.ts +5 -0
- package/build/esm/lib/unstable/core/types/index.js +5 -0
- package/build/esm/lib/unstable/core/types/schema.d.ts +1186 -0
- package/build/esm/lib/unstable/core/types/schema.js +1 -0
- package/build/esm/lib/unstable/core/types/validation.d.ts +39 -0
- package/build/esm/lib/unstable/core/types/validation.js +1 -0
- package/build/esm/lib/unstable/core/types/values.d.ts +4 -0
- package/build/esm/lib/unstable/core/types/values.js +1 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/constants.d.ts +1 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/constants.js +1 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/hooks/index.d.ts +2 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/hooks/index.js +2 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/hooks/useEntitiesState.d.ts +7 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/hooks/useEntitiesState.js +20 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/hooks/useSchemaRendererMutators.d.ts +10 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/hooks/useSchemaRendererMutators.js +13 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/index.d.ts +3 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/index.js +3 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/async-validation/async-validation.d.ts +3 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/async-validation/async-validation.js +29 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/async-validation/index.d.ts +2 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/async-validation/index.js +2 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/async-validation/types.d.ts +34 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/async-validation/types.js +1 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/external-errors/external-errors.d.ts +3 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/external-errors/external-errors.js +54 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/external-errors/index.d.ts +2 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/external-errors/index.js +2 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/external-errors/types.d.ts +25 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/external-errors/types.js +1 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/index.d.ts +13 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/index.js +13 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/schema-mutators/index.d.ts +2 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/schema-mutators/index.js +2 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/schema-mutators/schema-mutators.d.ts +3 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/schema-mutators/schema-mutators.js +75 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/schema-mutators/types.d.ts +26 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/schema-mutators/types.js +1 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/trigger-fields/index.d.ts +2 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/trigger-fields/index.js +2 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/trigger-fields/trigger-fields.d.ts +2 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/trigger-fields/trigger-fields.js +8 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/trigger-fields/types.d.ts +6 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/trigger-fields/types.js +1 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/types.d.ts +22 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/types.js +1 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/useSchemaRenderer.d.ts +37 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/useSchemaRenderer.js +81 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/utils/common.d.ts +1 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/utils/common.js +7 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/utils/get-ajv-validate.d.ts +11 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/utils/get-ajv-validate.js +34 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/utils/get-validate.d.ts +14 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/utils/get-validate.js +62 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/utils/index.d.ts +2 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/utils/index.js +2 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/utils/process-ajv-error.d.ts +10 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/utils/process-ajv-error.js +46 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/utils/process-ajv-validate-errors.d.ts +20 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/utils/process-ajv-validate-errors.js +39 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/utils/process-entity-parameters-error.d.ts +15 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/utils/process-entity-parameters-error.js +31 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/utils/process-errors-state.d.ts +12 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/utils/process-errors-state.js +12 -0
- package/build/esm/lib/unstable/core/utils/common.d.ts +49 -0
- package/build/esm/lib/unstable/core/utils/common.js +165 -0
- package/build/esm/lib/unstable/core/utils/index.d.ts +1 -0
- package/build/esm/lib/unstable/core/utils/index.js +1 -0
- package/build/esm/lib/unstable/kit/Accordeon.d.ts +3 -0
- package/build/esm/lib/unstable/kit/Accordeon.js +26 -0
- package/build/esm/lib/unstable/kit/Any.d.ts +2 -0
- package/build/esm/lib/unstable/kit/Any.js +16 -0
- package/build/esm/lib/unstable/kit/ArrayBase.css +23 -0
- package/build/esm/lib/unstable/kit/ArrayBase.d.ts +3 -0
- package/build/esm/lib/unstable/kit/ArrayBase.js +97 -0
- package/build/esm/lib/unstable/kit/MultiSelect.css +6 -0
- package/build/esm/lib/unstable/kit/MultiSelect.d.ts +7 -0
- package/build/esm/lib/unstable/kit/MultiSelect.js +62 -0
- package/build/esm/lib/unstable/kit/ObjectBase.css +10 -0
- package/build/esm/lib/unstable/kit/ObjectBase.d.ts +8 -0
- package/build/esm/lib/unstable/kit/ObjectBase.js +66 -0
- package/build/esm/lib/unstable/kit/Row.css +73 -0
- package/build/esm/lib/unstable/kit/Row.d.ts +11 -0
- package/build/esm/lib/unstable/kit/Row.js +47 -0
- package/build/esm/lib/unstable/kit/Text.d.ts +6 -0
- package/build/esm/lib/unstable/kit/Text.js +255 -0
- package/build/esm/lib/unstable/kit/components/ArrayRemoveButton/ArrayRemoveButton.d.ts +5 -0
- package/build/esm/lib/unstable/kit/components/ArrayRemoveButton/ArrayRemoveButton.js +24 -0
- package/build/esm/lib/unstable/kit/components/ArrayRemoveButton/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/components/ArrayRemoveButton/index.js +1 -0
- package/build/esm/lib/unstable/kit/components/ControlError/ControlError.css +33 -0
- package/build/esm/lib/unstable/kit/components/ControlError/ControlError.d.ts +9 -0
- package/build/esm/lib/unstable/kit/components/ControlError/ControlError.js +11 -0
- package/build/esm/lib/unstable/kit/components/ControlError/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/components/ControlError/index.js +1 -0
- package/build/esm/lib/unstable/kit/components/HTMLContent/HTMLContent.d.ts +6 -0
- package/build/esm/lib/unstable/kit/components/HTMLContent/HTMLContent.js +7 -0
- package/build/esm/lib/unstable/kit/components/HTMLContent/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/components/HTMLContent/index.js +1 -0
- package/build/esm/lib/unstable/kit/components/index.d.ts +3 -0
- package/build/esm/lib/unstable/kit/components/index.js +3 -0
- package/build/esm/lib/unstable/kit/config.d.ts +95 -0
- package/build/esm/lib/unstable/kit/config.js +65 -0
- package/build/esm/lib/unstable/kit/constants/config.d.ts +112 -0
- package/build/esm/lib/unstable/kit/constants/config.js +59 -0
- package/build/esm/lib/unstable/kit/constants/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/constants/index.js +1 -0
- package/build/esm/lib/unstable/kit/controls/ArrayBase/ArrayBase.d.ts +8 -0
- package/build/esm/lib/unstable/kit/controls/ArrayBase/ArrayBase.js +42 -0
- package/build/esm/lib/unstable/kit/controls/ArrayBase/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/controls/ArrayBase/index.js +1 -0
- package/build/esm/lib/unstable/kit/controls/Checkbox/Checkbox.css +5 -0
- package/build/esm/lib/unstable/kit/controls/Checkbox/Checkbox.d.ts +7 -0
- package/build/esm/lib/unstable/kit/controls/Checkbox/Checkbox.js +13 -0
- package/build/esm/lib/unstable/kit/controls/Checkbox/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/controls/Checkbox/index.js +1 -0
- package/build/esm/lib/unstable/kit/controls/CheckboxGroup/CheckboxGroup.css +3 -0
- package/build/esm/lib/unstable/kit/controls/CheckboxGroup/CheckboxGroup.d.ts +10 -0
- package/build/esm/lib/unstable/kit/controls/CheckboxGroup/CheckboxGroup.js +34 -0
- package/build/esm/lib/unstable/kit/controls/CheckboxGroup/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/controls/CheckboxGroup/index.js +1 -0
- package/build/esm/lib/unstable/kit/controls/ColorPicker/ColorPicker.d.ts +6 -0
- package/build/esm/lib/unstable/kit/controls/ColorPicker/ColorPicker.js +21 -0
- package/build/esm/lib/unstable/kit/controls/ColorPicker/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/controls/ColorPicker/index.js +1 -0
- package/build/esm/lib/unstable/kit/controls/DateInput/DateInput.css +3 -0
- package/build/esm/lib/unstable/kit/controls/DateInput/DateInput.d.ts +9 -0
- package/build/esm/lib/unstable/kit/controls/DateInput/DateInput.js +53 -0
- package/build/esm/lib/unstable/kit/controls/DateInput/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/controls/DateInput/index.js +1 -0
- package/build/esm/lib/unstable/kit/controls/MultiSelect/MultiSelect.d.ts +8 -0
- package/build/esm/lib/unstable/kit/controls/MultiSelect/MultiSelect.js +32 -0
- package/build/esm/lib/unstable/kit/controls/MultiSelect/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/controls/MultiSelect/index.js +1 -0
- package/build/esm/lib/unstable/kit/controls/NumberBase/Number.d.ts +6 -0
- package/build/esm/lib/unstable/kit/controls/NumberBase/Number.js +8 -0
- package/build/esm/lib/unstable/kit/controls/NumberBase/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/controls/NumberBase/index.js +1 -0
- package/build/esm/lib/unstable/kit/controls/ObjectBase/ObjectBase.d.ts +8 -0
- package/build/esm/lib/unstable/kit/controls/ObjectBase/ObjectBase.js +29 -0
- package/build/esm/lib/unstable/kit/controls/ObjectBase/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/controls/ObjectBase/index.js +1 -0
- package/build/esm/lib/unstable/kit/controls/Password/Password.d.ts +6 -0
- package/build/esm/lib/unstable/kit/controls/Password/Password.js +8 -0
- package/build/esm/lib/unstable/kit/controls/Password/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/controls/Password/index.js +1 -0
- package/build/esm/lib/unstable/kit/controls/RadioGroup/RadioGroup.css +3 -0
- package/build/esm/lib/unstable/kit/controls/RadioGroup/RadioGroup.d.ts +9 -0
- package/build/esm/lib/unstable/kit/controls/RadioGroup/RadioGroup.js +22 -0
- package/build/esm/lib/unstable/kit/controls/RadioGroup/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/controls/RadioGroup/index.js +1 -0
- package/build/esm/lib/unstable/kit/controls/RangeSlider/RangeSlider.css +3 -0
- package/build/esm/lib/unstable/kit/controls/RangeSlider/RangeSlider.d.ts +8 -0
- package/build/esm/lib/unstable/kit/controls/RangeSlider/RangeSlider.js +31 -0
- package/build/esm/lib/unstable/kit/controls/RangeSlider/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/controls/RangeSlider/index.js +1 -0
- package/build/esm/lib/unstable/kit/controls/Select/Select.d.ts +9 -0
- package/build/esm/lib/unstable/kit/controls/Select/Select.js +29 -0
- package/build/esm/lib/unstable/kit/controls/Select/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/controls/Select/index.js +1 -0
- package/build/esm/lib/unstable/kit/controls/Slider/Slider.css +3 -0
- package/build/esm/lib/unstable/kit/controls/Slider/Slider.d.ts +7 -0
- package/build/esm/lib/unstable/kit/controls/Slider/Slider.js +16 -0
- package/build/esm/lib/unstable/kit/controls/Slider/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/controls/Slider/index.js +1 -0
- package/build/esm/lib/unstable/kit/controls/StringBase/StringBase.d.ts +6 -0
- package/build/esm/lib/unstable/kit/controls/StringBase/StringBase.js +8 -0
- package/build/esm/lib/unstable/kit/controls/StringBase/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/controls/StringBase/index.js +1 -0
- package/build/esm/lib/unstable/kit/controls/Switch/Switch.css +5 -0
- package/build/esm/lib/unstable/kit/controls/Switch/Switch.d.ts +7 -0
- package/build/esm/lib/unstable/kit/controls/Switch/Switch.js +13 -0
- package/build/esm/lib/unstable/kit/controls/Switch/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/controls/Switch/index.js +1 -0
- package/build/esm/lib/unstable/kit/controls/TextArea/TextArea.d.ts +6 -0
- package/build/esm/lib/unstable/kit/controls/TextArea/TextArea.js +8 -0
- package/build/esm/lib/unstable/kit/controls/TextArea/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/controls/TextArea/index.js +1 -0
- package/build/esm/lib/unstable/kit/controls/index.d.ts +16 -0
- package/build/esm/lib/unstable/kit/controls/index.js +16 -0
- package/build/esm/lib/unstable/kit/styles/functions.css +0 -0
- package/build/esm/lib/unstable/kit/styles/variables.css +0 -0
- package/build/esm/lib/unstable/kit/utils/cn.d.ts +1 -0
- package/build/esm/lib/unstable/kit/utils/cn.js +3 -0
- package/build/esm/lib/unstable/kit/utils/common.d.ts +7 -0
- package/build/esm/lib/unstable/kit/utils/common.js +19 -0
- package/build/esm/lib/unstable/kit/utils/index.d.ts +2 -0
- package/build/esm/lib/unstable/kit/utils/index.js +2 -0
- package/build/esm/lib/unstable/kit/wrappers/Row/Row.css +27 -0
- package/build/esm/lib/unstable/kit/wrappers/Row/Row.d.ts +7 -0
- package/build/esm/lib/unstable/kit/wrappers/Row/Row.js +31 -0
- package/build/esm/lib/unstable/kit/wrappers/Row/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/wrappers/Row/index.js +1 -0
- package/build/esm/lib/unstable/kit/wrappers/Transparent/Transparent.css +6 -0
- package/build/esm/lib/unstable/kit/wrappers/Transparent/Transparent.d.ts +4 -0
- package/build/esm/lib/unstable/kit/wrappers/Transparent/Transparent.js +12 -0
- package/build/esm/lib/unstable/kit/wrappers/Transparent/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/wrappers/Transparent/index.js +1 -0
- package/build/esm/lib/unstable/kit/wrappers/index.d.ts +2 -0
- package/build/esm/lib/unstable/kit/wrappers/index.js +2 -0
- package/build/esm/unstable.d.ts +4 -0
- package/build/esm/unstable.js +4 -0
- package/package.json +24 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { SchemaToValueType } from './helpers';
|
|
2
|
+
import type { JsonSchema } from './schema';
|
|
3
|
+
import type { ObjectValue } from './values';
|
|
4
|
+
type ArrayError = SyncValidateError[];
|
|
5
|
+
interface ObjectError extends Record<string, SyncValidateError> {
|
|
6
|
+
}
|
|
7
|
+
export type SyncValidateError = ArrayError | boolean | string | ObjectError | undefined;
|
|
8
|
+
export type AsyncValidateError = Promise<SyncValidateError>;
|
|
9
|
+
export type SyncValidator<Schema extends JsonSchema> = (value: SchemaToValueType<Schema> | null | undefined, allValues: ObjectValue) => SyncValidateError;
|
|
10
|
+
export type AsyncValidator<Schema extends JsonSchema> = (value: SchemaToValueType<Schema> | null | undefined, allValues: ObjectValue) => AsyncValidateError;
|
|
11
|
+
export type Validator<Schema extends JsonSchema> = SyncValidator<Schema> | AsyncValidator<Schema>;
|
|
12
|
+
export interface ErrorMessages {
|
|
13
|
+
additionalItems?: string;
|
|
14
|
+
additionalProperties?: string;
|
|
15
|
+
anyOf?: string;
|
|
16
|
+
const?: string;
|
|
17
|
+
contains?: string;
|
|
18
|
+
dependencies?: string;
|
|
19
|
+
enum?: string;
|
|
20
|
+
exclusiveMaximum?: string;
|
|
21
|
+
exclusiveMinimum?: string;
|
|
22
|
+
maxItems?: string;
|
|
23
|
+
maxLength?: string;
|
|
24
|
+
maxProperties?: string;
|
|
25
|
+
maximum?: string;
|
|
26
|
+
minItems?: string;
|
|
27
|
+
minLength?: string;
|
|
28
|
+
minProperties?: string;
|
|
29
|
+
minimum?: string;
|
|
30
|
+
multipleOf?: string;
|
|
31
|
+
not?: string;
|
|
32
|
+
oneOf?: string;
|
|
33
|
+
pattern?: string;
|
|
34
|
+
propertyNames?: string;
|
|
35
|
+
required?: string;
|
|
36
|
+
type?: string;
|
|
37
|
+
uniqueItems?: string;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ENTITY_SERVICE_FIELD = "ENTITY_SERVICE_FIELD";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ENTITY_SERVICE_FIELD = 'ENTITY_SERVICE_FIELD';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const useEntitiesState: (name: string) => {
|
|
2
|
+
config: import("../..").SchemaRendererConfig | undefined;
|
|
3
|
+
error: import("../..").SyncValidateError;
|
|
4
|
+
headName: string | undefined;
|
|
5
|
+
mode: import("../..").SchemaRendererMode | undefined;
|
|
6
|
+
rootSchema: import("../..").JsonSchema | undefined;
|
|
7
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useField, useForm } from 'react-final-form';
|
|
3
|
+
import { ENTITY_SERVICE_FIELD } from '../constants';
|
|
4
|
+
import { guessHeadName } from '../utils';
|
|
5
|
+
export const useEntitiesState = (name) => {
|
|
6
|
+
var _a;
|
|
7
|
+
const form = useForm();
|
|
8
|
+
const headName = React.useMemo(() => guessHeadName(form.getRegisteredFields(), name), [form, name]);
|
|
9
|
+
const field = useField(`${ENTITY_SERVICE_FIELD}.${headName}`, { subscription: { data: true } });
|
|
10
|
+
const { config, errorsRef, mode, schema: rootSchema } = (field.meta.data || {});
|
|
11
|
+
const error = (_a = errorsRef === null || errorsRef === void 0 ? void 0 : errorsRef.current) === null || _a === void 0 ? void 0 : _a[name];
|
|
12
|
+
const state = React.useMemo(() => ({
|
|
13
|
+
config,
|
|
14
|
+
error,
|
|
15
|
+
headName,
|
|
16
|
+
mode,
|
|
17
|
+
rootSchema,
|
|
18
|
+
}), [config, error, headName, mode, rootSchema]);
|
|
19
|
+
return state;
|
|
20
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RemoveExternalErrorsMutator, RemoveSchemaMutatorsMutator, SetAsyncValidationCacheMutator, SetAsyncValidationWaitersMutator, SetExternalErrorsMutator, SetSchemaMutatorsMutator, TriggerFieldsMutator } from '../mutators';
|
|
2
|
+
export declare const useSchemaRendererMutators: () => {
|
|
3
|
+
removeExternalErrors: RemoveExternalErrorsMutator | undefined;
|
|
4
|
+
removeSchemaMutators: RemoveSchemaMutatorsMutator | undefined;
|
|
5
|
+
setAsyncValidationCache: SetAsyncValidationCacheMutator | undefined;
|
|
6
|
+
setAsyncValidationWaiters: SetAsyncValidationWaitersMutator | undefined;
|
|
7
|
+
setExternalErrors: SetExternalErrorsMutator | undefined;
|
|
8
|
+
setSchemaMutators: SetSchemaMutatorsMutator | undefined;
|
|
9
|
+
triggerFields: TriggerFieldsMutator | undefined;
|
|
10
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useForm } from 'react-final-form';
|
|
2
|
+
export const useSchemaRendererMutators = () => {
|
|
3
|
+
const { removeExternalErrors, removeSchemaMutators, setAsyncValidationCache, setAsyncValidationWaiters, setExternalErrors, setSchemaMutators, triggerFields, } = useForm().mutators;
|
|
4
|
+
return {
|
|
5
|
+
removeExternalErrors,
|
|
6
|
+
removeSchemaMutators,
|
|
7
|
+
setAsyncValidationCache,
|
|
8
|
+
setAsyncValidationWaiters,
|
|
9
|
+
setExternalErrors,
|
|
10
|
+
setSchemaMutators,
|
|
11
|
+
triggerFields,
|
|
12
|
+
};
|
|
13
|
+
};
|
package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/async-validation/async-validation.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import isEqual from 'lodash/isEqual';
|
|
2
|
+
import omit from 'lodash/omit';
|
|
3
|
+
export const setAsyncValidationWaiters = ([{ headName, waiters }], mutableState) => {
|
|
4
|
+
const field = mutableState.fields[headName];
|
|
5
|
+
if (field && waiters) {
|
|
6
|
+
Object.keys(waiters).forEach((waiterName) => {
|
|
7
|
+
field.data = Object.assign(Object.assign({}, field.data), { waiters: Object.assign(Object.assign({}, field.data.waiters), { [waiterName]: waiters[waiterName] }) });
|
|
8
|
+
const waiterField = mutableState.fields[waiterName];
|
|
9
|
+
if (waiterField) {
|
|
10
|
+
waiterField.validating = true;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export const setAsyncValidationCache = ([{ headName, cache }], mutableState) => {
|
|
16
|
+
const field = mutableState.fields[headName];
|
|
17
|
+
if (field && cache) {
|
|
18
|
+
Object.keys(cache).forEach((cacheName) => {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
field.data = Object.assign(Object.assign({}, field.data), { cache: Object.assign(Object.assign({}, field.data.cache), { [cacheName]: [...(((_a = field.data.cache) === null || _a === void 0 ? void 0 : _a[cacheName]) || []), cache[cacheName]] }) });
|
|
21
|
+
const cacheField = mutableState.fields[cacheName];
|
|
22
|
+
const waiter = (_b = field.data.waiters) === null || _b === void 0 ? void 0 : _b[cacheName];
|
|
23
|
+
if (cacheField && waiter && isEqual(waiter, omit(cache[cacheName], 'result'))) {
|
|
24
|
+
field.data.waiters = omit(field.data.waiters, cacheName);
|
|
25
|
+
cacheField.validating = false;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { MutableState, Tools } from 'final-form';
|
|
2
|
+
import type { FieldValue, JsonSchema, SyncValidateError, Validator } from '../../../types';
|
|
3
|
+
export interface AsyncValidationWaiter {
|
|
4
|
+
schema: JsonSchema;
|
|
5
|
+
validator: Validator<JsonSchema>;
|
|
6
|
+
value: FieldValue;
|
|
7
|
+
}
|
|
8
|
+
export interface AsyncValidationCache extends AsyncValidationWaiter {
|
|
9
|
+
result: SyncValidateError;
|
|
10
|
+
}
|
|
11
|
+
export interface AsyncValidationState {
|
|
12
|
+
cache?: {
|
|
13
|
+
[key: string]: AsyncValidationCache[] | undefined;
|
|
14
|
+
};
|
|
15
|
+
waiters?: {
|
|
16
|
+
[key: string]: AsyncValidationWaiter | undefined;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface SetAsyncValidationWaitersParams {
|
|
20
|
+
headName: string;
|
|
21
|
+
waiters: {
|
|
22
|
+
[key: string]: AsyncValidationWaiter;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export type SetAsyncValidationWaitersFunction<FormValues = object, InitialFormValues = Partial<FormValues>> = (args: [SetAsyncValidationWaitersParams], state: MutableState<FormValues, InitialFormValues>, tools: Tools<FormValues, InitialFormValues>) => void;
|
|
26
|
+
export type SetAsyncValidationWaitersMutator = (params: SetAsyncValidationWaitersParams) => void;
|
|
27
|
+
export interface SetAsyncValidationCacheParams {
|
|
28
|
+
cache: {
|
|
29
|
+
[key: string]: AsyncValidationCache;
|
|
30
|
+
};
|
|
31
|
+
headName: string;
|
|
32
|
+
}
|
|
33
|
+
export type SetAsyncValidationCacheFunction<FormValues = object, InitialFormValues = Partial<FormValues>> = (args: [SetAsyncValidationCacheParams], state: MutableState<FormValues, InitialFormValues>, tools: Tools<FormValues, InitialFormValues>) => void;
|
|
34
|
+
export type SetAsyncValidationCacheMutator = (params: SetAsyncValidationCacheParams) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/external-errors/external-errors.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import omit from 'lodash/omit';
|
|
2
|
+
import { ENTITY_SERVICE_FIELD } from '../../constants';
|
|
3
|
+
import { guessHeadName } from '../../utils';
|
|
4
|
+
export const setExternalErrors = ([{ priorityErrors, regularErrors }], mutableState) => {
|
|
5
|
+
const registeredFields = Object.keys(mutableState.fields);
|
|
6
|
+
Object.entries(priorityErrors || {}).forEach(([key, value]) => {
|
|
7
|
+
const headName = guessHeadName(registeredFields, key);
|
|
8
|
+
if (headName) {
|
|
9
|
+
const field = mutableState.fields[headName];
|
|
10
|
+
if (field) {
|
|
11
|
+
field.data = Object.assign(Object.assign({}, field.data), { priorityErrors: Object.assign(Object.assign({}, field.data.priorityErrors), { [key]: value }) });
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
Object.entries(regularErrors || {}).forEach(([key, value]) => {
|
|
16
|
+
const headName = guessHeadName(registeredFields, key);
|
|
17
|
+
if (headName) {
|
|
18
|
+
const field = mutableState.fields[headName];
|
|
19
|
+
if (field) {
|
|
20
|
+
field.data = Object.assign(Object.assign({}, field.data), { regularErrors: Object.assign(Object.assign({}, field.data.regularErrors), { [key]: value }) });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export const removeExternalErrors = ([{ removeFunctionOrNames }], mutableState) => {
|
|
26
|
+
const registeredFields = Object.keys(mutableState.fields);
|
|
27
|
+
if (Array.isArray(removeFunctionOrNames)) {
|
|
28
|
+
removeFunctionOrNames.forEach((name) => {
|
|
29
|
+
const headName = guessHeadName(registeredFields, name);
|
|
30
|
+
if (headName) {
|
|
31
|
+
const field = mutableState.fields[headName];
|
|
32
|
+
if (field) {
|
|
33
|
+
field.data = Object.assign(Object.assign({}, field.data), { priorityErrors: omit(Object.assign({}, field.data.priorityErrors), name), regularErrors: omit(Object.assign({}, field.data.regularErrors), name) });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
registeredFields.forEach((fieldName) => {
|
|
40
|
+
if (fieldName.startsWith(ENTITY_SERVICE_FIELD)) {
|
|
41
|
+
const headName = fieldName.slice(`${ENTITY_SERVICE_FIELD}.`.length);
|
|
42
|
+
const field = mutableState.fields[headName];
|
|
43
|
+
if (field) {
|
|
44
|
+
const { priorityErrors, regularErrors } = removeFunctionOrNames(headName, {
|
|
45
|
+
priorityErrors: field.data.priorityErrors,
|
|
46
|
+
regularErrors: field.data.regularErrors,
|
|
47
|
+
});
|
|
48
|
+
field.data = Object.assign(Object.assign({}, field.data), { priorityErrors,
|
|
49
|
+
regularErrors });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { MutableState, Tools } from 'final-form';
|
|
2
|
+
import type { SyncValidateError } from '../../../types';
|
|
3
|
+
export interface ExternalErrorsState {
|
|
4
|
+
priorityErrors?: {
|
|
5
|
+
[key: string]: SyncValidateError;
|
|
6
|
+
};
|
|
7
|
+
regularErrors?: {
|
|
8
|
+
[key: string]: SyncValidateError;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface SetExternalErrorsParams {
|
|
12
|
+
priorityErrors?: {
|
|
13
|
+
[key: string]: SyncValidateError;
|
|
14
|
+
};
|
|
15
|
+
regularErrors?: {
|
|
16
|
+
[key: string]: SyncValidateError;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export type SetExternalErrorsFunction<FormValues = object, InitialFormValues = Partial<FormValues>> = (args: [SetExternalErrorsParams], state: MutableState<FormValues, InitialFormValues>, tools: Tools<FormValues, InitialFormValues>) => void;
|
|
20
|
+
export type SetExternalErrorsMutator = (params: SetExternalErrorsParams) => void;
|
|
21
|
+
export interface RemoveExternalErrorsParams {
|
|
22
|
+
removeFunctionOrNames: string[] | ((headName: string, state: ExternalErrorsState) => ExternalErrorsState);
|
|
23
|
+
}
|
|
24
|
+
export type RemoveExternalErrorsFunction<FormValues = object, InitialFormValues = Partial<FormValues>> = (args: [RemoveExternalErrorsParams], state: MutableState<FormValues, InitialFormValues>, tools: Tools<FormValues, InitialFormValues>) => void;
|
|
25
|
+
export type RemoveExternalErrorsMutator = (params: RemoveExternalErrorsParams) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type * from './async-validation';
|
|
2
|
+
export type * from './external-errors';
|
|
3
|
+
export type * from './schema-mutators';
|
|
4
|
+
export type * from './trigger-fields';
|
|
5
|
+
export declare const schemaRendererMutators: {
|
|
6
|
+
removeExternalErrors: import("./external-errors").RemoveExternalErrorsFunction;
|
|
7
|
+
removeSchemaMutators: import("./schema-mutators").RemoveSchemaMutatorsFunction;
|
|
8
|
+
setAsyncValidationCache: import("./async-validation").SetAsyncValidationCacheFunction;
|
|
9
|
+
setAsyncValidationWaiters: import("./async-validation").SetAsyncValidationWaitersFunction;
|
|
10
|
+
setExternalErrors: import("./external-errors").SetExternalErrorsFunction;
|
|
11
|
+
setSchemaMutators: import("./schema-mutators").SetSchemaMutatorsFunction;
|
|
12
|
+
triggerFields: import("./trigger-fields").TriggerFieldsFunction;
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { setAsyncValidationCache, setAsyncValidationWaiters } from './async-validation';
|
|
2
|
+
import { removeExternalErrors, setExternalErrors } from './external-errors';
|
|
3
|
+
import { removeSchemaMutators, setSchemaMutators } from './schema-mutators';
|
|
4
|
+
import { triggerFields } from './trigger-fields';
|
|
5
|
+
export const schemaRendererMutators = {
|
|
6
|
+
removeExternalErrors,
|
|
7
|
+
removeSchemaMutators,
|
|
8
|
+
setAsyncValidationCache,
|
|
9
|
+
setAsyncValidationWaiters,
|
|
10
|
+
setExternalErrors,
|
|
11
|
+
setSchemaMutators,
|
|
12
|
+
triggerFields,
|
|
13
|
+
};
|
package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/schema-mutators/schema-mutators.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
2
|
+
import get from 'lodash/get';
|
|
3
|
+
import isEqual from 'lodash/isEqual';
|
|
4
|
+
import { getSchemaPath, getValuePaths, parseSchemaPath, smartSet } from '../../../utils';
|
|
5
|
+
import { guessHeadName } from '../../utils';
|
|
6
|
+
const applyMutators = ({ mutableState, mutators, }) => {
|
|
7
|
+
const registeredFields = Object.keys(mutableState.fields);
|
|
8
|
+
mutators.forEach((m) => {
|
|
9
|
+
const headName = guessHeadName(registeredFields, m.name);
|
|
10
|
+
if (headName) {
|
|
11
|
+
const headField = mutableState.fields[headName];
|
|
12
|
+
const data = headField === null || headField === void 0 ? void 0 : headField.data;
|
|
13
|
+
const mutatedSchema = data === null || data === void 0 ? void 0 : data.schema;
|
|
14
|
+
if (mutatedSchema) {
|
|
15
|
+
const schemaPath = getSchemaPath(m.name, headName, mutatedSchema);
|
|
16
|
+
if (schemaPath) {
|
|
17
|
+
smartSet(mutatedSchema, schemaPath, m.schema);
|
|
18
|
+
const schemaField = mutableState.fields[m.name];
|
|
19
|
+
if (schemaField) {
|
|
20
|
+
schemaField.data = Object.assign(Object.assign({}, schemaField.data), { schema: get(mutatedSchema, schemaPath) });
|
|
21
|
+
}
|
|
22
|
+
headField.data.mutators = [...((data === null || data === void 0 ? void 0 : data.mutators) || []), m];
|
|
23
|
+
headField.data.schema = mutatedSchema;
|
|
24
|
+
const mutatedPaths = getValuePaths(m.schema).map((path) => [
|
|
25
|
+
...schemaPath,
|
|
26
|
+
...path,
|
|
27
|
+
]);
|
|
28
|
+
Object.values(mutableState.fields).forEach((field) => {
|
|
29
|
+
var _a;
|
|
30
|
+
const data = field === null || field === void 0 ? void 0 : field.data;
|
|
31
|
+
if (((_a = data === null || data === void 0 ? void 0 : data.schema) === null || _a === void 0 ? void 0 : _a.$ref) && (data === null || data === void 0 ? void 0 : data.headName) === headName) {
|
|
32
|
+
const refPath = parseSchemaPath(data.schema.$ref);
|
|
33
|
+
const mutationAffectRefSchema = mutatedPaths.some((mutatedPath) => refPath.every((subpath, index) => mutatedPath[index] === subpath));
|
|
34
|
+
const fieldSchemaPath = getSchemaPath(field.name, headName, mutatedSchema);
|
|
35
|
+
if (mutationAffectRefSchema && fieldSchemaPath) {
|
|
36
|
+
field.data = Object.assign(Object.assign({}, field.data), { schema: Object.assign({}, get(mutatedSchema, fieldSchemaPath)) });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
export const setSchemaMutators = ([{ mutators }], mutableState) => {
|
|
46
|
+
applyMutators({ mutableState, mutators });
|
|
47
|
+
};
|
|
48
|
+
export const removeSchemaMutators = ([{ mutatorsToRemove }], mutableState) => {
|
|
49
|
+
const registeredFields = Object.keys(mutableState.fields);
|
|
50
|
+
[...new Set(mutatorsToRemove.map((m) => guessHeadName(registeredFields, m.name)))].forEach((name) => {
|
|
51
|
+
if (name) {
|
|
52
|
+
const headField = mutableState.fields[name];
|
|
53
|
+
const data = headField === null || headField === void 0 ? void 0 : headField.data;
|
|
54
|
+
const originalSchema = data === null || data === void 0 ? void 0 : data.originalSchema;
|
|
55
|
+
const mutators = (data === null || data === void 0 ? void 0 : data.mutators) || [];
|
|
56
|
+
if (headField && originalSchema) {
|
|
57
|
+
applyMutators({
|
|
58
|
+
mutableState,
|
|
59
|
+
mutators: mutators.map((m) => {
|
|
60
|
+
const schemaPath = getSchemaPath(m.name, name, originalSchema);
|
|
61
|
+
return Object.assign(Object.assign({}, m), { schema: schemaPath
|
|
62
|
+
? cloneDeep(get(originalSchema, schemaPath))
|
|
63
|
+
: {} });
|
|
64
|
+
}),
|
|
65
|
+
});
|
|
66
|
+
headField.data.mutators = [];
|
|
67
|
+
applyMutators({
|
|
68
|
+
mutableState,
|
|
69
|
+
mutators: mutators.filter((m) => !mutatorsToRemove.some(({ name, schema }) => name === m.name &&
|
|
70
|
+
(isEqual(m.schema, schema) || schema === true))),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { MutableState, Tools } from 'final-form';
|
|
2
|
+
import type { JsonSchema } from '../../../types';
|
|
3
|
+
export interface SchemaMutatorsState {
|
|
4
|
+
mutators?: {
|
|
5
|
+
name: string;
|
|
6
|
+
schema: JsonSchema;
|
|
7
|
+
}[];
|
|
8
|
+
originalSchema?: JsonSchema;
|
|
9
|
+
schema?: JsonSchema;
|
|
10
|
+
}
|
|
11
|
+
export interface SetSchemaMutatorsParams {
|
|
12
|
+
mutators: {
|
|
13
|
+
name: string;
|
|
14
|
+
schema: JsonSchema;
|
|
15
|
+
}[];
|
|
16
|
+
}
|
|
17
|
+
export type SetSchemaMutatorsFunction<FormValues = object, InitialFormValues = Partial<FormValues>> = (args: [SetSchemaMutatorsParams], state: MutableState<FormValues, InitialFormValues>, tools: Tools<FormValues, InitialFormValues>) => void;
|
|
18
|
+
export type SetSchemaMutatorsMutator = (params: SetSchemaMutatorsParams) => void;
|
|
19
|
+
export interface RemoveSchemaMutatorsParams {
|
|
20
|
+
mutatorsToRemove: {
|
|
21
|
+
name: string;
|
|
22
|
+
schema: JsonSchema | true;
|
|
23
|
+
}[];
|
|
24
|
+
}
|
|
25
|
+
export type RemoveSchemaMutatorsFunction<FormValues = object, InitialFormValues = Partial<FormValues>> = (args: [RemoveSchemaMutatorsParams], state: MutableState<FormValues, InitialFormValues>, tools: Tools<FormValues, InitialFormValues>) => void;
|
|
26
|
+
export type RemoveSchemaMutatorsMutator = (params: RemoveSchemaMutatorsParams) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/trigger-fields/trigger-fields.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const triggerFields = ([{ fields }], mutableState) => {
|
|
2
|
+
fields.forEach((fieldName) => {
|
|
3
|
+
const field = mutableState.fields[fieldName];
|
|
4
|
+
if (field) {
|
|
5
|
+
field.data = Object.assign(Object.assign({}, field.data), { count: (field.data.count || 0) + 1 });
|
|
6
|
+
}
|
|
7
|
+
});
|
|
8
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MutableState, Tools } from 'final-form';
|
|
2
|
+
export interface TriggerFieldsParams {
|
|
3
|
+
fields: string[];
|
|
4
|
+
}
|
|
5
|
+
export type TriggerFieldsFunction<FormValues = object, InitialFormValues = Partial<FormValues>> = (args: [TriggerFieldsParams], state: MutableState<FormValues, InitialFormValues>, tools: Tools<FormValues, InitialFormValues>) => void;
|
|
6
|
+
export type TriggerFieldsMutator = (params: TriggerFieldsParams) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ErrorObject } from 'ajv';
|
|
2
|
+
import type { SchemaRendererMode } from '../constants';
|
|
3
|
+
import type { FieldValue, JsonSchema, SchemaRendererConfig, SyncValidateError, Validator } from '../types';
|
|
4
|
+
import type { AsyncValidationState, ExternalErrorsState, SchemaMutatorsState } from './mutators';
|
|
5
|
+
export type EntityParametersError = ErrorObject<'entityParameters', {
|
|
6
|
+
schema: JsonSchema;
|
|
7
|
+
validator: Validator<JsonSchema>;
|
|
8
|
+
value: FieldValue;
|
|
9
|
+
}>;
|
|
10
|
+
export interface ValidateErrorItem {
|
|
11
|
+
error: SyncValidateError;
|
|
12
|
+
path: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface EntitiesState {
|
|
15
|
+
config?: SchemaRendererConfig;
|
|
16
|
+
errorsRef?: React.RefObject<Record<string, SyncValidateError>>;
|
|
17
|
+
headName?: string;
|
|
18
|
+
mode?: SchemaRendererMode;
|
|
19
|
+
schema?: SchemaMutatorsState['schema'];
|
|
20
|
+
}
|
|
21
|
+
export interface SchemaRendererState extends AsyncValidationState, ExternalErrorsState, SchemaMutatorsState {
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { FieldValidator } from 'final-form';
|
|
2
|
+
import { type SchemaRendererMode } from '../constants';
|
|
3
|
+
import type { ErrorMessages, FieldValue, JsonSchema, SchemaRendererConfig } from '../types';
|
|
4
|
+
export interface UseSchemaRendererParams {
|
|
5
|
+
config: SchemaRendererConfig;
|
|
6
|
+
connectValidate?: boolean;
|
|
7
|
+
errorMessages?: ErrorMessages;
|
|
8
|
+
mode: SchemaRendererMode;
|
|
9
|
+
/**
|
|
10
|
+
* The `name` prop must be a non-empty string.
|
|
11
|
+
*
|
|
12
|
+
* In `final-form` and `react-final-form`, the `name` is used as a key to register
|
|
13
|
+
* the field within the form. If you pass an empty string (`name=""`), the field will
|
|
14
|
+
* not be registered, its value will not be tracked, and validation will not work.
|
|
15
|
+
*
|
|
16
|
+
* This can lead to:
|
|
17
|
+
* - the field being missing from the form `values`;
|
|
18
|
+
* - the `validate` function not being called;
|
|
19
|
+
* - no error or touched state updates;
|
|
20
|
+
* - inconsistent or broken form behavior.
|
|
21
|
+
*
|
|
22
|
+
* Always provide a unique, non-empty string for the field name.
|
|
23
|
+
*/
|
|
24
|
+
name: string;
|
|
25
|
+
schema: JsonSchema;
|
|
26
|
+
}
|
|
27
|
+
export type UseSchemaRendererReturn = {
|
|
28
|
+
schema: JsonSchema | undefined;
|
|
29
|
+
validate: FieldValidator<FieldValue> | undefined;
|
|
30
|
+
};
|
|
31
|
+
export declare const useSchemaRenderer: ({ config, connectValidate, errorMessages, mode, name, schema: originalSchema, }: UseSchemaRendererParams) => {
|
|
32
|
+
schema: JsonSchema | undefined;
|
|
33
|
+
validate?: undefined;
|
|
34
|
+
} | {
|
|
35
|
+
schema: JsonSchema | undefined;
|
|
36
|
+
validate: (value?: FieldValue) => any;
|
|
37
|
+
};
|