@sap/ux-specification 1.96.2 → 1.96.5

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 (449) hide show
  1. package/CHANGELOG.md +66 -3
  2. package/dist/documentation/runDocu-min.js +1 -1
  3. package/dist/documentation/styleDocu.css +7 -14
  4. package/dist/documentation/v2/v2-AnalyticalListPage.html +1 -1
  5. package/dist/documentation/v2/v2-ApplicationV2.html +1 -1
  6. package/dist/documentation/v2/v2-ListReport.html +1 -1
  7. package/dist/documentation/v2/v2-ObjectPage.html +1 -1
  8. package/dist/documentation/v2/v2-OverviewPage.html +1 -1
  9. package/dist/documentation/v4/v4-AnalyticalListPage.html +1 -1
  10. package/dist/documentation/v4/v4-ApplicationV4.html +1 -1
  11. package/dist/documentation/v4/v4-ListReport.html +1 -1
  12. package/dist/documentation/v4/v4-ObjectPage.html +1 -1
  13. package/dist/index-min.js +1 -1
  14. package/dist/index-min.js.LICENSE.txt +0 -71
  15. package/dist/schemas/v2/AnalyticalListPageConfig.json +175 -15
  16. package/dist/schemas/v2/ApplicationV2.json +31 -0
  17. package/dist/schemas/v2/ListReportConfig.json +187 -15
  18. package/dist/schemas/v2/ObjectPageConfig.json +127 -33
  19. package/dist/schemas/v2/OverviewPageConfig.json +57 -16
  20. package/dist/schemas/v4/AnalyticalListPageConfig.json +122 -76
  21. package/dist/schemas/v4/ListReportConfig.json +122 -76
  22. package/dist/schemas/v4/ObjectPageConfig.json +144 -64
  23. package/dist/specification/v2/index-min.js +1 -1
  24. package/dist/specification/v4/index-min.js +1 -1
  25. package/dist/src/apiTypes.d.ts +5 -2
  26. package/dist/src/specification/v2/ApplicationV2.d.ts +21 -0
  27. package/dist/src/specification/v2/controls/Action.d.ts +19 -2
  28. package/dist/src/specification/v2/controls/FilterBar.d.ts +70 -22
  29. package/dist/src/specification/v2/controls/Footer.d.ts +20 -0
  30. package/dist/src/specification/v2/controls/ObjectPageTable.d.ts +4 -0
  31. package/dist/src/specification/v2/controls/Table.d.ts +12 -1
  32. package/dist/src/specification/v2/controls/ToolBar.d.ts +1 -8
  33. package/dist/src/specification/v2/controls/index.d.ts +1 -2
  34. package/dist/src/specification/v2/pages/AnalyticalListPageConfig.d.ts +2 -1
  35. package/dist/src/specification/v2/pages/ListReportConfig.d.ts +2 -1
  36. package/dist/src/specification/v2/pages/OverviewPageConfig.d.ts +36 -2
  37. package/dist/src/specification/v4/controls/ObjectPageFooter.d.ts +2 -2
  38. package/dist/src/specification/v4/controls/ObjectPageSection.d.ts +7 -7
  39. package/dist/src/specification/v4/controls/ObjectPageTable.d.ts +21 -6
  40. package/dist/src/specification/v4/controls/Table.d.ts +1 -6
  41. package/dist/src/specification/v4/webapp/manifest/ManifestSettings.d.ts +59 -10
  42. package/dist/src/sync/common/decoration/control.d.ts +11 -1
  43. package/dist/src/sync/common/generate/objectPage.d.ts +9 -0
  44. package/dist/src/sync/common/generate/utils.d.ts +30 -1
  45. package/dist/src/sync/common/import/utils.d.ts +8 -1
  46. package/dist/src/sync/common/types.d.ts +30 -16
  47. package/dist/src/sync/common/utils.d.ts +4 -3
  48. package/dist/src/sync/v2/application.d.ts +3 -1
  49. package/dist/src/sync/v2/export/controls/Action.d.ts +15 -0
  50. package/dist/src/sync/v2/export/controls/FilterBar.d.ts +18 -6
  51. package/dist/src/sync/v2/export/controls/Fragment.d.ts +1 -1
  52. package/dist/src/sync/v2/export/controls/ObjectPageFooterAction.d.ts +2 -2
  53. package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.d.ts +2 -2
  54. package/dist/src/sync/v2/export/controls/ObjectPageTable.d.ts +1 -0
  55. package/dist/src/sync/v2/export/controls/Table.d.ts +1 -0
  56. package/dist/src/sync/v2/export/controls/TableColumn.d.ts +18 -2
  57. package/dist/src/sync/v2/export/pages/AnalyticalListPage.d.ts +2 -1
  58. package/dist/src/sync/v2/export/pages/ListReport.d.ts +2 -1
  59. package/dist/src/sync/v2/export/pages/OverviewPage.d.ts +2 -1
  60. package/dist/src/sync/v2/export/view-controller-generator.d.ts +16 -21
  61. package/dist/src/sync/v2/generate/objectPage.d.ts +1 -5
  62. package/dist/src/sync/v2/generate/utils.d.ts +22 -11
  63. package/dist/src/sync/v2/import/common/index.d.ts +22 -4
  64. package/dist/src/sync/v2/import/pages/listReport.d.ts +0 -5
  65. package/dist/src/sync/v2/import/utils.d.ts +4 -6
  66. package/dist/src/sync/v2/types.d.ts +8 -1
  67. package/dist/src/sync/v4/export/controls/ObjectPageTableColumn.d.ts +13 -4
  68. package/dist/src/sync/v4/export/controls/TableColumn.d.ts +10 -2
  69. package/dist/src/sync/v4/export/controls/ToolBar.d.ts +5 -1
  70. package/dist/src/sync/v4/export/exportCustomColumn.d.ts +13 -0
  71. package/dist/src/sync/v4/export/pages/AnalyticalListPage.d.ts +2 -2
  72. package/dist/src/sync/v4/export/pages/ListReport.d.ts +2 -2
  73. package/dist/src/sync/v4/export/pages/ObjectPage.d.ts +2 -2
  74. package/dist/src/sync/v4/export/types.d.ts +3 -0
  75. package/dist/src/sync/v4/generate/generate.d.ts +4 -2
  76. package/dist/src/sync/v4/generate/listReport.d.ts +7 -6
  77. package/dist/src/sync/v4/import/pages/analyticalListPage.d.ts +2 -2
  78. package/dist/src/sync/v4/import/pages/listReport.d.ts +3 -3
  79. package/dist/src/sync/v4/import/pages/objectPage.d.ts +2 -2
  80. package/dist/src/sync/v4/utils/utils.d.ts +32 -1
  81. package/dist/test/unit/utils.test.d.ts +1 -1
  82. package/package.json +19 -17
  83. package/dist/scripts/extractDocu.js +0 -488
  84. package/dist/scripts/extractDocu.js.map +0 -1
  85. package/dist/scripts/runDocu.js +0 -577
  86. package/dist/scripts/runDocu.js.map +0 -1
  87. package/dist/scripts/spec.js +0 -114
  88. package/dist/scripts/spec.js.map +0 -1
  89. package/dist/scripts/to-json-schema.js +0 -130
  90. package/dist/scripts/to-json-schema.js.map +0 -1
  91. package/dist/src/api.js +0 -184
  92. package/dist/src/api.js.map +0 -1
  93. package/dist/src/apiTypes.js +0 -17
  94. package/dist/src/apiTypes.js.map +0 -1
  95. package/dist/src/extensionLogger.js +0 -39
  96. package/dist/src/extensionLogger.js.map +0 -1
  97. package/dist/src/i18n/i18n.js +0 -25
  98. package/dist/src/i18n/i18n.js.map +0 -1
  99. package/dist/src/index.js +0 -13
  100. package/dist/src/index.js.map +0 -1
  101. package/dist/src/project.js +0 -143
  102. package/dist/src/project.js.map +0 -1
  103. package/dist/src/specification/common/Application.js +0 -3
  104. package/dist/src/specification/common/Application.js.map +0 -1
  105. package/dist/src/specification/common/i18n.json +0 -1
  106. package/dist/src/specification/common/index.js +0 -10
  107. package/dist/src/specification/common/index.js.map +0 -1
  108. package/dist/src/specification/common/page.js +0 -33
  109. package/dist/src/specification/common/page.js.map +0 -1
  110. package/dist/src/specification/common/types.js +0 -20
  111. package/dist/src/specification/common/types.js.map +0 -1
  112. package/dist/src/specification/common/webapp/manifest/Manifest.js +0 -17
  113. package/dist/src/specification/common/webapp/manifest/Manifest.js.map +0 -1
  114. package/dist/src/specification/common/webapp/manifest/index.js +0 -8
  115. package/dist/src/specification/common/webapp/manifest/index.js.map +0 -1
  116. package/dist/src/specification/common/webapp/manifest/sapOvp.js +0 -9
  117. package/dist/src/specification/common/webapp/manifest/sapOvp.js.map +0 -1
  118. package/dist/src/specification/common/webapp/manifest/sapUi5.js +0 -14
  119. package/dist/src/specification/common/webapp/manifest/sapUi5.js.map +0 -1
  120. package/dist/src/specification/schemaAccess.js +0 -65
  121. package/dist/src/specification/schemaAccess.js.map +0 -1
  122. package/dist/src/specification/v2/ApplicationV2.js +0 -9
  123. package/dist/src/specification/v2/ApplicationV2.js.map +0 -1
  124. package/dist/src/specification/v2/controls/Action.js +0 -3
  125. package/dist/src/specification/v2/controls/Action.js.map +0 -1
  126. package/dist/src/specification/v2/controls/AnalyticalListPageChart.js +0 -36
  127. package/dist/src/specification/v2/controls/AnalyticalListPageChart.js.map +0 -1
  128. package/dist/src/specification/v2/controls/AnalyticalListPageKPI.js +0 -3
  129. package/dist/src/specification/v2/controls/AnalyticalListPageKPI.js.map +0 -1
  130. package/dist/src/specification/v2/controls/Card.js +0 -72
  131. package/dist/src/specification/v2/controls/Card.js.map +0 -1
  132. package/dist/src/specification/v2/controls/Facets.js +0 -3
  133. package/dist/src/specification/v2/controls/Facets.js.map +0 -1
  134. package/dist/src/specification/v2/controls/Field.js +0 -3
  135. package/dist/src/specification/v2/controls/Field.js.map +0 -1
  136. package/dist/src/specification/v2/controls/FilterBar.js +0 -54
  137. package/dist/src/specification/v2/controls/FilterBar.js.map +0 -1
  138. package/dist/src/specification/v2/controls/ObjectPageChart.js +0 -3
  139. package/dist/src/specification/v2/controls/ObjectPageChart.js.map +0 -1
  140. package/dist/src/specification/v2/controls/ObjectPageFooter.d.ts +0 -11
  141. package/dist/src/specification/v2/controls/ObjectPageFooter.js +0 -3
  142. package/dist/src/specification/v2/controls/ObjectPageFooter.js.map +0 -1
  143. package/dist/src/specification/v2/controls/ObjectPageFooterAction.d.ts +0 -28
  144. package/dist/src/specification/v2/controls/ObjectPageFooterAction.js +0 -3
  145. package/dist/src/specification/v2/controls/ObjectPageFooterAction.js.map +0 -1
  146. package/dist/src/specification/v2/controls/ObjectPageForm.js +0 -3
  147. package/dist/src/specification/v2/controls/ObjectPageForm.js.map +0 -1
  148. package/dist/src/specification/v2/controls/ObjectPageHeader.js +0 -3
  149. package/dist/src/specification/v2/controls/ObjectPageHeader.js.map +0 -1
  150. package/dist/src/specification/v2/controls/ObjectPageLayout.js +0 -3
  151. package/dist/src/specification/v2/controls/ObjectPageLayout.js.map +0 -1
  152. package/dist/src/specification/v2/controls/ObjectPageSection.js +0 -13
  153. package/dist/src/specification/v2/controls/ObjectPageSection.js.map +0 -1
  154. package/dist/src/specification/v2/controls/ObjectPageTable.js +0 -7
  155. package/dist/src/specification/v2/controls/ObjectPageTable.js.map +0 -1
  156. package/dist/src/specification/v2/controls/ObjectPageToolBar.js +0 -3
  157. package/dist/src/specification/v2/controls/ObjectPageToolBar.js.map +0 -1
  158. package/dist/src/specification/v2/controls/Table.js +0 -42
  159. package/dist/src/specification/v2/controls/Table.js.map +0 -1
  160. package/dist/src/specification/v2/controls/ToolBar.js +0 -3
  161. package/dist/src/specification/v2/controls/ToolBar.js.map +0 -1
  162. package/dist/src/specification/v2/controls/index.js +0 -12
  163. package/dist/src/specification/v2/controls/index.js.map +0 -1
  164. package/dist/src/specification/v2/index.js +0 -10
  165. package/dist/src/specification/v2/index.js.map +0 -1
  166. package/dist/src/specification/v2/page.js +0 -3
  167. package/dist/src/specification/v2/page.js.map +0 -1
  168. package/dist/src/specification/v2/pages/AnalyticalListPageConfig.js +0 -3
  169. package/dist/src/specification/v2/pages/AnalyticalListPageConfig.js.map +0 -1
  170. package/dist/src/specification/v2/pages/ListReportConfig.js +0 -3
  171. package/dist/src/specification/v2/pages/ListReportConfig.js.map +0 -1
  172. package/dist/src/specification/v2/pages/ObjectPageConfig.js +0 -3
  173. package/dist/src/specification/v2/pages/ObjectPageConfig.js.map +0 -1
  174. package/dist/src/specification/v2/pages/OverviewPageConfig.js +0 -8
  175. package/dist/src/specification/v2/pages/OverviewPageConfig.js.map +0 -1
  176. package/dist/src/specification/v2/pages/index.js +0 -7
  177. package/dist/src/specification/v2/pages/index.js.map +0 -1
  178. package/dist/src/specification/v2/webapp/index.js +0 -7
  179. package/dist/src/specification/v2/webapp/index.js.map +0 -1
  180. package/dist/src/specification/v2/webapp/manifest/index.js +0 -8
  181. package/dist/src/specification/v2/webapp/manifest/index.js.map +0 -1
  182. package/dist/src/specification/v2/webapp/manifest/sapUi.js +0 -3
  183. package/dist/src/specification/v2/webapp/manifest/sapUi.js.map +0 -1
  184. package/dist/src/specification/v2/webapp/manifest/sapUi5.js +0 -10
  185. package/dist/src/specification/v2/webapp/manifest/sapUi5.js.map +0 -1
  186. package/dist/src/specification/v2/webapp/manifest/sapUiPageV2.js +0 -7
  187. package/dist/src/specification/v2/webapp/manifest/sapUiPageV2.js.map +0 -1
  188. package/dist/src/specification/v4/ApplicationV4.js +0 -3
  189. package/dist/src/specification/v4/ApplicationV4.js.map +0 -1
  190. package/dist/src/specification/v4/controls/FilterBar.js +0 -3
  191. package/dist/src/specification/v4/controls/FilterBar.js.map +0 -1
  192. package/dist/src/specification/v4/controls/ObjectPageFooter.js +0 -3
  193. package/dist/src/specification/v4/controls/ObjectPageFooter.js.map +0 -1
  194. package/dist/src/specification/v4/controls/ObjectPageHeader.js +0 -3
  195. package/dist/src/specification/v4/controls/ObjectPageHeader.js.map +0 -1
  196. package/dist/src/specification/v4/controls/ObjectPageHeaderSection.js +0 -7
  197. package/dist/src/specification/v4/controls/ObjectPageHeaderSection.js.map +0 -1
  198. package/dist/src/specification/v4/controls/ObjectPageLayout.js +0 -8
  199. package/dist/src/specification/v4/controls/ObjectPageLayout.js.map +0 -1
  200. package/dist/src/specification/v4/controls/ObjectPageSection.js +0 -12
  201. package/dist/src/specification/v4/controls/ObjectPageSection.js.map +0 -1
  202. package/dist/src/specification/v4/controls/ObjectPageTable.js +0 -3
  203. package/dist/src/specification/v4/controls/ObjectPageTable.js.map +0 -1
  204. package/dist/src/specification/v4/controls/ObjectPageToolBar.js +0 -3
  205. package/dist/src/specification/v4/controls/ObjectPageToolBar.js.map +0 -1
  206. package/dist/src/specification/v4/controls/Table.js +0 -30
  207. package/dist/src/specification/v4/controls/Table.js.map +0 -1
  208. package/dist/src/specification/v4/controls/ToolBar.js +0 -8
  209. package/dist/src/specification/v4/controls/ToolBar.js.map +0 -1
  210. package/dist/src/specification/v4/controls/index.js +0 -11
  211. package/dist/src/specification/v4/controls/index.js.map +0 -1
  212. package/dist/src/specification/v4/index.js +0 -9
  213. package/dist/src/specification/v4/index.js.map +0 -1
  214. package/dist/src/specification/v4/page.js +0 -3
  215. package/dist/src/specification/v4/page.js.map +0 -1
  216. package/dist/src/specification/v4/pages/AnalyticalListPageConfig.js +0 -3
  217. package/dist/src/specification/v4/pages/AnalyticalListPageConfig.js.map +0 -1
  218. package/dist/src/specification/v4/pages/ListReportConfig.js +0 -9
  219. package/dist/src/specification/v4/pages/ListReportConfig.js.map +0 -1
  220. package/dist/src/specification/v4/pages/ObjectPageConfig.js +0 -8
  221. package/dist/src/specification/v4/pages/ObjectPageConfig.js.map +0 -1
  222. package/dist/src/specification/v4/pages/index.js +0 -8
  223. package/dist/src/specification/v4/pages/index.js.map +0 -1
  224. package/dist/src/specification/v4/webapp/index.js +0 -7
  225. package/dist/src/specification/v4/webapp/index.js.map +0 -1
  226. package/dist/src/specification/v4/webapp/manifest/ManifestSettings.js +0 -16
  227. package/dist/src/specification/v4/webapp/manifest/ManifestSettings.js.map +0 -1
  228. package/dist/src/specification/v4/webapp/manifest/index.js +0 -10
  229. package/dist/src/specification/v4/webapp/manifest/index.js.map +0 -1
  230. package/dist/src/specification/v4/webapp/manifest/sapUi5.js +0 -11
  231. package/dist/src/specification/v4/webapp/manifest/sapUi5.js.map +0 -1
  232. package/dist/src/specification/v4/webapp/manifest/sapUiPageV4.js +0 -14
  233. package/dist/src/specification/v4/webapp/manifest/sapUiPageV4.js.map +0 -1
  234. package/dist/src/sync/common/appProvider.js +0 -57
  235. package/dist/src/sync/common/appProvider.js.map +0 -1
  236. package/dist/src/sync/common/decoration/control.js +0 -180
  237. package/dist/src/sync/common/decoration/control.js.map +0 -1
  238. package/dist/src/sync/common/decoration/decorators.js +0 -43
  239. package/dist/src/sync/common/decoration/decorators.js.map +0 -1
  240. package/dist/src/sync/common/decoration/factory.js +0 -50
  241. package/dist/src/sync/common/decoration/factory.js.map +0 -1
  242. package/dist/src/sync/common/decoration/flex.js +0 -8
  243. package/dist/src/sync/common/decoration/flex.js.map +0 -1
  244. package/dist/src/sync/common/decoration/index.js +0 -9
  245. package/dist/src/sync/common/decoration/index.js.map +0 -1
  246. package/dist/src/sync/common/flexUtils.js +0 -95
  247. package/dist/src/sync/common/flexUtils.js.map +0 -1
  248. package/dist/src/sync/common/generate/index.js +0 -8
  249. package/dist/src/sync/common/generate/index.js.map +0 -1
  250. package/dist/src/sync/common/generate/objectPage.js +0 -336
  251. package/dist/src/sync/common/generate/objectPage.js.map +0 -1
  252. package/dist/src/sync/common/generate/utils.js +0 -205
  253. package/dist/src/sync/common/generate/utils.js.map +0 -1
  254. package/dist/src/sync/common/i18n.json +0 -21
  255. package/dist/src/sync/common/import/utils.js +0 -75
  256. package/dist/src/sync/common/import/utils.js.map +0 -1
  257. package/dist/src/sync/common/importProject.js +0 -351
  258. package/dist/src/sync/common/importProject.js.map +0 -1
  259. package/dist/src/sync/common/index.js +0 -15
  260. package/dist/src/sync/common/index.js.map +0 -1
  261. package/dist/src/sync/common/types.js +0 -82
  262. package/dist/src/sync/common/types.js.map +0 -1
  263. package/dist/src/sync/common/utils.js +0 -1056
  264. package/dist/src/sync/common/utils.js.map +0 -1
  265. package/dist/src/sync/i18n.js +0 -15
  266. package/dist/src/sync/i18n.js.map +0 -1
  267. package/dist/src/sync/v2/application.js +0 -170
  268. package/dist/src/sync/v2/application.js.map +0 -1
  269. package/dist/src/sync/v2/export/controls/Action.js +0 -74
  270. package/dist/src/sync/v2/export/controls/Action.js.map +0 -1
  271. package/dist/src/sync/v2/export/controls/AnalyticalListPageChart.js +0 -72
  272. package/dist/src/sync/v2/export/controls/AnalyticalListPageChart.js.map +0 -1
  273. package/dist/src/sync/v2/export/controls/AnalyticalListPageKPI.js +0 -56
  274. package/dist/src/sync/v2/export/controls/AnalyticalListPageKPI.js.map +0 -1
  275. package/dist/src/sync/v2/export/controls/Card.js +0 -655
  276. package/dist/src/sync/v2/export/controls/Card.js.map +0 -1
  277. package/dist/src/sync/v2/export/controls/Field.js +0 -32
  278. package/dist/src/sync/v2/export/controls/Field.js.map +0 -1
  279. package/dist/src/sync/v2/export/controls/FilterBar.js +0 -245
  280. package/dist/src/sync/v2/export/controls/FilterBar.js.map +0 -1
  281. package/dist/src/sync/v2/export/controls/FormAction.js +0 -95
  282. package/dist/src/sync/v2/export/controls/FormAction.js.map +0 -1
  283. package/dist/src/sync/v2/export/controls/Fragment.js +0 -401
  284. package/dist/src/sync/v2/export/controls/Fragment.js.map +0 -1
  285. package/dist/src/sync/v2/export/controls/ObjectPageChart.js +0 -37
  286. package/dist/src/sync/v2/export/controls/ObjectPageChart.js.map +0 -1
  287. package/dist/src/sync/v2/export/controls/ObjectPageCustomSection.js +0 -110
  288. package/dist/src/sync/v2/export/controls/ObjectPageCustomSection.js.map +0 -1
  289. package/dist/src/sync/v2/export/controls/ObjectPageFooterAction.js +0 -62
  290. package/dist/src/sync/v2/export/controls/ObjectPageFooterAction.js.map +0 -1
  291. package/dist/src/sync/v2/export/controls/ObjectPageHeader.js +0 -60
  292. package/dist/src/sync/v2/export/controls/ObjectPageHeader.js.map +0 -1
  293. package/dist/src/sync/v2/export/controls/ObjectPageHeaderAction.js +0 -62
  294. package/dist/src/sync/v2/export/controls/ObjectPageHeaderAction.js.map +0 -1
  295. package/dist/src/sync/v2/export/controls/ObjectPageLayout.js +0 -59
  296. package/dist/src/sync/v2/export/controls/ObjectPageLayout.js.map +0 -1
  297. package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.js +0 -144
  298. package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.js.map +0 -1
  299. package/dist/src/sync/v2/export/controls/ObjectPageTable.js +0 -323
  300. package/dist/src/sync/v2/export/controls/ObjectPageTable.js.map +0 -1
  301. package/dist/src/sync/v2/export/controls/ObjectPageToolBarAction.js +0 -59
  302. package/dist/src/sync/v2/export/controls/ObjectPageToolBarAction.js.map +0 -1
  303. package/dist/src/sync/v2/export/controls/Table.js +0 -667
  304. package/dist/src/sync/v2/export/controls/Table.js.map +0 -1
  305. package/dist/src/sync/v2/export/controls/TableColumn.js +0 -41
  306. package/dist/src/sync/v2/export/controls/TableColumn.js.map +0 -1
  307. package/dist/src/sync/v2/export/controls/ToolBar.js +0 -6
  308. package/dist/src/sync/v2/export/controls/ToolBar.js.map +0 -1
  309. package/dist/src/sync/v2/export/controls/index.js +0 -26
  310. package/dist/src/sync/v2/export/controls/index.js.map +0 -1
  311. package/dist/src/sync/v2/export/export.js +0 -592
  312. package/dist/src/sync/v2/export/export.js.map +0 -1
  313. package/dist/src/sync/v2/export/exportPage.js +0 -312
  314. package/dist/src/sync/v2/export/exportPage.js.map +0 -1
  315. package/dist/src/sync/v2/export/factory.js +0 -59
  316. package/dist/src/sync/v2/export/factory.js.map +0 -1
  317. package/dist/src/sync/v2/export/manifest.js +0 -117
  318. package/dist/src/sync/v2/export/manifest.js.map +0 -1
  319. package/dist/src/sync/v2/export/pages/AnalyticalListPage.js +0 -41
  320. package/dist/src/sync/v2/export/pages/AnalyticalListPage.js.map +0 -1
  321. package/dist/src/sync/v2/export/pages/ListReport.js +0 -38
  322. package/dist/src/sync/v2/export/pages/ListReport.js.map +0 -1
  323. package/dist/src/sync/v2/export/pages/ObjectPage.js +0 -100
  324. package/dist/src/sync/v2/export/pages/ObjectPage.js.map +0 -1
  325. package/dist/src/sync/v2/export/pages/OverviewPage.js +0 -178
  326. package/dist/src/sync/v2/export/pages/OverviewPage.js.map +0 -1
  327. package/dist/src/sync/v2/export/pages/index.js +0 -10
  328. package/dist/src/sync/v2/export/pages/index.js.map +0 -1
  329. package/dist/src/sync/v2/export/view-controller-generator.js +0 -157
  330. package/dist/src/sync/v2/export/view-controller-generator.js.map +0 -1
  331. package/dist/src/sync/v2/generate/analyticalListReport.js +0 -87
  332. package/dist/src/sync/v2/generate/analyticalListReport.js.map +0 -1
  333. package/dist/src/sync/v2/generate/generate.js +0 -96
  334. package/dist/src/sync/v2/generate/generate.js.map +0 -1
  335. package/dist/src/sync/v2/generate/index.js +0 -14
  336. package/dist/src/sync/v2/generate/index.js.map +0 -1
  337. package/dist/src/sync/v2/generate/listReport.js +0 -113
  338. package/dist/src/sync/v2/generate/listReport.js.map +0 -1
  339. package/dist/src/sync/v2/generate/objectPage.js +0 -556
  340. package/dist/src/sync/v2/generate/objectPage.js.map +0 -1
  341. package/dist/src/sync/v2/generate/overviewPage.js +0 -73
  342. package/dist/src/sync/v2/generate/overviewPage.js.map +0 -1
  343. package/dist/src/sync/v2/generate/utils.js +0 -347
  344. package/dist/src/sync/v2/generate/utils.js.map +0 -1
  345. package/dist/src/sync/v2/import/app/appProvider.js +0 -122
  346. package/dist/src/sync/v2/import/app/appProvider.js.map +0 -1
  347. package/dist/src/sync/v2/import/app/ovpProvider.js +0 -33
  348. package/dist/src/sync/v2/import/app/ovpProvider.js.map +0 -1
  349. package/dist/src/sync/v2/import/common/index.js +0 -213
  350. package/dist/src/sync/v2/import/common/index.js.map +0 -1
  351. package/dist/src/sync/v2/import/controls/table.js +0 -31
  352. package/dist/src/sync/v2/import/controls/table.js.map +0 -1
  353. package/dist/src/sync/v2/import/getPageType.js +0 -1
  354. package/dist/src/sync/v2/import/getPageType.js.map +0 -1
  355. package/dist/src/sync/v2/import/index.js +0 -11
  356. package/dist/src/sync/v2/import/index.js.map +0 -1
  357. package/dist/src/sync/v2/import/pages/analyticalListPage.js +0 -104
  358. package/dist/src/sync/v2/import/pages/analyticalListPage.js.map +0 -1
  359. package/dist/src/sync/v2/import/pages/listReport.js +0 -234
  360. package/dist/src/sync/v2/import/pages/listReport.js.map +0 -1
  361. package/dist/src/sync/v2/import/pages/objectPage.js +0 -620
  362. package/dist/src/sync/v2/import/pages/objectPage.js.map +0 -1
  363. package/dist/src/sync/v2/import/pages/overviewPage.js +0 -113
  364. package/dist/src/sync/v2/import/pages/overviewPage.js.map +0 -1
  365. package/dist/src/sync/v2/import/utils.js +0 -103
  366. package/dist/src/sync/v2/import/utils.js.map +0 -1
  367. package/dist/src/sync/v2/types.js +0 -26
  368. package/dist/src/sync/v2/types.js.map +0 -1
  369. package/dist/src/sync/v4/application.js +0 -80
  370. package/dist/src/sync/v4/application.js.map +0 -1
  371. package/dist/src/sync/v4/export/controls/FilterBar.js +0 -6
  372. package/dist/src/sync/v4/export/controls/FilterBar.js.map +0 -1
  373. package/dist/src/sync/v4/export/controls/ObjectPageCustomSection.js +0 -136
  374. package/dist/src/sync/v4/export/controls/ObjectPageCustomSection.js.map +0 -1
  375. package/dist/src/sync/v4/export/controls/ObjectPageHeader.js +0 -55
  376. package/dist/src/sync/v4/export/controls/ObjectPageHeader.js.map +0 -1
  377. package/dist/src/sync/v4/export/controls/ObjectPageHeaderSection.js +0 -65
  378. package/dist/src/sync/v4/export/controls/ObjectPageHeaderSection.js.map +0 -1
  379. package/dist/src/sync/v4/export/controls/ObjectPageLayout.js +0 -24
  380. package/dist/src/sync/v4/export/controls/ObjectPageLayout.js.map +0 -1
  381. package/dist/src/sync/v4/export/controls/ObjectPageTable.js +0 -245
  382. package/dist/src/sync/v4/export/controls/ObjectPageTable.js.map +0 -1
  383. package/dist/src/sync/v4/export/controls/ObjectPageTableColumn.js +0 -87
  384. package/dist/src/sync/v4/export/controls/ObjectPageTableColumn.js.map +0 -1
  385. package/dist/src/sync/v4/export/controls/ObjectPageToolBarAction.js +0 -21
  386. package/dist/src/sync/v4/export/controls/ObjectPageToolBarAction.js.map +0 -1
  387. package/dist/src/sync/v4/export/controls/Table.js +0 -318
  388. package/dist/src/sync/v4/export/controls/Table.js.map +0 -1
  389. package/dist/src/sync/v4/export/controls/TableColumn.js +0 -97
  390. package/dist/src/sync/v4/export/controls/TableColumn.js.map +0 -1
  391. package/dist/src/sync/v4/export/controls/ToolBar.js +0 -6
  392. package/dist/src/sync/v4/export/controls/ToolBar.js.map +0 -1
  393. package/dist/src/sync/v4/export/controls/ToolBarAction.js +0 -21
  394. package/dist/src/sync/v4/export/controls/ToolBarAction.js.map +0 -1
  395. package/dist/src/sync/v4/export/controls/index.js +0 -18
  396. package/dist/src/sync/v4/export/controls/index.js.map +0 -1
  397. package/dist/src/sync/v4/export/export.js +0 -418
  398. package/dist/src/sync/v4/export/export.js.map +0 -1
  399. package/dist/src/sync/v4/export/factory.js +0 -44
  400. package/dist/src/sync/v4/export/factory.js.map +0 -1
  401. package/dist/src/sync/v4/export/flexibleColumnLayout.js +0 -114
  402. package/dist/src/sync/v4/export/flexibleColumnLayout.js.map +0 -1
  403. package/dist/src/sync/v4/export/manifest.js +0 -208
  404. package/dist/src/sync/v4/export/manifest.js.map +0 -1
  405. package/dist/src/sync/v4/export/pages/AnalyticalListPage.js +0 -38
  406. package/dist/src/sync/v4/export/pages/AnalyticalListPage.js.map +0 -1
  407. package/dist/src/sync/v4/export/pages/ListReport.js +0 -33
  408. package/dist/src/sync/v4/export/pages/ListReport.js.map +0 -1
  409. package/dist/src/sync/v4/export/pages/ObjectPage.js +0 -39
  410. package/dist/src/sync/v4/export/pages/ObjectPage.js.map +0 -1
  411. package/dist/src/sync/v4/export/pages/index.js +0 -9
  412. package/dist/src/sync/v4/export/pages/index.js.map +0 -1
  413. package/dist/src/sync/v4/export/types.js +0 -3
  414. package/dist/src/sync/v4/export/types.js.map +0 -1
  415. package/dist/src/sync/v4/export/utils.js +0 -26
  416. package/dist/src/sync/v4/export/utils.js.map +0 -1
  417. package/dist/src/sync/v4/generate/generate.js +0 -47
  418. package/dist/src/sync/v4/generate/generate.js.map +0 -1
  419. package/dist/src/sync/v4/generate/index.js +0 -10
  420. package/dist/src/sync/v4/generate/index.js.map +0 -1
  421. package/dist/src/sync/v4/generate/listReport.js +0 -96
  422. package/dist/src/sync/v4/generate/listReport.js.map +0 -1
  423. package/dist/src/sync/v4/generate/objectPage.js +0 -395
  424. package/dist/src/sync/v4/generate/objectPage.js.map +0 -1
  425. package/dist/src/sync/v4/import/app/appProvider.js +0 -313
  426. package/dist/src/sync/v4/import/app/appProvider.js.map +0 -1
  427. package/dist/src/sync/v4/import/fragment.js +0 -130
  428. package/dist/src/sync/v4/import/fragment.js.map +0 -1
  429. package/dist/src/sync/v4/import/index.js +0 -9
  430. package/dist/src/sync/v4/import/index.js.map +0 -1
  431. package/dist/src/sync/v4/import/pages/analyticalListPage.js +0 -61
  432. package/dist/src/sync/v4/import/pages/analyticalListPage.js.map +0 -1
  433. package/dist/src/sync/v4/import/pages/listReport.js +0 -124
  434. package/dist/src/sync/v4/import/pages/listReport.js.map +0 -1
  435. package/dist/src/sync/v4/import/pages/objectPage.js +0 -231
  436. package/dist/src/sync/v4/import/pages/objectPage.js.map +0 -1
  437. package/dist/src/sync/v4/import/utils.js +0 -33
  438. package/dist/src/sync/v4/import/utils.js.map +0 -1
  439. package/dist/src/sync/v4/types.js +0 -3
  440. package/dist/src/sync/v4/types.js.map +0 -1
  441. package/dist/src/sync/v4/utils/StableIdHelper.js +0 -153
  442. package/dist/src/sync/v4/utils/StableIdHelper.js.map +0 -1
  443. package/dist/src/sync/v4/utils/utils.js +0 -94
  444. package/dist/src/sync/v4/utils/utils.js.map +0 -1
  445. package/dist/src/v2.js +0 -8
  446. package/dist/src/v2.js.map +0 -1
  447. package/dist/src/v4.js +0 -8
  448. package/dist/src/v4.js.map +0 -1
  449. package/dist/test/test-utils/metadataParser.d.ts +0 -19
