@adaptabletools/adaptable-cjs 18.0.0-canary.25 → 18.0.0-canary.26

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 (78) hide show
  1. package/package.json +1 -1
  2. package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -1
  3. package/src/AdaptableOptions/CommentOptions.d.ts +2 -2
  4. package/src/AdaptableOptions/MenuOptions.d.ts +4 -4
  5. package/src/Api/GridApi.d.ts +2 -1
  6. package/src/Api/Implementation/ActionRowApiImpl.js +3 -7
  7. package/src/Api/Implementation/AlertApiImpl.js +5 -10
  8. package/src/Api/Implementation/CalendarApiImpl.js +1 -6
  9. package/src/Api/Implementation/ChartingApiImpl.js +3 -3
  10. package/src/Api/Implementation/ColumnApiImpl.js +6 -6
  11. package/src/Api/Implementation/ColumnFilterApiImpl.js +7 -7
  12. package/src/Api/Implementation/CommentsApiImpl.js +1 -1
  13. package/src/Api/Implementation/ConfigApiImpl.js +11 -17
  14. package/src/Api/Implementation/DashboardApiImpl.js +1 -6
  15. package/src/Api/Implementation/ExportApiImpl.js +5 -10
  16. package/src/Api/Implementation/ExpressionApiImpl.js +8 -13
  17. package/src/Api/Implementation/Fdc3ApiImpl.js +1 -1
  18. package/src/Api/Implementation/FlashingCellApiImpl.js +3 -8
  19. package/src/Api/Implementation/FormatColumnApiImpl.js +4 -4
  20. package/src/Api/Implementation/FreeTextColumnApiImpl.js +1 -1
  21. package/src/Api/Implementation/GridApiImpl.d.ts +2 -1
  22. package/src/Api/Implementation/GridApiImpl.js +11 -8
  23. package/src/Api/Implementation/LayoutApiImpl.d.ts +2 -0
  24. package/src/Api/Implementation/LayoutApiImpl.js +2 -13
  25. package/src/Api/Implementation/PredicateApiImpl.js +2 -2
  26. package/src/Api/Implementation/ScheduleApiImpl.js +6 -6
  27. package/src/Api/Implementation/ScopeApiImpl.js +10 -10
  28. package/src/Api/Implementation/TeamSharingApiImpl.js +3 -15
  29. package/src/Api/Implementation/ThemeApiImpl.js +2 -7
  30. package/src/Api/Implementation/UserInterfaceApiImpl.js +4 -13
  31. package/src/Api/Internal/ActionRowInternalApi.js +7 -45
  32. package/src/Api/Internal/AdaptableInternalApi.js +2 -12
  33. package/src/Api/Internal/AlertInternalApi.js +4 -17
  34. package/src/Api/Internal/CalculatedColumnInternalApi.js +7 -14
  35. package/src/Api/Internal/ChartingInternalApi.js +13 -13
  36. package/src/Api/Internal/ColumnFilterInternalApi.js +18 -36
  37. package/src/Api/Internal/CustomSortInternalApi.js +1 -1
  38. package/src/Api/Internal/DashboardInternalApi.js +4 -10
  39. package/src/Api/Internal/DataImportInternalApi.js +3 -9
  40. package/src/Api/Internal/DataSetInternalApi.js +2 -7
  41. package/src/Api/Internal/ExportInternalApi.js +4 -4
  42. package/src/Api/Internal/ExpressionInternalApi.js +2 -12
  43. package/src/Api/Internal/Fdc3InternalApi.js +1 -10
  44. package/src/Api/Internal/FormatColumnInternalApi.js +11 -20
  45. package/src/Api/Internal/FreeTextColumnInternalApi.js +1 -1
  46. package/src/Api/Internal/GridFilterInternalApi.js +2 -8
  47. package/src/Api/Internal/GridInternalApi.js +13 -40
  48. package/src/Api/Internal/LayoutInternalApi.d.ts +1 -0
  49. package/src/Api/Internal/LayoutInternalApi.js +10 -19
  50. package/src/Api/Internal/PredicateInternalApi.js +5 -40
  51. package/src/Api/Internal/ScheduleInternalApi.js +1 -6
  52. package/src/Api/Internal/StyledColumnInternalApi.js +5 -5
  53. package/src/Api/Internal/SystemStatusInternalApi.js +1 -7
  54. package/src/Api/Internal/TeamSharingInternalApi.js +2 -7
  55. package/src/Api/Internal/ThemeInternalApi.js +1 -1
  56. package/src/Api/Internal/UserInterfaceInternalApi.js +1 -1
  57. package/src/Api/LayoutApi.d.ts +1 -0
  58. package/src/PredefinedConfig/Common/CellSummary.d.ts +5 -14
  59. package/src/PredefinedConfig/Common/Enums.d.ts +2 -0
  60. package/src/PredefinedConfig/Common/Enums.js +2 -0
  61. package/src/PredefinedConfig/Common/RowSummary.d.ts +1 -1
  62. package/src/PredefinedConfig/Common/RowSummary.js +4 -4
  63. package/src/Strategy/CellSummaryModule.js +54 -94
  64. package/src/Strategy/LayoutModule.js +5 -1
  65. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +1 -1
  66. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +19 -19
  67. package/src/Utilities/Helpers/AdaptableHelper.js +3 -2
  68. package/src/Utilities/ObjectFactory.js +2 -0
  69. package/src/View/Layout/Wizard/LayoutWizard.js +1 -0
  70. package/src/View/Layout/Wizard/sections/RowGroupingSection.js +17 -1
  71. package/src/View/Layout/Wizard/sections/RowSummarySection.js +5 -5
  72. package/src/agGrid/AdaptableAgGrid.d.ts +1 -1
  73. package/src/agGrid/AdaptableAgGrid.js +1 -1
  74. package/src/agGrid/AgGridAdapter.d.ts +1 -2
  75. package/src/env.js +2 -2
  76. package/src/metamodel/adaptable.metamodel.d.ts +8 -2
  77. package/src/metamodel/adaptable.metamodel.js +1 -1
  78. package/tsconfig.cjs.tsbuildinfo +1 -1
