@adaptabletools/adaptable 18.0.6 → 18.0.8

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "18.0.6",
3
+ "version": "18.0.8",
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",
@@ -5,6 +5,8 @@ export class DataImportApiImpl extends ApiBase {
5
5
  super(adaptable);
6
6
  this.internalApi = new DataImportInternalApi(adaptable);
7
7
  }
8
- openImportWizard() { }
8
+ openImportWizard() {
9
+ this.getSettingsPanelApi().openSettingsPanel('DataImport');
10
+ }
9
11
  importData(partialRows) { }
10
12
  }
@@ -15,8 +15,6 @@ export interface CellSummmary {
15
15
  Count: number | undefined;
16
16
  Only: string | undefined;
17
17
  Std_Deviation: number | undefined;
18
- Oldest: Date | undefined;
19
- Newest: Date | undefined;
20
18
  [key: string]: any;
21
19
  }
22
20
  /**
@@ -59,8 +59,6 @@ export declare enum SummaryOperation {
59
59
  Max = "Max",
60
60
  Min = "Min",
61
61
  Count = "Count",
62
- Newest = "Newest",
63
- Oldest = "Oldest",
64
62
  Std_Deviation = "Std Deviation",
65
63
  Only = "Only",
66
64
  Weighted_Average = "Weighted Avg"
@@ -73,8 +73,6 @@ 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";
78
76
  SummaryOperation["Std_Deviation"] = "Std Deviation";
79
77
  SummaryOperation["Only"] = "Only";
80
78
  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", "OLDEST", "NEWEST", "STD_DEVIATION", "WEIGHTED_AVERAGE"];
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'
@@ -10,8 +10,6 @@ export const summarySupportedExpressions = [
10
10
  'MODE',
11
11
  'DISTINCT',
12
12
  'ONLY',
13
- 'OLDEST',
14
- 'NEWEST',
15
13
  'STD_DEVIATION',
16
14
  WEIGHTED_AVERAGE_AGGREATED_FUNCTION,
17
15
  ];
@@ -74,10 +74,8 @@ export class CellSummaryModule extends AdaptableModuleBase {
74
74
  const modeValue = isNumericColumn ? handleExpression('MODE') : null;
75
75
  const medianValue = isNumericColumn ? handleExpression('MEDIAN') : null;
76
76
  const distinctValue = handleExpression('DISTINCT');
77
- const maxValue = isNumericColumn ? handleExpression('MAX') : null;
78
- const minValue = isNumericColumn ? handleExpression('MIN') : null;
79
- const oldestValue = isDateColumn ? handleExpression('OLDEST') : null;
80
- const newestValue = isDateColumn ? handleExpression('NEWEST') : null;
77
+ const maxValue = isNumericColumn || isDateColumn ? handleExpression('MAX') : null;
78
+ const minValue = isNumericColumn || isDateColumn ? handleExpression('MIN') : null;
81
79
  const stdDeviation = isNumericColumn
82
80
  ? Helper.roundNumberTo4dp(handleExpression('STD_DEVIATION'))
83
81
  : null;
@@ -90,8 +88,6 @@ export class CellSummaryModule extends AdaptableModuleBase {
90
88
  Max: maxValue,
91
89
  Min: minValue,
92
90
  Count: selectedCellInfo.gridCells.length,
93
- Oldest: oldestValue,
94
- Newest: newestValue,
95
91
  Std_Deviation: stdDeviation,
96
92
  Only: distinctValue == 1 ? JSON.stringify(selectedCellInfo.gridCells[0].rawValue) : '',
97
93
  };
@@ -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' | 'OLDEST' | 'NEWEST';
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;
@@ -19,8 +19,6 @@ export const aggregatedExpressionFunctions = [
19
19
  'DISTINCT',
20
20
  'ONLY',
21
21
  'STD_DEVIATION',
22
- // 'OLDEST', Andrei - we should add these 2 but weirdly they currently return a number (I think;.../)
23
- // 'NEWEST',
24
22
  ];
25
23
  export const cumulativeAggregatedExpressionFunctions = [
26
24
  'CUMUL',
@@ -46,7 +44,7 @@ export const aggregatedScalarExpressionFunctions = {
46
44
  handler(args, context) {
47
45
  const aggregationParameter = extractParameter('CUMUL', 'aggregationScalar', ['SUM', 'PERCENTAGE', 'AVG', 'MIN', 'MAX', 'COUNT'], args);
48
46
  const overColumnParameter = extractParameter('CUMUL', 'operand', ['OVER'], args);
49
- const groupByParameter = extractParameter('MAX', 'operand', ['GROUP_BY'], args, {
47
+ const groupByParameter = extractParameter(aggregationParameter.name, 'operand', ['GROUP_BY'], args, {
50
48
  isOptional: true,
51
49
  });
52
50
  if (!!groupByParameter) {
@@ -75,7 +73,7 @@ export const aggregatedScalarExpressionFunctions = {
75
73
  handler(args, context) {
76
74
  const sumColumnParameter = extractColumnParameter('SUM', args);
77
75
  const sumColumnName = sumColumnParameter.value;
78
- validateColumnType(sumColumnName, ['Number'], 'SUM', context.adaptableApi);
76
+ const columnType = validateColumnType(sumColumnName, ['Number'], 'SUM', context.adaptableApi);
79
77
  const groupByParameter = extractParameter('SUM', 'operand', ['GROUP_BY'], args, {
80
78
  isOptional: true,
81
79
  });
@@ -99,6 +97,7 @@ export const aggregatedScalarExpressionFunctions = {
99
97
  },
100
98
  rowFilterFn: context.filterFn,
101
99
  getRowNodes: context.getRowNodes,
100
+ columnType,
102
101
  };
103
102
  addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
104
103
  const result = {
@@ -124,7 +123,7 @@ export const aggregatedScalarExpressionFunctions = {
124
123
  var _a;
125
124
  const percentageColumnParameter = extractColumnParameter('PERCENTAGE', args);
126
125
  const percentageColumnName = percentageColumnParameter.value;
127
- validateColumnType(percentageColumnName, ['Number'], 'PERCENTAGE', context.adaptableApi);
126
+ const columnType = validateColumnType(percentageColumnName, ['Number'], 'PERCENTAGE', context.adaptableApi);
128
127
  const sumOperand = extractParameter('PERCENTAGE', 'aggregationScalar', ['SUM'], args, {
129
128
  isOptional: true,
130
129
  });
@@ -163,6 +162,7 @@ export const aggregatedScalarExpressionFunctions = {
163
162
  },
164
163
  rowFilterFn: context.filterFn,
165
164
  getRowNodes: context.getRowNodes,
165
+ columnType,
166
166
  };
167
167
  addGroupByParams(groupByColumnNames, aggregationExpressionEvaluation);
168
168
  const result = {
@@ -191,7 +191,7 @@ export const aggregatedScalarExpressionFunctions = {
191
191
  handler(args, context) {
192
192
  const avgColumnParameter = extractColumnParameter('AVG', args);
193
193
  const avgColumnName = avgColumnParameter.value;
194
- validateColumnType(avgColumnName, ['Number'], 'AVG', context.adaptableApi);
194
+ const columnType = validateColumnType(avgColumnName, ['Number'], 'AVG', context.adaptableApi);
195
195
  const groupByParameter = extractParameter('AVG', 'operand', ['GROUP_BY'], args, {
196
196
  isOptional: true,
197
197
  });
@@ -238,6 +238,7 @@ export const aggregatedScalarExpressionFunctions = {
238
238
  },
239
239
  rowFilterFn: context.filterFn,
240
240
  getRowNodes: context.getRowNodes,
241
+ columnType,
241
242
  };
242
243
  addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
243
244
  if (weightParameter) {
@@ -267,7 +268,7 @@ export const aggregatedScalarExpressionFunctions = {
267
268
  handler(args, context) {
268
269
  const medianColumnParameter = extractColumnParameter('MEDIAN', args);
269
270
  const medianColumnName = medianColumnParameter.value;
270
- validateColumnType(medianColumnName, ['Number'], 'MEDIAN', context.adaptableApi);
271
+ const columnType = validateColumnType(medianColumnName, ['Number'], 'MEDIAN', context.adaptableApi);
271
272
  const groupByParameter = extractParameter('MEDIAN', 'operand', ['GROUP_BY'], args, {
272
273
  isOptional: true,
273
274
  });
@@ -308,6 +309,7 @@ export const aggregatedScalarExpressionFunctions = {
308
309
  },
309
310
  rowFilterFn: context.filterFn,
310
311
  getRowNodes: context.getRowNodes,
312
+ columnType,
311
313
  };
312
314
  addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
313
315
  const result = {
@@ -332,7 +334,7 @@ export const aggregatedScalarExpressionFunctions = {
332
334
  handler(args, context) {
333
335
  const modeColumnParameter = extractColumnParameter('mode', args);
334
336
  const modeColumnName = modeColumnParameter.value;
335
- validateColumnType(modeColumnName, ['Number', 'String', 'Date'], 'mode', context.adaptableApi);
337
+ const columnType = validateColumnType(modeColumnName, ['Number', 'String', 'Date'], 'mode', context.adaptableApi);
336
338
  const groupByParameter = extractParameter('MODE', 'operand', ['GROUP_BY'], args, {
337
339
  isOptional: true,
338
340
  });
@@ -374,6 +376,7 @@ export const aggregatedScalarExpressionFunctions = {
374
376
  },
375
377
  rowFilterFn: context.filterFn,
376
378
  getRowNodes: context.getRowNodes,
379
+ columnType,
377
380
  };
378
381
  addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
379
382
  const result = {
@@ -446,7 +449,7 @@ export const aggregatedScalarExpressionFunctions = {
446
449
  handler(args, context) {
447
450
  const distinctColumnParameter = extractColumnParameter('ONLY', args);
448
451
  const onlyColumnName = distinctColumnParameter.value;
449
- validateColumnType(onlyColumnName, ['Number'], 'ONLY', context.adaptableApi);
452
+ const columnType = validateColumnType(onlyColumnName, ['Number'], 'ONLY', context.adaptableApi);
450
453
  const groupByParameter = extractParameter('ONLY', 'operand', ['GROUP_BY'], args, {
451
454
  isOptional: true,
452
455
  });
@@ -472,6 +475,7 @@ export const aggregatedScalarExpressionFunctions = {
472
475
  },
473
476
  rowFilterFn: context.filterFn,
474
477
  getRowNodes: context.getRowNodes,
478
+ columnType,
475
479
  };
476
480
  addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
477
481
  const result = {
@@ -496,7 +500,7 @@ export const aggregatedScalarExpressionFunctions = {
496
500
  handler(args, context) {
497
501
  const columnParameter = extractColumnParameter('STD_DEVIATION', args);
498
502
  const columnName = columnParameter.value;
499
- validateColumnType(columnName, ['Number'], 'STD_DEVIATION', context.adaptableApi);
503
+ const columnType = validateColumnType(columnName, ['Number'], 'STD_DEVIATION', context.adaptableApi);
500
504
  const groupByParameter = extractParameter('STD_DEVIATION', 'operand', ['GROUP_BY'], args, {
501
505
  isOptional: true,
502
506
  });
@@ -530,6 +534,7 @@ export const aggregatedScalarExpressionFunctions = {
530
534
  },
531
535
  rowFilterFn: context.filterFn,
532
536
  getRowNodes: context.getRowNodes,
537
+ columnType,
533
538
  };
534
539
  addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
535
540
  const result = {
@@ -554,7 +559,7 @@ export const aggregatedScalarExpressionFunctions = {
554
559
  handler(args, context) {
555
560
  const minColumnParameter = extractColumnParameter('MIN', args);
556
561
  const minColumnName = minColumnParameter.value;
557
- validateColumnType(minColumnName, ['Number'], 'MIN', context.adaptableApi);
562
+ const columnType = validateColumnType(minColumnName, ['Number', 'Date'], 'MIN', context.adaptableApi);
558
563
  const groupByParameter = extractParameter('MIN', 'operand', ['GROUP_BY'], args, {
559
564
  isOptional: true,
560
565
  });
@@ -569,8 +574,19 @@ export const aggregatedScalarExpressionFunctions = {
569
574
  if (isUndefinedValue(rowValue)) {
570
575
  return minValue;
571
576
  }
572
- const numericRowValue = getNumericValue(rowValue);
573
- return numericRowValue < minValue ? numericRowValue : minValue;
577
+ if (minValue === Number.MAX_VALUE) {
578
+ return rowValue;
579
+ }
580
+ if (columnType === 'Number') {
581
+ const numericRowValue = getNumericValue(rowValue);
582
+ return numericRowValue < minValue ? numericRowValue : minValue;
583
+ }
584
+ else {
585
+ // Date
586
+ return isAfter(parseDateValue(rowValue), parseDateValue(minValue))
587
+ ? minValue
588
+ : rowValue;
589
+ }
574
590
  },
575
591
  done: (minValue) => {
576
592
  if (minValue !== Number.MAX_VALUE) {
@@ -582,6 +598,7 @@ export const aggregatedScalarExpressionFunctions = {
582
598
  },
583
599
  rowFilterFn: context.filterFn,
584
600
  getRowNodes: context.getRowNodes,
601
+ columnType,
585
602
  };
586
603
  addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
587
604
  const result = {
@@ -606,7 +623,7 @@ export const aggregatedScalarExpressionFunctions = {
606
623
  handler(args, context) {
607
624
  const maxColumnParameter = extractColumnParameter('MAX', args);
608
625
  const maxColumnName = maxColumnParameter.value;
609
- validateColumnType(maxColumnName, ['Number'], 'MAX', context.adaptableApi);
626
+ const columnType = validateColumnType(maxColumnName, ['Number', 'Date'], 'MAX', context.adaptableApi);
610
627
  const groupByParameter = extractParameter('MAX', 'operand', ['GROUP_BY'], args, {
611
628
  isOptional: true,
612
629
  });
@@ -621,8 +638,19 @@ export const aggregatedScalarExpressionFunctions = {
621
638
  if (isUndefinedValue(rowValue)) {
622
639
  return maxValue;
623
640
  }
624
- const numericRowValue = getNumericValue(rowValue);
625
- return numericRowValue > maxValue ? numericRowValue : maxValue;
641
+ if (maxValue === Number.MIN_VALUE) {
642
+ return rowValue;
643
+ }
644
+ if (columnType === 'Number') {
645
+ const numericRowValue = getNumericValue(rowValue);
646
+ return numericRowValue > maxValue ? numericRowValue : maxValue;
647
+ }
648
+ else {
649
+ // Date
650
+ return isAfter(parseDateValue(rowValue), parseDateValue(maxValue))
651
+ ? rowValue
652
+ : maxValue;
653
+ }
626
654
  },
627
655
  done: (maxValue) => {
628
656
  if (maxValue !== Number.MIN_VALUE) {
@@ -634,6 +662,7 @@ export const aggregatedScalarExpressionFunctions = {
634
662
  },
635
663
  rowFilterFn: context.filterFn,
636
664
  getRowNodes: context.getRowNodes,
665
+ columnType,
637
666
  };
638
667
  addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
639
668
  const result = {
@@ -650,7 +679,7 @@ export const aggregatedScalarExpressionFunctions = {
650
679
  'MAX( [colNameA], GROUP_BY( [colNameB] ))',
651
680
  'MAX( COL(nameA: string), GROUP_BY( COL(nameB: string)))',
652
681
  ],
653
- examples: ['MIN([colA])', 'MIN([colA], GROUP_BY([colB]))'],
682
+ examples: ['MAX([colA])', 'MAX([colA], GROUP_BY([colB]))'],
654
683
  category: 'aggregation',
655
684
  inputs: ['number'],
656
685
  },
@@ -659,7 +688,7 @@ export const aggregatedScalarExpressionFunctions = {
659
688
  var _a, _b, _c;
660
689
  const quantileColumnParameter = extractColumnParameter('QUANT', args);
661
690
  const quantileColumnName = quantileColumnParameter.value;
662
- validateColumnType(quantileColumnName, ['Number'], 'QUANT', context.adaptableApi);
691
+ const columnType = validateColumnType(quantileColumnName, ['Number'], 'QUANT', context.adaptableApi);
663
692
  const qNumberCandidates = args.filter((arg) => typeof arg === 'number');
664
693
  if (qNumberCandidates.length !== 1) {
665
694
  throw new ExpressionEvaluationError('QUANT', 'expects a single positive numeric argument as q-quantile');
@@ -766,6 +795,7 @@ export const aggregatedScalarExpressionFunctions = {
766
795
  }
767
796
  return rowBucketMap[rowValue];
768
797
  },
798
+ columnType,
769
799
  };
770
800
  addGroupByParams(groupByOperand === null || groupByOperand === void 0 ? void 0 : groupByOperand.value, aggregationExpressionEvaluation);
771
801
  const result = {
@@ -913,124 +943,6 @@ export const aggregatedScalarExpressionFunctions = {
913
943
  examples: ['[col1]', 'COL("col1")'],
914
944
  category: 'special',
915
945
  },
916
- OLDEST: {
917
- handler(args, context) {
918
- const minColumnParameter = extractColumnParameter('OLDEST', args);
919
- const minColumnName = minColumnParameter.value;
920
- validateColumnType(minColumnName, ['Date'], 'OLDEST', context.adaptableApi);
921
- const groupByParameter = extractParameter('OLDEST', 'operand', ['GROUP_BY'], args, {
922
- isOptional: true,
923
- });
924
- const aggregationExpressionEvaluation = {
925
- aggregationParams: {
926
- reducers: {
927
- OLDEST: {
928
- name: 'OLDEST',
929
- field: minColumnName,
930
- initialValue: null,
931
- reducer: (minValue, rowValue) => {
932
- if (!minValue) {
933
- return rowValue;
934
- }
935
- if (!rowValue) {
936
- return minValue;
937
- }
938
- if (isAfter(parseDateValue(minValue), parseDateValue(rowValue))) {
939
- return rowValue;
940
- }
941
- else {
942
- return minValue;
943
- }
944
- },
945
- done: (minValue, arr) => {
946
- if (minValue !== null) {
947
- return minValue;
948
- }
949
- },
950
- },
951
- },
952
- },
953
- rowFilterFn: context.filterFn,
954
- getRowNodes: context.getRowNodes,
955
- };
956
- addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
957
- const result = {
958
- name: 'OLDEST',
959
- type: 'aggregationScalar',
960
- value: aggregationExpressionEvaluation,
961
- };
962
- return result;
963
- },
964
- 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',
965
- signatures: [
966
- 'OLDEST( [colName] )',
967
- 'OLDEST( COL(name: string))',
968
- 'OLDEST( [colNameA], GROUP_BY( [colNameB] ))',
969
- 'OLDEST( COL(nameA: string), GROUP_BY( COL(nameB: string)))',
970
- ],
971
- examples: ['OLDEST([colA])', 'OLDEST([colA], GROUP_BY([colB]))'],
972
- category: 'aggregation',
973
- inputs: ['date'],
974
- },
975
- NEWEST: {
976
- handler(args, context) {
977
- const minColumnParameter = extractColumnParameter('NEWEST', args);
978
- const minColumnName = minColumnParameter.value;
979
- validateColumnType(minColumnName, ['Date'], 'NEWEST', context.adaptableApi);
980
- const groupByParameter = extractParameter('NEWEST', 'operand', ['GROUP_BY'], args, {
981
- isOptional: true,
982
- });
983
- const aggregationExpressionEvaluation = {
984
- aggregationParams: {
985
- reducers: {
986
- NEWEST: {
987
- name: 'NEWEST',
988
- field: minColumnName,
989
- initialValue: null,
990
- reducer: (minValue, rowValue) => {
991
- if (!minValue) {
992
- return rowValue;
993
- }
994
- if (!rowValue) {
995
- return minValue;
996
- }
997
- if (isAfter(parseDateValue(minValue), parseDateValue(rowValue))) {
998
- return minValue;
999
- }
1000
- else {
1001
- return rowValue;
1002
- }
1003
- },
1004
- done: (minValue, arr) => {
1005
- if (minValue !== null) {
1006
- return minValue;
1007
- }
1008
- },
1009
- },
1010
- },
1011
- },
1012
- rowFilterFn: context.filterFn,
1013
- getRowNodes: context.getRowNodes,
1014
- };
1015
- addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
1016
- const result = {
1017
- name: 'NEWEST',
1018
- type: 'aggregationScalar',
1019
- value: aggregationExpressionEvaluation,
1020
- };
1021
- return result;
1022
- },
1023
- 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',
1024
- signatures: [
1025
- 'NEWEST( [colName] )',
1026
- 'NEWEST( COL(name: string))',
1027
- 'NEWEST( [colNameA], GROUP_BY( [colNameB] ))',
1028
- 'NEWEST( COL(nameA: string), GROUP_BY( COL(nameB: string)))',
1029
- ],
1030
- examples: ['NEWEST([colA])', 'NEWEST([colA], GROUP_BY([colB]))'],
1031
- category: 'aggregation',
1032
- inputs: ['date'],
1033
- },
1034
946
  };
1035
947
  const mapAggregationToCumulation = (aggregationParameter, overColumnParameter, context) => {
1036
948
  const aggregationEvaluation = aggregationParameter.value;
@@ -1060,8 +972,16 @@ const mapAggregationToCumulation = (aggregationParameter, overColumnParameter, c
1060
972
  cumulatedValues: {},
1061
973
  },
1062
974
  reducer: (cumulationBag, rowValue, rowNode) => {
1063
- if (isDefinedValue(rowValue) && rowValue < cumulationBag.currentValue) {
1064
- cumulationBag.currentValue = rowValue;
975
+ if (isDefinedValue(rowValue)) {
976
+ if (aggregationEvaluation.columnType === 'Date') {
977
+ if (cumulationBag.currentValue === aggregationReducer.initialValue ||
978
+ isAfter(parseDateValue(cumulationBag.currentValue), parseDateValue(rowValue))) {
979
+ cumulationBag.currentValue = rowValue;
980
+ }
981
+ }
982
+ else if (rowValue < cumulationBag.currentValue) {
983
+ cumulationBag.currentValue = rowValue;
984
+ }
1065
985
  }
1066
986
  if (cumulationBag.currentValue !== aggregationReducer.initialValue) {
1067
987
  cumulationBag.cumulatedValues[rowNode.id] = cumulationBag.currentValue;
@@ -1078,8 +998,16 @@ const mapAggregationToCumulation = (aggregationParameter, overColumnParameter, c
1078
998
  cumulatedValues: {},
1079
999
  },
1080
1000
  reducer: (cumulationBag, rowValue, rowNode) => {
1081
- if (isDefinedValue(rowValue) && rowValue > cumulationBag.currentValue) {
1082
- cumulationBag.currentValue = rowValue;
1001
+ if (isDefinedValue(rowValue)) {
1002
+ if (aggregationEvaluation.columnType === 'Date') {
1003
+ if (cumulationBag.currentValue === aggregationReducer.initialValue ||
1004
+ isAfter(parseDateValue(rowValue), parseDateValue(cumulationBag.currentValue))) {
1005
+ cumulationBag.currentValue = rowValue;
1006
+ }
1007
+ }
1008
+ else if (rowValue > cumulationBag.currentValue) {
1009
+ cumulationBag.currentValue = rowValue;
1010
+ }
1083
1011
  }
1084
1012
  if (cumulationBag.currentValue !== aggregationReducer.initialValue) {
1085
1013
  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) => void;
31
+ export declare const validateColumnType: (columnId: string, validColumnTypes: ('Number' | 'String' | 'Date')[], consumingFunction: string, api: AdaptableApi) => import("../../types").AdaptableColumnDataType;
@@ -116,6 +116,7 @@ export const validateColumnType = (columnId, validColumnTypes, consumingFunction
116
116
  if (!validColumnTypes.some((validType) => validType === columnType)) {
117
117
  throw new ExpressionEvaluationError(consumingFunction, `expects a column of type ${validColumnTypes.join(' or ')}`);
118
118
  }
119
+ return columnType;
119
120
  };
120
121
  const validateColumnId = (columnId, api) => {
121
122
  const column = api.columnApi.getColumnWithColumnId(columnId);
@@ -282,8 +282,6 @@ export function CreateEmptyCellSummmary() {
282
282
  Max: undefined,
283
283
  Min: undefined,
284
284
  Count: undefined,
285
- Newest: undefined,
286
- Oldest: undefined,
287
285
  Std_Deviation: undefined,
288
286
  Only: undefined,
289
287
  };
@@ -17,8 +17,9 @@ export class CellSummaryDetails extends React.Component {
17
17
  let data = [];
18
18
  if (this.props.CellSummary != null) {
19
19
  data = Object.keys(this.props.CellSummary).map((operationName) => {
20
+ const operationLabel = operationName === 'Std_Deviation' ? 'Standard Deviation' : operationName;
20
21
  return {
21
- Operation: operationName,
22
+ Operation: operationLabel,
22
23
  Value: this.props.CellSummary[operationName],
23
24
  };
24
25
  });
@@ -8,7 +8,8 @@ export const DataImportPopup = (props) => {
8
8
  const [isWizardOpen, setIsWizardOpen] = React.useState(false);
9
9
  React.useEffect(() => {
10
10
  var _a, _b;
11
- if (((_a = props.popupParams) === null || _a === void 0 ? void 0 : _a.action) === 'New' && ((_b = props.popupParams) === null || _b === void 0 ? void 0 : _b.source) !== 'ModuleMenu') {
11
+ if ((props === null || props === void 0 ? void 0 : props.popupParams) == undefined ||
12
+ (((_a = props.popupParams) === null || _a === void 0 ? void 0 : _a.action) === 'New' && ((_b = props.popupParams) === null || _b === void 0 ? void 0 : _b.source) !== 'ModuleMenu')) {
12
13
  setIsWizardOpen(true);
13
14
  }
14
15
  }, []);
@@ -20,7 +21,8 @@ export const DataImportPopup = (props) => {
20
21
  isWizardOpen && (React.createElement(DataImportWizard, { onClose: () => {
21
22
  var _a;
22
23
  setIsWizardOpen(false);
23
- if (['Toolbar', 'ContextMenu', 'ColumnMenu', 'ModuleButton'].includes((_a = props === null || props === void 0 ? void 0 : props.popupParams) === null || _a === void 0 ? void 0 : _a.source)) {
24
+ if ((props === null || props === void 0 ? void 0 : props.popupParams) == undefined ||
25
+ ['Toolbar', 'ContextMenu', 'ColumnMenu', 'ModuleButton'].includes((_a = props === null || props === void 0 ? void 0 : props.popupParams) === null || _a === void 0 ? void 0 : _a.source)) {
24
26
  props.onClosePopup();
25
27
  }
26
28
  } }))));
@@ -35,6 +35,10 @@ export const ReactActionColumnRenderer = (props) => {
35
35
  var _a, _b, _c;
36
36
  const rerender = useRerender();
37
37
  const adaptable = props.context.__adaptable;
38
+ if (!adaptable) {
39
+ console.warn('Adaptable not found in context of ActionColumnRenderer');
40
+ return null;
41
+ }
38
42
  const { actionButtons, actionColumn } = adaptable.api.internalApi.getActionButtonsAndActionColumn(props.colDef);
39
43
  if (!actionColumn || !actionButtons.length) {
40
44
  return null;
@@ -78,6 +82,10 @@ export class ActionColumnRenderer {
78
82
  init(params) {
79
83
  var _a, _b, _c;
80
84
  const adaptable = params.context.__adaptable;
85
+ if (!adaptable) {
86
+ console.warn('Adaptable not found in context of ActionColumnRenderer');
87
+ return null;
88
+ }
81
89
  const { actionButtons, actionColumn } = adaptable.api.internalApi.getActionButtonsAndActionColumn(params.colDef);
82
90
  if (!actionColumn || !actionButtons.length) {
83
91
  return;
@@ -992,12 +992,20 @@ export class AdaptableAgGrid {
992
992
  * Either initializes the AG Grid instance or delegates it to the framework wrappers (React/Anglar)
993
993
  */
