@dartech/arsenal-ui 1.3.0 → 1.3.2

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 (269) hide show
  1. package/{index.ts → index.d.ts} +5 -5
  2. package/index.js +1 -0
  3. package/package.json +10 -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/JsonPathPicker/JsonPathPicker.d.ts +10 -0
  44. package/src/lib/JsonPathPicker/PropertyStep.d.ts +11 -0
  45. package/src/lib/JsonPathPicker/{index.ts → index.d.ts} +1 -1
  46. package/src/lib/JsonView/JsonView.d.ts +7 -0
  47. package/src/lib/JsonView/{index.ts → index.d.ts} +1 -1
  48. package/src/lib/Loader/Loader.d.ts +21 -0
  49. package/src/lib/Loader/{index.ts → index.d.ts} +1 -1
  50. package/src/lib/Modals/JsonModalView.d.ts +10 -0
  51. package/src/lib/Modals/{index.ts → index.d.ts} +1 -1
  52. package/src/lib/Property/PropertyFiller/JsonEditor.d.ts +10 -0
  53. package/src/lib/Property/PropertyFiller/MultiplePropertyFiller.d.ts +12 -0
  54. package/src/lib/Property/PropertyFiller/MultiplePropertyWidget.d.ts +11 -0
  55. package/src/lib/Property/PropertyFiller/PropertyFiller.d.ts +12 -0
  56. package/src/lib/Property/PropertyFiller/{index.ts → index.d.ts} +2 -2
  57. package/src/lib/Property/PropertyFiller/styled.d.ts +18 -0
  58. package/src/lib/Property/PropertyFiller/usePropertyFiller.d.ts +24 -0
  59. package/src/lib/Property/PropertyValidator/NodeValidator.d.ts +6 -0
  60. package/src/lib/Property/PropertyValidator/NodesList.d.ts +6 -0
  61. package/src/lib/Property/PropertyValidator/NumericTypeValidator.d.ts +8 -0
  62. package/src/lib/Property/PropertyValidator/PropertyValidator.d.ts +6 -0
  63. package/src/lib/Property/PropertyValidator/PropertyValidatorContext.d.ts +3 -0
  64. package/src/lib/Property/PropertyValidator/StringTypeValidator.d.ts +8 -0
  65. package/src/lib/Property/PropertyValidator/ValidationNodeSelector.d.ts +7 -0
  66. package/src/lib/Property/PropertyValidator/index.d.ts +1 -0
  67. package/src/lib/Property/PropertyValueField/BooleanValueField.d.ts +7 -0
  68. package/src/lib/Property/PropertyValueField/DateTimeValueField.d.ts +9 -0
  69. package/src/lib/Property/PropertyValueField/DateValueField.d.ts +9 -0
  70. package/src/lib/Property/PropertyValueField/JsonValueField.d.ts +10 -0
  71. package/src/lib/Property/PropertyValueField/PropertyValueField.d.ts +9 -0
  72. package/src/lib/Property/PropertyValueField/StringValueField.d.ts +9 -0
  73. package/src/lib/Property/PropertyValueField/TimeValueField.d.ts +9 -0
  74. package/src/lib/Property/PropertyValueField/{index.ts → index.d.ts} +1 -1
  75. package/src/lib/Property/PropertyWidget/PropertyWidget.d.ts +13 -0
  76. package/src/lib/Property/PropertyWidget/{index.ts → index.d.ts} +1 -1
  77. package/src/lib/Property/UpsertProperty/CreatePropertiesList.d.ts +13 -0
  78. package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.d.ts +10 -0
  79. package/src/lib/Property/UpsertProperty/CustomPropertyField.d.ts +7 -0
  80. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/BigDecimalPropertyFields.d.ts +6 -0
  81. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/DateAdditionalFields.d.ts +7 -0
  82. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.d.ts +8 -0
  83. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityReferencePropertyFields.d.ts +6 -0
  84. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.d.ts +10 -0
  85. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/StringPropertyFields.d.ts +6 -0
  86. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/{index.ts → index.d.ts} +1 -1
  87. package/src/lib/Property/UpsertProperty/{index.ts → index.d.ts} +2 -2
  88. package/src/lib/Property/UpsertProperty/useCustomFields.d.ts +6 -0
  89. package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.d.ts +8 -0
  90. package/src/lib/Property/ViewPropertiesList/{index.ts → index.d.ts} +1 -1
  91. package/src/lib/Property/ViewProperty/EntityPropertiesShortView.d.ts +7 -0
  92. package/src/lib/Property/ViewProperty/EntityPropertiesView.d.ts +8 -0
  93. package/src/lib/Property/ViewProperty/PropertyDataTable.d.ts +7 -0
  94. package/src/lib/Property/ViewProperty/PropertyItem.d.ts +9 -0
  95. package/src/lib/Property/ViewProperty/ViewProperty.d.ts +9 -0
  96. package/src/lib/Property/ViewProperty/{index.ts → index.d.ts} +1 -1
  97. package/src/lib/Property/{index.ts → index.d.ts} +5 -5
  98. package/src/lib/Sidebar/Sidebar.d.ts +10 -0
  99. package/src/lib/Sidebar/Sidebar.styled.d.ts +117 -0
  100. package/src/lib/Sidebar/SidebarContext.d.ts +11 -0
  101. package/src/lib/Sidebar/SidebarDrawer.d.ts +9 -0
  102. package/src/lib/Sidebar/SidebarLink/MenuIcon.d.ts +7 -0
  103. package/src/lib/Sidebar/SidebarLink/SidebarLink.d.ts +7 -0
  104. package/src/lib/Sidebar/SidebarLink/SidebarLinkItem.d.ts +8 -0
  105. package/src/lib/Sidebar/SidebarLink/SidebarNestedItem.d.ts +10 -0
  106. package/src/lib/Sidebar/SidebarLink/{index.ts → index.d.ts} +2 -2
  107. package/src/lib/Sidebar/index.d.ts +2 -0
  108. package/src/lib/Status/Status.d.ts +8 -0
  109. package/src/lib/Status/{index.ts → index.d.ts} +1 -1
  110. package/src/lib/StepperView/StepperView.d.ts +11 -0
  111. package/src/lib/StepperView/{index.ts → index.d.ts} +1 -1
  112. package/src/lib/Table/DataGrid/JsonTypeCell.d.ts +7 -0
  113. package/src/lib/Table/DataGrid/Table.d.ts +49 -0
  114. package/src/lib/Table/DataGrid/TableAction.d.ts +13 -0
  115. package/src/lib/Table/DataGrid/TableColumnMenu.d.ts +3 -0
  116. package/src/lib/Table/DataGrid/TablePagination.d.ts +3 -0
  117. package/src/lib/Table/DataGrid/index.d.ts +2 -0
  118. package/src/lib/Table/DataGrid/styles.d.ts +44 -0
  119. package/src/lib/Table/DataGrid/usePagination.d.ts +5 -0
  120. package/src/lib/Table/DataGrid/useTableQueryPagination.d.ts +11 -0
  121. package/src/lib/Table/DataGrid/useTableQuerySorting.d.ts +6 -0
  122. package/src/lib/Table/SimpleTable/SimpleTable.d.ts +17 -0
  123. package/src/lib/Table/SimpleTable/TableActionCell.d.ts +10 -0
  124. package/src/lib/Table/SimpleTable/index.d.ts +2 -0
  125. package/src/lib/Table/SimpleTable/useTablePagination.d.ts +7 -0
  126. package/src/lib/Table/SimpleTable/useTableSorting.d.ts +6 -0
  127. package/src/lib/Table/index.d.ts +2 -0
  128. package/src/lib/Tabs/RouteTabs.d.ts +11 -0
  129. package/src/lib/Tabs/TabPanel.d.ts +25 -0
  130. package/src/lib/Tabs/{index.ts → index.d.ts} +2 -2
  131. package/src/lib/{index.ts → index.d.ts} +16 -16
  132. package/src/theme/baseTheme.d.ts +2 -0
  133. package/src/theme/index.d.ts +1 -0
  134. package/src/theme/inputThemeOptions.d.ts +117 -0
  135. package/src/theme/stepperThemeOptions.d.ts +16 -0
  136. package/src/theme/tableThemeOptions.d.ts +47 -0
  137. package/src/theme/typographyThemeOptions.d.ts +29 -0
  138. package/src/utils/common.d.ts +7 -0
  139. package/src/utils/dem.d.ts +27 -0
  140. package/src/utils/hooks.d.ts +7 -0
  141. package/src/utils/{index.ts → index.d.ts} +5 -5
  142. package/src/utils/ui-utils.d.ts +16 -0
  143. package/src/utils/validators.d.ts +5 -0
  144. package/.babelrc +0 -13
  145. package/.eslintrc.json +0 -22
  146. package/jest.config.ts +0 -11
  147. package/project.json +0 -89
  148. package/rollup.config.js +0 -146
  149. package/src/assets/chevron_left_gray.svg +0 -3
  150. package/src/consts/index.ts +0 -13
  151. package/src/interfaces/common.ts +0 -18
  152. package/src/interfaces/definition.ts +0 -143
  153. package/src/interfaces/ui.ts +0 -80
  154. package/src/lib/Alert/Alert.tsx +0 -108
  155. package/src/lib/Alert/index.ts +0 -1
  156. package/src/lib/Breadcrumbs/Breadcrumbs.styled.tsx +0 -16
  157. package/src/lib/Breadcrumbs/Breadcrumbs.tsx +0 -40
  158. package/src/lib/ContentLayout/ContentLayout.tsx +0 -31
  159. package/src/lib/ContentLayout/index.ts +0 -1
  160. package/src/lib/Definition/CreateDefinition/CreateDefinition.tsx +0 -78
  161. package/src/lib/Definition/DefinitionFiller/DefinitionFiller.tsx +0 -71
  162. package/src/lib/Definition/DefinitionValueView/DefinitionValueView.tsx +0 -54
  163. package/src/lib/Definition/DefinitionValueView/PropertyDataView.tsx +0 -67
  164. package/src/lib/Forms/BackButton.tsx +0 -46
  165. package/src/lib/Forms/ControlAceEditor.tsx +0 -125
  166. package/src/lib/Forms/ControlAutocomplete.tsx +0 -145
  167. package/src/lib/Forms/ControlCheckbox.tsx +0 -113
  168. package/src/lib/Forms/ControlDate.tsx +0 -75
  169. package/src/lib/Forms/ControlDateTime.tsx +0 -77
  170. package/src/lib/Forms/ControlDebouncedInput.tsx +0 -80
  171. package/src/lib/Forms/ControlInput.tsx +0 -111
  172. package/src/lib/Forms/ControlNumberInput.tsx +0 -121
  173. package/src/lib/Forms/ControlQueryAutocomplete.tsx +0 -197
  174. package/src/lib/Forms/ControlRadio.tsx +0 -136
  175. package/src/lib/Forms/ControlSelect.tsx +0 -164
  176. package/src/lib/Forms/ControlSwitch.tsx +0 -71
  177. package/src/lib/Forms/ControlTime.tsx +0 -93
  178. package/src/lib/Forms/CopyButton.tsx +0 -46
  179. package/src/lib/Forms/useAutocomplete.tsx +0 -47
  180. package/src/lib/InfoItem/InfoItem.tsx +0 -40
  181. package/src/lib/InfoItem/styles.ts +0 -17
  182. package/src/lib/JsonPathPicker/JsonPathPicker.tsx +0 -73
  183. package/src/lib/JsonPathPicker/PropertyStep.tsx +0 -70
  184. package/src/lib/JsonView/JsonView.tsx +0 -41
  185. package/src/lib/Loader/Loader.tsx +0 -41
  186. package/src/lib/Modals/JsonModalView.tsx +0 -53
  187. package/src/lib/Property/PropertyFiller/JsonEditor.tsx +0 -58
  188. package/src/lib/Property/PropertyFiller/MultiplePropertyFiller.tsx +0 -129
  189. package/src/lib/Property/PropertyFiller/MultiplePropertyWidget.tsx +0 -85
  190. package/src/lib/Property/PropertyFiller/PropertyFiller.tsx +0 -199
  191. package/src/lib/Property/PropertyFiller/usePropertyFiller.ts +0 -72
  192. package/src/lib/Property/PropertyFiller/useStyles.ts +0 -12
  193. package/src/lib/Property/PropertyValidator/NodeValidator.tsx +0 -92
  194. package/src/lib/Property/PropertyValidator/NodesList.tsx +0 -26
  195. package/src/lib/Property/PropertyValidator/NumericTypeValidator.tsx +0 -59
  196. package/src/lib/Property/PropertyValidator/PropertyValidator.tsx +0 -42
  197. package/src/lib/Property/PropertyValidator/PropertyValidatorContext.tsx +0 -4
  198. package/src/lib/Property/PropertyValidator/StringTypeValidator.tsx +0 -36
  199. package/src/lib/Property/PropertyValidator/ValidationNodeSelector.tsx +0 -62
  200. package/src/lib/Property/PropertyValidator/index.ts +0 -1
  201. package/src/lib/Property/PropertyValueField/BooleanValueField.tsx +0 -49
  202. package/src/lib/Property/PropertyValueField/DateTimeValueField.tsx +0 -58
  203. package/src/lib/Property/PropertyValueField/DateValueField.tsx +0 -58
  204. package/src/lib/Property/PropertyValueField/JsonValueField.tsx +0 -65
  205. package/src/lib/Property/PropertyValueField/PropertyValueField.tsx +0 -49
  206. package/src/lib/Property/PropertyValueField/StringValueField.tsx +0 -50
  207. package/src/lib/Property/PropertyValueField/TimeValueField.tsx +0 -67
  208. package/src/lib/Property/PropertyWidget/PropertyWidget.tsx +0 -115
  209. package/src/lib/Property/UpsertProperty/CreatePropertiesList.tsx +0 -148
  210. package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.tsx +0 -158
  211. package/src/lib/Property/UpsertProperty/CustomPropertyField.tsx +0 -40
  212. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/BigDecimalPropertyFields.tsx +0 -41
  213. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/DateAdditionalFields.tsx +0 -27
  214. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.tsx +0 -133
  215. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityReferencePropertyFields.tsx +0 -46
  216. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.tsx +0 -52
  217. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/StringPropertyFields.tsx +0 -103
  218. package/src/lib/Property/UpsertProperty/useCustomFields.ts +0 -22
  219. package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.tsx +0 -37
  220. package/src/lib/Property/ViewProperty/EntityPropertiesShortView.tsx +0 -40
  221. package/src/lib/Property/ViewProperty/EntityPropertiesView.tsx +0 -48
  222. package/src/lib/Property/ViewProperty/PropertyDataTable.tsx +0 -148
  223. package/src/lib/Property/ViewProperty/PropertyItem.tsx +0 -43
  224. package/src/lib/Property/ViewProperty/ViewProperty.tsx +0 -52
  225. package/src/lib/Sidebar/Sidebar.styled.tsx +0 -157
  226. package/src/lib/Sidebar/Sidebar.tsx +0 -27
  227. package/src/lib/Sidebar/SidebarContext.tsx +0 -37
  228. package/src/lib/Sidebar/SidebarDrawer.tsx +0 -50
  229. package/src/lib/Sidebar/SidebarLink/MenuIcon.tsx +0 -16
  230. package/src/lib/Sidebar/SidebarLink/SidebarLink.tsx +0 -54
  231. package/src/lib/Sidebar/SidebarLink/SidebarLinkItem.tsx +0 -54
  232. package/src/lib/Sidebar/SidebarLink/SidebarNestedItem.tsx +0 -62
  233. package/src/lib/Sidebar/index.ts +0 -2
  234. package/src/lib/Status/Status.tsx +0 -16
  235. package/src/lib/Status/styles.ts +0 -21
  236. package/src/lib/StepperView/StepperView.tsx +0 -73
  237. package/src/lib/Table/DataGrid/JsonTypeCell.tsx +0 -51
  238. package/src/lib/Table/DataGrid/Table.tsx +0 -117
  239. package/src/lib/Table/DataGrid/TableAction.tsx +0 -43
  240. package/src/lib/Table/DataGrid/TableColumnMenu.tsx +0 -12
  241. package/src/lib/Table/DataGrid/TablePagination.tsx +0 -42
  242. package/src/lib/Table/DataGrid/index.ts +0 -2
  243. package/src/lib/Table/DataGrid/styles.ts +0 -59
  244. package/src/lib/Table/DataGrid/usePagination.ts +0 -15
  245. package/src/lib/Table/DataGrid/useTableQueryPagination.ts +0 -47
  246. package/src/lib/Table/DataGrid/useTableQuerySorting.ts +0 -47
  247. package/src/lib/Table/SimpleTable/SimpleTable.tsx +0 -138
  248. package/src/lib/Table/SimpleTable/TableActionCell.tsx +0 -67
  249. package/src/lib/Table/SimpleTable/index.ts +0 -2
  250. package/src/lib/Table/SimpleTable/useTablePagination.ts +0 -54
  251. package/src/lib/Table/SimpleTable/useTableSorting.ts +0 -50
  252. package/src/lib/Table/index.ts +0 -2
  253. package/src/lib/Tabs/RouteTabs.tsx +0 -54
  254. package/src/lib/Tabs/TabPanel.tsx +0 -42
  255. package/src/theme/baseTheme.ts +0 -41
  256. package/src/theme/fonts.d.ts +0 -2
  257. package/src/theme/index.ts +0 -126
  258. package/src/theme/inputThemeOptions.ts +0 -126
  259. package/src/theme/stepperThemeOptions.ts +0 -20
  260. package/src/theme/tableThemeOptions.ts +0 -50
  261. package/src/theme/typographyThemeOptions.ts +0 -32
  262. package/src/utils/common.ts +0 -73
  263. package/src/utils/dem.ts +0 -431
  264. package/src/utils/hooks.ts +0 -41
  265. package/src/utils/ui-utils.tsx +0 -134
  266. package/src/utils/validators.ts +0 -14
  267. package/tsconfig.json +0 -25
  268. package/tsconfig.lib.json +0 -23
  269. package/tsconfig.spec.json +0 -20
