@adaptabletools/adaptable 21.0.0-canary.2 → 21.0.0-canary.3
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/AdaptableOptions/FilterOptions.d.ts +1 -1
- package/src/Api/Internal/ColumnFilterInternalApi.d.ts +1 -0
- package/src/Api/Internal/ColumnFilterInternalApi.js +6 -3
- package/src/View/Components/ColumnFilter/components/FloatingFilterValues.d.ts +3 -1
- package/src/View/Components/ColumnFilter/components/FloatingFilterValues.js +32 -11
- package/src/View/Components/FilterForm/ListBoxFilterForm.js +1 -1
- package/src/agGrid/AdaptableFilterHandler.d.ts +4 -1
- package/src/agGrid/AdaptableFilterHandler.js +12 -2
- 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": "21.0.0-canary.
|
|
3
|
+
"version": "21.0.0-canary.3",
|
|
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",
|
|
@@ -212,7 +212,7 @@ export type InFilterValueResult = {
|
|
|
212
212
|
/**
|
|
213
213
|
* List of Items to display in the IN Column Filter
|
|
214
214
|
*/
|
|
215
|
-
values:
|
|
215
|
+
values: InFilterValue[];
|
|
216
216
|
/**
|
|
217
217
|
* When TRUE, displays the provided values without any filtering.
|
|
218
218
|
* When FALSE, the values are filtered based on the current search text.
|
|
@@ -55,5 +55,6 @@ export declare class ColumnFilterInternalApi extends ApiBase {
|
|
|
55
55
|
currentSearchValue: string;
|
|
56
56
|
}): Promise<InFilterValueResult>;
|
|
57
57
|
shouldAutoApplyColumnFilter(columnId: string): boolean;
|
|
58
|
+
getAdaptableFilterHandler(columnId: string): AdaptableFilterHandler | undefined;
|
|
58
59
|
getAllAdaptableFilterHandlers(): AdaptableFilterHandler[];
|
|
59
60
|
}
|
|
@@ -254,14 +254,14 @@ export class ColumnFilterInternalApi extends ApiBase {
|
|
|
254
254
|
this.logWarn(`No ColumnFilterHandler found for columnId: ${options.columnId}!`);
|
|
255
255
|
return this.getGridApi().internalApi.getDistinctFilterDisplayValuesForColumn(newOptions);
|
|
256
256
|
}
|
|
257
|
-
if (typeof columnFilterHandler.
|
|
258
|
-
this.logWarn(`ColumnFilterHandler for columnId: ${options.columnId} does not have
|
|
257
|
+
if (typeof columnFilterHandler.getFromCacheOrFetchFilterDisplayValues !== 'function') {
|
|
258
|
+
this.logWarn(`ColumnFilterHandler for columnId: ${options.columnId} does not have getFromCacheOrFetchFilterDisplayValues method!`);
|
|
259
259
|
return this.getGridApi().internalApi.getDistinctFilterDisplayValuesForColumn(newOptions);
|
|
260
260
|
}
|
|
261
261
|
if (filterOptions.customInFilterValues) {
|
|
262
262
|
return columnFilterHandler.fetchFilterDisplayValues(newOptions);
|
|
263
263
|
}
|
|
264
|
-
return columnFilterHandler.
|
|
264
|
+
return columnFilterHandler.getFromCacheOrFetchFilterDisplayValues(newOptions);
|
|
265
265
|
}
|
|
266
266
|
shouldAutoApplyColumnFilter(columnId) {
|
|
267
267
|
const autoApplyColumnFilterOpt = this.getOptionsApi().getFilterOptions().columnFilterOptions?.autoApplyColumnFilter;
|
|
@@ -279,6 +279,9 @@ export class ColumnFilterInternalApi extends ApiBase {
|
|
|
279
279
|
// fallback, should never happen
|
|
280
280
|
return true;
|
|
281
281
|
}
|
|
282
|
+
getAdaptableFilterHandler(columnId) {
|
|
283
|
+
return this.getAgGridApi().getColumnFilterHandler(columnId);
|
|
284
|
+
}
|
|
282
285
|
getAllAdaptableFilterHandlers() {
|
|
283
286
|
const allFilterableColumns = this.getColumnApi().getFilterableColumns();
|
|
284
287
|
const filterHandlers = allFilterableColumns
|
|
@@ -37,7 +37,9 @@ export declare function useDistinctFilterColumnValues(options: {
|
|
|
37
37
|
skipDefaultSearch: boolean;
|
|
38
38
|
searchValueUsedInFilterValue: boolean;
|
|
39
39
|
}>>;
|
|
40
|
-
triggerValuesLoad: (
|
|
40
|
+
triggerValuesLoad: (options?: {
|
|
41
|
+
usePrevious: boolean;
|
|
42
|
+
}) => void;
|
|
41
43
|
};
|
|
42
44
|
/**
|
|
43
45
|
* This component was ported and modified to not know about colum filter and predicates.
|
|
@@ -20,7 +20,10 @@ export function useDistinctFilterColumnValues(options) {
|
|
|
20
20
|
const { columnId, searchValueRef } = options;
|
|
21
21
|
const { api } = useAdaptable();
|
|
22
22
|
const [valuesLoadTrigger, setValuesLoadTrigger] = React.useState(0);
|
|
23
|
-
const
|
|
23
|
+
const usePreviousValuesProbablyBecauseOfAGGridUnnecessaryFilterRemountRef = React.useRef(false);
|
|
24
|
+
const triggerValuesLoad = React.useCallback((options) => {
|
|
25
|
+
usePreviousValuesProbablyBecauseOfAGGridUnnecessaryFilterRemountRef.current =
|
|
26
|
+
!!options?.usePrevious;
|
|
24
27
|
setValuesLoadTrigger((prev) => prev + 1);
|
|
25
28
|
}, []);
|
|
26
29
|
const [quickFilterValues, setQuickFilterValues] = React.useState({
|
|
@@ -38,15 +41,27 @@ export function useDistinctFilterColumnValues(options) {
|
|
|
38
41
|
let ignore = false;
|
|
39
42
|
setIsDistinctColumnValuesLoading(true);
|
|
40
43
|
let searchValueUsedInFilterValue = false;
|
|
41
|
-
api.filterApi.columnFilterApi.internalApi
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
const columnFilterinternalApi = api.filterApi.columnFilterApi.internalApi;
|
|
45
|
+
let promise = undefined;
|
|
46
|
+
if (usePreviousValuesProbablyBecauseOfAGGridUnnecessaryFilterRemountRef.current) {
|
|
47
|
+
const previousResult = columnFilterinternalApi
|
|
48
|
+
.getAdaptableFilterHandler(columnId)
|
|
49
|
+
?.getLastCachedFilterDisplayValues();
|
|
50
|
+
if (previousResult) {
|
|
51
|
+
promise = Promise.resolve(previousResult);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
usePreviousValuesProbablyBecauseOfAGGridUnnecessaryFilterRemountRef.current = false;
|
|
55
|
+
if (!promise) {
|
|
56
|
+
promise = columnFilterinternalApi.getColumnFilterValues({
|
|
57
|
+
columnId,
|
|
58
|
+
get currentSearchValue() {
|
|
59
|
+
searchValueUsedInFilterValue = true;
|
|
60
|
+
return searchValueRef ? searchValueRef.current : '';
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
promise.then((distinctFilterDisplayValues) => {
|
|
50
65
|
if (ignore) {
|
|
51
66
|
return;
|
|
52
67
|
}
|
|
@@ -91,9 +106,15 @@ export const FloatingFilterValues = (props) => {
|
|
|
91
106
|
if (!value || !Array.isArray(value) || value.length === 0) {
|
|
92
107
|
return;
|
|
93
108
|
}
|
|
109
|
+
// see 😅 usePreviousValuesProbablyBecauseOfAGGridUnnecessaryFilterRemountRef 😅
|
|
110
|
+
const usePrevious = !!api.filterApi.columnFilterApi.internalApi
|
|
111
|
+
.getAdaptableFilterHandler(props.columnId)
|
|
112
|
+
?.getLastCachedFilterDisplayValues();
|
|
94
113
|
// however, if the `value` prop is a non-empty array, we need to load the values
|
|
95
114
|
// so we know which labels to show
|
|
96
|
-
triggerValuesLoad(
|
|
115
|
+
triggerValuesLoad({
|
|
116
|
+
usePrevious,
|
|
117
|
+
});
|
|
97
118
|
}, []);
|
|
98
119
|
const quickFilterValuesRef = React.useRef(quickFilterValues);
|
|
99
120
|
quickFilterValuesRef.current = quickFilterValues;
|
|
@@ -9,7 +9,7 @@ export const ColumnValuesSelect = (props) => {
|
|
|
9
9
|
const column = props.column;
|
|
10
10
|
const selectedColumnValues = props.value || [];
|
|
11
11
|
const value = [];
|
|
12
|
-
const options = props.options.filter((distinctValue
|
|
12
|
+
const options = (Array.isArray(props.options) ? props.options : []).filter((distinctValue) => {
|
|
13
13
|
let isActive = selectedColumnValues.indexOf(distinctValue.value) >= 0;
|
|
14
14
|
// special case for date objects, need to check against string values
|
|
15
15
|
if (!isActive && distinctValue.value && distinctValue.value instanceof Date) {
|
|
@@ -6,9 +6,12 @@ export declare class AdaptableFilterHandler implements FilterHandler {
|
|
|
6
6
|
private adaptableApi;
|
|
7
7
|
readonly colId: string;
|
|
8
8
|
private filterDisplayValuesResult;
|
|
9
|
+
private previousFilterDisplayValuesResult;
|
|
9
10
|
constructor(adaptableApi: AdaptableApi, columnSetup: ColumnSetupInfo);
|
|
10
11
|
doesFilterPass(params: DoesFilterPassParams): boolean;
|
|
11
|
-
|
|
12
|
+
getCachedFilterDisplayValues(): InFilterValueResult | undefined;
|
|
13
|
+
getLastCachedFilterDisplayValues(): InFilterValueResult | undefined;
|
|
14
|
+
getFromCacheOrFetchFilterDisplayValues(options: {
|
|
12
15
|
currentSearchValue: string;
|
|
13
16
|
}): Promise<InFilterValueResult>;
|
|
14
17
|
fetchFilterDisplayValues(options: {
|
|
@@ -27,7 +27,13 @@ export class AdaptableFilterHandler {
|
|
|
27
27
|
return false;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
getCachedFilterDisplayValues() {
|
|
31
|
+
return this.filterDisplayValuesResult;
|
|
32
|
+
}
|
|
33
|
+
getLastCachedFilterDisplayValues() {
|
|
34
|
+
return this.filterDisplayValuesResult ?? this.previousFilterDisplayValuesResult;
|
|
35
|
+
}
|
|
36
|
+
getFromCacheOrFetchFilterDisplayValues(options) {
|
|
31
37
|
if (this.filterDisplayValuesResult) {
|
|
32
38
|
return Promise.resolve(this.filterDisplayValuesResult);
|
|
33
39
|
}
|
|
@@ -61,12 +67,15 @@ export class AdaptableFilterHandler {
|
|
|
61
67
|
this.resetFilterDisplayValues();
|
|
62
68
|
}
|
|
63
69
|
resetFilterDisplayValues() {
|
|
70
|
+
if (this.filterDisplayValuesResult) {
|
|
71
|
+
this.previousFilterDisplayValuesResult = this.filterDisplayValuesResult;
|
|
72
|
+
}
|
|
64
73
|
// Reset the filter display values manually
|
|
65
74
|
this.filterDisplayValuesResult = undefined;
|
|
66
75
|
}
|
|
67
76
|
async refreshFilterDisplayValues() {
|
|
68
77
|
this.resetFilterDisplayValues();
|
|
69
|
-
return this.
|
|
78
|
+
return this.getFromCacheOrFetchFilterDisplayValues({ currentSearchValue: '' });
|
|
70
79
|
}
|
|
71
80
|
refresh(params) {
|
|
72
81
|
// No specific refresh logic needed for this handler
|
|
@@ -74,5 +83,6 @@ export class AdaptableFilterHandler {
|
|
|
74
83
|
}
|
|
75
84
|
destroy() {
|
|
76
85
|
this.filterDisplayValuesResult = undefined;
|
|
86
|
+
this.previousFilterDisplayValuesResult = undefined;
|
|
77
87
|
}
|
|
78
88
|
}
|
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: "21.0.0-canary.
|
|
3
|
+
PUBLISH_TIMESTAMP: 1757076026384 || Date.now(),
|
|
4
|
+
VERSION: "21.0.0-canary.3" || '--current-version--',
|
|
5
5
|
};
|