@adaptabletools/adaptable-cjs 20.0.4-canary.1 → 20.0.4-canary.2
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
|
+
"version": "20.0.4-canary.2",
|
|
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",
|
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:
|
|
6
|
-
VERSION: "20.0.4-canary.
|
|
5
|
+
PUBLISH_TIMESTAMP: 1744635605576 || Date.now(),
|
|
6
|
+
VERSION: "20.0.4-canary.2" || '--current-version--',
|
|
7
7
|
};
|
|
@@ -75,7 +75,10 @@ export declare class LayoutManager<DATA_TYPE = any> extends LMEmitter {
|
|
|
75
75
|
private setupPivotTotals;
|
|
76
76
|
private isPivotRowTotalColDef;
|
|
77
77
|
private patchGrandTotalColumn;
|
|
78
|
+
private isPivotGroupTotalColumn;
|
|
79
|
+
private patchPivotGroupTotalColumn;
|
|
78
80
|
private patchPivotTotalColumn;
|
|
81
|
+
private destructurePivotColumnId;
|
|
79
82
|
private getPivotTotalColumnConfig;
|
|
80
83
|
}
|
|
81
84
|
export {};
|
|
@@ -1105,6 +1105,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
1105
1105
|
return;
|
|
1106
1106
|
}
|
|
1107
1107
|
this.patchGrandTotalColumn(resulColDef);
|
|
1108
|
+
this.patchPivotGroupTotalColumn(resulColDef);
|
|
1108
1109
|
});
|
|
1109
1110
|
const _original_processPivotResultColGroupDef = this.gridApi.getGridOption('processPivotResultColGroupDef');
|
|
1110
1111
|
this.gridApi.setGridOption('processPivotResultColGroupDef', (colGroupDef) => {
|
|
@@ -1126,6 +1127,24 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
1126
1127
|
resultColDef.headerName = `Grand Total ${resultColDef.headerName}`;
|
|
1127
1128
|
}
|
|
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
|
+
}
|
|
1129
1148
|
patchPivotTotalColumn(colGroupDef) {
|
|
1130
1149
|
const hasPivotTotalCols = (pivotLayout) => {
|
|
1131
1150
|
return pivotLayout.PivotAggregationColumns?.some((aggCol) => !!aggCol.TotalColumn);
|
|
@@ -1183,16 +1202,12 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
1183
1202
|
...pivotRowTotalColDefsAfter,
|
|
1184
1203
|
];
|
|
1185
1204
|
}
|
|
1186
|
-
|
|
1187
|
-
const defaultHiddenConfig = {
|
|
1188
|
-
visible: false,
|
|
1189
|
-
};
|
|
1190
|
-
const colId = colDef.colId;
|
|
1205
|
+
destructurePivotColumnId(colId = '') {
|
|
1191
1206
|
// Split by underscore to get 4 parts
|
|
1192
1207
|
const parts = colId.split('_');
|
|
1193
1208
|
if (parts.length !== 4) {
|
|
1194
1209
|
this.warn(`Unsupported format of pivot total column id: ${colId}`);
|
|
1195
|
-
return
|
|
1210
|
+
return '!unknown!';
|
|
1196
1211
|
}
|
|
1197
1212
|
// e.g.
|
|
1198
1213
|
// pivot_country-sport-year_United States-Basketball_gold
|
|
@@ -1202,6 +1217,23 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
1202
1217
|
const [_pivotPrefix, pivotColsTxt, pivotKeysTxt, aggregationColumnId] = parts;
|
|
1203
1218
|
const pivotColumnIds = pivotColsTxt.split('-');
|
|
1204
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;
|
|
1205
1237
|
const layoutAggCol = currentPivotLayout.PivotAggregationColumns?.find((col) => col.ColumnId === aggregationColumnId);
|
|
1206
1238
|
if (!layoutAggCol) {
|
|
1207
1239
|
this.warn(`Pivot Totals: could NOT find aggregation(value) column with id ${aggregationColumnId}`);
|
|
@@ -1211,7 +1243,6 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
1211
1243
|
if (!layoutPivotTotalColumn) {
|
|
1212
1244
|
return defaultHiddenConfig;
|
|
1213
1245
|
}
|
|
1214
|
-
const pivotColumnId = pivotColumnIds[pivotKeys.length - 1];
|
|
1215
1246
|
if (Array.isArray(layoutPivotTotalColumn)) {
|
|
1216
1247
|
const pivotSpecificConfig = layoutPivotTotalColumn.find((config) => config.PivotColumnId === pivotColumnId);
|
|
1217
1248
|
return {
|