@adaptabletools/adaptable 20.1.6 → 20.1.8

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.1.6",
3
+ "version": "20.1.8",
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",
@@ -17,6 +17,7 @@ export declare class LayoutApiImpl extends ApiBase implements LayoutApi {
17
17
  [key: string]: boolean;
18
18
  };
19
19
  getCurrentVisibleColumnIdsForTableLayout(): string[];
20
+ getCurrentVisibleColumnIdsForPivotLayout(): string[];
20
21
  getCurrentRowGroupsColumnIds(): string[];
21
22
  setLayout(layoutName: string): void;
22
23
  getCurrentLayout(): Layout;
@@ -43,6 +43,15 @@ export class LayoutApiImpl extends ApiBase {
43
43
  }
44
44
  return layout.TableColumns.filter((colId) => !layout.ColumnVisibility || layout.ColumnVisibility?.[colId] !== false);
45
45
  }
46
+ getCurrentVisibleColumnIdsForPivotLayout() {
47
+ const layout = this.getCurrentLayout();
48
+ if (!isPivotLayout(layout)) {
49
+ return [];
50
+ }
51
+ return this.getAgGridApi()
52
+ .getAllDisplayedColumns()
53
+ .map((col) => col.getColId());
54
+ }
46
55
  getCurrentRowGroupsColumnIds() {
47
56
  const layout = this.getCurrentLayout();
48
57
  if (isPivotLayout(layout)) {
@@ -29,15 +29,19 @@ export interface LayoutApi {
29
29
  */
30
30
  getCurrentLayoutColumnSort(columnId: string): ColumnSort['SortOrder'] | null;
31
31
  /**
32
- * Retrieves map with visible columns in current Layout
32
+ * Retrieves map with visible columns in current Table Layout
33
33
  */
34
34
  getCurrentVisibleColumnIdsMapForTableLayout(): {
35
35
  [key: string]: boolean;
36
36
  };
37
37
  /**
38
- * Retrieves array of visible ColumnIds in current Layout
38
+ * Retrieves array of visible ColumnIds in current Table Layout
39
39
  */
40
40
  getCurrentVisibleColumnIdsForTableLayout(): string[];
41
+ /**
42
+ * Retrieves array of visible ColumnIds in current Pivot Layout
43
+ */
44
+ getCurrentVisibleColumnIdsForPivotLayout(): string[];
41
45
  /**
42
46
  * Retrieves array of visible ColumnIds in current Layout
43
47
  */
@@ -1558,13 +1558,9 @@ You need to define at least one Layout!`);
1558
1558
  const autoGroupColumns = gridApi
1559
1559
  .getAllGridColumns()
1560
1560
  .filter((column) => this.api.columnApi.isAutoRowGroupColumn(column.getColId()));
1561
- if (pivotResultColumns.length) {
1562
- agGridCols = [...agGridCols, ...pivotResultColumns, ...autoGroupColumns];
1563
- }
1561
+ agGridCols = [...autoGroupColumns, ...agGridCols, ...pivotResultColumns];
1564
1562
  }
1565
- const columnGroupChildren = gridApi
1566
- // TODO AFL MIG: check why this assertion is here
1567
- .getAllDisplayedColumnGroups();
1563
+ const columnGroupChildren = gridApi.getAllDisplayedColumnGroups();
1568
1564
  const groupsCount = {};
1569
1565
  const colsToGroups = (columnGroupChildren ?? []).reduce((acc, columnGroup) => {
1570
1566
  if (!columnGroup.getProvidedColumnGroup?.()?.getColGroupDef()) {
@@ -343,8 +343,8 @@ export class AgGridColumnAdapter {
343
343
  return userGetQuickFilterText;
344
344
  }
345
345
  return (params) => {
346
- const visibleCoulmnsMap = this.adaptableApi.layoutApi.getCurrentVisibleColumnIdsMapForTableLayout();
347
- const isVisible = visibleCoulmnsMap[abColumn.columnId];
346
+ const visibleColumnsMap = this.adaptableApi.layoutApi.getCurrentVisibleColumnIdsMapForTableLayout();
347
+ const isVisible = visibleColumnsMap[abColumn.columnId];
348
348
  if (!isVisible) {
349
349
  return '';
350
350
  }
@@ -316,9 +316,13 @@ export class AgGridExportAdapter {
316
316
  // we compute the exported column keys early, as we need them for other parts of the export process
317
317
  const onlyExportableColumnIds = (columnId) => exportableColumnIdsSet.has(columnId);
318
318
  const getVisibleColumnIds = () => {
319
- return this.adaptableApi.layoutApi
320
- .getCurrentVisibleColumnIdsForTableLayout()
321
- .filter(onlyExportableColumnIds);
319
+ return this.adaptableApi.layoutApi.isCurrentLayoutPivot()
320
+ ? this.adaptableApi.layoutApi
321
+ .getCurrentVisibleColumnIdsForPivotLayout()
322
+ .filter(onlyExportableColumnIds)
323
+ : this.adaptableApi.layoutApi
324
+ .getCurrentVisibleColumnIdsForTableLayout()
325
+ .filter(onlyExportableColumnIds);
322
326
  };
323
327
  let exportedColumnIds = [];
324
328
  switch (report.ReportColumnScope) {
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: 1748524771920 || Date.now(),
4
- VERSION: "20.1.6" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1748626733832 || Date.now(),
4
+ VERSION: "20.1.8" || '--current-version--',
5
5
  };
@@ -927,14 +927,15 @@ export class LayoutManager extends LMEmitter {
927
927
  return columnState;
928
928
  }
929
929
  computePivotAggregations(layout, columnState) {
930
- const pivotAggsToIndexes = layout.PivotAggregationColumns.reduce((acc, { ColumnId }, index) => {
930
+ const PivotAggregationColumns = layout.PivotAggregationColumns || [];
931
+ const pivotAggsToIndexes = PivotAggregationColumns.reduce((acc, { ColumnId }, index) => {
931
932
  acc[ColumnId] = index;
932
933
  return acc;
933
934
  }, {});
934
935
  columnState.state = columnState.state.map((colState) => {
935
936
  const columnId = colState.colId;
936
937
  const aggIndex = pivotAggsToIndexes[columnId];
937
- const aggFunc = aggIndex != null ? layout.PivotAggregationColumns[aggIndex].AggFunc.aggFunc : null;
938
+ const aggFunc = aggIndex != null ? PivotAggregationColumns[aggIndex].AggFunc.aggFunc : null;
938
939
  return {
939
940
  ...colState,
940
941
  aggFunc: aggIndex != null ? (aggFunc === true ? DEFAULT_AGG_FUNC : aggFunc) : null,
@@ -1109,7 +1110,7 @@ export class LayoutManager extends LMEmitter {
1109
1110
  // fourth: ...etc
1110
1111
  // so we apply the states for all aggregations except the last one
1111
1112
  //
1112
- const aggregationsMapForOrder = layout.PivotAggregationColumns.map((_, index) => layout.PivotAggregationColumns.slice(0, index));
1113
+ const aggregationsMapForOrder = (layout.PivotAggregationColumns || []).map((_, index) => layout.PivotAggregationColumns.slice(0, index));
1113
1114
  aggregationsMapForOrder.forEach((agg) => {
1114
1115
  // we're mutating the columnState here
1115
1116
  this.computePivotAggregations({ ...layout, PivotAggregationColumns: agg }, columnState);
@@ -1304,7 +1305,7 @@ export class LayoutManager extends LMEmitter {
1304
1305
  };
1305
1306
  const colIdInfo = destructurePivotColumnId(colDef, {
1306
1307
  pivotColIds: this.currentLayout.PivotColumns,
1307
- aggColIds: this.currentLayout.PivotAggregationColumns.map((col) => col.ColumnId),
1308
+ aggColIds: (this.currentLayout.PivotAggregationColumns || []).map((col) => col.ColumnId),
1308
1309
  }, (message) => this.warn(message));
1309
1310
  if (colIdInfo === '!unknown!') {
1310
1311
  return defaultHiddenConfig;