@@ -17,19 +17,11 @@ class LayoutInternalApi extends ApiBase_1.ApiBase {
17
17
  * @param newState Layout State after change
18
18
  */
19
19
  fireLayoutChangedEvent(trigger, oldSate, newState, skipEqualityCheck) {
20
- const adaptableApi = this.getAdaptableApi();
21
- const layoutChangedInfo = {
22
- adaptableApi: adaptableApi,
23
- actionName: trigger,
24
- oldLayoutState: oldSate,
25
- newLayoutState: newState,
26
- userName: adaptableApi.optionsApi.getUserName(),
27
- adaptableId: adaptableApi.optionsApi.getAdaptableId(),
28
- };
20
+ const layoutChangedInfo = Object.assign({ actionName: trigger, oldLayoutState: oldSate, newLayoutState: newState }, this.getAdaptableApi().internalApi.buildBaseContext());
29
21
  if (!skipEqualityCheck && (0, isEqual_1.default)(oldSate, newState)) {
30
22
  return;
31
23
  }
32
- this.adaptable.api.eventApi.emit('LayoutChanged', layoutChangedInfo);
24
+ this.getAdaptableApi().eventApi.emit('LayoutChanged', layoutChangedInfo);
33
25
  }
34
26
  /**
35
27
  * Compares 2 Layouts for equality
@@ -70,7 +62,7 @@ class LayoutInternalApi extends ApiBase_1.ApiBase {
70
62
  if (!layoutState.Layouts || !isLayoutDefined(GeneralConstants_1.DEFAULT_LAYOUT)) {
71
63
  // augogroup columns are not in columns list
72
64
  // the code that adds column ok grid state explicitly ignores autoColumns
73
- const allGridColumns = this.adaptable.getAgGridAllGridColumns();
65
+ const allGridColumns = this.getAdaptableApi().gridApi.getAllGridColumns();
74
66
  let defaultLayout = ObjectFactory_1.default.CreateEmptyLayout({
75
67
  Name: GeneralConstants_1.DEFAULT_LAYOUT,
76
68
  Columns: defaultLayoutColumns.map((c) => c.columnId),
@@ -114,6 +106,7 @@ class LayoutInternalApi extends ApiBase_1.ApiBase {
114
106
  * This takes into account the data-source.
115
107
  */
116
108
  getLayoutSupportedFeatures() {
109
+ var _a, _b;
117
110
  const layoutSupportedFeatures = {
118
111
  RowGroupedColumns: true,
119
112
  AggregationColumns: true,
@@ -121,6 +114,7 @@ class LayoutInternalApi extends ApiBase_1.ApiBase {
121
114
  ColumnFilters: true,
122
115
  ColumnSorts: true,
123
116
  GridFilter: true,
117
+ RowSummaries: true,
124
118
  };
125
119
  if (this.getGridApi().getAgGridRowModelType() === 'viewport') {
126
120
  layoutSupportedFeatures.RowGroupedColumns = false;
@@ -134,6 +128,9 @@ class LayoutInternalApi extends ApiBase_1.ApiBase {
134
128
  if (this.getEntitlementApi().getEntitlementAccessLevelForModule(ModuleConstants_1.GridFilterModuleId) == 'Hidden') {
135
129
  layoutSupportedFeatures.GridFilter = false;
136
130
  }
131
+ if (((_b = (_a = this.adaptable) === null || _a === void 0 ? void 0 : _a.getAgGridRowModelType) === null || _b === void 0 ? void 0 : _b.call(_a)) !== 'clientSide') {
132
+ layoutSupportedFeatures.RowSummaries = false;
133
+ }
137
134
  return layoutSupportedFeatures;
138
135
  }
139
136
  updateCurrentDraftLayout(layout) {
@@ -159,14 +156,8 @@ class LayoutInternalApi extends ApiBase_1.ApiBase {
159
156
  if ((layoutTagOptions === null || layoutTagOptions === void 0 ? void 0 : layoutTagOptions.autoCheckTagsForLayouts) == true) {
160
157
  return ArrayExtensions_1.default.IsNullOrEmpty(object.Tags) ? true : (_a = object.Tags) === null || _a === void 0 ? void 0 : _a.includes(layout.Name);
161
158
  }
162
- const context = {
163
- adaptableObject: object,
164
- module,
165
- layout,
166
- adaptableApi: this.getAdaptableApi(),
167
- userName: this.getOptions().userName,
168
- adaptableId: this.getOptions().adaptableId,
169
- };
159
+ const context = Object.assign({ adaptableObject: object, module,
160
+ layout }, this.getAdaptableApi().internalApi.buildBaseContext());
170
161
  return layoutTagOptions === null || layoutTagOptions === void 0 ? void 0 : layoutTagOptions.isObjectAvailableInLayout(context);
171
162
  }
172
163
  showLayoutNotAssociatedObjects() {
@@ -21,14 +21,7 @@ class PredicateInternalApi extends ApiBase_1.ApiBase {
21
21
  getSystemFilterPredicateIds(scope) {
22
22
  const systemFilterPredicates = this.getPredicateOptions().systemFilterPredicates;
23
23
  if (typeof systemFilterPredicates === 'function') {
24
- const systemPredicateContext = {
25
- adaptableApi: this.adaptable.api,
26
- userName: this.getOptions().userName,
27
- adaptableId: this.getOptions().adaptableId,
28
- systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('columnFilter'),
29
- moduleScope: 'columnFilter',
30
- columnScope: scope,
31
- };
24
+ const systemPredicateContext = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('columnFilter'), moduleScope: 'columnFilter', columnScope: scope });
32
25
  return systemFilterPredicates(systemPredicateContext);
33
26
  }
34
27
  return systemFilterPredicates;
@@ -43,14 +36,7 @@ class PredicateInternalApi extends ApiBase_1.ApiBase {
43
36
  getSystemAlertPredicateIds(scope) {
44
37
  const systemAlertPredicates = this.getPredicateOptions().systemAlertPredicates;
45
38
  if (typeof systemAlertPredicates === 'function') {
46
- const systemPredicateContext = {
47
- adaptableApi: this.adaptable.api,
48
- userName: this.getOptions().userName,
49
- adaptableId: this.getOptions().adaptableId,
50
- systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('alert'),
51
- moduleScope: 'alert',
52
- columnScope: scope,
53
- };
39
+ const systemPredicateContext = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('alert'), moduleScope: 'alert', columnScope: scope });
54
40
  return systemAlertPredicates(systemPredicateContext);
55
41
  }
56
42
  return systemAlertPredicates;
@@ -58,14 +44,7 @@ class PredicateInternalApi extends ApiBase_1.ApiBase {
58
44
  getSystemBadgeStylePredicateIds(scope) {
59
45
  const systemBadgeStylePredicates = this.getPredicateOptions().systemBadgeStylePredicates;
60
46
  if (typeof systemBadgeStylePredicates === 'function') {
61
- const systemPredicateContext = {
62
- adaptableApi: this.adaptable.api,
63
- userName: this.getOptions().userName,
64
- adaptableId: this.getOptions().adaptableId,
65
- systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('badgeStyle'),
66
- moduleScope: 'badgeStyle',
67
- columnScope: scope,
68
- };
47
+ const systemPredicateContext = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('badgeStyle'), moduleScope: 'badgeStyle', columnScope: scope });
69
48
  return systemBadgeStylePredicates(systemPredicateContext);
70
49
  }
71
50
  return systemBadgeStylePredicates;
@@ -80,14 +59,7 @@ class PredicateInternalApi extends ApiBase_1.ApiBase {
80
59
  getSystemFormatColumnPredicateIds(scope) {
81
60
  const systemFormatColumnPredicates = this.getPredicateOptions().systemFormatColumnPredicates;
82
61
  if (typeof systemFormatColumnPredicates === 'function') {
83
- const systemPredicateContext = {
84
- adaptableApi: this.adaptable.api,
85
- userName: this.getOptions().userName,
86
- adaptableId: this.getOptions().adaptableId,
87
- systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('formatColumn'),
88
- moduleScope: 'formatColumn',
89
- columnScope: scope,
90
- };
62
+ const systemPredicateContext = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('formatColumn'), moduleScope: 'formatColumn', columnScope: scope });
91
63
  return systemFormatColumnPredicates(systemPredicateContext);
92
64
  }
93
65
  return systemFormatColumnPredicates;
@@ -102,14 +74,7 @@ class PredicateInternalApi extends ApiBase_1.ApiBase {
102
74
  getSystemFlashingCellPredicateIds(scope) {
103
75
  const systemFlashingCellPredicates = this.getPredicateOptions().systemFlashingCellPredicates;
104
76
  if (typeof systemFlashingCellPredicates === 'function') {
105
- const systemPredicateContext = {
106
- adaptableApi: this.adaptable.api,
107
- userName: this.getOptions().userName,
108
- adaptableId: this.getOptions().adaptableId,
109
- systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('flashingcell'),
110
- moduleScope: 'flashingcell',
111
- columnScope: scope,
112
- };
77
+ const systemPredicateContext = Object.assign({ systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('flashingcell'), moduleScope: 'flashingcell', columnScope: scope }, this.getAdaptableApi().internalApi.buildBaseContext());
113
78
  return systemFlashingCellPredicates(systemPredicateContext);
114
79
  }
115
80
  return systemFlashingCellPredicates;
@@ -8,12 +8,7 @@ class ScheduleInternalApi extends ApiBase_1.ApiBase {
8
8
  */
9
9
  fireScheduleTriggeredEvent(schedule) {
10
10
  const adaptableApi = this.getAdaptableApi();
11
- const scheduleTriggeredInfo = {
12
- adaptableApi: adaptableApi,
13
- userName: adaptableApi.optionsApi.getUserName(),
14
- adaptableId: adaptableApi.optionsApi.getAdaptableId(),
15
- schedule: schedule,
16
- };
11
+ const scheduleTriggeredInfo = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { schedule: schedule });
17
12
  adaptableApi.eventApi.emit('ScheduleTriggered', scheduleTriggeredInfo);
18
13
  }
19
14
  }
@@ -34,11 +34,11 @@ class StyledColumnInternalApi extends ApiBase_1.ApiBase {
34
34
  }
35
35
  else {
36
36
  let columnId = columnComparison.MinValue;
37
- if (!this.adaptable.api.columnApi.isColumnInGrid(columnId)) {
37
+ if (!this.getAdaptableApi().columnApi.isColumnInGrid(columnId)) {
38
38
  return 0;
39
39
  }
40
40
  else {
41
- return this.adaptable.api.gridApi.getRawValueFromRowNode(rowNode, columnId);
41
+ return this.getAdaptableApi().gridApi.getRawValueFromRowNode(rowNode, columnId);
42
42
  }
43
43
  }
44
44
  }
@@ -97,11 +97,11 @@ class StyledColumnInternalApi extends ApiBase_1.ApiBase {
97
97
  }
98
98
  else {
99
99
  let columnId = columnComparison.MaxValue;
100
- if (!this.adaptable.api.columnApi.isColumnInGrid(columnId)) {
100
+ if (!this.getAdaptableApi().columnApi.isColumnInGrid(columnId)) {
101
101
  return 0;
102
102
  }
103
103
  else {
104
- return this.adaptable.api.gridApi.getRawValueFromRowNode(rowNode, columnId);
104
+ return this.getAdaptableApi().gridApi.getRawValueFromRowNode(rowNode, columnId);
105
105
  }
106
106
  }
107
107
  }
@@ -279,7 +279,7 @@ class StyledColumnInternalApi extends ApiBase_1.ApiBase {
279
279
  };
280
280
  return this.getAdaptableApi()
281
281
  .predicateApi.internalApi.getBadgeStylePredicateDefs(scope)
282
- .filter((predicate) => this.adaptable.api.scopeApi.isColumnInScope(column, predicate.columnScope));
282
+ .filter((predicate) => this.getAdaptableApi().scopeApi.isColumnInScope(column, predicate.columnScope));
283
283
  }
284
284
  }
285
285
  exports.StyledColumnInternalApi = StyledColumnInternalApi;
@@ -10,13 +10,7 @@ class SystemStatusInternalApi extends ApiBase_1.ApiBase {
10
10
  * @param systemStatusMessageInfo Info about new System Status Message
11
11
  */
12
12
  fireSystemStatusMessageDisplayedEvent(systemStatusMessageInfo) {
13
- const adaptableApi = this.getAdaptableApi();
14
- const systemStatusMessageDisplayedInfo = {
15
- adaptableApi,
16
- systemStatusMessageInfo: systemStatusMessageInfo,
17
- userName: adaptableApi.optionsApi.getUserName(),
18
- adaptableId: adaptableApi.optionsApi.getAdaptableId(),
19
- };
13
+ const systemStatusMessageDisplayedInfo = Object.assign({ systemStatusMessageInfo: systemStatusMessageInfo }, this.getAdaptableApi().internalApi.buildBaseContext());
20
14
  this.getAdaptableApi().eventApi.emit('SystemStatusMessageDisplayed', systemStatusMessageDisplayedInfo);
21
15
  }
22
16
  addSystemStatusMessageInfo(systemStatusMessageInfo) {
@@ -9,12 +9,7 @@ class TeamSharingInternalApi extends ApiBase_1.ApiBase {
9
9
  */
10
10
  fireTeamSharingEntityChangedEvent(sharedEntity) {
11
11
  if (this.adaptable.isReady) {
12
- const teamSharingEntityChangedInfo = {
13
- adaptableApi: this.adaptable.api,
14
- sharedEntity: sharedEntity,
15
- userName: this.adaptable.api.optionsApi.getUserName(),
16
- adaptableId: this.adaptable.api.optionsApi.getAdaptableId(),
17
- };
12
+ const teamSharingEntityChangedInfo = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { sharedEntity: sharedEntity });
18
13
  this.getAdaptableApi().eventApi.emit('TeamSharingEntityChanged', teamSharingEntityChangedInfo);
19
14
  }
20
15
  }
@@ -41,7 +36,7 @@ class TeamSharingInternalApi extends ApiBase_1.ApiBase {
41
36
  reject(false);
42
37
  }, waitThreshold);
43
38
  // poll state for changes:
44
- const unsubscribe = this.adaptable.api.eventApi.on('AdaptableStateChanged', () => {
39
+ const unsubscribe = this.getAdaptableApi().eventApi.on('AdaptableStateChanged', () => {
45
40
  clearTimeout(pollTimer);
46
41
  pollTimer = setTimeout(() => {
47
42
  // state is stable, cleanup all subscriptions before returning
@@ -13,7 +13,7 @@ class ThemeInternalApi extends ApiBase_1.ApiBase {
13
13
  return `ab--theme-${theme}`;
14
14
  }
15
15
  openInWindow() {
16
- this.adaptable.api.internalApi.showPopupWindow({
16
+ this.getAdaptableApi().internalApi.showPopupWindow({
17
17
  id: windowFactory_1.SHOW_THEME_EDITOR,
18
18
  title: 'Theme',
19
19
  icon: 'theme',
@@ -6,7 +6,7 @@ class UserInterfaceInternalApi extends ApiBase_1.ApiBase {
6
6
  prepareAdaptableIconDef(icon) {
7
7
  if (icon && 'name' in icon) {
8
8
  let customIcon = icon && 'name' in icon
9
- ? this.adaptable.api.userInterfaceApi.getCustomIconDefinition(icon.name)
9
+ ? this.getAdaptableApi().userInterfaceApi.getCustomIconDefinition(icon.name)
10
10
  : null;
11
11
  if (customIcon) {
12
12
  icon = customIcon;
@@ -192,5 +192,6 @@ export interface LayoutApi {
192
192
  PivotColumns: boolean;
193
193
  ColumnFilters: boolean;
194
194
  ColumnSorts: boolean;
195
+ RowSummaries: boolean;
195
196
  };
196
197
  }
@@ -1,4 +1,5 @@
1
1
  import { BaseContext } from '../../../types';
2
+ import { AdaptableColumn } from '../../types';
2
3
  import { SelectedCellInfo } from '../Selection/SelectedCellInfo';
3
4
  /**
4
5
  * Defines the Summary operations provides for Selected Cells
@@ -14,6 +15,8 @@ export interface CellSummmary {
14
15
  Count: number | undefined;
15
16
  Only: string | undefined;
16
17
  Std_Deviation: number | undefined;
18
+ Oldest: Date | undefined;
19
+ Newest: Date | undefined;
17
20
  [key: string]: any;
18
21
  }
19
22
  /**
@@ -38,19 +41,7 @@ export interface CellSummaryOperationContext<TData = any> extends BaseContext {
38
41
  */
39
42
  selectedCellInfo: SelectedCellInfo<TData>;
40
43
  /**
41
- * All values of selected cells
44
+ * Currently selected Column
42
45
  */
43
- allValues: any[];
44
- /**
45
- * Any numeric columns in current selection
46
- */
47
- numericColumns: string[];
48
- /**
49
- * Any numeric values in current selection
50
- */
51
- numericValues: number[];
52
- /**
53
- * Count of currently selected cells
54
- */
55
- distinctCount: number;
46
+ selectedColumn: AdaptableColumn;
56
47
  }
@@ -59,6 +59,8 @@ export declare enum SummaryOperation {
59
59
  Max = "Max",
60
60
  Min = "Min",
61
61
  Count = "Count",
62
+ Newest = "Newest",
63
+ Oldest = "Oldest",
62
64
  Std_Deviation = "Std Deviation",
63
65
  Only = "Only",
64
66
  Weighted_Average = "Weighted Avg"
@@ -76,6 +76,8 @@ var SummaryOperation;
76
76
  SummaryOperation["Max"] = "Max";
77
77
  SummaryOperation["Min"] = "Min";
78
78
  SummaryOperation["Count"] = "Count";
79
+ SummaryOperation["Newest"] = "Newest";
80
+ SummaryOperation["Oldest"] = "Oldest";
79
81
  SummaryOperation["Std_Deviation"] = "Std Deviation";
80
82
  SummaryOperation["Only"] = "Only";
81
83
  SummaryOperation["Weighted_Average"] = "Weighted Avg";
@@ -1,6 +1,6 @@
1
1
  export declare const ROW_SUMMARY_ROW_ID = "__ROW_SUMMARY_ROW_ID";
2
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"];
3
+ export declare const summarySupportedExpressions: readonly ["MIN", "MAX", "SUM", "AVG", "COUNT", "MEDIAN", "MODE", "DISTINCT", "ONLY", "OLDEST", "NEWEST", "STD_DEVIATION", "WEIGHTED_AVERAGE"];
4
4
  export type SummarySupportedExpression = (typeof summarySupportedExpressions)[number];
5
5
  /**
6
6
  * Position of Row Summary - 'Top' or 'Bottom'
@@ -4,17 +4,17 @@ exports.summarySupportedExpressions = exports.WEIGHTED_AVERAGE_AGGREATED_FUNCTIO
4
4
  exports.ROW_SUMMARY_ROW_ID = '__ROW_SUMMARY_ROW_ID';
5
5
  exports.WEIGHTED_AVERAGE_AGGREATED_FUNCTION = 'WEIGHTED_AVERAGE';
6
6
  exports.summarySupportedExpressions = [
7
- 'SUM',
8
- 'AVG',
9
7
  'MIN',
10
8
  'MAX',
9
+ 'SUM',
10
+ 'AVG',
11
11
  'COUNT',
12
12
  'MEDIAN',
13
13
  'MODE',
14
14
  'DISTINCT',
15
15
  'ONLY',
16
- 'STD_DEVIATION',
17
16
  'OLDEST',
18
- 'YOUNGEST',
17
+ 'NEWEST',
18
+ 'STD_DEVIATION',
19
19
  exports.WEIGHTED_AVERAGE_AGGREATED_FUNCTION,
20
20
  ];
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const ModuleConstants = tslib_1.__importStar(require("../Utilities/Constants/ModuleConstants"));
6
6
  const ArrayExtensions_1 = require("../Utilities/Extensions/ArrayExtensions");
7
7
  const Helper_1 = require("../Utilities/Helpers/Helper");
8
+ const ObjectFactory_1 = tslib_1.__importDefault(require("../Utilities/ObjectFactory"));
8
9
  const AggregatedScalarLiveValue_1 = require("../Utilities/Services/AggregatedScalarLiveValue");
9
10
  const CellSummaryStatusPanel_1 = require("../View/CellSummary/CellSummaryStatusPanel");
10
11
  const AdaptableModuleBase_1 = require("./AdaptableModuleBase");
@@ -52,104 +53,63 @@ class CellSummaryModule extends AdaptableModuleBase_1.AdaptableModuleBase {
52
53
  if (this.cachedCellSummary.has(selectedCellInfo)) {
53
54
  return this.cachedCellSummary.get(selectedCellInfo);
54
55
  }
55
- let selectedCellSummary;
56
- if (selectedCellInfo && ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(selectedCellInfo.columns)) {
57
- let numericValues = [];
58
- let allValues = [];
59
- let numericColumns = [];
60
- selectedCellInfo.columns.map((c) => {
61
- if (c && c.dataType == 'Number') {
62
- numericColumns.push(c.columnId);
63
- }
64
- });
65
- selectedCellInfo.gridCells.forEach((selectedCell) => {
66
- let value = selectedCell.rawValue;
67
- allValues.push(value);
68
- if (!selectedCell.column) {
69
- // GridCell.column may be undefined for cells from synthetic columns created by AG Grid (ex. autoGroup columns)
70
- return;
71
- }
72
- if (ArrayExtensions_1.ArrayExtensions.ContainsItem(numericColumns, selectedCell.column.columnId)) {
73
- let valueAsNumber = Number(value);
74
- // possible that its not a number despite it being a numeric column
75
- if (!isNaN(Number(valueAsNumber))) {
76
- numericValues.push(valueAsNumber);
56
+ let selectedCellSummary = ObjectFactory_1.default.CreateEmptyCellSummmary();
57
+ if (selectedCellInfo && ArrayExtensions_1.ArrayExtensions.GetLength(selectedCellInfo.columns) === 1) {
58
+ const selectedColumn = selectedCellInfo.columns[0];
59
+ if (selectedColumn) {
60
+ const isNumericColumn = selectedColumn.dataType === 'Number';
61
+ const isDateColumn = selectedColumn.dataType === 'Date';
62
+ const rowNodes = selectedCellInfo.gridCells.map((gc) => gc.rowNode);
63
+ const handleExpression = (functionName) => {
64
+ const aggScalarValue = new AggregatedScalarLiveValue_1.AggregatedScalarLiveValue({
65
+ aggregatedScalarExpression: `${functionName}([${selectedColumn.columnId}])`,
66
+ }, ModuleConstants.CellSummaryModuleId, this.api, () => rowNodes);
67
+ let value = aggScalarValue.getGlobalAggregatedValue();
68
+ if (typeof value === 'number' && !isNaN(value)) {
69
+ value = Helper_1.Helper.roundNumber(value, 2);
77
70
  }
78
- }
79
- });
80
- // copying so that we keep the order - needed for others
81
- const newNumericValues = [...numericValues];
82
- let hasNumericColumns = numericValues.length > 0;
83
- if (selectedCellInfo.columns.length > 1) {
84
- return {
85
- Sum: null,
86
- Average: null,
87
- Median: null,
88
- Mode: null,
89
- Distinct: null,
90
- Max: null,
91
- Min: null,
92
- Count: null,
93
- Std_Deviation: null,
94
- Only: '',
71
+ return value;
95
72
  };
96
- }
97
- const columnId = selectedCellInfo.columns[0].columnId;
98
- const rowNodes = selectedCellInfo.gridCells.map((gc) => gc.rowNode);
99
- const handleExpression = (functionName) => {
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);
73
+ const sumValue = isNumericColumn ? handleExpression('SUM') : null;
74
+ const avgValue = isNumericColumn ? Helper_1.Helper.roundNumber(handleExpression('AVG'), 2) : null;
75
+ const modeValue = isNumericColumn ? handleExpression('MODE') : null;
76
+ const medianValue = isNumericColumn ? handleExpression('MEDIAN') : null;
77
+ const distinctValue = handleExpression('DISTINCT');
78
+ const maxValue = isNumericColumn ? handleExpression('MAX') : null;
79
+ const minValue = isNumericColumn ? handleExpression('MIN') : null;
80
+ const oldestValue = isDateColumn ? handleExpression('OLDEST') : null;
81
+ const newestValue = isDateColumn ? handleExpression('NEWEST') : null;
82
+ const stdDeviation = isNumericColumn
83
+ ? Helper_1.Helper.roundNumberTo4dp(handleExpression('STD_DEVIATION'))
84
+ : null;
85
+ selectedCellSummary = {
86
+ Sum: sumValue,
87
+ Average: avgValue,
88
+ Median: medianValue,
89
+ Mode: modeValue,
90
+ Distinct: distinctValue,
91
+ Max: maxValue,
92
+ Min: minValue,
93
+ Count: selectedCellInfo.gridCells.length,
94
+ Oldest: oldestValue,
95
+ Newest: newestValue,
96
+ Std_Deviation: stdDeviation,
97
+ Only: distinctValue == 1 ? JSON.stringify(selectedCellInfo.gridCells[0].rawValue) : '',
98
+ };
99
+ const weightedAverage = this.getWeightedAverageCellSummary(selectedColumn.columnId, rowNodes);
100
+ if (weightedAverage !== null) {
101
+ selectedCellSummary.Weighted_Average = weightedAverage;
106
102
  }
107
- return value;
108
- };
109
- const sumValue = hasNumericColumns ? handleExpression('SUM') : null;
110
- const avgValue = hasNumericColumns ? Helper_1.Helper.roundNumber(handleExpression('AVG'), 2) : null;
111
- const modeValue = hasNumericColumns ? handleExpression('MODE') : null;
112
- const medianValue = hasNumericColumns ? handleExpression('MEDIAN') : null;
113
- const distinctValue = handleExpression('DISTINCT');
114
- const maxValue = hasNumericColumns ? handleExpression('MAX') : null;
115
- const minValue = hasNumericColumns ? handleExpression('MIN') : null;
116
- const stdDeviation = hasNumericColumns
117
- ? Helper_1.Helper.roundNumberTo4dp(handleExpression('STD_DEVIATION'))
118
- : null;
119
- selectedCellSummary = {
120
- Sum: sumValue,
121
- Average: avgValue,
122
- Median: medianValue,
123
- Mode: modeValue,
124
- Distinct: distinctValue,
125
- Max: maxValue,
126
- Min: minValue,
127
- Count: allValues.length,
128
- Std_Deviation: stdDeviation,
129
- Only: distinctValue == 1 ? JSON.stringify(allValues[0]) : '',
130
- };
131
- numericValues = [...newNumericValues];
132
- const weightedAverage = this.getWeightedAverageCellSummary(columnId, rowNodes);
133
- if (weightedAverage !== null) {
134
- selectedCellSummary.Weighted_Average = weightedAverage;
103
+ const operationDefinitions = this.api.cellSummaryApi.getCellSummaryOperationDefinitions();
104
+ operationDefinitions === null || operationDefinitions === void 0 ? void 0 : operationDefinitions.forEach((operation) => {
105
+ if (operation.operationFunction) {
106
+ const cellSummaryOperationContext = Object.assign({ selectedCellInfo,
107
+ selectedColumn }, this.api.internalApi.buildBaseContext());
108
+ selectedCellSummary[operation.operationName] = operation.operationFunction(cellSummaryOperationContext);
109
+ }
110
+ });
111
+ this.cachedCellSummary.set(selectedCellInfo, selectedCellSummary);
135
112
  }
136
- const operationDefinitions = this.api.cellSummaryApi.getCellSummaryOperationDefinitions();
137
- operationDefinitions === null || operationDefinitions === void 0 ? void 0 : operationDefinitions.forEach((operation) => {
138
- if (operation.operationFunction) {
139
- const cellSummaryOperationContext = {
140
- selectedCellInfo,
141
- distinctCount: distinctValue,
142
- allValues,
143
- numericValues,
144
- numericColumns,
145
- adaptableApi: this.api,
146
- userName: this.api.optionsApi.getUserName(),
147
- adaptableId: this.api.optionsApi.getAdaptableId(),
148
- };
149
- selectedCellSummary[operation.operationName] = operation.operationFunction(cellSummaryOperationContext);
150
- }
151
- });
152
- this.cachedCellSummary.set(selectedCellInfo, selectedCellSummary);
153
113
  }
154
114
  return selectedCellSummary;
155
115
  }
@@ -46,6 +46,10 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
46
46
  if (this.api.isDestroyed()) {
47
47
  return;
48
48
  }
49
+ // Currently not available for serverside model
50
+ if (!this.api.layoutApi.internalApi.getLayoutSupportedFeatures().RowSummaries) {
51
+ return;
52
+ }
49
53
  // ROW SUMMARY
50
54
  this.evaluateRowSummary();
51
55
  this.api.eventApi.on('AdaptableStateReloaded', () => {
@@ -342,7 +346,7 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
342
346
  const firstNColumns = columns
343
347
  .slice(0, maxColumnsToDisplay)
344
348
  .map((column) => columnIdToFriendlyName(column));
345
- columns = [...firstNColumns, `and other ${extraColumns}`];
349
+ columns = [...firstNColumns, `and ${extraColumns} more`];
346
350
  }
347
351
  else {
348
352
  columns = columns.map((column) => columnIdToFriendlyName(column));
@@ -6,7 +6,7 @@ import { AggregateParams } from './scalarAggregationHelper';
6
6
  * List of all the AggregatedScalar Functions available in AdaptableQL
7
7
  */
8
8
  export type AggregatedScalarFunctionName = ScalarAggregationFunction | OperandFunction;
9
- export type ScalarAggregationFunction = 'SUM' | 'PERCENTAGE' | 'QUANT' | 'QUARTILE' | 'PERCENTILE' | 'AVG' | 'MIN' | 'MAX' | 'COUNT' | 'CUMUL' | 'MEDIAN' | 'MODE' | 'DISTINCT' | 'ONLY' | 'STD_DEVIATION' | 'OLDEST' | 'YOUNGEST';
9
+ export type ScalarAggregationFunction = 'SUM' | 'PERCENTAGE' | 'QUANT' | 'QUARTILE' | 'PERCENTILE' | 'AVG' | 'MIN' | 'MAX' | 'COUNT' | 'CUMUL' | 'MEDIAN' | 'MODE' | 'DISTINCT' | 'ONLY' | 'STD_DEVIATION' | 'OLDEST' | 'NEWEST';
10
10
  type OperandFunction = 'COL' | 'OVER' | 'GROUP_BY' | 'WEIGHT';
11
11
  export interface ScalarAggregationParameter extends BaseParameter<'aggregationScalar', ScalarAggregationFunction> {
12
12
  value: AggregatedScalarExpressionEvaluation;