@adaptabletools/adaptable 20.0.7-canary.2 → 20.0.7-canary.3

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.0.7-canary.2",
3
+ "version": "20.0.7-canary.3",
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",
@@ -187,6 +187,10 @@ export interface AdaptableColumn<TData = any> extends AdaptableColumnBase {
187
187
  * Is Column an Action Column
188
188
  */
189
189
  isActionColumn: boolean;
190
+ /**
191
+ * Is Column a Pivot Total Column (GrandTotal, GroupTotal, AggregationTotal)
192
+ */
193
+ isPivotTotalColumn: boolean;
190
194
  }
191
195
  export interface AdaptableColumnProperties {
192
196
  sortable: boolean;
@@ -74,6 +74,10 @@ export interface LayoutBase extends AdaptableObject {
74
74
  * Whether Columns should autosize when Layout first loads
75
75
  */
76
76
  AutoSizeColumns?: boolean;
77
+ /**
78
+ * Display Grand Total Row at the top or bottom of the Table/Pivot
79
+ */
80
+ GrandTotalRow?: 'top' | 'bottom' | boolean;
77
81
  }
78
82
  /**
79
83
  * Defines a Table-based Layout
@@ -148,10 +152,6 @@ export interface PivotLayout extends LayoutBase {
148
152
  * Row Grouped Columns Columns - must NOT be provided
149
153
  */
150
154
  RowGroupedColumns?: never;
151
- /**
152
- * Display Grand Total Row at the top or bottom of the Pivot Table
153
- */
154
- GrandTotalRow?: 'top' | 'bottom' | boolean;
155
155
  /**
156
156
  * Display automatically calculated Totals of all Pivot Columns, in the position specified
157
157
  */
@@ -52,6 +52,7 @@ const ROW_GROUP_COLUMN_DEFAULTS = {
52
52
  isCalculatedColumn: false,
53
53
  isFreeTextColumn: false,
54
54
  isActionColumn: false,
55
+ isPivotTotalColumn: false,
55
56
  };
56
57
  export function generateAutoRowGroupSingleColumn() {
57
58
  return {
@@ -91,13 +92,15 @@ export function getFriendlyNameForPivotResultColumn(columnId, agGridApi) {
91
92
  .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
92
93
  .join(' ')}`;
93
94
  }
94
- if (isPivotAggregationTotalColumn(columnId, agGridApi)) {
95
- return `[Aggregation Total] ${columnId
96
- .split('_')
97
- .slice(2)
98
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
99
- .join(' ')}`;
100
- }
95
+ // is quite consuming on performance
96
+ // we don't need it anyway because currently (20.0.7) we don't display Pivot Totals at all
97
+ // if (isPivotAggregationTotalColumn(columnId, agGridApi)) {
98
+ // return `[Aggregation Total] ${columnId
99
+ // .split('_')
100
+ // .slice(2)
101
+ // .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
102
+ // .join(' ')}`;
103
+ // }
101
104
  return `[Pivot] ${columnId
102
105
  .split('_')
103
106
  .slice(1)
@@ -128,7 +131,9 @@ export class ColumnApiImpl extends ApiBase {
128
131
  return cols ?? [];
129
132
  }
130
133
  getUIAvailableColumns() {
131
- return this.getColumns().filter((c) => !c.alwaysHidden);
134
+ return this.getColumns().filter((c) => !c.alwaysHidden &&
135
+ // currently (20.0.7) we don't display Pivot Totals in UI
136
+ !c.isPivotTotalColumn);
132
137
  }
133
138
  getVisibleColumns() {
134
139
  const layout = this.getLayoutApi().getCurrentLayout();
@@ -172,6 +172,7 @@ export const tableLayoutToTableLayoutModel = (tableLayout) => {
172
172
  }
173
173
  : undefined,
174
174
  TableAggregationColumns: TableAggregationColumns,
175
+ GrandTotalRow: tableLayout.GrandTotalRow,
175
176
  });
176
177
  if (tableLayout.RowGroupDisplayType) {
177
178
  result.RowGroupDisplayType = tableLayout.RowGroupDisplayType;
@@ -281,6 +282,12 @@ export const tableLayoutModelToTableLayout = (layoutModel, defaults) => {
281
282
  else {
282
283
  delete tableLayout.TableAggregationColumns;
283
284
  }
285
+ if (layoutModel.GrandTotalRow) {
286
+ tableLayout.GrandTotalRow = layoutModel.GrandTotalRow;
287
+ }
288
+ else {
289
+ delete tableLayout.GrandTotalRow;
290
+ }
284
291
  if (layoutModel.ColumnFilters) {
285
292
  tableLayout.ColumnFilters = layoutModel.ColumnFilters;
286
293
  }
@@ -10,6 +10,8 @@ import { ValueSelector } from '../../../Components/ValueSelector';
10
10
  import { useOnePageAdaptableWizardContext } from '../../../Wizard/OnePageAdaptableWizard';
11
11
  import { columnFilter } from './Utilities';
12
12
  import ArrayExtensions from '../../../../Utilities/Extensions/ArrayExtensions';
13
+ import { Select } from '../../../../components/Select';
14
+ import StringExtensions from '../../../../Utilities/Extensions/StringExtensions';
13
15
  const WEIGHTED_AVERAGE_AGG_FN_NAME = 'weightedAvg';
14
16
  export const isAggregationsSectionValid = (data) => {
15
17
  const weightedAvg = data.TableAggregationColumns
@@ -190,7 +192,20 @@ export const AggregationsSection = (props) => {
190
192
  React.createElement(Tabs.Content, null,
191
193
  React.createElement(Flex, null,
192
194
  React.createElement(FormLayout, null,
193
- React.createElement(CheckBox, { checked: layout.SuppressAggFuncInHeader, onChange: handleSuppressAggFuncInHeader }, "Omit Aggregation Function from Header"))),
195
+ React.createElement(FormRow, { label: 'Omit Aggregation from Header' },
196
+ React.createElement(CheckBox, { checked: layout.SuppressAggFuncInHeader, onChange: handleSuppressAggFuncInHeader })),
197
+ React.createElement(FormRow, { label: 'Grand Total Row' },
198
+ React.createElement(Select, { style: { width: 120 }, options: ['top', 'bottom'].map((position) => {
199
+ return {
200
+ label: StringExtensions.CapitaliseFirstLetter(position),
201
+ value: position,
202
+ };
203
+ }), placeholder: "Off", value: layout.GrandTotalRow, onChange: (value) => {
204
+ props.onChange({
205
+ ...layout,
206
+ GrandTotalRow: value,
207
+ });
208
+ }, isClearable: true })))),
194
209
  React.createElement(ValueSelector, { showFilterInput: true, showSelectedOnlyPosition: "top", filter: columnFilter, toIdentifier: (option) => `${option.columnId}`, toLabel: (option) => option.friendlyName ?? option.columnId, toListLabel: (column) => (React.createElement(ColumnRow, { onChangeAggFunction: handleAggregationChange, layout: layout, column: column, aggregationColumnsMap: aggregationColumnsMap, numberColumns: numberColumns })), options: sortedAggregableColumns, value: (layout.TableAggregationColumns || []).map((agg) => agg.ColumnId), allowReorder: () => true, xSelectedLabel: () => {
195
210
  return `Active aggregations:`;
196
211
  }, onChange: handleColumnsSelectionChange }))));
@@ -332,6 +332,7 @@ export declare class AdaptableAgGrid implements IAdaptable {
332
332
  private filterOnDataChange;
333
333
  refreshLayout(): void;
334
334
  private isRowGroupDifferentInLayout;
335
+ private hasPivotTotalsInLayout;
335
336
  private onLayoutChange;
336
337
  private validateColumnDefTypes;
337
338
  }
@@ -3313,13 +3313,21 @@ You need to define at least one Layout!`);
3313
3313
  }
3314
3314
  return prevRowGroupedColumns.join(',') !== currentRowGroupedColumns.join(',');
3315
3315
  }
3316
+ hasPivotTotalsInLayout(one, other) {
3317
+ const prevAggregationColumns = one.PivotAggregationColumns || [];
3318
+ const currentAggregationColumns = other.PivotAggregationColumns || [];
3319
+ const prevHasPivotTotals = prevAggregationColumns.some((col) => !!col.TotalColumn);
3320
+ const currentHasPivotTotals = currentAggregationColumns.some((col) => !!col.TotalColumn);
3321
+ return prevHasPivotTotals || currentHasPivotTotals;
3322
+ }
3316
3323
  onLayoutChange(layout) {
3317
3324
  this.logger.info('onLayoutChange()');
3318
3325
  const prevOnChangeLayout = this.__prevLayoutForOnChange || this.api.layoutApi.getCurrentLayout();
3319
3326
  // see #on-regroup-expect-group-column-to-be-recomputed-and-setup-properly
3320
3327
  const rowGroupsChanged = this.isRowGroupDifferentInLayout(prevOnChangeLayout, layout);
3328
+ const hasPivotTotalsInLayout = this.hasPivotTotalsInLayout(prevOnChangeLayout, layout);
3321
3329
  const pivotColsChanged = JSON.stringify(layout.PivotColumns) !== JSON.stringify(prevOnChangeLayout.PivotColumns);
3322
- if (rowGroupsChanged || pivotColsChanged) {
3330
+ if (rowGroupsChanged || pivotColsChanged || hasPivotTotalsInLayout) {
3323
3331
  this.updateColumnModelAndRefreshGrid();
3324
3332
  }
3325
3333
  else {
@@ -63,6 +63,7 @@ export declare class AgGridAdapter {
63
63
  private isCalculatedColumn;
64
64
  private isFreeTextColumn;
65
65
  private isActionColumn;
66
+ private isPivotTotalColumn;
66
67
  private isColumnFilterable;
67
68
  private getColumnTypes;
68
69
  private getColumnPinnedPosition;
@@ -1,11 +1,14 @@
1
1
  import { ColumnApiModule, } from 'ag-grid-enterprise';
2
2
  import { ACTION_COLUMN_TYPE, CALCULATED_COLUMN_TYPE, FDC3_COLUMN_TYPE, FREE_TEXT_COLUMN_TYPE, } from '../AdaptableState/Common/AdaptableColumn';
3
- import { ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME, } from '../Utilities/Constants/GeneralConstants';
3
+ import { ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME } from '../Utilities/Constants/GeneralConstants';
4
4
  import { createUuid } from '../AdaptableState/Uuid';
5
5
  import ArrayExtensions from '../Utilities/Extensions/ArrayExtensions';
6
6
  import * as ModuleConstants from '../Utilities/Constants/ModuleConstants';
7
7
  import { ALL_AG_GRID_MODULES } from './agGridModules';
8
8
  import { agGridDataTypeDefinitions, ALL_ADAPTABLE_DATA_TYPES } from './agGridDataTypeDefinitions';
9
+ import { isPivotGrandTotalColumn } from '../Api/Implementation/ColumnApiImpl';
10
+ import { isPivotGroupTotalColumn } from '../layout-manager/src/isPivotGroupTotalColumn';
11
+ import { isPivotAggTotalColumn } from '../layout-manager/src/isPivotAggTotalColumn';
9
12
  // AG GRID obfuscates its internals, this is (currently) the best way to get hold of its internal services
10
13
  const DANGER_AG_GRID_BEANS_MAP = {};
11
14
  const getColumnApiModule = () => ColumnApiModule;
@@ -432,6 +435,7 @@ export class AgGridAdapter {
432
435
  isCalculatedColumn: this.isCalculatedColumn(colDef),
433
436
  isFreeTextColumn: this.isFreeTextColumn(colDef),
434
437
  isActionColumn: this.isActionColumn(colDef),
438
+ isPivotTotalColumn: this.isPivotTotalColumn(colDef),
435
439
  };
436
440
  abColumn.queryable = this.isColumnQueryable(abColumn);
437
441
  abColumn.exportable = this.isColumnExportable(abColumn);
@@ -605,6 +609,11 @@ export class AgGridAdapter {
605
609
  isActionColumn(colDef) {
606
610
  return this.adaptableApi.actionColumnApi.getActionColumnForColumnId(colDef.colId) != null;
607
611
  }
612
+ isPivotTotalColumn(colDef) {
613
+ return (isPivotGrandTotalColumn(colDef.colId) ||
614
+ isPivotGroupTotalColumn(colDef.colId) ||
615
+ isPivotAggTotalColumn(colDef));
616
+ }
608
617
  isColumnFilterable(colDef) {
609
618
  // follow agGrid logic which is that ONLY filterable if explicitly set
610
619
  if (this.adaptableApi.entitlementApi.getEntitlementAccessLevelForModule(ModuleConstants.ColumnFilterModuleId) == 'Hidden') {
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: 1745834803008 || Date.now(),
4
- VERSION: "20.0.7-canary.2" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1745852629865 || Date.now(),
4
+ VERSION: "20.0.7-canary.3" || '--current-version--',
5
5
  };
@@ -57,6 +57,10 @@ export interface BaseLayoutModel {
57
57
  ColumnPinning?: {
58
58
  [columnId: string]: 'left' | 'right';
59
59
  };
60
+ /**
61
+ * Display Grand Total Row at the top or bottom of the Pivot Table
62
+ */
63
+ GrandTotalRow?: 'top' | 'bottom' | boolean;
60
64
  }
61
65
  export type ColumnAggregationModel = {
62
66
  aggFunc: string | true;
@@ -109,10 +113,6 @@ export interface PivotLayoutModel extends BaseLayoutModel {
109
113
  */
110
114
  PivotGroupedColumns?: string[];
111
115
  RowGroupedColumns?: never;
112
- /**
113
- * Display Grand Total Row at the top or bottom of the Pivot Table
114
- */
115
- GrandTotalRow?: 'top' | 'bottom' | boolean;
116
116
  /**
117
117
  * Display Total of all Pivot Columns before or after the Pivot Columns
118
118
  */
@@ -258,12 +258,9 @@ export class LayoutManager extends LMEmitter {
258
258
  RowGroupValues: layout.RowGroupValues,
259
259
  PivotGroupedColumns: layout.RowGroupedColumns,
260
260
  PivotAggregationColumns: layout.TableAggregationColumns,
261
+ GrandTotalRow: layout.GrandTotalRow,
261
262
  PivotExpandLevel: prevLayout?.PivotExpandLevel ?? -1,
262
263
  };
263
- const grandTotalRow = this.gridApi.getGridOption('grandTotalRow');
264
- if (grandTotalRow) {
265
- pivotLayout.GrandTotalRow = grandTotalRow;
266
- }
267
264
  const grandTotalColumn = this.gridApi.getGridOption('pivotRowTotals');
268
265
  if (grandTotalColumn) {
269
266
  pivotLayout.GrandTotalColumn = grandTotalColumn;
@@ -445,6 +442,7 @@ export class LayoutManager extends LMEmitter {
445
442
  }
446
443
  }
447
444
  }
445
+ const grandTotalRow = this.gridApi.getGridOption('grandTotalRow');
448
446
  const layout = simplifyTableLayoutModel({
449
447
  TableColumns: TableColumns,
450
448
  ColumnVisibility,
@@ -454,6 +452,7 @@ export class LayoutManager extends LMEmitter {
454
452
  TableAggregationColumns,
455
453
  ColumnPinning: ColumnPinning,
456
454
  RowGroupValues,
455
+ GrandTotalRow: grandTotalRow,
457
456
  });
458
457
  return layout;
459
458
  }
@@ -692,6 +691,17 @@ export class LayoutManager extends LMEmitter {
692
691
  // @ts-ignore
693
692
  this.gridApi.setGridOption('suppressAggFuncInHeader', layout.SuppressAggFuncInHeader);
694
693
  }
694
+ if (layout.GrandTotalRow) {
695
+ const grandTotalRow = layout.GrandTotalRow === true || layout.GrandTotalRow === 'top'
696
+ ? 'top'
697
+ : layout.GrandTotalRow === 'bottom'
698
+ ? 'bottom'
699
+ : null;
700
+ this.gridApi.setGridOption('grandTotalRow', grandTotalRow);
701
+ }
702
+ else {
703
+ this.gridApi.setGridOption('grandTotalRow', null);
704
+ }
695
705
  if (isPivotLayoutModel(layout)) {
696
706
  try {
697
707
  const perfApplyPivot = this.beginPerf('applyLayout:pivot');
@@ -1035,17 +1045,7 @@ export class LayoutManager extends LMEmitter {
1035
1045
  /**
1036
1046
  * GrandTotalRow
1037
1047
  */
1038
- if (layout.GrandTotalRow) {
1039
- const grandTotalRow = layout.GrandTotalRow === true || layout.GrandTotalRow === 'top'
1040
- ? 'top'
1041
- : layout.GrandTotalRow === 'bottom'
1042
- ? 'bottom'
1043
- : null;
1044
- this.gridApi.setGridOption('grandTotalRow', grandTotalRow);
1045
- }
1046
- else {
1047
- this.gridApi.setGridOption('grandTotalRow', null);
1048
- }
1048
+ // is common to both Table and Pivot and is applied in applyLayout()
1049
1049
  /**
1050
1050
  * GrandTotalColumn
1051
1051
  */
@@ -139,9 +139,6 @@ export function normalizePivotLayoutModel(layout) {
139
139
  // make it an own property
140
140
  layout.SuppressAggFuncInHeader = undefined;
141
141
  }
142
- if (!layout.GrandTotalRow) {
143
- layout.GrandTotalRow = false;
144
- }
145
142
  return layout;
146
143
  }
147
144
  export function normalizeLayoutModel(layout, options) {
@@ -53,6 +53,9 @@ export function simplifyTableLayoutModel(layout) {
53
53
  });
54
54
  layout.RowGroupDisplayType = displayType;
55
55
  }
56
+ if (!layout.GrandTotalRow) {
57
+ delete layout.GrandTotalRow;
58
+ }
56
59
  return layout;
57
60
  }
58
61
  export function simplifyPivotLayoutModel(layout) {
@@ -314,6 +314,11 @@ export declare const ADAPTABLE_METAMODEL: {
314
314
  isOpt: boolean;
315
315
  }[];
316
316
  };
317
+ AdaptableColumnType: {
318
+ name: string;
319
+ kind: string;
320
+ desc: string;
321
+ };
317
322
  AdaptableComment: {
318
323
  name: string;
319
324
  kind: string;
@@ -920,11 +925,6 @@ export declare const ADAPTABLE_METAMODEL: {
920
925
  desc: string;
921
926
  }[];
922
927
  };
923
- AdaptableSpecialColumnType: {
924
- name: string;
925
- kind: string;
926
- desc: string;
927
- };
928
928
  AdaptableState: {
929
929
  name: string;
930
930
  kind: string;