@adaptabletools/adaptable-cjs 20.0.4-canary.3 → 20.0.5-canary.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable-cjs",
3
- "version": "20.0.4-canary.3",
3
+ "version": "20.0.5-canary.0",
4
4
  "description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
5
5
  "keywords": [
6
6
  "web-components",
@@ -11,6 +11,7 @@ export declare function generateAutoTreeSingleColumn(): AdaptableColumn;
11
11
  export declare function generateAutoRowGroupColumnForColumn(column: AdaptableColumn): AdaptableColumn;
12
12
  export declare function getFriendlyNameForPivotResultColumn(columnId: string): string;
13
13
  export declare function isPivotResultColumn(columnId: string): boolean;
14
+ export declare function isPivotGrandTotalColumn(columnId: string): boolean;
14
15
  export declare class ColumnApiImpl extends ApiBase implements ColumnApi {
15
16
  internalApi: ColumnInternalApi;
16
17
  constructor(_adaptable: IAdaptable);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ColumnApiImpl = exports.isPivotResultColumn = exports.getFriendlyNameForPivotResultColumn = exports.generateAutoRowGroupColumnForColumn = exports.generateAutoTreeSingleColumn = exports.generateAutoRowGroupSingleColumn = exports.isAutoRowGroupColumn = void 0;
3
+ exports.ColumnApiImpl = exports.isPivotGrandTotalColumn = exports.isPivotResultColumn = exports.getFriendlyNameForPivotResultColumn = exports.generateAutoRowGroupColumnForColumn = exports.generateAutoTreeSingleColumn = exports.generateAutoRowGroupSingleColumn = exports.isAutoRowGroupColumn = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const ApiBase_1 = require("./ApiBase");
6
6
  const GeneralConstants = tslib_1.__importStar(require("../../Utilities/Constants/GeneralConstants"));
@@ -71,6 +71,13 @@ function generateAutoRowGroupColumnForColumn(column) {
71
71
  }
72
72
  exports.generateAutoRowGroupColumnForColumn = generateAutoRowGroupColumnForColumn;
73
73
  function getFriendlyNameForPivotResultColumn(columnId) {
74
+ if (isPivotGrandTotalColumn(columnId)) {
75
+ return `[Grand Total] ${columnId
76
+ .split('_')
77
+ .slice(2)
78
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
79
+ .join(' ')}`;
80
+ }
74
81
  return `[Pivot] ${columnId
75
82
  .split('_')
76
83
  .slice(1)
@@ -83,6 +90,10 @@ function isPivotResultColumn(columnId) {
83
90
  return columnId?.startsWith(GeneralConstants.AG_GRID_PIVOT_COLUMN);
84
91
  }
85
92
  exports.isPivotResultColumn = isPivotResultColumn;
93
+ function isPivotGrandTotalColumn(columnId) {
94
+ return columnId?.startsWith(GeneralConstants.AG_GRID_PIVOT_GRAND_TOTAL_COLUMN);
95
+ }
96
+ exports.isPivotGrandTotalColumn = isPivotGrandTotalColumn;
86
97
  class ColumnApiImpl extends ApiBase_1.ApiBase {
87
98
  constructor(_adaptable) {
88
99
  super(_adaptable);
@@ -146,7 +157,7 @@ class ColumnApiImpl extends ApiBase_1.ApiBase {
146
157
  return isAutoRowGroupColumn(columnId);
147
158
  }
148
159
  isPivotResultColumn(columnId) {
149
- return isPivotResultColumn(columnId);
160
+ return isPivotResultColumn(columnId) || isPivotGrandTotalColumn(columnId);
150
161
  }
151
162
  isAutoRowGroupColumnForSingle(columnId) {
152
163
  return columnId === normalizeLayoutModel_1.GROUP_COLUMN_ID__SINGLE;
@@ -43,5 +43,5 @@ export declare class ColumnFilterInternalApi extends ApiBase {
43
43
  areColumnFiltersDifferent(oldFilters: ColumnFilter[], newFilters: ColumnFilter[]): boolean;
44
44
  getPredicateDefShortcuts(predicateDef: AdaptablePredicateDef): string[];
45
45
  showQuickFilterDropdown(columnId: string): boolean;
46
- openColumnFilterPopup(columnId: string): void;
46
+ openColumnFilterPopup(columnId: string, popupProps?: any): void;
47
47
  }
@@ -191,7 +191,7 @@ class ColumnFilterInternalApi extends ApiBase_1.ApiBase {
191
191
  }
192
192
  return true;
193
193
  }
194
- openColumnFilterPopup(columnId) {
194
+ openColumnFilterPopup(columnId, popupProps) {
195
195
  this.getAdaptableInternalApi().showPopupWindow({
196
196
  id: windowFactory_1.COLUMN_FILTER_WINDOW,
197
197
  title: ModuleConstants.ColumnFilterFriendlyName,
@@ -203,6 +203,7 @@ class ColumnFilterInternalApi extends ApiBase_1.ApiBase {
203
203
  width: 380,
204
204
  height: 450,
205
205
  },
206
+ ...popupProps,
206
207
  },
207
208
  });
208
209
  }
@@ -64,6 +64,12 @@ class CalculatedColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
64
64
  return (this.api.namedQueryApi.internalApi.getReferencedNamedQueryNames(this.api.expressionApi.getAdaptableQueryExpression(calculatedColumn.Query)) ?? []);
65
65
  }
66
66
  createColumnMenuItems(column) {
67
+ if (!column) {
68
+ return;
69
+ }
70
+ if (!this.isModuleAvailable()) {
71
+ return;
72
+ }
67
73
  if (this.isModuleEditable() && column.isCalculatedColumn) {
68
74
  const popupParam = {
69
75
  column: column,
@@ -76,6 +82,9 @@ class CalculatedColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
76
82
  }
77
83
  }
78
84
  createContextMenuItems(menuContext) {
85
+ if (!menuContext.adaptableColumn) {
86
+ return;
87
+ }
79
88
  if (!this.isModuleAvailable()) {
80
89
  return;
81
90
  }
@@ -24,6 +24,7 @@ export declare const GROUP_PATH_SEPARATOR: string;
24
24
  export declare const AG_GRID_GROUPED_COLUMN: string;
25
25
  export declare const AG_GRID_SELECTION_COLUMN: string;
26
26
  export declare const AG_GRID_PIVOT_COLUMN: string;
27
+ export declare const AG_GRID_PIVOT_GRAND_TOTAL_COLUMN: string;
27
28
  export declare const AG_GRID_CHART_WINDOW = "AG Grid Window";
28
29
  export declare const ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME = "(FDC3ActionColumn)";
29
30
  export declare const DEFAULT_DATE_FORMAT_PATTERN = "dd-MM-yyyy";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LAYOUT_NEW_PIVOT_TOOLTIP = exports.LAYOUT_NEW_TABLE_TOOLTIP = exports.THEME_STYLE = exports.SYSTEM_EXPORT_DESTINATIONS = exports.CLIPBOARD_EXPORT_DESTINATION = exports.DOWNLOAD_EXPORT_DESTINATION = exports.SELECT_REPORT_FORMAT_STRING = exports.SELECT_REPORT_STRING = exports.SYSTEM_REPORT_FORMATS = exports.JSON_FORMAT_REPORT = exports.CSV_FORMAT_REPORT = exports.VISUAL_EXCEL_FORMAT_REPORT = exports.EXCEL_FORMAT_REPORT = exports.SYSTEM_REPORT_NAMES = exports.SELECTED_DATA_REPORT = exports.CURRENT_LAYOUT_REPORT = exports.ALL_DATA_REPORT = exports.SERVER_VALIDATION_MESSAGE_TYPE = exports.SERVER_VALIDATION_HEADER = exports.DEFAULT_LIVE_REPORT_THROTTLE_TIME = exports.MENU_SEPARATOR = exports.QUICK_SEARCH_DEBOUNCE_TIME = exports.DEFAULT_DOUBLE_DISPLAY_VALUE = exports.DEFAULT_INTEGER_DISPLAY_VALUE = exports.DEFAULT_STRING_DISPLAY_VALUE = exports.DEFAULT_DATE_FORMAT_PATTERN_WITH_TIME = exports.DEFAULT_DATE_FORMAT_PATTERN = exports.ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME = exports.AG_GRID_CHART_WINDOW = exports.AG_GRID_PIVOT_COLUMN = exports.AG_GRID_SELECTION_COLUMN = exports.AG_GRID_GROUPED_COLUMN = exports.GROUP_PATH_SEPARATOR = exports.QUARTER_SECOND = exports.HALF_SECOND = exports.EMPTY_ARRAY = exports.EMPTY_STRING = exports.READ_ONLY_STYLE = exports.AGGRID_TOOLPANEL_COLUMNS = exports.AGGRID_TOOLPANEL_FILTERS = exports.ADAPTABLE_TOOLPANEL_COMPONENT = exports.ADAPTABLE_TOOLPANEL_ID = exports.ADAPTABLE_ID = exports.ADAPTABLE = exports.ERROR_LAYOUT = exports.OS_THEME = exports.DARK_THEME = exports.LIGHT_THEME = exports.MISSING_COLUMN = exports.AUTOGENERATED_PK_COLUMN = void 0;
4
- exports.OBSERVABLE_EXPRESSION_ROW_REMOVED = exports.OBSERVABLE_EXPRESSION_ROW_ADDED = exports.STANDALONE_MODULE_POPUPS = exports.LAYOUT_DELETE_TOOLTIP = exports.LAYOUT_CLONE_TOOLTIP = exports.LAYOUT_EDIT_TOOLTIP = exports.LAYOUT_SAVE_TOOLTIP = exports.LAYOUT_NEW_TABLE_OR_PIVOT_TOOLTIP = void 0;
3
+ exports.LAYOUT_NEW_TABLE_TOOLTIP = exports.THEME_STYLE = exports.SYSTEM_EXPORT_DESTINATIONS = exports.CLIPBOARD_EXPORT_DESTINATION = exports.DOWNLOAD_EXPORT_DESTINATION = exports.SELECT_REPORT_FORMAT_STRING = exports.SELECT_REPORT_STRING = exports.SYSTEM_REPORT_FORMATS = exports.JSON_FORMAT_REPORT = exports.CSV_FORMAT_REPORT = exports.VISUAL_EXCEL_FORMAT_REPORT = exports.EXCEL_FORMAT_REPORT = exports.SYSTEM_REPORT_NAMES = exports.SELECTED_DATA_REPORT = exports.CURRENT_LAYOUT_REPORT = exports.ALL_DATA_REPORT = exports.SERVER_VALIDATION_MESSAGE_TYPE = exports.SERVER_VALIDATION_HEADER = exports.DEFAULT_LIVE_REPORT_THROTTLE_TIME = exports.MENU_SEPARATOR = exports.QUICK_SEARCH_DEBOUNCE_TIME = exports.DEFAULT_DOUBLE_DISPLAY_VALUE = exports.DEFAULT_INTEGER_DISPLAY_VALUE = exports.DEFAULT_STRING_DISPLAY_VALUE = exports.DEFAULT_DATE_FORMAT_PATTERN_WITH_TIME = exports.DEFAULT_DATE_FORMAT_PATTERN = exports.ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME = exports.AG_GRID_CHART_WINDOW = exports.AG_GRID_PIVOT_GRAND_TOTAL_COLUMN = exports.AG_GRID_PIVOT_COLUMN = exports.AG_GRID_SELECTION_COLUMN = exports.AG_GRID_GROUPED_COLUMN = exports.GROUP_PATH_SEPARATOR = exports.QUARTER_SECOND = exports.HALF_SECOND = exports.EMPTY_ARRAY = exports.EMPTY_STRING = exports.READ_ONLY_STYLE = exports.AGGRID_TOOLPANEL_COLUMNS = exports.AGGRID_TOOLPANEL_FILTERS = exports.ADAPTABLE_TOOLPANEL_COMPONENT = exports.ADAPTABLE_TOOLPANEL_ID = exports.ADAPTABLE_ID = exports.ADAPTABLE = exports.ERROR_LAYOUT = exports.OS_THEME = exports.DARK_THEME = exports.LIGHT_THEME = exports.MISSING_COLUMN = exports.AUTOGENERATED_PK_COLUMN = void 0;
4
+ exports.OBSERVABLE_EXPRESSION_ROW_REMOVED = exports.OBSERVABLE_EXPRESSION_ROW_ADDED = exports.STANDALONE_MODULE_POPUPS = exports.LAYOUT_DELETE_TOOLTIP = exports.LAYOUT_CLONE_TOOLTIP = exports.LAYOUT_EDIT_TOOLTIP = exports.LAYOUT_SAVE_TOOLTIP = exports.LAYOUT_NEW_TABLE_OR_PIVOT_TOOLTIP = exports.LAYOUT_NEW_PIVOT_TOOLTIP = void 0;
5
5
  exports.AUTOGENERATED_PK_COLUMN = '__ADAPTABLE_PK__';
6
6
  exports.MISSING_COLUMN = ' [MISSING]';
7
7
  exports.LIGHT_THEME = 'light';
@@ -27,6 +27,7 @@ exports.GROUP_PATH_SEPARATOR = '/';
27
27
  exports.AG_GRID_GROUPED_COLUMN = 'ag-Grid-AutoColumn';
28
28
  exports.AG_GRID_SELECTION_COLUMN = 'ag-Grid-SelectionColumn';
29
29
  exports.AG_GRID_PIVOT_COLUMN = 'pivot_';
30
+ exports.AG_GRID_PIVOT_GRAND_TOTAL_COLUMN = 'PivotRowTotal_pivot_';
30
31
  exports.AG_GRID_CHART_WINDOW = 'AG Grid Window';
31
32
  exports.ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME = '(FDC3ActionColumn)';
32
33
  // FIXME AFL - load this from DateInputOptions
@@ -38,6 +38,6 @@ const AdaptableFloatingFilter = (props) => {
38
38
  ]);
39
39
  props.onChange?.();
40
40
  }
41
- }, onClear: onClear, columnId: props.Column.columnId, predicate: qlPredicate, predicateDefs: qlPredicateDefs, disabled: columnFilter?.IsSuspended, onPredicateChange: onPredicateChange }));
41
+ }, onClear: onClear, columnId: props.Column.columnId, predicate: qlPredicate, predicateDefs: qlPredicateDefs, disabled: columnFilter?.IsSuspended, onPredicateChange: onPredicateChange, onChange: props.onChange }));
42
42
  };
43
43
  exports.AdaptableFloatingFilter = AdaptableFloatingFilter;
@@ -16,6 +16,7 @@ const ColumnFilterWindow = (props) => {
16
16
  React.useEffect(() => {
17
17
  setColumnId(initialColumnId);
18
18
  }, [props.popupProps.value]);
19
+ const onChange = props.popupProps.onChange;
19
20
  return (React.createElement(rebass_1.Flex, { flex: 1, minHeight: 0, height: "100%", flexDirection: "column", p: 2, className: "ab-ColumnFilterWindow" },
20
21
  React.createElement(rebass_1.Box, { mb: 2 },
21
22
  React.createElement(FormLayout_1.default, null,
@@ -32,6 +33,6 @@ const ColumnFilterWindow = (props) => {
32
33
  }
33
34
  return label;
34
35
  }, onChange: (column) => setColumnId(column), filterColumn: (column) => column.queryable, isMulti: false, value: columnId })))),
35
- React.createElement(AdaptableColumnFilter_1.AdaptableColumnFilter, { columnId: columnId })));
36
+ React.createElement(AdaptableColumnFilter_1.AdaptableColumnFilter, { columnId: columnId, onChange: onChange })));
36
37
  };
37
38
  exports.ColumnFilterWindow = ColumnFilterWindow;
@@ -8,5 +8,6 @@ export interface FloatingFilterProps {
8
8
  onPredicateChange: (predicate: QlPredicate) => void;
9
9
  onKeydown?: (event: React.KeyboardEventHandler<HTMLDivElement>) => void;
10
10
  onClear?: () => void;
11
+ onChange?: () => void;
11
12
  }
12
13
  export declare const FloatingFilter: React.FunctionComponent<FloatingFilterProps>;
@@ -81,7 +81,9 @@ const FloatingFilter = (props) => {
81
81
  });
82
82
  } }))),
83
83
  isInlineEditable && (React.createElement(SimpleButton_1.default, { px: 0, onClick: () => {
84
- adaptable.api.filterApi.columnFilterApi.internalApi.openColumnFilterPopup(props.columnId);
84
+ adaptable.api.filterApi.columnFilterApi.internalApi.openColumnFilterPopup(props.columnId, {
85
+ onChange: props.onChange,
86
+ });
85
87
  }, "data-name": "expand-filter", icon: "expand", variant: "text" })),
86
88
  (isMultiple ||
87
89
  !(0, utils_1.isPredicateEmpty)(props.predicate.args[0], singleFilterPredicateDef)) && (React.createElement(SimpleButton_1.default, { "data-name": "clear-filter", p: 0, variant: "text", onClick: handleClear, icon: "close" }))));
@@ -28,7 +28,7 @@ const ColumnValuesSelect = (props) => {
28
28
  }
29
29
  return true;
30
30
  });
31
- const component = (React.createElement(Select_1.Select, { isMulti: true, showHeaderSelectionCheckbox: true, searchable: true, closeMenuOnSelect: false, size: "small", menuStyle: {
31
+ const component = (React.createElement(Select_1.Select, { isMulti: true, showHeaderSelectionCheckbox: true, searchable: true, closeMenuOnSelect: false, menuStyle: {
32
32
  minWidth: `var(--ab-cmp-select-column-menu-${column.columnId}__min-width, var(--ab-cmp-select-column-menu__min-width, 260px))`,
33
33
  }, ...props.selectProps, options: options, value: value, isLoading: props.isLoading, onChange: props.onChange }));
34
34
  return (React.createElement("div", { className: (0, join_1.default)(baseClassName, props.isLoading && `${baseClassName}--loading`, !value.length && `${baseClassName}--empty`), onKeyDownCapture: (e) => {
package/src/env.js CHANGED
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
4
  NEXT_PUBLIC_INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
5
- PUBLISH_TIMESTAMP: 1744658469734 || Date.now(),
6
- VERSION: "20.0.4-canary.3" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1744819299231 || Date.now(),
6
+ VERSION: "20.0.5-canary.0" || '--current-version--',
7
7
  };
@@ -1,4 +1,4 @@
1
- import { ColumnState, GridApi, GridOptions, GridState } from 'ag-grid-enterprise';
1
+ import { ColDef, ColumnState, GridApi, GridOptions, GridState } from 'ag-grid-enterprise';
2
2
  import { PivotLayoutModel, TableLayoutModel } from './LayoutManagerModel';
3
3
  import { LMEmitter } from './LMEmitter';
4
4
  export type LayoutManagerOptions = {
@@ -78,7 +78,15 @@ export declare class LayoutManager<DATA_TYPE = any> extends LMEmitter {
78
78
  private isPivotGroupTotalColumn;
79
79
  private patchPivotGroupTotalColumn;
80
80
  private patchPivotTotalColumn;
81
- private destructurePivotColumnId;
81
+ destructurePivotColumnId(colDef: ColDef, currentModel: {
82
+ pivotColIds: string[];
83
+ aggColIds: string[];
84
+ }): '!unknown!' | {
85
+ pivotColumnIds: string[];
86
+ pivotKeys: string[];
87
+ pivotColumnId: string;
88
+ aggregationColumnId?: string;
89
+ };
82
90
  private getPivotTotalColumnConfig;
83
91
  }
84
92
  export {};
@@ -1116,6 +1116,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
1116
1116
  if (!(0, isPivotLayoutModel_1.isPivotLayoutModel)(this.currentLayout)) {
1117
1117
  return;
1118
1118
  }
1119
+ // column that contain the aggregated total for each value column per row
1119
1120
  this.patchGrandTotalColumn(resulColDef);
1120
1121
  this.patchPivotGroupTotalColumn(resulColDef);
1121
1122
  });
@@ -1150,7 +1151,10 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
1150
1151
  }
1151
1152
  if (this.isPivotGroupTotalColumn(resultColDef)) {
1152
1153
  // resultColDef
1153
- const colInfo = this.destructurePivotColumnId(resultColDef.colId);
1154
+ const colInfo = this.destructurePivotColumnId(resultColDef, {
1155
+ pivotColIds: this.currentLayout.PivotColumns,
1156
+ aggColIds: this.currentLayout.PivotAggregationColumns.map((col) => col.ColumnId),
1157
+ });
1154
1158
  if (colInfo !== '!unknown!') {
1155
1159
  const currentPivotKey = colInfo.pivotKeys[colInfo.pivotKeys.length - 1];
1156
1160
  resultColDef.headerName = `${currentPivotKey} Total`;
@@ -1215,26 +1219,83 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
1215
1219
  ...pivotRowTotalColDefsAfter,
1216
1220
  ];
1217
1221
  }
1218
- destructurePivotColumnId(colId = '') {
1219
- // Split by underscore to get 4 parts
1220
- const parts = colId.split('_');
1221
- if (parts.length !== 4) {
1222
- this.warn(`Unsupported format of pivot total column id: ${colId}`);
1222
+ // supports only pivotTotalColumns (aggregation total) and pivotGroupTotal
1223
+ // AG Grid builds the ID as: `pivot_${pivotCols.join('-')}_${pivotKeys.join('-')}_${measureColumnId}`
1224
+ // see https://github.com/ag-grid/ag-grid/blob/e0cfe533b55b75cdc148cdfb1a4e977731dc0712/packages/ag-grid-enterprise/src/pivot/pivotColDefService.ts#L454C16-L454C88
1225
+ destructurePivotColumnId(colDef, currentModel) {
1226
+ const { colId } = colDef;
1227
+ // Basic validation
1228
+ if (!colId?.startsWith('pivot_')) {
1229
+ this.warn(`Column id must start with 'pivot_': ${colId}`);
1230
+ return '!unknown!';
1231
+ }
1232
+ const hasSpecialChars = (arr) => arr.some((str) => str.includes('-') || str.includes('_'));
1233
+ // AG Grid uses _ and - as delimiters
1234
+ // if we have these special characters in the column IDs, we need to parse them differently
1235
+ const colIdsOrKeysContainSpecialChars = hasSpecialChars(currentModel.pivotColIds) ||
1236
+ hasSpecialChars(currentModel.aggColIds) ||
1237
+ hasSpecialChars(colDef.pivotKeys || []);
1238
+ // Fast path - no special characters
1239
+ if (!colIdsOrKeysContainSpecialChars) {
1240
+ // Split by underscore to get 4 parts
1241
+ const parts = colId.split('_');
1242
+ if (parts.length !== 4) {
1243
+ this.warn(`Unsupported format of pivot total column id: ${colId}`);
1244
+ return '!unknown!';
1245
+ }
1246
+ const [_pivotPrefix, pivotColsTxt, pivotKeysTxt, aggregationColumnId] = parts;
1247
+ const pivotColumnIds = pivotColsTxt.split('-');
1248
+ const pivotKeys = pivotKeysTxt.split('-');
1249
+ const pivotColumnId = pivotColumnIds[pivotKeys.length - 1];
1250
+ return {
1251
+ pivotColumnIds,
1252
+ pivotKeys,
1253
+ pivotColumnId,
1254
+ aggregationColumnId: aggregationColumnId !== '' ? aggregationColumnId : undefined,
1255
+ };
1256
+ }
1257
+ // the complex path, where we have to handle the special characters
1258
+ // Remove 'pivot_' prefix
1259
+ const withoutPrefix = colId.slice(6);
1260
+ // Check if it's a pivot group total
1261
+ const isPivotGroupTotal = withoutPrefix.endsWith('_');
1262
+ // Get pivot keys from colDef (more reliable than string parsing)
1263
+ const pivotKeys = colDef.pivotKeys || [];
1264
+ if (isPivotGroupTotal) {
1265
+ // Remove trailing underscore for pivot group totals
1266
+ const content = withoutPrefix.slice(0, -1);
1267
+ // The remaining content should be the pivot columns
1268
+ const pivotColumnIds = currentModel.pivotColIds.filter((id) => content.includes(id));
1269
+ if (!pivotColumnIds.length) {
1270
+ this.warn(`Could not identify pivot columns in: ${content}`);
1271
+ return '!unknown!';
1272
+ }
1273
+ return {
1274
+ pivotColumnIds,
1275
+ pivotKeys,
1276
+ pivotColumnId: pivotColumnIds[pivotKeys.length],
1277
+ };
1278
+ }
1279
+ // For regular pivot columns, work backwards to find aggregation column
1280
+ const parts = withoutPrefix.split('_');
1281
+ const lastPart = parts[parts.length - 1];
1282
+ // Find the longest matching aggregation column id from the end
1283
+ const aggregationColumnId = currentModel.aggColIds.find((aggId) => lastPart.endsWith(aggId));
1284
+ if (!aggregationColumnId) {
1285
+ this.warn(`Could not identify aggregation column in: ${lastPart}`);
1286
+ return '!unknown!';
1287
+ }
1288
+ // Remove aggregation part and get pivot columns
1289
+ const withoutAgg = withoutPrefix.slice(0, -(aggregationColumnId.length + 1));
1290
+ const pivotColumnIds = currentModel.pivotColIds.filter((id) => withoutAgg.includes(id));
1291
+ if (!pivotColumnIds.length) {
1292
+ this.warn(`Could not identify pivot columns in: ${withoutAgg}`);
1223
1293
  return '!unknown!';
1224
1294
  }
1225
- // e.g.
1226
- // pivot_country-sport-year_United States-Basketball_gold
1227
- // pivotColumnIds: ['country', 'sport', 'year']
1228
- // pivotKeys: ['United States', 'Basketball']
1229
- // aggregationColumnId: 'gold'
1230
- const [_pivotPrefix, pivotColsTxt, pivotKeysTxt, aggregationColumnId] = parts;
1231
- const pivotColumnIds = pivotColsTxt.split('-');
1232
- const pivotKeys = pivotKeysTxt.split('-');
1233
- const pivotColumnId = pivotColumnIds[pivotKeys.length - 1];
1234
1295
  return {
1235
1296
  pivotColumnIds,
1236
1297
  pivotKeys,
1237
- pivotColumnId,
1298
+ pivotColumnId: pivotColumnIds[pivotKeys.length - 1],
1238
1299
  aggregationColumnId,
1239
1300
  };
1240
1301
  }
@@ -1242,7 +1303,10 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
1242
1303
  const defaultHiddenConfig = {
1243
1304
  visible: false,
1244
1305
  };
1245
- const colIdInfo = this.destructurePivotColumnId(colDef.colId);
1306
+ const colIdInfo = this.destructurePivotColumnId(colDef, {
1307
+ pivotColIds: this.currentLayout.PivotColumns,
1308
+ aggColIds: this.currentLayout.PivotAggregationColumns.map((col) => col.ColumnId),
1309
+ });
1246
1310
  if (colIdInfo === '!unknown!') {
1247
1311
  return defaultHiddenConfig;
1248
1312
  }
@@ -18,7 +18,7 @@ function simplifyTableLayoutModel(layout) {
18
18
  delete layout.RowGroupedColumns;
19
19
  }
20
20
  if (!layout.RowGroupedColumns && layout.RowGroupValues) {
21
- delete layout.RowGroupValues;
21
+ // delete layout.RowGroupValues;
22
22
  }
23
23
  if (layout.SuppressAggFuncInHeader === undefined) {
24
24
  delete layout.SuppressAggFuncInHeader;