@infinite-table/infinite-react 9.0.0-canary.0 → 9.0.1

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/index.dev.mjs CHANGED
@@ -2479,6 +2479,30 @@ function FilterIcon(props) {
2479
2479
  );
2480
2480
  }
2481
2481
 
2482
+ // src/components/InfiniteTable/utils/getColumnComputedType.ts
2483
+ var emptyType = Object.freeze({});
2484
+ var defaultFilterTypes = {
2485
+ string: emptyType,
2486
+ number: {}
2487
+ };
2488
+ function getColumnComputedType(column, columnTypes) {
2489
+ const defaultType = columnTypes["default"] || emptyType;
2490
+ if (column.type === void 0) {
2491
+ return defaultType;
2492
+ }
2493
+ if (column.type === null) {
2494
+ return emptyType;
2495
+ }
2496
+ if (typeof column.type === "string") {
2497
+ const type = columnTypes[column.type] || defaultFilterTypes[column.type] || emptyType;
2498
+ return type;
2499
+ }
2500
+ return column.type.reduce(
2501
+ (acc, columnType) => Object.assign(acc, columnTypes[columnType]),
2502
+ {}
2503
+ );
2504
+ }
2505
+
2482
2506
  // src/components/flexbox/index.ts
2483
2507
  var computeFlex = (params) => {
2484
2508
  const {
@@ -2913,30 +2937,6 @@ function assignExcept(exceptKeys, target, ...rest) {
2913
2937
  return assignFiltered((_value, key) => !(key in exceptKeys), target, ...rest);
2914
2938
  }
2915
2939
 
2916
- // src/components/InfiniteTable/utils/getColumnComputedType.ts
2917
- var emptyType = Object.freeze({});
2918
- var defaultFilterTypes = {
2919
- string: emptyType,
2920
- number: {}
2921
- };
2922
- function getColumnComputedType(column, columnTypes) {
2923
- const defaultType = columnTypes["default"] || emptyType;
2924
- if (column.type === void 0) {
2925
- return defaultType;
2926
- }
2927
- if (column.type === null) {
2928
- return emptyType;
2929
- }
2930
- if (typeof column.type === "string") {
2931
- const type = columnTypes[column.type] || defaultFilterTypes[column.type] || emptyType;
2932
- return type;
2933
- }
2934
- return column.type.reduce(
2935
- (acc, columnType) => Object.assign(acc, columnTypes[columnType]),
2936
- {}
2937
- );
2938
- }
2939
-
2940
2940
  // src/components/InfiniteTable/utils/getComputedColumns.ts
2941
2941
  var DEFAULT_SORTABLE = true;
2942
2942
  var DEFAULT_RESIZABLE = true;
@@ -2955,8 +2955,63 @@ var getComputedPinned = (colId, columnPinning) => {
2955
2955
  const computedPinned = pinned === "start" || pinned === true ? "start" : pinned === "end" ? "end" : false;
2956
2956
  return computedPinned;
2957
2957
  };
2958
+ function findColumnForField(columns, field) {
2959
+ if (!columns) {
2960
+ return void 0;
2961
+ }
2962
+ if (columns[field]) {
2963
+ return columns[field];
2964
+ }
2965
+ return Object.values(columns).find((col) => col.field === field);
2966
+ }
2967
+ function getSortTypeFromUserColumn(column, columnTypes) {
2968
+ const colType = getColumnComputedType(column, columnTypes);
2969
+ if (column.sortType) {
2970
+ return column.sortType;
2971
+ }
2972
+ if (colType.sortType) {
2973
+ return colType.sortType;
2974
+ }
2975
+ if (typeof column.type === "string") {
2976
+ return column.type;
2977
+ }
2978
+ return DEFAULT_DATA_TYPE;
2979
+ }
2980
+ function getSortTypeForGroupByFromUserColumns(groupByForColumn, userColumns, columnTypes) {
2981
+ const list = Array.isArray(groupByForColumn) ? groupByForColumn : groupByForColumn ? [groupByForColumn] : [];
2982
+ const types = list.flatMap((groupBy) => {
2983
+ const field = groupBy.field ?? groupBy.groupField;
2984
+ if (!field) {
2985
+ return [UNKNOWN_SORT_TYPE];
2986
+ }
2987
+ const userCol = findColumnForField(userColumns, field);
2988
+ if (!userCol) {
2989
+ return [UNKNOWN_SORT_TYPE];
2990
+ }
2991
+ const sortType = getSortTypeFromUserColumn(userCol, columnTypes);
2992
+ return Array.isArray(sortType) ? sortType : [sortType];
2993
+ });
2994
+ if (types.every((type) => type === UNKNOWN_SORT_TYPE)) {
2995
+ return UNKNOWN_SORT_TYPE;
2996
+ }
2997
+ return types.length === 1 ? types[0] : types;
2998
+ }
2999
+ function getColumnComputedSortable(column, options) {
3000
+ const { colType, sortable, columnDefaultSortable } = options;
3001
+ let sortableColumnOrType = column.defaultSortable ?? colType.defaultSortable;
3002
+ const isGroupColumn = !!column.groupByForColumn;
3003
+ if (sortableColumnOrType == null && !isGroupColumn) {
3004
+ const field = column.field ?? colType.field;
3005
+ const valueGetter = column.valueGetter ?? colType.valueGetter;
3006
+ if (field == null && valueGetter == null) {
3007
+ sortableColumnOrType = false;
3008
+ }
3009
+ }
3010
+ return sortable ?? sortableColumnOrType ?? columnDefaultSortable ?? DEFAULT_SORTABLE;
3011
+ }
2958
3012
  var getComputedColumns = ({
2959
3013
  columns,
3014
+ userColumns,
2960
3015
  bodySize,
2961
3016
  columnMinWidth,
2962
3017
  columnMaxWidth,
@@ -3210,15 +3265,13 @@ var getComputedColumns = ({
3210
3265
  if (c.groupByForColumn) {
3211
3266
  computedGroupable = false;
3212
3267
  }
3213
- let sortableColumnOrType = c.defaultSortable ?? colType.defaultSortable;
3214
- if (sortableColumnOrType == null && !c.groupByForColumn) {
3215
- if (field == null && valueGetter == null) {
3216
- sortableColumnOrType = false;
3217
- }
3218
- }
3219
3268
  const computedGroupedBy = field ? groupByFields[field] !== void 0 : false;
3220
3269
  const computedGroupedByIndex = computedGroupedBy ? groupByFields[field] : void 0;
3221
- let computedSortable = sortable ?? sortableColumnOrType ?? columnDefaultSortable ?? DEFAULT_SORTABLE;
3270
+ const computedSortable = getColumnComputedSortable(c, {
3271
+ colType,
3272
+ sortable,
3273
+ columnDefaultSortable
3274
+ });
3222
3275
  const computedResizable = c.resizable ?? colType.resizable ?? resizableColumns ?? DEFAULT_RESIZABLE;
3223
3276
  const result2 = {
3224
3277
  colType,
@@ -3308,7 +3361,11 @@ var getComputedColumns = ({
3308
3361
  prevPinned = computedPinned;
3309
3362
  }
3310
3363
  if (result2.groupByForColumn) {
3311
- result2.computedSortType = c.sortType || colType.sortType || UNKNOWN_SORT_TYPE;
3364
+ result2.computedSortType = c.sortType || colType.sortType || getSortTypeForGroupByFromUserColumns(
3365
+ result2.groupByForColumn,
3366
+ userColumns,
3367
+ columnTypes
3368
+ );
3312
3369
  groupColumns.push(result2);
3313
3370
  }
3314
3371
  computedColumnsMap.set(result2.id, result2);
@@ -3320,6 +3377,8 @@ var getComputedColumns = ({
3320
3377
  groupColumns.forEach((col) => {
3321
3378
  col.computedSortable = isGroupColumnSortable(col, {
3322
3379
  fieldsToColumn,
3380
+ userColumns,
3381
+ columnTypes,
3323
3382
  sortable,
3324
3383
  columnDefaultSortable
3325
3384
  });
@@ -3368,7 +3427,13 @@ var getComputedColumns = ({
3368
3427
 
3369
3428
  // src/components/InfiniteTable/api/getColumnApi.ts
3370
3429
  function isGroupColumnSortable(column, options) {
3371
- const { sortable, fieldsToColumn, columnDefaultSortable } = options;
3430
+ const {
3431
+ sortable,
3432
+ fieldsToColumn,
3433
+ columnDefaultSortable,
3434
+ userColumns,
3435
+ columnTypes
3436
+ } = options;
3372
3437
  if (sortable) {
3373
3438
  return sortable;
3374
3439
  }
@@ -3377,7 +3442,8 @@ function isGroupColumnSortable(column, options) {
3377
3442
  return sortableColumnOrType;
3378
3443
  }
3379
3444
  const defaultSortable = columnDefaultSortable ?? DEFAULT_SORTABLE;
3380
- if (column.computedSortType !== UNKNOWN_SORT_TYPE && defaultSortable) {
3445
+ const explicitSortType = column.sortType ?? column.colType.sortType;
3446
+ if (explicitSortType != null && explicitSortType !== UNKNOWN_SORT_TYPE && defaultSortable) {
3381
3447
  return true;
3382
3448
  }
3383
3449
  const isSortable = (params) => {
@@ -3398,7 +3464,17 @@ function isGroupColumnSortable(column, options) {
3398
3464
  if (foundCol && foundColApi) {
3399
3465
  colSortable = foundColApi.isSortable();
3400
3466
  } else {
3401
- colSortable = false;
3467
+ const userCol = findColumnForField(userColumns, field);
3468
+ if (userCol) {
3469
+ const userSortable = getColumnComputedSortable(userCol, {
3470
+ colType: getColumnComputedType(userCol, columnTypes ?? {}),
3471
+ sortable,
3472
+ columnDefaultSortable
3473
+ });
3474
+ colSortable = typeof userSortable === "boolean" ? userSortable : void 0;
3475
+ } else {
3476
+ colSortable = false;
3477
+ }
3402
3478
  }
3403
3479
  }
3404
3480
  if (colSortable === void 0 && groupBy.valueGetter) {
@@ -6140,7 +6216,6 @@ var useColumnPointerEvents = ({
6140
6216
  const pointerId = e2.pointerId;
6141
6217
  requestAnimationFrame(() => {
6142
6218
  const { multiSortBehavior } = getState();
6143
- const target2 = domRef.current;
6144
6219
  const rootNode = rootRef.current;
6145
6220
  rootNode?.classList.remove(InfiniteClsShiftingColumns);
6146
6221
  dragger.stop();
@@ -6149,10 +6224,12 @@ var useColumnPointerEvents = ({
6149
6224
  });
6150
6225
  discardAlwaysRenderedColumn?.();
6151
6226
  restoreRenderRange?.();
6152
- target2.style.cursor = initialCursor;
6153
- target2.releasePointerCapture(pointerId);
6154
- target2.removeEventListener("pointermove", onPointerMove);
6155
- target2.removeEventListener("pointerup", onPointerUp);
6227
+ target.style.cursor = initialCursor;
6228
+ if (target.hasPointerCapture?.(pointerId)) {
6229
+ target.releasePointerCapture(pointerId);
6230
+ }
6231
+ target.removeEventListener("pointermove", onPointerMove);
6232
+ target.removeEventListener("pointerup", onPointerUp);
6156
6233
  setProxyPosition(null);
6157
6234
  const dragColumnSortable = api.getColumnApi(dragColumn.id)?.isSortable() ?? false;
6158
6235
  if (!didDragAtLeastOnce && dragColumnSortable) {
@@ -16109,7 +16186,6 @@ function getPivotColumnsAndColumnGroups({
16109
16186
  pivotGroupKey: keys[keys.length - 1],
16110
16187
  pivotIndex: keys.length - 1,
16111
16188
  pivotByAtIndex: pivotByForColumn,
16112
- defaultSortable: false,
16113
16189
  columnGroup: parentColumnGroupId,
16114
16190
  header,
16115
16191
  valueFormatter: ({ rowInfo }) => {
@@ -16165,7 +16241,6 @@ function getPivotColumnsAndColumnGroups({
16165
16241
  pivotByAtIndex: pivotByForColumn,
16166
16242
  pivotIndex: keys.length - 1,
16167
16243
  pivotBy,
16168
- defaultSortable: false,
16169
16244
  valueFormatter: ({ rowInfo }) => {
16170
16245
  if (!rowInfo.isGroupRow) {
16171
16246
  return null;
@@ -20854,6 +20929,175 @@ function getDataSourceStateRestoreForDetails(state) {
20854
20929
  };
20855
20930
  }
20856
20931
 
20932
+ // src/components/DataSource/state/enrichSortInfoFromGroupBy.ts
20933
+ var GROUP_COLUMN_ID = "group-by";
20934
+ var GROUP_COLUMN_ID_PREFIX = "group-by-";
20935
+ function getSortFieldsForGroupBy(groupBy) {
20936
+ const fields = groupBy.map((g) => {
20937
+ if (g.valueGetter) {
20938
+ return (item) => g.valueGetter({ data: item, field: g.field });
20939
+ }
20940
+ return g.field ?? g.groupField;
20941
+ }).filter(Boolean);
20942
+ if (!fields.length) {
20943
+ return void 0;
20944
+ }
20945
+ if (fields.length === 1 && typeof fields[0] !== "function") {
20946
+ return fields[0];
20947
+ }
20948
+ return fields;
20949
+ }
20950
+ function enrichSortInfoFromGroupBy(sortInfo, groupBy) {
20951
+ if (!sortInfo?.length || !groupBy?.length) {
20952
+ return sortInfo;
20953
+ }
20954
+ let changed = false;
20955
+ const next = sortInfo.map((info) => {
20956
+ if (info.field != null || !info.id) {
20957
+ return info;
20958
+ }
20959
+ if (info.id === GROUP_COLUMN_ID) {
20960
+ const field = getSortFieldsForGroupBy(groupBy);
20961
+ if (field == null) {
20962
+ return info;
20963
+ }
20964
+ changed = true;
20965
+ return { ...info, field };
20966
+ }
20967
+ if (info.id.startsWith(GROUP_COLUMN_ID_PREFIX)) {
20968
+ const key = info.id.slice(GROUP_COLUMN_ID_PREFIX.length);
20969
+ const match = groupBy.find(
20970
+ (g) => String(g.field) === key || g.groupField === key
20971
+ );
20972
+ if (!match) {
20973
+ return info;
20974
+ }
20975
+ const field = getSortFieldsForGroupBy([match]);
20976
+ if (field == null) {
20977
+ return info;
20978
+ }
20979
+ changed = true;
20980
+ return { ...info, field };
20981
+ }
20982
+ return info;
20983
+ });
20984
+ return changed ? next : sortInfo;
20985
+ }
20986
+
20987
+ // src/components/DataSource/state/sortGroupedRowInfosByPivotColumns.ts
20988
+ function getRowNesting(row) {
20989
+ return "groupNesting" in row ? row.groupNesting ?? 0 : 0;
20990
+ }
20991
+ function getPivotCellValue(row, sort) {
20992
+ if (!row.isGroupRow || !sort.reducerId) {
20993
+ return void 0;
20994
+ }
20995
+ if (sort.pivotTotalColumn && (!sort.pivotGroupKeys || sort.pivotGroupKeys.length === 0)) {
20996
+ return row.reducerResults?.[sort.reducerId];
20997
+ }
20998
+ return row.pivotValuesMap?.get(sort.pivotGroupKeys)?.reducerResults?.[sort.reducerId];
20999
+ }
21000
+ function comparePivotValues(a, b, sort, sortTypes) {
21001
+ if (a == null && b == null) {
21002
+ return 0;
21003
+ }
21004
+ if (a == null) {
21005
+ return 1;
21006
+ }
21007
+ if (b == null) {
21008
+ return -1;
21009
+ }
21010
+ const type = Array.isArray(sort.type) ? sort.type[0] : sort.type;
21011
+ const fn = sort.fn || type && sortTypes[type] || sortTypes.string || sortTypes_default.string;
21012
+ const result = fn(a, b);
21013
+ return result === 0 ? 0 : sort.dir * result;
21014
+ }
21015
+ function toPivotSorts(sortInfo, pivotColumns) {
21016
+ if (!sortInfo?.length || !pivotColumns) {
21017
+ return [];
21018
+ }
21019
+ const result = [];
21020
+ for (const info of sortInfo) {
21021
+ const col = info.id ? pivotColumns[info.id] : void 0;
21022
+ if (!col?.pivotColumn || !col.pivotAggregator) {
21023
+ continue;
21024
+ }
21025
+ result.push({
21026
+ dir: info.dir,
21027
+ type: info.type,
21028
+ fn: info.fn,
21029
+ pivotGroupKeys: col.pivotGroupKeys ?? [],
21030
+ reducerId: col.pivotAggregator.id,
21031
+ pivotTotalColumn: !!col.pivotTotalColumn
21032
+ });
21033
+ }
21034
+ return result;
21035
+ }
21036
+ function buildTree(rows) {
21037
+ const roots = [];
21038
+ const stack = [];
21039
+ for (const row of rows) {
21040
+ const node = { row, children: [] };
21041
+ const nesting = getRowNesting(row);
21042
+ while (stack.length && getRowNesting(stack[stack.length - 1].row) >= nesting) {
21043
+ stack.pop();
21044
+ }
21045
+ if (!stack.length) {
21046
+ roots.push(node);
21047
+ } else {
21048
+ stack[stack.length - 1].children.push(node);
21049
+ }
21050
+ stack.push(node);
21051
+ }
21052
+ return roots;
21053
+ }
21054
+ function flattenSortedTree(roots) {
21055
+ const result = [];
21056
+ const walk = (nodes, parentIndexes) => {
21057
+ nodes.forEach((node, indexInGroup) => {
21058
+ const indexInParentGroups = [...parentIndexes, indexInGroup];
21059
+ const row = node.row;
21060
+ row.indexInGroup = indexInGroup;
21061
+ row.indexInParentGroups = indexInParentGroups;
21062
+ row.indexInAll = result.length;
21063
+ result.push(row);
21064
+ walk(node.children, indexInParentGroups);
21065
+ });
21066
+ };
21067
+ walk(roots, []);
21068
+ return result;
21069
+ }
21070
+ function sortGroupedRowInfosByPivotColumns(dataArray, sortInfo, pivotColumns, sortTypes) {
21071
+ const pivotSorts = toPivotSorts(sortInfo, pivotColumns);
21072
+ if (!pivotSorts.length || !dataArray.length) {
21073
+ return dataArray;
21074
+ }
21075
+ const knownSortTypes = { ...sortTypes_default, ...sortTypes };
21076
+ const roots = buildTree(dataArray);
21077
+ const compareNodes = (a, b) => {
21078
+ for (const sort of pivotSorts) {
21079
+ const result = comparePivotValues(
21080
+ getPivotCellValue(a.row, sort),
21081
+ getPivotCellValue(b.row, sort),
21082
+ sort,
21083
+ knownSortTypes
21084
+ );
21085
+ if (result !== 0) {
21086
+ return result;
21087
+ }
21088
+ }
21089
+ return 0;
21090
+ };
21091
+ const sortTree = (nodes) => {
21092
+ nodes.sort(compareNodes);
21093
+ for (const node of nodes) {
21094
+ sortTree(node.children);
21095
+ }
21096
+ };
21097
+ sortTree(roots);
21098
+ return flattenSortedTree(roots);
21099
+ }
21100
+
20857
21101
  // src/components/DataSource/state/reducer.ts
20858
21102
  function cleanupEmptyFilterValues(filterValue, filterTypes) {
20859
21103
  if (!filterValue) {
@@ -21074,7 +21318,7 @@ function concludeReducer(params) {
21074
21318
  rootMarker = getMarker(debugId).track.DataSource.label.PrepareData.start();
21075
21319
  }
21076
21320
  const cacheAffectedParts = getCacheAffectedParts(state);
21077
- const sortInfo = state.sortInfo;
21321
+ const sortInfo = enrichSortInfoFromGroupBy(state.sortInfo, state.groupBy);
21078
21322
  const sortMode = state.sortMode;
21079
21323
  let shouldSort = !!sortInfo?.length ? sortMode === "local" : false;
21080
21324
  if (state.lazyLoad || state.livePagination) {
@@ -21437,6 +21681,16 @@ function concludeReducer(params) {
21437
21681
  }) : void 0;
21438
21682
  state.pivotColumns = pivotGroupsAndCols?.columns;
21439
21683
  state.pivotColumnGroups = pivotGroupsAndCols?.columnGroups;
21684
+ const pivotSortedRowInfos = sortGroupedRowInfosByPivotColumns(
21685
+ rowInfoDataArray,
21686
+ sortInfo,
21687
+ state.pivotColumns,
21688
+ state.sortTypes
21689
+ );
21690
+ if (pivotSortedRowInfos !== rowInfoDataArray) {
21691
+ rowInfoDataArray = pivotSortedRowInfos;
21692
+ state.groupRowsIndexesInDataArray = rowInfoDataArray.map((row, index) => row.isGroupRow ? index : -1).filter((index) => index >= 0);
21693
+ }
21440
21694
  if (state.devToolsDetected) {
21441
21695
  state.debugTimings.set("group-and-pivot", Date.now() - groupTimestamp);
21442
21696
  }
@@ -21679,7 +21933,11 @@ var DATA_CHANGES_COMPARE_FUNCTIONS = {
21679
21933
  }
21680
21934
  };
21681
21935
  function buildDataSourceDataParams(componentState, overrides, masterContext) {
21682
- const sortInfo = componentState.multiSort ? componentState.sortInfo : componentState.sortInfo?.[0] ?? null;
21936
+ const resolvedSortInfo = enrichSortInfoFromGroupBy(
21937
+ componentState.sortInfo,
21938
+ componentState.groupBy
21939
+ );
21940
+ const sortInfo = componentState.multiSort ? resolvedSortInfo : resolvedSortInfo?.[0] ?? null;
21683
21941
  const dataSourceParams = {
21684
21942
  append: false,
21685
21943
  originalDataArray: componentState.originalDataArray,
@@ -23424,8 +23682,9 @@ var InfiniteTableApiImpl = class {
23424
23682
  this.setSortInfoForColumn(columnId, null, options);
23425
23683
  return;
23426
23684
  }
23685
+ const isPivotColumn = !!c.pivotColumn;
23427
23686
  const groupByForColumn = c.groupByForColumn;
23428
- let field = c.field;
23687
+ let field = isPivotColumn ? void 0 : c.field;
23429
23688
  const groupByForCol = groupByForColumn ? Array.isArray(groupByForColumn) ? groupByForColumn : [groupByForColumn] : [];
23430
23689
  const fieldArr = groupByForCol.map((c2) => {
23431
23690
  return c2.valueGetter ? (item) => c2.valueGetter({ data: item, field: c2.field }) : c2.field ? c2.field : c2.groupField ?? void 0;
@@ -23435,23 +23694,32 @@ var InfiniteTableApiImpl = class {
23435
23694
  }
23436
23695
  let computedSortType = c.computedSortType;
23437
23696
  if (groupByForCol.length && computedSortType === UNKNOWN_SORT_TYPE) {
23697
+ const userColumns = this.getState().initialColumns;
23438
23698
  const sortTypeForGroupCols = groupByForCol.flatMap((groupBy) => {
23439
23699
  const field2 = groupBy.field ?? groupBy.groupField;
23440
23700
  const col = field2 ? computedColumnsMap.get(field2) : null;
23441
- if (!col) {
23442
- return UNKNOWN_SORT_TYPE;
23701
+ if (col) {
23702
+ return col.computedSortType;
23703
+ }
23704
+ const userCol = field2 ? findColumnForField(userColumns, field2) : void 0;
23705
+ if (userCol) {
23706
+ const type = userCol.sortType || (typeof userCol.type === "string" ? userCol.type : "string");
23707
+ return type;
23443
23708
  }
23444
- return col.computedSortType;
23709
+ return [UNKNOWN_SORT_TYPE];
23445
23710
  });
23446
23711
  computedSortType = sortTypeForGroupCols;
23447
23712
  }
23713
+ if (groupByForCol.length && !Array.isArray(computedSortType)) {
23714
+ computedSortType = [computedSortType];
23715
+ }
23448
23716
  const newColumnSortInfo = {
23449
23717
  dir,
23450
23718
  id: c.id,
23451
23719
  field,
23452
23720
  type: computedSortType
23453
23721
  };
23454
- if (c.valueGetter) {
23722
+ if (!isPivotColumn && c.valueGetter) {
23455
23723
  newColumnSortInfo.valueGetter = (data) => c.valueGetter({ data, field: c.field });
23456
23724
  }
23457
23725
  this.setSortInfoForColumn(columnId, newColumnSortInfo, options);
@@ -26162,13 +26430,6 @@ function getColumnsWhenGrouping(params) {
26162
26430
  computedColumns[groupColumnId] = singleGroupColumn;
26163
26431
  }
26164
26432
  if (pivotColumns) {
26165
- const columnsByField = {};
26166
- Object.keys(columns).forEach((colId) => {
26167
- const col = columns[colId];
26168
- if (col.field) {
26169
- columnsByField[col.field] = col;
26170
- }
26171
- });
26172
26433
  Object.keys(pivotColumns).forEach((key) => {
26173
26434
  const col = pivotColumns[key];
26174
26435
  const isSimpleTotalColumn = col.pivotTotalColumn && col.columnGroup;
@@ -26198,7 +26459,7 @@ function getColumnsWhenGrouping(params) {
26198
26459
  }
26199
26460
  }
26200
26461
  if (column.inheritFromColumn !== false) {
26201
- const colToInheritFrom = typeof column.inheritFromColumn === "string" ? columns[column.inheritFromColumn] : column.pivotAggregator?.field ? columnsByField[column.pivotAggregator?.field] : void 0;
26462
+ const colToInheritFrom = typeof column.inheritFromColumn === "string" ? columns[column.inheritFromColumn] : column.pivotAggregator?.field ? findColumnForField(columns, column.pivotAggregator.field) : void 0;
26202
26463
  column = { ...colToInheritFrom, ...column };
26203
26464
  }
26204
26465
  if (!column.render && column.renderValue) {
@@ -26576,6 +26837,7 @@ function useHideColumns(groupByMap, state, actions) {
26576
26837
  import { useMemo as useMemo14 } from "react";
26577
26838
  var useComputedColumns = ({
26578
26839
  columns,
26840
+ userColumns,
26579
26841
  bodySize,
26580
26842
  columnMinWidth,
26581
26843
  columnMaxWidth,
@@ -26631,6 +26893,7 @@ var useComputedColumns = ({
26631
26893
  } = useMemo14(() => {
26632
26894
  return getComputedColumns({
26633
26895
  columns,
26896
+ userColumns,
26634
26897
  scrollbarWidth: scrollbarWidth2,
26635
26898
  bodySize,
26636
26899
  columnMinWidth,
@@ -26665,6 +26928,7 @@ var useComputedColumns = ({
26665
26928
  });
26666
26929
  }, [
26667
26930
  columns,
26931
+ userColumns,
26668
26932
  bodySize.width,
26669
26933
  columnMinWidth,
26670
26934
  columnMaxWidth,
@@ -26896,6 +27160,7 @@ function useComputed(options) {
26896
27160
  onRowDetailHeightCSSVarChange,
26897
27161
  onColumnHeaderHeightCSSVarChange,
26898
27162
  computedColumns,
27163
+ initialColumns,
26899
27164
  viewportReservedWidth,
26900
27165
  resizableColumns,
26901
27166
  sortable,
@@ -26972,6 +27237,7 @@ function useComputed(options) {
26972
27237
  fieldsToColumn
26973
27238
  } = useComputedColumns({
26974
27239
  columns,
27240
+ userColumns: initialColumns,
26975
27241
  // scrollbarWidth: scrollbars.vertical ? getScrollbarWidth() : 0,
26976
27242
  // #scrollbarverticaltag
26977
27243
  // we use the default scrollbar width - using it dynamically causes issues
@@ -27287,7 +27553,7 @@ var useLicense = (licenseKey = "") => {
27287
27553
  }
27288
27554
  let valid2 = isValidLicense(licenseKey, {
27289
27555
  publishedAt: 1624970570587,
27290
- version: "9.0.0-canary.0"
27556
+ version: "9.0.1"
27291
27557
  });
27292
27558
  if (!licenseKey && !valid2 && isInsidePlayground) {
27293
27559
  return true;