@adaptabletools/adaptable-cjs 20.0.4-canary.2 → 20.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable-cjs",
3
- "version": "20.0.4-canary.2",
3
+ "version": "20.0.4",
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",
@@ -12,14 +12,7 @@ export type TableAggregationColumns = {
12
12
  /**
13
13
  * Defines an Aggregated Column in a Pivot Layout
14
14
  */
15
- export type PivotAggregationColumns = {
16
- ColumnId: string;
17
- AggFunc: AggregationColumnValue;
18
- TotalColumn?: boolean | 'before' | 'after' | {
19
- PivotColumnId: string;
20
- ShowTotal?: boolean | 'before' | 'after';
21
- }[];
22
- }[];
15
+ export type PivotAggregationColumns = TableAggregationColumns;
23
16
  export declare const WEIGHTED_AVERAGE_AGG_FN_NAME = "weightedAvg";
24
17
  /**
25
18
  * Defines a Weighted Average Agg
@@ -148,18 +148,6 @@ export interface PivotLayout extends LayoutBase {
148
148
  * Row Grouped Columns Columns - must NOT be provided
149
149
  */
150
150
  RowGroupedColumns?: never;
151
- /**
152
- * Display Grand Total Row at the top or bottom of the Pivot Table
153
- */
154
- GrandTotalRow?: 'top' | 'bottom' | boolean;
155
- /**
156
- * Display automatically calculated Totals of all Pivot Columns, in the position specified
157
- */
158
- GrandTotalColumn?: 'before' | 'after' | boolean;
159
- /**
160
- * Display automatically calculated Totals within EACH Pivot Column Group, in the position specified
161
- */
162
- PivotGroupTotalColumn?: 'before' | 'after' | boolean;
163
151
  }
