material-react-table-narender 2.13.35 → 2.13.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +39 -42
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +37 -40
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/body/MRT_TableBodyRow.tsx +0 -3
- package/src/components/head/MRT_TableHeadCell.tsx +5 -0
- package/src/types.ts +2 -0
package/dist/index.d.ts
CHANGED
@@ -601,6 +601,7 @@ interface MRT_ColumnDef<TData extends MRT_RowData, TValue = unknown> extends Omi
|
|
601
601
|
* header must be a string. If you want custom JSX to render the header, you can also specify a `Header` option. (Capital H)
|
602
602
|
*/
|
603
603
|
header: string;
|
604
|
+
tooltip?: string;
|
604
605
|
/**
|
605
606
|
* Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
|
606
607
|
*
|
@@ -1328,6 +1329,7 @@ declare function defaultDisplayColumnProps<TData extends MRT_RowData>({ header,
|
|
1328
1329
|
readonly filterSelectOptions?: DropdownOption[];
|
1329
1330
|
readonly filterVariant?: "autocomplete" | "checkbox" | "date" | "date-range" | "datetime" | "datetime-range" | "multi-select" | "range" | "range-slider" | "select" | "text" | "time" | "time-range";
|
1330
1331
|
readonly grow?: boolean | number;
|
1332
|
+
readonly tooltip?: string;
|
1331
1333
|
readonly muiColumnActionsButtonProps?: _mui_material.IconButtonProps | ((props: {
|
1332
1334
|
column: MRT_Column<TData, unknown>;
|
1333
1335
|
table: MRT_TableInstance<TData>;
|
package/dist/index.esm.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { flexRender as flexRender$1, createRow as createRow$1, sortingFns, aggregationFns, filterFns, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from '@tanstack/react-table';
|
2
|
-
import { useMemo, useState, useReducer, useRef, useEffect, useCallback, memo,
|
2
|
+
import { useMemo, useState, useReducer, useRef, useEffect, useCallback, memo, Fragment as Fragment$1, useLayoutEffect } from 'react';
|
3
3
|
import { compareItems, rankItem, rankings } from '@tanstack/match-sorter-utils';
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
5
5
|
import IconButton from '@mui/material/IconButton';
|
@@ -52,7 +52,7 @@ import SettingsBackupRestoreIcon from '@mui/icons-material/SettingsBackupRestore
|
|
52
52
|
import SettingsOutlinedIcon from '@mui/icons-material/SettingsOutlined';
|
53
53
|
import { defaultRangeExtractor, useVirtualizer } from '@tanstack/react-virtual';
|
54
54
|
import Paper from '@mui/material/Paper';
|
55
|
-
import { useTheme as useTheme$1 } from '@mui/material';
|
55
|
+
import { Tooltip as Tooltip$1, useTheme as useTheme$1 } from '@mui/material';
|
56
56
|
import TableContainer from '@mui/material/TableContainer';
|
57
57
|
import Table from '@mui/material/Table';
|
58
58
|
import TableBody from '@mui/material/TableBody';
|
@@ -2420,7 +2420,7 @@ const MRT_TableDetailPanel = (_a) => {
|
|
2420
2420
|
};
|
2421
2421
|
|
2422
2422
|
const MRT_TableBodyRow = (_a) => {
|
2423
|
-
var _b, _c, _d, _f
|
2423
|
+
var _b, _c, _d, _f;
|
2424
2424
|
var { columnVirtualizer, numRows, pinnedRowIds, row, rowVirtualizer, staticRowIndex, table, virtualRow } = _a, rest = __rest(_a, ["columnVirtualizer", "numRows", "pinnedRowIds", "row", "rowVirtualizer", "staticRowIndex", "table", "virtualRow"]);
|
2425
2425
|
const theme = useTheme();
|
2426
2426
|
const { getState, options: { enableRowOrdering, enableRowPinning, enableStickyFooter, enableStickyHeader, layoutMode, memoMode, mrtTheme: { baseBackgroundColor, pinnedRowBackgroundColor, selectedRowBackgroundColor, }, muiTableBodyRowProps, renderDetailPanel, rowPinningDisplayMode, }, refs: { tableFooterRef, tableHeadRef }, setHoveredRow, } = table;
|
@@ -2478,8 +2478,7 @@ const MRT_TableBodyRow = (_a) => {
|
|
2478
2478
|
? `${lighten(baseBackgroundColor, 0.3)}`
|
2479
2479
|
: `${darken(baseBackgroundColor, 0.3)}`
|
2480
2480
|
: undefined;
|
2481
|
-
|
2482
|
-
return (jsxs(Fragment, { children: [createElement(TableRow, Object.assign({ "data-index": renderDetailPanel ? staticRowIndex * 2 : staticRowIndex, "data-pinned": !!isRowPinned || undefined, "data-selected": isRowSelected || undefined, onDragEnter: handleDragEnter, onDragOver: handleDragOver, ref: (node) => {
|
2481
|
+
return (jsxs(Fragment, { children: [jsxs(TableRow, Object.assign({ "data-index": renderDetailPanel ? staticRowIndex * 2 : staticRowIndex, "data-pinned": !!isRowPinned || undefined, "data-selected": isRowSelected || undefined, onDragEnter: handleDragEnter, onDragOver: handleDragOver, ref: (node) => {
|
2483
2482
|
if (node) {
|
2484
2483
|
rowRef.current = node;
|
2485
2484
|
rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement(node);
|
@@ -2500,30 +2499,27 @@ const MRT_TableBodyRow = (_a) => {
|
|
2500
2499
|
: topPinnedIndex !== undefined && isRowPinned
|
2501
2500
|
? `${topPinnedIndex * rowHeight +
|
2502
2501
|
(enableStickyHeader || isFullScreen ? tableHeadHeight - 1 : 0)}px`
|
2503
|
-
: undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', width: '100%', zIndex: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) && isRowPinned ? 2 : 0 }, sx)),
|
2504
|
-
|
2505
|
-
|
2506
|
-
|
2507
|
-
|
2508
|
-
|
2509
|
-
|
2510
|
-
|
2511
|
-
|
2512
|
-
|
2513
|
-
|
2514
|
-
|
2515
|
-
|
2516
|
-
|
2517
|
-
|
2518
|
-
|
2519
|
-
|
2520
|
-
|
2521
|
-
|
2522
|
-
|
2523
|
-
|
2524
|
-
(editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) !== row.id ? (jsx(Memo_MRT_TableBodyCell, Object.assign({}, props), cell.id)) : (jsx(MRT_TableBodyCell, Object.assign({}, props), cell.id))) : null;
|
2525
|
-
}),
|
2526
|
-
virtualPaddingRight ? (jsx("td", { style: { display: 'flex', width: virtualPaddingRight } })) : null), renderDetailPanel && !row.getIsGrouped() && (jsx(MRT_TableDetailPanel, { parentRowRef: rowRef, row: row, rowVirtualizer: rowVirtualizer, staticRowIndex: staticRowIndex, table: table, virtualRow: virtualRow }))] }));
|
2502
|
+
: undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', width: '100%', zIndex: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) && isRowPinned ? 2 : 0 }, sx)), children: [virtualPaddingLeft ? (jsx("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : visibleCells).map((cellOrVirtualCell, staticColumnIndex) => {
|
2503
|
+
let cell = cellOrVirtualCell;
|
2504
|
+
if (columnVirtualizer) {
|
2505
|
+
staticColumnIndex = cellOrVirtualCell.index;
|
2506
|
+
cell = visibleCells[staticColumnIndex];
|
2507
|
+
}
|
2508
|
+
const props = {
|
2509
|
+
cell,
|
2510
|
+
numRows,
|
2511
|
+
rowRef,
|
2512
|
+
staticColumnIndex,
|
2513
|
+
staticRowIndex,
|
2514
|
+
table,
|
2515
|
+
};
|
2516
|
+
return cell ? (memoMode === 'cells' &&
|
2517
|
+
cell.column.columnDef.columnDefType === 'data' &&
|
2518
|
+
!draggingColumn &&
|
2519
|
+
!draggingRow &&
|
2520
|
+
(editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) !== cell.id &&
|
2521
|
+
(editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) !== row.id ? (jsx(Memo_MRT_TableBodyCell, Object.assign({}, props), cell.id)) : (jsx(MRT_TableBodyCell, Object.assign({}, props), cell.id))) : null;
|
2522
|
+
}), virtualPaddingRight ? (jsx("td", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })), renderDetailPanel && !row.getIsGrouped() && (jsx(MRT_TableDetailPanel, { parentRowRef: rowRef, row: row, rowVirtualizer: rowVirtualizer, staticRowIndex: staticRowIndex, table: table, virtualRow: virtualRow }))] }));
|
2527
2523
|
};
|
2528
2524
|
const Memo_MRT_TableBodyRow = memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row && prev.staticRowIndex === next.staticRowIndex);
|
2529
2525
|
|
@@ -3556,7 +3552,7 @@ const MRT_TableHeadCellSortLabel = (_a) => {
|
|
3556
3552
|
};
|
3557
3553
|
|
3558
3554
|
const MRT_TableHeadCell = (_a) => {
|
3559
|
-
var _b, _c, _d, _f, _g, _h;
|
3555
|
+
var _b, _c, _d, _f, _g, _h, _j;
|
3560
3556
|
var { columnVirtualizer, header, staticColumnIndex, table } = _a, rest = __rest(_a, ["columnVirtualizer", "header", "staticColumnIndex", "table"]);
|
3561
3557
|
const theme = useTheme();
|
3562
3558
|
const { getState, options: { columnFilterDisplayMode, columnResizeDirection, columnResizeMode, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnPinning,
|
@@ -3645,6 +3641,7 @@ const MRT_TableHeadCell = (_a) => {
|
|
3645
3641
|
header,
|
3646
3642
|
table,
|
3647
3643
|
})) !== null && _b !== void 0 ? _b : columnDef.header;
|
3644
|
+
const headerTooltip = (_c = columnDef.tooltip) !== null && _c !== void 0 ? _c : columnDef.header;
|
3648
3645
|
return (jsxs(TableCell, Object.assign({ align: columnDefType === 'group'
|
3649
3646
|
? 'center'
|
3650
3647
|
: theme.direction === 'rtl'
|
@@ -3689,7 +3686,7 @@ const MRT_TableHeadCell = (_a) => {
|
|
3689
3686
|
theme,
|
3690
3687
|
})), draggingBorders)), children: [header.isPlaceholder
|
3691
3688
|
? null
|
3692
|
-
: ((
|
3689
|
+
: ((_d = tableCellProps.children) !== null && _d !== void 0 ? _d : (jsxs(Box, { className: "Mui-TableHeadCell-Content", sx: {
|
3693
3690
|
alignItems: 'center',
|
3694
3691
|
display: 'flex',
|
3695
3692
|
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
@@ -3712,17 +3709,17 @@ const MRT_TableHeadCell = (_a) => {
|
|
3712
3709
|
pl: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
|
3713
3710
|
? `${headerPL}rem`
|
3714
3711
|
: undefined,
|
3715
|
-
}, children: [jsx(Box, { className: "Mui-TableHeadCell-Content-Wrapper", sx: {
|
3716
|
-
|
3717
|
-
|
3718
|
-
|
3719
|
-
|
3720
|
-
|
3721
|
-
|
3722
|
-
|
3723
|
-
|
3724
|
-
|
3725
|
-
|
3712
|
+
}, children: [jsx(Tooltip$1, { title: headerTooltip, placement: "top", arrow: true, children: jsx(Box, { className: "Mui-TableHeadCell-Content-Wrapper", sx: {
|
3713
|
+
'&:hover': {
|
3714
|
+
textOverflow: 'clip',
|
3715
|
+
},
|
3716
|
+
minWidth: `${Math.min((_g = (_f = columnDef.header) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 0, 4)}ch`,
|
3717
|
+
overflow: columnDefType === 'data' ? 'hidden' : undefined,
|
3718
|
+
textOverflow: 'ellipsis',
|
3719
|
+
whiteSpace: ((_j = (_h = columnDef.header) === null || _h === void 0 ? void 0 : _h.length) !== null && _j !== void 0 ? _j : 0) < 20
|
3720
|
+
? 'nowrap'
|
3721
|
+
: 'normal',
|
3722
|
+
}, children: HeaderElement }) }), column.getCanFilter() && (jsx(MRT_TableHeadCellFilterLabel, { header: header, table: table })), column.getCanSort() && (jsx(MRT_TableHeadCellSortLabel, { header: header, table: table }))] }), columnDefType !== 'group' && (jsxs(Box, { className: "Mui-TableHeadCell-Content-Actions", sx: {
|
3726
3723
|
whiteSpace: 'nowrap',
|
3727
3724
|
}, children: [showDragHandle && (jsx(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
|
3728
3725
|
current: tableHeadCellRefs.current[column.id],
|