@adaptabletools/adaptable 18.0.0-canary.16 → 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 (69) hide show
  1. package/package.json +1 -1
  2. package/src/AdaptableInterfaces/IAdaptable.d.ts +0 -2
  3. package/src/AdaptableOptions/ColumnFilterOptions.d.ts +4 -3
  4. package/src/Api/GridApi.d.ts +1 -1
  5. package/src/Api/Implementation/CellSummaryApiImpl.d.ts +0 -5
  6. package/src/Api/Implementation/CellSummaryApiImpl.js +2 -23
  7. package/src/Api/Implementation/GridApiImpl.d.ts +1 -1
  8. package/src/Api/Implementation/GridApiImpl.js +1 -1
  9. package/src/Api/Internal/AdaptableInternalApi.d.ts +0 -2
  10. package/src/Api/Internal/AdaptableInternalApi.js +0 -3
  11. package/src/PredefinedConfig/Common/Enums.d.ts +2 -1
  12. package/src/PredefinedConfig/Common/Enums.js +1 -0
  13. package/src/PredefinedConfig/Common/Menu.d.ts +10 -1
  14. package/src/PredefinedConfig/Common/Menu.js +71 -1
  15. package/src/PredefinedConfig/Common/RowSummary.d.ts +3 -1
  16. package/src/PredefinedConfig/Common/RowSummary.js +16 -0
  17. package/src/Strategy/AdaptableModuleBase.d.ts +6 -5
  18. package/src/Strategy/AdaptableModuleBase.js +9 -8
  19. package/src/Strategy/AlertModule.js +1 -1
  20. package/src/Strategy/BulkUpdateModule.js +1 -1
  21. package/src/Strategy/CalculatedColumnModule.js +1 -1
  22. package/src/Strategy/CellSummaryModule.d.ts +7 -6
  23. package/src/Strategy/CellSummaryModule.js +37 -12
  24. package/src/Strategy/ColumnFilterModule.js +8 -7
  25. package/src/Strategy/ColumnInfoModule.js +2 -0
  26. package/src/Strategy/CommentModule.js +2 -2
  27. package/src/Strategy/CustomSortModule.js +2 -1
  28. package/src/Strategy/DashboardModule.js +8 -7
  29. package/src/Strategy/DataImportModule.js +1 -1
  30. package/src/Strategy/ExportModule.d.ts +1 -0
  31. package/src/Strategy/ExportModule.js +17 -2
  32. package/src/Strategy/Fdc3Module.js +3 -0
  33. package/src/Strategy/FlashingCellModule.js +4 -4
  34. package/src/Strategy/FormatColumnModule.js +6 -4
  35. package/src/Strategy/FreeTextColumnModule.js +1 -1
  36. package/src/Strategy/GridInfoModule.js +2 -0
  37. package/src/Strategy/LayoutModule.js +32 -23
  38. package/src/Strategy/NoteModule.js +2 -2
  39. package/src/Strategy/PlusMinusModule.js +1 -1
  40. package/src/Strategy/SettingsPanelModule.js +3 -3
  41. package/src/Strategy/SmartEditModule.js +1 -1
  42. package/src/Strategy/StyledColumnModule.d.ts +1 -0
  43. package/src/Strategy/StyledColumnModule.js +23 -5
  44. package/src/Strategy/SystemStatusModule.js +2 -2
  45. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +2 -2
  46. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +124 -3
  47. package/src/Utilities/MenuItem.d.ts +7 -4
  48. package/src/Utilities/MenuItem.js +6 -3
  49. package/src/Utilities/Services/LicenseService/index.js +1 -1
  50. package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +5 -2
  51. package/src/View/Components/FilterForm/QuickFilterForm.js +1 -1
  52. package/src/View/Components/ValueSelector/index.js +1 -1
  53. package/src/View/Layout/Wizard/LayoutWizard.js +26 -2
  54. package/src/View/Layout/Wizard/sections/RowSummarySection.d.ts +1 -0
  55. package/src/View/Layout/Wizard/sections/RowSummarySection.js +26 -2
  56. package/src/agGrid/AdaptableAgGrid.d.ts +0 -2
  57. package/src/agGrid/AdaptableAgGrid.js +7 -3
  58. package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +2 -2
  59. package/src/agGrid/weightedAverage.d.ts +0 -2
  60. package/src/agGrid/weightedAverage.js +0 -54
  61. package/src/components/Datepicker/index.js +3 -1
  62. package/src/env.js +2 -2
  63. package/src/metamodel/adaptable.metamodel.d.ts +6 -0
  64. package/src/metamodel/adaptable.metamodel.js +1 -1
  65. package/tsconfig.esm.tsbuildinfo +1 -1
  66. package/src/Utilities/Services/Interface/ISummaryService.d.ts +0 -17
  67. package/src/Utilities/Services/Interface/ISummaryService.js +0 -12
  68. package/src/Utilities/Services/SummaryService.d.ts +0 -10
  69. package/src/Utilities/Services/SummaryService.js +0 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "18.0.0-canary.16",
3
+ "version": "18.0.0-canary.17",
4
4
  "description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
