@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,337 @@
|
|
|
1
|
+
import React, { useId, useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
+
import { useJsonForms } from '@jsonforms/react';
|
|
3
|
+
|
|
4
|
+
export type InputAdornment =
|
|
5
|
+
| { kind: 'text'; text: string; i18n?: string; tooltip?: string }
|
|
6
|
+
| {
|
|
7
|
+
kind: 'icon';
|
|
8
|
+
icon: string;
|
|
9
|
+
label: string;
|
|
10
|
+
i18n?: string;
|
|
11
|
+
tooltip?: string;
|
|
12
|
+
decorative?: false;
|
|
13
|
+
}
|
|
14
|
+
| { kind: 'icon'; icon: string; decorative: true };
|
|
15
|
+
|
|
16
|
+
export function normalizeInputAdornments(value: unknown): InputAdornment[] {
|
|
17
|
+
const values = Array.isArray(value) ? value : [value];
|
|
18
|
+
return values.flatMap((item) => {
|
|
19
|
+
if (typeof item === 'string')
|
|
20
|
+
return item && !Array.isArray(value)
|
|
21
|
+
? [{ kind: 'text' as const, text: item }]
|
|
22
|
+
: [];
|
|
23
|
+
if (!item || typeof item !== 'object') return [];
|
|
24
|
+
const entry = item as Record<string, unknown>;
|
|
25
|
+
if (entry.kind === 'text' && typeof entry.text === 'string' && entry.text)
|
|
26
|
+
return [entry as InputAdornment];
|
|
27
|
+
if (
|
|
28
|
+
entry.kind === 'icon' &&
|
|
29
|
+
typeof entry.icon === 'string' &&
|
|
30
|
+
entry.icon &&
|
|
31
|
+
(entry.decorative === true ||
|
|
32
|
+
(typeof entry.label === 'string' && entry.label))
|
|
33
|
+
)
|
|
34
|
+
return [entry as InputAdornment];
|
|
35
|
+
return [];
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function supportsInputAdornments(
|
|
40
|
+
schema:
|
|
41
|
+
| { type?: unknown; format?: unknown; contentEncoding?: unknown }
|
|
42
|
+
| undefined,
|
|
43
|
+
options: Record<string, unknown>,
|
|
44
|
+
): boolean {
|
|
45
|
+
const type = schema?.type;
|
|
46
|
+
if (type !== 'string' && type !== 'number' && type !== 'integer')
|
|
47
|
+
return false;
|
|
48
|
+
if (
|
|
49
|
+
schema?.format === 'binary' ||
|
|
50
|
+
schema?.format === 'byte' ||
|
|
51
|
+
schema?.contentEncoding === 'base64'
|
|
52
|
+
)
|
|
53
|
+
return false;
|
|
54
|
+
if (
|
|
55
|
+
options.slider === true ||
|
|
56
|
+
options.variant === 'otp' ||
|
|
57
|
+
options.format === 'code' ||
|
|
58
|
+
options.format === 'radio' ||
|
|
59
|
+
options.showRadio === true
|
|
60
|
+
)
|
|
61
|
+
return false;
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const icons: Record<string, string> = {
|
|
66
|
+
information: 'ⓘ',
|
|
67
|
+
account: '◉',
|
|
68
|
+
schedule: '◷',
|
|
69
|
+
lock: '🔒',
|
|
70
|
+
};
|
|
71
|
+
const itemStyle: React.CSSProperties = {
|
|
72
|
+
position: 'relative',
|
|
73
|
+
flex: 'none',
|
|
74
|
+
whiteSpace: 'nowrap',
|
|
75
|
+
color: 'inherit',
|
|
76
|
+
};
|
|
77
|
+
const tooltipStyle: React.CSSProperties = {
|
|
78
|
+
position: 'absolute',
|
|
79
|
+
zIndex: 100,
|
|
80
|
+
insetBlockStart: '100%',
|
|
81
|
+
insetInlineStart: 0,
|
|
82
|
+
width: 'max-content',
|
|
83
|
+
maxWidth: 'min(20rem, 80vw)',
|
|
84
|
+
whiteSpace: 'normal',
|
|
85
|
+
padding: '.35rem .5rem',
|
|
86
|
+
borderRadius: '.25rem',
|
|
87
|
+
color: 'white',
|
|
88
|
+
background: '#222',
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
function AdornmentItem({
|
|
92
|
+
item,
|
|
93
|
+
side,
|
|
94
|
+
}: {
|
|
95
|
+
item: InputAdornment;
|
|
96
|
+
side: 'start' | 'end';
|
|
97
|
+
}) {
|
|
98
|
+
const { i18n } = useJsonForms();
|
|
99
|
+
const tooltipId = useId();
|
|
100
|
+
const [open, setOpen] = useState(false);
|
|
101
|
+
const translate = (role: string, fallback: string) =>
|
|
102
|
+
'i18n' in item && item.i18n
|
|
103
|
+
? (i18n?.translate?.(`${item.i18n}.${role}`, fallback) ?? fallback)
|
|
104
|
+
: fallback;
|
|
105
|
+
const label =
|
|
106
|
+
item.kind === 'text'
|
|
107
|
+
? translate('text', item.text)
|
|
108
|
+
: item.decorative
|
|
109
|
+
? ''
|
|
110
|
+
: translate('label', (item as { label?: string }).label ?? '');
|
|
111
|
+
const tooltip =
|
|
112
|
+
'tooltip' in item && item.tooltip ? translate('tooltip', item.tooltip) : '';
|
|
113
|
+
const content =
|
|
114
|
+
item.kind === 'text'
|
|
115
|
+
? label
|
|
116
|
+
: icons[item.icon] || (item.decorative ? '' : label);
|
|
117
|
+
if (tooltip)
|
|
118
|
+
return (
|
|
119
|
+
<button
|
|
120
|
+
type='button'
|
|
121
|
+
data-adornment={side}
|
|
122
|
+
data-kind={item.kind}
|
|
123
|
+
aria-label={item.kind === 'icon' ? label : undefined}
|
|
124
|
+
aria-describedby={tooltipId}
|
|
125
|
+
onFocus={() => setOpen(true)}
|
|
126
|
+
onBlur={() => setOpen(false)}
|
|
127
|
+
onMouseEnter={() => setOpen(true)}
|
|
128
|
+
onMouseLeave={() => setOpen(false)}
|
|
129
|
+
style={{
|
|
130
|
+
...itemStyle,
|
|
131
|
+
border: 0,
|
|
132
|
+
background: 'transparent',
|
|
133
|
+
padding: 0,
|
|
134
|
+
font: 'inherit',
|
|
135
|
+
}}
|
|
136
|
+
>
|
|
137
|
+
<span aria-hidden={item.kind === 'icon' || undefined}>{content}</span>
|
|
138
|
+
<span
|
|
139
|
+
id={tooltipId}
|
|
140
|
+
role='tooltip'
|
|
141
|
+
style={{
|
|
142
|
+
...tooltipStyle,
|
|
143
|
+
...(side === 'end'
|
|
144
|
+
? { insetInlineStart: 'auto', insetInlineEnd: 0 }
|
|
145
|
+
: {}),
|
|
146
|
+
display: open ? 'block' : 'none',
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
149
|
+
{tooltip}
|
|
150
|
+
</span>
|
|
151
|
+
</button>
|
|
152
|
+
);
|
|
153
|
+
return (
|
|
154
|
+
<span
|
|
155
|
+
data-adornment={side}
|
|
156
|
+
data-kind={item.kind}
|
|
157
|
+
role={item.kind === 'icon' && !item.decorative ? 'img' : undefined}
|
|
158
|
+
aria-label={item.kind === 'icon' && !item.decorative ? label : undefined}
|
|
159
|
+
aria-hidden={item.kind === 'icon' && item.decorative ? true : undefined}
|
|
160
|
+
style={itemStyle}
|
|
161
|
+
>
|
|
162
|
+
{content}
|
|
163
|
+
</span>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const fieldSelectors = [
|
|
168
|
+
'button[data-slot="select-trigger"]',
|
|
169
|
+
'.ant-input-affix-wrapper',
|
|
170
|
+
'.ant-picker',
|
|
171
|
+
'.ant-input-number',
|
|
172
|
+
'.ant-select',
|
|
173
|
+
'.ant-select-selector',
|
|
174
|
+
'.ant-input',
|
|
175
|
+
'input',
|
|
176
|
+
'textarea',
|
|
177
|
+
'select',
|
|
178
|
+
'button[aria-haspopup]',
|
|
179
|
+
'button[id]',
|
|
180
|
+
];
|
|
181
|
+
|
|
182
|
+
function findField(root: HTMLElement): HTMLElement | null {
|
|
183
|
+
for (const selector of fieldSelectors) {
|
|
184
|
+
const field = root.querySelector<HTMLElement>(selector);
|
|
185
|
+
if (field) return field;
|
|
186
|
+
}
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export function InputAdornments({
|
|
191
|
+
schema,
|
|
192
|
+
options,
|
|
193
|
+
children,
|
|
194
|
+
}: React.PropsWithChildren<{
|
|
195
|
+
schema?: { type?: unknown; format?: unknown; contentEncoding?: unknown };
|
|
196
|
+
options?: Record<string, unknown>;
|
|
197
|
+
}>) {
|
|
198
|
+
const applied = options ?? {};
|
|
199
|
+
const eligible = supportsInputAdornments(schema, applied);
|
|
200
|
+
const start = eligible
|
|
201
|
+
? normalizeInputAdornments(applied.startAdornment)
|
|
202
|
+
: [];
|
|
203
|
+
const end = eligible ? normalizeInputAdornments(applied.endAdornment) : [];
|
|
204
|
+
const hasAdornments = start.length > 0 || end.length > 0;
|
|
205
|
+
const controlRef = useRef<HTMLDivElement>(null);
|
|
206
|
+
const startRef = useRef<HTMLDivElement>(null);
|
|
207
|
+
const endRef = useRef<HTMLDivElement>(null);
|
|
208
|
+
|
|
209
|
+
useLayoutEffect(() => {
|
|
210
|
+
const control = controlRef.current;
|
|
211
|
+
if (!control || !hasAdornments) return;
|
|
212
|
+
const root = control.parentElement;
|
|
213
|
+
const field = findField(control);
|
|
214
|
+
if (!field) return;
|
|
215
|
+
const originalStart = field.style.paddingInlineStart;
|
|
216
|
+
const originalEnd = field.style.paddingInlineEnd;
|
|
217
|
+
const originalTransition = field.style.transition;
|
|
218
|
+
const computed = getComputedStyle(field);
|
|
219
|
+
const baseStart = Number.parseFloat(computed.paddingInlineStart) || 0;
|
|
220
|
+
const baseEnd = Number.parseFloat(computed.paddingInlineEnd) || 0;
|
|
221
|
+
const shifted: Array<{
|
|
222
|
+
element: HTMLElement;
|
|
223
|
+
property: 'insetInlineStart' | 'insetInlineEnd';
|
|
224
|
+
original: string;
|
|
225
|
+
base: number;
|
|
226
|
+
}> = [];
|
|
227
|
+
for (const element of Array.from(
|
|
228
|
+
control.querySelectorAll<HTMLElement>('button, div'),
|
|
229
|
+
)) {
|
|
230
|
+
if (
|
|
231
|
+
element === field ||
|
|
232
|
+
getComputedStyle(element).position !== 'absolute'
|
|
233
|
+
)
|
|
234
|
+
continue;
|
|
235
|
+
const side = element.className.includes('start-')
|
|
236
|
+
? 'insetInlineStart'
|
|
237
|
+
: element.className.includes('end-')
|
|
238
|
+
? 'insetInlineEnd'
|
|
239
|
+
: undefined;
|
|
240
|
+
if (!side) continue;
|
|
241
|
+
shifted.push({
|
|
242
|
+
element,
|
|
243
|
+
property: side,
|
|
244
|
+
original: element.style[side],
|
|
245
|
+
base: Number.parseFloat(getComputedStyle(element)[side]) || 0,
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
let transitionFrame = 0;
|
|
249
|
+
const apply = () => {
|
|
250
|
+
cancelAnimationFrame(transitionFrame);
|
|
251
|
+
const startSpace = startRef.current?.offsetWidth ?? 0;
|
|
252
|
+
const endSpace = endRef.current?.offsetWidth ?? 0;
|
|
253
|
+
root?.style.setProperty(
|
|
254
|
+
'--jf-end-adornment-space',
|
|
255
|
+
endSpace ? `${endSpace + 8}px` : '0px',
|
|
256
|
+
);
|
|
257
|
+
field.style.transition = 'none';
|
|
258
|
+
field.style.paddingInlineStart = `${baseStart + (startSpace ? startSpace + 8 : 0)}px`;
|
|
259
|
+
field.style.paddingInlineEnd = `${baseEnd + (endSpace ? endSpace + 8 : 0)}px`;
|
|
260
|
+
for (const { element, property, base } of shifted) {
|
|
261
|
+
const space = property === 'insetInlineStart' ? startSpace : endSpace;
|
|
262
|
+
if (space) element.style[property] = `${base + space + 8}px`;
|
|
263
|
+
}
|
|
264
|
+
transitionFrame = requestAnimationFrame(() => {
|
|
265
|
+
field.style.transition = originalTransition;
|
|
266
|
+
});
|
|
267
|
+
};
|
|
268
|
+
apply();
|
|
269
|
+
const observer = new ResizeObserver(apply);
|
|
270
|
+
if (startRef.current) observer.observe(startRef.current);
|
|
271
|
+
if (endRef.current) observer.observe(endRef.current);
|
|
272
|
+
return () => {
|
|
273
|
+
observer.disconnect();
|
|
274
|
+
cancelAnimationFrame(transitionFrame);
|
|
275
|
+
field.style.transition = originalTransition;
|
|
276
|
+
root?.style.removeProperty('--jf-end-adornment-space');
|
|
277
|
+
field.style.paddingInlineStart = originalStart;
|
|
278
|
+
field.style.paddingInlineEnd = originalEnd;
|
|
279
|
+
for (const { element, property, original } of shifted)
|
|
280
|
+
element.style[property] = original;
|
|
281
|
+
};
|
|
282
|
+
}, [hasAdornments]);
|
|
283
|
+
|
|
284
|
+
if (!hasAdornments) return <>{children}</>;
|
|
285
|
+
return (
|
|
286
|
+
<div
|
|
287
|
+
data-input-adornments
|
|
288
|
+
style={{ position: 'relative', width: '100%', minWidth: 0 }}
|
|
289
|
+
>
|
|
290
|
+
{start.length > 0 && (
|
|
291
|
+
<div
|
|
292
|
+
ref={startRef}
|
|
293
|
+
data-adornment-group='start'
|
|
294
|
+
style={{
|
|
295
|
+
position: 'absolute',
|
|
296
|
+
zIndex: 3,
|
|
297
|
+
insetInlineStart: 8,
|
|
298
|
+
insetBlockStart: '50%',
|
|
299
|
+
transform: 'translateY(-50%)',
|
|
300
|
+
display: 'flex',
|
|
301
|
+
alignItems: 'center',
|
|
302
|
+
gap: 4,
|
|
303
|
+
whiteSpace: 'nowrap',
|
|
304
|
+
}}
|
|
305
|
+
>
|
|
306
|
+
{start.map((item, index) => (
|
|
307
|
+
<AdornmentItem key={`start-${index}`} item={item} side='start' />
|
|
308
|
+
))}
|
|
309
|
+
</div>
|
|
310
|
+
)}
|
|
311
|
+
<div ref={controlRef} style={{ minWidth: 0 }}>
|
|
312
|
+
{children}
|
|
313
|
+
</div>
|
|
314
|
+
{end.length > 0 && (
|
|
315
|
+
<div
|
|
316
|
+
ref={endRef}
|
|
317
|
+
data-adornment-group='end'
|
|
318
|
+
style={{
|
|
319
|
+
position: 'absolute',
|
|
320
|
+
zIndex: 3,
|
|
321
|
+
insetInlineEnd: 8,
|
|
322
|
+
insetBlockStart: '50%',
|
|
323
|
+
transform: 'translateY(-50%)',
|
|
324
|
+
display: 'flex',
|
|
325
|
+
alignItems: 'center',
|
|
326
|
+
gap: 4,
|
|
327
|
+
whiteSpace: 'nowrap',
|
|
328
|
+
}}
|
|
329
|
+
>
|
|
330
|
+
{end.map((item, index) => (
|
|
331
|
+
<AdornmentItem key={`end-${index}`} item={item} side='end' />
|
|
332
|
+
))}
|
|
333
|
+
</div>
|
|
334
|
+
)}
|
|
335
|
+
</div>
|
|
336
|
+
);
|
|
337
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts what a numeric input reports into a value safe to commit.
|
|
3
|
+
*
|
|
4
|
+
* The specification is explicit that a numeric editor must "parse the complete
|
|
5
|
+
* input before committing a number" and must not "accept a numeric prefix
|
|
6
|
+
* while silently discarding the rest of the user's entry":
|
|
7
|
+
*
|
|
8
|
+
* - `parseInt('1.9')` is `1`. Typing a fractional value into an integer field
|
|
9
|
+
* silently committed a different number than the one on screen. The spec
|
|
10
|
+
* names this case: "1.9 must not become integer 1 through truncation."
|
|
11
|
+
* - `parseInt('1e3')` is `1`, not `1000` - the spec names this one too. An
|
|
12
|
+
* integer editor may refuse exponent syntax, "but it must not interpret 1e3
|
|
13
|
+
* as 1".
|
|
14
|
+
* - `parseFloat('12abc')` is `12`, discarding the rest.
|
|
15
|
+
*
|
|
16
|
+
* `Number` parses the whole string or fails, so it does none of these.
|
|
17
|
+
*
|
|
18
|
+
* **Integer fields commit the fractional value rather than rounding it.**
|
|
19
|
+
* Rounding would be the same silent substitution in a different disguise;
|
|
20
|
+
* committing 1.9 lets schema validation report "must be integer" against what
|
|
21
|
+
* the user actually typed, which they can then correct. This follows section
|
|
22
|
+
* 19: the UI represents actual form data and does not invent nearby valid data
|
|
23
|
+
* to make the widget look valid.
|
|
24
|
+
*
|
|
25
|
+
* Returns `undefined` for an empty or unparseable entry, so nothing is
|
|
26
|
+
* committed rather than `NaN` or `±Infinity`, which the spec forbids as form
|
|
27
|
+
* values. `Number('')` is `0`, so the empty case is tested first - otherwise
|
|
28
|
+
* clearing a field would commit a zero.
|
|
29
|
+
*
|
|
30
|
+
* **Not covered: precision loss.** `Number('9007199254740993')` is
|
|
31
|
+
* `9007199254740992`. antd's `InputNumber` has already converted the text to a
|
|
32
|
+
* JavaScript number before this is called, so the original digits are gone and
|
|
33
|
+
* the change cannot be detected here. Doing so needs antd's `stringMode`; see
|
|
34
|
+
* section 4.3 of the implementation-gaps document.
|
|
35
|
+
*/
|
|
36
|
+
export const toCommittableNumber = (value: unknown): number | undefined => {
|
|
37
|
+
if (value === '' || value === null || value === undefined) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
const parsed =
|
|
41
|
+
typeof value === 'number' ? value : Number(String(value).trim());
|
|
42
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
43
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Gates an input's clear button so it only appears when there is something to
|
|
5
|
+
* clear *and* the control is hovered or focused. antd's own `allowClear` shows
|
|
6
|
+
* the icon whenever a value is present, which leaves a permanent × on every
|
|
7
|
+
* populated field - noisy in a form and worse in a dense table row.
|
|
8
|
+
*/
|
|
9
|
+
export const useClearAffordance = (hasValue: boolean) => {
|
|
10
|
+
const [hovered, setHovered] = useState(false);
|
|
11
|
+
const [focused, setFocused] = useState(false);
|
|
12
|
+
return {
|
|
13
|
+
allowClear: hasValue && (hovered || focused),
|
|
14
|
+
affordanceProps: {
|
|
15
|
+
onMouseEnter: () => setHovered(true),
|
|
16
|
+
onMouseLeave: () => setHovered(false),
|
|
17
|
+
// hovering away while focused must not hide it, hence two flags
|
|
18
|
+
onFocus: () => setFocused(true),
|
|
19
|
+
onBlur: () => setFocused(false),
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/*
|
|
2
|
+
The MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2021 EclipseSource Munich
|
|
5
|
+
https://github.com/eclipsesource/jsonforms
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
|
15
|
+
all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
THE SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
import debounce from 'lodash/debounce';
|
|
26
|
+
import { useState, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
27
|
+
import { useRegisterPendingChange } from '../interaction/pendingChanges';
|
|
28
|
+
|
|
29
|
+
const eventToValue = (ev: any) => ev.target.value;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* An ordinary edit, committed after the user stops typing.
|
|
33
|
+
*
|
|
34
|
+
* ## Disposal
|
|
35
|
+
*
|
|
36
|
+
* §18 requires that "disposal must leave no stale write callback active", and
|
|
37
|
+
* that queued work whose target "was removed, rebound, or superseded" is
|
|
38
|
+
* cancelled — explicitly **not** flushed, because "flushing on unmount can
|
|
39
|
+
* recreate deleted data or write into a different item".
|
|
40
|
+
*
|
|
41
|
+
* There are three ways a queued write can outlive its target, and only one of
|
|
42
|
+
* them is an unmount:
|
|
43
|
+
*
|
|
44
|
+
* 1. **The control goes away.** A rule hides it, a tab closes, the form
|
|
45
|
+
* unmounts. The cleanup below cancels.
|
|
46
|
+
* 2. **The control is rebound to another path.** The debounced function is
|
|
47
|
+
* keyed on `path`, so a rebind produces a new one and the cleanup cancels
|
|
48
|
+
* the old — which still holds the old path in its closure.
|
|
49
|
+
* 3. **The path stays, and the thing it points at changes.** This is the
|
|
50
|
+
* specification's own worked example: type into item 0, delete item 0, and
|
|
51
|
+
* the former item 1 moves into its place. `ArrayLayout` keys rows by path,
|
|
52
|
+
* so the control at `items.0` is **not** unmounted and is not rebound — it
|
|
53
|
+
* re-renders with a different item's data. Neither of the first two cases
|
|
54
|
+
* fires. As the spec puts it, "the path alone is insufficient evidence
|
|
55
|
+
* that the original target still exists".
|
|
56
|
+
*
|
|
57
|
+
* The evidence for (3) is the value arriving from outside. The spec asks for
|
|
58
|
+
* external replacement to be distinguished from "normal host feedback of the
|
|
59
|
+
* just-committed data", which is what `lastWritten` is for: data equal to what
|
|
60
|
+
* this control last wrote is its own commit coming back, and anything else is
|
|
61
|
+
* a replacement that supersedes whatever is still queued.
|
|
62
|
+
*
|
|
63
|
+
* Without that distinction the guard eats ordinary typing. A commit lands
|
|
64
|
+
* mid-word, its value returns as a prop, and the keystrokes queued in the
|
|
65
|
+
* meantime would be cancelled along with it.
|
|
66
|
+
*/
|
|
67
|
+
export const useDebouncedChange = (
|
|
68
|
+
handleChange: (path: string, value: any) => void,
|
|
69
|
+
defaultValue: any,
|
|
70
|
+
data: any,
|
|
71
|
+
path: string,
|
|
72
|
+
eventToValueFunction: (ev: any) => any = eventToValue,
|
|
73
|
+
timeout = 300,
|
|
74
|
+
): [any, (event: any) => void, () => void] => {
|
|
75
|
+
const [input, setInput] = useState(data ?? defaultValue);
|
|
76
|
+
/** What this control last wrote, so its own echo is not read as a change. */
|
|
77
|
+
const lastWritten = useRef<any>(data);
|
|
78
|
+
/*
|
|
79
|
+
`useMemo`, not `useCallback`: the argument to `useCallback` is evaluated on
|
|
80
|
+
every render, so a fresh debounced function was constructed and discarded
|
|
81
|
+
each time. Only the identity mattered before; now the cleanup below hangs
|
|
82
|
+
off it, so it should be created exactly once per (handleChange, path).
|
|
83
|
+
*/
|
|
84
|
+
const commit = useCallback(
|
|
85
|
+
(newValue: any) => {
|
|
86
|
+
lastWritten.current = newValue;
|
|
87
|
+
handleChange(path, newValue);
|
|
88
|
+
},
|
|
89
|
+
[handleChange, path],
|
|
90
|
+
);
|
|
91
|
+
const debouncedUpdate = useMemo(
|
|
92
|
+
() =>
|
|
93
|
+
// eslint-disable-next-line react/refs -- lodash only schedules commit; constructing a debouncer does not execute the ref-backed callback.
|
|
94
|
+
debounce(commit, timeout),
|
|
95
|
+
[commit, timeout],
|
|
96
|
+
);
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
if (data === lastWritten.current) {
|
|
99
|
+
// Our own commit coming back. Nothing was replaced.
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
// Replaced from outside: the draft was for a value that is no longer here.
|
|
103
|
+
debouncedUpdate.cancel();
|
|
104
|
+
lastWritten.current = data;
|
|
105
|
+
setInput(data ?? defaultValue);
|
|
106
|
+
}, [data, debouncedUpdate, defaultValue]);
|
|
107
|
+
/*
|
|
108
|
+
Disposal, and rebinding. The returned cleanup runs both when this control
|
|
109
|
+
unmounts and when `debouncedUpdate` is replaced, so the instance that is
|
|
110
|
+
going away is the one cancelled — never the new one.
|
|
111
|
+
*/
|
|
112
|
+
useEffect(() => () => debouncedUpdate.cancel(), [debouncedUpdate]);
|
|
113
|
+
// A detail dialog applies on demand, so it has to be able to flush or drop
|
|
114
|
+
// whatever this control has not written yet.
|
|
115
|
+
useRegisterPendingChange({
|
|
116
|
+
flush: () => debouncedUpdate.flush(),
|
|
117
|
+
cancel: () => debouncedUpdate.cancel(),
|
|
118
|
+
});
|
|
119
|
+
const onChange = useCallback(
|
|
120
|
+
(ev: any) => {
|
|
121
|
+
const newValue = eventToValueFunction(ev);
|
|
122
|
+
setInput(newValue ?? defaultValue);
|
|
123
|
+
debouncedUpdate(newValue);
|
|
124
|
+
},
|
|
125
|
+
[debouncedUpdate, eventToValueFunction, defaultValue],
|
|
126
|
+
);
|
|
127
|
+
const onClear = useCallback(() => {
|
|
128
|
+
// Clearing supersedes whatever is still queued. Without this, a keystroke
|
|
129
|
+
// made inside the debounce window fires after the clear and writes the old
|
|
130
|
+
// text straight back - the value reappears on its own a fraction of a
|
|
131
|
+
// second later.
|
|
132
|
+
debouncedUpdate.cancel();
|
|
133
|
+
lastWritten.current = undefined;
|
|
134
|
+
setInput(defaultValue);
|
|
135
|
+
handleChange(path, undefined);
|
|
136
|
+
}, [debouncedUpdate, defaultValue, handleChange, path]);
|
|
137
|
+
return [input, onChange, onClear];
|
|
138
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
The MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2021 EclipseSource Munich
|
|
5
|
+
https://github.com/eclipsesource/jsonforms
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
|
15
|
+
all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
THE SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
import { useState, useCallback } from 'react';
|
|
26
|
+
|
|
27
|
+
export const useFocus = (): [boolean, () => void, () => void] => {
|
|
28
|
+
const [focused, setFocused] = useState(false);
|
|
29
|
+
const onFocus = useCallback(() => setFocused(true), []);
|
|
30
|
+
const onBlur = useCallback(() => setFocused(false), []);
|
|
31
|
+
return [focused, onFocus, onBlur];
|
|
32
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a JSON Forms `config` key belongs, by origin. See Adjustment 1 in
|
|
3
|
+
* `client/docs/jsonforms-extended-ui-model-adjustments.md`.
|
|
4
|
+
*
|
|
5
|
+
* - Core, Material or Vuetify convention -> top-level config key.
|
|
6
|
+
* - Portable project extension -> under {@link JSONFORMS_EXTENDED_CONFIG_KEY}.
|
|
7
|
+
* - JSON Forms React Renderers-only, outside the portable model -> under {@link JSONFORMS_CONFIG_KEY}.
|
|
8
|
+
*
|
|
9
|
+
* Per-element `uischema.options` stay flat in every case: `variant` is a
|
|
10
|
+
* reserved dispatch input, core's `optionIs` tester reads a flat option, and
|
|
11
|
+
* the specification's `confirmation` example resolves element options over a
|
|
12
|
+
* namespaced config default.
|
|
13
|
+
*
|
|
14
|
+
* Read these namespaces through the constants rather than writing the string,
|
|
15
|
+
* so a rename is one edit here. JSON cannot reference a constant, so authored
|
|
16
|
+
* schemas, config documents and fixtures spell the key literally - which makes
|
|
17
|
+
* a rename a breaking change to those documents, not just a constant edit.
|
|
18
|
+
*/
|
|
19
|
+
export const JSONFORMS_EXTENDED_CONFIG_KEY = 'jsonformsExtended';
|
|
20
|
+
|
|
21
|
+
/** Namespace for settings that exist only because of JSON Forms React Renderers's product. */
|
|
22
|
+
export const JSONFORMS_CONFIG_KEY = 'jsonforms-react-renderers';
|
|
23
|
+
|
|
24
|
+
const namespace = (
|
|
25
|
+
config: unknown,
|
|
26
|
+
key: string,
|
|
27
|
+
): Record<string, unknown> | undefined => {
|
|
28
|
+
if (!config || typeof config !== 'object') {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
const value = (config as Record<string, unknown>)[key];
|
|
32
|
+
return value && typeof value === 'object'
|
|
33
|
+
? (value as Record<string, unknown>)
|
|
34
|
+
: undefined;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** The `jsonformsExtended` block of a config object, if it has one. */
|
|
38
|
+
export const extendedConfig = (
|
|
39
|
+
config: unknown,
|
|
40
|
+
): Record<string, unknown> | undefined =>
|
|
41
|
+
namespace(config, JSONFORMS_EXTENDED_CONFIG_KEY);
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Resolves a project-extension option: the element's flat `options.<name>`,
|
|
45
|
+
* then `config.<namespace>.<name>`, then the caller's default.
|
|
46
|
+
*
|
|
47
|
+
* Only `undefined` falls through. An explicit `false`, `0` or `''` at a more
|
|
48
|
+
* specific level is a real override, as section 5 of the specification
|
|
49
|
+
* requires - truthiness-based fallback would silently discard it.
|
|
50
|
+
*/
|
|
51
|
+
export const resolveExtendedOption = <T>(
|
|
52
|
+
options: unknown,
|
|
53
|
+
config: unknown,
|
|
54
|
+
name: string,
|
|
55
|
+
fallback: T,
|
|
56
|
+
configKey: string = JSONFORMS_EXTENDED_CONFIG_KEY,
|
|
57
|
+
): T => {
|
|
58
|
+
const local =
|
|
59
|
+
options && typeof options === 'object'
|
|
60
|
+
? (options as Record<string, unknown>)[name]
|
|
61
|
+
: undefined;
|
|
62
|
+
if (local !== undefined) {
|
|
63
|
+
return local as T;
|
|
64
|
+
}
|
|
65
|
+
const global = namespace(config, configKey)?.[name];
|
|
66
|
+
return global !== undefined ? (global as T) : fallback;
|
|
67
|
+
};
|