@sap/ux-ui5-tooling 1.20.4 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/adp-tooling/templates/cf/_gitignore +6 -0
  3. package/dist/adp-tooling/templates/cf/approuter/package.json +13 -0
  4. package/dist/adp-tooling/templates/cf/approuter/xs-app.json +15 -0
  5. package/dist/adp-tooling/templates/cf/i18n/i18n.properties +3 -0
  6. package/dist/adp-tooling/templates/cf/package.json +35 -0
  7. package/dist/adp-tooling/templates/cf/ui5.yaml +5 -0
  8. package/dist/adp-tooling/templates/cf/xs-security.json +7 -0
  9. package/dist/adp-tooling/templates/changes/annotation.xml +18 -0
  10. package/dist/adp-tooling/templates/project/gitignore.tmpl +5 -0
  11. package/dist/adp-tooling/templates/project/package.json +31 -0
  12. package/dist/adp-tooling/templates/project/ui5.yaml +6 -0
  13. package/dist/adp-tooling/templates/project/webapp/i18n/i18n.properties +6 -0
  14. package/dist/adp-tooling/templates/project/webapp/manifest.appdescr_variant +10 -0
  15. package/dist/adp-tooling/templates/rta/common/analytical-custom-column.xml +25 -0
  16. package/dist/adp-tooling/templates/rta/common/custom-action.xml +8 -0
  17. package/dist/adp-tooling/templates/rta/common/grid-tree-custom-column.xml +22 -0
  18. package/dist/adp-tooling/templates/rta/common/header-field.xml +13 -0
  19. package/dist/adp-tooling/templates/rta/common/op-custom-section.xml +20 -0
  20. package/dist/adp-tooling/templates/rta/common/v4-table-action.xml +8 -0
  21. package/dist/adp-tooling/templates/rta/controller.ejs +80 -0
  22. package/dist/adp-tooling/templates/rta/fragment.xml +7 -0
  23. package/dist/adp-tooling/templates/rta/ts-controller.ejs +18 -0
  24. package/dist/adp-tooling/templates/rta/v2/m-table-custom-column-cell.xml +7 -0
  25. package/dist/adp-tooling/templates/rta/v2/m-table-custom-column.xml +18 -0
  26. package/dist/adp-tooling/templates/rta/v4/custom-section.xml +12 -0
  27. package/dist/adp-tooling/templates/rta/v4/mdc-custom-column-config.xml +6 -0
  28. package/dist/adp-tooling/templates/rta/v4/mdc-custom-column.xml +11 -0
  29. package/dist/adp-tooling/templates/typescript/tsconfig.json +19 -0
  30. package/dist/cli/index.js +15811 -9929
  31. package/dist/control-property-editor/app.css +2 -0
  32. package/dist/control-property-editor/app.js +175 -0
  33. package/dist/livereload-js/livereload.js +3795 -0
  34. package/dist/middlewares/fiori-tools-appreload.js +43486 -41472
  35. package/dist/middlewares/fiori-tools-preview.js +56962 -3066
  36. package/dist/middlewares/fiori-tools-proxy.js +55281 -32282
  37. package/dist/middlewares/fiori-tools-servestatic.js +31629 -29
  38. package/dist/preview-middleware/dist/client/adp/add-fragment.js +48 -0
  39. package/dist/preview-middleware/dist/client/adp/add-fragment.ts +51 -0
  40. package/dist/preview-middleware/dist/client/adp/api-handler.js +162 -0
  41. package/dist/preview-middleware/dist/client/adp/api-handler.ts +188 -0
  42. package/dist/preview-middleware/dist/client/adp/command-executor.js +100 -0
  43. package/dist/preview-middleware/dist/client/adp/command-executor.ts +105 -0
  44. package/dist/preview-middleware/dist/client/adp/control-utils.js +46 -0
  45. package/dist/preview-middleware/dist/client/adp/control-utils.ts +48 -0
  46. package/dist/preview-middleware/dist/client/adp/controllers/AddActionFragment.controller.js +198 -0
  47. package/dist/preview-middleware/dist/client/adp/controllers/AddActionFragment.controller.ts +232 -0
  48. package/dist/preview-middleware/dist/client/adp/controllers/AddCustomFragment.controller.js +223 -0
  49. package/dist/preview-middleware/dist/client/adp/controllers/AddCustomFragment.controller.ts +257 -0
  50. package/dist/preview-middleware/dist/client/adp/controllers/AddFragment.controller.js +195 -0
  51. package/dist/preview-middleware/dist/client/adp/controllers/AddFragment.controller.ts +264 -0
  52. package/dist/preview-middleware/dist/client/adp/controllers/AddSubpage.controller.js +146 -0
  53. package/dist/preview-middleware/dist/client/adp/controllers/AddSubpage.controller.ts +209 -0
  54. package/dist/preview-middleware/dist/client/adp/controllers/AddTableColumnFragments.controller.js +232 -0
  55. package/dist/preview-middleware/dist/client/adp/controllers/AddTableColumnFragments.controller.ts +306 -0
  56. package/dist/preview-middleware/dist/client/adp/controllers/BaseDialog.controller.js +187 -0
  57. package/dist/preview-middleware/dist/client/adp/controllers/BaseDialog.controller.ts +254 -0
  58. package/dist/preview-middleware/dist/client/adp/controllers/ControllerExtension.controller.js +330 -0
  59. package/dist/preview-middleware/dist/client/adp/controllers/ControllerExtension.controller.ts +408 -0
  60. package/dist/preview-middleware/dist/client/adp/controllers/ExtensionPoint.controller.js +160 -0
  61. package/dist/preview-middleware/dist/client/adp/controllers/ExtensionPoint.controller.ts +195 -0
  62. package/dist/preview-middleware/dist/client/adp/controllers/FileExistsDialog.controller.js +68 -0
  63. package/dist/preview-middleware/dist/client/adp/controllers/FileExistsDialog.controller.ts +86 -0
  64. package/dist/preview-middleware/dist/client/adp/controllers/types.js +2 -0
  65. package/dist/preview-middleware/dist/client/adp/controllers/types.ts +10 -0
  66. package/dist/preview-middleware/dist/client/adp/dialog-factory.js +151 -0
  67. package/dist/preview-middleware/dist/client/adp/dialog-factory.ts +210 -0
  68. package/dist/preview-middleware/dist/client/adp/extend-controller.js +48 -0
  69. package/dist/preview-middleware/dist/client/adp/extend-controller.ts +49 -0
  70. package/dist/preview-middleware/dist/client/adp/extension-point.js +83 -0
  71. package/dist/preview-middleware/dist/client/adp/extension-point.ts +116 -0
  72. package/dist/preview-middleware/dist/client/adp/init-dialogs.js +142 -0
  73. package/dist/preview-middleware/dist/client/adp/init-dialogs.ts +178 -0
  74. package/dist/preview-middleware/dist/client/adp/init.js +102 -0
  75. package/dist/preview-middleware/dist/client/adp/init.ts +85 -0
  76. package/dist/preview-middleware/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.js +97 -0
  77. package/dist/preview-middleware/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.ts +140 -0
  78. package/dist/preview-middleware/dist/client/adp/quick-actions/common/add-controller-to-page.js +74 -0
  79. package/dist/preview-middleware/dist/client/adp/quick-actions/common/add-controller-to-page.ts +92 -0
  80. package/dist/preview-middleware/dist/client/adp/quick-actions/common/add-new-annotation-file.js +171 -0
  81. package/dist/preview-middleware/dist/client/adp/quick-actions/common/add-new-annotation-file.ts +174 -0
  82. package/dist/preview-middleware/dist/client/adp/quick-actions/common/create-page-action.js +56 -0
  83. package/dist/preview-middleware/dist/client/adp/quick-actions/common/create-page-action.ts +56 -0
  84. package/dist/preview-middleware/dist/client/adp/quick-actions/common/op-add-custom-section.js +41 -0
  85. package/dist/preview-middleware/dist/client/adp/quick-actions/common/op-add-custom-section.ts +51 -0
  86. package/dist/preview-middleware/dist/client/adp/quick-actions/common/op-add-header-field.js +69 -0
  87. package/dist/preview-middleware/dist/client/adp/quick-actions/common/op-add-header-field.ts +81 -0
  88. package/dist/preview-middleware/dist/client/adp/quick-actions/common/utils.js +20 -0
  89. package/dist/preview-middleware/dist/client/adp/quick-actions/common/utils.ts +7 -0
  90. package/dist/preview-middleware/dist/client/adp/quick-actions/control-types.js +25 -0
  91. package/dist/preview-middleware/dist/client/adp/quick-actions/control-types.ts +7 -0
  92. package/dist/preview-middleware/dist/client/adp/quick-actions/dialog-enablement-validator.js +26 -0
  93. package/dist/preview-middleware/dist/client/adp/quick-actions/dialog-enablement-validator.ts +18 -0
  94. package/dist/preview-middleware/dist/client/adp/quick-actions/enablement-validator.js +2 -0
  95. package/dist/preview-middleware/dist/client/adp/quick-actions/enablement-validator.ts +19 -0
  96. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/add-new-subpage.js +82 -0
  97. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/add-new-subpage.ts +87 -0
  98. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/change-table-actions.js +69 -0
  99. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/change-table-actions.ts +71 -0
  100. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +103 -0
  101. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/change-table-columns.ts +105 -0
  102. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/create-table-action.js +111 -0
  103. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/create-table-action.ts +110 -0
  104. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +108 -0
  105. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.ts +141 -0
  106. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +80 -0
  107. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.ts +93 -0
  108. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +79 -0
  109. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.ts +102 -0
  110. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.js +71 -0
  111. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.ts +98 -0
  112. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +61 -0
  113. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.ts +77 -0
  114. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.js +95 -0
  115. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.ts +102 -0
  116. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.js +86 -0
  117. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.ts +116 -0
  118. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/registry.js +79 -0
  119. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/registry.ts +121 -0
  120. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/utils.js +138 -0
  121. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/utils.ts +134 -0
  122. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/add-new-subpage.js +140 -0
  123. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/add-new-subpage.ts +181 -0
  124. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/change-table-actions.js +81 -0
  125. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/change-table-actions.ts +81 -0
  126. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +90 -0
  127. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/change-table-columns.ts +97 -0
  128. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-page-action.js +81 -0
  129. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-page-action.ts +98 -0
  130. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-table-action-config-change.js +129 -0
  131. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-table-action-config-change.ts +149 -0
  132. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-table-custom-column-config-change.js +142 -0
  133. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-table-custom-column-config-change.ts +178 -0
  134. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/enable-variant-management.js +83 -0
  135. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/enable-variant-management.ts +96 -0
  136. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +58 -0
  137. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.ts +70 -0
  138. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +86 -0
  139. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.ts +96 -0
  140. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +55 -0
  141. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.ts +61 -0
  142. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/op-add-custom-section.js +73 -0
  143. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/op-add-custom-section.ts +91 -0
  144. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.js +91 -0
  145. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.ts +88 -0
  146. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/registry.js +62 -0
  147. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/registry.ts +86 -0
  148. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/utils.js +158 -0
  149. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/utils.ts +175 -0
  150. package/dist/preview-middleware/dist/client/adp/quick-actions/load.js +46 -0
  151. package/dist/preview-middleware/dist/client/adp/quick-actions/load.ts +23 -0
  152. package/dist/preview-middleware/dist/client/adp/quick-actions/quick-action-base.js +64 -0
  153. package/dist/preview-middleware/dist/client/adp/quick-actions/quick-action-base.ts +71 -0
  154. package/dist/preview-middleware/dist/client/adp/quick-actions/simple-quick-action-base.js +44 -0
  155. package/dist/preview-middleware/dist/client/adp/quick-actions/simple-quick-action-base.ts +51 -0
  156. package/dist/preview-middleware/dist/client/adp/quick-actions/supported-ui5versions.md +40 -0
  157. package/dist/preview-middleware/dist/client/adp/quick-actions/table-quick-action-base.js +372 -0
  158. package/dist/preview-middleware/dist/client/adp/quick-actions/table-quick-action-base.ts +433 -0
  159. package/dist/preview-middleware/dist/client/adp/sync-views-utils.js +123 -0
  160. package/dist/preview-middleware/dist/client/adp/sync-views-utils.ts +90 -0
  161. package/dist/preview-middleware/dist/client/adp/ui/AddAction.fragment.xml +49 -0
  162. package/dist/preview-middleware/dist/client/adp/ui/AddCustomFragment.fragment.xml +48 -0
  163. package/dist/preview-middleware/dist/client/adp/ui/AddFragment.fragment.xml +83 -0
  164. package/dist/preview-middleware/dist/client/adp/ui/AddSubpage.fragment.xml +73 -0
  165. package/dist/preview-middleware/dist/client/adp/ui/AddTableColumnFragments.fragment.xml +63 -0
  166. package/dist/preview-middleware/dist/client/adp/ui/ControllerExtension.fragment.xml +63 -0
  167. package/dist/preview-middleware/dist/client/adp/ui/ExtensionPoint.fragment.xml +61 -0
  168. package/dist/preview-middleware/dist/client/adp/ui/FileExistsDialog.fragment.xml +43 -0
  169. package/dist/preview-middleware/dist/client/adp/utils.js +199 -0
  170. package/dist/preview-middleware/dist/client/adp/utils.ts +200 -0
  171. package/dist/preview-middleware/dist/client/cpe/additional-change-info/add-xml-additional-info.js +85 -0
  172. package/dist/preview-middleware/dist/client/cpe/additional-change-info/add-xml-additional-info.ts +107 -0
  173. package/dist/preview-middleware/dist/client/cpe/changes/flex-change.js +66 -0
  174. package/dist/preview-middleware/dist/client/cpe/changes/flex-change.ts +66 -0
  175. package/dist/preview-middleware/dist/client/cpe/changes/generic-change.js +321 -0
  176. package/dist/preview-middleware/dist/client/cpe/changes/generic-change.ts +462 -0
  177. package/dist/preview-middleware/dist/client/cpe/changes/index.js +12 -0
  178. package/dist/preview-middleware/dist/client/cpe/changes/index.ts +1 -0
  179. package/dist/preview-middleware/dist/client/cpe/changes/service.js +527 -0
  180. package/dist/preview-middleware/dist/client/cpe/changes/service.ts +595 -0
  181. package/dist/preview-middleware/dist/client/cpe/changes/validator.js +41 -0
  182. package/dist/preview-middleware/dist/client/cpe/changes/validator.ts +35 -0
  183. package/dist/preview-middleware/dist/client/cpe/communication-service.js +44 -0
  184. package/dist/preview-middleware/dist/client/cpe/communication-service.ts +41 -0
  185. package/dist/preview-middleware/dist/client/cpe/connector-service.js +88 -0
  186. package/dist/preview-middleware/dist/client/cpe/connector-service.ts +74 -0
  187. package/dist/preview-middleware/dist/client/cpe/context-menu-service.js +90 -0
  188. package/dist/preview-middleware/dist/client/cpe/context-menu-service.ts +77 -0
  189. package/dist/preview-middleware/dist/client/cpe/control-data.js +366 -0
  190. package/dist/preview-middleware/dist/client/cpe/control-data.ts +400 -0
  191. package/dist/preview-middleware/dist/client/cpe/documentation.js +191 -0
  192. package/dist/preview-middleware/dist/client/cpe/documentation.ts +187 -0
  193. package/dist/preview-middleware/dist/client/cpe/feature-service.js +39 -0
  194. package/dist/preview-middleware/dist/client/cpe/feature-service.ts +25 -0
  195. package/dist/preview-middleware/dist/client/cpe/init.js +92 -0
  196. package/dist/preview-middleware/dist/client/cpe/init.ts +114 -0
  197. package/dist/preview-middleware/dist/client/cpe/logger.js +32 -0
  198. package/dist/preview-middleware/dist/client/cpe/logger.ts +24 -0
  199. package/dist/preview-middleware/dist/client/cpe/odata-health/odata-health-checker.js +126 -0
  200. package/dist/preview-middleware/dist/client/cpe/odata-health/odata-health-checker.ts +150 -0
  201. package/dist/preview-middleware/dist/client/cpe/odata-health/odata-health-status.js +63 -0
  202. package/dist/preview-middleware/dist/client/cpe/odata-health/odata-health-status.ts +52 -0
  203. package/dist/preview-middleware/dist/client/cpe/outline/editable.js +38 -0
  204. package/dist/preview-middleware/dist/client/cpe/outline/editable.ts +30 -0
  205. package/dist/preview-middleware/dist/client/cpe/outline/nodes.js +212 -0
  206. package/dist/preview-middleware/dist/client/cpe/outline/nodes.ts +236 -0
  207. package/dist/preview-middleware/dist/client/cpe/outline/service.js +62 -0
  208. package/dist/preview-middleware/dist/client/cpe/outline/service.ts +66 -0
  209. package/dist/preview-middleware/dist/client/cpe/quick-actions/quick-action-service.js +161 -0
  210. package/dist/preview-middleware/dist/client/cpe/quick-actions/quick-action-service.ts +184 -0
  211. package/dist/preview-middleware/dist/client/cpe/quick-actions/registry.js +145 -0
  212. package/dist/preview-middleware/dist/client/cpe/quick-actions/registry.ts +157 -0
  213. package/dist/preview-middleware/dist/client/cpe/quick-actions/utils.js +94 -0
  214. package/dist/preview-middleware/dist/client/cpe/quick-actions/utils.ts +113 -0
  215. package/dist/preview-middleware/dist/client/cpe/rta-service.js +94 -0
  216. package/dist/preview-middleware/dist/client/cpe/rta-service.ts +86 -0
  217. package/dist/preview-middleware/dist/client/cpe/selection.js +249 -0
  218. package/dist/preview-middleware/dist/client/cpe/selection.ts +267 -0
  219. package/dist/preview-middleware/dist/client/cpe/ui5-utils.js +35 -0
  220. package/dist/preview-middleware/dist/client/cpe/ui5-utils.ts +28 -0
  221. package/dist/preview-middleware/dist/client/cpe/utils.js +113 -0
  222. package/dist/preview-middleware/dist/client/cpe/utils.ts +162 -0
  223. package/dist/preview-middleware/dist/client/flp/WorkspaceConnector.js +96 -0
  224. package/dist/preview-middleware/dist/client/flp/WorkspaceConnector.ts +99 -0
  225. package/dist/preview-middleware/dist/client/flp/common.js +30 -0
  226. package/dist/preview-middleware/dist/client/flp/common.ts +28 -0
  227. package/dist/preview-middleware/dist/client/flp/enableFakeConnector.js +92 -0
  228. package/dist/preview-middleware/dist/client/flp/enableFakeConnector.ts +113 -0
  229. package/dist/preview-middleware/dist/client/flp/homepage/Component.js +16 -0
  230. package/dist/preview-middleware/dist/client/flp/homepage/Component.ts +10 -0
  231. package/dist/preview-middleware/dist/client/flp/homepage/controller/MyHome.controller.js +54 -0
  232. package/dist/preview-middleware/dist/client/flp/homepage/controller/MyHome.controller.ts +41 -0
  233. package/dist/preview-middleware/dist/client/flp/homepage/css/style.css +3 -0
  234. package/dist/preview-middleware/dist/client/flp/homepage/manifest.json +41 -0
  235. package/dist/preview-middleware/dist/client/flp/homepage/view/MyHome.view.xml +18 -0
  236. package/dist/preview-middleware/dist/client/flp/init.js +418 -0
  237. package/dist/preview-middleware/dist/client/flp/init.ts +448 -0
  238. package/dist/preview-middleware/dist/client/flp/initCdm.js +117 -0
  239. package/dist/preview-middleware/dist/client/flp/initCdm.ts +111 -0
  240. package/dist/preview-middleware/dist/client/flp/initConnectors.js +31 -0
  241. package/dist/preview-middleware/dist/client/flp/initConnectors.ts +20 -0
  242. package/dist/preview-middleware/dist/client/flp/initRta.js +180 -0
  243. package/dist/preview-middleware/dist/client/flp/initRta.ts +194 -0
  244. package/dist/preview-middleware/dist/client/i18n.js +56 -0
  245. package/dist/preview-middleware/dist/client/i18n.ts +49 -0
  246. package/dist/preview-middleware/dist/client/manifest.json +8 -0
  247. package/dist/preview-middleware/dist/client/messagebundle.properties +143 -0
  248. package/dist/preview-middleware/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +486 -0
  249. package/dist/preview-middleware/dist/client/utils/additional-change-info.js +69 -0
  250. package/dist/preview-middleware/dist/client/utils/additional-change-info.ts +73 -0
  251. package/dist/preview-middleware/dist/client/utils/application.js +34 -0
  252. package/dist/preview-middleware/dist/client/utils/application.ts +27 -0
  253. package/dist/preview-middleware/dist/client/utils/core.js +144 -0
  254. package/dist/preview-middleware/dist/client/utils/core.ts +145 -0
  255. package/dist/preview-middleware/dist/client/utils/error.js +28 -0
  256. package/dist/preview-middleware/dist/client/utils/error.ts +18 -0
  257. package/dist/preview-middleware/dist/client/utils/fe-v2.js +58 -0
  258. package/dist/preview-middleware/dist/client/utils/fe-v2.ts +61 -0
  259. package/dist/preview-middleware/dist/client/utils/fe-v4.js +168 -0
  260. package/dist/preview-middleware/dist/client/utils/fe-v4.ts +186 -0
  261. package/dist/preview-middleware/dist/client/utils/info-center-message.js +60 -0
  262. package/dist/preview-middleware/dist/client/utils/info-center-message.ts +60 -0
  263. package/dist/preview-middleware/dist/client/utils/version.js +126 -0
  264. package/dist/preview-middleware/dist/client/utils/version.ts +138 -0
  265. package/dist/preview-middleware/templates/flp/cdm.base.json +47 -0
  266. package/dist/preview-middleware/templates/flp/cdm.ejs +72 -0
  267. package/dist/preview-middleware/templates/flp/editor.ejs +28 -0
  268. package/dist/preview-middleware/templates/flp/sandbox.ejs +88 -0
  269. package/dist/preview-middleware/templates/flp/sandbox2.ejs +86 -0
  270. package/dist/preview-middleware/templates/test/qunit.ejs +26 -0
  271. package/dist/preview-middleware/templates/test/qunit.js +29 -0
  272. package/dist/preview-middleware/templates/test/testsuite.qunit.ejs +10 -0
  273. package/dist/preview-middleware/templates/test/testsuite.qunit.js +8 -0
  274. package/dist/tasks/cf-deploy/index.js +1780 -1464
  275. package/dist/tasks/deploy/index.js +14857 -9062
  276. package/package.json +31 -34
  277. package/prebuilds/keyring.darwin-arm64.node +0 -0
  278. package/prebuilds/keyring.darwin-x64.node +0 -0
  279. package/prebuilds/keyring.linux-arm-gnueabihf.node +0 -0
  280. package/prebuilds/keyring.linux-arm64-gnu.node +0 -0
  281. package/prebuilds/keyring.linux-arm64-musl.node +0 -0
  282. package/prebuilds/keyring.linux-ia32-gnu.node +0 -0
  283. package/prebuilds/keyring.linux-x64-gnu.node +0 -0
  284. package/prebuilds/keyring.linux-x64-musl.node +0 -0
  285. package/prebuilds/keyring.win32-arm64-msvc.node +0 -0
  286. package/prebuilds/keyring.win32-ia32-msvc.node +0 -0
  287. package/prebuilds/keyring.win32-x64-msvc.node +0 -0
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/rta/command/CommandFactory", "./utils", "./dialog-factory", "sap/ui/rta/plugin/AddXMLPlugin"], function (CommandFactory, ___utils, ___dialog_factory, AddXMLPlugin) {
4
+ "use strict";
5
+
6
+ const createDeferred = ___utils["createDeferred"];
7
+ const DialogFactory = ___dialog_factory["DialogFactory"];
8
+ const DialogNames = ___dialog_factory["DialogNames"];
9
+ /**
10
+ * Initializes the AddXMLPlugin and includes it in the Runtime Authoring (RTA) plugins.
11
+ *
12
+ * @param rta Runtime Authoring instance
13
+ */
14
+ function initAddXMLPlugin(rta) {
15
+ const flexSettings = rta.getFlexSettings();
16
+ const commandFactory = new CommandFactory({
17
+ flexSettings
18
+ });
19
+ const plugin = new AddXMLPlugin({
20
+ commandFactory,
21
+ fragmentHandler: async overlay => await handleFragmentCreation(rta, overlay)
22
+ });
23
+ const plugins = rta.getPlugins();
24
+ plugins.addXMLPlugin = plugin;
25
+ rta.setPlugins(plugins);
26
+ }
27
+
28
+ /**
29
+ * Handles the creation of a fragment by opening a dialog and resolving the deferred data.
30
+ *
31
+ * @param rta Runtime Authoring instance
32
+ * @param overlay UI5 Element overlay
33
+ * @returns A promise that resolves with DeferredXmlFragmentData
34
+ */
35
+ async function handleFragmentCreation(rta, overlay) {
36
+ const deferred = createDeferred();
37
+ await DialogFactory.createDialog(overlay, rta, DialogNames.ADD_FRAGMENT, {
38
+ deferred
39
+ });
40
+ return deferred.promise;
41
+ }
42
+ var __exports = {
43
+ __esModule: true
44
+ };
45
+ __exports.initAddXMLPlugin = initAddXMLPlugin;
46
+ return __exports;
47
+ });
48
+ //# sourceMappingURL=add-fragment.js.map
@@ -0,0 +1,51 @@
1
+ import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
2
+ import type UI5Element from 'sap/ui/core/Element';
3
+ import CommandFactory from 'sap/ui/rta/command/CommandFactory';
4
+ import { Deferred, createDeferred } from './utils';
5
+ import { DialogFactory, DialogNames } from './dialog-factory';
6
+ import AddXMLPlugin from 'sap/ui/rta/plugin/AddXMLPlugin';
7
+
8
+ export interface AddFragmentData {
9
+ deferred: Deferred<DeferredXmlFragmentData>;
10
+ }
11
+
12
+ export type DeferredXmlFragmentData = {
13
+ fragment: string;
14
+ fragmentPath: string;
15
+ targetAggregation: string;
16
+ index: number;
17
+ };
18
+
19
+ /**
20
+ * Initializes the AddXMLPlugin and includes it in the Runtime Authoring (RTA) plugins.
21
+ *
22
+ * @param rta Runtime Authoring instance
23
+ */
24
+ export function initAddXMLPlugin(rta: RuntimeAuthoring): void {
25
+ const flexSettings = rta.getFlexSettings();
26
+ const commandFactory = new CommandFactory({ flexSettings });
27
+
28
+ const plugin = new AddXMLPlugin({
29
+ commandFactory,
30
+ fragmentHandler: async (overlay: UI5Element) => await handleFragmentCreation(rta, overlay)
31
+ });
32
+
33
+ const plugins = rta.getPlugins();
34
+ plugins.addXMLPlugin = plugin;
35
+ rta.setPlugins(plugins);
36
+ }
37
+
38
+ /**
39
+ * Handles the creation of a fragment by opening a dialog and resolving the deferred data.
40
+ *
41
+ * @param rta Runtime Authoring instance
42
+ * @param overlay UI5 Element overlay
43
+ * @returns A promise that resolves with DeferredXmlFragmentData
44
+ */
45
+ async function handleFragmentCreation(rta: RuntimeAuthoring, overlay: UI5Element): Promise<DeferredXmlFragmentData> {
46
+ const deferred = createDeferred<DeferredXmlFragmentData>();
47
+
48
+ await DialogFactory.createDialog(overlay, rta, DialogNames.ADD_FRAGMENT, { deferred });
49
+
50
+ return deferred.promise;
51
+ }
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+
3
+ sap.ui.define(["../utils/error"], function (___utils_error) {
4
+ "use strict";
5
+
6
+ const getError = ___utils_error["getError"];
7
+ var ApiEndpoints = /*#__PURE__*/function (ApiEndpoints) {
8
+ ApiEndpoints["CHANGES"] = "/preview/api/changes";
9
+ ApiEndpoints["FRAGMENT"] = "/adp/api/fragment";
10
+ ApiEndpoints["CONTROLLER"] = "/adp/api/controller";
11
+ ApiEndpoints["CODE_EXT"] = "/adp/api/code_ext";
12
+ ApiEndpoints["ANNOTATION_FILE"] = "/adp/api/annotation";
13
+ ApiEndpoints["MANIFEST_APP_DESCRIPTOR"] = "/manifest.appdescr_variant";
14
+ return ApiEndpoints;
15
+ }(ApiEndpoints || {});
16
+ var RequestMethod = /*#__PURE__*/function (RequestMethod) {
17
+ RequestMethod["GET"] = "GET";
18
+ RequestMethod["PUT"] = "PUT";
19
+ RequestMethod["POST"] = "POST";
20
+ RequestMethod["PATCH"] = "PATCH";
21
+ RequestMethod["DELETE"] = "DELETE";
22
+ return RequestMethod;
23
+ }(RequestMethod || {});
24
+ /**
25
+ * Requests a given endpoint
26
+ *
27
+ * @param endpoint API Endpoint
28
+ * @param method RequestMethod
29
+ * @param data Data to be sent to the server
30
+ * @returns Data from the server request
31
+ */
32
+ async function request(endpoint, method, data) {
33
+ const config = {
34
+ method,
35
+ body: JSON.stringify(data),
36
+ headers: {
37
+ 'content-type': 'application/json'
38
+ }
39
+ };
40
+ try {
41
+ const baseUrl = document.getElementById('root')?.dataset.openUxPreviewBaseUrl ?? '';
42
+ const response = await fetch(`${baseUrl}${endpoint}`, config);
43
+ if (!response.ok) {
44
+ const errorData = await response.json();
45
+ const message = errorData?.message ? ` Server message: ${errorData.message}.` : '';
46
+ throw new Error(`Request failed, status: ${response.status}.${message}`);
47
+ }
48
+ switch (method) {
49
+ case RequestMethod.GET:
50
+ return response.json();
51
+ case RequestMethod.POST:
52
+ /**
53
+ * Since POST usually creates something
54
+ * and returns nothing (or a message) we just parse the text from res.send(msg)
55
+ */
56
+ return response.text();
57
+ default:
58
+ return response.json();
59
+ }
60
+ } catch (e) {
61
+ throw getError(e);
62
+ }
63
+ }
64
+
65
+ /**
66
+ * Retrieves all XML fragments from the project's workspace
67
+ *
68
+ * @returns Generic Promise<T>
69
+ */
70
+ async function getFragments() {
71
+ return request(ApiEndpoints.FRAGMENT, RequestMethod.GET);
72
+ }
73
+
74
+ /**
75
+ * Writes an XML fragment to the project's workspace
76
+ *
77
+ * @param data Data to be send to the server
78
+ * @returns Generic Promise<T>
79
+ */
80
+ async function writeFragment(data) {
81
+ return request(ApiEndpoints.FRAGMENT, RequestMethod.POST, data);
82
+ }
83
+
84
+ /**
85
+ * Retrieves manifest.appdescr_variant from the project's workspace
86
+ *
87
+ * @returns Generic Promise<T>
88
+ */
89
+ async function getManifestAppdescr() {
90
+ return request(ApiEndpoints.MANIFEST_APP_DESCRIPTOR, RequestMethod.GET);
91
+ }
92
+
93
+ /**
94
+ * Retrieves all controller extensions from the project's workspace
95
+ *
96
+ * @returns Generic Promise<T>
97
+ */
98
+ async function readControllers() {
99
+ return request(ApiEndpoints.CONTROLLER, RequestMethod.GET);
100
+ }
101
+
102
+ /**
103
+ * Writes a Controller to the project's workspace
104
+ *
105
+ * @param data Data to be send to the server
106
+ * @returns Generic Promise<T>
107
+ */
108
+ async function writeController(data) {
109
+ return request(ApiEndpoints.CONTROLLER, RequestMethod.POST, data);
110
+ }
111
+
112
+ /**
113
+ * Writes a new annotation file to the project's workspace
114
+ *
115
+ * @returns Generic Promise<DataSourceAnnotationMap>
116
+ */
117
+ async function getDataSourceAnnotationFileMap() {
118
+ return request(ApiEndpoints.ANNOTATION_FILE, RequestMethod.GET);
119
+ }
120
+
121
+ /**
122
+ * Checks for existing controller in the project's workspace
123
+ *
124
+ * @param controllerName Name of the controller
125
+ * @returns {CodeExtResponse} Returns path to existing controller if found
126
+ */
127
+ async function getExistingController(controllerName) {
128
+ const params = new URLSearchParams({
129
+ name: controllerName
130
+ });
131
+ const url = `${ApiEndpoints.CODE_EXT}?${params.toString()}`;
132
+ return request(url, RequestMethod.GET);
133
+ }
134
+
135
+ /**
136
+ * Writes a change object to the project's workspace
137
+ *
138
+ * @param data Data to be send to the server
139
+ * @returns Generic Promise<T>
140
+ */
141
+ async function writeChange(data) {
142
+ return request(ApiEndpoints.CHANGES, RequestMethod.POST, {
143
+ change: data
144
+ });
145
+ }
146
+ var __exports = {
147
+ __esModule: true
148
+ };
149
+ __exports.ApiEndpoints = ApiEndpoints;
150
+ __exports.RequestMethod = RequestMethod;
151
+ __exports.request = request;
152
+ __exports.getFragments = getFragments;
153
+ __exports.writeFragment = writeFragment;
154
+ __exports.getManifestAppdescr = getManifestAppdescr;
155
+ __exports.readControllers = readControllers;
156
+ __exports.writeController = writeController;
157
+ __exports.getDataSourceAnnotationFileMap = getDataSourceAnnotationFileMap;
158
+ __exports.getExistingController = getExistingController;
159
+ __exports.writeChange = writeChange;
160
+ return __exports;
161
+ });
162
+ //# sourceMappingURL=api-handler.js.map
@@ -0,0 +1,188 @@
1
+ import type { Layer } from 'sap/ui/fl';
2
+ import { getError } from '../utils/error';
3
+
4
+ export const enum ApiEndpoints {
5
+ CHANGES = '/preview/api/changes',
6
+ FRAGMENT = '/adp/api/fragment',
7
+ CONTROLLER = '/adp/api/controller',
8
+ CODE_EXT = '/adp/api/code_ext',
9
+ ANNOTATION_FILE = '/adp/api/annotation',
10
+ MANIFEST_APP_DESCRIPTOR = '/manifest.appdescr_variant'
11
+ }
12
+
13
+ export const enum RequestMethod {
14
+ GET = 'GET',
15
+ PUT = 'PUT',
16
+ POST = 'POST',
17
+ PATCH = 'PATCH',
18
+ DELETE = 'DELETE'
19
+ }
20
+
21
+ export type Fragments = { fragmentName: string }[];
22
+ export type Controllers = { controllerName: string }[];
23
+ type ResponseMessage = { message?: string };
24
+
25
+ export interface FragmentsResponse {
26
+ fragments: Fragments;
27
+ message: string;
28
+ }
29
+
30
+ export interface CodeExtResponse {
31
+ controllerExists: boolean;
32
+ controllerPath: string;
33
+ controllerPathFromRoot: string;
34
+ isRunningInBAS: boolean;
35
+ isTsSupported: boolean;
36
+ }
37
+
38
+ export interface AnnotationFileDetails {
39
+ annotationExistsInWS: boolean;
40
+ annotationPath: string;
41
+ annotationPathFromRoot: string | undefined;
42
+ }
43
+
44
+ export interface AnnotationDataSourceMap {
45
+ [key: string]: { serviceUrl: string; annotationDetails: AnnotationFileDetails; metadataReadErrorMsg: string };
46
+ }
47
+
48
+ export interface AnnotationDataSourceResponse {
49
+ isRunningInBAS: boolean;
50
+ annotationDataSourceMap: AnnotationDataSourceMap;
51
+ }
52
+ export interface ControllersResponse {
53
+ controllers: Controllers;
54
+ message: string;
55
+ }
56
+
57
+ export interface ManifestAppdescr {
58
+ fileName: string;
59
+ layer: Layer;
60
+ fileType: string;
61
+ reference: string;
62
+ id: string;
63
+ namespace: string;
64
+ version: string;
65
+ content: object[];
66
+ }
67
+
68
+ /**
69
+ * Requests a given endpoint
70
+ *
71
+ * @param endpoint API Endpoint
72
+ * @param method RequestMethod
73
+ * @param data Data to be sent to the server
74
+ * @returns Data from the server request
75
+ */
76
+ export async function request<T>(endpoint: ApiEndpoints, method: RequestMethod, data?: unknown): Promise<T> {
77
+ const config: RequestInit = {
78
+ method,
79
+ body: JSON.stringify(data),
80
+ headers: {
81
+ 'content-type': 'application/json'
82
+ }
83
+ };
84
+
85
+ try {
86
+ const baseUrl = document.getElementById('root')?.dataset.openUxPreviewBaseUrl ?? '';
87
+ const response: Response = await fetch(`${baseUrl}${endpoint}`, config);
88
+
89
+ if (!response.ok) {
90
+ const errorData = (await response.json()) as ResponseMessage;
91
+ const message = errorData?.message ? ` Server message: ${errorData.message}.` : '';
92
+ throw new Error(`Request failed, status: ${response.status}.${message}`);
93
+ }
94
+
95
+ switch (method) {
96
+ case RequestMethod.GET:
97
+ return response.json() as T;
98
+ case RequestMethod.POST:
99
+ /**
100
+ * Since POST usually creates something
101
+ * and returns nothing (or a message) we just parse the text from res.send(msg)
102
+ */
103
+ return response.text() as T;
104
+ default:
105
+ return response.json() as T;
106
+ }
107
+ } catch (e) {
108
+ throw getError(e);
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Retrieves all XML fragments from the project's workspace
114
+ *
115
+ * @returns Generic Promise<T>
116
+ */
117
+ export async function getFragments(): Promise<FragmentsResponse> {
118
+ return request<FragmentsResponse>(ApiEndpoints.FRAGMENT, RequestMethod.GET);
119
+ }
120
+
121
+ /**
122
+ * Writes an XML fragment to the project's workspace
123
+ *
124
+ * @param data Data to be send to the server
125
+ * @returns Generic Promise<T>
126
+ */
127
+ export async function writeFragment<T>(data: T): Promise<T> {
128
+ return request<T>(ApiEndpoints.FRAGMENT, RequestMethod.POST, data);
129
+ }
130
+
131
+ /**
132
+ * Retrieves manifest.appdescr_variant from the project's workspace
133
+ *
134
+ * @returns Generic Promise<T>
135
+ */
136
+ export async function getManifestAppdescr(): Promise<ManifestAppdescr> {
137
+ return request<ManifestAppdescr>(ApiEndpoints.MANIFEST_APP_DESCRIPTOR, RequestMethod.GET);
138
+ }
139
+
140
+ /**
141
+ * Retrieves all controller extensions from the project's workspace
142
+ *
143
+ * @returns Generic Promise<T>
144
+ */
145
+ export async function readControllers<T>(): Promise<T> {
146
+ return request<T>(ApiEndpoints.CONTROLLER, RequestMethod.GET);
147
+ }
148
+
149
+ /**
150
+ * Writes a Controller to the project's workspace
151
+ *
152
+ * @param data Data to be send to the server
153
+ * @returns Generic Promise<T>
154
+ */
155
+ export async function writeController<T>(data: T): Promise<T> {
156
+ return request<T>(ApiEndpoints.CONTROLLER, RequestMethod.POST, data);
157
+ }
158
+
159
+ /**
160
+ * Writes a new annotation file to the project's workspace
161
+ *
162
+ * @returns Generic Promise<DataSourceAnnotationMap>
163
+ */
164
+ export async function getDataSourceAnnotationFileMap(): Promise<AnnotationDataSourceResponse> {
165
+ return request<AnnotationDataSourceResponse>(ApiEndpoints.ANNOTATION_FILE, RequestMethod.GET);
166
+ }
167
+
168
+ /**
169
+ * Checks for existing controller in the project's workspace
170
+ *
171
+ * @param controllerName Name of the controller
172
+ * @returns {CodeExtResponse} Returns path to existing controller if found
173
+ */
174
+ export async function getExistingController(controllerName: string): Promise<CodeExtResponse> {
175
+ const params = new URLSearchParams({ name: controllerName });
176
+ const url = `${ApiEndpoints.CODE_EXT}?${params.toString()}` as ApiEndpoints;
177
+ return request<CodeExtResponse>(url, RequestMethod.GET);
178
+ }
179
+
180
+ /**
181
+ * Writes a change object to the project's workspace
182
+ *
183
+ * @param data Data to be send to the server
184
+ * @returns Generic Promise<T>
185
+ */
186
+ export async function writeChange<T>(data: T): Promise<T> {
187
+ return request<T>(ApiEndpoints.CHANGES, RequestMethod.POST, { change: data });
188
+ }
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+
3
+ sap.ui.define(["open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "sap/ui/rta/command/CommandFactory", "../utils/error", "../utils/info-center-message"], function (___sap_ux_private_control_property_editor_common, CommandFactory, ___utils_error, ___utils_info_center_message) {
4
+ "use strict";
5
+
6
+ const MessageBarType = ___sap_ux_private_control_property_editor_common["MessageBarType"];
7
+ const getError = ___utils_error["getError"];
8
+ const sendInfoCenterMessage = ___utils_info_center_message["sendInfoCenterMessage"];
9
+ /**
10
+ * Class responsible for handling rta calls
11
+ */
12
+ class CommandExecutor {
13
+ /**
14
+ *
15
+ * @param rta Runtime Authoring
16
+ */
17
+ constructor(rta) {
18
+ this.rta = rta;
19
+ }
20
+
21
+ /**
22
+ * Generates command based on given values
23
+ *
24
+ * @param runtimeControl Managed object
25
+ * @param commandName Command name
26
+ * @param modifiedValue Modified value/s
27
+ * @param flexSettings Additional flex settings
28
+ * @param designMetadata Design time metadata
29
+ */
30
+ async getCommand(runtimeControl, commandName, modifiedValue, flexSettings, designMetadata) {
31
+ try {
32
+ return await CommandFactory.getCommandFor(runtimeControl, commandName, modifiedValue, designMetadata, flexSettings);
33
+ } catch (e) {
34
+ const error = getError(e);
35
+ await sendInfoCenterMessage({
36
+ title: {
37
+ key: 'ADP_GET_COMMAND_FAILURE_TITLE'
38
+ },
39
+ description: {
40
+ key: 'ADP_GET_COMMAND_FAILURE_DESCRIPTION',
41
+ params: [commandName, error.message]
42
+ },
43
+ type: MessageBarType.error
44
+ });
45
+ error.message = `Could not get command for '${commandName}'. ${error.message}`;
46
+ throw error;
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Creates composite command without nested commands
52
+ *
53
+ * @param runtimeControl Managed object
54
+ */
55
+ async createCompositeCommand(runtimeControl) {
56
+ try {
57
+ return await CommandFactory.getCommandFor(runtimeControl, 'composite');
58
+ } catch (e) {
59
+ const error = getError(e);
60
+ await sendInfoCenterMessage({
61
+ title: {
62
+ key: 'ADP_GET_COMMAND_FAILURE_TITLE'
63
+ },
64
+ description: {
65
+ key: 'ADP_GET_COMPOSITE_COMMAND_FAILURE_DESCRIPTION',
66
+ params: [error.message]
67
+ },
68
+ type: MessageBarType.error
69
+ });
70
+ throw error;
71
+ }
72
+ }
73
+
74
+ /**
75
+ * Pushed and executes the provided command
76
+ *
77
+ * @param command Command
78
+ */
79
+ async pushAndExecuteCommand(command) {
80
+ try {
81
+ /**
82
+ * The change will have pending state and will only be saved to the workspace when the user clicks save icon
83
+ */
84
+ await this.rta.getCommandStack().pushAndExecute(command);
85
+ } catch (e) {
86
+ const error = getError(e);
87
+ await sendInfoCenterMessage({
88
+ title: {
89
+ key: 'ADP_RUN_COMMAND_FAILED_TITLE'
90
+ },
91
+ description: error.message,
92
+ type: MessageBarType.error
93
+ });
94
+ throw error;
95
+ }
96
+ }
97
+ }
98
+ return CommandExecutor;
99
+ });
100
+ //# sourceMappingURL=command-executor.js.map
@@ -0,0 +1,105 @@
1
+ import { MessageBarType } from '@sap-ux-private/control-property-editor-common';
2
+ import type ManagedObject from 'sap/ui/base/ManagedObject';
3
+ import type DesignTimeMetadata from 'sap/ui/dt/DesignTimeMetadata';
4
+ import CommandFactory from 'sap/ui/rta/command/CommandFactory';
5
+ import type CompositeCommand from 'sap/ui/rta/command/CompositeCommand';
6
+ import type FlexCommand from 'sap/ui/rta/command/FlexCommand';
7
+ import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
8
+ import type { FlexSettings } from 'sap/ui/rta/RuntimeAuthoring';
9
+ import { getError } from '../utils/error';
10
+ import { sendInfoCenterMessage } from '../utils/info-center-message';
11
+ type CommandNames = 'addXML' | 'codeExt' | 'appDescriptor';
12
+
13
+ /**
14
+ * Class responsible for handling rta calls
15
+ */
16
+ export default class CommandExecutor {
17
+ /**
18
+ *
19
+ * @param rta Runtime Authoring
20
+ */
21
+ constructor(private readonly rta: RuntimeAuthoring) {}
22
+
23
+ /**
24
+ * Generates command based on given values
25
+ *
26
+ * @param runtimeControl Managed object
27
+ * @param commandName Command name
28
+ * @param modifiedValue Modified value/s
29
+ * @param flexSettings Additional flex settings
30
+ * @param designMetadata Design time metadata
31
+ */
32
+ public async getCommand<T>(
33
+ runtimeControl: ManagedObject,
34
+ commandName: CommandNames,
35
+ modifiedValue: object,
36
+ flexSettings: FlexSettings,
37
+ designMetadata?: DesignTimeMetadata
38
+ ): Promise<FlexCommand<T>> {
39
+ try {
40
+ return await CommandFactory.getCommandFor<FlexCommand<T>>(
41
+ runtimeControl,
42
+ commandName,
43
+ modifiedValue,
44
+ designMetadata,
45
+ flexSettings
46
+ );
47
+ } catch (e) {
48
+ const error = getError(e);
49
+ await sendInfoCenterMessage({
50
+ title: { key: 'ADP_GET_COMMAND_FAILURE_TITLE' },
51
+ description: {
52
+ key: 'ADP_GET_COMMAND_FAILURE_DESCRIPTION',
53
+ params: [commandName, error.message]
54
+ },
55
+ type: MessageBarType.error
56
+ });
57
+ error.message = `Could not get command for '${commandName}'. ${error.message}`;
58
+ throw error;
59
+ }
60
+ }
61
+
62
+ /**
63
+ * Creates composite command without nested commands
64
+ *
65
+ * @param runtimeControl Managed object
66
+ */
67
+ public async createCompositeCommand(runtimeControl: ManagedObject): Promise<CompositeCommand> {
68
+ try {
69
+ return await CommandFactory.getCommandFor<CompositeCommand>(runtimeControl, 'composite');
70
+ } catch (e) {
71
+ const error = getError(e);
72
+ await sendInfoCenterMessage({
73
+ title: { key: 'ADP_GET_COMMAND_FAILURE_TITLE' },
74
+ description: {
75
+ key: 'ADP_GET_COMPOSITE_COMMAND_FAILURE_DESCRIPTION',
76
+ params: [error.message]
77
+ },
78
+ type: MessageBarType.error
79
+ });
80
+ throw error;
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Pushed and executes the provided command
86
+ *
87
+ * @param command Command
88
+ */
89
+ public async pushAndExecuteCommand(command: FlexCommand | CompositeCommand): Promise<void> {
90
+ try {
91
+ /**
92
+ * The change will have pending state and will only be saved to the workspace when the user clicks save icon
93
+ */
94
+ await this.rta.getCommandStack().pushAndExecute(command);
95
+ } catch (e) {
96
+ const error = getError(e);
97
+ await sendInfoCenterMessage({
98
+ title: { key: 'ADP_RUN_COMMAND_FAILED_TITLE' },
99
+ description: error.message,
100
+ type: MessageBarType.error
101
+ });
102
+ throw error;
103
+ }
104
+ }
105
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ sap.ui.define([], function () {
4
+ "use strict";
5
+
6
+ /**
7
+ * Handles calling control specific functions for retrieving control data
8
+ */
9
+ class ControlUtils {
10
+ /**
11
+ * Returns ManagedObject runtime control
12
+ *
13
+ * @param overlayControl Overlay
14
+ * @returns {ManagedObject} Managed Object instance
15
+ */
16
+ static getRuntimeControl(overlayControl) {
17
+ let runtimeControl;
18
+ if (overlayControl.getElementInstance) {
19
+ runtimeControl = overlayControl.getElementInstance();
20
+ } else {
21
+ runtimeControl = overlayControl.getElement();
22
+ }
23
+ return runtimeControl;
24
+ }
25
+
26
+ /**
27
+ * Returns control aggregation names in an array
28
+ *
29
+ * @param control Managed Object runtime control
30
+ * @param name Aggregation name
31
+ * @returns Array of control aggregations
32
+ */
33
+ static getControlAggregationByName(control, name) {
34
+ let result = [];
35
+ const aggregation = (control ? control.getMetadata().getAllAggregations() : {})[name];
36
+ if (aggregation) {
37
+ // This executes a _sGetter function that can vary from control to control (_sGetter can be: getContent, getItems, etc)
38
+ const names = aggregation._sGetter && control[aggregation._sGetter]() || [];
39
+ result = Array.isArray(names) ? names : [names];
40
+ }
41
+ return result;
42
+ }
43
+ }
44
+ return ControlUtils;
45
+ });
46
+ //# sourceMappingURL=control-utils.js.map