@@ -1,47 +0,0 @@
1
- import Box from '@mui/material/Box';
2
- import { useCallback } from 'react';
3
-
4
- const useAutocomplete = ({ valueKey, labelKey }) => {
5
- const isOptionEqualToValue = useCallback(
6
- (option, value) => {
7
- if (option && value) {
8
- if (typeof option === 'string') {
9
- return option === value;
10
- } else if (valueKey) {
11
- return option[valueKey] === value[valueKey] || option[valueKey] === value;
12
- } else if (option.value) {
13
- return option.value === value.value || option.value === value;
14
- }
15
- }
16
- return false;
17
- },
18
- [valueKey]
19
- );
20
-
21
- const getOptionLabel = useCallback(
22
- (option) => {
23
- if (!option) return '';
24
- if (typeof option === 'string') {
25
- return option;
26
- } else if (labelKey && option[labelKey]) {
27
- return option[labelKey] + '';
28
- } else {
29
- return option.label + '' || option.name + '' || option.value + '' || option.code + '' || '--no label--';
30
- }
31
- },
32
- [labelKey]
33
- );
34
-
35
- const renderOption = useCallback(
36
- (props, option) => (
37
- <Box {...props} component="li" key={props.id}>
38
- {getOptionLabel(option)}
39
- </Box>
40
- ),
41
- [getOptionLabel]
42
- );
43
-
44
- return { isOptionEqualToValue, getOptionLabel, renderOption };
45
- };
46
-
47
- export default useAutocomplete;
@@ -1,40 +0,0 @@
1
- import AceEditor from 'react-ace';
2
- import useStyles from './styles';
3
- import 'ace-builds/src-noconflict/ace';
4
- import 'ace-builds/src-noconflict/mode-json';
5
-
6
- type Props = {
7
- title: string;
8
- text?: string;
9
- json?: any;
10
- };
11
-
12
- export const InfoItem = ({ title, text, json }: Props) => {
13
- const { classes } = useStyles();
14
-
15
- return (
16
- <div className={classes.container}>
17
- <div className={classes.title}>{title}</div>
18
- {text && <div className={classes.text}>{text}</div>}
19
- {json && (
20
- <AceEditor
21
- readOnly
22
- value={json}
23
- mode="json"
24
- height="300px"
25
- width="100%"
26
- fontSize="16"
27
- setOptions={{
28
- enableSnippets: false,
29
- copyWithEmptySelection: true,
30
- showLineNumbers: true,
31
- tabSize: 2,
32
- useWorker: false
33
- }}
34
- />
35
- )}
36
- </div>
37
- );
38
- };
39
-
40
- export default InfoItem;
@@ -1,17 +0,0 @@
1
- import { makeStyles } from 'tss-react/mui';
2
-
3
- export default makeStyles()(() => ({
4
- container: {
5
- // borderBottom: '1px solid #ccc',
6
- paddingBottom: '8px',
7
- },
8
- title: {
9
- fontSize: '14px',
10
- fontWeight: 600,
11
- color: '#536DFE',
12
- },
13
- text: {
14
- fontSize: '18px',
15
- wordWrap: 'break-word',
16
- },
17
- }));
@@ -1,73 +0,0 @@
1
- import Button from '@mui/material/Button';
2
- import Dialog from '@mui/material/Dialog';
3
- import DialogTitle from '@mui/material/DialogTitle';
4
- import DialogContent from '@mui/material/DialogContent';
5
- import DialogActions from '@mui/material/DialogActions';
6
- import Typography from '@mui/material/Typography';
7
- import PropertyStep from './PropertyStep';
8
-
9
- import { useState } from 'react';
10
- import { toast } from 'react-toastify';
11
- import { JsonPathPickerProperty } from '../../interfaces';
12
-
13
- type Props = {
14
- properties: JsonPathPickerProperty[];
15
- open: boolean;
16
- onClose: () => void;
17
- onPaste: (path: string) => void;
18
- };
19
-
20
- export const JsonPathPicker = ({ open = false, onClose, onPaste, properties }: Props) => {
21
- const [selectedPropertyPath, setSelectedPropertyPath] = useState<string>('');
22
-
23
- const onCopy = () => {
24
- navigator.clipboard.writeText(`$(${selectedPropertyPath})`);
25
- toast.success('Copied!');
26
- };
27
-
28
- const handlePaste = () => {
29
- onPaste(`$(${selectedPropertyPath})`);
30
- toast.success('Pasted!');
31
- };
32
-
33
- return (
34
- <Dialog open={open} onClose={onClose} fullWidth maxWidth="md">
35
- <DialogTitle>JSON path picker</DialogTitle>
36
- <DialogContent>
37
- {properties?.length ? (
38
- properties.map((propEl, index) => (
39
- <div key={index}>
40
- <Typography variant="h6">{propEl.title}</Typography>
41
- <PropertyStep
42
- properties={propEl.properties}
43
- prefix={propEl.pathPrefix}
44
- onClick={setSelectedPropertyPath}
45
- activePath={selectedPropertyPath}
46
- />
47
- </div>
48
- ))
49
- ) : (
50
- <Typography>Please, add properties</Typography>
51
- )}
52
- {selectedPropertyPath && (
53
- <Typography variant="h6" gutterBottom>
54
- Selected path : $({selectedPropertyPath})
55
- </Typography>
56
- )}
57
- </DialogContent>
58
- <DialogActions>
59
- <Button variant="contained" color="primary" onClick={onCopy}>
60
- Copy
61
- </Button>
62
- <Button variant="contained" color="primary" onClick={handlePaste}>
63
- Paste
64
- </Button>
65
- <Button variant="contained" color="secondary" onClick={onClose}>
66
- Close
67
- </Button>
68
- </DialogActions>
69
- </Dialog>
70
- );
71
- };
72
-
73
- export default JsonPathPicker;
@@ -1,70 +0,0 @@
1
- import Stepper from '@mui/material/Stepper';
2
- import Step from '@mui/material/Step';
3
- import StepLabel from '@mui/material/StepLabel';
4
- import StepContent from '@mui/material/StepContent';
5
-
6
- import { EntityTypeProperty, PropertiesArrayType, PropertyType } from '../../interfaces';
7
- import { makeStyles } from 'tss-react/mui';
8
-
9
- type Props = {
10
- properties: PropertiesArrayType;
11
- parentKey?: string;
12
- activePath: string;
13
- prefix?: string;
14
- onClick: (path: string) => void;
15
- };
16
-
17
- const useStyles = makeStyles()(() => ({
18
- propertyStepLabel: {
19
- '&:hover': {
20
- fontWeight: '600',
21
- cursor: 'pointer',
22
- },
23
- },
24
- }));
25
-
26
- const PropertyStep = ({ properties, parentKey = '', activePath = '', prefix = '', onClick }: Props) => {
27
- const { classes } = useStyles();
28
-
29
- const handleClick = (path: string) => {
30
- if (prefix) {
31
- onClick(`${prefix}.${path}`);
32
- } else {
33
- onClick(path);
34
- }
35
- };
36
-
37
- return (
38
- <Stepper orientation="vertical" onClick={(event) => event.stopPropagation()}>
39
- {properties &&
40
- properties.map((property) => {
41
- const fullPropertyPath = parentKey ? `${parentKey}.${property.key}` : property.key;
42
- const propertyType = property.propertyType['value'] ?? property.propertyType;
43
- return (
44
- <Step expanded key={property.key} onClick={() => handleClick(fullPropertyPath)}>
45
- <StepLabel StepIconProps={{ icon: '', completed: false, active: activePath === fullPropertyPath }}>
46
- <div className={classes.propertyStepLabel}>
47
- {property.name} - {property.key} - {propertyType}
48
- </div>
49
- </StepLabel>
50
- <StepContent>
51
- <div>
52
- {propertyType === PropertyType.ENTITY && (
53
- <PropertyStep
54
- key={property.key}
55
- onClick={onClick}
56
- activePath={activePath}
57
- properties={(property as EntityTypeProperty).properties as PropertiesArrayType}
58
- parentKey={fullPropertyPath}
59
- />
60
- )}
61
- </div>
62
- </StepContent>
63
- </Step>
64
- );
65
- })}
66
- </Stepper>
67
- );
68
- };
69
-
70
- export default PropertyStep;
@@ -1,41 +0,0 @@
1
- import { useMemo } from 'react';
2
- import CodeMirror from '@uiw/react-codemirror';
3
- import { langs } from '@uiw/codemirror-extensions-langs';
4
-
5
- type Props = {
6
- value: unknown;
7
- height?: string;
8
- };
9
-
10
-
11
- export const JsonView = ({ value, height = '200px' }: Props) => {
12
-
13
- const stringValue = useMemo(() => {
14
- if (typeof value === 'string') {
15
- return value;
16
- } else if (typeof value === 'object') {
17
- try {
18
- return JSON.stringify(value, null, 2);
19
- } catch (error) {
20
- return 'Failed to stringify Object';
21
- }
22
- }
23
- return '';
24
- }, [value]);
25
-
26
- return (
27
- <CodeMirror
28
- readOnly
29
- width="100%"
30
- value={stringValue}
31
- height={height}
32
- basicSetup={{
33
- autocompletion: true,
34
- history: true
35
- }}
36
- extensions={[langs.json()]}
37
- style={{ fontSize: 16 }}
38
-
39
- />
40
- );
41
- };
@@ -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;