@addev-be/ui 0.15.1 → 0.16.1

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 (221) hide show
  1. package/assets/icons/arrow-down-1-9.svg +1 -1
  2. package/assets/icons/arrow-down-a-z.svg +1 -1
  3. package/assets/icons/arrow-up-z-a.svg +1 -1
  4. package/assets/icons/check.svg +1 -1
  5. package/assets/icons/circle-check.svg +1 -1
  6. package/assets/icons/down.svg +1 -1
  7. package/assets/icons/filter-full.svg +1 -1
  8. package/assets/icons/filter.svg +1 -1
  9. package/assets/icons/hashtag.svg +1 -1
  10. package/assets/icons/image-slash.svg +1 -1
  11. package/assets/icons/left.svg +1 -1
  12. package/assets/icons/magnifier.svg +1 -1
  13. package/assets/icons/phone.svg +1 -1
  14. package/assets/icons/right.svg +1 -1
  15. package/assets/icons/sort-calendar-ascending.svg +5 -5
  16. package/assets/icons/spinner-third.svg +1 -1
  17. package/assets/icons/table-columns.svg +1 -1
  18. package/assets/icons/table-footer-slash.svg +4 -4
  19. package/assets/icons/table-footer.svg +3 -3
  20. package/assets/icons/up.svg +1 -1
  21. package/assets/icons/user-tie.svg +1 -1
  22. package/assets/icons/x-bar.svg +3 -3
  23. package/dist/components/auth/LoginForm.js +1 -0
  24. package/dist/providers/AuthenticationProvider/index.d.ts +1 -0
  25. package/dist/providers/AuthenticationProvider/index.js +28 -14
  26. package/dist/services/advancedRequests.d.ts +1 -1
  27. package/dist/services/sqlRequests.d.ts +1 -1
  28. package/package.json +1 -1
  29. package/src/Icons.tsx +134 -134
  30. package/src/components/auth/LoginForm.tsx +84 -84
  31. package/src/components/auth/LoginPage.tsx +32 -32
  32. package/src/components/auth/PasswordRecoveryForm.tsx +52 -52
  33. package/src/components/auth/PasswordResetForm.tsx +112 -112
  34. package/src/components/auth/index.ts +4 -4
  35. package/src/components/auth/styles.ts +14 -14
  36. package/src/components/data/DataGrid/DataGridCell.tsx +77 -83
  37. package/src/components/data/DataGrid/DataGridColumnsModal/helpers.ts +9 -9
  38. package/src/components/data/DataGrid/DataGridColumnsModal/hooks.tsx +59 -59
  39. package/src/components/data/DataGrid/DataGridColumnsModal/index.tsx +182 -182
  40. package/src/components/data/DataGrid/DataGridColumnsModal/styles.ts +104 -104
  41. package/src/components/data/DataGrid/DataGridEditableCell/CheckboxEditableCell.tsx +38 -38
  42. package/src/components/data/DataGrid/DataGridEditableCell/DateEditableCell.tsx +39 -39
  43. package/src/components/data/DataGrid/DataGridEditableCell/NumberEditableCell.tsx +68 -68
  44. package/src/components/data/DataGrid/DataGridEditableCell/TextEditableCell.tsx +38 -38
  45. package/src/components/data/DataGrid/DataGridEditableCell/index.tsx +108 -106
  46. package/src/components/data/DataGrid/DataGridEditableCell/styles.ts +35 -35
  47. package/src/components/data/DataGrid/DataGridEditableCell/types.ts +19 -17
  48. package/src/components/data/DataGrid/DataGridFilterMenu/FilterValuesScroller.tsx +131 -131
  49. package/src/components/data/DataGrid/DataGridFilterMenu/hooks.tsx +81 -81
  50. package/src/components/data/DataGrid/DataGridFilterMenu/index.tsx +376 -376
  51. package/src/components/data/DataGrid/DataGridFilterMenu/styles.ts +97 -97
  52. package/src/components/data/DataGrid/DataGridFooter.tsx +45 -45
  53. package/src/components/data/DataGrid/DataGridHeader.tsx +173 -173
  54. package/src/components/data/DataGrid/DataGridHeaderCell.tsx +111 -115
  55. package/src/components/data/DataGrid/DataGridRowTemplate.tsx +80 -80
  56. package/src/components/data/DataGrid/FilterModalContent/index.tsx +136 -136
  57. package/src/components/data/DataGrid/FilterModalContent/styles.ts +22 -22
  58. package/src/components/data/DataGrid/constants.ts +6 -6
  59. package/src/components/data/DataGrid/helpers/columns.tsx +386 -384
  60. package/src/components/data/DataGrid/helpers/filters.ts +287 -287
  61. package/src/components/data/DataGrid/helpers/index.ts +2 -2
  62. package/src/components/data/DataGrid/hooks/index.ts +29 -29
  63. package/src/components/data/DataGrid/hooks/useDataGrid.tsx +377 -378
  64. package/src/components/data/DataGrid/hooks/useDataGridChangedRows.ts +56 -56
  65. package/src/components/data/DataGrid/hooks/useDataGridCopy.ts +174 -174
  66. package/src/components/data/DataGrid/hooks/useDataGridSettings.ts +48 -48
  67. package/src/components/data/DataGrid/index.tsx +110 -110
  68. package/src/components/data/DataGrid/styles.ts +372 -369
  69. package/src/components/data/DataGrid/types.ts +367 -367
  70. package/src/components/data/SqlRequestDataGrid/SqlRequestForeignListEditableCell.tsx +16 -16
  71. package/src/components/data/SqlRequestDataGrid/helpers/columns.tsx +480 -478
  72. package/src/components/data/SqlRequestDataGrid/helpers/index.ts +2 -2
  73. package/src/components/data/SqlRequestDataGrid/helpers/sqlRequests.ts +16 -16
  74. package/src/components/data/SqlRequestDataGrid/index.tsx +402 -402
  75. package/src/components/data/SqlRequestDataGrid/styles.ts +15 -15
  76. package/src/components/data/SqlRequestDataGrid/types.ts +74 -74
  77. package/src/components/data/SqlRequestForeignList/index.tsx +259 -259
  78. package/src/components/data/SqlRequestForeignList/styles.ts +43 -42
  79. package/src/components/data/SqlRequestForeignList/types.ts +34 -34
  80. package/src/components/data/SqlRequestGrid/filters/FiltersSidebar.tsx +110 -110
  81. package/src/components/data/SqlRequestGrid/filters/styles.ts +88 -88
  82. package/src/components/data/SqlRequestGrid/helpers/index.ts +1 -1
  83. package/src/components/data/SqlRequestGrid/helpers/sqlRequests.ts +16 -16
  84. package/src/components/data/SqlRequestGrid/index.tsx +316 -316
  85. package/src/components/data/SqlRequestGrid/styles.ts +20 -20
  86. package/src/components/data/SqlRequestGrid/types.ts +75 -75
  87. package/src/components/data/VirtualScroller/hooks.ts +71 -71
  88. package/src/components/data/VirtualScroller/index.tsx +91 -91
  89. package/src/components/data/VirtualScroller/styles.ts +58 -58
  90. package/src/components/data/VirtualScroller/types.ts +12 -12
  91. package/src/components/data/index.ts +16 -23
  92. package/src/components/forms/AutoTextArea.tsx +41 -41
  93. package/src/components/forms/Button.tsx +133 -133
  94. package/src/components/forms/Form/Checkbox.tsx +12 -13
  95. package/src/components/forms/Form/FormGroup.tsx +27 -27
  96. package/src/components/forms/Form/Input.tsx +16 -13
  97. package/src/components/forms/Form/Row.tsx +32 -0
  98. package/src/components/forms/Form/Select.tsx +81 -76
  99. package/src/components/forms/Form/TextArea.tsx +17 -13
  100. package/src/components/forms/Form/index.tsx +45 -37
  101. package/src/components/forms/Form/styles.ts +171 -101
  102. package/src/components/forms/IconButton.tsx +57 -57
  103. package/src/components/forms/IndeterminateCheckbox.tsx +46 -46
  104. package/src/components/forms/Select.tsx +35 -35
  105. package/src/components/forms/VerticalLabel.tsx +20 -20
  106. package/src/components/forms/index.ts +8 -8
  107. package/src/components/forms/styles.ts +31 -31
  108. package/src/components/index.ts +6 -6
  109. package/src/components/layout/Columns.ts +20 -20
  110. package/src/components/layout/Dropdown/index.tsx +113 -113
  111. package/src/components/layout/Dropdown/styles.ts +45 -45
  112. package/src/components/layout/Grid/index.tsx +8 -8
  113. package/src/components/layout/Grid/styles.ts +34 -34
  114. package/src/components/layout/Loading/index.tsx +29 -29
  115. package/src/components/layout/Loading/styles.ts +29 -29
  116. package/src/components/layout/Masonry/index.tsx +29 -29
  117. package/src/components/layout/Masonry/styles.ts +20 -20
  118. package/src/components/layout/Modal/index.tsx +51 -51
  119. package/src/components/layout/Modal/styles.ts +121 -121
  120. package/src/components/layout/index.ts +6 -6
  121. package/src/components/search/HighlightedText.tsx +37 -37
  122. package/src/components/search/QuickSearchBar.tsx +86 -86
  123. package/src/components/search/QuickSearchResults.tsx +86 -86
  124. package/src/components/search/index.ts +9 -9
  125. package/src/components/search/styles.ts +96 -96
  126. package/src/components/search/types.ts +26 -26
  127. package/src/components/ui/Avatar/index.tsx +54 -54
  128. package/src/components/ui/Card/index.tsx +14 -14
  129. package/src/components/ui/Card/styles.ts +37 -37
  130. package/src/components/ui/ContextMenu/index.tsx +79 -79
  131. package/src/components/ui/ContextMenu/styles.ts +119 -119
  132. package/src/components/ui/Ellipsis.tsx +34 -32
  133. package/src/components/ui/Label.tsx +90 -90
  134. package/src/components/ui/Message/index.tsx +57 -57
  135. package/src/components/ui/Message/styles.ts +40 -40
  136. package/src/components/ui/index.ts +6 -6
  137. package/src/config/index.ts +14 -14
  138. package/src/helpers/dates.ts +17 -17
  139. package/src/helpers/getScrollbarSize.ts +14 -14
  140. package/src/helpers/index.ts +4 -3
  141. package/src/helpers/numbers.ts +63 -63
  142. package/src/helpers/responsive.ts +83 -0
  143. package/src/helpers/text.ts +13 -13
  144. package/src/hooks/index.ts +7 -3
  145. package/src/hooks/useContainerMediaQuery.ts +7 -0
  146. package/src/hooks/useElementSize.ts +24 -24
  147. package/src/hooks/useMediaQuery.ts +9 -0
  148. package/src/hooks/useMediaQueryForWidth.ts +35 -0
  149. package/src/hooks/useMutableState.ts +19 -0
  150. package/src/hooks/useShowArchived.ts +28 -28
  151. package/src/hooks/useWindowSize.ts +20 -20
  152. package/src/index.ts +9 -9
  153. package/src/providers/AuthenticationProvider/helpers.ts +3 -3
  154. package/src/providers/AuthenticationProvider/index.tsx +243 -243
  155. package/src/providers/LoadingProvider/index.tsx +47 -47
  156. package/src/providers/PortalsProvider/index.tsx +54 -54
  157. package/src/providers/PortalsProvider/styles.ts +31 -31
  158. package/src/providers/SettingsProvider/index.tsx +70 -70
  159. package/src/providers/ThemeProvider/ThemeProvider.ts +63 -63
  160. package/src/providers/ThemeProvider/defaultTheme.ts +457 -457
  161. package/src/providers/ThemeProvider/helpers.ts +11 -11
  162. package/src/providers/ThemeProvider/index.ts +4 -4
  163. package/src/providers/ThemeProvider/types.ts +131 -131
  164. package/src/providers/TrackingProvider/index.tsx +71 -71
  165. package/src/providers/UiProviders/index.tsx +68 -68
  166. package/src/providers/UiProviders/styles.ts +10 -10
  167. package/src/providers/hooks.ts +12 -12
  168. package/src/providers/index.ts +8 -8
  169. package/src/services/HttpService.ts +92 -92
  170. package/src/services/WebSocketService.ts +137 -137
  171. package/src/services/advancedRequests.ts +102 -102
  172. package/src/services/base.ts +23 -23
  173. package/src/services/globalSearch.ts +29 -29
  174. package/src/services/hooks.ts +44 -44
  175. package/src/services/index.ts +21 -21
  176. package/src/services/requests/auth.ts +44 -44
  177. package/src/services/requests/generic.ts +62 -62
  178. package/src/services/requests/tracking.ts +12 -12
  179. package/src/services/requests/userProfiles.ts +35 -35
  180. package/src/services/requests/users.ts +28 -28
  181. package/src/services/smartQueries.ts +122 -122
  182. package/src/services/sqlRequests.ts +111 -111
  183. package/src/services/types/auth.ts +131 -131
  184. package/src/services/types/base.ts +10 -10
  185. package/src/services/types/generic.ts +96 -96
  186. package/src/services/types/tracking.ts +39 -39
  187. package/src/services/types/userProfiles.ts +107 -107
  188. package/src/services/types/users.ts +106 -106
  189. package/src/services/updateSqlRequests.ts +34 -34
  190. package/src/styles/animations.scss +30 -30
  191. package/src/styles/index.scss +42 -42
  192. package/src/typings.d.ts +19 -13
  193. package/tsconfig.json +18 -18
  194. package/dist/components/data/DataGrid/AdvancedRequestDataGrid.d.ts +0 -10
  195. package/dist/components/data/DataGrid/AdvancedRequestDataGrid.js +0 -173
  196. package/dist/components/data/DataGrid/FilterValuesScroller.d.ts +0 -13
  197. package/dist/components/data/DataGrid/FilterValuesScroller.js +0 -73
  198. package/dist/components/data/DataGrid/VirtualScroller.d.ts +0 -11
  199. package/dist/components/data/DataGrid/VirtualScroller.js +0 -41
  200. package/dist/components/data/DataGrid/helpers/advancedRequests.d.ts +0 -12
  201. package/dist/components/data/DataGrid/helpers/advancedRequests.js +0 -53
  202. package/dist/components/data/DataGrid/helpers.d.ts +0 -28
  203. package/dist/components/data/DataGrid/helpers.js +0 -436
  204. package/dist/config/types.d.ts +0 -11
  205. package/dist/config/types.js +0 -2
  206. package/dist/services/requests/userPermissions.d.ts +0 -4
  207. package/dist/services/requests/userPermissions.js +0 -20
  208. package/src/components/data/AdvancedRequestDataGrid/helpers/advancedRequests.ts +0 -93
  209. package/src/components/data/AdvancedRequestDataGrid/helpers/columns.tsx +0 -262
  210. package/src/components/data/AdvancedRequestDataGrid/helpers/index.ts +0 -2
  211. package/src/components/data/AdvancedRequestDataGrid/index.tsx +0 -267
  212. package/src/components/data/AdvancedRequestDataGrid/types.ts +0 -47
  213. package/src/components/data/SmartQueryDataGrid/helpers/columns.tsx +0 -333
  214. package/src/components/data/SmartQueryDataGrid/helpers/hooks.ts +0 -41
  215. package/src/components/data/SmartQueryDataGrid/helpers/index.ts +0 -2
  216. package/src/components/data/SmartQueryDataGrid/helpers/smartQueries.ts +0 -17
  217. package/src/components/data/SmartQueryDataGrid/hooks.ts +0 -75
  218. package/src/components/data/SmartQueryDataGrid/index.tsx +0 -338
  219. package/src/components/data/SmartQueryDataGrid/types.ts +0 -45
  220. package/src/components/forms/Form/InputWithLabel.tsx +0 -18
  221. package/src/components/forms/Form/types.ts +0 -7
