@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,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Entity = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const react_final_form_1 = require("react-final-form");
|
|
7
|
+
const constants_1 = require("../constants");
|
|
8
|
+
const useSchemaRenderer_1 = require("../useSchemaRenderer");
|
|
9
|
+
const utils_1 = require("../utils");
|
|
10
|
+
const utils_2 = require("./utils");
|
|
11
|
+
const EntityComponent = ({ modeOverride, name, schema: schemaProps = {}, schemaOverride, }) => {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
const { config, error, headName, mode: modeState, rootSchema } = (0, useSchemaRenderer_1.useEntitiesState)(name);
|
|
14
|
+
const getAccumulatedSchema = react_1.default.useCallback((schema, root, override) => {
|
|
15
|
+
let accumulatedSchema = schema;
|
|
16
|
+
if (override) {
|
|
17
|
+
accumulatedSchema = (0, utils_1.smartMerge)(accumulatedSchema, override);
|
|
18
|
+
}
|
|
19
|
+
if (accumulatedSchema.$ref && root) {
|
|
20
|
+
const schemaByRef = (0, utils_1.getSchemaBySchemaPath)(accumulatedSchema.$ref, root);
|
|
21
|
+
if (schemaByRef) {
|
|
22
|
+
accumulatedSchema = (0, utils_1.smartMerge)(accumulatedSchema, schemaByRef);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return accumulatedSchema;
|
|
26
|
+
}, []);
|
|
27
|
+
const options = react_1.default.useMemo(() => {
|
|
28
|
+
const data = { headName, schema: schemaProps };
|
|
29
|
+
const accumulatedSchema = getAccumulatedSchema(schemaProps, rootSchema, schemaOverride);
|
|
30
|
+
return {
|
|
31
|
+
data,
|
|
32
|
+
defaultValue: accumulatedSchema.default,
|
|
33
|
+
subscription: {
|
|
34
|
+
data: true,
|
|
35
|
+
submitFailed: true,
|
|
36
|
+
touched: true,
|
|
37
|
+
validating: true,
|
|
38
|
+
value: true,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}, [headName, getAccumulatedSchema, rootSchema, schemaOverride, schemaProps]);
|
|
42
|
+
const field = (0, react_final_form_1.useField)(name, options);
|
|
43
|
+
const meta = react_1.default.useMemo(() => (Object.assign(Object.assign({}, field.meta), { error })), [field.meta, error]);
|
|
44
|
+
const schema = react_1.default.useMemo(() => { var _a; return getAccumulatedSchema((_a = field.meta.data) === null || _a === void 0 ? void 0 : _a.schema, rootSchema, schemaOverride); }, [(_a = field.meta.data) === null || _a === void 0 ? void 0 : _a.schema, schemaOverride, getAccumulatedSchema, rootSchema]);
|
|
45
|
+
const mode = modeOverride || ((_b = field.meta.data) === null || _b === void 0 ? void 0 : _b.mode) || modeState;
|
|
46
|
+
const renderKit = react_1.default.useMemo(() => (0, utils_2.getRenderKit)({ config, schema }), [config, schema]);
|
|
47
|
+
let content = null;
|
|
48
|
+
if (mode === constants_1.SchemaRendererMode.Form) {
|
|
49
|
+
const formKit = renderKit[constants_1.SchemaRendererMode.Form];
|
|
50
|
+
if (formKit.Component) {
|
|
51
|
+
if (formKit.independent) {
|
|
52
|
+
content = (react_1.default.createElement(formKit.Component, { input: field.input, meta: meta, schema: schema, controlProps: formKit.props, Wrapper: formKit.Wrapper, wrapperProps: formKit.wrapperProps }));
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
content = (react_1.default.createElement(formKit.Component, { input: field.input, meta: meta, schema: schema, controlProps: formKit.props }));
|
|
56
|
+
if (formKit.Wrapper) {
|
|
57
|
+
content = (react_1.default.createElement(formKit.Wrapper, { input: field.input, meta: meta, schema: schema, wrapperProps: formKit.wrapperProps }, content));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (mode === constants_1.SchemaRendererMode.Overview) {
|
|
63
|
+
const overviewKit = renderKit[constants_1.SchemaRendererMode.Overview];
|
|
64
|
+
if (overviewKit.Component) {
|
|
65
|
+
if (overviewKit.independent) {
|
|
66
|
+
content = (react_1.default.createElement(overviewKit.Component, { input: field.input, meta: meta, schema: schema, viewProps: overviewKit.props, Wrapper: overviewKit.Wrapper, wrapperProps: overviewKit.wrapperProps }));
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
content = (react_1.default.createElement(overviewKit.Component, { input: field.input, meta: meta, schema: schema, viewProps: overviewKit.props }));
|
|
70
|
+
if (overviewKit.Wrapper) {
|
|
71
|
+
content = (react_1.default.createElement(overviewKit.Wrapper, { input: field.input, meta: meta, schema: schema, wrapperProps: overviewKit.wrapperProps }, content));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return content;
|
|
77
|
+
};
|
|
78
|
+
exports.Entity = react_1.default.memo(EntityComponent);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRenderKit = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const get_1 = tslib_1.__importDefault(require("lodash/get"));
|
|
6
|
+
const constants_1 = require("../constants");
|
|
7
|
+
const getRenderKit = ({ config, schema, }) => {
|
|
8
|
+
const entityType = (0, get_1.default)(schema, 'entityParameters.type');
|
|
9
|
+
const controlType = (0, get_1.default)(schema, 'entityParameters.controlType');
|
|
10
|
+
const ControlComponent = (0, get_1.default)(config, `${entityType}.controls.${controlType}.Component`);
|
|
11
|
+
const controlProps = (0, get_1.default)(schema, 'entityParameters.controlProps') || constants_1.EMPTY_OBJECT;
|
|
12
|
+
const controlIndependent = (0, get_1.default)(config, `${entityType}.controls.${controlType}.independent`);
|
|
13
|
+
const controlWrapperType = (0, get_1.default)(schema, 'entityParameters.controlWrapperType');
|
|
14
|
+
const ControlWrapperComponent = (0, get_1.default)(config, `${entityType}.wrappers.${controlWrapperType}`);
|
|
15
|
+
const controlWrapperProps = (0, get_1.default)(schema, 'entityParameters.controlWrapperProps') || constants_1.EMPTY_OBJECT;
|
|
16
|
+
const viewType = (0, get_1.default)(schema, 'entityParameters.viewType');
|
|
17
|
+
const ViewComponent = (0, get_1.default)(config, `${entityType}.views.${viewType}`);
|
|
18
|
+
const viewProps = (0, get_1.default)(schema, 'entityParameters.viewProps') || constants_1.EMPTY_OBJECT;
|
|
19
|
+
const viewIndependent = (0, get_1.default)(config, `${entityType}.views.${viewType}.independent`);
|
|
20
|
+
const viewWrapperType = (0, get_1.default)(schema, 'entityParameters.viewWrapperType');
|
|
21
|
+
const ViewWrapperComponent = (0, get_1.default)(config, `${entityType}.wrappers.${viewWrapperType}`);
|
|
22
|
+
const viewWrapperProps = (0, get_1.default)(schema, 'entityParameters.viewWrapperProps') || constants_1.EMPTY_OBJECT;
|
|
23
|
+
return {
|
|
24
|
+
[constants_1.SchemaRendererMode.Form]: {
|
|
25
|
+
Component: ControlComponent,
|
|
26
|
+
props: controlProps,
|
|
27
|
+
independent: controlIndependent,
|
|
28
|
+
Wrapper: ControlWrapperComponent,
|
|
29
|
+
wrapperProps: controlWrapperProps,
|
|
30
|
+
},
|
|
31
|
+
[constants_1.SchemaRendererMode.Overview]: {
|
|
32
|
+
Component: ViewComponent,
|
|
33
|
+
props: viewProps,
|
|
34
|
+
independent: viewIndependent,
|
|
35
|
+
Wrapper: ViewWrapperComponent,
|
|
36
|
+
wrapperProps: viewWrapperProps,
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
exports.getRenderKit = getRenderKit;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SchemaRenderer = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const Entity_1 = require("../Entity");
|
|
7
|
+
const useSchemaRenderer_1 = require("../useSchemaRenderer");
|
|
8
|
+
const SchemaRendererComponent = (props) => {
|
|
9
|
+
const { schema } = (0, useSchemaRenderer_1.useSchemaRenderer)(props);
|
|
10
|
+
return schema ? react_1.default.createElement(Entity_1.Entity, { name: props.name, schema: schema }) : null;
|
|
11
|
+
};
|
|
12
|
+
exports.SchemaRenderer = react_1.default.memo(SchemaRendererComponent);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SchemaRenderer = void 0;
|
|
4
|
+
var SchemaRenderer_1 = require("./SchemaRenderer");
|
|
5
|
+
Object.defineProperty(exports, "SchemaRenderer", { enumerable: true, get: function () { return SchemaRenderer_1.SchemaRenderer; } });
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EMPTY_OBJECT = exports.EntityType = exports.JsonSchemaType = exports.SchemaRendererMode = void 0;
|
|
4
|
+
var SchemaRendererMode;
|
|
5
|
+
(function (SchemaRendererMode) {
|
|
6
|
+
SchemaRendererMode["Form"] = "form";
|
|
7
|
+
SchemaRendererMode["Overview"] = "overview";
|
|
8
|
+
})(SchemaRendererMode || (exports.SchemaRendererMode = SchemaRendererMode = {}));
|
|
9
|
+
var JsonSchemaType;
|
|
10
|
+
(function (JsonSchemaType) {
|
|
11
|
+
JsonSchemaType["Array"] = "array";
|
|
12
|
+
JsonSchemaType["Boolean"] = "boolean";
|
|
13
|
+
JsonSchemaType["Integer"] = "integer";
|
|
14
|
+
JsonSchemaType["Null"] = "null";
|
|
15
|
+
JsonSchemaType["Number"] = "number";
|
|
16
|
+
JsonSchemaType["Object"] = "object";
|
|
17
|
+
JsonSchemaType["String"] = "string";
|
|
18
|
+
})(JsonSchemaType || (exports.JsonSchemaType = JsonSchemaType = {}));
|
|
19
|
+
var EntityType;
|
|
20
|
+
(function (EntityType) {
|
|
21
|
+
EntityType["Any"] = "any";
|
|
22
|
+
EntityType["Array"] = "array";
|
|
23
|
+
EntityType["Boolean"] = "boolean";
|
|
24
|
+
EntityType["Number"] = "number";
|
|
25
|
+
EntityType["Object"] = "object";
|
|
26
|
+
EntityType["String"] = "string";
|
|
27
|
+
})(EntityType || (exports.EntityType = EntityType = {}));
|
|
28
|
+
exports.EMPTY_OBJECT = {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSchemaRendererMutators = exports.useSchemaRenderer = exports.schemaRendererMutators = exports.SchemaRendererMode = exports.JsonSchemaType = exports.EntityType = exports.SchemaRenderer = exports.Entity = void 0;
|
|
4
|
+
var Entity_1 = require("./Entity");
|
|
5
|
+
Object.defineProperty(exports, "Entity", { enumerable: true, get: function () { return Entity_1.Entity; } });
|
|
6
|
+
var SchemaRenderer_1 = require("./SchemaRenderer");
|
|
7
|
+
Object.defineProperty(exports, "SchemaRenderer", { enumerable: true, get: function () { return SchemaRenderer_1.SchemaRenderer; } });
|
|
8
|
+
var constants_1 = require("./constants");
|
|
9
|
+
Object.defineProperty(exports, "EntityType", { enumerable: true, get: function () { return constants_1.EntityType; } });
|
|
10
|
+
Object.defineProperty(exports, "JsonSchemaType", { enumerable: true, get: function () { return constants_1.JsonSchemaType; } });
|
|
11
|
+
Object.defineProperty(exports, "SchemaRendererMode", { enumerable: true, get: function () { return constants_1.SchemaRendererMode; } });
|
|
12
|
+
var useSchemaRenderer_1 = require("./useSchemaRenderer");
|
|
13
|
+
Object.defineProperty(exports, "schemaRendererMutators", { enumerable: true, get: function () { return useSchemaRenderer_1.schemaRendererMutators; } });
|
|
14
|
+
Object.defineProperty(exports, "useSchemaRenderer", { enumerable: true, get: function () { return useSchemaRenderer_1.useSchemaRenderer; } });
|
|
15
|
+
Object.defineProperty(exports, "useSchemaRendererMutators", { enumerable: true, get: function () { return useSchemaRenderer_1.useSchemaRendererMutators; } });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./components"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./config"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./schema"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./validation"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./values"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSchemaRendererMutators = exports.useEntitiesState = void 0;
|
|
4
|
+
var useEntitiesState_1 = require("./useEntitiesState");
|
|
5
|
+
Object.defineProperty(exports, "useEntitiesState", { enumerable: true, get: function () { return useEntitiesState_1.useEntitiesState; } });
|
|
6
|
+
var useSchemaRendererMutators_1 = require("./useSchemaRendererMutators");
|
|
7
|
+
Object.defineProperty(exports, "useSchemaRendererMutators", { enumerable: true, get: function () { return useSchemaRendererMutators_1.useSchemaRendererMutators; } });
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useEntitiesState = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const react_final_form_1 = require("react-final-form");
|
|
7
|
+
const constants_1 = require("../constants");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const useEntitiesState = (name) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const form = (0, react_final_form_1.useForm)();
|
|
12
|
+
const headName = react_1.default.useMemo(() => (0, utils_1.guessHeadName)(form.getRegisteredFields(), name), [form, name]);
|
|
13
|
+
const field = (0, react_final_form_1.useField)(`${constants_1.ENTITY_SERVICE_FIELD}.${headName}`, { subscription: { data: true } });
|
|
14
|
+
const { config, errorsRef, mode, schema: rootSchema } = (field.meta.data || {});
|
|
15
|
+
const error = (_a = errorsRef === null || errorsRef === void 0 ? void 0 : errorsRef.current) === null || _a === void 0 ? void 0 : _a[name];
|
|
16
|
+
const state = react_1.default.useMemo(() => ({
|
|
17
|
+
config,
|
|
18
|
+
error,
|
|
19
|
+
headName,
|
|
20
|
+
mode,
|
|
21
|
+
rootSchema,
|
|
22
|
+
}), [config, error, headName, mode, rootSchema]);
|
|
23
|
+
return state;
|
|
24
|
+
};
|
|
25
|
+
exports.useEntitiesState = useEntitiesState;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSchemaRendererMutators = void 0;
|
|
4
|
+
const react_final_form_1 = require("react-final-form");
|
|
5
|
+
const useSchemaRendererMutators = () => {
|
|
6
|
+
const { removeExternalErrors, removeSchemaMutators, setAsyncValidationCache, setAsyncValidationWaiters, setExternalErrors, setSchemaMutators, triggerFields, } = (0, react_final_form_1.useForm)().mutators;
|
|
7
|
+
return {
|
|
8
|
+
removeExternalErrors,
|
|
9
|
+
removeSchemaMutators,
|
|
10
|
+
setAsyncValidationCache,
|
|
11
|
+
setAsyncValidationWaiters,
|
|
12
|
+
setExternalErrors,
|
|
13
|
+
setSchemaMutators,
|
|
14
|
+
triggerFields,
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
exports.useSchemaRendererMutators = useSchemaRendererMutators;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSchemaRenderer = exports.schemaRendererMutators = exports.useSchemaRendererMutators = exports.useEntitiesState = void 0;
|
|
4
|
+
var hooks_1 = require("./hooks");
|
|
5
|
+
Object.defineProperty(exports, "useEntitiesState", { enumerable: true, get: function () { return hooks_1.useEntitiesState; } });
|
|
6
|
+
Object.defineProperty(exports, "useSchemaRendererMutators", { enumerable: true, get: function () { return hooks_1.useSchemaRendererMutators; } });
|
|
7
|
+
var mutators_1 = require("./mutators");
|
|
8
|
+
Object.defineProperty(exports, "schemaRendererMutators", { enumerable: true, get: function () { return mutators_1.schemaRendererMutators; } });
|
|
9
|
+
var useSchemaRenderer_1 = require("./useSchemaRenderer");
|
|
10
|
+
Object.defineProperty(exports, "useSchemaRenderer", { enumerable: true, get: function () { return useSchemaRenderer_1.useSchemaRenderer; } });
|
package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/async-validation/async-validation.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setAsyncValidationCache = exports.setAsyncValidationWaiters = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const isEqual_1 = tslib_1.__importDefault(require("lodash/isEqual"));
|
|
6
|
+
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
7
|
+
const setAsyncValidationWaiters = ([{ headName, waiters }], mutableState) => {
|
|
8
|
+
const field = mutableState.fields[headName];
|
|
9
|
+
if (field && waiters) {
|
|
10
|
+
Object.keys(waiters).forEach((waiterName) => {
|
|
11
|
+
field.data = Object.assign(Object.assign({}, field.data), { waiters: Object.assign(Object.assign({}, field.data.waiters), { [waiterName]: waiters[waiterName] }) });
|
|
12
|
+
const waiterField = mutableState.fields[waiterName];
|
|
13
|
+
if (waiterField) {
|
|
14
|
+
waiterField.validating = true;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.setAsyncValidationWaiters = setAsyncValidationWaiters;
|
|
20
|
+
const setAsyncValidationCache = ([{ headName, cache }], mutableState) => {
|
|
21
|
+
const field = mutableState.fields[headName];
|
|
22
|
+
if (field && cache) {
|
|
23
|
+
Object.keys(cache).forEach((cacheName) => {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
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]] }) });
|
|
26
|
+
const cacheField = mutableState.fields[cacheName];
|
|
27
|
+
const waiter = (_b = field.data.waiters) === null || _b === void 0 ? void 0 : _b[cacheName];
|
|
28
|
+
if (cacheField && waiter && (0, isEqual_1.default)(waiter, (0, omit_1.default)(cache[cacheName], 'result'))) {
|
|
29
|
+
field.data.waiters = (0, omit_1.default)(field.data.waiters, cacheName);
|
|
30
|
+
cacheField.validating = false;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
exports.setAsyncValidationCache = setAsyncValidationCache;
|
package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/external-errors/external-errors.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeExternalErrors = exports.setExternalErrors = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
7
|
+
const utils_1 = require("../../utils");
|
|
8
|
+
const setExternalErrors = ([{ priorityErrors, regularErrors }], mutableState) => {
|
|
9
|
+
const registeredFields = Object.keys(mutableState.fields);
|
|
10
|
+
Object.entries(priorityErrors || {}).forEach(([key, value]) => {
|
|
11
|
+
const headName = (0, utils_1.guessHeadName)(registeredFields, key);
|
|
12
|
+
if (headName) {
|
|
13
|
+
const field = mutableState.fields[headName];
|
|
14
|
+
if (field) {
|
|
15
|
+
field.data = Object.assign(Object.assign({}, field.data), { priorityErrors: Object.assign(Object.assign({}, field.data.priorityErrors), { [key]: value }) });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
Object.entries(regularErrors || {}).forEach(([key, value]) => {
|
|
20
|
+
const headName = (0, utils_1.guessHeadName)(registeredFields, key);
|
|
21
|
+
if (headName) {
|
|
22
|
+
const field = mutableState.fields[headName];
|
|
23
|
+
if (field) {
|
|
24
|
+
field.data = Object.assign(Object.assign({}, field.data), { regularErrors: Object.assign(Object.assign({}, field.data.regularErrors), { [key]: value }) });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
exports.setExternalErrors = setExternalErrors;
|
|
30
|
+
const removeExternalErrors = ([{ removeFunctionOrNames }], mutableState) => {
|
|
31
|
+
const registeredFields = Object.keys(mutableState.fields);
|
|
32
|
+
if (Array.isArray(removeFunctionOrNames)) {
|
|
33
|
+
removeFunctionOrNames.forEach((name) => {
|
|
34
|
+
const headName = (0, utils_1.guessHeadName)(registeredFields, name);
|
|
35
|
+
if (headName) {
|
|
36
|
+
const field = mutableState.fields[headName];
|
|
37
|
+
if (field) {
|
|
38
|
+
field.data = Object.assign(Object.assign({}, field.data), { priorityErrors: (0, omit_1.default)(Object.assign({}, field.data.priorityErrors), name), regularErrors: (0, omit_1.default)(Object.assign({}, field.data.regularErrors), name) });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
registeredFields.forEach((fieldName) => {
|
|
45
|
+
if (fieldName.startsWith(constants_1.ENTITY_SERVICE_FIELD)) {
|
|
46
|
+
const headName = fieldName.slice(`${constants_1.ENTITY_SERVICE_FIELD}.`.length);
|
|
47
|
+
const field = mutableState.fields[headName];
|
|
48
|
+
if (field) {
|
|
49
|
+
const { priorityErrors, regularErrors } = removeFunctionOrNames(headName, {
|
|
50
|
+
priorityErrors: field.data.priorityErrors,
|
|
51
|
+
regularErrors: field.data.regularErrors,
|
|
52
|
+
});
|
|
53
|
+
field.data = Object.assign(Object.assign({}, field.data), { priorityErrors,
|
|
54
|
+
regularErrors });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
exports.removeExternalErrors = removeExternalErrors;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.schemaRendererMutators = void 0;
|
|
4
|
+
const async_validation_1 = require("./async-validation");
|
|
5
|
+
const external_errors_1 = require("./external-errors");
|
|
6
|
+
const schema_mutators_1 = require("./schema-mutators");
|
|
7
|
+
const trigger_fields_1 = require("./trigger-fields");
|
|
8
|
+
exports.schemaRendererMutators = {
|
|
9
|
+
removeExternalErrors: external_errors_1.removeExternalErrors,
|
|
10
|
+
removeSchemaMutators: schema_mutators_1.removeSchemaMutators,
|
|
11
|
+
setAsyncValidationCache: async_validation_1.setAsyncValidationCache,
|
|
12
|
+
setAsyncValidationWaiters: async_validation_1.setAsyncValidationWaiters,
|
|
13
|
+
setExternalErrors: external_errors_1.setExternalErrors,
|
|
14
|
+
setSchemaMutators: schema_mutators_1.setSchemaMutators,
|
|
15
|
+
triggerFields: trigger_fields_1.triggerFields,
|
|
16
|
+
};
|
package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/schema-mutators/schema-mutators.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeSchemaMutators = exports.setSchemaMutators = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const cloneDeep_1 = tslib_1.__importDefault(require("lodash/cloneDeep"));
|
|
6
|
+
const get_1 = tslib_1.__importDefault(require("lodash/get"));
|
|
7
|
+
const isEqual_1 = tslib_1.__importDefault(require("lodash/isEqual"));
|
|
8
|
+
const utils_1 = require("../../../utils");
|
|
9
|
+
const utils_2 = require("../../utils");
|
|
10
|
+
const applyMutators = ({ mutableState, mutators, }) => {
|
|
11
|
+
const registeredFields = Object.keys(mutableState.fields);
|
|
12
|
+
mutators.forEach((m) => {
|
|
13
|
+
const headName = (0, utils_2.guessHeadName)(registeredFields, m.name);
|
|
14
|
+
if (headName) {
|
|
15
|
+
const headField = mutableState.fields[headName];
|
|
16
|
+
const data = headField === null || headField === void 0 ? void 0 : headField.data;
|
|
17
|
+
const mutatedSchema = data === null || data === void 0 ? void 0 : data.schema;
|
|
18
|
+
if (mutatedSchema) {
|
|
19
|
+
const schemaPath = (0, utils_1.getSchemaPath)(m.name, headName, mutatedSchema);
|
|
20
|
+
if (schemaPath) {
|
|
21
|
+
(0, utils_1.smartSet)(mutatedSchema, schemaPath, m.schema);
|
|
22
|
+
const schemaField = mutableState.fields[m.name];
|
|
23
|
+
if (schemaField) {
|
|
24
|
+
schemaField.data = Object.assign(Object.assign({}, schemaField.data), { schema: (0, get_1.default)(mutatedSchema, schemaPath) });
|
|
25
|
+
}
|
|
26
|
+
headField.data.mutators = [...((data === null || data === void 0 ? void 0 : data.mutators) || []), m];
|
|
27
|
+
headField.data.schema = mutatedSchema;
|
|
28
|
+
const mutatedPaths = (0, utils_1.getValuePaths)(m.schema).map((path) => [
|
|
29
|
+
...schemaPath,
|
|
30
|
+
...path,
|
|
31
|
+
]);
|
|
32
|
+
Object.values(mutableState.fields).forEach((field) => {
|
|
33
|
+
var _a;
|
|
34
|
+
const data = field === null || field === void 0 ? void 0 : field.data;
|
|
35
|
+
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) {
|
|
36
|
+
const refPath = (0, utils_1.parseSchemaPath)(data.schema.$ref);
|
|
37
|
+
const mutationAffectRefSchema = mutatedPaths.some((mutatedPath) => refPath.every((subpath, index) => mutatedPath[index] === subpath));
|
|
38
|
+
const fieldSchemaPath = (0, utils_1.getSchemaPath)(field.name, headName, mutatedSchema);
|
|
39
|
+
if (mutationAffectRefSchema && fieldSchemaPath) {
|
|
40
|
+
field.data = Object.assign(Object.assign({}, field.data), { schema: Object.assign({}, (0, get_1.default)(mutatedSchema, fieldSchemaPath)) });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
const setSchemaMutators = ([{ mutators }], mutableState) => {
|
|
50
|
+
applyMutators({ mutableState, mutators });
|
|
51
|
+
};
|
|
52
|
+
exports.setSchemaMutators = setSchemaMutators;
|
|
53
|
+
const removeSchemaMutators = ([{ mutatorsToRemove }], mutableState) => {
|
|
54
|
+
const registeredFields = Object.keys(mutableState.fields);
|
|
55
|
+
[...new Set(mutatorsToRemove.map((m) => (0, utils_2.guessHeadName)(registeredFields, m.name)))].forEach((name) => {
|
|
56
|
+
if (name) {
|
|
57
|
+
const headField = mutableState.fields[name];
|
|
58
|
+
const data = headField === null || headField === void 0 ? void 0 : headField.data;
|
|
59
|
+
const originalSchema = data === null || data === void 0 ? void 0 : data.originalSchema;
|
|
60
|
+
const mutators = (data === null || data === void 0 ? void 0 : data.mutators) || [];
|
|
61
|
+
if (headField && originalSchema) {
|
|
62
|
+
applyMutators({
|
|
63
|
+
mutableState,
|
|
64
|
+
mutators: mutators.map((m) => {
|
|
65
|
+
const schemaPath = (0, utils_1.getSchemaPath)(m.name, name, originalSchema);
|
|
66
|
+
return Object.assign(Object.assign({}, m), { schema: schemaPath
|
|
67
|
+
? (0, cloneDeep_1.default)((0, get_1.default)(originalSchema, schemaPath))
|
|
68
|
+
: {} });
|
|
69
|
+
}),
|
|
70
|
+
});
|
|
71
|
+
headField.data.mutators = [];
|
|
72
|
+
applyMutators({
|
|
73
|
+
mutableState,
|
|
74
|
+
mutators: mutators.filter((m) => !mutatorsToRemove.some(({ name, schema }) => name === m.name &&
|
|
75
|
+
((0, isEqual_1.default)(m.schema, schema) || schema === true))),
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
exports.removeSchemaMutators = removeSchemaMutators;
|
package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/trigger-fields/trigger-fields.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.triggerFields = void 0;
|
|
4
|
+
const triggerFields = ([{ fields }], mutableState) => {
|
|
5
|
+
fields.forEach((fieldName) => {
|
|
6
|
+
const field = mutableState.fields[fieldName];
|
|
7
|
+
if (field) {
|
|
8
|
+
field.data = Object.assign(Object.assign({}, field.data), { count: (field.data.count || 0) + 1 });
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
exports.triggerFields = triggerFields;
|