@adaptabletools/adaptable-cjs 18.0.0-canary.15 → 18.0.0-canary.17

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 (84) hide show
  1. package/package.json +1 -1
  2. package/src/AdaptableInterfaces/IAdaptable.d.ts +0 -2
  3. package/src/AdaptableOptions/ColumnFilterOptions.d.ts +7 -0
  4. package/src/AdaptableOptions/MenuOptions.d.ts +5 -1
  5. package/src/AdaptableOptions/MenuOptions.js +72 -71
  6. package/src/Api/GridApi.d.ts +1 -1
  7. package/src/Api/Implementation/CellSummaryApiImpl.d.ts +0 -5
  8. package/src/Api/Implementation/CellSummaryApiImpl.js +2 -23
  9. package/src/Api/Implementation/GridApiImpl.d.ts +1 -1
  10. package/src/Api/Implementation/GridApiImpl.js +1 -1
  11. package/src/Api/Internal/AdaptableInternalApi.d.ts +0 -2
  12. package/src/Api/Internal/AdaptableInternalApi.js +0 -3
  13. package/src/PredefinedConfig/Common/Enums.d.ts +2 -1
  14. package/src/PredefinedConfig/Common/Enums.js +1 -0
  15. package/src/PredefinedConfig/Common/Menu.d.ts +10 -1
  16. package/src/PredefinedConfig/Common/Menu.js +72 -0
  17. package/src/PredefinedConfig/Common/RowSummary.d.ts +3 -1
  18. package/src/PredefinedConfig/Common/RowSummary.js +17 -1
  19. package/src/Redux/ActionsReducers/LayoutRedux.js +12 -10
  20. package/src/Strategy/AdaptableModuleBase.d.ts +6 -5
  21. package/src/Strategy/AdaptableModuleBase.js +9 -8
  22. package/src/Strategy/AlertModule.js +1 -1
  23. package/src/Strategy/BulkUpdateModule.js +1 -1
  24. package/src/Strategy/CalculatedColumnModule.js +1 -1
  25. package/src/Strategy/CellSummaryModule.d.ts +7 -6
  26. package/src/Strategy/CellSummaryModule.js +37 -12
  27. package/src/Strategy/ColumnFilterModule.js +8 -7
  28. package/src/Strategy/ColumnInfoModule.js +2 -0
  29. package/src/Strategy/CommentModule.js +2 -2
  30. package/src/Strategy/CustomSortModule.js +2 -1
  31. package/src/Strategy/DashboardModule.js +8 -7
  32. package/src/Strategy/DataImportModule.d.ts +1 -1
  33. package/src/Strategy/DataImportModule.js +5 -5
  34. package/src/Strategy/ExportModule.d.ts +1 -0
  35. package/src/Strategy/ExportModule.js +17 -2
  36. package/src/Strategy/Fdc3Module.js +3 -0
  37. package/src/Strategy/FlashingCellModule.js +4 -4
  38. package/src/Strategy/FormatColumnModule.js +6 -4
  39. package/src/Strategy/FreeTextColumnModule.js +1 -1
  40. package/src/Strategy/GridInfoModule.js +2 -0
  41. package/src/Strategy/LayoutModule.js +31 -22
  42. package/src/Strategy/NoteModule.js +2 -2
  43. package/src/Strategy/PlusMinusModule.js +1 -1
  44. package/src/Strategy/SettingsPanelModule.js +3 -3
  45. package/src/Strategy/SmartEditModule.js +1 -1
  46. package/src/Strategy/StyledColumnModule.d.ts +1 -0
  47. package/src/Strategy/StyledColumnModule.js +23 -5
  48. package/src/Strategy/SystemStatusModule.js +2 -2
  49. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +2 -2
  50. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +125 -3
  51. package/src/Utilities/MenuItem.d.ts +7 -4
  52. package/src/Utilities/MenuItem.js +6 -3
  53. package/src/Utilities/Services/LicenseService/index.js +1 -1
  54. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UIOptionsStatusbarForm.js +1 -1
  55. package/src/View/Components/AdaptableDateInput/index.d.ts +1 -1
  56. package/src/View/Components/AdaptableInput/AdaptableDateInlineInput.d.ts +5 -0
  57. package/src/View/Components/AdaptableInput/AdaptableDateInlineInput.js +46 -0
  58. package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +5 -2
  59. package/src/View/Components/FilterForm/FilterForm.js +20 -12
  60. package/src/View/Components/FilterForm/QuickFilterForm.js +15 -8
  61. package/src/View/Components/ValueSelector/index.js +1 -1
  62. package/src/View/GridFilter/GridFilterViewPanel.js +2 -2
  63. package/src/View/Layout/Wizard/LayoutWizard.js +25 -1
  64. package/src/View/Layout/Wizard/sections/ColumnsSection.js +1 -1
  65. package/src/View/Layout/Wizard/sections/RowSummarySection.d.ts +1 -0
  66. package/src/View/Layout/Wizard/sections/RowSummarySection.js +29 -4
  67. package/src/agGrid/AdaptableAgGrid.d.ts +0 -2
  68. package/src/agGrid/AdaptableAgGrid.js +14 -14
  69. package/src/agGrid/AgGridMenuAdapter.js +7 -5
  70. package/src/agGrid/defaultAdaptableOptions.js +1 -0
  71. package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +2 -2
  72. package/src/agGrid/weightedAverage.d.ts +0 -2
  73. package/src/agGrid/weightedAverage.js +1 -56
  74. package/src/components/Datepicker/index.js +10 -2
  75. package/src/components/Input/index.d.ts +1 -2
  76. package/src/components/Textarea/index.d.ts +2 -2
  77. package/src/env.js +2 -2
  78. package/src/metamodel/adaptable.metamodel.d.ts +6 -0
  79. package/src/metamodel/adaptable.metamodel.js +1 -1
  80. package/tsconfig.cjs.tsbuildinfo +1 -1
  81. package/src/Utilities/Services/Interface/ISummaryService.d.ts +0 -17
  82. package/src/Utilities/Services/Interface/ISummaryService.js +0 -15
  83. package/src/Utilities/Services/SummaryService.d.ts +0 -10
  84. package/src/Utilities/Services/SummaryService.js +0 -21
