@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
@@ -21,6 +21,12 @@ export declare const buildControlIdForPage: (baseId: string, idBreadcrumbs: stri
21
21
  */
22
22
  export declare const convertSectionId: (sectionId: string, title: string) => string;
23
23
  export declare function escapeId(sParam: string): string;
24
+ /**
25
+ * Binding Change values, will be added on object pages */
26
+ export declare enum BindingValue {
27
+ Editable = "{ui>/editable}",
28
+ NotEditable = "{= !${ui>/editable}}"
29
+ }
24
30
  /**
25
31
  * Export rule for table columns
26
32
  * @param baseId - base ID, first part of the stable ID
@@ -30,4 +36,5 @@ export declare function escapeId(sParam: string): string;
30
36
  * @param title - title from JSON schema, comprising the facet ID
31
37
  */
32
38
  export declare const buildColumnControlId: (baseId: string, idBreadcrumbs: string[], breadcrumbs: string[], controlType: ControlTypeFunction, title: string) => string;
33
- export declare const addPatternForBindingChangeOfEnum: (schema: object, definition: object, propertyName: string) => void;
39
+ export declare const addPatternForBindingChangeOfEnumLR: (schema: object, definition: object, propertyName: string) => void;
40
+ export declare const addPatternForBindingChangeOfEnumOP: (schema: object, definition: object, propertyName: string) => void;
@@ -47,6 +47,13 @@ function escapeId(sParam) {
47
47
  });
48
48
  }
49
49
  exports.escapeId = escapeId;
