@adaptabletools/adaptable 12.1.6 → 12.1.8-canary.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/base.css +11 -49
  2. package/bundle.cjs.js +106 -106
  3. package/index.css +13 -60
  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 +2 -0
  8. package/src/AdaptableOptions/ColumnOptions.d.ts +2 -4
  9. package/src/AdaptableOptions/FilterOptions.d.ts +12 -0
  10. package/src/AdaptableOptions/FinancePluginOptions.d.ts +22 -1
  11. package/src/AdaptableOptions/StateOptions.d.ts +25 -12
  12. package/src/Api/ColumnApi.d.ts +5 -0
  13. package/src/Api/ExportApi.d.ts +5 -0
  14. package/src/Api/FilterApi.d.ts +23 -0
  15. package/src/Api/FlashingCellApi.d.ts +8 -0
  16. package/src/Api/GridApi.d.ts +1 -0
  17. package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
  18. package/src/Api/Implementation/ColumnApiImpl.js +5 -1
  19. package/src/Api/Implementation/ExportApiImpl.d.ts +3 -1
  20. package/src/Api/Implementation/ExportApiImpl.js +19 -3
  21. package/src/Api/Implementation/FilterApiImpl.d.ts +5 -0
  22. package/src/Api/Implementation/FilterApiImpl.js +35 -3
  23. package/src/Api/Implementation/FlashingCellApiImpl.d.ts +1 -0
  24. package/src/Api/Implementation/FlashingCellApiImpl.js +4 -0
  25. package/src/Api/Implementation/GridApiImpl.d.ts +1 -0
  26. package/src/Api/Implementation/InternalApiImpl.d.ts +0 -1
  27. package/src/Api/Implementation/InternalApiImpl.js +0 -3
  28. package/src/Api/Implementation/PredicateApiImpl.js +4 -0
  29. package/src/Api/Implementation/QueryLanguageApiImpl.js +9 -1
  30. package/src/Api/InternalApi.d.ts +0 -1
  31. package/src/Api/SystemStatusApi.d.ts +1 -1
  32. package/src/Api/ToolPanelApi.d.ts +1 -1
  33. package/src/PredefinedConfig/CalculatedColumnState.d.ts +2 -2
  34. package/src/PredefinedConfig/Common/AdaptablePredicate.js +30 -10
  35. package/src/PredefinedConfig/Common/AdaptableQuery.js +1 -1
  36. package/src/PredefinedConfig/Common/AggregationColumns.d.ts +6 -0
  37. package/src/PredefinedConfig/Common/AggregationColumns.js +4 -0
  38. package/src/PredefinedConfig/Common/ColumnFilter.d.ts +2 -2
  39. package/src/PredefinedConfig/Common/Enums.d.ts +0 -15
  40. package/src/PredefinedConfig/Common/Enums.js +1 -18
  41. package/src/PredefinedConfig/Common/SpecialColumnSettings.d.ts +6 -6
  42. package/src/PredefinedConfig/ExportState.d.ts +12 -4
  43. package/src/PredefinedConfig/LayoutState.d.ts +2 -1
  44. package/src/PredefinedConfig/PopupState.d.ts +1 -2
  45. package/src/Redux/ActionsReducers/AlertRedux.d.ts +1 -1
  46. package/src/Redux/ActionsReducers/AlertRedux.js +1 -1
  47. package/src/Redux/ActionsReducers/ConditionalStyleRedux.d.ts +1 -1
  48. package/src/Redux/ActionsReducers/ConditionalStyleRedux.js +1 -1
  49. package/src/Redux/ActionsReducers/CustomSortRedux.d.ts +1 -1
  50. package/src/Redux/ActionsReducers/CustomSortRedux.js +1 -1
  51. package/src/Redux/ActionsReducers/FlashingCellRedux.d.ts +1 -1
  52. package/src/Redux/ActionsReducers/FlashingCellRedux.js +1 -1
  53. package/src/Redux/ActionsReducers/FormatColumnRedux.d.ts +1 -1
  54. package/src/Redux/ActionsReducers/FormatColumnRedux.js +1 -1
  55. package/src/Redux/ActionsReducers/LayoutRedux.d.ts +28 -0
  56. package/src/Redux/ActionsReducers/LayoutRedux.js +80 -2
  57. package/src/Redux/ActionsReducers/PlusMinusRedux.d.ts +1 -1
  58. package/src/Redux/ActionsReducers/PlusMinusRedux.js +1 -1
  59. package/src/Redux/ActionsReducers/PopupRedux.d.ts +0 -2
  60. package/src/Redux/ActionsReducers/PopupRedux.js +1 -28
  61. package/src/Redux/ActionsReducers/ScheduleRedux.d.ts +5 -5
  62. package/src/Redux/ActionsReducers/ScheduleRedux.js +5 -5
  63. package/src/Redux/ActionsReducers/ShortcutRedux.d.ts +1 -1
  64. package/src/Redux/ActionsReducers/ShortcutRedux.js +1 -1
  65. package/src/Redux/ActionsReducers/SystemRedux.d.ts +1 -2
  66. package/src/Redux/ActionsReducers/SystemRedux.js +1 -2
  67. package/src/Redux/Store/AdaptableStore.js +20 -6
  68. package/src/Strategy/AlertModule.d.ts +1 -0
  69. package/src/Strategy/AlertModule.js +20 -0
  70. package/src/Strategy/CalculatedColumnModule.js +2 -2
  71. package/src/Strategy/ExportModule.d.ts +0 -1
  72. package/src/Strategy/ExportModule.js +0 -16
  73. package/src/Strategy/FilterModule.js +6 -0
  74. package/src/Strategy/FlashingCellModule.js +2 -2
  75. package/src/Strategy/Interface/IModule.d.ts +4 -0
  76. package/src/Strategy/LayoutModule.js +20 -20
  77. package/src/Strategy/Utilities/FormatColumn/getFormatColumnStyleViewItems.js +16 -1
  78. package/src/Strategy/Utilities/Layout/getLayoutFilterViewItems.js +15 -11
  79. package/src/Utilities/Constants/DocumentationLinkConstants.d.ts +1 -0
  80. package/src/Utilities/Constants/DocumentationLinkConstants.js +2 -1
  81. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +2 -0
  82. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.d.ts +12 -2
  83. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +30 -66
  84. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +22 -6
  85. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +423 -220
  86. package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.d.ts +7 -1
  87. package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.js +23 -7
  88. package/src/Utilities/ExpressionFunctions/scalarAggregationHelper.d.ts +0 -1
  89. package/src/Utilities/ExpressionFunctions/scalarAggregationHelper.js +6 -54
  90. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +17 -5
  91. package/src/Utilities/Helpers/CalendarHelper.js +10 -7
  92. package/src/Utilities/Helpers/DateHelper.d.ts +0 -26
  93. package/src/Utilities/Helpers/DateHelper.js +2 -32
  94. package/src/Utilities/Interface/MessagePopups.d.ts +0 -4
  95. package/src/Utilities/ObjectFactory.d.ts +6 -4
  96. package/src/Utilities/ObjectFactory.js +30 -17
  97. package/src/Utilities/Services/AggregatedScalarLiveValue.d.ts +25 -0
  98. package/src/Utilities/Services/AggregatedScalarLiveValue.js +103 -0
  99. package/src/Utilities/Services/AlertService.d.ts +0 -1
  100. package/src/Utilities/Services/AlertService.js +5 -17
  101. package/src/Utilities/Services/CalculatedColumnExpressionService.d.ts +4 -4
  102. package/src/Utilities/Services/CalculatedColumnExpressionService.js +29 -154
  103. package/src/Utilities/Services/Interface/ICalculatedColumnExpressionService.d.ts +2 -2
  104. package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +6 -3
  105. package/src/Utilities/Services/QueryLanguageService.d.ts +6 -3
  106. package/src/Utilities/Services/QueryLanguageService.js +23 -6
  107. package/src/Utilities/Services/ReportService.js +47 -46
  108. package/src/View/AdaptableView.js +1 -2
  109. package/src/View/CalculatedColumn/Utilities/getCalculatedColumnSettingsTags.d.ts +2 -0
  110. package/src/View/CalculatedColumn/Utilities/{getCalculatedColumnSettingTags.js → getCalculatedColumnSettingsTags.js} +5 -3
  111. package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.d.ts +10 -0
  112. package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.js +80 -0
  113. package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +21 -15
  114. package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.d.ts +1 -2
  115. package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +10 -53
  116. package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.js +14 -3
  117. package/src/View/Components/AdaptableDateInput/index.js +1 -1
  118. package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +42 -6
  119. package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +1 -1
  120. package/src/View/Components/EntityRulesEditor/index.js +26 -5
  121. package/src/View/Components/FilterForm/FilterForm.js +8 -4
  122. package/src/View/Components/FilterForm/ListBoxFilterForm.js +1 -0
  123. package/src/View/Components/FilterForm/QuickFilterForm.js +10 -6
  124. package/src/View/Components/PermittedValuesSelector/PermitedValuesSelector.d.ts +9 -0
  125. package/src/View/Components/PermittedValuesSelector/PermitedValuesSelector.js +28 -0
  126. package/src/View/Components/PermittedValuesSelector/index.d.ts +1 -0
  127. package/src/View/Components/PermittedValuesSelector/index.js +5 -0
  128. package/src/View/Components/Popups/AdaptablePopup/Navigation.js +2 -2
  129. package/src/View/Components/Popups/AdaptableToaster.js +2 -7
  130. package/src/View/Components/Popups/WindowPopups/windowFactory.d.ts +0 -1
  131. package/src/View/Components/Popups/WindowPopups/windowFactory.js +1 -4
  132. package/src/View/Export/ExportViewPanel.d.ts +1 -2
  133. package/src/View/Export/ExportViewPanel.js +2 -6
  134. package/src/View/Export/Wizard/ReportColumnTypeWizard.d.ts +1 -2
  135. package/src/View/Export/Wizard/ReportColumnTypeWizard.js +11 -12
  136. package/src/View/Export/Wizard/ReportRowTypeWizard.d.ts +1 -2
  137. package/src/View/Export/Wizard/ReportRowTypeWizard.js +12 -13
  138. package/src/View/Export/Wizard/ReportSettingsWizard.js +1 -2
  139. package/src/View/Filter/FilterViewPanel.js +20 -4
  140. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +1 -1
  141. package/src/View/FreeTextColumn/FreeTextColumnSummary.js +1 -2
  142. package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.d.ts +1 -1
  143. package/src/View/FreeTextColumn/Wizard/FreeTextColumnWizard.js +1 -1
  144. package/src/View/Layout/Wizard/{LayoutEditor → Components}/ColumnLabels.d.ts +0 -0
  145. package/src/View/Layout/Wizard/{LayoutEditor → Components}/ColumnLabels.js +0 -0
  146. package/src/View/Layout/Wizard/LayoutWizard.js +1 -0
  147. package/src/View/Layout/Wizard/sections/AggregationsSection.d.ts +1 -0
  148. package/src/View/Layout/Wizard/sections/AggregationsSection.js +69 -8
  149. package/src/View/Layout/Wizard/sections/ColumnsSection.js +1 -1
  150. package/src/View/Query/QueryViewPanel.js +1 -1
  151. package/src/agGrid/Adaptable.d.ts +11 -3
  152. package/src/agGrid/Adaptable.js +224 -150
  153. package/src/agGrid/agGridHelper.d.ts +1 -0
  154. package/src/agGrid/agGridHelper.js +5 -3
  155. package/src/agGrid/agGridMenuHelper.d.ts +1 -0
  156. package/src/agGrid/agGridMenuHelper.js +4 -2
  157. package/src/agGrid/weightedAverage.d.ts +6 -0
  158. package/src/agGrid/weightedAverage.js +66 -0
  159. package/src/bundle-dependencies/bundles/react-toastify/index.js +1 -1
  160. package/src/components/ExpressionEditor/BaseEditorInput.d.ts +1 -0
  161. package/src/components/ExpressionEditor/BaseEditorInput.js +2 -3
  162. package/src/components/ExpressionEditor/EditorInput.d.ts +1 -1
  163. package/src/components/ExpressionEditor/EditorInput.js +24 -4
  164. package/src/components/ExpressionEditor/{EditorInputReactive.d.ts → EditorInputWithWhereClause.d.ts} +3 -3
  165. package/src/components/ExpressionEditor/{EditorInputReactive.js → EditorInputWithWhereClause.js} +6 -5
  166. package/src/components/ExpressionEditor/editorButtonsAggregatedBoolean.d.ts +2 -0
  167. package/src/components/ExpressionEditor/{editorButtonsReactive.js → editorButtonsAggregatedBoolean.js} +22 -37
  168. package/src/components/ExpressionEditor/editorButtonsAggregatedScalar.js +5 -10
  169. package/src/components/ExpressionEditor/editorButtonsCumulativeAggregatedScalar.d.ts +2 -0
  170. package/src/components/ExpressionEditor/editorButtonsCumulativeAggregatedScalar.js +50 -0
  171. package/src/components/ExpressionEditor/editorButtonsObservable.d.ts +2 -0
  172. package/src/components/ExpressionEditor/editorButtonsObservable.js +40 -0
  173. package/src/components/ExpressionEditor/index.d.ts +1 -1
  174. package/src/components/ExpressionEditor/index.js +26 -5
  175. package/src/metamodel/adaptable.metamodel.d.ts +55 -1
  176. package/src/metamodel/adaptable.metamodel.js +1 -1
  177. package/src/types.d.ts +3 -3
  178. package/version.d.ts +1 -1
  179. package/version.js +1 -1
  180. package/src/View/CalculatedColumn/Utilities/getCalculatedColumnSettingTags.d.ts +0 -2
  181. package/src/View/Layout/LayoutEditorStandalonePopup.d.ts +0 -3
  182. package/src/View/Layout/LayoutEditorStandalonePopup.js +0 -78
  183. package/src/View/Layout/Wizard/LayoutEditor/ColumnList.d.ts +0 -27
  184. package/src/View/Layout/Wizard/LayoutEditor/ColumnList.js +0 -86
  185. package/src/View/Layout/Wizard/LayoutEditor/ColumnSortList.d.ts +0 -16
  186. package/src/View/Layout/Wizard/LayoutEditor/ColumnSortList.js +0 -89
  187. package/src/View/Layout/Wizard/LayoutEditor/PivotList.d.ts +0 -15
  188. package/src/View/Layout/Wizard/LayoutEditor/PivotList.js +0 -70
  189. package/src/View/Layout/Wizard/LayoutEditor/RowGroupsList.d.ts +0 -15
  190. package/src/View/Layout/Wizard/LayoutEditor/RowGroupsList.js +0 -70
  191. package/src/View/Layout/Wizard/LayoutEditor/droppableIds.d.ts +0 -7
  192. package/src/View/Layout/Wizard/LayoutEditor/droppableIds.js +0 -11
  193. package/src/View/Layout/Wizard/LayoutEditor/getItemStyle.d.ts +0 -6
  194. package/src/View/Layout/Wizard/LayoutEditor/getItemStyle.js +0 -26
  195. package/src/View/Layout/Wizard/LayoutEditor/index.d.ts +0 -9
  196. package/src/View/Layout/Wizard/LayoutEditor/index.js +0 -367
  197. package/src/View/Layout/Wizard/LayoutEditor/reducer.d.ts +0 -28
  198. package/src/View/Layout/Wizard/LayoutEditor/reducer.js +0 -46
  199. package/src/View/Layout/Wizard/LayoutEditor/utils.d.ts +0 -10
  200. package/src/View/Layout/Wizard/LayoutEditor/utils.js +0 -14
  201. package/src/View/Layout/Wizard/LayoutEditorWizard.d.ts +0 -30
  202. package/src/View/Layout/Wizard/LayoutEditorWizard.js +0 -132
  203. package/src/components/ExpressionEditor/editorButtonsReactive.d.ts +0 -2
