@sapui5/sap.fe.core 1.96.4 → 1.99.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 (253) hide show
  1. package/package.json +6 -5
  2. package/src/sap/fe/core/.library +1 -1
  3. package/src/sap/fe/core/AnnotationHelper.js +377 -405
  4. package/src/sap/fe/core/AnnotationHelper.ts +385 -0
  5. package/src/sap/fe/core/AppComponent.js +5 -3
  6. package/src/sap/fe/core/AppStateHandler.js +229 -195
  7. package/src/sap/fe/core/AppStateHandler.ts +171 -0
  8. package/src/sap/fe/core/BaseController.js +3 -2
  9. package/src/sap/fe/core/BusyLocker.js +105 -121
  10. package/src/sap/fe/core/BusyLocker.ts +98 -0
  11. package/src/sap/fe/core/CommonUtils.js +2073 -2606
  12. package/src/sap/fe/core/CommonUtils.ts +2078 -0
  13. package/src/sap/fe/core/ExtensionAPI.js +16 -7
  14. package/src/sap/fe/core/PageController.js +84 -119
  15. package/src/sap/fe/core/PageController.ts +101 -0
  16. package/src/sap/fe/core/RouterProxy.js +986 -809
  17. package/src/sap/fe/core/RouterProxy.ts +838 -0
  18. package/src/sap/fe/core/Synchronization.js +51 -35
  19. package/src/sap/fe/core/Synchronization.ts +29 -0
  20. package/src/sap/fe/core/TemplateComponent.js +173 -155
  21. package/src/sap/fe/core/TemplateComponent.ts +166 -0
  22. package/src/sap/fe/core/TemplateModel.js +97 -54
  23. package/src/sap/fe/core/TemplateModel.ts +63 -0
  24. package/src/sap/fe/core/TransactionHelper.js +1576 -1627
  25. package/src/sap/fe/core/TransactionHelper.ts +1706 -0
  26. package/src/sap/fe/core/actions/draft.js +559 -581
  27. package/src/sap/fe/core/actions/draft.ts +593 -0
  28. package/src/sap/fe/core/actions/messageHandling.js +545 -435
  29. package/src/sap/fe/core/actions/messageHandling.ts +532 -0
  30. package/src/sap/fe/core/actions/nonDraft.js +17 -19
  31. package/src/sap/fe/core/actions/nonDraft.ts +12 -0
  32. package/src/sap/fe/core/actions/operations.js +1074 -1192
  33. package/src/sap/fe/core/actions/operations.ts +1162 -0
  34. package/src/sap/fe/core/actions/sticky.js +102 -105
  35. package/src/sap/fe/core/actions/sticky.ts +102 -0
  36. package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.js +3 -2
  37. package/src/sap/fe/core/controllerextensions/EditFlow.js +235 -264
  38. package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +3 -2
  39. package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +288 -13
  40. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +35 -25
  41. package/src/sap/fe/core/controllerextensions/InternalRouting.js +79 -46
  42. package/src/sap/fe/core/controllerextensions/KPIManagement.js +86 -10
  43. package/src/sap/fe/core/controllerextensions/KPIManagement.ts +109 -31
  44. package/src/sap/fe/core/controllerextensions/MassEdit.js +172 -0
  45. package/src/sap/fe/core/controllerextensions/MessageHandler.js +237 -104
  46. package/src/sap/fe/core/controllerextensions/PageReady.js +3 -3
  47. package/src/sap/fe/core/controllerextensions/PageReady.ts +12 -8
  48. package/src/sap/fe/core/controllerextensions/Paginator.js +37 -9
  49. package/src/sap/fe/core/controllerextensions/Placeholder.js +8 -4
  50. package/src/sap/fe/core/controllerextensions/Routing.js +25 -5
  51. package/src/sap/fe/core/controllerextensions/RoutingListener.js +3 -2
  52. package/src/sap/fe/core/controllerextensions/Share.js +3 -2
  53. package/src/sap/fe/core/controllerextensions/SideEffects.js +9 -9
  54. package/src/sap/fe/core/controllerextensions/SideEffects.ts +22 -21
  55. package/src/sap/fe/core/controllerextensions/ViewState.js +36 -8
  56. package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +2 -1
  57. package/src/sap/fe/core/controls/CommandExecution.js +3 -2
  58. package/src/sap/fe/core/controls/ConditionalWrapper.js +3 -2
  59. package/src/sap/fe/core/controls/CustomQuickViewPage.js +112 -113
  60. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +9 -5
  61. package/src/sap/fe/core/controls/FieldWrapper.js +18 -23
  62. package/src/sap/fe/core/controls/FilterBar.js +3 -2
  63. package/src/sap/fe/core/controls/FormElementWrapper.js +3 -7
  64. package/src/sap/fe/core/controls/MultiValueParameterDelegate.js +3 -2
  65. package/src/sap/fe/core/controls/NonComputedVisibleKeyFieldsDialog.fragment.xml +2 -1
  66. package/src/sap/fe/core/controls/filterbar/FilterContainer.js +3 -2
  67. package/src/sap/fe/core/controls/filterbar/VisualFilter.js +5 -4
  68. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +3 -2
  69. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +3 -2
  70. package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +106 -0
  71. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +79 -0
  72. package/src/sap/fe/core/converters/ConverterContext.js +14 -2
  73. package/src/sap/fe/core/converters/ConverterContext.ts +14 -3
  74. package/src/sap/fe/core/converters/ManifestSettings.js +2 -1
  75. package/src/sap/fe/core/converters/ManifestSettings.ts +8 -1
  76. package/src/sap/fe/core/converters/ManifestWrapper.js +56 -32
  77. package/src/sap/fe/core/converters/ManifestWrapper.ts +24 -6
  78. package/src/sap/fe/core/converters/MetaModelConverter.js +76 -6
  79. package/src/sap/fe/core/converters/MetaModelConverter.ts +79 -15
  80. package/src/sap/fe/core/converters/TemplateConverter.js +1 -1
  81. package/src/sap/fe/core/converters/TemplateConverter.ts +2 -2
  82. package/src/sap/fe/core/converters/annotations/DataField.js +3 -3
  83. package/src/sap/fe/core/converters/annotations/DataField.ts +1 -1
  84. package/src/sap/fe/core/converters/common/AnnotationConverter.js +85 -46
  85. package/src/sap/fe/core/converters/controls/Common/Action.js +16 -4
  86. package/src/sap/fe/core/converters/controls/Common/Action.ts +14 -5
  87. package/src/sap/fe/core/converters/controls/Common/Chart.js +5 -3
  88. package/src/sap/fe/core/converters/controls/Common/Chart.ts +11 -3
  89. package/src/sap/fe/core/converters/controls/Common/DataVisualization.js +3 -3
  90. package/src/sap/fe/core/converters/controls/Common/DataVisualization.ts +2 -2
  91. package/src/sap/fe/core/converters/controls/Common/Form.js +60 -19
  92. package/src/sap/fe/core/converters/controls/Common/Form.ts +66 -14
  93. package/src/sap/fe/core/converters/controls/Common/KPI.js +69 -4
  94. package/src/sap/fe/core/converters/controls/Common/KPI.ts +72 -0
  95. package/src/sap/fe/core/converters/controls/Common/Table.js +503 -399
  96. package/src/sap/fe/core/converters/controls/Common/Table.ts +615 -480
  97. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +527 -0
  98. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +655 -0
  99. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +489 -37
  100. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +506 -58
  101. package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +2 -2
  102. package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +1 -1
  103. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +6 -6
  104. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +9 -15
  105. package/src/sap/fe/core/converters/helpers/Aggregation.js +18 -3
  106. package/src/sap/fe/core/converters/helpers/Aggregation.ts +28 -5
  107. package/src/sap/fe/core/converters/helpers/ID.js +9 -1
  108. package/src/sap/fe/core/converters/helpers/ID.ts +4 -0
  109. package/src/sap/fe/core/converters/helpers/IssueManager.js +7 -1
  110. package/src/sap/fe/core/converters/helpers/IssueManager.ts +6 -0
  111. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +4 -4
  112. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +3 -3
  113. package/src/sap/fe/core/converters/templates/ListReportConverter.js +29 -11
  114. package/src/sap/fe/core/converters/templates/ListReportConverter.ts +36 -20
  115. package/src/sap/fe/core/designtime/AppComponent.designtime.js +13 -3
  116. package/src/sap/fe/core/formatters/CriticalityFormatter.js +1 -1
  117. package/src/sap/fe/core/formatters/CriticalityFormatter.ts +1 -1
  118. package/src/sap/fe/core/formatters/FPMFormatter.js +1 -1
  119. package/src/sap/fe/core/formatters/FPMFormatter.ts +4 -10
  120. package/src/sap/fe/core/formatters/KPIFormatter.js +1 -1
  121. package/src/sap/fe/core/formatters/KPIFormatter.ts +3 -1
  122. package/src/sap/fe/core/formatters/TableFormatter.js +65 -31
  123. package/src/sap/fe/core/formatters/TableFormatter.ts +62 -30
  124. package/src/sap/fe/core/formatters/ValueFormatter.js +30 -5
  125. package/src/sap/fe/core/formatters/ValueFormatter.ts +30 -7
  126. package/src/sap/fe/core/fpm/Component.js +3 -2
  127. package/src/sap/fe/core/helpers/AppStartupHelper.js +359 -0
  128. package/src/sap/fe/core/helpers/AppStartupHelper.ts +391 -0
  129. package/src/sap/fe/core/helpers/BindingExpression.js +479 -464
  130. package/src/sap/fe/core/helpers/BindingExpression.ts +477 -483
  131. package/src/sap/fe/core/helpers/ClassSupport.js +27 -15
  132. package/src/sap/fe/core/helpers/ClassSupport.ts +31 -20
  133. package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.js +63 -59
  134. package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.ts +56 -0
  135. package/src/sap/fe/core/helpers/EditState.js +81 -84
  136. package/src/sap/fe/core/helpers/EditState.ts +81 -0
  137. package/src/sap/fe/core/helpers/ExcelFormatHelper.js +62 -48
  138. package/src/sap/fe/core/helpers/ExcelFormatHelper.ts +49 -0
  139. package/src/sap/fe/core/helpers/FPMHelper.js +52 -56
  140. package/src/sap/fe/core/helpers/FPMHelper.ts +62 -0
  141. package/src/sap/fe/core/helpers/KeepAliveHelper.js +210 -0
  142. package/src/sap/fe/core/helpers/KeepAliveHelper.ts +202 -0
  143. package/src/sap/fe/core/helpers/KeepAliveRefreshTypes.js +32 -0
  144. package/src/sap/fe/core/helpers/KeepAliveRefreshTypes.ts +36 -0
  145. package/src/sap/fe/core/helpers/MassEditHelper.js +687 -0
  146. package/src/sap/fe/core/helpers/ModelHelper.js +229 -174
  147. package/src/sap/fe/core/helpers/ModelHelper.ts +227 -0
  148. package/src/sap/fe/core/helpers/PasteHelper.js +210 -132
  149. package/src/sap/fe/core/helpers/PasteHelper.ts +196 -0
  150. package/src/sap/fe/core/helpers/SemanticDateOperators.js +332 -313
  151. package/src/sap/fe/core/helpers/SemanticDateOperators.ts +330 -0
  152. package/src/sap/fe/core/helpers/SemanticKeyHelper.js +66 -67
  153. package/src/sap/fe/core/helpers/SemanticKeyHelper.ts +73 -0
  154. package/src/sap/fe/core/helpers/StableIdHelper.js +4 -7
  155. package/src/sap/fe/core/helpers/StableIdHelper.ts +2 -6
  156. package/src/sap/fe/core/jsx-runtime/jsx.js +1 -1
  157. package/src/sap/fe/core/jsx-runtime/jsx.ts +1 -1
  158. package/src/sap/fe/core/library.js +30 -3
  159. package/src/sap/fe/core/library.support.js +12 -5
  160. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +62 -0
  161. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +66 -0
  162. package/src/sap/fe/core/messagebundle.properties +72 -10
  163. package/src/sap/fe/core/messagebundle_ar.properties +41 -0
  164. package/src/sap/fe/core/messagebundle_bg.properties +41 -0
  165. package/src/sap/fe/core/messagebundle_ca.properties +41 -0
  166. package/src/sap/fe/core/messagebundle_cs.properties +42 -1
  167. package/src/sap/fe/core/messagebundle_cy.properties +41 -0
  168. package/src/sap/fe/core/messagebundle_da.properties +41 -0
  169. package/src/sap/fe/core/messagebundle_de.properties +41 -0
  170. package/src/sap/fe/core/messagebundle_el.properties +41 -0
  171. package/src/sap/fe/core/messagebundle_en.properties +41 -0
  172. package/src/sap/fe/core/messagebundle_en_GB.properties +41 -0
  173. package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +41 -0
  174. package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +35 -0
  175. package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +41 -0
  176. package/src/sap/fe/core/messagebundle_es.properties +41 -0
  177. package/src/sap/fe/core/messagebundle_es_MX.properties +41 -0
  178. package/src/sap/fe/core/messagebundle_et.properties +41 -0
  179. package/src/sap/fe/core/messagebundle_fi.properties +41 -0
  180. package/src/sap/fe/core/messagebundle_fr.properties +46 -5
  181. package/src/sap/fe/core/messagebundle_fr_CA.properties +41 -0
  182. package/src/sap/fe/core/messagebundle_hi.properties +41 -0
  183. package/src/sap/fe/core/messagebundle_hr.properties +41 -0
  184. package/src/sap/fe/core/messagebundle_hu.properties +42 -1
  185. package/src/sap/fe/core/messagebundle_id.properties +45 -4
  186. package/src/sap/fe/core/messagebundle_it.properties +41 -0
  187. package/src/sap/fe/core/messagebundle_iw.properties +41 -0
  188. package/src/sap/fe/core/messagebundle_ja.properties +50 -9
  189. package/src/sap/fe/core/messagebundle_kk.properties +41 -0
  190. package/src/sap/fe/core/messagebundle_ko.properties +41 -0
  191. package/src/sap/fe/core/messagebundle_lt.properties +41 -0
  192. package/src/sap/fe/core/messagebundle_lv.properties +41 -0
  193. package/src/sap/fe/core/messagebundle_ms.properties +41 -0
  194. package/src/sap/fe/core/messagebundle_nl.properties +41 -0
  195. package/src/sap/fe/core/messagebundle_no.properties +41 -0
  196. package/src/sap/fe/core/messagebundle_pl.properties +41 -0
  197. package/src/sap/fe/core/messagebundle_pt.properties +43 -2
  198. package/src/sap/fe/core/messagebundle_pt_PT.properties +41 -0
  199. package/src/sap/fe/core/messagebundle_ro.properties +41 -0
  200. package/src/sap/fe/core/messagebundle_ru.properties +41 -0
  201. package/src/sap/fe/core/messagebundle_sh.properties +41 -0
  202. package/src/sap/fe/core/messagebundle_sk.properties +41 -0
  203. package/src/sap/fe/core/messagebundle_sl.properties +41 -0
  204. package/src/sap/fe/core/messagebundle_sv.properties +42 -1
  205. package/src/sap/fe/core/messagebundle_th.properties +41 -0
  206. package/src/sap/fe/core/messagebundle_tr.properties +41 -0
  207. package/src/sap/fe/core/messagebundle_uk.properties +41 -0
  208. package/src/sap/fe/core/messagebundle_vi.properties +41 -0
  209. package/src/sap/fe/core/messagebundle_zh_CN.properties +41 -0
  210. package/src/sap/fe/core/messagebundle_zh_TW.properties +41 -0
  211. package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +2 -2
  212. package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +3 -1
  213. package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +269 -202
  214. package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +212 -0
  215. package/src/sap/fe/core/services/EnvironmentServiceFactory.js +4 -3
  216. package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +9 -5
  217. package/src/sap/fe/core/services/NavigationServiceFactory.js +406 -300
  218. package/src/sap/fe/core/services/NavigationServiceFactory.ts +316 -0
  219. package/src/sap/fe/core/services/ResourceModelServiceFactory.js +149 -81
  220. package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +80 -0
  221. package/src/sap/fe/core/services/RoutingServiceFactory.js +987 -1166
  222. package/src/sap/fe/core/services/RoutingServiceFactory.ts +898 -0
  223. package/src/sap/fe/core/services/ShellServicesFactory.js +31 -2
  224. package/src/sap/fe/core/services/ShellServicesFactory.ts +45 -11
  225. package/src/sap/fe/core/services/SideEffectsServiceFactory.js +41 -84
  226. package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +56 -99
  227. package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +461 -478
  228. package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +453 -0
  229. package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.js +10 -8
  230. package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.ts +8 -0
  231. package/src/sap/fe/core/support/AnnotationIssue.support.js +15 -3
  232. package/src/sap/fe/core/support/AnnotationIssue.support.ts +16 -2
  233. package/src/sap/fe/core/support/CollectionFacetUnsupportedLevel.support.js +2 -2
  234. package/src/sap/fe/core/support/CollectionFacetUnsupportedLevel.support.ts +1 -1
  235. package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.js +38 -0
  236. package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.ts +18 -0
  237. package/src/sap/fe/core/templating/DataModelPathHelper.js +6 -24
  238. package/src/sap/fe/core/templating/DataModelPathHelper.ts +10 -23
  239. package/src/sap/fe/core/templating/DisplayModeFormatter.js +114 -0
  240. package/src/sap/fe/core/templating/DisplayModeFormatter.ts +86 -0
  241. package/src/sap/fe/core/templating/EntitySetHelper.js +80 -7
  242. package/src/sap/fe/core/templating/EntitySetHelper.ts +42 -2
  243. package/src/sap/fe/core/templating/FieldControlHelper.js +8 -8
  244. package/src/sap/fe/core/templating/FieldControlHelper.ts +25 -7
  245. package/src/sap/fe/core/templating/FilterHelper.js +139 -70
  246. package/src/sap/fe/core/templating/FilterHelper.ts +140 -70
  247. package/src/sap/fe/core/templating/PropertyHelper.js +2 -2
  248. package/src/sap/fe/core/templating/PropertyHelper.ts +1 -1
  249. package/src/sap/fe/core/templating/UIFormatters.js +45 -113
  250. package/src/sap/fe/core/templating/UIFormatters.ts +39 -76
  251. package/src/sap/fe/core/type/Email.js +1 -1
  252. package/src/sap/fe/core/type/Email.ts +4 -6
  253. package/ui5.yaml +0 -3
