@adaptabletools/adaptable-cjs 18.0.6 → 18.0.7
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/Api/Implementation/DataImportApiImpl.js +3 -1
- package/src/PredefinedConfig/Common/CellSummary.d.ts +0 -2
- package/src/PredefinedConfig/Common/Enums.d.ts +0 -2
- package/src/PredefinedConfig/Common/Enums.js +0 -2
- package/src/PredefinedConfig/Common/RowSummary.d.ts +1 -1
- package/src/PredefinedConfig/Common/RowSummary.js +0 -2
- package/src/Strategy/CellSummaryModule.js +2 -6
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +3 -1
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +68 -140
- package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.d.ts +1 -1
- package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.js +1 -0
- package/src/Utilities/ObjectFactory.js +0 -2
- package/src/View/CellSummary/CellSummaryDetails.js +2 -1
- package/src/View/DataImport/DataImportPopup.js +4 -2
- package/src/agGrid/ActionColumnRenderer.js +8 -0
- package/src/agGrid/AdaptableAgGrid.js +9 -0
- package/src/agGrid/BadgeRenderer.js +4 -4
- package/src/env.js +2 -2
- package/tsconfig.cjs.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable-cjs",
|
|
3
|
-
"version": "18.0.
|
|
3
|
+
"version": "18.0.7",
|
|
4
4
|
"description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
@@ -8,7 +8,9 @@ class DataImportApiImpl extends ApiBase_1.ApiBase {
|
|
|
8
8
|
super(adaptable);
|
|
9
9
|
this.internalApi = new DataImportInternalApi_1.DataImportInternalApi(adaptable);
|
|
10
10
|
}
|
|
11
|
-
openImportWizard() {
|
|
11
|
+
openImportWizard() {
|
|
12
|
+
this.getSettingsPanelApi().openSettingsPanel('DataImport');
|
|
13
|
+
}
|
|
12
14
|
importData(partialRows) { }
|
|
13
15
|
}
|
|
14
16
|
exports.DataImportApiImpl = DataImportApiImpl;
|
|
@@ -76,8 +76,6 @@ 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";
|
|
81
79
|
SummaryOperation["Std_Deviation"] = "Std Deviation";
|
|
82
80
|
SummaryOperation["Only"] = "Only";
|
|
83
81
|
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 ["MIN", "MAX", "SUM", "AVG", "COUNT", "MEDIAN", "MODE", "DISTINCT", "ONLY", "
|
|
3
|
+
export declare const summarySupportedExpressions: readonly ["MIN", "MAX", "SUM", "AVG", "COUNT", "MEDIAN", "MODE", "DISTINCT", "ONLY", "STD_DEVIATION", "WEIGHTED_AVERAGE"];
|
|
4
4
|
export type SummarySupportedExpression = (typeof summarySupportedExpressions)[number];
|
|
5
5
|
/**
|
|
6
6
|
* Position of Row Summary - 'Top' or 'Bottom'
|
|
@@ -78,10 +78,8 @@ class CellSummaryModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
78
78
|
const modeValue = isNumericColumn ? handleExpression('MODE') : null;
|
|
79
79
|
const medianValue = isNumericColumn ? handleExpression('MEDIAN') : null;
|
|
80
80
|
const distinctValue = handleExpression('DISTINCT');
|
|
81
|
-
const maxValue = isNumericColumn ? handleExpression('MAX') : null;
|
|
82
|
-
const minValue = isNumericColumn ? handleExpression('MIN') : null;
|
|
83
|
-
const oldestValue = isDateColumn ? handleExpression('OLDEST') : null;
|
|
84
|
-
const newestValue = isDateColumn ? handleExpression('NEWEST') : null;
|
|
81
|
+
const maxValue = isNumericColumn || isDateColumn ? handleExpression('MAX') : null;
|
|
82
|
+
const minValue = isNumericColumn || isDateColumn ? handleExpression('MIN') : null;
|
|
85
83
|
const stdDeviation = isNumericColumn
|
|
86
84
|
? Helper_1.Helper.roundNumberTo4dp(handleExpression('STD_DEVIATION'))
|
|
87
85
|
: null;
|
|
@@ -94,8 +92,6 @@ class CellSummaryModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
94
92
|
Max: maxValue,
|
|
95
93
|
Min: minValue,
|
|
96
94
|
Count: selectedCellInfo.gridCells.length,
|
|
97
|
-
Oldest: oldestValue,
|
|
98
|
-
Newest: newestValue,
|
|
99
95
|
Std_Deviation: stdDeviation,
|
|
100
96
|
Only: distinctValue == 1 ? JSON.stringify(selectedCellInfo.gridCells[0].rawValue) : '',
|
|
101
97
|
};
|
|
@@ -2,11 +2,12 @@ import { IRowNode } from '@ag-grid-community/core';
|
|
|
2
2
|
import { ExpressionFunction } from '../../parser/src/types';
|
|
3
3
|
import { BaseParameter } from './expressionFunctionUtils';
|
|
4
4
|
import { AggregateParams } from './scalarAggregationHelper';
|
|
5
|
+
import { AdaptableColumnDataType } from '../../types';
|
|
5
6
|
/**
|
|
6
7
|
* List of all the AggregatedScalar Functions available in AdaptableQL
|
|
7
8
|
*/
|
|
8
9
|
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'
|
|
10
|
+
export type ScalarAggregationFunction = 'SUM' | 'PERCENTAGE' | 'QUANT' | 'QUARTILE' | 'PERCENTILE' | 'AVG' | 'MIN' | 'MAX' | 'COUNT' | 'CUMUL' | 'MEDIAN' | 'MODE' | 'DISTINCT' | 'ONLY' | 'STD_DEVIATION';
|
|
10
11
|
type OperandFunction = 'COL' | 'OVER' | 'GROUP_BY' | 'WEIGHT';
|
|
11
12
|
export interface ScalarAggregationParameter extends BaseParameter<'aggregationScalar', ScalarAggregationFunction> {
|
|
12
13
|
value: AggregatedScalarExpressionEvaluation;
|
|
@@ -29,6 +30,7 @@ export interface AggregatedScalarExpressionEvaluation {
|
|
|
29
30
|
sortByColumn?: string;
|
|
30
31
|
rowFilterFn?: (rowNode: IRowNode) => boolean;
|
|
31
32
|
getRowNodes?: () => IRowNode[];
|
|
33
|
+
columnType?: AdaptableColumnDataType;
|
|
32
34
|
}
|
|
33
35
|
export interface CumulatedAggregationValue {
|
|
34
36
|
currentValue: number;
|
|
@@ -23,8 +23,6 @@ exports.aggregatedExpressionFunctions = [
|
|
|
23
23
|
'DISTINCT',
|
|
24
24
|
'ONLY',
|
|
25
25
|
'STD_DEVIATION',
|
|
26
|
-
// 'OLDEST', Andrei - we should add these 2 but weirdly they currently return a number (I think;.../)
|
|
27
|
-
// 'NEWEST',
|
|
28
26
|
];
|
|
29
27
|
exports.cumulativeAggregatedExpressionFunctions = [
|
|
30
28
|
'CUMUL',
|
|
@@ -50,7 +48,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
50
48
|
handler(args, context) {
|
|
51
49
|
const aggregationParameter = (0, expressionFunctionUtils_1.extractParameter)('CUMUL', 'aggregationScalar', ['SUM', 'PERCENTAGE', 'AVG', 'MIN', 'MAX', 'COUNT'], args);
|
|
52
50
|
const overColumnParameter = (0, expressionFunctionUtils_1.extractParameter)('CUMUL', 'operand', ['OVER'], args);
|
|
53
|
-
const groupByParameter = (0, expressionFunctionUtils_1.extractParameter)(
|
|
51
|
+
const groupByParameter = (0, expressionFunctionUtils_1.extractParameter)(aggregationParameter.name, 'operand', ['GROUP_BY'], args, {
|
|
54
52
|
isOptional: true,
|
|
55
53
|
});
|
|
56
54
|
if (!!groupByParameter) {
|
|
@@ -79,7 +77,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
79
77
|
handler(args, context) {
|
|
80
78
|
const sumColumnParameter = (0, expressionFunctionUtils_1.extractColumnParameter)('SUM', args);
|
|
81
79
|
const sumColumnName = sumColumnParameter.value;
|
|
82
|
-
(0, expressionFunctionUtils_1.validateColumnType)(sumColumnName, ['Number'], 'SUM', context.adaptableApi);
|
|
80
|
+
const columnType = (0, expressionFunctionUtils_1.validateColumnType)(sumColumnName, ['Number'], 'SUM', context.adaptableApi);
|
|
83
81
|
const groupByParameter = (0, expressionFunctionUtils_1.extractParameter)('SUM', 'operand', ['GROUP_BY'], args, {
|
|
84
82
|
isOptional: true,
|
|
85
83
|
});
|
|
@@ -103,6 +101,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
103
101
|
},
|
|
104
102
|
rowFilterFn: context.filterFn,
|
|
105
103
|
getRowNodes: context.getRowNodes,
|
|
104
|
+
columnType,
|
|
106
105
|
};
|
|
107
106
|
addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
|
|
108
107
|
const result = {
|
|
@@ -128,7 +127,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
128
127
|
var _a;
|
|
129
128
|
const percentageColumnParameter = (0, expressionFunctionUtils_1.extractColumnParameter)('PERCENTAGE', args);
|
|
130
129
|
const percentageColumnName = percentageColumnParameter.value;
|
|
131
|
-
(0, expressionFunctionUtils_1.validateColumnType)(percentageColumnName, ['Number'], 'PERCENTAGE', context.adaptableApi);
|
|
130
|
+
const columnType = (0, expressionFunctionUtils_1.validateColumnType)(percentageColumnName, ['Number'], 'PERCENTAGE', context.adaptableApi);
|
|
132
131
|
const sumOperand = (0, expressionFunctionUtils_1.extractParameter)('PERCENTAGE', 'aggregationScalar', ['SUM'], args, {
|
|
133
132
|
isOptional: true,
|
|
134
133
|
});
|
|
@@ -167,6 +166,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
167
166
|
},
|
|
168
167
|
rowFilterFn: context.filterFn,
|
|
169
168
|
getRowNodes: context.getRowNodes,
|
|
169
|
+
columnType,
|
|
170
170
|
};
|
|
171
171
|
addGroupByParams(groupByColumnNames, aggregationExpressionEvaluation);
|
|
172
172
|
const result = {
|
|
@@ -195,7 +195,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
195
195
|
handler(args, context) {
|
|
196
196
|
const avgColumnParameter = (0, expressionFunctionUtils_1.extractColumnParameter)('AVG', args);
|
|
197
197
|
const avgColumnName = avgColumnParameter.value;
|
|
198
|
-
(0, expressionFunctionUtils_1.validateColumnType)(avgColumnName, ['Number'], 'AVG', context.adaptableApi);
|
|
198
|
+
const columnType = (0, expressionFunctionUtils_1.validateColumnType)(avgColumnName, ['Number'], 'AVG', context.adaptableApi);
|
|
199
199
|
const groupByParameter = (0, expressionFunctionUtils_1.extractParameter)('AVG', 'operand', ['GROUP_BY'], args, {
|
|
200
200
|
isOptional: true,
|
|
201
201
|
});
|
|
@@ -242,6 +242,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
242
242
|
},
|
|
243
243
|
rowFilterFn: context.filterFn,
|
|
244
244
|
getRowNodes: context.getRowNodes,
|
|
245
|
+
columnType,
|
|
245
246
|
};
|
|
246
247
|
addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
|
|
247
248
|
if (weightParameter) {
|
|
@@ -271,7 +272,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
271
272
|
handler(args, context) {
|
|
272
273
|
const medianColumnParameter = (0, expressionFunctionUtils_1.extractColumnParameter)('MEDIAN', args);
|
|
273
274
|
const medianColumnName = medianColumnParameter.value;
|
|
274
|
-
(0, expressionFunctionUtils_1.validateColumnType)(medianColumnName, ['Number'], 'MEDIAN', context.adaptableApi);
|
|
275
|
+
const columnType = (0, expressionFunctionUtils_1.validateColumnType)(medianColumnName, ['Number'], 'MEDIAN', context.adaptableApi);
|
|
275
276
|
const groupByParameter = (0, expressionFunctionUtils_1.extractParameter)('MEDIAN', 'operand', ['GROUP_BY'], args, {
|
|
276
277
|
isOptional: true,
|
|
277
278
|
});
|
|
@@ -312,6 +313,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
312
313
|
},
|
|
313
314
|
rowFilterFn: context.filterFn,
|
|
314
315
|
getRowNodes: context.getRowNodes,
|
|
316
|
+
columnType,
|
|
315
317
|
};
|
|
316
318
|
addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
|
|
317
319
|
const result = {
|
|
@@ -336,7 +338,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
336
338
|
handler(args, context) {
|
|
337
339
|
const modeColumnParameter = (0, expressionFunctionUtils_1.extractColumnParameter)('mode', args);
|
|
338
340
|
const modeColumnName = modeColumnParameter.value;
|
|
339
|
-
(0, expressionFunctionUtils_1.validateColumnType)(modeColumnName, ['Number', 'String', 'Date'], 'mode', context.adaptableApi);
|
|
341
|
+
const columnType = (0, expressionFunctionUtils_1.validateColumnType)(modeColumnName, ['Number', 'String', 'Date'], 'mode', context.adaptableApi);
|
|
340
342
|
const groupByParameter = (0, expressionFunctionUtils_1.extractParameter)('MODE', 'operand', ['GROUP_BY'], args, {
|
|
341
343
|
isOptional: true,
|
|
342
344
|
});
|
|
@@ -378,6 +380,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
378
380
|
},
|
|
379
381
|
rowFilterFn: context.filterFn,
|
|
380
382
|
getRowNodes: context.getRowNodes,
|
|
383
|
+
columnType,
|
|
381
384
|
};
|
|
382
385
|
addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
|
|
383
386
|
const result = {
|
|
@@ -450,7 +453,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
450
453
|
handler(args, context) {
|
|
451
454
|
const distinctColumnParameter = (0, expressionFunctionUtils_1.extractColumnParameter)('ONLY', args);
|
|
452
455
|
const onlyColumnName = distinctColumnParameter.value;
|
|
453
|
-
(0, expressionFunctionUtils_1.validateColumnType)(onlyColumnName, ['Number'], 'ONLY', context.adaptableApi);
|
|
456
|
+
const columnType = (0, expressionFunctionUtils_1.validateColumnType)(onlyColumnName, ['Number'], 'ONLY', context.adaptableApi);
|
|
454
457
|
const groupByParameter = (0, expressionFunctionUtils_1.extractParameter)('ONLY', 'operand', ['GROUP_BY'], args, {
|
|
455
458
|
isOptional: true,
|
|
456
459
|
});
|
|
@@ -476,6 +479,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
476
479
|
},
|
|
477
480
|
rowFilterFn: context.filterFn,
|
|
478
481
|
getRowNodes: context.getRowNodes,
|
|
482
|
+
columnType,
|
|
479
483
|
};
|
|
480
484
|
addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
|
|
481
485
|
const result = {
|
|
@@ -500,7 +504,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
500
504
|
handler(args, context) {
|
|
501
505
|
const columnParameter = (0, expressionFunctionUtils_1.extractColumnParameter)('STD_DEVIATION', args);
|
|
502
506
|
const columnName = columnParameter.value;
|
|
503
|
-
(0, expressionFunctionUtils_1.validateColumnType)(columnName, ['Number'], 'STD_DEVIATION', context.adaptableApi);
|
|
507
|
+
const columnType = (0, expressionFunctionUtils_1.validateColumnType)(columnName, ['Number'], 'STD_DEVIATION', context.adaptableApi);
|
|
504
508
|
const groupByParameter = (0, expressionFunctionUtils_1.extractParameter)('STD_DEVIATION', 'operand', ['GROUP_BY'], args, {
|
|
505
509
|
isOptional: true,
|
|
506
510
|
});
|
|
@@ -534,6 +538,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
534
538
|
},
|
|
535
539
|
rowFilterFn: context.filterFn,
|
|
536
540
|
getRowNodes: context.getRowNodes,
|
|
541
|
+
columnType,
|
|
537
542
|
};
|
|
538
543
|
addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
|
|
539
544
|
const result = {
|
|
@@ -558,7 +563,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
558
563
|
handler(args, context) {
|
|
559
564
|
const minColumnParameter = (0, expressionFunctionUtils_1.extractColumnParameter)('MIN', args);
|
|
560
565
|
const minColumnName = minColumnParameter.value;
|
|
561
|
-
(0, expressionFunctionUtils_1.validateColumnType)(minColumnName, ['Number'], 'MIN', context.adaptableApi);
|
|
566
|
+
const columnType = (0, expressionFunctionUtils_1.validateColumnType)(minColumnName, ['Number', 'Date'], 'MIN', context.adaptableApi);
|
|
562
567
|
const groupByParameter = (0, expressionFunctionUtils_1.extractParameter)('MIN', 'operand', ['GROUP_BY'], args, {
|
|
563
568
|
isOptional: true,
|
|
564
569
|
});
|
|
@@ -573,8 +578,19 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
573
578
|
if (isUndefinedValue(rowValue)) {
|
|
574
579
|
return minValue;
|
|
575
580
|
}
|
|
576
|
-
|
|
577
|
-
|
|
581
|
+
if (minValue === Number.MAX_VALUE) {
|
|
582
|
+
return rowValue;
|
|
583
|
+
}
|
|
584
|
+
if (columnType === 'Number') {
|
|
585
|
+
const numericRowValue = (0, expressionFunctionUtils_1.getNumericValue)(rowValue);
|
|
586
|
+
return numericRowValue < minValue ? numericRowValue : minValue;
|
|
587
|
+
}
|
|
588
|
+
else {
|
|
589
|
+
// Date
|
|
590
|
+
return (0, isAfter_1.default)((0, DateHelper_1.parseDateValue)(rowValue), (0, DateHelper_1.parseDateValue)(minValue))
|
|
591
|
+
? minValue
|
|
592
|
+
: rowValue;
|
|
593
|
+
}
|
|
578
594
|
},
|
|
579
595
|
done: (minValue) => {
|
|
580
596
|
if (minValue !== Number.MAX_VALUE) {
|
|
@@ -586,6 +602,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
586
602
|
},
|
|
587
603
|
rowFilterFn: context.filterFn,
|
|
588
604
|
getRowNodes: context.getRowNodes,
|
|
605
|
+
columnType,
|
|
589
606
|
};
|
|
590
607
|
addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
|
|
591
608
|
const result = {
|
|
@@ -610,7 +627,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
610
627
|
handler(args, context) {
|
|
611
628
|
const maxColumnParameter = (0, expressionFunctionUtils_1.extractColumnParameter)('MAX', args);
|
|
612
629
|
const maxColumnName = maxColumnParameter.value;
|
|
613
|
-
(0, expressionFunctionUtils_1.validateColumnType)(maxColumnName, ['Number'], 'MAX', context.adaptableApi);
|
|
630
|
+
const columnType = (0, expressionFunctionUtils_1.validateColumnType)(maxColumnName, ['Number', 'Date'], 'MAX', context.adaptableApi);
|
|
614
631
|
const groupByParameter = (0, expressionFunctionUtils_1.extractParameter)('MAX', 'operand', ['GROUP_BY'], args, {
|
|
615
632
|
isOptional: true,
|
|
616
633
|
});
|
|
@@ -625,8 +642,19 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
625
642
|
if (isUndefinedValue(rowValue)) {
|
|
626
643
|
return maxValue;
|
|
627
644
|
}
|
|
628
|
-
|
|
629
|
-
|
|
645
|
+
if (maxValue === Number.MIN_VALUE) {
|
|
646
|
+
return rowValue;
|
|
647
|
+
}
|
|
648
|
+
if (columnType === 'Number') {
|
|
649
|
+
const numericRowValue = (0, expressionFunctionUtils_1.getNumericValue)(rowValue);
|
|
650
|
+
return numericRowValue > maxValue ? numericRowValue : maxValue;
|
|
651
|
+
}
|
|
652
|
+
else {
|
|
653
|
+
// Date
|
|
654
|
+
return (0, isAfter_1.default)((0, DateHelper_1.parseDateValue)(rowValue), (0, DateHelper_1.parseDateValue)(maxValue))
|
|
655
|
+
? rowValue
|
|
656
|
+
: maxValue;
|
|
657
|
+
}
|
|
630
658
|
},
|
|
631
659
|
done: (maxValue) => {
|
|
632
660
|
if (maxValue !== Number.MIN_VALUE) {
|
|
@@ -638,6 +666,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
638
666
|
},
|
|
639
667
|
rowFilterFn: context.filterFn,
|
|
640
668
|
getRowNodes: context.getRowNodes,
|
|
669
|
+
columnType,
|
|
641
670
|
};
|
|
642
671
|
addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
|
|
643
672
|
const result = {
|
|
@@ -654,7 +683,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
654
683
|
'MAX( [colNameA], GROUP_BY( [colNameB] ))',
|
|
655
684
|
'MAX( COL(nameA: string), GROUP_BY( COL(nameB: string)))',
|
|
656
685
|
],
|
|
657
|
-
examples: ['
|
|
686
|
+
examples: ['MAX([colA])', 'MAX([colA], GROUP_BY([colB]))'],
|
|
658
687
|
category: 'aggregation',
|
|
659
688
|
inputs: ['number'],
|
|
660
689
|
},
|
|
@@ -663,7 +692,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
663
692
|
var _a, _b, _c;
|
|
664
693
|
const quantileColumnParameter = (0, expressionFunctionUtils_1.extractColumnParameter)('QUANT', args);
|
|
665
694
|
const quantileColumnName = quantileColumnParameter.value;
|
|
666
|
-
(0, expressionFunctionUtils_1.validateColumnType)(quantileColumnName, ['Number'], 'QUANT', context.adaptableApi);
|
|
695
|
+
const columnType = (0, expressionFunctionUtils_1.validateColumnType)(quantileColumnName, ['Number'], 'QUANT', context.adaptableApi);
|
|
667
696
|
const qNumberCandidates = args.filter((arg) => typeof arg === 'number');
|
|
668
697
|
if (qNumberCandidates.length !== 1) {
|
|
669
698
|
throw new ExpressionEvaluationError_1.ExpressionEvaluationError('QUANT', 'expects a single positive numeric argument as q-quantile');
|
|
@@ -770,6 +799,7 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
770
799
|
}
|
|
771
800
|
return rowBucketMap[rowValue];
|
|
772
801
|
},
|
|
802
|
+
columnType,
|
|
773
803
|
};
|
|
774
804
|
addGroupByParams(groupByOperand === null || groupByOperand === void 0 ? void 0 : groupByOperand.value, aggregationExpressionEvaluation);
|
|
775
805
|
const result = {
|
|
@@ -917,124 +947,6 @@ exports.aggregatedScalarExpressionFunctions = {
|
|
|
917
947
|
examples: ['[col1]', 'COL("col1")'],
|
|
918
948
|
category: 'special',
|
|
919
949
|
},
|
|
920
|
-
OLDEST: {
|
|
921
|
-
handler(args, context) {
|
|
922
|
-
const minColumnParameter = (0, expressionFunctionUtils_1.extractColumnParameter)('OLDEST', args);
|
|
923
|
-
const minColumnName = minColumnParameter.value;
|
|
924
|
-
(0, expressionFunctionUtils_1.validateColumnType)(minColumnName, ['Date'], 'OLDEST', context.adaptableApi);
|
|
925
|
-
const groupByParameter = (0, expressionFunctionUtils_1.extractParameter)('OLDEST', 'operand', ['GROUP_BY'], args, {
|
|
926
|
-
isOptional: true,
|
|
927
|
-
});
|
|
928
|
-
const aggregationExpressionEvaluation = {
|
|
929
|
-
aggregationParams: {
|
|
930
|
-
reducers: {
|
|
931
|
-
OLDEST: {
|
|
932
|
-
name: 'OLDEST',
|
|
933
|
-
field: minColumnName,
|
|
934
|
-
initialValue: null,
|
|
935
|
-
reducer: (minValue, rowValue) => {
|
|
936
|
-
if (!minValue) {
|
|
937
|
-
return rowValue;
|
|
938
|
-
}
|
|
939
|
-
if (!rowValue) {
|
|
940
|
-
return minValue;
|
|
941
|
-
}
|
|
942
|
-
if ((0, isAfter_1.default)((0, DateHelper_1.parseDateValue)(minValue), (0, DateHelper_1.parseDateValue)(rowValue))) {
|
|
943
|
-
return rowValue;
|
|
944
|
-
}
|
|
945
|
-
else {
|
|
946
|
-
return minValue;
|
|
947
|
-
}
|
|
948
|
-
},
|
|
949
|
-
done: (minValue, arr) => {
|
|
950
|
-
if (minValue !== null) {
|
|
951
|
-
return minValue;
|
|
952
|
-
}
|
|
953
|
-
},
|
|
954
|
-
},
|
|
955
|
-
},
|
|
956
|
-
},
|
|
957
|
-
rowFilterFn: context.filterFn,
|
|
958
|
-
getRowNodes: context.getRowNodes,
|
|
959
|
-
};
|
|
960
|
-
addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
|
|
961
|
-
const result = {
|
|
962
|
-
name: 'OLDEST',
|
|
963
|
-
type: 'aggregationScalar',
|
|
964
|
-
value: aggregationExpressionEvaluation,
|
|
965
|
-
};
|
|
966
|
-
return result;
|
|
967
|
-
},
|
|
968
|
-
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',
|
|
969
|
-
signatures: [
|
|
970
|
-
'OLDEST( [colName] )',
|
|
971
|
-
'OLDEST( COL(name: string))',
|
|
972
|
-
'OLDEST( [colNameA], GROUP_BY( [colNameB] ))',
|
|
973
|
-
'OLDEST( COL(nameA: string), GROUP_BY( COL(nameB: string)))',
|
|
974
|
-
],
|
|
975
|
-
examples: ['OLDEST([colA])', 'OLDEST([colA], GROUP_BY([colB]))'],
|
|
976
|
-
category: 'aggregation',
|
|
977
|
-
inputs: ['date'],
|
|
978
|
-
},
|
|
979
|
-
NEWEST: {
|
|
980
|
-
handler(args, context) {
|
|
981
|
-
const minColumnParameter = (0, expressionFunctionUtils_1.extractColumnParameter)('NEWEST', args);
|
|
982
|
-
const minColumnName = minColumnParameter.value;
|
|
983
|
-
(0, expressionFunctionUtils_1.validateColumnType)(minColumnName, ['Date'], 'NEWEST', context.adaptableApi);
|
|
984
|
-
const groupByParameter = (0, expressionFunctionUtils_1.extractParameter)('NEWEST', 'operand', ['GROUP_BY'], args, {
|
|
985
|
-
isOptional: true,
|
|
986
|
-
});
|
|
987
|
-
const aggregationExpressionEvaluation = {
|
|
988
|
-
aggregationParams: {
|
|
989
|
-
reducers: {
|
|
990
|
-
NEWEST: {
|
|
991
|
-
name: 'NEWEST',
|
|
992
|
-
field: minColumnName,
|
|
993
|
-
initialValue: null,
|
|
994
|
-
reducer: (minValue, rowValue) => {
|
|
995
|
-
if (!minValue) {
|
|
996
|
-
return rowValue;
|
|
997
|
-
}
|
|
998
|
-
if (!rowValue) {
|
|
999
|
-
return minValue;
|
|
1000
|
-
}
|
|
1001
|
-
if ((0, isAfter_1.default)((0, DateHelper_1.parseDateValue)(minValue), (0, DateHelper_1.parseDateValue)(rowValue))) {
|
|
1002
|
-
return minValue;
|
|
1003
|
-
}
|
|
1004
|
-
else {
|
|
1005
|
-
return rowValue;
|
|
1006
|
-
}
|
|
1007
|
-
},
|
|
1008
|
-
done: (minValue, arr) => {
|
|
1009
|
-
if (minValue !== null) {
|
|
1010
|
-
return minValue;
|
|
1011
|
-
}
|
|
1012
|
-
},
|
|
1013
|
-
},
|
|
1014
|
-
},
|
|
1015
|
-
},
|
|
1016
|
-
rowFilterFn: context.filterFn,
|
|
1017
|
-
getRowNodes: context.getRowNodes,
|
|
1018
|
-
};
|
|
1019
|
-
addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
|
|
1020
|
-
const result = {
|
|
1021
|
-
name: 'NEWEST',
|
|
1022
|
-
type: 'aggregationScalar',
|
|
1023
|
-
value: aggregationExpressionEvaluation,
|
|
1024
|
-
};
|
|
1025
|
-
return result;
|
|
1026
|
-
},
|
|
1027
|
-
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',
|
|
1028
|
-
signatures: [
|
|
1029
|
-
'NEWEST( [colName] )',
|
|
1030
|
-
'NEWEST( COL(name: string))',
|
|
1031
|
-
'NEWEST( [colNameA], GROUP_BY( [colNameB] ))',
|
|
1032
|
-
'NEWEST( COL(nameA: string), GROUP_BY( COL(nameB: string)))',
|
|
1033
|
-
],
|
|
1034
|
-
examples: ['NEWEST([colA])', 'NEWEST([colA], GROUP_BY([colB]))'],
|
|
1035
|
-
category: 'aggregation',
|
|
1036
|
-
inputs: ['date'],
|
|
1037
|
-
},
|
|
1038
950
|
};
|
|
1039
951
|
const mapAggregationToCumulation = (aggregationParameter, overColumnParameter, context) => {
|
|
1040
952
|
const aggregationEvaluation = aggregationParameter.value;
|
|
@@ -1064,8 +976,16 @@ const mapAggregationToCumulation = (aggregationParameter, overColumnParameter, c
|
|
|
1064
976
|
cumulatedValues: {},
|
|
1065
977
|
},
|
|
1066
978
|
reducer: (cumulationBag, rowValue, rowNode) => {
|
|
1067
|
-
if (isDefinedValue(rowValue)
|
|
1068
|
-
|
|
979
|
+
if (isDefinedValue(rowValue)) {
|
|
980
|
+
if (aggregationEvaluation.columnType === 'Date') {
|
|
981
|
+
if (cumulationBag.currentValue === aggregationReducer.initialValue ||
|
|
982
|
+
(0, isAfter_1.default)((0, DateHelper_1.parseDateValue)(cumulationBag.currentValue), (0, DateHelper_1.parseDateValue)(rowValue))) {
|
|
983
|
+
cumulationBag.currentValue = rowValue;
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
else if (rowValue < cumulationBag.currentValue) {
|
|
987
|
+
cumulationBag.currentValue = rowValue;
|
|
988
|
+
}
|
|
1069
989
|
}
|
|
1070
990
|
if (cumulationBag.currentValue !== aggregationReducer.initialValue) {
|
|
1071
991
|
cumulationBag.cumulatedValues[rowNode.id] = cumulationBag.currentValue;
|
|
@@ -1082,8 +1002,16 @@ const mapAggregationToCumulation = (aggregationParameter, overColumnParameter, c
|
|
|
1082
1002
|
cumulatedValues: {},
|
|
1083
1003
|
},
|
|
1084
1004
|
reducer: (cumulationBag, rowValue, rowNode) => {
|
|
1085
|
-
if (isDefinedValue(rowValue)
|
|
1086
|
-
|
|
1005
|
+
if (isDefinedValue(rowValue)) {
|
|
1006
|
+
if (aggregationEvaluation.columnType === 'Date') {
|
|
1007
|
+
if (cumulationBag.currentValue === aggregationReducer.initialValue ||
|
|
1008
|
+
(0, isAfter_1.default)((0, DateHelper_1.parseDateValue)(rowValue), (0, DateHelper_1.parseDateValue)(cumulationBag.currentValue))) {
|
|
1009
|
+
cumulationBag.currentValue = rowValue;
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
else if (rowValue > cumulationBag.currentValue) {
|
|
1013
|
+
cumulationBag.currentValue = rowValue;
|
|
1014
|
+
}
|
|
1087
1015
|
}
|
|
1088
1016
|
if (cumulationBag.currentValue !== aggregationReducer.initialValue) {
|
|
1089
1017
|
cumulationBag.cumulatedValues[rowNode.id] = cumulationBag.currentValue;
|
|
@@ -28,4 +28,4 @@ export declare const extractParameters: <T extends BaseParameter<string, string>
|
|
|
28
28
|
}) => T[];
|
|
29
29
|
export declare const handleColumnFunction: (args: any[], context: ExpressionContext) => ColumnParameter;
|
|
30
30
|
export declare const getNumericValue: (input: unknown) => number;
|
|
31
|
-
export declare const validateColumnType: (columnId: string, validColumnTypes: ('Number' | 'String' | 'Date')[], consumingFunction: string, api: AdaptableApi) =>
|
|
31
|
+
export declare const validateColumnType: (columnId: string, validColumnTypes: ('Number' | 'String' | 'Date')[], consumingFunction: string, api: AdaptableApi) => import("../../types").AdaptableColumnDataType;
|
|
@@ -133,6 +133,7 @@ const validateColumnType = (columnId, validColumnTypes, consumingFunction, api)
|
|
|
133
133
|
if (!validColumnTypes.some((validType) => validType === columnType)) {
|
|
134
134
|
throw new ExpressionEvaluationError_1.ExpressionEvaluationError(consumingFunction, `expects a column of type ${validColumnTypes.join(' or ')}`);
|
|
135
135
|
}
|
|
136
|
+
return columnType;
|
|
136
137
|
};
|
|
137
138
|
exports.validateColumnType = validateColumnType;
|
|
138
139
|
const validateColumnId = (columnId, api) => {
|
|
@@ -21,8 +21,9 @@ class CellSummaryDetails extends React.Component {
|
|
|
21
21
|
let data = [];
|
|
22
22
|
if (this.props.CellSummary != null) {
|
|
23
23
|
data = Object.keys(this.props.CellSummary).map((operationName) => {
|
|
24
|
+
const operationLabel = operationName === 'Std_Deviation' ? 'Standard Deviation' : operationName;
|
|
24
25
|
return {
|
|
25
|
-
Operation:
|
|
26
|
+
Operation: operationLabel,
|
|
26
27
|
Value: this.props.CellSummary[operationName],
|
|
27
28
|
};
|
|
28
29
|
});
|
|
@@ -12,7 +12,8 @@ const DataImportPopup = (props) => {
|
|
|
12
12
|
const [isWizardOpen, setIsWizardOpen] = React.useState(false);
|
|
13
13
|
React.useEffect(() => {
|
|
14
14
|
var _a, _b;
|
|
15
|
-
if ((
|
|
15
|
+
if ((props === null || props === void 0 ? void 0 : props.popupParams) == undefined ||
|
|
16
|
+
(((_a = props.popupParams) === null || _a === void 0 ? void 0 : _a.action) === 'New' && ((_b = props.popupParams) === null || _b === void 0 ? void 0 : _b.source) !== 'ModuleMenu')) {
|
|
16
17
|
setIsWizardOpen(true);
|
|
17
18
|
}
|
|
18
19
|
}, []);
|
|
@@ -24,7 +25,8 @@ const DataImportPopup = (props) => {
|
|
|
24
25
|
isWizardOpen && (React.createElement(DataImportWizard_1.DataImportWizard, { onClose: () => {
|
|
25
26
|
var _a;
|
|
26
27
|
setIsWizardOpen(false);
|
|
27
|
-
if (
|
|
28
|
+
if ((props === null || props === void 0 ? void 0 : props.popupParams) == undefined ||
|
|
29
|
+
['Toolbar', 'ContextMenu', 'ColumnMenu', 'ModuleButton'].includes((_a = props === null || props === void 0 ? void 0 : props.popupParams) === null || _a === void 0 ? void 0 : _a.source)) {
|
|
28
30
|
props.onClosePopup();
|
|
29
31
|
}
|
|
30
32
|
} }))));
|
|
@@ -39,6 +39,10 @@ const ReactActionColumnRenderer = (props) => {
|
|
|
39
39
|
var _a, _b, _c;
|
|
40
40
|
const rerender = (0, useRerender_1.useRerender)();
|
|
41
41
|
const adaptable = props.context.__adaptable;
|
|
42
|
+
if (!adaptable) {
|
|
43
|
+
console.warn('Adaptable not found in context of ActionColumnRenderer');
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
42
46
|
const { actionButtons, actionColumn } = adaptable.api.internalApi.getActionButtonsAndActionColumn(props.colDef);
|
|
43
47
|
if (!actionColumn || !actionButtons.length) {
|
|
44
48
|
return null;
|
|
@@ -83,6 +87,10 @@ class ActionColumnRenderer {
|
|
|
83
87
|
init(params) {
|
|
84
88
|
var _a, _b, _c;
|
|
85
89
|
const adaptable = params.context.__adaptable;
|
|
90
|
+
if (!adaptable) {
|
|
91
|
+
console.warn('Adaptable not found in context of ActionColumnRenderer');
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
86
94
|
const { actionButtons, actionColumn } = adaptable.api.internalApi.getActionButtonsAndActionColumn(params.colDef);
|
|
87
95
|
if (!actionColumn || !actionButtons.length) {
|
|
88
96
|
return;
|
|
@@ -997,11 +997,20 @@ class AdaptableAgGrid {
|
|
|
997
997
|
*/
|
|
998
998
|
async initializeAgGrid(gridOptions, modules, renderAgGridFrameworkComponent) {
|
|
999
999
|
if (renderAgGridFrameworkComponent) {
|
|
1000
|
+
console.log('renderAgGridFrameworkComponent');
|
|
1000
1001
|
const result = await renderAgGridFrameworkComponent(gridOptions);
|
|
1002
|
+
console.log('AFTER renderAgGridFrameworkComponent');
|
|
1001
1003
|
if (result === false) {
|
|
1002
1004
|
return false;
|
|
1003
1005
|
}
|
|
1004
1006
|
const agGridApi = result;
|
|
1007
|
+
// framework wrapper may have altered the context value via props
|
|
1008
|
+
// in that case, we have to re-populate it with the Adaptable context values
|
|
1009
|
+
const agGridContext = agGridApi.getGridOption('context');
|
|
1010
|
+
if (!agGridContext.__adaptable) {
|
|
1011
|
+
agGridContext.__adaptable = this;
|
|
1012
|
+
agGridContext.adaptableApi = this.api;
|
|
1013
|
+
}
|
|
1005
1014
|
// framework wrapper may pass the rowData as a prop
|
|
1006
1015
|
const rowData = agGridApi.getGridOption('rowData');
|
|
1007
1016
|
this.initWithLazyData = rowData == undefined || rowData.length === 0;
|