@adaptabletools/adaptable 12.1.7 → 12.2.0-canary.0

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 (237) hide show
  1. package/base.css +127 -71
  2. package/bundle.cjs.js +108 -108
  3. package/index.css +145 -83
  4. package/package.json +1 -1
  5. package/publishTimestamp.d.ts +1 -1
  6. package/publishTimestamp.js +1 -1
  7. package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -0
  8. package/src/AdaptableOptions/AdaptableQLOptions.d.ts +44 -10
  9. package/src/AdaptableOptions/FilterOptions.d.ts +12 -0
  10. package/src/AdaptableOptions/FinancePluginOptions.d.ts +22 -1
  11. package/src/AdaptableOptions/LayoutOptions.d.ts +10 -1
  12. package/src/AdaptableOptions/StateOptions.d.ts +25 -12
  13. package/src/Api/ColumnApi.d.ts +5 -0
  14. package/src/Api/ExportApi.d.ts +5 -0
  15. package/src/Api/FilterApi.d.ts +23 -0
  16. package/src/Api/GridApi.d.ts +1 -0
  17. package/src/Api/Implementation/AlertApiImpl.js +1 -2
  18. package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
  19. package/src/Api/Implementation/ColumnApiImpl.js +5 -0
  20. package/src/Api/Implementation/ExportApiImpl.d.ts +3 -1
  21. package/src/Api/Implementation/ExportApiImpl.js +19 -3
  22. package/src/Api/Implementation/FilterApiImpl.d.ts +5 -0
  23. package/src/Api/Implementation/FilterApiImpl.js +25 -2
  24. package/src/Api/Implementation/GridApiImpl.d.ts +1 -0
  25. package/src/Api/Implementation/InternalApiImpl.d.ts +3 -2
  26. package/src/Api/Implementation/InternalApiImpl.js +34 -3
  27. package/src/Api/Implementation/PredicateApiImpl.js +4 -0
  28. package/src/Api/Implementation/QueryLanguageApiImpl.d.ts +1 -0
  29. package/src/Api/Implementation/QueryLanguageApiImpl.js +14 -1
  30. package/src/Api/InternalApi.d.ts +6 -2
  31. package/src/Api/QueryLanguageApi.d.ts +5 -0
  32. package/src/PredefinedConfig/CalculatedColumnState.d.ts +2 -2
  33. package/src/PredefinedConfig/Common/AdaptablePredicate.js +16 -4
  34. package/src/PredefinedConfig/Common/AdaptableQuery.js +1 -1
  35. package/src/PredefinedConfig/Common/AggregationColumns.d.ts +6 -0
  36. package/src/PredefinedConfig/Common/AggregationColumns.js +4 -0
  37. package/src/PredefinedConfig/Common/ColumnFilter.d.ts +2 -2
  38. package/src/PredefinedConfig/Common/Enums.d.ts +0 -15
  39. package/src/PredefinedConfig/Common/Enums.js +1 -18
  40. package/src/PredefinedConfig/ExportState.d.ts +12 -4
  41. package/src/PredefinedConfig/LayoutState.d.ts +2 -1
  42. package/src/PredefinedConfig/PopupState.d.ts +1 -2
  43. package/src/Redux/ActionsReducers/AlertRedux.d.ts +1 -1
  44. package/src/Redux/ActionsReducers/AlertRedux.js +1 -1
  45. package/src/Redux/ActionsReducers/ConditionalStyleRedux.d.ts +1 -1
  46. package/src/Redux/ActionsReducers/ConditionalStyleRedux.js +1 -1
  47. package/src/Redux/ActionsReducers/CustomSortRedux.d.ts +1 -1
  48. package/src/Redux/ActionsReducers/CustomSortRedux.js +1 -1
  49. package/src/Redux/ActionsReducers/FlashingCellRedux.d.ts +1 -1
  50. package/src/Redux/ActionsReducers/FlashingCellRedux.js +1 -1
  51. package/src/Redux/ActionsReducers/FormatColumnRedux.d.ts +1 -1
  52. package/src/Redux/ActionsReducers/FormatColumnRedux.js +1 -1
  53. package/src/Redux/ActionsReducers/LayoutRedux.d.ts +28 -0
  54. package/src/Redux/ActionsReducers/LayoutRedux.js +80 -2
  55. package/src/Redux/ActionsReducers/PlusMinusRedux.d.ts +1 -1
  56. package/src/Redux/ActionsReducers/PlusMinusRedux.js +1 -1
  57. package/src/Redux/ActionsReducers/PopupRedux.d.ts +0 -2
  58. package/src/Redux/ActionsReducers/PopupRedux.js +1 -28
  59. package/src/Redux/ActionsReducers/ScheduleRedux.d.ts +5 -5
  60. package/src/Redux/ActionsReducers/ScheduleRedux.js +5 -5
  61. package/src/Redux/ActionsReducers/ShortcutRedux.d.ts +1 -1
  62. package/src/Redux/ActionsReducers/ShortcutRedux.js +1 -1
  63. package/src/Redux/Store/AdaptableStore.js +15 -6
  64. package/src/Strategy/AlertModule.d.ts +1 -0
  65. package/src/Strategy/AlertModule.js +20 -0
  66. package/src/Strategy/BulkUpdateModule.d.ts +1 -1
  67. package/src/Strategy/CalculatedColumnModule.js +3 -3
  68. package/src/Strategy/ExportModule.d.ts +0 -1
  69. package/src/Strategy/ExportModule.js +0 -16
  70. package/src/Strategy/FilterModule.js +6 -0
  71. package/src/Strategy/Interface/IModule.d.ts +4 -0
  72. package/src/Strategy/LayoutModule.js +20 -20
  73. package/src/Strategy/QueryModule.js +1 -1
  74. package/src/Strategy/Utilities/Export/getExportRowsViewItems.js +0 -13
  75. package/src/Strategy/Utilities/FormatColumn/getFormatColumnStyleViewItems.js +16 -1
  76. package/src/Strategy/Utilities/Layout/getLayoutFilterViewItems.js +15 -11
  77. package/src/Strategy/Utilities/getExpressionViewItems.d.ts +3 -4
  78. package/src/Strategy/Utilities/getExpressionViewItems.js +3 -3
  79. package/src/Strategy/Utilities/getRuleViewItems.js +1 -1
  80. package/src/Utilities/Constants/DocumentationLinkConstants.d.ts +1 -0
  81. package/src/Utilities/Constants/DocumentationLinkConstants.js +2 -1
  82. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +3 -0
  83. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.d.ts +12 -2
  84. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +30 -66
  85. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +22 -6
  86. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +423 -220
  87. package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.d.ts +7 -1
  88. package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.js +25 -7
  89. package/src/Utilities/ExpressionFunctions/scalarAggregationHelper.d.ts +0 -1
  90. package/src/Utilities/ExpressionFunctions/scalarAggregationHelper.js +6 -54
  91. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.d.ts +1 -1
  92. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +31 -5
  93. package/src/Utilities/Interface/MessagePopups.d.ts +0 -4
  94. package/src/Utilities/ObjectFactory.d.ts +4 -2
  95. package/src/Utilities/ObjectFactory.js +16 -3
  96. package/src/Utilities/Services/AggregatedScalarLiveValue.d.ts +25 -0
  97. package/src/Utilities/Services/AggregatedScalarLiveValue.js +103 -0
  98. package/src/Utilities/Services/AlertService.d.ts +0 -1
  99. package/src/Utilities/Services/AlertService.js +5 -17
  100. package/src/Utilities/Services/CalculatedColumnExpressionService.d.ts +4 -4
  101. package/src/Utilities/Services/CalculatedColumnExpressionService.js +29 -154
  102. package/src/Utilities/Services/Interface/ICalculatedColumnExpressionService.d.ts +2 -2
  103. package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +8 -3
  104. package/src/Utilities/Services/QueryLanguageService.d.ts +8 -4
  105. package/src/Utilities/Services/QueryLanguageService.js +68 -25
  106. package/src/Utilities/Services/ReportService.js +48 -48
  107. package/src/View/AdaptableView.js +1 -2
  108. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/AdaptableOptionsForm.d.ts +1 -1
  109. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/AdaptableOptionsForm.js +10 -10
  110. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/Components/FormBox.d.ts +3 -0
  111. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/Components/FormBox.js +9 -0
  112. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.js +14 -15
  113. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/EntitlementsForm.d.ts +1 -1
  114. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/EntitlementsForm.js +2 -2
  115. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/FinanceForm/FinanceForm.d.ts +7 -0
  116. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/FinanceForm/FinanceForm.js +280 -0
  117. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/FinanceForm/index.d.ts +1 -0
  118. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/FinanceForm/index.js +5 -0
  119. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/GridOptionsForm.d.ts +1 -1
  120. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/GridOptionsForm.js +4 -4
  121. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UIOptionsStatusbarForm.js +2 -8
  122. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UiOptionsForm.d.ts +1 -1
  123. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UiOptionsForm.js +3 -3
  124. package/src/View/AdaptableWizardView/Wizard.js +2 -2
  125. package/src/View/CalculatedColumn/CalculatedColumnSummary.d.ts +0 -1
  126. package/src/View/CalculatedColumn/CalculatedColumnSummary.js +1 -8
  127. package/src/View/CalculatedColumn/Utilities/getCalculatedColumnSettingsTags.d.ts +2 -0
  128. package/src/View/CalculatedColumn/Utilities/{getCalculatedColumnSettingTags.js → getCalculatedColumnSettingsTags.js} +3 -3
  129. package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.d.ts +10 -0
  130. package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.js +80 -0
  131. package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +24 -14
  132. package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.d.ts +1 -2
  133. package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +9 -52
  134. package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.js +17 -6
  135. package/src/View/Components/AdaptableObjectCollection/index.d.ts +3 -4
  136. package/src/View/Components/AdaptableObjectCollection/index.js +7 -8
  137. package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +42 -6
  138. package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +1 -1
  139. package/src/View/Components/AdaptableObjectRow/index.js +1 -4
  140. package/src/View/Components/EntityRulesEditor/index.js +28 -7
  141. package/src/View/Components/FilterForm/FilterForm.js +8 -4
  142. package/src/View/Components/FilterForm/ListBoxFilterForm.js +1 -0
  143. package/src/View/Components/FilterForm/QuickFilterForm.js +19 -7
  144. package/src/View/Components/PermittedValuesSelector/PermitedValuesSelector.d.ts +9 -0
  145. package/src/View/Components/PermittedValuesSelector/PermitedValuesSelector.js +28 -0
  146. package/src/View/Components/PermittedValuesSelector/index.d.ts +1 -0
  147. package/src/View/Components/PermittedValuesSelector/index.js +5 -0
  148. package/src/View/Components/Popups/AdaptablePopup/Navigation.js +2 -2
  149. package/src/View/Components/Popups/AdaptablePopup/PopupPanel.d.ts +1 -0
  150. package/src/View/Components/Popups/AdaptablePopup/PopupPanel.js +2 -1
  151. package/src/View/Components/Popups/AdaptableToaster.js +2 -7
  152. package/src/View/Components/Popups/WindowPopups/windowFactory.d.ts +0 -1
  153. package/src/View/Components/Popups/WindowPopups/windowFactory.js +1 -4
  154. package/src/View/Components/ValueSelector/index.js +8 -19
  155. package/src/View/CustomSort/CustomSortSummary.js +1 -1
  156. package/src/View/Dashboard/DashboardPopup.js +11 -10
  157. package/src/View/Export/ExportViewPanel.d.ts +1 -2
  158. package/src/View/Export/ExportViewPanel.js +4 -8
  159. package/src/View/Export/Wizard/ReportColumnTypeWizard.d.ts +1 -2
  160. package/src/View/Export/Wizard/ReportColumnTypeWizard.js +11 -12
  161. package/src/View/Export/Wizard/ReportRowTypeWizard.d.ts +1 -2
  162. package/src/View/Export/Wizard/ReportRowTypeWizard.js +12 -13
  163. package/src/View/Export/Wizard/ReportRowsWizardSection.js +4 -3
  164. package/src/View/Export/Wizard/ReportSettingsWizard.js +1 -2
  165. package/src/View/Filter/FilterViewPanel.js +21 -4
  166. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +1 -1
  167. package/src/View/GridInfo/AdaptableObjectsSummary.js +5 -3
  168. package/src/View/GridInfo/AdaptableOptionsComponent.js +1 -1
  169. package/src/View/GridInfo/GridInfoPopup.js +6 -7
  170. package/src/View/Layout/Wizard/{LayoutEditor → Components}/ColumnLabels.d.ts +0 -0
  171. package/src/View/Layout/Wizard/{LayoutEditor → Components}/ColumnLabels.js +0 -0
  172. package/src/View/Layout/Wizard/LayoutWizard.js +1 -0
  173. package/src/View/Layout/Wizard/sections/AggregationsSection.d.ts +1 -0
  174. package/src/View/Layout/Wizard/sections/AggregationsSection.js +69 -8
  175. package/src/View/Layout/Wizard/sections/ColumnsSection.js +1 -1
  176. package/src/View/Query/QueryViewPanel.js +1 -1
  177. package/src/View/Query/Wizard/NamedQueryExpressionWizardSection.js +3 -4
  178. package/src/View/StateManagement/StateManagementPopup.js +18 -19
  179. package/src/agGrid/Adaptable.d.ts +12 -3
  180. package/src/agGrid/Adaptable.js +264 -148
  181. package/src/agGrid/agGridHelper.d.ts +1 -0
  182. package/src/agGrid/agGridHelper.js +5 -3
  183. package/src/agGrid/agGridMenuHelper.d.ts +1 -0
  184. package/src/agGrid/agGridMenuHelper.js +4 -2
  185. package/src/agGrid/weightedAverage.d.ts +6 -0
  186. package/src/agGrid/weightedAverage.js +66 -0
  187. package/src/bundle-dependencies/bundles/react-toastify/index.js +1 -1
  188. package/src/components/DragAndDropContext/ModuleManager.js +3 -4
  189. package/src/components/DragAndDropContext/TabList.js +9 -30
  190. package/src/components/DragAndDropContext/UnusedPanel.js +1 -7
  191. package/src/components/DropdownButton/index.js +2 -2
  192. package/src/components/EmptyContent/index.js +2 -2
  193. package/src/components/ExpressionEditor/BaseEditorInput.d.ts +1 -0
  194. package/src/components/ExpressionEditor/BaseEditorInput.js +3 -3
  195. package/src/components/ExpressionEditor/EditorInput.d.ts +1 -1
  196. package/src/components/ExpressionEditor/EditorInput.js +24 -4
  197. package/src/components/ExpressionEditor/{EditorInputReactive.d.ts → EditorInputWithWhereClause.d.ts} +3 -3
  198. package/src/components/ExpressionEditor/{EditorInputReactive.js → EditorInputWithWhereClause.js} +6 -5
  199. package/src/components/ExpressionEditor/editorButtonsAggregatedBoolean.d.ts +2 -0
  200. package/src/components/ExpressionEditor/{editorButtonsReactive.js → editorButtonsAggregatedBoolean.js} +22 -37
  201. package/src/components/ExpressionEditor/editorButtonsAggregatedScalar.js +5 -10
  202. package/src/components/ExpressionEditor/editorButtonsCumulativeAggregatedScalar.d.ts +2 -0
  203. package/src/components/ExpressionEditor/editorButtonsCumulativeAggregatedScalar.js +50 -0
  204. package/src/components/ExpressionEditor/editorButtonsObservable.d.ts +2 -0
  205. package/src/components/ExpressionEditor/editorButtonsObservable.js +40 -0
  206. package/src/components/ExpressionEditor/index.d.ts +1 -1
  207. package/src/components/ExpressionEditor/index.js +50 -19
  208. package/src/metamodel/adaptable.metamodel.d.ts +86 -5
  209. package/src/metamodel/adaptable.metamodel.js +1 -1
  210. package/src/parser/src/types.d.ts +14 -10
  211. package/src/types.d.ts +4 -4
  212. package/version.d.ts +1 -1
  213. package/version.js +1 -1
  214. package/src/View/CalculatedColumn/Utilities/getCalculatedColumnSettingTags.d.ts +0 -2
  215. package/src/View/Layout/LayoutEditorStandalonePopup.d.ts +0 -3
  216. package/src/View/Layout/LayoutEditorStandalonePopup.js +0 -78
  217. package/src/View/Layout/Wizard/LayoutEditor/ColumnList.d.ts +0 -27
  218. package/src/View/Layout/Wizard/LayoutEditor/ColumnList.js +0 -86
  219. package/src/View/Layout/Wizard/LayoutEditor/ColumnSortList.d.ts +0 -16
  220. package/src/View/Layout/Wizard/LayoutEditor/ColumnSortList.js +0 -89
  221. package/src/View/Layout/Wizard/LayoutEditor/PivotList.d.ts +0 -15
  222. package/src/View/Layout/Wizard/LayoutEditor/PivotList.js +0 -70
  223. package/src/View/Layout/Wizard/LayoutEditor/RowGroupsList.d.ts +0 -15
  224. package/src/View/Layout/Wizard/LayoutEditor/RowGroupsList.js +0 -70
  225. package/src/View/Layout/Wizard/LayoutEditor/droppableIds.d.ts +0 -7
  226. package/src/View/Layout/Wizard/LayoutEditor/droppableIds.js +0 -11
  227. package/src/View/Layout/Wizard/LayoutEditor/getItemStyle.d.ts +0 -6
  228. package/src/View/Layout/Wizard/LayoutEditor/getItemStyle.js +0 -26
  229. package/src/View/Layout/Wizard/LayoutEditor/index.d.ts +0 -9
  230. package/src/View/Layout/Wizard/LayoutEditor/index.js +0 -367
  231. package/src/View/Layout/Wizard/LayoutEditor/reducer.d.ts +0 -28
  232. package/src/View/Layout/Wizard/LayoutEditor/reducer.js +0 -46
  233. package/src/View/Layout/Wizard/LayoutEditor/utils.d.ts +0 -10
  234. package/src/View/Layout/Wizard/LayoutEditor/utils.js +0 -14
  235. package/src/View/Layout/Wizard/LayoutEditorWizard.d.ts +0 -30
  236. package/src/View/Layout/Wizard/LayoutEditorWizard.js +0 -132
  237. package/src/components/ExpressionEditor/editorButtonsReactive.d.ts +0 -2
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CalculatedColumnExpressionService = void 0;
4
4
  const LoggingHelper_1 = require("../Helpers/LoggingHelper");
