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

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.7",
3
+ "version": "21.0.9-canary.0",
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",
@@ -54,6 +54,7 @@
54
54
  "react-select": "5.10.1",
55
55
  "react-toastify": "9.1.3",
56
56
  "rebass": "^3.2.2",
57
+ "@types/rebass": "^4.0.10",
57
58
  "redux": "^5.0.1",
58
59
  "rxjs": "^7.4.0",
59
60
  "sentence-case": "^3.0.4",
@@ -5,8 +5,6 @@ import { BaseState } from '../../AdaptableState/BaseState';
5
5
  import { IAdaptableStore, LoadStoreConfig } from './Interface/IAdaptableStore';
6
6
  type EmitterCallback = (data?: any) => any;
7
7
  type EmitterAnyCallback = (eventName: string, data?: any) => any;
8
- export declare const INIT_STATE = "INIT_STATE";
9
- export declare const LOAD_STATE = "LOAD_STATE";
10
8
  export interface ResetUserDataAction extends Redux.Action {
11
9
  }
12
10
  export interface InitStateAction extends Redux.Action {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AdaptableStore = exports.LoadState = exports.InitState = exports.LOAD_STATE = exports.INIT_STATE = void 0;
3
+ exports.AdaptableStore = exports.LoadState = exports.InitState = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const Redux = tslib_1.__importStar(require("redux"));
6
6
  const PluginsRedux = tslib_1.__importStar(require("../ActionsReducers/PluginsRedux"));
@@ -44,13 +44,13 @@ const ThemeRedux = tslib_1.__importStar(require("../ActionsReducers/ThemeRedux")
44
44
  const ToolPanelRedux = tslib_1.__importStar(require("../ActionsReducers/ToolPanelRedux"));
45
45
  const TeamSharingState_1 = require("../../AdaptableState/TeamSharingState");
46
46
  const buildAdaptableStateFunctionConfig_1 = require("./buildAdaptableStateFunctionConfig");
47
- exports.INIT_STATE = 'INIT_STATE';
48
- exports.LOAD_STATE = 'LOAD_STATE';
47
+ const INIT_STATE = 'INIT_STATE';
48
+ const LOAD_STATE = 'LOAD_STATE';
49
49
  const NON_PERSIST_ACTIONS = {
50
50
  '@@INIT': true,
51
51
  '@@redux/init': true,
52
- [exports.LOAD_STATE]: true,
53
- [exports.INIT_STATE]: true,
52
+ [LOAD_STATE]: true,
53
+ [INIT_STATE]: true,
54
54
  // progress indicators should NOT interfere with state management as it may lead to race conditions due to load/persist state being async
55
55
  [PopupRedux_1.PROGRESS_INDICATOR_SHOW]: true,
56
56
  [PopupRedux_1.PROGRESS_INDICATOR_HIDE]: true,
@@ -62,11 +62,11 @@ const NON_PERSISTENT_STORE_KEYS = [
62
62
  'Plugins',
63
63
  ];
64
64
  const InitState = () => ({
65
- type: exports.INIT_STATE,
65
+ type: INIT_STATE,
66
66
  });
67
67
  exports.InitState = InitState;
68
68
  const LoadState = (State) => ({
69
- type: exports.LOAD_STATE,
69
+ type: LOAD_STATE,
70
70
  State,
71
71
  });
72
72
  exports.LoadState = LoadState;
@@ -167,7 +167,7 @@ class AdaptableStore {
167
167
  Redux.combineReducers(rootReducerObject);
168
168
  const rootReducerWithResetManagement = (state, action) => {
169
169
  switch (action.type) {
170
- case exports.LOAD_STATE:
170
+ case LOAD_STATE:
171
171
  const { State } = action;
172
172
  Object.keys(State).forEach((key) => {
173
173
  state[key] = State[key];
@@ -199,7 +199,7 @@ class AdaptableStore {
199
199
  });
200
200
  };
201
201
  // this is now VERY BADLY NAMED!
202
- let rootReducer = (0, AdaptableReduxMerger_1.mergeReducer)(rootReducerWithResetManagement, exports.LOAD_STATE);
202
+ let rootReducer = (0, AdaptableReduxMerger_1.mergeReducer)(rootReducerWithResetManagement, LOAD_STATE);
203
203
  const composeEnhancers = (x) => x;
204
204
  const persistedReducer = (state, action) => {
205
205
  if (adaptable.isDestroyed) {
@@ -1507,7 +1507,7 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
1507
1507
  /*******************
1508
1508
  * MANAGING STATE ACTIONS
1509
1509
  *******************/
1510
- case exports.INIT_STATE: {
1510
+ case INIT_STATE: {
1511
1511
  let returnAction = next(action);
1512
1512
  if (adaptable.isReady) {
1513
1513
  // we need this here for when the state key is changed
@@ -1102,7 +1102,11 @@ You need to define at least one Layout!`);
1102
1102
  dataType: 'DateTime',
1103
1103
  }, {
1104
1104
  id: 'numberExcelType',
1105
- dataType: 'Number',
1105
+ // dataType: 'Number',
1106
+ // AG Grid requires either dataType or numberFormat to be set for Numbers
1107
+ numberFormat: {
1108
+ format: '0.###############',
1109
+ },
1106
1110
  });
1107
1111
  this.agGridExportAdapter.originalExcelStyles = excelStyles;
1108
1112
  this.agGridExportAdapter.DANGER_excelStyles = this.agGridExportAdapter.originalExcelStyles;
@@ -621,7 +621,11 @@ class AgGridExportAdapter {
621
621
  };
622
622
  this.excelStylesCache['numberExcelType'] = {
623
623
  id: 'numberExcelType',
624
- dataType: 'Number',
624
+ // dataType: 'Number',
625
+ // AG Grid requires either dataType or numberFormat to be set for Numbers
626
+ numberFormat: {
627
+ format: '0.###############',
628
+ },
625
629
  };
626
630
  return Object.values(this.excelStylesCache);
627
631
  }
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: 1760446071135 || Date.now(),
6
- VERSION: "21.0.7" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1761289716491 || Date.now(),
6
+ VERSION: "21.0.9-canary.0" || '--current-version--',
7
7
  };
@@ -97,7 +97,7 @@ function isGridLayoutSame(options) {
97
97
  if (!!gridLayout != !!layout) {
98
98
  return false;
99
99
  }
100
- return (0, isLayoutEqual_1.isLayoutEqual)(gridLayout, layout);
100
+ return (0, isLayoutEqual_1.isLayoutEqual)((0, normalizeLayoutModel_1.normalizeLayoutModel)(gridLayout), (0, normalizeLayoutModel_1.normalizeLayoutModel)(layout));
101
101
  }
102
102
  function getDefaultColumnSizeStateForColDef(colId, colDef, options) {
103
103
  if (!colDef) {
@@ -343,6 +343,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
343
343
  let PivotColumns = this.gridApi.getPivotColumns().map((col) => col.getColId());
344
344
  const layout = this.getUndecidedLayoutModelFromGrid(columnState);
345
345
  let ColumnSizing = layout.ColumnSizing || {};
346
+ let ColumnVisibility = { ...layout.ColumnVisibility };
346
347
  //let's also include the column widths of the pivotResult columns
347
348
  pivotResultColumns.forEach((col) => {
348
349
  const colId = col.getColId();
@@ -358,6 +359,18 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
358
359
  if (!Object.keys(ColumnSizing).length) {
359
360
  ColumnSizing = undefined;
360
361
  }
362
+ // from column visibility, let's remove all columns that are not actually in the pivot layout
363
+ // since having normal table columns here will break the equality check
364
+ // so we only want to keep the group columns and the pivot result columns
365
+ Object.keys(ColumnVisibility).forEach((colId) => {
366
+ const isInLayout = pivotResultColumnsSet.has(colId) || colId.startsWith(normalizeLayoutModel_1.AUTO_GROUP_COLUMN_ID__SINGLE);
367
+ if (!isInLayout) {
368
+ delete ColumnVisibility[colId];
369
+ }
370
+ });
371
+ if (!Object.keys(ColumnVisibility).length) {
372
+ ColumnVisibility = undefined;
373
+ }
361
374
  delete layout.TableColumns;
362
375
  const pivotLayout = {
363
376
  Name: layout.Name,
@@ -375,7 +388,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
375
388
  ColumnPinning: layout.ColumnPinning,
376
389
  ColumnSorts: layout.ColumnSorts,
377
390
  ColumnSizing,
378
- ColumnVisibility: layout.ColumnVisibility,
391
+ ColumnVisibility,
379
392
  RowGroupValues: layout.RowGroupValues,
380
393
  ColumnGroupValues: layout.ColumnGroupValues,
381
394
  PivotGroupedColumns: layout.RowGroupedColumns,
@@ -105,6 +105,11 @@ function normalizeTableLayoutModel(layout, options) {
105
105
  };
106
106
  }
107
107
  }
108
+ // there might be a case where there are we have an RowGroupedColumns array, but it's empty (or it's inexistent altogether)
109
+ // and there is no display type specified - so default it to single
110
+ if (!layout.RowGroupDisplayType && layout.TableColumns) {
111
+ layout.RowGroupDisplayType = 'single';
112
+ }
108
113
  if (options?.isTree && !layout.TableColumns.includes(exports.AUTO_GROUP_COLUMN_ID__SINGLE)) {
109
114
  layout.TableColumns.unshift(exports.AUTO_GROUP_COLUMN_ID__SINGLE);
110
115
  }
@@ -161,9 +166,9 @@ function normalizePivotLayoutModel(layout) {
161
166
  // make it an own property
162
167
  layout.PivotColumnTotal = undefined;
163
168
  }
164
- if (layout.PivotGroupedColumns && layout.PivotGroupedColumns.length) {
165
- layout.RowGroupDisplayType = layout.RowGroupDisplayType || 'single';
166
- }
169
+ // if (layout.PivotGroupedColumns && layout.PivotGroupedColumns.length) {
170
+ layout.RowGroupDisplayType = layout.RowGroupDisplayType || 'single';
171
+ // }
167
172
  return layout;
168
173
  }
169
174
  exports.normalizePivotLayoutModel = normalizePivotLayoutModel;