@@ -1,1056 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const types_1 = require("./types");
7
- const annotation_converter_1 = require("@sap-ux/annotation-converter");
8
- const edmx_parser_1 = require("@sap-ux/edmx-parser");
9
- const common_1 = require("../../specification/common");
10
- const schemaAccess_1 = require("../../specification/schemaAccess");
11
- const i18next_1 = __importDefault(require("i18next"));
12
- const v2_1 = require("../../specification/v2");
13
- const v4_1 = require("../../specification/v4");
14
- const extensionLogger_1 = require("../../extensionLogger");
15
- const deepmerge_1 = __importDefault(require("deepmerge"));
16
- var TemplateType;
17
- (function (TemplateType) {
18
- TemplateType["ListReportObjectPageV2"] = "ListReportObjectPageV2";
19
- TemplateType["ListReportObjectPageV4"] = "ListReportObjectPageV4";
20
- TemplateType["OverviewPageV2"] = "OverviewPageV2";
21
- TemplateType["AnalyticalListPageV2"] = "AnalyticalListPageV2";
22
- TemplateType["AnalyticalListPageV4"] = "AnalyticalListPageV4";
23
- })(TemplateType = exports.TemplateType || (exports.TemplateType = {}));
24
- exports.DEFINITION_LINK_PREFIX = '#/definitions/';
25
- /**
26
- * Function returns annotation path for schema based on received params.
27
- * @param entityTypeName - Entity type name.
28
- * @param term - Annotation term.
29
- * @param qualifier - Annotation qualifier.
30
- * @returns Annotation path based on received params
31
- */
32
- exports.createAnnotationPath = (entityTypeName, term, qualifier) => {
33
- let annotationPath = `/${entityTypeName}/@${term}`;
34
- if (qualifier) {
35
- annotationPath += `#${qualifier}`;
36
- }
37
- return annotationPath;
38
- };
39
- /**
40
- * Parses, merges, and converts a list of annotation files with aid of tools from annotation-vocabularies-tools
41
- * @param annotationFiles - The list of all annotation files, in JSON format
42
- * @returns the complete service information
43
- */
44
- function parseAndMergeAndConvert(annotationFiles, logger) {
45
- const parseResult = [];
46
- let converterOutput;
47
- try {
48
- if (annotationFiles) {
49
- annotationFiles.forEach(function (annotationData) {
50
- parseResult.push(edmx_parser_1.parseEDMX(annotationData.fileContent, annotationData.dataSourceUri));
51
- });
52
- }
53
- if (parseResult.length > 0) {
54
- converterOutput = annotation_converter_1.convertTypes(edmx_parser_1.merge(parseResult));
55
- }
56
- if (logger && (converterOutput === null || converterOutput === void 0 ? void 0 : converterOutput.diagnostics)) {
57
- for (const converterMessage of converterOutput.diagnostics) {
58
- extensionLogger_1.log(logger, {
59
- severity: "error" /* Error */,
60
- message: converterMessage.message
61
- });
62
- }
63
- }
64
- return converterOutput;
65
- }
66
- catch (error) {
67
- extensionLogger_1.log(logger, {
68
- severity: "error" /* Error */,
69
- message: i18next_1.default.t('ANNOERR')
70
- }, ...error);
71
- }
72
- }
73
- exports.parseAndMergeAndConvert = parseAndMergeAndConvert;
74
- exports.getAnnotationPropertyValue = (annotationProperty) => (annotationProperty === null || annotationProperty === void 0 ? void 0 : annotationProperty.value) || (annotationProperty === null || annotationProperty === void 0 ? void 0 : annotationProperty.path);
75
- /**
76
- * Checks for Common.Label and overwrites the label from it if present
77
- * @param {PropertyAnnotations} annotations - property annotations
78
- * @param {EntityType} entityType - entity type
79
- * @param {string} label - label, to be actualized
80
- */
81
- function evaluateCommonLabel(annotations, entityType, label) {
82
- var _a, _b, _c, _d;
83
- if ((_a = annotations === null || annotations === void 0 ? void 0 : annotations.Common) === null || _a === void 0 ? void 0 : _a.Label) {
84
- if (typeof annotations.Common.Label === 'string') {
85
- label = annotations.Common.Label;
86
- }
87
- else if (annotations.Common.Label['type'] === 'Path') {
88
- const targetProperty = entityType.resolvePath(annotations.Common.Label['path']);
89
- if (targetProperty.value) {
90
- label = targetProperty.value;
91
- }
92
- else if (typeof ((_b = targetProperty.Common) === null || _b === void 0 ? void 0 : _b.Label) === 'string') {
93
- label = targetProperty.annotations.Common.Label;
94
- }
95
- }
96
- else if (typeof ((_d = (_c = annotations.Common) === null || _c === void 0 ? void 0 : _c.Label) === null || _d === void 0 ? void 0 : _d.toString()) === 'string') {
97
- label = annotations.Common.Label.toString();
98
- }
99
- }
100
- return label;
101
- }
102
- exports.evaluateCommonLabel = evaluateCommonLabel;
103
- /**
104
- * Determines the label for a property path
105
- * @param {PropertyPath} propertyPath - property path
106
- * @param {EntityType} entityType - entity type
107
- * @returns label, derived from Common.Label or from property value
108
- */
109
- function getLabelForPropertyPath(propertyPath, entityType) {
110
- let label = propertyPath.value;
111
- if (propertyPath.$target) {
112
- label = evaluateCommonLabel(propertyPath.$target.annotations, entityType, label);
113
- }
114
- return label;
115
- }
116
- exports.getLabelForPropertyPath = getLabelForPropertyPath;
117
- /**
118
- * Determines the label for a LineItem record
119
- * @param {DataFieldAbstractType} field - Line item record
120
- * @param {EntityType} entityType - entity type
121
- * @returns label, derived from Common.Label or from property value
122
- */
123
- function getLabelForDataField(field, entityType) {
124
- var _a, _b;
125
- let label, property;
126
- if (field['Value']) {
127
- if (typeof field['Value'] === 'string') {
128
- property = entityType.entityProperties.find((ep) => ep.name === field['Value']);
129
- }
130
- else {
131
- property = entityType.resolvePath(field['Value'].path);
132
- if (!property) {
133
- property = field['Value'].$target;
134
- }
135
- }
136
- }
137
- else if (field['Target'] && field['Target'].$target && field['Target'].$target.Value) {
138
- property = field['Target'].$target.Value.$target;
139
- }
140
- if ((_b = (_a = property === null || property === void 0 ? void 0 : property.annotations) === null || _a === void 0 ? void 0 : _a.Common) === null || _b === void 0 ? void 0 : _b.Label) {
141
- label = evaluateCommonLabel(property.annotations, entityType, label);
142
- }
143
- return label;
144
- }
145
- exports.getLabelForDataField = getLabelForDataField;
146
- /**
147
- * Function to resolve the dataField label
148
- * @param dataFieldLabel - Given dataField label; might be of type string, or an object in case of a path reference
149
- * @param entityType - the entity type as part of the AVT ConverterOutput
150
- * @returns undefined or the right string value
151
- */
152
- function getLabel(dataFieldLabel, entityType) {
153
- var _a, _b;
154
- if (typeof dataFieldLabel === 'string') {
155
- return dataFieldLabel;
156
- }
157
- else if (typeof dataFieldLabel === 'object' && dataFieldLabel.path) {
158
- const property = entityType.resolvePath(dataFieldLabel.path);
159
- if (!property || property.length === 0) {
160
- return undefined;
161
- }
162
- else {
163
- const singleProperty = property[0];
164
- if ((_b = (_a = singleProperty === null || singleProperty === void 0 ? void 0 : singleProperty.annotations) === null || _a === void 0 ? void 0 : _a.Common) === null || _b === void 0 ? void 0 : _b.Label) {
165
- const label = dataFieldLabel;
166
- return evaluateCommonLabel(singleProperty.annotations, entityType, label);
167
- }
168
- }
169
- }
170
- else {
171
- return undefined;
172
- }
173
- }
174
- function getTitleForDataField(dataField, entityType, dataFieldLabel) {
175
- const propertyCommonLabel = getLabelForDataField(dataField, entityType);
176
- return (dataFieldLabel ||
177
- propertyCommonLabel ||
178
- (dataField.Value.$target ? dataField.Value.$target.name : dataField.Value.value || dataField.Value.path));
179
- }
180
- /**
181
- * Determines the description of a data field, e.g. for the column header
182
- * @param dataFieldAbstract - the given record of the line item annotation
183
- * @param entityType - the entity type as part of the AVT ConverterOutput
184
- */
185
- function getDatafieldDescription(dataFieldAbstract, entityType) {
186
- let title = '', propertyCommonLabel, dataField;
187
- const dataFieldLabel = getLabel(dataFieldAbstract.Label, entityType);
188
- switch (dataFieldAbstract.$Type) {
189
- case "com.sap.vocabularies.UI.v1.DataField" /* DataField */:
190
- dataField = dataFieldAbstract;
191
- title = getTitleForDataField(dataField, entityType, dataFieldLabel);
192
- break;
193
- case "com.sap.vocabularies.UI.v1.DataFieldWithUrl" /* DataFieldWithUrl */:
194
- dataField = dataFieldAbstract;
195
- propertyCommonLabel = getLabelForDataField(dataFieldAbstract, entityType);
196
- title =
197
- dataFieldLabel ||
198
- propertyCommonLabel ||
199
- (typeof dataField.Value === 'string' ? dataField.Value : dataField.Value.path);
200
- break;
201
- case "com.sap.vocabularies.UI.v1.DataFieldForAnnotation" /* DataFieldForAnnotation */:
202
- dataField = dataFieldAbstract;
203
- propertyCommonLabel = getLabelForDataField(dataFieldAbstract, entityType);
204
- title = dataFieldLabel || propertyCommonLabel || dataField.Target.$target.Title || dataField.Target.value;
205
- break;
206
- case "com.sap.vocabularies.UI.v1.DataFieldForAction" /* DataFieldForAction */:
207
- case "com.sap.vocabularies.UI.v1.DataFieldForIntentBasedNavigation" /* DataFieldForIntentBasedNavigation */:
208
- dataField = dataFieldAbstract;
209
- if (dataFieldLabel) {
210
- title = typeof dataFieldLabel === 'string' ? dataFieldLabel : dataField.Action;
211
- }
212
- else {
213
- title = dataFieldAbstract.Action;
214
- }
215
- break;
216
- case "com.sap.vocabularies.UI.v1.DataFieldWithIntentBasedNavigation" /* DataFieldWithIntentBasedNavigation */:
217
- dataField = dataFieldAbstract;
218
- propertyCommonLabel = getLabelForDataField(dataFieldAbstract, entityType);
219
- title = propertyCommonLabel || dataField.Value.path;
220
- break;
221
- case "com.sap.vocabularies.UI.v1.DataFieldWithNavigationPath" /* DataFieldWithNavigationPath */:
222
- dataField = dataFieldAbstract;
223
- title = getTitleForDataField(dataField, entityType, dataFieldLabel);
224
- break;
225
- default:
226
- break;
227
- }
228
- return title;
229
- }
230
- exports.getDatafieldDescription = getDatafieldDescription;
231
- /**
232
- * Return the page type for a given V2 page in manifest
233
- * @param name - page component name
234
- */
235
- function getPageTypeV2(name) {
236
- if (name) {
237
- const templatePart = `${v2_1.FE_TEMPLATE_V2}.`;
238
- return name.split(templatePart)[1];
239
- }
240
- }
241
- exports.getPageTypeV2 = getPageTypeV2;
242
- /**
243
- * Return the page type for a given V4 page in manifest
244
- * @param name - page component name
245
- */
246
- function getPageTypeV4(name) {
247
- if (name) {
248
- const templatePart = `${v4_1.FE_TEMPLATE_V4}.`;
249
- return name.split(templatePart)[1];
250
- }
251
- }
252
- exports.getPageTypeV4 = getPageTypeV4;
253
- function getTargetAnnotationName(targetAnnotation, keyForRelatedFacetKeys = false) {
254
- return `${!keyForRelatedFacetKeys ? '@' : ''}${targetAnnotation.qualifier ? targetAnnotation.term + '#' + targetAnnotation.qualifier : targetAnnotation.term}`;
255
- }
256
- /**
257
- * Finds the alias for a given namespace in the references' section of the converted service metadata
258
- * @param {string} namespace - complete namespace, e.g. 'com.sap.vocabularies.UI.v1'
259
- * @param {ConverterOutput} oDataServiceAVT - combined service metadata, as returned by annotation vocabularies tools
260
- * @returns alias for the given namespace
261
- */
262
- function findAlias(namespace, oDataServiceAVT) {
263
- let aliasReference = oDataServiceAVT.references.find((reference) => {
264
- return reference.namespace === namespace;
265
- });
266
- if (!aliasReference) {
267
- aliasReference = oDataServiceAVT.references.find((reference) => {
268
- return reference.alias === namespace;
269
- });
270
- }
271
- if (!aliasReference) {
272
- aliasReference = oDataServiceAVT.references.find((reference) => {
273
- return (reference.alias.toUpperCase() ===
274
- namespace.split('SAP__')[namespace.split('SAP__').length - 1].toUpperCase());
275
- });
276
- }
277
- return aliasReference === null || aliasReference === void 0 ? void 0 : aliasReference.alias;
278
- }
279
- exports.findAlias = findAlias;
280
- /**
281
- * Determines the target annotation
282
- * @param navigationParts - parts of the target annotation path
283
- * @param entityType - entity type
284
- * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
285
- * @returns the target annotation
286
- */
287
- function determineTargetAnnotation(navigationParts, entityType, oDataServiceAVT) {
288
- var _a;
289
- const lastNavigationPart = navigationParts[navigationParts.length - 1];
290
- const annotation = lastNavigationPart.substring(lastNavigationPart.lastIndexOf('.') + 1, lastNavigationPart.length);
291
- const alias = findAlias(lastNavigationPart.substring(0, lastNavigationPart.lastIndexOf('.')).replace('@', ''), oDataServiceAVT);
292
- return (_a = entityType === null || entityType === void 0 ? void 0 : entityType.annotations[alias]) === null || _a === void 0 ? void 0 : _a[annotation];
293
- }
294
- /**
295
- * Adjust key by considering navigation
296
- * @param key - given key
297
- * @param keyForRelatedFacetKeys - construct key for 'keyForRelatedFacetKeys' property(used to define custom sections) - we should not add '@' symbol there.
298
- * @param navigationParts - parts of the target annotation path
299
- */
300
- function adjustKey(key, navigationParts, keyForRelatedFacetKeys) {
301
- const uiParts = (navigationParts[1] || navigationParts[0]).split('#');
302
- const uiClass = uiParts[0];
303
- if (uiClass.includes('.LineItem')) {
304
- const pathParts = key.split('::');
305
- pathParts[pathParts.length - 1] = `${!keyForRelatedFacetKeys ? '@' : ''}${"com.sap.vocabularies.UI.v1.LineItem" /* LineItem */}`;
306
- key = pathParts.join('::');
307
- }
308
- else {
309
- key = uiClass.replace('@UI', `${!keyForRelatedFacetKeys ? '@' : ''}com.sap.vocabularies.UI.v1`);
310
- }
311
- }
312
- /**
313
- * Resolve page section(get key and label->description).
314
- * @param facetDefinition - the actual annotation record
315
- * @param keyForRelatedFacetKeys - construct key for 'keyForRelatedFacetKeys' property(used to define custom sections) - we should not add '@' symbol there.
316
- * @param {FioriElementsVersion} oDataVersion - OData version
317
- * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
318
- * @param {ExtensionLogger} logger - Logger class for logging messages
319
- * @returns {FacetSection} - object comprising the relevant facet information
320
- */
321
- function getSectionFacet(facetDefinition, sourceEntityType, oDataServiceAVT, logger, oDataVersion = common_1.FioriElementsVersion.v2, keyForRelatedFacetKeys = false) {
322
- var _a;
323
- //Take facet ID as fallback
324
- const facetName = facetDefinition.fullyQualifiedName.substr(facetDefinition.fullyQualifiedName.lastIndexOf('@'));
325
- let key = facetDefinition.ID ? facetDefinition.ID.toString() : facetName;
326
- let entityType = sourceEntityType; //default
327
- //If reference facet: overwrite with target annotation if present
328
- if (facetDefinition.$Type !== "com.sap.vocabularies.UI.v1.CollectionFacet" /* CollectionFacet */ && 'Target' in facetDefinition) {
329
- const propertyValue = exports.getAnnotationPropertyValue(facetDefinition.Target);
330
- if (!propertyValue) {
331
- extensionLogger_1.log(logger, {
332
- severity: "error" /* Error */,
333
- message: i18next_1.default.t('NOTARGET', { target: facetDefinition.Target })
334
- });
335
- return;
336
- }
337
- const navigationParts = propertyValue.split('/');
338
- const navigation = navigationParts.length > 1 ? navigationParts[0] : '';
339
- if (navigation) {
340
- entityType = (_a = sourceEntityType.resolvePath(navigation)) === null || _a === void 0 ? void 0 : _a.targetType;
341
- }
342
- adjustKey(key, navigationParts, keyForRelatedFacetKeys);
343
- const targetAnnotation = determineTargetAnnotation(navigationParts, entityType, oDataServiceAVT);
344
- if (targetAnnotation) {
345
- const separator = oDataVersion === common_1.FioriElementsVersion.v2 ? '::' : '#';
346
- key = getTargetAnnotationName(targetAnnotation, keyForRelatedFacetKeys).replace('#', separator);
347
- }
348
- else {
349
- return undefined;
350
- }
351
- if (navigation) {
352
- const navSeparator = oDataVersion === common_1.FioriElementsVersion.v2 ? '::' : '/';
353
- key = `${navigation}${navSeparator}${key}`;
354
- }
355
- }
356
- key = key.replace(/\//gi, '::');
357
- return key
358
- ? Object.assign(Object.assign(Object.assign({ key }, (facetDefinition.Label && { label: facetDefinition.Label.toString() })), (facetDefinition.ID && { ID: facetDefinition.ID.toString() })), { entityType }) : undefined;
359
- }
360
- exports.getSectionFacet = getSectionFacet;
361
- /**
362
- * Finds the alias for a given namespace in the references' section of the converted service metadata
363
- * @param {object} exportResultManifest - manifest that is being modified during export
364
- * @param {string} path - path of the property in the manifest
365
- * @param {string} targetAnnotation
366
- * @param {string} targetAnnotationEncoded
367
- * @returns returns section of the manifest based on path, generates an empty object in case it does not exists
368
- */
369
- exports.getManifestSectionByPathV4 = (exportResultManifest, path, targetAnnotation, targetAnnotationEncoded) => {
370
- let exportResultSection = exportResultManifest;
371
- path.split('/').forEach(function (element) {
372
- if (targetAnnotationEncoded && targetAnnotationEncoded === element) {
373
- element = targetAnnotation;
374
- }
375
- if (!exportResultSection[element]) {
376
- exportResultSection[element] = {};
377
- }
378
- exportResultSection = exportResultSection[element];
379
- });
380
- return exportResultSection;
381
- };
382
- function getSchemaKeyOfLineItemRecord(lineItemRecord) {
383
- let schemaKey, target, value;
384
- switch (lineItemRecord.$Type) {
385
- case "com.sap.vocabularies.UI.v1.DataField" /* DataField */:
386
- schemaKey = exports.getAnnotationPropertyValue(lineItemRecord.Value);
387
- break;
388
- case "com.sap.vocabularies.UI.v1.DataFieldWithUrl" /* DataFieldWithUrl */:
389
- schemaKey =
390
- typeof lineItemRecord.Value === 'string'
391
- ? lineItemRecord.Value
392
- : exports.getAnnotationPropertyValue(lineItemRecord.Value);
393
- break;
394
- case "com.sap.vocabularies.UI.v1.DataFieldForAnnotation" /* DataFieldForAnnotation */:
395
- target = lineItemRecord.Target.value;
396
- if (target) {
397
- schemaKey =
398
- 'DataFieldForAnnotation:::sTarget::' +
399
- target
400
- .replace('@UI', '@com.sap.vocabularies.UI.v1')
401
- .replace('@Communication', '@com.sap.vocabularies.Communication.v1')
402
- .replace('@Contact', '@com.sap.vocabularies.Contact.v1');
403
- }
404
- break;
405
- case "com.sap.vocabularies.UI.v1.DataFieldForAction" /* DataFieldForAction */:
406
- if (lineItemRecord.Inline) {
407
- schemaKey = 'DataFieldForAction:::sAction::' + lineItemRecord.Action;
408
- }
409
- break;
410
- case "com.sap.vocabularies.UI.v1.DataFieldWithIntentBasedNavigation" /* DataFieldWithIntentBasedNavigation */:
411
- value = exports.getAnnotationPropertyValue(lineItemRecord.Value);
412
- schemaKey =
413
- 'DataFieldWithIntentBasedNavigation:::sProperty::' +
414
- value +
415
- ':::sSemanticObject::' +
416
- lineItemRecord.SemanticObject +
417
- ':::sAction::' +
418
- lineItemRecord.Action;
419
- break;
420
- case "com.sap.vocabularies.UI.v1.DataFieldForIntentBasedNavigation" /* DataFieldForIntentBasedNavigation */:
421
- if (lineItemRecord.Inline) {
422
- schemaKey =
423
- 'DataFieldForIntentBasedNavigation:::sSemanticObject::' +
424
- lineItemRecord.SemanticObject +
425
- ':::sAction::' +
426
- lineItemRecord.Action;
427
- }
428
- break;
429
- case "com.sap.vocabularies.UI.v1.DataFieldWithNavigationPath" /* DataFieldWithNavigationPath */:
430
- value = exports.getAnnotationPropertyValue(lineItemRecord.Value);
431
- target = exports.getAnnotationPropertyValue(lineItemRecord.Target);
432
- schemaKey = 'DataFieldWithNavigationPath:::sProperty::' + value + ':::sTarget::' + target;
433
- break;
434
- default:
435
- break;
436
- }
437
- return schemaKey;
438
- }
439
- exports.getSchemaKeyOfLineItemRecord = getSchemaKeyOfLineItemRecord;
440
- /**
441
- * Evaluates the target annotation of a reference facet and actualizes the facets for the config
442
- * @param {AnnotationTerm} annotationRecord - the actual annotation record
443
- * @param {FacetConfigs} facets - list of facets in config format, to be updated
444
- * @param {EntityType} entityType - the entity type
445
- * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
446
- * @param {FioriElementsVersion} oDataVersion - OData version
447
- * @param {ExtensionLogger} logger - Logger class for logging messages
448
- */
449
- function evaluateTargetAnnotation(section, annotationRecord, facets, entityType, oDataServiceAVT, oDataVersion = common_1.FioriElementsVersion.v2, logger) {
450
- var _a, _b, _c, _d, _e, _f;
451
- const alias = findAlias(types_1.UIVOCABULARY, oDataServiceAVT);
452
- let path = section ? section.key : '';
453
- const targetEntityType = section.entityType;
454
- let annotation, targetAnnotation;
455
- if (path.includes("com.sap.vocabularies.UI.v1.Chart" /* Chart */) || path.includes(alias + '.Chart')) {
456
- facets[path] = { base: types_1.FacetBase.Chart };
457
- facets[path].entityType = targetEntityType;
458
- }
459
- else if (path.includes("com.sap.vocabularies.UI.v1.Identification" /* Identification */) || path.includes(alias + '.Identification')) {
460
- annotation = path.split('.')[path.split('.').length - 1];
461
- targetAnnotation = targetEntityType.annotations[alias][annotation];
462
- facets[path] = { base: types_1.FacetBase.Identification };
463
- facets[path].entityType = targetEntityType;
464
- facets[path].target = targetAnnotation;
465
- }
466
- else if (entityType && (path.includes("com.sap.vocabularies.UI.v1.LineItem" /* LineItem */) || path.includes(alias + '.LineItem'))) {
467
- if (!path.includes("com.sap.vocabularies.UI.v1.LineItem" /* LineItem */) && path.includes('.LineItem')) {
468
- const pathParts = path.split('::');
469
- pathParts[pathParts.length - 1] = `@${"com.sap.vocabularies.UI.v1.LineItem" /* LineItem */}`;
470
- path = pathParts.join('::');
471
- }
472
- facets[path] = { base: types_1.FacetBase.LineItem };
473
- facets[path].target = (_a = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _a === void 0 ? void 0 : _a.$target;
474
- facets[path].entityType = targetEntityType;
475
- }
476
- else if (path.includes("com.sap.vocabularies.UI.v1.FieldGroup" /* FieldGroup */) || path.includes(alias + '.FieldGroup')) {
477
- facets[path] = { base: types_1.FacetBase.Form };
478
- facets[path].target = (_b = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _b === void 0 ? void 0 : _b.$target;
479
- facets[path].entityType = targetEntityType;
480
- }
481
- else if (path.includes("com.sap.vocabularies.UI.v1.DataPoint" /* DataPoint */) || path.includes(alias + '.DataPoint')) {
482
- facets[path] = { base: types_1.FacetBase.DataPoint };
483
- facets[path].target = (_c = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _c === void 0 ? void 0 : _c.$target;
484
- facets[path].entityType = targetEntityType;
485
- facets[path].Label = (_d = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _d === void 0 ? void 0 : _d.$target['Title'];
486
- }
487
- else if (path.includes('com.sap.vocabularies.Communication.v1.Contact') || path.includes(alias + '.Contact')) {
488
- facets[path] = { base: types_1.FacetBase.Contact };
489
- facets[path].target = (_e = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _e === void 0 ? void 0 : _e.$target;
490
- facets[path].entityType = targetEntityType;
491
- }
492
- else if (path.includes('com.sap.vocabularies.Communication.v1.Address') || path.includes(alias + '.Address')) {
493
- facets[path] = { base: types_1.FacetBase.Address };
494
- facets[path].target = (_f = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _f === void 0 ? void 0 : _f.$target;
495
- facets[path].entityType = targetEntityType;
496
- }
497
- else {
498
- facets[path] = { base: types_1.FacetBase.Unknown };
499
- }
500
- if (facets[path]) {
501
- facets[path].annotationPath = `/${annotationRecord.fullyQualifiedName.replace('@com.sap.vocabularies', types_1.VOCWITHSLASH)}`;
502
- if (annotationRecord.Label) {
503
- facets[path].Label = annotationRecord.Label;
504
- }
505
- // Add Facet ID
506
- if (annotationRecord.ID) {
507
- facets[path]['ID'] = annotationRecord.ID;
508
- }
509
- else if (oDataVersion === common_1.FioriElementsVersion.v4) {
510
- extensionLogger_1.log(logger, {
511
- severity: "error" /* Error */,
512
- message: i18next_1.default.t('NOID4SECTION', { facet: annotationRecord.fullyQualifiedName })
513
- });
514
- }
515
- if (section && section.entityType) {
516
- facets[path].entityType = section.entityType;
517
- }
518
- }
519
- }
520
- /**
521
- * Adds the information from facets to the config
522
- * @param {AnnotationTerm} annotationRecord - the actual annotation record
523
- * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
524
- * @param {string} serviceName - name of the service of the app
525
- * @param {string} entityName - the entity (type) name
526
- * @param {FacetConfigs} facets - list of facets in config format, to be updated
527
- * @param {FioriElementsVersion} oDataVersion - OData version
528
- * @param {ExtensionLogger} logger - Logger class for logging messages
529
- */
530
- function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entityType, facets, oDataVersion = common_1.FioriElementsVersion.v2, logger) {
531
- var _a;
532
- const section = getSectionFacet(annotationRecord, entityType, oDataServiceAVT, logger, oDataVersion, false);
533
- if (section) {
534
- switch (annotationRecord.$Type) {
535
- case "com.sap.vocabularies.UI.v1.ReferenceFacet" /* ReferenceFacet */: {
536
- evaluateTargetAnnotation(section, annotationRecord, facets, entityType, oDataServiceAVT, oDataVersion, logger);
537
- break;
538
- }
539
- case "com.sap.vocabularies.UI.v1.CollectionFacet" /* CollectionFacet */: {
540
- const annotationPath = `/${entityType.fullyQualifiedName}/${annotationRecord.fullyQualifiedName.split(entityType.fullyQualifiedName)[1]}`;
541
- const facet = (facets[section.key] = {
542
- base: types_1.FacetBase.CollectionFacet,
543
- facets: {},
544
- ID: section.ID,
545
- annotationPath: annotationPath,
546
- Label: section.label
547
- });
548
- (_a = annotationRecord.Facets) === null || _a === void 0 ? void 0 : _a.forEach((collectionItem) => {
549
- addFacetToConfig(collectionItem, oDataServiceAVT, serviceName, entityType, facet.facets, oDataVersion, logger);
550
- });
551
- break;
552
- }
553
- }
554
- }
555
- }
556
- /**
557
- * Retrieve header facet configurations that can be used to generate ObjectPage schemas
558
- * @param {QualifiedName} entityTypeName - the name of the actual entity type
559
- * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
560
- * @param {FioriElementsVersion} oDataVersion - OData version
561
- * @param {ExtensionLogger} logger - Logger class for logging messages
562
- */
563
- function getObjectPageHeaderFacets(entityType, oDataServiceAVT, oDataVersion = common_1.FioriElementsVersion.v2, logger) {
564
- const facets = {};
565
- if (!entityType || !entityType.annotations) {
566
- return;
567
- }
568
- const alias = findAlias(types_1.UIVOCABULARY, oDataServiceAVT);
569
- const facetAnnotation = alias && entityType.annotations[alias] && entityType.annotations[alias].HeaderFacets;
570
- if (facetAnnotation) {
571
- const lastDot = entityType.fullyQualifiedName.lastIndexOf('.');
572
- const serviceName = entityType.fullyQualifiedName.substr(0, lastDot);
573
- // Add facets to configuration
574
- facetAnnotation.forEach((item) => {
575
- addFacetToConfig(item, oDataServiceAVT, serviceName, entityType, facets, oDataVersion, logger);
576
- });
577
- }
578
- return facets;
579
- }
580
- exports.getObjectPageHeaderFacets = getObjectPageHeaderFacets;
581
- /**
582
- * Retrieve facet configurations that can be used to generate ObjectPage schemas
583
- * @param {QualifiedName} entityTypeName - the name of the actual entity type
584
- * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
585
- * @param {FioriElementsVersion} oDataVersion - OData version
586
- * @param {ExtensionLogger} logger - Logger class for logging messages
587
- */
588
- function getObjectPageFacets(entityType, oDataServiceAVT, oDataVersion = common_1.FioriElementsVersion.v2, logger) {
589
- const facets = {};
590
- if (!entityType || !entityType.annotations) {
591
- return;
592
- }
593
- const alias = findAlias(types_1.UIVOCABULARY, oDataServiceAVT);
594
- const facetAnnotation = alias && entityType.annotations[alias] && entityType.annotations[alias].Facets;
595
- if (facetAnnotation) {
596
- const lastDot = entityType.fullyQualifiedName.lastIndexOf('.');
597
- const serviceName = entityType.fullyQualifiedName.substr(0, lastDot);
598
- // Add facets to configuration
599
- facetAnnotation.forEach((item) => {
600
- addFacetToConfig(item, oDataServiceAVT, serviceName, entityType, facets, oDataVersion, logger);
601
- });
602
- }
603
- return facets;
604
- }
605
- exports.getObjectPageFacets = getObjectPageFacets;
606
- /**
607
- * Returns the version of Fiori elements (v2/v4) from a given manifest
608
- * @param manifest - the manifest.json file
609
- */
610
- function getVersionFromManifest(manifest) {
611
- if (manifest[v4_1.ManifestSection.generic] || manifest[v4_1.ManifestSection.ovp]) {
612
- return common_1.FioriElementsVersion.v2;
613
- }
614
- else {
615
- return common_1.FioriElementsVersion.v4;
616
- }
617
- }
618
- exports.getVersionFromManifest = getVersionFromManifest;
619
- /**
620
- * Determines the template type of a V2 app
621
- * @param manifest - the manifest.json file
622
- * @param {ExtensionLogger} logger - Logger class for logging messages
623
- * @returns {TemplateType} the template type
624
- */
625
- function determineV2Template(manifest, logger) {
626
- let templateType;
627
- if (manifest[v4_1.ManifestSection.generic]) {
628
- const v2Pages = manifest[v4_1.ManifestSection.generic].pages;
629
- if (!v2Pages) {
630
- extensionLogger_1.log(logger, {
631
- severity: "error" /* Error */,
632
- message: i18next_1.default.t('NOPAGES', { appId: manifest['sap.app']['id'] }),
633
- location: {
634
- path: types_1.MANIFESTPATH,
635
- range: [v4_1.ManifestSection.generic]
636
- }
637
- });
638
- return;
639
- }
640
- for (const pageKey in v2Pages) {
641
- const v2Page = v2Pages[pageKey];
642
- if (getPageTypeV2(v2Page.component.name) === common_1.PageType.AnalyticalListPage) {
643
- templateType = TemplateType.AnalyticalListPageV2;
644
- break;
645
- }
646
- else if (getPageTypeV2(v2Page.component.name) === common_1.PageType.ListReport) {
647
- templateType = TemplateType.ListReportObjectPageV2;
648
- break;
649
- }
650
- }
651
- }
652
- else {
653
- if (!templateType) {
654
- extensionLogger_1.log(logger, {
655
- severity: "error" /* Error */,
656
- message: i18next_1.default.t('NOTEMPLATE', { section: v4_1.ManifestSection.generic }),
657
- location: {
658
- path: types_1.MANIFESTPATH,
659
- range: [v4_1.ManifestSection.generic]
660
- }
661
- });
662
- }
663
- }
664
- return templateType;
665
- }
666
- exports.determineV2Template = determineV2Template;
667
- /**
668
- * Determines the template type of a V4 app
669
- * @param manifest - the manifest.json file
670
- * @param {ExtensionLogger} logger - Logger class for logging messages
671
- * @returns {TemplateType} the template type
672
- */
673
- function determineV4Template(manifest, logger) {
674
- let templateType;
675
- const v4Pages = manifest[v4_1.ManifestSection.ui5].routing &&
676
- manifest[v4_1.ManifestSection.ui5].routing.targets;
677
- if (!v4Pages) {
678
- extensionLogger_1.log(logger, {
679
- severity: "error" /* Error */,
680
- message: i18next_1.default.t('NOPAGES', { appId: manifest['sap.app']['id'] }),
681
- location: {
682
- path: types_1.MANIFESTPATH,
683
- range: [v4_1.ManifestSection.ui5, 'routing']
684
- }
685
- });
686
- return;
687
- }
688
- for (const pageKey in v4Pages) {
689
- const v4Page = v4Pages[pageKey];
690
- const pageType = getPageTypeV4(v4Page.name);
691
- if (pageType === common_1.PageTypeV4.AnalyticalListPage) {
692
- templateType = TemplateType.AnalyticalListPageV4;
693
- break;
694
- }
695
- else if (pageType === common_1.PageTypeV4.ListReport || pageType === common_1.PageTypeV4.ObjectPage) {
696
- templateType = TemplateType.ListReportObjectPageV4;
697
- break;
698
- }
699
- }
700
- if (!templateType) {
701
- extensionLogger_1.log(logger, {
702
- severity: "error" /* Error */,
703
- message: i18next_1.default.t('NOTEMPLATE', { section: v4_1.ManifestSection.ui5 }),
704
- location: {
705
- path: types_1.MANIFESTPATH,
706
- range: [v4_1.ManifestSection.ui5, 'routing', 'targets']
707
- }
708
- });
709
- }
710
- return templateType;
711
- }
712
- exports.determineV4Template = determineV4Template;
713
- /**
714
- * Determines the template type, based on the given manifest entries of the app
715
- * @param manifest - the manifest.json file
716
- * @param {FioriElementsVersion} fioriElementsVersion - OData or FE version
717
- * @param {ExtensionLogger} logger - Logger class for logging messages
718
- * @returns {TemplateType} the template type
719
- */
720
- function getTemplateTypeFromManifest(manifest, fioriElementsVersion, logger) {
721
- let templateType;
722
- if (manifest[v4_1.ManifestSection.ovp]) {
723
- templateType = TemplateType.OverviewPageV2;
724
- }
725
- else if (fioriElementsVersion === common_1.FioriElementsVersion.v2) {
726
- templateType = determineV2Template(manifest, logger);
727
- }
728
- else if (fioriElementsVersion === common_1.FioriElementsVersion.v4) {
729
- templateType = determineV4Template(manifest, logger);
730
- }
731
- else {
732
- if (!templateType) {
733
- extensionLogger_1.log(logger, {
734
- severity: "error" /* Error */,
735
- message: i18next_1.default.t('NOFE'),
736
- location: {
737
- path: types_1.MANIFESTPATH
738
- }
739
- });
740
- }
741
- }
742
- return templateType;
743
- }
744
- exports.getTemplateTypeFromManifest = getTemplateTypeFromManifest;
745
- /**
746
- * Adds title and description to a section or header section in an app schema
747
- * @param facet - intermediate facet structure comprising annotation information
748
- * @param section - section in the app schema
749
- * @param facetKey - key of the facet
750
- */
751
- function addSectionTitleAndDescription(facet, section, facetKey) {
752
- if (facet === null || facet === void 0 ? void 0 : facet.ID) {
753
- section['title'] = types_1.FacetTitlePrefix + facet.ID;
754
- }
755
- else {
756
- section['title'] = facetKey.substr(facetKey.lastIndexOf('.') + 1);
757
- }
758
- // Description
759
- if (facet === null || facet === void 0 ? void 0 : facet.Label) {
760
- section['description'] = facet.Label;
761
- }
762
- else if (facet === null || facet === void 0 ? void 0 : facet.ID) {
763
- section['description'] = facet.ID;
764
- }
765
- else {
766
- section['description'] = facetKey.substr(facetKey.lastIndexOf('.') + 1);
767
- }
768
- }
769
- exports.addSectionTitleAndDescription = addSectionTitleAndDescription;
770
- /**
771
- * Creates a default object for a new section or subsection, and adds the ID as title if present.
772
- * @param facet Facet configuration, to be analyzed
773
- * @returns the new section object
774
- */
775
- function createSectionWithoutProperties(facet, facetKey) {
776
- if (!facet) {
777
- return undefined;
778
- }
779
- const section = {
780
- type: 'object',
781
- properties: {},
782
- additionalProperties: false,
783
- annotationPath: facet.annotationPath,
784
- isViewNode: true
785
- };
786
- addSectionTitleAndDescription(facet, section, facetKey);
787
- return section;
788
- }
789
- exports.createSectionWithoutProperties = createSectionWithoutProperties;
790
- /**
791
- * Retrieve page section data(so far id/key and label/description).
792
- * @param {EntityType} entityType The actual entityType
793
- * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
794
- * @param {ExtensionLogger} logger - Logger class for logging messages
795
- * @param {FioriElementsVersion} oDataVersion - OData version
796
- * @param {boolean} [checkUnresolvableFacets=false] - Check and avoid facets and sections without ID and Target.
797
- * @returns {FacetSection[]} - Array of facets or sections
798
- */
799
- function getObjectPageFacetSection(entityType, oDataServiceAVT, logger, oDataVersion = common_1.FioriElementsVersion.v2, checkUnresolvableFacets = false) {
800
- const alias = findAlias(types_1.UIVOCABULARY, oDataServiceAVT);
801
- let sections = [];
802
- if (entityType) {
803
- const facetAnnotation = alias && entityType.annotations && entityType.annotations[alias] && entityType.annotations[alias].Facets;
804
- if (facetAnnotation) {
805
- sections = facetAnnotation.reduce(function (result, item) {
806
- if (checkUnresolvableFacets && !item['ID'] && !('Target' in item && item['Target'])) {
807
- return result;
808
- }
809
- const section = getSectionFacet(item, entityType, oDataServiceAVT, logger, oDataVersion, true);
810
- if (section) {
811
- result.push(section);
812
- }
813
- return result;
814
- }, sections);
815
- }
816
- return sections;
817
- }
818
- }
819
- exports.getObjectPageFacetSection = getObjectPageFacetSection;
820
- /**
821
- * Cleans empty sub-structures from the export result for manifest
822
- * @param manifest - manifest.json part of the export result
823
- * @param path - path in the manifest
824
- * @param targetAnnotation - target annotation (optional, in case of sections, subsections)
825
- * @param targetAnnotationEncoded - encoded version of the target annotation, as represented in the manifest
826
- */
827
- exports.deleteEmptyStructure = (manifest, path, targetAnnotation, targetAnnotationEncoded) => {
828
- let manifestSection = manifest;
829
- const pathArray = path.split('/');
830
- pathArray.forEach(function (element) {
831
- if (element === targetAnnotationEncoded) {
832
- element = targetAnnotation;
833
- }
834
- if (!manifestSection[element]) {
835
- return;
836
- }
837
- if (Object.keys(manifestSection[element]).length === 0) {
838
- delete manifestSection[element];
839
- pathArray.pop();
840
- exports.deleteEmptyStructure(manifest, pathArray.join('/'), targetAnnotation, targetAnnotationEncoded);
841
- return;
842
- }
843
- manifestSection = manifestSection && manifestSection[element];
844
- });
845
- };
846
- /**
847
- * Method which returns generic schema file name.
848
- * @param {SchemaType | PageType} schemaType Schema type or Page type.
849
- * @return {string} File name of generic schema.
850
- */
851
- const getGenericSchemaFileName = (schemaType) => {
852
- return `${schemaType}`;
853
- };
854
- /**
855
- * Method which returns schema file name and path depending on passed schema or page type.
856
- * @param {SchemaType | PageType} schemaType Schema type or Page type.
857
- * @param {string} [entitySet] Entity set string.
858
- * @return {SchemaFilePath} File path info.
859
- */
860
- exports.getSchemaFilePath = (schemaType, entitySet) => {
861
- const schemaFile = {
862
- filename: '',
863
- path: ''
864
- };
865
- switch (schemaType) {
866
- // Application schema
867
- case schemaAccess_1.SchemaType.Application: {
868
- // File name
869
- schemaFile.filename = `App`;
870
- // Full path
871
- schemaFile.path = `./${types_1.DirName.Schemas}/${schemaFile.filename}`;
872
- break;
873
- }
874
- // List report and object page
875
- case schemaAccess_1.SchemaType.ListReport:
876
- case schemaAccess_1.SchemaType.ObjectPage: {
877
- // File name
878
- schemaFile.filename = entitySet ? `${schemaType}_${entitySet}` : getGenericSchemaFileName(schemaType);
879
- // Full path
880
- schemaFile.path = `../${types_1.DirName.Schemas}/${schemaFile.filename}`;
881
- break;
882
- }
883
- // Other page configs
884
- default: {
885
- // File name
886
- schemaFile.filename = getGenericSchemaFileName(schemaType);
887
- // Full path
888
- schemaFile.path = `../${types_1.DirName.Schemas}/${schemaFile.filename}`;
889
- break;
890
- }
891
- }
892
- schemaFile.path += '.json';
893
- return schemaFile;
894
- };
895
- /**
896
- * Method which generates id of page according to passed parameters.
897
- * @param appVersion - Fiori Elements version - V2 or V4.
898
- * @param pageType - Page type.
899
- * @param entitySet - Entity Set.
900
- * @param navigationProperty - Navigation property (optional).
901
- * @param viewId - Custom page's viewId (optional).
902
- * @returns {string} Generated page id
903
- */
904
- function generatePageId(pageType, entitySet, navigationProperty, viewId) {
905
- if (pageType === common_1.PageType.CustomPage) {
906
- const names = viewId && viewId.split('.');
907
- return names && names[names.length - 1] + 'Page';
908
- }
909
- const parts = [];
910
- parts.push(pageType);
911
- if (entitySet) {
912
- parts.push(entitySet);
913
- }
914
- // Page navigation - Optional
915
- if (navigationProperty) {
916
- parts.push(navigationProperty);
917
- }
918
- return parts.join('_');
919
- }
920
- exports.generatePageId = generatePageId;
921
- /**
922
- * Fills an array of next definitions from given references in the JSON schema
923
- * @param propertyDefinition - Definition of the current property in schema
924
- * @param currentConfigObject - Current object in the config JSON. Evaluated to get the right value of a cntrolling property,
925
- * for making the right choice in case of multiple options (anyOf)
926
- * @param appSchema - app-spcific JSON schema
927
- * @returns an array of definitions to proceed with
928
- */
929
- function fillArrayFromPropertyDefinition(propertyDefinition, currentConfigObject, appSchema) {
930
- const definitionArray = [];
931
- if (propertyDefinition['$ref']) {
932
- definitionArray.push(propertyDefinition['$ref'].split(exports.DEFINITION_LINK_PREFIX)[1]);
933
- }
934
- else if (propertyDefinition['anyOf']) {
935
- if (currentConfigObject) {
936
- propertyDefinition['anyOf'].forEach((element) => {
937
- if (element.$ref) {
938
- const definitionKey = element.$ref.split(exports.DEFINITION_LINK_PREFIX)[1];
939
- if (appSchema['definitions'][definitionKey]) {
940
- const controlProperty = appSchema['definitions'][definitionKey]['controlProperty'];
941
- if (element.$ref.includes(currentConfigObject[controlProperty])) {
942
- definitionArray.push(definitionKey);
943
- }
944
- }
945
- }
946
- });
947
- }
948
- if (definitionArray.length === 0) {
949
- return undefined;
950
- }
951
- }
952
- return definitionArray;
953
- }
954
- /**
955
- * Determines the next definition to be handled, based on the definition array.
956
- * It also creates the Metadata instance for the next definition, to subsequently access metadata like the syncRule
957
- * @param definitionArray - Array of definitions, as determined by fillArrayFromNextDefinition
958
- * @param appSchema - app-spcific JSON schema
959
- * @param title - default title
960
- * @param currentConfigObject - Current object in the config JSON.
961
- * @param key - actual key
962
- * @param {MetadataInstanceInterface} factory - factory for creating metadata instances
963
- * @param pageType - page type
964
- * @param propertyDefinition - Definition of the current property in schema
965
- * @returns {NextDefinition} - Next target definition to process
966
- */
967
- function determineNextDefinitionFromDefinitionArray(definitionArray, appSchema, title, currentConfigObject, key, factory, pageType, propertyDefinition) {
968
- var _a, _b, _c;
969
- let nextDefinition = {
970
- configObject: undefined,
971
- targetDefinition: {},
972
- title: ''
973
- };
974
- if (definitionArray.length) {
975
- const lastDefinition = definitionArray[definitionArray.length - 1];
976
- nextDefinition.targetDefinition = appSchema['definitions'][lastDefinition];
977
- if (((_a = nextDefinition === null || nextDefinition === void 0 ? void 0 : nextDefinition.targetDefinition) === null || _a === void 0 ? void 0 : _a['$ref']) || ((_b = nextDefinition === null || nextDefinition === void 0 ? void 0 : nextDefinition.targetDefinition) === null || _b === void 0 ? void 0 : _b['type']) === 'array') {
978
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
979
- nextDefinition = getNextTargetDefinition(appSchema, title, currentConfigObject, nextDefinition.targetDefinition, key, factory, pageType);
980
- return nextDefinition;
981
- }
982
- if (definitionArray.length > 1) {
983
- definitionArray.forEach((element) => {
984
- if (element !== '') {
985
- nextDefinition.targetDefinition['properties'] = Object.assign(Object.assign({}, nextDefinition.targetDefinition['properties']), appSchema['definitions'][element]['properties']);
986
- }
987
- });
988
- }
989
- nextDefinition.title = ((_c = nextDefinition === null || nextDefinition === void 0 ? void 0 : nextDefinition.targetDefinition) === null || _c === void 0 ? void 0 : _c['title']) ? nextDefinition.targetDefinition['title']
990
- : title;
991
- const factoryKey = lastDefinition === null || lastDefinition === void 0 ? void 0 : lastDefinition.split('<')[0];
992
- const targetObject = currentConfigObject ? currentConfigObject : {};
993
- nextDefinition.configObject = factory.createInstance(pageType, factoryKey, targetObject, nextDefinition.targetDefinition['controlProperty']);
994
- }
995
- else {
996
- //e.g. sections ==> loop over all properties = subsections or other
997
- nextDefinition.targetDefinition = propertyDefinition;
998
- nextDefinition.title = nextDefinition.targetDefinition['title']
999
- ? nextDefinition.targetDefinition['title']
1000
- : key;
1001
- nextDefinition.configObject = currentConfigObject;
1002
- }
1003
- return nextDefinition;
1004
- }
1005
- /**
1006
- * Recursive function to determine the next config part, next definition in the app schema and the title
1007
- * @param appSchema - app-spcific JSON schema
1008
- * @param title - default title
1009
- * @param currentConfigObject - current part of the configuration that gets traversed
1010
- * @param propertyDefinition - definition of a given property in the app schema
1011
- * @param key - actual key
1012
- * @param {MetadataInstanceInterface} factory - factory for creating metadata instances
1013
- * @param pageType - page type
1014
- */
1015
- function getNextTargetDefinition(appSchema, title, currentConfigObject, propertyDefinition, key, factory, pageType) {
1016
- let nextDefinition;
1017
- if (propertyDefinition['type'] === 'array') {
1018
- nextDefinition = getNextTargetDefinition(appSchema, title, currentConfigObject, propertyDefinition['items'], key, factory, pageType);
1019
- return nextDefinition;
1020
- }
1021
- const definitionArray = fillArrayFromPropertyDefinition(propertyDefinition, currentConfigObject, appSchema);
1022
- if (!definitionArray) {
1023
- return undefined;
1024
- }
1025
- nextDefinition = determineNextDefinitionFromDefinitionArray(definitionArray, appSchema, title, currentConfigObject, key, factory, pageType, propertyDefinition);
1026
- return nextDefinition;
1027
- }
1028
- exports.getNextTargetDefinition = getNextTargetDefinition;
1029
- function prepareRef(refInput) {
1030
- return refInput.replace('#', '::').replace(/\//g, '::');
1031
- }
1032
- exports.prepareRef = prepareRef;
1033
- /**
1034
- * Custom array merge function called by deepmerge's merge function
1035
- *
1036
- * @param {*} target Target array
1037
- * @param {*} source Source array
1038
- * @param {*} options options object provided by deepmerge's merge function
1039
- * @returns
1040
- */
1041
- exports.arrayCombineMerge = (target, source, options) => {
1042
- const destination = target.slice();
1043
- source.forEach((item, index) => {
1044
- if (typeof destination[index] === 'undefined') {
1045
- destination[index] = options.cloneUnlessOtherwiseSpecified(item, options);
1046
- }
1047
- else if (options.isMergeableObject(item)) {
1048
- destination[index] = deepmerge_1.default(target[index], item, options);
1049
- }
1050
- else if (target.indexOf(item) === -1) {
1051
- destination.push(item);
1052
- }
1053
- });
1054
- return destination;
1055
- };
1056
- //# sourceMappingURL=utils.js.map