@sapui5/sap.fe.core 1.100.0 → 1.101.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 (250) hide show
  1. package/package.json +4 -4
  2. package/src/sap/fe/core/.library +2 -3
  3. package/src/sap/fe/core/AnnotationHelper.js +43 -24
  4. package/src/sap/fe/core/AnnotationHelper.ts +43 -37
  5. package/src/sap/fe/core/AppComponent.js +20 -27
  6. package/src/sap/fe/core/AppComponent.ts +19 -25
  7. package/src/sap/fe/core/AppStateHandler.js +5 -5
  8. package/src/sap/fe/core/AppStateHandler.ts +2 -2
  9. package/src/sap/fe/core/BaseController.js +9 -9
  10. package/src/sap/fe/core/BaseController.ts +3 -4
  11. package/src/sap/fe/core/CommonUtils.js +74 -17
  12. package/src/sap/fe/core/CommonUtils.ts +181 -110
  13. package/src/sap/fe/core/ExtensionAPI.js +11 -10
  14. package/src/sap/fe/core/ExtensionAPI.ts +22 -30
  15. package/src/sap/fe/core/PageController.js +12 -11
  16. package/src/sap/fe/core/PageController.ts +34 -34
  17. package/src/sap/fe/core/RouterProxy.js +36 -24
  18. package/src/sap/fe/core/RouterProxy.ts +36 -22
  19. package/src/sap/fe/core/TemplateComponent.js +193 -118
  20. package/src/sap/fe/core/TemplateComponent.ts +105 -117
  21. package/src/sap/fe/core/TemplateModel.js +6 -8
  22. package/src/sap/fe/core/TemplateModel.ts +2 -2
  23. package/src/sap/fe/core/TransactionHelper.js +33 -18
  24. package/src/sap/fe/core/TransactionHelper.ts +172 -153
  25. package/src/sap/fe/core/actions/collaboration/ActivitySync.js +31 -17
  26. package/src/sap/fe/core/actions/collaboration/ActivitySync.ts +52 -45
  27. package/src/sap/fe/core/actions/collaboration/CollaborationCommon.js +16 -6
  28. package/src/sap/fe/core/actions/collaboration/CollaborationCommon.ts +13 -3
  29. package/src/sap/fe/core/actions/collaboration/Manage.js +9 -7
  30. package/src/sap/fe/core/actions/collaboration/Manage.ts +33 -31
  31. package/src/sap/fe/core/actions/collaboration/ManageDialog.fragment.xml +53 -56
  32. package/src/sap/fe/core/actions/draft.js +308 -166
  33. package/src/sap/fe/core/actions/draft.ts +177 -74
  34. package/src/sap/fe/core/actions/messageHandling.js +25 -13
  35. package/src/sap/fe/core/actions/messageHandling.ts +49 -39
  36. package/src/sap/fe/core/actions/operations.js +4 -4
  37. package/src/sap/fe/core/actions/operations.ts +3 -2
  38. package/src/sap/fe/core/buildingBlocks/AttributeModel.js +60 -0
  39. package/src/sap/fe/core/buildingBlocks/AttributeModel.ts +37 -0
  40. package/src/sap/fe/core/buildingBlocks/BuildingBlock.js +165 -0
  41. package/src/sap/fe/core/buildingBlocks/BuildingBlock.ts +178 -0
  42. package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.js +707 -0
  43. package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.ts +628 -0
  44. package/src/sap/fe/core/buildingBlocks/TraceInfo.js +436 -0
  45. package/src/sap/fe/core/buildingBlocks/TraceInfo.ts +431 -0
  46. package/src/sap/fe/core/controllerextensions/EditFlow.js +506 -245
  47. package/src/sap/fe/core/controllerextensions/EditFlow.ts +395 -275
  48. package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +11 -11
  49. package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.ts +6 -7
  50. package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +15 -17
  51. package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +98 -96
  52. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +15 -15
  53. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +60 -53
  54. package/src/sap/fe/core/controllerextensions/InternalRouting.js +94 -42
  55. package/src/sap/fe/core/controllerextensions/InternalRouting.ts +114 -91
  56. package/src/sap/fe/core/controllerextensions/KPIManagement.js +14 -14
  57. package/src/sap/fe/core/controllerextensions/KPIManagement.ts +12 -11
  58. package/src/sap/fe/core/controllerextensions/MassEdit.js +12 -12
  59. package/src/sap/fe/core/controllerextensions/MassEdit.ts +8 -9
  60. package/src/sap/fe/core/controllerextensions/MessageHandler.js +13 -25
  61. package/src/sap/fe/core/controllerextensions/MessageHandler.ts +18 -28
  62. package/src/sap/fe/core/controllerextensions/PageReady.js +25 -23
  63. package/src/sap/fe/core/controllerextensions/PageReady.ts +49 -47
  64. package/src/sap/fe/core/controllerextensions/Paginator.js +13 -13
  65. package/src/sap/fe/core/controllerextensions/Paginator.ts +24 -18
  66. package/src/sap/fe/core/controllerextensions/Placeholder.js +10 -10
  67. package/src/sap/fe/core/controllerextensions/Placeholder.ts +12 -14
  68. package/src/sap/fe/core/controllerextensions/Routing.js +11 -11
  69. package/src/sap/fe/core/controllerextensions/Routing.ts +12 -13
  70. package/src/sap/fe/core/controllerextensions/Share.js +16 -16
  71. package/src/sap/fe/core/controllerextensions/Share.ts +32 -32
  72. package/src/sap/fe/core/controllerextensions/SideEffects.js +14 -14
  73. package/src/sap/fe/core/controllerextensions/SideEffects.ts +62 -63
  74. package/src/sap/fe/core/controllerextensions/ViewState.js +17 -31
  75. package/src/sap/fe/core/controllerextensions/ViewState.ts +93 -102
  76. package/src/sap/fe/core/controls/Any.js +28 -0
  77. package/src/sap/fe/core/controls/Any.ts +30 -0
  78. package/src/sap/fe/core/controls/CommandExecution.js +38 -15
  79. package/src/sap/fe/core/controls/CommandExecution.ts +20 -20
  80. package/src/sap/fe/core/controls/ConditionalWrapper.js +136 -65
  81. package/src/sap/fe/core/controls/ConditionalWrapper.ts +49 -58
  82. package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.js +366 -0
  83. package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.ts +278 -0
  84. package/src/sap/fe/core/controls/CustomQuickViewPage.js +73 -36
  85. package/src/sap/fe/core/controls/CustomQuickViewPage.ts +22 -32
  86. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossDraft.fragment.xml +44 -5
  87. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +116 -66
  88. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.ts +121 -67
  89. package/src/sap/fe/core/controls/FieldWrapper.js +171 -87
  90. package/src/sap/fe/core/controls/FieldWrapper.ts +69 -80
  91. package/src/sap/fe/core/controls/FileWrapper.js +313 -0
  92. package/src/sap/fe/core/controls/FileWrapper.ts +169 -0
  93. package/src/sap/fe/core/controls/FilterBar.js +154 -119
  94. package/src/sap/fe/core/controls/FilterBar.ts +128 -123
  95. package/src/sap/fe/core/controls/FormElementWrapper.js +92 -37
  96. package/src/sap/fe/core/controls/FormElementWrapper.ts +32 -35
  97. package/src/sap/fe/core/controls/filterbar/FilterContainer.js +111 -89
  98. package/src/sap/fe/core/controls/filterbar/FilterContainer.ts +86 -82
  99. package/src/sap/fe/core/controls/filterbar/VisualFilter.js +242 -193
  100. package/src/sap/fe/core/controls/filterbar/VisualFilter.ts +211 -204
  101. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +152 -116
  102. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.ts +105 -105
  103. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +1 -1
  104. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +2 -2
  105. package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +37 -42
  106. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +7 -6
  107. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +15 -14
  108. package/src/sap/fe/core/converters/ManifestSettings.js +2 -1
  109. package/src/sap/fe/core/converters/ManifestSettings.ts +5 -1
  110. package/src/sap/fe/core/converters/annotations/DataField.js +1 -2
  111. package/src/sap/fe/core/converters/annotations/DataField.ts +3 -4
  112. package/src/sap/fe/core/converters/controls/Common/Action.js +10 -10
  113. package/src/sap/fe/core/converters/controls/Common/Action.ts +20 -19
  114. package/src/sap/fe/core/converters/controls/Common/Chart.js +8 -8
  115. package/src/sap/fe/core/converters/controls/Common/Chart.ts +12 -11
  116. package/src/sap/fe/core/converters/controls/Common/Form.js +5 -5
  117. package/src/sap/fe/core/converters/controls/Common/Form.ts +3 -1
  118. package/src/sap/fe/core/converters/controls/Common/KPI.js +1 -1
  119. package/src/sap/fe/core/converters/controls/Common/KPI.ts +2 -3
  120. package/src/sap/fe/core/converters/controls/Common/Table.js +245 -112
  121. package/src/sap/fe/core/converters/controls/Common/Table.ts +305 -193
  122. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +5 -5
  123. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +4 -7
  124. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +72 -43
  125. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +134 -100
  126. package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.js +6 -6
  127. package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.ts +20 -18
  128. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +5 -2
  129. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +4 -1
  130. package/src/sap/fe/core/converters/objectPage/FormMenuActions.js +1 -1
  131. package/src/sap/fe/core/converters/objectPage/FormMenuActions.ts +0 -4
  132. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +27 -24
  133. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +49 -40
  134. package/src/sap/fe/core/converters/templates/ListReportConverter.js +33 -22
  135. package/src/sap/fe/core/converters/templates/ListReportConverter.ts +77 -62
  136. package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +5 -5
  137. package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +3 -7
  138. package/src/sap/fe/core/formatters/KPIFormatter.js +3 -12
  139. package/src/sap/fe/core/formatters/KPIFormatter.ts +3 -2
  140. package/src/sap/fe/core/formatters/TableFormatter.js +2 -2
  141. package/src/sap/fe/core/formatters/TableFormatter.ts +1 -1
  142. package/src/sap/fe/core/formatters/ValueFormatter.js +4 -4
  143. package/src/sap/fe/core/formatters/ValueFormatter.ts +4 -7
  144. package/src/sap/fe/core/fpm/Component.js +46 -17
  145. package/src/sap/fe/core/fpm/Component.ts +11 -16
  146. package/src/sap/fe/core/helpers/AppStartupHelper.js +4 -4
  147. package/src/sap/fe/core/helpers/AppStartupHelper.ts +3 -3
  148. package/src/sap/fe/core/helpers/ClassSupport.js +273 -256
  149. package/src/sap/fe/core/helpers/ClassSupport.ts +314 -237
  150. package/src/sap/fe/core/helpers/MassEditHelper.js +173 -39
  151. package/src/sap/fe/core/helpers/MassEditHelper.ts +236 -132
  152. package/src/sap/fe/core/helpers/ModelHelper.js +29 -1
  153. package/src/sap/fe/core/helpers/ModelHelper.ts +23 -0
  154. package/src/sap/fe/core/helpers/PasteHelper.js +4 -4
  155. package/src/sap/fe/core/helpers/PasteHelper.ts +4 -3
  156. package/src/sap/fe/core/helpers/SemanticDateOperators.js +3 -3
  157. package/src/sap/fe/core/helpers/SemanticDateOperators.ts +3 -1
  158. package/src/sap/fe/core/helpers/SemanticKeyHelper.js +1 -1
  159. package/src/sap/fe/core/helpers/SemanticKeyHelper.ts +1 -1
  160. package/src/sap/fe/core/helpers/StableIdHelper.js +1 -7
  161. package/src/sap/fe/core/helpers/StableIdHelper.ts +0 -4
  162. package/src/sap/fe/core/jsx-runtime/jsx.js +35 -5
  163. package/src/sap/fe/core/jsx-runtime/jsx.ts +22 -8
  164. package/src/sap/fe/core/library.js +4 -5
  165. package/src/sap/fe/core/library.ts +17 -17
  166. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +1 -1
  167. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +0 -3
  168. package/src/sap/fe/core/messagebundle.properties +23 -8
  169. package/src/sap/fe/core/messagebundle_ar.properties +2 -0
  170. package/src/sap/fe/core/messagebundle_bg.properties +2 -0
  171. package/src/sap/fe/core/messagebundle_ca.properties +2 -0
  172. package/src/sap/fe/core/messagebundle_cs.properties +2 -0
  173. package/src/sap/fe/core/messagebundle_cy.properties +5 -3
  174. package/src/sap/fe/core/messagebundle_da.properties +2 -0
  175. package/src/sap/fe/core/messagebundle_de.properties +2 -0
  176. package/src/sap/fe/core/messagebundle_el.properties +2 -0
  177. package/src/sap/fe/core/messagebundle_en.properties +2 -0
  178. package/src/sap/fe/core/messagebundle_en_GB.properties +2 -0
  179. package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +2 -0
  180. package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +2 -0
  181. package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +2 -0
  182. package/src/sap/fe/core/messagebundle_es.properties +2 -0
  183. package/src/sap/fe/core/messagebundle_es_MX.properties +2 -0
  184. package/src/sap/fe/core/messagebundle_et.properties +2 -0
  185. package/src/sap/fe/core/messagebundle_fi.properties +2 -0
  186. package/src/sap/fe/core/messagebundle_fr.properties +4 -2
  187. package/src/sap/fe/core/messagebundle_fr_CA.properties +5 -3
  188. package/src/sap/fe/core/messagebundle_hi.properties +2 -0
  189. package/src/sap/fe/core/messagebundle_hr.properties +5 -3
  190. package/src/sap/fe/core/messagebundle_hu.properties +2 -0
  191. package/src/sap/fe/core/messagebundle_id.properties +2 -0
  192. package/src/sap/fe/core/messagebundle_it.properties +2 -0
  193. package/src/sap/fe/core/messagebundle_iw.properties +2 -0
  194. package/src/sap/fe/core/messagebundle_ja.properties +2 -0
  195. package/src/sap/fe/core/messagebundle_kk.properties +2 -0
  196. package/src/sap/fe/core/messagebundle_ko.properties +2 -0
  197. package/src/sap/fe/core/messagebundle_lt.properties +2 -0
  198. package/src/sap/fe/core/messagebundle_lv.properties +5 -3
  199. package/src/sap/fe/core/messagebundle_ms.properties +2 -0
  200. package/src/sap/fe/core/messagebundle_nl.properties +2 -0
  201. package/src/sap/fe/core/messagebundle_no.properties +2 -0
  202. package/src/sap/fe/core/messagebundle_pl.properties +5 -3
  203. package/src/sap/fe/core/messagebundle_pt.properties +2 -0
  204. package/src/sap/fe/core/messagebundle_pt_PT.properties +2 -0
  205. package/src/sap/fe/core/messagebundle_ro.properties +5 -3
  206. package/src/sap/fe/core/messagebundle_ru.properties +5 -3
  207. package/src/sap/fe/core/messagebundle_sh.properties +2 -0
  208. package/src/sap/fe/core/messagebundle_sk.properties +2 -0
  209. package/src/sap/fe/core/messagebundle_sl.properties +2 -0
  210. package/src/sap/fe/core/messagebundle_sv.properties +3 -1
  211. package/src/sap/fe/core/messagebundle_th.properties +2 -0
  212. package/src/sap/fe/core/messagebundle_tr.properties +2 -0
  213. package/src/sap/fe/core/messagebundle_uk.properties +2 -0
  214. package/src/sap/fe/core/messagebundle_vi.properties +2 -0
  215. package/src/sap/fe/core/messagebundle_zh_CN.properties +5 -3
  216. package/src/sap/fe/core/messagebundle_zh_TW.properties +5 -3
  217. package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +4 -4
  218. package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +1 -1
  219. package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +5 -5
  220. package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +1 -2
  221. package/src/sap/fe/core/services/EnvironmentServiceFactory.js +7 -7
  222. package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +6 -5
  223. package/src/sap/fe/core/services/NavigationServiceFactory.js +4 -4
  224. package/src/sap/fe/core/services/NavigationServiceFactory.ts +1 -1
  225. package/src/sap/fe/core/services/ResourceModelServiceFactory.js +4 -4
  226. package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +1 -1
  227. package/src/sap/fe/core/services/RoutingServiceFactory.js +98 -62
  228. package/src/sap/fe/core/services/RoutingServiceFactory.ts +51 -42
  229. package/src/sap/fe/core/services/ShellServicesFactory.js +69 -29
  230. package/src/sap/fe/core/services/ShellServicesFactory.ts +26 -29
  231. package/src/sap/fe/core/services/SideEffectsServiceFactory.js +4 -4
  232. package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +1 -1
  233. package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +8 -8
  234. package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +6 -17
  235. package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.js +43 -5
  236. package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.ts +6 -3
  237. package/src/sap/fe/core/support/CommonHelper.js +1 -1
  238. package/src/sap/fe/core/support/CommonHelper.ts +0 -3
  239. package/src/sap/fe/core/templating/DataModelPathHelper.js +2 -9
  240. package/src/sap/fe/core/templating/DataModelPathHelper.ts +32 -38
  241. package/src/sap/fe/core/templating/DisplayModeFormatter.js +23 -3
  242. package/src/sap/fe/core/templating/DisplayModeFormatter.ts +26 -5
  243. package/src/sap/fe/core/templating/PropertyHelper.js +15 -1
  244. package/src/sap/fe/core/templating/PropertyHelper.ts +30 -23
  245. package/src/sap/fe/core/templating/UIFormatters.js +121 -21
  246. package/src/sap/fe/core/templating/UIFormatters.ts +134 -49
  247. package/src/sap/fe/core/type/Email.js +26 -8
  248. package/src/sap/fe/core/type/Email.ts +8 -7
  249. package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.js +0 -78
  250. package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.ts +0 -65
