@addev-be/ui 0.2.2 → 0.2.6
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.
- package/assets/icons/arrow-down-a-z.svg +1 -1
- package/assets/icons/arrow-up-z-a.svg +1 -1
- package/assets/icons/check.svg +1 -1
- package/assets/icons/down.svg +1 -1
- package/assets/icons/filter-full.svg +1 -1
- package/assets/icons/filter.svg +1 -1
- package/assets/icons/hashtag.svg +1 -1
- package/assets/icons/image-slash.svg +1 -1
- package/assets/icons/left.svg +1 -1
- package/assets/icons/magnifier.svg +1 -1
- package/assets/icons/phone.svg +1 -1
- package/assets/icons/right.svg +1 -1
- package/assets/icons/spinner-third.svg +1 -1
- package/assets/icons/table-columns.svg +1 -1
- package/assets/icons/up.svg +1 -1
- package/assets/icons/user-tie.svg +1 -1
- package/dist/components/data/AdvancedRequestDataGrid/helpers/advancedRequests.d.ts +14 -0
- package/dist/components/data/AdvancedRequestDataGrid/helpers/advancedRequests.js +76 -0
- package/dist/components/data/AdvancedRequestDataGrid/helpers/columns.d.ts +22 -0
- package/dist/components/data/AdvancedRequestDataGrid/helpers/columns.js +156 -0
- package/dist/components/data/AdvancedRequestDataGrid/helpers/index.d.ts +2 -0
- package/dist/components/data/AdvancedRequestDataGrid/helpers/index.js +18 -0
- package/dist/components/data/AdvancedRequestDataGrid/index.d.ts +2 -0
- package/dist/components/data/AdvancedRequestDataGrid/index.js +215 -0
- package/dist/components/data/AdvancedRequestDataGrid/types.d.ts +21 -0
- package/dist/components/data/DataGrid/AdvancedRequestDataGrid.d.ts +1 -2
- package/dist/components/data/DataGrid/AdvancedRequestDataGrid.js +3 -5
- package/dist/components/data/DataGrid/DataGridCell.d.ts +1 -1
- package/dist/components/data/DataGrid/DataGridCell.js +6 -6
- package/dist/components/data/DataGrid/DataGridEditableCell.js +2 -7
- package/dist/components/data/DataGrid/DataGridFilterMenu/index.js +10 -8
- package/dist/components/data/DataGrid/DataGridFooter.js +4 -14
- package/dist/components/data/DataGrid/DataGridHeader.js +60 -12
- package/dist/components/data/DataGrid/DataGridHeaderCell.js +6 -5
- package/dist/components/data/DataGrid/FilterModalContent/index.d.ts +5 -5
- package/dist/components/data/DataGrid/FilterModalContent/index.js +11 -9
- package/dist/components/data/DataGrid/FilterValuesScroller.d.ts +8 -7
- package/dist/components/data/DataGrid/FilterValuesScroller.js +5 -6
- package/dist/components/data/DataGrid/VirtualScroller.js +1 -6
- package/dist/components/data/DataGrid/helpers/columns.d.ts +12 -13
- package/dist/components/data/DataGrid/helpers/columns.js +17 -71
- package/dist/components/data/DataGrid/helpers/filters.d.ts +8 -7
- package/dist/components/data/DataGrid/helpers/filters.js +26 -21
- package/dist/components/data/DataGrid/helpers/index.d.ts +1 -2
- package/dist/components/data/DataGrid/helpers/index.js +1 -2
- package/dist/components/data/DataGrid/hooks/index.d.ts +2 -2
- package/dist/components/data/DataGrid/hooks/index.js +4 -4
- package/dist/components/data/DataGrid/hooks/useDataGrid.js +27 -5
- package/dist/components/data/DataGrid/hooks/useDataGridCopy.js +0 -1
- package/dist/components/data/DataGrid/hooks/useDataGridSettings.js +0 -1
- package/dist/components/data/DataGrid/index.js +27 -20
- package/dist/components/data/DataGrid/styles.d.ts +7 -2
- package/dist/components/data/DataGrid/styles.js +13 -10
- package/dist/components/data/DataGrid/types.d.ts +47 -54
- package/dist/components/data/SqlRequestDataGrid/helpers/columns.d.ts +16 -0
- package/dist/components/data/SqlRequestDataGrid/helpers/columns.js +112 -0
- package/dist/components/data/SqlRequestDataGrid/helpers/index.d.ts +2 -0
- package/dist/components/data/SqlRequestDataGrid/helpers/index.js +18 -0
- package/dist/components/data/SqlRequestDataGrid/helpers/sqlRequests.d.ts +3 -0
- package/dist/components/data/SqlRequestDataGrid/helpers/sqlRequests.js +18 -0
- package/dist/components/data/SqlRequestDataGrid/index.d.ts +2 -0
- package/dist/components/data/SqlRequestDataGrid/index.js +224 -0
- package/dist/components/data/SqlRequestDataGrid/types.d.ts +21 -0
- package/dist/components/data/SqlRequestDataGrid/types.js +2 -0
- package/dist/components/data/index.d.ts +7 -2
- package/dist/components/data/index.js +7 -2
- package/dist/components/forms/IconButton.js +1 -1
- package/dist/components/forms/IndeterminateCheckbox.js +1 -1
- package/dist/components/layout/Modal/index.js +1 -1
- package/dist/helpers/dates.d.ts +2 -0
- package/dist/helpers/dates.js +13 -0
- package/dist/providers/PortalsProvider/index.d.ts +1 -1
- package/dist/providers/PortalsProvider/index.js +1 -1
- package/dist/services/HttpService.d.ts +10 -0
- package/dist/services/HttpService.js +117 -0
- package/dist/services/advancedRequests.d.ts +3 -3
- package/dist/services/advancedRequests.js +2 -2
- package/dist/services/hooks.d.ts +2 -1
- package/dist/services/hooks.js +10 -3
- package/dist/services/sqlRequests.d.ts +40 -0
- package/dist/services/sqlRequests.js +10 -0
- package/package.json +1 -1
- package/src/Icons.tsx +80 -80
- package/src/components/data/AdvancedRequestDataGrid/helpers/advancedRequests.ts +93 -93
- package/src/components/data/AdvancedRequestDataGrid/helpers/columns.tsx +262 -262
- package/src/components/data/AdvancedRequestDataGrid/helpers/index.ts +2 -2
- package/src/components/data/AdvancedRequestDataGrid/index.tsx +269 -269
- package/src/components/data/AdvancedRequestDataGrid/types.ts +47 -47
- package/src/components/data/DataGrid/DataGridCell.tsx +73 -75
- package/src/components/data/DataGrid/DataGridColumnsModal/helpers.ts +14 -14
- package/src/components/data/DataGrid/DataGridColumnsModal/hooks.tsx +58 -58
- package/src/components/data/DataGrid/DataGridColumnsModal/index.tsx +181 -181
- package/src/components/data/DataGrid/DataGridColumnsModal/styles.ts +104 -104
- package/src/components/data/DataGrid/DataGridEditableCell.tsx +43 -54
- package/src/components/data/DataGrid/DataGridFilterMenu/hooks.tsx +75 -75
- package/src/components/data/DataGrid/DataGridFilterMenu/index.tsx +200 -190
- package/src/components/data/DataGrid/DataGridFilterMenu/styles.ts +100 -100
- package/src/components/data/DataGrid/DataGridFooter.tsx +44 -64
- package/src/components/data/DataGrid/DataGridHeader.tsx +126 -128
- package/src/components/data/DataGrid/DataGridHeaderCell.tsx +167 -166
- package/src/components/data/DataGrid/FilterModalContent/index.tsx +124 -125
- package/src/components/data/DataGrid/FilterModalContent/styles.ts +22 -22
- package/src/components/data/DataGrid/FilterValuesScroller.tsx +133 -131
- package/src/components/data/DataGrid/VirtualScroller.tsx +46 -46
- package/src/components/data/DataGrid/helpers/columns.tsx +196 -199
- package/src/components/data/DataGrid/helpers/filters.ts +220 -207
- package/src/components/data/DataGrid/helpers/index.ts +2 -2
- package/src/components/data/DataGrid/hooks/index.ts +30 -30
- package/src/components/data/DataGrid/hooks/useDataGrid.tsx +264 -261
- package/src/components/data/DataGrid/hooks/useDataGridCopy.ts +165 -166
- package/src/components/data/DataGrid/hooks/useDataGridSettings.ts +48 -49
- package/src/components/data/DataGrid/index.tsx +132 -133
- package/src/components/data/DataGrid/styles.ts +326 -299
- package/src/components/data/DataGrid/types.ts +241 -233
- package/src/components/data/SqlRequestDataGrid/helpers/columns.tsx +224 -206
- package/src/components/data/SqlRequestDataGrid/helpers/index.ts +2 -2
- package/src/components/data/SqlRequestDataGrid/helpers/sqlRequests.ts +16 -16
- package/src/components/data/SqlRequestDataGrid/index.tsx +252 -221
- package/src/components/data/SqlRequestDataGrid/types.ts +47 -46
- package/src/components/data/index.ts +8 -6
- package/src/components/forms/Button.tsx +99 -99
- package/src/components/forms/IconButton.tsx +56 -56
- package/src/components/forms/IndeterminateCheckbox.tsx +46 -46
- package/src/components/forms/Select.tsx +40 -40
- package/src/components/forms/index.ts +5 -5
- package/src/components/forms/styles.ts +20 -20
- package/src/components/index.ts +3 -3
- package/src/components/layout/Dropdown/index.tsx +79 -79
- package/src/components/layout/Dropdown/styles.ts +44 -44
- package/src/components/layout/Loading/index.tsx +29 -29
- package/src/components/layout/Loading/styles.ts +29 -29
- package/src/components/layout/Modal/index.tsx +51 -51
- package/src/components/layout/Modal/styles.ts +110 -110
- package/src/components/layout/index.ts +3 -3
- package/src/config/index.ts +14 -14
- package/src/helpers/dates.ts +9 -0
- package/src/helpers/getScrollbarSize.ts +14 -14
- package/src/helpers/numbers.ts +20 -20
- package/src/hooks/index.ts +2 -2
- package/src/hooks/useElementSize.ts +24 -24
- package/src/hooks/useWindowSize.ts +20 -20
- package/src/index.ts +7 -7
- package/src/providers/PortalsProvider/index.tsx +54 -54
- package/src/providers/PortalsProvider/styles.ts +27 -27
- package/src/providers/SettingsProvider/index.tsx +70 -70
- package/src/providers/ThemeProvider/ThemeProvider.ts +55 -55
- package/src/providers/ThemeProvider/defaultTheme.ts +444 -444
- package/src/providers/ThemeProvider/index.ts +3 -3
- package/src/providers/ThemeProvider/types.ts +123 -123
- package/src/providers/UiProviders/index.tsx +65 -65
- package/src/providers/UiProviders/styles.ts +10 -10
- package/src/providers/hooks.ts +8 -8
- package/src/providers/index.ts +5 -5
- package/src/services/HttpService.ts +80 -80
- package/src/services/WebSocketService.ts +147 -147
- package/src/services/advancedRequests.ts +101 -101
- package/src/services/base.ts +31 -31
- package/src/services/hooks.ts +23 -23
- package/src/services/index.ts +2 -2
- package/src/services/sqlRequests.ts +99 -98
- package/src/styles/animations.scss +30 -30
- package/src/styles/index.scss +42 -42
- package/src/typings.d.ts +6 -6
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/components/data/DataGrid/helpers.d.ts +0 -28
- package/dist/components/data/DataGrid/helpers.js +0 -436
- package/dist/config/types.d.ts +0 -11
- /package/dist/{config → components/data/AdvancedRequestDataGrid}/types.js +0 -0
|
@@ -1,233 +1,241 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
|
|
3
|
-
import * as t from 'io-ts';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
CSSProperties,
|
|
7
|
-
Context,
|
|
8
|
-
Dispatch,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export type
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
export type
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
//
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
>;
|
|
137
|
-
export type
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
export type
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
export type
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
| '
|
|
178
|
-
| '
|
|
179
|
-
| '
|
|
180
|
-
| '
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
| '
|
|
188
|
-
| '
|
|
189
|
-
| '
|
|
190
|
-
| '
|
|
191
|
-
| '
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
export type
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
import * as t from 'io-ts';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
CSSProperties,
|
|
7
|
+
Context,
|
|
8
|
+
Dispatch,
|
|
9
|
+
FC,
|
|
10
|
+
MouseEvent,
|
|
11
|
+
MouseEventHandler,
|
|
12
|
+
ReactNode,
|
|
13
|
+
SetStateAction,
|
|
14
|
+
} from 'react';
|
|
15
|
+
|
|
16
|
+
import { SettingsContextProps } from '../../../providers/SettingsProvider';
|
|
17
|
+
import { ThemeColor } from '../../../providers/ThemeProvider/types';
|
|
18
|
+
|
|
19
|
+
export type DataGridCellFC = FC<{
|
|
20
|
+
onDoubleClick?: MouseEventHandler;
|
|
21
|
+
style?: CSSProperties;
|
|
22
|
+
}>;
|
|
23
|
+
|
|
24
|
+
export type DataGridColumn<R> = {
|
|
25
|
+
component?: DataGridCellFC;
|
|
26
|
+
editable?: boolean;
|
|
27
|
+
excelFormatter?: (value: any) => string;
|
|
28
|
+
excelValue?: (value: any) => string;
|
|
29
|
+
filter?: DataGridFilter;
|
|
30
|
+
footer?: (allRows: R[], filteredRows: R[], selectedRows: R[]) => ReactNode;
|
|
31
|
+
getter?: (row: R) => string | number;
|
|
32
|
+
name: string;
|
|
33
|
+
order?: number;
|
|
34
|
+
propertyName?: keyof R;
|
|
35
|
+
render?: (row: R, column: DataGridColumn<R>) => ReactNode | string;
|
|
36
|
+
resizable?: boolean;
|
|
37
|
+
sortGetter?: (row: R) => string | number;
|
|
38
|
+
type?: 'text' | 'number' | 'date';
|
|
39
|
+
width?: number;
|
|
40
|
+
settingsContext?: Context<SettingsContextProps>;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type DataGridColumns<R> = Record<string, DataGridColumn<R>>;
|
|
44
|
+
|
|
45
|
+
export type DataGridFilters = Record<
|
|
46
|
+
string,
|
|
47
|
+
DataGridFilter<DataGridFilterType>
|
|
48
|
+
>;
|
|
49
|
+
|
|
50
|
+
export type DataGridProps<R> = {
|
|
51
|
+
name?: string;
|
|
52
|
+
className?: string;
|
|
53
|
+
rows: R[];
|
|
54
|
+
columns: DataGridColumns<R>;
|
|
55
|
+
rowKey: keyof R | ((row: R) => string);
|
|
56
|
+
selectable?: boolean;
|
|
57
|
+
editable?: boolean;
|
|
58
|
+
onRowDoubleClick?: (row: R, e: MouseEvent) => void;
|
|
59
|
+
onSelectionChange?: (keys: string[]) => void;
|
|
60
|
+
getAllIds?: () => Promise<string[]>;
|
|
61
|
+
onFiltersChanged?: (filters: DataGridFilters) => void;
|
|
62
|
+
onSortsChanged?: (sorts: Record<string, DataGridSort>) => void;
|
|
63
|
+
onVisibleRowsChange?: (startIndex: number, length: number) => void;
|
|
64
|
+
onCellEdited?: (row: R, columnKey: string, value: any) => void;
|
|
65
|
+
rowClassNameGetter?: (row: R | null) => {
|
|
66
|
+
className?: string;
|
|
67
|
+
style?: CSSProperties;
|
|
68
|
+
};
|
|
69
|
+
headerRowHeight?: number;
|
|
70
|
+
rowHeight?: number;
|
|
71
|
+
filter?: boolean;
|
|
72
|
+
sort?: boolean;
|
|
73
|
+
initialSorts?: Record<string, DataGridSort>;
|
|
74
|
+
filterValuesLoader?: (
|
|
75
|
+
columnKey: string
|
|
76
|
+
) => Promise<(string | number | null)[]>;
|
|
77
|
+
// copyTableHandler?: (
|
|
78
|
+
// includeHeaders?: boolean,
|
|
79
|
+
// includeFooters?: boolean
|
|
80
|
+
// ) => Promise<void>;
|
|
81
|
+
loadCopyRows?: () => Promise<R[]>;
|
|
82
|
+
refresh?: () => void;
|
|
83
|
+
headerColor?: ThemeColor;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export type DataGridContextProps<R> = DataGridProps<R> & {
|
|
87
|
+
editingCell?: [number, number];
|
|
88
|
+
setEditingCell: Dispatch<SetStateAction<[number, number]>>;
|
|
89
|
+
sortedRows: R[];
|
|
90
|
+
selectedRows: R[];
|
|
91
|
+
selectedKeys: string[];
|
|
92
|
+
setSelectedKeys: (selection: string[]) => void;
|
|
93
|
+
sorts?: Record<string, DataGridSort>;
|
|
94
|
+
setSorts: (sorts: Record<string, DataGridSort>) => void;
|
|
95
|
+
filters?: DataGridFilters;
|
|
96
|
+
setFilters: Dispatch<SetStateAction<DataGridFilters>>;
|
|
97
|
+
visibleColumns: DataGridColumnKeyValuePair<R>[];
|
|
98
|
+
copyTable: (
|
|
99
|
+
includeHeaders?: boolean,
|
|
100
|
+
includeFooters?: boolean
|
|
101
|
+
) => Promise<void>;
|
|
102
|
+
setColumnWidth: (key: string, width: number) => void;
|
|
103
|
+
saveSettings: (newSettings?: DataGridSettings) => void;
|
|
104
|
+
settings: DataGridSettings;
|
|
105
|
+
setSettings: Dispatch<SetStateAction<DataGridSettings>>;
|
|
106
|
+
visibleRows: R[];
|
|
107
|
+
scrollableRef: React.RefObject<HTMLDivElement>;
|
|
108
|
+
onScroll: (e: React.UIEvent<HTMLDivElement>) => void;
|
|
109
|
+
index: number;
|
|
110
|
+
length: number;
|
|
111
|
+
rowKeyGetter: (row: R) => string;
|
|
112
|
+
gridTemplateColumns: string;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export type DataGridContext<R> = Context<DataGridContextProps<R>>;
|
|
116
|
+
|
|
117
|
+
export const dataGridSettingCodec = t.partial(
|
|
118
|
+
{
|
|
119
|
+
width: t.number,
|
|
120
|
+
order: t.number,
|
|
121
|
+
},
|
|
122
|
+
'DataGridSetting'
|
|
123
|
+
);
|
|
124
|
+
export const dataGridSettingsCodec = t.record(
|
|
125
|
+
t.string,
|
|
126
|
+
dataGridSettingCodec,
|
|
127
|
+
'DataGridSettings'
|
|
128
|
+
);
|
|
129
|
+
export const dataGridSettingsByNameCodec = t.record(
|
|
130
|
+
t.string,
|
|
131
|
+
dataGridSettingsCodec,
|
|
132
|
+
'DataGridSettingsByName'
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
export type DataGridSetting = t.TypeOf<typeof dataGridSettingCodec>;
|
|
136
|
+
export type DataGridSettings = t.TypeOf<typeof dataGridSettingsCodec>;
|
|
137
|
+
export type DataGridSettingsByName = t.TypeOf<
|
|
138
|
+
typeof dataGridSettingsByNameCodec
|
|
139
|
+
>;
|
|
140
|
+
export type DataGridSettingsTuple = [string, DataGridSetting];
|
|
141
|
+
export type DataGridSettingsArray = DataGridSettingsTuple[];
|
|
142
|
+
export type DataGridColumnKeyValuePair<R> = [string, DataGridColumn<R>];
|
|
143
|
+
|
|
144
|
+
export type DataGridCellProps<R> = {
|
|
145
|
+
row: R;
|
|
146
|
+
rowIndex: number;
|
|
147
|
+
columnKey: string;
|
|
148
|
+
columnIndex: number;
|
|
149
|
+
column: DataGridColumn<R>;
|
|
150
|
+
context: DataGridContext<R>;
|
|
151
|
+
className?: string;
|
|
152
|
+
style?: CSSProperties;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export type DataGridHeaderCellProps<R> = {
|
|
156
|
+
columnKey: string;
|
|
157
|
+
columnIndex: number;
|
|
158
|
+
column: DataGridColumn<R>;
|
|
159
|
+
context: DataGridContext<R>;
|
|
160
|
+
onFilterButtonClicked?: (columnKey: string) => void;
|
|
161
|
+
isFilterOpen?: boolean;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export type DataGridSort = 'asc' | 'desc';
|
|
165
|
+
|
|
166
|
+
export type DataGridFilterPredicate<T> = (valueToVerify: T) => boolean;
|
|
167
|
+
export type DataGridFilterPredicateBuilder<T> = (
|
|
168
|
+
...filterValues: T[]
|
|
169
|
+
) => DataGridFilterPredicate<T>;
|
|
170
|
+
|
|
171
|
+
export type DataGridFilterOperators<K extends string, T> = {
|
|
172
|
+
[key in K]: DataGridFilterPredicateBuilder<T>;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export type DataGridFilterPredicates = {
|
|
176
|
+
text: DataGridFilterOperators<
|
|
177
|
+
| 'contains'
|
|
178
|
+
| 'notContains'
|
|
179
|
+
| 'equals'
|
|
180
|
+
| 'notEquals'
|
|
181
|
+
| 'startsWith'
|
|
182
|
+
| 'endsWith'
|
|
183
|
+
| 'inArray',
|
|
184
|
+
string
|
|
185
|
+
>;
|
|
186
|
+
number: DataGridFilterOperators<
|
|
187
|
+
| 'equals'
|
|
188
|
+
| 'notEquals'
|
|
189
|
+
| 'lessThan'
|
|
190
|
+
| 'lessThanOrEqual'
|
|
191
|
+
| 'greaterThan'
|
|
192
|
+
| 'greaterThanOrEqual'
|
|
193
|
+
| 'inRange'
|
|
194
|
+
| 'inArray',
|
|
195
|
+
number
|
|
196
|
+
>;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export type DataGridFilterType = keyof DataGridFilterPredicates;
|
|
200
|
+
export type DataGridFilterDataType<T extends DataGridFilterType> =
|
|
201
|
+
DataGridFilterPredicates[T] extends DataGridFilterOperators<string, infer U>
|
|
202
|
+
? U
|
|
203
|
+
: never;
|
|
204
|
+
|
|
205
|
+
export type DataGridFilterGetter<T extends DataGridFilterType> = (
|
|
206
|
+
value: any
|
|
207
|
+
) => DataGridFilterDataType<T> | null;
|
|
208
|
+
export type DataGridFilterRenderer = (value: any) => ReactNode;
|
|
209
|
+
export type DataGridFilterFormatter = (value: any) => string;
|
|
210
|
+
|
|
211
|
+
export type DataGridFilterOperator<T extends DataGridFilterType> =
|
|
212
|
+
DataGridFilterPredicates[T] extends DataGridFilterOperators<infer K, any>
|
|
213
|
+
? K
|
|
214
|
+
: never;
|
|
215
|
+
|
|
216
|
+
export type DataGridFilter<T extends string = DataGridFilterType> =
|
|
217
|
+
T extends DataGridFilterType
|
|
218
|
+
? {
|
|
219
|
+
type: T;
|
|
220
|
+
operator: DataGridFilterOperator<T>;
|
|
221
|
+
getter: DataGridFilterGetter<T>;
|
|
222
|
+
renderer?: DataGridFilterRenderer;
|
|
223
|
+
formatter?: DataGridFilterFormatter;
|
|
224
|
+
values: (DataGridFilterDataType<T> | null)[];
|
|
225
|
+
}
|
|
226
|
+
: never;
|
|
227
|
+
|
|
228
|
+
export type DataGridFilterGroup = {
|
|
229
|
+
name: string;
|
|
230
|
+
values?: (string | number | null)[];
|
|
231
|
+
groups?: DataGridFilterGroup[];
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export type DataGridFilterValue = string | number | null;
|
|
235
|
+
|
|
236
|
+
export type DataGridFilterCheckbox = {
|
|
237
|
+
displayValue: ReactNode;
|
|
238
|
+
title: string;
|
|
239
|
+
value: DataGridFilterValue;
|
|
240
|
+
level: number;
|
|
241
|
+
};
|