@adaptabletools/adaptable 14.0.3 → 14.1.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 +7 -1
- package/base.css.map +1 -1
- package/bundle.cjs.js +170 -169
- package/index.css +76 -62
- package/index.css.map +1 -1
- package/package.json +2 -2
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableOptions/ActionOptions.d.ts +3 -0
- package/src/AdaptableOptions/AdaptablePlugin.d.ts +3 -0
- package/src/AdaptableOptions/AdaptablePlugin.js +3 -0
- package/src/AdaptableOptions/ChartingOptions.d.ts +1 -1
- package/src/AdaptableOptions/DataChangeHistoryOptions.d.ts +26 -26
- package/src/AdaptableOptions/ExportOptions.d.ts +17 -3
- package/src/Api/CalculatedColumnApi.d.ts +9 -0
- package/src/Api/ChartingApi.d.ts +41 -14
- package/src/Api/ColumnApi.d.ts +4 -0
- package/src/Api/DataSetApi.d.ts +2 -2
- package/src/Api/EventApi.d.ts +15 -1
- package/src/Api/Events/ChartChanged.d.ts +8 -0
- package/src/Api/Events/ChartChanged.js +2 -0
- package/src/Api/ExportApi.d.ts +5 -0
- package/src/Api/Implementation/CalculatedColumnApiImpl.d.ts +2 -0
- package/src/Api/Implementation/CalculatedColumnApiImpl.js +24 -0
- package/src/Api/Implementation/ChartingApiImpl.d.ts +16 -2
- package/src/Api/Implementation/ChartingApiImpl.js +54 -2
- package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
- package/src/Api/Implementation/ColumnApiImpl.js +3 -0
- package/src/Api/Implementation/ExportApiImpl.d.ts +2 -0
- package/src/Api/Implementation/ExportApiImpl.js +10 -0
- package/src/Api/Implementation/PredicateApiImpl.d.ts +6 -4
- package/src/Api/Implementation/PredicateApiImpl.js +20 -1
- package/src/Api/Implementation/QueryApiImpl.js +8 -2
- package/src/Api/Internal/AdaptableInternalApi.d.ts +7 -1
- package/src/Api/Internal/AdaptableInternalApi.js +2 -1
- package/src/Api/Internal/AlertInternalApi.js +1 -1
- package/src/Api/Internal/CalculatedColumnInternalApi.d.ts +2 -0
- package/src/Api/Internal/CalculatedColumnInternalApi.js +9 -0
- package/src/Api/Internal/ChartingInternalApi.d.ts +6 -0
- package/src/Api/Internal/ChartingInternalApi.js +24 -0
- package/src/Api/Internal/FormatColumnInternalApi.d.ts +5 -0
- package/src/Api/Internal/FormatColumnInternalApi.js +25 -1
- package/src/Api/PredicateApi.d.ts +17 -1
- package/src/PredefinedConfig/AlertState.d.ts +5 -2
- package/src/PredefinedConfig/Common/AdaptableAlert.d.ts +6 -0
- package/src/PredefinedConfig/Common/AdaptableColumn.d.ts +15 -11
- package/src/PredefinedConfig/Common/AdaptableForm.d.ts +6 -0
- package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
- package/src/PredefinedConfig/Common/AdaptablePredicate.d.ts +6 -0
- package/src/PredefinedConfig/Common/AdaptableQuery.d.ts +15 -0
- package/src/PredefinedConfig/Common/Enums.d.ts +2 -1
- package/src/PredefinedConfig/Common/Enums.js +1 -0
- package/src/PredefinedConfig/Common/FDC3Context.d.ts +3 -0
- package/src/PredefinedConfig/Common/Types.d.ts +21 -6
- package/src/PredefinedConfig/Common/Types.js +1 -3
- package/src/PredefinedConfig/FlashingCellState.d.ts +2 -2
- package/src/PredefinedConfig/FormatColumnState.d.ts +3 -2
- package/src/PredefinedConfig/FreeTextColumnState.d.ts +1 -1
- package/src/PredefinedConfig/PredefinedConfig.d.ts +4 -4
- package/src/PredefinedConfig/ThemeState.d.ts +0 -4
- package/src/Redux/ActionsReducers/PopupRedux.d.ts +2 -0
- package/src/Redux/ActionsReducers/PopupRedux.js +2 -0
- package/src/Redux/ActionsReducers/StatusBarRedux.d.ts +2 -2
- package/src/Redux/ActionsReducers/StatusBarRedux.js +4 -4
- package/src/Redux/Store/AdaptableStore.js +1 -11
- package/src/Strategy/AlertModule.js +7 -3
- package/src/Strategy/ChartingModule.js +5 -3
- package/src/Strategy/ExportModule.d.ts +1 -0
- package/src/Strategy/ExportModule.js +43 -0
- package/src/Strategy/FlashingCellModule.js +1 -1
- package/src/Strategy/FormatColumnModule.js +7 -2
- package/src/Strategy/Interface/IModule.d.ts +1 -1
- package/src/Strategy/LayoutModule.js +8 -1
- package/src/Strategy/StyledColumnModule.js +5 -0
- package/src/Strategy/ThemeModule.js +8 -2
- package/src/Strategy/Utilities/Alert/getAlertPreviewViewItems.js +2 -2
- package/src/Strategy/Utilities/Alert/getAlertTypeViewItems.d.ts +5 -0
- package/src/Strategy/Utilities/Alert/getAlertTypeViewItems.js +13 -0
- package/src/Strategy/Utilities/getObjectTagsViewItems.js +3 -3
- package/src/Utilities/Constants/ModuleConstants.d.ts +0 -3
- package/src/Utilities/Constants/ModuleConstants.js +2 -5
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +1 -0
- package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.d.ts +1 -1
- package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +3 -1
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +1 -1
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +64 -3
- package/src/Utilities/Interface/MessagePopups.d.ts +1 -0
- package/src/Utilities/Services/AggregatedScalarLiveValue.js +13 -0
- package/src/Utilities/Services/ChartingService.d.ts +8 -0
- package/src/Utilities/Services/ChartingService.js +16 -0
- package/src/Utilities/Services/ReportService.js +1 -1
- package/src/View/AdaptableViewFactory.js +1 -1
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.js +3 -2
- package/src/View/Alert/Utilities/getAlertType.d.ts +15 -0
- package/src/View/Alert/Utilities/getAlertType.js +58 -0
- package/src/View/Alert/Utilities/getAvailablePredicates.d.ts +3 -0
- package/src/View/Alert/Utilities/getAvailablePredicates.js +19 -0
- package/src/View/Alert/Utilities/getDefaultAlertDefinition.d.ts +37 -0
- package/src/View/Alert/Utilities/getDefaultAlertDefinition.js +32 -0
- package/src/View/Alert/Utilities/mapAlertDefinition.d.ts +2 -0
- package/src/View/Alert/Utilities/mapAlertDefinition.js +38 -0
- package/src/View/Alert/Wizard/AlertBehaviourWizardSection.d.ts +4 -2
- package/src/View/Alert/Wizard/AlertBehaviourWizardSection.js +18 -11
- package/src/View/Alert/Wizard/AlertButtonsEditor.d.ts +2 -0
- package/src/View/Alert/Wizard/AlertButtonsEditor.js +15 -6
- package/src/View/Alert/Wizard/AlertMessageWizardSection.d.ts +10 -0
- package/src/View/Alert/Wizard/AlertMessageWizardSection.js +57 -0
- package/src/View/Alert/Wizard/{AlertDisplayWizardSection.d.ts → AlertNotificationWizardSection.d.ts} +7 -5
- package/src/View/Alert/Wizard/{AlertDisplayWizardSection.js → AlertNotificationWizardSection.js} +12 -50
- package/src/View/Alert/Wizard/AlertRulesWizardSection.d.ts +7 -4
- package/src/View/Alert/Wizard/AlertRulesWizardSection.js +66 -6
- package/src/View/Alert/Wizard/AlertScopeWizardSection.d.ts +2 -0
- package/src/View/Alert/Wizard/AlertScopeWizardSection.js +41 -2
- package/src/View/Alert/Wizard/AlertTypeWizardSection.d.ts +9 -0
- package/src/View/Alert/Wizard/AlertTypeWizardSection.js +27 -0
- package/src/View/Alert/Wizard/AlertWizard.js +53 -98
- package/src/View/Alert/Wizard/BaseAlertScopeWizardSection.d.ts +1 -6
- package/src/View/Alert/Wizard/BaseAlertScopeWizardSection.js +4 -39
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.js +1 -1
- package/src/View/{Components/Charting → Charting}/ChartingStatusBarPopover.d.ts +0 -0
- package/src/View/{Components/Charting → Charting}/ChartingStatusBarPopover.js +2 -2
- package/src/View/{Components/Charting → Charting}/ChartingViewPanel.d.ts +1 -1
- package/src/View/{Components/Charting → Charting}/ChartingViewPanel.js +0 -0
- package/src/View/{Components/Charting → Charting}/ChartingWizard/ChartingWizard.d.ts +2 -2
- package/src/View/{Components/Charting → Charting}/ChartingWizard/ChartingWizard.js +12 -2
- package/src/View/{Components/Charting → Charting}/ChartingWizard/PreviewChartSection.d.ts +1 -1
- package/src/View/{Components/Charting → Charting}/ChartingWizard/PreviewChartSection.js +2 -2
- package/src/View/{Components/Charting → Charting}/ChartingWizard/SettingsSection.d.ts +1 -1
- package/src/View/{Components/Charting → Charting}/ChartingWizard/SettingsSection.js +4 -4
- package/src/View/{Components/Charting → Charting}/DeleteChartButton.d.ts +1 -1
- package/src/View/{Components/Charting → Charting}/DeleteChartButton.js +3 -3
- package/src/View/{Components/Charting → Charting}/EditChartButton.d.ts +1 -1
- package/src/View/{Components/Charting → Charting}/EditChartButton.js +3 -3
- package/src/View/{Components/Charting → Charting}/ShowChartButton.d.ts +1 -1
- package/src/View/{Components/Charting → Charting}/ShowChartButton.js +5 -5
- package/src/View/{Components/Charting → Charting}/useChartState.d.ts +1 -1
- package/src/View/{Components/Charting → Charting}/useChartState.js +5 -5
- package/src/View/{Components/Charting → Charting}/useChartingElements.d.ts +1 -1
- package/src/View/{Components/Charting → Charting}/useChartingElements.js +6 -6
- package/src/View/Components/EntityRulesEditor/EntityRulePredicatesEditor/EntityRulePredicateEditor.d.ts +12 -0
- package/src/View/Components/EntityRulesEditor/EntityRulePredicatesEditor/EntityRulePredicateEditor.js +85 -0
- package/src/View/Components/EntityRulesEditor/{PredicatesEditor.d.ts → EntityRulePredicatesEditor/EntityRulePredicatesEditor.d.ts} +6 -4
- package/src/View/Components/EntityRulesEditor/EntityRulePredicatesEditor/EntityRulePredicatesEditor.js +87 -0
- package/src/View/Components/EntityRulesEditor/EntityRulePredicatesEditor/index.d.ts +1 -0
- package/src/View/Components/EntityRulesEditor/EntityRulePredicatesEditor/index.js +5 -0
- package/src/View/Components/EntityRulesEditor/Utilities.js +7 -1
- package/src/View/Components/EntityRulesEditor/index.d.ts +4 -2
- package/src/View/Components/EntityRulesEditor/index.js +27 -10
- package/src/View/Components/NewScopeComponent.d.ts +9 -5
- package/src/View/Components/NewScopeComponent.js +19 -10
- package/src/View/Components/Popups/WindowPopups/WindowPopups.js +2 -2
- package/src/View/Components/Popups/WindowPopups/windowFactory.d.ts +1 -0
- package/src/View/Components/Popups/WindowPopups/windowFactory.js +4 -1
- package/src/View/Components/PredicateEditor/PredicateEditor.js +16 -5
- package/src/View/Components/PreviewResultsPanel.js +30 -3
- package/src/View/CustomSort/Wizard/CustomSortWizard.js +1 -1
- package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +3 -0
- package/src/View/DataChangeHistory/DataChangeHistoryPopup.js +1 -1
- package/src/View/DataChangeHistory/DataChangeHistoryViewPanel.js +1 -1
- package/src/View/Export/ExportTablePopup.d.ts +3 -0
- package/src/View/Export/ExportTablePopup.js +59 -0
- package/src/View/Export/Wizard/NewReportWizard.js +1 -1
- package/src/View/Export/Wizard/ReportColumnsWizardSection.js +1 -1
- package/src/View/FlashingCell/Wizard/FlashingCellRulesWizardSection.js +1 -1
- package/src/View/FlashingCell/Wizard/FlashingCellWizard.js +2 -2
- package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +1 -1
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnWizard.js +1 -1
- package/src/View/GridInfo/GridInfoPopup.js +1 -1
- package/src/View/PlusMinus/Wizard/PlusMinusWizard.js +1 -1
- package/src/View/Query/Wizard/NamedQueryWizard.js +1 -1
- package/src/View/Schedule/Wizard/ScheduleWizard.js +1 -1
- package/src/View/Shortcut/Wizard/ShortcutWizard.js +1 -1
- package/src/View/StatusBar/StatusBarPanel.d.ts +3 -4
- package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +7 -4
- package/src/View/StyledColumn/Wizard/StyledColumnWizardTypeSection.js +5 -5
- package/src/View/TeamSharing/TeamSharingApplyButton.js +1 -1
- package/src/View/Theme/ThemeStatusPanelPopover.js +10 -2
- package/src/View/Wizard/TypeRadio.d.ts +7 -0
- package/src/View/Wizard/TypeRadio.js +12 -0
- package/src/agGrid/Adaptable.d.ts +3 -1
- package/src/agGrid/Adaptable.js +28 -4
- package/src/agGrid/agGridHelper.d.ts +1 -0
- package/src/agGrid/agGridHelper.js +15 -0
- package/src/components/ExpressionEditor/EditorInputWithWhereClause.js +4 -0
- package/src/components/ExpressionEditor/editorButtonsAggregatedBoolean.js +5 -0
- package/src/components/ExpressionEditor/editorButtonsAggregatedScalar.js +5 -0
- package/src/components/icons/index.js +4 -0
- package/src/components/icons/visibility-off.d.ts +3 -0
- package/src/components/icons/visibility-off.js +7 -0
- package/src/components/icons/visibility.d.ts +3 -0
- package/src/components/icons/visibility.js +8 -0
- package/src/metamodel/adaptable.metamodel.d.ts +129 -0
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +5 -4
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/src/View/Alert/Wizard/BaseAlertRulesWizardSection.d.ts +0 -9
- package/src/View/Alert/Wizard/BaseAlertRulesWizardSection.js +0 -30
- package/src/View/Components/EntityRulesEditor/PredicatesEditor.js +0 -86
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAlertTypeText = exports.getAlertType = exports.AlertType = void 0;
|
|
4
|
+
var AlertType;
|
|
5
|
+
(function (AlertType) {
|
|
6
|
+
AlertType["DataChange"] = "DataChange";
|
|
7
|
+
AlertType["RowChange"] = "RowChange";
|
|
8
|
+
AlertType["Aggregation"] = "Aggregation";
|
|
9
|
+
AlertType["Observable"] = "Observable";
|
|
10
|
+
})(AlertType = exports.AlertType || (exports.AlertType = {}));
|
|
11
|
+
/**
|
|
12
|
+
* Based on alert shape the type is derived.
|
|
13
|
+
* In the future the alert will get a type property.
|
|
14
|
+
*
|
|
15
|
+
* @param alert
|
|
16
|
+
*/
|
|
17
|
+
const getAlertType = (alert) => {
|
|
18
|
+
if (alert.Rule.ObservableExpression) {
|
|
19
|
+
return AlertType.Observable;
|
|
20
|
+
}
|
|
21
|
+
if (alert.Rule.AggregatedBooleanExpression) {
|
|
22
|
+
return AlertType.Aggregation;
|
|
23
|
+
}
|
|
24
|
+
if (alert.Rule.BooleanExpression) {
|
|
25
|
+
return AlertType.DataChange;
|
|
26
|
+
}
|
|
27
|
+
const predicates = alert.Rule.Predicates;
|
|
28
|
+
if (predicates) {
|
|
29
|
+
if (predicates.some((predicate) => ['AddedRow', 'RemovedRow'].includes(predicate.PredicateId))) {
|
|
30
|
+
return AlertType.RowChange;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return AlertType.DataChange;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// the object is not a valid alert
|
|
37
|
+
return null;
|
|
38
|
+
};
|
|
39
|
+
exports.getAlertType = getAlertType;
|
|
40
|
+
const getAlertTypeText = (alertType) => {
|
|
41
|
+
let text = '';
|
|
42
|
+
switch (alertType) {
|
|
43
|
+
case AlertType.DataChange:
|
|
44
|
+
text = 'Data Change';
|
|
45
|
+
break;
|
|
46
|
+
case AlertType.RowChange:
|
|
47
|
+
text = 'Row Change';
|
|
48
|
+
break;
|
|
49
|
+
case AlertType.Aggregation:
|
|
50
|
+
text = 'Aggregation';
|
|
51
|
+
break;
|
|
52
|
+
case AlertType.Observable:
|
|
53
|
+
text = 'Observable';
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
return text;
|
|
57
|
+
};
|
|
58
|
+
exports.getAlertTypeText = getAlertTypeText;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { AdaptableApi, AdaptablePredicateDef, AdaptableScope } from '../../../types';
|
|
2
|
+
import { AlertType } from './getAlertType';
|
|
3
|
+
export declare const getAvailablePredicateDefinitions: (api: AdaptableApi, scope: AdaptableScope, alertType: AlertType) => AdaptablePredicateDef[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAvailablePredicateDefinitions = void 0;
|
|
4
|
+
const getAvailablePredicateDefinitions = (api, scope, alertType) => {
|
|
5
|
+
let predicateDefs = [];
|
|
6
|
+
if (alertType === 'DataChange') {
|
|
7
|
+
predicateDefs = api.alertApi.internalApi
|
|
8
|
+
.getAlertPredicateDefsForScope(scope)
|
|
9
|
+
.filter((predicateDef) => !['AddedRow', 'RemovedRow'].includes(predicateDef.id));
|
|
10
|
+
predicateDefs = [...predicateDefs].sort((a, b) => a.id === 'Any' ? -1 : b.id === 'Any' ? 1 : 0);
|
|
11
|
+
}
|
|
12
|
+
else if (alertType === 'RowChange') {
|
|
13
|
+
predicateDefs = api.alertApi.internalApi
|
|
14
|
+
.getAlertPredicateDefsForScope(scope)
|
|
15
|
+
.filter((predicateDef) => ['AddedRow', 'RemovedRow'].includes(predicateDef.id));
|
|
16
|
+
}
|
|
17
|
+
return predicateDefs;
|
|
18
|
+
};
|
|
19
|
+
exports.getAvailablePredicateDefinitions = getAvailablePredicateDefinitions;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AlertDefinition } from '../../../types';
|
|
2
|
+
import { AlertType } from './getAlertType';
|
|
3
|
+
/**
|
|
4
|
+
* This logic should be moved into Object factory once we have types on alert definitions
|
|
5
|
+
* @param type AlertType
|
|
6
|
+
*/
|
|
7
|
+
export declare const getDefaultAlertDefinition: (alertDefinition: AlertDefinition, type: AlertType) => {
|
|
8
|
+
Uuid: string;
|
|
9
|
+
Scope: import("../../../types").AdaptableScope<import("../../../PredefinedConfig/Common/AdaptableScope").ScopeDataType>;
|
|
10
|
+
Rule: ({
|
|
11
|
+
Predicates?: never;
|
|
12
|
+
} & (({
|
|
13
|
+
BooleanExpression?: never;
|
|
14
|
+
} & (({
|
|
15
|
+
ObservableExpression?: never;
|
|
16
|
+
} & import("../../../types").AdaptableAggregatedBooleanQuery) | ({
|
|
17
|
+
AggregatedBooleanExpression?: never;
|
|
18
|
+
} & import("../../../types").AdaptableObservableQuery))) | ({
|
|
19
|
+
AggregatedBooleanExpression?: never;
|
|
20
|
+
ObservableExpression?: never;
|
|
21
|
+
} & import("../../../types").AdaptableBooleanQuery))) | ({
|
|
22
|
+
AggregatedBooleanExpression?: never;
|
|
23
|
+
ObservableExpression?: never;
|
|
24
|
+
BooleanExpression?: never;
|
|
25
|
+
} & {
|
|
26
|
+
Predicates: import("../../../types").AlertDefinitionPredicate[];
|
|
27
|
+
});
|
|
28
|
+
MessageType: import("../../../types").AdaptableMessageType;
|
|
29
|
+
MessageHeader?: string;
|
|
30
|
+
MessageText?: string;
|
|
31
|
+
AlertProperties?: import("../../../types").AlertProperties;
|
|
32
|
+
AlertForm?: string | import("../../../types").AlertButtonForm;
|
|
33
|
+
IsSuspended?: boolean;
|
|
34
|
+
Source?: "Config" | "User";
|
|
35
|
+
IsReadOnly?: boolean;
|
|
36
|
+
Tags?: string[];
|
|
37
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultAlertDefinition = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const ObjectFactory_1 = tslib_1.__importDefault(require("../../../Utilities/ObjectFactory"));
|
|
6
|
+
const getAlertType_1 = require("./getAlertType");
|
|
7
|
+
/**
|
|
8
|
+
* This logic should be moved into Object factory once we have types on alert definitions
|
|
9
|
+
* @param type AlertType
|
|
10
|
+
*/
|
|
11
|
+
const getDefaultAlertDefinition = (alertDefinition, type) => {
|
|
12
|
+
const newAlert = Object.assign(Object.assign({}, ObjectFactory_1.default.CreateEmptyAlertDefinition()), { Uuid: alertDefinition.Uuid });
|
|
13
|
+
// can only be all
|
|
14
|
+
if (type === getAlertType_1.AlertType.Observable ||
|
|
15
|
+
type === getAlertType_1.AlertType.Aggregation ||
|
|
16
|
+
type === getAlertType_1.AlertType.RowChange) {
|
|
17
|
+
newAlert.Scope = {
|
|
18
|
+
All: true,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (type === getAlertType_1.AlertType.RowChange) {
|
|
22
|
+
newAlert.Rule = {
|
|
23
|
+
Predicates: [
|
|
24
|
+
{
|
|
25
|
+
PredicateId: 'AddedRow',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return newAlert;
|
|
31
|
+
};
|
|
32
|
+
exports.getDefaultAlertDefinition = getDefaultAlertDefinition;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapAlertDefinition = void 0;
|
|
4
|
+
const mapAlertDefinition = (api, alertDefinition) => {
|
|
5
|
+
var _a;
|
|
6
|
+
const isRemovedRowChangeAlert = api.alertApi.internalApi.isAlertDefinitionForRemovedRowChangeEvent(alertDefinition);
|
|
7
|
+
const mapValidButtonActions = (alertAction) => {
|
|
8
|
+
if (isRemovedRowChangeAlert) {
|
|
9
|
+
if (alertAction === 'highlight-row' || alertAction === 'jump-to-row') {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
return alertAction;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
// the only case needed is when changing from AddedRow to RemovedRow
|
|
16
|
+
// map FormButton Actions
|
|
17
|
+
if (alertDefinition.AlertForm && typeof alertDefinition.AlertForm !== 'string') {
|
|
18
|
+
const alertButtons = (_a = alertDefinition.AlertForm) === null || _a === void 0 ? void 0 : _a.Buttons;
|
|
19
|
+
alertButtons === null || alertButtons === void 0 ? void 0 : alertButtons.forEach((alertButton) => {
|
|
20
|
+
const alertAction = alertButton.Action;
|
|
21
|
+
if (Array.isArray(alertAction)) {
|
|
22
|
+
alertButton.Action = alertAction
|
|
23
|
+
.map(mapValidButtonActions)
|
|
24
|
+
.filter(Boolean);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
alertButton.Action = mapValidButtonActions(alertAction);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
// behaviours
|
|
32
|
+
if (isRemovedRowChangeAlert) {
|
|
33
|
+
delete alertDefinition.AlertProperties.HighlightRow;
|
|
34
|
+
delete alertDefinition.AlertProperties.JumpToRow;
|
|
35
|
+
}
|
|
36
|
+
return alertDefinition;
|
|
37
|
+
};
|
|
38
|
+
exports.mapAlertDefinition = mapAlertDefinition;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { AlertDefinition } from '../../../PredefinedConfig/AlertState';
|
|
3
3
|
import { AdaptableApi } from '../../../types';
|
|
4
|
+
import { AlertType } from '../Utilities/getAlertType';
|
|
5
|
+
export declare const renderAlertBehaviourWizardSummary: (alertDefinition: AlertDefinition) => JSX.Element;
|
|
6
|
+
export declare const renderAlertBehaviourSummary: (alert: AlertDefinition, api: AdaptableApi, allowWrap?: boolean) => JSX.Element;
|
|
4
7
|
declare type AlertBehaviourWizardSectionProps = {
|
|
5
8
|
onChange: (data: AlertDefinition) => void;
|
|
9
|
+
alertType: AlertType;
|
|
6
10
|
};
|
|
7
|
-
export declare const renderAlertBehaviourWizardSummary: (alertDefinition: AlertDefinition) => JSX.Element;
|
|
8
|
-
export declare const renderAlertBehaviourSummary: (alert: AlertDefinition, api: AdaptableApi, allowWrap?: boolean) => JSX.Element;
|
|
9
11
|
export declare const AlertBehaviourWizardSection: (props: AlertBehaviourWizardSectionProps) => JSX.Element;
|
|
10
12
|
export {};
|
|
@@ -89,14 +89,21 @@ exports.renderAlertBehaviourSummary = renderAlertBehaviourSummary;
|
|
|
89
89
|
const AlertBehaviourWizardSection = (props) => {
|
|
90
90
|
const { data, api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
91
91
|
const { AlertProperties = {} } = data;
|
|
92
|
-
const rowAddedAlert = api.alertApi.internalApi.isAlertDefinitionForAddedRowChangeEvent(data);
|
|
93
92
|
const rowRemovedAlert = api.alertApi.internalApi.isAlertDefinitionForRemovedRowChangeEvent(data);
|
|
94
|
-
|
|
95
|
-
const hasPreventCellEdit =
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
const
|
|
93
|
+
// data change only
|
|
94
|
+
const hasPreventCellEdit = props.alertType === 'DataChange';
|
|
95
|
+
// except row change
|
|
96
|
+
const hasHighlightCell = props.alertType !== 'RowChange';
|
|
97
|
+
// except row removed
|
|
98
|
+
const hasHighlightRow = !rowRemovedAlert;
|
|
99
|
+
// except row changed
|
|
100
|
+
const hasJumpToCell = props.alertType !== 'RowChange';
|
|
101
|
+
// for all
|
|
102
|
+
const showInSeparateDiv = true;
|
|
103
|
+
// for all
|
|
104
|
+
const logToConsole = true;
|
|
105
|
+
// except row removed
|
|
106
|
+
const hasJumpToRow = !rowRemovedAlert;
|
|
100
107
|
const onChange = (AlertProperties) => {
|
|
101
108
|
props.onChange(Object.assign(Object.assign({}, data), { AlertProperties: Object.assign(Object.assign({}, data.AlertProperties), AlertProperties) }));
|
|
102
109
|
};
|
|
@@ -122,14 +129,14 @@ const AlertBehaviourWizardSection = (props) => {
|
|
|
122
129
|
hasJumpToRow && (React.createElement(CheckBox_1.CheckBox, { "data-name": "jump-to-row", checked: AlertProperties.JumpToRow, onChange: (JumpToRow) => {
|
|
123
130
|
onChange({ JumpToRow });
|
|
124
131
|
} }, "Jump To Row")),
|
|
125
|
-
React.createElement(CheckBox_1.CheckBox, { "data-name": "show-in-div", checked: AlertProperties.ShowInDiv, onChange: (ShowInDiv) => {
|
|
132
|
+
showInSeparateDiv && (React.createElement(CheckBox_1.CheckBox, { "data-name": "show-in-div", checked: AlertProperties.ShowInDiv, onChange: (ShowInDiv) => {
|
|
126
133
|
onChange({ ShowInDiv });
|
|
127
134
|
} },
|
|
128
135
|
"Show in separate ",
|
|
129
136
|
React.createElement(CodeBlock_1.CodeBlock, null, `<div />`),
|
|
130
|
-
" element"),
|
|
131
|
-
React.createElement(CheckBox_1.CheckBox, { "data-name": "log-to-console", checked: AlertProperties.LogToConsole, onChange: (LogToConsole) => {
|
|
137
|
+
" element")),
|
|
138
|
+
logToConsole && (React.createElement(CheckBox_1.CheckBox, { "data-name": "log-to-console", checked: AlertProperties.LogToConsole, onChange: (LogToConsole) => {
|
|
132
139
|
onChange({ LogToConsole });
|
|
133
|
-
} }, "Log To Console"))));
|
|
140
|
+
} }, "Log To Console")))));
|
|
134
141
|
};
|
|
135
142
|
exports.AlertBehaviourWizardSection = AlertBehaviourWizardSection;
|
|
@@ -3,11 +3,13 @@ import { AlertButton } from '../../../PredefinedConfig/AlertState';
|
|
|
3
3
|
import { AdaptableAlert } from '../../../PredefinedConfig/Common/AdaptableAlert';
|
|
4
4
|
import { AdaptableApi } from '../../../Api/AdaptableApi';
|
|
5
5
|
import { AlertFormContext } from '../../../types';
|
|
6
|
+
import { AlertType } from '../Utilities/getAlertType';
|
|
6
7
|
declare type AlertButtonsEditorProps = {
|
|
7
8
|
AlertButtons: AlertButton<AlertFormContext>[];
|
|
8
9
|
onChange: (buttons: AlertButton<AlertFormContext>[]) => void;
|
|
9
10
|
api: AdaptableApi;
|
|
10
11
|
adaptableAlert: AdaptableAlert;
|
|
12
|
+
alertType: AlertType;
|
|
11
13
|
};
|
|
12
14
|
export declare const AlertButtonsEditor: (props: AlertButtonsEditorProps) => JSX.Element;
|
|
13
15
|
export {};
|
|
@@ -21,11 +21,18 @@ const AlertButtonsEditor = (props) => {
|
|
|
21
21
|
const rowAddedAlert = api.alertApi.internalApi.isAlertDefinitionForAddedRowChangeEvent(alertDefinition);
|
|
22
22
|
const rowRemovedAlert = api.alertApi.internalApi.isAlertDefinitionForRemovedRowChangeEvent(alertDefinition);
|
|
23
23
|
const cellChangedAlert = !rowAddedAlert && !rowRemovedAlert;
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
24
|
+
// except row change
|
|
25
|
+
const hasHighlightCell = props.alertType !== 'RowChange';
|
|
26
|
+
// all, except row removed
|
|
27
|
+
const hasHighlightRow = !rowRemovedAlert;
|
|
28
|
+
// except row removed
|
|
29
|
+
const hasJumpToCell = props.alertType !== 'RowChange';
|
|
30
|
+
// all
|
|
31
|
+
const hasJumpToRow = !rowRemovedAlert;
|
|
32
|
+
// all
|
|
33
|
+
const hasSuspend = true;
|
|
34
|
+
// only data change
|
|
35
|
+
const hasUndo = props.alertType === 'DataChange';
|
|
29
36
|
const AlertButtons = (0, Helper_1.cloneObject)(props.AlertButtons || []) || [];
|
|
30
37
|
const buttonActions = [];
|
|
31
38
|
if (hasHighlightRow) {
|
|
@@ -43,7 +50,9 @@ const AlertButtonsEditor = (props) => {
|
|
|
43
50
|
if (hasUndo) {
|
|
44
51
|
buttonActions.push('undo');
|
|
45
52
|
}
|
|
46
|
-
|
|
53
|
+
if (hasSuspend) {
|
|
54
|
+
buttonActions.push('suspend');
|
|
55
|
+
}
|
|
47
56
|
return (React.createElement(React.Fragment, null,
|
|
48
57
|
React.createElement(rebass_1.Flex, { flexDirection: "row", alignItems: "center", justifyContent: "space-between" },
|
|
49
58
|
React.createElement(rebass_1.Text, { fontSize: 2, mt: 3, mb: 2 }, "Add buttons to Alert, and Actions to perform when button is clicked"),
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AlertDefinition } from '../../../PredefinedConfig/AlertState';
|
|
3
|
+
import { AlertType } from '../Utilities/getAlertType';
|
|
4
|
+
export declare const renderAlertMessageSummary: () => JSX.Element;
|
|
5
|
+
declare type AlertDisplayWizardSectionProps = {
|
|
6
|
+
onChange: (data: AlertDefinition) => void;
|
|
7
|
+
alertType: AlertType;
|
|
8
|
+
};
|
|
9
|
+
export declare const AlertMessageWizardSection: (props: AlertDisplayWizardSectionProps) => JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AlertMessageWizardSection = exports.renderAlertMessageSummary = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const Tabs_1 = require("../../../components/Tabs");
|
|
7
|
+
const Radio_1 = tslib_1.__importStar(require("../../../components/Radio"));
|
|
8
|
+
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
|
|
9
|
+
const rebass_1 = require("rebass");
|
|
10
|
+
const CodeBlock_1 = require("../../../components/CodeBlock");
|
|
11
|
+
const AdaptableInput_1 = tslib_1.__importDefault(require("../../Components/AdaptableInput"));
|
|
12
|
+
const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
|
|
13
|
+
const renderAlertMessageSummary = () => {
|
|
14
|
+
const { data } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
15
|
+
return (React.createElement(rebass_1.Text, { fontSize: 2 },
|
|
16
|
+
"Message Type ",
|
|
17
|
+
React.createElement(CodeBlock_1.CodeBlock, null, data.MessageType)));
|
|
18
|
+
};
|
|
19
|
+
exports.renderAlertMessageSummary = renderAlertMessageSummary;
|
|
20
|
+
const AlertMessageWizardSection = (props) => {
|
|
21
|
+
const { data, api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
22
|
+
const messageType = data.MessageType;
|
|
23
|
+
const messageText = api.alertApi.internalApi.getAlertDescription(data);
|
|
24
|
+
const messageHeader = data.MessageHeader;
|
|
25
|
+
const onMessageTextChange = (e) => {
|
|
26
|
+
const { value } = e.target;
|
|
27
|
+
props.onChange(Object.assign(Object.assign({}, data), { MessageText: value }));
|
|
28
|
+
};
|
|
29
|
+
const onMessageHeaderChange = (e) => {
|
|
30
|
+
const { value } = e.target;
|
|
31
|
+
props.onChange(Object.assign(Object.assign({}, data), { MessageHeader: value }));
|
|
32
|
+
};
|
|
33
|
+
return (React.createElement(React.Fragment, null,
|
|
34
|
+
React.createElement(Tabs_1.Tabs, { "data-name": "message-type" },
|
|
35
|
+
React.createElement(Tabs_1.Tabs.Tab, null, "Message Type"),
|
|
36
|
+
React.createElement(Tabs_1.Tabs.Content, null,
|
|
37
|
+
React.createElement(Radio_1.RadioGroup, { value: messageType, name: "messageType", orientation: "horizontal", onRadioChange: (MessageType) => {
|
|
38
|
+
props.onChange(Object.assign(Object.assign({}, data), { MessageType }));
|
|
39
|
+
} },
|
|
40
|
+
React.createElement(Radio_1.default, { marginLeft: 1, value: "Info" }, "Info"),
|
|
41
|
+
React.createElement(Radio_1.default, { marginLeft: 4, value: "Success" }, "Success"),
|
|
42
|
+
React.createElement(Radio_1.default, { marginLeft: 4, value: "Warning" }, "Warning"),
|
|
43
|
+
React.createElement(Radio_1.default, { marginLeft: 4, value: "Error" }, "Error")))),
|
|
44
|
+
React.createElement(Tabs_1.Tabs, { "data-name": "message-text", mt: 2, mb: 3, autoFocus: false },
|
|
45
|
+
React.createElement(Tabs_1.Tabs.Tab, null, "Message Text"),
|
|
46
|
+
React.createElement(Tabs_1.Tabs.Content, null,
|
|
47
|
+
React.createElement(rebass_1.Text, { fontSize: 2, mt: 3, mb: 2 }, "The text to display as the Alert Message (leave blank to show automated Message based on Alert Type)"),
|
|
48
|
+
' ',
|
|
49
|
+
React.createElement(FormLayout_1.default, null,
|
|
50
|
+
React.createElement(FormLayout_1.FormRow, { label: "Header" },
|
|
51
|
+
React.createElement(AdaptableInput_1.default, { placeholder: "use defaults", marginTop: 2, type: 'text', autoFocus: false, value: messageHeader,
|
|
52
|
+
// placeholder="defaults to column name"
|
|
53
|
+
onChange: (e) => onMessageHeaderChange(e) })),
|
|
54
|
+
React.createElement(FormLayout_1.FormRow, { label: "Message" },
|
|
55
|
+
React.createElement(AdaptableInput_1.default, { marginTop: 2, type: 'text', autoFocus: false, value: messageText, onChange: (e) => onMessageTextChange(e) })))))));
|
|
56
|
+
};
|
|
57
|
+
exports.AlertMessageWizardSection = AlertMessageWizardSection;
|
package/src/View/Alert/Wizard/{AlertDisplayWizardSection.d.ts → AlertNotificationWizardSection.d.ts}
RENAMED
|
@@ -2,15 +2,17 @@ import * as React from 'react';
|
|
|
2
2
|
import { AlertDefinition } from '../../../PredefinedConfig/AlertState';
|
|
3
3
|
import { AdaptableApi } from '../../../types';
|
|
4
4
|
import { BoxProps } from 'rebass';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
export declare const renderAlertDisplaySummary: () => JSX.Element;
|
|
5
|
+
import { AlertType } from '../Utilities/getAlertType';
|
|
6
|
+
export declare const renderAlertNotificationSummary: () => JSX.Element;
|
|
9
7
|
interface AlertPreviewProps extends BoxProps {
|
|
10
8
|
api: AdaptableApi;
|
|
11
9
|
alertDefinition: AlertDefinition;
|
|
12
10
|
focusFirstButton?: boolean;
|
|
13
11
|
}
|
|
14
12
|
export declare const AlertPreview: React.FunctionComponent<AlertPreviewProps>;
|
|
15
|
-
|
|
13
|
+
declare type AlertNotificationWizardSectionProps = {
|
|
14
|
+
onChange: (data: AlertDefinition) => void;
|
|
15
|
+
alertType: AlertType;
|
|
16
|
+
};
|
|
17
|
+
export declare const AlertNotificationWizardSection: (props: AlertNotificationWizardSectionProps) => JSX.Element;
|
|
16
18
|
export {};
|
package/src/View/Alert/Wizard/{AlertDisplayWizardSection.js → AlertNotificationWizardSection.js}
RENAMED
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.AlertNotificationWizardSection = exports.AlertPreview = exports.renderAlertNotificationSummary = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const Tabs_1 = require("../../../components/Tabs");
|
|
7
|
-
const Radio_1 = tslib_1.__importStar(require("../../../components/Radio"));
|
|
8
7
|
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
|
|
9
8
|
const CheckBox_1 = require("../../../components/CheckBox");
|
|
10
9
|
const rebass_1 = require("rebass");
|
|
11
10
|
const AdaptablePopupAlert_1 = require("../../Components/Popups/AdaptablePopupAlert");
|
|
12
11
|
const AlertButtonsEditor_1 = require("./AlertButtonsEditor");
|
|
13
|
-
const CodeBlock_1 = require("../../../components/CodeBlock");
|
|
14
|
-
const AdaptableInput_1 = tslib_1.__importDefault(require("../../Components/AdaptableInput"));
|
|
15
12
|
const join_1 = tslib_1.__importDefault(require("../../../components/utils/join"));
|
|
16
|
-
const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
|
|
17
13
|
const DEFAULT_BUTTONS = [
|
|
18
14
|
{
|
|
19
15
|
Label: 'OK',
|
|
@@ -22,18 +18,15 @@ const DEFAULT_BUTTONS = [
|
|
|
22
18
|
},
|
|
23
19
|
},
|
|
24
20
|
];
|
|
25
|
-
const
|
|
21
|
+
const renderAlertNotificationSummary = () => {
|
|
26
22
|
var _a;
|
|
27
23
|
const { data, api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
28
24
|
if (!((_a = data.AlertProperties) === null || _a === void 0 ? void 0 : _a.DisplayNotification)) {
|
|
29
|
-
return
|
|
30
|
-
"Alert type ",
|
|
31
|
-
React.createElement(CodeBlock_1.CodeBlock, null, data.MessageType),
|
|
32
|
-
". No alert popup will be displayed"));
|
|
25
|
+
return React.createElement(rebass_1.Text, { fontSize: 2 }, "No Alert Notification will be displayed");
|
|
33
26
|
}
|
|
34
27
|
return React.createElement(exports.AlertPreview, { api: api, alertDefinition: data });
|
|
35
28
|
};
|
|
36
|
-
exports.
|
|
29
|
+
exports.renderAlertNotificationSummary = renderAlertNotificationSummary;
|
|
37
30
|
const AlertPreview = (_a) => {
|
|
38
31
|
var { alertDefinition, api, focusFirstButton } = _a, boxProps = tslib_1.__rest(_a, ["alertDefinition", "api", "focusFirstButton"]);
|
|
39
32
|
const mapButtons = React.useCallback((button) => {
|
|
@@ -59,62 +52,31 @@ const AlertPreview = (_a) => {
|
|
|
59
52
|
React.createElement(AdaptablePopupAlert_1.AdaptablePopupAlert, { headless: true, focusFirstButton: focusFirstButton, adaptableAlert: alertToPreview, onClose: () => { } })));
|
|
60
53
|
};
|
|
61
54
|
exports.AlertPreview = AlertPreview;
|
|
62
|
-
const
|
|
63
|
-
var _a, _b, _c, _d
|
|
55
|
+
const AlertNotificationWizardSection = (props) => {
|
|
56
|
+
var _a, _b, _c, _d;
|
|
64
57
|
const { data, api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
65
|
-
const messageType = data.MessageType;
|
|
66
|
-
const messageText = api.alertApi.internalApi.getAlertDescription(data);
|
|
67
|
-
const messageHeader = (_a = data.MessageHeader) !== null && _a !== void 0 ? _a : '';
|
|
68
58
|
const adaptableAlert = {
|
|
69
59
|
alertType: 'generic',
|
|
70
60
|
header: data.MessageType,
|
|
71
61
|
message: '',
|
|
72
62
|
alertDefinition: data,
|
|
73
63
|
};
|
|
74
|
-
const onMessageTextChange = (e) => {
|
|
75
|
-
const { value } = e.target;
|
|
76
|
-
props.onChange(Object.assign(Object.assign({}, data), { MessageText: value }));
|
|
77
|
-
};
|
|
78
|
-
const onMessageHeaderChange = (e) => {
|
|
79
|
-
const { value } = e.target;
|
|
80
|
-
props.onChange(Object.assign(Object.assign({}, data), { MessageHeader: value }));
|
|
81
|
-
};
|
|
82
64
|
return (React.createElement(React.Fragment, null,
|
|
83
|
-
React.createElement(Tabs_1.Tabs, { "data-name": "message-type" },
|
|
84
|
-
React.createElement(Tabs_1.Tabs.Tab, null, "Message Type"),
|
|
85
|
-
React.createElement(Tabs_1.Tabs.Content, null,
|
|
86
|
-
React.createElement(Radio_1.RadioGroup, { value: messageType, name: "messageType", orientation: "horizontal", onRadioChange: (MessageType) => {
|
|
87
|
-
props.onChange(Object.assign(Object.assign({}, data), { MessageType }));
|
|
88
|
-
} },
|
|
89
|
-
React.createElement(Radio_1.default, { marginLeft: 1, value: "Info" }, "Info"),
|
|
90
|
-
React.createElement(Radio_1.default, { marginLeft: 4, value: "Success" }, "Success"),
|
|
91
|
-
React.createElement(Radio_1.default, { marginLeft: 4, value: "Warning" }, "Warning"),
|
|
92
|
-
React.createElement(Radio_1.default, { marginLeft: 4, value: "Error" }, "Error")))),
|
|
93
|
-
React.createElement(Tabs_1.Tabs, { "data-name": "message-text", mt: 2, mb: 3, autoFocus: false },
|
|
94
|
-
React.createElement(Tabs_1.Tabs.Tab, null, "Message Text"),
|
|
95
|
-
React.createElement(Tabs_1.Tabs.Content, null,
|
|
96
|
-
React.createElement(rebass_1.Text, { fontSize: 2, mt: 3, mb: 2 }, "The text to display as the Alert Message (leave blank to show automated Message based on Trigger and Condition)"),
|
|
97
|
-
' ',
|
|
98
|
-
React.createElement(FormLayout_1.default, null,
|
|
99
|
-
React.createElement(FormLayout_1.FormRow, { label: "Header" },
|
|
100
|
-
React.createElement(AdaptableInput_1.default, { marginTop: 2, type: 'text', autoFocus: false, value: messageHeader, onChange: (e) => onMessageHeaderChange(e) })),
|
|
101
|
-
React.createElement(FormLayout_1.FormRow, { label: "Message" },
|
|
102
|
-
React.createElement(AdaptableInput_1.default, { marginTop: 2, type: 'text', autoFocus: false, value: messageText, onChange: (e) => onMessageTextChange(e) }))))),
|
|
103
65
|
React.createElement(Tabs_1.Tabs, { "data-name": "display-options", mt: 2, mb: 3, autoFocus: false },
|
|
104
|
-
React.createElement(Tabs_1.Tabs.Tab, null, "
|
|
66
|
+
React.createElement(Tabs_1.Tabs.Tab, null, "Notification Options"),
|
|
105
67
|
React.createElement(Tabs_1.Tabs.Content, null,
|
|
106
|
-
React.createElement(CheckBox_1.CheckBox, { checked: (
|
|
68
|
+
React.createElement(CheckBox_1.CheckBox, { checked: (_a = data.AlertProperties) === null || _a === void 0 ? void 0 : _a.DisplayNotification, onChange: (DisplayNotification) => {
|
|
107
69
|
const newAlertDefinition = Object.assign(Object.assign({}, data), { AlertProperties: Object.assign(Object.assign({}, data.AlertProperties), { DisplayNotification }) });
|
|
108
70
|
if (!DisplayNotification && typeof newAlertDefinition.AlertForm === 'object') {
|
|
109
71
|
delete newAlertDefinition.AlertForm.Buttons;
|
|
110
72
|
}
|
|
111
73
|
props.onChange(newAlertDefinition);
|
|
112
74
|
} }, "Show a Notification when Alert is triggered (with action buttons)"),
|
|
113
|
-
((
|
|
75
|
+
((_b = data.AlertProperties) === null || _b === void 0 ? void 0 : _b.DisplayNotification) ? (typeof data.AlertForm === 'string' ? (React.createElement(rebass_1.Text, { fontSize: 2 }, "Alert buttons cannot be customized because form is dynamically driven")) : (React.createElement(AlertButtonsEditor_1.AlertButtonsEditor, { alertType: props.alertType, AlertButtons: ((_c = data.AlertForm) === null || _c === void 0 ? void 0 : _c.Buttons) || DEFAULT_BUTTONS, api: api, adaptableAlert: adaptableAlert, onChange: (buttons) => {
|
|
114
76
|
props.onChange(Object.assign(Object.assign({}, data), { AlertForm: Object.assign(Object.assign({}, data.AlertForm), { Buttons: buttons }) }));
|
|
115
77
|
} }))) : null)),
|
|
116
|
-
((
|
|
117
|
-
React.createElement(Tabs_1.Tabs.Tab, null, "Alert
|
|
78
|
+
((_d = data.AlertProperties) === null || _d === void 0 ? void 0 : _d.DisplayNotification) ? (React.createElement(Tabs_1.Tabs, { "data-name": "alert-preview", autoFocus: false },
|
|
79
|
+
React.createElement(Tabs_1.Tabs.Tab, null, "Alert Preview"),
|
|
118
80
|
React.createElement(Tabs_1.Tabs.Content, null, typeof data.AlertForm === 'string' ? (React.createElement(rebass_1.Text, { fontSize: 2 }, "Preview not available because form is dynamically driven")) : (React.createElement(exports.AlertPreview, { alertDefinition: data, api: api }))))) : null));
|
|
119
81
|
};
|
|
120
|
-
exports.
|
|
82
|
+
exports.AlertNotificationWizardSection = AlertNotificationWizardSection;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { AlertDefinition } from '../../../PredefinedConfig/AlertState';
|
|
3
|
-
|
|
3
|
+
import { AlertType } from '../Utilities/getAlertType';
|
|
4
|
+
export declare const getRuleStepDescription: (alertType: AlertType) => "" | JSX.Element;
|
|
5
|
+
export declare const renderAlertRulesSummary: (alertDefinition: AlertDefinition) => JSX.Element;
|
|
6
|
+
export interface AlertRulesWizardSectionProps {
|
|
4
7
|
onChange: (data: AlertDefinition) => void;
|
|
5
8
|
module: 'alert';
|
|
6
|
-
|
|
9
|
+
wholeRowScope?: boolean;
|
|
10
|
+
alertType: AlertType | null;
|
|
11
|
+
}
|
|
7
12
|
export declare const AlertRulesWizardSection: (props: AlertRulesWizardSectionProps) => JSX.Element;
|
|
8
|
-
export declare const renderAlertRulesSummary: (alertDefinition: AlertDefinition) => JSX.Element;
|
|
9
|
-
export {};
|
|
@@ -1,19 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.renderAlertRulesSummary = exports.
|
|
3
|
+
exports.AlertRulesWizardSection = exports.renderAlertRulesSummary = exports.getRuleStepDescription = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
|
-
const BaseAlertRulesWizardSection_1 = require("./BaseAlertRulesWizardSection");
|
|
7
6
|
const EntityRulesEditor_1 = require("../../Components/EntityRulesEditor");
|
|
8
7
|
const Tag_1 = require("../../../components/Tag");
|
|
9
|
-
const
|
|
10
|
-
|
|
8
|
+
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
|
|
9
|
+
const getAvailablePredicates_1 = require("../Utilities/getAvailablePredicates");
|
|
10
|
+
const Tabs_1 = require("../../../components/Tabs");
|
|
11
|
+
const Radio_1 = tslib_1.__importDefault(require("../../../components/Radio"));
|
|
12
|
+
const rebass_1 = require("rebass");
|
|
13
|
+
const getRuleStepDescription = (alertType) => {
|
|
14
|
+
switch (alertType) {
|
|
15
|
+
case 'DataChange':
|
|
16
|
+
return (React.createElement(React.Fragment, null,
|
|
17
|
+
"Build the Rule ",
|
|
18
|
+
React.createElement("b", null, "when"),
|
|
19
|
+
" the Alert should trigger, using a Predicate or a Query"));
|
|
20
|
+
case 'RowChange':
|
|
21
|
+
return React.createElement(React.Fragment, null, "Specify which type of Row Change will trigger the Alert");
|
|
22
|
+
case 'Aggregation':
|
|
23
|
+
return React.createElement(React.Fragment, null, "Build an Aggregation Boolean Rule to specify when the Alert should trigger");
|
|
24
|
+
case 'Observable':
|
|
25
|
+
return React.createElement(React.Fragment, null, "Build an Observable Rule to specify when the Alert should trigger");
|
|
26
|
+
}
|
|
27
|
+
return '';
|
|
11
28
|
};
|
|
12
|
-
exports.
|
|
29
|
+
exports.getRuleStepDescription = getRuleStepDescription;
|
|
13
30
|
const renderAlertRulesSummary = (alertDefinition) => {
|
|
14
31
|
return (React.createElement(EntityRulesEditor_1.EntityRulesSummary, { data: alertDefinition, renderPredicate: (contents) => {
|
|
15
32
|
return (React.createElement(React.Fragment, null,
|
|
16
|
-
"Alert
|
|
33
|
+
"Alert Rule ",
|
|
17
34
|
React.createElement(Tag_1.Tag, null, contents)));
|
|
18
35
|
}, renderQueryExpression: (contents) => {
|
|
19
36
|
return (React.createElement(React.Fragment, null,
|
|
@@ -22,3 +39,46 @@ const renderAlertRulesSummary = (alertDefinition) => {
|
|
|
22
39
|
} }));
|
|
23
40
|
};
|
|
24
41
|
exports.renderAlertRulesSummary = renderAlertRulesSummary;
|
|
42
|
+
const RowChangeEditor = (props) => {
|
|
43
|
+
var _a, _b, _c;
|
|
44
|
+
const predicate = (_c = (_b = (_a = props.alert.Rule) === null || _a === void 0 ? void 0 : _a.Predicates) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : { PredicateId: null };
|
|
45
|
+
const handleChange = (predicateId) => {
|
|
46
|
+
props.onChange(Object.assign(Object.assign({}, props.alert), { Rule: {
|
|
47
|
+
Predicates: [{ PredicateId: predicateId }],
|
|
48
|
+
} }));
|
|
49
|
+
};
|
|
50
|
+
return (React.createElement(rebass_1.Box, { p: 2 },
|
|
51
|
+
React.createElement(Tabs_1.Tabs, null,
|
|
52
|
+
React.createElement(Tabs_1.Tabs.Tab, null, "Row Change"),
|
|
53
|
+
React.createElement(Tabs_1.Tabs.Content, null,
|
|
54
|
+
React.createElement(Radio_1.default, { onClick: () => handleChange('AddedRow'), checked: predicate.PredicateId === 'AddedRow' }, "Row Added"),
|
|
55
|
+
React.createElement(Radio_1.default, { onClick: () => handleChange('RemovedRow'), checked: predicate.PredicateId === 'RemovedRow' }, "Row Removed")))));
|
|
56
|
+
};
|
|
57
|
+
const AlertRulesWizardSection = (props) => {
|
|
58
|
+
const { data, api, moduleInfo } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
59
|
+
const predicateDefs = (0, getAvailablePredicates_1.getAvailablePredicateDefinitions)(api, data.Scope, props.alertType);
|
|
60
|
+
const showObservable = props.alertType === 'Observable';
|
|
61
|
+
const showAggregation = props.alertType === 'Aggregation';
|
|
62
|
+
const showBoolean = props.alertType === 'DataChange';
|
|
63
|
+
const showPredicate = props.alertType === 'DataChange' || props.alertType === 'RowChange';
|
|
64
|
+
const enablePredicateColumnId = props.alertType === 'DataChange';
|
|
65
|
+
if (props.alertType === 'RowChange') {
|
|
66
|
+
return React.createElement(RowChangeEditor, { alert: data, onChange: props.onChange });
|
|
67
|
+
}
|
|
68
|
+
return (React.createElement(EntityRulesEditor_1.EntityRulesEditor, { module: moduleInfo.ModuleName, defaultPredicateId: "Any", data: data, predicateDefs: predicateDefs, enablePredicateColumnId: enablePredicateColumnId, getPredicateDefsForColId: (colId) => (0, getAvailablePredicates_1.getAvailablePredicateDefinitions)(api, { ColumnIds: [colId] }, props.alertType), onChange: props.onChange, showAggregation: showAggregation, showObservable: showObservable, showBoolean: showBoolean, showPredicate: showPredicate, descriptions: {
|
|
69
|
+
selectPredicate: 'Create an Alert Rule - to be applied when data changes',
|
|
70
|
+
useBooleanQuery: (React.createElement(React.Fragment, null,
|
|
71
|
+
"Use an BooleanQuery if ",
|
|
72
|
+
React.createElement("i", null, "Scope"),
|
|
73
|
+
" is 'All Columns' - so any data change may be evaluated in a complex BooleanExpression")),
|
|
74
|
+
useObservableQuery: (React.createElement(React.Fragment, null,
|
|
75
|
+
"Use an ObservableQuery if ",
|
|
76
|
+
React.createElement("i", null, "Scope"),
|
|
77
|
+
" is 'All Columns' - so any data change may be evaluated in a complex ObservableExpression")),
|
|
78
|
+
useAggregationQuery: (React.createElement(React.Fragment, null,
|
|
79
|
+
"Use an AggregatedBooleanQuery if ",
|
|
80
|
+
React.createElement("i", null, "Scope"),
|
|
81
|
+
" is 'All Columns' - so any data change may be evaluated in a complex AggregatedBooleanExpression")),
|
|
82
|
+
} }));
|
|
83
|
+
};
|
|
84
|
+
exports.AlertRulesWizardSection = AlertRulesWizardSection;
|