material-react-table 1.0.4 → 1.0.6

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.
@@ -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;
@@ -566,9 +566,10 @@ const getLeadingDisplayColumnIds = (props) => {
566
566
  var _a;
567
567
  return [
568
568
  (props.enableRowDragging || props.enableRowOrdering) && 'mrt-row-drag',
569
- ((props.positionActionsColumn === 'first' && props.enableRowActions) ||
570
- (props.enableEditing &&
571
- ['row', 'modal'].includes((_a = props.editingMode) !== null && _a !== void 0 ? _a : ''))) &&
569
+ props.positionActionsColumn === 'first' &&
570
+ (props.enableRowActions ||
571
+ (props.enableEditing &&
572
+ ['row', 'modal'].includes((_a = props.editingMode) !== null && _a !== void 0 ? _a : ''))) &&
572
573
  'mrt-row-actions',
573
574
  props.positionExpandColumn === 'first' &&
574
575
  showExpandColumn(props) &&
@@ -580,9 +581,10 @@ const getLeadingDisplayColumnIds = (props) => {
580
581
  const getTrailingDisplayColumnIds = (props) => {
581
582
  var _a;
582
583
  return [
583
- ((props.positionActionsColumn === 'last' && props.enableRowActions) ||
584
- (props.enableEditing &&
585
- ['row', 'modal'].includes((_a = props.editingMode) !== null && _a !== void 0 ? _a : ''))) &&
584
+ props.positionActionsColumn === 'last' &&
585
+ (props.enableRowActions ||
586
+ (props.enableEditing &&
587
+ ['row', 'modal'].includes((_a = props.editingMode) !== null && _a !== void 0 ? _a : ''))) &&
586
588
  'mrt-row-actions',
587
589
  props.positionExpandColumn === 'last' &&
588
590
  showExpandColumn(props) &&