@adaptabletools/adaptable 23.1.0-canary.1 → 23.1.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 +3 -3
- package/src/AdaptableOptions/FilterOptions.d.ts +22 -2
- package/src/Api/Internal/GridInternalApi.js +3 -1
- package/src/Utilities/snapshotInFilterValue.d.ts +9 -0
- package/src/Utilities/snapshotInFilterValue.js +8 -0
- package/src/View/Components/ColumnFilter/components/FloatingFilterValues.d.ts +3 -9
- package/src/View/Components/ColumnFilter/components/FloatingFilterValues.js +33 -1
- package/src/View/Components/Selectors/PermittedValuesSelector.js +4 -1
- package/src/agGrid/AdaptableAgGrid.js +91 -102
- package/src/agGrid/AdaptableFilterHandler.d.ts +7 -0
- package/src/agGrid/AdaptableFilterHandler.js +17 -1
- package/src/agGrid/AgGridAdapter.js +0 -42
- package/src/env.js +2 -2
- package/tsconfig.esm.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable",
|
|
3
|
-
"version": "23.1.0
|
|
3
|
+
"version": "23.1.0",
|
|
4
4
|
"description": "Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"uuid": "9.0.1"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"ag-grid-enterprise": ">=36.
|
|
72
|
-
"ag-stack": ">=36.
|
|
71
|
+
"ag-grid-enterprise": ">=36.2.0",
|
|
72
|
+
"ag-stack": ">=36.2.0"
|
|
73
73
|
},
|
|
74
74
|
"publishTimestamp": 0,
|
|
75
75
|
"type": "module",
|
|
@@ -174,9 +174,20 @@ export interface DefaultPredicateFilterContext<TData = any> extends BaseContext
|
|
|
174
174
|
*/
|
|
175
175
|
export interface InFilterValue<ValueType = any> {
|
|
176
176
|
/**
|
|
177
|
-
* Item's label
|
|
177
|
+
* Item's label.
|
|
178
|
+
*
|
|
179
|
+
* Either a string, or a function that returns the label. The function is
|
|
180
|
+
* re-evaluated whenever filtering changes, so the label can embed live info
|
|
181
|
+
* (e.g. `visibleCount`) without `customInFilterValues` being called again:
|
|
182
|
+
*
|
|
183
|
+
* ```ts
|
|
184
|
+
* label: (item) => `${item.label} (${item.visibleCount})`
|
|
185
|
+
* ```
|
|
186
|
+
*
|
|
187
|
+
* The function receives the item's default {@link InFilterValueInfo} (same shape
|
|
188
|
+
* as `context.defaultValues`), looked up by `value`.
|
|
178
189
|
*/
|
|
179
|
-
label: string;
|
|
190
|
+
label: string | InFilterValueLabelFn;
|
|
180
191
|
/**
|
|
181
192
|
* The value of Item being shown
|
|
182
193
|
*/
|
|
@@ -188,6 +199,11 @@ export interface InFilterValue<ValueType = any> {
|
|
|
188
199
|
level?: number;
|
|
189
200
|
children?: InFilterValue<ValueType>[];
|
|
190
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Computes the label of an IN Filter item from its default info
|
|
204
|
+
* (`count`, `visibleCount`, `visible`, ...). Re-evaluated when filtering changes.
|
|
205
|
+
*/
|
|
206
|
+
export type InFilterValueLabelFn = (item: InFilterValueInfo) => string;
|
|
191
207
|
/**
|
|
192
208
|
* Result when providing custom values for the IN Column Filter
|
|
193
209
|
*/
|
|
@@ -245,6 +261,10 @@ export interface InFilterLabelContext extends BaseContext {
|
|
|
245
261
|
* Information about items in the IN Column Filter
|
|
246
262
|
*/
|
|
247
263
|
export interface InFilterValueInfo extends InFilterValue {
|
|
264
|
+
/**
|
|
265
|
+
* Item's default label (the Column's display value)
|
|
266
|
+
*/
|
|
267
|
+
label: string;
|
|
248
268
|
/**
|
|
249
269
|
* Whether Item is currently selected
|
|
250
270
|
*/
|
|
@@ -205,7 +205,9 @@ export class GridInternalApi extends ApiBase {
|
|
|
205
205
|
Aggregatable: defaultColumnDefinition.enableValue,
|
|
206
206
|
SuppressMenu: defaultColumnDefinition.suppressHeaderMenuButton,
|
|
207
207
|
SuppressMovable: defaultColumnDefinition.suppressMovable,
|
|
208
|
-
HeaderToolTip: defaultColumnDefinition.headerTooltip
|
|
208
|
+
HeaderToolTip: typeof defaultColumnDefinition.headerTooltip === 'string'
|
|
209
|
+
? defaultColumnDefinition.headerTooltip
|
|
210
|
+
: undefined,
|
|
209
211
|
Width: defaultColumnDefinition.width,
|
|
210
212
|
};
|
|
211
213
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InFilterValue, InFilterValueInfo } from '../AdaptableOptions/FilterOptions';
|
|
2
|
+
/**
|
|
3
|
+
* Copies an In Filter item into a plain object with a string `label`.
|
|
4
|
+
*
|
|
5
|
+
* Items coming from `customInFilterValues` may carry a live `label` getter (when
|
|
6
|
+
* the consumer returned a label function) - snapshotting reads the current label
|
|
7
|
+
* and gives UI components fresh references so they re-render the text.
|
|
8
|
+
*/
|
|
9
|
+
export declare const snapshotInFilterValue: (item: InFilterValue) => InFilterValueInfo;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ColumnValuesSelectProps } from '../../FilterForm/ListBoxFilterForm';
|
|
3
|
-
import { InFilterLabelContext } from '../../../../types';
|
|
3
|
+
import { InFilterValue, InFilterLabelContext } from '../../../../types';
|
|
4
4
|
/** Suggested page size passed to `customInFilterValues` as `context.limit`. */
|
|
5
5
|
export declare const IN_FILTER_VALUES_PAGE_SIZE = 1000;
|
|
6
6
|
export interface FloatingFilterValuesProps {
|
|
@@ -24,10 +24,7 @@ export declare function useDistinctFilterColumnValues(options: {
|
|
|
24
24
|
isDistinctColumnValuesLoading: boolean;
|
|
25
25
|
isLoadingMore: boolean;
|
|
26
26
|
quickFilterValues: {
|
|
27
|
-
values:
|
|
28
|
-
value: any;
|
|
29
|
-
label: string;
|
|
30
|
-
}[];
|
|
27
|
+
values: import("../../../../types").InFilterValueInfo[];
|
|
31
28
|
dataLoadIsComplete: boolean;
|
|
32
29
|
skipDefaultSearch: boolean;
|
|
33
30
|
searchValueUsedInFilterValue: boolean;
|
|
@@ -35,10 +32,7 @@ export declare function useDistinctFilterColumnValues(options: {
|
|
|
35
32
|
inFilterLabel?: (context: InFilterLabelContext) => string;
|
|
36
33
|
};
|
|
37
34
|
setQuickFilterValues: React.Dispatch<React.SetStateAction<{
|
|
38
|
-
values:
|
|
39
|
-
value: any;
|
|
40
|
-
label: string;
|
|
41
|
-
}[];
|
|
35
|
+
values: InFilterValue[];
|
|
42
36
|
dataLoadIsComplete: boolean;
|
|
43
37
|
skipDefaultSearch: boolean;
|
|
44
38
|
searchValueUsedInFilterValue: boolean;
|
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
import { useAdaptable } from '../../../AdaptableContext';
|
|
5
5
|
import { ColumnValuesSelect } from '../../FilterForm/ListBoxFilterForm';
|
|
6
|
+
import { snapshotInFilterValue } from '../../../../Utilities/snapshotInFilterValue';
|
|
6
7
|
import { AG_GRID_GROUPED_COLUMN } from '../../../../Utilities/Constants/GeneralConstants';
|
|
7
8
|
const onceFlags = {};
|
|
8
9
|
const logOnce = (message, loggingFn) => {
|
|
@@ -77,6 +78,37 @@ export function useDistinctFilterColumnValues(options) {
|
|
|
77
78
|
isLoadingMoreRef.current = next;
|
|
78
79
|
setIsLoadingMore(next);
|
|
79
80
|
}, []);
|
|
81
|
+
const [labelsVersion, setLabelsVersion] = React.useState(0);
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
const filterHandler = api.filterApi.columnFilterApi.internalApi.getAdaptableFilterHandler(columnId);
|
|
84
|
+
if (!filterHandler || typeof filterHandler.onDisplayValuesInvalidated !== 'function') {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
return filterHandler.onDisplayValuesInvalidated(() => {
|
|
88
|
+
const refreshed = filterHandler.getCachedFilterDisplayValues();
|
|
89
|
+
if (refreshed && !refreshed.hasMore) {
|
|
90
|
+
hasMoreRef.current = false;
|
|
91
|
+
accumulatedValuesRef.current = refreshed.values;
|
|
92
|
+
lastRequestedOffsetRef.current = 0;
|
|
93
|
+
setQuickFilterValues((prev) => ({
|
|
94
|
+
...prev,
|
|
95
|
+
values: refreshed.values,
|
|
96
|
+
dataLoadIsComplete: true,
|
|
97
|
+
skipDefaultSearch: !!refreshed.skipDefaultSearch,
|
|
98
|
+
hasMore: false,
|
|
99
|
+
inFilterLabel: refreshed.inFilterLabel,
|
|
100
|
+
}));
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
setLabelsVersion((version) => version + 1);
|
|
104
|
+
});
|
|
105
|
+
}, [api, columnId]);
|
|
106
|
+
const displayedQuickFilterValues = React.useMemo(() => {
|
|
107
|
+
return {
|
|
108
|
+
...quickFilterValues,
|
|
109
|
+
values: quickFilterValues.values.map(snapshotInFilterValue),
|
|
110
|
+
};
|
|
111
|
+
}, [quickFilterValues, labelsVersion]);
|
|
80
112
|
const fetchFilterValues = React.useCallback((offset) => {
|
|
81
113
|
let searchValueUsedInFilterValue = false;
|
|
82
114
|
const columnFilterInternalApi = api.filterApi.columnFilterApi.internalApi;
|
|
@@ -283,7 +315,7 @@ export function useDistinctFilterColumnValues(options) {
|
|
|
283
315
|
return {
|
|
284
316
|
isDistinctColumnValuesLoading,
|
|
285
317
|
isLoadingMore,
|
|
286
|
-
quickFilterValues,
|
|
318
|
+
quickFilterValues: displayedQuickFilterValues,
|
|
287
319
|
setQuickFilterValues,
|
|
288
320
|
triggerValuesLoad,
|
|
289
321
|
};
|
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { runIfNotResolvedIn } from '../../../Utilities/runIfNotResolvedIn';
|
|
4
4
|
import { useAdaptable } from '../../AdaptableContext';
|
|
5
5
|
import { useCallback } from 'react';
|
|
6
|
+
import { snapshotInFilterValue } from '../../../Utilities/snapshotInFilterValue';
|
|
6
7
|
import { MultiCombobox, SingleCombobox, } from '../../../components/Combobox';
|
|
7
8
|
export const PermittedValuesSelector = function (props) {
|
|
8
9
|
const adaptable = useAdaptable();
|
|
@@ -42,7 +43,9 @@ export const PermittedValuesSelector = function (props) {
|
|
|
42
43
|
});
|
|
43
44
|
setSearchValueWasUsedWhenFiltering(searchValueUsedInFilterValue);
|
|
44
45
|
setIsLoading(false);
|
|
45
|
-
setOptions(Array.isArray(distinctColumnValues)
|
|
46
|
+
setOptions((Array.isArray(distinctColumnValues)
|
|
47
|
+
? distinctColumnValues
|
|
48
|
+
: distinctColumnValues.values).map(snapshotInFilterValue));
|
|
46
49
|
})();
|
|
47
50
|
}, [props.columnId, props.loadValues, refetchKey]);
|
|
48
51
|
const isCreatable = (props.allowNewValues && !dataType) || ['text', 'number'].includes(dataType);
|
|
@@ -618,7 +618,6 @@ export class AdaptableAgGrid {
|
|
|
618
618
|
agGridApi.onFilterChanged();
|
|
619
619
|
filteringApplied = true;
|
|
620
620
|
}
|
|
621
|
-
agGridApi.refreshCells();
|
|
622
621
|
this._emit('AdapTableFiltersApplied');
|
|
623
622
|
return filteringApplied;
|
|
624
623
|
}
|
|
@@ -2440,32 +2439,90 @@ export class AdaptableAgGrid {
|
|
|
2440
2439
|
};
|
|
2441
2440
|
const mapFn = (gridCell, level) => {
|
|
2442
2441
|
if (level || Array.isArray(gridCell.children)) {
|
|
2443
|
-
|
|
2444
|
-
const inFilterValue = {
|
|
2445
|
-
value: gridCell.rawValue,
|
|
2446
|
-
label: gridCell.displayValue,
|
|
2447
|
-
level: level ?? 0,
|
|
2448
|
-
tooltip: false,
|
|
2449
|
-
get visible() {
|
|
2450
|
-
return gridCell.visible;
|
|
2451
|
-
},
|
|
2452
|
-
count: gridCell.count ?? 0,
|
|
2453
|
-
leafChildrenCount: cell.leafChildrenCount ?? 0,
|
|
2454
|
-
get visibleCount() {
|
|
2455
|
-
return gridCell.visibleCount ?? 0;
|
|
2456
|
-
},
|
|
2457
|
-
isSelected: gridCell.rowNode.displayed,
|
|
2458
|
-
children: cell.children
|
|
2459
|
-
? cell.children.map((v) => mapFn(v, level ? level + 1 : 1))
|
|
2460
|
-
: undefined,
|
|
2461
|
-
};
|
|
2462
|
-
return inFilterValue;
|
|
2442
|
+
return toInFilterValueInfo(gridCell, level ?? 0);
|
|
2463
2443
|
}
|
|
2464
2444
|
return {
|
|
2465
2445
|
value: gridCell.rawValue,
|
|
2466
2446
|
label: gridCell.displayValue,
|
|
2467
2447
|
};
|
|
2468
2448
|
};
|
|
2449
|
+
const toInFilterValueInfo = (gridCell, level) => {
|
|
2450
|
+
const itemId = `${gridCell.rowNode?.id}-${gridCell.column?.columnId}`;
|
|
2451
|
+
let children;
|
|
2452
|
+
let childrenComputed = false;
|
|
2453
|
+
return {
|
|
2454
|
+
id: itemId,
|
|
2455
|
+
label: gridCell.displayValue,
|
|
2456
|
+
value: gridCell.rawValue,
|
|
2457
|
+
isSelected: gridCell.rowNode.displayed,
|
|
2458
|
+
count: gridCell.count ?? 0,
|
|
2459
|
+
tooltip: false,
|
|
2460
|
+
level,
|
|
2461
|
+
leafChildrenCount: gridCell.leafChildrenCount ?? 0,
|
|
2462
|
+
get children() {
|
|
2463
|
+
if (!childrenComputed) {
|
|
2464
|
+
childrenComputed = true;
|
|
2465
|
+
children = gridCell.children?.map((child) => mapFn(child, level + 1));
|
|
2466
|
+
}
|
|
2467
|
+
return children;
|
|
2468
|
+
},
|
|
2469
|
+
get visible() {
|
|
2470
|
+
return gridCell.visible;
|
|
2471
|
+
},
|
|
2472
|
+
get visibleCount() {
|
|
2473
|
+
return gridCell.visibleCount ?? 0;
|
|
2474
|
+
},
|
|
2475
|
+
};
|
|
2476
|
+
};
|
|
2477
|
+
let infoByValue;
|
|
2478
|
+
const getInfoForValue = (value) => {
|
|
2479
|
+
if (!infoByValue) {
|
|
2480
|
+
const lookup = (infoByValue = new Map());
|
|
2481
|
+
const visit = (gridCells, level) => {
|
|
2482
|
+
for (const gridCell of gridCells) {
|
|
2483
|
+
if (!lookup.has(gridCell.rawValue)) {
|
|
2484
|
+
lookup.set(gridCell.rawValue, toInFilterValueInfo(gridCell, level));
|
|
2485
|
+
}
|
|
2486
|
+
const children = gridCell.children;
|
|
2487
|
+
if (children) {
|
|
2488
|
+
visit(children, level + 1);
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
};
|
|
2492
|
+
visit(getCurrentGridCells(), 0);
|
|
2493
|
+
}
|
|
2494
|
+
return infoByValue.get(value);
|
|
2495
|
+
};
|
|
2496
|
+
const resolveLabels = (values, level) => {
|
|
2497
|
+
return values.map((item) => {
|
|
2498
|
+
const children = item.children ? resolveLabels(item.children, level + 1) : undefined;
|
|
2499
|
+
if (typeof item.label !== 'function') {
|
|
2500
|
+
return children === item.children ? item : { ...item, children };
|
|
2501
|
+
}
|
|
2502
|
+
const labelFn = item.label;
|
|
2503
|
+
let info;
|
|
2504
|
+
return {
|
|
2505
|
+
...item,
|
|
2506
|
+
children,
|
|
2507
|
+
get label() {
|
|
2508
|
+
if (!info) {
|
|
2509
|
+
info = getInfoForValue(item.value) ?? {
|
|
2510
|
+
value: item.value,
|
|
2511
|
+
label: item.value == null ? '' : String(item.value),
|
|
2512
|
+
tooltip: item.tooltip ?? false,
|
|
2513
|
+
level,
|
|
2514
|
+
isSelected: false,
|
|
2515
|
+
count: 0,
|
|
2516
|
+
visibleCount: 0,
|
|
2517
|
+
visible: false,
|
|
2518
|
+
leafChildrenCount: 0,
|
|
2519
|
+
};
|
|
2520
|
+
}
|
|
2521
|
+
return labelFn(info);
|
|
2522
|
+
},
|
|
2523
|
+
};
|
|
2524
|
+
});
|
|
2525
|
+
};
|
|
2469
2526
|
const customInFilterValues = this.adaptableOptions.filterOptions.customInFilterValues;
|
|
2470
2527
|
if (customInFilterValues) {
|
|
2471
2528
|
const gridApiInternal = this.api.gridApi.internalApi;
|
|
@@ -2482,101 +2539,33 @@ export class AdaptableAgGrid {
|
|
|
2482
2539
|
return options.currentSearchValue;
|
|
2483
2540
|
},
|
|
2484
2541
|
get sortedValues() {
|
|
2485
|
-
|
|
2542
|
+
return gridApiInternal
|
|
2486
2543
|
.sortDistinctValues(getCurrentGridCells(), column)
|
|
2487
|
-
.map((gridCell) =>
|
|
2488
|
-
const itemId = `${gridCell.rowNode?.id}-${gridCell.column?.columnId}`;
|
|
2489
|
-
return {
|
|
2490
|
-
id: itemId,
|
|
2491
|
-
label: gridCell.displayValue,
|
|
2492
|
-
value: gridCell.rawValue,
|
|
2493
|
-
isSelected: gridCell.rowNode.displayed,
|
|
2494
|
-
count: gridCell.count ?? 0,
|
|
2495
|
-
tooltip: false,
|
|
2496
|
-
level: 0,
|
|
2497
|
-
leafChildrenCount: gridCell.leafChildrenCount ?? 0,
|
|
2498
|
-
get children() {
|
|
2499
|
-
if (!gridCell.children) {
|
|
2500
|
-
return undefined;
|
|
2501
|
-
}
|
|
2502
|
-
return gridCell.children.map((gridCell) => mapFn(gridCell, 1));
|
|
2503
|
-
},
|
|
2504
|
-
get visible() {
|
|
2505
|
-
return gridCell.visible;
|
|
2506
|
-
},
|
|
2507
|
-
get visibleCount() {
|
|
2508
|
-
return gridCell.visibleCount ?? 0;
|
|
2509
|
-
},
|
|
2510
|
-
};
|
|
2511
|
-
});
|
|
2512
|
-
return result;
|
|
2544
|
+
.map((gridCell) => toInFilterValueInfo(gridCell, 0));
|
|
2513
2545
|
},
|
|
2514
2546
|
get defaultValues() {
|
|
2515
|
-
|
|
2516
|
-
const itemId = `${gridCell.rowNode?.id}-${gridCell.column?.columnId}`;
|
|
2517
|
-
return {
|
|
2518
|
-
id: itemId,
|
|
2519
|
-
label: gridCell.displayValue,
|
|
2520
|
-
value: gridCell.rawValue,
|
|
2521
|
-
isSelected: gridCell.rowNode.displayed,
|
|
2522
|
-
count: gridCell.count ?? 0,
|
|
2523
|
-
tooltip: false,
|
|
2524
|
-
level: 0,
|
|
2525
|
-
leafChildrenCount: gridCell.leafChildrenCount ?? 0,
|
|
2526
|
-
get children() {
|
|
2527
|
-
if (!gridCell.children) {
|
|
2528
|
-
return undefined;
|
|
2529
|
-
}
|
|
2530
|
-
return gridCell.children.map((gridCell) => mapFn(gridCell, 1));
|
|
2531
|
-
},
|
|
2532
|
-
get visible() {
|
|
2533
|
-
return gridCell.visible;
|
|
2534
|
-
},
|
|
2535
|
-
get visibleCount() {
|
|
2536
|
-
return gridCell.visibleCount ?? 0;
|
|
2537
|
-
},
|
|
2538
|
-
};
|
|
2539
|
-
});
|
|
2540
|
-
return result;
|
|
2547
|
+
return getCurrentGridCells().map((gridCell) => toInFilterValueInfo(gridCell, 0));
|
|
2541
2548
|
},
|
|
2542
2549
|
get orderedValues() {
|
|
2543
2550
|
const rowNodes = gridApiInternal.getSortedRowNodesWithCurrentLayoutSortOrder();
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
return {
|
|
2548
|
-
id: itemId,
|
|
2549
|
-
label: gridCell.displayValue,
|
|
2550
|
-
value: gridCell.rawValue,
|
|
2551
|
-
isSelected: gridCell.rowNode.displayed,
|
|
2552
|
-
count: gridCell.count,
|
|
2553
|
-
tooltip: false,
|
|
2554
|
-
level: 0,
|
|
2555
|
-
get children() {
|
|
2556
|
-
if (!gridCell.children) {
|
|
2557
|
-
return undefined;
|
|
2558
|
-
}
|
|
2559
|
-
return gridCell.children.map((gridCell) => mapFn(gridCell, 1));
|
|
2560
|
-
},
|
|
2561
|
-
leafChildrenCount: gridCell.leafChildrenCount ?? 0,
|
|
2562
|
-
get visible() {
|
|
2563
|
-
return gridCell.visible;
|
|
2564
|
-
},
|
|
2565
|
-
get visibleCount() {
|
|
2566
|
-
return gridCell.visibleCount;
|
|
2567
|
-
},
|
|
2568
|
-
};
|
|
2569
|
-
});
|
|
2570
|
-
return result;
|
|
2551
|
+
return self
|
|
2552
|
+
.getDistinctGridCellsForColumn(column, rowNodes)
|
|
2553
|
+
.map((gridCell) => toInFilterValueInfo(gridCell, 0));
|
|
2571
2554
|
},
|
|
2572
2555
|
};
|
|
2573
|
-
let customInFilterValuesResult;
|
|
2556
|
+
let customInFilterValuesResult = undefined;
|
|
2574
2557
|
try {
|
|
2575
2558
|
customInFilterValuesResult = await customInFilterValues(customInFilterValuesContext);
|
|
2576
2559
|
}
|
|
2577
2560
|
catch (error) {
|
|
2578
2561
|
this.logger.consoleError('Failed to retrieve custom filter values.', column, error);
|
|
2579
2562
|
}
|
|
2563
|
+
if (customInFilterValuesResult?.values) {
|
|
2564
|
+
return {
|
|
2565
|
+
...customInFilterValuesResult,
|
|
2566
|
+
values: resolveLabels(customInFilterValuesResult.values, 0),
|
|
2567
|
+
};
|
|
2568
|
+
}
|
|
2580
2569
|
return customInFilterValuesResult;
|
|
2581
2570
|
}
|
|
2582
2571
|
const values = getCurrentGridCells().map((gridCell) => mapFn(gridCell));
|
|
@@ -8,7 +8,14 @@ export declare class AdaptableFilterHandler implements FilterHandler<any, any, C
|
|
|
8
8
|
private filterDisplayValuesResult;
|
|
9
9
|
private previousFilterDisplayValuesResult;
|
|
10
10
|
private rememberedInFilterValues;
|
|
11
|
+
private displayValuesInvalidatedListeners;
|
|
11
12
|
constructor(adaptableApi: AdaptableApi);
|
|
13
|
+
/**
|
|
14
|
+
* Notifies when the cached display values are invalidated by a filter change
|
|
15
|
+
* (or new rows), so mounted filter components can re-read live labels.
|
|
16
|
+
*/
|
|
17
|
+
onDisplayValuesInvalidated(listener: () => void): () => void;
|
|
18
|
+
private notifyDisplayValuesInvalidated;
|
|
12
19
|
init(params: FilterHandlerParams): void;
|
|
13
20
|
doesFilterPass(params: DoesFilterPassParams<any, any, ColumnFilter>): boolean;
|
|
14
21
|
getCachedFilterDisplayValues(): InFilterValueResult | undefined;
|
|
@@ -4,9 +4,21 @@ export class AdaptableFilterHandler {
|
|
|
4
4
|
filterDisplayValuesResult;
|
|
5
5
|
previousFilterDisplayValuesResult;
|
|
6
6
|
rememberedInFilterValues = new Map();
|
|
7
|
+
displayValuesInvalidatedListeners = new Set();
|
|
7
8
|
constructor(adaptableApi) {
|
|
8
9
|
this.adaptableApi = adaptableApi;
|
|
9
10
|
}
|
|
11
|
+
onDisplayValuesInvalidated(listener) {
|
|
12
|
+
this.displayValuesInvalidatedListeners.add(listener);
|
|
13
|
+
return () => {
|
|
14
|
+
this.displayValuesInvalidatedListeners.delete(listener);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
notifyDisplayValuesInvalidated() {
|
|
18
|
+
this.displayValuesInvalidatedListeners.forEach((listener) => {
|
|
19
|
+
listener();
|
|
20
|
+
});
|
|
21
|
+
}
|
|
10
22
|
init(params) {
|
|
11
23
|
this.colId = params.column.getColId();
|
|
12
24
|
}
|
|
@@ -117,15 +129,19 @@ export class AdaptableFilterHandler {
|
|
|
117
129
|
this.previousFilterDisplayValuesResult = this.filterDisplayValuesResult;
|
|
118
130
|
}
|
|
119
131
|
this.filterDisplayValuesResult = undefined;
|
|
132
|
+
this.notifyDisplayValuesInvalidated();
|
|
120
133
|
}
|
|
121
134
|
async refreshFilterDisplayValues() {
|
|
122
135
|
this.resetFilterDisplayValues();
|
|
123
|
-
|
|
136
|
+
const result = await this.getFromCacheOrFetchFilterDisplayValues({ currentSearchValue: '' });
|
|
137
|
+
this.notifyDisplayValuesInvalidated();
|
|
138
|
+
return result;
|
|
124
139
|
}
|
|
125
140
|
refresh(_params) { }
|
|
126
141
|
destroy() {
|
|
127
142
|
this.filterDisplayValuesResult = undefined;
|
|
128
143
|
this.previousFilterDisplayValuesResult = undefined;
|
|
129
144
|
this.rememberedInFilterValues.clear();
|
|
145
|
+
this.displayValuesInvalidatedListeners.clear();
|
|
130
146
|
}
|
|
131
147
|
}
|
|
@@ -48,47 +48,6 @@ const patchLocalEventServiceDispatchEvent = (beans) => {
|
|
|
48
48
|
DANGER_AG_GRID_ADAPTERS_MAP[gridId]?.handleRowNodeEvent(rowNodeEvent);
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
|
-
const patchVisibleColsPartition = (beans) => {
|
|
52
|
-
const visibleCols = beans?.visibleCols;
|
|
53
|
-
if (!visibleCols || typeof visibleCols.partitionVisibleCols !== 'function') {
|
|
54
|
-
console.error(`CRITICAL: could not get hold of AG Grid VisibleColsService.partitionVisibleCols, the selection column may NOT be displayed when it is the last column!`);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const original_partitionVisibleCols = visibleCols.partitionVisibleCols;
|
|
58
|
-
visibleCols.partitionVisibleCols = function () {
|
|
59
|
-
const result = original_partitionVisibleCols.apply(this, arguments);
|
|
60
|
-
const leftCols = result?.leftCols ?? [];
|
|
61
|
-
const rightCols = result?.rightCols ?? [];
|
|
62
|
-
const centerCols = result?.centerCols ?? [];
|
|
63
|
-
if (leftCols.length + rightCols.length + centerCols.length === 0) {
|
|
64
|
-
return result;
|
|
65
|
-
}
|
|
66
|
-
const colModel = beans.colModel;
|
|
67
|
-
const selectionCol = colModel?.colsList?.find((col) => col?.colKind === 'selection');
|
|
68
|
-
if (!selectionCol || !selectionCol.visible) {
|
|
69
|
-
return result;
|
|
70
|
-
}
|
|
71
|
-
if (leftCols.includes(selectionCol) ||
|
|
72
|
-
rightCols.includes(selectionCol) ||
|
|
73
|
-
centerCols.includes(selectionCol)) {
|
|
74
|
-
return result;
|
|
75
|
-
}
|
|
76
|
-
const showAutoGroupAndValuesOnly = colModel.pivotMode && !colModel.showingPivotResult;
|
|
77
|
-
if (showAutoGroupAndValuesOnly && !(beans.selectionColSvc?.isEnabled?.() ?? false)) {
|
|
78
|
-
return result;
|
|
79
|
-
}
|
|
80
|
-
if (selectionCol.pinned === 'right') {
|
|
81
|
-
rightCols.push(selectionCol);
|
|
82
|
-
}
|
|
83
|
-
else if (selectionCol.pinned) {
|
|
84
|
-
leftCols.push(selectionCol);
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
centerCols.push(selectionCol);
|
|
88
|
-
}
|
|
89
|
-
return result;
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
51
|
export class AgGridAdapter {
|
|
93
52
|
_adaptableInstance;
|
|
94
53
|
DANGER_USE_GETTER_gridApi;
|
|
@@ -117,7 +76,6 @@ export class AgGridAdapter {
|
|
|
117
76
|
}
|
|
118
77
|
DANGER_AG_GRID_BEANS_MAP[gridId] = beans;
|
|
119
78
|
patchLocalEventServiceDispatchEvent(beans);
|
|
120
|
-
patchVisibleColsPartition(beans);
|
|
121
79
|
};
|
|
122
80
|
}
|
|
123
81
|
}
|
package/src/env.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
NEXT_PUBLIC_INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
|
|
3
|
-
PUBLISH_TIMESTAMP:
|
|
4
|
-
VERSION: "23.1.0
|
|
3
|
+
PUBLISH_TIMESTAMP: 1789640674246 || Date.now(),
|
|
4
|
+
VERSION: "23.1.0" || '--current-version--',
|
|
5
5
|
};
|