@@ -0,0 +1,431 @@
1
+ import ManagedObject from "sap/ui/base/ManagedObject";
2
+ import XMLPreprocessor from "sap/ui/core/util/XMLPreprocessor";
3
+ //Trace information
4
+ const aTraceInfo: any[] = [
5
+ /* Structure for a macro
6
+ {
7
+ macro: '', //name of macro
8
+ metaDataContexts: [ //Properties of type sap.ui.model.Context
9
+ {
10
+ name: '', //context property name / key
11
+ path: '', //from oContext.getPath()
12
+ }
13
+ ],
14
+ properties: { // Other properties which become part of {this>}
15
+ property1: value,
16
+ property2: value
17
+ }
18
+ viewInfo: {
19
+ viewInfo: {} // As specified in view or fragement creation
20
+ },
21
+ traceID: this.index, //ID for this trace information,
22
+ macroInfo: {
23
+ macroID: index, // traceID of this macro (redundant for macros)
24
+ parentMacroID, index // traceID of the parent macro (if it has a parent)
25
+ }
26
+ }
27
+ // Structure for a control
28
+ {
29
+ control: '', //control class
30
+ properties: { // Other properties which become part of {this>}
31
+ property1: {
32
+ originalValue: '', //Value before templating
33
+ resolvedValue: '' //Value after templating
34
+ }
35
+ }
36
+ contexts: { //Models and Contexts used during templating
37
+ // Model or context name used for this control
38
+ modelName1: { // For ODataMetaModel
39
+ path1: {
40
+ path: '', //absolut path within metamodel
41
+ data: '', //data of path unless type Object
42
+ }
43
+ modelName2: {
44
+ // for other model types
45
+ {
46
+ property1: value,
47
+ property2: value
48
+ }
49
+ // In case binding cannot be resolved -> mark as runtime binding
50
+ // This is not always true, e.g. in case the path is metamodelpath
51
+ {
52
+ "bindingFor": "Runtime"
53
+ }
54
+ }
55
+ },
56
+ viewInfo: {
57
+ viewInfo: {} // As specified in view or fragement creation
58
+ },
59
+ macroInfo: {
60
+ macroID: index, // traceID of the macro that created this control
61
+ parentMacroID, index // traceID of the macro's parent macro
62
+ },
63
+ traceID: this.index //ID for this trace information
64
+ }
65
+ */
66
+ ];
67
+ const traceNamespace = "http://schemas.sap.com/sapui5/extension/sap.fe.info/1",
68
+ xmlns = "http://www.w3.org/2000/xmlns/",
69
+ /**
70
+ * Switch is currently based on url parameter
71
+ */
72
+ traceIsOn = location.search.indexOf("sap-ui-xx-feTraceInfo=true") > -1,
73
+ /**
74
+ * Specify all namespaces that shall be traced during templating
75
+ */
76
+ aNamespaces = [
77
+ "sap.m",
78
+ "sap.uxap",
79
+ "sap.ui.unified",
80
+ "sap.f",
81
+ "sap.ui.table",
82
+ "sap.suite.ui.microchart",
83
+ "sap.ui.layout.form",
84
+ "sap.ui.mdc",
85
+ "sap.ui.mdc.link",
86
+ "sap.ui.mdc.field",
87
+ "sap.fe.fpm"
88
+ ],
89
+ oCallbacks: any = {};
90
+
91
+ function fnClone(oObject: any) {
92
+ return JSON.parse(JSON.stringify(oObject));
93
+ }
94
+ function collectContextInfo(sValue: any, oContexts: any, oVisitor: any, oNode: any) {
95
+ let aContexts;
96
+ const aPromises: any[] = [];
97
+ try {
98
+ aContexts = (ManagedObject as any).bindingParser(sValue, undefined, false, true) || [];
99
+ } catch (e) {
100
+ aContexts = [];
101
+ }
102
+ aContexts = Array.isArray(aContexts) ? aContexts : [aContexts];
103
+ aContexts
104
+ .filter(function (oContext: any) {
105
+ return oContext.path || oContext.parts;
106
+ })
107
+ .forEach(function (oContext: any) {
108
+ const aParts = oContext.parts || [oContext];
109
+ aParts
110
+ .filter(function (oContext: any) {
111
+ return oContext.path;
112
+ })
113
+ .forEach(function (oContext: any) {
114
+ const oModel = (oContexts[oContext.model] = oContexts[oContext.model] || {});
115
+ const sSimplePath =
116
+ oContext.path.indexOf(">") < 0 ? (oContext.model && oContext.model + ">") + oContext.path : oContext.path;
117
+ let oRealContext: any;
118
+ let aParts;
119
+
120
+ if (typeof oContext.model === "undefined" && sSimplePath.indexOf(">") > -1) {
121
+ aParts = sSimplePath.split(">");
122
+ oContext.model = aParts[0];
123
+ oContext.path = aParts[1];
124
+ }
125
+ try {
126
+ oRealContext = oVisitor.getContext(sSimplePath);
127
+ aPromises.push(
128
+ oVisitor
129
+ .getResult("{" + sSimplePath + "}", oNode)
130
+ .then(function (oResult: any) {
131
+ if (oRealContext.getModel().getMetadata().getName() === "sap.ui.model.json.JSONModel") {
132
+ if (!oResult.oModel) {
133
+ oModel[oContext.path] = oResult; //oRealContext.getObject(oContext.path);
134
+ } else {
135
+ oModel[oContext.path] = "Context from " + oResult.getPath();
136
+ }
137
+ } else {
138
+ oModel[oContext.path] = {
139
+ path: oRealContext.getPath(),
140
+ data: typeof oResult === "object" ? "[ctrl/cmd-click] on path to see data" : oResult
141
+ };
142
+ }
143
+ })
144
+ .catch(function () {
145
+ oModel[oContext.path] = {
146
+ bindingFor: "Runtime"
147
+ };
148
+ })
149
+ );
150
+ } catch (exc) {
151
+ oModel[oContext.path] = {
152
+ bindingFor: "Runtime"
153
+ };
154
+ }
155
+ });
156
+ });
157
+ return Promise.all(aPromises);
158
+ }
159
+ function fillAttributes(oResults: any, oAttributes: any, sName: any, sValue: any) {
160
+ return oResults
161
+ .then(function (result: any) {
162
+ oAttributes[sName] =
163
+ sValue !== result
164
+ ? {
165
+ originalValue: sValue,
166
+ resolvedValue: result
167
+ }
168
+ : sValue;
169
+ })
170
+ .catch(function (e: any) {
171
+ oAttributes[sName] = {
172
+ originalValue: sValue,
173
+ error: (e.stack && e.stack.toString()) || e
174
+ };
175
+ });
176
+ }
177
+ function collectInfo(oNode: any, oVisitor: any) {
178
+ const oAttributes = {};
179
+ const aPromises = [];
180
+ const oContexts = {};
181
+ let oResults;
182
+ for (let i = oNode.attributes.length >>> 0; i--; ) {
183
+ const oAttribute = oNode.attributes[i],
184
+ sName = oAttribute.nodeName,
185
+ sValue = oNode.getAttribute(sName);
186
+ if (!["core:require"].includes(sName)) {
187
+ aPromises.push(collectContextInfo(sValue, oContexts, oVisitor, oNode));
188
+ oResults = oVisitor.getResult(sValue, oNode);
189
+ if (oResults) {
190
+ aPromises.push(fillAttributes(oResults, oAttributes, sName, sValue));
191
+ } else {
192
+ //What
193
+ }
194
+ }
195
+ }
196
+ return Promise.all(aPromises).then(function () {
197
+ return { properties: oAttributes, contexts: oContexts };
198
+ });
199
+ }
200
+ function resolve(oNode: any, oVisitor: any) {
201
+ const sControlName = oNode.nodeName.split(":")[1] || oNode.nodeName,
202
+ bIsControl = /^[A-Z]/.test(sControlName),
203
+ oTraceMetadataContext: any = {
204
+ control: oNode.namespaceURI + "." + (oNode.nodeName.split(":")[1] || oNode.nodeName)
205
+ };
206
+
207
+ if (bIsControl) {
208
+ if (!oNode.ownerDocument.firstChild.getAttribute("xmlns:trace")) {
209
+ oNode.ownerDocument.firstChild.setAttributeNS(xmlns, "xmlns:trace", traceNamespace);
210
+ oNode.ownerDocument.firstChild.setAttributeNS(traceNamespace, "trace:is", "on");
211
+ }
212
+ return collectInfo(oNode, oVisitor)
213
+ .then(function (result: { properties: {}; contexts: {} }) {
214
+ const bRelevant = Object.keys(result.contexts).length > 0; //If no context was used it is not relevant so we ignore Object.keys(result.properties).length
215
+ if (bRelevant) {
216
+ Object.assign(oTraceMetadataContext, result);
217
+ oTraceMetadataContext.viewInfo = oVisitor.getViewInfo();
218
+ oTraceMetadataContext.macroInfo = oVisitor.getSettings()["_macroInfo"];
219
+ oTraceMetadataContext.traceID = aTraceInfo.length;
220
+ oNode.setAttributeNS(traceNamespace, "trace:traceID", oTraceMetadataContext.traceID);
221
+ aTraceInfo.push(oTraceMetadataContext);
222
+ }
223
+ return oVisitor.visitAttributes(oNode).then(function () {
224
+ return oVisitor.visitChildNodes(oNode);
225
+ });
226
+ })
227
+ .catch(function (exc: any) {
228
+ oTraceMetadataContext.error = {
229
+ exception: exc,
230
+ node: new XMLSerializer().serializeToString(oNode)
231
+ };
232
+ });
233
+ } else {
234
+ return oVisitor.visitAttributes(oNode).then(function () {
235
+ return oVisitor.visitChildNodes(oNode);
236
+ });
237
+ }
238
+ }
239
+ /**
240
+ * Register path-through XMLPreprocessor plugin for all namespaces
241
+ * given above in aNamespaces
242
+ */
243
+ if (traceIsOn) {
244
+ aNamespaces.forEach(function (namespace: string) {
245
+ oCallbacks[namespace] = XMLPreprocessor.plugIn(resolve.bind(namespace), namespace);
246
+ });
247
+ }
248
+ /**
249
+ * Adds information about the processing of one macro to the collection.
250
+ *
251
+ * @name sap.fe.macros.TraceInfo.traceMacroCalls
252
+ * @param {string} sName Macro class name
253
+ * @param {object} oMetadata Definition from (macro).metadata.js
254
+ * @param {object} mContexts Available named contexts
255
+ * @param {XMLNode} oNode
256
+ * @param {object} oVisitor
257
+ * @returns {object}
258
+ * @private
259
+ * @ui5-restricted
260
+ * @static
261
+ */
262
+ function traceMacroCalls(sName: string, oMetadata: any, mContexts: any, oNode: any, oVisitor: any) {
263
+ let aMetadataContextKeys = (oMetadata.metadataContexts && Object.keys(oMetadata.metadataContexts)) || [];
264
+ const aProperties = (oMetadata.properties && Object.keys(oMetadata.properties)) || [];
265
+ const macroInfo = fnClone(oVisitor.getSettings()["_macroInfo"] || {});
266
+ const oTraceMetadataContext: any = {
267
+ macro: sName,
268
+ metaDataContexts: [] as any[],
269
+ properties: {}
270
+ };
271
+
272
+ if (aMetadataContextKeys.length === 0) {
273
+ //In case the macro has not metadata.js we take all metadataContexts except this
274
+ aMetadataContextKeys = Object.keys(mContexts).filter(function (name: string) {
275
+ return name !== "this";
276
+ });
277
+ }
278
+
279
+ if (!oNode.getAttribute("xmlns:trace")) {
280
+ oNode.setAttributeNS(xmlns, "xmlns:trace", traceNamespace);
281
+ }
282
+
283
+ if (aMetadataContextKeys.length > 0) {
284
+ aMetadataContextKeys.forEach(function (sKey: any) {
285
+ const oContext = mContexts[sKey],
286
+ oMetaDataContext: any = oContext && {
287
+ name: sKey,
288
+ path: oContext.getPath()
289
+ //data: JSON.stringify(oContext.getObject(),null,2)
290
+ };
291
+
292
+ if (oMetaDataContext) {
293
+ oTraceMetadataContext.metaDataContexts.push(oMetaDataContext);
294
+ }
295
+ });
296
+
297
+ aProperties.forEach(function (sKey: any) {
298
+ const //oPropertySettings = oMetadata.properties[sKey],
299
+ oProperty = mContexts.this.getObject(sKey);
300
+ // (oNode.hasAttribute(sKey) && oNode.getAttribute(sKey)) ||
301
+ // (oPropertySettings.hasOwnProperty("defaultValue") && oPropertySettings.define) ||
302
+ // false;
303
+
304
+ if (oProperty) {
305
+ oTraceMetadataContext.properties[sKey] = oProperty;
306
+ }
307
+ });
308
+ oTraceMetadataContext.viewInfo = oVisitor.getViewInfo();
309
+ oTraceMetadataContext.traceID = aTraceInfo.length;
310
+ macroInfo.parentMacroID = macroInfo.macroID;
311
+ macroInfo.macroID = oTraceMetadataContext.traceID;
312
+ oTraceMetadataContext.macroInfo = macroInfo;
313
+ oNode.setAttributeNS(traceNamespace, "trace:macroID", oTraceMetadataContext.traceID);
314
+ aTraceInfo.push(oTraceMetadataContext);
315
+ return oTraceMetadataContext;
316
+ }
317
+ }
318
+ /**
319
+ * Returns the globally stored trace information for the macro or
320
+ * control marked with the given id.
321
+ *
322
+ * Returns all trace information if no id is specified
323
+ *
324
+ *
325
+ <pre>Structure for a macro
326
+ {
327
+ macro: '', //name of macro
328
+ metaDataContexts: [ //Properties of type sap.ui.model.Context
329
+ {
330
+ name: '', //context property name / key
331
+ path: '', //from oContext.getPath()
332
+ }
333
+ ],
334
+ properties: { // Other properties which become part of {this>}
335
+ property1: value,
336
+ property2: value
337
+ }
338
+ viewInfo: {
339
+ viewInfo: {} // As specified in view or fragement creation
340
+ },
341
+ traceID: this.index, //ID for this trace information,
342
+ macroInfo: {
343
+ macroID: index, // traceID of this macro (redundant for macros)
344
+ parentMacroID, index // traceID of the parent macro (if it has a parent)
345
+ }
346
+ }
347
+ Structure for a control
348
+ {
349
+ control: '', //control class
350
+ properties: { // Other properties which become part of {this>}
351
+ property1: {
352
+ originalValue: '', //Value before templating
353
+ resolvedValue: '' //Value after templating
354
+ }
355
+ }
356
+ contexts: { //Models and Contexts used during templating
357
+ // Model or context name used for this control
358
+ modelName1: { // For ODataMetaModel
359
+ path1: {
360
+ path: '', //absolut path within metamodel
361
+ data: '', //data of path unless type Object
362
+ }
363
+ modelName2: {
364
+ // for other model types
365
+ {
366
+ property1: value,
367
+ property2: value
368
+ }
369
+ // In case binding cannot be resolved -> mark as runtime binding
370
+ // This is not always true, e.g. in case the path is metamodelpath
371
+ {
372
+ "bindingFor": "Runtime"
373
+ }
374
+ }
375
+ },
376
+ viewInfo: {
377
+ viewInfo: {} // As specified in view or fragement creation
378
+ },
379
+ macroInfo: {
380
+ macroID: index, // traceID of the macro that created this control
381
+ parentMacroID, index // traceID of the macro's parent macro
382
+ },
383
+ traceID: this.index //ID for this trace information
384
+ }</pre>.
385
+ *
386
+ * @function
387
+ * @name sap.fe.macros.TraceInfo.getTraceInfo
388
+ * @param {number} id TraceInfo id
389
+ * @returns {object|Array} Object / Array for TraceInfo
390
+ * @private
391
+ * @static
392
+ */
393
+ function getTraceInfo(id: number) {
394
+ if (id) {
395
+ return aTraceInfo[id];
396
+ }
397
+ const aErrors = aTraceInfo.filter(function (traceInfo: any) {
398
+ return traceInfo.error;
399
+ });
400
+ return (aErrors.length > 0 && aErrors) || aTraceInfo;
401
+ }
402
+ /**
403
+ * Returns true if TraceInfo is active.
404
+ *
405
+ * @function
406
+ * @name sap.fe.macros.TraceInfo.isTraceInfoActive
407
+ * @returns {boolean} `true` when active
408
+ * @private
409
+ * @static
410
+ */
411
+ function isTraceInfoActive() {
412
+ return traceIsOn;
413
+ }
414
+ /**
415
+ * @typedef sap.fe.macros.TraceInfo
416
+ * TraceInfo for SAP Fiori elements
417
+ *
418
+ * Once traces is switched, information about macros and controls
419
+ * that are processed during xml preprocessing ( @see {@link sap.ui.core.util.XMLPreprocessor})
420
+ * will be collected within this singleton
421
+ * @namespace
422
+ * @private
423
+ * @global
424
+ * @experimental This module is only for experimental use! <br/><b>This is only a POC and maybe deleted</b>
425
+ * @since 1.74.0
426
+ */
427
+ export default {
428
+ isTraceInfoActive: isTraceInfoActive,
429
+ traceMacroCalls: traceMacroCalls,
430
+ getTraceInfo: getTraceInfo
431
+ };