5
5
  "keywords": [
6
6
  "web-components",
@@ -31,7 +31,6 @@ import { AgGridAdapter } from '../agGrid/AgGridAdapter';
31
31
  import { AgGridColumnAdapter } from '../agGrid/AgGridColumnAdapter';
32
32
  import { AgGridMenuAdapter } from '../agGrid/AgGridMenuAdapter';
33
33
  import { RowEditService } from '../Utilities/Services/RowEditService';
34
- import { ISummaryService } from '../Utilities/Services/Interface/ISummaryService';
35
34
  /**
36
35
  * Contains AG Grid Options and Modules - used when instantiating AdapTable vanilla
37
36
  */
@@ -91,7 +90,6 @@ export interface IAdaptable {
91
90
  RowEditService: RowEditService;
92
91
  Fdc3Service: Fdc3Service;
93
92
  CellPopupService: CellPopupService;
94
- SummaryService: ISummaryService;
95
93
  /**
96
94
  * INTERNAL ADAPTABLE EVENTS
97
95
  * These are not called externally - for that we use eventapi
@@ -103,9 +103,10 @@ export interface ColumnFilterOptions<TData = any> {
103
103
  */
104
104
  showSuspendFilterButton?: boolean;
105
105
  /**
106
- * Wether to show Date Picker or only Date Input
107
- *
108
- * @default true
106
+ * Show Date Picker (or Date Input) in Filter controls
107
+ * @gridInfoItem
108
+ * @noCodeItem
109
+ * @defaultValue true
109
110
  */
110
111
  showDatePicker?: boolean;
111
112
  }
@@ -524,5 +524,5 @@ export interface GridApi {
524
524
  /**
525
525
  * Opens a window with a transposed view of Grid
526
526
  */
527
- showTransposedView(transposeConfig: TransposeConfig): void;
527
+ showTransposedView(transposeConfig?: TransposeConfig): void;
528
528
  }
@@ -9,9 +9,4 @@ export declare class CellSummaryApiImpl extends ApiBase implements CellSummaryAp
9
9
  setCurrentCellSummaryOperation(operation: SummaryOperation | string): void;
10
10
  getCellSummaryOperationValue(operation: SummaryOperation | string): any;
11
11
  getCurrentCellSummaryOperationValue(): any;
12
- /**
13
- * Weighted average is availabe only if the current layout has at leat a Weighted Average aggregation defined.
14
- */
15
- private isWeightedAverageCellSummaryAvailable;
16
- private getWeightedAverageCellSummaryOperation;
17
12
  }
@@ -2,7 +2,6 @@ import { ApiBase } from './ApiBase';
2
2
  import * as ModuleConstants from '../../Utilities/Constants/ModuleConstants';
3
3
  import * as SystemRedux from '../../Redux/ActionsReducers/SystemRedux';
4
4
  import { SummaryOperation } from '../../PredefinedConfig/Common/Enums';
