@sapui5/sap.fe.core 1.95.0 → 1.98.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 +5 -5
- package/src/sap/fe/core/.library +1 -1
- package/src/sap/fe/core/AnnotationHelper.js +3 -3
- package/src/sap/fe/core/AppComponent.js +9 -44
- package/src/sap/fe/core/AppStateHandler.js +2 -2
- package/src/sap/fe/core/BaseController.js +1 -1
- package/src/sap/fe/core/BusyLocker.js +13 -1
- package/src/sap/fe/core/CommonUtils.js +129 -219
- package/src/sap/fe/core/ExtensionAPI.js +14 -6
- package/src/sap/fe/core/PageController.js +9 -35
- package/src/sap/fe/core/RouterProxy.js +79 -75
- package/src/sap/fe/core/Synchronization.js +1 -1
- package/src/sap/fe/core/TemplateComponent.js +16 -7
- package/src/sap/fe/core/TemplateModel.js +1 -1
- package/src/sap/fe/core/TransactionHelper.js +183 -65
- package/src/sap/fe/core/actions/draft.js +50 -23
- package/src/sap/fe/core/actions/messageHandling.js +86 -7
- package/src/sap/fe/core/actions/nonDraft.js +1 -1
- package/src/sap/fe/core/actions/operations.js +75 -33
- package/src/sap/fe/core/actions/sticky.js +1 -1
- package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.js +1 -1
- package/src/sap/fe/core/controllerextensions/EditFlow.js +276 -122
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +1 -1
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +14 -6
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +90 -46
- package/src/sap/fe/core/controllerextensions/InternalRouting.js +234 -232
- package/src/sap/fe/core/controllerextensions/KPIManagement.js +539 -209
- package/src/sap/fe/core/controllerextensions/KPIManagement.ts +550 -213
- package/src/sap/fe/core/controllerextensions/MassEdit.js +79 -0
- package/src/sap/fe/core/controllerextensions/MessageHandler.js +227 -103
- package/src/sap/fe/core/controllerextensions/PageReady.js +2 -2
- package/src/sap/fe/core/controllerextensions/PageReady.ts +3 -7
- package/src/sap/fe/core/controllerextensions/Paginator.js +38 -12
- package/src/sap/fe/core/controllerextensions/Placeholder.js +16 -19
- package/src/sap/fe/core/controllerextensions/Routing.js +17 -2
- package/src/sap/fe/core/controllerextensions/RoutingListener.js +1 -1
- package/src/sap/fe/core/controllerextensions/Share.js +20 -7
- package/src/sap/fe/core/controllerextensions/SideEffects.js +8 -9
- package/src/sap/fe/core/controllerextensions/SideEffects.ts +19 -17
- package/src/sap/fe/core/controllerextensions/ViewState.js +54 -9
- package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +40 -34
- package/src/sap/fe/core/controls/ActionParameterDialogValueHelp.fragment.xml +35 -0
- package/src/sap/fe/core/controls/CommandExecution.js +1 -1
- package/src/sap/fe/core/controls/ConditionalWrapper.js +1 -1
- package/src/sap/fe/core/controls/CustomQuickViewPage.js +110 -109
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +7 -4
- package/src/sap/fe/core/controls/FieldWrapper.js +10 -4
- package/src/sap/fe/core/controls/FilterBar.js +1 -1
- package/src/sap/fe/core/controls/FormElementWrapper.js +1 -6
- package/src/sap/fe/core/controls/MultiValueParameterDelegate.js +45 -0
- package/src/sap/fe/core/controls/NonComputedVisibleKeyFieldsDialog.fragment.xml +1 -1
- package/src/sap/fe/core/controls/filterbar/FilterContainer.js +1 -1
- package/src/sap/fe/core/controls/filterbar/VisualFilter.js +1 -1
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +1 -1
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +1 -1
- package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +106 -0
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +78 -0
- package/src/sap/fe/core/converters/ConverterContext.js +13 -1
- package/src/sap/fe/core/converters/ConverterContext.ts +10 -0
- package/src/sap/fe/core/converters/ManifestSettings.js +2 -1
- package/src/sap/fe/core/converters/ManifestSettings.ts +7 -1
- package/src/sap/fe/core/converters/ManifestWrapper.js +18 -7
- package/src/sap/fe/core/converters/ManifestWrapper.ts +15 -6
- package/src/sap/fe/core/converters/MetaModelConverter.js +920 -882
- package/src/sap/fe/core/converters/MetaModelConverter.ts +829 -853
- package/src/sap/fe/core/converters/annotations/DataField.js +54 -4
- package/src/sap/fe/core/converters/annotations/DataField.ts +53 -3
- package/src/sap/fe/core/converters/common/AnnotationConverter.js +83 -48
- package/src/sap/fe/core/converters/controls/Common/Action.js +15 -3
- package/src/sap/fe/core/converters/controls/Common/Action.ts +12 -3
- package/src/sap/fe/core/converters/controls/Common/Chart.js +1 -3
- package/src/sap/fe/core/converters/controls/Common/Chart.ts +0 -2
- package/src/sap/fe/core/converters/controls/Common/Form.js +68 -21
- package/src/sap/fe/core/converters/controls/Common/Form.ts +60 -16
- package/src/sap/fe/core/converters/controls/Common/KPI.js +331 -248
- package/src/sap/fe/core/converters/controls/Common/KPI.ts +355 -287
- package/src/sap/fe/core/converters/controls/Common/Table.js +426 -332
- package/src/sap/fe/core/converters/controls/Common/Table.ts +516 -383
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +468 -0
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +609 -0
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +30 -13
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +31 -12
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +2 -2
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +1 -1
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +15 -7
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +27 -6
- package/src/sap/fe/core/converters/helpers/Aggregation.js +8 -1
- package/src/sap/fe/core/converters/helpers/Aggregation.ts +9 -1
- package/src/sap/fe/core/converters/helpers/BindingHelper.js +3 -2
- package/src/sap/fe/core/converters/helpers/BindingHelper.ts +2 -2
- package/src/sap/fe/core/converters/helpers/ID.js +9 -1
- package/src/sap/fe/core/converters/helpers/ID.ts +6 -2
- package/src/sap/fe/core/converters/helpers/IssueManager.js +7 -5
- package/src/sap/fe/core/converters/helpers/IssueManager.ts +6 -4
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +2 -2
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +1 -1
- package/src/sap/fe/core/converters/templates/ListReportConverter.js +34 -4
- package/src/sap/fe/core/converters/templates/ListReportConverter.ts +36 -7
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +2 -5
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +1 -2
- package/src/sap/fe/core/designtime/AppComponent.designtime.js +11 -2
- package/src/sap/fe/core/formatters/FPMFormatter.js +1 -1
- package/src/sap/fe/core/formatters/FPMFormatter.ts +8 -3
- package/src/sap/fe/core/formatters/TableFormatter.js +27 -4
- package/src/sap/fe/core/formatters/TableFormatter.ts +20 -3
- package/src/sap/fe/core/formatters/ValueFormatter.js +30 -5
- package/src/sap/fe/core/formatters/ValueFormatter.ts +25 -3
- package/src/sap/fe/core/fpm/Component.js +2 -2
- package/src/sap/fe/core/helpers/AppStartupHelper.js +359 -0
- package/src/sap/fe/core/helpers/AppStartupHelper.ts +388 -0
- package/src/sap/fe/core/helpers/BindingExpression.js +199 -111
- package/src/sap/fe/core/helpers/BindingExpression.ts +193 -102
- package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.js +1 -1
- package/src/sap/fe/core/helpers/EditState.js +1 -1
- package/src/sap/fe/core/helpers/ExcelFormatHelper.js +1 -3
- package/src/sap/fe/core/helpers/FPMHelper.js +1 -1
- package/src/sap/fe/core/helpers/KeepAliveHelper.js +211 -0
- package/src/sap/fe/core/helpers/KeepAliveHelper.ts +202 -0
- package/src/sap/fe/core/helpers/KeepAliveRefreshTypes.js +32 -0
- package/src/sap/fe/core/helpers/KeepAliveRefreshTypes.ts +36 -0
- package/src/sap/fe/core/helpers/MassEditHelper.js +678 -0
- package/src/sap/fe/core/helpers/ModelHelper.js +64 -1
- package/src/sap/fe/core/helpers/PasteHelper.js +7 -1
- package/src/sap/fe/core/helpers/SemanticDateOperators.js +1 -1
- package/src/sap/fe/core/helpers/SemanticKeyHelper.js +1 -1
- package/src/sap/fe/core/helpers/StableIdHelper.js +2 -2
- package/src/sap/fe/core/helpers/StableIdHelper.ts +1 -1
- package/src/sap/fe/core/library.js +28 -2
- package/src/sap/fe/core/library.support.js +10 -4
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +62 -0
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +66 -0
- package/src/sap/fe/core/messagebundle.properties +67 -3
- package/src/sap/fe/core/messagebundle_ar.properties +40 -3
- package/src/sap/fe/core/messagebundle_bg.properties +40 -3
- package/src/sap/fe/core/messagebundle_ca.properties +41 -4
- package/src/sap/fe/core/messagebundle_cs.properties +41 -4
- package/src/sap/fe/core/messagebundle_cy.properties +40 -3
- package/src/sap/fe/core/messagebundle_da.properties +40 -3
- package/src/sap/fe/core/messagebundle_de.properties +40 -3
- package/src/sap/fe/core/messagebundle_el.properties +40 -3
- package/src/sap/fe/core/messagebundle_en.properties +37 -0
- package/src/sap/fe/core/messagebundle_en_GB.properties +37 -0
- package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +37 -0
- package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +46 -2
- package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +44 -0
- package/src/sap/fe/core/messagebundle_es.properties +40 -3
- package/src/sap/fe/core/messagebundle_es_MX.properties +41 -4
- package/src/sap/fe/core/messagebundle_et.properties +40 -3
- package/src/sap/fe/core/messagebundle_fi.properties +40 -3
- package/src/sap/fe/core/messagebundle_fr.properties +41 -4
- package/src/sap/fe/core/messagebundle_fr_CA.properties +40 -3
- package/src/sap/fe/core/messagebundle_hi.properties +40 -3
- package/src/sap/fe/core/messagebundle_hr.properties +40 -3
- package/src/sap/fe/core/messagebundle_hu.properties +41 -4
- package/src/sap/fe/core/messagebundle_id.properties +42 -5
- package/src/sap/fe/core/messagebundle_it.properties +40 -3
- package/src/sap/fe/core/messagebundle_iw.properties +40 -3
- package/src/sap/fe/core/messagebundle_ja.properties +49 -12
- package/src/sap/fe/core/messagebundle_kk.properties +40 -3
- package/src/sap/fe/core/messagebundle_ko.properties +40 -3
- package/src/sap/fe/core/messagebundle_lt.properties +40 -3
- package/src/sap/fe/core/messagebundle_lv.properties +40 -3
- package/src/sap/fe/core/messagebundle_ms.properties +40 -3
- package/src/sap/fe/core/messagebundle_nl.properties +40 -3
- package/src/sap/fe/core/messagebundle_no.properties +40 -3
- package/src/sap/fe/core/messagebundle_pl.properties +40 -3
- package/src/sap/fe/core/messagebundle_pt.properties +42 -5
- package/src/sap/fe/core/messagebundle_pt_PT.properties +40 -3
- package/src/sap/fe/core/messagebundle_ro.properties +40 -3
- package/src/sap/fe/core/messagebundle_ru.properties +40 -3
- package/src/sap/fe/core/messagebundle_sh.properties +40 -3
- package/src/sap/fe/core/messagebundle_sk.properties +40 -3
- package/src/sap/fe/core/messagebundle_sl.properties +40 -3
- package/src/sap/fe/core/messagebundle_sv.properties +41 -4
- package/src/sap/fe/core/messagebundle_th.properties +40 -3
- package/src/sap/fe/core/messagebundle_tr.properties +40 -3
- package/src/sap/fe/core/messagebundle_uk.properties +40 -3
- package/src/sap/fe/core/messagebundle_vi.properties +40 -3
- package/src/sap/fe/core/messagebundle_zh_CN.properties +40 -3
- package/src/sap/fe/core/messagebundle_zh_TW.properties +40 -3
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +1 -1
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +1 -1
- package/src/sap/fe/core/services/EnvironmentServiceFactory.js +4 -3
- package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +3 -0
- package/src/sap/fe/core/services/NavigationServiceFactory.js +1 -1
- package/src/sap/fe/core/services/ResourceModelServiceFactory.js +1 -1
- package/src/sap/fe/core/services/RoutingServiceFactory.js +98 -328
- package/src/sap/fe/core/services/ShellServicesFactory.js +31 -2
- package/src/sap/fe/core/services/ShellServicesFactory.ts +30 -1
- package/src/sap/fe/core/services/SideEffectsServiceFactory.js +8 -5
- package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +11 -6
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +14 -5
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.js +1 -1
- package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.js +38 -0
- package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.ts +18 -0
- package/src/sap/fe/core/templating/DataModelPathHelper.js +8 -37
- package/src/sap/fe/core/templating/DataModelPathHelper.ts +13 -33
- package/src/sap/fe/core/templating/DisplayModeFormatter.js +114 -0
- package/src/sap/fe/core/templating/DisplayModeFormatter.ts +86 -0
- package/src/sap/fe/core/templating/EntitySetHelper.js +86 -3
- package/src/sap/fe/core/templating/EntitySetHelper.ts +44 -0
- package/src/sap/fe/core/templating/FilterHelper.js +10 -7
- package/src/sap/fe/core/templating/FilterHelper.ts +8 -6
- package/src/sap/fe/core/templating/PropertyHelper.js +2 -2
- package/src/sap/fe/core/templating/PropertyHelper.ts +1 -1
- package/src/sap/fe/core/templating/UIFormatters.js +47 -107
- package/src/sap/fe/core/templating/UIFormatters.ts +76 -72
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* SAPUI5
|
|
3
|
-
* (c) Copyright 2009-
|
|
3
|
+
* (c) Copyright 2009-2022 SAP SE. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
sap.ui.define(
|
|
6
6
|
[
|
|
@@ -19,7 +19,8 @@ sap.ui.define(
|
|
|
19
19
|
"sap/fe/core/helpers/EditState",
|
|
20
20
|
"sap/fe/core/helpers/FPMHelper",
|
|
21
21
|
"sap/ui/core/message/Message",
|
|
22
|
-
"sap/ui/core/MessageType"
|
|
22
|
+
"sap/ui/core/MessageType",
|
|
23
|
+
"sap/fe/core/helpers/ModelHelper"
|
|
23
24
|
],
|
|
24
25
|
function(
|
|
25
26
|
ControllerExtension,
|
|
@@ -37,7 +38,8 @@ sap.ui.define(
|
|
|
37
38
|
EditState,
|
|
38
39
|
FPMHelper,
|
|
39
40
|
Message,
|
|
40
|
-
MessageType
|
|
41
|
+
MessageType,
|
|
42
|
+
ModelHelper
|
|
41
43
|
) {
|
|
42
44
|
"use strict";
|
|
43
45
|
|
|
@@ -47,7 +49,6 @@ sap.ui.define(
|
|
|
47
49
|
* @name sap.fe.core.controllerextensions.EditFlow
|
|
48
50
|
* @hideconstructor
|
|
49
51
|
* @public
|
|
50
|
-
* @experimental As of version 1.90.0
|
|
51
52
|
* @since 1.90.0
|
|
52
53
|
*/
|
|
53
54
|
|
|
@@ -66,11 +67,16 @@ sap.ui.define(
|
|
|
66
67
|
saveDocument: { "public": true, "final": true },
|
|
67
68
|
cancelDocument: { "public": true, "final": true },
|
|
68
69
|
deleteDocument: { "public": true, "final": true },
|
|
70
|
+
deleteMultipleDocuments: { "public": true, "final": true },
|
|
69
71
|
applyDocument: { "public": true, "final": true },
|
|
70
72
|
invokeAction: { "public": true, "final": true },
|
|
71
73
|
securedExecution: { "public": true, "final": true },
|
|
72
74
|
|
|
73
|
-
onBeforeSave: { "public": true, "final": false, "overrideExecution": OverrideExecution.
|
|
75
|
+
onBeforeSave: { "public": true, "final": false, "overrideExecution": OverrideExecution.After },
|
|
76
|
+
onBeforeDelete: { "public": true, "final": false, "overrideExecution": OverrideExecution.After },
|
|
77
|
+
onBeforeCreate: { "public": true, "final": false, "overrideExecution": OverrideExecution.After },
|
|
78
|
+
onBeforeEdit: { "public": true, "final": false, "overrideExecution": OverrideExecution.After },
|
|
79
|
+
onBeforeDiscard: { "public": true, "final": false, "overrideExecution": OverrideExecution.After }
|
|
74
80
|
}
|
|
75
81
|
},
|
|
76
82
|
|
|
@@ -87,10 +93,11 @@ sap.ui.define(
|
|
|
87
93
|
*
|
|
88
94
|
* @memberof sap.fe.core.controllerextensions.EditFlow
|
|
89
95
|
* @param {object} oContext Context of the active document
|
|
96
|
+
* @param {map} [mParameters] Contains the following attributes:
|
|
97
|
+
* @param {boolean} [mParameters.prepareOnEdit] For a service with a prepare action, this parameter decides if the action is to be executed
|
|
90
98
|
* @returns {Promise} Promise resolves once the editable document is available
|
|
91
99
|
* @alias sap.fe.core.controllerextensions.EditFlow#editDocument
|
|
92
100
|
* @public
|
|
93
|
-
* @experimental As of version 1.90.0
|
|
94
101
|
* @since 1.90.0
|
|
95
102
|
*/
|
|
96
103
|
editDocument: function(oContext, mParameters) {
|
|
@@ -100,8 +107,17 @@ sap.ui.define(
|
|
|
100
107
|
bDraftNavigation = true,
|
|
101
108
|
transactionHelper = this._getTransactionHelper();
|
|
102
109
|
|
|
103
|
-
return
|
|
104
|
-
.
|
|
110
|
+
return this.base.editFlow
|
|
111
|
+
.onBeforeEdit({ context: oContext })
|
|
112
|
+
.then(
|
|
113
|
+
transactionHelper.editDocument.bind(
|
|
114
|
+
transactionHelper,
|
|
115
|
+
oContext,
|
|
116
|
+
bPrepareOnEdit,
|
|
117
|
+
that.getView(),
|
|
118
|
+
that._getMessageHandler()
|
|
119
|
+
)
|
|
120
|
+
)
|
|
105
121
|
.then(function(oNewDocumentContext) {
|
|
106
122
|
var sProgrammingModel = that._getProgrammingModel(oContext);
|
|
107
123
|
|
|
@@ -113,18 +129,37 @@ sap.ui.define(
|
|
|
113
129
|
that._getMessageHandler().showMessageDialog();
|
|
114
130
|
|
|
115
131
|
if (oNewDocumentContext !== oContext) {
|
|
116
|
-
return that
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
132
|
+
return that
|
|
133
|
+
._handleNewContext(oNewDocumentContext, true, undefined, bDraftNavigation, true)
|
|
134
|
+
.then(function() {
|
|
135
|
+
if (sProgrammingModel === ProgrammingModel.Sticky) {
|
|
136
|
+
// The stickyOn handler must be set after the navigation has been done,
|
|
137
|
+
// as the URL may change in the case of FCL
|
|
138
|
+
that._handleStickyOn(oNewDocumentContext);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
123
141
|
}
|
|
124
142
|
}
|
|
143
|
+
})
|
|
144
|
+
.catch(function(oError) {
|
|
145
|
+
Log.error("Error while editing the document", oError);
|
|
125
146
|
});
|
|
126
147
|
},
|
|
127
148
|
|
|
149
|
+
deleteMultipleDocuments: function(aContexts, mParameters) {
|
|
150
|
+
if (mParameters) {
|
|
151
|
+
mParameters.beforeDeleteCallBack = this.base.editFlow.onBeforeDelete;
|
|
152
|
+
} else {
|
|
153
|
+
mParameters = {
|
|
154
|
+
beforeDeleteCallBack: this.base.editFlow.onBeforeDelete
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
return this.base
|
|
158
|
+
.getView()
|
|
159
|
+
.getController()
|
|
160
|
+
._editFlow.deleteMultipleDocuments(aContexts, mParameters);
|
|
161
|
+
},
|
|
162
|
+
|
|
128
163
|
/**
|
|
129
164
|
* Updates the draft status and displays the error messages if there are errors during an update.
|
|
130
165
|
*
|
|
@@ -134,30 +169,31 @@ sap.ui.define(
|
|
|
134
169
|
* @returns {Promise} Promise resolves once draft status has been updated
|
|
135
170
|
* @alias sap.fe.core.controllerextensions.EditFlow#updateDocument
|
|
136
171
|
* @public
|
|
137
|
-
* @experimental As of version 1.90.0
|
|
138
172
|
* @since 1.90.0
|
|
139
173
|
*/
|
|
140
174
|
updateDocument: function(oContext, oPromise) {
|
|
141
175
|
var that = this,
|
|
142
176
|
transactionHelper = that._getTransactionHelper(),
|
|
177
|
+
oBindingContext = that.getView().getBindingContext(),
|
|
143
178
|
bIsDraft = that._getProgrammingModel(oContext) === ProgrammingModel.Draft;
|
|
144
179
|
|
|
145
180
|
this._getMessageHandler().removeTransitionMessages();
|
|
146
181
|
return this._syncTask(function() {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
182
|
+
if (oBindingContext) {
|
|
183
|
+
transactionHelper.handleDocumentModifications();
|
|
184
|
+
EditState.setEditStateDirty();
|
|
150
185
|
|
|
151
|
-
|
|
152
|
-
|
|
186
|
+
if (bIsDraft) {
|
|
187
|
+
that._setDraftStatus(DraftStatus.Saving);
|
|
188
|
+
}
|
|
153
189
|
}
|
|
190
|
+
that._getMessageHandler().removeTransitionMessages();
|
|
154
191
|
|
|
155
192
|
return oPromise
|
|
156
193
|
.then(
|
|
157
194
|
function() {
|
|
158
|
-
if (bIsDraft) {
|
|
159
|
-
var
|
|
160
|
-
oMetaModel = oBindingContext.getModel().getMetaModel(),
|
|
195
|
+
if (bIsDraft && oBindingContext) {
|
|
196
|
+
var oMetaModel = oBindingContext.getModel().getMetaModel(),
|
|
161
197
|
sEntitySetName = oMetaModel.getMetaContext(oBindingContext.getPath()).getObject("@sapui.name"),
|
|
162
198
|
aSemanticKeys = SemanticKeyHelper.getSemanticKeys(oMetaModel, sEntitySetName);
|
|
163
199
|
if (aSemanticKeys && aSemanticKeys.length) {
|
|
@@ -181,7 +217,7 @@ sap.ui.define(
|
|
|
181
217
|
}
|
|
182
218
|
},
|
|
183
219
|
function() {
|
|
184
|
-
if (bIsDraft) {
|
|
220
|
+
if (bIsDraft && oBindingContext) {
|
|
185
221
|
that._setDraftStatus(DraftStatus.Clear);
|
|
186
222
|
}
|
|
187
223
|
}
|
|
@@ -190,18 +226,16 @@ sap.ui.define(
|
|
|
190
226
|
Log.error("Error while updating the document", oError);
|
|
191
227
|
})
|
|
192
228
|
.finally(function() {
|
|
193
|
-
that._getMessageHandler().
|
|
229
|
+
that._getMessageHandler().showMessages();
|
|
194
230
|
});
|
|
195
231
|
});
|
|
196
232
|
},
|
|
197
233
|
|
|
198
234
|
// Internal only params ---
|
|
199
235
|
// * @param {string} mParameters.creationMode The creation mode using one of the following:
|
|
200
|
-
// * NewPage - the created document is shown in a new page, depending on whether metadata Sync, Async or Deferred is used
|
|
201
236
|
// * Sync - the creation is triggered and once the document is created, the navigation is done
|
|
202
237
|
// * Async - the creation and the navigation to the instance are done in parallel
|
|
203
238
|
// * Deferred - the creation is done on the target page
|
|
204
|
-
// * Inline - The creation is done inline (in a table)
|
|
205
239
|
// * CreationRow - The creation is done inline async so the user is not blocked
|
|
206
240
|
// mParameters.creationRow Instance of the creation row - (TODO: get rid but use list bindings only)
|
|
207
241
|
|
|
@@ -211,10 +245,16 @@ sap.ui.define(
|
|
|
211
245
|
*
|
|
212
246
|
* @memberof sap.fe.core.controllerextensions.EditFlow
|
|
213
247
|
* @param {sap.ui.model.odata.v4.ODataListBinding|string} vListBinding ODataListBinding object or the binding path for a temporary list binding
|
|
248
|
+
* @param {map} mParameters Contains the following attributes:
|
|
249
|
+
* @param {string} mParameters.creationMode The creation mode using one of the following:
|
|
250
|
+
* NewPage - the created document is shown in a new page, depending on whether metadata 'Sync', 'Async' or 'Deferred' is used
|
|
251
|
+
* Inline - The creation is done inline (in a table)
|
|
252
|
+
* External - The creation is done in a different application specified via the parameter 'outbound'
|
|
253
|
+
* @param {string} [mParameters.outbound] The navigation target where the document is created in case of creationMode 'External'
|
|
254
|
+
* @param {boolean} [mParameters.createAtEnd] Specifies if the new entry should be created at the top or bottom of a table in case of creationMode 'Inline'
|
|
214
255
|
* @returns {Promise} Promise resolves once the object has been created
|
|
215
256
|
* @alias sap.fe.core.controllerextensions.EditFlow#createDocument
|
|
216
257
|
* @public
|
|
217
|
-
* @experimental As of version 1.90.0
|
|
218
258
|
* @since 1.90.0
|
|
219
259
|
*/
|
|
220
260
|
createDocument: function(vListBinding, mParameters) {
|
|
@@ -238,7 +278,7 @@ sap.ui.define(
|
|
|
238
278
|
// TODO: Call appropriate function (currently using the same as for outbound chevron nav, and without any context - 3rd param)
|
|
239
279
|
return this._syncTask().then(function() {
|
|
240
280
|
var oController = that.getView().getController(),
|
|
241
|
-
sCreatePath =
|
|
281
|
+
sCreatePath = ModelHelper.getAbsoluteMetaPathForListBinding(that.getView(), vListBinding);
|
|
242
282
|
|
|
243
283
|
oController.handlers.onChevronPressNavigateOutBound(oController, mParameters.outbound, undefined, sCreatePath);
|
|
244
284
|
});
|
|
@@ -485,12 +525,21 @@ sap.ui.define(
|
|
|
485
525
|
if (!mParameters.parentControl) {
|
|
486
526
|
mParameters.parentControl = that.getView();
|
|
487
527
|
}
|
|
488
|
-
return
|
|
489
|
-
oListBinding
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
528
|
+
return that.base.editFlow
|
|
529
|
+
.onBeforeCreate({ contextPath: oListBinding.getPath() })
|
|
530
|
+
.then(
|
|
531
|
+
transactionHelper.createDocument.bind(
|
|
532
|
+
transactionHelper,
|
|
533
|
+
oListBinding,
|
|
534
|
+
mParameters,
|
|
535
|
+
oResourceBundle,
|
|
536
|
+
that._getMessageHandler()
|
|
537
|
+
)
|
|
538
|
+
)
|
|
539
|
+
.catch(function(oError) {
|
|
540
|
+
Log.error("Error while creating the document", oError);
|
|
541
|
+
return Promise.reject();
|
|
542
|
+
});
|
|
494
543
|
});
|
|
495
544
|
}
|
|
496
545
|
|
|
@@ -499,18 +548,21 @@ sap.ui.define(
|
|
|
499
548
|
case CreationMode.Deferred:
|
|
500
549
|
oNavigation = oRoutingListener.navigateForwardToContext(oListBinding, {
|
|
501
550
|
bDeferredContext: true,
|
|
502
|
-
editable: true
|
|
551
|
+
editable: true,
|
|
552
|
+
bForceFocus: true
|
|
503
553
|
});
|
|
504
554
|
break;
|
|
505
555
|
case CreationMode.Async:
|
|
506
556
|
oNavigation = oRoutingListener.navigateForwardToContext(oListBinding, {
|
|
507
557
|
asyncContext: oCreation,
|
|
508
|
-
editable: true
|
|
558
|
+
editable: true,
|
|
559
|
+
bForceFocus: true
|
|
509
560
|
});
|
|
510
561
|
break;
|
|
511
562
|
case CreationMode.Sync:
|
|
512
563
|
mArgs = {
|
|
513
|
-
editable: true
|
|
564
|
+
editable: true,
|
|
565
|
+
bForceFocus: true
|
|
514
566
|
};
|
|
515
567
|
if (sProgrammingModel == ProgrammingModel.Sticky || mParameters.createAction) {
|
|
516
568
|
mArgs.transient = true;
|
|
@@ -571,10 +623,17 @@ sap.ui.define(
|
|
|
571
623
|
if (sProgrammingModel === ProgrammingModel.Sticky) {
|
|
572
624
|
that._getInternalModel().setProperty("/sessionOn", true);
|
|
573
625
|
}
|
|
626
|
+
var bIsNewPageCreation =
|
|
627
|
+
mParameters.creationMode !== CreationMode.CreationRow &&
|
|
628
|
+
mParameters.creationMode !== CreationMode.Inline;
|
|
574
629
|
if (oCreation) {
|
|
575
630
|
return Promise.all([oCreation, oNavigation])
|
|
576
631
|
.then(function(aParams) {
|
|
577
|
-
|
|
632
|
+
if (bIsNewPageCreation) {
|
|
633
|
+
that._setEditMode(EditMode.Editable, bIsNewPageCreation);
|
|
634
|
+
} else {
|
|
635
|
+
that._setEditMode(EditMode.Editable);
|
|
636
|
+
}
|
|
578
637
|
var oNewDocumentContext = aParams[0];
|
|
579
638
|
if (oNewDocumentContext) {
|
|
580
639
|
EditState.setEditStateDirty();
|
|
@@ -620,21 +679,102 @@ sap.ui.define(
|
|
|
620
679
|
},
|
|
621
680
|
|
|
622
681
|
/**
|
|
623
|
-
* This function can be used to intercept the
|
|
624
|
-
* The framework waits for the returned promise to be resolved before continuing the
|
|
625
|
-
* reject the promise the
|
|
682
|
+
* This function can be used to intercept the 'Save' action. You can execute custom coding in this function.
|
|
683
|
+
* The framework waits for the returned promise to be resolved before continuing the 'Save' action.
|
|
684
|
+
* If you reject the promise, the 'Save' action is stopped and the user stays in edit mode.
|
|
626
685
|
*
|
|
627
686
|
* This function is meant to be individually overridden by consuming controllers, but not to be called directly.
|
|
628
|
-
* The override execution is: {@link sap.ui.core.mvc.OverrideExecution.
|
|
629
|
-
*
|
|
630
|
-
* @
|
|
687
|
+
* The override execution is: {@link sap.ui.core.mvc.OverrideExecution.After}.
|
|
688
|
+
* @param {map} [mParameters] Object containing the parameters passed to onBeforeSave
|
|
689
|
+
* @param {sap.ui.model.odata.v4.Context} [mParameters.context] Page context that is going to be saved.
|
|
690
|
+
* @returns {Promise} A promise to be returned by the overridden method. If resolved, the 'Save' action is triggered. If rejected, the 'Save' action is not triggered and the user stays in edit mode.
|
|
631
691
|
* @memberof sap.fe.core.controllerextensions.EditFlow
|
|
632
692
|
* @alias sap.fe.core.controllerextensions.EditFlow#onBeforeSave
|
|
633
693
|
* @public
|
|
634
694
|
* @experimental As of version 1.90.0
|
|
635
695
|
* @since 1.90.0
|
|
636
696
|
*/
|
|
637
|
-
onBeforeSave: function() {
|
|
697
|
+
onBeforeSave: function(mParameters) {
|
|
698
|
+
// to be overridden
|
|
699
|
+
return Promise.resolve();
|
|
700
|
+
},
|
|
701
|
+
/**
|
|
702
|
+
* This function can be used to intercept the 'Create' action. You can execute custom coding in this function.
|
|
703
|
+
* The framework waits for the returned promise to be resolved before continuing the 'Create' action.
|
|
704
|
+
* If you reject the promise, the 'Create' action is stopped.
|
|
705
|
+
*
|
|
706
|
+
* This function is meant to be individually overridden by consuming controllers, but not to be called directly.
|
|
707
|
+
* The override execution is: {@link sap.ui.core.mvc.OverrideExecution.After}.
|
|
708
|
+
* @param {map} [mParameters] Object containing the parameters passed to onBeforeCreate
|
|
709
|
+
* @param {string} [mParameters.contextPath] Path pointing to the context on which 'Create' action is triggered
|
|
710
|
+
* @returns {Promise} A promise to be returned by the overridden method. If resolved, the 'Create' action is triggered. If rejected, the 'Create' action is not triggered.
|
|
711
|
+
* @memberof sap.fe.core.controllerextensions.EditFlow
|
|
712
|
+
* @alias sap.fe.core.controllerextensions.EditFlow#onBeforeCreate
|
|
713
|
+
* @public
|
|
714
|
+
* @experimental As of version 1.98.0
|
|
715
|
+
* @since 1.98.0
|
|
716
|
+
*/
|
|
717
|
+
onBeforeCreate: function(mParameters) {
|
|
718
|
+
// to be overridden
|
|
719
|
+
return Promise.resolve();
|
|
720
|
+
},
|
|
721
|
+
/**
|
|
722
|
+
* This function can be used to intercept the 'Edit' action. You can execute custom coding in this function.
|
|
723
|
+
* The framework waits for the returned promise to be resolved before continuing the 'Edit' action.
|
|
724
|
+
* If you reject the promise, the 'Edit' action is stopped and the user stays in display mode.
|
|
725
|
+
*
|
|
726
|
+
* This function is meant to be individually overridden by consuming controllers, but not to be called directly.
|
|
727
|
+
* The override execution is: {@link sap.ui.core.mvc.OverrideExecution.After}.
|
|
728
|
+
* @param {map} [mParameters] Object containing the parameters passed to onBeforeEdit
|
|
729
|
+
* @param {sap.ui.model.odata.v4.Context} [mParameters.context] Page context that is going to be edited.
|
|
730
|
+
* @returns {Promise} A promise to be returned by the overridden method. If resolved, the 'Edit' action is triggered. If rejected, the 'Edit' action is not triggered and the user stays in display mode.
|
|
731
|
+
* @memberof sap.fe.core.controllerextensions.EditFlow
|
|
732
|
+
* @alias sap.fe.core.controllerextensions.EditFlow#onBeforeEdit
|
|
733
|
+
* @public
|
|
734
|
+
* @experimental As of version 1.98.0
|
|
735
|
+
* @since 1.98.0
|
|
736
|
+
*/
|
|
737
|
+
onBeforeEdit: function(mParameters) {
|
|
738
|
+
// to be overridden
|
|
739
|
+
return Promise.resolve();
|
|
740
|
+
},
|
|
741
|
+
/**
|
|
742
|
+
* This function can be used to intercept the 'Discard' action. You can execute custom coding in this function.
|
|
743
|
+
* The framework waits for the returned promise to be resolved before continuing the 'Discard' action.
|
|
744
|
+
* If you reject the promise, the 'Discard' action is stopped and the user stays in edit mode.
|
|
745
|
+
*
|
|
746
|
+
* This function is meant to be individually overridden by consuming controllers, but not to be called directly.
|
|
747
|
+
* The override execution is: {@link sap.ui.core.mvc.OverrideExecution.After}.
|
|
748
|
+
* @param {map} [mParameters] Object containing the parameters passed to onBeforeDiscard
|
|
749
|
+
* @param {sap.ui.model.odata.v4.Context} [mParameters.context] Page context that is going to be discarded.
|
|
750
|
+
* @returns {Promise} A promise to be returned by the overridden method. If resolved, the 'Discard' action is triggered. If rejected, the 'Discard' action is not triggered and the user stays in edit mode.
|
|
751
|
+
* @memberof sap.fe.core.controllerextensions.EditFlow
|
|
752
|
+
* @alias sap.fe.core.controllerextensions.EditFlow#onBeforeDiscard
|
|
753
|
+
* @public
|
|
754
|
+
* @experimental As of version 1.98.0
|
|
755
|
+
* @since 1.98.0
|
|
756
|
+
*/
|
|
757
|
+
onBeforeDiscard: function(mParameters) {
|
|
758
|
+
// to be overridden
|
|
759
|
+
return Promise.resolve();
|
|
760
|
+
},
|
|
761
|
+
/**
|
|
762
|
+
* This function can be used to intercept the 'Delete' action. You can execute custom coding in this function.
|
|
763
|
+
* The framework waits for the returned promise to be resolved before continuing the 'Delete' action.
|
|
764
|
+
* If you reject the promise, the 'Delete' action is stopped.
|
|
765
|
+
*
|
|
766
|
+
* This function is meant to be individually overridden by consuming controllers, but not to be called directly.
|
|
767
|
+
* The override execution is: {@link sap.ui.core.mvc.OverrideExecution.After}.
|
|
768
|
+
* @param {map} [mParameters] Object containing the parameters passed to onBeforeDelete
|
|
769
|
+
* @param {Array} [mParameters.contexts] An array of contexts that are going to be deleted
|
|
770
|
+
* @returns {Promise} A promise to be returned by the overridden method. If resolved, the 'Delete' action is triggered. If rejected, the 'Delete' action is not triggered.
|
|
771
|
+
* @memberof sap.fe.core.controllerextensions.EditFlow
|
|
772
|
+
* @alias sap.fe.core.controllerextensions.EditFlow#onBeforeDelete
|
|
773
|
+
* @public
|
|
774
|
+
* @experimental As of version 1.98.0
|
|
775
|
+
* @since 1.98.0
|
|
776
|
+
*/
|
|
777
|
+
onBeforeDelete: function(mParameters) {
|
|
638
778
|
// to be overridden
|
|
639
779
|
return Promise.resolve();
|
|
640
780
|
},
|
|
@@ -654,7 +794,6 @@ sap.ui.define(
|
|
|
654
794
|
* @returns {Promise} Promise resolves once save is complete
|
|
655
795
|
* @alias sap.fe.core.controllerextensions.EditFlow#saveDocument
|
|
656
796
|
* @public
|
|
657
|
-
* @experimental As of version 1.90.0
|
|
658
797
|
* @since 1.90.0
|
|
659
798
|
*/
|
|
660
799
|
saveDocument: function(oContext, mParameters) {
|
|
@@ -672,7 +811,7 @@ sap.ui.define(
|
|
|
672
811
|
.then(this._submitOpenChanges.bind(this, oContext))
|
|
673
812
|
// check if there are any validation/parse errors
|
|
674
813
|
.then(this._checkForValidationErrors.bind(this, oContext))
|
|
675
|
-
.then(this.base.editFlow.onBeforeSave.bind(this))
|
|
814
|
+
.then(this.base.editFlow.onBeforeSave.bind(this, { context: oContext }))
|
|
676
815
|
// and finally if all user changes are submitted and valid save the document
|
|
677
816
|
.then(
|
|
678
817
|
transactionHelper.saveDocument.bind(
|
|
@@ -697,7 +836,7 @@ sap.ui.define(
|
|
|
697
836
|
that._getMessageHandler().showMessageDialog();
|
|
698
837
|
|
|
699
838
|
if (oActiveDocumentContext !== oContext) {
|
|
700
|
-
that._handleNewContext(oActiveDocumentContext, false, undefined, bDraftNavigation);
|
|
839
|
+
that._handleNewContext(oActiveDocumentContext, false, undefined, bDraftNavigation, true);
|
|
701
840
|
}
|
|
702
841
|
})
|
|
703
842
|
.catch(function(oError) {
|
|
@@ -710,7 +849,7 @@ sap.ui.define(
|
|
|
710
849
|
toggleDraftActive: function(oContext) {
|
|
711
850
|
var oContextData = oContext.getObject();
|
|
712
851
|
var that = this;
|
|
713
|
-
var bEditable
|
|
852
|
+
var bEditable;
|
|
714
853
|
var bIsDraft = oContext && this._getProgrammingModel(oContext) === ProgrammingModel.Draft;
|
|
715
854
|
var oToggleContext = oContext
|
|
716
855
|
.getModel()
|
|
@@ -731,29 +870,23 @@ sap.ui.define(
|
|
|
731
870
|
if (!oContextData.IsActiveEntity && oContextData.HasActiveEntity) {
|
|
732
871
|
//start Point: edit draft
|
|
733
872
|
bEditable = false;
|
|
734
|
-
sEditMode = EditMode.Display;
|
|
735
|
-
bUseSemanticKey = false;
|
|
736
873
|
} else if (oContextData.IsActiveEntity && oContextData.HasDraftEntity) {
|
|
737
874
|
// start point active document
|
|
738
875
|
bEditable = true;
|
|
739
|
-
sEditMode = EditMode.Editable;
|
|
740
|
-
bUseSemanticKey = true;
|
|
741
876
|
}
|
|
742
877
|
oToggleContext
|
|
743
878
|
.requestCanonicalPath()
|
|
744
879
|
.then(function(sCanonicalPath) {
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
}
|
|
752
|
-
return oToggleContext;
|
|
880
|
+
// We use the canonical path for the navigation instead of the semantic path, as the
|
|
881
|
+
// semantic key values may have changed between the draft and the active version (BCP 2170216142)
|
|
882
|
+
return oToggleContext
|
|
883
|
+
.getModel()
|
|
884
|
+
.bindContext(sCanonicalPath)
|
|
885
|
+
.getBoundContext();
|
|
753
886
|
})
|
|
754
887
|
.then(function(oToggleContext) {
|
|
755
|
-
that._setEditMode(
|
|
756
|
-
that._handleNewContext(oToggleContext, bEditable, true, true);
|
|
888
|
+
that._setEditMode(bEditable ? EditMode.Editable : EditMode.Display, false); //switch to edit mode only if a draft is available
|
|
889
|
+
that._handleNewContext(oToggleContext, bEditable, true, true, true);
|
|
757
890
|
})
|
|
758
891
|
.catch(function(err) {
|
|
759
892
|
return Promise.reject("Error in EditFlow.toggleDraftActive:" + err);
|
|
@@ -769,12 +902,12 @@ sap.ui.define(
|
|
|
769
902
|
*
|
|
770
903
|
* @memberof sap.fe.core.controllerextensions.EditFlow
|
|
771
904
|
* @param {object} oContext Context of the editable document
|
|
772
|
-
* @param {map}
|
|
773
|
-
* @param {object} mParameters.control This is the control used to open the
|
|
905
|
+
* @param {map} mParameters Can contain the following attributes:
|
|
906
|
+
* @param {object} mParameters.control This is the control used to open the discard popover
|
|
907
|
+
* @param {boolean} [mParameters.skipDiscardPopover] Optional, supresses the discard popover and allows custom handling
|
|
774
908
|
* @returns {Promise} Promise resolves once editable document has been discarded
|
|
775
909
|
* @alias sap.fe.core.controllerextensions.EditFlow#cancelDocument
|
|
776
910
|
* @public
|
|
777
|
-
* @experimental As of version 1.90.0
|
|
778
911
|
* @since 1.90.0
|
|
779
912
|
*/
|
|
780
913
|
cancelDocument: function(oContext, mParameters) {
|
|
@@ -782,6 +915,7 @@ sap.ui.define(
|
|
|
782
915
|
transactionHelper = this._getTransactionHelper(),
|
|
783
916
|
oResourceBundle = that.getView().getController().oResourceBundle;
|
|
784
917
|
mParameters.cancelButton = mParameters.control || mParameters.cancelButton;
|
|
918
|
+
mParameters.beforeCancelCallBack = this.base.editFlow.onBeforeDiscard;
|
|
785
919
|
return this._syncTask()
|
|
786
920
|
.then(
|
|
787
921
|
transactionHelper.cancelDocument.bind(
|
|
@@ -808,7 +942,9 @@ sap.ui.define(
|
|
|
808
942
|
//in case of a new document, the value of hasActiveEntity is returned. navigate back.
|
|
809
943
|
if (!oActiveDocumentContext) {
|
|
810
944
|
EditState.setEditStateDirty();
|
|
811
|
-
|
|
945
|
+
return mParameters.skipBackNavigation
|
|
946
|
+
? undefined
|
|
947
|
+
: that._getRoutingListener().navigateBackFromContext(oContext);
|
|
812
948
|
} else if (sProgrammingModel === ProgrammingModel.Draft) {
|
|
813
949
|
// We need to load the semantic keys of the active context, as we need them
|
|
814
950
|
// for the navigation
|
|
@@ -816,16 +952,19 @@ sap.ui.define(
|
|
|
816
952
|
// We force the recreation of the context, so that it's created and bound in the same microtask,
|
|
817
953
|
// so that all properties are loaded together by autoExpandSelect, so that when switching back to Edit mode
|
|
818
954
|
// $$inheritExpandSelect takes all loaded properties into account (BCP 2070462265)
|
|
819
|
-
if (mParameters.
|
|
955
|
+
if (mParameters.skipBindingToView) {
|
|
820
956
|
return oActiveDocumentContext;
|
|
821
957
|
} else {
|
|
822
|
-
return that._handleNewContext(oActiveDocumentContext, false, true, bDraftNavigation);
|
|
958
|
+
return that._handleNewContext(oActiveDocumentContext, false, true, bDraftNavigation, true);
|
|
823
959
|
}
|
|
824
960
|
});
|
|
825
961
|
} else {
|
|
826
962
|
//active context is returned in case of cancel of existing document
|
|
827
|
-
return that._handleNewContext(oActiveDocumentContext, false, undefined, bDraftNavigation);
|
|
963
|
+
return that._handleNewContext(oActiveDocumentContext, false, undefined, bDraftNavigation, true);
|
|
828
964
|
}
|
|
965
|
+
})
|
|
966
|
+
.catch(function(oError) {
|
|
967
|
+
Log.error("Error while discarding the document", oError);
|
|
829
968
|
});
|
|
830
969
|
},
|
|
831
970
|
|
|
@@ -837,13 +976,12 @@ sap.ui.define(
|
|
|
837
976
|
*
|
|
838
977
|
* @memberof sap.fe.core.controllerextensions.EditFlow
|
|
839
978
|
* @param {object} oContext Context of the document
|
|
840
|
-
* @param {map}
|
|
979
|
+
* @param {map} mParameters Can contain the following attributes:
|
|
841
980
|
* @param {string} mParameters.title Title of the object being deleted
|
|
842
981
|
* @param {string} mParameters.description Description of the object being deleted
|
|
843
982
|
* @returns {Promise} Promise resolves once document has been deleted
|
|
844
983
|
* @alias sap.fe.core.controllerextensions.EditFlow#deleteDocument
|
|
845
984
|
* @public
|
|
846
|
-
* @experimental As of version 1.90.0
|
|
847
985
|
* @since 1.90.0
|
|
848
986
|
*/
|
|
849
987
|
deleteDocument: function(oContext, mParameters) {
|
|
@@ -856,17 +994,22 @@ sap.ui.define(
|
|
|
856
994
|
} else {
|
|
857
995
|
mParameters.bFindActiveContexts = false;
|
|
858
996
|
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
997
|
+
mParameters.beforeDeleteCallBack = this.base.editFlow.onBeforeDelete;
|
|
998
|
+
return this._deleteDocumentTransaction(oContext, mParameters)
|
|
999
|
+
.then(function() {
|
|
1000
|
+
// Single objet deletion is triggered from an OP header button (not from a list)
|
|
1001
|
+
// --> Mark UI dirty and navigate back to dismiss the OP
|
|
1002
|
+
EditState.setEditStateDirty();
|
|
1003
|
+
|
|
1004
|
+
that._getRoutingListener().navigateBackFromContext(oContext);
|
|
1005
|
+
// After delete is successfull, we need to dettch the setBackNavigation Methods
|
|
1006
|
+
if (oAppComponent) {
|
|
1007
|
+
oAppComponent.getShellServices().setBackNavigation();
|
|
1008
|
+
}
|
|
1009
|
+
})
|
|
1010
|
+
.catch(function(oError) {
|
|
1011
|
+
Log.error("Error while deleting the document", oError);
|
|
1012
|
+
});
|
|
870
1013
|
},
|
|
871
1014
|
|
|
872
1015
|
/**
|
|
@@ -877,15 +1020,12 @@ sap.ui.define(
|
|
|
877
1020
|
* @returns {Promise} Promise resolves once the changes have been saved
|
|
878
1021
|
* @alias sap.fe.core.controllerextensions.EditFlow#applyDocument
|
|
879
1022
|
* @public
|
|
880
|
-
* @experimental As of version 1.90.0
|
|
881
1023
|
* @since 1.90.0
|
|
882
1024
|
*/
|
|
883
1025
|
applyDocument: function(oContext) {
|
|
884
1026
|
var that = this,
|
|
885
1027
|
oLockObject = this._getGlobalUIModel();
|
|
886
|
-
|
|
887
1028
|
BusyLocker.lock(oLockObject);
|
|
888
|
-
|
|
889
1029
|
return (
|
|
890
1030
|
this._submitOpenChanges(oContext)
|
|
891
1031
|
// check if there are any validation/parse errors
|
|
@@ -896,7 +1036,9 @@ sap.ui.define(
|
|
|
896
1036
|
return true;
|
|
897
1037
|
})
|
|
898
1038
|
.finally(function() {
|
|
899
|
-
BusyLocker.
|
|
1039
|
+
if (BusyLocker.isLocked(oLockObject)) {
|
|
1040
|
+
BusyLocker.unlock(oLockObject);
|
|
1041
|
+
}
|
|
900
1042
|
})
|
|
901
1043
|
);
|
|
902
1044
|
},
|
|
@@ -912,22 +1054,22 @@ sap.ui.define(
|
|
|
912
1054
|
* @memberof sap.fe.core.controllerextensions.EditFlow
|
|
913
1055
|
* @param {string} sActionName The name of the action to be called
|
|
914
1056
|
* @param {map} [mParameters] Contains the following attributes:
|
|
915
|
-
* @param {sap.ui.model.odata.v4.Context} [mParameters.contexts] For a bound action, a context or an array with contexts for which the action
|
|
1057
|
+
* @param {sap.ui.model.odata.v4.Context} [mParameters.contexts] For a bound action, a context or an array with contexts for which the action is to be called must be provided
|
|
916
1058
|
* @param {sap.ui.model.odata.v4.ODataModel} [mParameters.model] For an unbound action, an instance of an OData V4 model must be provided
|
|
917
|
-
* @param {boolean} [mParameters.requiresNavigation] Boolean value indicating whether navigation is required after the action has been executed. Navigation takes place to the context returned by the action
|
|
918
|
-
* @param {string} [mParameters.label] A human-readable label for the action. This is needed in case the action has a parameter and a parameter dialog is shown to the user.
|
|
1059
|
+
* @param {boolean} [mParameters.requiresNavigation] Boolean value indicating whether navigation is required after the action has been executed. Navigation takes place to the context returned by the action
|
|
1060
|
+
* @param {string} [mParameters.label] A human-readable label for the action. This is needed in case the action has a parameter and a parameter dialog is shown to the user. The label will be used for the title of the dialog and for the confirmation button
|
|
1061
|
+
* @param {string} [mParameters.invocationGrouping] Mode how actions are to be called: 'ChangeSet' to put all action calls into one changeset, 'Isolated' to put them into separate changesets
|
|
919
1062
|
* @returns {Promise}
|
|
920
1063
|
* @alias sap.fe.core.controllerextensions.EditFlow#invokeAction
|
|
921
1064
|
* @public
|
|
922
|
-
* @experimental As of version 1.90.0
|
|
923
1065
|
* @since 1.90.0
|
|
924
1066
|
* @final
|
|
925
1067
|
**/
|
|
926
1068
|
invokeAction: function(sActionName, mParameters) {
|
|
927
1069
|
var that = this,
|
|
928
|
-
oTable,
|
|
929
|
-
transactionHelper = this._getTransactionHelper(),
|
|
930
1070
|
oControl,
|
|
1071
|
+
transactionHelper = this._getTransactionHelper(),
|
|
1072
|
+
oCurrentControl,
|
|
931
1073
|
oBindingContext,
|
|
932
1074
|
aParts,
|
|
933
1075
|
sOverloadEntityType,
|
|
@@ -959,11 +1101,11 @@ sap.ui.define(
|
|
|
959
1101
|
mParameters.parentControl = this.getView();
|
|
960
1102
|
}
|
|
961
1103
|
|
|
962
|
-
if (mParameters.
|
|
963
|
-
|
|
964
|
-
if (
|
|
1104
|
+
if (mParameters.controlId) {
|
|
1105
|
+
oControl = this.getView().byId(mParameters.controlId);
|
|
1106
|
+
if (oControl) {
|
|
965
1107
|
// TODO: currently this selected contexts update is done within the operation, should be moved out
|
|
966
|
-
mParameters.internalModelContext =
|
|
1108
|
+
mParameters.internalModelContext = oControl.getBindingContext("internal");
|
|
967
1109
|
}
|
|
968
1110
|
} else {
|
|
969
1111
|
mParameters.internalModelContext = oView.getBindingContext("internal");
|
|
@@ -980,10 +1122,10 @@ sap.ui.define(
|
|
|
980
1122
|
}
|
|
981
1123
|
|
|
982
1124
|
if (mParameters.bStaticAction) {
|
|
983
|
-
if (
|
|
984
|
-
mParameters.contexts =
|
|
1125
|
+
if (oControl.isTableBound()) {
|
|
1126
|
+
mParameters.contexts = oControl.getRowBinding().getHeaderContext();
|
|
985
1127
|
} else {
|
|
986
|
-
var sBindingPath =
|
|
1128
|
+
var sBindingPath = oControl.data("rowsBindingInfo").path,
|
|
987
1129
|
oListBinding = new ODataListBinding(that.getView().getModel(), sBindingPath);
|
|
988
1130
|
mParameters.contexts = oListBinding.getHeaderContext();
|
|
989
1131
|
}
|
|
@@ -996,9 +1138,9 @@ sap.ui.define(
|
|
|
996
1138
|
.getObject("$Type");
|
|
997
1139
|
if (sOverloadEntityType !== sTableContextEntityType) {
|
|
998
1140
|
// search for context in control tree hierarchy
|
|
999
|
-
|
|
1000
|
-
while (
|
|
1001
|
-
oBindingContext =
|
|
1141
|
+
oCurrentControl = oControl;
|
|
1142
|
+
while (oCurrentControl) {
|
|
1143
|
+
oBindingContext = oCurrentControl.getBindingContext();
|
|
1002
1144
|
if (
|
|
1003
1145
|
oBindingContext &&
|
|
1004
1146
|
oBindingContext
|
|
@@ -1011,7 +1153,7 @@ sap.ui.define(
|
|
|
1011
1153
|
break;
|
|
1012
1154
|
} else {
|
|
1013
1155
|
// check parent
|
|
1014
|
-
|
|
1156
|
+
oCurrentControl = oCurrentControl.getParent();
|
|
1015
1157
|
}
|
|
1016
1158
|
}
|
|
1017
1159
|
if (!mParameters.contexts) {
|
|
@@ -1021,7 +1163,7 @@ sap.ui.define(
|
|
|
1021
1163
|
}
|
|
1022
1164
|
|
|
1023
1165
|
if (mParameters.enableAutoScroll) {
|
|
1024
|
-
oCurrentActionCallBacks = this._createActionPromise(sActionName,
|
|
1166
|
+
oCurrentActionCallBacks = this._createActionPromise(sActionName, oControl.sId);
|
|
1025
1167
|
}
|
|
1026
1168
|
}
|
|
1027
1169
|
|
|
@@ -1176,11 +1318,14 @@ sap.ui.define(
|
|
|
1176
1318
|
*/
|
|
1177
1319
|
handlePatchSent: function(oEvent) {
|
|
1178
1320
|
var that = this;
|
|
1321
|
+
this.mPatchPromises = this.mPatchPromises ? this.mPatchPromises : {};
|
|
1322
|
+
// do this for every unique object (eg: every table) so that each associated promise is fulfilled at the end
|
|
1179
1323
|
var oPatchPromise = new Promise(function(resolve, reject) {
|
|
1180
|
-
that.
|
|
1181
|
-
|
|
1324
|
+
that.mPatchPromises[oEvent.getSource()] = {
|
|
1325
|
+
resolvePatchPromise: resolve,
|
|
1326
|
+
rejectPatchPromise: reject
|
|
1327
|
+
};
|
|
1182
1328
|
});
|
|
1183
|
-
|
|
1184
1329
|
this.updateDocument(oEvent.getSource(), oPatchPromise);
|
|
1185
1330
|
},
|
|
1186
1331
|
|
|
@@ -1192,10 +1337,11 @@ sap.ui.define(
|
|
|
1192
1337
|
handlePatchCompleted: function(oEvent) {
|
|
1193
1338
|
var bSuccess = oEvent.getParameter("success");
|
|
1194
1339
|
if (bSuccess) {
|
|
1195
|
-
this.resolvePatchPromise();
|
|
1340
|
+
this.mPatchPromises[oEvent.getSource()].resolvePatchPromise();
|
|
1196
1341
|
} else {
|
|
1197
|
-
this.rejectPatchPromise();
|
|
1342
|
+
this.mPatchPromises[oEvent.getSource()].rejectPatchPromise();
|
|
1198
1343
|
}
|
|
1344
|
+
delete this.mPatchPromises[oEvent.getSource()];
|
|
1199
1345
|
},
|
|
1200
1346
|
|
|
1201
1347
|
//////////////////////////////////////
|
|
@@ -1333,15 +1479,22 @@ sap.ui.define(
|
|
|
1333
1479
|
},
|
|
1334
1480
|
|
|
1335
1481
|
_submitOpenChanges: function(oContext) {
|
|
1336
|
-
var oModel = oContext.getModel()
|
|
1337
|
-
|
|
1482
|
+
var oModel = oContext.getModel(),
|
|
1483
|
+
oLockObject = this._getGlobalUIModel();
|
|
1338
1484
|
//Currently we are using only 1 updateGroupId, hence submitting the batch directly here
|
|
1339
|
-
return oModel
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1485
|
+
return oModel
|
|
1486
|
+
.submitBatch("$auto")
|
|
1487
|
+
.then(function() {
|
|
1488
|
+
if (oModel.hasPendingChanges("$auto")) {
|
|
1489
|
+
// the submit was not successful
|
|
1490
|
+
return Promise.reject("submit of open changes failed");
|
|
1491
|
+
}
|
|
1492
|
+
})
|
|
1493
|
+
.finally(function() {
|
|
1494
|
+
if (BusyLocker.isLocked(oLockObject)) {
|
|
1495
|
+
BusyLocker.unlock(oLockObject);
|
|
1496
|
+
}
|
|
1497
|
+
});
|
|
1345
1498
|
},
|
|
1346
1499
|
|
|
1347
1500
|
_handleStickyOn: function(oContext) {
|
|
@@ -1481,7 +1634,7 @@ sap.ui.define(
|
|
|
1481
1634
|
}
|
|
1482
1635
|
},
|
|
1483
1636
|
|
|
1484
|
-
_handleNewContext: function(oContext, bEditable, bRecreateContext, bDraftNavigation,
|
|
1637
|
+
_handleNewContext: function(oContext, bEditable, bRecreateContext, bDraftNavigation, bForceFocus) {
|
|
1485
1638
|
EditState.setEditStateDirty();
|
|
1486
1639
|
|
|
1487
1640
|
return this._getRoutingListener().navigateToContext(oContext, {
|
|
@@ -1490,7 +1643,8 @@ sap.ui.define(
|
|
|
1490
1643
|
bPersistOPScroll: true,
|
|
1491
1644
|
bRecreateContext: bRecreateContext,
|
|
1492
1645
|
bDraftNavigation: bDraftNavigation,
|
|
1493
|
-
showPlaceholder: false
|
|
1646
|
+
showPlaceholder: false,
|
|
1647
|
+
bForceFocus: bForceFocus
|
|
1494
1648
|
});
|
|
1495
1649
|
},
|
|
1496
1650
|
|