@adaptabletools/adaptable-cjs 18.0.0-canary.16 → 18.0.0-canary.18
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 +0 -2
- package/src/AdaptableOptions/ColumnFilterOptions.d.ts +4 -3
- package/src/Api/GridApi.d.ts +1 -1
- package/src/Api/Implementation/CellSummaryApiImpl.d.ts +0 -5
- package/src/Api/Implementation/CellSummaryApiImpl.js +2 -23
- package/src/Api/Implementation/GridApiImpl.d.ts +1 -1
- package/src/Api/Implementation/GridApiImpl.js +1 -1
- package/src/Api/Internal/AdaptableInternalApi.d.ts +0 -2
- package/src/Api/Internal/AdaptableInternalApi.js +0 -3
- package/src/Api/Internal/GridFilterInternalApi.d.ts +5 -0
- package/src/Api/Internal/GridFilterInternalApi.js +6 -0
- package/src/PredefinedConfig/Common/Enums.d.ts +2 -1
- package/src/PredefinedConfig/Common/Enums.js +1 -0
- package/src/PredefinedConfig/Common/Menu.d.ts +15 -1
- package/src/PredefinedConfig/Common/Menu.js +98 -0
- package/src/PredefinedConfig/Common/RowSummary.d.ts +3 -1
- package/src/PredefinedConfig/Common/RowSummary.js +17 -1
- package/src/Redux/Store/AdaptableStore.js +11 -6
- package/src/Strategy/AdaptableModuleBase.d.ts +6 -5
- package/src/Strategy/AdaptableModuleBase.js +9 -8
- package/src/Strategy/AlertModule.js +1 -1
- package/src/Strategy/BulkUpdateModule.js +1 -1
- package/src/Strategy/CalculatedColumnModule.js +1 -1
- package/src/Strategy/CellSummaryModule.d.ts +7 -6
- package/src/Strategy/CellSummaryModule.js +37 -12
- package/src/Strategy/ColumnFilterModule.d.ts +1 -1
- package/src/Strategy/ColumnFilterModule.js +43 -39
- package/src/Strategy/ColumnInfoModule.js +2 -0
- package/src/Strategy/CommentModule.js +2 -2
- package/src/Strategy/CustomSortModule.js +2 -1
- package/src/Strategy/DashboardModule.js +8 -7
- package/src/Strategy/DataImportModule.js +1 -1
- package/src/Strategy/ExportModule.d.ts +1 -0
- package/src/Strategy/ExportModule.js +17 -2
- package/src/Strategy/Fdc3Module.js +3 -0
- package/src/Strategy/FlashingCellModule.js +4 -4
- package/src/Strategy/FormatColumnModule.js +6 -4
- package/src/Strategy/FreeTextColumnModule.js +1 -1
- package/src/Strategy/GridInfoModule.js +2 -0
- package/src/Strategy/LayoutModule.js +31 -22
- package/src/Strategy/NoteModule.js +2 -2
- package/src/Strategy/PlusMinusModule.js +1 -1
- package/src/Strategy/SettingsPanelModule.js +3 -3
- package/src/Strategy/SmartEditModule.js +1 -1
- package/src/Strategy/StyledColumnModule.d.ts +1 -0
- package/src/Strategy/StyledColumnModule.js +26 -5
- package/src/Strategy/SystemStatusModule.js +2 -2
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +2 -2
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +125 -3
- package/src/Utilities/MenuItem.d.ts +7 -4
- package/src/Utilities/MenuItem.js +6 -3
- package/src/Utilities/Services/LicenseService/index.js +1 -1
- package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +5 -2
- package/src/View/Components/FilterForm/QuickFilterForm.js +1 -1
- package/src/View/Components/ValueSelector/index.js +1 -1
- package/src/View/Layout/Wizard/LayoutWizard.js +25 -1
- package/src/View/Layout/Wizard/sections/RowSummarySection.d.ts +1 -0
- package/src/View/Layout/Wizard/sections/RowSummarySection.js +29 -4
- package/src/agGrid/AdaptableAgGrid.d.ts +0 -2
- package/src/agGrid/AdaptableAgGrid.js +7 -3
- package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +1 -1
- package/src/agGrid/editors/AdaptableDateEditor/index.js +1 -1
- package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +2 -2
- package/src/agGrid/weightedAverage.d.ts +0 -2
- package/src/agGrid/weightedAverage.js +1 -56
- package/src/components/Datepicker/index.js +3 -1
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/src/Utilities/Services/Interface/ISummaryService.d.ts +0 -17
- package/src/Utilities/Services/Interface/ISummaryService.js +0 -15
- package/src/Utilities/Services/SummaryService.d.ts +0 -10
- package/src/Utilities/Services/SummaryService.js +0 -21
|
@@ -64,7 +64,7 @@ class PlusMinusModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
64
64
|
source: 'ColumnMenu',
|
|
65
65
|
};
|
|
66
66
|
return [
|
|
67
|
-
this.
|
|
67
|
+
this.createMenuItemShowPopup('plus-minus-add', 'Create Plus/Minus Rule', this.moduleInfo.Popup, this.moduleInfo.Glyph, popupParam),
|
|
68
68
|
];
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -13,17 +13,17 @@ class SettingsPanelModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
13
13
|
addColumnMenuItems(column) {
|
|
14
14
|
return [
|
|
15
15
|
// To do : get the icon and name from settings in case they have changed?
|
|
16
|
-
this.
|
|
16
|
+
this.createMenuItemReduxAction('settings-panel-open', 'Open ' + this.moduleInfo.FriendlyName, this.moduleInfo.Glyph, PopupRedux.PopupShowScreen()),
|
|
17
17
|
];
|
|
18
18
|
}
|
|
19
19
|
addContextMenuItems(menuContext) {
|
|
20
20
|
return [
|
|
21
|
-
this.
|
|
21
|
+
this.createMenuItemReduxAction('settings-panel-open', 'Open ' + this.moduleInfo.FriendlyName, this.moduleInfo.Glyph, PopupRedux.PopupShowScreen()),
|
|
22
22
|
];
|
|
23
23
|
}
|
|
24
24
|
addModuleMenuItem(source) {
|
|
25
25
|
if (this.isModuleAvailable()) {
|
|
26
|
-
return this.
|
|
26
|
+
return this.createMenuItemReduxAction('settings-panel-open', 'Open ' + this.moduleInfo.FriendlyName, this.moduleInfo.Glyph, PopupRedux.PopupShowScreen());
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -31,7 +31,7 @@ class SmartEditModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
31
31
|
let popUpParams = {
|
|
32
32
|
source: 'ContextMenu',
|
|
33
33
|
};
|
|
34
|
-
menuItemShowPopup = this.createMainMenuItemShowPopup({
|
|
34
|
+
menuItemShowPopup = this.createMainMenuItemShowPopup({ Name: 'smart-edit-apply',
|
|
35
35
|
Label: 'Apply Smart Edit',
|
|
36
36
|
ComponentName: this.moduleInfo.Popup,
|
|
37
37
|
Icon: this.moduleInfo.Glyph,
|
|
@@ -49,6 +49,9 @@ class StyledColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
49
49
|
styledColumn = Object.assign(Object.assign({}, ObjectFactory_1.default.CreateEmptyStyledColumn()), { ColumnId: column.columnId, SparkLineStyle: {} });
|
|
50
50
|
}
|
|
51
51
|
let label = hasSparklineStyle ? 'Edit ' : 'Create ';
|
|
52
|
+
let name = hasSparklineStyle
|
|
53
|
+
? 'styled-column-sparkline-edit'
|
|
54
|
+
: 'styled-column-sparkline-add';
|
|
52
55
|
let popupParam = {
|
|
53
56
|
action: sparklineColumnExists ? 'Edit' : 'New',
|
|
54
57
|
source: 'ColumnMenu',
|
|
@@ -57,7 +60,7 @@ class StyledColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
57
60
|
defaultCurrentSectionName: 'Settings',
|
|
58
61
|
},
|
|
59
62
|
};
|
|
60
|
-
returnColumnMenuItems.push(this.
|
|
63
|
+
returnColumnMenuItems.push(this.createMenuItemShowPopup(name, label + 'Sparkline Column', this.moduleInfo.Popup, this.getGlyphForStyledColumn(styledColumn), popupParam));
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
// Next do non sparkline
|
|
@@ -82,7 +85,8 @@ class StyledColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
82
85
|
};
|
|
83
86
|
const icon = this.getGlyphForStyledColumn(styledColumn);
|
|
84
87
|
const label = `Edit ${this.getTypeLabel(styledColumn)} Style`;
|
|
85
|
-
|
|
88
|
+
const name = this.getTypeName(styledColumn);
|
|
89
|
+
returnColumnMenuItems.push(this.createMenuItemShowPopup(name, label, this.moduleInfo.Popup, icon, popupParam));
|
|
86
90
|
}
|
|
87
91
|
}
|
|
88
92
|
else {
|
|
@@ -94,7 +98,7 @@ class StyledColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
94
98
|
config: {},
|
|
95
99
|
};
|
|
96
100
|
const badgeLabel = column.dataType === 'Number' ? 'Badge' : 'Create Badge Style';
|
|
97
|
-
const newBadgeButton = this.
|
|
101
|
+
const newBadgeButton = this.createMenuItemShowPopup('styled-column-badge-add', badgeLabel, this.moduleInfo.Popup, 'badge', Object.assign(Object.assign({}, popupParam), { value: Object.assign(Object.assign({}, newStyledColumn), { BadgeStyle: {
|
|
98
102
|
Badges: [ObjectFactory_1.default.CreateDefaultStyledColumnBadge()],
|
|
99
103
|
} }), config: {
|
|
100
104
|
defaultCurrentSectionName: 'Badges',
|
|
@@ -106,17 +110,18 @@ class StyledColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
106
110
|
const emptyRanges = this.api.scopeApi.createCellColorRangesForScope({
|
|
107
111
|
ColumnIds: [column.columnId],
|
|
108
112
|
});
|
|
109
|
-
const newGrandientButton = this.
|
|
113
|
+
const newGrandientButton = this.createMenuItemShowPopup('styled-column-gradient-add', 'Gradient', this.moduleInfo.Popup, 'gradient', Object.assign(Object.assign({}, popupParam), { value: Object.assign(Object.assign({}, newStyledColumn), { GradientStyle: {
|
|
110
114
|
CellRanges: emptyRanges,
|
|
111
115
|
} }), config: {
|
|
112
116
|
defaultCurrentSectionName: 'Style',
|
|
113
117
|
} }));
|
|
114
|
-
const newPrecentBarButton = this.
|
|
118
|
+
const newPrecentBarButton = this.createMenuItemShowPopup('styled-column-percent-bar-add', 'Percent Bar', this.moduleInfo.Popup, 'percent', Object.assign(Object.assign({}, popupParam), { value: Object.assign(Object.assign({}, newStyledColumn), { PercentBarStyle: {
|
|
115
119
|
CellRanges: emptyRanges,
|
|
116
120
|
} }), config: {
|
|
117
121
|
defaultCurrentSectionName: 'Style',
|
|
118
122
|
} }));
|
|
119
123
|
returnColumnMenuItems.push({
|
|
124
|
+
name: 'parent',
|
|
120
125
|
label: 'Create Styled Column',
|
|
121
126
|
module: this.moduleInfo.ModuleName,
|
|
122
127
|
isVisible: true,
|
|
@@ -234,5 +239,21 @@ class StyledColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
234
239
|
}
|
|
235
240
|
return type;
|
|
236
241
|
}
|
|
242
|
+
getTypeName(styledColumn) {
|
|
243
|
+
let type = null;
|
|
244
|
+
if (styledColumn.GradientStyle) {
|
|
245
|
+
type = 'styled-column-gradient-edit';
|
|
246
|
+
}
|
|
247
|
+
else if (styledColumn.PercentBarStyle) {
|
|
248
|
+
type = 'styled-column-percent-bar-edit';
|
|
249
|
+
}
|
|
250
|
+
else if (styledColumn.SparkLineStyle) {
|
|
251
|
+
type = 'styled-column-sparkline-edit';
|
|
252
|
+
}
|
|
253
|
+
else if (styledColumn.BadgeStyle) {
|
|
254
|
+
type = 'styled-column-badge-edit';
|
|
255
|
+
}
|
|
256
|
+
return type;
|
|
257
|
+
}
|
|
237
258
|
}
|
|
238
259
|
exports.StyledColumnModule = StyledColumnModule;
|
|
@@ -12,7 +12,7 @@ class SystemStatusModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
12
12
|
addColumnMenuItems(column) {
|
|
13
13
|
if (this.isModuleAvailable()) {
|
|
14
14
|
return [
|
|
15
|
-
this.
|
|
15
|
+
this.createMenuItemShowPopup('system-status-show', 'Show System Status', this.moduleInfo.Popup, this.moduleInfo.Glyph),
|
|
16
16
|
];
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -22,7 +22,7 @@ class SystemStatusModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
22
22
|
source: 'ContextMenu',
|
|
23
23
|
};
|
|
24
24
|
return [
|
|
25
|
-
this.createMainMenuItemShowPopup({
|
|
25
|
+
this.createMainMenuItemShowPopup({ Name: 'system-status-show',
|
|
26
26
|
Label: 'Show System Status',
|
|
27
27
|
ComponentName: this.moduleInfo.Popup,
|
|
28
28
|
Icon: this.moduleInfo.Glyph,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { IRowNode } from '@ag-grid-community/core';
|
|
1
2
|
import { ExpressionFunction } from '../../parser/src/types';
|
|
2
3
|
import { BaseParameter } from './expressionFunctionUtils';
|
|
3
|
-
import { IRowNode } from '@ag-grid-community/core';
|
|
4
4
|
import { AggregateParams } from './scalarAggregationHelper';
|
|
5
5
|
/**
|
|
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';
|
|
9
|
+
export type ScalarAggregationFunction = 'SUM' | 'PERCENTAGE' | 'QUANT' | 'QUARTILE' | 'PERCENTILE' | 'AVG' | 'MIN' | 'MAX' | 'COUNT' | 'CUMUL' | 'MEDIAN' | 'MODE' | 'DISTINCT' | 'ONLY' | 'STD_DEVIATION' | 'OLDEST' | 'YOUNGEST';
|
|
10
10
|
type OperandFunction = 'COL' | 'OVER' | 'GROUP_BY' | 'WEIGHT';
|
|
11
11
|
export interface ScalarAggregationParameter extends BaseParameter<'aggregationScalar', ScalarAggregationFunction> {
|
|
12
12
|
value: AggregatedScalarExpressionEvaluation;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.aggregatedScalarExpressionFunctionNames = exports.aggregatedScalarExpressionFunctions = exports.quantileAggregatedExpressionFunctions = exports.cumulativeAggregatedExpressionFunctions = exports.aggregatedExpressionFunctions = void 0;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
5
|
const ExpressionEvaluationError_1 = require("../../parser/src/ExpressionEvaluationError");
|
|
6
|
-
const TypeExtensions_1 = require("../Extensions/TypeExtensions");
|
|
7
6
|
const ArrayExtensions_1 = require("../Extensions/ArrayExtensions");
|
|
7
|
+
const TypeExtensions_1 = require("../Extensions/TypeExtensions");
|
|
8
|
+
const expressionFunctionUtils_1 = require("./expressionFunctionUtils");
|
|
9
|
+
const isAfter_1 = tslib_1.__importDefault(require("date-fns/isAfter"));
|
|
10
|
+
const DateHelper_1 = require("../Helpers/DateHelper");
|
|
8
11
|
exports.aggregatedExpressionFunctions = [
|
|
9
12
|
'SUM',
|
|
10
13
|
'PERCENTAGE',
|
|
@@ -354,6 +357,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
354
357
|
return aggregatedValue;
|
|
355
358
|
},
|
|
356
359
|
done: (aggregatedValue) => {
|
|
360
|
+
var _a;
|
|
357
361
|
const sorted = [...aggregatedValue.entries()].sort(([aVal, aFreq], [bVal, bFreq]) => {
|
|
358
362
|
if (aFreq < bFreq) {
|
|
359
363
|
return 1;
|
|
@@ -365,7 +369,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
365
369
|
return aVal === bVal ? 0 : 1;
|
|
366
370
|
}
|
|
367
371
|
});
|
|
368
|
-
return sorted[0][0];
|
|
372
|
+
return (_a = sorted === null || sorted === void 0 ? void 0 : sorted[0]) === null || _a === void 0 ? void 0 : _a[0];
|
|
369
373
|
},
|
|
370
374
|
},
|
|
371
375
|
},
|
|
@@ -911,6 +915,124 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
911
915
|
examples: ['[col1]', 'COL("col1")'],
|
|
912
916
|
category: 'special',
|
|
913
917
|
},
|
|
918
|
+
OLDEST: {
|
|
919
|
+
handler(args, context) {
|
|
920
|
+
const minColumnParameter = (0, expressionFunctionUtils_1.extractColumnParameter)('OLDEST', args);
|
|
921
|
+
const minColumnName = minColumnParameter.value;
|
|
922
|
+
(0, expressionFunctionUtils_1.validateColumnType)(minColumnName, ['Date'], 'OLDEST', context.adaptableApi);
|
|
923
|
+
const groupByParameter = (0, expressionFunctionUtils_1.extractParameter)('OLDEST', 'operand', ['GROUP_BY'], args, {
|
|
924
|
+
isOptional: true,
|
|
925
|
+
});
|
|
926
|
+
const aggregationExpressionEvaluation = {
|
|
927
|
+
aggregationParams: {
|
|
928
|
+
reducers: {
|
|
929
|
+
OLDEST: {
|
|
930
|
+
name: 'OLDEST',
|
|
931
|
+
field: minColumnName,
|
|
932
|
+
initialValue: null,
|
|
933
|
+
reducer: (minValue, rowValue) => {
|
|
934
|
+
if (!minValue) {
|
|
935
|
+
return rowValue;
|
|
936
|
+
}
|
|
937
|
+
if (!rowValue) {
|
|
938
|
+
return minValue;
|
|
939
|
+
}
|
|
940
|
+
if ((0, isAfter_1.default)((0, DateHelper_1.parseDateValue)(minValue), (0, DateHelper_1.parseDateValue)(rowValue))) {
|
|
941
|
+
return rowValue;
|
|
942
|
+
}
|
|
943
|
+
else {
|
|
944
|
+
return minValue;
|
|
945
|
+
}
|
|
946
|
+
},
|
|
947
|
+
done: (minValue, arr) => {
|
|
948
|
+
if (minValue !== null) {
|
|
949
|
+
return minValue;
|
|
950
|
+
}
|
|
951
|
+
},
|
|
952
|
+
},
|
|
953
|
+
},
|
|
954
|
+
},
|
|
955
|
+
rowFilterFn: context.filterFn,
|
|
956
|
+
getRowNodes: context.getRowNodes,
|
|
957
|
+
};
|
|
958
|
+
addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
|
|
959
|
+
const result = {
|
|
960
|
+
name: 'OLDEST',
|
|
961
|
+
type: 'aggregationScalar',
|
|
962
|
+
value: aggregationExpressionEvaluation,
|
|
963
|
+
};
|
|
964
|
+
return result;
|
|
965
|
+
},
|
|
966
|
+
description: 'Aggregates a column over multiple rows by computing the minimum of the column values\nOptionally the aggregation may be computed within provided individual groups',
|
|
967
|
+
signatures: [
|
|
968
|
+
'OLDEST( [colName] )',
|
|
969
|
+
'OLDEST( COL(name: string))',
|
|
970
|
+
'OLDEST( [colNameA], GROUP_BY( [colNameB] ))',
|
|
971
|
+
'OLDEST( COL(nameA: string), GROUP_BY( COL(nameB: string)))',
|
|
972
|
+
],
|
|
973
|
+
examples: ['OLDEST([colA])', 'OLDEST([colA], GROUP_BY([colB]))'],
|
|
974
|
+
category: 'aggregation',
|
|
975
|
+
inputs: ['date'],
|
|
976
|
+
},
|
|
977
|
+
YOUNGEST: {
|
|
978
|
+
handler(args, context) {
|
|
979
|
+
const minColumnParameter = (0, expressionFunctionUtils_1.extractColumnParameter)('YOUNGEST', args);
|
|
980
|
+
const minColumnName = minColumnParameter.value;
|
|
981
|
+
(0, expressionFunctionUtils_1.validateColumnType)(minColumnName, ['Date'], 'YOUNGEST', context.adaptableApi);
|
|
982
|
+
const groupByParameter = (0, expressionFunctionUtils_1.extractParameter)('YOUNGEST', 'operand', ['GROUP_BY'], args, {
|
|
983
|
+
isOptional: true,
|
|
984
|
+
});
|
|
985
|
+
const aggregationExpressionEvaluation = {
|
|
986
|
+
aggregationParams: {
|
|
987
|
+
reducers: {
|
|
988
|
+
YOUNGEST: {
|
|
989
|
+
name: 'YOUNGEST',
|
|
990
|
+
field: minColumnName,
|
|
991
|
+
initialValue: null,
|
|
992
|
+
reducer: (minValue, rowValue) => {
|
|
993
|
+
if (!minValue) {
|
|
994
|
+
return rowValue;
|
|
995
|
+
}
|
|
996
|
+
if (!rowValue) {
|
|
997
|
+
return minValue;
|
|
998
|
+
}
|
|
999
|
+
if ((0, isAfter_1.default)((0, DateHelper_1.parseDateValue)(minValue), (0, DateHelper_1.parseDateValue)(rowValue))) {
|
|
1000
|
+
return minValue;
|
|
1001
|
+
}
|
|
1002
|
+
else {
|
|
1003
|
+
return rowValue;
|
|
1004
|
+
}
|
|
1005
|
+
},
|
|
1006
|
+
done: (minValue, arr) => {
|
|
1007
|
+
if (minValue !== null) {
|
|
1008
|
+
return minValue;
|
|
1009
|
+
}
|
|
1010
|
+
},
|
|
1011
|
+
},
|
|
1012
|
+
},
|
|
1013
|
+
},
|
|
1014
|
+
rowFilterFn: context.filterFn,
|
|
1015
|
+
getRowNodes: context.getRowNodes,
|
|
1016
|
+
};
|
|
1017
|
+
addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
|
|
1018
|
+
const result = {
|
|
1019
|
+
name: 'YOUNGEST',
|
|
1020
|
+
type: 'aggregationScalar',
|
|
1021
|
+
value: aggregationExpressionEvaluation,
|
|
1022
|
+
};
|
|
1023
|
+
return result;
|
|
1024
|
+
},
|
|
1025
|
+
description: 'Aggregates a column over multiple rows by computing the minimum of the column values\nOptionally the aggregation may be computed within provided individual groups',
|
|
1026
|
+
signatures: [
|
|
1027
|
+
'YOUNGEST( [colName] )',
|
|
1028
|
+
'YOUNGEST( COL(name: string))',
|
|
1029
|
+
'YOUNGEST( [colNameA], GROUP_BY( [colNameB] ))',
|
|
1030
|
+
'YOUNGEST( COL(nameA: string), GROUP_BY( COL(nameB: string)))',
|
|
1031
|
+
],
|
|
1032
|
+
examples: ['YOUNGEST([colA])', 'YOUNGEST([colA], GROUP_BY([colB]))'],
|
|
1033
|
+
category: 'aggregation',
|
|
1034
|
+
inputs: ['date'],
|
|
1035
|
+
},
|
|
914
1036
|
};
|
|
915
1037
|
const mapAggregationToCumulation = (aggregationParameter, overColumnParameter, context) => {
|
|
916
1038
|
const aggregationEvaluation = aggregationParameter.value;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as Redux from 'redux';
|
|
2
2
|
import { ModuleParams } from '../View/Components/SharedProps/ModuleViewPopupProps';
|
|
3
|
-
import { AdaptableMenuItem } from '../PredefinedConfig/Common/Menu';
|
|
3
|
+
import { AdaptableMenuItem, AdaptableContextMenuItemName, AdaptableColumnMenuItemName } from '../PredefinedConfig/Common/Menu';
|
|
4
4
|
import { AdaptableModule } from '../PredefinedConfig/Common/Types';
|
|
5
5
|
import { AdaptableIcon, AdaptableSystemIconName } from '../PredefinedConfig/Common/AdaptableIcon';
|
|
6
6
|
export declare class MenuItemDoReduxAction implements AdaptableMenuItem {
|
|
7
|
-
constructor(label: string, module: AdaptableModule, reduxAction: Redux.Action, icon: AdaptableSystemIconName, isVisible: boolean);
|
|
7
|
+
constructor(name: AdaptableColumnMenuItemName | AdaptableContextMenuItemName, label: string, module: AdaptableModule, reduxAction: Redux.Action, icon: AdaptableSystemIconName, isVisible: boolean);
|
|
8
|
+
name: AdaptableColumnMenuItemName | AdaptableContextMenuItemName;
|
|
8
9
|
reduxAction: Redux.Action;
|
|
9
10
|
label: string;
|
|
10
11
|
module: AdaptableModule;
|
|
@@ -12,7 +13,8 @@ export declare class MenuItemDoReduxAction implements AdaptableMenuItem {
|
|
|
12
13
|
icon: AdaptableIcon;
|
|
13
14
|
}
|
|
14
15
|
export declare class MenuItemDoClickFunction implements AdaptableMenuItem {
|
|
15
|
-
constructor(label: string, module: AdaptableModule, clickFunction: () => void, icon: AdaptableSystemIconName, isVisible: boolean);
|
|
16
|
+
constructor(name: AdaptableColumnMenuItemName | AdaptableContextMenuItemName, label: string, module: AdaptableModule, clickFunction: () => void, icon: AdaptableSystemIconName, isVisible: boolean);
|
|
17
|
+
name: AdaptableColumnMenuItemName | AdaptableContextMenuItemName;
|
|
16
18
|
onClick: () => void;
|
|
17
19
|
label: string;
|
|
18
20
|
module: AdaptableModule;
|
|
@@ -20,7 +22,8 @@ export declare class MenuItemDoClickFunction implements AdaptableMenuItem {
|
|
|
20
22
|
icon: AdaptableIcon;
|
|
21
23
|
}
|
|
22
24
|
export declare class MenuItemShowPopup implements AdaptableMenuItem {
|
|
23
|
-
constructor(label: string, module: AdaptableModule, componentName: string, icon: AdaptableSystemIconName, isVisible: boolean, popupParams?: ModuleParams);
|
|
25
|
+
constructor(name: AdaptableColumnMenuItemName | AdaptableContextMenuItemName, label: string, module: AdaptableModule, componentName: string, icon: AdaptableSystemIconName, isVisible: boolean, popupParams?: ModuleParams);
|
|
26
|
+
name: AdaptableColumnMenuItemName | AdaptableContextMenuItemName;
|
|
24
27
|
reduxAction: Redux.Action;
|
|
25
28
|
label: string;
|
|
26
29
|
module: AdaptableModule;
|
|
@@ -5,7 +5,8 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const PopupRedux = tslib_1.__importStar(require("../Redux/ActionsReducers/PopupRedux"));
|
|
6
6
|
// A menu item which performs a Redux Action when it is clicke
|
|
7
7
|
class MenuItemDoReduxAction {
|
|
8
|
-
constructor(label, module, reduxAction, icon, isVisible) {
|
|
8
|
+
constructor(name, label, module, reduxAction, icon, isVisible) {
|
|
9
|
+
this.name = name;
|
|
9
10
|
this.label = label;
|
|
10
11
|
this.module = module;
|
|
11
12
|
this.isVisible = isVisible;
|
|
@@ -17,7 +18,8 @@ class MenuItemDoReduxAction {
|
|
|
17
18
|
}
|
|
18
19
|
exports.MenuItemDoReduxAction = MenuItemDoReduxAction;
|
|
19
20
|
class MenuItemDoClickFunction {
|
|
20
|
-
constructor(label, module, clickFunction, icon, isVisible) {
|
|
21
|
+
constructor(name, label, module, clickFunction, icon, isVisible) {
|
|
22
|
+
this.name = name;
|
|
21
23
|
this.label = label;
|
|
22
24
|
this.module = module;
|
|
23
25
|
this.isVisible = isVisible;
|
|
@@ -30,7 +32,8 @@ class MenuItemDoClickFunction {
|
|
|
30
32
|
exports.MenuItemDoClickFunction = MenuItemDoClickFunction;
|
|
31
33
|
// A menu item which shows a popup screen when it is clieked
|
|
32
34
|
class MenuItemShowPopup {
|
|
33
|
-
constructor(label, module, componentName, icon, isVisible, popupParams) {
|
|
35
|
+
constructor(name, label, module, componentName, icon, isVisible, popupParams) {
|
|
36
|
+
this.name = name;
|
|
34
37
|
this.label = label;
|
|
35
38
|
this.module = module;
|
|
36
39
|
this.isVisible = isVisible;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LicenseService=exports.LicenseValidityType=void 0;const e=require("tslib"),a=require("../../../Redux/ActionsReducers/SystemRedux"),t=require("../../../Redux/ActionsReducers/PopupRedux"),s=e.__importDefault(require("../../ObjectFactory")),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LicenseService=exports.LicenseValidityType=void 0;const e=require("tslib"),a=require("../../../Redux/ActionsReducers/SystemRedux"),t=require("../../../Redux/ActionsReducers/PopupRedux"),s=e.__importDefault(require("../../ObjectFactory")),i=e.__importDefault(require("lodash/clamp")),o=require("../../Constants/DocumentationLinkConstants"),n=require("../../license/decode"),r=require("./shouldLogThankYouMessage"),l="sales@adaptabletools.com",c=10,d=864e5;var p;!function(e){e.INVALID_LICENSE="INVALID_LICENSE",e.NO_LICENSE="NO_LICENSE",e.NON_PRODUCTION_VALID="NON_PRODUCTION_VALID",e.NON_PRODUCTION_EXPIRED_IN_SCOPE="NON_PRODUCTION_EXPIRED_IN_SCOPE",e.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE="NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE",e.COMMERCIAL_VALID="COMMERCIAL_VALID",e.COMMERCIAL_EXPIRED_IN_SCOPE="COMMERCIAL_EXPIRED_IN_SCOPE",e.COMMERCIAL_EXPIRED_OUT_OF_SCOPE="COMMERCIAL_EXPIRED_OUT_OF_SCOPE"}(p=exports.LicenseValidityType||(exports.LicenseValidityType={}));const h=()=>"undefined"!=typeof window?window.location.origin:"",E=()=>{const e=h(),[a,t,s]=Array.from(/(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g.exec(e)||[]);return"https"===t&&"sandpack.codesandbox.io"===s},_=()=>{const e=h(),[a,t,s]=Array.from(/(https):\/\/\S+(\.csb\.app)/g.exec(e)||[]);return"https"===t&&".csb.app"===s},I=()=>{const e=h(),[a,t,s]=Array.from(/(https):\/\/\S+(\.adaptabletools\.com)/g.exec(e)||[]);return"https"===t&&".adaptabletools.com"===s};class O{constructor(e,a,t){this.adaptable=e,this.licenseKey=a,this.packageDetails=t,this.adaptable=e,this.adaptable.api.eventApi.on("AdaptableReady",(()=>{requestAnimationFrame((()=>{this.init()}))}))}init(){let e=null;if(this.licenseKey)try{e=(0,n.decode)(this.licenseKey)}catch(a){e=a}E()||_()||I()||this.handleLicenseValidation(e,this.getValidityType(e,this.packageDetails))}getValidityType(e,a){if(!e)return p.NO_LICENSE;if(e instanceof Error)return p.INVALID_LICENSE;const t=new Date(a.publishedAt),s=new Date(e.end),i=s<new Date,o=e.trial;let n=null;return n=i?s>t?o?p.NON_PRODUCTION_EXPIRED_IN_SCOPE:p.COMMERCIAL_EXPIRED_IN_SCOPE:o?p.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE:p.COMMERCIAL_EXPIRED_OUT_OF_SCOPE:o?p.NON_PRODUCTION_VALID:p.COMMERCIAL_VALID,n}handleLicenseValidation(e,a){var t;const s=new Date;s.setHours(0,0,0,0);let p=0;e instanceof Error||!(null==e?void 0:e.end)||(p=Math.floor(((null===(t=null==e?void 0:e.end)||void 0===t?void 0:t.getTime())-s.getTime())/d),p=(0,i.default)(p,0,1/0));let h="",E="";!e||e instanceof Error||!e.appName||e.appName==n.GENERIC_APP_NAME||(h=e.appName,E=" for application [APP_NAME]");const _=(e,a=o.LicenseDocsLink,t=l,s=p,i=h)=>e.replace("[LINK]",a).replace("[EMAIL]",t).replace("[APP_NAME]",i).replace("[DAYS]",`${s}`);switch(a){case"NO_LICENSE":case"NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE":this.adaptable.logger.consoleLogByMessageType(_("This instance of AdapTable does not have a license, and some functionality has therefore been removed. In order to use a fully-featured version of AdapTable, please contact [EMAIL]. You can learn more about the different AdapTable license options at [LINK]."),"Error"),this.showNotification("No AdapTable License found."),this.showWatermark("This instance of AdapTable does not have a license, and some functionality has therefore been removed."),this.disableStatePersistence();break;case"INVALID_LICENSE":this.adaptable.logger.consoleLogByMessageType(_("This instance of AdapTable seems to use a corrupted License, and some functionality has therefore been removed. In order to use a fully-featured version of AdapTable, please contact [EMAIL]. You can learn more about the different AdapTable license options at [LINK]."),"Error"),this.showNotification("Corrupted AdapTable License found."),this.showWatermark("This instance of AdapTable has a corrupted License, and some functionality has therefore been removed."),this.disableStatePersistence();break;case"NON_PRODUCTION_VALID":this.adaptable.logger.consoleLogByMessageType(_("This AdapTable trial license expires in [DAYS] days. Please contact [EMAIL] to upgrade to a commercial version of AdapTable. You can learn more about the different AdapTable license options at [LINK]."),"Info");break;case"NON_PRODUCTION_EXPIRED_IN_SCOPE":this.adaptable.logger.consoleLogByMessageType(_("This AdapTable trial license has now expired. Please contact [EMAIL] to upgrade to a commercial version of AdapTable. You can learn more about the different AdapTable license options at [LINK]."),"Warning"),this.showWatermark("AdapTable License has expired");break;case"COMMERCIAL_VALID":if(p<=c)this.adaptable.logger.consoleLogByMessageType(_(`This AdapTable license${E} expires in [DAYS] days. Please contact [EMAIL] to renew (giving you access to Support and Updates)`),"Info");else try{(0,r.shouldLogThankYouMessage)()&&this.adaptable.logger.consoleLogByMessageType(_(`Thank you for using a valid AdapTable license${E}. Your license will expire in [DAYS] days.`),"Info")}catch(e){}break;case"COMMERCIAL_EXPIRED_IN_SCOPE":this.adaptable.logger.consoleLogByMessageType(_(`This AdapTable license${E} has expired. Please contact [EMAIL] if you wish to renew (giving you access to Support and Updates)`),"Warning");break;case"COMMERCIAL_EXPIRED_OUT_OF_SCOPE":this.adaptable.logger.consoleLogByMessageType(_(`This AdapTable license${E} has expired. Adaptable version was published after the license expired. Please contact [EMAIL] if you wish to renew your license.`),"Error"),this.showNotification("Adaptable License has expired"),this.showWatermark("Adaptable License has expired")}}showNotification(e){this.adaptable.api.internalApi.dispatchReduxAction((0,t.PopupShowAlert)({alertType:"generic",header:"License Error",message:e,alertDefinition:s.default.CreateInternalAlertDefinitionForMessages("Error")}))}showWatermark(e){this.adaptable.api.internalApi.dispatchReduxAction((0,a.SystemLicenseShowWatermark)(e))}disableStatePersistence(){this.adaptable.api.internalApi.dispatchReduxAction((0,a.SystemLicenseDisablePersistence)())}destroy(){}}exports.LicenseService=O;
|
|
@@ -43,7 +43,7 @@ const AdaptableObjectListItemView = (props) => {
|
|
|
43
43
|
var _a;
|
|
44
44
|
let labelEl = tag.label;
|
|
45
45
|
if (typeof tag.label === 'function') {
|
|
46
|
-
labelEl = React.createElement(tag.label, { data: props.abObject });
|
|
46
|
+
labelEl = React.createElement(tag.label, { key: index, data: props.abObject });
|
|
47
47
|
}
|
|
48
48
|
labelEl = labelEl !== null && labelEl !== void 0 ? labelEl : tag.name;
|
|
49
49
|
return (React.createElement(rebass_1.Flex, { "data-name": tag.name, key: `${index}-${tag.name}`, mb: 2, className: `${baseClassName}__row` },
|
|
@@ -135,6 +135,9 @@ const AdaptableObjectListItem = (props) => {
|
|
|
135
135
|
exports.AdaptableObjectListItem = AdaptableObjectListItem;
|
|
136
136
|
const AdaptableObjectList = (props) => {
|
|
137
137
|
var _a;
|
|
138
|
-
return (React.createElement("ul", { className: LIST_BASE_CLASS_NAME }, (_a = props === null || props === void 0 ? void 0 : props.items) === null || _a === void 0 ? void 0 : _a.map((item) =>
|
|
138
|
+
return (React.createElement("ul", { className: LIST_BASE_CLASS_NAME }, (_a = props === null || props === void 0 ? void 0 : props.items) === null || _a === void 0 ? void 0 : _a.map((item, index) => {
|
|
139
|
+
var _a;
|
|
140
|
+
return (React.createElement(exports.AdaptableObjectListItem, Object.assign({ key: (_a = item.abObject.Uuid) !== null && _a !== void 0 ? _a : index, data: item, module: props.module }, props.itemProps)));
|
|
141
|
+
})));
|
|
139
142
|
};
|
|
140
143
|
exports.AdaptableObjectList = AdaptableObjectList;
|
|
@@ -152,7 +152,7 @@ class QuickFilterFormComponent extends React.Component {
|
|
|
152
152
|
}
|
|
153
153
|
};
|
|
154
154
|
if (predicateInput.type === 'date' && !showDatePicker) {
|
|
155
|
-
return (React.createElement(AdaptableDateInlineInput_1.AdaptableDateInlineInput, { value: value, onKeyDownCapture: onKeyDownCapture, onChange: (value) => this.changeColumnPredicateInput(value, index) }));
|
|
155
|
+
return (React.createElement(AdaptableDateInlineInput_1.AdaptableDateInlineInput, { value: value, key: index, onKeyDownCapture: onKeyDownCapture, onChange: (value) => this.changeColumnPredicateInput(value, index) }));
|
|
156
156
|
}
|
|
157
157
|
return (React.createElement(AdaptableInput_1.default, { disabled: this.isFilterDisabled(), key: index, type: predicateInput.type === 'number' ? 'text' : predicateInput.type,
|
|
158
158
|
// autoFocus has to be FALSE because if the input receives focus in the init phase,
|
|
@@ -66,7 +66,7 @@ function ValueSelector(props) {
|
|
|
66
66
|
const label = !allowReorder ? preparedToLabel(option) : null;
|
|
67
67
|
const reorderable = typeof allowReorder === 'function' ? allowReorder(option) : allowReorder;
|
|
68
68
|
const renderNode = (props, dragHandleProps) => {
|
|
69
|
-
return (React.createElement(rebass_1.Flex, Object.assign({ className: `${baseClassName}__option`, alignItems: "center", mt: index ? 1 : 0, key: identifier, backgroundColor: 'primary', padding: 2, "data-index": index, "data-id": identifier, "data-name": "option" }, props),
|
|
69
|
+
return (React.createElement(rebass_1.Flex, Object.assign({ className: `${baseClassName}__option`, alignItems: "center", mt: index ? 1 : 0, key: identifier !== null && identifier !== void 0 ? identifier : index, backgroundColor: 'primary', padding: 2, "data-index": index, "data-id": identifier, "data-name": "option" }, props),
|
|
70
70
|
React.createElement(rebass_1.Flex, { flex: 1, flexDirection: "row", alignItems: "center" },
|
|
71
71
|
reorderable ? (React.createElement(rebass_1.Box, Object.assign({ mr: 3 }, dragHandleProps),
|
|
72
72
|
React.createElement(icons_1.Icon, { name: "drag", style: { cursor: 'grab' } }))) : null,
|
|
@@ -19,6 +19,7 @@ const SortSection_1 = require("./sections/SortSection");
|
|
|
19
19
|
const FilterSection_1 = require("./sections/FilterSection");
|
|
20
20
|
const GridFilterSection_1 = require("./sections/GridFilterSection");
|
|
21
21
|
const RowSummarySection_1 = require("./sections/RowSummarySection");
|
|
22
|
+
const RowSummary_1 = require("../../../PredefinedConfig/Common/RowSummary");
|
|
22
23
|
const LayoutWizard = (props) => {
|
|
23
24
|
var _a, _b;
|
|
24
25
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
@@ -107,6 +108,7 @@ const LayoutWizard = (props) => {
|
|
|
107
108
|
{
|
|
108
109
|
title: 'Row Groups',
|
|
109
110
|
isVisible: () => layoutSupportedFeatures.RowGroupedColumns,
|
|
111
|
+
isValid: RowSummarySection_1.areSummaryRowsValid,
|
|
110
112
|
details: 'Configure Row Grouping',
|
|
111
113
|
renderSummary: () => React.createElement(RowGroupingSection_1.RowGroupingSectionSummary, null),
|
|
112
114
|
render: () => (React.createElement(rebass_1.Box, { p: 2, style: { height: '100%' } },
|
|
@@ -119,7 +121,29 @@ const LayoutWizard = (props) => {
|
|
|
119
121
|
renderSummary: () => React.createElement(AggregationsSection_1.AggregationsSectionSummary, null),
|
|
120
122
|
isValid: (data) => (0, AggregationsSection_1.isAggregationsSectionValid)(data),
|
|
121
123
|
render: () => (React.createElement(rebass_1.Box, { p: 2, style: { height: '100%' } },
|
|
122
|
-
React.createElement(AggregationsSection_1.AggregationsSection, { onChange:
|
|
124
|
+
React.createElement(AggregationsSection_1.AggregationsSection, { onChange: (layout) => {
|
|
125
|
+
let newLayout = (0, Helper_1.cloneObject)(layout);
|
|
126
|
+
// if we do not have an weighted avg col, we need to clear the row summary if one exists
|
|
127
|
+
if (newLayout.RowSummaries) {
|
|
128
|
+
newLayout.RowSummaries = newLayout.RowSummaries.map((rowSummary) => {
|
|
129
|
+
return Object.assign(Object.assign({}, rowSummary), { ColumnsMap: Object.entries(rowSummary.ColumnsMap).reduce((acc, [columnId, aggFunc]) => {
|
|
130
|
+
if (
|
|
131
|
+
// see if it is weighted avg
|
|
132
|
+
aggFunc === RowSummary_1.WEIGHTED_AVERAGE_AGGREATED_FUNCTION &&
|
|
133
|
+
// see if we have a weight in the agg columns
|
|
134
|
+
newLayout.AggregationColumns[columnId] &&
|
|
135
|
+
(typeof newLayout.AggregationColumns[columnId] !== 'object' ||
|
|
136
|
+
newLayout.AggregationColumns[columnId].weightColumnId)) {
|
|
137
|
+
// need to remove the row summary
|
|
138
|
+
return acc;
|
|
139
|
+
}
|
|
140
|
+
acc[columnId] = aggFunc;
|
|
141
|
+
return acc;
|
|
142
|
+
}, {}) });
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
setLayout(newLayout);
|
|
146
|
+
} }))),
|
|
123
147
|
},
|
|
124
148
|
{
|
|
125
149
|
title: 'Row Summaries',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Layout } from '../../../../../types';
|
|
3
|
+
export declare const areSummaryRowsValid: (layout: Layout) => true | string;
|
|
3
4
|
export declare const RowGroupingSectionSummary: React.FunctionComponent;
|
|
4
5
|
interface RowSummarySectionProps {
|
|
5
6
|
onChange: (data: Layout) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RowSummarySection = exports.RowGroupingSectionSummary = void 0;
|
|
3
|
+
exports.RowSummarySection = exports.RowGroupingSectionSummary = exports.areSummaryRowsValid = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const rebass_1 = require("rebass");
|
|
@@ -10,21 +10,38 @@ const Select_1 = require("../../../../components/Select");
|
|
|
10
10
|
const SimpleButton_1 = tslib_1.__importDefault(require("../../../../components/SimpleButton"));
|
|
11
11
|
const Tabs_1 = require("../../../../components/Tabs");
|
|
12
12
|
const Tag_1 = require("../../../../components/Tag");
|
|
13
|
+
const RowSummary_1 = require("../../../../PredefinedConfig/Common/RowSummary");
|
|
13
14
|
const adaptableQlUtils_1 = require("../../../../Utilities/adaptableQlUtils");
|
|
14
15
|
const ModuleConstants_1 = require("../../../../Utilities/Constants/ModuleConstants");
|
|
15
|
-
const ISummaryService_1 = require("../../../../Utilities/Services/Interface/ISummaryService");
|
|
16
16
|
const sortWithOrder_1 = require("../../../../Utilities/sortWithOrder");
|
|
17
17
|
const AdaptableContext_1 = require("../../../AdaptableContext");
|
|
18
18
|
const ValueSelector_1 = require("../../../Components/ValueSelector");
|
|
19
19
|
const OnePageAdaptableWizard_1 = require("../../../Wizard/OnePageAdaptableWizard");
|
|
20
20
|
const Utilities_1 = require("./Utilities");
|
|
21
|
+
const areSummaryRowsValid = (layout) => {
|
|
22
|
+
var _a;
|
|
23
|
+
if (!layout.RowSummaries)
|
|
24
|
+
return true;
|
|
25
|
+
let valid = true;
|
|
26
|
+
(_a = layout.RowSummaries) === null || _a === void 0 ? void 0 : _a.find((rowSummary) => {
|
|
27
|
+
var _a;
|
|
28
|
+
for (const [_, fn] of Object.entries((_a = rowSummary.ColumnsMap) !== null && _a !== void 0 ? _a : {})) {
|
|
29
|
+
if (!fn) {
|
|
30
|
+
valid = 'All row summary columns must have an aggregation function.';
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return valid;
|
|
36
|
+
};
|
|
37
|
+
exports.areSummaryRowsValid = areSummaryRowsValid;
|
|
21
38
|
const getAvailableExpressionsForColumnType = (columnType, availableScalarExpressions) => {
|
|
22
39
|
const inputType = (0, adaptableQlUtils_1.mapColumnDataTypeToExpressionFunctionType)(columnType);
|
|
23
40
|
return Object.entries(availableScalarExpressions !== null && availableScalarExpressions !== void 0 ? availableScalarExpressions : {})
|
|
24
41
|
.map(([expression, expressionDef]) => {
|
|
25
42
|
var _a, _b;
|
|
26
43
|
let firstArg = null;
|
|
27
|
-
if (!
|
|
44
|
+
if (!RowSummary_1.summarySupportedExpressions.includes(expression)) {
|
|
28
45
|
return null;
|
|
29
46
|
}
|
|
30
47
|
if (Array.isArray((_a = expressionDef === null || expressionDef === void 0 ? void 0 : expressionDef.inputs) === null || _a === void 0 ? void 0 : _a[0])) {
|
|
@@ -58,7 +75,7 @@ const RowSummaryEditor = ({ rowSummary, onChange, availableScalarExpressions, on
|
|
|
58
75
|
.getColumns()
|
|
59
76
|
.filter((column) => {
|
|
60
77
|
var _a, _b;
|
|
61
|
-
if (!['Number', 'String'].includes(column.dataType))
|
|
78
|
+
if (!['Number', 'String', 'Date'].includes(column.dataType))
|
|
62
79
|
return false;
|
|
63
80
|
return (_b = (_a = layout.Columns) === null || _a === void 0 ? void 0 : _a.includes) === null || _b === void 0 ? void 0 : _b.call(_a, column.columnId);
|
|
64
81
|
})
|
|
@@ -101,6 +118,14 @@ const RowSummaryEditor = ({ rowSummary, onChange, availableScalarExpressions, on
|
|
|
101
118
|
label: expression,
|
|
102
119
|
value: expression,
|
|
103
120
|
}));
|
|
121
|
+
// check out if this layout has a aggregation with wighted column
|
|
122
|
+
const aggregation = layout.AggregationColumns[column.columnId];
|
|
123
|
+
if (aggregation && typeof aggregation === 'object' && aggregation.weightedColumnId) {
|
|
124
|
+
expressionOptions.push({
|
|
125
|
+
label: 'WEIGHTERD_AVG',
|
|
126
|
+
value: RowSummary_1.WEIGHTED_AVERAGE_AGGREATED_FUNCTION,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
104
129
|
const expression = rowSummary.ColumnsMap[column.columnId];
|
|
105
130
|
return (React.createElement(rebass_1.Flex, null,
|
|
106
131
|
React.createElement(rebass_1.Flex, { mr: 2, alignItems: 'center' }, label),
|
|
@@ -26,7 +26,6 @@ import { RenderReactRootFn } from '../renderReactRoot';
|
|
|
26
26
|
import { AgGridOptionsService } from './AgGridOptionsService';
|
|
27
27
|
import { AgGridColumnAdapter } from './AgGridColumnAdapter';
|
|
28
28
|
import { RowEditService } from '../Utilities/Services/RowEditService';
|
|
29
|
-
import { ISummaryService } from '../Utilities/Services/Interface/ISummaryService';
|
|
30
29
|
export type AdaptableVariant = 'vanilla' | 'react' | 'angular';
|
|
31
30
|
export type AdaptableLifecycleState = 'initial' | 'preprocessOptions' | 'initAdaptableState' | 'setupAgGrid' | 'initAgGrid' | 'available' | 'ready' | 'preDestroyed';
|
|
32
31
|
type RenderAgGridFrameworkComponentResult = false | GridApi;
|
|
@@ -82,7 +81,6 @@ export declare class AdaptableAgGrid implements IAdaptable {
|
|
|
82
81
|
RowEditService: RowEditService;
|
|
83
82
|
Fdc3Service: Fdc3Service;
|
|
84
83
|
CellPopupService: CellPopupService;
|
|
85
|
-
SummaryService: ISummaryService;
|
|
86
84
|
private LicenseService;
|
|
87
85
|
private ChartingService;
|
|
88
86
|
private ThemeService;
|