@adaptabletools/adaptable-cjs 21.0.9-canary.0 → 21.0.10

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.10",
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;
@@ -581,7 +581,7 @@ class AgGridColumnAdapter {
581
581
  if (this.adaptableApi.gridApi.isTreeDataGrid()) {
582
582
  this.setColDefProperty(col, 'filter', (original_filter) => {
583
583
  const autoGroupColumnDef = this.agGridApi.getGridOption('autoGroupColumnDef');
584
- if (autoGroupColumnDef.filter != undefined) {
584
+ if (autoGroupColumnDef?.filter != undefined) {
585
585
  // we plan to provide a TreeListColumnFilter
586
586
  // until then, it's the user's responsibility to explicitly set the filter in the provided `autoGroupColumnDef`
587
587
  return original_filter;
@@ -18,6 +18,7 @@ const UIHelper_1 = require("../../View/UIHelper");
18
18
  const InfiniteTable_1 = require("../InfiniteTable");
19
19
  const AdaptableContext_1 = require("../../View/AdaptableContext");
20
20
  const overlayBaseZIndex_1 = require("../overlayBaseZIndex");
21
+ const DATA_NAME_OVERLAY_TRIGGER = 'OverlayTrigger';
21
22
  const getConstrainElement = (target, constrainTo) => {
22
23
  let el = null;
23
24
  if (typeof constrainTo === 'string') {
@@ -65,6 +66,7 @@ const defaultProps = {
65
66
  };
66
67
  const OverlayTrigger = React.forwardRef((givenProps, ref) => {
67
68
  const props = { ...defaultProps, ...givenProps };
69
+ (0, exports.ensurePortalElement)();
68
70
  const adaptable = (0, AdaptableContext_1.useAdaptable)();
69
71
  let { visible: _, showTriangle, showEvent, hideEvent, render, targetOffset, preventPortalEventPropagation = false, anchor, hideDelay = 0, opacityTransitionDuration, onVisibleChange, alignPosition = [
70
72
  // overlay - target
@@ -113,7 +115,6 @@ const OverlayTrigger = React.forwardRef((givenProps, ref) => {
113
115
  doSetVisible(true);
114
116
  }, 50), []);
115
117
  const prevVisible = (0, usePrevious_1.default)(visible, false);
116
- (0, exports.ensurePortalElement)();
117
118
  const onShow = React.useCallback((event) => {
118
119
  const target = targetRef.current;
119
120
  if (event && preventPortalEventPropagation && !(0, contains_1.default)(target, event.target)) {
@@ -148,6 +149,9 @@ const OverlayTrigger = React.forwardRef((givenProps, ref) => {
148
149
  }, [ref]);
149
150
  (0, react_1.useEffect)(() => {
150
151
  let target = domRef.current.previousSibling;
152
+ while (target && target.dataset.name === DATA_NAME_OVERLAY_TRIGGER) {
153
+ target = target.previousSibling;
154
+ }
151
155
  if (targetProp) {
152
156
  target = targetProp(target);
153
157
  }
@@ -218,7 +222,7 @@ const OverlayTrigger = React.forwardRef((givenProps, ref) => {
218
222
  const agGridClassName = (0, useAgGridClassName_1.default)([visible]);
219
223
  return (React.createElement(React.Fragment, null,
220
224
  React.Children.only(props.children),
221
- React.createElement("div", { "data-name": "OverlayTrigger", "data-visible": visible, ref: domRef, style: {
225
+ React.createElement("div", { "data-name": DATA_NAME_OVERLAY_TRIGGER, "data-visible": visible, ref: domRef, style: {
222
226
  visibility: 'hidden',
223
227
  flex: 'none',
224
228
  width: 0,
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: 1761827394642 || Date.now(),
6
+ VERSION: "21.0.10" || '--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
  }
@@ -381,6 +381,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
381
381
  Ignore_RowSummaries: layout.Ignore_RowSummaries,
382
382
  Ignore_IsReadOnly: layout.Ignore_IsReadOnly,
383
383
  Ignore_Tags: layout.Ignore_Tags,
384
+ Ignore_Metadata: layout.Ignore_Metadata,
384
385
  Ignore_Source: layout.Ignore_Source,
385
386
  Ignore_AdaptableVersion: layout.Ignore_AdaptableVersion,
386
387
  Ignore_Uuid: layout.Ignore_Uuid,
@@ -709,6 +710,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
709
710
  Ignore_RowSummaries: this.currentLayout?.Ignore_RowSummaries,
710
711
  Ignore_IsReadOnly: this.currentLayout?.Ignore_IsReadOnly,
711
712
  Ignore_Tags: this.currentLayout?.Ignore_Tags,
713
+ Ignore_Metadata: this.currentLayout?.Ignore_Metadata,
712
714
  Ignore_Source: this.currentLayout?.Ignore_Source,
713
715
  Ignore_AdaptableVersion: this.currentLayout?.Ignore_AdaptableVersion,
714
716
  Ignore_Uuid: this.currentLayout?.Ignore_Uuid,
@@ -62,6 +62,7 @@ function clearIgnoredProperties(layout) {
62
62
  delete layout.Ignore_IsReadOnly;
63
63
  delete layout.Ignore_Tags;
64
64
  delete layout.Ignore_Source;
65
+ delete layout.Ignore_Metadata;
65
66
  delete layout.Ignore_AdaptableVersion;
66
67
  delete layout.Ignore_Uuid;
67
68
  }
@@ -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 = {};