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

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": "20.0.7-canary.2",
3
+ "version": "20.0.7",
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
  */
@@ -57,6 +57,7 @@ const ROW_GROUP_COLUMN_DEFAULTS = {
57
57
  isCalculatedColumn: false,
58
58
  isFreeTextColumn: false,
59
59
  isActionColumn: false,
60
+ isPivotTotalColumn: false,
60
61
  };
61
62
  function generateAutoRowGroupSingleColumn() {
62
63
  return {
@@ -99,13 +100,15 @@ function getFriendlyNameForPivotResultColumn(columnId, agGridApi) {
99
100
  .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
100
101
  .join(' ')}`;
101
102
  }
102
- if (isPivotAggregationTotalColumn(columnId, agGridApi)) {
103
- return `[Aggregation Total] ${columnId
104
- .split('_')
105
- .slice(2)
106
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
107
- .join(' ')}`;
108
- }
103
+ // is quite consuming on performance
104
+ // we don't need it anyway because currently (20.0.7) we don't display Pivot Totals at all
105
+ // if (isPivotAggregationTotalColumn(columnId, agGridApi)) {
106
+ // return `[Aggregation Total] ${columnId
107
+ // .split('_')
108
+ // .slice(2)
109
+ // .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
110
+ // .join(' ')}`;
111
+ // }
109
112
  return `[Pivot] ${columnId
110
113
  .split('_')
111
114
  .slice(1)
@@ -139,7 +142,9 @@ class ColumnApiImpl extends ApiBase_1.ApiBase {
139
142
  return cols ?? [];
140
143
  }
141
144
  getUIAvailableColumns() {
142
- return this.getColumns().filter((c) => !c.alwaysHidden);
145
+ return this.getColumns().filter((c) => !c.alwaysHidden &&
146
+ // currently (20.0.7) we don't display Pivot Totals in UI
147
+ !c.isPivotTotalColumn);
143
148
  }
144
149
  getVisibleColumns() {
145
150
  const layout = this.getLayoutApi().getCurrentLayout();
@@ -183,6 +183,7 @@ const tableLayoutToTableLayoutModel = (tableLayout) => {
183
183
  }
184
184
  : undefined,
185
185
  TableAggregationColumns: TableAggregationColumns,
186
+ GrandTotalRow: tableLayout.GrandTotalRow,
186
187
  });
187
188
  if (tableLayout.RowGroupDisplayType) {
188
189
  result.RowGroupDisplayType = tableLayout.RowGroupDisplayType;
@@ -294,6 +295,12 @@ const tableLayoutModelToTableLayout = (layoutModel, defaults) => {
294
295
  else {
295
296
  delete tableLayout.TableAggregationColumns;
296
297
  }
298
+ if (layoutModel.GrandTotalRow) {
299
+ tableLayout.GrandTotalRow = layoutModel.GrandTotalRow;
300
+ }
301
+ else {
302
+ delete tableLayout.GrandTotalRow;
303
+ }
297
304
  if (layoutModel.ColumnFilters) {
298
305
  tableLayout.ColumnFilters = layoutModel.ColumnFilters;
299
306
  }
@@ -14,6 +14,8 @@ const ValueSelector_1 = require("../../../Components/ValueSelector");
14
14
  const OnePageAdaptableWizard_1 = require("../../../Wizard/OnePageAdaptableWizard");
15
15
  const Utilities_1 = require("./Utilities");
16
16
  const ArrayExtensions_1 = tslib_1.__importDefault(require("../../../../Utilities/Extensions/ArrayExtensions"));
17
+ const Select_1 = require("../../../../components/Select");
18
+ const StringExtensions_1 = tslib_1.__importDefault(require("../../../../Utilities/Extensions/StringExtensions"));
17
19
  const WEIGHTED_AVERAGE_AGG_FN_NAME = 'weightedAvg';
18
20
  const isAggregationsSectionValid = (data) => {
19
21
  const weightedAvg = data.TableAggregationColumns
@@ -196,7 +198,20 @@ const AggregationsSection = (props) => {
196
198
  React.createElement(Tabs_1.Tabs.Content, null,
197
199
  React.createElement(rebass_1.Flex, null,
198
200
  React.createElement(FormLayout_1.default, null,
199
- React.createElement(CheckBox_1.CheckBox, { checked: layout.SuppressAggFuncInHeader, onChange: handleSuppressAggFuncInHeader }, "Omit Aggregation Function from Header"))),
201
+ React.createElement(FormLayout_1.FormRow, { label: 'Omit Aggregation from Header' },
202
+ React.createElement(CheckBox_1.CheckBox, { checked: layout.SuppressAggFuncInHeader, onChange: handleSuppressAggFuncInHeader })),
203
+ React.createElement(FormLayout_1.FormRow, { label: 'Grand Total Row' },
204
+ React.createElement(Select_1.Select, { style: { width: 120 }, options: ['top', 'bottom'].map((position) => {
205
+ return {
206
+ label: StringExtensions_1.default.CapitaliseFirstLetter(position),
207
+ value: position,
208
+ };
209
+ }), placeholder: "Off", value: layout.GrandTotalRow, onChange: (value) => {
210
+ props.onChange({
211
+ ...layout,
212
+ GrandTotalRow: value,
213
+ });
214
+ }, isClearable: true })))),
200
215
  React.createElement(ValueSelector_1.ValueSelector, { showFilterInput: true, showSelectedOnlyPosition: "top", filter: Utilities_1.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: () => {
201
216
  return `Active aggregations:`;
202
217
  }, 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
  }
@@ -3317,13 +3317,21 @@ You need to define at least one Layout!`);
3317
3317
  }
3318
3318
  return prevRowGroupedColumns.join(',') !== currentRowGroupedColumns.join(',');
3319
3319
  }
