material-react-table 2.9.1 → 2.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +53 -41
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +53 -41
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
- package/src/components/body/MRT_TableBodyCell.tsx +0 -5
- package/src/components/body/MRT_TableBodyRow.tsx +15 -17
- package/src/components/footer/MRT_TableFooter.tsx +1 -1
- package/src/components/footer/MRT_TableFooterCell.tsx +2 -4
- package/src/components/footer/MRT_TableFooterRow.tsx +1 -0
- package/src/components/head/MRT_TableHeadCell.tsx +0 -6
- package/src/components/head/MRT_TableHeadRow.tsx +5 -1
- package/src/components/inputs/MRT_EditCellTextField.tsx +4 -1
- package/src/components/inputs/MRT_FilterTextField.tsx +1 -0
- package/src/components/menus/MRT_ColumnActionMenu.tsx +1 -0
- package/src/components/menus/MRT_FilterOptionMenu.tsx +1 -0
- package/src/components/menus/MRT_RowActionMenu.tsx +1 -0
- package/src/components/menus/MRT_ShowHideColumnsMenu.tsx +1 -0
- package/src/components/table/MRT_Table.tsx +1 -0
- package/src/components/toolbar/MRT_TablePagination.tsx +14 -5
- package/src/utils/style.utils.ts +17 -4
package/dist/index.js
CHANGED
|
@@ -589,7 +589,7 @@ const getMRTTheme = (table, theme) => {
|
|
|
589
589
|
? styles.darken(theme.palette.warning.dark, 0.25)
|
|
590
590
|
: styles.lighten(theme.palette.warning.light, 0.5), menuBackgroundColor: styles.lighten(baseBackgroundColor, 0.07), pinnedRowBackgroundColor: styles.alpha(theme.palette.primary.main, 0.1), selectedRowBackgroundColor: styles.alpha(theme.palette.primary.main, 0.2) }, themeOverrides);
|
|
591
591
|
};
|
|
592
|
-
const
|
|
592
|
+
const commonCellBeforeAfterStyles = {
|
|
593
593
|
content: '""',
|
|
594
594
|
height: '100%',
|
|
595
595
|
left: 0,
|
|
@@ -608,14 +608,16 @@ const getCommonPinnedCellStyles = ({ column, table, theme, }) => {
|
|
|
608
608
|
: getIsFirstRightPinnedColumn(column)
|
|
609
609
|
? `4px 0 4px -4px ${styles.alpha(theme.palette.grey[700], 0.5)} inset`
|
|
610
610
|
: undefined
|
|
611
|
-
: undefined },
|
|
611
|
+
: undefined }, commonCellBeforeAfterStyles),
|
|
612
612
|
},
|
|
613
613
|
};
|
|
614
614
|
};
|
|
615
615
|
const getCommonMRTCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
|
|
616
616
|
var _a, _b, _c, _d, _e, _f;
|
|
617
|
-
const { options: { enableColumnVirtualization, layoutMode }, } = table;
|
|
617
|
+
const { getState, options: { enableColumnVirtualization, layoutMode }, } = table;
|
|
618
|
+
const { draggingColumn } = getState();
|
|
618
619
|
const { columnDef } = column;
|
|
620
|
+
const { columnDefType } = columnDef;
|
|
619
621
|
const isColumnPinned = columnDef.columnDefType !== 'group' && column.getIsPinned();
|
|
620
622
|
const widthStyles = {
|
|
621
623
|
minWidth: `max(calc(var(--${header ? 'header' : 'col'}-${parseCSSVarId((_a = header === null || header === void 0 ? void 0 : header.id) !== null && _a !== void 0 ? _a : column.id)}-size) * 1px), ${(_b = columnDef.minSize) !== null && _b !== void 0 ? _b : 30}px)`,
|
|
@@ -634,13 +636,21 @@ const getCommonMRTCellStyles = ({ column, header, table, tableCellProps, theme,
|
|
|
634
636
|
? `${column.getStart('left')}px`
|
|
635
637
|
: undefined, opacity: 0.97, position: 'sticky', right: isColumnPinned === 'right'
|
|
636
638
|
? `${getTotalRight(table, column)}px`
|
|
637
|
-
: undefined
|
|
638
|
-
return Object.assign(Object.assign(Object.assign({ backgroundColor: 'inherit', backgroundImage: 'inherit', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined,
|
|
639
|
+
: undefined }) : {};
|
|
640
|
+
return Object.assign(Object.assign(Object.assign({ backgroundColor: 'inherit', backgroundImage: 'inherit', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, justifyContent: columnDefType === 'group'
|
|
641
|
+
? 'center'
|
|
642
|
+
: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid'))
|
|
643
|
+
? tableCellProps.align
|
|
644
|
+
: undefined, opacity: ((_e = table.getState().draggingColumn) === null || _e === void 0 ? void 0 : _e.id) === column.id ||
|
|
639
645
|
((_f = table.getState().hoveredColumn) === null || _f === void 0 ? void 0 : _f.id) === column.id
|
|
640
646
|
? 0.5
|
|
641
647
|
: 1, position: 'relative', transition: enableColumnVirtualization
|
|
642
648
|
? 'none'
|
|
643
|
-
: `padding 150ms ease-in-out`, zIndex:
|
|
649
|
+
: `padding 150ms ease-in-out`, zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
|
650
|
+
? 2
|
|
651
|
+
: columnDefType !== 'group' && isColumnPinned
|
|
652
|
+
? 1
|
|
653
|
+
: 0 }, pinnedStyles), widthStyles), parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme));
|
|
644
654
|
};
|
|
645
655
|
const getCommonToolbarStyles = ({ table, theme, }) => ({
|
|
646
656
|
alignItems: 'flex-start',
|
|
@@ -846,7 +856,7 @@ const MRT_FilterOptionMenu = (_a) => {
|
|
|
846
856
|
sx: {
|
|
847
857
|
backgroundColor: menuBackgroundColor,
|
|
848
858
|
},
|
|
849
|
-
}, anchorEl: anchorEl, anchorOrigin: { horizontal: 'right', vertical: 'center' }, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: (_e = (header && column && columnDef
|
|
859
|
+
}, anchorEl: anchorEl, anchorOrigin: { horizontal: 'right', vertical: 'center' }, disableScrollLock: true, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: (_e = (header && column && columnDef
|
|
850
860
|
? (_d = (_c = columnDef.renderColumnFilterModeMenuItems) === null || _c === void 0 ? void 0 : _c.call(columnDef, {
|
|
851
861
|
column: column,
|
|
852
862
|
internalFilterOptions,
|
|
@@ -1001,7 +1011,7 @@ const MRT_ColumnActionMenu = (_a) => {
|
|
|
1001
1011
|
sx: {
|
|
1002
1012
|
backgroundColor: menuBackgroundColor,
|
|
1003
1013
|
},
|
|
1004
|
-
}, anchorEl: anchorEl, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: (_l = (_k = (_j = columnDef.renderColumnActionsMenuItems) === null || _j === void 0 ? void 0 : _j.call(columnDef, {
|
|
1014
|
+
}, anchorEl: anchorEl, disableScrollLock: true, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: (_l = (_k = (_j = columnDef.renderColumnActionsMenuItems) === null || _j === void 0 ? void 0 : _j.call(columnDef, {
|
|
1005
1015
|
closeMenu: () => setAnchorEl(null),
|
|
1006
1016
|
column,
|
|
1007
1017
|
internalColumnMenuItems,
|
|
@@ -1025,7 +1035,7 @@ const MRT_RowActionMenu = (_a) => {
|
|
|
1025
1035
|
sx: {
|
|
1026
1036
|
backgroundColor: menuBackgroundColor,
|
|
1027
1037
|
},
|
|
1028
|
-
}, anchorEl: anchorEl, onClick: (event) => event.stopPropagation(), onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: [parseFromValuesOrFunc(enableEditing, row) &&
|
|
1038
|
+
}, anchorEl: anchorEl, disableScrollLock: true, onClick: (event) => event.stopPropagation(), onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: [parseFromValuesOrFunc(enableEditing, row) &&
|
|
1029
1039
|
['modal', 'row'].includes(editDisplayMode) && (jsxRuntime.jsx(MenuItem__default["default"], { onClick: handleEdit, sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(EditIcon, {}) }), localization.edit] }) })), renderRowActionMenuItems === null || renderRowActionMenuItems === void 0 ? void 0 : renderRowActionMenuItems({
|
|
1030
1040
|
closeMenu: () => setAnchorEl(null),
|
|
1031
1041
|
row,
|
|
@@ -2220,7 +2230,9 @@ const MRT_EditCellTextField = (_a) => {
|
|
|
2220
2230
|
: {})), textFieldProps.InputProps), { sx: (theme) => {
|
|
2221
2231
|
var _a;
|
|
2222
2232
|
return (Object.assign({ mb: 0 }, parseFromValuesOrFunc((_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.InputProps) === null || _a === void 0 ? void 0 : _a.sx, theme)));
|
|
2223
|
-
} }),
|
|
2233
|
+
} }), SelectProps: {
|
|
2234
|
+
MenuProps: { disableScrollLock: true },
|
|
2235
|
+
}, inputProps: Object.assign({ autoComplete: 'new-password' }, textFieldProps.inputProps), onBlur: handleBlur, onChange: handleChange, onClick: (e) => {
|
|
2224
2236
|
var _a;
|
|
2225
2237
|
e.stopPropagation();
|
|
2226
2238
|
(_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.onClick) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, e);
|
|
@@ -2363,9 +2375,7 @@ const MRT_TableBodyCell = (_a) => {
|
|
|
2363
2375
|
: undefined,
|
|
2364
2376
|
outlineOffset: '-1px',
|
|
2365
2377
|
textOverflow: 'clip',
|
|
2366
|
-
}, alignItems: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'center' : undefined, cursor: isEditable && editDisplayMode === 'cell' ? 'pointer' : 'inherit',
|
|
2367
|
-
? tableCellProps.align
|
|
2368
|
-
: undefined, overflow: 'hidden', p: density === 'compact'
|
|
2378
|
+
}, alignItems: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'center' : undefined, cursor: isEditable && editDisplayMode === 'cell' ? 'pointer' : 'inherit', overflow: 'hidden', p: density === 'compact'
|
|
2369
2379
|
? columnDefType === 'display'
|
|
2370
2380
|
? '0 0.5rem'
|
|
2371
2381
|
: '0.5rem'
|
|
@@ -2375,7 +2385,7 @@ const MRT_TableBodyCell = (_a) => {
|
|
|
2375
2385
|
: '1rem'
|
|
2376
2386
|
: columnDefType === 'display'
|
|
2377
2387
|
? '1rem 1.25rem'
|
|
2378
|
-
: '1.5rem', textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined, whiteSpace: row.getIsPinned() || density === 'compact' ? 'nowrap' : 'normal'
|
|
2388
|
+
: '1.5rem', textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined, whiteSpace: row.getIsPinned() || density === 'compact' ? 'nowrap' : 'normal' }, getCommonMRTCellStyles({
|
|
2379
2389
|
column,
|
|
2380
2390
|
table,
|
|
2381
2391
|
tableCellProps,
|
|
@@ -2492,25 +2502,21 @@ const MRT_TableBodyRow = ({ columnVirtualizer, numRows, pinnedRowIds, row, rowVi
|
|
|
2492
2502
|
}
|
|
2493
2503
|
}, selected: isRowSelected }, tableRowProps, { style: Object.assign({ transform: virtualRow
|
|
2494
2504
|
? `translateY(${virtualRow.start}px)`
|
|
2495
|
-
: undefined }, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style), sx: (theme) => (Object.assign({ '&:hover td':
|
|
2496
|
-
|
|
2497
|
-
? styles.alpha(cellHighlightColorHover, 0.3)
|
|
2498
|
-
: undefined }, pinnedBeforeAfterStyles),
|
|
2499
|
-
}, backgroundColor: `${baseBackgroundColor} !important`, bottom: !virtualRow && bottomPinnedIndex !== undefined && isRowPinned
|
|
2505
|
+
: undefined }, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style), sx: (theme) => (Object.assign({ '&:hover td:after': cellHighlightColorHover
|
|
2506
|
+
? Object.assign({ backgroundColor: styles.alpha(cellHighlightColorHover, 0.3) }, commonCellBeforeAfterStyles) : undefined, backgroundColor: `${baseBackgroundColor} !important`, bottom: !virtualRow && bottomPinnedIndex !== undefined && isRowPinned
|
|
2500
2507
|
? `${bottomPinnedIndex * rowHeight +
|
|
2501
2508
|
(enableStickyFooter ? tableFooterHeight - 1 : 0)}px`
|
|
2502
2509
|
: undefined, boxSizing: 'border-box', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, opacity: isRowPinned ? 0.97 : isDraggingRow || isHoveredRow ? 0.5 : 1, position: virtualRow
|
|
2503
2510
|
? 'absolute'
|
|
2504
2511
|
: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) && isRowPinned
|
|
2505
2512
|
? 'sticky'
|
|
2506
|
-
:
|
|
2513
|
+
: 'relative', td: Object.assign({}, getCommonPinnedCellStyles({ table, theme })), 'td:after': cellHighlightColor
|
|
2514
|
+
? Object.assign({ backgroundColor: cellHighlightColor }, commonCellBeforeAfterStyles) : undefined, top: virtualRow
|
|
2507
2515
|
? 0
|
|
2508
2516
|
: topPinnedIndex !== undefined && isRowPinned
|
|
2509
2517
|
? `${topPinnedIndex * rowHeight +
|
|
2510
2518
|
(enableStickyHeader || isFullScreen ? tableHeadHeight - 1 : 0)}px`
|
|
2511
|
-
: undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', width: '100%', zIndex: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) && isRowPinned
|
|
2512
|
-
? 2
|
|
2513
|
-
: undefined }, sx)), children: [virtualPaddingLeft ? (jsxRuntime.jsx("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : visibleCells).map((cellOrVirtualCell, staticColumnIndex) => {
|
|
2519
|
+
: 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 ? (jsxRuntime.jsx("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : visibleCells).map((cellOrVirtualCell, staticColumnIndex) => {
|
|
2514
2520
|
let cell = cellOrVirtualCell;
|
|
2515
2521
|
if (columnVirtualizer) {
|
|
2516
2522
|
staticColumnIndex = cellOrVirtualCell.index;
|
|
@@ -2620,7 +2626,7 @@ const MRT_TableFooterCell = (_a) => {
|
|
|
2620
2626
|
var _b, _c, _d;
|
|
2621
2627
|
var { footer, staticColumnIndex, table } = _a, rest = __rest(_a, ["footer", "staticColumnIndex", "table"]);
|
|
2622
2628
|
const theme = styles.useTheme();
|
|
2623
|
-
const { getState, options: { enableColumnPinning,
|
|
2629
|
+
const { getState, options: { enableColumnPinning, muiTableFooterCellProps }, } = table;
|
|
2624
2630
|
const { density } = getState();
|
|
2625
2631
|
const { column } = footer;
|
|
2626
2632
|
const { columnDef } = column;
|
|
@@ -2634,12 +2640,13 @@ const MRT_TableFooterCell = (_a) => {
|
|
|
2634
2640
|
? 'center'
|
|
2635
2641
|
: theme.direction === 'rtl'
|
|
2636
2642
|
? 'right'
|
|
2637
|
-
: 'left', colSpan: footer.colSpan, "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, variant: "footer" }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({
|
|
2643
|
+
: 'left', colSpan: footer.colSpan, "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, variant: "footer" }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ fontWeight: 'bold', p: density === 'compact'
|
|
2638
2644
|
? '0.5rem'
|
|
2639
2645
|
: density === 'comfortable'
|
|
2640
2646
|
? '1rem'
|
|
2641
|
-
: '1.5rem', verticalAlign: 'top'
|
|
2647
|
+
: '1.5rem', verticalAlign: 'top' }, getCommonMRTCellStyles({
|
|
2642
2648
|
column,
|
|
2649
|
+
header: footer,
|
|
2643
2650
|
table,
|
|
2644
2651
|
tableCellProps,
|
|
2645
2652
|
theme,
|
|
@@ -2666,7 +2673,7 @@ const MRT_TableFooterRow = (_a) => {
|
|
|
2666
2673
|
footerGroup,
|
|
2667
2674
|
table,
|
|
2668
2675
|
})), rest);
|
|
2669
|
-
return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: getMRTTheme(table, theme).baseBackgroundColor, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, width: '100%' }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter, staticColumnIndex) => {
|
|
2676
|
+
return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: getMRTTheme(table, theme).baseBackgroundColor, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, position: 'relative', width: '100%' }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter, staticColumnIndex) => {
|
|
2670
2677
|
let footer = footerOrVirtualFooter;
|
|
2671
2678
|
if (columnVirtualizer) {
|
|
2672
2679
|
staticColumnIndex = footerOrVirtualFooter
|
|
@@ -2695,7 +2702,7 @@ const MRT_TableFooter = (_a) => {
|
|
|
2695
2702
|
? theme.palette.mode === 'light'
|
|
2696
2703
|
? `1px solid ${theme.palette.grey[300]}`
|
|
2697
2704
|
: `1px solid ${theme.palette.grey[700]}`
|
|
2698
|
-
: undefined, position: stickFooter ? 'sticky' :
|
|
2705
|
+
: undefined, position: stickFooter ? 'sticky' : 'relative', zIndex: stickFooter ? 1 : undefined }, parseFromValuesOrFunc(tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx, theme))), children: getFooterGroups().map((footerGroup) => (jsxRuntime.jsx(MRT_TableFooterRow, { columnVirtualizer: columnVirtualizer, footerGroup: footerGroup, table: table }, footerGroup.id))) })));
|
|
2699
2706
|
};
|
|
2700
2707
|
|
|
2701
2708
|
const MRT_TableHeadCellColumnActionsButton = (_a) => {
|
|
@@ -2963,7 +2970,7 @@ const MRT_FilterTextField = (_a) => {
|
|
|
2963
2970
|
} }))) : isAutocompleteFilter ? (jsxRuntime.jsx(Autocomplete__default["default"], Object.assign({ freeSolo: true, getOptionLabel: (option) => getValueAndLabel(option).label, onChange: (_e, newValue) => handleChange(getValueAndLabel(newValue).value), options: (_t = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map((option) => getValueAndLabel(option))) !== null && _t !== void 0 ? _t : [] }, autocompleteProps, { renderInput: (builtinTextFieldProps) => {
|
|
2964
2971
|
var _a;
|
|
2965
2972
|
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() })));
|
|
2966
|
-
}, value: filterValue }))) : (jsxRuntime.jsx(TextField__default["default"], Object.assign({ select: isSelectFilter || isMultiSelectFilter }, commonTextFieldProps, { SelectProps: Object.assign({ displayEmpty: true, multiple: isMultiSelectFilter, renderValue: isMultiSelectFilter
|
|
2973
|
+
}, value: filterValue }))) : (jsxRuntime.jsx(TextField__default["default"], Object.assign({ select: isSelectFilter || isMultiSelectFilter }, commonTextFieldProps, { SelectProps: Object.assign({ MenuProps: { disableScrollLock: true }, displayEmpty: true, multiple: isMultiSelectFilter, renderValue: isMultiSelectFilter
|
|
2967
2974
|
? (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) => {
|
|
2968
2975
|
const selectedValue = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.find((option) => getValueAndLabel(option).value === value);
|
|
2969
2976
|
return (jsxRuntime.jsx(Chip__default["default"], { label: getValueAndLabel(selectedValue).label }, value));
|
|
@@ -3340,11 +3347,7 @@ const MRT_TableHeadCell = (_a) => {
|
|
|
3340
3347
|
? '0.25rem'
|
|
3341
3348
|
: density === 'comfortable'
|
|
3342
3349
|
? '.75rem'
|
|
3343
|
-
: '1.25rem', userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top',
|
|
3344
|
-
? 3
|
|
3345
|
-
: column.getIsPinned() && columnDefType !== 'group'
|
|
3346
|
-
? 2
|
|
3347
|
-
: 1 }, getCommonMRTCellStyles({
|
|
3350
|
+
: '1.25rem', userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top' }, getCommonMRTCellStyles({
|
|
3348
3351
|
column,
|
|
3349
3352
|
header,
|
|
3350
3353
|
table,
|
|
@@ -3394,13 +3397,15 @@ const MRT_TableHeadCell = (_a) => {
|
|
|
3394
3397
|
|
|
3395
3398
|
const MRT_TableHeadRow = (_a) => {
|
|
3396
3399
|
var { columnVirtualizer, headerGroup, table } = _a, rest = __rest(_a, ["columnVirtualizer", "headerGroup", "table"]);
|
|
3397
|
-
const { options: { layoutMode, muiTableHeadRowProps }, } = table;
|
|
3400
|
+
const { options: { enableStickyHeader, layoutMode, muiTableHeadRowProps }, } = table;
|
|
3398
3401
|
const { virtualColumns, virtualPaddingLeft, virtualPaddingRight } = columnVirtualizer !== null && columnVirtualizer !== void 0 ? columnVirtualizer : {};
|
|
3399
3402
|
const tableRowProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableHeadRowProps, {
|
|
3400
3403
|
headerGroup,
|
|
3401
3404
|
table,
|
|
3402
3405
|
})), rest);
|
|
3403
|
-
return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: getMRTTheme(table, theme).baseBackgroundColor, boxShadow: `4px 0 8px ${styles.alpha(theme.palette.common.black, 0.1)}`, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined,
|
|
3406
|
+
return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: getMRTTheme(table, theme).baseBackgroundColor, boxShadow: `4px 0 8px ${styles.alpha(theme.palette.common.black, 0.1)}`, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, position: enableStickyHeader && layoutMode === 'semantic'
|
|
3407
|
+
? 'sticky'
|
|
3408
|
+
: 'relative', top: 0 }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader, staticColumnIndex) => {
|
|
3404
3409
|
let header = headerOrVirtualHeader;
|
|
3405
3410
|
if (columnVirtualizer) {
|
|
3406
3411
|
staticColumnIndex = headerOrVirtualHeader
|
|
@@ -3497,7 +3502,7 @@ const MRT_Table = (_a) => {
|
|
|
3497
3502
|
columnVirtualizer,
|
|
3498
3503
|
table,
|
|
3499
3504
|
};
|
|
3500
|
-
return (jsxRuntime.jsxs(Table__default["default"], Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style), sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined }, parseFromValuesOrFunc(tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx, theme))), children: [!!Caption && jsxRuntime.jsx("caption", { children: Caption }), enableTableHead && jsxRuntime.jsx(MRT_TableHead, Object.assign({}, commonTableGroupProps)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsxRuntime.jsx(Memo_MRT_TableBody, Object.assign({}, commonTableGroupProps))) : (jsxRuntime.jsx(MRT_TableBody, Object.assign({}, commonTableGroupProps))), enableTableFooter && jsxRuntime.jsx(MRT_TableFooter, Object.assign({}, commonTableGroupProps))] })));
|
|
3505
|
+
return (jsxRuntime.jsxs(Table__default["default"], Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style), sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, position: 'relative' }, parseFromValuesOrFunc(tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx, theme))), children: [!!Caption && jsxRuntime.jsx("caption", { children: Caption }), enableTableHead && jsxRuntime.jsx(MRT_TableHead, Object.assign({}, commonTableGroupProps)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsxRuntime.jsx(Memo_MRT_TableBody, Object.assign({}, commonTableGroupProps))) : (jsxRuntime.jsx(MRT_TableBody, Object.assign({}, commonTableGroupProps))), enableTableFooter && jsxRuntime.jsx(MRT_TableFooter, Object.assign({}, commonTableGroupProps))] })));
|
|
3501
3506
|
};
|
|
3502
3507
|
|
|
3503
3508
|
const MRT_TableLoadingOverlay = (_a) => {
|
|
@@ -3618,6 +3623,7 @@ const defaultRowsPerPage = [5, 10, 15, 20, 25, 30, 50, 100];
|
|
|
3618
3623
|
const MRT_TablePagination = (_a) => {
|
|
3619
3624
|
var { position = 'bottom', table } = _a, rest = __rest(_a, ["position", "table"]);
|
|
3620
3625
|
const theme = styles.useTheme();
|
|
3626
|
+
const isMobile = useMediaQuery__default["default"]('(max-width: 720px)');
|
|
3621
3627
|
const { getPrePaginationRowModel, getState, options: { enableToolbarInternalActions, icons: { ChevronLeftIcon, ChevronRightIcon, FirstPageIcon, LastPageIcon }, localization, muiPaginationProps, paginationDisplayMode, rowCount, }, setPageIndex, setPageSize, } = table;
|
|
3622
3628
|
const { pagination: { pageIndex = 0, pageSize = 10 }, showGlobalFilter, } = getState();
|
|
3623
3629
|
const paginationProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiPaginationProps, {
|
|
@@ -3628,9 +3634,12 @@ const MRT_TablePagination = (_a) => {
|
|
|
3628
3634
|
const showFirstLastPageButtons = numberOfPages > 2;
|
|
3629
3635
|
const firstRowIndex = pageIndex * pageSize;
|
|
3630
3636
|
const lastRowIndex = Math.min(pageIndex * pageSize + pageSize, totalRowCount);
|
|
3631
|
-
const _b = paginationProps !== null && paginationProps !== void 0 ? paginationProps : {}, { SelectProps, disabled = false, rowsPerPageOptions = defaultRowsPerPage, showFirstButton = showFirstLastPageButtons, showLastButton = showFirstLastPageButtons, showRowsPerPage = true } = _b,
|
|
3637
|
+
const _b = paginationProps !== null && paginationProps !== void 0 ? paginationProps : {}, { SelectProps = {}, disabled = false, rowsPerPageOptions = defaultRowsPerPage, showFirstButton = showFirstLastPageButtons, showLastButton = showFirstLastPageButtons, showRowsPerPage = true } = _b, restPaginationProps = __rest(_b, ["SelectProps", "disabled", "rowsPerPageOptions", "showFirstButton", "showLastButton", "showRowsPerPage"]);
|
|
3632
3638
|
const disableBack = pageIndex <= 0 || disabled;
|
|
3633
3639
|
const disableNext = lastRowIndex >= totalRowCount || disabled;
|
|
3640
|
+
if (isMobile && (SelectProps === null || SelectProps === void 0 ? void 0 : SelectProps.native) !== false) {
|
|
3641
|
+
SelectProps.native = true;
|
|
3642
|
+
}
|
|
3634
3643
|
const tooltipProps = getCommonTooltipProps();
|
|
3635
3644
|
return (jsxRuntime.jsxs(Box__default["default"], { className: "MuiTablePagination-root", sx: {
|
|
3636
3645
|
alignItems: 'center',
|
|
@@ -3648,7 +3657,10 @@ const MRT_TablePagination = (_a) => {
|
|
|
3648
3657
|
px: '8px',
|
|
3649
3658
|
py: '12px',
|
|
3650
3659
|
zIndex: 2,
|
|
3651
|
-
}, children: [showRowsPerPage && (jsxRuntime.jsxs(Box__default["default"], { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsxRuntime.jsx(InputLabel__default["default"], { htmlFor: "mrt-rows-per-page", sx: { mb: 0 }, children: localization.rowsPerPage }), jsxRuntime.jsx(Select__default["default"], Object.assign({
|
|
3660
|
+
}, children: [showRowsPerPage && (jsxRuntime.jsxs(Box__default["default"], { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsxRuntime.jsx(InputLabel__default["default"], { htmlFor: "mrt-rows-per-page", sx: { mb: 0 }, children: localization.rowsPerPage }), jsxRuntime.jsx(Select__default["default"], Object.assign({ MenuProps: { disableScrollLock: true }, disableUnderline: true, disabled: disabled, inputProps: {
|
|
3661
|
+
'aria-label': localization.rowsPerPage,
|
|
3662
|
+
id: 'mrt-rows-per-page',
|
|
3663
|
+
}, label: localization.rowsPerPage, onChange: (event) => setPageSize(+event.target.value), sx: { mb: 0 }, value: pageSize, variant: "standard" }, SelectProps, { children: rowsPerPageOptions.map((option) => {
|
|
3652
3664
|
var _a;
|
|
3653
3665
|
const value = typeof option !== 'number' ? option.value : option;
|
|
3654
3666
|
const label = typeof option !== 'number' ? option.label : `${option}`;
|
|
@@ -3658,7 +3670,7 @@ const MRT_TablePagination = (_a) => {
|
|
|
3658
3670
|
last: LastPageIcon,
|
|
3659
3671
|
next: ChevronRightIcon,
|
|
3660
3672
|
previous: ChevronLeftIcon,
|
|
3661
|
-
} }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton },
|
|
3673
|
+
} }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton }, restPaginationProps))) : paginationDisplayMode === 'default' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography__default["default"], { align: "center", component: "span", sx: { m: '0 4px', minWidth: '8ch' }, variant: "body2", children: `${lastRowIndex === 0 ? 0 : (firstRowIndex + 1).toLocaleString()}-${lastRowIndex.toLocaleString()} ${localization.of} ${totalRowCount.toLocaleString()}` }), jsxRuntime.jsxs(Box__default["default"], { gap: "xs", children: [showFirstButton && (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, tooltipProps, { title: localization.goToFirstPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToFirstPage, disabled: disableBack, onClick: () => setPageIndex(0), size: "small", children: jsxRuntime.jsx(FirstPageIcon, Object.assign({}, flipIconStyles(theme))) }) }) }))), jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, tooltipProps, { title: localization.goToPreviousPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToPreviousPage, disabled: disableBack, onClick: () => setPageIndex(pageIndex - 1), size: "small", children: jsxRuntime.jsx(ChevronLeftIcon, Object.assign({}, flipIconStyles(theme))) }) }) })), jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, tooltipProps, { title: localization.goToNextPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToNextPage, disabled: disableNext, onClick: () => setPageIndex(pageIndex + 1), size: "small", children: jsxRuntime.jsx(ChevronRightIcon, Object.assign({}, flipIconStyles(theme))) }) }) })), showLastButton && (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, tooltipProps, { title: localization.goToLastPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToLastPage, disabled: disableNext, onClick: () => setPageIndex(numberOfPages - 1), size: "small", children: jsxRuntime.jsx(LastPageIcon, Object.assign({}, flipIconStyles(theme))) }) }) })))] })] })) : null] }));
|
|
3662
3674
|
};
|
|
3663
3675
|
|
|
3664
3676
|
const MRT_ToolbarDropZone = (_a) => {
|
|
@@ -3831,7 +3843,7 @@ const MRT_ShowHideColumnsMenu = (_a) => {
|
|
|
3831
3843
|
sx: {
|
|
3832
3844
|
backgroundColor: menuBackgroundColor,
|
|
3833
3845
|
},
|
|
3834
|
-
}, anchorEl: anchorEl, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: [jsxRuntime.jsxs(Box__default["default"], { sx: {
|
|
3846
|
+
}, anchorEl: anchorEl, disableScrollLock: true, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: [jsxRuntime.jsxs(Box__default["default"], { sx: {
|
|
3835
3847
|
display: 'flex',
|
|
3836
3848
|
justifyContent: 'space-between',
|
|
3837
3849
|
p: '0.5rem',
|