@adaptabletools/adaptable 20.1.8 → 20.2.0-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.
Files changed (63) hide show
  1. package/base.css +27 -0
  2. package/base.css.map +1 -1
  3. package/index.css +22 -0
  4. package/index.css.map +1 -1
  5. package/package.json +2 -2
  6. package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -0
  7. package/src/AdaptableOptions/DefaultAdaptableOptions.js +2 -1
  8. package/src/AdaptableOptions/ExportOptions.d.ts +91 -8
  9. package/src/AdaptableOptions/QuickSearchOptions.d.ts +1 -6
  10. package/src/AdaptableState/FormatColumnState.d.ts +8 -0
  11. package/src/AdaptableState/LayoutState.d.ts +15 -2
  12. package/src/AdaptableState/QuickSearchState.d.ts +8 -0
  13. package/src/Api/ColumnApi.d.ts +5 -0
  14. package/src/Api/ExportApi.d.ts +23 -7
  15. package/src/Api/Implementation/ColumnApiImpl.d.ts +2 -2
  16. package/src/Api/Implementation/ColumnApiImpl.js +15 -30
  17. package/src/Api/Implementation/ExportApiImpl.d.ts +11 -4
  18. package/src/Api/Implementation/ExportApiImpl.js +51 -9
  19. package/src/Api/Implementation/LayoutHelpers.js +44 -0
  20. package/src/Api/Implementation/QuickSearchApiImpl.d.ts +4 -0
  21. package/src/Api/Implementation/QuickSearchApiImpl.js +12 -0
  22. package/src/Api/Internal/AlertInternalApi.js +1 -1
  23. package/src/Api/Internal/ExportInternalApi.d.ts +3 -8
  24. package/src/Api/Internal/ExportInternalApi.js +1 -74
  25. package/src/Api/Internal/ExpressionInternalApi.d.ts +1 -1
  26. package/src/Api/Internal/ExpressionInternalApi.js +1 -32
  27. package/src/Api/Internal/FormatColumnInternalApi.d.ts +2 -1
  28. package/src/Api/Internal/FormatColumnInternalApi.js +62 -0
  29. package/src/Api/QuickSearchApi.d.ts +16 -0
  30. package/src/Redux/Store/AdaptableStore.js +3 -2
  31. package/src/Utilities/Constants/GeneralConstants.js +2 -1
  32. package/src/View/Components/Forms/AdaptableFormControlTextClear.d.ts +1 -0
  33. package/src/View/Components/Forms/AdaptableFormControlTextClear.js +1 -0
  34. package/src/View/Dashboard/Dashboard.js +2 -4
  35. package/src/View/Layout/Wizard/sections/AggregationsSection.js +2 -2
  36. package/src/View/Layout/Wizard/sections/PivotAggregationsSection.js +2 -2
  37. package/src/View/Layout/Wizard/sections/PivotRowGroupingSection.js +6 -1
  38. package/src/View/Layout/Wizard/sections/RowGroupingSection.d.ts +4 -0
  39. package/src/View/Layout/Wizard/sections/RowGroupingSection.js +22 -19
  40. package/src/View/QuickSearch/QuickSearchInput.js +6 -1
  41. package/src/View/QuickSearch/QuickSearchPopup.js +2 -3
  42. package/src/agGrid/AdaptableAgGrid.d.ts +2 -0
  43. package/src/agGrid/AdaptableAgGrid.js +121 -38
  44. package/src/agGrid/AgGridAdapter.d.ts +4 -1
  45. package/src/agGrid/AgGridAdapter.js +90 -13
  46. package/src/agGrid/AgGridColumnAdapter.d.ts +4 -0
  47. package/src/agGrid/AgGridColumnAdapter.js +142 -35
  48. package/src/agGrid/AgGridExportAdapter.d.ts +6 -1
  49. package/src/agGrid/AgGridExportAdapter.js +103 -14
  50. package/src/agGrid/FloatingFilterWrapper.js +30 -4
  51. package/src/env.js +2 -2
  52. package/src/layout-manager/src/LayoutManagerModel.d.ts +16 -2
  53. package/src/layout-manager/src/index.d.ts +1 -1
  54. package/src/layout-manager/src/index.js +135 -20
  55. package/src/layout-manager/src/normalizeLayoutModel.d.ts +2 -4
  56. package/src/layout-manager/src/normalizeLayoutModel.js +12 -16
  57. package/src/layout-manager/src/simplifyLayoutModel.js +15 -3
  58. package/src/metamodel/adaptable.metamodel.d.ts +71 -0
  59. package/src/metamodel/adaptable.metamodel.js +1 -1
  60. package/src/types.d.ts +1 -1
  61. package/tsconfig.esm.tsbuildinfo +1 -1
  62. package/src/Utilities/buildSortedColumnStateForLayout.d.ts +0 -7
  63. package/src/Utilities/buildSortedColumnStateForLayout.js +0 -131