164
152
  /**
165
153
  * Manages how (and which) Row Group values are stored
@@ -209,16 +209,12 @@ const pivotLayoutToPivotLayoutModel = (pivotLayout) => {
209
209
  ColumnPinning: pivotLayout.ColumnPinning,
210
210
  PivotColumns: pivotLayout.PivotColumns,
211
211
  PivotExpandLevel: pivotLayout.PivotExpandLevel,
212
- PivotAggregationColumns: (pivotLayout.PivotAggregationColumns || []).map(({ ColumnId, AggFunc, TotalColumn }) => {
212
+ PivotAggregationColumns: (pivotLayout.PivotAggregationColumns || []).map(({ ColumnId, AggFunc }) => {
213
213
  return {
214
214
  ColumnId,
215
215
  AggFunc: toAggFunc(AggFunc),
216
- TotalColumn,
217
216
  };
218
217
  }),
219
- GrandTotalRow: pivotLayout.GrandTotalRow,
220
- GrandTotalColumn: pivotLayout.GrandTotalColumn,
221
- PivotGroupTotalColumn: pivotLayout.PivotGroupTotalColumn,
222
218
  RowGroupValues: pivotLayout.RowGroupValues
223
219
  ? pivotLayout.RowGroupValues.RowGroupDefaultBehavior === 'always-collapsed' ||
224
220
  pivotLayout.RowGroupValues.RowGroupDefaultBehavior === 'always-expanded'
@@ -344,20 +340,10 @@ const pivotLayoutModelToPivotLayout = (layoutModel, defaults) => {
344
340
  else {
345
341
  delete pivotLayout.RowGroupValues;
346
342
  }
347
- if (layoutModel.GrandTotalRow) {
348
- pivotLayout.GrandTotalRow = layoutModel.GrandTotalRow;
349
- }
350
- if (layoutModel.GrandTotalColumn) {
351
- pivotLayout.GrandTotalColumn = layoutModel.GrandTotalColumn;
352
- }
353
- if (layoutModel.PivotGroupTotalColumn) {
354
- pivotLayout.PivotGroupTotalColumn = layoutModel.PivotGroupTotalColumn;
355
- }
356
343
  if (layoutModel.PivotAggregationColumns) {
357
- pivotLayout.PivotAggregationColumns = (layoutModel.PivotAggregationColumns || []).map(({ ColumnId, AggFunc, TotalColumn }) => ({
344
+ pivotLayout.PivotAggregationColumns = (layoutModel.PivotAggregationColumns || []).map(({ ColumnId, AggFunc }) => ({
358
345
  ColumnId,
359
346
  AggFunc: toAggregationColumnValue(AggFunc),
360
- TotalColumn,
361
347
  }));
362
348
  }
363
349
  else {
@@ -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
  }
@@ -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: 1744635605576 || Date.now(),
6
- VERSION: "20.0.4-canary.2" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1744726373908 || Date.now(),
6
+ VERSION: "20.0.4" || '--current-version--',
7
7
  };
@@ -62,17 +62,26 @@ export type ColumnAggregationModel = {
62
62
  aggFunc: string | true;
63
63
  weightedColumnId?: string;
64
64
  };
65
- export type AggregationColumnsModelItem = {
65
+ export type AggregationColumnsModel = {
66
66
  ColumnId: string;
67
67
  AggFunc: ColumnAggregationModel;
68
- };
69
- export type AggregationColumnsModel = AggregationColumnsModelItem[];
70
- export type PivotAggregationColumnsModel = (AggregationColumnsModelItem & {
71
- TotalColumn?: boolean | 'before' | 'after' | {
72
- PivotColumnId: string;
73
- ShowTotal?: boolean | 'before' | 'after';
74
- }[];
75
- })[];
68
+ }[];
69
+ type RowSummaryPosition = 'Top' | 'Bottom';
70
+ export interface RowSummaryModel {
71
+ /**
72
+ * Where Row Summary appears - 'Top' or 'Bottom'
73
+ */
74
+ Position?: RowSummaryPosition;
75
+ /**
76
+ * Map of Columns with Summary Expressions
77
+ */
78
+ ColumnsMap: Record<string, string>;
79
+ /**
80
+ * Evaluates only currently filtered rows in the summary
81
+ * @defaultValue true
82
+ */
83
+ IncludeOnlyFilteredRows?: boolean;
84
+ }
76
85
  export interface TableLayoutModel extends BaseLayoutModel {
77
86
  TableColumns: string[];
78
87
  /**
@@ -87,7 +96,6 @@ export interface TableLayoutModel extends BaseLayoutModel {
87
96
  * @defaultValue 'single'
88
97
  */
89
98
  RowGroupDisplayType?: 'single' | 'multi';
90
- PivotAggregationColumns?: never;
91
99
  PivotColumns?: never;
92
100
  PivotGroupedColumns?: never;
93
101
  PivotExpandLevel?: never;
@@ -102,24 +110,13 @@ export interface PivotLayoutModel extends BaseLayoutModel {
102
110
  /**
103
111
  * Columns showing aggregated values in Group Rows; 1st value in record is Column name, 2nd is either aggfunc (e.g. sum, avg etc.) or 'true' (to use default aggfunc)
104
112
  */
105
- PivotAggregationColumns?: PivotAggregationColumnsModel;
113
+ PivotAggregationColumns?: AggregationColumnsModel;
106
114
  TableAggregationColumns?: never;
107
115
  /**
108
116
  * Columns which are row-grouped when the Layout is applied
109
117
  */
110
118
  PivotGroupedColumns?: string[];
111
119
  RowGroupedColumns?: never;
112
- /**
113
- * Display Grand Total Row at the top or bottom of the Pivot Table
114
- */
115
- GrandTotalRow?: 'top' | 'bottom' | boolean;
116
- /**
117
- * Display Total of all Pivot Columns before or after the Pivot Columns
118
- */
119
- GrandTotalColumn?: 'before' | 'after' | boolean;
120
- /**
121
- * Display automatically calculated Totals within EACH Pivot Column Group, in the position specified
122
- */
123
- PivotGroupTotalColumn?: 'before' | 'after' | boolean;
124
120
  }
125
121
  export type LayoutModel = TableLayoutModel | PivotLayoutModel;
122
+ export {};
@@ -69,16 +69,7 @@ export declare class LayoutManager<DATA_TYPE = any> extends LMEmitter {
69
69
  private computeColumnOrderAndVisibility;
70
70
  autoSizeColumns(columnIds?: string[]): false | string[];
71
71
  private applyPivotLayout;
72
- applyPivotTotals(layout: PivotLayoutModel): void;
73
72
  applyPivotExpandLevel(layout: PivotLayoutModel): void;
74
73
  private withSuppressColumnAnimation;
75
- private setupPivotTotals;
76
- private isPivotRowTotalColDef;
77
- private patchGrandTotalColumn;
78
- private isPivotGroupTotalColumn;
79
- private patchPivotGroupTotalColumn;
80
- private patchPivotTotalColumn;
81
- private destructurePivotColumnId;
82
- private getPivotTotalColumnConfig;
83
74
  }
84
75
  export {};
@@ -120,12 +120,8 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
120
120
  }).bind(this);
