@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,21 @@
|
|
|
1
|
+
import { useMemo as e } from "react";
|
|
2
|
+
// src/mixed/useMixedNavigation.ts
|
|
3
|
+
var t = (t, n, r, i) => e(() => ({ selectPath: (e) => {
|
|
4
|
+
if (!n) return;
|
|
5
|
+
let a = (n) => {
|
|
6
|
+
if ([t, ...n.path].filter((e) => e !== "").join(".") === e) return n;
|
|
7
|
+
for (let e of n.children) {
|
|
8
|
+
let t = a(e);
|
|
9
|
+
if (t) return t;
|
|
10
|
+
}
|
|
11
|
+
}, o = a(n);
|
|
12
|
+
o && (r(o.path), i(!0));
|
|
13
|
+
} }), [
|
|
14
|
+
t,
|
|
15
|
+
n,
|
|
16
|
+
i,
|
|
17
|
+
r
|
|
18
|
+
]);
|
|
19
|
+
export { t as useMixedNavigation };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=useMixedNavigation.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMixedNavigation.esm.js","names":["useMixedNavigation","useMemo","tree","findByDataPath","path","node","segment","targetPath","child","found","target","setSelectedPath","setExpanded"],"sources":["../../src/mixed/useMixedNavigation.ts"],"sourcesContent":["import { useMemo, type Dispatch, type SetStateAction } from 'react';\nimport type { MixedTreeNode, MixedTreePath } from './mixedTree';\n\n/** Maps a descendant data path back to its tree node without selecting an unrelated node. */\nexport const useMixedNavigation = (\n path: string,\n tree: MixedTreeNode | undefined,\n setSelectedPath: Dispatch<SetStateAction<MixedTreePath>>,\n setExpanded: (expanded: boolean) => void,\n) =>\n useMemo(\n () => ({\n selectPath: (targetPath: string) => {\n if (!tree) return;\n const findByDataPath = (\n node: MixedTreeNode,\n ): MixedTreeNode | undefined => {\n const nodePath = [path, ...node.path]\n .filter((segment) => segment !== '')\n .join('.');\n if (nodePath === targetPath) return node;\n for (const child of node.children) {\n const found = findByDataPath(child);\n if (found) return found;\n }\n return undefined;\n };\n const target = findByDataPath(tree);\n if (target) {\n setSelectedPath(target.path);\n setExpanded(true);\n }\n },\n }),\n [path, tree, setExpanded, setSelectedPath],\n );\n"],"mappings":";;AAIA,IAAaA,KACX,GACA,GACA,GACA,MAEAC,SACS,EACL,aAAa,MAAuB;CAClC,IAAI,CAACC,GAAM;CACX,IAAMC,KACJ,MAC8B;EAI9B,IAHiB,CAACC,GAAM,GAAGC,EAAK,IAAI,CAAC,CAClC,QAAQ,MAAYC,MAAY,EAAE,CAAC,CACnC,KAAK,GACJ,MAAaC,GAAY,OAAOF;EACpC,KAAK,IAAMG,KAASH,EAAK,UAAU;GACjC,IAAMI,IAAQN,EAAeK,CAAK;GAClC,IAAIC,GAAO,OAAOA;EACpB;CAEF,GACMC,IAASP,EAAeD,CAAI;CAClC,AAAIQ,MACFC,EAAgBD,EAAO,IAAI,GAC3BE,EAAY,EAAI;AAEpB,EACF,IACA;CAACR;CAAMF;CAAMU;CAAaD;AAAe,CAC3C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./mixedTreeActions.cjs.js"),t=require("./mixedTree.cjs.js"),n=require("./useMixedNavigation.cjs.js"),r=require("./createMixedTypeChangeHandler.cjs.js"),i=require("../core/detailUiSchema.cjs.js"),a=require("../validation/validationIndicator.cjs.js"),o=require("../layout/groupState.cjs.js"),s=require("./useMixedType.cjs.js"),c=require("./mixedSchema.cjs.js"),l=require("../objects/dynamicProperties.cjs.js"),u=require("../locale/translate.cjs.js");let d=require("react"),f=require("@jsonforms/core"),p=require("@jsonforms/react");var m=e=>(0,f.isControl)(e)&&e.scope===`#`?{...e,label:!1}:e;function h(e,n,r,i,a){let o=u.useI18n()(`control.value`),[s,c]=(0,d.useState)([]),l=(0,d.useMemo)(()=>i&&(a===`object`||a===`array`)?t.buildMixedTree(e,i,r,n||o):void 0,[e,n,o,r,i,a]),f=l&&t.findMixedTreeNode(l,s);return l&&s.length>0&&!f&&c([]),{tree:l,selectedPath:s,selectedNode:f??l,setSelectedPath:c}}function g({schema:e,rootSchema:t,uischema:n,path:r},a,o){let s=(0,d.useMemo)(()=>a?c.schemaForType(e,a,t):void 0,[t,e,a]);return{selectedSchema:s,detailUiSchema:(0,d.useMemo)(()=>{var e,c;return s?i.findMixedDetailUiSchema(s,{...n,options:{...n.options,detail:((e=n.options)==null?void 0:e[`${a}-detail`])??((c=n.options)==null?void 0:c.detail)}},r,t,o):void 0},[r,t,s,a,n,o])}}function _({schema:e,data:t,path:n,enabled:r,readonly:i,errors:a,required:o},l){let u=(0,d.useMemo)(()=>c.getSchemaTypes(e),[e]),{selectedType:f,selectNumericType:p}=s.useMixedType(t,u,n),m=f===`integer`&&typeof t==`number`&&!Number.isInteger(t)?l(`mixed.integerRequired`):void 0;return{types:u,selectedType:f,selectNumericType:p,numericError:m,selector:{disabled:!r||!!i,error:m??(f?void 0:a),fullWidth:!f,required:o,types:u,value:f}}}var v=(i,s)=>{var f,v,y;let{cells:b,enabled:x,readonly:S,renderers:C,handleChange:w,data:T,config:E,label:ee,path:D,rootSchema:O,schema:k,uischema:A}=i,j=(0,p.useJsonForms)(),M=((f=A.options)==null?void 0:f.structuredLayout)??(E==null||(v=E.jsonformsExtended)==null||(v=v.mixed)==null?void 0:v.structuredLayout)??`tree`,N=a.useContainerValidation({...A,scope:`#`},D,E,!1),P=u.useI18n(),F=(0,d.useMemo)(()=>j.uischemas??[],[j.uischemas]),{collapsible:I,collapsed:L,setExpanded:R}=o.useGroupExpansion(A,E,!0,`mixed`),te=!L,{types:ne,selectedType:z,selectNumericType:B,numericError:V,selector:H}=_(i,P),{selectedSchema:U,detailUiSchema:W}=g(i,z,F),{tree:G,selectedPath:K,selectedNode:q,setSelectedPath:J}=h(T,ee,O,U,z),Y=l.useDynamicProperty(D),X=c.isArrayElementPath((y=j.core)==null?void 0:y.data,D),re=r.createMixedTypeChangeHandler({data:T,path:D,schema:k,rootSchema:O,uischema:A,config:E,handleChange:w,arrayElement:X,selectedType:z,selectNumericType:B,setSelectedPath:J,setExpanded:R,requestConfirmation:s}),ie=n.useMixedNavigation(D,G,J,R),ae={...H,clearable:!Y&&!X,onChange:e=>re(e)},Z=(0,d.useRef)({data:T,path:D,enabled:x,readonly:S});(0,d.useLayoutEffect)(()=>{Z.current={data:T,path:D,enabled:x,readonly:S}},[T,D,x,S]);let Q={...E,...A.options},oe=Q.restrict!==!1,$=t=>e.canDeleteMixedTreeNode(G,t,O,x,S,oe);return{appliedOptions:Q,canDeleteNode:$,canRenameNode:t=>e.canRenameMixedTreeNode(t,x,S),deleteNode:e=>{$(e)&&s({operation:`delete`,catalogId:`mixed`,discarded:[e.data],options:A==null?void 0:A.options,config:E,perform:()=>{$(e)&&Z.current.data===T&&Z.current.path===D&&Z.current.enabled&&!Z.current.readonly&&(w(D,t.deleteMixedTreeNode(T,e.path)),J(e.path.slice(0,-1)))}})},renameNode:(e,n)=>{w(D,t.renameMixedTreeNode(T,e.path,n)),J([...e.path.slice(0,-1),n])},selectorProps:ae,navigation:ie,nodeEditorProps:{rootSchema:O,handleChange:w},detailProps:{path:D,enabled:x,readonly:S,renderers:C,cells:b,detailUiSchema:W,withoutControlLabel:m},jsonforms:j,structuredLayout:M,validation:N,t:P,uischemas:F,collapsible:I,collapsed:L,setExpanded:R,expanded:te,selectedPath:K,setSelectedPath:J,types:ne,selectedType:z,selectNumericType:B,numericError:V,selectedSchema:U,detailUiSchema:W,tree:G,selectedNode:q,preserveDynamicPropertyKey:Y,withoutControlLabel:m}};exports.useMixedRenderer=v;
|
|
2
|
+
//# sourceMappingURL=useMixedRenderer.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMixedRenderer.cjs.js","names":["isControl","useI18n","useState","useMemo","buildMixedTree","findMixedTreeNode","schemaForType","findMixedDetailUiSchema","getSchemaTypes","useMixedType","useJsonForms","useContainerValidation","useGroupExpansion","useDynamicProperty","isArrayElementPath","createMixedTypeChangeHandler","useMixedNavigation","useRef","canDeleteMixedTreeNode","canRenameMixedTreeNode","deleteMixedTreeNode","renameMixedTreeNode","require_mixed_mixedTreeActions","require_mixed_mixedTree","require_mixed_useMixedNavigation","require_mixed_createMixedTypeChangeHandler","require_core_detailUiSchema","require_validation_validationIndicator","require_layout_groupState","require_mixed_useMixedType","require_mixed_mixedSchema","require_objects_dynamicProperties","require_locale_translate","react","_jsonforms_core","_jsonforms_react","withoutControlLabel","element","useMixedTreeSelection","fallbackLabel","selectedPath","setSelectedPath","tree","selectedSchema","selectedType","data","rootSchema","label","matchedNode","useMixedDetailSchema","schema","_uischema$options","_uischema$options2","uischema","path","uischemas","useMixedTypeOptions","types","numericError","t","enabled","readonly","errors","useMixedRenderer","_uischema$options3","_config$jsonformsExte","_jsonforms$core","props","jsonforms","structuredLayout","config","validation","expanded","collapsed","preserveDynamicPropertyKey","arrayElement","changeType","navigation","setExpanded","selectorProps","selector","value","latest","appliedOptions","restrict","canDeleteNode","node","requestConfirmation","handleChange","nextName"],"sources":["../../src/mixed/useMixedRenderer.ts"],"sourcesContent":["import {\n canDeleteMixedTreeNode,\n canRenameMixedTreeNode,\n} from './mixedTreeActions';\nimport {\n deleteMixedTreeNode,\n renameMixedTreeNode,\n type MixedTreeNode,\n buildMixedTree,\n findMixedTreeNode,\n type MixedTreePath,\n} from './mixedTree';\nimport type { ConfirmationRequest } from '../interaction/confirmation';\nimport { useMixedNavigation } from './useMixedNavigation';\nimport { createMixedTypeChangeHandler } from './createMixedTypeChangeHandler';\nimport { useLayoutEffect, useRef, useMemo, useState } from 'react';\nimport { findMixedDetailUiSchema } from '../core/detailUiSchema';\nimport { useContainerValidation } from '../validation/validationIndicator';\nimport { useGroupExpansion } from '../layout/groupState';\nimport { useMixedType } from './useMixedType';\nimport {\n getSchemaTypes,\n schemaForType,\n isArrayElementPath,\n type JsonDataType,\n} from './mixedSchema';\nimport { useDynamicProperty } from '../objects/dynamicProperties';\nimport { useI18n } from '../locale/translate';\nimport {\n isControl,\n type ControlProps,\n type UISchemaElement,\n} from '@jsonforms/core';\nimport { useJsonForms } from '@jsonforms/react';\n\nconst withoutControlLabel = (element: UISchemaElement): UISchemaElement =>\n isControl(element) && element.scope === '#'\n ? { ...element, label: false }\n : element;\n\nfunction useMixedTreeSelection(\n data: ControlProps['data'],\n label: ControlProps['label'],\n rootSchema: ControlProps['rootSchema'],\n selectedSchema: ControlProps['schema'] | undefined,\n selectedType: JsonDataType | null | undefined,\n) {\n const t = useI18n();\n const fallbackLabel = t('control.value');\n const [selectedPath, setSelectedPath] = useState<MixedTreePath>([]);\n const tree = useMemo(\n () =>\n selectedSchema && (selectedType === 'object' || selectedType === 'array')\n ? buildMixedTree(\n data,\n selectedSchema,\n rootSchema,\n label || fallbackLabel,\n )\n : undefined,\n [data, label, fallbackLabel, rootSchema, selectedSchema, selectedType],\n );\n const matchedNode = tree && findMixedTreeNode(tree, selectedPath);\n if (tree && selectedPath.length > 0 && !matchedNode) setSelectedPath([]);\n return {\n tree,\n selectedPath,\n selectedNode: matchedNode ?? tree,\n setSelectedPath,\n };\n}\n\nfunction useMixedDetailSchema(\n { schema, rootSchema, uischema, path }: ControlProps,\n selectedType: ReturnType<typeof useMixedType>['selectedType'],\n uischemas: NonNullable<ReturnType<typeof useJsonForms>['uischemas']>,\n) {\n const selectedSchema = useMemo(\n () =>\n selectedType\n ? schemaForType(schema, selectedType, rootSchema)\n : undefined,\n [rootSchema, schema, selectedType],\n );\n const detailUiSchema = useMemo(\n () =>\n selectedSchema\n ? findMixedDetailUiSchema(\n selectedSchema,\n {\n ...uischema,\n options: {\n ...uischema.options,\n detail:\n uischema.options?.[`${selectedType}-detail`] ??\n uischema.options?.detail,\n },\n },\n path,\n rootSchema,\n uischemas,\n )\n : undefined,\n [path, rootSchema, selectedSchema, selectedType, uischema, uischemas],\n );\n return { selectedSchema, detailUiSchema };\n}\n\nfunction useMixedTypeOptions(\n { schema, data, path, enabled, readonly, errors, required }: ControlProps,\n t: ReturnType<typeof useI18n>,\n) {\n const types = useMemo(() => getSchemaTypes(schema), [schema]);\n const { selectedType, selectNumericType } = useMixedType(data, types, path);\n const numericError =\n selectedType === 'integer' &&\n typeof data === 'number' &&\n !Number.isInteger(data)\n ? t('mixed.integerRequired')\n : undefined;\n const selector = {\n disabled: !enabled || Boolean(readonly),\n error: numericError ?? (!selectedType ? errors : undefined),\n fullWidth: !selectedType,\n required,\n types,\n value: selectedType,\n };\n return { types, selectedType, selectNumericType, numericError, selector };\n}\n\nexport const useMixedRenderer = (\n props: ControlProps,\n requestConfirmation: (request: ConfirmationRequest) => void,\n) => {\n const {\n cells,\n enabled,\n readonly,\n renderers,\n handleChange,\n data,\n config,\n label,\n path,\n rootSchema,\n schema,\n uischema,\n } = props;\n const jsonforms = useJsonForms();\n const structuredLayout =\n uischema.options?.structuredLayout ??\n config?.jsonformsExtended?.mixed?.structuredLayout ??\n 'tree';\n const validation = useContainerValidation(\n { ...uischema, scope: '#' },\n path,\n config,\n false,\n );\n const t = useI18n();\n const uischemas = useMemo(\n () => jsonforms.uischemas ?? [],\n [jsonforms.uischemas],\n );\n const { collapsible, collapsed, setExpanded } = useGroupExpansion(\n uischema,\n config,\n true,\n 'mixed',\n );\n const expanded = !collapsed;\n const { types, selectedType, selectNumericType, numericError, selector } =\n useMixedTypeOptions(props, t);\n const { selectedSchema, detailUiSchema } = useMixedDetailSchema(\n props,\n selectedType,\n uischemas,\n );\n const { tree, selectedPath, selectedNode, setSelectedPath } =\n useMixedTreeSelection(\n data,\n label,\n rootSchema,\n selectedSchema,\n selectedType,\n );\n const preserveDynamicPropertyKey = useDynamicProperty(path);\n const arrayElement = isArrayElementPath(jsonforms.core?.data, path);\n const changeType = 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 });\n const navigation = useMixedNavigation(\n path,\n tree,\n setSelectedPath,\n setExpanded,\n );\n const selectorProps = {\n ...selector,\n clearable: !preserveDynamicPropertyKey && !arrayElement,\n onChange: (value: string | undefined) =>\n changeType(value as JsonDataType | undefined),\n };\n const latest = useRef({ data, path, enabled, readonly });\n useLayoutEffect(() => {\n latest.current = { data, path, enabled, readonly };\n }, [data, path, enabled, readonly]);\n const appliedOptions = { ...config, ...uischema.options };\n const restrict = appliedOptions.restrict !== false;\n const canDeleteNode = (node: MixedTreeNode) =>\n canDeleteMixedTreeNode(tree, node, rootSchema, enabled, readonly, restrict);\n const canRenameNode = (node: MixedTreeNode) =>\n canRenameMixedTreeNode(node, enabled, readonly);\n const deleteNode = (node: MixedTreeNode) => {\n if (!canDeleteNode(node)) return;\n /*\n \"Tree Delete in the mixed workspace uses mixed\" - the owner of the action,\n not whichever renderer happens to draw the row. Fallback `always`.\n */\n requestConfirmation({\n operation: 'delete',\n catalogId: 'mixed',\n discarded: [node.data],\n options: uischema?.options,\n config,\n perform: () => {\n // Re-checked after confirmation: the guard, and the node still being\n // there, are both current rather than remembered.\n if (\n !canDeleteNode(node) ||\n latest.current.data !== data ||\n latest.current.path !== path ||\n !latest.current.enabled ||\n latest.current.readonly\n )\n return;\n handleChange(path, deleteMixedTreeNode(data, node.path));\n setSelectedPath(node.path.slice(0, -1));\n },\n });\n };\n const renameNode = (node: MixedTreeNode, nextName: string) => {\n handleChange(path, renameMixedTreeNode(data, node.path, nextName));\n setSelectedPath([...node.path.slice(0, -1), nextName]);\n };\n\n return {\n appliedOptions,\n canDeleteNode,\n canRenameNode,\n deleteNode,\n renameNode,\n selectorProps,\n navigation,\n nodeEditorProps: { rootSchema, handleChange },\n detailProps: {\n path,\n enabled,\n readonly,\n renderers,\n cells,\n detailUiSchema,\n withoutControlLabel,\n },\n jsonforms,\n structuredLayout,\n validation,\n t,\n uischemas,\n collapsible,\n collapsed,\n setExpanded,\n expanded,\n selectedPath,\n setSelectedPath,\n types,\n selectedType,\n selectNumericType,\n numericError,\n selectedSchema,\n detailUiSchema,\n tree,\n selectedNode,\n preserveDynamicPropertyKey,\n withoutControlLabel,\n };\n};\n"],"mappings":"A,smBAmCA,IAAMoC,EAAuB,IAAA,EAC3BpC,EAAAA,UAAAA,CAAUqC,CAAO,GAAKA,EAAQ,QAAU,IACpC,CAAE,GAAGA,EAAS,MAAO,EAAM,EAC3BA,EAEN,SAASC,EACP,EACA,EACA,EACA,EACA,EACA,CAEA,IAAMC,EADItC,EAAAA,QACY,CAAA,CAAE,eAAe,EACjC,CAACuC,EAAcC,IAAA,EAAmBvC,EAAAA,SAAAA,CAAwB,CAAC,CAAC,EAC5DwC,GAAA,EAAOvC,EAAAA,QAAAA,KAETwC,IAAmBC,IAAiB,UAAYA,IAAiB,SAC7DxC,EAAAA,eACEyC,EACAF,EACAG,EACAC,GAASR,CACX,EACA,IAAA,GACN,CAACM,EAAME,EAAOR,EAAeO,EAAYH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WACA,YACA,QACA,iBACA,qBACF,EACA,YACA,mBACA,aACA,IACA,YACA,cACA,YACA,cACA,YACA,eACA,kBACA,SACA,eACA,oBACA,eACA,iBACA,iBACA,OACA,eACA,6BACA,qBACF,CACF,E"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type MixedTreeNode, type MixedTreePath } from './mixedTree';
|
|
2
|
+
import type { ConfirmationRequest } from '../interaction/confirmation';
|
|
3
|
+
import { type JsonDataType } from './mixedSchema';
|
|
4
|
+
import { type ControlProps, type UISchemaElement } from '@jsonforms/core';
|
|
5
|
+
export declare const useMixedRenderer: (props: ControlProps, requestConfirmation: (request: ConfirmationRequest) => void) => {
|
|
6
|
+
appliedOptions: any;
|
|
7
|
+
canDeleteNode: (node: MixedTreeNode) => boolean;
|
|
8
|
+
canRenameNode: (node: MixedTreeNode) => boolean;
|
|
9
|
+
deleteNode: (node: MixedTreeNode) => void;
|
|
10
|
+
renameNode: (node: MixedTreeNode, nextName: string) => void;
|
|
11
|
+
selectorProps: {
|
|
12
|
+
clearable: boolean;
|
|
13
|
+
onChange: (value: string | undefined) => void;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
error: string | undefined;
|
|
16
|
+
fullWidth: boolean;
|
|
17
|
+
required: boolean | undefined;
|
|
18
|
+
types: JsonDataType[];
|
|
19
|
+
value: JsonDataType | null;
|
|
20
|
+
};
|
|
21
|
+
navigation: {
|
|
22
|
+
selectPath: (targetPath: string) => void;
|
|
23
|
+
};
|
|
24
|
+
nodeEditorProps: {
|
|
25
|
+
rootSchema: import("@jsonforms/core").JsonSchema;
|
|
26
|
+
handleChange: (path: string, value: any) => void;
|
|
27
|
+
};
|
|
28
|
+
detailProps: {
|
|
29
|
+
path: string;
|
|
30
|
+
enabled: boolean;
|
|
31
|
+
readonly: boolean | undefined;
|
|
32
|
+
renderers: import("@jsonforms/core").JsonFormsRendererRegistryEntry[] | undefined;
|
|
33
|
+
cells: {
|
|
34
|
+
tester: import("@jsonforms/core").RankedTester;
|
|
35
|
+
cell: any;
|
|
36
|
+
}[] | undefined;
|
|
37
|
+
detailUiSchema: import("@jsonforms/core").BaseUISchemaElement | undefined;
|
|
38
|
+
withoutControlLabel: (element: UISchemaElement) => UISchemaElement;
|
|
39
|
+
};
|
|
40
|
+
jsonforms: import("@jsonforms/react").JsonFormsStateContext;
|
|
41
|
+
structuredLayout: any;
|
|
42
|
+
validation: import("..").ContainerValidation;
|
|
43
|
+
t: (key: import("..").I18nKey, values?: Record<string, unknown>) => string;
|
|
44
|
+
uischemas: import("@jsonforms/core").JsonFormsUISchemaRegistryEntry[];
|
|
45
|
+
collapsible: boolean;
|
|
46
|
+
collapsed: boolean;
|
|
47
|
+
setExpanded: (expanded: boolean) => void;
|
|
48
|
+
expanded: boolean;
|
|
49
|
+
selectedPath: MixedTreePath;
|
|
50
|
+
setSelectedPath: import("react").Dispatch<import("react").SetStateAction<MixedTreePath>>;
|
|
51
|
+
types: JsonDataType[];
|
|
52
|
+
selectedType: JsonDataType | null;
|
|
53
|
+
selectNumericType: (type: JsonDataType) => void;
|
|
54
|
+
numericError: string | undefined;
|
|
55
|
+
selectedSchema: import("@jsonforms/core").JsonSchema | undefined;
|
|
56
|
+
detailUiSchema: import("@jsonforms/core").BaseUISchemaElement | undefined;
|
|
57
|
+
tree: MixedTreeNode | undefined;
|
|
58
|
+
selectedNode: MixedTreeNode | undefined;
|
|
59
|
+
preserveDynamicPropertyKey: boolean;
|
|
60
|
+
withoutControlLabel: (element: UISchemaElement) => UISchemaElement;
|
|
61
|
+
};
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { canDeleteMixedTreeNode as e, canRenameMixedTreeNode as t } from "./mixedTreeActions.esm.js";
|
|
2
|
+
import { buildMixedTree as n, deleteMixedTreeNode as r, findMixedTreeNode as i, renameMixedTreeNode as a } from "./mixedTree.esm.js";
|
|
3
|
+
import { useMixedNavigation as o } from "./useMixedNavigation.esm.js";
|
|
4
|
+
import { createMixedTypeChangeHandler as s } from "./createMixedTypeChangeHandler.esm.js";
|
|
5
|
+
import { findMixedDetailUiSchema as c } from "../core/detailUiSchema.esm.js";
|
|
6
|
+
import { useContainerValidation as l } from "../validation/validationIndicator.esm.js";
|
|
7
|
+
import { useGroupExpansion as u } from "../layout/groupState.esm.js";
|
|
8
|
+
import { useMixedType as d } from "./useMixedType.esm.js";
|
|
9
|
+
import { getSchemaTypes as f, isArrayElementPath as p, schemaForType as m } from "./mixedSchema.esm.js";
|
|
10
|
+
import { useDynamicProperty as h } from "../objects/dynamicProperties.esm.js";
|
|
11
|
+
import { useI18n as g } from "../locale/translate.esm.js";
|
|
12
|
+
import { useLayoutEffect as _, useMemo as v, useRef as y, useState as b } from "react";
|
|
13
|
+
import { isControl as x } from "@jsonforms/core";
|
|
14
|
+
import { useJsonForms as ee } from "@jsonforms/react";
|
|
15
|
+
// src/mixed/useMixedRenderer.ts
|
|
16
|
+
var S = (e) => x(e) && e.scope === "#" ? {
|
|
17
|
+
...e,
|
|
18
|
+
label: !1
|
|
19
|
+
} : e;
|
|
20
|
+
function C(e, t, r, a, o) {
|
|
21
|
+
let s = g()("control.value"), [c, l] = b([]), u = v(() => a && (o === "object" || o === "array") ? n(e, a, r, t || s) : void 0, [
|
|
22
|
+
e,
|
|
23
|
+
t,
|
|
24
|
+
s,
|
|
25
|
+
r,
|
|
26
|
+
a,
|
|
27
|
+
o
|
|
28
|
+
]), d = u && i(u, c);
|
|
29
|
+
return u && c.length > 0 && !d && l([]), {
|
|
30
|
+
tree: u,
|
|
31
|
+
selectedPath: c,
|
|
32
|
+
selectedNode: d ?? u,
|
|
33
|
+
setSelectedPath: l
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function te({ schema: e, rootSchema: t, uischema: n, path: r }, i, a) {
|
|
37
|
+
let o = v(() => i ? m(e, i, t) : void 0, [
|
|
38
|
+
t,
|
|
39
|
+
e,
|
|
40
|
+
i
|
|
41
|
+
]);
|
|
42
|
+
return {
|
|
43
|
+
selectedSchema: o,
|
|
44
|
+
detailUiSchema: v(() => {
|
|
45
|
+
var e, s;
|
|
46
|
+
return o ? c(o, {
|
|
47
|
+
...n,
|
|
48
|
+
options: {
|
|
49
|
+
...n.options,
|
|
50
|
+
detail: ((e = n.options) == null ? void 0 : e[`${i}-detail`]) ?? ((s = n.options) == null ? void 0 : s.detail)
|
|
51
|
+
}
|
|
52
|
+
}, r, t, a) : void 0;
|
|
53
|
+
}, [
|
|
54
|
+
r,
|
|
55
|
+
t,
|
|
56
|
+
o,
|
|
57
|
+
i,
|
|
58
|
+
n,
|
|
59
|
+
a
|
|
60
|
+
])
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function ne({ schema: e, data: t, path: n, enabled: r, readonly: i, errors: a, required: o }, s) {
|
|
64
|
+
let c = v(() => f(e), [e]), { selectedType: l, selectNumericType: u } = d(t, c, n), p = l === "integer" && typeof t == "number" && !Number.isInteger(t) ? s("mixed.integerRequired") : void 0;
|
|
65
|
+
return {
|
|
66
|
+
types: c,
|
|
67
|
+
selectedType: l,
|
|
68
|
+
selectNumericType: u,
|
|
69
|
+
numericError: p,
|
|
70
|
+
selector: {
|
|
71
|
+
disabled: !r || !!i,
|
|
72
|
+
error: p ?? (l ? void 0 : a),
|
|
73
|
+
fullWidth: !l,
|
|
74
|
+
required: o,
|
|
75
|
+
types: c,
|
|
76
|
+
value: l
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
var w = (n, i) => {
|
|
81
|
+
var c, d, f;
|
|
82
|
+
let { cells: m, enabled: b, readonly: x, renderers: w, handleChange: T, data: E, config: D, label: re, path: O, rootSchema: k, schema: ie, uischema: A } = n, j = ee(), M = ((c = A.options) == null ? void 0 : c.structuredLayout) ?? (D == null || (d = D.jsonformsExtended) == null || (d = d.mixed) == null ? void 0 : d.structuredLayout) ?? "tree", N = l({
|
|
83
|
+
...A,
|
|
84
|
+
scope: "#"
|
|
85
|
+
}, O, D, !1), P = g(), F = v(() => j.uischemas ?? [], [j.uischemas]), { collapsible: ae, collapsed: I, setExpanded: L } = u(A, D, !0, "mixed"), R = !I, { types: z, selectedType: B, selectNumericType: V, numericError: H, selector: U } = ne(n, P), { selectedSchema: W, detailUiSchema: G } = te(n, B, F), { tree: K, selectedPath: q, selectedNode: oe, setSelectedPath: J } = C(E, re, k, W, B), Y = h(O), X = p((f = j.core) == null ? void 0 : f.data, O), se = s({
|
|
86
|
+
data: E,
|
|
87
|
+
path: O,
|
|
88
|
+
schema: ie,
|
|
89
|
+
rootSchema: k,
|
|
90
|
+
uischema: A,
|
|
91
|
+
config: D,
|
|
92
|
+
handleChange: T,
|
|
93
|
+
arrayElement: X,
|
|
94
|
+
selectedType: B,
|
|
95
|
+
selectNumericType: V,
|
|
96
|
+
setSelectedPath: J,
|
|
97
|
+
setExpanded: L,
|
|
98
|
+
requestConfirmation: i
|
|
99
|
+
}), ce = o(O, K, J, L), le = {
|
|
100
|
+
...U,
|
|
101
|
+
clearable: !Y && !X,
|
|
102
|
+
onChange: (e) => se(e)
|
|
103
|
+
}, Z = y({
|
|
104
|
+
data: E,
|
|
105
|
+
path: O,
|
|
106
|
+
enabled: b,
|
|
107
|
+
readonly: x
|
|
108
|
+
});
|
|
109
|
+
_(() => {
|
|
110
|
+
Z.current = {
|
|
111
|
+
data: E,
|
|
112
|
+
path: O,
|
|
113
|
+
enabled: b,
|
|
114
|
+
readonly: x
|
|
115
|
+
};
|
|
116
|
+
}, [
|
|
117
|
+
E,
|
|
118
|
+
O,
|
|
119
|
+
b,
|
|
120
|
+
x
|
|
121
|
+
]);
|
|
122
|
+
let Q = {
|
|
123
|
+
...D,
|
|
124
|
+
...A.options
|
|
125
|
+
}, ue = Q.restrict !== !1, $ = (t) => e(K, t, k, b, x, ue);
|
|
126
|
+
return {
|
|
127
|
+
appliedOptions: Q,
|
|
128
|
+
canDeleteNode: $,
|
|
129
|
+
canRenameNode: (e) => t(e, b, x),
|
|
130
|
+
deleteNode: (e) => {
|
|
131
|
+
$(e) && i({
|
|
132
|
+
operation: "delete",
|
|
133
|
+
catalogId: "mixed",
|
|
134
|
+
discarded: [e.data],
|
|
135
|
+
options: A == null ? void 0 : A.options,
|
|
136
|
+
config: D,
|
|
137
|
+
perform: () => {
|
|
138
|
+
$(e) && Z.current.data === E && Z.current.path === O && Z.current.enabled && !Z.current.readonly && (T(O, r(E, e.path)), J(e.path.slice(0, -1)));
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
},
|
|
142
|
+
renameNode: (e, t) => {
|
|
143
|
+
T(O, a(E, e.path, t)), J([...e.path.slice(0, -1), t]);
|
|
144
|
+
},
|
|
145
|
+
selectorProps: le,
|
|
146
|
+
navigation: ce,
|
|
147
|
+
nodeEditorProps: {
|
|
148
|
+
rootSchema: k,
|
|
149
|
+
handleChange: T
|
|
150
|
+
},
|
|
151
|
+
detailProps: {
|
|
152
|
+
path: O,
|
|
153
|
+
enabled: b,
|
|
154
|
+
readonly: x,
|
|
155
|
+
renderers: w,
|
|
156
|
+
cells: m,
|
|
157
|
+
detailUiSchema: G,
|
|
158
|
+
withoutControlLabel: S
|
|
159
|
+
},
|
|
160
|
+
jsonforms: j,
|
|
161
|
+
structuredLayout: M,
|
|
162
|
+
validation: N,
|
|
163
|
+
t: P,
|
|
164
|
+
uischemas: F,
|
|
165
|
+
collapsible: ae,
|
|
166
|
+
collapsed: I,
|
|
167
|
+
setExpanded: L,
|
|
168
|
+
expanded: R,
|
|
169
|
+
selectedPath: q,
|
|
170
|
+
setSelectedPath: J,
|
|
171
|
+
types: z,
|
|
172
|
+
selectedType: B,
|
|
173
|
+
selectNumericType: V,
|
|
174
|
+
numericError: H,
|
|
175
|
+
selectedSchema: W,
|
|
176
|
+
detailUiSchema: G,
|
|
177
|
+
tree: K,
|
|
178
|
+
selectedNode: oe,
|
|
179
|
+
preserveDynamicPropertyKey: Y,
|
|
180
|
+
withoutControlLabel: S
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
export { w as useMixedRenderer };
|
|
184
|
+
|
|
185
|
+
//# sourceMappingURL=useMixedRenderer.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMixedRenderer.esm.js","names":["withoutControlLabel","isControl","element","useMixedTreeSelection","fallbackLabel","useI18n","selectedPath","setSelectedPath","useState","tree","useMemo","selectedSchema","selectedType","buildMixedTree","data","rootSchema","label","matchedNode","findMixedTreeNode","useMixedDetailSchema","schemaForType","schema","_uischema$options","_uischema$options2","findMixedDetailUiSchema","uischema","path","uischemas","useMixedTypeOptions","types","getSchemaTypes","useMixedType","numericError","t","enabled","readonly","errors","useMixedRenderer","_uischema$options3","_config$jsonformsExte","_jsonforms$core","props","jsonforms","useJsonForms","structuredLayout","config","validation","useContainerValidation","useGroupExpansion","expanded","collapsed","preserveDynamicPropertyKey","useDynamicProperty","arrayElement","isArrayElementPath","changeType","createMixedTypeChangeHandler","navigation","useMixedNavigation","setExpanded","selectorProps","selector","value","latest","useRef","appliedOptions","restrict","canDeleteNode","canDeleteMixedTreeNode","node","canRenameMixedTreeNode","requestConfirmation","handleChange","deleteMixedTreeNode","renameMixedTreeNode","nextName"],"sources":["../../src/mixed/useMixedRenderer.ts"],"sourcesContent":["import {\n canDeleteMixedTreeNode,\n canRenameMixedTreeNode,\n} from './mixedTreeActions';\nimport {\n deleteMixedTreeNode,\n renameMixedTreeNode,\n type MixedTreeNode,\n buildMixedTree,\n findMixedTreeNode,\n type MixedTreePath,\n} from './mixedTree';\nimport type { ConfirmationRequest } from '../interaction/confirmation';\nimport { useMixedNavigation } from './useMixedNavigation';\nimport { createMixedTypeChangeHandler } from './createMixedTypeChangeHandler';\nimport { useLayoutEffect, useRef, useMemo, useState } from 'react';\nimport { findMixedDetailUiSchema } from '../core/detailUiSchema';\nimport { useContainerValidation } from '../validation/validationIndicator';\nimport { useGroupExpansion } from '../layout/groupState';\nimport { useMixedType } from './useMixedType';\nimport {\n getSchemaTypes,\n schemaForType,\n isArrayElementPath,\n type JsonDataType,\n} from './mixedSchema';\nimport { useDynamicProperty } from '../objects/dynamicProperties';\nimport { useI18n } from '../locale/translate';\nimport {\n isControl,\n type ControlProps,\n type UISchemaElement,\n} from '@jsonforms/core';\nimport { useJsonForms } from '@jsonforms/react';\n\nconst withoutControlLabel = (element: UISchemaElement): UISchemaElement =>\n isControl(element) && element.scope === '#'\n ? { ...element, label: false }\n : element;\n\nfunction useMixedTreeSelection(\n data: ControlProps['data'],\n label: ControlProps['label'],\n rootSchema: ControlProps['rootSchema'],\n selectedSchema: ControlProps['schema'] | undefined,\n selectedType: JsonDataType | null | undefined,\n) {\n const t = useI18n();\n const fallbackLabel = t('control.value');\n const [selectedPath, setSelectedPath] = useState<MixedTreePath>([]);\n const tree = useMemo(\n () =>\n selectedSchema && (selectedType === 'object' || selectedType === 'array')\n ? buildMixedTree(\n data,\n selectedSchema,\n rootSchema,\n label || fallbackLabel,\n )\n : undefined,\n [data, label, fallbackLabel, rootSchema, selectedSchema, selectedType],\n );\n const matchedNode = tree && findMixedTreeNode(tree, selectedPath);\n if (tree && selectedPath.length > 0 && !matchedNode) setSelectedPath([]);\n return {\n tree,\n selectedPath,\n selectedNode: matchedNode ?? tree,\n setSelectedPath,\n };\n}\n\nfunction useMixedDetailSchema(\n { schema, rootSchema, uischema, path }: ControlProps,\n selectedType: ReturnType<typeof useMixedType>['selectedType'],\n uischemas: NonNullable<ReturnType<typeof useJsonForms>['uischemas']>,\n) {\n const selectedSchema = useMemo(\n () =>\n selectedType\n ? schemaForType(schema, selectedType, rootSchema)\n : undefined,\n [rootSchema, schema, selectedType],\n );\n const detailUiSchema = useMemo(\n () =>\n selectedSchema\n ? findMixedDetailUiSchema(\n selectedSchema,\n {\n ...uischema,\n options: {\n ...uischema.options,\n detail:\n uischema.options?.[`${selectedType}-detail`] ??\n uischema.options?.detail,\n },\n },\n path,\n rootSchema,\n uischemas,\n )\n : undefined,\n [path, rootSchema, selectedSchema, selectedType, uischema, uischemas],\n );\n return { selectedSchema, detailUiSchema };\n}\n\nfunction useMixedTypeOptions(\n { schema, data, path, enabled, readonly, errors, required }: ControlProps,\n t: ReturnType<typeof useI18n>,\n) {\n const types = useMemo(() => getSchemaTypes(schema), [schema]);\n const { selectedType, selectNumericType } = useMixedType(data, types, path);\n const numericError =\n selectedType === 'integer' &&\n typeof data === 'number' &&\n !Number.isInteger(data)\n ? t('mixed.integerRequired')\n : undefined;\n const selector = {\n disabled: !enabled || Boolean(readonly),\n error: numericError ?? (!selectedType ? errors : undefined),\n fullWidth: !selectedType,\n required,\n types,\n value: selectedType,\n };\n return { types, selectedType, selectNumericType, numericError, selector };\n}\n\nexport const useMixedRenderer = (\n props: ControlProps,\n requestConfirmation: (request: ConfirmationRequest) => void,\n) => {\n const {\n cells,\n enabled,\n readonly,\n renderers,\n handleChange,\n data,\n config,\n label,\n path,\n rootSchema,\n schema,\n uischema,\n } = props;\n const jsonforms = useJsonForms();\n const structuredLayout =\n uischema.options?.structuredLayout ??\n config?.jsonformsExtended?.mixed?.structuredLayout ??\n 'tree';\n const validation = useContainerValidation(\n { ...uischema, scope: '#' },\n path,\n config,\n false,\n );\n const t = useI18n();\n const uischemas = useMemo(\n () => jsonforms.uischemas ?? [],\n [jsonforms.uischemas],\n );\n const { collapsible, collapsed, setExpanded } = useGroupExpansion(\n uischema,\n config,\n true,\n 'mixed',\n );\n const expanded = !collapsed;\n const { types, selectedType, selectNumericType, numericError, selector } =\n useMixedTypeOptions(props, t);\n const { selectedSchema, detailUiSchema } = useMixedDetailSchema(\n props,\n selectedType,\n uischemas,\n );\n const { tree, selectedPath, selectedNode, setSelectedPath } =\n useMixedTreeSelection(\n data,\n label,\n rootSchema,\n selectedSchema,\n selectedType,\n );\n const preserveDynamicPropertyKey = useDynamicProperty(path);\n const arrayElement = isArrayElementPath(jsonforms.core?.data, path);\n const changeType = 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 });\n const navigation = useMixedNavigation(\n path,\n tree,\n setSelectedPath,\n setExpanded,\n );\n const selectorProps = {\n ...selector,\n clearable: !preserveDynamicPropertyKey && !arrayElement,\n onChange: (value: string | undefined) =>\n changeType(value as JsonDataType | undefined),\n };\n const latest = useRef({ data, path, enabled, readonly });\n useLayoutEffect(() => {\n latest.current = { data, path, enabled, readonly };\n }, [data, path, enabled, readonly]);\n const appliedOptions = { ...config, ...uischema.options };\n const restrict = appliedOptions.restrict !== false;\n const canDeleteNode = (node: MixedTreeNode) =>\n canDeleteMixedTreeNode(tree, node, rootSchema, enabled, readonly, restrict);\n const canRenameNode = (node: MixedTreeNode) =>\n canRenameMixedTreeNode(node, enabled, readonly);\n const deleteNode = (node: MixedTreeNode) => {\n if (!canDeleteNode(node)) return;\n /*\n \"Tree Delete in the mixed workspace uses mixed\" - the owner of the action,\n not whichever renderer happens to draw the row. Fallback `always`.\n */\n requestConfirmation({\n operation: 'delete',\n catalogId: 'mixed',\n discarded: [node.data],\n options: uischema?.options,\n config,\n perform: () => {\n // Re-checked after confirmation: the guard, and the node still being\n // there, are both current rather than remembered.\n if (\n !canDeleteNode(node) ||\n latest.current.data !== data ||\n latest.current.path !== path ||\n !latest.current.enabled ||\n latest.current.readonly\n )\n return;\n handleChange(path, deleteMixedTreeNode(data, node.path));\n setSelectedPath(node.path.slice(0, -1));\n },\n });\n };\n const renameNode = (node: MixedTreeNode, nextName: string) => {\n handleChange(path, renameMixedTreeNode(data, node.path, nextName));\n setSelectedPath([...node.path.slice(0, -1), nextName]);\n };\n\n return {\n appliedOptions,\n canDeleteNode,\n canRenameNode,\n deleteNode,\n renameNode,\n selectorProps,\n navigation,\n nodeEditorProps: { rootSchema, handleChange },\n detailProps: {\n path,\n enabled,\n readonly,\n renderers,\n cells,\n detailUiSchema,\n withoutControlLabel,\n },\n jsonforms,\n structuredLayout,\n validation,\n t,\n uischemas,\n collapsible,\n collapsed,\n setExpanded,\n expanded,\n selectedPath,\n setSelectedPath,\n types,\n selectedType,\n selectNumericType,\n numericError,\n selectedSchema,\n detailUiSchema,\n tree,\n selectedNode,\n preserveDynamicPropertyKey,\n withoutControlLabel,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;AAmCA,IAAMA,KAAuB,MAC3BC,EAAUC,CAAO,KAAKA,EAAQ,UAAU,MACpC;CAAE,GAAGA;CAAS,OAAO;AAAM,IAC3BA;AAEN,SAASC,EACP,GACA,GACA,GACA,GACA,GACA;CAEA,IAAMC,IADIC,EACY,CAAA,CAAE,eAAe,GACjC,CAACC,GAAcC,KAAmBC,EAAwB,CAAC,CAAC,GAC5DC,IAAOC,QAETC,MAAmBC,MAAiB,YAAYA,MAAiB,WAC7DC,EACEC,GACAH,GACAI,GACAC,KAASZ,CACX,IACA,KAAA,GACN;EAACU;EAAME;EAAOZ;EAAeW;EAAYJ;EAAgBC;CAAY,CACvE,GACMK,IAAcR,KAAQS,EAAkBT,GAAMH,CAAY;CAEhE,OADIG,KAAQH,EAAa,SAAS,KAAK,CAACW,KAAaV,EAAgB,CAAC,CAAC,GAChE;EACL;EACA;EACA,cAAcU,KAAeR;EAC7B;CACF;AACF;AAEA,SAASU,GACP,EAAE,WAAQ,eAAY,aAAU,WAChC,GACA,GACA;CACA,IAAMR,IAAiBD,QAEnBE,IACIQ,EAAcC,GAAQT,GAAcG,CAAU,IAC9C,KAAA,GACN;EAACA;EAAYM;EAAQT;CAAY,CACnC;CAsBA,OAAO;EAAE;EAAgB,gBArBFF,QAEnB;;GACI,OAAAC,IAAAa,EACEb,GACA;IACE,GAAGc;IACH,SAAS;KACP,GAAGA,EAAS;KACZ,UAAA,IACEA,EAAS,YAAA,OAAA,KAAA,IAAAH,EAAU,GAAGV,EAAa,gBAAA,IACnCa,EAAS,YAAA,OAAA,KAAA,IAAAF,EAAS;IACtB;GACF,GACAG,GACAX,GACAY,CACF,IACA,KAAA;EAAA,GACN;GAACD;GAAMX;GAAYJ;GAAgBC;GAAca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IACxC;GACF,CAAC;EACH;EAWE,aAVkB,GAAqB,MAAqB;GAE5D,AADAG,EAAa9C,GAAMgD,EAAoB5D,GAAMuD,EAAK,MAAMM,CAAQ,CAAC,GACjEpE,EAAgB,CAAC,GAAG8D,EAAK,KAAK,MAAM,GAAG,EAAE,GAAGM,CAAQ,CAAC;EACvD;EAQE;EACA;EACA,iBAAiB;GAAE;GAAY;EAAa;EAC5C,aAAa;GACX;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./mixedSchema.cjs.js");let t=require("react");var n=(n,r,i)=>{let[a,o]=(0,t.useState)(),s=r.join(`,`);typeof n!=`number`&&a!==void 0&&o(void 0);let c=e.getJsonDataType(n),l=c&&r.includes(c)?c:c===`integer`&&r.includes(`number`)?`number`:null,u=typeof n==`number`&&(a==null?void 0:a.path)===i&&a.types===s&&r.includes(a.type)?a.type:l;return typeof n==`number`&&u&&((a==null?void 0:a.path)!==i||a.types!==s)&&o({type:u,path:i,types:s}),{selectedType:u,selectNumericType:e=>o({type:e,path:i,types:s})}};exports.useMixedType=n;
|
|
2
|
+
//# sourceMappingURL=useMixedType.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMixedType.cjs.js","names":["useState","getJsonDataType","require_mixed_mixedSchema","react","useMixedType","numeric","setNumeric","typeKey","types","data","detected","inferred","selectedType","path"],"sources":["../../src/mixed/useMixedType.ts"],"sourcesContent":["import { useState } from 'react';\nimport { getJsonDataType, JsonDataType } from './mixedSchema';\n\n/** Numeric editor intent cannot be reconstructed from JSON: 2 is both types. */\nexport const useMixedType = (\n data: unknown,\n types: JsonDataType[],\n path: string,\n) => {\n const [numeric, setNumeric] = useState<{\n type: JsonDataType;\n path: string;\n types: string;\n }>();\n const typeKey = types.join(',');\n if (typeof data !== 'number' && numeric !== undefined) {\n setNumeric(undefined);\n }\n const detected = getJsonDataType(data);\n const inferred =\n detected && types.includes(detected)\n ? detected\n : detected === 'integer' && types.includes('number')\n ? 'number'\n : null;\n const selectedType =\n typeof data === 'number' &&\n numeric?.path === path &&\n numeric.types === typeKey &&\n types.includes(numeric.type)\n ? numeric.type\n : inferred;\n // Retain an inferred numeric editor too: resetting a number to zero must not\n // switch the editor to integer merely because zero satisfies both types.\n if (\n typeof data === 'number' &&\n selectedType &&\n (numeric?.path !== path || numeric.types !== typeKey)\n ) {\n setNumeric({ type: selectedType, path, types: typeKey });\n }\n const selectNumericType = (type: JsonDataType) =>\n setNumeric({ type, path, types: typeKey });\n return { selectedType, selectNumericType };\n};\n"],"mappings":"A,kIAIA,IAAaI,GACX,EACA,EACA,IACG,CACH,GAAM,CAACC,EAASC,IAAA,EAAcN,EAAAA,SAAAA,CAI3B,EACGO,EAAUC,EAAM,KAAK,GAAG,EAC1B,OAAOC,GAAS,UAAYJ,IAAY,IAAA,IAC1CC,EAAW,IAAA,EAAS,EAEtB,IAAMI,EAAWT,EAAAA,gBAAgBQ,CAAI,EAC/BE,EACJD,GAAYF,EAAM,SAASE,CAAQ,EAC/BA,EACAA,IAAa,WAAaF,EAAM,SAAS,QAAQ,EAC/C,SACA,KACFI,EACJ,OAAOH,GAAS,WAAAJ,GAAA,KAAA,IAAA,GAChBA,EAAS,QAASQ,GAClBR,EAAQ,QAAUE,GAClBC,EAAM,SAASH,EAAQ,IAAI,EACvBA,EAAQ,KACRM,EAYN,OARE,OAAOF,GAAS,UAChBG,KAAAP,GAAA,KAAA,IAAA,GACCA,EAAS,QAASQ,GAAQR,EAAQ,QAAUE,IAE7CD,EAAW,CAAE,KAAMM,EAAc,OAAM,MAAOL,CAAQ,CAAC,EAIlD,CAAE,eAAc,kBAFI,GACzBD,EAAW,CAAE,OAAM,OAAM,MAAOC,CAAQ,CAAC,CACF,CAC3C,E"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { JsonDataType } from './mixedSchema';
|
|
2
|
+
/** Numeric editor intent cannot be reconstructed from JSON: 2 is both types. */
|
|
3
|
+
export declare const useMixedType: (data: unknown, types: JsonDataType[], path: string) => {
|
|
4
|
+
selectedType: JsonDataType | null;
|
|
5
|
+
selectNumericType: (type: JsonDataType) => void;
|
|
6
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getJsonDataType as e } from "./mixedSchema.esm.js";
|
|
2
|
+
import { useState as t } from "react";
|
|
3
|
+
// src/mixed/useMixedType.ts
|
|
4
|
+
var n = (n, r, i) => {
|
|
5
|
+
let [a, o] = t(), s = r.join(",");
|
|
6
|
+
typeof n != "number" && a !== void 0 && o(void 0);
|
|
7
|
+
let c = e(n), l = c && r.includes(c) ? c : c === "integer" && r.includes("number") ? "number" : null, u = typeof n == "number" && (a == null ? void 0 : a.path) === i && a.types === s && r.includes(a.type) ? a.type : l;
|
|
8
|
+
return typeof n == "number" && u && ((a == null ? void 0 : a.path) !== i || a.types !== s) && o({
|
|
9
|
+
type: u,
|
|
10
|
+
path: i,
|
|
11
|
+
types: s
|
|
12
|
+
}), {
|
|
13
|
+
selectedType: u,
|
|
14
|
+
selectNumericType: (e) => o({
|
|
15
|
+
type: e,
|
|
16
|
+
path: i,
|
|
17
|
+
types: s
|
|
18
|
+
})
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export { n as useMixedType };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=useMixedType.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMixedType.esm.js","names":["useMixedType","numeric","setNumeric","useState","typeKey","types","data","detected","getJsonDataType","inferred","selectedType","path"],"sources":["../../src/mixed/useMixedType.ts"],"sourcesContent":["import { useState } from 'react';\nimport { getJsonDataType, JsonDataType } from './mixedSchema';\n\n/** Numeric editor intent cannot be reconstructed from JSON: 2 is both types. */\nexport const useMixedType = (\n data: unknown,\n types: JsonDataType[],\n path: string,\n) => {\n const [numeric, setNumeric] = useState<{\n type: JsonDataType;\n path: string;\n types: string;\n }>();\n const typeKey = types.join(',');\n if (typeof data !== 'number' && numeric !== undefined) {\n setNumeric(undefined);\n }\n const detected = getJsonDataType(data);\n const inferred =\n detected && types.includes(detected)\n ? detected\n : detected === 'integer' && types.includes('number')\n ? 'number'\n : null;\n const selectedType =\n typeof data === 'number' &&\n numeric?.path === path &&\n numeric.types === typeKey &&\n types.includes(numeric.type)\n ? numeric.type\n : inferred;\n // Retain an inferred numeric editor too: resetting a number to zero must not\n // switch the editor to integer merely because zero satisfies both types.\n if (\n typeof data === 'number' &&\n selectedType &&\n (numeric?.path !== path || numeric.types !== typeKey)\n ) {\n setNumeric({ type: selectedType, path, types: typeKey });\n }\n const selectNumericType = (type: JsonDataType) =>\n setNumeric({ type, path, types: typeKey });\n return { selectedType, selectNumericType };\n};\n"],"mappings":";;;AAIA,IAAaA,KACX,GACA,GACA,MACG;CACH,IAAM,CAACC,GAASC,KAAcC,EAI3B,GACGC,IAAUC,EAAM,KAAK,GAAG;CAC9B,AAAI,OAAOC,KAAS,YAAYL,MAAY,KAAA,KAC1CC,EAAW,KAAA,CAAS;CAEtB,IAAMK,IAAWC,EAAgBF,CAAI,GAC/BG,IACJF,KAAYF,EAAM,SAASE,CAAQ,IAC/BA,IACAA,MAAa,aAAaF,EAAM,SAAS,QAAQ,IAC/C,WACA,MACFK,IACJ,OAAOJ,KAAS,aAAAL,KAAA,OAAA,KAAA,IAChBA,EAAS,UAASU,KAClBV,EAAQ,UAAUG,KAClBC,EAAM,SAASJ,EAAQ,IAAI,IACvBA,EAAQ,OACRQ;CAYN,OARE,OAAOH,KAAS,YAChBI,OAAAT,KAAA,OAAA,KAAA,IACCA,EAAS,UAASU,KAAQV,EAAQ,UAAUG,MAE7CF,EAAW;EAAE,MAAMQ;EAAc;EAAM,OAAON;CAAQ,CAAC,GAIlD;EAAE;EAAc,oBAFI,MACzBF,EAAW;GAAE;GAAM;GAAM,OAAOE;EAAQ,CAAC;CACF;AAC3C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BocRIvOZ.js");let t=require("react");t=e.t(t);let n=require("lodash/isEqual");n=e.t(n);let r=require("@jsonforms/react");var i=({value:e,schema:i,uischema:a,enabled:o,readonly:s,renderers:c,cells:l,onChange:u})=>{var d,f;let p=(0,r.useJsonForms)(),m=(0,t.useRef)(e);return(0,t.useLayoutEffect)(()=>{m.current=e},[e]),t.default.createElement(r.JsonForms,{data:e,schema:i,uischema:a,renderers:c??p.renderers??[],cells:l??p.cells??[],readonly:!o||!!s,ajv:(d=p.core)==null?void 0:d.ajv,validationMode:(f=p.core)==null?void 0:f.validationMode,i18n:p.i18n,onChange:({data:e})=>{(0,n.default)(e,m.current)||(m.current=e,u(e))}})};exports.IsolatedPropertyEditor=i;
|
|
2
|
+
//# sourceMappingURL=IsolatedPropertyEditor.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IsolatedPropertyEditor.cjs.js","names":["useJsonForms","useRef","JsonForms","isEqual","require_rolldown_runtime","react","lodash_isEqual","_jsonforms_react","IsolatedPropertyEditor","_parent$core","_parent$core2","parent","latest","value","renderers","cells","enabled","readonly","data","onChange"],"sources":["../../src/objects/IsolatedPropertyEditor.tsx"],"sourcesContent":["import React, { useLayoutEffect, useRef } from 'react';\nimport {\n JsonFormsCellRendererRegistryEntry,\n JsonFormsRendererRegistryEntry,\n JsonSchema,\n UISchemaElement,\n} from '@jsonforms/core';\nimport { JsonForms, useJsonForms } from '@jsonforms/react';\nimport isEqual from 'lodash/isEqual';\n\nexport interface IsolatedPropertyEditorProps {\n value: unknown;\n schema: JsonSchema;\n uischema: UISchemaElement;\n enabled: boolean;\n readonly?: boolean;\n renderers?: JsonFormsRendererRegistryEntry[];\n cells?: JsonFormsCellRendererRegistryEntry[];\n onChange: (value: unknown) => void;\n}\n\n/**\n * Edits one dynamic property's value in a form of its own, rooted at that\n * value.\n *\n * This exists because **some property names cannot be addressed by a data\n * path**. JSON Forms separates path segments with `.` and has no escape for\n * one, so a property literally called `\"\"` or `a.b` has no path: composing an\n * empty segment yields the parent's own path, and a control dispatched there\n * would edit the whole containing object rather than that property. Composing a\n * dotted name yields a path that points at a nested property nobody declared.\n *\n * So the value is edited in isolation - `scope: \"#\"`, no path at all - and\n * written back to the containing object under its exact key by the caller. This\n * is the \"literal-key editing\" contract of section 18.\n *\n * The parent form's validator, locale and validation mode are passed in, so\n * errors and labels behave as they do everywhere else. What does **not** cross\n * the boundary is the error *list*: this form validates its own value, so those\n * errors are shown here but are not part of the containing form's error count.\n * That is a real limitation of editing in isolation, and the price of being\n * able to edit the property at all.\n */\nexport const IsolatedPropertyEditor = ({\n value,\n schema,\n uischema,\n enabled,\n readonly,\n renderers,\n cells,\n onChange,\n}: IsolatedPropertyEditorProps) => {\n const parent = useJsonForms();\n /*\n JsonForms reports once on mount with the data it was given. Writing that\n back would replace the containing object with an equal copy, which\n re-renders this editor with a new `data` identity and reports again - a\n loop. Only a real change is forwarded.\n */\n const latest = useRef(value);\n useLayoutEffect(() => {\n latest.current = value;\n }, [value]);\n\n return (\n <JsonForms\n data={value}\n schema={schema}\n uischema={uischema}\n renderers={renderers ?? parent.renderers ?? []}\n cells={cells ?? parent.cells ?? []}\n readonly={!enabled || Boolean(readonly)}\n ajv={parent.core?.ajv}\n validationMode={parent.core?.validationMode}\n i18n={parent.i18n}\n onChange={({ data }) => {\n if (isEqual(data, latest.current)) {\n return;\n }\n latest.current = data;\n onChange(data);\n }}\n />\n );\n};\n"],"mappings":"A,iOA2CA,IAAaQ,GAA0B,CACrC,QACA,SACA,WACA,UACA,WACA,YACA,QACA,cACiC,C,QACjC,IAAMG,GAAA,EAASX,EAAAA,aAAAA,CAAa,EAOtBY,GAAA,EAASX,EAAAA,OAAAA,CAAOY,CAAK,EAK3B,OAJA,EAAAR,EAAA,gBAAA,KAAsB,CACpB,EAAO,QAAUQ,CACnB,EAAG,CAACA,CAAK,CAAC,EAGRR,EAAA,QAAA,cAACH,EAAAA,UAAD,CACE,KAAMW,EACE,SACE,WACV,UAAWC,GAAaH,EAAO,WAAa,CAAC,EAC7C,MAAOI,GAASJ,EAAO,OAAS,CAAC,EACjC,SAAU,CAACK,GAAW,EAAQC,EAC9B,KAAA,EAAKN,EAAO,OAAA,KAAA,IAAA,GAAAF,EAAM,IAClB,gBAAA,EAAgBE,EAAO,OAAA,KAAA,IAAA,GAAAD,EAAM,eAC7B,KAAMC,EAAO,KACb,UAAW,CAAE,UAAW,EACtB,EAAIR,EAAAA,QAAAA,CAAQe,EAAMN,EAAO,OAAO,IAGhC,EAAO,QAAUM,EACjBC,EAASD,CAAI,EACf,CACD,CAAA,CAEL,E"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { JsonFormsCellRendererRegistryEntry, JsonFormsRendererRegistryEntry, JsonSchema, UISchemaElement } from '@jsonforms/core';
|
|
3
|
+
export interface IsolatedPropertyEditorProps {
|
|
4
|
+
value: unknown;
|
|
5
|
+
schema: JsonSchema;
|
|
6
|
+
uischema: UISchemaElement;
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
readonly?: boolean;
|
|
9
|
+
renderers?: JsonFormsRendererRegistryEntry[];
|
|
10
|
+
cells?: JsonFormsCellRendererRegistryEntry[];
|
|
11
|
+
onChange: (value: unknown) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Edits one dynamic property's value in a form of its own, rooted at that
|
|
15
|
+
* value.
|
|
16
|
+
*
|
|
17
|
+
* This exists because **some property names cannot be addressed by a data
|
|
18
|
+
* path**. JSON Forms separates path segments with `.` and has no escape for
|
|
19
|
+
* one, so a property literally called `""` or `a.b` has no path: composing an
|
|
20
|
+
* empty segment yields the parent's own path, and a control dispatched there
|
|
21
|
+
* would edit the whole containing object rather than that property. Composing a
|
|
22
|
+
* dotted name yields a path that points at a nested property nobody declared.
|
|
23
|
+
*
|
|
24
|
+
* So the value is edited in isolation - `scope: "#"`, no path at all - and
|
|
25
|
+
* written back to the containing object under its exact key by the caller. This
|
|
26
|
+
* is the "literal-key editing" contract of section 18.
|
|
27
|
+
*
|
|
28
|
+
* The parent form's validator, locale and validation mode are passed in, so
|
|
29
|
+
* errors and labels behave as they do everywhere else. What does **not** cross
|
|
30
|
+
* the boundary is the error *list*: this form validates its own value, so those
|
|
31
|
+
* errors are shown here but are not part of the containing form's error count.
|
|
32
|
+
* That is a real limitation of editing in isolation, and the price of being
|
|
33
|
+
* able to edit the property at all.
|
|
34
|
+
*/
|
|
35
|
+
export declare const IsolatedPropertyEditor: ({ value, schema, uischema, enabled, readonly, renderers, cells, onChange, }: IsolatedPropertyEditorProps) => React.JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import e, { useLayoutEffect as t, useRef as n } from "react";
|
|
2
|
+
import r from "lodash/isEqual";
|
|
3
|
+
import { JsonForms as i, useJsonForms as a } from "@jsonforms/react";
|
|
4
|
+
// src/objects/IsolatedPropertyEditor.tsx
|
|
5
|
+
var o = ({ value: o, schema: s, uischema: c, enabled: l, readonly: u, renderers: d, cells: f, onChange: p }) => {
|
|
6
|
+
var m, h;
|
|
7
|
+
let g = a(), _ = n(o);
|
|
8
|
+
return t(() => {
|
|
9
|
+
_.current = o;
|
|
10
|
+
}, [o]), /* @__PURE__ */ e.createElement(i, {
|
|
11
|
+
data: o,
|
|
12
|
+
schema: s,
|
|
13
|
+
uischema: c,
|
|
14
|
+
renderers: d ?? g.renderers ?? [],
|
|
15
|
+
cells: f ?? g.cells ?? [],
|
|
16
|
+
readonly: !l || !!u,
|
|
17
|
+
ajv: (m = g.core) == null ? void 0 : m.ajv,
|
|
18
|
+
validationMode: (h = g.core) == null ? void 0 : h.validationMode,
|
|
19
|
+
i18n: g.i18n,
|
|
20
|
+
onChange: ({ data: e }) => {
|
|
21
|
+
r(e, _.current) || (_.current = e, p(e));
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export { o as IsolatedPropertyEditor };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=IsolatedPropertyEditor.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IsolatedPropertyEditor.esm.js","names":["React","isEqual","IsolatedPropertyEditor","_parent$core","_parent$core2","parent","useJsonForms","latest","useRef","value","useLayoutEffect","JsonForms","renderers","cells","enabled","readonly","data","onChange"],"sources":["../../src/objects/IsolatedPropertyEditor.tsx"],"sourcesContent":["import React, { useLayoutEffect, useRef } from 'react';\nimport {\n JsonFormsCellRendererRegistryEntry,\n JsonFormsRendererRegistryEntry,\n JsonSchema,\n UISchemaElement,\n} from '@jsonforms/core';\nimport { JsonForms, useJsonForms } from '@jsonforms/react';\nimport isEqual from 'lodash/isEqual';\n\nexport interface IsolatedPropertyEditorProps {\n value: unknown;\n schema: JsonSchema;\n uischema: UISchemaElement;\n enabled: boolean;\n readonly?: boolean;\n renderers?: JsonFormsRendererRegistryEntry[];\n cells?: JsonFormsCellRendererRegistryEntry[];\n onChange: (value: unknown) => void;\n}\n\n/**\n * Edits one dynamic property's value in a form of its own, rooted at that\n * value.\n *\n * This exists because **some property names cannot be addressed by a data\n * path**. JSON Forms separates path segments with `.` and has no escape for\n * one, so a property literally called `\"\"` or `a.b` has no path: composing an\n * empty segment yields the parent's own path, and a control dispatched there\n * would edit the whole containing object rather than that property. Composing a\n * dotted name yields a path that points at a nested property nobody declared.\n *\n * So the value is edited in isolation - `scope: \"#\"`, no path at all - and\n * written back to the containing object under its exact key by the caller. This\n * is the \"literal-key editing\" contract of section 18.\n *\n * The parent form's validator, locale and validation mode are passed in, so\n * errors and labels behave as they do everywhere else. What does **not** cross\n * the boundary is the error *list*: this form validates its own value, so those\n * errors are shown here but are not part of the containing form's error count.\n * That is a real limitation of editing in isolation, and the price of being\n * able to edit the property at all.\n */\nexport const IsolatedPropertyEditor = ({\n value,\n schema,\n uischema,\n enabled,\n readonly,\n renderers,\n cells,\n onChange,\n}: IsolatedPropertyEditorProps) => {\n const parent = useJsonForms();\n /*\n JsonForms reports once on mount with the data it was given. Writing that\n back would replace the containing object with an equal copy, which\n re-renders this editor with a new `data` identity and reports again - a\n loop. Only a real change is forwarded.\n */\n const latest = useRef(value);\n useLayoutEffect(() => {\n latest.current = value;\n }, [value]);\n\n return (\n <JsonForms\n data={value}\n schema={schema}\n uischema={uischema}\n renderers={renderers ?? parent.renderers ?? []}\n cells={cells ?? parent.cells ?? []}\n readonly={!enabled || Boolean(readonly)}\n ajv={parent.core?.ajv}\n validationMode={parent.core?.validationMode}\n i18n={parent.i18n}\n onChange={({ data }) => {\n if (isEqual(data, latest.current)) {\n return;\n }\n latest.current = data;\n onChange(data);\n }}\n />\n );\n};\n"],"mappings":";;;;AA2CA,IAAaE,KAA0B,EACrC,UACA,WACA,aACA,YACA,aACA,cACA,UACA,kBACiC;;CACjC,IAAMG,IAASC,EAAa,GAOtBC,IAASC,EAAOC,CAAK;CAK3B,OAJAC,QAAsB;EACpB,EAAO,UAAUD;CACnB,GAAG,CAACA,CAAK,CAAC,GAGR,kBAAA,cAACE,GAAD;EACE,MAAMF;EACE;EACE;EACV,WAAWG,KAAaP,EAAO,aAAa,CAAC;EAC7C,OAAOQ,KAASR,EAAO,SAAS,CAAC;EACjC,UAAU,CAACS,KAAW,EAAQC;EAC9B,MAAA,IAAKV,EAAO,SAAA,OAAA,KAAA,IAAAF,EAAM;EAClB,iBAAA,IAAgBE,EAAO,SAAA,OAAA,KAAA,IAAAD,EAAM;EAC7B,MAAMC,EAAO;EACb,WAAW,EAAE,cAAW;GACtB,AAAIJ,EAAQe,GAAMT,EAAO,OAAO,MAGhC,EAAO,UAAUS,GACjBC,EAASD,CAAI;EACf;CACD,CAAA;AAEL"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BocRIvOZ.js"),t=require("../core/uiSchemaCycle.cjs.js"),n=require("../dynamic/DynamicUiProvider.cjs.js"),r=require("../core/detailUiSchema.cjs.js"),i=require("../validation/errorSummary.cjs.js"),a=require("./conditionalFields.cjs.js");let o=require("react");o=e.t(o);let s=require("@jsonforms/core"),c=require("@jsonforms/react");var l=o.default.createContext(void 0);function u({schema:e,rootSchema:t,data:n,uischema:r,config:i}){let s=(0,c.useJsonForms)(),l=(0,o.useMemo)(()=>s.uischemas??[],[s.uischemas]),u=a.useConditionalFields(e,t,n,r,i),d=u.schema;return{uischemas:l,conditional:u,schema:d,additionalSchema:{...d,properties:{...Object.fromEntries([...u.known].map(e=>[e,{}])),...d.properties}}}}function d({props:e,schema:t,uischema:n,diagnostics:r,errors:a,additional:s}){let u=n.elements,d=n.type===`Group`||!Array.isArray(u)||u.length>0;return o.default.createElement(o.default.Fragment,null,r.map(e=>o.default.createElement(`div`,{key:e,role:`alert`},e)),o.default.createElement(i.ObjectErrorContext.Provider,{value:{uischema:n,message:a}},o.default.createElement(l.Provider,{value:{uischema:n,additional:s}},d&&o.default.createElement(c.JsonFormsDispatch,{visible:e.visible,enabled:e.enabled,schema:t,uischema:n,path:e.path,renderers:e.renderers,cells:e.cells,readonly:e.readonly}))))}var f=(e,t,n)=>(0,s.isObjectControl)(e,t,n)?a.conditionalFieldsEnabled(e,n.config)&&a.hasConditionalFields(t)?25:2:-1;function p(e){return(n,r,i,a,s)=>{let c=i.type===`Group`,l=o.default.createElement(e,{...n,embedded:!!n.path||c,schema:r.additionalSchema,uischemas:r.uischemas});return{isGroup:c,additional:l,detail:o.default.createElement(t.UiSchemaCycleProvider,{stack:a},o.default.createElement(d,{props:n,schema:r.schema,uischema:i,diagnostics:r.conditional.diagnostics,errors:s,additional:l})),title:n.label&&n.path&&n.uischema.label!==!1?n.label:void 0}}}function m(e,c,l=!1){let d=p(e);return function(e){let f=u(e),{path:p,rootSchema:m,uischema:h,label:g}=e,{schema:_,conditional:v,uischemas:y}=f,b=(0,o.useMemo)(()=>({...s.Generate.uiSchema(_,p?`Group`:`VerticalLayout`,void 0,m),...p?{label:l&&h.label===!1?void 0:g}:{}}),[_,p,m,h.label,g]),x=(0,o.useMemo)(()=>r.findDetailUISchema(y,_,h.scope,p,()=>b,h,m),[y,_,h,p,b,m]),{cycle:S,stack:C}=t.useUiSchemaCycleGuard(x,p,`the object renderer`),w=n.useDynamicTreeResolver(p),T=a.conditionalLayout(w(S?b:x),_,v.known),E=i.usePathErrorIndicator(p,void 0,!1);if(!e.visible)return null;let D=d(e,f,T,C,E);return D.isGroup?D.detail:o.default.createElement(c,{path:p,errors:E,...D})}}exports.ObjectDetail=d,exports.ObjectDetailContext=l,exports.createObjectPresentation=p,exports.createObjectRenderer=m,exports.objectControlTester=f,exports.useObjectSchema=u;
|
|
2
|
+
//# sourceMappingURL=ObjectDetail.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectDetail.cjs.js","names":["React","useJsonForms","useMemo","useConditionalFields","ObjectErrorContext","JsonFormsDispatch","isObjectControl","conditionalFieldsEnabled","hasConditionalFields","UiSchemaCycleProvider","Generate","findDetailUISchema","useUiSchemaCycleGuard","useDynamicTreeResolver","conditionalLayout","usePathErrorIndicator","require_rolldown_runtime","require_core_uiSchemaCycle","require_dynamic_DynamicUiProvider","require_core_detailUiSchema","require_validation_errorSummary","require_objects_conditionalFields","react","_jsonforms_core","_jsonforms_react","ObjectDetailContext","useObjectSchema","originalSchema","jsonforms","uischemas","conditional","rootSchema","data","uischema","config","schema","key","ObjectDetail","elements","showContent","diagnostics","message","errors","props","objectControlTester","ui","context","createObjectPresentation","isGroup","additional","AdditionalProperties","state","createObjectRenderer","presentation","generated","path","hideGeneratedLabel","label","detailUiSchema","resolveTree","dispatchUiSchema","cycle","content","stack","Frame"],"sources":["../../src/objects/ObjectDetail.tsx"],"sourcesContent":["import {\n UiSchemaCycleProvider,\n useUiSchemaCycleGuard,\n} from '../core/uiSchemaCycle';\nimport type { AdditionalPropertiesProps } from './useAdditionalPropertyEntries';\nimport React, { useMemo } from 'react';\nimport {\n Generate,\n isObjectControl,\n type RankedTester,\n type ControlProps,\n type UISchemaElement,\n} from '@jsonforms/core';\nimport { JsonFormsDispatch, useJsonForms } from '@jsonforms/react';\nimport { useDynamicTreeResolver } from '../dynamic/DynamicUiProvider';\nimport { findDetailUISchema } from '../core/detailUiSchema';\nimport {\n ObjectErrorContext,\n usePathErrorIndicator,\n} from '../validation/errorSummary';\nimport {\n conditionalLayout,\n useConditionalFields,\n conditionalFieldsEnabled,\n hasConditionalFields,\n} from './conditionalFields';\n\nexport const ObjectDetailContext = React.createContext<\n { uischema: UISchemaElement; additional: React.ReactNode } | undefined\n>(undefined);\n\nexport function useObjectSchema({\n schema: originalSchema,\n rootSchema,\n data,\n uischema,\n config,\n}: ControlProps) {\n const jsonforms = useJsonForms();\n const uischemas = useMemo(\n () => jsonforms.uischemas ?? [],\n [jsonforms.uischemas],\n );\n const conditional = useConditionalFields(\n originalSchema,\n rootSchema,\n data,\n uischema,\n config,\n );\n const schema = conditional.schema;\n const additionalSchema = {\n ...schema,\n properties: {\n ...Object.fromEntries([...conditional.known].map((key) => [key, {}])),\n ...schema.properties,\n },\n } as ControlProps['schema'];\n return { uischemas, conditional, schema, additionalSchema };\n}\n\nexport function ObjectDetail({\n props,\n schema,\n uischema,\n diagnostics,\n errors,\n additional,\n}: {\n props: ControlProps;\n schema: ControlProps['schema'];\n uischema: UISchemaElement;\n diagnostics: readonly string[];\n errors: string;\n additional: React.ReactNode;\n}) {\n const elements = (uischema as { elements?: unknown[] }).elements;\n const showContent =\n uischema.type === 'Group' ||\n !Array.isArray(elements) ||\n elements.length > 0;\n return (\n <>\n {diagnostics.map((message) => (\n <div key={message} role='alert'>\n {message}\n </div>\n ))}\n <ObjectErrorContext.Provider value={{ uischema, message: errors }}>\n <ObjectDetailContext.Provider value={{ uischema, additional }}>\n {showContent && (\n <JsonFormsDispatch\n visible={props.visible}\n enabled={props.enabled}\n schema={schema}\n uischema={uischema}\n path={props.path}\n renderers={props.renderers}\n cells={props.cells}\n readonly={props.readonly}\n />\n )}\n </ObjectDetailContext.Provider>\n </ObjectErrorContext.Provider>\n </>\n );\n}\n\nexport const objectControlTester: RankedTester = (ui, schema, context) =>\n isObjectControl(ui, schema, context)\n ? conditionalFieldsEnabled(ui, context.config) &&\n hasConditionalFields(schema)\n ? 25\n : 2\n : -1;\n\n/** Assemble the shared object boundary while adapters retain their native outer frame. */\nexport function createObjectPresentation(\n AdditionalProperties: React.ComponentType<AdditionalPropertiesProps>,\n) {\n return (\n props: ControlProps,\n state: ReturnType<typeof useObjectSchema>,\n uischema: UISchemaElement,\n stack: ReadonlySet<string>,\n errors: string,\n ) => {\n const isGroup = uischema.type === 'Group';\n const additional = (\n <AdditionalProperties\n {...props}\n embedded={Boolean(props.path) || isGroup}\n schema={state.additionalSchema}\n uischemas={state.uischemas}\n />\n );\n const detail = (\n <UiSchemaCycleProvider stack={stack}>\n <ObjectDetail\n props={props}\n schema={state.schema}\n uischema={uischema}\n diagnostics={state.conditional.diagnostics}\n errors={errors}\n additional={additional}\n />\n </UiSchemaCycleProvider>\n );\n return {\n isGroup,\n additional,\n detail,\n title:\n props.label && props.path && props.uischema.label !== false\n ? props.label\n : undefined,\n };\n };\n}\n\nexport interface ObjectFrameProps {\n path: string;\n title?: string;\n errors: string;\n detail: React.ReactNode;\n additional: React.ReactNode;\n}\n\n/** Shared resolution and boundary ownership; native frames remain adapter-specific. */\nexport function createObjectRenderer(\n AdditionalProperties: React.ComponentType<AdditionalPropertiesProps>,\n Frame: React.ComponentType<ObjectFrameProps>,\n hideGeneratedLabel = false,\n) {\n const presentation = createObjectPresentation(AdditionalProperties);\n return function ObjectRenderer(props: ControlProps) {\n const state = useObjectSchema(props);\n const { path, rootSchema, uischema, label } = props;\n const { schema, conditional, uischemas } = state;\n const generated = useMemo(\n () => ({\n ...Generate.uiSchema(\n schema,\n path ? 'Group' : 'VerticalLayout',\n undefined,\n rootSchema,\n ),\n ...(path\n ? {\n label:\n hideGeneratedLabel && uischema.label === false\n ? undefined\n : label,\n }\n : {}),\n }),\n [schema, path, rootSchema, uischema.label, label],\n );\n const detailUiSchema = useMemo(\n () =>\n findDetailUISchema(\n uischemas,\n schema,\n uischema.scope,\n path,\n () => generated,\n uischema,\n rootSchema,\n ),\n [uischemas, schema, uischema, path, generated, rootSchema],\n );\n const { cycle, stack } = useUiSchemaCycleGuard(\n detailUiSchema,\n path,\n 'the object renderer',\n );\n const resolveTree = useDynamicTreeResolver(path);\n const dispatchUiSchema = conditionalLayout(\n resolveTree(cycle ? generated : detailUiSchema),\n schema,\n conditional.known,\n );\n const errors = usePathErrorIndicator(path, undefined, false);\n if (!props.visible) return null;\n const content = presentation(props, state, dispatchUiSchema, stack, errors);\n return content.isGroup ? (\n content.detail\n ) : (\n <Frame path={path} errors={errors} {...content} />\n );\n };\n}\n"],"mappings":"A,kbA2BA,IAAayB,EAAsBzB,EAAAA,QAAM,cAEvC,IAAA,EAAS,EAEX,SAAgB0B,EAAgB,CAC9B,OAAQC,EACR,aACA,OACA,WACA,UACe,CACf,IAAMC,GAAA,EAAY3B,EAAAA,aAAAA,CAAa,EACzB4B,GAAA,EAAY3B,EAAAA,QAAAA,KACV0B,EAAU,WAAa,CAAC,EAC9B,CAACA,EAAU,SAAS,CACtB,EACME,EAAc3B,EAAAA,qBAClBwB,EACAI,EACAC,EACAC,EACAC,CACF,EACMC,EAASL,EAAY,OAQ3B,MAAO,CAAE,YAAW,cAAa,SAAQ,iBAAA,CANvC,GAAGK,EACH,WAAY,CACV,GAAG,OAAO,YAAY,CAAC,GAAGL,EAAY,KAAK,CAAC,CAAC,IAAK,GAAQ,CAACM,EAAK,CAAC,CAAC,CAAC,CAAC,EACpE,GAAGD,EAAO,UACZ,CAEuC,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AAA,QAAA,cAAC0C,EAAD,CAAa,OAAc,SAAQ,GAAIF,CAAU,CAAA,CAErD,CACF,C"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AdditionalPropertiesProps } from './useAdditionalPropertyEntries';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { type RankedTester, type ControlProps, type UISchemaElement } from '@jsonforms/core';
|
|
4
|
+
export declare const ObjectDetailContext: React.Context<{
|
|
5
|
+
uischema: UISchemaElement;
|
|
6
|
+
additional: React.ReactNode;
|
|
7
|
+
} | undefined>;
|
|
8
|
+
export declare function useObjectSchema({ schema: originalSchema, rootSchema, data, uischema, config, }: ControlProps): {
|
|
9
|
+
uischemas: import("@jsonforms/core").JsonFormsUISchemaRegistryEntry[];
|
|
10
|
+
conditional: {
|
|
11
|
+
schema: import("@jsonforms/core").JsonSchema;
|
|
12
|
+
known: Set<string>;
|
|
13
|
+
diagnostics: string[];
|
|
14
|
+
};
|
|
15
|
+
schema: import("@jsonforms/core").JsonSchema;
|
|
16
|
+
additionalSchema: import("@jsonforms/core").JsonSchema;
|
|
17
|
+
};
|
|
18
|
+
export declare function ObjectDetail({ props, schema, uischema, diagnostics, errors, additional, }: {
|
|
19
|
+
props: ControlProps;
|
|
20
|
+
schema: ControlProps['schema'];
|
|
21
|
+
uischema: UISchemaElement;
|
|
22
|
+
diagnostics: readonly string[];
|
|
23
|
+
errors: string;
|
|
24
|
+
additional: React.ReactNode;
|
|
25
|
+
}): React.JSX.Element;
|
|
26
|
+
export declare const objectControlTester: RankedTester;
|
|
27
|
+
/** Assemble the shared object boundary while adapters retain their native outer frame. */
|
|
28
|
+
export declare function createObjectPresentation(AdditionalProperties: React.ComponentType<AdditionalPropertiesProps>): (props: ControlProps, state: ReturnType<typeof useObjectSchema>, uischema: UISchemaElement, stack: ReadonlySet<string>, errors: string) => {
|
|
29
|
+
isGroup: boolean;
|
|
30
|
+
additional: React.JSX.Element;
|
|
31
|
+
detail: React.JSX.Element;
|
|
32
|
+
title: string | undefined;
|
|
33
|
+
};
|
|
34
|
+
export interface ObjectFrameProps {
|
|
35
|
+
path: string;
|
|
36
|
+
title?: string;
|
|
37
|
+
errors: string;
|
|
38
|
+
detail: React.ReactNode;
|
|
39
|
+
additional: React.ReactNode;
|
|
40
|
+
}
|
|
41
|
+
/** Shared resolution and boundary ownership; native frames remain adapter-specific. */
|
|
42
|
+
export declare function createObjectRenderer(AdditionalProperties: React.ComponentType<AdditionalPropertiesProps>, Frame: React.ComponentType<ObjectFrameProps>, hideGeneratedLabel?: boolean): (props: ControlProps) => React.JSX.Element | null;
|