@adaptabletools/adaptable 21.0.0-canary.0 → 21.0.0-canary.2
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/AdaptableInterfaces/IAdaptable.d.ts +3 -2
- package/src/AdaptableOptions/DefaultAdaptableOptions.js +0 -1
- package/src/AdaptableOptions/EditOptions.d.ts +6 -1
- package/src/AdaptableOptions/FilterOptions.d.ts +20 -8
- package/src/AdaptableOptions/LayoutOptions.d.ts +35 -1
- package/src/AdaptableState/Common/AdaptableColumn.d.ts +2 -2
- package/src/Api/ColumnFilterApi.d.ts +5 -5
- package/src/Api/Implementation/ColumnApiImpl.js +1 -1
- package/src/Api/Implementation/ColumnFilterApiImpl.d.ts +3 -3
- package/src/Api/Implementation/ColumnFilterApiImpl.js +6 -6
- package/src/Api/Implementation/LayoutApiImpl.js +6 -6
- package/src/Api/Internal/ColumnFilterInternalApi.d.ts +2 -3
- package/src/Api/Internal/ColumnFilterInternalApi.js +17 -25
- package/src/Api/Internal/ColumnInternalApi.js +1 -1
- package/src/Api/Internal/GridInternalApi.d.ts +3 -2
- package/src/Api/Internal/GridInternalApi.js +3 -2
- package/src/Api/Internal/LayoutInternalApi.d.ts +5 -0
- package/src/Api/Internal/LayoutInternalApi.js +44 -1
- package/src/Api/Internal/PredicateInternalApi.js +0 -1
- package/src/Redux/Store/AdaptableStore.js +0 -2
- package/src/Strategy/ColumnFilterModule.js +8 -1
- package/src/Utilities/Helpers/AdaptableHelper.d.ts +1 -0
- package/src/Utilities/Helpers/AdaptableHelper.js +1 -0
- package/src/Utilities/ObjectFactory.d.ts +7 -3
- package/src/Utilities/ObjectFactory.js +25 -17
- package/src/Utilities/adaptableQlUtils.js +1 -1
- package/src/View/Components/ColumnFilter/components/FloatingFilterValues.d.ts +2 -0
- package/src/View/Components/ColumnFilter/components/FloatingFilterValues.js +20 -5
- package/src/View/Components/ColumnFilter/utils.js +0 -1
- package/src/View/Components/PredicateEditor/PredicateEditor.js +14 -0
- package/src/View/Components/Selectors/PermittedValuesSelector.d.ts +2 -4
- package/src/View/Components/Selectors/PermittedValuesSelector.js +6 -5
- package/src/View/Layout/Wizard/LayoutWizard.js +5 -7
- package/src/agGrid/AdaptableAgGrid.d.ts +3 -2
- package/src/agGrid/AdaptableAgGrid.js +20 -10
- package/src/agGrid/AdaptableFilterHandler.d.ts +9 -4
- package/src/agGrid/AdaptableFilterHandler.js +28 -11
- package/src/agGrid/AgGridColumnAdapter.js +5 -2
- package/src/agGrid/AgGridExportAdapter.js +2 -4
- package/src/agGrid/AgGridModulesAdapter.js +5 -1
- package/src/agGrid/agGridDataTypeDefinitions.js +1 -8
- package/src/components/Select/Select.d.ts +1 -0
- package/src/components/Select/Select.js +5 -4
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.d.ts +49 -22
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/migration/VersionUpgrade20.js +1 -2
- package/src/types.d.ts +3 -3
- 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.2",
|
|
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",
|
|
@@ -10,7 +10,7 @@ import { SelectedCellInfo } from '../AdaptableState/Selection/SelectedCellInfo';
|
|
|
10
10
|
import { AdaptableTheme } from '../AdaptableState/ThemeState';
|
|
11
11
|
import { IAdaptableStore } from '../Redux/Store/Interface/IAdaptableStore';
|
|
12
12
|
import { IModuleCollection } from '../Strategy/Interface/IModule';
|
|
13
|
-
import { AdaptableMenuItem, AdaptableOptions, AdaptablePlugin, AdaptableState, ChartDefinition,
|
|
13
|
+
import { AdaptableMenuItem, AdaptableOptions, AdaptablePlugin, AdaptableState, ChartDefinition, InFilterValueResult, SelectedRowInfo } from '../types';
|
|
14
14
|
import { ICalculatedColumnExpressionService } from '../Utilities/Services/Interface/ICalculatedColumnExpressionService';
|
|
15
15
|
import { IDataService } from '../Utilities/Services/Interface/IDataService';
|
|
16
16
|
import { AnnotationsService } from '../Utilities/Services/AnnotationsService';
|
|
@@ -183,7 +183,8 @@ export interface IAdaptable {
|
|
|
183
183
|
getDistinctFilterValuesForColumn(options: {
|
|
184
184
|
column: AdaptableColumn;
|
|
185
185
|
currentSearchValue: string;
|
|
186
|
-
|
|
186
|
+
previousResult: InFilterValueResult | undefined;
|
|
187
|
+
}): Promise<InFilterValueResult>;
|
|
187
188
|
getGridCellFromRowNode(rowNode: IRowNode, columnId: string): GridCell | undefined;
|
|
188
189
|
getRawValueFromRowNode(rowNode: IRowNode, columnId: string): any;
|
|
189
190
|
getDisplayValueFromRowNode(rowNode: IRowNode, columnId: string): string | undefined;
|
|
@@ -150,7 +150,6 @@ const DefaultAdaptableOptions = {
|
|
|
150
150
|
columnFilterOptions: {
|
|
151
151
|
indicateFilteredColumns: true,
|
|
152
152
|
autoApplyColumnFilter: true,
|
|
153
|
-
cacheInFilterValues: true,
|
|
154
153
|
defaultNumericColumnFilter: 'Equals',
|
|
155
154
|
defaultTextColumnFilter: 'Contains',
|
|
156
155
|
defaultDateColumnFilter: 'On',
|
|
@@ -58,7 +58,12 @@ export interface EditColumnValueInfo {
|
|
|
58
58
|
value: any;
|
|
59
59
|
label?: string;
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Information about items in the custom Edit Controls
|
|
63
|
+
*/
|
|
64
|
+
export interface CustomEditColumnValueInfo {
|
|
65
|
+
value: any;
|
|
66
|
+
label?: string;
|
|
62
67
|
}
|
|
63
68
|
/**
|
|
64
69
|
* Used for Server Validation ie. after an edit in AG Grid which must be checked on Server
|
|
@@ -30,7 +30,7 @@ export interface FilterOptions<TData = any> {
|
|
|
30
30
|
* @param context
|
|
31
31
|
* @returns
|
|
32
32
|
*/
|
|
33
|
-
customInFilterValues?: (context: CustomInFilterValuesContext<TData>) => Promise<
|
|
33
|
+
customInFilterValues?: (context: CustomInFilterValuesContext<TData>) => Promise<InFilterValueResult> | InFilterValueResult;
|
|
34
34
|
/**
|
|
35
35
|
* When to re-filter grid after data changes: 'Always', 'Never' or 'Throttle' (with a delay value)
|
|
36
36
|
*
|
|
@@ -86,13 +86,6 @@ export interface ColumnFilterOptions<TData = any> {
|
|
|
86
86
|
* @noCodeItem
|
|
87
87
|
*/
|
|
88
88
|
autoApplyColumnFilter?: boolean | ((context: AdaptableColumnContext) => boolean);
|
|
89
|
-
/**
|
|
90
|
-
* Whether to cache the values in the IN Filter component
|
|
91
|
-
* @defaultValue true
|
|
92
|
-
* @gridInfoItem
|
|
93
|
-
* @noCodeItem
|
|
94
|
-
*/
|
|
95
|
-
cacheInFilterValues?: boolean | ((context: AdaptableColumnContext) => boolean);
|
|
96
89
|
/**
|
|
97
90
|
* Default filter type for numeric Columns
|
|
98
91
|
*
|
|
@@ -212,6 +205,20 @@ export interface InFilterValue<ValueType = any> {
|
|
|
212
205
|
*/
|
|
213
206
|
tooltip?: boolean | string;
|
|
214
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* Result when providing custom values for the IN Column Filter
|
|
210
|
+
*/
|
|
211
|
+
export type InFilterValueResult = {
|
|
212
|
+
/**
|
|
213
|
+
* List of Items to display in the IN Column Filter
|
|
214
|
+
*/
|
|
215
|
+
values: InFilterValueInfo[];
|
|
216
|
+
/**
|
|
217
|
+
* When TRUE, displays the provided values without any filtering.
|
|
218
|
+
* When FALSE, the values are filtered based on the current search text.
|
|
219
|
+
*/
|
|
220
|
+
skipDefaultSearch?: boolean;
|
|
221
|
+
};
|
|
215
222
|
/**
|
|
216
223
|
* Information about items in the IN Column Filter
|
|
217
224
|
*/
|
|
@@ -253,6 +260,11 @@ export interface CustomInFilterValuesContext<TData = any> extends AdaptableColum
|
|
|
253
260
|
* Search text in the IN Filter component - used when filtering on server
|
|
254
261
|
*/
|
|
255
262
|
currentSearchValue: string;
|
|
263
|
+
/**
|
|
264
|
+
* Memoized result from previous invocation. Helps avoid expensive recomputations,
|
|
265
|
+
* especially for async operations (e.g. server-side filtering).
|
|
266
|
+
*/
|
|
267
|
+
previousFilterResult?: InFilterValueResult;
|
|
256
268
|
}
|
|
257
269
|
/**
|
|
258
270
|
* List of Editors that can be used when creating the Grid Filter
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Layout } from '../AdaptableState/LayoutState';
|
|
1
|
+
import { Layout, PivotLayout, TableLayout } from '../AdaptableState/LayoutState';
|
|
2
2
|
import { AdaptableObjectTag } from '../AdaptableState/Common/AdaptableObject';
|
|
3
3
|
import { BaseContext, LayoutExtensionModule, LayoutExtensionObject } from '../../types';
|
|
4
4
|
/**
|
|
@@ -17,6 +17,10 @@ export interface LayoutOptions {
|
|
|
17
17
|
* Columns to display in Table that opens when viewing Pivot Cell contents
|
|
18
18
|
*/
|
|
19
19
|
pivotPreviewColumns?: string[] | ((context: PivotPreviewColumnsContext) => string[]);
|
|
20
|
+
/**
|
|
21
|
+
* Default properties to apply when creating a new Layout (Table or Pivot)
|
|
22
|
+
*/
|
|
23
|
+
defaultLayoutProperties?: DefaultLayoutProperties | ((context: DefaultLayoutPropertiesContext) => DefaultTableLayoutProperties | DefaultPivotLayoutProperties);
|
|
20
24
|
}
|
|
21
25
|
/**
|
|
22
26
|
* Options for managing Tags in Layouts (used to enhance Layouts)
|
|
@@ -93,3 +97,33 @@ export interface PivotPreviewColumnsContext extends BaseContext {
|
|
|
93
97
|
*/
|
|
94
98
|
columnId: string;
|
|
95
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Default properties to apply when creating a new Table Layout
|
|
102
|
+
*/
|
|
103
|
+
export type DefaultTableLayoutProperties = Partial<Omit<TableLayout, 'Name'>>;
|
|
104
|
+
/**
|
|
105
|
+
* Default properties to apply when creating a new Pivot Layout
|
|
106
|
+
*/
|
|
107
|
+
export type DefaultPivotLayoutProperties = Partial<Omit<PivotLayout, 'Name'>>;
|
|
108
|
+
/**
|
|
109
|
+
* Default properties to apply when creating a new Layout (Table or Pivot)
|
|
110
|
+
*/
|
|
111
|
+
export interface DefaultLayoutProperties {
|
|
112
|
+
/**
|
|
113
|
+
* Default properties to apply when creating a new Table Layout
|
|
114
|
+
*/
|
|
115
|
+
tableLayout?: DefaultTableLayoutProperties;
|
|
116
|
+
/**
|
|
117
|
+
* Default properties to apply when creating a new Pivot Layout
|
|
118
|
+
*/
|
|
119
|
+
pivotLayout?: DefaultPivotLayoutProperties;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Context for `LayoutOptions.defaultLayoutProperties` function
|
|
123
|
+
*/
|
|
124
|
+
export interface DefaultLayoutPropertiesContext extends BaseContext {
|
|
125
|
+
/**
|
|
126
|
+
* Type of Layout ('table' | 'pivot')
|
|
127
|
+
*/
|
|
128
|
+
layoutType: 'table' | 'pivot';
|
|
129
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AdaptableObject } from './AdaptableObject';
|
|
2
|
-
import {
|
|
2
|
+
import { ColDef } from 'ag-grid-enterprise';
|
|
3
3
|
import { UniqueGridCell } from '../Selection/GridCell';
|
|
4
4
|
import { ColumnFilter } from './ColumnFilter';
|
|
5
5
|
/**
|
|
6
6
|
* Defines data type of a Column; can be an AG Grid BaseCellDataType or an AdapTable array-related one
|
|
7
7
|
*/
|
|
8
|
-
export type AdaptableColumnDataType =
|
|
8
|
+
export type AdaptableColumnDataType = 'text' | 'number' | 'boolean' | 'date' | 'object' | 'textArray' | 'numberArray' | 'tupleArray' | 'objectArray' | 'unknown';
|
|
9
9
|
/**
|
|
10
10
|
* Column Types recognised by AdapTable; to be set in GridOptions
|
|
11
11
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AdaptableColumn, ColumnFilter, ColumnFilterPredicate,
|
|
1
|
+
import { AdaptableColumn, ColumnFilter, ColumnFilterPredicate, InFilterValueInfo, InFilterValueResult } from '../types';
|
|
2
2
|
import { AdaptablePredicateDef, ColumnFilterDef } from '../AdaptableState/Common/AdaptablePredicate';
|
|
3
3
|
/**
|
|
4
4
|
* Provides run-time access to Filter section of Adaptable State.
|
|
@@ -138,16 +138,16 @@ export interface ColumnFilterApi {
|
|
|
138
138
|
* @param columnId - the ID of the Column for which to refresh filter values.
|
|
139
139
|
* @return a Promise that resolves to the list of filter values, each represented as an object with `value` and `label` properties.
|
|
140
140
|
*/
|
|
141
|
-
refreshFilterValues(columnId: string): Promise<
|
|
141
|
+
refreshFilterValues(columnId: string): Promise<InFilterValueResult>;
|
|
142
142
|
/**
|
|
143
143
|
* Refreshes (reloads) the filter values for ALL Columns (for `IN` Filter).
|
|
144
144
|
*
|
|
145
145
|
* @returns A Promise that resolves to a map where:
|
|
146
146
|
* - keys are column IDs (string)
|
|
147
|
-
* - values are
|
|
148
|
-
* Each
|
|
147
|
+
* - values are objects with a `values` property, which is an array of values for the corresponding column
|
|
148
|
+
* Each item in the array contains a `value` and display `label` property
|
|
149
149
|
*/
|
|
150
|
-
refreshAllFilterValues(): Promise<Record<string,
|
|
150
|
+
refreshAllFilterValues(): Promise<Record<string, InFilterValueResult>>;
|
|
151
151
|
/**
|
|
152
152
|
* Reset(clear cache) the filter values for a given Column (for `IN` Filter).
|
|
153
153
|
* @param columnId - the ID of the Column for which to reset filter values.
|
|
@@ -414,7 +414,7 @@ export class ColumnApiImpl extends ApiBase {
|
|
|
414
414
|
return this.getUIAvailableColumns().filter((c) => c.dataType === 'textArray');
|
|
415
415
|
}
|
|
416
416
|
getDateColumns() {
|
|
417
|
-
return this.getUIAvailableColumns().filter((c) => c.dataType === 'date'
|
|
417
|
+
return this.getUIAvailableColumns().filter((c) => c.dataType === 'date');
|
|
418
418
|
}
|
|
419
419
|
getBooleanColumns() {
|
|
420
420
|
return this.getUIAvailableColumns().filter((c) => c.dataType === 'boolean');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ApiBase } from './ApiBase';
|
|
2
2
|
import { AdaptablePredicateDef, ColumnFilterDef } from '../../AdaptableState/Common/AdaptablePredicate';
|
|
3
3
|
import { AdaptableColumn } from '../../AdaptableState/Common/AdaptableColumn';
|
|
4
|
-
import { ColumnFilter, ColumnFilterPredicate, InFilterValueInfo,
|
|
4
|
+
import { ColumnFilter, ColumnFilterPredicate, InFilterValueInfo, InFilterValueResult } from '../../types';
|
|
5
5
|
import { IAdaptable } from '../../AdaptableInterfaces/IAdaptable';
|
|
6
6
|
import { ColumnFilterInternalApi } from '../Internal/ColumnFilterInternalApi';
|
|
7
7
|
import { ColumnFilterApi } from '../ColumnFilterApi';
|
|
@@ -44,8 +44,8 @@ export declare class ColumnFilterApiImpl extends ApiBase implements ColumnFilter
|
|
|
44
44
|
suspendAllColumnFilters(): void;
|
|
45
45
|
unSuspendAllColumnFilters(): void;
|
|
46
46
|
addBlanksToInFilterValues(columnDistinctValues: InFilterValueInfo[]): InFilterValueInfo[];
|
|
47
|
-
refreshFilterValues(columnId: string): Promise<
|
|
48
|
-
refreshAllFilterValues(): Promise<Record<string,
|
|
47
|
+
refreshFilterValues(columnId: string): Promise<InFilterValueResult>;
|
|
48
|
+
refreshAllFilterValues(): Promise<Record<string, InFilterValueResult>>;
|
|
49
49
|
resetFilterValues(columnId: string): void;
|
|
50
50
|
resetAllFilterValues(): void;
|
|
51
51
|
}
|
|
@@ -214,19 +214,19 @@ export class ColumnFilterApiImpl extends ApiBase {
|
|
|
214
214
|
async refreshAllFilterValues() {
|
|
215
215
|
const allFilterHandlers = this.internalApi.getAllAdaptableFilterHandlers();
|
|
216
216
|
const handlerPromises = allFilterHandlers.map(async (handler) => {
|
|
217
|
-
let
|
|
217
|
+
let result = { values: [] };
|
|
218
218
|
if (typeof handler.refreshFilterDisplayValues === 'function') {
|
|
219
|
-
|
|
219
|
+
result = await handler.refreshFilterDisplayValues();
|
|
220
220
|
}
|
|
221
221
|
else {
|
|
222
222
|
this.logWarn(`No refresh function for filter handler: ${handler.colId}`);
|
|
223
|
-
|
|
223
|
+
result = { values: [] };
|
|
224
224
|
}
|
|
225
|
-
return { columnId: handler.colId,
|
|
225
|
+
return { columnId: handler.colId, result };
|
|
226
226
|
});
|
|
227
227
|
return Promise.all(handlerPromises).then((results) => {
|
|
228
|
-
return results.reduce((acc, { columnId,
|
|
229
|
-
acc[columnId] =
|
|
228
|
+
return results.reduce((acc, { columnId, result }) => {
|
|
229
|
+
acc[columnId] = result;
|
|
230
230
|
return acc;
|
|
231
231
|
}, {});
|
|
232
232
|
});
|
|
@@ -2,8 +2,6 @@ import * as LayoutRedux from '../../Redux/ActionsReducers/LayoutRedux';
|
|
|
2
2
|
import * as ModuleConstants from '../../Utilities/Constants/ModuleConstants';
|
|
3
3
|
import { ApiBase } from './ApiBase';
|
|
4
4
|
import StringExtensions from '../../Utilities/Extensions/StringExtensions';
|
|
5
|
-
import ObjectFactory from '../../Utilities/ObjectFactory';
|
|
6
|
-
import Helper from '../../Utilities/Helpers/Helper';
|
|
7
5
|
import { createUuid } from '../../AdaptableState/Uuid';
|
|
8
6
|
import { PopupShowPrompt } from '../../Redux/ActionsReducers/PopupRedux';
|
|
9
7
|
import { LayoutInternalApi } from '../Internal/LayoutInternalApi';
|
|
@@ -275,7 +273,7 @@ export class LayoutApiImpl extends ApiBase {
|
|
|
275
273
|
this.logError("Cannot create layout with the Name: '" + layoutToCreate.Name + "' as it already exists");
|
|
276
274
|
return false;
|
|
277
275
|
}
|
|
278
|
-
const newLayout =
|
|
276
|
+
const newLayout = this.internalApi.buildInitialLayout(layoutToCreate);
|
|
279
277
|
this.addUidToAdaptableObject(newLayout);
|
|
280
278
|
this.dispatchAction(LayoutRedux.LayoutAdd(newLayout));
|
|
281
279
|
return newLayout;
|
|
@@ -292,9 +290,11 @@ export class LayoutApiImpl extends ApiBase {
|
|
|
292
290
|
this.logError("Cannot clone layout with Name: '" + layoutName + "' as other Layout does not exist");
|
|
293
291
|
return false;
|
|
294
292
|
}
|
|
295
|
-
const newLayout =
|
|
296
|
-
|
|
297
|
-
|
|
293
|
+
const newLayout = {
|
|
294
|
+
...this.internalApi.cloneLayout(layoutToClone),
|
|
295
|
+
Name: layoutName,
|
|
296
|
+
Uuid: createUuid(),
|
|
297
|
+
};
|
|
298
298
|
this.dispatchAction(LayoutRedux.LayoutAdd(newLayout));
|
|
299
299
|
return this.getLayoutById(newLayout.Uuid);
|
|
300
300
|
}
|
|
@@ -5,7 +5,7 @@ import { AdaptablePredicateDef } from '../../AdaptableState/Common/AdaptablePred
|
|
|
5
5
|
import { ColumnFilter } from '../../AdaptableState/Common/ColumnFilter';
|
|
6
6
|
import { GridCell } from '../../AdaptableState/Selection/GridCell';
|
|
7
7
|
import { LayoutColumnFilterAction } from '../../Redux/ActionsReducers/LayoutRedux';
|
|
8
|
-
import {
|
|
8
|
+
import { InFilterValueResult } from '../../types';
|
|
9
9
|
import { ApiBase } from '../Implementation/ApiBase';
|
|
10
10
|
import { AdaptableFilterHandler } from '../../agGrid/AdaptableFilterHandler';
|
|
11
11
|
export declare class ColumnFilterInternalApi extends ApiBase {
|
|
@@ -53,8 +53,7 @@ export declare class ColumnFilterInternalApi extends ApiBase {
|
|
|
53
53
|
getColumnFilterValues(options: {
|
|
54
54
|
columnId: string;
|
|
55
55
|
currentSearchValue: string;
|
|
56
|
-
}): Promise<
|
|
56
|
+
}): Promise<InFilterValueResult>;
|
|
57
57
|
shouldAutoApplyColumnFilter(columnId: string): boolean;
|
|
58
|
-
shouldCacheColumnFilterValues(columnId: string): boolean;
|
|
59
58
|
getAllAdaptableFilterHandlers(): AdaptableFilterHandler[];
|
|
60
59
|
}
|
|
@@ -240,20 +240,28 @@ export class ColumnFilterInternalApi extends ApiBase {
|
|
|
240
240
|
* Only if the FilterHandler is not available we fallback to the GridApi method
|
|
241
241
|
*/
|
|
242
242
|
async getColumnFilterValues(options) {
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
243
|
+
const filterOptions = this.getOptionsApi().getFilterOptions();
|
|
244
|
+
const newOptions = {
|
|
245
|
+
columnId: options.columnId,
|
|
246
|
+
get currentSearchValue() {
|
|
247
|
+
// we need this in order to keep it lazy
|
|
248
|
+
return options.currentSearchValue;
|
|
249
|
+
},
|
|
250
|
+
previousResult: undefined,
|
|
251
|
+
};
|
|
247
252
|
const columnFilterHandler = this.getAgGridApi().getColumnFilterHandler(options.columnId);
|
|
248
253
|
if (!columnFilterHandler) {
|
|
249
254
|
this.logWarn(`No ColumnFilterHandler found for columnId: ${options.columnId}!`);
|
|
250
|
-
return this.getGridApi().internalApi.getDistinctFilterDisplayValuesForColumn(
|
|
255
|
+
return this.getGridApi().internalApi.getDistinctFilterDisplayValuesForColumn(newOptions);
|
|
256
|
+
}
|
|
257
|
+
if (typeof columnFilterHandler.getFilterDisplayValuesFromCache !== 'function') {
|
|
258
|
+
this.logWarn(`ColumnFilterHandler for columnId: ${options.columnId} does not have getFilterDisplayValuesFromCache method!`);
|
|
259
|
+
return this.getGridApi().internalApi.getDistinctFilterDisplayValuesForColumn(newOptions);
|
|
251
260
|
}
|
|
252
|
-
if (
|
|
253
|
-
|
|
254
|
-
return this.getGridApi().internalApi.getDistinctFilterDisplayValuesForColumn(options);
|
|
261
|
+
if (filterOptions.customInFilterValues) {
|
|
262
|
+
return columnFilterHandler.fetchFilterDisplayValues(newOptions);
|
|
255
263
|
}
|
|
256
|
-
return columnFilterHandler.
|
|
264
|
+
return columnFilterHandler.getFilterDisplayValuesFromCache(newOptions);
|
|
257
265
|
}
|
|
258
266
|
shouldAutoApplyColumnFilter(columnId) {
|
|
259
267
|
const autoApplyColumnFilterOpt = this.getOptionsApi().getFilterOptions().columnFilterOptions?.autoApplyColumnFilter;
|
|
@@ -271,22 +279,6 @@ export class ColumnFilterInternalApi extends ApiBase {
|
|
|
271
279
|
// fallback, should never happen
|
|
272
280
|
return true;
|
|
273
281
|
}
|
|
274
|
-
shouldCacheColumnFilterValues(columnId) {
|
|
275
|
-
const cacheColumnFilterValuesOpt = this.getOptionsApi().getFilterOptions().columnFilterOptions?.cacheInFilterValues;
|
|
276
|
-
if (typeof cacheColumnFilterValuesOpt === 'boolean') {
|
|
277
|
-
return cacheColumnFilterValuesOpt;
|
|
278
|
-
}
|
|
279
|
-
if (typeof cacheColumnFilterValuesOpt === 'function') {
|
|
280
|
-
const column = this.getColumnApi().getColumnWithColumnId(columnId);
|
|
281
|
-
const context = {
|
|
282
|
-
column,
|
|
283
|
-
...this.getAdaptableApi().internalApi.buildBaseContext(),
|
|
284
|
-
};
|
|
285
|
-
return cacheColumnFilterValuesOpt(context);
|
|
286
|
-
}
|
|
287
|
-
// fallback, should never happen
|
|
288
|
-
return true;
|
|
289
|
-
}
|
|
290
282
|
getAllAdaptableFilterHandlers() {
|
|
291
283
|
const allFilterableColumns = this.getColumnApi().getFilterableColumns();
|
|
292
284
|
const filterHandlers = allFilterableColumns
|
|
@@ -296,6 +296,6 @@ export class ColumnInternalApi extends ApiBase {
|
|
|
296
296
|
}
|
|
297
297
|
getColumnDateTypes() {
|
|
298
298
|
// this is required because Adaptable uses 'date' type for all AG Grid date types: 'date', 'dateString'
|
|
299
|
-
return ['date'
|
|
299
|
+
return ['date'];
|
|
300
300
|
}
|
|
301
301
|
}
|
|
@@ -5,7 +5,7 @@ import { SpecialColumnSettings } from '../../AdaptableState/Common/SpecialColumn
|
|
|
5
5
|
import { GridCell } from '../../AdaptableState/Selection/GridCell';
|
|
6
6
|
import { SelectedCellInfo } from '../../AdaptableState/Selection/SelectedCellInfo';
|
|
7
7
|
import { SelectedRowInfo } from '../../AdaptableState/Selection/SelectedRowInfo';
|
|
8
|
-
import {
|
|
8
|
+
import { InFilterValueResult } from '../../types';
|
|
9
9
|
import { ApiBase } from '../Implementation/ApiBase';
|
|
10
10
|
import { EditColumnValueInfo } from '../../AdaptableOptions/EditOptions';
|
|
11
11
|
export declare class GridInternalApi extends ApiBase {
|
|
@@ -29,7 +29,8 @@ export declare class GridInternalApi extends ApiBase {
|
|
|
29
29
|
getDistinctFilterDisplayValuesForColumn(options: {
|
|
30
30
|
columnId: string;
|
|
31
31
|
currentSearchValue: string;
|
|
32
|
-
|
|
32
|
+
previousResult: InFilterValueResult | undefined;
|
|
33
|
+
}): Promise<InFilterValueResult>;
|
|
33
34
|
getDistinctValuesForColumn(columnId: string): Promise<GridCell[]> | undefined;
|
|
34
35
|
getDistinctEditDisplayValuesForColumn(options: {
|
|
35
36
|
columnId: string;
|
|
@@ -35,15 +35,16 @@ export class GridInternalApi extends ApiBase {
|
|
|
35
35
|
async getDistinctFilterDisplayValuesForColumn(options) {
|
|
36
36
|
const abColumn = this.getColumnApi().getColumnWithColumnId(options.columnId);
|
|
37
37
|
if (abColumn == undefined) {
|
|
38
|
-
return [];
|
|
38
|
+
return { values: [] };
|
|
39
39
|
}
|
|
40
40
|
const inFilterValues = await this._adaptable.getDistinctFilterValuesForColumn({
|
|
41
41
|
column: abColumn,
|
|
42
42
|
get currentSearchValue() {
|
|
43
43
|
return options.currentSearchValue;
|
|
44
44
|
},
|
|
45
|
+
previousResult: options.previousResult,
|
|
45
46
|
});
|
|
46
|
-
return inFilterValues || [];
|
|
47
|
+
return inFilterValues || { values: [] };
|
|
47
48
|
}
|
|
48
49
|
async getDistinctValuesForColumn(columnId) {
|
|
49
50
|
const abColumn = this.getColumnApi().getColumnWithColumnId(columnId);
|
|
@@ -32,4 +32,9 @@ export declare class LayoutInternalApi extends ApiBase {
|
|
|
32
32
|
setupRowSummaries(): void;
|
|
33
33
|
refreshLayout(): void;
|
|
34
34
|
getChangedColumnSorts(oldSorts: LayoutBase['ColumnSorts'], newSorts: LayoutBase['ColumnSorts']): string[];
|
|
35
|
+
buildInitialLayout(providedLayout: Partial<Layout> & {
|
|
36
|
+
Name: string;
|
|
37
|
+
}, type?: 'table' | 'pivot'): Layout;
|
|
38
|
+
private getDefaultLayoutProperties;
|
|
39
|
+
cloneLayout(layoutToClone: Layout): Omit<Layout, 'Name'>;
|
|
35
40
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { ColumnFilterModuleId, GridFilterModuleId, } from '../../Utilities/Constants/ModuleConstants';
|
|
2
2
|
import ArrayExtensions from '../../Utilities/Extensions/ArrayExtensions';
|
|
3
3
|
import { ApiBase } from '../Implementation/ApiBase';
|
|
4
|
-
import { areLayoutsEqual, normalizeLayout } from '../Implementation/LayoutHelpers';
|
|
4
|
+
import { areLayoutsEqual, isPivotLayout, normalizeLayout } from '../Implementation/LayoutHelpers';
|
|
5
|
+
import ObjectFactory from '../../Utilities/ObjectFactory';
|
|
6
|
+
import Helper from '../../Utilities/Helpers/Helper';
|
|
7
|
+
import AdaptableHelper from '../../Utilities/Helpers/AdaptableHelper';
|
|
5
8
|
export class LayoutInternalApi extends ApiBase {
|
|
6
9
|
getNormalizedLayout(layout) {
|
|
7
10
|
return normalizeLayout(layout);
|
|
@@ -206,4 +209,44 @@ export class LayoutInternalApi extends ApiBase {
|
|
|
206
209
|
});
|
|
207
210
|
return changedColumnIds;
|
|
208
211
|
}
|
|
212
|
+
buildInitialLayout(providedLayout, type) {
|
|
213
|
+
const layoutType = type || (isPivotLayout(providedLayout) ? 'pivot' : 'table');
|
|
214
|
+
const providedTableLayout = providedLayout;
|
|
215
|
+
const providedPivotLayout = providedLayout;
|
|
216
|
+
const initialEmptyLayout = layoutType === 'pivot'
|
|
217
|
+
? ObjectFactory.CreateEmptyPivotLayout({ ...providedPivotLayout })
|
|
218
|
+
: ObjectFactory.CreateEmptyTableLayout({ ...providedTableLayout });
|
|
219
|
+
const defaultLayoutProperties = this.getDefaultLayoutProperties(layoutType);
|
|
220
|
+
const initialLayout = {
|
|
221
|
+
...initialEmptyLayout,
|
|
222
|
+
...defaultLayoutProperties,
|
|
223
|
+
};
|
|
224
|
+
return initialLayout;
|
|
225
|
+
}
|
|
226
|
+
getDefaultLayoutProperties(layoutType) {
|
|
227
|
+
const defaultLayoutPropertiesOption = this.getLayoutOptions().defaultLayoutProperties;
|
|
228
|
+
if (typeof defaultLayoutPropertiesOption === 'object') {
|
|
229
|
+
const initialProps = layoutType === 'table'
|
|
230
|
+
? defaultLayoutPropertiesOption.tableLayout
|
|
231
|
+
: defaultLayoutPropertiesOption.pivotLayout;
|
|
232
|
+
return initialProps;
|
|
233
|
+
}
|
|
234
|
+
if (typeof defaultLayoutPropertiesOption === 'function') {
|
|
235
|
+
const context = {
|
|
236
|
+
layoutType,
|
|
237
|
+
...this.getAdaptableInternalApi().buildBaseContext(),
|
|
238
|
+
};
|
|
239
|
+
return defaultLayoutPropertiesOption(context);
|
|
240
|
+
}
|
|
241
|
+
return {};
|
|
242
|
+
}
|
|
243
|
+
cloneLayout(layoutToClone) {
|
|
244
|
+
let clonedLayout = Helper.cloneObject(layoutToClone);
|
|
245
|
+
let result = {
|
|
246
|
+
...this.buildInitialLayout(clonedLayout),
|
|
247
|
+
};
|
|
248
|
+
result = AdaptableHelper.removeAdaptableObjectPrimitivesInlineDeep(result);
|
|
249
|
+
delete result.Name;
|
|
250
|
+
return result;
|
|
251
|
+
}
|
|
209
252
|
}
|
|
@@ -892,8 +892,6 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
|
|
|
892
892
|
const newLayout = (newLayoutState.Layouts || []).find((l) => l.Name == newLayoutState.CurrentLayout) ||
|
|
893
893
|
newLayoutState.Layouts[0] ||
|
|
894
894
|
ERROR_LAYOUT;
|
|
895
|
-
const changedColumnSorts = adaptable.api.layoutApi.internalApi.getChangedColumnSorts(oldLayout.ColumnSorts, newLayout.ColumnSorts);
|
|
896
|
-
changedColumnSorts.forEach((columnId) => adaptable.api.filterApi.columnFilterApi.resetFilterValues(columnId));
|
|
897
895
|
let refreshColumnFilters = false;
|
|
898
896
|
if (adaptable.api.filterApi.columnFilterApi.internalApi.areColumnFiltersDifferent(oldLayout.ColumnFilters, newLayout.ColumnFilters)) {
|
|
899
897
|
refreshColumnFilters = true;
|
|
@@ -30,11 +30,18 @@ export class ColumnFilterModule extends AdaptableModuleBase {
|
|
|
30
30
|
// we reset the filter cache on sort change, because we might have columns
|
|
31
31
|
// with "In" filters, with custom values, which use `context.orderedValues`
|
|
32
32
|
// customInFilterValues: (context: CustomInFilterValuesContext<Car>) => {
|
|
33
|
-
// return context.orderedValues;
|
|
33
|
+
// return {values: context.orderedValues};
|
|
34
34
|
// }
|
|
35
35
|
// and that order will most likely change when sorting happens
|
|
36
36
|
// so we need to reset the cached filter values when sorting changes
|
|
37
37
|
this.api.eventApi.on('GridSorted', () => {
|
|
38
|
+
const filterOptions = this.api.optionsApi.getFilterOptions();
|
|
39
|
+
if (!filterOptions.customInFilterValues) {
|
|
40
|
+
// no-one is using context.sortedValues/context.orderedValues
|
|
41
|
+
// or a custom property from a value, like value.count or value.visible
|
|
42
|
+
// so no need to reset the filter display values
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
38
45
|
this.api.filterApi.columnFilterApi.resetAllFilterValues();
|
|
39
46
|
});
|
|
40
47
|
}
|
|
@@ -14,6 +14,7 @@ export declare const AdaptableHelper: {
|
|
|
14
14
|
addAdaptableObjectPrimitives: typeof addAdaptableObjectPrimitives;
|
|
15
15
|
removeAdaptableObjectPrimitives: typeof removeAdaptableObjectPrimitives;
|
|
16
16
|
removeAdaptableObjectPrimitivesInline: typeof removeAdaptableObjectPrimitivesInline;
|
|
17
|
+
removeAdaptableObjectPrimitivesInlineDeep: typeof removeAdaptableObjectPrimitivesInlineDeep;
|
|
17
18
|
isAdaptableObject: typeof isAdaptableObject;
|
|
18
19
|
};
|
|
19
20
|
export default AdaptableHelper;
|
|
@@ -106,6 +106,7 @@ export const AdaptableHelper = {
|
|
|
106
106
|
addAdaptableObjectPrimitives,
|
|
107
107
|
removeAdaptableObjectPrimitives,
|
|
108
108
|
removeAdaptableObjectPrimitivesInline,
|
|
109
|
+
removeAdaptableObjectPrimitivesInlineDeep,
|
|
109
110
|
isAdaptableObject,
|
|
110
111
|
};
|
|
111
112
|
export default AdaptableHelper;
|
|
@@ -23,7 +23,7 @@ import { NotificationsOptions } from '../AdaptableOptions/NotificationsOptions';
|
|
|
23
23
|
import { CellSummmaryInfo } from '../AdaptableState/Common/CellSummary';
|
|
24
24
|
import { AdaptableTheme, ChartDefinition, ColumnFilter, CommentThread, CustomDisplayFormatterContext, FlashingCellDefinition, RowDataChangedInfo, SpecialColumnSettings, SystemFilterPredicateId } from '../types';
|
|
25
25
|
import { IRowNode } from 'ag-grid-enterprise';
|
|
26
|
-
import { AdaptableApi, AdaptableComment, BadgeStyleDefinition, CellAddress, NamedQuery, PivotLayout } from '../../types';
|
|
26
|
+
import { AdaptableApi, AdaptableComment, BadgeStyleDefinition, CellAddress, NamedQuery, PivotLayout, TableLayout } from '../../types';
|
|
27
27
|
import { ToastOptions } from '../components/Toastify';
|
|
28
28
|
import { StyledColumn } from '../AdaptableState/StyledColumnState';
|
|
29
29
|
export declare function CreateEmptyCustomSort(): CustomSort;
|
|
@@ -51,12 +51,15 @@ export declare function CreateEmptySchedule(): Schedule;
|
|
|
51
51
|
export declare function CreateEmptyShortcut(): Shortcut;
|
|
52
52
|
export declare function CreateEmptyFormatColumn(): FormatColumn;
|
|
53
53
|
export declare function CreateEmptyFreeTextColumn(defaultSpecialColumnSettings: Partial<SpecialColumnSettings>): FreeTextColumn;
|
|
54
|
-
export declare function CreateEmptyPivotLayout(
|
|
54
|
+
export declare function CreateEmptyPivotLayout(pivotLayout?: Partial<PivotLayout> & {
|
|
55
55
|
Name: string;
|
|
56
56
|
}): PivotLayout;
|
|
57
|
+
export declare function CreateEmptyTableLayout(tableLayout?: Partial<TableLayout> & {
|
|
58
|
+
Name: string;
|
|
59
|
+
}): TableLayout;
|
|
57
60
|
export declare function CreateEmptyLayout(layout?: Partial<Layout> & {
|
|
58
61
|
Name: string;
|
|
59
|
-
}
|
|
62
|
+
}): Layout;
|
|
60
63
|
export declare function CreateEmptyStyle(): AdaptableStyle;
|
|
61
64
|
export declare function CreateSystemStatusMessageInfo(message: string, type: AdaptableMessageType, furtherInfo?: string): SystemStatusMessageInfo;
|
|
62
65
|
export declare function CreateEmptyCellSummmary(): CellSummmaryInfo;
|
|
@@ -100,6 +103,7 @@ export declare const ObjectFactory: {
|
|
|
100
103
|
CreateEmptyFreeTextColumn: typeof CreateEmptyFreeTextColumn;
|
|
101
104
|
CreateEmptyLayout: typeof CreateEmptyLayout;
|
|
102
105
|
CreateEmptyPivotLayout: typeof CreateEmptyPivotLayout;
|
|
106
|
+
CreateEmptyTableLayout: typeof CreateEmptyTableLayout;
|
|
103
107
|
CreateColumnFilter: typeof CreateColumnFilter;
|
|
104
108
|
CreateEmptyStyle: typeof CreateEmptyStyle;
|
|
105
109
|
CreateEmptyCellSummmary: typeof CreateEmptyCellSummmary;
|