@adaptabletools/adaptable-cjs 20.2.0-canary.1 → 20.2.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": "20.2.0-canary.1",
3
+ "version": "20.2.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",
@@ -26,21 +26,21 @@ export interface ExportOptions<TData = any> {
26
26
  */
27
27
  customDestinations?: CustomDestination[];
28
28
  /**
29
- * System Reports to use; leave blank for all, empty array for none
29
+ * System Reports to use; leave unset for all, empty array for none
30
30
  *
31
31
  * @defaultValue 'All Data', 'Current Layout', 'Selected Data',
32
32
  * @gridInfoItem
33
33
  */
34
34
  systemReportNames?: SystemReportName[] | ((context: SystemReportNamesContext) => SystemReportName[]);
35
35
  /**
36
- * System Report Formats to use; leave blank for all, empty array for none
36
+ * System Report Formats to use; leave unset for all, empty array for none
37
37
  *
38
38
  * @defaultValue 'Excel', 'VisualExcel', 'CSV', 'JSON'
39
39
  * @gridInfoItem
40
40
  */
41
41
  systemReportFormats?: SystemReportFormat[] | ((context: SystemReportFormatsContext) => SystemReportFormat[]);
42
42
  /**
43
- * Export destinations to use; leave blank for all, empty array for none
43
+ * Export destinations to use; leave unset for all, empty array for none
44
44
  *
45
45
  * @defaultValue 'Download', 'Clipboard'
46
46
  * @gridInfoItem
@@ -46,6 +46,9 @@ export interface LayoutBase extends AdaptableObject {
46
46
  * Defines which Row Groups are expanded / collapsed
47
47
  */
48
48
  RowGroupValues?: RowGroupValues;
49
+ /**
50
+ * Defines which Column Groups are expanded / collapsed
51
+ */
49
52
  ColumnGroupValues?: ColumnGroupValues;
50
53
  /**
51
54
  * Set of custom header names for some (or all) Columns
@@ -172,25 +175,43 @@ export interface PivotLayout extends LayoutBase {
172
175
  */
173
176
  export type PivotTotalPosition = 'before' | 'after' | boolean;
174
177
  /**
175
- * Manages how (and which) Row Group values are stored
178
+ * Manages Row Group expand / collapse behaviour, including exceptions
176
179
  */
177
180
  export type RowGroupValues = {
178
181
  RowGroupDefaultBehavior: 'always-expanded' | 'always-collapsed';
179
182
  } | RowGroupValuesWithExceptionKeys;
183
+ /**
184
+ * Defines which Row Groups are expanded or collapsed
185
+ */
186
+ export type RowGroupValuesWithExceptionKeys = {
187
+ /**
188
+ * Default behaviour for Row Groups: 'expanded' or 'collapsed';
189
+ */
190
+ RowGroupDefaultBehavior: 'expanded' | 'collapsed';
191
+ /**
192
+ * Keys of Row Groups which are exceptions to default RowGroupDefaultBehavior - these are actual values in Row Grouped Column
193
+ */
194
+ ExceptionGroupKeys?: any[][];
195
+ };
196
+ /**
197
+ * Manages Column Group expand / collapse behaviour, including exceptions
198
+ */
180
199
  export type ColumnGroupValues = {
181
200
  ColumnGroupDefaultBehavior: 'always-expanded' | 'always-collapsed';
182
201
  } | ColumnGroupValuesWithExceptionKeys;
202
+ /**
203
+ * Defines which Column Groups are expanded or collapsed
204
+ */
183
205
  export type ColumnGroupValuesWithExceptionKeys = {
206
+ /**
207
+ * Default behaviour for Column Groups: 'expanded' or 'collapsed';
208
+ */
184
209
  ColumnGroupDefaultBehavior: 'expanded' | 'collapsed';
210
+ /**
211
+ * Keys of Column Groups which are exceptions to default ColumnGroupDefaultBehavior; key maps to groupId property in ColGroupDef
212
+ */
185
213
  ExceptionGroupKeys?: any[];
186
214
  };
187
- /**
188
- * Defines which Row Group Values are expanded or collapsed
189
- */
190
- export type RowGroupValuesWithExceptionKeys = {
191
- RowGroupDefaultBehavior: 'expanded' | 'collapsed';
192
- ExceptionGroupKeys?: any[][];
193
- };
194
215
  /**
195
216
  * Defines a map of Columns with a String value
196
217
  */
@@ -4,4 +4,5 @@ import { AdaptableModule } from '../../../types';
4
4
  export declare class SettingsPanelApiImpl extends ApiBase implements SettingsPanelApi {
5
5
  openSettingsPanel(moduleName?: AdaptableModule): void;
6
6
  openCustomSettingsPanel(name: string): void;
7
+ closeSettingsPanel(): void;
7
8
  }
@@ -6,17 +6,22 @@ const ApiBase_1 = require("./ApiBase");
6
6
  const PopupRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/PopupRedux"));
7
7
  class SettingsPanelApiImpl extends ApiBase_1.ApiBase {
8
8
  openSettingsPanel(moduleName) {
9
+ if (!moduleName) {
10
+ this.dispatchAction(PopupRedux.PopupShowScreen());
11
+ }
9
12
  const moduleInfo = this.getAdaptableInternalApi()
10
13
  .getModuleService()
11
14
  .getModuleInfoByModule(moduleName);
12
15
  if (!moduleInfo) {
13
- this.logError(`${moduleName} module does not exist`);
14
- return;
16
+ this.logWarn(`${moduleName} module does not exist`);
15
17
  }
16
- this.dispatchAction(PopupRedux.PopupShowScreen(moduleName, moduleInfo.Popup));
18
+ this.dispatchAction(PopupRedux.PopupShowScreen(moduleName, moduleInfo?.Popup));
17
19
  }
18
20
  openCustomSettingsPanel(name) {
19
21
  this.dispatchAction(PopupRedux.PopupShowScreen(null, name));
20
22
  }
23
+ closeSettingsPanel() {
24
+ this.dispatchAction(PopupRedux.PopupHideScreen());
25
+ }
21
26
  }
22
27
  exports.SettingsPanelApiImpl = SettingsPanelApiImpl;
@@ -13,4 +13,8 @@ export interface SettingsPanelApi {
13
13
  * @param name name of Custom Settings Panel to display
14
14
  */
15
15
  openCustomSettingsPanel(name: string): void;
16
+ /**
17
+ * Closes Settings Panel
18
+ */
19
+ closeSettingsPanel(): void;
16
20
  }
@@ -10,16 +10,16 @@ class ChartingService {
10
10
  }
11
11
  onChartModelChange(models, eventType, params) {
12
12
  const allChartDefinitions = this.api.chartingApi.getChartDefinitions();
13
- const currentChartModel = models.find((model) => model.chartId === params.chartId);
14
- const currentChartDefinition = allChartDefinitions.find((chartDefinition) => chartDefinition.Model.chartId === params.chartId);
13
+ const currentChartModel = models.find((model) => model?.chartId === params.chartId);
14
+ const currentChartDefinition = allChartDefinitions.find((chartDefinition) => chartDefinition.Model?.chartId === params.chartId);
15
15
  switch (eventType) {
16
16
  case 'chartCreated':
17
17
  const createParams = params;
18
- if (allChartDefinitions.some((chartDefinition) => chartDefinition.Model.chartId === createParams.chartId)) {
18
+ if (allChartDefinitions.some((chartDefinition) => chartDefinition.Model?.chartId === createParams.chartId)) {
19
19
  // chart already exists
20
20
  }
21
21
  else {
22
- const chartModel = models.find((model) => model.chartId === createParams.chartId);
22
+ const chartModel = models.find((model) => model?.chartId === createParams.chartId);
23
23
  this.saveNewChart(chartModel);
24
24
  }
25
25
  break;
@@ -20,7 +20,7 @@ const useAgChartState = (chartDefinition) => {
20
20
  }, [currentChartModels, chartDefinition]);
21
21
  const closeAlreadyOpenedChartsInContainer = (element) => {
22
22
  const chartModelAlreadyInChartContainer = currentChartModels.find((chartModel) => {
23
- const chartRef = adaptable.api.chartingApi.getChartRef(chartModel.chartId);
23
+ const chartRef = adaptable.api.chartingApi.getChartRef(chartModel?.chartId);
24
24
  return chartRef && element.contains(chartRef.chartElement);
25
25
  });
26
26
  if (chartModelAlreadyInChartContainer) {
@@ -18,7 +18,7 @@ export interface ModuleParams {
18
18
  value?: any;
19
19
  primaryKeyValues?: any[];
20
20
  maxWidth?: number;
21
- source: 'Toolbar' | 'ModuleMenu' | 'ColumnMenu' | 'ContextMenu' | 'ModuleButton' | 'Other';
21
+ source: 'Toolbar' | 'ModuleMenu' | 'ColumnMenu' | 'ContextMenu' | 'ModuleButton' | 'Other' | 'Api';
22
22
  config?: {
23
23
  [key: string]: any;
24
24
  };
@@ -101,6 +101,7 @@ export declare class AdaptableAgGrid implements IAdaptable {
101
101
  private agGridListenerMouseEnter;
102
102
  private agGridListenerMouseLeave;
103
103
  private listenerGlobalSetRowSelection;
104
+ private listenerGlobalChartingChanges;
104
105
  private listenerCellEditingStarted;
105
106
  private listenerFirstDataRendered;
106
107
  private listenerPivotChanged;
@@ -1406,11 +1406,25 @@ You need to define at least one Layout!`);
1406
1406
  ];
1407
1407
  const chartingModule = this.ModuleService.getModuleById('Charting');
1408
1408
  if (chartingModule.isModuleAvailable()) {
1409
- this.agGridAdapter.getAgGridApi().addGlobalListener((type, params) => {
1410
- if (ArrayExtensions_1.default.ContainsItem(eventsThatTriggerChartingChanges, type)) {
1409
+ // We need to break the loop of charting changes for 'chartOptionsChanged', which is triggered by the subsequent agGridApi.updateChart(...)
1410
+ // see #ag_grid_update_chart_loop
1411
+ let lastChartOptionsChangePayload = '';
1412
+ this.listenerGlobalChartingChanges = (type, params) => {
1413
+ if (eventsThatTriggerChartingChanges.includes(type)) {
1414
+ if (type === 'chartOptionsChanged') {
1415
+ // Exclude api and context
1416
+ const { api, context, ...sanitizedParams } = params || {};
1417
+ const eventPayload = JSON.stringify(sanitizedParams);
1418
+ if (eventPayload === lastChartOptionsChangePayload) {
1419
+ // this is a loop, so we ignore it
1420
+ return;
1421
+ }
1422
+ lastChartOptionsChangePayload = eventPayload;
1423
+ }
1411
1424
  this.ChartingService.onChartModelChange(this.getChartModels(), type, params);
1412
1425
  }
1413
- });
1426
+ };
1427
+ this.agGridAdapter.getAgGridApi().addGlobalListener(this.listenerGlobalChartingChanges);
1414
1428
  }
1415
1429
  /**
1416
1430
  * Row and Cell listeners created in 2020
@@ -2709,6 +2723,10 @@ You need to define at least one Layout!`);
2709
2723
  return chartRef;
2710
2724
  }
2711
2725
  updateChart(chart) {
2726
+ if (!chart.Model) {
2727
+ this.logger.consoleError(`Chart definition must have a Model property to be updated: ${chart.Name}`);
2728
+ return;
2729
+ }
2712
2730
  const upgradableProperties = {
2713
2731
  // Only Range charts are supported to be created at run time
2714
2732
  // the other two are pivot & cross-filter
@@ -2718,6 +2736,7 @@ You need to define at least one Layout!`);
2718
2736
  suppressChartRanges: Boolean(chart.Model.suppressChartRanges),
2719
2737
  aggFunc: chart.Model.aggFunc,
2720
2738
  };
2739
+ // see also #ag_grid_update_chart_loop
2721
2740
  this.agGridAdapter.getAgGridApi().updateChart(upgradableProperties);
2722
2741
  }
2723
2742
  getChartModels() {
@@ -2934,6 +2953,9 @@ You need to define at least one Layout!`);
2934
2953
  agGridApi.removeEventListener('columnGroupOpened', this.listenerColumnGroupOpened);
2935
2954
  agGridApi.removeEventListener('sortChanged', this.listenerSortChanged);
2936
2955
  agGridApi.removeGlobalListener(this.listenerGlobalSetRowSelection);
2956
+ if (this.listenerGlobalChartingChanges) {
2957
+ this.agGridAdapter.getAgGridApi().removeGlobalListener(this.listenerGlobalChartingChanges);
2958
+ }
2937
2959
  this.listenerFirstDataRendered = null;
2938
2960
  this.listenerPivotChanged = null;
2939
2961
  this.listenerColumnGroupOpened = null;
@@ -3011,7 +3033,9 @@ You need to define at least one Layout!`);
3011
3033
  }
3012
3034
  this.DANGER_USE_GETTER_adaptableContainerElement = null;
3013
3035
  this.DANGER_USE_GETTER_agGridContainerElement = null;
3036
+ this.debouncedSetSelectedCells?.cancel?.();
3014
3037
  this.debouncedSetSelectedCells = null;
3038
+ this.debouncedSetSelectedRows?.cancel?.();
3015
3039
  this.debouncedSetSelectedRows = null;
3016
3040
  this.adaptableStore?.destroy();
3017
3041
  this.adaptableStore = null;
@@ -6,7 +6,8 @@ const React = tslib_1.__importStar(require("react"));
6
6
  const uuid_1 = require("../utils/uuid");
7
7
  const setZIndexMap = {};
8
8
  const zIndexMap = [];
9
- const BASE_Z_INDEX = 1000;
9
+ // starts with 3000, to be above the default zIndex of the Modal component
10
+ const BASE_Z_INDEX = 3000;
10
11
  /**
11
12
  * Used to facilitate the stacking between multiple opened windows.
12
13
  * When calling 'bringToFront' brings caller to top.
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: 1749490708802 || Date.now(),
6
- VERSION: "20.2.0-canary.1" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1749810340250 || Date.now(),
6
+ VERSION: "20.2.0" || '--current-version--',
7
7
  };