@dartech/arsenal-ui 1.2.6 → 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 -132
  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,133 +0,0 @@
1
- import Grid from '@mui/material/Unstable_Grid2';
2
- import Button from '@mui/material/Button';
3
- import Typography from '@mui/material/Typography';
4
- import Dialog from '@mui/material/Dialog';
5
- import DialogTitle from '@mui/material/DialogTitle';
6
- import DialogContent from '@mui/material/DialogContent';
7
- import DialogActions from '@mui/material/DialogActions';
8
- import Stepper from '@mui/material/Stepper';
9
- import Step from '@mui/material/Step';
10
- import StepLabel from '@mui/material/StepLabel';
11
- import StepContent from '@mui/material/StepContent';
12
- import CreatePropertiesList from '../CreatePropertiesList';
13
- import EntityPropertiesShortView from '../../ViewProperty/EntityPropertiesShortView';
14
-
15
- import { useCallback, useState } from 'react';
16
- import { useFormContext, useWatch } from 'react-hook-form';
17
- import { useToggle } from '../../../../utils/hooks';
18
-
19
- type Props = {
20
- parentPropertyFieldName: string;
21
- entityDefinition?: boolean;
22
- globalParameter?: boolean;
23
- };
24
-
25
- const defaultPropertyValues = {
26
- key: '',
27
- propertyType: '',
28
- name: '',
29
- defaultValue: '',
30
- isRequired: true,
31
- isMultiple: false,
32
- sortOrder: 0,
33
- isEnabled: true,
34
- };
35
-
36
- const EntityAdditionalFields = ({
37
- parentPropertyFieldName,
38
- entityDefinition = false,
39
- globalParameter = false,
40
- }: Props) => {
41
- const { control, setValue, getValues, trigger } = useFormContext();
42
- const properties = useWatch({
43
- control,
44
- name: `${parentPropertyFieldName}.properties`,
45
- defaultValue: getValues(`${parentPropertyFieldName}.properties`) || [],
46
- });
47
- const parentPropertyName = useWatch({ control, name: `${parentPropertyFieldName}.name` });
48
-
49
- const parametersModal = useToggle();
50
-
51
- const [focusedProperty, setFocusedProperty] = useState(0);
52
-
53
- const handleAddParameter = useCallback(() => {
54
- if (properties) {
55
- const propertyIndex = properties.length;
56
- setValue(`${parentPropertyFieldName}.properties.${propertyIndex}`, defaultPropertyValues);
57
- setFocusedProperty(propertyIndex);
58
- } else {
59
- setValue(`${parentPropertyFieldName}.properties`, [defaultPropertyValues]);
60
- }
61
- }, [properties, parentPropertyFieldName, setValue]);
62
-
63
- const handleStepperClick = (index) => setFocusedProperty(index);
64
-
65
- const handleSubmitClick = async () => {
66
- const isValid = await trigger(`${parentPropertyFieldName}.properties`);
67
- if (isValid) {
68
- parametersModal.onClose();
69
- }
70
- };
71
-
72
- return (
73
- <>
74
- <Grid>
75
- <Typography variant="h6">Properties</Typography>
76
- </Grid>
77
- <Grid>
78
- <EntityPropertiesShortView properties={properties} />
79
- </Grid>
80
- <Grid>
81
- <Button variant="contained" color="primary" onClick={parametersModal.onOpen}>
82
- Edit properties
83
- </Button>
84
- </Grid>
85
-
86
- <Dialog disableEscapeKeyDown open={parametersModal.open} onClose={handleSubmitClick} fullWidth maxWidth="md">
87
- <DialogTitle>{parentPropertyName || 'Entity'} Properties</DialogTitle>
88
- <DialogContent style={{ height: '500px', overflow: 'hidden' }}>
89
- <Grid container direction="row" spacing={2} style={{ height: '100%' }}>
90
- <Grid xs={3} style={{ backgroundColor: '#f9f9f9' }}>
91
- <Stepper nonLinear activeStep={focusedProperty} orientation="vertical" style={{ paddingLeft: '4px' }}>
92
- {properties.map((property, index) => (
93
- <Step key={index} onClick={() => handleStepperClick(index)} style={{ cursor: 'pointer' }}>
94
- <StepLabel StepIconProps={{ icon: '' }} style={{ wordBreak: 'break-word' }}>
95
- {property.name || '(no name)'}
96
- </StepLabel>
97
- <StepContent></StepContent>
98
- </Step>
99
- ))}
100
- </Stepper>
101
- <Button variant="contained" size="small" color="primary" onClick={handleAddParameter}>
102
- Add property
103
- </Button>
104
- </Grid>
105
- <Grid
106
- container
107
- wrap="nowrap"
108
- direction="column"
109
- xs={9}
110
- spacing={2}
111
- style={{ height: '100%', overflowY: 'auto' }}
112
- >
113
- <CreatePropertiesList
114
- hideAddButton
115
- parentFieldName={parentPropertyFieldName}
116
- focusOnIndex={focusedProperty}
117
- entityDefinition={entityDefinition}
118
- globalParameter={globalParameter}
119
- />
120
- </Grid>
121
- </Grid>
122
- </DialogContent>
123
- <DialogActions>
124
- <Button variant="contained" color="primary" onClick={handleSubmitClick}>
125
- Ok
126
- </Button>
127
- </DialogActions>
128
- </Dialog>
129
- </>
130
- );
131
- };
132
-
133
- export default EntityAdditionalFields;
@@ -1,46 +0,0 @@
1
- import Grid from '@mui/material/Unstable_Grid2';
2
- import { ControlInput } from '../../../Forms';
3
-
4
- import { useFormContext } from 'react-hook-form';
5
-
6
- type Props = {
7
- propertyFieldName: string;
8
- };
9
-
10
- const EntityReferencePropertyFields = ({ propertyFieldName }: Props) => {
11
- const { control } = useFormContext();
12
-
13
- return (
14
- <>
15
- <Grid>
16
- <ControlInput required control={control} name={`${propertyFieldName}.definitionCode`} label="Definition Code" />
17
- </Grid>
18
- <Grid>
19
- <ControlInput
20
- required
21
- control={control}
22
- name={`${propertyFieldName}.definitionVersion`}
23
- label="Definition Version"
24
- />
25
- </Grid>
26
- <Grid>
27
- <ControlInput
28
- required
29
- control={control}
30
- name={`${propertyFieldName}.labelPropertyCode`}
31
- label="Label Property Code"
32
- />
33
- </Grid>
34
- <Grid>
35
- <ControlInput
36
- required
37
- control={control}
38
- name={`${propertyFieldName}.valuePropertyCode`}
39
- label="Value Property Code"
40
- />
41
- </Grid>
42
- </>
43
- );
44
- };
45
-
46
- export default EntityReferencePropertyFields;
@@ -1,52 +0,0 @@
1
- import {
2
- PropertyType,
3
- DATE_DEFAULT_FORMAT,
4
- DATE_TIME_DEFAULT_FORMAT,
5
- TIME_DEFAULT_FORMAT,
6
- } from '../../../../interfaces';
7
- import BigDecimalPropertyFields from './BigDecimalPropertyFields';
8
- import DateAdditionalFields from './DateAdditionalFields';
9
- import EntityAdditionalFields from './EntityAdditionalFields';
10
- import EntityReferencePropertyFields from './EntityReferencePropertyFields';
11
- import StringPropertyFields from './StringPropertyFields';
12
-
13
- type Props = {
14
- propertyType: PropertyType;
15
- propertyFieldName: string;
16
- entityDefinition?: boolean;
17
- globalParameter?: boolean;
18
- };
19
-
20
- export const PropertyAdditionalFields = ({
21
- propertyType,
22
- propertyFieldName,
23
- entityDefinition = false,
24
- globalParameter = false,
25
- }: Props) => {
26
- switch (propertyType) {
27
- case PropertyType.STRING:
28
- return <StringPropertyFields propertyFieldName={propertyFieldName} />;
29
- case PropertyType.BIG_DECIMAL:
30
- return <BigDecimalPropertyFields propertyFieldName={propertyFieldName} />;
31
- case PropertyType.DATE:
32
- return <DateAdditionalFields propertyFieldName={propertyFieldName} defaultValue={DATE_DEFAULT_FORMAT} />;
33
- case PropertyType.TIME:
34
- return <DateAdditionalFields propertyFieldName={propertyFieldName} defaultValue={TIME_DEFAULT_FORMAT} />;
35
- case PropertyType.DATE_TIME:
36
- return <DateAdditionalFields propertyFieldName={propertyFieldName} defaultValue={DATE_TIME_DEFAULT_FORMAT} />;
37
- case PropertyType.ENTITY_REFERENCE:
38
- return <EntityReferencePropertyFields propertyFieldName={propertyFieldName} />;
39
- case PropertyType.ENTITY:
40
- return (
41
- <EntityAdditionalFields
42
- parentPropertyFieldName={propertyFieldName}
43
- globalParameter={globalParameter}
44
- entityDefinition={entityDefinition}
45
- />
46
- );
47
- default:
48
- return null;
49
- }
50
- };
51
-
52
- export default PropertyAdditionalFields;
@@ -1,103 +0,0 @@
1
- import Grid from '@mui/material/Unstable_Grid2';
2
- import Chip from '@mui/material/Chip';
3
- import Box from '@mui/material/Box';
4
- import Typography from '@mui/material/Typography';
5
- import TextField from '@mui/material/TextField';
6
- import IconButton from '@mui/material/IconButton';
7
- import AddIcon from '@mui/icons-material/Add';
8
-
9
- import { useFormContext, useWatch } from 'react-hook-form';
10
- import { removeArrayItem } from '../../../../utils';
11
- import { useCallback, useMemo, useState } from 'react';
12
-
13
- type Props = {
14
- propertyFieldName: string;
15
- };
16
-
17
- const StringPropertyFields = ({ propertyFieldName }: Props) => {
18
- const fieldName = useMemo(() => `${propertyFieldName}.restrictedValues`, [propertyFieldName]);
19
-
20
- const { control, setValue, getValues } = useFormContext();
21
- const restrictedValues = useWatch({
22
- control,
23
- name: fieldName,
24
- defaultValue: getValues(`${propertyFieldName}.restrictedValues`) || [],
25
- });
26
-
27
- const [inputValue, setInputValue] = useState('');
28
- const [error, setError] = useState('');
29
-
30
- const handleDelete = useCallback(
31
- (index) => {
32
- setValue(fieldName, removeArrayItem(restrictedValues, index));
33
- },
34
- [restrictedValues, fieldName, setValue]
35
- );
36
-
37
- const handleAddValue = () => {
38
- if (inputValue) {
39
- setValue(fieldName, [...restrictedValues, inputValue]);
40
- setInputValue('');
41
- }
42
- };
43
-
44
- const handleInputChange = (e) => {
45
- const { value } = e.target;
46
- setInputValue(value);
47
-
48
- if (restrictedValues.includes(value)) {
49
- setError('This value already exists');
50
- } else {
51
- setError('');
52
- }
53
- };
54
-
55
- const handleKeyDown = (e) => {
56
- if (e.key === 'Enter') {
57
- handleAddValue();
58
- }
59
- };
60
-
61
- return (
62
- <>
63
- <Grid>
64
- <Typography variant="h6">Restricted Values</Typography>
65
- </Grid>
66
- {
67
- !!restrictedValues?.length && (
68
- <Grid>
69
- <Box display="flex" flexWrap="wrap">
70
- {restrictedValues.map((value, index) => (
71
- <Chip sx={{ mr: 1 }} key={index} variant="outlined" label={value} onDelete={() => handleDelete(index)} />
72
- ))}
73
- </Box>
74
- </Grid>
75
- )
76
- }
77
-
78
- <Grid>
79
- <TextField
80
- fullWidth
81
- variant="outlined"
82
- size="small"
83
- label="Add restricted value"
84
- value={inputValue}
85
- onChange={handleInputChange}
86
- error={!!error}
87
- helperText={error}
88
- name="restrictedValues"
89
- inputProps={{ onKeyDown: handleKeyDown }}
90
- InputProps={{
91
- endAdornment: (
92
- <IconButton size="small" onClick={handleAddValue} disabled={!!error}>
93
- <AddIcon />
94
- </IconButton>
95
- ),
96
- }}
97
- />
98
- </Grid>
99
- </>
100
- );
101
- };
102
-
103
- export default StringPropertyFields;
@@ -1,22 +0,0 @@
1
- import { useMemo } from 'react';
2
- import { CustomPropertyFieldProps } from '../../../interfaces';
3
-
4
- const useCustomFields = (customPropertyFields: CustomPropertyFieldProps[]) => {
5
- const customCheckboxes = useMemo(() => {
6
- if (customPropertyFields.length) {
7
- return customPropertyFields.filter((field) => field.type === 'checkbox');
8
- }
9
- return [];
10
- }, [customPropertyFields]);
11
-
12
- const customFields = useMemo(() => {
13
- if (customPropertyFields.length) {
14
- return customPropertyFields.filter((field) => field.type !== 'checkbox');
15
- }
16
- return [];
17
- }, [customPropertyFields]);
18
-
19
- return { customCheckboxes, customFields };
20
- };
21
-
22
- export default useCustomFields;
@@ -1,37 +0,0 @@
1
- import Box from '@mui/material/Box';
2
- import Typography from '@mui/material/Typography';
3
- import { ViewProperty } from '../ViewProperty';
4
-
5
- import { useMemo } from 'react';
6
- import { propertiesObjectToArray } from '../../../utils';
7
- import { PropertiesArrayType, PropertiesObjectType } from '../../../interfaces';
8
-
9
- type Props = {
10
- properties: PropertiesObjectType<unknown> | PropertiesArrayType<unknown>;
11
- expandAll?: boolean;
12
- };
13
-
14
- export const ViewPropertiesList = ({ properties, expandAll = true }: Props) => {
15
- const propertiesList = useMemo(() => {
16
- if (Array.isArray(properties)) {
17
- return properties;
18
- } else if (properties) {
19
- return propertiesObjectToArray(properties);
20
- }
21
- return [];
22
- }, [properties]);
23
-
24
- return (
25
- <Box display="flex" flexDirection="column">
26
- {propertiesList.length ? (
27
- propertiesList.map((property) => (
28
- <ViewProperty key={property.key} property={property} defaultExpanded={expandAll} />
29
- ))
30
- ) : (
31
- <Typography>No properties</Typography>
32
- )}
33
- </Box>
34
- );
35
- };
36
-
37
- export default ViewPropertiesList;
@@ -1,40 +0,0 @@
1
- import Box from '@mui/material/Box';
2
- import { PropertiesArrayType } from '../../../interfaces';
3
- import { StepperData, StepperView } from '../../StepperView';
4
- import { useMemo } from 'react';
5
-
6
- type Props = {
7
- properties: PropertiesArrayType;
8
- };
9
-
10
- const EntityPropertiesShortView = ({ properties = [] }: Props) => {
11
- const stepperData: StepperData = useMemo(() => {
12
- if (properties) {
13
- return properties.map((property) => {
14
- const propertyType =
15
- typeof property.propertyType === 'string' ? property.propertyType : property['propertyType']['value'];
16
- return {
17
- label: (
18
- <Box display="flex" flexDirection="column">
19
- <b>
20
- {property.name}
21
- {property.isRequired ? '*' : ''}
22
- </b>
23
- <span>
24
- {property.key} | {property.isMultiple ? 'multiple' : 'single'} | {propertyType}
25
- </span>
26
- </Box>
27
- ),
28
- content: property.propertyType === 'ENTITY' && (
29
- <EntityPropertiesShortView properties={property.properties as PropertiesArrayType} />
30
- ),
31
- };
32
- });
33
- }
34
- return [];
35
- }, [properties]);
36
-
37
- return <StepperView data={stepperData} />;
38
- };
39
-
40
- export default EntityPropertiesShortView;
@@ -1,48 +0,0 @@
1
- import Box from '@mui/material/Box';
2
- import Stepper from '@mui/material/Stepper';
3
- import Step from '@mui/material/Step';
4
- import StepLabel from '@mui/material/StepLabel';
5
- import StepContent from '@mui/material/StepContent';
6
- import Typography from '@mui/material/Typography';
7
- import ViewProperty from './ViewProperty';
8
-
9
- import { memo, useMemo } from 'react';
10
- import { PropertiesArrayType, PropertyType } from '../../../interfaces';
11
-
12
- type Props = {
13
- properties: PropertiesArrayType;
14
- parentNames?: string[];
15
- };
16
-
17
- const EntityPropertiesView = ({ properties, parentNames = [] }: Props) => {
18
- const hasProperties = useMemo(() => {
19
- let hasProps = false;
20
- properties.every((property) => {
21
- if (property.propertyType === PropertyType.ENTITY) {
22
- hasProps = true;
23
- return false;
24
- }
25
- return true;
26
- });
27
- return hasProps;
28
- }, [properties]);
29
-
30
- return (
31
- <Box mt={4}>
32
- <Typography variant="h6">Properties</Typography>
33
- <Stepper orientation="vertical" style={{ paddingLeft: '4px' }}>
34
- {properties.map((property) => (
35
- <Step expanded key={property.key}>
36
- <StepLabel StepIconProps={{ icon: '', completed: false, active: true }} />
37
- <StepContent>
38
- <ViewProperty property={property} parentNames={[...parentNames]} defaultExpanded={false} />
39
- </StepContent>
40
- </Step>
41
- ))}
42
- {hasProperties && <Step />}
43
- </Stepper>
44
- </Box>
45
- );
46
- };
47
-
48
- export default memo(EntityPropertiesView);
@@ -1,148 +0,0 @@
1
- import Box from '@mui/material/Box';
2
- import Table from '@mui/material/Table';
3
- import TableBody from '@mui/material/TableBody';
4
- import TableRow from '@mui/material/TableRow';
5
- import TableCell from '@mui/material/TableCell';
6
- import Typography from '@mui/material/Typography';
7
- import Chip from '@mui/material/Chip';
8
- import CheckCircleIcon from '@mui/icons-material/CheckCircle';
9
-
10
- import { useMemo } from 'react';
11
- import { PropertyType, PropertyUnion } from '../../../interfaces';
12
- import { JsonView } from '../../JsonView';
13
-
14
- type Props = {
15
- property: PropertyUnion;
16
- };
17
-
18
- type ValueDisplayProps = {
19
- value: unknown;
20
- type: PropertyType;
21
- };
22
-
23
- const labels = {
24
- name: 'Name',
25
- key: 'Key',
26
- propertyType: 'Property Type',
27
- defaultValue: 'Default Value',
28
- defaultValues: 'Default Values',
29
- sortOrder: 'Sort Order',
30
- isRequired: 'Required',
31
- isMultiple: 'Multiple',
32
- isEnabled: 'Enabled',
33
- isViewableInList: 'Is Viewable In List',
34
- precisionScale: 'Precision Scale',
35
- roundingMode: 'Rounding Mode',
36
- format: 'Format',
37
- definitionCode: 'Definition Code',
38
- definitionVersion: 'Definition Version',
39
- labelPropertyCode: 'Label Property Code',
40
- valuePropertyCode: 'Value Property Code',
41
- restrictedValues: 'Restricted Values',
42
- value: 'Value',
43
- values: 'Values',
44
- uiSettings: 'UI Settings',
45
- validationNode: 'Validation Node',
46
- };
47
-
48
- const ValueDisplay = ({ value, type }: ValueDisplayProps) => {
49
- if ((type === PropertyType.JSON || type === PropertyType.ENTITY || type === PropertyType.ANY) && value) {
50
- return <JsonView value={value} />;
51
- } else {
52
- return (
53
- <Typography variant="subtitle1" display="inline" style={{ wordBreak: 'break-word' }}>
54
- {value === null ? 'null' : value.toString()}
55
- </Typography>
56
- );
57
- }
58
- };
59
-
60
- const formatDiplayValue = (value: any, key: string, type: PropertyType) => {
61
- switch (key) {
62
- case 'isRequired':
63
- case 'isMultiple':
64
- case 'isEnabled':
65
- case 'isViewableInList':
66
- return value ? <CheckCircleIcon color="primary" fontSize="small" /> : null;
67
- case 'restrictedValues':
68
- return value ? (
69
- <Box display="flex" flexWrap="wrap">
70
- {(value as string[]).map((restrictedValue) => (
71
- <Chip
72
- key={restrictedValue}
73
- label={restrictedValue}
74
- style={{ wordBreak: 'break-word', maxWidth: '500px' }}
75
- />
76
- ))}
77
- </Box>
78
- ) : null;
79
- case 'defaultValue':
80
- case 'value':
81
- return <ValueDisplay value={value} type={type} />;
82
- case 'values':
83
- case 'defaultValues':
84
- if (
85
- !Array.isArray(value) ||
86
- type === PropertyType.ENTITY ||
87
- type === PropertyType.JSON ||
88
- type === PropertyType.ANY
89
- ) {
90
- return <JsonView value={value} />;
91
- } else {
92
- return (
93
- <div>
94
- [
95
- {(value as unknown[])?.map((v, index) => (
96
- <div key={index}>
97
- <ValueDisplay value={v} type={type} />
98
- </div>
99
- ))}
100
- ]
101
- </div>
102
- );
103
- }
104
- case 'uiSettings':
105
- case 'validationNode':
106
- return value ? <JsonView value={value} /> : null;
107
- default:
108
- return (
109
- <Typography variant="subtitle1" display="inline" style={{ wordBreak: 'break-word' }}>
110
- {value}
111
- </Typography>
112
- );
113
- }
114
- };
115
-
116
- const PropertyDataTable = ({ property }: Props) => {
117
- const propertyData = useMemo(() => {
118
- if (property) {
119
- if (property.isMultiple) {
120
- delete property.defaultValue;
121
- delete property['value'];
122
- } else {
123
- delete property.defaultValues;
124
- delete property['values'];
125
- }
126
- }
127
- return property;
128
- }, [property]);
129
-
130
- return (
131
- <Table size="small">
132
- <TableBody>
133
- {Object.keys(labels).map((key) =>
134
- key in propertyData ? (
135
- <TableRow key={key}>
136
- <TableCell width="30%">
137
- <Typography>{labels[key]}</Typography>
138
- </TableCell>
139
- <TableCell>{formatDiplayValue(propertyData[key], key, propertyData.propertyType)}</TableCell>
140
- </TableRow>
141
- ) : null
142
- )}
143
- </TableBody>
144
- </Table>
145
- );
146
- };
147
-
148
- export default PropertyDataTable;
@@ -1,43 +0,0 @@
1
- import TreeItem from '@mui/lab/TreeItem';
2
-
3
- import { useMemo } from 'react';
4
- import { PropertiesArrayType, PropertyType, PropertyUnion } from '../../../interfaces';
5
-
6
- type PropertyItemProps = {
7
- property: PropertyUnion;
8
- showName: boolean;
9
- showType: boolean;
10
- };
11
-
12
- const PropertyItem = ({ property, showName, showType }: PropertyItemProps) => {
13
- const label = useMemo(() => {
14
- let labelText = '';
15
-
16
- if (property) {
17
- labelText += `<b>${property.key}</b>`;
18
- }
19
-
20
- if (showName) {
21
- labelText += ` - ${property.name}`;
22
- }
23
-
24
- if (showType) {
25
- const type = property.propertyType['value'] ?? property.propertyType;
26
- labelText += ` - ${type}${property.isMultiple ? '[]' : ''}`;
27
- }
28
-
29
- return labelText;
30
- }, [property, showName, showType]);
31
-
32
- return (
33
- <TreeItem nodeId={property.key} label={<div dangerouslySetInnerHTML={{ __html: label }} />}>
34
- {property.propertyType === PropertyType.ENTITY
35
- ? (property.properties as PropertiesArrayType).map((prop) => (
36
- <PropertyItem key={prop.key} property={prop} showName={showName} showType={showType} />
37
- ))
38
- : null}
39
- </TreeItem>
40
- );
41
- };
42
-
43
- export default PropertyItem;