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