@@ -0,0 +1,316 @@
1
+ import Service from "sap/ui/core/service/Service";
2
+ import ServiceFactory from "sap/ui/core/service/ServiceFactory";
3
+ import { ServiceContext } from "sap/ui/core/service";
4
+ import { SelectionVariant, NavigationHandler } from "sap/fe/navigation";
5
+
6
+ type NavigationServiceSettings = {};
7
+ class NavigationService extends Service<NavigationServiceSettings> {
8
+ initPromise!: Promise<any>;
9
+ oNavHandler!: NavigationHandler;
10
+ init() {
11
+ const oContext = this.getContext(),
12
+ oComponent = oContext && oContext.scopeObject;
13
+
14
+ this.oNavHandler = new NavigationHandler(oComponent);
15
+ this.oNavHandler.setModel(oComponent.getModel());
16
+ this.initPromise = Promise.resolve(this);
17
+ }
18
+ exit() {
19
+ this.oNavHandler.destroy();
20
+ }
21
+
22
+ /**
23
+ * Triggers a cross-app navigation after saving the inner and the cross-app states.
24
+ * @private
25
+ * @ui5-restricted
26
+ * @param {string} sSemanticObject Semantic object of the target app
27
+ * @param {string} sActionName Action of the target app
28
+ * @param {object | string } [vNavigationParameters] Navigation parameters as an object with key/value pairs or as a string representation of
29
+ * such an object. If passed as an object, the properties are not checked against the <code>IsPotentialSensitive</code> or
30
+ * <code>Measure</code> type.
31
+ * @param {object} [oInnerAppData] Object for storing current state of the app
32
+ * @param {Function} [fnOnError] Callback that is called if an error occurs during navigation <br>
33
+ * @param {object} oExternalAppData Object for storing the state which will be forwarded to the target component.
34
+ * @param {string} [sNavMode] Argument is used to overwrite the FLP-configured target for opening a URL. If used, only the
35
+ * <code>explace</code> or <code>inplace</code> values are allowed. Any other value will lead to an exception
36
+ * <code>NavigationHandler.INVALID_NAV_MODE</code>.
37
+ **/
38
+ navigate(
39
+ sSemanticObject: string,
40
+ sActionName: string,
41
+ vNavigationParameters: string | object | undefined,
42
+ oInnerAppData: object | undefined,
43
+ fnOnError: Function | undefined,
44
+ oExternalAppData: object,
45
+ sNavMode: string | undefined
46
+ ) {
47
+ // TODO: Navigation Handler does not handle navigation without a context
48
+ // but in v4 DataFieldForIBN with requiresContext false can trigger a navigation without any context
49
+ // This should be handled
50
+ this.oNavHandler.navigate(
51
+ sSemanticObject,
52
+ sActionName,
53
+ vNavigationParameters,
54
+ oInnerAppData,
55
+ fnOnError,
56
+ oExternalAppData,
57
+ sNavMode
58
+ );
59
+ }
60
+ /**
61
+ * Parses the incoming URL and returns a Promise.
62
+ * @returns {object} A Promise object which returns the
63
+ * extracted app state, the startup parameters, and the type of navigation when execution is successful,
64
+ * @private
65
+ * @ui5-restricted
66
+ **/
67
+ parseNavigation() {
68
+ return this.oNavHandler.parseNavigation();
69
+ }
70
+ /**
71
+ * Processes navigation-related tasks related to beforePopoverOpens event handling for the SmartLink control and returns a Promise object.
72
+ *
73
+ * @param {object} oTableEventParameters The parameters made available by the SmartTable control when the SmartLink control has been clicked,
74
+ * an instance of a PopOver object
75
+ * @param {string} sSelectionVariant Stringified JSON object as returned, for example, from getDataSuiteFormat() of the SmartFilterBar control
76
+ * @param {object} [mInnerAppData] Object containing the current state of the app. If provided, opening the Popover is deferred until the
77
+ * inner app data is saved in a consistent way.
78
+ * @returns {Promise} A Promise object to monitor when all actions of the function have been executed; if the execution is successful, the
79
+ * modified oTableEventParameters is returned; if an error occurs, an error object of type
80
+ * {@link sap.fe.navigation.NavError} is returned
81
+ * @private
82
+ */
83
+ _processBeforeSmartLinkPopoverOpens(oTableEventParameters: object, sSelectionVariant: string, mInnerAppData: object | undefined) {
84
+ return this.oNavHandler.processBeforeSmartLinkPopoverOpens(oTableEventParameters, sSelectionVariant, mInnerAppData);
85
+ }
86
+
87
+ /**
88
+ * Processes selectionVariant string and returns a Promise object (semanticAttributes and AppStateKey).
89
+ * @param {string} sSelectionVariant Stringified JSON object
90
+ * @returns {object} A Promise object to monitor when all actions of the function have been executed; if the execution is successful, the
91
+ * semanticAttributes as well as the appStateKey are returned; if an error occurs, an error object of type
92
+ * {@link sap.fe.navigation.NavError} is returned
93
+ * <br>
94
+ * @example <code>
95
+ *
96
+ * var oSelectionVariant = new sap.fe.navigation.SelectionVariant();
97
+ * oSelectionVariant.addSelectOption("CompanyCode", "I", "EQ", "0001");
98
+ * oSelectionVariant.addSelectOption("Customer", "I", "EQ", "C0001");
99
+ * var sSelectionVariant= oSelectionVariant.toJSONString();
100
+ *
101
+ * var oNavigationHandler = new sap.fe.navigation.NavigationHandler(oController);
102
+ * var oPromiseObject = oNavigationHandler._getAppStateKeyAndUrlParameters(sSelectionVariant);
103
+ *
104
+ * oPromiseObject.done(function(oSemanticAttributes, sAppStateKey){
105
+ * // here you can add coding that should run after all app state and the semantic attributes have been returned.
106
+ * });
107
+ *
108
+ * oPromiseObject.fail(function(oError){
109
+ * //some error handling
110
+ * });
111
+ *
112
+ * </code>
113
+ * @private
114
+ * @ui5-restricted
115
+ */
116
+ getAppStateKeyAndUrlParameters(sSelectionVariant: string) {
117
+ return this.oNavHandler._getAppStateKeyAndUrlParameters(sSelectionVariant);
118
+ }
119
+
120
+ /**
121
+ * Gets the application specific technical parameters.
122
+ * @returns {Array} Containing the technical parameters.
123
+ * @private
124
+ * @ui5-restricted
125
+ */
126
+ getTechnicalParameters() {
127
+ return this.oNavHandler.getTechnicalParameters();
128
+ }
129
+ /**
130
+ * Sets the application specific technical parameters. Technical parameters will not be added to the selection variant passed to the
131
+ * application.
132
+ * As a default sap-system, sap-ushell-defaultedParameterNames and hcpApplicationId are considered as technical parameters.
133
+ * @param {Array} aTechnicalParameters List of parameter names to be considered as technical parameters. <code>null</code> or
134
+ * <code>undefined</code> may be used to reset the complete list.
135
+ * @private
136
+ * @ui5-restricted
137
+ */
138
+ setTechnicalParameters(aTechnicalParameters: any[]) {
139
+ this.oNavHandler.setTechnicalParameters(aTechnicalParameters);
140
+ }
141
+ /**
142
+ * Sets the model that is used for verification of sensitive information. If the model is not set, the unnamed component model is used for the
143
+ * verification of sensitive information.
144
+ * @private
145
+ * @ui5-restricted
146
+ * @param {sap.ui.model.odata.v2.ODataModel} oModel Model For checking sensitive information
147
+ */
148
+ setModel(oModel: any) {
149
+ this.oNavHandler.setModel(oModel);
150
+ }
151
+ /**
152
+ * Changes the URL according to the current app state and stores the app state for later retrieval.
153
+ * @private
154
+ * @ui5-restricted
155
+ * @param {object} mInnerAppData Object containing the current state of the app
156
+ * @returns {object} A Promise object to monitor when all the actions of the function have been executed; if the execution is successful, the
157
+ * app state key is returned; if an error occurs, an object of type {@link sap.fe.navigation.NavError} is
158
+ * returned
159
+ **/
160
+ storeInnerAppState(mInnerAppData: object) {
161
+ return this.oNavHandler.storeInnerAppState(mInnerAppData);
162
+ }
163
+ /**
164
+ * Changes the URL according to the current app state and stores the app state for later retrieval.
165
+ * @private
166
+ * @ui5-restricted
167
+ * @param {object} mInnerAppData Object containing the current state of the app
168
+ * @param {boolean} [bImmediateHashReplace=false] If set to false, the inner app hash will not be replaced until storing is successful; do not
169
+ * @param bNotLegacy
170
+
171
+ * @returns {object} An object containing the appStateId and a promise object to monitor when all the actions of the function have been
172
+ * executed; Please note that the appStateKey may be undefined or empty.
173
+ */
174
+ storeInnerAppStateWithImmediateReturn(mInnerAppData: object, bImmediateHashReplace: boolean | undefined, bNotLegacy: any) {
175
+ return this.oNavHandler.storeInnerAppStateWithImmediateReturn(mInnerAppData, bImmediateHashReplace, bNotLegacy);
176
+ }
177
+ /**
178
+ * Changes the URL according to the current sAppStateKey. As an reaction route change event will be triggered.
179
+ * @private
180
+ * @ui5-restricted
181
+ * @param {string} sAppStateKey The new app state key.
182
+ */
183
+ replaceHash(sAppStateKey: string) {
184
+ this.oNavHandler.replaceHash(sAppStateKey);
185
+ }
186
+ replaceInnerAppStateKey(sAppHash: any, sAppStateKey: any) {
187
+ return this.oNavHandler._replaceInnerAppStateKey(sAppHash, sAppStateKey);
188
+ }
189
+ /**
190
+ * Get single values from SelectionVariant for url parameters.
191
+ *
192
+ * @private
193
+ * @ui5-restricted
194
+ * @param {object | string } [vSelectionVariant]
195
+ * @param {object} [vSelectionVariant.oUrlParamaters]
196
+ * @returns {pbject}
197
+ */
198
+ getUrlParametersFromSelectionVariant(vSelectionVariant: string | object | undefined) {
199
+ return this.oNavHandler._getURLParametersFromSelectionVariant(vSelectionVariant);
200
+ }
201
+
202
+ /**
203
+ * Save app state and return immediately without waiting for response.
204
+ *
205
+ * @private
206
+ * @ui5-restricted
207
+ * @param {object} oInSelectionVariant Instance of sap.fe.navigation.SelectionVariant
208
+ * @returns {string} AppState key
209
+ */
210
+ saveAppStateWithImmediateReturn(oInSelectionVariant: SelectionVariant) {
211
+ if (oInSelectionVariant) {
212
+ const sSelectionVariant = oInSelectionVariant.toJSONString(), // create an SV for app state in string format
213
+ oSelectionVariant = JSON.parse(sSelectionVariant), // convert string into JSON to store in AppState
214
+ oXAppStateObject = {
215
+ selectionVariant: oSelectionVariant
216
+ },
217
+ oReturn = this.oNavHandler._saveAppStateWithImmediateReturn(oXAppStateObject);
218
+ return oReturn.appStateKey ? oReturn.appStateKey : "";
219
+ }
220
+ }
221
+
222
+ /**
223
+ * Mix Attributes and selectionVariant.
224
+ *
225
+ * @param {object|Array} vSemanticAttributes Object/(Array of Objects) containing key/value pairs
226
+ * @param {string} sSelectionVariant The selection variant in string format as provided by the SmartFilterBar control
227
+ * @param {int} [iSuppressionBehavior=sap.fe.navigation.SuppressionBehavior.standard] Indicates whether semantic
228
+ * attributes with special values (see {@link sap.fe.navigation.SuppressionBehavior suppression behavior}) must be
229
+ * suppressed before they are combined with the selection variant; several
230
+ * {@link sap.fe.navigation.SuppressionBehavior suppression behaviors} can be combined with the bitwise OR operator
231
+ * (|)
232
+ * @returns {object} Instance of {@link sap.fe.navigation.SelectionVariant}
233
+ */
234
+ mixAttributesAndSelectionVariant(
235
+ vSemanticAttributes: object | any[],
236
+ sSelectionVariant: string,
237
+ iSuppressionBehavior: number | undefined
238
+ ) {
239
+ return this.oNavHandler.mixAttributesAndSelectionVariant(vSemanticAttributes, sSelectionVariant, iSuppressionBehavior);
240
+ }
241
+
242
+ /**
243
+ * The method creates a context url based on provided data. This context url can either be used as.
244
+ *
245
+ * @param {string} sEntitySetName Used for url determination
246
+ * @param [oModel] The ODataModel used for url determination. If omitted, the NavigationHandler model is used.
247
+ * @returns {string} The context url for the given entities
248
+ */
249
+ constructContextUrl(sEntitySetName: string, oModel: any) {
250
+ return this.oNavHandler.constructContextUrl(sEntitySetName, oModel);
251
+ }
252
+ getInterface() {
253
+ return this;
254
+ }
255
+ }
256
+ function fnGetEmptyObject() {
257
+ return {};
258
+ }
259
+
260
+ function fnGetPromise() {
261
+ return Promise.resolve({});
262
+ }
263
+
264
+ function fnGetJQueryPromise() {
265
+ const oMyDeffered = jQuery.Deferred();
266
+ oMyDeffered.resolve({}, {}, "initial");
267
+ return oMyDeffered.promise();
268
+ }
269
+
270
+ function fnGetEmptyString() {
271
+ return "";
272
+ }
273
+ export class NavigationServicesMock {
274
+ initPromise: Promise<any>;
275
+ constructor() {
276
+ this.initPromise = Promise.resolve(this);
277
+ }
278
+
279
+ getInterface() {
280
+ return this;
281
+ }
282
+
283
+ // return empty object
284
+ createEmptyAppState = fnGetEmptyObject;
285
+ storeInnerAppStateWithImmediateReturn = fnGetEmptyObject;
286
+ mixAttributesAndSelectionVariant = fnGetEmptyObject;
287
+
288
+ // return promise
289
+ getAppState = fnGetPromise;
290
+ getStartupAppState = fnGetPromise;
291
+ parseNavigation = fnGetJQueryPromise;
292
+
293
+ // return empty string
294
+ constructContextUrl = fnGetEmptyString;
295
+
296
+ replaceInnerAppStateKey(sAppHash: any) {
297
+ return sAppHash ? sAppHash : "";
298
+ }
299
+
300
+ navigate() {
301
+ // Don't do anything
302
+ }
303
+ }
304
+
305
+ class NavigationServiceFactory extends ServiceFactory<NavigationServiceSettings> {
306
+ createInstance(oServiceContext: ServiceContext<NavigationServiceSettings>) {
307
+ const oNavigationService =
308
+ sap.ushell && sap.ushell.Container ? new NavigationService(oServiceContext) : new NavigationServicesMock();
309
+ // Wait For init
310
+ return oNavigationService.initPromise.then(function(oService: any) {
311
+ return oService;
312
+ });
313
+ }
314
+ }
315
+
316
+ export default NavigationServiceFactory;
@@ -1,83 +1,151 @@
1
1
  /*!
2
- * SAPUI5
3
- * (c) Copyright 2009-2022 SAP SE. All rights reserved.
2
+ * SAP UI development toolkit for HTML5 (SAPUI5)
3
+ * (c) Copyright 2009-2021 SAP SE. All rights reserved
4
4
  */
