@adaptabletools/adaptable 21.0.9-canary.0 → 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 +1 -1
- package/src/layout-manager/src/normalizeLayoutModel.js +3 -0
- package/tsconfig.esm.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable",
|
|
3
|
-
"version": "21.0.9
|
|
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",
|
|
@@ -41,10 +41,15 @@ const ColumnRow = (props) => {
|
|
|
41
41
|
const adaptable = useAdaptable();
|
|
42
42
|
const aggValue = props.layout?.TableAggregationColumns?.find((agg) => agg.ColumnId === props.column.columnId)?.AggFunc;
|
|
43
43
|
const adaptableAggFunctions = [];
|
|
44
|
-
if (props.column.dataType === 'number') {
|
|
44
|
+
if (props.column.dataType === 'number' && props.column.aggregatable) {
|
|
45
45
|
adaptableAggFunctions.push(WEIGHTED_AVERAGE_AGG_FN_NAME);
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
// props.column.availableAggregationFunctions is null for non-aggregatable columns
|
|
48
|
+
// but we want to support non-aggregatable columns that are specified to be aggregated by default
|
|
49
|
+
// 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.
|
|
50
|
+
// but until the user checks them off, we want to allow them.
|
|
51
|
+
const availableAggregationFunctions = props.column.availableAggregationFunctions || [];
|
|
52
|
+
const aggOptions = [...new Set([...availableAggregationFunctions, ...adaptableAggFunctions])].map((fnName) => {
|
|
48
53
|
return {
|
|
49
54
|
label: fnName,
|
|
50
55
|
onClick: () => {
|
|
@@ -135,9 +140,17 @@ export const AggregationsSection = (props) => {
|
|
|
135
140
|
const allAggregableColumns = adaptable.api.columnApi.getAggregatableColumns();
|
|
136
141
|
const allColumns = adaptable.api.columnApi.getUIAvailableColumns();
|
|
137
142
|
const numberColumns = adaptable.api.columnApi.getNumericColumns();
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
143
|
+
const allAggregatableColumnIds = allAggregableColumns.map((col) => col.columnId);
|
|
144
|
+
(layout.TableAggregationColumns || []).forEach((agg) => {
|
|
145
|
+
// we need to also display the columns currently aggregated,
|
|
146
|
+
// even if they are not aggregatable
|
|
147
|
+
if (!allAggregatableColumnIds.includes(agg.ColumnId)) {
|
|
148
|
+
allAggregatableColumnIds.push(agg.ColumnId);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
const sortedAggregableColumns = ArrayExtensions.sortArrayWithOrder(allAggregatableColumnIds, (layout.TableAggregationColumns ?? []).map((agg) => agg.ColumnId), { sortUnorderedItems: false })
|
|
152
|
+
.map((colId) => adaptable.api.columnApi.getColumnWithColumnId(colId))
|
|
153
|
+
.filter(Boolean);
|
|
141
154
|
const handleColumnsSelectionChange = React.useCallback((columnIds) => {
|
|
142
155
|
const currentAggsMap = (layout.TableAggregationColumns || []).reduce((acc, { ColumnId, AggFunc }) => {
|
|
143
156
|
acc[ColumnId] = AggFunc;
|
|
@@ -608,7 +608,10 @@ export class AgGridAdapter {
|
|
|
608
608
|
return false;
|
|
609
609
|
}
|
|
610
610
|
getColumnAggregationFunctions(colDef) {
|
|
611
|
-
|
|
611
|
+
const result = colDef.allowedAggFuncs || ['sum', 'min', 'max', 'count', 'avg', 'first', 'last']; // those are the default fns aggrid supports out-of-the-box
|
|
612
|
+
const gridOptionsAggFuncs = this.adaptableApi.agGridApi.getGridOption('aggFuncs') || {};
|
|
613
|
+
result.push(...Object.keys(gridOptionsAggFuncs));
|
|
614
|
+
return [...new Set(result)];
|
|
612
615
|
}
|
|
613
616
|
isTreeColumn(isGeneratedRowGroupColumn) {
|
|
614
617
|
return this.adaptableApi.gridApi.isTreeDataGrid() ? isGeneratedRowGroupColumn : false;
|
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: "21.0.9
|
|
3
|
+
PUBLISH_TIMESTAMP: 1761300024312 || Date.now(),
|
|
4
|
+
VERSION: "21.0.9" || '--current-version--',
|
|
5
5
|
};
|
|
@@ -312,7 +312,7 @@ export class LayoutManager extends LMEmitter {
|
|
|
312
312
|
// emit an event that the layout has changed from the grid
|
|
313
313
|
this.emitSync('gridLayoutChanged', layout);
|
|
314
314
|
const log = this.debugger.extend('gridLayoutChanged');
|
|
315
|
-
const changes = getChanges(prevLayout, layout);
|
|
315
|
+
const changes = getChanges(normalizeLayoutModel(prevLayout), normalizeLayoutModel(layout));
|
|
316
316
|
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);
|
|
317
317
|
}
|
|
318
318
|
}
|
|
@@ -2,6 +2,9 @@ import { isPivotLayoutModel } from './isPivotLayoutModel';
|
|
|
2
2
|
export const AUTO_GROUP_COLUMN_ID__SINGLE = 'ag-Grid-AutoColumn';
|
|
3
3
|
export const AUTO_GROUP_COLUMN_ID__MULTI_PREFIX = 'ag-Grid-AutoColumn-';
|
|
4
4
|
export function normalizeTableLayoutModel(layout, options) {
|
|
5
|
+
if (!layout) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
5
8
|
layout = structuredClone(layout);
|
|
6
9
|
if (!layout.ColumnVisibility) {
|
|
7
10
|
layout.ColumnVisibility = {};
|