@dartech/arsenal-ui 1.2.5 → 1.2.7

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 (271) hide show
  1. package/{index.ts → index.d.ts} +5 -5
  2. package/index.js +1 -0
  3. package/package.json +12 -3
  4. package/src/consts/index.d.ts +12 -0
  5. package/src/interfaces/common.d.ts +17 -0
  6. package/src/interfaces/definition.d.ts +107 -0
  7. package/src/interfaces/{index.ts → index.d.ts} +3 -3
  8. package/src/interfaces/ui.d.ts +70 -0
  9. package/src/lib/Alert/Alert.d.ts +53 -0
  10. package/src/lib/Alert/index.d.ts +1 -0
  11. package/src/lib/Breadcrumbs/Breadcrumbs.d.ts +9 -0
  12. package/src/lib/Breadcrumbs/Breadcrumbs.styled.d.ts +2 -0
  13. package/src/lib/Breadcrumbs/{index.ts → index.d.ts} +1 -1
  14. package/src/lib/ContentLayout/ContentLayout.d.ts +9 -0
  15. package/src/lib/ContentLayout/index.d.ts +1 -0
  16. package/src/lib/Definition/CreateDefinition/CreateDefinition.d.ts +11 -0
  17. package/src/lib/Definition/CreateDefinition/{index.ts → index.d.ts} +1 -1
  18. package/src/lib/Definition/DefinitionFiller/DefinitionFiller.d.ts +10 -0
  19. package/src/lib/Definition/DefinitionFiller/{index.ts → index.d.ts} +1 -1
  20. package/src/lib/Definition/DefinitionValueView/DefinitionValueView.d.ts +8 -0
  21. package/src/lib/Definition/DefinitionValueView/PropertyDataView.d.ts +9 -0
  22. package/src/lib/Definition/DefinitionValueView/{index.ts → index.d.ts} +1 -1
  23. package/src/lib/Definition/{index.ts → index.d.ts} +3 -3
  24. package/src/lib/Forms/BackButton.d.ts +7 -0
  25. package/src/lib/Forms/ControlAceEditor.d.ts +24 -0
  26. package/src/lib/Forms/ControlAutocomplete.d.ts +69 -0
  27. package/src/lib/Forms/ControlCheckbox.d.ts +51 -0
  28. package/src/lib/Forms/ControlDate.d.ts +18 -0
  29. package/src/lib/Forms/ControlDateTime.d.ts +18 -0
  30. package/src/lib/Forms/ControlDebouncedInput.d.ts +4 -0
  31. package/src/lib/Forms/ControlInput.d.ts +59 -0
  32. package/src/lib/Forms/ControlNumberInput.d.ts +51 -0
  33. package/src/lib/Forms/ControlQueryAutocomplete.d.ts +16 -0
  34. package/src/lib/Forms/ControlRadio.d.ts +66 -0
  35. package/src/lib/Forms/ControlSelect.d.ts +67 -0
  36. package/src/lib/Forms/ControlSwitch.d.ts +19 -0
  37. package/src/lib/Forms/ControlTime.d.ts +18 -0
  38. package/src/lib/Forms/CopyButton.d.ts +20 -0
  39. package/src/lib/Forms/{index.ts → index.d.ts} +15 -15
  40. package/src/lib/Forms/useAutocomplete.d.ts +10 -0
  41. package/src/lib/InfoItem/InfoItem.d.ts +10 -0
  42. package/src/lib/InfoItem/{index.ts → index.d.ts} +1 -1
  43. package/src/lib/InfoItem/styles.d.ts +12 -0
  44. package/src/lib/JsonPathPicker/JsonPathPicker.d.ts +10 -0
  45. package/src/lib/JsonPathPicker/PropertyStep.d.ts +11 -0
  46. package/src/lib/JsonPathPicker/{index.ts → index.d.ts} +1 -1
  47. package/src/lib/JsonView/JsonView.d.ts +7 -0
  48. package/src/lib/JsonView/{index.ts → index.d.ts} +1 -1
  49. package/src/lib/Loader/Loader.d.ts +21 -0
  50. package/src/lib/Loader/{index.ts → index.d.ts} +1 -1
  51. package/src/lib/Modals/JsonModalView.d.ts +10 -0
  52. package/src/lib/Modals/{index.ts → index.d.ts} +1 -1
  53. package/src/lib/Property/PropertyFiller/JsonEditor.d.ts +10 -0
  54. package/src/lib/Property/PropertyFiller/MultiplePropertyFiller.d.ts +12 -0
  55. package/src/lib/Property/PropertyFiller/MultiplePropertyWidget.d.ts +11 -0
  56. package/src/lib/Property/PropertyFiller/PropertyFiller.d.ts +12 -0
  57. package/src/lib/Property/PropertyFiller/{index.ts → index.d.ts} +2 -2
  58. package/src/lib/Property/PropertyFiller/usePropertyFiller.d.ts +24 -0
  59. package/src/lib/Property/PropertyFiller/useStyles.d.ts +12 -0
  60. package/src/lib/Property/PropertyValidator/NodeValidator.d.ts +6 -0
  61. package/src/lib/Property/PropertyValidator/NodesList.d.ts +6 -0
  62. package/src/lib/Property/PropertyValidator/NumericTypeValidator.d.ts +8 -0
  63. package/src/lib/Property/PropertyValidator/PropertyValidator.d.ts +6 -0
  64. package/src/lib/Property/PropertyValidator/PropertyValidatorContext.d.ts +3 -0
  65. package/src/lib/Property/PropertyValidator/StringTypeValidator.d.ts +8 -0
  66. package/src/lib/Property/PropertyValidator/ValidationNodeSelector.d.ts +7 -0
  67. package/src/lib/Property/PropertyValidator/index.d.ts +1 -0
  68. package/src/lib/Property/PropertyValueField/BooleanValueField.d.ts +7 -0
  69. package/src/lib/Property/PropertyValueField/DateTimeValueField.d.ts +9 -0
  70. package/src/lib/Property/PropertyValueField/DateValueField.d.ts +9 -0
  71. package/src/lib/Property/PropertyValueField/JsonValueField.d.ts +10 -0
  72. package/src/lib/Property/PropertyValueField/PropertyValueField.d.ts +9 -0
  73. package/src/lib/Property/PropertyValueField/StringValueField.d.ts +9 -0
  74. package/src/lib/Property/PropertyValueField/TimeValueField.d.ts +9 -0
  75. package/src/lib/Property/PropertyValueField/{index.ts → index.d.ts} +1 -1
  76. package/src/lib/Property/PropertyWidget/PropertyWidget.d.ts +13 -0
  77. package/src/lib/Property/PropertyWidget/{index.ts → index.d.ts} +1 -1
  78. package/src/lib/Property/UpsertProperty/CreatePropertiesList.d.ts +13 -0
  79. package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.d.ts +10 -0
  80. package/src/lib/Property/UpsertProperty/CustomPropertyField.d.ts +7 -0
  81. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/BigDecimalPropertyFields.d.ts +6 -0
  82. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/DateAdditionalFields.d.ts +7 -0
  83. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.d.ts +8 -0
  84. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityReferencePropertyFields.d.ts +6 -0
  85. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.d.ts +10 -0
  86. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/StringPropertyFields.d.ts +6 -0
  87. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/{index.ts → index.d.ts} +1 -1
  88. package/src/lib/Property/UpsertProperty/{index.ts → index.d.ts} +2 -2
  89. package/src/lib/Property/UpsertProperty/useCustomFields.d.ts +6 -0
  90. package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.d.ts +8 -0
  91. package/src/lib/Property/ViewPropertiesList/{index.ts → index.d.ts} +1 -1
  92. package/src/lib/Property/ViewProperty/EntityPropertiesShortView.d.ts +7 -0
  93. package/src/lib/Property/ViewProperty/EntityPropertiesView.d.ts +8 -0
  94. package/src/lib/Property/ViewProperty/PropertyDataTable.d.ts +7 -0
  95. package/src/lib/Property/ViewProperty/PropertyItem.d.ts +9 -0
  96. package/src/lib/Property/ViewProperty/ViewProperty.d.ts +9 -0
  97. package/src/lib/Property/ViewProperty/{index.ts → index.d.ts} +1 -1
  98. package/src/lib/Property/{index.ts → index.d.ts} +5 -5
  99. package/src/lib/Sidebar/Sidebar.d.ts +10 -0
  100. package/src/lib/Sidebar/Sidebar.styled.d.ts +117 -0
  101. package/src/lib/Sidebar/SidebarContext.d.ts +11 -0
  102. package/src/lib/Sidebar/SidebarDrawer.d.ts +9 -0
  103. package/src/lib/Sidebar/SidebarLink/MenuIcon.d.ts +7 -0
  104. package/src/lib/Sidebar/SidebarLink/SidebarLink.d.ts +7 -0
  105. package/src/lib/Sidebar/SidebarLink/SidebarLinkItem.d.ts +8 -0
  106. package/src/lib/Sidebar/SidebarLink/SidebarNestedItem.d.ts +10 -0
  107. package/src/lib/Sidebar/SidebarLink/{index.ts → index.d.ts} +2 -2
  108. package/src/lib/Sidebar/index.d.ts +2 -0
  109. package/src/lib/Status/Status.d.ts +8 -0
  110. package/src/lib/Status/{index.ts → index.d.ts} +1 -1
  111. package/src/lib/Status/styles.d.ts +12 -0
  112. package/src/lib/StepperView/StepperView.d.ts +11 -0
  113. package/src/lib/StepperView/{index.ts → index.d.ts} +1 -1
  114. package/src/lib/Table/DataGrid/JsonTypeCell.d.ts +7 -0
  115. package/src/lib/Table/DataGrid/Table.d.ts +49 -0
  116. package/src/lib/Table/DataGrid/TableAction.d.ts +13 -0
  117. package/src/lib/Table/DataGrid/TableColumnMenu.d.ts +3 -0
  118. package/src/lib/Table/DataGrid/TablePagination.d.ts +3 -0
  119. package/src/lib/Table/DataGrid/index.d.ts +2 -0
  120. package/src/lib/Table/DataGrid/styles.d.ts +12 -0
  121. package/src/lib/Table/DataGrid/usePagination.d.ts +5 -0
  122. package/src/lib/Table/DataGrid/useTableQueryPagination.d.ts +11 -0
  123. package/src/lib/Table/DataGrid/useTableQuerySorting.d.ts +6 -0
  124. package/src/lib/Table/SimpleTable/SimpleTable.d.ts +17 -0
  125. package/src/lib/Table/SimpleTable/TableActionCell.d.ts +10 -0
  126. package/src/lib/Table/SimpleTable/index.d.ts +2 -0
  127. package/src/lib/Table/SimpleTable/useTablePagination.d.ts +7 -0
  128. package/src/lib/Table/SimpleTable/useTableSorting.d.ts +6 -0
  129. package/src/lib/Table/index.d.ts +2 -0
  130. package/src/lib/Tabs/RouteTabs.d.ts +11 -0
  131. package/src/lib/Tabs/TabPanel.d.ts +25 -0
  132. package/src/lib/Tabs/{index.ts → index.d.ts} +2 -2
  133. package/src/lib/{index.ts → index.d.ts} +16 -16
  134. package/src/theme/baseTheme.d.ts +2 -0
  135. package/src/theme/index.d.ts +1 -0
  136. package/src/theme/inputThemeOptions.d.ts +117 -0
  137. package/src/theme/stepperThemeOptions.d.ts +16 -0
  138. package/src/theme/tableThemeOptions.d.ts +47 -0
  139. package/src/theme/typographyThemeOptions.d.ts +29 -0
  140. package/src/utils/common.d.ts +7 -0
  141. package/src/utils/dem.d.ts +27 -0
  142. package/src/utils/hooks.d.ts +7 -0
  143. package/src/utils/{index.ts → index.d.ts} +5 -5
  144. package/src/utils/ui-utils.d.ts +14 -0
  145. package/src/utils/validators.d.ts +5 -0
  146. package/.babelrc +0 -13
  147. package/.eslintrc.json +0 -22
  148. package/jest.config.ts +0 -11
  149. package/project.json +0 -94
  150. package/rollup.config.js +0 -146
  151. package/src/assets/chevron_left_gray.svg +0 -3
  152. package/src/consts/index.ts +0 -13
  153. package/src/interfaces/common.ts +0 -18
  154. package/src/interfaces/definition.ts +0 -143
  155. package/src/interfaces/ui.ts +0 -80
  156. package/src/lib/Alert/Alert.tsx +0 -108
  157. package/src/lib/Alert/index.ts +0 -1
  158. package/src/lib/Breadcrumbs/Breadcrumbs.styled.tsx +0 -16
  159. package/src/lib/Breadcrumbs/Breadcrumbs.tsx +0 -40
  160. package/src/lib/ContentLayout/ContentLayout.tsx +0 -31
  161. package/src/lib/ContentLayout/index.ts +0 -1
  162. package/src/lib/Definition/CreateDefinition/CreateDefinition.tsx +0 -78
  163. package/src/lib/Definition/DefinitionFiller/DefinitionFiller.tsx +0 -71
  164. package/src/lib/Definition/DefinitionValueView/DefinitionValueView.tsx +0 -54
  165. package/src/lib/Definition/DefinitionValueView/PropertyDataView.tsx +0 -67
  166. package/src/lib/Forms/BackButton.tsx +0 -46
  167. package/src/lib/Forms/ControlAceEditor.tsx +0 -125
  168. package/src/lib/Forms/ControlAutocomplete.tsx +0 -145
  169. package/src/lib/Forms/ControlCheckbox.tsx +0 -113
  170. package/src/lib/Forms/ControlDate.tsx +0 -75
  171. package/src/lib/Forms/ControlDateTime.tsx +0 -77
  172. package/src/lib/Forms/ControlDebouncedInput.tsx +0 -80
  173. package/src/lib/Forms/ControlInput.tsx +0 -111
  174. package/src/lib/Forms/ControlNumberInput.tsx +0 -121
  175. package/src/lib/Forms/ControlQueryAutocomplete.tsx +0 -197
  176. package/src/lib/Forms/ControlRadio.tsx +0 -136
  177. package/src/lib/Forms/ControlSelect.tsx +0 -164
  178. package/src/lib/Forms/ControlSwitch.tsx +0 -71
  179. package/src/lib/Forms/ControlTime.tsx +0 -93
  180. package/src/lib/Forms/CopyButton.tsx +0 -46
  181. package/src/lib/Forms/useAutocomplete.tsx +0 -47
  182. package/src/lib/InfoItem/InfoItem.tsx +0 -40
  183. package/src/lib/InfoItem/styles.ts +0 -17
  184. package/src/lib/JsonPathPicker/JsonPathPicker.tsx +0 -73
  185. package/src/lib/JsonPathPicker/PropertyStep.tsx +0 -70
  186. package/src/lib/JsonView/JsonView.tsx +0 -41
  187. package/src/lib/Loader/Loader.tsx +0 -41
  188. package/src/lib/Modals/JsonModalView.tsx +0 -53
  189. package/src/lib/Property/PropertyFiller/JsonEditor.tsx +0 -58
  190. package/src/lib/Property/PropertyFiller/MultiplePropertyFiller.tsx +0 -129
  191. package/src/lib/Property/PropertyFiller/MultiplePropertyWidget.tsx +0 -85
  192. package/src/lib/Property/PropertyFiller/PropertyFiller.tsx +0 -199
  193. package/src/lib/Property/PropertyFiller/usePropertyFiller.ts +0 -72
  194. package/src/lib/Property/PropertyFiller/useStyles.ts +0 -12
  195. package/src/lib/Property/PropertyValidator/NodeValidator.tsx +0 -92
  196. package/src/lib/Property/PropertyValidator/NodesList.tsx +0 -26
  197. package/src/lib/Property/PropertyValidator/NumericTypeValidator.tsx +0 -59
  198. package/src/lib/Property/PropertyValidator/PropertyValidator.tsx +0 -42
  199. package/src/lib/Property/PropertyValidator/PropertyValidatorContext.tsx +0 -4
  200. package/src/lib/Property/PropertyValidator/StringTypeValidator.tsx +0 -36
  201. package/src/lib/Property/PropertyValidator/ValidationNodeSelector.tsx +0 -62
  202. package/src/lib/Property/PropertyValidator/index.ts +0 -1
  203. package/src/lib/Property/PropertyValueField/BooleanValueField.tsx +0 -49
  204. package/src/lib/Property/PropertyValueField/DateTimeValueField.tsx +0 -58
  205. package/src/lib/Property/PropertyValueField/DateValueField.tsx +0 -58
  206. package/src/lib/Property/PropertyValueField/JsonValueField.tsx +0 -65
  207. package/src/lib/Property/PropertyValueField/PropertyValueField.tsx +0 -49
  208. package/src/lib/Property/PropertyValueField/StringValueField.tsx +0 -50
  209. package/src/lib/Property/PropertyValueField/TimeValueField.tsx +0 -67
  210. package/src/lib/Property/PropertyWidget/PropertyWidget.tsx +0 -115
  211. package/src/lib/Property/UpsertProperty/CreatePropertiesList.tsx +0 -148
  212. package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.tsx +0 -158
  213. package/src/lib/Property/UpsertProperty/CustomPropertyField.tsx +0 -40
  214. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/BigDecimalPropertyFields.tsx +0 -41
  215. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/DateAdditionalFields.tsx +0 -27
  216. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.tsx +0 -133
  217. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityReferencePropertyFields.tsx +0 -46
  218. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.tsx +0 -52
  219. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/StringPropertyFields.tsx +0 -103
  220. package/src/lib/Property/UpsertProperty/useCustomFields.ts +0 -22
  221. package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.tsx +0 -37
  222. package/src/lib/Property/ViewProperty/EntityPropertiesShortView.tsx +0 -40
  223. package/src/lib/Property/ViewProperty/EntityPropertiesView.tsx +0 -48
  224. package/src/lib/Property/ViewProperty/PropertyDataTable.tsx +0 -148
  225. package/src/lib/Property/ViewProperty/PropertyItem.tsx +0 -43
  226. package/src/lib/Property/ViewProperty/ViewProperty.tsx +0 -52
  227. package/src/lib/Sidebar/Sidebar.styled.tsx +0 -157
  228. package/src/lib/Sidebar/Sidebar.tsx +0 -27
  229. package/src/lib/Sidebar/SidebarContext.tsx +0 -37
  230. package/src/lib/Sidebar/SidebarDrawer.tsx +0 -50
  231. package/src/lib/Sidebar/SidebarLink/MenuIcon.tsx +0 -16
  232. package/src/lib/Sidebar/SidebarLink/SidebarLink.tsx +0 -54
  233. package/src/lib/Sidebar/SidebarLink/SidebarLinkItem.tsx +0 -54
  234. package/src/lib/Sidebar/SidebarLink/SidebarNestedItem.tsx +0 -62
  235. package/src/lib/Sidebar/index.ts +0 -2
  236. package/src/lib/Status/Status.tsx +0 -16
  237. package/src/lib/Status/styles.ts +0 -21
  238. package/src/lib/StepperView/StepperView.tsx +0 -73
  239. package/src/lib/Table/DataGrid/JsonTypeCell.tsx +0 -51
  240. package/src/lib/Table/DataGrid/Table.tsx +0 -117
  241. package/src/lib/Table/DataGrid/TableAction.tsx +0 -43
  242. package/src/lib/Table/DataGrid/TableColumnMenu.tsx +0 -12
  243. package/src/lib/Table/DataGrid/TablePagination.tsx +0 -42
  244. package/src/lib/Table/DataGrid/index.ts +0 -2
  245. package/src/lib/Table/DataGrid/styles.ts +0 -59
  246. package/src/lib/Table/DataGrid/usePagination.ts +0 -15
  247. package/src/lib/Table/DataGrid/useTableQueryPagination.ts +0 -47
  248. package/src/lib/Table/DataGrid/useTableQuerySorting.ts +0 -47
  249. package/src/lib/Table/SimpleTable/SimpleTable.tsx +0 -138
  250. package/src/lib/Table/SimpleTable/TableActionCell.tsx +0 -67
  251. package/src/lib/Table/SimpleTable/index.ts +0 -2
  252. package/src/lib/Table/SimpleTable/useTablePagination.ts +0 -54
  253. package/src/lib/Table/SimpleTable/useTableSorting.ts +0 -50
  254. package/src/lib/Table/index.ts +0 -2
  255. package/src/lib/Tabs/RouteTabs.tsx +0 -54
  256. package/src/lib/Tabs/TabPanel.tsx +0 -42
  257. package/src/theme/baseTheme.ts +0 -128
  258. package/src/theme/fonts.d.ts +0 -2
  259. package/src/theme/index.ts +0 -126
  260. package/src/theme/inputThemeOptions.ts +0 -126
  261. package/src/theme/stepperThemeOptions.ts +0 -20
  262. package/src/theme/tableThemeOptions.ts +0 -50
  263. package/src/theme/typographyThemeOptions.ts +0 -32
  264. package/src/utils/common.ts +0 -73
  265. package/src/utils/dem.ts +0 -431
  266. package/src/utils/hooks.ts +0 -41
  267. package/src/utils/ui-utils.tsx +0 -102
  268. package/src/utils/validators.ts +0 -14
  269. package/tsconfig.json +0 -25
  270. package/tsconfig.lib.json +0 -23
  271. package/tsconfig.spec.json +0 -20
