material-react-table 2.10.0 → 2.11.1
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 +213 -154
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +213 -151
- 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 +28 -35
- 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 +196 -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,77 @@ 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, manualPagination, rowPinningDisplayMode, }, refs: { lastSelectedRowId: lastSelectedRowId }, } = table;
|
|
496
|
+
const { pagination: { pageIndex, pageSize }, } = getState();
|
|
497
|
+
const paginationOffset = manualPagination ? 0 : pageSize * pageIndex;
|
|
498
|
+
const isCurrentRowChecked = getIsRowSelected({ row, table });
|
|
499
|
+
const isStickySelection = enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('select'));
|
|
500
|
+
// toggle selection of this row
|
|
501
|
+
row.getToggleSelectedHandler()(event);
|
|
502
|
+
// if shift key is pressed, select all rows between last selected and this one
|
|
503
|
+
if (enableBatchRowSelection &&
|
|
504
|
+
event.nativeEvent.shiftKey &&
|
|
505
|
+
lastSelectedRowId.current !== null) {
|
|
506
|
+
const rows = getMRT_Rows(table, undefined, true);
|
|
507
|
+
const lastIndex = rows.findIndex((r) => r.id === lastSelectedRowId.current);
|
|
508
|
+
if (lastIndex !== -1) {
|
|
509
|
+
const isLastIndexChecked = getIsRowSelected({
|
|
510
|
+
row: rows === null || rows === void 0 ? void 0 : rows[lastIndex],
|
|
511
|
+
table,
|
|
512
|
+
});
|
|
513
|
+
const currentIndex = staticRowIndex + paginationOffset;
|
|
514
|
+
const [start, end] = lastIndex < currentIndex
|
|
515
|
+
? [lastIndex, currentIndex]
|
|
516
|
+
: [currentIndex, lastIndex];
|
|
517
|
+
// toggle selection of all rows between last selected and this one
|
|
518
|
+
// but only if the last selected row is not the same as the current one
|
|
519
|
+
if (isCurrentRowChecked !== isLastIndexChecked) {
|
|
520
|
+
for (let i = start; i <= end; i++) {
|
|
521
|
+
rows[i].toggleSelected(!isCurrentRowChecked);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
// record the last selected row id
|
|
527
|
+
lastSelectedRowId.current = row.id;
|
|
528
|
+
// if all sub rows were selected, unselect them
|
|
529
|
+
if (row.getCanSelectSubRows() && row.getIsAllSubRowsSelected()) {
|
|
530
|
+
(_a = row.subRows) === null || _a === void 0 ? void 0 : _a.forEach((r) => r.toggleSelected(false));
|
|
531
|
+
}
|
|
532
|
+
if (isStickySelection) {
|
|
533
|
+
row.pin(!row.getIsPinned() && isCurrentRowChecked
|
|
534
|
+
? (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('bottom'))
|
|
535
|
+
? 'bottom'
|
|
536
|
+
: 'top'
|
|
537
|
+
: false);
|
|
538
|
+
}
|
|
539
|
+
};
|
|
432
540
|
|
|
433
541
|
const MRT_AggregationFns = Object.assign({}, reactTable.aggregationFns);
|
|
434
542
|
|
|
435
|
-
const fuzzy
|
|
543
|
+
const fuzzy = (row, columnId, filterValue, addMeta) => {
|
|
436
544
|
const itemRank = matchSorterUtils.rankItem(row.getValue(columnId), filterValue, {
|
|
437
545
|
threshold: matchSorterUtils.rankings.MATCHES,
|
|
438
546
|
});
|
|
439
547
|
addMeta(itemRank);
|
|
440
548
|
return itemRank.passed;
|
|
441
549
|
};
|
|
442
|
-
fuzzy
|
|
550
|
+
fuzzy.autoRemove = (val) => !val;
|
|
443
551
|
const contains = (row, id, filterValue) => row
|
|
444
552
|
.getValue(id)
|
|
445
553
|
.toString()
|
|
@@ -507,7 +615,7 @@ const MRT_FilterFns = Object.assign(Object.assign({}, reactTable.filterFns), { b
|
|
|
507
615
|
empty,
|
|
508
616
|
endsWith,
|
|
509
617
|
equals,
|
|
510
|
-
fuzzy
|
|
618
|
+
fuzzy,
|
|
511
619
|
greaterThan,
|
|
512
620
|
greaterThanOrEqualTo,
|
|
513
621
|
lessThan,
|
|
@@ -516,20 +624,6 @@ const MRT_FilterFns = Object.assign(Object.assign({}, reactTable.filterFns), { b
|
|
|
516
624
|
notEquals,
|
|
517
625
|
startsWith });
|
|
518
626
|
|
|
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
627
|
/******************************************************************************
|
|
534
628
|
Copyright (c) Microsoft Corporation.
|
|
535
629
|
|
|
@@ -785,19 +879,18 @@ const getMRT_RowActionsColumnDef = (tableOptions) => {
|
|
|
785
879
|
|
|
786
880
|
const MRT_GrabHandleButton = (_a) => {
|
|
787
881
|
var _b, _c;
|
|
788
|
-
var {
|
|
882
|
+
var { location, table } = _a, rest = __rest(_a, ["location", "table"]);
|
|
789
883
|
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) => {
|
|
884
|
+
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
885
|
var _a;
|
|
793
886
|
e.stopPropagation();
|
|
794
|
-
(_a =
|
|
795
|
-
},
|
|
887
|
+
(_a = rest === null || rest === void 0 ? void 0 : rest.onClick) === null || _a === void 0 ? void 0 : _a.call(rest, e);
|
|
888
|
+
}, sx: (theme) => (Object.assign({ '&:active': {
|
|
796
889
|
cursor: 'grabbing',
|
|
797
890
|
}, '&:hover': {
|
|
798
891
|
backgroundColor: 'transparent',
|
|
799
892
|
opacity: 1,
|
|
800
|
-
}, cursor: 'grab', m: '0 -0.1rem', opacity: location === 'row' ? 1 : 0.
|
|
893
|
+
}, 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
894
|
};
|
|
802
895
|
|
|
803
896
|
const MRT_TableBodyRowGrabHandle = (_a) => {
|
|
@@ -824,7 +917,7 @@ const MRT_TableBodyRowGrabHandle = (_a) => {
|
|
|
824
917
|
table.setDraggingRow(null);
|
|
825
918
|
table.setHoveredRow(null);
|
|
826
919
|
};
|
|
827
|
-
return (jsxRuntime.jsx(MRT_GrabHandleButton, { iconButtonProps
|
|
920
|
+
return (jsxRuntime.jsx(MRT_GrabHandleButton, Object.assign({}, iconButtonProps, { location: "row", onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })));
|
|
828
921
|
};
|
|
829
922
|
|
|
830
923
|
const getMRT_RowDragColumnDef = (tableOptions) => {
|
|
@@ -988,36 +1081,25 @@ const getMRT_RowPinningColumnDef = (tableOptions) => {
|
|
|
988
1081
|
const MRT_SelectCheckbox = (_a) => {
|
|
989
1082
|
var _b;
|
|
990
1083
|
var { row, staticRowIndex, table } = _a, rest = __rest(_a, ["row", "staticRowIndex", "table"]);
|
|
991
|
-
const { getState, options: { enableMultiRowSelection, enableRowPinning, localization, muiSelectAllCheckboxProps, muiSelectCheckboxProps, rowPinningDisplayMode, selectAllMode, }, } = table;
|
|
1084
|
+
const { getState, options: { enableMultiRowSelection, enableRowPinning, localization, muiSelectAllCheckboxProps, muiSelectCheckboxProps, rowPinningDisplayMode, selectAllMode, }, refs: { lastSelectedRowId }, } = table;
|
|
992
1085
|
const { density, isLoading } = getState();
|
|
993
1086
|
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
1087
|
const isStickySelection = enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('select'));
|
|
1002
1088
|
const allRowsSelected = selectAll
|
|
1003
1089
|
? selectAllMode === 'page'
|
|
1004
1090
|
? table.getIsAllPageRowsSelected()
|
|
1005
1091
|
: table.getIsAllRowsSelected()
|
|
1006
1092
|
: undefined;
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
: 'top'
|
|
1018
|
-
: false);
|
|
1019
|
-
}
|
|
1020
|
-
};
|
|
1093
|
+
const isChecked = selectAll
|
|
1094
|
+
? allRowsSelected
|
|
1095
|
+
: getIsRowSelected({ row, table });
|
|
1096
|
+
const checkboxProps = Object.assign(Object.assign({}, (selectAll
|
|
1097
|
+
? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
|
|
1098
|
+
: parseFromValuesOrFunc(muiSelectCheckboxProps, {
|
|
1099
|
+
row,
|
|
1100
|
+
table,
|
|
1101
|
+
}))), rest);
|
|
1102
|
+
const onSelectionChange = getMRT_RowSelectionHandler();
|
|
1021
1103
|
const onSelectAllChange = (event) => {
|
|
1022
1104
|
selectAllMode === 'all'
|
|
1023
1105
|
? table.getToggleAllRowsSelectedHandler()(event)
|
|
@@ -1025,16 +1107,19 @@ const MRT_SelectCheckbox = (_a) => {
|
|
|
1025
1107
|
if (isStickySelection) {
|
|
1026
1108
|
table.setRowPinning({ bottom: [], top: [] });
|
|
1027
1109
|
}
|
|
1110
|
+
lastSelectedRowId.current = null;
|
|
1028
1111
|
};
|
|
1029
1112
|
const commonProps = Object.assign(Object.assign({ 'aria-label': selectAll
|
|
1030
1113
|
? localization.toggleSelectAll
|
|
1031
|
-
: localization.toggleSelectRow, checked:
|
|
1114
|
+
: localization.toggleSelectRow, checked: isChecked, disabled: isLoading || (row && !row.getCanSelect()) || (row === null || row === void 0 ? void 0 : row.id) === 'mrt-row-create', inputProps: {
|
|
1032
1115
|
'aria-label': selectAll
|
|
1033
1116
|
? localization.toggleSelectAll
|
|
1034
1117
|
: localization.toggleSelectRow,
|
|
1035
1118
|
}, onChange: (event) => {
|
|
1036
1119
|
event.stopPropagation();
|
|
1037
|
-
row
|
|
1120
|
+
row
|
|
1121
|
+
? onSelectionChange({ event, row, staticRowIndex, table })
|
|
1122
|
+
: onSelectAllChange(event);
|
|
1038
1123
|
}, size: (density === 'compact' ? 'small' : 'medium') }, checkboxProps), { onClick: (e) => {
|
|
1039
1124
|
var _a;
|
|
1040
1125
|
e.stopPropagation();
|
|
@@ -1042,8 +1127,8 @@ const MRT_SelectCheckbox = (_a) => {
|
|
|
1042
1127
|
}, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.5rem', m: density !== 'compact' ? '-0.4rem' : undefined, width: density === 'compact' ? '1.75rem' : '2.5rem', zIndex: 0 }, parseFromValuesOrFunc(checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx, theme))), title: undefined });
|
|
1043
1128
|
return (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, getCommonTooltipProps(), { title: (_b = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _b !== void 0 ? _b : (selectAll
|
|
1044
1129
|
? localization.toggleSelectAll
|
|
1045
|
-
: localization.toggleSelectRow), children: enableMultiRowSelection === false ? (jsxRuntime.jsx(Radio__default["default"], Object.assign({}, commonProps))) : (jsxRuntime.jsx(Checkbox__default["default"], Object.assign({ indeterminate: selectAll
|
|
1046
|
-
? table.getIsSomeRowsSelected()
|
|
1130
|
+
: localization.toggleSelectRow), children: enableMultiRowSelection === false ? (jsxRuntime.jsx(Radio__default["default"], Object.assign({}, commonProps))) : (jsxRuntime.jsx(Checkbox__default["default"], Object.assign({ indeterminate: !isChecked && selectAll
|
|
1131
|
+
? table.getIsSomeRowsSelected()
|
|
1047
1132
|
: (row === null || row === void 0 ? void 0 : row.getIsSomeSelected()) && row.getCanSelectSubRows() }, commonProps))) })));
|
|
1048
1133
|
};
|
|
1049
1134
|
|
|
@@ -1104,6 +1189,7 @@ const MRT_Localization_EN = {
|
|
|
1104
1189
|
changeSearchMode: 'Change search mode',
|
|
1105
1190
|
clearFilter: 'Clear filter',
|
|
1106
1191
|
clearSearch: 'Clear search',
|
|
1192
|
+
clearSelection: 'Clear selection',
|
|
1107
1193
|
clearSort: 'Clear sort',
|
|
1108
1194
|
clickToCopy: 'Click to copy',
|
|
1109
1195
|
copy: 'Copy',
|
|
@@ -1211,7 +1297,7 @@ const MRT_DefaultDisplayColumn = {
|
|
|
1211
1297
|
};
|
|
1212
1298
|
const useMRT_TableOptions = (_a) => {
|
|
1213
1299
|
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"]);
|
|
1300
|
+
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
1301
|
const theme = styles.useTheme();
|
|
1216
1302
|
icons = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
|
|
1217
1303
|
localization = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
|
|
@@ -1252,6 +1338,7 @@ const useMRT_TableOptions = (_a) => {
|
|
|
1252
1338
|
defaultColumn,
|
|
1253
1339
|
defaultDisplayColumn,
|
|
1254
1340
|
editDisplayMode,
|
|
1341
|
+
enableBatchRowSelection,
|
|
1255
1342
|
enableBottomToolbar,
|
|
1256
1343
|
enableColumnActions,
|
|
1257
1344
|
enableColumnFilters,
|
|
@@ -1334,7 +1421,6 @@ const useMRT_Effects = (table) => {
|
|
|
1334
1421
|
const totalColumnCount = table.options.columns.length;
|
|
1335
1422
|
const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
|
|
1336
1423
|
const rerender = react.useReducer(() => ({}), {})[1];
|
|
1337
|
-
const isMounted = react.useRef(false);
|
|
1338
1424
|
const initialBodyHeight = react.useRef();
|
|
1339
1425
|
const previousTop = react.useRef();
|
|
1340
1426
|
react.useEffect(() => {
|
|
@@ -1342,11 +1428,12 @@ const useMRT_Effects = (table) => {
|
|
|
1342
1428
|
initialBodyHeight.current = document.body.style.height;
|
|
1343
1429
|
}
|
|
1344
1430
|
}, []);
|
|
1431
|
+
//hide scrollbars when table is in full screen mode, preserve body scroll position after full screen exit
|
|
1345
1432
|
react.useEffect(() => {
|
|
1346
|
-
if (
|
|
1433
|
+
if (typeof window !== 'undefined') {
|
|
1347
1434
|
if (isFullScreen) {
|
|
1348
1435
|
previousTop.current = document.body.getBoundingClientRect().top; //save scroll position
|
|
1349
|
-
document.body.style.height = '
|
|
1436
|
+
document.body.style.height = '100dvh'; //hide page scrollbars when table is in full screen mode
|
|
1350
1437
|
}
|
|
1351
1438
|
else {
|
|
1352
1439
|
document.body.style.height = initialBodyHeight.current;
|
|
@@ -1359,8 +1446,13 @@ const useMRT_Effects = (table) => {
|
|
|
1359
1446
|
});
|
|
1360
1447
|
}
|
|
1361
1448
|
}
|
|
1362
|
-
isMounted.current = true;
|
|
1363
1449
|
}, [isFullScreen]);
|
|
1450
|
+
//recalculate column order when columns change or features are toggled on/off
|
|
1451
|
+
react.useEffect(() => {
|
|
1452
|
+
if (totalColumnCount !== columnOrder.length) {
|
|
1453
|
+
table.setColumnOrder(getDefaultColumnOrderIds(table.options));
|
|
1454
|
+
}
|
|
1455
|
+
}, [totalColumnCount]);
|
|
1364
1456
|
//if page index is out of bounds, set it to the last page
|
|
1365
1457
|
react.useEffect(() => {
|
|
1366
1458
|
if (!enablePagination || isLoading || showSkeletons)
|
|
@@ -1388,6 +1480,7 @@ const useMRT_Effects = (table) => {
|
|
|
1388
1480
|
table.setSorting(() => appliedSort.current || []);
|
|
1389
1481
|
}
|
|
1390
1482
|
}, [globalFilter]);
|
|
1483
|
+
//fix pinned row top style when density changes
|
|
1391
1484
|
react.useEffect(() => {
|
|
1392
1485
|
if (enableRowPinning && getIsSomeRowsPinned()) {
|
|
1393
1486
|
setTimeout(() => {
|
|
@@ -1395,12 +1488,6 @@ const useMRT_Effects = (table) => {
|
|
|
1395
1488
|
}, 150);
|
|
1396
1489
|
}
|
|
1397
1490
|
}, [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
1491
|
};
|
|
1405
1492
|
|
|
1406
1493
|
/**
|
|
@@ -1410,6 +1497,7 @@ const useMRT_Effects = (table) => {
|
|
|
1410
1497
|
*/
|
|
1411
1498
|
const useMRT_TableInstance = (definedTableOptions) => {
|
|
1412
1499
|
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;
|
|
1500
|
+
const lastSelectedRowId = react.useRef(null);
|
|
1413
1501
|
const actionCellRef = react.useRef(null);
|
|
1414
1502
|
const bottomToolbarRef = react.useRef(null);
|
|
1415
1503
|
const editInputRefs = react.useRef({});
|
|
@@ -1536,6 +1624,7 @@ const useMRT_TableInstance = (definedTableOptions) => {
|
|
|
1536
1624
|
bottomToolbarRef,
|
|
1537
1625
|
editInputRefs,
|
|
1538
1626
|
filterInputRefs,
|
|
1627
|
+
lastSelectedRowId,
|
|
1539
1628
|
searchInputRef,
|
|
1540
1629
|
tableContainerRef,
|
|
1541
1630
|
tableFooterRef,
|
|
@@ -1691,71 +1780,26 @@ const useMRT_RowVirtualizer = (table, rows) => {
|
|
|
1691
1780
|
};
|
|
1692
1781
|
|
|
1693
1782
|
const useMRT_Rows = (table, pinnedRowIds = []) => {
|
|
1694
|
-
const {
|
|
1783
|
+
const { getRowModel, getState, options: { data, enableGlobalFilterRankedResults, positionCreatingRow }, } = table;
|
|
1695
1784
|
const { creatingRow, expanded, globalFilter, pagination, rowPinning, sorting, } = getState();
|
|
1696
|
-
const
|
|
1697
|
-
|
|
1698
|
-
|
|
1785
|
+
const rows = react.useMemo(() => getMRT_Rows(table, pinnedRowIds), [
|
|
1786
|
+
creatingRow,
|
|
1787
|
+
data,
|
|
1699
1788
|
enableGlobalFilterRankedResults,
|
|
1700
1789
|
expanded,
|
|
1790
|
+
getRowModel().rows,
|
|
1701
1791
|
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
1792
|
pagination.pageIndex,
|
|
1748
1793
|
pagination.pageSize,
|
|
1749
1794
|
positionCreatingRow,
|
|
1750
1795
|
rowPinning,
|
|
1751
|
-
|
|
1752
|
-
shouldRankRows,
|
|
1796
|
+
sorting,
|
|
1753
1797
|
]);
|
|
1754
1798
|
return rows;
|
|
1755
1799
|
};
|
|
1756
1800
|
|
|
1757
1801
|
const allowedTypes = ['string', 'number'];
|
|
1758
|
-
const MRT_TableBodyCellValue = ({ cell, rowRef, staticRowIndex, table, }) => {
|
|
1802
|
+
const MRT_TableBodyCellValue = ({ cell, rowRef, staticColumnIndex, staticRowIndex, table, }) => {
|
|
1759
1803
|
var _a, _b, _c;
|
|
1760
1804
|
const { getState, options: { enableFilterMatchHighlighting }, } = table;
|
|
1761
1805
|
const { column, row } = cell;
|
|
@@ -1818,6 +1862,7 @@ const MRT_TableBodyCellValue = ({ cell, rowRef, staticRowIndex, table, }) => {
|
|
|
1818
1862
|
renderedCellValue,
|
|
1819
1863
|
row,
|
|
1820
1864
|
rowRef,
|
|
1865
|
+
staticColumnIndex,
|
|
1821
1866
|
staticRowIndex,
|
|
1822
1867
|
table,
|
|
1823
1868
|
});
|
|
@@ -2104,6 +2149,7 @@ const MRT_TableBodyCell = (_a) => {
|
|
|
2104
2149
|
renderedCellValue: cell.renderValue(),
|
|
2105
2150
|
row,
|
|
2106
2151
|
rowRef,
|
|
2152
|
+
staticColumnIndex,
|
|
2107
2153
|
staticRowIndex,
|
|
2108
2154
|
table,
|
|
2109
2155
|
})) : 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 +2190,9 @@ const MRT_TableDetailPanel = (_a) => {
|
|
|
2144
2190
|
: 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
2191
|
};
|
|
2146
2192
|
|
|
2147
|
-
const MRT_TableBodyRow = (
|
|
2148
|
-
var
|
|
2193
|
+
const MRT_TableBodyRow = (_a) => {
|
|
2194
|
+
var _b, _c, _d, _f;
|
|
2195
|
+
var { columnVirtualizer, numRows, pinnedRowIds, row, rowVirtualizer, staticRowIndex, table, virtualRow } = _a, rest = __rest(_a, ["columnVirtualizer", "numRows", "pinnedRowIds", "row", "rowVirtualizer", "staticRowIndex", "table", "virtualRow"]);
|
|
2149
2196
|
const theme = styles.useTheme();
|
|
2150
2197
|
const { getState, options: { enableRowOrdering, enableRowPinning, enableStickyFooter, enableStickyHeader, layoutMode, memoMode, muiTableBodyRowProps, renderDetailPanel, rowPinningDisplayMode, }, refs: { tableFooterRef, tableHeadRef }, setHoveredRow, } = table;
|
|
2151
2198
|
const { density, draggingColumn, draggingRow, editingCell, editingRow, hoveredRow, isFullScreen, rowPinning, } = getState();
|
|
@@ -2155,11 +2202,11 @@ const MRT_TableBodyRow = ({ columnVirtualizer, numRows, pinnedRowIds, row, rowVi
|
|
|
2155
2202
|
const isRowPinned = enableRowPinning && row.getIsPinned();
|
|
2156
2203
|
const isDraggingRow = (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id;
|
|
2157
2204
|
const isHoveredRow = (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id;
|
|
2158
|
-
const tableRowProps = parseFromValuesOrFunc(muiTableBodyRowProps, {
|
|
2205
|
+
const tableRowProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableBodyRowProps, {
|
|
2159
2206
|
row,
|
|
2160
2207
|
staticRowIndex,
|
|
2161
2208
|
table,
|
|
2162
|
-
});
|
|
2209
|
+
})), rest);
|
|
2163
2210
|
const [bottomPinnedIndex, topPinnedIndex] = react.useMemo(() => {
|
|
2164
2211
|
if (!enableRowPinning ||
|
|
2165
2212
|
!(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) ||
|
|
@@ -2172,14 +2219,14 @@ const MRT_TableBodyRow = ({ columnVirtualizer, numRows, pinnedRowIds, row, rowVi
|
|
|
2172
2219
|
];
|
|
2173
2220
|
}, [pinnedRowIds, rowPinning]);
|
|
2174
2221
|
const tableHeadHeight = ((enableStickyHeader || isFullScreen) &&
|
|
2175
|
-
((
|
|
2222
|
+
((_b = tableHeadRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight)) ||
|
|
2176
2223
|
0;
|
|
2177
|
-
const tableFooterHeight = (enableStickyFooter && ((
|
|
2224
|
+
const tableFooterHeight = (enableStickyFooter && ((_c = tableFooterRef.current) === null || _c === void 0 ? void 0 : _c.clientHeight)) || 0;
|
|
2178
2225
|
const sx = parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme);
|
|
2179
2226
|
const defaultRowHeight = density === 'compact' ? 37 : density === 'comfortable' ? 53 : 69;
|
|
2180
2227
|
const customRowHeight =
|
|
2181
2228
|
// @ts-ignore
|
|
2182
|
-
parseInt((
|
|
2229
|
+
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
2230
|
const rowHeight = customRowHeight || defaultRowHeight;
|
|
2184
2231
|
const handleDragEnter = (_e) => {
|
|
2185
2232
|
if (enableRowOrdering && draggingRow) {
|
|
@@ -2369,8 +2416,9 @@ const MRT_TableFooterRow = (_a) => {
|
|
|
2369
2416
|
// if no content in row, skip row
|
|
2370
2417
|
if (!((_b = footerGroup.headers) === null || _b === void 0 ? void 0 : _b.some((header) => (typeof header.column.columnDef.footer === 'string' &&
|
|
2371
2418
|
!!header.column.columnDef.footer) ||
|
|
2372
|
-
header.column.columnDef.Footer)))
|
|
2419
|
+
header.column.columnDef.Footer))) {
|
|
2373
2420
|
return null;
|
|
2421
|
+
}
|
|
2374
2422
|
const tableRowProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterRowProps, {
|
|
2375
2423
|
footerGroup,
|
|
2376
2424
|
table,
|
|
@@ -2612,7 +2660,7 @@ const MRT_FilterOptionMenu = (_a) => {
|
|
|
2612
2660
|
const MRT_ColumnActionMenu = (_a) => {
|
|
2613
2661
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
2614
2662
|
var { anchorEl, header, setAnchorEl, table } = _a, rest = __rest(_a, ["anchorEl", "header", "setAnchorEl", "table"]);
|
|
2615
|
-
const {
|
|
2663
|
+
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
2664
|
const { column } = header;
|
|
2617
2665
|
const { columnDef } = column;
|
|
2618
2666
|
const { columnSizing, columnVisibility, density, showColumnFilters } = getState();
|
|
@@ -2860,6 +2908,7 @@ const MRT_FilterTextField = (_a) => {
|
|
|
2860
2908
|
? ((_a = column.getFilterValue()) === null || _a === void 0 ? void 0 : _a[rangeFilterIndex]) || ''
|
|
2861
2909
|
: (_b = column.getFilterValue()) !== null && _b !== void 0 ? _b : '';
|
|
2862
2910
|
});
|
|
2911
|
+
const [autocompleteValue, setAutocompleteValue] = react.useState(isAutocompleteFilter ? filterValue : null);
|
|
2863
2912
|
const handleChangeDebounced = react.useCallback(utils.debounce((newValue) => {
|
|
2864
2913
|
if (isRangeFilter) {
|
|
2865
2914
|
column.setFilterValue((old) => {
|
|
@@ -2886,6 +2935,10 @@ const MRT_FilterTextField = (_a) => {
|
|
|
2886
2935
|
handleChange(newValue);
|
|
2887
2936
|
(_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.onChange) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
|
|
2888
2937
|
};
|
|
2938
|
+
const handleAutocompleteChange = (newValue) => {
|
|
2939
|
+
setAutocompleteValue(newValue);
|
|
2940
|
+
handleChange(getValueAndLabel(newValue).value);
|
|
2941
|
+
};
|
|
2889
2942
|
const handleClear = () => {
|
|
2890
2943
|
if (isMultiSelectFilter) {
|
|
2891
2944
|
setFilterValue([]);
|
|
@@ -3006,10 +3059,10 @@ const MRT_FilterTextField = (_a) => {
|
|
|
3006
3059
|
} }))) : (filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.startsWith('date')) ? (jsxRuntime.jsx(DatePicker.DatePicker, Object.assign({}, commonDatePickerProps, datePickerProps, { slotProps: {
|
|
3007
3060
|
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
3061
|
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) =>
|
|
3062
|
+
} }))) : 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
3063
|
var _a;
|
|
3011
3064
|
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:
|
|
3065
|
+
}, 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
3066
|
? (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
3067
|
const selectedValue = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.find((option) => getValueAndLabel(option).value === value);
|
|
3015
3068
|
return (jsxRuntime.jsx(Chip__default["default"], { label: getValueAndLabel(selectedValue).label }, value));
|
|
@@ -3209,7 +3262,7 @@ const MRT_TableHeadCellGrabHandle = (_a) => {
|
|
|
3209
3262
|
setDraggingColumn(null);
|
|
3210
3263
|
setHoveredColumn(null);
|
|
3211
3264
|
};
|
|
3212
|
-
return (jsxRuntime.jsx(MRT_GrabHandleButton, { iconButtonProps
|
|
3265
|
+
return (jsxRuntime.jsx(MRT_GrabHandleButton, Object.assign({}, iconButtonProps, { onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })));
|
|
3213
3266
|
};
|
|
3214
3267
|
|
|
3215
3268
|
const MRT_TableHeadCellResizeHandle = (_a) => {
|
|
@@ -3431,7 +3484,7 @@ const MRT_TableHeadCell = (_a) => {
|
|
|
3431
3484
|
whiteSpace: ((_h = (_g = columnDef.header) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0) < 20
|
|
3432
3485
|
? 'nowrap'
|
|
3433
3486
|
: 'normal',
|
|
3434
|
-
},
|
|
3487
|
+
}, 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
3488
|
whiteSpace: 'nowrap',
|
|
3436
3489
|
}, children: [showDragHandle && (jsxRuntime.jsx(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
|
|
3437
3490
|
current: tableHeadCellRefs.current[column.id],
|
|
@@ -3462,7 +3515,7 @@ const MRT_TableHeadRow = (_a) => {
|
|
|
3462
3515
|
const MRT_ToolbarAlertBanner = (_a) => {
|
|
3463
3516
|
var _b, _c, _d;
|
|
3464
3517
|
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;
|
|
3518
|
+
const { getFilteredSelectedRowModel, getPrePaginationRowModel, getState, options: { enableRowSelection, enableSelectAll, localization, manualPagination, muiToolbarAlertBannerChipProps, muiToolbarAlertBannerProps, positionToolbarAlertBanner, renderToolbarAlertBannerContent, rowCount, }, refs: { lastSelectedRowId, tablePaperRef }, } = table;
|
|
3466
3519
|
const { density, grouping, rowSelection, showAlertBanner } = getState();
|
|
3467
3520
|
const alertProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiToolbarAlertBannerProps, {
|
|
3468
3521
|
table,
|
|
@@ -3470,10 +3523,14 @@ const MRT_ToolbarAlertBanner = (_a) => {
|
|
|
3470
3523
|
const chipProps = parseFromValuesOrFunc(muiToolbarAlertBannerChipProps, {
|
|
3471
3524
|
table,
|
|
3472
3525
|
});
|
|
3473
|
-
const
|
|
3474
|
-
const
|
|
3475
|
-
?
|
|
3476
|
-
:
|
|
3526
|
+
const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
|
|
3527
|
+
const selectedRowCount = react.useMemo(() => manualPagination
|
|
3528
|
+
? Object.values(rowSelection).filter(Boolean).length
|
|
3529
|
+
: getFilteredSelectedRowModel().rows.length, [rowSelection, totalRowCount, manualPagination]);
|
|
3530
|
+
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: () => {
|
|
3531
|
+
table.toggleAllRowsSelected(false);
|
|
3532
|
+
lastSelectedRowId.current = null;
|
|
3533
|
+
}, size: "small", sx: { p: '2px' }, children: localization.clearSelection })] })) : null;
|
|
3477
3534
|
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
3535
|
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
3536
|
var _a, _b;
|
|
@@ -3549,6 +3606,7 @@ const MRT_Table = (_a) => {
|
|
|
3549
3606
|
};
|
|
3550
3607
|
|
|
3551
3608
|
const MRT_TableLoadingOverlay = (_a) => {
|
|
3609
|
+
var _b;
|
|
3552
3610
|
var { table } = _a, rest = __rest(_a, ["table"]);
|
|
3553
3611
|
const { options: { localization, muiCircularProgressProps }, } = table;
|
|
3554
3612
|
const circularProgressProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiCircularProgressProps, { table })), rest);
|
|
@@ -3564,8 +3622,8 @@ const MRT_TableLoadingOverlay = (_a) => {
|
|
|
3564
3622
|
right: 0,
|
|
3565
3623
|
top: 0,
|
|
3566
3624
|
width: '100%',
|
|
3567
|
-
zIndex:
|
|
3568
|
-
}), children: jsxRuntime.jsx(CircularProgress__default["default"], Object.assign({ "aria-label": localization.noRecordsToDisplay, id: "mrt-progress" }, circularProgressProps)) }));
|
|
3625
|
+
zIndex: 3,
|
|
3626
|
+
}), 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
3627
|
};
|
|
3570
3628
|
|
|
3571
3629
|
const MRT_CellActionMenu = (_a) => {
|
|
@@ -3829,7 +3887,7 @@ const MRT_ColumnPinningButtons = (_a) => {
|
|
|
3829
3887
|
|
|
3830
3888
|
const MRT_ShowHideColumnsMenuItems = (_a) => {
|
|
3831
3889
|
var _b;
|
|
3832
|
-
var { allColumns, column, hoveredColumn, setHoveredColumn, table } = _a, rest = __rest(_a, ["allColumns", "column", "hoveredColumn", "setHoveredColumn", "table"]);
|
|
3890
|
+
var { allColumns, column, hoveredColumn, isNestedColumns, setHoveredColumn, table } = _a, rest = __rest(_a, ["allColumns", "column", "hoveredColumn", "isNestedColumns", "setHoveredColumn", "table"]);
|
|
3833
3891
|
const { getState, options: { enableColumnOrdering, enableColumnPinning, enableHiding, localization, }, setColumnOrder, } = table;
|
|
3834
3892
|
const { columnOrder } = getState();
|
|
3835
3893
|
const { columnDef } = column;
|
|
@@ -3884,7 +3942,7 @@ const MRT_ShowHideColumnsMenuItems = (_a) => {
|
|
|
3884
3942
|
gap: '8px',
|
|
3885
3943
|
}, children: [columnDefType !== 'group' &&
|
|
3886
3944
|
enableColumnOrdering &&
|
|
3887
|
-
!
|
|
3945
|
+
!isNestedColumns &&
|
|
3888
3946
|
(columnDef.enableColumnOrdering !== false ? (jsxRuntime.jsx(MRT_GrabHandleButton, { onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })) : (jsxRuntime.jsx(Box__default["default"], { sx: { width: '28px' } }))), enableColumnPinning &&
|
|
3889
3947
|
(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
3948
|
typography: {
|
|
@@ -3893,7 +3951,7 @@ const MRT_ShowHideColumnsMenuItems = (_a) => {
|
|
|
3893
3951
|
opacity: columnDefType !== 'display' ? 1 : 0.5,
|
|
3894
3952
|
},
|
|
3895
3953
|
},
|
|
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}`)))] }));
|
|
3954
|
+
}, 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
3955
|
};
|
|
3898
3956
|
|
|
3899
3957
|
const MRT_ShowHideColumnsMenu = (_a) => {
|
|
@@ -3924,6 +3982,7 @@ const MRT_ShowHideColumnsMenu = (_a) => {
|
|
|
3924
3982
|
getLeftLeafColumns(),
|
|
3925
3983
|
getRightLeafColumns(),
|
|
3926
3984
|
]);
|
|
3985
|
+
const isNestedColumns = allColumns.some((col) => col.columnDef.columnDefType === 'group');
|
|
3927
3986
|
const [hoveredColumn, setHoveredColumn] = react.useState(null);
|
|
3928
3987
|
const theme = styles.useTheme();
|
|
3929
3988
|
const { menuBackgroundColor } = getMRTTheme(table, theme);
|
|
@@ -3937,7 +3996,7 @@ const MRT_ShowHideColumnsMenu = (_a) => {
|
|
|
3937
3996
|
justifyContent: 'space-between',
|
|
3938
3997
|
p: '0.5rem',
|
|
3939
3998
|
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}`)))] })));
|
|
3999
|
+
}, 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
4000
|
};
|
|
3942
4001
|
|
|
3943
4002
|
const MRT_ShowHideColumnsButton = (_a) => {
|
|
@@ -4233,8 +4292,11 @@ exports.getIsFirstColumn = getIsFirstColumn;
|
|
|
4233
4292
|
exports.getIsFirstRightPinnedColumn = getIsFirstRightPinnedColumn;
|
|
4234
4293
|
exports.getIsLastColumn = getIsLastColumn;
|
|
4235
4294
|
exports.getIsLastLeftPinnedColumn = getIsLastLeftPinnedColumn;
|
|
4295
|
+
exports.getIsRankingRows = getIsRankingRows;
|
|
4236
4296
|
exports.getIsRowSelected = getIsRowSelected;
|
|
4237
4297
|
exports.getLeadingDisplayColumnIds = getLeadingDisplayColumnIds;
|
|
4298
|
+
exports.getMRT_RowSelectionHandler = getMRT_RowSelectionHandler;
|
|
4299
|
+
exports.getMRT_Rows = getMRT_Rows;
|
|
4238
4300
|
exports.getTotalRight = getTotalRight;
|
|
4239
4301
|
exports.getTrailingDisplayColumnIds = getTrailingDisplayColumnIds;
|
|
4240
4302
|
exports.isCellEditable = isCellEditable;
|