mantine-datatable 9.4.0 → 9.8.0
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/LICENSE +1 -1
- package/README.md +1 -1
- package/dist/index.d.ts +992 -1015
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +80 -46
- package/dist/styles.layer.css +80 -46
- package/package.json +39 -34
package/dist/index.d.ts
CHANGED
|
@@ -1,1046 +1,1024 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { JSX, Ref, RefObject } from
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
1
|
+
import { CheckboxProps, CollapseProps, MantineColor, MantineLoader, MantineShadow, MantineSize, MantineStyleProp, MantineTheme, PaginationProps, PopoverProps, ScrollAreaProps, StylesRecord, TableProps, TableTrProps, TextProps } from "@mantine/core";
|
|
2
|
+
import { JSX, Ref, RefObject } from "react";
|
|
3
|
+
import { DropResult } from "@hello-pangea/dnd";
|
|
4
|
+
export type DataTableColumnTextAlign = "left" | "center" | "right";
|
|
5
|
+
export type DataTableColumn<T = Record<string, unknown>> = {
|
|
6
|
+
/**
|
|
7
|
+
* Column accessor.
|
|
8
|
+
* You can use dot-notation for nested objects property drilling.
|
|
9
|
+
* (i.e. `department.name` or `department.company.name`)
|
|
10
|
+
*/
|
|
11
|
+
accessor: keyof T | (string & NonNullable<unknown>);
|
|
12
|
+
/**
|
|
13
|
+
* Optional column header title.
|
|
14
|
+
* If not present, one will be generated by "humanizing" the provided column accessor.
|
|
15
|
+
* (i.e. `firstName` -> `First name`; `user.firstName` -> `User first name`)
|
|
16
|
+
*/
|
|
17
|
+
title?: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Custom cell data render function.
|
|
20
|
+
* Accepts the current record and its index in `records` as arguments and returns a React node
|
|
21
|
+
* (remember that a string is a valid React node too).
|
|
22
|
+
*/
|
|
23
|
+
render?: (record: T, index: number) => React.ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Column text alignment.
|
|
26
|
+
* @default `left`
|
|
27
|
+
*/
|
|
28
|
+
textAlign?: DataTableColumnTextAlign;
|
|
29
|
+
/**
|
|
30
|
+
* If true, column will be sortable.
|
|
31
|
+
*/
|
|
32
|
+
sortable?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Optional key passed to `onSortStatusChange` as `sortKey`, useful when the value
|
|
35
|
+
* to sort by differs from the column accessor (e.g. a database field name).
|
|
36
|
+
*/
|
|
37
|
+
sortKey?: string;
|
|
38
|
+
/**
|
|
39
|
+
* If set to true, the column can be dragged.
|
|
40
|
+
*/
|
|
41
|
+
draggable?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* If set to true, the column can be toggled.
|
|
44
|
+
*/
|
|
45
|
+
toggleable?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* If set to true, the column can be resized.
|
|
48
|
+
*/
|
|
49
|
+
resizable?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* If set, the column will be pinned to the specified side of the table.
|
|
52
|
+
* If `pinnable` is false or undefined, this is a static pin (not changeable by user).
|
|
53
|
+
* If `pinnable` is true, this is the initial pinning state (user can change it).
|
|
54
|
+
*/
|
|
55
|
+
pinned?: "left" | "right";
|
|
56
|
+
/**
|
|
57
|
+
* If set to true, the column can be pinned/unpinned by the user via UI.
|
|
58
|
+
* When true, `pinned` acts as the initial pinning state.
|
|
59
|
+
*/
|
|
60
|
+
pinnable?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* If set to true, the column will be toggled by default.
|
|
63
|
+
*/
|
|
64
|
+
defaultToggle?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Optional node providing the user with filtering options.
|
|
67
|
+
* If present, a filter button will be added to the column's header. Upon clicking that button,
|
|
68
|
+
* a pop-over showing the provided node will be opened.
|
|
69
|
+
*
|
|
70
|
+
* Alternatively, a function returning a node can be provided. The function receives props with a `close`
|
|
71
|
+
* method which allows programmatically closing the pop-over.
|
|
72
|
+
*
|
|
73
|
+
* ```tsx
|
|
74
|
+
* // …
|
|
75
|
+
* columns={[
|
|
76
|
+
* {
|
|
77
|
+
* accessor: 'name',
|
|
78
|
+
* filter: ({ close }) => {
|
|
79
|
+
* return <Stack>
|
|
80
|
+
* <Button onClick={() => { setFilter(undefined); close(); }}>Reset</Button>
|
|
81
|
+
* </Stack>
|
|
82
|
+
* },
|
|
83
|
+
* }
|
|
84
|
+
* ]}
|
|
85
|
+
* // …
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* Note: this property only takes care of rendering the node which provides the filtering options.
|
|
89
|
+
* It is assumed that the actual filtering is performed somewhere in user code.
|
|
90
|
+
*/
|
|
91
|
+
filter?: React.ReactNode | ((params: {
|
|
92
|
+
close: () => void;
|
|
93
|
+
}) => React.ReactNode);
|
|
94
|
+
/**
|
|
95
|
+
* Filter popover props; override if necessary.
|
|
96
|
+
*/
|
|
97
|
+
filterPopoverProps?: PopoverProps;
|
|
98
|
+
/**
|
|
99
|
+
* Disables the use of the Mantine useClickOutside hook inside the filter popover
|
|
100
|
+
*/
|
|
101
|
+
filterPopoverDisableClickOutside?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* If true, filter icon will be styled differently to indicate the filter is in effect.
|
|
104
|
+
*/
|
|
105
|
+
filtering?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Desired column width.
|
|
108
|
+
*/
|
|
109
|
+
width?: string | number;
|
|
110
|
+
/**
|
|
111
|
+
* If true, column will not be visible.
|
|
112
|
+
*/
|
|
113
|
+
hidden?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* If true, tbody cells will not be visible.
|
|
116
|
+
*/
|
|
117
|
+
hiddenContent?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* If set, the column will only be visible according to the specified media query.
|
|
120
|
+
* Can be a string, or a function receiving the current theme and returning a string.
|
|
121
|
+
*/
|
|
122
|
+
visibleMediaQuery?: string | ((theme: MantineTheme) => string);
|
|
123
|
+
/**
|
|
124
|
+
* Optional class name passed to the column title
|
|
125
|
+
*/
|
|
126
|
+
titleClassName?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Optional style passed to the column title.
|
|
129
|
+
* Either a style object, or a function receiving the current theme and returning a style object.
|
|
130
|
+
*/
|
|
131
|
+
titleStyle?: MantineStyleProp;
|
|
132
|
+
/**
|
|
133
|
+
* Optional class name passed to each data cell in the column.
|
|
134
|
+
* Can be a string, or a function receiving the current record and its index
|
|
135
|
+
* as arguments and returning a string.
|
|
136
|
+
*/
|
|
137
|
+
cellsClassName?: string | ((record: T, index: number) => string | undefined);
|
|
138
|
+
/**
|
|
139
|
+
* Optional style passed to each data cell in the column.
|
|
140
|
+
* A function that receives the current record and its index as arguments and returns either
|
|
141
|
+
* a style object, or a function that accepts theme and returns a style object.
|
|
142
|
+
*/
|
|
143
|
+
cellsStyle?: (record: T, index: number) => MantineStyleProp | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* Optional function returning an object of custom attributes to be applied to each cell in the column.
|
|
146
|
+
* Receives the current record and its index as arguments.
|
|
147
|
+
* Useful for adding data attributes, handling middle-clicks, etc.
|
|
148
|
+
*/
|
|
149
|
+
customCellAttributes?: (record: T, index: number) => Record<string, unknown>;
|
|
150
|
+
/**
|
|
151
|
+
* Optional column footer content.
|
|
152
|
+
* If at least one column has a footer, the table will display a footer row.
|
|
153
|
+
*/
|
|
154
|
+
footer?: React.ReactNode;
|
|
155
|
+
/**
|
|
156
|
+
* Optional class name passed to the column footer.
|
|
157
|
+
*/
|
|
158
|
+
footerClassName?: string;
|
|
159
|
+
/**
|
|
160
|
+
* Optional style passed to the column footer.
|
|
161
|
+
*/
|
|
162
|
+
footerStyle?: MantineStyleProp;
|
|
162
163
|
} & ({
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
164
|
+
/**
|
|
165
|
+
* If true, cell content in this column will be truncated with ellipsis as needed and will not wrap
|
|
166
|
+
* to multiple lines (i.e. `overflow: hidden; text-overflow: ellipsis`; `white-space: nowrap`).
|
|
167
|
+
* On a column, you can either set this property or `noWrap`, but not both.
|
|
168
|
+
*/
|
|
169
|
+
ellipsis?: boolean;
|
|
170
|
+
noWrap?: never;
|
|
170
171
|
} | {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
172
|
+
ellipsis?: never;
|
|
173
|
+
/**
|
|
174
|
+
* If true, cell content in this column will not wrap to multiple lines (i.e. `white-space: nowrap`).
|
|
175
|
+
* This is useful for columns containing long strings.
|
|
176
|
+
* On a column, you can either set this property or `ellipsis`, but not both.
|
|
177
|
+
*/
|
|
178
|
+
noWrap?: boolean;
|
|
178
179
|
});
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
columnIndex: number;
|
|
180
|
+
export type DataTableCellClickHandler<T = Record<string, unknown>> = (params: {
|
|
181
|
+
/**
|
|
182
|
+
* Click event.
|
|
183
|
+
*/
|
|
184
|
+
event: React.MouseEvent;
|
|
185
|
+
/**
|
|
186
|
+
* Clicked record.
|
|
187
|
+
*/
|
|
188
|
+
record: T;
|
|
189
|
+
/**
|
|
190
|
+
* Clicked record index.
|
|
191
|
+
*/
|
|
192
|
+
index: number;
|
|
193
|
+
/**
|
|
194
|
+
* Clicked column information.
|
|
195
|
+
*/
|
|
196
|
+
column: DataTableColumn<T>;
|
|
197
|
+
/**
|
|
198
|
+
* Clicked column index.
|
|
199
|
+
*/
|
|
200
|
+
columnIndex: number;
|
|
201
201
|
}) => void;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
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
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
202
|
+
export type DataTableColorProps<T> = {
|
|
203
|
+
/**
|
|
204
|
+
* Data table text color.
|
|
205
|
+
* Can be a `MantineColor` (key of `theme.colors` or any valid CSS color string),
|
|
206
|
+
* or an object with `light` and `dark` keys and `MantineColor` values.
|
|
207
|
+
*/
|
|
208
|
+
c?: MantineColor | {
|
|
209
|
+
light: MantineColor;
|
|
210
|
+
dark: MantineColor;
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* Data table background color.
|
|
214
|
+
* Can be a `MantineColor` (key of `theme.colors` or any valid CSS color string),
|
|
215
|
+
* or an object with `light` and `dark` keys and `MantineColor` values.
|
|
216
|
+
*/
|
|
217
|
+
backgroundColor?: MantineColor | {
|
|
218
|
+
light: MantineColor;
|
|
219
|
+
dark: MantineColor;
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* Color of table borders, applied to all borders except row borders.
|
|
223
|
+
* Can be a `MantineColor` (key of `theme.colors` or any valid CSS color string),
|
|
224
|
+
* or an object with `light` and `dark` keys and `MantineColor` values.
|
|
225
|
+
*/
|
|
226
|
+
borderColor?: MantineColor | {
|
|
227
|
+
light: MantineColor;
|
|
228
|
+
dark: MantineColor;
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* Color of row borders.
|
|
232
|
+
* Can be a `MantineColor` (key of `theme.colors` or any valid CSS color string),
|
|
233
|
+
* or an object with `light` and `dark` keys and `MantineColor` values.
|
|
234
|
+
*/
|
|
235
|
+
rowBorderColor?: MantineColor | {
|
|
236
|
+
light: MantineColor;
|
|
237
|
+
dark: MantineColor;
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* Background color of striped rows.
|
|
241
|
+
* Can be a `MantineColor` (key of `theme.colors` or any valid CSS color string),
|
|
242
|
+
* or an object with `light` and `dark` keys and `MantineColor` values.
|
|
243
|
+
*/
|
|
244
|
+
stripedColor?: MantineColor | {
|
|
245
|
+
light: MantineColor;
|
|
246
|
+
dark: MantineColor;
|
|
247
|
+
};
|
|
248
|
+
/**
|
|
249
|
+
* Background color of hover-highlighted row.
|
|
250
|
+
* Can be a `MantineColor` (key of `theme.colors` or any valid CSS color string),
|
|
251
|
+
* or an object with `light` and `dark` keys and `MantineColor` values.
|
|
252
|
+
*/
|
|
253
|
+
highlightOnHoverColor?: MantineColor | {
|
|
254
|
+
light: MantineColor;
|
|
255
|
+
dark: MantineColor;
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Background color of selected rows.
|
|
259
|
+
* Can be a `MantineColor` (key of `theme.colors` or any valid CSS color string),
|
|
260
|
+
* or an object with `light` and `dark` keys and `MantineColor` values.
|
|
261
|
+
* Defaults to the light variant of the theme's primary color.
|
|
262
|
+
*/
|
|
263
|
+
selectionColor?: MantineColor | {
|
|
264
|
+
light: MantineColor;
|
|
265
|
+
dark: MantineColor;
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Data table row text color.
|
|
269
|
+
* A function that accepts row data and returns color.
|
|
270
|
+
* The returned color can be a `MantineColor` (key of `theme.colors` or any valid CSS color string),
|
|
271
|
+
* or an object with `light` and `dark` keys and `MantineColor` values.
|
|
272
|
+
*/
|
|
273
|
+
rowColor?: (record: T, index: number) => MantineColor | undefined | {
|
|
274
|
+
light: MantineColor;
|
|
275
|
+
dark: MantineColor;
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* Data table row background color.
|
|
279
|
+
* A function that accepts row data and returns a background color.
|
|
280
|
+
* Can be a `MantineColor` (key of `theme.colors` or any valid CSS color string),
|
|
281
|
+
* or an object with `light` and `dark` keys and `MantineColor` values.
|
|
282
|
+
*/
|
|
283
|
+
rowBackgroundColor?: (record: T, index: number) => MantineColor | undefined | {
|
|
284
|
+
light: MantineColor;
|
|
285
|
+
dark: MantineColor;
|
|
286
|
+
};
|
|
237
287
|
};
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
288
|
+
export type DataTableColumnGroup<T = Record<string, unknown>> = {
|
|
289
|
+
/**
|
|
290
|
+
* Used as the `key` prop for the created `<th />`.
|
|
291
|
+
*/
|
|
292
|
+
id: string;
|
|
293
|
+
/**
|
|
294
|
+
* Component to render inside the column group header.
|
|
295
|
+
*/
|
|
296
|
+
title?: React.ReactNode;
|
|
297
|
+
/**
|
|
298
|
+
* Text alignment of the column group header.
|
|
299
|
+
* @default `left`
|
|
300
|
+
*/
|
|
301
|
+
textAlign?: DataTableColumnTextAlign;
|
|
302
|
+
/**
|
|
303
|
+
* Columns which are part of the group.
|
|
304
|
+
* Optional when groups are provided for multilevel grouping.
|
|
305
|
+
*/
|
|
306
|
+
columns?: DataTableColumn<T>[];
|
|
307
|
+
/**
|
|
308
|
+
* Nested column groups for multilevel grouping.
|
|
309
|
+
* When provided, columns should be omitted.
|
|
310
|
+
*/
|
|
311
|
+
groups?: DataTableColumnGroup<T>[];
|
|
312
|
+
/**
|
|
313
|
+
* Optional className to apply to the column group header.
|
|
314
|
+
*/
|
|
315
|
+
className?: string;
|
|
316
|
+
/**
|
|
317
|
+
* Optional style to apply to the column group header.
|
|
318
|
+
* Can be a style object or a function which receives the current theme and
|
|
319
|
+
* returns a style object.
|
|
320
|
+
*/
|
|
321
|
+
style?: MantineStyleProp;
|
|
268
322
|
};
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
323
|
+
export type DataTableColumnProps<T = Record<string, unknown>> = {
|
|
324
|
+
/**
|
|
325
|
+
* Grouped columns.
|
|
326
|
+
*/
|
|
327
|
+
groups: DataTableColumnGroup<T>[];
|
|
328
|
+
columns?: never;
|
|
273
329
|
} | {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
* Table border radius.
|
|
280
|
-
*/
|
|
281
|
-
borderRadius?: MantineSize | (string & NonNullable<unknown>) | number;
|
|
330
|
+
groups?: never;
|
|
331
|
+
/**
|
|
332
|
+
* Visible columns.
|
|
333
|
+
*/
|
|
334
|
+
columns: DataTableColumn<T>[];
|
|
282
335
|
};
|
|
283
|
-
|
|
284
|
-
type
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
336
|
+
export type DataTableDefaultColumnProps<T = Record<string, unknown>> = Omit<DataTableColumn<T>, "accessor" | "hidden" | "visibleMediaQuery" | "render">;
|
|
337
|
+
export type DataTableDraggableRowProps = {
|
|
338
|
+
/**
|
|
339
|
+
* Optional class name.
|
|
340
|
+
*/
|
|
341
|
+
className?: string;
|
|
342
|
+
/**
|
|
343
|
+
* Current dragging status.
|
|
344
|
+
*/
|
|
345
|
+
isDragging?: boolean;
|
|
346
|
+
} & TableTrProps;
|
|
347
|
+
export type DataTableEmptyStateProps = {
|
|
348
|
+
/**
|
|
349
|
+
* Content to show when no records are available.
|
|
350
|
+
* The provided content will be overlaid and centered automatically.
|
|
351
|
+
* You can either provide this property or `noRecordsIcon`, but not both.
|
|
352
|
+
*/
|
|
353
|
+
emptyState?: React.ReactNode;
|
|
354
|
+
noRecordsIcon?: never;
|
|
288
355
|
} | {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
*/
|
|
297
|
-
recordsPerPageOptions: number[];
|
|
298
|
-
/**
|
|
299
|
-
* Label for records per page selector.
|
|
300
|
-
*/
|
|
301
|
-
recordsPerPageLabel?: string;
|
|
356
|
+
emptyState?: never;
|
|
357
|
+
/**
|
|
358
|
+
* Icon to show when no records are available.
|
|
359
|
+
* The provided icon will be overlaid and centered automatically.
|
|
360
|
+
* You can either provide this property or `emptyState`, but not both.
|
|
361
|
+
*/
|
|
362
|
+
noRecordsIcon?: React.ReactNode;
|
|
302
363
|
};
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
364
|
+
export type DataTableLoaderProps = {
|
|
365
|
+
/**
|
|
366
|
+
* Loader background blur (in pixels).
|
|
367
|
+
*/
|
|
368
|
+
loaderBackgroundBlur?: number;
|
|
369
|
+
} & ({
|
|
370
|
+
loaderSize?: never;
|
|
371
|
+
loaderType?: never;
|
|
372
|
+
loaderColor?: never;
|
|
373
|
+
/**
|
|
374
|
+
* Custom loader component to use instead of default one.
|
|
375
|
+
*/
|
|
376
|
+
customLoader?: React.ReactNode;
|
|
377
|
+
} | {
|
|
378
|
+
/**
|
|
379
|
+
* Loader size.
|
|
380
|
+
* @default `md` (Mantine Loader default)
|
|
381
|
+
*/
|
|
382
|
+
loaderSize?: MantineSize | (string & NonNullable<unknown>) | number;
|
|
383
|
+
/**
|
|
384
|
+
* Loader type.
|
|
385
|
+
*/
|
|
386
|
+
loaderType?: MantineLoader;
|
|
387
|
+
/**
|
|
388
|
+
* Loader color.
|
|
389
|
+
*/
|
|
390
|
+
loaderColor?: MantineColor;
|
|
391
|
+
customLoader?: never;
|
|
392
|
+
});
|
|
393
|
+
export type DataTableOuterBorderProps = {
|
|
394
|
+
withTableBorder?: never;
|
|
395
|
+
borderRadius?: never;
|
|
396
|
+
} | {
|
|
397
|
+
/**
|
|
398
|
+
* If true, table will have border.
|
|
399
|
+
*/
|
|
400
|
+
withTableBorder: boolean;
|
|
401
|
+
/**
|
|
402
|
+
* Table border radius.
|
|
403
|
+
*/
|
|
404
|
+
borderRadius?: MantineSize | (string & NonNullable<unknown>) | number;
|
|
326
405
|
};
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
page?: never;
|
|
332
|
-
onPageChange?: never;
|
|
333
|
-
totalRecords?: never;
|
|
334
|
-
recordsPerPage?: never;
|
|
335
|
-
paginationActiveTextColor?: never;
|
|
336
|
-
paginationActiveBackgroundColor?: never;
|
|
337
|
-
paginationSize?: never;
|
|
338
|
-
loadingText?: never;
|
|
339
|
-
paginationText?: never;
|
|
340
|
-
paginationWrapBreakpoint?: never;
|
|
341
|
-
getPaginationControlProps?: never;
|
|
342
|
-
getPaginationItemProps?: never;
|
|
343
|
-
renderPagination?: never;
|
|
406
|
+
export type DataTablePageSizeSelectorProps = {
|
|
407
|
+
onRecordsPerPageChange?: never;
|
|
408
|
+
recordsPerPageOptions?: never;
|
|
409
|
+
recordsPerPageLabel?: never;
|
|
344
410
|
} | {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
411
|
+
/**
|
|
412
|
+
* Callback fired a new page size is selected.
|
|
413
|
+
* Receives new page size as argument.
|
|
414
|
+
*/
|
|
415
|
+
onRecordsPerPageChange: (recordsPerPage: number) => void;
|
|
416
|
+
/**
|
|
417
|
+
* Array of page sizes (numbers) to show in records per page selector.
|
|
418
|
+
*/
|
|
419
|
+
recordsPerPageOptions: number[];
|
|
420
|
+
/**
|
|
421
|
+
* Label for records per page selector.
|
|
422
|
+
*/
|
|
423
|
+
recordsPerPageLabel?: string;
|
|
424
|
+
};
|
|
425
|
+
export type DataTablePaginationRenderContext = {
|
|
426
|
+
state: {
|
|
427
|
+
paginationSize: MantineSize;
|
|
357
428
|
page: number;
|
|
358
|
-
|
|
359
|
-
* Callback fired after page change.
|
|
360
|
-
* Receives the new page number as argument.
|
|
361
|
-
*/
|
|
362
|
-
onPageChange: (page: number) => void;
|
|
363
|
-
/**
|
|
364
|
-
* Total number of records in the dataset.
|
|
365
|
-
*/
|
|
429
|
+
totalPages: number;
|
|
366
430
|
totalRecords: number | undefined;
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
light: MantineColor;
|
|
384
|
-
dark: MantineColor;
|
|
385
|
-
};
|
|
386
|
-
/**
|
|
387
|
-
* Color applied to active page button background.
|
|
388
|
-
* Can be a `MantineColor` (key of `theme.colors` or any valid CSS color string),
|
|
389
|
-
* or an object with `light` and `dark` keys and `MantineColor` values.
|
|
390
|
-
* Defaults to primary theme color.
|
|
391
|
-
*/
|
|
392
|
-
paginationActiveBackgroundColor?: MantineColor | {
|
|
393
|
-
light: MantineColor;
|
|
394
|
-
dark: MantineColor;
|
|
395
|
-
};
|
|
396
|
-
/**
|
|
397
|
-
* Text to show while records are loading.
|
|
398
|
-
*/
|
|
399
|
-
loadingText?: string;
|
|
400
|
-
/**
|
|
401
|
-
* Pagination text. Defaults to ```({ from, to, totalRecords }) => `${from}-${to}/${totalRecords}`
|
|
402
|
-
* ```
|
|
403
|
-
*/
|
|
404
|
-
paginationText?: (params: {
|
|
405
|
-
from: number;
|
|
406
|
-
to: number;
|
|
407
|
-
totalRecords: number;
|
|
408
|
-
}) => React.ReactNode;
|
|
409
|
-
/**
|
|
410
|
-
* Pagination wrap breakpoints.
|
|
411
|
-
* Below this breakpoint the content will be displayed on multiple lines,
|
|
412
|
-
* above it the content will be displayed on a single line.
|
|
413
|
-
* @default `sm`
|
|
414
|
-
*/
|
|
415
|
-
paginationWrapBreakpoint?: MantineSize | (string & NonNullable<unknown>) | number;
|
|
416
|
-
/**
|
|
417
|
-
* Function that returns props object for pagination control.
|
|
418
|
-
* Useful for improving accessibility.
|
|
419
|
-
*/
|
|
420
|
-
getPaginationControlProps?: (control: 'first' | 'last' | 'previous' | 'next') => Record<string, unknown>;
|
|
421
|
-
/**
|
|
422
|
-
* Function that returns props object for pagination item (page number button).
|
|
423
|
-
*/
|
|
424
|
-
getPaginationItemProps?: (page: number) => Record<string, unknown>;
|
|
425
|
-
/**
|
|
426
|
-
* Optional render function to replace the entire pagination component.
|
|
427
|
-
*/
|
|
428
|
-
renderPagination?: (ctx: DataTablePaginationRenderContext) => React.ReactNode;
|
|
429
|
-
}) & DataTablePageSizeSelectorProps;
|
|
430
|
-
|
|
431
|
-
type DataTableColorProps<T> = {
|
|
432
|
-
/**
|
|
433
|
-
* Data table text color.
|
|
434
|
-
* Can be a `MantineColor` (key of `theme.colors` or any valid CSS color string),
|
|
435
|
-
* or an object with `light` and `dark` keys and `MantineColor` values.
|
|
436
|
-
*/
|
|
437
|
-
c?: MantineColor | {
|
|
438
|
-
light: MantineColor;
|
|
439
|
-
dark: MantineColor;
|
|
440
|
-
};
|
|
441
|
-
/**
|
|
442
|
-
* Data table background color.
|
|
443
|
-
* Can be a `MantineColor` (key of `theme.colors` or any valid CSS color string),
|
|
444
|
-
* or an object with `light` and `dark` keys and `MantineColor` values.
|
|
445
|
-
*/
|
|
446
|
-
backgroundColor?: MantineColor | {
|
|
447
|
-
light: MantineColor;
|
|
448
|
-
dark: MantineColor;
|
|
449
|
-
};
|
|
450
|
-
/**
|
|
451
|
-
* Color of table borders, applied to all borders except row borders.
|
|
452
|
-
* Can be a `MantineColor` (key of `theme.colors` or any valid CSS color string),
|
|
453
|
-
* or an object with `light` and `dark` keys and `MantineColor` values.
|
|
454
|
-
*/
|
|
455
|
-
borderColor?: MantineColor | {
|
|
456
|
-
light: MantineColor;
|
|
457
|
-
dark: MantineColor;
|
|
458
|
-
};
|
|
459
|
-
/**
|
|
460
|
-
* Color of row borders.
|
|
461
|
-
* Can be a `MantineColor` (key of `theme.colors` or any valid CSS color string),
|
|
462
|
-
* or an object with `light` and `dark` keys and `MantineColor` values.
|
|
463
|
-
*/
|
|
464
|
-
rowBorderColor?: MantineColor | {
|
|
465
|
-
light: MantineColor;
|
|
466
|
-
dark: MantineColor;
|
|
467
|
-
};
|
|
468
|
-
/**
|
|
469
|
-
* Background color of striped rows.
|
|
470
|
-
* Can be a `MantineColor` (key of `theme.colors` or any valid CSS color string),
|
|
471
|
-
* or an object with `light` and `dark` keys and `MantineColor` values.
|
|
472
|
-
*/
|
|
473
|
-
stripedColor?: MantineColor | {
|
|
474
|
-
light: MantineColor;
|
|
475
|
-
dark: MantineColor;
|
|
476
|
-
};
|
|
477
|
-
/**
|
|
478
|
-
* Background color of hover-highlighted row.
|
|
479
|
-
* Can be a `MantineColor` (key of `theme.colors` or any valid CSS color string),
|
|
480
|
-
* or an object with `light` and `dark` keys and `MantineColor` values.
|
|
481
|
-
*/
|
|
482
|
-
highlightOnHoverColor?: MantineColor | {
|
|
483
|
-
light: MantineColor;
|
|
484
|
-
dark: MantineColor;
|
|
485
|
-
};
|
|
486
|
-
/**
|
|
487
|
-
* Data table row text color.
|
|
488
|
-
* A function that accepts row data and returns color.
|
|
489
|
-
* The returned color can be a `MantineColor` (key of `theme.colors` or any valid CSS color string),
|
|
490
|
-
* or an object with `light` and `dark` keys and `MantineColor` values.
|
|
491
|
-
*/
|
|
492
|
-
rowColor?: (record: T, index: number) => MantineColor | undefined | {
|
|
493
|
-
light: MantineColor;
|
|
494
|
-
dark: MantineColor;
|
|
495
|
-
};
|
|
496
|
-
/**
|
|
497
|
-
* Data table row background color.
|
|
498
|
-
* A function that accepts row data and returns background color color.
|
|
499
|
-
* Can be a `MantineColor` (key of `theme.colors` or any valid CSS color string),
|
|
500
|
-
* or an object with `light` and `dark` keys and `MantineColor` values.
|
|
501
|
-
*/
|
|
502
|
-
rowBackgroundColor?: (record: T, index: number) => MantineColor | undefined | {
|
|
503
|
-
light: MantineColor;
|
|
504
|
-
dark: MantineColor;
|
|
505
|
-
};
|
|
431
|
+
recordsPerPage: number | undefined;
|
|
432
|
+
recordsLength: number | undefined;
|
|
433
|
+
fetching: boolean | undefined;
|
|
434
|
+
from?: number;
|
|
435
|
+
to?: number;
|
|
436
|
+
isWrapped: boolean;
|
|
437
|
+
};
|
|
438
|
+
actions: {
|
|
439
|
+
setPage: (page: number) => void;
|
|
440
|
+
setRecordsPerPage?: (n: number) => void;
|
|
441
|
+
};
|
|
442
|
+
Controls: {
|
|
443
|
+
Text: (props?: Partial<TextProps>) => JSX.Element;
|
|
444
|
+
PageSizeSelector: (props?: Partial<DataTablePageSizeSelectorProps>) => JSX.Element | null;
|
|
445
|
+
Pagination: (props?: Partial<PaginationProps>) => JSX.Element;
|
|
446
|
+
};
|
|
506
447
|
};
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
448
|
+
export type DataTablePaginationProps = ({
|
|
449
|
+
paginationWithEdges?: never;
|
|
450
|
+
paginationWithControls?: never;
|
|
451
|
+
page?: never;
|
|
452
|
+
onPageChange?: never;
|
|
453
|
+
totalRecords?: never;
|
|
454
|
+
recordsPerPage?: never;
|
|
455
|
+
paginationActiveTextColor?: never;
|
|
456
|
+
paginationActiveBackgroundColor?: never;
|
|
457
|
+
paginationSize?: never;
|
|
458
|
+
loadingText?: never;
|
|
459
|
+
paginationText?: never;
|
|
460
|
+
paginationWrapBreakpoint?: never;
|
|
461
|
+
getPaginationControlProps?: never;
|
|
462
|
+
getPaginationItemProps?: never;
|
|
463
|
+
renderPagination?: never;
|
|
514
464
|
} | {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
465
|
+
/**
|
|
466
|
+
* Whether to show first and last page navigation buttons.
|
|
467
|
+
*/
|
|
468
|
+
paginationWithEdges?: boolean;
|
|
469
|
+
/**
|
|
470
|
+
* Whether to show next and previous page navigation buttons.
|
|
471
|
+
*/
|
|
472
|
+
paginationWithControls?: boolean;
|
|
473
|
+
/**
|
|
474
|
+
* Current page number (1-based).
|
|
475
|
+
* If provided, a pagination component is shown.
|
|
476
|
+
*/
|
|
477
|
+
page: number;
|
|
478
|
+
/**
|
|
479
|
+
* Callback fired after page change.
|
|
480
|
+
* Receives the new page number as argument.
|
|
481
|
+
*/
|
|
482
|
+
onPageChange: (page: number) => void;
|
|
483
|
+
/**
|
|
484
|
+
* Total number of records in the dataset.
|
|
485
|
+
*/
|
|
486
|
+
totalRecords: number | undefined;
|
|
487
|
+
/**
|
|
488
|
+
* Number of records per page.
|
|
489
|
+
*/
|
|
490
|
+
recordsPerPage: number;
|
|
491
|
+
/**
|
|
492
|
+
* Pagination component size.
|
|
493
|
+
* @default `sm`
|
|
494
|
+
*/
|
|
495
|
+
paginationSize?: MantineSize;
|
|
496
|
+
/**
|
|
497
|
+
* Color applied to active page button text.
|
|
498
|
+
* Can be a `MantineColor` (key of `theme.colors` or any valid CSS color string),
|
|
499
|
+
* or an object with `light` and `dark` keys and `MantineColor` values.
|
|
500
|
+
* Defaults to white.
|
|
501
|
+
*/
|
|
502
|
+
paginationActiveTextColor?: MantineColor | {
|
|
503
|
+
light: MantineColor;
|
|
504
|
+
dark: MantineColor;
|
|
505
|
+
};
|
|
506
|
+
/**
|
|
507
|
+
* Color applied to active page button background.
|
|
508
|
+
* Can be a `MantineColor` (key of `theme.colors` or any valid CSS color string),
|
|
509
|
+
* or an object with `light` and `dark` keys and `MantineColor` values.
|
|
510
|
+
* Defaults to primary theme color.
|
|
511
|
+
*/
|
|
512
|
+
paginationActiveBackgroundColor?: MantineColor | {
|
|
513
|
+
light: MantineColor;
|
|
514
|
+
dark: MantineColor;
|
|
515
|
+
};
|
|
516
|
+
/**
|
|
517
|
+
* Text to show while records are loading.
|
|
518
|
+
*/
|
|
519
|
+
loadingText?: string;
|
|
520
|
+
/**
|
|
521
|
+
* Pagination text. Defaults to ```({ from, to, totalRecords }) => `${from}-${to}/${totalRecords}`
|
|
522
|
+
* ```
|
|
523
|
+
*/
|
|
524
|
+
paginationText?: (params: {
|
|
525
|
+
from: number;
|
|
526
|
+
to: number;
|
|
527
|
+
totalRecords: number;
|
|
528
|
+
}) => React.ReactNode;
|
|
529
|
+
/**
|
|
530
|
+
* Pagination wrap breakpoints.
|
|
531
|
+
* Below this breakpoint the content will be displayed on multiple lines,
|
|
532
|
+
* above it the content will be displayed on a single line.
|
|
533
|
+
* @default `sm`
|
|
534
|
+
*/
|
|
535
|
+
paginationWrapBreakpoint?: MantineSize | (string & NonNullable<unknown>) | number;
|
|
536
|
+
/**
|
|
537
|
+
* Function that returns props object for pagination control.
|
|
538
|
+
* Useful for improving accessibility.
|
|
539
|
+
*/
|
|
540
|
+
getPaginationControlProps?: (control: "first" | "last" | "previous" | "next") => Record<string, unknown>;
|
|
541
|
+
/**
|
|
542
|
+
* Function that returns props object for pagination item (page number button).
|
|
543
|
+
*/
|
|
544
|
+
getPaginationItemProps?: (page: number) => Record<string, unknown>;
|
|
545
|
+
/**
|
|
546
|
+
* Optional render function to replace the entire pagination component.
|
|
547
|
+
*/
|
|
548
|
+
renderPagination?: (ctx: DataTablePaginationRenderContext) => React.ReactNode;
|
|
549
|
+
}) & DataTablePageSizeSelectorProps;
|
|
550
|
+
export type DataTableRowClickHandler<T = Record<string, unknown>> = (params: {
|
|
551
|
+
/**
|
|
552
|
+
* Click event.
|
|
553
|
+
*/
|
|
554
|
+
event: React.MouseEvent;
|
|
555
|
+
/**
|
|
556
|
+
* Clicked record.
|
|
557
|
+
*/
|
|
558
|
+
record: T;
|
|
559
|
+
/**
|
|
560
|
+
* Clicked record index.
|
|
561
|
+
*/
|
|
562
|
+
index: number;
|
|
563
|
+
}) => void;
|
|
564
|
+
export type DataTableRowExpansionCollapseProps = Pick<CollapseProps, "animateOpacity" | "transitionDuration" | "transitionTimingFunction">;
|
|
565
|
+
export type DataTableRowExpansionProps<T = Record<string, unknown>> = {
|
|
566
|
+
/**
|
|
567
|
+
* Function defining which records can be expanded.
|
|
568
|
+
* Accepts an object with `record` and `index` properties and returns a boolean specifying
|
|
569
|
+
* whether the row should be expandable.
|
|
570
|
+
*/
|
|
571
|
+
expandable?: (params: {
|
|
560
572
|
record: T;
|
|
561
|
-
/**
|
|
562
|
-
* Clicked record index.
|
|
563
|
-
*/
|
|
564
573
|
index: number;
|
|
565
|
-
}) =>
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
*
|
|
600
|
-
*/
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
onRecordIdsChange?: React.Dispatch<React.SetStateAction<any[]>> | ((recordIds: unknown[]) => void);
|
|
615
|
-
};
|
|
616
|
-
/**
|
|
617
|
-
* Function returning the custom content to be lazily rendered for an expanded row.
|
|
618
|
-
* Accepts an object with properties containing the current record, its index,
|
|
619
|
-
* and a `collapse()` callback that can be used to collapse the expanded row.
|
|
620
|
-
* Must return a React node.
|
|
621
|
-
*/
|
|
622
|
-
content: (params: {
|
|
623
|
-
record: T;
|
|
624
|
-
index: number;
|
|
625
|
-
collapse: () => void;
|
|
626
|
-
}) => React.ReactNode;
|
|
574
|
+
}) => boolean;
|
|
575
|
+
/**
|
|
576
|
+
* Defines when rows should expand.
|
|
577
|
+
* @default `click`
|
|
578
|
+
*/
|
|
579
|
+
trigger?: "click" | "always" | "never";
|
|
580
|
+
/**
|
|
581
|
+
* If true, multiple rows can be expanded at the same time.
|
|
582
|
+
*/
|
|
583
|
+
allowMultiple?: boolean;
|
|
584
|
+
/**
|
|
585
|
+
* Function defining which records will be initially expanded.
|
|
586
|
+
* Accepts an object with `record` and `index` properties and returns a boolean specifying
|
|
587
|
+
* whether the row should be expanded initially.
|
|
588
|
+
* Does nothing if `trigger === 'always'`.
|
|
589
|
+
*/
|
|
590
|
+
initiallyExpanded?: (options: {
|
|
591
|
+
record: T;
|
|
592
|
+
index: number;
|
|
593
|
+
}) => boolean;
|
|
594
|
+
/**
|
|
595
|
+
* Additional properties passed to the Mantine Collapse component wrapping the custom content.
|
|
596
|
+
*/
|
|
597
|
+
collapseProps?: DataTableRowExpansionCollapseProps;
|
|
598
|
+
/**
|
|
599
|
+
* An object defining the row expansion behavior in controlled mode.
|
|
600
|
+
*/
|
|
601
|
+
expanded?: {
|
|
602
|
+
/**
|
|
603
|
+
* Currently expanded record IDs.
|
|
604
|
+
*/
|
|
605
|
+
recordIds: unknown[];
|
|
606
|
+
/**
|
|
607
|
+
* Callback fired when expanded records change.
|
|
608
|
+
* Receives an array containing the newly expanded record IDs.
|
|
609
|
+
*/
|
|
610
|
+
onRecordIdsChange?: React.Dispatch<React.SetStateAction<any[]>> | ((recordIds: unknown[]) => void);
|
|
611
|
+
};
|
|
612
|
+
/**
|
|
613
|
+
* Function returning the custom content to be lazily rendered for an expanded row.
|
|
614
|
+
* Accepts an object with properties containing the current record, its index,
|
|
615
|
+
* and a `collapse()` callback that can be used to collapse the expanded row.
|
|
616
|
+
* Must return a React node.
|
|
617
|
+
*/
|
|
618
|
+
content: (params: {
|
|
619
|
+
record: T;
|
|
620
|
+
index: number;
|
|
621
|
+
collapse: () => void;
|
|
622
|
+
}) => React.ReactNode;
|
|
627
623
|
};
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
onScrollToRight?: () => void;
|
|
624
|
+
export type DataTableScrollProps = {
|
|
625
|
+
/**
|
|
626
|
+
* Function to call when the DataTable is scrolled.
|
|
627
|
+
*/
|
|
628
|
+
onScroll?: (position: {
|
|
629
|
+
x: number;
|
|
630
|
+
y: number;
|
|
631
|
+
}) => void;
|
|
632
|
+
/**
|
|
633
|
+
* Function to call when the DataTable is scrolled to top.
|
|
634
|
+
*/
|
|
635
|
+
onScrollToTop?: () => void;
|
|
636
|
+
/**
|
|
637
|
+
* Function to call when the DataTable is scrolled to bottom.
|
|
638
|
+
*/
|
|
639
|
+
onScrollToBottom?: () => void;
|
|
640
|
+
/**
|
|
641
|
+
* Function to call when the DataTable is scrolled to left.
|
|
642
|
+
*/
|
|
643
|
+
onScrollToLeft?: () => void;
|
|
644
|
+
/**
|
|
645
|
+
* Function to call when the DataTable is scrolled to right.
|
|
646
|
+
*/
|
|
647
|
+
onScrollToRight?: () => void;
|
|
653
648
|
};
|
|
654
|
-
|
|
655
|
-
type
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
selectionColumnClassName?: never;
|
|
666
|
-
selectionColumnStyle?: never;
|
|
649
|
+
export type DataTableSelectionTrigger = "cell" | "checkbox";
|
|
650
|
+
export type DataTableSelectionProps<T = Record<string, unknown>> = {
|
|
651
|
+
selectionTrigger?: never;
|
|
652
|
+
selectedRecords?: never;
|
|
653
|
+
onSelectedRecordsChange?: never;
|
|
654
|
+
isRecordSelectable?: never;
|
|
655
|
+
selectionCheckboxProps?: never;
|
|
656
|
+
getRecordSelectionCheckboxProps?: never;
|
|
657
|
+
allRecordsSelectionCheckboxProps?: never;
|
|
658
|
+
selectionColumnClassName?: never;
|
|
659
|
+
selectionColumnStyle?: never;
|
|
667
660
|
} | {
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
661
|
+
/**
|
|
662
|
+
* Defines how selection is triggered.
|
|
663
|
+
* @default 'checkbox'
|
|
664
|
+
*/
|
|
665
|
+
selectionTrigger?: DataTableSelectionTrigger;
|
|
666
|
+
/**
|
|
667
|
+
* Currently-selected records.
|
|
668
|
+
*/
|
|
669
|
+
selectedRecords?: T[];
|
|
670
|
+
/**
|
|
671
|
+
* Callback fired when selected records change.
|
|
672
|
+
* Receives an array of selected records as argument.
|
|
673
|
+
*/
|
|
674
|
+
onSelectedRecordsChange?: (selectedRecords: T[]) => void;
|
|
675
|
+
/**
|
|
676
|
+
* Optional class name applied to selection column.
|
|
677
|
+
*/
|
|
678
|
+
selectionColumnClassName?: string;
|
|
679
|
+
/**
|
|
680
|
+
* Optional style applied to selection column.
|
|
681
|
+
*/
|
|
682
|
+
selectionColumnStyle?: MantineStyleProp;
|
|
683
|
+
/**
|
|
684
|
+
* A function used to determine whether a certain record is selectable.
|
|
685
|
+
* if the function returns false, the row selection checkbox is disabled.
|
|
686
|
+
* Accepts the current record and index as arguments and returns a boolean.
|
|
687
|
+
*/
|
|
688
|
+
isRecordSelectable?: (record: T, index: number) => boolean;
|
|
689
|
+
/**
|
|
690
|
+
* Props for the selection checkboxes, applied to header and all rows.
|
|
691
|
+
*/
|
|
692
|
+
selectionCheckboxProps?: CheckboxProps;
|
|
693
|
+
/**
|
|
694
|
+
* A function used to determine additional props of the row selection checkboxes.
|
|
695
|
+
* Accepts the current record and its index as arguments and returns an object.
|
|
696
|
+
*/
|
|
697
|
+
getRecordSelectionCheckboxProps?: (record: T, index: number) => CheckboxProps;
|
|
698
|
+
/**
|
|
699
|
+
* Additional props for the header checkbox that toggles selection of all records.
|
|
700
|
+
*/
|
|
701
|
+
allRecordsSelectionCheckboxProps?: CheckboxProps;
|
|
709
702
|
};
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
direction: 'asc' | 'desc';
|
|
703
|
+
export type DataTableSortStatus<T = Record<string, unknown>> = {
|
|
704
|
+
/**
|
|
705
|
+
* Sort column key for nested values.
|
|
706
|
+
* @type {string}
|
|
707
|
+
*/
|
|
708
|
+
sortKey?: string;
|
|
709
|
+
/**
|
|
710
|
+
* Sort column accessor.
|
|
711
|
+
* You can use dot-notation for nested objects property drilling
|
|
712
|
+
* (i.e. `department.name` or `department.company.name`).
|
|
713
|
+
*/
|
|
714
|
+
columnAccessor: keyof T | (string & NonNullable<unknown>);
|
|
715
|
+
/**
|
|
716
|
+
* Sort direction - `asc` for ascending, `desc` for descending.
|
|
717
|
+
*/
|
|
718
|
+
direction: "asc" | "desc";
|
|
727
719
|
};
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
onSortStatusChange?: never;
|
|
720
|
+
export type DataTableSortProps<T = Record<string, unknown>> = ({
|
|
721
|
+
sortStatus?: never;
|
|
722
|
+
onSortStatusChange?: never;
|
|
732
723
|
} | {
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
724
|
+
/**
|
|
725
|
+
* Current sort status (sort column accessor & direction).
|
|
726
|
+
*/
|
|
727
|
+
sortStatus: DataTableSortStatus<T>;
|
|
728
|
+
/**
|
|
729
|
+
* Callback fired after change of sort status.
|
|
730
|
+
* Receives the new sort status as argument.
|
|
731
|
+
*/
|
|
732
|
+
onSortStatusChange?: (sortStatus: DataTableSortStatus<T>) => void;
|
|
742
733
|
}) & {
|
|
734
|
+
/**
|
|
735
|
+
* Custom sort icons.
|
|
736
|
+
*/
|
|
737
|
+
sortIcons?: {
|
|
743
738
|
/**
|
|
744
|
-
*
|
|
745
|
-
|
|
746
|
-
sortIcons?: {
|
|
747
|
-
/**
|
|
748
|
-
* Icon to display when column is sorted ascending.
|
|
749
|
-
* Will be rotated 180deg for descending sort
|
|
750
|
-
*/
|
|
751
|
-
sorted: React.ReactNode;
|
|
752
|
-
/**
|
|
753
|
-
* Icon to display when column is not sorted.
|
|
754
|
-
*/
|
|
755
|
-
unsorted: React.ReactNode;
|
|
756
|
-
};
|
|
757
|
-
};
|
|
758
|
-
|
|
759
|
-
type DataTableVerticalAlign = 'top' | 'center' | 'bottom';
|
|
760
|
-
|
|
761
|
-
type DataTableProps<T = Record<string, unknown>> = {
|
|
762
|
-
/**
|
|
763
|
-
* Data table container class name.
|
|
739
|
+
* Icon to display when column is sorted ascending.
|
|
740
|
+
* Will be flipped vertically for descending sort
|
|
764
741
|
*/
|
|
765
|
-
|
|
742
|
+
sorted: React.ReactNode;
|
|
766
743
|
/**
|
|
767
|
-
*
|
|
768
|
-
* Either a style object or a function that accepts current theme and returns a style object.
|
|
744
|
+
* Icon to display when column is not sorted.
|
|
769
745
|
*/
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
* Data table elements class names.
|
|
773
|
-
* An object with `root`, `table`, `header`, `footer` and `pagination` keys and class names
|
|
774
|
-
* as values.
|
|
775
|
-
*/
|
|
776
|
-
classNames?: Partial<Record<'root' | 'table' | 'header' | 'footer' | 'pagination', string>>;
|
|
777
|
-
/**
|
|
778
|
-
* Data table elements styles.
|
|
779
|
-
* An object with `root`, `table`, `header`, `footer` and `pagination` keys and
|
|
780
|
-
* either style objects, or functions that accept current theme and return style objects, as values.
|
|
781
|
-
*/
|
|
782
|
-
styles?: StylesRecord<'root' | 'table' | 'header' | 'footer' | 'pagination', MantineStyleProp>;
|
|
783
|
-
/**
|
|
784
|
-
* Table height.
|
|
785
|
-
* @default '100%'
|
|
786
|
-
*/
|
|
787
|
-
height?: string | number;
|
|
788
|
-
/**
|
|
789
|
-
* Minimum table height.
|
|
790
|
-
*/
|
|
791
|
-
minHeight?: string | number;
|
|
792
|
-
/**
|
|
793
|
-
* Maximum table height.
|
|
794
|
-
*/
|
|
795
|
-
maxHeight?: string | number;
|
|
796
|
-
/**
|
|
797
|
-
* DataTable component shadow.
|
|
798
|
-
*/
|
|
799
|
-
shadow?: MantineShadow;
|
|
800
|
-
/**
|
|
801
|
-
* If true, the user will not be able to select text.
|
|
802
|
-
*/
|
|
803
|
-
textSelectionDisabled?: boolean;
|
|
804
|
-
/**
|
|
805
|
-
* Vertical alignment for row cells.
|
|
806
|
-
* @default `center`
|
|
807
|
-
*/
|
|
808
|
-
verticalAlign?: DataTableVerticalAlign;
|
|
809
|
-
/**
|
|
810
|
-
* If true, will show a loader with semi-transparent background, centered over the table.
|
|
811
|
-
*/
|
|
812
|
-
fetching?: boolean;
|
|
813
|
-
/**
|
|
814
|
-
* If true, the first column will be pinned to the left side of the table.
|
|
815
|
-
*/
|
|
816
|
-
pinFirstColumn?: boolean;
|
|
817
|
-
/**
|
|
818
|
-
* If true, the last column will be pinned to the right side of the table.
|
|
819
|
-
*/
|
|
820
|
-
pinLastColumn?: boolean;
|
|
821
|
-
/**
|
|
822
|
-
* Default column props; will be merged with column props provided to each column
|
|
823
|
-
*/
|
|
824
|
-
defaultColumnProps?: DataTableDefaultColumnProps<T>;
|
|
825
|
-
/**
|
|
826
|
-
* If you want to use drag and drop as well as toggle to reorder and toggle columns
|
|
827
|
-
* provide a unique key which will be used to store the column order in localStorage.
|
|
828
|
-
*/
|
|
829
|
-
storeColumnsKey?: string | undefined;
|
|
830
|
-
/**
|
|
831
|
-
* A default render function for all columns.
|
|
832
|
-
* Accepts the current record, its index in `records` and the column `accessor` as
|
|
833
|
-
* arguments and returns a React node (remember that a string is a valid React node too).
|
|
834
|
-
*/
|
|
835
|
-
defaultColumnRender?: (record: T, index: number, accessor: keyof T | (string & NonNullable<unknown>)) => React.ReactNode;
|
|
836
|
-
/**
|
|
837
|
-
* Accessor to use as unique record key.
|
|
838
|
-
* Can be a string representing a property name or a function receiving the current record
|
|
839
|
-
* and returning a unique value.
|
|
840
|
-
* If you're providing a string, you can use dot-notation for nested objects property drilling
|
|
841
|
-
* (i.e. `department.name` or `department.company.name`).
|
|
842
|
-
* @default `id`
|
|
843
|
-
*/
|
|
844
|
-
idAccessor?: (keyof T | (string & NonNullable<unknown>)) | ((record: T) => React.Key);
|
|
845
|
-
/**
|
|
846
|
-
* Visible records.
|
|
847
|
-
* The component will try to infer its row type from here.
|
|
848
|
-
*/
|
|
849
|
-
records?: T[];
|
|
850
|
-
/**
|
|
851
|
-
* Text to show on empty state and pagination footer when no records are available.
|
|
852
|
-
*/
|
|
853
|
-
noRecordsText?: string;
|
|
854
|
-
/**
|
|
855
|
-
* If true, the table will not show the header with column titles.
|
|
856
|
-
*/
|
|
857
|
-
noHeader?: boolean;
|
|
858
|
-
/**
|
|
859
|
-
* Function to call when a row cell is clicked.
|
|
860
|
-
* Receives an object with the current record, its index in `records`, the current column,
|
|
861
|
-
* its index in `columns` and the click event as properties.
|
|
862
|
-
*/
|
|
863
|
-
onCellClick?: DataTableCellClickHandler<T>;
|
|
864
|
-
/**
|
|
865
|
-
* Function to call when a row cell is double-clicked.
|
|
866
|
-
* Receives an object with the current record, its index in `records`, the current column,
|
|
867
|
-
* its index in `columns` and the click event as properties.
|
|
868
|
-
*/
|
|
869
|
-
onCellDoubleClick?: DataTableCellClickHandler<T>;
|
|
870
|
-
/**
|
|
871
|
-
* Function to call when the user right-clicks on a row cell.
|
|
872
|
-
* Receives an object with the current record, its index in `records`, the current column,
|
|
873
|
-
* its index in `columns` and the click event as properties.
|
|
874
|
-
*/
|
|
875
|
-
onCellContextMenu?: DataTableCellClickHandler<T>;
|
|
876
|
-
/**
|
|
877
|
-
* Function to call when a row is clicked.
|
|
878
|
-
* Receives an object with the current record, its index in `records` and the click event
|
|
879
|
-
* as properties.
|
|
880
|
-
*/
|
|
881
|
-
onRowClick?: DataTableRowClickHandler<T>;
|
|
882
|
-
/**
|
|
883
|
-
* Function to call when a row is double-clicked.
|
|
884
|
-
* Receives an object with the current record, its index in `records` and the click event
|
|
885
|
-
* as properties.
|
|
886
|
-
*/
|
|
887
|
-
onRowDoubleClick?: DataTableRowClickHandler<T>;
|
|
888
|
-
/**
|
|
889
|
-
* Function to call when the user right-clicks on a row.
|
|
890
|
-
* Receives an object with the current record, its index in `records` and the click event
|
|
891
|
-
* as properties.
|
|
892
|
-
*/
|
|
893
|
-
onRowContextMenu?: DataTableRowClickHandler<T>;
|
|
894
|
-
/**
|
|
895
|
-
* Defines the row expansion behavior.
|
|
896
|
-
*/
|
|
897
|
-
rowExpansion?: DataTableRowExpansionProps<T>;
|
|
898
|
-
/**
|
|
899
|
-
* Optional class name passed to each row.
|
|
900
|
-
* Can be a string or a function receiving the current record and its index as arguments and returning a string.
|
|
901
|
-
*/
|
|
902
|
-
rowClassName?: string | ((record: T, index: number) => string | undefined);
|
|
903
|
-
/**
|
|
904
|
-
* Optional style passed to each row.
|
|
905
|
-
* A function receiving the current record and its index as arguments and returning either
|
|
906
|
-
* a style object, or a function that accepts theme and returns a style object.
|
|
907
|
-
*/
|
|
908
|
-
rowStyle?: (record: T, index: number) => MantineStyleProp | undefined;
|
|
909
|
-
/**
|
|
910
|
-
* Optional style passed to each row.
|
|
911
|
-
* a function that receives the current record, its index, default row props and expanded element as arguments
|
|
912
|
-
* and returns a React node representing the row.
|
|
913
|
-
*/
|
|
914
|
-
rowFactory?: (props: {
|
|
915
|
-
record: T;
|
|
916
|
-
index: number;
|
|
917
|
-
children: React.ReactNode;
|
|
918
|
-
rowProps: TableTrProps;
|
|
919
|
-
expandedElement?: React.ReactNode;
|
|
920
|
-
}) => React.ReactNode;
|
|
921
|
-
/**
|
|
922
|
-
* Optional function returning a React node representing the table wrapper.
|
|
923
|
-
* If not provided, no wrapper will be used.
|
|
924
|
-
*
|
|
925
|
-
* examplle: This function can be used with rowFactory if using drag and drop to pass context
|
|
926
|
-
*/
|
|
927
|
-
tableWrapper?: ({ children }: {
|
|
928
|
-
children: React.ReactNode;
|
|
929
|
-
}) => React.ReactNode;
|
|
930
|
-
/**
|
|
931
|
-
* Optional function returning an object of custom attributes to be applied to each row in the table.
|
|
932
|
-
* Receives the current record and its index as arguments.
|
|
933
|
-
* Useful for adding data attributes, handling middle-clicks, etc.
|
|
934
|
-
*/
|
|
935
|
-
customRowAttributes?: (record: T, index: number) => Record<string, unknown>;
|
|
936
|
-
/**
|
|
937
|
-
* Ref pointing to the scrollable viewport element.
|
|
938
|
-
* Useful for imperative scrolling.
|
|
939
|
-
*/
|
|
940
|
-
scrollViewportRef?: React.RefObject<HTMLDivElement | null>;
|
|
941
|
-
/**
|
|
942
|
-
* Additional props passed to the underlying `ScrollArea` element.
|
|
943
|
-
*/
|
|
944
|
-
scrollAreaProps?: Omit<ScrollAreaProps, 'classNames' | 'styles' | 'onScrollPositionChange'>;
|
|
945
|
-
/**
|
|
946
|
-
* Ref pointing to the table element.
|
|
947
|
-
*/
|
|
948
|
-
tableRef?: ((instance: HTMLTableElement | null) => void) | React.RefObject<HTMLTableElement>;
|
|
949
|
-
/**
|
|
950
|
-
* Ref pointing to the table body element.
|
|
951
|
-
*/
|
|
952
|
-
bodyRef?: ((instance: HTMLTableSectionElement | null) => void) | React.RefObject<HTMLTableSectionElement>;
|
|
953
|
-
} & Omit<TableProps, 'onScroll' | 'className' | 'classNames' | 'style' | 'styles' | 'p' | 'px' | 'py' | 'pt' | 'pb' | 'layout' | 'captionSide' | 'c' | 'color' | 'borderColor' | 'stripedColor' | 'highlightOnHoverColor' | 'stickyHeader' | 'stickyHeaderOffset' | 'onDragEnd'> & DataTableColorProps<T> & DataTableColumnProps<T> & DataTableOuterBorderProps & DataTableLoaderProps & DataTableEmptyStateProps & DataTablePaginationProps & DataTableSortProps<T> & DataTableScrollProps & DataTableSelectionProps<T>;
|
|
954
|
-
|
|
955
|
-
type WithOptionalProperty<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
|
|
956
|
-
type WithRequiredProperty<Type, Key extends keyof Type> = Type & {
|
|
957
|
-
[Property in Key]-?: Type[Property];
|
|
746
|
+
unsorted: React.ReactNode;
|
|
747
|
+
};
|
|
958
748
|
};
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
749
|
+
export type DataTableVerticalAlign = "top" | "center" | "bottom";
|
|
750
|
+
export type DataTableProps<T = Record<string, unknown>> = {
|
|
751
|
+
/**
|
|
752
|
+
* Data table container class name.
|
|
753
|
+
*/
|
|
754
|
+
className?: string;
|
|
755
|
+
/**
|
|
756
|
+
* Data table container style.
|
|
757
|
+
* Either a style object or a function that accepts current theme and returns a style object.
|
|
758
|
+
*/
|
|
759
|
+
style?: MantineStyleProp;
|
|
760
|
+
/**
|
|
761
|
+
* Data table elements class names.
|
|
762
|
+
* An object with `root`, `table`, `header`, `footer` and `pagination` keys and class names
|
|
763
|
+
* as values.
|
|
764
|
+
*/
|
|
765
|
+
classNames?: Partial<Record<"root" | "table" | "header" | "footer" | "pagination", string>>;
|
|
766
|
+
/**
|
|
767
|
+
* Data table elements styles.
|
|
768
|
+
* An object with `root`, `table`, `header`, `footer` and `pagination` keys and
|
|
769
|
+
* either style objects, or functions that accept current theme and return style objects, as values.
|
|
770
|
+
*/
|
|
771
|
+
styles?: StylesRecord<"root" | "table" | "header" | "footer" | "pagination", MantineStyleProp>;
|
|
772
|
+
/**
|
|
773
|
+
* Table height.
|
|
774
|
+
* @default '100%'
|
|
775
|
+
*/
|
|
776
|
+
height?: string | number;
|
|
777
|
+
/**
|
|
778
|
+
* Minimum table height.
|
|
779
|
+
*/
|
|
780
|
+
minHeight?: string | number;
|
|
781
|
+
/**
|
|
782
|
+
* Maximum table height.
|
|
783
|
+
*/
|
|
784
|
+
maxHeight?: string | number;
|
|
785
|
+
/**
|
|
786
|
+
* DataTable component shadow.
|
|
787
|
+
*/
|
|
788
|
+
shadow?: MantineShadow;
|
|
789
|
+
/**
|
|
790
|
+
* If true, the user will not be able to select text.
|
|
791
|
+
*/
|
|
792
|
+
textSelectionDisabled?: boolean;
|
|
793
|
+
/**
|
|
794
|
+
* Vertical alignment for row cells.
|
|
795
|
+
* @default `center`
|
|
796
|
+
*/
|
|
797
|
+
verticalAlign?: DataTableVerticalAlign;
|
|
798
|
+
/**
|
|
799
|
+
* If true, will show a loader with semi-transparent background, centered over the table.
|
|
800
|
+
*/
|
|
801
|
+
fetching?: boolean;
|
|
802
|
+
/**
|
|
803
|
+
* If true, the first visible column will be pinned to the left side of the table (to the right side in RTL).
|
|
804
|
+
*/
|
|
805
|
+
pinFirstColumn?: boolean;
|
|
806
|
+
/**
|
|
807
|
+
* If true, the last visible column will be pinned to the right side of the table (to the left side in RTL).
|
|
808
|
+
*/
|
|
809
|
+
pinLastColumn?: boolean;
|
|
810
|
+
/**
|
|
811
|
+
* Default column props; will be merged with column props provided to each column
|
|
812
|
+
*/
|
|
813
|
+
defaultColumnProps?: DataTableDefaultColumnProps<T>;
|
|
814
|
+
/**
|
|
815
|
+
* Unique key used to persist the columns state (order, visibility, widths and pinning) in localStorage.
|
|
816
|
+
* Required if you want users' column dragging, toggling, resizing or pinning to survive page reloads.
|
|
817
|
+
*/
|
|
818
|
+
storeColumnsKey?: string | undefined;
|
|
819
|
+
/**
|
|
820
|
+
* A default render function for all columns.
|
|
821
|
+
* Accepts the current record, its index in `records` and the column `accessor` as
|
|
822
|
+
* arguments and returns a React node (remember that a string is a valid React node too).
|
|
823
|
+
*/
|
|
824
|
+
defaultColumnRender?: (record: T, index: number, accessor: keyof T | (string & NonNullable<unknown>)) => React.ReactNode;
|
|
825
|
+
/**
|
|
826
|
+
* Accessor to use as unique record key.
|
|
827
|
+
* Can be a string representing a property name or a function receiving the current record
|
|
828
|
+
* and returning a unique value.
|
|
829
|
+
* If you're providing a string, you can use dot-notation for nested objects property drilling
|
|
830
|
+
* (i.e. `department.name` or `department.company.name`).
|
|
831
|
+
* @default `id`
|
|
832
|
+
*/
|
|
833
|
+
idAccessor?: (keyof T | (string & NonNullable<unknown>)) | ((record: T) => React.Key);
|
|
834
|
+
/**
|
|
835
|
+
* Visible records.
|
|
836
|
+
* The component will try to infer its row type from here.
|
|
837
|
+
*/
|
|
838
|
+
records?: T[];
|
|
839
|
+
/**
|
|
840
|
+
* Text to show on empty state and pagination footer when no records are available.
|
|
841
|
+
*/
|
|
842
|
+
noRecordsText?: string;
|
|
843
|
+
/**
|
|
844
|
+
* If true, the table will not show the header with column titles.
|
|
845
|
+
*/
|
|
846
|
+
noHeader?: boolean;
|
|
847
|
+
/**
|
|
848
|
+
* Function to call when a row cell is clicked.
|
|
849
|
+
* Receives an object with the current record, its index in `records`, the current column,
|
|
850
|
+
* its index in `columns` and the click event as properties.
|
|
851
|
+
*/
|
|
852
|
+
onCellClick?: DataTableCellClickHandler<T>;
|
|
853
|
+
/**
|
|
854
|
+
* Function to call when a row cell is double-clicked.
|
|
855
|
+
* Receives an object with the current record, its index in `records`, the current column,
|
|
856
|
+
* its index in `columns` and the click event as properties.
|
|
857
|
+
*/
|
|
858
|
+
onCellDoubleClick?: DataTableCellClickHandler<T>;
|
|
859
|
+
/**
|
|
860
|
+
* Function to call when the user right-clicks on a row cell.
|
|
861
|
+
* Receives an object with the current record, its index in `records`, the current column,
|
|
862
|
+
* its index in `columns` and the click event as properties.
|
|
863
|
+
*/
|
|
864
|
+
onCellContextMenu?: DataTableCellClickHandler<T>;
|
|
865
|
+
/**
|
|
866
|
+
* Function to call when a row is clicked.
|
|
867
|
+
* Receives an object with the current record, its index in `records` and the click event
|
|
868
|
+
* as properties.
|
|
869
|
+
*/
|
|
870
|
+
onRowClick?: DataTableRowClickHandler<T>;
|
|
871
|
+
/**
|
|
872
|
+
* Function to call when a row is double-clicked.
|
|
873
|
+
* Receives an object with the current record, its index in `records` and the click event
|
|
874
|
+
* as properties.
|
|
875
|
+
*/
|
|
876
|
+
onRowDoubleClick?: DataTableRowClickHandler<T>;
|
|
877
|
+
/**
|
|
878
|
+
* Function to call when the user right-clicks on a row.
|
|
879
|
+
* Receives an object with the current record, its index in `records` and the click event
|
|
880
|
+
* as properties.
|
|
881
|
+
*/
|
|
882
|
+
onRowContextMenu?: DataTableRowClickHandler<T>;
|
|
883
|
+
/**
|
|
884
|
+
* Defines the row expansion behavior.
|
|
885
|
+
*/
|
|
886
|
+
rowExpansion?: DataTableRowExpansionProps<T>;
|
|
887
|
+
/**
|
|
888
|
+
* Optional class name passed to each row.
|
|
889
|
+
* Can be a string or a function receiving the current record and its index as arguments and returning a string.
|
|
890
|
+
*/
|
|
891
|
+
rowClassName?: string | ((record: T, index: number) => string | undefined);
|
|
892
|
+
/**
|
|
893
|
+
* Optional style passed to each row.
|
|
894
|
+
* A function receiving the current record and its index as arguments and returning either
|
|
895
|
+
* a style object, or a function that accepts theme and returns a style object.
|
|
896
|
+
*/
|
|
897
|
+
rowStyle?: (record: T, index: number) => MantineStyleProp | undefined;
|
|
898
|
+
/**
|
|
899
|
+
* Optional function rendering a custom row.
|
|
900
|
+
* Receives the current record, its index, the default row props, the row cells (`children`)
|
|
901
|
+
* and the expanded element as arguments, and returns a React node representing the row.
|
|
902
|
+
*/
|
|
903
|
+
rowFactory?: (props: {
|
|
904
|
+
record: T;
|
|
905
|
+
index: number;
|
|
906
|
+
children: React.ReactNode;
|
|
907
|
+
rowProps: TableTrProps;
|
|
908
|
+
expandedElement?: React.ReactNode;
|
|
909
|
+
}) => React.ReactNode;
|
|
910
|
+
/**
|
|
911
|
+
* Optional function returning a React node representing the table wrapper.
|
|
912
|
+
* If not provided, no wrapper will be used.
|
|
913
|
+
*
|
|
914
|
+
* For example, it can be used together with `rowFactory` to provide a drag-and-drop context.
|
|
915
|
+
*/
|
|
916
|
+
tableWrapper?: ({ children }: {
|
|
917
|
+
children: React.ReactNode;
|
|
918
|
+
}) => React.ReactNode;
|
|
919
|
+
/**
|
|
920
|
+
* Optional function returning an object of custom attributes to be applied to each row in the table.
|
|
921
|
+
* Receives the current record and its index as arguments.
|
|
922
|
+
* Useful for adding data attributes, handling middle-clicks, etc.
|
|
923
|
+
*/
|
|
924
|
+
customRowAttributes?: (record: T, index: number) => Record<string, unknown>;
|
|
925
|
+
/**
|
|
926
|
+
* Ref pointing to the scrollable viewport element.
|
|
927
|
+
* Useful for imperative scrolling.
|
|
928
|
+
*/
|
|
929
|
+
scrollViewportRef?: React.RefObject<HTMLDivElement | null>;
|
|
930
|
+
/**
|
|
931
|
+
* Additional props passed to the underlying `ScrollArea` element.
|
|
932
|
+
*/
|
|
933
|
+
scrollAreaProps?: Omit<ScrollAreaProps, "classNames" | "styles" | "onScrollPositionChange">;
|
|
934
|
+
/**
|
|
935
|
+
* Ref pointing to the table element.
|
|
936
|
+
*/
|
|
937
|
+
tableRef?: ((instance: HTMLTableElement | null) => void) | React.RefObject<HTMLTableElement>;
|
|
938
|
+
/**
|
|
939
|
+
* Ref pointing to the table body element.
|
|
940
|
+
*/
|
|
941
|
+
bodyRef?: ((instance: HTMLTableSectionElement | null) => void) | React.RefObject<HTMLTableSectionElement>;
|
|
942
|
+
} & Omit<TableProps, "onScroll" | "className" | "classNames" | "style" | "styles" | "p" | "px" | "py" | "pt" | "pb" | "layout" | "captionSide" | "c" | "color" | "borderColor" | "stripedColor" | "highlightOnHoverColor" | "stickyHeader" | "stickyHeaderOffset" | "onDragEnd"> & DataTableColorProps<T> & DataTableColumnProps<T> & DataTableOuterBorderProps & DataTableLoaderProps & DataTableEmptyStateProps & DataTablePaginationProps & DataTableSortProps<T> & DataTableScrollProps & DataTableSelectionProps<T>;
|
|
943
|
+
export type WithOptionalProperty<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
|
|
944
|
+
export type WithRequiredProperty<Type, Key extends keyof Type> = Type & { [Property in Key]-?: Type[Property]; };
|
|
945
|
+
export declare function DataTable<T>({ withTableBorder, borderRadius, textSelectionDisabled, height, minHeight, maxHeight, shadow, verticalAlign, fetching, columns, storeColumnsKey, groups, pinFirstColumn, pinLastColumn, defaultColumnProps, defaultColumnRender, idAccessor, records, selectionTrigger, selectedRecords, onSelectedRecordsChange, selectionColumnClassName, selectionColumnStyle, isRecordSelectable, selectionCheckboxProps, allRecordsSelectionCheckboxProps, getRecordSelectionCheckboxProps, sortStatus, sortIcons, onSortStatusChange, horizontalSpacing, page, onPageChange, totalRecords, recordsPerPage, onRecordsPerPageChange, recordsPerPageOptions, recordsPerPageLabel, paginationWithEdges, paginationWithControls, paginationActiveTextColor, paginationActiveBackgroundColor, paginationSize, paginationText, paginationWrapBreakpoint, getPaginationControlProps, getPaginationItemProps, renderPagination, loaderBackgroundBlur, customLoader, loaderSize, loaderType, loaderColor, loadingText, emptyState, noRecordsText, noRecordsIcon, highlightOnHover, striped, noHeader, onRowClick, onRowDoubleClick, onRowContextMenu, onCellClick, onCellDoubleClick, onCellContextMenu, onScroll, onScrollToTop, onScrollToBottom, onScrollToLeft, onScrollToRight, c, backgroundColor, borderColor, rowBorderColor, stripedColor, highlightOnHoverColor, selectionColor, rowColor, rowBackgroundColor, rowExpansion, rowClassName, rowStyle, customRowAttributes, scrollViewportRef, scrollAreaProps, tableRef, bodyRef, m, my, mx, mt, mb, ml, mr, className, classNames, style, styles, rowFactory, tableWrapper, ...otherProps }: DataTableProps<T>): JSX.Element;
|
|
946
|
+
export declare function DataTableDraggableRow({ className, children, isDragging, ref: refProp, ...otherProps }: DataTableDraggableRowProps & {
|
|
947
|
+
ref?: Ref<HTMLTableRowElement>;
|
|
948
|
+
}): JSX.Element;
|
|
966
949
|
type DataTableColumnPinning = {
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
950
|
+
accessor: string;
|
|
951
|
+
defaultPinned: "left" | "right" | undefined;
|
|
952
|
+
pinnable: boolean;
|
|
953
|
+
pinned: "left" | "right" | undefined;
|
|
971
954
|
};
|
|
972
|
-
|
|
973
955
|
type DataTableColumnToggle = {
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
956
|
+
accessor: string;
|
|
957
|
+
defaultToggle: boolean;
|
|
958
|
+
toggleable: boolean;
|
|
959
|
+
toggled: boolean;
|
|
978
960
|
};
|
|
979
|
-
|
|
980
961
|
/**
|
|
981
962
|
* Hook to handle column features such as drag-and-drop reordering, visibility toggling and resizing.
|
|
982
963
|
* @see https://icflorescu.github.io/mantine-datatable/examples/column-dragging-and-toggling/
|
|
983
964
|
*/
|
|
984
|
-
declare const useDataTableColumns: <T>({ key, columns, getInitialValueInEffect, headerRef, scrollViewportRef
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
965
|
+
export declare const useDataTableColumns: <T>({ key, columns, getInitialValueInEffect, headerRef, scrollViewportRef }: {
|
|
966
|
+
/**
|
|
967
|
+
* The key to use in localStorage to store the columns order and toggle state.
|
|
968
|
+
*/
|
|
969
|
+
key: string | undefined;
|
|
970
|
+
/**
|
|
971
|
+
* Columns definitions.
|
|
972
|
+
*/
|
|
973
|
+
columns: DataTableColumn<T>[];
|
|
974
|
+
/**
|
|
975
|
+
* If set to true, value will be updated in useEffect after mount.
|
|
976
|
+
* @default true
|
|
977
|
+
*/
|
|
978
|
+
getInitialValueInEffect?: boolean;
|
|
979
|
+
/**
|
|
980
|
+
* Reference to the table header element for measuring column widths.
|
|
981
|
+
*/
|
|
982
|
+
headerRef?: RefObject<HTMLTableSectionElement | null>;
|
|
983
|
+
/**
|
|
984
|
+
* Reference to the scroll viewport for calculating overflow.
|
|
985
|
+
*/
|
|
986
|
+
scrollViewportRef?: RefObject<HTMLElement | null>;
|
|
1006
987
|
}) => {
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
readonly beginResize: () => void;
|
|
1037
|
-
readonly endResize: () => void;
|
|
988
|
+
readonly effectiveColumns: DataTableColumn<T>[];
|
|
989
|
+
readonly setColumnsOrder: (order: string[]) => void;
|
|
990
|
+
readonly columnsOrder: string[];
|
|
991
|
+
readonly resetColumnsOrder: () => void;
|
|
992
|
+
readonly columnsToggle: DataTableColumnToggle[];
|
|
993
|
+
readonly setColumnsToggle: (toggle: DataTableColumnToggle[]) => void;
|
|
994
|
+
readonly resetColumnsToggle: () => void;
|
|
995
|
+
readonly columnsPinning: DataTableColumnPinning[];
|
|
996
|
+
readonly setColumnsPinning: (pinning: DataTableColumnPinning[] | ((prev: DataTableColumnPinning[]) => DataTableColumnPinning[])) => void;
|
|
997
|
+
readonly resetColumnsPinning: () => void;
|
|
998
|
+
readonly columnsWidth: Record<string, string | number>[];
|
|
999
|
+
readonly setColumnsWidth: (updates: {
|
|
1000
|
+
accessor: string;
|
|
1001
|
+
width: string | number;
|
|
1002
|
+
}[]) => void;
|
|
1003
|
+
readonly setColumnWidth: (accessor: string, width: string | number) => void;
|
|
1004
|
+
readonly setMultipleColumnWidths: (updates: {
|
|
1005
|
+
accessor: string;
|
|
1006
|
+
width: string | number;
|
|
1007
|
+
}[]) => void;
|
|
1008
|
+
readonly resetColumnsWidth: () => void;
|
|
1009
|
+
readonly hasResizableColumns: boolean;
|
|
1010
|
+
readonly allResizableWidthsInitial: boolean;
|
|
1011
|
+
readonly measureAndSetColumnWidths: () => void;
|
|
1012
|
+
readonly isResizing: boolean;
|
|
1013
|
+
readonly isLocked: boolean;
|
|
1014
|
+
readonly tableWidth: number | null;
|
|
1015
|
+
readonly beginResize: () => void;
|
|
1016
|
+
readonly endResize: () => void;
|
|
1038
1017
|
};
|
|
1039
|
-
|
|
1040
1018
|
/**
|
|
1041
1019
|
* Utility function that returns a humanized version of a string, e.g. "camelCase" -> "Camel Case"
|
|
1042
1020
|
*/
|
|
1043
|
-
declare function humanize(value: string): string;
|
|
1021
|
+
export declare function humanize(value: string): string;
|
|
1044
1022
|
/**
|
|
1045
1023
|
* Sanitizes a value read from `localStorage` before the column hooks call array
|
|
1046
1024
|
* methods on it.
|
|
@@ -1056,57 +1034,56 @@ declare function humanize(value: string): string;
|
|
|
1056
1034
|
* Returns `value` when it is an array whose items all pass the optional
|
|
1057
1035
|
* `isValidItem` predicate; otherwise returns `fallback`.
|
|
1058
1036
|
*/
|
|
1059
|
-
declare function sanitizeStoredArray<T>(value: unknown, fallback: T[], isValidItem?: (item: unknown) => boolean): T[];
|
|
1037
|
+
export declare function sanitizeStoredArray<T>(value: unknown, fallback: T[], isValidItem?: (item: unknown) => boolean): T[];
|
|
1060
1038
|
/**
|
|
1061
1039
|
* Predicate matching the `{ accessor: string, ... }` shape persisted for column
|
|
1062
1040
|
* toggle and pinning state.
|
|
1063
1041
|
*/
|
|
1064
|
-
declare function hasStringAccessor(item: unknown): boolean;
|
|
1042
|
+
export declare function hasStringAccessor(item: unknown): boolean;
|
|
1065
1043
|
/**
|
|
1066
1044
|
* Utility function that returns an array of values that are present in the first array but not in the second
|
|
1067
1045
|
*/
|
|
1068
|
-
declare function differenceBy<T>(arr1: T[], arr2: T[], iteratee: (value: T) => unknown): T[];
|
|
1046
|
+
export declare function differenceBy<T>(arr1: T[], arr2: T[], iteratee: (value: T) => unknown): T[];
|
|
1069
1047
|
/**
|
|
1070
1048
|
* Utility function that returns an array of unique values from a given array
|
|
1071
1049
|
*/
|
|
1072
|
-
declare function uniqBy<T>(arr: T[], iteratee: (value: T) => unknown): T[];
|
|
1050
|
+
export declare function uniqBy<T>(arr: T[], iteratee: (value: T) => unknown): T[];
|
|
1073
1051
|
/**
|
|
1074
1052
|
* Utility function that returns the value at a given path in an object
|
|
1075
1053
|
*/
|
|
1076
|
-
declare function getValueAtPath<T>(obj: T, path: keyof T | (string & NonNullable<unknown>)): unknown;
|
|
1054
|
+
export declare function getValueAtPath<T>(obj: T, path: keyof T | (string & NonNullable<unknown>)): unknown;
|
|
1077
1055
|
/**
|
|
1078
1056
|
* Utility function that returns the record id using idAccessor
|
|
1079
1057
|
*/
|
|
1080
|
-
declare function getRecordId<T>(record: T, idAccessor: keyof T | (string & NonNullable<unknown>) | ((record: T) => React.Key)): unknown;
|
|
1058
|
+
export declare function getRecordId<T>(record: T, idAccessor: keyof T | (string & NonNullable<unknown>) | ((record: T) => React.Key)): unknown;
|
|
1081
1059
|
/**
|
|
1082
1060
|
* Utility function that reorders an array of records by a given field used for drag'n'drop functionality.
|
|
1083
1061
|
* @see https://github.com/hello-pangea/dnd
|
|
1084
1062
|
*/
|
|
1085
|
-
declare function reorderRecords<T>(dropResult: DropResult, records: T[]): T[];
|
|
1063
|
+
export declare function reorderRecords<T>(dropResult: DropResult, records: T[]): T[];
|
|
1086
1064
|
/**
|
|
1087
1065
|
* Utility function that swaps elements of an array, by a given result from drag'n'drop functionality.
|
|
1088
1066
|
* @see https://github.com/hello-pangea/dnd
|
|
1089
1067
|
*/
|
|
1090
|
-
declare function swapRecords<T>(dropResult: DropResult, records: T[]): T[];
|
|
1068
|
+
export declare function swapRecords<T>(dropResult: DropResult, records: T[]): T[];
|
|
1091
1069
|
/**
|
|
1092
1070
|
* Calculates the maximum depth of nested column groups
|
|
1093
1071
|
*/
|
|
1094
|
-
declare function getMaxGroupDepth<T>(groups: readonly DataTableColumnGroup<T>[]): number;
|
|
1072
|
+
export declare function getMaxGroupDepth<T>(groups: readonly DataTableColumnGroup<T>[]): number;
|
|
1095
1073
|
/**
|
|
1096
1074
|
* Flattens nested column groups to extract all columns at the deepest level
|
|
1097
1075
|
*/
|
|
1098
|
-
declare function flattenColumns<T>(groups: DataTableColumnGroup<T>[]): DataTableColumn<T>[];
|
|
1076
|
+
export declare function flattenColumns<T>(groups: DataTableColumnGroup<T>[]): DataTableColumn<T>[];
|
|
1099
1077
|
/**
|
|
1100
1078
|
* Calculates the column span for a group based on visible columns
|
|
1101
1079
|
*/
|
|
1102
|
-
declare function calculateColSpan<T>(group: DataTableColumnGroup<T>, visibles?: (boolean | undefined)[]): number;
|
|
1080
|
+
export declare function calculateColSpan<T>(group: DataTableColumnGroup<T>, visibles?: (boolean | undefined)[]): number;
|
|
1103
1081
|
/**
|
|
1104
1082
|
* Gets all groups at a specific depth level
|
|
1105
1083
|
*/
|
|
1106
|
-
declare function getGroupsAtDepth<T>(groups: readonly DataTableColumnGroup<T>[], targetDepth: number, currentDepth?: number): DataTableColumnGroup<T>[];
|
|
1084
|
+
export declare function getGroupsAtDepth<T>(groups: readonly DataTableColumnGroup<T>[], targetDepth: number, currentDepth?: number): DataTableColumnGroup<T>[];
|
|
1107
1085
|
/**
|
|
1108
1086
|
* Checks if a group needs a right border based on its position and context
|
|
1109
1087
|
*/
|
|
1110
|
-
declare function needsRightBorder(isLastGroup: boolean, hasMoreColumnsAfter: boolean, withColumnBorders: boolean): boolean;
|
|
1111
|
-
|
|
1112
|
-
export { DataTable, type DataTableCellClickHandler, type DataTableColumn, type DataTableColumnGroup, type DataTableColumnPinning, type DataTableColumnTextAlign, type DataTableColumnToggle, type DataTableDefaultColumnProps, DataTableDraggableRow, type DataTableDraggableRowProps, type DataTableEmptyStateProps, type DataTableOuterBorderProps, type DataTablePaginationProps, type DataTablePaginationRenderContext, type DataTableProps, type DataTableRowClickHandler, type DataTableRowExpansionCollapseProps, type DataTableRowExpansionProps, type DataTableSelectionProps, type DataTableSelectionTrigger, type DataTableSortProps, type DataTableSortStatus, type DataTableVerticalAlign, type WithOptionalProperty, type WithRequiredProperty, calculateColSpan, differenceBy, flattenColumns, getGroupsAtDepth, getMaxGroupDepth, getRecordId, getValueAtPath, hasStringAccessor, humanize, needsRightBorder, reorderRecords, sanitizeStoredArray, swapRecords, uniqBy, useDataTableColumns };
|
|
1088
|
+
export declare function needsRightBorder(isLastGroup: boolean, hasMoreColumnsAfter: boolean, withColumnBorders: boolean): boolean;
|
|
1089
|
+
export type { DataTableColumnPinning, DataTableColumnToggle };
|