material-react-table 1.0.3 → 1.0.5

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.
@@ -0,0 +1,2 @@
1
+ import { MRT_Localization } from '../MaterialReactTable';
2
+ export declare const MRT_Localization_CS: MRT_Localization;
@@ -502,19 +502,19 @@ const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table,
502
502
 
503
503
  const getColumnId = (columnDef) => { var _a, _b, _c, _d; return (_d = (_a = columnDef.id) !== null && _a !== void 0 ? _a : (_c = (_b = columnDef.accessorKey) === null || _b === void 0 ? void 0 : _b.toString) === null || _c === void 0 ? void 0 : _c.call(_b)) !== null && _d !== void 0 ? _d : columnDef.header; };
504
504
  const getAllLeafColumnDefs = (columns) => {
505
- let lowestLevelColumns = columns;
506
- let currentCols = columns;
507
- while (!!(currentCols === null || currentCols === void 0 ? void 0 : currentCols.length) && currentCols.some((col) => col.columns)) {
508
- const nextCols = currentCols
509
- .filter((col) => !!col.columns)
510
- .map((col) => col.columns)
511
- .flat();
512
- if (nextCols.every((col) => !(col === null || col === void 0 ? void 0 : col.columns))) {
513
- lowestLevelColumns = [...lowestLevelColumns, ...nextCols];
514
- }
515
- currentCols = nextCols;
516
- }
517
- return lowestLevelColumns.filter((col) => !col.columns);
505
+ const allLeafColumnDefs = [];
506
+ const getLeafColumns = (cols) => {
507
+ cols.forEach((col) => {
508
+ if (col.columns) {
509
+ getLeafColumns(col.columns);
510
+ }
511
+ else {
512
+ allLeafColumnDefs.push(col);
513
+ }
514
+ });
515
+ };
516
+ getLeafColumns(columns);
517
+ return allLeafColumnDefs;
518
518
  };
519
519
  const prepareColumns = ({ columnDefs, columnFilterFns, defaultDisplayColumn, filterFns, sortingFns, }) => columnDefs.map((columnDef) => {
520
520
  var _a, _b;
@@ -1953,7 +1953,7 @@ const MRT_TableHead = ({ table }) => {
1953
1953
  const tableHeadProps = muiTableHeadProps instanceof Function
1954
1954
  ? muiTableHeadProps({ table })
1955
1955
  : muiTableHeadProps;
1956
- return (React.createElement(TableHead, Object.assign({}, tableHeadProps, { sx: (theme) => (Object.assign({ opacity: enableStickyHeader ? 0.97 : undefined, position: enableStickyHeader ? 'sticky' : undefined, zIndex: enableStickyHeader ? 2 : undefined }, ((tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx) instanceof Function
1956
+ return (React.createElement(TableHead, Object.assign({}, tableHeadProps, { sx: (theme) => (Object.assign({ opacity: 0.97, position: enableStickyHeader ? 'sticky' : undefined, zIndex: enableStickyHeader ? 2 : undefined }, ((tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx) instanceof Function
1957
1957
  ? tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx(theme)
1958
1958
  : tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx))) }), getHeaderGroups().map((headerGroup) => (React.createElement(MRT_TableHeadRow, { headerGroup: headerGroup, key: headerGroup.id, table: table })))));
1959
1959
  };