@adaptabletools/adaptable 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.
- package/package.json +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -1
- package/src/AdaptableOptions/CommentOptions.d.ts +2 -2
- package/src/AdaptableOptions/MenuOptions.d.ts +4 -4
- package/src/Api/GridApi.d.ts +2 -1
- package/src/Api/Implementation/ActionRowApiImpl.js +3 -7
- package/src/Api/Implementation/AlertApiImpl.js +5 -10
- package/src/Api/Implementation/CalendarApiImpl.js +1 -6
- package/src/Api/Implementation/ChartingApiImpl.js +3 -3
- package/src/Api/Implementation/ColumnApiImpl.js +6 -6
- package/src/Api/Implementation/ColumnFilterApiImpl.js +7 -7
- package/src/Api/Implementation/CommentsApiImpl.js +1 -1
- package/src/Api/Implementation/ConfigApiImpl.js +11 -17
- package/src/Api/Implementation/DashboardApiImpl.js +1 -6
- package/src/Api/Implementation/ExportApiImpl.js +5 -10
- package/src/Api/Implementation/ExpressionApiImpl.js +8 -13
- package/src/Api/Implementation/Fdc3ApiImpl.js +1 -1
- package/src/Api/Implementation/FlashingCellApiImpl.js +3 -8
- package/src/Api/Implementation/FormatColumnApiImpl.js +4 -4
- package/src/Api/Implementation/FreeTextColumnApiImpl.js +1 -1
- package/src/Api/Implementation/GridApiImpl.d.ts +2 -1
- package/src/Api/Implementation/GridApiImpl.js +11 -8
- package/src/Api/Implementation/LayoutApiImpl.d.ts +2 -0
- package/src/Api/Implementation/LayoutApiImpl.js +2 -13
- package/src/Api/Implementation/PredicateApiImpl.js +2 -2
- package/src/Api/Implementation/ScheduleApiImpl.js +6 -6
- package/src/Api/Implementation/ScopeApiImpl.js +10 -10
- package/src/Api/Implementation/TeamSharingApiImpl.js +3 -15
- package/src/Api/Implementation/ThemeApiImpl.js +2 -7
- package/src/Api/Implementation/UserInterfaceApiImpl.js +4 -13
- package/src/Api/Internal/ActionRowInternalApi.js +7 -45
- package/src/Api/Internal/AdaptableInternalApi.js +2 -12
- package/src/Api/Internal/AlertInternalApi.js +4 -17
- package/src/Api/Internal/CalculatedColumnInternalApi.js +7 -14
- package/src/Api/Internal/ChartingInternalApi.js +13 -13
- package/src/Api/Internal/ColumnFilterInternalApi.js +18 -36
- package/src/Api/Internal/CustomSortInternalApi.js +1 -1
- package/src/Api/Internal/DashboardInternalApi.js +4 -10
- package/src/Api/Internal/DataImportInternalApi.js +3 -9
- package/src/Api/Internal/DataSetInternalApi.js +2 -7
- package/src/Api/Internal/ExportInternalApi.js +4 -4
- package/src/Api/Internal/ExpressionInternalApi.js +2 -12
- package/src/Api/Internal/Fdc3InternalApi.js +1 -10
- package/src/Api/Internal/FormatColumnInternalApi.js +11 -20
- package/src/Api/Internal/FreeTextColumnInternalApi.js +1 -1
- package/src/Api/Internal/GridFilterInternalApi.js +2 -8
- package/src/Api/Internal/GridInternalApi.js +13 -40
- package/src/Api/Internal/LayoutInternalApi.d.ts +1 -0
- package/src/Api/Internal/LayoutInternalApi.js +10 -19
- package/src/Api/Internal/PredicateInternalApi.js +5 -40
- package/src/Api/Internal/ScheduleInternalApi.js +1 -6
- package/src/Api/Internal/StyledColumnInternalApi.js +5 -5
- package/src/Api/Internal/SystemStatusInternalApi.js +1 -7
- package/src/Api/Internal/TeamSharingInternalApi.js +2 -7
- package/src/Api/Internal/ThemeInternalApi.js +1 -1
- package/src/Api/Internal/UserInterfaceInternalApi.js +1 -1
- package/src/Api/LayoutApi.d.ts +1 -0
- package/src/PredefinedConfig/Common/CellSummary.d.ts +5 -14
- package/src/PredefinedConfig/Common/Enums.d.ts +2 -0
- package/src/PredefinedConfig/Common/Enums.js +2 -0
- package/src/PredefinedConfig/Common/RowSummary.d.ts +1 -1
- package/src/PredefinedConfig/Common/RowSummary.js +4 -4
- package/src/Strategy/CellSummaryModule.js +54 -94
- package/src/Strategy/LayoutModule.js +5 -1
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +1 -1
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +19 -19
- package/src/Utilities/Helpers/AdaptableHelper.js +3 -2
- package/src/Utilities/ObjectFactory.js +2 -0
- package/src/View/Layout/Wizard/LayoutWizard.js +1 -0
- package/src/View/Layout/Wizard/sections/RowGroupingSection.js +17 -1
- package/src/View/Layout/Wizard/sections/RowSummarySection.js +5 -5
- package/src/agGrid/AdaptableAgGrid.d.ts +1 -1
- package/src/agGrid/AdaptableAgGrid.js +1 -1
- package/src/agGrid/AgGridAdapter.d.ts +1 -2
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.d.ts +8 -2
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/tsconfig.esm.tsbuildinfo +1 -1
|
@@ -18,14 +18,7 @@ export class PredicateInternalApi extends ApiBase {
|
|
|
18
18
|
getSystemFilterPredicateIds(scope) {
|
|
19
19
|
const systemFilterPredicates = this.getPredicateOptions().systemFilterPredicates;
|
|
20
20
|
if (typeof systemFilterPredicates === 'function') {
|
|
21
|
-
const systemPredicateContext = {
|
|
22
|
-
adaptableApi: this.adaptable.api,
|
|
23
|
-
userName: this.getOptions().userName,
|
|
24
|
-
adaptableId: this.getOptions().adaptableId,
|
|
25
|
-
systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('columnFilter'),
|
|
26
|
-
moduleScope: 'columnFilter',
|
|
27
|
-
columnScope: scope,
|
|
28
|
-
};
|
|
21
|
+
const systemPredicateContext = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('columnFilter'), moduleScope: 'columnFilter', columnScope: scope });
|
|
29
22
|
return systemFilterPredicates(systemPredicateContext);
|
|
30
23
|
}
|
|
31
24
|
return systemFilterPredicates;
|
|
@@ -40,14 +33,7 @@ export class PredicateInternalApi extends ApiBase {
|
|
|
40
33
|
getSystemAlertPredicateIds(scope) {
|
|
41
34
|
const systemAlertPredicates = this.getPredicateOptions().systemAlertPredicates;
|
|
42
35
|
if (typeof systemAlertPredicates === 'function') {
|
|
43
|
-
const systemPredicateContext = {
|
|
44
|
-
adaptableApi: this.adaptable.api,
|
|
45
|
-
userName: this.getOptions().userName,
|
|
46
|
-
adaptableId: this.getOptions().adaptableId,
|
|
47
|
-
systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('alert'),
|
|
48
|
-
moduleScope: 'alert',
|
|
49
|
-
columnScope: scope,
|
|
50
|
-
};
|
|
36
|
+
const systemPredicateContext = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('alert'), moduleScope: 'alert', columnScope: scope });
|
|
51
37
|
return systemAlertPredicates(systemPredicateContext);
|
|
52
38
|
}
|
|
53
39
|
return systemAlertPredicates;
|
|
@@ -55,14 +41,7 @@ export class PredicateInternalApi extends ApiBase {
|
|
|
55
41
|
getSystemBadgeStylePredicateIds(scope) {
|
|
56
42
|
const systemBadgeStylePredicates = this.getPredicateOptions().systemBadgeStylePredicates;
|
|
57
43
|
if (typeof systemBadgeStylePredicates === 'function') {
|
|
58
|
-
const systemPredicateContext = {
|
|
59
|
-
adaptableApi: this.adaptable.api,
|
|
60
|
-
userName: this.getOptions().userName,
|
|
61
|
-
adaptableId: this.getOptions().adaptableId,
|
|
62
|
-
systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('badgeStyle'),
|
|
63
|
-
moduleScope: 'badgeStyle',
|
|
64
|
-
columnScope: scope,
|
|
65
|
-
};
|
|
44
|
+
const systemPredicateContext = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('badgeStyle'), moduleScope: 'badgeStyle', columnScope: scope });
|
|
66
45
|
return systemBadgeStylePredicates(systemPredicateContext);
|
|
67
46
|
}
|
|
68
47
|
return systemBadgeStylePredicates;
|
|
@@ -77,14 +56,7 @@ export class PredicateInternalApi extends ApiBase {
|
|
|
77
56
|
getSystemFormatColumnPredicateIds(scope) {
|
|
78
57
|
const systemFormatColumnPredicates = this.getPredicateOptions().systemFormatColumnPredicates;
|
|
79
58
|
if (typeof systemFormatColumnPredicates === 'function') {
|
|
80
|
-
const systemPredicateContext = {
|
|
81
|
-
adaptableApi: this.adaptable.api,
|
|
82
|
-
userName: this.getOptions().userName,
|
|
83
|
-
adaptableId: this.getOptions().adaptableId,
|
|
84
|
-
systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('formatColumn'),
|
|
85
|
-
moduleScope: 'formatColumn',
|
|
86
|
-
columnScope: scope,
|
|
87
|
-
};
|
|
59
|
+
const systemPredicateContext = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('formatColumn'), moduleScope: 'formatColumn', columnScope: scope });
|
|
88
60
|
return systemFormatColumnPredicates(systemPredicateContext);
|
|
89
61
|
}
|
|
90
62
|
return systemFormatColumnPredicates;
|
|
@@ -99,14 +71,7 @@ export class PredicateInternalApi extends ApiBase {
|
|
|
99
71
|
getSystemFlashingCellPredicateIds(scope) {
|
|
100
72
|
const systemFlashingCellPredicates = this.getPredicateOptions().systemFlashingCellPredicates;
|
|
101
73
|
if (typeof systemFlashingCellPredicates === 'function') {
|
|
102
|
-
const systemPredicateContext = {
|
|
103
|
-
adaptableApi: this.adaptable.api,
|
|
104
|
-
userName: this.getOptions().userName,
|
|
105
|
-
adaptableId: this.getOptions().adaptableId,
|
|
106
|
-
systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('flashingcell'),
|
|
107
|
-
moduleScope: 'flashingcell',
|
|
108
|
-
columnScope: scope,
|
|
109
|
-
};
|
|
74
|
+
const systemPredicateContext = Object.assign({ systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('flashingcell'), moduleScope: 'flashingcell', columnScope: scope }, this.getAdaptableApi().internalApi.buildBaseContext());
|
|
110
75
|
return systemFlashingCellPredicates(systemPredicateContext);
|
|
111
76
|
}
|
|
112
77
|
return systemFlashingCellPredicates;
|
|
@@ -5,12 +5,7 @@ export class ScheduleInternalApi extends ApiBase {
|
|
|
5
5
|
*/
|
|
6
6
|
fireScheduleTriggeredEvent(schedule) {
|
|
7
7
|
const adaptableApi = this.getAdaptableApi();
|
|
8
|
-
const scheduleTriggeredInfo = {
|
|
9
|
-
adaptableApi: adaptableApi,
|
|
10
|
-
userName: adaptableApi.optionsApi.getUserName(),
|
|
11
|
-
adaptableId: adaptableApi.optionsApi.getAdaptableId(),
|
|
12
|
-
schedule: schedule,
|
|
13
|
-
};
|
|
8
|
+
const scheduleTriggeredInfo = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { schedule: schedule });
|
|
14
9
|
adaptableApi.eventApi.emit('ScheduleTriggered', scheduleTriggeredInfo);
|
|
15
10
|
}
|
|
16
11
|
}
|
|
@@ -30,11 +30,11 @@ export class StyledColumnInternalApi extends ApiBase {
|
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
32
|
let columnId = columnComparison.MinValue;
|
|
33
|
-
if (!this.
|
|
33
|
+
if (!this.getAdaptableApi().columnApi.isColumnInGrid(columnId)) {
|
|
34
34
|
return 0;
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
return this.
|
|
37
|
+
return this.getAdaptableApi().gridApi.getRawValueFromRowNode(rowNode, columnId);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -93,11 +93,11 @@ export class StyledColumnInternalApi extends ApiBase {
|
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
95
95
|
let columnId = columnComparison.MaxValue;
|
|
96
|
-
if (!this.
|
|
96
|
+
if (!this.getAdaptableApi().columnApi.isColumnInGrid(columnId)) {
|
|
97
97
|
return 0;
|
|
98
98
|
}
|
|
99
99
|
else {
|
|
100
|
-
return this.
|
|
100
|
+
return this.getAdaptableApi().gridApi.getRawValueFromRowNode(rowNode, columnId);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
}
|
|
@@ -275,6 +275,6 @@ export class StyledColumnInternalApi extends ApiBase {
|
|
|
275
275
|
};
|
|
276
276
|
return this.getAdaptableApi()
|
|
277
277
|
.predicateApi.internalApi.getBadgeStylePredicateDefs(scope)
|
|
278
|
-
.filter((predicate) => this.
|
|
278
|
+
.filter((predicate) => this.getAdaptableApi().scopeApi.isColumnInScope(column, predicate.columnScope));
|
|
279
279
|
}
|
|
280
280
|
}
|
|
@@ -6,13 +6,7 @@ export class SystemStatusInternalApi extends ApiBase {
|
|
|
6
6
|
* @param systemStatusMessageInfo Info about new System Status Message
|
|
7
7
|
*/
|
|
8
8
|
fireSystemStatusMessageDisplayedEvent(systemStatusMessageInfo) {
|
|
9
|
-
const
|
|
10
|
-
const systemStatusMessageDisplayedInfo = {
|
|
11
|
-
adaptableApi,
|
|
12
|
-
systemStatusMessageInfo: systemStatusMessageInfo,
|
|
13
|
-
userName: adaptableApi.optionsApi.getUserName(),
|
|
14
|
-
adaptableId: adaptableApi.optionsApi.getAdaptableId(),
|
|
15
|
-
};
|
|
9
|
+
const systemStatusMessageDisplayedInfo = Object.assign({ systemStatusMessageInfo: systemStatusMessageInfo }, this.getAdaptableApi().internalApi.buildBaseContext());
|
|
16
10
|
this.getAdaptableApi().eventApi.emit('SystemStatusMessageDisplayed', systemStatusMessageDisplayedInfo);
|
|
17
11
|
}
|
|
18
12
|
addSystemStatusMessageInfo(systemStatusMessageInfo) {
|
|
@@ -6,12 +6,7 @@ export class TeamSharingInternalApi extends ApiBase {
|
|
|
6
6
|
*/
|
|
7
7
|
fireTeamSharingEntityChangedEvent(sharedEntity) {
|
|
8
8
|
if (this.adaptable.isReady) {
|
|
9
|
-
const teamSharingEntityChangedInfo = {
|
|
10
|
-
adaptableApi: this.adaptable.api,
|
|
11
|
-
sharedEntity: sharedEntity,
|
|
12
|
-
userName: this.adaptable.api.optionsApi.getUserName(),
|
|
13
|
-
adaptableId: this.adaptable.api.optionsApi.getAdaptableId(),
|
|
14
|
-
};
|
|
9
|
+
const teamSharingEntityChangedInfo = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { sharedEntity: sharedEntity });
|
|
15
10
|
this.getAdaptableApi().eventApi.emit('TeamSharingEntityChanged', teamSharingEntityChangedInfo);
|
|
16
11
|
}
|
|
17
12
|
}
|
|
@@ -38,7 +33,7 @@ export class TeamSharingInternalApi extends ApiBase {
|
|
|
38
33
|
reject(false);
|
|
39
34
|
}, waitThreshold);
|
|
40
35
|
// poll state for changes:
|
|
41
|
-
const unsubscribe = this.
|
|
36
|
+
const unsubscribe = this.getAdaptableApi().eventApi.on('AdaptableStateChanged', () => {
|
|
42
37
|
clearTimeout(pollTimer);
|
|
43
38
|
pollTimer = setTimeout(() => {
|
|
44
39
|
// state is stable, cleanup all subscriptions before returning
|
|
@@ -10,7 +10,7 @@ export class ThemeInternalApi extends ApiBase {
|
|
|
10
10
|
return `ab--theme-${theme}`;
|
|
11
11
|
}
|
|
12
12
|
openInWindow() {
|
|
13
|
-
this.
|
|
13
|
+
this.getAdaptableApi().internalApi.showPopupWindow({
|
|
14
14
|
id: SHOW_THEME_EDITOR,
|
|
15
15
|
title: 'Theme',
|
|
16
16
|
icon: 'theme',
|
|
@@ -3,7 +3,7 @@ export class UserInterfaceInternalApi extends ApiBase {
|
|
|
3
3
|
prepareAdaptableIconDef(icon) {
|
|
4
4
|
if (icon && 'name' in icon) {
|
|
5
5
|
let customIcon = icon && 'name' in icon
|
|
6
|
-
? this.
|
|
6
|
+
? this.getAdaptableApi().userInterfaceApi.getCustomIconDefinition(icon.name)
|
|
7
7
|
: null;
|
|
8
8
|
if (customIcon) {
|
|
9
9
|
icon = customIcon;
|
package/src/Api/LayoutApi.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
44
|
+
* Currently selected Column
|
|
42
45
|
*/
|
|
43
|
-
|
|
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
|
}
|
|
@@ -73,6 +73,8 @@ export var SummaryOperation;
|
|
|
73
73
|
SummaryOperation["Max"] = "Max";
|
|
74
74
|
SummaryOperation["Min"] = "Min";
|
|
75
75
|
SummaryOperation["Count"] = "Count";
|
|
76
|
+
SummaryOperation["Newest"] = "Newest";
|
|
77
|
+
SummaryOperation["Oldest"] = "Oldest";
|
|
76
78
|
SummaryOperation["Std_Deviation"] = "Std Deviation";
|
|
77
79
|
SummaryOperation["Only"] = "Only";
|
|
78
80
|
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 ["
|
|
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'
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
export const ROW_SUMMARY_ROW_ID = '__ROW_SUMMARY_ROW_ID';
|
|
2
2
|
export const WEIGHTED_AVERAGE_AGGREATED_FUNCTION = 'WEIGHTED_AVERAGE';
|
|
3
3
|
export const summarySupportedExpressions = [
|
|
4
|
-
'SUM',
|
|
5
|
-
'AVG',
|
|
6
4
|
'MIN',
|
|
7
5
|
'MAX',
|
|
6
|
+
'SUM',
|
|
7
|
+
'AVG',
|
|
8
8
|
'COUNT',
|
|
9
9
|
'MEDIAN',
|
|
10
10
|
'MODE',
|
|
11
11
|
'DISTINCT',
|
|
12
12
|
'ONLY',
|
|
13
|
-
'STD_DEVIATION',
|
|
14
13
|
'OLDEST',
|
|
15
|
-
'
|
|
14
|
+
'NEWEST',
|
|
15
|
+
'STD_DEVIATION',
|
|
16
16
|
WEIGHTED_AVERAGE_AGGREATED_FUNCTION,
|
|
17
17
|
];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as ModuleConstants from '../Utilities/Constants/ModuleConstants';
|
|
2
2
|
import { ArrayExtensions } from '../Utilities/Extensions/ArrayExtensions';
|
|
3
3
|
import { Helper } from '../Utilities/Helpers/Helper';
|
|
4
|
+
import ObjectFactory from '../Utilities/ObjectFactory';
|
|
4
5
|
import { AggregatedScalarLiveValue } from '../Utilities/Services/AggregatedScalarLiveValue';
|
|
5
6
|
import { CellSummaryStatusPanel } from '../View/CellSummary/CellSummaryStatusPanel';
|
|
6
7
|
import { AdaptableModuleBase } from './AdaptableModuleBase';
|
|
@@ -48,104 +49,63 @@ export class CellSummaryModule extends AdaptableModuleBase {
|
|
|
48
49
|
if (this.cachedCellSummary.has(selectedCellInfo)) {
|
|
49
50
|
return this.cachedCellSummary.get(selectedCellInfo);
|
|
50
51
|
}
|
|
51
|
-
let selectedCellSummary;
|
|
52
|
-
if (selectedCellInfo && ArrayExtensions.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
// GridCell.column may be undefined for cells from synthetic columns created by AG Grid (ex. autoGroup columns)
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
if (ArrayExtensions.ContainsItem(numericColumns, selectedCell.column.columnId)) {
|
|
69
|
-
let valueAsNumber = Number(value);
|
|
70
|
-
// possible that its not a number despite it being a numeric column
|
|
71
|
-
if (!isNaN(Number(valueAsNumber))) {
|
|
72
|
-
numericValues.push(valueAsNumber);
|
|
52
|
+
let selectedCellSummary = ObjectFactory.CreateEmptyCellSummmary();
|
|
53
|
+
if (selectedCellInfo && ArrayExtensions.GetLength(selectedCellInfo.columns) === 1) {
|
|
54
|
+
const selectedColumn = selectedCellInfo.columns[0];
|
|
55
|
+
if (selectedColumn) {
|
|
56
|
+
const isNumericColumn = selectedColumn.dataType === 'Number';
|
|
57
|
+
const isDateColumn = selectedColumn.dataType === 'Date';
|
|
58
|
+
const rowNodes = selectedCellInfo.gridCells.map((gc) => gc.rowNode);
|
|
59
|
+
const handleExpression = (functionName) => {
|
|
60
|
+
const aggScalarValue = new AggregatedScalarLiveValue({
|
|
61
|
+
aggregatedScalarExpression: `${functionName}([${selectedColumn.columnId}])`,
|
|
62
|
+
}, ModuleConstants.CellSummaryModuleId, this.api, () => rowNodes);
|
|
63
|
+
let value = aggScalarValue.getGlobalAggregatedValue();
|
|
64
|
+
if (typeof value === 'number' && !isNaN(value)) {
|
|
65
|
+
value = Helper.roundNumber(value, 2);
|
|
73
66
|
}
|
|
74
|
-
|
|
75
|
-
});
|
|
76
|
-
// copying so that we keep the order - needed for others
|
|
77
|
-
const newNumericValues = [...numericValues];
|
|
78
|
-
let hasNumericColumns = numericValues.length > 0;
|
|
79
|
-
if (selectedCellInfo.columns.length > 1) {
|
|
80
|
-
return {
|
|
81
|
-
Sum: null,
|
|
82
|
-
Average: null,
|
|
83
|
-
Median: null,
|
|
84
|
-
Mode: null,
|
|
85
|
-
Distinct: null,
|
|
86
|
-
Max: null,
|
|
87
|
-
Min: null,
|
|
88
|
-
Count: null,
|
|
89
|
-
Std_Deviation: null,
|
|
90
|
-
Only: '',
|
|
67
|
+
return value;
|
|
91
68
|
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
69
|
+
const sumValue = isNumericColumn ? handleExpression('SUM') : null;
|
|
70
|
+
const avgValue = isNumericColumn ? Helper.roundNumber(handleExpression('AVG'), 2) : null;
|
|
71
|
+
const modeValue = isNumericColumn ? handleExpression('MODE') : null;
|
|
72
|
+
const medianValue = isNumericColumn ? handleExpression('MEDIAN') : null;
|
|
73
|
+
const distinctValue = handleExpression('DISTINCT');
|
|
74
|
+
const maxValue = isNumericColumn ? handleExpression('MAX') : null;
|
|
75
|
+
const minValue = isNumericColumn ? handleExpression('MIN') : null;
|
|
76
|
+
const oldestValue = isDateColumn ? handleExpression('OLDEST') : null;
|
|
77
|
+
const newestValue = isDateColumn ? handleExpression('NEWEST') : null;
|
|
78
|
+
const stdDeviation = isNumericColumn
|
|
79
|
+
? Helper.roundNumberTo4dp(handleExpression('STD_DEVIATION'))
|
|
80
|
+
: null;
|
|
81
|
+
selectedCellSummary = {
|
|
82
|
+
Sum: sumValue,
|
|
83
|
+
Average: avgValue,
|
|
84
|
+
Median: medianValue,
|
|
85
|
+
Mode: modeValue,
|
|
86
|
+
Distinct: distinctValue,
|
|
87
|
+
Max: maxValue,
|
|
88
|
+
Min: minValue,
|
|
89
|
+
Count: selectedCellInfo.gridCells.length,
|
|
90
|
+
Oldest: oldestValue,
|
|
91
|
+
Newest: newestValue,
|
|
92
|
+
Std_Deviation: stdDeviation,
|
|
93
|
+
Only: distinctValue == 1 ? JSON.stringify(selectedCellInfo.gridCells[0].rawValue) : '',
|
|
94
|
+
};
|
|
95
|
+
const weightedAverage = this.getWeightedAverageCellSummary(selectedColumn.columnId, rowNodes);
|
|
96
|
+
if (weightedAverage !== null) {
|
|
97
|
+
selectedCellSummary.Weighted_Average = weightedAverage;
|
|
102
98
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const stdDeviation = hasNumericColumns
|
|
113
|
-
? Helper.roundNumberTo4dp(handleExpression('STD_DEVIATION'))
|
|
114
|
-
: null;
|
|
115
|
-
selectedCellSummary = {
|
|
116
|
-
Sum: sumValue,
|
|
117
|
-
Average: avgValue,
|
|
118
|
-
Median: medianValue,
|
|
119
|
-
Mode: modeValue,
|
|
120
|
-
Distinct: distinctValue,
|
|
121
|
-
Max: maxValue,
|
|
122
|
-
Min: minValue,
|
|
123
|
-
Count: allValues.length,
|
|
124
|
-
Std_Deviation: stdDeviation,
|
|
125
|
-
Only: distinctValue == 1 ? JSON.stringify(allValues[0]) : '',
|
|
126
|
-
};
|
|
127
|
-
numericValues = [...newNumericValues];
|
|
128
|
-
const weightedAverage = this.getWeightedAverageCellSummary(columnId, rowNodes);
|
|
129
|
-
if (weightedAverage !== null) {
|
|
130
|
-
selectedCellSummary.Weighted_Average = weightedAverage;
|
|
99
|
+
const operationDefinitions = this.api.cellSummaryApi.getCellSummaryOperationDefinitions();
|
|
100
|
+
operationDefinitions === null || operationDefinitions === void 0 ? void 0 : operationDefinitions.forEach((operation) => {
|
|
101
|
+
if (operation.operationFunction) {
|
|
102
|
+
const cellSummaryOperationContext = Object.assign({ selectedCellInfo,
|
|
103
|
+
selectedColumn }, this.api.internalApi.buildBaseContext());
|
|
104
|
+
selectedCellSummary[operation.operationName] = operation.operationFunction(cellSummaryOperationContext);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
this.cachedCellSummary.set(selectedCellInfo, selectedCellSummary);
|
|
131
108
|
}
|
|
132
|
-
const operationDefinitions = this.api.cellSummaryApi.getCellSummaryOperationDefinitions();
|
|
133
|
-
operationDefinitions === null || operationDefinitions === void 0 ? void 0 : operationDefinitions.forEach((operation) => {
|
|
134
|
-
if (operation.operationFunction) {
|
|
135
|
-
const cellSummaryOperationContext = {
|
|
136
|
-
selectedCellInfo,
|
|
137
|
-
distinctCount: distinctValue,
|
|
138
|
-
allValues,
|
|
139
|
-
numericValues,
|
|
140
|
-
numericColumns,
|
|
141
|
-
adaptableApi: this.api,
|
|
142
|
-
userName: this.api.optionsApi.getUserName(),
|
|
143
|
-
adaptableId: this.api.optionsApi.getAdaptableId(),
|
|
144
|
-
};
|
|
145
|
-
selectedCellSummary[operation.operationName] = operation.operationFunction(cellSummaryOperationContext);
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
this.cachedCellSummary.set(selectedCellInfo, selectedCellSummary);
|
|
149
109
|
}
|
|
150
110
|
return selectedCellSummary;
|
|
151
111
|
}
|
|
@@ -42,6 +42,10 @@ export class LayoutModule extends AdaptableModuleBase {
|
|
|
42
42
|
if (this.api.isDestroyed()) {
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
+
// Currently not available for serverside model
|
|
46
|
+
if (!this.api.layoutApi.internalApi.getLayoutSupportedFeatures().RowSummaries) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
45
49
|
// ROW SUMMARY
|
|
46
50
|
this.evaluateRowSummary();
|
|
47
51
|
this.api.eventApi.on('AdaptableStateReloaded', () => {
|
|
@@ -338,7 +342,7 @@ export class LayoutModule extends AdaptableModuleBase {
|
|
|
338
342
|
const firstNColumns = columns
|
|
339
343
|
.slice(0, maxColumnsToDisplay)
|
|
340
344
|
.map((column) => columnIdToFriendlyName(column));
|
|
341
|
-
columns = [...firstNColumns, `and
|
|
345
|
+
columns = [...firstNColumns, `and ${extraColumns} more`];
|
|
342
346
|
}
|
|
343
347
|
else {
|
|
344
348
|
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' | '
|
|
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;
|
|
@@ -330,7 +330,7 @@ export const aggregatedScalarExpressionFunctions = {
|
|
|
330
330
|
handler(args, context) {
|
|
331
331
|
const modeColumnParameter = extractColumnParameter('mode', args);
|
|
332
332
|
const modeColumnName = modeColumnParameter.value;
|
|
333
|
-
validateColumnType(modeColumnName, ['Number', 'String'], 'mode', context.adaptableApi);
|
|
333
|
+
validateColumnType(modeColumnName, ['Number', 'String', 'Date'], 'mode', context.adaptableApi);
|
|
334
334
|
const groupByParameter = extractParameter('MODE', 'operand', ['GROUP_BY'], args, {
|
|
335
335
|
isOptional: true,
|
|
336
336
|
});
|
|
@@ -390,7 +390,7 @@ export const aggregatedScalarExpressionFunctions = {
|
|
|
390
390
|
],
|
|
391
391
|
examples: ['MODE([colA])', 'MODE([colA], GROUP_BY([colB]))'],
|
|
392
392
|
category: 'aggregation',
|
|
393
|
-
inputs: [['number'], ['text']],
|
|
393
|
+
inputs: [['number'], ['text'], ['date']],
|
|
394
394
|
},
|
|
395
395
|
DISTINCT: {
|
|
396
396
|
handler(args, context) {
|
|
@@ -438,7 +438,7 @@ export const aggregatedScalarExpressionFunctions = {
|
|
|
438
438
|
],
|
|
439
439
|
examples: ['DISTINCT([colA])', 'DISTINCT([colA], GROUP_BY([colB]))'],
|
|
440
440
|
category: 'aggregation',
|
|
441
|
-
inputs: [['number'], ['text']],
|
|
441
|
+
inputs: [['number'], ['text'], ['date']],
|
|
442
442
|
},
|
|
443
443
|
ONLY: {
|
|
444
444
|
handler(args, context) {
|
|
@@ -488,7 +488,7 @@ export const aggregatedScalarExpressionFunctions = {
|
|
|
488
488
|
],
|
|
489
489
|
examples: ['ONLY([colA])', 'ONLY([colA], GROUP_BY([colB]))'],
|
|
490
490
|
category: 'aggregation',
|
|
491
|
-
inputs: [['number'], ['text']],
|
|
491
|
+
inputs: [['number'], ['text'], ['date']],
|
|
492
492
|
},
|
|
493
493
|
STD_DEVIATION: {
|
|
494
494
|
handler(args, context) {
|
|
@@ -849,7 +849,7 @@ export const aggregatedScalarExpressionFunctions = {
|
|
|
849
849
|
],
|
|
850
850
|
examples: ['COUNT([colA])', 'COUNT([colA], GROUP_BY([colB]))'],
|
|
851
851
|
category: 'aggregation',
|
|
852
|
-
inputs: [['number'], ['text']],
|
|
852
|
+
inputs: [['number'], ['text'], ['date']],
|
|
853
853
|
},
|
|
854
854
|
OVER: {
|
|
855
855
|
handler(args, context) {
|
|
@@ -959,7 +959,7 @@ export const aggregatedScalarExpressionFunctions = {
|
|
|
959
959
|
};
|
|
960
960
|
return result;
|
|
961
961
|
},
|
|
962
|
-
description: 'Aggregates a column over multiple rows by computing the
|
|
962
|
+
description: 'Aggregates a Date column over multiple rows by computing the oldest of the column values\nOptionally the aggregation may be computed within provided individual groups',
|
|
963
963
|
signatures: [
|
|
964
964
|
'OLDEST( [colName] )',
|
|
965
965
|
'OLDEST( COL(name: string))',
|
|
@@ -970,19 +970,19 @@ export const aggregatedScalarExpressionFunctions = {
|
|
|
970
970
|
category: 'aggregation',
|
|
971
971
|
inputs: ['date'],
|
|
972
972
|
},
|
|
973
|
-
|
|
973
|
+
NEWEST: {
|
|
974
974
|
handler(args, context) {
|
|
975
|
-
const minColumnParameter = extractColumnParameter('
|
|
975
|
+
const minColumnParameter = extractColumnParameter('NEWEST', args);
|
|
976
976
|
const minColumnName = minColumnParameter.value;
|
|
977
|
-
validateColumnType(minColumnName, ['Date'], '
|
|
978
|
-
const groupByParameter = extractParameter('
|
|
977
|
+
validateColumnType(minColumnName, ['Date'], 'NEWEST', context.adaptableApi);
|
|
978
|
+
const groupByParameter = extractParameter('NEWEST', 'operand', ['GROUP_BY'], args, {
|
|
979
979
|
isOptional: true,
|
|
980
980
|
});
|
|
981
981
|
const aggregationExpressionEvaluation = {
|
|
982
982
|
aggregationParams: {
|
|
983
983
|
reducers: {
|
|
984
|
-
|
|
985
|
-
name: '
|
|
984
|
+
NEWEST: {
|
|
985
|
+
name: 'NEWEST',
|
|
986
986
|
field: minColumnName,
|
|
987
987
|
initialValue: null,
|
|
988
988
|
reducer: (minValue, rowValue) => {
|
|
@@ -1012,20 +1012,20 @@ export const aggregatedScalarExpressionFunctions = {
|
|
|
1012
1012
|
};
|
|
1013
1013
|
addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
|
|
1014
1014
|
const result = {
|
|
1015
|
-
name: '
|
|
1015
|
+
name: 'NEWEST',
|
|
1016
1016
|
type: 'aggregationScalar',
|
|
1017
1017
|
value: aggregationExpressionEvaluation,
|
|
1018
1018
|
};
|
|
1019
1019
|
return result;
|
|
1020
1020
|
},
|
|
1021
|
-
description: 'Aggregates a column over multiple rows by computing the
|
|
1021
|
+
description: 'Aggregates a Date column over multiple rows by computing the most recent of the column values\nOptionally the aggregation may be computed within provided individual groups',
|
|
1022
1022
|
signatures: [
|
|
1023
|
-
'
|
|
1024
|
-
'
|
|
1025
|
-
'
|
|
1026
|
-
'
|
|
1023
|
+
'NEWEST( [colName] )',
|
|
1024
|
+
'NEWEST( COL(name: string))',
|
|
1025
|
+
'NEWEST( [colNameA], GROUP_BY( [colNameB] ))',
|
|
1026
|
+
'NEWEST( COL(nameA: string), GROUP_BY( COL(nameB: string)))',
|
|
1027
1027
|
],
|
|
1028
|
-
examples: ['
|
|
1028
|
+
examples: ['NEWEST([colA])', 'NEWEST([colA], GROUP_BY([colB]))'],
|
|
1029
1029
|
category: 'aggregation',
|
|
1030
1030
|
inputs: ['date'],
|
|
1031
1031
|
},
|
|
@@ -87,6 +87,7 @@ export function addUuidAndSource(adaptableObject) {
|
|
|
87
87
|
return adaptableObject;
|
|
88
88
|
}
|
|
89
89
|
export function removeUuidAndSource(adaptableObject) {
|
|
90
|
+
const clonedObject = structuredClone(adaptableObject);
|
|
90
91
|
const sanitiseObject = (object) => {
|
|
91
92
|
for (const key in object) {
|
|
92
93
|
if (key === 'Source' || key === 'Uuid') {
|
|
@@ -100,8 +101,8 @@ export function removeUuidAndSource(adaptableObject) {
|
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
};
|
|
103
|
-
sanitiseObject(
|
|
104
|
-
return
|
|
104
|
+
sanitiseObject(clonedObject);
|
|
105
|
+
return clonedObject;
|
|
105
106
|
}
|
|
106
107
|
export const AdaptableHelper = {
|
|
107
108
|
initPredefinedConfigWithUuids,
|
|
@@ -146,6 +146,7 @@ export const LayoutWizard = (props) => {
|
|
|
146
146
|
title: 'Row Summaries',
|
|
147
147
|
details: 'Configure Row Summaries',
|
|
148
148
|
renderSummary: () => React.createElement(RowGroupingSectionSummary, null),
|
|
149
|
+
isVisible: () => layoutSupportedFeatures.RowSummaries,
|
|
149
150
|
render: () => (React.createElement(Box, { p: 2, style: { height: '100%' } },
|
|
150
151
|
React.createElement(RowSummarySection, { onChange: setLayout }))),
|
|
151
152
|
},
|