@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 @@
|
|
|
1
|
+
{"version":3,"file":"tupleSchema.cjs.js","names":["isControl","Resolve","cloneDeep","extractDefaults","require_rolldown_runtime","_jsonforms_core","lodash_cloneDeep","tupleDefinition","candidate","schema","explicit","minItems","maxItems","tupleControlTester","_uischema$options","uischema","resolved","context","resolveTupleSchema","root","tupleInitialValue","tupleEmptyValue","UNCONSTRAINED_TYPES","tupleRenderSchema","isComplexTupleSchema","tupleFieldOwnsLabel","rendered"],"sources":["../../src/tuple/tupleSchema.ts"],"sourcesContent":["import {\n JsonSchema,\n RankedTester,\n Resolve,\n extractDefaults,\n isControl,\n} from '@jsonforms/core';\nimport cloneDeep from 'lodash/cloneDeep';\n\n/**\n * Positional arrays, with no React in it.\n *\n * Which schemas are tuples, what each position renders, and what value a\n * missing position starts life with are all decidable from the schema alone, so\n * they are settled here and tested without rendering anything.\n */\n\n/**\n * A position's schema. `false` is a real value here - draft-07's\n * `additionalItems: false` and 2020-12's `items: false` both mean \"nothing is\n * permitted past the prefix\" - so this cannot be narrowed to `JsonSchema`.\n */\nexport type TupleSchema = JsonSchema | boolean;\n\nexport interface TupleDefinition {\n /** One schema per declared position. */\n prefix: TupleSchema[];\n /** What a trailing value past the prefix must satisfy; `false` forbids one. */\n tail: TupleSchema;\n}\n\n/** 2020-12 spells the positional list `prefixItems`; the types predate it. */\ntype PositionalSchema = JsonSchema & { prefixItems?: TupleSchema[] };\n\n/**\n * The declared positions and the tail, or `undefined` when the schema does not\n * describe a tuple at all.\n *\n * **Both dialects are recognized**, which the gap review asks to be declared:\n * draft 2020-12's `prefixItems` + `items`, and draft-07's positional `items` +\n * `additionalItems`. `prefixItems` is checked first, because a 2020-12 schema\n * uses `items` for the *tail* and reading it as the prefix would turn one\n * position into every position.\n *\n * `explicit` is `options.variant === 'tuple'` and unlocks only the third case -\n * a uniform array asked to be presented positionally. A positional schema needs\n * no variant, and per section 18 equal bounds alone must not change how an\n * ordinary uniform array is presented.\n */\nexport const tupleDefinition = (\n schema: JsonSchema | undefined,\n explicit = false,\n): TupleDefinition | undefined => {\n const candidate = schema as PositionalSchema | undefined;\n if (candidate?.type !== 'array') {\n return undefined;\n }\n if (Array.isArray(candidate.prefixItems)) {\n return {\n prefix: candidate.prefixItems,\n tail: (candidate.items ?? true) as TupleSchema,\n };\n }\n if (Array.isArray(candidate.items)) {\n return {\n prefix: candidate.items as TupleSchema[],\n tail: (candidate.additionalItems ?? true) as TupleSchema,\n };\n }\n const { minItems, maxItems } = candidate;\n if (\n explicit &&\n Number.isInteger(minItems) &&\n (minItems as number) >= 0 &&\n minItems === maxItems\n ) {\n return {\n // The shared item schema, repeated. The count comes from the bounds, so\n // the tail is closed: a uniform tuple has exactly as many positions as it\n // declares.\n prefix: Array.from(\n { length: minItems as number },\n () => (candidate.items ?? true) as TupleSchema,\n ),\n tail: false,\n };\n }\n return undefined;\n};\n\n/**\n * Rank 25, above the mixed control at 20 and every array renderer below it.\n *\n * It deliberately also claims a control that merely *asks* for `variant:\n * \"tuple\"` without a schema that can support one. Section 18 calls that an\n * \"unsupported configuration\" and says to \"report a configuration diagnostic\n * rather than guessing a positional count\" - which is only possible if this\n * renderer wins and explains itself. Falling through would render an ordinary\n * array control and silently ignore the request.\n */\nexport const tupleControlTester: RankedTester = (uischema, schema, context) => {\n if (!isControl(uischema)) {\n return -1;\n }\n const resolved = Resolve.schema(\n schema,\n uischema.scope,\n context?.rootSchema ?? schema,\n );\n const explicit = uischema.options?.variant === 'tuple';\n return explicit || (resolved && tupleDefinition(resolved)) ? 25 : -1;\n};\n\n/** Follows a `$ref` on a positional schema, leaving anything else alone. */\nexport const resolveTupleSchema = (\n schema: TupleSchema,\n root: JsonSchema,\n): TupleSchema =>\n typeof schema === 'object' && schema.$ref\n ? (Resolve.schema(root, schema.$ref, root) ?? schema)\n : schema;\n\n/**\n * What a position holds when an edit further along the array forces it into\n * existence - the shared **Array Add-item initialization** contract.\n *\n * `undefined` means the schema gives no unambiguous answer. That is not a\n * failure to handle: section 18 says to \"retain the edit as a local draft and\n * identify the position needing input rather than inventing a type or null\n * value\", so the caller reports which position is blocking instead of filling\n * it with a guess.\n */\nexport const tupleInitialValue = (\n schema: TupleSchema,\n root: JsonSchema,\n): unknown => {\n const resolved = resolveTupleSchema(schema, root);\n if (typeof resolved !== 'object') {\n return undefined;\n }\n if (resolved.default !== undefined) {\n // Deep-copied, so two positions sharing one schema cannot end up sharing\n // the object the schema author wrote.\n return cloneDeep(resolved.default);\n }\n switch (resolved.type) {\n case 'string':\n return '';\n case 'integer':\n case 'number':\n return 0;\n case 'boolean':\n return false;\n case 'null':\n return null;\n case 'array':\n return [];\n case 'object':\n return extractDefaults(resolved, root);\n default:\n // A union, an unconstrained schema, or a combinator: no single supported\n // type, so no initial value.\n return undefined;\n }\n};\n\n/**\n * The value a *cleared* position keeps, which is not the same question as\n * {@link tupleInitialValue}.\n *\n * Section 18: \"absence and emptiness are distinct\" and clearing \"must never\n * splice the array, shift later positions, or write undefined into it\".\n * Clearing a string leaves `\"\"`; clearing a number has no natural empty value,\n * so this returns `undefined` and the caller keeps the edit as a draft rather\n * than silently writing `0` or `null`.\n */\nexport const tupleEmptyValue = (\n schema: TupleSchema,\n root: JsonSchema,\n): unknown => {\n const resolved = resolveTupleSchema(schema, root);\n if (typeof resolved !== 'object') {\n return undefined;\n }\n if (resolved.type === 'string') return '';\n if (resolved.type === 'array') return [];\n if (resolved.type === 'object') return {};\n if (\n resolved.type === 'null' ||\n (Array.isArray(resolved.type) && resolved.type.includes('null'))\n ) {\n return null;\n }\n return undefined;\n};\n\n/** Every JSON type, for a position the schema does not constrain. */\nexport const UNCONSTRAINED_TYPES = [\n 'string',\n 'number',\n 'integer',\n 'boolean',\n 'object',\n 'array',\n 'null',\n];\n\n/**\n * The schema to hand a delegated renderer.\n *\n * An unconstrained tail - `true`, or `{}` - carries no type, and JSON Forms\n * would find no renderer for it. Section 18 says such a tail uses \"the mixed\n * renderer with type selection\", and the way to ask for that renderer is a\n * schema naming every type.\n */\nexport const tupleRenderSchema = (schema: TupleSchema): JsonSchema => {\n if (\n schema === true ||\n (typeof schema === 'object' && Object.keys(schema).length === 0)\n ) {\n return { type: UNCONSTRAINED_TYPES } as JsonSchema;\n }\n return schema as JsonSchema;\n};\n\n/** Whether a position is edited through a summary and a dialog. */\nexport const isComplexTupleSchema = (schema: TupleSchema): boolean =>\n typeof schema === 'object' &&\n (schema.type === 'object' || schema.type === 'array');\n\n/**\n * Whether a position draws its own label above the delegated editor.\n *\n * A scalar control renders its own `Form.Item` label, so labelling it here too\n * would print the name twice. A complex position shows a summary rather than a\n * control, a forbidden position shows a message, and a mixed position's own\n * label belongs to the type selector - all three need the label supplied.\n */\nexport const tupleFieldOwnsLabel = (schema: TupleSchema): boolean => {\n if (schema === false || isComplexTupleSchema(schema)) {\n return true;\n }\n const rendered = tupleRenderSchema(schema);\n return !rendered.type || Array.isArray(rendered.type);\n};\n"],"mappings":"A,8LAiDA,IAAaO,GACX,EACA,EAAW,KACqB,CAChC,IAAMC,EAAYC,EAClB,IAAAD,GAAA,KAAA,IAAA,GAAIA,EAAW,QAAS,QACtB,OAEF,GAAI,MAAM,QAAQA,EAAU,WAAW,EACrC,MAAO,CACL,OAAQA,EAAU,YAClB,KAAOA,EAAU,OAAS,EAC5B,EAEF,GAAI,MAAM,QAAQA,EAAU,KAAK,EAC/B,MAAO,CACL,OAAQA,EAAU,MAClB,KAAOA,EAAU,iBAAmB,EACtC,EAEF,GAAM,CAAE,WAAU,YAAaA,EAC/B,GACEE,GACA,OAAO,UAAUC,CAAQ,GACxBA,GAAuB,GACxBA,IAAaC,EAEb,MAAO,CAIL,OAAQ,MAAM,KACZ,CAAE,OAAQD,CAAmB,MACtBH,EAAU,OAAS,EAC5B,EACA,KAAM,EACR,CAGJ,EAYaK,GAAoC,EAAU,EAAQ,IAAY,C,MAC7E,GAAI,EAAA,EAACb,EAAAA,UAAAA,CAAUe,CAAQ,EACrB,MAAO,GAET,IAAMC,EAAWf,EAAAA,QAAQ,OACvBQ,EACAM,EAAS,OAAAE,GAAA,KAAA,IAAA,GACTA,EAAS,aAAcR,CACzB,EAEA,QAAA,EADiBM,EAAS,UAAA,KAAA,IAAA,GAAAD,EAAS,WAAY,SAC3BE,GAAYT,EAAgBS,CAAQ,EAAK,GAAK,EACpE,EAGaE,GACX,EACA,IAEA,OAAOT,GAAW,UAAYA,EAAO,KAChCR,EAAAA,QAAQ,OAAOkB,EAAMV,EAAO,KAAMU,CAAI,GAAKV,EAC5CA,EAYOW,GACX,EACA,IACY,CACZ,IAAMJ,EAAWE,EAAmBT,EAAQU,CAAI,EAChD,GAAI,OAAOH,GAAa,SAGxB,IAAIA,EAAS,UAAY,IAAA,GAGvB,OAAA,EAAOd,EAAAA,QAAAA,CAAUc,EAAS,OAAO,EAEnC,OAAQA,EAAS,KAAjB,CACE,IAAK,SACH,MAAO,GACT,IAAK,UACL,IAAK,SACH,MAAO,GACT,IAAK,UACH,MAAO,GACT,IAAK,OACH,OAAO,KACT,IAAK,QACH,MAAO,CAAC,EACV,IAAK,SACH,OAAA,EAAOb,EAAAA,gBAAAA,CAAgBa,EAAUG,CAAI,EACvC,QAGE,MACJ,CApBmC,CAqBrC,EAYaE,GACX,EACA,IACY,CACZ,IAAML,EAAWE,EAAmBT,EAAQU,CAAI,EAChD,GAAI,OAAOH,GAAa,SAGxB,IAAIA,EAAS,OAAS,SAAU,MAAO,GACvC,GAAIA,EAAS,OAAS,QAAS,MAAO,CAAC,EACvC,GAAIA,EAAS,OAAS,SAAU,MAAO,CAAC,EACxC,GACEA,EAAS,OAAS,QACjB,MAAM,QAAQA,EAAS,IAAI,GAAKA,EAAS,KAAK,SAAS,MAAM,EAE9D,OAAO,IAP8B,CAUzC,EAGaM,EAAsB,CACjC,SACA,SACA,UACA,UACA,SACA,QACA,MACF,EAUaC,EAAqB,GAE9Bd,IAAW,IACV,OAAOA,GAAW,UAAY,OAAO,KAAKA,CAAM,CAAC,CAAC,SAAW,EAEvD,CAAE,KAAMa,CAAoB,EAE9Bb,EAIIe,EAAwB,GACnC,OAAOf,GAAW,WACjBA,EAAO,OAAS,UAAYA,EAAO,OAAS,SAUlCgB,EAAuB,GAAiC,CACnE,GAAIhB,IAAW,IAASe,EAAqBf,CAAM,EACjD,MAAO,GAET,IAAMiB,EAAWH,EAAkBd,CAAM,EACzC,MAAO,CAACiB,EAAS,MAAQ,MAAM,QAAQA,EAAS,IAAI,CACtD,E"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { JsonSchema, RankedTester } from '@jsonforms/core';
|
|
2
|
+
/**
|
|
3
|
+
* Positional arrays, with no React in it.
|
|
4
|
+
*
|
|
5
|
+
* Which schemas are tuples, what each position renders, and what value a
|
|
6
|
+
* missing position starts life with are all decidable from the schema alone, so
|
|
7
|
+
* they are settled here and tested without rendering anything.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* A position's schema. `false` is a real value here - draft-07's
|
|
11
|
+
* `additionalItems: false` and 2020-12's `items: false` both mean "nothing is
|
|
12
|
+
* permitted past the prefix" - so this cannot be narrowed to `JsonSchema`.
|
|
13
|
+
*/
|
|
14
|
+
export type TupleSchema = JsonSchema | boolean;
|
|
15
|
+
export interface TupleDefinition {
|
|
16
|
+
/** One schema per declared position. */
|
|
17
|
+
prefix: TupleSchema[];
|
|
18
|
+
/** What a trailing value past the prefix must satisfy; `false` forbids one. */
|
|
19
|
+
tail: TupleSchema;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The declared positions and the tail, or `undefined` when the schema does not
|
|
23
|
+
* describe a tuple at all.
|
|
24
|
+
*
|
|
25
|
+
* **Both dialects are recognized**, which the gap review asks to be declared:
|
|
26
|
+
* draft 2020-12's `prefixItems` + `items`, and draft-07's positional `items` +
|
|
27
|
+
* `additionalItems`. `prefixItems` is checked first, because a 2020-12 schema
|
|
28
|
+
* uses `items` for the *tail* and reading it as the prefix would turn one
|
|
29
|
+
* position into every position.
|
|
30
|
+
*
|
|
31
|
+
* `explicit` is `options.variant === 'tuple'` and unlocks only the third case -
|
|
32
|
+
* a uniform array asked to be presented positionally. A positional schema needs
|
|
33
|
+
* no variant, and per section 18 equal bounds alone must not change how an
|
|
34
|
+
* ordinary uniform array is presented.
|
|
35
|
+
*/
|
|
36
|
+
export declare const tupleDefinition: (schema: JsonSchema | undefined, explicit?: boolean) => TupleDefinition | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Rank 25, above the mixed control at 20 and every array renderer below it.
|
|
39
|
+
*
|
|
40
|
+
* It deliberately also claims a control that merely *asks* for `variant:
|
|
41
|
+
* "tuple"` without a schema that can support one. Section 18 calls that an
|
|
42
|
+
* "unsupported configuration" and says to "report a configuration diagnostic
|
|
43
|
+
* rather than guessing a positional count" - which is only possible if this
|
|
44
|
+
* renderer wins and explains itself. Falling through would render an ordinary
|
|
45
|
+
* array control and silently ignore the request.
|
|
46
|
+
*/
|
|
47
|
+
export declare const tupleControlTester: RankedTester;
|
|
48
|
+
/** Follows a `$ref` on a positional schema, leaving anything else alone. */
|
|
49
|
+
export declare const resolveTupleSchema: (schema: TupleSchema, root: JsonSchema) => TupleSchema;
|
|
50
|
+
/**
|
|
51
|
+
* What a position holds when an edit further along the array forces it into
|
|
52
|
+
* existence - the shared **Array Add-item initialization** contract.
|
|
53
|
+
*
|
|
54
|
+
* `undefined` means the schema gives no unambiguous answer. That is not a
|
|
55
|
+
* failure to handle: section 18 says to "retain the edit as a local draft and
|
|
56
|
+
* identify the position needing input rather than inventing a type or null
|
|
57
|
+
* value", so the caller reports which position is blocking instead of filling
|
|
58
|
+
* it with a guess.
|
|
59
|
+
*/
|
|
60
|
+
export declare const tupleInitialValue: (schema: TupleSchema, root: JsonSchema) => unknown;
|
|
61
|
+
/**
|
|
62
|
+
* The value a *cleared* position keeps, which is not the same question as
|
|
63
|
+
* {@link tupleInitialValue}.
|
|
64
|
+
*
|
|
65
|
+
* Section 18: "absence and emptiness are distinct" and clearing "must never
|
|
66
|
+
* splice the array, shift later positions, or write undefined into it".
|
|
67
|
+
* Clearing a string leaves `""`; clearing a number has no natural empty value,
|
|
68
|
+
* so this returns `undefined` and the caller keeps the edit as a draft rather
|
|
69
|
+
* than silently writing `0` or `null`.
|
|
70
|
+
*/
|
|
71
|
+
export declare const tupleEmptyValue: (schema: TupleSchema, root: JsonSchema) => unknown;
|
|
72
|
+
/** Every JSON type, for a position the schema does not constrain. */
|
|
73
|
+
export declare const UNCONSTRAINED_TYPES: string[];
|
|
74
|
+
/**
|
|
75
|
+
* The schema to hand a delegated renderer.
|
|
76
|
+
*
|
|
77
|
+
* An unconstrained tail - `true`, or `{}` - carries no type, and JSON Forms
|
|
78
|
+
* would find no renderer for it. Section 18 says such a tail uses "the mixed
|
|
79
|
+
* renderer with type selection", and the way to ask for that renderer is a
|
|
80
|
+
* schema naming every type.
|
|
81
|
+
*/
|
|
82
|
+
export declare const tupleRenderSchema: (schema: TupleSchema) => JsonSchema;
|
|
83
|
+
/** Whether a position is edited through a summary and a dialog. */
|
|
84
|
+
export declare const isComplexTupleSchema: (schema: TupleSchema) => boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Whether a position draws its own label above the delegated editor.
|
|
87
|
+
*
|
|
88
|
+
* A scalar control renders its own `Form.Item` label, so labelling it here too
|
|
89
|
+
* would print the name twice. A complex position shows a summary rather than a
|
|
90
|
+
* control, a forbidden position shows a message, and a mixed position's own
|
|
91
|
+
* label belongs to the type selector - all three need the label supplied.
|
|
92
|
+
*/
|
|
93
|
+
export declare const tupleFieldOwnsLabel: (schema: TupleSchema) => boolean;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Resolve as e, extractDefaults as t, isControl as n } from "@jsonforms/core";
|
|
2
|
+
import r from "lodash/cloneDeep";
|
|
3
|
+
// src/tuple/tupleSchema.ts
|
|
4
|
+
var i = (e, t = !1) => {
|
|
5
|
+
let n = e;
|
|
6
|
+
if ((n == null ? void 0 : n.type) !== "array") return;
|
|
7
|
+
if (Array.isArray(n.prefixItems)) return {
|
|
8
|
+
prefix: n.prefixItems,
|
|
9
|
+
tail: n.items ?? !0
|
|
10
|
+
};
|
|
11
|
+
if (Array.isArray(n.items)) return {
|
|
12
|
+
prefix: n.items,
|
|
13
|
+
tail: n.additionalItems ?? !0
|
|
14
|
+
};
|
|
15
|
+
let { minItems: r, maxItems: i } = n;
|
|
16
|
+
if (t && Number.isInteger(r) && r >= 0 && r === i) return {
|
|
17
|
+
prefix: Array.from({ length: r }, () => n.items ?? !0),
|
|
18
|
+
tail: !1
|
|
19
|
+
};
|
|
20
|
+
}, a = (t, r, a) => {
|
|
21
|
+
var o;
|
|
22
|
+
if (!n(t)) return -1;
|
|
23
|
+
let s = e.schema(r, t.scope, (a == null ? void 0 : a.rootSchema) ?? r);
|
|
24
|
+
return ((o = t.options) == null ? void 0 : o.variant) === "tuple" || s && i(s) ? 25 : -1;
|
|
25
|
+
}, o = (t, n) => typeof t == "object" && t.$ref ? e.schema(n, t.$ref, n) ?? t : t, s = (e, n) => {
|
|
26
|
+
let i = o(e, n);
|
|
27
|
+
if (typeof i == "object") {
|
|
28
|
+
if (i.default !== void 0) return r(i.default);
|
|
29
|
+
switch (i.type) {
|
|
30
|
+
case "string": return "";
|
|
31
|
+
case "integer":
|
|
32
|
+
case "number": return 0;
|
|
33
|
+
case "boolean": return !1;
|
|
34
|
+
case "null": return null;
|
|
35
|
+
case "array": return [];
|
|
36
|
+
case "object": return t(i, n);
|
|
37
|
+
default: return;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, c = (e, t) => {
|
|
41
|
+
let n = o(e, t);
|
|
42
|
+
if (typeof n == "object") {
|
|
43
|
+
if (n.type === "string") return "";
|
|
44
|
+
if (n.type === "array") return [];
|
|
45
|
+
if (n.type === "object") return {};
|
|
46
|
+
if (n.type === "null" || Array.isArray(n.type) && n.type.includes("null")) return null;
|
|
47
|
+
}
|
|
48
|
+
}, l = [
|
|
49
|
+
"string",
|
|
50
|
+
"number",
|
|
51
|
+
"integer",
|
|
52
|
+
"boolean",
|
|
53
|
+
"object",
|
|
54
|
+
"array",
|
|
55
|
+
"null"
|
|
56
|
+
], u = (e) => e === !0 || typeof e == "object" && Object.keys(e).length === 0 ? { type: l } : e, d = (e) => typeof e == "object" && (e.type === "object" || e.type === "array"), f = (e) => {
|
|
57
|
+
if (e === !1 || d(e)) return !0;
|
|
58
|
+
let t = u(e);
|
|
59
|
+
return !t.type || Array.isArray(t.type);
|
|
60
|
+
};
|
|
61
|
+
export { l as UNCONSTRAINED_TYPES, d as isComplexTupleSchema, o as resolveTupleSchema, a as tupleControlTester, i as tupleDefinition, c as tupleEmptyValue, f as tupleFieldOwnsLabel, s as tupleInitialValue, u as tupleRenderSchema };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=tupleSchema.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tupleSchema.esm.js","names":["cloneDeep","tupleDefinition","candidate","schema","explicit","minItems","maxItems","tupleControlTester","_uischema$options","isControl","uischema","resolved","Resolve","context","resolveTupleSchema","root","tupleInitialValue","extractDefaults","tupleEmptyValue","UNCONSTRAINED_TYPES","tupleRenderSchema","isComplexTupleSchema","tupleFieldOwnsLabel","rendered"],"sources":["../../src/tuple/tupleSchema.ts"],"sourcesContent":["import {\n JsonSchema,\n RankedTester,\n Resolve,\n extractDefaults,\n isControl,\n} from '@jsonforms/core';\nimport cloneDeep from 'lodash/cloneDeep';\n\n/**\n * Positional arrays, with no React in it.\n *\n * Which schemas are tuples, what each position renders, and what value a\n * missing position starts life with are all decidable from the schema alone, so\n * they are settled here and tested without rendering anything.\n */\n\n/**\n * A position's schema. `false` is a real value here - draft-07's\n * `additionalItems: false` and 2020-12's `items: false` both mean \"nothing is\n * permitted past the prefix\" - so this cannot be narrowed to `JsonSchema`.\n */\nexport type TupleSchema = JsonSchema | boolean;\n\nexport interface TupleDefinition {\n /** One schema per declared position. */\n prefix: TupleSchema[];\n /** What a trailing value past the prefix must satisfy; `false` forbids one. */\n tail: TupleSchema;\n}\n\n/** 2020-12 spells the positional list `prefixItems`; the types predate it. */\ntype PositionalSchema = JsonSchema & { prefixItems?: TupleSchema[] };\n\n/**\n * The declared positions and the tail, or `undefined` when the schema does not\n * describe a tuple at all.\n *\n * **Both dialects are recognized**, which the gap review asks to be declared:\n * draft 2020-12's `prefixItems` + `items`, and draft-07's positional `items` +\n * `additionalItems`. `prefixItems` is checked first, because a 2020-12 schema\n * uses `items` for the *tail* and reading it as the prefix would turn one\n * position into every position.\n *\n * `explicit` is `options.variant === 'tuple'` and unlocks only the third case -\n * a uniform array asked to be presented positionally. A positional schema needs\n * no variant, and per section 18 equal bounds alone must not change how an\n * ordinary uniform array is presented.\n */\nexport const tupleDefinition = (\n schema: JsonSchema | undefined,\n explicit = false,\n): TupleDefinition | undefined => {\n const candidate = schema as PositionalSchema | undefined;\n if (candidate?.type !== 'array') {\n return undefined;\n }\n if (Array.isArray(candidate.prefixItems)) {\n return {\n prefix: candidate.prefixItems,\n tail: (candidate.items ?? true) as TupleSchema,\n };\n }\n if (Array.isArray(candidate.items)) {\n return {\n prefix: candidate.items as TupleSchema[],\n tail: (candidate.additionalItems ?? true) as TupleSchema,\n };\n }\n const { minItems, maxItems } = candidate;\n if (\n explicit &&\n Number.isInteger(minItems) &&\n (minItems as number) >= 0 &&\n minItems === maxItems\n ) {\n return {\n // The shared item schema, repeated. The count comes from the bounds, so\n // the tail is closed: a uniform tuple has exactly as many positions as it\n // declares.\n prefix: Array.from(\n { length: minItems as number },\n () => (candidate.items ?? true) as TupleSchema,\n ),\n tail: false,\n };\n }\n return undefined;\n};\n\n/**\n * Rank 25, above the mixed control at 20 and every array renderer below it.\n *\n * It deliberately also claims a control that merely *asks* for `variant:\n * \"tuple\"` without a schema that can support one. Section 18 calls that an\n * \"unsupported configuration\" and says to \"report a configuration diagnostic\n * rather than guessing a positional count\" - which is only possible if this\n * renderer wins and explains itself. Falling through would render an ordinary\n * array control and silently ignore the request.\n */\nexport const tupleControlTester: RankedTester = (uischema, schema, context) => {\n if (!isControl(uischema)) {\n return -1;\n }\n const resolved = Resolve.schema(\n schema,\n uischema.scope,\n context?.rootSchema ?? schema,\n );\n const explicit = uischema.options?.variant === 'tuple';\n return explicit || (resolved && tupleDefinition(resolved)) ? 25 : -1;\n};\n\n/** Follows a `$ref` on a positional schema, leaving anything else alone. */\nexport const resolveTupleSchema = (\n schema: TupleSchema,\n root: JsonSchema,\n): TupleSchema =>\n typeof schema === 'object' && schema.$ref\n ? (Resolve.schema(root, schema.$ref, root) ?? schema)\n : schema;\n\n/**\n * What a position holds when an edit further along the array forces it into\n * existence - the shared **Array Add-item initialization** contract.\n *\n * `undefined` means the schema gives no unambiguous answer. That is not a\n * failure to handle: section 18 says to \"retain the edit as a local draft and\n * identify the position needing input rather than inventing a type or null\n * value\", so the caller reports which position is blocking instead of filling\n * it with a guess.\n */\nexport const tupleInitialValue = (\n schema: TupleSchema,\n root: JsonSchema,\n): unknown => {\n const resolved = resolveTupleSchema(schema, root);\n if (typeof resolved !== 'object') {\n return undefined;\n }\n if (resolved.default !== undefined) {\n // Deep-copied, so two positions sharing one schema cannot end up sharing\n // the object the schema author wrote.\n return cloneDeep(resolved.default);\n }\n switch (resolved.type) {\n case 'string':\n return '';\n case 'integer':\n case 'number':\n return 0;\n case 'boolean':\n return false;\n case 'null':\n return null;\n case 'array':\n return [];\n case 'object':\n return extractDefaults(resolved, root);\n default:\n // A union, an unconstrained schema, or a combinator: no single supported\n // type, so no initial value.\n return undefined;\n }\n};\n\n/**\n * The value a *cleared* position keeps, which is not the same question as\n * {@link tupleInitialValue}.\n *\n * Section 18: \"absence and emptiness are distinct\" and clearing \"must never\n * splice the array, shift later positions, or write undefined into it\".\n * Clearing a string leaves `\"\"`; clearing a number has no natural empty value,\n * so this returns `undefined` and the caller keeps the edit as a draft rather\n * than silently writing `0` or `null`.\n */\nexport const tupleEmptyValue = (\n schema: TupleSchema,\n root: JsonSchema,\n): unknown => {\n const resolved = resolveTupleSchema(schema, root);\n if (typeof resolved !== 'object') {\n return undefined;\n }\n if (resolved.type === 'string') return '';\n if (resolved.type === 'array') return [];\n if (resolved.type === 'object') return {};\n if (\n resolved.type === 'null' ||\n (Array.isArray(resolved.type) && resolved.type.includes('null'))\n ) {\n return null;\n }\n return undefined;\n};\n\n/** Every JSON type, for a position the schema does not constrain. */\nexport const UNCONSTRAINED_TYPES = [\n 'string',\n 'number',\n 'integer',\n 'boolean',\n 'object',\n 'array',\n 'null',\n];\n\n/**\n * The schema to hand a delegated renderer.\n *\n * An unconstrained tail - `true`, or `{}` - carries no type, and JSON Forms\n * would find no renderer for it. Section 18 says such a tail uses \"the mixed\n * renderer with type selection\", and the way to ask for that renderer is a\n * schema naming every type.\n */\nexport const tupleRenderSchema = (schema: TupleSchema): JsonSchema => {\n if (\n schema === true ||\n (typeof schema === 'object' && Object.keys(schema).length === 0)\n ) {\n return { type: UNCONSTRAINED_TYPES } as JsonSchema;\n }\n return schema as JsonSchema;\n};\n\n/** Whether a position is edited through a summary and a dialog. */\nexport const isComplexTupleSchema = (schema: TupleSchema): boolean =>\n typeof schema === 'object' &&\n (schema.type === 'object' || schema.type === 'array');\n\n/**\n * Whether a position draws its own label above the delegated editor.\n *\n * A scalar control renders its own `Form.Item` label, so labelling it here too\n * would print the name twice. A complex position shows a summary rather than a\n * control, a forbidden position shows a message, and a mixed position's own\n * label belongs to the type selector - all three need the label supplied.\n */\nexport const tupleFieldOwnsLabel = (schema: TupleSchema): boolean => {\n if (schema === false || isComplexTupleSchema(schema)) {\n return true;\n }\n const rendered = tupleRenderSchema(schema);\n return !rendered.type || Array.isArray(rendered.type);\n};\n"],"mappings":";;;AAiDA,IAAaC,KACX,GACA,IAAW,OACqB;CAChC,IAAMC,IAAYC;CAClB,KAAAD,KAAA,OAAA,KAAA,IAAIA,EAAW,UAAS,SACtB;CAEF,IAAI,MAAM,QAAQA,EAAU,WAAW,GACrC,OAAO;EACL,QAAQA,EAAU;EAClB,MAAOA,EAAU,SAAS;CAC5B;CAEF,IAAI,MAAM,QAAQA,EAAU,KAAK,GAC/B,OAAO;EACL,QAAQA,EAAU;EAClB,MAAOA,EAAU,mBAAmB;CACtC;CAEF,IAAM,EAAE,aAAU,gBAAaA;CAC/B,IACEE,KACA,OAAO,UAAUC,CAAQ,KACxBA,KAAuB,KACxBA,MAAaC,GAEb,OAAO;EAIL,QAAQ,MAAM,KACZ,EAAE,QAAQD,EAAmB,SACtBH,EAAU,SAAS,EAC5B;EACA,MAAM;CACR;AAGJ,GAYaK,KAAoC,GAAU,GAAQ,MAAY;;CAC7E,IAAI,CAACE,EAAUC,CAAQ,GACrB,OAAO;CAET,IAAMC,IAAWC,EAAQ,OACvBT,GACAO,EAAS,QAAAG,KAAA,OAAA,KAAA,IACTA,EAAS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B,MAAiC;CACnE,IAAInB,MAAW,MAASkB,EAAqBlB,CAAM,GACjD,OAAO;CAET,IAAMoB,IAAWH,EAAkBjB,CAAM;CACzC,OAAO,CAACoB,EAAS,QAAQ,MAAM,QAAQA,EAAS,IAAI;AACtD"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../collections/useCollectionDelete.cjs.js"),t=require("../collections/collectionPagination.cjs.js"),n=require("../locale/translate.cjs.js"),r=require("./tupleSchema.cjs.js");let i=require("react");var a=({definition:a,data:o,schema:s,rootSchema:c,options:l,config:u,path:d,enabled:f,onChange:p})=>{var m;let h=n.useI18n(),[g,_]=(0,i.useState)(),v=l.restrict!==!1,{maxItems:y,minItems:b}=s,x=f&&!l.disableAdd&&a.tail!==!1&&(!v||y===void 0||Math.max(o.length,a.prefix.length)<y),S=f&&!l.disableRemove&&(!v||b===void 0||o.length>b),C=()=>{let e=[...o];for(let t=e.length;t<a.prefix.length;t+=1){let n=r.tupleInitialValue(a.prefix[t],c);if(n===void 0){_(h(`tuple.missingPosition`,{position:t+1}));return}e.push(n)}let{tail:t}=a,n=t===!0||typeof t==`object`&&Object.keys(t).length===0,i=r.tupleInitialValue(t,c);i===void 0&&!n?_(h(`tuple.initialType`)):(e.push(i===void 0?``:i),_(void 0),p(e))},w=e.useCollectionDelete({data:o,identity:d,catalogId:`additionalItems`,options:l,config:u,canRemove:e=>S&&e>=a.prefix.length&&e<o.length,value:e=>o[e],remove:e=>p(o.filter((t,n)=>n!==e))}),T=[];for(let e=a.prefix.length;e<Math.max(o.length,a.prefix.length);e+=1)T.push(e);let E=t.useCollectionPagination(T,(m=l.additionalItems)==null?void 0:m.pagination,u,`additionalItems`);return{visibleIndices:E.indices.map(e=>T[e]),t:h,message:g,canAdd:x,canDelete:S,add:C,deletion:w,trailing:T,page:E}};exports.useTupleAdditionalItems=a;
|
|
2
|
+
//# sourceMappingURL=useTupleAdditionalItems.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTupleAdditionalItems.cjs.js","names":["useI18n","useState","tupleInitialValue","useCollectionDelete","useCollectionPagination","require_collections_useCollectionDelete","require_collections_collectionPagination","require_locale_translate","require_tuple_tupleSchema","react","useTupleAdditionalItems","_options$additionalIt","t","message","setMessage","restricted","options","schema","canAdd","enabled","definition","maxItems","data","canDelete","minItems","add","next","position","initial","rootSchema","unconstrained","tail","onChange","deletion","path","index","trailing","page","config","offset"],"sources":["../../src/tuple/useTupleAdditionalItems.ts"],"sourcesContent":["import type { JsonSchema } from '@jsonforms/core';\nimport { useState, type ReactNode } from 'react';\nimport { useCollectionDelete } from '../collections/useCollectionDelete';\nimport { useCollectionPagination } from '../collections/collectionPagination';\nimport { useI18n } from '../locale/translate';\nimport { tupleInitialValue, type TupleDefinition } from './tupleSchema';\n\nexport interface TupleAdditionalItemsInput {\n definition: TupleDefinition;\n data: unknown[];\n schema: JsonSchema;\n rootSchema: JsonSchema;\n options: Record<string, any>;\n config?: any;\n path?: string;\n enabled: boolean;\n onChange: (next: unknown[]) => void;\n}\n\nexport interface TupleAdditionalItemsProps extends TupleAdditionalItemsInput {\n renderItem: (index: number) => ReactNode;\n positionLabel: (index: number) => string;\n}\n\n/** Shared tuple-tail operations; each renderer owns its presentation. */\nexport const useTupleAdditionalItems = ({\n definition,\n data,\n schema,\n rootSchema,\n options,\n config,\n path,\n enabled,\n onChange,\n}: TupleAdditionalItemsInput) => {\n const t = useI18n();\n const [message, setMessage] = useState<string | undefined>();\n\n // Restrict prevents an edit at the bounds; otherwise validation reports it.\n const restricted = options.restrict !== false;\n const { maxItems, minItems } = schema;\n\n const canAdd =\n enabled &&\n !options.disableAdd &&\n definition.tail !== false &&\n (!restricted ||\n maxItems === undefined ||\n Math.max(data.length, definition.prefix.length) < maxItems);\n\n const canDelete =\n enabled &&\n !options.disableRemove &&\n (!restricted || minItems === undefined || data.length > minItems);\n\n const add = () => {\n const next = [...data];\n // Fill any missing declared positions before appending the tail.\n for (\n let position = next.length;\n position < definition.prefix.length;\n position += 1\n ) {\n const initial = tupleInitialValue(\n definition.prefix[position],\n rootSchema,\n );\n if (initial === undefined) {\n setMessage(t('tuple.missingPosition', { position: position + 1 }));\n return;\n }\n next.push(initial);\n }\n const { tail } = definition;\n const unconstrained =\n tail === true ||\n (typeof tail === 'object' && Object.keys(tail).length === 0);\n const initial = tupleInitialValue(tail, rootSchema);\n if (initial === undefined && !unconstrained) {\n setMessage(t('tuple.initialType'));\n return;\n }\n // The mixed renderer can choose a type after an unconstrained tail starts.\n next.push(initial === undefined ? '' : initial);\n setMessage(undefined);\n onChange(next);\n };\n\n const deletion = useCollectionDelete<number>({\n data,\n identity: path,\n catalogId: 'additionalItems',\n options,\n config,\n canRemove: (index) =>\n canDelete && index >= definition.prefix.length && index < data.length,\n value: (index) => data[index],\n remove: (index) =>\n onChange(data.filter((_, position) => position !== index)),\n });\n\n const trailing: number[] = [];\n for (\n let index = definition.prefix.length;\n index < Math.max(data.length, definition.prefix.length);\n index += 1\n ) {\n trailing.push(index);\n }\n\n const page = useCollectionPagination(\n trailing,\n options.additionalItems?.pagination,\n config,\n 'additionalItems',\n );\n\n const visibleIndices = page.indices.map((offset) => trailing[offset]);\n return {\n visibleIndices,\n t,\n message,\n canAdd,\n canDelete,\n add,\n deletion,\n trailing,\n page,\n };\n};\n"],"mappings":"A,yRAyBA,IAAaU,GAA2B,CACtC,aACA,OACA,SACA,aACA,UACA,SACA,OACA,UACA,cAC+B,C,MAC/B,IAAME,EAAIZ,EAAAA,QAAQ,EACZ,CAACa,EAASC,IAAA,EAAcb,EAAAA,SAAAA,CAA6B,EAGrDc,EAAaC,EAAQ,WAAa,GAClC,CAAE,WAAU,YAAaC,EAEzBC,EACJC,GACA,CAACH,EAAQ,YACTI,EAAW,OAAS,KACnB,CAACL,GACAM,IAAa,IAAA,IACb,KAAK,IAAIC,EAAK,OAAQF,EAAW,OAAO,MAAM,EAAIC,GAEh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B2B,EACA,iBACF,EAGA,MAAO,CACL,eAFqBD,EAAK,QAAQ,IAAK,GAAWD,EAASG,EAE3D,EACA,IACA,UACA,SACA,YACA,MACA,WACA,WACA,MACF,CACF,E"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { JsonSchema } from '@jsonforms/core';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
import { type TupleDefinition } from './tupleSchema';
|
|
4
|
+
export interface TupleAdditionalItemsInput {
|
|
5
|
+
definition: TupleDefinition;
|
|
6
|
+
data: unknown[];
|
|
7
|
+
schema: JsonSchema;
|
|
8
|
+
rootSchema: JsonSchema;
|
|
9
|
+
options: Record<string, any>;
|
|
10
|
+
config?: any;
|
|
11
|
+
path?: string;
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
onChange: (next: unknown[]) => void;
|
|
14
|
+
}
|
|
15
|
+
export interface TupleAdditionalItemsProps extends TupleAdditionalItemsInput {
|
|
16
|
+
renderItem: (index: number) => ReactNode;
|
|
17
|
+
positionLabel: (index: number) => string;
|
|
18
|
+
}
|
|
19
|
+
/** Shared tuple-tail operations; each renderer owns its presentation. */
|
|
20
|
+
export declare const useTupleAdditionalItems: ({ definition, data, schema, rootSchema, options, config, path, enabled, onChange, }: TupleAdditionalItemsInput) => {
|
|
21
|
+
visibleIndices: number[];
|
|
22
|
+
t: (key: import("..").I18nKey, values?: Record<string, unknown>) => string;
|
|
23
|
+
message: string | undefined;
|
|
24
|
+
canAdd: boolean;
|
|
25
|
+
canDelete: boolean;
|
|
26
|
+
add: () => void;
|
|
27
|
+
deletion: {
|
|
28
|
+
confirming: boolean;
|
|
29
|
+
request: (key: number) => void;
|
|
30
|
+
confirm: () => void;
|
|
31
|
+
cancel: () => void;
|
|
32
|
+
};
|
|
33
|
+
trailing: number[];
|
|
34
|
+
page: {
|
|
35
|
+
pending: Set<import("..").PendingChange>;
|
|
36
|
+
enabled: boolean;
|
|
37
|
+
current: number;
|
|
38
|
+
size: any;
|
|
39
|
+
total: number;
|
|
40
|
+
pages: number;
|
|
41
|
+
choices: any[];
|
|
42
|
+
indices: number[];
|
|
43
|
+
change: (nextPage: number, nextSize?: any) => void;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useCollectionDelete as e } from "../collections/useCollectionDelete.esm.js";
|
|
2
|
+
import { useCollectionPagination as t } from "../collections/collectionPagination.esm.js";
|
|
3
|
+
import { useI18n as n } from "../locale/translate.esm.js";
|
|
4
|
+
import { tupleInitialValue as r } from "./tupleSchema.esm.js";
|
|
5
|
+
import { useState as i } from "react";
|
|
6
|
+
// src/tuple/useTupleAdditionalItems.ts
|
|
7
|
+
var a = ({ definition: a, data: o, schema: s, rootSchema: c, options: l, config: u, path: d, enabled: f, onChange: p }) => {
|
|
8
|
+
var m;
|
|
9
|
+
let h = n(), [g, _] = i(), v = l.restrict !== !1, { maxItems: y, minItems: b } = s, x = f && !l.disableAdd && a.tail !== !1 && (!v || y === void 0 || Math.max(o.length, a.prefix.length) < y), S = f && !l.disableRemove && (!v || b === void 0 || o.length > b), C = () => {
|
|
10
|
+
let e = [...o];
|
|
11
|
+
for (let t = e.length; t < a.prefix.length; t += 1) {
|
|
12
|
+
let n = r(a.prefix[t], c);
|
|
13
|
+
if (n === void 0) {
|
|
14
|
+
_(h("tuple.missingPosition", { position: t + 1 }));
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
e.push(n);
|
|
18
|
+
}
|
|
19
|
+
let { tail: t } = a, n = t === !0 || typeof t == "object" && Object.keys(t).length === 0, i = r(t, c);
|
|
20
|
+
i === void 0 && !n ? _(h("tuple.initialType")) : (e.push(i === void 0 ? "" : i), _(void 0), p(e));
|
|
21
|
+
}, w = e({
|
|
22
|
+
data: o,
|
|
23
|
+
identity: d,
|
|
24
|
+
catalogId: "additionalItems",
|
|
25
|
+
options: l,
|
|
26
|
+
config: u,
|
|
27
|
+
canRemove: (e) => S && e >= a.prefix.length && e < o.length,
|
|
28
|
+
value: (e) => o[e],
|
|
29
|
+
remove: (e) => p(o.filter((t, n) => n !== e))
|
|
30
|
+
}), T = [];
|
|
31
|
+
for (let e = a.prefix.length; e < Math.max(o.length, a.prefix.length); e += 1) T.push(e);
|
|
32
|
+
let E = t(T, (m = l.additionalItems) == null ? void 0 : m.pagination, u, "additionalItems");
|
|
33
|
+
return {
|
|
34
|
+
visibleIndices: E.indices.map((e) => T[e]),
|
|
35
|
+
t: h,
|
|
36
|
+
message: g,
|
|
37
|
+
canAdd: x,
|
|
38
|
+
canDelete: S,
|
|
39
|
+
add: C,
|
|
40
|
+
deletion: w,
|
|
41
|
+
trailing: T,
|
|
42
|
+
page: E
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export { a as useTupleAdditionalItems };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=useTupleAdditionalItems.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTupleAdditionalItems.esm.js","names":["useTupleAdditionalItems","_options$additionalIt","t","useI18n","message","setMessage","useState","restricted","options","schema","canAdd","enabled","definition","maxItems","data","canDelete","minItems","add","next","position","initial","tupleInitialValue","rootSchema","unconstrained","tail","onChange","deletion","useCollectionDelete","path","index","trailing","page","useCollectionPagination","config","offset"],"sources":["../../src/tuple/useTupleAdditionalItems.ts"],"sourcesContent":["import type { JsonSchema } from '@jsonforms/core';\nimport { useState, type ReactNode } from 'react';\nimport { useCollectionDelete } from '../collections/useCollectionDelete';\nimport { useCollectionPagination } from '../collections/collectionPagination';\nimport { useI18n } from '../locale/translate';\nimport { tupleInitialValue, type TupleDefinition } from './tupleSchema';\n\nexport interface TupleAdditionalItemsInput {\n definition: TupleDefinition;\n data: unknown[];\n schema: JsonSchema;\n rootSchema: JsonSchema;\n options: Record<string, any>;\n config?: any;\n path?: string;\n enabled: boolean;\n onChange: (next: unknown[]) => void;\n}\n\nexport interface TupleAdditionalItemsProps extends TupleAdditionalItemsInput {\n renderItem: (index: number) => ReactNode;\n positionLabel: (index: number) => string;\n}\n\n/** Shared tuple-tail operations; each renderer owns its presentation. */\nexport const useTupleAdditionalItems = ({\n definition,\n data,\n schema,\n rootSchema,\n options,\n config,\n path,\n enabled,\n onChange,\n}: TupleAdditionalItemsInput) => {\n const t = useI18n();\n const [message, setMessage] = useState<string | undefined>();\n\n // Restrict prevents an edit at the bounds; otherwise validation reports it.\n const restricted = options.restrict !== false;\n const { maxItems, minItems } = schema;\n\n const canAdd =\n enabled &&\n !options.disableAdd &&\n definition.tail !== false &&\n (!restricted ||\n maxItems === undefined ||\n Math.max(data.length, definition.prefix.length) < maxItems);\n\n const canDelete =\n enabled &&\n !options.disableRemove &&\n (!restricted || minItems === undefined || data.length > minItems);\n\n const add = () => {\n const next = [...data];\n // Fill any missing declared positions before appending the tail.\n for (\n let position = next.length;\n position < definition.prefix.length;\n position += 1\n ) {\n const initial = tupleInitialValue(\n definition.prefix[position],\n rootSchema,\n );\n if (initial === undefined) {\n setMessage(t('tuple.missingPosition', { position: position + 1 }));\n return;\n }\n next.push(initial);\n }\n const { tail } = definition;\n const unconstrained =\n tail === true ||\n (typeof tail === 'object' && Object.keys(tail).length === 0);\n const initial = tupleInitialValue(tail, rootSchema);\n if (initial === undefined && !unconstrained) {\n setMessage(t('tuple.initialType'));\n return;\n }\n // The mixed renderer can choose a type after an unconstrained tail starts.\n next.push(initial === undefined ? '' : initial);\n setMessage(undefined);\n onChange(next);\n };\n\n const deletion = useCollectionDelete<number>({\n data,\n identity: path,\n catalogId: 'additionalItems',\n options,\n config,\n canRemove: (index) =>\n canDelete && index >= definition.prefix.length && index < data.length,\n value: (index) => data[index],\n remove: (index) =>\n onChange(data.filter((_, position) => position !== index)),\n });\n\n const trailing: number[] = [];\n for (\n let index = definition.prefix.length;\n index < Math.max(data.length, definition.prefix.length);\n index += 1\n ) {\n trailing.push(index);\n }\n\n const page = useCollectionPagination(\n trailing,\n options.additionalItems?.pagination,\n config,\n 'additionalItems',\n );\n\n const visibleIndices = page.indices.map((offset) => trailing[offset]);\n return {\n visibleIndices,\n t,\n message,\n canAdd,\n canDelete,\n add,\n deletion,\n trailing,\n page,\n };\n};\n"],"mappings":";;;;;;AAyBA,IAAaA,KAA2B,EACtC,eACA,SACA,WACA,eACA,YACA,WACA,SACA,YACA,kBAC+B;;CAC/B,IAAME,IAAIC,EAAQ,GACZ,CAACC,GAASC,KAAcC,EAA6B,GAGrDC,IAAaC,EAAQ,aAAa,IAClC,EAAE,aAAU,gBAAaC,GAEzBC,IACJC,KACA,CAACH,EAAQ,cACTI,EAAW,SAAS,OACnB,CAACL,KACAM,MAAa,KAAA,KACb,KAAK,IAAIC,EAAK,QAAQF,EAAW,OAAO,MAAM,IAAIC,IAEhDE,IACJJ,KACA,CAACH,EAAQ,kBACR,CAACD,KAAcS,MAAa,KAAA,KAAaF,EAAK,SAASE,IAEpDC,UAAY;EAChB,IAAMC,IAAO,CAAC,GAAGJ,CAAI;EAErB,KACE,IAAIK,IAAWD,EAAK,QACpBC,IAAWP,EAAW,OAAO,QAC7B,KAAY,GACZ;GACA,IAAMQ,IAAUC,EACdT,EAAW,OAAOO,IAClBG,CACF;GACA,IAAIF,MAAY,KAAA,GAAW;IACzB,EAAWlB,EAAE,yBAAyB,EAAE,UAAUiB,IAAW,EAAE,CAAC,CAAC;IACjE;GACF;GACA,EAAK,KAAKC,CAAO;EACnB;EACA,IAAM,EAAE,YAASR,GACXW,IACJC,MAAS,MACR,OAAOA,KAAS,YAAY,OAAO,KAAKA,CAAI,CAAC,CAAC,WAAW,GACtDJ,IAAUC,EAAkBG,GAAMF,CAAU;EAClD,AAAIF,MAAY,KAAA,KAAa,CAACG,IAC5BlB,EAAWH,EAAE,mBAAmB,CAAC,KAInCgB,EAAK,KAAKE,MAAY,KAAA,IAAY,KAAKA,CAAO,GAC9Cf,EAAW,KAAA,CAAS,GACpBoB,EAASP,CAAI;CACf,GAEMQ,IAAWC,EAA4B;EAC3C;EACA,UAAUC;EACV,WAAW;EACX;EACA;EACA,YAAY,MACVb,KAAac,KAASjB,EAAW,OAAO,UAAUiB,IAAQf,EAAK;EACjE,QAAQ,MAAUA,EAAKe;EACvB,SAAS,MACPJ,EAASX,EAAK,QAAQ,GAAG,MAAaK,MAAaU,CAAK,CAAC;CAC7D,CAAC,GAEKC,IAAqB,CAAC;CAC5B,KACE,IAAID,IAAQjB,EAAW,OAAO,QAC9BiB,IAAQ,KAAK,IAAIf,EAAK,QAAQF,EAAW,OAAO,MAAM,GACtD,KAAS,GAET,EAAS,KAAKiB,CAAK;CAGrB,IAAME,IAAOC,EACXF,IAAA,IACAtB,EAAQ,oBAAA,OAAA,KAAA,IAAAP,EAAiB,YACzBgC,GACA,iBACF;CAGA,OAAO;EACL,gBAFqBF,EAAK,QAAQ,KAAK,MAAWD,EAASI,EAE3D;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BocRIvOZ.js"),t=require("../dynamic/DynamicUiProvider.cjs.js"),n=require("../locale/translate.cjs.js"),r=require("./tupleSchema.cjs.js");let i=require("react");i=e.t(i);let a=require("@jsonforms/core"),o=require("@jsonforms/react");var s=/\/(?:items|prefixItems)\/(\d+)(\/.*)?$/,c=i.default.createContext(void 0),l={tester:e=>{let t=e==null?void 0:e.scope;return(e==null?void 0:e.type)===`Control`&&typeof t==`string`&&s.test(t)?9999:-1},renderer:({uischema:e})=>{let t=i.default.useContext(c),n=e==null?void 0:e.scope,r=typeof n==`string`?s.exec(n):null;if(!t||!r)return null;let a=Number(r[1]);return a<0||a>=t.count?null:r[2]?t.renderWithin(a,`#${r[2]}`):t.render(a)}},u=(e,t=new Set)=>{if(!e||typeof e!=`object`)return t;let n=e,r=typeof n.scope==`string`?s.exec(n.scope):null;if(r&&t.add(Number(r[1])),Array.isArray(n.elements))for(let e of n.elements)u(e,t);return t},d=e=>{let t=e.detail;return t&&typeof t==`object`&&typeof t.type==`string`?t:void 0},f=e=>{var i,s;let{data:c,enabled:l,errors:f,path:p,rootSchema:m,schema:h,uischema:g,uischemas:_}=e,v=t.useDynamicTreeResolver(p),y=n.useI18n(),b=(0,o.useJsonForms)(),x={...e.config,...g.options},S=(((i=g.options)==null?void 0:i.vertical)??((s=e.config)==null||(s=s.jsonformsExtended)==null||(s=s.tuple)==null?void 0:s.vertical)??!1)===!0,C=r.tupleDefinition(h,x.variant===`tuple`),w=Array.isArray(c)?c:[],T=l!==!1,E=e=>y(`tuple.position`,{position:e+1}),D=e=>{if(!C)return!0;let t=C.prefix[e],n=C.tail===!1||C.tail;return r.resolveTupleSchema(t??n,m)},O=e=>r.tupleRenderSchema(D(e)).title??E(e),k=e=>{let t=r.tupleRenderSchema(D(e)),n=O(e);if(!r.isComplexTupleSchema(D(e)))return{type:`Control`,scope:`#`,label:n};let i=(0,a.findUISchema)((_??[]).filter(e=>typeof(e==null?void 0:e.tester)==`function`),t,`#`,`${p}.${e}`,()=>({type:`Control`,scope:`#`,label:n}),{type:`Control`,scope:`#`},m);return{...i,label:i.label??n}},A=d(x),j=A?v(A):void 0;return{t:y,options:x,vertical:S,definition:C,values:w,editable:T,positionLabel:E,fieldSchema:D,fieldUiSchema:k,positionLayout:j,shownErrors:[f,...(()=>{if(!j||!C)return[];let e=u(j),t=[];return C.prefix.forEach((n,r)=>{var i;if(e.has(r))return;let o=`${p}.${r}`,s=(((i=b.core)==null?void 0:i.errors)??[]).filter(e=>{let t=(0,a.getControlPath)(e);return t===o||t.startsWith(`${o}.`)});for(let e of s)t.push(`${O(r)}: ${e.message}`)}),t})()].filter(Boolean).join(`
|
|
2
|
+
`)}};exports.TuplePositionContext=c,exports.tuplePositionEntry=l,exports.useTupleControl=f;
|
|
3
|
+
//# sourceMappingURL=useTupleControl.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTupleControl.cjs.js","names":["React","useDynamicTreeResolver","useI18n","useJsonForms","tupleDefinition","resolveTupleSchema","tupleRenderSchema","isComplexTupleSchema","findUISchema","getControlPath","require_rolldown_runtime","require_dynamic_DynamicUiProvider","require_locale_translate","require_tuple_tupleSchema","react","_jsonforms_core","_jsonforms_react","POSITION_SCOPE","TuplePositionContext","tuplePositionEntry","scope","uischema","ctx","match","index","namedPositions","element","found","node","child","positionLayoutOf","layout","options","useTupleControl","_uischema$options","_props$config","props","resolveTree","path","t","jsonforms","vertical","definition","schema","values","data","editable","enabled","positionLabel","fieldSchema","declared","fallback","rootSchema","positionName","fieldUiSchema","positionSchema","name","uischemas","entry","authoredPositionLayout","positionLayout","errors","named","messages","_jsonforms$core","target","own","at","error"],"sources":["../../src/tuple/useTupleControl.tsx"],"sourcesContent":["import React from 'react';\nimport { useDynamicTreeResolver } from '../dynamic/DynamicUiProvider';\nimport { useI18n } from '../locale/translate';\nimport {\n isComplexTupleSchema,\n resolveTupleSchema,\n tupleDefinition,\n tupleRenderSchema,\n type TupleSchema,\n} from './tupleSchema';\nimport {\n type ControlElement,\n type JsonFormsRendererRegistryEntry,\n type UISchemaElement,\n type StatePropsOfControlWithDetail,\n findUISchema,\n getControlPath,\n} from '@jsonforms/core';\nimport { useJsonForms } from '@jsonforms/react';\n\nconst POSITION_SCOPE = /\\/(?:items|prefixItems)\\/(\\d+)(\\/.*)?$/;\n\ninterface TuplePositionContextValue {\n count: number;\n render: (index: number) => React.ReactElement | null;\n renderWithin: (index: number, scope: string) => React.ReactElement | null;\n}\n\n/** A module-level renderer keeps focused position controls mounted on re-render. */\nexport const TuplePositionContext = React.createContext<\n TuplePositionContextValue | undefined\n>(undefined);\n\nconst TuplePositionRenderer = ({ uischema }: { uischema: UISchemaElement }) => {\n const ctx = React.useContext(TuplePositionContext);\n const scope = (uischema as ControlElement)?.scope;\n const match = typeof scope === 'string' ? POSITION_SCOPE.exec(scope) : null;\n if (!ctx || !match) return null;\n const index = Number(match[1]);\n if (index < 0 || index >= ctx.count) return null;\n return match[2] ? ctx.renderWithin(index, `#${match[2]}`) : ctx.render(index);\n};\n\nexport const tuplePositionEntry: JsonFormsRendererRegistryEntry = {\n tester: (uischema) => {\n const scope = (uischema as ControlElement)?.scope;\n return uischema?.type === 'Control' &&\n typeof scope === 'string' &&\n POSITION_SCOPE.test(scope)\n ? 9999\n : -1;\n },\n renderer: TuplePositionRenderer as any,\n};\n\nconst namedPositions = (element: unknown, found = new Set<number>()) => {\n if (!element || typeof element !== 'object') return found;\n const node = element as UISchemaElement & {\n scope?: string;\n elements?: unknown[];\n };\n const match =\n typeof node.scope === 'string' ? POSITION_SCOPE.exec(node.scope) : null;\n if (match) found.add(Number(match[1]));\n if (Array.isArray(node.elements))\n for (const child of node.elements) namedPositions(child, found);\n return found;\n};\n\nconst positionLayoutOf = (\n options: Record<string, any>,\n): UISchemaElement | undefined => {\n const layout = options.detail;\n return layout &&\n typeof layout === 'object' &&\n typeof (layout as UISchemaElement).type === 'string'\n ? (layout as UISchemaElement)\n : undefined;\n};\n\n/** Resolve positional schemas and registry entries without any UI toolkit dependency. */\nexport const useTupleControl = (props: StatePropsOfControlWithDetail) => {\n const {\n data,\n enabled,\n errors,\n path,\n rootSchema,\n schema,\n uischema,\n uischemas,\n } = props;\n const resolveTree = useDynamicTreeResolver(path);\n const t = useI18n();\n const jsonforms = useJsonForms();\n const options = { ...props.config, ...uischema.options } as Record<\n string,\n any\n >;\n const vertical =\n (uischema.options?.vertical ??\n props.config?.jsonformsExtended?.tuple?.vertical ??\n false) === true;\n const definition = tupleDefinition(schema, options.variant === 'tuple');\n const values: unknown[] = Array.isArray(data) ? data : [];\n const editable = enabled !== false;\n const positionLabel = (index: number) =>\n t('tuple.position', { position: index + 1 });\n const fieldSchema = (index: number): TupleSchema => {\n if (!definition) return true;\n const declared = definition.prefix[index];\n const fallback = definition.tail === false ? true : definition.tail;\n return resolveTupleSchema(declared ?? fallback, rootSchema);\n };\n const positionName = (index: number) =>\n tupleRenderSchema(fieldSchema(index)).title ?? positionLabel(index);\n const fieldUiSchema = (index: number): UISchemaElement => {\n const positionSchema = tupleRenderSchema(fieldSchema(index));\n const name = positionName(index);\n if (!isComplexTupleSchema(fieldSchema(index)))\n return { type: 'Control', scope: '#', label: name } as ControlElement;\n const found = findUISchema(\n // A host registry can contain serialized entries without callable testers.\n (uischemas ?? []).filter((entry) => typeof entry?.tester === 'function'),\n positionSchema,\n '#',\n `${path}.${index}`,\n () => ({ type: 'Control', scope: '#', label: name }) as ControlElement,\n { type: 'Control', scope: '#' } as ControlElement,\n rootSchema,\n );\n return {\n ...found,\n label: (found as { label?: unknown }).label ?? name,\n } as UISchemaElement;\n };\n const authoredPositionLayout = positionLayoutOf(options);\n const positionLayout = authoredPositionLayout\n ? resolveTree(authoredPositionLayout)\n : undefined;\n const hiddenPositionErrors = (): string[] => {\n if (!positionLayout || !definition) return [];\n const named = namedPositions(positionLayout);\n const messages: string[] = [];\n definition.prefix.forEach((_, index) => {\n if (named.has(index)) return;\n const target = `${path}.${index}`;\n const own = (jsonforms.core?.errors ?? []).filter((error) => {\n const at = getControlPath(error);\n return at === target || at.startsWith(`${target}.`);\n });\n for (const error of own)\n messages.push(`${positionName(index)}: ${error.message}`);\n });\n return messages;\n };\n const shownErrors = [errors, ...hiddenPositionErrors()]\n .filter(Boolean)\n .join('\\n');\n return {\n t,\n options,\n vertical,\n definition,\n values,\n editable,\n positionLabel,\n fieldSchema,\n fieldUiSchema,\n positionLayout,\n shownErrors,\n };\n};\n"],"mappings":"A,gVAoBA,IAAMiB,EAAiB,yCASVC,EAAuBlB,EAAAA,QAAM,cAExC,IAAA,EAAS,EAYEmB,EAAqD,CAChE,OAAS,GAAa,CACpB,IAAMC,EAAAC,GAAA,KAAA,IAAA,GAASA,EAA6B,MAC5C,OAAAA,GAAA,KAAA,IAAA,GAAOA,EAAU,QAAS,WACxB,OAAOD,GAAU,UACjBH,EAAe,KAAKG,CAAK,EACvB,KACA,EACN,EACA,UAnB6B,CAAE,cAA8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,WACA,aACA,SACA,WACA,gBACA,cACA,gBACA,iBACA,YAdkB,CAACE,EAAQ,QAhBgB,CAC3C,GAAI,CAACD,GAAkB,CAAClB,EAAY,MAAO,CAAC,EAC5C,IAAMoB,EAAQrC,EAAemC,CAAc,EACrCG,EAAqB,CAAC,EAW5B,OAVArB,EAAW,OAAO,SAAS,EAAG,IAAU,C,MACtC,GAAIoB,EAAM,IAAItC,CAAK,EAAG,OACtB,IAAMyC,EAAS,GAAG3B,EAAK,GAAGd,IACpB0C,KAAA,EAAO1B,EAAU,OAAA,KAAA,IAAA,GAAAwB,EAAM,SAAU,CAAC,EAAA,CAAG,OAAQ,GAAU,CAC3D,IAAMG,GAAA,EAAK1D,EAAAA,eAAAA,CAAe2D,CAAK,EAC/B,OAAOD,IAAOF,GAAUE,EAAG,WAAW,GAAGF,EAAO,EAAE,CACpD,CAAC,EACD,IAAK,IAAMG,KAASF,EAClBH,EAAS,KAAK,GAAGV,EAAa7B,CAAK,EAAE,IAAI4C,EAAM,SAAS,CAC5D,CAAC,EACML,CACT,EACgC,CAAqB,CAAC,CAAC,CACpD,OAAO,OAAO,CAAC,CACf,KAAK;CAYN,CACF,CACF,E"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type TupleSchema } from './tupleSchema';
|
|
3
|
+
import { type JsonFormsRendererRegistryEntry, type UISchemaElement, type StatePropsOfControlWithDetail } from '@jsonforms/core';
|
|
4
|
+
interface TuplePositionContextValue {
|
|
5
|
+
count: number;
|
|
6
|
+
render: (index: number) => React.ReactElement | null;
|
|
7
|
+
renderWithin: (index: number, scope: string) => React.ReactElement | null;
|
|
8
|
+
}
|
|
9
|
+
/** A module-level renderer keeps focused position controls mounted on re-render. */
|
|
10
|
+
export declare const TuplePositionContext: React.Context<TuplePositionContextValue | undefined>;
|
|
11
|
+
export declare const tuplePositionEntry: JsonFormsRendererRegistryEntry;
|
|
12
|
+
/** Resolve positional schemas and registry entries without any UI toolkit dependency. */
|
|
13
|
+
export declare const useTupleControl: (props: StatePropsOfControlWithDetail) => {
|
|
14
|
+
t: (key: import("..").I18nKey, values?: Record<string, unknown>) => string;
|
|
15
|
+
options: Record<string, any>;
|
|
16
|
+
vertical: boolean;
|
|
17
|
+
definition: import("./tupleSchema").TupleDefinition | undefined;
|
|
18
|
+
values: unknown[];
|
|
19
|
+
editable: boolean;
|
|
20
|
+
positionLabel: (index: number) => string;
|
|
21
|
+
fieldSchema: (index: number) => TupleSchema;
|
|
22
|
+
fieldUiSchema: (index: number) => UISchemaElement;
|
|
23
|
+
positionLayout: import("@jsonforms/core").BaseUISchemaElement | undefined;
|
|
24
|
+
shownErrors: string;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { useDynamicTreeResolver as e } from "../dynamic/DynamicUiProvider.esm.js";
|
|
2
|
+
import { useI18n as t } from "../locale/translate.esm.js";
|
|
3
|
+
import { isComplexTupleSchema as n, resolveTupleSchema as r, tupleDefinition as i, tupleRenderSchema as a } from "./tupleSchema.esm.js";
|
|
4
|
+
import o from "react";
|
|
5
|
+
import { findUISchema as s, getControlPath as c } from "@jsonforms/core";
|
|
6
|
+
import { useJsonForms as l } from "@jsonforms/react";
|
|
7
|
+
// src/tuple/useTupleControl.tsx
|
|
8
|
+
var u = /\/(?:items|prefixItems)\/(\d+)(\/.*)?$/, d = o.createContext(void 0), f = {
|
|
9
|
+
tester: (e) => {
|
|
10
|
+
let t = e == null ? void 0 : e.scope;
|
|
11
|
+
return (e == null ? void 0 : e.type) === "Control" && typeof t == "string" && u.test(t) ? 9999 : -1;
|
|
12
|
+
},
|
|
13
|
+
renderer: ({ uischema: e }) => {
|
|
14
|
+
let t = o.useContext(d), n = e == null ? void 0 : e.scope, r = typeof n == "string" ? u.exec(n) : null;
|
|
15
|
+
if (!t || !r) return null;
|
|
16
|
+
let i = Number(r[1]);
|
|
17
|
+
return i < 0 || i >= t.count ? null : r[2] ? t.renderWithin(i, `#${r[2]}`) : t.render(i);
|
|
18
|
+
}
|
|
19
|
+
}, p = (e, t = /* @__PURE__ */ new Set()) => {
|
|
20
|
+
if (!e || typeof e != "object") return t;
|
|
21
|
+
let n = e, r = typeof n.scope == "string" ? u.exec(n.scope) : null;
|
|
22
|
+
if (r && t.add(Number(r[1])), Array.isArray(n.elements)) for (let e of n.elements) p(e, t);
|
|
23
|
+
return t;
|
|
24
|
+
}, m = (e) => {
|
|
25
|
+
let t = e.detail;
|
|
26
|
+
return t && typeof t == "object" && typeof t.type == "string" ? t : void 0;
|
|
27
|
+
}, h = (o) => {
|
|
28
|
+
var u, d;
|
|
29
|
+
let { data: f, enabled: h, errors: g, path: _, rootSchema: v, schema: y, uischema: b, uischemas: x } = o, S = e(_), C = t(), w = l(), T = {
|
|
30
|
+
...o.config,
|
|
31
|
+
...b.options
|
|
32
|
+
}, E = (((u = b.options) == null ? void 0 : u.vertical) ?? ((d = o.config) == null || (d = d.jsonformsExtended) == null || (d = d.tuple) == null ? void 0 : d.vertical) ?? !1) === !0, D = i(y, T.variant === "tuple"), O = Array.isArray(f) ? f : [], k = h !== !1, A = (e) => C("tuple.position", { position: e + 1 }), j = (e) => {
|
|
33
|
+
if (!D) return !0;
|
|
34
|
+
let t = D.prefix[e], n = D.tail === !1 || D.tail;
|
|
35
|
+
return r(t ?? n, v);
|
|
36
|
+
}, M = (e) => a(j(e)).title ?? A(e), N = (e) => {
|
|
37
|
+
let t = a(j(e)), r = M(e);
|
|
38
|
+
if (!n(j(e))) return {
|
|
39
|
+
type: "Control",
|
|
40
|
+
scope: "#",
|
|
41
|
+
label: r
|
|
42
|
+
};
|
|
43
|
+
let i = s((x ?? []).filter((e) => typeof (e == null ? void 0 : e.tester) == "function"), t, "#", `${_}.${e}`, () => ({
|
|
44
|
+
type: "Control",
|
|
45
|
+
scope: "#",
|
|
46
|
+
label: r
|
|
47
|
+
}), {
|
|
48
|
+
type: "Control",
|
|
49
|
+
scope: "#"
|
|
50
|
+
}, v);
|
|
51
|
+
return {
|
|
52
|
+
...i,
|
|
53
|
+
label: i.label ?? r
|
|
54
|
+
};
|
|
55
|
+
}, P = m(T), F = P ? S(P) : void 0;
|
|
56
|
+
return {
|
|
57
|
+
t: C,
|
|
58
|
+
options: T,
|
|
59
|
+
vertical: E,
|
|
60
|
+
definition: D,
|
|
61
|
+
values: O,
|
|
62
|
+
editable: k,
|
|
63
|
+
positionLabel: A,
|
|
64
|
+
fieldSchema: j,
|
|
65
|
+
fieldUiSchema: N,
|
|
66
|
+
positionLayout: F,
|
|
67
|
+
shownErrors: [g, ...(() => {
|
|
68
|
+
if (!F || !D) return [];
|
|
69
|
+
let e = p(F), t = [];
|
|
70
|
+
return D.prefix.forEach((n, r) => {
|
|
71
|
+
var i;
|
|
72
|
+
if (e.has(r)) return;
|
|
73
|
+
let a = `${_}.${r}`, o = (((i = w.core) == null ? void 0 : i.errors) ?? []).filter((e) => {
|
|
74
|
+
let t = c(e);
|
|
75
|
+
return t === a || t.startsWith(`${a}.`);
|
|
76
|
+
});
|
|
77
|
+
for (let e of o) t.push(`${M(r)}: ${e.message}`);
|
|
78
|
+
}), t;
|
|
79
|
+
})()].filter(Boolean).join("\n")
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
export { d as TuplePositionContext, f as tuplePositionEntry, h as useTupleControl };
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=useTupleControl.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTupleControl.esm.js","names":["React","POSITION_SCOPE","TuplePositionContext","tuplePositionEntry","scope","uischema","ctx","match","index","namedPositions","element","found","node","child","positionLayoutOf","layout","options","useTupleControl","_uischema$options","_props$config","props","resolveTree","useDynamicTreeResolver","path","t","useI18n","jsonforms","useJsonForms","vertical","definition","tupleDefinition","schema","values","data","editable","enabled","positionLabel","fieldSchema","declared","fallback","resolveTupleSchema","rootSchema","positionName","tupleRenderSchema","fieldUiSchema","positionSchema","name","isComplexTupleSchema","findUISchema","uischemas","entry","authoredPositionLayout","positionLayout","errors","named","messages","_jsonforms$core","target","own","at","getControlPath","error"],"sources":["../../src/tuple/useTupleControl.tsx"],"sourcesContent":["import React from 'react';\nimport { useDynamicTreeResolver } from '../dynamic/DynamicUiProvider';\nimport { useI18n } from '../locale/translate';\nimport {\n isComplexTupleSchema,\n resolveTupleSchema,\n tupleDefinition,\n tupleRenderSchema,\n type TupleSchema,\n} from './tupleSchema';\nimport {\n type ControlElement,\n type JsonFormsRendererRegistryEntry,\n type UISchemaElement,\n type StatePropsOfControlWithDetail,\n findUISchema,\n getControlPath,\n} from '@jsonforms/core';\nimport { useJsonForms } from '@jsonforms/react';\n\nconst POSITION_SCOPE = /\\/(?:items|prefixItems)\\/(\\d+)(\\/.*)?$/;\n\ninterface TuplePositionContextValue {\n count: number;\n render: (index: number) => React.ReactElement | null;\n renderWithin: (index: number, scope: string) => React.ReactElement | null;\n}\n\n/** A module-level renderer keeps focused position controls mounted on re-render. */\nexport const TuplePositionContext = React.createContext<\n TuplePositionContextValue | undefined\n>(undefined);\n\nconst TuplePositionRenderer = ({ uischema }: { uischema: UISchemaElement }) => {\n const ctx = React.useContext(TuplePositionContext);\n const scope = (uischema as ControlElement)?.scope;\n const match = typeof scope === 'string' ? POSITION_SCOPE.exec(scope) : null;\n if (!ctx || !match) return null;\n const index = Number(match[1]);\n if (index < 0 || index >= ctx.count) return null;\n return match[2] ? ctx.renderWithin(index, `#${match[2]}`) : ctx.render(index);\n};\n\nexport const tuplePositionEntry: JsonFormsRendererRegistryEntry = {\n tester: (uischema) => {\n const scope = (uischema as ControlElement)?.scope;\n return uischema?.type === 'Control' &&\n typeof scope === 'string' &&\n POSITION_SCOPE.test(scope)\n ? 9999\n : -1;\n },\n renderer: TuplePositionRenderer as any,\n};\n\nconst namedPositions = (element: unknown, found = new Set<number>()) => {\n if (!element || typeof element !== 'object') return found;\n const node = element as UISchemaElement & {\n scope?: string;\n elements?: unknown[];\n };\n const match =\n typeof node.scope === 'string' ? POSITION_SCOPE.exec(node.scope) : null;\n if (match) found.add(Number(match[1]));\n if (Array.isArray(node.elements))\n for (const child of node.elements) namedPositions(child, found);\n return found;\n};\n\nconst positionLayoutOf = (\n options: Record<string, any>,\n): UISchemaElement | undefined => {\n const layout = options.detail;\n return layout &&\n typeof layout === 'object' &&\n typeof (layout as UISchemaElement).type === 'string'\n ? (layout as UISchemaElement)\n : undefined;\n};\n\n/** Resolve positional schemas and registry entries without any UI toolkit dependency. */\nexport const useTupleControl = (props: StatePropsOfControlWithDetail) => {\n const {\n data,\n enabled,\n errors,\n path,\n rootSchema,\n schema,\n uischema,\n uischemas,\n } = props;\n const resolveTree = useDynamicTreeResolver(path);\n const t = useI18n();\n const jsonforms = useJsonForms();\n const options = { ...props.config, ...uischema.options } as Record<\n string,\n any\n >;\n const vertical =\n (uischema.options?.vertical ??\n props.config?.jsonformsExtended?.tuple?.vertical ??\n false) === true;\n const definition = tupleDefinition(schema, options.variant === 'tuple');\n const values: unknown[] = Array.isArray(data) ? data : [];\n const editable = enabled !== false;\n const positionLabel = (index: number) =>\n t('tuple.position', { position: index + 1 });\n const fieldSchema = (index: number): TupleSchema => {\n if (!definition) return true;\n const declared = definition.prefix[index];\n const fallback = definition.tail === false ? true : definition.tail;\n return resolveTupleSchema(declared ?? fallback, rootSchema);\n };\n const positionName = (index: number) =>\n tupleRenderSchema(fieldSchema(index)).title ?? positionLabel(index);\n const fieldUiSchema = (index: number): UISchemaElement => {\n const positionSchema = tupleRenderSchema(fieldSchema(index));\n const name = positionName(index);\n if (!isComplexTupleSchema(fieldSchema(index)))\n return { type: 'Control', scope: '#', label: name } as ControlElement;\n const found = findUISchema(\n // A host registry can contain serialized entries without callable testers.\n (uischemas ?? []).filter((entry) => typeof entry?.tester === 'function'),\n positionSchema,\n '#',\n `${path}.${index}`,\n () => ({ type: 'Control', scope: '#', label: name }) as ControlElement,\n { type: 'Control', scope: '#' } as ControlElement,\n rootSchema,\n );\n return {\n ...found,\n label: (found as { label?: unknown }).label ?? name,\n } as UISchemaElement;\n };\n const authoredPositionLayout = positionLayoutOf(options);\n const positionLayout = authoredPositionLayout\n ? resolveTree(authoredPositionLayout)\n : undefined;\n const hiddenPositionErrors = (): string[] => {\n if (!positionLayout || !definition) return [];\n const named = namedPositions(positionLayout);\n const messages: string[] = [];\n definition.prefix.forEach((_, index) => {\n if (named.has(index)) return;\n const target = `${path}.${index}`;\n const own = (jsonforms.core?.errors ?? []).filter((error) => {\n const at = getControlPath(error);\n return at === target || at.startsWith(`${target}.`);\n });\n for (const error of own)\n messages.push(`${positionName(index)}: ${error.message}`);\n });\n return messages;\n };\n const shownErrors = [errors, ...hiddenPositionErrors()]\n .filter(Boolean)\n .join('\\n');\n return {\n t,\n options,\n vertical,\n definition,\n values,\n editable,\n positionLabel,\n fieldSchema,\n fieldUiSchema,\n positionLayout,\n shownErrors,\n };\n};\n"],"mappings":";;;;;;;AAoBA,IAAMC,IAAiB,0CASVC,IAAuBF,EAAM,cAExC,KAAA,CAAS,GAYEG,IAAqD;CAChE,SAAS,MAAa;EACpB,IAAMC,IAAAC,KAAA,OAAA,KAAA,IAASA,EAA6B;EAC5C,QAAAA,KAAA,OAAA,KAAA,IAAOA,EAAU,UAAS,aACxB,OAAOD,KAAU,YACjBH,EAAe,KAAKG,CAAK,IACvB,OACA;CACN;CACA,WAnB6B,EAAE,kBAA8C;EAC7E,IAAME,IAAMN,EAAM,WAAWE,CAAoB,GAC3CE,IAAAC,KAAA,OAAA,KAAA,IAASA,EAA6B,OACtCE,IAAQ,OAAOH,KAAU,WAAWH,EAAe,KAAKG,CAAK,IAAI;EACvE,IAAI,CAACE,KAAO,CAACC,GAAO,OAAO;EAC3B,IAAMC,IAAQ,OAAOD,EAAM,EAAE;EAE7B,OADIC,IAAQ,KAAKA,KAASF,EAAI,QAAc,OACrCC,EAAM,KAAKD,EAAI,aAAaE,GAAO,IAAID,EAAM,IAAI,IAAID,EAAI,OAAOE,CAAK;CAC9E;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F,EAAO,EAAE;IACpD,CAAC;IACD,KAAK,IAAMI,KAASH,GAClB,EAAS,KAAK,GAAGhB,EAAalC,CAAK,EAAE,IAAIqD,EAAM,SAAS;GAC5D,CAAC,GACMN;EACT,EACgC,CAAqB,CAAC,CAAC,CACpD,OAAO,OAAO,CAAC,CACf,KAAK,IAYN;CACF;AACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BocRIvOZ.js"),t=require("../core/detailUiSchema.cjs.js"),n=require("../locale/translate.cjs.js"),r=require("./tupleSchema.cjs.js");let i=require("react"),a=require("@jsonforms/core"),o=require("@jsonforms/react"),s=require("lodash/get");s=e.t(s);let c=require("lodash/cloneDeep");c=e.t(c);let l=require("lodash/set");l=e.t(l);let u=require("lodash/unset");u=e.t(u);var d=({schema:e,prefix:d,index:f,arrayPath:p,rootSchema:m,uischema:h,enabled:g})=>{var _,v,y;let b=n.useI18n(),x=n.useTranslator(),S=n.useI18nDefault(),C=(0,o.useJsonForms)(),[w,T]=(0,i.useState)(!1),[E,D]=(0,i.useState)(),O=a.Paths.compose(p,String(f)),k=p?(0,s.default)((_=C.core)==null?void 0:_.data,p.split(`.`)):(v=C.core)==null?void 0:v.data,A=(0,i.useMemo)(()=>Array.isArray(k)?k:[],[k]),j=A[f],M=r.tupleRenderSchema(e),N=r.isComplexTupleSchema(e),P=r.tupleFieldOwnsLabel(e),F=String(h.label??``),I=x((0,a.getI18nKey)(M,h,O,`label`),F)??F,L=C.dispatch,R=(0,i.useCallback)(t=>{var n;if(!((t==null?void 0:t.type)===a.UPDATE_DATA&&(t.path===O||(n=t.path)!=null&&n.startsWith(`${O}.`)))){L==null||L(t);return}if(!g)return;let i=[...(0,c.default)(A)],o=t.path===O?``:t.path.slice(O.length+1),h=t.updater((0,c.default)(o?(0,s.default)(i[f],o.split(`.`)):i[f]));if(!o&&h===void 0&&(h=r.tupleEmptyValue(e,m),h===void 0))D(b(`tuple.valueRequired`));else{for(let e=i.length;e<f;e+=1){let t=r.tupleInitialValue(d[e]??!0,m);if(t===void 0){D(b(`tuple.missingPosition`,{position:e+1}));return}i.push(t)}if(o){i[f]===void 0&&(i[f]=r.tupleInitialValue(e,m)??(/^\d+(\.|$)/.test(o)?[]:{}));let t=o.split(`.`);h===void 0?(0,u.default)(i[f],t):(0,l.default)(i[f],t,h)}else i[f]=h;D(void 0),L==null||L((0,a.update)(p,()=>i))}},[p,A,g,f,L,O,d,m,e,b]);return{t:b,translator:x,i18nDefault:S,open:w,setOpen:T,message:E,path:O,value:j,renderSchema:M,complex:N,ownsLabel:P,label:I,intercept:R,scoped:(0,i.useMemo)(()=>({...C,dispatch:R}),[C,R]),detail:t.resolveEditorDetail((y=h.options)==null?void 0:y.detail,C.uischemas??[],M,`#`,O,m,{...h,options:{...h.options,detail:void 0}})}};exports.useTupleField=d;
|
|
2
|
+
//# sourceMappingURL=useTupleField.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTupleField.cjs.js","names":["useI18n","useTranslator","useI18nDefault","useJsonForms","useState","Paths","get","useMemo","tupleRenderSchema","isComplexTupleSchema","tupleFieldOwnsLabel","getI18nKey","useCallback","UPDATE_DATA","cloneDeep","tupleEmptyValue","tupleInitialValue","update","resolveEditorDetail","require_rolldown_runtime","require_core_detailUiSchema","require_locale_translate","require_tuple_tupleSchema","react","_jsonforms_core","_jsonforms_react","lodash_get","lodash_cloneDeep","lodash_set","lodash_unset","useTupleField","_context$core","_context$core2","_uischema$options","t","translator","i18nDefault","context","open","setOpen","message","setMessage","path","arrayPath","index","array","data","value","renderSchema","schema","complex","ownsLabel","fallbackLabel","uischema","label","parentDispatch","intercept","_action$path","action","enabled","source","relative","next","rootSchema","position","initial","prefix","segments"],"sources":["../../src/tuple/useTupleField.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react';\nimport {\n Paths,\n UPDATE_DATA,\n getI18nKey,\n update,\n type JsonSchema,\n type UISchemaElement,\n} from '@jsonforms/core';\nimport { useJsonForms } from '@jsonforms/react';\nimport cloneDeep from 'lodash/cloneDeep';\nimport get from 'lodash/get';\nimport set from 'lodash/set';\nimport unset from 'lodash/unset';\nimport { resolveEditorDetail } from '../core/detailUiSchema';\nimport { useI18n, useI18nDefault, useTranslator } from '../locale/translate';\nimport {\n isComplexTupleSchema,\n tupleEmptyValue,\n tupleFieldOwnsLabel,\n tupleInitialValue,\n tupleRenderSchema,\n type TupleSchema,\n} from './tupleSchema';\n\nexport interface TupleFieldBehaviorProps {\n schema: TupleSchema;\n prefix: TupleSchema[];\n index: number;\n arrayPath: string;\n rootSchema: JsonSchema;\n uischema: UISchemaElement;\n enabled: boolean;\n}\n\n/** Intercepts positional writes so missing tuple positions never become sparse array holes. */\nexport const useTupleField = ({\n schema,\n prefix,\n index,\n arrayPath,\n rootSchema,\n uischema,\n enabled,\n}: TupleFieldBehaviorProps) => {\n const t = useI18n();\n const translator = useTranslator();\n const i18nDefault = useI18nDefault();\n const context = useJsonForms();\n const [open, setOpen] = useState(false);\n const [message, setMessage] = useState<string | undefined>();\n const path = Paths.compose(arrayPath, String(index));\n const array = arrayPath\n ? get(context.core?.data, arrayPath.split('.'))\n : context.core?.data;\n const data: unknown[] = useMemo(\n () => (Array.isArray(array) ? array : []),\n [array],\n );\n const value = data[index];\n const renderSchema = tupleRenderSchema(schema);\n const complex = isComplexTupleSchema(schema);\n const ownsLabel = tupleFieldOwnsLabel(schema);\n const fallbackLabel = String((uischema as { label?: unknown }).label ?? '');\n const label =\n translator(\n getI18nKey(renderSchema, uischema, path, 'label'),\n fallbackLabel,\n ) ?? fallbackLabel;\n const parentDispatch = context.dispatch;\n\n /* eslint-disable react/preserve-manual-memoization -- The updater only mutates a deep-cloned tuple; lodash cloneDeep aliasing is opaque to the compiler. */\n const intercept = useCallback(\n (action: any) => {\n const inside =\n action?.type === UPDATE_DATA &&\n (action.path === path || action.path?.startsWith(`${path}.`));\n if (!inside) {\n parentDispatch?.(action);\n return;\n }\n if (!enabled) return;\n const source = [...cloneDeep(data)];\n const relative =\n action.path === path ? '' : action.path.slice(path.length + 1);\n let next = action.updater(\n cloneDeep(\n relative ? get(source[index], relative.split('.')) : source[index],\n ),\n );\n if (!relative && next === undefined) {\n next = tupleEmptyValue(schema, rootSchema);\n if (next === undefined) {\n setMessage(t('tuple.valueRequired'));\n return;\n }\n }\n for (let position = source.length; position < index; position += 1) {\n const initial = tupleInitialValue(prefix[position] ?? true, rootSchema);\n if (initial === undefined) {\n setMessage(t('tuple.missingPosition', { position: position + 1 }));\n return;\n }\n source.push(initial);\n }\n if (relative) {\n if (source[index] === undefined) {\n source[index] =\n tupleInitialValue(schema, rootSchema) ??\n (/^\\d+(\\.|$)/.test(relative) ? [] : {});\n }\n const segments = relative.split('.');\n if (next === undefined) unset(source[index], segments);\n else set(source[index] as object, segments, next);\n } else source[index] = next;\n setMessage(undefined);\n parentDispatch?.(update(arrayPath, () => source));\n },\n [\n arrayPath,\n data,\n enabled,\n index,\n parentDispatch,\n path,\n prefix,\n rootSchema,\n schema,\n t,\n ],\n );\n /* eslint-enable react/preserve-manual-memoization */\n\n const scoped = useMemo(\n () => ({ ...context, dispatch: intercept }),\n [context, intercept],\n );\n const detail = resolveEditorDetail(\n uischema.options?.detail,\n context.uischemas ?? [],\n renderSchema,\n '#',\n path,\n rootSchema,\n { ...uischema, options: { ...uischema.options, detail: undefined } },\n );\n return {\n t,\n translator,\n i18nDefault,\n open,\n setOpen,\n message,\n path,\n value,\n renderSchema,\n complex,\n ownsLabel,\n label,\n intercept,\n scoped,\n detail,\n };\n};\n"],"mappings":"A,qdAoCA,IAAa8B,GAAiB,CAC5B,SACA,SACA,QACA,YACA,aACA,WACA,aAC6B,C,UAC7B,IAAMI,EAAIlC,EAAAA,QAAQ,EACZmC,EAAalC,EAAAA,cAAc,EAC3BmC,EAAclC,EAAAA,eAAe,EAC7BmC,GAAA,EAAUlC,EAAAA,aAAAA,CAA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AG8B,EAAS,SAAUmB,CAAU,GACzC,CAACnB,EAASmB,CAAS,CAyBnB,EACA,OAxBatC,EAAAA,qBAAAA,EACbmC,EAAS,UAAA,KAAA,IAAA,GAAApB,EAAS,OAClBI,EAAQ,WAAa,CAAC,EACtBW,EACA,IACAN,EACAqB,EACA,CAAE,GAAGV,EAAU,QAAS,CAAE,GAAGA,EAAS,QAAS,OAAQ,IAAA,EAAU,CAAE,CAiBnE,CACF,CACF,E"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type JsonSchema, type UISchemaElement } from '@jsonforms/core';
|
|
2
|
+
import { type TupleSchema } from './tupleSchema';
|
|
3
|
+
export interface TupleFieldBehaviorProps {
|
|
4
|
+
schema: TupleSchema;
|
|
5
|
+
prefix: TupleSchema[];
|
|
6
|
+
index: number;
|
|
7
|
+
arrayPath: string;
|
|
8
|
+
rootSchema: JsonSchema;
|
|
9
|
+
uischema: UISchemaElement;
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** Intercepts positional writes so missing tuple positions never become sparse array holes. */
|
|
13
|
+
export declare const useTupleField: ({ schema, prefix, index, arrayPath, rootSchema, uischema, enabled, }: TupleFieldBehaviorProps) => {
|
|
14
|
+
t: (key: import("..").I18nKey, values?: Record<string, unknown>) => string;
|
|
15
|
+
translator: import("@jsonforms/core").Translator;
|
|
16
|
+
i18nDefault: (key: import("..").I18nKey) => string;
|
|
17
|
+
open: boolean;
|
|
18
|
+
setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
19
|
+
message: string | undefined;
|
|
20
|
+
path: string;
|
|
21
|
+
value: unknown;
|
|
22
|
+
renderSchema: JsonSchema;
|
|
23
|
+
complex: boolean;
|
|
24
|
+
ownsLabel: boolean;
|
|
25
|
+
label: string;
|
|
26
|
+
intercept: (action: any) => void;
|
|
27
|
+
scoped: {
|
|
28
|
+
dispatch: (action: any) => void;
|
|
29
|
+
core?: import("@jsonforms/core").JsonFormsCore;
|
|
30
|
+
config?: any;
|
|
31
|
+
renderers?: import("@jsonforms/core").JsonFormsRendererRegistryEntry[];
|
|
32
|
+
cells?: import("@jsonforms/core").JsonFormsCellRendererRegistryEntry[];
|
|
33
|
+
i18n?: import("@jsonforms/core").JsonFormsI18nState;
|
|
34
|
+
uischemas?: import("@jsonforms/core").JsonFormsUISchemaRegistryEntry[];
|
|
35
|
+
readonly?: boolean;
|
|
36
|
+
};
|
|
37
|
+
detail: UISchemaElement;
|
|
38
|
+
};
|