@adaptabletools/adaptable 18.1.0-canary.0 → 18.1.0-canary.1
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/base.css +5 -0
- package/base.css.map +1 -1
- package/index.css +7 -0
- package/index.css.map +1 -1
- package/package.json +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +4 -4
- package/src/AdaptableOptions/ColumnFilterOptions.d.ts +39 -24
- package/src/Api/ColumnApi.d.ts +5 -0
- package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
- package/src/Api/Implementation/ColumnApiImpl.js +3 -0
- package/src/Api/Implementation/ConfigApiImpl.js +3 -1
- package/src/Api/Internal/ColumnFilterInternalApi.js +6 -6
- package/src/Api/Internal/GridInternalApi.d.ts +29 -13
- package/src/Api/Internal/GridInternalApi.js +129 -39
- package/src/PredefinedConfig/Common/AdaptableField.d.ts +1 -1
- package/src/PredefinedConfig/Common/AdaptablePredicate.js +5 -1
- package/src/Utilities/Constants/DocumentationLinkConstants.js +4 -4
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnTypeSection.js +5 -5
- package/src/View/Components/FilterForm/FilterForm.js +2 -2
- package/src/View/Components/FilterForm/ListBoxFilterForm.js +2 -1
- package/src/View/Components/FilterForm/QuickFilterValues.d.ts +1 -1
- package/src/View/Components/FilterForm/QuickFilterValues.js +20 -43
- package/src/View/Components/Selectors/PermittedValuesSelector.js +1 -1
- package/src/agGrid/AdaptableAgGrid.d.ts +4 -4
- package/src/agGrid/AdaptableAgGrid.js +21 -16
- package/src/agGrid/FilterWrapper.js +12 -7
- package/src/agGrid/defaultAdaptableOptions.js +2 -2
- package/src/components/ExpressionEditor/EditorInput.js +1 -1
- package/src/components/ExpressionEditor/index.js +1 -3
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.d.ts +45 -2
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/parser/src/predicate/mapExpressionToQlPredicate.js +1 -0
- package/src/types.d.ts +1 -1
- package/tsconfig.esm.tsbuildinfo +1 -1
|
@@ -44,11 +44,10 @@ export interface AgGridConfig {
|
|
|
44
44
|
*/
|
|
45
45
|
modules: Module[];
|
|
46
46
|
}
|
|
47
|
-
export interface
|
|
47
|
+
export interface DistinctColumnValuesParams {
|
|
48
48
|
visibleRowsOnly?: boolean;
|
|
49
49
|
skipRowNode?: IRowNode;
|
|
50
50
|
permittedValues?: any[];
|
|
51
|
-
addBlankValue?: boolean;
|
|
52
51
|
}
|
|
53
52
|
export type AdaptableVariant = 'vanilla' | 'react' | 'angular';
|
|
54
53
|
/**
|
|
@@ -172,13 +171,13 @@ export interface IAdaptable {
|
|
|
172
171
|
}>;
|
|
173
172
|
deleteRows(dataRows: any[], dataUpdateConfig?: DataUpdateConfig): Promise<IRowNode[]>;
|
|
174
173
|
getPrimaryKeyValueFromRowNode(rowNode: IRowNode, gridApi?: GridApi): any;
|
|
175
|
-
getDistinctValuesForColumn(column: AdaptableColumn, distinctValuesParams:
|
|
174
|
+
getDistinctValuesForColumn(column: AdaptableColumn, distinctValuesParams: DistinctColumnValuesParams): GridCell[];
|
|
176
175
|
getGridCellFromRowNode(rowNode: IRowNode, columnId: string): GridCell | undefined;
|
|
177
176
|
getRawValueFromRowNode(rowNode: IRowNode, columnId: string): any;
|
|
178
177
|
getDisplayValueFromRowNode(rowNode: IRowNode, columnId: string): string | undefined;
|
|
179
178
|
getDisplayValueFromRawValue(rowNode: IRowNode, columnId: string, rawValue: any): string | undefined;
|
|
180
179
|
getNormalisedValueFromRawValue(rawValue: any, column: AdaptableColumn): string | number | boolean | Date | unknown;
|
|
181
|
-
getGridCellsForColumn(columnId: string, includeBlanks?: boolean): GridCell[] | undefined;
|
|
180
|
+
getGridCellsForColumn(columnId: string, includeBlanks?: boolean, onlyVisibleRows?: boolean): GridCell[] | undefined;
|
|
182
181
|
getRowNodesForPrimaryKeys(primaryKeyValues: any[]): IRowNode[];
|
|
183
182
|
getRowNodeForPrimaryKey(primaryKeyValue: any): IRowNode;
|
|
184
183
|
getRowNodeByIndex(index: number): IRowNode;
|
|
@@ -255,6 +254,7 @@ export interface IAdaptable {
|
|
|
255
254
|
getAgGridContainerElement(): HTMLElement | null;
|
|
256
255
|
updateColumnModelAndRefreshGrid(config?: {
|
|
257
256
|
skipColDefsRefresh?: boolean;
|
|
257
|
+
preemptiveColumnStateRefresh?: boolean;
|
|
258
258
|
}): void;
|
|
259
259
|
getAgGridColumnForColumnId(columnId: string): Column;
|
|
260
260
|
getMinMaxCachedValueForColumn(column: AdaptableColumn, minMax: 'min' | 'max'): number | undefined;
|
|
@@ -112,12 +112,12 @@ export interface ColumnFilterOptions<TData = any> {
|
|
|
112
112
|
*/
|
|
113
113
|
showDatePicker?: boolean;
|
|
114
114
|
/**
|
|
115
|
-
*
|
|
115
|
+
* Configure whether some Rows will not be evaluated when Column Filtering
|
|
116
116
|
*
|
|
117
117
|
* @param context
|
|
118
118
|
* @returns boolean
|
|
119
119
|
*/
|
|
120
|
-
isRowFilterable?: (context:
|
|
120
|
+
isRowFilterable?: (context: IsRowFilterableContext) => boolean;
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
123
123
|
* Options for managing the Filter Bar (aka Quick Filter)
|
|
@@ -211,27 +211,20 @@ export interface ValuesFilterOptions<TData = any> {
|
|
|
211
211
|
*/
|
|
212
212
|
filterValuesUsingTime?: boolean;
|
|
213
213
|
/**
|
|
214
|
-
* Display only currently filtered
|
|
214
|
+
* Display only currently filtered values in Filter controls
|
|
215
215
|
*
|
|
216
216
|
* @defaultValue false
|
|
217
217
|
* @gridInfoItem
|
|
218
218
|
* @noCodeItem
|
|
219
219
|
*/
|
|
220
|
-
|
|
220
|
+
showCurrentlyFilteredValuesOnly?: boolean;
|
|
221
221
|
/**
|
|
222
222
|
* Show the count of each distinct item for given column in the Values (IN) Filter
|
|
223
223
|
* @defaultValue false
|
|
224
224
|
* @gridInfoItem
|
|
225
225
|
* @noCodeItem
|
|
226
226
|
*/
|
|
227
|
-
showValuesCount?: (columFilterContext: ColumnFilterContext<TData>) => boolean;
|
|
228
|
-
/**
|
|
229
|
-
* Includes a [BLANKS] entry in Values filter
|
|
230
|
-
* @defaultValue false
|
|
231
|
-
* @gridInfoItem
|
|
232
|
-
* @noCodeItem
|
|
233
|
-
*/
|
|
234
|
-
includeBlankFilterValues?: boolean;
|
|
227
|
+
showValuesCount?: boolean | ((columFilterContext: ColumnFilterContext<TData>) => boolean);
|
|
235
228
|
/**
|
|
236
229
|
* Whether column values in filter dropdown should apply column's current Sort Order for the column
|
|
237
230
|
*
|
|
@@ -248,18 +241,9 @@ export interface ValuesFilterOptions<TData = any> {
|
|
|
248
241
|
*/
|
|
249
242
|
valuesFilterTrigger?: 'mouseenter' | 'click';
|
|
250
243
|
/**
|
|
251
|
-
*
|
|
252
|
-
* The predicates should not take inputs, good predicates can be: 'BLANK', 'NOT_BLANK', 'TODAY'
|
|
253
|
-
*/
|
|
254
|
-
predicates?: ColumnValuesFilterPredicate[] | ((context: ColumnFilterPredicateContext) => ColumnValuesFilterPredicate[]);
|
|
255
|
-
/**
|
|
256
|
-
* Where shoudld predicates be displayed in the values filter.
|
|
244
|
+
* Options for including (Non Input) Predicates in Values Filter
|
|
257
245
|
*/
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
export type ColumnValuesFilterPredicate = TypeHint<string, SystemFilterPredicateIds>;
|
|
261
|
-
export interface ColumnFilterPredicateContext extends BaseContext {
|
|
262
|
-
column: AdaptableColumn;
|
|
246
|
+
valuesFilterPredicateOptions?: ValuesFilterPredicateOptions;
|
|
263
247
|
}
|
|
264
248
|
/**
|
|
265
249
|
* Context provided when Column Filtering
|
|
@@ -270,7 +254,38 @@ export interface ColumnFilterContext<TData = any> extends BaseContext {
|
|
|
270
254
|
*/
|
|
271
255
|
column: AdaptableColumn<TData>;
|
|
272
256
|
}
|
|
273
|
-
|
|
257
|
+
/**
|
|
258
|
+
* Context used for setting whether a Row can be Column Filtered
|
|
259
|
+
*/
|
|
260
|
+
export interface IsRowFilterableContext<TData = any> extends BaseContext {
|
|
274
261
|
rowNode: IRowNode;
|
|
275
262
|
data: TData;
|
|
276
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* Options for including Predicates in Values Filter
|
|
266
|
+
*/
|
|
267
|
+
export interface ValuesFilterPredicateOptions<TData = any> {
|
|
268
|
+
/**
|
|
269
|
+
* Predicates to add to Values Filter: should NOT take inputs (ie. use 'BLANK', 'NOT_BLANK', 'TODAY')
|
|
270
|
+
*/
|
|
271
|
+
predicates: ColumnValuesFilterPredicate[] | ((context: ColumnFilterContext) => ColumnValuesFilterPredicate[]);
|
|
272
|
+
/**
|
|
273
|
+
* Where Predicates are displayed in Values Filter
|
|
274
|
+
* @defaultValue 'Start'
|
|
275
|
+
*/
|
|
276
|
+
predicatesPosition?: 'Start' | 'End';
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Context provided when Column Filtering
|
|
280
|
+
*/
|
|
281
|
+
export interface ValuesFilterPredicateContext<TData = any> extends BaseContext {
|
|
282
|
+
/**
|
|
283
|
+
* Column being filtered
|
|
284
|
+
*/
|
|
285
|
+
column: AdaptableColumn<TData>;
|
|
286
|
+
/**
|
|
287
|
+
* Predicate being evaluated
|
|
288
|
+
*/
|
|
289
|
+
predicate: ColumnValuesFilterPredicate;
|
|
290
|
+
}
|
|
291
|
+
export type ColumnValuesFilterPredicate = TypeHint<string, SystemFilterPredicateIds>;
|
package/src/Api/ColumnApi.d.ts
CHANGED
|
@@ -290,6 +290,11 @@ export interface ColumnApi {
|
|
|
290
290
|
* Sets the Column Definitions for the Grid
|
|
291
291
|
*/
|
|
292
292
|
setColumnDefinitions(columnDefinitions: (ColDef | ColGroupDef)[]): void;
|
|
293
|
+
/**
|
|
294
|
+
* Returns all the distinct display values in a given Column
|
|
295
|
+
* @param columnId Column to Check
|
|
296
|
+
*/
|
|
297
|
+
getDistinctDisplayValuesForColumn(columnId: string): any[];
|
|
293
298
|
}
|
|
294
299
|
/**
|
|
295
300
|
* Configuration of an AG Grid Column, used for runtime updating of ColDefs
|
|
@@ -72,4 +72,5 @@ export declare class ColumnApiImpl extends ApiBase implements ColumnApi {
|
|
|
72
72
|
updateColumnConfiguration(columnConfig: ColumnConfig): void;
|
|
73
73
|
updateColumnConfigurations(columnConfigs: ColumnConfig[]): void;
|
|
74
74
|
setColumnDefinitions(columnDefinitions: (ColDef | ColGroupDef)[]): void;
|
|
75
|
+
getDistinctDisplayValuesForColumn(columnId: string): any[];
|
|
75
76
|
}
|
|
@@ -393,4 +393,7 @@ export class ColumnApiImpl extends ApiBase {
|
|
|
393
393
|
const agGridApi = this.adaptable.agGridAdapter.getAgGridApi();
|
|
394
394
|
agGridApi.setGridOption('columnDefs', columnDefinitions);
|
|
395
395
|
}
|
|
396
|
+
getDistinctDisplayValuesForColumn(columnId) {
|
|
397
|
+
return this.getAdaptableApi().gridApi.internalApi.getDistinctDisplayValuesForColumn(columnId);
|
|
398
|
+
}
|
|
396
399
|
}
|
|
@@ -137,7 +137,9 @@ export class ConfigApiImpl extends ApiBase {
|
|
|
137
137
|
});
|
|
138
138
|
promise
|
|
139
139
|
.then(() => {
|
|
140
|
-
this.adaptable.updateColumnModelAndRefreshGrid({
|
|
140
|
+
this.adaptable.updateColumnModelAndRefreshGrid({
|
|
141
|
+
preemptiveColumnStateRefresh: true,
|
|
142
|
+
});
|
|
141
143
|
this.adaptable.setLayout();
|
|
142
144
|
})
|
|
143
145
|
.then(() => {
|
|
@@ -207,16 +207,16 @@ export class ColumnFilterInternalApi extends ApiBase {
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
getValuesFitlerPredicateIds(column) {
|
|
210
|
-
var _a;
|
|
211
|
-
const
|
|
210
|
+
var _a, _b;
|
|
211
|
+
const valuesFilterPredicateOptions = (_b = (_a = this.getOptions().columnFilterOptions) === null || _a === void 0 ? void 0 : _a.valuesFilterOptions) === null || _b === void 0 ? void 0 : _b.valuesFilterPredicateOptions;
|
|
212
212
|
const availablePredicates = this.getPredicateApi().getPredicateDefsByModuleScope('columnFilter');
|
|
213
213
|
let predicateIds = [];
|
|
214
|
-
if (typeof (
|
|
214
|
+
if (typeof (valuesFilterPredicateOptions === null || valuesFilterPredicateOptions === void 0 ? void 0 : valuesFilterPredicateOptions.predicates) === 'function') {
|
|
215
215
|
const columnFilterContext = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { column: column });
|
|
216
|
-
predicateIds =
|
|
216
|
+
predicateIds = valuesFilterPredicateOptions.predicates(columnFilterContext);
|
|
217
217
|
}
|
|
218
|
-
else if (Array.isArray(
|
|
219
|
-
predicateIds =
|
|
218
|
+
else if (Array.isArray(valuesFilterPredicateOptions === null || valuesFilterPredicateOptions === void 0 ? void 0 : valuesFilterPredicateOptions.predicates)) {
|
|
219
|
+
predicateIds = valuesFilterPredicateOptions.predicates;
|
|
220
220
|
}
|
|
221
221
|
return predicateIds.filter((predicateId) => {
|
|
222
222
|
const predicate = availablePredicates.find((p) => p.id === predicateId);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ApiBase } from '../Implementation/ApiBase';
|
|
2
|
-
import { CellDataChangedInfo } from '../../PredefinedConfig/Common/CellDataChangedInfo';
|
|
3
1
|
import { IRowNode, RowClassParams } from '@ag-grid-community/core';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { DistinctColumnValuesParams } from '../../AdaptableInterfaces/IAdaptable';
|
|
3
|
+
import { EditLookUpPermittedValues } from '../../AdaptableOptions/UserInterfaceOptions';
|
|
6
4
|
import { AdaptableColumn, AdaptableColumnDataType } from '../../PredefinedConfig/Common/AdaptableColumn';
|
|
7
|
-
import {
|
|
8
|
-
import { SelectedRowInfo } from '../../PredefinedConfig/Selection/SelectedRowInfo';
|
|
5
|
+
import { CellDataChangedInfo } from '../../PredefinedConfig/Common/CellDataChangedInfo';
|
|
9
6
|
import { AdaptableMenuItem } from '../../PredefinedConfig/Common/Menu';
|
|
10
|
-
import { EditLookUpPermittedValues } from '../../AdaptableOptions/UserInterfaceOptions';
|
|
11
|
-
import { DistinctValuesParams } from '../../AdaptableInterfaces/IAdaptable';
|
|
12
|
-
import { AdaptableColumnType } from '../../PredefinedConfig/Common/Types';
|
|
13
7
|
import { SpecialColumnSettings } from '../../PredefinedConfig/Common/SpecialColumnSettings';
|
|
8
|
+
import { AdaptableColumnType } from '../../PredefinedConfig/Common/Types';
|
|
9
|
+
import { GridCell } from '../../PredefinedConfig/Selection/GridCell';
|
|
10
|
+
import { SelectedCellInfo } from '../../PredefinedConfig/Selection/SelectedCellInfo';
|
|
11
|
+
import { SelectedRowInfo } from '../../PredefinedConfig/Selection/SelectedRowInfo';
|
|
12
|
+
import { GridDataChangeTrigger } from '../Events/GridDataChanged';
|
|
13
|
+
import { ApiBase } from '../Implementation/ApiBase';
|
|
14
14
|
export declare class GridInternalApi extends ApiBase {
|
|
15
15
|
/**
|
|
16
16
|
* Fires Grid Sorted Event
|
|
@@ -25,7 +25,7 @@ export declare class GridInternalApi extends ApiBase {
|
|
|
25
25
|
*/
|
|
26
26
|
fireGridDataChangedEvent(dataRows: any[], rowNodes: IRowNode[], rowTrigger: GridDataChangeTrigger): void;
|
|
27
27
|
/**
|
|
28
|
-
* Gets all distinct display values in the Column
|
|
28
|
+
* Gets all distinct display values in the Column for given ColumnId
|
|
29
29
|
* @param columnId Column to check
|
|
30
30
|
*/
|
|
31
31
|
getDistinctDisplayValuesForColumn(columnId: string): any[];
|
|
@@ -33,6 +33,11 @@ export declare class GridInternalApi extends ApiBase {
|
|
|
33
33
|
* Gets all distinct Filter values for the Column with the given ColumnId
|
|
34
34
|
* used for Floating Filter and Column Header filter
|
|
35
35
|
* either returns a list of values or al ist a list of values with count
|
|
36
|
+
*
|
|
37
|
+
* This is a general method, and it is used in:
|
|
38
|
+
* - Column Filters
|
|
39
|
+
* - Query Builder
|
|
40
|
+
*
|
|
36
41
|
* @param columnId Column to check
|
|
37
42
|
* @param columnFilter Current applied filter
|
|
38
43
|
*/
|
|
@@ -43,7 +48,18 @@ export declare class GridInternalApi extends ApiBase {
|
|
|
43
48
|
}[];
|
|
44
49
|
suppressClientSideFilter: boolean;
|
|
45
50
|
}>;
|
|
46
|
-
|
|
51
|
+
private shouldShowValuesCount;
|
|
52
|
+
getDistinctFilterDisplayValuesForColumnForFiltersUI(columnId: string, filter: string, showFilteredRowsOnly: boolean): Promise<{
|
|
53
|
+
values: {
|
|
54
|
+
value: any;
|
|
55
|
+
label: string;
|
|
56
|
+
}[];
|
|
57
|
+
suppressClientSideFilter: boolean;
|
|
58
|
+
}>;
|
|
59
|
+
private addPredicateValues;
|
|
60
|
+
private isPredicateInVisibleCellValues;
|
|
61
|
+
private getPredicateOccurance;
|
|
62
|
+
getDistinctFilterListValuesForColumn(column: AdaptableColumn, filter: string, distinctValuesParams: DistinctColumnValuesParams): Promise<{
|
|
47
63
|
suppressClientSideFilter?: boolean;
|
|
48
64
|
gridCells: GridCell[];
|
|
49
65
|
}>;
|
|
@@ -52,14 +68,14 @@ export declare class GridInternalApi extends ApiBase {
|
|
|
52
68
|
* @param columnId Column to check
|
|
53
69
|
*/
|
|
54
70
|
getDistinctCustomSortDisplayValuesForColumn(columnId: string): Promise<any[]>;
|
|
55
|
-
getDistinctCustomSortValuesForColumn(column: AdaptableColumn, distinctValuesParams:
|
|
71
|
+
getDistinctCustomSortValuesForColumn(column: AdaptableColumn, distinctValuesParams: DistinctColumnValuesParams): Promise<GridCell<any>[]>;
|
|
56
72
|
/**
|
|
57
73
|
* Gets all distinct Bulk Update values for the Column with the given ColumnId
|
|
58
74
|
* @param columnId Column to check
|
|
59
75
|
* @param selectedGridCells Selected grid cells
|
|
60
76
|
*/
|
|
61
77
|
getDistinctBulkUpdateDisplayValuesForColumn(columnId: string, selectedGridCells: GridCell[]): Promise<any[]>;
|
|
62
|
-
getDistinctBulkUpdateValuesForColumn(column: AdaptableColumn, selectedGridCells: GridCell[], distinctValuesParams:
|
|
78
|
+
getDistinctBulkUpdateValuesForColumn(column: AdaptableColumn, selectedGridCells: GridCell[], distinctValuesParams: DistinctColumnValuesParams): Promise<GridCell<any>[]>;
|
|
63
79
|
/**
|
|
64
80
|
* Gets all distinct visible (after current filters are applied) display values in the Column with the given ColumnId
|
|
65
81
|
* @param columnId Column to check
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { ApiBase } from '../Implementation/ApiBase';
|
|
2
1
|
import { SortOrder } from '../../PredefinedConfig/Common/Enums';
|
|
3
|
-
import ArrayExtensions from '../../Utilities/Extensions/ArrayExtensions';
|
|
4
2
|
import * as GridRedux from '../../Redux/ActionsReducers/GridRedux';
|
|
3
|
+
import ArrayExtensions from '../../Utilities/Extensions/ArrayExtensions';
|
|
5
4
|
import NumberExtensions from '../../Utilities/Extensions/NumberExtensions';
|
|
6
5
|
import { convertAdaptableStyleToCSS } from '../../Utilities/Helpers/StyleHelper';
|
|
7
|
-
import UIHelper from '../../View/UIHelper';
|
|
8
6
|
import { createBaseContext } from '../../Utilities/ObjectFactory';
|
|
9
|
-
import
|
|
7
|
+
import UIHelper from '../../View/UIHelper';
|
|
8
|
+
import { ApiBase } from '../Implementation/ApiBase';
|
|
10
9
|
export class GridInternalApi extends ApiBase {
|
|
11
10
|
/**
|
|
12
11
|
* Fires Grid Sorted Event
|
|
@@ -41,7 +40,7 @@ export class GridInternalApi extends ApiBase {
|
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
/**
|
|
44
|
-
* Gets all distinct display values in the Column
|
|
43
|
+
* Gets all distinct display values in the Column for given ColumnId
|
|
45
44
|
* @param columnId Column to check
|
|
46
45
|
*/
|
|
47
46
|
getDistinctDisplayValuesForColumn(columnId) {
|
|
@@ -61,11 +60,15 @@ export class GridInternalApi extends ApiBase {
|
|
|
61
60
|
* Gets all distinct Filter values for the Column with the given ColumnId
|
|
62
61
|
* used for Floating Filter and Column Header filter
|
|
63
62
|
* either returns a list of values or al ist a list of values with count
|
|
63
|
+
*
|
|
64
|
+
* This is a general method, and it is used in:
|
|
65
|
+
* - Column Filters
|
|
66
|
+
* - Query Builder
|
|
67
|
+
*
|
|
64
68
|
* @param columnId Column to check
|
|
65
69
|
* @param columnFilter Current applied filter
|
|
66
70
|
*/
|
|
67
71
|
async getDistinctFilterDisplayValuesForColumn(columnId, filter, showFilteredRowsOnly) {
|
|
68
|
-
var _a, _b;
|
|
69
72
|
const abColumn = this.getColumnApi().getColumnWithColumnId(columnId);
|
|
70
73
|
if (abColumn == undefined) {
|
|
71
74
|
return {
|
|
@@ -73,53 +76,140 @@ export class GridInternalApi extends ApiBase {
|
|
|
73
76
|
suppressClientSideFilter: false,
|
|
74
77
|
};
|
|
75
78
|
}
|
|
76
|
-
const addBlankValue = this.getColumnFilterOptions().valuesFilterOptions.includeBlankFilterValues;
|
|
77
79
|
const distinctValuesParams = {
|
|
78
80
|
visibleRowsOnly: showFilteredRowsOnly,
|
|
79
|
-
addBlankValue: addBlankValue,
|
|
80
81
|
};
|
|
81
82
|
const { gridCells, suppressClientSideFilter } = await this.getDistinctFilterListValuesForColumn(abColumn, filter, distinctValuesParams);
|
|
82
83
|
const sortedDistinctValues = this.sortDistinctValues(gridCells, abColumn);
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (showValuesCountFunction) {
|
|
86
|
-
const columnFilterContext = Object.assign({ column: abColumn }, this.getAdaptableApi().internalApi.buildBaseContext());
|
|
87
|
-
shouldShowValuesCount = showValuesCountFunction(columnFilterContext);
|
|
88
|
-
}
|
|
84
|
+
const shouldShowValuesCount = this.shouldShowValuesCount(abColumn);
|
|
85
|
+
let valueOptions = [];
|
|
89
86
|
if (shouldShowValuesCount) {
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return {
|
|
102
|
-
values: newsortedDistinctValues.map((cv) => {
|
|
103
|
-
const label = cv.displayValue +
|
|
104
|
-
NumberExtensions.WrapInParentheses(ArrayExtensions.getOccurrence(allColumnDisplayValues, cv.displayValue));
|
|
105
|
-
return {
|
|
106
|
-
label: label,
|
|
107
|
-
value: cv.normalisedValue,
|
|
108
|
-
};
|
|
109
|
-
}),
|
|
110
|
-
suppressClientSideFilter,
|
|
111
|
-
};
|
|
87
|
+
const allGridCells = this.adaptable.getGridCellsForColumn(columnId);
|
|
88
|
+
const allGridValues = allGridCells.map((gc) => gc.displayValue);
|
|
89
|
+
const newsortedDistinctValues = sortedDistinctValues.filter((gc) => gc.displayValue != undefined && gc.displayValue != '' && gc.displayValue != null);
|
|
90
|
+
valueOptions = newsortedDistinctValues.map((cv) => {
|
|
91
|
+
const label = cv.displayValue +
|
|
92
|
+
NumberExtensions.WrapInParentheses(ArrayExtensions.getOccurrence(allGridValues, cv.displayValue));
|
|
93
|
+
return {
|
|
94
|
+
label: label,
|
|
95
|
+
value: cv.normalisedValue,
|
|
96
|
+
};
|
|
97
|
+
});
|
|
112
98
|
}
|
|
113
|
-
|
|
114
|
-
|
|
99
|
+
else {
|
|
100
|
+
valueOptions = sortedDistinctValues.map((cv) => {
|
|
115
101
|
return {
|
|
116
102
|
label: cv.displayValue,
|
|
117
103
|
value: cv.normalisedValue,
|
|
118
104
|
};
|
|
119
|
-
})
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
values: valueOptions,
|
|
120
109
|
suppressClientSideFilter,
|
|
121
110
|
};
|
|
122
111
|
}
|
|
112
|
+
shouldShowValuesCount(column) {
|
|
113
|
+
const showValuesCount = this.getColumnFilterOptions().valuesFilterOptions.showValuesCount;
|
|
114
|
+
let shouldShowValuesCount = false;
|
|
115
|
+
if (showValuesCount) {
|
|
116
|
+
if (typeof showValuesCount === 'function') {
|
|
117
|
+
const columnFilterContext = Object.assign({ column }, this.getAdaptableApi().internalApi.buildBaseContext());
|
|
118
|
+
shouldShowValuesCount = showValuesCount(columnFilterContext);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
shouldShowValuesCount = showValuesCount;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return shouldShowValuesCount;
|
|
125
|
+
}
|
|
126
|
+
async getDistinctFilterDisplayValuesForColumnForFiltersUI(columnId, filter, showFilteredRowsOnly) {
|
|
127
|
+
const abColumn = this.getColumnApi().getColumnWithColumnId(columnId);
|
|
128
|
+
if (!abColumn) {
|
|
129
|
+
return {
|
|
130
|
+
values: [],
|
|
131
|
+
suppressClientSideFilter: false,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
const shouldShowValuesCount = this.shouldShowValuesCount(abColumn);
|
|
135
|
+
const valueOptions = await this.getDistinctFilterDisplayValuesForColumn(columnId, filter, showFilteredRowsOnly);
|
|
136
|
+
this.addPredicateValues({
|
|
137
|
+
valueOptions: valueOptions.values,
|
|
138
|
+
column: abColumn,
|
|
139
|
+
shouldShowValuesCount,
|
|
140
|
+
visibleRowsOnly: showFilteredRowsOnly,
|
|
141
|
+
});
|
|
142
|
+
return valueOptions;
|
|
143
|
+
}
|
|
144
|
+
addPredicateValues(params) {
|
|
145
|
+
var _a, _b, _c, _d;
|
|
146
|
+
const { valueOptions, column, shouldShowValuesCount, visibleRowsOnly } = params;
|
|
147
|
+
const allGridCells = this.adaptable.getGridCellsForColumn(column.columnId, true, visibleRowsOnly);
|
|
148
|
+
const adaptableApi = this.getAdaptableApi();
|
|
149
|
+
const predicateIds = adaptableApi.columnFilterApi.internalApi.getValuesFitlerPredicateIds(column);
|
|
150
|
+
if (ArrayExtensions.IsNullOrEmpty(predicateIds)) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const predicatesPosition = (_d = (_c = (_b = (_a = adaptableApi.optionsApi.getColumnFilterOptions()) === null || _a === void 0 ? void 0 : _a.valuesFilterOptions) === null || _b === void 0 ? void 0 : _b.valuesFilterPredicateOptions) === null || _c === void 0 ? void 0 : _c.predicatesPosition) !== null && _d !== void 0 ? _d : 'Start';
|
|
154
|
+
const predicateValues = predicateIds
|
|
155
|
+
.filter((predicateId) => {
|
|
156
|
+
// we have to make sure it is part of the visibleRowsOnly, when true
|
|
157
|
+
if (!visibleRowsOnly) {
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
return this.isPredicateInVisibleCellValues(predicateId, allGridCells);
|
|
161
|
+
})
|
|
162
|
+
.map((predicateId) => {
|
|
163
|
+
var _a;
|
|
164
|
+
const predicateDef = adaptableApi.predicateApi.getPredicateDefById(predicateId);
|
|
165
|
+
let label = ((_a = predicateDef.label) !== null && _a !== void 0 ? _a : predicateId);
|
|
166
|
+
return {
|
|
167
|
+
value: predicateId,
|
|
168
|
+
label: shouldShowValuesCount
|
|
169
|
+
? label +
|
|
170
|
+
NumberExtensions.WrapInParentheses(this.getPredicateOccurance({ predicateId, column, allGridCells }))
|
|
171
|
+
: label,
|
|
172
|
+
};
|
|
173
|
+
});
|
|
174
|
+
if (predicatesPosition === 'End') {
|
|
175
|
+
valueOptions.push(...predicateValues);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
valueOptions.unshift(...predicateValues);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
isPredicateInVisibleCellValues(predicateId, allGridCells) {
|
|
182
|
+
const predicate = this.getPredicateApi().getPredicateDefById(predicateId);
|
|
183
|
+
if (!predicate) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
const commonContext = createBaseContext(this.getAdaptableApi());
|
|
187
|
+
for (let gridCell of allGridCells) {
|
|
188
|
+
if (this.getPredicateApi().handlePredicate({
|
|
189
|
+
PredicateId: predicate.id,
|
|
190
|
+
}, Object.assign({ value: gridCell.rawValue, oldValue: null, displayValue: gridCell.displayValue, node: gridCell.rowNode, column: gridCell.column }, commonContext), false)) {
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
getPredicateOccurance(params) {
|
|
197
|
+
const { predicateId, allGridCells, column } = params;
|
|
198
|
+
const predicate = this.getPredicateApi().getPredicateDefById(predicateId);
|
|
199
|
+
if (!predicate) {
|
|
200
|
+
return 0;
|
|
201
|
+
}
|
|
202
|
+
let count = 0;
|
|
203
|
+
const commonContext = createBaseContext(this.getAdaptableApi());
|
|
204
|
+
for (let gridCell of allGridCells) {
|
|
205
|
+
if (this.getPredicateApi().handlePredicate({
|
|
206
|
+
PredicateId: predicate.id,
|
|
207
|
+
}, Object.assign({ value: gridCell.rawValue, oldValue: null, displayValue: gridCell.displayValue, node: gridCell.rowNode, column }, commonContext), false)) {
|
|
208
|
+
count++;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return count;
|
|
212
|
+
}
|
|
123
213
|
async getDistinctFilterListValuesForColumn(column, filter, distinctValuesParams) {
|
|
124
214
|
var _a;
|
|
125
215
|
const filterPermittedValues = (_a = this.getUserInterfaceApi().getFilterPermittedValuesForColumn(column)) !== null && _a !== void 0 ? _a : {
|
|
@@ -4,7 +4,7 @@ import { AdaptableColumnDataType } from './AdaptableColumn';
|
|
|
4
4
|
*/
|
|
5
5
|
export interface AdaptableField {
|
|
6
6
|
/**
|
|
7
|
-
* Name of field, e.g. 'rowId', 'parentObject.childObject.value'
|
|
7
|
+
* Name of field in data source, e.g. 'rowId', 'parentObject.childObject.value'
|
|
8
8
|
*/
|
|
9
9
|
name: string;
|
|
10
10
|
/**
|
|
@@ -37,11 +37,15 @@ export const SystemPredicateDefs = [
|
|
|
37
37
|
if (predicateInputs.length) {
|
|
38
38
|
const nestedContext = Object.assign({}, context);
|
|
39
39
|
delete nestedContext.inputs;
|
|
40
|
-
|
|
40
|
+
const predicateResult = predicateInputs.some((predicate) => {
|
|
41
41
|
return adaptableApi.predicateApi.handlePredicate({
|
|
42
42
|
PredicateId: predicate.id,
|
|
43
43
|
}, nestedContext, false);
|
|
44
44
|
});
|
|
45
|
+
if (predicateResult) {
|
|
46
|
+
// We want to use the only true values, to allow for multiple predicates to be used
|
|
47
|
+
return predicateResult;
|
|
48
|
+
}
|
|
45
49
|
}
|
|
46
50
|
if (inputs.length === 0) {
|
|
47
51
|
return true;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export const HOST_URL_DOCS = 'https://docs.adaptabletools.com';
|
|
2
2
|
//export const HOST_URL_DOCS = 'http://localhost:3000';
|
|
3
3
|
export const ExpressionEditorDocsLink = `${HOST_URL_DOCS}/guide/ui-expression-editor`;
|
|
4
|
-
export const BooleanQueryDocsLink = `${HOST_URL_DOCS}/guide/adaptable-ql-expression-
|
|
5
|
-
export const ScalarQueryDocsLink = `${HOST_URL_DOCS}/guide/adaptable-ql-expression-
|
|
4
|
+
export const BooleanQueryDocsLink = `${HOST_URL_DOCS}/guide/adaptable-ql-expression-standard`;
|
|
5
|
+
export const ScalarQueryDocsLink = `${HOST_URL_DOCS}/guide/adaptable-ql-expression-standard`;
|
|
6
6
|
export const ObservableQueryDocsLink = `${HOST_URL_DOCS}/guide/adaptable-ql-expression-observable`;
|
|
7
|
-
export const AggregatedBooleanQueryDocsLink = `${HOST_URL_DOCS}/guide/adaptable-ql-expression-aggregation
|
|
8
|
-
export const AggregatedScalarQueryDocsLink = `${HOST_URL_DOCS}/guide/adaptable-ql-expression-aggregation
|
|
7
|
+
export const AggregatedBooleanQueryDocsLink = `${HOST_URL_DOCS}/guide/adaptable-ql-expression-aggregation`;
|
|
8
|
+
export const AggregatedScalarQueryDocsLink = `${HOST_URL_DOCS}/guide/adaptable-ql-expression-aggregation`;
|
|
9
9
|
export const CumulativeAggregatedScalarQueryDocsLink = `${HOST_URL_DOCS}/guide/adaptable-ql-expression-cumulative`;
|
|
10
10
|
export const QuantileAggregatedScalarQueryDocsLink = `${HOST_URL_DOCS}/guide/adaptable-ql-expression-quantile`;
|
|
11
11
|
export const PredicateDocsLink = `${HOST_URL_DOCS}/guide/adaptable-predicate`;
|
|
@@ -4,11 +4,11 @@ import { Tabs } from '../../../components/Tabs';
|
|
|
4
4
|
import { TypeRadio } from '../../Wizard/TypeRadio';
|
|
5
5
|
export const CalculatedColumnTypeWizardSection = (props) => {
|
|
6
6
|
return (React.createElement(Tabs, null,
|
|
7
|
-
React.createElement(Tabs.Tab, null, "Calculated Column Type"),
|
|
7
|
+
React.createElement(Tabs.Tab, null, "Calculated Column Expression Type"),
|
|
8
8
|
React.createElement(Tabs.Content, null,
|
|
9
9
|
React.createElement(Flex, { flexDirection: "column" },
|
|
10
|
-
React.createElement(TypeRadio, { text: '
|
|
11
|
-
React.createElement(TypeRadio, { text: 'Aggregated
|
|
12
|
-
React.createElement(TypeRadio, { text: 'Cumulative
|
|
13
|
-
React.createElement(TypeRadio, { text: 'Quantile
|
|
10
|
+
React.createElement(TypeRadio, { text: 'Standard', description: "The calculated value is derived from other cells in the row", checked: props.type === 'ScalarExpression', onClick: () => props.onTypeChange('ScalarExpression') }),
|
|
11
|
+
React.createElement(TypeRadio, { text: 'Aggregated', description: "The calculated value is derived from other rows", checked: props.type === 'AggregatedScalarExpression', onClick: () => props.onTypeChange('AggregatedScalarExpression') }),
|
|
12
|
+
React.createElement(TypeRadio, { text: 'Cumulative', description: "The calculated value is derived cumulatively from other rows", checked: props.type === 'CumulativeAggregatedExpression', onClick: () => props.onTypeChange('CumulativeAggregatedExpression') }),
|
|
13
|
+
React.createElement(TypeRadio, { text: 'Quantile', description: "The calculated value is derived from other rows using quantile aggregations", checked: props.type === 'QuantileAggregatedExpression', onClick: () => props.onTypeChange('QuantileAggregatedExpression') })))));
|
|
14
14
|
};
|
|
@@ -107,8 +107,8 @@ class FilterFormComponent extends React.Component {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
async loadPermittedValues(filter = '') {
|
|
110
|
-
const { values: distinctColumnValues, suppressClientSideFilter } = await runIfNotResolvedIn(this.props.api.gridApi.internalApi.
|
|
111
|
-
.
|
|
110
|
+
const { values: distinctColumnValues, suppressClientSideFilter } = await runIfNotResolvedIn(this.props.api.gridApi.internalApi.getDistinctFilterDisplayValuesForColumnForFiltersUI(this.props.currentColumn.columnId, filter, this.props.api.optionsApi.getColumnFilterOptions().valuesFilterOptions
|
|
111
|
+
.showCurrentlyFilteredValuesOnly), () => this._isMounted && this.setState({ isDistinctColumnValuesLoading: true }));
|
|
112
112
|
if (this._isMounted) {
|
|
113
113
|
this.setState({
|
|
114
114
|
distinctColumnValues,
|
|
@@ -41,7 +41,8 @@ export const ListBoxFilterForm = (props) => {
|
|
|
41
41
|
setUiSelectedColumnValues([...UiSelectedColumnValues, item]);
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
const
|
|
44
|
+
const permittedValuesOptions = props.columnDistinctValues;
|
|
45
|
+
const columnValuesItemsElements = permittedValuesOptions.map((distinctValue, index) => {
|
|
45
46
|
let isActive = UiSelectedColumnValues.indexOf(distinctValue.value) >= 0;
|
|
46
47
|
// special case for date objects, need to check against string values
|
|
47
48
|
if (!isActive && distinctValue.value && distinctValue.value instanceof Date) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ColumnFilter } from '../../../PredefinedConfig/Common/ColumnFilter';
|
|
3
2
|
import { AdaptableApi } from '../../../Api/AdaptableApi';
|
|
4
3
|
import { AdaptableColumn } from '../../../PredefinedConfig/Common/AdaptableColumn';
|
|
4
|
+
import { ColumnFilter } from '../../../PredefinedConfig/Common/ColumnFilter';
|
|
5
5
|
import { ValuesFilterOptions } from '../../../types';
|
|
6
6
|
export interface QuickFilterValuesProps {
|
|
7
7
|
api: AdaptableApi;
|