material-react-table 1.11.2 → 1.11.4
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/cjs/index.js +32 -24
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/MaterialReactTable.d.ts +3 -4
- package/dist/cjs/types/_locales/hu.d.ts +2 -0
- package/dist/cjs/types/index.d.ts +3 -2
- package/dist/esm/material-react-table.esm.js +32 -25
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/MaterialReactTable.d.ts +3 -4
- package/dist/esm/types/_locales/hu.d.ts +2 -0
- package/dist/esm/types/index.d.ts +3 -2
- package/dist/index.d.ts +27 -22
- package/locales/hu.d.ts +2 -0
- package/locales/hu.esm.d.ts +2 -0
- package/locales/hu.esm.js +94 -0
- package/locales/hu.esm.js.map +1 -0
- package/locales/hu.js +98 -0
- package/locales/hu.js.map +1 -0
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +4 -4
- package/src/_locales/hu.ts +94 -0
- package/src/body/MRT_TableBody.tsx +5 -1
- package/src/body/MRT_TableBodyRow.tsx +10 -6
- package/src/column.utils.ts +4 -3
- package/src/index.tsx +4 -2
- package/src/menus/MRT_ColumnActionMenu.tsx +19 -15
- package/src/table/MRT_TableRoot.tsx +15 -15
package/dist/cjs/index.js
CHANGED
@@ -314,7 +314,10 @@ const getIsFirstRightPinnedColumn = (column) => {
|
|
314
314
|
return column.getIsPinned() === 'right' && column.getPinnedIndex() === 0;
|
315
315
|
};
|
316
316
|
const getTotalRight = (table, column) => {
|
317
|
-
return
|
317
|
+
return table
|
318
|
+
.getRightLeafHeaders()
|
319
|
+
.slice(column.getPinnedIndex() + 1)
|
320
|
+
.reduce((acc, col) => acc + col.getSize(), 0);
|
318
321
|
};
|
319
322
|
const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
|
320
323
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
@@ -759,7 +762,7 @@ const commonListItemStyles = {
|
|
759
762
|
};
|
760
763
|
const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
761
764
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
762
|
-
const { getState, toggleAllColumnsVisible, setColumnOrder, options: { columnFilterModeOptions, enableColumnFilterModes, enableColumnFilters, enableColumnResizing, enableGrouping, enableHiding, enablePinning, enableSorting, icons: { ArrowRightIcon, ClearAllIcon, ViewColumnIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, SortIcon, RestartAltIcon, VisibilityOffIcon, }, localization, renderColumnActionsMenuItems, }, refs: { filterInputRefs }, setColumnSizingInfo, setShowColumnFilters, } = table;
|
765
|
+
const { getState, toggleAllColumnsVisible, setColumnOrder, options: { columnFilterModeOptions, enableColumnFilterModes, enableColumnFilters, enableColumnResizing, enableGrouping, enableHiding, enablePinning, enableSorting, enableSortingRemoval, icons: { ArrowRightIcon, ClearAllIcon, ViewColumnIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, SortIcon, RestartAltIcon, VisibilityOffIcon, }, localization, renderColumnActionsMenuItems, }, refs: { filterInputRefs }, setColumnSizingInfo, setShowColumnFilters, } = table;
|
763
766
|
const { column } = header;
|
764
767
|
const { columnDef } = column;
|
765
768
|
const { columnSizing, columnVisibility, density, showColumnFilters } = getState();
|
@@ -829,23 +832,24 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
|
829
832
|
column,
|
830
833
|
table,
|
831
834
|
})) !== null && _d !== void 0 ? _d : (enableSorting &&
|
832
|
-
column.getCanSort() &&
|
833
|
-
|
834
|
-
React__default["default"].createElement(
|
835
|
-
React__default["default"].createElement(
|
836
|
-
React__default["default"].createElement(
|
837
|
-
|
838
|
-
|
839
|
-
React__default["default"].createElement(
|
840
|
-
React__default["default"].createElement(
|
841
|
-
React__default["default"].createElement(
|
842
|
-
|
843
|
-
|
844
|
-
React__default["default"].createElement(
|
845
|
-
React__default["default"].createElement(
|
846
|
-
React__default["default"].createElement(
|
847
|
-
|
848
|
-
|
835
|
+
column.getCanSort() &&
|
836
|
+
[
|
837
|
+
enableSortingRemoval !== false && (React__default["default"].createElement(MenuItem__default["default"], { disabled: !column.getIsSorted(), key: 0, onClick: handleClearSort, sx: commonMenuItemStyles },
|
838
|
+
React__default["default"].createElement(Box__default["default"], { sx: commonListItemStyles },
|
839
|
+
React__default["default"].createElement(ListItemIcon__default["default"], null,
|
840
|
+
React__default["default"].createElement(ClearAllIcon, null)),
|
841
|
+
localization.clearSort))),
|
842
|
+
React__default["default"].createElement(MenuItem__default["default"], { disabled: column.getIsSorted() === 'asc', key: 1, onClick: handleSortAsc, sx: commonMenuItemStyles },
|
843
|
+
React__default["default"].createElement(Box__default["default"], { sx: commonListItemStyles },
|
844
|
+
React__default["default"].createElement(ListItemIcon__default["default"], null,
|
845
|
+
React__default["default"].createElement(SortIcon, { style: { transform: 'rotate(180deg) scaleX(-1)' } })), (_e = localization.sortByColumnAsc) === null || _e === void 0 ? void 0 :
|
846
|
+
_e.replace('{column}', String(columnDef.header)))),
|
847
|
+
React__default["default"].createElement(MenuItem__default["default"], { divider: enableColumnFilters || enableGrouping || enableHiding, key: 2, disabled: column.getIsSorted() === 'desc', onClick: handleSortDesc, sx: commonMenuItemStyles },
|
848
|
+
React__default["default"].createElement(Box__default["default"], { sx: commonListItemStyles },
|
849
|
+
React__default["default"].createElement(ListItemIcon__default["default"], null,
|
850
|
+
React__default["default"].createElement(SortIcon, null)), (_f = localization.sortByColumnDesc) === null || _f === void 0 ? void 0 :
|
851
|
+
_f.replace('{column}', String(columnDef.header)))),
|
852
|
+
].filter(Boolean)),
|
849
853
|
enableColumnFilters &&
|
850
854
|
column.getCanFilter() &&
|
851
855
|
[
|
@@ -2565,9 +2569,7 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, row, row
|
|
2565
2569
|
rowRef.current = node;
|
2566
2570
|
measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
|
2567
2571
|
}
|
2568
|
-
} }, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: styles.lighten(theme.palette.background.default, 0.06), display: layoutMode === 'grid' ? 'flex' : 'table-row', opacity: (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id ? 0.5 : 1, position: virtualRow ? 'absolute' : undefined, top: virtualRow ? 0 : undefined,
|
2569
|
-
? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
|
2570
|
-
: undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', width: '100%', '&:hover td': {
|
2572
|
+
} }, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: styles.lighten(theme.palette.background.default, 0.06), boxSizing: 'border-box', display: layoutMode === 'grid' ? 'flex' : 'table-row', opacity: (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id ? 0.5 : 1, position: virtualRow ? 'absolute' : undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', top: virtualRow ? 0 : undefined, width: '100%', '&:hover td': {
|
2571
2573
|
backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false
|
2572
2574
|
? row.getIsSelected()
|
2573
2575
|
? `${styles.alpha(theme.palette.primary.main, 0.2)}`
|
@@ -2577,7 +2579,9 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, row, row
|
|
2577
2579
|
: undefined,
|
2578
2580
|
} }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
|
2579
2581
|
? tableRowProps.sx(theme)
|
2580
|
-
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx)))
|
2582
|
+
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))), style: Object.assign({ transform: virtualRow
|
2583
|
+
? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
|
2584
|
+
: undefined }, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style) }),
|
2581
2585
|
virtualPaddingLeft ? (React__default["default"].createElement("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null,
|
2582
2586
|
(virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : row.getVisibleCells()).map((cellOrVirtualCell) => {
|
2583
2587
|
const cell = columnVirtualizer
|
@@ -2655,7 +2659,10 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
|
|
2655
2659
|
pagination.pageSize,
|
2656
2660
|
]);
|
2657
2661
|
const rowVirtualizer = enableRowVirtualization
|
2658
|
-
? reactVirtual.useVirtualizer(Object.assign(Object.assign({ count: rows.length, estimateSize: () => density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73, getScrollElement: () => tableContainerRef.current, measureElement:
|
2662
|
+
? reactVirtual.useVirtualizer(Object.assign(Object.assign({ count: rows.length, estimateSize: () => density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73, getScrollElement: () => tableContainerRef.current, measureElement: typeof window !== 'undefined' &&
|
2663
|
+
navigator.userAgent.indexOf('Firefox') === -1
|
2664
|
+
? (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height
|
2665
|
+
: undefined, overscan: 4 }, vProps_old), vProps))
|
2659
2666
|
: undefined;
|
2660
2667
|
if (rowVirtualizerInstanceRef && rowVirtualizer) {
|
2661
2668
|
rowVirtualizerInstanceRef.current = rowVirtualizer;
|
@@ -3259,6 +3266,7 @@ exports.MRT_GlobalFilterTextField = MRT_GlobalFilterTextField;
|
|
3259
3266
|
exports.MRT_GrabHandleButton = MRT_GrabHandleButton;
|
3260
3267
|
exports.MRT_ShowHideColumnsButton = MRT_ShowHideColumnsButton;
|
3261
3268
|
exports.MRT_SortingFns = MRT_SortingFns;
|
3269
|
+
exports.MRT_TableHeadCellFilterContainer = MRT_TableHeadCellFilterContainer;
|
3262
3270
|
exports.MRT_TablePagination = MRT_TablePagination;
|
3263
3271
|
exports.MRT_ToggleDensePaddingButton = MRT_ToggleDensePaddingButton;
|
3264
3272
|
exports.MRT_ToggleFiltersButton = MRT_ToggleFiltersButton;
|