@sap/ux-specification 1.90.9 → 1.90.13

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 (259) hide show
  1. package/CHANGELOG.md +99 -24
  2. package/README.md +4 -4
  3. package/dist/documentation/runDocu-min.js +2 -0
  4. package/dist/documentation/runDocu-min.js.LICENSE.txt +24 -0
  5. package/dist/documentation/styleDocu.css +227 -0
  6. package/dist/documentation/v2/v2-AnalyticalListPage.html +49 -0
  7. package/dist/documentation/v2/v2-ApplicationV2.html +48 -0
  8. package/dist/documentation/v2/v2-ListReport.html +49 -0
  9. package/dist/documentation/v2/v2-ObjectPage.html +49 -0
  10. package/dist/documentation/v2/v2-OverviewPage.html +49 -0
  11. package/dist/documentation/v4/v4-AnalyticalListPage.html +49 -0
  12. package/dist/documentation/v4/v4-ApplicationV4.html +48 -0
  13. package/dist/documentation/v4/v4-ListReport.html +49 -0
  14. package/dist/documentation/v4/v4-ObjectPage.html +49 -0
  15. package/dist/index-min.js +1 -1
  16. package/dist/schemas/v2/AnalyticalListPageConfig.json +87 -12
  17. package/dist/schemas/v2/ApplicationV2.json +6 -0
  18. package/dist/schemas/v2/ListReportConfig.json +86 -11
  19. package/dist/schemas/v2/ObjectPageConfig.json +338 -52
  20. package/dist/schemas/v2/OverviewPageConfig.json +25 -42
  21. package/dist/schemas/v4/ApplicationV4.json +2 -1
  22. package/dist/schemas/v4/ObjectPageConfig.json +35 -2
  23. package/dist/scripts/extractDocu.js +186 -19
  24. package/dist/scripts/extractDocu.js.map +1 -1
  25. package/dist/scripts/runDocu.d.ts +1 -0
  26. package/dist/scripts/runDocu.js +561 -0
  27. package/dist/scripts/runDocu.js.map +1 -0
  28. package/dist/specification/v2/index-min.js +1 -1
  29. package/dist/specification/v4/index-min.js +1 -1
  30. package/dist/src/api.js +13 -22
  31. package/dist/src/api.js.map +1 -1
  32. package/dist/src/apiTypes.d.ts +117 -105
  33. package/dist/src/extensionLogger.js +7 -2
  34. package/dist/src/extensionLogger.js.map +1 -1
  35. package/dist/src/specification/common/page.d.ts +2 -3
  36. package/dist/src/specification/common/page.js +0 -1
  37. package/dist/src/specification/common/page.js.map +1 -1
  38. package/dist/src/specification/common/types.d.ts +1 -0
  39. package/dist/src/specification/common/webapp/manifest/Manifest.d.ts +3 -1
  40. package/dist/src/specification/common/webapp/manifest/Manifest.js +1 -0
  41. package/dist/src/specification/common/webapp/manifest/Manifest.js.map +1 -1
  42. package/dist/src/specification/common/webapp/manifest/sapOvp.d.ts +2 -1
  43. package/dist/src/specification/v2/ApplicationV2.d.ts +6 -0
  44. package/dist/src/specification/v2/controls/AnalyticalListPageChart.d.ts +1 -1
  45. package/dist/src/specification/v2/controls/Card.d.ts +11 -10
  46. package/dist/src/specification/v2/controls/Card.js.map +1 -1
  47. package/dist/src/specification/v2/controls/Facets.d.ts +2 -1
  48. package/dist/src/specification/v2/controls/Field.d.ts +10 -0
  49. package/dist/src/specification/v2/controls/Field.js +3 -0
  50. package/dist/src/specification/v2/controls/Field.js.map +1 -0
  51. package/dist/src/specification/v2/controls/FormAction.d.ts +43 -0
  52. package/dist/src/specification/v2/controls/FormAction.js +20 -0
  53. package/dist/src/specification/v2/controls/FormAction.js.map +1 -0
  54. package/dist/src/specification/v2/controls/ObjectPageChart.d.ts +1 -1
  55. package/dist/src/specification/v2/controls/ObjectPageFooter.d.ts +11 -0
  56. package/dist/src/specification/v2/controls/ObjectPageFooter.js +3 -0
  57. package/dist/src/specification/v2/controls/ObjectPageFooter.js.map +1 -0
  58. package/dist/src/specification/v2/controls/ObjectPageForm.d.ts +16 -0
  59. package/dist/src/specification/v2/controls/ObjectPageForm.js +3 -0
  60. package/dist/src/specification/v2/controls/ObjectPageForm.js.map +1 -0
  61. package/dist/src/specification/v2/controls/ObjectPageHeaderAction.d.ts +21 -5
  62. package/dist/src/specification/v2/controls/ObjectPageHeaderAction.js +0 -5
  63. package/dist/src/specification/v2/controls/ObjectPageHeaderAction.js.map +1 -1
  64. package/dist/src/specification/v2/controls/ObjectPageSection.d.ts +25 -8
  65. package/dist/src/specification/v2/controls/ObjectPageSection.js.map +1 -1
  66. package/dist/src/specification/v2/controls/ObjectPageTable.d.ts +12 -5
  67. package/dist/src/specification/v2/controls/ObjectPageTable.js.map +1 -1
  68. package/dist/src/specification/v2/controls/Table.d.ts +4 -3
  69. package/dist/src/specification/v2/controls/ToolBar.d.ts +2 -6
  70. package/dist/src/specification/v2/controls/index.d.ts +5 -0
  71. package/dist/src/specification/v2/controls/index.js +1 -1
  72. package/dist/src/specification/v2/controls/index.js.map +1 -1
  73. package/dist/src/specification/v2/pages/ListReportConfig.d.ts +2 -1
  74. package/dist/src/specification/v2/pages/ObjectPageConfig.d.ts +2 -1
  75. package/dist/src/specification/v2/webapp/manifest/sapUiPageV2.d.ts +1 -0
  76. package/dist/src/specification/v2/webapp/manifest/sapUiPageV2.js +1 -0
  77. package/dist/src/specification/v2/webapp/manifest/sapUiPageV2.js.map +1 -1
  78. package/dist/src/specification/v4/ApplicationV4.d.ts +2 -0
  79. package/dist/src/specification/v4/controls/ObjectPageFooter.d.ts +11 -0
  80. package/dist/src/specification/v4/controls/ObjectPageFooter.js +3 -0
  81. package/dist/src/specification/v4/controls/ObjectPageFooter.js.map +1 -0
  82. package/dist/src/specification/v4/controls/ObjectPageHeader.d.ts +6 -1
  83. package/dist/src/specification/v4/controls/index.d.ts +1 -0
  84. package/dist/src/specification/v4/pages/ObjectPageConfig.d.ts +2 -1
  85. package/dist/src/specification/v4/webapp/manifest/sapUi5.d.ts +2 -1
  86. package/dist/src/specification/v4/webapp/manifest/sapUi5.js.map +1 -1
  87. package/dist/src/specification/v4/webapp/manifest/sapUiPageV4.d.ts +1 -0
  88. package/dist/src/specification/v4/webapp/manifest/sapUiPageV4.js +1 -0
  89. package/dist/src/specification/v4/webapp/manifest/sapUiPageV4.js.map +1 -1
  90. package/dist/src/sync/common/decoration/control.d.ts +8 -1
  91. package/dist/src/sync/common/decoration/control.js +62 -21
  92. package/dist/src/sync/common/decoration/control.js.map +1 -1
  93. package/dist/src/sync/common/flexUtils.d.ts +2 -2
  94. package/dist/src/sync/common/flexUtils.js +10 -5
  95. package/dist/src/sync/common/flexUtils.js.map +1 -1
  96. package/dist/src/sync/common/generate/index.d.ts +1 -0
  97. package/dist/src/sync/common/generate/index.js +7 -0
  98. package/dist/src/sync/common/generate/index.js.map +1 -0
  99. package/dist/src/sync/common/generate/objectPage.d.ts +49 -0
  100. package/dist/src/sync/common/generate/objectPage.js +331 -0
  101. package/dist/src/sync/common/generate/objectPage.js.map +1 -0
  102. package/dist/src/sync/common/i18n.json +1 -0
  103. package/dist/src/sync/common/import/utils.d.ts +28 -0
  104. package/dist/src/sync/common/import/utils.js +75 -0
  105. package/dist/src/sync/common/import/utils.js.map +1 -0
  106. package/dist/src/sync/common/importProject.js +70 -79
  107. package/dist/src/sync/common/importProject.js.map +1 -1
  108. package/dist/src/sync/common/index.d.ts +2 -0
  109. package/dist/src/sync/common/index.js +2 -0
  110. package/dist/src/sync/common/index.js.map +1 -1
  111. package/dist/src/sync/common/types.d.ts +17 -5
  112. package/dist/src/sync/common/types.js +12 -0
  113. package/dist/src/sync/common/types.js.map +1 -1
  114. package/dist/src/sync/common/utils.d.ts +41 -13
  115. package/dist/src/sync/common/utils.js +291 -198
  116. package/dist/src/sync/common/utils.js.map +1 -1
  117. package/dist/src/sync/v2/application.d.ts +2 -0
  118. package/dist/src/sync/v2/application.js +21 -10
  119. package/dist/src/sync/v2/application.js.map +1 -1
  120. package/dist/src/sync/v2/export/controls/Card.d.ts +4 -3
  121. package/dist/src/sync/v2/export/controls/Card.js +16 -9
  122. package/dist/src/sync/v2/export/controls/Card.js.map +1 -1
  123. package/dist/src/sync/v2/export/controls/Field.d.ts +4 -0
  124. package/dist/src/sync/v2/export/controls/Field.js +32 -0
  125. package/dist/src/sync/v2/export/controls/Field.js.map +1 -0
  126. package/dist/src/sync/v2/export/controls/FilterBar.d.ts +1 -2
  127. package/dist/src/sync/v2/export/controls/FilterBar.js +17 -19
  128. package/dist/src/sync/v2/export/controls/FilterBar.js.map +1 -1
  129. package/dist/src/sync/v2/export/controls/FormAction.d.ts +15 -0
  130. package/dist/src/sync/v2/export/controls/FormAction.js +133 -0
  131. package/dist/src/sync/v2/export/controls/FormAction.js.map +1 -0
  132. package/dist/src/sync/v2/export/controls/Fragment.d.ts +1 -1
  133. package/dist/src/sync/v2/export/controls/Fragment.js +100 -87
  134. package/dist/src/sync/v2/export/controls/Fragment.js.map +1 -1
  135. package/dist/src/sync/v2/export/controls/ObjectPageChart.d.ts +4 -1
  136. package/dist/src/sync/v2/export/controls/ObjectPageChart.js +13 -0
  137. package/dist/src/sync/v2/export/controls/ObjectPageChart.js.map +1 -1
  138. package/dist/src/sync/v2/export/controls/ObjectPageHeader.js +1 -1
  139. package/dist/src/sync/v2/export/controls/ObjectPageHeader.js.map +1 -1
  140. package/dist/src/sync/v2/export/controls/ObjectPageHeaderAction.d.ts +6 -2
  141. package/dist/src/sync/v2/export/controls/ObjectPageHeaderAction.js +43 -4
  142. package/dist/src/sync/v2/export/controls/ObjectPageHeaderAction.js.map +1 -1
  143. package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.d.ts +32 -0
  144. package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.js +144 -0
  145. package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.js.map +1 -0
  146. package/dist/src/sync/v2/export/controls/ObjectPageTable.d.ts +5 -4
  147. package/dist/src/sync/v2/export/controls/ObjectPageTable.js +19 -7
  148. package/dist/src/sync/v2/export/controls/ObjectPageTable.js.map +1 -1
  149. package/dist/src/sync/v2/export/controls/Table.d.ts +12 -4
  150. package/dist/src/sync/v2/export/controls/Table.js +105 -57
  151. package/dist/src/sync/v2/export/controls/Table.js.map +1 -1
  152. package/dist/src/sync/v2/export/controls/TableColumn.js +1 -1
  153. package/dist/src/sync/v2/export/controls/TableColumn.js.map +1 -1
  154. package/dist/src/sync/v2/export/controls/index.d.ts +3 -0
  155. package/dist/src/sync/v2/export/controls/index.js +3 -0
  156. package/dist/src/sync/v2/export/controls/index.js.map +1 -1
  157. package/dist/src/sync/v2/export/export.d.ts +24 -10
  158. package/dist/src/sync/v2/export/export.js +284 -503
  159. package/dist/src/sync/v2/export/export.js.map +1 -1
  160. package/dist/src/sync/v2/export/exportPage.d.ts +10 -0
  161. package/dist/src/sync/v2/export/exportPage.js +311 -0
  162. package/dist/src/sync/v2/export/exportPage.js.map +1 -0
  163. package/dist/src/sync/v2/export/pages/ListReport.d.ts +3 -1
  164. package/dist/src/sync/v2/export/pages/ListReport.js.map +1 -1
  165. package/dist/src/sync/v2/export/pages/ObjectPage.js.map +1 -1
  166. package/dist/src/sync/v2/export/pages/OverviewPage.d.ts +4 -2
  167. package/dist/src/sync/v2/export/pages/OverviewPage.js +1 -1
  168. package/dist/src/sync/v2/export/pages/OverviewPage.js.map +1 -1
  169. package/dist/src/sync/v2/export/view-controller-generator.js +1 -1
  170. package/dist/src/sync/v2/export/view-controller-generator.js.map +1 -1
  171. package/dist/src/sync/v2/generate/analyticalListReport.d.ts +3 -9
  172. package/dist/src/sync/v2/generate/analyticalListReport.js +15 -16
  173. package/dist/src/sync/v2/generate/analyticalListReport.js.map +1 -1
  174. package/dist/src/sync/v2/generate/generate.js +28 -6
  175. package/dist/src/sync/v2/generate/generate.js.map +1 -1
  176. package/dist/src/sync/v2/generate/listReport.d.ts +3 -10
  177. package/dist/src/sync/v2/generate/listReport.js +24 -30
  178. package/dist/src/sync/v2/generate/listReport.js.map +1 -1
  179. package/dist/src/sync/v2/generate/objectPage.d.ts +3 -10
  180. package/dist/src/sync/v2/generate/objectPage.js +246 -155
  181. package/dist/src/sync/v2/generate/objectPage.js.map +1 -1
  182. package/dist/src/sync/v2/generate/utils.d.ts +1 -2
  183. package/dist/src/sync/v2/generate/utils.js +19 -4
  184. package/dist/src/sync/v2/generate/utils.js.map +1 -1
  185. package/dist/src/sync/v2/import/app/appProvider.js +25 -3
  186. package/dist/src/sync/v2/import/app/appProvider.js.map +1 -1
  187. package/dist/src/sync/v2/import/app/ovpProvider.d.ts +2 -1
  188. package/dist/src/sync/v2/import/app/ovpProvider.js +7 -3
  189. package/dist/src/sync/v2/import/app/ovpProvider.js.map +1 -1
  190. package/dist/src/sync/v2/import/common/index.d.ts +10 -1
  191. package/dist/src/sync/v2/import/common/index.js +17 -38
  192. package/dist/src/sync/v2/import/common/index.js.map +1 -1
  193. package/dist/src/sync/v2/import/controls/table.d.ts +2 -1
  194. package/dist/src/sync/v2/import/controls/table.js +1 -1
  195. package/dist/src/sync/v2/import/controls/table.js.map +1 -1
  196. package/dist/src/sync/v2/import/pages/analyticalListPage.d.ts +3 -8
  197. package/dist/src/sync/v2/import/pages/analyticalListPage.js +23 -24
  198. package/dist/src/sync/v2/import/pages/analyticalListPage.js.map +1 -1
  199. package/dist/src/sync/v2/import/pages/listReport.d.ts +3 -7
  200. package/dist/src/sync/v2/import/pages/listReport.js +26 -27
  201. package/dist/src/sync/v2/import/pages/listReport.js.map +1 -1
  202. package/dist/src/sync/v2/import/pages/objectPage.d.ts +3 -10
  203. package/dist/src/sync/v2/import/pages/objectPage.js +294 -156
  204. package/dist/src/sync/v2/import/pages/objectPage.js.map +1 -1
  205. package/dist/src/sync/v2/import/pages/overviewPage.d.ts +2 -1
  206. package/dist/src/sync/v2/import/pages/overviewPage.js +65 -57
  207. package/dist/src/sync/v2/import/pages/overviewPage.js.map +1 -1
  208. package/dist/src/sync/v2/import/utils.d.ts +3 -3
  209. package/dist/src/sync/v2/import/utils.js +5 -5
  210. package/dist/src/sync/v2/import/utils.js.map +1 -1
  211. package/dist/src/sync/v2/types.d.ts +33 -0
  212. package/dist/src/sync/v2/types.js +16 -0
  213. package/dist/src/sync/v2/types.js.map +1 -1
  214. package/dist/src/sync/v4/application.js +10 -10
  215. package/dist/src/sync/v4/application.js.map +1 -1
  216. package/dist/src/sync/v4/export/controls/ObjectPageTable.js +4 -3
  217. package/dist/src/sync/v4/export/controls/ObjectPageTable.js.map +1 -1
  218. package/dist/src/sync/v4/export/controls/Table.js +4 -3
  219. package/dist/src/sync/v4/export/controls/Table.js.map +1 -1
  220. package/dist/src/sync/v4/export/export.d.ts +1 -1
  221. package/dist/src/sync/v4/export/export.js +219 -175
  222. package/dist/src/sync/v4/export/export.js.map +1 -1
  223. package/dist/src/sync/v4/export/manifest.js +100 -78
  224. package/dist/src/sync/v4/export/manifest.js.map +1 -1
  225. package/dist/src/sync/v4/export/pages/AnalyticalListPage.js +3 -2
  226. package/dist/src/sync/v4/export/pages/AnalyticalListPage.js.map +1 -1
  227. package/dist/src/sync/v4/export/types.d.ts +14 -1
  228. package/dist/src/sync/v4/generate/generate.js +10 -2
  229. package/dist/src/sync/v4/generate/generate.js.map +1 -1
  230. package/dist/src/sync/v4/generate/listReport.js +1 -1
  231. package/dist/src/sync/v4/generate/listReport.js.map +1 -1
  232. package/dist/src/sync/v4/generate/objectPage.d.ts +3 -6
  233. package/dist/src/sync/v4/generate/objectPage.js +97 -193
  234. package/dist/src/sync/v4/generate/objectPage.js.map +1 -1
  235. package/dist/src/sync/v4/import/app/appProvider.d.ts +1 -1
  236. package/dist/src/sync/v4/import/app/appProvider.js +131 -52
  237. package/dist/src/sync/v4/import/app/appProvider.js.map +1 -1
  238. package/dist/src/sync/v4/import/fragment.js +53 -58
  239. package/dist/src/sync/v4/import/fragment.js.map +1 -1
  240. package/dist/src/sync/v4/import/pages/analyticalListPage.d.ts +2 -2
  241. package/dist/src/sync/v4/import/pages/analyticalListPage.js +6 -6
  242. package/dist/src/sync/v4/import/pages/analyticalListPage.js.map +1 -1
  243. package/dist/src/sync/v4/import/pages/listReport.d.ts +5 -7
  244. package/dist/src/sync/v4/import/pages/listReport.js +21 -23
  245. package/dist/src/sync/v4/import/pages/listReport.js.map +1 -1
  246. package/dist/src/sync/v4/import/pages/objectPage.d.ts +3 -5
  247. package/dist/src/sync/v4/import/pages/objectPage.js +105 -73
  248. package/dist/src/sync/v4/import/pages/objectPage.js.map +1 -1
  249. package/dist/src/sync/v4/import/utils.d.ts +11 -9
  250. package/dist/src/sync/v4/import/utils.js +23 -13
  251. package/dist/src/sync/v4/import/utils.js.map +1 -1
  252. package/dist/src/sync/v4/utils/StableIdHelper.js +5 -7
  253. package/dist/src/sync/v4/utils/StableIdHelper.js.map +1 -1
  254. package/dist/src/sync/v4/utils/utils.js +3 -2
  255. package/dist/src/sync/v4/utils/utils.js.map +1 -1
  256. package/package.json +16 -7
  257. package/dist/src/sync/v4/import/common/index.d.ts +0 -12
  258. package/dist/src/sync/v4/import/common/index.js +0 -41
  259. package/dist/src/sync/v4/import/common/index.js.map +0 -1
