@adaptabletools/adaptable-cjs 21.0.8 → 21.0.9
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 +1 -1
- package/src/View/Layout/Wizard/sections/AggregationsSection.js +18 -5
- package/src/agGrid/AgGridAdapter.js +4 -1
- package/src/env.js +2 -2
- package/src/layout-manager/src/index.js +3 -5
- package/src/layout-manager/src/normalizeLayoutModel.js +3 -0
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/tsconfig.cjs.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable-cjs",
|
|
3
|
-
"version": "21.0.
|
|
3
|
+
"version": "21.0.9",
|
|
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",
|
|
@@ -47,10 +47,15 @@ const ColumnRow = (props) => {
|
|
|
47
47
|
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
48
48
|
const aggValue = props.layout?.TableAggregationColumns?.find((agg) => agg.ColumnId === props.column.columnId)?.AggFunc;
|
|
49
49
|
const adaptableAggFunctions = [];
|
|
50
|
-
if (props.column.dataType === 'number') {
|
|
50
|
+
if (props.column.dataType === 'number' && props.column.aggregatable) {
|
|
51
51
|
adaptableAggFunctions.push(WEIGHTED_AVERAGE_AGG_FN_NAME);
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
// props.column.availableAggregationFunctions is null for non-aggregatable columns
|
|
54
|
+
// but we want to support non-aggregatable columns that are specified to be aggregated by default
|
|
55
|
+
// so we need to allow this. as soon as they will be unchecked from aggregation, they will no longer be displayed in the aggregation wizard.
|
|
56
|
+
// but until the user checks them off, we want to allow them.
|
|
57
|
+
const availableAggregationFunctions = props.column.availableAggregationFunctions || [];
|
|
58
|
+
const aggOptions = [...new Set([...availableAggregationFunctions, ...adaptableAggFunctions])].map((fnName) => {
|
|
54
59
|
return {
|
|
55
60
|
label: fnName,
|
|
56
61
|
onClick: () => {
|
|
@@ -141,9 +146,17 @@ const AggregationsSection = (props) => {
|
|
|
141
146
|
const allAggregableColumns = adaptable.api.columnApi.getAggregatableColumns();
|
|
142
147
|
const allColumns = adaptable.api.columnApi.getUIAvailableColumns();
|
|
143
148
|
const numberColumns = adaptable.api.columnApi.getNumericColumns();
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
149
|
+
const allAggregatableColumnIds = allAggregableColumns.map((col) => col.columnId);
|
|
150
|
+
(layout.TableAggregationColumns || []).forEach((agg) => {
|
|
151
|
+
// we need to also display the columns currently aggregated,
|
|
152
|
+
// even if they are not aggregatable
|
|
153
|
+
if (!allAggregatableColumnIds.includes(agg.ColumnId)) {
|
|
154
|
+
allAggregatableColumnIds.push(agg.ColumnId);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
const sortedAggregableColumns = ArrayExtensions_1.default.sortArrayWithOrder(allAggregatableColumnIds, (layout.TableAggregationColumns ?? []).map((agg) => agg.ColumnId), { sortUnorderedItems: false })
|
|
158
|
+
.map((colId) => adaptable.api.columnApi.getColumnWithColumnId(colId))
|
|
159
|
+
.filter(Boolean);
|
|
147
160
|
const handleColumnsSelectionChange = React.useCallback((columnIds) => {
|
|
148
161
|
const currentAggsMap = (layout.TableAggregationColumns || []).reduce((acc, { ColumnId, AggFunc }) => {
|
|
149
162
|
acc[ColumnId] = AggFunc;
|
|
@@ -612,7 +612,10 @@ class AgGridAdapter {
|
|
|
612
612
|
return false;
|
|
613
613
|
}
|
|
614
614
|
getColumnAggregationFunctions(colDef) {
|
|
615
|
-
|
|
615
|
+
const result = colDef.allowedAggFuncs || ['sum', 'min', 'max', 'count', 'avg', 'first', 'last']; // those are the default fns aggrid supports out-of-the-box
|
|
616
|
+
const gridOptionsAggFuncs = this.adaptableApi.agGridApi.getGridOption('aggFuncs') || {};
|
|
617
|
+
result.push(...Object.keys(gridOptionsAggFuncs));
|
|
618
|
+
return [...new Set(result)];
|
|
616
619
|
}
|
|
617
620
|
isTreeColumn(isGeneratedRowGroupColumn) {
|
|
618
621
|
return this.adaptableApi.gridApi.isTreeDataGrid() ? isGeneratedRowGroupColumn : false;
|
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: "21.0.
|
|
5
|
+
PUBLISH_TIMESTAMP: 1761300055892 || Date.now(),
|
|
6
|
+
VERSION: "21.0.9" || '--current-version--',
|
|
7
7
|
};
|
|
@@ -97,7 +97,7 @@ function isGridLayoutSame(options) {
|
|
|
97
97
|
if (!!gridLayout != !!layout) {
|
|
98
98
|
return false;
|
|
99
99
|
}
|
|
100
|
-
return (0, isLayoutEqual_1.isLayoutEqual)(gridLayout, layout);
|
|
100
|
+
return (0, isLayoutEqual_1.isLayoutEqual)((0, normalizeLayoutModel_1.normalizeLayoutModel)(gridLayout), (0, normalizeLayoutModel_1.normalizeLayoutModel)(layout));
|
|
101
101
|
}
|
|
102
102
|
function getDefaultColumnSizeStateForColDef(colId, colDef, options) {
|
|
103
103
|
if (!colDef) {
|
|
@@ -315,7 +315,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
315
315
|
// emit an event that the layout has changed from the grid
|
|
316
316
|
this.emitSync('gridLayoutChanged', layout);
|
|
317
317
|
const log = this.debugger.extend('gridLayoutChanged');
|
|
318
|
-
const changes = (0, isLayoutEqual_1.getChanges)(prevLayout, layout);
|
|
318
|
+
const changes = (0, isLayoutEqual_1.getChanges)((0, normalizeLayoutModel_1.normalizeLayoutModel)(prevLayout), (0, normalizeLayoutModel_1.normalizeLayoutModel)(layout));
|
|
319
319
|
log('current grid layout:', JSON.stringify(layout, null, 2), '\nprev layout:\n', prevLayout ? JSON.stringify(prevLayout, null, 2) : 'no prev layout', '\nchanges from prev to current:\n', changes);
|
|
320
320
|
}
|
|
321
321
|
}
|
|
@@ -336,8 +336,6 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
336
336
|
getPivotLayoutModelFromGrid() {
|
|
337
337
|
const pivotResultColumns = this.gridApi.getPivotResultColumns() || [];
|
|
338
338
|
const pivotResultColumnsSet = new Set(pivotResultColumns.map((col) => col.getColId()));
|
|
339
|
-
const rowGroupColumns = this.gridApi.getRowGroupColumns() || [];
|
|
340
|
-
const rowGroupColumnsSet = new Set(rowGroupColumns.map((col) => col.getColId()));
|
|
341
339
|
const prevLayout = this.currentLayout;
|
|
342
340
|
const columnState = this.gridApi
|
|
343
341
|
.getColumnState()
|
|
@@ -365,7 +363,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
365
363
|
// since having normal table columns here will break the equality check
|
|
366
364
|
// so we only want to keep the group columns and the pivot result columns
|
|
367
365
|
Object.keys(ColumnVisibility).forEach((colId) => {
|
|
368
|
-
const isInLayout = pivotResultColumnsSet.has(colId) ||
|
|
366
|
+
const isInLayout = pivotResultColumnsSet.has(colId) || colId.startsWith(normalizeLayoutModel_1.AUTO_GROUP_COLUMN_ID__SINGLE);
|
|
369
367
|
if (!isInLayout) {
|
|
370
368
|
delete ColumnVisibility[colId];
|
|
371
369
|
}
|
|
@@ -5,6 +5,9 @@ const isPivotLayoutModel_1 = require("./isPivotLayoutModel");
|
|
|
5
5
|
exports.AUTO_GROUP_COLUMN_ID__SINGLE = 'ag-Grid-AutoColumn';
|
|
6
6
|
exports.AUTO_GROUP_COLUMN_ID__MULTI_PREFIX = 'ag-Grid-AutoColumn-';
|
|
7
7
|
function normalizeTableLayoutModel(layout, options) {
|
|
8
|
+
if (!layout) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
8
11
|
layout = structuredClone(layout);
|
|
9
12
|
if (!layout.ColumnVisibility) {
|
|
10
13
|
layout.ColumnVisibility = {};
|