@sapui5/sap.fe.core 1.135.0 → 1.136.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/package.json +1 -1
- package/src/sap/fe/core/.library +1 -1
- package/src/sap/fe/core/ActionRuntime.js +3 -2
- package/src/sap/fe/core/ActionRuntime.ts +3 -1
- package/src/sap/fe/core/AppComponent.js +6 -4
- package/src/sap/fe/core/AppComponent.ts +3 -1
- package/src/sap/fe/core/AppStateHandler.js +8 -6
- package/src/sap/fe/core/AppStateHandler.ts +7 -5
- package/src/sap/fe/core/CommonUtils.js +4 -1
- package/src/sap/fe/core/CommonUtils.ts +12 -2
- package/src/sap/fe/core/ExtensionAPI.js +5 -3
- package/src/sap/fe/core/ExtensionAPI.ts +4 -2
- package/src/sap/fe/core/PageController.js +13 -1
- package/src/sap/fe/core/PageController.ts +13 -0
- package/src/sap/fe/core/buildingBlocks/BuildingBlock.js +13 -5
- package/src/sap/fe/core/buildingBlocks/BuildingBlock.ts +19 -6
- package/src/sap/fe/core/controllerextensions/BaseControllerExtension.js +4 -2
- package/src/sap/fe/core/controllerextensions/BaseControllerExtension.ts +3 -1
- package/src/sap/fe/core/controllerextensions/EditFlow.js +58 -14
- package/src/sap/fe/core/controllerextensions/EditFlow.ts +71 -11
- package/src/sap/fe/core/controllerextensions/InlineEditFlow.js +184 -17
- package/src/sap/fe/core/controllerextensions/InlineEditFlow.ts +204 -12
- package/src/sap/fe/core/controllerextensions/InternalRouting.js +12 -3
- package/src/sap/fe/core/controllerextensions/InternalRouting.ts +11 -1
- package/src/sap/fe/core/controllerextensions/MessageHandler.js +35 -5
- package/src/sap/fe/core/controllerextensions/MessageHandler.ts +41 -1
- package/src/sap/fe/core/controllerextensions/Routing.js +6 -6
- package/src/sap/fe/core/controllerextensions/Routing.ts +2 -2
- package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.js +3 -11
- package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.ts +2 -10
- package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.js +11 -1
- package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.ts +12 -0
- package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.js +21 -6
- package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.ts +19 -5
- package/src/sap/fe/core/controllerextensions/editFlow/draft.js +17 -14
- package/src/sap/fe/core/controllerextensions/editFlow/draft.ts +19 -17
- package/src/sap/fe/core/controllerextensions/editFlow/draftDataLossPopup.js +2 -2
- package/src/sap/fe/core/controllerextensions/editFlow/draftDataLossPopup.ts +4 -1
- package/src/sap/fe/core/controllerextensions/editFlow/operations/ODataOperation.js +10 -2
- package/src/sap/fe/core/controllerextensions/editFlow/operations/ODataOperation.ts +8 -2
- package/src/sap/fe/core/controllerextensions/editFlow/operations/ODataStrictHandling.js +2 -2
- package/src/sap/fe/core/controllerextensions/editFlow/operations/ODataStrictHandling.ts +1 -1
- package/src/sap/fe/core/controllerextensions/editFlow/operations/Operation.js +1 -1
- package/src/sap/fe/core/controllerextensions/editFlow/operations/Operation.ts +33 -31
- package/src/sap/fe/core/controllerextensions/editFlow/operations/facade.js +2 -2
- package/src/sap/fe/core/controllerextensions/editFlow/operations/facade.ts +3 -3
- package/src/sap/fe/core/controllerextensions/editFlow/sticky.js +4 -1
- package/src/sap/fe/core/controllerextensions/editFlow/sticky.ts +2 -1
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DraftDataLossDialog.js +2 -2
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DraftDataLossDialog.tsx +8 -1
- package/src/sap/fe/core/controls/HideFormGroupAutomatically.js +4 -3
- package/src/sap/fe/core/controls/HideFormGroupAutomatically.ts +7 -2
- package/src/sap/fe/core/controls/inlineEditFlow/BeforeActionDialog.js +68 -0
- package/src/sap/fe/core/controls/inlineEditFlow/BeforeActionDialog.tsx +52 -0
- package/src/sap/fe/core/controls/inlineEditFlow/BeforeNavigationDialog.js +144 -0
- package/src/sap/fe/core/controls/inlineEditFlow/BeforeNavigationDialog.tsx +128 -0
- package/src/sap/fe/core/controls/inlineEditFlow/DraftExistsDialog.js +53 -0
- package/src/sap/fe/core/controls/inlineEditFlow/DraftExistsDialog.tsx +39 -0
- package/src/sap/fe/core/converters/ManifestSettings.js +1 -1
- package/src/sap/fe/core/converters/ManifestSettings.ts +18 -8
- package/src/sap/fe/core/converters/controls/Common/Action.js +54 -5
- package/src/sap/fe/core/converters/controls/Common/Action.ts +59 -3
- package/src/sap/fe/core/converters/controls/Common/Chart.js +22 -4
- package/src/sap/fe/core/converters/controls/Common/Chart.ts +23 -4
- package/src/sap/fe/core/converters/controls/Common/Form.js +13 -4
- package/src/sap/fe/core/converters/controls/Common/Form.ts +13 -3
- package/src/sap/fe/core/converters/controls/Common/Table.js +29 -9
- package/src/sap/fe/core/converters/controls/Common/Table.ts +38 -8
- package/src/sap/fe/core/converters/controls/Common/table/Columns.js +14 -16
- package/src/sap/fe/core/converters/controls/Common/table/Columns.ts +61 -96
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +62 -13
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +75 -13
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +4 -33
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +4 -44
- package/src/sap/fe/core/converters/controls/ListReport/FilterField.js +106 -0
- package/src/sap/fe/core/converters/controls/ListReport/FilterField.ts +129 -0
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +9 -4
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +8 -3
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +7 -2
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +5 -1
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +29 -7
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +40 -16
- package/src/sap/fe/core/designtime/AnnotationBasedChanges.js +34 -16
- package/src/sap/fe/core/designtime/AnnotationBasedChanges.ts +35 -16
- package/src/sap/fe/core/designtime/messagebundle_ar.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_bg.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_ca.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_cnr.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_cs.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_cy.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_da.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_de.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_el.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_en.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_en_GB.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_es.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_es_MX.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_et.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_fi.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_fr.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_fr_CA.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_hi.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_hr.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_hu.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_id.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_it.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_iw.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_ja.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_kk.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_ko.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_lt.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_lv.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_mk.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_ms.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_nl.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_no.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_pl.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_pt.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_pt_PT.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_ro.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_ru.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_sh.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_sk.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_sl.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_sr.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_sv.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_th.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_tr.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_uk.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_vi.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_zh_CN.properties +7 -0
- package/src/sap/fe/core/designtime/messagebundle_zh_TW.properties +7 -0
- package/src/sap/fe/core/fpm/manifest.json +1 -1
- package/src/sap/fe/core/helpers/AppStartupHelper.js +24 -3
- package/src/sap/fe/core/helpers/AppStartupHelper.ts +28 -2
- package/src/sap/fe/core/helpers/BindingHelper.js +3 -2
- package/src/sap/fe/core/helpers/BindingHelper.ts +2 -1
- package/src/sap/fe/core/helpers/DeleteHelper.js +4 -9
- package/src/sap/fe/core/helpers/DeleteHelper.ts +3 -8
- package/src/sap/fe/core/helpers/ModelHelper.js +14 -4
- package/src/sap/fe/core/helpers/ModelHelper.ts +15 -4
- package/src/sap/fe/core/helpers/PasteHelper.js +38 -39
- package/src/sap/fe/core/helpers/PasteHelper.ts +49 -51
- package/src/sap/fe/core/helpers/WebSocket.js +10 -1
- package/src/sap/fe/core/helpers/WebSocket.ts +8 -0
- package/src/sap/fe/core/library.js +1 -1
- package/src/sap/fe/core/messagebundle.properties +41 -2
- package/src/sap/fe/core/messagebundle_ar.properties +23 -2
- package/src/sap/fe/core/messagebundle_bg.properties +23 -2
- package/src/sap/fe/core/messagebundle_ca.properties +21 -0
- package/src/sap/fe/core/messagebundle_cnr.properties +23 -2
- package/src/sap/fe/core/messagebundle_cs.properties +21 -0
- package/src/sap/fe/core/messagebundle_cy.properties +21 -0
- package/src/sap/fe/core/messagebundle_da.properties +23 -2
- package/src/sap/fe/core/messagebundle_de.properties +23 -2
- package/src/sap/fe/core/messagebundle_el.properties +21 -0
- package/src/sap/fe/core/messagebundle_en.properties +23 -2
- package/src/sap/fe/core/messagebundle_en_GB.properties +23 -2
- package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +23 -2
- package/src/sap/fe/core/messagebundle_es.properties +21 -0
- package/src/sap/fe/core/messagebundle_es_MX.properties +21 -0
- package/src/sap/fe/core/messagebundle_et.properties +21 -0
- package/src/sap/fe/core/messagebundle_fi.properties +21 -0
- package/src/sap/fe/core/messagebundle_fr.properties +22 -1
- package/src/sap/fe/core/messagebundle_fr_CA.properties +21 -0
- package/src/sap/fe/core/messagebundle_hi.properties +22 -1
- package/src/sap/fe/core/messagebundle_hr.properties +24 -3
- package/src/sap/fe/core/messagebundle_hu.properties +21 -0
- package/src/sap/fe/core/messagebundle_id.properties +21 -0
- package/src/sap/fe/core/messagebundle_it.properties +23 -2
- package/src/sap/fe/core/messagebundle_iw.properties +21 -0
- package/src/sap/fe/core/messagebundle_ja.properties +21 -0
- package/src/sap/fe/core/messagebundle_kk.properties +21 -0
- package/src/sap/fe/core/messagebundle_ko.properties +21 -0
- package/src/sap/fe/core/messagebundle_lt.properties +21 -0
- package/src/sap/fe/core/messagebundle_lv.properties +23 -2
- package/src/sap/fe/core/messagebundle_mk.properties +21 -0
- package/src/sap/fe/core/messagebundle_ms.properties +22 -1
- package/src/sap/fe/core/messagebundle_nl.properties +21 -0
- package/src/sap/fe/core/messagebundle_no.properties +21 -0
- package/src/sap/fe/core/messagebundle_pl.properties +23 -2
- package/src/sap/fe/core/messagebundle_pt.properties +23 -2
- package/src/sap/fe/core/messagebundle_pt_PT.properties +21 -0
- package/src/sap/fe/core/messagebundle_ro.properties +23 -2
- package/src/sap/fe/core/messagebundle_ru.properties +22 -1
- package/src/sap/fe/core/messagebundle_sh.properties +23 -2
- package/src/sap/fe/core/messagebundle_sk.properties +21 -0
- package/src/sap/fe/core/messagebundle_sl.properties +23 -2
- package/src/sap/fe/core/messagebundle_sr.properties +23 -2
- package/src/sap/fe/core/messagebundle_sv.properties +21 -0
- package/src/sap/fe/core/messagebundle_th.properties +21 -0
- package/src/sap/fe/core/messagebundle_tr.properties +21 -0
- package/src/sap/fe/core/messagebundle_uk.properties +23 -2
- package/src/sap/fe/core/messagebundle_vi.properties +23 -2
- package/src/sap/fe/core/messagebundle_zh_CN.properties +23 -2
- package/src/sap/fe/core/messagebundle_zh_TW.properties +21 -0
- package/src/sap/fe/core/rootView/Fcl.controller.js +5 -5
- package/src/sap/fe/core/rootView/Fcl.controller.ts +10 -4
- package/src/sap/fe/core/rootView/NavContainer.controller.js +2 -2
- package/src/sap/fe/core/rootView/NavContainer.controller.ts +1 -1
- package/src/sap/fe/core/rootView/RootViewBaseController.js +61 -9
- package/src/sap/fe/core/rootView/RootViewBaseController.ts +70 -7
- package/src/sap/fe/core/services/CollaborationManagerServiceFactory.js +28 -12
- package/src/sap/fe/core/services/CollaborationManagerServiceFactory.ts +27 -13
- package/src/sap/fe/core/services/EnvironmentServiceFactory.js +7 -1
- package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +6 -0
- package/src/sap/fe/core/services/RoutingServiceFactory.js +3 -2
- package/src/sap/fe/core/services/RoutingServiceFactory.ts +2 -1
- package/src/sap/fe/core/services/ShellServicesFactory.js +4 -3
- package/src/sap/fe/core/services/ShellServicesFactory.ts +5 -3
- package/src/sap/fe/core/services/SideEffectsServiceFactory.js +27 -3
- package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +32 -3
- package/src/sap/fe/core/services/view/TemplatingErrorPage.view.xml +1 -1
- package/src/sap/fe/core/templating/EntitySetHelper.js +198 -58
- package/src/sap/fe/core/templating/EntitySetHelper.ts +221 -61
- package/src/sap/fe/core/templating/SemanticObjectHelper.js +6 -7
- package/src/sap/fe/core/templating/SemanticObjectHelper.ts +9 -7
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import type { Property } from "@sap-ux/vocabularies-types";
|
|
2
2
|
import Log from "sap/base/Log";
|
|
3
|
-
import type
|
|
4
|
-
import { defineUI5Class } from "sap/fe/base/ClassSupport";
|
|
3
|
+
import { defineUI5Class, methodOverride, type EnhanceWithUI5 } from "sap/fe/base/ClassSupport";
|
|
5
4
|
import { hookable } from "sap/fe/base/HookSupport";
|
|
6
5
|
import CommonUtils from "sap/fe/core/CommonUtils";
|
|
7
6
|
import type PageController from "sap/fe/core/PageController";
|
|
8
7
|
import BaseControllerExtension from "sap/fe/core/controllerextensions/BaseControllerExtension";
|
|
9
8
|
import messageHandling from "sap/fe/core/controllerextensions/messageHandler/messageHandling";
|
|
9
|
+
import BeforeActionDialog from "sap/fe/core/controls/inlineEditFlow/BeforeActionDialog";
|
|
10
|
+
import BeforeNavigationDialog, { type DIALOGRESULT } from "sap/fe/core/controls/inlineEditFlow/BeforeNavigationDialog";
|
|
10
11
|
import * as MetaModelConverter from "sap/fe/core/converters/MetaModelConverter";
|
|
11
12
|
import { isProperty } from "sap/fe/core/helpers/TypeGuards";
|
|
12
13
|
import { type DataModelObjectPath } from "sap/fe/core/templating/DataModelPathHelper";
|
|
13
14
|
import type Field from "sap/fe/macros/Field";
|
|
14
15
|
import type InlineEdit from "sap/fe/macros/inlineEdit/InlineEdit";
|
|
16
|
+
import MessageToast from "sap/m/MessageToast";
|
|
15
17
|
import type UI5Event from "sap/ui/base/Event";
|
|
18
|
+
import type ManagedObject from "sap/ui/base/ManagedObject";
|
|
16
19
|
import type Control from "sap/ui/core/Control";
|
|
20
|
+
import Lib from "sap/ui/core/Lib";
|
|
17
21
|
import Messaging from "sap/ui/core/Messaging";
|
|
18
22
|
import type Message from "sap/ui/core/message/Message";
|
|
19
23
|
import type { ODataContextBinding$PatchSentEvent } from "sap/ui/model/odata/v4/ODataContextBinding";
|
|
24
|
+
import DraftExistsDialog from "../controls/inlineEditFlow/DraftExistsDialog";
|
|
20
25
|
|
|
21
26
|
@defineUI5Class("sap.fe.core.controllerextensions.InlineEditFlow")
|
|
22
27
|
export default class InlineEditFlow extends BaseControllerExtension {
|
|
@@ -26,6 +31,10 @@ export default class InlineEditFlow extends BaseControllerExtension {
|
|
|
26
31
|
|
|
27
32
|
private inlineEditBindingContextPath?: string;
|
|
28
33
|
|
|
34
|
+
private abortTimerBeforeSave?: Function;
|
|
35
|
+
|
|
36
|
+
private patchPromise?: Promise<UI5Event>;
|
|
37
|
+
|
|
29
38
|
/**
|
|
30
39
|
* Method to know if there can be inline edit on the page.
|
|
31
40
|
* @returns True if inline edit is possible
|
|
@@ -36,10 +45,9 @@ export default class InlineEditFlow extends BaseControllerExtension {
|
|
|
36
45
|
|
|
37
46
|
/**
|
|
38
47
|
* Save the inline edit changes.
|
|
39
|
-
* @param bindingContextPath
|
|
40
48
|
* @returns A promise that resolved once the batch has returned.
|
|
41
49
|
*/
|
|
42
|
-
async inlineEditSave(
|
|
50
|
+
async inlineEditSave(): Promise<void> {
|
|
43
51
|
const model = this.base.getView().getModel();
|
|
44
52
|
|
|
45
53
|
const messages = Messaging.getMessageModel().getData();
|
|
@@ -55,7 +63,6 @@ export default class InlineEditFlow extends BaseControllerExtension {
|
|
|
55
63
|
}
|
|
56
64
|
try {
|
|
57
65
|
Messaging.removeAllMessages();
|
|
58
|
-
this.inlineEditBindingContextPath = bindingContextPath;
|
|
59
66
|
await model.submitBatch(CommonUtils.INLINEEDIT_UPDATEGROUPID);
|
|
60
67
|
} catch (error: unknown) {
|
|
61
68
|
Log.warning("Error while saving inline edit changes");
|
|
@@ -67,27 +74,40 @@ export default class InlineEditFlow extends BaseControllerExtension {
|
|
|
67
74
|
*/
|
|
68
75
|
inlineEditDiscard(): void {
|
|
69
76
|
this.base.getView().getModel().resetChanges(CommonUtils.INLINEEDIT_UPDATEGROUPID);
|
|
70
|
-
this.inlineEditEnd();
|
|
77
|
+
this.inlineEditEnd(true);
|
|
71
78
|
}
|
|
72
79
|
|
|
73
80
|
/**
|
|
74
81
|
* End the inline edit.
|
|
82
|
+
* @param refreshDescription
|
|
75
83
|
*/
|
|
76
|
-
inlineEditEnd(): void {
|
|
84
|
+
inlineEditEnd(refreshDescription?: boolean): void {
|
|
77
85
|
Messaging.removeAllMessages();
|
|
78
86
|
this.base.setShowFooter(false);
|
|
79
87
|
for (const control of this.inlineEditControls) {
|
|
80
|
-
(control as EnhanceWithUI5<Field> & InlineEdit).inlineEditEnd();
|
|
88
|
+
(control as EnhanceWithUI5<Field> & InlineEdit).inlineEditEnd(refreshDescription);
|
|
81
89
|
}
|
|
82
90
|
this.inlineEditControls = [];
|
|
91
|
+
this.base.getView().getModel("ui").setProperty("/isInlineEditActive", false);
|
|
83
92
|
}
|
|
84
93
|
|
|
85
94
|
/**
|
|
86
95
|
* Start the inline edit on the bindingContextPath for the propertyFullyQualifiedName.
|
|
87
96
|
* @param propertyFullyQualifiedName
|
|
88
97
|
* @param bindingContextPath
|
|
98
|
+
* @param controlTrigger
|
|
89
99
|
*/
|
|
90
|
-
startInlineEdit(
|
|
100
|
+
startInlineEdit(
|
|
101
|
+
propertyFullyQualifiedName: string,
|
|
102
|
+
bindingContextPath: string,
|
|
103
|
+
controlTrigger?: EnhanceWithUI5<Field> & InlineEdit
|
|
104
|
+
): void {
|
|
105
|
+
if (controlTrigger?.getBindingContext()?.getProperty("HasDraftEntity")) {
|
|
106
|
+
// there is already a draft on the entity. We should not start inline edit
|
|
107
|
+
new DraftExistsDialog(this.base.getView()).open();
|
|
108
|
+
controlTrigger?.resetIndicatorPopup();
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
91
111
|
const inlineEditService = this.base.getAppComponent().getInlineEditService();
|
|
92
112
|
const dependentProperties = inlineEditService.getInlineConnectedProperties(
|
|
93
113
|
this.base.getRoutingTargetName(),
|
|
@@ -95,6 +115,7 @@ export default class InlineEditFlow extends BaseControllerExtension {
|
|
|
95
115
|
);
|
|
96
116
|
|
|
97
117
|
this.inlineEditStart([], dependentProperties?.length ? dependentProperties : [propertyFullyQualifiedName], bindingContextPath);
|
|
118
|
+
this.base.getView().getModel("ui").setProperty("/isInlineEditActive", true);
|
|
98
119
|
}
|
|
99
120
|
|
|
100
121
|
/**
|
|
@@ -119,13 +140,21 @@ export default class InlineEditFlow extends BaseControllerExtension {
|
|
|
119
140
|
*/
|
|
120
141
|
@hookable("Before")
|
|
121
142
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
122
|
-
inlineEditStart(inlineEditControls: Control[], properties: string[], bindingContextPath: string): void {
|
|
143
|
+
async inlineEditStart(inlineEditControls: Control[], properties: string[], bindingContextPath: string): Promise<void> {
|
|
144
|
+
if (this.abortTimerBeforeSave) {
|
|
145
|
+
// if there is a timer to save
|
|
146
|
+
this.abortTimerBeforeSave();
|
|
147
|
+
this.abortTimerBeforeSave = undefined;
|
|
148
|
+
await this.inlineEditSave();
|
|
149
|
+
}
|
|
123
150
|
const alreadyRegisteredControls = this.inlineEditControls.map((control: Control) => control.getId());
|
|
124
151
|
for (const control of inlineEditControls) {
|
|
125
152
|
if (!alreadyRegisteredControls.includes(control.getId())) {
|
|
126
153
|
this.inlineEditControls.push(control);
|
|
127
154
|
}
|
|
128
155
|
}
|
|
156
|
+
this.inlineEditBindingContextPath = bindingContextPath;
|
|
157
|
+
return;
|
|
129
158
|
}
|
|
130
159
|
|
|
131
160
|
/**
|
|
@@ -145,7 +174,7 @@ export default class InlineEditFlow extends BaseControllerExtension {
|
|
|
145
174
|
* @param event The event sent by the binding
|
|
146
175
|
*/
|
|
147
176
|
async handleInlineEditPatchSent(event: ODataContextBinding$PatchSentEvent): Promise<void> {
|
|
148
|
-
|
|
177
|
+
this.patchPromise = new Promise<UI5Event>((resolve, reject) => {
|
|
149
178
|
event.getSource().attachEventOnce("patchCompleted", (patchCompletedEvent: UI5Event<{ success: boolean }>) => {
|
|
150
179
|
const bSuccess = patchCompletedEvent.getParameter("success");
|
|
151
180
|
if (bSuccess) {
|
|
@@ -156,9 +185,15 @@ export default class InlineEditFlow extends BaseControllerExtension {
|
|
|
156
185
|
});
|
|
157
186
|
});
|
|
158
187
|
try {
|
|
159
|
-
await patchPromise;
|
|
188
|
+
await this.patchPromise;
|
|
189
|
+
this.patchPromise = undefined;
|
|
190
|
+
const resourceBundle = Lib.getResourceBundleFor("sap.fe.core");
|
|
191
|
+
if (resourceBundle) {
|
|
192
|
+
MessageToast.show(resourceBundle.getText("C_INLINE_EDIT_SAVED"));
|
|
193
|
+
}
|
|
160
194
|
this.inlineEditEnd();
|
|
161
195
|
} catch (patchCompletedEvent) {
|
|
196
|
+
this.patchPromise = undefined;
|
|
162
197
|
this.handleInlineEditSaveFailed();
|
|
163
198
|
}
|
|
164
199
|
}
|
|
@@ -172,6 +207,7 @@ export default class InlineEditFlow extends BaseControllerExtension {
|
|
|
172
207
|
const messages = Messaging.getMessageModel().getData();
|
|
173
208
|
if (messages.length) {
|
|
174
209
|
this.base.setShowFooter(true);
|
|
210
|
+
this.propagateInlineFieldGroupIdToMessageButton();
|
|
175
211
|
}
|
|
176
212
|
if (!this.inlineEditBindingContextPath) {
|
|
177
213
|
return;
|
|
@@ -192,4 +228,160 @@ export default class InlineEditFlow extends BaseControllerExtension {
|
|
|
192
228
|
}
|
|
193
229
|
}
|
|
194
230
|
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Performs a delayedCall when you focus out of a field.
|
|
234
|
+
*/
|
|
235
|
+
async delayedCallToSave(): Promise<void> {
|
|
236
|
+
if (this.abortTimerBeforeSave || this.patchPromise) {
|
|
237
|
+
// if there is already a timer running or a save in process do nothing
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
const timerBeforeSave = new Promise<void>((resolve, reject) => {
|
|
241
|
+
this.abortTimerBeforeSave = reject;
|
|
242
|
+
setTimeout(() => resolve(), 500);
|
|
243
|
+
});
|
|
244
|
+
try {
|
|
245
|
+
await timerBeforeSave;
|
|
246
|
+
this.abortTimerBeforeSave = undefined;
|
|
247
|
+
this.inlineEditSave();
|
|
248
|
+
} catch (e) {
|
|
249
|
+
// Nothing to see it is just someone that cancelled the timer
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Method to ensure we leave inline edit before any navigation..
|
|
255
|
+
* @returns Promise that retruns true if we need to cancel navigation and stay in inline edit
|
|
256
|
+
*/
|
|
257
|
+
@methodOverride("routing")
|
|
258
|
+
async onBeforeNavigation(): Promise<boolean> {
|
|
259
|
+
if (this.inlineEditControls.length > 0) {
|
|
260
|
+
// there are controls in inline edit we need to prevent the navigation and show the dialog
|
|
261
|
+
if (this.abortTimerBeforeSave) {
|
|
262
|
+
this.abortTimerBeforeSave();
|
|
263
|
+
this.abortTimerBeforeSave = undefined;
|
|
264
|
+
}
|
|
265
|
+
if (!this.base.getView().getModel().hasPendingChanges(CommonUtils.INLINEEDIT_UPDATEGROUPID)) {
|
|
266
|
+
// fields are in inline edit and there are no pending changes. We need to show the dialog
|
|
267
|
+
this.inlineEditEnd();
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
try {
|
|
271
|
+
if (this.patchPromise) {
|
|
272
|
+
await this.patchPromise;
|
|
273
|
+
} else {
|
|
274
|
+
const dialogResult = await this.openInlineEditBeforeNavigationDialogAndWaitForResult();
|
|
275
|
+
if (dialogResult === "Save") {
|
|
276
|
+
// we save and wait for the patchPromise
|
|
277
|
+
await this.inlineEditSave();
|
|
278
|
+
if (this.base.getView().getModel().hasPendingChanges(CommonUtils.INLINEEDIT_UPDATEGROUPID)) {
|
|
279
|
+
// if after saves there are still changes this means save has failed. we need to cancel navigation
|
|
280
|
+
this.focusHandling(this.inlineEditControls[0]);
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
} else if (dialogResult === "Cancel") {
|
|
284
|
+
this.focusHandling(this.inlineEditControls[0]);
|
|
285
|
+
return true;
|
|
286
|
+
} else {
|
|
287
|
+
// we discard the changes
|
|
288
|
+
this.inlineEditDiscard();
|
|
289
|
+
}
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
} catch (e) {
|
|
293
|
+
this.focusHandling(this.inlineEditControls[0]);
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return false;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Method to open the dialog before navigation.
|
|
302
|
+
* @returns Promise that returns the dialog choice once the user has clicked on ok or cancel
|
|
303
|
+
*/
|
|
304
|
+
async openInlineEditBeforeNavigationDialogAndWaitForResult(): Promise<DIALOGRESULT> {
|
|
305
|
+
return new Promise<DIALOGRESULT>((resolve) => {
|
|
306
|
+
new BeforeNavigationDialog(this.base.getView(), resolve).open();
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Method to ensure we leave inline edit before any standard edit flowaction.
|
|
312
|
+
* @returns Promise that reject and triggers save or discard if we are in inline edit
|
|
313
|
+
*/
|
|
314
|
+
async onBeforeAnyEditFlowAction(): Promise<void> {
|
|
315
|
+
if (this.inlineEditControls.length > 0) {
|
|
316
|
+
if (this.abortTimerBeforeSave) {
|
|
317
|
+
this.abortTimerBeforeSave();
|
|
318
|
+
this.abortTimerBeforeSave = undefined;
|
|
319
|
+
}
|
|
320
|
+
if (!this.base.getView().getModel().hasPendingChanges(CommonUtils.INLINEEDIT_UPDATEGROUPID)) {
|
|
321
|
+
// fields are in inline edit and there are no pending changes. We don't need to show the dialog
|
|
322
|
+
this.inlineEditEnd();
|
|
323
|
+
return Promise.resolve();
|
|
324
|
+
}
|
|
325
|
+
new BeforeActionDialog(this.base.getView()).open();
|
|
326
|
+
// there are controls in inline edit we need to prevent the action and show the dialog
|
|
327
|
+
return Promise.reject();
|
|
328
|
+
}
|
|
329
|
+
return Promise.resolve();
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Handle before edit.
|
|
334
|
+
* @returns Promise that reject if edit needs to be cancelled
|
|
335
|
+
*/
|
|
336
|
+
@methodOverride("editFlow")
|
|
337
|
+
async onBeforeEdit(): Promise<void> {
|
|
338
|
+
return this.onBeforeAnyEditFlowAction();
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Handle before create.
|
|
343
|
+
* @returns Promise that reject if cretae needs to be cancelled
|
|
344
|
+
*/
|
|
345
|
+
@methodOverride("editFlow")
|
|
346
|
+
async onBeforeCreate(): Promise<void> {
|
|
347
|
+
return this.onBeforeAnyEditFlowAction();
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Handle before delete.
|
|
352
|
+
* @returns Promise that reject if delete needs to be cancelled
|
|
353
|
+
*/
|
|
354
|
+
@methodOverride("editFlow")
|
|
355
|
+
async onBeforeDelete(): Promise<void> {
|
|
356
|
+
return this.onBeforeAnyEditFlowAction();
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Handle before action.
|
|
361
|
+
* @returns Promise that reject if delete needs to be cancelled
|
|
362
|
+
*/
|
|
363
|
+
@methodOverride("editFlow")
|
|
364
|
+
async onBeforeExecuteAction(): Promise<void> {
|
|
365
|
+
return this.onBeforeAnyEditFlowAction();
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Propagate the field group id to the message button.
|
|
370
|
+
*/
|
|
371
|
+
private propagateInlineFieldGroupIdToMessageButton(): void {
|
|
372
|
+
// we propagate the fieldgroupId to the footer and all its descendants to ensure that
|
|
373
|
+
// clicking on the footer does not trigger a focusout and a save for the inline edit
|
|
374
|
+
const footerControls =
|
|
375
|
+
(this.base
|
|
376
|
+
.getFooter()
|
|
377
|
+
?.findAggregatedObjects(true, (managedObject: ManagedObject) => managedObject.isA<Control>("sap.ui.core.Control")) as
|
|
378
|
+
| Control[]
|
|
379
|
+
| undefined) ?? [];
|
|
380
|
+
|
|
381
|
+
for (const control of footerControls) {
|
|
382
|
+
const childFieldGroupIds = new Set(control.getFieldGroupIds());
|
|
383
|
+
childFieldGroupIds.add("InlineEdit");
|
|
384
|
+
control.setFieldGroupIds(Array.from(childFieldGroupIds));
|
|
385
|
+
}
|
|
386
|
+
}
|
|
195
387
|
}
|