@adaptabletools/adaptable 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",
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
@@ -197,16 +197,12 @@ export const pivotLayoutToPivotLayoutModel = (pivotLayout) => {
197
197
  ColumnPinning: pivotLayout.ColumnPinning,
198
198
  PivotColumns: pivotLayout.PivotColumns,
199
199
  PivotExpandLevel: pivotLayout.PivotExpandLevel,
200
- PivotAggregationColumns: (pivotLayout.PivotAggregationColumns || []).map(({ ColumnId, AggFunc, TotalColumn }) => {
200
+ PivotAggregationColumns: (pivotLayout.PivotAggregationColumns || []).map(({ ColumnId, AggFunc }) => {
201
201
  return {
202
202
  ColumnId,
203
203
  AggFunc: toAggFunc(AggFunc),
204
- TotalColumn,
205
204
  };
206
205
  }),
207
- GrandTotalRow: pivotLayout.GrandTotalRow,
208
- GrandTotalColumn: pivotLayout.GrandTotalColumn,
209
- PivotGroupTotalColumn: pivotLayout.PivotGroupTotalColumn,
210
206
  RowGroupValues: pivotLayout.RowGroupValues
211
207
  ? pivotLayout.RowGroupValues.RowGroupDefaultBehavior === 'always-collapsed' ||
212
208
  pivotLayout.RowGroupValues.RowGroupDefaultBehavior === 'always-expanded'
@@ -330,20 +326,10 @@ export const pivotLayoutModelToPivotLayout = (layoutModel, defaults) => {
330
326
  else {
331
327
  delete pivotLayout.RowGroupValues;
332
328
  }
333
- if (layoutModel.GrandTotalRow) {
334
- pivotLayout.GrandTotalRow = layoutModel.GrandTotalRow;
335
- }
336
- if (layoutModel.GrandTotalColumn) {
337
- pivotLayout.GrandTotalColumn = layoutModel.GrandTotalColumn;
338
- }
339
- if (layoutModel.PivotGroupTotalColumn) {
340
- pivotLayout.PivotGroupTotalColumn = layoutModel.PivotGroupTotalColumn;
341
- }
342
329
  if (layoutModel.PivotAggregationColumns) {
343
- pivotLayout.PivotAggregationColumns = (layoutModel.PivotAggregationColumns || []).map(({ ColumnId, AggFunc, TotalColumn }) => ({
330
+ pivotLayout.PivotAggregationColumns = (layoutModel.PivotAggregationColumns || []).map(({ ColumnId, AggFunc }) => ({
344
331
  ColumnId,
345
332
  AggFunc: toAggregationColumnValue(AggFunc),
346
- TotalColumn,
347
333
  }));
348
334
  }
349
335
  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
  }
@@ -187,7 +187,7 @@ export class ColumnFilterInternalApi extends ApiBase {
187
187
  }
188
188
  return true;
189
189
  }
190
- openColumnFilterPopup(columnId) {
190
+ openColumnFilterPopup(columnId, popupProps) {
191
191
  this.getAdaptableInternalApi().showPopupWindow({
192
192
  id: COLUMN_FILTER_WINDOW,
193
193
  title: ModuleConstants.ColumnFilterFriendlyName,
@@ -199,6 +199,7 @@ export class ColumnFilterInternalApi extends ApiBase {
199
199
  width: 380,
200
200
  height: 450,
201
201
  },
202
+ ...popupProps,
202
203
  },
203
204
  });
204
205
  }
@@ -60,6 +60,12 @@ export class CalculatedColumnModule extends AdaptableModuleBase {
60
60
  return (this.api.namedQueryApi.internalApi.getReferencedNamedQueryNames(this.api.expressionApi.getAdaptableQueryExpression(calculatedColumn.Query)) ?? []);
61
61
  }
62
62
  createColumnMenuItems(column) {
63
+ if (!column) {
64
+ return;
65
+ }
66
+ if (!this.isModuleAvailable()) {
67
+ return;
68
+ }
63
69
  if (this.isModuleEditable() && column.isCalculatedColumn) {
64
70
  const popupParam = {
65
71
  column: column,
@@ -72,6 +78,9 @@ export class CalculatedColumnModule extends AdaptableModuleBase {
72
78
  }
73
79
  }
74
80
  createContextMenuItems(menuContext) {
81
+ if (!menuContext.adaptableColumn) {
82
+ return;
83
+ }
75
84
  if (!this.isModuleAvailable()) {
76
85
  return;
77
86
  }
@@ -34,5 +34,5 @@ export const AdaptableFloatingFilter = (props) => {
34
34
  ]);
35
35
  props.onChange?.();
36
36
  }
37
- }, onClear: onClear, columnId: props.Column.columnId, predicate: qlPredicate, predicateDefs: qlPredicateDefs, disabled: columnFilter?.IsSuspended, onPredicateChange: onPredicateChange }));
37
+ }, onClear: onClear, columnId: props.Column.columnId, predicate: qlPredicate, predicateDefs: qlPredicateDefs, disabled: columnFilter?.IsSuspended, onPredicateChange: onPredicateChange, onChange: props.onChange }));
38
38
  };
