@adaptabletools/adaptable-cjs 20.0.11 → 20.0.13

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.
Files changed (52) hide show
  1. package/agGrid.d.ts +3 -3
  2. package/agGrid.js +3 -3
  3. package/package.json +1 -1
  4. package/src/AdaptableOptions/ColumnOptions.d.ts +3 -3
  5. package/src/AdaptableState/Common/AdaptableColumn.d.ts +3 -3
  6. package/src/AdaptableState/Common/AdaptableColumn.js +10 -9
  7. package/src/AdaptableState/Common/AggregationColumns.d.ts +3 -2
  8. package/src/AdaptableState/Common/AggregationColumns.js +0 -3
  9. package/src/AdaptableState/LayoutState.d.ts +6 -2
  10. package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -1
  11. package/src/Api/Implementation/ColumnApiImpl.js +7 -7
  12. package/src/Api/Implementation/LayoutHelpers.js +17 -31
  13. package/src/Api/Internal/ColumnInternalApi.js +4 -4
  14. package/src/Strategy/CalculatedColumnModule.d.ts +1 -1
  15. package/src/Strategy/CellSummaryModule.d.ts +1 -1
  16. package/src/Strategy/ChartingModule.d.ts +1 -1
  17. package/src/Strategy/ColumnFilterModule.d.ts +1 -1
  18. package/src/Strategy/ColumnInfoModule.d.ts +1 -1
  19. package/src/Strategy/FlashingCellModule.d.ts +1 -1
  20. package/src/Strategy/FormatColumnModule.d.ts +1 -1
  21. package/src/Strategy/FreeTextColumnModule.d.ts +1 -1
  22. package/src/Strategy/GridInfoModule.d.ts +1 -1
  23. package/src/Strategy/LayoutModule.d.ts +1 -1
  24. package/src/Strategy/PlusMinusModule.d.ts +1 -1
  25. package/src/Strategy/SettingsPanelModule.d.ts +1 -1
  26. package/src/Strategy/StyledColumnModule.d.ts +1 -1
  27. package/src/Strategy/SystemStatusModule.d.ts +1 -1
  28. package/src/Utilities/Helpers/AdaptableHelper.d.ts +1 -0
  29. package/src/Utilities/Helpers/AdaptableHelper.js +29 -2
  30. package/src/View/Layout/Wizard/sections/PivotAggregationsSection.js +23 -23
  31. package/src/agGrid/AdaptableAgGrid.js +7 -3
  32. package/src/agGrid/AgGridAdapter.js +3 -3
  33. package/src/agGrid/AgGridColumnAdapter.js +21 -3
  34. package/src/env.js +2 -2
  35. package/src/layout-manager/src/LayoutManagerModel.d.ts +3 -3
  36. package/src/layout-manager/src/index.d.ts +5 -1
  37. package/src/layout-manager/src/index.js +48 -44
  38. package/src/layout-manager/src/isLayoutEqual.d.ts +8 -0
  39. package/src/layout-manager/src/isLayoutEqual.js +46 -3
  40. package/src/layout-manager/src/isPivotColumnTotal.d.ts +1 -0
  41. package/src/layout-manager/src/{isPivotGroupTotalColumn.js → isPivotColumnTotal.js} +3 -3
  42. package/src/layout-manager/src/isPivotGrandTotal.d.ts +2 -0
  43. package/src/layout-manager/src/isPivotGrandTotal.js +7 -0
  44. package/src/layout-manager/src/normalizeLayoutModel.js +24 -0
  45. package/src/layout-manager/src/simplifyLayoutModel.js +10 -1
  46. package/src/metamodel/adaptable.metamodel.d.ts +4 -4
  47. package/src/metamodel/adaptable.metamodel.js +1 -1
  48. package/src/types.d.ts +1 -1
  49. package/tsconfig.cjs.tsbuildinfo +1 -1
  50. package/src/layout-manager/src/isPivotGrandTotalColumn.d.ts +0 -2
  51. package/src/layout-manager/src/isPivotGrandTotalColumn.js +0 -7
  52. package/src/layout-manager/src/isPivotGroupTotalColumn.d.ts +0 -1