@@ -1,41 +0,0 @@
1
- import Box from "@mui/material/Box";
2
- import CircularProgress from "@mui/material/CircularProgress";
3
-
4
- /**
5
- * This interface is referencing the [[Loader]] component props.
6
- * @category Common UI components
7
- */
8
- export interface LoaderProps {
9
- /**
10
- * Background transparency flag. Default: `rgba(255, 255, 255, .3)`
11
- */
12
- transparent?: boolean;
13
- /**
14
- * CSS `position` property. Default: `absolute`
15
- */
16
- position?: 'absolute' | 'relative' | 'fixed';
17
- }
18
- /**
19
- * Loader screen component. Used in the data loading process
20
- * @category Common UI components
21
- */
22
- export const Loader = ({ transparent, position }: LoaderProps) => {
23
- return (
24
- <Box
25
- position={position ?? 'absolute'}
26
- top={0}
27
- left={0}
28
- width="100%"
29
- height="100%"
30
- display="flex"
31
- alignItems="center"
32
- justifyContent="center"
33
- bgcolor={transparent ? 'none' : 'rgba(255, 255, 255, .3)'}
34
- zIndex={10}
35
- >
36
- <CircularProgress />
37
- </Box>
38
- )
39
- }
40
-
41
- export default Loader;
@@ -1,53 +0,0 @@
1
- import React from 'react';
2
- import AceEditor from 'react-ace';
3
- import 'ace-builds/src-noconflict/ace';
4
- import 'ace-builds/src-noconflict/mode-json';
5
- import Dialog from '@mui/material/Dialog';
6
- import DialogContent from '@mui/material/DialogContent';
7
- import DialogActions from '@mui/material/DialogActions';
8
- import Button from '@mui/material/Button';
9
- import { CopyButton } from '../Forms';
10
-
11
- type Props = {
12
- open: boolean;
13
- value: string;
14
- onClose: () => void;
15
- };
16
-
17
- export const JsonModalView: React.FC<Props> = ({ open, onClose, value }) => {
18
- return (
19
- <Dialog
20
- disableEscapeKeyDown
21
- open={open}
22
- onClose={onClose}
23
- fullWidth
24
- maxWidth="md"
25
- style={{ width: 800, left: '30%' }}
26
- >
27
- <DialogContent>
28
- <AceEditor
29
- readOnly
30
- value={value}
31
- mode="json"
32
- width="100%"
33
- fontSize="16"
34
- setOptions={{
35
- enableSnippets: false,
36
- copyWithEmptySelection: true,
37
- showLineNumbers: true,
38
- tabSize: 2,
39
- useWorker: false
40
- }}
41
- />
42
- </DialogContent>
43
- <DialogActions>
44
- <CopyButton copyText={value} />
45
- <Button onClick={onClose} variant="contained" color="secondary">
46
- Close
47
- </Button>
48
- </DialogActions>
49
- </Dialog>
50
- );
51
- };
52
-
53
- export default JsonModalView;
@@ -1,58 +0,0 @@
1
- import AceEditor from 'react-ace';
2
- import 'ace-builds/src-noconflict/mode-json';
3
- import { RefCallBack, useFormContext, useWatch } from 'react-hook-form';
4
-
5
- type Props = {
6
- validate?: boolean;
7
- name: string;
8
- inputRef: RefCallBack;
9
- };
10
-
11
- const JsonEditor = ({ validate = false, name, inputRef }: Props) => {
12
- const { control, setValue, setError, clearErrors } = useFormContext();
13
- const value = useWatch({ control, name });
14
-
15
- const handleChange = (value: string) => {
16
- setValue(name, value);
17
-
18
- if (validate) {
19
- try {
20
- JSON.parse(value);
21
- clearErrors(name);
22
- } catch (err) {
23
- setError(name, { message: 'Invalid JSON' });
24
- }
25
- }
26
- };
27
-
28
- return (
29
- <AceEditor
30
- wrapEnabled
31
- width="100%"
32
- height="200px"
33
- theme="monokai"
34
- fontSize={14}
35
- showPrintMargin={false}
36
- style={{ lineHeight: 1.4, zIndex: 0, isolation: 'isolate' }}
37
- setOptions={{
38
- enableLiveAutocompletion: true,
39
- enableBasicAutocompletion: true,
40
- showLineNumbers: true,
41
- tabSize: 2,
42
- useWorker: false
43
- }}
44
- ref={inputRef}
45
- name={name}
46
- value={typeof value !== 'string' ? (value === null ? '' : JSON.stringify(value)) : value}
47
- onChange={handleChange}
48
- mode="json"
49
- onLoad={(editor) => {
50
- if (!validate) {
51
- editor.getSession().setUseWorker(false);
52
- }
53
- }}
54
- />
55
- );
56
- };
57
-
58
- export default JsonEditor;
@@ -1,129 +0,0 @@
1
- import Box from '@mui/material/Box';
2
- import Grid from '@mui/material/Unstable_Grid2';
3
- import Select, { SelectChangeEvent } from '@mui/material/Select';
4
- import MenuItem from '@mui/material/MenuItem';
5
- import FormControl from '@mui/material/FormControl';
6
- import InputLabel from '@mui/material/InputLabel';
7
- import Typography from '@mui/material/Typography';
8
- import JsonEditor from './JsonEditor';
9
- import MultiplePropertyWidget from './MultiplePropertyWidget';
10
- import { ControlInput } from '../../Forms';
11
-
12
- import { useEffect } from 'react';
13
- import { useController, useFormContext, useWatch } from 'react-hook-form';
14
- import usePropertyFiller from './usePropertyFiller';
15
- import useStyles from './useStyles';
16
-
17
- import { PropertyFillType, PropertyType, PropertyUnion } from '../../../interfaces';
18
-
19
- type Props = {
20
- property: PropertyUnion;
21
- name: string;
22
- useExpression?: boolean;
23
- required?: boolean;
24
- label?: string;
25
- title?: string;
26
- };
27
-
28
- export const MultiplePropertyFiller = ({ property, name, useExpression, required, label, title }: Props) => {
29
- const { control, clearErrors } = useFormContext();
30
- const {
31
- field: { ref, onChange },
32
- fieldState: { error, isDirty },
33
- } = useController({
34
- control,
35
- name,
36
- rules: {
37
- validate: (val) => {
38
- if (required && !val) {
39
- return 'Please, fill this field';
40
- }
41
- return true;
42
- },
43
- },
44
- });
45
- const value = useWatch({ control, name });
46
-
47
- const { propertyType, valueLabel, fillOptionLabel, fillOption, fillOptions, setFillOption } = usePropertyFiller({
48
- property,
49
- value,
50
- isDirty,
51
- label,
52
- required,
53
- useExpression,
54
- multipleOptions: true,
55
- });
56
-
57
- const handleFillOptionChange = (event: SelectChangeEvent<PropertyFillType>) => {
58
- const selectedType = event.target.value as PropertyFillType;
59
-
60
- if (selectedType === 'null') {
61
- onChange(null);
62
- } else if (selectedType === 'expression' || selectedType === 'json_valid' || selectedType === 'json_notvalid') {
63
- onChange('');
64
- } else if (selectedType === 'widget') {
65
- onChange([]);
66
- }
67
- setFillOption(selectedType);
68
- clearErrors(name);
69
- };
70
-
71
- useEffect(() => {
72
- if (value === undefined) {
73
- onChange(null);
74
- }
75
- }, [value, onChange]);
76
-
77
- const { classes } = useStyles();
78
- return (
79
- <Grid>
80
- {title && (
81
- <Box mb={2}>
82
- <Typography variant="h6">{title}</Typography>
83
- </Box>
84
- )}
85
- {fillOptions ? (
86
- <Box mb={2}>
87
- <FormControl fullWidth size="small" variant="outlined">
88
- <InputLabel htmlFor="type-select" className={classes.inputLabel}>
89
- {fillOptionLabel}
90
- </InputLabel>
91
- <Select
92
- labelId="type-select"
93
- label={fillOptionLabel}
94
- value={fillOption || ''}
95
- onChange={handleFillOptionChange}
96
- >
97
- {fillOptions.map((option) => (
98
- <MenuItem key={option.value} value={option.value}>
99
- {option.label}
100
- </MenuItem>
101
- ))}
102
- </Select>
103
- </FormControl>
104
- </Box>
105
- ) : null}
106
- {fillOption === 'expression' &&
107
- (propertyType === PropertyType.JSON ||
108
- propertyType === PropertyType.ENTITY ||
109
- propertyType === PropertyType.ANY ? (
110
- <JsonEditor name={name} inputRef={ref} />
111
- ) : (
112
- <ControlInput required hideErrorMessage control={control} name={name} label={valueLabel} />
113
- ))}
114
- {fillOption === 'json_valid' && <JsonEditor validate name={name} inputRef={ref} />}
115
- {fillOption === 'widget' && (
116
- <MultiplePropertyWidget
117
- property={property}
118
- name={name}
119
- useExpression={useExpression}
120
- required={required}
121
- label={label}
122
- />
123
- )}
124
- {error && <Typography color="secondary">{error.message}</Typography>}
125
- </Grid>
126
- );
127
- };
128
-
129
- export default MultiplePropertyFiller;
@@ -1,85 +0,0 @@
1
- import Box from '@mui/material/Box';
2
- import Grid from '@mui/material/Unstable_Grid2';
3
- import Button from '@mui/material/Button';
4
- import IconButton from '@mui/material/IconButton';
5
- import CloseIcon from '@mui/icons-material/Close';
6
- import PropertyFiller from './PropertyFiller';
7
-
8
- import { useCallback } from 'react';
9
- import { useController, useFormContext, useWatch } from 'react-hook-form';
10
- import { removeArrayItem } from '../../../utils';
11
-
12
- import { PropertyUnion } from '../../../interfaces';
13
-
14
- type Props = {
15
- name: string;
16
- property: PropertyUnion;
17
- useExpression?: boolean;
18
- required?: boolean;
19
- label?: string;
20
- };
21
-
22
- const MultiplePropertyWidget = ({ name, property, useExpression, required, label }: Props) => {
23
- const { control, setValue, clearErrors } = useFormContext();
24
- const controller = useController({
25
- control,
26
- name,
27
- rules: {
28
- validate: (val) => {
29
- if (!val || (Array.isArray(val) && !val.length)) {
30
- return 'Please, fill array';
31
- }
32
- return true;
33
- },
34
- },
35
- });
36
- const values = useWatch({ control, name });
37
-
38
- const handleAddValue = useCallback(() => {
39
- if (values && Array.isArray(values)) {
40
- setValue(`${name}.${values.length}`, null);
41
- } else {
42
- setValue(name, [null]);
43
- }
44
- clearErrors(name);
45
- }, [name, values, setValue, clearErrors]);
46
-
47
- const handleDeleteValue = useCallback(
48
- (index) => {
49
- setValue(name, removeArrayItem(values, index));
50
- },
51
- [name, values, setValue]
52
- );
53
-
54
- return (
55
- <Grid container spacing={2} direction="column" xs={12}>
56
- {values && Array.isArray(values)
57
- ? values.map((value, index) => (
58
- <Grid key={index} xs={12}>
59
- <Box display="flex" alignItems="flex-start" width="100%" p={2} style={{ backgroundColor: '#f1f1f1' }}>
60
- <PropertyFiller
61
- required={required}
62
- property={property}
63
- useExpression={useExpression}
64
- name={`${name}.${index}`}
65
- label={`${label || property.name} (${index + 1})`}
66
- />
67
- <Box mt="8px" ml="4px">
68
- <IconButton size="small" onClick={() => handleDeleteValue(index)}>
69
- <CloseIcon fontSize="small" />
70
- </IconButton>
71
- </Box>
72
- </Box>
73
- </Grid>
74
- ))
75
- : null}
76
- <Grid>
77
- <Button variant="contained" size="small" color="primary" onClick={handleAddValue}>
78
- Add value
79
- </Button>
80
- </Grid>
81
- </Grid>
82
- );
83
- };
84
-
85
- export default MultiplePropertyWidget;
@@ -1,199 +0,0 @@
1
- import Box from '@mui/material/Box';
2
- import Grid from '@mui/material/Unstable_Grid2';
3
- import Select, { SelectChangeEvent } from '@mui/material/Select';
4
- import MenuItem from '@mui/material/MenuItem';
5
- import FormControl from '@mui/material/FormControl';
6
- import InputLabel from '@mui/material/InputLabel';
7
- import Typography from '@mui/material/Typography';
8
- import JsonEditor from './JsonEditor';
9
- import { ControlInput } from '../../Forms';
10
- import { PropertyWidget } from '../PropertyWidget';
11
-
12
- import { useEffect } from 'react';
13
- import { useController, useFormContext, useWatch } from 'react-hook-form';
14
- import usePropertyFiller from './usePropertyFiller';
15
- import useStyles from './useStyles';
16
-
17
- import {
18
- PropertyFillType,
19
- PropertyType,
20
- PropertyUnion,
21
- } from '../../../interfaces';
22
- import { CreateDefinition } from '../../Definition';
23
- import { defaultDefinitionArrayValue } from '../../../consts';
24
- import {
25
- propertiesArrayToObject,
26
- propertiesObjectToArray,
27
- } from '../../../utils';
28
-
29
- type Props = {
30
- property: PropertyUnion;
31
- name: string;
32
- useExpression?: boolean;
33
- label?: string;
34
- required?: boolean;
35
- title?: string;
36
- };
37
-
38
- export const PropertyFiller = ({
39
- property,
40
- name,
41
- useExpression,
42
- label,
43
- required,
44
- title,
45
- }: Props) => {
46
- const { control, clearErrors } = useFormContext();
47
- const {
48
- field: { ref, onChange },
49
- fieldState: { error, isDirty },
50
- } = useController({
51
- name,
52
- });
53
- const value = useWatch({ control, name });
54
-
55
- const {
56
- propertyType,
57
- valueLabel,
58
- fillOptionLabel,
59
- fillOption,
60
- fillOptions,
61
- setFillOption,
62
- } = usePropertyFiller({
63
- value,
64
- property,
65
- isDirty,
66
- label,
67
- required,
68
- useExpression,
69
- });
70
-
71
- const handleFillOptionChange = (
72
- event: SelectChangeEvent<PropertyFillType>
73
- ) => {
74
- const selectedType = event.target.value as PropertyFillType;
75
- if (selectedType === 'null') {
76
- onChange(null);
77
- // register(name, { value: null });
78
- } else if (selectedType === 'widget') {
79
- if (
80
- propertyType === PropertyType.JSON &&
81
- value &&
82
- typeof value !== 'string' &&
83
- fillOption === 'dem_builder' &&
84
- 'properties' in value
85
- ) {
86
- const definitionValue = {
87
- ...value,
88
- properties: propertiesArrayToObject(value.property || []),
89
- };
90
- try {
91
- onChange(JSON.stringify(definitionValue, null, '\t'));
92
- } catch (error) {
93
- console.log('Stringify failed');
94
- }
95
- } else {
96
- onChange(null);
97
- }
98
- } else if (selectedType === 'expression' || selectedType === 'string') {
99
- onChange('');
100
- } else if (selectedType === 'dem_builder') {
101
- if (value) {
102
- try {
103
- const definitionValue = JSON.parse(value);
104
- definitionValue['properties'] = propertiesObjectToArray(
105
- definitionValue['properties'] || {}
106
- );
107
- onChange(definitionValue);
108
- } catch (error) {
109
- onChange(defaultDefinitionArrayValue);
110
- console.log('Parse failed');
111
- }
112
- } else {
113
- onChange(defaultDefinitionArrayValue);
114
- }
115
- }
116
- setFillOption(selectedType);
117
- clearErrors(name);
118
- };
119
-
120
- useEffect(() => {
121
- if (value === undefined) {
122
- onChange(null);
123
- }
124
- }, [value, onChange]);
125
-
126
- const { classes } = useStyles();
127
- return (
128
- <Grid xs={12}>
129
- {title && (
130
- <Box mb={2}>
131
- <Typography variant="h6">{title}</Typography>
132
- </Box>
133
- )}
134
- {fillOptions ? (
135
- <Box mb={2}>
136
- <FormControl fullWidth size="small" variant="outlined">
137
- <InputLabel htmlFor="type-select" className={classes.inputLabel}>
138
- {fillOptionLabel}
139
- </InputLabel>
140
- <Select
141
- labelId="type-select"
142
- label={fillOptionLabel}
143
- value={fillOption || ''}
144
- onChange={handleFillOptionChange}
145
- >
146
- {fillOptions.map((option) => (
147
- <MenuItem key={option.value} value={option.value}>
148
- {option.label}
149
- </MenuItem>
150
- ))}
151
- </Select>
152
- </FormControl>
153
- </Box>
154
- ) : null}
155
- {fillOption === 'expression' &&
156
- (propertyType === PropertyType.JSON ||
157
- propertyType === PropertyType.ENTITY ||
158
- propertyType === PropertyType.ANY ? (
159
- <JsonEditor name={name} inputRef={ref} />
160
- ) : (
161
- <ControlInput
162
- control={control}
163
- name={name}
164
- label={valueLabel}
165
- required
166
- hideErrorMessage
167
- />
168
- ))}
169
- {fillOption === 'string' && (
170
- <ControlInput
171
- control={control}
172
- name={name}
173
- label={valueLabel}
174
- required
175
- hideErrorMessage
176
- />
177
- )}
178
- {fillOption === 'json_notvalid' && (
179
- <JsonEditor name={name} inputRef={ref} />
180
- )}
181
- {fillOption === 'widget' && (
182
- <PropertyWidget
183
- property={property}
184
- name={name}
185
- useExpression={useExpression}
186
- label={valueLabel}
187
- inputRef={ref}
188
- required={required}
189
- />
190
- )}
191
- {fillOption === 'dem_builder' && (
192
- <CreateDefinition title="JSON" definitionFieldName={name} />
193
- )}
194
- {error && <Typography color="secondary">{error.message}</Typography>}
195
- </Grid>
196
- );
197
- };
198
-
199
- export default PropertyFiller;
@@ -1,72 +0,0 @@
1
- import { useEffect, useMemo, useState } from 'react';
2
- import {
3
- getMultiplePropertyFillOptions,
4
- getSinglePropertyFillOptions,
5
- isExpression,
6
- isPropertyValueEmpty,
7
- } from '../../../utils';
8
-
9
- import { PropertyFillType, PropertyUnion } from '../../../interfaces';
10
-
11
- type Props = {
12
- value: unknown;
13
- property: PropertyUnion;
14
- isDirty: boolean;
15
- label?: string;
16
- required?: boolean;
17
- useExpression?: boolean;
18
- multipleOptions?: boolean;
19
- };
20
-
21
- const usePropertyFiller = ({
22
- value,
23
- property,
24
- label,
25
- isDirty,
26
- required = false,
27
- useExpression = false,
28
- multipleOptions = false,
29
- }: Props) => {
30
- const valueLabel = useMemo(() => (label ? `${label} (value)` : `${property.name} (value)`), [label, property]);
31
- const fillOptionLabel = useMemo(() => (label ? `${label} (widget)` : `${property.name} (widget)`), [label, property]);
32
-
33
- const propertyType = useMemo(
34
- () => (typeof property.propertyType === 'string' ? property.propertyType : property['propertyType']['value']),
35
- [property]
36
- );
37
-
38
- const [fillOption, setFillOption] = useState<PropertyFillType>(null);
39
- const fillOptions = useMemo(
40
- () =>
41
- multipleOptions
42
- ? getMultiplePropertyFillOptions({ propertyType, required, useExpression })
43
- : getSinglePropertyFillOptions({
44
- propertyType,
45
- required,
46
- useExpression,
47
- }),
48
- [useExpression, required, propertyType, multipleOptions]
49
- );
50
-
51
- useEffect(() => {
52
- if (!fillOption) {
53
- if (isPropertyValueEmpty(value) && fillOptions?.length) {
54
- setFillOption(fillOptions[0].value);
55
- } else if (useExpression && isExpression(value)) {
56
- setFillOption('expression');
57
- } else {
58
- setFillOption('widget');
59
- }
60
- } else if (!isDirty) {
61
- if (isExpression(value) && fillOption !== 'expression') {
62
- setFillOption('expression');
63
- } else if (value !== null && value !== undefined && !isExpression(value) && fillOption !== 'widget') {
64
- setFillOption('widget');
65
- }
66
- }
67
- }, [value, fillOption, fillOptions, useExpression, isDirty]);
68
-
69
- return { propertyType, valueLabel, fillOptionLabel, fillOption, fillOptions, setFillOption };
70
- };
71
-
72
- export default usePropertyFiller;
@@ -1,12 +0,0 @@
1
- import { makeStyles } from 'tss-react/mui';
2
-
3
- const useStyles = makeStyles()(() => ({
4
- inputLabel: {
5
- overflow: 'hidden',
6
- whiteSpace: 'nowrap',
7
- textOverflow: 'ellipsis',
8
- width: '100%',
9
- },
10
- }));
11
-
12
- export default useStyles;