994
994
  async initializeAgGrid(gridOptions, modules, renderAgGridFrameworkComponent) {
995
+ var _a, _b, _c;
995
996
  if (renderAgGridFrameworkComponent) {
996
997
  const result = await renderAgGridFrameworkComponent(gridOptions);
997
998
  if (result === false) {
998
999
  return false;
999
1000
  }
1000
1001
  const agGridApi = result;
1002
+ // framework wrapper may have altered the context value via props
1003
+ // in that case, we have to re-populate it with the Adaptable context values
1004
+ const agGridContext = agGridApi.getGridOption('context');
1005
+ if (!agGridContext.__adaptable) {
1006
+ agGridContext.__adaptable = this;
1007
+ agGridContext.adaptableApi = this.api;
1008
+ }
1001
1009
  // framework wrapper may pass the rowData as a prop
1002
1010
  const rowData = agGridApi.getGridOption('rowData');
1003
1011
  this.initWithLazyData = rowData == undefined || rowData.length === 0;
@@ -1007,7 +1015,7 @@ export class AdaptableAgGrid {
1007
1015
  if (!this.getAgGridContainerElement()) {
1008
1016
  // initialize the agGridContainerElement from the AgGrid instance
1009
1017
  // @ts-ignore
1010
- const gridRoot = agGridApi.ctrlsService.gridBodyCtrl.eGridBody;
1018
+ const gridRoot = (_c = (_b = (_a = agGridApi.ctrlsService) === null || _a === void 0 ? void 0 : _a.getGridBodyCtrl) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c.eGridBody;
1011
1019
  const gridContainer = gridRoot === null || gridRoot === void 0 ? void 0 : gridRoot.closest('[class*="ag-theme"]');
1012
1020
  if (!gridContainer) {
1013
1021
  this.logger.consoleError(`No AG Grid container could be derived from the Adaptable framework wrapper.