@@ -15,7 +15,13 @@ export declare const isTextSearchCaseInsensitive: (context: ExpressionContext) =
15
15
  export declare const getDataChangeLog$: (context: ExpressionContext, columnNameFilter: string) => Observable<CellDataChangedInfo>;
16
16
  export declare const handleWhereFunction: (args: any[], context: ExpressionContext) => any;
17
17
  export declare const extractColumnParameter: (consumingFunctionName: string, args: BaseParameter[]) => ColumnParameter;
18
- export declare const extractParameter: <T extends BaseParameter<string, string>>(consumingFunctionName: string, allowedType: T["type"], allowedOperands: T["name"][], args: BaseParameter[], isOptional?: boolean) => T;
18
+ export declare const extractColumnParameters: (consumingFunctionName: string, args: BaseParameter[]) => ColumnParameter[];
19
+ export declare const extractParameter: <T extends BaseParameter<string, string>>(consumingFunctionName: string, allowedType: T["type"], allowedOperands: T["name"][], args: BaseParameter[], config?: {
20
+ isOptional?: boolean;
21
+ }) => T;
22
+ export declare const extractParameters: <T extends BaseParameter<string, string>>(consumingFunctionName: string, allowedType: T["type"], allowedOperands: T["name"][], args: BaseParameter[], config?: {
23
+ isOptional?: boolean;
24
+ }) => T[];
19
25
  export declare const handleColumnFunction: (args: any[], context: ExpressionContext) => ColumnParameter;
