@chobantonov/jsonforms-react-renderer-common 0.0.0-stage → 0.1.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/LICENSE +22 -0
- package/README.md +79 -2
- package/lib/cells/CellSummary.cjs.js +2 -0
- package/lib/cells/CellSummary.cjs.js.map +1 -0
- package/lib/cells/CellSummary.d.ts +14 -0
- package/lib/cells/CellSummary.esm.js +29 -0
- package/lib/cells/CellSummary.esm.js.map +1 -0
- package/lib/cells/cellMode.cjs.js +2 -0
- package/lib/cells/cellMode.cjs.js.map +1 -0
- package/lib/cells/cellMode.d.ts +14 -0
- package/lib/cells/cellMode.esm.js +6 -0
- package/lib/cells/cellMode.esm.js.map +1 -0
- package/lib/cells/compositeActions.cjs.js +2 -0
- package/lib/cells/compositeActions.cjs.js.map +1 -0
- package/lib/cells/compositeActions.d.ts +7 -0
- package/lib/cells/compositeActions.esm.js +14 -0
- package/lib/cells/compositeActions.esm.js.map +1 -0
- package/lib/cells/compositeCellTester.cjs.js +2 -0
- package/lib/cells/compositeCellTester.cjs.js.map +1 -0
- package/lib/cells/compositeCellTester.d.ts +2 -0
- package/lib/cells/compositeCellTester.esm.js +12 -0
- package/lib/cells/compositeCellTester.esm.js.map +1 -0
- package/lib/cells/compositeSummary.cjs.js +2 -0
- package/lib/cells/compositeSummary.cjs.js.map +1 -0
- package/lib/cells/compositeSummary.d.ts +10 -0
- package/lib/cells/compositeSummary.esm.js +44 -0
- package/lib/cells/compositeSummary.esm.js.map +1 -0
- package/lib/cells/useCompositeCellPresentation.cjs.js +2 -0
- package/lib/cells/useCompositeCellPresentation.cjs.js.map +1 -0
- package/lib/cells/useCompositeCellPresentation.d.ts +7 -0
- package/lib/cells/useCompositeCellPresentation.esm.js +18 -0
- package/lib/cells/useCompositeCellPresentation.esm.js.map +1 -0
- package/lib/cells/useCompositeDraft.cjs.js +2 -0
- package/lib/cells/useCompositeDraft.cjs.js.map +1 -0
- package/lib/cells/useCompositeDraft.d.ts +52 -0
- package/lib/cells/useCompositeDraft.esm.js +95 -0
- package/lib/cells/useCompositeDraft.esm.js.map +1 -0
- package/lib/collections/CollectionErrorNavigation.cjs.js +2 -0
- package/lib/collections/CollectionErrorNavigation.cjs.js.map +1 -0
- package/lib/collections/CollectionErrorNavigation.d.ts +12 -0
- package/lib/collections/CollectionErrorNavigation.esm.js +68 -0
- package/lib/collections/CollectionErrorNavigation.esm.js.map +1 -0
- package/lib/collections/arrayChoices.cjs.js +2 -0
- package/lib/collections/arrayChoices.cjs.js.map +1 -0
- package/lib/collections/arrayChoices.d.ts +85 -0
- package/lib/collections/arrayChoices.esm.js +54 -0
- package/lib/collections/arrayChoices.esm.js.map +1 -0
- package/lib/collections/collectionPagination.cjs.js +2 -0
- package/lib/collections/collectionPagination.cjs.js.map +1 -0
- package/lib/collections/collectionPagination.d.ts +22 -0
- package/lib/collections/collectionPagination.esm.js +51 -0
- package/lib/collections/collectionPagination.esm.js.map +1 -0
- package/lib/collections/columnResize.cjs.js +2 -0
- package/lib/collections/columnResize.cjs.js.map +1 -0
- package/lib/collections/columnResize.d.ts +16 -0
- package/lib/collections/columnResize.esm.js +85 -0
- package/lib/collections/columnResize.esm.js.map +1 -0
- package/lib/collections/rowDetail.cjs.js +2 -0
- package/lib/collections/rowDetail.cjs.js.map +1 -0
- package/lib/collections/rowDetail.d.ts +34 -0
- package/lib/collections/rowDetail.esm.js +106 -0
- package/lib/collections/rowDetail.esm.js.map +1 -0
- package/lib/collections/tableColumns.cjs.js +2 -0
- package/lib/collections/tableColumns.cjs.js.map +1 -0
- package/lib/collections/tableColumns.d.ts +13 -0
- package/lib/collections/tableColumns.esm.js +16 -0
- package/lib/collections/tableColumns.esm.js.map +1 -0
- package/lib/collections/useArrayPanelState.cjs.js +2 -0
- package/lib/collections/useArrayPanelState.cjs.js.map +1 -0
- package/lib/collections/useArrayPanelState.d.ts +7 -0
- package/lib/collections/useArrayPanelState.esm.js +18 -0
- package/lib/collections/useArrayPanelState.esm.js.map +1 -0
- package/lib/collections/useCollectionDelete.cjs.js +2 -0
- package/lib/collections/useCollectionDelete.cjs.js.map +1 -0
- package/lib/collections/useCollectionDelete.d.ts +17 -0
- package/lib/collections/useCollectionDelete.esm.js +38 -0
- package/lib/collections/useCollectionDelete.esm.js.map +1 -0
- package/lib/collections/useTableSelection.cjs.js +2 -0
- package/lib/collections/useTableSelection.cjs.js.map +1 -0
- package/lib/collections/useTableSelection.d.ts +11 -0
- package/lib/collections/useTableSelection.esm.js +41 -0
- package/lib/collections/useTableSelection.esm.js.map +1 -0
- package/lib/composition/AllOfRenderer.cjs.js +2 -0
- package/lib/composition/AllOfRenderer.cjs.js.map +1 -0
- package/lib/composition/AllOfRenderer.d.ts +5 -0
- package/lib/composition/AllOfRenderer.esm.js +33 -0
- package/lib/composition/AllOfRenderer.esm.js.map +1 -0
- package/lib/composition/CombinatorBranch.cjs.js +2 -0
- package/lib/composition/CombinatorBranch.cjs.js.map +1 -0
- package/lib/composition/CombinatorBranch.d.ts +17 -0
- package/lib/composition/CombinatorBranch.esm.js +54 -0
- package/lib/composition/CombinatorBranch.esm.js.map +1 -0
- package/lib/composition/CombinatorProperties.cjs.js +2 -0
- package/lib/composition/CombinatorProperties.cjs.js.map +1 -0
- package/lib/composition/CombinatorProperties.d.ts +12 -0
- package/lib/composition/CombinatorProperties.esm.js +20 -0
- package/lib/composition/CombinatorProperties.esm.js.map +1 -0
- package/lib/composition/ScalarCompositionControl.cjs.js +2 -0
- package/lib/composition/ScalarCompositionControl.cjs.js.map +1 -0
- package/lib/composition/ScalarCompositionControl.d.ts +6 -0
- package/lib/composition/ScalarCompositionControl.esm.js +22 -0
- package/lib/composition/ScalarCompositionControl.esm.js.map +1 -0
- package/lib/composition/choiceCards.cjs.js +2 -0
- package/lib/composition/choiceCards.cjs.js.map +1 -0
- package/lib/composition/choiceCards.d.ts +36 -0
- package/lib/composition/choiceCards.esm.js +162 -0
- package/lib/composition/choiceCards.esm.js.map +1 -0
- package/lib/composition/combinators.cjs.js +2 -0
- package/lib/composition/combinators.cjs.js.map +1 -0
- package/lib/composition/combinators.d.ts +40 -0
- package/lib/composition/combinators.esm.js +26 -0
- package/lib/composition/combinators.esm.js.map +1 -0
- package/lib/composition/discriminatorBranch.cjs.js +2 -0
- package/lib/composition/discriminatorBranch.cjs.js.map +1 -0
- package/lib/composition/discriminatorBranch.d.ts +6 -0
- package/lib/composition/discriminatorBranch.esm.js +41 -0
- package/lib/composition/discriminatorBranch.esm.js.map +1 -0
- package/lib/composition/scalarComposition.cjs.js +2 -0
- package/lib/composition/scalarComposition.cjs.js.map +1 -0
- package/lib/composition/scalarComposition.d.ts +27 -0
- package/lib/composition/scalarComposition.esm.js +76 -0
- package/lib/composition/scalarComposition.esm.js.map +1 -0
- package/lib/composition/useCombinatorSelection.cjs.js +2 -0
- package/lib/composition/useCombinatorSelection.cjs.js.map +1 -0
- package/lib/composition/useCombinatorSelection.d.ts +6 -0
- package/lib/composition/useCombinatorSelection.esm.js +22 -0
- package/lib/composition/useCombinatorSelection.esm.js.map +1 -0
- package/lib/composition/useScalarComposition.cjs.js +2 -0
- package/lib/composition/useScalarComposition.cjs.js.map +1 -0
- package/lib/composition/useScalarComposition.d.ts +18 -0
- package/lib/composition/useScalarComposition.esm.js +24 -0
- package/lib/composition/useScalarComposition.esm.js.map +1 -0
- package/lib/controls/FileArrayInput.cjs.js +2 -0
- package/lib/controls/FileArrayInput.cjs.js.map +1 -0
- package/lib/controls/FileArrayInput.d.ts +19 -0
- package/lib/controls/FileArrayInput.esm.js +232 -0
- package/lib/controls/FileArrayInput.esm.js.map +1 -0
- package/lib/controls/controlHelp.cjs.js +2 -0
- package/lib/controls/controlHelp.cjs.js.map +1 -0
- package/lib/controls/controlHelp.d.ts +15 -0
- package/lib/controls/controlHelp.esm.js +9 -0
- package/lib/controls/controlHelp.esm.js.map +1 -0
- package/lib/controls/inputAdornments.cjs.js +2 -0
- package/lib/controls/inputAdornments.cjs.js.map +1 -0
- package/lib/controls/inputAdornments.d.ts +32 -0
- package/lib/controls/inputAdornments.esm.js +192 -0
- package/lib/controls/inputAdornments.esm.js.map +1 -0
- package/lib/controls/numeric.cjs.js +2 -0
- package/lib/controls/numeric.cjs.js.map +1 -0
- package/lib/controls/numeric.d.ts +36 -0
- package/lib/controls/numeric.esm.js +9 -0
- package/lib/controls/numeric.esm.js.map +1 -0
- package/lib/controls/useClearAffordance.cjs.js +2 -0
- package/lib/controls/useClearAffordance.cjs.js.map +1 -0
- package/lib/controls/useClearAffordance.d.ts +15 -0
- package/lib/controls/useClearAffordance.esm.js +17 -0
- package/lib/controls/useClearAffordance.esm.js.map +1 -0
- package/lib/controls/useDebouncedChange.cjs.js +2 -0
- package/lib/controls/useDebouncedChange.cjs.js.map +1 -0
- package/lib/controls/useDebouncedChange.d.ts +37 -0
- package/lib/controls/useDebouncedChange.esm.js +40 -0
- package/lib/controls/useDebouncedChange.esm.js.map +1 -0
- package/lib/controls/useFocus.cjs.js +2 -0
- package/lib/controls/useFocus.cjs.js.map +1 -0
- package/lib/controls/useFocus.d.ts +1 -0
- package/lib/controls/useFocus.esm.js +13 -0
- package/lib/controls/useFocus.esm.js.map +1 -0
- package/lib/core/configNamespaces.cjs.js +2 -0
- package/lib/core/configNamespaces.cjs.js.map +1 -0
- package/lib/core/configNamespaces.d.ts +32 -0
- package/lib/core/configNamespaces.esm.js +15 -0
- package/lib/core/configNamespaces.esm.js.map +1 -0
- package/lib/core/dataPointer.cjs.js +2 -0
- package/lib/core/dataPointer.cjs.js.map +1 -0
- package/lib/core/dataPointer.d.ts +1 -0
- package/lib/core/dataPointer.esm.js +5 -0
- package/lib/core/dataPointer.esm.js.map +1 -0
- package/lib/core/detailUiSchema.cjs.js +2 -0
- package/lib/core/detailUiSchema.cjs.js.map +1 -0
- package/lib/core/detailUiSchema.d.ts +7 -0
- package/lib/core/detailUiSchema.esm.js +23 -0
- package/lib/core/detailUiSchema.esm.js.map +1 -0
- package/lib/core/plainRecord.cjs.js +2 -0
- package/lib/core/plainRecord.cjs.js.map +1 -0
- package/lib/core/plainRecord.d.ts +1 -0
- package/lib/core/plainRecord.esm.js +5 -0
- package/lib/core/plainRecord.esm.js.map +1 -0
- package/lib/core/uiSchemaCycle.cjs.js +2 -0
- package/lib/core/uiSchemaCycle.cjs.js.map +1 -0
- package/lib/core/uiSchemaCycle.d.ts +18 -0
- package/lib/core/uiSchemaCycle.esm.js +27 -0
- package/lib/core/uiSchemaCycle.esm.js.map +1 -0
- package/lib/dynamic/DynamicUiProvider.cjs.js +4 -0
- package/lib/dynamic/DynamicUiProvider.cjs.js.map +1 -0
- package/lib/dynamic/DynamicUiProvider.d.ts +35 -0
- package/lib/dynamic/DynamicUiProvider.esm.js +182 -0
- package/lib/dynamic/DynamicUiProvider.esm.js.map +1 -0
- package/lib/dynamic/dynamicCel.cjs.js +2 -0
- package/lib/dynamic/dynamicCel.cjs.js.map +1 -0
- package/lib/dynamic/dynamicCel.d.ts +1 -0
- package/lib/dynamic/dynamicCel.esm.js +43 -0
- package/lib/dynamic/dynamicCel.esm.js.map +1 -0
- package/lib/dynamic/dynamicConfig.cjs.js +2 -0
- package/lib/dynamic/dynamicConfig.cjs.js.map +1 -0
- package/lib/dynamic/dynamicConfig.d.ts +7 -0
- package/lib/dynamic/dynamicConfig.esm.js +13 -0
- package/lib/dynamic/dynamicConfig.esm.js.map +1 -0
- package/lib/dynamic/dynamicRuntime.cjs.js +2 -0
- package/lib/dynamic/dynamicRuntime.cjs.js.map +1 -0
- package/lib/dynamic/dynamicRuntime.d.ts +4 -0
- package/lib/dynamic/dynamicRuntime.esm.js +16 -0
- package/lib/dynamic/dynamicRuntime.esm.js.map +1 -0
- package/lib/dynamic/dynamicScope.cjs.js +2 -0
- package/lib/dynamic/dynamicScope.cjs.js.map +1 -0
- package/lib/dynamic/dynamicScope.d.ts +2 -0
- package/lib/dynamic/dynamicScope.esm.js +17 -0
- package/lib/dynamic/dynamicScope.esm.js.map +1 -0
- package/lib/dynamic/dynamicTree.cjs.js +2 -0
- package/lib/dynamic/dynamicTree.cjs.js.map +1 -0
- package/lib/dynamic/dynamicTree.d.ts +12 -0
- package/lib/dynamic/dynamicTree.esm.js +57 -0
- package/lib/dynamic/dynamicTree.esm.js.map +1 -0
- package/lib/dynamic/dynamicUi.cjs.js +2 -0
- package/lib/dynamic/dynamicUi.cjs.js.map +1 -0
- package/lib/dynamic/dynamicUi.d.ts +39 -0
- package/lib/dynamic/dynamicUi.esm.js +397 -0
- package/lib/dynamic/dynamicUi.esm.js.map +1 -0
- package/lib/formats/colorFormat.cjs.js +2 -0
- package/lib/formats/colorFormat.cjs.js.map +1 -0
- package/lib/formats/colorFormat.d.ts +127 -0
- package/lib/formats/colorFormat.esm.js +139 -0
- package/lib/formats/colorFormat.esm.js.map +1 -0
- package/lib/formats/dateValues.cjs.js +2 -0
- package/lib/formats/dateValues.cjs.js.map +1 -0
- package/lib/formats/dateValues.d.ts +3 -0
- package/lib/formats/dateValues.esm.js +21 -0
- package/lib/formats/dateValues.esm.js.map +1 -0
- package/lib/formats/duration.cjs.js +2 -0
- package/lib/formats/duration.cjs.js.map +1 -0
- package/lib/formats/duration.d.ts +13 -0
- package/lib/formats/duration.esm.js +28 -0
- package/lib/formats/duration.esm.js.map +1 -0
- package/lib/formats/maskControls.cjs.js +2 -0
- package/lib/formats/maskControls.cjs.js.map +1 -0
- package/lib/formats/maskControls.d.ts +32 -0
- package/lib/formats/maskControls.esm.js +16 -0
- package/lib/formats/maskControls.esm.js.map +1 -0
- package/lib/formats/maskFormat.cjs.js +2 -0
- package/lib/formats/maskFormat.cjs.js.map +1 -0
- package/lib/formats/maskFormat.d.ts +198 -0
- package/lib/formats/maskFormat.esm.js +79 -0
- package/lib/formats/maskFormat.esm.js.map +1 -0
- package/lib/formats/temporalBounds.cjs.js +2 -0
- package/lib/formats/temporalBounds.cjs.js.map +1 -0
- package/lib/formats/temporalBounds.d.ts +82 -0
- package/lib/formats/temporalBounds.esm.js +76 -0
- package/lib/formats/temporalBounds.esm.js.map +1 -0
- package/lib/formats/temporalFormats.cjs.js +2 -0
- package/lib/formats/temporalFormats.cjs.js.map +1 -0
- package/lib/formats/temporalFormats.d.ts +62 -0
- package/lib/formats/temporalFormats.esm.js +18 -0
- package/lib/formats/temporalFormats.esm.js.map +1 -0
- package/lib/formats/useMaskedInput.cjs.js +2 -0
- package/lib/formats/useMaskedInput.cjs.js.map +1 -0
- package/lib/formats/useMaskedInput.d.ts +11 -0
- package/lib/formats/useMaskedInput.esm.js +80 -0
- package/lib/formats/useMaskedInput.esm.js.map +1 -0
- package/lib/index.cjs.js +1 -0
- package/lib/index.d.ts +42 -0
- package/lib/index.esm.js +44 -0
- package/lib/interaction/confirmation.cjs.js +2 -0
- package/lib/interaction/confirmation.cjs.js.map +1 -0
- package/lib/interaction/confirmation.d.ts +112 -0
- package/lib/interaction/confirmation.esm.js +18 -0
- package/lib/interaction/confirmation.esm.js.map +1 -0
- package/lib/interaction/createDeleteConfirmation.cjs.js +2 -0
- package/lib/interaction/createDeleteConfirmation.cjs.js.map +1 -0
- package/lib/interaction/createDeleteConfirmation.d.ts +10 -0
- package/lib/interaction/createDeleteConfirmation.esm.js +17 -0
- package/lib/interaction/createDeleteConfirmation.esm.js.map +1 -0
- package/lib/interaction/detailDialog.cjs.js +2 -0
- package/lib/interaction/detailDialog.cjs.js.map +1 -0
- package/lib/interaction/detailDialog.d.ts +30 -0
- package/lib/interaction/detailDialog.esm.js +89 -0
- package/lib/interaction/detailDialog.esm.js.map +1 -0
- package/lib/interaction/pendingChanges.cjs.js +2 -0
- package/lib/interaction/pendingChanges.cjs.js.map +1 -0
- package/lib/interaction/pendingChanges.d.ts +19 -0
- package/lib/interaction/pendingChanges.esm.js +17 -0
- package/lib/interaction/pendingChanges.esm.js.map +1 -0
- package/lib/interaction/useConfirmationState.cjs.js +2 -0
- package/lib/interaction/useConfirmationState.cjs.js.map +1 -0
- package/lib/interaction/useConfirmationState.d.ts +11 -0
- package/lib/interaction/useConfirmationState.esm.js +39 -0
- package/lib/interaction/useConfirmationState.esm.js.map +1 -0
- package/lib/interaction/visuallyHidden.cjs.js +2 -0
- package/lib/interaction/visuallyHidden.cjs.js.map +1 -0
- package/lib/interaction/visuallyHidden.d.ts +9 -0
- package/lib/interaction/visuallyHidden.esm.js +14 -0
- package/lib/interaction/visuallyHidden.esm.js.map +1 -0
- package/lib/layout/categoryState.cjs.js +2 -0
- package/lib/layout/categoryState.cjs.js.map +1 -0
- package/lib/layout/categoryState.d.ts +66 -0
- package/lib/layout/categoryState.esm.js +42 -0
- package/lib/layout/categoryState.esm.js.map +1 -0
- package/lib/layout/groupState.cjs.js +2 -0
- package/lib/layout/groupState.cjs.js.map +1 -0
- package/lib/layout/groupState.d.ts +34 -0
- package/lib/layout/groupState.esm.js +63 -0
- package/lib/layout/groupState.esm.js.map +1 -0
- package/lib/layout/layoutContext.cjs.js +2 -0
- package/lib/layout/layoutContext.cjs.js.map +1 -0
- package/lib/layout/layoutContext.d.ts +16 -0
- package/lib/layout/layoutContext.esm.js +26 -0
- package/lib/layout/layoutContext.esm.js.map +1 -0
- package/lib/layout/layoutSizing.cjs.js +2 -0
- package/lib/layout/layoutSizing.cjs.js.map +1 -0
- package/lib/layout/layoutSizing.d.ts +104 -0
- package/lib/layout/layoutSizing.esm.js +69 -0
- package/lib/layout/layoutSizing.esm.js.map +1 -0
- package/lib/locale/bg.cjs.js +2 -0
- package/lib/locale/bg.cjs.js.map +1 -0
- package/lib/locale/bg.d.ts +279 -0
- package/lib/locale/bg.esm.js +271 -0
- package/lib/locale/bg.esm.js.map +1 -0
- package/lib/locale/calendar.cjs.js +2 -0
- package/lib/locale/calendar.cjs.js.map +1 -0
- package/lib/locale/calendar.d.ts +23 -0
- package/lib/locale/calendar.esm.js +57 -0
- package/lib/locale/calendar.esm.js.map +1 -0
- package/lib/locale/en.cjs.js +2 -0
- package/lib/locale/en.cjs.js.map +1 -0
- package/lib/locale/en.d.ts +275 -0
- package/lib/locale/en.esm.js +271 -0
- package/lib/locale/en.esm.js.map +1 -0
- package/lib/locale/index.cjs.js +1 -0
- package/lib/locale/index.d.ts +3 -0
- package/lib/locale/index.esm.js +3 -0
- package/lib/locale/intl.cjs.js +2 -0
- package/lib/locale/intl.cjs.js.map +1 -0
- package/lib/locale/intl.d.ts +2 -0
- package/lib/locale/intl.esm.js +11 -0
- package/lib/locale/intl.esm.js.map +1 -0
- package/lib/locale/rendererLocale.cjs.js +2 -0
- package/lib/locale/rendererLocale.cjs.js.map +1 -0
- package/lib/locale/rendererLocale.d.ts +40 -0
- package/lib/locale/rendererLocale.esm.js +24 -0
- package/lib/locale/rendererLocale.esm.js.map +1 -0
- package/lib/locale/translate.cjs.js +2 -0
- package/lib/locale/translate.cjs.js.map +1 -0
- package/lib/locale/translate.d.ts +43 -0
- package/lib/locale/translate.esm.js +25 -0
- package/lib/locale/translate.esm.js.map +1 -0
- package/lib/mixed/MixedDetailControl.cjs.js +2 -0
- package/lib/mixed/MixedDetailControl.cjs.js.map +1 -0
- package/lib/mixed/MixedDetailControl.d.ts +20 -0
- package/lib/mixed/MixedDetailControl.esm.js +73 -0
- package/lib/mixed/MixedDetailControl.esm.js.map +1 -0
- package/lib/mixed/RecursiveTreeRenderer.cjs.js +2 -0
- package/lib/mixed/RecursiveTreeRenderer.cjs.js.map +1 -0
- package/lib/mixed/RecursiveTreeRenderer.d.ts +35 -0
- package/lib/mixed/RecursiveTreeRenderer.esm.js +206 -0
- package/lib/mixed/RecursiveTreeRenderer.esm.js.map +1 -0
- package/lib/mixed/createMixedTypeChangeHandler.cjs.js +2 -0
- package/lib/mixed/createMixedTypeChangeHandler.cjs.js.map +1 -0
- package/lib/mixed/createMixedTypeChangeHandler.d.ts +16 -0
- package/lib/mixed/createMixedTypeChangeHandler.esm.js +34 -0
- package/lib/mixed/createMixedTypeChangeHandler.esm.js.map +1 -0
- package/lib/mixed/mixedComposition.cjs.js +2 -0
- package/lib/mixed/mixedComposition.cjs.js.map +1 -0
- package/lib/mixed/mixedComposition.d.ts +7 -0
- package/lib/mixed/mixedComposition.esm.js +37 -0
- package/lib/mixed/mixedComposition.esm.js.map +1 -0
- package/lib/mixed/mixedNodeEditor.cjs.js +2 -0
- package/lib/mixed/mixedNodeEditor.cjs.js.map +1 -0
- package/lib/mixed/mixedNodeEditor.d.ts +12 -0
- package/lib/mixed/mixedNodeEditor.esm.js +20 -0
- package/lib/mixed/mixedNodeEditor.esm.js.map +1 -0
- package/lib/mixed/mixedScalar.cjs.js +2 -0
- package/lib/mixed/mixedScalar.cjs.js.map +1 -0
- package/lib/mixed/mixedScalar.d.ts +4 -0
- package/lib/mixed/mixedScalar.esm.js +6 -0
- package/lib/mixed/mixedScalar.esm.js.map +1 -0
- package/lib/mixed/mixedSchema.cjs.js +2 -0
- package/lib/mixed/mixedSchema.cjs.js.map +1 -0
- package/lib/mixed/mixedSchema.d.ts +22 -0
- package/lib/mixed/mixedSchema.esm.js +88 -0
- package/lib/mixed/mixedSchema.esm.js.map +1 -0
- package/lib/mixed/mixedTree.cjs.js +2 -0
- package/lib/mixed/mixedTree.cjs.js.map +1 -0
- package/lib/mixed/mixedTree.d.ts +19 -0
- package/lib/mixed/mixedTree.esm.js +78 -0
- package/lib/mixed/mixedTree.esm.js.map +1 -0
- package/lib/mixed/mixedTreeActions.cjs.js +2 -0
- package/lib/mixed/mixedTreeActions.cjs.js.map +1 -0
- package/lib/mixed/mixedTreeActions.d.ts +6 -0
- package/lib/mixed/mixedTreeActions.esm.js +17 -0
- package/lib/mixed/mixedTreeActions.esm.js.map +1 -0
- package/lib/mixed/recursiveTree.cjs.js +2 -0
- package/lib/mixed/recursiveTree.cjs.js.map +1 -0
- package/lib/mixed/recursiveTree.d.ts +9 -0
- package/lib/mixed/recursiveTree.esm.js +49 -0
- package/lib/mixed/recursiveTree.esm.js.map +1 -0
- package/lib/mixed/useMixedNavigation.cjs.js +2 -0
- package/lib/mixed/useMixedNavigation.cjs.js.map +1 -0
- package/lib/mixed/useMixedNavigation.d.ts +6 -0
- package/lib/mixed/useMixedNavigation.esm.js +21 -0
- package/lib/mixed/useMixedNavigation.esm.js.map +1 -0
- package/lib/mixed/useMixedRenderer.cjs.js +2 -0
- package/lib/mixed/useMixedRenderer.cjs.js.map +1 -0
- package/lib/mixed/useMixedRenderer.d.ts +61 -0
- package/lib/mixed/useMixedRenderer.esm.js +185 -0
- package/lib/mixed/useMixedRenderer.esm.js.map +1 -0
- package/lib/mixed/useMixedType.cjs.js +2 -0
- package/lib/mixed/useMixedType.cjs.js.map +1 -0
- package/lib/mixed/useMixedType.d.ts +6 -0
- package/lib/mixed/useMixedType.esm.js +23 -0
- package/lib/mixed/useMixedType.esm.js.map +1 -0
- package/lib/objects/IsolatedPropertyEditor.cjs.js +2 -0
- package/lib/objects/IsolatedPropertyEditor.cjs.js.map +1 -0
- package/lib/objects/IsolatedPropertyEditor.d.ts +35 -0
- package/lib/objects/IsolatedPropertyEditor.esm.js +27 -0
- package/lib/objects/IsolatedPropertyEditor.esm.js.map +1 -0
- package/lib/objects/ObjectDetail.cjs.js +2 -0
- package/lib/objects/ObjectDetail.cjs.js.map +1 -0
- package/lib/objects/ObjectDetail.d.ts +42 -0
- package/lib/objects/ObjectDetail.esm.js +103 -0
- package/lib/objects/ObjectDetail.esm.js.map +1 -0
- package/lib/objects/additionalProperties.cjs.js +2 -0
- package/lib/objects/additionalProperties.cjs.js.map +1 -0
- package/lib/objects/additionalProperties.d.ts +14 -0
- package/lib/objects/additionalProperties.esm.js +41 -0
- package/lib/objects/additionalProperties.esm.js.map +1 -0
- package/lib/objects/additionalPropertyName.cjs.js +2 -0
- package/lib/objects/additionalPropertyName.cjs.js.map +1 -0
- package/lib/objects/additionalPropertyName.d.ts +63 -0
- package/lib/objects/additionalPropertyName.esm.js +46 -0
- package/lib/objects/additionalPropertyName.esm.js.map +1 -0
- package/lib/objects/conditionalFields.cjs.js +2 -0
- package/lib/objects/conditionalFields.cjs.js.map +1 -0
- package/lib/objects/conditionalFields.d.ts +18 -0
- package/lib/objects/conditionalFields.esm.js +105 -0
- package/lib/objects/conditionalFields.esm.js.map +1 -0
- package/lib/objects/dynamicProperties.cjs.js +2 -0
- package/lib/objects/dynamicProperties.cjs.js.map +1 -0
- package/lib/objects/dynamicProperties.d.ts +10 -0
- package/lib/objects/dynamicProperties.esm.js +33 -0
- package/lib/objects/dynamicProperties.esm.js.map +1 -0
- package/lib/objects/literalPropertySchema.cjs.js +2 -0
- package/lib/objects/literalPropertySchema.cjs.js.map +1 -0
- package/lib/objects/literalPropertySchema.d.ts +2 -0
- package/lib/objects/literalPropertySchema.esm.js +38 -0
- package/lib/objects/literalPropertySchema.esm.js.map +1 -0
- package/lib/objects/useAdditionalPropertyEntries.cjs.js +2 -0
- package/lib/objects/useAdditionalPropertyEntries.cjs.js.map +1 -0
- package/lib/objects/useAdditionalPropertyEntries.d.ts +72 -0
- package/lib/objects/useAdditionalPropertyEntries.esm.js +71 -0
- package/lib/objects/useAdditionalPropertyEntries.esm.js.map +1 -0
- package/lib/rolldown-runtime-BocRIvOZ.js +1 -0
- package/lib/tuple/TupleControlContent.cjs.js +2 -0
- package/lib/tuple/TupleControlContent.cjs.js.map +1 -0
- package/lib/tuple/TupleControlContent.d.ts +17 -0
- package/lib/tuple/TupleControlContent.esm.js +74 -0
- package/lib/tuple/TupleControlContent.esm.js.map +1 -0
- package/lib/tuple/TupleField.cjs.js +2 -0
- package/lib/tuple/TupleField.cjs.js.map +1 -0
- package/lib/tuple/TupleField.d.ts +15 -0
- package/lib/tuple/TupleField.esm.js +72 -0
- package/lib/tuple/TupleField.esm.js.map +1 -0
- package/lib/tuple/tupleSchema.cjs.js +2 -0
- package/lib/tuple/tupleSchema.cjs.js.map +1 -0
- package/lib/tuple/tupleSchema.d.ts +93 -0
- package/lib/tuple/tupleSchema.esm.js +63 -0
- package/lib/tuple/tupleSchema.esm.js.map +1 -0
- package/lib/tuple/useTupleAdditionalItems.cjs.js +2 -0
- package/lib/tuple/useTupleAdditionalItems.cjs.js.map +1 -0
- package/lib/tuple/useTupleAdditionalItems.d.ts +45 -0
- package/lib/tuple/useTupleAdditionalItems.esm.js +47 -0
- package/lib/tuple/useTupleAdditionalItems.esm.js.map +1 -0
- package/lib/tuple/useTupleControl.cjs.js +3 -0
- package/lib/tuple/useTupleControl.cjs.js.map +1 -0
- package/lib/tuple/useTupleControl.d.ts +26 -0
- package/lib/tuple/useTupleControl.esm.js +84 -0
- package/lib/tuple/useTupleControl.esm.js.map +1 -0
- package/lib/tuple/useTupleField.cjs.js +2 -0
- package/lib/tuple/useTupleField.cjs.js.map +1 -0
- package/lib/tuple/useTupleField.d.ts +38 -0
- package/lib/tuple/useTupleField.esm.js +80 -0
- package/lib/tuple/useTupleField.esm.js.map +1 -0
- package/lib/validation/ItemValidationIndicator.cjs.js +2 -0
- package/lib/validation/ItemValidationIndicator.cjs.js.map +1 -0
- package/lib/validation/ItemValidationIndicator.d.ts +9 -0
- package/lib/validation/ItemValidationIndicator.esm.js +14 -0
- package/lib/validation/ItemValidationIndicator.esm.js.map +1 -0
- package/lib/validation/errorSummary.cjs.js +9 -0
- package/lib/validation/errorSummary.cjs.js.map +1 -0
- package/lib/validation/errorSummary.d.ts +44 -0
- package/lib/validation/errorSummary.esm.js +194 -0
- package/lib/validation/errorSummary.esm.js.map +1 -0
- package/lib/validation/preTouchErrors.cjs.js +2 -0
- package/lib/validation/preTouchErrors.cjs.js.map +1 -0
- package/lib/validation/preTouchErrors.d.ts +77 -0
- package/lib/validation/preTouchErrors.esm.js +42 -0
- package/lib/validation/preTouchErrors.esm.js.map +1 -0
- package/lib/validation/validationIndicator.cjs.js +2 -0
- package/lib/validation/validationIndicator.cjs.js.map +1 -0
- package/lib/validation/validationIndicator.d.ts +72 -0
- package/lib/validation/validationIndicator.esm.js +66 -0
- package/lib/validation/validationIndicator.esm.js.map +1 -0
- package/lib/webcomponent/element.cjs.js +2 -0
- package/lib/webcomponent/element.cjs.js.map +1 -0
- package/lib/webcomponent/element.d.ts +48 -0
- package/lib/webcomponent/element.esm.js +85 -0
- package/lib/webcomponent/element.esm.js.map +1 -0
- package/lib/webcomponent/input.cjs.js +2 -0
- package/lib/webcomponent/input.cjs.js.map +1 -0
- package/lib/webcomponent/input.d.ts +6 -0
- package/lib/webcomponent/input.esm.js +25 -0
- package/lib/webcomponent/input.esm.js.map +1 -0
- package/package.json +86 -3
- package/src/cells/CellSummary.tsx +59 -0
- package/src/cells/cellMode.tsx +21 -0
- package/src/cells/compositeActions.ts +21 -0
- package/src/cells/compositeCellTester.ts +15 -0
- package/src/cells/compositeSummary.ts +149 -0
- package/src/cells/useCompositeCellPresentation.ts +37 -0
- package/src/cells/useCompositeDraft.ts +199 -0
- package/src/collections/CollectionErrorNavigation.tsx +123 -0
- package/src/collections/arrayChoices.ts +235 -0
- package/src/collections/collectionPagination.ts +95 -0
- package/src/collections/columnResize.tsx +151 -0
- package/src/collections/rowDetail.tsx +208 -0
- package/src/collections/tableColumns.ts +39 -0
- package/src/collections/useArrayPanelState.ts +25 -0
- package/src/collections/useCollectionDelete.ts +62 -0
- package/src/collections/useTableSelection.ts +77 -0
- package/src/composition/AllOfRenderer.tsx +79 -0
- package/src/composition/CombinatorBranch.tsx +93 -0
- package/src/composition/CombinatorProperties.tsx +56 -0
- package/src/composition/ScalarCompositionControl.tsx +34 -0
- package/src/composition/choiceCards.tsx +389 -0
- package/src/composition/combinators.ts +131 -0
- package/src/composition/discriminatorBranch.ts +82 -0
- package/src/composition/scalarComposition.ts +193 -0
- package/src/composition/useCombinatorSelection.ts +53 -0
- package/src/composition/useScalarComposition.ts +67 -0
- package/src/controls/FileArrayInput.tsx +407 -0
- package/src/controls/controlHelp.ts +28 -0
- package/src/controls/inputAdornments.tsx +337 -0
- package/src/controls/numeric.ts +43 -0
- package/src/controls/useClearAffordance.ts +22 -0
- package/src/controls/useDebouncedChange.ts +138 -0
- package/src/controls/useFocus.ts +32 -0
- package/src/core/configNamespaces.ts +67 -0
- package/src/core/dataPointer.ts +8 -0
- package/src/core/detailUiSchema.ts +88 -0
- package/src/core/plainRecord.ts +8 -0
- package/src/core/uiSchemaCycle.tsx +122 -0
- package/src/dynamic/DynamicUiProvider.tsx +414 -0
- package/src/dynamic/dynamicCel.ts +68 -0
- package/src/dynamic/dynamicConfig.ts +26 -0
- package/src/dynamic/dynamicRuntime.ts +25 -0
- package/src/dynamic/dynamicScope.ts +22 -0
- package/src/dynamic/dynamicTree.ts +128 -0
- package/src/dynamic/dynamicUi.ts +711 -0
- package/src/formats/colorFormat.ts +390 -0
- package/src/formats/dateValues.ts +45 -0
- package/src/formats/duration.ts +60 -0
- package/src/formats/maskControls.ts +88 -0
- package/src/formats/maskFormat.ts +375 -0
- package/src/formats/temporalBounds.ts +219 -0
- package/src/formats/temporalFormats.ts +128 -0
- package/src/formats/useMaskedInput.ts +194 -0
- package/src/index.ts +42 -0
- package/src/interaction/confirmation.ts +211 -0
- package/src/interaction/createDeleteConfirmation.ts +23 -0
- package/src/interaction/detailDialog.ts +138 -0
- package/src/interaction/pendingChanges.tsx +55 -0
- package/src/interaction/useConfirmationState.ts +55 -0
- package/src/interaction/visuallyHidden.ts +19 -0
- package/src/layout/categoryState.ts +189 -0
- package/src/layout/groupState.ts +201 -0
- package/src/layout/layoutContext.tsx +49 -0
- package/src/layout/layoutSizing.ts +369 -0
- package/src/locale/bg.ts +309 -0
- package/src/locale/calendar.ts +57 -0
- package/src/locale/en.ts +375 -0
- package/src/locale/index.ts +5 -0
- package/src/locale/intl.ts +10 -0
- package/src/locale/rendererLocale.ts +74 -0
- package/src/locale/translate.ts +98 -0
- package/src/mixed/MixedDetailControl.tsx +182 -0
- package/src/mixed/RecursiveTreeRenderer.tsx +388 -0
- package/src/mixed/createMixedTypeChangeHandler.ts +77 -0
- package/src/mixed/mixedComposition.ts +76 -0
- package/src/mixed/mixedNodeEditor.ts +47 -0
- package/src/mixed/mixedScalar.ts +7 -0
- package/src/mixed/mixedSchema.ts +283 -0
- package/src/mixed/mixedTree.ts +199 -0
- package/src/mixed/mixedTreeActions.ts +60 -0
- package/src/mixed/recursiveTree.ts +105 -0
- package/src/mixed/useMixedNavigation.ts +36 -0
- package/src/mixed/useMixedRenderer.ts +300 -0
- package/src/mixed/useMixedType.ts +45 -0
- package/src/objects/IsolatedPropertyEditor.tsx +86 -0
- package/src/objects/ObjectDetail.tsx +232 -0
- package/src/objects/additionalProperties.ts +151 -0
- package/src/objects/additionalPropertyName.ts +185 -0
- package/src/objects/conditionalFields.ts +173 -0
- package/src/objects/dynamicProperties.tsx +68 -0
- package/src/objects/literalPropertySchema.ts +100 -0
- package/src/objects/useAdditionalPropertyEntries.ts +204 -0
- package/src/tuple/TupleControlContent.tsx +152 -0
- package/src/tuple/TupleField.tsx +150 -0
- package/src/tuple/tupleSchema.ts +245 -0
- package/src/tuple/useTupleAdditionalItems.ts +131 -0
- package/src/tuple/useTupleControl.tsx +173 -0
- package/src/tuple/useTupleField.ts +164 -0
- package/src/validation/ItemValidationIndicator.tsx +21 -0
- package/src/validation/errorSummary.tsx +489 -0
- package/src/validation/preTouchErrors.ts +185 -0
- package/src/validation/validationIndicator.ts +202 -0
- package/src/webcomponent/element.ts +107 -0
- package/src/webcomponent/input.ts +56 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { JsonSchema, JsonSchema7 } from '@jsonforms/core';
|
|
2
|
+
|
|
3
|
+
const valueMatchesType = (value: unknown, type: string): boolean => {
|
|
4
|
+
if (type === 'null') return value === null;
|
|
5
|
+
if (type === 'array') return Array.isArray(value);
|
|
6
|
+
if (type === 'object')
|
|
7
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
8
|
+
if (type === 'integer')
|
|
9
|
+
return typeof value === 'number' && Number.isInteger(value);
|
|
10
|
+
return typeof value === type;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** Narrow only schemas applying to the current value, never property/item schemas.
|
|
14
|
+
* The budget bounds analysis; unresolved references and conditions stay intact.
|
|
15
|
+
*/
|
|
16
|
+
export const narrowMixedComposition = (
|
|
17
|
+
schema: JsonSchema,
|
|
18
|
+
type: string,
|
|
19
|
+
budget = { remaining: 256 },
|
|
20
|
+
): JsonSchema => {
|
|
21
|
+
if (typeof schema === 'boolean') {
|
|
22
|
+
return schema ? { type: type as JsonSchema7['type'] } : schema;
|
|
23
|
+
}
|
|
24
|
+
if (--budget.remaining < 0) return schema;
|
|
25
|
+
const source = schema as JsonSchema7;
|
|
26
|
+
// Draft-07 ignores siblings of $ref. Do not infer compatibility from them.
|
|
27
|
+
if (source.$ref) return schema;
|
|
28
|
+
const declared = Array.isArray(source.type)
|
|
29
|
+
? source.type
|
|
30
|
+
: source.type
|
|
31
|
+
? [source.type]
|
|
32
|
+
: [];
|
|
33
|
+
const compatible =
|
|
34
|
+
declared.length === 0 ||
|
|
35
|
+
declared.some(
|
|
36
|
+
(candidate) =>
|
|
37
|
+
candidate === type ||
|
|
38
|
+
(candidate === 'number' && type === 'integer') ||
|
|
39
|
+
(candidate === 'integer' && type === 'number'),
|
|
40
|
+
);
|
|
41
|
+
if (!compatible) return false as unknown as JsonSchema;
|
|
42
|
+
if ('const' in source && !valueMatchesType(source.const, type))
|
|
43
|
+
return false as unknown as JsonSchema;
|
|
44
|
+
const choices = source.enum?.filter((value) => valueMatchesType(value, type));
|
|
45
|
+
if (choices?.length === 0) return false as unknown as JsonSchema;
|
|
46
|
+
const next: JsonSchema7 = {
|
|
47
|
+
...source,
|
|
48
|
+
...(choices ? { enum: choices } : {}),
|
|
49
|
+
type: (type === 'number' &&
|
|
50
|
+
declared.includes('integer') &&
|
|
51
|
+
!declared.includes('number')
|
|
52
|
+
? 'integer'
|
|
53
|
+
: type) as JsonSchema7['type'],
|
|
54
|
+
};
|
|
55
|
+
for (const keyword of ['allOf', 'anyOf', 'oneOf'] as const) {
|
|
56
|
+
const branches = source[keyword];
|
|
57
|
+
if (!branches) continue;
|
|
58
|
+
const narrowed = branches.map((branch) =>
|
|
59
|
+
narrowMixedComposition(branch, type, budget),
|
|
60
|
+
);
|
|
61
|
+
// False alternatives contribute no matches, including to oneOf's count.
|
|
62
|
+
// A false allOf branch must remain: the conjunction is impossible.
|
|
63
|
+
const retained =
|
|
64
|
+
keyword === 'allOf'
|
|
65
|
+
? narrowed
|
|
66
|
+
: narrowed.filter((branch) => branch !== (false as unknown));
|
|
67
|
+
next[keyword] = retained.length
|
|
68
|
+
? retained.map((branch) =>
|
|
69
|
+
typeof branch === 'boolean'
|
|
70
|
+
? { type: type as JsonSchema7['type'], not: {} }
|
|
71
|
+
: (branch as JsonSchema7),
|
|
72
|
+
)
|
|
73
|
+
: [{ type: type as JsonSchema7['type'], not: {} }];
|
|
74
|
+
}
|
|
75
|
+
return next;
|
|
76
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createDefaultValue, type JsonSchema } from '@jsonforms/core';
|
|
2
|
+
import {
|
|
3
|
+
ANY_TYPES,
|
|
4
|
+
getSchemaTypes,
|
|
5
|
+
schemaForType,
|
|
6
|
+
type JsonDataType,
|
|
7
|
+
} from './mixedSchema';
|
|
8
|
+
import type { MixedTreeNode } from './mixedTree';
|
|
9
|
+
|
|
10
|
+
/** The editor at a selected mixed-tree node, independent of selector widgets. */
|
|
11
|
+
export const resolveMixedNodeEditor = (
|
|
12
|
+
node: MixedTreeNode,
|
|
13
|
+
path: string,
|
|
14
|
+
rootSchema: JsonSchema,
|
|
15
|
+
) => {
|
|
16
|
+
const isNestedPrimitive =
|
|
17
|
+
node.path.length > 0 &&
|
|
18
|
+
node.type !== 'array' &&
|
|
19
|
+
node.type !== 'object' &&
|
|
20
|
+
node.type !== 'null';
|
|
21
|
+
const nodeSchema = ANY_TYPES.includes(node.type as JsonDataType)
|
|
22
|
+
? schemaForType(node.schema, node.type as JsonDataType, rootSchema)
|
|
23
|
+
: node.schema;
|
|
24
|
+
const nodePath = [path, ...node.path]
|
|
25
|
+
.filter((segment) => segment !== '')
|
|
26
|
+
.join('.');
|
|
27
|
+
const nodeTypes = getSchemaTypes(node.schema);
|
|
28
|
+
const nodeType =
|
|
29
|
+
node.type && nodeTypes.includes(node.type as JsonDataType)
|
|
30
|
+
? node.type
|
|
31
|
+
: node.type === 'integer' && nodeTypes.includes('number')
|
|
32
|
+
? 'number'
|
|
33
|
+
: null;
|
|
34
|
+
return { isNestedPrimitive, nodeSchema, nodePath, nodeTypes, nodeType };
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const changeMixedNodeType = (
|
|
38
|
+
node: MixedTreeNode,
|
|
39
|
+
nextType: JsonDataType | undefined,
|
|
40
|
+
nodePath: string,
|
|
41
|
+
rootSchema: JsonSchema,
|
|
42
|
+
handleChange: (path: string, value: unknown) => void,
|
|
43
|
+
) => {
|
|
44
|
+
if (!nextType) return;
|
|
45
|
+
const nextSchema = schemaForType(node.schema, nextType, rootSchema);
|
|
46
|
+
handleChange(nodePath, createDefaultValue(nextSchema, rootSchema));
|
|
47
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
/** Only the scalar owned by a mixed type selector retains its empty value.
|
|
4
|
+
* Ordinary optional fields keep their existing clear-to-absent behavior. */
|
|
5
|
+
export const MixedScalarContext = createContext<string | undefined>(undefined);
|
|
6
|
+
export const useMixedScalar = (path: string) =>
|
|
7
|
+
useContext(MixedScalarContext) === path;
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import {
|
|
2
|
+
JsonSchema,
|
|
3
|
+
JsonSchema7,
|
|
4
|
+
UISchemaElement,
|
|
5
|
+
Scopable,
|
|
6
|
+
TesterContext,
|
|
7
|
+
isControl,
|
|
8
|
+
resolveSchema,
|
|
9
|
+
rankWith,
|
|
10
|
+
RankedTester,
|
|
11
|
+
} from '@jsonforms/core';
|
|
12
|
+
import get from 'lodash/get';
|
|
13
|
+
import { narrowMixedComposition } from './mixedComposition';
|
|
14
|
+
export type JsonDataType =
|
|
15
|
+
| 'array'
|
|
16
|
+
| 'boolean'
|
|
17
|
+
| 'integer'
|
|
18
|
+
| 'null'
|
|
19
|
+
| 'number'
|
|
20
|
+
| 'object'
|
|
21
|
+
| 'string';
|
|
22
|
+
|
|
23
|
+
export const ANY_TYPES: JsonDataType[] = [
|
|
24
|
+
'array',
|
|
25
|
+
'boolean',
|
|
26
|
+
'integer',
|
|
27
|
+
'null',
|
|
28
|
+
'number',
|
|
29
|
+
'object',
|
|
30
|
+
'string',
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
const ARRAY_KEYWORDS = [
|
|
34
|
+
'items',
|
|
35
|
+
'maxItems',
|
|
36
|
+
'minItems',
|
|
37
|
+
'uniqueItems',
|
|
38
|
+
] as const;
|
|
39
|
+
const OBJECT_KEYWORDS = [
|
|
40
|
+
'additionalProperties',
|
|
41
|
+
'dependencies',
|
|
42
|
+
'dependentRequired',
|
|
43
|
+
'dependentSchemas',
|
|
44
|
+
'maxProperties',
|
|
45
|
+
'minProperties',
|
|
46
|
+
'patternProperties',
|
|
47
|
+
'properties',
|
|
48
|
+
'propertyNames',
|
|
49
|
+
'required',
|
|
50
|
+
] as const;
|
|
51
|
+
const STRING_KEYWORDS = [
|
|
52
|
+
'contentEncoding',
|
|
53
|
+
'contentMediaType',
|
|
54
|
+
'format',
|
|
55
|
+
'maxLength',
|
|
56
|
+
'minLength',
|
|
57
|
+
'pattern',
|
|
58
|
+
] as const;
|
|
59
|
+
const NUMBER_KEYWORDS = [
|
|
60
|
+
'exclusiveMaximum',
|
|
61
|
+
'exclusiveMinimum',
|
|
62
|
+
'maximum',
|
|
63
|
+
'minimum',
|
|
64
|
+
'multipleOf',
|
|
65
|
+
] as const;
|
|
66
|
+
|
|
67
|
+
const removeKeywords = (schema: JsonSchema7, keywords: readonly string[]) =>
|
|
68
|
+
keywords.forEach(
|
|
69
|
+
(keyword) => delete (schema as Record<string, unknown>)[keyword],
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
export const getJsonDataType = (value: any): JsonDataType | null => {
|
|
73
|
+
if (typeof value === 'string') {
|
|
74
|
+
return 'string';
|
|
75
|
+
}
|
|
76
|
+
if (typeof value === 'number') {
|
|
77
|
+
return Number.isInteger(value) ? 'integer' : 'number';
|
|
78
|
+
}
|
|
79
|
+
if (typeof value === 'boolean') {
|
|
80
|
+
return 'boolean';
|
|
81
|
+
}
|
|
82
|
+
if (Array.isArray(value)) {
|
|
83
|
+
return 'array';
|
|
84
|
+
}
|
|
85
|
+
if (value === null) {
|
|
86
|
+
return 'null';
|
|
87
|
+
}
|
|
88
|
+
if (typeof value === 'object') {
|
|
89
|
+
return 'object';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return null;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const getSchemaTypes = (schema: JsonSchema): JsonDataType[] => {
|
|
96
|
+
if (typeof schema !== 'object') {
|
|
97
|
+
return ANY_TYPES;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (typeof schema.type === 'string') {
|
|
101
|
+
return [schema.type as JsonDataType];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (Array.isArray(schema.type)) {
|
|
105
|
+
return schema.type as JsonDataType[];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return ANY_TYPES;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export function removeInapplicableKeywords(
|
|
112
|
+
nextSchema: JsonSchema7,
|
|
113
|
+
type: JsonDataType,
|
|
114
|
+
) {
|
|
115
|
+
if (type !== 'array') removeKeywords(nextSchema, ARRAY_KEYWORDS);
|
|
116
|
+
if (type !== 'object') removeKeywords(nextSchema, OBJECT_KEYWORDS);
|
|
117
|
+
if (type !== 'string') removeKeywords(nextSchema, STRING_KEYWORDS);
|
|
118
|
+
if (type !== 'integer' && type !== 'number') {
|
|
119
|
+
removeKeywords(nextSchema, NUMBER_KEYWORDS);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function resolveMixedArrayItems(
|
|
124
|
+
items: JsonSchema7['items'],
|
|
125
|
+
rootSchema: JsonSchema,
|
|
126
|
+
) {
|
|
127
|
+
return typeof items === 'object' &&
|
|
128
|
+
!Array.isArray(items) &&
|
|
129
|
+
typeof items.$ref === 'string'
|
|
130
|
+
? (resolveSchema(rootSchema, items.$ref, rootSchema) ?? items)
|
|
131
|
+
: items;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export const schemaForType = (
|
|
135
|
+
schema: JsonSchema,
|
|
136
|
+
type: JsonDataType,
|
|
137
|
+
rootSchema: JsonSchema,
|
|
138
|
+
): JsonSchema => {
|
|
139
|
+
const narrowed = narrowMixedComposition(schema, type);
|
|
140
|
+
const nextSchema: JsonSchema7 = {
|
|
141
|
+
...(typeof narrowed === 'object' ? (narrowed as JsonSchema7) : {}),
|
|
142
|
+
...(narrowed === (false as unknown) ? { not: {} } : {}),
|
|
143
|
+
type: typeof narrowed === 'object' ? (narrowed.type ?? type) : type,
|
|
144
|
+
};
|
|
145
|
+
removeInapplicableKeywords(nextSchema, type);
|
|
146
|
+
if (nextSchema.default !== undefined) {
|
|
147
|
+
const defaultType = getJsonDataType(nextSchema.default);
|
|
148
|
+
const compatibleDefault =
|
|
149
|
+
defaultType === type || (type === 'number' && defaultType === 'integer');
|
|
150
|
+
if (!compatibleDefault) delete nextSchema.default;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (type === 'object') {
|
|
154
|
+
nextSchema.additionalProperties = nextSchema.additionalProperties ?? true;
|
|
155
|
+
} else if (type === 'array') {
|
|
156
|
+
const items = resolveMixedArrayItems(nextSchema.items, rootSchema);
|
|
157
|
+
nextSchema.items =
|
|
158
|
+
items !== undefined
|
|
159
|
+
? (items as JsonSchema7 | JsonSchema7[])
|
|
160
|
+
: { type: ANY_TYPES as JsonSchema7['type'] };
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return nextSchema;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Whether the value at `path` is an element of an array.
|
|
168
|
+
*
|
|
169
|
+
* Read from the data rather than from the schema, because it is the data's
|
|
170
|
+
* shape that decides what unsetting the path will do: core deletes an array
|
|
171
|
+
* element in place and leaves a hole, whatever the schema says the container
|
|
172
|
+
* ought to be.
|
|
173
|
+
*/
|
|
174
|
+
export const isArrayElementPath = (data: unknown, path: string): boolean => {
|
|
175
|
+
if (!path) {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
const separator = path.lastIndexOf('.');
|
|
179
|
+
const parent =
|
|
180
|
+
separator < 0 ? data : get(data, path.slice(0, separator).split('.'));
|
|
181
|
+
return Array.isArray(parent);
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* The schema this control actually edits.
|
|
186
|
+
*
|
|
187
|
+
* A tester is handed the schema of the dispatch it sits in, which at the top of
|
|
188
|
+
* a form is the **root** - so a Control scoped at `#/properties/setting` is
|
|
189
|
+
* asked about the whole document, not about `setting`. The specification is
|
|
190
|
+
* explicit that selection is on "a Control with a **resolved** schema whose
|
|
191
|
+
* type is an array of permitted JSON types", so the scope is resolved first.
|
|
192
|
+
*
|
|
193
|
+
* Without this, a declared property with a union type never matched: the root
|
|
194
|
+
* carries `properties`, which the checks below reject, and the field fell
|
|
195
|
+
* through to the plain text control. A `["string", "number"]` property became a
|
|
196
|
+
* text box, and a number typed into it was stored as a string.
|
|
197
|
+
*/
|
|
198
|
+
const resolveScopedSchema = (
|
|
199
|
+
uischema: UISchemaElement & Scopable,
|
|
200
|
+
schema: JsonSchema,
|
|
201
|
+
context: TesterContext,
|
|
202
|
+
): JsonSchema => {
|
|
203
|
+
const scope = uischema?.scope;
|
|
204
|
+
if (!scope) {
|
|
205
|
+
return schema;
|
|
206
|
+
}
|
|
207
|
+
try {
|
|
208
|
+
return (
|
|
209
|
+
(resolveSchema(schema, scope, context?.rootSchema ?? schema) as
|
|
210
|
+
| JsonSchema
|
|
211
|
+
| undefined) ?? schema
|
|
212
|
+
);
|
|
213
|
+
} catch {
|
|
214
|
+
// An unresolvable scope is not this tester's problem to report.
|
|
215
|
+
return schema;
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
export const isMixedSchema = (
|
|
220
|
+
uischema: UISchemaElement & Scopable,
|
|
221
|
+
rawSchema: JsonSchema,
|
|
222
|
+
context: TesterContext,
|
|
223
|
+
) => {
|
|
224
|
+
if (rawSchema && typeof rawSchema === 'boolean') {
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (!rawSchema || typeof rawSchema !== 'object') {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const schema = resolveScopedSchema(uischema, rawSchema, context);
|
|
233
|
+
|
|
234
|
+
if (typeof schema === 'boolean') {
|
|
235
|
+
return Boolean(schema);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (Array.isArray(schema.type)) {
|
|
239
|
+
return schema.type.length > 1;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (
|
|
243
|
+
schema.allOf ||
|
|
244
|
+
schema.anyOf ||
|
|
245
|
+
schema.oneOf ||
|
|
246
|
+
schema.properties ||
|
|
247
|
+
schema.patternProperties ||
|
|
248
|
+
schema.additionalProperties !== undefined
|
|
249
|
+
) {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// An unconstrained schema: the specification admits it to this renderer, and
|
|
254
|
+
// nothing else would know what editor to offer.
|
|
255
|
+
if (schema.type === undefined && isControl(uischema)) {
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return false;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
export const isDefaultGeneratedUiSchema = (
|
|
263
|
+
uischema: UISchemaElement,
|
|
264
|
+
): boolean => {
|
|
265
|
+
const elements = (uischema as any)?.elements;
|
|
266
|
+
return (
|
|
267
|
+
(uischema.type === 'VerticalLayout' || uischema.type === 'Group') &&
|
|
268
|
+
Array.isArray(elements) &&
|
|
269
|
+
elements.length === 1 &&
|
|
270
|
+
elements[0].scope === '#' &&
|
|
271
|
+
elements[0].type === 'Control'
|
|
272
|
+
);
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
export const mixedControlFor =
|
|
276
|
+
(matchesSchema: typeof isMixedSchema) =>
|
|
277
|
+
(uischema: UISchemaElement, schema: JsonSchema, context: TesterContext) =>
|
|
278
|
+
matchesSchema(uischema as UISchemaElement & Scopable, schema, context) &&
|
|
279
|
+
(isControl(uischema) || isDefaultGeneratedUiSchema(uischema));
|
|
280
|
+
|
|
281
|
+
export const isMixedControl = mixedControlFor(isMixedSchema);
|
|
282
|
+
|
|
283
|
+
export const mixedControlTester: RankedTester = rankWith(20, isMixedControl);
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { JsonSchema, resolveSchema } from '@jsonforms/core';
|
|
2
|
+
|
|
3
|
+
export type MixedTreePath = Array<string | number>;
|
|
4
|
+
|
|
5
|
+
export interface MixedTreeNode {
|
|
6
|
+
named?: boolean;
|
|
7
|
+
children: MixedTreeNode[];
|
|
8
|
+
data: unknown;
|
|
9
|
+
dynamic: boolean;
|
|
10
|
+
label: string;
|
|
11
|
+
path: MixedTreePath;
|
|
12
|
+
schema: JsonSchema;
|
|
13
|
+
type: string | null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const mixedPathKey = (path: MixedTreePath) =>
|
|
17
|
+
path.length ? JSON.stringify(path) : '$';
|
|
18
|
+
|
|
19
|
+
export const mixedDataType = (value: unknown): string | null => {
|
|
20
|
+
if (value === null) return 'null';
|
|
21
|
+
if (Array.isArray(value)) return 'array';
|
|
22
|
+
if (typeof value === 'number')
|
|
23
|
+
return Number.isInteger(value) ? 'integer' : 'number';
|
|
24
|
+
return value === undefined ? null : typeof value;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const childSchema = (
|
|
28
|
+
schema: JsonSchema,
|
|
29
|
+
key: string | number,
|
|
30
|
+
rootSchema: JsonSchema,
|
|
31
|
+
): { dynamic: boolean; schema: JsonSchema } => {
|
|
32
|
+
const resolveChild = (candidate: JsonSchema): JsonSchema =>
|
|
33
|
+
typeof candidate === 'object' && candidate.$ref
|
|
34
|
+
? (resolveSchema(rootSchema, candidate.$ref, rootSchema) ?? candidate)
|
|
35
|
+
: candidate;
|
|
36
|
+
const resolved =
|
|
37
|
+
typeof schema === 'object' && schema.$ref
|
|
38
|
+
? (resolveSchema(rootSchema, schema.$ref, rootSchema) ?? schema)
|
|
39
|
+
: schema;
|
|
40
|
+
if (typeof resolved !== 'object') return { dynamic: false, schema: {} };
|
|
41
|
+
if (typeof key === 'number') {
|
|
42
|
+
const items = resolved.items;
|
|
43
|
+
return {
|
|
44
|
+
dynamic: false,
|
|
45
|
+
schema: resolveChild(
|
|
46
|
+
Array.isArray(items)
|
|
47
|
+
? (items[key] ?? {})
|
|
48
|
+
: ((items as JsonSchema | undefined) ?? {}),
|
|
49
|
+
),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (resolved.properties?.[key]) {
|
|
53
|
+
return {
|
|
54
|
+
dynamic: false,
|
|
55
|
+
schema: resolveChild(resolved.properties[key]),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const matches = Object.entries(resolved.patternProperties ?? {})
|
|
59
|
+
.filter(([pattern]) => {
|
|
60
|
+
try {
|
|
61
|
+
return new RegExp(pattern).test(key);
|
|
62
|
+
} catch {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
.map(([, value]) => resolveChild(value));
|
|
67
|
+
if (matches.length > 1) {
|
|
68
|
+
return { dynamic: true, schema: { allOf: matches } as JsonSchema };
|
|
69
|
+
}
|
|
70
|
+
if (matches.length === 1) {
|
|
71
|
+
return { dynamic: true, schema: matches[0] };
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
dynamic: true,
|
|
75
|
+
schema:
|
|
76
|
+
resolved.additionalProperties === false
|
|
77
|
+
? {}
|
|
78
|
+
: resolveChild(
|
|
79
|
+
(resolved.additionalProperties as JsonSchema | undefined) ?? {},
|
|
80
|
+
),
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const buildMixedTree = (
|
|
85
|
+
data: unknown,
|
|
86
|
+
schema: JsonSchema,
|
|
87
|
+
rootSchema: JsonSchema,
|
|
88
|
+
label = 'Value',
|
|
89
|
+
path: MixedTreePath = [],
|
|
90
|
+
dynamic = false,
|
|
91
|
+
): MixedTreeNode => {
|
|
92
|
+
const entries: Array<[string | number, unknown]> = Array.isArray(data)
|
|
93
|
+
? data.map((value, index) => [index, value])
|
|
94
|
+
: data && typeof data === 'object'
|
|
95
|
+
? Object.entries(data)
|
|
96
|
+
: [];
|
|
97
|
+
return {
|
|
98
|
+
children: entries.map(([key, value]) => {
|
|
99
|
+
const resolved = childSchema(schema, key, rootSchema);
|
|
100
|
+
return buildMixedTree(
|
|
101
|
+
value,
|
|
102
|
+
resolved.schema,
|
|
103
|
+
rootSchema,
|
|
104
|
+
typeof key === 'number' ? `Item ${key}` : key,
|
|
105
|
+
[...path, key],
|
|
106
|
+
resolved.dynamic,
|
|
107
|
+
);
|
|
108
|
+
}),
|
|
109
|
+
data,
|
|
110
|
+
dynamic,
|
|
111
|
+
label,
|
|
112
|
+
path,
|
|
113
|
+
schema,
|
|
114
|
+
type: mixedDataType(data),
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const findMixedTreeNode = (
|
|
119
|
+
node: MixedTreeNode,
|
|
120
|
+
path: MixedTreePath,
|
|
121
|
+
): MixedTreeNode | undefined => {
|
|
122
|
+
if (mixedPathKey(node.path) === mixedPathKey(path)) return node;
|
|
123
|
+
for (const child of node.children) {
|
|
124
|
+
const result = findMixedTreeNode(child, path);
|
|
125
|
+
if (result) return result;
|
|
126
|
+
}
|
|
127
|
+
return undefined;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const mixedTreeLabel = (node: MixedTreeNode) =>
|
|
131
|
+
node.path.length === 0 && !node.named
|
|
132
|
+
? node.type === 'array'
|
|
133
|
+
? '[]'
|
|
134
|
+
: node.type === 'object'
|
|
135
|
+
? '{}'
|
|
136
|
+
: node.label
|
|
137
|
+
: node.label;
|
|
138
|
+
|
|
139
|
+
const updateMixedParent = (
|
|
140
|
+
data: unknown,
|
|
141
|
+
parentPath: MixedTreePath,
|
|
142
|
+
update: (parent: unknown) => unknown,
|
|
143
|
+
): unknown => {
|
|
144
|
+
if (parentPath.length === 0) return update(data);
|
|
145
|
+
const [segment, ...remaining] = parentPath;
|
|
146
|
+
if (Array.isArray(data) && typeof segment === 'number') {
|
|
147
|
+
const next = [...data];
|
|
148
|
+
next[segment] = updateMixedParent(next[segment], remaining, update);
|
|
149
|
+
return next;
|
|
150
|
+
}
|
|
151
|
+
if (data && typeof data === 'object' && typeof segment === 'string') {
|
|
152
|
+
const next = { ...(data as Record<string, unknown>) };
|
|
153
|
+
next[segment] = updateMixedParent(next[segment], remaining, update);
|
|
154
|
+
return next;
|
|
155
|
+
}
|
|
156
|
+
return data;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const deleteMixedTreeNode = (
|
|
160
|
+
data: unknown,
|
|
161
|
+
path: MixedTreePath,
|
|
162
|
+
): unknown => {
|
|
163
|
+
if (path.length === 0) return data;
|
|
164
|
+
const parentPath = path.slice(0, -1);
|
|
165
|
+
const segment = path[path.length - 1];
|
|
166
|
+
return updateMixedParent(data, parentPath, (parent) => {
|
|
167
|
+
if (Array.isArray(parent) && typeof segment === 'number') {
|
|
168
|
+
return parent.filter((_, index) => index !== segment);
|
|
169
|
+
}
|
|
170
|
+
if (parent && typeof parent === 'object' && typeof segment === 'string') {
|
|
171
|
+
return Object.fromEntries(
|
|
172
|
+
Object.entries(parent).filter(([key]) => key !== segment),
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
return parent;
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export const renameMixedTreeNode = (
|
|
180
|
+
data: unknown,
|
|
181
|
+
path: MixedTreePath,
|
|
182
|
+
nextName: string,
|
|
183
|
+
): unknown => {
|
|
184
|
+
if (path.length === 0) return data;
|
|
185
|
+
const parentPath = path.slice(0, -1);
|
|
186
|
+
const segment = path[path.length - 1];
|
|
187
|
+
if (typeof segment !== 'string') return data;
|
|
188
|
+
return updateMixedParent(data, parentPath, (parent) => {
|
|
189
|
+
if (!parent || typeof parent !== 'object' || Array.isArray(parent)) {
|
|
190
|
+
return parent;
|
|
191
|
+
}
|
|
192
|
+
return Object.fromEntries(
|
|
193
|
+
Object.entries(parent).map(([key, value]) => [
|
|
194
|
+
key === segment ? nextName : key,
|
|
195
|
+
value,
|
|
196
|
+
]),
|
|
197
|
+
);
|
|
198
|
+
});
|
|
199
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { JsonSchema, JsonSchema7 } from '@jsonforms/core';
|
|
2
|
+
import { ANY_TYPES, schemaForType, type JsonDataType } from './mixedSchema';
|
|
3
|
+
import { findMixedTreeNode, type MixedTreeNode } from './mixedTree';
|
|
4
|
+
|
|
5
|
+
export const mixedParentNode = (
|
|
6
|
+
tree: MixedTreeNode | undefined,
|
|
7
|
+
node: MixedTreeNode,
|
|
8
|
+
) => (tree ? findMixedTreeNode(tree, node.path.slice(0, -1)) : undefined);
|
|
9
|
+
|
|
10
|
+
/** Respect collection bounds, required properties and renderer permissions. */
|
|
11
|
+
export const canDeleteMixedTreeNode = (
|
|
12
|
+
tree: MixedTreeNode | undefined,
|
|
13
|
+
node: MixedTreeNode,
|
|
14
|
+
rootSchema: JsonSchema,
|
|
15
|
+
enabled: boolean,
|
|
16
|
+
readonly: boolean | undefined,
|
|
17
|
+
restrict: boolean,
|
|
18
|
+
) => {
|
|
19
|
+
if (!enabled || readonly || node.path.length === 0) return false;
|
|
20
|
+
const parent = mixedParentNode(tree, node);
|
|
21
|
+
if (!parent) return false;
|
|
22
|
+
if (!restrict) return true;
|
|
23
|
+
const parentSchema = ANY_TYPES.includes(parent.type as JsonDataType)
|
|
24
|
+
? (schemaForType(
|
|
25
|
+
parent.schema,
|
|
26
|
+
parent.type as JsonDataType,
|
|
27
|
+
rootSchema,
|
|
28
|
+
) as JsonSchema7)
|
|
29
|
+
: (parent.schema as JsonSchema7);
|
|
30
|
+
if (Array.isArray(parent.data)) {
|
|
31
|
+
return (
|
|
32
|
+
parentSchema.minItems === undefined ||
|
|
33
|
+
parent.data.length > parentSchema.minItems
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
const key = node.path[node.path.length - 1];
|
|
37
|
+
if (
|
|
38
|
+
!parent.data ||
|
|
39
|
+
typeof parent.data !== 'object' ||
|
|
40
|
+
typeof key !== 'string'
|
|
41
|
+
)
|
|
42
|
+
return false;
|
|
43
|
+
if (parentSchema.required?.includes(key)) return false;
|
|
44
|
+
return (
|
|
45
|
+
parentSchema.minProperties === undefined ||
|
|
46
|
+
Object.keys(parent.data).length > parentSchema.minProperties
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const canRenameMixedTreeNode = (
|
|
51
|
+
node: MixedTreeNode,
|
|
52
|
+
enabled: boolean,
|
|
53
|
+
readonly: boolean | undefined,
|
|
54
|
+
) =>
|
|
55
|
+
Boolean(
|
|
56
|
+
enabled &&
|
|
57
|
+
!readonly &&
|
|
58
|
+
node.dynamic &&
|
|
59
|
+
typeof node.path[node.path.length - 1] === 'string',
|
|
60
|
+
);
|