material-react-table 2.10.0 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/index.d.ts +144 -125
- package/dist/index.esm.js +201 -152
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +201 -149
- package/dist/index.js.map +1 -1
- package/locales/ar/index.esm.js +1 -0
- package/locales/ar/index.js +1 -0
- package/locales/az/index.esm.js +1 -0
- package/locales/az/index.js +1 -0
- package/locales/bg/index.esm.js +1 -0
- package/locales/bg/index.js +1 -0
- package/locales/cs/index.esm.js +1 -0
- package/locales/cs/index.js +1 -0
- package/locales/da/index.esm.js +1 -0
- package/locales/da/index.js +1 -0
- package/locales/de/index.esm.js +1 -0
- package/locales/de/index.js +1 -0
- package/locales/en/index.esm.js +1 -0
- package/locales/en/index.js +1 -0
- package/locales/es/index.esm.js +1 -0
- package/locales/es/index.js +1 -0
- package/locales/et/index.esm.js +1 -0
- package/locales/et/index.js +1 -0
- package/locales/fa/index.esm.js +1 -0
- package/locales/fa/index.js +1 -0
- package/locales/fi/index.esm.js +1 -0
- package/locales/fi/index.js +1 -0
- package/locales/fr/index.esm.js +1 -0
- package/locales/fr/index.js +1 -0
- package/locales/he/index.esm.js +1 -0
- package/locales/he/index.js +1 -0
- package/locales/hu/index.esm.js +1 -0
- package/locales/hu/index.js +1 -0
- package/locales/hy/index.esm.js +1 -0
- package/locales/hy/index.js +1 -0
- package/locales/id/index.esm.js +1 -0
- package/locales/id/index.js +1 -0
- package/locales/it/index.esm.js +1 -0
- package/locales/it/index.js +1 -0
- package/locales/ja/index.esm.js +1 -0
- package/locales/ja/index.js +1 -0
- package/locales/ko/index.esm.js +1 -0
- package/locales/ko/index.js +1 -0
- package/locales/nl/index.esm.js +1 -0
- package/locales/nl/index.js +1 -0
- package/locales/no/index.esm.js +1 -0
- package/locales/no/index.js +1 -0
- package/locales/np/index.esm.js +1 -0
- package/locales/np/index.js +1 -0
- package/locales/pl/index.esm.js +1 -0
- package/locales/pl/index.js +1 -0
- package/locales/pt/index.esm.js +1 -0
- package/locales/pt/index.js +1 -0
- package/locales/pt-BR/index.esm.js +1 -0
- package/locales/pt-BR/index.js +1 -0
- package/locales/ro/index.esm.js +1 -0
- package/locales/ro/index.js +1 -0
- package/locales/ru/index.esm.js +1 -0
- package/locales/ru/index.js +1 -0
- package/locales/sk/index.esm.js +1 -0
- package/locales/sk/index.js +1 -0
- package/locales/sr-Cyrl-RS/index.esm.js +1 -0
- package/locales/sr-Cyrl-RS/index.js +1 -0
- package/locales/sr-Latn-RS/index.esm.js +1 -0
- package/locales/sr-Latn-RS/index.js +1 -0
- package/locales/sv/index.esm.js +1 -0
- package/locales/sv/index.js +1 -0
- package/locales/tr/index.esm.js +1 -0
- package/locales/tr/index.js +1 -0
- package/locales/uk/index.esm.js +1 -0
- package/locales/uk/index.js +1 -0
- package/locales/vi/index.esm.js +1 -0
- package/locales/vi/index.js +1 -0
- package/locales/zh-Hans/index.esm.js +1 -0
- package/locales/zh-Hans/index.js +1 -0
- package/locales/zh-Hant/index.esm.js +1 -0
- package/locales/zh-Hant/index.js +1 -0
- package/package.json +18 -18
- package/src/components/MaterialReactTable.tsx +3 -3
- package/src/components/body/MRT_TableBody.tsx +3 -2
- package/src/components/body/MRT_TableBodyCell.tsx +4 -2
- package/src/components/body/MRT_TableBodyCellValue.tsx +5 -2
- package/src/components/body/MRT_TableBodyRow.tsx +13 -8
- package/src/components/body/MRT_TableBodyRowGrabHandle.tsx +4 -3
- package/src/components/body/MRT_TableBodyRowPinButton.tsx +3 -2
- package/src/components/body/MRT_TableDetailPanel.tsx +3 -2
- package/src/components/buttons/MRT_ColumnPinningButtons.tsx +3 -2
- package/src/components/buttons/MRT_CopyButton.tsx +3 -2
- package/src/components/buttons/MRT_EditActionButtons.tsx +3 -2
- package/src/components/buttons/MRT_ExpandAllButton.tsx +3 -2
- package/src/components/buttons/MRT_ExpandButton.tsx +3 -2
- package/src/components/buttons/MRT_GrabHandleButton.tsx +9 -15
- package/src/components/buttons/MRT_RowPinButton.tsx +3 -2
- package/src/components/buttons/MRT_ShowHideColumnsButton.tsx +3 -2
- package/src/components/buttons/MRT_ToggleDensePaddingButton.tsx +3 -2
- package/src/components/buttons/MRT_ToggleFiltersButton.tsx +3 -2
- package/src/components/buttons/MRT_ToggleFullScreenButton.tsx +3 -2
- package/src/components/buttons/MRT_ToggleGlobalFilterButton.tsx +3 -2
- package/src/components/buttons/MRT_ToggleRowActionMenuButton.tsx +3 -2
- package/src/components/footer/MRT_TableFooter.tsx +3 -2
- package/src/components/footer/MRT_TableFooterCell.tsx +3 -2
- package/src/components/footer/MRT_TableFooterRow.tsx +5 -3
- package/src/components/head/MRT_TableHead.tsx +3 -2
- package/src/components/head/MRT_TableHeadCell.tsx +3 -5
- package/src/components/head/MRT_TableHeadCellColumnActionsButton.tsx +4 -2
- package/src/components/head/MRT_TableHeadCellFilterContainer.tsx +4 -2
- package/src/components/head/MRT_TableHeadCellFilterLabel.tsx +3 -2
- package/src/components/head/MRT_TableHeadCellGrabHandle.tsx +4 -3
- package/src/components/head/MRT_TableHeadCellResizeHandle.tsx +3 -2
- package/src/components/head/MRT_TableHeadCellSortLabel.tsx +3 -2
- package/src/components/head/MRT_TableHeadRow.tsx +3 -2
- package/src/components/inputs/MRT_EditCellTextField.tsx +3 -2
- package/src/components/inputs/MRT_FilterCheckbox.tsx +3 -2
- package/src/components/inputs/MRT_FilterRangeFields.tsx +3 -2
- package/src/components/inputs/MRT_FilterRangeSlider.tsx +3 -2
- package/src/components/inputs/MRT_FilterTextField.tsx +15 -6
- package/src/components/inputs/MRT_GlobalFilterTextField.tsx +3 -2
- package/src/components/inputs/MRT_SelectCheckbox.tsx +26 -33
- package/src/components/menus/MRT_ActionMenuItem.tsx +3 -2
- package/src/components/menus/MRT_CellActionMenu.tsx +5 -4
- package/src/components/menus/MRT_ColumnActionMenu.tsx +5 -4
- package/src/components/menus/MRT_FilterOptionMenu.tsx +3 -2
- package/src/components/menus/MRT_RowActionMenu.tsx +3 -2
- package/src/components/menus/MRT_ShowHideColumnsMenu.tsx +8 -2
- package/src/components/menus/MRT_ShowHideColumnsMenuItems.tsx +7 -5
- package/src/components/modals/MRT_EditRowModal.tsx +3 -2
- package/src/components/table/MRT_Table.tsx +2 -2
- package/src/components/table/MRT_TableContainer.tsx +3 -2
- package/src/components/table/MRT_TableLoadingOverlay.tsx +11 -8
- package/src/components/table/MRT_TablePaper.tsx +3 -2
- package/src/components/toolbar/MRT_BottomToolbar.tsx +3 -2
- package/src/components/toolbar/MRT_LinearProgressBar.tsx +3 -2
- package/src/components/toolbar/MRT_TablePagination.tsx +2 -2
- package/src/components/toolbar/MRT_ToolbarAlertBanner.tsx +30 -13
- package/src/components/toolbar/MRT_ToolbarDropZone.tsx +3 -2
- package/src/components/toolbar/MRT_ToolbarInternalButtons.tsx +3 -2
- package/src/components/toolbar/MRT_TopToolbar.tsx +2 -2
- package/src/hooks/useMRT_Effects.ts +11 -11
- package/src/hooks/useMRT_Rows.ts +11 -79
- package/src/hooks/useMRT_TableInstance.ts +2 -0
- package/src/hooks/useMRT_TableOptions.ts +2 -0
- package/src/locales/ar.ts +1 -0
- package/src/locales/az.ts +1 -0
- package/src/locales/bg.ts +1 -0
- package/src/locales/cs.ts +1 -0
- package/src/locales/da.ts +1 -0
- package/src/locales/de.ts +1 -0
- package/src/locales/en.ts +1 -0
- package/src/locales/es.ts +1 -0
- package/src/locales/et.ts +1 -0
- package/src/locales/fa.ts +1 -0
- package/src/locales/fi.ts +1 -0
- package/src/locales/fr.ts +1 -0
- package/src/locales/he.ts +1 -0
- package/src/locales/hu.ts +1 -0
- package/src/locales/hy.ts +1 -0
- package/src/locales/id.ts +1 -0
- package/src/locales/it.ts +1 -0
- package/src/locales/ja.ts +1 -0
- package/src/locales/ko.ts +1 -0
- package/src/locales/nl.ts +1 -0
- package/src/locales/no.ts +1 -0
- package/src/locales/np.ts +1 -0
- package/src/locales/pl.ts +1 -0
- package/src/locales/pt-BR.ts +1 -0
- package/src/locales/pt.ts +1 -0
- package/src/locales/ro.ts +1 -0
- package/src/locales/ru.ts +1 -0
- package/src/locales/sk.ts +1 -0
- package/src/locales/sr-Cyrl-RS.ts +1 -0
- package/src/locales/sr-Latn-RS.ts +1 -0
- package/src/locales/sv.ts +1 -0
- package/src/locales/tr.ts +1 -0
- package/src/locales/uk.ts +1 -0
- package/src/locales/vi.ts +1 -0
- package/src/locales/zh-Hans.ts +1 -0
- package/src/locales/zh-Hant.ts +1 -0
- package/src/types.ts +10 -4
- package/src/utils/column.utils.ts +4 -6
- package/src/utils/displayColumn.utils.ts +1 -1
- package/src/utils/row.utils.ts +179 -21
- package/locales/am/index.d.ts +0 -3
- package/locales/am/index.esm.d.ts +0 -3
- package/locales/am/index.esm.js +0 -93
- package/locales/am/index.js +0 -97
- package/locales/am/package.json +0 -6
package/dist/index.js
CHANGED
|
@@ -250,13 +250,12 @@ const reorderColumn = (draggedColumn, targetColumn, columnOrder) => {
|
|
|
250
250
|
return newColumnOrder;
|
|
251
251
|
};
|
|
252
252
|
const getDefaultColumnFilterFn = (columnDef) => {
|
|
253
|
-
|
|
254
|
-
if (
|
|
253
|
+
const { filterVariant } = columnDef;
|
|
254
|
+
if (filterVariant === 'multi-select')
|
|
255
255
|
return 'arrIncludesSome';
|
|
256
|
-
if (
|
|
256
|
+
if (filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.includes('range'))
|
|
257
257
|
return 'betweenInclusive';
|
|
258
|
-
if (
|
|
259
|
-
columnDef.filterVariant === 'checkbox')
|
|
258
|
+
if (filterVariant === 'select' || filterVariant === 'checkbox')
|
|
260
259
|
return 'equals';
|
|
261
260
|
return 'fuzzy';
|
|
262
261
|
};
|
|
@@ -359,7 +358,7 @@ const showRowDragColumn = (tableOptions) => {
|
|
|
359
358
|
const showRowExpandColumn = (tableOptions) => {
|
|
360
359
|
const { enableExpanding, enableGrouping, renderDetailPanel, state: { grouping }, } = tableOptions;
|
|
361
360
|
return !!(enableExpanding ||
|
|
362
|
-
(enableGrouping && (grouping ===
|
|
361
|
+
(enableGrouping && (grouping === null || grouping === void 0 ? void 0 : grouping.length)) ||
|
|
363
362
|
renderDetailPanel);
|
|
364
363
|
};
|
|
365
364
|
const showRowActionsColumn = (tableOptions) => {
|
|
@@ -409,16 +408,65 @@ const getDefaultColumnOrderIds = (tableOptions, reset = false) => {
|
|
|
409
408
|
];
|
|
410
409
|
};
|
|
411
410
|
|
|
412
|
-
const
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
(
|
|
416
|
-
|
|
417
|
-
|
|
411
|
+
const fuzzy$1 = (rowA, rowB, columnId) => {
|
|
412
|
+
let dir = 0;
|
|
413
|
+
if (rowA.columnFiltersMeta[columnId]) {
|
|
414
|
+
dir = matchSorterUtils.compareItems(rowA.columnFiltersMeta[columnId], rowB.columnFiltersMeta[columnId]);
|
|
415
|
+
}
|
|
416
|
+
// Provide a fallback for when the item ranks are equal
|
|
417
|
+
return dir === 0
|
|
418
|
+
? reactTable.sortingFns.alphanumeric(rowA, rowB, columnId)
|
|
419
|
+
: dir;
|
|
420
|
+
};
|
|
421
|
+
const MRT_SortingFns = Object.assign(Object.assign({}, reactTable.sortingFns), { fuzzy: fuzzy$1 });
|
|
422
|
+
const rankGlobalFuzzy = (rowA, rowB) => Math.max(...Object.values(rowB.columnFiltersMeta).map((v) => v.rank)) -
|
|
423
|
+
Math.max(...Object.values(rowA.columnFiltersMeta).map((v) => v.rank));
|
|
424
|
+
|
|
425
|
+
const getMRT_Rows = (table, pinnedRowIds = [], all) => {
|
|
426
|
+
const { getBottomRows, getCenterRows, getPrePaginationRowModel, getRowModel, getState, getTopRows, options: { createDisplayMode, enablePagination, enableRowPinning, manualPagination, positionCreatingRow, rowPinningDisplayMode, }, } = table;
|
|
427
|
+
const { creatingRow, pagination } = getState();
|
|
428
|
+
const isRankingRows = getIsRankingRows(table);
|
|
429
|
+
let rows = [];
|
|
430
|
+
if (!isRankingRows) {
|
|
431
|
+
rows =
|
|
432
|
+
!enableRowPinning || (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky'))
|
|
433
|
+
? all
|
|
434
|
+
? getPrePaginationRowModel().rows
|
|
435
|
+
: getRowModel().rows
|
|
436
|
+
: getCenterRows();
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
rows = getPrePaginationRowModel().rows.sort((a, b) => rankGlobalFuzzy(a, b));
|
|
440
|
+
if (enablePagination && !manualPagination && !all) {
|
|
441
|
+
const start = pagination.pageIndex * pagination.pageSize;
|
|
442
|
+
rows = rows.slice(start, start + pagination.pageSize);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
if (enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky'))) {
|
|
446
|
+
rows = [
|
|
447
|
+
...getTopRows().filter((row) => !pinnedRowIds.includes(row.id)),
|
|
448
|
+
...rows,
|
|
449
|
+
...getBottomRows().filter((row) => !pinnedRowIds.includes(row.id)),
|
|
450
|
+
];
|
|
451
|
+
}
|
|
452
|
+
if (positionCreatingRow !== undefined &&
|
|
453
|
+
creatingRow &&
|
|
454
|
+
createDisplayMode === 'row') {
|
|
455
|
+
const creatingRowIndex = !isNaN(+positionCreatingRow)
|
|
456
|
+
? +positionCreatingRow
|
|
457
|
+
: positionCreatingRow === 'top'
|
|
458
|
+
? 0
|
|
459
|
+
: rows.length;
|
|
460
|
+
rows = [
|
|
461
|
+
...rows.slice(0, creatingRowIndex),
|
|
462
|
+
creatingRow,
|
|
463
|
+
...rows.slice(creatingRowIndex),
|
|
464
|
+
];
|
|
465
|
+
}
|
|
466
|
+
return rows;
|
|
418
467
|
};
|
|
419
468
|
const getCanRankRows = (table) => {
|
|
420
|
-
const { getState, options } = table;
|
|
421
|
-
const { enableGlobalFilterRankedResults, manualExpanding, manualFiltering, manualGrouping, manualSorting, } = options;
|
|
469
|
+
const { getState, options: { enableGlobalFilterRankedResults, manualExpanding, manualFiltering, manualGrouping, manualSorting, }, } = table;
|
|
422
470
|
const { expanded, globalFilterFn } = getState();
|
|
423
471
|
return (!manualExpanding &&
|
|
424
472
|
!manualFiltering &&
|
|
@@ -429,17 +477,67 @@ const getCanRankRows = (table) => {
|
|
|
429
477
|
expanded !== true &&
|
|
430
478
|
!Object.values(expanded).some(Boolean));
|
|
431
479
|
};
|
|
480
|
+
const getIsRankingRows = (table) => {
|
|
481
|
+
const { globalFilter, sorting } = table.getState();
|
|
482
|
+
return (getCanRankRows(table) &&
|
|
483
|
+
globalFilter &&
|
|
484
|
+
!Object.values(sorting).some(Boolean));
|
|
485
|
+
};
|
|
486
|
+
const getIsRowSelected = ({ row, table, }) => {
|
|
487
|
+
const { options: { enableRowSelection }, } = table;
|
|
488
|
+
return (row.getIsSelected() ||
|
|
489
|
+
(parseFromValuesOrFunc(enableRowSelection, row) &&
|
|
490
|
+
row.getCanSelectSubRows() &&
|
|
491
|
+
row.getIsAllSubRowsSelected()));
|
|
492
|
+
};
|
|
493
|
+
const getMRT_RowSelectionHandler = () => ({ event, row, staticRowIndex = 0, table, }) => {
|
|
494
|
+
var _a;
|
|
495
|
+
const { getState, options: { enableBatchRowSelection, enableRowPinning, rowPinningDisplayMode, }, refs: { lastSelectedRowId: lastSelectedRowId }, } = table;
|
|
496
|
+
const { pagination: { pageIndex, pageSize }, } = getState();
|
|
497
|
+
const isChecked = getIsRowSelected({ row, table });
|
|
498
|
+
const isStickySelection = enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('select'));
|
|
499
|
+
// toggle selected of this row
|
|
500
|
+
row.getToggleSelectedHandler()(event);
|
|
501
|
+
// if shift key is pressed, select all rows between last selected and this one
|
|
502
|
+
if (enableBatchRowSelection &&
|
|
503
|
+
event.nativeEvent.shiftKey &&
|
|
504
|
+
lastSelectedRowId.current !== null) {
|
|
505
|
+
const rows = getMRT_Rows(table, undefined, true);
|
|
506
|
+
const lastIndex = rows.findIndex((r) => r.id === lastSelectedRowId.current);
|
|
507
|
+
if (lastIndex !== -1) {
|
|
508
|
+
const currentIndex = staticRowIndex + pageSize * pageIndex;
|
|
509
|
+
const [start, end] = lastIndex < currentIndex
|
|
510
|
+
? [lastIndex, currentIndex]
|
|
511
|
+
: [currentIndex, lastIndex];
|
|
512
|
+
for (let i = start; i <= end; i++) {
|
|
513
|
+
rows[i].toggleSelected(!isChecked);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
lastSelectedRowId.current = row.id;
|
|
518
|
+
// if all sub rows were selected, unselect them
|
|
519
|
+
if (row.getCanSelectSubRows() && row.getIsAllSubRowsSelected()) {
|
|
520
|
+
(_a = row.subRows) === null || _a === void 0 ? void 0 : _a.forEach((r) => r.toggleSelected(false));
|
|
521
|
+
}
|
|
522
|
+
if (isStickySelection) {
|
|
523
|
+
row.pin(!row.getIsPinned() && isChecked
|
|
524
|
+
? (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('bottom'))
|
|
525
|
+
? 'bottom'
|
|
526
|
+
: 'top'
|
|
527
|
+
: false);
|
|
528
|
+
}
|
|
529
|
+
};
|
|
432
530
|
|
|
433
531
|
const MRT_AggregationFns = Object.assign({}, reactTable.aggregationFns);
|
|
434
532
|
|
|
435
|
-
const fuzzy
|
|
533
|
+
const fuzzy = (row, columnId, filterValue, addMeta) => {
|
|
436
534
|
const itemRank = matchSorterUtils.rankItem(row.getValue(columnId), filterValue, {
|
|
437
535
|
threshold: matchSorterUtils.rankings.MATCHES,
|
|
438
536
|
});
|
|
439
537
|
addMeta(itemRank);
|
|
440
538
|
return itemRank.passed;
|
|
441
539
|
};
|
|
442
|
-
fuzzy
|
|
540
|
+
fuzzy.autoRemove = (val) => !val;
|
|
443
541
|
const contains = (row, id, filterValue) => row
|
|
444
542
|
.getValue(id)
|
|
445
543
|
.toString()
|
|
@@ -507,7 +605,7 @@ const MRT_FilterFns = Object.assign(Object.assign({}, reactTable.filterFns), { b
|
|
|
507
605
|
empty,
|
|
508
606
|
endsWith,
|
|
509
607
|
equals,
|
|
510
|
-
fuzzy
|
|
608
|
+
fuzzy,
|
|
511
609
|
greaterThan,
|
|
512
610
|
greaterThanOrEqualTo,
|
|
513
611
|
lessThan,
|
|
@@ -516,20 +614,6 @@ const MRT_FilterFns = Object.assign(Object.assign({}, reactTable.filterFns), { b
|
|
|
516
614
|
notEquals,
|
|
517
615
|
startsWith });
|
|
518
616
|
|
|
519
|
-
const fuzzy = (rowA, rowB, columnId) => {
|
|
520
|
-
let dir = 0;
|
|
521
|
-
if (rowA.columnFiltersMeta[columnId]) {
|
|
522
|
-
dir = matchSorterUtils.compareItems(rowA.columnFiltersMeta[columnId], rowB.columnFiltersMeta[columnId]);
|
|
523
|
-
}
|
|
524
|
-
// Provide a fallback for when the item ranks are equal
|
|
525
|
-
return dir === 0
|
|
526
|
-
? reactTable.sortingFns.alphanumeric(rowA, rowB, columnId)
|
|
527
|
-
: dir;
|
|
528
|
-
};
|
|
529
|
-
const MRT_SortingFns = Object.assign(Object.assign({}, reactTable.sortingFns), { fuzzy });
|
|
530
|
-
const rankGlobalFuzzy = (rowA, rowB) => Math.max(...Object.values(rowB.columnFiltersMeta).map((v) => v.rank)) -
|
|
531
|
-
Math.max(...Object.values(rowA.columnFiltersMeta).map((v) => v.rank));
|
|
532
|
-
|
|
533
617
|
/******************************************************************************
|
|
534
618
|
Copyright (c) Microsoft Corporation.
|
|
535
619
|
|
|
@@ -785,19 +869,18 @@ const getMRT_RowActionsColumnDef = (tableOptions) => {
|
|
|
785
869
|
|
|
786
870
|
const MRT_GrabHandleButton = (_a) => {
|
|
787
871
|
var _b, _c;
|
|
788
|
-
var {
|
|
872
|
+
var { location, table } = _a, rest = __rest(_a, ["location", "table"]);
|
|
789
873
|
const { options: { icons: { DragHandleIcon }, localization, }, } = table;
|
|
790
|
-
|
|
791
|
-
return (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, getCommonTooltipProps('top'), { title: (_b = _iconButtonProps === null || _iconButtonProps === void 0 ? void 0 : _iconButtonProps.title) !== null && _b !== void 0 ? _b : localization.move, children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": (_c = _iconButtonProps.title) !== null && _c !== void 0 ? _c : localization.move, disableRipple: true, draggable: "true", size: "small" }, _iconButtonProps, { onClick: (e) => {
|
|
874
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, getCommonTooltipProps('top'), { title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.move, children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": (_c = rest.title) !== null && _c !== void 0 ? _c : localization.move, disableRipple: true, draggable: "true", size: "small" }, rest, { onClick: (e) => {
|
|
792
875
|
var _a;
|
|
793
876
|
e.stopPropagation();
|
|
794
|
-
(_a =
|
|
795
|
-
},
|
|
877
|
+
(_a = rest === null || rest === void 0 ? void 0 : rest.onClick) === null || _a === void 0 ? void 0 : _a.call(rest, e);
|
|
878
|
+
}, sx: (theme) => (Object.assign({ '&:active': {
|
|
796
879
|
cursor: 'grabbing',
|
|
797
880
|
}, '&:hover': {
|
|
798
881
|
backgroundColor: 'transparent',
|
|
799
882
|
opacity: 1,
|
|
800
|
-
}, cursor: 'grab', m: '0 -0.1rem', opacity: location === 'row' ? 1 : 0.
|
|
883
|
+
}, cursor: 'grab', m: '0 -0.1rem', opacity: location === 'row' ? 1 : 0.5, p: '2px', transition: 'all 150ms ease-in-out' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), title: undefined, children: jsxRuntime.jsx(DragHandleIcon, {}) })) })));
|
|
801
884
|
};
|
|
802
885
|
|
|
803
886
|
const MRT_TableBodyRowGrabHandle = (_a) => {
|
|
@@ -824,7 +907,7 @@ const MRT_TableBodyRowGrabHandle = (_a) => {
|
|
|
824
907
|
table.setDraggingRow(null);
|
|
825
908
|
table.setHoveredRow(null);
|
|
826
909
|
};
|
|
827
|
-
return (jsxRuntime.jsx(MRT_GrabHandleButton, { iconButtonProps
|
|
910
|
+
return (jsxRuntime.jsx(MRT_GrabHandleButton, Object.assign({}, iconButtonProps, { location: "row", onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })));
|
|
828
911
|
};
|
|
829
912
|
|
|
830
913
|
const getMRT_RowDragColumnDef = (tableOptions) => {
|
|
@@ -988,36 +1071,25 @@ const getMRT_RowPinningColumnDef = (tableOptions) => {
|
|
|
988
1071
|
const MRT_SelectCheckbox = (_a) => {
|
|
989
1072
|
var _b;
|
|
990
1073
|
var { row, staticRowIndex, table } = _a, rest = __rest(_a, ["row", "staticRowIndex", "table"]);
|
|
991
|
-
const { getState, options: { enableMultiRowSelection, enableRowPinning, localization, muiSelectAllCheckboxProps, muiSelectCheckboxProps, rowPinningDisplayMode, selectAllMode, }, } = table;
|
|
1074
|
+
const { getState, options: { enableMultiRowSelection, enableRowPinning, localization, muiSelectAllCheckboxProps, muiSelectCheckboxProps, rowPinningDisplayMode, selectAllMode, }, refs: { lastSelectedRowId }, } = table;
|
|
992
1075
|
const { density, isLoading } = getState();
|
|
993
1076
|
const selectAll = !row;
|
|
994
|
-
const checkboxProps = Object.assign(Object.assign({}, (!row
|
|
995
|
-
? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
|
|
996
|
-
: parseFromValuesOrFunc(muiSelectCheckboxProps, {
|
|
997
|
-
row,
|
|
998
|
-
staticRowIndex,
|
|
999
|
-
table,
|
|
1000
|
-
}))), rest);
|
|
1001
1077
|
const isStickySelection = enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('select'));
|
|
1002
1078
|
const allRowsSelected = selectAll
|
|
1003
1079
|
? selectAllMode === 'page'
|
|
1004
1080
|
? table.getIsAllPageRowsSelected()
|
|
1005
1081
|
: table.getIsAllRowsSelected()
|
|
1006
1082
|
: undefined;
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
: 'top'
|
|
1018
|
-
: false);
|
|
1019
|
-
}
|
|
1020
|
-
};
|
|
1083
|
+
const isChecked = selectAll
|
|
1084
|
+
? allRowsSelected
|
|
1085
|
+
: getIsRowSelected({ row, table });
|
|
1086
|
+
const checkboxProps = Object.assign(Object.assign({}, (selectAll
|
|
1087
|
+
? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
|
|
1088
|
+
: parseFromValuesOrFunc(muiSelectCheckboxProps, {
|
|
1089
|
+
row,
|
|
1090
|
+
table,
|
|
1091
|
+
}))), rest);
|
|
1092
|
+
const onSelectionChange = getMRT_RowSelectionHandler();
|
|
1021
1093
|
const onSelectAllChange = (event) => {
|
|
1022
1094
|
selectAllMode === 'all'
|
|
1023
1095
|
? table.getToggleAllRowsSelectedHandler()(event)
|
|
@@ -1025,16 +1097,19 @@ const MRT_SelectCheckbox = (_a) => {
|
|
|
1025
1097
|
if (isStickySelection) {
|
|
1026
1098
|
table.setRowPinning({ bottom: [], top: [] });
|
|
1027
1099
|
}
|
|
1100
|
+
lastSelectedRowId.current = null;
|
|
1028
1101
|
};
|
|
1029
1102
|
const commonProps = Object.assign(Object.assign({ 'aria-label': selectAll
|
|
1030
1103
|
? localization.toggleSelectAll
|
|
1031
|
-
: localization.toggleSelectRow, checked:
|
|
1104
|
+
: localization.toggleSelectRow, checked: isChecked, disabled: isLoading || (row && !row.getCanSelect()) || (row === null || row === void 0 ? void 0 : row.id) === 'mrt-row-create', inputProps: {
|
|
1032
1105
|
'aria-label': selectAll
|
|
1033
1106
|
? localization.toggleSelectAll
|
|
1034
1107
|
: localization.toggleSelectRow,
|
|
1035
1108
|
}, onChange: (event) => {
|
|
1036
1109
|
event.stopPropagation();
|
|
1037
|
-
row
|
|
1110
|
+
row
|
|
1111
|
+
? onSelectionChange({ event, row, staticRowIndex, table })
|
|
1112
|
+
: onSelectAllChange(event);
|
|
1038
1113
|
}, size: (density === 'compact' ? 'small' : 'medium') }, checkboxProps), { onClick: (e) => {
|
|
1039
1114
|
var _a;
|
|
1040
1115
|
e.stopPropagation();
|
|
@@ -1104,6 +1179,7 @@ const MRT_Localization_EN = {
|
|
|
1104
1179
|
changeSearchMode: 'Change search mode',
|
|
1105
1180
|
clearFilter: 'Clear filter',
|
|
1106
1181
|
clearSearch: 'Clear search',
|
|
1182
|
+
clearSelection: 'Clear selection',
|
|
1107
1183
|
clearSort: 'Clear sort',
|
|
1108
1184
|
clickToCopy: 'Click to copy',
|
|
1109
1185
|
copy: 'Copy',
|
|
@@ -1211,7 +1287,7 @@ const MRT_DefaultDisplayColumn = {
|
|
|
1211
1287
|
};
|
|
1212
1288
|
const useMRT_TableOptions = (_a) => {
|
|
1213
1289
|
var _b;
|
|
1214
|
-
var { aggregationFns, autoResetExpanded = false, columnFilterDisplayMode = 'subheader', columnResizeDirection, columnResizeMode = 'onChange', createDisplayMode = 'modal', defaultColumn, defaultDisplayColumn, editDisplayMode = 'modal', 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, 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, 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", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnPinning", "enableColumnResizing", "enableColumnVirtualization", "enableDensityToggle", "enableExpandAll", "enableExpanding", "enableFacetedValues", "enableFilterMatchHighlighting", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enableRowPinning", "enableRowSelection", "enableRowVirtualization", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "paginationDisplayMode", "positionActionsColumn", "positionCreatingRow", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberDisplayMode", "rowPinningDisplayMode", "selectAllMode", "sortingFns"]);
|
|
1290
|
+
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, 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, 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", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enableRowPinning", "enableRowSelection", "enableRowVirtualization", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "paginationDisplayMode", "positionActionsColumn", "positionCreatingRow", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberDisplayMode", "rowPinningDisplayMode", "selectAllMode", "sortingFns"]);
|
|
1215
1291
|
const theme = styles.useTheme();
|
|
1216
1292
|
icons = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
|
|
1217
1293
|
localization = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
|
|
@@ -1252,6 +1328,7 @@ const useMRT_TableOptions = (_a) => {
|
|
|
1252
1328
|
defaultColumn,
|
|
1253
1329
|
defaultDisplayColumn,
|
|
1254
1330
|
editDisplayMode,
|
|
1331
|
+
enableBatchRowSelection,
|
|
1255
1332
|
enableBottomToolbar,
|
|
1256
1333
|
enableColumnActions,
|
|
1257
1334
|
enableColumnFilters,
|
|
@@ -1334,7 +1411,6 @@ const useMRT_Effects = (table) => {
|
|
|
1334
1411
|
const totalColumnCount = table.options.columns.length;
|
|
1335
1412
|
const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
|
|
1336
1413
|
const rerender = react.useReducer(() => ({}), {})[1];
|
|
1337
|
-
const isMounted = react.useRef(false);
|
|
1338
1414
|
const initialBodyHeight = react.useRef();
|
|
1339
1415
|
const previousTop = react.useRef();
|
|
1340
1416
|
react.useEffect(() => {
|
|
@@ -1342,11 +1418,12 @@ const useMRT_Effects = (table) => {
|
|
|
1342
1418
|
initialBodyHeight.current = document.body.style.height;
|
|
1343
1419
|
}
|
|
1344
1420
|
}, []);
|
|
1421
|
+
//hide scrollbars when table is in full screen mode, preserve body scroll position after full screen exit
|
|
1345
1422
|
react.useEffect(() => {
|
|
1346
|
-
if (
|
|
1423
|
+
if (typeof window !== 'undefined') {
|
|
1347
1424
|
if (isFullScreen) {
|
|
1348
1425
|
previousTop.current = document.body.getBoundingClientRect().top; //save scroll position
|
|
1349
|
-
document.body.style.height = '
|
|
1426
|
+
document.body.style.height = '100dvh'; //hide page scrollbars when table is in full screen mode
|
|
1350
1427
|
}
|
|
1351
1428
|
else {
|
|
1352
1429
|
document.body.style.height = initialBodyHeight.current;
|
|
@@ -1359,8 +1436,13 @@ const useMRT_Effects = (table) => {
|
|
|
1359
1436
|
});
|
|
1360
1437
|
}
|
|
1361
1438
|
}
|
|
1362
|
-
isMounted.current = true;
|
|
1363
1439
|
}, [isFullScreen]);
|
|
1440
|
+
//recalculate column order when columns change or features are toggled on/off
|
|
1441
|
+
react.useEffect(() => {
|
|
1442
|
+
if (totalColumnCount !== columnOrder.length) {
|
|
1443
|
+
table.setColumnOrder(getDefaultColumnOrderIds(table.options));
|
|
1444
|
+
}
|
|
1445
|
+
}, [totalColumnCount]);
|
|
1364
1446
|
//if page index is out of bounds, set it to the last page
|
|
1365
1447
|
react.useEffect(() => {
|
|
1366
1448
|
if (!enablePagination || isLoading || showSkeletons)
|
|
@@ -1388,6 +1470,7 @@ const useMRT_Effects = (table) => {
|
|
|
1388
1470
|
table.setSorting(() => appliedSort.current || []);
|
|
1389
1471
|
}
|
|
1390
1472
|
}, [globalFilter]);
|
|
1473
|
+
//fix pinned row top style when density changes
|
|
1391
1474
|
react.useEffect(() => {
|
|
1392
1475
|
if (enableRowPinning && getIsSomeRowsPinned()) {
|
|
1393
1476
|
setTimeout(() => {
|
|
@@ -1395,12 +1478,6 @@ const useMRT_Effects = (table) => {
|
|
|
1395
1478
|
}, 150);
|
|
1396
1479
|
}
|
|
1397
1480
|
}, [density]);
|
|
1398
|
-
//recalculate column order when columns change or features are toggled on/off
|
|
1399
|
-
react.useEffect(() => {
|
|
1400
|
-
if (totalColumnCount !== columnOrder.length) {
|
|
1401
|
-
table.setColumnOrder(getDefaultColumnOrderIds(table.options));
|
|
1402
|
-
}
|
|
1403
|
-
}, [totalColumnCount]);
|
|
1404
1481
|
};
|
|
1405
1482
|
|
|
1406
1483
|
/**
|
|
@@ -1410,6 +1487,7 @@ const useMRT_Effects = (table) => {
|
|
|
1410
1487
|
*/
|
|
1411
1488
|
const useMRT_TableInstance = (definedTableOptions) => {
|
|
1412
1489
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10;
|
|
1490
|
+
const lastSelectedRowId = react.useRef(null);
|
|
1413
1491
|
const actionCellRef = react.useRef(null);
|
|
1414
1492
|
const bottomToolbarRef = react.useRef(null);
|
|
1415
1493
|
const editInputRefs = react.useRef({});
|
|
@@ -1536,6 +1614,7 @@ const useMRT_TableInstance = (definedTableOptions) => {
|
|
|
1536
1614
|
bottomToolbarRef,
|
|
1537
1615
|
editInputRefs,
|
|
1538
1616
|
filterInputRefs,
|
|
1617
|
+
lastSelectedRowId,
|
|
1539
1618
|
searchInputRef,
|
|
1540
1619
|
tableContainerRef,
|
|
1541
1620
|
tableFooterRef,
|
|
@@ -1691,71 +1770,26 @@ const useMRT_RowVirtualizer = (table, rows) => {
|
|
|
1691
1770
|
};
|
|
1692
1771
|
|
|
1693
1772
|
const useMRT_Rows = (table, pinnedRowIds = []) => {
|
|
1694
|
-
const {
|
|
1773
|
+
const { getRowModel, getState, options: { data, enableGlobalFilterRankedResults, positionCreatingRow }, } = table;
|
|
1695
1774
|
const { creatingRow, expanded, globalFilter, pagination, rowPinning, sorting, } = getState();
|
|
1696
|
-
const
|
|
1697
|
-
|
|
1698
|
-
|
|
1775
|
+
const rows = react.useMemo(() => getMRT_Rows(table, pinnedRowIds), [
|
|
1776
|
+
creatingRow,
|
|
1777
|
+
data,
|
|
1699
1778
|
enableGlobalFilterRankedResults,
|
|
1700
1779
|
expanded,
|
|
1780
|
+
getRowModel().rows,
|
|
1701
1781
|
globalFilter,
|
|
1702
|
-
manualExpanding,
|
|
1703
|
-
manualFiltering,
|
|
1704
|
-
manualGrouping,
|
|
1705
|
-
manualSorting,
|
|
1706
|
-
sorting,
|
|
1707
|
-
]);
|
|
1708
|
-
const rows = react.useMemo(() => {
|
|
1709
|
-
let rows = [];
|
|
1710
|
-
if (!shouldRankRows) {
|
|
1711
|
-
rows =
|
|
1712
|
-
!enableRowPinning || (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky'))
|
|
1713
|
-
? getRowModel().rows
|
|
1714
|
-
: getCenterRows();
|
|
1715
|
-
}
|
|
1716
|
-
else {
|
|
1717
|
-
rows = getPrePaginationRowModel().rows.sort((a, b) => rankGlobalFuzzy(a, b));
|
|
1718
|
-
if (enablePagination && !manualPagination) {
|
|
1719
|
-
const start = pagination.pageIndex * pagination.pageSize;
|
|
1720
|
-
rows = rows.slice(start, start + pagination.pageSize);
|
|
1721
|
-
}
|
|
1722
|
-
}
|
|
1723
|
-
if (enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky'))) {
|
|
1724
|
-
rows = [
|
|
1725
|
-
...getTopRows().filter((row) => !pinnedRowIds.includes(row.id)),
|
|
1726
|
-
...rows,
|
|
1727
|
-
...getBottomRows().filter((row) => !pinnedRowIds.includes(row.id)),
|
|
1728
|
-
];
|
|
1729
|
-
}
|
|
1730
|
-
if (positionCreatingRow !== undefined &&
|
|
1731
|
-
creatingRow &&
|
|
1732
|
-
createDisplayMode === 'row') {
|
|
1733
|
-
const creatingRowIndex = !isNaN(+positionCreatingRow)
|
|
1734
|
-
? +positionCreatingRow
|
|
1735
|
-
: positionCreatingRow === 'top'
|
|
1736
|
-
? 0
|
|
1737
|
-
: rows.length;
|
|
1738
|
-
rows = [
|
|
1739
|
-
...rows.slice(0, creatingRowIndex),
|
|
1740
|
-
creatingRow,
|
|
1741
|
-
...rows.slice(creatingRowIndex),
|
|
1742
|
-
];
|
|
1743
|
-
}
|
|
1744
|
-
return rows;
|
|
1745
|
-
}, [
|
|
1746
|
-
creatingRow,
|
|
1747
1782
|
pagination.pageIndex,
|
|
1748
1783
|
pagination.pageSize,
|
|
1749
1784
|
positionCreatingRow,
|
|
1750
1785
|
rowPinning,
|
|
1751
|
-
|
|
1752
|
-
shouldRankRows,
|
|
1786
|
+
sorting,
|
|
1753
1787
|
]);
|
|
1754
1788
|
return rows;
|
|
1755
1789
|
};
|
|
1756
1790
|
|
|
1757
1791
|
const allowedTypes = ['string', 'number'];
|
|
1758
|
-
const MRT_TableBodyCellValue = ({ cell, rowRef, staticRowIndex, table, }) => {
|
|
1792
|
+
const MRT_TableBodyCellValue = ({ cell, rowRef, staticColumnIndex, staticRowIndex, table, }) => {
|
|
1759
1793
|
var _a, _b, _c;
|
|
1760
1794
|
const { getState, options: { enableFilterMatchHighlighting }, } = table;
|
|
1761
1795
|
const { column, row } = cell;
|
|
@@ -1818,6 +1852,7 @@ const MRT_TableBodyCellValue = ({ cell, rowRef, staticRowIndex, table, }) => {
|
|
|
1818
1852
|
renderedCellValue,
|
|
1819
1853
|
row,
|
|
1820
1854
|
rowRef,
|
|
1855
|
+
staticColumnIndex,
|
|
1821
1856
|
staticRowIndex,
|
|
1822
1857
|
table,
|
|
1823
1858
|
});
|
|
@@ -2104,6 +2139,7 @@ const MRT_TableBodyCell = (_a) => {
|
|
|
2104
2139
|
renderedCellValue: cell.renderValue(),
|
|
2105
2140
|
row,
|
|
2106
2141
|
rowRef,
|
|
2142
|
+
staticColumnIndex,
|
|
2107
2143
|
staticRowIndex,
|
|
2108
2144
|
table,
|
|
2109
2145
|
})) : isCreating || isEditing ? (jsxRuntime.jsx(MRT_EditCellTextField, { cell: cell, table: table })) : showClickToCopyButton && columnDef.enableClickToCopy !== false ? (jsxRuntime.jsx(MRT_CopyButton, { cell: cell, table: table, children: jsxRuntime.jsx(MRT_TableBodyCellValue, Object.assign({}, cellValueProps)) })) : (jsxRuntime.jsx(MRT_TableBodyCellValue, Object.assign({}, cellValueProps))), cell.getIsGrouped() && !columnDef.GroupedCell && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [" (", (_f = row.subRows) === null || _f === void 0 ? void 0 : _f.length, ")"] }))] })) })));
|
|
@@ -2144,8 +2180,9 @@ const MRT_TableDetailPanel = (_a) => {
|
|
|
2144
2180
|
: undefined, width: `100%` }, parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme))), children: enableRowVirtualization ? (row.getIsExpanded() && DetailPanel) : (jsxRuntime.jsx(Collapse__default["default"], { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true, children: DetailPanel })) })) })));
|
|
2145
2181
|
};
|
|
2146
2182
|
|
|
2147
|
-
const MRT_TableBodyRow = (
|
|
2148
|
-
var
|
|
2183
|
+
const MRT_TableBodyRow = (_a) => {
|
|
2184
|
+
var _b, _c, _d, _f;
|
|
2185
|
+
var { columnVirtualizer, numRows, pinnedRowIds, row, rowVirtualizer, staticRowIndex, table, virtualRow } = _a, rest = __rest(_a, ["columnVirtualizer", "numRows", "pinnedRowIds", "row", "rowVirtualizer", "staticRowIndex", "table", "virtualRow"]);
|
|
2149
2186
|
const theme = styles.useTheme();
|
|
2150
2187
|
const { getState, options: { enableRowOrdering, enableRowPinning, enableStickyFooter, enableStickyHeader, layoutMode, memoMode, muiTableBodyRowProps, renderDetailPanel, rowPinningDisplayMode, }, refs: { tableFooterRef, tableHeadRef }, setHoveredRow, } = table;
|
|
2151
2188
|
const { density, draggingColumn, draggingRow, editingCell, editingRow, hoveredRow, isFullScreen, rowPinning, } = getState();
|
|
@@ -2155,11 +2192,11 @@ const MRT_TableBodyRow = ({ columnVirtualizer, numRows, pinnedRowIds, row, rowVi
|
|
|
2155
2192
|
const isRowPinned = enableRowPinning && row.getIsPinned();
|
|
2156
2193
|
const isDraggingRow = (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id;
|
|
2157
2194
|
const isHoveredRow = (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id;
|
|
2158
|
-
const tableRowProps = parseFromValuesOrFunc(muiTableBodyRowProps, {
|
|
2195
|
+
const tableRowProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableBodyRowProps, {
|
|
2159
2196
|
row,
|
|
2160
2197
|
staticRowIndex,
|
|
2161
2198
|
table,
|
|
2162
|
-
});
|
|
2199
|
+
})), rest);
|
|
2163
2200
|
const [bottomPinnedIndex, topPinnedIndex] = react.useMemo(() => {
|
|
2164
2201
|
if (!enableRowPinning ||
|
|
2165
2202
|
!(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) ||
|
|
@@ -2172,14 +2209,14 @@ const MRT_TableBodyRow = ({ columnVirtualizer, numRows, pinnedRowIds, row, rowVi
|
|
|
2172
2209
|
];
|
|
2173
2210
|
}, [pinnedRowIds, rowPinning]);
|
|
2174
2211
|
const tableHeadHeight = ((enableStickyHeader || isFullScreen) &&
|
|
2175
|
-
((
|
|
2212
|
+
((_b = tableHeadRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight)) ||
|
|
2176
2213
|
0;
|
|
2177
|
-
const tableFooterHeight = (enableStickyFooter && ((
|
|
2214
|
+
const tableFooterHeight = (enableStickyFooter && ((_c = tableFooterRef.current) === null || _c === void 0 ? void 0 : _c.clientHeight)) || 0;
|
|
2178
2215
|
const sx = parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme);
|
|
2179
2216
|
const defaultRowHeight = density === 'compact' ? 37 : density === 'comfortable' ? 53 : 69;
|
|
2180
2217
|
const customRowHeight =
|
|
2181
2218
|
// @ts-ignore
|
|
2182
|
-
parseInt((
|
|
2219
|
+
parseInt((_f = (_d = tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style) === null || _d === void 0 ? void 0 : _d.height) !== null && _f !== void 0 ? _f : sx === null || sx === void 0 ? void 0 : sx.height, 10) || undefined;
|
|
2183
2220
|
const rowHeight = customRowHeight || defaultRowHeight;
|
|
2184
2221
|
const handleDragEnter = (_e) => {
|
|
2185
2222
|
if (enableRowOrdering && draggingRow) {
|
|
@@ -2369,8 +2406,9 @@ const MRT_TableFooterRow = (_a) => {
|
|
|
2369
2406
|
// if no content in row, skip row
|
|
2370
2407
|
if (!((_b = footerGroup.headers) === null || _b === void 0 ? void 0 : _b.some((header) => (typeof header.column.columnDef.footer === 'string' &&
|
|
2371
2408
|
!!header.column.columnDef.footer) ||
|
|
2372
|
-
header.column.columnDef.Footer)))
|
|
2409
|
+
header.column.columnDef.Footer))) {
|
|
2373
2410
|
return null;
|
|
2411
|
+
}
|
|
2374
2412
|
const tableRowProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterRowProps, {
|
|
2375
2413
|
footerGroup,
|
|
2376
2414
|
table,
|
|
@@ -2612,7 +2650,7 @@ const MRT_FilterOptionMenu = (_a) => {
|
|
|
2612
2650
|
const MRT_ColumnActionMenu = (_a) => {
|
|
2613
2651
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
2614
2652
|
var { anchorEl, header, setAnchorEl, table } = _a, rest = __rest(_a, ["anchorEl", "header", "setAnchorEl", "table"]);
|
|
2615
|
-
const {
|
|
2653
|
+
const { getAllLeafColumns, getState, options: { columnFilterDisplayMode, columnFilterModeOptions, enableColumnFilterModes, enableColumnFilters, enableColumnPinning, enableColumnResizing, enableGrouping, enableHiding, enableSorting, enableSortingRemoval, icons: { ClearAllIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, RestartAltIcon, SortIcon, ViewColumnIcon, VisibilityOffIcon, }, localization, renderColumnActionsMenuItems, }, refs: { filterInputRefs }, setColumnFilterFns, setColumnOrder, setColumnSizingInfo, setShowColumnFilters, } = table;
|
|
2616
2654
|
const { column } = header;
|
|
2617
2655
|
const { columnDef } = column;
|
|
2618
2656
|
const { columnSizing, columnVisibility, density, showColumnFilters } = getState();
|
|
@@ -2860,6 +2898,7 @@ const MRT_FilterTextField = (_a) => {
|
|
|
2860
2898
|
? ((_a = column.getFilterValue()) === null || _a === void 0 ? void 0 : _a[rangeFilterIndex]) || ''
|
|
2861
2899
|
: (_b = column.getFilterValue()) !== null && _b !== void 0 ? _b : '';
|
|
2862
2900
|
});
|
|
2901
|
+
const [autocompleteValue, setAutocompleteValue] = react.useState(isAutocompleteFilter ? filterValue : null);
|
|
2863
2902
|
const handleChangeDebounced = react.useCallback(utils.debounce((newValue) => {
|
|
2864
2903
|
if (isRangeFilter) {
|
|
2865
2904
|
column.setFilterValue((old) => {
|
|
@@ -2886,6 +2925,10 @@ const MRT_FilterTextField = (_a) => {
|
|
|
2886
2925
|
handleChange(newValue);
|
|
2887
2926
|
(_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.onChange) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
|
|
2888
2927
|
};
|
|
2928
|
+
const handleAutocompleteChange = (newValue) => {
|
|
2929
|
+
setAutocompleteValue(newValue);
|
|
2930
|
+
handleChange(getValueAndLabel(newValue).value);
|
|
2931
|
+
};
|
|
2889
2932
|
const handleClear = () => {
|
|
2890
2933
|
if (isMultiSelectFilter) {
|
|
2891
2934
|
setFilterValue([]);
|
|
@@ -3006,10 +3049,10 @@ const MRT_FilterTextField = (_a) => {
|
|
|
3006
3049
|
} }))) : (filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.startsWith('date')) ? (jsxRuntime.jsx(DatePicker.DatePicker, Object.assign({}, commonDatePickerProps, datePickerProps, { slotProps: {
|
|
3007
3050
|
field: Object.assign({ clearable: true, onClear: () => handleClear() }, (_r = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.slotProps) === null || _r === void 0 ? void 0 : _r.field),
|
|
3008
3051
|
textField: Object.assign(Object.assign({}, commonTextFieldProps), (_s = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.slotProps) === null || _s === void 0 ? void 0 : _s.textField),
|
|
3009
|
-
} }))) : isAutocompleteFilter ? (jsxRuntime.jsx(Autocomplete__default["default"], Object.assign({ freeSolo: true, getOptionLabel: (option) => getValueAndLabel(option).label, onChange: (_e, newValue) =>
|
|
3052
|
+
} }))) : isAutocompleteFilter ? (jsxRuntime.jsx(Autocomplete__default["default"], Object.assign({ freeSolo: true, getOptionLabel: (option) => getValueAndLabel(option).label, onChange: (_e, newValue) => handleAutocompleteChange(newValue), options: (_t = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map((option) => getValueAndLabel(option))) !== null && _t !== void 0 ? _t : [] }, autocompleteProps, { renderInput: (builtinTextFieldProps) => {
|
|
3010
3053
|
var _a;
|
|
3011
3054
|
return (jsxRuntime.jsx(TextField__default["default"], Object.assign({}, builtinTextFieldProps, commonTextFieldProps, { InputProps: Object.assign(Object.assign({}, builtinTextFieldProps.InputProps), { startAdornment: (_a = commonTextFieldProps === null || commonTextFieldProps === void 0 ? void 0 : commonTextFieldProps.InputProps) === null || _a === void 0 ? void 0 : _a.startAdornment }), inputProps: Object.assign(Object.assign({}, builtinTextFieldProps.inputProps), commonTextFieldProps === null || commonTextFieldProps === void 0 ? void 0 : commonTextFieldProps.inputProps), onChange: handleTextFieldChange, onClick: (e) => e.stopPropagation() })));
|
|
3012
|
-
}, value:
|
|
3055
|
+
}, value: autocompleteValue }))) : (jsxRuntime.jsx(TextField__default["default"], Object.assign({ select: isSelectFilter || isMultiSelectFilter }, commonTextFieldProps, { SelectProps: Object.assign({ MenuProps: { disableScrollLock: true }, displayEmpty: true, multiple: isMultiSelectFilter, renderValue: isMultiSelectFilter
|
|
3013
3056
|
? (selected) => !(selected === null || selected === void 0 ? void 0 : selected.length) ? (jsxRuntime.jsx(Box__default["default"], { sx: { opacity: 0.5 }, children: filterPlaceholder })) : (jsxRuntime.jsx(Box__default["default"], { sx: { display: 'flex', flexWrap: 'wrap', gap: '2px' }, children: selected === null || selected === void 0 ? void 0 : selected.map((value) => {
|
|
3014
3057
|
const selectedValue = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.find((option) => getValueAndLabel(option).value === value);
|
|
3015
3058
|
return (jsxRuntime.jsx(Chip__default["default"], { label: getValueAndLabel(selectedValue).label }, value));
|
|
@@ -3209,7 +3252,7 @@ const MRT_TableHeadCellGrabHandle = (_a) => {
|
|
|
3209
3252
|
setDraggingColumn(null);
|
|
3210
3253
|
setHoveredColumn(null);
|
|
3211
3254
|
};
|
|
3212
|
-
return (jsxRuntime.jsx(MRT_GrabHandleButton, { iconButtonProps
|
|
3255
|
+
return (jsxRuntime.jsx(MRT_GrabHandleButton, Object.assign({}, iconButtonProps, { onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })));
|
|
3213
3256
|
};
|
|
3214
3257
|
|
|
3215
3258
|
const MRT_TableHeadCellResizeHandle = (_a) => {
|
|
@@ -3431,7 +3474,7 @@ const MRT_TableHeadCell = (_a) => {
|
|
|
3431
3474
|
whiteSpace: ((_h = (_g = columnDef.header) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0) < 20
|
|
3432
3475
|
? 'nowrap'
|
|
3433
3476
|
: 'normal',
|
|
3434
|
-
},
|
|
3477
|
+
}, children: HeaderElement }), column.getCanFilter() && (jsxRuntime.jsx(MRT_TableHeadCellFilterLabel, { header: header, table: table })), column.getCanSort() && (jsxRuntime.jsx(MRT_TableHeadCellSortLabel, { header: header, table: table }))] }), columnDefType !== 'group' && (jsxRuntime.jsxs(Box__default["default"], { className: "Mui-TableHeadCell-Content-Actions", sx: {
|
|
3435
3478
|
whiteSpace: 'nowrap',
|
|
3436
3479
|
}, children: [showDragHandle && (jsxRuntime.jsx(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
|
|
3437
3480
|
current: tableHeadCellRefs.current[column.id],
|
|
@@ -3462,7 +3505,7 @@ const MRT_TableHeadRow = (_a) => {
|
|
|
3462
3505
|
const MRT_ToolbarAlertBanner = (_a) => {
|
|
3463
3506
|
var _b, _c, _d;
|
|
3464
3507
|
var { stackAlertBanner, table } = _a, rest = __rest(_a, ["stackAlertBanner", "table"]);
|
|
3465
|
-
const { getPrePaginationRowModel, getState, options: { enableRowSelection, enableSelectAll, localization, muiToolbarAlertBannerChipProps, muiToolbarAlertBannerProps, positionToolbarAlertBanner, renderToolbarAlertBannerContent, rowCount, }, refs: { tablePaperRef }, } = table;
|
|
3508
|
+
const { getFilteredSelectedRowModel, getPrePaginationRowModel, getState, options: { enableRowSelection, enableSelectAll, localization, manualPagination, muiToolbarAlertBannerChipProps, muiToolbarAlertBannerProps, positionToolbarAlertBanner, renderToolbarAlertBannerContent, rowCount, }, refs: { lastSelectedRowId, tablePaperRef }, } = table;
|
|
3466
3509
|
const { density, grouping, rowSelection, showAlertBanner } = getState();
|
|
3467
3510
|
const alertProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiToolbarAlertBannerProps, {
|
|
3468
3511
|
table,
|
|
@@ -3470,10 +3513,14 @@ const MRT_ToolbarAlertBanner = (_a) => {
|
|
|
3470
3513
|
const chipProps = parseFromValuesOrFunc(muiToolbarAlertBannerChipProps, {
|
|
3471
3514
|
table,
|
|
3472
3515
|
});
|
|
3473
|
-
const
|
|
3474
|
-
const
|
|
3475
|
-
?
|
|
3476
|
-
:
|
|
3516
|
+
const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
|
|
3517
|
+
const selectedRowCount = react.useMemo(() => manualPagination
|
|
3518
|
+
? Object.values(rowSelection).filter(Boolean).length
|
|
3519
|
+
: getFilteredSelectedRowModel().rows.length, [rowSelection, totalRowCount, manualPagination]);
|
|
3520
|
+
const selectedAlert = selectedRowCount > 0 ? (jsxRuntime.jsxs(Stack__default["default"], { alignItems: "center", direction: "row", gap: "16px", children: [(_c = (_b = localization.selectedCountOfRowCountRowsSelected) === null || _b === void 0 ? void 0 : _b.replace('{selectedCount}', selectedRowCount.toLocaleString())) === null || _c === void 0 ? void 0 : _c.replace('{rowCount}', totalRowCount.toString()), jsxRuntime.jsx(Button__default["default"], { onClick: () => {
|
|
3521
|
+
table.toggleAllRowsSelected(false);
|
|
3522
|
+
lastSelectedRowId.current = null;
|
|
3523
|
+
}, size: "small", sx: { p: '2px' }, children: localization.clearSelection })] })) : null;
|
|
3477
3524
|
const groupedAlert = grouping.length > 0 ? (jsxRuntime.jsxs("span", { children: [localization.groupedBy, ' ', grouping.map((columnId, index) => (jsxRuntime.jsxs(react.Fragment, { children: [index > 0 ? localization.thenBy : '', jsxRuntime.jsx(Chip__default["default"], Object.assign({ label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() }, chipProps))] }, `${index}-${columnId}`)))] })) : null;
|
|
3478
3525
|
return (jsxRuntime.jsx(Collapse__default["default"], { in: showAlertBanner || !!selectedAlert || !!groupedAlert, timeout: stackAlertBanner ? 200 : 0, children: jsxRuntime.jsx(Alert__default["default"], Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => {
|
|
3479
3526
|
var _a, _b;
|
|
@@ -3549,6 +3596,7 @@ const MRT_Table = (_a) => {
|
|
|
3549
3596
|
};
|
|
3550
3597
|
|
|
3551
3598
|
const MRT_TableLoadingOverlay = (_a) => {
|
|
3599
|
+
var _b;
|
|
3552
3600
|
var { table } = _a, rest = __rest(_a, ["table"]);
|
|
3553
3601
|
const { options: { localization, muiCircularProgressProps }, } = table;
|
|
3554
3602
|
const circularProgressProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiCircularProgressProps, { table })), rest);
|
|
@@ -3564,8 +3612,8 @@ const MRT_TableLoadingOverlay = (_a) => {
|
|
|
3564
3612
|
right: 0,
|
|
3565
3613
|
top: 0,
|
|
3566
3614
|
width: '100%',
|
|
3567
|
-
zIndex:
|
|
3568
|
-
}), children: jsxRuntime.jsx(CircularProgress__default["default"], Object.assign({ "aria-label": localization.noRecordsToDisplay, id: "mrt-progress" }, circularProgressProps)) }));
|
|
3615
|
+
zIndex: 3,
|
|
3616
|
+
}), children: (_b = circularProgressProps === null || circularProgressProps === void 0 ? void 0 : circularProgressProps.Component) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(CircularProgress__default["default"], Object.assign({ "aria-label": localization.noRecordsToDisplay, id: "mrt-progress" }, circularProgressProps))) }));
|
|
3569
3617
|
};
|
|
3570
3618
|
|
|
3571
3619
|
const MRT_CellActionMenu = (_a) => {
|
|
@@ -3829,7 +3877,7 @@ const MRT_ColumnPinningButtons = (_a) => {
|
|
|
3829
3877
|
|
|
3830
3878
|
const MRT_ShowHideColumnsMenuItems = (_a) => {
|
|
3831
3879
|
var _b;
|
|
3832
|
-
var { allColumns, column, hoveredColumn, setHoveredColumn, table } = _a, rest = __rest(_a, ["allColumns", "column", "hoveredColumn", "setHoveredColumn", "table"]);
|
|
3880
|
+
var { allColumns, column, hoveredColumn, isNestedColumns, setHoveredColumn, table } = _a, rest = __rest(_a, ["allColumns", "column", "hoveredColumn", "isNestedColumns", "setHoveredColumn", "table"]);
|
|
3833
3881
|
const { getState, options: { enableColumnOrdering, enableColumnPinning, enableHiding, localization, }, setColumnOrder, } = table;
|
|
3834
3882
|
const { columnOrder } = getState();
|
|
3835
3883
|
const { columnDef } = column;
|
|
@@ -3884,7 +3932,7 @@ const MRT_ShowHideColumnsMenuItems = (_a) => {
|
|
|
3884
3932
|
gap: '8px',
|
|
3885
3933
|
}, children: [columnDefType !== 'group' &&
|
|
3886
3934
|
enableColumnOrdering &&
|
|
3887
|
-
!
|
|
3935
|
+
!isNestedColumns &&
|
|
3888
3936
|
(columnDef.enableColumnOrdering !== false ? (jsxRuntime.jsx(MRT_GrabHandleButton, { onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })) : (jsxRuntime.jsx(Box__default["default"], { sx: { width: '28px' } }))), enableColumnPinning &&
|
|
3889
3937
|
(column.getCanPin() ? (jsxRuntime.jsx(MRT_ColumnPinningButtons, { column: column, table: table })) : (jsxRuntime.jsx(Box__default["default"], { sx: { width: '70px' } }))), enableHiding ? (jsxRuntime.jsx(FormControlLabel__default["default"], { checked: switchChecked, componentsProps: {
|
|
3890
3938
|
typography: {
|
|
@@ -3893,7 +3941,7 @@ const MRT_ShowHideColumnsMenuItems = (_a) => {
|
|
|
3893
3941
|
opacity: columnDefType !== 'display' ? 1 : 0.5,
|
|
3894
3942
|
},
|
|
3895
3943
|
},
|
|
3896
|
-
}, control: jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, getCommonTooltipProps(), { title: localization.toggleVisibility, children: jsxRuntime.jsx(Switch__default["default"], {}) })), disabled: !column.getCanHide(), label: columnDef.header, onChange: () => handleToggleColumnHidden(column) })) : (jsxRuntime.jsx(Typography__default["default"], { sx: { alignSelf: 'center' }, children: columnDef.header }))] }) })), (_b = column.columns) === null || _b === void 0 ? void 0 : _b.map((c, i) => (jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: c, hoveredColumn: hoveredColumn, setHoveredColumn: setHoveredColumn, table: table }, `${i}-${c.id}`)))] }));
|
|
3944
|
+
}, control: jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, getCommonTooltipProps(), { title: localization.toggleVisibility, children: jsxRuntime.jsx(Switch__default["default"], {}) })), disabled: !column.getCanHide(), label: columnDef.header, onChange: () => handleToggleColumnHidden(column) })) : (jsxRuntime.jsx(Typography__default["default"], { sx: { alignSelf: 'center' }, children: columnDef.header }))] }) })), (_b = column.columns) === null || _b === void 0 ? void 0 : _b.map((c, i) => (jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: c, hoveredColumn: hoveredColumn, isNestedColumns: isNestedColumns, setHoveredColumn: setHoveredColumn, table: table }, `${i}-${c.id}`)))] }));
|
|
3897
3945
|
};
|
|
3898
3946
|
|
|
3899
3947
|
const MRT_ShowHideColumnsMenu = (_a) => {
|
|
@@ -3924,6 +3972,7 @@ const MRT_ShowHideColumnsMenu = (_a) => {
|
|
|
3924
3972
|
getLeftLeafColumns(),
|
|
3925
3973
|
getRightLeafColumns(),
|
|
3926
3974
|
]);
|
|
3975
|
+
const isNestedColumns = allColumns.some((col) => col.columnDef.columnDefType === 'group');
|
|
3927
3976
|
const [hoveredColumn, setHoveredColumn] = react.useState(null);
|
|
3928
3977
|
const theme = styles.useTheme();
|
|
3929
3978
|
const { menuBackgroundColor } = getMRTTheme(table, theme);
|
|
@@ -3937,7 +3986,7 @@ const MRT_ShowHideColumnsMenu = (_a) => {
|
|
|
3937
3986
|
justifyContent: 'space-between',
|
|
3938
3987
|
p: '0.5rem',
|
|
3939
3988
|
pt: 0,
|
|
3940
|
-
}, children: [enableHiding && (jsxRuntime.jsx(Button__default["default"], { disabled: !getIsSomeColumnsVisible(), onClick: () => handleToggleAllColumns(false), children: localization.hideAll })), enableColumnOrdering && (jsxRuntime.jsx(Button__default["default"], { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options, true)), children: localization.resetOrder })), enableColumnPinning && (jsxRuntime.jsx(Button__default["default"], { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true), children: localization.unpinAll })), enableHiding && (jsxRuntime.jsx(Button__default["default"], { disabled: getIsAllColumnsVisible(), onClick: () => handleToggleAllColumns(true), children: localization.showAll }))] }), jsxRuntime.jsx(Divider__default["default"], {}), allColumns.map((column, index) => (jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, setHoveredColumn: setHoveredColumn, table: table }, `${index}-${column.id}`)))] })));
|
|
3989
|
+
}, children: [enableHiding && (jsxRuntime.jsx(Button__default["default"], { disabled: !getIsSomeColumnsVisible(), onClick: () => handleToggleAllColumns(false), children: localization.hideAll })), enableColumnOrdering && (jsxRuntime.jsx(Button__default["default"], { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options, true)), children: localization.resetOrder })), enableColumnPinning && (jsxRuntime.jsx(Button__default["default"], { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true), children: localization.unpinAll })), enableHiding && (jsxRuntime.jsx(Button__default["default"], { disabled: getIsAllColumnsVisible(), onClick: () => handleToggleAllColumns(true), children: localization.showAll }))] }), jsxRuntime.jsx(Divider__default["default"], {}), allColumns.map((column, index) => (jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, isNestedColumns: isNestedColumns, setHoveredColumn: setHoveredColumn, table: table }, `${index}-${column.id}`)))] })));
|
|
3941
3990
|
};
|
|
3942
3991
|
|
|
3943
3992
|
const MRT_ShowHideColumnsButton = (_a) => {
|
|
@@ -4233,8 +4282,11 @@ exports.getIsFirstColumn = getIsFirstColumn;
|
|
|
4233
4282
|
exports.getIsFirstRightPinnedColumn = getIsFirstRightPinnedColumn;
|
|
4234
4283
|
exports.getIsLastColumn = getIsLastColumn;
|
|
4235
4284
|
exports.getIsLastLeftPinnedColumn = getIsLastLeftPinnedColumn;
|
|
4285
|
+
exports.getIsRankingRows = getIsRankingRows;
|
|
4236
4286
|
exports.getIsRowSelected = getIsRowSelected;
|
|
4237
4287
|
exports.getLeadingDisplayColumnIds = getLeadingDisplayColumnIds;
|
|
4288
|
+
exports.getMRT_RowSelectionHandler = getMRT_RowSelectionHandler;
|
|
4289
|
+
exports.getMRT_Rows = getMRT_Rows;
|
|
4238
4290
|
exports.getTotalRight = getTotalRight;
|
|
4239
4291
|
exports.getTrailingDisplayColumnIds = getTrailingDisplayColumnIds;
|
|
4240
4292
|
exports.isCellEditable = isCellEditable;
|