@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,199 +1,196 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
|
|
3
|
-
import { DataGridColumn, DataGridColumns, DataGridSettings } from '../types';
|
|
4
|
-
import {
|
|
5
|
-
formatMoney,
|
|
6
|
-
formatNumber,
|
|
7
|
-
formatPercentage,
|
|
8
|
-
} from '../../../../helpers/numbers';
|
|
9
|
-
import { numberFilter, textFilter } from './filters';
|
|
10
|
-
|
|
11
|
-
import moment from 'moment';
|
|
12
|
-
|
|
13
|
-
export const isColumnVisible = <R,>(
|
|
14
|
-
obj: DataGridColumn<R> | DataGridSettings
|
|
15
|
-
): boolean =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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
|
-
...options,
|
|
198
|
-
},
|
|
199
|
-
});
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
import { DataGridColumn, DataGridColumns, DataGridSettings } from '../types';
|
|
4
|
+
import {
|
|
5
|
+
formatMoney,
|
|
6
|
+
formatNumber,
|
|
7
|
+
formatPercentage,
|
|
8
|
+
} from '../../../../helpers/numbers';
|
|
9
|
+
import { numberFilter, textFilter } from './filters';
|
|
10
|
+
|
|
11
|
+
import moment from 'moment';
|
|
12
|
+
|
|
13
|
+
export const isColumnVisible = <R,>(
|
|
14
|
+
obj: DataGridColumn<R> | DataGridSettings
|
|
15
|
+
): boolean => obj?.order !== -1;
|
|
16
|
+
|
|
17
|
+
export const textColumn = <R extends Record<string, any>>(
|
|
18
|
+
key: string,
|
|
19
|
+
title: string,
|
|
20
|
+
options?: Partial<DataGridColumn<R>>
|
|
21
|
+
): DataGridColumns<R> => ({
|
|
22
|
+
[key]: {
|
|
23
|
+
name: title,
|
|
24
|
+
render: (row) => row[key] ?? '',
|
|
25
|
+
getter: (row) => row[key] ?? '',
|
|
26
|
+
sortGetter: (row) => row[key] ?? '',
|
|
27
|
+
filter: textFilter(key),
|
|
28
|
+
...options,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const mailColumn = <R extends Record<string, any>>(
|
|
33
|
+
key: string,
|
|
34
|
+
title: string,
|
|
35
|
+
options?: Partial<DataGridColumn<R>>
|
|
36
|
+
): DataGridColumns<R> => ({
|
|
37
|
+
[key]: {
|
|
38
|
+
name: title,
|
|
39
|
+
render: (row) => (
|
|
40
|
+
<a
|
|
41
|
+
// className="text-blue-500 hover:text-blue-700"
|
|
42
|
+
href={`mailto:${row[key]}`}
|
|
43
|
+
>
|
|
44
|
+
{row[key] ?? ''}
|
|
45
|
+
</a>
|
|
46
|
+
),
|
|
47
|
+
getter: (row) => row[key] ?? '',
|
|
48
|
+
sortGetter: (row) => row[key] ?? '',
|
|
49
|
+
filter: textFilter(key),
|
|
50
|
+
...options,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export const phoneColumn = <R extends Record<string, any>>(
|
|
55
|
+
key: string,
|
|
56
|
+
title: string,
|
|
57
|
+
options?: Partial<DataGridColumn<R>>
|
|
58
|
+
): DataGridColumns<R> => ({
|
|
59
|
+
[key]: {
|
|
60
|
+
name: title,
|
|
61
|
+
render: (row) => (
|
|
62
|
+
<a
|
|
63
|
+
// className="text-blue-500 hover:text-blue-700"
|
|
64
|
+
href={`tel:${row[key]}`}
|
|
65
|
+
>
|
|
66
|
+
{row[key] ?? ''}
|
|
67
|
+
</a>
|
|
68
|
+
),
|
|
69
|
+
getter: (row) => row[key] ?? '',
|
|
70
|
+
sortGetter: (row) => row[key] ?? '',
|
|
71
|
+
filter: textFilter(key),
|
|
72
|
+
...options,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export const dateColumn = <R extends Record<string, any>>(
|
|
77
|
+
key: string,
|
|
78
|
+
title: string,
|
|
79
|
+
options?: Partial<DataGridColumn<R>>
|
|
80
|
+
): DataGridColumns<R> => ({
|
|
81
|
+
[key]: {
|
|
82
|
+
name: title,
|
|
83
|
+
render: (row) => moment(row[key]).format('DD/MM/YYYY') ?? '',
|
|
84
|
+
getter: (row) => row[key] ?? '',
|
|
85
|
+
sortGetter: (row) => row[key] ?? '',
|
|
86
|
+
filter: textFilter(key),
|
|
87
|
+
...options,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
export const monthColumn = <R extends Record<string, any>>(
|
|
92
|
+
key: string,
|
|
93
|
+
title: string,
|
|
94
|
+
options?: Partial<DataGridColumn<R>>
|
|
95
|
+
): DataGridColumns<R> => ({
|
|
96
|
+
[key]: {
|
|
97
|
+
name: title,
|
|
98
|
+
render: (row) => (row[key] ? `${row[key]} mois ` : ''),
|
|
99
|
+
getter: (row) => row[key] ?? '',
|
|
100
|
+
sortGetter: (row) => row[key] ?? '',
|
|
101
|
+
filter: textFilter(key),
|
|
102
|
+
...options,
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
export const numberColumn = <R extends Record<string, any>>(
|
|
107
|
+
key: string,
|
|
108
|
+
title: string,
|
|
109
|
+
decimals = 2,
|
|
110
|
+
options?: Partial<DataGridColumn<R>>
|
|
111
|
+
): DataGridColumns<R> => ({
|
|
112
|
+
[key]: {
|
|
113
|
+
name: title,
|
|
114
|
+
render: (row) => formatNumber(row[key], decimals) ?? '',
|
|
115
|
+
excelFormatter: () => '#',
|
|
116
|
+
getter: (row) => row[key] ?? '',
|
|
117
|
+
sortGetter: (row) => row[key] ?? '',
|
|
118
|
+
filter: {
|
|
119
|
+
type: 'number',
|
|
120
|
+
operator: 'equals',
|
|
121
|
+
values: [0],
|
|
122
|
+
getter: (value) => value ?? 0,
|
|
123
|
+
},
|
|
124
|
+
...options,
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
export const moneyColumn = <R extends Record<string, any>>(
|
|
129
|
+
key: string,
|
|
130
|
+
title: string,
|
|
131
|
+
decimals = 2,
|
|
132
|
+
options?: Partial<DataGridColumn<R>>
|
|
133
|
+
): DataGridColumns<R> => ({
|
|
134
|
+
[key]: {
|
|
135
|
+
name: title,
|
|
136
|
+
render: (row) => formatMoney(row[key], decimals) ?? '',
|
|
137
|
+
excelFormatter: () => '#0.00',
|
|
138
|
+
getter: (row) => row[key] ?? '',
|
|
139
|
+
sortGetter: (row) => row[key] ?? '',
|
|
140
|
+
filter: numberFilter(key),
|
|
141
|
+
...options,
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
export const percentageColumn = <R extends Record<string, any>>(
|
|
146
|
+
key: string,
|
|
147
|
+
title: string,
|
|
148
|
+
options?: Partial<DataGridColumn<R>>
|
|
149
|
+
): DataGridColumns<R> => ({
|
|
150
|
+
[key]: {
|
|
151
|
+
name: title,
|
|
152
|
+
render: (row) => formatPercentage(row[key]) ?? '',
|
|
153
|
+
excelFormatter: () => '#0.00',
|
|
154
|
+
getter: (row) => row[key] ?? '',
|
|
155
|
+
sortGetter: (row) => row[key] ?? '',
|
|
156
|
+
filter: numberFilter(key),
|
|
157
|
+
...options,
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
export const checkboxColumn = <R extends Record<string, any>>(
|
|
162
|
+
key: string,
|
|
163
|
+
title: string,
|
|
164
|
+
options?: Partial<DataGridColumn<R>>
|
|
165
|
+
): DataGridColumns<R> => ({
|
|
166
|
+
[key]: {
|
|
167
|
+
name: title,
|
|
168
|
+
render: (row) => (
|
|
169
|
+
<>
|
|
170
|
+
<input type="checkbox" checked={row[key]} />
|
|
171
|
+
<span>{row[key] ? ' Oui' : ' Non'}</span>
|
|
172
|
+
</>
|
|
173
|
+
),
|
|
174
|
+
getter: (row) => row[key] ?? '',
|
|
175
|
+
sortGetter: (row) => row[key] ?? '',
|
|
176
|
+
filter: numberFilter(key),
|
|
177
|
+
...options,
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
export const colorColumn = <R extends Record<string, any>>(
|
|
182
|
+
key: string,
|
|
183
|
+
title: string,
|
|
184
|
+
options?: Partial<DataGridColumn<R>>
|
|
185
|
+
): DataGridColumns<R> => ({
|
|
186
|
+
[key]: {
|
|
187
|
+
name: title,
|
|
188
|
+
render: (row) => (
|
|
189
|
+
<div style={{ backgroundColor: row[key] }}>{row[key] ?? ''}</div>
|
|
190
|
+
),
|
|
191
|
+
getter: (row) => row[key] ?? '',
|
|
192
|
+
sortGetter: (row) => row[key] ?? '',
|
|
193
|
+
filter: textFilter(key),
|
|
194
|
+
...options,
|
|
195
|
+
},
|
|
196
|
+
});
|