@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,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ControlProps } from '@jsonforms/core';
|
|
3
|
+
import { type MixedTreeNode } from './mixedTree';
|
|
4
|
+
import { type useMixedRenderer } from './useMixedRenderer';
|
|
5
|
+
type MixedRendererState = ReturnType<typeof useMixedRenderer>;
|
|
6
|
+
type MixedDetailProps = Pick<ControlProps, 'path' | 'enabled' | 'readonly' | 'renderers' | 'cells'> & Pick<MixedRendererState, 'detailUiSchema' | 'withoutControlLabel'>;
|
|
7
|
+
export declare function MixedNodeControl({ node, path, enabled, readonly, renderers, cells, detailUiSchema, withoutControlLabel, rootSchema, handleChange, MixedTypeSelector, wrapStructured, }: MixedDetailProps & Pick<ControlProps, 'rootSchema' | 'handleChange'> & {
|
|
8
|
+
node?: MixedTreeNode;
|
|
9
|
+
MixedTypeSelector: React.ComponentType<{
|
|
10
|
+
clearable: boolean;
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
types: string[];
|
|
13
|
+
value: string | null;
|
|
14
|
+
onChange: (value: string | undefined) => void;
|
|
15
|
+
}>;
|
|
16
|
+
wrapStructured: (children: React.ReactNode) => React.ReactElement;
|
|
17
|
+
}): React.JSX.Element | null;
|
|
18
|
+
export declare function MixedDetailControl({ path, enabled, readonly, renderers, cells, detailUiSchema, withoutControlLabel, selectedType, selectedSchema, }: MixedDetailProps & Pick<MixedRendererState, 'selectedType' | 'selectedSchema'>): React.JSX.Element | null;
|
|
19
|
+
export declare function MixedCodeControl({ schema, uischema, path, enabled, readonly, renderers, cells, }: ControlProps): React.JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { useI18n as e } from "../locale/translate.esm.js";
|
|
2
|
+
import { changeMixedNodeType as t, resolveMixedNodeEditor as n } from "./mixedNodeEditor.esm.js";
|
|
3
|
+
import { MixedScalarContext as r } from "./mixedScalar.esm.js";
|
|
4
|
+
import i from "react";
|
|
5
|
+
import { JsonFormsDispatch as a } from "@jsonforms/react";
|
|
6
|
+
// src/mixed/MixedDetailControl.tsx
|
|
7
|
+
function o(e, t) {
|
|
8
|
+
return e === "string" || e === "number" || e === "integer" ? t : void 0;
|
|
9
|
+
}
|
|
10
|
+
function s(e, t, n, r) {
|
|
11
|
+
let i = e.path.length === 0 && t ? t : {
|
|
12
|
+
type: "Control",
|
|
13
|
+
scope: "#"
|
|
14
|
+
};
|
|
15
|
+
return n ? r(i) : i;
|
|
16
|
+
}
|
|
17
|
+
function c({ node: e, path: c, enabled: l, readonly: u, renderers: d, cells: f, detailUiSchema: p, withoutControlLabel: m, rootSchema: h, handleChange: g, MixedTypeSelector: _, wrapStructured: v }) {
|
|
18
|
+
if (!e) return null;
|
|
19
|
+
let { isNestedPrimitive: y, nodeSchema: b, nodePath: x, nodeTypes: S, nodeType: C } = n(e, c, h), w = e.path.length > 0 ? /* @__PURE__ */ i.createElement("div", { className: "jsonforms-mixed-renderer-detail-type" }, /* @__PURE__ */ i.createElement(_, {
|
|
20
|
+
clearable: !1,
|
|
21
|
+
disabled: !l || !!u,
|
|
22
|
+
onChange: (n) => t(e, n, x, h, g),
|
|
23
|
+
types: S,
|
|
24
|
+
value: C
|
|
25
|
+
})) : null, T = e.type === "null" ? null : /* @__PURE__ */ i.createElement("div", { className: "jsonforms-mixed-renderer-detail-control" }, /* @__PURE__ */ i.createElement(r.Provider, { value: o(e.type, x) }, /* @__PURE__ */ i.createElement(a, {
|
|
26
|
+
schema: b,
|
|
27
|
+
uischema: s(e, p, y, m),
|
|
28
|
+
path: x,
|
|
29
|
+
enabled: l,
|
|
30
|
+
renderers: d,
|
|
31
|
+
cells: f,
|
|
32
|
+
readonly: u
|
|
33
|
+
}))), E = /* @__PURE__ */ i.createElement(i.Fragment, null, w, T);
|
|
34
|
+
return y ? /* @__PURE__ */ i.createElement("div", { className: "jsonforms-mixed-renderer-detail-primitive" }, E) : v(E);
|
|
35
|
+
}
|
|
36
|
+
function l({ path: e, enabled: t, readonly: n, renderers: s, cells: c, detailUiSchema: l, withoutControlLabel: u, selectedType: d, selectedSchema: f }) {
|
|
37
|
+
return d !== "null" && f && l ? /* @__PURE__ */ i.createElement(r.Provider, { value: o(d, e) }, /* @__PURE__ */ i.createElement(a, {
|
|
38
|
+
schema: f,
|
|
39
|
+
uischema: u(l),
|
|
40
|
+
path: e,
|
|
41
|
+
enabled: t,
|
|
42
|
+
renderers: s,
|
|
43
|
+
cells: c,
|
|
44
|
+
readonly: n
|
|
45
|
+
})) : null;
|
|
46
|
+
}
|
|
47
|
+
function u({ schema: t, uischema: n, path: r, enabled: o, readonly: s, renderers: c, cells: l }) {
|
|
48
|
+
var u;
|
|
49
|
+
let d = e();
|
|
50
|
+
return ((u = n.options) == null ? void 0 : u.format) === "code" ? /* @__PURE__ */ i.createElement("div", { role: "alert" }, d("mixed.codeUnavailable")) : /* @__PURE__ */ i.createElement(a, {
|
|
51
|
+
schema: t,
|
|
52
|
+
uischema: {
|
|
53
|
+
...n,
|
|
54
|
+
scope: "#",
|
|
55
|
+
options: {
|
|
56
|
+
...n.options,
|
|
57
|
+
format: "code",
|
|
58
|
+
language: "json",
|
|
59
|
+
convertJson: !0,
|
|
60
|
+
validateJsonSchema: !0,
|
|
61
|
+
propagateErrors: !0
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
path: r,
|
|
65
|
+
enabled: o,
|
|
66
|
+
readonly: s,
|
|
67
|
+
renderers: c,
|
|
68
|
+
cells: l
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
export { u as MixedCodeControl, l as MixedDetailControl, c as MixedNodeControl };
|
|
72
|
+
|
|
73
|
+
//# sourceMappingURL=MixedDetailControl.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MixedDetailControl.esm.js","names":["React","scalarContextPath","type","path","nodeControlUiSchema","uiSchema","node","detailUiSchema","isNestedPrimitive","withoutControlLabel","MixedNodeControl","resolveMixedNodeEditor","rootSchema","nodeSelector","MixedTypeSelector","enabled","readonly","changeMixedNodeType","value","nodePath","handleChange","nodeTypes","nodeType","nodeControl","MixedScalarContext","JsonFormsDispatch","nodeSchema","content","wrapStructured","MixedDetailControl","selectedType","selectedSchema","MixedCodeControl","_uischema$options","t","useI18n","uischema"],"sources":["../../src/mixed/MixedDetailControl.tsx"],"sourcesContent":["import { useI18n } from '../locale/translate';\nimport React from 'react';\nimport { type ControlProps } from '@jsonforms/core';\nimport { JsonFormsDispatch } from '@jsonforms/react';\nimport { type JsonDataType } from './mixedSchema';\nimport { resolveMixedNodeEditor, changeMixedNodeType } from './mixedNodeEditor';\nimport { MixedScalarContext } from './mixedScalar';\nimport { type MixedTreeNode } from './mixedTree';\nimport { type useMixedRenderer } from './useMixedRenderer';\n\ntype MixedRendererState = ReturnType<typeof useMixedRenderer>;\ntype MixedDetailProps = Pick<\n ControlProps,\n 'path' | 'enabled' | 'readonly' | 'renderers' | 'cells'\n> &\n Pick<MixedRendererState, 'detailUiSchema' | 'withoutControlLabel'>;\n\nfunction scalarContextPath(type: string | null | undefined, path: string) {\n return type === 'string' || type === 'number' || type === 'integer'\n ? path\n : undefined;\n}\n\nfunction nodeControlUiSchema(\n node: MixedTreeNode,\n detailUiSchema: MixedDetailProps['detailUiSchema'],\n isNestedPrimitive: boolean,\n withoutControlLabel: MixedDetailProps['withoutControlLabel'],\n) {\n const uiSchema =\n node.path.length === 0 && detailUiSchema\n ? detailUiSchema\n : { type: 'Control', scope: '#' };\n return isNestedPrimitive ? withoutControlLabel(uiSchema) : uiSchema;\n}\n\nexport function MixedNodeControl({\n node,\n path,\n enabled,\n readonly,\n renderers,\n cells,\n detailUiSchema,\n withoutControlLabel,\n rootSchema,\n handleChange,\n MixedTypeSelector,\n wrapStructured,\n}: MixedDetailProps &\n Pick<ControlProps, 'rootSchema' | 'handleChange'> & {\n node?: MixedTreeNode;\n MixedTypeSelector: React.ComponentType<{\n clearable: boolean;\n disabled: boolean;\n types: string[];\n value: string | null;\n onChange: (value: string | undefined) => void;\n }>;\n wrapStructured: (children: React.ReactNode) => React.ReactElement;\n }) {\n if (!node) return null;\n const { isNestedPrimitive, nodeSchema, nodePath, nodeTypes, nodeType } =\n resolveMixedNodeEditor(node, path, rootSchema);\n const nodeSelector =\n node.path.length > 0 ? (\n <div className='jsonforms-mixed-renderer-detail-type'>\n <MixedTypeSelector\n clearable={false}\n disabled={!enabled || Boolean(readonly)}\n onChange={(value) =>\n changeMixedNodeType(\n node,\n value as JsonDataType | undefined,\n nodePath,\n rootSchema,\n handleChange,\n )\n }\n types={nodeTypes}\n value={nodeType}\n />\n </div>\n ) : null;\n const nodeControl =\n node.type === 'null' ? null : (\n <div className='jsonforms-mixed-renderer-detail-control'>\n <MixedScalarContext.Provider\n value={scalarContextPath(node.type, nodePath)}\n >\n <JsonFormsDispatch\n schema={nodeSchema}\n uischema={nodeControlUiSchema(\n node,\n detailUiSchema,\n isNestedPrimitive,\n withoutControlLabel,\n )}\n path={nodePath}\n enabled={enabled}\n renderers={renderers}\n cells={cells}\n readonly={readonly}\n />\n </MixedScalarContext.Provider>\n </div>\n );\n\n const content = (\n <>\n {nodeSelector}\n {nodeControl}\n </>\n );\n if (isNestedPrimitive) {\n return (\n <div className='jsonforms-mixed-renderer-detail-primitive'>{content}</div>\n );\n }\n return wrapStructured(content);\n}\nexport function MixedDetailControl({\n path,\n enabled,\n readonly,\n renderers,\n cells,\n detailUiSchema,\n withoutControlLabel,\n selectedType,\n selectedSchema,\n}: MixedDetailProps &\n Pick<MixedRendererState, 'selectedType' | 'selectedSchema'>) {\n return selectedType !== 'null' && selectedSchema && detailUiSchema ? (\n <MixedScalarContext.Provider value={scalarContextPath(selectedType, path)}>\n <JsonFormsDispatch\n schema={selectedSchema}\n uischema={withoutControlLabel(detailUiSchema)}\n path={path}\n enabled={enabled}\n renderers={renderers}\n cells={cells}\n readonly={readonly}\n />\n </MixedScalarContext.Provider>\n ) : null;\n}\nexport function MixedCodeControl({\n schema,\n uischema,\n path,\n enabled,\n readonly,\n renderers,\n cells,\n}: ControlProps) {\n const t = useI18n();\n if (uischema.options?.format === 'code')\n return <div role='alert'>{t('mixed.codeUnavailable')}</div>;\n return (\n <JsonFormsDispatch\n schema={schema}\n uischema={{\n ...uischema,\n scope: '#',\n options: {\n ...uischema.options,\n format: 'code',\n language: 'json',\n convertJson: true,\n validateJsonSchema: true,\n propagateErrors: true,\n },\n }}\n path={path}\n enabled={enabled}\n readonly={readonly}\n renderers={renderers}\n cells={cells}\n />\n );\n}\n"],"mappings":";;;;;;AAiBA,SAASC,EAAkB,GAAiC,GAAc;CACxE,OAAOC,MAAS,YAAYA,MAAS,YAAYA,MAAS,YACtDC,IACA,KAAA;AACN;AAEA,SAASC,EACP,GACA,GACA,GACA,GACA;CACA,IAAMC,IACJC,E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T3B,kBAAA,cAACsB,GAAD;EACE,QAAQM;EACR,UAAUtB,EAAoBF,CAAc;EACtC;EACG;EACE;EACJ;EACG;CACX,CAAA,CAC0B,IAC3B;AACN;AACA,SAAgByB,EAAiB,EAC/B,WACA,aACA,SACA,YACA,aACA,cACA,YACe;;CACf,IAAME,IAAIC,EAAQ;CAGlB,SAFA,IAAIC,EAAS,YAAA,OAAA,KAAA,IAAAH,EAAS,YAAW,SACxB,kBAAA,cAAC,OAAD,EAAK,MAAK,QAAyC,GAAhCC,EAAE,uBAAuB,CAAO,IAE1D,kBAAA,cAACT,GAAD;EACU;EACR,UAAU;GACR,GAAGW;GACH,OAAO;GACP,SAAS;IACP,GAAGA,EAAS;IACZ,QAAQ;IACR,UAAU;IACV,aAAa;IACb,oBAAoB;IACpB,iBAAiB;GACnB;EACF;EACM;EACG;EACC;EACC;EACJ;CACR,CAAA;AAEL"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BocRIvOZ.js"),t=require("../core/detailUiSchema.cjs.js"),n=require("./recursiveTree.cjs.js"),r=require("./mixedTree.cjs.js"),i=require("../locale/translate.cjs.js"),a=require("../validation/validationIndicator.cjs.js");let o=require("react");o=e.t(o);let s=require("@jsonforms/core"),c=require("@jsonforms/react");var l=(0,o.createContext)(null),u=(0,c.withJsonFormsControlProps)(({data:e,path:t})=>{let n=(0,o.useContext)(l);return o.default.createElement(n.Link,{onClick:()=>n.select(t)},typeof(e==null?void 0:e[n.labelProperty])==`string`&&e[n.labelProperty].trim()?e[n.labelProperty]:String(Number(t.split(`.`).pop())+1))}),d=(0,c.withJsonFormsControlProps)(e=>o.default.createElement(c.JsonFormsDispatch,{schema:e.schema,path:e.path,enabled:e.enabled,renderers:e.renderers,cells:e.cells,uischema:{...e.uischema,scope:`#`,options:{...e.uischema.options,recursiveTreeChildren:!0,table:!1,format:void 0,collapsed:!1,detail:{type:`Control`,scope:`#`,options:{recursiveTreeNodeLink:!0}}}}})),f=e=>{var t;return e.type===`Control`&&(t=e.options)!=null&&t.recursiveTree&&typeof e.options.recursiveTree.childrenProperty==`string`&&typeof e.options.recursiveTree.labelProperty==`string`?30:-1},p=(e,f,p,m)=>{let h=({path:e,options:t,config:n})=>{let r=a.useContainerValidation({type:`Control`,scope:`#`,options:t},e,n,!1);return r.show?o.default.createElement(f,{count:r.count}):null};return(0,c.withJsonFormsControlProps)(a=>{var f;let{data:g,schema:_,rootSchema:v,path:y,uischema:b,config:x,label:S,visible:C}=a,w=b.options.recursiveTree,T=m(),E=i.useI18n(),D=(0,c.useJsonForms)(),O=(f=D.core)==null?void 0:f.ajv,k=(0,o.useMemo)(()=>n.buildRecursiveTree(g,_,v,w.childrenProperty,w.labelProperty,S||E(`control.value`)),[g,_,v,w.childrenProperty,w.labelProperty,S,E]),[A,j]=(0,o.useState)({node:k,tree:k}),M=A.tree===k?A.node:n.recursiveTreeSelection(k,A.node,A.tree),N=e=>j({node:e,tree:k});A.tree!==k&&j({node:M,tree:k});let P=e=>e.path.reduce((e,t)=>(0,s.composePaths)(e,String(t)),y),F=e=>n.recursiveNodeSchema(e.schema,v,e.data),I=e=>e!=null&&e.$ref?(0,s.resolveSchema)(v,e.$ref,v)??e:e,L=e=>{if(!a.enabled||a.readonly)return!1;for(let i=0;i<=e.path.length;i+=2){var t,n;let a=r.findMixedTreeNode(k,e.path.slice(0,i));if(!a||F(a).readOnly||i<e.path.length&&(t=I((n=F(a).properties)==null?void 0:n[w.childrenProperty]))!=null&&t.readOnly)return!1}return!0},R=e=>{var t;if(!e.path.length||!L(e))return!1;let r=n.recursiveTreeParent(k,e.path),i=I((t=F(r).properties)==null?void 0:t[w.childrenProperty]);return L(r)&&!(i!=null&&i.readOnly)&&r.children.length>((i==null?void 0:i.minItems)??0)},z=e=>{var t;return I((t=F(e).properties)==null?void 0:t[w.labelProperty])},B=e=>{let t=z(e);return L(e)&&t&&!t.readOnly&&t.const===void 0&&(!t.type||t.type===`string`)},V=(e,t)=>{if(!t.trim())return E(`additionalProperties.nameRequired`);let n=z(e);if(!n)return E(`additionalProperties.nameInvalid`,{name:t});try{if(O&&!O.validate(n,t))return E(`additionalProperties.nameInvalid`,{name:t})}catch{return E(`additionalProperties.nameInvalid`,{name:t})}},H=o.default.useRef({tree:k,props:a,canDelete:R,canRename:B,validateRename:V});(0,o.useLayoutEffect)(()=>{H.current={tree:k,props:a,canDelete:R,canRename:B,validateRename:V}});let U=e=>{R(e)&&T.request({operation:`delete`,catalogId:`mixed`,discarded:[e.data],options:b.options,config:x,perform:()=>{let t=H.current,n=r.findMixedTreeNode(t.tree,e.path);n&&n.data===e.data&&t.canDelete(n)&&t.props.handleChange(t.props.path,r.deleteMixedTreeNode(t.props.data,n.path))}})},W=(e,t)=>{let n=H.current,i=r.findMixedTreeNode(n.tree,e.path);i&&i.data===e.data&&n.canRename(i)&&!n.validateRename(i,t)&&n.props.handleChange((0,s.composePaths)(P(i),w.labelProperty),t)},G=(0,o.useMemo)(()=>[{tester:e=>{var t;return(t=e.options)!=null&&t.recursiveTreeNodeLink?100:-1},renderer:u},{tester:(e,t,n)=>{var r,i;return!((r=e.options)!=null&&r.recursiveTreeChildren)&&(i=e.scope)!=null&&i.endsWith(`/properties/`+w.childrenProperty.replace(/~/g,`~0`).replace(/\//g,`~1`))&&(0,s.schemaTypeIs)(`array`)(e,t,n)?100:-1},renderer:d},...a.renderers??[]],[a.renderers,w.childrenProperty]),K=t.resolveEditorDetail(w.detail,D.uischemas??[],M.schema,`#`,P(M),v,{type:`Control`,scope:`#`,label:S});return C?o.default.createElement(l.Provider,{value:{Link:p,labelProperty:w.labelProperty,select:e=>{let t=n=>P(n)===e?n:n.children.map(t).find(Boolean),n=t(k);n&&N(n)}}},o.default.createElement(`div`,{"data-recursive-tree":!0,style:{display:`flex`,flexWrap:`wrap`,gap:16,alignItems:`flex-start`}},o.default.createElement(`div`,{style:{flex:`1 1 240px`,minWidth:0}},o.default.createElement(e,{domainTree:!0,root:k,selectedPath:M.path,onSelect:N,canDelete:R,canRename:B,onDelete:U,onRename:W,validateRename:V,renderIndicator:e=>o.default.createElement(h,{path:P(e),options:b.options,config:x})})),o.default.createElement(`div`,{"data-recursive-tree-detail":!0,style:{flex:`3 1 360px`,minWidth:0}},o.default.createElement(c.JsonFormsDispatch,{key:r.mixedPathKey(M.path),schema:M.schema,path:P(M),enabled:a.enabled,renderers:G,cells:a.cells,uischema:{...K,options:{...K.options,recursiveTree:void 0}}}))),T.dialog):null})};exports.createRecursiveTreeRenderer=p,exports.recursiveTreeTester=f;
|
|
2
|
+
//# sourceMappingURL=RecursiveTreeRenderer.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecursiveTreeRenderer.cjs.js","names":["createContext","withJsonFormsControlProps","useContext","JsonFormsDispatch","useContainerValidation","useI18n","useJsonForms","useMemo","buildRecursiveTree","useState","recursiveTreeSelection","composePaths","recursiveNodeSchema","resolveSchema","findMixedTreeNode","recursiveTreeParent","React","deleteMixedTreeNode","schemaTypeIs","resolveEditorDetail","mixedPathKey","require_rolldown_runtime","require_core_detailUiSchema","require_mixed_recursiveTree","require_mixed_mixedTree","require_locale_translate","require_validation_validationIndicator","react","_jsonforms_core","_jsonforms_react","Navigation","NodeLink","navigation","path","data","ChildrenLinks","props","recursiveTreeTester","_ui$options","ui","createRecursiveTreeRenderer","NodeIndicator","validation","config","Indicator","_context$core","options","uischema","confirmation","useConfirmation","t","context","ajv","tree","schema","rootSchema","label","selection","setSelection","selected","select","nodePath","node","p","segment","branch","resolve","candidate","writable","length","_resolve","_branch$properties","ancestor","canDelete","_branch$properties2","parent","collection","nameSchema","_branch$properties3","canRename","field","validateRename","name","current","onDelete","now","target","onRename","registry","_ui$options2","_ui$options3","_ui$scope","detail","visible","find","found","Tree"],"sources":["../../src/mixed/RecursiveTreeRenderer.tsx"],"sourcesContent":["import React, {\n useLayoutEffect,\n createContext,\n useContext,\n useMemo,\n useState,\n} from 'react';\nimport { resolveEditorDetail } from '../core/detailUiSchema';\nimport {\n ControlProps,\n JsonSchema7,\n ControlElement,\n JsonFormsRendererRegistryEntry,\n RankedTester,\n composePaths,\n schemaTypeIs,\n resolveSchema,\n} from '@jsonforms/core';\nimport {\n JsonFormsDispatch,\n withJsonFormsControlProps,\n useJsonForms,\n} from '@jsonforms/react';\nimport {\n buildRecursiveTree,\n recursiveTreeSelection,\n recursiveTreeParent,\n recursiveNodeSchema,\n} from './recursiveTree';\nimport {\n MixedTreeNode,\n MixedTreePath,\n mixedPathKey,\n deleteMixedTreeNode,\n findMixedTreeNode,\n} from './mixedTree';\nimport { useI18n } from '../locale/translate';\nimport {\n ConfirmationCatalogId,\n ConfirmationOperation,\n} from '../interaction/confirmation';\nimport { useContainerValidation } from '../validation/validationIndicator';\n\nexport type MixedTreeProps = {\n root: MixedTreeNode;\n selectedPath: MixedTreePath;\n onSelect: (node: MixedTreeNode) => void;\n canDelete: (node: MixedTreeNode) => boolean;\n canRename: (node: MixedTreeNode) => boolean;\n onDelete: (node: MixedTreeNode) => void;\n onRename: (node: MixedTreeNode, name: string) => void;\n validateRename: (node: MixedTreeNode, name: string) => string | undefined;\n domainTree?: boolean;\n renderIndicator?: (node: MixedTreeNode) => React.ReactNode;\n};\ntype LinkProps = { children: React.ReactNode; onClick: () => void };\nconst Navigation = createContext<{\n select: (path: string) => void;\n labelProperty: string;\n Link: React.ComponentType<LinkProps>;\n} | null>(null);\n\nconst NodeLink = withJsonFormsControlProps(({ data, path }: ControlProps) => {\n const navigation = useContext(Navigation)!;\n return (\n <navigation.Link onClick={() => navigation.select(path)}>\n {typeof data?.[navigation.labelProperty] === 'string' &&\n data[navigation.labelProperty].trim()\n ? data[navigation.labelProperty]\n : String(Number(path.split('.').pop()) + 1)}\n </navigation.Link>\n );\n});\n\n// Keep native array actions, defaults, permissions and confirmation. Only the\n// row detail is replaced with navigation to the child's editor.\nconst ChildrenLinks = withJsonFormsControlProps((props: ControlProps) => (\n <JsonFormsDispatch\n schema={props.schema}\n path={props.path}\n enabled={props.enabled}\n renderers={props.renderers}\n cells={props.cells}\n uischema={\n {\n ...props.uischema,\n scope: '#',\n options: {\n ...props.uischema.options,\n recursiveTreeChildren: true,\n table: false,\n format: undefined,\n collapsed: false,\n detail: {\n type: 'Control',\n scope: '#',\n options: { recursiveTreeNodeLink: true },\n },\n },\n } as ControlElement\n }\n />\n));\n\nexport const recursiveTreeTester: RankedTester = (ui) =>\n ui.type === 'Control' &&\n ui.options?.recursiveTree &&\n typeof ui.options.recursiveTree.childrenProperty === 'string' &&\n typeof ui.options.recursiveTree.labelProperty === 'string'\n ? 30\n : -1;\n\nexport const createRecursiveTreeRenderer = (\n Tree: React.ComponentType<MixedTreeProps>,\n Indicator: React.ComponentType<{ count?: number }>,\n Link: React.ComponentType<LinkProps>,\n useConfirmation: () => {\n request: (request: {\n operation: ConfirmationOperation;\n catalogId: ConfirmationCatalogId;\n discarded: unknown[];\n options?: Record<string, unknown>;\n config?: unknown;\n perform: () => void;\n }) => void;\n dialog: React.ReactNode;\n },\n) => {\n const NodeIndicator = ({ path, options, config }: any) => {\n const validation = useContainerValidation(\n { type: 'Control', scope: '#', options } as ControlElement,\n path,\n config,\n false,\n );\n return validation.show ? <Indicator count={validation.count} /> : null;\n };\n const RecursiveTree = (props: ControlProps) => {\n const { data, schema, rootSchema, path, uischema, config, label, visible } =\n props;\n const options = uischema.options!.recursiveTree;\n const confirmation = useConfirmation();\n const t = useI18n();\n const context = useJsonForms();\n const ajv = context.core?.ajv;\n const tree = useMemo(\n () =>\n buildRecursiveTree(\n data,\n schema,\n rootSchema,\n options.childrenProperty,\n options.labelProperty,\n label || t('control.value'),\n ),\n [\n data,\n schema,\n rootSchema,\n options.childrenProperty,\n options.labelProperty,\n label,\n t,\n ],\n );\n const [selection, setSelection] = useState<{\n node: MixedTreeNode;\n tree: MixedTreeNode;\n }>({ node: tree, tree });\n const selected =\n selection.tree === tree\n ? selection.node\n : recursiveTreeSelection(tree, selection.node, selection.tree);\n const select = (node: MixedTreeNode) => setSelection({ node, tree });\n // Updating this remembered snapshot prevents a later mutation from comparing\n // against an obsolete array index after an external reorder.\n if (selection.tree !== tree) setSelection({ node: selected, tree });\n const nodePath = (node: MixedTreeNode) =>\n node.path.reduce<string>(\n (p, segment) => composePaths(p, String(segment)),\n path,\n );\n const branch = (node: MixedTreeNode) =>\n recursiveNodeSchema(node.schema, rootSchema, node.data);\n const resolve = (candidate: any) =>\n candidate?.$ref\n ? (resolveSchema(rootSchema, candidate.$ref, rootSchema) ?? candidate)\n : candidate;\n const writable = (node: MixedTreeNode) => {\n if (!props.enabled || props.readonly) return false;\n for (let length = 0; length <= node.path.length; length += 2) {\n const ancestor = findMixedTreeNode(tree, node.path.slice(0, length));\n if (!ancestor || (branch(ancestor) as JsonSchema7).readOnly)\n return false;\n if (\n length < node.path.length &&\n resolve(branch(ancestor).properties?.[options.childrenProperty])\n ?.readOnly\n )\n return false;\n }\n return true;\n };\n const canDelete = (node: MixedTreeNode) => {\n if (!node.path.length || !writable(node)) return false;\n const parent = recursiveTreeParent(tree, node.path);\n const collection = resolve(\n branch(parent).properties?.[options.childrenProperty],\n );\n return (\n writable(parent) &&\n !collection?.readOnly &&\n parent.children.length > (collection?.minItems ?? 0)\n );\n };\n const nameSchema = (node: MixedTreeNode) =>\n resolve(branch(node).properties?.[options.labelProperty]);\n const canRename = (node: MixedTreeNode) => {\n const field = nameSchema(node);\n return (\n writable(node) &&\n field &&\n !field.readOnly &&\n field.const === undefined &&\n (!field.type || field.type === 'string')\n );\n };\n const validateRename = (node: MixedTreeNode, name: string) => {\n if (!name.trim()) return t('additionalProperties.nameRequired');\n const field = nameSchema(node);\n if (!field) return t('additionalProperties.nameInvalid', { name });\n try {\n if (ajv && !ajv.validate(field, name))\n return t('additionalProperties.nameInvalid', { name });\n } catch {\n return t('additionalProperties.nameInvalid', { name });\n }\n return undefined;\n };\n // Confirmation callbacks must use current permissions and data, and must\n // never delete a replacement item that now occupies the original index.\n const current = React.useRef({\n tree,\n props,\n canDelete,\n canRename,\n validateRename,\n });\n useLayoutEffect(() => {\n current.current = { tree, props, canDelete, canRename, validateRename };\n });\n const onDelete = (node: MixedTreeNode) => {\n if (!canDelete(node)) return;\n confirmation.request({\n operation: 'delete',\n catalogId: 'mixed',\n discarded: [node.data],\n options: uischema.options,\n config,\n perform: () => {\n const now = current.current;\n const target = findMixedTreeNode(now.tree, node.path);\n if (!target || target.data !== node.data || !now.canDelete(target))\n return;\n now.props.handleChange(\n now.props.path,\n deleteMixedTreeNode(now.props.data, target.path),\n );\n },\n });\n };\n const onRename = (node: MixedTreeNode, name: string) => {\n const now = current.current;\n const target = findMixedTreeNode(now.tree, node.path);\n if (\n !target ||\n target.data !== node.data ||\n !now.canRename(target) ||\n now.validateRename(target, name)\n )\n return;\n now.props.handleChange(\n composePaths(nodePath(target), options.labelProperty),\n name,\n );\n };\n const registry = useMemo<JsonFormsRendererRegistryEntry[]>(\n () => [\n {\n tester: (ui) => (ui.options?.recursiveTreeNodeLink ? 100 : -1),\n renderer: NodeLink,\n },\n {\n tester: (ui, candidate, context) =>\n !ui.options?.recursiveTreeChildren &&\n (ui as ControlElement).scope?.endsWith(\n '/properties/' +\n options.childrenProperty\n .replace(/~/g, '~0')\n .replace(/\\//g, '~1'),\n ) &&\n schemaTypeIs('array')(ui, candidate, context)\n ? 100\n : -1,\n renderer: ChildrenLinks,\n },\n ...(props.renderers ?? []),\n ],\n [props.renderers, options.childrenProperty],\n );\n const detail = resolveEditorDetail(\n options.detail,\n context.uischemas ?? [],\n selected.schema,\n '#',\n nodePath(selected),\n rootSchema,\n { type: 'Control', scope: '#', label } as ControlElement,\n );\n if (!visible) return null;\n return (\n <Navigation.Provider\n value={{\n Link,\n labelProperty: options.labelProperty,\n select: (target) => {\n const find = (node: MixedTreeNode): MixedTreeNode | undefined =>\n nodePath(node) === target\n ? node\n : node.children.map(find).find(Boolean);\n const found = find(tree);\n if (found) select(found);\n },\n }}\n >\n <div\n data-recursive-tree\n style={{\n display: 'flex',\n flexWrap: 'wrap',\n gap: 16,\n alignItems: 'flex-start',\n }}\n >\n <div style={{ flex: '1 1 240px', minWidth: 0 }}>\n <Tree\n domainTree\n root={tree}\n selectedPath={selected.path}\n onSelect={select}\n canDelete={canDelete}\n canRename={canRename}\n onDelete={onDelete}\n onRename={onRename}\n validateRename={validateRename}\n renderIndicator={(node) => (\n <NodeIndicator\n path={nodePath(node)}\n options={uischema.options}\n config={config}\n />\n )}\n />\n </div>\n <div\n data-recursive-tree-detail\n style={{ flex: '3 1 360px', minWidth: 0 }}\n >\n <JsonFormsDispatch\n key={mixedPathKey(selected.path)}\n schema={selected.schema}\n path={nodePath(selected)}\n enabled={props.enabled}\n renderers={registry}\n cells={props.cells}\n uischema={{\n ...detail,\n options: { ...detail.options, recursiveTree: undefined },\n }}\n />\n </div>\n </div>\n {confirmation.dialog}\n </Navigation.Provider>\n );\n };\n return withJsonFormsControlProps(RecursiveTree);\n};\n"],"mappings":"A,kaAwDA,IAAM8B,GAAA,EAAa9B,EAAAA,cAAAA,CAIT,IAAI,EAER+B,GAAA,EAAW9B,EAAAA,0BAAAA,EAA2B,CAAE,OAAM,UAAyB,CAC3E,IAAM+B,GAAA,EAAa9B,EAAAA,WAAAA,CAAW4B,CAAU,EACxC,OACEH,EAAA,QAAA,cAACK,EAAW,KAAZ,CAAiB,YAAeA,EAAW,OAAOC,CAAI,CAKrC,EAJd,OAAAC,GAAA,KAAA,IAAA,GAAOA,EAAOF,EAAW,iBAAmB,UAC7CE,EAAKF,EAAW,cAAc,CAAC,KAAK,EAChCE,EAAKF,EAAW,eAChB,OAAO,OAAOC,EAAK,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,EAAI,CAAC,CAC7B,CAErB,CAAC,EAIKE,GAAA,EAAgBlC,EAAAA,0BAAAA,CAA2B,GAC/C0B,EAAA,QAAA,cAACxB,EAAAA,kBAAD,CACE,OAAQiC,EAAM,OACd,KAAMA,EA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CAC8C,CAChD,E"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RankedTester } from '@jsonforms/core';
|
|
3
|
+
import { MixedTreeNode, MixedTreePath } from './mixedTree';
|
|
4
|
+
import { ConfirmationCatalogId, ConfirmationOperation } from '../interaction/confirmation';
|
|
5
|
+
export type MixedTreeProps = {
|
|
6
|
+
root: MixedTreeNode;
|
|
7
|
+
selectedPath: MixedTreePath;
|
|
8
|
+
onSelect: (node: MixedTreeNode) => void;
|
|
9
|
+
canDelete: (node: MixedTreeNode) => boolean;
|
|
10
|
+
canRename: (node: MixedTreeNode) => boolean;
|
|
11
|
+
onDelete: (node: MixedTreeNode) => void;
|
|
12
|
+
onRename: (node: MixedTreeNode, name: string) => void;
|
|
13
|
+
validateRename: (node: MixedTreeNode, name: string) => string | undefined;
|
|
14
|
+
domainTree?: boolean;
|
|
15
|
+
renderIndicator?: (node: MixedTreeNode) => React.ReactNode;
|
|
16
|
+
};
|
|
17
|
+
type LinkProps = {
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
onClick: () => void;
|
|
20
|
+
};
|
|
21
|
+
export declare const recursiveTreeTester: RankedTester;
|
|
22
|
+
export declare const createRecursiveTreeRenderer: (Tree: React.ComponentType<MixedTreeProps>, Indicator: React.ComponentType<{
|
|
23
|
+
count?: number;
|
|
24
|
+
}>, Link: React.ComponentType<LinkProps>, useConfirmation: () => {
|
|
25
|
+
request: (request: {
|
|
26
|
+
operation: ConfirmationOperation;
|
|
27
|
+
catalogId: ConfirmationCatalogId;
|
|
28
|
+
discarded: unknown[];
|
|
29
|
+
options?: Record<string, unknown>;
|
|
30
|
+
config?: unknown;
|
|
31
|
+
perform: () => void;
|
|
32
|
+
}) => void;
|
|
33
|
+
dialog: React.ReactNode;
|
|
34
|
+
}) => React.ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { resolveEditorDetail as e } from "../core/detailUiSchema.esm.js";
|
|
2
|
+
import { buildRecursiveTree as t, recursiveNodeSchema as n, recursiveTreeParent as r, recursiveTreeSelection as i } from "./recursiveTree.esm.js";
|
|
3
|
+
import { deleteMixedTreeNode as a, findMixedTreeNode as o, mixedPathKey as s } from "./mixedTree.esm.js";
|
|
4
|
+
import { useI18n as c } from "../locale/translate.esm.js";
|
|
5
|
+
import { useContainerValidation as l } from "../validation/validationIndicator.esm.js";
|
|
6
|
+
import u, { createContext as d, useContext as f, useLayoutEffect as p, useMemo as m, useState as h } from "react";
|
|
7
|
+
import { composePaths as g, resolveSchema as _, schemaTypeIs as v } from "@jsonforms/core";
|
|
8
|
+
import { JsonFormsDispatch as y, useJsonForms as b, withJsonFormsControlProps as x } from "@jsonforms/react";
|
|
9
|
+
// src/mixed/RecursiveTreeRenderer.tsx
|
|
10
|
+
var S = d(null), C = x(({ data: e, path: t }) => {
|
|
11
|
+
let n = f(S);
|
|
12
|
+
return /* @__PURE__ */ u.createElement(n.Link, { onClick: () => n.select(t) }, typeof (e == null ? void 0 : e[n.labelProperty]) == "string" && e[n.labelProperty].trim() ? e[n.labelProperty] : String(Number(t.split(".").pop()) + 1));
|
|
13
|
+
}), w = x((e) => /* @__PURE__ */ u.createElement(y, {
|
|
14
|
+
schema: e.schema,
|
|
15
|
+
path: e.path,
|
|
16
|
+
enabled: e.enabled,
|
|
17
|
+
renderers: e.renderers,
|
|
18
|
+
cells: e.cells,
|
|
19
|
+
uischema: {
|
|
20
|
+
...e.uischema,
|
|
21
|
+
scope: "#",
|
|
22
|
+
options: {
|
|
23
|
+
...e.uischema.options,
|
|
24
|
+
recursiveTreeChildren: !0,
|
|
25
|
+
table: !1,
|
|
26
|
+
format: void 0,
|
|
27
|
+
collapsed: !1,
|
|
28
|
+
detail: {
|
|
29
|
+
type: "Control",
|
|
30
|
+
scope: "#",
|
|
31
|
+
options: { recursiveTreeNodeLink: !0 }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
})), T = (e) => {
|
|
36
|
+
var t;
|
|
37
|
+
return e.type === "Control" && (t = e.options) != null && t.recursiveTree && typeof e.options.recursiveTree.childrenProperty == "string" && typeof e.options.recursiveTree.labelProperty == "string" ? 30 : -1;
|
|
38
|
+
}, E = (d, f, T, E) => {
|
|
39
|
+
let ee = ({ path: e, options: t, config: n }) => {
|
|
40
|
+
let r = l({
|
|
41
|
+
type: "Control",
|
|
42
|
+
scope: "#",
|
|
43
|
+
options: t
|
|
44
|
+
}, e, n, !1);
|
|
45
|
+
return r.show ? /* @__PURE__ */ u.createElement(f, { count: r.count }) : null;
|
|
46
|
+
};
|
|
47
|
+
return x((l) => {
|
|
48
|
+
var f;
|
|
49
|
+
let { data: x, schema: D, rootSchema: O, path: k, uischema: A, config: j, label: M, visible: N } = l, P = A.options.recursiveTree, F = E(), I = c(), L = b(), R = (f = L.core) == null ? void 0 : f.ajv, z = m(() => t(x, D, O, P.childrenProperty, P.labelProperty, M || I("control.value")), [
|
|
50
|
+
x,
|
|
51
|
+
D,
|
|
52
|
+
O,
|
|
53
|
+
P.childrenProperty,
|
|
54
|
+
P.labelProperty,
|
|
55
|
+
M,
|
|
56
|
+
I
|
|
57
|
+
]), [B, V] = h({
|
|
58
|
+
node: z,
|
|
59
|
+
tree: z
|
|
60
|
+
}), H = B.tree === z ? B.node : i(z, B.node, B.tree), U = (e) => V({
|
|
61
|
+
node: e,
|
|
62
|
+
tree: z
|
|
63
|
+
});
|
|
64
|
+
B.tree !== z && V({
|
|
65
|
+
node: H,
|
|
66
|
+
tree: z
|
|
67
|
+
});
|
|
68
|
+
let W = (e) => e.path.reduce((e, t) => g(e, String(t)), k), G = (e) => n(e.schema, O, e.data), K = (e) => e != null && e.$ref ? _(O, e.$ref, O) ?? e : e, q = (e) => {
|
|
69
|
+
if (!l.enabled || l.readonly) return !1;
|
|
70
|
+
for (let r = 0; r <= e.path.length; r += 2) {
|
|
71
|
+
var t, n;
|
|
72
|
+
let i = o(z, e.path.slice(0, r));
|
|
73
|
+
if (!i || G(i).readOnly || r < e.path.length && (t = K((n = G(i).properties) == null ? void 0 : n[P.childrenProperty])) != null && t.readOnly) return !1;
|
|
74
|
+
}
|
|
75
|
+
return !0;
|
|
76
|
+
}, J = (e) => {
|
|
77
|
+
var t;
|
|
78
|
+
if (!e.path.length || !q(e)) return !1;
|
|
79
|
+
let n = r(z, e.path), i = K((t = G(n).properties) == null ? void 0 : t[P.childrenProperty]);
|
|
80
|
+
return q(n) && !(i != null && i.readOnly) && n.children.length > ((i == null ? void 0 : i.minItems) ?? 0);
|
|
81
|
+
}, Y = (e) => {
|
|
82
|
+
var t;
|
|
83
|
+
return K((t = G(e).properties) == null ? void 0 : t[P.labelProperty]);
|
|
84
|
+
}, X = (e) => {
|
|
85
|
+
let t = Y(e);
|
|
86
|
+
return q(e) && t && !t.readOnly && t.const === void 0 && (!t.type || t.type === "string");
|
|
87
|
+
}, Z = (e, t) => {
|
|
88
|
+
if (!t.trim()) return I("additionalProperties.nameRequired");
|
|
89
|
+
let n = Y(e);
|
|
90
|
+
if (!n) return I("additionalProperties.nameInvalid", { name: t });
|
|
91
|
+
try {
|
|
92
|
+
if (R && !R.validate(n, t)) return I("additionalProperties.nameInvalid", { name: t });
|
|
93
|
+
} catch {
|
|
94
|
+
return I("additionalProperties.nameInvalid", { name: t });
|
|
95
|
+
}
|
|
96
|
+
}, Q = u.useRef({
|
|
97
|
+
tree: z,
|
|
98
|
+
props: l,
|
|
99
|
+
canDelete: J,
|
|
100
|
+
canRename: X,
|
|
101
|
+
validateRename: Z
|
|
102
|
+
});
|
|
103
|
+
p(() => {
|
|
104
|
+
Q.current = {
|
|
105
|
+
tree: z,
|
|
106
|
+
props: l,
|
|
107
|
+
canDelete: J,
|
|
108
|
+
canRename: X,
|
|
109
|
+
validateRename: Z
|
|
110
|
+
};
|
|
111
|
+
});
|
|
112
|
+
let te = (e) => {
|
|
113
|
+
J(e) && F.request({
|
|
114
|
+
operation: "delete",
|
|
115
|
+
catalogId: "mixed",
|
|
116
|
+
discarded: [e.data],
|
|
117
|
+
options: A.options,
|
|
118
|
+
config: j,
|
|
119
|
+
perform: () => {
|
|
120
|
+
let t = Q.current, n = o(t.tree, e.path);
|
|
121
|
+
n && n.data === e.data && t.canDelete(n) && t.props.handleChange(t.props.path, a(t.props.data, n.path));
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}, ne = (e, t) => {
|
|
125
|
+
let n = Q.current, r = o(n.tree, e.path);
|
|
126
|
+
r && r.data === e.data && n.canRename(r) && !n.validateRename(r, t) && n.props.handleChange(g(W(r), P.labelProperty), t);
|
|
127
|
+
}, re = m(() => [
|
|
128
|
+
{
|
|
129
|
+
tester: (e) => {
|
|
130
|
+
var t;
|
|
131
|
+
return (t = e.options) != null && t.recursiveTreeNodeLink ? 100 : -1;
|
|
132
|
+
},
|
|
133
|
+
renderer: C
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
tester: (e, t, n) => {
|
|
137
|
+
var r, i;
|
|
138
|
+
return !((r = e.options) != null && r.recursiveTreeChildren) && (i = e.scope) != null && i.endsWith("/properties/" + P.childrenProperty.replace(/~/g, "~0").replace(/\//g, "~1")) && v("array")(e, t, n) ? 100 : -1;
|
|
139
|
+
},
|
|
140
|
+
renderer: w
|
|
141
|
+
},
|
|
142
|
+
...l.renderers ?? []
|
|
143
|
+
], [l.renderers, P.childrenProperty]), $ = e(P.detail, L.uischemas ?? [], H.schema, "#", W(H), O, {
|
|
144
|
+
type: "Control",
|
|
145
|
+
scope: "#",
|
|
146
|
+
label: M
|
|
147
|
+
});
|
|
148
|
+
return N ? /* @__PURE__ */ u.createElement(S.Provider, { value: {
|
|
149
|
+
Link: T,
|
|
150
|
+
labelProperty: P.labelProperty,
|
|
151
|
+
select: (e) => {
|
|
152
|
+
let t = (n) => W(n) === e ? n : n.children.map(t).find(Boolean), n = t(z);
|
|
153
|
+
n && U(n);
|
|
154
|
+
}
|
|
155
|
+
} }, /* @__PURE__ */ u.createElement("div", {
|
|
156
|
+
"data-recursive-tree": !0,
|
|
157
|
+
style: {
|
|
158
|
+
display: "flex",
|
|
159
|
+
flexWrap: "wrap",
|
|
160
|
+
gap: 16,
|
|
161
|
+
alignItems: "flex-start"
|
|
162
|
+
}
|
|
163
|
+
}, /* @__PURE__ */ u.createElement("div", { style: {
|
|
164
|
+
flex: "1 1 240px",
|
|
165
|
+
minWidth: 0
|
|
166
|
+
} }, /* @__PURE__ */ u.createElement(d, {
|
|
167
|
+
domainTree: !0,
|
|
168
|
+
root: z,
|
|
169
|
+
selectedPath: H.path,
|
|
170
|
+
onSelect: U,
|
|
171
|
+
canDelete: J,
|
|
172
|
+
canRename: X,
|
|
173
|
+
onDelete: te,
|
|
174
|
+
onRename: ne,
|
|
175
|
+
validateRename: Z,
|
|
176
|
+
renderIndicator: (e) => /* @__PURE__ */ u.createElement(ee, {
|
|
177
|
+
path: W(e),
|
|
178
|
+
options: A.options,
|
|
179
|
+
config: j
|
|
180
|
+
})
|
|
181
|
+
})), /* @__PURE__ */ u.createElement("div", {
|
|
182
|
+
"data-recursive-tree-detail": !0,
|
|
183
|
+
style: {
|
|
184
|
+
flex: "3 1 360px",
|
|
185
|
+
minWidth: 0
|
|
186
|
+
}
|
|
187
|
+
}, /* @__PURE__ */ u.createElement(y, {
|
|
188
|
+
key: s(H.path),
|
|
189
|
+
schema: H.schema,
|
|
190
|
+
path: W(H),
|
|
191
|
+
enabled: l.enabled,
|
|
192
|
+
renderers: re,
|
|
193
|
+
cells: l.cells,
|
|
194
|
+
uischema: {
|
|
195
|
+
...$,
|
|
196
|
+
options: {
|
|
197
|
+
...$.options,
|
|
198
|
+
recursiveTree: void 0
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}))), F.dialog) : null;
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
export { E as createRecursiveTreeRenderer, T as recursiveTreeTester };
|
|
205
|
+
|
|
206
|
+
//# sourceMappingURL=RecursiveTreeRenderer.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecursiveTreeRenderer.esm.js","names":["React","Navigation","createContext","NodeLink","withJsonFormsControlProps","navigation","useContext","path","data","ChildrenLinks","JsonFormsDispatch","props","recursiveTreeTester","_ui$options","ui","createRecursiveTreeRenderer","NodeIndicator","validation","useContainerValidation","config","Indicator","_context$core","options","uischema","confirmation","useConfirmation","t","useI18n","context","useJsonForms","ajv","tree","useMemo","buildRecursiveTree","schema","rootSchema","label","selection","setSelection","useState","selected","recursiveTreeSelection","select","nodePath","node","composePaths","p","segment","branch","recursiveNodeSchema","resolve","candidate","resolveSchema","writable","length","_resolve","_branch$properties","ancestor","findMixedTreeNode","canDelete","_branch$properties2","parent","recursiveTreeParent","collection","nameSchema","_branch$properties3","canRename","field","validateRename","name","current","onDelete","now","target","deleteMixedTreeNode","onRename","registry","_ui$options2","_ui$options3","_ui$scope","schemaTypeIs","detail","resolveEditorDetail","visible","find","found","Tree","mixedPathKey"],"sources":["../../src/mixed/RecursiveTreeRenderer.tsx"],"sourcesContent":["import React, {\n useLayoutEffect,\n createContext,\n useContext,\n useMemo,\n useState,\n} from 'react';\nimport { resolveEditorDetail } from '../core/detailUiSchema';\nimport {\n ControlProps,\n JsonSchema7,\n ControlElement,\n JsonFormsRendererRegistryEntry,\n RankedTester,\n composePaths,\n schemaTypeIs,\n resolveSchema,\n} from '@jsonforms/core';\nimport {\n JsonFormsDispatch,\n withJsonFormsControlProps,\n useJsonForms,\n} from '@jsonforms/react';\nimport {\n buildRecursiveTree,\n recursiveTreeSelection,\n recursiveTreeParent,\n recursiveNodeSchema,\n} from './recursiveTree';\nimport {\n MixedTreeNode,\n MixedTreePath,\n mixedPathKey,\n deleteMixedTreeNode,\n findMixedTreeNode,\n} from './mixedTree';\nimport { useI18n } from '../locale/translate';\nimport {\n ConfirmationCatalogId,\n ConfirmationOperation,\n} from '../interaction/confirmation';\nimport { useContainerValidation } from '../validation/validationIndicator';\n\nexport type MixedTreeProps = {\n root: MixedTreeNode;\n selectedPath: MixedTreePath;\n onSelect: (node: MixedTreeNode) => void;\n canDelete: (node: MixedTreeNode) => boolean;\n canRename: (node: MixedTreeNode) => boolean;\n onDelete: (node: MixedTreeNode) => void;\n onRename: (node: MixedTreeNode, name: string) => void;\n validateRename: (node: MixedTreeNode, name: string) => string | undefined;\n domainTree?: boolean;\n renderIndicator?: (node: MixedTreeNode) => React.ReactNode;\n};\ntype LinkProps = { children: React.ReactNode; onClick: () => void };\nconst Navigation = createContext<{\n select: (path: string) => void;\n labelProperty: string;\n Link: React.ComponentType<LinkProps>;\n} | null>(null);\n\nconst NodeLink = withJsonFormsControlProps(({ data, path }: ControlProps) => {\n const navigation = useContext(Navigation)!;\n return (\n <navigation.Link onClick={() => navigation.select(path)}>\n {typeof data?.[navigation.labelProperty] === 'string' &&\n data[navigation.labelProperty].trim()\n ? data[navigation.labelProperty]\n : String(Number(path.split('.').pop()) + 1)}\n </navigation.Link>\n );\n});\n\n// Keep native array actions, defaults, permissions and confirmation. Only the\n// row detail is replaced with navigation to the child's editor.\nconst ChildrenLinks = withJsonFormsControlProps((props: ControlProps) => (\n <JsonFormsDispatch\n schema={props.schema}\n path={props.path}\n enabled={props.enabled}\n renderers={props.renderers}\n cells={props.cells}\n uischema={\n {\n ...props.uischema,\n scope: '#',\n options: {\n ...props.uischema.options,\n recursiveTreeChildren: true,\n table: false,\n format: undefined,\n collapsed: false,\n detail: {\n type: 'Control',\n scope: '#',\n options: { recursiveTreeNodeLink: true },\n },\n },\n } as ControlElement\n }\n />\n));\n\nexport const recursiveTreeTester: RankedTester = (ui) =>\n ui.type === 'Control' &&\n ui.options?.recursiveTree &&\n typeof ui.options.recursiveTree.childrenProperty === 'string' &&\n typeof ui.options.recursiveTree.labelProperty === 'string'\n ? 30\n : -1;\n\nexport const createRecursiveTreeRenderer = (\n Tree: React.ComponentType<MixedTreeProps>,\n Indicator: React.ComponentType<{ count?: number }>,\n Link: React.ComponentType<LinkProps>,\n useConfirmation: () => {\n request: (request: {\n operation: ConfirmationOperation;\n catalogId: ConfirmationCatalogId;\n discarded: unknown[];\n options?: Record<string, unknown>;\n config?: unknown;\n perform: () => void;\n }) => void;\n dialog: React.ReactNode;\n },\n) => {\n const NodeIndicator = ({ path, options, config }: any) => {\n const validation = useContainerValidation(\n { type: 'Control', scope: '#', options } as ControlElement,\n path,\n config,\n false,\n );\n return validation.show ? <Indicator count={validation.count} /> : null;\n };\n const RecursiveTree = (props: ControlProps) => {\n const { data, schema, rootSchema, path, uischema, config, label, visible } =\n props;\n const options = uischema.options!.recursiveTree;\n const confirmation = useConfirmation();\n const t = useI18n();\n const context = useJsonForms();\n const ajv = context.core?.ajv;\n const tree = useMemo(\n () =>\n buildRecursiveTree(\n data,\n schema,\n rootSchema,\n options.childrenProperty,\n options.labelProperty,\n label || t('control.value'),\n ),\n [\n data,\n schema,\n rootSchema,\n options.childrenProperty,\n options.labelProperty,\n label,\n t,\n ],\n );\n const [selection, setSelection] = useState<{\n node: MixedTreeNode;\n tree: MixedTreeNode;\n }>({ node: tree, tree });\n const selected =\n selection.tree === tree\n ? selection.node\n : recursiveTreeSelection(tree, selection.node, selection.tree);\n const select = (node: MixedTreeNode) => setSelection({ node, tree });\n // Updating this remembered snapshot prevents a later mutation from comparing\n // against an obsolete array index after an external reorder.\n if (selection.tree !== tree) setSelection({ node: selected, tree });\n const nodePath = (node: MixedTreeNode) =>\n node.path.reduce<string>(\n (p, segment) => composePaths(p, String(segment)),\n path,\n );\n const branch = (node: MixedTreeNode) =>\n recursiveNodeSchema(node.schema, rootSchema, node.data);\n const resolve = (candidate: any) =>\n candidate?.$ref\n ? (resolveSchema(rootSchema, candidate.$ref, rootSchema) ?? candidate)\n : candidate;\n const writable = (node: MixedTreeNode) => {\n if (!props.enabled || props.readonly) return false;\n for (let length = 0; length <= node.path.length; length += 2) {\n const ancestor = findMixedTreeNode(tree, node.path.slice(0, length));\n if (!ancestor || (branch(ancestor) as JsonSchema7).readOnly)\n return false;\n if (\n length < node.path.length &&\n resolve(branch(ancestor).properties?.[options.childrenProperty])\n ?.readOnly\n )\n return false;\n }\n return true;\n };\n const canDelete = (node: MixedTreeNode) => {\n if (!node.path.length || !writable(node)) return false;\n const parent = recursiveTreeParent(tree, node.path);\n const collection = resolve(\n branch(parent).properties?.[options.childrenProperty],\n );\n return (\n writable(parent) &&\n !collection?.readOnly &&\n parent.children.length > (collection?.minItems ?? 0)\n );\n };\n const nameSchema = (node: MixedTreeNode) =>\n resolve(branch(node).properties?.[options.labelProperty]);\n const canRename = (node: MixedTreeNode) => {\n const field = nameSchema(node);\n return (\n writable(node) &&\n field &&\n !field.readOnly &&\n field.const === undefined &&\n (!field.type || field.type === 'string')\n );\n };\n const validateRename = (node: MixedTreeNode, name: string) => {\n if (!name.trim()) return t('additionalProperties.nameRequired');\n const field = nameSchema(node);\n if (!field) return t('additionalProperties.nameInvalid', { name });\n try {\n if (ajv && !ajv.validate(field, name))\n return t('additionalProperties.nameInvalid', { name });\n } catch {\n return t('additionalProperties.nameInvalid', { name });\n }\n return undefined;\n };\n // Confirmation callbacks must use current permissions and data, and must\n // never delete a replacement item that now occupies the original index.\n const current = React.useRef({\n tree,\n props,\n canDelete,\n canRename,\n validateRename,\n });\n useLayoutEffect(() => {\n current.current = { tree, props, canDelete, canRename, validateRename };\n });\n const onDelete = (node: MixedTreeNode) => {\n if (!canDelete(node)) return;\n confirmation.request({\n operation: 'delete',\n catalogId: 'mixed',\n discarded: [node.data],\n options: uischema.options,\n config,\n perform: () => {\n const now = current.current;\n const target = findMixedTreeNode(now.tree, node.path);\n if (!target || target.data !== node.data || !now.canDelete(target))\n return;\n now.props.handleChange(\n now.props.path,\n deleteMixedTreeNode(now.props.data, target.path),\n );\n },\n });\n };\n const onRename = (node: MixedTreeNode, name: string) => {\n const now = current.current;\n const target = findMixedTreeNode(now.tree, node.path);\n if (\n !target ||\n target.data !== node.data ||\n !now.canRename(target) ||\n now.validateRename(target, name)\n )\n return;\n now.props.handleChange(\n composePaths(nodePath(target), options.labelProperty),\n name,\n );\n };\n const registry = useMemo<JsonFormsRendererRegistryEntry[]>(\n () => [\n {\n tester: (ui) => (ui.options?.recursiveTreeNodeLink ? 100 : -1),\n renderer: NodeLink,\n },\n {\n tester: (ui, candidate, context) =>\n !ui.options?.recursiveTreeChildren &&\n (ui as ControlElement).scope?.endsWith(\n '/properties/' +\n options.childrenProperty\n .replace(/~/g, '~0')\n .replace(/\\//g, '~1'),\n ) &&\n schemaTypeIs('array')(ui, candidate, context)\n ? 100\n : -1,\n renderer: ChildrenLinks,\n },\n ...(props.renderers ?? []),\n ],\n [props.renderers, options.childrenProperty],\n );\n const detail = resolveEditorDetail(\n options.detail,\n context.uischemas ?? [],\n selected.schema,\n '#',\n nodePath(selected),\n rootSchema,\n { type: 'Control', scope: '#', label } as ControlElement,\n );\n if (!visible) return null;\n return (\n <Navigation.Provider\n value={{\n Link,\n labelProperty: options.labelProperty,\n select: (target) => {\n const find = (node: MixedTreeNode): MixedTreeNode | undefined =>\n nodePath(node) === target\n ? node\n : node.children.map(find).find(Boolean);\n const found = find(tree);\n if (found) select(found);\n },\n }}\n >\n <div\n data-recursive-tree\n style={{\n display: 'flex',\n flexWrap: 'wrap',\n gap: 16,\n alignItems: 'flex-start',\n }}\n >\n <div style={{ flex: '1 1 240px', minWidth: 0 }}>\n <Tree\n domainTree\n root={tree}\n selectedPath={selected.path}\n onSelect={select}\n canDelete={canDelete}\n canRename={canRename}\n onDelete={onDelete}\n onRename={onRename}\n validateRename={validateRename}\n renderIndicator={(node) => (\n <NodeIndicator\n path={nodePath(node)}\n options={uischema.options}\n config={config}\n />\n )}\n />\n </div>\n <div\n data-recursive-tree-detail\n style={{ flex: '3 1 360px', minWidth: 0 }}\n >\n <JsonFormsDispatch\n key={mixedPathKey(selected.path)}\n schema={selected.schema}\n path={nodePath(selected)}\n enabled={props.enabled}\n renderers={registry}\n cells={props.cells}\n uischema={{\n ...detail,\n options: { ...detail.options, recursiveTree: undefined },\n }}\n />\n </div>\n </div>\n {confirmation.dialog}\n </Navigation.Provider>\n );\n };\n return withJsonFormsControlProps(RecursiveTree);\n};\n"],"mappings":";;;;;;;;;AAwDA,IAAMC,IAAaC,EAIT,IAAI,GAERC,IAAWC,GAA2B,EAAE,SAAM,cAAyB;CAC3E,IAAMC,IAAaC,EAAWL,CAAU;CACxC,OACE,kBAAA,cAACI,EAAW,MAAZ,EAAiB,eAAeA,EAAW,OAAOE,CAAI,EAKrC,GAJd,QAAAC,KAAA,OAAA,KAAA,IAAOA,EAAOH,EAAW,mBAAmB,YAC7CG,EAAKH,EAAW,cAAc,CAAC,KAAK,IAChCG,EAAKH,EAAW,iBAChB,OAAO,OAAOE,EAAK,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAC7B;AAErB,CAAC,GAIKE,IAAgBL,GAA2B,MAC/C,kBAAA,cAACM,GAAD;CACE,QAAQC,EAAM;CACd,MAAMA,EAAM;CACZ,SAASA,EAAM;CACf,WAAWA,EAAM;CACjB,OAAOA,EAAM;CACb,UACE;EACE,GAAGA,EAAM;EACT,OAAO;EACP,SAAS;GACP,GAAGA,EAAM,SAAS;GAClB,uBAAuB;GACvB,OAAO;GACP,QAAQ,KAAA;GACR,WAAW;GACX,QAAQ;IACN,MAAM;IACN,OAAO;IACP,SAAS,EAAE,uBAAuB,GAAK;GACzC;EACF;CACF;AAEH,CAAA,CACF,GAEYC,KAAqC,MAChD;;CAAG,OAAAE,EAAA,SAAS,cAAA,IACZA,EAAG,YAAA,QAAAD,EAAS,iBACZ,OAAOC,EAAG,QAAQ,cAAc,oBAAqB,YACrD,OAAOA,EAAG,QAAQ,cAAc,iBAAkB,WAC9C,KACA;AAAC,GAEMC,KACX,GACA,GACA,GACA,MAWG;CACH,IAAMC,MAAiB,EAAE,SAAM,YAAS,gBAAkB;EACxD,IAAMC,IAAaC,EACjB;GAAE,MAAM;GAAW,OAAO;GAAK;EAAQ,GACvCX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/B,QAAQA,EAAS;GACjB,MAAMG,EAASH,CAAQ;GACvB,SAAS7B,EAAM;GACf,WAAWiE;GACX,OAAOjE,EAAM;GACb,UAAU;IACR,GAAGsE;IACH,SAAS;KAAE,GAAGA,EAAO;KAAS,eAAe,KAAA;IAAU;GACzD;EACD,CAAA,CACE,CACF,GACJzD,EAAa,MACK,IAhEF;CAkEvB,CAC8C;AAChD"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./mixedSchema.cjs.js");let t=require("@jsonforms/core");var n=({data:n,path:r,schema:i,rootSchema:a,uischema:o,config:s,handleChange:c,arrayElement:l,selectedType:u,selectNumericType:d,setSelectedPath:f,setExpanded:p,requestConfirmation:m})=>{let h=e=>m({operation:`typeChange`,catalogId:`mixed`,discarded:[n],options:o==null?void 0:o.options,config:s,perform:e});return o=>{if(!o){if(l)return;h(()=>{c(r,void 0),f([])});return}if(o===u)return;if(typeof n==`number`&&(o===`number`||o===`integer`)){d(o);return}let s=e.schemaForType(i,o,a);h(()=>{(o===`number`||o===`integer`)&&d(o),c(r,(0,t.createDefaultValue)(s,a)),f([]),(o===`object`||o===`array`)&&p(!0)})}};exports.createMixedTypeChangeHandler=n;
|
|
2
|
+
//# sourceMappingURL=createMixedTypeChangeHandler.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMixedTypeChangeHandler.cjs.js","names":["schemaForType","createDefaultValue","require_mixed_mixedSchema","_jsonforms_core","createMixedTypeChangeHandler","requestTypeChange","requestConfirmation","data","uischema","nextType","arrayElement","handleChange","path","setSelectedPath","selectedType","selectNumericType","nextSchema","schema","rootSchema","setExpanded"],"sources":["../../src/mixed/createMixedTypeChangeHandler.ts"],"sourcesContent":["import { createDefaultValue, type ControlProps } from '@jsonforms/core';\nimport type { Dispatch, SetStateAction } from 'react';\nimport { schemaForType, type JsonDataType } from './mixedSchema';\nimport type { MixedTreePath } from './mixedTree';\n\nimport type { ConfirmationRequest } from '../interaction/confirmation';\n\ntype MixedTypeChangeOptions = Pick<\n ControlProps,\n | 'data'\n | 'path'\n | 'schema'\n | 'rootSchema'\n | 'uischema'\n | 'config'\n | 'handleChange'\n> & {\n arrayElement: boolean;\n selectedType: JsonDataType | null;\n selectNumericType: (type: JsonDataType) => void;\n setSelectedPath: Dispatch<SetStateAction<MixedTreePath>>;\n setExpanded: (expanded: boolean) => void;\n requestConfirmation: (request: ConfirmationRequest) => void;\n};\n\n/** Shared type changes keep array positions intact and confirm discarded values. */\nexport const createMixedTypeChangeHandler = ({\n data,\n path,\n schema,\n rootSchema,\n uischema,\n config,\n handleChange,\n arrayElement,\n selectedType,\n selectNumericType,\n setSelectedPath,\n setExpanded,\n requestConfirmation,\n}: MixedTypeChangeOptions) => {\n const requestTypeChange = (perform: () => void) =>\n requestConfirmation({\n operation: 'typeChange',\n catalogId: 'mixed',\n discarded: [data],\n options: uischema?.options,\n config,\n perform,\n });\n return (nextType?: JsonDataType) => {\n if (!nextType) {\n if (arrayElement) return;\n requestTypeChange(() => {\n handleChange(path, undefined);\n setSelectedPath([]);\n });\n return;\n }\n if (nextType === selectedType) return;\n if (\n typeof data === 'number' &&\n (nextType === 'number' || nextType === 'integer')\n ) {\n selectNumericType(nextType);\n return;\n }\n const nextSchema = schemaForType(schema, nextType, rootSchema);\n requestTypeChange(() => {\n if (nextType === 'number' || nextType === 'integer')\n selectNumericType(nextType);\n handleChange(path, createDefaultValue(nextSchema, rootSchema));\n setSelectedPath([]);\n if (nextType === 'object' || nextType === 'array') setExpanded(true);\n });\n };\n};\n"],"mappings":"A,4IA0BA,IAAaI,GAAgC,CAC3C,OACA,OACA,SACA,aACA,WACA,SACA,eACA,eACA,eACA,oBACA,kBACA,cACA,yBAC4B,CAC5B,IAAMC,EAAqB,GACzBC,EAAoB,CAClB,UAAW,aACX,UAAW,QACX,UAAW,CAACC,CAAI,EAChB,QAAAC,GAAA,KAAA,IAAA,GAASA,EAAU,QACnB,SACA,SACF,CAAC,EACH,MAAQ,IAA4B,CAClC,GAAI,CAACC,EAAU,CACb,GAAIC,EAAc,OAClBL,MAAwB,CACtBM,EAAaC,EAAM,IAAA,EAAS,EAC5BC,EAAgB,CAAC,CAAC,CACpB,CAAC,EACD,MACF,CACA,GAAIJ,IAAaK,EAAc,OAC/B,GACE,OAAOP,GAAS,WACfE,IAAa,UAAYA,IAAa,WACvC,CACAM,EAAkBN,CAAQ,EAC1B,MACF,CACA,IAAMO,EAAahB,EAAAA,cAAciB,EAAQR,EAAUS,CAAU,EAC7Db,MAAwB,EAClBI,IAAa,UAAYA,IAAa,YACxCM,EAAkBN,CAAQ,EAC5BE,EAAaC,GAAA,EAAMX,EAAAA,mBAAAA,CAAmBe,EAAYE,CAAU,CAAC,EAC7DL,EAAgB,CAAC,CAAC,GACdJ,IAAa,UAAYA,IAAa,UAASU,EAAY,EAAI,CACrE,CAAC,CACH,CACF,E"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ControlProps } from '@jsonforms/core';
|
|
2
|
+
import type { Dispatch, SetStateAction } from 'react';
|
|
3
|
+
import { type JsonDataType } from './mixedSchema';
|
|
4
|
+
import type { MixedTreePath } from './mixedTree';
|
|
5
|
+
import type { ConfirmationRequest } from '../interaction/confirmation';
|
|
6
|
+
type MixedTypeChangeOptions = Pick<ControlProps, 'data' | 'path' | 'schema' | 'rootSchema' | 'uischema' | 'config' | 'handleChange'> & {
|
|
7
|
+
arrayElement: boolean;
|
|
8
|
+
selectedType: JsonDataType | null;
|
|
9
|
+
selectNumericType: (type: JsonDataType) => void;
|
|
10
|
+
setSelectedPath: Dispatch<SetStateAction<MixedTreePath>>;
|
|
11
|
+
setExpanded: (expanded: boolean) => void;
|
|
12
|
+
requestConfirmation: (request: ConfirmationRequest) => void;
|
|
13
|
+
};
|
|
14
|
+
/** Shared type changes keep array positions intact and confirm discarded values. */
|
|
15
|
+
export declare const createMixedTypeChangeHandler: ({ data, path, schema, rootSchema, uischema, config, handleChange, arrayElement, selectedType, selectNumericType, setSelectedPath, setExpanded, requestConfirmation, }: MixedTypeChangeOptions) => (nextType?: JsonDataType) => void;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { schemaForType as e } from "./mixedSchema.esm.js";
|
|
2
|
+
import { createDefaultValue as t } from "@jsonforms/core";
|
|
3
|
+
// src/mixed/createMixedTypeChangeHandler.ts
|
|
4
|
+
var n = ({ data: n, path: r, schema: i, rootSchema: a, uischema: o, config: s, handleChange: c, arrayElement: l, selectedType: u, selectNumericType: d, setSelectedPath: f, setExpanded: p, requestConfirmation: m }) => {
|
|
5
|
+
let h = (e) => m({
|
|
6
|
+
operation: "typeChange",
|
|
7
|
+
catalogId: "mixed",
|
|
8
|
+
discarded: [n],
|
|
9
|
+
options: o == null ? void 0 : o.options,
|
|
10
|
+
config: s,
|
|
11
|
+
perform: e
|
|
12
|
+
});
|
|
13
|
+
return (o) => {
|
|
14
|
+
if (!o) {
|
|
15
|
+
if (l) return;
|
|
16
|
+
h(() => {
|
|
17
|
+
c(r, void 0), f([]);
|
|
18
|
+
});
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (o === u) return;
|
|
22
|
+
if (typeof n == "number" && (o === "number" || o === "integer")) {
|
|
23
|
+
d(o);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
let s = e(i, o, a);
|
|
27
|
+
h(() => {
|
|
28
|
+
(o === "number" || o === "integer") && d(o), c(r, t(s, a)), f([]), (o === "object" || o === "array") && p(!0);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export { n as createMixedTypeChangeHandler };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=createMixedTypeChangeHandler.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMixedTypeChangeHandler.esm.js","names":["createMixedTypeChangeHandler","requestTypeChange","requestConfirmation","data","uischema","nextType","arrayElement","handleChange","path","setSelectedPath","selectedType","nextSchema","schemaForType","schema","rootSchema","selectNumericType","createDefaultValue","setExpanded"],"sources":["../../src/mixed/createMixedTypeChangeHandler.ts"],"sourcesContent":["import { createDefaultValue, type ControlProps } from '@jsonforms/core';\nimport type { Dispatch, SetStateAction } from 'react';\nimport { schemaForType, type JsonDataType } from './mixedSchema';\nimport type { MixedTreePath } from './mixedTree';\n\nimport type { ConfirmationRequest } from '../interaction/confirmation';\n\ntype MixedTypeChangeOptions = Pick<\n ControlProps,\n | 'data'\n | 'path'\n | 'schema'\n | 'rootSchema'\n | 'uischema'\n | 'config'\n | 'handleChange'\n> & {\n arrayElement: boolean;\n selectedType: JsonDataType | null;\n selectNumericType: (type: JsonDataType) => void;\n setSelectedPath: Dispatch<SetStateAction<MixedTreePath>>;\n setExpanded: (expanded: boolean) => void;\n requestConfirmation: (request: ConfirmationRequest) => void;\n};\n\n/** Shared type changes keep array positions intact and confirm discarded values. */\nexport const createMixedTypeChangeHandler = ({\n data,\n path,\n schema,\n rootSchema,\n uischema,\n config,\n handleChange,\n arrayElement,\n selectedType,\n selectNumericType,\n setSelectedPath,\n setExpanded,\n requestConfirmation,\n}: MixedTypeChangeOptions) => {\n const requestTypeChange = (perform: () => void) =>\n requestConfirmation({\n operation: 'typeChange',\n catalogId: 'mixed',\n discarded: [data],\n options: uischema?.options,\n config,\n perform,\n });\n return (nextType?: JsonDataType) => {\n if (!nextType) {\n if (arrayElement) return;\n requestTypeChange(() => {\n handleChange(path, undefined);\n setSelectedPath([]);\n });\n return;\n }\n if (nextType === selectedType) return;\n if (\n typeof data === 'number' &&\n (nextType === 'number' || nextType === 'integer')\n ) {\n selectNumericType(nextType);\n return;\n }\n const nextSchema = schemaForType(schema, nextType, rootSchema);\n requestTypeChange(() => {\n if (nextType === 'number' || nextType === 'integer')\n selectNumericType(nextType);\n handleChange(path, createDefaultValue(nextSchema, rootSchema));\n setSelectedPath([]);\n if (nextType === 'object' || nextType === 'array') setExpanded(true);\n });\n };\n};\n"],"mappings":";;;AA0BA,IAAaA,KAAgC,EAC3C,SACA,SACA,WACA,eACA,aACA,WACA,iBACA,iBACA,iBACA,sBACA,oBACA,gBACA,6BAC4B;CAC5B,IAAMC,KAAqB,MACzBC,EAAoB;EAClB,WAAW;EACX,WAAW;EACX,WAAW,CAACC,CAAI;EAChB,SAAAC,KAAA,OAAA,KAAA,IAASA,EAAU;EACnB;EACA;CACF,CAAC;CACH,QAAQ,MAA4B;EAClC,IAAI,CAACC,GAAU;GACb,IAAIC,GAAc;GAClB,QAAwB;IAEtB,AADAC,EAAaC,GAAM,KAAA,CAAS,GAC5BC,EAAgB,CAAC,CAAC;GACpB,CAAC;GACD;EACF;EACA,IAAIJ,MAAaK,GAAc;EAC/B,IACE,OAAOP,KAAS,aACfE,MAAa,YAAYA,MAAa,YACvC;GACA,EAAkBA,CAAQ;GAC1B;EACF;EACA,IAAMM,IAAaC,EAAcC,GAAQR,GAAUS,CAAU;EAC7D,QAAwB;GAKtB,CAJIT,MAAa,YAAYA,MAAa,cACxCU,EAAkBV,CAAQ,GAC5BE,EAAaC,GAAMQ,EAAmBL,GAAYG,CAAU,CAAC,GAC7DL,EAAgB,CAAC,CAAC,IACdJ,MAAa,YAAYA,MAAa,YAASY,EAAY,EAAI;EACrE,CAAC;CACH;AACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=(e,t)=>t===`null`?e===null:t===`array`?Array.isArray(e):t===`object`?typeof e==`object`&&!!e&&!Array.isArray(e):t===`integer`?typeof e==`number`&&Number.isInteger(e):typeof e===t,t=(n,r,i={remaining:256})=>{var a;if(typeof n==`boolean`)return n&&{type:r};if(--i.remaining<0)return n;let o=n;if(o.$ref)return n;let s=Array.isArray(o.type)?o.type:o.type?[o.type]:[];if(!(s.length===0||s.some(e=>e===r||e===`number`&&r===`integer`||e===`integer`&&r===`number`))||`const`in o&&!e(o.const,r))return!1;let c=(a=o.enum)==null?void 0:a.filter(t=>e(t,r));if((c==null?void 0:c.length)===0)return!1;let l={...o,...c?{enum:c}:{},type:r===`number`&&s.includes(`integer`)&&!s.includes(`number`)?`integer`:r};for(let e of[`allOf`,`anyOf`,`oneOf`]){let n=o[e];if(!n)continue;let a=n.map(e=>t(e,r,i)),s=e===`allOf`?a:a.filter(e=>e!==!1);l[e]=s.length?s.map(e=>typeof e==`boolean`?{type:r,not:{}}:e):[{type:r,not:{}}]}return l};exports.narrowMixedComposition=t;
|
|
2
|
+
//# sourceMappingURL=mixedComposition.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mixedComposition.cjs.js","names":["valueMatchesType","type","value","narrowMixedComposition","_source$enum","schema","budget","source","declared","candidate","choices","next","keyword","branches","narrowed","branch","retained"],"sources":["../../src/mixed/mixedComposition.ts"],"sourcesContent":["import { JsonSchema, JsonSchema7 } from '@jsonforms/core';\n\nconst valueMatchesType = (value: unknown, type: string): boolean => {\n if (type === 'null') return value === null;\n if (type === 'array') return Array.isArray(value);\n if (type === 'object')\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n if (type === 'integer')\n return typeof value === 'number' && Number.isInteger(value);\n return typeof value === type;\n};\n\n/** Narrow only schemas applying to the current value, never property/item schemas.\n * The budget bounds analysis; unresolved references and conditions stay intact.\n */\nexport const narrowMixedComposition = (\n schema: JsonSchema,\n type: string,\n budget = { remaining: 256 },\n): JsonSchema => {\n if (typeof schema === 'boolean') {\n return schema ? { type: type as JsonSchema7['type'] } : schema;\n }\n if (--budget.remaining < 0) return schema;\n const source = schema as JsonSchema7;\n // Draft-07 ignores siblings of $ref. Do not infer compatibility from them.\n if (source.$ref) return schema;\n const declared = Array.isArray(source.type)\n ? source.type\n : source.type\n ? [source.type]\n : [];\n const compatible =\n declared.length === 0 ||\n declared.some(\n (candidate) =>\n candidate === type ||\n (candidate === 'number' && type === 'integer') ||\n (candidate === 'integer' && type === 'number'),\n );\n if (!compatible) return false as unknown as JsonSchema;\n if ('const' in source && !valueMatchesType(source.const, type))\n return false as unknown as JsonSchema;\n const choices = source.enum?.filter((value) => valueMatchesType(value, type));\n if (choices?.length === 0) return false as unknown as JsonSchema;\n const next: JsonSchema7 = {\n ...source,\n ...(choices ? { enum: choices } : {}),\n type: (type === 'number' &&\n declared.includes('integer') &&\n !declared.includes('number')\n ? 'integer'\n : type) as JsonSchema7['type'],\n };\n for (const keyword of ['allOf', 'anyOf', 'oneOf'] as const) {\n const branches = source[keyword];\n if (!branches) continue;\n const narrowed = branches.map((branch) =>\n narrowMixedComposition(branch, type, budget),\n );\n // False alternatives contribute no matches, including to oneOf's count.\n // A false allOf branch must remain: the conjunction is impossible.\n const retained =\n keyword === 'allOf'\n ? narrowed\n : narrowed.filter((branch) => branch !== (false as unknown));\n next[keyword] = retained.length\n ? retained.map((branch) =>\n typeof branch === 'boolean'\n ? { type: type as JsonSchema7['type'], not: {} }\n : (branch as JsonSchema7),\n )\n : [{ type: type as JsonSchema7['type'], not: {} }];\n }\n return next;\n};\n"],"mappings":"A,mEAEA,IAAMA,GAAoB,EAAgB,IACpCC,IAAS,OAAeC,IAAU,KAClCD,IAAS,QAAgB,MAAM,QAAQC,CAAK,EAC5CD,IAAS,SACc,OAAOC,GAAU,YAAnCA,GAA+C,CAAC,MAAM,QAAQA,CAAK,EACxED,IAAS,UACJ,OAAOC,GAAU,UAAY,OAAO,UAAUA,CAAK,EACrD,OAAOA,IAAUD,EAMbE,GACX,EACA,EACA,EAAS,CAAE,UAAW,GAAI,IACX,C,MACf,GAAI,OAAOE,GAAW,UACpB,OAAOA,GAAS,CAAQ,MAA4B,EAEtD,GAAI,EAAEC,EAAO,UAAY,EAAG,OAAOD,EACnC,IAAME,EAASF,EAEf,GAAIE,EAAO,KAAM,OAAOF,EACxB,IAAMG,EAAW,MAAM,QAAQD,EAAO,IAAI,EACtCA,EAAO,KACPA,EAAO,KACL,CAACA,EAAO,IAAI,EACZ,CAAC,EAUP,GADI,EAPFC,EAAS,SAAW,GACpBA,EAAS,KACN,GACCC,IAAcR,GACbQ,IAAc,UAAYR,IAAS,WACnCQ,IAAc,WAAaR,IAAS,QACzC,IAEE,UAAWM,GAAU,CAACP,EAAiBO,EAAO,MAAON,CAAI,EAC3D,MAAO,GACT,IAAMS,GAAA,EAAUH,EAAO,OAAA,KAAA,IAAA,GAAAH,EAAM,OAAQ,GAAUJ,EAAiBE,EAAOD,CAAI,CAAC,EAC5E,IAAAS,GAAA,KAAA,IAAA,GAAIA,EAAS,UAAW,EAAG,MAAO,GAClC,IAAMC,EAAoB,CACxB,GAAGJ,EACH,GAAIG,EAAU,CAAE,KAAMA,CAAQ,EAAI,CAAC,EACnC,KAAOT,IAAS,UAChBO,EAAS,SAAS,SAAS,GAC3B,CAACA,EAAS,SAAS,QAAQ,EACvB,UACAP,CACN,EACA,IAAK,IAAMW,IAAW,CAAC,QAAS,QAAS,OAAO,EAAY,CAC1D,IAAMC,EAAWN,EAAOK,GACxB,GAAI,CAACC,EAAU,SACf,IAAMC,EAAWD,EAAS,IAAK,GAC7BV,EAAuBY,EAAQd,EAAMK,CAAM,CAC7C,EAGMU,EACJJ,IAAY,QACRE,EACAA,EAAS,OAAQ,GAAWC,IAAY,EAAiB,EAC/D,EAAKH,GAAWI,EAAS,OACrBA,EAAS,IAAK,GACZ,OAAOD,GAAW,UACd,CAAQ,OAA6B,IAAK,CAAC,CAAE,EAC5CA,CACP,EACA,CAAC,CAAQ,OAA6B,IAAK,CAAC,CAAE,CAAC,CACrD,CACA,OAAOJ,CACT,E"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { JsonSchema } from '@jsonforms/core';
|
|
2
|
+
/** Narrow only schemas applying to the current value, never property/item schemas.
|
|
3
|
+
* The budget bounds analysis; unresolved references and conditions stay intact.
|
|
4
|
+
*/
|
|
5
|
+
export declare const narrowMixedComposition: (schema: JsonSchema, type: string, budget?: {
|
|
6
|
+
remaining: number;
|
|
7
|
+
}) => JsonSchema;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// src/mixed/mixedComposition.ts
|
|
2
|
+
var e = (e, t) => t === "null" ? e === null : t === "array" ? Array.isArray(e) : t === "object" ? typeof e == "object" && !!e && !Array.isArray(e) : t === "integer" ? typeof e == "number" && Number.isInteger(e) : typeof e === t, t = (n, r, i = { remaining: 256 }) => {
|
|
3
|
+
var a;
|
|
4
|
+
if (typeof n == "boolean") return n && { type: r };
|
|
5
|
+
if (--i.remaining < 0) return n;
|
|
6
|
+
let o = n;
|
|
7
|
+
if (o.$ref) return n;
|
|
8
|
+
let s = Array.isArray(o.type) ? o.type : o.type ? [o.type] : [];
|
|
9
|
+
if (!(s.length === 0 || s.some((e) => e === r || e === "number" && r === "integer" || e === "integer" && r === "number")) || "const" in o && !e(o.const, r)) return !1;
|
|
10
|
+
let c = (a = o.enum) == null ? void 0 : a.filter((t) => e(t, r));
|
|
11
|
+
if ((c == null ? void 0 : c.length) === 0) return !1;
|
|
12
|
+
let l = {
|
|
13
|
+
...o,
|
|
14
|
+
...c ? { enum: c } : {},
|
|
15
|
+
type: r === "number" && s.includes("integer") && !s.includes("number") ? "integer" : r
|
|
16
|
+
};
|
|
17
|
+
for (let e of [
|
|
18
|
+
"allOf",
|
|
19
|
+
"anyOf",
|
|
20
|
+
"oneOf"
|
|
21
|
+
]) {
|
|
22
|
+
let n = o[e];
|
|
23
|
+
if (!n) continue;
|
|
24
|
+
let a = n.map((e) => t(e, r, i)), s = e === "allOf" ? a : a.filter((e) => e !== !1);
|
|
25
|
+
l[e] = s.length ? s.map((e) => typeof e == "boolean" ? {
|
|
26
|
+
type: r,
|
|
27
|
+
not: {}
|
|
28
|
+
} : e) : [{
|
|
29
|
+
type: r,
|
|
30
|
+
not: {}
|
|
31
|
+
}];
|
|
32
|
+
}
|
|
33
|
+
return l;
|
|
34
|
+
};
|
|
35
|
+
export { t as narrowMixedComposition };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=mixedComposition.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mixedComposition.esm.js","names":["valueMatchesType","type","value","narrowMixedComposition","_source$enum","schema","budget","source","declared","candidate","choices","next","keyword","branches","narrowed","branch","retained"],"sources":["../../src/mixed/mixedComposition.ts"],"sourcesContent":["import { JsonSchema, JsonSchema7 } from '@jsonforms/core';\n\nconst valueMatchesType = (value: unknown, type: string): boolean => {\n if (type === 'null') return value === null;\n if (type === 'array') return Array.isArray(value);\n if (type === 'object')\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n if (type === 'integer')\n return typeof value === 'number' && Number.isInteger(value);\n return typeof value === type;\n};\n\n/** Narrow only schemas applying to the current value, never property/item schemas.\n * The budget bounds analysis; unresolved references and conditions stay intact.\n */\nexport const narrowMixedComposition = (\n schema: JsonSchema,\n type: string,\n budget = { remaining: 256 },\n): JsonSchema => {\n if (typeof schema === 'boolean') {\n return schema ? { type: type as JsonSchema7['type'] } : schema;\n }\n if (--budget.remaining < 0) return schema;\n const source = schema as JsonSchema7;\n // Draft-07 ignores siblings of $ref. Do not infer compatibility from them.\n if (source.$ref) return schema;\n const declared = Array.isArray(source.type)\n ? source.type\n : source.type\n ? [source.type]\n : [];\n const compatible =\n declared.length === 0 ||\n declared.some(\n (candidate) =>\n candidate === type ||\n (candidate === 'number' && type === 'integer') ||\n (candidate === 'integer' && type === 'number'),\n );\n if (!compatible) return false as unknown as JsonSchema;\n if ('const' in source && !valueMatchesType(source.const, type))\n return false as unknown as JsonSchema;\n const choices = source.enum?.filter((value) => valueMatchesType(value, type));\n if (choices?.length === 0) return false as unknown as JsonSchema;\n const next: JsonSchema7 = {\n ...source,\n ...(choices ? { enum: choices } : {}),\n type: (type === 'number' &&\n declared.includes('integer') &&\n !declared.includes('number')\n ? 'integer'\n : type) as JsonSchema7['type'],\n };\n for (const keyword of ['allOf', 'anyOf', 'oneOf'] as const) {\n const branches = source[keyword];\n if (!branches) continue;\n const narrowed = branches.map((branch) =>\n narrowMixedComposition(branch, type, budget),\n );\n // False alternatives contribute no matches, including to oneOf's count.\n // A false allOf branch must remain: the conjunction is impossible.\n const retained =\n keyword === 'allOf'\n ? narrowed\n : narrowed.filter((branch) => branch !== (false as unknown));\n next[keyword] = retained.length\n ? retained.map((branch) =>\n typeof branch === 'boolean'\n ? { type: type as JsonSchema7['type'], not: {} }\n : (branch as JsonSchema7),\n )\n : [{ type: type as JsonSchema7['type'], not: {} }];\n }\n return next;\n};\n"],"mappings":";AAEA,IAAMA,KAAoB,GAAgB,MACpCC,MAAS,SAAeC,MAAU,OAClCD,MAAS,UAAgB,MAAM,QAAQC,CAAK,IAC5CD,MAAS,WACc,OAAOC,KAAU,cAAnCA,KAA+C,CAAC,MAAM,QAAQA,CAAK,IACxED,MAAS,YACJ,OAAOC,KAAU,YAAY,OAAO,UAAUA,CAAK,IACrD,OAAOA,MAAUD,GAMbE,KACX,GACA,GACA,IAAS,EAAE,WAAW,IAAI,MACX;;CACf,IAAI,OAAOE,KAAW,WACpB,OAAOA,KAAS,EAAQ,QAA4B;CAEtD,IAAI,EAAEC,EAAO,YAAY,GAAG,OAAOD;CACnC,IAAME,IAASF;CAEf,IAAIE,EAAO,MAAM,OAAOF;CACxB,IAAMG,IAAW,MAAM,QAAQD,EAAO,IAAI,IACtCA,EAAO,OACPA,EAAO,OACL,CAACA,EAAO,IAAI,IACZ,CAAC;CAUP,IADI,EAPFC,EAAS,WAAW,KACpBA,EAAS,MACN,MACCC,MAAcR,KACbQ,MAAc,YAAYR,MAAS,aACnCQ,MAAc,aAAaR,MAAS,QACzC,MAEE,WAAWM,KAAU,CAACP,EAAiBO,EAAO,OAAON,CAAI,GAC3D,OAAO;CACT,IAAMS,KAAA,IAAUH,EAAO,SAAA,OAAA,KAAA,IAAAH,EAAM,QAAQ,MAAUJ,EAAiBE,GAAOD,CAAI,CAAC;CAC5E,KAAAS,KAAA,OAAA,KAAA,IAAIA,EAAS,YAAW,GAAG,OAAO;CAClC,IAAMC,IAAo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