@adaptabletools/adaptable 20.0.4-canary.0 → 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",
|
|
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
|
@@ -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:
|
|
4
|
-
VERSION: "20.0.4-canary.
|
|
3
|
+
PUBLISH_TIMESTAMP: 1744635576553 || Date.now(),
|
|
4
|
+
VERSION: "20.0.4-canary.2" || '--current-version--',
|
|
5
5
|
};
|
|
@@ -73,8 +73,12 @@ export declare class LayoutManager<DATA_TYPE = any> extends LMEmitter {
|
|
|
73
73
|
applyPivotExpandLevel(layout: PivotLayoutModel): void;
|
|
74
74
|
private withSuppressColumnAnimation;
|
|
75
75
|
private setupPivotTotals;
|
|
76
|
+
private isPivotRowTotalColDef;
|
|
76
77
|
private patchGrandTotalColumn;
|
|
78
|
+
private isPivotGroupTotalColumn;
|
|
79
|
+
private patchPivotGroupTotalColumn;
|
|
77
80
|
private patchPivotTotalColumn;
|
|
81
|
+
private destructurePivotColumnId;
|
|
78
82
|
private getPivotTotalColumnConfig;
|
|
79
83
|
}
|
|
80
84
|
export {};
|
|
@@ -1102,6 +1102,7 @@ export class LayoutManager extends LMEmitter {
|
|
|
1102
1102
|
return;
|
|
1103
1103
|
}
|
|
1104
1104
|
this.patchGrandTotalColumn(resulColDef);
|
|
1105
|
+
this.patchPivotGroupTotalColumn(resulColDef);
|
|
1105
1106
|
});
|
|
1106
1107
|
const _original_processPivotResultColGroupDef = this.gridApi.getGridOption('processPivotResultColGroupDef');
|
|
1107
1108
|
this.gridApi.setGridOption('processPivotResultColGroupDef', (colGroupDef) => {
|
|
@@ -1112,14 +1113,35 @@ export class LayoutManager extends LMEmitter {
|
|
|
1112
1113
|
this.patchPivotTotalColumn(colGroupDef);
|
|
1113
1114
|
});
|
|
1114
1115
|
}
|
|
1116
|
+
isPivotRowTotalColDef(colDef) {
|
|
1117
|
+
return colDef.colId?.startsWith('PivotRowTotal_');
|
|
1118
|
+
}
|
|
1115
1119
|
patchGrandTotalColumn(resultColDef) {
|
|
1116
1120
|
if (!isPivotLayoutModel(this.currentLayout) || !this.currentLayout.GrandTotalColumn) {
|
|
1117
1121
|
return;
|
|
1118
1122
|
}
|
|
1119
|
-
if (
|
|
1123
|
+
if (this.isPivotRowTotalColDef(resultColDef)) {
|
|
1120
1124
|
resultColDef.headerName = `Grand Total ${resultColDef.headerName}`;
|
|
1121
1125
|
}
|
|
1122
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
|
+
}
|
|
1123
1145
|
patchPivotTotalColumn(colGroupDef) {
|
|
1124
1146
|
const hasPivotTotalCols = (pivotLayout) => {
|
|
1125
1147
|
return pivotLayout.PivotAggregationColumns?.some((aggCol) => !!aggCol.TotalColumn);
|
|
@@ -1130,10 +1152,20 @@ export class LayoutManager extends LMEmitter {
|
|
|
1130
1152
|
if (!isPivotLayoutModel(this.currentLayout) || !hasPivotTotalCols(this.currentLayout)) {
|
|
1131
1153
|
return;
|
|
1132
1154
|
}
|
|
1155
|
+
const pivotRowTotalColDefsBefore = [];
|
|
1156
|
+
const pivotRowTotalColDefsAfter = [];
|
|
1133
1157
|
const pivotTotalColDefsBefore = [];
|
|
1134
1158
|
const pivotTotalColDefsAfter = [];
|
|
1135
1159
|
const normalColDefs = [];
|
|
1136
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
|
+
}
|
|
1137
1169
|
if (isPivotTotalColDef(colDef)) {
|
|
1138
1170
|
if (!colDef.colId.startsWith('pivot_')) {
|
|
1139
1171
|
this.warn(`Pivot total column ${colDef.colId} is not prefixed with 'pivot_', skipping...`);
|
|
@@ -1160,21 +1192,19 @@ export class LayoutManager extends LMEmitter {
|
|
|
1160
1192
|
}
|
|
1161
1193
|
});
|
|
1162
1194
|
colGroupDef.children = [
|
|
1195
|
+
...pivotRowTotalColDefsBefore,
|
|
1163
1196
|
...pivotTotalColDefsBefore,
|
|
1164
1197
|
...normalColDefs,
|
|
1165
1198
|
...pivotTotalColDefsAfter,
|
|
1199
|
+
...pivotRowTotalColDefsAfter,
|
|
1166
1200
|
];
|
|
1167
1201
|
}
|
|
1168
|
-
|
|
1169
|
-
const defaultHiddenConfig = {
|
|
1170
|
-
visible: false,
|
|
1171
|
-
};
|
|
1172
|
-
const colId = colDef.colId;
|
|
1202
|
+
destructurePivotColumnId(colId = '') {
|
|
1173
1203
|
// Split by underscore to get 4 parts
|
|
1174
1204
|
const parts = colId.split('_');
|
|
1175
1205
|
if (parts.length !== 4) {
|
|
1176
1206
|
this.warn(`Unsupported format of pivot total column id: ${colId}`);
|
|
1177
|
-
return
|
|
1207
|
+
return '!unknown!';
|
|
1178
1208
|
}
|
|
1179
1209
|
// e.g.
|
|
1180
1210
|
// pivot_country-sport-year_United States-Basketball_gold
|
|
@@ -1184,6 +1214,23 @@ export class LayoutManager extends LMEmitter {
|
|
|
1184
1214
|
const [_pivotPrefix, pivotColsTxt, pivotKeysTxt, aggregationColumnId] = parts;
|
|
1185
1215
|
const pivotColumnIds = pivotColsTxt.split('-');
|
|
1186
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;
|
|
1187
1234
|
const layoutAggCol = currentPivotLayout.PivotAggregationColumns?.find((col) => col.ColumnId === aggregationColumnId);
|
|
1188
1235
|
if (!layoutAggCol) {
|
|
1189
1236
|
this.warn(`Pivot Totals: could NOT find aggregation(value) column with id ${aggregationColumnId}`);
|
|
@@ -1193,7 +1240,6 @@ export class LayoutManager extends LMEmitter {
|
|
|
1193
1240
|
if (!layoutPivotTotalColumn) {
|
|
1194
1241
|
return defaultHiddenConfig;
|
|
1195
1242
|
}
|
|
1196
|
-
const pivotColumnId = pivotColumnIds[pivotKeys.length - 1];
|
|
1197
1243
|
if (Array.isArray(layoutPivotTotalColumn)) {
|
|
1198
1244
|
const pivotSpecificConfig = layoutPivotTotalColumn.find((config) => config.PivotColumnId === pivotColumnId);
|
|
1199
1245
|
return {
|