@@ -12,6 +12,7 @@ export const ColumnFilterWindow = (props) => {
12
12
  React.useEffect(() => {
13
13
  setColumnId(initialColumnId);
14
14
  }, [props.popupProps.value]);
15
+ const onChange = props.popupProps.onChange;
15
16
  return (React.createElement(Flex, { flex: 1, minHeight: 0, height: "100%", flexDirection: "column", p: 2, className: "ab-ColumnFilterWindow" },
16
17
  React.createElement(Box, { mb: 2 },
17
18
  React.createElement(FormLayout, null,
@@ -28,5 +29,5 @@ export const ColumnFilterWindow = (props) => {
28
29
  }
29
30
  return label;
30
31
  }, onChange: (column) => setColumnId(column), filterColumn: (column) => column.queryable, isMulti: false, value: columnId })))),
31
- React.createElement(AdaptableColumnFilter, { columnId: columnId })));
32
+ React.createElement(AdaptableColumnFilter, { columnId: columnId, onChange: onChange })));
32
33
  };
@@ -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>;
@@ -77,7 +77,9 @@ export const FloatingFilter = (props) => {
77
77
  });
78
78
  } }))),
79
79
  isInlineEditable && (React.createElement(SimpleButton, { px: 0, onClick: () => {
80
- adaptable.api.filterApi.columnFilterApi.internalApi.openColumnFilterPopup(props.columnId);
80
+ adaptable.api.filterApi.columnFilterApi.internalApi.openColumnFilterPopup(props.columnId, {
81
+ onChange: props.onChange,
82
+ });
81
83
  }, "data-name": "expand-filter", icon: "expand", variant: "text" })),
82
84
  (isMultiple ||
83
85
  !isPredicateEmpty(props.predicate.args[0], singleFilterPredicateDef)) && (React.createElement(SimpleButton, { "data-name": "clear-filter", p: 0, variant: "text", onClick: handleClear, icon: "close" }))));
@@ -24,7 +24,7 @@ export const ColumnValuesSelect = (props) => {
24
24
  }
25
25
  return true;
26
26
  });
