@adaptabletools/adaptable-cjs 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable-cjs",
3
- "version": "21.0.9-canary.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
- const aggOptions = [...props.column.availableAggregationFunctions, ...adaptableAggFunctions].map((fnName) => {
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 sortedAggregableColumns = React.useMemo(() => {
145
- return ArrayExtensions_1.default.sortArrayWithOrder(allAggregableColumns.map((col) => col.columnId), (layout.TableAggregationColumns ?? []).map((agg) => agg.ColumnId), { sortUnorderedItems: false }).map((colId) => adaptable.api.columnApi.getColumnWithColumnId(colId));
146
- }, [layout, allAggregableColumns]);
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
- return colDef.allowedAggFuncs || ['sum', 'min', 'max', 'count', 'avg', 'first', 'last']; // those are the default fns aggrid supports out-of-the-box
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: 1761289716491 || Date.now(),
6
- VERSION: "21.0.9-canary.0" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1761300055892 || Date.now(),
6
+ VERSION: "21.0.9" || '--current-version--',
7
7
  };
@@ -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
  }
@@ -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 = {};