121
121
  }
122
122
  this.setOptions(options);
123
- // this ensures the grand total columns are positioned correctly (before/after) even when changed at runtime
124
- // see https://www.ag-grid.com/react-data-grid/pivoting-column-groups/#changing-data-filters-and-configurations
125
- this.gridApi.setGridOption('enableStrictPivotColumnOrder', true);
126
123
  this.setupEvents();
127
124
  this.indexColumns();
128
- this.setupPivotTotals();
129
125
  globalThis.layoutManager = this;
130
126
  }
131
127
  destroy() {
@@ -279,7 +275,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
279
275
  let ColumnPinning = {};
280
276
  const gridState = this.gridApi.getState();
281
277
  const prevLayout = this.currentLayout;
282
- const prevAggColumns = prevLayout?.TableAggregationColumns ?? prevLayout?.PivotAggregationColumns;
278
+ const prevAggColumns = prevLayout?.TableAggregationColumns;
283
279
  const prevAggColumnsMap = prevAggColumns?.reduce((acc, agg) => {
284
280
  acc[agg.ColumnId] = agg;
285
281
  return acc;
@@ -990,7 +986,6 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
990
986
  return columnIds;
991
987
  }
992
988
  applyPivotLayout(layout, options) {
993
- this.applyPivotTotals(layout);
994
989
  const columnState = this.computeColumnStateForPivotLayout(layout);
995
990
  // by simply calling this.gridApi.applyColumnState(columnState)
996
991
  // the order of aggregations is not preserved/guaranteed by ag-grid
@@ -1018,50 +1013,6 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
1018
1013
  this.applyRowGroupValues(layout.RowGroupValues);
1019
1014
  }
1020
1015
  }
1021
- applyPivotTotals(layout) {
1022
- /**
1023
- * GrandTotalRow
1024
- */
1025
- if (layout.GrandTotalRow) {
1026
- const grandTotalRow = layout.GrandTotalRow === true || layout.GrandTotalRow === 'top'
1027
- ? 'top'
1028
- : layout.GrandTotalRow === 'bottom'
1029
- ? 'bottom'
1030
- : null;
1031
- this.gridApi.setGridOption('grandTotalRow', grandTotalRow);
1032
- }
1033
- else {
1034
- this.gridApi.setGridOption('grandTotalRow', null);
1035
- }
1036
- /**
1037
- * GrandTotalColumn
1038
- */
1039
- if (layout.GrandTotalColumn) {
1040
- const grandTotalColumn = layout.GrandTotalColumn === true || layout.GrandTotalColumn === 'before'
1041
- ? 'before'
1042
- : layout.GrandTotalColumn === 'after'
1043
- ? 'after'
1044
- : null;
1045
- this.gridApi.setGridOption('pivotRowTotals', grandTotalColumn);
1046
- }
1047
- else {
1048
- this.gridApi.setGridOption('pivotRowTotals', null);
1049
- }
1050
- /**
1051
- * PivotGroupTotalColumn
1052
- */
1053
- if (layout.PivotGroupTotalColumn) {
1054
- const pivotGroupTotalColumn = layout.PivotGroupTotalColumn === true || layout.PivotGroupTotalColumn === 'before'
1055
- ? 'before'
1056
- : layout.PivotGroupTotalColumn === 'after'
1057
- ? 'after'
1058
- : null;
1059
- this.gridApi.setGridOption('pivotColumnGroupTotals', pivotGroupTotalColumn);
1060
- }
1061
- else {
1062
- this.gridApi.setGridOption('pivotColumnGroupTotals', null);
1063
- }
1064
- }
1065
1016
  applyPivotExpandLevel(layout) {
1066
1017
  const PivotExpandLevel = layout.PivotExpandLevel ?? -1;
1067
1018
  const allDisplayedColumnGroups = this.gridApi.getAllDisplayedColumnGroups();
@@ -1097,165 +1048,5 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
1097
1048
  }
1098
1049
  return res;
1099
1050
  }
