@adaptabletools/adaptable-cjs 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.cjs.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable-cjs",
|
|
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
|
}
|
|
@@ -258,14 +258,14 @@ class ColumnFilterInternalApi extends ApiBase_1.ApiBase {
|
|
|
258
258
|
this.logWarn(`No ColumnFilterHandler found for columnId: ${options.columnId}!`);
|
|
259
259
|
return this.getGridApi().internalApi.getDistinctFilterDisplayValuesForColumn(newOptions);
|
|
260
260
|
}
|
|
261
|
-
if (typeof columnFilterHandler.
|
|
262
|
-
this.logWarn(`ColumnFilterHandler for columnId: ${options.columnId} does not have
|
|
261
|
+
if (typeof columnFilterHandler.getFromCacheOrFetchFilterDisplayValues !== 'function') {
|
|
262
|
+
this.logWarn(`ColumnFilterHandler for columnId: ${options.columnId} does not have getFromCacheOrFetchFilterDisplayValues method!`);
|
|
263
263
|
return this.getGridApi().internalApi.getDistinctFilterDisplayValuesForColumn(newOptions);
|
|
264
264
|
}
|
|
265
265
|
if (filterOptions.customInFilterValues) {
|
|
266
266
|
return columnFilterHandler.fetchFilterDisplayValues(newOptions);
|
|
267
267
|
}
|
|
268
|
-
return columnFilterHandler.
|
|
268
|
+
return columnFilterHandler.getFromCacheOrFetchFilterDisplayValues(newOptions);
|
|
269
269
|
}
|
|
270
270
|
shouldAutoApplyColumnFilter(columnId) {
|
|
271
271
|
const autoApplyColumnFilterOpt = this.getOptionsApi().getFilterOptions().columnFilterOptions?.autoApplyColumnFilter;
|
|
@@ -283,6 +283,9 @@ class ColumnFilterInternalApi extends ApiBase_1.ApiBase {
|
|
|
283
283
|
// fallback, should never happen
|
|
284
284
|
return true;
|
|
285
285
|
}
|
|
286
|
+
getAdaptableFilterHandler(columnId) {
|
|
287
|
+
return this.getAgGridApi().getColumnFilterHandler(columnId);
|
|
288
|
+
}
|
|
286
289
|
getAllAdaptableFilterHandlers() {
|
|
287
290
|
const allFilterableColumns = this.getColumnApi().getFilterableColumns();
|
|
288
291
|
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.
|
|
@@ -24,7 +24,10 @@ function useDistinctFilterColumnValues(options) {
|
|
|
24
24
|
const { columnId, searchValueRef } = options;
|
|
25
25
|
const { api } = (0, AdaptableContext_1.useAdaptable)();
|
|
26
26
|
const [valuesLoadTrigger, setValuesLoadTrigger] = React.useState(0);
|
|
27
|
-
const
|
|
27
|
+
const usePreviousValuesProbablyBecauseOfAGGridUnnecessaryFilterRemountRef = React.useRef(false);
|
|
28
|
+
const triggerValuesLoad = React.useCallback((options) => {
|
|
29
|
+
usePreviousValuesProbablyBecauseOfAGGridUnnecessaryFilterRemountRef.current =
|
|
30
|
+
!!options?.usePrevious;
|
|
28
31
|
setValuesLoadTrigger((prev) => prev + 1);
|
|
29
32
|
}, []);
|
|
30
33
|
const [quickFilterValues, setQuickFilterValues] = React.useState({
|
|
@@ -42,15 +45,27 @@ function useDistinctFilterColumnValues(options) {
|
|
|
42
45
|
let ignore = false;
|
|
43
46
|
setIsDistinctColumnValuesLoading(true);
|
|
44
47
|
let searchValueUsedInFilterValue = false;
|
|
45
|
-
api.filterApi.columnFilterApi.internalApi
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
const columnFilterinternalApi = api.filterApi.columnFilterApi.internalApi;
|
|
49
|
+
let promise = undefined;
|
|
50
|
+
if (usePreviousValuesProbablyBecauseOfAGGridUnnecessaryFilterRemountRef.current) {
|
|
51
|
+
const previousResult = columnFilterinternalApi
|
|
52
|
+
.getAdaptableFilterHandler(columnId)
|
|
53
|
+
?.getLastCachedFilterDisplayValues();
|
|
54
|
+
if (previousResult) {
|
|
55
|
+
promise = Promise.resolve(previousResult);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
usePreviousValuesProbablyBecauseOfAGGridUnnecessaryFilterRemountRef.current = false;
|
|
59
|
+
if (!promise) {
|
|
60
|
+
promise = columnFilterinternalApi.getColumnFilterValues({
|
|
61
|
+
columnId,
|
|
62
|
+
get currentSearchValue() {
|
|
63
|
+
searchValueUsedInFilterValue = true;
|
|
64
|
+
return searchValueRef ? searchValueRef.current : '';
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
promise.then((distinctFilterDisplayValues) => {
|
|
54
69
|
if (ignore) {
|
|
55
70
|
return;
|
|
56
71
|
}
|
|
@@ -96,9 +111,15 @@ const FloatingFilterValues = (props) => {
|
|
|
96
111
|
if (!value || !Array.isArray(value) || value.length === 0) {
|
|
97
112
|
return;
|
|
98
113
|
}
|
|
114
|
+
// see 😅 usePreviousValuesProbablyBecauseOfAGGridUnnecessaryFilterRemountRef 😅
|
|
115
|
+
const usePrevious = !!api.filterApi.columnFilterApi.internalApi
|
|
116
|
+
.getAdaptableFilterHandler(props.columnId)
|
|
117
|
+
?.getLastCachedFilterDisplayValues();
|
|
99
118
|
// however, if the `value` prop is a non-empty array, we need to load the values
|
|
100
119
|
// so we know which labels to show
|
|
101
|
-
triggerValuesLoad(
|
|
120
|
+
triggerValuesLoad({
|
|
121
|
+
usePrevious,
|
|
122
|
+
});
|
|
102
123
|
}, []);
|
|
103
124
|
const quickFilterValuesRef = React.useRef(quickFilterValues);
|
|
104
125
|
quickFilterValuesRef.current = quickFilterValues;
|
|
@@ -13,7 +13,7 @@ const ColumnValuesSelect = (props) => {
|
|
|
13
13
|
const column = props.column;
|
|
14
14
|
const selectedColumnValues = props.value || [];
|
|
15
15
|
const value = [];
|
|
16
|
-
const options = props.options.filter((distinctValue
|
|
16
|
+
const options = (Array.isArray(props.options) ? props.options : []).filter((distinctValue) => {
|
|
17
17
|
let isActive = selectedColumnValues.indexOf(distinctValue.value) >= 0;
|
|
18
18
|
// special case for date objects, need to check against string values
|
|
19
19
|
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: {
|
|
@@ -30,7 +30,13 @@ class AdaptableFilterHandler {
|
|
|
30
30
|
return false;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
getCachedFilterDisplayValues() {
|
|
34
|
+
return this.filterDisplayValuesResult;
|
|
35
|
+
}
|
|
36
|
+
getLastCachedFilterDisplayValues() {
|
|
37
|
+
return this.filterDisplayValuesResult ?? this.previousFilterDisplayValuesResult;
|
|
38
|
+
}
|
|
39
|
+
getFromCacheOrFetchFilterDisplayValues(options) {
|
|
34
40
|
if (this.filterDisplayValuesResult) {
|
|
35
41
|
return Promise.resolve(this.filterDisplayValuesResult);
|
|
36
42
|
}
|
|
@@ -64,12 +70,15 @@ class AdaptableFilterHandler {
|
|
|
64
70
|
this.resetFilterDisplayValues();
|
|
65
71
|
}
|
|
66
72
|
resetFilterDisplayValues() {
|
|
73
|
+
if (this.filterDisplayValuesResult) {
|
|
74
|
+
this.previousFilterDisplayValuesResult = this.filterDisplayValuesResult;
|
|
75
|
+
}
|
|
67
76
|
// Reset the filter display values manually
|
|
68
77
|
this.filterDisplayValuesResult = undefined;
|
|
69
78
|
}
|
|
70
79
|
async refreshFilterDisplayValues() {
|
|
71
80
|
this.resetFilterDisplayValues();
|
|
72
|
-
return this.
|
|
81
|
+
return this.getFromCacheOrFetchFilterDisplayValues({ currentSearchValue: '' });
|
|
73
82
|
}
|
|
74
83
|
refresh(params) {
|
|
75
84
|
// No specific refresh logic needed for this handler
|
|
@@ -77,6 +86,7 @@ class AdaptableFilterHandler {
|
|
|
77
86
|
}
|
|
78
87
|
destroy() {
|
|
79
88
|
this.filterDisplayValuesResult = undefined;
|
|
89
|
+
this.previousFilterDisplayValuesResult = undefined;
|
|
80
90
|
}
|
|
81
91
|
}
|
|
82
92
|
exports.AdaptableFilterHandler = AdaptableFilterHandler;
|
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.0.0-canary.
|
|
5
|
+
PUBLISH_TIMESTAMP: 1757076059447 || Date.now(),
|
|
6
|
+
VERSION: "21.0.0-canary.3" || '--current-version--',
|
|
7
7
|
};
|