@sapui5/sap.fe.core 1.101.1 → 1.102.2

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 (217) hide show
  1. package/package.json +1 -1
  2. package/src/sap/fe/core/.library +1 -1
  3. package/src/sap/fe/core/AppComponent.js +5 -5
  4. package/src/sap/fe/core/AppComponent.ts +19 -18
  5. package/src/sap/fe/core/AppStateHandler.js +4 -4
  6. package/src/sap/fe/core/AppStateHandler.ts +9 -9
  7. package/src/sap/fe/core/CommonUtils.js +59 -93
  8. package/src/sap/fe/core/CommonUtils.ts +80 -99
  9. package/src/sap/fe/core/ExtensionAPI.js +2 -4
  10. package/src/sap/fe/core/ExtensionAPI.ts +1 -3
  11. package/src/sap/fe/core/PageController.js +14 -9
  12. package/src/sap/fe/core/PageController.ts +8 -2
  13. package/src/sap/fe/core/TemplateComponent.js +6 -6
  14. package/src/sap/fe/core/TemplateComponent.ts +5 -5
  15. package/src/sap/fe/core/TemplateModel.js +2 -2
  16. package/src/sap/fe/core/TemplateModel.ts +2 -2
  17. package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.js +303 -75
  18. package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.ts +273 -64
  19. package/src/sap/fe/core/{BusyLocker.js → controllerextensions/BusyLocker.js} +1 -1
  20. package/src/sap/fe/core/{BusyLocker.ts → controllerextensions/BusyLocker.ts} +7 -7
  21. package/src/sap/fe/core/controllerextensions/EditFlow.js +234 -123
  22. package/src/sap/fe/core/controllerextensions/EditFlow.ts +176 -114
  23. package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +34 -10
  24. package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +44 -12
  25. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +30 -28
  26. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +38 -31
  27. package/src/sap/fe/core/controllerextensions/InternalRouting.js +157 -102
  28. package/src/sap/fe/core/controllerextensions/InternalRouting.ts +155 -103
  29. package/src/sap/fe/core/controllerextensions/MassEdit.js +4 -3
  30. package/src/sap/fe/core/controllerextensions/MassEdit.ts +15 -14
  31. package/src/sap/fe/core/controllerextensions/MessageHandler.js +3 -3
  32. package/src/sap/fe/core/controllerextensions/MessageHandler.ts +10 -2
  33. package/src/sap/fe/core/controllerextensions/Paginator.js +12 -3
  34. package/src/sap/fe/core/controllerextensions/Paginator.ts +11 -2
  35. package/src/sap/fe/core/controllerextensions/Share.js +19 -1
  36. package/src/sap/fe/core/controllerextensions/Share.ts +18 -0
  37. package/src/sap/fe/core/controllerextensions/SideEffects.js +2 -2
  38. package/src/sap/fe/core/controllerextensions/SideEffects.ts +2 -2
  39. package/src/sap/fe/core/controllerextensions/ViewState.js +11 -1
  40. package/src/sap/fe/core/controllerextensions/ViewState.ts +10 -0
  41. package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.js +105 -0
  42. package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.ts +98 -0
  43. package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync.js +360 -0
  44. package/src/sap/fe/core/{actions → controllerextensions}/collaboration/ActivitySync.ts +57 -106
  45. package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.js +146 -0
  46. package/src/sap/fe/core/{actions → controllerextensions}/collaboration/CollaborationCommon.ts +6 -6
  47. package/src/sap/fe/core/{actions → controllerextensions}/collaboration/Manage.js +4 -4
  48. package/src/sap/fe/core/{actions → controllerextensions}/collaboration/Manage.ts +3 -3
  49. package/src/sap/fe/core/{actions → controllerextensions}/collaboration/ManageDialog.fragment.xml +0 -0
  50. package/src/sap/fe/core/{actions → controllerextensions}/collaboration/UserDetails.fragment.xml +5 -7
  51. package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.js +1587 -0
  52. package/src/sap/fe/core/{TransactionHelper.ts → controllerextensions/editFlow/TransactionHelper.ts} +26 -13
  53. package/src/sap/fe/core/controllerextensions/editFlow/draft.js +785 -0
  54. package/src/sap/fe/core/{actions → controllerextensions/editFlow}/draft.ts +179 -22
  55. package/src/sap/fe/core/controllerextensions/editFlow/operations.js +1175 -0
  56. package/src/sap/fe/core/{actions → controllerextensions/editFlow}/operations.ts +203 -98
  57. package/src/sap/fe/core/controllerextensions/editFlow/sticky.js +190 -0
  58. package/src/sap/fe/core/{actions → controllerextensions/editFlow}/sticky.ts +76 -12
  59. package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.js +597 -0
  60. package/src/sap/fe/core/{actions → controllerextensions/messageHandler}/messageHandling.ts +46 -27
  61. package/src/sap/fe/core/controllerextensions/routing/RouterProxy.js +940 -0
  62. package/src/sap/fe/core/{RouterProxy.ts → controllerextensions/routing/RouterProxy.ts} +20 -18
  63. package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +21 -18
  64. package/src/sap/fe/core/controls/CommandExecution.js +14 -3
  65. package/src/sap/fe/core/controls/CommandExecution.ts +11 -2
  66. package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.js +34 -29
  67. package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.ts +33 -29
  68. package/src/sap/fe/core/controls/CustomQuickViewPage.js +2 -1
  69. package/src/sap/fe/core/controls/CustomQuickViewPage.ts +1 -0
  70. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossDraft.fragment.xml +11 -3
  71. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +17 -7
  72. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.ts +9 -3
  73. package/src/sap/fe/core/controls/FileWrapper.js +49 -2
  74. package/src/sap/fe/core/controls/FileWrapper.ts +34 -1
  75. package/src/sap/fe/core/controls/FormElementWrapper.js +12 -2
  76. package/src/sap/fe/core/controls/FormElementWrapper.ts +12 -1
  77. package/src/sap/fe/core/controls/MassEditSelect.js +33 -0
  78. package/src/sap/fe/core/controls/MassEditSelect.ts +45 -0
  79. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +2 -2
  80. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +23 -28
  81. package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +28 -63
  82. package/src/sap/fe/core/controls/massEdit/MassEditField.fragment.xml +107 -0
  83. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +550 -36
  84. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +604 -36
  85. package/src/sap/fe/core/converters/ManifestSettings.js +2 -1
  86. package/src/sap/fe/core/converters/ManifestSettings.ts +4 -1
  87. package/src/sap/fe/core/converters/MetaModelConverter.js +11 -40
  88. package/src/sap/fe/core/converters/MetaModelConverter.ts +56 -84
  89. package/src/sap/fe/core/converters/annotations/DataField.js +20 -4
  90. package/src/sap/fe/core/converters/annotations/DataField.ts +24 -2
  91. package/src/sap/fe/core/converters/controls/Common/Action.js +5 -12
  92. package/src/sap/fe/core/converters/controls/Common/Action.ts +3 -9
  93. package/src/sap/fe/core/converters/controls/Common/Chart.js +10 -3
  94. package/src/sap/fe/core/converters/controls/Common/Chart.ts +8 -3
  95. package/src/sap/fe/core/converters/controls/Common/Form.js +12 -14
  96. package/src/sap/fe/core/converters/controls/Common/Form.ts +17 -19
  97. package/src/sap/fe/core/converters/controls/Common/Table.js +149 -66
  98. package/src/sap/fe/core/converters/controls/Common/Table.ts +136 -52
  99. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +22 -12
  100. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +23 -12
  101. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +7 -5
  102. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +15 -10
  103. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +26 -24
  104. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +35 -33
  105. package/src/sap/fe/core/converters/helpers/Aggregation.js +10 -2
  106. package/src/sap/fe/core/converters/helpers/Aggregation.ts +18 -13
  107. package/src/sap/fe/core/converters/helpers/BindingHelper.js +3 -2
  108. package/src/sap/fe/core/converters/helpers/BindingHelper.ts +6 -5
  109. package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +25 -25
  110. package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +35 -38
  111. package/src/sap/fe/core/designtime/AppComponent.designtime.js +3 -3
  112. package/src/sap/fe/core/designtime/AppComponent.designtime.ts +8 -6
  113. package/src/sap/fe/core/formatters/TableFormatter.js +73 -12
  114. package/src/sap/fe/core/formatters/TableFormatter.ts +70 -15
  115. package/src/sap/fe/core/fpm/Component.js +2 -2
  116. package/src/sap/fe/core/fpm/Component.ts +1 -1
  117. package/src/sap/fe/core/helpers/BindingExpression.js +10 -7
  118. package/src/sap/fe/core/helpers/BindingExpression.ts +37 -35
  119. package/src/sap/fe/core/helpers/ClassSupport.js +1 -1
  120. package/src/sap/fe/core/helpers/ClassSupport.ts +1 -0
  121. package/src/sap/fe/core/helpers/FPMHelper.js +3 -2
  122. package/src/sap/fe/core/helpers/FPMHelper.ts +9 -8
  123. package/src/sap/fe/core/helpers/MassEditHelper.js +399 -152
  124. package/src/sap/fe/core/helpers/MassEditHelper.ts +385 -163
  125. package/src/sap/fe/core/helpers/ModelHelper.js +1 -1
  126. package/src/sap/fe/core/helpers/ModelHelper.ts +20 -30
  127. package/src/sap/fe/core/helpers/StableIdHelper.js +5 -1
  128. package/src/sap/fe/core/helpers/StableIdHelper.ts +8 -4
  129. package/src/sap/fe/core/{Synchronization.js → helpers/Synchronization.js} +1 -1
  130. package/src/sap/fe/core/{Synchronization.ts → helpers/Synchronization.ts} +1 -1
  131. package/src/sap/fe/core/library.js +12 -3
  132. package/src/sap/fe/core/library.ts +9 -0
  133. package/src/sap/fe/core/messagebundle.properties +125 -180
  134. package/src/sap/fe/core/messagebundle_ar.properties +30 -63
  135. package/src/sap/fe/core/messagebundle_bg.properties +30 -63
  136. package/src/sap/fe/core/messagebundle_ca.properties +30 -63
  137. package/src/sap/fe/core/messagebundle_cs.properties +30 -63
  138. package/src/sap/fe/core/messagebundle_cy.properties +30 -63
  139. package/src/sap/fe/core/messagebundle_da.properties +31 -64
  140. package/src/sap/fe/core/messagebundle_de.properties +30 -63
  141. package/src/sap/fe/core/messagebundle_el.properties +31 -64
  142. package/src/sap/fe/core/messagebundle_en.properties +31 -64
  143. package/src/sap/fe/core/messagebundle_en_GB.properties +31 -64
  144. package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +40 -73
  145. package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +31 -64
  146. package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +49 -82
  147. package/src/sap/fe/core/messagebundle_es.properties +30 -63
  148. package/src/sap/fe/core/messagebundle_es_MX.properties +30 -63
  149. package/src/sap/fe/core/messagebundle_et.properties +30 -63
  150. package/src/sap/fe/core/messagebundle_fi.properties +30 -63
  151. package/src/sap/fe/core/messagebundle_fr.properties +33 -66
  152. package/src/sap/fe/core/messagebundle_fr_CA.properties +30 -63
  153. package/src/sap/fe/core/messagebundle_hi.properties +30 -63
  154. package/src/sap/fe/core/messagebundle_hr.properties +30 -63
  155. package/src/sap/fe/core/messagebundle_hu.properties +29 -62
  156. package/src/sap/fe/core/messagebundle_id.properties +31 -64
  157. package/src/sap/fe/core/messagebundle_it.properties +30 -63
  158. package/src/sap/fe/core/messagebundle_iw.properties +30 -63
  159. package/src/sap/fe/core/messagebundle_ja.properties +30 -63
  160. package/src/sap/fe/core/messagebundle_kk.properties +30 -63
  161. package/src/sap/fe/core/messagebundle_ko.properties +30 -63
  162. package/src/sap/fe/core/messagebundle_lt.properties +30 -63
  163. package/src/sap/fe/core/messagebundle_lv.properties +30 -63
  164. package/src/sap/fe/core/messagebundle_ms.properties +31 -64
  165. package/src/sap/fe/core/messagebundle_nl.properties +31 -64
  166. package/src/sap/fe/core/messagebundle_no.properties +30 -63
  167. package/src/sap/fe/core/messagebundle_pl.properties +31 -64
  168. package/src/sap/fe/core/messagebundle_pt.properties +31 -64
  169. package/src/sap/fe/core/messagebundle_pt_PT.properties +30 -63
  170. package/src/sap/fe/core/messagebundle_ro.properties +30 -63
  171. package/src/sap/fe/core/messagebundle_ru.properties +30 -63
  172. package/src/sap/fe/core/messagebundle_sh.properties +30 -63
  173. package/src/sap/fe/core/messagebundle_sk.properties +30 -63
  174. package/src/sap/fe/core/messagebundle_sl.properties +32 -65
  175. package/src/sap/fe/core/messagebundle_sv.properties +30 -63
  176. package/src/sap/fe/core/messagebundle_th.properties +30 -63
  177. package/src/sap/fe/core/messagebundle_tr.properties +30 -63
  178. package/src/sap/fe/core/messagebundle_uk.properties +31 -64
  179. package/src/sap/fe/core/messagebundle_vi.properties +31 -64
  180. package/src/sap/fe/core/messagebundle_zh_CN.properties +30 -63
  181. package/src/sap/fe/core/messagebundle_zh_TW.properties +31 -64
  182. package/src/sap/fe/core/services/EnvironmentServiceFactory.js +6 -3
  183. package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +10 -9
  184. package/src/sap/fe/core/services/NavigationServiceFactory.js +2 -2
  185. package/src/sap/fe/core/services/NavigationServiceFactory.ts +8 -4
  186. package/src/sap/fe/core/services/RoutingServiceFactory.js +9 -6
  187. package/src/sap/fe/core/services/RoutingServiceFactory.ts +10 -9
  188. package/src/sap/fe/core/services/ShellServicesFactory.js +36 -1
  189. package/src/sap/fe/core/services/ShellServicesFactory.ts +38 -1
  190. package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +5 -4
  191. package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +34 -36
  192. package/src/sap/fe/core/templating/DisplayModeFormatter.js +1 -1
  193. package/src/sap/fe/core/templating/DisplayModeFormatter.ts +1 -1
  194. package/src/sap/fe/core/templating/EntitySetHelper.js +1 -9
  195. package/src/sap/fe/core/templating/EntitySetHelper.ts +11 -13
  196. package/src/sap/fe/core/templating/FilterHelper.js +4 -4
  197. package/src/sap/fe/core/templating/FilterHelper.ts +6 -5
  198. package/src/sap/fe/core/templating/PropertyHelper.js +58 -35
  199. package/src/sap/fe/core/templating/PropertyHelper.ts +19 -4
  200. package/src/sap/fe/core/templating/UIFormatters.js +16 -5
  201. package/src/sap/fe/core/templating/UIFormatters.ts +14 -5
  202. package/src/sap/fe/core/type/DateTimeWithTimezone.js +47 -0
  203. package/src/sap/fe/core/type/DateTimeWithTimezone.ts +23 -0
  204. package/src/sap/fe/core/AnnotationHelper.js +0 -331
  205. package/src/sap/fe/core/AnnotationHelper.ts +0 -321
  206. package/src/sap/fe/core/RouterProxy.js +0 -938
  207. package/src/sap/fe/core/TransactionHelper.js +0 -1577
  208. package/src/sap/fe/core/actions/collaboration/ActivitySync.js +0 -406
  209. package/src/sap/fe/core/actions/collaboration/CollaborationCommon.js +0 -146
  210. package/src/sap/fe/core/actions/draft.js +0 -665
  211. package/src/sap/fe/core/actions/messageHandling.js +0 -579
  212. package/src/sap/fe/core/actions/nonDraft.js +0 -20
  213. package/src/sap/fe/core/actions/nonDraft.ts +0 -12
  214. package/src/sap/fe/core/actions/operations.js +0 -1096
  215. package/src/sap/fe/core/actions/sticky.js +0 -130
  216. package/src/sap/fe/core/formatters/CriticalityFormatter.js +0 -77
  217. package/src/sap/fe/core/formatters/CriticalityFormatter.ts +0 -58