20
26
  export declare const getNumericValue: (input: unknown) => number;
21
27
  export declare const validateColumnType: (columnId: string, validColumnTypes: ('Number' | 'String' | 'Date')[], consumingFunction: string, api: AdaptableApi) => void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateColumnType = exports.getNumericValue = exports.handleColumnFunction = exports.extractParameter = exports.extractColumnParameter = exports.handleWhereFunction = exports.getDataChangeLog$ = exports.isTextSearchCaseInsensitive = exports.getStringValue = exports.getStringValues = void 0;
3
+ exports.validateColumnType = exports.getNumericValue = exports.handleColumnFunction = exports.extractParameters = exports.extractParameter = exports.extractColumnParameters = exports.extractColumnParameter = exports.handleWhereFunction = exports.getDataChangeLog$ = exports.isTextSearchCaseInsensitive = exports.getStringValue = exports.getStringValues = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const ExpressionEvaluationError_1 = require("../../parser/src/ExpressionEvaluationError");
6
6
  const StringExtensions_1 = tslib_1.__importDefault(require("../Extensions/StringExtensions"));
@@ -58,20 +58,33 @@ const extractColumnParameter = (consumingFunctionName, args) => {
58
58
  return exports.extractParameter(consumingFunctionName, 'config', ['COL'], args);
59
59
  };
60
60
  exports.extractColumnParameter = extractColumnParameter;
