@sap/ux-specification 1.90.19 → 1.96.4

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