5
- import { cellSummaryWeightedAverage } from '../../agGrid/weightedAverage';
6
5
  export class CellSummaryApiImpl extends ApiBase {
7
6
  openCellSummaryPopupSettingsPanel() {
8
7
  this.showModulePopup(ModuleConstants.CellSummaryModuleId);
@@ -13,12 +12,6 @@ export class CellSummaryApiImpl extends ApiBase {
13
12
  getCellSummaryOperationDefinitions() {
14
13
  var _a;
15
14
  let cellSummaryOperations = (_a = this.getCellSummaryOptions().cellSummaryOperations) !== null && _a !== void 0 ? _a : [];
16
- if (this.isWeightedAverageCellSummaryAvailable()) {
17
- cellSummaryOperations = [
18
- ...cellSummaryOperations,
19
- this.getWeightedAverageCellSummaryOperation(),
20
- ];
21
- }
22
15
  return cellSummaryOperations;
23
16
  }
24
17
  setCurrentCellSummaryOperation(operation) {
@@ -50,6 +43,8 @@ export class CellSummaryApiImpl extends ApiBase {
50
43
  return cellSummary.Std_Deviation;
51
44
  case SummaryOperation.Only:
52
45
  return cellSummary.Only;
46
+ case SummaryOperation.Weighted_Average:
47
+ return cellSummary.Weighted_Average;
53
48
  default:
54
49
  return cellSummary[operation];
55
50
  }
@@ -61,20 +56,4 @@ export class CellSummaryApiImpl extends ApiBase {
61
56
  : cellSummaryOperation.operationName;
62
57
  return this.getCellSummaryOperationValue(summaryOperation);
63
58
  }
64
- /**
65
- * Weighted average is availabe only if the current layout has at leat a Weighted Average aggregation defined.
66
- */
67
- isWeightedAverageCellSummaryAvailable() {
68
- const currentLayout = this.getAdaptableApi().layoutApi.getCurrentLayout();
69
- if (currentLayout.AggregationColumns == undefined) {
70
- return false;
71
- }
72
- return Object.values(currentLayout.AggregationColumns).some((aggCol) => typeof aggCol === 'object' && aggCol.type === 'weightedAverage');
73
- }
74
- getWeightedAverageCellSummaryOperation() {
75
- return {
76
- operationName: 'Weighted Avg',
77
- operationFunction: cellSummaryWeightedAverage,
78
- };
79
- }
80
59
  }
@@ -132,5 +132,5 @@ export declare class GridApiImpl extends ApiBase implements GridApi {
132
132
  openGridInfoSettingsPanel(): void;
133
133
  getAgGridRowModelType(): RowModelType;
134
134
  getVisibleRowCount(): number;
135
- showTransposedView(transposeConfig: TransposeConfig): void;
135
+ showTransposedView(transposeConfig?: TransposeConfig): void;
136
136
  }
@@ -525,7 +525,7 @@ export class GridApiImpl extends ApiBase {
525
525
  logDeprecation(this.adaptable.logger, 'GridApi', 'getVisibleRowCount', 'getRowCount');
526
526
  return this.getRowCount();
527
527
  }
528
- showTransposedView(transposeConfig) {
528
+ showTransposedView(transposeConfig = {}) {
529
529
  var _a, _b, _c, _d;
530
530
  const transposedColumnId = (_a = transposeConfig.transposedColumnId) !== null && _a !== void 0 ? _a : this.getAdaptableApi().optionsApi.getPrimaryKey();
531
531
  const hideTransposedColumn = (_b = transposeConfig.hideTransposedColumn) !== null && _b !== void 0 ? _b : true;
@@ -27,7 +27,6 @@ import { AdaptableObjectTag, AdaptableObjectWithScope } from '../../PredefinedCo
27
27
  import { Fdc3Service } from '../../Utilities/Services/Fdc3Service';
28
28
  import { CellPopupService } from '../../Utilities/Services/CellPopupService';
29
29
  import { RowEditService } from '../../Utilities/Services/RowEditService';
30
- import { ISummaryService } from '../../Utilities/Services/Interface/ISummaryService';
31
30
  export declare class AdaptableInternalApi extends ApiBase {
32
31
  getSystemState(): SystemState;
33
32
  showPopupConfirmation(confirmation: UIConfirmation): void;
@@ -61,7 +60,6 @@ export declare class AdaptableInternalApi extends ApiBase {
61
60
  getReportService(): IReportService;
62
61
  getCalculatedColumnExpressionService(): ICalculatedColumnExpressionService;
63
62
  getEntitlementService(): IEntitlementService;
64
- getSummaryService(): ISummaryService;
65
63
  getQueryLanguageService(): IQueryLanguageService;
66
64
  getAlertService(): IAlertService;
67
65
  getTeamSharingService(): ITeamSharingService;
@@ -102,9 +102,6 @@ export class AdaptableInternalApi extends ApiBase {
102
102
  getEntitlementService() {
103
103
  return this.adaptable.EntitlementService;
104
104
  }
105
- getSummaryService() {
106
- return this.adaptable.SummaryService;
107
- }
108
105
  getQueryLanguageService() {
109
106
  return this.adaptable.QueryLanguageService;
110
107
  }
@@ -60,7 +60,8 @@ export declare enum SummaryOperation {
60
60
  Min = "Min",
61
61
  Count = "Count",
62
62
  Std_Deviation = "Std Deviation",
63
- Only = "Only"
63
+ Only = "Only",
64
+ Weighted_Average = "Weighted Avg"
64
65
  }
65
66
  export declare enum FilterOnDataChangeOptions {
66
67
  Always = "Always",
@@ -75,6 +75,7 @@ export var SummaryOperation;
75
75
  SummaryOperation["Count"] = "Count";
76
76
  SummaryOperation["Std_Deviation"] = "Std Deviation";
77
77
  SummaryOperation["Only"] = "Only";
78
+ SummaryOperation["Weighted_Average"] = "Weighted Avg";
78
79
  })(SummaryOperation || (SummaryOperation = {}));
79
80
  export var FilterOnDataChangeOptions;
80
81
  (function (FilterOnDataChangeOptions) {
@@ -5,12 +5,21 @@ import { SelectedCellInfo } from '../Selection/SelectedCellInfo';
5
5
  import { SelectedRowInfo } from '../Selection/SelectedRowInfo';
6
6
  import { Column, IRowNode } from '@ag-grid-community/core';
7
7
  import { AdaptableIcon, BaseContext } from '../../types';
8
+ /**
9
+ * List of Shipped Adaptable Menu Items
10
+ */
11
+ export declare const ADAPTABLE_MENU_ITEMS: readonly ["alert-clear", "bulk-update-apply", "calculated-column-edit", "cell-summary-show", "column-info", "comment-add", "comment-remove", "custom-sort-add", "custom-sort-edit", "dashboard", "dashboard-collapse", "dashboard-configure", "dashboard-dock", "dashboard-expand", "dashboard-float", "dashboard-hide", "dashboard-show", "data-import", "export", "export-clipboard", "export-csv", "export-excel", "export-json", "export-table", "export-custom-destination", "fdc3", "fdc3-broadcast", "fdc3-raise-intent", "filter", "filter-bar-visbility", "filter-clear", "filter-suspend", "filter-cell-value", "flashing-cell-add", "flashing-cell-clear", "flashing-cell-delete", "flashing-row-clear", "format-column", "format-column-add", "format-column-edit", "free-text-column-edit", "grid-info", "layout-aggregated-view", "layout-auto-size", "layout-clear-selection", "layout-column-caption-change", "layout-column-hide", "layout-column-select", "layout-column-select-preserve", "layout-column-select-reset", "layout-edit", "layout-grid", "layout-select", "layout-select-all", "note-add", "note-remove", "plus-minus-add", "smart-edit-apply", "settings-panel-open", "styled-column-badge", "styled-column", "styled-column-gradient", "styled-column-percent-bar", "styled-column-sparkline", "system-status-show", "internal"];
12
+ export type AdaptableMenuItemName = typeof ADAPTABLE_MENU_ITEMS[number];
8
13
  /**
9
14
  * Menu item used by Adaptable in both Column and Context Menus
10
15
  */
11
16
  export interface AdaptableMenuItem {
12
17
  /**
13
- * Name that appears in the menu
18
+ * Unique name for the Menu Item
19
+ */
20
+ name: AdaptableMenuItemName;
21
+ /**
22
+ * Text that appears in the menu
14
23
  */
15
24
  label: string;
16
25
  /**
@@ -1 +1,71 @@
1
- export {};
1
+ /**
2
+ * List of Shipped Adaptable Menu Items
3
+ */
4
+ export const ADAPTABLE_MENU_ITEMS = [
5
+ 'alert-clear',
6
+ 'bulk-update-apply',
7
+ 'calculated-column-edit',
8
+ 'cell-summary-show',
9
+ 'column-info',
10
+ 'comment-add',
11
+ 'comment-remove',
12
+ 'custom-sort-add',
13
+ 'custom-sort-edit',
14
+ 'dashboard',
15
+ 'dashboard-collapse',
16
+ 'dashboard-configure',
17
+ 'dashboard-dock',
18
+ 'dashboard-expand',
19
+ 'dashboard-float',
20
+ 'dashboard-hide',
21
+ 'dashboard-show',
22
+ 'data-import',
23
+ 'export',
24
+ 'export-clipboard',
25
+ 'export-csv',
26
+ 'export-excel',
27
+ 'export-json',
28
+ 'export-table',
29
+ 'export-custom-destination',
30
+ 'fdc3',
31
+ 'fdc3-broadcast',
32
+ 'fdc3-raise-intent',
33
+ 'filter',
34
+ 'filter-bar-visbility',
35
+ 'filter-clear',
36
+ 'filter-suspend',
37
+ 'filter-cell-value',
38
+ 'flashing-cell-add',
39
+ 'flashing-cell-clear',
40
+ 'flashing-cell-delete',
41
+ 'flashing-row-clear',
42
+ 'format-column',
43
+ 'format-column-add',
44
+ 'format-column-edit',
45
+ 'free-text-column-edit',
46
+ 'grid-info',
47
+ 'layout-aggregated-view',
48
+ 'layout-auto-size',
49
+ 'layout-clear-selection',
50
+ 'layout-column-caption-change',
51
+ 'layout-column-hide',
52
+ 'layout-column-select',
53
+ 'layout-column-select-preserve',
54
+ 'layout-column-select-reset',
55
+ 'layout-edit',
56
+ 'layout-grid',
57
+ 'layout-select',
58
+ 'layout-select-all',
59
+ 'note-add',
60
+ 'note-remove',
61
+ 'plus-minus-add',
62
+ 'smart-edit-apply',
63
+ 'settings-panel-open',
64
+ 'styled-column-badge',
65
+ 'styled-column',
66
+ 'styled-column-gradient',
67
+ 'styled-column-percent-bar',
68
+ 'styled-column-sparkline',
69
+ 'system-status-show',
70
+ 'internal' // used by AdapTable in Settings Panel
71
+ ];
@@ -1,5 +1,7 @@
1
- import { SummarySupportedExpression } from "../../Utilities/Services/Interface/ISummaryService";
2
1
  export declare const ROW_SUMMARY_ROW_ID = "__ROW_SUMMARY_ROW_ID";
2
+ export declare const WEIGHTED_AVERAGE_AGGREATED_FUNCTION = "WEIGHTED_AVERAGE";
3
+ export declare const summarySupportedExpressions: readonly ["SUM", "AVG", "MIN", "MAX", "COUNT", "MEDIAN", "MODE", "DISTINCT", "ONLY", "STD_DEVIATION", "OLDEST", "YOUNGEST", "WEIGHTED_AVERAGE"];
4
+ export type SummarySupportedExpression = (typeof summarySupportedExpressions)[number];
3
5
  /**
4
6
  * Position of Row Summary - 'Top' or 'Bottom'
5
7
  */
@@ -1 +1,17 @@
1
1
  export const ROW_SUMMARY_ROW_ID = '__ROW_SUMMARY_ROW_ID';
2
+ export const WEIGHTED_AVERAGE_AGGREATED_FUNCTION = 'WEIGHTED_AVERAGE';
3
+ export const summarySupportedExpressions = [
4
+ 'SUM',
5
+ 'AVG',
6
+ 'MIN',
7
+ 'MAX',
8
+ 'COUNT',
9
+ 'MEDIAN',
10
+ 'MODE',
11
+ 'DISTINCT',
12
+ 'ONLY',
13
+ 'STD_DEVIATION',
14
+ 'OLDEST',
15
+ 'YOUNGEST',
16
+ WEIGHTED_AVERAGE_AGGREATED_FUNCTION,
17
+ ];
@@ -3,7 +3,7 @@ import { Action } from 'redux';
3
3
  import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
4
4
  import { ModuleParams } from '../View/Components/SharedProps/ModuleViewPopupProps';
5
5
  import { MenuItemShowPopup, MenuItemDoReduxAction, MenuItemDoClickFunction } from '../Utilities/MenuItem';
6
- import { AdaptableMenuItem, ContextMenuContext } from '../PredefinedConfig/Common/Menu';
6
+ import { AdaptableMenuItem, AdaptableMenuItemName, ContextMenuContext } from '../PredefinedConfig/Common/Menu';
7
7
  import { AdaptableModule } from '../PredefinedConfig/Common/Types';
8
8
  import { TeamSharingImportInfo } from '../PredefinedConfig/TeamSharingState';
9
9
  import { AdaptableObject } from '../PredefinedConfig/Common/AdaptableObject';
@@ -40,15 +40,16 @@ export declare abstract class AdaptableModuleBase implements IModule {
40
40
  addModuleButtonMenuItem(): AdaptableMenuItem | undefined;
41
41
  addColumnMenuItems(column: AdaptableColumn): AdaptableMenuItem[] | undefined;
42
42
  addContextMenuItems(menuContext: ContextMenuContext): AdaptableMenuItem[] | undefined;
43
- createMainMenuItemShowPopup({ Label, ComponentName, Icon, PopupParams, }: {
43
+ createMainMenuItemShowPopup({ Name, Label, ComponentName, Icon, PopupParams, }: {
44
+ Name: AdaptableMenuItemName;
44
45
  Label: string;
45
46
  ComponentName: string;
46
47
  Icon: AdaptableSystemIconName;
47
48
  PopupParams?: ModuleParams;
48
49
  }): MenuItemShowPopup;
49
- createColumnMenuItemClickFunction(Label: string, Icon: AdaptableSystemIconName, ClickFunction: () => void): MenuItemDoClickFunction;
50
- createColumnMenuItemReduxAction(Label: string, Icon: AdaptableSystemIconName, Action: Action): MenuItemDoReduxAction;
51
- createColumnMenuItemShowPopup(Label: string, ComponentName: string, Icon: AdaptableSystemIconName, PopupParams?: ModuleParams): MenuItemShowPopup;
50
+ createColumnMenuItemClickFunction(Name: AdaptableMenuItemName, Label: string, Icon: AdaptableSystemIconName, ClickFunction: () => void): MenuItemDoClickFunction;
51
+ createColumnMenuItemReduxAction(Name: AdaptableMenuItemName, Label: string, Icon: AdaptableSystemIconName, Action: Action): MenuItemDoReduxAction;
52
+ createColumnMenuItemShowPopup(Name: AdaptableMenuItemName, Label: string, ComponentName: string, Icon: AdaptableSystemIconName, PopupParams?: ModuleParams): MenuItemShowPopup;
52
53
  getTeamSharingAction(): TeamSharingImportInfo<AdaptableObject> | undefined;
53
54
  getModuleNamedQueryReferences(): string[];
54
55
  getModuleCalculatedColumnReferences(): CalculatedColumn[];
@@ -78,6 +78,7 @@ export class AdaptableModuleBase {
78
78
  maxWidth: this.getPopupMaxWidth(),
79
79
  };
80
80
  return this.createMainMenuItemShowPopup({
81
+ Name: 'internal',
81
82
  Label: this.moduleInfo.FriendlyName,
82
83
  ComponentName: this.moduleInfo.Popup,
83
84
  Icon: this.moduleInfo.Glyph,
@@ -98,20 +99,20 @@ export class AdaptableModuleBase {
98
99
  return undefined;
99
100
  }
100
101
  // creates the menu items in the main dropdown
101
- createMainMenuItemShowPopup({ Label, ComponentName, Icon, PopupParams, }) {
102
- return new MenuItemShowPopup(Label, this.moduleInfo.ModuleName, ComponentName, Icon, true, PopupParams);
102
+ createMainMenuItemShowPopup({ Name, Label, ComponentName, Icon, PopupParams, }) {
103
+ return new MenuItemShowPopup(Name, Label, this.moduleInfo.ModuleName, ComponentName, Icon, true, PopupParams);
103
104
  }
104
105
  // creates a menu item for the column menu to perform a function
105
- createColumnMenuItemClickFunction(Label, Icon, ClickFunction) {
106
- return new MenuItemDoClickFunction(Label, this.moduleInfo.ModuleName, ClickFunction, Icon, true);
106
+ createColumnMenuItemClickFunction(Name, Label, Icon, ClickFunction) {
107
+ return new MenuItemDoClickFunction(Name, Label, this.moduleInfo.ModuleName, ClickFunction, Icon, true);
107
108
  }
108
109
  // creates a menu item for the column menu to enact a Redux action
109
- createColumnMenuItemReduxAction(Label, Icon, Action) {
110
- return new MenuItemDoReduxAction(Label, this.moduleInfo.ModuleName, Action, Icon, true);
110
+ createColumnMenuItemReduxAction(Name, Label, Icon, Action) {
111
+ return new MenuItemDoReduxAction(Name, Label, this.moduleInfo.ModuleName, Action, Icon, true);
111
112
  }
112
113
  // popups called by the column menu - invisible if module is hidden or readonly
113
- createColumnMenuItemShowPopup(Label, ComponentName, Icon, PopupParams) {
114
- return new MenuItemShowPopup(Label, this.moduleInfo.ModuleName, ComponentName, Icon, true, PopupParams);
114
+ createColumnMenuItemShowPopup(Name, Label, ComponentName, Icon, PopupParams) {
115
+ return new MenuItemShowPopup(Name, Label, this.moduleInfo.ModuleName, ComponentName, Icon, true, PopupParams);
115
116
  }
116
117
  getTeamSharingAction() {
117
118
  return undefined;
@@ -83,7 +83,7 @@ export class AlertModule extends AdaptableModuleBase {
83
83
  relevantAlert = this.api.alertApi.internalApi.getAdaptableAlertWithHighlightRow(menuContext.rowNode);
84
84
  }
85
85
  if (relevantAlert) {
86
- items.push(this.createColumnMenuItemReduxAction('Clear Alert', this.moduleInfo.Glyph, SystemRedux.SystemAlertDelete(relevantAlert)));
86
+ items.push(this.createColumnMenuItemReduxAction('alert-clear', 'Clear Alert', this.moduleInfo.Glyph, SystemRedux.SystemAlertDelete(relevantAlert)));
87
87
  }
88
88
  }
89
89
  }
@@ -22,7 +22,7 @@ export class BulkUpdateModule extends AdaptableModuleBase {
22
22
  let popUpParams = {
23
23
  source: 'ContextMenu',
24
24
  };
25
- menuItemShowPopup = this.createMainMenuItemShowPopup({
25
+ menuItemShowPopup = this.createMainMenuItemShowPopup({ Name: 'bulk-update-apply',
26
26
  Label: 'Apply Bulk Update',
27
27
  ComponentName: this.moduleInfo.Popup,
28
28
  Icon: this.moduleInfo.Glyph,
@@ -57,7 +57,7 @@ export class CalculatedColumnModule extends AdaptableModuleBase {
57
57
  source: 'ColumnMenu',
58
58
  };
59
59
  return [
60
- this.createColumnMenuItemShowPopup('Edit Calculated Column', this.moduleInfo.Popup, this.moduleInfo.Glyph, popupParam),
60
+ this.createColumnMenuItemShowPopup('calculated-column-edit', 'Edit Calculated Column', this.moduleInfo.Popup, this.moduleInfo.Glyph, popupParam),
61
61
  ];
62
62
  }
63
63
  getTeamSharingAction() {
@@ -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;
@@ -1,8 +1,9 @@
1
- import { AdaptableModuleBase } from './AdaptableModuleBase';
2
1
  import * as ModuleConstants from '../Utilities/Constants/ModuleConstants';
3
2
  import { ArrayExtensions } from '../Utilities/Extensions/ArrayExtensions';
4
3
  import { Helper } from '../Utilities/Helpers/Helper';
4
+ import { AggregatedScalarLiveValue } from '../Utilities/Services/AggregatedScalarLiveValue';
5
5
  import { CellSummaryStatusPanel } from '../View/CellSummary/CellSummaryStatusPanel';
6
+ import { AdaptableModuleBase } from './AdaptableModuleBase';
6
7
  export class CellSummaryModule extends AdaptableModuleBase {
7
8
  constructor(api) {
8
9
  super(ModuleConstants.CellSummaryModuleId, ModuleConstants.CellSummaryFriendlyName, 'cells', 'CellSummaryPopup', 'See summary information on a group of cells using multiple summary operations', api);
@@ -36,6 +37,7 @@ export class CellSummaryModule extends AdaptableModuleBase {
36
37
  }
37
38
  createCellSummaryMenuItem(popUpParams) {
38
39
  return this.createMainMenuItemShowPopup({
40
+ Name: 'cell-summary-show',
39
41
  Label: 'See Cell Summary',
40
42
  ComponentName: this.moduleInfo.Popup,
41
43
  Icon: this.moduleInfo.Glyph,
@@ -88,17 +90,17 @@ export class CellSummaryModule extends AdaptableModuleBase {
88
90
  Only: '',
89
91
  };
90
92
  }
93
+ const columnId = selectedCellInfo.columns[0].columnId;
94
+ const rowNodes = selectedCellInfo.gridCells.map((gc) => gc.rowNode);
91
95
  const handleExpression = (functionName) => {
92
- const columnId = selectedCellInfo.columns[0].columnId;
93
- const rowNodes = selectedCellInfo.gridCells.map((gc) => gc.rowNode);
94
- return this.api.internalApi
95
- .getSummaryService().evaluateExpressionValue({
96
- expression: {
97
- function: functionName,
98
- },
99
- columnId: columnId,
100
- getRowNodes: () => rowNodes,
101
- }, ModuleConstants.CellSummaryModuleId);
96
+ const aggScalarValue = new AggregatedScalarLiveValue({
97
+ aggregatedScalarExpression: `${functionName}([${columnId}])`,
98
+ }, ModuleConstants.CellSummaryModuleId, this.api, () => rowNodes);
99
+ let value = aggScalarValue.getGlobalAggregatedValue();
100
+ if (typeof value === 'number' && !isNaN(value)) {
101
+ value = Helper.roundNumber(value, 2);
102
+ }
103
+ return value;
102
104
  };
103
105
  const sumValue = hasNumericColumns ? handleExpression('SUM') : null;
104
106
  const avgValue = hasNumericColumns ? Helper.roundNumber(handleExpression('AVG'), 2) : null;
@@ -123,8 +125,11 @@ export class CellSummaryModule extends AdaptableModuleBase {
123
125
  Only: distinctValue == 1 ? JSON.stringify(allValues[0]) : '',
124
126
  };
125
127
  numericValues = [...newNumericValues];
128
+ const weightedAverage = this.getWeightedAverageCellSummary(columnId, rowNodes);
129
+ if (weightedAverage !== null) {
130
+ selectedCellSummary.Weighted_Average = weightedAverage;
131
+ }
126
132
  const operationDefinitions = this.api.cellSummaryApi.getCellSummaryOperationDefinitions();
127
- const api = this.api;
128
133
  operationDefinitions === null || operationDefinitions === void 0 ? void 0 : operationDefinitions.forEach((operation) => {
129
134
  if (operation.operationFunction) {
130
135
  const cellSummaryOperationContext = {
@@ -144,6 +149,26 @@ export class CellSummaryModule extends AdaptableModuleBase {
144
149
  this.cachedCellSummary.set(selectedCellInfo, selectedCellSummary);
145
150
  return selectedCellSummary;
146
151
  }
152
+ getWeightedAverageCellSummary(columnId, rowNodes) {
153
+ const currentLayout = this.api.layoutApi.getCurrentLayout();
154
+ if (currentLayout.AggregationColumns == undefined) {
155
+ return false;
156
+ }
157
+ const weightedAverageConfig = Object.entries(currentLayout.AggregationColumns).find(([colId, aggCol]) => typeof aggCol === 'object' && aggCol.type === 'weightedAverage' && colId === columnId);
158
+ if (!weightedAverageConfig) {
159
+ return null;
160
+ }
161
+ const { weightedColumnId } = weightedAverageConfig[1];
162
+ const expression = `AVG([${columnId}], WEIGHT([${weightedColumnId}]))`;
163
+ const aggScalarValue = new AggregatedScalarLiveValue({
164
+ aggregatedScalarExpression: expression,
165
+ }, ModuleConstants.CellSummaryModuleId, this.api, () => rowNodes);
166
+ let value = aggScalarValue.getGlobalAggregatedValue();
167
+ if (typeof value === 'number' && !isNaN(value)) {
168
+ value = Helper.roundNumber(value, 2);
169
+ }
170
+ return value;
171
+ }
147
172
  getViewProperties() {
148
173
  return {
149
174
  getStatusBarPanelProps() {
@@ -57,13 +57,13 @@ export class ColumnFilterModule extends AdaptableModuleBase {
57
57
  this.api.columnFilterApi.internalApi.createEqualityColumnFilterForCell(menuContext.selectedCellInfo.gridCells[0]);
58
58
  };
59
59
  return [
60
- this.createColumnMenuItemClickFunction(isMultiple ? 'Filter on Cell Values' : 'Filter on Cell Value', this.moduleInfo.Glyph, clickFunction),
60
+ this.createColumnMenuItemClickFunction('filter-cell-value', isMultiple ? 'Filter on Cell Values' : 'Filter on Cell Value', this.moduleInfo.Glyph, clickFunction),
61
61
  ];
62
62
  }
63
63
  else {
64
64
  let filterSubMenuItems = [];
65
- filterSubMenuItems.push(this.createColumnMenuItemReduxAction('Clear Filter', 'close', LayoutRedux.LayoutColumnFilterClear(existingColumnFilter)));
66
- filterSubMenuItems.push(this.createColumnMenuItemClickFunction(existingColumnFilter.IsSuspended ? 'Unsuspend Filter' : 'Suspend Filter', existingColumnFilter.IsSuspended ? 'resume' : 'pause', existingColumnFilter.IsSuspended
65
+ filterSubMenuItems.push(this.createColumnMenuItemReduxAction('filter-clear', 'Clear Filter', 'close', LayoutRedux.LayoutColumnFilterClear(existingColumnFilter)));
66
+ filterSubMenuItems.push(this.createColumnMenuItemClickFunction('filter-suspend', existingColumnFilter.IsSuspended ? 'Unsuspend Filter' : 'Suspend Filter', existingColumnFilter.IsSuspended ? 'resume' : 'pause', existingColumnFilter.IsSuspended
67
67
  ? () => {
68
68
  this.api.columnFilterApi.unSuspendColumnFilter(existingColumnFilter);
69
69
  }
@@ -71,7 +71,7 @@ export class ColumnFilterModule extends AdaptableModuleBase {
71
71
  this.api.columnFilterApi.suspendColumnFilter(existingColumnFilter);
72
72
  }));
73
73
  return [
74
- {
74
+ { name: 'filter',
75
75
  label: this.moduleInfo.FriendlyName,
76
76
  isVisible: true,
77
77
  module: this.moduleInfo.ModuleName,
@@ -94,21 +94,22 @@ export class ColumnFilterModule extends AdaptableModuleBase {
94
94
  const isFilterVisible = this.api.columnFilterApi.isQuickFilterVisible();
95
95
  if (this.isModuleEditable() &&
96
96
  this.api.optionsApi.getColumnFilterOptions().useAdaptableColumnFiltering) {
97
- filterSubMenuItems.push(this.createColumnMenuItemReduxAction(isFilterVisible ? 'Hide Filter Bar' : 'Show Filter Bar', isFilterVisible ? 'unchecked' : 'check', isFilterVisible
97
+ filterSubMenuItems.push(this.createColumnMenuItemReduxAction('filter-bar-visbility', isFilterVisible ? 'Hide Filter Bar' : 'Show Filter Bar', isFilterVisible ? 'unchecked' : 'check', isFilterVisible
98
98
  ? SystemRedux.SystemQuickFilterBarHide()
99
99
  : SystemRedux.SystemQuickFilterBarShow()));
100
100
  }
101
101
  }
102
102
  const existingColumnFilter = this.getExistingColumnFilter(column);
103
103
  if (existingColumnFilter) {
104
- filterSubMenuItems.push(this.createColumnMenuItemReduxAction('Clear Filter', 'close', LayoutRedux.LayoutColumnFilterClear(existingColumnFilter)));
105
- filterSubMenuItems.push(this.createColumnMenuItemReduxAction(existingColumnFilter.IsSuspended ? 'Unsuspend Filter' : 'Suspend Filter', existingColumnFilter.IsSuspended ? 'resume' : 'pause', existingColumnFilter.IsSuspended
104
+ filterSubMenuItems.push(this.createColumnMenuItemReduxAction('filter-clear', 'Clear Filter', 'close', LayoutRedux.LayoutColumnFilterClear(existingColumnFilter)));
105
+ filterSubMenuItems.push(this.createColumnMenuItemReduxAction('filter-suspend', existingColumnFilter.IsSuspended ? 'Unsuspend Filter' : 'Suspend Filter', existingColumnFilter.IsSuspended ? 'resume' : 'pause', existingColumnFilter.IsSuspended
106
106
  ? LayoutRedux.LayoutColumnFilterUnSuspend(existingColumnFilter)
107
107
  : LayoutRedux.LayoutColumnFilterSuspend(existingColumnFilter)));
108
108
  }
109
109
  if (ArrayExtensions.IsNotNullOrEmpty(filterSubMenuItems)) {
110
110
  return [
111
111
  {
112
+ name: 'filter',
112
113
  label: this.moduleInfo.FriendlyName,
113
114
  isVisible: true,
114
115
  module: this.moduleInfo.ModuleName,
@@ -15,6 +15,7 @@ export class ColumnInfoModule extends AdaptableModuleBase {
15
15
  };
16
16
  return [
17
17
  this.createMainMenuItemShowPopup({
18
+ Name: 'column-info',
18
19
  Label: 'Column Info',
19
20
  ComponentName: this.moduleInfo.Popup,
20
21
  Icon: this.moduleInfo.Glyph,
@@ -31,6 +32,7 @@ export class ColumnInfoModule extends AdaptableModuleBase {
31
32
  };
32
33
  return [
33
34
  this.createMainMenuItemShowPopup({
35
+ Name: 'column-info',
34
36
  Label: 'Column Info',
35
37
  ComponentName: this.moduleInfo.Popup,
36
38
  Icon: this.moduleInfo.Glyph,
@@ -58,12 +58,12 @@ export class CommentModule extends AdaptableModuleBase {
58
58
  return items;
59
59
  }
60
60
  if (comments) {
61
- items.push(this.createColumnMenuItemClickFunction('Remove Comments', this.moduleInfo.Glyph, () => {
61
+ items.push(this.createColumnMenuItemClickFunction('comment-remove', 'Remove Comment', this.moduleInfo.Glyph, () => {
62
62
  this.api.commentApi.deleteCommentThread(cellAddress);
63
63
  }));
64
64
  }
65
65
  else {
66
- items.push(this.createColumnMenuItemClickFunction('Add Comment', this.moduleInfo.Glyph, () => {
66
+ items.push(this.createColumnMenuItemClickFunction('comment-add', 'Add Comment', this.moduleInfo.Glyph, () => {
67
67
  // add an empty one
68
68
  this.api.commentApi.addCommentThread(Object.assign(Object.assign({}, cellAddress), { Comments: [] }));
69
69
  requestAnimationFrame(() => {
@@ -34,8 +34,9 @@ export class CustomSortModule extends AdaptableModuleBase {
34
34
  action: customSort ? 'Edit' : 'New',
35
35
  source: 'ColumnMenu',
36
36
  };
37
+ let name = customSort ? 'custom-sort-edit' : 'custom-sort-add';
37
38
  return [
38
- this.createColumnMenuItemShowPopup(label + 'Custom Sort', this.moduleInfo.Popup, this.moduleInfo.Glyph, popupParam),
39
+ this.createColumnMenuItemShowPopup(name, label + 'Custom Sort', this.moduleInfo.Popup, this.moduleInfo.Glyph, popupParam),
39
40
  ];
40
41
  }
41
42
  }