5
- sap.ui.define(
6
- [
7
- "sap/ui/core/service/Service",
8
- "sap/ui/core/service/ServiceFactory",
9
- "sap/ui/model/resource/ResourceModel",
10
- "sap/base/i18n/ResourceBundle"
11
- ],
12
- function(Service, ServiceFactory, ResourceModel, ResourceBundle) {
13
- "use strict";
14
-
15
- var ResourceModelService = Service.extend("sap.fe.core.services.ResourceModelService", {
16
- initPromise: Promise.resolve(),
17
- init: function() {
18
- var oContext = this.getContext();
19
- var mSettings = oContext.settings;
20
- this.oFactory = oContext.factory;
21
-
22
- // When enhancing i18n keys the value in the last resource bundle takes precedence
23
- // hence arrange various resource bundles so that enhanceI18n provided by the application is the last.
24
- // The following order is used :
25
- // 1. sap.fe bundle - sap.fe.core.messagebundle (passed with mSettings.bundles)
26
- // 2. sap.fe bundle - sap.fe.templates.messagebundle (passed with mSettings.bundles)
27
- // 3. Multiple bundles passed by the application as part of enhanceI18n
28
- var aBundles = mSettings.bundles.concat(mSettings.enhanceI18n || []).map(function(vI18n) {
29
- // if value passed for enhanceI18n is a Resource Model, return the associated bundle
30
- // else the value is a bundleUrl, return Resource Bundle configuration so that a bundle can be created
31
- return typeof vI18n.isA === "function" && vI18n.isA("sap.ui.model.resource.ResourceModel")
32
- ? vI18n.getResourceBundle()
33
- : { bundleName: vI18n.replace(/\//g, ".") };
34
- });
35
-
36
- this.oResourceModel = new ResourceModel({
37
- bundleName: aBundles[0].bundleName,
38
- enhanceWith: aBundles.slice(1),
39
- async: true
40
- });
41
-
42
- if (oContext.scopeType === "component") {
43
- var oComponent = oContext.scopeObject;
44
- oComponent.setModel(this.oResourceModel, mSettings.modelName);
45
- }
46
-
47
- this.initPromise = this.oResourceModel.getResourceBundle().then(
48
- function(oBundle) {
49
- this.oResourceModel.__bundle = oBundle;
50
- return this;
51
- }.bind(this)
52
- );
53
- },
54
-
55
- getResourceModel: function() {
56
- return this.oResourceModel;
57
- },
58
- exit: function() {
59
- // Deregister global instance
60
- this.oFactory.removeGlobalInstance();
61
- }
62
- });
63
-
64
- return ServiceFactory.extend("sap.fe.core.services.ResourceModelServiceFactory", {
65
- _oInstances: {},
66
- createInstance: function(oServiceContext) {
67
- var sKey =
68
- oServiceContext.settings.bundles.join(",") +
69
- (oServiceContext.settings.enhanceI18n ? "," + oServiceContext.settings.enhanceI18n.join(",") : "");
70
-
71
- if (!this._oInstances[sKey]) {
72
- this._oInstances[sKey] = new ResourceModelService(Object.assign({ factory: this }, oServiceContext));
73
- }
74
-
75
- return this._oInstances[sKey].initPromise;
76
- },
77
- removeGlobalInstance: function() {
78
- this._oInstances = {};
79
- }
80
- });
81
- },
82
- true
83
- );
5
+ sap.ui.define(["sap/ui/core/service/Service", "sap/ui/core/service/ServiceFactory", "sap/ui/model/resource/ResourceModel"], function (Service, ServiceFactory, ResourceModel) {
6
+ "use strict";
7
+
8
+ var _exports = {};
9
+
10
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
+
12
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13
+
14
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
15
+
16
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
17
+
18
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
19
+
20
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
21
+
22
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
23
+
24
+ function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
25
+
26
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
27
+
28
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
29
+
30
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
31
+
32
+ var ResourceModelService = /*#__PURE__*/function (_Service) {
33
+ _inherits(ResourceModelService, _Service);
34
+
35
+ var _super = _createSuper(ResourceModelService);
36
+
37
+ function ResourceModelService() {
38
+ _classCallCheck(this, ResourceModelService);
39
+
40
+ return _super.apply(this, arguments);
41
+ }
42
+
43
+ _exports.ResourceModelService = ResourceModelService;
44
+
45
+ _createClass(ResourceModelService, [{
46
+ key: "init",
47
+ value: function init() {
48
+ var _this = this;
49
+
50
+ var oContext = this.getContext();
51
+ var mSettings = oContext.settings;
52
+ this.oFactory = oContext.factory; // When enhancing i18n keys the value in the last resource bundle takes precedence
53
+ // hence arrange various resource bundles so that enhanceI18n provided by the application is the last.
54
+ // The following order is used :
55
+ // 1. sap.fe bundle - sap.fe.core.messagebundle (passed with mSettings.bundles)
56
+ // 2. sap.fe bundle - sap.fe.templates.messagebundle (passed with mSettings.bundles)
57
+ // 3. Multiple bundles passed by the application as part of enhanceI18n
58
+
59
+ var aBundles = mSettings.bundles.concat(mSettings.enhanceI18n || []).map(function (vI18n) {
60
+ // if value passed for enhanceI18n is a Resource Model, return the associated bundle
61
+ // else the value is a bundleUrl, return Resource Bundle configuration so that a bundle can be created
62
+ return typeof vI18n.isA === "function" && vI18n.isA("sap.ui.model.resource.ResourceModel") ? vI18n.getResourceBundle() : {
63
+ bundleName: vI18n.replace(/\//g, ".")
64
+ };
65
+ });
66
+ this.oResourceModel = new ResourceModel({
67
+ bundleName: aBundles[0].bundleName,
68
+ enhanceWith: aBundles.slice(1),
69
+ async: true
70
+ });
71
+
72
+ if (oContext.scopeType === "component") {
73
+ var oComponent = oContext.scopeObject;
74
+ oComponent.setModel(this.oResourceModel, mSettings.modelName);
75
+ }
76
+
77
+ this.initPromise = this.oResourceModel.getResourceBundle().then(function (oBundle) {
78
+ _this.oResourceModel.__bundle = oBundle;
79
+ return _this;
80
+ });
81
+ }
82
+ }, {
83
+ key: "getResourceModel",
84
+ value: function getResourceModel() {
85
+ return this.oResourceModel;
86
+ }
87
+ }, {
88
+ key: "getInterface",
89
+ value: function getInterface() {
90
+ return this;
91
+ }
92
+ }, {
93
+ key: "exit",
94
+ value: function exit() {
95
+ // Deregister global instance
96
+ this.oFactory.removeGlobalInstance();
97
+ }
98
+ }]);
99
+
100
+ return ResourceModelService;
101
+ }(Service);
102
+
103
+ _exports.ResourceModelService = ResourceModelService;
104
+
105
+ var ResourceModelServiceFactory = /*#__PURE__*/function (_ServiceFactory) {
106
+ _inherits(ResourceModelServiceFactory, _ServiceFactory);
107
+
108
+ var _super2 = _createSuper(ResourceModelServiceFactory);
109
+
110
+ function ResourceModelServiceFactory() {
111
+ var _this2;
112
+
113
+ _classCallCheck(this, ResourceModelServiceFactory);
114
+
115
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
116
+ args[_key] = arguments[_key];
117
+ }
118
+
119
+ _this2 = _super2.call.apply(_super2, [this].concat(args));
120
+
121
+ _defineProperty(_assertThisInitialized(_this2), "_oInstances", {});
122
+
123
+ return _this2;
124
+ }
125
+
126
+ _createClass(ResourceModelServiceFactory, [{
127
+ key: "createInstance",
128
+ value: function createInstance(oServiceContext) {
129
+ var sKey = oServiceContext.settings.bundles.join(",") + (oServiceContext.settings.enhanceI18n ? "," + oServiceContext.settings.enhanceI18n.join(",") : "");
130
+
131
+ if (!this._oInstances[sKey]) {
132
+ this._oInstances[sKey] = new ResourceModelService(Object.assign({
133
+ factory: this
134
+ }, oServiceContext));
135
+ }
136
+
137
+ return this._oInstances[sKey].initPromise;
138
+ }
139
+ }, {
140
+ key: "removeGlobalInstance",
141
+ value: function removeGlobalInstance() {
142
+ this._oInstances = {};
143
+ }
144
+ }]);
145
+
146
+ return ResourceModelServiceFactory;
147
+ }(ServiceFactory);
148
+
149
+ return ResourceModelServiceFactory;
150
+ }, false);
151
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlJlc291cmNlTW9kZWxTZXJ2aWNlRmFjdG9yeS50cyJdLCJuYW1lcyI6WyJSZXNvdXJjZU1vZGVsU2VydmljZSIsIm9Db250ZXh0IiwiZ2V0Q29udGV4dCIsIm1TZXR0aW5ncyIsInNldHRpbmdzIiwib0ZhY3RvcnkiLCJmYWN0b3J5IiwiYUJ1bmRsZXMiLCJidW5kbGVzIiwiY29uY2F0IiwiZW5oYW5jZUkxOG4iLCJtYXAiLCJ2STE4biIsImlzQSIsImdldFJlc291cmNlQnVuZGxlIiwiYnVuZGxlTmFtZSIsInJlcGxhY2UiLCJvUmVzb3VyY2VNb2RlbCIsIlJlc291cmNlTW9kZWwiLCJlbmhhbmNlV2l0aCIsInNsaWNlIiwiYXN5bmMiLCJzY29wZVR5cGUiLCJvQ29tcG9uZW50Iiwic2NvcGVPYmplY3QiLCJzZXRNb2RlbCIsIm1vZGVsTmFtZSIsImluaXRQcm9taXNlIiwidGhlbiIsIm9CdW5kbGUiLCJfX2J1bmRsZSIsInJlbW92ZUdsb2JhbEluc3RhbmNlIiwiU2VydmljZSIsIlJlc291cmNlTW9kZWxTZXJ2aWNlRmFjdG9yeSIsIm9TZXJ2aWNlQ29udGV4dCIsInNLZXkiLCJqb2luIiwiX29JbnN0YW5jZXMiLCJPYmplY3QiLCJhc3NpZ24iLCJTZXJ2aWNlRmFjdG9yeS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mhhbmNlSTE4biA/IFwiLFwiICsgb1NlcnZpY2VDb250ZXh0LnNldHRpbmdzLmVuaGFuY2VJMThuLmpvaW4oXCIsXCIpIDogXCJcIik7XG5cblx0XHRpZiAoIXRoaXMuX29JbnN0YW5jZXNbc0tleV0pIHtcblx0XHRcdHRoaXMuX29JbnN0YW5jZXNbc0tleV0gPSBuZXcgUmVzb3VyY2VNb2RlbFNlcnZpY2UoT2JqZWN0LmFzc2lnbih7IGZhY3Rvcnk6IHRoaXMgfSwgb1NlcnZpY2VDb250ZXh0KSk7XG5cdFx0fVxuXG5cdFx0cmV0dXJuIHRoaXMuX29JbnN0YW5jZXNbc0tleV0uaW5pdFByb21pc2U7XG5cdH1cblx0cmVtb3ZlR2xvYmFsSW5zdGFuY2UoKSB7XG5cdFx0dGhpcy5fb0luc3RhbmNlcyA9IHt9O1xuXHR9XG59XG5cbmV4cG9ydCBkZWZhdWx0IFJlc291cmNlTW9kZWxTZXJ2aWNlRmFjdG9yeTtcbiJdfQ==
@@ -0,0 +1,80 @@
1
+ import Service from "sap/ui/core/service/Service";
2
+ import ServiceFactory from "sap/ui/core/service/ServiceFactory";
3
+ import ResourceModel from "sap/ui/model/resource/ResourceModel";
4
+ import ResourceBundle from "sap/base/i18n/ResourceBundle";
5
+ import { ServiceContext } from "sap/ui/core/service";
6
+ type ResourceModelServiceSettings = {
7
+ bundles: ResourceBundle[];
8
+ enhanceI18n: string[];
9
+ };
10
+ export class ResourceModelService extends Service<ResourceModelServiceSettings> {
11
+ initPromise!: Promise<any>;
12
+ oFactory!: ResourceModelServiceFactory;
13
+ oResourceModel!: ResourceModel;
14
+ init() {
15
+ const oContext = this.getContext();
16
+ const mSettings = oContext.settings;
17
+ this.oFactory = oContext.factory;
18
+
19
+ // When enhancing i18n keys the value in the last resource bundle takes precedence
20
+ // hence arrange various resource bundles so that enhanceI18n provided by the application is the last.
21
+ // The following order is used :
22
+ // 1. sap.fe bundle - sap.fe.core.messagebundle (passed with mSettings.bundles)
23
+ // 2. sap.fe bundle - sap.fe.templates.messagebundle (passed with mSettings.bundles)
24
+ // 3. Multiple bundles passed by the application as part of enhanceI18n
25
+ const aBundles = mSettings.bundles.concat(mSettings.enhanceI18n || []).map(function(vI18n: any) {
26
+ // if value passed for enhanceI18n is a Resource Model, return the associated bundle
27
+ // else the value is a bundleUrl, return Resource Bundle configuration so that a bundle can be created
28
+ return typeof vI18n.isA === "function" && vI18n.isA("sap.ui.model.resource.ResourceModel")
29
+ ? vI18n.getResourceBundle()
30
+ : { bundleName: vI18n.replace(/\//g, ".") };
31
+ });
32
+
33
+ this.oResourceModel = new ResourceModel({
34
+ bundleName: aBundles[0].bundleName,
35
+ enhanceWith: aBundles.slice(1),
36
+ async: true
37
+ });
38
+
39
+ if (oContext.scopeType === "component") {
40
+ const oComponent = oContext.scopeObject;
41
+ oComponent.setModel(this.oResourceModel, mSettings.modelName);
42
+ }
43
+
44
+ this.initPromise = (this.oResourceModel.getResourceBundle() as Promise<ResourceBundle>).then((oBundle: any) => {
45
+ (this.oResourceModel as any).__bundle = oBundle;
46
+ return this;
47
+ });
48
+ }
49
+
50
+ getResourceModel() {
51
+ return this.oResourceModel;
52
+ }
53
+ getInterface(): any {
54
+ return this;
55
+ }
56
+ exit() {
57
+ // Deregister global instance
58
+ this.oFactory.removeGlobalInstance();
59
+ }
60
+ }
61
+
62
+ class ResourceModelServiceFactory extends ServiceFactory<ResourceModelServiceSettings> {
63
+ _oInstances: Record<string, ResourceModelService> = {};
64
+ createInstance(oServiceContext: ServiceContext<ResourceModelServiceSettings>) {
65
+ const sKey =
66
+ oServiceContext.settings.bundles.join(",") +
67
+ (oServiceContext.settings.enhanceI18n ? "," + oServiceContext.settings.enhanceI18n.join(",") : "");
68
+
69
+ if (!this._oInstances[sKey]) {
70
+ this._oInstances[sKey] = new ResourceModelService(Object.assign({ factory: this }, oServiceContext));
71
+ }
72
+
73
+ return this._oInstances[sKey].initPromise;
74
+ }
75
+ removeGlobalInstance() {
76
+ this._oInstances = {};
77
+ }
78
+ }
79
+
80
+ export default ResourceModelServiceFactory;