@adaptabletools/adaptable 18.0.17 → 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 (136) hide show
  1. package/agGrid.d.ts +4 -3
  2. package/agGrid.js +4 -3
  3. package/base.css +7 -2
  4. package/base.css.map +1 -1
  5. package/index.css +11 -2
  6. package/index.css.map +1 -1
  7. package/package.json +2 -2
  8. package/src/AdaptableInterfaces/IAdaptable.d.ts +3 -4
  9. package/src/AdaptableOptions/ActionColumnOptions.d.ts +1 -1
  10. package/src/AdaptableOptions/ColumnFilterOptions.d.ts +52 -11
  11. package/src/AdaptableOptions/ExportOptions.d.ts +20 -7
  12. package/src/AdaptableOptions/ExpressionOptions.d.ts +12 -2
  13. package/src/AdaptableOptions/Fdc3Options.d.ts +48 -43
  14. package/src/Api/ColumnApi.d.ts +5 -0
  15. package/src/Api/Events/Fdc3MessageInfo.d.ts +5 -7
  16. package/src/Api/ExpressionApi.d.ts +2 -2
  17. package/src/Api/Fdc3Api.d.ts +14 -19
  18. package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
  19. package/src/Api/Implementation/ColumnApiImpl.js +3 -0
  20. package/src/Api/Implementation/ConfigApiImpl.js +3 -0
  21. package/src/Api/Implementation/Fdc3ApiImpl.d.ts +14 -16
  22. package/src/Api/Implementation/Fdc3ApiImpl.js +36 -12
  23. package/src/Api/Internal/AlertInternalApi.d.ts +17 -2
  24. package/src/Api/Internal/AlertInternalApi.js +196 -25
  25. package/src/Api/Internal/ColumnFilterInternalApi.d.ts +2 -0
  26. package/src/Api/Internal/ColumnFilterInternalApi.js +20 -0
  27. package/src/Api/Internal/ExportInternalApi.d.ts +3 -3
  28. package/src/Api/Internal/ExportInternalApi.js +31 -17
  29. package/src/Api/Internal/ExpressionInternalApi.d.ts +5 -1
  30. package/src/Api/Internal/ExpressionInternalApi.js +79 -0
  31. package/src/Api/Internal/Fdc3InternalApi.d.ts +8 -10
  32. package/src/Api/Internal/Fdc3InternalApi.js +6 -10
  33. package/src/Api/Internal/GridInternalApi.d.ts +29 -13
  34. package/src/Api/Internal/GridInternalApi.js +129 -39
  35. package/src/PredefinedConfig/Common/AdaptableField.d.ts +18 -0
  36. package/src/PredefinedConfig/Common/AdaptableField.js +1 -0
  37. package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
  38. package/src/PredefinedConfig/Common/AdaptablePredicate.js +22 -1
  39. package/src/PredefinedConfig/Common/Fdc3Context.d.ts +7 -226
  40. package/src/PredefinedConfig/Common/Fdc3Context.js +43 -31
  41. package/src/PredefinedConfig/Common/Fdc3Intent.d.ts +6 -89
  42. package/src/PredefinedConfig/Common/Fdc3Intent.js +26 -73
  43. package/src/PredefinedConfig/Common/RowSummary.d.ts +2 -1
  44. package/src/PredefinedConfig/StyledColumnState.d.ts +1 -1
  45. package/src/Redux/ActionsReducers/FormatColumnRedux.js +0 -3
  46. package/src/Strategy/AdaptableModuleBase.js +1 -3
  47. package/src/Strategy/AlertModule.d.ts +1 -1
  48. package/src/Strategy/AlertModule.js +8 -8
  49. package/src/Utilities/Constants/DocumentationLinkConstants.js +4 -4
  50. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +3 -1
  51. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +1 -1
  52. package/src/Utilities/Services/Fdc3Service.d.ts +1 -1
  53. package/src/Utilities/Services/Fdc3Service.js +2 -2
  54. package/src/Utilities/Services/QueryLanguageService.d.ts +8 -4
  55. package/src/Utilities/Services/QueryLanguageService.js +105 -6
  56. package/src/Utilities/Services/ReportService.js +8 -5
  57. package/src/Utilities/Services/RowSummaryService.js +3 -1
  58. package/src/Utilities/divideBy100.d.ts +1 -0
  59. package/src/Utilities/divideBy100.js +30 -0
  60. package/src/Utilities/times100.d.ts +1 -0
  61. package/src/Utilities/times100.js +23 -0
  62. package/src/View/Alert/Wizard/AlertMessageWizardSection.js +1 -1
  63. package/src/View/Alert/Wizard/AlertNotificationWizardSection.js +2 -2
  64. package/src/View/Alert/Wizard/AlertScopeWizardSection.js +2 -1
  65. package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +1 -1
  66. package/src/View/CalculatedColumn/Wizard/CalculatedColumnTypeSection.js +5 -5
  67. package/src/View/Components/EntityRulesEditor/index.d.ts +1 -0
  68. package/src/View/Components/EntityRulesEditor/index.js +11 -7
  69. package/src/View/Components/ExpressionWizard.js +1 -1
  70. package/src/View/Components/FilterForm/FilterForm.js +2 -2
  71. package/src/View/Components/FilterForm/ListBoxFilterForm.js +2 -1
  72. package/src/View/Components/FilterForm/QuickFilterValues.d.ts +1 -1
  73. package/src/View/Components/FilterForm/QuickFilterValues.js +5 -5
  74. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +6 -2
  75. package/src/View/Components/Selectors/FieldSelector.d.ts +13 -0
  76. package/src/View/Components/Selectors/FieldSelector.js +21 -0
  77. package/src/View/Components/Selectors/PermittedValuesSelector.js +9 -5
  78. package/src/View/Export/Wizard/ReportRowsWizardSection.js +1 -1
  79. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +1 -1
  80. package/src/View/GridFilter/GridFilterExpressionEditor.js +1 -1
  81. package/src/View/Layout/Wizard/sections/GridFilterSection.js +4 -2
  82. package/src/View/Layout/Wizard/sections/RowSummarySection.js +7 -1
  83. package/src/View/NamedQuery/Wizard/NamedQueryExpressionWizardSection.js +1 -1
  84. package/src/View/Wizard/OnePageAdaptableWizard.js +3 -2
  85. package/src/agGrid/AdaptableAgGrid.d.ts +4 -6
  86. package/src/agGrid/AdaptableAgGrid.js +68 -49
  87. package/src/agGrid/AgGridColumnAdapter.d.ts +3 -0
  88. package/src/agGrid/AgGridColumnAdapter.js +22 -0
  89. package/src/agGrid/AgGridMenuAdapter.js +1 -1
  90. package/src/agGrid/FilterWrapper.js +12 -7
  91. package/src/agGrid/defaultAdaptableOptions.js +2 -2
  92. package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.d.ts +0 -1
  93. package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.js +0 -2
  94. package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +4 -16
  95. package/src/agGrid/editors/AdaptableDateEditor/index.js +5 -18
  96. package/src/agGrid/editors/AdaptableNumberEditor/InternalAdaptableNumberEditor.js +6 -1
  97. package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +4 -3
  98. package/src/agGrid/editors/AdaptableNumberEditor/index.js +5 -2
  99. package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.d.ts +23 -0
  100. package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.js +80 -0
  101. package/src/agGrid/editors/AdaptablePercentageEditor/index.d.ts +47 -0
  102. package/src/agGrid/editors/AdaptablePercentageEditor/index.js +148 -0
  103. package/src/components/Accordion.js +1 -1
  104. package/src/components/Datepicker/DatepickerContext.d.ts +0 -2
  105. package/src/components/Datepicker/index.js +3 -4
  106. package/src/components/ExpressionEditor/DataTableEditor.d.ts +17 -0
  107. package/src/components/ExpressionEditor/DataTableEditor.js +63 -0
  108. package/src/components/ExpressionEditor/EditorInput.js +22 -9
  109. package/src/components/ExpressionEditor/NamedQueryEditor.d.ts +5 -0
  110. package/src/components/ExpressionEditor/NamedQueryEditor.js +30 -0
  111. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.d.ts +10 -0
  112. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.js +7 -4
  113. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.d.ts +3 -2
  114. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.js +71 -13
  115. package/src/components/ExpressionEditor/QueryBuilder/QueryPredicateBuilder.js +30 -22
  116. package/src/components/ExpressionEditor/QueryBuilder/utils.d.ts +9 -1
  117. package/src/components/ExpressionEditor/QueryBuilder/utils.js +41 -3
  118. package/src/components/ExpressionEditor/index.d.ts +3 -1
  119. package/src/components/ExpressionEditor/index.js +67 -94
  120. package/src/components/Input/NumberInput.d.ts +2 -1
  121. package/src/components/Input/NumberInput.js +7 -4
  122. package/src/components/OverlayTrigger/index.js +10 -6
  123. package/src/components/icons/column-outline.d.ts +3 -0
  124. package/src/components/icons/column-outline.js +4 -0
  125. package/src/components/icons/index.js +5 -1
  126. package/src/components/icons/sync.d.ts +3 -0
  127. package/src/components/icons/sync.js +4 -0
  128. package/src/env.js +2 -2
  129. package/src/metamodel/adaptable.metamodel.d.ts +121 -200
  130. package/src/metamodel/adaptable.metamodel.js +1 -1
  131. package/src/parser/src/predicate/mapExpressionToQlPredicate.d.ts +1 -0
  132. package/src/parser/src/predicate/mapExpressionToQlPredicate.js +12 -2
  133. package/src/parser/src/predicate/mapQlPredicateToExpression.js +4 -1
  134. package/src/parser/src/types.d.ts +101 -1
  135. package/src/types.d.ts +8 -6
  136. package/tsconfig.esm.tsbuildinfo +1 -1