@@ -1,10 +1,11 @@
1
1
  import ResourceBundle from "sap/base/i18n/ResourceBundle";
2
2
  import Log from "sap/base/Log";
3
- import ActivitySync from "sap/fe/core/actions/collaboration/ActivitySync";
4
- import messageHandling from "sap/fe/core/actions/messageHandling";
5
3
  import AppComponent from "sap/fe/core/AppComponent";
6
4
  import CommonUtils from "sap/fe/core/CommonUtils";
7
- import FELibrary from "sap/fe/core/library";
5
+ import ActivitySync from "sap/fe/core/controllerextensions/collaboration/ActivitySync";
6
+ import messageHandling from "sap/fe/core/controllerextensions/messageHandler/messageHandling";
7
+ import DataLossOrDraftDiscardHandler from "sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler";
8
+ import EditState from "sap/fe/core/helpers/EditState";
8
9
  import { SideEffectsService } from "sap/fe/core/services/SideEffectsServiceFactory";
9
10
  import Button from "sap/m/Button";
10
11
  import Dialog from "sap/m/Dialog";
@@ -17,7 +18,6 @@ import ODataMetaModel from "sap/ui/model/odata/v4/ODataMetaModel";
17
18
  import ResourceModel from "sap/ui/model/resource/ResourceModel";