@@ -1,20 +1,63 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isLayoutEqual = exports.isPivotLayoutEqual = exports.isTableLayoutEqual = void 0;
3
+ exports.isLayoutEqual = exports.isPivotLayoutEqual = exports.isTableLayoutEqual = exports.logChanges = exports.getChanges = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const isEqual_1 = tslib_1.__importDefault(require("lodash/isEqual"));
6
+ const infinite_react_1 = require("@infinite-table/infinite-react");
6
7
  const isPivotLayoutModel_1 = require("./isPivotLayoutModel");
7
8
  const normalizeLayoutModel_1 = require("./normalizeLayoutModel");
9
+ const logger = (0, infinite_react_1.debug)(`LayoutManager:Diffing`);
10
+ const getChanges = (l1, l2) => {
11
+ if (!l1 || typeof l1 !== 'object' || !l2 || typeof l2 !== 'object') {
12
+ return [
13
+ {
14
+ key: 'missing',
15
+ value1: l1,
16
+ value2: l2,
17
+ },
18
+ ];
19
+ }
20
+ const k1 = Object.keys(l1);
21
+ const k2 = Object.keys(l2);
22
+ const allKeys = new Set([...k1, ...k2]);
23
+ const changes = [];
24
+ for (const key of allKeys) {
25
+ if (!(0, isEqual_1.default)(l1[key], l2[key])) {
26
+ changes.push({ key, value1: l1[key], value2: l2[key] });
27
+ }
28
+ }
29
+ return changes;
30
+ };
31
+ exports.getChanges = getChanges;
32
+ const logChanges = (l1, l2, log) => {
33
+ log = log || logger;
34
+ const changes = (0, exports.getChanges)(l1, l2);
35
+ log('---');
36
+ log('Layouts are not equal.');
37
+ log('Layout 1', l1);
38
+ log('Layout 2', l2);
39
+ log('Differences:', changes);
40
+ log('---');
41
+ };
42
+ exports.logChanges = logChanges;
8
43
  function isTableLayoutEqual(l1, l2) {
9
44
  l1 = (0, normalizeLayoutModel_1.normalizeTableLayoutModel)(l1);
10
45
  l2 = (0, normalizeLayoutModel_1.normalizeTableLayoutModel)(l2);
11
- return (0, isEqual_1.default)(l1, l2);
46
+ const res = (0, isEqual_1.default)(l1, l2);
47
+ if (!res) {
48
+ (0, exports.logChanges)(l1, l2);
49
+ }
50
+ return res;
12
51
  }
13
52
  exports.isTableLayoutEqual = isTableLayoutEqual;
14
53
  function isPivotLayoutEqual(l1, l2) {
15
54
  l1 = (0, normalizeLayoutModel_1.normalizePivotLayoutModel)(l1);
16
55
  l2 = (0, normalizeLayoutModel_1.normalizePivotLayoutModel)(l2);
17
- return (0, isEqual_1.default)(l1, l2);
56
+ const res = (0, isEqual_1.default)(l1, l2);
57
+ if (!res) {
58
+ (0, exports.logChanges)(l1, l2);
59
+ }
60
+ return res;
18
61
  }
19
62
  exports.isPivotLayoutEqual = isPivotLayoutEqual;