@@ -403,7 +403,8 @@ export class AdaptableAgGrid {
403
403
  perfInitAgGrid.end();
404
404
  // we need to intercept several AG Grid Api methods and trigger Adaptable state changes
405
405
  this.agGridAdapter.setAgGridApi(agGridApi);
406
- this.agGridAdapter.monkeyPatchingGridOptionsUpdates(agGridApi);
406
+ this.agGridAdapter.monkeyPatchingGridOptionsUpdates();
407
+ this.agGridAdapter.monkeyPatchingAggColumnFilters();
407
408
  this.lifecycleState = 'agGridReady';
408
409
  this.logger.info(`Registered AG Grid modules: `, this.agGridAdapter.getAgGridRegisteredModuleNames().sort());
409
410
  /**
@@ -418,12 +419,22 @@ export class AdaptableAgGrid {
418
419
  // TODO AFL MIG: we could just patch the defautl Layout on init? instead
419
420
  this.checkShouldClearExistingFiltersOrSearches();
420
421
  this.applyFiltering();
422
+ // apply quick search if there is one
423
+ // yes, we could have put this on the gridOptions.findSearchValue
424
+ // but we need to wait for setupColumns to run first so as to correctly
425
+ // determine on which columns the quick search should be applied or not
426
+ // and also to setup the quick search style
427
+ const quickSearchState = this.api.stateApi.getQuickSearchState();
428
+ if (quickSearchState.QuickSearchText) {
429
+ this.setAgGridFindSearchValue(quickSearchState.QuickSearchText);
430
+ }
421
431
  this.addGridEventListeners();
422
432
  this.temporaryAdaptableStateUpdates();
423
433
  this.redrawBody();
424
434
  this.refreshHeader();
425
435
  const currentLayout = this.api.layoutApi.getCurrentLayout();
426
436
  checkForDuplicateColumns(currentLayout);
437
+ this.__prevLayoutForRefresh = currentLayout;
427
438
  if (isPivotLayout(currentLayout)) {
428
439
  // this is very very strange!
429
440
  // for some projects, if the initial layout is pivot, the columnDefs of the pivot resutl columns are NOT derived correctly from the main colDefs
@@ -437,7 +448,9 @@ export class AdaptableAgGrid {
437
448
  // see test /tests/pages/quick-search/pivot-search.spec.ts
438
449
  this.updateColumnModelAndRefreshGrid();
439
450
  }
440
- this.layoutManager.applyRowGroupValues(layoutStateToLayoutModel(currentLayout).RowGroupValues);
451
+ const layoutModelForApply = layoutStateToLayoutModel(currentLayout);
452
+ this.layoutManager.applyRowGroupValues(layoutModelForApply.RowGroupValues);
453
+ this.layoutManager.applyColumnGroupCollapseExpandState(layoutModelForApply);
441
454
  this.autoSizeLayoutIfNeeded();
442
455
  this.ModuleService.createModuleUIItems();
443
456
  const adaptableContainerElem = this.getAdaptableContainerElement();
@@ -761,10 +774,14 @@ You need to define at least one Layout!`);
761
774
  if (!this.isAvailable) {
762
775
  return true;
763
776
  }
764
- const isColumnFiltersActive = ArrayExtensions.IsNotNullOrEmpty(this.api.filterApi.columnFilterApi.getActiveColumnFilters());
765
777
  const isGridFilterActive = StringExtensions.IsNotNullOrEmpty(this.api.filterApi.gridFilterApi.getCurrentGridFilterExpression());
766
- return (isColumnFiltersActive ||
767
- isGridFilterActive ||
778
+ const isTableColumnFiltersActive = ArrayExtensions.IsNotNullOrEmpty(this.api.filterApi.columnFilterApi
779
+ .getActiveColumnFilters()
780
+ .filter((columnFilter) => !this.api.columnApi.isPivotResultColumn(columnFilter.ColumnId)));
781
+ return (isGridFilterActive ||
782
+ // only Table ColumnFilters are handled here
783
+ // see #doAggregateFiltersPassMonkeyPatcher for filtering Pivot Columns
784
+ isTableColumnFiltersActive ||
768
785
  // it means that userPropertyValue will be called so we re-init that collection
769
786
  (original_isExternalFilterPresent ? original_isExternalFilterPresent(params) : false));
770
787
  };
@@ -777,10 +794,20 @@ You need to define at least one Layout!`);
777
794
  if (!this.isAvailable) {
778
795
  return true;
779
796
  }
780
- // Note: not sure we need this check as doubtful AG Grid ever passes in a Group Row node to filter...
781
- // But if it does, then we might change this IF we allow Column filtering (but not Grid Filters) for Group nodes
782
797
  if (this.isGroupRowNode(node)) {
783
- return true;
798
+ if (this.api.gridApi.isTreeDataGrid()) {
799
+ if (node.data == undefined) {
800
+ // Filler Groups are not filterable
801
+ // see https://www.ag-grid.com/javascript-data-grid/tree-data-paths/#filler-groups
802
+ return false;
803
+ }
804
+ }
805
+ else {
806
+ // for non-Tree Data Grids, we don't filter Group Rows
807
+ // not sure if that's 100% correct, but we did it like this in the past
808
+ // so we keep it like this for now until bugs are reported
809
+ return true;
810
+ }
784
811
  }
785
812
  // first assess if the Row i s filterable - if not, then return true so it appears in Grid
786
813
  const isRowFilterable = this.api.optionsApi.getFilterOptions().isRowFilterable;
@@ -816,11 +843,15 @@ You need to define at least one Layout!`);
816
843
  }
817
844
  }
818
845
  // finally we evaluate column filters
819
- const columnFilters = this.api.filterApi.columnFilterApi.getActiveColumnFilters();
846
+ const tableColumnFilters = this.api.filterApi.columnFilterApi
847
+ .getActiveColumnFilters()
848
+ .filter((columnFilter) => !this.api.columnApi.isPivotResultColumn(columnFilter.ColumnId));
820
849
  try {
821
- if (columnFilters.length > 0) {
822
- for (const columnFilter of columnFilters) {
823
- const evaluateColumnFilterOnClient = this.api.expressionApi.internalApi.evaluatePredicatesInAdaptableQL('ColumnFilter', columnFilter, columnFilter.Predicates);
850
+ // only Table ColumnFilters are handled here
851
+ // see #doAggregateFiltersPassMonkeyPatcher for filtering Pivot Columns
852
+ if (tableColumnFilters.length > 0) {
853
+ for (const columnFilter of tableColumnFilters) {
854
+ const evaluateColumnFilterOnClient = this.api.expressionApi.internalApi.shouldEvaluatePredicatesInAdaptableQL('ColumnFilter', columnFilter, columnFilter.Predicates);
824
855
  if (evaluateColumnFilterOnClient) {
825
856
  const columnFilterEvaluationResult = this.api.filterApi.columnFilterApi.internalApi.evaluateColumnFilter(columnFilter, node);
826
857
  if (!columnFilterEvaluationResult) {
@@ -1043,18 +1074,6 @@ You need to define at least one Layout!`);
1043
1074
  // this array reference will be used for the entire AG Grid session
1044
1075
  return this.agGridExportAdapter.DANGER_excelStyles;
1045
1076
  });
1046
- /**
1047
- * `processPivotResultColDef`
1048
- */
1049
- this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'processPivotResultColDef', (original_processPivotResultColDef) => {
1050
- return (colDef) => {
1051
- if (this.adaptableOptions.filterOptions.useAdaptableFiltering) {
1052
- colDef.floatingFilter = false;
1053
- colDef.filter = false;
1054
- }
1055
- original_processPivotResultColDef?.(colDef);
1056
- };
1057
- });
1058
1077
  /**
1059
1078
  * `maintainColumnOrder`
1060
1079
  */
