@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,88 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ControlElement,
|
|
3
|
+
UISchemaElement,
|
|
4
|
+
findUISchema,
|
|
5
|
+
createControlElement,
|
|
6
|
+
type JsonSchema,
|
|
7
|
+
type JsonFormsUISchemaRegistryEntry,
|
|
8
|
+
} from '@jsonforms/core';
|
|
9
|
+
|
|
10
|
+
/** Editor details use upstream mode semantics and retain their caller's scope and fallback. */
|
|
11
|
+
export const findDetailUISchema: typeof findUISchema = (
|
|
12
|
+
registry,
|
|
13
|
+
schema,
|
|
14
|
+
schemaPath,
|
|
15
|
+
path,
|
|
16
|
+
fallback = 'VerticalLayout',
|
|
17
|
+
control,
|
|
18
|
+
rootSchema,
|
|
19
|
+
) => {
|
|
20
|
+
const detail = control?.options?.detail;
|
|
21
|
+
const generate =
|
|
22
|
+
typeof detail === 'string' && detail.toUpperCase() === 'GENERATE';
|
|
23
|
+
const guardedFallback =
|
|
24
|
+
typeof fallback === 'function'
|
|
25
|
+
? () => {
|
|
26
|
+
const result = fallback();
|
|
27
|
+
// A fallback Control delegates again. Carry generation intent through that
|
|
28
|
+
// dispatch so its object/array editor cannot pick the registry back up.
|
|
29
|
+
return generate && result.type === 'Control'
|
|
30
|
+
? { ...result, options: { ...result.options, detail: 'GENERATE' } }
|
|
31
|
+
: result;
|
|
32
|
+
}
|
|
33
|
+
: fallback;
|
|
34
|
+
return findUISchema(
|
|
35
|
+
registry,
|
|
36
|
+
schema,
|
|
37
|
+
schemaPath,
|
|
38
|
+
path,
|
|
39
|
+
guardedFallback,
|
|
40
|
+
control,
|
|
41
|
+
rootSchema,
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** Explicit editor option; absence preserves the host's existing fallback.
|
|
46
|
+
* Tuple-field layouts and recursive-node defaults may already come from a registry. */
|
|
47
|
+
export const resolveEditorDetail = (
|
|
48
|
+
detail: unknown,
|
|
49
|
+
registry: Parameters<typeof findUISchema>[0],
|
|
50
|
+
schema: Parameters<typeof findUISchema>[1],
|
|
51
|
+
schemaPath: string,
|
|
52
|
+
path: string,
|
|
53
|
+
rootSchema: Parameters<typeof findUISchema>[6],
|
|
54
|
+
fallback: UISchemaElement,
|
|
55
|
+
): UISchemaElement =>
|
|
56
|
+
detail === undefined
|
|
57
|
+
? fallback
|
|
58
|
+
: findDetailUISchema(
|
|
59
|
+
registry,
|
|
60
|
+
schema,
|
|
61
|
+
schemaPath,
|
|
62
|
+
path,
|
|
63
|
+
() => fallback,
|
|
64
|
+
{
|
|
65
|
+
type: 'Control',
|
|
66
|
+
scope: schemaPath,
|
|
67
|
+
options: { detail },
|
|
68
|
+
} as ControlElement,
|
|
69
|
+
rootSchema,
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
export const findMixedDetailUiSchema = (
|
|
73
|
+
schema: JsonSchema,
|
|
74
|
+
uischema: ControlElement,
|
|
75
|
+
path: string,
|
|
76
|
+
rootSchema: JsonSchema,
|
|
77
|
+
uischemas: JsonFormsUISchemaRegistryEntry[],
|
|
78
|
+
resolve: typeof findUISchema = findDetailUISchema,
|
|
79
|
+
) =>
|
|
80
|
+
resolve(
|
|
81
|
+
uischemas,
|
|
82
|
+
schema,
|
|
83
|
+
uischema.scope,
|
|
84
|
+
path,
|
|
85
|
+
() => createControlElement('#'),
|
|
86
|
+
uischema,
|
|
87
|
+
rootSchema,
|
|
88
|
+
);
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { UISchemaElement } from '@jsonforms/core';
|
|
2
|
+
import React, { useContext, useEffect, useMemo } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Breaks a UI-schema registry entry that resolves to itself.
|
|
6
|
+
*
|
|
7
|
+
* `findUISchema` consults the registry with a schema and a path. A renderer
|
|
8
|
+
* that then **dispatches the result at the same path** can be handed straight
|
|
9
|
+
* back to itself: the entry matches the schema, the dispatch selects the same
|
|
10
|
+
* renderer, the renderer asks the registry the same question, and the tree
|
|
11
|
+
* grows until the heap runs out. Nothing throws - React is happy to build an
|
|
12
|
+
* infinitely deep tree - so the symptom is a frozen tab and an out-of-memory
|
|
13
|
+
* abort with no stack pointing anywhere useful.
|
|
14
|
+
*
|
|
15
|
+
* The shape that does it is ordinary and looks correct:
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* uischemas = [{
|
|
19
|
+
* tester: (schema) => (schema.title === 'Address' ? 10 : -1),
|
|
20
|
+
* uischema: { type: 'Control', scope: '#' },
|
|
21
|
+
* }]
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* A **layout** entry is fine, because dispatching a layout does not come back
|
|
25
|
+
* to a control renderer. A Control entry carrying `options.detail` is fine
|
|
26
|
+
* too, because core's `findUISchema` returns that detail before it consults
|
|
27
|
+
* the registry - which is why the combination that hangs is the one an author
|
|
28
|
+
* reaches for first, and the one with the most configuration works.
|
|
29
|
+
*
|
|
30
|
+
* ## How the guard works
|
|
31
|
+
*
|
|
32
|
+
* Each renderer announces, through context, the element it is **about to
|
|
33
|
+
* dispatch at which path**. If a descendant is about to dispatch the same
|
|
34
|
+
* element at the same path, that is the fixed point, and it falls back to the
|
|
35
|
+
* generated UI schema instead - the same thing it would have used had the
|
|
36
|
+
* registry matched nothing.
|
|
37
|
+
*
|
|
38
|
+
* Context rather than a module-level set, because the answer depends on where
|
|
39
|
+
* in the tree the renderer sits: the same element at the same path is only a
|
|
40
|
+
* cycle when it is already an *ancestor*, not when two sibling forms happen
|
|
41
|
+
* to render it.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
const emptyStack: ReadonlySet<string> = new Set();
|
|
45
|
+
|
|
46
|
+
const UiSchemaCycleContext =
|
|
47
|
+
React.createContext<ReadonlySet<string>>(emptyStack);
|
|
48
|
+
|
|
49
|
+
/** Stable code, so a host can grep for it. */
|
|
50
|
+
export const UI_SCHEMA_CYCLE_DIAGNOSTIC = 'uischema.registryCycle';
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* What identifies "the same dispatch".
|
|
54
|
+
*
|
|
55
|
+
* The path and the element's own identity as an author wrote it - its type and
|
|
56
|
+
* scope. Object identity is not usable: a caller may spread the entry to add a
|
|
57
|
+
* label, so the descendant sees a copy of what the ancestor dispatched.
|
|
58
|
+
*/
|
|
59
|
+
const signatureOf = (uischema: UISchemaElement, path: string) =>
|
|
60
|
+
`${path}::${uischema?.type ?? ''}::${
|
|
61
|
+
(uischema as { scope?: string })?.scope ?? ''
|
|
62
|
+
}`;
|
|
63
|
+
|
|
64
|
+
export interface UiSchemaCycleGuard {
|
|
65
|
+
/** True when dispatching this element here would re-enter the same renderer. */
|
|
66
|
+
cycle: boolean;
|
|
67
|
+
/** The stack to publish to descendants. */
|
|
68
|
+
stack: ReadonlySet<string>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const useUiSchemaCycleGuard = (
|
|
72
|
+
uischema: UISchemaElement | undefined,
|
|
73
|
+
path: string,
|
|
74
|
+
/** Named in the diagnostic, so the message says which renderer noticed. */
|
|
75
|
+
renderer: string,
|
|
76
|
+
): UiSchemaCycleGuard => {
|
|
77
|
+
const seen = useContext(UiSchemaCycleContext);
|
|
78
|
+
const signature = uischema ? signatureOf(uischema, path) : undefined;
|
|
79
|
+
const cycle = signature !== undefined && seen.has(signature);
|
|
80
|
+
|
|
81
|
+
const stack = useMemo(() => {
|
|
82
|
+
if (signature === undefined || cycle) {
|
|
83
|
+
return seen;
|
|
84
|
+
}
|
|
85
|
+
const next = new Set(seen);
|
|
86
|
+
next.add(signature);
|
|
87
|
+
return next;
|
|
88
|
+
}, [seen, signature, cycle]);
|
|
89
|
+
|
|
90
|
+
/*
|
|
91
|
+
In an effect, not during render: React may render a component more than
|
|
92
|
+
once for one commit, and a warning printed during render would repeat.
|
|
93
|
+
*/
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (!cycle) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
// oxlint-disable-next-line no-console
|
|
99
|
+
console.warn(
|
|
100
|
+
`${UI_SCHEMA_CYCLE_DIAGNOSTIC}: the UI schema registry returned an ` +
|
|
101
|
+
`element that ${renderer} would dispatch back to itself at ` +
|
|
102
|
+
`${JSON.stringify(path || '<root>')} (${signature}). The generated ` +
|
|
103
|
+
`UI schema was used instead. A registry entry for an object schema ` +
|
|
104
|
+
`should be a layout, or a Control carrying options.detail.`,
|
|
105
|
+
);
|
|
106
|
+
}, [cycle, renderer, path, signature]);
|
|
107
|
+
|
|
108
|
+
return { cycle, stack };
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/** Publishes the stack to everything rendered inside. */
|
|
112
|
+
export const UiSchemaCycleProvider = ({
|
|
113
|
+
stack,
|
|
114
|
+
children,
|
|
115
|
+
}: {
|
|
116
|
+
stack: ReadonlySet<string>;
|
|
117
|
+
children: React.ReactNode;
|
|
118
|
+
}) => (
|
|
119
|
+
<UiSchemaCycleContext.Provider value={stack}>
|
|
120
|
+
{children}
|
|
121
|
+
</UiSchemaCycleContext.Provider>
|
|
122
|
+
);
|
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import { rendererDefault } from '../locale/rendererLocale';
|
|
2
|
+
import {
|
|
3
|
+
createDynamicTreeResolver,
|
|
4
|
+
hasDynamicTree,
|
|
5
|
+
createDynamicChildrenMemo,
|
|
6
|
+
dynamicPresentation,
|
|
7
|
+
dynamicTreeAuthor,
|
|
8
|
+
} from './dynamicTree';
|
|
9
|
+
import {
|
|
10
|
+
dynamicUiExpressionsReady,
|
|
11
|
+
loadDynamicUiExpressions,
|
|
12
|
+
} from './dynamicRuntime';
|
|
13
|
+
import React, {
|
|
14
|
+
createContext,
|
|
15
|
+
useContext,
|
|
16
|
+
useEffect,
|
|
17
|
+
useMemo,
|
|
18
|
+
useState,
|
|
19
|
+
} from 'react';
|
|
20
|
+
import type {
|
|
21
|
+
JsonFormsRendererRegistryEntry,
|
|
22
|
+
JsonFormsCellRendererRegistryEntry,
|
|
23
|
+
UISchemaElement,
|
|
24
|
+
} from '@jsonforms/core';
|
|
25
|
+
import {
|
|
26
|
+
JsonForms,
|
|
27
|
+
JsonFormsDispatch,
|
|
28
|
+
DispatchCell,
|
|
29
|
+
useJsonForms,
|
|
30
|
+
} from '@jsonforms/react';
|
|
31
|
+
import {
|
|
32
|
+
createDynamicUiResolver,
|
|
33
|
+
createDynamicUiCache,
|
|
34
|
+
type DynamicUiCache,
|
|
35
|
+
dynamicBoundValue,
|
|
36
|
+
dynamicCellValue,
|
|
37
|
+
dynamicItemAt,
|
|
38
|
+
type DynamicUiOptions,
|
|
39
|
+
type DynamicUiEnvironment,
|
|
40
|
+
type DynamicUiResult,
|
|
41
|
+
} from './dynamicUi';
|
|
42
|
+
|
|
43
|
+
import { dynamicUiOptions } from './dynamicConfig';
|
|
44
|
+
|
|
45
|
+
export interface DynamicUiSettings extends DynamicUiOptions {
|
|
46
|
+
onDiagnostic?: (diagnostic: {
|
|
47
|
+
code: 'dynamic.invalid';
|
|
48
|
+
path: string;
|
|
49
|
+
message: string;
|
|
50
|
+
}) => void;
|
|
51
|
+
}
|
|
52
|
+
const DynamicContext = createContext<DynamicUiSettings | undefined>(undefined);
|
|
53
|
+
const DynamicCacheContext = createContext<DynamicUiCache | undefined>(
|
|
54
|
+
undefined,
|
|
55
|
+
);
|
|
56
|
+
const ExternalContext = createContext<
|
|
57
|
+
Readonly<Record<string, unknown>> | undefined
|
|
58
|
+
>(undefined);
|
|
59
|
+
export const DynamicUiProvider = ({
|
|
60
|
+
config,
|
|
61
|
+
external,
|
|
62
|
+
children,
|
|
63
|
+
locale,
|
|
64
|
+
translate,
|
|
65
|
+
}: React.PropsWithChildren<{
|
|
66
|
+
config?: unknown;
|
|
67
|
+
external?: Readonly<Record<string, unknown>>;
|
|
68
|
+
locale?: string;
|
|
69
|
+
translate?: (key: string, fallback?: string) => string | undefined;
|
|
70
|
+
}>) => {
|
|
71
|
+
const cache = useMemo(createDynamicUiCache, []);
|
|
72
|
+
const dynamic = dynamicUiOptions(config, external);
|
|
73
|
+
const enabled = !!dynamic;
|
|
74
|
+
const [ready, setReady] = useState(dynamicUiExpressionsReady);
|
|
75
|
+
const [failed, setFailed] = useState(false);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (!enabled || ready) return;
|
|
78
|
+
let current = true;
|
|
79
|
+
setFailed(false);
|
|
80
|
+
loadDynamicUiExpressions().then(
|
|
81
|
+
() => {
|
|
82
|
+
if (current) setReady(true);
|
|
83
|
+
},
|
|
84
|
+
() => {
|
|
85
|
+
if (current) setFailed(true);
|
|
86
|
+
},
|
|
87
|
+
);
|
|
88
|
+
return () => {
|
|
89
|
+
current = false;
|
|
90
|
+
};
|
|
91
|
+
}, [enabled, ready]);
|
|
92
|
+
const pending = enabled && !ready;
|
|
93
|
+
const [hasPresented, setHasPresented] = useState(() => !enabled || ready);
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (!pending) setHasPresented(true);
|
|
96
|
+
}, [pending]);
|
|
97
|
+
const fallback = rendererDefault(
|
|
98
|
+
locale,
|
|
99
|
+
failed ? 'dynamic.loadFailed' : 'dynamic.loading',
|
|
100
|
+
);
|
|
101
|
+
return (
|
|
102
|
+
<DynamicCacheContext.Provider value={cache}>
|
|
103
|
+
<ExternalContext.Provider value={external}>
|
|
104
|
+
<DynamicContext.Provider value={ready ? dynamic : undefined}>
|
|
105
|
+
{pending && (hasPresented || failed) && (
|
|
106
|
+
<p role={failed ? 'alert' : 'status'} data-dynamic-loading>
|
|
107
|
+
{translate?.(
|
|
108
|
+
failed ? 'dynamic.loadFailed' : 'dynamic.loading',
|
|
109
|
+
fallback,
|
|
110
|
+
) ?? fallback}
|
|
111
|
+
</p>
|
|
112
|
+
)}
|
|
113
|
+
<DynamicBoundary pending={pending}>
|
|
114
|
+
{(!pending || hasPresented) && children}
|
|
115
|
+
</DynamicBoundary>
|
|
116
|
+
</DynamicContext.Provider>
|
|
117
|
+
</ExternalContext.Provider>
|
|
118
|
+
</DynamicCacheContext.Provider>
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/** Host-owned external values shared with template FormContext; no snapshot or writes. */
|
|
123
|
+
export const useDynamicExternal = () => useContext(ExternalContext);
|
|
124
|
+
|
|
125
|
+
// Stable identity uses the authored element; dispatch uses the effective presentation.
|
|
126
|
+
export const dynamicAuthoredElement = dynamicTreeAuthor;
|
|
127
|
+
const hasDynamic = (element: UISchemaElement) =>
|
|
128
|
+
!!element &&
|
|
129
|
+
Object.prototype.hasOwnProperty.call(
|
|
130
|
+
dynamicAuthoredElement(element),
|
|
131
|
+
'$dynamic',
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
export function useDynamicResolution(path: string, cell = false) {
|
|
135
|
+
const form = useJsonForms();
|
|
136
|
+
const cache = useContext(DynamicCacheContext);
|
|
137
|
+
const dynamic = useContext(DynamicContext);
|
|
138
|
+
const resolvers = useMemo(
|
|
139
|
+
() =>
|
|
140
|
+
new WeakMap<
|
|
141
|
+
UISchemaElement,
|
|
142
|
+
ReturnType<typeof createDynamicUiResolver>
|
|
143
|
+
>(),
|
|
144
|
+
[cache],
|
|
145
|
+
);
|
|
146
|
+
return (element: UISchemaElement): DynamicUiResult => {
|
|
147
|
+
const presented = dynamicPresentation(element);
|
|
148
|
+
if (presented) return presented;
|
|
149
|
+
const authored = dynamicAuthoredElement(element);
|
|
150
|
+
if (!dynamic || !hasDynamic(authored))
|
|
151
|
+
return { element: authored, failures: [] };
|
|
152
|
+
let resolve = resolvers.get(authored);
|
|
153
|
+
if (!resolve) {
|
|
154
|
+
resolve = createDynamicUiResolver(cache);
|
|
155
|
+
// Pure per-instance cache: abandoned React renders can only evict cached
|
|
156
|
+
// calculations; no form state, subscriptions or effects are published.
|
|
157
|
+
// eslint-disable-next-line react/immutability
|
|
158
|
+
resolvers.set(authored, resolve);
|
|
159
|
+
}
|
|
160
|
+
const segments = path ? path.split('.') : [];
|
|
161
|
+
const environment: DynamicUiEnvironment = {
|
|
162
|
+
get data() {
|
|
163
|
+
return form.core?.data;
|
|
164
|
+
},
|
|
165
|
+
get value() {
|
|
166
|
+
return cell
|
|
167
|
+
? dynamicCellValue(form.core?.data, segments)
|
|
168
|
+
: dynamicBoundValue(authored, form.core?.data, segments);
|
|
169
|
+
},
|
|
170
|
+
get item() {
|
|
171
|
+
return dynamicItemAt(
|
|
172
|
+
form.core?.data,
|
|
173
|
+
segments,
|
|
174
|
+
(form as typeof form & { item?: unknown }).item,
|
|
175
|
+
);
|
|
176
|
+
},
|
|
177
|
+
get external() {
|
|
178
|
+
return dynamic.external;
|
|
179
|
+
},
|
|
180
|
+
get config() {
|
|
181
|
+
return form.config;
|
|
182
|
+
},
|
|
183
|
+
get errors() {
|
|
184
|
+
return form.core?.errors;
|
|
185
|
+
},
|
|
186
|
+
get locale() {
|
|
187
|
+
return form.i18n?.locale;
|
|
188
|
+
},
|
|
189
|
+
path,
|
|
190
|
+
trustedFunctions: dynamic.trustedFunctions,
|
|
191
|
+
};
|
|
192
|
+
return resolve(authored, environment);
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** Structural presentation views preserve both effective properties and authored identity. */
|
|
197
|
+
export function useDynamicTreeResolver(path = '') {
|
|
198
|
+
const dynamic = useContext(DynamicContext);
|
|
199
|
+
const resolve = useDynamicResolution(path);
|
|
200
|
+
const tree = useMemo(() => createDynamicTreeResolver(), []);
|
|
201
|
+
return (element: UISchemaElement) =>
|
|
202
|
+
dynamic ? tree(element, resolve) : element;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** Names/keys should be assigned from authored children before using this view. */
|
|
206
|
+
export function useDynamicElements(elements: UISchemaElement[], path: string) {
|
|
207
|
+
const resolve = useDynamicTreeResolver(path);
|
|
208
|
+
const stabilize = useMemo(() => createDynamicChildrenMemo(), []);
|
|
209
|
+
return stabilize(elements.map(resolve));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Capture focus before React removes the old DOM. This also covers an internal
|
|
213
|
+
// editor replacement within the selected component, without render-time refs.
|
|
214
|
+
type DynamicBoundaryProps = React.PropsWithChildren<{ pending?: boolean }>;
|
|
215
|
+
class DynamicBoundary extends React.Component<DynamicBoundaryProps> {
|
|
216
|
+
private suspendedFocus: Element | null = null;
|
|
217
|
+
private container = React.createRef<HTMLDivElement>();
|
|
218
|
+
getSnapshotBeforeUpdate() {
|
|
219
|
+
const root = this.container.current?.getRootNode() as
|
|
220
|
+
| Document
|
|
221
|
+
| ShadowRoot
|
|
222
|
+
| undefined;
|
|
223
|
+
const focused = root?.activeElement;
|
|
224
|
+
return focused && this.container.current?.contains(focused)
|
|
225
|
+
? focused
|
|
226
|
+
: null;
|
|
227
|
+
}
|
|
228
|
+
componentDidUpdate(
|
|
229
|
+
previousProps: DynamicBoundaryProps,
|
|
230
|
+
_state: unknown,
|
|
231
|
+
snapshot: Element | null,
|
|
232
|
+
) {
|
|
233
|
+
if (this.props.pending) {
|
|
234
|
+
this.suspendedFocus ??= snapshot;
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
const resuming = previousProps.pending && !this.props.pending;
|
|
238
|
+
const focused = resuming ? this.suspendedFocus : snapshot;
|
|
239
|
+
this.suspendedFocus = null;
|
|
240
|
+
const container = this.container.current;
|
|
241
|
+
if (!focused || (!resuming && focused.isConnected) || !container) return;
|
|
242
|
+
const root = container.getRootNode() as Document | ShadowRoot;
|
|
243
|
+
const active = root.activeElement;
|
|
244
|
+
if (
|
|
245
|
+
active &&
|
|
246
|
+
active !== container.ownerDocument.body &&
|
|
247
|
+
active !== container &&
|
|
248
|
+
active !== focused
|
|
249
|
+
)
|
|
250
|
+
return;
|
|
251
|
+
if (
|
|
252
|
+
resuming &&
|
|
253
|
+
focused instanceof HTMLElement &&
|
|
254
|
+
focused.isConnected &&
|
|
255
|
+
!focused.closest('[inert]')
|
|
256
|
+
) {
|
|
257
|
+
focused.focus({ preventScroll: true });
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
const candidates = container.querySelectorAll<HTMLElement>(
|
|
261
|
+
'input:not([disabled]):not([type="hidden"]),select:not([disabled]),textarea:not([disabled]),[role="combobox"],[role="slider"],[role="radio"],button:not([disabled]),[tabindex]:not([tabindex="-1"]),a[href]',
|
|
262
|
+
);
|
|
263
|
+
const target = Array.from(candidates).find(
|
|
264
|
+
(element) =>
|
|
265
|
+
element.getAttribute('aria-disabled') !== 'true' &&
|
|
266
|
+
!element.closest('[hidden],[inert]') &&
|
|
267
|
+
(typeof element.checkVisibility !== 'function' ||
|
|
268
|
+
element.checkVisibility()),
|
|
269
|
+
);
|
|
270
|
+
if (target) {
|
|
271
|
+
target.focus({ preventScroll: true });
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
let fallback = container.parentElement;
|
|
275
|
+
while (fallback && getComputedStyle(fallback).display === 'contents')
|
|
276
|
+
fallback = fallback.parentElement;
|
|
277
|
+
if (!fallback) return;
|
|
278
|
+
if (!fallback.hasAttribute('tabindex')) {
|
|
279
|
+
fallback.setAttribute('tabindex', '-1');
|
|
280
|
+
fallback.addEventListener(
|
|
281
|
+
'blur',
|
|
282
|
+
() => fallback.removeAttribute('tabindex'),
|
|
283
|
+
{ once: true },
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
fallback.focus({ preventScroll: true });
|
|
287
|
+
}
|
|
288
|
+
render() {
|
|
289
|
+
// React 18 forwards an empty-string inert attribute; React 19 expects a boolean.
|
|
290
|
+
const inert = this.props.pending
|
|
291
|
+
? { inert: Number.parseInt(React.version, 10) >= 19 ? true : '' }
|
|
292
|
+
: {};
|
|
293
|
+
return (
|
|
294
|
+
<div
|
|
295
|
+
ref={this.container}
|
|
296
|
+
style={{ display: 'contents' }}
|
|
297
|
+
aria-busy={this.props.pending}
|
|
298
|
+
{...inert}
|
|
299
|
+
>
|
|
300
|
+
{this.props.children}
|
|
301
|
+
</div>
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Bypass only this redispatch; nested occurrences retain their own aspect boundary.
|
|
307
|
+
const redispatched = new WeakSet<UISchemaElement>();
|
|
308
|
+
|
|
309
|
+
function useDynamicAspect(props: any, cell: boolean) {
|
|
310
|
+
const dynamic = useContext(DynamicContext);
|
|
311
|
+
const resolve = useDynamicResolution(props.path ?? '', cell);
|
|
312
|
+
const resolveChild = useDynamicResolution(props.path ?? '');
|
|
313
|
+
const tree = useMemo(() => createDynamicTreeResolver(), []);
|
|
314
|
+
const resolved = dynamic
|
|
315
|
+
? tree(props.uischema, (element) =>
|
|
316
|
+
element === props.uischema ? resolve(element) : resolveChild(element),
|
|
317
|
+
)
|
|
318
|
+
: props.uischema;
|
|
319
|
+
const result = dynamicPresentation(resolved) ?? resolve(resolved);
|
|
320
|
+
const effective = useMemo(() => {
|
|
321
|
+
const { $dynamic: _metadata, ...element } =
|
|
322
|
+
result.element as UISchemaElement & { $dynamic?: unknown };
|
|
323
|
+
redispatched.add(element);
|
|
324
|
+
return element;
|
|
325
|
+
}, [result.element]);
|
|
326
|
+
const signature = result.failures.join('\n');
|
|
327
|
+
const onDiagnostic = dynamic?.onDiagnostic;
|
|
328
|
+
useEffect(() => {
|
|
329
|
+
for (const message of signature ? signature.split('\n') : []) {
|
|
330
|
+
const diagnostic = {
|
|
331
|
+
code: 'dynamic.invalid' as const,
|
|
332
|
+
path: props.path ?? '',
|
|
333
|
+
message,
|
|
334
|
+
};
|
|
335
|
+
if (onDiagnostic) onDiagnostic(diagnostic);
|
|
336
|
+
else console.warn('dynamic.invalid', diagnostic);
|
|
337
|
+
}
|
|
338
|
+
}, [signature, props.path, onDiagnostic]);
|
|
339
|
+
const scope = (effective as { scope?: string }).scope ?? '';
|
|
340
|
+
const {
|
|
341
|
+
visible: _visible,
|
|
342
|
+
readonly: cellReadonly,
|
|
343
|
+
enabled: cellEnabled,
|
|
344
|
+
...cellProps
|
|
345
|
+
} = props;
|
|
346
|
+
return (
|
|
347
|
+
<DynamicBoundary>
|
|
348
|
+
{cell ? (
|
|
349
|
+
<DispatchCell
|
|
350
|
+
{...cellProps}
|
|
351
|
+
readonly={cellReadonly || undefined}
|
|
352
|
+
enabled={cellEnabled === false ? false : undefined}
|
|
353
|
+
key={scope}
|
|
354
|
+
uischema={effective}
|
|
355
|
+
/>
|
|
356
|
+
) : (
|
|
357
|
+
<JsonFormsDispatch {...props} key={scope} uischema={effective} />
|
|
358
|
+
)}
|
|
359
|
+
</DynamicBoundary>
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
export const DynamicRenderer = (props: any) => useDynamicAspect(props, false);
|
|
363
|
+
export const DynamicCell = (props: any) => useDynamicAspect(props, true);
|
|
364
|
+
const tester = (element: UISchemaElement) =>
|
|
365
|
+
!redispatched.has(element) &&
|
|
366
|
+
(hasDynamicTree(element) || dynamicPresentation(element))
|
|
367
|
+
? Number.MAX_SAFE_INTEGER
|
|
368
|
+
: -1;
|
|
369
|
+
export const dynamicRendererEntry: JsonFormsRendererRegistryEntry = {
|
|
370
|
+
tester,
|
|
371
|
+
renderer: DynamicRenderer,
|
|
372
|
+
};
|
|
373
|
+
export const dynamicCellEntry: JsonFormsCellRendererRegistryEntry = {
|
|
374
|
+
tester,
|
|
375
|
+
cell: DynamicCell,
|
|
376
|
+
};
|
|
377
|
+
export const withDynamicRenderers = (
|
|
378
|
+
entries: JsonFormsRendererRegistryEntry[] = [],
|
|
379
|
+
) => [
|
|
380
|
+
dynamicRendererEntry,
|
|
381
|
+
...entries.filter((entry) => entry.renderer !== DynamicRenderer),
|
|
382
|
+
];
|
|
383
|
+
export const withDynamicCells = (
|
|
384
|
+
entries: JsonFormsCellRendererRegistryEntry[] = [],
|
|
385
|
+
) => [
|
|
386
|
+
dynamicCellEntry,
|
|
387
|
+
...entries.filter((entry) => entry.cell !== DynamicCell),
|
|
388
|
+
];
|
|
389
|
+
|
|
390
|
+
export type DynamicJsonFormsProps = React.ComponentProps<typeof JsonForms> & {
|
|
391
|
+
external?: Readonly<Record<string, unknown>>;
|
|
392
|
+
};
|
|
393
|
+
export const DynamicJsonForms = ({
|
|
394
|
+
external,
|
|
395
|
+
renderers,
|
|
396
|
+
cells,
|
|
397
|
+
...props
|
|
398
|
+
}: DynamicJsonFormsProps) => {
|
|
399
|
+
const rendererRegistry = useMemo(
|
|
400
|
+
() => withDynamicRenderers(renderers),
|
|
401
|
+
[renderers],
|
|
402
|
+
);
|
|
403
|
+
const cellRegistry = useMemo(() => withDynamicCells(cells), [cells]);
|
|
404
|
+
return (
|
|
405
|
+
<DynamicUiProvider
|
|
406
|
+
config={props.config}
|
|
407
|
+
external={external}
|
|
408
|
+
locale={props.i18n?.locale}
|
|
409
|
+
translate={props.i18n?.translate}
|
|
410
|
+
>
|
|
411
|
+
<JsonForms {...props} renderers={rendererRegistry} cells={cellRegistry} />
|
|
412
|
+
</DynamicUiProvider>
|
|
413
|
+
);
|
|
414
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { isPlainRecord } from '../core/plainRecord';
|
|
2
|
+
import { Environment } from '@marcbachmann/cel-js';
|
|
3
|
+
|
|
4
|
+
const compiledExpressions = new WeakMap<
|
|
5
|
+
object,
|
|
6
|
+
{
|
|
7
|
+
source: string;
|
|
8
|
+
names: string;
|
|
9
|
+
evaluate: (roots: Record<string, unknown>) => unknown;
|
|
10
|
+
}
|
|
11
|
+
>();
|
|
12
|
+
|
|
13
|
+
function celJsonValue(
|
|
14
|
+
value: unknown,
|
|
15
|
+
depth = 0,
|
|
16
|
+
seen = new WeakSet<object>(),
|
|
17
|
+
budget = { remaining: 10_000 },
|
|
18
|
+
): unknown {
|
|
19
|
+
if (--budget.remaining < 0) throw Error('CEL result size limit exceeded');
|
|
20
|
+
if (depth > 32) throw Error('CEL result depth limit exceeded');
|
|
21
|
+
if (typeof value === 'bigint') {
|
|
22
|
+
const number = Number(value);
|
|
23
|
+
if (!Number.isSafeInteger(number))
|
|
24
|
+
throw Error('CEL integer exceeds JSON safe range');
|
|
25
|
+
return number;
|
|
26
|
+
}
|
|
27
|
+
if (Array.isArray(value) || isPlainRecord(value)) {
|
|
28
|
+
if (seen.has(value)) throw Error('cyclic CEL result');
|
|
29
|
+
seen.add(value);
|
|
30
|
+
const result = Array.isArray(value)
|
|
31
|
+
? value.map((entry) => celJsonValue(entry, depth + 1, seen, budget))
|
|
32
|
+
: Object.fromEntries(
|
|
33
|
+
Object.entries(value).map(([key, entry]) => [
|
|
34
|
+
key,
|
|
35
|
+
celJsonValue(entry, depth + 1, seen, budget),
|
|
36
|
+
]),
|
|
37
|
+
);
|
|
38
|
+
seen.delete(value);
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function expression(
|
|
45
|
+
descriptor: object,
|
|
46
|
+
source: string,
|
|
47
|
+
roots: Record<string, unknown>,
|
|
48
|
+
): unknown {
|
|
49
|
+
if (source.length > 4096) throw Error('expression length limit exceeded');
|
|
50
|
+
const names = Object.keys(roots).sort().join(',');
|
|
51
|
+
let compiled = compiledExpressions.get(descriptor);
|
|
52
|
+
if (!compiled || compiled.source !== source || compiled.names !== names) {
|
|
53
|
+
const environment = new Environment({
|
|
54
|
+
limits: {
|
|
55
|
+
maxAstNodes: 256,
|
|
56
|
+
maxDepth: 32,
|
|
57
|
+
maxListElements: 128,
|
|
58
|
+
maxMapEntries: 128,
|
|
59
|
+
maxCallArguments: 8,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
for (const name of Object.keys(roots))
|
|
63
|
+
environment.registerVariable(name, 'dyn');
|
|
64
|
+
compiled = { source, names, evaluate: environment.parse(source) };
|
|
65
|
+
compiledExpressions.set(descriptor, compiled);
|
|
66
|
+
}
|
|
67
|
+
return celJsonValue(compiled.evaluate(roots));
|
|
68
|
+
}
|