3320
+ hasPivotTotalsInLayout(one, other) {
3321
+ const prevAggregationColumns = one.PivotAggregationColumns || [];
3322
+ const currentAggregationColumns = other.PivotAggregationColumns || [];
3323
+ const prevHasPivotTotals = prevAggregationColumns.some((col) => !!col.TotalColumn);
3324
+ const currentHasPivotTotals = currentAggregationColumns.some((col) => !!col.TotalColumn);
3325
+ return prevHasPivotTotals || currentHasPivotTotals;
3326
+ }
3320
3327
  onLayoutChange(layout) {
3321
3328
  this.logger.info('onLayoutChange()');
3322
3329
  const prevOnChangeLayout = this.__prevLayoutForOnChange || this.api.layoutApi.getCurrentLayout();
3323
3330
  // see #on-regroup-expect-group-column-to-be-recomputed-and-setup-properly
3324
3331
  const rowGroupsChanged = this.isRowGroupDifferentInLayout(prevOnChangeLayout, layout);
3332
+ const hasPivotTotalsInLayout = this.hasPivotTotalsInLayout(prevOnChangeLayout, layout);
3325
3333
  const pivotColsChanged = JSON.stringify(layout.PivotColumns) !== JSON.stringify(prevOnChangeLayout.PivotColumns);
3326
- if (rowGroupsChanged || pivotColsChanged) {
3334
+ if (rowGroupsChanged || pivotColsChanged || hasPivotTotalsInLayout) {
3327
3335
  this.updateColumnModelAndRefreshGrid();
3328
3336
  }
3329
3337
  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;
@@ -10,6 +10,9 @@ const ArrayExtensions_1 = tslib_1.__importDefault(require("../Utilities/Extensio
10
10
  const ModuleConstants = tslib_1.__importStar(require("../Utilities/Constants/ModuleConstants"));
11
11
  const agGridModules_1 = require("./agGridModules");
12
12
  const agGridDataTypeDefinitions_1 = require("./agGridDataTypeDefinitions");
13
+ const ColumnApiImpl_1 = require("../Api/Implementation/ColumnApiImpl");
14
+ const isPivotGroupTotalColumn_1 = require("../layout-manager/src/isPivotGroupTotalColumn");
15
+ const isPivotAggTotalColumn_1 = require("../layout-manager/src/isPivotAggTotalColumn");
13
16
  // AG GRID obfuscates its internals, this is (currently) the best way to get hold of its internal services
14
17
  const DANGER_AG_GRID_BEANS_MAP = {};
15
18
  const getColumnApiModule = () => ag_grid_enterprise_1.ColumnApiModule;
@@ -436,6 +439,7 @@ class AgGridAdapter {
436
439
  isCalculatedColumn: this.isCalculatedColumn(colDef),
437
440
  isFreeTextColumn: this.isFreeTextColumn(colDef),
438
441
  isActionColumn: this.isActionColumn(colDef),
442
+ isPivotTotalColumn: this.isPivotTotalColumn(colDef),
439
443
  };
440
444
  abColumn.queryable = this.isColumnQueryable(abColumn);
441
445
  abColumn.exportable = this.isColumnExportable(abColumn);
@@ -609,6 +613,11 @@ class AgGridAdapter {
609
613
  isActionColumn(colDef) {
610
614
  return this.adaptableApi.actionColumnApi.getActionColumnForColumnId(colDef.colId) != null;
611
615
  }
616
+ isPivotTotalColumn(colDef) {
617
+ return ((0, ColumnApiImpl_1.isPivotGrandTotalColumn)(colDef.colId) ||
618
+ (0, isPivotGroupTotalColumn_1.isPivotGroupTotalColumn)(colDef.colId) ||
619
+ (0, isPivotAggTotalColumn_1.isPivotAggTotalColumn)(colDef));
620
+ }
612
621
  isColumnFilterable(colDef) {
613
622
  // follow agGrid logic which is that ONLY filterable if explicitly set
614
623
  if (this.adaptableApi.entitlementApi.getEntitlementAccessLevelForModule(ModuleConstants.ColumnFilterModuleId) == 'Hidden') {
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: 1745834831422 || Date.now(),
6
- VERSION: "20.0.7-canary.2" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1745854148582 || Date.now(),
6
+ VERSION: "20.0.7" || '--current-version--',
7
7
  };
@@ -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
  */
@@ -261,12 +261,9 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
261
261
  RowGroupValues: layout.RowGroupValues,
262
262
  PivotGroupedColumns: layout.RowGroupedColumns,
263
263
  PivotAggregationColumns: layout.TableAggregationColumns,
264
+ GrandTotalRow: layout.GrandTotalRow,
264
265
  PivotExpandLevel: prevLayout?.PivotExpandLevel ?? -1,
265
266
  };
266
- const grandTotalRow = this.gridApi.getGridOption('grandTotalRow');
267
- if (grandTotalRow) {
268
- pivotLayout.GrandTotalRow = grandTotalRow;
269
- }
270
267
  const grandTotalColumn = this.gridApi.getGridOption('pivotRowTotals');
271
268
  if (grandTotalColumn) {
272
269
  pivotLayout.GrandTotalColumn = grandTotalColumn;
@@ -448,6 +445,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
448
445
  }
449
446
  }
450
447
  }
448
+ const grandTotalRow = this.gridApi.getGridOption('grandTotalRow');
451
449
  const layout = (0, simplifyLayoutModel_1.simplifyTableLayoutModel)({
452
450
  TableColumns: TableColumns,
453
451
  ColumnVisibility,
@@ -457,6 +455,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
457
455
  TableAggregationColumns,
458
456
  ColumnPinning: ColumnPinning,
459
457
  RowGroupValues,
458
+ GrandTotalRow: grandTotalRow,
460
459
  });
461
460
  return layout;
462
461
  }
@@ -695,6 +694,17 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
695
694
  // @ts-ignore
696
695
  this.gridApi.setGridOption('suppressAggFuncInHeader', layout.SuppressAggFuncInHeader);
697
696
  }
697
+ if (layout.GrandTotalRow) {
698
+ const grandTotalRow = layout.GrandTotalRow === true || layout.GrandTotalRow === 'top'
699
+ ? 'top'
700
+ : layout.GrandTotalRow === 'bottom'
701
+ ? 'bottom'
702
+ : null;
703
+ this.gridApi.setGridOption('grandTotalRow', grandTotalRow);
704
+ }
705
+ else {
706
+ this.gridApi.setGridOption('grandTotalRow', null);
707
+ }
698
708
  if ((0, isPivotLayoutModel_1.isPivotLayoutModel)(layout)) {
699
709
  try {
700
710
  const perfApplyPivot = this.beginPerf('applyLayout:pivot');
@@ -1038,17 +1048,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
1038
1048
  /**
1039
1049
  * GrandTotalRow
1040
1050
  */
1041
- if (layout.GrandTotalRow) {
1042
- const grandTotalRow = layout.GrandTotalRow === true || layout.GrandTotalRow === 'top'
1043
- ? 'top'
1044
- : layout.GrandTotalRow === 'bottom'
1045
- ? 'bottom'
1046
- : null;
1047
- this.gridApi.setGridOption('grandTotalRow', grandTotalRow);
1048
- }
1049
- else {
1050
- this.gridApi.setGridOption('grandTotalRow', null);
1051
- }
1051
+ // is common to both Table and Pivot and is applied in applyLayout()
1052
1052
  /**
1053
1053
  * GrandTotalColumn
1054
1054
  */
@@ -144,9 +144,6 @@ function normalizePivotLayoutModel(layout) {
144
144
  // make it an own property
145
145
  layout.SuppressAggFuncInHeader = undefined;
146
146
  }
147
- if (!layout.GrandTotalRow) {
148
- layout.GrandTotalRow = false;
149
- }
150
147
  return layout;
151
148
  }
152
149
  exports.normalizePivotLayoutModel = normalizePivotLayoutModel;
@@ -56,6 +56,9 @@ function simplifyTableLayoutModel(layout) {
56
56
  });
57
57
  layout.RowGroupDisplayType = displayType;
58
58
  }
59
+ if (!layout.GrandTotalRow) {
60
+ delete layout.GrandTotalRow;
61
+ }
59
62
  return layout;
60
63
  }
61
64
  exports.simplifyTableLayoutModel = simplifyTableLayoutModel;
@@ -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;