@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,173 @@
|
|
|
1
|
+
import { retainDynamicPresentation } from '../dynamic/dynamicTree';
|
|
2
|
+
import { JsonSchema, Resolve, UISchemaElement } from '@jsonforms/core';
|
|
3
|
+
import type Ajv from 'ajv';
|
|
4
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
import { useJsonForms } from '@jsonforms/react';
|
|
7
|
+
import { literalPropertySchema } from './literalPropertySchema';
|
|
8
|
+
|
|
9
|
+
export const conditionalFieldsEnabled = (ui: any, config: any): boolean =>
|
|
10
|
+
(ui.options?.conditionalFields ??
|
|
11
|
+
config?.jsonformsExtended?.conditionalFields) === true;
|
|
12
|
+
|
|
13
|
+
export const hasConditionalFields = (
|
|
14
|
+
schema: any,
|
|
15
|
+
seen = new Set<any>(),
|
|
16
|
+
): boolean => {
|
|
17
|
+
if (!schema || typeof schema !== 'object' || seen.has(schema)) return false;
|
|
18
|
+
seen.add(schema);
|
|
19
|
+
return (
|
|
20
|
+
(schema.if !== undefined &&
|
|
21
|
+
(schema.then !== undefined || schema.else !== undefined)) ||
|
|
22
|
+
Object.keys(schema.dependencies ?? {}).length > 0 ||
|
|
23
|
+
(schema.allOf ?? []).some((part: any) => hasConditionalFields(part, seen))
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const validators = new WeakMap<
|
|
28
|
+
Ajv,
|
|
29
|
+
WeakMap<object, WeakMap<object, ReturnType<Ajv['compile']>>>
|
|
30
|
+
>();
|
|
31
|
+
const evaluate = (
|
|
32
|
+
ajv: Ajv,
|
|
33
|
+
condition: any,
|
|
34
|
+
root: JsonSchema,
|
|
35
|
+
data: unknown,
|
|
36
|
+
) => {
|
|
37
|
+
if (typeof condition === 'boolean') return condition;
|
|
38
|
+
let roots = validators.get(ajv);
|
|
39
|
+
if (!roots) validators.set(ajv, (roots = new WeakMap()));
|
|
40
|
+
let conditions = roots.get(root);
|
|
41
|
+
if (!conditions) roots.set(root, (conditions = new WeakMap()));
|
|
42
|
+
let validate = conditions.get(condition);
|
|
43
|
+
if (!validate) {
|
|
44
|
+
validate = ajv.compile(literalPropertySchema(condition, root));
|
|
45
|
+
conditions.set(condition, validate);
|
|
46
|
+
}
|
|
47
|
+
return Boolean(validate(cloneDeep(data)));
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** Presentation projection only. The host still validates the original schema. */
|
|
51
|
+
export const projectConditionalFields = (
|
|
52
|
+
schema: JsonSchema,
|
|
53
|
+
rootSchema: JsonSchema,
|
|
54
|
+
data: unknown,
|
|
55
|
+
ajv: Ajv,
|
|
56
|
+
) => {
|
|
57
|
+
const properties: Record<string, any> = Object.create(null);
|
|
58
|
+
const known = new Set<string>();
|
|
59
|
+
const required = new Set<string>();
|
|
60
|
+
const diagnostics: string[] = [];
|
|
61
|
+
const seen = new Set<any>();
|
|
62
|
+
const visit = (input: any, active: boolean) => {
|
|
63
|
+
if (!input || typeof input !== 'object' || seen.has(input)) return;
|
|
64
|
+
seen.add(input);
|
|
65
|
+
if (input.$ref) {
|
|
66
|
+
try {
|
|
67
|
+
visit(Resolve.schema(rootSchema, input.$ref, rootSchema), active);
|
|
68
|
+
} catch {
|
|
69
|
+
diagnostics.push(
|
|
70
|
+
'A conditional schema reference could not be resolved.',
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
for (const [key, value] of Object.entries(input.properties ?? {})) {
|
|
75
|
+
known.add(key);
|
|
76
|
+
if (active) {
|
|
77
|
+
const previous = properties[key];
|
|
78
|
+
// Preserve every constraint; top-level annotations guide editor selection.
|
|
79
|
+
properties[key] =
|
|
80
|
+
previous === undefined
|
|
81
|
+
? value
|
|
82
|
+
: {
|
|
83
|
+
...(typeof previous === 'object' ? previous : {}),
|
|
84
|
+
...(typeof value === 'object' ? value : {}),
|
|
85
|
+
allOf: [previous, value],
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (active) for (const key of input.required ?? []) required.add(key);
|
|
90
|
+
for (const part of input.allOf ?? []) visit(part, active);
|
|
91
|
+
if (input.if !== undefined) {
|
|
92
|
+
let matches: boolean | undefined;
|
|
93
|
+
if (active) {
|
|
94
|
+
try {
|
|
95
|
+
matches = evaluate(ajv, input.if, rootSchema, data);
|
|
96
|
+
} catch {
|
|
97
|
+
diagnostics.push(
|
|
98
|
+
'A conditional field condition could not be evaluated.',
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
visit(input.then, active && matches === true);
|
|
103
|
+
visit(input.else, active && matches === false);
|
|
104
|
+
}
|
|
105
|
+
for (const [key, dependency] of Object.entries(input.dependencies ?? {})) {
|
|
106
|
+
const present =
|
|
107
|
+
active &&
|
|
108
|
+
data !== null &&
|
|
109
|
+
typeof data === 'object' &&
|
|
110
|
+
Object.prototype.hasOwnProperty.call(data, key);
|
|
111
|
+
if (Array.isArray(dependency)) {
|
|
112
|
+
if (present) for (const field of dependency) required.add(field);
|
|
113
|
+
} else visit(dependency, present);
|
|
114
|
+
}
|
|
115
|
+
seen.delete(input);
|
|
116
|
+
};
|
|
117
|
+
visit(schema, true);
|
|
118
|
+
const projected = { ...schema, properties, required: [...required] } as any;
|
|
119
|
+
// These have already contributed to this object's presentation. Retaining them
|
|
120
|
+
// here would redispatch the same branch or duplicate its fields.
|
|
121
|
+
for (const key of ['$ref', 'if', 'then', 'else', 'dependencies', 'allOf'])
|
|
122
|
+
delete projected[key];
|
|
123
|
+
return { schema: projected as JsonSchema, known, diagnostics };
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export const useConditionalFields = (
|
|
127
|
+
schema: JsonSchema,
|
|
128
|
+
root: JsonSchema,
|
|
129
|
+
data: unknown,
|
|
130
|
+
ui: any,
|
|
131
|
+
config: any,
|
|
132
|
+
) => {
|
|
133
|
+
const context = useJsonForms();
|
|
134
|
+
const ajv = context.core?.ajv;
|
|
135
|
+
const enabled =
|
|
136
|
+
conditionalFieldsEnabled(ui, config) && hasConditionalFields(schema);
|
|
137
|
+
return useMemo(
|
|
138
|
+
() =>
|
|
139
|
+
enabled && ajv
|
|
140
|
+
? projectConditionalFields(schema, root, data, ajv)
|
|
141
|
+
: { schema, known: new Set<string>(), diagnostics: [] as string[] },
|
|
142
|
+
[enabled, schema, root, data, ajv],
|
|
143
|
+
);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
/** Explicit details retain authored order and groups. Only inactive branch-only
|
|
147
|
+
* bindings are omitted; base fields stay visible even if conditionally required. */
|
|
148
|
+
export const conditionalLayout = (
|
|
149
|
+
ui: UISchemaElement,
|
|
150
|
+
schema: JsonSchema,
|
|
151
|
+
known: Set<string>,
|
|
152
|
+
): UISchemaElement => {
|
|
153
|
+
if (known.size === 0) return ui;
|
|
154
|
+
const visit = (element: any): any => {
|
|
155
|
+
const key =
|
|
156
|
+
element.type === 'Control' &&
|
|
157
|
+
/^#\/properties\/([^/]*)(?:\/|$)/.exec(element.scope ?? '');
|
|
158
|
+
const name = key?.[1]?.replace(/~1/g, '/').replace(/~0/g, '~');
|
|
159
|
+
if (
|
|
160
|
+
name !== undefined &&
|
|
161
|
+
known.has(name) &&
|
|
162
|
+
!Object.prototype.hasOwnProperty.call(schema.properties ?? {}, name)
|
|
163
|
+
)
|
|
164
|
+
return undefined;
|
|
165
|
+
return Array.isArray(element.elements)
|
|
166
|
+
? retainDynamicPresentation(element, {
|
|
167
|
+
...element,
|
|
168
|
+
elements: element.elements.map(visit).filter(Boolean),
|
|
169
|
+
})
|
|
170
|
+
: element;
|
|
171
|
+
};
|
|
172
|
+
return visit(ui) ?? { type: 'VerticalLayout', elements: [] };
|
|
173
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { createDefaultValue, JsonSchema, UPDATE_DATA } from '@jsonforms/core';
|
|
2
|
+
import { JsonFormsContext, useJsonForms } from '@jsonforms/react';
|
|
3
|
+
|
|
4
|
+
import React, { createContext, useContext, useMemo } from 'react';
|
|
5
|
+
|
|
6
|
+
const DynamicPropertyPath = createContext<string | undefined>(undefined);
|
|
7
|
+
|
|
8
|
+
export const DynamicPropertyProvider = ({
|
|
9
|
+
path,
|
|
10
|
+
schema,
|
|
11
|
+
rootSchema,
|
|
12
|
+
children,
|
|
13
|
+
}: React.PropsWithChildren<{
|
|
14
|
+
path: string;
|
|
15
|
+
schema?: JsonSchema;
|
|
16
|
+
rootSchema?: JsonSchema;
|
|
17
|
+
}>) => {
|
|
18
|
+
const parent = useJsonForms();
|
|
19
|
+
const context = useMemo(
|
|
20
|
+
() => ({
|
|
21
|
+
...parent,
|
|
22
|
+
dispatch: (
|
|
23
|
+
action: Parameters<NonNullable<typeof parent.dispatch>>[0],
|
|
24
|
+
) => {
|
|
25
|
+
// Protect only this property's own value. Nested fields and the
|
|
26
|
+
// collection's explicit Delete update their respective paths normally.
|
|
27
|
+
if (schema && action.type === UPDATE_DATA && action.path === path) {
|
|
28
|
+
parent.dispatch?.({
|
|
29
|
+
...action,
|
|
30
|
+
updater: (previous) => {
|
|
31
|
+
const value = action.updater(previous);
|
|
32
|
+
return value === undefined
|
|
33
|
+
? clearedDynamicPropertyValue(
|
|
34
|
+
schema,
|
|
35
|
+
rootSchema ?? schema,
|
|
36
|
+
previous,
|
|
37
|
+
)
|
|
38
|
+
: value;
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
} else {
|
|
42
|
+
parent.dispatch?.(action);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
46
|
+
[parent, path, schema, rootSchema],
|
|
47
|
+
);
|
|
48
|
+
return (
|
|
49
|
+
<DynamicPropertyPath.Provider value={path}>
|
|
50
|
+
<JsonFormsContext.Provider value={schema ? context : parent}>
|
|
51
|
+
{children}
|
|
52
|
+
</JsonFormsContext.Provider>
|
|
53
|
+
</DynamicPropertyPath.Provider>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/** Only the property itself is protected; its nested fields clear normally. */
|
|
58
|
+
export const useDynamicProperty = (path: string): boolean =>
|
|
59
|
+
useContext(DynamicPropertyPath) === path;
|
|
60
|
+
|
|
61
|
+
export const clearedDynamicPropertyValue = (
|
|
62
|
+
schema: JsonSchema,
|
|
63
|
+
rootSchema: JsonSchema,
|
|
64
|
+
previous?: unknown,
|
|
65
|
+
): unknown =>
|
|
66
|
+
schema.type === 'string' || typeof previous === 'string'
|
|
67
|
+
? ''
|
|
68
|
+
: (createDefaultValue(schema, rootSchema) ?? previous);
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { JsonSchema, JsonSchema7 } from '@jsonforms/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Rebundles a property's schema so it can stand alone as its own document.
|
|
5
|
+
*
|
|
6
|
+
* An isolated editor gives the property's *value* its own form, which means its
|
|
7
|
+
* own root schema - and that breaks every local `$ref`. A schema saying
|
|
8
|
+
* `{ "$ref": "#/definitions/address" }` resolves against the document it came
|
|
9
|
+
* from; in a form rooted at the value there is no such definition, so the
|
|
10
|
+
* control fails to resolve and renders nothing.
|
|
11
|
+
*
|
|
12
|
+
* So the original root is carried along under
|
|
13
|
+
* `definitions.__jsonforms_root`, and every local reference is rewritten to
|
|
14
|
+
* point into it. `#/definitions/address` becomes
|
|
15
|
+
* `#/definitions/__jsonforms_root/definitions/address`, and a bare `#` becomes
|
|
16
|
+
* `#/definitions/__jsonforms_root`.
|
|
17
|
+
*
|
|
18
|
+
* Only schema *keywords* are walked. `default`, `const` and `enum` hold data,
|
|
19
|
+
* and data is allowed to contain a `$ref` key that means nothing to a
|
|
20
|
+
* validator - rewriting it would corrupt a value.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const SCHEMA_MAPS = new Set([
|
|
24
|
+
'properties',
|
|
25
|
+
'patternProperties',
|
|
26
|
+
'definitions',
|
|
27
|
+
'$defs',
|
|
28
|
+
'dependentSchemas',
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
const SCHEMA_VALUES = new Set([
|
|
32
|
+
'additionalProperties',
|
|
33
|
+
'additionalItems',
|
|
34
|
+
'contains',
|
|
35
|
+
'propertyNames',
|
|
36
|
+
'not',
|
|
37
|
+
'if',
|
|
38
|
+
'then',
|
|
39
|
+
'else',
|
|
40
|
+
'unevaluatedProperties',
|
|
41
|
+
'unevaluatedItems',
|
|
42
|
+
]);
|
|
43
|
+
|
|
44
|
+
const SCHEMA_ARRAYS = new Set(['allOf', 'anyOf', 'oneOf', 'prefixItems']);
|
|
45
|
+
|
|
46
|
+
const ROOT_POINTER = '#/definitions/__jsonforms_root';
|
|
47
|
+
|
|
48
|
+
const rewrite = (input: unknown): unknown => {
|
|
49
|
+
if (!input || typeof input !== 'object' || Array.isArray(input)) {
|
|
50
|
+
return input;
|
|
51
|
+
}
|
|
52
|
+
const source = input as Record<string, unknown>;
|
|
53
|
+
return Object.fromEntries(
|
|
54
|
+
Object.entries(source).map(([key, value]) => {
|
|
55
|
+
if (
|
|
56
|
+
key === '$ref' &&
|
|
57
|
+
typeof value === 'string' &&
|
|
58
|
+
(value === '#' || value.startsWith('#/'))
|
|
59
|
+
) {
|
|
60
|
+
return [key, `${ROOT_POINTER}${value.slice(1)}`];
|
|
61
|
+
}
|
|
62
|
+
if (SCHEMA_MAPS.has(key) || key === 'dependencies') {
|
|
63
|
+
return [
|
|
64
|
+
key,
|
|
65
|
+
Object.fromEntries(
|
|
66
|
+
Object.entries((value ?? {}) as Record<string, unknown>).map(
|
|
67
|
+
([name, child]) => [name, rewrite(child)],
|
|
68
|
+
),
|
|
69
|
+
),
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
if (SCHEMA_VALUES.has(key)) {
|
|
73
|
+
return [key, rewrite(value)];
|
|
74
|
+
}
|
|
75
|
+
if (SCHEMA_ARRAYS.has(key) || key === 'items') {
|
|
76
|
+
return [
|
|
77
|
+
key,
|
|
78
|
+
Array.isArray(value) ? value.map(rewrite) : rewrite(value),
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
return [key, value];
|
|
82
|
+
}),
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const literalPropertySchema = (
|
|
87
|
+
schema: JsonSchema,
|
|
88
|
+
rootSchema: JsonSchema,
|
|
89
|
+
): JsonSchema => {
|
|
90
|
+
const root = rewrite(rootSchema) as JsonSchema7;
|
|
91
|
+
// The bundled root is part of this document now, not a separate reference
|
|
92
|
+
// scope, so its own identifier must not follow it in.
|
|
93
|
+
delete root.$id;
|
|
94
|
+
const value = rewrite(schema) as JsonSchema7;
|
|
95
|
+
delete value.$id;
|
|
96
|
+
return {
|
|
97
|
+
...value,
|
|
98
|
+
definitions: { ...value.definitions, __jsonforms_root: root },
|
|
99
|
+
} as JsonSchema;
|
|
100
|
+
};
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
createDefaultValue,
|
|
4
|
+
type ControlElement,
|
|
5
|
+
type JsonSchema,
|
|
6
|
+
type JsonFormsCellRendererRegistryEntry,
|
|
7
|
+
type JsonFormsRendererRegistryEntry,
|
|
8
|
+
type JsonFormsUISchemaRegistryEntry,
|
|
9
|
+
} from '@jsonforms/core';
|
|
10
|
+
import { useCollectionDelete } from '../collections/useCollectionDelete';
|
|
11
|
+
import { assignOwnProperty } from './additionalPropertyName';
|
|
12
|
+
|
|
13
|
+
import { useCollectionPagination } from '../collections/collectionPagination';
|
|
14
|
+
import {
|
|
15
|
+
hasAdditionalProperties,
|
|
16
|
+
toAdditionalPropertyItem,
|
|
17
|
+
toObjectSchema,
|
|
18
|
+
} from './additionalProperties';
|
|
19
|
+
|
|
20
|
+
export type AdditionalPropertiesProps = {
|
|
21
|
+
cells?: JsonFormsCellRendererRegistryEntry[];
|
|
22
|
+
config?: any;
|
|
23
|
+
data: unknown;
|
|
24
|
+
enabled: boolean;
|
|
25
|
+
handleChange(path: string, value: unknown): void;
|
|
26
|
+
label: string;
|
|
27
|
+
path: string;
|
|
28
|
+
readonly?: boolean;
|
|
29
|
+
renderers?: JsonFormsRendererRegistryEntry[];
|
|
30
|
+
rootSchema: JsonSchema;
|
|
31
|
+
schema: JsonSchema;
|
|
32
|
+
uischema: ControlElement;
|
|
33
|
+
uischemas?: JsonFormsUISchemaRegistryEntry[];
|
|
34
|
+
embedded?: boolean;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
type AdditionalPropertyEntriesInput = Pick<
|
|
38
|
+
AdditionalPropertiesProps,
|
|
39
|
+
'data' | 'schema' | 'rootSchema' | 'path' | 'uischema' | 'config'
|
|
40
|
+
>;
|
|
41
|
+
|
|
42
|
+
/** Shared property discovery and pagination; renderers own editors and actions. */
|
|
43
|
+
export const useAdditionalPropertyItems = ({
|
|
44
|
+
data,
|
|
45
|
+
schema,
|
|
46
|
+
rootSchema,
|
|
47
|
+
path,
|
|
48
|
+
uischema,
|
|
49
|
+
config,
|
|
50
|
+
}: AdditionalPropertyEntriesInput) => {
|
|
51
|
+
const objectSchema = toObjectSchema(schema);
|
|
52
|
+
const appliedOptions = { ...config, ...uischema.options };
|
|
53
|
+
const objectData =
|
|
54
|
+
typeof data === 'object' && data !== null && !Array.isArray(data)
|
|
55
|
+
? (data as Record<string, unknown>)
|
|
56
|
+
: undefined;
|
|
57
|
+
const allowIfMissing =
|
|
58
|
+
appliedOptions.allowAdditionalPropertiesIfMissing === true &&
|
|
59
|
+
objectSchema.additionalProperties === undefined;
|
|
60
|
+
const reservedPropertyNames = Object.keys(objectSchema.properties ?? {});
|
|
61
|
+
const additionalKeys = Object.keys(objectData ?? {}).filter(
|
|
62
|
+
(key) => !reservedPropertyNames.includes(key),
|
|
63
|
+
);
|
|
64
|
+
const additionalKeySnapshot = JSON.stringify(additionalKeys);
|
|
65
|
+
const additionalPropertyItems = useMemo(
|
|
66
|
+
() =>
|
|
67
|
+
(JSON.parse(additionalKeySnapshot) as string[]).map((propertyName) =>
|
|
68
|
+
toAdditionalPropertyItem(
|
|
69
|
+
propertyName,
|
|
70
|
+
path,
|
|
71
|
+
schema,
|
|
72
|
+
rootSchema,
|
|
73
|
+
allowIfMissing,
|
|
74
|
+
),
|
|
75
|
+
),
|
|
76
|
+
[additionalKeySnapshot, allowIfMissing, path, rootSchema, schema],
|
|
77
|
+
);
|
|
78
|
+
const shouldShow =
|
|
79
|
+
hasAdditionalProperties(schema) ||
|
|
80
|
+
allowIfMissing ||
|
|
81
|
+
additionalKeys.length > 0;
|
|
82
|
+
const count = Object.keys(objectData ?? {}).length;
|
|
83
|
+
const maxPropertiesReached =
|
|
84
|
+
objectSchema.maxProperties !== undefined &&
|
|
85
|
+
count >= objectSchema.maxProperties &&
|
|
86
|
+
Boolean(objectData);
|
|
87
|
+
const minPropertiesReached =
|
|
88
|
+
objectSchema.minProperties !== undefined &&
|
|
89
|
+
count <= objectSchema.minProperties &&
|
|
90
|
+
Boolean(objectData);
|
|
91
|
+
return {
|
|
92
|
+
maxPropertiesReached,
|
|
93
|
+
minPropertiesReached,
|
|
94
|
+
objectSchema,
|
|
95
|
+
appliedOptions,
|
|
96
|
+
objectData,
|
|
97
|
+
allowIfMissing,
|
|
98
|
+
reservedPropertyNames,
|
|
99
|
+
additionalKeys,
|
|
100
|
+
additionalPropertyItems,
|
|
101
|
+
shouldShow,
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const useAdditionalPropertyEntries = (
|
|
106
|
+
input: AdditionalPropertyEntriesInput,
|
|
107
|
+
) => {
|
|
108
|
+
const items = useAdditionalPropertyItems(input);
|
|
109
|
+
const page = useCollectionPagination(
|
|
110
|
+
items.additionalKeys,
|
|
111
|
+
input.uischema.options?.additionalProperties?.pagination,
|
|
112
|
+
input.config,
|
|
113
|
+
'additionalProperties',
|
|
114
|
+
);
|
|
115
|
+
return { ...items, page };
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export function useAdditionalPropertyActions(
|
|
119
|
+
props: AdditionalPropertiesProps,
|
|
120
|
+
entries: ReturnType<typeof useAdditionalPropertyEntries>,
|
|
121
|
+
{
|
|
122
|
+
restrict,
|
|
123
|
+
propertyName,
|
|
124
|
+
propertyNameError,
|
|
125
|
+
setNewPropertyName,
|
|
126
|
+
}: {
|
|
127
|
+
restrict: boolean;
|
|
128
|
+
propertyName: string;
|
|
129
|
+
propertyNameError?: string;
|
|
130
|
+
setNewPropertyName: (name: string) => void;
|
|
131
|
+
},
|
|
132
|
+
) {
|
|
133
|
+
const {
|
|
134
|
+
enabled,
|
|
135
|
+
readonly,
|
|
136
|
+
path,
|
|
137
|
+
rootSchema,
|
|
138
|
+
schema,
|
|
139
|
+
uischema,
|
|
140
|
+
config,
|
|
141
|
+
handleChange,
|
|
142
|
+
} = props;
|
|
143
|
+
const {
|
|
144
|
+
objectData,
|
|
145
|
+
objectSchema,
|
|
146
|
+
reservedPropertyNames,
|
|
147
|
+
appliedOptions,
|
|
148
|
+
allowIfMissing,
|
|
149
|
+
} = entries;
|
|
150
|
+
const addDisabled =
|
|
151
|
+
!enabled || Boolean(readonly) || (restrict && entries.maxPropertiesReached);
|
|
152
|
+
const removePropertyDisabled =
|
|
153
|
+
!enabled || Boolean(readonly) || (restrict && entries.minPropertiesReached);
|
|
154
|
+
const deletion = useCollectionDelete<string>({
|
|
155
|
+
data: objectData,
|
|
156
|
+
identity: path,
|
|
157
|
+
catalogId: 'additionalProperties',
|
|
158
|
+
options: uischema.options,
|
|
159
|
+
config,
|
|
160
|
+
canRemove: (key) =>
|
|
161
|
+
!removePropertyDisabled &&
|
|
162
|
+
!appliedOptions.disableRemove &&
|
|
163
|
+
!!objectData &&
|
|
164
|
+
Object.prototype.hasOwnProperty.call(objectData, key) &&
|
|
165
|
+
!reservedPropertyNames.includes(key) &&
|
|
166
|
+
!(
|
|
167
|
+
appliedOptions.restrict !== false &&
|
|
168
|
+
objectSchema.required?.includes(key)
|
|
169
|
+
),
|
|
170
|
+
value: (key) => objectData?.[key],
|
|
171
|
+
remove: (key) => {
|
|
172
|
+
const updatedData = { ...objectData };
|
|
173
|
+
delete updatedData[key];
|
|
174
|
+
handleChange(path, updatedData);
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
const addPropertyDisabled = addDisabled || Boolean(propertyNameError);
|
|
178
|
+
function addProperty() {
|
|
179
|
+
if (addPropertyDisabled) return;
|
|
180
|
+
const item = toAdditionalPropertyItem(
|
|
181
|
+
propertyName,
|
|
182
|
+
path,
|
|
183
|
+
schema,
|
|
184
|
+
rootSchema,
|
|
185
|
+
allowIfMissing,
|
|
186
|
+
);
|
|
187
|
+
handleChange(
|
|
188
|
+
path,
|
|
189
|
+
assignOwnProperty(
|
|
190
|
+
{ ...objectData },
|
|
191
|
+
propertyName,
|
|
192
|
+
createDefaultValue(item.schema, rootSchema),
|
|
193
|
+
),
|
|
194
|
+
);
|
|
195
|
+
setNewPropertyName('');
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
addPropertyDisabled,
|
|
199
|
+
removePropertyDisabled,
|
|
200
|
+
deletion,
|
|
201
|
+
addProperty,
|
|
202
|
+
removeProperty: deletion.request,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type {
|
|
3
|
+
ControlElement,
|
|
4
|
+
JsonSchema,
|
|
5
|
+
StatePropsOfControlWithDetail,
|
|
6
|
+
} from '@jsonforms/core';
|
|
7
|
+
import {
|
|
8
|
+
JsonFormsDispatch,
|
|
9
|
+
type JsonFormsStateContext,
|
|
10
|
+
ctxDispatchToControlProps,
|
|
11
|
+
ctxToControlWithDetailProps,
|
|
12
|
+
withJsonFormsContext,
|
|
13
|
+
} from '@jsonforms/react';
|
|
14
|
+
import {
|
|
15
|
+
TuplePositionContext,
|
|
16
|
+
tuplePositionEntry,
|
|
17
|
+
type useTupleControl,
|
|
18
|
+
} from './useTupleControl';
|
|
19
|
+
import { tupleRenderSchema } from './tupleSchema';
|
|
20
|
+
import type { TupleAdditionalItemsProps } from './useTupleAdditionalItems';
|
|
21
|
+
import type { TupleFieldProps } from './TupleField';
|
|
22
|
+
export type TupleControlProps = StatePropsOfControlWithDetail & {
|
|
23
|
+
handleChange: (path: string, value: unknown) => void;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export function TupleControlContent({
|
|
27
|
+
props,
|
|
28
|
+
model,
|
|
29
|
+
TupleField,
|
|
30
|
+
TupleAdditionalItems,
|
|
31
|
+
diagnostic,
|
|
32
|
+
gap,
|
|
33
|
+
}: {
|
|
34
|
+
props: TupleControlProps;
|
|
35
|
+
model: ReturnType<typeof useTupleControl>;
|
|
36
|
+
TupleField: React.ComponentType<TupleFieldProps>;
|
|
37
|
+
TupleAdditionalItems: React.ComponentType<TupleAdditionalItemsProps>;
|
|
38
|
+
diagnostic: (message: string) => React.ReactNode;
|
|
39
|
+
gap: number;
|
|
40
|
+
}) {
|
|
41
|
+
const { path, rootSchema, schema } = props;
|
|
42
|
+
const {
|
|
43
|
+
t,
|
|
44
|
+
options,
|
|
45
|
+
vertical,
|
|
46
|
+
definition,
|
|
47
|
+
values,
|
|
48
|
+
editable,
|
|
49
|
+
positionLabel,
|
|
50
|
+
fieldSchema,
|
|
51
|
+
fieldUiSchema,
|
|
52
|
+
positionLayout,
|
|
53
|
+
} = model;
|
|
54
|
+
const field = (index: number) => (
|
|
55
|
+
<TupleField
|
|
56
|
+
key={index}
|
|
57
|
+
schema={fieldSchema(index)}
|
|
58
|
+
prefix={definition?.prefix ?? []}
|
|
59
|
+
index={index}
|
|
60
|
+
arrayPath={path}
|
|
61
|
+
rootSchema={rootSchema}
|
|
62
|
+
uischema={fieldUiSchema(index)}
|
|
63
|
+
enabled={editable}
|
|
64
|
+
options={options}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
if (!definition) return <>{diagnostic(t('tuple.configuration'))}</>;
|
|
69
|
+
return (
|
|
70
|
+
<>
|
|
71
|
+
{positionLayout ? (
|
|
72
|
+
<div data-tuple-fields data-tuple-layout>
|
|
73
|
+
<TuplePositionContext.Provider
|
|
74
|
+
value={{
|
|
75
|
+
count: definition.prefix.length,
|
|
76
|
+
render: field,
|
|
77
|
+
renderWithin: (index, scope) => (
|
|
78
|
+
<JsonFormsDispatch
|
|
79
|
+
schema={tupleRenderSchema(fieldSchema(index)) as JsonSchema}
|
|
80
|
+
uischema={{ type: 'Control', scope } as ControlElement}
|
|
81
|
+
path={`${path}.${index}`}
|
|
82
|
+
renderers={props.renderers}
|
|
83
|
+
cells={props.cells}
|
|
84
|
+
enabled={editable}
|
|
85
|
+
/>
|
|
86
|
+
),
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
<JsonFormsDispatch
|
|
90
|
+
schema={schema as JsonSchema}
|
|
91
|
+
uischema={positionLayout}
|
|
92
|
+
path={path}
|
|
93
|
+
renderers={[...(props.renderers ?? []), tuplePositionEntry]}
|
|
94
|
+
cells={props.cells}
|
|
95
|
+
enabled={editable}
|
|
96
|
+
/>
|
|
97
|
+
</TuplePositionContext.Provider>
|
|
98
|
+
</div>
|
|
99
|
+
) : (
|
|
100
|
+
<div
|
|
101
|
+
data-tuple-fields
|
|
102
|
+
style={{
|
|
103
|
+
display: 'flex',
|
|
104
|
+
flexDirection: vertical ? 'column' : 'row',
|
|
105
|
+
flexWrap: vertical ? 'nowrap' : 'wrap',
|
|
106
|
+
gap,
|
|
107
|
+
alignItems: vertical ? 'stretch' : 'flex-start',
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
110
|
+
{definition.prefix.map((_, index) => field(index))}
|
|
111
|
+
</div>
|
|
112
|
+
)}
|
|
113
|
+
{(definition.tail !== false ||
|
|
114
|
+
values.length > definition.prefix.length) && (
|
|
115
|
+
<TupleAdditionalItems
|
|
116
|
+
definition={definition}
|
|
117
|
+
config={props.config}
|
|
118
|
+
path={path}
|
|
119
|
+
data={values}
|
|
120
|
+
schema={schema}
|
|
121
|
+
rootSchema={rootSchema}
|
|
122
|
+
options={options}
|
|
123
|
+
enabled={editable}
|
|
124
|
+
onChange={(next) => props.handleChange(path, next)}
|
|
125
|
+
renderItem={field}
|
|
126
|
+
positionLabel={positionLabel}
|
|
127
|
+
/>
|
|
128
|
+
)}
|
|
129
|
+
</>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
const withTupleProps = (Component: React.ComponentType<TupleControlProps>) =>
|
|
133
|
+
function WithTupleProps({
|
|
134
|
+
ctx,
|
|
135
|
+
props,
|
|
136
|
+
}: {
|
|
137
|
+
ctx: JsonFormsStateContext;
|
|
138
|
+
props: any;
|
|
139
|
+
}) {
|
|
140
|
+
if (!ctx.dispatch) return null;
|
|
141
|
+
return (
|
|
142
|
+
<Component
|
|
143
|
+
{...props}
|
|
144
|
+
{...ctxToControlWithDetailProps(ctx, props)}
|
|
145
|
+
{...ctxDispatchToControlProps(ctx.dispatch)}
|
|
146
|
+
/>
|
|
147
|
+
);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export const connectTupleControl = (
|
|
151
|
+
Component: React.ComponentType<TupleControlProps>,
|
|
152
|
+
) => withJsonFormsContext(withTupleProps(React.memo(Component)) as any);
|