@adaptabletools/adaptable 12.1.6 → 12.1.8-canary.1
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 +106 -106
- 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 +2 -0
- package/src/AdaptableOptions/ColumnOptions.d.ts +2 -4
- 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/FlashingCellApi.d.ts +8 -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 -1
- 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 +35 -3
- package/src/Api/Implementation/FlashingCellApiImpl.d.ts +1 -0
- package/src/Api/Implementation/FlashingCellApiImpl.js +4 -0
- 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/Api/SystemStatusApi.d.ts +1 -1
- package/src/Api/ToolPanelApi.d.ts +1 -1
- package/src/PredefinedConfig/CalculatedColumnState.d.ts +2 -2
- package/src/PredefinedConfig/Common/AdaptablePredicate.js +30 -10
- 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/Common/SpecialColumnSettings.d.ts +6 -6
- 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/ActionsReducers/SystemRedux.d.ts +1 -2
- package/src/Redux/ActionsReducers/SystemRedux.js +1 -2
- package/src/Redux/Store/AdaptableStore.js +20 -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/FlashingCellModule.js +2 -2
- 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/Helpers/CalendarHelper.js +10 -7
- package/src/Utilities/Helpers/DateHelper.d.ts +0 -26
- package/src/Utilities/Helpers/DateHelper.js +2 -32
- package/src/Utilities/Interface/MessagePopups.d.ts +0 -4
- package/src/Utilities/ObjectFactory.d.ts +6 -4
- package/src/Utilities/ObjectFactory.js +30 -17
- 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} +5 -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 +21 -15
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.d.ts +1 -2
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +10 -53
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.js +14 -3
- package/src/View/Components/AdaptableDateInput/index.js +1 -1
- 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/FreeTextColumn/FreeTextColumnSummary.js +1 -2
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.d.ts +1 -1
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnWizard.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 +11 -3
- package/src/agGrid/Adaptable.js +224 -150
- 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/bundle-dependencies/bundles/react-toastify/index.js +1 -1
- 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
|
@@ -15,7 +15,13 @@ export declare const isTextSearchCaseInsensitive: (context: ExpressionContext) =
|
|
|
15
15
|
export declare const getDataChangeLog$: (context: ExpressionContext, columnNameFilter: string) => Observable<CellDataChangedInfo>;
|
|
16
16
|
export declare const handleWhereFunction: (args: any[], context: ExpressionContext) => any;
|
|
17
17
|
export declare const extractColumnParameter: (consumingFunctionName: string, args: BaseParameter[]) => ColumnParameter;
|
|
18
|
-
export declare const
|
|
18
|
+
export declare const extractColumnParameters: (consumingFunctionName: string, args: BaseParameter[]) => ColumnParameter[];
|
|
19
|
+
export declare const extractParameter: <T extends BaseParameter<string, string>>(consumingFunctionName: string, allowedType: T["type"], allowedOperands: T["name"][], args: BaseParameter[], config?: {
|
|
20
|
+
isOptional?: boolean;
|
|
21
|
+
}) => T;
|
|
22
|
+
export declare const extractParameters: <T extends BaseParameter<string, string>>(consumingFunctionName: string, allowedType: T["type"], allowedOperands: T["name"][], args: BaseParameter[], config?: {
|
|
23
|
+
isOptional?: boolean;
|
|
24
|
+
}) => T[];
|
|
19
25
|
export declare const handleColumnFunction: (args: any[], context: ExpressionContext) => ColumnParameter;
|
|
20
26
|
export declare const getNumericValue: (input: unknown) => number;
|
|
21
27
|
export declare const validateColumnType: (columnId: string, validColumnTypes: ('Number' | 'String' | 'Date')[], consumingFunction: string, api: AdaptableApi) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateColumnType = exports.getNumericValue = exports.handleColumnFunction = exports.extractParameter = exports.extractColumnParameter = exports.handleWhereFunction = exports.getDataChangeLog$ = exports.isTextSearchCaseInsensitive = exports.getStringValue = exports.getStringValues = void 0;
|
|
3
|
+
exports.validateColumnType = exports.getNumericValue = exports.handleColumnFunction = exports.extractParameters = exports.extractParameter = exports.extractColumnParameters = exports.extractColumnParameter = exports.handleWhereFunction = exports.getDataChangeLog$ = exports.isTextSearchCaseInsensitive = exports.getStringValue = exports.getStringValues = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const ExpressionEvaluationError_1 = require("../../parser/src/ExpressionEvaluationError");
|
|
6
6
|
const StringExtensions_1 = tslib_1.__importDefault(require("../Extensions/StringExtensions"));
|
|
@@ -58,20 +58,33 @@ const extractColumnParameter = (consumingFunctionName, args) => {
|
|
|
58
58
|
return exports.extractParameter(consumingFunctionName, 'config', ['COL'], args);
|
|
59
59
|
};
|
|
60
60
|
exports.extractColumnParameter = extractColumnParameter;
|
|
61
|
-
const
|
|
61
|
+
const extractColumnParameters = (consumingFunctionName, args) => {
|
|
62
|
+
return exports.extractParameters(consumingFunctionName, 'config', ['COL'], args);
|
|
63
|
+
};
|
|
64
|
+
exports.extractColumnParameters = extractColumnParameters;
|
|
65
|
+
const extractParameter = (consumingFunctionName, allowedType, allowedOperands, args, config) => {
|
|
66
|
+
const parameters = exports.extractParameters(consumingFunctionName, allowedType, allowedOperands, args, config);
|
|
67
|
+
if (parameters == undefined) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (parameters.length > 1) {
|
|
71
|
+
throw new ExpressionEvaluationError_1.ExpressionEvaluationError(consumingFunctionName, `expects only 1 argument of type '${[...new Set(parameters.map((op) => op.name))].join(`' / '`)}'`);
|
|
72
|
+
}
|
|
73
|
+
return parameters[0];
|
|
74
|
+
};
|
|
75
|
+
exports.extractParameter = extractParameter;
|
|
76
|
+
const extractParameters = (consumingFunctionName, allowedType, allowedOperands, args, config) => {
|
|
77
|
+
const { isOptional } = config !== null && config !== void 0 ? config : {};
|
|
62
78
|
const result = args.filter((arg) => (arg === null || arg === void 0 ? void 0 : arg.type) === allowedType && allowedOperands.includes(arg === null || arg === void 0 ? void 0 : arg.name));
|
|
63
79
|
if (isOptional && !result.length) {
|
|
64
80
|
return;
|
|
65
81
|
}
|
|
66
|
-
if (result.length > 1) {
|
|
67
|
-
throw new ExpressionEvaluationError_1.ExpressionEvaluationError(consumingFunctionName, `expects only 1 argument of type '${[...new Set(result.map((op) => op.name))].join(`' / '`)}'`);
|
|
68
|
-
}
|
|
69
82
|
if (!result.length) {
|
|
70
83
|
throw new ExpressionEvaluationError_1.ExpressionEvaluationError(consumingFunctionName, `expects an argument of type '${allowedOperands.join(`' / '`)}'`);
|
|
71
84
|
}
|
|
72
|
-
return result
|
|
85
|
+
return result;
|
|
73
86
|
};
|
|
74
|
-
exports.
|
|
87
|
+
exports.extractParameters = extractParameters;
|
|
75
88
|
const handleColumnFunction = (args, context) => {
|
|
76
89
|
if (StringExtensions_1.default.IsNullOrEmpty(args[0])) {
|
|
77
90
|
throw new ExpressionEvaluationError_1.ExpressionEvaluationError('COL', `no column name is provided`);
|
|
@@ -86,6 +99,9 @@ const handleColumnFunction = (args, context) => {
|
|
|
86
99
|
};
|
|
87
100
|
exports.handleColumnFunction = handleColumnFunction;
|
|
88
101
|
const getNumericValue = (input) => {
|
|
102
|
+
if (typeof input === 'number') {
|
|
103
|
+
return input;
|
|
104
|
+
}
|
|
89
105
|
const numericValue = toNumber_1.default(input);
|
|
90
106
|
return isNaN(numericValue) ? 0 : numericValue;
|
|
91
107
|
};
|
|
@@ -30,4 +30,3 @@ export declare type DeepMapAggregationValueType<DataType, KeyType> = {
|
|
|
30
30
|
};
|
|
31
31
|
export declare type AggregationReducerResult = number;
|
|
32
32
|
export declare function aggregate<DataType, KeyType = any>(aggregateParams: AggregateParams<DataType, KeyType>, data: DataType[]): DataAggregationResult<DataType, KeyType>;
|
|
33
|
-
export declare function cumulate<DataType, KeyType = any>(aggregateParams: AggregateParams<DataType, KeyType>, data: DataType[]): DataAggregationResult<DataType, KeyType>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.aggregate = void 0;
|
|
4
4
|
const deepMap_1 = require("./deepMap");
|
|
5
5
|
function DEFAULT_TO_KEY(value) {
|
|
6
6
|
return value;
|
|
@@ -10,57 +10,10 @@ function aggregate(aggregateParams, data) {
|
|
|
10
10
|
const groupByLength = groupBy.length;
|
|
11
11
|
const deepMap = new deepMap_1.DeepMap();
|
|
12
12
|
let currentGroupKeys = [];
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
for (let i = 0, len = data.length; i < len; i++) {
|
|
16
|
-
let item = data[i];
|
|
17
|
-
for (let groupByIndex = 0; groupByIndex < groupByLength; groupByIndex++) {
|
|
18
|
-
const { field: groupByProperty, toKey: groupToKey } = groupBy[groupByIndex];
|
|
19
|
-
const key = (groupToKey || defaultToKey)(item[groupByProperty], item);
|
|
20
|
-
currentGroupKeys.push(key);
|
|
21
|
-
if (!deepMap.has(currentGroupKeys)) {
|
|
22
|
-
const deepMapGroupValue = {
|
|
23
|
-
items: [],
|
|
24
|
-
reducerResults: Object.assign({}, initialReducerValue),
|
|
25
|
-
};
|
|
26
|
-
deepMap.set(currentGroupKeys, deepMapGroupValue);
|
|
27
|
-
}
|
|
28
|
-
const { items: currentGroupItems, reducerResults } = deepMap.get(currentGroupKeys);
|
|
29
|
-
currentGroupItems.push(item);
|
|
30
|
-
if (reducers) {
|
|
31
|
-
computeReducersFor(item, reducers, reducerResults, i);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
if (reducers) {
|
|
35
|
-
computeReducersFor(item, reducers, globalReducerResults, i);
|
|
36
|
-
}
|
|
37
|
-
currentGroupKeys.length = 0;
|
|
38
|
-
}
|
|
39
|
-
if (reducers) {
|
|
40
|
-
deepMap.visitDepthFirst((deepMapValue, _keys, _indexInGroup, next) => {
|
|
41
|
-
completeReducers(reducers, deepMapValue.reducerResults, deepMapValue.items);
|
|
42
|
-
next === null || next === void 0 ? void 0 : next();
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
if (reducers) {
|
|
46
|
-
completeReducers(reducers, globalReducerResults, data);
|
|
47
|
-
}
|
|
48
|
-
const result = {
|
|
49
|
-
deepMap,
|
|
50
|
-
aggregateParams,
|
|
51
|
-
initialData: data,
|
|
52
|
-
reducerResults: globalReducerResults,
|
|
13
|
+
const getInitialReducerValue = () => {
|
|
14
|
+
return JSON.parse(JSON.stringify(initReducers(reducers)));
|
|
53
15
|
};
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
exports.aggregate = aggregate;
|
|
57
|
-
function cumulate(aggregateParams, data) {
|
|
58
|
-
const { groupBy = [], defaultToKey = DEFAULT_TO_KEY, reducers } = aggregateParams;
|
|
59
|
-
const groupByLength = groupBy.length;
|
|
60
|
-
const deepMap = new deepMap_1.DeepMap();
|
|
61
|
-
let currentGroupKeys = [];
|
|
62
|
-
let initialReducerValue = initReducers(reducers);
|
|
63
|
-
const globalReducerResults = Object.assign({}, initialReducerValue);
|
|
16
|
+
const globalReducerResults = getInitialReducerValue();
|
|
64
17
|
for (let i = 0, len = data.length; i < len; i++) {
|
|
65
18
|
let item = data[i];
|
|
66
19
|
for (let groupByIndex = 0; groupByIndex < groupByLength; groupByIndex++) {
|
|
@@ -70,7 +23,7 @@ function cumulate(aggregateParams, data) {
|
|
|
70
23
|
if (!deepMap.has(currentGroupKeys)) {
|
|
71
24
|
const deepMapGroupValue = {
|
|
72
25
|
items: [],
|
|
73
|
-
reducerResults:
|
|
26
|
+
reducerResults: getInitialReducerValue(),
|
|
74
27
|
};
|
|
75
28
|
deepMap.set(currentGroupKeys, deepMapGroupValue);
|
|
76
29
|
}
|
|
@@ -83,7 +36,6 @@ function cumulate(aggregateParams, data) {
|
|
|
83
36
|
if (reducers) {
|
|
84
37
|
computeReducersFor(item, reducers, globalReducerResults, i);
|
|
85
38
|
}
|
|
86
|
-
initialReducerValue = Object.assign({}, deepMap.get(currentGroupKeys).reducerResults);
|
|
87
39
|
currentGroupKeys.length = 0;
|
|
88
40
|
}
|
|
89
41
|
if (reducers) {
|
|
@@ -103,7 +55,7 @@ function cumulate(aggregateParams, data) {
|
|
|
103
55
|
};
|
|
104
56
|
return result;
|
|
105
57
|
}
|
|
106
|
-
exports.
|
|
58
|
+
exports.aggregate = aggregate;
|
|
107
59
|
function initReducers(reducers) {
|
|
108
60
|
if (!reducers || !Object.keys(reducers).length) {
|
|
109
61
|
return {};
|
|
@@ -30,7 +30,12 @@ const sanitizeNumericResult = (value) => {
|
|
|
30
30
|
exports.scalarExpressionFunctions = {
|
|
31
31
|
ADD: {
|
|
32
32
|
handler(args) {
|
|
33
|
-
|
|
33
|
+
const sanitizedArguments = sanitizeArguments(args, true);
|
|
34
|
+
if (args.length && !sanitizedArguments.length) {
|
|
35
|
+
// expression is syntactically valid, but operates with incompatible values
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
return sanitizedArguments.reduce((a, b) => a + b);
|
|
34
39
|
},
|
|
35
40
|
isHiddenFromMenu: true,
|
|
36
41
|
description: 'Returns the sum of 2 numbers',
|
|
@@ -39,7 +44,12 @@ exports.scalarExpressionFunctions = {
|
|
|
39
44
|
},
|
|
40
45
|
SUB: {
|
|
41
46
|
handler(args) {
|
|
42
|
-
|
|
47
|
+
const sanitizedArguments = sanitizeArguments(args);
|
|
48
|
+
if (args.length && !sanitizedArguments.length) {
|
|
49
|
+
// expression is syntactically valid, but operates with incompatible values
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
return sanitizedArguments.reduce((a, b) => a - b);
|
|
43
53
|
},
|
|
44
54
|
isHiddenFromMenu: true,
|
|
45
55
|
description: 'Returns the difference of 2 numbers',
|
|
@@ -126,10 +136,12 @@ exports.scalarExpressionFunctions = {
|
|
|
126
136
|
},
|
|
127
137
|
AVG: {
|
|
128
138
|
handler(args) {
|
|
129
|
-
|
|
130
|
-
|
|
139
|
+
const sanitizedArguments = sanitizeArguments(args);
|
|
140
|
+
if (args.length && !sanitizedArguments.length) {
|
|
141
|
+
// expression is syntactically valid, but operates with incompatible values
|
|
142
|
+
return;
|
|
131
143
|
}
|
|
132
|
-
return
|
|
144
|
+
return sanitizedArguments.reduce((a, b) => a + b) / args.length;
|
|
133
145
|
},
|
|
134
146
|
description: 'Returns the average of inputted numbers',
|
|
135
147
|
signatures: ['AVG(number, number, ...number)'],
|
|
@@ -298,7 +298,7 @@ function getNextWorkingDay(days = 1) {
|
|
|
298
298
|
let counterDate = new Date();
|
|
299
299
|
while (count < days) {
|
|
300
300
|
counterDate.setDate(counterDate.getDate() + 1);
|
|
301
|
-
if (
|
|
301
|
+
if (isNotWorkingDay(counterDate)) {
|
|
302
302
|
count++;
|
|
303
303
|
}
|
|
304
304
|
}
|
|
@@ -310,7 +310,7 @@ function getPreviousWorkingDay(days = 1) {
|
|
|
310
310
|
let counterDate = new Date();
|
|
311
311
|
while (count < days) {
|
|
312
312
|
counterDate.setDate(counterDate.getDate() - 1);
|
|
313
|
-
if (
|
|
313
|
+
if (isNotWorkingDay(counterDate)) {
|
|
314
314
|
count++;
|
|
315
315
|
}
|
|
316
316
|
}
|
|
@@ -319,14 +319,17 @@ function getPreviousWorkingDay(days = 1) {
|
|
|
319
319
|
exports.getPreviousWorkingDay = getPreviousWorkingDay;
|
|
320
320
|
// pretty sure this can be improved as pretty expensive - though rarely used to be honest
|
|
321
321
|
function isNotWorkingDay(dateToCheck) {
|
|
322
|
-
|
|
322
|
+
/*
|
|
323
|
+
// Removing lookups to current calendar until we decide what to do
|
|
324
|
+
let currentCalendar: string = this.getGeneralOptions().currentCalendar;
|
|
323
325
|
let currentHoliday = getAvailableCalendars().find((c) => c.Name == currentCalendar);
|
|
324
326
|
for (let holiday of currentHoliday.CalendarEntries) {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
327
|
+
let holidayDate = new Date(holiday.HolidayDate);
|
|
328
|
+
if (holidayDate.setHours(0, 0, 0, 0) == dateToCheck.setHours(0, 0, 0, 0)) {
|
|
329
|
+
return false;
|
|
330
|
+
}
|
|
329
331
|
}
|
|
332
|
+
*/
|
|
330
333
|
return dateToCheck.getDay() != 0 && dateToCheck.getDay() != 6;
|
|
331
334
|
}
|
|
332
335
|
exports.isNotWorkingDay = isNotWorkingDay;
|
|
@@ -8,30 +8,4 @@ export declare const isValueValidDate: (data: any) => boolean;
|
|
|
8
8
|
export declare const dateToISO: (date: Date | number | string) => string;
|
|
9
9
|
export declare const parseToISO: (date: string | Date | number, dateFormat?: string) => string;
|
|
10
10
|
export declare const parseDateValue: (dateValue: string | Date | number, dateFormat?: string) => Date | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Creates a date with the same day/month/year/hour with the current timezone.
|
|
13
|
-
* '2022-06-01T17:00:00.000Z' => '2022-06-01T17:00:00.000+03:00' // RO time
|
|
14
|
-
*
|
|
15
|
-
* new Date() always creates the date using the current timezone.
|
|
16
|
-
* To compare two dates, they need to be in the same timezone.
|
|
17
|
-
*
|
|
18
|
-
* @param date Date
|
|
19
|
-
*/
|
|
20
|
-
export declare const utcDateToSameDateInLocale: (date: Date) => Date;
|
|
21
|
-
/**
|
|
22
|
-
* To make sure selected/input date is correct and in the current time-zone.
|
|
23
|
-
|
|
24
|
-
*
|
|
25
|
-
* '2022-06-14' is considered to be '2022-06-13 00:00:00.
|
|
26
|
-
* And when date object is created it uses the current timezone.
|
|
27
|
-
*
|
|
28
|
-
* '2022-06-14' => Mon Jun 13 2022 20:00:00 GMT-0400 (Eastern Daylight Time)
|
|
29
|
-
*
|
|
30
|
-
* @param stringDate date string
|
|
31
|
-
*/
|
|
32
11
|
export declare const parseFilterInputDate: (stringDate: string) => Date;
|
|
33
|
-
/**
|
|
34
|
-
* Used to parse the date from rowDate inside date predicates.
|
|
35
|
-
* The date is parsed in moved to local timezone.
|
|
36
|
-
*/
|
|
37
|
-
export declare const parseFilterValueDate: (value: any) => Date;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.parseFilterInputDate = exports.parseDateValue = exports.parseToISO = exports.dateToISO = exports.isValueValidDate = exports.isValidDate = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const parseISO_1 = tslib_1.__importDefault(require("date-fns/parseISO"));
|
|
6
6
|
const parse_1 = tslib_1.__importDefault(require("date-fns/parse"));
|
|
@@ -63,35 +63,5 @@ const parseDateValue = (dateValue, dateFormat) => {
|
|
|
63
63
|
return dateInstance;
|
|
64
64
|
};
|
|
65
65
|
exports.parseDateValue = parseDateValue;
|
|
66
|
-
|
|
67
|
-
* Creates a date with the same day/month/year/hour with the current timezone.
|
|
68
|
-
* '2022-06-01T17:00:00.000Z' => '2022-06-01T17:00:00.000+03:00' // RO time
|
|
69
|
-
*
|
|
70
|
-
* new Date() always creates the date using the current timezone.
|
|
71
|
-
* To compare two dates, they need to be in the same timezone.
|
|
72
|
-
*
|
|
73
|
-
* @param date Date
|
|
74
|
-
*/
|
|
75
|
-
const utcDateToSameDateInLocale = (date) => {
|
|
76
|
-
return new Date(date.getTime() + date.getTimezoneOffset() * 60 * 1000);
|
|
77
|
-
};
|
|
78
|
-
exports.utcDateToSameDateInLocale = utcDateToSameDateInLocale;
|
|
79
|
-
/**
|
|
80
|
-
* To make sure selected/input date is correct and in the current time-zone.
|
|
81
|
-
|
|
82
|
-
*
|
|
83
|
-
* '2022-06-14' is considered to be '2022-06-13 00:00:00.
|
|
84
|
-
* And when date object is created it uses the current timezone.
|
|
85
|
-
*
|
|
86
|
-
* '2022-06-14' => Mon Jun 13 2022 20:00:00 GMT-0400 (Eastern Daylight Time)
|
|
87
|
-
*
|
|
88
|
-
* @param stringDate date string
|
|
89
|
-
*/
|
|
90
|
-
const parseFilterInputDate = (stringDate) => exports.utcDateToSameDateInLocale(new Date(stringDate));
|
|
66
|
+
const parseFilterInputDate = (stringDate) => new Date(stringDate);
|
|
91
67
|
exports.parseFilterInputDate = parseFilterInputDate;
|
|
92
|
-
/**
|
|
93
|
-
* Used to parse the date from rowDate inside date predicates.
|
|
94
|
-
* The date is parsed in moved to local timezone.
|
|
95
|
-
*/
|
|
96
|
-
const parseFilterValueDate = (value) => exports.utcDateToSameDateInLocale(exports.parseDateValue(value));
|
|
97
|
-
exports.parseFilterValueDate = parseFilterValueDate;
|
|
@@ -2,7 +2,6 @@ import { Action } from 'redux';
|
|
|
2
2
|
import { ModuleParams } from '../../View/Components/SharedProps/ModuleViewPopupProps';
|
|
3
3
|
import { AdaptableModule } from '../../PredefinedConfig/Common/Types';
|
|
4
4
|
import { AdaptableMessageType } from '../../PredefinedConfig/Common/AdaptableMessageType';
|
|
5
|
-
import { AdaptableAlert } from '../../PredefinedConfig/Common/AdaptableAlert';
|
|
6
5
|
import { AdaptableForm, BaseContext } from '../../types';
|
|
7
6
|
export interface UIConfirmation {
|
|
8
7
|
Header: string;
|
|
@@ -36,9 +35,6 @@ export interface ScreenPopup {
|
|
|
36
35
|
export interface LoadingPopup {
|
|
37
36
|
ShowLoadingPopup: boolean;
|
|
38
37
|
}
|
|
39
|
-
export interface AlertPopup {
|
|
40
|
-
Alert: AdaptableAlert | null;
|
|
41
|
-
}
|
|
42
38
|
export interface ConfirmationPopup {
|
|
43
39
|
ShowConfirmationPopup: boolean;
|
|
44
40
|
Header: string;
|
|
@@ -6,7 +6,7 @@ import { AlertDefinition, AlertProperties } from '../PredefinedConfig/AlertState
|
|
|
6
6
|
import { Layout } from '../PredefinedConfig/LayoutState';
|
|
7
7
|
import { Report, ReportSchedule } from '../PredefinedConfig/ExportState';
|
|
8
8
|
import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
|
|
9
|
-
import {
|
|
9
|
+
import { BaseSchedule, Schedule } from '../PredefinedConfig/Common/Schedule';
|
|
10
10
|
import { Shortcut } from '../PredefinedConfig/ShortcutState';
|
|
11
11
|
import { ConditionalStyle } from '../PredefinedConfig/ConditionalStyleState';
|
|
12
12
|
import { FormatColumn } from '../PredefinedConfig/FormatColumnState';
|
|
@@ -16,7 +16,7 @@ import { CellDataChangedInfo } from '../PredefinedConfig/Common/CellDataChangedI
|
|
|
16
16
|
import { Glue42Report, Glue42Schedule } from '../PredefinedConfig/Glue42State';
|
|
17
17
|
import { IPushPullReport } from '../PredefinedConfig/SystemState';
|
|
18
18
|
import { IPushPullSchedule } from '../PredefinedConfig/IPushPullState';
|
|
19
|
-
import {
|
|
19
|
+
import { OpenFinReport, OpenFinSchedule } from '../PredefinedConfig/OpenFinState';
|
|
20
20
|
import { NamedQuery } from '../PredefinedConfig/QueryState';
|
|
21
21
|
import { ReminderSchedule } from '../PredefinedConfig/ScheduleState';
|
|
22
22
|
import { AdaptableCellChangedAlert, AdaptableGenericAlert, AdaptableRowChangedAlert } from '../PredefinedConfig/Common/AdaptableAlert';
|
|
@@ -29,7 +29,7 @@ import { RowNode } from '@ag-grid-community/all-modules';
|
|
|
29
29
|
import { AdaptableApi } from '../../types';
|
|
30
30
|
import { ToastOptions } from '../components/Toastify';
|
|
31
31
|
export declare function CreateEmptyCustomSort(): CustomSort;
|
|
32
|
-
export declare function CreateEmptyCalculatedColumn(
|
|
32
|
+
export declare function CreateEmptyCalculatedColumn(): CalculatedColumn;
|
|
33
33
|
export declare function CreateEmptyNamedQuery(expression?: string): NamedQuery;
|
|
34
34
|
export declare function CreateEmptyPlusMinusNudge(): PlusMinusNudge;
|
|
35
35
|
export declare function CreateGenericAlert(alertHeader: string, alertMessage: string, alertDefinition: AlertDefinition): AdaptableGenericAlert;
|
|
@@ -39,6 +39,7 @@ export declare function CreateEmptyAlertDefinition(): AlertDefinition;
|
|
|
39
39
|
export declare function CreateEmptyFlashingCellDefinition(): FlashingCellDefinition;
|
|
40
40
|
export declare function CreateInternalAlertDefinitionForMessages(messageType: AdaptableMessageType, alertProperties?: AlertProperties): AlertDefinition;
|
|
41
41
|
export declare function CreateEmptyReport(): Report;
|
|
42
|
+
export declare function CreateCustomReport(reportName: string): Report;
|
|
42
43
|
export declare function CreateEmptyBaseSchedule(scheduleType: ScheduleType): BaseSchedule;
|
|
43
44
|
export declare function CreateEmptyReminderSchedule(): ReminderSchedule;
|
|
44
45
|
export declare function CreateEmptyReportSchedule(): ReportSchedule;
|
|
@@ -55,7 +56,7 @@ export declare function CreateEmptySchedule(): Schedule;
|
|
|
55
56
|
export declare function CreateEmptyShortcut(): Shortcut;
|
|
56
57
|
export declare function CreateEmptyConditionalStyle(): ConditionalStyle;
|
|
57
58
|
export declare function CreateEmptyFormatColumn(): FormatColumn;
|
|
58
|
-
export declare function CreateEmptyFreeTextColumn(
|
|
59
|
+
export declare function CreateEmptyFreeTextColumn(): FreeTextColumn;
|
|
59
60
|
export declare function CreateEmptyLayout(layout?: Partial<Layout> & {
|
|
60
61
|
Name: string;
|
|
61
62
|
}, adaptableColumns?: AdaptableColumn[]): Layout;
|
|
@@ -79,6 +80,7 @@ export declare const ObjectFactory: {
|
|
|
79
80
|
CreateEmptyAlertDefinition: typeof CreateEmptyAlertDefinition;
|
|
80
81
|
CreateEmptyFlashingCellDefinition: typeof CreateEmptyFlashingCellDefinition;
|
|
81
82
|
CreateInternalAlertDefinitionForMessages: typeof CreateInternalAlertDefinitionForMessages;
|
|
83
|
+
CreateCustomReport: typeof CreateCustomReport;
|
|
82
84
|
CreateEmptyReport: typeof CreateEmptyReport;
|
|
83
85
|
CreateEmptyBaseSchedule: typeof CreateEmptyBaseSchedule;
|
|
84
86
|
CreateEmptyReminderSchedule: typeof CreateEmptyReminderSchedule;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObjectFactory = exports.CreateToastOptions = exports.CreateCustomDisplayFormatterContext = exports.CreateColumnFilter = exports.CreateEmptyCellSummmary = exports.CreateSystemStatusMessageInfo = exports.CreateEmptyStyle = exports.CreateEmptyLayout = exports.CreateEmptyFreeTextColumn = exports.CreateEmptyFormatColumn = exports.CreateEmptyConditionalStyle = exports.CreateEmptyShortcut = exports.CreateEmptySchedule = exports.CreateReportSchedule = exports.CreateGlue42Schedule = exports.CreateIPushPullSchedule = exports.CreateEmptyOpenFinSchedule = exports.CreateEmptyGlue42Schedule = exports.CreateEmptyIPushPullSchedule = exports.CreateEmptyOpenFinReport = exports.CreateEmptyGlue42Report = exports.CreateEmptyIPushPullReport = exports.CreateEmptyReportSchedule = exports.CreateEmptyReminderSchedule = exports.CreateEmptyBaseSchedule = exports.CreateEmptyReport = exports.CreateInternalAlertDefinitionForMessages = exports.CreateEmptyFlashingCellDefinition = exports.CreateEmptyAlertDefinition = exports.CreateRowChangedAlert = exports.CreateCellChangedAlert = exports.CreateGenericAlert = exports.CreateEmptyPlusMinusNudge = exports.CreateEmptyNamedQuery = exports.CreateEmptyCalculatedColumn = exports.CreateEmptyCustomSort = void 0;
|
|
3
|
+
exports.ObjectFactory = exports.CreateToastOptions = exports.CreateCustomDisplayFormatterContext = exports.CreateColumnFilter = exports.CreateEmptyCellSummmary = exports.CreateSystemStatusMessageInfo = exports.CreateEmptyStyle = exports.CreateEmptyLayout = exports.CreateEmptyFreeTextColumn = exports.CreateEmptyFormatColumn = exports.CreateEmptyConditionalStyle = exports.CreateEmptyShortcut = exports.CreateEmptySchedule = exports.CreateReportSchedule = exports.CreateGlue42Schedule = exports.CreateIPushPullSchedule = exports.CreateEmptyOpenFinSchedule = exports.CreateEmptyGlue42Schedule = exports.CreateEmptyIPushPullSchedule = exports.CreateEmptyOpenFinReport = exports.CreateEmptyGlue42Report = exports.CreateEmptyIPushPullReport = exports.CreateEmptyReportSchedule = exports.CreateEmptyReminderSchedule = exports.CreateEmptyBaseSchedule = exports.CreateCustomReport = exports.CreateEmptyReport = exports.CreateInternalAlertDefinitionForMessages = exports.CreateEmptyFlashingCellDefinition = exports.CreateEmptyAlertDefinition = exports.CreateRowChangedAlert = exports.CreateCellChangedAlert = exports.CreateGenericAlert = exports.CreateEmptyPlusMinusNudge = exports.CreateEmptyNamedQuery = exports.CreateEmptyCalculatedColumn = exports.CreateEmptyCustomSort = void 0;
|
|
4
4
|
const Enums_1 = require("../PredefinedConfig/Common/Enums");
|
|
5
5
|
const GeneralConstants_1 = require("./Constants/GeneralConstants");
|
|
6
6
|
const Uuid_1 = require("../PredefinedConfig/Uuid");
|
|
@@ -9,7 +9,7 @@ function CreateEmptyCustomSort() {
|
|
|
9
9
|
return { Uuid: Uuid_1.createUuid(), ColumnId: GeneralConstants_1.EMPTY_STRING, SortedValues: [] };
|
|
10
10
|
}
|
|
11
11
|
exports.CreateEmptyCustomSort = CreateEmptyCustomSort;
|
|
12
|
-
function CreateEmptyCalculatedColumn(
|
|
12
|
+
function CreateEmptyCalculatedColumn() {
|
|
13
13
|
return {
|
|
14
14
|
Uuid: Uuid_1.createUuid(),
|
|
15
15
|
ColumnId: GeneralConstants_1.EMPTY_STRING,
|
|
@@ -18,12 +18,13 @@ function CreateEmptyCalculatedColumn(isFilterable) {
|
|
|
18
18
|
},
|
|
19
19
|
// need to create some defaults - which we will change later
|
|
20
20
|
CalculatedColumnSettings: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
DataType: undefined,
|
|
22
|
+
Filterable: false,
|
|
23
|
+
Resizable: false,
|
|
24
|
+
Groupable: false,
|
|
25
|
+
Sortable: false,
|
|
26
|
+
Pivotable: false,
|
|
27
|
+
Aggregatable: false,
|
|
27
28
|
SuppressMenu: false,
|
|
28
29
|
SuppressMovable: false,
|
|
29
30
|
},
|
|
@@ -123,12 +124,23 @@ function CreateEmptyReport() {
|
|
|
123
124
|
Uuid: Uuid_1.createUuid(),
|
|
124
125
|
Name: GeneralConstants_1.EMPTY_STRING,
|
|
125
126
|
Scope: undefined,
|
|
126
|
-
ReportColumnScope:
|
|
127
|
-
ReportRowScope:
|
|
127
|
+
ReportColumnScope: 'AllColumns',
|
|
128
|
+
ReportRowScope: 'AllRows',
|
|
128
129
|
Query: undefined,
|
|
129
130
|
};
|
|
130
131
|
}
|
|
131
132
|
exports.CreateEmptyReport = CreateEmptyReport;
|
|
133
|
+
function CreateCustomReport(reportName) {
|
|
134
|
+
return {
|
|
135
|
+
Uuid: Uuid_1.createUuid(),
|
|
136
|
+
Name: reportName,
|
|
137
|
+
Scope: undefined,
|
|
138
|
+
ReportColumnScope: 'AllColumns',
|
|
139
|
+
ReportRowScope: 'AllRows',
|
|
140
|
+
Query: undefined,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
exports.CreateCustomReport = CreateCustomReport;
|
|
132
144
|
function CreateEmptyBaseSchedule(scheduleType) {
|
|
133
145
|
return {
|
|
134
146
|
Uuid: Uuid_1.createUuid(),
|
|
@@ -283,7 +295,7 @@ function CreateEmptyFormatColumn() {
|
|
|
283
295
|
};
|
|
284
296
|
}
|
|
285
297
|
exports.CreateEmptyFormatColumn = CreateEmptyFormatColumn;
|
|
286
|
-
function CreateEmptyFreeTextColumn(
|
|
298
|
+
function CreateEmptyFreeTextColumn() {
|
|
287
299
|
return {
|
|
288
300
|
Uuid: Uuid_1.createUuid(),
|
|
289
301
|
ColumnId: GeneralConstants_1.EMPTY_STRING,
|
|
@@ -292,12 +304,12 @@ function CreateEmptyFreeTextColumn(isFilterable) {
|
|
|
292
304
|
TextEditor: 'Inline',
|
|
293
305
|
DataType: 'String',
|
|
294
306
|
FreeTextColumnSettings: {
|
|
295
|
-
Filterable:
|
|
296
|
-
Resizable:
|
|
297
|
-
Groupable:
|
|
298
|
-
Sortable:
|
|
299
|
-
Pivotable:
|
|
300
|
-
Aggregatable:
|
|
307
|
+
Filterable: false,
|
|
308
|
+
Resizable: false,
|
|
309
|
+
Groupable: false,
|
|
310
|
+
Sortable: false,
|
|
311
|
+
Pivotable: false,
|
|
312
|
+
Aggregatable: false,
|
|
301
313
|
SuppressMenu: false,
|
|
302
314
|
SuppressMovable: false,
|
|
303
315
|
},
|
|
@@ -429,6 +441,7 @@ exports.ObjectFactory = {
|
|
|
429
441
|
CreateEmptyAlertDefinition,
|
|
430
442
|
CreateEmptyFlashingCellDefinition,
|
|
431
443
|
CreateInternalAlertDefinitionForMessages,
|
|
444
|
+
CreateCustomReport,
|
|
432
445
|
CreateEmptyReport,
|
|
433
446
|
CreateEmptyBaseSchedule,
|
|
434
447
|
CreateEmptyReminderSchedule,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AggregatedScalarExpressionEvaluation } from '../ExpressionFunctions/aggregatedScalarExpressionFunctions';
|
|
2
|
+
import { AdaptableApi } from '../../Api/AdaptableApi';
|
|
3
|
+
import { AdaptableModule as ModuleConstants } from '../../PredefinedConfig/Common/Types';
|
|
4
|
+
import { RowNode } from '@ag-grid-community/all-modules';
|
|
5
|
+
import { XOR } from '../Extensions/TypeExtensions';
|
|
6
|
+
export declare class AggregatedScalarLiveValue {
|
|
7
|
+
private source;
|
|
8
|
+
private requestingModule;
|
|
9
|
+
private adaptableApi;
|
|
10
|
+
private aggregationReducerName;
|
|
11
|
+
private aggregatedScalarExpression;
|
|
12
|
+
private expressionEvaluation;
|
|
13
|
+
private aggregationResult;
|
|
14
|
+
constructor(source: XOR<{
|
|
15
|
+
aggregatedScalarExpression: string;
|
|
16
|
+
}, {
|
|
17
|
+
aggregatedScalarExpressionEvaluation: AggregatedScalarExpressionEvaluation;
|
|
18
|
+
}>, requestingModule: ModuleConstants, adaptableApi: AdaptableApi);
|
|
19
|
+
refresh(): void;
|
|
20
|
+
getAggregatedValueForRow(rowNode: RowNode): any;
|
|
21
|
+
getAllAggregationValues(): number[];
|
|
22
|
+
private getAggregationValue;
|
|
23
|
+
private getGlobalAggregatedValue;
|
|
24
|
+
private computeAggregatedValue;
|
|
25
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AggregatedScalarLiveValue = void 0;
|
|
4
|
+
const scalarAggregationHelper_1 = require("../ExpressionFunctions/scalarAggregationHelper");
|
|
5
|
+
class AggregatedScalarLiveValue {
|
|
6
|
+
constructor(source, requestingModule, adaptableApi) {
|
|
7
|
+
this.source = source;
|
|
8
|
+
this.requestingModule = requestingModule;
|
|
9
|
+
this.adaptableApi = adaptableApi;
|
|
10
|
+
if (source.aggregatedScalarExpression) {
|
|
11
|
+
this.aggregatedScalarExpression = source.aggregatedScalarExpression;
|
|
12
|
+
}
|
|
13
|
+
this.expressionEvaluation = source.aggregatedScalarExpression
|
|
14
|
+
? this.adaptableApi.internalApi
|
|
15
|
+
.getQueryLanguageService()
|
|
16
|
+
.evaluateAggregatedScalarExpression(source.aggregatedScalarExpression, requestingModule)
|
|
17
|
+
.value
|
|
18
|
+
: source.aggregatedScalarExpressionEvaluation;
|
|
19
|
+
// currently we support only one reducer
|
|
20
|
+
this.aggregationReducerName = Object.keys(this.expressionEvaluation.aggregationParams.reducers)[0];
|
|
21
|
+
this.aggregationResult = this.computeAggregatedValue(this.expressionEvaluation);
|
|
22
|
+
}
|
|
23
|
+
refresh() {
|
|
24
|
+
if (this.aggregatedScalarExpression) {
|
|
25
|
+
this.expressionEvaluation = this.adaptableApi.internalApi
|
|
26
|
+
.getQueryLanguageService()
|
|
27
|
+
.evaluateAggregatedScalarExpression(this.aggregatedScalarExpression, this.requestingModule).value;
|
|
28
|
+
}
|
|
29
|
+
// currently we support only one reducer
|
|
30
|
+
this.aggregationReducerName = Object.keys(this.expressionEvaluation.aggregationParams.reducers)[0];
|
|
31
|
+
this.aggregationResult = this.computeAggregatedValue(this.expressionEvaluation);
|
|
32
|
+
}
|
|
33
|
+
getAggregatedValueForRow(rowNode) {
|
|
34
|
+
const aggregationValue = this.getAggregationValue(rowNode);
|
|
35
|
+
if (this.expressionEvaluation.rowValueGetter) {
|
|
36
|
+
return this.expressionEvaluation.rowValueGetter(rowNode, aggregationValue);
|
|
37
|
+
}
|
|
38
|
+
return aggregationValue;
|
|
39
|
+
}
|
|
40
|
+
getAllAggregationValues() {
|
|
41
|
+
var _a;
|
|
42
|
+
if ((_a = this.expressionEvaluation.aggregationParams.groupBy) === null || _a === void 0 ? void 0 : _a.length) {
|
|
43
|
+
const aggregations = this.aggregationResult.deepMap.topDownValues();
|
|
44
|
+
return aggregations.map((aggregation) => aggregation.reducerResults[this.aggregationReducerName]);
|
|
45
|
+
}
|
|
46
|
+
return [this.getGlobalAggregatedValue()];
|
|
47
|
+
}
|
|
48
|
+
getAggregationValue(rowNode) {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
if ((_a = this.expressionEvaluation.aggregationParams.groupBy) === null || _a === void 0 ? void 0 : _a.length) {
|
|
51
|
+
const groupColumns = this.expressionEvaluation.aggregationParams.groupBy.map((groupByParam) => groupByParam.field);
|
|
52
|
+
const groupKeys = groupColumns.map((groupColumnName) => this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, groupColumnName));
|
|
53
|
+
return (_b = this.aggregationResult.deepMap.get(groupKeys)) === null || _b === void 0 ? void 0 : _b.reducerResults[this.aggregationReducerName];
|
|
54
|
+
}
|
|
55
|
+
return this.getGlobalAggregatedValue();
|
|
56
|
+
}
|
|
57
|
+
getGlobalAggregatedValue() {
|
|
58
|
+
return this.aggregationResult.reducerResults[this.aggregationReducerName];
|
|
59
|
+
}
|
|
60
|
+
computeAggregatedValue(expressionEvaluation) {
|
|
61
|
+
var _a;
|
|
62
|
+
const gridRowNodes = this.adaptableApi.gridApi.getAllRowNodes({
|
|
63
|
+
filterFn: expressionEvaluation.rowFilterFn,
|
|
64
|
+
});
|
|
65
|
+
// we iterate over the RowNode list (we need this to handle complex column values (nested values, valueGetters etc)
|
|
66
|
+
// so we will map the fieldNames to RowNode.data
|
|
67
|
+
const mapReducerValueGetter = (fieldName) => {
|
|
68
|
+
return (rowNode) => {
|
|
69
|
+
return this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, fieldName);
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
Object.values(expressionEvaluation.aggregationParams.reducers).forEach((aggregationReducer) => {
|
|
73
|
+
aggregationReducer.getter = mapReducerValueGetter(aggregationReducer.field);
|
|
74
|
+
// nullify the field to force the fallback on the getter fn
|
|
75
|
+
aggregationReducer.field = null;
|
|
76
|
+
});
|
|
77
|
+
const mapGroupByToKey = (fieldName) => {
|
|
78
|
+
return (_unusableProperty, rowNode) => this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, fieldName);
|
|
79
|
+
};
|
|
80
|
+
(_a = expressionEvaluation.aggregationParams.groupBy) === null || _a === void 0 ? void 0 : _a.forEach((groupByDef) => {
|
|
81
|
+
groupByDef.toKey = mapGroupByToKey(groupByDef.field);
|
|
82
|
+
});
|
|
83
|
+
let aggregatedRowNodes = gridRowNodes;
|
|
84
|
+
if (expressionEvaluation.sortByColumn) {
|
|
85
|
+
const sortByColumn = expressionEvaluation.sortByColumn;
|
|
86
|
+
const getRowNodeValue = (rowNode, columnId) => this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, columnId);
|
|
87
|
+
// currently, we support only ascending sorting
|
|
88
|
+
aggregatedRowNodes.sort((first, second) => {
|
|
89
|
+
const firstValue = getRowNodeValue(first, sortByColumn);
|
|
90
|
+
const secondValue = getRowNodeValue(second, sortByColumn);
|
|
91
|
+
if (firstValue < secondValue) {
|
|
92
|
+
return -1;
|
|
93
|
+
}
|
|
94
|
+
if (firstValue > secondValue) {
|
|
95
|
+
return 1;
|
|
96
|
+
}
|
|
97
|
+
return 0;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return scalarAggregationHelper_1.aggregate(expressionEvaluation.aggregationParams, aggregatedRowNodes);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.AggregatedScalarLiveValue = AggregatedScalarLiveValue;
|
|
@@ -11,6 +11,5 @@ export declare class AlertService implements IAlertService {
|
|
|
11
11
|
onReactiveAlertTriggered: (callback: EmitterCallback) => (() => void);
|
|
12
12
|
createReactiveAlert(alertDefinition: AlertDefinition): void;
|
|
13
13
|
deleteReactiveAlert(alertDefinition: AlertDefinition): void;
|
|
14
|
-
private isValidExpression;
|
|
15
14
|
private evaluateReactiveExpression;
|
|
16
15
|
}
|