@@ -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
@@ -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 { BLANK_DISTINCT_COLUMN_VALUE } from '../../Utilities/Constants/GeneralConstants';
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 with the given ColumnId
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
- let shouldShowValuesCount = false;
84
- const showValuesCountFunction = this.getColumnFilterOptions().valuesFilterOptions.showValuesCount;
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 allColumnDisplayValues = addBlankValue
91
- ? (_a = this.adaptable.getGridCellsForColumn(columnId, true)) === null || _a === void 0 ? void 0 : _a.map((gc) => {
92
- var _a;
93
- return (_a = gc.displayValue) !== null && _a !== void 0 ? _a : BLANK_DISTINCT_COLUMN_VALUE;
94
- })
95
- : (_b = this.adaptable.getGridCellsForColumn(columnId)) === null || _b === void 0 ? void 0 : _b.map((gc) => {
96
- return gc.displayValue;
97
- });
98
- const newsortedDistinctValues = addBlankValue
99
- ? sortedDistinctValues
100
- : sortedDistinctValues.filter((gc) => gc.displayValue !== undefined);
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
- return {
114
- values: sortedDistinctValues.map((cv) => {
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 : {
@@ -0,0 +1,18 @@
1
+ import { AdaptableColumnDataType } from './AdaptableColumn';
2
+ /**
3
+ * Used in Expressions to reference row values which are not a column definition
4
+ */
5
+ export interface AdaptableField {
6
+ /**
7
+ * Name of field in data source, e.g. 'rowId', 'parentObject.childObject.value'
8
+ */
9
+ name: string;
10
+ /**
11
+ * Label for field (optional - defaults to name)
12
+ */
13
+ label?: string;
14
+ /**
15
+ * Data Type of field, used to validate and show correctly in UI
16
+ */
17
+ dataType: AdaptableColumnDataType;
18
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -54,4 +54,4 @@ export interface AdaptableBaseIcon {
54
54
  /**
55
55
  * All AdapTable System Icon names
56
56
  */
57
- export type AdaptableSystemIconName = 'add' | 'alert' | 'building' | 'laptop' | 'arrow-down' | 'arrow-left' | 'arrow-right' | 'arrow-up' | 'arrow-up-long' | 'arrow-down-long' | 'arrow-expand' | 'paperclip' | 'unfilled-circle' | 'boolean-list' | 'broadcast' | 'brush' | 'spanner' | 'edit-table' | 'chart-and-grid' | 'calendar' | 'call' | 'cells' | 'fdc3' | 'flag' | 'chart' | 'chat' | 'check' | 'check-circle' | 'checked' | 'clone' | 'close' | 'cloud-upload' | 'collapse' | 'column-add' | 'columns' | 'filter-list' | 'copy' | 'comment' | 'comments' | 'contains' | 'dashboard' | 'json' | 'data-set' | 'date-range' | 'delete' | 'division' | 'dock' | 'dollar' | 'drag' | 'edit' | 'ends-with' | 'equals' | 'equation' | 'error' | 'excel' | 'expand' | 'exponent' | 'export' | 'export-data' | 'fast-backward' | 'fast-forward' | 'filter' | 'filter-off' | 'lightning' | 'folder' | 'folder-open' | 'folder-shared' | 'color-palette' | 'horizontal-lines' | 'function' | 'greater-than' | 'greater-than-or-equal' | 'history' | 'home' | 'import-export' | 'info' | 'brain' | 'download' | 'grid' | 'interactions' | 'less-than' | 'less-than-or-equal' | 'list' | 'logout' | 'mail' | 'menu' | 'minus' | 'multiplication' | 'money' | 'newpage' | 'news' | 'filled-circle' | 'not-contains' | 'not-equal' | 'open-in-new' | 'order' | 'organisation' | 'pause' | 'percent' | 'percent-tag' | 'person' | 'contact' | 'pie-chart' | 'play' | 'plus' | 'add-circle' | 'search' | 'search-table' | 'select-all' | 'select-off' | 'select-fwd' | 'quote' | 'refresh' | 'regex' | 'reminder' | 'save' | 'schedule' | 'science' | 'settings' | 'link' | 'sort-asc' | 'sort-desc' | 'spark-line' | 'resume' | 'starts-with' | 'assignment' | 'statusbar' | 'stop' | 'traffic-lights' | 'tab-unselected' | 'theme' | 'clipboard' | 'target' | 'triangle-down' | 'triangle-up' | 'unchecked' | 'undo' | 'downloaded' | 'upload' | 'warning' | 'gradient' | 'badge' | 'italic' | 'bold' | 'align-left' | 'align-right' | 'align-center' | 'align-justify' | 'underline' | 'strikethrough' | 'overline' | 'case-upper' | 'case-lower' | 'case-sentence' | 'visibility-on' | 'visibility-off' | 'visibility-off-bold' | 'visibility-on-bold' | 'note' | 'import' | 'grid-filter' | 'grid-info' | 'csv' | 'rows' | 'expand-all' | 'collapse-all';
57
+ export type AdaptableSystemIconName = 'add' | 'alert' | 'building' | 'laptop' | 'arrow-down' | 'arrow-left' | 'arrow-right' | 'arrow-up' | 'arrow-up-long' | 'arrow-down-long' | 'arrow-expand' | 'paperclip' | 'unfilled-circle' | 'boolean-list' | 'broadcast' | 'brush' | 'spanner' | 'edit-table' | 'chart-and-grid' | 'calendar' | 'call' | 'cells' | 'fdc3' | 'flag' | 'chart' | 'chat' | 'check' | 'check-circle' | 'checked' | 'clone' | 'close' | 'cloud-upload' | 'collapse' | 'column-add' | 'columns' | 'filter-list' | 'copy' | 'comment' | 'comments' | 'contains' | 'dashboard' | 'json' | 'data-set' | 'date-range' | 'delete' | 'division' | 'dock' | 'dollar' | 'drag' | 'edit' | 'ends-with' | 'equals' | 'equation' | 'error' | 'excel' | 'expand' | 'exponent' | 'export' | 'export-data' | 'fast-backward' | 'fast-forward' | 'filter' | 'filter-off' | 'lightning' | 'folder' | 'folder-open' | 'folder-shared' | 'color-palette' | 'horizontal-lines' | 'function' | 'greater-than' | 'greater-than-or-equal' | 'history' | 'home' | 'import-export' | 'info' | 'brain' | 'download' | 'grid' | 'interactions' | 'less-than' | 'less-than-or-equal' | 'list' | 'logout' | 'mail' | 'menu' | 'minus' | 'multiplication' | 'money' | 'newpage' | 'news' | 'filled-circle' | 'not-contains' | 'not-equal' | 'open-in-new' | 'order' | 'organisation' | 'pause' | 'percent' | 'percent-tag' | 'person' | 'contact' | 'pie-chart' | 'play' | 'plus' | 'add-circle' | 'search' | 'search-table' | 'select-all' | 'select-off' | 'select-fwd' | 'sync' | 'quote' | 'refresh' | 'regex' | 'reminder' | 'save' | 'schedule' | 'science' | 'settings' | 'link' | 'sort-asc' | 'sort-desc' | 'spark-line' | 'resume' | 'starts-with' | 'assignment' | 'statusbar' | 'stop' | 'traffic-lights' | 'tab-unselected' | 'theme' | 'clipboard' | 'target' | 'triangle-down' | 'triangle-up' | 'unchecked' | 'undo' | 'downloaded' | 'upload' | 'warning' | 'gradient' | 'badge' | 'italic' | 'bold' | 'align-left' | 'align-right' | 'align-center' | 'align-justify' | 'underline' | 'strikethrough' | 'overline' | 'case-upper' | 'case-lower' | 'case-sentence' | 'visibility-on' | 'visibility-off' | 'visibility-off-bold' | 'visibility-on-bold' | 'note' | 'import' | 'grid-filter' | 'grid-info' | 'csv' | 'rows' | 'expand-all' | 'collapse-all' | 'column-outline';
@@ -25,7 +25,28 @@ export const SystemPredicateDefs = [
25
25
  icon: { text: 'IN' },
26
26
  columnScope: { DataTypes: ['String', 'Number', 'Date'] },
27
27
  moduleScope: ['columnFilter', 'flashingcell', 'formatColumn', 'alert', 'badgeStyle'],
28
- handler: ({ inputs, column, value, adaptableApi }) => {
28
+ handler: (context) => {
29
+ const { inputs, column, value, adaptableApi } = context;
30
+ const predicateInputs = context.inputs.reduce((acc, input) => {
31
+ const predicate = adaptableApi.predicateApi.getPredicateDefById(input);
32
+ if (predicate) {
33
+ acc.push(predicate);
34
+ }
35
+ return acc;
36
+ }, []);
37
+ if (predicateInputs.length) {
38
+ const nestedContext = Object.assign({}, context);
39
+ delete nestedContext.inputs;
40
+ const predicateResult = predicateInputs.some((predicate) => {
41
+ return adaptableApi.predicateApi.handlePredicate({
42
+ PredicateId: predicate.id,
43
+ }, nestedContext, false);
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
+ }
49
+ }
29
50
  if (inputs.length === 0) {
30
51
  return true;
31
52
  }
@@ -1,226 +1,7 @@
1
- import { Chart, ChatInitSettings, Contact, ContactList, Context, Country, Currency, Email, Instrument, InstrumentList, Nothing, Organization, Portfolio, Position, TimeRange, Valuation, ContextTypes } from '@finos/fdc3';
2
- /**
3
- * FDC3 (2.0) Standard Context Types supported by AdapTable
4
- */
5
- export type Fdc3StandardContextType = ChartContextType | ChatInitSettingsContextType | ContactContextType | ContactListContextType | CountryContextType | CurrencyContextType | EmailContextType | InstrumentContextType | InstrumentListContextType | OrganizationContextType | PortfolioContextType | PositionContextType | TimeRangeContextType | ValuationContextType | NothingContextType;
6
- /**
7
- * Type for FDC3 Custom Context
8
- */
9
- export type Fdc3CustomContextType = string;
10
- /**
11
- * Type for FDC3 Contexts (can be Standard or Custom)
12
- */
13
- export type Fdc3ContextType = Fdc3StandardContextType | Fdc3CustomContextType;
14
- export declare const ChartContextKey = "fdc3.chart";
15
- /**
16
- * Type for FDC3 Chart Context
17
- */
18
- export type ChartContextType = typeof ChartContextKey;
19
- export declare const ChatInitSettingsContextKey = "fdc3.chat.initSettings";
20
- /**
21
- * Type for FDC3 Chart Init Settings Context
22
- */
23
- export type ChatInitSettingsContextType = typeof ChatInitSettingsContextKey;
24
- export declare const ContactContextKey = "fdc3.contact";
25
- /**
26
- * Type for FDC3 Contact Context
27
- */
28
- export type ContactContextType = typeof ContactContextKey;
29
- export declare const ContactListContextKey = "fdc3.contactList";
30
- /**
31
- * Type for FDC3 Contact List Context
32
- */
33
- export type ContactListContextType = typeof ContactListContextKey;
34
- export declare const CountryContextKey = "fdc3.country";
35
- /**
36
- * Type for FDC3 Country Context
37
- */
38
- export type CountryContextType = typeof CountryContextKey;
39
- export declare const CurrencyContextKey = "fdc3.currency";
40
- /**
41
- * Type for FDC3 Currency Context
42
- */
43
- export type CurrencyContextType = typeof CurrencyContextKey;
44
- export declare const EmailContextKey = "fdc3.email";
45
- /**
46
- * Type for FDC3 Email Context
47
- */
48
- export type EmailContextType = typeof EmailContextKey;
49
- export declare const InstrumentContextKey = "fdc3.instrument";
50
- /**
51
- * Type for FDC3 Instrument Context
52
- */
53
- export type InstrumentContextType = typeof InstrumentContextKey;
54
- export declare const InstrumentListContextKey = "fdc3.instrumentList";
55
- /**
56
- * Type for FDC3 Instrument List Context
57
- */
58
- export type InstrumentListContextType = typeof InstrumentListContextKey;
59
- export declare const OrganizationContextKey = "fdc3.organization";
60
- /**
61
- * Type for FDC3 Organization Context
62
- */
63
- export type OrganizationContextType = typeof OrganizationContextKey;
64
- export declare const PortfolioContextKey = "fdc3.portfolio";
65
- /**
66
- * Type for FDC3 Portfolio Context
67
- */
68
- export type PortfolioContextType = typeof PortfolioContextKey;
69
- export declare const PositionContextKey = "fdc3.position";
70
- /**
71
- * Type for FDC3 Position Context
72
- */
73
- export type PositionContextType = typeof PositionContextKey;
74
- export declare const TimeRangeContextKey = "fdc3.timerange";
75
- /**
76
- * Type for FDC3 Time Range Context
77
- */
78
- export type TimeRangeContextType = typeof TimeRangeContextKey;
79
- export declare const ValuationContextKey = "fdc3.valuation";
80
- /**
81
- * Type for FDC3 Valuation Context
82
- */
83
- export type ValuationContextType = typeof ValuationContextKey;
84
- export declare const NothingContextKey = "fdc3.nothing";
85
- /**
86
- * Type for FDC3 Nothing Context
87
- */
88
- export type NothingContextType = typeof NothingContextKey;
89
- /**
90
- * FDC3 (2.0) Contexts
91
- */
92
- export type Fdc3StandardContext = ChartContext | ChatInitSettingsContext | ContactContext | ContactListContext | CountryContext | CurrencyContext | EmailContext | InstrumentContext | InstrumentListContext | OrganizationContext | PortfolioContext | PositionContext | TimeRangeContext | ValuationContext | NothingContext;
93
- /**
94
- * FDC3 (2.0) Custom Context
95
- */
96
- export type Fdc3CustomContext = Context;
97
- /**
98
- * FDC3 (2.0) Generic Context (Standard or Custom)
99
- */
100
- export type Fdc3Context = Fdc3StandardContext | Fdc3CustomContext;
101
- export type TypedFdc3Context<CONTEXT, TYPE extends Fdc3StandardContextType> = CONTEXT & {
102
- type: TYPE;
103
- };
104
- /**
105
- * FDC3 2.0 Chart Context
106
- */
107
- export type ChartContext = TypedFdc3Context<Chart, ContextTypes.Chart>;
108
- /**
109
- * FDC3 2.0 Chat Context
110
- */
111
- export type ChatInitSettingsContext = TypedFdc3Context<ChatInitSettings, ContextTypes.ChatInitSettings>;
112
- /**
113
- * FDC3 2.0 Contact Context
114
- */
115
- export type ContactContext = TypedFdc3Context<Contact, ContextTypes.Contact>;
116
- /**
117
- * FDC3 2.0 Contact List Context
118
- */
119
- export type ContactListContext = TypedFdc3Context<ContactList, ContextTypes.ContactList>;
120
- /**
121
- * FDC3 2.0 Country Context
122
- */
123
- export type CountryContext = TypedFdc3Context<Country, ContextTypes.Country>;
124
- /**
125
- * FDC3 2.0 Currency Context
126
- */
127
- export type CurrencyContext = TypedFdc3Context<Currency, ContextTypes.Currency>;
128
- /**
129
- * FDC3 2.0 Email Context
130
- */
131
- export type EmailContext = TypedFdc3Context<Email, ContextTypes.Email>;
132
- /**
133
- * FDC3 2.0 Instrument Context
134
- */
135
- export type InstrumentContext = TypedFdc3Context<Instrument, ContextTypes.Instrument>;
136
- /**
137
- * FDC3 2.0 Instrument List Context
138
- */
139
- export type InstrumentListContext = TypedFdc3Context<InstrumentList, ContextTypes.InstrumentList>;
140
- /**
141
- * FDC3 2.0 Organization Context
142
- */
143
- export type OrganizationContext = TypedFdc3Context<Organization, ContextTypes.Organization>;
144
- /**
145
- * FDC3 2.0 Portfolio Context
146
- */
147
- export type PortfolioContext = TypedFdc3Context<Portfolio, ContextTypes.Portfolio>;
148
- /**
149
- * FDC3 2.0 Position Context
150
- */
151
- export type PositionContext = TypedFdc3Context<Position, ContextTypes.Position>;
152
- /**
153
- * FDC3 2.0 Time Range Context
154
- */
155
- export type TimeRangeContext = TypedFdc3Context<TimeRange, ContextTypes.TimeRange>;
156
- /**
157
- * FDC3 2.0 Valuation Context
158
- */
159
- export type ValuationContext = TypedFdc3Context<Valuation, ContextTypes.Valuation>;
160
- /**
161
- * FDC3 2.0 Nothing Context
162
- */
163
- export type NothingContext = TypedFdc3Context<Nothing, ContextTypes.Nothing>;
164
- export declare const ContextConfiguration: {
165
- readonly "fdc3.chart": {
166
- readonly label: "Chart";
167
- readonly icon: "pie-chart";
168
- };
169
- readonly "fdc3.chat.initSettings": {
170
- readonly label: "ChatInitSettings";
171
- readonly icon: "chat";
172
- };
173
- readonly "fdc3.contact": {
174
- readonly label: "Contact";
175
- readonly icon: "badge";
176
- };
177
- readonly "fdc3.contactList": {
178
- readonly label: "ContactList";
179
- readonly icon: "badge";
180
- };
181
- readonly "fdc3.country": {
182
- readonly label: "Country";
183
- readonly icon: "flag";
184
- };
185
- readonly "fdc3.currency": {
186
- readonly label: "Currency";
187
- readonly icon: "dollar";
188
- };
189
- readonly "fdc3.email": {
190
- readonly label: "Email";
191
- readonly icon: "mail";
192
- };
193
- readonly "fdc3.instrument": {
194
- readonly label: "Instrument";
195
- readonly icon: "money";
196
- };
197
- readonly "fdc3.instrumentList": {
198
- readonly label: "InstrumentList";
199
- readonly icon: "money";
200
- };
201
- readonly "fdc3.organization": {
202
- readonly label: "Organization";
203
- readonly icon: "organisation";
204
- };
205
- readonly "fdc3.portfolio": {
206
- readonly label: "Portfolio";
207
- readonly icon: "building";
208
- };
209
- readonly "fdc3.position": {
210
- readonly label: "Position";
211
- readonly icon: "building";
212
- };
213
- readonly "fdc3.timerange": {
214
- readonly label: "TimeRange";
215
- readonly icon: "date-range";
216
- };
217
- readonly "fdc3.valuation": {
218
- readonly label: "Valuation";
219
- readonly icon: "equation";
220
- };
221
- readonly "fdc3.nothing": {
222
- readonly label: "Nothing";
223
- readonly icon: "fdc3";
224
- };
225
- };
226
- export declare const StandardContextTypes: Fdc3StandardContextType[];
1
+ import { StandardContextType } from '@finos/fdc3';
2
+ interface ContextConfig {
3
+ label: string;
4
+ icon: string;
5
+ }
6
+ export declare const ContextConfiguration: Record<StandardContextType, ContextConfig>;
7
+ export {};