@adaptabletools/adaptable 18.0.0-canary.8 → 18.0.0-canary.9
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/base.css.map +1 -1
- package/index.css.map +1 -1
- package/package.json +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +8 -1
- package/src/AdaptableOptions/AdaptableOptions.d.ts +1 -1
- package/src/Api/ConfigApi.d.ts +1 -1
- package/src/Api/GridApi.d.ts +4 -0
- package/src/Api/Implementation/CommentsApiImpl.d.ts +4 -0
- package/src/Api/Implementation/CommentsApiImpl.js +5 -0
- package/src/Api/Implementation/ConfigApiImpl.js +6 -3
- package/src/Api/Implementation/GridApiImpl.d.ts +1 -0
- package/src/Api/Implementation/GridApiImpl.js +13 -0
- package/src/Api/Implementation/LayoutApiImpl.d.ts +2 -4
- package/src/Api/Implementation/LayoutApiImpl.js +15 -14
- package/src/Api/Implementation/NotesApiImpl.d.ts +4 -0
- package/src/Api/Implementation/NotesApiImpl.js +5 -0
- package/src/Api/Implementation/ScopeApiImpl.d.ts +2 -0
- package/src/Api/Implementation/ScopeApiImpl.js +20 -7
- package/src/Api/Internal/CalculatedColumnInternalApi.js +1 -1
- package/src/Api/Internal/CommentsInternalApi.d.ts +4 -0
- package/src/Api/Internal/CommentsInternalApi.js +13 -0
- package/src/Api/Internal/FormatColumnInternalApi.js +3 -2
- package/src/Api/Internal/FreeTextColumnInternalApi.js +1 -1
- package/src/Api/Internal/NotesInternalApi.d.ts +4 -0
- package/src/Api/Internal/NotesInternalApi.js +13 -0
- package/src/Api/LayoutApi.d.ts +11 -8
- package/src/Api/ScopeApi.d.ts +10 -0
- package/src/PredefinedConfig/Common/AdaptableColumn.d.ts +4 -0
- package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
- package/src/PredefinedConfig/Common/AdaptableScope.d.ts +4 -1
- package/src/PredefinedConfig/Common/RowSummary.d.ts +7 -0
- package/src/PredefinedConfig/Common/RowSummary.js +1 -0
- package/src/PredefinedConfig/LayoutState.d.ts +5 -0
- package/src/PredefinedConfig/SystemState.d.ts +7 -0
- package/src/Redux/ActionsReducers/LayoutRedux.d.ts +9 -0
- package/src/Redux/ActionsReducers/LayoutRedux.js +20 -0
- package/src/Redux/ActionsReducers/SystemRedux.d.ts +5 -0
- package/src/Redux/ActionsReducers/SystemRedux.js +13 -1
- package/src/Redux/Store/AdaptableStore.js +11 -0
- package/src/Redux/Store/Interface/IAdaptableStore.d.ts +2 -2
- package/src/Strategy/CellSummaryModule.d.ts +1 -0
- package/src/Strategy/CellSummaryModule.js +50 -21
- package/src/Strategy/CommentsModule.js +3 -0
- package/src/Strategy/LayoutModule.d.ts +7 -0
- package/src/Strategy/LayoutModule.js +102 -3
- package/src/Strategy/NotesModule.js +3 -4
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +2 -1
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +294 -0
- package/src/Utilities/ExpressionFunctions/scalarAggregationHelper.js +1 -1
- package/src/Utilities/Extensions/ArrayExtensions.d.ts +2 -0
- package/src/Utilities/Extensions/ArrayExtensions.js +4 -0
- package/src/Utilities/ObjectFactory.js +6 -6
- package/src/Utilities/Services/AggregatedScalarLiveValue.d.ts +3 -2
- package/src/Utilities/Services/AggregatedScalarLiveValue.js +11 -8
- package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +1 -1
- package/src/Utilities/Services/LicenseService/index.js +4 -1
- package/src/Utilities/Services/QueryLanguageService.d.ts +1 -1
- package/src/Utilities/Services/QueryLanguageService.js +2 -1
- package/src/Utilities/Services/SummaryService.d.ts +19 -0
- package/src/Utilities/Services/SummaryService.js +29 -0
- package/src/View/Components/AdaptableDateInput/index.d.ts +1 -1
- package/src/View/Components/NewScopeComponent.js +32 -1
- package/src/View/Layout/TransposedPopup.js +7 -6
- package/src/agGrid/AdaptableAgGrid.d.ts +15 -1
- package/src/agGrid/AdaptableAgGrid.js +131 -23
- package/src/agGrid/AgGridAdapter.d.ts +1 -0
- package/src/agGrid/AgGridAdapter.js +8 -0
- package/src/agGrid/AgGridColumnAdapter.js +14 -3
- package/src/components/ColorPicker/ColorPicker.d.ts +1 -1
- package/src/components/Datepicker/index.d.ts +1 -1
- package/src/components/Input/index.d.ts +1 -1
- package/src/components/List/ListGroupItem/index.d.ts +1 -1
- package/src/components/icons/index.js +2 -0
- package/src/components/icons/rows.d.ts +3 -0
- package/src/components/icons/rows.js +4 -0
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.d.ts +8 -0
- package/src/metamodel/adaptable.metamodel.js +18 -0
- package/src/parser/src/types.d.ts +5 -0
- package/tsconfig.esm.tsbuildinfo +1 -1
- package/src/View/Components/ScopeComponent.d.ts +0 -24
- package/src/View/Components/ScopeComponent.js +0 -133
- package/src/View/Export/Wizard/ReportScopeWizard.d.ts +0 -17
- package/src/View/Export/Wizard/ReportScopeWizard.js +0 -47
|
@@ -310,6 +310,16 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
|
|
|
310
310
|
const ret = next(action);
|
|
311
311
|
return ret;
|
|
312
312
|
}
|
|
313
|
+
/*******************
|
|
314
|
+
* System Row Summary ACTIONS
|
|
315
|
+
*******************/
|
|
316
|
+
case SystemRedux.SYSTEM_SUMMARY_ROW_SET: {
|
|
317
|
+
let nextAction = next(action);
|
|
318
|
+
setTimeout(() => {
|
|
319
|
+
adaptable.setupRowSummaries();
|
|
320
|
+
}, 0);
|
|
321
|
+
return nextAction;
|
|
322
|
+
}
|
|
313
323
|
/*******************
|
|
314
324
|
* FLASHING CELL ACTIONS
|
|
315
325
|
*******************/
|
|
@@ -1045,6 +1055,7 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
|
|
|
1045
1055
|
adaptable.setLayout(savingLayout);
|
|
1046
1056
|
}
|
|
1047
1057
|
}
|
|
1058
|
+
adaptable.refreshQuickFilter();
|
|
1048
1059
|
return returnAction;
|
|
1049
1060
|
}
|
|
1050
1061
|
/*******************
|
|
@@ -10,8 +10,8 @@ export interface LoadStoreConfig {
|
|
|
10
10
|
}
|
|
11
11
|
export interface IAdaptableStore {
|
|
12
12
|
TheStore: Redux.Store<AdaptableState>;
|
|
13
|
-
Load:
|
|
14
|
-
loadStore: (config: LoadStoreConfig) =>
|
|
13
|
+
Load: Promise<any>;
|
|
14
|
+
loadStore: (config: LoadStoreConfig) => Promise<any>;
|
|
15
15
|
getCurrentStorageState: () => AdaptableState | void;
|
|
16
16
|
saveStateNow: (adaptable: IAdaptable) => Promise<any>;
|
|
17
17
|
on: (eventName: string, callback: (data?: any) => any) => () => void;
|
|
@@ -8,6 +8,7 @@ import { AccessLevel } from '../PredefinedConfig/Common/Entitlement';
|
|
|
8
8
|
import { CellSummmary } from '../PredefinedConfig/Common/CellSummary';
|
|
9
9
|
import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
|
|
10
10
|
export declare class CellSummaryModule extends AdaptableModuleBase implements ICellSummaryModule {
|
|
11
|
+
cachedCellSummary: WeakMap<SelectedCellInfo<any>, CellSummmary>;
|
|
11
12
|
constructor(api: AdaptableApi);
|
|
12
13
|
getViewAccessLevel(): AccessLevel;
|
|
13
14
|
addColumnMenuItems(column: AdaptableColumn): AdaptableMenuItem[] | undefined;
|
|
@@ -6,6 +6,7 @@ import { CellSummaryStatusPanel } from '../View/CellSummary/CellSummaryStatusPan
|
|
|
6
6
|
export class CellSummaryModule extends AdaptableModuleBase {
|
|
7
7
|
constructor(api) {
|
|
8
8
|
super(ModuleConstants.CellSummaryModuleId, ModuleConstants.CellSummaryFriendlyName, 'cells', 'CellSummaryPopup', 'See summary information on a group of cells using multiple summary operations', api);
|
|
9
|
+
this.cachedCellSummary = new WeakMap();
|
|
9
10
|
}
|
|
10
11
|
getViewAccessLevel() {
|
|
11
12
|
return 'Full';
|
|
@@ -42,6 +43,9 @@ export class CellSummaryModule extends AdaptableModuleBase {
|
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
createCellSummary(selectedCellInfo) {
|
|
46
|
+
if (this.cachedCellSummary.has(selectedCellInfo)) {
|
|
47
|
+
return this.cachedCellSummary.get(selectedCellInfo);
|
|
48
|
+
}
|
|
45
49
|
let selectedCellSummary;
|
|
46
50
|
if (selectedCellInfo && ArrayExtensions.IsNotNullOrEmpty(selectedCellInfo.columns)) {
|
|
47
51
|
let numericValues = [];
|
|
@@ -70,28 +74,52 @@ export class CellSummaryModule extends AdaptableModuleBase {
|
|
|
70
74
|
// copying so that we keep the order - needed for others
|
|
71
75
|
const newNumericValues = [...numericValues];
|
|
72
76
|
let hasNumericColumns = numericValues.length > 0;
|
|
73
|
-
|
|
77
|
+
if (selectedCellInfo.columns.length > 1) {
|
|
78
|
+
return {
|
|
79
|
+
Sum: null,
|
|
80
|
+
Average: null,
|
|
81
|
+
Median: null,
|
|
82
|
+
Mode: null,
|
|
83
|
+
Distinct: null,
|
|
84
|
+
Max: null,
|
|
85
|
+
Min: null,
|
|
86
|
+
Count: null,
|
|
87
|
+
Std_Deviation: null,
|
|
88
|
+
Only: '',
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const handleExpression = (functionName) => {
|
|
92
|
+
const columnId = selectedCellInfo.columns[0].columnId;
|
|
93
|
+
const rowNodes = selectedCellInfo.gridCells.map((gc) => gc.rowNode);
|
|
94
|
+
return this.api.internalApi.getAdaptableInstance().SummaryService.evaluateExpressionValue({
|
|
95
|
+
expression: {
|
|
96
|
+
function: functionName,
|
|
97
|
+
},
|
|
98
|
+
columnId: columnId,
|
|
99
|
+
getRowNodes: () => rowNodes,
|
|
100
|
+
}, ModuleConstants.CellSummaryModuleId);
|
|
101
|
+
};
|
|
102
|
+
const sumValue = hasNumericColumns ? handleExpression('SUM') : null;
|
|
103
|
+
const avgValue = hasNumericColumns ? Helper.roundNumber(handleExpression('AVG'), 2) : null;
|
|
104
|
+
const modeValue = hasNumericColumns ? handleExpression('MODE') : null;
|
|
105
|
+
const medianValue = hasNumericColumns ? handleExpression('MEDIAN') : null;
|
|
106
|
+
const distinctValue = handleExpression('DISTINCT');
|
|
107
|
+
const maxValue = hasNumericColumns ? handleExpression('MAX') : null;
|
|
108
|
+
const minValue = hasNumericColumns ? handleExpression('MIN') : null;
|
|
109
|
+
const stdDeviation = hasNumericColumns
|
|
110
|
+
? Helper.roundNumberTo4dp(handleExpression('STD_DEVIATION'))
|
|
111
|
+
: null;
|
|
74
112
|
selectedCellSummary = {
|
|
75
|
-
Sum:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
? Helper.roundNumberTo4dp(Helper.medianNumberArray(numericValues))
|
|
83
|
-
: undefined,
|
|
84
|
-
Mode: hasNumericColumns
|
|
85
|
-
? Helper.roundNumberTo4dp(Helper.modeNumberArray(numericValues))
|
|
86
|
-
: undefined,
|
|
87
|
-
Distinct: distinctCount,
|
|
88
|
-
Max: hasNumericColumns ? Helper.roundNumberTo4dp(Math.max(...numericValues)) : undefined,
|
|
89
|
-
Min: hasNumericColumns ? Helper.roundNumberTo4dp(Math.min(...numericValues)) : undefined,
|
|
113
|
+
Sum: sumValue,
|
|
114
|
+
Average: avgValue,
|
|
115
|
+
Median: medianValue,
|
|
116
|
+
Mode: modeValue,
|
|
117
|
+
Distinct: distinctValue,
|
|
118
|
+
Max: maxValue,
|
|
119
|
+
Min: minValue,
|
|
90
120
|
Count: allValues.length,
|
|
91
|
-
Std_Deviation:
|
|
92
|
-
|
|
93
|
-
: undefined,
|
|
94
|
-
Only: distinctCount == 1 ? JSON.stringify(allValues[0]) : '',
|
|
121
|
+
Std_Deviation: stdDeviation,
|
|
122
|
+
Only: distinctValue == 1 ? JSON.stringify(allValues[0]) : '',
|
|
95
123
|
};
|
|
96
124
|
numericValues = [...newNumericValues];
|
|
97
125
|
const operationDefinitions = this.api.cellSummaryApi.getCellSummaryOperationDefinitions();
|
|
@@ -100,7 +128,7 @@ export class CellSummaryModule extends AdaptableModuleBase {
|
|
|
100
128
|
if (operation.operationFunction) {
|
|
101
129
|
const cellSummaryOperationContext = {
|
|
102
130
|
selectedCellInfo,
|
|
103
|
-
distinctCount,
|
|
131
|
+
distinctCount: distinctValue,
|
|
104
132
|
allValues,
|
|
105
133
|
numericValues,
|
|
106
134
|
numericColumns,
|
|
@@ -112,6 +140,7 @@ export class CellSummaryModule extends AdaptableModuleBase {
|
|
|
112
140
|
}
|
|
113
141
|
});
|
|
114
142
|
}
|
|
143
|
+
this.cachedCellSummary.set(selectedCellInfo, selectedCellSummary);
|
|
115
144
|
return selectedCellSummary;
|
|
116
145
|
}
|
|
117
146
|
getViewProperties() {
|
|
@@ -55,6 +55,9 @@ export class CommentsModule extends AdaptableModuleBase {
|
|
|
55
55
|
ColumnId: menuContext.adaptableColumn.columnId,
|
|
56
56
|
};
|
|
57
57
|
const comments = this.adaptable.api.commentApi.getComments(cellAddress);
|
|
58
|
+
if (!this.api.commentApi.internalApi.areCommentsAvailable()) {
|
|
59
|
+
return items;
|
|
60
|
+
}
|
|
58
61
|
if (comments) {
|
|
59
62
|
items.push(this.createColumnMenuItemClickFunction('Remove Comments', this.moduleInfo.Glyph, () => {
|
|
60
63
|
this.api.commentApi.deleteCommentThread(cellAddress);
|
|
@@ -7,7 +7,9 @@ import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
|
|
|
7
7
|
import { AdaptableApi } from '../Api/AdaptableApi';
|
|
8
8
|
import { AdaptableModuleView, IModule, TeamSharingReferences } from './Interface/IModule';
|
|
9
9
|
import { AdaptableObject } from '../PredefinedConfig/Common/AdaptableObject';
|
|
10
|
+
import { AggregatedScalarLiveValue } from '../Utilities/Services/AggregatedScalarLiveValue';
|
|
10
11
|
export declare class LayoutModule extends AdaptableModuleBase implements IModule {
|
|
12
|
+
cachedCellSummary: Map<string, AggregatedScalarLiveValue>;
|
|
11
13
|
protected LayoutState: LayoutState;
|
|
12
14
|
constructor(api: AdaptableApi);
|
|
13
15
|
onAdaptableReady(): void;
|
|
@@ -42,4 +44,9 @@ export declare class LayoutModule extends AdaptableModuleBase implements IModule
|
|
|
42
44
|
getViewProperties(): AdaptableModuleView;
|
|
43
45
|
handleLayoutChange(): void;
|
|
44
46
|
getReferencedNamedQueryNames(layout: Layout): string[];
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* @param colId optional to evaluate only one column
|
|
50
|
+
*/
|
|
51
|
+
private evaluateRowSummary;
|
|
45
52
|
}
|
|
@@ -15,9 +15,13 @@ import { SHOW_PIVOT_COLUMN_DETAILS } from '../View/Components/Popups/WindowPopup
|
|
|
15
15
|
import flattenDeep from 'lodash/flattenDeep';
|
|
16
16
|
import StringExtensions from '../Utilities/Extensions/StringExtensions';
|
|
17
17
|
import { getGridFilterViewItems } from '../View/Layout/Wizard/getGridFilterPreview';
|
|
18
|
+
import { SystemRowSummartSet } from '../Redux/ActionsReducers/SystemRedux';
|
|
19
|
+
import { ROW_SUMMARY_ROW_ID } from '../PredefinedConfig/Common/RowSummary';
|
|
20
|
+
import Helper from '../Utilities/Helpers/Helper';
|
|
18
21
|
export class LayoutModule extends AdaptableModuleBase {
|
|
19
22
|
constructor(api) {
|
|
20
23
|
super(ModuleConstants.LayoutModuleId, ModuleConstants.LayoutFriendlyName, 'grid', 'LayoutPopup', 'Named sets of column visibility, order, groupings, aggregation, pivots etc.', api);
|
|
24
|
+
this.cachedCellSummary = new Map();
|
|
21
25
|
}
|
|
22
26
|
onAdaptableReady() {
|
|
23
27
|
this.api.eventApi.on('LayoutChanged', (layoutChangedInfo) => {
|
|
@@ -31,6 +35,26 @@ export class LayoutModule extends AdaptableModuleBase {
|
|
|
31
35
|
requestAnimationFrame(() => {
|
|
32
36
|
this.api.layoutApi.internalApi.fireLayoutChangedEvent('ADAPTABLE_READY', null, this.api.layoutApi.getLayoutState());
|
|
33
37
|
});
|
|
38
|
+
this.evaluateRowSummary();
|
|
39
|
+
this.api.eventApi.on('AdaptableStateReloaded', () => {
|
|
40
|
+
this.evaluateRowSummary();
|
|
41
|
+
});
|
|
42
|
+
this.api.eventApi.on('GridDataChanged', (event) => {
|
|
43
|
+
this.evaluateRowSummary();
|
|
44
|
+
});
|
|
45
|
+
this.api.eventApi.on('CellChanged', (event) => {
|
|
46
|
+
const columnId = event.cellChange.column.columnId;
|
|
47
|
+
this.evaluateRowSummary({
|
|
48
|
+
columnId,
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
this.api.eventApi.on('LayoutChanged', (event) => {
|
|
52
|
+
this.evaluateRowSummary();
|
|
53
|
+
});
|
|
54
|
+
const adaptable = this.api.internalApi.getAdaptableInstance();
|
|
55
|
+
adaptable._on('FirstDataRendered', () => {
|
|
56
|
+
this.evaluateRowSummary();
|
|
57
|
+
});
|
|
34
58
|
}
|
|
35
59
|
getModuleAdaptableObjects() {
|
|
36
60
|
return this.api.layoutApi.getLayouts();
|
|
@@ -195,7 +219,7 @@ export class LayoutModule extends AdaptableModuleBase {
|
|
|
195
219
|
}
|
|
196
220
|
createViewPivotItemsMenuItem(menuContext) {
|
|
197
221
|
// current group => menuContext.rowNode.field;
|
|
198
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
222
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
199
223
|
const selectedCellInfo = (_a = menuContext.selectedCellInfo) !== null && _a !== void 0 ? _a : this.api.gridApi.getSelectedCellInfo();
|
|
200
224
|
if (((_b = selectedCellInfo === null || selectedCellInfo === void 0 ? void 0 : selectedCellInfo.gridCells) === null || _b === void 0 ? void 0 : _b.length) !== 1) {
|
|
201
225
|
return;
|
|
@@ -236,7 +260,9 @@ export class LayoutModule extends AdaptableModuleBase {
|
|
|
236
260
|
}
|
|
237
261
|
const data = flattenDeep(getData(menuContext.rowNode.childrenAfterFilter));
|
|
238
262
|
const rowGroups = currentLayout.RowGroupedColumns;
|
|
239
|
-
const cellValue = isPivotColumn
|
|
263
|
+
const cellValue = isPivotColumn
|
|
264
|
+
? (_o = (_m = menuContext.rowNode) === null || _m === void 0 ? void 0 : _m.aggData) === null || _o === void 0 ? void 0 : _o[columnId]
|
|
265
|
+
: gridCell.displayValue;
|
|
240
266
|
const popupProps = {
|
|
241
267
|
hasPivotValue: isPivotColumn,
|
|
242
268
|
columnId,
|
|
@@ -277,7 +303,7 @@ export class LayoutModule extends AdaptableModuleBase {
|
|
|
277
303
|
return this.getModuleAdaptableObjects().map((layout) => this.toView(layout));
|
|
278
304
|
}
|
|
279
305
|
toView(layout) {
|
|
280
|
-
var _a, _b, _c, _d, _e, _f;
|
|
306
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
281
307
|
const maxColumnsToDisplay = (_b = (_a = this.api.optionsApi.getLayoutOptions().layoutViewOptions) === null || _a === void 0 ? void 0 : _a.maxColumnsToDisplay) !== null && _b !== void 0 ? _b : 10;
|
|
282
308
|
const columnIdToFriendlyName = (columnId) => {
|
|
283
309
|
return this.api.columnApi.getFriendlyNameForColumnId(columnId);
|
|
@@ -346,6 +372,22 @@ export class LayoutModule extends AdaptableModuleBase {
|
|
|
346
372
|
(layout === null || layout === void 0 ? void 0 : layout.GridFilter) &&
|
|
347
373
|
StringExtensions.IsNotNullOrEmpty(layout.GridFilter.Expression) &&
|
|
348
374
|
getGridFilterViewItems(layout),
|
|
375
|
+
((_g = layout === null || layout === void 0 ? void 0 : layout.RowSummaries) === null || _g === void 0 ? void 0 : _g.length) && {
|
|
376
|
+
name: 'Row Summaries',
|
|
377
|
+
values: layout === null || layout === void 0 ? void 0 : layout.RowSummaries.map((rowSummary) => {
|
|
378
|
+
var _a;
|
|
379
|
+
const columns = Object.entries((_a = rowSummary.ColumnsMap) !== null && _a !== void 0 ? _a : {})
|
|
380
|
+
.map(([columnId, expression]) => {
|
|
381
|
+
if (columnId === 'Source' || columnId === 'Uuid') {
|
|
382
|
+
return '';
|
|
383
|
+
}
|
|
384
|
+
return `${expression}(${columnIdToFriendlyName(columnId)})`;
|
|
385
|
+
})
|
|
386
|
+
.filter(Boolean)
|
|
387
|
+
.join(', ');
|
|
388
|
+
return `${rowSummary.Position}: ${columns}`;
|
|
389
|
+
}),
|
|
390
|
+
},
|
|
349
391
|
].filter(Boolean),
|
|
350
392
|
abObject: layout,
|
|
351
393
|
};
|
|
@@ -400,4 +442,61 @@ export class LayoutModule extends AdaptableModuleBase {
|
|
|
400
442
|
}
|
|
401
443
|
return this.api.namedQueryApi.internalApi.getReferencedNamedQueryNames(layout.GridFilter.Expression);
|
|
402
444
|
}
|
|
445
|
+
/**
|
|
446
|
+
*
|
|
447
|
+
* @param colId optional to evaluate only one column
|
|
448
|
+
*/
|
|
449
|
+
evaluateRowSummary(reason) {
|
|
450
|
+
var _a;
|
|
451
|
+
const rowSummaries = (_a = this.api.layoutApi.getCurrentLayout().RowSummaries) !== null && _a !== void 0 ? _a : [];
|
|
452
|
+
const rowSummariesResults = rowSummaries.map(({ ColumnsMap, Position }) => {
|
|
453
|
+
return {
|
|
454
|
+
Position,
|
|
455
|
+
RowData: Object.entries(ColumnsMap !== null && ColumnsMap !== void 0 ? ColumnsMap : {}).reduce((acc, [columnId, expression]) => {
|
|
456
|
+
const key = `${columnId}-${expression}`;
|
|
457
|
+
let expressionLiveValue = this.cachedCellSummary.get(key);
|
|
458
|
+
if (expressionLiveValue) {
|
|
459
|
+
if (!reason) {
|
|
460
|
+
// refresh all of them
|
|
461
|
+
expressionLiveValue.refresh();
|
|
462
|
+
}
|
|
463
|
+
else if ('columnId' in reason && reason.columnId === columnId) {
|
|
464
|
+
expressionLiveValue.refresh();
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
if (!expressionLiveValue) {
|
|
468
|
+
try {
|
|
469
|
+
expressionLiveValue = this.api.internalApi
|
|
470
|
+
.getAdaptableInstance()
|
|
471
|
+
.SummaryService.evaluateScalarLiveValue({
|
|
472
|
+
expression: {
|
|
473
|
+
function: expression,
|
|
474
|
+
},
|
|
475
|
+
columnId: columnId,
|
|
476
|
+
getRowNodes: () => {
|
|
477
|
+
return this.api.gridApi.getVisibleRowNodes();
|
|
478
|
+
},
|
|
479
|
+
}, ModuleConstants.LayoutModuleId);
|
|
480
|
+
}
|
|
481
|
+
catch (e) {
|
|
482
|
+
this.api.logError('Error evaluating row summary', e);
|
|
483
|
+
}
|
|
484
|
+
this.cachedCellSummary.set(key, expressionLiveValue);
|
|
485
|
+
}
|
|
486
|
+
let value = null;
|
|
487
|
+
if (expressionLiveValue) {
|
|
488
|
+
value = expressionLiveValue.getGlobalAggregatedValue();
|
|
489
|
+
if (typeof value === 'number' && !isNaN(value)) {
|
|
490
|
+
value = Helper.roundNumber(value, 2);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
acc[columnId] = value;
|
|
494
|
+
return acc;
|
|
495
|
+
}, {
|
|
496
|
+
[ROW_SUMMARY_ROW_ID]: true,
|
|
497
|
+
}),
|
|
498
|
+
};
|
|
499
|
+
});
|
|
500
|
+
this.api.internalApi.dispatchReduxAction(SystemRowSummartSet(rowSummariesResults));
|
|
501
|
+
}
|
|
403
502
|
}
|
|
@@ -5,10 +5,6 @@ export class NotesModule extends AdaptableModuleBase {
|
|
|
5
5
|
super(ModuleConstants.NotesModuleId, ModuleConstants.NotesFriendlyName, 'note', 'NotesPopup', 'Notes', api);
|
|
6
6
|
this.adaptable = api.internalApi.getAdaptableInstance();
|
|
7
7
|
}
|
|
8
|
-
// isModuleAvailable(): boolean {
|
|
9
|
-
// // FIXME remove this once Notes feature is public
|
|
10
|
-
// return true;
|
|
11
|
-
// }
|
|
12
8
|
addContextMenuItems(menuContext) {
|
|
13
9
|
var _a, _b;
|
|
14
10
|
if (!this.isModuleAvailable()) {
|
|
@@ -32,6 +28,9 @@ export class NotesModule extends AdaptableModuleBase {
|
|
|
32
28
|
getAddRemoveNoteMenuItems(menuContext) {
|
|
33
29
|
var _a;
|
|
34
30
|
const items = [];
|
|
31
|
+
if (!this.api.notesApi.internalApi.areNotesAvailable()) {
|
|
32
|
+
return items;
|
|
33
|
+
}
|
|
35
34
|
// does not have note
|
|
36
35
|
const [note] = (_a = this.adaptable.api.notesApi.getCellNotes({
|
|
37
36
|
PrimaryKeyValue: menuContext.primaryKeyValue,
|
|
@@ -6,7 +6,7 @@ import { AggregateParams } from './scalarAggregationHelper';
|
|
|
6
6
|
* List of all the AggregatedScalar Functions available in AdaptableQL
|
|
7
7
|
*/
|
|
8
8
|
export type AggregatedScalarFunctionName = ScalarAggregationFunction | OperandFunction;
|
|
9
|
-
export type ScalarAggregationFunction = 'SUM' | 'PERCENTAGE' | 'QUANT' | 'QUARTILE' | 'PERCENTILE' | 'AVG' | 'MIN' | 'MAX' | 'COUNT' | 'CUMUL';
|
|
9
|
+
export type ScalarAggregationFunction = 'SUM' | 'PERCENTAGE' | 'QUANT' | 'QUARTILE' | 'PERCENTILE' | 'AVG' | 'MIN' | 'MAX' | 'COUNT' | 'CUMUL' | 'MEDIAN' | 'MODE' | 'DISTINCT' | 'ONLY' | 'STD_DEVIATION';
|
|
10
10
|
type OperandFunction = 'COL' | 'OVER' | 'GROUP_BY' | 'WEIGHT';
|
|
11
11
|
export interface ScalarAggregationParameter extends BaseParameter<'aggregationScalar', ScalarAggregationFunction> {
|
|
12
12
|
value: AggregatedScalarExpressionEvaluation;
|
|
@@ -28,6 +28,7 @@ export interface AggregatedScalarExpressionEvaluation {
|
|
|
28
28
|
};
|
|
29
29
|
sortByColumn?: string;
|
|
30
30
|
rowFilterFn?: (rowNode: IRowNode) => boolean;
|
|
31
|
+
getRowNodes?: () => IRowNode[];
|
|
31
32
|
}
|
|
32
33
|
export interface CumulatedAggregationValue {
|
|
33
34
|
currentValue: number;
|