@adaptabletools/adaptable-cjs 18.0.0-canary.27 → 18.0.0-canary.29
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 +3 -13
- package/base.css.map +1 -1
- package/index.css +3 -13
- package/index.css.map +1 -1
- package/package.json +1 -1
- package/src/AdaptableOptions/AdaptableFrameworkComponent.d.ts +3 -0
- package/src/AdaptableOptions/MenuOptions.d.ts +3 -3
- package/src/Api/GridApi.d.ts +4 -1
- package/src/Api/Implementation/ColumnApiImpl.js +6 -6
- package/src/Api/Implementation/ConfigApiImpl.js +0 -1
- package/src/Api/Implementation/ExpressionApiImpl.js +12 -12
- package/src/Api/Implementation/GridApiImpl.d.ts +1 -1
- package/src/Api/Implementation/GridApiImpl.js +8 -3
- package/src/Api/Implementation/ScopeApiImpl.js +4 -4
- package/src/Api/Implementation/UserInterfaceApiImpl.d.ts +14 -5
- package/src/Api/Implementation/UserInterfaceApiImpl.js +26 -4
- package/src/Api/Internal/AdaptableInternalApi.d.ts +0 -1
- package/src/Api/Internal/AdaptableInternalApi.js +2 -6
- package/src/Api/Internal/ColumnFilterInternalApi.js +2 -2
- package/src/Api/Internal/DashboardInternalApi.js +2 -2
- package/src/Api/Internal/FormatColumnInternalApi.js +11 -5
- package/src/Api/Internal/GridFilterInternalApi.d.ts +2 -2
- package/src/Api/Internal/GridFilterInternalApi.js +2 -2
- package/src/Api/Internal/LayoutInternalApi.js +1 -1
- package/src/Api/UserInterfaceApi.d.ts +15 -2
- package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
- package/src/PredefinedConfig/Common/Fdc3Intent.d.ts +2 -2
- package/src/PredefinedConfig/Common/Menu.d.ts +4 -4
- package/src/PredefinedConfig/Common/Menu.js +30 -17
- package/src/PredefinedConfig/Common/TransposeConfig.d.ts +3 -3
- package/src/PredefinedConfig/FormatColumnState.d.ts +4 -0
- package/src/PredefinedConfig/PopupState.d.ts +1 -2
- package/src/PredefinedConfig/StyledColumnState.d.ts +5 -0
- package/src/PredefinedConfig/SystemState.d.ts +4 -2
- package/src/Redux/ActionsReducers/PopupRedux.d.ts +5 -13
- package/src/Redux/ActionsReducers/PopupRedux.js +1 -22
- package/src/Redux/ActionsReducers/SystemRedux.d.ts +9 -3
- package/src/Redux/ActionsReducers/SystemRedux.js +8 -5
- package/src/Strategy/ColumnFilterModule.js +1 -1
- package/src/Strategy/ColumnInfoModule.js +2 -2
- package/src/Strategy/ExportModule.d.ts +0 -1
- package/src/Strategy/ExportModule.js +37 -26
- package/src/Strategy/GridInfoModule.js +1 -1
- package/src/Strategy/LayoutModule.d.ts +1 -8
- package/src/Strategy/LayoutModule.js +11 -121
- package/src/Strategy/StyledColumnModule.js +14 -10
- package/src/Strategy/Utilities/FormatColumn/getFormatColumnSettingsViewItems.js +1 -0
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +4 -2
- package/src/Utilities/Interface/MessagePopups.d.ts +0 -3
- package/src/Utilities/Services/RowSummaryService.d.ts +22 -0
- package/src/Utilities/Services/RowSummaryService.js +146 -0
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.d.ts +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +11 -2
- package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +1 -1
- package/src/View/StyledColumn/Wizard/StyledColumnWizardSettingsSection.js +14 -10
- package/src/agGrid/AdaptableAgGrid.js +2 -1
- package/src/agGrid/AgGridColumnAdapter.js +19 -13
- package/src/agGrid/AgGridMenuAdapter.d.ts +6 -0
- package/src/agGrid/AgGridMenuAdapter.js +240 -106
- package/src/agGrid/BadgeRenderer.js +7 -1
- package/src/agGrid/PercentBarRenderer.js +3 -1
- package/src/components/ProgressIndicator/ProgressIndicator.js +15 -6
- package/src/components/icons/copy.d.ts +3 -0
- package/src/components/icons/copy.js +7 -0
- package/src/components/icons/filter-off.d.ts +3 -0
- package/src/components/icons/filter-off.js +7 -0
- package/src/components/icons/grid-info.d.ts +3 -0
- package/src/components/icons/grid-info.js +7 -0
- package/src/components/icons/index.js +12 -0
- package/src/components/icons/select-all.d.ts +3 -0
- package/src/components/icons/select-all.js +7 -0
- package/src/components/icons/select-fwd.d.ts +3 -0
- package/src/components/icons/select-fwd.js +7 -0
- package/src/components/icons/select-off.d.ts +3 -0
- package/src/components/icons/select-off.js +7 -0
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/parser/src/parser.js +1218 -55
- package/src/parser/src/predicate/mapQlPredicateToExpression.js +1 -3
- package/src/parser/src/types.js +1 -2
- package/src/types.d.ts +1 -1
- package/tsconfig.cjs.tsbuildinfo +1 -1
|
@@ -19,16 +19,14 @@ const windowFactory_1 = require("../View/Components/Popups/WindowPopups/windowFa
|
|
|
19
19
|
const flattenDeep_1 = tslib_1.__importDefault(require("lodash/flattenDeep"));
|
|
20
20
|
const StringExtensions_1 = tslib_1.__importDefault(require("../Utilities/Extensions/StringExtensions"));
|
|
21
21
|
const getGridFilterPreview_1 = require("../View/Layout/Wizard/getGridFilterPreview");
|
|
22
|
-
const
|
|
23
|
-
const SystemRedux_1 = require("../Redux/ActionsReducers/SystemRedux");
|
|
24
|
-
const RowSummary_1 = require("../PredefinedConfig/Common/RowSummary");
|
|
25
|
-
const Helper_1 = tslib_1.__importDefault(require("../Utilities/Helpers/Helper"));
|
|
22
|
+
const RowSummaryService_1 = require("../Utilities/Services/RowSummaryService");
|
|
26
23
|
class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
27
24
|
constructor(api) {
|
|
28
25
|
super(ModuleConstants.LayoutModuleId, ModuleConstants.LayoutFriendlyName, 'grid', 'LayoutPopup', 'Named sets of column visibility, order, groupings, aggregation, pivots etc.', api);
|
|
29
|
-
this.
|
|
26
|
+
this.rowSummaryService = new RowSummaryService_1.RowSummaryService(this.api);
|
|
30
27
|
}
|
|
31
28
|
onAdaptableReady() {
|
|
29
|
+
this.rowSummaryService.onAdapterReady();
|
|
32
30
|
this.api.eventApi.on('LayoutChanged', (layoutChangedInfo) => {
|
|
33
31
|
var _a;
|
|
34
32
|
if (layoutChangedInfo.newLayoutState.CurrentLayout !==
|
|
@@ -40,49 +38,6 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
40
38
|
requestAnimationFrame(() => {
|
|
41
39
|
this.api.layoutApi.internalApi.fireLayoutChangedEvent('ADAPTABLE_READY', null, this.api.layoutApi.getLayoutState());
|
|
42
40
|
});
|
|
43
|
-
this.rowSummariesSubscriptions();
|
|
44
|
-
}
|
|
45
|
-
rowSummariesSubscriptions() {
|
|
46
|
-
if (this.api.isDestroyed()) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
// Currently not available for serverside model
|
|
50
|
-
if (!this.api.layoutApi.internalApi.getLayoutSupportedFeatures().RowSummaries) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
// ROW SUMMARY
|
|
54
|
-
this.evaluateRowSummary();
|
|
55
|
-
this.api.eventApi.on('AdaptableStateReloaded', () => {
|
|
56
|
-
this.evaluateRowSummary();
|
|
57
|
-
});
|
|
58
|
-
this.api.eventApi.on('GridDataChanged', (event) => {
|
|
59
|
-
this.evaluateRowSummary();
|
|
60
|
-
});
|
|
61
|
-
this.api.eventApi.on('CellChanged', (event) => {
|
|
62
|
-
const columnId = event.cellChange.column.columnId;
|
|
63
|
-
this.evaluateRowSummary({
|
|
64
|
-
columnId,
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
this.api.eventApi.on('LayoutChanged', (event) => {
|
|
68
|
-
// exclude filter events, those are handled in another event
|
|
69
|
-
if (event.actionName.includes('FILTER')) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
setTimeout(() => {
|
|
73
|
-
// the timeout is added so the grid has time to repond to the layout changed
|
|
74
|
-
this.evaluateRowSummary();
|
|
75
|
-
}, 16);
|
|
76
|
-
});
|
|
77
|
-
const adaptable = this.api.internalApi.getAdaptableInstance();
|
|
78
|
-
adaptable._on('AdapTableFiltersApplied', () => {
|
|
79
|
-
// we need to use this instead of layout changed
|
|
80
|
-
// so the rows have time to update
|
|
81
|
-
this.evaluateRowSummary();
|
|
82
|
-
});
|
|
83
|
-
adaptable._on('FirstDataRendered', () => {
|
|
84
|
-
this.evaluateRowSummary();
|
|
85
|
-
});
|
|
86
41
|
}
|
|
87
42
|
getModuleAdaptableObjects() {
|
|
88
43
|
return this.api.layoutApi.getLayouts();
|
|
@@ -158,7 +113,7 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
158
113
|
let returnColumnMenuItems = [];
|
|
159
114
|
const isReadOnlyLayout = this.api.layoutApi.isCurrentLayoutReadOnly();
|
|
160
115
|
if (!isReadOnlyLayout) {
|
|
161
|
-
returnColumnMenuItems.push(this.createMenuItemShowPopup('layout-edit', 'Edit Layout', this.moduleInfo.Popup,
|
|
116
|
+
returnColumnMenuItems.push(this.createMenuItemShowPopup('layout-edit', 'Edit Layout', this.moduleInfo.Popup, 'edit-table', {
|
|
162
117
|
action: 'Edit',
|
|
163
118
|
source: 'ColumnMenu',
|
|
164
119
|
value: this.api.layoutApi.getCurrentLayout(),
|
|
@@ -175,20 +130,20 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
175
130
|
}
|
|
176
131
|
const hasExistingSelection = (_b = (_a = this.api.gridApi.getSelectedCellInfo()) === null || _a === void 0 ? void 0 : _a.gridCells) === null || _b === void 0 ? void 0 : _b.length;
|
|
177
132
|
if (hasExistingSelection) {
|
|
178
|
-
returnColumnMenuItems.push(this.createMenuItemClickFunction('layout-column-select-preserve', 'Column (Preserve Selection)', '
|
|
133
|
+
returnColumnMenuItems.push(this.createMenuItemClickFunction('layout-column-select-preserve', 'Select Column (Preserve Selection)', 'select-fwd', () => {
|
|
179
134
|
this.api.columnApi.addColumnToSelection(column.columnId);
|
|
180
135
|
}));
|
|
181
|
-
returnColumnMenuItems.push(this.createMenuItemClickFunction('layout-column-select-reset', 'Column (Reset Selection)', '
|
|
136
|
+
returnColumnMenuItems.push(this.createMenuItemClickFunction('layout-column-select-reset', 'Select Column (Reset Selection)', 'tab-unselected', () => {
|
|
182
137
|
this.api.columnApi.selectColumn(column.columnId);
|
|
183
138
|
}));
|
|
184
139
|
}
|
|
185
140
|
else {
|
|
186
|
-
returnColumnMenuItems.push(this.createMenuItemClickFunction('layout-column-select', 'Column', '
|
|
141
|
+
returnColumnMenuItems.push(this.createMenuItemClickFunction('layout-column-select', 'Select Column', 'tab-unselected', () => {
|
|
187
142
|
this.api.columnApi.selectColumn(column.columnId);
|
|
188
143
|
}));
|
|
189
144
|
}
|
|
190
145
|
}
|
|
191
|
-
returnColumnMenuItems.push(this.createMenuItemClickFunction('layout-select
|
|
146
|
+
returnColumnMenuItems.push(this.createMenuItemClickFunction('layout-grid-select', 'Select Grid', 'select-all', () => {
|
|
192
147
|
this.api.gridApi.selectAll();
|
|
193
148
|
}));
|
|
194
149
|
return returnColumnMenuItems;
|
|
@@ -196,7 +151,7 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
196
151
|
createContextMenuItems(menuContext) {
|
|
197
152
|
let returnColumnMenuItems = [];
|
|
198
153
|
if (this.isModuleEditable() && !this.api.layoutApi.isCurrentLayoutReadOnly()) {
|
|
199
|
-
returnColumnMenuItems.push(this.createMenuItemShowPopup('layout-edit', 'Edit Layout', this.moduleInfo.Popup,
|
|
154
|
+
returnColumnMenuItems.push(this.createMenuItemShowPopup('layout-edit', 'Edit Layout', this.moduleInfo.Popup, 'edit-table', {
|
|
200
155
|
action: 'Edit',
|
|
201
156
|
source: 'ColumnMenu',
|
|
202
157
|
}));
|
|
@@ -205,11 +160,11 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
205
160
|
ArrayExtensions_1.default.IsNotNullOrEmpty(menuContext.selectedCellInfo.columns)) ||
|
|
206
161
|
(menuContext.selectedRowInfo &&
|
|
207
162
|
ArrayExtensions_1.default.IsNotNullOrEmpty(menuContext.selectedRowInfo.gridRows))) {
|
|
208
|
-
returnColumnMenuItems.push(this.createMenuItemClickFunction('layout-clear-selection', 'Clear Selected Cells', '
|
|
163
|
+
returnColumnMenuItems.push(this.createMenuItemClickFunction('layout-clear-selection', 'Clear Selected Cells', 'select-off', () => {
|
|
209
164
|
this.api.gridApi.deselectAll();
|
|
210
165
|
}));
|
|
211
166
|
}
|
|
212
|
-
returnColumnMenuItems.push(this.createMenuItemClickFunction('layout-select-all', 'Select', '
|
|
167
|
+
returnColumnMenuItems.push(this.createMenuItemClickFunction('layout-select-all', 'Select Grid', 'select-all', () => {
|
|
213
168
|
this.api.gridApi.selectAll();
|
|
214
169
|
}));
|
|
215
170
|
returnColumnMenuItems.push(this.createMenuItemClickFunction('layout-auto-size', 'Auto Size', 'arrow-expand', () => {
|
|
@@ -448,70 +403,5 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
448
403
|
}
|
|
449
404
|
return this.api.namedQueryApi.internalApi.getReferencedNamedQueryNames(layout.GridFilter.Expression);
|
|
450
405
|
}
|
|
451
|
-
/**
|
|
452
|
-
*
|
|
453
|
-
* @param colId optional to evaluate only one column
|
|
454
|
-
*/
|
|
455
|
-
evaluateRowSummary(reason) {
|
|
456
|
-
var _a;
|
|
457
|
-
if (this.api.isDestroyed()) {
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
const currentLayout = this.api.layoutApi.getCurrentLayout();
|
|
461
|
-
const rowSummaries = (_a = this.api.layoutApi.getCurrentLayout().RowSummaries) !== null && _a !== void 0 ? _a : [];
|
|
462
|
-
const rowSummariesResults = rowSummaries.map(({ ColumnsMap, Position }) => {
|
|
463
|
-
return {
|
|
464
|
-
Position,
|
|
465
|
-
RowData: Object.entries(ColumnsMap !== null && ColumnsMap !== void 0 ? ColumnsMap : {}).reduce((acc, [columnId, expression]) => {
|
|
466
|
-
const key = `${columnId}-${expression}`;
|
|
467
|
-
let expressionLiveValue = this.cachedCellSummary.get(key);
|
|
468
|
-
if (expressionLiveValue) {
|
|
469
|
-
if (!reason) {
|
|
470
|
-
// refresh all of them
|
|
471
|
-
expressionLiveValue.refresh();
|
|
472
|
-
}
|
|
473
|
-
else if ('columnId' in reason && reason.columnId === columnId) {
|
|
474
|
-
expressionLiveValue.refresh();
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
if (!expressionLiveValue) {
|
|
478
|
-
try {
|
|
479
|
-
let aggregatedScalarExpression = `${expression}([${columnId}])`;
|
|
480
|
-
if (aggregatedScalarExpression.includes(RowSummary_1.WEIGHTED_AVERAGE_AGGREATED_FUNCTION) &&
|
|
481
|
-
currentLayout.AggregationColumns[columnId] &&
|
|
482
|
-
typeof currentLayout.AggregationColumns[columnId] === 'object') {
|
|
483
|
-
const weight = currentLayout.AggregationColumns[columnId]
|
|
484
|
-
.weightedColumnId;
|
|
485
|
-
if (weight) {
|
|
486
|
-
aggregatedScalarExpression = `AVG([${columnId}], WEIGHT([${weight}]))`;
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
expressionLiveValue = new AggregatedScalarLiveValue_1.AggregatedScalarLiveValue({
|
|
490
|
-
aggregatedScalarExpression,
|
|
491
|
-
}, ModuleConstants.LayoutModuleId, this.api, () => {
|
|
492
|
-
return this.api.gridApi.getVisibleRowNodes();
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
catch (e) {
|
|
496
|
-
this.api.logError('Error evaluating row summary', e);
|
|
497
|
-
}
|
|
498
|
-
this.cachedCellSummary.set(key, expressionLiveValue);
|
|
499
|
-
}
|
|
500
|
-
let value = null;
|
|
501
|
-
if (expressionLiveValue) {
|
|
502
|
-
value = expressionLiveValue.getGlobalAggregatedValue();
|
|
503
|
-
if (typeof value === 'number' && !isNaN(value)) {
|
|
504
|
-
value = Helper_1.default.roundNumber(value, 2);
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
acc[columnId] = value;
|
|
508
|
-
return acc;
|
|
509
|
-
}, {
|
|
510
|
-
[RowSummary_1.ROW_SUMMARY_ROW_ID]: true,
|
|
511
|
-
}),
|
|
512
|
-
};
|
|
513
|
-
});
|
|
514
|
-
this.api.internalApi.dispatchReduxAction((0, SystemRedux_1.SystemRowSummarySet)(rowSummariesResults));
|
|
515
|
-
}
|
|
516
406
|
}
|
|
517
407
|
exports.LayoutModule = LayoutModule;
|
|
@@ -84,7 +84,8 @@ class StyledColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
84
84
|
},
|
|
85
85
|
};
|
|
86
86
|
const icon = this.getGlyphForStyledColumn(styledColumn);
|
|
87
|
-
const
|
|
87
|
+
const typeLabel = this.getTypeLabel(styledColumn);
|
|
88
|
+
const label = `Edit ${typeLabel}`;
|
|
88
89
|
const name = this.getTypeName(styledColumn);
|
|
89
90
|
returnColumnMenuItems.push(this.createMenuItemShowPopup(name, label, this.moduleInfo.Popup, icon, popupParam));
|
|
90
91
|
}
|
|
@@ -97,7 +98,7 @@ class StyledColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
97
98
|
value: newStyledColumn,
|
|
98
99
|
config: {},
|
|
99
100
|
};
|
|
100
|
-
const badgeLabel =
|
|
101
|
+
const badgeLabel = 'Create Badge Style';
|
|
101
102
|
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: {
|
|
102
103
|
Badges: [ObjectFactory_1.default.CreateDefaultStyledColumnBadge()],
|
|
103
104
|
} }), config: {
|
|
@@ -110,12 +111,12 @@ class StyledColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
110
111
|
const emptyRanges = this.api.scopeApi.createCellColorRangesForScope({
|
|
111
112
|
ColumnIds: [column.columnId],
|
|
112
113
|
});
|
|
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: {
|
|
114
|
+
const newGrandientButton = this.createMenuItemShowPopup('styled-column-gradient-add', 'Create Gradient Column', this.moduleInfo.Popup, 'gradient', Object.assign(Object.assign({}, popupParam), { value: Object.assign(Object.assign({}, newStyledColumn), { GradientStyle: {
|
|
114
115
|
CellRanges: emptyRanges,
|
|
115
116
|
} }), config: {
|
|
116
117
|
defaultCurrentSectionName: 'Style',
|
|
117
118
|
} }));
|
|
118
|
-
const
|
|
119
|
+
const newPercentBarButton = this.createMenuItemShowPopup('styled-column-percent-bar-add', 'Create Percent Bar', this.moduleInfo.Popup, 'percent', Object.assign(Object.assign({}, popupParam), { value: Object.assign(Object.assign({}, newStyledColumn), { PercentBarStyle: {
|
|
119
120
|
CellRanges: emptyRanges,
|
|
120
121
|
} }), config: {
|
|
121
122
|
defaultCurrentSectionName: 'Style',
|
|
@@ -126,9 +127,9 @@ class StyledColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
126
127
|
// module: this.moduleInfo.ModuleName,
|
|
127
128
|
// isVisible: true,
|
|
128
129
|
// icon: { name: this.moduleInfo.Glyph },
|
|
129
|
-
// subItems: [newGrandientButton,
|
|
130
|
+
// subItems: [newGrandientButton, newPercentBarButton, newBadgeButton],
|
|
130
131
|
// });
|
|
131
|
-
returnColumnMenuItems.push(...[newGrandientButton,
|
|
132
|
+
returnColumnMenuItems.push(...[newGrandientButton, newPercentBarButton, newBadgeButton]);
|
|
132
133
|
break;
|
|
133
134
|
case 'String':
|
|
134
135
|
returnColumnMenuItems.push(newBadgeButton);
|
|
@@ -174,10 +175,13 @@ class StyledColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
174
175
|
},
|
|
175
176
|
});
|
|
176
177
|
}
|
|
177
|
-
if (
|
|
178
|
+
if (styledColumn.BadgeStyle) {
|
|
178
179
|
specificTypeItems.push({
|
|
179
180
|
name: 'Settings',
|
|
180
|
-
values: [
|
|
181
|
+
values: [
|
|
182
|
+
`Include grouped rows: ${styledColumn.IncludeGroupedRows ? 'Yes' : 'No'}`,
|
|
183
|
+
`Include row summaries: ${styledColumn.IncludeRowSummaries ? 'Yes' : 'No'}`,
|
|
184
|
+
],
|
|
181
185
|
});
|
|
182
186
|
}
|
|
183
187
|
if (styledColumn.BadgeStyle) {
|
|
@@ -227,7 +231,7 @@ class StyledColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
227
231
|
getTypeLabel(styledColumn) {
|
|
228
232
|
let type = null;
|
|
229
233
|
if (styledColumn.GradientStyle) {
|
|
230
|
-
type = 'Gradient';
|
|
234
|
+
type = 'Gradient Column';
|
|
231
235
|
}
|
|
232
236
|
else if (styledColumn.PercentBarStyle) {
|
|
233
237
|
type = 'Percent Bar';
|
|
@@ -236,7 +240,7 @@ class StyledColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
236
240
|
type = 'Spark Line';
|
|
237
241
|
}
|
|
238
242
|
else if (styledColumn.BadgeStyle) {
|
|
239
|
-
type = 'Badge';
|
|
243
|
+
type = 'Badge Style';
|
|
240
244
|
}
|
|
241
245
|
return type;
|
|
242
246
|
}
|
|
@@ -6,6 +6,7 @@ const getFormatColumnSettingsViewItems = (formatColumn) => {
|
|
|
6
6
|
const values = [
|
|
7
7
|
`Cell alignment: ${(_a = formatColumn.CellAlignment) !== null && _a !== void 0 ? _a : 'default'}`,
|
|
8
8
|
`Include grouped rows: ${formatColumn.IncludeGroupedRows ? 'Yes' : 'No'}`,
|
|
9
|
+
`Include row summaries: ${formatColumn.IncludeRowSummaries ? 'Yes' : 'No'}`,
|
|
9
10
|
].filter(Boolean);
|
|
10
11
|
return {
|
|
11
12
|
name: 'Settings',
|
|
@@ -1104,13 +1104,15 @@ const mapAggregationToCumulation = (aggregationParameter, overColumnParameter, c
|
|
|
1104
1104
|
if ((_a = aggregationEvaluation.context) === null || _a === void 0 ? void 0 : _a.weightParam) {
|
|
1105
1105
|
// weighted average
|
|
1106
1106
|
const weightValue = (_b = context.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, aggregationEvaluation.context.weightParam.value)) !== null && _b !== void 0 ? _b : 0;
|
|
1107
|
-
cumulationBag.currentValue =
|
|
1107
|
+
cumulationBag.currentValue =
|
|
1108
|
+
cumulationBag.currentValue + rowValue * weightValue;
|
|
1108
1109
|
cumulationBag.numberOfCumulatedValues =
|
|
1109
1110
|
cumulationBag.numberOfCumulatedValues + weightValue;
|
|
1110
1111
|
}
|
|
1111
1112
|
else {
|
|
1112
1113
|
cumulationBag.currentValue = cumulationBag.currentValue + rowValue;
|
|
1113
|
-
cumulationBag.numberOfCumulatedValues =
|
|
1114
|
+
cumulationBag.numberOfCumulatedValues =
|
|
1115
|
+
cumulationBag.numberOfCumulatedValues + 1;
|
|
1114
1116
|
}
|
|
1115
1117
|
}
|
|
1116
1118
|
if (cumulationBag.numberOfCumulatedValues !== 0) {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AdaptableApi, Layout } from '../../types';
|
|
2
|
+
import { AggregatedScalarLiveValue } from './AggregatedScalarLiveValue';
|
|
3
|
+
/**
|
|
4
|
+
* The logic is extracted here to make it easier to follow
|
|
5
|
+
*/
|
|
6
|
+
export declare class RowSummaryService {
|
|
7
|
+
private api;
|
|
8
|
+
cachedCellSummary: Map<string, AggregatedScalarLiveValue>;
|
|
9
|
+
previousRowSummaries: any;
|
|
10
|
+
previousLayout: Layout | null;
|
|
11
|
+
debouncedEvaluateRowSummary: import("lodash").DebouncedFunc<(reason?: {
|
|
12
|
+
columnId: string;
|
|
13
|
+
}) => void>;
|
|
14
|
+
constructor(api: AdaptableApi);
|
|
15
|
+
onAdapterReady(): void;
|
|
16
|
+
rowSummariesSubscriptions(): void;
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param colId optional to evaluate only one column
|
|
20
|
+
*/
|
|
21
|
+
private evaluateRowSummary;
|
|
22
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RowSummaryService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const RowSummary_1 = require("../../PredefinedConfig/Common/RowSummary");
|
|
7
|
+
const SystemRedux_1 = require("../../Redux/ActionsReducers/SystemRedux");
|
|
8
|
+
const ModuleConstants = tslib_1.__importStar(require("../../Utilities/Constants/ModuleConstants"));
|
|
9
|
+
const Helper_1 = tslib_1.__importDefault(require("../Helpers/Helper"));
|
|
10
|
+
const AggregatedScalarLiveValue_1 = require("./AggregatedScalarLiveValue");
|
|
11
|
+
const ObjectExtensions_1 = require("../Extensions/ObjectExtensions");
|
|
12
|
+
const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
|
|
13
|
+
/**
|
|
14
|
+
* The logic is extracted here to make it easier to follow
|
|
15
|
+
*/
|
|
16
|
+
class RowSummaryService {
|
|
17
|
+
constructor(api) {
|
|
18
|
+
this.api = api;
|
|
19
|
+
this.cachedCellSummary = new Map();
|
|
20
|
+
this.debouncedEvaluateRowSummary = (0, debounce_1.default)(this.evaluateRowSummary, 300);
|
|
21
|
+
}
|
|
22
|
+
onAdapterReady() {
|
|
23
|
+
this.rowSummariesSubscriptions();
|
|
24
|
+
}
|
|
25
|
+
rowSummariesSubscriptions() {
|
|
26
|
+
// return;
|
|
27
|
+
if (this.api.isDestroyed()) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
// Currently not available for serverside model
|
|
31
|
+
if (!this.api.layoutApi.internalApi.getLayoutSupportedFeatures().RowSummaries) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
this.debouncedEvaluateRowSummary();
|
|
35
|
+
this.api.eventApi.on('AdaptableStateReloaded', () => {
|
|
36
|
+
this.debouncedEvaluateRowSummary();
|
|
37
|
+
});
|
|
38
|
+
this.api.eventApi.on('GridDataChanged', (event) => {
|
|
39
|
+
this.debouncedEvaluateRowSummary();
|
|
40
|
+
});
|
|
41
|
+
this.api.eventApi.on('CellChanged', (event) => {
|
|
42
|
+
const columnId = event.cellChange.column.columnId;
|
|
43
|
+
this.debouncedEvaluateRowSummary({
|
|
44
|
+
columnId,
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
this.api.eventApi.on('LayoutChanged', (event) => {
|
|
48
|
+
// exclude filter events, those are handled in another event
|
|
49
|
+
if (event.actionName.includes('FILTER')) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
// the timeout is added so the grid has time to repond to the layout changed
|
|
54
|
+
this.debouncedEvaluateRowSummary();
|
|
55
|
+
}, 16);
|
|
56
|
+
});
|
|
57
|
+
const adaptable = this.api.internalApi.getAdaptableInstance();
|
|
58
|
+
adaptable._on('AdapTableFiltersApplied', () => {
|
|
59
|
+
// we need to use this instead of layout changed
|
|
60
|
+
// so the rows have time to update
|
|
61
|
+
this.debouncedEvaluateRowSummary();
|
|
62
|
+
});
|
|
63
|
+
adaptable._on('FirstDataRendered', () => {
|
|
64
|
+
this.debouncedEvaluateRowSummary();
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
*
|
|
69
|
+
* @param colId optional to evaluate only one column
|
|
70
|
+
*/
|
|
71
|
+
evaluateRowSummary(reason) {
|
|
72
|
+
var _a;
|
|
73
|
+
if (this.api.isDestroyed()) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const currentLayout = this.api.layoutApi.getCurrentLayout();
|
|
77
|
+
let previousLayout = this.previousLayout;
|
|
78
|
+
// it is added here to be sure it is saved
|
|
79
|
+
this.previousLayout = currentLayout;
|
|
80
|
+
/**
|
|
81
|
+
* If the previous & current layout does not have row summaries, it is safe to exit
|
|
82
|
+
*/
|
|
83
|
+
if ((0, ObjectExtensions_1.isObjectEmpty)(currentLayout === null || currentLayout === void 0 ? void 0 : currentLayout.RowSummaries) && (0, ObjectExtensions_1.isObjectEmpty)(previousLayout === null || previousLayout === void 0 ? void 0 : previousLayout.RowSummaries)) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const rowSummaries = (_a = this.api.layoutApi.getCurrentLayout().RowSummaries) !== null && _a !== void 0 ? _a : [];
|
|
87
|
+
const rowSummariesResults = rowSummaries.map(({ ColumnsMap, Position }) => {
|
|
88
|
+
return {
|
|
89
|
+
Position,
|
|
90
|
+
RowData: Object.entries(ColumnsMap !== null && ColumnsMap !== void 0 ? ColumnsMap : {}).reduce((acc, [columnId, expression]) => {
|
|
91
|
+
const key = `${columnId}-${expression}`;
|
|
92
|
+
let expressionLiveValue = this.cachedCellSummary.get(key);
|
|
93
|
+
if (expressionLiveValue) {
|
|
94
|
+
if (!reason) {
|
|
95
|
+
// refresh all of them
|
|
96
|
+
expressionLiveValue.refresh();
|
|
97
|
+
}
|
|
98
|
+
else if ('columnId' in reason && reason.columnId === columnId) {
|
|
99
|
+
expressionLiveValue.refresh();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (!expressionLiveValue) {
|
|
103
|
+
try {
|
|
104
|
+
let aggregatedScalarExpression = `${expression}([${columnId}])`;
|
|
105
|
+
if (aggregatedScalarExpression.includes(RowSummary_1.WEIGHTED_AVERAGE_AGGREATED_FUNCTION) &&
|
|
106
|
+
currentLayout.AggregationColumns[columnId] &&
|
|
107
|
+
typeof currentLayout.AggregationColumns[columnId] === 'object') {
|
|
108
|
+
const weight = currentLayout.AggregationColumns[columnId]
|
|
109
|
+
.weightedColumnId;
|
|
110
|
+
if (weight) {
|
|
111
|
+
aggregatedScalarExpression = `AVG([${columnId}], WEIGHT([${weight}]))`;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
expressionLiveValue = new AggregatedScalarLiveValue_1.AggregatedScalarLiveValue({
|
|
115
|
+
aggregatedScalarExpression,
|
|
116
|
+
}, ModuleConstants.LayoutModuleId, this.api, () => {
|
|
117
|
+
return this.api.gridApi.getVisibleRowNodes();
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
catch (e) {
|
|
121
|
+
this.api.logError('Error evaluating row summary', e);
|
|
122
|
+
}
|
|
123
|
+
this.cachedCellSummary.set(key, expressionLiveValue);
|
|
124
|
+
}
|
|
125
|
+
let value = null;
|
|
126
|
+
if (expressionLiveValue) {
|
|
127
|
+
value = expressionLiveValue.getGlobalAggregatedValue();
|
|
128
|
+
if (typeof value === 'number' && !isNaN(value)) {
|
|
129
|
+
value = Helper_1.default.roundNumber(value, 2);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
acc[columnId] = value;
|
|
133
|
+
return acc;
|
|
134
|
+
}, {
|
|
135
|
+
[RowSummary_1.ROW_SUMMARY_ROW_ID]: true,
|
|
136
|
+
}),
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
if (this.previousRowSummaries && (0, lodash_1.isEqual)(rowSummariesResults, this.previousRowSummaries)) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
this.api.internalApi.dispatchReduxAction((0, SystemRedux_1.SystemRowSummarySet)(rowSummariesResults));
|
|
143
|
+
this.previousRowSummaries = rowSummariesResults;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.RowSummaryService = RowSummaryService;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { CalculatedColumn } from '../../../types';
|
|
3
3
|
import { AdaptableOnePageWizardProps } from '../../Wizard/Interface/IAdaptableWizard';
|
|
4
4
|
export declare const calculatedColumnTypes: readonly ["ScalarExpression", "AggregatedScalarExpression", "CumulativeAggregatedExpression", "QuantileAggregatedExpression"];
|
|
5
|
-
export type ExpressionType = typeof calculatedColumnTypes[number];
|
|
5
|
+
export type ExpressionType = (typeof calculatedColumnTypes)[number];
|
|
6
6
|
export interface CalculatedColumnWizardProps extends AdaptableOnePageWizardProps<CalculatedColumn> {
|
|
7
7
|
}
|
|
8
8
|
export declare const CalculatedColumnWizard: (props: CalculatedColumnWizardProps) => JSX.Element;
|
|
@@ -19,7 +19,10 @@ const renderFormatColumnSettingsSummary = (data) => {
|
|
|
19
19
|
React.createElement(Tag_1.Tag, null, (_a = data.CellAlignment) !== null && _a !== void 0 ? _a : 'default')),
|
|
20
20
|
React.createElement(rebass_1.Text, { mt: 3 },
|
|
21
21
|
"Include grouped rows ",
|
|
22
|
-
React.createElement(Tag_1.Tag, null, data.IncludeGroupedRows ? 'yes' : 'no'))
|
|
22
|
+
React.createElement(Tag_1.Tag, null, data.IncludeGroupedRows ? 'yes' : 'no')),
|
|
23
|
+
React.createElement(rebass_1.Text, { mt: 3 },
|
|
24
|
+
"Include row summaries ",
|
|
25
|
+
React.createElement(Tag_1.Tag, null, data.IncludeRowSummaries ? 'yes' : 'no'))));
|
|
23
26
|
};
|
|
24
27
|
exports.renderFormatColumnSettingsSummary = renderFormatColumnSettingsSummary;
|
|
25
28
|
const FormatColumnSettingsWizardSection = (props) => {
|
|
@@ -34,6 +37,9 @@ const FormatColumnSettingsWizardSection = (props) => {
|
|
|
34
37
|
const onIncludeGroupedRowsChanged = (IncludeGroupedRows) => {
|
|
35
38
|
props.onChange(Object.assign(Object.assign({}, data), { IncludeGroupedRows }));
|
|
36
39
|
};
|
|
40
|
+
const onIncludeRowSummariesChanged = (IncludeRowSummaries) => {
|
|
41
|
+
props.onChange(Object.assign(Object.assign({}, data), { IncludeRowSummaries }));
|
|
42
|
+
};
|
|
37
43
|
return (React.createElement(Tabs_1.Tabs, null,
|
|
38
44
|
React.createElement(Tabs_1.Tabs.Tab, null, "Settings"),
|
|
39
45
|
React.createElement(Tabs_1.Tabs.Content, null,
|
|
@@ -52,6 +58,9 @@ const FormatColumnSettingsWizardSection = (props) => {
|
|
|
52
58
|
: onCellAlignmentSelectChanged(null) }))),
|
|
53
59
|
React.createElement(FormLayout_1.FormRow, { label: "Include Grouped Rows:" },
|
|
54
60
|
React.createElement(rebass_1.Flex, { alignItems: "center", marginLeft: 2 },
|
|
55
|
-
React.createElement(CheckBox_1.CheckBox, { "data-name": "include-grouped-rows-checkbox", checked: data.IncludeGroupedRows, onChange: onIncludeGroupedRowsChanged, mr: 2 })))
|
|
61
|
+
React.createElement(CheckBox_1.CheckBox, { "data-name": "include-grouped-rows-checkbox", checked: data.IncludeGroupedRows, onChange: onIncludeGroupedRowsChanged, mr: 2 }))),
|
|
62
|
+
React.createElement(FormLayout_1.FormRow, { label: "Include Row Summaries:" },
|
|
63
|
+
React.createElement(rebass_1.Flex, { alignItems: "center", marginLeft: 2 },
|
|
64
|
+
React.createElement(CheckBox_1.CheckBox, { "data-name": "include-grouped-rows-checkbox", checked: data.IncludeRowSummaries, onChange: onIncludeRowSummariesChanged, mr: 2 }))))))));
|
|
56
65
|
};
|
|
57
66
|
exports.FormatColumnSettingsWizardSection = FormatColumnSettingsWizardSection;
|
|
@@ -81,7 +81,7 @@ const StyledColumnWizard = (props) => {
|
|
|
81
81
|
React.createElement(StyledColumnWizardStyleSection_1.StyledColumnWizardStyleSection, { onChange: setStyledColumn })));
|
|
82
82
|
},
|
|
83
83
|
title: 'Style',
|
|
84
|
-
}
|
|
84
|
+
});
|
|
85
85
|
}
|
|
86
86
|
else if (styledColumn.BadgeStyle) {
|
|
87
87
|
specificSteps.push({
|
|
@@ -4,28 +4,29 @@ exports.StyledColumnWizardSettingsSection = exports.renderStyledColumnWizardSett
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const rebass_1 = require("rebass");
|
|
7
|
-
const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
|
|
8
7
|
const CheckBox_1 = require("../../../components/CheckBox");
|
|
8
|
+
const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
|
|
9
9
|
const Tabs_1 = require("../../../components/Tabs");
|
|
10
|
-
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
|
|
11
10
|
const Tag_1 = require("../../../components/Tag");
|
|
12
|
-
|
|
13
|
-
{ value: 'Left', label: 'Left' },
|
|
14
|
-
{ value: 'Right', label: 'Right' },
|
|
15
|
-
{ value: 'Center', label: 'Center' },
|
|
16
|
-
];
|
|
11
|
+
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
|
|
17
12
|
const renderStyledColumnWizardSettingsSummary = (data) => {
|
|
18
13
|
return (React.createElement(rebass_1.Box, { padding: 2 },
|
|
19
14
|
React.createElement(rebass_1.Text, { mt: 3 },
|
|
20
15
|
"Include grouped rows ",
|
|
21
|
-
React.createElement(Tag_1.Tag, null, data.IncludeGroupedRows ? 'yes' : 'no'))
|
|
16
|
+
React.createElement(Tag_1.Tag, null, data.IncludeGroupedRows ? 'yes' : 'no')),
|
|
17
|
+
React.createElement(rebass_1.Text, { mt: 3 },
|
|
18
|
+
"Include row summaries ",
|
|
19
|
+
React.createElement(Tag_1.Tag, null, data.IncludeRowSummaries ? 'yes' : 'no'))));
|
|
22
20
|
};
|
|
23
21
|
exports.renderStyledColumnWizardSettingsSummary = renderStyledColumnWizardSettingsSummary;
|
|
24
22
|
const StyledColumnWizardSettingsSection = (props) => {
|
|
25
|
-
const { data
|
|
23
|
+
const { data } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
26
24
|
const onIncludeGroupedRowsChanged = (IncludeGroupedRows) => {
|
|
27
25
|
props.onChange(Object.assign(Object.assign({}, data), { IncludeGroupedRows }));
|
|
28
26
|
};
|
|
27
|
+
const onIncludeRowSummariesChanged = (IncludeRowSummaries) => {
|
|
28
|
+
props.onChange(Object.assign(Object.assign({}, data), { IncludeRowSummaries }));
|
|
29
|
+
};
|
|
29
30
|
return (React.createElement(Tabs_1.Tabs, null,
|
|
30
31
|
React.createElement(Tabs_1.Tabs.Tab, null, "Settings"),
|
|
31
32
|
React.createElement(Tabs_1.Tabs.Content, null,
|
|
@@ -33,6 +34,9 @@ const StyledColumnWizardSettingsSection = (props) => {
|
|
|
33
34
|
React.createElement(FormLayout_1.default, null,
|
|
34
35
|
React.createElement(FormLayout_1.FormRow, { label: "Include Grouped Rows:" },
|
|
35
36
|
React.createElement(rebass_1.Flex, { alignItems: "center", marginLeft: 2 },
|
|
36
|
-
React.createElement(CheckBox_1.CheckBox, { "data-name": "include-grouped-rows-checkbox", checked: data.IncludeGroupedRows, onChange: onIncludeGroupedRowsChanged, mr: 2 })))
|
|
37
|
+
React.createElement(CheckBox_1.CheckBox, { "data-name": "include-grouped-rows-checkbox", checked: data.IncludeGroupedRows, onChange: onIncludeGroupedRowsChanged, mr: 2 }))),
|
|
38
|
+
React.createElement(FormLayout_1.FormRow, { label: "Include Row Summaries:" },
|
|
39
|
+
React.createElement(rebass_1.Flex, { alignItems: "center", marginLeft: 2 },
|
|
40
|
+
React.createElement(CheckBox_1.CheckBox, { "data-name": "include-grouped-rows-checkbox", checked: data.IncludeRowSummaries, onChange: onIncludeRowSummariesChanged, mr: 2 }))))))));
|
|
37
41
|
};
|
|
38
42
|
exports.StyledColumnWizardSettingsSection = StyledColumnWizardSettingsSection;
|
|
@@ -1694,7 +1694,8 @@ class AdaptableAgGrid {
|
|
|
1694
1694
|
return acc;
|
|
1695
1695
|
}
|
|
1696
1696
|
const ColumnGroupId = columnGroup.getGroupId();
|
|
1697
|
-
const AllowGroupSplit = !columnGroup.getProvidedColumnGroup().getColGroupDef()
|
|
1697
|
+
const AllowGroupSplit = !columnGroup.getProvidedColumnGroup().getColGroupDef()
|
|
1698
|
+
.marryChildren;
|
|
1698
1699
|
const FriendlyName = (_c = columnGroup.getProvidedColumnGroup().getColGroupDef().headerName) !== null && _c !== void 0 ? _c : ColumnGroupId;
|
|
1699
1700
|
const columnsInGroup = columnGroup.getLeafColumns();
|
|
1700
1701
|
columnsInGroup.forEach((col) => {
|