@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,138 @@
|
|
|
1
|
+
import { useJsonForms } from '@jsonforms/react';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
export type DetailDialogOptions = {
|
|
5
|
+
width?: number | string;
|
|
6
|
+
height?: number | string;
|
|
7
|
+
maximizable?: boolean;
|
|
8
|
+
draggable?: boolean;
|
|
9
|
+
resizable?: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/** Geometry only; each renderer supplies its own dialog and controls. */
|
|
13
|
+
export const useDetailDialog = (
|
|
14
|
+
open: boolean,
|
|
15
|
+
options: DetailDialogOptions = {},
|
|
16
|
+
getSurface?: () => HTMLElement | null | undefined,
|
|
17
|
+
) => {
|
|
18
|
+
const config = useJsonForms().config;
|
|
19
|
+
options = { ...config?.jsonformsExtended?.dialog, ...options };
|
|
20
|
+
const [maximized, setMaximized] = useState(false);
|
|
21
|
+
const [offset, setOffset] = useState({ x: 0, y: 0 });
|
|
22
|
+
const [wasOpen, setWasOpen] = useState(open);
|
|
23
|
+
if (wasOpen !== open) {
|
|
24
|
+
setWasOpen(open);
|
|
25
|
+
if (!open) {
|
|
26
|
+
setMaximized(false);
|
|
27
|
+
setOffset({ x: 0, y: 0 });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const frame = React.useRef<number>();
|
|
31
|
+
const nextOffset = React.useRef<{ x: number; y: number }>();
|
|
32
|
+
const flushOffset = () => {
|
|
33
|
+
if (frame.current !== undefined) cancelAnimationFrame(frame.current);
|
|
34
|
+
frame.current = undefined;
|
|
35
|
+
if (nextOffset.current) setOffset(nextOffset.current);
|
|
36
|
+
nextOffset.current = undefined;
|
|
37
|
+
};
|
|
38
|
+
useEffect(
|
|
39
|
+
() => () => {
|
|
40
|
+
if (frame.current !== undefined) cancelAnimationFrame(frame.current);
|
|
41
|
+
},
|
|
42
|
+
[],
|
|
43
|
+
);
|
|
44
|
+
const drag = React.useRef<{
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
left: number;
|
|
48
|
+
top: number;
|
|
49
|
+
bounds: { left: number; top: number; right: number; bottom: number };
|
|
50
|
+
}>();
|
|
51
|
+
const onPointerDown: React.PointerEventHandler<HTMLElement> = (event) => {
|
|
52
|
+
if (
|
|
53
|
+
!options.draggable ||
|
|
54
|
+
maximized ||
|
|
55
|
+
event.button !== 0 ||
|
|
56
|
+
(event.target as HTMLElement).closest('button')
|
|
57
|
+
)
|
|
58
|
+
return;
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
const surface =
|
|
61
|
+
getSurface?.() ??
|
|
62
|
+
event.currentTarget.closest<HTMLElement>('[role="dialog"]');
|
|
63
|
+
if (!surface) return;
|
|
64
|
+
const rect = surface.getBoundingClientRect();
|
|
65
|
+
drag.current = {
|
|
66
|
+
x: event.clientX,
|
|
67
|
+
y: event.clientY,
|
|
68
|
+
left: offset.x,
|
|
69
|
+
top: offset.y,
|
|
70
|
+
bounds: {
|
|
71
|
+
left: offset.x - rect.left,
|
|
72
|
+
top: offset.y - rect.top,
|
|
73
|
+
right:
|
|
74
|
+
offset.x + Math.max(0, window.innerWidth - rect.width) - rect.left,
|
|
75
|
+
bottom:
|
|
76
|
+
offset.y + Math.max(0, window.innerHeight - rect.height) - rect.top,
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
80
|
+
};
|
|
81
|
+
return {
|
|
82
|
+
options,
|
|
83
|
+
offset: maximized ? { x: 0, y: 0 } : offset,
|
|
84
|
+
maximized,
|
|
85
|
+
toggle: () => setMaximized((value) => !value),
|
|
86
|
+
style: {
|
|
87
|
+
width: maximized ? 'calc(100vw - 32px)' : options.width,
|
|
88
|
+
height: maximized ? 'calc(100dvh - 32px)' : options.height,
|
|
89
|
+
minWidth: 280,
|
|
90
|
+
minHeight: 160,
|
|
91
|
+
maxWidth: 'calc(100vw - 32px)',
|
|
92
|
+
maxHeight: 'calc(100dvh - 32px)',
|
|
93
|
+
translate: maximized ? undefined : `${offset.x}px ${offset.y}px`,
|
|
94
|
+
resize: options.resizable && !maximized ? 'both' : undefined,
|
|
95
|
+
overflow: 'auto',
|
|
96
|
+
} as React.CSSProperties,
|
|
97
|
+
dragProps: {
|
|
98
|
+
style: {
|
|
99
|
+
cursor: options.draggable && !maximized ? 'move' : undefined,
|
|
100
|
+
touchAction: 'none',
|
|
101
|
+
},
|
|
102
|
+
onPointerDown,
|
|
103
|
+
onPointerMove: (event: React.PointerEvent<HTMLElement>) => {
|
|
104
|
+
if (!drag.current) return;
|
|
105
|
+
nextOffset.current = {
|
|
106
|
+
x: Math.max(
|
|
107
|
+
drag.current.bounds.left,
|
|
108
|
+
Math.min(
|
|
109
|
+
drag.current.bounds.right,
|
|
110
|
+
drag.current.left + event.clientX - drag.current.x,
|
|
111
|
+
),
|
|
112
|
+
),
|
|
113
|
+
y: Math.max(
|
|
114
|
+
drag.current.bounds.top,
|
|
115
|
+
Math.min(
|
|
116
|
+
drag.current.bounds.bottom,
|
|
117
|
+
drag.current.top + event.clientY - drag.current.y,
|
|
118
|
+
),
|
|
119
|
+
),
|
|
120
|
+
};
|
|
121
|
+
if (frame.current === undefined)
|
|
122
|
+
frame.current = requestAnimationFrame(flushOffset);
|
|
123
|
+
},
|
|
124
|
+
onPointerUp: () => {
|
|
125
|
+
flushOffset();
|
|
126
|
+
drag.current = undefined;
|
|
127
|
+
},
|
|
128
|
+
onPointerCancel: () => {
|
|
129
|
+
flushOffset();
|
|
130
|
+
drag.current = undefined;
|
|
131
|
+
},
|
|
132
|
+
onLostPointerCapture: () => {
|
|
133
|
+
flushOffset();
|
|
134
|
+
drag.current = undefined;
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { createContext, useContext, useEffect, useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
export type PendingChange = {
|
|
4
|
+
/** Apply the outstanding value now. */
|
|
5
|
+
flush: () => void;
|
|
6
|
+
/** Drop the outstanding value. */
|
|
7
|
+
cancel: () => void;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const PendingChangesContext = createContext<Set<PendingChange> | undefined>(
|
|
11
|
+
undefined,
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Text controls debounce their writes, so a value the user has typed may not
|
|
16
|
+
* have reached the form data yet when a dialog's Apply is pressed. Controls
|
|
17
|
+
* register their pending write here; the dialog flushes them all before it
|
|
18
|
+
* reads the draft, and cancels them when it is dismissed.
|
|
19
|
+
*
|
|
20
|
+
* Outside a provider this is inert, which is what an ordinary form wants.
|
|
21
|
+
*/
|
|
22
|
+
export const PendingChangesProvider = ({
|
|
23
|
+
changes,
|
|
24
|
+
children,
|
|
25
|
+
}: React.PropsWithChildren<{ changes: Set<PendingChange> }>) => (
|
|
26
|
+
<PendingChangesContext.Provider value={changes}>
|
|
27
|
+
{children}
|
|
28
|
+
</PendingChangesContext.Provider>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export const useRegisterPendingChange = (change: PendingChange) => {
|
|
32
|
+
const pending = useContext(PendingChangesContext);
|
|
33
|
+
// The registered entry has to stay stable, or every render would leave a
|
|
34
|
+
// stale one behind in the set.
|
|
35
|
+
const entry = useMemo<PendingChange>(
|
|
36
|
+
() => ({
|
|
37
|
+
flush: () => entry.current.flush(),
|
|
38
|
+
cancel: () => entry.current.cancel(),
|
|
39
|
+
current: change,
|
|
40
|
+
}),
|
|
41
|
+
// oxlint-disable-next-line react-hooks/exhaustive-deps
|
|
42
|
+
[],
|
|
43
|
+
) as PendingChange & { current: PendingChange };
|
|
44
|
+
entry.current = change;
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (!pending) return undefined;
|
|
47
|
+
pending.add(entry);
|
|
48
|
+
return () => {
|
|
49
|
+
// Unmounting while a write is outstanding must not let it land after
|
|
50
|
+
// the dialog that owned it has gone.
|
|
51
|
+
entry.cancel();
|
|
52
|
+
pending.delete(entry);
|
|
53
|
+
};
|
|
54
|
+
}, [pending, entry]);
|
|
55
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useCallback, useRef, useState } from 'react';
|
|
2
|
+
import { useI18n } from '../locale/translate';
|
|
3
|
+
import {
|
|
4
|
+
confirmationRequired,
|
|
5
|
+
resolveConfirmationPolicy,
|
|
6
|
+
type ConfirmationRequest,
|
|
7
|
+
} from './confirmation';
|
|
8
|
+
|
|
9
|
+
const TITLES = {
|
|
10
|
+
delete: 'confirm.delete.title',
|
|
11
|
+
typeChange: 'confirm.typeChange.title',
|
|
12
|
+
branchChange: 'confirm.branchChange.title',
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
const MESSAGES = {
|
|
16
|
+
delete: 'confirm.delete.message',
|
|
17
|
+
typeChange: 'confirm.typeChange.message',
|
|
18
|
+
branchChange: 'confirm.branchChange.message',
|
|
19
|
+
} as const;
|
|
20
|
+
|
|
21
|
+
/** Confirmation policy and pending action; UI packages provide only the dialog. */
|
|
22
|
+
export const useConfirmationState = () => {
|
|
23
|
+
const t = useI18n();
|
|
24
|
+
const [pending, setPending] = useState<ConfirmationRequest>();
|
|
25
|
+
const pendingRef = useRef<ConfirmationRequest>();
|
|
26
|
+
const request = useCallback((next: ConfirmationRequest) => {
|
|
27
|
+
const prompts = confirmationRequired(
|
|
28
|
+
resolveConfirmationPolicy({
|
|
29
|
+
options: next.options,
|
|
30
|
+
config: next.config,
|
|
31
|
+
catalogId: next.catalogId,
|
|
32
|
+
operation: next.operation,
|
|
33
|
+
}),
|
|
34
|
+
next.discarded,
|
|
35
|
+
);
|
|
36
|
+
if (!prompts) {
|
|
37
|
+
next.perform();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
pendingRef.current = next;
|
|
41
|
+
setPending(next);
|
|
42
|
+
}, []);
|
|
43
|
+
const close = useCallback(() => {
|
|
44
|
+
pendingRef.current = undefined;
|
|
45
|
+
setPending(undefined);
|
|
46
|
+
}, []);
|
|
47
|
+
const confirm = useCallback(() => {
|
|
48
|
+
const action = pendingRef.current;
|
|
49
|
+
close();
|
|
50
|
+
action?.perform();
|
|
51
|
+
}, [close]);
|
|
52
|
+
const title = pending ? t(TITLES[pending.operation]) : undefined;
|
|
53
|
+
const message = pending ? t(MESSAGES[pending.operation]) : undefined;
|
|
54
|
+
return { t, pending, request, close, confirm, title, message };
|
|
55
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Hides content visually while leaving it available to assistive technology.
|
|
5
|
+
*
|
|
6
|
+
* Inline rather than a `sr-only` class: that class is defined in the demo
|
|
7
|
+
* application's stylesheet, not in this package, so a renderer relying on it
|
|
8
|
+
* shows the text to everyone in any other host.
|
|
9
|
+
*/
|
|
10
|
+
export const visuallyHidden: CSSProperties = {
|
|
11
|
+
border: 0,
|
|
12
|
+
clip: 'rect(0 0 0 0)',
|
|
13
|
+
clipPath: 'inset(50%)',
|
|
14
|
+
height: 1,
|
|
15
|
+
overflow: 'hidden',
|
|
16
|
+
position: 'absolute',
|
|
17
|
+
whiteSpace: 'nowrap',
|
|
18
|
+
width: 1,
|
|
19
|
+
};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useDynamicElements,
|
|
3
|
+
dynamicAuthoredElement,
|
|
4
|
+
} from '../dynamic/DynamicUiProvider';
|
|
5
|
+
import { resolveCollapsed } from './groupState';
|
|
6
|
+
import { Categorization, Category, isVisible } from '@jsonforms/core';
|
|
7
|
+
import { useMemo, useState } from 'react';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A category's stable identity, for keeping the selection across a reorder.
|
|
11
|
+
*
|
|
12
|
+
* The specification says to "preserve the selected category's identity across
|
|
13
|
+
* reordering" and that sibling `name`s SHOULD be unique, so the name is the
|
|
14
|
+
* identity when there is one. Without a name there is nothing to preserve -
|
|
15
|
+
* position is all a category has - so the index stands in, and moving an
|
|
16
|
+
* unnamed category moves the selection with the slot rather than the content.
|
|
17
|
+
* Prefixed so a category named `2` cannot collide with the third unnamed one.
|
|
18
|
+
*/
|
|
19
|
+
export const categoryKey = (category: Category, index: number): string => {
|
|
20
|
+
const name = (
|
|
21
|
+
dynamicAuthoredElement(category) as Category & { name?: unknown }
|
|
22
|
+
).name;
|
|
23
|
+
return typeof name === 'string' && name.length > 0
|
|
24
|
+
? `name:${name}`
|
|
25
|
+
: `index:${index}`;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** Warned-about elements, so an authoring mistake is reported once, not per render. */
|
|
29
|
+
const warned = new WeakSet<Categorization>();
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The index `options.initial` asks for, or `0`.
|
|
33
|
+
*
|
|
34
|
+
* "Missing target falls back to first visible category with diagnostic."
|
|
35
|
+
* The diagnostic is a console warning rather than something rendered: a name
|
|
36
|
+
* that does not match any category is a mistake in the UI schema, which the
|
|
37
|
+
* author can fix and the person filling in the form can do nothing about.
|
|
38
|
+
* That is why the specification's `categorization.initialNotFound` key has no
|
|
39
|
+
* entry in our catalogue - nothing user-facing uses it. See Adjustment 10.
|
|
40
|
+
*/
|
|
41
|
+
export const resolveInitialIndex = (
|
|
42
|
+
categories: Category[],
|
|
43
|
+
categorization: Categorization,
|
|
44
|
+
): number => {
|
|
45
|
+
const initial = (
|
|
46
|
+
categorization.options as Record<string, unknown> | undefined
|
|
47
|
+
)?.initial;
|
|
48
|
+
if (typeof initial !== 'string' || initial.length === 0) {
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
const found = categories.findIndex(
|
|
52
|
+
(category) => (category as Category & { name?: unknown }).name === initial,
|
|
53
|
+
);
|
|
54
|
+
if (found >= 0) {
|
|
55
|
+
return found;
|
|
56
|
+
}
|
|
57
|
+
if (!warned.has(categorization)) {
|
|
58
|
+
warned.add(categorization);
|
|
59
|
+
// oxlint-disable-next-line no-console
|
|
60
|
+
console.warn(
|
|
61
|
+
`Categorization: options.initial "${initial}" matches no visible category; opening the first one instead.`,
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
return 0;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/** Nothing open: no visible categories, or the accordion was closed. */
|
|
68
|
+
export const NO_CATEGORY = -1;
|
|
69
|
+
|
|
70
|
+
export interface CategorySelection {
|
|
71
|
+
/** The visible categories, in UI schema order. */
|
|
72
|
+
categories: Category[];
|
|
73
|
+
/** Index into {@link categories}, or {@link NO_CATEGORY}. */
|
|
74
|
+
active: number;
|
|
75
|
+
/** Selects by index into {@link categories}. */
|
|
76
|
+
select: (index: number) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Closes the open category, where the presentation permits it.
|
|
79
|
+
*
|
|
80
|
+
* Ignored unless the caller passed `closable` - a tab strip or a stepper
|
|
81
|
+
* with nothing selected has no meaning. See Adjustment 10.2.
|
|
82
|
+
*/
|
|
83
|
+
close: () => void;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The navigation contract shared by the tabs, stepper and accordion
|
|
88
|
+
* presentations of a Categorization.
|
|
89
|
+
*
|
|
90
|
+
* All three answer the same questions - which categories are visible, which
|
|
91
|
+
* one is current, what happens when the current one disappears - and section 8
|
|
92
|
+
* specifies the answers once, for all of them:
|
|
93
|
+
*
|
|
94
|
+
* - Visibility is the category's own rule. A visible category with no visible
|
|
95
|
+
* children stays selectable; there is no `hideWhenEmpty`.
|
|
96
|
+
* - "When the selected category becomes hidden, select an available visible
|
|
97
|
+
* category": the selection is resolved from identity on every render, so a
|
|
98
|
+
* category that disappears falls back to the initial one rather than leaving
|
|
99
|
+
* a stale index pointing at a different category's content.
|
|
100
|
+
* - With nothing visible there is "no active category or stale active panel",
|
|
101
|
+
* which is what {@link NO_CATEGORY} means here.
|
|
102
|
+
*
|
|
103
|
+
* `closable` adds the one place this project **differs** from section 8: an
|
|
104
|
+
* accordion may be closed entirely, so an explicit close is remembered and is
|
|
105
|
+
* not undone by the fallback above. A tab strip and a stepper are not
|
|
106
|
+
* closable - there is no such thing as a tab strip with no current tab - so
|
|
107
|
+
* they leave it off and behave exactly as specified. See Adjustment 10.2.
|
|
108
|
+
*
|
|
109
|
+
* Selection is runtime UI state: it never writes form data or the UI schema.
|
|
110
|
+
*/
|
|
111
|
+
export const useCategorySelection = (
|
|
112
|
+
categorization: Categorization,
|
|
113
|
+
data: unknown,
|
|
114
|
+
ajv: unknown,
|
|
115
|
+
config: unknown,
|
|
116
|
+
initiallySelected?: number,
|
|
117
|
+
closable = false,
|
|
118
|
+
path = '',
|
|
119
|
+
): CategorySelection => {
|
|
120
|
+
const effectiveCategories = useDynamicElements(
|
|
121
|
+
categorization.elements ?? [],
|
|
122
|
+
path,
|
|
123
|
+
);
|
|
124
|
+
const categories = useMemo(
|
|
125
|
+
() =>
|
|
126
|
+
effectiveCategories.filter((category) =>
|
|
127
|
+
isVisible(category, data, path, ajv as never, config as never),
|
|
128
|
+
) as Category[],
|
|
129
|
+
[effectiveCategories, data, ajv, config, path],
|
|
130
|
+
);
|
|
131
|
+
/*
|
|
132
|
+
`undefined` means untouched, so `options.initial` decides. `null` means
|
|
133
|
+
the user closed the accordion, which is a state they chose and which a
|
|
134
|
+
later visibility change must not quietly undo - so it is a third value
|
|
135
|
+
rather than a second meaning for `undefined`.
|
|
136
|
+
*/
|
|
137
|
+
const initiallyCollapsed = resolveCollapsed(
|
|
138
|
+
categorization.options,
|
|
139
|
+
config,
|
|
140
|
+
'accordion',
|
|
141
|
+
);
|
|
142
|
+
const [selectedKey, setSelectedKey] = useState<string | null | undefined>(
|
|
143
|
+
() =>
|
|
144
|
+
initiallySelected === undefined
|
|
145
|
+
? closable && initiallyCollapsed && !categorization.options?.initial
|
|
146
|
+
? null
|
|
147
|
+
: undefined
|
|
148
|
+
: categoryKey(
|
|
149
|
+
(categorization.elements ?? [])[initiallySelected] as Category,
|
|
150
|
+
initiallySelected,
|
|
151
|
+
),
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
const [previousCollapsed, setPreviousCollapsed] =
|
|
155
|
+
useState(initiallyCollapsed);
|
|
156
|
+
if (previousCollapsed !== initiallyCollapsed) {
|
|
157
|
+
setPreviousCollapsed(initiallyCollapsed);
|
|
158
|
+
if (closable) setSelectedKey(initiallyCollapsed ? null : undefined);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const fromKey =
|
|
162
|
+
typeof selectedKey !== 'string'
|
|
163
|
+
? NO_CATEGORY
|
|
164
|
+
: categories.findIndex(
|
|
165
|
+
(category, index) => categoryKey(category, index) === selectedKey,
|
|
166
|
+
);
|
|
167
|
+
const active =
|
|
168
|
+
categories.length === 0 || selectedKey === null
|
|
169
|
+
? NO_CATEGORY
|
|
170
|
+
: fromKey >= 0
|
|
171
|
+
? fromKey
|
|
172
|
+
: resolveInitialIndex(categories, categorization);
|
|
173
|
+
|
|
174
|
+
return {
|
|
175
|
+
categories,
|
|
176
|
+
active,
|
|
177
|
+
select: (index: number) => {
|
|
178
|
+
const category = categories[index];
|
|
179
|
+
if (category) {
|
|
180
|
+
setSelectedKey(categoryKey(category, index));
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
close: () => {
|
|
184
|
+
if (closable) {
|
|
185
|
+
setSelectedKey(null);
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
};
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { useTranslator } from '../locale/translate';
|
|
2
|
+
import { useDynamicTreeResolver } from '../dynamic/DynamicUiProvider';
|
|
3
|
+
import { Resolve, toDataPathSegments, UISchemaElement } from '@jsonforms/core';
|
|
4
|
+
import { JSONFORMS_EXTENDED_CONFIG_KEY } from '../core/configNamespaces';
|
|
5
|
+
import { useJsonForms } from '@jsonforms/react';
|
|
6
|
+
import { useCallback, useId, useMemo, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
/** Matches Svelte Group semantics: false and zero count, empty containers do not. */
|
|
9
|
+
export const hasGroupValue = (value: unknown): boolean => {
|
|
10
|
+
if (value === undefined || value === null) return false;
|
|
11
|
+
if (typeof value === 'string') return value.trim().length > 0;
|
|
12
|
+
if (Array.isArray(value)) return value.some(hasGroupValue);
|
|
13
|
+
if (typeof value === 'object')
|
|
14
|
+
return Object.values(value).some(hasGroupValue);
|
|
15
|
+
return true;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** Where one Control below a container is bound. */
|
|
19
|
+
export interface BoundPath {
|
|
20
|
+
/** Scope segments, for resolving a value against the container's context. */
|
|
21
|
+
segments: string[];
|
|
22
|
+
/** The same path dotted, to prefix with the container's data path. */
|
|
23
|
+
relative: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Every Control bound below an element, as data paths.
|
|
28
|
+
*
|
|
29
|
+
* This is the traversal both container indicators need, so it is done once and
|
|
30
|
+
* shared rather than once per indicator:
|
|
31
|
+
*
|
|
32
|
+
* - the data-presence indicator resolves `segments` against the container's
|
|
33
|
+
* data context and asks whether any value is present;
|
|
34
|
+
* - an error indicator prefixes `relative` with the container's data path and
|
|
35
|
+
* asks whether any of them is in the error index.
|
|
36
|
+
*
|
|
37
|
+
* It depends only on the UI schema, never on the data, so it is computed once
|
|
38
|
+
* per element rather than on every render - splitting each scope string was
|
|
39
|
+
* previously repeated for every Control on every keystroke.
|
|
40
|
+
*
|
|
41
|
+
* Keyed by element identity: a regenerated element simply misses the cache and
|
|
42
|
+
* is recomputed, and entries for discarded elements are collected.
|
|
43
|
+
*/
|
|
44
|
+
const boundPathsCache = new WeakMap<UISchemaElement, BoundPath[]>();
|
|
45
|
+
|
|
46
|
+
export const collectBoundPaths = (element: UISchemaElement): BoundPath[] => {
|
|
47
|
+
const cached = boundPathsCache.get(element);
|
|
48
|
+
if (cached) {
|
|
49
|
+
return cached;
|
|
50
|
+
}
|
|
51
|
+
const paths: BoundPath[] = [];
|
|
52
|
+
const walk = (node: UISchemaElement) => {
|
|
53
|
+
const candidate = node as UISchemaElement & {
|
|
54
|
+
scope?: string;
|
|
55
|
+
elements?: UISchemaElement[];
|
|
56
|
+
};
|
|
57
|
+
if (
|
|
58
|
+
(candidate.type === 'Control' || candidate.type === 'ListWithDetail') &&
|
|
59
|
+
typeof candidate.scope === 'string'
|
|
60
|
+
) {
|
|
61
|
+
const segments = toDataPathSegments(candidate.scope);
|
|
62
|
+
paths.push({ segments, relative: segments.join('.') });
|
|
63
|
+
}
|
|
64
|
+
candidate.elements?.forEach(walk);
|
|
65
|
+
};
|
|
66
|
+
walk(element);
|
|
67
|
+
boundPathsCache.set(element, paths);
|
|
68
|
+
return paths;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Absolute data paths of everything bound below a container, for looking each
|
|
73
|
+
* one up in the shared error index.
|
|
74
|
+
*/
|
|
75
|
+
export const boundDataPaths = (element: UISchemaElement, path = ''): string[] =>
|
|
76
|
+
collectBoundPaths(element).map(({ relative }) =>
|
|
77
|
+
[path, relative].filter(Boolean).join('.'),
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const resolveSegments = (context: unknown, segments: string[]): unknown =>
|
|
81
|
+
segments.reduce<unknown>(
|
|
82
|
+
(current, key) =>
|
|
83
|
+
current !== null && typeof current === 'object'
|
|
84
|
+
? (current as Record<string, unknown>)[key]
|
|
85
|
+
: undefined,
|
|
86
|
+
context,
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
export const groupHasData = (
|
|
90
|
+
element: UISchemaElement,
|
|
91
|
+
data: unknown,
|
|
92
|
+
path = '',
|
|
93
|
+
): boolean => {
|
|
94
|
+
// Resolved once for the whole subtree. It used to be resolved again for
|
|
95
|
+
// every Control, which is the same answer each time.
|
|
96
|
+
const context = path ? Resolve.data(data, path) : data;
|
|
97
|
+
return collectBoundPaths(element).some(({ segments }) =>
|
|
98
|
+
hasGroupValue(resolveSegments(context, segments)),
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const useGroupState = (
|
|
103
|
+
uischema: UISchemaElement,
|
|
104
|
+
path: string,
|
|
105
|
+
config?: Record<string, unknown>,
|
|
106
|
+
) => {
|
|
107
|
+
const context = useJsonForms();
|
|
108
|
+
const resolveTree = useDynamicTreeResolver(path);
|
|
109
|
+
const effectiveUi = resolveTree(uischema);
|
|
110
|
+
const { collapsible, collapsed, setExpanded } = useGroupExpansion(
|
|
111
|
+
effectiveUi,
|
|
112
|
+
config,
|
|
113
|
+
);
|
|
114
|
+
const showDataIndicator =
|
|
115
|
+
groupOption(effectiveUi, config, 'showDataIndicator') === true;
|
|
116
|
+
const data = context.core?.data;
|
|
117
|
+
const contentId = useId();
|
|
118
|
+
// Only re-resolve when the data actually changes. Collapsing a panel, a
|
|
119
|
+
// locale change or any unrelated parent render no longer walks the group.
|
|
120
|
+
const hasData = useMemo(
|
|
121
|
+
() => showDataIndicator && groupHasData(effectiveUi, data, path),
|
|
122
|
+
[showDataIndicator, effectiveUi, data, path],
|
|
123
|
+
);
|
|
124
|
+
return {
|
|
125
|
+
contentId,
|
|
126
|
+
collapsible,
|
|
127
|
+
collapsed: collapsible && collapsed,
|
|
128
|
+
hasData,
|
|
129
|
+
toggle: () => setExpanded(collapsed),
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
/** Element options override namespaced defaults. */
|
|
134
|
+
const groupOption = (
|
|
135
|
+
uischema: UISchemaElement,
|
|
136
|
+
config: Record<string, unknown> | undefined,
|
|
137
|
+
name: string,
|
|
138
|
+
) => {
|
|
139
|
+
const namespaced = config?.[JSONFORMS_EXTENDED_CONFIG_KEY] as
|
|
140
|
+
| Record<string, unknown>
|
|
141
|
+
| undefined;
|
|
142
|
+
return uischema.options?.[name] ?? namespaced?.[name];
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/** Shared outer-frame expansion; independent of tree and array-item state. */
|
|
146
|
+
export const useGroupExpansion = (
|
|
147
|
+
uischema: UISchemaElement,
|
|
148
|
+
config?: Record<string, unknown>,
|
|
149
|
+
defaultCollapsible = false,
|
|
150
|
+
component: CollapseComponent = 'group',
|
|
151
|
+
) => {
|
|
152
|
+
const collapsible =
|
|
153
|
+
(groupOption(uischema, config, 'collapsible') ?? defaultCollapsible) ===
|
|
154
|
+
true;
|
|
155
|
+
const initiallyCollapsed = resolveCollapsed(
|
|
156
|
+
uischema.options,
|
|
157
|
+
config,
|
|
158
|
+
component,
|
|
159
|
+
);
|
|
160
|
+
const [collapsed, setCollapsed] = useState(initiallyCollapsed);
|
|
161
|
+
const [previousCollapsed, setPreviousCollapsed] =
|
|
162
|
+
useState(initiallyCollapsed);
|
|
163
|
+
if (previousCollapsed !== initiallyCollapsed) {
|
|
164
|
+
setPreviousCollapsed(initiallyCollapsed);
|
|
165
|
+
setCollapsed(initiallyCollapsed);
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
collapsible,
|
|
169
|
+
collapsed: collapsible && collapsed,
|
|
170
|
+
setExpanded: useCallback(
|
|
171
|
+
(expanded: boolean) => setCollapsed(!expanded),
|
|
172
|
+
[],
|
|
173
|
+
),
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export type CollapseComponent = 'group' | 'mixed' | 'accordion' | 'array';
|
|
178
|
+
|
|
179
|
+
/** False overrides true; omitted component settings inherit the shared default. */
|
|
180
|
+
export const resolveCollapsed = (
|
|
181
|
+
options: Record<string, any> | undefined,
|
|
182
|
+
config: any,
|
|
183
|
+
component: CollapseComponent,
|
|
184
|
+
): boolean =>
|
|
185
|
+
(options?.collapsed ??
|
|
186
|
+
config?.jsonformsExtended?.[component]?.collapsed ??
|
|
187
|
+
config?.jsonformsExtended?.collapsed ??
|
|
188
|
+
false) === true;
|
|
189
|
+
|
|
190
|
+
export function useGroupHeaderTitle(path: string, header?: UISchemaElement[]) {
|
|
191
|
+
const translate = useTranslator();
|
|
192
|
+
const resolveHeader = useDynamicTreeResolver(path);
|
|
193
|
+
const headerLabel = header
|
|
194
|
+
?.map(resolveHeader)
|
|
195
|
+
.find((element) => element.type === 'Label') as
|
|
196
|
+
| { text?: string; i18n?: string }
|
|
197
|
+
| undefined;
|
|
198
|
+
return headerLabel?.i18n
|
|
199
|
+
? translate(`${headerLabel.i18n}.text`, headerLabel.text || '')
|
|
200
|
+
: headerLabel?.text;
|
|
201
|
+
}
|