@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,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSchemaRenderer = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const cloneDeep_1 = tslib_1.__importDefault(require("lodash/cloneDeep"));
|
|
7
|
+
const noop_1 = tslib_1.__importDefault(require("lodash/noop"));
|
|
8
|
+
const react_final_form_1 = require("react-final-form");
|
|
9
|
+
const constants_1 = require("../constants");
|
|
10
|
+
const constants_2 = require("./constants");
|
|
11
|
+
const hooks_1 = require("./hooks");
|
|
12
|
+
const utils_1 = require("./utils");
|
|
13
|
+
const useSchemaRenderer = ({ config, connectValidate = true, errorMessages = constants_1.EMPTY_OBJECT, mode, name, schema: originalSchema, }) => {
|
|
14
|
+
const form = (0, react_final_form_1.useForm)();
|
|
15
|
+
const { setAsyncValidationCache, setAsyncValidationWaiters, triggerFields } = (0, hooks_1.useSchemaRendererMutators)();
|
|
16
|
+
const errorsRef = react_1.default.useRef({});
|
|
17
|
+
const schemaRef = react_1.default.useRef(undefined);
|
|
18
|
+
const [schema, setSchema] = react_1.default.useState(undefined);
|
|
19
|
+
const [fieldsToTrigger, setFieldsToTrigger] = react_1.default.useState([]);
|
|
20
|
+
const setErrors = react_1.default.useCallback((errors) => {
|
|
21
|
+
const formState = form.getState();
|
|
22
|
+
const fieldsToTrigger = Object.keys(Object.assign(Object.assign({}, errorsRef.current), errors)).filter((key) => {
|
|
23
|
+
if (errorsRef.current[key] !== errors[key]) {
|
|
24
|
+
const field = form.getFieldState(key);
|
|
25
|
+
if ((field === null || field === void 0 ? void 0 : field.touched) || formState.submitFailed) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
});
|
|
31
|
+
errorsRef.current = errors;
|
|
32
|
+
if (fieldsToTrigger.length) {
|
|
33
|
+
setFieldsToTrigger(fieldsToTrigger);
|
|
34
|
+
}
|
|
35
|
+
}, [form]);
|
|
36
|
+
const validate = react_1.default.useMemo(() => (0, utils_1.getValidate)({
|
|
37
|
+
config,
|
|
38
|
+
errorMessages,
|
|
39
|
+
name,
|
|
40
|
+
setAsyncValidationCache,
|
|
41
|
+
setAsyncValidationWaiters,
|
|
42
|
+
setErrors,
|
|
43
|
+
}), [
|
|
44
|
+
config,
|
|
45
|
+
errorMessages,
|
|
46
|
+
name,
|
|
47
|
+
setAsyncValidationCache,
|
|
48
|
+
setAsyncValidationWaiters,
|
|
49
|
+
setErrors,
|
|
50
|
+
]);
|
|
51
|
+
const returnValue = react_1.default.useMemo(() => {
|
|
52
|
+
if (connectValidate) {
|
|
53
|
+
return { schema };
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
schema,
|
|
57
|
+
validate: (value) => {
|
|
58
|
+
const allValues = form.getState().values;
|
|
59
|
+
const meta = form.getFieldState(name);
|
|
60
|
+
return validate(value, allValues, meta);
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}, [connectValidate, form, name, schema, validate]);
|
|
64
|
+
react_1.default.useEffect(() => {
|
|
65
|
+
schemaRef.current = (0, cloneDeep_1.default)(originalSchema);
|
|
66
|
+
setSchema(schemaRef.current);
|
|
67
|
+
}, [originalSchema]);
|
|
68
|
+
react_1.default.useEffect(() => {
|
|
69
|
+
const data = { originalSchema, schema: schemaRef.current };
|
|
70
|
+
const getValidator = connectValidate ? () => validate : undefined;
|
|
71
|
+
const unsubscribe = form.registerField(name, noop_1.default, constants_1.EMPTY_OBJECT, { data, getValidator });
|
|
72
|
+
return () => unsubscribe();
|
|
73
|
+
}, [connectValidate, form, name, originalSchema, validate]);
|
|
74
|
+
react_1.default.useEffect(() => {
|
|
75
|
+
const data = { config, errorsRef, headName: name, mode, schema: schemaRef.current };
|
|
76
|
+
const unsubscribe = form.registerField(`${constants_2.ENTITY_SERVICE_FIELD}.${name}`, noop_1.default, constants_1.EMPTY_OBJECT, { data });
|
|
77
|
+
return () => unsubscribe();
|
|
78
|
+
}, [config, form, mode, name]);
|
|
79
|
+
react_1.default.useEffect(() => {
|
|
80
|
+
if (fieldsToTrigger.length) {
|
|
81
|
+
triggerFields === null || triggerFields === void 0 ? void 0 : triggerFields({ fields: fieldsToTrigger });
|
|
82
|
+
}
|
|
83
|
+
}, [fieldsToTrigger, triggerFields]);
|
|
84
|
+
return returnValue;
|
|
85
|
+
};
|
|
86
|
+
exports.useSchemaRenderer = useSchemaRenderer;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.guessHeadName = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const guessHeadName = (registeredFields, name) => {
|
|
6
|
+
const registeredServiceFields = registeredFields
|
|
7
|
+
.filter((n) => n.startsWith(constants_1.ENTITY_SERVICE_FIELD))
|
|
8
|
+
.map((n) => n.slice(`${constants_1.ENTITY_SERVICE_FIELD}.`.length));
|
|
9
|
+
return registeredServiceFields.find((n) => name === n || name.startsWith(`${n}.`) || name.startsWith(`${n}[`));
|
|
10
|
+
};
|
|
11
|
+
exports.guessHeadName = guessHeadName;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAjvValidate = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const ajv_1 = tslib_1.__importDefault(require("ajv"));
|
|
6
|
+
const get_1 = tslib_1.__importDefault(require("lodash/get"));
|
|
7
|
+
const getAjvValidate = ({ config, schema }) => {
|
|
8
|
+
function entityParametersValidate(_, value, schema) {
|
|
9
|
+
if (schema && schema.entityParameters) {
|
|
10
|
+
const entityType = (0, get_1.default)(schema, 'entityParameters.type');
|
|
11
|
+
const validatorType = schema.entityParameters.validatorType;
|
|
12
|
+
const validator = (0, get_1.default)(config, `${entityType}.validators.${validatorType}`);
|
|
13
|
+
if (validator) {
|
|
14
|
+
const error = {
|
|
15
|
+
keyword: 'entityParameters',
|
|
16
|
+
message: '',
|
|
17
|
+
params: { validator, value, schema },
|
|
18
|
+
};
|
|
19
|
+
entityParametersValidate.errors = [error];
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
const ajv = new ajv_1.default({
|
|
26
|
+
allErrors: true,
|
|
27
|
+
allowMatchingProperties: true,
|
|
28
|
+
keywords: [
|
|
29
|
+
{
|
|
30
|
+
errors: true,
|
|
31
|
+
keyword: 'entityParameters',
|
|
32
|
+
validate: entityParametersValidate,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
});
|
|
36
|
+
const ajvValidate = ajv.compile(schema);
|
|
37
|
+
return ajvValidate;
|
|
38
|
+
};
|
|
39
|
+
exports.getAjvValidate = getAjvValidate;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getValidate = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const get_1 = tslib_1.__importDefault(require("lodash/get"));
|
|
6
|
+
const isBoolean_1 = tslib_1.__importDefault(require("lodash/isBoolean"));
|
|
7
|
+
const isObjectLike_1 = tslib_1.__importDefault(require("lodash/isObjectLike"));
|
|
8
|
+
const isString_1 = tslib_1.__importDefault(require("lodash/isString"));
|
|
9
|
+
const utils_1 = require("../../utils");
|
|
10
|
+
const get_ajv_validate_1 = require("./get-ajv-validate");
|
|
11
|
+
const process_ajv_validate_errors_1 = require("./process-ajv-validate-errors");
|
|
12
|
+
const process_errors_state_1 = require("./process-errors-state");
|
|
13
|
+
const getValidate = ({ config, errorMessages, name, setAsyncValidationCache, setAsyncValidationWaiters, setErrors, }) => {
|
|
14
|
+
let schema;
|
|
15
|
+
let ajvValidate;
|
|
16
|
+
return (value, allValues, meta) => {
|
|
17
|
+
const data = meta === null || meta === void 0 ? void 0 : meta.data;
|
|
18
|
+
if (!(data === null || data === void 0 ? void 0 : data.schema)) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
if (schema !== data.schema) {
|
|
22
|
+
schema = data.schema;
|
|
23
|
+
ajvValidate = (0, get_ajv_validate_1.getAjvValidate)({ config, schema });
|
|
24
|
+
}
|
|
25
|
+
ajvValidate(value);
|
|
26
|
+
const { ajvErrorItems, entityParametersErrorItems, waiters } = (0, process_ajv_validate_errors_1.processAjvValidateErrors)({
|
|
27
|
+
ajvValidateErrors: ajvValidate.errors || [],
|
|
28
|
+
allValues: allValues,
|
|
29
|
+
errorMessages,
|
|
30
|
+
name,
|
|
31
|
+
schema,
|
|
32
|
+
setAsyncValidationCache,
|
|
33
|
+
validationState: data,
|
|
34
|
+
});
|
|
35
|
+
const { externalPriorityErrorItems, externalRegularErrorItems } = (0, process_errors_state_1.processErrorsState)({
|
|
36
|
+
errorsState: data,
|
|
37
|
+
name,
|
|
38
|
+
});
|
|
39
|
+
if (Object.keys(waiters).length) {
|
|
40
|
+
setAsyncValidationWaiters === null || setAsyncValidationWaiters === void 0 ? void 0 : setAsyncValidationWaiters({ headName: name, waiters });
|
|
41
|
+
}
|
|
42
|
+
const result = { errors: {} };
|
|
43
|
+
[
|
|
44
|
+
...externalRegularErrorItems,
|
|
45
|
+
...ajvErrorItems,
|
|
46
|
+
...entityParametersErrorItems,
|
|
47
|
+
...externalPriorityErrorItems,
|
|
48
|
+
].forEach((item) => {
|
|
49
|
+
if (!item.error) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if ((0, isObjectLike_1.default)(item.error)) {
|
|
53
|
+
(0, utils_1.getValuePaths)(item.error).forEach((childPath) => {
|
|
54
|
+
result.errors[(0, utils_1.formatFinalFormPath)([name, ...item.path, ...childPath])] = (0, get_1.default)(item.error, childPath);
|
|
55
|
+
});
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if ((0, isBoolean_1.default)(item.error) || (0, isString_1.default)(item.error)) {
|
|
59
|
+
result.errors[(0, utils_1.formatFinalFormPath)([name, ...item.path])] = item.error;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
setErrors(result.errors);
|
|
64
|
+
return Object.keys(result.errors).length ? 'error' : false;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
exports.getValidate = getValidate;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getValidate = exports.guessHeadName = void 0;
|
|
4
|
+
var common_1 = require("./common");
|
|
5
|
+
Object.defineProperty(exports, "guessHeadName", { enumerable: true, get: function () { return common_1.guessHeadName; } });
|
|
6
|
+
var get_validate_1 = require("./get-validate");
|
|
7
|
+
Object.defineProperty(exports, "getValidate", { enumerable: true, get: function () { return get_validate_1.getValidate; } });
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processAjvError = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const get_1 = tslib_1.__importDefault(require("lodash/get"));
|
|
6
|
+
const isString_1 = tslib_1.__importDefault(require("lodash/isString"));
|
|
7
|
+
const utils_1 = require("../../utils");
|
|
8
|
+
const processAjvError = ({ error, errorMessages, schema, onError, }) => {
|
|
9
|
+
let instancePath = error.instancePath;
|
|
10
|
+
let keyword = error.keyword;
|
|
11
|
+
let schemaPath = error.schemaPath;
|
|
12
|
+
if (keyword === 'anyOf' ||
|
|
13
|
+
(keyword === 'if' &&
|
|
14
|
+
(error.params.failingKeyword === 'then' || error.params.failingKeyword === 'else')) ||
|
|
15
|
+
keyword === 'false schema') {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (error.propertyName) {
|
|
19
|
+
instancePath += `/${error.propertyName}`;
|
|
20
|
+
}
|
|
21
|
+
if (keyword === 'required') {
|
|
22
|
+
instancePath += `/${error.params.missingProperty}`;
|
|
23
|
+
}
|
|
24
|
+
else if (keyword === 'dependencies') {
|
|
25
|
+
instancePath += `/${error.params.missingProperty}`;
|
|
26
|
+
schemaPath =
|
|
27
|
+
schemaPath.slice(0, -'dependencies'.length) +
|
|
28
|
+
`properties/${error.params.missingProperty}/dependencies`;
|
|
29
|
+
}
|
|
30
|
+
else if (keyword === 'if') {
|
|
31
|
+
keyword = error.params.failingKeyword;
|
|
32
|
+
schemaPath = schemaPath.slice(0, -'if'.length) + error.params.failingKeyword;
|
|
33
|
+
}
|
|
34
|
+
const getErrorMessageBySchema = (schema) => {
|
|
35
|
+
const propertyName = instancePath.split('/').pop();
|
|
36
|
+
const errorOrMap = (0, get_1.default)(schema, `entityParameters.errorMessages.${keyword}`);
|
|
37
|
+
const message = (0, isString_1.default)(errorOrMap)
|
|
38
|
+
? errorOrMap
|
|
39
|
+
: (0, get_1.default)(errorOrMap, propertyName);
|
|
40
|
+
return message;
|
|
41
|
+
};
|
|
42
|
+
onError({
|
|
43
|
+
path: (0, utils_1.parseInstancePath)(instancePath),
|
|
44
|
+
error: getErrorMessageBySchema((0, utils_1.getSchemaBySchemaPath)(schemaPath, schema)) ||
|
|
45
|
+
getErrorMessageBySchema((0, utils_1.getSchemaBySchemaPath)(schemaPath.slice(0, -`/${keyword}`.length), schema)) ||
|
|
46
|
+
getErrorMessageBySchema((0, utils_1.getSchemaByInstancePath)(instancePath, schema)) ||
|
|
47
|
+
errorMessages[keyword] ||
|
|
48
|
+
error.message,
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
exports.processAjvError = processAjvError;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processAjvValidateErrors = void 0;
|
|
4
|
+
const process_ajv_error_1 = require("./process-ajv-error");
|
|
5
|
+
const process_entity_parameters_error_1 = require("./process-entity-parameters-error");
|
|
6
|
+
const processAjvValidateErrors = ({ ajvValidateErrors, allValues, errorMessages, name, schema, setAsyncValidationCache, validationState, }) => {
|
|
7
|
+
const waiters = {};
|
|
8
|
+
const ajvErrorItems = [];
|
|
9
|
+
const entityParametersErrorItems = [];
|
|
10
|
+
ajvValidateErrors.forEach((ajvOrEntityParametersError) => {
|
|
11
|
+
if (ajvOrEntityParametersError.keyword === 'entityParameters') {
|
|
12
|
+
const error = ajvOrEntityParametersError;
|
|
13
|
+
(0, process_entity_parameters_error_1.processEntityParametersError)({
|
|
14
|
+
allValues,
|
|
15
|
+
error,
|
|
16
|
+
onAsyncError: (w) => {
|
|
17
|
+
waiters[w.instancePath] = w.params;
|
|
18
|
+
w.promise.then((result) => {
|
|
19
|
+
setAsyncValidationCache === null || setAsyncValidationCache === void 0 ? void 0 : setAsyncValidationCache({
|
|
20
|
+
headName: name,
|
|
21
|
+
cache: {
|
|
22
|
+
[w.instancePath]: Object.assign(Object.assign({}, w.params), { result }),
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
onError: (e) => entityParametersErrorItems.push(e),
|
|
28
|
+
validationState,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
const error = ajvOrEntityParametersError;
|
|
33
|
+
(0, process_ajv_error_1.processAjvError)({
|
|
34
|
+
error,
|
|
35
|
+
errorMessages,
|
|
36
|
+
schema,
|
|
37
|
+
onError: (e) => ajvErrorItems.push(e),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return { ajvErrorItems, entityParametersErrorItems, waiters };
|
|
42
|
+
};
|
|
43
|
+
exports.processAjvValidateErrors = processAjvValidateErrors;
|
package/build/cjs/lib/unstable/core/useSchemaRenderer/utils/process-entity-parameters-error.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processEntityParametersError = 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 utils_1 = require("../../utils");
|
|
8
|
+
const processEntityParametersError = ({ allValues, error, onAsyncError, onError, validationState, }) => {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
const waiter = (_a = validationState === null || validationState === void 0 ? void 0 : validationState.waiters) === null || _a === void 0 ? void 0 : _a[error.instancePath];
|
|
11
|
+
const cache = (_b = validationState === null || validationState === void 0 ? void 0 : validationState.cache) === null || _b === void 0 ? void 0 : _b[error.instancePath];
|
|
12
|
+
const cacheItem = cache === null || cache === void 0 ? void 0 : cache.find((item) => (0, isEqual_1.default)(error.params, (0, omit_1.default)(item, 'result')));
|
|
13
|
+
if (cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.result) {
|
|
14
|
+
onError({
|
|
15
|
+
error: cacheItem.result,
|
|
16
|
+
path: (0, utils_1.parseInstancePath)(error.instancePath),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
else if (!waiter || !(0, isEqual_1.default)(error.params, waiter)) {
|
|
20
|
+
const errorOrPromise = error.params.validator(error.params.value, allValues);
|
|
21
|
+
if (errorOrPromise instanceof Promise) {
|
|
22
|
+
onAsyncError({
|
|
23
|
+
instancePath: error.instancePath,
|
|
24
|
+
params: error.params,
|
|
25
|
+
promise: errorOrPromise,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
onError({
|
|
30
|
+
error: errorOrPromise,
|
|
31
|
+
path: (0, utils_1.parseInstancePath)(error.instancePath),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
exports.processEntityParametersError = processEntityParametersError;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processErrorsState = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const mapValues_1 = tslib_1.__importDefault(require("lodash/mapValues"));
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
|
+
const processErrorsState = ({ errorsState, name, }) => {
|
|
8
|
+
const getErrorItems = (errors) => Object.values((0, mapValues_1.default)(errors, (value, key) => ({
|
|
9
|
+
path: (0, utils_1.parseFinalFormName)(key).slice((0, utils_1.parseFinalFormName)(name).length),
|
|
10
|
+
error: value,
|
|
11
|
+
})));
|
|
12
|
+
return {
|
|
13
|
+
externalPriorityErrorItems: getErrorItems(errorsState === null || errorsState === void 0 ? void 0 : errorsState.priorityErrors),
|
|
14
|
+
externalRegularErrorItems: getErrorItems(errorsState === null || errorsState === void 0 ? void 0 : errorsState.regularErrors),
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
exports.processErrorsState = processErrorsState;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.smartMerge = exports.smartSet = exports.getValuePaths = exports.getSchemaByFinalFormPath = exports.getSchemaByInstancePath = exports.getSchemaBySchemaPath = exports.getSchemaPath = exports.formatFinalFormPath = exports.parseFinalFormName = exports.parseInstancePath = exports.parseSchemaPath = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const get_1 = tslib_1.__importDefault(require("lodash/get"));
|
|
6
|
+
const set_1 = tslib_1.__importDefault(require("lodash/set"));
|
|
7
|
+
/**
|
|
8
|
+
* Parses an AJV `schemaPath` (JSON Pointer) into an array of path segments
|
|
9
|
+
* suitable for lodash `get`.
|
|
10
|
+
*
|
|
11
|
+
* Strips the `#/` prefix, decodes URI-encoded characters, splits on `/`,
|
|
12
|
+
* and unescapes JSON Pointer tokens (`~1` → `/`, `~0` → `~`).
|
|
13
|
+
*
|
|
14
|
+
* Returns all segments unchanged; stripping a trailing validation keyword
|
|
15
|
+
* (e.g. `minLength`) before lookup is the caller's responsibility.
|
|
16
|
+
*
|
|
17
|
+
* @param schemaPath - JSON Pointer string, e.g. `"#/properties/name/minLength"`.
|
|
18
|
+
* @returns Path segments, e.g. `['properties', 'name', 'minLength']`.
|
|
19
|
+
*/
|
|
20
|
+
const parseSchemaPath = (schemaPath) => {
|
|
21
|
+
return decodeURIComponent(schemaPath)
|
|
22
|
+
.split('/')
|
|
23
|
+
.slice(1)
|
|
24
|
+
.map((segment) => segment.replace(/~1/g, '/').replace(/~0/g, '~'));
|
|
25
|
+
};
|
|
26
|
+
exports.parseSchemaPath = parseSchemaPath;
|
|
27
|
+
const parseInstancePath = (instancePath) => {
|
|
28
|
+
if (!instancePath.length) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
return instancePath
|
|
32
|
+
.slice('/'.length)
|
|
33
|
+
.split('/')
|
|
34
|
+
.map((segment) => segment.replace(/~1/g, '/').replace(/~0/g, '~'));
|
|
35
|
+
};
|
|
36
|
+
exports.parseInstancePath = parseInstancePath;
|
|
37
|
+
const parseFinalFormName = (finalFormName) => {
|
|
38
|
+
const result = [];
|
|
39
|
+
const regex = /([^[.\]]+)|\[(\d+)\]/g;
|
|
40
|
+
let match;
|
|
41
|
+
while ((match = regex.exec(finalFormName)) !== null) {
|
|
42
|
+
if (match[1] !== undefined) {
|
|
43
|
+
result.push(match[1]);
|
|
44
|
+
}
|
|
45
|
+
else if (match[2] !== undefined) {
|
|
46
|
+
result.push(match[2]);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return result;
|
|
50
|
+
};
|
|
51
|
+
exports.parseFinalFormName = parseFinalFormName;
|
|
52
|
+
const formatFinalFormPath = (finalFormPath) => {
|
|
53
|
+
return finalFormPath.reduce((result, segment) => {
|
|
54
|
+
if (/^\d+$/.test(segment)) {
|
|
55
|
+
return `${result}[${segment}]`;
|
|
56
|
+
}
|
|
57
|
+
return result ? `${result}.${segment}` : segment;
|
|
58
|
+
}, '');
|
|
59
|
+
};
|
|
60
|
+
exports.formatFinalFormPath = formatFinalFormPath;
|
|
61
|
+
const getSchemaPath = (finalFormNameOrPath, finalFormHeadName, schema) => {
|
|
62
|
+
const finalFormPath = Array.isArray(finalFormNameOrPath)
|
|
63
|
+
? finalFormNameOrPath
|
|
64
|
+
: (0, exports.parseFinalFormName)(finalFormNameOrPath);
|
|
65
|
+
const schemaPath = finalFormPath
|
|
66
|
+
.slice((0, exports.parseFinalFormName)(finalFormHeadName).length)
|
|
67
|
+
.reduce((path, segment, index) => {
|
|
68
|
+
if (path === undefined) {
|
|
69
|
+
return path;
|
|
70
|
+
}
|
|
71
|
+
const schemaByPath = index === 0 ? schema : (0, get_1.default)(schema, path);
|
|
72
|
+
if ((0, get_1.default)(schemaByPath, ['properties', segment])) {
|
|
73
|
+
return [...path, 'properties', segment];
|
|
74
|
+
}
|
|
75
|
+
const items = (0, get_1.default)(schemaByPath, 'items');
|
|
76
|
+
if (items) {
|
|
77
|
+
if (Array.isArray(items)) {
|
|
78
|
+
return [...path, 'items', segment];
|
|
79
|
+
}
|
|
80
|
+
return [...path, 'items'];
|
|
81
|
+
}
|
|
82
|
+
return undefined;
|
|
83
|
+
}, []);
|
|
84
|
+
return schemaPath;
|
|
85
|
+
};
|
|
86
|
+
exports.getSchemaPath = getSchemaPath;
|
|
87
|
+
/**
|
|
88
|
+
* Resolves a sub-schema from the root schema by an AJV `schemaPath`.
|
|
89
|
+
*
|
|
90
|
+
* Parses `schemaPath` via `parseSchemaPath` and looks up the node with lodash `get`.
|
|
91
|
+
* The path must point to a schema object, not to a validation keyword — callers
|
|
92
|
+
* should strip the trailing keyword first (see `processAjvError`).
|
|
93
|
+
*
|
|
94
|
+
* @param schemaPath - JSON Pointer string pointing to a schema node,
|
|
95
|
+
* e.g. `"#/properties/name"`.
|
|
96
|
+
* @param schema - The root JSON schema object.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* const nameSchema = {
|
|
100
|
+
* minLength: 5,
|
|
101
|
+
* };
|
|
102
|
+
* const objectSchema = {
|
|
103
|
+
* properties: {
|
|
104
|
+
* name: nameSchema,
|
|
105
|
+
* },
|
|
106
|
+
* };
|
|
107
|
+
* getSchemaBySchemaPath("#/properties/name", objectSchema); // returns nameSchema
|
|
108
|
+
*
|
|
109
|
+
* @returns The sub-schema at the given path, or the root schema when the path is empty.
|
|
110
|
+
*/
|
|
111
|
+
const getSchemaBySchemaPath = (schemaPath, schema) => {
|
|
112
|
+
const pathArr = (0, exports.parseSchemaPath)(schemaPath);
|
|
113
|
+
if (!pathArr.length) {
|
|
114
|
+
return schema;
|
|
115
|
+
}
|
|
116
|
+
return (0, get_1.default)(schema, pathArr);
|
|
117
|
+
};
|
|
118
|
+
exports.getSchemaBySchemaPath = getSchemaBySchemaPath;
|
|
119
|
+
const getSchemaByInstancePath = (instancePath, schema) => {
|
|
120
|
+
const schemaPath = (0, exports.getSchemaPath)((0, exports.parseInstancePath)(instancePath), '', schema);
|
|
121
|
+
if (schemaPath) {
|
|
122
|
+
return schemaPath.length ? (0, get_1.default)(schema, schemaPath) : schema;
|
|
123
|
+
}
|
|
124
|
+
return undefined;
|
|
125
|
+
};
|
|
126
|
+
exports.getSchemaByInstancePath = getSchemaByInstancePath;
|
|
127
|
+
const getSchemaByFinalFormPath = (finalFormNameOrPath, finalFormHeadName, schema) => {
|
|
128
|
+
const schemaPath = (0, exports.getSchemaPath)(finalFormNameOrPath, finalFormHeadName, schema);
|
|
129
|
+
if (schemaPath) {
|
|
130
|
+
return schemaPath.length ? (0, get_1.default)(schema, schemaPath) : schema;
|
|
131
|
+
}
|
|
132
|
+
return undefined;
|
|
133
|
+
};
|
|
134
|
+
exports.getSchemaByFinalFormPath = getSchemaByFinalFormPath;
|
|
135
|
+
const getValuePaths = (value, path = []) => {
|
|
136
|
+
const result = [];
|
|
137
|
+
const isObject = (v) => v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
138
|
+
if (Array.isArray(value)) {
|
|
139
|
+
value.forEach((_, index) => {
|
|
140
|
+
result.push(...(0, exports.getValuePaths)(value[index], [...path, `${index}`]));
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
else if (isObject(value)) {
|
|
144
|
+
Object.keys(value).forEach((key) => {
|
|
145
|
+
result.push(...(0, exports.getValuePaths)((0, get_1.default)(value, key), [...path, key]));
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
else if (path.length) {
|
|
149
|
+
result.push(path);
|
|
150
|
+
}
|
|
151
|
+
return result;
|
|
152
|
+
};
|
|
153
|
+
exports.getValuePaths = getValuePaths;
|
|
154
|
+
const smartSet = (object, path, value) => {
|
|
155
|
+
const valuePaths = (0, exports.getValuePaths)(value);
|
|
156
|
+
if (valuePaths.length) {
|
|
157
|
+
(0, set_1.default)(object, path, Object.assign({}, (0, get_1.default)(object, path)));
|
|
158
|
+
valuePaths.forEach((valuePath) => {
|
|
159
|
+
(0, set_1.default)(object, [...path, ...valuePath], (0, get_1.default)(value, valuePath));
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
return object;
|
|
163
|
+
};
|
|
164
|
+
exports.smartSet = smartSet;
|
|
165
|
+
const smartMerge = (first, second, deep = false) => {
|
|
166
|
+
let result = {};
|
|
167
|
+
if (deep) {
|
|
168
|
+
(0, exports.getValuePaths)(first).forEach((path) => {
|
|
169
|
+
(0, set_1.default)(result, path, (0, get_1.default)(first, path));
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
result = Object.assign({}, first);
|
|
174
|
+
}
|
|
175
|
+
(0, exports.getValuePaths)(second).forEach((path) => {
|
|
176
|
+
(0, set_1.default)(result, path, (0, get_1.default)(second, path));
|
|
177
|
+
});
|
|
178
|
+
return result;
|
|
179
|
+
};
|
|
180
|
+
exports.smartMerge = smartMerge;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Accordeon = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// import {ArrayLayoutProps, ObjectLayoutProps, isArrayItem} from '../../../../core';
|
|
6
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
7
|
+
const components_1 = require("../../kit/components");
|
|
8
|
+
// import {useErrorChecker} from '../../../hooks';
|
|
9
|
+
// import {RemoveButton} from '../../kit/components/RemoveButton';
|
|
10
|
+
const SimpleVerticalAccordeon_1 = require("../../kit/components/SimpleVerticalAccordeon");
|
|
11
|
+
const Accordeon = ({ schema, input, meta, children, wrapperProps, }) => {
|
|
12
|
+
const [open, setOpen] = react_1.default.useState(Boolean(wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.open));
|
|
13
|
+
// const onDrop = React.useCallback(() => {
|
|
14
|
+
// setOpen(false);
|
|
15
|
+
// input.onDrop();
|
|
16
|
+
// }, [input.onDrop, setOpen]);
|
|
17
|
+
// const removeButton = React.useMemo(() => {
|
|
18
|
+
// if (!isArrayItem(name) && (spec.required || !input.value)) {
|
|
19
|
+
// return null;
|
|
20
|
+
// }
|
|
21
|
+
// return <RemoveButton name={name} onDrop={onDrop} />;
|
|
22
|
+
// }, [spec.required, input.value, onDrop, name]);
|
|
23
|
+
// useErrorChecker({name, meta, open, setOpen});
|
|
24
|
+
return (react_1.default.createElement(SimpleVerticalAccordeon_1.SimpleVerticalAccordeon, { name: input.name, title: schema.title || '', note: schema.description || '', open: open, onOpenChange: setOpen,
|
|
25
|
+
// headerActionsTemplate={removeButton}
|
|
26
|
+
hideInsteadOfDestroy: true, withBranchView: true },
|
|
27
|
+
react_1.default.createElement(components_1.ErrorWrapper, { name: input.name, meta: meta,
|
|
28
|
+
// ff
|
|
29
|
+
withoutChildErrorStyles: true }, children)));
|
|
30
|
+
};
|
|
31
|
+
exports.Accordeon = Accordeon;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnyInput = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
|
+
const core_1 = require("../core");
|
|
8
|
+
const AnyInput = ({ input, schema }) => {
|
|
9
|
+
var _a;
|
|
10
|
+
const [state, setState] = react_1.default.useState(true);
|
|
11
|
+
// React.useEffect(() => {
|
|
12
|
+
// input.onChange(undefined);
|
|
13
|
+
// }, []);
|
|
14
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
15
|
+
react_1.default.createElement(core_1.Entity, { name: `${input.name}.bla`, schema: (_a = schema.oneOf) === null || _a === void 0 ? void 0 : _a[state ? 0 : 1] }),
|
|
16
|
+
react_1.default.createElement(uikit_1.Button, { onClick: () => {
|
|
17
|
+
input.onChange(undefined);
|
|
18
|
+
setState(!state);
|
|
19
|
+
} }, "Toggle")));
|
|
20
|
+
};
|
|
21
|
+
exports.AnyInput = AnyInput;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.array-base_add-button-right {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: flex-end;
|
|
4
|
+
}
|
|
5
|
+
.array-base_add-button-right .transparent {
|
|
6
|
+
align-items: flex-end;
|
|
7
|
+
}
|
|
8
|
+
.array-base__items-wrapper_add-button-down {
|
|
9
|
+
margin-bottom: 15px;
|
|
10
|
+
}
|
|
11
|
+
.array-base__items-wrapper_items-primitive {
|
|
12
|
+
min-width: 100%;
|
|
13
|
+
}
|
|
14
|
+
.array-base__items-wrapper_items-primitive:empty {
|
|
15
|
+
min-width: unset;
|
|
16
|
+
}
|
|
17
|
+
.array-base__item-prefix {
|
|
18
|
+
margin-top: -7px;
|
|
19
|
+
margin-bottom: 8px;
|
|
20
|
+
}
|
|
21
|
+
.array-base__add-button_right {
|
|
22
|
+
margin-left: 4px;
|
|
23
|
+
}
|