@sapui5/sap.fe.core 1.97.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.
Files changed (186) hide show
  1. package/package.json +4 -4
  2. package/src/sap/fe/core/.library +1 -1
  3. package/src/sap/fe/core/AnnotationHelper.js +1 -1
  4. package/src/sap/fe/core/AppComponent.js +4 -2
  5. package/src/sap/fe/core/AppStateHandler.js +2 -2
  6. package/src/sap/fe/core/BaseController.js +1 -1
  7. package/src/sap/fe/core/BusyLocker.js +1 -1
  8. package/src/sap/fe/core/CommonUtils.js +36 -16
  9. package/src/sap/fe/core/ExtensionAPI.js +14 -6
  10. package/src/sap/fe/core/PageController.js +9 -3
  11. package/src/sap/fe/core/RouterProxy.js +27 -11
  12. package/src/sap/fe/core/Synchronization.js +1 -1
  13. package/src/sap/fe/core/TemplateComponent.js +14 -5
  14. package/src/sap/fe/core/TemplateModel.js +1 -1
  15. package/src/sap/fe/core/TransactionHelper.js +125 -40
  16. package/src/sap/fe/core/actions/draft.js +50 -23
  17. package/src/sap/fe/core/actions/messageHandling.js +12 -9
  18. package/src/sap/fe/core/actions/nonDraft.js +1 -1
  19. package/src/sap/fe/core/actions/operations.js +13 -9
  20. package/src/sap/fe/core/actions/sticky.js +1 -1
  21. package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.js +1 -1
  22. package/src/sap/fe/core/controllerextensions/EditFlow.js +197 -71
  23. package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +1 -1
  24. package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +10 -3
  25. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +20 -18
  26. package/src/sap/fe/core/controllerextensions/InternalRouting.js +40 -9
  27. package/src/sap/fe/core/controllerextensions/KPIManagement.js +114 -25
  28. package/src/sap/fe/core/controllerextensions/KPIManagement.ts +112 -24
  29. package/src/sap/fe/core/controllerextensions/MassEdit.js +79 -0
  30. package/src/sap/fe/core/controllerextensions/MessageHandler.js +6 -2
  31. package/src/sap/fe/core/controllerextensions/PageReady.js +1 -1
  32. package/src/sap/fe/core/controllerextensions/Paginator.js +35 -8
  33. package/src/sap/fe/core/controllerextensions/Placeholder.js +6 -3
  34. package/src/sap/fe/core/controllerextensions/Routing.js +17 -2
  35. package/src/sap/fe/core/controllerextensions/RoutingListener.js +1 -1
  36. package/src/sap/fe/core/controllerextensions/Share.js +20 -7
  37. package/src/sap/fe/core/controllerextensions/SideEffects.js +7 -7
  38. package/src/sap/fe/core/controllerextensions/SideEffects.ts +6 -5
  39. package/src/sap/fe/core/controllerextensions/ViewState.js +1 -1
  40. package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +2 -1
  41. package/src/sap/fe/core/controls/CommandExecution.js +1 -1
  42. package/src/sap/fe/core/controls/ConditionalWrapper.js +1 -1
  43. package/src/sap/fe/core/controls/CustomQuickViewPage.js +1 -1
  44. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +7 -4
  45. package/src/sap/fe/core/controls/FieldWrapper.js +10 -4
  46. package/src/sap/fe/core/controls/FilterBar.js +1 -1
  47. package/src/sap/fe/core/controls/FormElementWrapper.js +1 -6
  48. package/src/sap/fe/core/controls/MultiValueParameterDelegate.js +1 -1
  49. package/src/sap/fe/core/controls/NonComputedVisibleKeyFieldsDialog.fragment.xml +1 -1
  50. package/src/sap/fe/core/controls/filterbar/FilterContainer.js +1 -1
  51. package/src/sap/fe/core/controls/filterbar/VisualFilter.js +1 -1
  52. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +1 -1
  53. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +1 -1
  54. package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +106 -0
  55. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +78 -0
  56. package/src/sap/fe/core/converters/ConverterContext.js +13 -1
  57. package/src/sap/fe/core/converters/ConverterContext.ts +10 -0
  58. package/src/sap/fe/core/converters/ManifestSettings.js +1 -1
  59. package/src/sap/fe/core/converters/ManifestSettings.ts +3 -0
  60. package/src/sap/fe/core/converters/ManifestWrapper.js +18 -7
  61. package/src/sap/fe/core/converters/ManifestWrapper.ts +15 -6
  62. package/src/sap/fe/core/converters/MetaModelConverter.js +62 -4
  63. package/src/sap/fe/core/converters/MetaModelConverter.ts +60 -4
  64. package/src/sap/fe/core/converters/annotations/DataField.js +3 -3
  65. package/src/sap/fe/core/converters/annotations/DataField.ts +1 -1
  66. package/src/sap/fe/core/converters/common/AnnotationConverter.js +18 -10
  67. package/src/sap/fe/core/converters/controls/Common/Action.js +10 -1
  68. package/src/sap/fe/core/converters/controls/Common/Action.ts +6 -0
  69. package/src/sap/fe/core/converters/controls/Common/Form.js +17 -9
  70. package/src/sap/fe/core/converters/controls/Common/Form.ts +9 -3
  71. package/src/sap/fe/core/converters/controls/Common/KPI.js +69 -4
  72. package/src/sap/fe/core/converters/controls/Common/KPI.ts +72 -0
  73. package/src/sap/fe/core/converters/controls/Common/Table.js +172 -284
  74. package/src/sap/fe/core/converters/controls/Common/Table.ts +228 -348
  75. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +468 -0
  76. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +609 -0
  77. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +30 -13
  78. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +31 -12
  79. package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +2 -2
  80. package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +1 -1
  81. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +14 -6
  82. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +26 -5
  83. package/src/sap/fe/core/converters/helpers/Aggregation.js +8 -1
  84. package/src/sap/fe/core/converters/helpers/Aggregation.ts +9 -1
  85. package/src/sap/fe/core/converters/helpers/IssueManager.js +4 -1
  86. package/src/sap/fe/core/converters/helpers/IssueManager.ts +3 -0
  87. package/src/sap/fe/core/designtime/AppComponent.designtime.js +9 -1
  88. package/src/sap/fe/core/formatters/ValueFormatter.js +30 -5
  89. package/src/sap/fe/core/formatters/ValueFormatter.ts +25 -3
  90. package/src/sap/fe/core/fpm/Component.js +1 -1
  91. package/src/sap/fe/core/helpers/AppStartupHelper.js +359 -0
  92. package/src/sap/fe/core/helpers/AppStartupHelper.ts +388 -0
  93. package/src/sap/fe/core/helpers/BindingExpression.js +199 -111
  94. package/src/sap/fe/core/helpers/BindingExpression.ts +193 -102
  95. package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.js +1 -1
  96. package/src/sap/fe/core/helpers/EditState.js +1 -1
  97. package/src/sap/fe/core/helpers/ExcelFormatHelper.js +1 -1
  98. package/src/sap/fe/core/helpers/FPMHelper.js +1 -1
  99. package/src/sap/fe/core/helpers/KeepAliveHelper.js +2 -2
  100. package/src/sap/fe/core/helpers/KeepAliveHelper.ts +1 -1
  101. package/src/sap/fe/core/helpers/MassEditHelper.js +678 -0
  102. package/src/sap/fe/core/helpers/ModelHelper.js +1 -1
  103. package/src/sap/fe/core/helpers/PasteHelper.js +1 -1
  104. package/src/sap/fe/core/helpers/SemanticDateOperators.js +1 -1
  105. package/src/sap/fe/core/helpers/SemanticKeyHelper.js +1 -1
  106. package/src/sap/fe/core/helpers/StableIdHelper.js +1 -1
  107. package/src/sap/fe/core/library.js +28 -2
  108. package/src/sap/fe/core/library.support.js +10 -4
  109. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +62 -0
  110. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +66 -0
  111. package/src/sap/fe/core/messagebundle.properties +40 -5
  112. package/src/sap/fe/core/messagebundle_ar.properties +24 -2
  113. package/src/sap/fe/core/messagebundle_bg.properties +24 -2
  114. package/src/sap/fe/core/messagebundle_ca.properties +24 -2
  115. package/src/sap/fe/core/messagebundle_cs.properties +25 -3
  116. package/src/sap/fe/core/messagebundle_cy.properties +24 -2
  117. package/src/sap/fe/core/messagebundle_da.properties +24 -2
  118. package/src/sap/fe/core/messagebundle_de.properties +24 -2
  119. package/src/sap/fe/core/messagebundle_el.properties +24 -2
  120. package/src/sap/fe/core/messagebundle_en.properties +23 -1
  121. package/src/sap/fe/core/messagebundle_en_GB.properties +23 -1
  122. package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +27 -1
  123. package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +24 -2
  124. package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +24 -2
  125. package/src/sap/fe/core/messagebundle_es.properties +24 -2
  126. package/src/sap/fe/core/messagebundle_es_MX.properties +24 -2
  127. package/src/sap/fe/core/messagebundle_et.properties +24 -2
  128. package/src/sap/fe/core/messagebundle_fi.properties +25 -3
  129. package/src/sap/fe/core/messagebundle_fr.properties +25 -3
  130. package/src/sap/fe/core/messagebundle_fr_CA.properties +24 -2
  131. package/src/sap/fe/core/messagebundle_hi.properties +24 -2
  132. package/src/sap/fe/core/messagebundle_hr.properties +24 -2
  133. package/src/sap/fe/core/messagebundle_hu.properties +25 -3
  134. package/src/sap/fe/core/messagebundle_id.properties +26 -4
  135. package/src/sap/fe/core/messagebundle_it.properties +24 -2
  136. package/src/sap/fe/core/messagebundle_iw.properties +24 -2
  137. package/src/sap/fe/core/messagebundle_ja.properties +24 -2
  138. package/src/sap/fe/core/messagebundle_kk.properties +24 -2
  139. package/src/sap/fe/core/messagebundle_ko.properties +24 -2
  140. package/src/sap/fe/core/messagebundle_lt.properties +24 -2
  141. package/src/sap/fe/core/messagebundle_lv.properties +24 -2
  142. package/src/sap/fe/core/messagebundle_ms.properties +24 -2
  143. package/src/sap/fe/core/messagebundle_nl.properties +24 -2
  144. package/src/sap/fe/core/messagebundle_no.properties +24 -2
  145. package/src/sap/fe/core/messagebundle_pl.properties +24 -2
  146. package/src/sap/fe/core/messagebundle_pt.properties +25 -3
  147. package/src/sap/fe/core/messagebundle_pt_PT.properties +24 -2
  148. package/src/sap/fe/core/messagebundle_ro.properties +24 -2
  149. package/src/sap/fe/core/messagebundle_ru.properties +24 -2
  150. package/src/sap/fe/core/messagebundle_sh.properties +24 -2
  151. package/src/sap/fe/core/messagebundle_sk.properties +24 -2
  152. package/src/sap/fe/core/messagebundle_sl.properties +24 -2
  153. package/src/sap/fe/core/messagebundle_sv.properties +25 -3
  154. package/src/sap/fe/core/messagebundle_th.properties +24 -2
  155. package/src/sap/fe/core/messagebundle_tr.properties +24 -2
  156. package/src/sap/fe/core/messagebundle_uk.properties +24 -2
  157. package/src/sap/fe/core/messagebundle_vi.properties +24 -2
  158. package/src/sap/fe/core/messagebundle_zh_CN.properties +24 -2
  159. package/src/sap/fe/core/messagebundle_zh_TW.properties +24 -2
  160. package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +1 -1
  161. package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +1 -1
  162. package/src/sap/fe/core/services/EnvironmentServiceFactory.js +4 -3
  163. package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +3 -0
  164. package/src/sap/fe/core/services/NavigationServiceFactory.js +1 -1
  165. package/src/sap/fe/core/services/ResourceModelServiceFactory.js +1 -1
  166. package/src/sap/fe/core/services/RoutingServiceFactory.js +94 -347
  167. package/src/sap/fe/core/services/ShellServicesFactory.js +31 -2
  168. package/src/sap/fe/core/services/ShellServicesFactory.ts +30 -1
  169. package/src/sap/fe/core/services/SideEffectsServiceFactory.js +8 -5
  170. package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +11 -6
  171. package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +13 -4
  172. package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.js +1 -1
  173. package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.js +38 -0
  174. package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.ts +18 -0
  175. package/src/sap/fe/core/templating/DataModelPathHelper.js +10 -48
  176. package/src/sap/fe/core/templating/DataModelPathHelper.ts +14 -46
  177. package/src/sap/fe/core/templating/DisplayModeFormatter.js +114 -0
  178. package/src/sap/fe/core/templating/DisplayModeFormatter.ts +86 -0
  179. package/src/sap/fe/core/templating/FilterHelper.js +10 -7
  180. package/src/sap/fe/core/templating/FilterHelper.ts +8 -6
  181. package/src/sap/fe/core/templating/PropertyHelper.js +2 -2
  182. package/src/sap/fe/core/templating/PropertyHelper.ts +1 -1
  183. package/src/sap/fe/core/templating/UIFormatters.js +15 -110
  184. package/src/sap/fe/core/templating/UIFormatters.ts +6 -73
  185. package/src/sap/fe/core/controls/filterbar.d.js +0 -8
  186. package/src/sap/fe/core/controls/filterbar.d.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * SAPUI5