50
+ /**
51
+ * Binding Change values, will be added on object pages */
52
+ var BindingValue;
53
+ (function (BindingValue) {
54
+ BindingValue["Editable"] = "{ui>/editable}";
55
+ BindingValue["NotEditable"] = "{= !${ui>/editable}}";
56
+ })(BindingValue = exports.BindingValue || (exports.BindingValue = {}));
50
57
  /**
51
58
  * Export rule for table columns
52
59
  * @param baseId - base ID, first part of the stable ID
@@ -65,7 +72,8 @@ exports.buildColumnControlId = (baseId, idBreadcrumbs, breadcrumbs, controlType,
65
72
  if (breadcrumb === 'sections') {
66
73
  sectionId = localBreadcrumbs[index + 1];
67
74
  if (sectionId.indexOf('LineItem') !== -1) {
68
- return (localBreadcrumbs[index + 1] = exports.convertSectionId(sectionId, title) + '::Table');
75
+ localBreadcrumbs[index + 1] = exports.convertSectionId(sectionId, title) + '::Table';
76
+ return localBreadcrumbs[index + 1];
69
77
  }
70
78
  }
71
79
  }
@@ -74,12 +82,12 @@ exports.buildColumnControlId = (baseId, idBreadcrumbs, breadcrumbs, controlType,
74
82
  });
75
83
  if (localBreadcrumbs[0] === 'sections') {
76
84
  tableId = localBreadcrumbs[1]
77
- .replace(/::com.sap.vocabularies/g, '/@com.sap.vocabularies')
78
- .replace(/::@com.sap.vocabularies/g, '/@com.sap.vocabularies');
85
+ .replace(/::com.sap.vocabularies/g, types_1.VOCWITHSLASH)
86
+ .replace(/::@com.sap.vocabularies/g, types_1.VOCWITHSLASH);
79
87
  }
80
88
  const lastIdPart = localBreadcrumbs[localBreadcrumbs.length - 1]
81
- .replace(/::com.sap.vocabularies/g, '/@com.sap.vocabularies')
82
- .replace(/::@com.sap.vocabularies/g, '/@com.sap.vocabularies')
89
+ .replace(/::com.sap.vocabularies/g, types_1.VOCWITHSLASH)
90
+ .replace(/::@com.sap.vocabularies/g, types_1.VOCWITHSLASH)
83
91
  .replace('sTarget/@', 'sTarget::@');
84
92
  let fullId;
85
93
  const splitPoint = lastIdPart.indexOf(':::');
@@ -98,34 +106,60 @@ exports.buildColumnControlId = (baseId, idBreadcrumbs, breadcrumbs, controlType,
98
106
  }
99
107
  return escapeId(fullId);
100
108
  };
101
- exports.addPatternForBindingChangeOfEnum = (schema, definition, propertyName) => {
109
+ /**
110
+ * Determines the valid pattern for a binding change
111
+ * @param schemaDefinition - definition in the JSON schema
112
+ * @returns the pattern as string
113
+ */
114
+ function determinePattern(schemaDefinition) {
115
+ let pattern = types_1.BindingPropertyRegexAsString;
116
+ if (schemaDefinition.enum) {
117
+ let enumPattern;
118
+ schemaDefinition.enum.forEach((enumValue) => {
119
+ if (!enumValue.toString().startsWith('{')) {
120
+ enumPattern = enumPattern ? enumPattern + '|' + enumValue.toString() : enumValue.toString();
121
+ }
122
+ });
123
+ pattern = `^(${enumPattern})$|${pattern}`;
124
+ }
125
+ if (schemaDefinition['type'] && schemaDefinition['type'] === 'boolean') {
126
+ pattern = `^(false|true)$|${pattern}`;
127
+ }
128
+ return pattern;
129
+ }
130
+ /**
131
+ * Reuseable function for strings that allow binding changes
132
+ * @param schema - the complete JSON schema
133
+ * @param definition - definition in the JSON schema, to be updated
134
+ * @param propertyName - property in the properties' list of the given definition
135
+ * @param bindingValues - values that shall be added to the resulting enum
136
+ */
137
+ const addPatternForBindingChangeOfEnum = (schema, definition, propertyName, bindingValues) => {
102
138
  const propertyList = definition && definition['properties'];
103
139
  if (propertyList[propertyName].pattern) {
104
140
  return; //as already processed
105
141
  }
106
142
  const originalDefinition = propertyList[propertyName];
107
- let targetDefinition;
108
- let pattern = types_1.BindingPropertyRegexAsString;
109
- if (originalDefinition.$ref) {
110
- targetDefinition = schema['definitions'][originalDefinition.$ref.split(utils_1.DEFINITION_LINK_PREFIX)[1]];
111
- }
112
- else {
113
- targetDefinition = originalDefinition;
114
- }
143
+ let resultDefinition = originalDefinition;
144
+ const targetDefinition = originalDefinition.$ref
145
+ ? schema['definitions'][originalDefinition.$ref.split(utils_1.DEFINITION_LINK_PREFIX)[1]]
146
+ : originalDefinition;
115
147
  const description = originalDefinition.description ? originalDefinition.description : targetDefinition.description;
116
- if (targetDefinition.enum) {
117
- let enumPattern;
118
- targetDefinition.enum.forEach((enumValue) => {
119
- if (!enumValue.toString().startsWith('{')) {
120
- enumPattern = enumPattern ? enumPattern + '|' + enumValue.toString() : enumValue.toString();
148
+ const pattern = determinePattern(targetDefinition);
149
+ if (targetDefinition['type'] && targetDefinition['type'] === 'boolean') {
150
+ resultDefinition = { enum: [false, true] };
151
+ }
152
+ if (bindingValues && resultDefinition['enum']) {
153
+ bindingValues.forEach((value) => {
154
+ if (resultDefinition['enum'].indexOf(value) === -1) {
155
+ resultDefinition['enum'].push(value);
121
156
  }
122
157
  });
123
- pattern = '^(' + enumPattern + ')$|' + pattern;
124
158
  }
125
159
  propertyList[propertyName] = {
126
160
  pattern: pattern,
127
161
  anyOf: [
128
- originalDefinition,
162
+ resultDefinition,
129
163
  {
130
164
  type: 'string'
131
165
  }
@@ -136,4 +170,11 @@ exports.addPatternForBindingChangeOfEnum = (schema, definition, propertyName) =>
136
170
  delete originalDefinition.description;
137
171
  }
138
172
  };
173
+ exports.addPatternForBindingChangeOfEnumLR = (schema, definition, propertyName) => {
174
+ addPatternForBindingChangeOfEnum(schema, definition, propertyName);
175
+ };
176
+ exports.addPatternForBindingChangeOfEnumOP = (schema, definition, propertyName) => {
177
+ const bindingValues = Object.values(BindingValue);
178
+ addPatternForBindingChangeOfEnum(schema, definition, propertyName, bindingValues);
179
+ };
139
180
  //# sourceMappingURL=control.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"control.js","sourceRoot":"","sources":["../../../../../src/sync/common/decoration/control.ts"],"names":[],"mappings":";;AAAA,oCAA+F;AAC/F,oCAAkD;AAElD;;;;GAIG;AACU,QAAA,wBAAwB,GAAG,CAAC,MAAc,EAAE,aAAuB,EAAU,EAAE;IACxF,OAAO,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEF;;;;;GAKG;AACU,QAAA,qBAAqB,GAAG,CAAC,MAAc,EAAE,aAAuB,EAAE,WAAqB,EAAU,EAAE;IAC5G,OAAO,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI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AAW,CAAC;KACzC;AACL,CAAC,CAAC;AAEW,QAAA,kCAAkC,GAAG,CAAC,MAAc,EAAE,UAAkB,EAAE,YAAoB,EAAQ,EAAE;IACjH,gCAAgC,CAAC,MAAM,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;AACvE,CAAC,CAAC;AAEW,QAAA,kCAAkC,GAAG,CAAC,MAAc,EAAE,UAAkB,EAAE,YAAoB,EAAQ,EAAE;IACjH,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAClD,gCAAgC,CAAC,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;AACtF,CAAC,CAAC"}
@@ -13,7 +13,7 @@ export declare function createChangeString(change: ChangeDefinitionInCreation, m
13
13
  * Parse string and return the change as object (calls changeUtils from ui5-flexibility-utils)
14
14
  * @param changeString - string with serialized change
15
15
  */
16
- export declare function parseChangeString(changeString: string): ChangeDefinition;
16
+ export declare function parseChangeString(changeString: string): ChangeDefinition | boolean;
17
17
  /**
18
18
  * Creates a flex change based on the given config information
19
19
  * @param configObject - current (sub)object of the configuration file
@@ -27,5 +27,5 @@ export declare function parseChangeString(changeString: string): ChangeDefinitio
27
27
  * @param layer - layer
28
28
  * @returns {ChangeDefinitionInCreation} - the newly created flex change
29
29
  */
30
- export declare function createFlexChange(configObject: object, breadcrumbs: string[], syncRule: SyncRule, ui5Version: UI5Version, baseId: string, ids: string[], title: string, key: string): ChangeDefinitionInCreation;
30
+ export declare function fillFlexChangeContent(configObject: object, syncRule: SyncRule, ui5Version: UI5Version, key: string, controlId: string): ChangeDefinitionInCreation;
31
31
  export {};
@@ -41,8 +41,13 @@ exports.createChangeString = createChangeString;
41
41
  * @param changeString - string with serialized change
42
42
  */
43
43
  function parseChangeString(changeString) {
44
- const change = changesUtils.parse(changeString);
45
- return change;
44
+ try {
45
+ const change = changesUtils.parse(changeString);
46
+ return change;
47
+ }
48
+ catch (error) {
49
+ return false;
50
+ }
46
51
  }
47
52
  exports.parseChangeString = parseChangeString;
48
53
  /**
@@ -58,10 +63,10 @@ exports.parseChangeString = parseChangeString;
58
63
  * @param layer - layer
59
64
  * @returns {ChangeDefinitionInCreation} - the newly created flex change
60
65
  */
61
- function createFlexChange(configObject, breadcrumbs, syncRule, ui5Version, baseId, ids, title, key) {
66
+ function fillFlexChangeContent(configObject, syncRule, ui5Version, key, controlId) {
62
67
  const isCustomer = ui5Version.layer ? ui5Version.layer === "CUSTOMER_BASE" /* Customer */ : true;
63
68
  const flexChange = {
64
- controlId: syncRule.flex.controlId(baseId, ids, breadcrumbs, syncRule.flex.controlType, title),
69
+ controlId,
65
70
  controlType: syncRule.flex.controlType(),
66
71
  content: {
67
72
  property: key
@@ -86,5 +91,5 @@ function createFlexChange(configObject, breadcrumbs, syncRule, ui5Version, baseI
86
91
  }
87
92
  return flexChange;
88
93
  }
89
- exports.createFlexChange = createFlexChange;
94
+ exports.fillFlexChangeContent = fillFlexChangeContent;
90
95
  //# sourceMappingURL=flexUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flexUtils.js","sourceRoot":"","sources":["../../../../src/sync/common/flexUtils.ts"],"names":[],"mappings":";;;;;;;;;AACA,kEAAoD;AAOpD,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC;AAE9C,MAAM,aAAa,GAAG;IAClB,UAAU,EAAE,KAAK;IACjB,aAAa,EAAE,GAAG;IAClB,YAAY,EAAE,eAAe;IAC7B,IAAI,EAAE,gBAAgB;CACzB,CAAC;AAEF;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,MAAkC,EAAE,QAAkB;IACrF,IAAI,YAAY,GAAG,EAAE,CAAC;IACtB,IAAI;QACA,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE;YACtC,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,SAAS,EAAE;gBACpC,MAAM,CAAC,YAAY,CAAC,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;aAC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 -0,0 +1 @@
1
+ export * from './objectPage';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ function __export(m) {
3
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
+ }
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ __export(require("./objectPage"));
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/sync/common/generate/index.ts"],"names":[],"mappings":";;;;;AAAA,kCAA6B"}
@@ -0,0 +1,49 @@
1
+ import { ConverterOutput, EntityType } from '@sap-ux/vocabularies-types';
2
+ import { FioriElementsVersion } from '../../../specification/common';
3
+ import { FacetConfig, SectionType } from '..';
4
+ /**
5
+ * Adds definitions for forms in object page sections to the app schema
6
+ * @param {SectionType} sectionType - prefix to distinguish Section and HeaderSection
7
+ * @param {FacetConfig} section - facet or section in the FE core model
8
+ * @param {object} appSchemaSection - current definition of facet or section in the JSON schema
9
+ * @param {object} appSchema - app specific schema that gets enhanced
10
+ */
11
+ export declare function handleForm(sectionType: SectionType, section: FacetConfig, appSchemaSection: object, appSchema: object, version: FioriElementsVersion, withActions?: boolean): void;
12
+ /**
13
+ * Replaces an alias in an annotation ID or reference, based on the AVT references' list
14
+ * @param annotationIdentifier - annotation ID or reference
15
+ * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
16
+ * @returns the converted string
17
+ */
18
+ export declare function replaceAlias(annotationIdentifier: string, oDataServiceAVT: ConverterOutput): string;
19
+ /**
20
+ * Common routine to determine the name and the ID of a header action
21
+ * @param action - action as given by AVT
22
+ * @param entityType - entity type by AVT
23
+ * @returns an object comprising action name and action id
24
+ */
25
+ export declare function getActionNameAndId(action: string, entityType: EntityType): {
26
+ actionName: string;
27
+ actionId: string;
28
+ };
29
+ /**
30
+ * Add Object Page Footer Action Buttons to app-specific schema
31
+ *
32
+ * @param {object} appSchema Schema of the app
33
+ * @param {EntityType} entityType - current entity type
34
+ * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
35
+ */
36
+ export declare function addFooterActions(appSchema: object, entityType: EntityType, oDataServiceAVT: ConverterOutput): void;
37
+ /**
38
+ * Add Object Page Header Action Buttons to app-specific schema
39
+ * @param {object} appSchema Schema of the app
40
+ * @param {EntityType} entityType - current entity type
41
+ * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
42
+ */
43
+ export declare function addHeaderActions(appSchema: object, entityType: EntityType, oDataServiceAVT: ConverterOutput, addHeaderActionCallBack: any): void;
44
+ /**
45
+ * Adds common Object Page Header definitions to the app schema
46
+ * @param appSchema - app-specific JSOn schema
47
+ * @param entityType - current entity Type
48
+ */
49
+ export declare function addCommonHeaderSchema(appSchema: object, entityType: EntityType): void;
@@ -0,0 +1,331 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const StableIdHelper_1 = require("../../v4/utils/StableIdHelper");
4
+ const common_1 = require("../../../specification/common");
5
+ const __1 = require("..");
6
+ /**
7
+ * Adds a field definition to the app specific schema
8
+ * @param {string} sectionType - prefix to distinguish Section and HeaderSection
9
+ * @param {object} appSchema - App schema in general
10
+ * @param {DataFieldAbstractTypes} field - field definition in parser output (AVT)
11
+ * @param {string} targetID - unique ID, identifies the parent object (form)
12
+ * @param {string} key - current field key
13
+ * @param {SectionType} section - current section of the object page
14
+ */
15
+ function addField(sectionType, appSchema, field, targetID, key, section, version, withActions = true) {
16
+ var _a, _b, _c, _d, _e;
17
+ const fieldReferenceId = StableIdHelper_1.getStableIdPartFromDataField(field);
18
+ const fieldReference = version === common_1.FioriElementsVersion.v2 && fieldReferenceId && fieldReferenceId.includes('::')
19
+ ? fieldReferenceId
20
+ .split('::')
21
+ .splice(1)
22
+ .join('::')
23
+ : fieldReferenceId;
24
+ const fieldReferenceType = version === common_1.FioriElementsVersion.v2 && fieldReferenceId && fieldReferenceId.includes('::')
25
+ ? fieldReferenceId.split('::')[0].replace('DataField', 'Field')
26
+ : undefined;
27
+ const fieldDefinition = version === common_1.FioriElementsVersion.v2
28
+ ? `${fieldReferenceType}<${targetID}::${fieldReference}>`
29
+ : `${targetID}::${fieldReference}`;
30
+ const fieldsDefinition = `${sectionType}Fields<${targetID}>`;
31
+ const actionsDefinition = `${sectionType}Actions<${targetID}>`;
32
+ if (!field || !field.$Type) {
33
+ return;
34
+ }
35
+ else if (field.$Type === 'com.sap.vocabularies.UI.v1.DataFieldForAction' ||
36
+ field.$Type === 'com.sap.vocabularies.UI.v1.DataFieldForIntentBasedNavigation') {
37
+ if (withActions && sectionType === __1.SectionType.Section) {
38
+ appSchema['definitions'][actionsDefinition]['properties'][fieldReference] = {
39
+ $ref: __1.DEFINITION_LINK_PREFIX + fieldDefinition,
40
+ propertyIndex: parseInt(key)
41
+ };
42
+ }
43
+ }
44
+ else {
45
+ appSchema['definitions'][fieldsDefinition]['properties'][fieldReference] = {
46
+ $ref: __1.DEFINITION_LINK_PREFIX + fieldDefinition,
47
+ propertyIndex: parseInt(key)
48
+ };
49
+ }
50
+ appSchema['definitions'][fieldDefinition] = {
51
+ type: 'object',
52
+ isViewNode: true,
53
+ properties: {},
54
+ description: __1.getDatafieldDescription(field, section.entityType),
55
+ additionalProperties: false
56
+ };
57
+ if (version === common_1.FioriElementsVersion.v4 && appSchema['definitions']['Field']) {
58
+ switch (field.$Type) {
59
+ case 'com.sap.vocabularies.UI.v1.DataField':
60
+ case 'com.sap.vocabularies.UI.v1.DataFieldForAnnotation':
61
+ case 'com.sap.vocabularies.UI.v1.DataFieldWithNavigationPath':
62
+ case 'com.sap.vocabularies.UI.v1.DataFieldWithUrl': {
63
+ appSchema['definitions'][fieldDefinition]['properties'] =
64
+ appSchema['definitions']['Field']['properties'];
65
+ break;
66
+ }
67
+ }
68
+ }
69
+ else if (version === common_1.FioriElementsVersion.v2 && appSchema['definitions']['Field']) {
70
+ switch (field.$Type) {
71
+ case 'com.sap.vocabularies.UI.v1.DataField':
72
+ case 'com.sap.vocabularies.UI.v1.DataFieldForAnnotation':
73
+ case 'com.sap.vocabularies.UI.v1.DataFieldWithUrl': {
74
+ appSchema['definitions'][fieldDefinition]['properties'] =
75
+ appSchema['definitions']['Field']['properties'];
76
+ break;
77
+ }
78
+ }
79
+ }
80
+ if (field.$Type === 'com.sap.vocabularies.UI.v1.DataFieldForAction' && ((_a = appSchema['definitions']) === null || _a === void 0 ? void 0 : _a['FormAction'])) {
81
+ appSchema['definitions'][fieldDefinition]['properties'] = appSchema['definitions']['FormAction']['properties'];
82
+ }
83
+ if ((_c = (_b = field['Value']) === null || _b === void 0 ? void 0 : _b.$target) === null || _c === void 0 ? void 0 : _c.type) {
84
+ appSchema['definitions'][fieldDefinition].dataType = (_e = (_d = field['Value']) === null || _d === void 0 ? void 0 : _d.$target) === null || _e === void 0 ? void 0 : _e.type;
85
+ }
86
+ appSchema['definitions'][fieldDefinition].annotationPath = `/${section.entityType.fullyQualifiedName}/${field.fullyQualifiedName.split(section.entityType.fullyQualifiedName)[1]}`;
87
+ }
88
+ function determineTargetIdOfForm(section) {
89
+ let targetID;
90
+ if (section.target && section.target['qualifier'] && section.entityType) {
91
+ targetID = `${section.entityType.name}::${section.base}::${section.target['qualifier']}`;
92
+ }
93
+ else if (section.entityType) {
94
+ targetID = `${section.entityType.name}::${section.base}`;
95
+ }
96
+ else {
97
+ targetID = section.ID;
98
+ }
99
+ return targetID;
100
+ }
101
+ /**
102
+ * Adds definitions for forms in object page sections to the app schema
103
+ * @param {SectionType} sectionType - prefix to distinguish Section and HeaderSection
104
+ * @param {FacetConfig} section - facet or section in the FE core model
105
+ * @param {object} appSchemaSection - current definition of facet or section in the JSON schema
106
+ * @param {object} appSchema - app specific schema that gets enhanced
107
+ */
108
+ function handleForm(sectionType, section, appSchemaSection, appSchema, version, withActions = true) {
109
+ var _a;
110
+ if (!section.target) {
111
+ return;
112
+ }
113
+ const targetID = determineTargetIdOfForm(section);
114
+ const formDefinition = `${sectionType}Form<${targetID}>`;
115
+ const fieldsDefinition = `${sectionType}Fields<${targetID}>`;
116
+ const actionsDefinition = `${sectionType}Actions<${targetID}>`;
117
+ // Form definition
118
+ appSchemaSection['properties']['form'] = { $ref: __1.DEFINITION_LINK_PREFIX + formDefinition };
119
+ if (sectionType === __1.SectionType.Section && withActions) {
120
+ appSchema['definitions'][formDefinition] = {
121
+ type: 'object',
122
+ properties: {
123
+ actions: {
124
+ $ref: __1.DEFINITION_LINK_PREFIX + actionsDefinition
125
+ },
126
+ fields: { $ref: __1.DEFINITION_LINK_PREFIX + fieldsDefinition }
127
+ },
128
+ isViewNode: true,
129
+ description: 'Form',
130
+ additionalProperties: false
131
+ };
132
+ appSchema['definitions'][actionsDefinition] = {
133
+ type: 'object',
134
+ properties: {},
135
+ isViewNode: true,
136
+ description: 'Actions',
137
+ additionalProperties: false
138
+ };
139
+ }
140
+ else {
141
+ appSchema['definitions'][formDefinition] = {
142
+ type: 'object',
143
+ properties: {
144
+ fields: { $ref: __1.DEFINITION_LINK_PREFIX + fieldsDefinition }
145
+ },
146
+ isViewNode: true,
147
+ description: 'Form',
148
+ additionalProperties: false
149
+ };
150
+ }
151
+ if ((_a = section.entityType) === null || _a === void 0 ? void 0 : _a.name) {
152
+ appSchema['definitions'][formDefinition].annotationPath = __1.createAnnotationPath(section.entityType.fullyQualifiedName, section.target['term'], section.target['qualifier']);
153
+ }
154
+ // Fields definition
155
+ appSchema['definitions'][fieldsDefinition] = {
156
+ type: 'object',
157
+ properties: {},
158
+ isViewNode: true,
159
+ description: 'Fields',
160
+ additionalProperties: false
161
+ };
162
+ // Add fields
163
+ if (section.base === __1.FacetBase.Identification) {
164
+ for (const key in section.target) {
165
+ const field = section.target[key];
166
+ if (field) {
167
+ addField(sectionType, appSchema, field, targetID, key, section, version, withActions);
168
+ }
169
+ }
170
+ }
171
+ else {
172
+ for (const key in section.target['Data']) {
173
+ const field = section.target['Data'][key];
174
+ addField(sectionType, appSchema, field, targetID, key, section, version);
175
+ }
176
+ }
177
+ }
178
+ exports.handleForm = handleForm;
179
+ /**
180
+ * Replaces an alias in an annotation ID or reference, based on the AVT references' list
181
+ * @param annotationIdentifier - annotation ID or reference
182
+ * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
183
+ * @returns the converted string
184
+ */
185
+ function replaceAlias(annotationIdentifier, oDataServiceAVT) {
186
+ const potentialAlias = annotationIdentifier.indexOf('.') > -1 ? annotationIdentifier.split('.')[0] : undefined;
187
+ let result = annotationIdentifier;
188
+ if (potentialAlias) {
189
+ const reference = oDataServiceAVT.references.find((ref) => {
190
+ return ref.alias === potentialAlias;
191
+ });
192
+ if (reference) {
193
+ result = annotationIdentifier.replace(potentialAlias, reference.namespace);
194
+ }
195
+ }
196
+ return result;
197
+ }
198
+ exports.replaceAlias = replaceAlias;
199
+ /**
200
+ * Common routine to determine the name and the ID of a header action
201
+ * @param action - action as given by AVT
202
+ * @param entityType - entity type by AVT
203
+ * @returns an object comprising action name and action id
204
+ */
205
+ function getActionNameAndId(action, entityType) {
206
+ let separatorIndex = action.lastIndexOf('/');
207
+ if (separatorIndex === -1) {
208
+ separatorIndex = action.lastIndexOf('.');
209
+ }
210
+ let actionName, actionId;
211
+ if (separatorIndex > -1) {
212
+ actionName = action.substr(separatorIndex + 1);
213
+ actionId = action.substr(0, separatorIndex) + '::' + actionName;
214
+ }
215
+ else {
216
+ actionName = action;
217
+ const namespace = entityType.fullyQualifiedName.split(entityType.name)[0];
218
+ actionId = namespace.substr(0, namespace.length - 1) + '::' + actionName;
219
+ }
220
+ return { actionName, actionId };
221
+ }
222
+ exports.getActionNameAndId = getActionNameAndId;
223
+ /**
224
+ * Add Object Page Footer Action Buttons to app-specific schema
225
+ *
226
+ * @param {object} appSchema Schema of the app
227
+ * @param {EntityType} entityType - current entity type
228
+ * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
229
+ */
230
+ function addFooterActions(appSchema, entityType, oDataServiceAVT) {
231
+ appSchema['definitions']['ObjectPageFooter'] = JSON.parse(JSON.stringify(appSchema['definitions']['ObjectPageFooter<GenericFooterActions>']));
232
+ // Change reference of footer
233
+ appSchema['properties']['footer'] = {
234
+ $ref: __1.DEFINITION_LINK_PREFIX + 'ObjectPageFooter'
235
+ };
236
+ // Add action to configuration
237
+ appSchema['definitions']['ObjectPageFooter'].properties['actions'] = {
238
+ $ref: `${__1.DEFINITION_LINK_PREFIX}FooterActions`
239
+ };
240
+ const footerActions = (appSchema['definitions']['FooterActions'] = {
241
+ type: 'object',
242
+ properties: {},
243
+ description: 'Actions',
244
+ additionalProperties: false,
245
+ isViewNode: true
246
+ });
247
+ const alias = __1.findAlias(__1.UIVOCABULARY, oDataServiceAVT);
248
+ const actionAnnotation = alias &&
249
+ entityType.annotations &&
250
+ entityType.annotations[alias] &&
251
+ entityType.annotations[alias].Identification;
252
+ if (actionAnnotation) {
253
+ const convertedIdentification = actionAnnotation.fullyQualifiedName.replace(`@${"com.sap.vocabularies.UI.v1.Identification" /* Identification */}`, `/@${"com.sap.vocabularies.UI.v1.Identification" /* Identification */}`);
254
+ footerActions['annotationPath'] = `/${convertedIdentification}`;
255
+ actionAnnotation.forEach((item, index) => {
256
+ if (item['Determining'] && item.$Type === 'com.sap.vocabularies.UI.v1.DataFieldForAction') {
257
+ const { actionName, actionId } = getActionNameAndId(item.Action, entityType);
258
+ const description = item.Label || actionName;
259
+ const actionDefinitionKey = `FooterAction<${actionId}>`;
260
+ appSchema['definitions'][actionDefinitionKey] = {
261
+ isViewNode: true,
262
+ type: 'object',
263
+ properties: {},
264
+ description: description,
265
+ annotationPath: `/${convertedIdentification}/${index}`
266
+ };
267
+ footerActions.properties[actionId] = {
268
+ $ref: `${__1.DEFINITION_LINK_PREFIX}${actionDefinitionKey}`
269
+ };
270
+ }
271
+ });
272
+ }
273
+ else {
274
+ footerActions['annotationPath'] = `/${entityType.fullyQualifiedName}/@${"com.sap.vocabularies.UI.v1.Identification" /* Identification */}`;
275
+ }
276
+ delete appSchema['definitions']['GenericFooterActions'];
277
+ delete appSchema['definitions']['FooterAction'];
278
+ delete appSchema['definitions']['ObjectPageFooter<GenericFooterActions>'];
279
+ }
280
+ exports.addFooterActions = addFooterActions;
281
+ /**
282
+ * Add Object Page Header Action Buttons to app-specific schema
283
+ * @param {object} appSchema Schema of the app
284
+ * @param {EntityType} entityType - current entity type
285
+ * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
286
+ */
287
+ function addHeaderActions(appSchema, entityType, oDataServiceAVT,
288
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
289
+ addHeaderActionCallBack) {
290
+ appSchema['definitions']['ObjectPageHeader'].properties['actions'] = {
291
+ $ref: `${__1.DEFINITION_LINK_PREFIX}HeaderActions`
292
+ };
293
+ const headerActions = (appSchema['definitions']['HeaderActions'] = {
294
+ type: 'object',
295
+ properties: {},
296
+ description: 'Actions',
297
+ additionalProperties: false,
298
+ isViewNode: true
299
+ });
300
+ const alias = __1.findAlias(__1.UIVOCABULARY, oDataServiceAVT);
301
+ const identification = alias &&
302
+ entityType.annotations &&
303
+ entityType.annotations[alias] &&
304
+ entityType.annotations[alias].Identification;
305
+ if (identification) {
306
+ headerActions['annotationPath'] =
307
+ '/' +
308
+ identification.fullyQualifiedName.replace(`@${"com.sap.vocabularies.UI.v1.Identification" /* Identification */}`, `/@${"com.sap.vocabularies.UI.v1.Identification" /* Identification */}`);
309
+ identification.forEach(addHeaderActionCallBack(entityType, appSchema, identification, headerActions, oDataServiceAVT));
310
+ }
311
+ else {
312
+ headerActions['annotationPath'] = `/${entityType.fullyQualifiedName}/@${"com.sap.vocabularies.UI.v1.Identification" /* Identification */}`;
313
+ }
314
+ delete appSchema['definitions']['GenericActions'];
315
+ delete appSchema['definitions']['ObjectPageHeader<GenericActions>'];
316
+ }
317
+ exports.addHeaderActions = addHeaderActions;
318
+ /**
319
+ * Adds common Object Page Header definitions to the app schema
320
+ * @param appSchema - app-specific JSOn schema
321
+ * @param entityType - current entity Type
322
+ */
323
+ function addCommonHeaderSchema(appSchema, entityType) {
324
+ appSchema['properties']['header'] = {
325
+ $ref: __1.DEFINITION_LINK_PREFIX + 'ObjectPageHeader'
326
+ };
327
+ appSchema['definitions']['ObjectPageHeader'] = JSON.parse(JSON.stringify(appSchema['definitions']['ObjectPageHeader<GenericActions>']));
328
+ appSchema['definitions']['ObjectPageHeader'].annotationPath = `/${entityType.fullyQualifiedName}/@${"com.sap.vocabularies.UI.v1.HeaderInfo" /* HeaderInfo */}`;
329
+ }
330
+ exports.addCommonHeaderSchema = addCommonHeaderSchema;
331
+ //# sourceMappingURL=objectPage.js.map