@@ -1,338 +0,0 @@
1
- import {
2
- ColumnDTO,
3
- ConditionDTO,
4
- FooterFunction,
5
- OrderByDirection,
6
- RequestRow,
7
- useSmartQueryHandler,
8
- } from '../../../services/smartQueries';
9
- import {
10
- DataGridFilters,
11
- DataGridFooterFunction,
12
- DataGridRefProps,
13
- DataGridSort,
14
- } from '../DataGrid/types';
15
- import {
16
- ForwardedRef,
17
- forwardRef,
18
- useCallback,
19
- useEffect,
20
- useImperativeHandle,
21
- useMemo,
22
- useRef,
23
- useState,
24
- } from 'react';
25
- import {
26
- convertSmartFiltersToConditions,
27
- getColumnsConditions,
28
- getFooterColumn,
29
- } from './helpers';
30
- import { debounce, identity, mapValues } from 'lodash';
31
- import { useIdSmartColumnDTO, useSmartColumnDTOs } from './helpers/hooks';
32
-
33
- import { DataGrid } from '../DataGrid';
34
- import { SmartQueryDataGridProps } from './types';
35
-
36
- export const SmartQueryDataGridInner = <R,>(
37
- {
38
- onSelectionChange: onSelectionChangeFromProps,
39
- ...props
40
- }: SmartQueryDataGridProps<R>,
41
- ref: ForwardedRef<DataGridRefProps>
42
- ) => {
43
- const currentRows = useRef<R[]>([]);
44
- const [rows, setRows] = useState<R[]>([]);
45
- const [start, setStart] = useState(0);
46
- const [length, setLength] = useState(-1);
47
- const [count, setCount] = useState(-1);
48
- const [smartQuery, smartIdRequest] = useSmartQueryHandler<R>('SmartQuery');
49
- const gridRef = useRef<DataGridRefProps>(null);
50
-
51
- const [sorts, setSorts] = useState<Record<string, OrderByDirection>>({});
52
- const [footers, setFooters] = useState<Record<string, FooterFunction>>(
53
- props.initialFooters ?? {}
54
- );
55
- const [conditions, setConditions] = useState<Record<string, ConditionDTO>>(
56
- {}
57
- );
58
-
59
- const smartColumns = useSmartColumnDTOs(
60
- props.columns,
61
- conditions,
62
- footers,
63
- sorts
64
- );
65
- const smartIdColumn = useIdSmartColumnDTO(smartColumns);
66
-
67
- const refresh = useCallback(() => {
68
- setRows([]);
69
- setStart(0);
70
- setCount(-1);
71
- }, []);
72
-
73
- const onFiltersChanged = useCallback(
74
- (filters: DataGridFilters) => {
75
- const newConditions = convertSmartFiltersToConditions(filters);
76
- console.log('newConditions', newConditions);
77
- setConditions(newConditions);
78
- refresh();
79
- },
80
- [refresh]
81
- );
82
-
83
- const onSortsChanged = useCallback(
84
- (sorts: Record<string, DataGridSort>) => {
85
- setSorts(
86
- mapValues(sorts, (sort) =>
87
- sort === 'asc' ? 'ascending' : 'descending'
88
- )
89
- );
90
- refresh();
91
- },
92
- [refresh]
93
- );
94
-
95
- const loadRows = useRef(
96
- debounce(
97
- (
98
- type: string,
99
- columns: ColumnDTO[],
100
- where: ConditionDTO[] = [],
101
- offset = 0,
102
- limit = 0,
103
- getCount = false
104
- ) => {
105
- if (limit > 0) {
106
- smartQuery({
107
- type,
108
- columns,
109
- where,
110
- offset,
111
- limit,
112
- getCount,
113
- }).then((response) => {
114
- if (getCount) {
115
- currentRows.current = Array(response.count).fill(null);
116
- if (getCount) setCount(response.count ?? 0);
117
- }
118
- const data = response.data ?? [];
119
- const parsedRows = props.parser
120
- ? data.map(props.parser)
121
- : (data as R[]);
122
- currentRows.current.splice(offset, limit, ...parsedRows);
123
- setRows([...currentRows.current]);
124
- });
125
- }
126
- },
127
- 100,
128
- {
129
- leading: true,
130
- trailing: true,
131
- }
132
- )
133
- );
134
-
135
- const loadFilterValues = useCallback(
136
- (columnKey: string) => {
137
- const smartColumn = smartColumns.find((col) => col.key === columnKey);
138
- if (!smartColumn) {
139
- return Promise.resolve([]);
140
- }
141
- const otherSmartColumns = smartColumns.filter(
142
- (col) => col.key !== columnKey
143
- );
144
- return smartQuery({
145
- type: props.type,
146
- columns: [
147
- {
148
- ...smartColumn,
149
- having: undefined,
150
- },
151
- ...otherSmartColumns,
152
- ],
153
- filterColumn: smartColumn,
154
- where: props.conditions ?? [],
155
- getCount: false,
156
- }).then((response) =>
157
- response.data.map(
158
- (row) => props.columns[columnKey].filter?.getter?.(row) ?? null
159
- )
160
- );
161
- },
162
- [props.columns, props.conditions, props.type, smartColumns, smartQuery]
163
- );
164
-
165
- useEffect(() => {
166
- if (
167
- (!rows.length && count < 0) ||
168
- rows.slice(start, start + length).some((row) => row === null)
169
- ) {
170
- loadRows.current(
171
- props.type,
172
- smartColumns,
173
- props.conditions ?? [],
174
- start,
175
- length,
176
- count < 0
177
- );
178
- }
179
- }, [
180
- conditions,
181
- count,
182
- length,
183
- props.conditions,
184
- props.type,
185
- rows,
186
- smartColumns,
187
- start,
188
- ]);
189
-
190
- const loadCopyRows = useCallback(
191
- () =>
192
- smartQuery({
193
- type: props.type,
194
- columns: smartColumns,
195
- where: props.conditions ?? [],
196
- }).then((response) =>
197
- props.parser ? response.data.map(props.parser) : (response.data as R[])
198
- ),
199
- [smartQuery, props.type, props.conditions, props.parser, smartColumns]
200
- );
201
-
202
- const loadAllIds = useCallback(() => {
203
- return smartIdRequest({
204
- type: props.type,
205
- columns: [smartIdColumn],
206
- where: [
207
- ...(props.conditions ?? []),
208
- ...(Object.values(conditions) ?? []),
209
- ],
210
- // orderBy,
211
- offset: 0,
212
- limit: count,
213
- }).then((response) => response.data.map((row) => row['id']));
214
- }, [
215
- conditions,
216
- count,
217
- props.conditions,
218
- props.type,
219
- smartIdColumn,
220
- smartIdRequest,
221
- ]);
222
-
223
- const onVisibleRowsChanged = useCallback(
224
- (newStart: number, newLength: number) => {
225
- if (newStart !== start || newLength !== length) {
226
- setStart(newStart);
227
- setLength(newLength);
228
- }
229
- },
230
- [length, start]
231
- );
232
-
233
- const onSelectionChange = useCallback(
234
- (selectedKeys: string[]) => {
235
- onSelectionChangeFromProps?.(selectedKeys);
236
- },
237
- [onSelectionChangeFromProps]
238
- );
239
-
240
- /** FOOTERS */
241
-
242
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
243
- const [footerData, setFooterData] = useState<RequestRow<any>>({});
244
-
245
- const loadFooters = useCallback(() => {
246
- const columnsWithFooter = smartColumns
247
- .filter((column) => !!column.footer)
248
- .map(getFooterColumn);
249
- const otherSmartColumns = smartColumns.filter((column) => !column.footer);
250
- if (columnsWithFooter.length === 0) {
251
- setFooterData({});
252
- } else {
253
- columnsWithFooter.map((column) =>
254
- smartQuery({
255
- type: props.type,
256
- columns: [column],
257
- where: [
258
- ...(props.conditions ?? []),
259
- ...getColumnsConditions(otherSmartColumns),
260
- ],
261
- }).then((response) =>
262
- setFooterData((previousData) => ({
263
- ...previousData,
264
- ...response.data[0],
265
- }))
266
- )
267
- );
268
- }
269
- }, [props.conditions, props.type, smartColumns, smartQuery]);
270
-
271
- useEffect(() => {
272
- loadFooters();
273
- }, [loadFooters]);
274
-
275
- const footerFunctions = useMemo(
276
- () =>
277
- !footerData
278
- ? {}
279
- : Object.entries(footers).reduce((acc, [columnKey, footerKey]) => {
280
- const column = props.columns[columnKey];
281
- const footerFunc =
282
- typeof column?.footer === 'function'
283
- ? column.footer
284
- : column?.footer?.[footerKey];
285
- const render = footerFunc
286
- ? // eslint-disable-next-line @typescript-eslint/no-explicit-any
287
- (data: any) => footerFunc([data], [], [])
288
- : column?.render ?? identity;
289
- if (!column) {
290
- return acc;
291
- }
292
- acc[columnKey] = () => render(footerData, column);
293
- return acc;
294
- }, {} as Record<string, DataGridFooterFunction<R>>),
295
- [footerData, footers, props.columns]
296
- );
297
-
298
- const contextOverride = useMemo(
299
- () => ({
300
- footers,
301
- setFooters: setFooters as React.Dispatch<
302
- React.SetStateAction<Record<string, string>>
303
- >,
304
- footerFunctions,
305
- }),
306
- [footers, setFooters, footerFunctions]
307
- );
308
-
309
- useImperativeHandle(
310
- ref,
311
- () => ({
312
- refresh,
313
- setSelectedKeys: gridRef.current?.setSelectedKeys ?? (() => {}),
314
- }),
315
- [refresh]
316
- );
317
-
318
- return (
319
- <DataGrid
320
- ref={gridRef}
321
- onVisibleRowsChange={onVisibleRowsChanged}
322
- filter={false}
323
- sort={false}
324
- onFiltersChanged={onFiltersChanged}
325
- onSortsChanged={onSortsChanged}
326
- filterValuesLoader={loadFilterValues}
327
- rows={rows}
328
- loadCopyRows={loadCopyRows}
329
- refresh={refresh}
330
- onSelectionChange={onSelectionChange}
331
- getAllIds={loadAllIds}
332
- contextOverride={contextOverride}
333
- {...props}
334
- />
335
- );
336
- };
337
-
338
- export const SmartQueryDataGrid = forwardRef(SmartQueryDataGridInner);
@@ -1,45 +0,0 @@
1
- import { ConditionDTO, FieldDTO } from '../../../services/smartQueries';
2
- import {
3
- DataGridColumn,
4
- DataGridFilter,
5
- DataGridFilterType,
6
- DataGridProps,
7
- } from '../DataGrid/types';
8
-
9
- import { SmartQueries } from '../../../services';
10
-
11
- export type SmartQueryDataGridFilter<
12
- T extends DataGridFilterType = DataGridFilterType
13
- > = DataGridFilter<T> & {
14
- field?: FieldDTO;
15
- };
16
-
17
- export type SmartQueryDataGridFilters = Record<
18
- string,
19
- SmartQueryDataGridFilter
20
- >;
21
-
22
- export type SmartQueryDataGridColumn<R> = DataGridColumn<R> & {
23
- filter?: SmartQueryDataGridFilter;
24
- field?: FieldDTO;
25
- filterField?: string;
26
- sortField?: string;
27
- ignore?: boolean;
28
- };
29
-
30
- export type SmartQueryDataGridColumns<R> = Record<
31
- string,
32
- SmartQueryDataGridColumn<R>
33
- >;
34
-
35
- export type SmartQueryDataGridProps<R> = Omit<
36
- DataGridProps<R>,
37
- 'rows' | 'columns'
38
- > & {
39
- columns: SmartQueryDataGridColumns<R>;
40
- type: string;
41
- // orderBy?: OrderByDTO[];
42
- conditions?: ConditionDTO[];
43
- initialFooters?: Record<string, SmartQueries.FooterFunction>;
44
- parser?: (row: SmartQueries.RequestRow<R>) => R;
45
- };
@@ -1,18 +0,0 @@
1
- import { InputContainer } from './styles';
2
- import { InputContainerProps } from './types';
3
-
4
- export const InputWithLabel = ({
5
- label,
6
- icon: Icon,
7
- children,
8
- }: InputContainerProps) => (
9
- <InputContainer>
10
- {(label || Icon) && (
11
- <span>
12
- {Icon && <Icon />}
13
- {label}
14
- </span>
15
- )}
16
- {children}
17
- </InputContainer>
18
- );
@@ -1,7 +0,0 @@
1
- import { IconFC } from '../../../Icons';
2
- import { PropsWithChildren } from 'react';
3
-
4
- export type InputContainerProps = PropsWithChildren<{
5
- label?: string;
6
- icon?: IconFC;
7
- }>;