1100
- setupPivotTotals() {
1101
- const _original_processPivotResultColDef = this.gridApi.getGridOption('processPivotResultColDef');
1102
- this.gridApi.setGridOption('processPivotResultColDef', (resulColDef) => {
1103
- _original_processPivotResultColDef?.(resulColDef);
1104
- if (!(0, isPivotLayoutModel_1.isPivotLayoutModel)(this.currentLayout)) {
1105
- return;
1106
- }
1107
- this.patchGrandTotalColumn(resulColDef);
1108
- this.patchPivotGroupTotalColumn(resulColDef);
1109
- });
1110
- const _original_processPivotResultColGroupDef = this.gridApi.getGridOption('processPivotResultColGroupDef');
1111
- this.gridApi.setGridOption('processPivotResultColGroupDef', (colGroupDef) => {
1112
- _original_processPivotResultColGroupDef?.(colGroupDef);
1113
- if (!(0, isPivotLayoutModel_1.isPivotLayoutModel)(this.currentLayout)) {
1114
- return;
1115
- }
1116
- this.patchPivotTotalColumn(colGroupDef);
1117
- });
1118
- }
1119
- isPivotRowTotalColDef(colDef) {
1120
- return colDef.colId?.startsWith('PivotRowTotal_');
1121
- }
1122
- patchGrandTotalColumn(resultColDef) {
1123
- if (!(0, isPivotLayoutModel_1.isPivotLayoutModel)(this.currentLayout) || !this.currentLayout.GrandTotalColumn) {
1124
- return;
1125
- }
1126
- if (this.isPivotRowTotalColDef(resultColDef)) {
1127
- resultColDef.headerName = `Grand Total ${resultColDef.headerName}`;
1128
- }
1129
- }
1130
- isPivotGroupTotalColumn(colDef) {
1131
- // pivot group total are spanning cross all aggregations
1132
- // therefore the last part of the colId is empty (hence the "dangling" underscore)
1133
- return colDef.colId?.startsWith('pivot_') && colDef.colId?.endsWith('_');
1134
- }
1135
- patchPivotGroupTotalColumn(resultColDef) {
1136
- if (!(0, isPivotLayoutModel_1.isPivotLayoutModel)(this.currentLayout) || !this.currentLayout.PivotGroupTotalColumn) {
1137
- return;
1138
- }
1139
- if (this.isPivotGroupTotalColumn(resultColDef)) {
1140
- // resultColDef
1141
- const colInfo = this.destructurePivotColumnId(resultColDef.colId);
1142
- if (colInfo !== '!unknown!') {
1143
- const currentPivotKey = colInfo.pivotKeys[colInfo.pivotKeys.length - 1];
1144
- resultColDef.headerName = `${currentPivotKey} Total`;
1145
- }
1146
- }
1147
- }
1148
- patchPivotTotalColumn(colGroupDef) {
1149
- const hasPivotTotalCols = (pivotLayout) => {
1150
- return pivotLayout.PivotAggregationColumns?.some((aggCol) => !!aggCol.TotalColumn);
1151
- };
1152
- const isPivotTotalColDef = (colDef) => {
1153
- return !!colDef.pivotTotalColumnIds?.length;
1154
- };
1155
- if (!(0, isPivotLayoutModel_1.isPivotLayoutModel)(this.currentLayout) || !hasPivotTotalCols(this.currentLayout)) {
1156
- return;
1157
- }
1158
- const pivotRowTotalColDefsBefore = [];
1159
- const pivotRowTotalColDefsAfter = [];
1160
- const pivotTotalColDefsBefore = [];
1161
- const pivotTotalColDefsAfter = [];
1162
- const normalColDefs = [];
1163
- colGroupDef.children.forEach((colDef) => {
1164
- if (this.isPivotRowTotalColDef(colDef)) {
1165
- if (this.gridApi.getGridOption('pivotRowTotals') === 'after') {
1166
- pivotRowTotalColDefsAfter.push(colDef);
1167
- }
1168
- else {
1169
- pivotRowTotalColDefsBefore.push(colDef);
1170
- }
1171
- }
1172
- if (isPivotTotalColDef(colDef)) {
1173
- if (!colDef.colId.startsWith('pivot_')) {
1174
- this.warn(`Pivot total column ${colDef.colId} is not prefixed with 'pivot_', skipping...`);
1175
- return;
1176
- }
1177
- // we do this for all total cols, but we will hide the ones that are not visible
1178
- colDef.columnGroupShow = undefined;
1179
- colDef.headerName = `Total ${colDef.headerName}`;
1180
- const totalColConfig = this.getPivotTotalColumnConfig(colDef, this.currentLayout);
1181
- if (!totalColConfig.visible) {
1182
- colDef.hide = true;
1183
- }
1184
- else {
1185
- if (totalColConfig.position === 'after') {
1186
- pivotTotalColDefsAfter.push(colDef);
1187
- }
1188
- else {
1189
- pivotTotalColDefsBefore.push(colDef);
1190
- }
1191
- }
1192
- }
1193
- else {
1194
- normalColDefs.push(colDef);
1195
- }
1196
- });
1197
- colGroupDef.children = [
1198
- ...pivotRowTotalColDefsBefore,
1199
- ...pivotTotalColDefsBefore,
1200
- ...normalColDefs,
1201
- ...pivotTotalColDefsAfter,
1202
- ...pivotRowTotalColDefsAfter,
1203
- ];
1204
- }
1205
- destructurePivotColumnId(colId = '') {
1206
- // Split by underscore to get 4 parts
1207
- const parts = colId.split('_');
1208
- if (parts.length !== 4) {
1209
- this.warn(`Unsupported format of pivot total column id: ${colId}`);
1210
- return '!unknown!';
1211
- }
1212
- // e.g.
1213
- // pivot_country-sport-year_United States-Basketball_gold
1214
- // pivotColumnIds: ['country', 'sport', 'year']
1215
- // pivotKeys: ['United States', 'Basketball']
1216
- // aggregationColumnId: 'gold'
1217
- const [_pivotPrefix, pivotColsTxt, pivotKeysTxt, aggregationColumnId] = parts;
1218
- const pivotColumnIds = pivotColsTxt.split('-');
1219
- const pivotKeys = pivotKeysTxt.split('-');
1220
- const pivotColumnId = pivotColumnIds[pivotKeys.length - 1];
1221
- return {
1222
- pivotColumnIds,
1223
- pivotKeys,
1224
- pivotColumnId,
1225
- aggregationColumnId,
1226
- };
1227
- }
1228
- getPivotTotalColumnConfig(colDef, currentPivotLayout) {
1229
- const defaultHiddenConfig = {
1230
- visible: false,
1231
- };
1232
- const colIdInfo = this.destructurePivotColumnId(colDef.colId);
1233
- if (colIdInfo === '!unknown!') {
1234
- return defaultHiddenConfig;
1235
- }
1236
- const { pivotColumnId, aggregationColumnId } = colIdInfo;
1237
- const layoutAggCol = currentPivotLayout.PivotAggregationColumns?.find((col) => col.ColumnId === aggregationColumnId);
1238
- if (!layoutAggCol) {
1239
- this.warn(`Pivot Totals: could NOT find aggregation(value) column with id ${aggregationColumnId}`);
1240
- return defaultHiddenConfig;
1241
- }
1242
- const layoutPivotTotalColumn = layoutAggCol.TotalColumn;
1243
- if (!layoutPivotTotalColumn) {
1244
- return defaultHiddenConfig;
1245
- }
1246
- if (Array.isArray(layoutPivotTotalColumn)) {
1247
- const pivotSpecificConfig = layoutPivotTotalColumn.find((config) => config.PivotColumnId === pivotColumnId);
1248
- return {
1249
- visible: pivotSpecificConfig && pivotSpecificConfig.ShowTotal !== false,
1250
- position: pivotSpecificConfig?.ShowTotal === 'after' ? 'after' : 'before',
1251
- };
1252
- }
1253
- else {
1254
- return {
1255
- visible: !!layoutPivotTotalColumn,
1256
- position: layoutPivotTotalColumn === 'after' ? 'after' : 'before',
1257
- };
1258
- }
1259
- }
1260
1051
  }
1261
1052
  exports.LayoutManager = LayoutManager;
@@ -144,9 +144,6 @@ function normalizePivotLayoutModel(layout) {
144
144
  // make it an own property
145
145
  layout.SuppressAggFuncInHeader = undefined;
146
146
  }
147
- if (!layout.GrandTotalRow) {
148
- layout.GrandTotalRow = false;
149
- }
150
147
  return layout;
151
148
  }
152
149
  exports.normalizePivotLayoutModel = normalizePivotLayoutModel;
@@ -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;