@dartech/arsenal-ui 1.2.5 → 1.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/{index.ts → index.d.ts} +5 -5
  2. package/index.js +1 -0
  3. package/package.json +12 -3
  4. package/src/consts/index.d.ts +12 -0
  5. package/src/interfaces/common.d.ts +17 -0
  6. package/src/interfaces/definition.d.ts +107 -0
  7. package/src/interfaces/{index.ts → index.d.ts} +3 -3
  8. package/src/interfaces/ui.d.ts +70 -0
  9. package/src/lib/Alert/Alert.d.ts +53 -0
  10. package/src/lib/Alert/index.d.ts +1 -0
  11. package/src/lib/Breadcrumbs/Breadcrumbs.d.ts +9 -0
  12. package/src/lib/Breadcrumbs/Breadcrumbs.styled.d.ts +2 -0
  13. package/src/lib/Breadcrumbs/{index.ts → index.d.ts} +1 -1
  14. package/src/lib/ContentLayout/ContentLayout.d.ts +9 -0
  15. package/src/lib/ContentLayout/index.d.ts +1 -0
  16. package/src/lib/Definition/CreateDefinition/CreateDefinition.d.ts +11 -0
  17. package/src/lib/Definition/CreateDefinition/{index.ts → index.d.ts} +1 -1
  18. package/src/lib/Definition/DefinitionFiller/DefinitionFiller.d.ts +10 -0
  19. package/src/lib/Definition/DefinitionFiller/{index.ts → index.d.ts} +1 -1
  20. package/src/lib/Definition/DefinitionValueView/DefinitionValueView.d.ts +8 -0
  21. package/src/lib/Definition/DefinitionValueView/PropertyDataView.d.ts +9 -0
  22. package/src/lib/Definition/DefinitionValueView/{index.ts → index.d.ts} +1 -1
  23. package/src/lib/Definition/{index.ts → index.d.ts} +3 -3
  24. package/src/lib/Forms/BackButton.d.ts +7 -0
  25. package/src/lib/Forms/ControlAceEditor.d.ts +24 -0
  26. package/src/lib/Forms/ControlAutocomplete.d.ts +69 -0
  27. package/src/lib/Forms/ControlCheckbox.d.ts +51 -0
  28. package/src/lib/Forms/ControlDate.d.ts +18 -0
  29. package/src/lib/Forms/ControlDateTime.d.ts +18 -0
  30. package/src/lib/Forms/ControlDebouncedInput.d.ts +4 -0
  31. package/src/lib/Forms/ControlInput.d.ts +59 -0
  32. package/src/lib/Forms/ControlNumberInput.d.ts +51 -0
  33. package/src/lib/Forms/ControlQueryAutocomplete.d.ts +16 -0
  34. package/src/lib/Forms/ControlRadio.d.ts +66 -0
  35. package/src/lib/Forms/ControlSelect.d.ts +67 -0
  36. package/src/lib/Forms/ControlSwitch.d.ts +19 -0
  37. package/src/lib/Forms/ControlTime.d.ts +18 -0
  38. package/src/lib/Forms/CopyButton.d.ts +20 -0
  39. package/src/lib/Forms/{index.ts → index.d.ts} +15 -15
  40. package/src/lib/Forms/useAutocomplete.d.ts +10 -0
  41. package/src/lib/InfoItem/InfoItem.d.ts +10 -0
  42. package/src/lib/InfoItem/{index.ts → index.d.ts} +1 -1
  43. package/src/lib/InfoItem/styles.d.ts +12 -0
  44. package/src/lib/JsonPathPicker/JsonPathPicker.d.ts +10 -0
  45. package/src/lib/JsonPathPicker/PropertyStep.d.ts +11 -0
  46. package/src/lib/JsonPathPicker/{index.ts → index.d.ts} +1 -1
  47. package/src/lib/JsonView/JsonView.d.ts +7 -0
  48. package/src/lib/JsonView/{index.ts → index.d.ts} +1 -1
  49. package/src/lib/Loader/Loader.d.ts +21 -0
  50. package/src/lib/Loader/{index.ts → index.d.ts} +1 -1
  51. package/src/lib/Modals/JsonModalView.d.ts +10 -0
  52. package/src/lib/Modals/{index.ts → index.d.ts} +1 -1
  53. package/src/lib/Property/PropertyFiller/JsonEditor.d.ts +10 -0
  54. package/src/lib/Property/PropertyFiller/MultiplePropertyFiller.d.ts +12 -0
  55. package/src/lib/Property/PropertyFiller/MultiplePropertyWidget.d.ts +11 -0
  56. package/src/lib/Property/PropertyFiller/PropertyFiller.d.ts +12 -0
  57. package/src/lib/Property/PropertyFiller/{index.ts → index.d.ts} +2 -2
  58. package/src/lib/Property/PropertyFiller/usePropertyFiller.d.ts +24 -0
  59. package/src/lib/Property/PropertyFiller/useStyles.d.ts +12 -0
  60. package/src/lib/Property/PropertyValidator/NodeValidator.d.ts +6 -0
  61. package/src/lib/Property/PropertyValidator/NodesList.d.ts +6 -0
  62. package/src/lib/Property/PropertyValidator/NumericTypeValidator.d.ts +8 -0
  63. package/src/lib/Property/PropertyValidator/PropertyValidator.d.ts +6 -0
  64. package/src/lib/Property/PropertyValidator/PropertyValidatorContext.d.ts +3 -0
  65. package/src/lib/Property/PropertyValidator/StringTypeValidator.d.ts +8 -0
  66. package/src/lib/Property/PropertyValidator/ValidationNodeSelector.d.ts +7 -0
  67. package/src/lib/Property/PropertyValidator/index.d.ts +1 -0
  68. package/src/lib/Property/PropertyValueField/BooleanValueField.d.ts +7 -0
  69. package/src/lib/Property/PropertyValueField/DateTimeValueField.d.ts +9 -0
  70. package/src/lib/Property/PropertyValueField/DateValueField.d.ts +9 -0
  71. package/src/lib/Property/PropertyValueField/JsonValueField.d.ts +10 -0
  72. package/src/lib/Property/PropertyValueField/PropertyValueField.d.ts +9 -0
  73. package/src/lib/Property/PropertyValueField/StringValueField.d.ts +9 -0
  74. package/src/lib/Property/PropertyValueField/TimeValueField.d.ts +9 -0
  75. package/src/lib/Property/PropertyValueField/{index.ts → index.d.ts} +1 -1
  76. package/src/lib/Property/PropertyWidget/PropertyWidget.d.ts +13 -0
  77. package/src/lib/Property/PropertyWidget/{index.ts → index.d.ts} +1 -1
  78. package/src/lib/Property/UpsertProperty/CreatePropertiesList.d.ts +13 -0
  79. package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.d.ts +10 -0
  80. package/src/lib/Property/UpsertProperty/CustomPropertyField.d.ts +7 -0
  81. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/BigDecimalPropertyFields.d.ts +6 -0
  82. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/DateAdditionalFields.d.ts +7 -0
  83. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.d.ts +8 -0
  84. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityReferencePropertyFields.d.ts +6 -0
  85. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.d.ts +10 -0
  86. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/StringPropertyFields.d.ts +6 -0
  87. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/{index.ts → index.d.ts} +1 -1
  88. package/src/lib/Property/UpsertProperty/{index.ts → index.d.ts} +2 -2
  89. package/src/lib/Property/UpsertProperty/useCustomFields.d.ts +6 -0
  90. package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.d.ts +8 -0
  91. package/src/lib/Property/ViewPropertiesList/{index.ts → index.d.ts} +1 -1
  92. package/src/lib/Property/ViewProperty/EntityPropertiesShortView.d.ts +7 -0
  93. package/src/lib/Property/ViewProperty/EntityPropertiesView.d.ts +8 -0
  94. package/src/lib/Property/ViewProperty/PropertyDataTable.d.ts +7 -0
  95. package/src/lib/Property/ViewProperty/PropertyItem.d.ts +9 -0
  96. package/src/lib/Property/ViewProperty/ViewProperty.d.ts +9 -0
  97. package/src/lib/Property/ViewProperty/{index.ts → index.d.ts} +1 -1
  98. package/src/lib/Property/{index.ts → index.d.ts} +5 -5
  99. package/src/lib/Sidebar/Sidebar.d.ts +10 -0
  100. package/src/lib/Sidebar/Sidebar.styled.d.ts +117 -0
  101. package/src/lib/Sidebar/SidebarContext.d.ts +11 -0
  102. package/src/lib/Sidebar/SidebarDrawer.d.ts +9 -0
  103. package/src/lib/Sidebar/SidebarLink/MenuIcon.d.ts +7 -0
  104. package/src/lib/Sidebar/SidebarLink/SidebarLink.d.ts +7 -0
  105. package/src/lib/Sidebar/SidebarLink/SidebarLinkItem.d.ts +8 -0
  106. package/src/lib/Sidebar/SidebarLink/SidebarNestedItem.d.ts +10 -0
  107. package/src/lib/Sidebar/SidebarLink/{index.ts → index.d.ts} +2 -2
  108. package/src/lib/Sidebar/index.d.ts +2 -0
  109. package/src/lib/Status/Status.d.ts +8 -0
  110. package/src/lib/Status/{index.ts → index.d.ts} +1 -1
  111. package/src/lib/Status/styles.d.ts +12 -0
  112. package/src/lib/StepperView/StepperView.d.ts +11 -0
  113. package/src/lib/StepperView/{index.ts → index.d.ts} +1 -1
  114. package/src/lib/Table/DataGrid/JsonTypeCell.d.ts +7 -0
  115. package/src/lib/Table/DataGrid/Table.d.ts +49 -0
  116. package/src/lib/Table/DataGrid/TableAction.d.ts +13 -0
  117. package/src/lib/Table/DataGrid/TableColumnMenu.d.ts +3 -0
  118. package/src/lib/Table/DataGrid/TablePagination.d.ts +3 -0
  119. package/src/lib/Table/DataGrid/index.d.ts +2 -0
  120. package/src/lib/Table/DataGrid/styles.d.ts +12 -0
  121. package/src/lib/Table/DataGrid/usePagination.d.ts +5 -0
  122. package/src/lib/Table/DataGrid/useTableQueryPagination.d.ts +11 -0
  123. package/src/lib/Table/DataGrid/useTableQuerySorting.d.ts +6 -0
  124. package/src/lib/Table/SimpleTable/SimpleTable.d.ts +17 -0
  125. package/src/lib/Table/SimpleTable/TableActionCell.d.ts +10 -0
  126. package/src/lib/Table/SimpleTable/index.d.ts +2 -0
  127. package/src/lib/Table/SimpleTable/useTablePagination.d.ts +7 -0
  128. package/src/lib/Table/SimpleTable/useTableSorting.d.ts +6 -0
  129. package/src/lib/Table/index.d.ts +2 -0
  130. package/src/lib/Tabs/RouteTabs.d.ts +11 -0
  131. package/src/lib/Tabs/TabPanel.d.ts +25 -0
  132. package/src/lib/Tabs/{index.ts → index.d.ts} +2 -2
  133. package/src/lib/{index.ts → index.d.ts} +16 -16
  134. package/src/theme/baseTheme.d.ts +2 -0
  135. package/src/theme/index.d.ts +1 -0
  136. package/src/theme/inputThemeOptions.d.ts +117 -0
  137. package/src/theme/stepperThemeOptions.d.ts +16 -0
  138. package/src/theme/tableThemeOptions.d.ts +47 -0
  139. package/src/theme/typographyThemeOptions.d.ts +29 -0
  140. package/src/utils/common.d.ts +7 -0
  141. package/src/utils/dem.d.ts +27 -0
  142. package/src/utils/hooks.d.ts +7 -0
  143. package/src/utils/{index.ts → index.d.ts} +5 -5
  144. package/src/utils/ui-utils.d.ts +14 -0
  145. package/src/utils/validators.d.ts +5 -0
  146. package/.babelrc +0 -13
  147. package/.eslintrc.json +0 -22
  148. package/jest.config.ts +0 -11
  149. package/project.json +0 -94
  150. package/rollup.config.js +0 -146
  151. package/src/assets/chevron_left_gray.svg +0 -3
  152. package/src/consts/index.ts +0 -13
  153. package/src/interfaces/common.ts +0 -18
  154. package/src/interfaces/definition.ts +0 -143
  155. package/src/interfaces/ui.ts +0 -80
  156. package/src/lib/Alert/Alert.tsx +0 -108
  157. package/src/lib/Alert/index.ts +0 -1
  158. package/src/lib/Breadcrumbs/Breadcrumbs.styled.tsx +0 -16
  159. package/src/lib/Breadcrumbs/Breadcrumbs.tsx +0 -40
  160. package/src/lib/ContentLayout/ContentLayout.tsx +0 -31
  161. package/src/lib/ContentLayout/index.ts +0 -1
  162. package/src/lib/Definition/CreateDefinition/CreateDefinition.tsx +0 -78
  163. package/src/lib/Definition/DefinitionFiller/DefinitionFiller.tsx +0 -71
  164. package/src/lib/Definition/DefinitionValueView/DefinitionValueView.tsx +0 -54
  165. package/src/lib/Definition/DefinitionValueView/PropertyDataView.tsx +0 -67
  166. package/src/lib/Forms/BackButton.tsx +0 -46
  167. package/src/lib/Forms/ControlAceEditor.tsx +0 -125
  168. package/src/lib/Forms/ControlAutocomplete.tsx +0 -145
  169. package/src/lib/Forms/ControlCheckbox.tsx +0 -113
  170. package/src/lib/Forms/ControlDate.tsx +0 -75
  171. package/src/lib/Forms/ControlDateTime.tsx +0 -77
  172. package/src/lib/Forms/ControlDebouncedInput.tsx +0 -80
  173. package/src/lib/Forms/ControlInput.tsx +0 -111
  174. package/src/lib/Forms/ControlNumberInput.tsx +0 -121
  175. package/src/lib/Forms/ControlQueryAutocomplete.tsx +0 -197
  176. package/src/lib/Forms/ControlRadio.tsx +0 -136
  177. package/src/lib/Forms/ControlSelect.tsx +0 -164
  178. package/src/lib/Forms/ControlSwitch.tsx +0 -71
  179. package/src/lib/Forms/ControlTime.tsx +0 -93
  180. package/src/lib/Forms/CopyButton.tsx +0 -46
  181. package/src/lib/Forms/useAutocomplete.tsx +0 -47
  182. package/src/lib/InfoItem/InfoItem.tsx +0 -40
  183. package/src/lib/InfoItem/styles.ts +0 -17
  184. package/src/lib/JsonPathPicker/JsonPathPicker.tsx +0 -73
  185. package/src/lib/JsonPathPicker/PropertyStep.tsx +0 -70
  186. package/src/lib/JsonView/JsonView.tsx +0 -41
  187. package/src/lib/Loader/Loader.tsx +0 -41
  188. package/src/lib/Modals/JsonModalView.tsx +0 -53
  189. package/src/lib/Property/PropertyFiller/JsonEditor.tsx +0 -58
  190. package/src/lib/Property/PropertyFiller/MultiplePropertyFiller.tsx +0 -129
  191. package/src/lib/Property/PropertyFiller/MultiplePropertyWidget.tsx +0 -85
  192. package/src/lib/Property/PropertyFiller/PropertyFiller.tsx +0 -199
  193. package/src/lib/Property/PropertyFiller/usePropertyFiller.ts +0 -72
  194. package/src/lib/Property/PropertyFiller/useStyles.ts +0 -12
  195. package/src/lib/Property/PropertyValidator/NodeValidator.tsx +0 -92
  196. package/src/lib/Property/PropertyValidator/NodesList.tsx +0 -26
  197. package/src/lib/Property/PropertyValidator/NumericTypeValidator.tsx +0 -59
  198. package/src/lib/Property/PropertyValidator/PropertyValidator.tsx +0 -42
  199. package/src/lib/Property/PropertyValidator/PropertyValidatorContext.tsx +0 -4
  200. package/src/lib/Property/PropertyValidator/StringTypeValidator.tsx +0 -36
  201. package/src/lib/Property/PropertyValidator/ValidationNodeSelector.tsx +0 -62
  202. package/src/lib/Property/PropertyValidator/index.ts +0 -1
  203. package/src/lib/Property/PropertyValueField/BooleanValueField.tsx +0 -49
  204. package/src/lib/Property/PropertyValueField/DateTimeValueField.tsx +0 -58
  205. package/src/lib/Property/PropertyValueField/DateValueField.tsx +0 -58
  206. package/src/lib/Property/PropertyValueField/JsonValueField.tsx +0 -65
  207. package/src/lib/Property/PropertyValueField/PropertyValueField.tsx +0 -49
  208. package/src/lib/Property/PropertyValueField/StringValueField.tsx +0 -50
  209. package/src/lib/Property/PropertyValueField/TimeValueField.tsx +0 -67
  210. package/src/lib/Property/PropertyWidget/PropertyWidget.tsx +0 -115
  211. package/src/lib/Property/UpsertProperty/CreatePropertiesList.tsx +0 -148
  212. package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.tsx +0 -158
  213. package/src/lib/Property/UpsertProperty/CustomPropertyField.tsx +0 -40
  214. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/BigDecimalPropertyFields.tsx +0 -41
  215. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/DateAdditionalFields.tsx +0 -27
  216. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.tsx +0 -133
  217. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityReferencePropertyFields.tsx +0 -46
  218. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.tsx +0 -52
  219. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/StringPropertyFields.tsx +0 -103
  220. package/src/lib/Property/UpsertProperty/useCustomFields.ts +0 -22
  221. package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.tsx +0 -37
  222. package/src/lib/Property/ViewProperty/EntityPropertiesShortView.tsx +0 -40
  223. package/src/lib/Property/ViewProperty/EntityPropertiesView.tsx +0 -48
  224. package/src/lib/Property/ViewProperty/PropertyDataTable.tsx +0 -148
  225. package/src/lib/Property/ViewProperty/PropertyItem.tsx +0 -43
  226. package/src/lib/Property/ViewProperty/ViewProperty.tsx +0 -52
  227. package/src/lib/Sidebar/Sidebar.styled.tsx +0 -157
  228. package/src/lib/Sidebar/Sidebar.tsx +0 -27
  229. package/src/lib/Sidebar/SidebarContext.tsx +0 -37
  230. package/src/lib/Sidebar/SidebarDrawer.tsx +0 -50
  231. package/src/lib/Sidebar/SidebarLink/MenuIcon.tsx +0 -16
  232. package/src/lib/Sidebar/SidebarLink/SidebarLink.tsx +0 -54
  233. package/src/lib/Sidebar/SidebarLink/SidebarLinkItem.tsx +0 -54
  234. package/src/lib/Sidebar/SidebarLink/SidebarNestedItem.tsx +0 -62
  235. package/src/lib/Sidebar/index.ts +0 -2
  236. package/src/lib/Status/Status.tsx +0 -16
  237. package/src/lib/Status/styles.ts +0 -21
  238. package/src/lib/StepperView/StepperView.tsx +0 -73
  239. package/src/lib/Table/DataGrid/JsonTypeCell.tsx +0 -51
  240. package/src/lib/Table/DataGrid/Table.tsx +0 -117
  241. package/src/lib/Table/DataGrid/TableAction.tsx +0 -43
  242. package/src/lib/Table/DataGrid/TableColumnMenu.tsx +0 -12
  243. package/src/lib/Table/DataGrid/TablePagination.tsx +0 -42
  244. package/src/lib/Table/DataGrid/index.ts +0 -2
  245. package/src/lib/Table/DataGrid/styles.ts +0 -59
  246. package/src/lib/Table/DataGrid/usePagination.ts +0 -15
  247. package/src/lib/Table/DataGrid/useTableQueryPagination.ts +0 -47
  248. package/src/lib/Table/DataGrid/useTableQuerySorting.ts +0 -47
  249. package/src/lib/Table/SimpleTable/SimpleTable.tsx +0 -138
  250. package/src/lib/Table/SimpleTable/TableActionCell.tsx +0 -67
  251. package/src/lib/Table/SimpleTable/index.ts +0 -2
  252. package/src/lib/Table/SimpleTable/useTablePagination.ts +0 -54
  253. package/src/lib/Table/SimpleTable/useTableSorting.ts +0 -50
  254. package/src/lib/Table/index.ts +0 -2
  255. package/src/lib/Tabs/RouteTabs.tsx +0 -54
  256. package/src/lib/Tabs/TabPanel.tsx +0 -42
  257. package/src/theme/baseTheme.ts +0 -128
  258. package/src/theme/fonts.d.ts +0 -2
  259. package/src/theme/index.ts +0 -126
  260. package/src/theme/inputThemeOptions.ts +0 -126
  261. package/src/theme/stepperThemeOptions.ts +0 -20
  262. package/src/theme/tableThemeOptions.ts +0 -50
  263. package/src/theme/typographyThemeOptions.ts +0 -32
  264. package/src/utils/common.ts +0 -73
  265. package/src/utils/dem.ts +0 -431
  266. package/src/utils/hooks.ts +0 -41
  267. package/src/utils/ui-utils.tsx +0 -102
  268. package/src/utils/validators.ts +0 -14
  269. package/tsconfig.json +0 -25
  270. package/tsconfig.lib.json +0 -23
  271. package/tsconfig.spec.json +0 -20
