material-react-table 3.0.0-beta.1 → 3.0.0-beta.2
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/dist/index.d.ts +87 -87
- package/dist/index.esm.js +79 -42
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +79 -42
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/body/MRT_TableBodyCell.tsx +9 -11
- package/src/components/footer/MRT_TableFooterCell.tsx +8 -9
- package/src/components/head/MRT_TableHeadCell.tsx +10 -11
- package/src/hooks/useMRT_TableOptions.ts +2 -2
- package/src/types.ts +66 -66
- package/src/utils/cell.utils.ts +57 -11
package/dist/index.d.ts
CHANGED
@@ -313,9 +313,10 @@ interface MRT_Localization {
|
|
313
313
|
filterFuzzy: string;
|
314
314
|
filterGreaterThan: string;
|
315
315
|
filterGreaterThanOrEqualTo: string;
|
316
|
-
filterInNumberRange: string;
|
317
316
|
filterIncludesString: string;
|
318
317
|
filterIncludesStringSensitive: string;
|
318
|
+
filteringByColumn: string;
|
319
|
+
filterInNumberRange: string;
|
319
320
|
filterLessThan: string;
|
320
321
|
filterLessThanOrEqualTo: string;
|
321
322
|
filterMode: string;
|
@@ -323,7 +324,6 @@ interface MRT_Localization {
|
|
323
324
|
filterNotEquals: string;
|
324
325
|
filterStartsWith: string;
|
325
326
|
filterWeakEquals: string;
|
326
|
-
filteringByColumn: string;
|
327
327
|
goToFirstPage: string;
|
328
328
|
goToLastPage: string;
|
329
329
|
goToNextPage: string;
|
@@ -474,6 +474,22 @@ interface MRT_TableState<TData extends MRT_RowData> extends TableState {
|
|
474
474
|
showToolbarDropZone: boolean;
|
475
475
|
}
|
476
476
|
interface MRT_ColumnDef<TData extends MRT_RowData, TValue = unknown> extends Omit<ColumnDef<TData, TValue>, 'accessorKey' | 'aggregatedCell' | 'aggregationFn' | 'cell' | 'columns' | 'filterFn' | 'footer' | 'header' | 'id' | 'sortingFn'> {
|
477
|
+
/**
|
478
|
+
* Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
|
479
|
+
* Specify a function here to point to the correct property in the data object.
|
480
|
+
*
|
481
|
+
* @example accessorFn: (row) => row.username
|
482
|
+
*/
|
483
|
+
accessorFn?: (originalRow: TData) => TValue;
|
484
|
+
/**
|
485
|
+
* Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
|
486
|
+
* Specify which key in the row this column should use to access the correct data.
|
487
|
+
* Also supports Deep Key Dot Notation.
|
488
|
+
*
|
489
|
+
* @example accessorKey: 'username' //simple
|
490
|
+
* @example accessorKey: 'name.firstName' //deep key dot notation
|
491
|
+
*/
|
492
|
+
accessorKey?: DeepKeys<TData> | (string & {});
|
477
493
|
AggregatedCell?: (props: {
|
478
494
|
cell: MRT_Cell<TData, TValue>;
|
479
495
|
column: MRT_Column<TData, TValue>;
|
@@ -482,6 +498,7 @@ interface MRT_ColumnDef<TData extends MRT_RowData, TValue = unknown> extends Omi
|
|
482
498
|
staticColumnIndex?: number;
|
483
499
|
staticRowIndex?: number;
|
484
500
|
}) => ReactNode;
|
501
|
+
aggregationFn?: Array<MRT_AggregationFn<TData>> | MRT_AggregationFn<TData>;
|
485
502
|
Cell?: (props: {
|
486
503
|
cell: MRT_Cell<TData, TValue>;
|
487
504
|
column: MRT_Column<TData, TValue>;
|
@@ -492,59 +509,6 @@ interface MRT_ColumnDef<TData extends MRT_RowData, TValue = unknown> extends Omi
|
|
492
509
|
staticRowIndex?: number;
|
493
510
|
table: MRT_TableInstance<TData>;
|
494
511
|
}) => ReactNode;
|
495
|
-
Edit?: (props: {
|
496
|
-
cell: MRT_Cell<TData, TValue>;
|
497
|
-
column: MRT_Column<TData, TValue>;
|
498
|
-
row: MRT_Row<TData>;
|
499
|
-
table: MRT_TableInstance<TData>;
|
500
|
-
}) => ReactNode;
|
501
|
-
Filter?: (props: {
|
502
|
-
column: MRT_Column<TData, TValue>;
|
503
|
-
header: MRT_Header<TData>;
|
504
|
-
rangeFilterIndex?: number;
|
505
|
-
table: MRT_TableInstance<TData>;
|
506
|
-
}) => ReactNode;
|
507
|
-
Footer?: ((props: {
|
508
|
-
column: MRT_Column<TData, TValue>;
|
509
|
-
footer: MRT_Header<TData>;
|
510
|
-
table: MRT_TableInstance<TData>;
|
511
|
-
}) => ReactNode) | ReactNode;
|
512
|
-
GroupedCell?: (props: {
|
513
|
-
cell: MRT_Cell<TData, TValue>;
|
514
|
-
column: MRT_Column<TData, TValue>;
|
515
|
-
row: MRT_Row<TData>;
|
516
|
-
table: MRT_TableInstance<TData>;
|
517
|
-
staticColumnIndex?: number;
|
518
|
-
staticRowIndex?: number;
|
519
|
-
}) => ReactNode;
|
520
|
-
Header?: ((props: {
|
521
|
-
column: MRT_Column<TData, TValue>;
|
522
|
-
header: MRT_Header<TData>;
|
523
|
-
table: MRT_TableInstance<TData>;
|
524
|
-
}) => ReactNode) | ReactNode;
|
525
|
-
PlaceholderCell?: (props: {
|
526
|
-
cell: MRT_Cell<TData, TValue>;
|
527
|
-
column: MRT_Column<TData, TValue>;
|
528
|
-
row: MRT_Row<TData>;
|
529
|
-
table: MRT_TableInstance<TData>;
|
530
|
-
}) => ReactNode;
|
531
|
-
/**
|
532
|
-
* Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
|
533
|
-
* Specify a function here to point to the correct property in the data object.
|
534
|
-
*
|
535
|
-
* @example accessorFn: (row) => row.username
|
536
|
-
*/
|
537
|
-
accessorFn?: (originalRow: TData) => TValue;
|
538
|
-
/**
|
539
|
-
* Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
|
540
|
-
* Specify which key in the row this column should use to access the correct data.
|
541
|
-
* Also supports Deep Key Dot Notation.
|
542
|
-
*
|
543
|
-
* @example accessorKey: 'username' //simple
|
544
|
-
* @example accessorKey: 'name.firstName' //deep key dot notation
|
545
|
-
*/
|
546
|
-
accessorKey?: DeepKeys<TData> | (string & {});
|
547
|
-
aggregationFn?: Array<MRT_AggregationFn<TData>> | MRT_AggregationFn<TData>;
|
548
512
|
/**
|
549
513
|
* Specify what type of column this is. Either `data`, `display`, or `group`. Defaults to `data`.
|
550
514
|
* Leave this blank if you are just creating a normal data column.
|
@@ -556,6 +520,12 @@ interface MRT_ColumnDef<TData extends MRT_RowData, TValue = unknown> extends Omi
|
|
556
520
|
columnDefType?: 'data' | 'display' | 'group';
|
557
521
|
columnFilterModeOptions?: Array<LiteralUnion<string & MRT_FilterOption>> | null;
|
558
522
|
columns?: MRT_ColumnDef<TData, TValue>[];
|
523
|
+
Edit?: (props: {
|
524
|
+
cell: MRT_Cell<TData, TValue>;
|
525
|
+
column: MRT_Column<TData, TValue>;
|
526
|
+
row: MRT_Row<TData>;
|
527
|
+
table: MRT_TableInstance<TData>;
|
528
|
+
}) => ReactNode;
|
559
529
|
editSelectOptions?: ((props: {
|
560
530
|
cell: MRT_Cell<TData, TValue>;
|
561
531
|
column: MRT_Column<TData>;
|
@@ -570,6 +540,12 @@ interface MRT_ColumnDef<TData extends MRT_RowData, TValue = unknown> extends Omi
|
|
570
540
|
enableColumnOrdering?: boolean;
|
571
541
|
enableEditing?: ((row: MRT_Row<TData>) => boolean) | boolean;
|
572
542
|
enableFilterMatchHighlighting?: boolean;
|
543
|
+
Filter?: (props: {
|
544
|
+
column: MRT_Column<TData, TValue>;
|
545
|
+
header: MRT_Header<TData>;
|
546
|
+
rangeFilterIndex?: number;
|
547
|
+
table: MRT_TableInstance<TData>;
|
548
|
+
}) => ReactNode;
|
573
549
|
filterFn?: MRT_FilterFn<TData>;
|
574
550
|
filterSelectOptions?: DropdownOption[];
|
575
551
|
filterVariant?: 'autocomplete' | 'checkbox' | 'date' | 'date-range' | 'datetime' | 'datetime-range' | 'multi-select' | 'range' | 'range-slider' | 'select' | 'text' | 'time' | 'time-range';
|
@@ -577,6 +553,19 @@ interface MRT_ColumnDef<TData extends MRT_RowData, TValue = unknown> extends Omi
|
|
577
553
|
* footer must be a string. If you want custom JSX to render the footer, you can also specify a `Footer` option. (Capital F)
|
578
554
|
*/
|
579
555
|
footer?: string;
|
556
|
+
Footer?: ((props: {
|
557
|
+
column: MRT_Column<TData, TValue>;
|
558
|
+
footer: MRT_Header<TData>;
|
559
|
+
table: MRT_TableInstance<TData>;
|
560
|
+
}) => ReactNode) | ReactNode;
|
561
|
+
GroupedCell?: (props: {
|
562
|
+
cell: MRT_Cell<TData, TValue>;
|
563
|
+
column: MRT_Column<TData, TValue>;
|
564
|
+
row: MRT_Row<TData>;
|
565
|
+
table: MRT_TableInstance<TData>;
|
566
|
+
staticColumnIndex?: number;
|
567
|
+
staticRowIndex?: number;
|
568
|
+
}) => ReactNode;
|
580
569
|
/**
|
581
570
|
* If `layoutMode` is `'grid'` or `'grid-no-grow'`, you can specify the flex grow value for individual columns to still grow and take up remaining space, or set to `false`/0 to not grow.
|
582
571
|
*/
|
@@ -585,6 +574,11 @@ interface MRT_ColumnDef<TData extends MRT_RowData, TValue = unknown> extends Omi
|
|
585
574
|
* header must be a string. If you want custom JSX to render the header, you can also specify a `Header` option. (Capital H)
|
586
575
|
*/
|
587
576
|
header: string;
|
577
|
+
Header?: ((props: {
|
578
|
+
column: MRT_Column<TData, TValue>;
|
579
|
+
header: MRT_Header<TData>;
|
580
|
+
table: MRT_TableInstance<TData>;
|
581
|
+
}) => ReactNode) | ReactNode;
|
588
582
|
/**
|
589
583
|
* Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
|
590
584
|
*
|
@@ -661,6 +655,12 @@ interface MRT_ColumnDef<TData extends MRT_RowData, TValue = unknown> extends Omi
|
|
661
655
|
column: MRT_Column<TData>;
|
662
656
|
table: MRT_TableInstance<TData>;
|
663
657
|
}) => TableCellProps) | TableCellProps;
|
658
|
+
PlaceholderCell?: (props: {
|
659
|
+
cell: MRT_Cell<TData, TValue>;
|
660
|
+
column: MRT_Column<TData, TValue>;
|
661
|
+
row: MRT_Row<TData>;
|
662
|
+
table: MRT_TableInstance<TData>;
|
663
|
+
}) => ReactNode;
|
664
664
|
renderCellActionMenuItems?: (props: {
|
665
665
|
cell: MRT_Cell<TData>;
|
666
666
|
closeMenu: () => void;
|
@@ -746,10 +746,6 @@ type MRT_DisplayColumnIds = 'mrt-row-actions' | 'mrt-row-drag' | 'mrt-row-expand
|
|
746
746
|
interface MRT_TableOptions<TData extends MRT_RowData> extends Omit<Partial<TableOptions<TData>>, 'columns' | 'data' | 'defaultColumn' | 'enableRowSelection' | 'expandRowsFn' | 'getRowId' | 'globalFilterFn' | 'initialState' | 'onStateChange' | 'state'> {
|
747
747
|
columnFilterDisplayMode?: 'custom' | 'popover' | 'subheader';
|
748
748
|
columnFilterModeOptions?: Array<LiteralUnion<string & MRT_FilterOption>> | null;
|
749
|
-
columnVirtualizerInstanceRef?: MutableRefObject<MRT_ColumnVirtualizer | null>;
|
750
|
-
columnVirtualizerOptions?: ((props: {
|
751
|
-
table: MRT_TableInstance<TData>;
|
752
|
-
}) => Partial<VirtualizerOptions<HTMLDivElement, HTMLTableCellElement>>) | Partial<VirtualizerOptions<HTMLDivElement, HTMLTableCellElement>>;
|
753
749
|
/**
|
754
750
|
* The columns to display in the table. `accessorKey`s or `accessorFn`s must match keys in the `data` table option.
|
755
751
|
*
|
@@ -761,6 +757,10 @@ interface MRT_TableOptions<TData extends MRT_RowData> extends Omit<Partial<Table
|
|
761
757
|
* @link https://www.material-react-table.com/docs/api/column-options
|
762
758
|
*/
|
763
759
|
columns: MRT_ColumnDef<TData, any>[];
|
760
|
+
columnVirtualizerInstanceRef?: MutableRefObject<MRT_ColumnVirtualizer | null>;
|
761
|
+
columnVirtualizerOptions?: ((props: {
|
762
|
+
table: MRT_TableInstance<TData>;
|
763
|
+
}) => Partial<VirtualizerOptions<HTMLDivElement, HTMLTableCellElement>>) | Partial<VirtualizerOptions<HTMLDivElement, HTMLTableCellElement>>;
|
764
764
|
createDisplayMode?: 'custom' | 'modal' | 'row';
|
765
765
|
/**
|
766
766
|
* Pass your data as an array of objects. Objects can theoretically be any shape, but it's best to keep them consistent.
|
@@ -798,7 +798,7 @@ interface MRT_TableOptions<TData extends MRT_RowData> extends Omit<Partial<Table
|
|
798
798
|
enableFullScreenToggle?: boolean;
|
799
799
|
enableGlobalFilterModes?: boolean;
|
800
800
|
enableGlobalFilterRankedResults?: boolean;
|
801
|
-
|
801
|
+
enableKeyboardShortcuts?: boolean;
|
802
802
|
enablePagination?: boolean;
|
803
803
|
enableRowActions?: boolean;
|
804
804
|
enableRowDragging?: boolean;
|
@@ -1217,7 +1217,7 @@ declare const openEditingCell: <TData extends MRT_RowData>({ cell, table, }: {
|
|
1217
1217
|
cell: MRT_Cell<TData>;
|
1218
1218
|
table: MRT_TableInstance<TData>;
|
1219
1219
|
}) => void;
|
1220
|
-
declare const
|
1220
|
+
declare const cellKeyboardShortcuts: <TData extends MRT_RowData = MRT_RowData>({ cell, cellElements, cellValue, containerElement, event, header, parentElement, table, }: {
|
1221
1221
|
cell?: MRT_Cell<TData>;
|
1222
1222
|
header?: MRT_Header<TData>;
|
1223
1223
|
cellElements?: Array<HTMLTableCellElement>;
|
@@ -1303,18 +1303,36 @@ declare function defaultDisplayColumnProps<TData extends MRT_RowData>({ header,
|
|
1303
1303
|
staticRowIndex?: number;
|
1304
1304
|
table: MRT_TableInstance<TData>;
|
1305
1305
|
}) => react.ReactNode) | undefined;
|
1306
|
+
readonly columnDefType?: "data" | "display" | "group";
|
1307
|
+
readonly columnFilterModeOptions?: Array<LiteralUnion<string & MRT_FilterOption>> | null;
|
1306
1308
|
readonly Edit?: ((props: {
|
1307
1309
|
cell: MRT_Cell<TData, unknown>;
|
1308
1310
|
column: MRT_Column<TData, unknown>;
|
1309
1311
|
row: MRT_Row<TData>;
|
1310
1312
|
table: MRT_TableInstance<TData>;
|
1311
1313
|
}) => react.ReactNode) | undefined;
|
1314
|
+
readonly editSelectOptions?: DropdownOption[] | ((props: {
|
1315
|
+
cell: MRT_Cell<TData, unknown>;
|
1316
|
+
column: MRT_Column<TData, unknown>;
|
1317
|
+
row: MRT_Row<TData>;
|
1318
|
+
table: MRT_TableInstance<TData>;
|
1319
|
+
}) => DropdownOption[]) | undefined;
|
1320
|
+
readonly editVariant?: "select" | "text";
|
1321
|
+
readonly enableClickToCopy?: boolean | "context-menu" | ((cell: MRT_Cell<TData, unknown>) => "context-menu" | boolean) | undefined;
|
1322
|
+
readonly enableColumnActions?: boolean;
|
1323
|
+
readonly enableColumnDragging?: boolean;
|
1324
|
+
readonly enableColumnFilterModes?: boolean;
|
1325
|
+
readonly enableColumnOrdering?: boolean;
|
1326
|
+
readonly enableEditing?: boolean | ((row: MRT_Row<TData>) => boolean) | undefined;
|
1327
|
+
readonly enableFilterMatchHighlighting?: boolean;
|
1312
1328
|
readonly Filter?: ((props: {
|
1313
1329
|
column: MRT_Column<TData, unknown>;
|
1314
1330
|
header: MRT_Header<TData>;
|
1315
1331
|
rangeFilterIndex?: number;
|
1316
1332
|
table: MRT_TableInstance<TData>;
|
1317
1333
|
}) => react.ReactNode) | undefined;
|
1334
|
+
readonly filterSelectOptions?: DropdownOption[];
|
1335
|
+
readonly filterVariant?: "autocomplete" | "checkbox" | "date" | "date-range" | "datetime" | "datetime-range" | "multi-select" | "range" | "range-slider" | "select" | "text" | "time" | "time-range";
|
1318
1336
|
readonly Footer?: react.ReactNode | ((props: {
|
1319
1337
|
column: MRT_Column<TData, unknown>;
|
1320
1338
|
footer: MRT_Header<TData>;
|
@@ -1328,36 +1346,12 @@ declare function defaultDisplayColumnProps<TData extends MRT_RowData>({ header,
|
|
1328
1346
|
staticColumnIndex?: number;
|
1329
1347
|
staticRowIndex?: number;
|
1330
1348
|
}) => react.ReactNode) | undefined;
|
1349
|
+
readonly grow?: boolean | number;
|
1331
1350
|
readonly Header?: react.ReactNode | ((props: {
|
1332
1351
|
column: MRT_Column<TData, unknown>;
|
1333
1352
|
header: MRT_Header<TData>;
|
1334
1353
|
table: MRT_TableInstance<TData>;
|
1335
1354
|
}) => react.ReactNode);
|
1336
|
-
readonly PlaceholderCell?: ((props: {
|
1337
|
-
cell: MRT_Cell<TData, unknown>;
|
1338
|
-
column: MRT_Column<TData, unknown>;
|
1339
|
-
row: MRT_Row<TData>;
|
1340
|
-
table: MRT_TableInstance<TData>;
|
1341
|
-
}) => react.ReactNode) | undefined;
|
1342
|
-
readonly columnDefType?: "data" | "display" | "group";
|
1343
|
-
readonly columnFilterModeOptions?: Array<LiteralUnion<string & MRT_FilterOption>> | null;
|
1344
|
-
readonly editSelectOptions?: DropdownOption[] | ((props: {
|
1345
|
-
cell: MRT_Cell<TData, unknown>;
|
1346
|
-
column: MRT_Column<TData, unknown>;
|
1347
|
-
row: MRT_Row<TData>;
|
1348
|
-
table: MRT_TableInstance<TData>;
|
1349
|
-
}) => DropdownOption[]) | undefined;
|
1350
|
-
readonly editVariant?: "select" | "text";
|
1351
|
-
readonly enableClickToCopy?: boolean | "context-menu" | ((cell: MRT_Cell<TData, unknown>) => "context-menu" | boolean) | undefined;
|
1352
|
-
readonly enableColumnActions?: boolean;
|
1353
|
-
readonly enableColumnDragging?: boolean;
|
1354
|
-
readonly enableColumnFilterModes?: boolean;
|
1355
|
-
readonly enableColumnOrdering?: boolean;
|
1356
|
-
readonly enableEditing?: boolean | ((row: MRT_Row<TData>) => boolean) | undefined;
|
1357
|
-
readonly enableFilterMatchHighlighting?: boolean;
|
1358
|
-
readonly filterSelectOptions?: DropdownOption[];
|
1359
|
-
readonly filterVariant?: "autocomplete" | "checkbox" | "date" | "date-range" | "datetime" | "datetime-range" | "multi-select" | "range" | "range-slider" | "select" | "text" | "time" | "time-range";
|
1360
|
-
readonly grow?: boolean | number;
|
1361
1355
|
readonly muiColumnActionsButtonProps?: _mui_material.IconButtonProps | ((props: {
|
1362
1356
|
column: MRT_Column<TData, unknown>;
|
1363
1357
|
table: MRT_TableInstance<TData>;
|
@@ -1424,6 +1418,12 @@ declare function defaultDisplayColumnProps<TData extends MRT_RowData>({ header,
|
|
1424
1418
|
column: MRT_Column<TData, unknown>;
|
1425
1419
|
table: MRT_TableInstance<TData>;
|
1426
1420
|
}) => _mui_material.TableCellProps) | undefined;
|
1421
|
+
readonly PlaceholderCell?: ((props: {
|
1422
|
+
cell: MRT_Cell<TData, unknown>;
|
1423
|
+
column: MRT_Column<TData, unknown>;
|
1424
|
+
row: MRT_Row<TData>;
|
1425
|
+
table: MRT_TableInstance<TData>;
|
1426
|
+
}) => react.ReactNode) | undefined;
|
1427
1427
|
readonly renderCellActionMenuItems?: ((props: {
|
1428
1428
|
cell: MRT_Cell<TData, unknown>;
|
1429
1429
|
closeMenu: () => void;
|
@@ -1911,4 +1911,4 @@ interface MRT_TopToolbarProps<TData extends MRT_RowData> {
|
|
1911
1911
|
}
|
1912
1912
|
declare const MRT_TopToolbar: <TData extends MRT_RowData>({ table, }: MRT_TopToolbarProps<TData>) => react_jsx_runtime.JSX.Element;
|
1913
1913
|
|
1914
|
-
export { type DropdownOption, type LiteralUnion, MRT_ActionMenuItem, type MRT_ActionMenuItemProps, type MRT_AggregationFn, MRT_AggregationFns, type MRT_AggregationOption, MRT_BottomToolbar, type MRT_BottomToolbarProps, type MRT_Cell, type MRT_Column, MRT_ColumnActionMenu, type MRT_ColumnActionMenuProps, type MRT_ColumnDef, type MRT_ColumnFilterFnsState, type MRT_ColumnFiltersState, type MRT_ColumnHelper, type MRT_ColumnOrderState, MRT_ColumnPinningButtons, type MRT_ColumnPinningButtonsProps, type MRT_ColumnPinningState, type MRT_ColumnSizingInfoState, type MRT_ColumnSizingState, type MRT_ColumnVirtualizer, MRT_CopyButton, type MRT_CopyButtonProps, MRT_DefaultColumn, MRT_DefaultDisplayColumn, type MRT_DefinedColumnDef, type MRT_DefinedTableOptions, type MRT_DensityState, type MRT_DisplayColumnDef, type MRT_DisplayColumnIds, MRT_EditActionButtons, type MRT_EditActionButtonsProps, MRT_EditCellTextField, type MRT_EditCellTextFieldProps, MRT_EditRowModal, type MRT_EditRowModalProps, MRT_ExpandAllButton, type MRT_ExpandAllButtonProps, MRT_ExpandButton, type MRT_ExpandButtonProps, type MRT_ExpandedState, MRT_FilterCheckbox, type MRT_FilterCheckboxProps, type MRT_FilterFn, MRT_FilterFns, type MRT_FilterOption, MRT_FilterOptionMenu, type MRT_FilterOptionMenuProps, MRT_FilterRangeFields, type MRT_FilterRangeFieldsProps, MRT_FilterRangeSlider, type MRT_FilterRangeSliderProps, MRT_FilterTextField, type MRT_FilterTextFieldProps, MRT_GlobalFilterTextField, type MRT_GlobalFilterTextFieldProps, MRT_GrabHandleButton, type MRT_GrabHandleButtonProps, type MRT_GroupColumnDef, type MRT_GroupingState, type MRT_Header, type MRT_HeaderGroup, type MRT_Icons, type MRT_InternalFilterOption, MRT_LinearProgressBar, type MRT_LinearProgressBarProps, type MRT_Localization, type MRT_PaginationState, type MRT_Row, MRT_RowActionMenu, type MRT_RowActionMenuProps, type MRT_RowData, type MRT_RowModel, MRT_RowPinButton, type MRT_RowPinButtonProps, type MRT_RowSelectionState, type MRT_RowVirtualizer, MRT_SelectCheckbox, type MRT_SelectCheckboxProps, MRT_ShowHideColumnsButton, type MRT_ShowHideColumnsButtonProps, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, type MRT_ShowHideColumnsMenuItemsProps, type MRT_ShowHideColumnsMenuProps, type MRT_SortingFn, MRT_SortingFns, type MRT_SortingOption, type MRT_SortingState, type MRT_StatefulTableOptions, MRT_Table, MRT_TableBody, MRT_TableBodyCell, type MRT_TableBodyCellProps, MRT_TableBodyCellValue, type MRT_TableBodyCellValueProps, type MRT_TableBodyProps, MRT_TableBodyRow, MRT_TableBodyRowGrabHandle, type MRT_TableBodyRowGrabHandleProps, MRT_TableBodyRowPinButton, type MRT_TableBodyRowPinButtonProps, type MRT_TableBodyRowProps, MRT_TableContainer, type MRT_TableContainerProps, MRT_TableDetailPanel, type MRT_TableDetailPanelProps, MRT_TableFooter, MRT_TableFooterCell, type MRT_TableFooterCellProps, type MRT_TableFooterProps, MRT_TableFooterRow, type MRT_TableFooterRowProps, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, type MRT_TableHeadCellColumnActionsButtonProps, MRT_TableHeadCellFilterContainer, type MRT_TableHeadCellFilterContainerProps, MRT_TableHeadCellFilterLabel, type MRT_TableHeadCellFilterLabelProps, MRT_TableHeadCellGrabHandle, type MRT_TableHeadCellGrabHandleProps, type MRT_TableHeadCellProps, MRT_TableHeadCellResizeHandle, type MRT_TableHeadCellResizeHandleProps, MRT_TableHeadCellSortLabel, type MRT_TableHeadCellSortLabelProps, type MRT_TableHeadProps, MRT_TableHeadRow, type MRT_TableHeadRowProps, type MRT_TableInstance, MRT_TableLoadingOverlay, type MRT_TableLoadingOverlayProps, type MRT_TableOptions, MRT_TablePagination, type MRT_TablePaginationProps, MRT_TablePaper, type MRT_TablePaperProps, type MRT_TableProps, type MRT_TableState, type MRT_Theme, MRT_ToggleDensePaddingButton, type MRT_ToggleDensePaddingButtonProps, MRT_ToggleFiltersButton, type MRT_ToggleFiltersButtonProps, MRT_ToggleFullScreenButton, type MRT_ToggleFullScreenButtonProps, MRT_ToggleGlobalFilterButton, type MRT_ToggleGlobalFilterButtonProps, MRT_ToggleRowActionMenuButton, type MRT_ToggleRowActionMenuButtonProps, MRT_ToolbarAlertBanner, type MRT_ToolbarAlertBannerProps, MRT_ToolbarDropZone, type MRT_ToolbarDropZoneProps, MRT_ToolbarInternalButtons, type MRT_ToolbarInternalButtonsProps, MRT_TopToolbar, type MRT_TopToolbarProps, type MRT_Updater, type MRT_VirtualItem, type MRT_VirtualizerOptions, type MRT_VisibilityState, MaterialReactTable, type MaterialReactTableProps, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow, type Prettify, type Xor,
|
1914
|
+
export { type DropdownOption, type LiteralUnion, MRT_ActionMenuItem, type MRT_ActionMenuItemProps, type MRT_AggregationFn, MRT_AggregationFns, type MRT_AggregationOption, MRT_BottomToolbar, type MRT_BottomToolbarProps, type MRT_Cell, type MRT_Column, MRT_ColumnActionMenu, type MRT_ColumnActionMenuProps, type MRT_ColumnDef, type MRT_ColumnFilterFnsState, type MRT_ColumnFiltersState, type MRT_ColumnHelper, type MRT_ColumnOrderState, MRT_ColumnPinningButtons, type MRT_ColumnPinningButtonsProps, type MRT_ColumnPinningState, type MRT_ColumnSizingInfoState, type MRT_ColumnSizingState, type MRT_ColumnVirtualizer, MRT_CopyButton, type MRT_CopyButtonProps, MRT_DefaultColumn, MRT_DefaultDisplayColumn, type MRT_DefinedColumnDef, type MRT_DefinedTableOptions, type MRT_DensityState, type MRT_DisplayColumnDef, type MRT_DisplayColumnIds, MRT_EditActionButtons, type MRT_EditActionButtonsProps, MRT_EditCellTextField, type MRT_EditCellTextFieldProps, MRT_EditRowModal, type MRT_EditRowModalProps, MRT_ExpandAllButton, type MRT_ExpandAllButtonProps, MRT_ExpandButton, type MRT_ExpandButtonProps, type MRT_ExpandedState, MRT_FilterCheckbox, type MRT_FilterCheckboxProps, type MRT_FilterFn, MRT_FilterFns, type MRT_FilterOption, MRT_FilterOptionMenu, type MRT_FilterOptionMenuProps, MRT_FilterRangeFields, type MRT_FilterRangeFieldsProps, MRT_FilterRangeSlider, type MRT_FilterRangeSliderProps, MRT_FilterTextField, type MRT_FilterTextFieldProps, MRT_GlobalFilterTextField, type MRT_GlobalFilterTextFieldProps, MRT_GrabHandleButton, type MRT_GrabHandleButtonProps, type MRT_GroupColumnDef, type MRT_GroupingState, type MRT_Header, type MRT_HeaderGroup, type MRT_Icons, type MRT_InternalFilterOption, MRT_LinearProgressBar, type MRT_LinearProgressBarProps, type MRT_Localization, type MRT_PaginationState, type MRT_Row, MRT_RowActionMenu, type MRT_RowActionMenuProps, type MRT_RowData, type MRT_RowModel, MRT_RowPinButton, type MRT_RowPinButtonProps, type MRT_RowSelectionState, type MRT_RowVirtualizer, MRT_SelectCheckbox, type MRT_SelectCheckboxProps, MRT_ShowHideColumnsButton, type MRT_ShowHideColumnsButtonProps, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, type MRT_ShowHideColumnsMenuItemsProps, type MRT_ShowHideColumnsMenuProps, type MRT_SortingFn, MRT_SortingFns, type MRT_SortingOption, type MRT_SortingState, type MRT_StatefulTableOptions, MRT_Table, MRT_TableBody, MRT_TableBodyCell, type MRT_TableBodyCellProps, MRT_TableBodyCellValue, type MRT_TableBodyCellValueProps, type MRT_TableBodyProps, MRT_TableBodyRow, MRT_TableBodyRowGrabHandle, type MRT_TableBodyRowGrabHandleProps, MRT_TableBodyRowPinButton, type MRT_TableBodyRowPinButtonProps, type MRT_TableBodyRowProps, MRT_TableContainer, type MRT_TableContainerProps, MRT_TableDetailPanel, type MRT_TableDetailPanelProps, MRT_TableFooter, MRT_TableFooterCell, type MRT_TableFooterCellProps, type MRT_TableFooterProps, MRT_TableFooterRow, type MRT_TableFooterRowProps, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, type MRT_TableHeadCellColumnActionsButtonProps, MRT_TableHeadCellFilterContainer, type MRT_TableHeadCellFilterContainerProps, MRT_TableHeadCellFilterLabel, type MRT_TableHeadCellFilterLabelProps, MRT_TableHeadCellGrabHandle, type MRT_TableHeadCellGrabHandleProps, type MRT_TableHeadCellProps, MRT_TableHeadCellResizeHandle, type MRT_TableHeadCellResizeHandleProps, MRT_TableHeadCellSortLabel, type MRT_TableHeadCellSortLabelProps, type MRT_TableHeadProps, MRT_TableHeadRow, type MRT_TableHeadRowProps, type MRT_TableInstance, MRT_TableLoadingOverlay, type MRT_TableLoadingOverlayProps, type MRT_TableOptions, MRT_TablePagination, type MRT_TablePaginationProps, MRT_TablePaper, type MRT_TablePaperProps, type MRT_TableProps, type MRT_TableState, type MRT_Theme, MRT_ToggleDensePaddingButton, type MRT_ToggleDensePaddingButtonProps, MRT_ToggleFiltersButton, type MRT_ToggleFiltersButtonProps, MRT_ToggleFullScreenButton, type MRT_ToggleFullScreenButtonProps, MRT_ToggleGlobalFilterButton, type MRT_ToggleGlobalFilterButtonProps, MRT_ToggleRowActionMenuButton, type MRT_ToggleRowActionMenuButtonProps, MRT_ToolbarAlertBanner, type MRT_ToolbarAlertBannerProps, MRT_ToolbarDropZone, type MRT_ToolbarDropZoneProps, MRT_ToolbarInternalButtons, type MRT_ToolbarInternalButtonsProps, MRT_TopToolbar, type MRT_TopToolbarProps, type MRT_Updater, type MRT_VirtualItem, type MRT_VirtualizerOptions, type MRT_VisibilityState, MaterialReactTable, type MaterialReactTableProps, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow, type Prettify, type Xor, cellKeyboardShortcuts, createMRTColumnHelper, createRow, defaultDisplayColumnProps, flexRender, getAllLeafColumnDefs, getCanRankRows, getColumnFilterInfo, getColumnId, getDefaultColumnFilterFn, getDefaultColumnOrderIds, getIsRankingRows, getIsRowSelected, getLeadingDisplayColumnIds, getMRT_RowSelectionHandler, getMRT_Rows, getMRT_SelectAllHandler, getTrailingDisplayColumnIds, isCellEditable, mrtFilterOptions, openEditingCell, prepareColumns, rankGlobalFuzzy, reorderColumn, showRowActionsColumn, showRowDragColumn, showRowExpandColumn, showRowNumbersColumn, showRowPinningColumn, showRowSelectionColumn, showRowSpacerColumn, useDropdownOptions, useMRT_ColumnVirtualizer, useMRT_Effects, useMRT_RowVirtualizer, useMRT_Rows, useMRT_TableInstance, useMRT_TableOptions, useMaterialReactTable };
|
package/dist/index.esm.js
CHANGED
@@ -407,6 +407,10 @@ const getMRT_SelectAllHandler = ({ table }) => (event, value, forceAll) => {
|
|
407
407
|
lastSelectedRowId.current = null;
|
408
408
|
};
|
409
409
|
|
410
|
+
const isWinCtrlMacMeta = (event) => {
|
411
|
+
return ((event.ctrlKey && navigator.platform.toLowerCase().includes('win')) ||
|
412
|
+
(event.metaKey && navigator.platform.toLowerCase().includes('mac')));
|
413
|
+
};
|
410
414
|
const isCellEditable = ({ cell, table, }) => {
|
411
415
|
const { enableEditing } = table.options;
|
412
416
|
const { column: { columnDef }, row, } = cell;
|
@@ -429,13 +433,17 @@ const openEditingCell = ({ cell, table, }) => {
|
|
429
433
|
});
|
430
434
|
}
|
431
435
|
};
|
432
|
-
const
|
436
|
+
const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement, event, header, parentElement, table, }) => {
|
433
437
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
434
|
-
if (
|
438
|
+
if (!table.options.enableKeyboardShortcuts)
|
439
|
+
return;
|
440
|
+
const currentCell = event.currentTarget;
|
441
|
+
if (cellValue && isWinCtrlMacMeta(event) && event.key === 'c') {
|
435
442
|
navigator.clipboard.writeText(cellValue);
|
436
443
|
}
|
437
444
|
else if (['Enter', ' '].includes(event.key)) {
|
438
445
|
if (((_a = cell === null || cell === void 0 ? void 0 : cell.column) === null || _a === void 0 ? void 0 : _a.id) === 'mrt-row-select') {
|
446
|
+
event.preventDefault();
|
439
447
|
getMRT_RowSelectionHandler({
|
440
448
|
row: cell.row,
|
441
449
|
table,
|
@@ -445,6 +453,7 @@ const cellNavigation = ({ cell, cellElements, cellValue, containerElement, event
|
|
445
453
|
}
|
446
454
|
else if (((_b = header === null || header === void 0 ? void 0 : header.column) === null || _b === void 0 ? void 0 : _b.id) === 'mrt-row-select' &&
|
447
455
|
table.options.enableSelectAll) {
|
456
|
+
event.preventDefault();
|
448
457
|
getMRT_SelectAllHandler({
|
449
458
|
table,
|
450
459
|
})(event);
|
@@ -452,26 +461,44 @@ const cellNavigation = ({ cell, cellElements, cellValue, containerElement, event
|
|
452
461
|
else if (((_c = cell === null || cell === void 0 ? void 0 : cell.column) === null || _c === void 0 ? void 0 : _c.id) === 'mrt-row-expand' &&
|
453
462
|
(cell.row.getCanExpand() ||
|
454
463
|
((_e = (_d = table.options).renderDetailPanel) === null || _e === void 0 ? void 0 : _e.call(_d, { row: cell.row, table })))) {
|
464
|
+
event.preventDefault();
|
455
465
|
cell.row.toggleExpanded();
|
456
466
|
}
|
457
467
|
else if (((_f = header === null || header === void 0 ? void 0 : header.column) === null || _f === void 0 ? void 0 : _f.id) === 'mrt-row-expand' &&
|
458
468
|
table.options.enableExpandAll) {
|
469
|
+
event.preventDefault();
|
459
470
|
table.toggleAllRowsExpanded();
|
460
471
|
}
|
461
|
-
else if ((_g = header === null || header === void 0 ? void 0 : header.column) === null || _g === void 0 ? void 0 : _g.getCanSort()) {
|
462
|
-
header.column.toggleSorting();
|
463
|
-
}
|
464
472
|
else if ((cell === null || cell === void 0 ? void 0 : cell.column.id) === 'mrt-row-pin') {
|
473
|
+
event.preventDefault();
|
465
474
|
cell.row.getIsPinned()
|
466
475
|
? cell.row.pin(false)
|
467
|
-
: cell.row.pin(((
|
476
|
+
: cell.row.pin(((_g = table.options.rowPinningDisplayMode) === null || _g === void 0 ? void 0 : _g.includes('bottom'))
|
468
477
|
? 'bottom'
|
469
478
|
: 'top');
|
470
479
|
}
|
480
|
+
else if (header && isWinCtrlMacMeta(event)) {
|
481
|
+
const actionsButton = currentCell.querySelector(`button[aria-label="${table.options.localization.columnActions}"]`);
|
482
|
+
if (actionsButton) {
|
483
|
+
actionsButton.click();
|
484
|
+
}
|
485
|
+
}
|
486
|
+
else if ((_h = header === null || header === void 0 ? void 0 : header.column) === null || _h === void 0 ? void 0 : _h.getCanSort()) {
|
487
|
+
event.preventDefault();
|
488
|
+
header.column.toggleSorting();
|
489
|
+
}
|
471
490
|
}
|
472
|
-
else if ([
|
491
|
+
else if ([
|
492
|
+
'ArrowRight',
|
493
|
+
'ArrowLeft',
|
494
|
+
'ArrowUp',
|
495
|
+
'ArrowDown',
|
496
|
+
'Home',
|
497
|
+
'End',
|
498
|
+
'PageUp',
|
499
|
+
'PageDown',
|
500
|
+
].includes(event.key)) {
|
473
501
|
event.preventDefault();
|
474
|
-
const currentCell = event.currentTarget;
|
475
502
|
const currentRow = parentElement || currentCell.closest('tr');
|
476
503
|
const tableElement = containerElement || currentCell.closest('table');
|
477
504
|
const allCells = cellElements ||
|
@@ -491,6 +518,16 @@ const cellNavigation = ({ cell, cellElements, cellValue, containerElement, event
|
|
491
518
|
const targetCell = edge === 'f' ? rowCells[0] : rowCells[rowCells.length - 1];
|
492
519
|
return targetCell;
|
493
520
|
};
|
521
|
+
//page up/down first or last cell in column
|
522
|
+
const findBottomTopCell = (columnIndex, edge) => {
|
523
|
+
var _a;
|
524
|
+
const row = edge === 't'
|
525
|
+
? tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelector('tr')
|
526
|
+
: (_a = tableElement === null || tableElement === void 0 ? void 0 : tableElement.lastElementChild) === null || _a === void 0 ? void 0 : _a.lastElementChild;
|
527
|
+
const rowCells = Array.from((row === null || row === void 0 ? void 0 : row.children) || []);
|
528
|
+
const targetCell = rowCells[columnIndex];
|
529
|
+
return targetCell;
|
530
|
+
};
|
494
531
|
const findAdjacentCell = (columnIndex, searchDirection) => {
|
495
532
|
const searchArray = searchDirection === 'f'
|
496
533
|
? allCells.slice(currentCellIndex + 1)
|
@@ -511,10 +548,16 @@ const cellNavigation = ({ cell, cellElements, cellValue, containerElement, event
|
|
511
548
|
nextCell = findAdjacentCell(currentIndex, 'f');
|
512
549
|
break;
|
513
550
|
case 'Home':
|
514
|
-
nextCell = findEdgeCell(event
|
551
|
+
nextCell = findEdgeCell(isWinCtrlMacMeta(event) ? 'f' : 'c', 'f');
|
515
552
|
break;
|
516
553
|
case 'End':
|
517
|
-
nextCell = findEdgeCell(event
|
554
|
+
nextCell = findEdgeCell(isWinCtrlMacMeta(event) ? 'l' : 'c', 'l');
|
555
|
+
break;
|
556
|
+
case 'PageUp':
|
557
|
+
nextCell = findBottomTopCell(currentIndex, 't');
|
558
|
+
break;
|
559
|
+
case 'PageDown':
|
560
|
+
nextCell = findBottomTopCell(currentIndex, 'b');
|
518
561
|
break;
|
519
562
|
}
|
520
563
|
if (nextCell) {
|
@@ -1369,7 +1412,7 @@ const MRT_DefaultDisplayColumn = {
|
|
1369
1412
|
};
|
1370
1413
|
const useMRT_TableOptions = (_a) => {
|
1371
1414
|
var _b;
|
1372
|
-
var { aggregationFns, autoResetExpanded = false, columnFilterDisplayMode = 'subheader', columnResizeDirection, columnResizeMode = 'onChange', createDisplayMode = 'modal', defaultColumn, defaultDisplayColumn, editDisplayMode = 'modal', enableBatchRowSelection = true, enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnPinning = false, enableColumnResizing = false, enableColumnVirtualization, enableDensityToggle = true, enableExpandAll = true, enableExpanding, enableFacetedValues = false, enableFilterMatchHighlighting = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true,
|
1415
|
+
var { aggregationFns, autoResetExpanded = false, columnFilterDisplayMode = 'subheader', columnResizeDirection, columnResizeMode = 'onChange', createDisplayMode = 'modal', defaultColumn, defaultDisplayColumn, editDisplayMode = 'modal', enableBatchRowSelection = true, enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnPinning = false, enableColumnResizing = false, enableColumnVirtualization, enableDensityToggle = true, enableExpandAll = true, enableExpanding, enableFacetedValues = false, enableFilterMatchHighlighting = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true, enableKeyboardShortcuts = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enableRowPinning = false, enableRowSelection = false, enableRowVirtualization, enableSelectAll = true, enableSorting = true, enableStickyHeader = false, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, layoutMode, localization, manualFiltering, manualGrouping, manualPagination, manualSorting, mrtTheme, paginationDisplayMode = 'default', positionActionsColumn = 'first', positionCreatingRow = 'top', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberDisplayMode = 'static', rowPinningDisplayMode = 'sticky', selectAllMode = 'page', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnFilterDisplayMode", "columnResizeDirection", "columnResizeMode", "createDisplayMode", "defaultColumn", "defaultDisplayColumn", "editDisplayMode", "enableBatchRowSelection", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnPinning", "enableColumnResizing", "enableColumnVirtualization", "enableDensityToggle", "enableExpandAll", "enableExpanding", "enableFacetedValues", "enableFilterMatchHighlighting", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableKeyboardShortcuts", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enableRowPinning", "enableRowSelection", "enableRowVirtualization", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "mrtTheme", "paginationDisplayMode", "positionActionsColumn", "positionCreatingRow", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberDisplayMode", "rowPinningDisplayMode", "selectAllMode", "sortingFns"]);
|
1373
1416
|
const theme = useTheme();
|
1374
1417
|
icons = useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
|
1375
1418
|
localization = useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
|
@@ -1430,7 +1473,7 @@ const useMRT_TableOptions = (_a) => {
|
|
1430
1473
|
enableGlobalFilterRankedResults,
|
1431
1474
|
enableGrouping,
|
1432
1475
|
enableHiding,
|
1433
|
-
|
1476
|
+
enableKeyboardShortcuts,
|
1434
1477
|
enableMultiRowSelection,
|
1435
1478
|
enableMultiSort,
|
1436
1479
|
enablePagination,
|
@@ -2077,7 +2120,7 @@ const MRT_TableBodyCell = (_a) => {
|
|
2077
2120
|
var _b, _c, _d, _e, _f;
|
2078
2121
|
var { cell, numRows, rowRef, staticColumnIndex, staticRowIndex, table } = _a, rest = __rest(_a, ["cell", "numRows", "rowRef", "staticColumnIndex", "staticRowIndex", "table"]);
|
2079
2122
|
const theme = useTheme();
|
2080
|
-
const { getState, options: { columnResizeDirection, columnResizeMode, createDisplayMode, editDisplayMode, enableCellActions, enableClickToCopy, enableColumnOrdering, enableColumnPinning, enableGrouping,
|
2123
|
+
const { getState, options: { columnResizeDirection, columnResizeMode, createDisplayMode, editDisplayMode, enableCellActions, enableClickToCopy, enableColumnOrdering, enableColumnPinning, enableGrouping, enableKeyboardShortcuts, layoutMode, mrtTheme: { draggingBorderColor }, muiSkeletonProps, muiTableBodyCellProps, }, setHoveredColumn, } = table;
|
2081
2124
|
const { actionCell, columnSizingInfo, creatingRow, density, draggingColumn, draggingRow, editingCell, editingRow, hoveredColumn, hoveredRow, isLoading, showSkeletons, } = getState();
|
2082
2125
|
const { column, row } = cell;
|
2083
2126
|
const { columnDef } = column;
|
@@ -2201,17 +2244,15 @@ const MRT_TableBodyCell = (_a) => {
|
|
2201
2244
|
};
|
2202
2245
|
const handleKeyDown = (event) => {
|
2203
2246
|
var _a;
|
2204
|
-
|
2205
|
-
|
2206
|
-
|
2207
|
-
|
2208
|
-
|
2209
|
-
|
2210
|
-
});
|
2211
|
-
}
|
2247
|
+
cellKeyboardShortcuts({
|
2248
|
+
cell,
|
2249
|
+
cellValue: cell.getValue(),
|
2250
|
+
event,
|
2251
|
+
table,
|
2252
|
+
});
|
2212
2253
|
(_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
|
2213
2254
|
};
|
2214
|
-
return (jsx(TableCell, Object.assign({ align: theme.direction === 'rtl' ? 'right' : 'left', "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, tabIndex:
|
2255
|
+
return (jsx(TableCell, Object.assign({ align: theme.direction === 'rtl' ? 'right' : 'left', "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, tabIndex: enableKeyboardShortcuts ? 0 : undefined }, tableCellProps, { onKeyDown: handleKeyDown, onContextMenu: handleContextMenu, onDoubleClick: handleDoubleClick, onDragEnter: handleDragEnter, onDragOver: handleDragOver, sx: (theme) => (Object.assign(Object.assign({ '&:hover': {
|
2215
2256
|
outline: (actionCell === null || actionCell === void 0 ? void 0 : actionCell.id) === cell.id ||
|
2216
2257
|
(editDisplayMode === 'cell' && isEditable) ||
|
2217
2258
|
(editDisplayMode === 'table' && (isCreating || isEditing))
|
@@ -2472,7 +2513,7 @@ const MRT_TableFooterCell = (_a) => {
|
|
2472
2513
|
var _b, _c, _d;
|
2473
2514
|
var { footer, staticColumnIndex, table } = _a, rest = __rest(_a, ["footer", "staticColumnIndex", "table"]);
|
2474
2515
|
const theme = useTheme();
|
2475
|
-
const { getState, options: { enableColumnPinning, muiTableFooterCellProps,
|
2516
|
+
const { getState, options: { enableColumnPinning, muiTableFooterCellProps, enableKeyboardShortcuts, }, } = table;
|
2476
2517
|
const { density } = getState();
|
2477
2518
|
const { column } = footer;
|
2478
2519
|
const { columnDef } = column;
|
@@ -2484,20 +2525,18 @@ const MRT_TableFooterCell = (_a) => {
|
|
2484
2525
|
const tableCellProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterCellProps, args)), parseFromValuesOrFunc(columnDef.muiTableFooterCellProps, args)), rest);
|
2485
2526
|
const handleKeyDown = (event) => {
|
2486
2527
|
var _a;
|
2487
|
-
|
2488
|
-
|
2489
|
-
|
2490
|
-
|
2491
|
-
|
2492
|
-
});
|
2493
|
-
}
|
2528
|
+
cellKeyboardShortcuts({
|
2529
|
+
event,
|
2530
|
+
cellValue: footer.column.columnDef.footer,
|
2531
|
+
table,
|
2532
|
+
});
|
2494
2533
|
(_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
|
2495
2534
|
};
|
2496
2535
|
return (jsx(TableCell, Object.assign({ align: columnDefType === 'group'
|
2497
2536
|
? 'center'
|
2498
2537
|
: theme.direction === 'rtl'
|
2499
2538
|
? 'right'
|
2500
|
-
: 'left', colSpan: footer.colSpan, "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, variant: "footer" }, tableCellProps, { onKeyDown: handleKeyDown, sx: (theme) => (Object.assign(Object.assign({ fontWeight: 'bold', p: density === 'compact'
|
2539
|
+
: 'left', colSpan: footer.colSpan, "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, tabIndex: enableKeyboardShortcuts ? 0 : undefined, variant: "footer" }, tableCellProps, { onKeyDown: handleKeyDown, sx: (theme) => (Object.assign(Object.assign({ fontWeight: 'bold', p: density === 'compact'
|
2501
2540
|
? '0.5rem'
|
2502
2541
|
: density === 'comfortable'
|
2503
2542
|
? '1rem'
|
@@ -3427,7 +3466,7 @@ const MRT_TableHeadCell = (_a) => {
|
|
3427
3466
|
var _b, _c, _d, _f, _g, _h;
|
3428
3467
|
var { columnVirtualizer, header, staticColumnIndex, table } = _a, rest = __rest(_a, ["columnVirtualizer", "header", "staticColumnIndex", "table"]);
|
3429
3468
|
const theme = useTheme();
|
3430
|
-
const { getState, options: { columnFilterDisplayMode, columnResizeDirection, columnResizeMode, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnPinning, enableGrouping,
|
3469
|
+
const { getState, options: { columnFilterDisplayMode, columnResizeDirection, columnResizeMode, enableKeyboardShortcuts, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnPinning, enableGrouping, enableMultiSort, layoutMode, mrtTheme: { draggingBorderColor }, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
|
3431
3470
|
const { columnSizingInfo, density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
|
3432
3471
|
const { column } = header;
|
3433
3472
|
const { columnDef } = column;
|
@@ -3498,14 +3537,12 @@ const MRT_TableHeadCell = (_a) => {
|
|
3498
3537
|
};
|
3499
3538
|
const handleKeyDown = (event) => {
|
3500
3539
|
var _a;
|
3501
|
-
|
3502
|
-
|
3503
|
-
|
3504
|
-
|
3505
|
-
|
3506
|
-
|
3507
|
-
});
|
3508
|
-
}
|
3540
|
+
cellKeyboardShortcuts({
|
3541
|
+
event,
|
3542
|
+
cellValue: header.column.columnDef.header,
|
3543
|
+
table,
|
3544
|
+
header,
|
3545
|
+
});
|
3509
3546
|
(_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
|
3510
3547
|
};
|
3511
3548
|
const HeaderElement = (_b = parseFromValuesOrFunc(columnDef.Header, {
|
@@ -3529,7 +3566,7 @@ const MRT_TableHeadCell = (_a) => {
|
|
3529
3566
|
(_a = columnVirtualizer === null || columnVirtualizer === void 0 ? void 0 : columnVirtualizer.measureElement) === null || _a === void 0 ? void 0 : _a.call(columnVirtualizer, node);
|
3530
3567
|
}
|
3531
3568
|
}
|
3532
|
-
}, tabIndex:
|
3569
|
+
}, tabIndex: enableKeyboardShortcuts ? 0 : undefined }, tableCellProps, { onKeyDown: handleKeyDown, sx: (theme) => (Object.assign(Object.assign({ '& :hover': {
|
3533
3570
|
'.MuiButtonBase-root': {
|
3534
3571
|
opacity: 1,
|
3535
3572
|
},
|
@@ -4316,5 +4353,5 @@ const MaterialReactTable = (props) => {
|
|
4316
4353
|
return jsx(MRT_TablePaper, { table: table });
|
4317
4354
|
};
|
4318
4355
|
|
4319
|
-
export { MRT_ActionMenuItem, MRT_AggregationFns, MRT_BottomToolbar, MRT_ColumnActionMenu, MRT_ColumnPinningButtons, MRT_CopyButton, MRT_DefaultColumn, MRT_DefaultDisplayColumn, MRT_EditActionButtons, MRT_EditCellTextField, MRT_EditRowModal, MRT_ExpandAllButton, MRT_ExpandButton, MRT_FilterCheckbox, MRT_FilterFns, MRT_FilterOptionMenu, MRT_FilterRangeFields, MRT_FilterRangeSlider, MRT_FilterTextField, MRT_GlobalFilterTextField, MRT_GrabHandleButton, MRT_LinearProgressBar, MRT_RowActionMenu, MRT_RowPinButton, MRT_SelectCheckbox, MRT_ShowHideColumnsButton, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, MRT_SortingFns, MRT_Table, MRT_TableBody, MRT_TableBodyCell, MRT_TableBodyCellValue, MRT_TableBodyRow, MRT_TableBodyRowGrabHandle, MRT_TableBodyRowPinButton, MRT_TableContainer, MRT_TableDetailPanel, MRT_TableFooter, MRT_TableFooterCell, MRT_TableFooterRow, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, MRT_TableHeadCellFilterContainer, MRT_TableHeadCellFilterLabel, MRT_TableHeadCellGrabHandle, MRT_TableHeadCellResizeHandle, MRT_TableHeadCellSortLabel, MRT_TableHeadRow, MRT_TableLoadingOverlay, MRT_TablePagination, MRT_TablePaper, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleFullScreenButton, MRT_ToggleGlobalFilterButton, MRT_ToggleRowActionMenuButton, MRT_ToolbarAlertBanner, MRT_ToolbarDropZone, MRT_ToolbarInternalButtons, MRT_TopToolbar, MaterialReactTable, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow,
|
4356
|
+
export { MRT_ActionMenuItem, MRT_AggregationFns, MRT_BottomToolbar, MRT_ColumnActionMenu, MRT_ColumnPinningButtons, MRT_CopyButton, MRT_DefaultColumn, MRT_DefaultDisplayColumn, MRT_EditActionButtons, MRT_EditCellTextField, MRT_EditRowModal, MRT_ExpandAllButton, MRT_ExpandButton, MRT_FilterCheckbox, MRT_FilterFns, MRT_FilterOptionMenu, MRT_FilterRangeFields, MRT_FilterRangeSlider, MRT_FilterTextField, MRT_GlobalFilterTextField, MRT_GrabHandleButton, MRT_LinearProgressBar, MRT_RowActionMenu, MRT_RowPinButton, MRT_SelectCheckbox, MRT_ShowHideColumnsButton, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, MRT_SortingFns, MRT_Table, MRT_TableBody, MRT_TableBodyCell, MRT_TableBodyCellValue, MRT_TableBodyRow, MRT_TableBodyRowGrabHandle, MRT_TableBodyRowPinButton, MRT_TableContainer, MRT_TableDetailPanel, MRT_TableFooter, MRT_TableFooterCell, MRT_TableFooterRow, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, MRT_TableHeadCellFilterContainer, MRT_TableHeadCellFilterLabel, MRT_TableHeadCellGrabHandle, MRT_TableHeadCellResizeHandle, MRT_TableHeadCellSortLabel, MRT_TableHeadRow, MRT_TableLoadingOverlay, MRT_TablePagination, MRT_TablePaper, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleFullScreenButton, MRT_ToggleGlobalFilterButton, MRT_ToggleRowActionMenuButton, MRT_ToolbarAlertBanner, MRT_ToolbarDropZone, MRT_ToolbarInternalButtons, MRT_TopToolbar, MaterialReactTable, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow, cellKeyboardShortcuts, createMRTColumnHelper, createRow, defaultDisplayColumnProps, flexRender, getAllLeafColumnDefs, getCanRankRows, getColumnFilterInfo, getColumnId, getDefaultColumnFilterFn, getDefaultColumnOrderIds, getIsRankingRows, getIsRowSelected, getLeadingDisplayColumnIds, getMRT_RowSelectionHandler, getMRT_Rows, getMRT_SelectAllHandler, getTrailingDisplayColumnIds, isCellEditable, mrtFilterOptions, openEditingCell, prepareColumns, rankGlobalFuzzy, reorderColumn, showRowActionsColumn, showRowDragColumn, showRowExpandColumn, showRowNumbersColumn, showRowPinningColumn, showRowSelectionColumn, showRowSpacerColumn, useDropdownOptions, useMRT_ColumnVirtualizer, useMRT_Effects, useMRT_RowVirtualizer, useMRT_Rows, useMRT_TableInstance, useMRT_TableOptions, useMaterialReactTable };
|
4320
4357
|
//# sourceMappingURL=index.esm.js.map
|