20
63
  function isLayoutEqual(l1, l2) {
@@ -0,0 +1 @@
1
+ export declare function isPivotColumnTotal(colId: string): boolean;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isPivotGroupTotalColumn = void 0;
4
- function isPivotGroupTotalColumn(colId) {
3
+ exports.isPivotColumnTotal = void 0;
4
+ function isPivotColumnTotal(colId) {
5
5
  // pivot group total are spanning cross all aggregations
6
6
  // therefore the last part of the colId is empty (hence the "dangling" underscore)
7
7
  return colId?.startsWith('pivot_') && colId?.endsWith('_');
8
8
  }
9
- exports.isPivotGroupTotalColumn = isPivotGroupTotalColumn;
9
+ exports.isPivotColumnTotal = isPivotColumnTotal;
@@ -0,0 +1,2 @@
1
+ import { ColDef, ColGroupDef } from 'ag-grid-enterprise';
2
+ export declare function isPivotGrandTotal(colDef: ColDef | ColGroupDef): boolean;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isPivotGrandTotal = void 0;
4
+ function isPivotGrandTotal(colDef) {
5
+ return colDef?.colId?.startsWith('PivotRowTotal_pivot_');
6
+ }
7
+ exports.isPivotGrandTotal = isPivotGrandTotal;
@@ -29,6 +29,14 @@ function normalizeTableLayoutModel(layout, options) {
29
29
  if (!layout.RowGroupedColumns) {
30
30
  layout.RowGroupedColumns = [];
31
31
  }
32
+ if (!('SuppressAggFuncInHeader' in layout)) {
33
+ // make it an own property
34
+ layout.SuppressAggFuncInHeader = undefined;
35
+ }
36
+ if (!('GrandTotalRow' in layout)) {
37
+ // make it an own property
38
+ layout.GrandTotalRow = undefined;
39
+ }
32
40
  const ColumnOrderSet = new Set(layout.TableColumns);
33
41
  if (layout.RowGroupedColumns && layout.RowGroupedColumns.length && layout.TableColumns) {
34
42
  // the layout.TableColumns might not include the group columns
@@ -136,6 +144,22 @@ function normalizePivotLayoutModel(layout) {
136
144
  RowGroupDisplay: 'always-collapsed',
137
145
  };
138
146
  }
147
+ if (!('SuppressAggFuncInHeader' in layout)) {
148
+ // make it an own property
149
+ layout.SuppressAggFuncInHeader = undefined;
150
+ }
151
+ if (!('GrandTotalRow' in layout)) {
152
+ // make it an own property
153
+ layout.GrandTotalRow = undefined;
154
+ }
155
+ if (!('PivotGrandTotal' in layout)) {
156
+ // make it an own property
157
+ layout.PivotGrandTotal = undefined;
158
+ }
159
+ if (!('PivotColumnTotal' in layout)) {
160
+ // make it an own property
161
+ layout.PivotColumnTotal = undefined;
162
+ }
139
163
  return layout;
140
164
  }
141
165
  exports.normalizePivotLayoutModel = normalizePivotLayoutModel;
@@ -56,7 +56,7 @@ function simplifyTableLayoutModel(layout) {
56
56
  });
57
57
  layout.RowGroupDisplayType = displayType;
58
58
  }
59
- if (!layout.GrandTotalRow) {
59
+ if (layout.GrandTotalRow === undefined) {
60
60
  delete layout.GrandTotalRow;
61
61
  }
62
62
  return layout;
@@ -79,6 +79,15 @@ function simplifyPivotLayoutModel(layout) {
79
79
  if (!layout.PivotGroupedColumns && layout.RowGroupValues) {
80
80
  delete layout.RowGroupValues;
81
81
  }
82
+ if (layout.GrandTotalRow === undefined) {
83
+ delete layout.GrandTotalRow;
84
+ }
85
+ if (layout.PivotColumnTotal === undefined) {
86
+ delete layout.PivotColumnTotal;
87
+ }
88
+ if (layout.PivotGrandTotal === undefined) {
89
+ delete layout.PivotGrandTotal;
90
+ }
82
91
  return layout;
83
92
  }
84
93
  exports.simplifyPivotLayoutModel = simplifyPivotLayoutModel;
@@ -4382,18 +4382,18 @@ export declare const ADAPTABLE_METAMODEL: {
4382
4382
  kind: string;
4383
4383
  desc: string;
4384
4384
  isOpt: boolean;
4385
- ref?: undefined;
4385
+ ref: string;
4386
4386
  } | {
4387
4387
  name: string;
4388
4388
  kind: string;
4389
4389
  desc: string;
4390
- isOpt: boolean;
4391
- ref: string;
4390
+ isOpt?: undefined;
4391
+ ref?: undefined;
4392
4392
  } | {
4393
4393
  name: string;
4394
4394
  kind: string;
4395
4395
  desc: string;
4396
- isOpt?: undefined;
4396
+ isOpt: boolean;
4397
4397
  ref?: undefined;
4398
4398
  })[];
4399
4399
  };