@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,10 @@
1
1
  import Log from "sap/base/Log";
2
2
  import FlexibleColumnLayout from "sap/f/FlexibleColumnLayout";
3
- import { send } from "sap/fe/core/actions/collaboration/ActivitySync";
4
- import { Activity } from "sap/fe/core/actions/collaboration/CollaborationCommon";
5
- import draft, { SiblingInformation } from "sap/fe/core/actions/draft";
6
- import BusyLocker from "sap/fe/core/BusyLocker";
7
3
  import CommonUtils from "sap/fe/core/CommonUtils";
4
+ import BusyLocker from "sap/fe/core/controllerextensions/BusyLocker";
5
+ import { send } from "sap/fe/core/controllerextensions/collaboration/ActivitySync";
6
+ import { Activity } from "sap/fe/core/controllerextensions/collaboration/CollaborationCommon";
7
+ import draft, { SiblingInformation } from "sap/fe/core/controllerextensions/editFlow/draft";
8
8
  import { defineUI5Class, extensible, finalExtension, publicExtension } from "sap/fe/core/helpers/ClassSupport";
9
9
  import EditState from "sap/fe/core/helpers/EditState";
10
10
  import ModelHelper, { InternalModelContext } from "sap/fe/core/helpers/ModelHelper";
@@ -69,29 +69,25 @@ class EditFlow extends ControllerExtension {
69
69
  async editDocument(oContext: Context): Promise<void> {
70
70
  const bDraftNavigation = true;
71
71
  const transactionHelper = this._getTransactionHelper();
72
-
72
+ const oRootViewController = this._getRootViewController() as any;
73
+ let rightmostContext;
73
74
  try {
74
75
  await this.base.editFlow.onBeforeEdit({ context: oContext });
75
76
  const oNewDocumentContext = await transactionHelper.editDocument(oContext, this.getView(), this._getMessageHandler());
76
77
 
77
78
  const sProgrammingModel = this._getProgrammingModel(oContext);
78
79
 
79
- if (sProgrammingModel === ProgrammingModel.Sticky) {
80
- this._getInternalModel().setProperty("/sessionOn", true);
81
- }
80
+ this._setStickySessionInternalProperties(sProgrammingModel, oContext.getModel() as ODataModel);
81
+
82
82
  if (oNewDocumentContext) {
83
83
  this._setEditMode(EditMode.Editable, false);
84
84
  this._getMessageHandler().showMessageDialog();
85
85
 
86
86
  if (oNewDocumentContext !== oContext) {
87
87
  let contextToNavigate = oNewDocumentContext;
88
- const oRootViewController = this._getRootViewController() as any;
89
- if (oRootViewController.isFclEnabled()) {
90
- let siblingInfo = await this._computeSiblingInformation(
91
- oContext,
92
- oRootViewController.getRightmostContext(),
93
- sProgrammingModel
94
- );
88
+ if (this._isFclEnabled()) {
89
+ rightmostContext = oRootViewController.getRightmostContext();
90
+ let siblingInfo = await this._computeSiblingInformation(oContext, rightmostContext, sProgrammingModel, true);
95
91
  siblingInfo = siblingInfo ?? this._createSiblingInfo(oContext, oNewDocumentContext);
96
92
  this._updatePathsInHistory(siblingInfo.pathMapping);
97
93
  if (siblingInfo.targetContext.getPath() != oNewDocumentContext.getPath()) {
@@ -137,7 +133,7 @@ class EditFlow extends ControllerExtension {
137
133
  */
138
134
  @publicExtension()
139
135
  @finalExtension()
140
- updateDocument(oContext: object, oPromise: Promise<any>): Promise<void> {
136
+ updateDocument(oContext: object, oPromise: Promise<any>): Promise<void> | undefined {
141
137
  const transactionHelper = this._getTransactionHelper();
142
138
  const originalBindingContext = this.getView().getBindingContext();
143
139
  const bIsDraft = this._getProgrammingModel(oContext) === ProgrammingModel.Draft;
@@ -146,7 +142,9 @@ class EditFlow extends ControllerExtension {
146
142
  return this._syncTask(() => {
147
143
  if (originalBindingContext) {
148
144
  transactionHelper.handleDocumentModifications();
149
- EditState.setEditStateDirty();
145
+ if (!this._isFclEnabled()) {
146
+ EditState.setEditStateDirty();
147
+ }
150
148
 
151
149
  if (bIsDraft) {
152
150
  this._setDraftStatus(DraftStatus.Saving);
@@ -168,8 +166,8 @@ class EditFlow extends ControllerExtension {
168
166
  const oCurrentSemanticMapping = this._getSemanticMapping(),
169
167
  sCurrentSemanticPath = oCurrentSemanticMapping && oCurrentSemanticMapping.semanticPath,
170
168
  sChangedPath = SemanticKeyHelper.getSemanticPath(oBindingContext, true);
171
-
172
- if (sCurrentSemanticPath !== sChangedPath) {
169
+ // sCurrentSemanticPath could be null if we have navigated via deep link then there are no semanticMappings to calculate it from
170
+ if (sCurrentSemanticPath && sCurrentSemanticPath !== sChangedPath) {
173
171
  return this._handleNewContext(oBindingContext, true, false, true).then(() => {
174
172
  this._setDraftStatus(DraftStatus.Saved);
175
173
  });
@@ -234,8 +232,7 @@ class EditFlow extends ControllerExtension {
234
232
  ): Promise<void> {
235
233
  const transactionHelper = this._getTransactionHelper(),
236
234
  oLockObject = this._getGlobalUIModel();
237
- let oTable: Table;
238
- let iCountTableItems = 0;
235
+ let oTable: any; //should be Table but there are missing methods into the def
239
236
  let mParameters: any = mInParameters;
240
237
  const oResourceBundle = this._getResourceBundle();
241
238
  const bShouldBusyLock =
@@ -410,7 +407,6 @@ class EditFlow extends ControllerExtension {
410
407
  }
411
408
 
412
409
  const oModel = oListBinding.getModel();
413
- iCountTableItems = oListBinding.iMaxLength || 0;
414
410
  const sCreationMode = mParameters.creationMode;
415
411
 
416
412
  return Promise.resolve(this._getProgrammingModel(oListBinding))
@@ -582,14 +578,13 @@ class EditFlow extends ControllerExtension {
582
578
  break;
583
579
  }
584
580
 
585
- if (sProgrammingModel === ProgrammingModel.Sticky) {
586
- this._getInternalModel().setProperty("/sessionOn", true);
587
- }
588
581
  const bIsNewPageCreation =
589
582
  mParameters.creationMode !== CreationMode.CreationRow && mParameters.creationMode !== CreationMode.Inline;
590
583
  if (oCreation) {
591
584
  return Promise.all([oCreation, oNavigation])
592
585
  .then((aParams: [any, any]) => {
586
+ this._setStickySessionInternalProperties(sProgrammingModel, oModel);
587
+
593
588
  if (bIsNewPageCreation) {
594
589
  this._setEditMode(EditMode.Editable, bIsNewPageCreation);
595
590
  } else {
@@ -597,7 +592,9 @@ class EditFlow extends ControllerExtension {
597
592
  }
598
593
  const oNewDocumentContext = aParams[0];
599
594
  if (oNewDocumentContext) {
600
- EditState.setEditStateDirty();
595
+ if (!this._isFclEnabled()) {
596
+ EditState.setEditStateDirty();
597
+ }
601
598
  this._sendActivity(Activity.Create, oNewDocumentContext);
602
599
  if (sProgrammingModel === ProgrammingModel.Sticky) {
603
600
  this._handleStickyOn(oNewDocumentContext);
@@ -605,7 +602,13 @@ class EditFlow extends ControllerExtension {
605
602
  }
606
603
  })
607
604
  .catch(function (oError: any) {
608
- if (oError && (oError.navigateBackFromTransientState || oError == Constants.CancelActionDialog)) {
605
+ if (
606
+ oError &&
607
+ (oError.navigateBackFromTransientState ||
608
+ oError == Constants.CancelActionDialog ||
609
+ oError.canceled ||
610
+ (oError.rejectedItems && oError.rejectedItems[0].canceled))
611
+ ) {
609
612
  oRoutingListener.navigateBackFromTransientState();
610
613
  }
611
614
 
@@ -619,18 +622,7 @@ class EditFlow extends ControllerExtension {
619
622
  const fnFocusOrScroll =
620
623
  mParameters.creationMode === CreationMode.Inline ? oTable.focusRow.bind(oTable) : oTable.scrollToIndex.bind(oTable);
621
624
  oTable.getRowBinding().attachEventOnce("change", function () {
622
- switch (mParameters.createAtEnd) {
623
- case true:
624
- if (oTable.data("tableType") === "ResponsiveTable" && oTable.getThreshold()) {
625
- fnFocusOrScroll(oTable.getThreshold(), true);
626
- } else {
627
- fnFocusOrScroll(iCountTableItems, true);
628
- }
629
- break;
630
- case false:
631
- fnFocusOrScroll(0, true);
632
- break;
633
- }
625
+ fnFocusOrScroll(mParameters.createAtEnd ? oTable.getRowBinding().getLength() : 0, true);
634
626
  });
635
627
  }
636
628
  bShouldBusyLock && BusyLocker.unlock(oLockObject);
@@ -790,7 +782,12 @@ class EditFlow extends ControllerExtension {
790
782
  oRootViewController.isFclEnabled()
791
783
  ) {
792
784
  // No need to try to get rightmost context in case of a new object
793
- siblingInfo = await this._computeSiblingInformation(oContext, oRootViewController.getRightmostContext(), sProgrammingModel);
785
+ siblingInfo = await this._computeSiblingInformation(
786
+ oContext,
787
+ oRootViewController.getRightmostContext(),
788
+ sProgrammingModel,
789
+ true
790
+ );
794
791
  }
795
792
 
796
793
  const activeDocumentContext = await transactionHelper.saveDocument(
@@ -802,10 +799,7 @@ class EditFlow extends ControllerExtension {
802
799
  );
803
800
 
804
801
  this._removeContextsFromPages();
805
- if (sProgrammingModel === ProgrammingModel.Sticky) {
806
- this._getInternalModel().setProperty("/sessionOn", false);
807
- this._handleStickyOff(/*oContext*/);
808
- }
802
+ this._removeStickySessionInternalProperties(sProgrammingModel);
809
803
 
810
804
  this._sendActivity(Activity.Activate, activeDocumentContext);
811
805
  this._triggerConfiguredSurvey(standardActions.save, triggerType.standardAction);
@@ -825,8 +819,10 @@ class EditFlow extends ControllerExtension {
825
819
 
826
820
  await this._handleNewContext(contextToNavigate, false, false, bDraftNavigation, true);
827
821
  }
828
- } catch (oError) {
829
- Log.error("Error while saving the document", oError as any);
822
+ } catch (oError: any) {
823
+ if (!(oError && oError.canceled)) {
824
+ Log.error("Error while saving the document", oError);
825
+ }
830
826
  return Promise.reject(oError);
831
827
  }
832
828
  }
@@ -859,7 +855,7 @@ class EditFlow extends ControllerExtension {
859
855
  try {
860
856
  const oRootViewController = this._getRootViewController() as any;
861
857
  const oRightmostContext = oRootViewController.isFclEnabled() ? oRootViewController.getRightmostContext() : oContext;
862
- const siblingInfo = await this._computeSiblingInformation(oContext, oRightmostContext, ProgrammingModel.Draft);
858
+ const siblingInfo = await this._computeSiblingInformation(oContext, oRightmostContext, ProgrammingModel.Draft, false);
863
859
  if (siblingInfo) {
864
860
  this._setEditMode(bEditable ? EditMode.Editable : EditMode.Display, false); //switch to edit mode only if a draft is available
865
861
 
@@ -912,13 +908,16 @@ class EditFlow extends ControllerExtension {
912
908
  try {
913
909
  await this._syncTask();
914
910
  const sProgrammingModel = this._getProgrammingModel(oContext);
915
- const oRootViewController = this._getRootViewController() as any;
916
- if (
917
- (sProgrammingModel === ProgrammingModel.Sticky || oContext.getProperty("HasActiveEntity")) &&
918
- oRootViewController.isFclEnabled()
919
- ) {
911
+ if ((sProgrammingModel === ProgrammingModel.Sticky || oContext.getProperty("HasActiveEntity")) && this._isFclEnabled()) {
912
+ const oRootViewController = this._getRootViewController() as any;
913
+
920
914
  // No need to try to get rightmost context in case of a new object
921
- siblingInfo = await this._computeSiblingInformation(oContext, oRootViewController.getRightmostContext(), sProgrammingModel);
915
+ siblingInfo = await this._computeSiblingInformation(
916
+ oContext,
917
+ oRootViewController.getRightmostContext(),
918
+ sProgrammingModel,
919
+ true
920
+ );
922
921
  }
923
922
 
924
923
  const oActiveDocumentContext = await transactionHelper.cancelDocument(
@@ -930,25 +929,24 @@ class EditFlow extends ControllerExtension {
930
929
  const bDraftNavigation = true;
931
930
 
932
931
  this._removeContextsFromPages();
933
- if (sProgrammingModel === ProgrammingModel.Sticky) {
934
- this._getInternalModel().setProperty("/sessionOn", false);
935
- this._handleStickyOff(/*oContext*/);
936
- }
937
-
938
- this._sendActivity(Activity.Discard, oActiveDocumentContext);
932
+ this._removeStickySessionInternalProperties(sProgrammingModel);
939
933
 
940
934
  this._setEditMode(EditMode.Display, false);
941
935
  this._setDraftStatus(DraftStatus.Clear);
936
+ // we force the edit state even for FCL because the draft discard might not be implemented
937
+ // and we may just delete the draft
938
+ EditState.setEditStateDirty();
942
939
 
943
940
  if (!oActiveDocumentContext) {
941
+ this._sendActivity(Activity.Discard, undefined);
944
942
  //in case of a new document, no activeContext is returned --> navigate back.
945
- EditState.setEditStateDirty();
946
943
  if (!mInParameters.skipBackNavigation) {
947
944
  await this._getRoutingListener().navigateBackFromContext(oContext);
948
945
  }
949
946
  } else {
947
+ this._sendActivity(Activity.Discard, oActiveDocumentContext);
950
948
  let contextToNavigate = oActiveDocumentContext;
951
- if (oRootViewController.isFclEnabled()) {
949
+ if (this._isFclEnabled()) {
952
950
  siblingInfo = siblingInfo ?? this._createSiblingInfo(oContext, oActiveDocumentContext);
953
951
  this._updatePathsInHistory(siblingInfo.pathMapping);
954
952
  if (siblingInfo.targetContext.getPath() !== oActiveDocumentContext.getPath()) {
@@ -998,7 +996,6 @@ class EditFlow extends ControllerExtension {
998
996
  @finalExtension()
999
997
  deleteDocument(oContext: Context, mInParameters: { title: string; description: string }): Promise<void> {
1000
998
  const oAppComponent = CommonUtils.getAppComponent(this.getView());
1001
- const sPath = oContext.getPath();
1002
999
  let mParameters: any = mInParameters;
1003
1000
  if (!mParameters) {
1004
1001
  mParameters = {
@@ -1012,9 +1009,10 @@ class EditFlow extends ControllerExtension {
1012
1009
  .then(() => {
1013
1010
  // Single objet deletion is triggered from an OP header button (not from a list)
1014
1011
  // --> Mark UI dirty and navigate back to dismiss the OP
1015
- EditState.setEditStateDirty();
1016
-
1017
- this._sendActivity(Activity.Delete, sPath);
1012
+ if (!this._isFclEnabled()) {
1013
+ EditState.setEditStateDirty();
1014
+ }
1015
+ this._sendActivity(Activity.Delete, oContext);
1018
1016
 
1019
1017
  this._getRoutingListener().navigateBackFromContext(oContext);
1020
1018
  // After delete is successfull, we need to dettch the setBackNavigation Methods
@@ -1039,23 +1037,21 @@ class EditFlow extends ControllerExtension {
1039
1037
  */
1040
1038
  @publicExtension()
1041
1039
  @finalExtension()
1042
- applyDocument(oContext: object): Promise<void> {
1040
+ async applyDocument(oContext: object): Promise<void> {
1043
1041
  const oLockObject = this._getGlobalUIModel();
1044
1042
  BusyLocker.lock(oLockObject);
1045
- return (
1046
- this._submitOpenChanges(oContext)
1047
- // check if there are any validation/parse errors
1048
- .then(this._checkForValidationErrors.bind(this, oContext))
1049
- .then(() => {
1050
- this._getMessageHandler().showMessageDialog();
1051
- this._getRoutingListener().navigateBackFromContext(oContext);
1052
- })
1053
- .finally(function () {
1054
- if (BusyLocker.isLocked(oLockObject)) {
1055
- BusyLocker.unlock(oLockObject);
1056
- }
1057
- })
1058
- );
1043
+
1044
+ try {
1045
+ await this._syncTask();
1046
+ await this._submitOpenChanges(oContext);
1047
+ await this._checkForValidationErrors();
1048
+ await this._getMessageHandler().showMessageDialog();
1049
+ await this._getRoutingListener().navigateBackFromContext(oContext);
1050
+ } finally {
1051
+ if (BusyLocker.isLocked(oLockObject)) {
1052
+ BusyLocker.unlock(oLockObject);
1053
+ }
1054
+ }
1059
1055
  }
1060
1056
 
1061
1057
  // Internal only params ---
@@ -1231,7 +1227,9 @@ class EditFlow extends ControllerExtension {
1231
1227
  first one as they are anyway siblings
1232
1228
  */
1233
1229
  if (mParameters.contexts) {
1234
- EditState.setEditStateDirty();
1230
+ if (!this._isFclEnabled()) {
1231
+ EditState.setEditStateDirty();
1232
+ }
1235
1233
  this._getInternalModel().setProperty("/sCustomAction", sActionName);
1236
1234
  }
1237
1235
  if (mParameters.isNavigable) {
@@ -1263,7 +1261,9 @@ class EditFlow extends ControllerExtension {
1263
1261
  if (err == Constants.CancelActionDialog) {
1264
1262
  return Promise.reject("Dialog cancelled.");
1265
1263
  } else {
1266
- return Promise.reject("Error in EditFlow.invokeAction:" + err);
1264
+ if (!(err && (err.canceled || (err.rejectedItems && err.rejectedItems[0].canceled)))) {
1265
+ return Promise.reject("Error in EditFlow.invokeAction:" + err);
1266
+ }
1267
1267
  }
1268
1268
  });
1269
1269
  }
@@ -1321,7 +1321,9 @@ class EditFlow extends ControllerExtension {
1321
1321
  .then(() => {
1322
1322
  if (bUpdatesDocument) {
1323
1323
  this._getTransactionHelper().handleDocumentModifications();
1324
- EditState.setEditStateDirty();
1324
+ if (!this._isFclEnabled()) {
1325
+ EditState.setEditStateDirty();
1326
+ }
1325
1327
  if (bIsDraft) {
1326
1328
  this._setDraftStatus(DraftStatus.Saved);
1327
1329
  }
@@ -1348,18 +1350,41 @@ class EditFlow extends ControllerExtension {
1348
1350
  */
1349
1351
  @publicExtension()
1350
1352
  handlePatchSent(oEvent: any) {
1351
- // Create a promise that will be resolved or rejected when the path is completed
1352
- const oPatchPromise = new Promise<void>((resolve, reject) => {
1353
- oEvent.getSource().attachEventOnce("patchCompleted", (oEvent: any) => {
1354
- const bSuccess = oEvent.getParameter("success");
1355
- if (bSuccess) {
1356
- resolve();
1357
- } else {
1358
- reject();
1359
- }
1353
+ if (!(this.base.getView()?.getBindingContext("internal") as InternalModelContext)?.getProperty("skipPatchHandlers")) {
1354
+ // Create a promise that will be resolved or rejected when the path is completed
1355
+ const oPatchPromise = new Promise<void>((resolve, reject) => {
1356
+ oEvent.getSource().attachEventOnce("patchCompleted", (oEvent: any) => {
1357
+ const bSuccess = oEvent.getParameter("success");
1358
+ if (bSuccess) {
1359
+ resolve();
1360
+ } else {
1361
+ reject();
1362
+ }
1363
+ });
1360
1364
  });
1361
- });
1362
- this.updateDocument(oEvent.getSource(), oPatchPromise);
1365
+ this.updateDocument(oEvent.getSource(), oPatchPromise);
1366
+ }
1367
+ }
1368
+
1369
+ /**
1370
+ * Handles the CreateActivate event.
1371
+ *
1372
+ * @param oEvent
1373
+ */
1374
+ handleCreateActivate(oEvent: any) {
1375
+ const oBinding = oEvent.getSource();
1376
+ const transactionHelper = this._getTransactionHelper();
1377
+ const bAtEnd = true;
1378
+ const bInactive = true;
1379
+ const oResourceBundle = this._getResourceBundle();
1380
+ const oParams: any = {
1381
+ creationMode: CreationMode.Inline,
1382
+ createAtEnd: bAtEnd,
1383
+ inactive: bInactive,
1384
+ keepTransientContextOnFailed: false, // currently not fully supported
1385
+ busyMode: "None"
1386
+ };
1387
+ transactionHelper.createDocument(oBinding, oParams, oResourceBundle, this._getMessageHandler(), false, this.getView());
1363
1388
  }
1364
1389
 
1365
1390
  //////////////////////////////////////
@@ -1450,7 +1475,8 @@ class EditFlow extends ControllerExtension {
1450
1475
  return (this.base.getView().getController() as PageController)._editFlow.getMessageHandler();
1451
1476
  }
1452
1477
 
1453
- _sendActivity(action: Activity, content: string | string[] | Context | Context[] | undefined) {
1478
+ _sendActivity(action: Activity, relatedContexts: Context | Context[] | undefined) {
1479
+ const content = Array.isArray(relatedContexts) ? relatedContexts.map((context) => context.getPath()) : relatedContexts?.getPath();
1454
1480
  send(this.getView(), action, content);
1455
1481
  }
1456
1482
 
@@ -1470,23 +1496,29 @@ class EditFlow extends ControllerExtension {
1470
1496
  return (this.base.getView().getController() as PageController)._editFlow.getActionResponseDataAndKeys(sActionName, oResponse);
1471
1497
  }
1472
1498
 
1473
- _submitOpenChanges(oContext: any): Promise<any> {
1499
+ async _submitOpenChanges(oContext: any): Promise<any> {
1474
1500
  const oModel = oContext.getModel(),
1475
1501
  oLockObject = this._getGlobalUIModel();
1476
- //Currently we are using only 1 updateGroupId, hence submitting the batch directly here
1477
- return oModel
1478
- .submitBatch("$auto")
1479
- .then(function () {
1480
- if (oModel.hasPendingChanges("$auto")) {
1481
- // the submit was not successful
1482
- return Promise.reject("submit of open changes failed");
1483
- }
1484
- })
1485
- .finally(function () {
1486
- if (BusyLocker.isLocked(oLockObject)) {
1487
- BusyLocker.unlock(oLockObject);
1488
- }
1489
- });
1502
+
1503
+ try {
1504
+ // Submit any leftover changes that are not yet submitted
1505
+ // Currently we are using only 1 updateGroupId, hence submitting the batch directly here
1506
+ await oModel.submitBatch("$auto");
1507
+
1508
+ // Wait for all currently running changes
1509
+ // For the time being we agreed with the v4 model team to use an internal method. We'll replace it once
1510
+ // a public or restricted method was provided
1511
+ await oModel.oRequestor.waitForRunningChangeRequests("$auto");
1512
+
1513
+ // Check if all changes were submitted successfully
1514
+ if (oModel.hasPendingChanges("$auto")) {
1515
+ throw new Error("submit of open changes failed");
1516
+ }
1517
+ } finally {
1518
+ if (BusyLocker.isLocked(oLockObject)) {
1519
+ BusyLocker.unlock(oLockObject);
1520
+ }
1521
+ }
1490
1522
  }
1491
1523
 
1492
1524
  _handleStickyOn(oContext: Context) {
@@ -1505,6 +1537,23 @@ class EditFlow extends ControllerExtension {
1505
1537
  return (this.base.getView().getController() as PageController)._editFlow.discardStickySession(oContext);
1506
1538
  }
1507
1539
 
1540
+ _setStickySessionInternalProperties(programmingModel: any, model: ODataModel) {
1541
+ if (programmingModel === ProgrammingModel.Sticky) {
1542
+ const internalModel = this._getInternalModel();
1543
+ internalModel.setProperty("/sessionOn", true);
1544
+ internalModel.setProperty("/stickySessionToken", (model.getHttpHeaders(true) as any)["SAP-ContextId"]);
1545
+ }
1546
+ }
1547
+
1548
+ _removeStickySessionInternalProperties(programmingModel: any) {
1549
+ if (programmingModel === ProgrammingModel.Sticky) {
1550
+ const internalModel = this._getInternalModel();
1551
+ internalModel.setProperty("/sessionOn", false);
1552
+ internalModel.setProperty("/stickySessionToken", undefined);
1553
+ this._handleStickyOff(/*oContext*/);
1554
+ }
1555
+ }
1556
+
1508
1557
  async _handleNewContext(
1509
1558
  oContext: any,
1510
1559
  bEditable: boolean,
@@ -1513,7 +1562,9 @@ class EditFlow extends ControllerExtension {
1513
1562
  bForceFocus?: boolean,
1514
1563
  bNavigateToSiblingEntity?: boolean
1515
1564
  ) {
1516
- EditState.setEditStateDirty();
1565
+ if (!this._isFclEnabled()) {
1566
+ EditState.setEditStateDirty();
1567
+ }
1517
1568
 
1518
1569
  await this._getRoutingListener().navigateToContext(oContext, {
1519
1570
  checkNoHashChange: true,
@@ -1650,7 +1701,7 @@ class EditFlow extends ControllerExtension {
1650
1701
  let aPages: any[] = [];
1651
1702
  const oAppComponent = CommonUtils.getAppComponent(this.getView());
1652
1703
 
1653
- if (oAppComponent._isFclEnabled()) {
1704
+ if (this._isFclEnabled()) {
1654
1705
  const oFCL = oAppComponent.getRootContainer() as FlexibleColumnLayout;
1655
1706
  aPages = aPages.concat(oFCL.getMidColumnPages() || []);
1656
1707
  aPages = aPages.concat(oFCL.getEndColumnPages() || []);
@@ -1701,6 +1752,9 @@ class EditFlow extends ControllerExtension {
1701
1752
  if (oActionBindingContext) {
1702
1753
  throw "context found - stop SubSections loop";
1703
1754
  }
1755
+ if (oSubSection.getBindingContext() === null) {
1756
+ oSubSection.setBindingContext(undefined);
1757
+ }
1704
1758
  const aActions = oSubSection.getAggregation("actions");
1705
1759
  oActionBindingContext = _checkActions(aActions);
1706
1760
  });
@@ -1762,18 +1816,23 @@ class EditFlow extends ControllerExtension {
1762
1816
  * @param {object} rootCurrentContext The context for the root of the draft
1763
1817
  * @param {object} rightmostCurrentContext The context of the sub-object
1764
1818
  * @param {string} sProgrammingModel The programming model
1765
- * @returns {Promise} returns the siblingInformation object
1819
+ * @param {boolean} doNotComputeIfRoot If true, we don't compute siblingInfo if the root and the rightmost contexts are the same
1820
+ * @returns {Promise} Returns the siblingInformation object
1766
1821
  */
1767
1822
  async _computeSiblingInformation(
1768
1823
  rootCurrentContext: Context,
1769
1824
  rightmostCurrentContext: Context,
1770
- sProgrammingModel: string
1825
+ sProgrammingModel: string,
1826
+ doNotComputeIfRoot: boolean
1771
1827
  ): Promise<SiblingInformation | undefined> {
1772
1828
  if (!rightmostCurrentContext.getPath().startsWith(rootCurrentContext.getPath())) {
1773
1829
  // Wrong usage !!
1774
1830
  Log.error("Cannot compute rightmost sibling context");
1775
1831
  throw new Error("Cannot compute rightmost sibling context");
1776
1832
  }
1833
+ if (doNotComputeIfRoot && rightmostCurrentContext.getPath() === rootCurrentContext.getPath()) {
1834
+ return Promise.resolve(undefined);
1835
+ }
1777
1836
 
1778
1837
  const model = rootCurrentContext.getModel();
1779
1838
  if (sProgrammingModel === ProgrammingModel.Draft) {
@@ -1787,6 +1846,9 @@ class EditFlow extends ControllerExtension {
1787
1846
  };
1788
1847
  }
1789
1848
  }
1849
+ _isFclEnabled(): boolean {
1850
+ return CommonUtils.getAppComponent(this.getView())._isFclEnabled();
1851
+ }
1790
1852
  }
1791
1853
 
1792
1854
  export default EditFlow;