@adaptabletools/adaptable-cjs 22.0.8 → 22.0.10

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": "22.0.8",
3
+ "version": "22.0.10",
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",
@@ -227,7 +227,6 @@ export interface InFilterValueResult {
227
227
  * Information about items in the IN Column Filter
228
228
  */
229
229
  export interface InFilterValueInfo extends InFilterValue {
230
- id: string | number;
231
230
  /**
232
231
  * Whether Item is currently selected
233
232
  */
@@ -255,23 +254,41 @@ export interface InFilterValueInfo extends InFilterValue {
255
254
  */
256
255
  export interface CustomInFilterValuesContext<TData = any> extends AdaptableColumnContext {
257
256
  /**
258
- * Default list of values that will be displayed
257
+ * Distinct Column values in natural (unsorted) row iteration order.
258
+ *
259
+ * When the Column uses a Tree Filter, items have a hierarchical structure.
260
+ *
261
+ * Computed lazily on first access.
259
262
  */
260
263
  defaultValues: Required<InFilterValueInfo>[];
261
264
  /**
262
- * Default values but sorted (if Column is sorted)
265
+ * Distinct Column values sorted by the Column's own sort direction (Asc / Desc).
266
+ *
267
+ * If the Column has no active sort, values are returned in the same order as `defaultValues`.
268
+ *
269
+ * When the Column uses a Tree Filter, items have a hierarchical structure.
270
+ *
271
+ * Computed lazily on first access.
263
272
  */
264
273
  sortedValues: Required<InFilterValueInfo>[];
265
274
  /**
266
- * Default values in order which currently listed in the grid
275
+ * Distinct Column values in the order they appear in the grid from top to bottom.
276
+ *
277
+ * Always a flat list, even when the Column uses a Tree Filter.
278
+ *
279
+ * Computed lazily on first access.
267
280
  */
268
281
  orderedValues: Required<InFilterValueInfo>[];
269
282
  /**
270
- * Search text in the IN Filter component - used when filtering on server
283
+ * Current text in the IN Filter search box.
284
+ *
285
+ * Useful when implementing server-side filtering of the value list.
271
286
  */
272
287
  currentSearchValue: string;
273
288
  /**
274
- * Last filter result; avoids expensive recomputations (eg if async or server-side filtering)
289
+ * The result returned by the previous invocation of `FilterOptions.customInFilterValues`, if any.
290
+ *
291
+ * Useful for avoiding expensive recomputations (e.g. when filtering is async or server-side).
275
292
  */
276
293
  previousFilterResult?: InFilterValueResult;
277
294
  }
@@ -36,4 +36,8 @@ export interface CellDataChangedInfo<TData = any> {
36
36
  * What triggered the change - user, background change or a reverted change?
37
37
  */
38
38
  trigger?: 'edit' | 'tick' | 'undo' | 'aggChange';
39
+ /**
40
+ * Whether the change was prevented by a validation rule
41
+ */
42
+ preventEdit?: boolean;
39
43
  }
@@ -198,7 +198,6 @@ class ColumnFilterApiImpl extends ApiBase_1.ApiBase {
198
198
  if (columnDistinctValues.some((item) => StringExtensions_1.default.IsNullOrEmpty(item.value))) {
199
199
  return [
200
200
  {
201
- id: '_blanks',
202
201
  label: 'Blanks',
203
202
  value: 'Blanks',
204
203
  },
@@ -36,7 +36,7 @@ class CalculatedColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
36
36
  this.api.internalApi
37
37
  .getDataService()
38
38
  .on('CellDataChanged', (cellDataChangedInfo) => {
39
- if (cellDataChangedInfo.trigger !== 'aggChange') {
39
+ if (cellDataChangedInfo.trigger !== 'aggChange' && !cellDataChangedInfo.preventEdit) {
40
40
  this.api.internalApi
41
41
  .getCalculatedColumnExpressionService()
42
42
  .listentoCellDataChange(cellDataChangedInfo);
@@ -28,8 +28,10 @@ class ColumnFilterModule extends AdaptableModuleBase_1.AdaptableModuleBase {
28
28
  this.api.internalApi
29
29
  .getDataService()
30
30
  .on('CellDataChanged', (cellDataChangedInfo) => {
31
- const changedColumnId = cellDataChangedInfo.column.columnId;
32
- this.api.filterApi.columnFilterApi.resetFilterValues(changedColumnId);
31
+ if (!cellDataChangedInfo.preventEdit) {
32
+ const changedColumnId = cellDataChangedInfo.column.columnId;
33
+ this.api.filterApi.columnFilterApi.resetFilterValues(changedColumnId);
34
+ }
33
35
  });
34
36
  // we reset the filter cache on sort change, because we might have columns
35
37
  // with "In" filters, with custom values, which use `context.orderedValues`
@@ -33,7 +33,9 @@ class DataChangeHistoryModule extends AdaptableModuleBase_1.AdaptableModuleBase
33
33
  this.api.internalApi
34
34
  .getDataService()
35
35
  .on('CellDataChanged', (cellDataChangedInfo) => {
36
- if (this.isListeningToCellDataChanges && this.isDataChangeLoggable(cellDataChangedInfo)) {
36
+ if (this.isListeningToCellDataChanges &&
37
+ this.isDataChangeLoggable(cellDataChangedInfo) &&
38
+ !cellDataChangedInfo.preventEdit) {
37
39
  this.api.dataChangeHistoryApi.addDataChangeHistoryEntry(cellDataChangedInfo);
38
40
  }
39
41
  });
@@ -39,7 +39,7 @@ class FlashingCellModule extends AdaptableModuleBase_1.AdaptableModuleBase {
39
39
  this.api.internalApi
40
40
  .getDataService()
41
41
  .on('CellDataChanged', (cellDataChangedInfo) => {
42
- if (cellDataChangedInfo.trigger === 'undo') {
42
+ if (cellDataChangedInfo.trigger === 'undo' || cellDataChangedInfo.preventEdit) {
43
43
  // do NOT handle reverted changes
44
44
  return;
45
45
  }
@@ -34,7 +34,7 @@ class FreeTextColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
34
34
  this.api.internalApi
35
35
  .getDataService()
36
36
  .on('CellDataChanged', (cellDataChangedInfo) => {
37
- if (cellDataChangedInfo.trigger !== 'aggChange') {
37
+ if (cellDataChangedInfo.trigger !== 'aggChange' && !cellDataChangedInfo.preventEdit) {
38
38
  this.api.freeTextColumnApi.internalApi.handleFreeTextColumnDataChange(cellDataChangedInfo);
39
39
  }
40
40
  });
@@ -45,6 +45,12 @@ class DataService {
45
45
  emit = (eventName, data) => this.emitter.emit(eventName, data);
46
46
  CreateCellDataChangedEvent(cellDataChangedInfo) {
47
47
  if (cellDataChangedInfo.newValue != cellDataChangedInfo.oldValue) {
48
+ const validationRules = this.adaptable.api.internalApi
49
+ .getValidationService()
50
+ .getValidationRulesForDataChange(cellDataChangedInfo);
51
+ if (validationRules.length) {
52
+ cellDataChangedInfo.preventEdit = true;
53
+ }
48
54
  this.emitter.emitSync('CellDataChanged', cellDataChangedInfo);
49
55
  this.adaptable.api.eventApi.internalApi.fireCellChangedEvent(cellDataChangedInfo);
50
56
  const dataChangeLogEntry = this.extractDataChangeLogEntry(cellDataChangedInfo);
@@ -507,6 +507,7 @@ class AdaptableAgGrid {
507
507
  this.agGridAdapter.setAgGridApi(agGridApi);
508
508
  this.agGridAdapter.monkeyPatchingGridOptionsUpdates();
509
509
  this.agGridAdapter.monkeyPatchingAggColumnFilters();
510
+ this.agGridAdapter.monkeyPatchingAggFuncLabels();
510
511
  this.lifecycleState = 'agGridReady';
511
512
  this.api.entitlementApi.internalApi.setModulesAgGridDepsInfos();
512
513
  this.ModuleService.logMissingAgGridDepsInfos();
@@ -1024,7 +1025,7 @@ class AdaptableAgGrid {
1024
1025
  }
1025
1026
  return (params) => {
1026
1027
  // might be a summary row
1027
- if (params.data?.[RowSummary_1.ROW_SUMMARY_ROW_ID]) {
1028
+ if (params.data?.[RowSummary_1.ROW_SUMMARY_ROW_ID] != undefined) {
1028
1029
  return params.data[RowSummary_1.ROW_SUMMARY_ROW_ID];
1029
1030
  }
1030
1031
  if (params.level > 0) {
@@ -1040,7 +1041,7 @@ class AdaptableAgGrid {
1040
1041
  const id = [...parentKeys, Math.abs(hash)].join('/');
1041
1042
  return id;
1042
1043
  }
1043
- if (params.data?.[primaryKey]) {
1044
+ if (params.data?.[primaryKey] != undefined) {
1044
1045
  const primaryKeyValue = params.data[primaryKey];
1045
1046
  return typeof primaryKeyValue === 'number'
1046
1047
  ? `${primaryKeyValue}`
@@ -2713,11 +2714,9 @@ class AdaptableAgGrid {
2713
2714
  };
2714
2715
  // No distinct values so lets return unique grid cells
2715
2716
  const mapFn = (gridCell, level) => {
2716
- const itemId = `${gridCell.rowNode?.id}-${gridCell.column?.columnId}`;
2717
2717
  if (level || Array.isArray(gridCell.children)) {
2718
2718
  const cell = gridCell;
2719
2719
  const inFilterValue = {
2720
- id: itemId,
2721
2720
  value: gridCell.rawValue,
2722
2721
  label: gridCell.displayValue,
2723
2722
  level: level ?? 0,
@@ -2738,7 +2737,6 @@ class AdaptableAgGrid {
2738
2737
  return inFilterValue;
2739
2738
  }
2740
2739
  return {
2741
- id: itemId,
2742
2740
  value: gridCell.rawValue,
2743
2741
  label: gridCell.displayValue,
2744
2742
  };
@@ -11,6 +11,7 @@ export declare class AgGridAdapter {
11
11
  private DANGER_updateGridOptionsMonkeyPatcher;
12
12
  private DANGER_doFiltersPassMonkeyPatcher;
13
13
  private DANGER_isAggFilterPresentMonkeyPatcher;
14
+ private DANGER_getDefaultFuncLabelMonkeyPatcher;
14
15
  private activePivotColumnFilters_MEMO;
15
16
  initialGridOptions: GridOptions;
16
17
  private _agGridId;
@@ -28,6 +29,7 @@ export declare class AgGridAdapter {
28
29
  getAgGridApi(skipLogging?: boolean): GridApi | undefined;
29
30
  monkeyPatchingGridOptionsUpdates(): void;
30
31
  monkeyPatchingAggColumnFilters(): void;
32
+ monkeyPatchingAggFuncLabels(): void;
31
33
  private DANGER_getPrivateAgGridBeans;
32
34
  DANGER_getLiveGridOptions(): GridOptions<any>;
33
35
  getAgGridRootElement(): HTMLElement;
@@ -25,6 +25,8 @@ class AgGridAdapter {
25
25
  // see #aggColumnFilters_monkey_patch
26
26
  DANGER_doFiltersPassMonkeyPatcher;
27
27
  DANGER_isAggFilterPresentMonkeyPatcher;
28
+ // see #aggFuncLabels_monkey_patch
29
+ DANGER_getDefaultFuncLabelMonkeyPatcher;
28
30
  activePivotColumnFilters_MEMO = new WeakMap();
29
31
  initialGridOptions;
30
32
  _agGridId;
@@ -55,6 +57,7 @@ class AgGridAdapter {
55
57
  this.DANGER_updateGridOptionsMonkeyPatcher = null;
56
58
  this.DANGER_doFiltersPassMonkeyPatcher = null;
57
59
  this.DANGER_isAggFilterPresentMonkeyPatcher = null;
60
+ this.DANGER_getDefaultFuncLabelMonkeyPatcher = null;
58
61
  this.activePivotColumnFilters_MEMO = null;
59
62
  this._adaptableInstance = null;
60
63
  }
@@ -212,6 +215,27 @@ class AgGridAdapter {
212
215
  };
213
216
  agGridColumnFilterService.isAggFilterPresent = this.DANGER_isAggFilterPresentMonkeyPatcher;
214
217
  }
218
+ // #aggFuncLabels_monkey_patch
219
+ monkeyPatchingAggFuncLabels() {
220
+ const agGridAggFuncService = this.DANGER_getPrivateAgGridBeans()?.aggFuncSvc;
221
+ if (!agGridAggFuncService) {
222
+ return;
223
+ }
224
+ const original_getDefaultFuncLabel = agGridAggFuncService.getDefaultFuncLabel;
225
+ if (typeof original_getDefaultFuncLabel !== 'function') {
226
+ return;
227
+ }
228
+ this.DANGER_getDefaultFuncLabelMonkeyPatcher = function (fctName) {
229
+ if (fctName === 'only') {
230
+ return 'Only';
231
+ }
232
+ if (fctName === 'weightedAvg') {
233
+ return 'Weighted Average';
234
+ }
235
+ return original_getDefaultFuncLabel.call(this, fctName);
236
+ };
237
+ agGridAggFuncService.getDefaultFuncLabel = this.DANGER_getDefaultFuncLabelMonkeyPatcher;
238
+ }
215
239
  DANGER_getPrivateAgGridBeans() {
216
240
  const beans = DANGER_AG_GRID_BEANS_MAP[this._agGridId];
217
241
  if (!beans) {
@@ -659,9 +683,14 @@ class AgGridAdapter {
659
683
  return false;
660
684
  }
661
685
  getColumnAggregationFunctions(colDef) {
662
- let result = [].concat(colDef.allowedAggFuncs || ['sum', 'min', 'max', 'count', 'avg', 'first', 'last']); // those are the default fns aggrid supports out-of-the-box
686
+ const defaultAggFuncs = ['sum', 'min', 'max', 'count', 'avg', 'first', 'last'];
687
+ const hasAllowedAggFuncs = Array.isArray(colDef.allowedAggFuncs);
688
+ let result = hasAllowedAggFuncs ? [...colDef.allowedAggFuncs] : [...defaultAggFuncs];
663
689
  const gridOptionsAggFuncs = this.adaptableApi.agGridApi.getGridOption('aggFuncs') || {};
664
- result.push(...Object.keys(gridOptionsAggFuncs));
690
+ const gridOptionsAggFuncNames = Object.keys(gridOptionsAggFuncs);
691
+ if (!hasAllowedAggFuncs) {
692
+ result.push(...gridOptionsAggFuncNames);
693
+ }
665
694
  result = result.filter((func) => !(0, AggregationColumns_1.isWeightedAverageAggFuncName)(func));
666
695
  return [...new Set(result)];
667
696
  }
@@ -576,6 +576,7 @@ class AgGridColumnAdapter {
576
576
  return undefined;
577
577
  }
578
578
  return abColumn.availableAggregationFunctions.filter((func) => !(0, AggregationColumns_1.isWeightedAverageAggFuncName)(func));
579
+ // .filter((func) => func !== ONLY_AGG_FN_NAME);
579
580
  });
580
581
  }
581
582
  setupColumnType(columnSetupInfo) {
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { DataSourcePropOnTreeSelectionChange_MultiNode, InfiniteTableProps, TreeDataSourceProps } from '../../InfiniteTable';
3
3
  export type TreeListItem<T = any> = {
4
- id: string | number;
4
+ id?: string | number;
5
5
  label: string;
6
6
  children?: TreeListItem<T>[];
7
7
  };
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: 1775221059632 || Date.now(),
6
- VERSION: "22.0.8" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1775746156657 || Date.now(),
6
+ VERSION: "22.0.10" || '--current-version--',
7
7
  };