3
- * (c) Copyright 2009-2021 SAP SE. All rights reserved.
3
+ * (c) Copyright 2009-2022 SAP SE. All rights reserved.
4
4
  */
5
5
  sap.ui.define(
6
6
  [
@@ -76,7 +76,13 @@ sap.ui.define(
76
76
  },
77
77
  getProgrammingModel: function(oContext) {
78
78
  if (!this.sProgrammingModel && oContext) {
79
- if (ModelHelper.isDraftSupported(oContext.getModel().getMetaModel(), oContext.getPath())) {
79
+ var sPath;
80
+ if (oContext.isA("sap.ui.model.odata.v4.Context")) {
81
+ sPath = oContext.getPath();
82
+ } else {
83
+ sPath = oContext.isRelative() ? oContext.getResolvedPath() : oContext.getPath();
84
+ }
85
+ if (ModelHelper.isDraftSupported(oContext.getModel().getMetaModel(), sPath)) {
80
86
  this.sProgrammingModel = ProgrammingModel.Draft;
81
87
  } else if (ModelHelper.isStickySessionSupported(oContext.getModel().getMetaModel())) {
82
88
  this.sProgrammingModel = ProgrammingModel.Sticky;
@@ -93,9 +99,8 @@ sap.ui.define(
93
99
  *
94
100
  * @memberof sap.fe.core.TransactionHelper
95
101
  * @static
96
- * @param {sap.ui.model.odata.v4.ODataListBinding} oMainListBinding OData v4 ListBinding object
102
+ * @param {sap.ui.model.odata.v4.ODataListBinding} oMainListBinding OData V4 ListBinding object
97
103
  * @param {object} [mParameters] Optional, can contain the following attributes:
98
- * @param {boolean} [mParameters.refreshList] If the list shall be refreshed immediately after creating the instance
99
104
  * @param {map} [mParameters.data] A map of data that should be sent within the POST
100
105
  * @param {string} [mParameters.busyMode] Global (default), Local, None TODO: to be refactored
101
106
  * @param {map} [mParameters.keepTransientContextOnFailed] If set, the context stays in the list if the POST failed and POST will be repeated with the next change
@@ -109,7 +114,6 @@ sap.ui.define(
109
114
  createDocument: function(oMainListBinding, mParameters, oResourceBundle, messageHandler, bFromCopyPaste) {
110
115
  var oNewDocumentContext,
111
116
  that = this,
112
- bSkipRefresh,
113
117
  oModel = oMainListBinding.getModel(),
114
118
  oMetaModel = oModel.getMetaModel(),
115
119
  sMetaPath = oMetaModel.getMetaPath(oMainListBinding.getHeaderContext().getPath()),
@@ -131,8 +135,18 @@ sap.ui.define(
131
135
  oMetaModel.getObject(
132
136
  ModelHelper.getTargetEntitySet(oMetaModel.getContext(sMetaPath)) +
133
137
  "@com.sap.vocabularies.Common.v1.DefaultValuesFunction"
134
- );
135
-
138
+ ),
139
+ bFunctionOnNavProp;
140
+ if (sFunctionName) {
141
+ if (
142
+ oMetaModel.getObject(sMetaPath + "@com.sap.vocabularies.Common.v1.DefaultValuesFunction") &&
143
+ ModelHelper.getTargetEntitySet(oMetaModel.getContext(sMetaPath)) !== sMetaPath
144
+ ) {
145
+ bFunctionOnNavProp = true;
146
+ } else {
147
+ bFunctionOnNavProp = false;
148
+ }
149
+ }
136
150
  if (sMessagesPath) {
137
151
  mBindingParameters["$select"] = sMessagesPath;
138
152
  }
@@ -150,7 +164,6 @@ sap.ui.define(
150
164
  sBusyPath = "/busyLocal/" + oMainListBinding.sId;
151
165
  }
152
166
  BusyLocker.lock(this.oLockObject, sBusyPath);
153
- bSkipRefresh = !mParameters.refreshList;
154
167
  var oResourceBundleCore = sap.ui.getCore().getLibraryResourceBundle("sap.fe.core");
155
168
  if (sNewAction) {
156
169
  oCreationPromise = this.callAction(
@@ -158,7 +171,7 @@ sap.ui.define(
158
171
  {
159
172
  contexts: oMainListBinding.getHeaderContext(),
160
173
  showActionParameterDialog: true,
161
- label: oResourceBundleCore.getText("C_TRANSACTION_HELPER_SAPFE_ACTION_CREATE"),
174
+ label: this._getSpecificCreateActionDialogLabel(oMetaModel, sMetaPath, sNewAction, oResourceBundleCore),
162
175
  bindingParameters: mBindingParameters,
163
176
  parentControl: mParameters.parentControl,
164
177
  bIsCreateAction: true
@@ -173,8 +186,29 @@ sap.ui.define(
173
186
  ? CommonUtils.getNonComputedVisibleFields(oMetaModel, sMetaPath)
174
187
  : [];
175
188
  sFunctionName = bFromCopyPaste ? null : sFunctionName;
176
- oCreationPromise = operations
177
- .callFunctionImport(sFunctionName, oModel)
189
+ var sFunctionPath, oFunctionContext;
190
+ if (sFunctionName) {
191
+ //bound to the source entity:
192
+ if (bFunctionOnNavProp) {
193
+ sFunctionPath =
194
+ oMainListBinding.getContext() &&
195
+ oMetaModel.getMetaPath(oMainListBinding.getContext().getPath()) + "/" + sFunctionName;
196
+ oFunctionContext = oMainListBinding.getContext();
197
+ } else {
198
+ sFunctionPath =
199
+ oMainListBinding.getHeaderContext() &&
200
+ oMetaModel.getMetaPath(oMainListBinding.getHeaderContext().getPath()) + "/" + sFunctionName;
201
+ oFunctionContext = oMainListBinding.getHeaderContext();
202
+ }
203
+ }
204
+ var oFunction = sFunctionPath && oMetaModel.createBindingContext(sFunctionPath);
205
+ if (oFunction && oFunction.getObject() && oFunction.getObject()[0].$IsBound) {
206
+ oCreationPromise = operations.callBoundFunction(sFunctionName, oFunctionContext, oModel);
207
+ } else {
208
+ oCreationPromise = operations.callFunctionImport(sFunctionName, oModel);
209
+ }
210
+
211
+ oCreationPromise = oCreationPromise
178
212
  .then(function(oContext) {
179
213
  if (oContext) {
180
214
  return oContext.getObject();
@@ -183,7 +217,7 @@ sap.ui.define(
183
217
  }
184
218
  })
185
219
  .catch(function(oError) {
186
- Log.error("Error while calling function Import " + sFunctionName, oError);
220
+ Log.error("Error while executing the function " + sFunctionName, oError);
187
221
  throw oError;
188
222
  })
189
223
  .then(function(oData) {
@@ -202,7 +236,7 @@ sap.ui.define(
202
236
  }
203
237
  );
204
238
  oTransientListBinding.refreshInternal = function() {};
205
- oNewDocumentContext = oTransientListBinding.create(mParameters.data, bSkipRefresh);
239
+ oNewDocumentContext = oTransientListBinding.create(mParameters.data, true);
206
240
  return that._launchDialogWithKeyFields(
207
241
  oMainListBinding,
208
242
  oTransientListBinding,
@@ -213,7 +247,7 @@ sap.ui.define(
213
247
  messageHandler
214
248
  );
215
249
  } else {
216
- oNewDocumentContext = oMainListBinding.create(mParameters.data, bSkipRefresh, mParameters.createAtEnd);
250
+ oNewDocumentContext = oMainListBinding.create(mParameters.data, true, mParameters.createAtEnd);
217
251
  return that.onAfterCreateCompletion(
218
252
  oMainListBinding,
219
253
  oNewDocumentContext,
@@ -407,22 +441,13 @@ sap.ui.define(
407
441
  }
408
442
  mParameters = getParameters(mParameters);
409
443
  if (mParameters.title) {
410
- if (mParameters.description) {
411
- aParams = [mParameters.title, mParameters.description];
412
- oDeleteMessage.text = CommonUtils.getTranslatedText(
413
- "C_TRANSACTION_HELPER_OBJECT_PAGE_CONFIRM_DELETE_WITH_OBJECTINFO",
414
- oResourceBundle,
415
- aParams,
416
- mParameters.entitySetName
417
- );
418
- } else {
419
- oDeleteMessage.text = CommonUtils.getTranslatedText(
420
- "C_TRANSACTION_HELPER_OBJECT_PAGE_CONFIRM_DELETE_WITH_OBJECTTITLE_SINGULAR",
421
- oResourceBundle,
422
- null,
423
- mParameters.entitySetName
424
- );
425
- }
444
+ aParams = [mParameters.title, mParameters.description];
445
+ oDeleteMessage.text = CommonUtils.getTranslatedText(
446
+ "C_TRANSACTION_HELPER_OBJECT_PAGE_CONFIRM_DELETE_WITH_OBJECTINFO",
447
+ oResourceBundle,
448
+ aParams,
449
+ mParameters.entitySetName
450
+ );
426
451
  } else {
427
452
  oDeleteMessage.text = CommonUtils.getTranslatedText(
428
453
  "C_TRANSACTION_HELPER_OBJECT_PAGE_CONFIRM_DELETE_WITH_OBJECTTITLE_SINGULAR",
@@ -632,8 +657,14 @@ sap.ui.define(
632
657
  bDialogConfirmed = true;
633
658
  BusyLocker.lock(that.oLockObject);
634
659
  var aContexts = aDeletableContexts;
635
- return that
636
- .findActiveDraftRootContexts(aContexts, mParameters.bFindActiveContexts)
660
+ var onBeforeDeletePromise;
661
+ if (mParameters.beforeDeleteCallBack) {
662
+ onBeforeDeletePromise = mParameters.beforeDeleteCallBack({ contexts: aContexts });
663
+ } else {
664
+ onBeforeDeletePromise = Promise.resolve();
665
+ }
666
+ return onBeforeDeletePromise
667
+ .then(that.findActiveDraftRootContexts.bind(that, aContexts, mParameters.bFindActiveContexts))
637
668
  .then(function(activeContexts) {
638
669
  //make sure to fetch the active contexts before deleting the drafts
639
670
  return Promise.all(
@@ -783,7 +814,7 @@ sap.ui.define(
783
814
  * @param {sap.ui.model.odata.v4.Context} oContext Context of the document to be canceled or deleted
784
815
  * @param {object} [mParameters] Optional, can contain the following attributes:
785
816
  * @param {sap.m.Button} mParameters.cancelButton Cancel Button of the discard popover (mandatory for now)
786
- * @param {boolean} mParameters.bSkipDiscardPopover Optional, supresses the discard popover incase of draft applications while navigating out of OP
817
+ * @param {boolean} mParameters.skipDiscardPopover Optional, supresses the discard popover incase of draft applications while navigating out of OP
787
818
  * @param oResourceBundle
788
819
  * @param messageHandler
789
820
  * @returns {Promise} Promise resolves with ???
@@ -802,6 +833,7 @@ sap.ui.define(
802
833
  var oParamsContext = oContext,
803
834
  oCancelButton = mParameters.cancelButton,
804
835
  oModel = oParamsContext.getModel(),
836
+ onBeforeCancelPromise,
805
837
  sCanonicalPath;
806
838
  return Promise.resolve(this.getProgrammingModel(oContext))
807
839
  .then(function(sPModel) {
@@ -820,12 +852,20 @@ sap.ui.define(
820
852
  }
821
853
  })
822
854
  .then(function() {
823
- if (!mParameters.bSkipDiscardPopover) {
855
+ if (!mParameters.skipDiscardPopover) {
824
856
  return that._showDiscardPopover(oCancelButton, that._bIsModified, oResourceBundle);
825
857
  } else {
826
858
  return Promise.resolve();
827
859
  }
828
860
  })
861
+ .then(function() {
862
+ if (mParameters.beforeCancelCallBack) {
863
+ onBeforeCancelPromise = mParameters.beforeCancelCallBack({ context: oContext });
864
+ } else {
865
+ onBeforeCancelPromise = Promise.resolve();
866
+ }
867
+ return onBeforeCancelPromise;
868
+ })
829
869
  .then(function() {
830
870
  // eslint-disable-next-line default-case
831
871
  switch (sProgrammingModel) {
@@ -975,7 +1015,7 @@ sap.ui.define(
975
1015
  });
976
1016
  },
977
1017
  /**
978
- * Calls a bound/unbound action.
1018
+ * Calls a bound or unbound action.
979
1019
  *
980
1020
  * @function
981
1021
  * @static
@@ -983,9 +1023,9 @@ sap.ui.define(
983
1023
  * @memberof sap.fe.core.TransactionHelper
984
1024
  * @param {string} sActionName The name of the action to be called
985
1025
  * @param {map} [mParameters] Contains the following attributes:
986
- * @param {sap.ui.model.odata.v4.Context} [mParameters.contexts] Mandatory for a bound action: Either one context or an array with contexts for which the action shall be called
987
- * @param {sap.ui.model.odata.v4.ODataModel} [mParameters.model] Mandatory for an unbound action: An instance of an OData v4 model
988
- * @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 (TODO: create enum)
1026
+ * @param {sap.ui.model.odata.v4.Context} [mParameters.contexts] Mandatory for a bound action: Either one context or an array with contexts for which the action is to be called
1027
+ * @param {sap.ui.model.odata.v4.ODataModel} [mParameters.model] Mandatory for an unbound action: An instance of an OData V4 model
1028
+ * @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
989
1029
  * @param {string} [mParameters.label] A human-readable label for the action
990
1030
  * @param {boolean} [mParameters.bGetBoundContext] If specified, the action promise returns the bound context
991
1031
  * @param {object} oView Contains the object of the current view
@@ -1321,8 +1361,9 @@ sap.ui.define(
1321
1361
  oMetaModel = oModel.getMetaModel(),
1322
1362
  aImmutableFields = [],
1323
1363
  oAppComponent = that._getAppComponent(),
1324
- oEntitySetContext = oMetaModel.createBindingContext(oListBinding.getPath()),
1325
- sMetaPath = oMetaModel.getMetaPath(oListBinding.getPath());
1364
+ sPath = oListBinding.isRelative() ? oListBinding.getResolvedPath() : oListBinding.getPath(),
1365
+ oEntitySetContext = oMetaModel.createBindingContext(sPath),
1366
+ sMetaPath = oMetaModel.getMetaPath(sPath);
1326
1367
  for (var i in mFields) {
1327
1368
  aImmutableFields.push(oMetaModel.createBindingContext(sMetaPath + "/" + mFields[i]));
1328
1369
  }
@@ -1575,6 +1616,50 @@ sap.ui.define(
1575
1616
  : undefined;
1576
1617
  }
1577
1618
  return sNewAction;
1619
+ },
1620
+ /**
1621
+ * Retrieves the label for the title of a specific create action dialog, e.g. Create Sales Order from Quotation.
1622
+ *
1623
+ * The following priority is applied:
1624
+ * 1. label of line-item annotation.
1625
+ * 2. label annotated in the action.
1626
+ * 3. "Create" as a constant from i18n.
1627
+ *
1628
+ * @function
1629
+ * @static
1630
+ * @private
1631
+ * @name sap.fe.core.TransactionHelper._getSpecificCreateActionDialogLabel
1632
+ * @memberof sap.fe.core.TransactionHelper
1633
+ * @param {object} oMetaModel The MetaModel used to check for the NewAction parameter
1634
+ * @param {string} sMetaPath The MetaPath
1635
+ * @param {string} sNewAction Contains the name of the action to be executed
1636
+ * @param {object} oResourceBundleCore ResourceBundle to access the default Create label
1637
+ * @returns {string} The label for the Create Action Dialog
1638
+ * @ui5-restricted
1639
+ * @final
1640
+ **/
1641
+ _getSpecificCreateActionDialogLabel: function(oMetaModel, sMetaPath, sNewAction, oResourceBundleCore) {
1642
+ var fnGetLabelFromLineItemAnnotation = function() {
1643
+ if (oMetaModel && oMetaModel.getObject(sMetaPath + "/@com.sap.vocabularies.UI.v1.LineItem")) {
1644
+ var iLineItemIndex = oMetaModel
1645
+ .getObject(sMetaPath + "/@com.sap.vocabularies.UI.v1.LineItem")
1646
+ .findIndex(function(oLineItem) {
1647
+ var aLineItemAction = oLineItem.Action ? oLineItem.Action.split("(") : undefined;
1648
+ return aLineItemAction ? aLineItemAction[0] === sNewAction : false;
1649
+ });
1650
+ return iLineItemIndex > -1
1651
+ ? oMetaModel.getObject(sMetaPath + "/@com.sap.vocabularies.UI.v1.LineItem")[iLineItemIndex].Label
1652
+ : undefined;
1653
+ } else {
1654
+ return undefined;
1655
+ }
1656
+ };
1657
+
1658
+ return (
1659
+ fnGetLabelFromLineItemAnnotation() ||
1660
+ (oMetaModel && oMetaModel.getObject(sMetaPath + "/" + sNewAction + "@com.sap.vocabularies.Common.v1.Label")) ||
1661
+ (oResourceBundleCore && oResourceBundleCore.getText("C_TRANSACTION_HELPER_SAPFE_ACTION_CREATE"))
1662
+ );
1578
1663
  }
1579
1664
  });
1580
1665
  }
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * SAPUI5
3
- * (c) Copyright 2009-2021 SAP SE. All rights reserved.
3
+ * (c) Copyright 2009-2022 SAP SE. All rights reserved.
4
4
  */
5
5
 
6
6
  // Provides static functions for the draft programming model
@@ -75,6 +75,21 @@ sap.ui.define(
75
75
  PREPARE: "PreparationAction"
76
76
  };
77
77
 
78
+ /**
79
+ * Static functions for the draft programming model
80
+ *
81
+ * @namespace
82
+ * @alias sap.fe.core.actions.draft
83
+ * @private
84
+ * @experimental This module is only for experimental use! <br/><b>This is only a POC and maybe deleted</b>
85
+ * @since 1.54.0
86
+ */
87
+ var draft = {
88
+ createDraftFromActiveDocument: createDraftFromActiveDocument,
89
+ activateDocument: activateDocument,
90
+ deleteDraft: deleteDraft
91
+ };
92
+
78
93
  /**
79
94
  * Determines action name for a draft operation.
80
95
  *
@@ -134,23 +149,49 @@ sap.ui.define(
134
149
  var oOptions = { $$inheritExpandSelect: true };
135
150
  var oOperation = createOperation(oContext, draftOperations.EDIT, oOptions);
136
151
  oOperation.setParameter("PreserveChanges", bPreserveChanges);
137
- var oEditPromise = oOperation.execute("direct").then(function(oDraftDocumentContext) {
138
- return oDraftDocumentContext;
139
- });
140
- oOperation.getModel().submitBatch("direct");
152
+ var sGroupId = "direct";
153
+ var oEditPromise = oOperation
154
+ .execute(sGroupId, undefined, fnOnStrictHandlingFailed.bind(draft, oContext, sGroupId))
155
+ .then(function(oDraftDocumentContext) {
156
+ return oDraftDocumentContext;
157
+ });
158
+ oOperation.getModel().submitBatch(sGroupId);
141
159
  return oEditPromise;
142
160
  } else {
143
- throw new Error("The edit action cannot be executed on a draft document");
161
+ throw new Error("You cannot edit this draft document");
162
+ }
163
+ }
164
+
165
+ function fnOnStrictHandlingFailed(oContext, sGroupId, aMessages) {
166
+ if (aMessages.length === 1) {
167
+ var sMessage = aMessages[0].message,
168
+ dialogPromise = new Promise(function(resolve) {
169
+ sap.ui.require(["sap/m/MessageBox"], function(MessageBox) {
170
+ MessageBox.warning(sMessage, {
171
+ title: "Warning",
172
+ actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],
173
+ onClose: function(sAction) {
174
+ if (sAction === MessageBox.Action.OK) {
175
+ resolve(true);
176
+ oContext.getModel().submitBatch(sGroupId);
177
+ } else {
178
+ resolve(false);
179
+ }
180
+ }
181
+ });
182
+ });
183
+ });
184
+ return dialogPromise;
144
185
  }
145
186
  }
146
187
 
147
188
  /**
148
- * Activates a draft document. The draft will replace the sibling entity and will be deleted by the backend.
189
+ * Activates a draft document. The draft will replace the sibling entity and will be deleted by the back end.
149
190
  *
150
191
  * @function
151
192
  * @param {sap.ui.model.odata.v4.Context} oContext context for which the action should be performed
152
193
  * @param {object} oAppComponent The AppComponent
153
- * @param {string} [sGroupId] the optional batch group where we want to execute the operation in
194
+ * @param {string} [sGroupId] The optional batch group in which the operation is to be executed
154
195
  * @returns {Promise.<sap.ui.model.odata.v4.Context>} Resolve function returns the context of the operation
155
196
  * @private
156
197
  * @ui5-restricted
@@ -166,7 +207,7 @@ sap.ui.define(
166
207
  if (!oContext.getProperty("IsActiveEntity")) {
167
208
  var oOperation = createOperation(oContext, draftOperations.ACTIVATION, { $$inheritExpandSelect: true });
168
209
  return oOperation
169
- .execute(sGroupId, bIgnoreEtag)
210
+ .execute(sGroupId, bIgnoreEtag, fnOnStrictHandlingFailed.bind(draft, oContext, sGroupId)) //3rd parameter<------
170
211
  .then(function(oActiveDocumentContext) {
171
212
  return oActiveDocumentContext;
172
213
  })
@@ -563,20 +604,6 @@ sap.ui.define(
563
604
  return executeDraftDiscardAction(oContext);
564
605
  }
565
606
  }
566
- /**
567
- * Static functions for the draft programming model
568
- *
569
- * @namespace
570
- * @alias sap.fe.core.actions.draft
571
- * @private
572
- * @experimental This module is only for experimental use! <br/><b>This is only a POC and maybe deleted</b>
573
- * @since 1.54.0
574
- */
575
- var draft = {
576
- createDraftFromActiveDocument: createDraftFromActiveDocument,
577
- activateDocument: activateDocument,
578
- deleteDraft: deleteDraft
579
- };
580
607
 
581
608
  return draft;
582
609
  }
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * SAPUI5
3
- * (c) Copyright 2009-2021 SAP SE. All rights reserved.
3
+ * (c) Copyright 2009-2022 SAP SE. All rights reserved.
4
4
  */
5
5
 
6
6
  // Static functions for Fiori Message Handling
@@ -165,10 +165,7 @@ sap.ui.define(
165
165
  oDateFormat = DateFormat.getDateTimeInstance({
166
166
  pattern: "MMMM dd, yyyy 'at' hh:mm a"
167
167
  });
168
- sRetryAfterMessage = oResourceBundle.getText(
169
- "C_MESSAGE_HANDLING_SAPFE_503_ERROR_YEAR",
170
- oDateFormat.format(dRetryAfter)
171
- );
168
+ sRetryAfterMessage = oResourceBundle.getText("C_MESSAGE_HANDLING_SAPFE_503_ERROR", oDateFormat.format(dRetryAfter));
172
169
  } else if (dNow.getFullYear() == dRetryAfter.getFullYear()) {
173
170
  //same year
174
171
  if (bMessageDialog) {
@@ -359,6 +356,8 @@ sap.ui.define(
359
356
  this.setVisible(false);
360
357
  }
361
358
  });
359
+ // Update proper ETag Mismatch error
360
+ var bHasEtagMessage = fnModifyETagMessagesOnly(oMessageManager, oResourceBundle);
362
361
  that.oMessageView.setModel(oMessageDialogModel);
363
362
  that.oDialog =
364
363
  that.oDialog ||
@@ -394,8 +393,6 @@ sap.ui.define(
394
393
  }
395
394
  });
396
395
 
397
- // Update proper ETag Mismatch error
398
- var bHasEtagMessage = fnModifyETagMessagesOnly(oMessageManager, oResourceBundle);
399
396
  if (bHasEtagMessage) {
400
397
  sap.ui.require(["sap/m/ButtonType"], function(ButtonType) {
401
398
  that.oDialog.setBeginButton(
@@ -460,6 +457,7 @@ sap.ui.define(
460
457
  var oMessageManager = sap.ui.getCore().getMessageManager(),
461
458
  oMessageModel = oMessageManager.getMessageModel(),
462
459
  aMessages = oMessageModel.getObject("/"),
460
+ oResourceBundle = sap.ui.getCore().getLibraryResourceBundle("sap.fe.core"),
463
461
  aTransitionMessages = [];
464
462
 
465
463
  for (var i = 0; i < aMessages.length; i++) {
@@ -474,8 +472,13 @@ sap.ui.define(
474
472
  }
475
473
 
476
474
  for (var i = 0; i < aTransitionMessages.length; i++) {
477
- if (aTransitionMessages[i].code === "503") {
478
- aTransitionMessages[i].message = "\n" + aTransitionMessages[i].message;
475
+ if (
476
+ aTransitionMessages[i].code === "503" &&
477
+ aTransitionMessages[i].message !== "" &&
478
+ aTransitionMessages[i].message.indexOf(oResourceBundle.getText("C_MESSAGE_HANDLING_SAPFE_503_BACKEND_PREFIX")) === -1
479
+ ) {
480
+ aTransitionMessages[i].message =
481
+ "\n" + oResourceBundle.getText("C_MESSAGE_HANDLING_SAPFE_503_BACKEND_PREFIX") + aTransitionMessages[i].message;
479
482
  }
480
483
  }
481
484
  return aTransitionMessages;
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * SAPUI5
3
- * (c) Copyright 2009-2021 SAP SE. All rights reserved.
3
+ * (c) Copyright 2009-2022 SAP SE. All rights reserved.
4
4
  */
5
5
 
6
6
  // Provides static functions for the non-draft programming model
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * SAPUI5
3
- * (c) Copyright 2009-2021 SAP SE. All rights reserved.
3
+ * (c) Copyright 2009-2022 SAP SE. All rights reserved.
4
4
  */
5
5
 
6
6
  // Provides static functions to call OData actions (bound/import) and functions (bound/import)
@@ -35,7 +35,8 @@ sap.ui.define(
35
35
  ) {
36
36
  "use strict";
37
37
 
38
- var Constants = FELibrary.Constants;
38
+ var Constants = FELibrary.Constants,
39
+ InvocationGrouping = FELibrary.InvocationGrouping;
39
40
 
40
41
  /**
41
42
  * Calls a bound action for one or multiple contexts
@@ -44,7 +45,7 @@ sap.ui.define(
44
45
  * @name sap.fe.core.actions.operations.callBoundAction
45
46
  * @memberof sap.fe.core.actions.operations
46
47
  * @param {string} sActionName The name of the action to be called
47
- * @param {sap.ui.model.odata.v4.Context} contexts Either one context or an array with contexts for which the action shall be called
48
+ * @param {sap.ui.model.odata.v4.Context} contexts Either one context or an array with contexts for which the action is to be be called
48
49
  * @param {sap.ui.model.odata.v4.Model} oModel OData Model
49
50
  * @param {object} oAppComponent The AppComponent
50
51
  * @param {map} [mParameters] Optional, can contain the following attributes:
@@ -53,7 +54,7 @@ sap.ui.define(
53
54
  * @param {Array} [mParameters.additionalSideEffect] array of property paths to be requested in addition to actual target properties of the side effect
54
55
  * @param {boolean} [mParameters.showActionParameterDialog] [false] if set and if parameters exist the user retrieves a dialog to fill in parameters, if actionParameters are passed they are shown to the user
55
56
  * @param {string} [mParameters.label] a human-readable label for the action
56
- * @param {string} [mParameters.invocationGrouping] [Isolated] mode how actions shall be called: Changeset to put all action calls into one changeset, Isolated to put them into separate changesets
57
+ * @param {string} [mParameters.invocationGrouping] [Isolated] mode how actions are to be called: Changeset to put all action calls into one changeset, Isolated to put them into separate changesets
57
58
  * @param {Function} [mParameters.onSubmitted] Function which is called once the actions are submitted with an array of promises
58
59
  * @param {map} [mParameters.defaultParameters] can contain default parameters from FLP user defaults
59
60
  * @param {sap.ui.core.Element} [mParameters.parentControl] if specified the dialogs are added as dependent of the parent control
@@ -166,7 +167,7 @@ sap.ui.define(
166
167
  function _executeFunction(sFunctionName, oModel, oFunction, context) {
167
168
  var oFunctionPromise, sGroupId;
168
169
  if (!oFunction || !oFunction.getObject()) {
169
- return Promise.reject(new Error("Function" + sFunctionName + " not found"));
170
+ return Promise.reject(new Error("Function " + sFunctionName + " not found"));
170
171
  }
171
172
  if (context) {
172
173
  oFunction = oModel.bindContext(sFunctionName + "(...)", context);
@@ -198,7 +199,7 @@ sap.ui.define(
198
199
  sMessagesPath,
199
200
  iMessageSideEffect;
200
201
  if (!oAction || !oAction.getObject()) {
201
- return reject(new Error("Action" + sActionName + " not found"));
202
+ return reject(new Error("Action " + sActionName + " not found"));
202
203
  }
203
204
  if (bShowActionParameterDialog || aActionParameters.length > 0) {
204
205
  aActionParameters = prepareActionParameters(oAction, aActionParameters);
@@ -257,7 +258,7 @@ sap.ui.define(
257
258
  mActionExecutionParameters.aContexts = aContexts;
258
259
  mActionExecutionParameters.mBindingParameters = mParameters.mBindingParameters;
259
260
  mActionExecutionParameters.additionalSideEffect = mParameters.additionalSideEffect;
260
- mActionExecutionParameters.bGrouped = mParameters.invocationGrouping === "ChangeSet";
261
+ mActionExecutionParameters.bGrouped = mParameters.invocationGrouping === InvocationGrouping.ChangeSet;
261
262
  mActionExecutionParameters.bReturnAsArray = mParameters.bReturnAsArray;
262
263
  mActionExecutionParameters.internalModelContext = mParameters.internalModelContext;
263
264
  mActionExecutionParameters.operationAvailableMap = mParameters.operationAvailableMap;
@@ -415,7 +416,9 @@ sap.ui.define(
415
416
  if (oMessage.target.includes("APD_::" + sParameter)) {
416
417
  aFieldInvalid.push("APD_::" + sParam);
417
418
  oMessage.target = bClearTarget ? "" : oMessage.target;
418
- oMessageManager.removeMessages(oMessage);
419
+ if (bClearTarget) {
420
+ oMessageManager.removeMessages(oMessage);
421
+ }
419
422
  }
420
423
  });
421
424
  });
@@ -461,6 +464,7 @@ sap.ui.define(
461
464
  // TODO: move the dialog into the fragment and move the handlers to the oController
462
465
  return Fragment.load({ definition: oFragment, controller: oController }).then(function(oDialogContent) {
463
466
  var oOperationBinding;
467
+ var aContexts;
464
468
  var oResourceBundle = oParentControl.getController().oResourceBundle;
465
469
  var oDialog = new Dialog({
466
470
  title:
@@ -843,7 +847,7 @@ sap.ui.define(
843
847
  oDialog.setModel(oMVFModel, "mvfview");
844
848
 
845
849
  var sActionPath = sActionName + "(...)";
846
- var aContexts = mParameters.aContexts || [];
850
+ aContexts = mParameters.aContexts || [];
847
851
  if (!aContexts.length) {
848
852
  sActionPath = "/" + sActionPath;
849
853
  }
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * SAPUI5
3
- * (c) Copyright 2009-2021 SAP SE. All rights reserved.
3
+ * (c) Copyright 2009-2022 SAP SE. All rights reserved.
4
4
  */
5
5
 
6
6
  // Provides static functions for the sticky session programming model
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * SAPUI5
3
- * (c) Copyright 2009-2021 SAP SE. All rights reserved.
3
+ * (c) Copyright 2009-2022 SAP SE. All rights reserved.
4
4
  */
5
5
 
6
6
  // Provides ControllerMetadata