18
19
  import { CoreEx } from "types/extension_types";
19
20
 
20
- const ProgrammingModel = FELibrary.ProgrammingModel;
21
21
  export type SiblingInformation = {
22
22
  targetContext: Context;
23
23
  pathMapping: { oldPath: string; newPath: string }[];
@@ -79,6 +79,11 @@ const draftOperations = {
79
79
  DISCARD: "DiscardAction",
80
80
  PREPARE: "PreparationAction"
81
81
  };
82
+ /* Enum for navigation types */
83
+ enum NavigationType {
84
+ BackNavigation = "BackNavigation",
85
+ ForwardNavigation = "ForwardNavigation"
86
+ }
82
87
  /**
83
88
  * Static functions for the draft programming model
84
89
  *
@@ -143,8 +148,14 @@ function executeDraftEditAction(oContext: any, bPreserveChanges: boolean) {
143
148
  const sGroupId = "direct";
144
149
  const localI18nRef = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core");
145
150
  const sActionName = localI18nRef.getText("C_COMMON_OBJECT_PAGE_EDIT");
151
+ //If the context is coming from a list binding we pass the flag true to replace the context by the active one
146
152
  const oEditPromise = oOperation
147
- .execute(sGroupId, undefined, CommonUtils.fnOnStrictHandlingFailed.bind(draft, sGroupId, sActionName, oContext.getModel()))
153
+ .execute(
154
+ sGroupId,
155
+ undefined,
156
+ CommonUtils.fnOnStrictHandlingFailed.bind(draft, sGroupId, sActionName, oContext.getModel()),
157
+ oContext.getBinding().isA("sap.ui.model.odata.v4.ODataListBinding")
158
+ )
148
159
  .then(function (oDraftDocumentContext: any) {
149
160
  return oDraftDocumentContext;
150
161
  });
@@ -181,7 +192,8 @@ function executeDraftActivationAction(oContext: any, oAppComponent: AppComponent
181
192
  .execute(
182
193
  sGroupId,
183
194
  bIgnoreEtag,
184
- sGroupId ? CommonUtils.fnOnStrictHandlingFailed.bind(draft, sGroupId, sActionName, oContext.getModel()) : undefined
195
+ sGroupId ? CommonUtils.fnOnStrictHandlingFailed.bind(draft, sGroupId, sActionName, oContext.getModel()) : undefined,
196
+ oContext.getBinding().isA("sap.ui.model.odata.v4.ODataListBinding")
185
197
  ) //3rd parameter<------
186
198
  .then(function (oActiveDocumentContext: any) {
187
199
  return oActiveDocumentContext;
@@ -274,25 +286,30 @@ function requestMessages(oContext: any, oSideEffectsService: SideEffectsService)
274
286
  return Promise.resolve();
275
287
  }
276
288
  /**
277
- * Executes discard of a draft function using HTTP Post.
289
+ * Executes the discard of a draft function using HTTP POST.
278
290
  *
279
291
  * @function
280
292
  * @param {sap.ui.model.odata.v4.Context} oContext Context for which the action should be performed
293
+ * @param {boolean} bEnableStrictHandling
281
294
  * @returns {Promise.<sap.ui.model.odata.v4.Context>} Resolve function returns the context of the operation
282
295
  * @private
283
296
  * @ui5-restricted
284
297
  */
285
- function executeDraftDiscardAction(oContext: any): Promise<boolean> {
298
+ function executeDraftDiscardAction(oContext: any, bEnableStrictHandling?: boolean): Promise<boolean> {
286
299
  if (!oContext.getProperty("IsActiveEntity")) {
287
- const oDiscardOperation = createOperation(oContext, draftOperations.DISCARD);
300
+ const oDiscardOperation = draft.createOperation(oContext, draftOperations.DISCARD);
288
301
  const localI18nRef = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core");
289
302
  const sGroupId = "direct";
290
303
  const sActionName = localI18nRef.getText("C_TRANSACTION_HELPER_DRAFT_DISCARD_BUTTON");
291
- const oDiscardPromise = oDiscardOperation.execute(
292
- sGroupId,
293
- undefined,
294
- CommonUtils.fnOnStrictHandlingFailed.bind(draft, sGroupId, sActionName, oContext.getModel())
295
- );
304
+ // as the discard action doesnt' send the active version in the response we do not use the replace in cache
305
+ const oDiscardPromise = !bEnableStrictHandling
306
+ ? oDiscardOperation.execute(sGroupId)
307
+ : oDiscardOperation.execute(
308
+ sGroupId,
309
+ undefined,
310
+ CommonUtils.fnOnStrictHandlingFailed.bind(draft, sGroupId, sActionName, oContext.getModel()),
311
+ false
312
+ );
296
313
  oContext.getModel().submitBatch(sGroupId);
297
314
  return oDiscardPromise;
298
315
  } else {
@@ -301,11 +318,11 @@ function executeDraftDiscardAction(oContext: any): Promise<boolean> {
301
318
  }
302
319
 
303
320
  /**
304
- * This methods creates a sibling context for a sub-object page, and calculates a sibling path for
305
- * all intermediates paths between the OP and the sub-OP.
321
+ * This method creates a sibling context for a subobject page and calculates a sibling path for all intermediate paths
322
+ * between the object page and the subobject page.
306
323
  *
307
324
  * @param {object} rootCurrentContext The context for the root of the draft
308
- * @param {object} rightmostCurrentContext The context of the sub-object
325
+ * @param {object} rightmostCurrentContext The context of the subobject page
309
326
  * @returns {Promise} returns the siblingInformation object
310
327
  */
311
328
  async function computeSiblingInformation(
@@ -516,8 +533,9 @@ async function createDraftFromActiveDocument(
516
533
  } catch (oResponse: any) {
517
534
  //Only call back if error 409
518
535
  if (bRunPreserveChangesFlow && oResponse.status === 409) {
536
+ messageHandling.removeBoundTransitionMessages();
537
+ messageHandling.removeUnboundTransitionMessages();
519
538
  if (ActivitySync.isCollaborationEnabled(mParameters.oView)) {
520
- messageHandling.removeUnboundTransitionMessages();
521
539
  const siblingInfo = await draft.computeSiblingInformation(oContext, oContext);
522
540
  const siblingContext = (mParameters.oView.getController() as any)._routing._createBindingContext(
523
541
  siblingInfo?.targetContext.getPath(),
@@ -531,7 +549,9 @@ async function createDraftFromActiveDocument(
531
549
  );
532
550
  }
533
551
  } else {
534
- throw new Error(oResponse);
552
+ if (!(oResponse && oResponse.canceled)) {
553
+ throw new Error(oResponse);
554
+ }
535
555
  }
536
556
  }
537
557
  if (openingSiblingContext) {
@@ -630,11 +650,12 @@ function activateDocument(
630
650
  * @memberof sap.fe.core.actions.draft
631
651
  * @static
632
652
  * @param {sap.ui.model.odata.v4.Context} oContext Context of the document to be discarded
653
+ * @param {boolean} bEnableStrictHandling
633
654
  * @private
634
655
  * @returns {Promise}
635
656
  * @ui5-restricted
636
657
  */
637
- function deleteDraft(oContext: any): Promise<boolean> {
658
+ function deleteDraft(oContext: any, bEnableStrictHandling?: boolean): Promise<boolean> {
638
659
  const sDiscardAction = getActionName(oContext, draftOperations.DISCARD),
639
660
  bIsActiveEntity = oContext.getObject().IsActiveEntity;
640
661
 
@@ -655,15 +676,151 @@ function deleteDraft(oContext: any): Promise<boolean> {
655
676
  }
656
677
  } else {
657
678
  //Use Discard Post Action if it is a draft entity and discard action exists
658
- return executeDraftDiscardAction(oContext);
679
+ return executeDraftDiscardAction(oContext, bEnableStrictHandling);
680
+ }
681
+ }
682
+
683
+ /**
684
+ * @param fnProcessFunction
685
+ * @param fnCancelFunction
686
+ * @param oContext
687
+ * @param oController
688
+ * @param bSkipBindingToView
689
+ * @param navigationType
690
+ */
691
+ function processDataLossOrDraftDiscardConfirmation(
692
+ fnProcessFunction: any,
693
+ fnCancelFunction: any,
694
+ oContext: any,
695
+ oController: any,
696
+ bSkipBindingToView?: boolean,
697
+ navigationType: NavigationType = NavigationType.BackNavigation
698
+ ) {
699
+ const oModel = oContext.getModel();
700
+ const draftDataContext = oModel.bindContext(oContext.getPath() + "/DraftAdministrativeData").getBoundContext();
701
+
702
+ const collaborationConnected = ActivitySync.isConnected(oController.getView());
703
+ const processFunctionForDrafts = !collaborationConnected
704
+ ? fnProcessFunction
705
+ : function (...args: any[]) {
706
+ ActivitySync.disconnect(oController.getView());
707
+ fnProcessFunction.apply(null, ...args);
708
+ };
709
+
710
+ if (
711
+ oContext &&
712
+ oContext.getObject() &&
713
+ (!oContext.getObject().DraftAdministrativeData || oContext.getObject().IsActiveEntity === true)
714
+ ) {
715
+ fnProcessFunction();
716
+ } else {
717
+ draftDataContext
718
+ .requestObject()
719
+ .then(function (draftAdminData: any) {
720
+ if (draftAdminData) {
721
+ if (oController.getAppComponent().getRootViewController().isFclEnabled()) {
722
+ // The application is running in FCL mode so in this case we fall back to
723
+ // the old logic since the dirty state handling is not properly working
724
+ // for FCL.
725
+ if (!(draftAdminData.CreationDateTime === draftAdminData.LastChangeDateTime)) {
726
+ DataLossOrDraftDiscardHandler.performAfterDiscardorKeepDraft(
727
+ processFunctionForDrafts,
728
+ fnCancelFunction,
729
+ oController,
730
+ bSkipBindingToView
731
+ );
732
+ } else {
733
+ processFunctionForDrafts();
734
+ }
735
+ } else {
736
+ if (!oContext.getObject().HasActiveEntity) {
737
+ // There is no active entity so we are editing either newly created data or
738
+ // a draft which has never been saved to active version
739
+ // Since we want to react differently in the two situations, we have to check the
740
+ // dirty state
741
+ if (EditState.isEditStateDirty()) {
742
+ // In this case data is being newly created and then we always want to
743
+ // show the dataloss dialog on navigation
744
+ DataLossOrDraftDiscardHandler.performAfterDiscardorKeepDraft(
745
+ processFunctionForDrafts,
746
+ fnCancelFunction,
747
+ oController,
748
+ bSkipBindingToView
749
+ );
750
+ } else {
751
+ // We are editing a draft which has been created earlier but never saved to active
752
+ // version and since the edit state is not dirty, there have been no user changes
753
+ // so in this case we want to silently navigate and do nothing
754
+ processFunctionForDrafts();
755
+ }
756
+ } else {
757
+ // We are editing a draft for an existing active entity
758
+ if (draftAdminData.CreationDateTime === draftAdminData.LastChangeDateTime) {
759
+ // The CreationDateTime and LastChangeDateTime are equal, so this draft was
760
+ // never saved before, hence we're currently editing a newly created draft for
761
+ // an existing active entity for the first time.
762
+ // Also there have so far been no changes made to the draft and in this
763
+ // case we want to silently navigate and delete the draft in case of a back
764
+ // navigation but in case of a forward navigation we want to silently keep it!
765
+ if (navigationType === NavigationType.BackNavigation) {
766
+ const mParameters = {
767
+ skipDiscardPopover: true
768
+ };
769
+ oController.editFlow
770
+ .cancelDocument(oContext, mParameters)
771
+ .then(() => {
772
+ processFunctionForDrafts();
773
+ })
774
+ .catch((error: any) => {
775
+ Log.error("Error while canceling the document", error);
776
+ });
777
+ } else {
778
+ // In case of a forward navigation we silently keep the draft and only
779
+ // execute the followup function.
780
+ processFunctionForDrafts();
781
+ }
782
+ } else {
783
+ // The CreationDateTime and LastChangeDateTime are NOT equal, so we are currently editing
784
+ // an existing draft and need to distinguish depending on if any changes
785
+ // have been made in the current editing session or not
786
+ if (EditState.isEditStateDirty()) {
787
+ // Changes have been made in the current editing session so we want
788
+ // to show the dataloss dialog and let the user decide
789
+ DataLossOrDraftDiscardHandler.performAfterDiscardorKeepDraft(
790
+ processFunctionForDrafts,
791
+ fnCancelFunction,
792
+ oController,
793
+ bSkipBindingToView
794
+ );
795
+ } else {
796
+ // The user started editing the existing draft but did not make any changes
797
+ // in the current editing session, so in this case we do not want
798
+ // to show the dataloss dialog but just keep the draft
799
+ processFunctionForDrafts();
800
+ }
801
+ }
802
+ }
803
+ }
804
+ } else {
805
+ fnProcessFunction();
806
+ }
807
+ })
808
+ .catch(function (oError: any) {
809
+ Log.error("Cannot retrieve draftDataContext information", oError);
810
+ });
659
811
  }
660
812
  }
813
+
661
814
  const draft = {
662
815
  createDraftFromActiveDocument: createDraftFromActiveDocument,
663
816
  activateDocument: activateDocument,
664
817
  deleteDraft: deleteDraft,
665
818
  executeDraftEditAction: executeDraftEditAction,
666
- computeSiblingInformation: computeSiblingInformation
819
+ computeSiblingInformation: computeSiblingInformation,
820
+ processDataLossOrDraftDiscardConfirmation: processDataLossOrDraftDiscardConfirmation,
821
+ createOperation: createOperation,
822
+ executeDraftDiscardAction: executeDraftDiscardAction,
823
+ NavigationType: NavigationType
667
824
  };
668
825
 
669
826
  export default draft;