@@ -1,12 +1,12 @@
1
1
  /// <reference types="react" />
2
- import { AdaptableModuleBase } from './AdaptableModuleBase';
3
- import { ICellSummaryModule } from './Interface/ICellSummaryModule';
4
- import { SelectedCellInfo } from '../PredefinedConfig/Selection/SelectedCellInfo';
5
- import { AdaptableMenuItem, ContextMenuContext } from '../PredefinedConfig/Common/Menu';
6
2
  import { AdaptableApi } from '../Api/AdaptableApi';
7
- import { AccessLevel } from '../PredefinedConfig/Common/Entitlement';
8
- import { CellSummmary } from '../PredefinedConfig/Common/CellSummary';
9
3
  import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
4
+ import { CellSummmary } from '../PredefinedConfig/Common/CellSummary';
5
+ import { AccessLevel } from '../PredefinedConfig/Common/Entitlement';
6
+ import { AdaptableMenuItem, ContextMenuContext } from '../PredefinedConfig/Common/Menu';
7
+ import { SelectedCellInfo } from '../PredefinedConfig/Selection/SelectedCellInfo';
8
+ import { AdaptableModuleBase } from './AdaptableModuleBase';
9
+ import { ICellSummaryModule } from './Interface/ICellSummaryModule';
10
10
  export declare class CellSummaryModule extends AdaptableModuleBase implements ICellSummaryModule {
11
11
  cachedCellSummary: WeakMap<SelectedCellInfo<any>, CellSummmary>;
12
12
  constructor(api: AdaptableApi);
@@ -15,6 +15,7 @@ export declare class CellSummaryModule extends AdaptableModuleBase implements IC
15
15
  addContextMenuItems(menuContext: ContextMenuContext): AdaptableMenuItem[] | undefined;
16
16
  private createCellSummaryMenuItem;
17
17
  createCellSummary(selectedCellInfo: SelectedCellInfo): CellSummmary;
18
+ private getWeightedAverageCellSummary;
18
19
  getViewProperties(): {
19
20
  getStatusBarPanelProps(): {
20
21
  view: () => JSX.Element;
@@ -2,11 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CellSummaryModule = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const AdaptableModuleBase_1 = require("./AdaptableModuleBase");
6
5
  const ModuleConstants = tslib_1.__importStar(require("../Utilities/Constants/ModuleConstants"));
7
6
  const ArrayExtensions_1 = require("../Utilities/Extensions/ArrayExtensions");
8
7
  const Helper_1 = require("../Utilities/Helpers/Helper");
8
+ const AggregatedScalarLiveValue_1 = require("../Utilities/Services/AggregatedScalarLiveValue");
9
9
  const CellSummaryStatusPanel_1 = require("../View/CellSummary/CellSummaryStatusPanel");
10
+ const AdaptableModuleBase_1 = require("./AdaptableModuleBase");
10
11
  class CellSummaryModule extends AdaptableModuleBase_1.AdaptableModuleBase {
11
12
  constructor(api) {
12
13
  super(ModuleConstants.CellSummaryModuleId, ModuleConstants.CellSummaryFriendlyName, 'cells', 'CellSummaryPopup', 'See summary information on a group of cells using multiple summary operations', api);
@@ -40,6 +41,7 @@ class CellSummaryModule extends AdaptableModuleBase_1.AdaptableModuleBase {
40
41
  }
41
42
  createCellSummaryMenuItem(popUpParams) {
42
43
  return this.createMainMenuItemShowPopup({
44
+ Name: 'cell-summary-show',
43
45
  Label: 'See Cell Summary',
44
46
  ComponentName: this.moduleInfo.Popup,
45
47
  Icon: this.moduleInfo.Glyph,
@@ -92,17 +94,17 @@ class CellSummaryModule extends AdaptableModuleBase_1.AdaptableModuleBase {
92
94
  Only: '',
93
95
  };
94
96
  }
97
+ const columnId = selectedCellInfo.columns[0].columnId;
98
+ const rowNodes = selectedCellInfo.gridCells.map((gc) => gc.rowNode);
95
99
  const handleExpression = (functionName) => {
96
- const columnId = selectedCellInfo.columns[0].columnId;
97
- const rowNodes = selectedCellInfo.gridCells.map((gc) => gc.rowNode);
98
- return this.api.internalApi
99
- .getSummaryService().evaluateExpressionValue({
100
- expression: {
101
- function: functionName,
102
- },
103
- columnId: columnId,
104
- getRowNodes: () => rowNodes,
105
- }, ModuleConstants.CellSummaryModuleId);
100
+ const aggScalarValue = new AggregatedScalarLiveValue_1.AggregatedScalarLiveValue({
101
+ aggregatedScalarExpression: `${functionName}([${columnId}])`,
102
+ }, ModuleConstants.CellSummaryModuleId, this.api, () => rowNodes);
103
+ let value = aggScalarValue.getGlobalAggregatedValue();
104
+ if (typeof value === 'number' && !isNaN(value)) {
105
+ value = Helper_1.Helper.roundNumber(value, 2);
106
+ }
107
+ return value;
106
108
  };
107
109
  const sumValue = hasNumericColumns ? handleExpression('SUM') : null;
108
110
  const avgValue = hasNumericColumns ? Helper_1.Helper.roundNumber(handleExpression('AVG'), 2) : null;
@@ -127,8 +129,11 @@ class CellSummaryModule extends AdaptableModuleBase_1.AdaptableModuleBase {
127
129
  Only: distinctValue == 1 ? JSON.stringify(allValues[0]) : '',
128
130
  };
129
131
  numericValues = [...newNumericValues];
132
+ const weightedAverage = this.getWeightedAverageCellSummary(columnId, rowNodes);
133
+ if (weightedAverage !== null) {
134
+ selectedCellSummary.Weighted_Average = weightedAverage;
135
+ }
130
136
  const operationDefinitions = this.api.cellSummaryApi.getCellSummaryOperationDefinitions();
131
- const api = this.api;
132
137
  operationDefinitions === null || operationDefinitions === void 0 ? void 0 : operationDefinitions.forEach((operation) => {
133
138
  if (operation.operationFunction) {
134
139
  const cellSummaryOperationContext = {
@@ -148,6 +153,26 @@ class CellSummaryModule extends AdaptableModuleBase_1.AdaptableModuleBase {
148
153
  this.cachedCellSummary.set(selectedCellInfo, selectedCellSummary);
149
154
  return selectedCellSummary;
150
155
  }
156
+ getWeightedAverageCellSummary(columnId, rowNodes) {
157
+ const currentLayout = this.api.layoutApi.getCurrentLayout();
158
+ if (currentLayout.AggregationColumns == undefined) {
159
+ return false;
160
+ }
161
+ const weightedAverageConfig = Object.entries(currentLayout.AggregationColumns).find(([colId, aggCol]) => typeof aggCol === 'object' && aggCol.type === 'weightedAverage' && colId === columnId);
162
+ if (!weightedAverageConfig) {
163
+ return null;
164
+ }
165
+ const { weightedColumnId } = weightedAverageConfig[1];
166
+ const expression = `AVG([${columnId}], WEIGHT([${weightedColumnId}]))`;
167
+ const aggScalarValue = new AggregatedScalarLiveValue_1.AggregatedScalarLiveValue({
168
+ aggregatedScalarExpression: expression,
169
+ }, ModuleConstants.CellSummaryModuleId, this.api, () => rowNodes);
170
+ let value = aggScalarValue.getGlobalAggregatedValue();
171
+ if (typeof value === 'number' && !isNaN(value)) {
172
+ value = Helper_1.Helper.roundNumber(value, 2);
173
+ }
174
+ return value;
175
+ }
151
176
  getViewProperties() {
152
177
  return {
153
178
  getStatusBarPanelProps() {
@@ -61,13 +61,13 @@ class ColumnFilterModule extends AdaptableModuleBase_1.AdaptableModuleBase {
61
61
  this.api.columnFilterApi.internalApi.createEqualityColumnFilterForCell(menuContext.selectedCellInfo.gridCells[0]);
62
62
  };
63
63
  return [
64
- this.createColumnMenuItemClickFunction(isMultiple ? 'Filter on Cell Values' : 'Filter on Cell Value', this.moduleInfo.Glyph, clickFunction),
64
+ this.createColumnMenuItemClickFunction('filter-cell-value', isMultiple ? 'Filter on Cell Values' : 'Filter on Cell Value', this.moduleInfo.Glyph, clickFunction),
65
65
  ];
66
66
  }
67
67
  else {
68
68
  let filterSubMenuItems = [];
69
- filterSubMenuItems.push(this.createColumnMenuItemReduxAction('Clear Filter', 'close', LayoutRedux.LayoutColumnFilterClear(existingColumnFilter)));
70
- filterSubMenuItems.push(this.createColumnMenuItemClickFunction(existingColumnFilter.IsSuspended ? 'Unsuspend Filter' : 'Suspend Filter', existingColumnFilter.IsSuspended ? 'resume' : 'pause', existingColumnFilter.IsSuspended
69
+ filterSubMenuItems.push(this.createColumnMenuItemReduxAction('filter-clear', 'Clear Filter', 'close', LayoutRedux.LayoutColumnFilterClear(existingColumnFilter)));
70
+ filterSubMenuItems.push(this.createColumnMenuItemClickFunction('filter-suspend', existingColumnFilter.IsSuspended ? 'Unsuspend Filter' : 'Suspend Filter', existingColumnFilter.IsSuspended ? 'resume' : 'pause', existingColumnFilter.IsSuspended
71
71
  ? () => {
72
72
  this.api.columnFilterApi.unSuspendColumnFilter(existingColumnFilter);
73
73
  }
@@ -75,7 +75,7 @@ class ColumnFilterModule extends AdaptableModuleBase_1.AdaptableModuleBase {
75
75
  this.api.columnFilterApi.suspendColumnFilter(existingColumnFilter);
76
76
  }));
77
77
  return [
78
- {
78
+ { name: 'filter',
79
79
  label: this.moduleInfo.FriendlyName,
80
80
  isVisible: true,
81
81
  module: this.moduleInfo.ModuleName,
@@ -98,21 +98,22 @@ class ColumnFilterModule extends AdaptableModuleBase_1.AdaptableModuleBase {
98
98
  const isFilterVisible = this.api.columnFilterApi.isQuickFilterVisible();
99
99
  if (this.isModuleEditable() &&
100
100
  this.api.optionsApi.getColumnFilterOptions().useAdaptableColumnFiltering) {
101
- filterSubMenuItems.push(this.createColumnMenuItemReduxAction(isFilterVisible ? 'Hide Filter Bar' : 'Show Filter Bar', isFilterVisible ? 'unchecked' : 'check', isFilterVisible
101
+ filterSubMenuItems.push(this.createColumnMenuItemReduxAction('filter-bar-visbility', isFilterVisible ? 'Hide Filter Bar' : 'Show Filter Bar', isFilterVisible ? 'unchecked' : 'check', isFilterVisible
102
102
  ? SystemRedux.SystemQuickFilterBarHide()
103
103
  : SystemRedux.SystemQuickFilterBarShow()));
104
104
  }
105
105
  }
106
106
  const existingColumnFilter = this.getExistingColumnFilter(column);
107
107
  if (existingColumnFilter) {
108
- filterSubMenuItems.push(this.createColumnMenuItemReduxAction('Clear Filter', 'close', LayoutRedux.LayoutColumnFilterClear(existingColumnFilter)));
109
- filterSubMenuItems.push(this.createColumnMenuItemReduxAction(existingColumnFilter.IsSuspended ? 'Unsuspend Filter' : 'Suspend Filter', existingColumnFilter.IsSuspended ? 'resume' : 'pause', existingColumnFilter.IsSuspended
108
+ filterSubMenuItems.push(this.createColumnMenuItemReduxAction('filter-clear', 'Clear Filter', 'close', LayoutRedux.LayoutColumnFilterClear(existingColumnFilter)));
109
+ filterSubMenuItems.push(this.createColumnMenuItemReduxAction('filter-suspend', existingColumnFilter.IsSuspended ? 'Unsuspend Filter' : 'Suspend Filter', existingColumnFilter.IsSuspended ? 'resume' : 'pause', existingColumnFilter.IsSuspended
110
110
  ? LayoutRedux.LayoutColumnFilterUnSuspend(existingColumnFilter)
111
111
  : LayoutRedux.LayoutColumnFilterSuspend(existingColumnFilter)));
112
112
  }
113
113
  if (ArrayExtensions_1.default.IsNotNullOrEmpty(filterSubMenuItems)) {
114
114
  return [
115
115
  {
116
+ name: 'filter',
116
117
  label: this.moduleInfo.FriendlyName,
117
118
  isVisible: true,
118
119
  module: this.moduleInfo.ModuleName,
@@ -19,6 +19,7 @@ class ColumnInfoModule extends AdaptableModuleBase_1.AdaptableModuleBase {
19
19
  };
20
20
  return [
21
21
  this.createMainMenuItemShowPopup({
22
+ Name: 'column-info',
22
23
  Label: 'Column Info',
23
24
  ComponentName: this.moduleInfo.Popup,
24
25
  Icon: this.moduleInfo.Glyph,
@@ -35,6 +36,7 @@ class ColumnInfoModule extends AdaptableModuleBase_1.AdaptableModuleBase {
35
36
  };
36
37
  return [
37
38
  this.createMainMenuItemShowPopup({
39
+ Name: 'column-info',
38
40
  Label: 'Column Info',
39
41
  ComponentName: this.moduleInfo.Popup,
40
42
  Icon: this.moduleInfo.Glyph,
@@ -62,12 +62,12 @@ class CommentModule extends AdaptableModuleBase_1.AdaptableModuleBase {
62
62
  return items;
63
63
  }
64
64
  if (comments) {
65
- items.push(this.createColumnMenuItemClickFunction('Remove Comments', this.moduleInfo.Glyph, () => {
65
+ items.push(this.createColumnMenuItemClickFunction('comment-remove', 'Remove Comment', this.moduleInfo.Glyph, () => {
66
66
  this.api.commentApi.deleteCommentThread(cellAddress);
67
67
  }));
68
68
  }
69
69
  else {
70
- items.push(this.createColumnMenuItemClickFunction('Add Comment', this.moduleInfo.Glyph, () => {
70
+ items.push(this.createColumnMenuItemClickFunction('comment-add', 'Add Comment', this.moduleInfo.Glyph, () => {
71
71
  // add an empty one
72
72
  this.api.commentApi.addCommentThread(Object.assign(Object.assign({}, cellAddress), { Comments: [] }));
73
73
  requestAnimationFrame(() => {
@@ -38,8 +38,9 @@ class CustomSortModule extends AdaptableModuleBase_1.AdaptableModuleBase {
38
38
  action: customSort ? 'Edit' : 'New',
39
39
  source: 'ColumnMenu',
40
40
  };
41
+ let name = customSort ? 'custom-sort-edit' : 'custom-sort-add';
41
42
  return [
42
- this.createColumnMenuItemShowPopup(label + 'Custom Sort', this.moduleInfo.Popup, this.moduleInfo.Glyph, popupParam),
43
+ this.createColumnMenuItemShowPopup(name, label + 'Custom Sort', this.moduleInfo.Popup, this.moduleInfo.Glyph, popupParam),
43
44
  ];
44
45
  }
45
46
  }
@@ -31,28 +31,29 @@ class DashboardModule extends AdaptableModuleBase_1.AdaptableModuleBase {
31
31
  if (this.isModuleAvailable()) {
32
32
  let menuItems = [];
33
33
  if (this.isModuleEditable()) {
34
- menuItems.push(this.createColumnMenuItemClickFunction('Configure', 'settings', () => this.api.dashboardApi.openDashboardSettingsPanel()));
34
+ menuItems.push(this.createColumnMenuItemClickFunction('dashboard-configure', 'Configure', 'settings', () => this.api.dashboardApi.openDashboardSettingsPanel()));
35
35
  }
36
36
  if (this.api.dashboardApi.getDashboardState().IsCollapsed) {
37
- menuItems.push(this.createColumnMenuItemReduxAction('Expand', 'expand', DashboardRedux.DashboardSetIsCollapsed(false)));
37
+ menuItems.push(this.createColumnMenuItemReduxAction('dashboard-expand', 'Expand', 'expand', DashboardRedux.DashboardSetIsCollapsed(false)));
38
38
  }
39
39
  else {
40
- menuItems.push(this.createColumnMenuItemReduxAction('Collapse', 'collapse', DashboardRedux.DashboardSetIsCollapsed(true)));
40
+ menuItems.push(this.createColumnMenuItemReduxAction('dashboard-collapse', 'Collapse', 'collapse', DashboardRedux.DashboardSetIsCollapsed(true)));
41
41
  }
42
42
  if (this.api.dashboardApi.getDashboardState().IsFloating) {
43
- menuItems.push(this.createColumnMenuItemReduxAction('Dock', 'dock', DashboardRedux.DashboardSetIsFloating(false)));
43
+ menuItems.push(this.createColumnMenuItemReduxAction('dashboard-dock', 'Dock', 'dock', DashboardRedux.DashboardSetIsFloating(false)));
44
44
  }
45
45
  else if (this.api.optionsApi.getDashboardOptions().canFloat) {
46
- menuItems.push(this.createColumnMenuItemReduxAction('Float', 'dock', DashboardRedux.DashboardSetIsFloating(true)));
46
+ menuItems.push(this.createColumnMenuItemReduxAction('dashboard-float', 'Float', 'dock', DashboardRedux.DashboardSetIsFloating(true)));
47
47
  }
48
48
  if (this.api.dashboardApi.getDashboardState().IsHidden) {
49
- menuItems.push(this.createColumnMenuItemReduxAction('Show', 'visibility-on-bold', DashboardRedux.DashboardSetIsHidden(false)));
49
+ menuItems.push(this.createColumnMenuItemReduxAction('dashboard-show', 'Show', 'visibility-on-bold', DashboardRedux.DashboardSetIsHidden(false)));
50
50
  }
51
51
  else {
52
- menuItems.push(this.createColumnMenuItemReduxAction('Hide', 'visibility-off-bold', DashboardRedux.DashboardSetIsHidden(true)));
52
+ menuItems.push(this.createColumnMenuItemReduxAction('dashboard-hide', 'Hide', 'visibility-off-bold', DashboardRedux.DashboardSetIsHidden(true)));
53
53
  }
54
54
  return [
55
55
  {
56
+ name: 'dashboard',
56
57
  label: this.moduleInfo.FriendlyName,
57
58
  isVisible: true,
58
59
  module: this.moduleInfo.ModuleName,
@@ -7,5 +7,5 @@ export declare class DataImportModule extends AdaptableModuleBase implements IMo
7
7
  addModuleMenuItem(source: 'ModuleMenu' | 'ModuleButton'): AdaptableMenuItem | undefined;
8
8
  addContextMenuItems(): AdaptableMenuItem[] | undefined;
9
9
  addColumnMenuItems(): AdaptableMenuItem[] | undefined;
10
- private getOpenPopupMenuItem;
10
+ private createDataImportMenuItem;
11
11
  }
@@ -10,27 +10,27 @@ class DataImportModule extends AdaptableModuleBase_1.AdaptableModuleBase {
10
10
  }
11
11
  addModuleMenuItem(source) {
12
12
  if (this.isModuleAvailable()) {
13
- return this.getOpenPopupMenuItem(source);
13
+ return this.createDataImportMenuItem(source);
14
14
  }
15
15
  }
16
16
  addContextMenuItems() {
17
17
  if (this.isModuleAvailable()) {
18
- return [this.getOpenPopupMenuItem('ContextMenu')];
18
+ return [this.createDataImportMenuItem('ContextMenu')];
19
19
  }
20
20
  return undefined;
21
21
  }
22
22
  addColumnMenuItems() {
23
23
  if (this.isModuleAvailable()) {
24
- return [this.getOpenPopupMenuItem('ColumnMenu')];
24
+ return [this.createDataImportMenuItem('ColumnMenu')];
25
25
  }
26
26
  }
27
- getOpenPopupMenuItem(source) {
27
+ createDataImportMenuItem(source) {
28
28
  const moduleParams = {
29
29
  action: 'New',
30
30
  source: source,
31
31
  maxWidth: this.getPopupMaxWidth(),
32
32
  };
33
- return this.createColumnMenuItemShowPopup('Import Data', this.moduleInfo.Popup, this.moduleInfo.Glyph, moduleParams);
33
+ return this.createColumnMenuItemShowPopup('data-import', 'Import Data', this.moduleInfo.Popup, this.moduleInfo.Glyph, moduleParams);
34
34
  }
35
35
  }
36
36
  exports.DataImportModule = DataImportModule;
@@ -15,6 +15,7 @@ export declare class ExportModule extends AdaptableModuleBase implements IExport
15
15
  addContextMenuItems(menuContext: ContextMenuContext): AdaptableMenuItem[] | undefined;
16
16
  private buildReportMenuItems;
17
17
  private buildExportMenuItem;
18
+ private getMenuName;
18
19
  export(report: Report, exportDestination: ExportDestination | string): Promise<void>;
19
20
  private preProcessExport;
20
21
  private isCustomDestination;
@@ -90,15 +90,16 @@ class ExportModule extends AdaptableModuleBase_1.AdaptableModuleBase {
90
90
  buildReportMenuItems(report) {
91
91
  const menuItems = [];
92
92
  for (const destination of this.api.exportApi.getAvailableExportDestinations()) {
93
- menuItems.push(this.createColumnMenuItemClickFunction(destination, this.moduleInfo.Glyph, () => this.export(report, destination)));
93
+ menuItems.push(this.createColumnMenuItemClickFunction(this.getMenuName(destination), destination, this.moduleInfo.Glyph, () => this.export(report, destination)));
94
94
  }
95
95
  for (const customDestination of this.api.exportApi.getCustomDestinations()) {
96
- menuItems.push(this.createColumnMenuItemClickFunction(customDestination.name, this.moduleInfo.Glyph, () => this.export(report, customDestination.name)));
96
+ menuItems.push(this.createColumnMenuItemClickFunction('export-custom-destination', customDestination.name, this.moduleInfo.Glyph, () => this.export(report, customDestination.name)));
97
97
  }
98
98
  return menuItems;
99
99
  }
100
100
  buildExportMenuItem(label, subItems) {
101
101
  return {
102
+ name: 'export',
102
103
  label: label,
103
104
  module: this.moduleInfo.ModuleName,
104
105
  isVisible: true,
@@ -106,6 +107,20 @@ class ExportModule extends AdaptableModuleBase_1.AdaptableModuleBase {
106
107
  subItems: subItems,
107
108
  };
108
109
  }
110
+ getMenuName(exportDestination) {
111
+ switch (exportDestination) {
112
+ case Enums_1.ExportDestination.CSV:
113
+ return 'export-csv';
114
+ case Enums_1.ExportDestination.Clipboard:
115
+ return 'export-clipboard';
116
+ case Enums_1.ExportDestination.Excel:
117
+ return 'export-excel';
118
+ case Enums_1.ExportDestination.JSON:
119
+ return 'export-json';
120
+ case Enums_1.ExportDestination.Table:
121
+ return 'export-table';
122
+ }
123
+ }
109
124
  async export(report, exportDestination) {
110
125
  var _a;
111
126
  const cleanupExportProcess = () => {
@@ -31,6 +31,7 @@ class Fdc3Module extends AdaptableModuleBase_1.AdaptableModuleBase {
31
31
  contextMenuItems.sort((a, b) => a.label.localeCompare(b.label));
32
32
  if (contextMenuItems.length > 1) {
33
33
  const groupMenuItem = {
34
+ name: 'fdc3',
34
35
  module: this.moduleInfo.ModuleName,
35
36
  label: 'FDC3',
36
37
  icon: {
@@ -48,6 +49,7 @@ class Fdc3Module extends AdaptableModuleBase_1.AdaptableModuleBase {
48
49
  var _a, _b, _c;
49
50
  const { intentType, contextType } = intentConfig;
50
51
  const menuItem = {
52
+ name: 'fdc3-raise-intent',
51
53
  label: `Raise ${intentType}`,
52
54
  onClick: () => {
53
55
  this.getFdc3Api().raiseIntentFromRow(rowNode, intentType, contextType);
@@ -67,6 +69,7 @@ class Fdc3Module extends AdaptableModuleBase_1.AdaptableModuleBase {
67
69
  var _a, _b, _c;
68
70
  const { contextType } = contextConfig;
69
71
  const menuItem = {
72
+ name: 'fdc3-broadcast',
70
73
  label: `Broadcast ${this.getFdc3Api().getContextLabel(contextType)}`,
71
74
  onClick: () => {
72
75
  this.getFdc3Api().broadcastFromRow(rowNode, contextType);
@@ -73,11 +73,11 @@ class FlashingCellModule extends AdaptableModuleBase_1.AdaptableModuleBase {
73
73
  });
74
74
  if (flashingCellForCurrentColumn) {
75
75
  return [
76
- this.createColumnMenuItemReduxAction('Remove Flashing Cell', this.moduleInfo.Glyph, FlashingCellRedux.FlashingCellDefinitionDelete(flashingCellForCurrentColumn)),
76
+ this.createColumnMenuItemReduxAction('flashing-cell-delete', 'Delete Flashing Cell', this.moduleInfo.Glyph, FlashingCellRedux.FlashingCellDefinitionDelete(flashingCellForCurrentColumn)),
77
77
  ];
78
78
  }
79
79
  return [
80
- this.createColumnMenuItemReduxAction('Add Flashing Cell', this.moduleInfo.Glyph, FlashingCellRedux.FlashingCellDefinitionAdd({
80
+ this.createColumnMenuItemReduxAction('flashing-cell-add', 'Add Flashing Cell', this.moduleInfo.Glyph, FlashingCellRedux.FlashingCellDefinitionAdd({
81
81
  Scope: {
82
82
  ColumnIds: [column.columnId],
83
83
  },
@@ -99,11 +99,11 @@ class FlashingCellModule extends AdaptableModuleBase_1.AdaptableModuleBase {
99
99
  if (flashingCellForRow.flashTarget === 'row' ||
100
100
  (Array.isArray(flashingCellForRow === null || flashingCellForRow === void 0 ? void 0 : flashingCellForRow.flashTarget) &&
101
101
  flashingCellForRow.flashTarget.includes('row'))) {
102
- items.push(this.createColumnMenuItemReduxAction('Clear Flashing Row', this.moduleInfo.Glyph, SystemRedux.SystemFlashingCellDelete(flashingCellForRow)));
102
+ items.push(this.createColumnMenuItemReduxAction('flashing-row-clear', 'Clear Flashing Row', this.moduleInfo.Glyph, SystemRedux.SystemFlashingCellDelete(flashingCellForRow)));
103
103
  }
104
104
  }
105
105
  else if (flashingCellForCell && flashingCellForCell.flashTarget === 'cell') {
106
- items.push(this.createColumnMenuItemReduxAction('Clear Flashing Cell', this.moduleInfo.Glyph, SystemRedux.SystemFlashingCellDelete(flashingCellForCell)));
106
+ items.push(this.createColumnMenuItemReduxAction('flashing-cell-clear', 'Clear Flashing Cell', this.moduleInfo.Glyph, SystemRedux.SystemFlashingCellDelete(flashingCellForCell)));
107
107
  }
108
108
  }
109
109
  }
@@ -49,12 +49,12 @@ class FormatColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
49
49
  action: 'New',
50
50
  source: 'ColumnMenu',
51
51
  };
52
- const createFormatColumnMenuItem = this.createColumnMenuItemShowPopup('Create', this.moduleInfo.Popup, 'plus', createPopupParam);
52
+ const createFormatColumnMenuItem = this.createColumnMenuItemShowPopup('format-column-add', 'Create', this.moduleInfo.Popup, 'plus', createPopupParam);
53
53
  const formatColumnsForColumn = this.api.formatColumnApi.getFormatColumnsForColumnId(column.columnId);
54
54
  // .filter((fc) => this.api.scopeApi.isSingleColumnScope(fc.Scope));
55
55
  // if no formats then just show Create
56
56
  if (ArrayExtensions_1.default.IsNullOrEmpty(formatColumnsForColumn)) {
57
- returnColumnMenuItems.push(this.createColumnMenuItemShowPopup('Create Format Column', this.moduleInfo.Popup, this.moduleInfo.Glyph, createPopupParam));
57
+ returnColumnMenuItems.push(this.createColumnMenuItemShowPopup('format-column-add', 'Create Format Column', this.moduleInfo.Popup, this.moduleInfo.Glyph, createPopupParam));
58
58
  // if 1 format then show a Create and an Edit
59
59
  }
60
60
  else if (formatColumnsForColumn.length == 1) {
@@ -64,8 +64,9 @@ class FormatColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
64
64
  value: formatColumnsForColumn[0],
65
65
  source: 'ColumnMenu',
66
66
  };
67
- const editFormatColumnMenuItem = this.createColumnMenuItemShowPopup('Edit', this.moduleInfo.Popup, 'edit', editPopupParam);
67
+ const editFormatColumnMenuItem = this.createColumnMenuItemShowPopup('format-column-edit', 'Edit', this.moduleInfo.Popup, 'edit', editPopupParam);
68
68
  returnColumnMenuItems.push({
69
+ name: 'format-column',
69
70
  label: 'Format Column',
70
71
  module: this.moduleInfo.ModuleName,
71
72
  isVisible: true,
@@ -80,8 +81,9 @@ class FormatColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
80
81
  const moduleInfo = this.api.internalApi
81
82
  .getModuleService()
82
83
  .getModuleInfoByModule('FormatColumn');
83
- const editFormatColumnMenuItem = this.createColumnMenuItemReduxAction('Show Current', this.moduleInfo.Glyph, PopupRedux.PopupShowScreen('FormatColumn', moduleInfo.Popup));
84
+ const editFormatColumnMenuItem = this.createColumnMenuItemReduxAction('format-column-edit', 'Show Current', this.moduleInfo.Glyph, PopupRedux.PopupShowScreen('FormatColumn', moduleInfo.Popup));
84
85
  returnColumnMenuItems.push({
86
+ name: 'format-column',
85
87
  label: 'Format Column',
86
88
  module: this.moduleInfo.ModuleName,
87
89
  isVisible: true,
@@ -32,7 +32,7 @@ class FreeTextColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
32
32
  source: 'ColumnMenu',
33
33
  };
34
34
  return [
35
- this.createColumnMenuItemShowPopup('Edit Free Text Column', this.moduleInfo.Popup, this.moduleInfo.Glyph, popupParam),
35
+ this.createColumnMenuItemShowPopup('free-text-column-edit', 'Edit Free Text Column', this.moduleInfo.Popup, this.moduleInfo.Glyph, popupParam),
36
36
  ];
37
37
  }
38
38
  }
@@ -15,6 +15,7 @@ class GridInfoModule extends AdaptableModuleBase_1.AdaptableModuleBase {
15
15
  if (this.isModuleAvailable()) {
16
16
  return [
17
17
  this.createMainMenuItemShowPopup({
18
+ Name: 'grid-info',
18
19
  Label: 'Grid Info',
19
20
  ComponentName: this.moduleInfo.Popup,
20
21
  Icon: this.moduleInfo.Glyph,
@@ -26,6 +27,7 @@ class GridInfoModule extends AdaptableModuleBase_1.AdaptableModuleBase {
26
27
  if (this.isModuleAvailable()) {
27
28
  return [
28
29
  this.createMainMenuItemShowPopup({
30
+ Name: 'grid-info',
29
31
  Label: 'Grid Info',
30
32
  ComponentName: this.moduleInfo.Popup,
31
33
  Icon: this.moduleInfo.Glyph,
@@ -19,6 +19,7 @@ const windowFactory_1 = require("../View/Components/Popups/WindowPopups/windowFa
19
19
  const flattenDeep_1 = tslib_1.__importDefault(require("lodash/flattenDeep"));
20
20
  const StringExtensions_1 = tslib_1.__importDefault(require("../Utilities/Extensions/StringExtensions"));
21
21
  const getGridFilterPreview_1 = require("../View/Layout/Wizard/getGridFilterPreview");
22
+ const AggregatedScalarLiveValue_1 = require("../Utilities/Services/AggregatedScalarLiveValue");
22
23
  const SystemRedux_1 = require("../Redux/ActionsReducers/SystemRedux");
23
24
  const RowSummary_1 = require("../PredefinedConfig/Common/RowSummary");
24
25
  const Helper_1 = tslib_1.__importDefault(require("../Utilities/Helpers/Helper"));
@@ -148,7 +149,7 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
148
149
  if (this.isModuleEditable()) {
149
150
  const isReadOnlyLayout = this.api.layoutApi.isCurrentLayoutReadOnly();
150
151
  if (!isReadOnlyLayout) {
151
- returnColumnMenuItems.push(this.createColumnMenuItemShowPopup('Edit Layout', this.moduleInfo.Popup, this.moduleInfo.Glyph, {
152
+ returnColumnMenuItems.push(this.createColumnMenuItemShowPopup('layout-edit', 'Edit Layout', this.moduleInfo.Popup, this.moduleInfo.Glyph, {
152
153
  action: 'Edit',
153
154
  source: 'ColumnMenu',
154
155
  value: this.api.layoutApi.getCurrentLayout(),
@@ -156,10 +157,10 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
156
157
  }
157
158
  if (column) {
158
159
  if (!isReadOnlyLayout) {
159
- returnColumnMenuItems.push(this.createColumnMenuItemClickFunction('Change Caption', 'edit', () => this.api.layoutApi.showChangeColumnCaption(column)));
160
+ returnColumnMenuItems.push(this.createColumnMenuItemClickFunction('layout-column-caption-change', 'Change Caption', 'edit', () => this.api.layoutApi.showChangeColumnCaption(column)));
160
161
  }
161
162
  if (column.hideable) {
162
- returnColumnMenuItems.push(this.createColumnMenuItemClickFunction('Hide Column', 'visibility-off-bold', () => {
163
+ returnColumnMenuItems.push(this.createColumnMenuItemClickFunction('layout-column-hide', 'Hide Column', 'visibility-off-bold', () => {
163
164
  this.api.columnApi.hideColumn(column.columnId);
164
165
  }));
165
166
  }
@@ -168,23 +169,24 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
168
169
  if (column) {
169
170
  const hasExistingSelection = (_b = (_a = this.api.gridApi.getSelectedCellInfo()) === null || _a === void 0 ? void 0 : _a.gridCells) === null || _b === void 0 ? void 0 : _b.length;
170
171
  if (hasExistingSelection) {
171
- selectMenuItems.push(this.createColumnMenuItemClickFunction('Column (Preserve Selection)', 'column-add', () => {
172
+ selectMenuItems.push(this.createColumnMenuItemClickFunction('layout-column-select-preserve', 'Column (Preserve Selection)', 'column-add', () => {
172
173
  this.api.columnApi.addColumnToSelection(column.columnId);
173
174
  }));
174
- selectMenuItems.push(this.createColumnMenuItemClickFunction('Column (Reset Selection)', 'columns', () => {
175
+ selectMenuItems.push(this.createColumnMenuItemClickFunction('layout-column-select-reset', 'Column (Reset Selection)', 'columns', () => {
175
176
  this.api.columnApi.selectColumn(column.columnId);
176
177
  }));
177
178
  }
178
179
  else {
179
- selectMenuItems.push(this.createColumnMenuItemClickFunction('Column', 'columns', () => {
180
+ selectMenuItems.push(this.createColumnMenuItemClickFunction('layout-column-select', 'Column', 'columns', () => {
180
181
  this.api.columnApi.selectColumn(column.columnId);
181
182
  }));
182
183
  }
183
184
  }
184
- selectMenuItems.push(this.createColumnMenuItemClickFunction('Whole Grid', this.moduleInfo.Glyph, () => {
185
+ selectMenuItems.push(this.createColumnMenuItemClickFunction('layout-select-all', 'Whole Grid', this.moduleInfo.Glyph, () => {
185
186
  this.api.gridApi.selectAll();
186
187
  }));
187
188
  returnColumnMenuItems.push({
189
+ name: 'layout-select',
188
190
  label: 'Select',
189
191
  isVisible: true,
190
192
  module: this.moduleInfo.ModuleName,
@@ -199,7 +201,7 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
199
201
  addContextMenuItems(menuContext) {
200
202
  let returnColumnMenuItems = [];
201
203
  if (this.isModuleEditable() && !this.api.layoutApi.isCurrentLayoutReadOnly()) {
202
- returnColumnMenuItems.push(this.createColumnMenuItemShowPopup('Edit Layout', this.moduleInfo.Popup, this.moduleInfo.Glyph, {
204
+ returnColumnMenuItems.push(this.createColumnMenuItemShowPopup('layout-edit', 'Edit Layout', this.moduleInfo.Popup, this.moduleInfo.Glyph, {
203
205
  action: 'Edit',
204
206
  source: 'ColumnMenu',
205
207
  }));
@@ -211,18 +213,19 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
211
213
  let clickFunction = () => {
212
214
  this.api.gridApi.deselectAll();
213
215
  };
214
- returnColumnMenuItems.push(this.createColumnMenuItemClickFunction('Clear Selected Cells', 'undo', clickFunction));
216
+ returnColumnMenuItems.push(this.createColumnMenuItemClickFunction('layout-clear-selection', 'Clear Selected Cells', 'undo', clickFunction));
215
217
  if (this.isModuleAvailable()) {
216
218
  let gridMenuItems = [];
217
219
  let autoSizeFunction = () => {
218
220
  this.api.columnApi.autosizeAllColumns();
219
221
  };
220
- gridMenuItems.push(this.createColumnMenuItemClickFunction('Auto Size', 'arrow-expand', autoSizeFunction));
222
+ gridMenuItems.push(this.createColumnMenuItemClickFunction('layout-auto-size', 'Auto Size', 'arrow-expand', autoSizeFunction));
221
223
  let clickFunction = () => {
222
224
  this.api.gridApi.selectAll();
223
225
  };
224
- gridMenuItems.push(this.createColumnMenuItemClickFunction('Select', 'tab-unselected', clickFunction));
226
+ gridMenuItems.push(this.createColumnMenuItemClickFunction('layout-select-all', 'Select', 'tab-unselected', clickFunction));
225
227
  returnColumnMenuItems.push({
228
+ name: 'layout-grid',
226
229
  label: 'Grid',
227
230
  module: this.moduleInfo.ModuleName,
228
231
  isVisible: true,
@@ -294,6 +297,7 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
294
297
  pivotColumnId,
295
298
  };
296
299
  return {
300
+ name: 'layout-aggregated-view',
297
301
  module: this.moduleInfo.ModuleName,
298
302
  isVisible: true,
299
303
  label: 'Expand Aggregated Value',
@@ -468,6 +472,7 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
468
472
  */
469
473
  evaluateRowSummary(reason) {
470
474
  var _a;
475
+ const currentLayout = this.api.layoutApi.getCurrentLayout();
471
476
  const rowSummaries = (_a = this.api.layoutApi.getCurrentLayout().RowSummaries) !== null && _a !== void 0 ? _a : [];
472
477
  const rowSummariesResults = rowSummaries.map(({ ColumnsMap, Position }) => {
473
478
  return {
@@ -486,17 +491,21 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
486
491
  }
487
492
  if (!expressionLiveValue) {
488
493
  try {
489
- expressionLiveValue = this.api.internalApi
490
- .getAdaptableInstance()
491
- .SummaryService.evaluateScalarLiveValue({
492
- expression: {
493
- function: expression,
494
- },
495
- columnId: columnId,
496
- getRowNodes: () => {
497
- return this.api.gridApi.getVisibleRowNodes();
498
- },
499
- }, ModuleConstants.LayoutModuleId);
494
+ let aggregatedScalarExpression = `${expression}([${columnId}])`;
495
+ if (aggregatedScalarExpression.includes(RowSummary_1.WEIGHTED_AVERAGE_AGGREATED_FUNCTION) &&
496
+ currentLayout.AggregationColumns[columnId] &&
497
+ typeof currentLayout.AggregationColumns[columnId] === 'object') {
498
+ const weight = currentLayout.AggregationColumns[columnId]
499
+ .weightedColumnId;
500
+ if (weight) {
501
+ aggregatedScalarExpression = `AVG([${columnId}], WEIGHT([${weight}]))`;
502
+ }
503
+ }
504
+ expressionLiveValue = new AggregatedScalarLiveValue_1.AggregatedScalarLiveValue({
505
+ aggregatedScalarExpression,
506
+ }, ModuleConstants.LayoutModuleId, this.api, () => {
507
+ return this.api.gridApi.getVisibleRowNodes();
508
+ });
500
509
  }
501
510
  catch (e) {
502
511
  this.api.logError('Error evaluating row summary', e);
@@ -45,12 +45,12 @@ class NoteModule extends AdaptableModuleBase_1.AdaptableModuleBase {
45
45
  ColumnId: menuContext.adaptableColumn.columnId,
46
46
  })) !== null && _a !== void 0 ? _a : [];
47
47
  if (note) {
48
- items.push(this.createColumnMenuItemClickFunction('Remove Note', this.moduleInfo.Glyph, () => {
48
+ items.push(this.createColumnMenuItemClickFunction('note-remove', 'Remove Note', this.moduleInfo.Glyph, () => {
49
49
  this.api.noteApi.deleteNote(note);
50
50
  }));
51
51
  }
52
52
  else {
53
- items.push(this.createColumnMenuItemClickFunction('Add Note', this.moduleInfo.Glyph, () => {
53
+ items.push(this.createColumnMenuItemClickFunction('note-add', 'Add Note', this.moduleInfo.Glyph, () => {
54
54
  // add an empty one
55
55
  this.api.noteApi.addNote('', menuContext.primaryKeyValue, menuContext.adaptableColumn.columnId);
56
56
  this.api.internalApi.getCellPopupService().showPopup({