@@ -1,73 +0,0 @@
1
- export const removeArrayItem = (arr: Array<unknown>, index: number) => {
2
- const newArr = [...arr];
3
- newArr.splice(index, 1);
4
- return newArr;
5
- };
6
-
7
- export const validateJson = (value: string): boolean => {
8
- try {
9
- JSON.parse(value);
10
- } catch (error) {
11
- return false;
12
- }
13
- return true;
14
- };
15
-
16
- export function capitalize(str: string): string {
17
- return str.replace(/(^\w)|([-\s]\w)/g, (c) => c.toUpperCase());
18
- }
19
-
20
- export const sortArrayOfObjects = (a: Record<string, unknown>, b: Record<string, unknown>, key: string, order = 'asc') => {
21
- const valueA = a[key];
22
- const valueB = b[key];
23
-
24
- if (valueA < valueB) return order === 'asc' ? -1 : 1;
25
- if (valueA > valueB) return order === 'asc' ? 1 : -1;
26
- return 0;
27
- };
28
-
29
- export const getJsonStringValue = (value: unknown): string => {
30
- if (!value) return '';
31
- if (typeof value === 'string') {
32
- try {
33
- return JSON.stringify(JSON.parse(value), null, 2)
34
- } catch (error) {
35
- return value;
36
- }
37
- } else {
38
- try {
39
- return JSON.stringify(value, null, 2);
40
- } catch (error) {
41
- return 'Failed to stringify JSON';
42
- }
43
- }
44
- };
45
-
46
- export const safeParseJson = (value: string) => {
47
- try {
48
- return JSON.parse(value);
49
- } catch (error) {
50
- return null;
51
- }
52
- };
53
-
54
- export const deepParseJson = (value: string) => {
55
- try {
56
- const parsedValue = JSON.parse(value);
57
- Object.keys(parsedValue).forEach((key) => {
58
- parsedValue[key] = deepParseJson(parsedValue[key]);
59
- });
60
- return parsedValue;
61
- } catch (error) {
62
- return value;
63
- }
64
- };
65
-
66
- // export const convertArrayToObjectByKey = (array: { [key: string]: string }[], key: string) => {
67
- // const obj = {};
68
- // array.forEach((el) => {
69
- // obj[el[key]] = { ...el };
70
- // delete obj[el[key]][key];
71
- // });
72
- // return obj;
73
- // };
package/src/utils/dem.ts DELETED
@@ -1,431 +0,0 @@
1
- import {
2
- PropertyType,
3
- EntityTypeProperty,
4
- PropertiesArrayType,
5
- PropertyUnion,
6
- PropertiesObjectType,
7
- PropertyFillType,
8
- } from '../interfaces';
9
- import { sortArrayOfObjects } from './common';
10
- import { format } from 'date-fns';
11
-
12
- export const isPropertyValueEmpty = (value: unknown): boolean => {
13
- if (value || value === 0 || value === false) {
14
- return false;
15
- }
16
- return true;
17
- };
18
-
19
- const formatPropertyValue = (
20
- propertyType: PropertyType,
21
- value: unknown,
22
- params?: {
23
- formatText?: string;
24
- properties?: PropertiesArrayType;
25
- }
26
- ) => {
27
- if ((value === null || value === undefined) && propertyType !== PropertyType.BOOLEAN) {
28
- return null;
29
- }
30
- let parsedValue: unknown = value;
31
-
32
- switch (propertyType) {
33
- case PropertyType.BOOLEAN:
34
- if (value) {
35
- parsedValue = true;
36
- } else {
37
- parsedValue = false;
38
- }
39
- break;
40
- case PropertyType.INTEGER:
41
- case PropertyType.BIG_INTEGER:
42
- case PropertyType.BIG_DECIMAL:
43
- case PropertyType.FLOAT:
44
- case PropertyType.LONG:
45
- case PropertyType.DOUBLE:
46
- parsedValue = Number(value);
47
- break;
48
- case PropertyType.DATE:
49
- case PropertyType.DATE_TIME:
50
- case PropertyType.TIME:
51
- parsedValue = format(new Date(value.toString()), params.formatText);
52
- break;
53
- case PropertyType.JSON:
54
- case PropertyType.ANY:
55
- try {
56
- if (typeof value !== 'string') {
57
- parsedValue = JSON.stringify(value);
58
- }
59
- parsedValue = JSON.parse(parsedValue as string);
60
- } catch (e) {
61
- console.log(e);
62
- parsedValue = null;
63
- }
64
- break;
65
- case PropertyType.ENTITY:
66
- parsedValue = formatDefinitionData(params.properties, value);
67
- break;
68
- default:
69
- break;
70
- }
71
-
72
- return parsedValue;
73
- };
74
-
75
- export const formatDefinitionData = (properties: PropertiesArrayType<unknown>, data: unknown) => {
76
- if (data) {
77
- const formattedData = {};
78
-
79
- properties.forEach((property) => {
80
- const { key, propertyType } = property;
81
- const value = data[key];
82
-
83
- if (Array.isArray(value)) {
84
- formattedData[key] = value.map((val) =>
85
- formatPropertyValue(propertyType, val, {
86
- formatText: property['format'],
87
- properties: property['properties'],
88
- })
89
- );
90
- } else {
91
- formattedData[key] = formatPropertyValue(propertyType, value, {
92
- formatText: property['format'],
93
- properties: property['properties'],
94
- });
95
- }
96
- });
97
-
98
- return formattedData;
99
- }
100
- return null;
101
- };
102
-
103
- const getPropertyValue = (property: PropertyUnion & { [key: string]: unknown }, isGlobalParameter: boolean) => {
104
- const valueObject = {};
105
- let value;
106
- let key = '';
107
-
108
- if (isGlobalParameter) {
109
- if (property.isMultiple) {
110
- key = 'values';
111
- value = property['value'];
112
- } else {
113
- key = 'value';
114
- value = property['value'];
115
- }
116
- } else {
117
- if (property.isMultiple) {
118
- key = 'defaultValues';
119
- value = property['defaultValue'];
120
- } else {
121
- key = 'defaultValue';
122
- value = property['defaultValue'];
123
- }
124
- }
125
-
126
- if (Array.isArray(value)) {
127
- valueObject[key] = value.map((val) =>
128
- formatPropertyValue(property.propertyType, val, {
129
- formatText: property['format'] as string,
130
- properties: property['properties'] as PropertiesArrayType,
131
- })
132
- );
133
- } else {
134
- valueObject[key] = formatPropertyValue(property.propertyType, value, {
135
- formatText: property['format'] as string,
136
- properties: property['properties'] as PropertiesArrayType,
137
- });
138
- }
139
-
140
- return valueObject;
141
- };
142
-
143
- export const propertiesArrayToObject = (properties, isGlobalParameter?: boolean): PropertiesObjectType<any> => {
144
- const propertiesObject = {};
145
-
146
- properties.forEach((property) => {
147
- const { key, name, isRequired, isMultiple, sortOrder, isEnabled, uiSettings, validationNode } = property;
148
- const propertyType =
149
- typeof property.propertyType === 'string' ? property.propertyType : property.propertyType.value;
150
-
151
- const resultProperty = {
152
- name,
153
- propertyType,
154
- isRequired,
155
- isMultiple,
156
- sortOrder,
157
- isEnabled,
158
- validationNode,
159
- uiSettings,
160
- ...getPropertyValue({ ...property, propertyType }, isGlobalParameter),
161
- };
162
-
163
- if ('isViewableInList' in property) {
164
- resultProperty['isViewableInList'] = property.isViewableInList;
165
- }
166
-
167
- if (uiSettings) {
168
- try {
169
- resultProperty.uiSettings = JSON.parse(uiSettings);
170
- } catch (e) {
171
- console.log(e);
172
- }
173
- } else {
174
- resultProperty.uiSettings = null;
175
- }
176
-
177
- if (propertyType === PropertyType.BIG_DECIMAL) {
178
- resultProperty['precisionScale'] = property.precisionScale;
179
- resultProperty['roundingMode'] = property.roundingMode;
180
- }
181
-
182
- if (
183
- propertyType === PropertyType.DATE ||
184
- propertyType === PropertyType.TIME ||
185
- propertyType === PropertyType.DATE_TIME
186
- ) {
187
- resultProperty['format'] = property.format;
188
- }
189
-
190
- if (propertyType === PropertyType.STRING) {
191
- resultProperty['restrictedValues'] = property.restrictedValues;
192
- }
193
-
194
- if (propertyType === PropertyType.ENTITY_REFERENCE) {
195
- resultProperty['definitionCode'] = property.definitionCode;
196
- resultProperty['definitionVersion'] = property.definitionVersion;
197
- resultProperty['labelPropertyCode'] = property.labelPropertyCode;
198
- resultProperty['valuePropertyCode'] = property.valuePropertyCode;
199
- }
200
-
201
- if (propertyType === PropertyType.ENTITY) {
202
- resultProperty['properties'] = propertiesArrayToObject(property.properties, isGlobalParameter);
203
- }
204
-
205
- propertiesObject[key] = resultProperty;
206
- });
207
-
208
- return propertiesObject;
209
- };
210
-
211
- export function propertiesObjectToArray(properties, fields?: { [key: string]: unknown }) {
212
- return Object.keys(properties)
213
- .map((key) => {
214
- const propObj = { key, ...properties[key], ...(fields ? fields : {}) };
215
- if (propObj['propertyType'] === PropertyType.ENTITY) {
216
- propObj['properties'] = propertiesObjectToArray(propObj['properties'], fields);
217
- }
218
-
219
- if (propObj['propertyType'] === PropertyType.JSON) {
220
- try {
221
- if (propObj.defaultValue == null) {
222
- propObj.defaultValue = '';
223
- } else {
224
- propObj.defaultValue = JSON.stringify(propObj.defaultValue, null, 2);
225
- }
226
- } catch (error) {
227
- propObj.defaultValue = '';
228
- }
229
- }
230
-
231
- if (propObj['uiSettings']) {
232
- try {
233
- propObj.uiSettings = JSON.stringify(propObj.uiSettings, null, 2);
234
- } catch (error) {
235
- propObj.uiSettings = '';
236
- }
237
- }
238
-
239
- if (propObj['isMultiple']) {
240
- if ('defaultValues' in propObj) {
241
- propObj['defaultValue'] = propObj.defaultValues;
242
- }
243
- if ('values' in propObj) {
244
- propObj['value'] = propObj.values;
245
- }
246
- }
247
-
248
- return propObj;
249
- })
250
- .sort((a, b) => sortArrayOfObjects(a, b, 'sortOrder'));
251
- }
252
-
253
- export const getDemPropertyDateFormat = (defaultFormat: string, propertyFormat: string) => {
254
- if (propertyFormat) {
255
- try {
256
- const correctFormat = propertyFormat.replace(/Z/g, 'XXX');
257
- format(new Date(), correctFormat);
258
- return correctFormat;
259
- } catch (e) {
260
- console.error('Incorrect format', e);
261
- return defaultFormat;
262
- }
263
- }
264
- return defaultFormat;
265
- };
266
-
267
- export const getEntityStarterValue = (property: EntityTypeProperty) => {
268
- let properties: PropertiesArrayType = [];
269
- if (Array.isArray(property.properties)) {
270
- properties = property.properties;
271
- } else {
272
- properties = propertiesObjectToArray(property.properties);
273
- }
274
-
275
- return properties.reduce((value, property) => {
276
- const result = JSON.parse(JSON.stringify(value));
277
- if (property.propertyType === PropertyType.ENTITY) {
278
- result[property.key] = getEntityStarterValue(property);
279
- } else {
280
- result[property.key] = property.propertyType;
281
- }
282
- return result;
283
- }, {});
284
- };
285
-
286
- export const getMultiplePropertyFillOptions = ({
287
- propertyType,
288
- useExpression,
289
- required,
290
- }: {
291
- propertyType: PropertyType;
292
- required: boolean;
293
- useExpression?: boolean;
294
- }): { value: PropertyFillType; label: string; sortOrder: number }[] => {
295
- let options: { value: PropertyFillType; label: string; sortOrder: number }[] = [
296
- {
297
- value: 'widget',
298
- label: 'Fill array (widget)',
299
- sortOrder: 1,
300
- },
301
- ];
302
-
303
- if (!required) {
304
- options.push({
305
- value: 'null',
306
- label: 'NULL',
307
- sortOrder: 0,
308
- });
309
- }
310
-
311
- if (useExpression) {
312
- if (
313
- propertyType === PropertyType.JSON ||
314
- propertyType === PropertyType.ENTITY ||
315
- propertyType === PropertyType.ANY
316
- ) {
317
- options.push({ value: 'expression', label: 'Expression (JSON editor)', sortOrder: 3 });
318
- } else {
319
- options.push({
320
- value: 'expression',
321
- label: 'Expression',
322
- sortOrder: 3,
323
- });
324
- }
325
- }
326
-
327
- if (propertyType === PropertyType.JSON || propertyType === PropertyType.ANY || propertyType === PropertyType.ENTITY) {
328
- options.push({
329
- value: 'json_valid',
330
- label: 'JSON editor',
331
- sortOrder: 2,
332
- });
333
- }
334
-
335
- options = options.sort((a, b) => sortArrayOfObjects(a, b, 'sortOrder'));
336
- return options;
337
- };
338
-
339
- export const getSinglePropertyFillOptions = ({
340
- propertyType,
341
- useExpression,
342
- required,
343
- }: {
344
- propertyType: PropertyType;
345
- required: boolean;
346
- useExpression?: boolean;
347
- }): { value: PropertyFillType; label: string; sortOrder: number }[] => {
348
- let options: { value: PropertyFillType; label: string; sortOrder: number }[] = [
349
- {
350
- value: 'widget',
351
- label: 'Widget',
352
- sortOrder: 1,
353
- },
354
- ];
355
-
356
- if (!required) {
357
- options.push({
358
- value: 'null',
359
- label: 'NULL',
360
- sortOrder: 0,
361
- });
362
- }
363
-
364
- if (useExpression) {
365
- if (
366
- propertyType === PropertyType.JSON ||
367
- propertyType === PropertyType.ENTITY ||
368
- propertyType === PropertyType.ANY
369
- ) {
370
- options.push({ value: 'expression', label: 'Expression (JSON editor)', sortOrder: 3 });
371
- } else {
372
- options.push({
373
- value: 'expression',
374
- label: 'Expression',
375
- sortOrder: 3,
376
- });
377
- }
378
- }
379
-
380
- if (propertyType === PropertyType.JSON) {
381
- options.push({
382
- value: 'dem_builder',
383
- label: 'DEM Builder',
384
- sortOrder: 2,
385
- });
386
- }
387
-
388
- // WIDGET LABEL SET
389
- switch (propertyType) {
390
- case PropertyType.STRING:
391
- options[0].label = 'Text input';
392
- break;
393
- case PropertyType.INTEGER:
394
- case PropertyType.BIG_INTEGER:
395
- case PropertyType.BIG_DECIMAL:
396
- case PropertyType.FLOAT:
397
- case PropertyType.LONG:
398
- case PropertyType.DOUBLE:
399
- options[0].label = 'Number input';
400
- break;
401
- case PropertyType.BOOLEAN:
402
- options[0].label = 'Switch';
403
- break;
404
- case PropertyType.ENTITY_REFERENCE:
405
- options[0].label = 'Entity reference fields';
406
- break;
407
- case PropertyType.JSON:
408
- options[0].label = 'JSON editor';
409
- break;
410
- case PropertyType.DATE:
411
- options[0].label = 'Date picker';
412
- options.push({ value: 'string', label: 'Text input', sortOrder: 2 });
413
- break;
414
- case PropertyType.DATE_TIME:
415
- options[0].label = 'Date & Time picker';
416
- options.push({ value: 'string', label: 'Text input', sortOrder: 2 });
417
- break;
418
- case PropertyType.TIME:
419
- options[0].label = 'Time picker';
420
- options.push({ value: 'string', label: 'Text input', sortOrder: 2 });
421
- break;
422
- case PropertyType.ANY:
423
- options[0].label = 'Textarea';
424
- break;
425
- default:
426
- break;
427
- }
428
-
429
- options = options.sort((a, b) => sortArrayOfObjects(a, b, 'sortOrder'));
430
- return options;
431
- };
@@ -1,41 +0,0 @@
1
- import { useEffect, useRef, useState } from 'react';
2
-
3
- export function useDebounce(func: (args?: any) => void, delay: number) {
4
- const timer = useRef<any>();
5
-
6
- useEffect(() => {
7
- return () => {
8
- if (!timer.current) return;
9
- clearTimeout(timer.current);
10
- };
11
- }, []);
12
-
13
- const debounceFunction = (...args) => {
14
- clearTimeout(timer.current);
15
- timer.current = setTimeout(() => {
16
- func(...args);
17
- }, delay);
18
- };
19
-
20
- return debounceFunction;
21
- }
22
-
23
-
24
- export const useToggle = () => {
25
- const [open, setOpen] = useState(false);
26
-
27
- const toggle = () => {
28
- setOpen((prevState) => !prevState);
29
- };
30
-
31
- const onClose = () => {
32
- setOpen(false);
33
- };
34
-
35
- const onOpen = () => {
36
- setOpen(true);
37
- };
38
-
39
- return { open, toggle, onClose, onOpen };
40
- };
41
-
@@ -1,102 +0,0 @@
1
- import Box from '@mui/material/Box';
2
- import SvgIcon from '@mui/material/SvgIcon';
3
- import Tooltip from '@mui/material/Tooltip';
4
- import { CopyButton, Status } from '../lib';
5
- import { format } from 'date-fns';
6
- import { StatusVariant, TableDataType } from '../interfaces';
7
- import JsonTypeCell from '../lib/Table/DataGrid/JsonTypeCell';
8
-
9
- export const formatTableRowValue = ({
10
- value,
11
- type,
12
- copyText,
13
- status,
14
- }: {
15
- value: any;
16
- type?: TableDataType;
17
- copyText?: string;
18
- status?: StatusVariant;
19
- }) => {
20
- switch (type) {
21
- case 'id':
22
- return (
23
- <Box display="flex" alignItems="center" minWidth="100%">
24
- <Tooltip title={value}>
25
- <Box mr="auto">
26
- {value
27
- ? `${(value as string).slice(0, 6)}...${(value as string).slice(
28
- -6
29
- )}`
30
- : '...'}
31
- </Box>
32
- </Tooltip>
33
-
34
- <CopyButton copyText={(copyText ? copyText : value) as string} />
35
- </Box>
36
- );
37
- case 'JSON_copy':
38
- return <JsonTypeCell value={value} copyButton />;
39
- case 'JSON':
40
- return <JsonTypeCell value={value} />;
41
- case 'JSON_text':
42
- return <JsonTypeCell value={value} textField />;
43
- case 'copy':
44
- return (
45
- <Box display="flex" alignItems="center" minWidth="100%">
46
- <Tooltip title={value}>
47
- <Box
48
- mr="auto"
49
- overflow="hidden"
50
- textOverflow="ellipsis"
51
- whiteSpace="nowrap"
52
- >
53
- {value?.length > 12
54
- ? `${(value as string).slice(0, 6)}...${(value as string).slice(
55
- -6
56
- )}`
57
- : value}
58
- </Box>
59
- </Tooltip>
60
-
61
- <CopyButton copyText={(copyText ? copyText : value) as string} />
62
- </Box>
63
- );
64
- case 'boolean':
65
- return value ? (
66
- <SvgIcon color="primary" fontSize="small">
67
- <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" />
68
- </SvgIcon>
69
- ) : (
70
- <SvgIcon fontSize="small">
71
- <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20zm6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9z" />
72
- </SvgIcon>
73
- );
74
- case 'date':
75
- return value ? (
76
- <div>
77
- <div>{format(new Date(value as string), 'dd.MM.yyyy')}</div>
78
- <div>{format(new Date(value as string), 'HH:mm:ss')}</div>
79
- </div>
80
- ) : (
81
- ''
82
- );
83
- case 'status':
84
- return <Status text={value as string} status={status} />;
85
- case 'array':
86
- return (
87
- <Box>
88
- {(value as string[]).map((val, index) => (
89
- <Box key={index}>{val}</Box>
90
- ))}
91
- </Box>
92
- );
93
- default:
94
- return (
95
- <Tooltip title={value}>
96
- <div className="MuiDataGrid-cellContent" title={value}>
97
- {value}
98
- </div>
99
- </Tooltip>
100
- );
101
- }
102
- };
@@ -1,14 +0,0 @@
1
- import { PropertyType } from '../interfaces';
2
-
3
- export const digitsOnly = new RegExp('^[-+]?[0-9]+$');
4
- export const floatsOnly = new RegExp(/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/);
5
-
6
- export const isExpression = (value: unknown): boolean => {
7
- return typeof value === 'string' ? value.includes('$(') : false;
8
- };
9
-
10
- export const isDateType = (propertyType: PropertyType) => {
11
- return (
12
- propertyType === PropertyType.DATE || propertyType === PropertyType.DATE_TIME || propertyType === PropertyType.TIME
13
- );
14
- };
package/tsconfig.json DELETED
@@ -1,25 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "ESNext",
4
- "jsx": "react-jsx",
5
- "allowJs": true,
6
- "esModuleInterop": true,
7
- "allowSyntheticDefaultImports": true,
8
- "forceConsistentCasingInFileNames": true,
9
- "noImplicitOverride": true,
10
- "noPropertyAccessFromIndexSignature": true,
11
- "noImplicitReturns": true,
12
- "noFallthroughCasesInSwitch": true
13
- },
14
- "files": [],
15
- "include": [],
16
- "references": [
17
- {
18
- "path": "./tsconfig.lib.json"
19
- },
20
- {
21
- "path": "./tsconfig.spec.json"
22
- }
23
- ],
24
- "extends": "../../tsconfig.base.json"
25
- }
package/tsconfig.lib.json DELETED
@@ -1,23 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "../../dist/out-tsc",
5
- "types": ["node"]
6
- },
7
- "files": [
8
- "../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
9
- "../../node_modules/@nrwl/react/typings/image.d.ts"
10
- ],
11
- "exclude": [
12
- "jest.config.ts",
13
- "src/**/*.spec.ts",
14
- "src/**/*.test.ts",
15
- "src/**/*.spec.tsx",
16
- "src/**/*.test.tsx",
17
- "src/**/*.spec.js",
18
- "src/**/*.test.js",
19
- "src/**/*.spec.jsx",
20
- "src/**/*.test.jsx"
21
- ],
22
- "include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts"]
23
- }