@adaptabletools/adaptable 20.2.0-canary.0 → 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",
3
- "version": "20.2.0-canary.0",
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
@@ -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
  */
@@ -9,6 +9,9 @@ export interface QuickSearchOptions<TData = any> {
9
9
  * @param quickSearchContext Contains quick search text and current Grid Cell
10
10
  */
11
11
  isCellSearchable?: (quickSearchContext: QuickSearchContext) => boolean;
12
+ /**
13
+ * Allows a different value to be used for a cell when searching (instead of its raw value)
14
+ */
12
15
  getCellSearchText?: (quickSearchContext: QuickSearchContext) => string | null;
13
16
  /**
14
17
  * Value to use as placeholder in QuickSearch controls (e.g. in Dashboard)
@@ -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
  */
@@ -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
  };
@@ -195,14 +195,16 @@ export const ColumnsSection = (props) => {
195
195
  const adaptable = useAdaptable();
196
196
  const { data: layout } = useOnePageAdaptableWizardContext();
197
197
  const [searchInputValue, setSearchInputValue] = React.useState('');
198
- // we don't want to rely on all the columns from the Grid itself
199
- // since the "Row Groups" section of the editor can determine a change
200
- // which is not reflected into AG Grid until we hit finish
201
- //
202
- // so we only rely on non-generated columns, which are the same
203
- const allColumns = adaptable.api.columnApi.getUIAvailableColumns().filter((col) => {
198
+ const allColumns = adaptable.api.columnApi
199
+ .getUIAvailableColumns()
200
+ .filter((col) => {
201
+ // since the "Row Groups" section of the editor can determine a change
202
+ // which is not reflected into AG Grid until we hit finish
203
+ // so we only rely on non-generated columns, which are the same
204
204
  return !col.isGeneratedRowGroupColumn;
205
- });
205
+ })
206
+ // if the current Layout is a PivotLayout, then we also filter out current Pivot Result Columns
207
+ .filter((col) => !col.isGeneratedPivotResultColumn);
206
208
  // however, changes in RowGroupedColumns done in the previous step
207
209
  // are reflected into the layout, so we use the latest layout.RowGroupedColumns
208
210
  // to create new columns
@@ -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;
@@ -1402,11 +1402,25 @@ You need to define at least one Layout!`);
1402
1402
  ];
1403
1403
  const chartingModule = this.ModuleService.getModuleById('Charting');
1404
1404
  if (chartingModule.isModuleAvailable()) {
1405
- this.agGridAdapter.getAgGridApi().addGlobalListener((type, params) => {
1406
- if (ArrayExtensions.ContainsItem(eventsThatTriggerChartingChanges, type)) {
1405
+ // We need to break the loop of charting changes for 'chartOptionsChanged', which is triggered by the subsequent agGridApi.updateChart(...)
1406
+ // see #ag_grid_update_chart_loop
1407
+ let lastChartOptionsChangePayload = '';
1408
+ this.listenerGlobalChartingChanges = (type, params) => {
1409
+ if (eventsThatTriggerChartingChanges.includes(type)) {
1410
+ if (type === 'chartOptionsChanged') {
1411
+ // Exclude api and context
1412
+ const { api, context, ...sanitizedParams } = params || {};
1413
+ const eventPayload = JSON.stringify(sanitizedParams);
1414
+ if (eventPayload === lastChartOptionsChangePayload) {
1415
+ // this is a loop, so we ignore it
1416
+ return;
1417
+ }
1418
+ lastChartOptionsChangePayload = eventPayload;
1419
+ }
1407
1420
  this.ChartingService.onChartModelChange(this.getChartModels(), type, params);
1408
1421
  }
1409
- });
1422
+ };
1423
+ this.agGridAdapter.getAgGridApi().addGlobalListener(this.listenerGlobalChartingChanges);
1410
1424
  }
1411
1425
  /**
1412
1426
  * Row and Cell listeners created in 2020
@@ -2248,6 +2262,9 @@ You need to define at least one Layout!`);
2248
2262
  get visible() {
2249
2263
  return gridCell.visible;
2250
2264
  },
