@chobantonov/jsonforms-react-antd-renderers 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 +103 -2
- package/lib/additional/LabelRenderer.d.ts +13 -0
- package/lib/additional/ListWithDetailMasterItem.d.ts +9 -0
- package/lib/additional/ListWithDetailRenderer.d.ts +8 -0
- package/lib/additional/index.d.ts +4 -0
- package/lib/additional/unwrapped.d.ts +6 -0
- package/lib/antd-controls/AntdCheckbox.d.ts +10 -0
- package/lib/antd-controls/AntdClearValueButton.d.ts +44 -0
- package/lib/antd-controls/AntdClearableInput.d.ts +19 -0
- package/lib/antd-controls/AntdDatePicker.d.ts +7 -0
- package/lib/antd-controls/AntdDateTimePicker.d.ts +7 -0
- package/lib/antd-controls/AntdFile.d.ts +7 -0
- package/lib/antd-controls/AntdInputInteger.d.ts +3 -0
- package/lib/antd-controls/AntdInputNumber.d.ts +3 -0
- package/lib/antd-controls/AntdInputNumberFormat.d.ts +6 -0
- package/lib/antd-controls/AntdInputText.d.ts +6 -0
- package/lib/antd-controls/AntdNumericInput.d.ts +9 -0
- package/lib/antd-controls/AntdOtp.d.ts +33 -0
- package/lib/antd-controls/AntdPassword.d.ts +6 -0
- package/lib/antd-controls/AntdRadioGroup.d.ts +6 -0
- package/lib/antd-controls/AntdRevealButton.d.ts +32 -0
- package/lib/antd-controls/AntdSelect.d.ts +7 -0
- package/lib/antd-controls/AntdSlider.d.ts +21 -0
- package/lib/antd-controls/AntdTimePicker.d.ts +6 -0
- package/lib/antd-controls/AntdToggle.d.ts +6 -0
- package/lib/antd-controls/FileFeedback.d.ts +6 -0
- package/lib/antd-controls/index.d.ts +18 -0
- package/lib/antd-controls/useTemporalPicker.d.ts +49 -0
- package/lib/cells/AntdCompositeCell.d.ts +8 -0
- package/lib/cells/BooleanCell.d.ts +6 -0
- package/lib/cells/BooleanToggleCell.d.ts +5 -0
- package/lib/cells/CompositeDetailDialog.d.ts +15 -0
- package/lib/cells/CustomizableCells.d.ts +9 -0
- package/lib/cells/DateCell.d.ts +6 -0
- package/lib/cells/EnumCell.d.ts +11 -0
- package/lib/cells/IntegerCell.d.ts +6 -0
- package/lib/cells/NumberCell.d.ts +10 -0
- package/lib/cells/NumberFormatCell.d.ts +10 -0
- package/lib/cells/OneOfEnumCell.d.ts +11 -0
- package/lib/cells/PasswordCell.d.ts +5 -0
- package/lib/cells/TextCell.d.ts +10 -0
- package/lib/cells/TimeCell.d.ts +6 -0
- package/lib/cells/index.d.ts +14 -0
- package/lib/complex/AdditionalProperties.d.ts +4 -0
- package/lib/complex/AnyOfRenderer.d.ts +31 -0
- package/lib/complex/ArrayControlRenderer.d.ts +8 -0
- package/lib/complex/ChipsControl.d.ts +22 -0
- package/lib/complex/CollectionPager.d.ts +5 -0
- package/lib/complex/DataCell.d.ts +16 -0
- package/lib/complex/DeleteDialog.d.ts +14 -0
- package/lib/complex/DetailModal.d.ts +6 -0
- package/lib/complex/EnumArrayRenderer.d.ts +6 -0
- package/lib/complex/ErrorFeedback.d.ts +6 -0
- package/lib/complex/MixedRenderer.d.ts +6 -0
- package/lib/complex/MultiSelectControl.d.ts +17 -0
- package/lib/complex/ObjectRenderer.d.ts +5 -0
- package/lib/complex/OneOfRenderer.d.ts +6 -0
- package/lib/complex/OneOfTabRenderer.d.ts +5 -0
- package/lib/complex/RecursiveTreeRenderer.d.ts +4 -0
- package/lib/complex/RowDetailFrame.d.ts +10 -0
- package/lib/complex/ScalarCompositionRenderer.d.ts +4 -0
- package/lib/complex/TabSwitchConfirmDialog.d.ts +9 -0
- package/lib/complex/TableControl.d.ts +9 -0
- package/lib/complex/TableToolbar.d.ts +21 -0
- package/lib/complex/TupleAdditionalItems.d.ts +13 -0
- package/lib/complex/TupleControlRenderer.d.ts +6 -0
- package/lib/complex/TupleField.d.ts +4 -0
- package/lib/complex/ValidationIcon.d.ts +8 -0
- package/lib/complex/additionalProperties/AntdAdditionalPropertyActions.d.ts +9 -0
- package/lib/complex/additionalProperties/AntdAdditionalPropertyRenameDialog.d.ts +11 -0
- package/lib/complex/index.d.ts +20 -0
- package/lib/complex/mixed/AntdJsonTypeIcon.d.ts +4 -0
- package/lib/complex/mixed/AntdMixedNavigationContext.d.ts +5 -0
- package/lib/complex/mixed/AntdMixedSplitPane.d.ts +5 -0
- package/lib/complex/mixed/AntdMixedTree.d.ts +15 -0
- package/lib/complex/mixed/AntdMixedTypeSelector.d.ts +12 -0
- package/lib/complex/mixed/AntdNestedMixedNavigation.d.ts +7 -0
- package/lib/complex/mixed/mixedTree.d.ts +2 -0
- package/lib/complex/unwrapped.d.ts +10 -0
- package/lib/controls/AnyOfStringOrEnumControl.d.ts +9 -0
- package/lib/controls/BooleanControl.d.ts +6 -0
- package/lib/controls/BooleanToggleControl.d.ts +6 -0
- package/lib/controls/ChoiceCards.d.ts +1 -0
- package/lib/controls/DateControl.d.ts +6 -0
- package/lib/controls/DateTimeControl.d.ts +6 -0
- package/lib/controls/EnumControl.d.ts +7 -0
- package/lib/controls/FileControl.d.ts +7 -0
- package/lib/controls/InputControl.d.ts +6 -0
- package/lib/controls/IntegerControl.d.ts +6 -0
- package/lib/controls/NativeControl.d.ts +6 -0
- package/lib/controls/NumberControl.d.ts +6 -0
- package/lib/controls/OneOfEnumControl.d.ts +7 -0
- package/lib/controls/OneOfRadioGroupControl.d.ts +6 -0
- package/lib/controls/PasswordControl.d.ts +18 -0
- package/lib/controls/PasswordOtpControl.d.ts +38 -0
- package/lib/controls/RadioGroup.d.ts +3 -0
- package/lib/controls/RadioGroupControl.d.ts +6 -0
- package/lib/controls/SliderControl.d.ts +6 -0
- package/lib/controls/TextControl.d.ts +6 -0
- package/lib/controls/TimeControl.d.ts +6 -0
- package/lib/controls/index.d.ts +20 -0
- package/lib/controls/unwrapped.d.ts +19 -0
- package/lib/index.d.ts +50 -0
- package/lib/jsonforms-react-antd.cjs.js +39 -0
- package/lib/jsonforms-react-antd.cjs.js.map +1 -0
- package/lib/jsonforms-react-antd.esm.js +4235 -0
- package/lib/jsonforms-react-antd.esm.js.map +1 -0
- package/lib/layouts/ArrayLayout.d.ts +5 -0
- package/lib/layouts/ArrayLayoutRenderer.d.ts +8 -0
- package/lib/layouts/ArrayPanel.d.ts +7 -0
- package/lib/layouts/ArrayToolbar.d.ts +17 -0
- package/lib/layouts/CategorizationAccordionLayout.d.ts +21 -0
- package/lib/layouts/CategorizationLayout.d.ts +14 -0
- package/lib/layouts/CategorizationStepperLayout.d.ts +10 -0
- package/lib/layouts/CategoryHeader.d.ts +39 -0
- package/lib/layouts/ContainerIndicator.d.ts +37 -0
- package/lib/layouts/GroupLayout.d.ts +6 -0
- package/lib/layouts/HorizontalLayout.d.ts +10 -0
- package/lib/layouts/ValidationIndicator.d.ts +13 -0
- package/lib/layouts/VerticalLayout.d.ts +10 -0
- package/lib/layouts/arrayTitle.d.ts +2 -0
- package/lib/layouts/index.d.ts +11 -0
- package/lib/layouts/unwrapped.d.ts +11 -0
- package/lib/locale/index.d.ts +1 -0
- package/lib/util/additionalPropertyName.d.ts +2 -0
- package/lib/util/arrayChoices.d.ts +2 -0
- package/lib/util/categoryState.d.ts +3 -0
- package/lib/util/cellFrame.d.ts +27 -0
- package/lib/util/cellMode.d.ts +29 -0
- package/lib/util/clearAffordance.d.ts +1 -0
- package/lib/util/combinators.d.ts +1 -0
- package/lib/util/compositeActions.d.ts +1 -0
- package/lib/util/compositeSummary.d.ts +1 -0
- package/lib/util/configNamespaces.d.ts +1 -0
- package/lib/util/confirmation.d.ts +2 -0
- package/lib/util/datejs.d.ts +4 -0
- package/lib/util/debounce.d.ts +1 -0
- package/lib/util/dynamicProperties.d.ts +1 -0
- package/lib/util/focus.d.ts +1 -0
- package/lib/util/groupState.d.ts +1 -0
- package/lib/util/index.d.ts +25 -0
- package/lib/util/layout.d.ts +18 -0
- package/lib/util/layoutSizing.d.ts +6 -0
- package/lib/util/literalPropertySchema.d.ts +1 -0
- package/lib/util/locale.d.ts +68 -0
- package/lib/util/numeric.d.ts +1 -0
- package/lib/util/pendingChanges.d.ts +2 -0
- package/lib/util/preTouchErrors.d.ts +2 -0
- package/lib/util/rendererLocale.d.ts +2 -0
- package/lib/util/temporalBounds.d.ts +35 -0
- package/lib/util/temporalFormats.d.ts +26 -0
- package/lib/util/theme.d.ts +9 -0
- package/lib/util/translate.d.ts +1 -0
- package/lib/util/tuple.d.ts +2 -0
- package/lib/util/useConfirmation.d.ts +7 -0
- package/lib/util/validationIndicator.d.ts +2 -0
- package/lib/util/visuallyHidden.d.ts +1 -0
- package/package.json +89 -3
- package/src/additional/LabelRenderer.tsx +21 -0
- package/src/additional/ListWithDetailMasterItem.tsx +124 -0
- package/src/additional/ListWithDetailRenderer.tsx +243 -0
- package/src/additional/index.ts +14 -0
- package/src/additional/unwrapped.ts +8 -0
- package/src/antd-controls/AntdCheckbox.tsx +56 -0
- package/src/antd-controls/AntdClearValueButton.tsx +96 -0
- package/src/antd-controls/AntdClearableInput.tsx +63 -0
- package/src/antd-controls/AntdDatePicker.tsx +26 -0
- package/src/antd-controls/AntdDateTimePicker.tsx +31 -0
- package/src/antd-controls/AntdFile.tsx +395 -0
- package/src/antd-controls/AntdInputInteger.tsx +10 -0
- package/src/antd-controls/AntdInputNumber.tsx +10 -0
- package/src/antd-controls/AntdInputNumberFormat.tsx +63 -0
- package/src/antd-controls/AntdInputText.tsx +124 -0
- package/src/antd-controls/AntdNumericInput.tsx +83 -0
- package/src/antd-controls/AntdOtp.tsx +132 -0
- package/src/antd-controls/AntdPassword.tsx +106 -0
- package/src/antd-controls/AntdRadioGroup.tsx +60 -0
- package/src/antd-controls/AntdRevealButton.tsx +74 -0
- package/src/antd-controls/AntdSelect.tsx +113 -0
- package/src/antd-controls/AntdSlider.tsx +114 -0
- package/src/antd-controls/AntdTimePicker.tsx +25 -0
- package/src/antd-controls/AntdToggle.tsx +70 -0
- package/src/antd-controls/FileFeedback.tsx +37 -0
- package/src/antd-controls/index.ts +18 -0
- package/src/antd-controls/useTemporalPicker.ts +130 -0
- package/src/cells/AntdCompositeCell.tsx +228 -0
- package/src/cells/BooleanCell.tsx +33 -0
- package/src/cells/BooleanToggleCell.tsx +38 -0
- package/src/cells/CompositeDetailDialog.tsx +100 -0
- package/src/cells/CustomizableCells.ts +9 -0
- package/src/cells/DateCell.tsx +17 -0
- package/src/cells/EnumCell.tsx +30 -0
- package/src/cells/IntegerCell.tsx +17 -0
- package/src/cells/NumberCell.tsx +20 -0
- package/src/cells/NumberFormatCell.tsx +37 -0
- package/src/cells/OneOfEnumCell.tsx +32 -0
- package/src/cells/PasswordCell.tsx +22 -0
- package/src/cells/TextCell.tsx +22 -0
- package/src/cells/TimeCell.tsx +17 -0
- package/src/cells/index.ts +40 -0
- package/src/complex/AdditionalProperties.tsx +422 -0
- package/src/complex/AnyOfRenderer.tsx +158 -0
- package/src/complex/ArrayControlRenderer.tsx +121 -0
- package/src/complex/ChipsControl.tsx +205 -0
- package/src/complex/CollectionPager.tsx +26 -0
- package/src/complex/DataCell.tsx +82 -0
- package/src/complex/DeleteDialog.tsx +44 -0
- package/src/complex/DetailModal.tsx +110 -0
- package/src/complex/EnumArrayRenderer.tsx +148 -0
- package/src/complex/ErrorFeedback.tsx +51 -0
- package/src/complex/MixedRenderer.tsx +325 -0
- package/src/complex/MultiSelectControl.tsx +205 -0
- package/src/complex/ObjectRenderer.tsx +55 -0
- package/src/complex/OneOfRenderer.tsx +299 -0
- package/src/complex/OneOfTabRenderer.tsx +123 -0
- package/src/complex/RecursiveTreeRenderer.tsx +20 -0
- package/src/complex/RowDetailFrame.tsx +99 -0
- package/src/complex/ScalarCompositionRenderer.tsx +14 -0
- package/src/complex/TabSwitchConfirmDialog.tsx +36 -0
- package/src/complex/TableControl.tsx +646 -0
- package/src/complex/TableToolbar.tsx +80 -0
- package/src/complex/TupleAdditionalItems.tsx +100 -0
- package/src/complex/TupleControlRenderer.tsx +78 -0
- package/src/complex/TupleField.tsx +44 -0
- package/src/complex/ValidationIcon.tsx +30 -0
- package/src/complex/additionalProperties/AntdAdditionalPropertyActions.tsx +56 -0
- package/src/complex/additionalProperties/AntdAdditionalPropertyRenameDialog.tsx +56 -0
- package/src/complex/index.ts +48 -0
- package/src/complex/mixed/AntdJsonTypeIcon.tsx +40 -0
- package/src/complex/mixed/AntdMixedNavigationContext.ts +8 -0
- package/src/complex/mixed/AntdMixedSplitPane.tsx +51 -0
- package/src/complex/mixed/AntdMixedTree.tsx +287 -0
- package/src/complex/mixed/AntdMixedTypeSelector.tsx +60 -0
- package/src/complex/mixed/AntdNestedMixedNavigation.tsx +39 -0
- package/src/complex/mixed/mixedTree.ts +9 -0
- package/src/complex/unwrapped.ts +15 -0
- package/src/controls/AnyOfStringOrEnumControl.tsx +123 -0
- package/src/controls/BooleanControl.tsx +17 -0
- package/src/controls/BooleanToggleControl.tsx +24 -0
- package/src/controls/ChoiceCards.tsx +13 -0
- package/src/controls/DateControl.tsx +19 -0
- package/src/controls/DateTimeControl.tsx +22 -0
- package/src/controls/EnumControl.tsx +29 -0
- package/src/controls/FileControl.tsx +44 -0
- package/src/controls/InputControl.tsx +94 -0
- package/src/controls/IntegerControl.tsx +16 -0
- package/src/controls/NativeControl.tsx +79 -0
- package/src/controls/NumberControl.tsx +18 -0
- package/src/controls/OneOfEnumControl.tsx +32 -0
- package/src/controls/OneOfRadioGroupControl.tsx +25 -0
- package/src/controls/PasswordControl.tsx +43 -0
- package/src/controls/PasswordOtpControl.tsx +61 -0
- package/src/controls/RadioGroup.tsx +8 -0
- package/src/controls/RadioGroupControl.tsx +21 -0
- package/src/controls/SliderControl.tsx +19 -0
- package/src/controls/TextControl.tsx +17 -0
- package/src/controls/TimeControl.tsx +20 -0
- package/src/controls/index.ts +69 -0
- package/src/controls/unwrapped.ts +35 -0
- package/src/index.ts +267 -0
- package/src/layouts/ArrayLayout.tsx +435 -0
- package/src/layouts/ArrayLayoutRenderer.tsx +54 -0
- package/src/layouts/ArrayPanel.tsx +51 -0
- package/src/layouts/ArrayToolbar.tsx +67 -0
- package/src/layouts/CategorizationAccordionLayout.tsx +217 -0
- package/src/layouts/CategorizationLayout.tsx +149 -0
- package/src/layouts/CategorizationStepperLayout.tsx +164 -0
- package/src/layouts/CategoryHeader.tsx +107 -0
- package/src/layouts/ContainerIndicator.tsx +83 -0
- package/src/layouts/GroupLayout.tsx +307 -0
- package/src/layouts/HorizontalLayout.tsx +50 -0
- package/src/layouts/ValidationIndicator.tsx +43 -0
- package/src/layouts/VerticalLayout.tsx +50 -0
- package/src/layouts/arrayTitle.tsx +30 -0
- package/src/layouts/index.ts +35 -0
- package/src/layouts/unwrapped.ts +17 -0
- package/src/locale/index.ts +1 -0
- package/src/util/additionalPropertyName.ts +11 -0
- package/src/util/arrayChoices.ts +21 -0
- package/src/util/categoryState.ts +17 -0
- package/src/util/cellFrame.tsx +52 -0
- package/src/util/cellMode.tsx +145 -0
- package/src/util/clearAffordance.ts +2 -0
- package/src/util/combinators.ts +6 -0
- package/src/util/compositeActions.ts +2 -0
- package/src/util/compositeSummary.ts +2 -0
- package/src/util/configNamespaces.ts +4 -0
- package/src/util/confirmation.ts +15 -0
- package/src/util/datejs.tsx +42 -0
- package/src/util/debounce.ts +2 -0
- package/src/util/dynamicProperties.ts +6 -0
- package/src/util/focus.ts +2 -0
- package/src/util/groupState.ts +8 -0
- package/src/util/index.ts +25 -0
- package/src/util/layout.tsx +121 -0
- package/src/util/layoutSizing.ts +33 -0
- package/src/util/literalPropertySchema.ts +2 -0
- package/src/util/locale.ts +222 -0
- package/src/util/numeric.ts +2 -0
- package/src/util/pendingChanges.tsx +6 -0
- package/src/util/preTouchErrors.ts +10 -0
- package/src/util/rendererLocale.ts +10 -0
- package/src/util/temporalBounds.ts +106 -0
- package/src/util/temporalFormats.ts +95 -0
- package/src/util/theme.ts +9 -0
- package/src/util/translate.ts +6 -0
- package/src/util/tuple.ts +16 -0
- package/src/util/uiSchemaCycle.tsx +2 -0
- package/src/util/useConfirmation.tsx +25 -0
- package/src/util/validationIndicator.ts +10 -0
- package/src/util/visuallyHidden.ts +2 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useCompositeDraft,
|
|
3
|
+
type CompositeDetailDialogProps,
|
|
4
|
+
} from '@chobantonov/jsonforms-react-renderer-common/cells/useCompositeDraft';
|
|
5
|
+
export type { CompositeDetailDialogOptions } from '@chobantonov/jsonforms-react-renderer-common/cells/useCompositeDraft';
|
|
6
|
+
import { DetailModal } from '../complex/DetailModal';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { Button, Tooltip } from 'antd';
|
|
9
|
+
import { JsonFormsContext } from '@jsonforms/react';
|
|
10
|
+
import { CellModeProvider } from '../util/cellMode';
|
|
11
|
+
import { PendingChangesProvider } from '../util/pendingChanges';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A detail dialog that edits an isolated copy of the form state, so nothing
|
|
15
|
+
* reaches the form until Apply. Ported from the Svelte renderers'
|
|
16
|
+
* `useDetailDialog`.
|
|
17
|
+
*
|
|
18
|
+
* The whole core is cloned rather than just the value at `path`, so `$ref`s
|
|
19
|
+
* into the root schema and rules that read other parts of the data still
|
|
20
|
+
* resolve while the dialog is open. Only writes are redirected: dispatch is
|
|
21
|
+
* replaced with one that accepts UPDATE_DATA inside `path` and drops
|
|
22
|
+
* everything else.
|
|
23
|
+
*/
|
|
24
|
+
export const CompositeDetailDialog = (props: CompositeDetailDialogProps) => {
|
|
25
|
+
const { open, title, label, options, t, children } = props;
|
|
26
|
+
const dialog = useCompositeDraft(props);
|
|
27
|
+
|
|
28
|
+
const footer = (
|
|
29
|
+
<div style={{ display: 'flex', gap: 8, justifyContent: 'flex-end' }}>
|
|
30
|
+
{options.showEmptyButton === true && (
|
|
31
|
+
<Tooltip
|
|
32
|
+
title={t(
|
|
33
|
+
'composite.emptyTooltip',
|
|
34
|
+
dialog.defaultMessage('composite.emptyTooltip'),
|
|
35
|
+
)}
|
|
36
|
+
>
|
|
37
|
+
<span>
|
|
38
|
+
<Button disabled={!dialog.canEmpty} onClick={dialog.clear}>
|
|
39
|
+
{dialog.buttonLabel(options.emptyLabel, 'composite.empty')}
|
|
40
|
+
</Button>
|
|
41
|
+
</span>
|
|
42
|
+
</Tooltip>
|
|
43
|
+
)}
|
|
44
|
+
<Tooltip
|
|
45
|
+
title={t(
|
|
46
|
+
'composite.cancelTooltip',
|
|
47
|
+
dialog.defaultMessage('composite.cancelTooltip'),
|
|
48
|
+
)}
|
|
49
|
+
>
|
|
50
|
+
<Button onClick={dialog.cancel}>
|
|
51
|
+
{dialog.buttonLabel(options.cancelLabel, 'composite.cancel')}
|
|
52
|
+
</Button>
|
|
53
|
+
</Tooltip>
|
|
54
|
+
<Tooltip
|
|
55
|
+
title={
|
|
56
|
+
dialog.conflicted
|
|
57
|
+
? t(
|
|
58
|
+
'composite.applyConflict',
|
|
59
|
+
dialog.defaultMessage('composite.applyConflict'),
|
|
60
|
+
)
|
|
61
|
+
: t(
|
|
62
|
+
'composite.applyTooltip',
|
|
63
|
+
dialog.defaultMessage('composite.applyTooltip'),
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
>
|
|
67
|
+
<span>
|
|
68
|
+
<Button
|
|
69
|
+
type='primary'
|
|
70
|
+
disabled={!dialog.canApply}
|
|
71
|
+
onClick={dialog.apply}
|
|
72
|
+
>
|
|
73
|
+
{dialog.buttonLabel(options.okLabel, 'composite.apply')}
|
|
74
|
+
</Button>
|
|
75
|
+
</span>
|
|
76
|
+
</Tooltip>
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<DetailModal
|
|
82
|
+
options={options.dialog}
|
|
83
|
+
open={open}
|
|
84
|
+
title={title}
|
|
85
|
+
onCancel={dialog.cancel}
|
|
86
|
+
footer={footer}
|
|
87
|
+
destroyOnHidden
|
|
88
|
+
width={640}
|
|
89
|
+
aria-label={label}
|
|
90
|
+
>
|
|
91
|
+
<JsonFormsContext.Provider value={dialog.context as any}>
|
|
92
|
+
<PendingChangesProvider changes={dialog.pending}>
|
|
93
|
+
{/* the dialog is a normal form: labels, descriptions and inline
|
|
94
|
+
messages all come back */}
|
|
95
|
+
<CellModeProvider value={false}>{children}</CellModeProvider>
|
|
96
|
+
</PendingChangesProvider>
|
|
97
|
+
</JsonFormsContext.Provider>
|
|
98
|
+
</DetailModal>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { BooleanCell } from './BooleanCell';
|
|
2
|
+
export { DateCell } from './DateCell';
|
|
3
|
+
export { EnumCell } from './EnumCell';
|
|
4
|
+
export { IntegerCell } from './IntegerCell';
|
|
5
|
+
export { NumberCell } from './NumberCell';
|
|
6
|
+
export { NumberFormatCell } from './NumberFormatCell';
|
|
7
|
+
export { OneOfEnumCell } from './OneOfEnumCell';
|
|
8
|
+
export { TextCell } from './TextCell';
|
|
9
|
+
export { TimeCell } from './TimeCell';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
CellProps,
|
|
4
|
+
isDateControl,
|
|
5
|
+
RankedTester,
|
|
6
|
+
rankWith,
|
|
7
|
+
WithClassname,
|
|
8
|
+
} from '@jsonforms/core';
|
|
9
|
+
import { withJsonFormsCellProps } from '@jsonforms/react';
|
|
10
|
+
import { AntdDatePicker } from '../antd-controls';
|
|
11
|
+
|
|
12
|
+
export const DateCell = (props: CellProps & WithClassname) => {
|
|
13
|
+
return <AntdDatePicker {...props} />;
|
|
14
|
+
};
|
|
15
|
+
export const dateCellTester: RankedTester = rankWith(2, isDateControl);
|
|
16
|
+
|
|
17
|
+
export default withJsonFormsCellProps(DateCell);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
EnumCellProps,
|
|
4
|
+
isEnumControl,
|
|
5
|
+
RankedTester,
|
|
6
|
+
rankWith,
|
|
7
|
+
WithClassname,
|
|
8
|
+
} from '@jsonforms/core';
|
|
9
|
+
import {
|
|
10
|
+
TranslateProps,
|
|
11
|
+
withJsonFormsEnumCellProps,
|
|
12
|
+
withTranslateProps,
|
|
13
|
+
} from '@jsonforms/react';
|
|
14
|
+
import { AntdSelect } from '../antd-controls/AntdSelect';
|
|
15
|
+
|
|
16
|
+
export const EnumCell = (
|
|
17
|
+
props: EnumCellProps & WithClassname & TranslateProps,
|
|
18
|
+
) => <AntdSelect {...props} />;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Default tester for enum controls.
|
|
22
|
+
* @type {RankedTester}
|
|
23
|
+
*/
|
|
24
|
+
export const enumCellTester: RankedTester = rankWith(2, isEnumControl);
|
|
25
|
+
|
|
26
|
+
// HOC order can be reversed with https://github.com/eclipsesource/jsonforms/issues/1987
|
|
27
|
+
export default withJsonFormsEnumCellProps(
|
|
28
|
+
withTranslateProps(React.memo(EnumCell)),
|
|
29
|
+
false,
|
|
30
|
+
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
CellProps,
|
|
4
|
+
isIntegerControl,
|
|
5
|
+
RankedTester,
|
|
6
|
+
rankWith,
|
|
7
|
+
WithClassname,
|
|
8
|
+
} from '@jsonforms/core';
|
|
9
|
+
import { withJsonFormsCellProps } from '@jsonforms/react';
|
|
10
|
+
import { AntdInputInteger } from '../antd-controls/AntdInputInteger';
|
|
11
|
+
|
|
12
|
+
export const IntegerCell = (props: CellProps & WithClassname) => (
|
|
13
|
+
<AntdInputInteger {...props} />
|
|
14
|
+
);
|
|
15
|
+
export const integerCellTester: RankedTester = rankWith(2, isIntegerControl);
|
|
16
|
+
|
|
17
|
+
export default withJsonFormsCellProps(IntegerCell);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
CellProps,
|
|
4
|
+
isNumberControl,
|
|
5
|
+
RankedTester,
|
|
6
|
+
rankWith,
|
|
7
|
+
WithClassname,
|
|
8
|
+
} from '@jsonforms/core';
|
|
9
|
+
import { withJsonFormsCellProps } from '@jsonforms/react';
|
|
10
|
+
import { AntdInputNumber } from '../antd-controls/AntdInputNumber';
|
|
11
|
+
|
|
12
|
+
export const NumberCell = (props: CellProps & WithClassname) => (
|
|
13
|
+
<AntdInputNumber {...props} />
|
|
14
|
+
);
|
|
15
|
+
/**
|
|
16
|
+
* Default tester for number controls.
|
|
17
|
+
* @type {RankedTester}
|
|
18
|
+
*/
|
|
19
|
+
export const numberCellTester: RankedTester = rankWith(2, isNumberControl);
|
|
20
|
+
export default withJsonFormsCellProps(NumberCell);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IntegerCell } from './IntegerCell';
|
|
3
|
+
import {
|
|
4
|
+
CellProps,
|
|
5
|
+
Formatted,
|
|
6
|
+
isNumberFormatControl,
|
|
7
|
+
RankedTester,
|
|
8
|
+
rankWith,
|
|
9
|
+
WithClassname,
|
|
10
|
+
} from '@jsonforms/core';
|
|
11
|
+
import { withJsonFormsCellProps } from '@jsonforms/react';
|
|
12
|
+
import { AntdInputNumberFormat } from '../antd-controls/AntdInputNumberFormat';
|
|
13
|
+
|
|
14
|
+
export const NumberFormatCell = (
|
|
15
|
+
props: CellProps & WithClassname & Partial<Formatted<number>>,
|
|
16
|
+
) => {
|
|
17
|
+
const { toFormatted, fromFormatted } = props;
|
|
18
|
+
return toFormatted && fromFormatted ? (
|
|
19
|
+
<AntdInputNumberFormat
|
|
20
|
+
{...props}
|
|
21
|
+
toFormatted={toFormatted}
|
|
22
|
+
fromFormatted={fromFormatted}
|
|
23
|
+
/>
|
|
24
|
+
) : (
|
|
25
|
+
<IntegerCell {...props} />
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Default tester for text-based/string controls.
|
|
30
|
+
* @type {RankedTester}
|
|
31
|
+
*/
|
|
32
|
+
export const numberFormatCellTester: RankedTester = rankWith(
|
|
33
|
+
4,
|
|
34
|
+
isNumberFormatControl,
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export default withJsonFormsCellProps(NumberFormatCell);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
EnumCellProps,
|
|
4
|
+
isOneOfEnumControl,
|
|
5
|
+
RankedTester,
|
|
6
|
+
rankWith,
|
|
7
|
+
WithClassname,
|
|
8
|
+
} from '@jsonforms/core';
|
|
9
|
+
import {
|
|
10
|
+
TranslateProps,
|
|
11
|
+
withJsonFormsOneOfEnumCellProps,
|
|
12
|
+
withTranslateProps,
|
|
13
|
+
} from '@jsonforms/react';
|
|
14
|
+
import { AntdSelect } from '../antd-controls/AntdSelect';
|
|
15
|
+
|
|
16
|
+
export const OneOfEnumCell = (
|
|
17
|
+
props: EnumCellProps & WithClassname & TranslateProps,
|
|
18
|
+
) => <AntdSelect {...props} />;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Default tester for oneOf enum controls.
|
|
22
|
+
* @type {RankedTester}
|
|
23
|
+
*/
|
|
24
|
+
export const oneOfEnumCellTester: RankedTester = rankWith(
|
|
25
|
+
2,
|
|
26
|
+
isOneOfEnumControl,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export default withJsonFormsOneOfEnumCellProps(
|
|
30
|
+
withTranslateProps(React.memo(OneOfEnumCell)),
|
|
31
|
+
false,
|
|
32
|
+
);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CellProps, RankedTester, WithClassname } from '@jsonforms/core';
|
|
2
|
+
import { withJsonFormsCellProps } from '@jsonforms/react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { AntdPassword } from '../antd-controls/AntdPassword';
|
|
5
|
+
import { passwordControlTester } from '../controls/PasswordControl';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Masking has to survive delegation to a cell.
|
|
9
|
+
*
|
|
10
|
+
* The shared table-cell contract requires that "password masking, multiline
|
|
11
|
+
* input, radio choices, switches, sliders, masks, and temporal controls must
|
|
12
|
+
* not lose their meaning merely because the editor appears in a table" -
|
|
13
|
+
* without this, a password column fell through to the plain text cell and
|
|
14
|
+
* showed the value to anyone looking at the screen.
|
|
15
|
+
*/
|
|
16
|
+
const PasswordCell = (props: CellProps & WithClassname) => (
|
|
17
|
+
<AntdPassword {...props} />
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export const passwordCellTester: RankedTester = passwordControlTester;
|
|
21
|
+
|
|
22
|
+
export default withJsonFormsCellProps(PasswordCell);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
CellProps,
|
|
4
|
+
isStringControl,
|
|
5
|
+
RankedTester,
|
|
6
|
+
rankWith,
|
|
7
|
+
WithClassname,
|
|
8
|
+
} from '@jsonforms/core';
|
|
9
|
+
import { withJsonFormsCellProps } from '@jsonforms/react';
|
|
10
|
+
import { AntdInputText } from '../antd-controls/AntdInputText';
|
|
11
|
+
|
|
12
|
+
export const TextCell = (props: CellProps & WithClassname) => (
|
|
13
|
+
<AntdInputText {...props} />
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Default tester for text-based/string controls.
|
|
18
|
+
* @type {RankedTester}
|
|
19
|
+
*/
|
|
20
|
+
export const textCellTester: RankedTester = rankWith(1, isStringControl);
|
|
21
|
+
|
|
22
|
+
export default withJsonFormsCellProps(TextCell);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
CellProps,
|
|
4
|
+
isTimeControl,
|
|
5
|
+
RankedTester,
|
|
6
|
+
rankWith,
|
|
7
|
+
WithClassname,
|
|
8
|
+
} from '@jsonforms/core';
|
|
9
|
+
import { withJsonFormsCellProps } from '@jsonforms/react';
|
|
10
|
+
import { AntdTimePicker } from '../antd-controls/AntdTimePicker';
|
|
11
|
+
|
|
12
|
+
export const TimeCell = (props: CellProps & WithClassname) => (
|
|
13
|
+
<AntdTimePicker {...props} />
|
|
14
|
+
);
|
|
15
|
+
export const timeCellTester: RankedTester = rankWith(2, isTimeControl);
|
|
16
|
+
|
|
17
|
+
export default withJsonFormsCellProps(TimeCell);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import BooleanCell, { booleanCellTester } from './BooleanCell';
|
|
2
|
+
import BooleanToggleCell, {
|
|
3
|
+
booleanToggleCellTester,
|
|
4
|
+
} from './BooleanToggleCell';
|
|
5
|
+
import DateCell, { dateCellTester } from './DateCell';
|
|
6
|
+
import EnumCell, { enumCellTester } from './EnumCell';
|
|
7
|
+
import IntegerCell, { integerCellTester } from './IntegerCell';
|
|
8
|
+
import NumberCell, { numberCellTester } from './NumberCell';
|
|
9
|
+
import NumberFormatCell, { numberFormatCellTester } from './NumberFormatCell';
|
|
10
|
+
import OneOfEnumCell, { oneOfEnumCellTester } from './OneOfEnumCell';
|
|
11
|
+
import PasswordCell, { passwordCellTester } from './PasswordCell';
|
|
12
|
+
import TextCell, { textCellTester } from './TextCell';
|
|
13
|
+
import TimeCell, { timeCellTester } from './TimeCell';
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
BooleanCell,
|
|
17
|
+
booleanCellTester,
|
|
18
|
+
BooleanToggleCell,
|
|
19
|
+
booleanToggleCellTester,
|
|
20
|
+
DateCell,
|
|
21
|
+
dateCellTester,
|
|
22
|
+
EnumCell,
|
|
23
|
+
enumCellTester,
|
|
24
|
+
IntegerCell,
|
|
25
|
+
integerCellTester,
|
|
26
|
+
NumberCell,
|
|
27
|
+
numberCellTester,
|
|
28
|
+
NumberFormatCell,
|
|
29
|
+
numberFormatCellTester,
|
|
30
|
+
OneOfEnumCell,
|
|
31
|
+
oneOfEnumCellTester,
|
|
32
|
+
PasswordCell,
|
|
33
|
+
passwordCellTester,
|
|
34
|
+
TextCell,
|
|
35
|
+
textCellTester,
|
|
36
|
+
TimeCell,
|
|
37
|
+
timeCellTester,
|
|
38
|
+
};
|
|
39
|
+
import * as Customizable from './CustomizableCells';
|
|
40
|
+
export { Customizable };
|