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.esm.js
CHANGED
|
@@ -500,7 +500,7 @@ const getMRTTheme = (table, theme) => {
|
|
|
500
500
|
? darken(theme.palette.warning.dark, 0.25)
|
|
501
501
|
: lighten(theme.palette.warning.light, 0.5), menuBackgroundColor: lighten(baseBackgroundColor, 0.07), pinnedRowBackgroundColor: alpha(theme.palette.primary.main, 0.1), selectedRowBackgroundColor: alpha(theme.palette.primary.main, 0.2) }, themeOverrides);
|
|
502
502
|
};
|
|
503
|
-
const
|
|
503
|
+
const commonCellBeforeAfterStyles = {
|
|
504
504
|
content: '""',
|
|
505
505
|
height: '100%',
|
|
506
506
|
left: 0,
|
|
@@ -519,14 +519,16 @@ const getCommonPinnedCellStyles = ({ column, table, theme, }) => {
|
|
|
519
519
|
: getIsFirstRightPinnedColumn(column)
|
|
520
520
|
? `4px 0 4px -4px ${alpha(theme.palette.grey[700], 0.5)} inset`
|
|
521
521
|
: undefined
|
|
522
|
-
: undefined },
|
|
522
|
+
: undefined }, commonCellBeforeAfterStyles),
|
|
523
523
|
},
|
|
524
524
|
};
|
|
525
525
|
};
|
|
526
526
|
const getCommonMRTCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
|
|
527
527
|
var _a, _b, _c, _d, _e, _f;
|
|
528
|
-
const { options: { enableColumnVirtualization, layoutMode }, } = table;
|
|
528
|
+
const { getState, options: { enableColumnVirtualization, layoutMode }, } = table;
|
|
529
|
+
const { draggingColumn } = getState();
|
|
529
530
|
const { columnDef } = column;
|
|
531
|
+
const { columnDefType } = columnDef;
|
|
530
532
|
const isColumnPinned = columnDef.columnDefType !== 'group' && column.getIsPinned();
|
|
531
533
|
const widthStyles = {
|
|
532
534
|
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)`,
|
|
@@ -545,13 +547,21 @@ const getCommonMRTCellStyles = ({ column, header, table, tableCellProps, theme,
|
|
|
545
547
|
? `${column.getStart('left')}px`
|
|
546
548
|
: undefined, opacity: 0.97, position: 'sticky', right: isColumnPinned === 'right'
|
|
547
549
|
? `${getTotalRight(table, column)}px`
|
|
548
|
-
: undefined
|
|
549
|
-
return Object.assign(Object.assign(Object.assign({ backgroundColor: 'inherit', backgroundImage: 'inherit', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined,
|
|
550
|
+
: undefined }) : {};
|
|
551
|
+
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'
|
|
552
|
+
? 'center'
|
|
553
|
+
: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid'))
|
|
554
|
+
? tableCellProps.align
|
|
555
|
+
: undefined, opacity: ((_e = table.getState().draggingColumn) === null || _e === void 0 ? void 0 : _e.id) === column.id ||
|
|
550
556
|
((_f = table.getState().hoveredColumn) === null || _f === void 0 ? void 0 : _f.id) === column.id
|
|
551
557
|
? 0.5
|
|
552
558
|
: 1, position: 'relative', transition: enableColumnVirtualization
|
|
553
559
|
? 'none'
|
|
554
|
-
: `padding 150ms ease-in-out`, zIndex:
|
|
560
|
+
: `padding 150ms ease-in-out`, zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
|
561
|
+
? 2
|
|
562
|
+
: columnDefType !== 'group' && isColumnPinned
|
|
563
|
+
? 1
|
|
564
|
+
: 0 }, pinnedStyles), widthStyles), parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme));
|
|
555
565
|
};
|
|
556
566
|
const getCommonToolbarStyles = ({ table, theme, }) => ({
|
|
557
567
|
alignItems: 'flex-start',
|
|
@@ -757,7 +767,7 @@ const MRT_FilterOptionMenu = (_a) => {
|
|
|
757
767
|
sx: {
|
|
758
768
|
backgroundColor: menuBackgroundColor,
|
|
759
769
|
},
|
|
760
|
-
}, anchorEl: anchorEl, anchorOrigin: { horizontal: 'right', vertical: 'center' }, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: (_e = (header && column && columnDef
|
|
770
|
+
}, anchorEl: anchorEl, anchorOrigin: { horizontal: 'right', vertical: 'center' }, disableScrollLock: true, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: (_e = (header && column && columnDef
|
|
761
771
|
? (_d = (_c = columnDef.renderColumnFilterModeMenuItems) === null || _c === void 0 ? void 0 : _c.call(columnDef, {
|
|
762
772
|
column: column,
|
|
763
773
|
internalFilterOptions,
|
|
@@ -912,7 +922,7 @@ const MRT_ColumnActionMenu = (_a) => {
|
|
|
912
922
|
sx: {
|
|
913
923
|
backgroundColor: menuBackgroundColor,
|
|
914
924
|
},
|
|
915
|
-
}, anchorEl: anchorEl, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: (_l = (_k = (_j = columnDef.renderColumnActionsMenuItems) === null || _j === void 0 ? void 0 : _j.call(columnDef, {
|
|
925
|
+
}, 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, {
|
|
916
926
|
closeMenu: () => setAnchorEl(null),
|
|
917
927
|
column,
|
|
918
928
|
internalColumnMenuItems,
|
|
@@ -936,7 +946,7 @@ const MRT_RowActionMenu = (_a) => {
|
|
|
936
946
|
sx: {
|
|
937
947
|
backgroundColor: menuBackgroundColor,
|
|
938
948
|
},
|
|
939
|
-
}, anchorEl: anchorEl, onClick: (event) => event.stopPropagation(), onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: [parseFromValuesOrFunc(enableEditing, row) &&
|
|
949
|
+
}, anchorEl: anchorEl, disableScrollLock: true, onClick: (event) => event.stopPropagation(), onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: [parseFromValuesOrFunc(enableEditing, row) &&
|
|
940
950
|
['modal', 'row'].includes(editDisplayMode) && (jsx(MenuItem, { onClick: handleEdit, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(EditIcon, {}) }), localization.edit] }) })), renderRowActionMenuItems === null || renderRowActionMenuItems === void 0 ? void 0 : renderRowActionMenuItems({
|
|
941
951
|
closeMenu: () => setAnchorEl(null),
|
|
942
952
|
row,
|
|
@@ -2131,7 +2141,9 @@ const MRT_EditCellTextField = (_a) => {
|
|
|
2131
2141
|
: {})), textFieldProps.InputProps), { sx: (theme) => {
|
|
2132
2142
|
var _a;
|
|
2133
2143
|
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)));
|
|
2134
|
-
} }),
|
|
2144
|
+
} }), SelectProps: {
|
|
2145
|
+
MenuProps: { disableScrollLock: true },
|
|
2146
|
+
}, inputProps: Object.assign({ autoComplete: 'new-password' }, textFieldProps.inputProps), onBlur: handleBlur, onChange: handleChange, onClick: (e) => {
|
|
2135
2147
|
var _a;
|
|
2136
2148
|
e.stopPropagation();
|
|
2137
2149
|
(_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.onClick) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, e);
|
|
@@ -2274,9 +2286,7 @@ const MRT_TableBodyCell = (_a) => {
|
|
|
2274
2286
|
: undefined,
|
|
2275
2287
|
outlineOffset: '-1px',
|
|
2276
2288
|
textOverflow: 'clip',
|
|
2277
|
-
}, alignItems: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'center' : undefined, cursor: isEditable && editDisplayMode === 'cell' ? 'pointer' : 'inherit',
|
|
2278
|
-
? tableCellProps.align
|
|
2279
|
-
: undefined, overflow: 'hidden', p: density === 'compact'
|
|
2289
|
+
}, alignItems: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'center' : undefined, cursor: isEditable && editDisplayMode === 'cell' ? 'pointer' : 'inherit', overflow: 'hidden', p: density === 'compact'
|
|
2280
2290
|
? columnDefType === 'display'
|
|
2281
2291
|
? '0 0.5rem'
|
|
2282
2292
|
: '0.5rem'
|
|
@@ -2286,7 +2296,7 @@ const MRT_TableBodyCell = (_a) => {
|
|
|
2286
2296
|
: '1rem'
|
|
2287
2297
|
: columnDefType === 'display'
|
|
2288
2298
|
? '1rem 1.25rem'
|
|
2289
|
-
: '1.5rem', textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined, whiteSpace: row.getIsPinned() || density === 'compact' ? 'nowrap' : 'normal'
|
|
2299
|
+
: '1.5rem', textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined, whiteSpace: row.getIsPinned() || density === 'compact' ? 'nowrap' : 'normal' }, getCommonMRTCellStyles({
|
|
2290
2300
|
column,
|
|
2291
2301
|
table,
|
|
2292
2302
|
tableCellProps,
|
|
@@ -2403,25 +2413,21 @@ const MRT_TableBodyRow = ({ columnVirtualizer, numRows, pinnedRowIds, row, rowVi
|
|
|
2403
2413
|
}
|
|
2404
2414
|
}, selected: isRowSelected }, tableRowProps, { style: Object.assign({ transform: virtualRow
|
|
2405
2415
|
? `translateY(${virtualRow.start}px)`
|
|
2406
|
-
: undefined }, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style), sx: (theme) => (Object.assign({ '&:hover td':
|
|
2407
|
-
|
|
2408
|
-
? alpha(cellHighlightColorHover, 0.3)
|
|
2409
|
-
: undefined }, pinnedBeforeAfterStyles),
|
|
2410
|
-
}, backgroundColor: `${baseBackgroundColor} !important`, bottom: !virtualRow && bottomPinnedIndex !== undefined && isRowPinned
|
|
2416
|
+
: undefined }, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style), sx: (theme) => (Object.assign({ '&:hover td:after': cellHighlightColorHover
|
|
2417
|
+
? Object.assign({ backgroundColor: alpha(cellHighlightColorHover, 0.3) }, commonCellBeforeAfterStyles) : undefined, backgroundColor: `${baseBackgroundColor} !important`, bottom: !virtualRow && bottomPinnedIndex !== undefined && isRowPinned
|
|
2411
2418
|
? `${bottomPinnedIndex * rowHeight +
|
|
2412
2419
|
(enableStickyFooter ? tableFooterHeight - 1 : 0)}px`
|
|
2413
2420
|
: 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
|
|
2414
2421
|
? 'absolute'
|
|
2415
2422
|
: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) && isRowPinned
|
|
2416
2423
|
? 'sticky'
|
|
2417
|
-
:
|
|
2424
|
+
: 'relative', td: Object.assign({}, getCommonPinnedCellStyles({ table, theme })), 'td:after': cellHighlightColor
|
|
2425
|
+
? Object.assign({ backgroundColor: cellHighlightColor }, commonCellBeforeAfterStyles) : undefined, top: virtualRow
|
|
2418
2426
|
? 0
|
|
2419
2427
|
: topPinnedIndex !== undefined && isRowPinned
|
|
2420
2428
|
? `${topPinnedIndex * rowHeight +
|
|
2421
2429
|
(enableStickyHeader || isFullScreen ? tableHeadHeight - 1 : 0)}px`
|
|
2422
|
-
: undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', width: '100%', zIndex: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) && isRowPinned
|
|
2423
|
-
? 2
|
|
2424
|
-
: undefined }, sx)), children: [virtualPaddingLeft ? (jsx("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : visibleCells).map((cellOrVirtualCell, staticColumnIndex) => {
|
|
2430
|
+
: 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) => {
|
|
2425
2431
|
let cell = cellOrVirtualCell;
|
|
2426
2432
|
if (columnVirtualizer) {
|
|
2427
2433
|
staticColumnIndex = cellOrVirtualCell.index;
|
|
@@ -2531,7 +2537,7 @@ const MRT_TableFooterCell = (_a) => {
|
|
|
2531
2537
|
var _b, _c, _d;
|
|
2532
2538
|
var { footer, staticColumnIndex, table } = _a, rest = __rest(_a, ["footer", "staticColumnIndex", "table"]);
|
|
2533
2539
|
const theme = useTheme();
|
|
2534
|
-
const { getState, options: { enableColumnPinning,
|
|
2540
|
+
const { getState, options: { enableColumnPinning, muiTableFooterCellProps }, } = table;
|
|
2535
2541
|
const { density } = getState();
|
|
2536
2542
|
const { column } = footer;
|
|
2537
2543
|
const { columnDef } = column;
|
|
@@ -2545,12 +2551,13 @@ const MRT_TableFooterCell = (_a) => {
|
|
|
2545
2551
|
? 'center'
|
|
2546
2552
|
: theme.direction === 'rtl'
|
|
2547
2553
|
? 'right'
|
|
2548
|
-
: 'left', colSpan: footer.colSpan, "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, variant: "footer" }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({
|
|
2554
|
+
: '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'
|
|
2549
2555
|
? '0.5rem'
|
|
2550
2556
|
: density === 'comfortable'
|
|
2551
2557
|
? '1rem'
|
|
2552
|
-
: '1.5rem', verticalAlign: 'top'
|
|
2558
|
+
: '1.5rem', verticalAlign: 'top' }, getCommonMRTCellStyles({
|
|
2553
2559
|
column,
|
|
2560
|
+
header: footer,
|
|
2554
2561
|
table,
|
|
2555
2562
|
tableCellProps,
|
|
2556
2563
|
theme,
|
|
@@ -2577,7 +2584,7 @@ const MRT_TableFooterRow = (_a) => {
|
|
|
2577
2584
|
footerGroup,
|
|
2578
2585
|
table,
|
|
2579
2586
|
})), rest);
|
|
2580
|
-
return (jsxs(TableRow, 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 ? (jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter, staticColumnIndex) => {
|
|
2587
|
+
return (jsxs(TableRow, 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 ? (jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter, staticColumnIndex) => {
|
|
2581
2588
|
let footer = footerOrVirtualFooter;
|
|
2582
2589
|
if (columnVirtualizer) {
|
|
2583
2590
|
staticColumnIndex = footerOrVirtualFooter
|
|
@@ -2606,7 +2613,7 @@ const MRT_TableFooter = (_a) => {
|
|
|
2606
2613
|
? theme.palette.mode === 'light'
|
|
2607
2614
|
? `1px solid ${theme.palette.grey[300]}`
|
|
2608
2615
|
: `1px solid ${theme.palette.grey[700]}`
|
|
2609
|
-
: undefined, position: stickFooter ? 'sticky' :
|
|
2616
|
+
: undefined, position: stickFooter ? 'sticky' : 'relative', zIndex: stickFooter ? 1 : undefined }, parseFromValuesOrFunc(tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx, theme))), children: getFooterGroups().map((footerGroup) => (jsx(MRT_TableFooterRow, { columnVirtualizer: columnVirtualizer, footerGroup: footerGroup, table: table }, footerGroup.id))) })));
|
|
2610
2617
|
};
|
|
2611
2618
|
|
|
2612
2619
|
const MRT_TableHeadCellColumnActionsButton = (_a) => {
|
|
@@ -2874,7 +2881,7 @@ const MRT_FilterTextField = (_a) => {
|
|
|
2874
2881
|
} }))) : isAutocompleteFilter ? (jsx(Autocomplete, 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) => {
|
|
2875
2882
|
var _a;
|
|
2876
2883
|
return (jsx(TextField, 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() })));
|
|
2877
|
-
}, value: filterValue }))) : (jsx(TextField, Object.assign({ select: isSelectFilter || isMultiSelectFilter }, commonTextFieldProps, { SelectProps: Object.assign({ displayEmpty: true, multiple: isMultiSelectFilter, renderValue: isMultiSelectFilter
|
|
2884
|
+
}, value: filterValue }))) : (jsx(TextField, Object.assign({ select: isSelectFilter || isMultiSelectFilter }, commonTextFieldProps, { SelectProps: Object.assign({ MenuProps: { disableScrollLock: true }, displayEmpty: true, multiple: isMultiSelectFilter, renderValue: isMultiSelectFilter
|
|
2878
2885
|
? (selected) => !(selected === null || selected === void 0 ? void 0 : selected.length) ? (jsx(Box, { sx: { opacity: 0.5 }, children: filterPlaceholder })) : (jsx(Box, { sx: { display: 'flex', flexWrap: 'wrap', gap: '2px' }, children: selected === null || selected === void 0 ? void 0 : selected.map((value) => {
|
|
2879
2886
|
const selectedValue = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.find((option) => getValueAndLabel(option).value === value);
|
|
2880
2887
|
return (jsx(Chip, { label: getValueAndLabel(selectedValue).label }, value));
|
|
@@ -3251,11 +3258,7 @@ const MRT_TableHeadCell = (_a) => {
|
|
|
3251
3258
|
? '0.25rem'
|
|
3252
3259
|
: density === 'comfortable'
|
|
3253
3260
|
? '.75rem'
|
|
3254
|
-
: '1.25rem', userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top',
|
|
3255
|
-
? 3
|
|
3256
|
-
: column.getIsPinned() && columnDefType !== 'group'
|
|
3257
|
-
? 2
|
|
3258
|
-
: 1 }, getCommonMRTCellStyles({
|
|
3261
|
+
: '1.25rem', userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top' }, getCommonMRTCellStyles({
|
|
3259
3262
|
column,
|
|
3260
3263
|
header,
|
|
3261
3264
|
table,
|
|
@@ -3305,13 +3308,15 @@ const MRT_TableHeadCell = (_a) => {
|
|
|
3305
3308
|
|
|
3306
3309
|
const MRT_TableHeadRow = (_a) => {
|
|
3307
3310
|
var { columnVirtualizer, headerGroup, table } = _a, rest = __rest(_a, ["columnVirtualizer", "headerGroup", "table"]);
|
|
3308
|
-
const { options: { layoutMode, muiTableHeadRowProps }, } = table;
|
|
3311
|
+
const { options: { enableStickyHeader, layoutMode, muiTableHeadRowProps }, } = table;
|
|
3309
3312
|
const { virtualColumns, virtualPaddingLeft, virtualPaddingRight } = columnVirtualizer !== null && columnVirtualizer !== void 0 ? columnVirtualizer : {};
|
|
3310
3313
|
const tableRowProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableHeadRowProps, {
|
|
3311
3314
|
headerGroup,
|
|
3312
3315
|
table,
|
|
3313
3316
|
})), rest);
|
|
3314
|
-
return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: getMRTTheme(table, theme).baseBackgroundColor, boxShadow: `4px 0 8px ${alpha(theme.palette.common.black, 0.1)}`, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined,
|
|
3317
|
+
return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: getMRTTheme(table, theme).baseBackgroundColor, boxShadow: `4px 0 8px ${alpha(theme.palette.common.black, 0.1)}`, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, position: enableStickyHeader && layoutMode === 'semantic'
|
|
3318
|
+
? 'sticky'
|
|
3319
|
+
: 'relative', top: 0 }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader, staticColumnIndex) => {
|
|
3315
3320
|
let header = headerOrVirtualHeader;
|
|
3316
3321
|
if (columnVirtualizer) {
|
|
3317
3322
|
staticColumnIndex = headerOrVirtualHeader
|
|
@@ -3408,7 +3413,7 @@ const MRT_Table = (_a) => {
|
|
|
3408
3413
|
columnVirtualizer,
|
|
3409
3414
|
table,
|
|
3410
3415
|
};
|
|
3411
|
-
return (jsxs(Table, 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 && jsx("caption", { children: Caption }), enableTableHead && jsx(MRT_TableHead, Object.assign({}, commonTableGroupProps)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsx(Memo_MRT_TableBody, Object.assign({}, commonTableGroupProps))) : (jsx(MRT_TableBody, Object.assign({}, commonTableGroupProps))), enableTableFooter && jsx(MRT_TableFooter, Object.assign({}, commonTableGroupProps))] })));
|
|
3416
|
+
return (jsxs(Table, 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 && jsx("caption", { children: Caption }), enableTableHead && jsx(MRT_TableHead, Object.assign({}, commonTableGroupProps)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsx(Memo_MRT_TableBody, Object.assign({}, commonTableGroupProps))) : (jsx(MRT_TableBody, Object.assign({}, commonTableGroupProps))), enableTableFooter && jsx(MRT_TableFooter, Object.assign({}, commonTableGroupProps))] })));
|
|
3412
3417
|
};
|
|
3413
3418
|
|
|
3414
3419
|
const MRT_TableLoadingOverlay = (_a) => {
|
|
@@ -3529,6 +3534,7 @@ const defaultRowsPerPage = [5, 10, 15, 20, 25, 30, 50, 100];
|
|
|
3529
3534
|
const MRT_TablePagination = (_a) => {
|
|
3530
3535
|
var { position = 'bottom', table } = _a, rest = __rest(_a, ["position", "table"]);
|
|
3531
3536
|
const theme = useTheme();
|
|
3537
|
+
const isMobile = useMediaQuery('(max-width: 720px)');
|
|
3532
3538
|
const { getPrePaginationRowModel, getState, options: { enableToolbarInternalActions, icons: { ChevronLeftIcon, ChevronRightIcon, FirstPageIcon, LastPageIcon }, localization, muiPaginationProps, paginationDisplayMode, rowCount, }, setPageIndex, setPageSize, } = table;
|
|
3533
3539
|
const { pagination: { pageIndex = 0, pageSize = 10 }, showGlobalFilter, } = getState();
|
|
3534
3540
|
const paginationProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiPaginationProps, {
|
|
@@ -3539,9 +3545,12 @@ const MRT_TablePagination = (_a) => {
|
|
|
3539
3545
|
const showFirstLastPageButtons = numberOfPages > 2;
|
|
3540
3546
|
const firstRowIndex = pageIndex * pageSize;
|
|
3541
3547
|
const lastRowIndex = Math.min(pageIndex * pageSize + pageSize, totalRowCount);
|
|
3542
|
-
const _b = paginationProps !== null && paginationProps !== void 0 ? paginationProps : {}, { SelectProps, disabled = false, rowsPerPageOptions = defaultRowsPerPage, showFirstButton = showFirstLastPageButtons, showLastButton = showFirstLastPageButtons, showRowsPerPage = true } = _b,
|
|
3548
|
+
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"]);
|
|
3543
3549
|
const disableBack = pageIndex <= 0 || disabled;
|
|
3544
3550
|
const disableNext = lastRowIndex >= totalRowCount || disabled;
|
|
3551
|
+
if (isMobile && (SelectProps === null || SelectProps === void 0 ? void 0 : SelectProps.native) !== false) {
|
|
3552
|
+
SelectProps.native = true;
|
|
3553
|
+
}
|
|
3545
3554
|
const tooltipProps = getCommonTooltipProps();
|
|
3546
3555
|
return (jsxs(Box, { className: "MuiTablePagination-root", sx: {
|
|
3547
3556
|
alignItems: 'center',
|
|
@@ -3559,7 +3568,10 @@ const MRT_TablePagination = (_a) => {
|
|
|
3559
3568
|
px: '8px',
|
|
3560
3569
|
py: '12px',
|
|
3561
3570
|
zIndex: 2,
|
|
3562
|
-
}, children: [showRowsPerPage && (jsxs(Box, { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsx(InputLabel, { htmlFor: "mrt-rows-per-page", sx: { mb: 0 }, children: localization.rowsPerPage }), jsx(Select, Object.assign({
|
|
3571
|
+
}, children: [showRowsPerPage && (jsxs(Box, { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsx(InputLabel, { htmlFor: "mrt-rows-per-page", sx: { mb: 0 }, children: localization.rowsPerPage }), jsx(Select, Object.assign({ MenuProps: { disableScrollLock: true }, disableUnderline: true, disabled: disabled, inputProps: {
|
|
3572
|
+
'aria-label': localization.rowsPerPage,
|
|
3573
|
+
id: 'mrt-rows-per-page',
|
|
3574
|
+
}, label: localization.rowsPerPage, onChange: (event) => setPageSize(+event.target.value), sx: { mb: 0 }, value: pageSize, variant: "standard" }, SelectProps, { children: rowsPerPageOptions.map((option) => {
|
|
3563
3575
|
var _a;
|
|
3564
3576
|
const value = typeof option !== 'number' ? option.value : option;
|
|
3565
3577
|
const label = typeof option !== 'number' ? option.label : `${option}`;
|
|
@@ -3569,7 +3581,7 @@ const MRT_TablePagination = (_a) => {
|
|
|
3569
3581
|
last: LastPageIcon,
|
|
3570
3582
|
next: ChevronRightIcon,
|
|
3571
3583
|
previous: ChevronLeftIcon,
|
|
3572
|
-
} }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton },
|
|
3584
|
+
} }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton }, restPaginationProps))) : paginationDisplayMode === 'default' ? (jsxs(Fragment, { children: [jsx(Typography, { 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()}` }), jsxs(Box, { gap: "xs", children: [showFirstButton && (jsx(Tooltip, Object.assign({}, tooltipProps, { title: localization.goToFirstPage, children: jsx("span", { children: jsx(IconButton, { "aria-label": localization.goToFirstPage, disabled: disableBack, onClick: () => setPageIndex(0), size: "small", children: jsx(FirstPageIcon, Object.assign({}, flipIconStyles(theme))) }) }) }))), jsx(Tooltip, Object.assign({}, tooltipProps, { title: localization.goToPreviousPage, children: jsx("span", { children: jsx(IconButton, { "aria-label": localization.goToPreviousPage, disabled: disableBack, onClick: () => setPageIndex(pageIndex - 1), size: "small", children: jsx(ChevronLeftIcon, Object.assign({}, flipIconStyles(theme))) }) }) })), jsx(Tooltip, Object.assign({}, tooltipProps, { title: localization.goToNextPage, children: jsx("span", { children: jsx(IconButton, { "aria-label": localization.goToNextPage, disabled: disableNext, onClick: () => setPageIndex(pageIndex + 1), size: "small", children: jsx(ChevronRightIcon, Object.assign({}, flipIconStyles(theme))) }) }) })), showLastButton && (jsx(Tooltip, Object.assign({}, tooltipProps, { title: localization.goToLastPage, children: jsx("span", { children: jsx(IconButton, { "aria-label": localization.goToLastPage, disabled: disableNext, onClick: () => setPageIndex(numberOfPages - 1), size: "small", children: jsx(LastPageIcon, Object.assign({}, flipIconStyles(theme))) }) }) })))] })] })) : null] }));
|
|
3573
3585
|
};
|
|
3574
3586
|
|
|
3575
3587
|
const MRT_ToolbarDropZone = (_a) => {
|
|
@@ -3742,7 +3754,7 @@ const MRT_ShowHideColumnsMenu = (_a) => {
|
|
|
3742
3754
|
sx: {
|
|
3743
3755
|
backgroundColor: menuBackgroundColor,
|
|
3744
3756
|
},
|
|
3745
|
-
}, anchorEl: anchorEl, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: [jsxs(Box, { sx: {
|
|
3757
|
+
}, anchorEl: anchorEl, disableScrollLock: true, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: [jsxs(Box, { sx: {
|
|
3746
3758
|
display: 'flex',
|
|
3747
3759
|
justifyContent: 'space-between',
|
|
3748
3760
|
p: '0.5rem',
|