27
- const component = (React.createElement(Select, { isMulti: true, showHeaderSelectionCheckbox: true, searchable: true, closeMenuOnSelect: false, size: "small", menuStyle: {
27
+ const component = (React.createElement(Select, { isMulti: true, showHeaderSelectionCheckbox: true, searchable: true, closeMenuOnSelect: false, menuStyle: {
28
28
  minWidth: `var(--ab-cmp-select-column-menu-${column.columnId}__min-width, var(--ab-cmp-select-column-menu__min-width, 260px))`,
29
29
  }, ...props.selectProps, options: options, value: value, isLoading: props.isLoading, onChange: props.onChange }));
30
30
  return (React.createElement("div", { className: join(baseClassName, props.isLoading && `${baseClassName}--loading`, !value.length && `${baseClassName}--empty`), onKeyDownCapture: (e) => {
package/src/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  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" || '',
3
- PUBLISH_TIMESTAMP: 1744635576553 || Date.now(),
4
- VERSION: "20.0.4-canary.2" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1744726345600 || Date.now(),
4
+ VERSION: "20.0.4" || '--current-version--',
5
5
  };
@@ -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 {};
@@ -3,7 +3,7 @@ import { isPivotLayoutModel } from './isPivotLayoutModel';
3
3
  import { LMEmitter } from './LMEmitter';
4
4
  import { GROUP_COLUMN_ID__MULTI_PREFIX, GROUP_COLUMN_ID__SINGLE, normalizeLayoutModel, normalizePivotLayoutModel, normalizeTableLayoutModel, } from './normalizeLayoutModel';
5
5
  import { isLayoutEqual } from './isLayoutEqual';
6
- import { simplifyLayoutModel, simplifyPivotLayoutModel, simplifyTableLayoutModel, } from './simplifyLayoutModel';
6
+ import { simplifyTableLayoutModel, simplifyPivotLayoutModel, simplifyLayoutModel, } from './simplifyLayoutModel';
7
7
  import { sortColumnIdsByOrder } from './sortColumnIdsByOrder';
8
8
  function flattenColDefs(colDefs) {
9
9
  const res = [];
@@ -117,12 +117,8 @@ export class LayoutManager extends LMEmitter {
117
117
  }).bind(this);
118
118
  }
119
119
  this.setOptions(options);
120
- // this ensures the grand total columns are positioned correctly (before/after) even when changed at runtime
121
- // see https://www.ag-grid.com/react-data-grid/pivoting-column-groups/#changing-data-filters-and-configurations
122
- this.gridApi.setGridOption('enableStrictPivotColumnOrder', true);
123
120
  this.setupEvents();
124
121
  this.indexColumns();
125
- this.setupPivotTotals();
126
122
  globalThis.layoutManager = this;
127
123
  }
128
124
  destroy() {
@@ -276,7 +272,7 @@ export class LayoutManager extends LMEmitter {
276
272
  let ColumnPinning = {};
277
273
  const gridState = this.gridApi.getState();
278
274
  const prevLayout = this.currentLayout;
279
- const prevAggColumns = prevLayout?.TableAggregationColumns ?? prevLayout?.PivotAggregationColumns;
275
+ const prevAggColumns = prevLayout?.TableAggregationColumns;
280
276
  const prevAggColumnsMap = prevAggColumns?.reduce((acc, agg) => {
281
277
  acc[agg.ColumnId] = agg;
282
278
  return acc;
@@ -987,7 +983,6 @@ export class LayoutManager extends LMEmitter {
987
983
  return columnIds;
988
984
  }
989
985
  applyPivotLayout(layout, options) {
990
- this.applyPivotTotals(layout);
991
986
  const columnState = this.computeColumnStateForPivotLayout(layout);
992
987
  // by simply calling this.gridApi.applyColumnState(columnState)
993
988
  // the order of aggregations is not preserved/guaranteed by ag-grid
@@ -1015,50 +1010,6 @@ export class LayoutManager extends LMEmitter {
1015
1010
  this.applyRowGroupValues(layout.RowGroupValues);
1016
1011
  }
1017
1012
  }
1018
- applyPivotTotals(layout) {
1019
- /**
1020
- * GrandTotalRow
1021
- */
1022
- if (layout.GrandTotalRow) {
1023
- const grandTotalRow = layout.GrandTotalRow === true || layout.GrandTotalRow === 'top'
1024
- ? 'top'
1025
- : layout.GrandTotalRow === 'bottom'
1026
- ? 'bottom'
1027
- : null;
1028
- this.gridApi.setGridOption('grandTotalRow', grandTotalRow);
1029
- }
1030
- else {
1031
- this.gridApi.setGridOption('grandTotalRow', null);
1032
- }
1033
- /**
1034
- * GrandTotalColumn
1035
- */
1036
- if (layout.GrandTotalColumn) {
1037
- const grandTotalColumn = layout.GrandTotalColumn === true || layout.GrandTotalColumn === 'before'
1038
- ? 'before'
1039
- : layout.GrandTotalColumn === 'after'
1040
- ? 'after'
1041
- : null;
1042
- this.gridApi.setGridOption('pivotRowTotals', grandTotalColumn);
1043
- }
1044
- else {
1045
- this.gridApi.setGridOption('pivotRowTotals', null);
1046
- }
1047
- /**
1048
- * PivotGroupTotalColumn
1049
- */
1050
- if (layout.PivotGroupTotalColumn) {
1051
- const pivotGroupTotalColumn = layout.PivotGroupTotalColumn === true || layout.PivotGroupTotalColumn === 'before'
1052
- ? 'before'
1053
- : layout.PivotGroupTotalColumn === 'after'
1054
- ? 'after'
1055
- : null;
1056
- this.gridApi.setGridOption('pivotColumnGroupTotals', pivotGroupTotalColumn);
1057
- }
1058
- else {
1059
- this.gridApi.setGridOption('pivotColumnGroupTotals', null);
1060
- }
1061
- }
1062
1013
  applyPivotExpandLevel(layout) {
1063
1014
  const PivotExpandLevel = layout.PivotExpandLevel ?? -1;
1064
1015
  const allDisplayedColumnGroups = this.gridApi.getAllDisplayedColumnGroups();
@@ -1094,164 +1045,4 @@ export class LayoutManager extends LMEmitter {
1094
1045
  }
1095
1046
  return res;
1096
1047
  }
1097
- setupPivotTotals() {
1098
- const _original_processPivotResultColDef = this.gridApi.getGridOption('processPivotResultColDef');
1099
- this.gridApi.setGridOption('processPivotResultColDef', (resulColDef) => {
1100
- _original_processPivotResultColDef?.(resulColDef);
1101
- if (!isPivotLayoutModel(this.currentLayout)) {
1102
- return;
1103
- }
1104
- this.patchGrandTotalColumn(resulColDef);
1105
- this.patchPivotGroupTotalColumn(resulColDef);
1106
- });
1107
- const _original_processPivotResultColGroupDef = this.gridApi.getGridOption('processPivotResultColGroupDef');
1108
- this.gridApi.setGridOption('processPivotResultColGroupDef', (colGroupDef) => {
1109
- _original_processPivotResultColGroupDef?.(colGroupDef);
1110
- if (!isPivotLayoutModel(this.currentLayout)) {
1111
- return;
1112
- }
1113
- this.patchPivotTotalColumn(colGroupDef);
1114
- });
1115
- }
1116
- isPivotRowTotalColDef(colDef) {
1117
- return colDef.colId?.startsWith('PivotRowTotal_');
1118
- }
1119
- patchGrandTotalColumn(resultColDef) {
1120
- if (!isPivotLayoutModel(this.currentLayout) || !this.currentLayout.GrandTotalColumn) {
1121
- return;
1122
- }
1123
- if (this.isPivotRowTotalColDef(resultColDef)) {
1124
- resultColDef.headerName = `Grand Total ${resultColDef.headerName}`;
1125
- }
1126
- }
1127
- isPivotGroupTotalColumn(colDef) {
1128
- // pivot group total are spanning cross all aggregations
1129
- // therefore the last part of the colId is empty (hence the "dangling" underscore)
1130
- return colDef.colId?.startsWith('pivot_') && colDef.colId?.endsWith('_');
1131
- }
1132
- patchPivotGroupTotalColumn(resultColDef) {
1133
- if (!isPivotLayoutModel(this.currentLayout) || !this.currentLayout.PivotGroupTotalColumn) {
1134
- return;
1135
- }
1136
- if (this.isPivotGroupTotalColumn(resultColDef)) {
1137
- // resultColDef
1138
- const colInfo = this.destructurePivotColumnId(resultColDef.colId);
1139
- if (colInfo !== '!unknown!') {
1140
- const currentPivotKey = colInfo.pivotKeys[colInfo.pivotKeys.length - 1];
1141
- resultColDef.headerName = `${currentPivotKey} Total`;
1142
- }
1143
- }
1144
- }
1145
- patchPivotTotalColumn(colGroupDef) {
1146
- const hasPivotTotalCols = (pivotLayout) => {
1147
- return pivotLayout.PivotAggregationColumns?.some((aggCol) => !!aggCol.TotalColumn);
1148
- };
1149
- const isPivotTotalColDef = (colDef) => {
1150
- return !!colDef.pivotTotalColumnIds?.length;
1151
- };
1152
- if (!isPivotLayoutModel(this.currentLayout) || !hasPivotTotalCols(this.currentLayout)) {
1153
- return;
1154
- }
1155
- const pivotRowTotalColDefsBefore = [];
1156
- const pivotRowTotalColDefsAfter = [];
1157
- const pivotTotalColDefsBefore = [];
1158
- const pivotTotalColDefsAfter = [];
1159
- const normalColDefs = [];
1160
- colGroupDef.children.forEach((colDef) => {
1161
- if (this.isPivotRowTotalColDef(colDef)) {
1162
- if (this.gridApi.getGridOption('pivotRowTotals') === 'after') {
1163
- pivotRowTotalColDefsAfter.push(colDef);
1164
- }
1165
- else {
1166
- pivotRowTotalColDefsBefore.push(colDef);
1167
- }
1168
- }
1169
- if (isPivotTotalColDef(colDef)) {
1170
- if (!colDef.colId.startsWith('pivot_')) {
1171
- this.warn(`Pivot total column ${colDef.colId} is not prefixed with 'pivot_', skipping...`);
1172
- return;
1173
- }
1174
- // we do this for all total cols, but we will hide the ones that are not visible
1175
- colDef.columnGroupShow = undefined;
1176
- colDef.headerName = `Total ${colDef.headerName}`;
1177
- const totalColConfig = this.getPivotTotalColumnConfig(colDef, this.currentLayout);
1178
- if (!totalColConfig.visible) {
1179
- colDef.hide = true;
1180
- }
1181
- else {
1182
- if (totalColConfig.position === 'after') {
1183
- pivotTotalColDefsAfter.push(colDef);
1184
- }
1185
- else {
1186
- pivotTotalColDefsBefore.push(colDef);
1187
- }
1188
- }
1189
- }
1190
- else {
1191
- normalColDefs.push(colDef);
1192
- }
1193
- });
1194
- colGroupDef.children = [
1195
- ...pivotRowTotalColDefsBefore,
1196
- ...pivotTotalColDefsBefore,
1197
- ...normalColDefs,
1198
- ...pivotTotalColDefsAfter,
1199
- ...pivotRowTotalColDefsAfter,
1200
- ];
1201
- }
1202
- destructurePivotColumnId(colId = '') {
1203
- // Split by underscore to get 4 parts
1204
- const parts = colId.split('_');
1205
- if (parts.length !== 4) {
1206
- this.warn(`Unsupported format of pivot total column id: ${colId}`);
1207
- return '!unknown!';
1208
- }
1209
- // e.g.
1210
- // pivot_country-sport-year_United States-Basketball_gold
1211
- // pivotColumnIds: ['country', 'sport', 'year']
1212
- // pivotKeys: ['United States', 'Basketball']
1213
- // aggregationColumnId: 'gold'
1214
- const [_pivotPrefix, pivotColsTxt, pivotKeysTxt, aggregationColumnId] = parts;
1215
- const pivotColumnIds = pivotColsTxt.split('-');
1216
- const pivotKeys = pivotKeysTxt.split('-');
1217
- const pivotColumnId = pivotColumnIds[pivotKeys.length - 1];
1218
- return {
1219
- pivotColumnIds,
1220
- pivotKeys,
1221
- pivotColumnId,
1222
- aggregationColumnId,
1223
- };
1224
- }
1225
- getPivotTotalColumnConfig(colDef, currentPivotLayout) {
1226
- const defaultHiddenConfig = {
1227
- visible: false,
1228
- };
1229
- const colIdInfo = this.destructurePivotColumnId(colDef.colId);
1230
- if (colIdInfo === '!unknown!') {
1231
- return defaultHiddenConfig;
1232
- }
1233
- const { pivotColumnId, aggregationColumnId } = colIdInfo;
1234
- const layoutAggCol = currentPivotLayout.PivotAggregationColumns?.find((col) => col.ColumnId === aggregationColumnId);
1235
- if (!layoutAggCol) {
1236
- this.warn(`Pivot Totals: could NOT find aggregation(value) column with id ${aggregationColumnId}`);
1237
- return defaultHiddenConfig;
1238
- }
1239
- const layoutPivotTotalColumn = layoutAggCol.TotalColumn;
1240
- if (!layoutPivotTotalColumn) {
1241
- return defaultHiddenConfig;
1242
- }
1243
- if (Array.isArray(layoutPivotTotalColumn)) {
1244
- const pivotSpecificConfig = layoutPivotTotalColumn.find((config) => config.PivotColumnId === pivotColumnId);
1245
- return {
1246
- visible: pivotSpecificConfig && pivotSpecificConfig.ShowTotal !== false,
1247
- position: pivotSpecificConfig?.ShowTotal === 'after' ? 'after' : 'before',
1248
- };
1249
- }
1250
- else {
1251
- return {
1252
- visible: !!layoutPivotTotalColumn,
1253
- position: layoutPivotTotalColumn === 'after' ? 'after' : 'before',
1254
- };
1255
- }
1256
- }
1257
1048
  }
@@ -139,9 +139,6 @@ export function normalizePivotLayoutModel(layout) {
139
139
  // make it an own property
140
140
  layout.SuppressAggFuncInHeader = undefined;
141
141
  }
142
- if (!layout.GrandTotalRow) {
143
- layout.GrandTotalRow = false;
144
- }
145
142
  return layout;
146
143
  }
147
144
  export function normalizeLayoutModel(layout, options) {
@@ -15,7 +15,7 @@ export function simplifyTableLayoutModel(layout) {
15
15
  delete layout.RowGroupedColumns;
16
16
  }
17
17
  if (!layout.RowGroupedColumns && layout.RowGroupValues) {
18
- delete layout.RowGroupValues;
18
+ // delete layout.RowGroupValues;
19
19
  }
20
20
  if (layout.SuppressAggFuncInHeader === undefined) {
21
21
  delete layout.SuppressAggFuncInHeader;