@@ -9,6 +9,7 @@ const edmx_parser_1 = require("@sap-ux/edmx-parser");
9
9
  const common_1 = require("../../specification/common");
10
10
  const schemaAccess_1 = require("../../specification/schemaAccess");
11
11
  const i18next_1 = __importDefault(require("i18next"));
12
+ const v2_1 = require("../../specification/v2");
12
13
  const v4_1 = require("../../specification/v4");
13
14
  const extensionLogger_1 = require("../../extensionLogger");
14
15
  const deepmerge_1 = __importDefault(require("deepmerge"));
@@ -16,7 +17,6 @@ var TemplateType;
16
17
  (function (TemplateType) {
17
18
  TemplateType["ListReportObjectPageV2"] = "ListReportObjectPageV2";
18
19
  TemplateType["ListReportObjectPageV4"] = "ListReportObjectPageV4";
19
- TemplateType["FormPageV4"] = "FormPageV4";
20
20
  TemplateType["OverviewPageV2"] = "OverviewPageV2";
21
21
  TemplateType["AnalyticalListPageV2"] = "AnalyticalListPageV2";
22
22
  TemplateType["AnalyticalListPageV4"] = "AnalyticalListPageV4";
@@ -84,11 +84,12 @@ function evaluateCommonLabel(annotations, entityType, label) {
84
84
  }
85
85
  else if (annotations.Common.Label['type'] === 'Path') {
86
86
  const targetProperty = entityType.resolvePath(annotations.Common.Label['path']);
87
- label = targetProperty.value
88
- ? targetProperty.value
89
- : typeof ((_b = targetProperty.Common) === null || _b === void 0 ? void 0 : _b.Label) === 'string'
90
- ? targetProperty.annotations.Common.Label
91
- : label;
87
+ if (targetProperty.value) {
88
+ label = targetProperty.value;
89
+ }
90
+ else if (typeof ((_b = targetProperty.Common) === null || _b === void 0 ? void 0 : _b.Label) === 'string') {
91
+ label = targetProperty.annotations.Common.Label;
92
+ }
92
93
  }
93
94
  else if (typeof ((_d = (_c = annotations.Common) === null || _c === void 0 ? void 0 : _c.Label) === null || _d === void 0 ? void 0 : _d.toString()) === 'string') {
94
95
  label = annotations.Common.Label.toString();
@@ -105,7 +106,9 @@ exports.evaluateCommonLabel = evaluateCommonLabel;
105
106
  */
106
107
  function getLabelForPropertyPath(propertyPath, entityType) {
107
108
  let label = propertyPath.value;
108
- label = evaluateCommonLabel(propertyPath.$target.annotations, entityType, label);
109
+ if (propertyPath.$target) {
110
+ label = evaluateCommonLabel(propertyPath.$target.annotations, entityType, label);
111
+ }
109
112
  return label;
110
113
  }
111
114
  exports.getLabelForPropertyPath = getLabelForPropertyPath;
@@ -166,6 +169,12 @@ function getLabel(dataFieldLabel, entityType) {
166
169
  return undefined;
167
170
  }
168
171
  }
172
+ function getTitleForDataField(dataField, entityType, dataFieldLabel) {
173
+ const propertyCommonLabel = getLabelForDataField(dataField, entityType);
174
+ return (dataFieldLabel ||
175
+ propertyCommonLabel ||
176
+ (dataField.Value.$target ? dataField.Value.$target.name : dataField.Value.value || dataField.Value.path));
177
+ }
169
178
  /**
170
179
  * Determines the description of a data field, e.g. for the column header
171
180
  * @param dataFieldAbstract - the given record of the line item annotation
@@ -177,13 +186,7 @@ function getDatafieldDescription(dataFieldAbstract, entityType) {
177
186
  switch (dataFieldAbstract.$Type) {
178
187
  case "com.sap.vocabularies.UI.v1.DataField" /* DataField */:
179
188
  dataField = dataFieldAbstract;
180
- propertyCommonLabel = getLabelForDataField(dataFieldAbstract, entityType);
181
- title =
182
- dataFieldLabel ||
183
- propertyCommonLabel ||
184
- (dataField.Value.$target
185
- ? dataField.Value.$target.name
186
- : dataField.Value.value || dataField.Value.path);
189
+ title = getTitleForDataField(dataField, entityType, dataFieldLabel);
187
190
  break;
188
191
  case "com.sap.vocabularies.UI.v1.DataFieldWithUrl" /* DataFieldWithUrl */:
189
192
  dataField = dataFieldAbstract;
@@ -215,13 +218,7 @@ function getDatafieldDescription(dataFieldAbstract, entityType) {
215
218
  break;
216
219
  case "com.sap.vocabularies.UI.v1.DataFieldWithNavigationPath" /* DataFieldWithNavigationPath */:
217
220
  dataField = dataFieldAbstract;
218
- propertyCommonLabel = getLabelForDataField(dataFieldAbstract, entityType);
219
- title =
220
- dataFieldLabel ||
221
- propertyCommonLabel ||
222
- (dataField.Value.$target
223
- ? dataField.Value.$target.name
224
- : dataField.Value.value || dataField.Value.path);
221
+ title = getTitleForDataField(dataField, entityType, dataFieldLabel);
225
222
  break;
226
223
  default:
227
224
  break;
@@ -235,7 +232,8 @@ exports.getDatafieldDescription = getDatafieldDescription;
235
232
  */
236
233
  function getPageTypeV2(name) {
237
234
  if (name) {
238
- return name.split('sap.suite.ui.generic.template.')[1];
235
+ const templatePart = `${v2_1.FE_TEMPLATE_V2}.`;
236
+ return name.split(templatePart)[1];
239
237
  }
240
238
  }
241
239
  exports.getPageTypeV2 = getPageTypeV2;
@@ -245,7 +243,8 @@ exports.getPageTypeV2 = getPageTypeV2;
245
243
  */
246
244
  function getPageTypeV4(name) {
247
245
  if (name) {
248
- return name.split('sap.fe.templates.')[1];
246
+ const templatePart = `${v4_1.FE_TEMPLATE_V4}.`;
247
+ return name.split(templatePart)[1];
249
248
  }
250
249
  }
251
250
  exports.getPageTypeV4 = getPageTypeV4;
@@ -276,6 +275,38 @@ function findAlias(namespace, oDataServiceAVT) {
276
275
  return aliasReference === null || aliasReference === void 0 ? void 0 : aliasReference.alias;
277
276
  }
278
277
  exports.findAlias = findAlias;
278
+ /**
279
+ * Determines the target annotation
280
+ * @param navigationParts - parts of the target annotation path
281
+ * @param entityType - entity type
282
+ * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
283
+ * @returns the target annotation
284
+ */
285
+ function determineTargetAnnotation(navigationParts, entityType, oDataServiceAVT) {
286
+ var _a;
287
+ const lastNavigationPart = navigationParts[navigationParts.length - 1];
288
+ const annotation = lastNavigationPart.substring(lastNavigationPart.lastIndexOf('.') + 1, lastNavigationPart.length);
289
+ const alias = findAlias(lastNavigationPart.substring(0, lastNavigationPart.lastIndexOf('.')).replace('@', ''), oDataServiceAVT);
290
+ return (_a = entityType === null || entityType === void 0 ? void 0 : entityType.annotations[alias]) === null || _a === void 0 ? void 0 : _a[annotation];
291
+ }
292
+ /**
293
+ * Adjust key by considering navigation
294
+ * @param key - given key
295
+ * @param keyForRelatedFacetKeys - construct key for 'keyForRelatedFacetKeys' property(used to define custom sections) - we should not add '@' symbol there.
296
+ * @param navigationParts - parts of the target annotation path
297
+ */
298
+ function adjustKey(key, navigationParts, keyForRelatedFacetKeys) {
299
+ const uiParts = (navigationParts[1] || navigationParts[0]).split('#');
300
+ const uiClass = uiParts[0];
301
+ if (uiClass.includes('.LineItem')) {
302
+ const pathParts = key.split('::');
303
+ pathParts[pathParts.length - 1] = `${!keyForRelatedFacetKeys ? '@' : ''}${"com.sap.vocabularies.UI.v1.LineItem" /* LineItem */}`;
304
+ key = pathParts.join('::');
305
+ }
306
+ else {
307
+ key = uiClass.replace('@UI', `${!keyForRelatedFacetKeys ? '@' : ''}com.sap.vocabularies.UI.v1`);
308
+ }
309
+ }
279
310
  /**
280
311
  * Resolve page section(get key and label->description).
281
312
  * @param facetDefinition - the actual annotation record
@@ -285,12 +316,12 @@ exports.findAlias = findAlias;
285
316
  * @param {ExtensionLogger} logger - Logger class for logging messages
286
317
  * @returns {FacetSection} - object comprising the relevant facet information
287
318
  */
288
- function getSectionFacet(facetDefinition, keyForRelatedFacetKeys = false, oDataVersion = common_1.FioriElementsVersion.v2, sourceEntityType, oDataServiceAVT, logger) {
289
- var _a, _b;
290
- let entityType = sourceEntityType; //default
291
- const facetName = facetDefinition.fullyQualifiedName.substr(facetDefinition.fullyQualifiedName.lastIndexOf('@'));
319
+ function getSectionFacet(facetDefinition, sourceEntityType, oDataServiceAVT, logger, oDataVersion = common_1.FioriElementsVersion.v2, keyForRelatedFacetKeys = false) {
320
+ var _a;
292
321
  //Take facet ID as fallback
322
+ const facetName = facetDefinition.fullyQualifiedName.substr(facetDefinition.fullyQualifiedName.lastIndexOf('@'));
293
323
  let key = facetDefinition.ID ? facetDefinition.ID.toString() : facetName;
324
+ let entityType = sourceEntityType; //default
294
325
  //If reference facet: overwrite with target annotation if present
295
326
  if (facetDefinition.$Type !== 'com.sap.vocabularies.UI.v1.CollectionFacet' && 'Target' in facetDefinition) {
296
327
  const propertyValue = exports.getAnnotationPropertyValue(facetDefinition.Target);
@@ -301,34 +332,22 @@ function getSectionFacet(facetDefinition, keyForRelatedFacetKeys = false, oDataV
301
332
  });
302
333
  return;
303
334
  }
304
- const navSeparator = oDataVersion === common_1.FioriElementsVersion.v2 ? '::' : '/';
305
- const separator = oDataVersion === common_1.FioriElementsVersion.v2 ? '::' : '#';
306
335
  const navigationParts = propertyValue.split('/');
307
336
  const navigation = navigationParts.length > 1 ? navigationParts[0] : '';
308
337
  if (navigation) {
309
338
  entityType = (_a = sourceEntityType.resolvePath(navigation)) === null || _a === void 0 ? void 0 : _a.targetType;
310
339
  }
311
- const uiParts = (navigationParts[1] || navigationParts[0]).split('#');
312
- const uiClass = uiParts[0];
313
- if (uiClass.includes('.LineItem')) {
314
- const pathParts = key.split('::');
315
- pathParts[pathParts.length - 1] = `${!keyForRelatedFacetKeys ? '@' : ''}com.sap.vocabularies.UI.v1.LineItem`;
316
- key = pathParts.join('::');
317
- }
318
- else {
319
- key = uiClass.replace('@UI', `${!keyForRelatedFacetKeys ? '@' : ''}com.sap.vocabularies.UI.v1`);
320
- }
321
- const lastNavigationPart = navigationParts[navigationParts.length - 1];
322
- const annotation = lastNavigationPart.substring(lastNavigationPart.lastIndexOf('.') + 1, lastNavigationPart.length);
323
- const alias = findAlias(lastNavigationPart.substring(0, lastNavigationPart.lastIndexOf('.')).replace('@', ''), oDataServiceAVT);
324
- const targetAnnotation = (_b = entityType === null || entityType === void 0 ? void 0 : entityType.annotations[alias]) === null || _b === void 0 ? void 0 : _b[annotation];
340
+ adjustKey(key, navigationParts, keyForRelatedFacetKeys);
341
+ const targetAnnotation = determineTargetAnnotation(navigationParts, entityType, oDataServiceAVT);
325
342
  if (targetAnnotation) {
343
+ const separator = oDataVersion === common_1.FioriElementsVersion.v2 ? '::' : '#';
326
344
  key = getTargetAnnotationName(targetAnnotation, keyForRelatedFacetKeys).replace('#', separator);
327
345
  }
328
346
  else {
329
347
  return undefined;
330
348
  }
331
349
  if (navigation) {
350
+ const navSeparator = oDataVersion === common_1.FioriElementsVersion.v2 ? '::' : '/';
332
351
  key = `${navigation}${navSeparator}${key}`;
333
352
  }
334
353
  }
@@ -425,69 +444,58 @@ exports.getSchemaKeyOfLineItemRecord = getSchemaKeyOfLineItemRecord;
425
444
  * @param {FioriElementsVersion} oDataVersion - OData version
426
445
  * @param {ExtensionLogger} logger - Logger class for logging messages
427
446
  */
428
- function evaluateTargetAnnotation(annotationRecord, facets, entityType, oDataServiceAVT, oDataVersion = common_1.FioriElementsVersion.v2, logger) {
447
+ function evaluateTargetAnnotation(section, annotationRecord, facets, entityType, oDataServiceAVT, oDataVersion = common_1.FioriElementsVersion.v2, logger) {
429
448
  var _a, _b, _c, _d, _e;
430
- const alias = findAlias('com.sap.vocabularies.UI.v1', oDataServiceAVT);
431
- const section = getSectionFacet(annotationRecord, false, oDataVersion, entityType, oDataServiceAVT, logger);
432
- if (!section) {
433
- return;
434
- }
449
+ const alias = findAlias(types_1.UIVOCABULARY, oDataServiceAVT);
435
450
  let path = section ? section.key : '';
436
451
  const targetEntityType = section.entityType;
437
- let version, annotation, targetAnnotation;
438
- let scope = alias;
439
- if (path.includes('com.sap.vocabularies.UI.v1.Chart') || path.includes(alias + '.Chart')) {
452
+ let annotation, targetAnnotation;
453
+ if (path.includes("com.sap.vocabularies.UI.v1.Chart" /* Chart */) || path.includes(alias + '.Chart')) {
440
454
  facets[path] = { base: types_1.FacetBase.Chart };
441
455
  facets[path]['entityType'] = targetEntityType;
442
456
  }
443
- else if (path.includes('com.sap.vocabularies.UI.v1.Identification') || path.includes(alias + '.Identification')) {
457
+ else if (path.includes("com.sap.vocabularies.UI.v1.Identification" /* Identification */) || path.includes(alias + '.Identification')) {
444
458
  annotation = path.split('.')[path.split('.').length - 1];
445
- targetAnnotation = targetEntityType.annotations[scope][annotation];
459
+ targetAnnotation = targetEntityType.annotations[alias][annotation];
446
460
  facets[path] = { base: types_1.FacetBase.Identification };
447
461
  facets[path]['entityType'] = targetEntityType;
448
462
  facets[path]['target'] = targetAnnotation;
449
463
  }
450
- else if (path.includes('com.sap.vocabularies.UI.v1.LineItem') || path.includes(alias + '.LineItem')) {
451
- if (entityType) {
452
- if (path.includes('com.sap.vocabularies.UI.v1.LineItem')) {
453
- [scope, version, annotation] = path.split('com.sap.vocabularies.')[1].split('.');
454
- }
455
- else if (path.includes('.LineItem')) {
456
- annotation = 'LineItem';
457
- const pathParts = path.split('::');
458
- pathParts[pathParts.length - 1] = '@com.sap.vocabularies.UI.v1.LineItem';
459
- path = pathParts.join('::');
460
- }
461
- facets[path] = { base: types_1.FacetBase.LineItem };
462
- facets[path]['lineItem'] = (_a = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _a === void 0 ? void 0 : _a.$target;
463
- facets[path]['entityType'] = targetEntityType;
464
+ else if (entityType && (path.includes("com.sap.vocabularies.UI.v1.LineItem" /* LineItem */) || path.includes(alias + '.LineItem'))) {
465
+ if (!path.includes("com.sap.vocabularies.UI.v1.LineItem" /* LineItem */) && path.includes('.LineItem')) {
466
+ const pathParts = path.split('::');
467
+ pathParts[pathParts.length - 1] = `@${"com.sap.vocabularies.UI.v1.LineItem" /* LineItem */}`;
468
+ path = pathParts.join('::');
464
469
  }
470
+ facets[path] = { base: types_1.FacetBase.LineItem };
471
+ facets[path].target = (_a = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _a === void 0 ? void 0 : _a.$target;
472
+ facets[path].entityType = targetEntityType;
465
473
  }
466
- else if (path.includes('com.sap.vocabularies.UI.v1.FieldGroup') || path.includes(alias + '.FieldGroup')) {
474
+ else if (path.includes("com.sap.vocabularies.UI.v1.FieldGroup" /* FieldGroup */) || path.includes(alias + '.FieldGroup')) {
467
475
  facets[path] = { base: types_1.FacetBase.Form };
468
- facets[path]['target'] = (_b = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _b === void 0 ? void 0 : _b.$target;
469
- facets[path]['entityType'] = targetEntityType;
476
+ facets[path].target = (_b = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _b === void 0 ? void 0 : _b.$target;
477
+ facets[path].entityType = targetEntityType;
470
478
  }
471
- else if (path.includes('com.sap.vocabularies.UI.v1.DataPoint') || path.includes(alias + '.DataPoint')) {
479
+ else if (path.includes("com.sap.vocabularies.UI.v1.DataPoint" /* DataPoint */) || path.includes(alias + '.DataPoint')) {
472
480
  facets[path] = { base: types_1.FacetBase.DataPoint };
473
481
  facets[path].target = (_c = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _c === void 0 ? void 0 : _c.$target;
474
- facets[path]['entityType'] = targetEntityType;
482
+ facets[path].entityType = targetEntityType;
475
483
  }
476
484
  else if (path.includes('com.sap.vocabularies.Communication.v1.Contact') || path.includes(alias + '.Contact')) {
477
485
  facets[path] = { base: types_1.FacetBase.Contact };
478
486
  facets[path].target = (_d = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _d === void 0 ? void 0 : _d.$target;
479
- facets[path]['entityType'] = targetEntityType;
487
+ facets[path].entityType = targetEntityType;
480
488
  }
481
489
  else if (path.includes('com.sap.vocabularies.Communication.v1.Address') || path.includes(alias + '.Address')) {
482
490
  facets[path] = { base: types_1.FacetBase.Address };
483
491
  facets[path].target = (_e = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _e === void 0 ? void 0 : _e.$target;
484
- facets[path]['entityType'] = targetEntityType;
492
+ facets[path].entityType = targetEntityType;
485
493
  }
486
494
  else {
487
495
  facets[path] = { base: types_1.FacetBase.Unknown };
488
496
  }
489
497
  if (facets[path]) {
490
- facets[path].annotationPath = `/${annotationRecord.fullyQualifiedName.replace('@com.sap.vocabularies', '/@com.sap.vocabularies')}`;
498
+ facets[path].annotationPath = `/${annotationRecord.fullyQualifiedName.replace('@com.sap.vocabularies', types_1.VOCWITHSLASH)}`;
491
499
  if (annotationRecord.Label) {
492
500
  facets[path].Label = annotationRecord.Label;
493
501
  }
@@ -518,14 +526,14 @@ function evaluateTargetAnnotation(annotationRecord, facets, entityType, oDataSer
518
526
  */
519
527
  function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entityType, facets, oDataVersion = common_1.FioriElementsVersion.v2, logger) {
520
528
  var _a;
521
- switch (annotationRecord.$Type) {
522
- case "com.sap.vocabularies.UI.v1.ReferenceFacet" /* ReferenceFacet */: {
523
- evaluateTargetAnnotation(annotationRecord, facets, entityType, oDataServiceAVT, oDataVersion, logger);
524
- break;
525
- }
526
- case "com.sap.vocabularies.UI.v1.CollectionFacet" /* CollectionFacet */: {
527
- const section = getSectionFacet(annotationRecord, false, oDataVersion, entityType, oDataServiceAVT, logger);
528
- if (section) {
529
+ const section = getSectionFacet(annotationRecord, entityType, oDataServiceAVT, logger, oDataVersion, false);
530
+ if (section) {
531
+ switch (annotationRecord.$Type) {
532
+ case "com.sap.vocabularies.UI.v1.ReferenceFacet" /* ReferenceFacet */: {
533
+ evaluateTargetAnnotation(section, annotationRecord, facets, entityType, oDataServiceAVT, oDataVersion, logger);
534
+ break;
535
+ }
536
+ case "com.sap.vocabularies.UI.v1.CollectionFacet" /* CollectionFacet */: {
529
537
  const annotationPath = `/${entityType.fullyQualifiedName}/${annotationRecord.fullyQualifiedName.split(entityType.fullyQualifiedName)[1]}`;
530
538
  const facet = (facets[section.key] = {
531
539
  base: types_1.FacetBase.CollectionFacet,
@@ -537,8 +545,8 @@ function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entity
537
545
  (_a = annotationRecord.Facets) === null || _a === void 0 ? void 0 : _a.forEach((collectionItem) => {
538
546
  addFacetToConfig(collectionItem, oDataServiceAVT, serviceName, entityType, facet.facets, oDataVersion, logger);
539
547
  });
548
+ break;
540
549
  }
541
- break;
542
550
  }
543
551
  }
544
552
  }
@@ -554,7 +562,7 @@ function getObjectPageHeaderFacets(entityType, oDataServiceAVT, oDataVersion = c
554
562
  if (!entityType || !entityType.annotations) {
555
563
  return;
556
564
  }
557
- const alias = findAlias('com.sap.vocabularies.UI.v1', oDataServiceAVT);
565
+ const alias = findAlias(types_1.UIVOCABULARY, oDataServiceAVT);
558
566
  const facetAnnotation = alias && entityType.annotations[alias] && entityType.annotations[alias].HeaderFacets;
559
567
  if (facetAnnotation) {
560
568
  const lastDot = entityType.fullyQualifiedName.lastIndexOf('.');
@@ -579,7 +587,7 @@ function getObjectPageFacets(entityType, oDataServiceAVT, oDataVersion = common_
579
587
  if (!entityType || !entityType.annotations) {
580
588
  return;
581
589
  }
582
- const alias = findAlias('com.sap.vocabularies.UI.v1', oDataServiceAVT);
590
+ const alias = findAlias(types_1.UIVOCABULARY, oDataServiceAVT);
583
591
  const facetAnnotation = alias && entityType.annotations[alias] && entityType.annotations[alias].Facets;
584
592
  if (facetAnnotation) {
585
593
  const lastDot = entityType.fullyQualifiedName.lastIndexOf('.');
@@ -605,90 +613,118 @@ function getVersionFromManifest(manifest) {
605
613
  }
606
614
  }
607
615
  exports.getVersionFromManifest = getVersionFromManifest;
608
- function getTemplateTypeFromManifest(manifest, fioriElementsVersion, logger) {
616
+ /**
617
+ * Determines the template type of a V2 app
618
+ * @param manifest - the manifest.json file
619
+ * @param {ExtensionLogger} logger - Logger class for logging messages
620
+ * @returns {TemplateType} the template type
621
+ */
622
+ function determineV2Template(manifest, logger) {
609
623
  let templateType;
610
- if (manifest[v4_1.ManifestSection.ovp]) {
611
- templateType = TemplateType.OverviewPageV2;
612
- }
613
- else if (fioriElementsVersion === common_1.FioriElementsVersion.v2) {
614
- if (manifest[v4_1.ManifestSection.generic]) {
615
- const v2Pages = manifest[v4_1.ManifestSection.generic].pages;
616
- if (!v2Pages) {
617
- extensionLogger_1.log(logger, {
618
- severity: "error" /* Error */,
619
- message: i18next_1.default.t('NOPAGES', { appId: manifest['sap.app']['id'] }),
620
- location: {
621
- path: types_1.MANIFESTPATH,
622
- range: [v4_1.ManifestSection.generic]
623
- }
624
- });
625
- return;
626
- }
627
- for (const pageKey in v2Pages) {
628
- const v2Page = v2Pages[pageKey];
629
- if (getPageTypeV2(v2Page.component.name) === common_1.PageType.AnalyticalListPage) {
630
- templateType = TemplateType.AnalyticalListPageV2;
631
- break;
632
- }
633
- else if (getPageTypeV2(v2Page.component.name) === common_1.PageType.ListReport) {
634
- templateType = TemplateType.ListReportObjectPageV2;
635
- break;
636
- }
637
- }
638
- }
639
- else {
640
- if (!templateType) {
641
- extensionLogger_1.log(logger, {
642
- severity: "error" /* Error */,
643
- message: i18next_1.default.t('NOTEMPLATE', { section: v4_1.ManifestSection.generic }),
644
- location: {
645
- path: types_1.MANIFESTPATH,
646
- range: [v4_1.ManifestSection.generic]
647
- }
648
- });
649
- }
650
- }
651
- }
652
- else if (fioriElementsVersion === common_1.FioriElementsVersion.v4) {
653
- const v4Pages = manifest[v4_1.ManifestSection.ui5].routing &&
654
- manifest[v4_1.ManifestSection.ui5].routing.targets;
655
- if (!v4Pages) {
624
+ if (manifest[v4_1.ManifestSection.generic]) {
625
+ const v2Pages = manifest[v4_1.ManifestSection.generic].pages;
626
+ if (!v2Pages) {
656
627
  extensionLogger_1.log(logger, {
657
628
  severity: "error" /* Error */,
658
629
  message: i18next_1.default.t('NOPAGES', { appId: manifest['sap.app']['id'] }),
659
630
  location: {
660
631
  path: types_1.MANIFESTPATH,
661
- range: [v4_1.ManifestSection.ui5, 'routing']
632
+ range: [v4_1.ManifestSection.generic]
662
633
  }
663
634
  });
664
635
  return;
665
636
  }
666
- for (const pageKey in v4Pages) {
667
- const v4Page = v4Pages[pageKey];
668
- if (getPageTypeV4(v4Page.name) === common_1.PageTypeV4.AnalyticalListPage) {
669
- templateType = TemplateType.AnalyticalListPageV4;
670
- break;
671
- }
672
- else if (getPageTypeV4(v4Page.name) === common_1.PageTypeV4.ListReport) {
673
- templateType = TemplateType.ListReportObjectPageV4;
637
+ for (const pageKey in v2Pages) {
638
+ const v2Page = v2Pages[pageKey];
639
+ if (getPageTypeV2(v2Page.component.name) === common_1.PageType.AnalyticalListPage) {
640
+ templateType = TemplateType.AnalyticalListPageV2;
674
641
  break;
675
642
  }
676
- else if (getPageTypeV4(v4Page.name) === common_1.PageTypeV4.ObjectPage) {
677
- templateType = TemplateType.FormPageV4;
643
+ else if (getPageTypeV2(v2Page.component.name) === common_1.PageType.ListReport) {
644
+ templateType = TemplateType.ListReportObjectPageV2;
678
645
  break;
679
646
  }
680
647
  }
648
+ }
649
+ else {
681
650
  if (!templateType) {
682
651
  extensionLogger_1.log(logger, {
683
652
  severity: "error" /* Error */,
684
- message: i18next_1.default.t('NOTEMPLATE', { section: v4_1.ManifestSection.ui5 }),
653
+ message: i18next_1.default.t('NOTEMPLATE', { section: v4_1.ManifestSection.generic }),
685
654
  location: {
686
655
  path: types_1.MANIFESTPATH,
687
- range: [v4_1.ManifestSection.ui5, 'routing', 'targets']
656
+ range: [v4_1.ManifestSection.generic]
688
657
  }
689
658
  });
690
659
  }
691
660
  }
661
+ return templateType;
662
+ }
663
+ exports.determineV2Template = determineV2Template;
664
+ /**
665
+ * Determines the template type of a V4 app
666
+ * @param manifest - the manifest.json file
667
+ * @param {ExtensionLogger} logger - Logger class for logging messages
668
+ * @returns {TemplateType} the template type
669
+ */
670
+ function determineV4Template(manifest, logger) {
671
+ let templateType;
672
+ const v4Pages = manifest[v4_1.ManifestSection.ui5].routing &&
673
+ manifest[v4_1.ManifestSection.ui5].routing.targets;
674
+ if (!v4Pages) {
675
+ extensionLogger_1.log(logger, {
676
+ severity: "error" /* Error */,
677
+ message: i18next_1.default.t('NOPAGES', { appId: manifest['sap.app']['id'] }),
678
+ location: {
679
+ path: types_1.MANIFESTPATH,
680
+ range: [v4_1.ManifestSection.ui5, 'routing']
681
+ }
682
+ });
683
+ return;
684
+ }
685
+ for (const pageKey in v4Pages) {
686
+ const v4Page = v4Pages[pageKey];
687
+ const pageType = getPageTypeV4(v4Page.name);
688
+ if (pageType === common_1.PageTypeV4.AnalyticalListPage) {
689
+ templateType = TemplateType.AnalyticalListPageV4;
690
+ break;
691
+ }
692
+ else if (pageType === common_1.PageTypeV4.ListReport || pageType === common_1.PageTypeV4.ObjectPage) {
693
+ templateType = TemplateType.ListReportObjectPageV4;
694
+ break;
695
+ }
696
+ }
697
+ if (!templateType) {
698
+ extensionLogger_1.log(logger, {
699
+ severity: "error" /* Error */,
700
+ message: i18next_1.default.t('NOTEMPLATE', { section: v4_1.ManifestSection.ui5 }),
701
+ location: {
702
+ path: types_1.MANIFESTPATH,
703
+ range: [v4_1.ManifestSection.ui5, 'routing', 'targets']
704
+ }
705
+ });
706
+ }
707
+ return templateType;
708
+ }
709
+ exports.determineV4Template = determineV4Template;
710
+ /**
711
+ * Determines the template type, based on the given manifest entries of the app
712
+ * @param manifest - the manifest.json file
713
+ * @param {FioriElementsVersion} fioriElementsVersion - OData or FE version
714
+ * @param {ExtensionLogger} logger - Logger class for logging messages
715
+ * @returns {TemplateType} the template type
716
+ */
717
+ function getTemplateTypeFromManifest(manifest, fioriElementsVersion, logger) {
718
+ let templateType;
719
+ if (manifest[v4_1.ManifestSection.ovp]) {
720
+ templateType = TemplateType.OverviewPageV2;
721
+ }
722
+ else if (fioriElementsVersion === common_1.FioriElementsVersion.v2) {
723
+ templateType = determineV2Template(manifest, logger);
724
+ }
725
+ else if (fioriElementsVersion === common_1.FioriElementsVersion.v4) {
726
+ templateType = determineV4Template(manifest, logger);
727
+ }
692
728
  else {
693
729
  if (!templateType) {
694
730
  extensionLogger_1.log(logger, {
@@ -703,12 +739,40 @@ function getTemplateTypeFromManifest(manifest, fioriElementsVersion, logger) {
703
739
  return templateType;
704
740
  }
705
741
  exports.getTemplateTypeFromManifest = getTemplateTypeFromManifest;
742
+ /**
743
+ * Adds title and description to a section or header section in an app schema
744
+ * @param facet - intermediate facet structure comprising annotation information
745
+ * @param section - section in the app schema
746
+ * @param facetKey - key of the facet
747
+ */
748
+ function addSectionTitleAndDescription(facet, section, facetKey) {
749
+ if (facet === null || facet === void 0 ? void 0 : facet.ID) {
750
+ section['title'] = types_1.FacetTitlePrefix + facet.ID;
751
+ }
752
+ else {
753
+ section['title'] = facetKey.substr(facetKey.lastIndexOf('.') + 1);
754
+ }
755
+ // Description
756
+ if (facet === null || facet === void 0 ? void 0 : facet.Label) {
757
+ section['description'] = facet.Label;
758
+ }
759
+ else if (facet === null || facet === void 0 ? void 0 : facet.ID) {
760
+ section['description'] = facet.ID;
761
+ }
762
+ else {
763
+ section['description'] = facetKey.substr(facetKey.lastIndexOf('.') + 1);
764
+ }
765
+ }
766
+ exports.addSectionTitleAndDescription = addSectionTitleAndDescription;
706
767
  /**
707
768
  * Creates a default object for a new section or subsection, and adds the ID as title if present.
708
769
  * @param facet Facet configuration, to be analyzed
709
770
  * @returns the new section object
710
771
  */
711
- function createSectionWithoutProperties(facet) {
772
+ function createSectionWithoutProperties(facet, facetKey) {
773
+ if (!facet) {
774
+ return undefined;
775
+ }
712
776
  const section = {
713
777
  type: 'object',
714
778
  properties: {},
@@ -716,12 +780,7 @@ function createSectionWithoutProperties(facet) {
716
780
  annotationPath: facet.annotationPath,
717
781
  isViewNode: true
718
782
  };
719
- if (facet && facet.ID) {
720
- section['title'] = types_1.FacetTitlePrefix + facet.ID;
721
- }
722
- if (facet && facet.Label) {
723
- section['description'] = facet.Label;
724
- }
783
+ addSectionTitleAndDescription(facet, section, facetKey);
725
784
  return section;
726
785
  }
727
786
  exports.createSectionWithoutProperties = createSectionWithoutProperties;
@@ -735,22 +794,23 @@ exports.createSectionWithoutProperties = createSectionWithoutProperties;
735
794
  * @returns {FacetSection[]} - Array of facets or sections
736
795
  */
737
796
  function getObjectPageFacetSection(entityType, oDataServiceAVT, logger, oDataVersion = common_1.FioriElementsVersion.v2, checkUnresolvableFacets = false) {
738
- const alias = findAlias('com.sap.vocabularies.UI.v1', oDataServiceAVT);
797
+ const alias = findAlias(types_1.UIVOCABULARY, oDataServiceAVT);
798
+ let sections = [];
739
799
  if (entityType) {
740
800
  const facetAnnotation = alias && entityType.annotations && entityType.annotations[alias] && entityType.annotations[alias].Facets;
741
- if (!facetAnnotation) {
742
- return [];
743
- }
744
- return facetAnnotation.reduce(function (result, item) {
745
- if (checkUnresolvableFacets && !item['ID'] && !('Target' in item && item['Target'])) {
801
+ if (facetAnnotation) {
802
+ sections = facetAnnotation.reduce(function (result, item) {
803
+ if (checkUnresolvableFacets && !item['ID'] && !('Target' in item && item['Target'])) {
804
+ return result;
805
+ }
806
+ const section = getSectionFacet(item, entityType, oDataServiceAVT, logger, oDataVersion, true);
807
+ if (section) {
808
+ result.push(section);
809
+ }
746
810
  return result;
747
- }
748
- const section = getSectionFacet(item, true, oDataVersion, entityType, oDataServiceAVT, logger);
749
- if (section) {
750
- result.push(section);
751
- }
752
- return result;
753
- }, []);
811
+ }, sections);
812
+ }
813
+ return sections;
754
814
  }
755
815
  }
756
816
  exports.getObjectPageFacetSection = getObjectPageFacetSection;
@@ -856,27 +916,16 @@ function generatePageId(pageType, entitySet, navigationProperty, viewId) {
856
916
  }
857
917
  exports.generatePageId = generatePageId;
858
918
  /**
859
- * Recursive function to determine the next config part, next definition in the app schema and the title
860
- * @param appSchema - app schema
861
- * @param title - default title
862
- * @param currentConfigObject - current part of the configuration that gets traversed
863
- * @param propertyDefinition - definition of a given property in the app schema
864
- * @param key - actual key
865
- * @param factory - factory for creating metadata instances
866
- * @param pageType - page type
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
867
925
  */
868
- function getNextTargetDefinition(appSchema, title, currentConfigObject, propertyDefinition, key, factory, pageType) {
869
- let nextDefinition = {
870
- configObject: undefined,
871
- targetDefinition: {},
872
- title: ''
873
- };
926
+ function fillArrayFromPropertyDefinition(propertyDefinition, currentConfigObject, appSchema) {
874
927
  const definitionArray = [];
875
- if (propertyDefinition['type'] === 'array') {
876
- nextDefinition = getNextTargetDefinition(appSchema, title, currentConfigObject, propertyDefinition['items'], key, factory, pageType);
877
- return nextDefinition;
878
- }
879
- else if (propertyDefinition['$ref']) {
928
+ if (propertyDefinition['$ref']) {
880
929
  definitionArray.push(propertyDefinition['$ref'].split(exports.DEFINITION_LINK_PREFIX)[1]);
881
930
  }
882
931
  else if (propertyDefinition['anyOf']) {
@@ -897,16 +946,38 @@ function getNextTargetDefinition(appSchema, title, currentConfigObject, property
897
946
  return undefined;
898
947
  }
899
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
+ let nextDefinition = {
966
+ configObject: undefined,
967
+ targetDefinition: {},
968
+ title: ''
969
+ };
900
970
  if (definitionArray.length) {
901
971
  const lastDefinition = definitionArray[definitionArray.length - 1];
902
972
  nextDefinition.targetDefinition = appSchema['definitions'][lastDefinition];
903
973
  if (nextDefinition.targetDefinition['$ref'] || nextDefinition.targetDefinition['type'] === 'array') {
974
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
904
975
  nextDefinition = getNextTargetDefinition(appSchema, title, currentConfigObject, nextDefinition.targetDefinition, key, factory, pageType);
905
976
  return nextDefinition;
906
977
  }
907
978
  if (definitionArray.length > 1) {
908
979
  definitionArray.forEach((element) => {
909
- if (element != '') {
980
+ if (element !== '') {
910
981
  nextDefinition.targetDefinition['properties'] = Object.assign(Object.assign({}, nextDefinition.targetDefinition['properties']), appSchema['definitions'][element]['properties']);
911
982
  }
912
983
  });
@@ -928,36 +999,58 @@ function getNextTargetDefinition(appSchema, title, currentConfigObject, property
928
999
  }
929
1000
  return nextDefinition;
930
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
+ }
931
1025
  exports.getNextTargetDefinition = getNextTargetDefinition;
932
1026
  /**
933
1027
  * Add schema definitions for fields of createWithParameterDialog
934
1028
  * @param {object} appSchema - Application-specific schema, to be enhanced
935
- * @param {EntityType} entityType - Given entity type for which entries shall get generated.
1029
+ * @param {EntityType} entityType - Given entity type for which entries shall get generated
1030
+ * @param {string=} floorplanSuffix - floorplan specific suffix (optional)
936
1031
  */
937
- function addFieldsType(appSchema, entityType) {
1032
+ function addFieldsType(appSchema, entityType, floorplanSuffix = '') {
938
1033
  const propertyNameArray = [], propertyObject = {};
939
- for (const key in entityType.entityProperties) {
940
- const propertyName = entityType.entityProperties[key].name;
1034
+ for (const key of entityType.entityProperties) {
1035
+ const propertyName = key.name;
941
1036
  propertyNameArray.push(propertyName);
942
1037
  propertyObject[propertyName] = {
943
- $ref: exports.DEFINITION_LINK_PREFIX + 'FieldPath'
1038
+ $ref: exports.DEFINITION_LINK_PREFIX + `FieldPath${floorplanSuffix}`
944
1039
  };
945
1040
  }
946
1041
  appSchema['definitions'][entityType.name] = {
947
1042
  enum: propertyNameArray
948
1043
  };
949
- appSchema['definitions']['FieldPath'].properties.path = {
1044
+ appSchema['definitions'][`FieldPath${floorplanSuffix}`].properties.path = {
950
1045
  $ref: exports.DEFINITION_LINK_PREFIX + entityType.name
951
1046
  };
952
- appSchema['definitions']['CreationFieldKeys'] = {
1047
+ appSchema['definitions'][`CreationFieldKeys${floorplanSuffix}`] = {
953
1048
  type: 'object',
954
1049
  properties: propertyObject,
955
1050
  additionalProperties: false
956
1051
  };
957
- const fields4Dialog = appSchema['definitions']['Fields4Dialog'] || appSchema['definitions']['Fields4DialogOP'];
958
- fields4Dialog.properties.fields = {
959
- $ref: exports.DEFINITION_LINK_PREFIX + 'CreationFieldKeys'
960
- };
1052
+ const fields4Dialog = appSchema['definitions'][`Fields4Dialog${floorplanSuffix}`];
1053
+ fields4Dialog.properties.fields.$ref = exports.DEFINITION_LINK_PREFIX + `CreationFieldKeys${floorplanSuffix}`;
961
1054
  }
962
1055
  exports.addFieldsType = addFieldsType;
963
1056
  /**