@dartech/arsenal-ui 1.2.3 → 1.2.5

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/.babelrc +13 -0
  2. package/.eslintrc.json +22 -0
  3. package/{index.d.ts → index.ts} +5 -5
  4. package/jest.config.ts +11 -0
  5. package/package.json +3 -12
  6. package/project.json +94 -0
  7. package/rollup.config.js +146 -0
  8. package/src/assets/chevron_left_gray.svg +3 -0
  9. package/src/consts/index.ts +13 -0
  10. package/src/interfaces/common.ts +18 -0
  11. package/src/interfaces/definition.ts +143 -0
  12. package/src/interfaces/{index.d.ts → index.ts} +3 -3
  13. package/src/interfaces/ui.ts +80 -0
  14. package/src/lib/Alert/Alert.tsx +108 -0
  15. package/src/lib/Alert/index.ts +1 -0
  16. package/src/lib/Breadcrumbs/Breadcrumbs.styled.tsx +16 -0
  17. package/src/lib/Breadcrumbs/Breadcrumbs.tsx +40 -0
  18. package/src/lib/Breadcrumbs/{index.d.ts → index.ts} +1 -1
  19. package/src/lib/ContentLayout/ContentLayout.tsx +31 -0
  20. package/src/lib/ContentLayout/index.ts +1 -0
  21. package/src/lib/Definition/CreateDefinition/CreateDefinition.tsx +78 -0
  22. package/src/lib/Definition/CreateDefinition/{index.d.ts → index.ts} +1 -1
  23. package/src/lib/Definition/DefinitionFiller/DefinitionFiller.tsx +71 -0
  24. package/src/lib/Definition/DefinitionFiller/{index.d.ts → index.ts} +1 -1
  25. package/src/lib/Definition/DefinitionValueView/DefinitionValueView.tsx +54 -0
  26. package/src/lib/Definition/DefinitionValueView/PropertyDataView.tsx +67 -0
  27. package/src/lib/Definition/DefinitionValueView/{index.d.ts → index.ts} +1 -1
  28. package/src/lib/Definition/{index.d.ts → index.ts} +3 -3
  29. package/src/lib/Forms/BackButton.tsx +46 -0
  30. package/src/lib/Forms/ControlAceEditor.tsx +125 -0
  31. package/src/lib/Forms/ControlAutocomplete.tsx +145 -0
  32. package/src/lib/Forms/ControlCheckbox.tsx +113 -0
  33. package/src/lib/Forms/ControlDate.tsx +75 -0
  34. package/src/lib/Forms/ControlDateTime.tsx +77 -0
  35. package/src/lib/Forms/ControlDebouncedInput.tsx +80 -0
  36. package/src/lib/Forms/ControlInput.tsx +111 -0
  37. package/src/lib/Forms/ControlNumberInput.tsx +121 -0
  38. package/src/lib/Forms/ControlQueryAutocomplete.tsx +197 -0
  39. package/src/lib/Forms/ControlRadio.tsx +136 -0
  40. package/src/lib/Forms/ControlSelect.tsx +164 -0
  41. package/src/lib/Forms/ControlSwitch.tsx +71 -0
  42. package/src/lib/Forms/ControlTime.tsx +93 -0
  43. package/src/lib/Forms/CopyButton.tsx +46 -0
  44. package/src/lib/Forms/{index.d.ts → index.ts} +15 -15
  45. package/src/lib/Forms/useAutocomplete.tsx +47 -0
  46. package/src/lib/InfoItem/InfoItem.tsx +40 -0
  47. package/src/lib/InfoItem/{index.d.ts → index.ts} +1 -1
  48. package/src/lib/InfoItem/styles.ts +17 -0
  49. package/src/lib/JsonPathPicker/JsonPathPicker.tsx +73 -0
  50. package/src/lib/JsonPathPicker/PropertyStep.tsx +70 -0
  51. package/src/lib/JsonPathPicker/{index.d.ts → index.ts} +1 -1
  52. package/src/lib/JsonView/JsonView.tsx +41 -0
  53. package/src/lib/JsonView/{index.d.ts → index.ts} +1 -1
  54. package/src/lib/Loader/Loader.tsx +41 -0
  55. package/src/lib/Loader/{index.d.ts → index.ts} +1 -1
  56. package/src/lib/Modals/JsonModalView.tsx +53 -0
  57. package/src/lib/Modals/{index.d.ts → index.ts} +1 -1
  58. package/src/lib/Property/PropertyFiller/JsonEditor.tsx +58 -0
  59. package/src/lib/Property/PropertyFiller/MultiplePropertyFiller.tsx +129 -0
  60. package/src/lib/Property/PropertyFiller/MultiplePropertyWidget.tsx +85 -0
  61. package/src/lib/Property/PropertyFiller/PropertyFiller.tsx +199 -0
  62. package/src/lib/Property/PropertyFiller/{index.d.ts → index.ts} +2 -2
  63. package/src/lib/Property/PropertyFiller/usePropertyFiller.ts +72 -0
  64. package/src/lib/Property/PropertyFiller/useStyles.ts +12 -0
  65. package/src/lib/Property/PropertyValidator/NodeValidator.tsx +92 -0
  66. package/src/lib/Property/PropertyValidator/NodesList.tsx +26 -0
  67. package/src/lib/Property/PropertyValidator/NumericTypeValidator.tsx +59 -0
  68. package/src/lib/Property/PropertyValidator/PropertyValidator.tsx +42 -0
  69. package/src/lib/Property/PropertyValidator/PropertyValidatorContext.tsx +4 -0
  70. package/src/lib/Property/PropertyValidator/StringTypeValidator.tsx +36 -0
  71. package/src/lib/Property/PropertyValidator/ValidationNodeSelector.tsx +62 -0
  72. package/src/lib/Property/PropertyValidator/index.ts +1 -0
  73. package/src/lib/Property/PropertyValueField/BooleanValueField.tsx +49 -0
  74. package/src/lib/Property/PropertyValueField/DateTimeValueField.tsx +58 -0
  75. package/src/lib/Property/PropertyValueField/DateValueField.tsx +58 -0
  76. package/src/lib/Property/PropertyValueField/JsonValueField.tsx +65 -0
  77. package/src/lib/Property/PropertyValueField/PropertyValueField.tsx +49 -0
  78. package/src/lib/Property/PropertyValueField/StringValueField.tsx +50 -0
  79. package/src/lib/Property/PropertyValueField/TimeValueField.tsx +67 -0
  80. package/src/lib/Property/PropertyValueField/{index.d.ts → index.ts} +1 -1
  81. package/src/lib/Property/PropertyWidget/PropertyWidget.tsx +115 -0
  82. package/src/lib/Property/PropertyWidget/{index.d.ts → index.ts} +1 -1
  83. package/src/lib/Property/UpsertProperty/CreatePropertiesList.tsx +148 -0
  84. package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.tsx +158 -0
  85. package/src/lib/Property/UpsertProperty/CustomPropertyField.tsx +40 -0
  86. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/BigDecimalPropertyFields.tsx +41 -0
  87. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/DateAdditionalFields.tsx +27 -0
  88. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.tsx +133 -0
  89. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityReferencePropertyFields.tsx +46 -0
  90. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.tsx +52 -0
  91. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/StringPropertyFields.tsx +103 -0
  92. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/{index.d.ts → index.ts} +1 -1
  93. package/src/lib/Property/UpsertProperty/{index.d.ts → index.ts} +2 -2
  94. package/src/lib/Property/UpsertProperty/useCustomFields.ts +22 -0
  95. package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.tsx +37 -0
  96. package/src/lib/Property/ViewPropertiesList/{index.d.ts → index.ts} +1 -1
  97. package/src/lib/Property/ViewProperty/EntityPropertiesShortView.tsx +40 -0
  98. package/src/lib/Property/ViewProperty/EntityPropertiesView.tsx +48 -0
  99. package/src/lib/Property/ViewProperty/PropertyDataTable.tsx +148 -0
  100. package/src/lib/Property/ViewProperty/PropertyItem.tsx +43 -0
  101. package/src/lib/Property/ViewProperty/ViewProperty.tsx +52 -0
  102. package/src/lib/Property/ViewProperty/{index.d.ts → index.ts} +1 -1
  103. package/src/lib/Property/{index.d.ts → index.ts} +5 -5
  104. package/src/lib/Sidebar/Sidebar.styled.tsx +157 -0
  105. package/src/lib/Sidebar/Sidebar.tsx +27 -0
  106. package/src/lib/Sidebar/SidebarContext.tsx +37 -0
  107. package/src/lib/Sidebar/SidebarDrawer.tsx +50 -0
  108. package/src/lib/Sidebar/SidebarLink/MenuIcon.tsx +16 -0
  109. package/src/lib/Sidebar/SidebarLink/SidebarLink.tsx +54 -0
  110. package/src/lib/Sidebar/SidebarLink/SidebarLinkItem.tsx +54 -0
  111. package/src/lib/Sidebar/SidebarLink/SidebarNestedItem.tsx +62 -0
  112. package/src/lib/Sidebar/SidebarLink/{index.d.ts → index.ts} +2 -2
  113. package/src/lib/Sidebar/index.ts +2 -0
  114. package/src/lib/Status/Status.tsx +16 -0
  115. package/src/lib/Status/{index.d.ts → index.ts} +1 -1
  116. package/src/lib/Status/styles.ts +21 -0
  117. package/src/lib/StepperView/StepperView.tsx +73 -0
  118. package/src/lib/StepperView/{index.d.ts → index.ts} +1 -1
  119. package/src/lib/Table/DataGrid/JsonTypeCell.tsx +51 -0
  120. package/src/lib/Table/DataGrid/Table.tsx +117 -0
  121. package/src/lib/Table/DataGrid/TableAction.tsx +43 -0
  122. package/src/lib/Table/DataGrid/TableColumnMenu.tsx +12 -0
  123. package/src/lib/Table/DataGrid/TablePagination.tsx +42 -0
  124. package/src/lib/Table/DataGrid/index.ts +2 -0
  125. package/src/lib/Table/DataGrid/styles.ts +59 -0
  126. package/src/lib/Table/DataGrid/usePagination.ts +15 -0
  127. package/src/lib/Table/DataGrid/useTableQueryPagination.ts +47 -0
  128. package/src/lib/Table/DataGrid/useTableQuerySorting.ts +47 -0
  129. package/src/lib/Table/SimpleTable/SimpleTable.tsx +138 -0
  130. package/src/lib/Table/SimpleTable/TableActionCell.tsx +67 -0
  131. package/src/lib/Table/SimpleTable/index.ts +2 -0
  132. package/src/lib/Table/SimpleTable/useTablePagination.ts +54 -0
  133. package/src/lib/Table/SimpleTable/useTableSorting.ts +50 -0
  134. package/src/lib/Table/index.ts +2 -0
  135. package/src/lib/Tabs/RouteTabs.tsx +54 -0
  136. package/src/lib/Tabs/TabPanel.tsx +42 -0
  137. package/src/lib/Tabs/{index.d.ts → index.ts} +2 -2
  138. package/src/lib/{index.d.ts → index.ts} +16 -16
  139. package/src/theme/baseTheme.ts +128 -0
  140. package/src/theme/fonts.d.ts +2 -0
  141. package/src/theme/index.ts +126 -0
  142. package/src/theme/inputThemeOptions.ts +126 -0
  143. package/src/theme/stepperThemeOptions.ts +20 -0
  144. package/src/theme/tableThemeOptions.ts +50 -0
  145. package/src/theme/typographyThemeOptions.ts +32 -0
  146. package/src/utils/common.ts +73 -0
  147. package/src/utils/dem.ts +431 -0
  148. package/src/utils/hooks.ts +41 -0
  149. package/src/utils/{index.d.ts → index.ts} +5 -5
  150. package/src/utils/ui-utils.tsx +102 -0
  151. package/src/utils/validators.ts +14 -0
  152. package/tsconfig.json +25 -0
  153. package/tsconfig.lib.json +23 -0
  154. package/tsconfig.spec.json +20 -0
  155. package/index.js +0 -1
  156. package/src/consts/index.d.ts +0 -12
  157. package/src/interfaces/common.d.ts +0 -17
  158. package/src/interfaces/definition.d.ts +0 -107
  159. package/src/interfaces/ui.d.ts +0 -70
  160. package/src/lib/Alert/Alert.d.ts +0 -53
  161. package/src/lib/Alert/index.d.ts +0 -1
  162. package/src/lib/Breadcrumbs/Breadcrumbs.d.ts +0 -9
  163. package/src/lib/Breadcrumbs/Breadcrumbs.styled.d.ts +0 -2
  164. package/src/lib/ContentLayout/ContentLayout.d.ts +0 -9
  165. package/src/lib/ContentLayout/index.d.ts +0 -1
  166. package/src/lib/Definition/CreateDefinition/CreateDefinition.d.ts +0 -11
  167. package/src/lib/Definition/DefinitionFiller/DefinitionFiller.d.ts +0 -10
  168. package/src/lib/Definition/DefinitionValueView/DefinitionValueView.d.ts +0 -8
  169. package/src/lib/Definition/DefinitionValueView/PropertyDataView.d.ts +0 -9
  170. package/src/lib/Forms/BackButton.d.ts +0 -7
  171. package/src/lib/Forms/ControlAceEditor.d.ts +0 -24
  172. package/src/lib/Forms/ControlAutocomplete.d.ts +0 -69
  173. package/src/lib/Forms/ControlCheckbox.d.ts +0 -51
  174. package/src/lib/Forms/ControlDate.d.ts +0 -18
  175. package/src/lib/Forms/ControlDateTime.d.ts +0 -18
  176. package/src/lib/Forms/ControlDebouncedInput.d.ts +0 -4
  177. package/src/lib/Forms/ControlInput.d.ts +0 -59
  178. package/src/lib/Forms/ControlNumberInput.d.ts +0 -51
  179. package/src/lib/Forms/ControlQueryAutocomplete.d.ts +0 -16
  180. package/src/lib/Forms/ControlRadio.d.ts +0 -66
  181. package/src/lib/Forms/ControlSelect.d.ts +0 -67
  182. package/src/lib/Forms/ControlSwitch.d.ts +0 -19
  183. package/src/lib/Forms/ControlTime.d.ts +0 -18
  184. package/src/lib/Forms/CopyButton.d.ts +0 -20
  185. package/src/lib/Forms/useAutocomplete.d.ts +0 -10
  186. package/src/lib/InfoItem/InfoItem.d.ts +0 -10
  187. package/src/lib/InfoItem/styles.d.ts +0 -12
  188. package/src/lib/JsonPathPicker/JsonPathPicker.d.ts +0 -10
  189. package/src/lib/JsonPathPicker/PropertyStep.d.ts +0 -11
  190. package/src/lib/JsonView/JsonView.d.ts +0 -7
  191. package/src/lib/Loader/Loader.d.ts +0 -21
  192. package/src/lib/Modals/JsonModalView.d.ts +0 -10
  193. package/src/lib/Property/PropertyFiller/JsonEditor.d.ts +0 -10
  194. package/src/lib/Property/PropertyFiller/MultiplePropertyFiller.d.ts +0 -12
  195. package/src/lib/Property/PropertyFiller/MultiplePropertyWidget.d.ts +0 -11
  196. package/src/lib/Property/PropertyFiller/PropertyFiller.d.ts +0 -12
  197. package/src/lib/Property/PropertyFiller/usePropertyFiller.d.ts +0 -24
  198. package/src/lib/Property/PropertyFiller/useStyles.d.ts +0 -12
  199. package/src/lib/Property/PropertyValidator/NodeValidator.d.ts +0 -6
  200. package/src/lib/Property/PropertyValidator/NodesList.d.ts +0 -6
  201. package/src/lib/Property/PropertyValidator/NumericTypeValidator.d.ts +0 -8
  202. package/src/lib/Property/PropertyValidator/PropertyValidator.d.ts +0 -6
  203. package/src/lib/Property/PropertyValidator/PropertyValidatorContext.d.ts +0 -3
  204. package/src/lib/Property/PropertyValidator/StringTypeValidator.d.ts +0 -8
  205. package/src/lib/Property/PropertyValidator/ValidationNodeSelector.d.ts +0 -7
  206. package/src/lib/Property/PropertyValidator/index.d.ts +0 -1
  207. package/src/lib/Property/PropertyValueField/BooleanValueField.d.ts +0 -7
  208. package/src/lib/Property/PropertyValueField/DateTimeValueField.d.ts +0 -9
  209. package/src/lib/Property/PropertyValueField/DateValueField.d.ts +0 -9
  210. package/src/lib/Property/PropertyValueField/JsonValueField.d.ts +0 -10
  211. package/src/lib/Property/PropertyValueField/PropertyValueField.d.ts +0 -9
  212. package/src/lib/Property/PropertyValueField/StringValueField.d.ts +0 -9
  213. package/src/lib/Property/PropertyValueField/TimeValueField.d.ts +0 -9
  214. package/src/lib/Property/PropertyWidget/PropertyWidget.d.ts +0 -13
  215. package/src/lib/Property/UpsertProperty/CreatePropertiesList.d.ts +0 -13
  216. package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.d.ts +0 -10
  217. package/src/lib/Property/UpsertProperty/CustomPropertyField.d.ts +0 -7
  218. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/BigDecimalPropertyFields.d.ts +0 -6
  219. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/DateAdditionalFields.d.ts +0 -7
  220. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.d.ts +0 -8
  221. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityReferencePropertyFields.d.ts +0 -6
  222. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.d.ts +0 -10
  223. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/StringPropertyFields.d.ts +0 -6
  224. package/src/lib/Property/UpsertProperty/useCustomFields.d.ts +0 -6
  225. package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.d.ts +0 -8
  226. package/src/lib/Property/ViewProperty/EntityPropertiesShortView.d.ts +0 -7
  227. package/src/lib/Property/ViewProperty/EntityPropertiesView.d.ts +0 -8
  228. package/src/lib/Property/ViewProperty/PropertyDataTable.d.ts +0 -7
  229. package/src/lib/Property/ViewProperty/PropertyItem.d.ts +0 -9
  230. package/src/lib/Property/ViewProperty/ViewProperty.d.ts +0 -9
  231. package/src/lib/Sidebar/Sidebar.d.ts +0 -10
  232. package/src/lib/Sidebar/Sidebar.styled.d.ts +0 -117
  233. package/src/lib/Sidebar/SidebarContext.d.ts +0 -11
  234. package/src/lib/Sidebar/SidebarDrawer.d.ts +0 -9
  235. package/src/lib/Sidebar/SidebarLink/MenuIcon.d.ts +0 -7
  236. package/src/lib/Sidebar/SidebarLink/SidebarLink.d.ts +0 -7
  237. package/src/lib/Sidebar/SidebarLink/SidebarLinkItem.d.ts +0 -8
  238. package/src/lib/Sidebar/SidebarLink/SidebarNestedItem.d.ts +0 -10
  239. package/src/lib/Sidebar/index.d.ts +0 -2
  240. package/src/lib/Status/Status.d.ts +0 -8
  241. package/src/lib/Status/styles.d.ts +0 -12
  242. package/src/lib/StepperView/StepperView.d.ts +0 -11
  243. package/src/lib/Table/DataGrid/JsonTypeCell.d.ts +0 -7
  244. package/src/lib/Table/DataGrid/Table.d.ts +0 -49
  245. package/src/lib/Table/DataGrid/TableAction.d.ts +0 -13
  246. package/src/lib/Table/DataGrid/TableColumnMenu.d.ts +0 -3
  247. package/src/lib/Table/DataGrid/TablePagination.d.ts +0 -3
  248. package/src/lib/Table/DataGrid/index.d.ts +0 -2
  249. package/src/lib/Table/DataGrid/styles.d.ts +0 -12
  250. package/src/lib/Table/DataGrid/usePagination.d.ts +0 -5
  251. package/src/lib/Table/DataGrid/useTableQueryPagination.d.ts +0 -11
  252. package/src/lib/Table/DataGrid/useTableQuerySorting.d.ts +0 -6
  253. package/src/lib/Table/SimpleTable/SimpleTable.d.ts +0 -17
  254. package/src/lib/Table/SimpleTable/TableActionCell.d.ts +0 -10
  255. package/src/lib/Table/SimpleTable/index.d.ts +0 -2
  256. package/src/lib/Table/SimpleTable/useTablePagination.d.ts +0 -7
  257. package/src/lib/Table/SimpleTable/useTableSorting.d.ts +0 -6
  258. package/src/lib/Table/index.d.ts +0 -2
  259. package/src/lib/Tabs/RouteTabs.d.ts +0 -11
  260. package/src/lib/Tabs/TabPanel.d.ts +0 -25
  261. package/src/theme/baseTheme.d.ts +0 -2
  262. package/src/theme/index.d.ts +0 -1
  263. package/src/theme/inputThemeOptions.d.ts +0 -117
  264. package/src/theme/stepperThemeOptions.d.ts +0 -16
  265. package/src/theme/tableThemeOptions.d.ts +0 -47
  266. package/src/theme/typographyThemeOptions.d.ts +0 -29
  267. package/src/utils/common.d.ts +0 -7
  268. package/src/utils/dem.d.ts +0 -27
  269. package/src/utils/hooks.d.ts +0 -7
  270. package/src/utils/ui-utils.d.ts +0 -8
  271. package/src/utils/validators.d.ts +0 -5