61
- const extractParameter = (consumingFunctionName, allowedType, allowedOperands, args, isOptional) => {
61
+ const extractColumnParameters = (consumingFunctionName, args) => {
62
+ return exports.extractParameters(consumingFunctionName, 'config', ['COL'], args);
63
+ };
64
+ exports.extractColumnParameters = extractColumnParameters;
65
+ const extractParameter = (consumingFunctionName, allowedType, allowedOperands, args, config) => {
66
+ const parameters = exports.extractParameters(consumingFunctionName, allowedType, allowedOperands, args, config);
67
+ if (parameters == undefined) {
68
+ return;
69
+ }
70
+ if (parameters.length > 1) {
71
+ throw new ExpressionEvaluationError_1.ExpressionEvaluationError(consumingFunctionName, `expects only 1 argument of type '${[...new Set(parameters.map((op) => op.name))].join(`' / '`)}'`);
72
+ }
73
+ return parameters[0];
74
+ };
75
+ exports.extractParameter = extractParameter;
76
+ const extractParameters = (consumingFunctionName, allowedType, allowedOperands, args, config) => {
77
+ const { isOptional } = config !== null && config !== void 0 ? config : {};
62
78
  const result = args.filter((arg) => (arg === null || arg === void 0 ? void 0 : arg.type) === allowedType && allowedOperands.includes(arg === null || arg === void 0 ? void 0 : arg.name));
63
79
  if (isOptional && !result.length) {
64
80
  return;
65
81
  }
66
- if (result.length > 1) {
67
- throw new ExpressionEvaluationError_1.ExpressionEvaluationError(consumingFunctionName, `expects only 1 argument of type '${[...new Set(result.map((op) => op.name))].join(`' / '`)}'`);
68
- }
69
82
  if (!result.length) {
70
83
  throw new ExpressionEvaluationError_1.ExpressionEvaluationError(consumingFunctionName, `expects an argument of type '${allowedOperands.join(`' / '`)}'`);
71
84
  }
72
- return result[0];
85
+ return result;
73
86
  };
74
- exports.extractParameter = extractParameter;
87
+ exports.extractParameters = extractParameters;
75
88
  const handleColumnFunction = (args, context) => {
76
89
  if (StringExtensions_1.default.IsNullOrEmpty(args[0])) {
77
90
  throw new ExpressionEvaluationError_1.ExpressionEvaluationError('COL', `no column name is provided`);
@@ -86,6 +99,9 @@ const handleColumnFunction = (args, context) => {
86
99
  };
87
100
  exports.handleColumnFunction = handleColumnFunction;
88
101
  const getNumericValue = (input) => {
102
+ if (typeof input === 'number') {
103
+ return input;
104
+ }
89
105
  const numericValue = toNumber_1.default(input);
90
106
  return isNaN(numericValue) ? 0 : numericValue;
91
107
  };
@@ -30,4 +30,3 @@ export declare type DeepMapAggregationValueType<DataType, KeyType> = {
30
30
  };
31
31
  export declare type AggregationReducerResult = number;
32
32
  export declare function aggregate<DataType, KeyType = any>(aggregateParams: AggregateParams<DataType, KeyType>, data: DataType[]): DataAggregationResult<DataType, KeyType>;
33
- export declare function cumulate<DataType, KeyType = any>(aggregateParams: AggregateParams<DataType, KeyType>, data: DataType[]): DataAggregationResult<DataType, KeyType>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cumulate = exports.aggregate = void 0;
3
+ exports.aggregate = void 0;
4
4
  const deepMap_1 = require("./deepMap");
5
5
  function DEFAULT_TO_KEY(value) {
6
6
  return value;
@@ -10,57 +10,10 @@ function aggregate(aggregateParams, data) {
10
10
  const groupByLength = groupBy.length;
11
11
  const deepMap = new deepMap_1.DeepMap();
12
12
  let currentGroupKeys = [];
13
- const initialReducerValue = initReducers(reducers);
14
- const globalReducerResults = Object.assign({}, initialReducerValue);
15
- for (let i = 0, len = data.length; i < len; i++) {
16
- let item = data[i];
17
- for (let groupByIndex = 0; groupByIndex < groupByLength; groupByIndex++) {
18
- const { field: groupByProperty, toKey: groupToKey } = groupBy[groupByIndex];
19
- const key = (groupToKey || defaultToKey)(item[groupByProperty], item);
20
- currentGroupKeys.push(key);
21
- if (!deepMap.has(currentGroupKeys)) {
22
- const deepMapGroupValue = {
23
- items: [],
24
- reducerResults: Object.assign({}, initialReducerValue),
25
- };
26
- deepMap.set(currentGroupKeys, deepMapGroupValue);
27
- }
28
- const { items: currentGroupItems, reducerResults } = deepMap.get(currentGroupKeys);
29
- currentGroupItems.push(item);
30
- if (reducers) {
31
- computeReducersFor(item, reducers, reducerResults, i);
32
- }
33
- }
34
- if (reducers) {
35
- computeReducersFor(item, reducers, globalReducerResults, i);
36
- }
37
- currentGroupKeys.length = 0;
38
- }
39
- if (reducers) {
40
- deepMap.visitDepthFirst((deepMapValue, _keys, _indexInGroup, next) => {
41
- completeReducers(reducers, deepMapValue.reducerResults, deepMapValue.items);
42
- next === null || next === void 0 ? void 0 : next();
43
- });
44
- }
45
- if (reducers) {
46
- completeReducers(reducers, globalReducerResults, data);
47
- }
48
- const result = {
49
- deepMap,
50
- aggregateParams,
51
- initialData: data,
52
- reducerResults: globalReducerResults,
13
+ const getInitialReducerValue = () => {
14
+ return JSON.parse(JSON.stringify(initReducers(reducers)));
53
15
  };
54
- return result;
55
- }
56
- exports.aggregate = aggregate;
57
- function cumulate(aggregateParams, data) {
58
- const { groupBy = [], defaultToKey = DEFAULT_TO_KEY, reducers } = aggregateParams;
59
- const groupByLength = groupBy.length;
60
- const deepMap = new deepMap_1.DeepMap();
61
- let currentGroupKeys = [];
62
- let initialReducerValue = initReducers(reducers);
63
- const globalReducerResults = Object.assign({}, initialReducerValue);
16
+ const globalReducerResults = getInitialReducerValue();
64
17
  for (let i = 0, len = data.length; i < len; i++) {
65
18
  let item = data[i];
66
19
  for (let groupByIndex = 0; groupByIndex < groupByLength; groupByIndex++) {
@@ -70,7 +23,7 @@ function cumulate(aggregateParams, data) {
70
23
  if (!deepMap.has(currentGroupKeys)) {
71
24
  const deepMapGroupValue = {
72
25
  items: [],
73
- reducerResults: Object.assign({}, initialReducerValue),
26
+ reducerResults: getInitialReducerValue(),
74
27
  };
75
28
  deepMap.set(currentGroupKeys, deepMapGroupValue);
76
29
  }
@@ -83,7 +36,6 @@ function cumulate(aggregateParams, data) {
83
36
  if (reducers) {
84
37
  computeReducersFor(item, reducers, globalReducerResults, i);
85
38
  }
86
- initialReducerValue = Object.assign({}, deepMap.get(currentGroupKeys).reducerResults);
87
39
  currentGroupKeys.length = 0;
88
40
  }
89
41
  if (reducers) {
@@ -103,7 +55,7 @@ function cumulate(aggregateParams, data) {
103
55
  };
104
56
  return result;
105
57
  }
106
- exports.cumulate = cumulate;
58
+ exports.aggregate = aggregate;
107
59
  function initReducers(reducers) {
108
60
  if (!reducers || !Object.keys(reducers).length) {
109
61
  return {};
@@ -30,7 +30,12 @@ const sanitizeNumericResult = (value) => {
30
30
  exports.scalarExpressionFunctions = {
31
31
  ADD: {
32
32
  handler(args) {
33
- return sanitizeArguments(args, true).reduce((a, b) => a + b);
33
+ const sanitizedArguments = sanitizeArguments(args, true);
34
+ if (args.length && !sanitizedArguments.length) {
35
+ // expression is syntactically valid, but operates with incompatible values
36
+ return;
37
+ }
38
+ return sanitizedArguments.reduce((a, b) => a + b);
34
39
  },
35
40
  isHiddenFromMenu: true,
36
41
  description: 'Returns the sum of 2 numbers',
@@ -39,7 +44,12 @@ exports.scalarExpressionFunctions = {
39
44
  },
40
45
  SUB: {
41
46
  handler(args) {
42
- return sanitizeArguments(args).reduce((a, b) => a - b);
47
+ const sanitizedArguments = sanitizeArguments(args);
48
+ if (args.length && !sanitizedArguments.length) {
49
+ // expression is syntactically valid, but operates with incompatible values
50
+ return;
51
+ }
52
+ return sanitizedArguments.reduce((a, b) => a - b);
43
53
  },
44
54
  isHiddenFromMenu: true,
45
55
  description: 'Returns the difference of 2 numbers',
@@ -126,10 +136,12 @@ exports.scalarExpressionFunctions = {
126
136
  },
127
137
  AVG: {
128
138
  handler(args) {
129
- if (args.length === 0) {
130
- return 0;
139
+ const sanitizedArguments = sanitizeArguments(args);
140
+ if (args.length && !sanitizedArguments.length) {
141
+ // expression is syntactically valid, but operates with incompatible values
142
+ return;
131
143
  }
132
- return sanitizeArguments(args).reduce((a, b) => a + b) / args.length;
144
+ return sanitizedArguments.reduce((a, b) => a + b) / args.length;
133
145
  },
134
146
  description: 'Returns the average of inputted numbers',
135
147
  signatures: ['AVG(number, number, ...number)'],
@@ -298,7 +298,7 @@ function getNextWorkingDay(days = 1) {
298
298
  let counterDate = new Date();
299
299
  while (count < days) {
300
300
  counterDate.setDate(counterDate.getDate() + 1);
301
- if (this.isNotWorkingDay(counterDate)) {
301
+ if (isNotWorkingDay(counterDate)) {
302
302
  count++;
303
303
  }
304
304
  }
@@ -310,7 +310,7 @@ function getPreviousWorkingDay(days = 1) {
310
310
  let counterDate = new Date();
311
311
  while (count < days) {
312
312
  counterDate.setDate(counterDate.getDate() - 1);
313
- if (this.isNotWorkingDay(counterDate)) {
313
+ if (isNotWorkingDay(counterDate)) {
314
314
  count++;
315
315
  }
316
316
  }
@@ -319,14 +319,17 @@ function getPreviousWorkingDay(days = 1) {
319
319
  exports.getPreviousWorkingDay = getPreviousWorkingDay;
320
320
  // pretty sure this can be improved as pretty expensive - though rarely used to be honest
321
321
  function isNotWorkingDay(dateToCheck) {
322
- let currentCalendar = this.getGeneralOptions().currentCalendar;
322
+ /*
323
+ // Removing lookups to current calendar until we decide what to do
324
+ let currentCalendar: string = this.getGeneralOptions().currentCalendar;
323
325
  let currentHoliday = getAvailableCalendars().find((c) => c.Name == currentCalendar);
324
326
  for (let holiday of currentHoliday.CalendarEntries) {
325
- let holidayDate = new Date(holiday.HolidayDate);
326
- if (holidayDate.setHours(0, 0, 0, 0) == dateToCheck.setHours(0, 0, 0, 0)) {
327
- return false;
328
- }
327
+ let holidayDate = new Date(holiday.HolidayDate);
328
+ if (holidayDate.setHours(0, 0, 0, 0) == dateToCheck.setHours(0, 0, 0, 0)) {
329
+ return false;
330
+ }
329
331
  }
332
+ */
330
333
  return dateToCheck.getDay() != 0 && dateToCheck.getDay() != 6;
331
334
  }
332
335
  exports.isNotWorkingDay = isNotWorkingDay;
@@ -8,30 +8,4 @@ export declare const isValueValidDate: (data: any) => boolean;
8
8
  export declare const dateToISO: (date: Date | number | string) => string;
9
9
  export declare const parseToISO: (date: string | Date | number, dateFormat?: string) => string;
10
10
  export declare const parseDateValue: (dateValue: string | Date | number, dateFormat?: string) => Date | undefined;
11
- /**
12
- * Creates a date with the same day/month/year/hour with the current timezone.
13
- * '2022-06-01T17:00:00.000Z' => '2022-06-01T17:00:00.000+03:00' // RO time
14
- *
15
- * new Date() always creates the date using the current timezone.
16
- * To compare two dates, they need to be in the same timezone.
17
- *
18
- * @param date Date
19
- */
20
- export declare const utcDateToSameDateInLocale: (date: Date) => Date;
21
- /**
22
- * To make sure selected/input date is correct and in the current time-zone.
23
-
24
- *
25
- * '2022-06-14' is considered to be '2022-06-13 00:00:00.
26
- * And when date object is created it uses the current timezone.
27
- *
28
- * '2022-06-14' => Mon Jun 13 2022 20:00:00 GMT-0400 (Eastern Daylight Time)
29
- *
30
- * @param stringDate date string
31
- */
32
11
  export declare const parseFilterInputDate: (stringDate: string) => Date;
33
- /**
34
- * Used to parse the date from rowDate inside date predicates.
35
- * The date is parsed in moved to local timezone.
36
- */
37
- export declare const parseFilterValueDate: (value: any) => Date;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseFilterValueDate = exports.parseFilterInputDate = exports.utcDateToSameDateInLocale = exports.parseDateValue = exports.parseToISO = exports.dateToISO = exports.isValueValidDate = exports.isValidDate = void 0;
3
+ exports.parseFilterInputDate = exports.parseDateValue = exports.parseToISO = exports.dateToISO = exports.isValueValidDate = exports.isValidDate = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const parseISO_1 = tslib_1.__importDefault(require("date-fns/parseISO"));
6
6
  const parse_1 = tslib_1.__importDefault(require("date-fns/parse"));
@@ -63,35 +63,5 @@ const parseDateValue = (dateValue, dateFormat) => {
63
63
  return dateInstance;
64
64
  };
65
65
  exports.parseDateValue = parseDateValue;
66
- /**
67
- * Creates a date with the same day/month/year/hour with the current timezone.
68
- * '2022-06-01T17:00:00.000Z' => '2022-06-01T17:00:00.000+03:00' // RO time
69
- *
70
- * new Date() always creates the date using the current timezone.
71
- * To compare two dates, they need to be in the same timezone.
72
- *
73
- * @param date Date
74
- */
75
- const utcDateToSameDateInLocale = (date) => {
76
- return new Date(date.getTime() + date.getTimezoneOffset() * 60 * 1000);
77
- };
78
- exports.utcDateToSameDateInLocale = utcDateToSameDateInLocale;
79
- /**
80
- * To make sure selected/input date is correct and in the current time-zone.
81
-
82
- *
83
- * '2022-06-14' is considered to be '2022-06-13 00:00:00.
84
- * And when date object is created it uses the current timezone.
85
- *
86
- * '2022-06-14' => Mon Jun 13 2022 20:00:00 GMT-0400 (Eastern Daylight Time)
87
- *
88
- * @param stringDate date string
89
- */
90
- const parseFilterInputDate = (stringDate) => exports.utcDateToSameDateInLocale(new Date(stringDate));
66
+ const parseFilterInputDate = (stringDate) => new Date(stringDate);
91
67
  exports.parseFilterInputDate = parseFilterInputDate;
92
- /**
93
- * Used to parse the date from rowDate inside date predicates.
94
- * The date is parsed in moved to local timezone.
95
- */
96
- const parseFilterValueDate = (value) => exports.utcDateToSameDateInLocale(exports.parseDateValue(value));
97
- exports.parseFilterValueDate = parseFilterValueDate;
@@ -2,7 +2,6 @@ import { Action } from 'redux';
2
2
  import { ModuleParams } from '../../View/Components/SharedProps/ModuleViewPopupProps';
3
3
  import { AdaptableModule } from '../../PredefinedConfig/Common/Types';
4
4
  import { AdaptableMessageType } from '../../PredefinedConfig/Common/AdaptableMessageType';
5
- import { AdaptableAlert } from '../../PredefinedConfig/Common/AdaptableAlert';
6
5
  import { AdaptableForm, BaseContext } from '../../types';
7
6
  export interface UIConfirmation {
8
7
  Header: string;
@@ -36,9 +35,6 @@ export interface ScreenPopup {
36
35
  export interface LoadingPopup {
37
36
  ShowLoadingPopup: boolean;
38
37
  }
39
- export interface AlertPopup {
40
- Alert: AdaptableAlert | null;
41
- }
42
38
  export interface ConfirmationPopup {
43
39
  ShowConfirmationPopup: boolean;
44
40
  Header: string;
@@ -6,7 +6,7 @@ import { AlertDefinition, AlertProperties } from '../PredefinedConfig/AlertState
6
6
  import { Layout } from '../PredefinedConfig/LayoutState';
7
7
  import { Report, ReportSchedule } from '../PredefinedConfig/ExportState';
8
8
  import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
9
- import { Schedule, BaseSchedule } from '../PredefinedConfig/Common/Schedule';
9
+ import { BaseSchedule, Schedule } from '../PredefinedConfig/Common/Schedule';
10
10
  import { Shortcut } from '../PredefinedConfig/ShortcutState';
11
11
  import { ConditionalStyle } from '../PredefinedConfig/ConditionalStyleState';
12
12
  import { FormatColumn } from '../PredefinedConfig/FormatColumnState';
@@ -16,7 +16,7 @@ import { CellDataChangedInfo } from '../PredefinedConfig/Common/CellDataChangedI
16
16
  import { Glue42Report, Glue42Schedule } from '../PredefinedConfig/Glue42State';
17
17
  import { IPushPullReport } from '../PredefinedConfig/SystemState';
18
18
  import { IPushPullSchedule } from '../PredefinedConfig/IPushPullState';
19
- import { OpenFinSchedule, OpenFinReport } from '../PredefinedConfig/OpenFinState';
19
+ import { OpenFinReport, OpenFinSchedule } from '../PredefinedConfig/OpenFinState';
20
20
  import { NamedQuery } from '../PredefinedConfig/QueryState';
21
21
  import { ReminderSchedule } from '../PredefinedConfig/ScheduleState';
22
22
  import { AdaptableCellChangedAlert, AdaptableGenericAlert, AdaptableRowChangedAlert } from '../PredefinedConfig/Common/AdaptableAlert';
@@ -29,7 +29,7 @@ import { RowNode } from '@ag-grid-community/all-modules';
29
29
  import { AdaptableApi } from '../../types';
30
30
  import { ToastOptions } from '../components/Toastify';
31
31
  export declare function CreateEmptyCustomSort(): CustomSort;
32
- export declare function CreateEmptyCalculatedColumn(isFilterable: boolean): CalculatedColumn;
32
+ export declare function CreateEmptyCalculatedColumn(): CalculatedColumn;
33
33
  export declare function CreateEmptyNamedQuery(expression?: string): NamedQuery;
34
34
  export declare function CreateEmptyPlusMinusNudge(): PlusMinusNudge;
35
35
  export declare function CreateGenericAlert(alertHeader: string, alertMessage: string, alertDefinition: AlertDefinition): AdaptableGenericAlert;
@@ -39,6 +39,7 @@ export declare function CreateEmptyAlertDefinition(): AlertDefinition;
39
39
  export declare function CreateEmptyFlashingCellDefinition(): FlashingCellDefinition;
40
40
  export declare function CreateInternalAlertDefinitionForMessages(messageType: AdaptableMessageType, alertProperties?: AlertProperties): AlertDefinition;
41
41
  export declare function CreateEmptyReport(): Report;
42
+ export declare function CreateCustomReport(reportName: string): Report;
42
43
  export declare function CreateEmptyBaseSchedule(scheduleType: ScheduleType): BaseSchedule;
43
44
  export declare function CreateEmptyReminderSchedule(): ReminderSchedule;
44
45
  export declare function CreateEmptyReportSchedule(): ReportSchedule;
@@ -55,7 +56,7 @@ export declare function CreateEmptySchedule(): Schedule;
55
56
  export declare function CreateEmptyShortcut(): Shortcut;
56
57
  export declare function CreateEmptyConditionalStyle(): ConditionalStyle;
57
58
  export declare function CreateEmptyFormatColumn(): FormatColumn;
58
- export declare function CreateEmptyFreeTextColumn(isFilterable: boolean): FreeTextColumn;
59
+ export declare function CreateEmptyFreeTextColumn(): FreeTextColumn;
59
60
  export declare function CreateEmptyLayout(layout?: Partial<Layout> & {
60
61
  Name: string;
61
62
  }, adaptableColumns?: AdaptableColumn[]): Layout;
@@ -79,6 +80,7 @@ export declare const ObjectFactory: {
79
80
  CreateEmptyAlertDefinition: typeof CreateEmptyAlertDefinition;
80
81
  CreateEmptyFlashingCellDefinition: typeof CreateEmptyFlashingCellDefinition;
81
82
  CreateInternalAlertDefinitionForMessages: typeof CreateInternalAlertDefinitionForMessages;
83
+ CreateCustomReport: typeof CreateCustomReport;
82
84
  CreateEmptyReport: typeof CreateEmptyReport;
83
85
  CreateEmptyBaseSchedule: typeof CreateEmptyBaseSchedule;
84
86
  CreateEmptyReminderSchedule: typeof CreateEmptyReminderSchedule;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ObjectFactory = exports.CreateToastOptions = exports.CreateCustomDisplayFormatterContext = exports.CreateColumnFilter = exports.CreateEmptyCellSummmary = exports.CreateSystemStatusMessageInfo = exports.CreateEmptyStyle = exports.CreateEmptyLayout = exports.CreateEmptyFreeTextColumn = exports.CreateEmptyFormatColumn = exports.CreateEmptyConditionalStyle = exports.CreateEmptyShortcut = exports.CreateEmptySchedule = exports.CreateReportSchedule = exports.CreateGlue42Schedule = exports.CreateIPushPullSchedule = exports.CreateEmptyOpenFinSchedule = exports.CreateEmptyGlue42Schedule = exports.CreateEmptyIPushPullSchedule = exports.CreateEmptyOpenFinReport = exports.CreateEmptyGlue42Report = exports.CreateEmptyIPushPullReport = exports.CreateEmptyReportSchedule = exports.CreateEmptyReminderSchedule = exports.CreateEmptyBaseSchedule = exports.CreateEmptyReport = exports.CreateInternalAlertDefinitionForMessages = exports.CreateEmptyFlashingCellDefinition = exports.CreateEmptyAlertDefinition = exports.CreateRowChangedAlert = exports.CreateCellChangedAlert = exports.CreateGenericAlert = exports.CreateEmptyPlusMinusNudge = exports.CreateEmptyNamedQuery = exports.CreateEmptyCalculatedColumn = exports.CreateEmptyCustomSort = void 0;
3
+ exports.ObjectFactory = exports.CreateToastOptions = exports.CreateCustomDisplayFormatterContext = exports.CreateColumnFilter = exports.CreateEmptyCellSummmary = exports.CreateSystemStatusMessageInfo = exports.CreateEmptyStyle = exports.CreateEmptyLayout = exports.CreateEmptyFreeTextColumn = exports.CreateEmptyFormatColumn = exports.CreateEmptyConditionalStyle = exports.CreateEmptyShortcut = exports.CreateEmptySchedule = exports.CreateReportSchedule = exports.CreateGlue42Schedule = exports.CreateIPushPullSchedule = exports.CreateEmptyOpenFinSchedule = exports.CreateEmptyGlue42Schedule = exports.CreateEmptyIPushPullSchedule = exports.CreateEmptyOpenFinReport = exports.CreateEmptyGlue42Report = exports.CreateEmptyIPushPullReport = exports.CreateEmptyReportSchedule = exports.CreateEmptyReminderSchedule = exports.CreateEmptyBaseSchedule = exports.CreateCustomReport = exports.CreateEmptyReport = exports.CreateInternalAlertDefinitionForMessages = exports.CreateEmptyFlashingCellDefinition = exports.CreateEmptyAlertDefinition = exports.CreateRowChangedAlert = exports.CreateCellChangedAlert = exports.CreateGenericAlert = exports.CreateEmptyPlusMinusNudge = exports.CreateEmptyNamedQuery = exports.CreateEmptyCalculatedColumn = exports.CreateEmptyCustomSort = void 0;
4
4
  const Enums_1 = require("../PredefinedConfig/Common/Enums");
5
5
  const GeneralConstants_1 = require("./Constants/GeneralConstants");
6
6
  const Uuid_1 = require("../PredefinedConfig/Uuid");
@@ -9,7 +9,7 @@ function CreateEmptyCustomSort() {
9
9
  return { Uuid: Uuid_1.createUuid(), ColumnId: GeneralConstants_1.EMPTY_STRING, SortedValues: [] };
10
10
  }
11
11
  exports.CreateEmptyCustomSort = CreateEmptyCustomSort;
12
- function CreateEmptyCalculatedColumn(isFilterable) {
12
+ function CreateEmptyCalculatedColumn() {
13
13
  return {
14
14
  Uuid: Uuid_1.createUuid(),
15
15
  ColumnId: GeneralConstants_1.EMPTY_STRING,
@@ -18,12 +18,13 @@ function CreateEmptyCalculatedColumn(isFilterable) {
18
18
  },
19
19
  // need to create some defaults - which we will change later
20
20
  CalculatedColumnSettings: {
21
- Filterable: isFilterable,
22
- Resizable: true,
23
- Groupable: true,
24
- Sortable: true,
25
- Pivotable: true,
26
- Aggregatable: true,
21
+ DataType: undefined,
22
+ Filterable: false,
23
+ Resizable: false,
24
+ Groupable: false,
25
+ Sortable: false,
26
+ Pivotable: false,
27
+ Aggregatable: false,
27
28
  SuppressMenu: false,
28
29
  SuppressMovable: false,
29
30
  },
@@ -123,12 +124,23 @@ function CreateEmptyReport() {
123
124
  Uuid: Uuid_1.createUuid(),
124
125
  Name: GeneralConstants_1.EMPTY_STRING,
125
126
  Scope: undefined,
126
- ReportColumnScope: Enums_1.ReportColumnScope.AllColumns,
127
- ReportRowScope: Enums_1.ReportRowScope.AllRows,
127
+ ReportColumnScope: 'AllColumns',
128
+ ReportRowScope: 'AllRows',
128
129
  Query: undefined,
129
130
  };
130
131
  }
131
132
  exports.CreateEmptyReport = CreateEmptyReport;
133
+ function CreateCustomReport(reportName) {
134
+ return {
135
+ Uuid: Uuid_1.createUuid(),
136
+ Name: reportName,
137
+ Scope: undefined,
138
+ ReportColumnScope: 'AllColumns',
139
+ ReportRowScope: 'AllRows',
140
+ Query: undefined,
141
+ };
142
+ }
143
+ exports.CreateCustomReport = CreateCustomReport;
132
144
  function CreateEmptyBaseSchedule(scheduleType) {
133
145
  return {
134
146
  Uuid: Uuid_1.createUuid(),
@@ -283,7 +295,7 @@ function CreateEmptyFormatColumn() {
283
295
  };
284
296
  }
285
297
  exports.CreateEmptyFormatColumn = CreateEmptyFormatColumn;
286
- function CreateEmptyFreeTextColumn(isFilterable) {
298
+ function CreateEmptyFreeTextColumn() {
287
299
  return {
288
300
  Uuid: Uuid_1.createUuid(),
289
301
  ColumnId: GeneralConstants_1.EMPTY_STRING,
@@ -292,12 +304,12 @@ function CreateEmptyFreeTextColumn(isFilterable) {
292
304
  TextEditor: 'Inline',
293
305
  DataType: 'String',
294
306
  FreeTextColumnSettings: {
295
- Filterable: isFilterable,
296
- Resizable: true,
297
- Groupable: true,
298
- Sortable: true,
299
- Pivotable: true,
300
- Aggregatable: true,
307
+ Filterable: false,
308
+ Resizable: false,
309
+ Groupable: false,
310
+ Sortable: false,
311
+ Pivotable: false,
312
+ Aggregatable: false,
301
313
  SuppressMenu: false,
302
314
  SuppressMovable: false,
303
315
  },
@@ -429,6 +441,7 @@ exports.ObjectFactory = {
429
441
  CreateEmptyAlertDefinition,
430
442
  CreateEmptyFlashingCellDefinition,
431
443
  CreateInternalAlertDefinitionForMessages,
444
+ CreateCustomReport,
432
445
  CreateEmptyReport,
433
446
  CreateEmptyBaseSchedule,
434
447
  CreateEmptyReminderSchedule,
@@ -0,0 +1,25 @@
1
+ import { AggregatedScalarExpressionEvaluation } from '../ExpressionFunctions/aggregatedScalarExpressionFunctions';
2
+ import { AdaptableApi } from '../../Api/AdaptableApi';
3
+ import { AdaptableModule as ModuleConstants } from '../../PredefinedConfig/Common/Types';
4
+ import { RowNode } from '@ag-grid-community/all-modules';
5
+ import { XOR } from '../Extensions/TypeExtensions';
6
+ export declare class AggregatedScalarLiveValue {
7
+ private source;
8
+ private requestingModule;
9
+ private adaptableApi;
10
+ private aggregationReducerName;
11
+ private aggregatedScalarExpression;
12
+ private expressionEvaluation;
13
+ private aggregationResult;
14
+ constructor(source: XOR<{
15
+ aggregatedScalarExpression: string;
16
+ }, {
17
+ aggregatedScalarExpressionEvaluation: AggregatedScalarExpressionEvaluation;
18
+ }>, requestingModule: ModuleConstants, adaptableApi: AdaptableApi);
19
+ refresh(): void;
20
+ getAggregatedValueForRow(rowNode: RowNode): any;
21
+ getAllAggregationValues(): number[];
22
+ private getAggregationValue;
23
+ private getGlobalAggregatedValue;
24
+ private computeAggregatedValue;
25
+ }
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AggregatedScalarLiveValue = void 0;
4
+ const scalarAggregationHelper_1 = require("../ExpressionFunctions/scalarAggregationHelper");
5
+ class AggregatedScalarLiveValue {
6
+ constructor(source, requestingModule, adaptableApi) {
7
+ this.source = source;
8
+ this.requestingModule = requestingModule;
9
+ this.adaptableApi = adaptableApi;
10
+ if (source.aggregatedScalarExpression) {
11
+ this.aggregatedScalarExpression = source.aggregatedScalarExpression;
12
+ }
13
+ this.expressionEvaluation = source.aggregatedScalarExpression
14
+ ? this.adaptableApi.internalApi
15
+ .getQueryLanguageService()
16
+ .evaluateAggregatedScalarExpression(source.aggregatedScalarExpression, requestingModule)
17
+ .value
18
+ : source.aggregatedScalarExpressionEvaluation;
19
+ // currently we support only one reducer
20
+ this.aggregationReducerName = Object.keys(this.expressionEvaluation.aggregationParams.reducers)[0];
21
+ this.aggregationResult = this.computeAggregatedValue(this.expressionEvaluation);
22
+ }
23
+ refresh() {
24
+ if (this.aggregatedScalarExpression) {
25
+ this.expressionEvaluation = this.adaptableApi.internalApi
26
+ .getQueryLanguageService()
27
+ .evaluateAggregatedScalarExpression(this.aggregatedScalarExpression, this.requestingModule).value;
28
+ }
29
+ // currently we support only one reducer
30
+ this.aggregationReducerName = Object.keys(this.expressionEvaluation.aggregationParams.reducers)[0];
31
+ this.aggregationResult = this.computeAggregatedValue(this.expressionEvaluation);
32
+ }
33
+ getAggregatedValueForRow(rowNode) {
34
+ const aggregationValue = this.getAggregationValue(rowNode);
35
+ if (this.expressionEvaluation.rowValueGetter) {
36
+ return this.expressionEvaluation.rowValueGetter(rowNode, aggregationValue);
37
+ }
38
+ return aggregationValue;
39
+ }
40
+ getAllAggregationValues() {
41
+ var _a;
42
+ if ((_a = this.expressionEvaluation.aggregationParams.groupBy) === null || _a === void 0 ? void 0 : _a.length) {
43
+ const aggregations = this.aggregationResult.deepMap.topDownValues();
44
+ return aggregations.map((aggregation) => aggregation.reducerResults[this.aggregationReducerName]);
45
+ }
46
+ return [this.getGlobalAggregatedValue()];
47
+ }
48
+ getAggregationValue(rowNode) {
49
+ var _a, _b;
50
+ if ((_a = this.expressionEvaluation.aggregationParams.groupBy) === null || _a === void 0 ? void 0 : _a.length) {
51
+ const groupColumns = this.expressionEvaluation.aggregationParams.groupBy.map((groupByParam) => groupByParam.field);
52
+ const groupKeys = groupColumns.map((groupColumnName) => this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, groupColumnName));
53
+ return (_b = this.aggregationResult.deepMap.get(groupKeys)) === null || _b === void 0 ? void 0 : _b.reducerResults[this.aggregationReducerName];
54
+ }
55
+ return this.getGlobalAggregatedValue();
56
+ }
57
+ getGlobalAggregatedValue() {
58
+ return this.aggregationResult.reducerResults[this.aggregationReducerName];
59
+ }
60
+ computeAggregatedValue(expressionEvaluation) {
61
+ var _a;
62
+ const gridRowNodes = this.adaptableApi.gridApi.getAllRowNodes({
63
+ filterFn: expressionEvaluation.rowFilterFn,
64
+ });
65
+ // we iterate over the RowNode list (we need this to handle complex column values (nested values, valueGetters etc)
66
+ // so we will map the fieldNames to RowNode.data
67
+ const mapReducerValueGetter = (fieldName) => {
68
+ return (rowNode) => {
69
+ return this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, fieldName);
70
+ };
71
+ };
72
+ Object.values(expressionEvaluation.aggregationParams.reducers).forEach((aggregationReducer) => {
73
+ aggregationReducer.getter = mapReducerValueGetter(aggregationReducer.field);
74
+ // nullify the field to force the fallback on the getter fn
75
+ aggregationReducer.field = null;
76
+ });
77
+ const mapGroupByToKey = (fieldName) => {
78
+ return (_unusableProperty, rowNode) => this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, fieldName);
79
+ };
80
+ (_a = expressionEvaluation.aggregationParams.groupBy) === null || _a === void 0 ? void 0 : _a.forEach((groupByDef) => {
81
+ groupByDef.toKey = mapGroupByToKey(groupByDef.field);
82
+ });
83
+ let aggregatedRowNodes = gridRowNodes;
84
+ if (expressionEvaluation.sortByColumn) {
85
+ const sortByColumn = expressionEvaluation.sortByColumn;
86
+ const getRowNodeValue = (rowNode, columnId) => this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, columnId);
87
+ // currently, we support only ascending sorting
88
+ aggregatedRowNodes.sort((first, second) => {
89
+ const firstValue = getRowNodeValue(first, sortByColumn);
90
+ const secondValue = getRowNodeValue(second, sortByColumn);
91
+ if (firstValue < secondValue) {
92
+ return -1;
93
+ }
94
+ if (firstValue > secondValue) {
95
+ return 1;
96
+ }
97
+ return 0;
98
+ });
99
+ }
100
+ return scalarAggregationHelper_1.aggregate(expressionEvaluation.aggregationParams, aggregatedRowNodes);
101
+ }
102
+ }
103
+ exports.AggregatedScalarLiveValue = AggregatedScalarLiveValue;
@@ -11,6 +11,5 @@ export declare class AlertService implements IAlertService {
11
11
  onReactiveAlertTriggered: (callback: EmitterCallback) => (() => void);
12
12
  createReactiveAlert(alertDefinition: AlertDefinition): void;
13
13
  deleteReactiveAlert(alertDefinition: AlertDefinition): void;
14
- private isValidExpression;
15
14
  private evaluateReactiveExpression;
16
15
  }