@adaptabletools/adaptable-cjs 21.2.0 → 21.2.2-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/package.json +1 -1
- package/src/AdaptableState/Common/AdaptablePredicate.js +8 -1
- package/src/Api/Implementation/PredicateApiImpl.d.ts +1 -0
- package/src/Api/Implementation/PredicateApiImpl.js +17 -2
- package/src/Api/Internal/ColumnFilterInternalApi.js +1 -0
- package/src/Api/Internal/LayoutInternalApi.d.ts +1 -0
- package/src/Api/Internal/LayoutInternalApi.js +9 -0
- package/src/agGrid/AdaptableAgGrid.d.ts +11 -1
- package/src/agGrid/AdaptableAgGrid.js +63 -9
- package/src/agGrid/AdaptableFilterHandler.d.ts +1 -0
- package/src/agGrid/AdaptableFilterHandler.js +15 -5
- package/src/agGrid/AgGridAdapter.d.ts +2 -0
- package/src/agGrid/AgGridAdapter.js +29 -15
- package/src/env.js +2 -2
- package/src/layout-manager/src/index.d.ts +6 -0
- package/src/layout-manager/src/index.js +20 -0
- package/tsconfig.cjs.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable-cjs",
|
|
3
|
-
"version": "21.2.0",
|
|
3
|
+
"version": "21.2.2-canary.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",
|
|
@@ -89,7 +89,14 @@ exports.SystemPredicateDefs = [
|
|
|
89
89
|
if (column.columnId === GeneralConstants_1.AG_GRID_GROUPED_COLUMN) {
|
|
90
90
|
const { node, treeSelectionState } = context;
|
|
91
91
|
const groupValues = getGroupValuesForNode({ node, value });
|
|
92
|
-
|
|
92
|
+
// for non-trees, this line is reached for every leaf-row
|
|
93
|
+
// so for 2 levels-deep, groupValues is an array of ['level1-value','level2-value','leaf-value']
|
|
94
|
+
// but for trees, the groupValues is first an array with only
|
|
95
|
+
// one value, the current branch root - and if we go via the treeSelectionState
|
|
96
|
+
// that root might have a leaf selected, but if we return true here
|
|
97
|
+
// ag grid would include all rows of that branch - which is not what we want
|
|
98
|
+
// so we want to enter the `if` block and use the startsWith check
|
|
99
|
+
if (column.isTreeColumn || !treeSelectionState) {
|
|
93
100
|
// in case we don't have treeSelectionState
|
|
94
101
|
// this is another possible implementation
|
|
95
102
|
// though it won't be as performant as using the treeSelectionState
|
|
@@ -4,6 +4,7 @@ import { AdaptableColumnPredicate, AdaptablePredicate, AdaptablePredicateDef, Pr
|
|
|
4
4
|
import { IAdaptable } from '../../AdaptableInterfaces/IAdaptable';
|
|
5
5
|
import { PredicateInternalApi } from '../Internal/PredicateInternalApi';
|
|
6
6
|
import { TreeSelectionState } from '@infinite-table/infinite-react';
|
|
7
|
+
export declare const clearPredicateDefMapMemo: () => void;
|
|
7
8
|
export declare const getTreeSelectionStateForPredicateInputs: (inputs: any[], cache?: WeakMap<any[], TreeSelectionState>) => TreeSelectionState<any>;
|
|
8
9
|
export declare class PredicateApiImpl extends ApiBase implements PredicateApi {
|
|
9
10
|
internalApi: PredicateInternalApi;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PredicateApiImpl = exports.getTreeSelectionStateForPredicateInputs = void 0;
|
|
3
|
+
exports.PredicateApiImpl = exports.getTreeSelectionStateForPredicateInputs = exports.clearPredicateDefMapMemo = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const ApiBase_1 = require("./ApiBase");
|
|
6
6
|
const ArrayExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/ArrayExtensions"));
|
|
@@ -9,6 +9,11 @@ const PredicateInternalApi_1 = require("../Internal/PredicateInternalApi");
|
|
|
9
9
|
const AdaptablePredicate_1 = require("../../AdaptableState/Common/AdaptablePredicate");
|
|
10
10
|
const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
|
|
11
11
|
const infinite_react_1 = require("@infinite-table/infinite-react");
|
|
12
|
+
const predicateDefMap_MEMO = new Map();
|
|
13
|
+
const clearPredicateDefMapMemo = () => {
|
|
14
|
+
predicateDefMap_MEMO.clear();
|
|
15
|
+
};
|
|
16
|
+
exports.clearPredicateDefMapMemo = clearPredicateDefMapMemo;
|
|
12
17
|
const treeSelectionStatesForPredicates = new WeakMap();
|
|
13
18
|
const getTreeSelectionStateForPredicateInputs = (inputs, cache = treeSelectionStatesForPredicates) => {
|
|
14
19
|
const treeSelectionState = cache.get(inputs);
|
|
@@ -141,7 +146,14 @@ class PredicateApiImpl extends ApiBase_1.ApiBase {
|
|
|
141
146
|
if (!predicate) {
|
|
142
147
|
return defaultReturn;
|
|
143
148
|
}
|
|
144
|
-
|
|
149
|
+
// memoization to avoid repeated lookups
|
|
150
|
+
// during filtering of large datasets
|
|
151
|
+
// see #column_filter_predicates_evaluation
|
|
152
|
+
let predicateDef = predicateDefMap_MEMO.get(predicate.PredicateId);
|
|
153
|
+
if (predicateDef === undefined) {
|
|
154
|
+
predicateDef = this.getPredicateDefById(predicate.PredicateId);
|
|
155
|
+
predicateDefMap_MEMO.set(predicate.PredicateId, predicateDef);
|
|
156
|
+
}
|
|
145
157
|
if (predicateDef === undefined) {
|
|
146
158
|
return defaultReturn;
|
|
147
159
|
}
|
|
@@ -169,6 +181,9 @@ class PredicateApiImpl extends ApiBase_1.ApiBase {
|
|
|
169
181
|
if (predicates === undefined || predicates === null || predicates?.length === 0) {
|
|
170
182
|
return this.handlePredicate(undefined, params, defaultReturn);
|
|
171
183
|
}
|
|
184
|
+
if (predicates.length === 1) {
|
|
185
|
+
return this.handlePredicate(predicates[0], params, defaultReturn);
|
|
186
|
+
}
|
|
172
187
|
if (params.predicatesOperator && params.predicatesOperator === 'OR') {
|
|
173
188
|
return predicates?.some((p) => this.handlePredicate(p, params, defaultReturn));
|
|
174
189
|
}
|
|
@@ -101,6 +101,7 @@ class ColumnFilterInternalApi extends ApiBase_1.ApiBase {
|
|
|
101
101
|
predicatesOperator: columnFilter.PredicatesOperator,
|
|
102
102
|
...this.getAdaptableInternalApi().buildBaseContext(),
|
|
103
103
|
};
|
|
104
|
+
// #column_filter_predicates_evaluation
|
|
104
105
|
return this.getPredicateApi().handlePredicates(columnFilter.Predicates, predicateDefHandlerContext, true);
|
|
105
106
|
}
|
|
106
107
|
/**
|
|
@@ -190,5 +190,14 @@ class LayoutInternalApi extends ApiBase_1.ApiBase {
|
|
|
190
190
|
delete result.Name;
|
|
191
191
|
return result;
|
|
192
192
|
}
|
|
193
|
+
getCurrentLayout_perfOptimized() {
|
|
194
|
+
// perf-optimized version of getCurrentLayout()
|
|
195
|
+
const layoutState = this.getAdaptableState().Layout;
|
|
196
|
+
const currentLayoutName = layoutState.CurrentLayout;
|
|
197
|
+
if (!currentLayoutName) {
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
return layoutState.Layouts.find((layout) => layout.Name === currentLayoutName);
|
|
201
|
+
}
|
|
193
202
|
}
|
|
194
203
|
exports.LayoutInternalApi = LayoutInternalApi;
|
|
@@ -149,9 +149,19 @@ export declare class AdaptableAgGrid implements IAdaptable {
|
|
|
149
149
|
private normaliseToolPanelState;
|
|
150
150
|
private getCurrentLayoutModel;
|
|
151
151
|
silentUpdateCurrentLayoutModel(layoutModel?: TableLayoutModel | PivotLayoutModel): void;
|
|
152
|
+
/**
|
|
153
|
+
* Returns TRUE if filtering was applied, FALSE otherwise
|
|
154
|
+
* This is important in the INIT phase because applying filtering will automatically refresh AG Grids columnState,
|
|
155
|
+
* implicitly refreshing the sorting state too (hence we don't need to apply sorting separately)
|
|
156
|
+
*/
|
|
152
157
|
applyFiltering(config?: {
|
|
153
158
|
updateColumnFilterModel?: boolean;
|
|
154
|
-
}):
|
|
159
|
+
}): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Checks if the current layout has ColumnSorts for columns that have CustomSort defined
|
|
162
|
+
* (either via initialState CustomSorts or via customSortComparers option) and refreshes the sort if needed.
|
|
163
|
+
*/
|
|
164
|
+
private refreshInitialSortIfNeeded;
|
|
155
165
|
showQuickFilter(): void;
|
|
156
166
|
hideQuickFilter(): void;
|
|
157
167
|
private normalizeAdaptableOptions;
|
|
@@ -106,6 +106,7 @@ const AgGridModulesAdapter_1 = require("./AgGridModulesAdapter");
|
|
|
106
106
|
const devTools_1 = require("../devTools");
|
|
107
107
|
const infinite_react_1 = require("@infinite-table/infinite-react");
|
|
108
108
|
const FormatHelper_1 = require("../Utilities/Helpers/FormatHelper");
|
|
109
|
+
const PredicateApiImpl_1 = require("../Api/Implementation/PredicateApiImpl");
|
|
109
110
|
const LocalEventService_Prototype = ag_grid_enterprise_1.LocalEventService.prototype;
|
|
110
111
|
const LocalEventService_dispatchEvent = LocalEventService_Prototype.dispatchEvent;
|
|
111
112
|
LocalEventService_Prototype.dispatchEvent = function (event) {
|
|
@@ -450,10 +451,14 @@ class AdaptableAgGrid {
|
|
|
450
451
|
this.api.themeApi.applyCurrentTheme();
|
|
451
452
|
this.validatePrimaryKey();
|
|
452
453
|
this.checkShouldClearExistingFiltersOrSearches();
|
|
453
|
-
// FIXME AFL FILTER: talk with Radu: should ColumnFilters still be ignored?!
|
|
454
|
-
// see layoutModel.Ignore_ColumnFilters
|
|
455
454
|
// initial filter model
|
|
456
|
-
this.applyFiltering();
|
|
455
|
+
const filteringApplied = this.applyFiltering();
|
|
456
|
+
// We may need to re-apply sort if there are ColumnSorts for columns with CustomSort defined
|
|
457
|
+
// This is required because AG Grid wasn't aware of the CustomSort when applying sorting initially
|
|
458
|
+
// this is not required when filtering was applied because filtering also triggers a sort refresh internally
|
|
459
|
+
if (!filteringApplied) {
|
|
460
|
+
this.refreshInitialSortIfNeeded();
|
|
461
|
+
}
|
|
457
462
|
// apply quick search if there is one
|
|
458
463
|
// yes, we could have put this on the gridOptions.findSearchValue
|
|
459
464
|
// but we need to wait for setupColumns to run first so as to correctly
|
|
@@ -625,26 +630,67 @@ You need to define at least one Layout!`);
|
|
|
625
630
|
normalize: true,
|
|
626
631
|
});
|
|
627
632
|
}
|
|
633
|
+
/**
|
|
634
|
+
* Returns TRUE if filtering was applied, FALSE otherwise
|
|
635
|
+
* This is important in the INIT phase because applying filtering will automatically refresh AG Grids columnState,
|
|
636
|
+
* implicitly refreshing the sorting state too (hence we don't need to apply sorting separately)
|
|
637
|
+
*/
|
|
628
638
|
applyFiltering(config) {
|
|
639
|
+
let filteringApplied = false;
|
|
629
640
|
// default updateColumnFilterModel to TRUE, if not provided
|
|
630
641
|
const updateColumnFilterModel = config?.updateColumnFilterModel ?? true;
|
|
631
642
|
const agGridApi = this.agGridAdapter.getAgGridApi();
|
|
632
643
|
if (updateColumnFilterModel) {
|
|
633
644
|
const columnFilters = this.api.filterApi.columnFilterApi
|
|
634
645
|
.getActiveColumnFilters()
|
|
635
|
-
//
|
|
646
|
+
// we need this additional filter because 'getActiveColumnFilters' checks only for suspended while 'isColumnFilterActive' also checkss for COMPLETE filters
|
|
636
647
|
.filter((columnFilter) => this.api.filterApi.columnFilterApi.isColumnFilterActive(columnFilter));
|
|
637
648
|
const filterModel = {};
|
|
638
649
|
columnFilters.forEach((columnFilter) => {
|
|
639
650
|
filterModel[columnFilter.ColumnId] = columnFilter;
|
|
640
651
|
});
|
|
641
652
|
agGridApi.setFilterModel(filterModel);
|
|
653
|
+
filteringApplied = Object.keys(filterModel).length > 0;
|
|
642
654
|
}
|
|
643
655
|
// FIXME AFL FILTER why is this needed???
|
|
644
656
|
this.refreshSelectedCellsState();
|
|
645
657
|
this.refreshSelectedRowsState();
|
|
646
|
-
|
|
658
|
+
// FIXME AFL: this is temporary, will be replaced with v22's new autoCol filtering
|
|
659
|
+
const currentPivotLayoutHasAutoCols = this.api.layoutApi.isCurrentLayoutPivot() &&
|
|
660
|
+
!!this.api.layoutApi.getCurrentRowGroupsColumnIds()?.length;
|
|
661
|
+
// agGridApi.setFilterModel() already triggered onFilterChanged(), so we skip it if updateColumnFilterModel is TRUE
|
|
662
|
+
if (!filteringApplied || currentPivotLayoutHasAutoCols) {
|
|
663
|
+
agGridApi.onFilterChanged();
|
|
664
|
+
filteringApplied = true;
|
|
665
|
+
}
|
|
647
666
|
this._emit('AdapTableFiltersApplied');
|
|
667
|
+
return filteringApplied;
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Checks if the current layout has ColumnSorts for columns that have CustomSort defined
|
|
671
|
+
* (either via initialState CustomSorts or via customSortComparers option) and refreshes the sort if needed.
|
|
672
|
+
*/
|
|
673
|
+
refreshInitialSortIfNeeded() {
|
|
674
|
+
const currentLayout = this.api.layoutApi.getCurrentLayout();
|
|
675
|
+
const columnSorts = currentLayout?.ColumnSorts;
|
|
676
|
+
if (!columnSorts || columnSorts.length === 0) {
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
const hasCustomSortForSortedColumn = columnSorts.some((columnSort) => {
|
|
680
|
+
// Check if there's a CustomSort defined in state for this column
|
|
681
|
+
const customSort = this.api.customSortApi.getCustomSortForColumn(columnSort.ColumnId);
|
|
682
|
+
if (customSort && !customSort.IsSuspended) {
|
|
683
|
+
return true;
|
|
684
|
+
}
|
|
685
|
+
// Check if there's a customSortComparer defined in options for this column
|
|
686
|
+
if (this.api.customSortApi.internalApi.columnHasCustomSortComparer(columnSort.ColumnId)) {
|
|
687
|
+
return true;
|
|
688
|
+
}
|
|
689
|
+
return false;
|
|
690
|
+
});
|
|
691
|
+
if (hasCustomSortForSortedColumn) {
|
|
692
|
+
this.layoutManager.refreshSort();
|
|
693
|
+
}
|
|
648
694
|
}
|
|
649
695
|
showQuickFilter() {
|
|
650
696
|
const height = this.api.optionsApi.getFilterOptions().columnFilterOptions.quickFilterHeight;
|
|
@@ -1768,14 +1814,21 @@ You need to define at least one Layout!`);
|
|
|
1768
1814
|
let _displayValue = defaults ? defaults.displayValue : undefined;
|
|
1769
1815
|
let _normalisedValue = defaults ? defaults.normalisedValue : undefined;
|
|
1770
1816
|
let _isRowGroupCell;
|
|
1771
|
-
|
|
1772
|
-
this.api.columnApi.isPivotAggColumnWithNoPivotColumns(columnId);
|
|
1817
|
+
let _isPivotCell;
|
|
1773
1818
|
const self = this;
|
|
1774
1819
|
const api = this.api;
|
|
1820
|
+
const getIsPivotCell = () => {
|
|
1821
|
+
if (_isPivotCell === undefined) {
|
|
1822
|
+
_isPivotCell =
|
|
1823
|
+
api.columnApi.isPivotResultColumn(columnId) ||
|
|
1824
|
+
api.columnApi.isPivotAggColumnWithNoPivotColumns(columnId);
|
|
1825
|
+
}
|
|
1826
|
+
return _isPivotCell;
|
|
1827
|
+
};
|
|
1775
1828
|
const getRawValue = () => {
|
|
1776
1829
|
if (_rawValue === undefined) {
|
|
1777
1830
|
_rawValue = self.getRawValueFromRowNode(rowNode, columnId);
|
|
1778
|
-
if (
|
|
1831
|
+
if (_rawValue?.value != undefined && getIsPivotCell()) {
|
|
1779
1832
|
// for pivot result columns, the raw value is an object with a value property
|
|
1780
1833
|
// we want to return the value property as the raw value
|
|
1781
1834
|
_rawValue = _rawValue.value;
|
|
@@ -1818,7 +1871,7 @@ You need to define at least one Layout!`);
|
|
|
1818
1871
|
return _primaryKeyValue;
|
|
1819
1872
|
},
|
|
1820
1873
|
get isPivotCell() {
|
|
1821
|
-
return
|
|
1874
|
+
return getIsPivotCell();
|
|
1822
1875
|
},
|
|
1823
1876
|
get isRowGroupCell() {
|
|
1824
1877
|
if (_isRowGroupCell === undefined) {
|
|
@@ -3390,6 +3443,7 @@ You need to define at least one Layout!`);
|
|
|
3390
3443
|
this.__prevLayoutForRefresh = undefined;
|
|
3391
3444
|
this.layoutManager?.destroy();
|
|
3392
3445
|
this.layoutManager = null;
|
|
3446
|
+
(0, PredicateApiImpl_1.clearPredicateDefMapMemo)();
|
|
3393
3447
|
const agGridApi = this.agGridAdapter?.getAgGridApi();
|
|
3394
3448
|
if (agGridApi && !agGridApi.isDestroyed()) {
|
|
3395
3449
|
agGridApi.removeEventListener('firstDataRendered', this.listenerFirstDataRendered);
|
|
@@ -8,6 +8,7 @@ export declare class AdaptableFilterHandler implements FilterHandler {
|
|
|
8
8
|
readonly colId: string;
|
|
9
9
|
private filterDisplayValuesResult;
|
|
10
10
|
private previousFilterDisplayValuesResult;
|
|
11
|
+
private currentColumnFilters_MEMO;
|
|
11
12
|
constructor(adaptableApi: AdaptableApi, columnSetup: ColumnSetupInfo);
|
|
12
13
|
getCurrentColumnFilters(): ColumnFilter[];
|
|
13
14
|
doesFilterPass(params: DoesFilterPassParams): boolean;
|
|
@@ -4,9 +4,17 @@ exports.AdaptableFilterHandler = void 0;
|
|
|
4
4
|
class AdaptableFilterHandler {
|
|
5
5
|
constructor(adaptableApi, columnSetup) {
|
|
6
6
|
this.adaptableApi = adaptableApi;
|
|
7
|
+
this.currentColumnFilters_MEMO = new WeakMap();
|
|
7
8
|
this.colId = columnSetup.colId;
|
|
8
9
|
}
|
|
9
10
|
getCurrentColumnFilters() {
|
|
11
|
+
// we memoize based on layout column filters object reference
|
|
12
|
+
// this method is called for each row during filtering so we need to optimize it
|
|
13
|
+
const layoutColumnFilters = this.adaptableApi.layoutApi.internalApi.getCurrentLayout_perfOptimized()?.ColumnFilters;
|
|
14
|
+
const memoizedColumnFilters = this.currentColumnFilters_MEMO.get(layoutColumnFilters);
|
|
15
|
+
if (memoizedColumnFilters) {
|
|
16
|
+
return memoizedColumnFilters;
|
|
17
|
+
}
|
|
10
18
|
const columnFilters = this.adaptableApi.filterApi.columnFilterApi
|
|
11
19
|
.getActiveColumnFilters()
|
|
12
20
|
.filter((columnFilter) => this.adaptableApi.filterApi.columnFilterApi.isColumnFilterActive(columnFilter))
|
|
@@ -15,6 +23,7 @@ class AdaptableFilterHandler {
|
|
|
15
23
|
const shouldEvaluateFilterOnClient = this.adaptableApi.expressionApi.internalApi.shouldEvaluatePredicatesInAdaptableQL('ColumnFilter', columnFilter, columnFilter.Predicates);
|
|
16
24
|
return shouldEvaluateFilterOnClient;
|
|
17
25
|
});
|
|
26
|
+
this.currentColumnFilters_MEMO.set(layoutColumnFilters, columnFilters);
|
|
18
27
|
return columnFilters;
|
|
19
28
|
}
|
|
20
29
|
doesFilterPass(params) {
|
|
@@ -26,11 +35,11 @@ class AdaptableFilterHandler {
|
|
|
26
35
|
return true;
|
|
27
36
|
}
|
|
28
37
|
const columnFilters = this.getCurrentColumnFilters();
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return
|
|
38
|
+
// #column_filter_predicates_evaluation
|
|
39
|
+
const allFiltersMatched = columnFilters.every((columnFilter) => {
|
|
40
|
+
return this.adaptableApi.filterApi.columnFilterApi.internalApi.evaluateColumnFilter(columnFilter, rowNode);
|
|
32
41
|
});
|
|
33
|
-
return
|
|
42
|
+
return allFiltersMatched;
|
|
34
43
|
}
|
|
35
44
|
catch (ex) {
|
|
36
45
|
this.adaptableApi.consoleError(ex);
|
|
@@ -49,7 +58,7 @@ class AdaptableFilterHandler {
|
|
|
49
58
|
}
|
|
50
59
|
return this.fetchFilterDisplayValues(options);
|
|
51
60
|
}
|
|
52
|
-
fetchFilterDisplayValues(options) {
|
|
61
|
+
async fetchFilterDisplayValues(options) {
|
|
53
62
|
return this.adaptableApi.gridApi.internalApi
|
|
54
63
|
.getDistinctFilterDisplayValuesForColumn({
|
|
55
64
|
columnId: this.colId,
|
|
@@ -91,6 +100,7 @@ class AdaptableFilterHandler {
|
|
|
91
100
|
destroy() {
|
|
92
101
|
this.filterDisplayValuesResult = undefined;
|
|
93
102
|
this.previousFilterDisplayValuesResult = undefined;
|
|
103
|
+
this.currentColumnFilters_MEMO = undefined;
|
|
94
104
|
}
|
|
95
105
|
}
|
|
96
106
|
exports.AdaptableFilterHandler = AdaptableFilterHandler;
|
|
@@ -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 activePivotColumnFilters_MEMO;
|
|
14
15
|
initialGridOptions: GridOptions;
|
|
15
16
|
private _agGridId;
|
|
16
17
|
constructor(_adaptableInstance: AdaptableAgGrid, config?: {
|
|
@@ -20,6 +21,7 @@ export declare class AgGridAdapter {
|
|
|
20
21
|
private get adaptableOptions();
|
|
21
22
|
private get adaptableApi();
|
|
22
23
|
private get logger();
|
|
24
|
+
private getActivePivotColumnFilters;
|
|
23
25
|
private get agGridOptionsService();
|
|
24
26
|
setAgGridId(agGridId: string): void;
|
|
25
27
|
setAgGridApi(gridApi: GridApi): void;
|
|
@@ -19,6 +19,7 @@ const getColumnApiModule = () => ag_grid_enterprise_1.ColumnApiModule;
|
|
|
19
19
|
class AgGridAdapter {
|
|
20
20
|
constructor(_adaptableInstance, config) {
|
|
21
21
|
this._adaptableInstance = _adaptableInstance;
|
|
22
|
+
this.activePivotColumnFilters_MEMO = new WeakMap();
|
|
22
23
|
const columnApiModuleReference = config?.getAgGridColumnApiModuleReference?.() ?? getColumnApiModule();
|
|
23
24
|
const ColumnDefFactory_Prototype = columnApiModuleReference?.beans?.[0]?.prototype;
|
|
24
25
|
if (!ColumnDefFactory_Prototype) {
|
|
@@ -44,6 +45,7 @@ class AgGridAdapter {
|
|
|
44
45
|
this.DANGER_updateGridOptionsMonkeyPatcher = null;
|
|
45
46
|
this.DANGER_doFiltersPassMonkeyPatcher = null;
|
|
46
47
|
this.DANGER_isAggFilterPresentMonkeyPatcher = null;
|
|
48
|
+
this.activePivotColumnFilters_MEMO = null;
|
|
47
49
|
this._adaptableInstance = null;
|
|
48
50
|
}
|
|
49
51
|
get adaptableOptions() {
|
|
@@ -55,6 +57,27 @@ class AgGridAdapter {
|
|
|
55
57
|
get logger() {
|
|
56
58
|
return this._adaptableInstance.logger;
|
|
57
59
|
}
|
|
60
|
+
getActivePivotColumnFilters() {
|
|
61
|
+
// we memoize based on layout column filters object reference
|
|
62
|
+
// this method is called for each row during filtering so we need to optimize it
|
|
63
|
+
const layoutColumnFilters = this.adaptableApi.layoutApi.internalApi.getCurrentLayout_perfOptimized()?.ColumnFilters;
|
|
64
|
+
if (!layoutColumnFilters) {
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
const memoizedColumnFilters = this.activePivotColumnFilters_MEMO.get(layoutColumnFilters);
|
|
68
|
+
if (memoizedColumnFilters) {
|
|
69
|
+
return memoizedColumnFilters;
|
|
70
|
+
}
|
|
71
|
+
const pivotColumnFilters = this.adaptableApi.filterApi.columnFilterApi
|
|
72
|
+
.getActiveColumnFilters()
|
|
73
|
+
.filter((columnFilter) => this.adaptableApi.columnApi.isPivotResultColumn(columnFilter.ColumnId) ||
|
|
74
|
+
this.adaptableApi.columnApi.isAutoRowGroupColumnForSingle(columnFilter.ColumnId) ||
|
|
75
|
+
this.adaptableApi.columnApi.isPivotAggColumnWithNoPivotColumns(columnFilter.ColumnId))
|
|
76
|
+
.filter((columnFilter) => this.adaptableApi.filterApi.columnFilterApi.isColumnFilterActive(columnFilter))
|
|
77
|
+
.filter((columnFilter) => this.adaptableApi.expressionApi.internalApi.shouldEvaluatePredicatesInAdaptableQL('ColumnFilter', columnFilter, columnFilter.Predicates));
|
|
78
|
+
this.activePivotColumnFilters_MEMO.set(layoutColumnFilters, pivotColumnFilters);
|
|
79
|
+
return pivotColumnFilters;
|
|
80
|
+
}
|
|
58
81
|
get agGridOptionsService() {
|
|
59
82
|
return this._adaptableInstance.agGridOptionsService;
|
|
60
83
|
}
|
|
@@ -155,21 +178,15 @@ class AgGridAdapter {
|
|
|
155
178
|
// should NEVER happen
|
|
156
179
|
return true;
|
|
157
180
|
}
|
|
158
|
-
const pivotColumnFilters = self.
|
|
159
|
-
.getActiveColumnFilters()
|
|
160
|
-
.filter((columnFilter) => self.adaptableApi.columnApi.isPivotResultColumn(columnFilter.ColumnId) ||
|
|
161
|
-
self.adaptableApi.columnApi.isAutoRowGroupColumnForSingle(columnFilter.ColumnId) ||
|
|
162
|
-
self.adaptableApi.columnApi.isPivotAggColumnWithNoPivotColumns(columnFilter.ColumnId));
|
|
181
|
+
const pivotColumnFilters = self.getActivePivotColumnFilters();
|
|
163
182
|
try {
|
|
164
183
|
if (pivotColumnFilters.length > 0) {
|
|
165
184
|
for (const columnFilter of pivotColumnFilters) {
|
|
166
|
-
const
|
|
167
|
-
if (
|
|
168
|
-
|
|
169
|
-
if (!columnFilterEvaluationResult) {
|
|
170
|
-
return false;
|
|
171
|
-
}
|
|
185
|
+
const columnFilterEvaluationResult = self.adaptableApi.filterApi.columnFilterApi.internalApi.evaluateColumnFilter(columnFilter, rowNode);
|
|
186
|
+
if (!columnFilterEvaluationResult) {
|
|
187
|
+
return false;
|
|
172
188
|
}
|
|
189
|
+
// else continue to next filter
|
|
173
190
|
}
|
|
174
191
|
}
|
|
175
192
|
}
|
|
@@ -181,10 +198,7 @@ class AgGridAdapter {
|
|
|
181
198
|
};
|
|
182
199
|
agGridColumnFilterService.doFiltersPass = this.DANGER_doFiltersPassMonkeyPatcher;
|
|
183
200
|
this.DANGER_isAggFilterPresentMonkeyPatcher = function () {
|
|
184
|
-
|
|
185
|
-
return columnFilters.some((colFilter) => self.adaptableApi.columnApi.isPivotResultColumn(colFilter.ColumnId) ||
|
|
186
|
-
self.adaptableApi.columnApi.isAutoRowGroupColumnForSingle(colFilter.ColumnId) ||
|
|
187
|
-
self.adaptableApi.columnApi.isPivotAggColumnWithNoPivotColumns(colFilter.ColumnId));
|
|
201
|
+
return self.getActivePivotColumnFilters().length > 0;
|
|
188
202
|
};
|
|
189
203
|
agGridColumnFilterService.isAggFilterPresent = this.DANGER_isAggFilterPresentMonkeyPatcher;
|
|
190
204
|
}
|
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:
|
|
6
|
-
VERSION: "21.2.0" || '--current-version--',
|
|
5
|
+
PUBLISH_TIMESTAMP: 1768333338805 || Date.now(),
|
|
6
|
+
VERSION: "21.2.2-canary.0" || '--current-version--',
|
|
7
7
|
};
|
|
@@ -87,6 +87,12 @@ export declare class LayoutManager<DATA_TYPE = any> extends LMEmitter {
|
|
|
87
87
|
applyPivotTotals(layout: PivotLayoutModel): void;
|
|
88
88
|
applyColumnGroupCollapseExpandState(layout: PivotLayoutModel | TableLayoutModel): void;
|
|
89
89
|
private withSuppressColumnAnimation;
|
|
90
|
+
private withSuppressRowAnimation;
|
|
91
|
+
/**
|
|
92
|
+
* Refreshes the sort order by refreshing the client side row model.
|
|
93
|
+
* This is useful when custom sort comparers are defined and the sort needs to be re-applied after filtering.
|
|
94
|
+
*/
|
|
95
|
+
refreshSort(): void;
|
|
90
96
|
private patchColDefType;
|
|
91
97
|
private setupPivotTotals;
|
|
92
98
|
private patchPivotAggregationTotal;
|
|
@@ -1633,6 +1633,26 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
1633
1633
|
}
|
|
1634
1634
|
return res;
|
|
1635
1635
|
}
|
|
1636
|
+
withSuppressRowAnimation(fn) {
|
|
1637
|
+
const animateRows = this.gridApi.getGridOption('animateRows');
|
|
1638
|
+
if (animateRows) {
|
|
1639
|
+
this.gridApi.setGridOption('animateRows', false);
|
|
1640
|
+
}
|
|
1641
|
+
const res = fn();
|
|
1642
|
+
if (animateRows) {
|
|
1643
|
+
this.gridApi.setGridOption('animateRows', true);
|
|
1644
|
+
}
|
|
1645
|
+
return res;
|
|
1646
|
+
}
|
|
1647
|
+
/**
|
|
1648
|
+
* Refreshes the sort order by refreshing the client side row model.
|
|
1649
|
+
* This is useful when custom sort comparers are defined and the sort needs to be re-applied after filtering.
|
|
1650
|
+
*/
|
|
1651
|
+
refreshSort() {
|
|
1652
|
+
this.withSuppressRowAnimation(() => {
|
|
1653
|
+
this.gridApi.refreshClientSideRowModel('sort');
|
|
1654
|
+
});
|
|
1655
|
+
}
|
|
1636
1656
|
patchColDefType(colDef, colTypes) {
|
|
1637
1657
|
const originalTypes = colDef.type == undefined ? [] : Array.isArray(colDef.type) ? colDef.type : [colDef.type];
|
|
1638
1658
|
const columnTypes = new Set(originalTypes);
|