@@ -0,0 +1,108 @@
1
+ import React from 'react';
2
+ import Button from '@mui/material/Button';
3
+ import Dialog, { DialogProps } from '@mui/material/Dialog';
4
+ import DialogActions from '@mui/material/DialogActions';
5
+ import DialogContent from '@mui/material/DialogContent';
6
+ import DialogContentText from '@mui/material/DialogContentText';
7
+ import DialogTitle from '@mui/material/DialogTitle';
8
+ import Box from '@mui/material/Box';
9
+ import { Loader } from '../Loader';
10
+
11
+ /**
12
+ * This interface is referencing the [[AlertDialog]] component props.
13
+ * @category Common UI components
14
+ */
15
+ export interface AlertDialogProps {
16
+ /**
17
+ * Is dialog open flag
18
+ */
19
+ open: boolean;
20
+ /**
21
+ * Dialog title
22
+ */
23
+ title: string;
24
+ /**
25
+ * Dialog description
26
+ */
27
+ description?: string;
28
+ /**
29
+ * Close button text
30
+ */
31
+ closeButtonTitle?: string;
32
+ /**
33
+ * Confirm button text
34
+ */
35
+ confirmButtonTitle?: string;
36
+ /**
37
+ * onClose event handle function
38
+ */
39
+ onClose: () => void;
40
+ /**
41
+ * onConfirm event handle function
42
+ */
43
+
44
+ onConfirm?: (values?: any) => void;
45
+ /**
46
+ * children components
47
+ */
48
+ children?: React.ReactNode;
49
+ /**
50
+ * Material UI Dialog component props
51
+ */
52
+ dialogProps?: Partial<DialogProps>;
53
+ loading?: boolean;
54
+ confirmButtonDisabled?: boolean;
55
+ maxWidth?: false | "xs" | "sm" | "md" | "lg" | "xl";
56
+ };
57
+
58
+ /**
59
+ * Alert dialog component. Used for popup information
60
+ * @category Common UI components
61
+ */
62
+ export const AlertDialog = ({
63
+ open,
64
+ title,
65
+ description,
66
+ closeButtonTitle="Close",
67
+ onClose,
68
+ confirmButtonTitle = "Confirm",
69
+ confirmButtonDisabled = false,
70
+ onConfirm,
71
+ children,
72
+ dialogProps,
73
+ loading,
74
+ maxWidth="xs"
75
+ }: AlertDialogProps) => {
76
+ return (
77
+ <div>
78
+ <Dialog
79
+ open={open}
80
+ onClose={onClose}
81
+ aria-labelledby="alert-dialog-title"
82
+ aria-describedby="alert-dialog-description"
83
+ fullWidth
84
+ maxWidth={maxWidth}
85
+ {...dialogProps}
86
+ >
87
+ {loading && <Loader />}
88
+ <DialogTitle id="alert-dialog-title">{title}</DialogTitle>
89
+ <DialogContent>
90
+ { description && <DialogContentText id="alert-dialog-description">{description}</DialogContentText>}
91
+ <Box maxWidth="100%" overflow="hidden">{children}</Box>
92
+ </DialogContent>
93
+ <DialogActions>
94
+ <Button onClick={onClose} color="primary" variant="contained">
95
+ {closeButtonTitle}
96
+ </Button>
97
+ {confirmButtonTitle && onConfirm ? (
98
+ <Button onClick={onConfirm} color="secondary" variant="contained" autoFocus disabled={confirmButtonDisabled}>
99
+ {confirmButtonTitle}
100
+ </Button>
101
+ ) : null}
102
+ </DialogActions>
103
+ </Dialog>
104
+ </div>
105
+ );
106
+ };
107
+
108
+ export default AlertDialog;
@@ -0,0 +1 @@
1
+ export * from './Alert';
@@ -0,0 +1,16 @@
1
+ import { Link } from 'react-router-dom';
2
+ import { styled } from '@mui/material/styles';
3
+
4
+ // export const StyledBreadcrumbs = styled(Breadcrumbs)(() => ({
5
+ // '& li': {
6
+ // color: '#6D6E85',
7
+ // '&:last-child': {
8
+ // color: '#262842',
9
+ // },
10
+ // },
11
+ // }));
12
+
13
+ export const StyledLink = styled(Link)(() => ({
14
+ textDecoration: 'none',
15
+ color: 'inherit',
16
+ }));
@@ -0,0 +1,40 @@
1
+ import Typography from '@mui/material/Typography';
2
+ import MuiBreadcrumbs from '@mui/material/Breadcrumbs';
3
+ import { StyledLink } from './Breadcrumbs.styled';
4
+ import NavigateNextIcon from '@mui/icons-material/NavigateNext';
5
+
6
+ type Props = {
7
+ crumbs: {
8
+ title: string;
9
+ link?: string;
10
+ }[];
11
+ };
12
+
13
+ export const Breadcrumbs = ({ crumbs }: Props) => {
14
+ return (
15
+ <MuiBreadcrumbs
16
+ separator={<NavigateNextIcon fontSize="small" />}
17
+ aria-label="breadcrumb"
18
+ sx={{
19
+ '& li': {
20
+ color: '#6D6E85',
21
+ '&:last-child': {
22
+ color: '#262842',
23
+ },
24
+ },
25
+ }}
26
+ >
27
+ {crumbs.map((crumb, index) =>
28
+ crumb.link ? (
29
+ <StyledLink key={index} to={crumb.link} className="breadcrumb">
30
+ {crumb.title}
31
+ </StyledLink>
32
+ ) : (
33
+ <Typography key={index} className="breadcrumb">
34
+ {crumb.title}
35
+ </Typography>
36
+ )
37
+ )}
38
+ </MuiBreadcrumbs>
39
+ );
40
+ };
@@ -1 +1 @@
1
- export * from './Breadcrumbs';
1
+ export * from './Breadcrumbs';
@@ -0,0 +1,31 @@
1
+ import { Suspense, ReactNode } from 'react';
2
+ import Box from '@mui/material/Box';
3
+ import { SxProps, Theme } from '@mui/material/styles';
4
+ import Toolbar from '@mui/material/Toolbar';
5
+ import { Outlet } from 'react-router-dom';
6
+ import { Loader } from '../Loader';
7
+
8
+ type Props = {
9
+ children?: ReactNode;
10
+ toolbar?: ReactNode;
11
+ contentSx?: SxProps<Theme>;
12
+ }
13
+
14
+ export const ContentLayout = ({ children, toolbar, contentSx }: Props) => {
15
+ return (
16
+ <Box component="main" sx={{ flexGrow: 1, bgcolor: 'background.default' }}>
17
+ <Toolbar
18
+ sx={{
19
+ borderBottom: '1px solid rgba(38, 40, 66, 0.08)',
20
+ }}
21
+ >{toolbar}</Toolbar>
22
+ <Box sx={{ ...contentSx, height: 'calc(100vh - 56px)', overflow: 'scroll' }}>
23
+ <Suspense fallback={<Loader />}>
24
+ {
25
+ children ?? <Outlet />
26
+ }
27
+ </Suspense>
28
+ </Box>
29
+ </Box>
30
+ );
31
+ };
@@ -0,0 +1 @@
1
+ export * from './ContentLayout';
@@ -0,0 +1,78 @@
1
+ import Box from '@mui/material/Box';
2
+ import Grid from '@mui/material/Unstable_Grid2';
3
+ import Typography from '@mui/material/Typography';
4
+ import { ControlInput, ControlNumberInput } from '../../Forms';
5
+ import CreatePropertiesList from '../../Property/UpsertProperty/CreatePropertiesList';
6
+
7
+ import { useFormContext } from 'react-hook-form';
8
+
9
+ type Props = {
10
+ definitionFieldName?: string;
11
+ title?: string;
12
+ hideCodeField?: boolean;
13
+ hideVersionField?: boolean;
14
+ hideNameField?: boolean;
15
+ required?: boolean;
16
+ };
17
+
18
+ export const CreateDefinition = ({
19
+ definitionFieldName,
20
+ title,
21
+ hideCodeField,
22
+ hideVersionField,
23
+ hideNameField,
24
+ required = false,
25
+ }: Props) => {
26
+ const { control } = useFormContext();
27
+
28
+ return (
29
+ <Grid container direction="column" spacing={2}>
30
+ {title && (
31
+ <Grid sm={12}>
32
+ <Box my={2}>
33
+ <Typography variant="h6">{title}</Typography>
34
+ </Box>
35
+ </Grid>
36
+ )}
37
+ {!hideNameField && (
38
+ <Grid sm={12}>
39
+ <ControlInput
40
+ required
41
+ control={control}
42
+ name={definitionFieldName ? `${definitionFieldName}.name` : `name`}
43
+ label="Name"
44
+ />
45
+ </Grid>
46
+ )}
47
+ {!hideCodeField && (
48
+ <Grid sm={12}>
49
+ <ControlInput
50
+ required
51
+ control={control}
52
+ name={definitionFieldName ? `${definitionFieldName}.code` : `code`}
53
+ label="Code"
54
+ />
55
+ </Grid>
56
+ )}
57
+ {!hideVersionField && (
58
+ <Grid sm={12}>
59
+ <ControlNumberInput
60
+ required
61
+ control={control}
62
+ name={
63
+ definitionFieldName ? `${definitionFieldName}.version` : `version`
64
+ }
65
+ label="Version"
66
+ />
67
+ </Grid>
68
+ )}
69
+
70
+ <CreatePropertiesList
71
+ required={required}
72
+ parentFieldName={definitionFieldName}
73
+ />
74
+ </Grid>
75
+ );
76
+ };
77
+
78
+ export default CreateDefinition;
@@ -1 +1 @@
1
- export * from './CreateDefinition';
1
+ export * from './CreateDefinition';
@@ -0,0 +1,71 @@
1
+ import Box from '@mui/material/Box';
2
+ import Grid from '@mui/material/Unstable_Grid2';
3
+ import { StepperData, StepperView } from '../../StepperView';
4
+ import { PropertyFiller } from '../../Property';
5
+ import { MultiplePropertyFiller } from '../../Property';
6
+
7
+ import { useMemo } from 'react';
8
+
9
+ import { PropertiesArrayType } from '../../../interfaces';
10
+
11
+ type Props = {
12
+ properties: PropertiesArrayType;
13
+ dataFieldName: string;
14
+ useExpression?: boolean;
15
+ title?: string;
16
+ };
17
+
18
+ export const DefinitionFiller = ({ properties, dataFieldName, useExpression = false, title }: Props) => {
19
+ const stepperData: StepperData = useMemo(() => {
20
+ if (properties) {
21
+ return properties.map((property) => {
22
+ const propertyType =
23
+ typeof property.propertyType === 'string' ? property.propertyType : property['propertyType']['value'];
24
+ return {
25
+ label: (
26
+ <Box display="flex" flexDirection="column">
27
+ <b>
28
+ {property.name}
29
+ {property.isRequired ? '*' : ''}
30
+ </b>
31
+ <span>
32
+ {property.key} | {property.isMultiple ? 'multiple' : 'single'} | {propertyType}
33
+ </span>
34
+ </Box>
35
+ ),
36
+ content: property.isMultiple ? (
37
+ <MultiplePropertyFiller
38
+ property={property}
39
+ name={`${dataFieldName}.${property.key}`}
40
+ useExpression={useExpression}
41
+ label={property.name}
42
+ required={property.isRequired}
43
+ />
44
+ ) : (
45
+ <PropertyFiller
46
+ property={property}
47
+ name={`${dataFieldName}.${property.key}`}
48
+ useExpression={useExpression}
49
+ label={property.name}
50
+ required={property.isRequired}
51
+ />
52
+ ),
53
+ };
54
+ });
55
+ }
56
+ return [];
57
+ }, [properties, dataFieldName, useExpression]);
58
+
59
+ return (
60
+ <Grid container direction="column" spacing={2}>
61
+ {title && (
62
+ <Grid xs={12}>
63
+ <div style={{ fontWeight: '600' }}>{title}</div>
64
+ </Grid>
65
+ )}
66
+ <StepperView data={stepperData} />
67
+ </Grid>
68
+ );
69
+ };
70
+
71
+ export default DefinitionFiller;
@@ -1 +1 @@
1
- export * from './DefinitionFiller';
1
+ export * from './DefinitionFiller';
@@ -0,0 +1,54 @@
1
+ import Box from '@mui/material/Box';
2
+ import Grid from '@mui/material/Unstable_Grid2';
3
+ import { StepperData, StepperView } from '../../StepperView';
4
+ import PropertyDataView from './PropertyDataView';
5
+
6
+ import { useMemo } from 'react';
7
+ import { PropertiesArrayType, PropertyType } from '../../../interfaces';
8
+
9
+ type Props = {
10
+ properties: PropertiesArrayType<unknown>;
11
+ data: unknown;
12
+ };
13
+
14
+ export const DefinitionValueView = ({ properties, data }: Props) => {
15
+ const stepperData: StepperData = useMemo(() => {
16
+ if (properties && data) {
17
+ return properties.map((property) => {
18
+ const { key, name, isMultiple, propertyType } = property;
19
+ const value = data[property.key] ?? data;
20
+ return {
21
+ label: (
22
+ <Box display="flex" flexDirection="column">
23
+ <b>{name}</b>
24
+ <span>
25
+ {key} | {isMultiple ? 'multiple' : 'single'} | {propertyType}
26
+ </span>
27
+ </Box>
28
+ ),
29
+ content:
30
+ isMultiple && Array.isArray(value) && property.propertyType !== PropertyType.ANY ? (
31
+ <>
32
+ {value.map((itemValue, index) => (
33
+ <Box key={index} mb={2}>
34
+ <PropertyDataView property={property} data={itemValue} hasBackground />
35
+ </Box>
36
+ ))}
37
+ </>
38
+ ) : (
39
+ <PropertyDataView property={property} data={value} />
40
+ ),
41
+ };
42
+ });
43
+ }
44
+ return [];
45
+ }, [properties, data]);
46
+
47
+ return (
48
+ <Grid container direction="column" spacing={2}>
49
+ <StepperView data={stepperData} />
50
+ </Grid>
51
+ );
52
+ };
53
+
54
+ export default DefinitionValueView;
@@ -0,0 +1,67 @@
1
+ import Box from '@mui/material/Box';
2
+ import { JsonView } from '../../JsonView';
3
+ import DefinitionValueView from './DefinitionValueView';
4
+
5
+ import { useMemo } from 'react';
6
+ import { isExpression, propertiesObjectToArray } from '../../../utils';
7
+
8
+ import { PropertyUnion, PropertyType, PropertiesArrayType } from '../../../interfaces';
9
+
10
+ type Props = {
11
+ property: PropertyUnion;
12
+ data: unknown;
13
+ hasBackground?: boolean;
14
+ };
15
+
16
+ type PropertyValueComponentProps = {
17
+ property: PropertyUnion;
18
+ data: unknown;
19
+ properties?: PropertiesArrayType;
20
+ };
21
+
22
+ const PropertyValueComponent = ({ property, data, properties }: PropertyValueComponentProps) => {
23
+ const defaultRender = (value: any) => (
24
+ <Box style={{ backgroundColor: '#fff', border: '1px solid #ccc', borderRadius: '4px', padding: '4px' }}>
25
+ {value === null ? 'null' : value?.toString()}
26
+ </Box>
27
+ )
28
+ if (isExpression(data)) {
29
+ return defaultRender(data);
30
+ } else {
31
+ switch (property.propertyType) {
32
+ case PropertyType.JSON:
33
+ return <JsonView value={data} />;
34
+ case PropertyType.ENTITY:
35
+ return <DefinitionValueView properties={properties} data={data} />;
36
+ case PropertyType.ANY:
37
+ // TODO need to prefetch data and show as is
38
+ return (typeof data === 'object' ? <JsonView value={data} /> : defaultRender(data));
39
+ default:
40
+ return defaultRender(data);
41
+ }
42
+ }
43
+ };
44
+
45
+ export const PropertyDataView = ({ property, data, hasBackground = false }: Props) => {
46
+ const properties = useMemo(() => {
47
+ if (property.propertyType === PropertyType.ENTITY) {
48
+ if (Array.isArray(property.properties)) {
49
+ return property.properties;
50
+ }
51
+ return propertiesObjectToArray(property.properties);
52
+ }
53
+ return [];
54
+ }, [property]);
55
+
56
+ return (
57
+ <Box
58
+ style={{
59
+ backgroundColor: hasBackground ? '#f1f1f1' : 'none',
60
+ }}
61
+ >
62
+ <PropertyValueComponent property={property} data={data} properties={properties} />
63
+ </Box>
64
+ );
65
+ };
66
+
67
+ export default PropertyDataView;
@@ -1 +1 @@
1
- export * from './DefinitionValueView';
1
+ export * from './DefinitionValueView';
@@ -1,3 +1,3 @@
1
- export * from './CreateDefinition';
2
- export * from './DefinitionFiller';
3
- export * from './DefinitionValueView';
1
+ export * from './CreateDefinition';
2
+ export * from './DefinitionFiller';
3
+ export * from './DefinitionValueView';
@@ -0,0 +1,46 @@
1
+ import { useCallback, useMemo } from 'react';
2
+ import SvgIcon from '@mui/material/SvgIcon';
3
+ import { useNavigate, useLocation, Link } from 'react-router-dom';
4
+ import IconButton from '@mui/material/IconButton';
5
+ import Button from '@mui/material/Button';
6
+ import Box from '@mui/material/Box';
7
+
8
+ type Props = {
9
+ text?: string;
10
+ buttonProps?: Record<string, unknown>;
11
+ };
12
+ export const BackButton = ({ text, buttonProps = {} }: Props) => {
13
+ const navigate = useNavigate();
14
+ const { state } = useLocation();
15
+ const fromLocation = useMemo(() => state?.['from'], [state]);
16
+
17
+ const handleClick = useCallback(() => {
18
+ if (fromLocation) {
19
+ navigate(fromLocation);
20
+ } else navigate(-1);
21
+ }, [navigate, fromLocation]);
22
+
23
+ return (
24
+ <Box mr={2}>
25
+ {text ? (
26
+ <Button
27
+ color="inherit"
28
+ onClick={!fromLocation ? handleClick : null}
29
+ component={Link}
30
+ to={fromLocation ?? ''}
31
+ {...buttonProps}
32
+ >
33
+ {text}
34
+ </Button>
35
+ ) : (
36
+ <IconButton onClick={handleClick}>
37
+ <SvgIcon>
38
+ <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" />
39
+ </SvgIcon>
40
+ </IconButton>
41
+ )}
42
+ </Box>
43
+ );
44
+ };
45
+
46
+ export default BackButton;
@@ -0,0 +1,125 @@
1
+ import AceEditor from 'react-ace';
2
+ import 'ace-builds/src-noconflict/mode-python';
3
+ import 'ace-builds/src-noconflict/theme-monokai';
4
+ import 'ace-builds/src-noconflict/ext-language_tools';
5
+ import Typography from '@mui/material/Typography';
6
+ import Box from '@mui/material/Box';
7
+ import FormHelperText from '@mui/material/FormHelperText';
8
+ import { Control, useFormContext, useController, useWatch } from 'react-hook-form';
9
+ import { forwardRef } from 'react';
10
+
11
+ export interface ControlAceEditorProps {
12
+ name: string;
13
+ control: Control<any>;
14
+ mode?: string;
15
+ label?: string;
16
+ width?: string;
17
+ height?: string;
18
+ theme?: string;
19
+ readOnly?: boolean;
20
+ required?: boolean;
21
+ validateJson?: boolean;
22
+ fontSize?: number;
23
+ validate?: boolean;
24
+ parseValue?: boolean;
25
+ [key: string]: unknown;
26
+ }
27
+
28
+ export const ControlAceEditor = forwardRef<AceEditor, ControlAceEditorProps>(({
29
+ control,
30
+ name,
31
+ mode = 'json',
32
+ label,
33
+ width = '100%',
34
+ height = '200px',
35
+ theme = 'monokai',
36
+ readOnly,
37
+ required = false,
38
+ validateJson = false,
39
+ fontSize = 16,
40
+ validate = true,
41
+ parseValue,
42
+ ...otherProps
43
+ }, ref) => {
44
+ const { setError, clearErrors } = useFormContext();
45
+ const {
46
+ field: { onChange },
47
+ fieldState: { error },
48
+ } = useController({ control, name });
49
+ const value = useWatch({ control, name });
50
+
51
+ const handleChange = (value) => {
52
+ if (!value && required) {
53
+ setError(name, { message: 'Required field' });
54
+ } else {
55
+ clearErrors(name);
56
+ }
57
+
58
+ if (validateJson) {
59
+ try {
60
+ JSON.parse(value);
61
+ clearErrors(name);
62
+ } catch (error) {
63
+ setError(name, { message: 'Invalid JSON' });
64
+ }
65
+ }
66
+
67
+ if (parseValue) {
68
+ try {
69
+ const val = JSON.parse(value);
70
+ console.log('parsed val:', val);
71
+ onChange(val);
72
+ } catch (e) {
73
+ onChange(value);
74
+ }
75
+ } else {
76
+ onChange(value);
77
+ }
78
+ };
79
+
80
+ return (
81
+ <Box display="flex" flexDirection="column" width="100%">
82
+ <Box>
83
+ {label && (
84
+ <Typography variant="subtitle1" display="inline" style={{ marginRight: 10 }}>
85
+ {label}
86
+ </Typography>
87
+ )}
88
+ </Box>
89
+ <>
90
+ <AceEditor
91
+ ref={ref}
92
+ focus
93
+ wrapEnabled
94
+ width={width}
95
+ height={height}
96
+ showPrintMargin={false}
97
+ theme={theme}
98
+ fontSize={fontSize}
99
+ setOptions={{
100
+ enableLiveAutocompletion: true,
101
+ enableBasicAutocompletion: true,
102
+ enableSnippets: true,
103
+ showLineNumbers: true,
104
+ tabSize: 2,
105
+ useWorker: false
106
+ }}
107
+ style={{ lineHeight: 1.4, zIndex: 0, isolation: 'isolate' }}
108
+ readOnly={readOnly}
109
+ value={mode === 'json' && typeof value !== 'string' ? (value === null ? '' : JSON.stringify(value)) : value}
110
+ onChange={handleChange}
111
+ mode={mode}
112
+ onLoad={(editor) => {
113
+ if (!validate || !validateJson) {
114
+ editor.getSession().setUseWorker(false);
115
+ }
116
+ }}
117
+ {...otherProps}
118
+ />
119
+ {error && <FormHelperText error>{error.message}</FormHelperText>}
120
+ </>
121
+ </Box>
122
+ );
123
+ });
124
+
125
+ export default ControlAceEditor;