@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
@@ -112,6 +112,7 @@ const LayoutWizard = (props) => {
112
112
  title: 'Aggregations',
113
113
  details: 'Select Column Aggregations',
114
114
  renderSummary: () => React.createElement(AggregationsSection_1.AggregationsSectionSummary, null),
115
+ isValid: (data) => AggregationsSection_1.isAggregationsSectionValid(data),
115
116
  render: () => (React.createElement(rebass_1.Box, { p: 2, style: { height: '100%' } },
116
117
  React.createElement(AggregationsSection_1.AggregationsSection, { onChange: setLayout }))),
117
118
  },
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { Layout } from '../../../../../types';
3
+ export declare const isAggregationsSectionValid: (data: Layout) => true | string;
3
4
  export declare const AggregationsSectionSummary: React.FunctionComponent;
4
5
  interface AggregationsSectionProps {
5
6
  onChange: (data: Layout) => void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AggregationsSection = exports.AggregationsSectionSummary = void 0;
3
+ exports.AggregationsSection = exports.AggregationsSectionSummary = exports.isAggregationsSectionValid = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
6
  const rebass_1 = require("rebass");
@@ -14,6 +14,17 @@ const AdaptableContext_1 = require("../../../AdaptableContext");
14
14
  const ValueSelector_1 = require("../../../Components/ValueSelector");
15
15
  const OnePageAdaptableWizard_1 = require("../../../Wizard/OnePageAdaptableWizard");
16
16
  const Utilities_1 = require("./Utilities");
17
+ const WEIGHTED_AVERAGE_AGG_FN_NAME = 'weightedAvg';
18
+ const isAggregationsSectionValid = (data) => {
19
+ const weightedAvg = data.AggregationColumns
20
+ ? Object.values(data.AggregationColumns).find((agg) => typeof agg === 'object' && agg.type === 'weightedAverage')
21
+ : null;
22
+ if (weightedAvg && !weightedAvg.weightedColumnId) {
23
+ return 'Weighted Average aggregation requires a weighted column';
24
+ }
25
+ return true;
26
+ };
27
+ exports.isAggregationsSectionValid = isAggregationsSectionValid;
17
28
  const AggregationsSectionSummary = () => {
18
29
  const adaptable = AdaptableContext_1.useAdaptable();
19
30
  const { data: layout } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
@@ -32,8 +43,13 @@ const AggregationsSectionSummary = () => {
32
43
  exports.AggregationsSectionSummary = AggregationsSectionSummary;
33
44
  const ColumnRow = (props) => {
34
45
  var _a, _b;
46
+ const adaptable = AdaptableContext_1.useAdaptable();
35
47
  const aggValue = (_b = (_a = props.layout) === null || _a === void 0 ? void 0 : _a.AggregationColumns) === null || _b === void 0 ? void 0 : _b[props.column.columnId];
36
- const aggOptions = props.column.availableAggregationFunctions.map((fnName) => {
48
+ const adaptableAggFunctions = [];
49
+ if (props.column.dataType === 'Number') {
50
+ adaptableAggFunctions.push(WEIGHTED_AVERAGE_AGG_FN_NAME);
51
+ }
52
+ const aggOptions = [...props.column.availableAggregationFunctions, ...adaptableAggFunctions].map((fnName) => {
37
53
  return {
38
54
  label: fnName,
39
55
  onClick: () => {
@@ -41,14 +57,51 @@ const ColumnRow = (props) => {
41
57
  if (!aggCols) {
42
58
  return;
43
59
  }
44
- aggCols[props.column.columnId] = fnName;
60
+ if (fnName === WEIGHTED_AVERAGE_AGG_FN_NAME) {
61
+ aggCols[props.column.columnId] = {
62
+ type: 'weightedAverage',
63
+ weightedColumnId: null,
64
+ };
65
+ }
66
+ else {
67
+ aggCols[props.column.columnId] = fnName;
68
+ }
45
69
  props.onChangeAggFunction(aggCols);
46
70
  },
47
71
  };
48
72
  });
49
- return (React.createElement(rebass_1.Box, null,
73
+ const numericColumnsOptions = props.numberColumns
74
+ .filter((col) => col.columnId !== props.column.columnId)
75
+ .map((col) => {
76
+ return {
77
+ label: col.friendlyName,
78
+ onClick: () => {
79
+ const aggCols = Object.assign({}, props.layout.AggregationColumns);
80
+ if (!aggCols) {
81
+ return;
82
+ }
83
+ aggCols[props.column.columnId] = {
84
+ type: 'weightedAverage',
85
+ weightedColumnId: col.columnId,
86
+ };
87
+ props.onChangeAggFunction(aggCols);
88
+ },
89
+ };
90
+ });
91
+ const currentAggFnName = props.aggregationColumnsMap[props.column.columnId];
92
+ let weightName = null;
93
+ if (typeof aggValue === 'object' && aggValue.type === 'weightedAverage') {
94
+ weightName = aggValue.weightedColumnId
95
+ ? adaptable.api.columnApi.getFriendlyNameFromColumnId(aggValue.weightedColumnId)
96
+ : 'Select Weight';
97
+ }
98
+ return (React.createElement(rebass_1.Flex, { alignItems: "center" },
50
99
  props.column.friendlyName,
51
- aggValue && (React.createElement(DropdownButton_1.default, { columns: ['label'], items: aggOptions, ml: 2 }, props.aggregationColumnsMap[props.column.columnId]))));
100
+ aggValue && (React.createElement(DropdownButton_1.default, { columns: ['label'], items: aggOptions, ml: 2 }, currentAggFnName)),
101
+ currentAggFnName === WEIGHTED_AVERAGE_AGG_FN_NAME && (React.createElement(rebass_1.Flex, { backgroundColor: "primary", ml: 3, alignItems: "center" },
102
+ React.createElement(rebass_1.Text, null, "Weight"),
103
+ ' ',
104
+ React.createElement(DropdownButton_1.default, { columns: ['label'], items: numericColumnsOptions, ml: 2 }, weightName)))));
52
105
  };
53
106
  const AggregationsSection = (props) => {
54
107
  var _a, _b;
@@ -56,6 +109,7 @@ const AggregationsSection = (props) => {
56
109
  const { data: layout } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
57
110
  const allAggregableColumns = adaptable.api.columnApi.getAggregetableColumns();
58
111
  const allColumns = adaptable.api.columnApi.getColumns();
112
+ const numberColumns = adaptable.api.columnApi.getNumericColumns();
59
113
  const sortedAggregableColumns = React.useMemo(() => {
60
114
  var _a, _b;
61
115
  return sortWithOrder_1.sortWithOrderArray(allAggregableColumns.map((col) => col.columnId), (_b = Object.keys((_a = layout.AggregationColumns) !== null && _a !== void 0 ? _a : {})) !== null && _b !== void 0 ? _b : [], { sortUnorderedItems: false }).map((colId) => adaptable.api.columnApi.getColumnFromId(colId));
@@ -79,10 +133,17 @@ const AggregationsSection = (props) => {
79
133
  return Object.keys(layout.AggregationColumns || {}).reduce((acc, colId) => {
80
134
  var _a;
81
135
  let fn = (_a = layout.AggregationColumns) === null || _a === void 0 ? void 0 : _a[colId];
136
+ let fnName = '';
82
137
  if (typeof fn === 'boolean') {
83
- fn = allColumnsMap[colId].aggregationFunction;
138
+ fnName = allColumnsMap[colId].aggregationFunction;
139
+ }
140
+ if (typeof fn === 'object' && fn.type === 'weightedAverage') {
141
+ fnName = WEIGHTED_AVERAGE_AGG_FN_NAME;
142
+ }
143
+ else if (typeof fn === 'string') {
144
+ fnName = fn;
84
145
  }
85
- acc[colId] = fn;
146
+ acc[colId] = fnName;
86
147
  return acc;
87
148
  }, {});
88
149
  }, [layout]);
@@ -95,7 +156,7 @@ const AggregationsSection = (props) => {
95
156
  React.createElement(rebass_1.Flex, null,
96
157
  React.createElement(FormLayout_1.default, null,
97
158
  React.createElement(CheckBox_1.CheckBox, { checked: layout.SuppressAggFuncInHeader, onChange: handleSuppressAggFuncInHeader }, "Suppress Aggregation Function in Header"))),
98
- React.createElement(ValueSelector_1.ValueSelector, { showFilterInput: true, showSelectedOnlyPosition: "top", filter: Utilities_1.columnFilter, toIdentifier: (option) => `${option.columnId}`, toLabel: (option) => { var _a; return (_a = option.friendlyName) !== null && _a !== void 0 ? _a : option.columnId; }, toListLabel: (column) => (React.createElement(ColumnRow, { onChangeAggFunction: handleAggregationChange, layout: layout, column: column, aggregationColumnsMap: aggregationColumnsMap })), options: sortedAggregableColumns, value: (_b = Object.keys((_a = layout.AggregationColumns) !== null && _a !== void 0 ? _a : {})) !== null && _b !== void 0 ? _b : [], allowReorder: () => false, xSelectedLabel: () => {
159
+ React.createElement(ValueSelector_1.ValueSelector, { showFilterInput: true, showSelectedOnlyPosition: "top", filter: Utilities_1.columnFilter, toIdentifier: (option) => `${option.columnId}`, toLabel: (option) => { var _a; return (_a = option.friendlyName) !== null && _a !== void 0 ? _a : option.columnId; }, toListLabel: (column) => (React.createElement(ColumnRow, { onChangeAggFunction: handleAggregationChange, layout: layout, column: column, aggregationColumnsMap: aggregationColumnsMap, numberColumns: numberColumns })), options: sortedAggregableColumns, value: (_b = Object.keys((_a = layout.AggregationColumns) !== null && _a !== void 0 ? _a : {})) !== null && _b !== void 0 ? _b : [], allowReorder: () => false, xSelectedLabel: () => {
99
160
  return `Active aggregations:`;
100
161
  }, onChange: handleColumnsSelectionChange }))));
101
162
  };
@@ -16,11 +16,11 @@ const sortWithOrder_1 = require("../../../../Utilities/sortWithOrder");
16
16
  const AdaptableContext_1 = require("../../../AdaptableContext");
17
17
  const ValueSelector_1 = require("../../../Components/ValueSelector");
18
18
  const OnePageAdaptableWizard_1 = require("../../../Wizard/OnePageAdaptableWizard");
19
- const ColumnLabels_1 = require("../LayoutEditor/ColumnLabels");
20
19
  const Utilities_1 = require("./Utilities");
21
20
  const icons_1 = require("../../../../components/icons");
22
21
  const CheckBox_1 = require("../../../../components/CheckBox");
23
22
  const Helper_1 = require("../../../../Utilities/Helpers/Helper");
23
+ const ColumnLabels_1 = require("../Components/ColumnLabels");
24
24
  const PropertyOrderText = (props) => (React.createElement(rebass_1.Text, { fontWeight: 600, fontSize: 2 }, props.children));
25
25
  const ColumnsSectionSummary = () => {
26
26
  const adaptable = AdaptableContext_1.useAdaptable();
@@ -88,7 +88,7 @@ class QueryViewPanelComponent extends React.Component {
88
88
  const renderTextInput = () => {
89
89
  return this.props.viewType === 'Toolbar' ? (React.createElement(FieldWrap_1.default, { marginRight: 1, width: 600 },
90
90
  React.createElement(ButtonExpand_1.ButtonExpand, { variant: "text", tone: "neutral", onClick: () => this.props.api.queryApi.expandCurrentQuery(this.state.expression), tooltip: "Expand", marginLeft: 1 }),
91
- React.createElement(Input_1.default, { type: "text", placeholder: "Query", spellCheck: false, value: this.state.expression, onChange: (x) => this.setState({ expression: x.target.value }), style: { fontFamily: 'monospace', fontSize: 12 } }),
91
+ React.createElement(Input_1.default, { type: "text", "data-name": "query-input", placeholder: "Query", spellCheck: false, value: this.state.expression, onChange: (x) => this.setState({ expression: x.target.value }), style: { fontFamily: 'monospace', fontSize: 12 } }),
92
92
  isExpressionValid ? (React.createElement(ButtonPlay_1.ButtonPlay, { onClick: () => this.runQuery(), tooltip: '', accessLevel: 'Full', variant: "text", tone: "neutral", disabled: this.state.expression == '' || this.state.expression == this.props.CurrentQuery, marginRight: 1 })) : (React.createElement(ButtonInvalid_1.ButtonInvalid, { variant: "text", tone: "neutral", tooltip: "Invalid Query", marginRight: 1 })),
93
93
  ' ',
94
94
  this.props.CurrentQuery !== '' && (React.createElement(ButtonClear_1.ButtonClear, { onClick: () => this.clearQuery(), tooltip: "Clear Query", accessLevel: 'Full' })))) : (React.createElement(Input_1.default, { type: "text", placeholder: "Query", spellCheck: false, value: this.state.expression, onChange: (x) => this.setState({ expression: x.target.value }), style: { width: '100%' } }));
@@ -6,7 +6,6 @@ const React = tslib_1.__importStar(require("react"));
6
6
  const react_1 = require("react");
7
7
  const rebass_1 = require("rebass");
8
8
  const ExpressionEditor_1 = require("../../../components/ExpressionEditor");
9
- const AdaptableContext_1 = require("../../AdaptableContext");
10
9
  const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
11
10
  const ModuleConstants_1 = require("../../../Utilities/Constants/ModuleConstants");
12
11
  const Tag_1 = require("../../../components/Tag");
@@ -22,14 +21,14 @@ const isValidNamedQueryExpression = (data, api) => {
22
21
  };
23
22
  exports.isValidNamedQueryExpression = isValidNamedQueryExpression;
24
23
  const renderNamedQueryExpressionSummary = (data) => {
24
+ const { api } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
25
25
  return (React.createElement(rebass_1.Text, { fontSize: 2 },
26
26
  "Expression: ",
27
- React.createElement(Tag_1.Tag, null, data.BooleanExpression)));
27
+ React.createElement(Tag_1.Tag, null, api.internalApi.getAdaptableQueryExpressionText(data))));
28
28
  };
29
29
  exports.renderNamedQueryExpressionSummary = renderNamedQueryExpressionSummary;
30
30
  const NamedQueryExpressionWizardSection = (props) => {
31
- const { api } = AdaptableContext_1.useAdaptable();
32
- const { data, moduleInfo } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
31
+ const { data, moduleInfo, api } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
33
32
  const initialData = react_1.useMemo(() => api.internalApi.getQueryPreviewData(), []);
34
33
  return (React.createElement(ExpressionEditor_1.ExpressionEditor, { allowSaveNamedQuery: false, type: 'boolean', module: moduleInfo.ModuleName, value: data.BooleanExpression, onChange: (BooleanExpression) => {
35
34
  props.onChange(Object.assign(Object.assign({}, data), { BooleanExpression }));
@@ -4,30 +4,29 @@ exports.StateManagementPopup = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
6
  const PopupPanel_1 = require("../Components/Popups/AdaptablePopup/PopupPanel");
7
- const rebass_1 = require("rebass");
8
7
  const HelpBlock_1 = tslib_1.__importDefault(require("../../components/HelpBlock"));
9
8
  const LoadButton_1 = require("./components/LoadButton");
10
9
  const ClearButton_1 = require("./components/ClearButton");
11
10
  const ExportDropdown_1 = require("./components/ExportDropdown");
12
11
  const Panel_1 = tslib_1.__importDefault(require("../../components/Panel"));
13
12
  const StateManagementPopup = (props) => {
14
- return (React.createElement(PopupPanel_1.PopupPanel, { headerText: props.moduleInfo.FriendlyName, glyphicon: props.moduleInfo.Glyph, infoLink: props.moduleInfo.HelpPage, infoLinkDisabled: !props.api.internalApi.isDocumentationLinksDisplayed() },
15
- React.createElement(rebass_1.Box, null,
16
- React.createElement(Panel_1.default, { header: 'User State', style: { height: 'auto' }, variant: "default", borderRadius: "none", marginTop: 3, marginRight: 2 },
17
- React.createElement(HelpBlock_1.default, { marginBottom: 2 }, 'Clear all current user state that has been persisted.'),
18
- React.createElement(HelpBlock_1.default, null, 'This will cause this window to close and any state you have previously created will be lost and the initial Predefined Config will then be reapplied.'),
19
- React.createElement(ClearButton_1.ClearButton, { tone: "error", variant: "raised", marginTop: 2, accessLevel: props.accessLevel, onClick: () => props.api.configApi.reloadPredefinedConfig() }, "Clear User State")),
20
- React.createElement(Panel_1.default, { header: 'Load Predefined Config', style: { height: 'auto' }, variant: "default", borderRadius: "none", marginTop: 3, marginRight: 2 },
21
- React.createElement(HelpBlock_1.default, { marginTop: 2 }, 'Load Predefined Config (from a .json file). This will cause this window to close.'),
22
- ' ',
23
- React.createElement(LoadButton_1.LoadButton, { tone: "info", variant: "raised", marginTop: 2, accessLevel: props.accessLevel, onLoad: (json) => props.api.configApi.reloadPredefinedConfig(json) }, "Load Predefined Config")),
24
- React.createElement(Panel_1.default, { header: 'Export Adaptable State', style: { height: 'auto' }, variant: "default", borderRadius: "none", marginTop: 3, marginRight: 2 },
25
- React.createElement(HelpBlock_1.default, { marginTop: 2, marginBottom: 2 }, 'Exports the currently persisted Adaptable state.'),
26
- ' ',
27
- React.createElement(ExportDropdown_1.ExportDropdown, { api: props.api, type: "adaptableState", marginRight: 3, style: { flex: 1, maxWidth: 'none' }, columns: ['label'] }, "Select Export Destination")),
28
- React.createElement(Panel_1.default, { header: 'Export Initial Predefined Config', style: { height: 'auto' }, variant: "default", borderRadius: "none", marginTop: 3, marginRight: 2 },
29
- React.createElement(HelpBlock_1.default, { marginTop: 2, marginBottom: 2 }, 'Exports the Predefined Config which was provided at design time.'),
30
- ' ',
31
- React.createElement(ExportDropdown_1.ExportDropdown, { api: props.api, type: "predefinedConfig", marginRight: 3, style: { flex: 1, maxWidth: 'none' }, columns: ['label'] }, "Select Export Destination")))));
13
+ const baseClassName = 'ab-ManageState';
14
+ return (React.createElement(PopupPanel_1.PopupPanel, { className: baseClassName, headerText: props.moduleInfo.FriendlyName, glyphicon: props.moduleInfo.Glyph, infoLink: props.moduleInfo.HelpPage, infoLinkDisabled: !props.api.internalApi.isDocumentationLinksDisplayed() },
15
+ React.createElement(Panel_1.default, { className: `${baseClassName}__panel`, "data-name": "user-state", header: 'User State', style: { height: 'auto' }, variant: "default", borderRadius: "none", marginRight: 2, mb: 2 },
16
+ React.createElement(HelpBlock_1.default, { marginBottom: 2 }, 'Clear all current user state that has been persisted.'),
17
+ React.createElement(HelpBlock_1.default, null, 'This will cause this window to close and any state you have previously created will be lost and the initial Predefined Config will then be reapplied.'),
18
+ React.createElement(ClearButton_1.ClearButton, { tone: "error", variant: "raised", marginTop: 2, accessLevel: props.accessLevel, onClick: () => props.api.configApi.reloadPredefinedConfig() }, "Clear User State")),
19
+ React.createElement(Panel_1.default, { className: `${baseClassName}__panel`, "data-name": "predefined-config", header: 'Load Predefined Config', style: { height: 'auto' }, variant: "default", borderRadius: "none", marginTop: 3, marginRight: 2, mb: 2 },
20
+ React.createElement(HelpBlock_1.default, { marginTop: 2 }, 'Load Predefined Config (from a .json file). This will cause this window to close.'),
21
+ ' ',
22
+ React.createElement(LoadButton_1.LoadButton, { tone: "info", variant: "raised", marginTop: 2, accessLevel: props.accessLevel, onLoad: (json) => props.api.configApi.reloadPredefinedConfig(json) }, "Load Predefined Config")),
23
+ React.createElement(Panel_1.default, { className: `${baseClassName}__panel`, "data-name": "adaptable-state", header: 'Export Adaptable State', style: { height: 'auto' }, variant: "default", borderRadius: "none", marginTop: 3, marginRight: 2, mb: 2 },
24
+ React.createElement(HelpBlock_1.default, { marginTop: 2, marginBottom: 2 }, 'Exports the currently persisted Adaptable state.'),
25
+ ' ',
26
+ React.createElement(ExportDropdown_1.ExportDropdown, { api: props.api, type: "adaptableState", marginRight: 3, style: { flex: 1, maxWidth: 'none' }, columns: ['label'] }, "Select Export Destination")),
27
+ React.createElement(Panel_1.default, { className: `${baseClassName}__panel`, "data-name": "initial-predefined-config", header: 'Export Initial Predefined Config', style: { height: 'auto' }, variant: "default", borderRadius: "none", marginTop: 3, marginRight: 2, mb: 2 },
28
+ React.createElement(HelpBlock_1.default, { marginTop: 2, marginBottom: 2 }, 'Exports the Predefined Config which was provided at design time.'),
29
+ ' ',
30
+ React.createElement(ExportDropdown_1.ExportDropdown, { api: props.api, type: "predefinedConfig", marginRight: 3, style: { flex: 1, maxWidth: 'none' }, columns: ['label'] }, "Select Export Destination"))));
32
31
  };
33
32
  exports.StateManagementPopup = StateManagementPopup;
@@ -201,6 +201,7 @@ export declare class Adaptable implements IAdaptable {
201
201
  getVisibleRowNodes(): RowNode[];
202
202
  getAllRowNodes(config?: {
203
203
  includeGroupRows?: boolean;
204
+ filterFn?: (rowNode: RowNode) => boolean;
204
205
  }): RowNode[];
205
206
  getRowsInViewport(): RowNode[];
206
207
  selectNodes(rowNodes: RowNode[], clearSelection: boolean): void;
@@ -225,12 +226,11 @@ export declare class Adaptable implements IAdaptable {
225
226
  private mapColumnDefs;
226
227
  private getColDefsForSpecialColumns;
227
228
  getColDefsForFreeTextColumns(): ColDef[];
228
- setupColumnValueGetter({ col }: ColumnSetupInfo): void;
229
+ setupColumnValueGetter({ col, abColumn }: ColumnSetupInfo): void;
229
230
  setupColumnAggFunc({ col }: ColumnSetupInfo): void;
230
231
  private getColDefsForRowEditColumns;
231
232
  getColDefsForActionColumns(): ColDef[];
232
233
  updateColDefsForSpecialColumns(): void;
233
- private cleanupFloatingFilters_WORKAROUND;
234
234
  private getColDefsForCalculatedColumns;
235
235
  private isRegularColDef;
236
236
  private isGroupColDef;
@@ -253,6 +253,7 @@ export declare class Adaptable implements IAdaptable {
253
253
  buildStandaloneColumnHeader(adaptableColumn: AdaptableColumn): AdaptableMenuItem[];
254
254
  prepareGrid(): void;
255
255
  setupColumns(): void;
256
+ revertGridOptionsPropertiesToUserValue<T extends keyof GridOptions>(propertyNames: T[]): void;
256
257
  setGridOptionsProperty<T extends keyof GridOptions>(propertyName: T, propertyGetter: (userPropertyValue: GridOptions[T]) => GridOptions[T] | undefined): void;
257
258
  setColDefProperty<T extends keyof ColDef>(col: Column, propertyName: T, propertyGetter: (userPropertyValue: ColDef[T]) => ColDef[T] | undefined): void;
258
259
  private getUserColDefProperty;
@@ -263,6 +264,9 @@ export declare class Adaptable implements IAdaptable {
263
264
  setupColumnCellRenderer({ col, colId, abColumn }: ColumnSetupInfo): void;
264
265
  setupColumnTooltipValueGetter({ col, colId, abColumn }: ColumnSetupInfo): void;
265
266
  setupColumnQuickFilerText({ col, abColumn }: ColumnSetupInfo): void;
267
+ setupAllowedAggFuncs({ col, abColumn }: ColumnSetupInfo): void;
268
+ triggerSetupColumnKeyCreator(colId: string): void;
269
+ setupColumnKeyCreator(columnSetupInfo: ColumnSetupInfo): void;
266
270
  setupColumnHeader({ col, abColumn }: ColumnSetupInfo): boolean;
267
271
  setupColumnFilter({ col, colDef }: ColumnSetupInfo): void;
268
272
  setupColumnFloatingFilter({ col, colDef }: ColumnSetupInfo): void;
@@ -271,7 +275,6 @@ export declare class Adaptable implements IAdaptable {
271
275
  setupColumnValueSetter({ col, colId, abColumn }: ColumnSetupInfo): void;
272
276
  setupColumnComparator({ col, colId, abColumn }: ColumnSetupInfo): void;
273
277
  private applyCurrentTheme;
274
- private getInitialGroupOrderComparator;
275
278
  private applyFinalRendering;
276
279
  private isModulePresent;
277
280
  private getPreviousColDefInfo;
@@ -361,6 +364,12 @@ export declare class Adaptable implements IAdaptable {
361
364
  initLicenseService(): LicenseService;
362
365
  showCharts(charts: ChartModel[]): ChartRef[];
363
366
  getChartModels(): ChartModel[];
367
+ private getActiveAdaptableAggFuncForCol;
368
+ private registerAdaptableAggFuncs;
369
+ /**
370
+ * When reading the state from the grid, we have to make sure 'avg' is not overriden with the 'avg' string.
371
+ */
372
+ private handleUpdateWeightedAvgFromGrid;
364
373
  }
365
374
  export declare class AdaptableNoCodeWizard implements IAdaptableNoCodeWizard {
366
375
  private init;