@adaptabletools/adaptable 12.1.7 → 12.1.8-canary.0
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 +11 -49
- package/bundle.cjs.js +105 -105
- package/index.css +13 -60
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -0
- package/src/AdaptableOptions/FilterOptions.d.ts +12 -0
- package/src/AdaptableOptions/FinancePluginOptions.d.ts +22 -1
- package/src/AdaptableOptions/StateOptions.d.ts +25 -12
- package/src/Api/ColumnApi.d.ts +5 -0
- package/src/Api/ExportApi.d.ts +5 -0
- package/src/Api/FilterApi.d.ts +23 -0
- package/src/Api/GridApi.d.ts +1 -0
- package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
- package/src/Api/Implementation/ColumnApiImpl.js +5 -0
- package/src/Api/Implementation/ExportApiImpl.d.ts +3 -1
- package/src/Api/Implementation/ExportApiImpl.js +19 -3
- package/src/Api/Implementation/FilterApiImpl.d.ts +5 -0
- package/src/Api/Implementation/FilterApiImpl.js +25 -2
- package/src/Api/Implementation/GridApiImpl.d.ts +1 -0
- package/src/Api/Implementation/InternalApiImpl.d.ts +0 -1
- package/src/Api/Implementation/InternalApiImpl.js +0 -3
- package/src/Api/Implementation/PredicateApiImpl.js +4 -0
- package/src/Api/Implementation/QueryLanguageApiImpl.js +9 -1
- package/src/Api/InternalApi.d.ts +0 -1
- package/src/PredefinedConfig/CalculatedColumnState.d.ts +2 -2
- package/src/PredefinedConfig/Common/AdaptablePredicate.js +16 -4
- package/src/PredefinedConfig/Common/AdaptableQuery.js +1 -1
- package/src/PredefinedConfig/Common/AggregationColumns.d.ts +6 -0
- package/src/PredefinedConfig/Common/AggregationColumns.js +4 -0
- package/src/PredefinedConfig/Common/ColumnFilter.d.ts +2 -2
- package/src/PredefinedConfig/Common/Enums.d.ts +0 -15
- package/src/PredefinedConfig/Common/Enums.js +1 -18
- package/src/PredefinedConfig/ExportState.d.ts +12 -4
- package/src/PredefinedConfig/LayoutState.d.ts +2 -1
- package/src/PredefinedConfig/PopupState.d.ts +1 -2
- package/src/Redux/ActionsReducers/AlertRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/AlertRedux.js +1 -1
- package/src/Redux/ActionsReducers/ConditionalStyleRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/ConditionalStyleRedux.js +1 -1
- package/src/Redux/ActionsReducers/CustomSortRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/CustomSortRedux.js +1 -1
- package/src/Redux/ActionsReducers/FlashingCellRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/FlashingCellRedux.js +1 -1
- package/src/Redux/ActionsReducers/FormatColumnRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/FormatColumnRedux.js +1 -1
- package/src/Redux/ActionsReducers/LayoutRedux.d.ts +28 -0
- package/src/Redux/ActionsReducers/LayoutRedux.js +80 -2
- package/src/Redux/ActionsReducers/PlusMinusRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/PlusMinusRedux.js +1 -1
- package/src/Redux/ActionsReducers/PopupRedux.d.ts +0 -2
- package/src/Redux/ActionsReducers/PopupRedux.js +1 -28
- package/src/Redux/ActionsReducers/ScheduleRedux.d.ts +5 -5
- package/src/Redux/ActionsReducers/ScheduleRedux.js +5 -5
- package/src/Redux/ActionsReducers/ShortcutRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/ShortcutRedux.js +1 -1
- package/src/Redux/Store/AdaptableStore.js +15 -6
- package/src/Strategy/AlertModule.d.ts +1 -0
- package/src/Strategy/AlertModule.js +20 -0
- package/src/Strategy/CalculatedColumnModule.js +2 -2
- package/src/Strategy/ExportModule.d.ts +0 -1
- package/src/Strategy/ExportModule.js +0 -16
- package/src/Strategy/FilterModule.js +6 -0
- package/src/Strategy/Interface/IModule.d.ts +4 -0
- package/src/Strategy/LayoutModule.js +20 -20
- package/src/Strategy/Utilities/FormatColumn/getFormatColumnStyleViewItems.js +16 -1
- package/src/Strategy/Utilities/Layout/getLayoutFilterViewItems.js +15 -11
- package/src/Utilities/Constants/DocumentationLinkConstants.d.ts +1 -0
- package/src/Utilities/Constants/DocumentationLinkConstants.js +2 -1
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +2 -0
- package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.d.ts +12 -2
- package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +30 -66
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +22 -6
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +423 -220
- package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.d.ts +7 -1
- package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.js +23 -7
- package/src/Utilities/ExpressionFunctions/scalarAggregationHelper.d.ts +0 -1
- package/src/Utilities/ExpressionFunctions/scalarAggregationHelper.js +6 -54
- package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +17 -5
- package/src/Utilities/Interface/MessagePopups.d.ts +0 -4
- package/src/Utilities/ObjectFactory.d.ts +4 -2
- package/src/Utilities/ObjectFactory.js +16 -3
- package/src/Utilities/Services/AggregatedScalarLiveValue.d.ts +25 -0
- package/src/Utilities/Services/AggregatedScalarLiveValue.js +103 -0
- package/src/Utilities/Services/AlertService.d.ts +0 -1
- package/src/Utilities/Services/AlertService.js +5 -17
- package/src/Utilities/Services/CalculatedColumnExpressionService.d.ts +4 -4
- package/src/Utilities/Services/CalculatedColumnExpressionService.js +29 -154
- package/src/Utilities/Services/Interface/ICalculatedColumnExpressionService.d.ts +2 -2
- package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +6 -3
- package/src/Utilities/Services/QueryLanguageService.d.ts +6 -3
- package/src/Utilities/Services/QueryLanguageService.js +23 -6
- package/src/Utilities/Services/ReportService.js +47 -46
- package/src/View/AdaptableView.js +1 -2
- package/src/View/CalculatedColumn/Utilities/getCalculatedColumnSettingsTags.d.ts +2 -0
- package/src/View/CalculatedColumn/Utilities/{getCalculatedColumnSettingTags.js → getCalculatedColumnSettingsTags.js} +3 -3
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.d.ts +10 -0
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.js +80 -0
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +20 -11
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.d.ts +1 -2
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +9 -52
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.js +17 -6
- package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +42 -6
- package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +1 -1
- package/src/View/Components/EntityRulesEditor/index.js +26 -5
- package/src/View/Components/FilterForm/FilterForm.js +8 -4
- package/src/View/Components/FilterForm/ListBoxFilterForm.js +1 -0
- package/src/View/Components/FilterForm/QuickFilterForm.js +10 -6
- package/src/View/Components/PermittedValuesSelector/PermitedValuesSelector.d.ts +9 -0
- package/src/View/Components/PermittedValuesSelector/PermitedValuesSelector.js +28 -0
- package/src/View/Components/PermittedValuesSelector/index.d.ts +1 -0
- package/src/View/Components/PermittedValuesSelector/index.js +5 -0
- package/src/View/Components/Popups/AdaptablePopup/Navigation.js +2 -2
- package/src/View/Components/Popups/AdaptableToaster.js +2 -7
- package/src/View/Components/Popups/WindowPopups/windowFactory.d.ts +0 -1
- package/src/View/Components/Popups/WindowPopups/windowFactory.js +1 -4
- package/src/View/Export/ExportViewPanel.d.ts +1 -2
- package/src/View/Export/ExportViewPanel.js +2 -6
- package/src/View/Export/Wizard/ReportColumnTypeWizard.d.ts +1 -2
- package/src/View/Export/Wizard/ReportColumnTypeWizard.js +11 -12
- package/src/View/Export/Wizard/ReportRowTypeWizard.d.ts +1 -2
- package/src/View/Export/Wizard/ReportRowTypeWizard.js +12 -13
- package/src/View/Export/Wizard/ReportSettingsWizard.js +1 -2
- package/src/View/Filter/FilterViewPanel.js +20 -4
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +1 -1
- package/src/View/Layout/Wizard/{LayoutEditor → Components}/ColumnLabels.d.ts +0 -0
- package/src/View/Layout/Wizard/{LayoutEditor → Components}/ColumnLabels.js +0 -0
- package/src/View/Layout/Wizard/LayoutWizard.js +1 -0
- package/src/View/Layout/Wizard/sections/AggregationsSection.d.ts +1 -0
- package/src/View/Layout/Wizard/sections/AggregationsSection.js +69 -8
- package/src/View/Layout/Wizard/sections/ColumnsSection.js +1 -1
- package/src/View/Query/QueryViewPanel.js +1 -1
- package/src/agGrid/Adaptable.d.ts +10 -3
- package/src/agGrid/Adaptable.js +211 -142
- package/src/agGrid/agGridHelper.d.ts +1 -0
- package/src/agGrid/agGridHelper.js +5 -3
- package/src/agGrid/agGridMenuHelper.d.ts +1 -0
- package/src/agGrid/agGridMenuHelper.js +4 -2
- package/src/agGrid/weightedAverage.d.ts +6 -0
- package/src/agGrid/weightedAverage.js +66 -0
- package/src/components/ExpressionEditor/BaseEditorInput.d.ts +1 -0
- package/src/components/ExpressionEditor/BaseEditorInput.js +2 -3
- package/src/components/ExpressionEditor/EditorInput.d.ts +1 -1
- package/src/components/ExpressionEditor/EditorInput.js +24 -4
- package/src/components/ExpressionEditor/{EditorInputReactive.d.ts → EditorInputWithWhereClause.d.ts} +3 -3
- package/src/components/ExpressionEditor/{EditorInputReactive.js → EditorInputWithWhereClause.js} +6 -5
- package/src/components/ExpressionEditor/editorButtonsAggregatedBoolean.d.ts +2 -0
- package/src/components/ExpressionEditor/{editorButtonsReactive.js → editorButtonsAggregatedBoolean.js} +22 -37
- package/src/components/ExpressionEditor/editorButtonsAggregatedScalar.js +5 -10
- package/src/components/ExpressionEditor/editorButtonsCumulativeAggregatedScalar.d.ts +2 -0
- package/src/components/ExpressionEditor/editorButtonsCumulativeAggregatedScalar.js +50 -0
- package/src/components/ExpressionEditor/editorButtonsObservable.d.ts +2 -0
- package/src/components/ExpressionEditor/editorButtonsObservable.js +40 -0
- package/src/components/ExpressionEditor/index.d.ts +1 -1
- package/src/components/ExpressionEditor/index.js +26 -5
- package/src/metamodel/adaptable.metamodel.d.ts +55 -1
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +3 -3
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/src/View/CalculatedColumn/Utilities/getCalculatedColumnSettingTags.d.ts +0 -2
- package/src/View/Layout/LayoutEditorStandalonePopup.d.ts +0 -3
- package/src/View/Layout/LayoutEditorStandalonePopup.js +0 -78
- package/src/View/Layout/Wizard/LayoutEditor/ColumnList.d.ts +0 -27
- package/src/View/Layout/Wizard/LayoutEditor/ColumnList.js +0 -86
- package/src/View/Layout/Wizard/LayoutEditor/ColumnSortList.d.ts +0 -16
- package/src/View/Layout/Wizard/LayoutEditor/ColumnSortList.js +0 -89
- package/src/View/Layout/Wizard/LayoutEditor/PivotList.d.ts +0 -15
- package/src/View/Layout/Wizard/LayoutEditor/PivotList.js +0 -70
- package/src/View/Layout/Wizard/LayoutEditor/RowGroupsList.d.ts +0 -15
- package/src/View/Layout/Wizard/LayoutEditor/RowGroupsList.js +0 -70
- package/src/View/Layout/Wizard/LayoutEditor/droppableIds.d.ts +0 -7
- package/src/View/Layout/Wizard/LayoutEditor/droppableIds.js +0 -11
- package/src/View/Layout/Wizard/LayoutEditor/getItemStyle.d.ts +0 -6
- package/src/View/Layout/Wizard/LayoutEditor/getItemStyle.js +0 -26
- package/src/View/Layout/Wizard/LayoutEditor/index.d.ts +0 -9
- package/src/View/Layout/Wizard/LayoutEditor/index.js +0 -367
- package/src/View/Layout/Wizard/LayoutEditor/reducer.d.ts +0 -28
- package/src/View/Layout/Wizard/LayoutEditor/reducer.js +0 -46
- package/src/View/Layout/Wizard/LayoutEditor/utils.d.ts +0 -10
- package/src/View/Layout/Wizard/LayoutEditor/utils.js +0 -14
- package/src/View/Layout/Wizard/LayoutEditorWizard.d.ts +0 -30
- package/src/View/Layout/Wizard/LayoutEditorWizard.js +0 -132
- package/src/components/ExpressionEditor/editorButtonsReactive.d.ts +0 -2
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CalculatedColumnExpressionService = void 0;
|
|
4
4
|
const LoggingHelper_1 = require("../Helpers/LoggingHelper");
|
|
5
5
|
const ModuleConstants_1 = require("../Constants/ModuleConstants");
|
|
6
|
-
const
|
|
6
|
+
const AggregatedScalarLiveValue_1 = require("./AggregatedScalarLiveValue");
|
|
7
7
|
class CalculatedColumnExpressionService {
|
|
8
8
|
constructor(adaptableApi) {
|
|
9
9
|
this.adaptableApi = adaptableApi;
|
|
10
|
-
this.
|
|
10
|
+
this.aggregatedScalarLiveValuesMap = new Map();
|
|
11
11
|
this.adaptableApi = adaptableApi;
|
|
12
12
|
this.adaptableApi.internalApi
|
|
13
13
|
.getDataService()
|
|
@@ -17,12 +17,12 @@ class CalculatedColumnExpressionService {
|
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
const refreshedCalculatedColumns = [];
|
|
20
|
-
this.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
refreshedCalculatedColumns.push(
|
|
20
|
+
this.aggregatedScalarLiveValuesMap.forEach((aggregatedScalarLiveValue, calculatedColumnId) => {
|
|
21
|
+
const calculatedColumn = this.adaptableApi.calculatedColumnApi.getCalculatedColumnById(calculatedColumnId);
|
|
22
|
+
const columnDependencies = this.adaptableApi.calculatedColumnApi.getReferencedColumnIdsForCalculatedColumn(calculatedColumn);
|
|
23
|
+
if (columnDependencies.includes(cellDataChangedInfo.column.columnId)) {
|
|
24
|
+
aggregatedScalarLiveValue.refresh();
|
|
25
|
+
refreshedCalculatedColumns.push(calculatedColumn.ColumnId);
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
if (refreshedCalculatedColumns.length) {
|
|
@@ -31,9 +31,10 @@ class CalculatedColumnExpressionService {
|
|
|
31
31
|
});
|
|
32
32
|
this.adaptableApi.eventApi.on('GridDataChanged', () => {
|
|
33
33
|
const refreshedCalculatedColumns = [];
|
|
34
|
-
this.
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
this.aggregatedScalarLiveValuesMap.forEach((aggregatedScalarLiveValue, calculatedColumnId) => {
|
|
35
|
+
const calculatedColumn = this.adaptableApi.calculatedColumnApi.getCalculatedColumnById(calculatedColumnId);
|
|
36
|
+
aggregatedScalarLiveValue.refresh();
|
|
37
|
+
refreshedCalculatedColumns.push(calculatedColumn.ColumnId);
|
|
37
38
|
});
|
|
38
39
|
if (refreshedCalculatedColumns.length) {
|
|
39
40
|
this.adaptableApi.gridApi.refreshCells(null, refreshedCalculatedColumns);
|
|
@@ -41,9 +42,8 @@ class CalculatedColumnExpressionService {
|
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
44
|
destroy() {
|
|
44
|
-
|
|
45
|
-
this.
|
|
46
|
-
this.aggregatedScalarCalculatedColumnsMap = null;
|
|
45
|
+
this.aggregatedScalarLiveValuesMap.clear();
|
|
46
|
+
this.aggregatedScalarLiveValuesMap = null;
|
|
47
47
|
}
|
|
48
48
|
getCalculatedColumnDataType(calculatedColumnQuery) {
|
|
49
49
|
try {
|
|
@@ -99,21 +99,21 @@ class CalculatedColumnExpressionService {
|
|
|
99
99
|
// if query has neither a ScalarExpression nor an AggregatedScalarExpression => it can only be false
|
|
100
100
|
return false;
|
|
101
101
|
}
|
|
102
|
-
evaluateCalculatedColumnQuery(calculatedColumn,
|
|
102
|
+
evaluateCalculatedColumnQuery(calculatedColumn, rowNode) {
|
|
103
103
|
var _a, _b, _c, _d, _e;
|
|
104
104
|
try {
|
|
105
|
-
if (this.adaptableApi.gridApi.isGroupRowNode(
|
|
105
|
+
if (this.adaptableApi.gridApi.isGroupRowNode(rowNode)) {
|
|
106
106
|
return undefined;
|
|
107
107
|
}
|
|
108
108
|
// no validation here, this function has to be as performant as possible
|
|
109
109
|
if ((_a = calculatedColumn === null || calculatedColumn === void 0 ? void 0 : calculatedColumn.Query) === null || _a === void 0 ? void 0 : _a.ScalarExpression) {
|
|
110
110
|
return this.adaptableApi.internalApi
|
|
111
111
|
.getQueryLanguageService()
|
|
112
|
-
.evaluateScalarExpression(calculatedColumn.Query.ScalarExpression, ModuleConstants_1.CalculatedColumnModuleId,
|
|
112
|
+
.evaluateScalarExpression(calculatedColumn.Query.ScalarExpression, ModuleConstants_1.CalculatedColumnModuleId, rowNode);
|
|
113
113
|
}
|
|
114
114
|
if ((_b = calculatedColumn === null || calculatedColumn === void 0 ? void 0 : calculatedColumn.Query) === null || _b === void 0 ? void 0 : _b.AggregatedScalarExpression) {
|
|
115
|
-
const
|
|
116
|
-
return
|
|
115
|
+
const aggregatedScalarLiveValue = this.aggregatedScalarLiveValuesMap.get(calculatedColumn.Uuid);
|
|
116
|
+
return aggregatedScalarLiveValue === null || aggregatedScalarLiveValue === void 0 ? void 0 : aggregatedScalarLiveValue.getAggregatedValueForRow(rowNode);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
catch (error) {
|
|
@@ -121,149 +121,24 @@ class CalculatedColumnExpressionService {
|
|
|
121
121
|
return null;
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
|
|
125
|
-
var _a, _b;
|
|
124
|
+
createAggregatedScalarLiveValue(calculatedColumn) {
|
|
125
|
+
var _a, _b, _c;
|
|
126
126
|
// if there is already an aggregated scalar, delete it (possible when editing)
|
|
127
|
-
this.
|
|
127
|
+
this.destroyAggregatedScalarLiveValue(calculatedColumn);
|
|
128
128
|
if ((_a = calculatedColumn.Query) === null || _a === void 0 ? void 0 : _a.AggregatedScalarExpression) {
|
|
129
129
|
try {
|
|
130
|
-
const
|
|
131
|
-
|
|
130
|
+
const aggregatedScalarLiveValue = new AggregatedScalarLiveValue_1.AggregatedScalarLiveValue({
|
|
131
|
+
aggregatedScalarExpression: (_b = calculatedColumn.Query) === null || _b === void 0 ? void 0 : _b.AggregatedScalarExpression,
|
|
132
|
+
}, ModuleConstants_1.CalculatedColumnModuleId, this.adaptableApi);
|
|
133
|
+
this.aggregatedScalarLiveValuesMap.set(calculatedColumn.Uuid, aggregatedScalarLiveValue);
|
|
132
134
|
}
|
|
133
135
|
catch (e) {
|
|
134
|
-
LoggingHelper_1.LogAdaptableError(`Creating CalculatedColumn ('${(
|
|
136
|
+
LoggingHelper_1.LogAdaptableError(`Creating CalculatedColumn ('${(_c = calculatedColumn.Query) === null || _c === void 0 ? void 0 : _c.AggregatedScalarExpression}') failed!\n${e.message}`);
|
|
135
137
|
}
|
|
136
138
|
}
|
|
137
139
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
(_a = this.aggregatedScalarCalculatedColumnsMap.get(calculatedColumn.Uuid)) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
141
|
-
this.aggregatedScalarCalculatedColumnsMap.delete(calculatedColumn.Uuid);
|
|
140
|
+
destroyAggregatedScalarLiveValue(calculatedColumn) {
|
|
141
|
+
this.aggregatedScalarLiveValuesMap.delete(calculatedColumn.Uuid);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
exports.CalculatedColumnExpressionService = CalculatedColumnExpressionService;
|
|
145
|
-
class AggregatedScalarCalculatedColumn {
|
|
146
|
-
constructor(calculatedColumn, adaptableApi) {
|
|
147
|
-
this.calculatedColumn = calculatedColumn;
|
|
148
|
-
this.adaptableApi = adaptableApi;
|
|
149
|
-
const aggregationConfig = this.adaptableApi.internalApi
|
|
150
|
-
.getQueryLanguageService()
|
|
151
|
-
.evaluateAggregatedScalarExpression(calculatedColumn.Query.AggregatedScalarExpression, ModuleConstants_1.CalculatedColumnModuleId);
|
|
152
|
-
this.expressionEvaluation = aggregationConfig.value;
|
|
153
|
-
this.aggregationResult = this.computeAggregatedValue(this.expressionEvaluation);
|
|
154
|
-
// currently we support only one reducer
|
|
155
|
-
this.aggregationReducerName = Object.keys(this.expressionEvaluation.aggregationParams.reducers)[0];
|
|
156
|
-
}
|
|
157
|
-
destroy() {
|
|
158
|
-
this.expressionEvaluation = null;
|
|
159
|
-
this.calculatedColumn = null;
|
|
160
|
-
this.adaptableApi = null;
|
|
161
|
-
this.aggregationResult = null;
|
|
162
|
-
}
|
|
163
|
-
getAggregatedColumnValue(rowNode) {
|
|
164
|
-
const aggregationValue = this.getAggregationValue(rowNode);
|
|
165
|
-
if (this.expressionEvaluation.rowValueGetter) {
|
|
166
|
-
return this.expressionEvaluation.rowValueGetter(rowNode, aggregationValue);
|
|
167
|
-
}
|
|
168
|
-
return aggregationValue;
|
|
169
|
-
}
|
|
170
|
-
refreshAggregatedColumnValue() {
|
|
171
|
-
const aggregationConfig = this.adaptableApi.internalApi
|
|
172
|
-
.getQueryLanguageService()
|
|
173
|
-
.evaluateAggregatedScalarExpression(this.calculatedColumn.Query.AggregatedScalarExpression, ModuleConstants_1.CalculatedColumnModuleId);
|
|
174
|
-
this.expressionEvaluation = aggregationConfig.value;
|
|
175
|
-
this.aggregationResult = this.computeAggregatedValue(this.expressionEvaluation);
|
|
176
|
-
}
|
|
177
|
-
getCalculatedColumnId() {
|
|
178
|
-
return this.calculatedColumn.ColumnId;
|
|
179
|
-
}
|
|
180
|
-
getColumnDependencies() {
|
|
181
|
-
return this.expressionEvaluation.columnDependencies;
|
|
182
|
-
}
|
|
183
|
-
computeAggregatedValue(expressionEvaluation) {
|
|
184
|
-
var _a;
|
|
185
|
-
const gridRowNodes = this.adaptableApi.gridApi.getAllRowNodes();
|
|
186
|
-
// we iterate over the RowNode list (we need this to handle complex column values (nested values, valueGetters etc)
|
|
187
|
-
// so we will map the fieldNames to RowNode.data
|
|
188
|
-
const mapReducerValueGetter = (fieldName) => {
|
|
189
|
-
return (rowNode) => {
|
|
190
|
-
return this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, fieldName);
|
|
191
|
-
};
|
|
192
|
-
};
|
|
193
|
-
Object.values(expressionEvaluation.aggregationParams.reducers).forEach((aggregationReducer) => {
|
|
194
|
-
aggregationReducer.getter = mapReducerValueGetter(aggregationReducer.field);
|
|
195
|
-
// nullify the field to force the fallback on the getter fn
|
|
196
|
-
aggregationReducer.field = null;
|
|
197
|
-
});
|
|
198
|
-
const mapGroupByToKey = (fieldName) => {
|
|
199
|
-
return (_unusableProperty, rowNode) => this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, fieldName);
|
|
200
|
-
};
|
|
201
|
-
(_a = expressionEvaluation.aggregationParams.groupBy) === null || _a === void 0 ? void 0 : _a.forEach((groupByDef) => {
|
|
202
|
-
groupByDef.toKey = mapGroupByToKey(groupByDef.field);
|
|
203
|
-
});
|
|
204
|
-
if (!expressionEvaluation.cumulateOver) {
|
|
205
|
-
let aggregatedRowNodes = gridRowNodes;
|
|
206
|
-
if (expressionEvaluation.sortByColumn) {
|
|
207
|
-
const sortByColumn = expressionEvaluation.sortByColumn;
|
|
208
|
-
const getRowNodeValue = (rowNode, columnId) => this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, columnId);
|
|
209
|
-
if (expressionEvaluation.filterUndefinedValues) {
|
|
210
|
-
aggregatedRowNodes = gridRowNodes.filter((node) => {
|
|
211
|
-
const rowValue = getRowNodeValue(node, sortByColumn);
|
|
212
|
-
return rowValue != undefined;
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
// currently, we support only ascending sorting
|
|
216
|
-
aggregatedRowNodes.sort((first, second) => {
|
|
217
|
-
const firstValue = getRowNodeValue(first, sortByColumn);
|
|
218
|
-
const secondValue = getRowNodeValue(second, sortByColumn);
|
|
219
|
-
if (firstValue < secondValue) {
|
|
220
|
-
return -1;
|
|
221
|
-
}
|
|
222
|
-
if (firstValue > secondValue) {
|
|
223
|
-
return 1;
|
|
224
|
-
}
|
|
225
|
-
return 0;
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
return scalarAggregationHelper_1.aggregate(expressionEvaluation.aggregationParams, aggregatedRowNodes);
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
231
|
-
// 1. sort grid data by given OVER column
|
|
232
|
-
const sortByColumn = expressionEvaluation.cumulateOver;
|
|
233
|
-
const getRowNodeValue = (rowNode, columnId) => this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, columnId);
|
|
234
|
-
// currently, we support only ascending sorting
|
|
235
|
-
gridRowNodes.sort((first, second) => {
|
|
236
|
-
const firstValue = getRowNodeValue(first, sortByColumn);
|
|
237
|
-
const secondValue = getRowNodeValue(second, sortByColumn);
|
|
238
|
-
if (firstValue < secondValue) {
|
|
239
|
-
return -1;
|
|
240
|
-
}
|
|
241
|
-
if (firstValue > secondValue) {
|
|
242
|
-
return 1;
|
|
243
|
-
}
|
|
244
|
-
return 0;
|
|
245
|
-
});
|
|
246
|
-
// 2. add primary key column as the most specific groupBy
|
|
247
|
-
if (!expressionEvaluation.aggregationParams.groupBy) {
|
|
248
|
-
expressionEvaluation.aggregationParams.groupBy = [];
|
|
249
|
-
}
|
|
250
|
-
const gridPrimaryKeyColumn = this.adaptableApi.internalApi.getAdaptableOptions().primaryKey;
|
|
251
|
-
// !! aggregationParams mutated
|
|
252
|
-
expressionEvaluation.aggregationParams.groupBy.push({
|
|
253
|
-
field: gridPrimaryKeyColumn,
|
|
254
|
-
toKey: mapGroupByToKey(gridPrimaryKeyColumn),
|
|
255
|
-
});
|
|
256
|
-
// 3. cumulate
|
|
257
|
-
return scalarAggregationHelper_1.cumulate(expressionEvaluation.aggregationParams, gridRowNodes);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
getAggregationValue(rowNode) {
|
|
261
|
-
var _a, _b;
|
|
262
|
-
if ((_a = this.expressionEvaluation.aggregationParams.groupBy) === null || _a === void 0 ? void 0 : _a.length) {
|
|
263
|
-
const groupColumns = this.expressionEvaluation.aggregationParams.groupBy.map((groupByParam) => groupByParam.field);
|
|
264
|
-
const groupKeys = groupColumns.map((groupColumnName) => this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, groupColumnName));
|
|
265
|
-
return (_b = this.aggregationResult.deepMap.get(groupKeys)) === null || _b === void 0 ? void 0 : _b.reducerResults[this.aggregationReducerName];
|
|
266
|
-
}
|
|
267
|
-
return this.aggregationResult.reducerResults[this.aggregationReducerName];
|
|
268
|
-
}
|
|
269
|
-
}
|
|
@@ -5,6 +5,6 @@ export interface ICalculatedColumnExpressionService extends IAdaptableService {
|
|
|
5
5
|
isCalculatedColumnQueryValid(calculatedColumnQuery: AdaptableCalculatedColumnQuery): boolean;
|
|
6
6
|
evaluateCalculatedColumnQuery(calculatedColumn: CalculatedColumn, rowNode: RowNode): any;
|
|
7
7
|
getCalculatedColumnDataType(calculatedColumnQuery: AdaptableCalculatedColumnQuery): 'String' | 'Number' | 'Boolean' | 'Date';
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
createAggregatedScalarLiveValue(calculatedColumn: CalculatedColumn): void;
|
|
9
|
+
destroyAggregatedScalarLiveValue(calculatedColumn: CalculatedColumn): void;
|
|
10
10
|
}
|
|
@@ -3,14 +3,15 @@ import { IAdaptableService } from './IAdaptableService';
|
|
|
3
3
|
import { RowNode } from '@ag-grid-community/all-modules';
|
|
4
4
|
import { CellDataChangedInfo } from '../../../PredefinedConfig/Common/CellDataChangedInfo';
|
|
5
5
|
import { AdaptableModule } from '../../../PredefinedConfig/Common/Types';
|
|
6
|
-
import {
|
|
6
|
+
import { ScalarAggregationParameter } from '../../ExpressionFunctions/aggregatedScalarExpressionFunctions';
|
|
7
7
|
import { ModuleExpressionFunctions } from '../../../AdaptableOptions/AdaptableQLOptions';
|
|
8
|
+
import { BooleanAggregationParameter } from '../../ExpressionFunctions/aggregatedBooleanExpressionFunctions';
|
|
8
9
|
export interface IQueryLanguageService extends IAdaptableService {
|
|
9
10
|
evaluateBooleanExpression(expression: string, module: AdaptableModule, rowNode: RowNode): boolean;
|
|
10
11
|
evaluateScalarExpression(expression: string, module: AdaptableModule, rowNode: RowNode): any;
|
|
11
12
|
evaluateObservableExpression(expression: string, module: AdaptableModule): Observable<CellDataChangedInfo>;
|
|
12
|
-
evaluateAggregatedBooleanExpression(expression: string, module: AdaptableModule):
|
|
13
|
-
evaluateAggregatedScalarExpression(expression: string, module: AdaptableModule):
|
|
13
|
+
evaluateAggregatedBooleanExpression(expression: string, module: AdaptableModule): BooleanAggregationParameter;
|
|
14
|
+
evaluateAggregatedScalarExpression(expression: string, module: AdaptableModule): ScalarAggregationParameter;
|
|
14
15
|
validateBoolean(expression: string, module: AdaptableModule, config?: {
|
|
15
16
|
force?: boolean;
|
|
16
17
|
}): {
|
|
@@ -29,7 +30,9 @@ export interface IQueryLanguageService extends IAdaptableService {
|
|
|
29
30
|
isValid: boolean;
|
|
30
31
|
errorMessage: string;
|
|
31
32
|
};
|
|
33
|
+
computeAggregatedBooleanValue(expression: string, module: AdaptableModule): boolean;
|
|
32
34
|
getModuleExpressionFunctions(module: AdaptableModule): ModuleExpressionFunctions;
|
|
33
35
|
getColumnsFromExpression(input: string): string[];
|
|
34
36
|
getNamedQueryNamesFromExpression(input: string): string[];
|
|
37
|
+
isCumulativeAggregate(input: string): boolean;
|
|
35
38
|
}
|
|
@@ -4,8 +4,9 @@ import { CellDataChangedInfo } from '../../PredefinedConfig/Common/CellDataChang
|
|
|
4
4
|
import { RowNode } from '@ag-grid-community/all-modules';
|
|
5
5
|
import { AdaptableModule } from '../../PredefinedConfig/Common/Types';
|
|
6
6
|
import { ModuleExpressionFunctions } from '../../AdaptableOptions/AdaptableQLOptions';
|
|
7
|
-
import {
|
|
7
|
+
import { ScalarAggregationParameter } from '../ExpressionFunctions/aggregatedScalarExpressionFunctions';
|
|
8
8
|
import { AdaptableApi } from '../../../types';
|
|
9
|
+
import { BooleanAggregationParameter } from '../ExpressionFunctions/aggregatedBooleanExpressionFunctions';
|
|
9
10
|
export declare class QueryLanguageService implements IQueryLanguageService {
|
|
10
11
|
private adaptableApi;
|
|
11
12
|
private cacheBooleanValidation;
|
|
@@ -16,9 +17,9 @@ export declare class QueryLanguageService implements IQueryLanguageService {
|
|
|
16
17
|
constructor(adaptableApi: AdaptableApi);
|
|
17
18
|
evaluateBooleanExpression(expression: string, module: AdaptableModule, rowNode: any): any;
|
|
18
19
|
evaluateScalarExpression(expression: string, module: AdaptableModule, rowNode: RowNode): any;
|
|
19
|
-
evaluateAggregatedScalarExpression(expression: string, module: AdaptableModule):
|
|
20
|
+
evaluateAggregatedScalarExpression(expression: string, module: AdaptableModule): ScalarAggregationParameter;
|
|
20
21
|
evaluateObservableExpression(reactiveExpression: string, module: AdaptableModule): Observable<CellDataChangedInfo>;
|
|
21
|
-
evaluateAggregatedBooleanExpression(aggregationExpression: string, module: AdaptableModule):
|
|
22
|
+
evaluateAggregatedBooleanExpression(aggregationExpression: string, module: AdaptableModule): BooleanAggregationParameter;
|
|
22
23
|
validateBoolean(expressionInput: string, module: AdaptableModule, config?: {
|
|
23
24
|
force?: boolean;
|
|
24
25
|
}): {
|
|
@@ -37,8 +38,10 @@ export declare class QueryLanguageService implements IQueryLanguageService {
|
|
|
37
38
|
isValid: boolean;
|
|
38
39
|
errorMessage: string;
|
|
39
40
|
};
|
|
41
|
+
computeAggregatedBooleanValue(expression: string, module: AdaptableModule): boolean;
|
|
40
42
|
getColumnsFromExpression(input?: string): string[];
|
|
41
43
|
getNamedQueryNamesFromExpression(input?: string): string[];
|
|
44
|
+
isCumulativeAggregate(input: string): boolean;
|
|
42
45
|
getModuleExpressionFunctions(module: AdaptableModule): ModuleExpressionFunctions;
|
|
43
46
|
destroy(): void;
|
|
44
47
|
private getBooleanAndScalarFunctions;
|
|
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const parser = tslib_1.__importStar(require("../../parser/src"));
|
|
6
6
|
const rxjs_1 = require("rxjs");
|
|
7
7
|
const LoggingHelper_1 = require("../Helpers/LoggingHelper");
|
|
8
|
+
const AggregatedScalarLiveValue_1 = require("./AggregatedScalarLiveValue");
|
|
8
9
|
class QueryLanguageService {
|
|
9
10
|
constructor(adaptableApi) {
|
|
10
11
|
this.adaptableApi = adaptableApi;
|
|
@@ -49,13 +50,13 @@ class QueryLanguageService {
|
|
|
49
50
|
evaluateAggregatedBooleanExpression(aggregationExpression, module) {
|
|
50
51
|
const moduleExpressionFunctions = this.getModuleExpressionFunctions(module);
|
|
51
52
|
const booleanAndScalarFunctions = this.getBooleanAndScalarFunctions(moduleExpressionFunctions);
|
|
52
|
-
const
|
|
53
|
+
const aggregationEvaluation = parser.evaluate(aggregationExpression, {
|
|
53
54
|
node: aggregationExpression,
|
|
54
55
|
adaptableApi: this.adaptableApi,
|
|
55
56
|
functions: moduleExpressionFunctions.aggregatedBooleanFunctions,
|
|
56
57
|
whereClauseFunctions: booleanAndScalarFunctions,
|
|
57
58
|
});
|
|
58
|
-
return
|
|
59
|
+
return aggregationEvaluation;
|
|
59
60
|
}
|
|
60
61
|
validateBoolean(expressionInput = '', module, config = { force: false }) {
|
|
61
62
|
var _a;
|
|
@@ -170,15 +171,16 @@ class QueryLanguageService {
|
|
|
170
171
|
return result;
|
|
171
172
|
}
|
|
172
173
|
try {
|
|
173
|
-
const
|
|
174
|
-
if (
|
|
174
|
+
const evaluationResult = this.evaluateAggregatedBooleanExpression(expression, module);
|
|
175
|
+
if (evaluationResult.type !== 'aggregationBoolean') {
|
|
175
176
|
const result = {
|
|
176
177
|
isValid: false,
|
|
177
|
-
errorMessage:
|
|
178
|
+
errorMessage: 'provided AggregatedBBoolean expression does not evaluate to a supported aggregation',
|
|
178
179
|
};
|
|
179
180
|
this.cacheAggregatedBooleanValidation.set(cacheKey, result);
|
|
180
181
|
return result;
|
|
181
182
|
}
|
|
183
|
+
// no exception,so everything seems to be fine
|
|
182
184
|
const result = { isValid: true, errorMessage: '' };
|
|
183
185
|
this.cacheAggregatedBooleanValidation.set(cacheKey, result);
|
|
184
186
|
return result;
|
|
@@ -208,7 +210,7 @@ class QueryLanguageService {
|
|
|
208
210
|
}
|
|
209
211
|
try {
|
|
210
212
|
const evaluationResult = this.evaluateAggregatedScalarExpression(expression, module);
|
|
211
|
-
if (evaluationResult.type !== '
|
|
213
|
+
if (evaluationResult.type !== 'aggregationScalar') {
|
|
212
214
|
const result = {
|
|
213
215
|
isValid: false,
|
|
214
216
|
errorMessage: 'provided AggregatedScalar expression does not evaluate to a supported aggregation',
|
|
@@ -230,12 +232,27 @@ class QueryLanguageService {
|
|
|
230
232
|
return result;
|
|
231
233
|
}
|
|
232
234
|
}
|
|
235
|
+
computeAggregatedBooleanValue(expression, module) {
|
|
236
|
+
const booleanAggregationParameter = this.evaluateAggregatedBooleanExpression(expression, module);
|
|
237
|
+
const aggregatedScalarExpressionEvaluation = booleanAggregationParameter.scalarAggregation.value;
|
|
238
|
+
const aggregatedScalarLiveValue = new AggregatedScalarLiveValue_1.AggregatedScalarLiveValue({ aggregatedScalarExpressionEvaluation }, module, this.adaptableApi);
|
|
239
|
+
const allAggregationValues = aggregatedScalarLiveValue.getAllAggregationValues();
|
|
240
|
+
const numericOperand = booleanAggregationParameter.conditionValue;
|
|
241
|
+
const booleanConditionFn = booleanAggregationParameter.conditionFn;
|
|
242
|
+
return allAggregationValues.some((aggregationValue) => {
|
|
243
|
+
return booleanConditionFn(aggregationValue, numericOperand);
|
|
244
|
+
});
|
|
245
|
+
}
|
|
233
246
|
getColumnsFromExpression(input = '') {
|
|
234
247
|
return this.getNodesFromExpression(input, 'COL');
|
|
235
248
|
}
|
|
236
249
|
getNamedQueryNamesFromExpression(input = '') {
|
|
237
250
|
return this.getNodesFromExpression(input, 'QUERY');
|
|
238
251
|
}
|
|
252
|
+
isCumulativeAggregate(input) {
|
|
253
|
+
var _a;
|
|
254
|
+
return !!((_a = this.getNodesFromExpression(input, 'CUMUL')) === null || _a === void 0 ? void 0 : _a.length);
|
|
255
|
+
}
|
|
239
256
|
// Returns the ExpressionFunctions available for the given Module as specified in the `QueryLanguageOptions.moduleExpressionFunctions`
|
|
240
257
|
// if there are no specific functions defined, it falls back to the default values
|
|
241
258
|
getModuleExpressionFunctions(module) {
|
|
@@ -21,8 +21,8 @@ class ReportService {
|
|
|
21
21
|
return {
|
|
22
22
|
Uuid: Uuid_1.createUuid(),
|
|
23
23
|
Name: GeneralConstants_1.VISUAL_DATA_REPORT,
|
|
24
|
-
ReportColumnScope:
|
|
25
|
-
ReportRowScope:
|
|
24
|
+
ReportColumnScope: 'VisibleColumns',
|
|
25
|
+
ReportRowScope: 'VisibleRows',
|
|
26
26
|
Query: undefined,
|
|
27
27
|
IsReadOnly: true,
|
|
28
28
|
};
|
|
@@ -30,8 +30,8 @@ class ReportService {
|
|
|
30
30
|
return {
|
|
31
31
|
Uuid: Uuid_1.createUuid(),
|
|
32
32
|
Name: GeneralConstants_1.ALL_DATA_REPORT,
|
|
33
|
-
ReportColumnScope:
|
|
34
|
-
ReportRowScope:
|
|
33
|
+
ReportColumnScope: 'AllColumns',
|
|
34
|
+
ReportRowScope: 'AllRows',
|
|
35
35
|
Query: undefined,
|
|
36
36
|
IsReadOnly: true,
|
|
37
37
|
};
|
|
@@ -39,8 +39,8 @@ class ReportService {
|
|
|
39
39
|
return {
|
|
40
40
|
Uuid: Uuid_1.createUuid(),
|
|
41
41
|
Name: GeneralConstants_1.CURRENT_DATA_REPORT,
|
|
42
|
-
ReportColumnScope:
|
|
43
|
-
ReportRowScope:
|
|
42
|
+
ReportColumnScope: 'VisibleColumns',
|
|
43
|
+
ReportRowScope: 'VisibleRows',
|
|
44
44
|
Query: undefined,
|
|
45
45
|
IsReadOnly: true,
|
|
46
46
|
};
|
|
@@ -48,8 +48,8 @@ class ReportService {
|
|
|
48
48
|
return {
|
|
49
49
|
Uuid: Uuid_1.createUuid(),
|
|
50
50
|
Name: GeneralConstants_1.SELECTED_CELLS_REPORT,
|
|
51
|
-
ReportColumnScope:
|
|
52
|
-
ReportRowScope:
|
|
51
|
+
ReportColumnScope: 'SelectedColumns',
|
|
52
|
+
ReportRowScope: 'SelectedCellRows',
|
|
53
53
|
Query: undefined,
|
|
54
54
|
IsReadOnly: true,
|
|
55
55
|
};
|
|
@@ -57,8 +57,8 @@ class ReportService {
|
|
|
57
57
|
return {
|
|
58
58
|
Uuid: Uuid_1.createUuid(),
|
|
59
59
|
Name: GeneralConstants_1.SELECTED_ROWS_REPORT,
|
|
60
|
-
ReportColumnScope:
|
|
61
|
-
ReportRowScope:
|
|
60
|
+
ReportColumnScope: 'VisibleColumns',
|
|
61
|
+
ReportRowScope: 'SelectedRows',
|
|
62
62
|
Query: undefined,
|
|
63
63
|
IsReadOnly: true,
|
|
64
64
|
};
|
|
@@ -91,38 +91,43 @@ class ReportService {
|
|
|
91
91
|
}
|
|
92
92
|
GetReportColumnScopeShortDescription(report) {
|
|
93
93
|
var _a, _b;
|
|
94
|
+
if (this.adaptableApi.exportApi.isCustomReport(report)) {
|
|
95
|
+
return ['[Custom Columns]'];
|
|
96
|
+
}
|
|
94
97
|
switch (report.ReportColumnScope) {
|
|
95
|
-
case
|
|
98
|
+
case 'AllColumns':
|
|
96
99
|
return ['[All Columns]'];
|
|
97
|
-
case
|
|
100
|
+
case 'VisibleColumns':
|
|
98
101
|
return ['[Visible Columns]'];
|
|
99
|
-
case
|
|
102
|
+
case 'SelectedColumns':
|
|
100
103
|
return ['[Selected Columns]'];
|
|
101
|
-
case
|
|
104
|
+
case 'ScopeColumns':
|
|
102
105
|
if ('ColumnIds' in (report === null || report === void 0 ? void 0 : report.Scope)) {
|
|
103
106
|
return (_b = (_a = report.Scope.ColumnIds).map) === null || _b === void 0 ? void 0 : _b.call(_a, (columnId) => { var _a; return (_a = this.adaptableApi.columnApi.getFriendlyNameFromColumnId(columnId)) !== null && _a !== void 0 ? _a : columnId; });
|
|
104
107
|
}
|
|
105
108
|
return ['[Bespoke Columns]'];
|
|
106
|
-
case Enums_1.ReportColumnScope.CustomColumns:
|
|
107
|
-
return ['[Custom Columns]'];
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
GetReportColumnScopeLongDescription(report) {
|
|
112
|
+
if (this.adaptableApi.exportApi.isCustomReport(report)) {
|
|
113
|
+
return '[Custom Columns]';
|
|
114
|
+
}
|
|
111
115
|
switch (report.ReportColumnScope) {
|
|
112
|
-
case
|
|
116
|
+
case 'AllColumns':
|
|
113
117
|
return '[All Columns]';
|
|
114
|
-
case
|
|
118
|
+
case 'VisibleColumns':
|
|
115
119
|
return '[Visible Columns]';
|
|
116
|
-
case
|
|
120
|
+
case 'SelectedColumns':
|
|
117
121
|
return '[Selected Columns]';
|
|
118
|
-
case
|
|
122
|
+
case 'ScopeColumns':
|
|
119
123
|
return this.adaptableApi.scopeApi.getScopeDescription(report.Scope);
|
|
120
|
-
case Enums_1.ReportColumnScope.CustomColumns:
|
|
121
|
-
return '[Custom Columns]';
|
|
122
124
|
}
|
|
123
125
|
}
|
|
124
126
|
GetReportExpressionDescription(report, cols) {
|
|
125
127
|
var _a;
|
|
128
|
+
if (this.adaptableApi.exportApi.isCustomReport(report)) {
|
|
129
|
+
return '[Custom Data]';
|
|
130
|
+
}
|
|
126
131
|
if (this.IsSystemReport(report.Name)) {
|
|
127
132
|
if (report.Name == GeneralConstants_1.ALL_DATA_REPORT) {
|
|
128
133
|
return '[All Data]';
|
|
@@ -142,38 +147,39 @@ class ReportService {
|
|
|
142
147
|
}
|
|
143
148
|
else {
|
|
144
149
|
switch (report.ReportRowScope) {
|
|
145
|
-
case
|
|
150
|
+
case 'AllRows':
|
|
146
151
|
return '[All Rows]';
|
|
147
|
-
case
|
|
152
|
+
case 'VisibleRows':
|
|
148
153
|
return '[Visible Rows]';
|
|
149
|
-
case
|
|
154
|
+
case 'SelectedRows':
|
|
150
155
|
return '[Selected Rows]';
|
|
151
|
-
case
|
|
156
|
+
case 'ExpressionRows':
|
|
152
157
|
return (_a = report.Query) === null || _a === void 0 ? void 0 : _a.BooleanExpression;
|
|
153
|
-
case Enums_1.ReportRowScope.CustomRows:
|
|
154
|
-
return '[Custom Rows]';
|
|
155
158
|
}
|
|
156
159
|
}
|
|
157
160
|
}
|
|
158
161
|
GetReportColumnsForReport(report, includePrimaryKey = false) {
|
|
159
162
|
let reportColumns = [];
|
|
160
163
|
let gridColumns = this.adaptableApi.columnApi.getColumns();
|
|
164
|
+
if (this.adaptableApi.exportApi.isCustomReport(report)) {
|
|
165
|
+
return reportColumns;
|
|
166
|
+
}
|
|
161
167
|
// first get the cols depending on the Column Scope
|
|
162
168
|
switch (report.ReportColumnScope) {
|
|
163
|
-
case
|
|
169
|
+
case 'AllColumns':
|
|
164
170
|
reportColumns = gridColumns;
|
|
165
171
|
break;
|
|
166
|
-
case
|
|
172
|
+
case 'VisibleColumns':
|
|
167
173
|
reportColumns = gridColumns.filter((c) => c.visible);
|
|
168
174
|
break;
|
|
169
|
-
case
|
|
175
|
+
case 'SelectedColumns':
|
|
170
176
|
// we extract the selected columns from the grid columns to preserve the grid column order
|
|
171
177
|
const selectedColumnIds = this.adaptableApi.gridApi
|
|
172
178
|
.getSelectedCellInfo()
|
|
173
179
|
.columns.map((column) => column.columnId);
|
|
174
180
|
reportColumns = gridColumns.filter((gridColumn) => selectedColumnIds.includes(gridColumn.columnId));
|
|
175
181
|
break;
|
|
176
|
-
case
|
|
182
|
+
case 'ScopeColumns':
|
|
177
183
|
if ('ColumnIds' in report.Scope) {
|
|
178
184
|
reportColumns = report.Scope.ColumnIds.map((columnId) => this.adaptableApi.columnApi.getColumnFromId(columnId)).filter((c) => c);
|
|
179
185
|
}
|
|
@@ -181,9 +187,6 @@ class ReportService {
|
|
|
181
187
|
reportColumns = this.adaptableApi.scopeApi.getColumnsForScope(report.Scope);
|
|
182
188
|
}
|
|
183
189
|
break;
|
|
184
|
-
case Enums_1.ReportColumnScope.CustomColumns:
|
|
185
|
-
// nothing required if custom coluns
|
|
186
|
-
break;
|
|
187
190
|
}
|
|
188
191
|
if (includePrimaryKey) {
|
|
189
192
|
const pkColumn = reportColumns.find((column) => column.columnId === this.adaptableApi.internalApi.getAdaptableOptions().primaryKey);
|
|
@@ -202,14 +205,16 @@ class ReportService {
|
|
|
202
205
|
friendlyName: column.friendlyName,
|
|
203
206
|
dataType: column.dataType,
|
|
204
207
|
}));
|
|
205
|
-
if (
|
|
206
|
-
|
|
208
|
+
if (this.adaptableApi.exportApi.isCustomReport(report)) {
|
|
209
|
+
return this.adaptableApi.exportApi.runCustomReport(report.Name);
|
|
210
|
+
}
|
|
211
|
+
if (ArrayExtensions_1.default.IsNullOrEmpty(columns)) {
|
|
207
212
|
return { columns: [], rows: [] };
|
|
208
213
|
}
|
|
209
214
|
const data = { columns, rows: [] };
|
|
210
215
|
const columnIds = columns.map((column) => column.columnId);
|
|
211
216
|
switch (report.ReportRowScope) {
|
|
212
|
-
case
|
|
217
|
+
case 'AllRows':
|
|
213
218
|
this.adaptableApi.internalApi.forAllRowNodesDo((rowNode) => {
|
|
214
219
|
// skip row groups
|
|
215
220
|
if (!rowNode.group) {
|
|
@@ -217,7 +222,7 @@ class ReportService {
|
|
|
217
222
|
}
|
|
218
223
|
});
|
|
219
224
|
break;
|
|
220
|
-
case
|
|
225
|
+
case 'VisibleRows':
|
|
221
226
|
this.adaptableApi.internalApi.forAllVisibleRowNodesDo((rowNode) => {
|
|
222
227
|
// skip row groups
|
|
223
228
|
if (!rowNode.group) {
|
|
@@ -225,7 +230,7 @@ class ReportService {
|
|
|
225
230
|
}
|
|
226
231
|
});
|
|
227
232
|
break;
|
|
228
|
-
case
|
|
233
|
+
case 'ExpressionRows':
|
|
229
234
|
this.adaptableApi.internalApi.forAllRowNodesDo((rowNode) => {
|
|
230
235
|
var _a;
|
|
231
236
|
if (this.adaptableApi.internalApi
|
|
@@ -235,7 +240,7 @@ class ReportService {
|
|
|
235
240
|
}
|
|
236
241
|
});
|
|
237
242
|
break;
|
|
238
|
-
case
|
|
243
|
+
case 'SelectedCellRows':
|
|
239
244
|
const selectedCellInfo = this.adaptableApi.gridApi.getSelectedCellInfo();
|
|
240
245
|
const { gridCells: GridCells } = selectedCellInfo;
|
|
241
246
|
let selectedCellsByPrimaryKey = groupBy_1.default(GridCells, 'primaryKeyValue');
|
|
@@ -255,7 +260,7 @@ class ReportService {
|
|
|
255
260
|
}
|
|
256
261
|
});
|
|
257
262
|
break;
|
|
258
|
-
case
|
|
263
|
+
case 'SelectedRows':
|
|
259
264
|
const selectedRowInfo = this.adaptableApi.gridApi.getSelectedRowInfo();
|
|
260
265
|
const selectedGridRowPrimaryKeys = (_b = (_a = selectedRowInfo === null || selectedRowInfo === void 0 ? void 0 : selectedRowInfo.gridRows) === null || _a === void 0 ? void 0 : _a.filter((gr) => gr.rowInfo.isGroup == false).map((gridRow) => gridRow.primaryKeyValue)) !== null && _b !== void 0 ? _b : [];
|
|
261
266
|
if (selectedGridRowPrimaryKeys.length) {
|
|
@@ -267,10 +272,6 @@ class ReportService {
|
|
|
267
272
|
});
|
|
268
273
|
}
|
|
269
274
|
break;
|
|
270
|
-
case Enums_1.ReportRowScope.CustomRows:
|
|
271
|
-
const reportData = this.adaptableApi.exportApi.runCustomReport(report.Name);
|
|
272
|
-
return reportData;
|
|
273
|
-
// break;
|
|
274
275
|
}
|
|
275
276
|
return data;
|
|
276
277
|
}
|