@@ -1095,6 +1114,12 @@ You need to define at least one Layout!`);
1095
1114
  const revertedDateTypeDefinitions = agGridDataTypeDefinitions;
1096
1115
  return revertedDateTypeDefinitions;
1097
1116
  });
1117
+ this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'findOptions', (original_findOptions) => {
1118
+ return {
1119
+ ...original_findOptions,
1120
+ caseSensitive: !!this.adaptableOptions.quickSearchOptions.isQuickSearchCaseSensitive,
1121
+ };
1122
+ });
1098
1123
  }
1099
1124
  /**
1100
1125
  * Either initializes the AG Grid instance or delegates it to the framework wrappers (React/Anglar)
@@ -1296,6 +1321,17 @@ You need to define at least one Layout!`);
1296
1321
  }
1297
1322
  this.autoSizeLayoutIfNeeded();
1298
1323
  }));
1324
+ /**
1325
+ * Use Case: A format column that has ColumnGroupState needs to be re-evaluated
1326
+ * whenever a column group is expanded or collapsed
1327
+ */
1328
+ this.agGridAdapter.getAgGridApi().addEventListener('columnGroupOpened', (this.listenerColumnGroupOpened = () => {
1329
+ if (this.api.formatColumnApi.getActiveFormatColumns().some((fc) => {
1330
+ return fc.ColumnGroupState != null;
1331
+ })) {
1332
+ this.updateColumnModelAndRefreshGrid();
1333
+ }
1334
+ }));
1299
1335
  /**
1300
1336
  * Use Case: A pivot column has changed
1301
1337
  * Action: Autosize pivot columns (if autosize pivot in Layout is true)
@@ -1631,13 +1667,18 @@ You need to define at least one Layout!`);
1631
1667
  let _rawValue;
1632
1668
  let _displayValue;
1633
1669
  let _normalisedValue;
1634
- let _isPivotCell;
1635
1670
  let _isRowGroupCell;
1671
+ const _isPivotCell = this.api.columnApi.isPivotResultColumn(columnId);
1636
1672
  const self = this;
1637
1673
  const api = this.api;
1638
1674
  const getRawValue = () => {
1639
1675
  if (_rawValue === undefined) {
1640
1676
  _rawValue = self.getRawValueFromRowNode(rowNode, columnId);
1677
+ if (_isPivotCell && _rawValue?.value != undefined) {
1678
+ // for pivot result columns, the raw value is an object with a value property
1679
+ // we want to return the value property as the raw value
1680
+ _rawValue = _rawValue.value;
1681
+ }
1641
1682
  }
1642
1683
  return _rawValue;
1643
1684
  };
@@ -1676,9 +1717,6 @@ You need to define at least one Layout!`);
1676
1717
  return _primaryKeyValue;
1677
1718
  },
1678
1719
  get isPivotCell() {
1679
- if (_isPivotCell === undefined) {
1680
- _isPivotCell = api.columnApi.isPivotResultColumn(columnId);
1681
- }
1682
1720
  return _isPivotCell;
1683
1721
  },
1684
1722
  get isRowGroupCell() {
@@ -1747,6 +1785,26 @@ You need to define at least one Layout!`);
1747
1785
  return formattedValue || '';
1748
1786
  }
1749
1787
  }
1788
+ else if (this.api.columnApi.isPivotResultColumn(columnId)) {
1789
+ const pivotResultColumn = this.agGridAdapter
1790
+ .getAgGridApi()
1791
+ .getPivotResultColumns()
1792
+ .find((col) => col.getColId() === columnId);
1793
+ const pivotResultColDef = pivotResultColumn?.getColDef();
1794
+ if (pivotResultColDef && typeof pivotResultColDef.valueFormatter === 'function') {
1795
+ const params = {
1796
+ value: rawValue,
1797
+ node: rowNode,
1798
+ data: rowNode.data,
1799
+ colDef: pivotResultColDef,
1800
+ column: pivotResultColumn,
1801
+ api: this.agGridAdapter.getAgGridApi(),
1802
+ context: this.agGridAdapter.getGridOption('context'),
1803
+ };
1804
+ const formattedValue = pivotResultColDef.valueFormatter(params);
1805
+ return formattedValue || '';
1806
+ }
1807
+ }
1750
1808
  return this.getCleanValue(rawValue);
1751
1809
  }
1752
1810
  getCleanValue(value) {
@@ -2268,8 +2326,9 @@ You need to define at least one Layout!`);
2268
2326
  }
2269
2327
  getDistinctGridCellsForColumn(column) {
2270
2328
  let gridCells = [];
2329
+ const isPivotResultColumn = column.isGeneratedPivotResultColumn;
2271
2330
  this.agGridAdapter.getAgGridApi().forEachNode((rowNode) => {
2272
- const gridCell = this.addDistinctColumnValue(rowNode, column.columnId);
2331
+ const gridCell = this.addDistinctColumnValue(rowNode, column.columnId, isPivotResultColumn);
2273
2332
  if (gridCell) {
2274
2333
  gridCells.push(gridCell);
2275
2334
  }
@@ -2294,17 +2353,36 @@ You need to define at least one Layout!`);
2294
2353
  return gridCells;
2295
2354
  }
2296
2355
  }
2297
- addDistinctColumnValue(rowNode, columnId) {
2298
- // we do not return the values of the aggregates when in grouping mode
2299
- // otherwise they would appear in the filter dropdown etc....
2300
- if (rowNode && !this.isGroupRowNode(rowNode)) {
2301
- const returnValue = this.getGridCellFromRowNode(rowNode, columnId);
2302
- if (Helper.objectExists(returnValue)) {
2303
- return returnValue;
2356
+ addDistinctColumnValue(rowNode, columnId, isPivotResultColumn) {
2357
+ if (!rowNode) {
2358
+ return;
2359
+ }
2360
+ if (!isPivotResultColumn && this.isGroupRowNode(rowNode)) {
2361
+ if (this.api.gridApi.isTreeDataGrid()) {
2362
+ if (rowNode.data == undefined) {
2363
+ // skip Tree Filler Groups
2364
+ // see https://www.ag-grid.com/javascript-data-grid/tree-data-paths/#filler-groups
2365
+ return;
2366
+ }
2367
+ }
2368
+ else {
2369
+ // for normal Table Columns we do NOT return the values of the aggregates
2370
+ return;
2304
2371
  }
2305
2372
  }
2306
- else {
2307
- return undefined;
2373
+ if (isPivotResultColumn) {
2374
+ // if it's a Pivot Result Column, we are interested only in the aggregated(pivoted) data
2375
+ if (!rowNode.aggData) {
2376
+ return;
2377
+ }
2378
+ if (!rowNode.leafGroup) {
2379
+ // if it's a Pivot Result Column, we are interested only in the leaf groups (pivot results, NOT group aggregates)
2380
+ return;
2381
+ }
2382
+ }
2383
+ const returnValue = this.getGridCellFromRowNode(rowNode, columnId);
2384
+ if (Helper.objectExists(returnValue)) {
2385
+ return returnValue;
2308
2386
  }
2309
2387
  }
2310
2388
  getUniqueGridCells(column, gridCells) {
@@ -2667,6 +2745,9 @@ You need to define at least one Layout!`);
2667
2745
  clearAgGridQuickSearch() {
2668
2746
  this.setAgGridQuickSearch('');
2669
2747
  }
2748
+ setAgGridFindSearchValue(searchText) {
2749
+ this.agGridAdapter.setGridOption('findSearchValue', searchText);
2750
+ }
2670
2751
  applyAdaptableTheme(theme) {
2671
2752
  const container = this.getAgGridContainerElement();
2672
2753
  if (container != null) {
@@ -2835,10 +2916,12 @@ You need to define at least one Layout!`);
2835
2916
  agGridApi.removeEventListener('columnPivotChanged', this.listenerPivotChanged);
2836
2917
  agGridApi.removeEventListener('cellEditingStarted', this.listenerCellEditingStarted);
2837
2918
  agGridApi.removeEventListener('cellSelectionChanged', this.listenerCellSelectionChanged);
2919
+ agGridApi.removeEventListener('columnGroupOpened', this.listenerColumnGroupOpened);
2838
2920
  agGridApi.removeEventListener('sortChanged', this.listenerSortChanged);
2839
2921
  agGridApi.removeGlobalListener(this.listenerGlobalSetRowSelection);
2840
2922
  this.listenerFirstDataRendered = null;
2841
2923
  this.listenerPivotChanged = null;
2924
+ this.listenerColumnGroupOpened = null;
2842
2925
  this.listenerCellEditingStarted = null;
2843
2926
  this.listenerCellSelectionChanged = null;
2844
2927
  this.listenerGlobalSetRowSelection = null;
@@ -9,6 +9,8 @@ export declare class AgGridAdapter {
9
9
  private DANGER_USE_GETTER_gridApi;
10
10
  private DANGER_gridApi_from_args;
11
11
  private DANGER_updateGridOptionsMonkeyPatcher;
12
+ private DANGER_doAggregateFiltersPassMonkeyPatcher;
13
+ private DANGER_isAggregateFilterPresentMonkeyPatcher;
12
14
  initialGridOptions: GridOptions;
13
15
  private _agGridId;
14
16
  constructor(_adaptableInstance: AdaptableAgGrid, config?: {
@@ -22,7 +24,8 @@ export declare class AgGridAdapter {
22
24
  setAgGridId(agGridId: string): void;
23
25
  setAgGridApi(gridApi: GridApi): void;
24
26
  getAgGridApi(skipLogging?: boolean): GridApi | undefined;
25
- monkeyPatchingGridOptionsUpdates(agGridApi: GridApi<any>): void;
27
+ monkeyPatchingGridOptionsUpdates(): void;
28
+ monkeyPatchingAggColumnFilters(): void;
26
29
  private DANGER_getPrivateAgGridBeans;
27
30
  DANGER_getLiveGridOptions(): GridOptions<any>;
28
31
  isAgGridModuleRegistered(moduleName: ModuleName): boolean;
@@ -1,6 +1,6 @@
1
1
  import { ColumnApiModule, } from 'ag-grid-enterprise';
2
2
  import { ACTION_COLUMN_TYPE, CALCULATED_COLUMN_TYPE, FDC3_COLUMN_TYPE, FREE_TEXT_COLUMN_TYPE, } from '../AdaptableState/Common/AdaptableColumn';
3
- import { ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME, AG_GRID_GROUPED_COLUMN, AG_GRID_SELECTION_COLUMN, } from '../Utilities/Constants/GeneralConstants';
3
+ import { ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME } from '../Utilities/Constants/GeneralConstants';
4
4
  import { createUuid } from '../AdaptableState/Uuid';
5
5
  import ArrayExtensions from '../Utilities/Extensions/ArrayExtensions';
6
6
  import * as ModuleConstants from '../Utilities/Constants/ModuleConstants';
@@ -16,6 +16,8 @@ export class AgGridAdapter {
16
16
  constructor(_adaptableInstance, config) {
17
17
  this._adaptableInstance = _adaptableInstance;
18
18
  const columnApiModuleReference = config?.getAgGridColumnApiModuleReference?.() ?? getColumnApiModule();
19
+ const beans = columnApiModuleReference?.beans;
20
+ console.log(beans?.length);
19
21
  const ColumnDefFactory_Prototype = columnApiModuleReference?.beans?.[0]?.prototype;
20
22
  if (!ColumnDefFactory_Prototype) {
21
23
  console.error(`CRITICAL: could not get hold of AG Grid beans, this should never happen!`);
@@ -38,6 +40,8 @@ export class AgGridAdapter {
38
40
  this.DANGER_gridApi_from_args = null;
39
41
  this.DANGER_USE_GETTER_gridApi = null;
40
42
  this.DANGER_updateGridOptionsMonkeyPatcher = null;
43
+ this.DANGER_doAggregateFiltersPassMonkeyPatcher = null;
44
+ this.DANGER_isAggregateFilterPresentMonkeyPatcher = null;
41
45
  this._adaptableInstance = null;
42
46
  }
43
47
  get adaptableOptions() {
@@ -71,7 +75,7 @@ export class AgGridAdapter {
71
75
  }
72
76
  // #gridOpts_monkey_patch
73
77
  // we need to intercept some of the GridOptions updates and refresh the Adaptable state
74
- monkeyPatchingGridOptionsUpdates(agGridApi) {
78
+ monkeyPatchingGridOptionsUpdates() {
75
79
  const agGridOptionsService = this.DANGER_getPrivateAgGridBeans()?.gos;
76
80
  if (!agGridOptionsService) {
77
81
  return;
@@ -107,6 +111,57 @@ export class AgGridAdapter {
107
111
  };
108
112
  agGridOptionsService.updateGridOptions = this.DANGER_updateGridOptionsMonkeyPatcher;
109
113
  }
114
+ monkeyPatchingAggColumnFilters() {
115
+ if (!this.adaptableApi.optionsApi.getFilterOptions().useAdaptableFiltering) {
116
+ // monkey patching is only needed if Adaptable is used for filtering
117
+ return;
118
+ }
119
+ const agGridColumnFilterService = this.DANGER_getPrivateAgGridBeans()?.colFilter;
120
+ if (!agGridColumnFilterService) {
121
+ this.logger.consoleError('Could not get hold of ColumnFilterService! This is a critical error and will prevent Adaptable from working correctly.');
122
+ return;
123
+ }
124
+ const self = this;
125
+ // https://github.com/ag-grid/ag-grid/blob/8409e99c8010473356a878e9bdfb836a5ea16718/packages/ag-grid-community/src/filter/columnFilterService.ts#L240
126
+ // monkey patch ColumnFilterService.doAggregateFiltersPass because currently Adaptable does NOT override the ColumnFilters
127
+ // (it uses the `doesExternalFilterPass` to evaluate the filters on the client side)
128
+ // #doAggregateFiltersPassMonkeyPatcher
129
+ this.DANGER_doAggregateFiltersPassMonkeyPatcher = function (rowNode, filterToSkip) {
130
+ if (!self.adaptableApi.layoutApi.isCurrentLayoutPivot()) {
131
+ // should NEVER happen
132
+ return true;
133
+ }
134
+ const pivotColumnFilters = self.adaptableApi.filterApi.columnFilterApi
135
+ .getActiveColumnFilters()
136
+ .filter((columnFilter) => self.adaptableApi.columnApi.isPivotResultColumn(columnFilter.ColumnId));
137
+ try {
138
+ if (pivotColumnFilters.length > 0) {
139
+ for (const columnFilter of pivotColumnFilters) {
140
+ const evaluateColumnFilterOnClient = self.adaptableApi.expressionApi.internalApi.shouldEvaluatePredicatesInAdaptableQL('ColumnFilter', columnFilter, columnFilter.Predicates);
141
+ if (evaluateColumnFilterOnClient) {
142
+ const columnFilterEvaluationResult = self.adaptableApi.filterApi.columnFilterApi.internalApi.evaluateColumnFilter(columnFilter, rowNode);
143
+ if (!columnFilterEvaluationResult) {
144
+ return false;
145
+ }
146
+ }
147
+ }
148
+ }
149
+ }
150
+ catch (ex) {
151
+ self.logger.error(ex);
152
+ return true;
153
+ }
154
+ return true;
155
+ };
156
+ agGridColumnFilterService.doAggregateFiltersPass =
157
+ this.DANGER_doAggregateFiltersPassMonkeyPatcher;
158
+ this.DANGER_isAggregateFilterPresentMonkeyPatcher = function () {
159
+ const columnFilters = self.adaptableApi.filterApi.columnFilterApi.getActiveColumnFilters();
160
+ return columnFilters.some((colFilter) => self.adaptableApi.columnApi.isPivotResultColumn(colFilter.ColumnId));
161
+ };
162
+ agGridColumnFilterService.isAggregateFilterPresent =
163
+ this.DANGER_isAggregateFilterPresentMonkeyPatcher;
164
+ }
110
165
  DANGER_getPrivateAgGridBeans() {
111
166
  const beans = DANGER_AG_GRID_BEANS_MAP[this._agGridId];
112
167
  if (!beans) {
@@ -159,12 +214,21 @@ export class AgGridAdapter {
159
214
  }
160
215
  }
161
216
  updateGridOptions(options) {
217
+ if (this.getAgGridApi()?.isDestroyed()) {
218
+ return;
219
+ }
162
220
  this.getAgGridApi()?.updateGridOptions(options);
163
221
  }
164
222
  getGridOption(key) {
223
+ if (this.getAgGridApi()?.isDestroyed()) {
224
+ return;
225
+ }
165
226
  return this.getAgGridApi()?.getGridOption(key);
166
227
  }
167
228
  setGridOption(key, value) {
229
+ if (this.getAgGridApi()?.isDestroyed()) {
230
+ return;
231
+ }
168
232
  this.getAgGridApi()?.setGridOption(key, value);
169
233
  }
170
234
  getUserGridOptionsProperty(propertyName) {
@@ -453,10 +517,21 @@ export class AgGridAdapter {
453
517
  this.logger.warn(`Column is undefined, returning 'text' for Type`);
454
518
  return 'text';
455
519
  }
456
- if (agColumn.getId() === AG_GRID_GROUPED_COLUMN ||
457
- agColumn.getId() === AG_GRID_SELECTION_COLUMN) {
520
+ if (this.adaptableApi.columnApi.isAutoRowGroupColumnForSingle(agColumn.getId()) ||
521
+ this.adaptableApi.columnApi.isSelectionColumn(agColumn.getId())) {
458
522
  return 'unknown';
459
523
  }
524
+ if (this.adaptableApi.columnApi.isAutoRowGroupColumnForMulti(agColumn.getId())) {
525
+ const rowGroupKey = agColumn.getColDef().showRowGroup;
526
+ if (typeof rowGroupKey !== 'string') {
527
+ return 'unknown';
528
+ }
529
+ const groupedColumn = this.adaptableApi.agGridApi.getColumn(rowGroupKey);
530
+ if (!groupedColumn) {
531
+ return 'unknown';
532
+ }
533
+ return this.deriveAdaptableColumnDataType(groupedColumn, logWarning);
534
+ }
460
535
  const colDefType = [].concat(agColumn.getColDef()?.type || []).filter(Boolean);
461
536
  const skippedSpecialCols = ['actionColumn', 'fdc3Column'];
462
537
  if (skippedSpecialCols.some((specialColType) => colDefType.includes(specialColType))) {
@@ -483,15 +558,17 @@ export class AgGridAdapter {
483
558
  this.logger.consoleError(`No data in grid, returning type "unknown" for Column: "${agColumn.getColId()}". This will impact several Adaptable features, such as Filters and ColumnFormats.`);
484
559
  return 'unknown';
485
560
  }
486
- // if it's a group we need the content of the group
487
- if (row.group) {
488
- const childNodes = row.childrenAfterGroup;
489
- if (ArrayExtensions.IsNullOrEmpty(childNodes)) {
490
- this.logger.consoleError(`No data in grid, returning type "unknown" for Column: "${agColumn.getColId()}". This will impact several Adaptable features, such as Filters and ColumnFormats.`);
491
- return 'unknown';
492
- }
493
- row = childNodes[0];
494
- }
561
+ // // if it's a group we need the content of the group
562
+ // if (row.group) {
563
+ // const childNodes = row.childrenAfterGroup;
564
+ // if (ArrayExtensions.IsNullOrEmpty(childNodes)) {
565
+ // this.logger.consoleError(
566
+ // `No data in grid, returning type "unknown" for Column: "${agColumn.getColId()}". This will impact several Adaptable features, such as Filters and ColumnFormats.`
567
+ // );
568
+ // return 'unknown';
569
+ // }
570
+ // row = childNodes[0];
571
+ // }
495
572
  const value = this._agGridApi_getValue(agColumn, row);
496
573
  switch (typeof value) {
497
574
  case 'string':
@@ -35,6 +35,8 @@ export declare class AgGridColumnAdapter {
35
35
  private setupColumnEditable;
36
36
  private setupColumnValueSetter;
37
37
  private setupColumnComparator;
38
+ private setupColumnGetFindText;
39
+ private isCellSearchable;
38
40
  private isQuickSearchActive;
39
41
  private getEditableCellClass;
40
42
  private getReadonlyCellClass;
@@ -45,6 +47,8 @@ export declare class AgGridColumnAdapter {
45
47
  private getCommentCellClassName;
46
48
  private getFormatColumnCellClass;
47
49
  private getQuickSearchCellStyle;
50
+ private getQuickSearchTextMatchStyle;
51
+ private getQuickSearchCurrentTextMatchStyle;
48
52
  private getReadOnlyCellStyle;
49
53
  private getEditableCellStyle;
50
54
  private getEditedCellStyle;