@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
@@ -8,9 +8,9 @@ const CalculatedColumnRedux = tslib_1.__importStar(require("../Redux/ActionsRedu
8
8
  const LoggingHelper_1 = require("../Utilities/Helpers/LoggingHelper");
9
9
  const getExpressionViewItems_1 = require("./Utilities/getExpressionViewItems");
10
10
  const CalculatedColumnWizard_1 = require("../View/CalculatedColumn/Wizard/CalculatedColumnWizard");
11
- const getCalculatedColumnSettingTags_1 = require("../View/CalculatedColumn/Utilities/getCalculatedColumnSettingTags");
12
11
  const ArrayExtensions_1 = tslib_1.__importDefault(require("../Utilities/Extensions/ArrayExtensions"));
13
12
  const getObjectTagsViewItems_1 = require("./Utilities/getObjectTagsViewItems");
13
+ const getCalculatedColumnSettingsTags_1 = require("../View/CalculatedColumn/Utilities/getCalculatedColumnSettingsTags");
14
14
  class CalculatedColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
15
15
  constructor(api) {
16
16
  super(ModuleConstants.CalculatedColumnModuleId, ModuleConstants.CalculatedColumnFriendlyName, 'calculated-column', 'CalculatedColumnPopup', 'Create bespoke columns whose cell value is derived dynamically from an Expression', api);
@@ -69,7 +69,7 @@ class CalculatedColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
69
69
  };
70
70
  }
71
71
  toView(calculateColumn) {
72
- const settingsTags = getCalculatedColumnSettingTags_1.getCalculatedColumnSettingTags(calculateColumn.CalculatedColumnSettings);
72
+ const settingsTags = getCalculatedColumnSettingsTags_1.getCalculatedColumnSettingsTags(calculateColumn.CalculatedColumnSettings);
73
73
  let items = [
74
74
  {
75
75
  name: 'Settings',
@@ -81,7 +81,7 @@ class CalculatedColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
81
81
  label: 'Column Name',
82
82
  values: [calculateColumn.FriendlyName],
83
83
  },
84
- getExpressionViewItems_1.getExpressionViewItems(calculateColumn.Query),
84
+ getExpressionViewItems_1.getExpressionViewItems(calculateColumn.Query, this.api),
85
85
  ].filter(Boolean);
86
86
  if (ArrayExtensions_1.default.IsNotNullOrEmpty(settingsTags)) {
87
87
  items.push({
@@ -12,7 +12,6 @@ export declare class ExportModule extends AdaptableModuleBase implements IExport
12
12
  getModuleAdaptableObjects(): AdaptableObject[];
13
13
  getExplicitlyReferencedColumnIds(report: Report): string[];
14
14
  getReferencedNamedQueryNames(report: Report): string[];
15
- updateOldConfig(): void;
16
15
  addContextMenuItems(menuContext: ContextMenuContext): AdaptableMenuItem[] | undefined;
17
16
  export(report: Report, exportDestination: ExportDestination | string): void;
18
17
  private isCustomDestination;
@@ -9,7 +9,6 @@ const Helper_1 = require("../Utilities/Helpers/Helper");
9
9
  const ExportRedux = tslib_1.__importStar(require("../Redux/ActionsReducers/ExportRedux"));
10
10
  const GeneralConstants_1 = require("../Utilities/Constants/GeneralConstants");
11
11
  const ArrayExtensions_1 = tslib_1.__importDefault(require("../Utilities/Extensions/ArrayExtensions"));
12
- const LoggingHelper_1 = require("../Utilities/Helpers/LoggingHelper");
13
12
  const StringExtensions_1 = tslib_1.__importDefault(require("../Utilities/Extensions/StringExtensions"));
14
13
  const PopupRedux = tslib_1.__importStar(require("../Redux/ActionsReducers/PopupRedux"));
15
14
  const ObjectFactory_1 = require("../Utilities/ObjectFactory");
@@ -41,21 +40,6 @@ class ExportModule extends AdaptableModuleBase_1.AdaptableModuleBase {
41
40
  }
42
41
  return this.api.queryApi.getReferencedNamedQueryNames(report.Query.BooleanExpression);
43
42
  }
44
- updateOldConfig() {
45
- let reportsToEdit = [];
46
- this.api.exportApi.getAllReports().forEach((report) => {
47
- if (!report.Query && report.Expression) {
48
- report.Query = {
49
- BooleanExpression: report.Expression,
50
- };
51
- LoggingHelper_1.LogAdaptableWarning(`Updating incorrect Predefined Config for Report: ${report.Name}`);
52
- report.Expression = undefined;
53
- LoggingHelper_1.LogAdaptableInfo('Updating Report: ' + report.Name + ' to use existing Expression');
54
- reportsToEdit.push(report);
55
- }
56
- });
57
- this.api.exportApi.editReports(reportsToEdit);
58
- }
59
43
  addContextMenuItems(menuContext) {
60
44
  const canExport = !menuContext.isRowGroupColumn &&
61
45
  this.isModuleAvailable() &&
@@ -111,6 +111,12 @@ class FilterModule extends AdaptableModuleBase_1.AdaptableModuleBase {
111
111
  getViewProperties() {
112
112
  const api = this.api;
113
113
  return {
114
+ getSuspendAction: (columnFilter) => LayoutRedux.LayoutColumnFilterSuspend(columnFilter),
115
+ getUnSuspendAction: (columnFilter) => LayoutRedux.LayoutColumnFilterUnSuspend(columnFilter),
116
+ getCompactSuspendAction: (columnFilter) => LayoutRedux.LayoutColumnFilterSuspend(columnFilter),
117
+ getCompactUnSuspendAction: (columnFilter) => LayoutRedux.LayoutColumnFilterUnSuspend(columnFilter),
118
+ getSuspendAllAction: () => LayoutRedux.LayoutColumnFilterSuspendAll(),
119
+ getUnSuspendAllAction: () => LayoutRedux.LayoutColumnFilterUnSuspendAll(),
114
120
  getDeleteAction: LayoutRedux.LayoutColumnFilterClear,
115
121
  getCompactDeleteAction: LayoutRedux.LayoutColumnFilterClear,
116
122
  getDeleteAllAction: LayoutRedux.LayoutColumnFilterClearAll,
@@ -93,6 +93,10 @@ export interface AdaptableModuleView {
93
93
  getCompactDeleteAction?: (abObject: AdaptableObject) => Redux.Action;
94
94
  getSuspendAction?: (abObject: AdaptableObject) => Redux.Action;
95
95
  getUnSuspendAction?: (abObject: AdaptableObject) => Redux.Action;
96
+ getCompactSuspendAction?: (abObject: AdaptableObject) => Redux.Action;
97
+ getCompactUnSuspendAction?: (abObject: AdaptableObject) => Redux.Action;
98
+ getSuspendAllAction?: () => Redux.Action;
99
+ getUnSuspendAllAction?: () => Redux.Action;
96
100
  getDeleteAllAction?: () => Redux.Action;
97
101
  emptyView?: React.FunctionComponent<{
98
102
  module: IModule;
@@ -14,6 +14,7 @@ const SaveLayoutButton_1 = require("../View/Layout/SaveLayoutButton");
14
14
  const LayoutWizard_1 = require("../View/Layout/Wizard/LayoutWizard");
15
15
  const getLayoutFilterViewItems_1 = require("./Utilities/Layout/getLayoutFilterViewItems");
16
16
  const getLayoutSortViewItems_1 = require("./Utilities/Layout/getLayoutSortViewItems");
17
+ const AggregationColumns_1 = require("../PredefinedConfig/Common/AggregationColumns");
17
18
  class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
18
19
  constructor(api) {
19
20
  super(ModuleConstants.LayoutModuleId, ModuleConstants.LayoutFriendlyName, 'layout', 'LayoutPopup', 'Named sets of column visibility, order, groupings, aggregation, pivots etc.', api);
@@ -26,26 +27,6 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
26
27
  }
27
28
  });
28
29
  }
29
- /*
30
- // commenting this out as it doesnt make sense we dont know which filters should be applied to which layout
31
- // for this we will jsut say they need to reapply them
32
- updateOldConfig() {
33
- // @ts-ignore ignore reading deprecated state
34
- const oldColumnFilters = this.api.filterApi.getFilterState().ColumnFilters;
35
- if (ArrayExtensions.IsNotNullOrEmpty(oldColumnFilters)) {
36
- ConsoleLogWarning(
37
- `DEPRECATED: The 'Filter.ColumnFilters' property is deprecated; use 'Layout.ColumnFilters' instead'!`
38
- );
39
-
40
- this.api.internalApi.clearColumnFilterState();
41
- const currentLayout = this.api.layoutApi.getCurrentLayout();
42
-
43
- if (ArrayExtensions.IsNullOrEmpty(currentLayout.ColumnFilters)) {
44
- this.api.layoutApi.setColumnFilter(oldColumnFilters);
45
- }
46
- }
47
- }
48
- */
49
30
  getModuleAdaptableObjects() {
50
31
  return this.api.layoutApi.getAllLayout();
51
32
  }
@@ -264,6 +245,25 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
264
245
  name: 'Pivot Columns',
265
246
  values: layout.PivotColumns.map((colId) => columnIdToFriendlyName(colId)),
266
247
  },
248
+ (layout === null || layout === void 0 ? void 0 : layout.AggregationColumns) &&
249
+ Object.keys(layout === null || layout === void 0 ? void 0 : layout.AggregationColumns).length && {
250
+ name: 'Aggregation Columns',
251
+ values: Object.entries(layout === null || layout === void 0 ? void 0 : layout.AggregationColumns)
252
+ .map(([colId, aggFn]) => {
253
+ if (colId === 'Source' || colId === 'Uuid') {
254
+ return '';
255
+ }
256
+ let aggFnName = '';
257
+ if (typeof aggFn === 'string') {
258
+ aggFnName = aggFn;
259
+ }
260
+ else if (typeof aggFn === 'object' && aggFn.type === 'weightedAverage') {
261
+ aggFnName = AggregationColumns_1.WEIGHTED_AVERAGE_AGG_FN_NAME;
262
+ }
263
+ return `${aggFnName}(${columnIdToFriendlyName(colId)})`;
264
+ })
265
+ .filter(Boolean),
266
+ },
267
267
  ].filter(Boolean),
268
268
  abObject: layout,
269
269
  };
@@ -38,7 +38,7 @@ class QueryModule extends AdaptableModuleBase_1.AdaptableModuleBase {
38
38
  },
39
39
  {
40
40
  name: 'Expression',
41
- values: [query.BooleanExpression],
41
+ values: [this.api.internalApi.getAdaptableQueryExpressionText(query)],
42
42
  },
43
43
  getObjectTagsViewItems_1.getObjectTagsViewItems(query, this.api),
44
44
  ],
@@ -2,19 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getExportRowsViewItems = void 0;
4
4
  const getExportRowsViewItems = (report, api) => {
5
- var _a;
6
- const values = [];
7
- switch (report.ReportRowScope) {
8
- case 'AllRows':
9
- values.push('All Rows');
10
- break;
11
- case 'VisibleRows':
12
- values.push('Visible Rows');
13
- break;
14
- case 'ExpressionRows':
15
- values.push((_a = report.Query) === null || _a === void 0 ? void 0 : _a.BooleanExpression);
16
- break;
17
- }
18
5
  return {
19
6
  name: 'Rows',
20
7
  values: [
@@ -6,6 +6,21 @@ const React = tslib_1.__importStar(require("react"));
6
6
  const rebass_1 = require("rebass");
7
7
  const FormatColumnStyleWizardSection_1 = require("../../../View/FormatColumn/Wizard/FormatColumnStyleWizardSection");
8
8
  const getFormatColumnStyleViewItems = (formatColumn, api) => {
9
- return React.createElement(rebass_1.Box, { mt: 2 }, FormatColumnStyleWizardSection_1.renderFormatColumnStyleSummary(formatColumn, api));
9
+ var _a, _b;
10
+ let styleType = '';
11
+ if ((_a = formatColumn === null || formatColumn === void 0 ? void 0 : formatColumn.ColumnStyle) === null || _a === void 0 ? void 0 : _a.GradientStyle) {
12
+ styleType = 'Gradient';
13
+ }
14
+ else if ((_b = formatColumn === null || formatColumn === void 0 ? void 0 : formatColumn.ColumnStyle) === null || _b === void 0 ? void 0 : _b.PercentBarStyle) {
15
+ styleType = 'Percent Bar';
16
+ }
17
+ else {
18
+ styleType = 'Standard';
19
+ }
20
+ return (React.createElement(rebass_1.Box, { mt: 2 },
21
+ React.createElement(rebass_1.Box, { mb: 1 },
22
+ "Type: ",
23
+ styleType),
24
+ FormatColumnStyleWizardSection_1.renderFormatColumnStyleSummary(formatColumn, api)));
10
25
  };
11
26
  exports.getFormatColumnStyleViewItems = getFormatColumnStyleViewItems;
@@ -8,17 +8,21 @@ const getLayoutFilterViewItems = (layout, api) => {
8
8
  };
9
9
  return {
10
10
  name: 'Filter',
11
- values: ((_a = layout.ColumnFilters) !== null && _a !== void 0 ? _a : []).map((customFilter) => `[${columnIdToFriendlyName(customFilter.ColumnId)}: ${customFilter.Predicate.PredicateId} ${customFilter.Predicate.Inputs.map((input) => {
12
- if (typeof input === 'string') {
13
- return input;
14
- }
15
- if (typeof (input === null || input === void 0 ? void 0 : input.toString) === 'function') {
16
- return input.toString();
17
- }
18
- return '';
19
- })
20
- .filter(Boolean)
21
- .join(', ')}]`),
11
+ values: ((_a = layout.ColumnFilters) !== null && _a !== void 0 ? _a : []).map((customFilter) => {
12
+ var _a, _b;
13
+ return `[${columnIdToFriendlyName(customFilter.ColumnId)}: ${customFilter.Predicate.PredicateId} ${((_b = (_a = customFilter.Predicate) === null || _a === void 0 ? void 0 : _a.Inputs) !== null && _b !== void 0 ? _b : [])
14
+ .map((input) => {
15
+ if (typeof input === 'string') {
16
+ return input;
17
+ }
18
+ if (typeof (input === null || input === void 0 ? void 0 : input.toString) === 'function') {
19
+ return input.toString();
20
+ }
21
+ return '';
22
+ })
23
+ .filter(Boolean)
24
+ .join(', ')}]`;
25
+ }),
22
26
  };
23
27
  };
24
28
  exports.getLayoutFilterViewItems = getLayoutFilterViewItems;
@@ -1,5 +1,4 @@
1
1
  import { AdaptableCalculatedColumnQuery } from '../../PredefinedConfig/CalculatedColumnState';
2
- export declare const getExpressionViewItems: (query: AdaptableCalculatedColumnQuery) => {
3
- name: string;
4
- values: string[];
5
- };
2
+ import { AdaptableApi } from '../../Api/AdaptableApi';
3
+ import { AdaptableObjectItemView } from '../Interface/IModule';
4
+ export declare const getExpressionViewItems: (query: AdaptableCalculatedColumnQuery, api: AdaptableApi) => AdaptableObjectItemView;
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getExpressionViewItems = void 0;
4
- const getExpressionViewItems = (query) => {
5
- var _a;
4
+ const getExpressionViewItems = (query, api) => {
5
+ const expressionText = api.internalApi.getAdaptableQueryExpressionText(query);
6
6
  return {
7
7
  name: 'Expression',
8
- values: [(_a = query === null || query === void 0 ? void 0 : query.ScalarExpression) !== null && _a !== void 0 ? _a : query === null || query === void 0 ? void 0 : query.AggregatedScalarExpression],
8
+ values: [expressionText],
9
9
  };
10
10
  };
11
11
  exports.getExpressionViewItems = getExpressionViewItems;
@@ -7,7 +7,7 @@ const getRuleViewItems = (rule, api) => {
7
7
  values: [
8
8
  rule.Predicate
9
9
  ? api.predicateApi.predicateToString(rule.Predicate)
10
- : api.queryLanguageApi.getAdaptableQueryExpression(rule),
10
+ : api.internalApi.getAdaptableQueryExpressionText(rule),
11
11
  ],
12
12
  };
13
13
  };
@@ -5,6 +5,7 @@ export declare const ScalarQueryDocsLink: string;
5
5
  export declare const ObservableQueryDocsLink: string;
6
6
  export declare const AggregatedBooleanQueryDocsLink: string;
7
7
  export declare const AggregatedScalarQueryDocsLink: string;
8
+ export declare const CumulativeAggregatedScalarQueryDocsLink: string;
8
9
  export declare const PredicateDocsLink: string;
9
10
  export declare const PrimaryKeyDocsLink: string;
10
11
  export declare const LicenseDocsLink: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AdaptableOptionsDocsLink = exports.LicenseDocsLink = exports.PrimaryKeyDocsLink = exports.PredicateDocsLink = exports.AggregatedScalarQueryDocsLink = exports.AggregatedBooleanQueryDocsLink = exports.ObservableQueryDocsLink = exports.ScalarQueryDocsLink = exports.BooleanQueryDocsLink = exports.ExpressionEditorDocsLink = exports.HOST_URL_DOCS = void 0;
3
+ exports.AdaptableOptionsDocsLink = exports.LicenseDocsLink = exports.PrimaryKeyDocsLink = exports.PredicateDocsLink = exports.CumulativeAggregatedScalarQueryDocsLink = exports.AggregatedScalarQueryDocsLink = exports.AggregatedBooleanQueryDocsLink = exports.ObservableQueryDocsLink = exports.ScalarQueryDocsLink = exports.BooleanQueryDocsLink = exports.ExpressionEditorDocsLink = exports.HOST_URL_DOCS = void 0;
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`;
@@ -9,6 +9,7 @@ exports.ScalarQueryDocsLink = `${exports.HOST_URL_DOCS}/guide/adaptable-ql-expre
9
9
  exports.ObservableQueryDocsLink = `${exports.HOST_URL_DOCS}/guide/adaptable-ql-expression-observable`;
10
10
  exports.AggregatedBooleanQueryDocsLink = `${exports.HOST_URL_DOCS}/guide/adaptable-ql-expression-aggregation-boolean`;
11
11
  exports.AggregatedScalarQueryDocsLink = `${exports.HOST_URL_DOCS}/guide/adaptable-ql-expression-aggregation-scalar`;
12
+ exports.CumulativeAggregatedScalarQueryDocsLink = `${exports.HOST_URL_DOCS}/guide/adaptable-ql-expression-aggregation-scalar#cumulative-aggregation`;
12
13
  exports.PredicateDocsLink = `${exports.HOST_URL_DOCS}/guide/adaptable-ql-predicate`;
13
14
  exports.PrimaryKeyDocsLink = `${exports.HOST_URL_DOCS}/guide/dev-guide-tutorial-primary-key`;
14
15
  exports.LicenseDocsLink = `${exports.HOST_URL_DOCS}/guide/licensing`;
@@ -62,6 +62,7 @@ exports.DefaultAdaptableOptions = {
62
62
  caseSensitiveTextComparisons: false,
63
63
  externallyEvaluatedModules: [],
64
64
  customPredicateDefs: [],
65
+ displayColumnFriendlyNamesForExpressions: true,
65
66
  expressionOptions: {
66
67
  defaultBooleanFunctions: booleanExpressionFunctions_1.booleanExpressionFunctions,
67
68
  defaultScalarFunctions: scalarExpressionFunctions_1.scalarExpressionFunctions,
@@ -206,6 +207,8 @@ exports.DefaultAdaptableOptions = {
206
207
  systemFilters: AdaptablePredicate_1.SystemFilterPredicateIds,
207
208
  showQuickFilter: true,
208
209
  showDistinctFilteredValuesOnly: false,
210
+ showClearFilterButton: false,
211
+ showSuspendFilterButton: false,
209
212
  },
210
213
  searchOptions: {
211
214
  excludeColumnFromQuickSearch: undefined,
@@ -1,9 +1,19 @@
1
1
  import { ExpressionFunction } from '../../parser/src/types';
2
+ import { BaseParameter } from './expressionFunctionUtils';
3
+ import { AggregatedScalarExpressionEvaluation } from './aggregatedScalarExpressionFunctions';
2
4
  /**
3
5
  * List of all the Aggregation Functions available in AdaptableQL
4
6
  */
5
- export declare type AggregationFunctionName = 'WHERE' | 'COL' | AggregationFunction | ComparisonFunction;
6
- declare type AggregationFunction = 'SUM';
7
+ export declare type AggregationFunctionName = 'WHERE' | 'COL' | 'GROUP_BY' | AggregationFunction | ComparisonFunction;
8
+ declare type AggregationFunction = 'SUM' | 'MIN' | 'MAX' | 'AVG';
7
9
  declare type ComparisonFunction = 'EQ' | 'NEQ' | 'LT' | 'GT' | 'LTE' | 'GTE';
10
+ export interface BooleanAggregationParameter extends BaseParameter<'aggregationBoolean', AggregationFunction> {
11
+ scalarAggregation: ScalarAggregationOperand;
12
+ conditionValue: number;
13
+ conditionFn: (aggregatedValue: number, conditionValue: number) => boolean;
14
+ }
15
+ export interface ScalarAggregationOperand extends BaseParameter<'aggregationScalar', AggregationFunction> {
16
+ value: AggregatedScalarExpressionEvaluation;
17
+ }
8
18
  export declare const aggregatedBooleanExpressionFunctions: Record<AggregationFunctionName, ExpressionFunction>;
9
19
  export {};
@@ -2,13 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.aggregatedBooleanExpressionFunctions = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const rxjs_1 = require("rxjs");
6
5
  const parseInt_1 = tslib_1.__importDefault(require("lodash/parseInt"));
7
6
  const ExpressionEvaluationError_1 = require("../../parser/src/ExpressionEvaluationError");
8
- const operators_1 = require("rxjs/operators");
9
7
  const expressionFunctionUtils_1 = require("./expressionFunctionUtils");
8
+ const aggregatedScalarExpressionFunctions_1 = require("./aggregatedScalarExpressionFunctions");
9
+ const SUPPORTED_AGGREGATION_FNS = ['SUM', 'MIN', 'MAX', 'AVG'];
10
10
  const aggregationScalarOperandMap = {
11
11
  SUM: ['string', 'number'],
12
+ MIN: ['string', 'number'],
13
+ MAX: ['string', 'number'],
14
+ AVG: ['string', 'number'],
12
15
  };
13
16
  // 0. optional non-capturing block of empty spaces
14
17
  // 1. block containing a numeric value (any digits) (required)
@@ -25,23 +28,11 @@ exports.aggregatedBooleanExpressionFunctions = {
25
28
  examples: ['<main_query> WHERE <boolean_query>', '<main_query> WHERE QUERY("abc")'],
26
29
  hasEagerEvaluation: true,
27
30
  },
28
- SUM: {
29
- handler(args, context) {
30
- const columnParameter = expressionFunctionUtils_1.extractColumnParameter('SUM', args);
31
- expressionFunctionUtils_1.validateColumnType(columnParameter.value, ['Number'], 'SUM', context.adaptableApi);
32
- const sumAggregationFn = (dataSource$) => getSumAggregation$(dataSource$, getColumnValueSum(columnParameter.value, context));
33
- const result = {
34
- type: 'aggregation',
35
- name: 'SUM',
36
- column: columnParameter.value,
37
- aggregationFn: sumAggregationFn,
38
- };
39
- return result;
40
- },
41
- description: 'Aggregates a column over multiple rows by summing up the column values',
42
- signatures: ['SUM( [colName] )', 'SUM( COL(name: string) )'],
43
- examples: ['SUM( [colA] )', "SUM( COL('col1') )"],
44
- },
31
+ SUM: aggregatedScalarExpressionFunctions_1.aggregatedScalarExpressionFunctions['SUM'],
32
+ MIN: aggregatedScalarExpressionFunctions_1.aggregatedScalarExpressionFunctions['MIN'],
33
+ MAX: aggregatedScalarExpressionFunctions_1.aggregatedScalarExpressionFunctions['MAX'],
34
+ AVG: aggregatedScalarExpressionFunctions_1.aggregatedScalarExpressionFunctions['AVG'],
35
+ GROUP_BY: aggregatedScalarExpressionFunctions_1.aggregatedScalarExpressionFunctions['GROUP_BY'],
45
36
  COL: {
46
37
  handler(args, context) {
47
38
  return expressionFunctionUtils_1.handleColumnFunction(args, context);
@@ -52,7 +43,7 @@ exports.aggregatedBooleanExpressionFunctions = {
52
43
  },
53
44
  EQ: {
54
45
  handler(args, context) {
55
- return handleAggregationCondition(args, context, '=', (aggregatedValue, conditionValue) => aggregatedValue === conditionValue);
46
+ return buildBooleanAggregationParameter(args, context, '=', (aggregatedValue, conditionValue) => aggregatedValue === conditionValue);
56
47
  },
57
48
  isHiddenFromMenu: true,
58
49
  description: 'Evaluates if the aggregation result equals a numerical value defined either as a number or a string abbreviation for thousands(K), millions(M) or billions(B)',
@@ -66,7 +57,7 @@ exports.aggregatedBooleanExpressionFunctions = {
66
57
  },
67
58
  NEQ: {
68
59
  handler(args, context) {
69
- return handleAggregationCondition(args, context, '!=', (aggregatedValue, conditionValue) => aggregatedValue !== conditionValue);
60
+ return buildBooleanAggregationParameter(args, context, '!=', (aggregatedValue, conditionValue) => aggregatedValue !== conditionValue);
70
61
  },
71
62
  isHiddenFromMenu: true,
72
63
  description: 'Evaluates if the aggregation result is NOT equal with a numerical value defined either as a number or a string abbreviation for thousands(K), millions(M) or billions(B)',
@@ -80,7 +71,7 @@ exports.aggregatedBooleanExpressionFunctions = {
80
71
  },
81
72
  LT: {
82
73
  handler(args, context) {
83
- return handleAggregationCondition(args, context, '<', (aggregatedValue, conditionValue) => aggregatedValue < conditionValue);
74
+ return buildBooleanAggregationParameter(args, context, '<', (aggregatedValue, conditionValue) => aggregatedValue < conditionValue);
84
75
  },
85
76
  isHiddenFromMenu: true,
86
77
  description: 'Evaluates if the aggregation result is less than a numerical value defined either as a number or a string abbreviation for thousands(K), millions(M) or billions(B)',
@@ -94,7 +85,7 @@ exports.aggregatedBooleanExpressionFunctions = {
94
85
  },
95
86
  LTE: {
96
87
  handler(args, context) {
97
- return handleAggregationCondition(args, context, '<=', (aggregatedValue, conditionValue) => aggregatedValue <= conditionValue);
88
+ return buildBooleanAggregationParameter(args, context, '<=', (aggregatedValue, conditionValue) => aggregatedValue <= conditionValue);
98
89
  },
99
90
  isHiddenFromMenu: true,
100
91
  description: 'Evaluates if the aggregation result is less than or equals a numerical value defined either as a number or a string abbreviation for thousands(K), millions(M) or billions(B)',
@@ -108,7 +99,7 @@ exports.aggregatedBooleanExpressionFunctions = {
108
99
  },
109
100
  GT: {
110
101
  handler(args, context) {
111
- return handleAggregationCondition(args, context, '>', (aggregatedValue, conditionValue) => aggregatedValue > conditionValue);
102
+ return buildBooleanAggregationParameter(args, context, '>', (aggregatedValue, conditionValue) => aggregatedValue > conditionValue);
112
103
  },
113
104
  isHiddenFromMenu: true,
114
105
  description: 'Evaluates if the aggregation result is greater than a numerical value defined either as a number or a string abbreviation for thousands(K), millions(M) or billions(B)',
@@ -122,7 +113,7 @@ exports.aggregatedBooleanExpressionFunctions = {
122
113
  },
123
114
  GTE: {
124
115
  handler(args, context) {
125
- return handleAggregationCondition(args, context, '>=', (aggregatedValue, conditionValue) => aggregatedValue >= conditionValue);
116
+ return buildBooleanAggregationParameter(args, context, '>=', (aggregatedValue, conditionValue) => aggregatedValue >= conditionValue);
126
117
  },
127
118
  isHiddenFromMenu: true,
128
119
  description: 'Evaluates if the aggregation result is greater than or equals a numerical value defined either as a number or a string abbreviation for thousands(K), millions(M) or billions(B)',
@@ -135,24 +126,25 @@ exports.aggregatedBooleanExpressionFunctions = {
135
126
  examples: [`SUM([col1]) >= '5M'`, 'GTE( SUM([col1]), 250000)'],
136
127
  },
137
128
  };
138
- const handleAggregationCondition = (args, context, comparisonOperator, conditionFn) => {
129
+ const buildBooleanAggregationParameter = (args, context, comparisonOperator, conditionFn) => {
139
130
  // LHS
140
- const aggregationOperand = extractAggregationOperand(comparisonOperator, ['SUM'], args[0]);
131
+ const aggregationOperand = extractScalarAggregationOperand(comparisonOperator, args[0]);
141
132
  // RHS
142
133
  const scalarOperand = extractScalarOperand(comparisonOperator, args[1], aggregationScalarOperandMap[aggregationOperand.name]);
143
- let dataChangeLog$ = expressionFunctionUtils_1.getDataChangeLog$(context, aggregationOperand.column);
144
- const aggregatedValue$ = aggregationOperand.aggregationFn(dataChangeLog$);
145
- return dataChangeLog$.pipe(operators_1.withLatestFrom(aggregatedValue$), operators_1.filter(([_, currentAggregationValue]) => {
146
- // check if new aggregated value satisfies the criteria
147
- return conditionFn(currentAggregationValue, scalarOperand);
148
- }), operators_1.map(([source]) => source));
134
+ return {
135
+ type: 'aggregationBoolean',
136
+ name: aggregationOperand.name,
137
+ scalarAggregation: aggregationOperand,
138
+ conditionValue: scalarOperand,
139
+ conditionFn,
140
+ };
149
141
  };
150
- const extractAggregationOperand = (consumingFunctionName, allowedAggregations, argument) => {
142
+ const extractScalarAggregationOperand = (consumingFunctionName, argument) => {
151
143
  const result = argument;
152
- if (argument == undefined ||
153
- argument.type !== 'aggregation' ||
154
- !allowedAggregations.includes(argument.name)) {
155
- throw new ExpressionEvaluationError_1.ExpressionEvaluationError(consumingFunctionName, `comparison operator expects as a left-hand operand an aggregation function of type '${allowedAggregations.join(' | ')}'`);
144
+ if (result == undefined ||
145
+ result.type !== 'aggregationScalar' ||
146
+ !SUPPORTED_AGGREGATION_FNS.includes(result.name)) {
147
+ throw new ExpressionEvaluationError_1.ExpressionEvaluationError(consumingFunctionName, `comparison operator expects as a left-hand operand an aggregation function of type '${SUPPORTED_AGGREGATION_FNS.join(' | ')}'`);
156
148
  }
157
149
  return result;
158
150
  };
@@ -182,31 +174,3 @@ const extractScalarOperand = (consumingFunctionName, value, allowedTypes) => {
182
174
  // numeric value
183
175
  return parseInt_1.default(numericString) * numberUnitRatios[largeNumberUnit.toLowerCase()];
184
176
  };
185
- const getSumAggregation$ = (source$, initialSum) => {
186
- return rxjs_1.defer(() => {
187
- let sumValue = initialSum;
188
- const updateSum = (dataChangeLog) => {
189
- const oldValue = expressionFunctionUtils_1.getNumericValue(dataChangeLog.oldValue);
190
- const newValue = expressionFunctionUtils_1.getNumericValue(dataChangeLog.newValue);
191
- sumValue = sumValue - oldValue + newValue;
192
- };
193
- return source$.pipe(operators_1.tap((dataChangeLog) => updateSum(dataChangeLog)), operators_1.map(() => sumValue));
194
- });
195
- };
196
- const getColumnValueSum = (column, context) => {
197
- let sum = 0;
198
- context.adaptableApi.internalApi.forAllRowNodesDo((rowNode) => {
199
- // if there is a WHERE clause defined, check if the current rowNode satisfies the condition
200
- if (context.filterFn && !context.filterFn(rowNode)) {
201
- return;
202
- }
203
- if (context.adaptableApi.gridApi.isGroupRowNode(rowNode)) {
204
- return;
205
- }
206
- const cellValue = context.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, column);
207
- if (cellValue != undefined) {
208
- sum = sum + expressionFunctionUtils_1.getNumericValue(rowNode.data[column]);
209
- }
210
- });
211
- return sum;
212
- };
@@ -5,25 +5,41 @@ import { AggregateParams } from './scalarAggregationHelper';
5
5
  /**
6
6
  * List of all the AggregatedScalar Functions available in AdaptableQL
7
7
  */
8
- export declare type AggregatedScalarFunctionName = AggregationFunction | OperandFunction;
9
- declare type AggregationFunction = 'SUM' | 'PERCENTAGE' | 'QUANT' | 'AVG' | 'MIN' | 'MAX' | 'CUMUL';
10
- declare type OperandFunction = 'COL' | 'OVER' | 'GROUP_BY';
11
- export interface AggregationParameter extends BaseParameter<'aggregation', AggregationFunction> {
8
+ export declare type AggregatedScalarFunctionName = ScalarAggregationFunction | OperandFunction;
9
+ export declare type ScalarAggregationFunction = 'SUM' | 'PERCENTAGE' | 'QUANT' | 'AVG' | 'MIN' | 'MAX' | 'CUMUL';
10
+ declare type OperandFunction = 'COL' | 'OVER' | 'GROUP_BY' | 'WEIGHT';
11
+ export interface ScalarAggregationParameter extends BaseParameter<'aggregationScalar', ScalarAggregationFunction> {
12
12
  value: AggregatedScalarExpressionEvaluation;
13
13
  }
14
14
  export interface OverParameter extends BaseParameter<'operand', 'OVER'> {
15
15
  value: string;
16
16
  }
17
17
  export interface GroupByParameter extends BaseParameter<'operand', 'GROUP_BY'> {
18
+ value: string[];
19
+ }
20
+ export interface WeightParameter extends BaseParameter<'operand', 'WEIGHT'> {
18
21
  value: string;
19
22
  }
20
23
  export interface AggregatedScalarExpressionEvaluation {
21
24
  aggregationParams: AggregateParams<any, string | number>;
22
25
  rowValueGetter?: (rowNode: RowNode, aggregatedValue: any) => string | number | Date | boolean;
26
+ /**
27
+ * @deprecated remove this
28
+ */
23
29
  columnDependencies: string[];
24
- cumulateOver?: string;
30
+ context?: {
31
+ weightParam?: WeightParameter;
32
+ };
25
33
  sortByColumn?: string;
26
- filterUndefinedValues?: boolean;
34
+ rowFilterFn?: (rowNode: RowNode) => boolean;
35
+ }
36
+ export interface CumulatedAggregationValue {
37
+ currentValue: number;
38
+ cumulatedValues: Record<number | string, number>;
39
+ numberOfCumulatedValues?: number;
40
+ totalAggregationValue?: number;
27
41
  }
42
+ export declare const cumulativeAggregatedExpressionFunctions: AggregatedScalarFunctionName[];
43
+ export declare const aggregatedExpressionFunctions: AggregatedScalarFunctionName[];
28
44
  export declare const aggregatedScalarExpressionFunctions: Record<AggregatedScalarFunctionName, ExpressionFunction>;
29
45
  export {};