@adaptabletools/adaptable-cjs 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.
Files changed (35) hide show
  1. package/base.css +5 -0
  2. package/base.css.map +1 -1
  3. package/index.css +7 -0
  4. package/index.css.map +1 -1
  5. package/package.json +1 -1
  6. package/src/AdaptableInterfaces/IAdaptable.d.ts +4 -4
  7. package/src/AdaptableOptions/ColumnFilterOptions.d.ts +39 -24
  8. package/src/Api/ColumnApi.d.ts +5 -0
  9. package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
  10. package/src/Api/Implementation/ColumnApiImpl.js +3 -0
  11. package/src/Api/Implementation/ConfigApiImpl.js +3 -1
  12. package/src/Api/Internal/ColumnFilterInternalApi.js +6 -6
  13. package/src/Api/Internal/GridInternalApi.d.ts +29 -13
  14. package/src/Api/Internal/GridInternalApi.js +129 -39
  15. package/src/PredefinedConfig/Common/AdaptableField.d.ts +1 -1
  16. package/src/PredefinedConfig/Common/AdaptablePredicate.js +5 -1
  17. package/src/Utilities/Constants/DocumentationLinkConstants.js +4 -4
  18. package/src/View/CalculatedColumn/Wizard/CalculatedColumnTypeSection.js +5 -5
  19. package/src/View/Components/FilterForm/FilterForm.js +2 -2
  20. package/src/View/Components/FilterForm/ListBoxFilterForm.js +2 -1
  21. package/src/View/Components/FilterForm/QuickFilterValues.d.ts +1 -1
  22. package/src/View/Components/FilterForm/QuickFilterValues.js +20 -43
  23. package/src/View/Components/Selectors/PermittedValuesSelector.js +1 -1
  24. package/src/agGrid/AdaptableAgGrid.d.ts +4 -4
  25. package/src/agGrid/AdaptableAgGrid.js +20 -15
  26. package/src/agGrid/FilterWrapper.js +12 -7
  27. package/src/agGrid/defaultAdaptableOptions.js +2 -2
  28. package/src/components/ExpressionEditor/EditorInput.js +1 -1
  29. package/src/components/ExpressionEditor/index.js +1 -3
  30. package/src/env.js +2 -2
  31. package/src/metamodel/adaptable.metamodel.d.ts +45 -2
  32. package/src/metamodel/adaptable.metamodel.js +1 -1
  33. package/src/parser/src/predicate/mapExpressionToQlPredicate.js +1 -0
  34. package/src/types.d.ts +1 -1
  35. package/tsconfig.cjs.tsbuildinfo +1 -1
@@ -44,11 +44,10 @@ export interface AgGridConfig {
44
44
  */
45
45
  modules: Module[];
46
46
  }
47
- export interface DistinctValuesParams {
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: DistinctValuesParams): GridCell[];
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
- * Override column filter, return false to prevent filtering on a row
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: ColumnFilterIsRowFiltrableContext) => boolean;
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 distinct values in Filter controls
214
+ * Display only currently filtered values in Filter controls
215
215
  *
216
216
  * @defaultValue false
217
217
  * @gridInfoItem
218
218
  * @noCodeItem
219
219
  */
220
- showDistinctFilteredValuesOnly?: boolean;
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
- * Adds predicates to values filter.
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
- predicatesPosition?: 'Start' | 'End';
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
- export interface ColumnFilterIsRowFiltrableContext<TData = any> extends BaseContext {
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>;
@@ -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
  }
@@ -399,5 +399,8 @@ class ColumnApiImpl extends ApiBase_1.ApiBase {
399
399
  const agGridApi = this.adaptable.agGridAdapter.getAgGridApi();
400
400
  agGridApi.setGridOption('columnDefs', columnDefinitions);
401
401
  }
402
+ getDistinctDisplayValuesForColumn(columnId) {
403
+ return this.getAdaptableApi().gridApi.internalApi.getDistinctDisplayValuesForColumn(columnId);
404
+ }
402
405
  }
403
406
  exports.ColumnApiImpl = ColumnApiImpl;
@@ -141,7 +141,9 @@ class ConfigApiImpl extends ApiBase_1.ApiBase {
141
141
  });
142
142
  promise
143
143
  .then(() => {
144
- this.adaptable.updateColumnModelAndRefreshGrid({ skipColDefsRefresh: true });
144
+ this.adaptable.updateColumnModelAndRefreshGrid({
145
+ preemptiveColumnStateRefresh: true,
146
+ });
145
147
  this.adaptable.setLayout();
146
148
  })
