@adaptabletools/adaptable 20.1.9 → 20.1.11

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.1.9",
3
+ "version": "20.1.11",
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",
@@ -186,6 +186,10 @@ export interface InFilterValueInfo {
186
186
  * How many times the item appears in the column
187
187
  */
188
188
  count?: number;
189
+ /**
190
+ * How many times the item appears in the column in filtered rows
191
+ */
192
+ visibleCount?: number;
189
193
  /**
190
194
  * Whether the item is currently visible in the Grid (i.e. in filtered rows)
191
195
  */
@@ -56,6 +56,7 @@ export interface GridCell<TData = any> {
56
56
  }
57
57
  export interface GridCellWithCount extends GridCell {
58
58
  count: number;
59
+ visibleCount: number;
59
60
  }
60
61
  /**
61
62
  * Lightweight object used for identifying a Cell to be updated
@@ -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
  }
@@ -2,16 +2,21 @@ import { ApiBase } from './ApiBase';
2
2
  import * as PopupRedux from '../../Redux/ActionsReducers/PopupRedux';
3
3
  export class SettingsPanelApiImpl extends ApiBase {
4
4
  openSettingsPanel(moduleName) {
5
+ if (!moduleName) {
6
+ this.dispatchAction(PopupRedux.PopupShowScreen());
7
+ }
5
8
  const moduleInfo = this.getAdaptableInternalApi()
6
9
  .getModuleService()
7
10
  .getModuleInfoByModule(moduleName);
8
11
  if (!moduleInfo) {
9
- this.logError(`${moduleName} module does not exist`);
10
- return;
12
+ this.logWarn(`${moduleName} module does not exist`);
11
13
  }
12
- this.dispatchAction(PopupRedux.PopupShowScreen(moduleName, moduleInfo.Popup));
14
+ this.dispatchAction(PopupRedux.PopupShowScreen(moduleName, moduleInfo?.Popup));
13
15
  }
14
16
  openCustomSettingsPanel(name) {
15
17
  this.dispatchAction(PopupRedux.PopupShowScreen(null, name));
16
18
  }
19
+ closeSettingsPanel() {
20
+ this.dispatchAction(PopupRedux.PopupHideScreen());
21
+ }
17
22
  }
@@ -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
  }
@@ -6,16 +6,16 @@ export class ChartingService {
6
6
  }
7
7
  onChartModelChange(models, eventType, params) {
8
8
  const allChartDefinitions = this.api.chartingApi.getChartDefinitions();
9
- const currentChartModel = models.find((model) => model.chartId === params.chartId);
10
- const currentChartDefinition = allChartDefinitions.find((chartDefinition) => chartDefinition.Model.chartId === params.chartId);
9
+ const currentChartModel = models.find((model) => model?.chartId === params.chartId);
10
+ const currentChartDefinition = allChartDefinitions.find((chartDefinition) => chartDefinition.Model?.chartId === params.chartId);
11
11
  switch (eventType) {
12
12
  case 'chartCreated':
13
13
  const createParams = params;
14
- if (allChartDefinitions.some((chartDefinition) => chartDefinition.Model.chartId === createParams.chartId)) {
14
+ if (allChartDefinitions.some((chartDefinition) => chartDefinition.Model?.chartId === createParams.chartId)) {
15
15
  // chart already exists
16
16
  }
17
17
  else {
18
- const chartModel = models.find((model) => model.chartId === createParams.chartId);
18
+ const chartModel = models.find((model) => model?.chartId === createParams.chartId);
19
19
  this.saveNewChart(chartModel);
20
20
  }
21
21
  break;
@@ -16,7 +16,7 @@ export const useAgChartState = (chartDefinition) => {
16
16
  }, [currentChartModels, chartDefinition]);
17
17
  const closeAlreadyOpenedChartsInContainer = (element) => {
18
18
  const chartModelAlreadyInChartContainer = currentChartModels.find((chartModel) => {
19
- const chartRef = adaptable.api.chartingApi.getChartRef(chartModel.chartId);
19
+ const chartRef = adaptable.api.chartingApi.getChartRef(chartModel?.chartId);
20
20
  return chartRef && element.contains(chartRef.chartElement);
21
21
  });
22
22
  if (chartModelAlreadyInChartContainer) {
@@ -24,19 +24,19 @@ export const isScopeValid = ({ Scope }) => {
24
24
  return result.length ? result.join(', ') : true;
25
25
  };
26
26
  const DATA_TYPES_MAP = {
27
- Date: {
27
+ date: {
28
28
  label: 'Date',
29
29
  value: 'date',
30
30
  },
31
- Number: {
31
+ number: {
32
32
  label: 'Number',
33
33
  value: 'number',
34
34
  },
35
- String: {
35
+ text: {
36
36
  label: 'Text',
37
37
  value: 'text',
38
38
  },
39
- Boolean: {
39
+ boolean: {
40
40
  label: 'Boolean',
41
41
  value: 'boolean',
42
42
  },
@@ -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;
@@ -1366,11 +1366,25 @@ You need to define at least one Layout!`);
1366
1366
  ];
1367
1367
  const chartingModule = this.ModuleService.getModuleById('Charting');
1368
1368
  if (chartingModule.isModuleAvailable()) {
1369
- this.agGridAdapter.getAgGridApi().addGlobalListener((type, params) => {
1370
- if (ArrayExtensions.ContainsItem(eventsThatTriggerChartingChanges, type)) {
1369
+ // We need to break the loop of charting changes for 'chartOptionsChanged', which is triggered by the subsequent agGridApi.updateChart(...)
1370
+ // see #ag_grid_update_chart_loop
1371
+ let lastChartOptionsChangePayload = '';
1372
+ this.listenerGlobalChartingChanges = (type, params) => {
1373
+ if (eventsThatTriggerChartingChanges.includes(type)) {
1374
+ if (type === 'chartOptionsChanged') {
1375
+ // Exclude api and context
1376
+ const { api, context, ...sanitizedParams } = params || {};
1377
+ const eventPayload = JSON.stringify(sanitizedParams);
1378
+ if (eventPayload === lastChartOptionsChangePayload) {
1379
+ // this is a loop, so we ignore it
1380
+ return;
1381
+ }
1382
+ lastChartOptionsChangePayload = eventPayload;
1383
+ }
1371
1384
  this.ChartingService.onChartModelChange(this.getChartModels(), type, params);
1372
1385
  }
1373
- });
1386
+ };
1387
+ this.agGridAdapter.getAgGridApi().addGlobalListener(this.listenerGlobalChartingChanges);
1374
1388
  }
1375
1389
  /**
1376
1390
  * Row and Cell listeners created in 2020
@@ -2190,6 +2204,9 @@ You need to define at least one Layout!`);
2190
2204
  get visible() {
2191
2205
  return gridCell.visible;
2192
2206
  },
2207
+ get visibleCount() {
2208
+ return gridCell.visibleCount;
2209
+ },
2193
2210
  };
2194
2211
  });
2195
2212
  return result;
@@ -2204,6 +2221,9 @@ You need to define at least one Layout!`);
2204
2221
  get visible() {
2205
2222
  return gridCell.visible;
2206
2223
  },
2224
+ get visibleCount() {
2225
+ return gridCell.visibleCount;
2226
+ },
2207
2227
  };
2208
2228
  });
2209
2229
  return result;
@@ -2352,6 +2372,11 @@ You need to define at least one Layout!`);
2352
2372
  return (rowNodesWithSameCellValue.findIndex((pk) => self.isRowNodeAvailableAfterFiltering(pk) === true) !== -1);
2353
2373
  },
2354
2374
  });
2375
+ Object.defineProperty(cellWithCount, 'visibleCount', {
2376
+ get: () => {
2377
+ return rowNodesWithSameCellValue.filter((pk) => self.isRowNodeAvailableAfterFiltering(pk) === true).length;
2378
+ },
2379
+ });
2355
2380
  result.push(cellWithCount);
2356
2381
  });
2357
2382
  return result;
@@ -2616,6 +2641,10 @@ You need to define at least one Layout!`);
2616
2641
  return chartRef;
2617
2642
  }
2618
2643
  updateChart(chart) {
2644
+ if (!chart.Model) {
2645
+ this.logger.consoleError(`Chart definition must have a Model property to be updated: ${chart.Name}`);
2646
+ return;
2647
+ }
2619
2648
  const upgradableProperties = {
2620
2649
  // Only Range charts are supported to be created at run time
2621
2650
  // the other two are pivot & cross-filter
@@ -2625,6 +2654,7 @@ You need to define at least one Layout!`);
2625
2654
  suppressChartRanges: Boolean(chart.Model.suppressChartRanges),
2626
2655
  aggFunc: chart.Model.aggFunc,
2627
2656
  };
2657
+ // see also #ag_grid_update_chart_loop
2628
2658
  this.agGridAdapter.getAgGridApi().updateChart(upgradableProperties);
2629
2659
  }
2630
2660
  getChartModels() {
@@ -2837,6 +2867,9 @@ You need to define at least one Layout!`);
2837
2867
  agGridApi.removeEventListener('cellSelectionChanged', this.listenerCellSelectionChanged);
2838
2868
  agGridApi.removeEventListener('sortChanged', this.listenerSortChanged);
2839
2869
  agGridApi.removeGlobalListener(this.listenerGlobalSetRowSelection);
2870
+ if (this.listenerGlobalChartingChanges) {
2871
+ this.agGridAdapter.getAgGridApi().removeGlobalListener(this.listenerGlobalChartingChanges);
2872
+ }
2840
2873
  this.listenerFirstDataRendered = null;
2841
2874
  this.listenerPivotChanged = null;
2842
2875
  this.listenerCellEditingStarted = null;
@@ -2913,7 +2946,9 @@ You need to define at least one Layout!`);
2913
2946
  }
2914
2947
  this.DANGER_USE_GETTER_adaptableContainerElement = null;
2915
2948
  this.DANGER_USE_GETTER_agGridContainerElement = null;
2949
+ this.debouncedSetSelectedCells?.cancel?.();
2916
2950
  this.debouncedSetSelectedCells = null;
2951
+ this.debouncedSetSelectedRows?.cancel?.();
2917
2952
  this.debouncedSetSelectedRows = null;
2918
2953
  this.adaptableStore?.destroy();
2919
2954
  this.adaptableStore = null;
@@ -2,7 +2,8 @@ import * as React from 'react';
2
2
  import { createUuid } from '../utils/uuid';
3
3
  const setZIndexMap = {};
4
4
  const zIndexMap = [];
5
- const BASE_Z_INDEX = 1000;
5
+ // starts with 3000, to be above the default zIndex of the Modal component
6
+ const BASE_Z_INDEX = 3000;
6
7
  /**
7
8
  * Used to facilitate the stacking between multiple opened windows.
8
9
  * When calling 'bringToFront' brings caller to top.
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: 1749212715232 || Date.now(),
4
- VERSION: "20.1.9" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1749648014004 || Date.now(),
4
+ VERSION: "20.1.11" || '--current-version--',
5
5
  };