2265
+ get visibleCount() {
2266
+ return gridCell.visibleCount;
2267
+ },
2251
2268
  };
2252
2269
  });
2253
2270
  return result;
@@ -2262,6 +2279,9 @@ You need to define at least one Layout!`);
2262
2279
  get visible() {
2263
2280
  return gridCell.visible;
2264
2281
  },
2282
+ get visibleCount() {
2283
+ return gridCell.visibleCount;
2284
+ },
2265
2285
  };
2266
2286
  });
2267
2287
  return result;
@@ -2430,6 +2450,11 @@ You need to define at least one Layout!`);
2430
2450
  return (rowNodesWithSameCellValue.findIndex((pk) => self.isRowNodeAvailableAfterFiltering(pk) === true) !== -1);
2431
2451
  },
2432
2452
  });
2453
+ Object.defineProperty(cellWithCount, 'visibleCount', {
2454
+ get: () => {
2455
+ return rowNodesWithSameCellValue.filter((pk) => self.isRowNodeAvailableAfterFiltering(pk) === true).length;
2456
+ },
2457
+ });
2433
2458
  result.push(cellWithCount);
2434
2459
  });
2435
2460
  return result;
@@ -2694,6 +2719,10 @@ You need to define at least one Layout!`);
2694
2719
  return chartRef;
2695
2720
  }
2696
2721
  updateChart(chart) {
2722
+ if (!chart.Model) {
2723
+ this.logger.consoleError(`Chart definition must have a Model property to be updated: ${chart.Name}`);
2724
+ return;
2725
+ }
2697
2726
  const upgradableProperties = {
2698
2727
  // Only Range charts are supported to be created at run time
2699
2728
  // the other two are pivot & cross-filter
@@ -2703,6 +2732,7 @@ You need to define at least one Layout!`);
2703
2732
  suppressChartRanges: Boolean(chart.Model.suppressChartRanges),
2704
2733
  aggFunc: chart.Model.aggFunc,
2705
2734
  };
2735
+ // see also #ag_grid_update_chart_loop
2706
2736
  this.agGridAdapter.getAgGridApi().updateChart(upgradableProperties);
2707
2737
  }
2708
2738
  getChartModels() {
@@ -2919,6 +2949,9 @@ You need to define at least one Layout!`);
2919
2949
  agGridApi.removeEventListener('columnGroupOpened', this.listenerColumnGroupOpened);
2920
2950
  agGridApi.removeEventListener('sortChanged', this.listenerSortChanged);
2921
2951
  agGridApi.removeGlobalListener(this.listenerGlobalSetRowSelection);
2952
+ if (this.listenerGlobalChartingChanges) {
2953
+ this.agGridAdapter.getAgGridApi().removeGlobalListener(this.listenerGlobalChartingChanges);
2954
+ }
2922
2955
  this.listenerFirstDataRendered = null;
2923
2956
  this.listenerPivotChanged = null;
2924
2957
  this.listenerColumnGroupOpened = null;
@@ -2996,7 +3029,9 @@ You need to define at least one Layout!`);
2996
3029
  }
2997
3030
  this.DANGER_USE_GETTER_adaptableContainerElement = null;
2998
3031
  this.DANGER_USE_GETTER_agGridContainerElement = null;
3032
+ this.debouncedSetSelectedCells?.cancel?.();
2999
3033
  this.debouncedSetSelectedCells = null;
3034
+ this.debouncedSetSelectedRows?.cancel?.();
3000
3035
  this.debouncedSetSelectedRows = null;
3001
3036
  this.adaptableStore?.destroy();
3002
3037
  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: 1748873595292 || Date.now(),
4
- VERSION: "20.2.0-canary.0" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1749810312509 || Date.now(),
4
+ VERSION: "20.2.0" || '--current-version--',
5
5
  };