147
149
  .then(() => {
@@ -211,16 +211,16 @@ class ColumnFilterInternalApi extends ApiBase_1.ApiBase {
211
211
  }
212
212
  }
213
213
  getValuesFitlerPredicateIds(column) {
214
- var _a;
215
- const valuesFilterOptions = (_a = this.getOptions().columnFilterOptions) === null || _a === void 0 ? void 0 : _a.valuesFilterOptions;
214
+ var _a, _b;
215
+ const valuesFilterPredicateOptions = (_b = (_a = this.getOptions().columnFilterOptions) === null || _a === void 0 ? void 0 : _a.valuesFilterOptions) === null || _b === void 0 ? void 0 : _b.valuesFilterPredicateOptions;
216
216
  const availablePredicates = this.getPredicateApi().getPredicateDefsByModuleScope('columnFilter');
217
217
  let predicateIds = [];
218
- if (typeof (valuesFilterOptions === null || valuesFilterOptions === void 0 ? void 0 : valuesFilterOptions.predicates) === 'function') {
218
+ if (typeof (valuesFilterPredicateOptions === null || valuesFilterPredicateOptions === void 0 ? void 0 : valuesFilterPredicateOptions.predicates) === 'function') {
219
219
  const columnFilterContext = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { column: column });
220
- predicateIds = valuesFilterOptions.predicates(columnFilterContext);
220
+ predicateIds = valuesFilterPredicateOptions.predicates(columnFilterContext);
221
221
  }
222
- else if (Array.isArray(valuesFilterOptions === null || valuesFilterOptions === void 0 ? void 0 : valuesFilterOptions.predicates)) {
223
- predicateIds = valuesFilterOptions.predicates;
222
+ else if (Array.isArray(valuesFilterPredicateOptions === null || valuesFilterPredicateOptions === void 0 ? void 0 : valuesFilterPredicateOptions.predicates)) {
223
+ predicateIds = valuesFilterPredicateOptions.predicates;
224
224
  }
225
225
  return predicateIds.filter((predicateId) => {
226
226
  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 { GridDataChangeTrigger } from '../Events/GridDataChanged';
5
- import { GridCell } from '../../PredefinedConfig/Selection/GridCell';
2
+ import { DistinctColumnValuesParams } from '../../AdaptableInterfaces/IAdaptable';
3
+ import { EditLookUpPermittedValues } from '../../AdaptableOptions/UserInterfaceOptions';
6
4
  import { AdaptableColumn, AdaptableColumnDataType } from '../../PredefinedConfig/Common/AdaptableColumn';
7
- import { SelectedCellInfo } from '../../PredefinedConfig/Selection/SelectedCellInfo';
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 with the given ColumnId
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
- getDistinctFilterListValuesForColumn(column: AdaptableColumn, filter: string, distinctValuesParams: DistinctValuesParams): Promise<{
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: DistinctValuesParams): Promise<GridCell<any>[]>;
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: DistinctValuesParams): Promise<GridCell<any>[]>;
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
@@ -2,15 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GridInternalApi = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const ApiBase_1 = require("../Implementation/ApiBase");
6
5
  const Enums_1 = require("../../PredefinedConfig/Common/Enums");
7
- const ArrayExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/ArrayExtensions"));
8
6
  const GridRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/GridRedux"));
7
+ const ArrayExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/ArrayExtensions"));
9
8
  const NumberExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/NumberExtensions"));
10
9
  const StyleHelper_1 = require("../../Utilities/Helpers/StyleHelper");
11
- const UIHelper_1 = tslib_1.__importDefault(require("../../View/UIHelper"));
12
10
  const ObjectFactory_1 = require("../../Utilities/ObjectFactory");
13
- const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
11
+ const UIHelper_1 = tslib_1.__importDefault(require("../../View/UIHelper"));
12
+ const ApiBase_1 = require("../Implementation/ApiBase");
14
13
  class GridInternalApi extends ApiBase_1.ApiBase {
15
14
  /**
16
15
  * Fires Grid Sorted Event
@@ -45,7 +44,7 @@ class GridInternalApi extends ApiBase_1.ApiBase {
45
44
  }
46
45
  }
47
46
  /**
48
- * Gets all distinct display values in the Column with the given ColumnId
47
+ * Gets all distinct display values in the Column for given ColumnId
49
48
  * @param columnId Column to check
50
49
  */
51
50
  getDistinctDisplayValuesForColumn(columnId) {
@@ -65,11 +64,15 @@ class GridInternalApi extends ApiBase_1.ApiBase {
65
64
  * Gets all distinct Filter values for the Column with the given ColumnId
66
65
  * used for Floating Filter and Column Header filter
67
66
  * either returns a list of values or al ist a list of values with count
67
+ *
68
+ * This is a general method, and it is used in:
69
+ * - Column Filters
70
+ * - Query Builder
71
+ *
68
72
  * @param columnId Column to check
69
73
  * @param columnFilter Current applied filter
70
74
  */
71
75
  async getDistinctFilterDisplayValuesForColumn(columnId, filter, showFilteredRowsOnly) {
72
- var _a, _b;
73
76
  const abColumn = this.getColumnApi().getColumnWithColumnId(columnId);
74
77
  if (abColumn == undefined) {
75
78
  return {
@@ -77,53 +80,140 @@ class GridInternalApi extends ApiBase_1.ApiBase {
77
80
  suppressClientSideFilter: false,
78
81
  };
79
82
  }
80
- const addBlankValue = this.getColumnFilterOptions().valuesFilterOptions.includeBlankFilterValues;
81
83
  const distinctValuesParams = {
82
84
  visibleRowsOnly: showFilteredRowsOnly,
83
- addBlankValue: addBlankValue,
84
85
  };
85
86
  const { gridCells, suppressClientSideFilter } = await this.getDistinctFilterListValuesForColumn(abColumn, filter, distinctValuesParams);
86
87
  const sortedDistinctValues = this.sortDistinctValues(gridCells, abColumn);
87
- let shouldShowValuesCount = false;
88
- const showValuesCountFunction = this.getColumnFilterOptions().valuesFilterOptions.showValuesCount;
89
- if (showValuesCountFunction) {
90
- const columnFilterContext = Object.assign({ column: abColumn }, this.getAdaptableApi().internalApi.buildBaseContext());
91
- shouldShowValuesCount = showValuesCountFunction(columnFilterContext);
92
- }
88
+ const shouldShowValuesCount = this.shouldShowValuesCount(abColumn);
89
+ let valueOptions = [];
93
90
  if (shouldShowValuesCount) {
94
- const allColumnDisplayValues = addBlankValue
95
- ? (_a = this.adaptable.getGridCellsForColumn(columnId, true)) === null || _a === void 0 ? void 0 : _a.map((gc) => {
96
- var _a;
97
- return (_a = gc.displayValue) !== null && _a !== void 0 ? _a : GeneralConstants_1.BLANK_DISTINCT_COLUMN_VALUE;
98
- })
99
- : (_b = this.adaptable.getGridCellsForColumn(columnId)) === null || _b === void 0 ? void 0 : _b.map((gc) => {
100
- return gc.displayValue;
101
- });
102
- const newsortedDistinctValues = addBlankValue
103
- ? sortedDistinctValues
104
- : sortedDistinctValues.filter((gc) => gc.displayValue !== undefined);
105
- return {
106
- values: newsortedDistinctValues.map((cv) => {
107
- const label = cv.displayValue +
108
- NumberExtensions_1.default.WrapInParentheses(ArrayExtensions_1.default.getOccurrence(allColumnDisplayValues, cv.displayValue));
109
- return {
110
- label: label,
111
- value: cv.normalisedValue,
112
- };
113
- }),
114
- suppressClientSideFilter,
115
- };
91
+ const allGridCells = this.adaptable.getGridCellsForColumn(columnId);
92
+ const allGridValues = allGridCells.map((gc) => gc.displayValue);
93
+ const newsortedDistinctValues = sortedDistinctValues.filter((gc) => gc.displayValue != undefined && gc.displayValue != '' && gc.displayValue != null);
94
+ valueOptions = newsortedDistinctValues.map((cv) => {
95
+ const label = cv.displayValue +
96
+ NumberExtensions_1.default.WrapInParentheses(ArrayExtensions_1.default.getOccurrence(allGridValues, cv.displayValue));
97
+ return {
98
+ label: label,
99
+ value: cv.normalisedValue,
100
+ };
101
+ });
116
102
  }
117
- return {
118
- values: sortedDistinctValues.map((cv) => {
103
+ else {
104
+ valueOptions = sortedDistinctValues.map((cv) => {
119
105
  return {
120
106
  label: cv.displayValue,
121
107
  value: cv.normalisedValue,
122
108
  };
123
- }),
109
+ });
110
+ }
111
+ return {
112
+ values: valueOptions,
124
113
  suppressClientSideFilter,
125
114
  };
126
115
  }
116
+ shouldShowValuesCount(column) {
117
+ const showValuesCount = this.getColumnFilterOptions().valuesFilterOptions.showValuesCount;
118
+ let shouldShowValuesCount = false;
119
+ if (showValuesCount) {
120
+ if (typeof showValuesCount === 'function') {
121
+ const columnFilterContext = Object.assign({ column }, this.getAdaptableApi().internalApi.buildBaseContext());
122
+ shouldShowValuesCount = showValuesCount(columnFilterContext);
123
+ }
124
+ else {
125
+ shouldShowValuesCount = showValuesCount;
126
+ }
127
+ }
128
+ return shouldShowValuesCount;
129
+ }
130
+ async getDistinctFilterDisplayValuesForColumnForFiltersUI(columnId, filter, showFilteredRowsOnly) {
131
+ const abColumn = this.getColumnApi().getColumnWithColumnId(columnId);
132
+ if (!abColumn) {
133
+ return {
134
+ values: [],
135
+ suppressClientSideFilter: false,
136
+ };
137
+ }
138
+ const shouldShowValuesCount = this.shouldShowValuesCount(abColumn);
139
+ const valueOptions = await this.getDistinctFilterDisplayValuesForColumn(columnId, filter, showFilteredRowsOnly);
140
+ this.addPredicateValues({
141
+ valueOptions: valueOptions.values,
142
+ column: abColumn,
143
+ shouldShowValuesCount,
144
+ visibleRowsOnly: showFilteredRowsOnly,
145
+ });
146
+ return valueOptions;
147
+ }
148
+ addPredicateValues(params) {
149
+ var _a, _b, _c, _d;
150
+ const { valueOptions, column, shouldShowValuesCount, visibleRowsOnly } = params;
151
+ const allGridCells = this.adaptable.getGridCellsForColumn(column.columnId, true, visibleRowsOnly);
152
+ const adaptableApi = this.getAdaptableApi();
153
+ const predicateIds = adaptableApi.columnFilterApi.internalApi.getValuesFitlerPredicateIds(column);
154
+ if (ArrayExtensions_1.default.IsNullOrEmpty(predicateIds)) {
155
+ return;
156
+ }
157
+ 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';
158
+ const predicateValues = predicateIds
159
+ .filter((predicateId) => {
160
+ // we have to make sure it is part of the visibleRowsOnly, when true
161
+ if (!visibleRowsOnly) {
162
+ return true;
163
+ }
164
+ return this.isPredicateInVisibleCellValues(predicateId, allGridCells);
165
+ })
166
+ .map((predicateId) => {
167
+ var _a;
168
+ const predicateDef = adaptableApi.predicateApi.getPredicateDefById(predicateId);
169
+ let label = ((_a = predicateDef.label) !== null && _a !== void 0 ? _a : predicateId);
170
+ return {
171
+ value: predicateId,
172
+ label: shouldShowValuesCount
173
+ ? label +
174
+ NumberExtensions_1.default.WrapInParentheses(this.getPredicateOccurance({ predicateId, column, allGridCells }))
175
+ : label,
176
+ };
177
+ });
178
+ if (predicatesPosition === 'End') {
179
+ valueOptions.push(...predicateValues);
180
+ }
181
+ else {
182
+ valueOptions.unshift(...predicateValues);
183
+ }
184
+ }
185
+ isPredicateInVisibleCellValues(predicateId, allGridCells) {
186
+ const predicate = this.getPredicateApi().getPredicateDefById(predicateId);
187
+ if (!predicate) {
188
+ return false;
189
+ }
190
+ const commonContext = (0, ObjectFactory_1.createBaseContext)(this.getAdaptableApi());
191
+ for (let gridCell of allGridCells) {
192
+ if (this.getPredicateApi().handlePredicate({
193
+ PredicateId: predicate.id,
194
+ }, Object.assign({ value: gridCell.rawValue, oldValue: null, displayValue: gridCell.displayValue, node: gridCell.rowNode, column: gridCell.column }, commonContext), false)) {
195
+ return true;
196
+ }
197
+ }
198
+ return false;
199
+ }
200
+ getPredicateOccurance(params) {
201
+ const { predicateId, allGridCells, column } = params;
202
+ const predicate = this.getPredicateApi().getPredicateDefById(predicateId);
203
+ if (!predicate) {
204
+ return 0;
205
+ }
206
+ let count = 0;
207
+ const commonContext = (0, ObjectFactory_1.createBaseContext)(this.getAdaptableApi());
208
+ for (let gridCell of allGridCells) {
209
+ if (this.getPredicateApi().handlePredicate({
210
+ PredicateId: predicate.id,
211
+ }, Object.assign({ value: gridCell.rawValue, oldValue: null, displayValue: gridCell.displayValue, node: gridCell.rowNode, column }, commonContext), false)) {
212
+ count++;
213
+ }
214
+ }
215
+ return count;
216
+ }
127
217
  async getDistinctFilterListValuesForColumn(column, filter, distinctValuesParams) {
128
218
  var _a;
129
219
  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
  /**
@@ -41,11 +41,15 @@ exports.SystemPredicateDefs = [
41
41
  if (predicateInputs.length) {
42
42
  const nestedContext = Object.assign({}, context);
43
43
  delete nestedContext.inputs;
44
- return predicateInputs.some((predicate) => {
44
+ const predicateResult = predicateInputs.some((predicate) => {
45
45
  return adaptableApi.predicateApi.handlePredicate({
46
46
  PredicateId: predicate.id,
47
47
  }, nestedContext, false);
48
48
  });
49
+ if (predicateResult) {
50
+ // We want to use the only true values, to allow for multiple predicates to be used
51
+ return predicateResult;
52
+ }
49
53
  }
50
54
  if (inputs.length === 0) {
51
55
  return true;
@@ -4,11 +4,11 @@ exports.AgGridModulesDocsLink = exports.AdaptableOptionsDocsLink = exports.Licen
4
4
  exports.HOST_URL_DOCS = 'https://docs.adaptabletools.com';
5
5
  //export const HOST_URL_DOCS = 'http://localhost:3000';
6
6
  exports.ExpressionEditorDocsLink = `${exports.HOST_URL_DOCS}/guide/ui-expression-editor`;
7
- exports.BooleanQueryDocsLink = `${exports.HOST_URL_DOCS}/guide/adaptable-ql-expression-boolean`;
8
- exports.ScalarQueryDocsLink = `${exports.HOST_URL_DOCS}/guide/adaptable-ql-expression-scalar`;
7
+ exports.BooleanQueryDocsLink = `${exports.HOST_URL_DOCS}/guide/adaptable-ql-expression-standard`;
8
+ exports.ScalarQueryDocsLink = `${exports.HOST_URL_DOCS}/guide/adaptable-ql-expression-standard`;
9
9
  exports.ObservableQueryDocsLink = `${exports.HOST_URL_DOCS}/guide/adaptable-ql-expression-observable`;
10
- exports.AggregatedBooleanQueryDocsLink = `${exports.HOST_URL_DOCS}/guide/adaptable-ql-expression-aggregation-boolean`;
11
- exports.AggregatedScalarQueryDocsLink = `${exports.HOST_URL_DOCS}/guide/adaptable-ql-expression-aggregation-scalar`;
10
+ exports.AggregatedBooleanQueryDocsLink = `${exports.HOST_URL_DOCS}/guide/adaptable-ql-expression-aggregation`;
11
+ exports.AggregatedScalarQueryDocsLink = `${exports.HOST_URL_DOCS}/guide/adaptable-ql-expression-aggregation`;
12
12
  exports.CumulativeAggregatedScalarQueryDocsLink = `${exports.HOST_URL_DOCS}/guide/adaptable-ql-expression-cumulative`;
13
13
  exports.QuantileAggregatedScalarQueryDocsLink = `${exports.HOST_URL_DOCS}/guide/adaptable-ql-expression-quantile`;
14
14
  exports.PredicateDocsLink = `${exports.HOST_URL_DOCS}/guide/adaptable-predicate`;
@@ -8,12 +8,12 @@ const Tabs_1 = require("../../../components/Tabs");
8
8
  const TypeRadio_1 = require("../../Wizard/TypeRadio");
9
9
  const CalculatedColumnTypeWizardSection = (props) => {
10
10
  return (React.createElement(Tabs_1.Tabs, null,
11
- React.createElement(Tabs_1.Tabs.Tab, null, "Calculated Column Type"),
11
+ React.createElement(Tabs_1.Tabs.Tab, null, "Calculated Column Expression Type"),
12
12
  React.createElement(Tabs_1.Tabs.Content, null,
13
13
  React.createElement(rebass_1.Flex, { flexDirection: "column" },
14
- React.createElement(TypeRadio_1.TypeRadio, { text: 'Scalar Expression', description: "The calculated value is derived from other cells in the row", checked: props.type === 'ScalarExpression', onClick: () => props.onTypeChange('ScalarExpression') }),
15
- React.createElement(TypeRadio_1.TypeRadio, { text: 'Aggregated Scalar Expression', description: "The calculated value is derived from other rows", checked: props.type === 'AggregatedScalarExpression', onClick: () => props.onTypeChange('AggregatedScalarExpression') }),
16
- React.createElement(TypeRadio_1.TypeRadio, { text: 'Cumulative Aggregated Expression', description: "The calculated value is derived cumulatively from other rows", checked: props.type === 'CumulativeAggregatedExpression', onClick: () => props.onTypeChange('CumulativeAggregatedExpression') }),
17
- React.createElement(TypeRadio_1.TypeRadio, { text: 'Quantile Aggregated Expression', description: "The calculated value is derived from other rows using quantile aggregations", checked: props.type === 'QuantileAggregatedExpression', onClick: () => props.onTypeChange('QuantileAggregatedExpression') })))));
14
+ React.createElement(TypeRadio_1.TypeRadio, { text: 'Standard', description: "The calculated value is derived from other cells in the row", checked: props.type === 'ScalarExpression', onClick: () => props.onTypeChange('ScalarExpression') }),
15
+ React.createElement(TypeRadio_1.TypeRadio, { text: 'Aggregated', description: "The calculated value is derived from other rows", checked: props.type === 'AggregatedScalarExpression', onClick: () => props.onTypeChange('AggregatedScalarExpression') }),
16
+ React.createElement(TypeRadio_1.TypeRadio, { text: 'Cumulative', description: "The calculated value is derived cumulatively from other rows", checked: props.type === 'CumulativeAggregatedExpression', onClick: () => props.onTypeChange('CumulativeAggregatedExpression') }),
17
+ React.createElement(TypeRadio_1.TypeRadio, { text: 'Quantile', description: "The calculated value is derived from other rows using quantile aggregations", checked: props.type === 'QuantileAggregatedExpression', onClick: () => props.onTypeChange('QuantileAggregatedExpression') })))));
18
18
  };
19
19
  exports.CalculatedColumnTypeWizardSection = CalculatedColumnTypeWizardSection;
@@ -111,8 +111,8 @@ class FilterFormComponent extends React.Component {
111
111
  }
112
112
  }
113
113
  async loadPermittedValues(filter = '') {
114
- const { values: distinctColumnValues, suppressClientSideFilter } = await (0, runIfNotResolvedIn_1.runIfNotResolvedIn)(this.props.api.gridApi.internalApi.getDistinctFilterDisplayValuesForColumn(this.props.currentColumn.columnId, filter, this.props.api.optionsApi.getColumnFilterOptions().valuesFilterOptions
115
- .showDistinctFilteredValuesOnly), () => this._isMounted && this.setState({ isDistinctColumnValuesLoading: true }));
114
+ const { values: distinctColumnValues, suppressClientSideFilter } = await (0, runIfNotResolvedIn_1.runIfNotResolvedIn)(this.props.api.gridApi.internalApi.getDistinctFilterDisplayValuesForColumnForFiltersUI(this.props.currentColumn.columnId, filter, this.props.api.optionsApi.getColumnFilterOptions().valuesFilterOptions
115
+ .showCurrentlyFilteredValuesOnly), () => this._isMounted && this.setState({ isDistinctColumnValuesLoading: true }));
116
116
  if (this._isMounted) {
117
117
  this.setState({
118
118
  distinctColumnValues,
@@ -45,7 +45,8 @@ const ListBoxFilterForm = (props) => {
45
45
  setUiSelectedColumnValues([...UiSelectedColumnValues, item]);
46
46
  }
47
47
  };
48
- const columnValuesItemsElements = props.columnDistinctValues.map((distinctValue, index) => {
48
+ const permittedValuesOptions = props.columnDistinctValues;
49
+ const columnValuesItemsElements = permittedValuesOptions.map((distinctValue, index) => {
49
50
  let isActive = UiSelectedColumnValues.indexOf(distinctValue.value) >= 0;
50
51
  // special case for date objects, need to check against string values
51
52
  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;