@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.
Files changed (312) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +103 -2
  3. package/lib/additional/LabelRenderer.d.ts +13 -0
  4. package/lib/additional/ListWithDetailMasterItem.d.ts +9 -0
  5. package/lib/additional/ListWithDetailRenderer.d.ts +8 -0
  6. package/lib/additional/index.d.ts +4 -0
  7. package/lib/additional/unwrapped.d.ts +6 -0
  8. package/lib/antd-controls/AntdCheckbox.d.ts +10 -0
  9. package/lib/antd-controls/AntdClearValueButton.d.ts +44 -0
  10. package/lib/antd-controls/AntdClearableInput.d.ts +19 -0
  11. package/lib/antd-controls/AntdDatePicker.d.ts +7 -0
  12. package/lib/antd-controls/AntdDateTimePicker.d.ts +7 -0
  13. package/lib/antd-controls/AntdFile.d.ts +7 -0
  14. package/lib/antd-controls/AntdInputInteger.d.ts +3 -0
  15. package/lib/antd-controls/AntdInputNumber.d.ts +3 -0
  16. package/lib/antd-controls/AntdInputNumberFormat.d.ts +6 -0
  17. package/lib/antd-controls/AntdInputText.d.ts +6 -0
  18. package/lib/antd-controls/AntdNumericInput.d.ts +9 -0
  19. package/lib/antd-controls/AntdOtp.d.ts +33 -0
  20. package/lib/antd-controls/AntdPassword.d.ts +6 -0
  21. package/lib/antd-controls/AntdRadioGroup.d.ts +6 -0
  22. package/lib/antd-controls/AntdRevealButton.d.ts +32 -0
  23. package/lib/antd-controls/AntdSelect.d.ts +7 -0
  24. package/lib/antd-controls/AntdSlider.d.ts +21 -0
  25. package/lib/antd-controls/AntdTimePicker.d.ts +6 -0
  26. package/lib/antd-controls/AntdToggle.d.ts +6 -0
  27. package/lib/antd-controls/FileFeedback.d.ts +6 -0
  28. package/lib/antd-controls/index.d.ts +18 -0
  29. package/lib/antd-controls/useTemporalPicker.d.ts +49 -0
  30. package/lib/cells/AntdCompositeCell.d.ts +8 -0
  31. package/lib/cells/BooleanCell.d.ts +6 -0
  32. package/lib/cells/BooleanToggleCell.d.ts +5 -0
  33. package/lib/cells/CompositeDetailDialog.d.ts +15 -0
  34. package/lib/cells/CustomizableCells.d.ts +9 -0
  35. package/lib/cells/DateCell.d.ts +6 -0
  36. package/lib/cells/EnumCell.d.ts +11 -0
  37. package/lib/cells/IntegerCell.d.ts +6 -0
  38. package/lib/cells/NumberCell.d.ts +10 -0
  39. package/lib/cells/NumberFormatCell.d.ts +10 -0
  40. package/lib/cells/OneOfEnumCell.d.ts +11 -0
  41. package/lib/cells/PasswordCell.d.ts +5 -0
  42. package/lib/cells/TextCell.d.ts +10 -0
  43. package/lib/cells/TimeCell.d.ts +6 -0
  44. package/lib/cells/index.d.ts +14 -0
  45. package/lib/complex/AdditionalProperties.d.ts +4 -0
  46. package/lib/complex/AnyOfRenderer.d.ts +31 -0
  47. package/lib/complex/ArrayControlRenderer.d.ts +8 -0
  48. package/lib/complex/ChipsControl.d.ts +22 -0
  49. package/lib/complex/CollectionPager.d.ts +5 -0
  50. package/lib/complex/DataCell.d.ts +16 -0
  51. package/lib/complex/DeleteDialog.d.ts +14 -0
  52. package/lib/complex/DetailModal.d.ts +6 -0
  53. package/lib/complex/EnumArrayRenderer.d.ts +6 -0
  54. package/lib/complex/ErrorFeedback.d.ts +6 -0
  55. package/lib/complex/MixedRenderer.d.ts +6 -0
  56. package/lib/complex/MultiSelectControl.d.ts +17 -0
  57. package/lib/complex/ObjectRenderer.d.ts +5 -0
  58. package/lib/complex/OneOfRenderer.d.ts +6 -0
  59. package/lib/complex/OneOfTabRenderer.d.ts +5 -0
  60. package/lib/complex/RecursiveTreeRenderer.d.ts +4 -0
  61. package/lib/complex/RowDetailFrame.d.ts +10 -0
  62. package/lib/complex/ScalarCompositionRenderer.d.ts +4 -0
  63. package/lib/complex/TabSwitchConfirmDialog.d.ts +9 -0
  64. package/lib/complex/TableControl.d.ts +9 -0
  65. package/lib/complex/TableToolbar.d.ts +21 -0
  66. package/lib/complex/TupleAdditionalItems.d.ts +13 -0
  67. package/lib/complex/TupleControlRenderer.d.ts +6 -0
  68. package/lib/complex/TupleField.d.ts +4 -0
  69. package/lib/complex/ValidationIcon.d.ts +8 -0
  70. package/lib/complex/additionalProperties/AntdAdditionalPropertyActions.d.ts +9 -0
  71. package/lib/complex/additionalProperties/AntdAdditionalPropertyRenameDialog.d.ts +11 -0
  72. package/lib/complex/index.d.ts +20 -0
  73. package/lib/complex/mixed/AntdJsonTypeIcon.d.ts +4 -0
  74. package/lib/complex/mixed/AntdMixedNavigationContext.d.ts +5 -0
  75. package/lib/complex/mixed/AntdMixedSplitPane.d.ts +5 -0
  76. package/lib/complex/mixed/AntdMixedTree.d.ts +15 -0
  77. package/lib/complex/mixed/AntdMixedTypeSelector.d.ts +12 -0
  78. package/lib/complex/mixed/AntdNestedMixedNavigation.d.ts +7 -0
  79. package/lib/complex/mixed/mixedTree.d.ts +2 -0
  80. package/lib/complex/unwrapped.d.ts +10 -0
  81. package/lib/controls/AnyOfStringOrEnumControl.d.ts +9 -0
  82. package/lib/controls/BooleanControl.d.ts +6 -0
  83. package/lib/controls/BooleanToggleControl.d.ts +6 -0
  84. package/lib/controls/ChoiceCards.d.ts +1 -0
  85. package/lib/controls/DateControl.d.ts +6 -0
  86. package/lib/controls/DateTimeControl.d.ts +6 -0
  87. package/lib/controls/EnumControl.d.ts +7 -0
  88. package/lib/controls/FileControl.d.ts +7 -0
  89. package/lib/controls/InputControl.d.ts +6 -0
  90. package/lib/controls/IntegerControl.d.ts +6 -0
  91. package/lib/controls/NativeControl.d.ts +6 -0
  92. package/lib/controls/NumberControl.d.ts +6 -0
  93. package/lib/controls/OneOfEnumControl.d.ts +7 -0
  94. package/lib/controls/OneOfRadioGroupControl.d.ts +6 -0
  95. package/lib/controls/PasswordControl.d.ts +18 -0
  96. package/lib/controls/PasswordOtpControl.d.ts +38 -0
  97. package/lib/controls/RadioGroup.d.ts +3 -0
  98. package/lib/controls/RadioGroupControl.d.ts +6 -0
  99. package/lib/controls/SliderControl.d.ts +6 -0
  100. package/lib/controls/TextControl.d.ts +6 -0
  101. package/lib/controls/TimeControl.d.ts +6 -0
  102. package/lib/controls/index.d.ts +20 -0
  103. package/lib/controls/unwrapped.d.ts +19 -0
  104. package/lib/index.d.ts +50 -0
  105. package/lib/jsonforms-react-antd.cjs.js +39 -0
  106. package/lib/jsonforms-react-antd.cjs.js.map +1 -0
  107. package/lib/jsonforms-react-antd.esm.js +4235 -0
  108. package/lib/jsonforms-react-antd.esm.js.map +1 -0
  109. package/lib/layouts/ArrayLayout.d.ts +5 -0
  110. package/lib/layouts/ArrayLayoutRenderer.d.ts +8 -0
  111. package/lib/layouts/ArrayPanel.d.ts +7 -0
  112. package/lib/layouts/ArrayToolbar.d.ts +17 -0
  113. package/lib/layouts/CategorizationAccordionLayout.d.ts +21 -0
  114. package/lib/layouts/CategorizationLayout.d.ts +14 -0
  115. package/lib/layouts/CategorizationStepperLayout.d.ts +10 -0
  116. package/lib/layouts/CategoryHeader.d.ts +39 -0
  117. package/lib/layouts/ContainerIndicator.d.ts +37 -0
  118. package/lib/layouts/GroupLayout.d.ts +6 -0
  119. package/lib/layouts/HorizontalLayout.d.ts +10 -0
  120. package/lib/layouts/ValidationIndicator.d.ts +13 -0
  121. package/lib/layouts/VerticalLayout.d.ts +10 -0
  122. package/lib/layouts/arrayTitle.d.ts +2 -0
  123. package/lib/layouts/index.d.ts +11 -0
  124. package/lib/layouts/unwrapped.d.ts +11 -0
  125. package/lib/locale/index.d.ts +1 -0
  126. package/lib/util/additionalPropertyName.d.ts +2 -0
  127. package/lib/util/arrayChoices.d.ts +2 -0
  128. package/lib/util/categoryState.d.ts +3 -0
  129. package/lib/util/cellFrame.d.ts +27 -0
  130. package/lib/util/cellMode.d.ts +29 -0
  131. package/lib/util/clearAffordance.d.ts +1 -0
  132. package/lib/util/combinators.d.ts +1 -0
  133. package/lib/util/compositeActions.d.ts +1 -0
  134. package/lib/util/compositeSummary.d.ts +1 -0
  135. package/lib/util/configNamespaces.d.ts +1 -0
  136. package/lib/util/confirmation.d.ts +2 -0
  137. package/lib/util/datejs.d.ts +4 -0
  138. package/lib/util/debounce.d.ts +1 -0
  139. package/lib/util/dynamicProperties.d.ts +1 -0
  140. package/lib/util/focus.d.ts +1 -0
  141. package/lib/util/groupState.d.ts +1 -0
  142. package/lib/util/index.d.ts +25 -0
  143. package/lib/util/layout.d.ts +18 -0
  144. package/lib/util/layoutSizing.d.ts +6 -0
  145. package/lib/util/literalPropertySchema.d.ts +1 -0
  146. package/lib/util/locale.d.ts +68 -0
  147. package/lib/util/numeric.d.ts +1 -0
  148. package/lib/util/pendingChanges.d.ts +2 -0
  149. package/lib/util/preTouchErrors.d.ts +2 -0
  150. package/lib/util/rendererLocale.d.ts +2 -0
  151. package/lib/util/temporalBounds.d.ts +35 -0
  152. package/lib/util/temporalFormats.d.ts +26 -0
  153. package/lib/util/theme.d.ts +9 -0
  154. package/lib/util/translate.d.ts +1 -0
  155. package/lib/util/tuple.d.ts +2 -0
  156. package/lib/util/useConfirmation.d.ts +7 -0
  157. package/lib/util/validationIndicator.d.ts +2 -0
  158. package/lib/util/visuallyHidden.d.ts +1 -0
  159. package/package.json +89 -3
  160. package/src/additional/LabelRenderer.tsx +21 -0
  161. package/src/additional/ListWithDetailMasterItem.tsx +124 -0
  162. package/src/additional/ListWithDetailRenderer.tsx +243 -0
  163. package/src/additional/index.ts +14 -0
  164. package/src/additional/unwrapped.ts +8 -0
  165. package/src/antd-controls/AntdCheckbox.tsx +56 -0
  166. package/src/antd-controls/AntdClearValueButton.tsx +96 -0
  167. package/src/antd-controls/AntdClearableInput.tsx +63 -0
  168. package/src/antd-controls/AntdDatePicker.tsx +26 -0
  169. package/src/antd-controls/AntdDateTimePicker.tsx +31 -0
  170. package/src/antd-controls/AntdFile.tsx +395 -0
  171. package/src/antd-controls/AntdInputInteger.tsx +10 -0
  172. package/src/antd-controls/AntdInputNumber.tsx +10 -0
  173. package/src/antd-controls/AntdInputNumberFormat.tsx +63 -0
  174. package/src/antd-controls/AntdInputText.tsx +124 -0
  175. package/src/antd-controls/AntdNumericInput.tsx +83 -0
  176. package/src/antd-controls/AntdOtp.tsx +132 -0
  177. package/src/antd-controls/AntdPassword.tsx +106 -0
  178. package/src/antd-controls/AntdRadioGroup.tsx +60 -0
  179. package/src/antd-controls/AntdRevealButton.tsx +74 -0
  180. package/src/antd-controls/AntdSelect.tsx +113 -0
  181. package/src/antd-controls/AntdSlider.tsx +114 -0
  182. package/src/antd-controls/AntdTimePicker.tsx +25 -0
  183. package/src/antd-controls/AntdToggle.tsx +70 -0
  184. package/src/antd-controls/FileFeedback.tsx +37 -0
  185. package/src/antd-controls/index.ts +18 -0
  186. package/src/antd-controls/useTemporalPicker.ts +130 -0
  187. package/src/cells/AntdCompositeCell.tsx +228 -0
  188. package/src/cells/BooleanCell.tsx +33 -0
  189. package/src/cells/BooleanToggleCell.tsx +38 -0
  190. package/src/cells/CompositeDetailDialog.tsx +100 -0
  191. package/src/cells/CustomizableCells.ts +9 -0
  192. package/src/cells/DateCell.tsx +17 -0
  193. package/src/cells/EnumCell.tsx +30 -0
  194. package/src/cells/IntegerCell.tsx +17 -0
  195. package/src/cells/NumberCell.tsx +20 -0
  196. package/src/cells/NumberFormatCell.tsx +37 -0
  197. package/src/cells/OneOfEnumCell.tsx +32 -0
  198. package/src/cells/PasswordCell.tsx +22 -0
  199. package/src/cells/TextCell.tsx +22 -0
  200. package/src/cells/TimeCell.tsx +17 -0
  201. package/src/cells/index.ts +40 -0
  202. package/src/complex/AdditionalProperties.tsx +422 -0
  203. package/src/complex/AnyOfRenderer.tsx +158 -0
  204. package/src/complex/ArrayControlRenderer.tsx +121 -0
  205. package/src/complex/ChipsControl.tsx +205 -0
  206. package/src/complex/CollectionPager.tsx +26 -0
  207. package/src/complex/DataCell.tsx +82 -0
  208. package/src/complex/DeleteDialog.tsx +44 -0
  209. package/src/complex/DetailModal.tsx +110 -0
  210. package/src/complex/EnumArrayRenderer.tsx +148 -0
  211. package/src/complex/ErrorFeedback.tsx +51 -0
  212. package/src/complex/MixedRenderer.tsx +325 -0
  213. package/src/complex/MultiSelectControl.tsx +205 -0
  214. package/src/complex/ObjectRenderer.tsx +55 -0
  215. package/src/complex/OneOfRenderer.tsx +299 -0
  216. package/src/complex/OneOfTabRenderer.tsx +123 -0
  217. package/src/complex/RecursiveTreeRenderer.tsx +20 -0
  218. package/src/complex/RowDetailFrame.tsx +99 -0
  219. package/src/complex/ScalarCompositionRenderer.tsx +14 -0
  220. package/src/complex/TabSwitchConfirmDialog.tsx +36 -0
  221. package/src/complex/TableControl.tsx +646 -0
  222. package/src/complex/TableToolbar.tsx +80 -0
  223. package/src/complex/TupleAdditionalItems.tsx +100 -0
  224. package/src/complex/TupleControlRenderer.tsx +78 -0
  225. package/src/complex/TupleField.tsx +44 -0
  226. package/src/complex/ValidationIcon.tsx +30 -0
  227. package/src/complex/additionalProperties/AntdAdditionalPropertyActions.tsx +56 -0
  228. package/src/complex/additionalProperties/AntdAdditionalPropertyRenameDialog.tsx +56 -0
  229. package/src/complex/index.ts +48 -0
  230. package/src/complex/mixed/AntdJsonTypeIcon.tsx +40 -0
  231. package/src/complex/mixed/AntdMixedNavigationContext.ts +8 -0
  232. package/src/complex/mixed/AntdMixedSplitPane.tsx +51 -0
  233. package/src/complex/mixed/AntdMixedTree.tsx +287 -0
  234. package/src/complex/mixed/AntdMixedTypeSelector.tsx +60 -0
  235. package/src/complex/mixed/AntdNestedMixedNavigation.tsx +39 -0
  236. package/src/complex/mixed/mixedTree.ts +9 -0
  237. package/src/complex/unwrapped.ts +15 -0
  238. package/src/controls/AnyOfStringOrEnumControl.tsx +123 -0
  239. package/src/controls/BooleanControl.tsx +17 -0
  240. package/src/controls/BooleanToggleControl.tsx +24 -0
  241. package/src/controls/ChoiceCards.tsx +13 -0
  242. package/src/controls/DateControl.tsx +19 -0
  243. package/src/controls/DateTimeControl.tsx +22 -0
  244. package/src/controls/EnumControl.tsx +29 -0
  245. package/src/controls/FileControl.tsx +44 -0
  246. package/src/controls/InputControl.tsx +94 -0
  247. package/src/controls/IntegerControl.tsx +16 -0
  248. package/src/controls/NativeControl.tsx +79 -0
  249. package/src/controls/NumberControl.tsx +18 -0
  250. package/src/controls/OneOfEnumControl.tsx +32 -0
  251. package/src/controls/OneOfRadioGroupControl.tsx +25 -0
  252. package/src/controls/PasswordControl.tsx +43 -0
  253. package/src/controls/PasswordOtpControl.tsx +61 -0
  254. package/src/controls/RadioGroup.tsx +8 -0
  255. package/src/controls/RadioGroupControl.tsx +21 -0
  256. package/src/controls/SliderControl.tsx +19 -0
  257. package/src/controls/TextControl.tsx +17 -0
  258. package/src/controls/TimeControl.tsx +20 -0
  259. package/src/controls/index.ts +69 -0
  260. package/src/controls/unwrapped.ts +35 -0
  261. package/src/index.ts +267 -0
  262. package/src/layouts/ArrayLayout.tsx +435 -0
  263. package/src/layouts/ArrayLayoutRenderer.tsx +54 -0
  264. package/src/layouts/ArrayPanel.tsx +51 -0
  265. package/src/layouts/ArrayToolbar.tsx +67 -0
  266. package/src/layouts/CategorizationAccordionLayout.tsx +217 -0
  267. package/src/layouts/CategorizationLayout.tsx +149 -0
  268. package/src/layouts/CategorizationStepperLayout.tsx +164 -0
  269. package/src/layouts/CategoryHeader.tsx +107 -0
  270. package/src/layouts/ContainerIndicator.tsx +83 -0
  271. package/src/layouts/GroupLayout.tsx +307 -0
  272. package/src/layouts/HorizontalLayout.tsx +50 -0
  273. package/src/layouts/ValidationIndicator.tsx +43 -0
  274. package/src/layouts/VerticalLayout.tsx +50 -0
  275. package/src/layouts/arrayTitle.tsx +30 -0
  276. package/src/layouts/index.ts +35 -0
  277. package/src/layouts/unwrapped.ts +17 -0
  278. package/src/locale/index.ts +1 -0
  279. package/src/util/additionalPropertyName.ts +11 -0
  280. package/src/util/arrayChoices.ts +21 -0
  281. package/src/util/categoryState.ts +17 -0
  282. package/src/util/cellFrame.tsx +52 -0
  283. package/src/util/cellMode.tsx +145 -0
  284. package/src/util/clearAffordance.ts +2 -0
  285. package/src/util/combinators.ts +6 -0
  286. package/src/util/compositeActions.ts +2 -0
  287. package/src/util/compositeSummary.ts +2 -0
  288. package/src/util/configNamespaces.ts +4 -0
  289. package/src/util/confirmation.ts +15 -0
  290. package/src/util/datejs.tsx +42 -0
  291. package/src/util/debounce.ts +2 -0
  292. package/src/util/dynamicProperties.ts +6 -0
  293. package/src/util/focus.ts +2 -0
  294. package/src/util/groupState.ts +8 -0
  295. package/src/util/index.ts +25 -0
  296. package/src/util/layout.tsx +121 -0
  297. package/src/util/layoutSizing.ts +33 -0
  298. package/src/util/literalPropertySchema.ts +2 -0
  299. package/src/util/locale.ts +222 -0
  300. package/src/util/numeric.ts +2 -0
  301. package/src/util/pendingChanges.tsx +6 -0
  302. package/src/util/preTouchErrors.ts +10 -0
  303. package/src/util/rendererLocale.ts +10 -0
  304. package/src/util/temporalBounds.ts +106 -0
  305. package/src/util/temporalFormats.ts +95 -0
  306. package/src/util/theme.ts +9 -0
  307. package/src/util/translate.ts +6 -0
  308. package/src/util/tuple.ts +16 -0
  309. package/src/util/uiSchemaCycle.tsx +2 -0
  310. package/src/util/useConfirmation.tsx +25 -0
  311. package/src/util/validationIndicator.ts +10 -0
  312. package/src/util/visuallyHidden.ts +2 -0
