@adaptabletools/adaptable-cjs 20.1.7 → 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.
- package/base.css +27 -0
- package/base.css.map +1 -1
- package/index.css +22 -0
- package/index.css.map +1 -1
- package/package.json +2 -2
- package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -0
- package/src/AdaptableOptions/DefaultAdaptableOptions.js +2 -1
- package/src/AdaptableOptions/ExportOptions.d.ts +91 -8
- package/src/AdaptableOptions/QuickSearchOptions.d.ts +1 -6
- package/src/AdaptableState/FormatColumnState.d.ts +8 -0
- package/src/AdaptableState/LayoutState.d.ts +15 -2
- package/src/AdaptableState/QuickSearchState.d.ts +8 -0
- package/src/Api/ColumnApi.d.ts +5 -0
- package/src/Api/ExportApi.d.ts +23 -7
- package/src/Api/Implementation/ColumnApiImpl.d.ts +2 -2
- package/src/Api/Implementation/ColumnApiImpl.js +15 -31
- package/src/Api/Implementation/ExportApiImpl.d.ts +11 -4
- package/src/Api/Implementation/ExportApiImpl.js +50 -8
- package/src/Api/Implementation/LayoutApiImpl.d.ts +1 -0
- package/src/Api/Implementation/LayoutApiImpl.js +9 -0
- package/src/Api/Implementation/LayoutHelpers.js +44 -0
- package/src/Api/Implementation/QuickSearchApiImpl.d.ts +4 -0
- package/src/Api/Implementation/QuickSearchApiImpl.js +12 -0
- package/src/Api/Internal/AlertInternalApi.js +1 -1
- package/src/Api/Internal/ExportInternalApi.d.ts +3 -8
- package/src/Api/Internal/ExportInternalApi.js +1 -74
- package/src/Api/Internal/ExpressionInternalApi.d.ts +1 -1
- package/src/Api/Internal/ExpressionInternalApi.js +1 -32
- package/src/Api/Internal/FormatColumnInternalApi.d.ts +2 -1
- package/src/Api/Internal/FormatColumnInternalApi.js +62 -0
- package/src/Api/LayoutApi.d.ts +6 -2
- package/src/Api/QuickSearchApi.d.ts +16 -0
- package/src/Redux/Store/AdaptableStore.js +3 -2
- package/src/Utilities/Constants/GeneralConstants.js +2 -1
- package/src/View/Components/Forms/AdaptableFormControlTextClear.d.ts +1 -0
- package/src/View/Components/Forms/AdaptableFormControlTextClear.js +1 -0
- package/src/View/Dashboard/Dashboard.js +2 -4
- package/src/View/Layout/Wizard/sections/AggregationsSection.js +2 -2
- package/src/View/Layout/Wizard/sections/PivotAggregationsSection.js +2 -2
- package/src/View/Layout/Wizard/sections/PivotRowGroupingSection.js +6 -1
- package/src/View/Layout/Wizard/sections/RowGroupingSection.d.ts +4 -0
- package/src/View/Layout/Wizard/sections/RowGroupingSection.js +24 -20
- package/src/View/QuickSearch/QuickSearchInput.js +6 -1
- package/src/View/QuickSearch/QuickSearchPopup.js +2 -3
- package/src/agGrid/AdaptableAgGrid.d.ts +2 -0
- package/src/agGrid/AdaptableAgGrid.js +123 -44
- package/src/agGrid/AgGridAdapter.d.ts +4 -1
- package/src/agGrid/AgGridAdapter.js +89 -12
- package/src/agGrid/AgGridColumnAdapter.d.ts +4 -0
- package/src/agGrid/AgGridColumnAdapter.js +144 -37
- package/src/agGrid/AgGridExportAdapter.d.ts +6 -1
- package/src/agGrid/AgGridExportAdapter.js +110 -17
- package/src/agGrid/FloatingFilterWrapper.js +30 -4
- package/src/env.js +2 -2
- package/src/layout-manager/src/LayoutManagerModel.d.ts +16 -2
- package/src/layout-manager/src/index.d.ts +1 -1
- package/src/layout-manager/src/index.js +133 -18
- package/src/layout-manager/src/normalizeLayoutModel.d.ts +2 -4
- package/src/layout-manager/src/normalizeLayoutModel.js +13 -18
- package/src/layout-manager/src/simplifyLayoutModel.js +14 -2
- package/src/metamodel/adaptable.metamodel.d.ts +71 -0
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +1 -1
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/src/Utilities/buildSortedColumnStateForLayout.d.ts +0 -7
- package/src/Utilities/buildSortedColumnStateForLayout.js +0 -135
|
@@ -407,7 +407,8 @@ class AdaptableAgGrid {
|
|
|
407
407
|
perfInitAgGrid.end();
|
|
408
408
|
// we need to intercept several AG Grid Api methods and trigger Adaptable state changes
|
|
409
409
|
this.agGridAdapter.setAgGridApi(agGridApi);
|
|
410
|
-
this.agGridAdapter.monkeyPatchingGridOptionsUpdates(
|
|
410
|
+
this.agGridAdapter.monkeyPatchingGridOptionsUpdates();
|
|
411
|
+
this.agGridAdapter.monkeyPatchingAggColumnFilters();
|
|
411
412
|
this.lifecycleState = 'agGridReady';
|
|
412
413
|
this.logger.info(`Registered AG Grid modules: `, this.agGridAdapter.getAgGridRegisteredModuleNames().sort());
|
|
413
414
|
/**
|
|
@@ -422,12 +423,22 @@ class AdaptableAgGrid {
|
|
|
422
423
|
// TODO AFL MIG: we could just patch the defautl Layout on init? instead
|
|
423
424
|
this.checkShouldClearExistingFiltersOrSearches();
|
|
424
425
|
this.applyFiltering();
|
|
426
|
+
// apply quick search if there is one
|
|
427
|
+
// yes, we could have put this on the gridOptions.findSearchValue
|
|
428
|
+
// but we need to wait for setupColumns to run first so as to correctly
|
|
429
|
+
// determine on which columns the quick search should be applied or not
|
|
430
|
+
// and also to setup the quick search style
|
|
431
|
+
const quickSearchState = this.api.stateApi.getQuickSearchState();
|
|
432
|
+
if (quickSearchState.QuickSearchText) {
|
|
433
|
+
this.setAgGridFindSearchValue(quickSearchState.QuickSearchText);
|
|
434
|
+
}
|
|
425
435
|
this.addGridEventListeners();
|
|
426
436
|
this.temporaryAdaptableStateUpdates();
|
|
427
437
|
this.redrawBody();
|
|
428
438
|
this.refreshHeader();
|
|
429
439
|
const currentLayout = this.api.layoutApi.getCurrentLayout();
|
|
430
440
|
(0, LayoutHelpers_1.checkForDuplicateColumns)(currentLayout);
|
|
441
|
+
this.__prevLayoutForRefresh = currentLayout;
|
|
431
442
|
if ((0, LayoutHelpers_1.isPivotLayout)(currentLayout)) {
|
|
432
443
|
// this is very very strange!
|
|
433
444
|
// for some projects, if the initial layout is pivot, the columnDefs of the pivot resutl columns are NOT derived correctly from the main colDefs
|
|
@@ -441,7 +452,9 @@ class AdaptableAgGrid {
|
|
|
441
452
|
// see test /tests/pages/quick-search/pivot-search.spec.ts
|
|
442
453
|
this.updateColumnModelAndRefreshGrid();
|
|
443
454
|
}
|
|
444
|
-
|
|
455
|
+
const layoutModelForApply = (0, LayoutHelpers_1.layoutStateToLayoutModel)(currentLayout);
|
|
456
|
+
this.layoutManager.applyRowGroupValues(layoutModelForApply.RowGroupValues);
|
|
457
|
+
this.layoutManager.applyColumnGroupCollapseExpandState(layoutModelForApply);
|
|
445
458
|
this.autoSizeLayoutIfNeeded();
|
|
446
459
|
this.ModuleService.createModuleUIItems();
|
|
447
460
|
const adaptableContainerElem = this.getAdaptableContainerElement();
|
|
@@ -765,10 +778,14 @@ You need to define at least one Layout!`);
|
|
|
765
778
|
if (!this.isAvailable) {
|
|
766
779
|
return true;
|
|
767
780
|
}
|
|
768
|
-
const isColumnFiltersActive = ArrayExtensions_1.default.IsNotNullOrEmpty(this.api.filterApi.columnFilterApi.getActiveColumnFilters());
|
|
769
781
|
const isGridFilterActive = StringExtensions_1.default.IsNotNullOrEmpty(this.api.filterApi.gridFilterApi.getCurrentGridFilterExpression());
|
|
770
|
-
|
|
771
|
-
|
|
782
|
+
const isTableColumnFiltersActive = ArrayExtensions_1.default.IsNotNullOrEmpty(this.api.filterApi.columnFilterApi
|
|
783
|
+
.getActiveColumnFilters()
|
|
784
|
+
.filter((columnFilter) => !this.api.columnApi.isPivotResultColumn(columnFilter.ColumnId)));
|
|
785
|
+
return (isGridFilterActive ||
|
|
786
|
+
// only Table ColumnFilters are handled here
|
|
787
|
+
// see #doAggregateFiltersPassMonkeyPatcher for filtering Pivot Columns
|
|
788
|
+
isTableColumnFiltersActive ||
|
|
772
789
|
// it means that userPropertyValue will be called so we re-init that collection
|
|
773
790
|
(original_isExternalFilterPresent ? original_isExternalFilterPresent(params) : false));
|
|
774
791
|
};
|
|
@@ -781,10 +798,20 @@ You need to define at least one Layout!`);
|
|
|
781
798
|
if (!this.isAvailable) {
|
|
782
799
|
return true;
|
|
783
800
|
}
|
|
784
|
-
// Note: not sure we need this check as doubtful AG Grid ever passes in a Group Row node to filter...
|
|
785
|
-
// But if it does, then we might change this IF we allow Column filtering (but not Grid Filters) for Group nodes
|
|
786
801
|
if (this.isGroupRowNode(node)) {
|
|
787
|
-
|
|
802
|
+
if (this.api.gridApi.isTreeDataGrid()) {
|
|
803
|
+
if (node.data == undefined) {
|
|
804
|
+
// Filler Groups are not filterable
|
|
805
|
+
// see https://www.ag-grid.com/javascript-data-grid/tree-data-paths/#filler-groups
|
|
806
|
+
return false;
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
else {
|
|
810
|
+
// for non-Tree Data Grids, we don't filter Group Rows
|
|
811
|
+
// not sure if that's 100% correct, but we did it like this in the past
|
|
812
|
+
// so we keep it like this for now until bugs are reported
|
|
813
|
+
return true;
|
|
814
|
+
}
|
|
788
815
|
}
|
|
789
816
|
// first assess if the Row i s filterable - if not, then return true so it appears in Grid
|
|
790
817
|
const isRowFilterable = this.api.optionsApi.getFilterOptions().isRowFilterable;
|
|
@@ -820,11 +847,15 @@ You need to define at least one Layout!`);
|
|
|
820
847
|
}
|
|
821
848
|
}
|
|
822
849
|
// finally we evaluate column filters
|
|
823
|
-
const
|
|
850
|
+
const tableColumnFilters = this.api.filterApi.columnFilterApi
|
|
851
|
+
.getActiveColumnFilters()
|
|
852
|
+
.filter((columnFilter) => !this.api.columnApi.isPivotResultColumn(columnFilter.ColumnId));
|
|
824
853
|
try {
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
854
|
+
// only Table ColumnFilters are handled here
|
|
855
|
+
// see #doAggregateFiltersPassMonkeyPatcher for filtering Pivot Columns
|
|
856
|
+
if (tableColumnFilters.length > 0) {
|
|
857
|
+
for (const columnFilter of tableColumnFilters) {
|
|
858
|
+
const evaluateColumnFilterOnClient = this.api.expressionApi.internalApi.shouldEvaluatePredicatesInAdaptableQL('ColumnFilter', columnFilter, columnFilter.Predicates);
|
|
828
859
|
if (evaluateColumnFilterOnClient) {
|
|
829
860
|
const columnFilterEvaluationResult = this.api.filterApi.columnFilterApi.internalApi.evaluateColumnFilter(columnFilter, node);
|
|
830
861
|
if (!columnFilterEvaluationResult) {
|
|
@@ -1047,18 +1078,6 @@ You need to define at least one Layout!`);
|
|
|
1047
1078
|
// this array reference will be used for the entire AG Grid session
|
|
1048
1079
|
return this.agGridExportAdapter.DANGER_excelStyles;
|
|
1049
1080
|
});
|
|
1050
|
-
/**
|
|
1051
|
-
* `processPivotResultColDef`
|
|
1052
|
-
*/
|
|
1053
|
-
this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'processPivotResultColDef', (original_processPivotResultColDef) => {
|
|
1054
|
-
return (colDef) => {
|
|
1055
|
-
if (this.adaptableOptions.filterOptions.useAdaptableFiltering) {
|
|
1056
|
-
colDef.floatingFilter = false;
|
|
1057
|
-
colDef.filter = false;
|
|
1058
|
-
}
|
|
1059
|
-
original_processPivotResultColDef?.(colDef);
|
|
1060
|
-
};
|
|
1061
|
-
});
|
|
1062
1081
|
/**
|
|
1063
1082
|
* `maintainColumnOrder`
|
|
1064
1083
|
*/
|
|
@@ -1099,6 +1118,12 @@ You need to define at least one Layout!`);
|
|
|
1099
1118
|
const revertedDateTypeDefinitions = agGridDataTypeDefinitions_1.agGridDataTypeDefinitions;
|
|
1100
1119
|
return revertedDateTypeDefinitions;
|
|
1101
1120
|
});
|
|
1121
|
+
this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'findOptions', (original_findOptions) => {
|
|
1122
|
+
return {
|
|
1123
|
+
...original_findOptions,
|
|
1124
|
+
caseSensitive: !!this.adaptableOptions.quickSearchOptions.isQuickSearchCaseSensitive,
|
|
1125
|
+
};
|
|
1126
|
+
});
|
|
1102
1127
|
}
|
|
1103
1128
|
/**
|
|
1104
1129
|
* Either initializes the AG Grid instance or delegates it to the framework wrappers (React/Anglar)
|
|
@@ -1300,6 +1325,17 @@ You need to define at least one Layout!`);
|
|
|
1300
1325
|
}
|
|
1301
1326
|
this.autoSizeLayoutIfNeeded();
|
|
1302
1327
|
}));
|
|
1328
|
+
/**
|
|
1329
|
+
* Use Case: A format column that has ColumnGroupState needs to be re-evaluated
|
|
1330
|
+
* whenever a column group is expanded or collapsed
|
|
1331
|
+
*/
|
|
1332
|
+
this.agGridAdapter.getAgGridApi().addEventListener('columnGroupOpened', (this.listenerColumnGroupOpened = () => {
|
|
1333
|
+
if (this.api.formatColumnApi.getActiveFormatColumns().some((fc) => {
|
|
1334
|
+
return fc.ColumnGroupState != null;
|
|
1335
|
+
})) {
|
|
1336
|
+
this.updateColumnModelAndRefreshGrid();
|
|
1337
|
+
}
|
|
1338
|
+
}));
|
|
1303
1339
|
/**
|
|
1304
1340
|
* Use Case: A pivot column has changed
|
|
1305
1341
|
* Action: Autosize pivot columns (if autosize pivot in Layout is true)
|
|
@@ -1562,13 +1598,9 @@ You need to define at least one Layout!`);
|
|
|
1562
1598
|
const autoGroupColumns = gridApi
|
|
1563
1599
|
.getAllGridColumns()
|
|
1564
1600
|
.filter((column) => this.api.columnApi.isAutoRowGroupColumn(column.getColId()));
|
|
1565
|
-
|
|
1566
|
-
agGridCols = [...agGridCols, ...pivotResultColumns, ...autoGroupColumns];
|
|
1567
|
-
}
|
|
1601
|
+
agGridCols = [...autoGroupColumns, ...agGridCols, ...pivotResultColumns];
|
|
1568
1602
|
}
|
|
1569
|
-
const columnGroupChildren = gridApi
|
|
1570
|
-
// TODO AFL MIG: check why this assertion is here
|
|
1571
|
-
.getAllDisplayedColumnGroups();
|
|
1603
|
+
const columnGroupChildren = gridApi.getAllDisplayedColumnGroups();
|
|
1572
1604
|
const groupsCount = {};
|
|
1573
1605
|
const colsToGroups = (columnGroupChildren ?? []).reduce((acc, columnGroup) => {
|
|
1574
1606
|
if (!columnGroup.getProvidedColumnGroup?.()?.getColGroupDef()) {
|
|
@@ -1639,13 +1671,18 @@ You need to define at least one Layout!`);
|
|
|
1639
1671
|
let _rawValue;
|
|
1640
1672
|
let _displayValue;
|
|
1641
1673
|
let _normalisedValue;
|
|
1642
|
-
let _isPivotCell;
|
|
1643
1674
|
let _isRowGroupCell;
|
|
1675
|
+
const _isPivotCell = this.api.columnApi.isPivotResultColumn(columnId);
|
|
1644
1676
|
const self = this;
|
|
1645
1677
|
const api = this.api;
|
|
1646
1678
|
const getRawValue = () => {
|
|
1647
1679
|
if (_rawValue === undefined) {
|
|
1648
1680
|
_rawValue = self.getRawValueFromRowNode(rowNode, columnId);
|
|
1681
|
+
if (_isPivotCell && _rawValue?.value != undefined) {
|
|
1682
|
+
// for pivot result columns, the raw value is an object with a value property
|
|
1683
|
+
// we want to return the value property as the raw value
|
|
1684
|
+
_rawValue = _rawValue.value;
|
|
1685
|
+
}
|
|
1649
1686
|
}
|
|
1650
1687
|
return _rawValue;
|
|
1651
1688
|
};
|
|
@@ -1684,9 +1721,6 @@ You need to define at least one Layout!`);
|
|
|
1684
1721
|
return _primaryKeyValue;
|
|
1685
1722
|
},
|
|
1686
1723
|
get isPivotCell() {
|
|
1687
|
-
if (_isPivotCell === undefined) {
|
|
1688
|
-
_isPivotCell = api.columnApi.isPivotResultColumn(columnId);
|
|
1689
|
-
}
|
|
1690
1724
|
return _isPivotCell;
|
|
1691
1725
|
},
|
|
1692
1726
|
get isRowGroupCell() {
|
|
@@ -1755,6 +1789,26 @@ You need to define at least one Layout!`);
|
|
|
1755
1789
|
return formattedValue || '';
|
|
1756
1790
|
}
|
|
1757
1791
|
}
|
|
1792
|
+
else if (this.api.columnApi.isPivotResultColumn(columnId)) {
|
|
1793
|
+
const pivotResultColumn = this.agGridAdapter
|
|
1794
|
+
.getAgGridApi()
|
|
1795
|
+
.getPivotResultColumns()
|
|
1796
|
+
.find((col) => col.getColId() === columnId);
|
|
1797
|
+
const pivotResultColDef = pivotResultColumn?.getColDef();
|
|
1798
|
+
if (pivotResultColDef && typeof pivotResultColDef.valueFormatter === 'function') {
|
|
1799
|
+
const params = {
|
|
1800
|
+
value: rawValue,
|
|
1801
|
+
node: rowNode,
|
|
1802
|
+
data: rowNode.data,
|
|
1803
|
+
colDef: pivotResultColDef,
|
|
1804
|
+
column: pivotResultColumn,
|
|
1805
|
+
api: this.agGridAdapter.getAgGridApi(),
|
|
1806
|
+
context: this.agGridAdapter.getGridOption('context'),
|
|
1807
|
+
};
|
|
1808
|
+
const formattedValue = pivotResultColDef.valueFormatter(params);
|
|
1809
|
+
return formattedValue || '';
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1758
1812
|
return this.getCleanValue(rawValue);
|
|
1759
1813
|
}
|
|
1760
1814
|
getCleanValue(value) {
|
|
@@ -2276,8 +2330,9 @@ You need to define at least one Layout!`);
|
|
|
2276
2330
|
}
|
|
2277
2331
|
getDistinctGridCellsForColumn(column) {
|
|
2278
2332
|
let gridCells = [];
|
|
2333
|
+
const isPivotResultColumn = column.isGeneratedPivotResultColumn;
|
|
2279
2334
|
this.agGridAdapter.getAgGridApi().forEachNode((rowNode) => {
|
|
2280
|
-
const gridCell = this.addDistinctColumnValue(rowNode, column.columnId);
|
|
2335
|
+
const gridCell = this.addDistinctColumnValue(rowNode, column.columnId, isPivotResultColumn);
|
|
2281
2336
|
if (gridCell) {
|
|
2282
2337
|
gridCells.push(gridCell);
|
|
2283
2338
|
}
|
|
@@ -2302,17 +2357,36 @@ You need to define at least one Layout!`);
|
|
|
2302
2357
|
return gridCells;
|
|
2303
2358
|
}
|
|
2304
2359
|
}
|
|
2305
|
-
addDistinctColumnValue(rowNode, columnId) {
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
if (
|
|
2311
|
-
|
|
2360
|
+
addDistinctColumnValue(rowNode, columnId, isPivotResultColumn) {
|
|
2361
|
+
if (!rowNode) {
|
|
2362
|
+
return;
|
|
2363
|
+
}
|
|
2364
|
+
if (!isPivotResultColumn && this.isGroupRowNode(rowNode)) {
|
|
2365
|
+
if (this.api.gridApi.isTreeDataGrid()) {
|
|
2366
|
+
if (rowNode.data == undefined) {
|
|
2367
|
+
// skip Tree Filler Groups
|
|
2368
|
+
// see https://www.ag-grid.com/javascript-data-grid/tree-data-paths/#filler-groups
|
|
2369
|
+
return;
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
else {
|
|
2373
|
+
// for normal Table Columns we do NOT return the values of the aggregates
|
|
2374
|
+
return;
|
|
2312
2375
|
}
|
|
2313
2376
|
}
|
|
2314
|
-
|
|
2315
|
-
|
|
2377
|
+
if (isPivotResultColumn) {
|
|
2378
|
+
// if it's a Pivot Result Column, we are interested only in the aggregated(pivoted) data
|
|
2379
|
+
if (!rowNode.aggData) {
|
|
2380
|
+
return;
|
|
2381
|
+
}
|
|
2382
|
+
if (!rowNode.leafGroup) {
|
|
2383
|
+
// if it's a Pivot Result Column, we are interested only in the leaf groups (pivot results, NOT group aggregates)
|
|
2384
|
+
return;
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
const returnValue = this.getGridCellFromRowNode(rowNode, columnId);
|
|
2388
|
+
if (Helper_1.Helper.objectExists(returnValue)) {
|
|
2389
|
+
return returnValue;
|
|
2316
2390
|
}
|
|
2317
2391
|
}
|
|
2318
2392
|
getUniqueGridCells(column, gridCells) {
|
|
@@ -2675,6 +2749,9 @@ You need to define at least one Layout!`);
|
|
|
2675
2749
|
clearAgGridQuickSearch() {
|
|
2676
2750
|
this.setAgGridQuickSearch('');
|
|
2677
2751
|
}
|
|
2752
|
+
setAgGridFindSearchValue(searchText) {
|
|
2753
|
+
this.agGridAdapter.setGridOption('findSearchValue', searchText);
|
|
2754
|
+
}
|
|
2678
2755
|
applyAdaptableTheme(theme) {
|
|
2679
2756
|
const container = this.getAgGridContainerElement();
|
|
2680
2757
|
if (container != null) {
|
|
@@ -2843,10 +2920,12 @@ You need to define at least one Layout!`);
|
|
|
2843
2920
|
agGridApi.removeEventListener('columnPivotChanged', this.listenerPivotChanged);
|
|
2844
2921
|
agGridApi.removeEventListener('cellEditingStarted', this.listenerCellEditingStarted);
|
|
2845
2922
|
agGridApi.removeEventListener('cellSelectionChanged', this.listenerCellSelectionChanged);
|
|
2923
|
+
agGridApi.removeEventListener('columnGroupOpened', this.listenerColumnGroupOpened);
|
|
2846
2924
|
agGridApi.removeEventListener('sortChanged', this.listenerSortChanged);
|
|
2847
2925
|
agGridApi.removeGlobalListener(this.listenerGlobalSetRowSelection);
|
|
2848
2926
|
this.listenerFirstDataRendered = null;
|
|
2849
2927
|
this.listenerPivotChanged = null;
|
|
2928
|
+
this.listenerColumnGroupOpened = null;
|
|
2850
2929
|
this.listenerCellEditingStarted = null;
|
|
2851
2930
|
this.listenerCellSelectionChanged = null;
|
|
2852
2931
|
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(
|
|
27
|
+
monkeyPatchingGridOptionsUpdates(): void;
|
|
28
|
+
monkeyPatchingAggColumnFilters(): void;
|
|
26
29
|
private DANGER_getPrivateAgGridBeans;
|
|
27
30
|
DANGER_getLiveGridOptions(): GridOptions<any>;
|
|
28
31
|
isAgGridModuleRegistered(moduleName: ModuleName): boolean;
|
|
@@ -20,6 +20,8 @@ class AgGridAdapter {
|
|
|
20
20
|
constructor(_adaptableInstance, config) {
|
|
21
21
|
this._adaptableInstance = _adaptableInstance;
|
|
22
22
|
const columnApiModuleReference = config?.getAgGridColumnApiModuleReference?.() ?? getColumnApiModule();
|
|
23
|
+
const beans = columnApiModuleReference?.beans;
|
|
24
|
+
console.log(beans?.length);
|
|
23
25
|
const ColumnDefFactory_Prototype = columnApiModuleReference?.beans?.[0]?.prototype;
|
|
24
26
|
if (!ColumnDefFactory_Prototype) {
|
|
25
27
|
console.error(`CRITICAL: could not get hold of AG Grid beans, this should never happen!`);
|
|
@@ -42,6 +44,8 @@ class AgGridAdapter {
|
|
|
42
44
|
this.DANGER_gridApi_from_args = null;
|
|
43
45
|
this.DANGER_USE_GETTER_gridApi = null;
|
|
44
46
|
this.DANGER_updateGridOptionsMonkeyPatcher = null;
|
|
47
|
+
this.DANGER_doAggregateFiltersPassMonkeyPatcher = null;
|
|
48
|
+
this.DANGER_isAggregateFilterPresentMonkeyPatcher = null;
|
|
45
49
|
this._adaptableInstance = null;
|
|
46
50
|
}
|
|
47
51
|
get adaptableOptions() {
|
|
@@ -75,7 +79,7 @@ class AgGridAdapter {
|
|
|
75
79
|
}
|
|
76
80
|
// #gridOpts_monkey_patch
|
|
77
81
|
// we need to intercept some of the GridOptions updates and refresh the Adaptable state
|
|
78
|
-
monkeyPatchingGridOptionsUpdates(
|
|
82
|
+
monkeyPatchingGridOptionsUpdates() {
|
|
79
83
|
const agGridOptionsService = this.DANGER_getPrivateAgGridBeans()?.gos;
|
|
80
84
|
if (!agGridOptionsService) {
|
|
81
85
|
return;
|
|
@@ -111,6 +115,57 @@ class AgGridAdapter {
|
|
|
111
115
|
};
|
|
112
116
|
agGridOptionsService.updateGridOptions = this.DANGER_updateGridOptionsMonkeyPatcher;
|
|
113
117
|
}
|
|
118
|
+
monkeyPatchingAggColumnFilters() {
|
|
119
|
+
if (!this.adaptableApi.optionsApi.getFilterOptions().useAdaptableFiltering) {
|
|
120
|
+
// monkey patching is only needed if Adaptable is used for filtering
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const agGridColumnFilterService = this.DANGER_getPrivateAgGridBeans()?.colFilter;
|
|
124
|
+
if (!agGridColumnFilterService) {
|
|
125
|
+
this.logger.consoleError('Could not get hold of ColumnFilterService! This is a critical error and will prevent Adaptable from working correctly.');
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const self = this;
|
|
129
|
+
// https://github.com/ag-grid/ag-grid/blob/8409e99c8010473356a878e9bdfb836a5ea16718/packages/ag-grid-community/src/filter/columnFilterService.ts#L240
|
|
130
|
+
// monkey patch ColumnFilterService.doAggregateFiltersPass because currently Adaptable does NOT override the ColumnFilters
|
|
131
|
+
// (it uses the `doesExternalFilterPass` to evaluate the filters on the client side)
|
|
132
|
+
// #doAggregateFiltersPassMonkeyPatcher
|
|
133
|
+
this.DANGER_doAggregateFiltersPassMonkeyPatcher = function (rowNode, filterToSkip) {
|
|
134
|
+
if (!self.adaptableApi.layoutApi.isCurrentLayoutPivot()) {
|
|
135
|
+
// should NEVER happen
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
const pivotColumnFilters = self.adaptableApi.filterApi.columnFilterApi
|
|
139
|
+
.getActiveColumnFilters()
|
|
140
|
+
.filter((columnFilter) => self.adaptableApi.columnApi.isPivotResultColumn(columnFilter.ColumnId));
|
|
141
|
+
try {
|
|
142
|
+
if (pivotColumnFilters.length > 0) {
|
|
143
|
+
for (const columnFilter of pivotColumnFilters) {
|
|
144
|
+
const evaluateColumnFilterOnClient = self.adaptableApi.expressionApi.internalApi.shouldEvaluatePredicatesInAdaptableQL('ColumnFilter', columnFilter, columnFilter.Predicates);
|
|
145
|
+
if (evaluateColumnFilterOnClient) {
|
|
146
|
+
const columnFilterEvaluationResult = self.adaptableApi.filterApi.columnFilterApi.internalApi.evaluateColumnFilter(columnFilter, rowNode);
|
|
147
|
+
if (!columnFilterEvaluationResult) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
catch (ex) {
|
|
155
|
+
self.logger.error(ex);
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
return true;
|
|
159
|
+
};
|
|
160
|
+
agGridColumnFilterService.doAggregateFiltersPass =
|
|
161
|
+
this.DANGER_doAggregateFiltersPassMonkeyPatcher;
|
|
162
|
+
this.DANGER_isAggregateFilterPresentMonkeyPatcher = function () {
|
|
163
|
+
const columnFilters = self.adaptableApi.filterApi.columnFilterApi.getActiveColumnFilters();
|
|
164
|
+
return columnFilters.some((colFilter) => self.adaptableApi.columnApi.isPivotResultColumn(colFilter.ColumnId));
|
|
165
|
+
};
|
|
166
|
+
agGridColumnFilterService.isAggregateFilterPresent =
|
|
167
|
+
this.DANGER_isAggregateFilterPresentMonkeyPatcher;
|
|
168
|
+
}
|
|
114
169
|
DANGER_getPrivateAgGridBeans() {
|
|
115
170
|
const beans = DANGER_AG_GRID_BEANS_MAP[this._agGridId];
|
|
116
171
|
if (!beans) {
|
|
@@ -163,12 +218,21 @@ class AgGridAdapter {
|
|
|
163
218
|
}
|
|
164
219
|
}
|
|
165
220
|
updateGridOptions(options) {
|
|
221
|
+
if (this.getAgGridApi()?.isDestroyed()) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
166
224
|
this.getAgGridApi()?.updateGridOptions(options);
|
|
167
225
|
}
|
|
168
226
|
getGridOption(key) {
|
|
227
|
+
if (this.getAgGridApi()?.isDestroyed()) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
169
230
|
return this.getAgGridApi()?.getGridOption(key);
|
|
170
231
|
}
|
|
171
232
|
setGridOption(key, value) {
|
|
233
|
+
if (this.getAgGridApi()?.isDestroyed()) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
172
236
|
this.getAgGridApi()?.setGridOption(key, value);
|
|
173
237
|
}
|
|
174
238
|
getUserGridOptionsProperty(propertyName) {
|
|
@@ -457,10 +521,21 @@ class AgGridAdapter {
|
|
|
457
521
|
this.logger.warn(`Column is undefined, returning 'text' for Type`);
|
|
458
522
|
return 'text';
|
|
459
523
|
}
|
|
460
|
-
if (agColumn.getId()
|
|
461
|
-
agColumn.getId()
|
|
524
|
+
if (this.adaptableApi.columnApi.isAutoRowGroupColumnForSingle(agColumn.getId()) ||
|
|
525
|
+
this.adaptableApi.columnApi.isSelectionColumn(agColumn.getId())) {
|
|
462
526
|
return 'unknown';
|
|
463
527
|
}
|
|
528
|
+
if (this.adaptableApi.columnApi.isAutoRowGroupColumnForMulti(agColumn.getId())) {
|
|
529
|
+
const rowGroupKey = agColumn.getColDef().showRowGroup;
|
|
530
|
+
if (typeof rowGroupKey !== 'string') {
|
|
531
|
+
return 'unknown';
|
|
532
|
+
}
|
|
533
|
+
const groupedColumn = this.adaptableApi.agGridApi.getColumn(rowGroupKey);
|
|
534
|
+
if (!groupedColumn) {
|
|
535
|
+
return 'unknown';
|
|
536
|
+
}
|
|
537
|
+
return this.deriveAdaptableColumnDataType(groupedColumn, logWarning);
|
|
538
|
+
}
|
|
464
539
|
const colDefType = [].concat(agColumn.getColDef()?.type || []).filter(Boolean);
|
|
465
540
|
const skippedSpecialCols = ['actionColumn', 'fdc3Column'];
|
|
466
541
|
if (skippedSpecialCols.some((specialColType) => colDefType.includes(specialColType))) {
|
|
@@ -487,15 +562,17 @@ class AgGridAdapter {
|
|
|
487
562
|
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.`);
|
|
488
563
|
return 'unknown';
|
|
489
564
|
}
|
|
490
|
-
// if it's a group we need the content of the group
|
|
491
|
-
if (row.group) {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
}
|
|
565
|
+
// // if it's a group we need the content of the group
|
|
566
|
+
// if (row.group) {
|
|
567
|
+
// const childNodes = row.childrenAfterGroup;
|
|
568
|
+
// if (ArrayExtensions.IsNullOrEmpty(childNodes)) {
|
|
569
|
+
// this.logger.consoleError(
|
|
570
|
+
// `No data in grid, returning type "unknown" for Column: "${agColumn.getColId()}". This will impact several Adaptable features, such as Filters and ColumnFormats.`
|
|
571
|
+
// );
|
|
572
|
+
// return 'unknown';
|
|
573
|
+
// }
|
|
574
|
+
// row = childNodes[0];
|
|
575
|
+
// }
|
|
499
576
|
const value = this._agGridApi_getValue(agColumn, row);
|
|
500
577
|
switch (typeof value) {
|
|
501
578
|
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;
|