5
5
  const ModuleConstants_1 = require("../Constants/ModuleConstants");
6
- const scalarAggregationHelper_1 = require("../ExpressionFunctions/scalarAggregationHelper");
6
+ const AggregatedScalarLiveValue_1 = require("./AggregatedScalarLiveValue");
7
7
  class CalculatedColumnExpressionService {
8
8
  constructor(adaptableApi) {
9
9
  this.adaptableApi = adaptableApi;
10
- this.aggregatedScalarCalculatedColumnsMap = new Map();
10
+ this.aggregatedScalarLiveValuesMap = new Map();
11
11
  this.adaptableApi = adaptableApi;
12
12
  this.adaptableApi.internalApi
13
13
  .getDataService()
@@ -17,12 +17,12 @@ class CalculatedColumnExpressionService {
17
17
  return;
18
18
  }
19
19
  const refreshedCalculatedColumns = [];
20
- this.aggregatedScalarCalculatedColumnsMap.forEach((aggregatedScalarCalculatedColumn) => {
21
- if (aggregatedScalarCalculatedColumn
22
- .getColumnDependencies()
23
- .includes(cellDataChangedInfo.column.columnId)) {
24
- aggregatedScalarCalculatedColumn.refreshAggregatedColumnValue();
25
- refreshedCalculatedColumns.push(aggregatedScalarCalculatedColumn.getCalculatedColumnId());
20
+ this.aggregatedScalarLiveValuesMap.forEach((aggregatedScalarLiveValue, calculatedColumnId) => {
21
+ const calculatedColumn = this.adaptableApi.calculatedColumnApi.getCalculatedColumnById(calculatedColumnId);
22
+ const columnDependencies = this.adaptableApi.calculatedColumnApi.getReferencedColumnIdsForCalculatedColumn(calculatedColumn);
23
+ if (columnDependencies.includes(cellDataChangedInfo.column.columnId)) {
24
+ aggregatedScalarLiveValue.refresh();
25
+ refreshedCalculatedColumns.push(calculatedColumn.ColumnId);
26
26
  }
27
27
  });
28
28
  if (refreshedCalculatedColumns.length) {
@@ -31,9 +31,10 @@ class CalculatedColumnExpressionService {
31
31
  });
32
32
  this.adaptableApi.eventApi.on('GridDataChanged', () => {
33
33
  const refreshedCalculatedColumns = [];
34
- this.aggregatedScalarCalculatedColumnsMap.forEach((aggregatedScalarCalculatedColumn) => {
35
- aggregatedScalarCalculatedColumn.refreshAggregatedColumnValue();
36
- refreshedCalculatedColumns.push(aggregatedScalarCalculatedColumn.getCalculatedColumnId());
34
+ this.aggregatedScalarLiveValuesMap.forEach((aggregatedScalarLiveValue, calculatedColumnId) => {
35
+ const calculatedColumn = this.adaptableApi.calculatedColumnApi.getCalculatedColumnById(calculatedColumnId);
36
+ aggregatedScalarLiveValue.refresh();
37
+ refreshedCalculatedColumns.push(calculatedColumn.ColumnId);
37
38
  });
38
39
  if (refreshedCalculatedColumns.length) {
39
40
  this.adaptableApi.gridApi.refreshCells(null, refreshedCalculatedColumns);
@@ -41,9 +42,8 @@ class CalculatedColumnExpressionService {
41
42
  });
42
43
  }
43
44
  destroy() {
44
- [...this.aggregatedScalarCalculatedColumnsMap.values()].forEach((aggregatedScalarCalculatedColumn) => aggregatedScalarCalculatedColumn.destroy());
45
- this.aggregatedScalarCalculatedColumnsMap.clear();
46
- this.aggregatedScalarCalculatedColumnsMap = null;
45
+ this.aggregatedScalarLiveValuesMap.clear();
46
+ this.aggregatedScalarLiveValuesMap = null;
47
47
  }
48
48
  getCalculatedColumnDataType(calculatedColumnQuery) {
49
49
  try {
@@ -99,21 +99,21 @@ class CalculatedColumnExpressionService {
99
99
  // if query has neither a ScalarExpression nor an AggregatedScalarExpression => it can only be false
100
100
  return false;
101
101
  }
102
- evaluateCalculatedColumnQuery(calculatedColumn, node) {
102
+ evaluateCalculatedColumnQuery(calculatedColumn, rowNode) {
103
103
  var _a, _b, _c, _d, _e;
104
104
  try {
105
- if (this.adaptableApi.gridApi.isGroupRowNode(node)) {
105
+ if (this.adaptableApi.gridApi.isGroupRowNode(rowNode)) {
106
106
  return undefined;
107
107
  }
108
108
  // no validation here, this function has to be as performant as possible
109
109
  if ((_a = calculatedColumn === null || calculatedColumn === void 0 ? void 0 : calculatedColumn.Query) === null || _a === void 0 ? void 0 : _a.ScalarExpression) {
110
110
  return this.adaptableApi.internalApi
111
111
  .getQueryLanguageService()
112
- .evaluateScalarExpression(calculatedColumn.Query.ScalarExpression, ModuleConstants_1.CalculatedColumnModuleId, node);
112
+ .evaluateScalarExpression(calculatedColumn.Query.ScalarExpression, ModuleConstants_1.CalculatedColumnModuleId, rowNode);
113
113
  }
114
114
  if ((_b = calculatedColumn === null || calculatedColumn === void 0 ? void 0 : calculatedColumn.Query) === null || _b === void 0 ? void 0 : _b.AggregatedScalarExpression) {
115
- const aggregatedScalarCalculatedColumn = this.aggregatedScalarCalculatedColumnsMap.get(calculatedColumn.Uuid);
116
- return aggregatedScalarCalculatedColumn === null || aggregatedScalarCalculatedColumn === void 0 ? void 0 : aggregatedScalarCalculatedColumn.getAggregatedColumnValue(node);
115
+ const aggregatedScalarLiveValue = this.aggregatedScalarLiveValuesMap.get(calculatedColumn.Uuid);
116
+ return aggregatedScalarLiveValue === null || aggregatedScalarLiveValue === void 0 ? void 0 : aggregatedScalarLiveValue.getAggregatedValueForRow(rowNode);
117
117
  }
118
118
  }
119
119
  catch (error) {
@@ -121,149 +121,24 @@ class CalculatedColumnExpressionService {
121
121
  return null;
122
122
  }
123
123
  }
124
- createAggregatedScalarCalculatedColumn(calculatedColumn) {
125
- var _a, _b;
124
+ createAggregatedScalarLiveValue(calculatedColumn) {
125
+ var _a, _b, _c;
126
126
  // if there is already an aggregated scalar, delete it (possible when editing)
127
- this.destroyAggregatedScalarCalculatedColumn(calculatedColumn);
127
+ this.destroyAggregatedScalarLiveValue(calculatedColumn);
128
128
  if ((_a = calculatedColumn.Query) === null || _a === void 0 ? void 0 : _a.AggregatedScalarExpression) {
129
129
  try {
130
- const aggregatedScalarCalculatedColumn = new AggregatedScalarCalculatedColumn(calculatedColumn, this.adaptableApi);
131
- this.aggregatedScalarCalculatedColumnsMap.set(calculatedColumn.Uuid, aggregatedScalarCalculatedColumn);
130
+ const aggregatedScalarLiveValue = new AggregatedScalarLiveValue_1.AggregatedScalarLiveValue({
131
+ aggregatedScalarExpression: (_b = calculatedColumn.Query) === null || _b === void 0 ? void 0 : _b.AggregatedScalarExpression,
132
+ }, ModuleConstants_1.CalculatedColumnModuleId, this.adaptableApi);
133
+ this.aggregatedScalarLiveValuesMap.set(calculatedColumn.Uuid, aggregatedScalarLiveValue);
132
134
  }
133
135
  catch (e) {
134
- LoggingHelper_1.LogAdaptableError(`Creating CalculatedColumn ('${(_b = calculatedColumn.Query) === null || _b === void 0 ? void 0 : _b.AggregatedScalarExpression}') failed!\n${e.message}`);
136
+ LoggingHelper_1.LogAdaptableError(`Creating CalculatedColumn ('${(_c = calculatedColumn.Query) === null || _c === void 0 ? void 0 : _c.AggregatedScalarExpression}') failed!\n${e.message}`);
135
137
  }
136
138
  }
137
139
  }
138
- destroyAggregatedScalarCalculatedColumn(calculatedColumn) {
139
- var _a;
140
- (_a = this.aggregatedScalarCalculatedColumnsMap.get(calculatedColumn.Uuid)) === null || _a === void 0 ? void 0 : _a.destroy();
141
- this.aggregatedScalarCalculatedColumnsMap.delete(calculatedColumn.Uuid);
140
+ destroyAggregatedScalarLiveValue(calculatedColumn) {
141
+ this.aggregatedScalarLiveValuesMap.delete(calculatedColumn.Uuid);
142
142
  }
143
143
  }
144
144
  exports.CalculatedColumnExpressionService = CalculatedColumnExpressionService;
145
- class AggregatedScalarCalculatedColumn {
146
- constructor(calculatedColumn, adaptableApi) {
147
- this.calculatedColumn = calculatedColumn;
148
- this.adaptableApi = adaptableApi;
149
- const aggregationConfig = this.adaptableApi.internalApi
150
- .getQueryLanguageService()
151
- .evaluateAggregatedScalarExpression(calculatedColumn.Query.AggregatedScalarExpression, ModuleConstants_1.CalculatedColumnModuleId);
152
- this.expressionEvaluation = aggregationConfig.value;
153
- this.aggregationResult = this.computeAggregatedValue(this.expressionEvaluation);
154
- // currently we support only one reducer
155
- this.aggregationReducerName = Object.keys(this.expressionEvaluation.aggregationParams.reducers)[0];
156
- }
157
- destroy() {
158
- this.expressionEvaluation = null;
159
- this.calculatedColumn = null;
160
- this.adaptableApi = null;
161
- this.aggregationResult = null;
162
- }
163
- getAggregatedColumnValue(rowNode) {
164
- const aggregationValue = this.getAggregationValue(rowNode);
165
- if (this.expressionEvaluation.rowValueGetter) {
166
- return this.expressionEvaluation.rowValueGetter(rowNode, aggregationValue);
167
- }
168
- return aggregationValue;
169
- }
170
- refreshAggregatedColumnValue() {
171
- const aggregationConfig = this.adaptableApi.internalApi
172
- .getQueryLanguageService()
173
- .evaluateAggregatedScalarExpression(this.calculatedColumn.Query.AggregatedScalarExpression, ModuleConstants_1.CalculatedColumnModuleId);
174
- this.expressionEvaluation = aggregationConfig.value;
175
- this.aggregationResult = this.computeAggregatedValue(this.expressionEvaluation);
176
- }
177
- getCalculatedColumnId() {
178
- return this.calculatedColumn.ColumnId;
179
- }
180
- getColumnDependencies() {
181
- return this.expressionEvaluation.columnDependencies;
182
- }
183
- computeAggregatedValue(expressionEvaluation) {
184
- var _a;
185
- const gridRowNodes = this.adaptableApi.gridApi.getAllRowNodes();
186
- // we iterate over the RowNode list (we need this to handle complex column values (nested values, valueGetters etc)
187
- // so we will map the fieldNames to RowNode.data
188
- const mapReducerValueGetter = (fieldName) => {
189
- return (rowNode) => {
190
- return this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, fieldName);
191
- };
192
- };
193
- Object.values(expressionEvaluation.aggregationParams.reducers).forEach((aggregationReducer) => {
194
- aggregationReducer.getter = mapReducerValueGetter(aggregationReducer.field);
195
- // nullify the field to force the fallback on the getter fn
196
- aggregationReducer.field = null;
197
- });
198
- const mapGroupByToKey = (fieldName) => {
199
- return (_unusableProperty, rowNode) => this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, fieldName);
200
- };
201
- (_a = expressionEvaluation.aggregationParams.groupBy) === null || _a === void 0 ? void 0 : _a.forEach((groupByDef) => {
202
- groupByDef.toKey = mapGroupByToKey(groupByDef.field);
203
- });
204
- if (!expressionEvaluation.cumulateOver) {
205
- let aggregatedRowNodes = gridRowNodes;
206
- if (expressionEvaluation.sortByColumn) {
207
- const sortByColumn = expressionEvaluation.sortByColumn;
208
- const getRowNodeValue = (rowNode, columnId) => this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, columnId);
209
- if (expressionEvaluation.filterUndefinedValues) {
210
- aggregatedRowNodes = gridRowNodes.filter((node) => {
211
- const rowValue = getRowNodeValue(node, sortByColumn);
212
- return rowValue != undefined;
213
- });
214
- }
215
- // currently, we support only ascending sorting
216
- aggregatedRowNodes.sort((first, second) => {
217
- const firstValue = getRowNodeValue(first, sortByColumn);
218
- const secondValue = getRowNodeValue(second, sortByColumn);
219
- if (firstValue < secondValue) {
220
- return -1;
221
- }
222
- if (firstValue > secondValue) {
223
- return 1;
224
- }
225
- return 0;
226
- });
227
- }
228
- return scalarAggregationHelper_1.aggregate(expressionEvaluation.aggregationParams, aggregatedRowNodes);
229
- }
230
- else {
231
- // 1. sort grid data by given OVER column
232
- const sortByColumn = expressionEvaluation.cumulateOver;
233
- const getRowNodeValue = (rowNode, columnId) => this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, columnId);
234
- // currently, we support only ascending sorting
235
- gridRowNodes.sort((first, second) => {
236
- const firstValue = getRowNodeValue(first, sortByColumn);
237
- const secondValue = getRowNodeValue(second, sortByColumn);
238
- if (firstValue < secondValue) {
239
- return -1;
240
- }
241
- if (firstValue > secondValue) {
242
- return 1;
243
- }
244
- return 0;
245
- });
246
- // 2. add primary key column as the most specific groupBy
247
- if (!expressionEvaluation.aggregationParams.groupBy) {
248
- expressionEvaluation.aggregationParams.groupBy = [];
249
- }
250
- const gridPrimaryKeyColumn = this.adaptableApi.internalApi.getAdaptableOptions().primaryKey;
251
- // !! aggregationParams mutated
252
- expressionEvaluation.aggregationParams.groupBy.push({
253
- field: gridPrimaryKeyColumn,
254
- toKey: mapGroupByToKey(gridPrimaryKeyColumn),
255
- });
256
- // 3. cumulate
257
- return scalarAggregationHelper_1.cumulate(expressionEvaluation.aggregationParams, gridRowNodes);
258
- }
259
- }
260
- getAggregationValue(rowNode) {
261
- var _a, _b;
262
- if ((_a = this.expressionEvaluation.aggregationParams.groupBy) === null || _a === void 0 ? void 0 : _a.length) {
263
- const groupColumns = this.expressionEvaluation.aggregationParams.groupBy.map((groupByParam) => groupByParam.field);
264
- const groupKeys = groupColumns.map((groupColumnName) => this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, groupColumnName));
265
- return (_b = this.aggregationResult.deepMap.get(groupKeys)) === null || _b === void 0 ? void 0 : _b.reducerResults[this.aggregationReducerName];
266
- }
267
- return this.aggregationResult.reducerResults[this.aggregationReducerName];
268
- }
269
- }
@@ -5,6 +5,6 @@ export interface ICalculatedColumnExpressionService extends IAdaptableService {
5
5
  isCalculatedColumnQueryValid(calculatedColumnQuery: AdaptableCalculatedColumnQuery): boolean;
6
6
  evaluateCalculatedColumnQuery(calculatedColumn: CalculatedColumn, rowNode: RowNode): any;
7
7
  getCalculatedColumnDataType(calculatedColumnQuery: AdaptableCalculatedColumnQuery): 'String' | 'Number' | 'Boolean' | 'Date';
8
- createAggregatedScalarCalculatedColumn(calculatedColumn: CalculatedColumn): void;
9
- destroyAggregatedScalarCalculatedColumn(calculatedColumn: CalculatedColumn): void;
8
+ createAggregatedScalarLiveValue(calculatedColumn: CalculatedColumn): void;
9
+ destroyAggregatedScalarLiveValue(calculatedColumn: CalculatedColumn): void;
10
10
  }
@@ -3,14 +3,15 @@ import { IAdaptableService } from './IAdaptableService';
3
3
  import { RowNode } from '@ag-grid-community/all-modules';
4
4
  import { CellDataChangedInfo } from '../../../PredefinedConfig/Common/CellDataChangedInfo';
5
5
  import { AdaptableModule } from '../../../PredefinedConfig/Common/Types';
6
- import { AggregationParameter } from '../../ExpressionFunctions/aggregatedScalarExpressionFunctions';
6
+ import { ScalarAggregationParameter } from '../../ExpressionFunctions/aggregatedScalarExpressionFunctions';
7
7
  import { ModuleExpressionFunctions } from '../../../AdaptableOptions/AdaptableQLOptions';
8
+ import { BooleanAggregationParameter } from '../../ExpressionFunctions/aggregatedBooleanExpressionFunctions';
8
9
  export interface IQueryLanguageService extends IAdaptableService {
9
10
  evaluateBooleanExpression(expression: string, module: AdaptableModule, rowNode: RowNode): boolean;
10
11
  evaluateScalarExpression(expression: string, module: AdaptableModule, rowNode: RowNode): any;
11
12
  evaluateObservableExpression(expression: string, module: AdaptableModule): Observable<CellDataChangedInfo>;
12
- evaluateAggregatedBooleanExpression(expression: string, module: AdaptableModule): Observable<CellDataChangedInfo>;
13
- evaluateAggregatedScalarExpression(expression: string, module: AdaptableModule): AggregationParameter;
13
+ evaluateAggregatedBooleanExpression(expression: string, module: AdaptableModule): BooleanAggregationParameter;
14
+ evaluateAggregatedScalarExpression(expression: string, module: AdaptableModule): ScalarAggregationParameter;
14
15
  validateBoolean(expression: string, module: AdaptableModule, config?: {
15
16
  force?: boolean;
16
17
  }): {
@@ -29,7 +30,11 @@ export interface IQueryLanguageService extends IAdaptableService {
29
30
  isValid: boolean;
30
31
  errorMessage: string;
31
32
  };
33
+ computeAggregatedBooleanValue(expression: string, module: AdaptableModule): boolean;
32
34
  getModuleExpressionFunctions(module: AdaptableModule): ModuleExpressionFunctions;
33
35
  getColumnsFromExpression(input: string): string[];
34
36
  getNamedQueryNamesFromExpression(input: string): string[];
37
+ isCumulativeAggregate(input: string): boolean;
38
+ evaluateCustomQueryVariable(functionName: string, args?: any[]): any;
39
+ getExpressionWithColumnFriendlyNames(expression: string): string;
35
40
  }
@@ -4,8 +4,9 @@ import { CellDataChangedInfo } from '../../PredefinedConfig/Common/CellDataChang
4
4
  import { RowNode } from '@ag-grid-community/all-modules';
5
5
  import { AdaptableModule } from '../../PredefinedConfig/Common/Types';
6
6
  import { ModuleExpressionFunctions } from '../../AdaptableOptions/AdaptableQLOptions';
7
- import { AggregationParameter } from '../ExpressionFunctions/aggregatedScalarExpressionFunctions';
7
+ import { ScalarAggregationParameter } from '../ExpressionFunctions/aggregatedScalarExpressionFunctions';
8
8
  import { AdaptableApi } from '../../../types';
9
+ import { BooleanAggregationParameter } from '../ExpressionFunctions/aggregatedBooleanExpressionFunctions';
9
10
  export declare class QueryLanguageService implements IQueryLanguageService {
10
11
  private adaptableApi;
11
12
  private cacheBooleanValidation;
@@ -16,9 +17,9 @@ export declare class QueryLanguageService implements IQueryLanguageService {
16
17
  constructor(adaptableApi: AdaptableApi);
17
18
  evaluateBooleanExpression(expression: string, module: AdaptableModule, rowNode: any): any;
18
19
  evaluateScalarExpression(expression: string, module: AdaptableModule, rowNode: RowNode): any;
19
- evaluateAggregatedScalarExpression(expression: string, module: AdaptableModule): AggregationParameter;
20
+ evaluateAggregatedScalarExpression(expression: string, module: AdaptableModule): ScalarAggregationParameter;
20
21
  evaluateObservableExpression(reactiveExpression: string, module: AdaptableModule): Observable<CellDataChangedInfo>;
21
- evaluateAggregatedBooleanExpression(aggregationExpression: string, module: AdaptableModule): Observable<CellDataChangedInfo>;
22
+ evaluateAggregatedBooleanExpression(aggregationExpression: string, module: AdaptableModule): BooleanAggregationParameter;
22
23
  validateBoolean(expressionInput: string, module: AdaptableModule, config?: {
23
24
  force?: boolean;
24
25
  }): {
@@ -37,10 +38,13 @@ export declare class QueryLanguageService implements IQueryLanguageService {
37
38
  isValid: boolean;
38
39
  errorMessage: string;
39
40
  };
41
+ computeAggregatedBooleanValue(expression: string, module: AdaptableModule): boolean;
40
42
  getColumnsFromExpression(input?: string): string[];
41
43
  getNamedQueryNamesFromExpression(input?: string): string[];
44
+ isCumulativeAggregate(input: string): boolean;
45
+ getExpressionWithColumnFriendlyNames(expression?: string): string;
42
46
  getModuleExpressionFunctions(module: AdaptableModule): ModuleExpressionFunctions;
43
- destroy(): void;
47
+ evaluateCustomQueryVariable(functionName: string, args?: any[]): any;
44
48
  private getBooleanAndScalarFunctions;
45
49
  private getExpressionCacheKey;
46
50
  private getNodesFromExpression;
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const parser = tslib_1.__importStar(require("../../parser/src"));
6
6
  const rxjs_1 = require("rxjs");
7
7
  const LoggingHelper_1 = require("../Helpers/LoggingHelper");
8
+ const AggregatedScalarLiveValue_1 = require("./AggregatedScalarLiveValue");
8
9
  class QueryLanguageService {
9
10
  constructor(adaptableApi) {
10
11
  this.adaptableApi = adaptableApi;
@@ -21,6 +22,7 @@ class QueryLanguageService {
21
22
  node: rowNode,
22
23
  adaptableApi: this.adaptableApi,
23
24
  functions: booleanAndScalarFunctions,
25
+ evaluateCustomQueryVariable: this.evaluateCustomQueryVariable,
24
26
  });
25
27
  }
26
28
  evaluateScalarExpression(expression, module, rowNode) {
@@ -33,6 +35,7 @@ class QueryLanguageService {
33
35
  node: null,
34
36
  adaptableApi: this.adaptableApi,
35
37
  functions: aggregatedScalarFunctions,
38
+ evaluateCustomQueryVariable: this.evaluateCustomQueryVariable,
36
39
  });
37
40
  }
38
41
  evaluateObservableExpression(reactiveExpression, module) {
@@ -43,19 +46,21 @@ class QueryLanguageService {
43
46
  adaptableApi: this.adaptableApi,
44
47
  functions: moduleExpressionFunctions.observableFunctions,
45
48
  whereClauseFunctions: booleanAndScalarFunctions,
49
+ evaluateCustomQueryVariable: this.evaluateCustomQueryVariable,
46
50
  });
47
51
  return reactiveExpression$;
48
52
  }
49
53
  evaluateAggregatedBooleanExpression(aggregationExpression, module) {
50
54
  const moduleExpressionFunctions = this.getModuleExpressionFunctions(module);
51
55
  const booleanAndScalarFunctions = this.getBooleanAndScalarFunctions(moduleExpressionFunctions);
52
- const aggregationExpression$ = parser.evaluate(aggregationExpression, {
56
+ const aggregationEvaluation = parser.evaluate(aggregationExpression, {
53
57
  node: aggregationExpression,
54
58
  adaptableApi: this.adaptableApi,
55
59
  functions: moduleExpressionFunctions.aggregatedBooleanFunctions,
56
60
  whereClauseFunctions: booleanAndScalarFunctions,
61
+ evaluateCustomQueryVariable: this.evaluateCustomQueryVariable,
57
62
  });
58
- return aggregationExpression$;
63
+ return aggregationEvaluation;
59
64
  }
60
65
  validateBoolean(expressionInput = '', module, config = { force: false }) {
61
66
  var _a;
@@ -170,15 +175,16 @@ class QueryLanguageService {
170
175
  return result;
171
176
  }
172
177
  try {
173
- const aggregatedBooleanExpressionEvaluation = this.evaluateAggregatedBooleanExpression(expression, module);
174
- if (!rxjs_1.isObservable(aggregatedBooleanExpressionEvaluation)) {
178
+ const evaluationResult = this.evaluateAggregatedBooleanExpression(expression, module);
179
+ if (evaluationResult.type !== 'aggregationBoolean') {
175
180
  const result = {
176
181
  isValid: false,
177
- errorMessage: `provided AggregatedBoolean expression does not evaluate to an Observable`,
182
+ errorMessage: 'provided AggregatedBBoolean expression does not evaluate to a supported aggregation',
178
183
  };
179
184
  this.cacheAggregatedBooleanValidation.set(cacheKey, result);
180
185
  return result;
181
186
  }
187
+ // no exception,so everything seems to be fine
182
188
  const result = { isValid: true, errorMessage: '' };
183
189
  this.cacheAggregatedBooleanValidation.set(cacheKey, result);
184
190
  return result;
@@ -208,7 +214,7 @@ class QueryLanguageService {
208
214
  }
209
215
  try {
210
216
  const evaluationResult = this.evaluateAggregatedScalarExpression(expression, module);
211
- if (evaluationResult.type !== 'aggregation') {
217
+ if (evaluationResult.type !== 'aggregationScalar') {
212
218
  const result = {
213
219
  isValid: false,
214
220
  errorMessage: 'provided AggregatedScalar expression does not evaluate to a supported aggregation',
@@ -230,12 +236,36 @@ class QueryLanguageService {
230
236
  return result;
231
237
  }
232
238
  }
239
+ computeAggregatedBooleanValue(expression, module) {
240
+ const booleanAggregationParameter = this.evaluateAggregatedBooleanExpression(expression, module);
241
+ const aggregatedScalarExpressionEvaluation = booleanAggregationParameter.scalarAggregation.value;
242
+ const aggregatedScalarLiveValue = new AggregatedScalarLiveValue_1.AggregatedScalarLiveValue({ aggregatedScalarExpressionEvaluation }, module, this.adaptableApi);
243
+ const allAggregationValues = aggregatedScalarLiveValue.getAllAggregationValues();
244
+ const numericOperand = booleanAggregationParameter.conditionValue;
245
+ const booleanConditionFn = booleanAggregationParameter.conditionFn;
246
+ return allAggregationValues.some((aggregationValue) => {
247
+ return booleanConditionFn(aggregationValue, numericOperand);
248
+ });
249
+ }
233
250
  getColumnsFromExpression(input = '') {
234
251
  return this.getNodesFromExpression(input, 'COL');
235
252
  }
236
253
  getNamedQueryNamesFromExpression(input = '') {
237
254
  return this.getNodesFromExpression(input, 'QUERY');
238
255
  }
256
+ isCumulativeAggregate(input) {
257
+ var _a;
258
+ return !!((_a = this.getNodesFromExpression(input, 'CUMUL')) === null || _a === void 0 ? void 0 : _a.length);
259
+ }
260
+ getExpressionWithColumnFriendlyNames(expression = '') {
261
+ let result = expression;
262
+ const columnIds = this.getColumnsFromExpression(expression);
263
+ columnIds.forEach((columnId) => {
264
+ const columnFriendlyName = this.adaptableApi.columnApi.getFriendlyNameFromColumnId(columnId);
265
+ result = result.split(columnId).join(columnFriendlyName);
266
+ });
267
+ return result;
268
+ }
239
269
  // Returns the ExpressionFunctions available for the given Module as specified in the `QueryLanguageOptions.moduleExpressionFunctions`
240
270
  // if there are no specific functions defined, it falls back to the default values
241
271
  getModuleExpressionFunctions(module) {
@@ -276,8 +306,16 @@ class QueryLanguageService {
276
306
  this.cacheModuleSpecificExpressionFunctions.set(module, moduleSpecificFunctions);
277
307
  return moduleSpecificFunctions;
278
308
  }
279
- destroy() {
280
- // TO DO
309
+ evaluateCustomQueryVariable(functionName, args) {
310
+ var _a, _b, _c;
311
+ const context = {
312
+ adaptableApi: this.adaptableApi,
313
+ args,
314
+ };
315
+ const customQueryVariableDefinition = (_c = (_b = (_a = this.adaptableApi.internalApi.getAdaptableOptions().adaptableQLOptions) === null || _a === void 0 ? void 0 : _a.expressionOptions) === null || _b === void 0 ? void 0 : _b.customQueryVariable) === null || _c === void 0 ? void 0 : _c[functionName];
316
+ return typeof customQueryVariableDefinition === 'function'
317
+ ? customQueryVariableDefinition(context)
318
+ : customQueryVariableDefinition;
281
319
  }
282
320
  getBooleanAndScalarFunctions(moduleExpressionFunctions) {
283
321
  return Object.assign(Object.assign({}, moduleExpressionFunctions.booleanFunctions), moduleExpressionFunctions.scalarFunctions);
@@ -286,23 +324,28 @@ class QueryLanguageService {
286
324
  return `${module}::${expression}`;
287
325
  }
288
326
  getNodesFromExpression(input, nodeType) {
289
- const resultSet = new Set();
290
- // @ts-ignore
291
- const walk = (node) => {
292
- if (typeof node !== 'object') {
293
- return false;
294
- }
295
- if (Array.isArray(node)) {
296
- return node.map(walk);
297
- }
298
- node.args.map(walk);
299
- if (node.type === nodeType) {
300
- resultSet.add(String(node.args[0]));
301
- }
302
- };
303
- const { ast } = parser.parse(input.trim());
304
- walk(ast);
305
- return Array.from(resultSet.values());
327
+ try {
328
+ const resultSet = new Set();
329
+ // @ts-ignore
330
+ const walk = (node) => {
331
+ if (typeof node !== 'object') {
332
+ return false;
333
+ }
334
+ if (Array.isArray(node)) {
335
+ return node.map(walk);
336
+ }
337
+ node.args.map(walk);
338
+ if (node.type === nodeType) {
339
+ resultSet.add(String(node.args[0]));
340
+ }
341
+ };
342
+ const { ast } = parser.parse(input.trim());
343
+ walk(ast);
344
+ return Array.from(resultSet.values());
345
+ }
346
+ catch (e) {
347
+ return [];
348
+ }
306
349
  }
307
350
  }
308
351
  exports.QueryLanguageService = QueryLanguageService;