@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.
@@ -0,0 +1,1195 @@
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;
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;
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;
185
+ });
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;
209
+ }) => void;
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;
246
+ };
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;
261
+ } & TableTrProps;
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;
272
+ } | {
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;
280
+ };
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;
289
+ } | {
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;
298
+ };
299
+ //#endregion
300
+ //#region package/types/DataTablePageSizeSelectorProps.d.ts
301
+ type DataTablePageSizeSelectorProps = {
302
+ onRecordsPerPageChange?: never;
303
+ recordsPerPageOptions?: never;
304
+ recordsPerPageLabel?: never;
305
+ } | {
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;
319
+ };
320
+ //#endregion
321
+ //#region package/types/DataTablePaginationRenderContext.d.ts
322
+ export type DataTablePaginationRenderContext = {
323
+ state: {
324
+ paginationSize: MantineSize;
325
+ page: number;
326
+ totalPages: number;
327
+ totalRecords: number | undefined;
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;
448
+ }) & DataTablePageSizeSelectorProps;
449
+ //#endregion
450
+ //#region package/types/DataTableColorProps.d.ts
451
+ type DataTableColorProps<T> = {
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
+ };
526
+ };
527
+ //#endregion
528
+ //#region package/types/DataTableColumnProps.d.ts
529
+ type DataTableColumnProps<T = Record<string, unknown>> = {
530
+ /**
531
+ * Grouped columns.
532
+ */
533
+ groups: DataTableColumnGroup<T>[];
534
+ columns?: never;
535
+ } | {
536
+ groups?: never;
537
+ /**
538
+ * Visible columns.
539
+ */
540
+ columns: DataTableColumn<T>[];
541
+ };
542
+ //#endregion
543
+ //#region package/types/DataTableLoaderProps.d.ts
544
+ type DataTableLoaderProps = {
545
+ /**
546
+ * Loader background blur (in pixels).
547
+ */
548
+ loaderBackgroundBlur?: number;
549
+ } & ({
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;
557
+ } | {
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;
572
+ });
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: {
601
+ record: T;
602
+ index: number;
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;
652
+ };
653
+ //#endregion
654
+ //#region package/types/DataTableScrollProps.d.ts
655
+ type DataTableScrollProps = {
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;
679
+ };
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;
695
+ } | {
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;
737
+ };
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';
756
+ };
757
+ //#endregion
758
+ //#region package/types/DataTableSortProps.d.ts
759
+ export type DataTableSortProps<T = Record<string, unknown>> = ({
760
+ sortStatus?: never;
761
+ onSortStatusChange?: never;
762
+ } | {
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;
772
+ }) & {
773
+ /**
774
+ * Custom sort icons.
775
+ */
776
+ sortIcons?: {
777
+ /**
778
+ * Icon to display when column is sorted ascending.
779
+ * Will be rotated 180deg for descending sort
780
+ */
781
+ sorted: React.ReactNode;
782
+ /**
783
+ * Icon to display when column is not sorted.
784
+ */
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>;
828
+ };
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
1043
+ type DataTableColumnPinning = {
1044
+ accessor: string;
1045
+ defaultPinned: 'left' | 'right' | undefined;
1046
+ pinnable: boolean;
1047
+ pinned: 'left' | 'right' | undefined;
1048
+ };
1049
+ //#endregion
1050
+ //#region package/hooks/useDataTableColumnToggle.d.ts
1051
+ type DataTableColumnToggle = {
1052
+ accessor: string;
1053
+ defaultToggle: boolean;
1054
+ toggleable: boolean;
1055
+ toggled: boolean;
1056
+ };
1057
+ //#endregion
1058
+ //#region package/hooks/useDataTableColumns.d.ts
1059
+ /**
1060
+ * Hook to handle column features such as drag-and-drop reordering, visibility toggling and resizing.
1061
+ * @see https://documatrix.github.io/mantine-datatable/examples/column-dragging-and-toggling/
1062
+ */
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>;
1085
+ }) => {
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;
1117
+ };
1118
+ //#endregion
1119
+ //#region package/utils.d.ts
1120
+ /**
1121
+ * Utility function that returns a humanized version of a string, e.g. "camelCase" -> "Camel Case"
1122
+ */
1123
+ export declare function humanize(value: string): string;
1124
+ /**
1125
+ * Sanitizes a value read from `localStorage` before the column hooks call array
1126
+ * methods on it.
1127
+ *
1128
+ * Persisted column state is synchronized across browser tabs through the native
1129
+ * `storage` event (e.g. when a tab is duplicated). A malformed or unexpected
1130
+ * value — written by another tab, by a different DataTable instance sharing the
1131
+ * same `storeColumnsKey`, or by manual tampering — is delivered verbatim to
1132
+ * every listening table. Without this guard such a value flows straight into
1133
+ * `.map()` / `.forEach()` and crashes the app with
1134
+ * `TypeError: <x>.map is not a function`.
1135
+ *
1136
+ * Returns `value` when it is an array whose items all pass the optional
1137
+ * `isValidItem` predicate; otherwise returns `fallback`.
1138
+ */
1139
+ export declare function sanitizeStoredArray<T>(value: unknown, fallback: T[], isValidItem?: (item: unknown) => boolean): T[];
1140
+ /**
1141
+ * Predicate matching the `{ accessor: string, ... }` shape persisted for column
1142
+ * toggle and pinning state.
1143
+ */
1144
+ export declare function hasStringAccessor(item: unknown): boolean;
1145
+ /**
1146
+ * Utility function that returns an array of values that are present in the first array but not in the second
1147
+ */
1148
+ export declare function differenceBy<T>(arr1: T[], arr2: T[], iteratee: (value: T) => unknown): T[];
1149
+ /**
1150
+ * Utility function that returns an array of unique values from a given array
1151
+ */
1152
+ export declare function uniqBy<T>(arr: T[], iteratee: (value: T) => unknown): T[];
1153
+ /**
1154
+ * Utility function that returns the value at a given path in an object
1155
+ */
1156
+ export declare function getValueAtPath<T>(obj: T, path: keyof T | (string & NonNullable<unknown>)): unknown;
1157
+ /**
1158
+ * Utility function that returns the record id using idAccessor
1159
+ */
1160
+ export declare function getRecordId<T>(record: T, idAccessor: DataTableIdAccessor<T>): unknown;
1161
+ /**
1162
+ * Utility function that reorders an array of records by a given field used for drag'n'drop functionality.
1163
+ * @see https://github.com/hello-pangea/dnd
1164
+ */
1165
+ export declare function reorderRecords<T>(dropResult: DropResult, records: T[]): T[];
1166
+ /**
1167
+ * Utility function that swaps elements of an array, by a given result from drag'n'drop functionality.
1168
+ * @see https://github.com/hello-pangea/dnd
1169
+ */
1170
+ export declare function swapRecords<T>(dropResult: DropResult, records: T[]): T[];
1171
+ /**
1172
+ * Calculates the maximum depth of nested column groups
1173
+ */
1174
+ export declare function getMaxGroupDepth<T>(groups: readonly DataTableColumnGroup<T>[]): number;
1175
+ /**
1176
+ * Flattens nested column groups to extract all columns at the deepest level
1177
+ */
1178
+ export declare function flattenColumns<T>(groups: DataTableColumnGroup<T>[]): DataTableColumn<T>[];
1179
+ /**
1180
+ * Calculates the column span for a group based on visible columns
1181
+ */
1182
+ export declare function calculateColSpan<T>(group: DataTableColumnGroup<T>, visibles?: (boolean | undefined)[]): number;
1183
+ /**
1184
+ * Gets all groups at a specific depth level
1185
+ */
1186
+ export declare function getGroupsAtDepth<T>(groups: readonly DataTableColumnGroup<T>[], targetDepth: number, currentDepth?: number): DataTableColumnGroup<T>[];
1187
+ /**
1188
+ * Checks if a group needs a right border based on its position and context
1189
+ */
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.mts.map