@@ -0,0 +1,80 @@
1
+ import { usePathErrorIndicator } from '@chobantonov/jsonforms-react-renderer-common/validation/errorSummary';
2
+ import { ArrayPanel } from '../layouts/ArrayPanel';
3
+ import React from 'react';
4
+ import {
5
+ ControlElement,
6
+ createDefaultValue,
7
+ JsonSchema,
8
+ ArrayTranslations,
9
+ } from '@jsonforms/core';
10
+ import { Button, Tooltip } from 'antd';
11
+ import PlusOutlined from '@ant-design/icons/PlusOutlined';
12
+ import { renderArrayTitle } from '../layouts/arrayTitle';
13
+
14
+ export interface TableToolbarProps {
15
+ errors: string;
16
+ options?: Record<string, any>;
17
+ config?: any;
18
+ label: string;
19
+ description: string | undefined;
20
+ path: string;
21
+ uischema: ControlElement;
22
+ schema: JsonSchema;
23
+ rootSchema: JsonSchema;
24
+ enabled: boolean;
25
+ translations: ArrayTranslations;
26
+ addItem(path: string, value: any): () => void;
27
+ disableAdd?: boolean;
28
+ children?: React.ReactNode;
29
+ actions?: React.ReactNode;
30
+ }
31
+
32
+ const TableToolbar = React.memo(function TableToolbar({
33
+ label,
34
+ description,
35
+ path,
36
+ addItem,
37
+ schema,
38
+ enabled,
39
+ translations,
40
+ rootSchema,
41
+ disableAdd,
42
+ children,
43
+ actions,
44
+ options,
45
+ uischema,
46
+ config,
47
+ }: TableToolbarProps) {
48
+ const arrayErrors = usePathErrorIndicator(path, options ?? uischema.options);
49
+ return (
50
+ <ArrayPanel
51
+ options={options ?? uischema.options}
52
+ config={config}
53
+ panelLabel={label}
54
+ style={{ width: '100%' }}
55
+ size='small'
56
+ type='inner'
57
+ title={renderArrayTitle(label, arrayErrors, description)}
58
+ extra={[
59
+ actions,
60
+ <Tooltip
61
+ key='tooltip-add'
62
+ title={translations.addTooltip}
63
+ placement='bottom'
64
+ >
65
+ <Button
66
+ disabled={!enabled || disableAdd}
67
+ aria-label={translations.addAriaLabel}
68
+ onClick={addItem(path, createDefaultValue(schema, rootSchema))}
69
+ shape='circle'
70
+ icon={<PlusOutlined rev={undefined} />}
71
+ />
72
+ </Tooltip>,
73
+ ]}
74
+ >
75
+ {children}
76
+ </ArrayPanel>
77
+ );
78
+ });
79
+
80
+ export default TableToolbar;
@@ -0,0 +1,100 @@
1
+ import {
2
+ useTupleAdditionalItems,
3
+ type TupleAdditionalItemsProps,
4
+ } from '@chobantonov/jsonforms-react-renderer-common/tuple/useTupleAdditionalItems';
5
+ import { DeleteDialog } from './DeleteDialog';
6
+ import { PendingChangesProvider } from '@chobantonov/jsonforms-react-renderer-common/interaction/pendingChanges';
7
+ import { CollectionPager } from './CollectionPager';
8
+ import React from 'react';
9
+ import { Button, Typography, theme as antTheme } from 'antd';
10
+ import DeleteOutlined from '@ant-design/icons/DeleteOutlined';
11
+ import PlusOutlined from '@ant-design/icons/PlusOutlined';
12
+ export type { TupleAdditionalItemsProps } from '@chobantonov/jsonforms-react-renderer-common/tuple/useTupleAdditionalItems';
13
+
14
+ /**
15
+ * The trailing values a tuple permits past its declared positions.
16
+ *
17
+ * Presented as its own section with a heading and an Add button in the header,
18
+ * "consistent with the additional-properties control" as section 18 asks, and
19
+ * each entry gets a positional label and a Delete button. The declared prefix is
20
+ * untouchable from here: Delete refuses any index inside it, so no action in
21
+ * this section can remove or reorder a fixed position.
22
+ */
23
+ export const TupleAdditionalItems = (props: TupleAdditionalItemsProps) => {
24
+ const { renderItem, positionLabel } = props;
25
+ const { token } = antTheme.useToken();
26
+ const { t, message, canAdd, canDelete, add, deletion, visibleIndices, page } =
27
+ useTupleAdditionalItems(props);
28
+
29
+ return (
30
+ <section
31
+ data-tuple-additional
32
+ style={{
33
+ marginTop: token.margin,
34
+ paddingTop: token.paddingSM,
35
+ borderTop: `1px solid ${token.colorBorderSecondary}`,
36
+ }}
37
+ >
38
+ <DeleteDialog
39
+ open={deletion.confirming}
40
+ onCancel={deletion.cancel}
41
+ onConfirm={deletion.confirm}
42
+ />
43
+ <header
44
+ style={{
45
+ display: 'flex',
46
+ alignItems: 'center',
47
+ justifyContent: 'space-between',
48
+ gap: token.paddingXS,
49
+ marginBottom: token.paddingXS,
50
+ }}
51
+ >
52
+ <Typography.Text strong>{t('tuple.additionalItems')}</Typography.Text>
53
+ <Button
54
+ size='small'
55
+ type='text'
56
+ icon={<PlusOutlined />}
57
+ disabled={!canAdd}
58
+ onClick={add}
59
+ title={t('tuple.add')}
60
+ aria-label={t('tuple.add')}
61
+ data-tuple-add
62
+ />
63
+ </header>
64
+ <PendingChangesProvider changes={page.pending}>
65
+ {visibleIndices.map((index) => (
66
+ <div
67
+ key={index}
68
+ style={{
69
+ display: 'flex',
70
+ alignItems: 'flex-start',
71
+ gap: token.paddingXS,
72
+ marginBottom: token.paddingXS,
73
+ }}
74
+ >
75
+ <div style={{ flex: 1, minWidth: 0 }}>{renderItem(index)}</div>
76
+ <Button
77
+ size='small'
78
+ type='text'
79
+ danger
80
+ icon={<DeleteOutlined />}
81
+ disabled={!canDelete}
82
+ onClick={() => deletion.request(index)}
83
+ title={t('tuple.delete', { label: positionLabel(index) })}
84
+ aria-label={t('tuple.delete', {
85
+ label: positionLabel(index),
86
+ })}
87
+ data-tuple-delete={index}
88
+ />
89
+ </div>
90
+ ))}
91
+ </PendingChangesProvider>
92
+ <CollectionPager page={page} />
93
+ {message && (
94
+ <Typography.Text type='warning' role='alert' data-tuple-draft>
95
+ {message}
96
+ </Typography.Text>
97
+ )}
98
+ </section>
99
+ );
100
+ };
@@ -0,0 +1,78 @@
1
+ import { useTupleControl } from '@chobantonov/jsonforms-react-renderer-common/tuple/useTupleControl';
2
+ import {
3
+ connectTupleControl,
4
+ TupleControlContent,
5
+ type TupleControlProps,
6
+ } from '@chobantonov/jsonforms-react-renderer-common/tuple/TupleControlContent';
7
+ import React from 'react';
8
+ import type { RankedTester } from '@jsonforms/core';
9
+ import { Typography, theme as antTheme } from 'antd';
10
+ import { ControlFormItem } from '../util/cellMode';
11
+ import { tupleControlTester } from '../util/tuple';
12
+ import { TupleAdditionalItems } from './TupleAdditionalItems';
13
+ import { TupleField } from './TupleField';
14
+
15
+ export const tupleControlRendererTester: RankedTester = tupleControlTester;
16
+
17
+ export const TupleControl = (props: TupleControlProps) => {
18
+ const { label, required, visible, uischema } = props;
19
+ const { token } = antTheme.useToken();
20
+ const model = useTupleControl(props);
21
+ const { options, shownErrors } = model;
22
+ if (!visible) return null;
23
+ const content = (
24
+ <TupleControlContent
25
+ props={props}
26
+ model={model}
27
+ TupleField={TupleField}
28
+ TupleAdditionalItems={TupleAdditionalItems}
29
+ gap={token.margin}
30
+ diagnostic={(message) => (
31
+ <Typography.Text type='danger' role='alert' data-tuple-diagnostic>
32
+ {message}
33
+ </Typography.Text>
34
+ )}
35
+ />
36
+ );
37
+ return (
38
+ /*
39
+ Array-level errors - minItems, maxItems, uniqueItems - belong to the tuple
40
+ as a whole and appear here, beneath it. `props.errors` on an array control
41
+ carries only errors at the array's own path, so a position's error stays
42
+ beside that position and never marks the others invalid.
43
+
44
+ The exception is a position a supplied layout does not draw: its error
45
+ has no field to sit beside, so it is reported here instead, named.
46
+ */
47
+ <ControlFormItem
48
+ hideRequiredAsterisk={uischema.options?.hideRequiredAsterisk}
49
+ id={props.id}
50
+ label={label}
51
+ required={required}
52
+ errors={shownErrors || undefined}
53
+ help={shownErrors || props.description}
54
+ >
55
+ {options.showBorder === false ? (
56
+ <div data-tuple-control>{content}</div>
57
+ ) : (
58
+ /*
59
+ `showBorder` defaults to true: one subtle boundary around the heading,
60
+ the positions, the additional items and the array-level errors, so a
61
+ tuple reads as one value rather than as several loose fields.
62
+ */
63
+ <div
64
+ data-tuple-control
65
+ style={{
66
+ border: `1px solid ${token.colorBorderSecondary}`,
67
+ borderRadius: token.borderRadius,
68
+ padding: token.paddingSM,
69
+ }}
70
+ >
71
+ {content}
72
+ </div>
73
+ )}
74
+ </ControlFormItem>
75
+ );
76
+ };
77
+
78
+ export const TupleControlRenderer = connectTupleControl(TupleControl);
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import {
3
+ TupleField as CommonTupleField,
4
+ type TupleFieldProps,
5
+ } from '@chobantonov/jsonforms-react-renderer-common/tuple/TupleField';
6
+ export type { TupleFieldProps } from '@chobantonov/jsonforms-react-renderer-common/tuple/TupleField';
7
+ import { CompositeDetailDialog } from '../cells/CompositeDetailDialog';
8
+ import { Button, Typography, theme as antTheme } from 'antd';
9
+ import EditOutlined from '@ant-design/icons/EditOutlined';
10
+ export function TupleField(props: TupleFieldProps) {
11
+ const { token } = antTheme.useToken();
12
+ return (
13
+ <CommonTupleField
14
+ {...props}
15
+ CompositeDetailDialog={CompositeDetailDialog}
16
+ gap={token.paddingXS}
17
+ legendStyle={{
18
+ marginBottom: token.paddingXXS,
19
+ fontSize: token.fontSize,
20
+ color: token.colorTextHeading,
21
+ }}
22
+ renderEditButton={(label, disabled, open) => (
23
+ <Button
24
+ size='small'
25
+ type='text'
26
+ icon={<EditOutlined />}
27
+ disabled={disabled}
28
+ onClick={open}
29
+ title={label}
30
+ aria-label={label}
31
+ />
32
+ )}
33
+ renderError={(message, draft) => (
34
+ <Typography.Text
35
+ type={draft ? 'warning' : 'danger'}
36
+ role='alert'
37
+ data-tuple-draft={draft || undefined}
38
+ >
39
+ {message}
40
+ </Typography.Text>
41
+ )}
42
+ />
43
+ );
44
+ }
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { Button } from 'antd';
3
+ import ExclamationCircleOutlined from '@ant-design/icons/ExclamationCircleOutlined';
4
+ import { ErrorFeedback } from './ErrorFeedback';
5
+ export interface ValidationProps {
6
+ errorMessages: string;
7
+ id: string;
8
+ path?: string;
9
+ local?: boolean;
10
+ }
11
+ export const ValidationIcon: React.FC<ValidationProps> = ({
12
+ errorMessages,
13
+ id,
14
+ path,
15
+ local,
16
+ }) => {
17
+ return errorMessages ? (
18
+ <ErrorFeedback errors={errorMessages} path={path} local={local}>
19
+ <Button
20
+ id={id}
21
+ data-validation-summary
22
+ type='text'
23
+ danger
24
+ size='small'
25
+ aria-label={errorMessages}
26
+ icon={<ExclamationCircleOutlined />}
27
+ />
28
+ </ErrorFeedback>
29
+ ) : null;
30
+ };
@@ -0,0 +1,56 @@
1
+ import DeleteOutlined from '@ant-design/icons/DeleteOutlined';
2
+ import EditOutlined from '@ant-design/icons/EditOutlined';
3
+ import { Button, Flex, Tooltip } from 'antd';
4
+ import React from 'react';
5
+ import { useI18n } from '../../util/translate';
6
+
7
+ export interface AntdAdditionalPropertyActionsProps {
8
+ deleteDisabled: boolean;
9
+ name: string;
10
+ onDelete: () => void;
11
+ onRename: () => void;
12
+ readonly?: boolean;
13
+ }
14
+
15
+ export const AntdAdditionalPropertyActions = ({
16
+ deleteDisabled,
17
+ name,
18
+ onDelete,
19
+ onRename,
20
+ readonly,
21
+ }: AntdAdditionalPropertyActionsProps) => {
22
+ const t = useI18n();
23
+ return (
24
+ <Flex className='jsonforms-additional-property-actions' gap={4}>
25
+ <Tooltip title={t('additionalProperties.rename')}>
26
+ <Button
27
+ aria-label={t('additionalProperties.renameNamed', { name })}
28
+ disabled={readonly}
29
+ icon={<EditOutlined />}
30
+ onClick={onRename}
31
+ shape='circle'
32
+ size='small'
33
+ type='text'
34
+ />
35
+ </Tooltip>
36
+ <Tooltip
37
+ title={
38
+ deleteDisabled
39
+ ? t('additionalProperties.deleteBlocked')
40
+ : t('additionalProperties.delete')
41
+ }
42
+ >
43
+ <Button
44
+ aria-label={t('additionalProperties.deleteNamed', { name })}
45
+ danger
46
+ disabled={deleteDisabled}
47
+ icon={<DeleteOutlined />}
48
+ onClick={onDelete}
49
+ shape='circle'
50
+ size='small'
51
+ type='text'
52
+ />
53
+ </Tooltip>
54
+ </Flex>
55
+ );
56
+ };
@@ -0,0 +1,56 @@
1
+ import { Form, Input, Modal, Typography } from 'antd';
2
+ import React from 'react';
3
+ import { useI18n } from '../../util/translate';
4
+
5
+ export interface AntdAdditionalPropertyRenameDialogProps {
6
+ disabled: boolean;
7
+ error?: string;
8
+ oldName: string | null;
9
+ onCancel: () => void;
10
+ onChange: (value: string) => void;
11
+ onRename: () => void;
12
+ value: string;
13
+ }
14
+
15
+ export const AntdAdditionalPropertyRenameDialog = ({
16
+ disabled,
17
+ error,
18
+ oldName,
19
+ onCancel,
20
+ onChange,
21
+ onRename,
22
+ value,
23
+ }: AntdAdditionalPropertyRenameDialogProps) => {
24
+ const t = useI18n();
25
+ return (
26
+ <Modal
27
+ cancelText={t('combinator.cancel')}
28
+ destroyOnHidden
29
+ okButtonProps={{ disabled }}
30
+ okText={t('additionalProperties.renameConfirm')}
31
+ onCancel={onCancel}
32
+ onOk={onRename}
33
+ open={oldName !== null}
34
+ title={t('additionalProperties.renameTitle')}
35
+ >
36
+ <Typography.Paragraph type='secondary'>
37
+ {t('additionalProperties.renameDialogDescription')}
38
+ </Typography.Paragraph>
39
+ <Form.Item
40
+ help={error}
41
+ label={t('additionalProperties.renamePropertyNameLabel')}
42
+ validateStatus={error ? 'error' : undefined}
43
+ >
44
+ <Input
45
+ autoFocus
46
+ aria-label={t('additionalProperties.renamePropertyNameLabel')}
47
+ onChange={(event) => onChange(event.currentTarget.value)}
48
+ onPressEnter={() => {
49
+ if (!disabled) onRename();
50
+ }}
51
+ value={value}
52
+ />
53
+ </Form.Item>
54
+ </Modal>
55
+ );
56
+ };
@@ -0,0 +1,48 @@
1
+ import {
2
+ AllOfControl as AllOfRenderer,
3
+ allOfControlTester,
4
+ } from '@chobantonov/jsonforms-react-renderer-common/composition/AllOfRenderer';
5
+ import AnyOfRenderer, { anyOfControlTester } from './AnyOfRenderer';
6
+ import ArrayControlRenderer, {
7
+ arrayControlTester,
8
+ } from './ArrayControlRenderer';
9
+ import EnumArrayRenderer, {
10
+ enumArrayRendererTester,
11
+ } from './EnumArrayRenderer';
12
+ import ObjectRenderer, { objectControlTester } from './ObjectRenderer';
13
+ import OneOfRenderer, { oneOfControlTester } from './OneOfRenderer';
14
+ import OneOfTabRenderer, { oneOfTabControlTester } from './OneOfTabRenderer';
15
+ import ScalarCompositionRenderer, {
16
+ scalarCompositionTester,
17
+ } from './ScalarCompositionRenderer';
18
+ export * from './MixedRenderer';
19
+
20
+ export {
21
+ allOfControlTester,
22
+ AllOfRenderer,
23
+ anyOfControlTester,
24
+ AnyOfRenderer,
25
+ arrayControlTester,
26
+ ArrayControlRenderer,
27
+ enumArrayRendererTester,
28
+ EnumArrayRenderer,
29
+ objectControlTester,
30
+ ObjectRenderer,
31
+ oneOfControlTester,
32
+ OneOfRenderer,
33
+ oneOfTabControlTester,
34
+ OneOfTabRenderer,
35
+ scalarCompositionTester,
36
+ ScalarCompositionRenderer,
37
+ };
38
+
39
+ export * from '@chobantonov/jsonforms-react-renderer-common/composition/CombinatorProperties';
40
+ export * from './DeleteDialog';
41
+ export * from './TableControl';
42
+ export * from './TableToolbar';
43
+ export * from './ValidationIcon';
44
+ export * from './TupleControlRenderer';
45
+ export * from './TupleField';
46
+ export * from './TupleAdditionalItems';
47
+ export * from './ChipsControl';
48
+ export * from './MultiSelectControl';
@@ -0,0 +1,40 @@
1
+ import {
2
+ useI18n,
3
+ useTranslator,
4
+ } from '@chobantonov/jsonforms-react-renderer-common/locale/translate';
5
+ import AlignLeftOutlined from '@ant-design/icons/AlignLeftOutlined';
6
+ import CheckOutlined from '@ant-design/icons/CheckOutlined';
7
+ import CodeOutlined from '@ant-design/icons/CodeOutlined';
8
+ import StopOutlined from '@ant-design/icons/StopOutlined';
9
+ import React from 'react';
10
+
11
+ const typeIcons = new Map<string, React.ReactNode>([
12
+ ['array', '[]'],
13
+ ['object', '{}'],
14
+ ['string', <AlignLeftOutlined key='AlignLeftOutlined' />],
15
+ ['integer', '#'],
16
+ ['number', '#'],
17
+ ['boolean', <CheckOutlined key='CheckOutlined' />],
18
+ ['null', <StopOutlined key='StopOutlined' />],
19
+ ]);
20
+
21
+ export const AntdJsonTypeIcon = ({ type }: { type: string | null }) => {
22
+ const t = useI18n();
23
+ const translate = useTranslator();
24
+ const label = t('mixed.typedValue', {
25
+ type: translate(`mixed.type.${type ?? 'unknown'}`, type ?? 'unknown'),
26
+ });
27
+ const icon = typeIcons.get(type ?? 'unknown') ?? <CodeOutlined />;
28
+
29
+ return (
30
+ <span
31
+ aria-label={label}
32
+ className='jsonforms-mixed-tree-type-icon'
33
+ role='img'
34
+ style={{ fontFamily: 'monospace', fontWeight: 600 }}
35
+ title={label}
36
+ >
37
+ {icon}
38
+ </span>
39
+ );
40
+ };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+
3
+ export interface AntdMixedNavigation {
4
+ selectPath: (path: string) => void;
5
+ }
6
+
7
+ export const AntdMixedNavigationContext =
8
+ React.createContext<AntdMixedNavigation | null>(null);
@@ -0,0 +1,51 @@
1
+ import { Grid, Splitter } from 'antd';
2
+ import React from 'react';
3
+
4
+ export const AntdMixedSplitPane = ({
5
+ detail,
6
+ tree,
7
+ }: {
8
+ detail: React.ReactNode;
9
+ tree: React.ReactNode;
10
+ }) => {
11
+ const screens = Grid.useBreakpoint();
12
+ if (!screens.md) {
13
+ return (
14
+ <div
15
+ className='jsonforms-mixed-split-pane-stacked'
16
+ style={{ display: 'grid', gap: 16 }}
17
+ >
18
+ <div
19
+ className='jsonforms-mixed-tree-pane'
20
+ style={{ maxHeight: 'min(45vh, 480px)', overflow: 'auto' }}
21
+ >
22
+ {tree}
23
+ </div>
24
+ <div className='jsonforms-mixed-detail-pane'>{detail}</div>
25
+ </div>
26
+ );
27
+ }
28
+ return (
29
+ <Splitter
30
+ className='jsonforms-mixed-split-pane'
31
+ style={{ height: 'min(70vh, 720px)', minHeight: 280 }}
32
+ >
33
+ <Splitter.Panel defaultSize='25%' min='18%' max='45%'>
34
+ <div
35
+ className='jsonforms-mixed-tree-pane'
36
+ style={{ height: '100%', overflow: 'auto', padding: 12 }}
37
+ >
38
+ {tree}
39
+ </div>
40
+ </Splitter.Panel>
41
+ <Splitter.Panel min='45%'>
42
+ <div
43
+ className='jsonforms-mixed-detail-pane'
44
+ style={{ height: '100%', overflow: 'auto', padding: 12 }}
45
+ >
46
+ {detail}
47
+ </div>
48
+ </Splitter.Panel>
49
+ </Splitter>
50
+ );
51
+ };