@sap/ux-ui5-tooling 1.20.4 → 1.22.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 (289) hide show
  1. package/CHANGELOG.md +60 -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 +17761 -11603
  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 +44007 -41669
  35. package/dist/middlewares/fiori-tools-preview.js +66889 -4176
  36. package/dist/middlewares/fiori-tools-proxy.js +38049 -5767
  37. package/dist/middlewares/fiori-tools-servestatic.js +32893 -347
  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 +165 -0
  41. package/dist/preview-middleware/dist/client/adp/api-handler.ts +191 -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 +111 -0
  75. package/dist/preview-middleware/dist/client/adp/init.ts +92 -0
  76. package/dist/preview-middleware/dist/client/adp/ovp-window-functions.js +130 -0
  77. package/dist/preview-middleware/dist/client/adp/ovp-window-functions.ts +171 -0
  78. package/dist/preview-middleware/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.js +97 -0
  79. package/dist/preview-middleware/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.ts +140 -0
  80. package/dist/preview-middleware/dist/client/adp/quick-actions/common/add-controller-to-page.js +74 -0
  81. package/dist/preview-middleware/dist/client/adp/quick-actions/common/add-controller-to-page.ts +92 -0
  82. package/dist/preview-middleware/dist/client/adp/quick-actions/common/add-new-annotation-file.js +171 -0
  83. package/dist/preview-middleware/dist/client/adp/quick-actions/common/add-new-annotation-file.ts +174 -0
  84. package/dist/preview-middleware/dist/client/adp/quick-actions/common/create-page-action.js +56 -0
  85. package/dist/preview-middleware/dist/client/adp/quick-actions/common/create-page-action.ts +56 -0
  86. package/dist/preview-middleware/dist/client/adp/quick-actions/common/op-add-custom-section.js +41 -0
  87. package/dist/preview-middleware/dist/client/adp/quick-actions/common/op-add-custom-section.ts +51 -0
  88. package/dist/preview-middleware/dist/client/adp/quick-actions/common/op-add-header-field.js +69 -0
  89. package/dist/preview-middleware/dist/client/adp/quick-actions/common/op-add-header-field.ts +81 -0
  90. package/dist/preview-middleware/dist/client/adp/quick-actions/common/utils.js +20 -0
  91. package/dist/preview-middleware/dist/client/adp/quick-actions/common/utils.ts +7 -0
  92. package/dist/preview-middleware/dist/client/adp/quick-actions/control-types.js +25 -0
  93. package/dist/preview-middleware/dist/client/adp/quick-actions/control-types.ts +7 -0
  94. package/dist/preview-middleware/dist/client/adp/quick-actions/dialog-enablement-validator.js +26 -0
  95. package/dist/preview-middleware/dist/client/adp/quick-actions/dialog-enablement-validator.ts +18 -0
  96. package/dist/preview-middleware/dist/client/adp/quick-actions/enablement-validator.js +2 -0
  97. package/dist/preview-middleware/dist/client/adp/quick-actions/enablement-validator.ts +19 -0
  98. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/add-new-subpage.js +82 -0
  99. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/add-new-subpage.ts +87 -0
  100. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/change-table-actions.js +69 -0
  101. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/change-table-actions.ts +71 -0
  102. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +103 -0
  103. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/change-table-columns.ts +105 -0
  104. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/create-table-action.js +111 -0
  105. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/create-table-action.ts +110 -0
  106. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +108 -0
  107. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.ts +141 -0
  108. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +80 -0
  109. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.ts +93 -0
  110. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +79 -0
  111. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.ts +102 -0
  112. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.js +71 -0
  113. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.ts +98 -0
  114. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +61 -0
  115. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.ts +77 -0
  116. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.js +95 -0
  117. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.ts +102 -0
  118. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.js +86 -0
  119. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.ts +116 -0
  120. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/registry.js +79 -0
  121. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/registry.ts +121 -0
  122. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/utils.js +138 -0
  123. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/utils.ts +134 -0
  124. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/add-new-subpage.js +140 -0
  125. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/add-new-subpage.ts +181 -0
  126. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/change-table-actions.js +81 -0
  127. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/change-table-actions.ts +81 -0
  128. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +90 -0
  129. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/change-table-columns.ts +97 -0
  130. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-page-action.js +81 -0
  131. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-page-action.ts +98 -0
  132. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-table-action-config-change.js +129 -0
  133. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-table-action-config-change.ts +149 -0
  134. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-table-custom-column-config-change.js +142 -0
  135. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-table-custom-column-config-change.ts +178 -0
  136. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/enable-variant-management.js +83 -0
  137. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/enable-variant-management.ts +96 -0
  138. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +58 -0
  139. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.ts +70 -0
  140. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +86 -0
  141. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.ts +96 -0
  142. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +55 -0
  143. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.ts +61 -0
  144. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/op-add-custom-section.js +73 -0
  145. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/op-add-custom-section.ts +91 -0
  146. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.js +91 -0
  147. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.ts +88 -0
  148. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/registry.js +62 -0
  149. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/registry.ts +86 -0
  150. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/utils.js +158 -0
  151. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/utils.ts +175 -0
  152. package/dist/preview-middleware/dist/client/adp/quick-actions/load.js +46 -0
  153. package/dist/preview-middleware/dist/client/adp/quick-actions/load.ts +23 -0
  154. package/dist/preview-middleware/dist/client/adp/quick-actions/quick-action-base.js +64 -0
  155. package/dist/preview-middleware/dist/client/adp/quick-actions/quick-action-base.ts +71 -0
  156. package/dist/preview-middleware/dist/client/adp/quick-actions/simple-quick-action-base.js +44 -0
  157. package/dist/preview-middleware/dist/client/adp/quick-actions/simple-quick-action-base.ts +51 -0
  158. package/dist/preview-middleware/dist/client/adp/quick-actions/supported-ui5versions.md +40 -0
  159. package/dist/preview-middleware/dist/client/adp/quick-actions/table-quick-action-base.js +372 -0
  160. package/dist/preview-middleware/dist/client/adp/quick-actions/table-quick-action-base.ts +433 -0
  161. package/dist/preview-middleware/dist/client/adp/sync-views-utils.js +123 -0
  162. package/dist/preview-middleware/dist/client/adp/sync-views-utils.ts +90 -0
  163. package/dist/preview-middleware/dist/client/adp/ui/AddAction.fragment.xml +49 -0
  164. package/dist/preview-middleware/dist/client/adp/ui/AddCustomFragment.fragment.xml +48 -0
  165. package/dist/preview-middleware/dist/client/adp/ui/AddFragment.fragment.xml +83 -0
  166. package/dist/preview-middleware/dist/client/adp/ui/AddSubpage.fragment.xml +73 -0
  167. package/dist/preview-middleware/dist/client/adp/ui/AddTableColumnFragments.fragment.xml +63 -0
  168. package/dist/preview-middleware/dist/client/adp/ui/ControllerExtension.fragment.xml +63 -0
  169. package/dist/preview-middleware/dist/client/adp/ui/ExtensionPoint.fragment.xml +61 -0
  170. package/dist/preview-middleware/dist/client/adp/ui/FileExistsDialog.fragment.xml +43 -0
  171. package/dist/preview-middleware/dist/client/adp/utils.js +199 -0
  172. package/dist/preview-middleware/dist/client/adp/utils.ts +200 -0
  173. package/dist/preview-middleware/dist/client/cpe/additional-change-info/add-xml-additional-info.js +85 -0
  174. package/dist/preview-middleware/dist/client/cpe/additional-change-info/add-xml-additional-info.ts +107 -0
  175. package/dist/preview-middleware/dist/client/cpe/changes/flex-change.js +66 -0
  176. package/dist/preview-middleware/dist/client/cpe/changes/flex-change.ts +66 -0
  177. package/dist/preview-middleware/dist/client/cpe/changes/generic-change.js +321 -0
  178. package/dist/preview-middleware/dist/client/cpe/changes/generic-change.ts +462 -0
  179. package/dist/preview-middleware/dist/client/cpe/changes/index.js +12 -0
  180. package/dist/preview-middleware/dist/client/cpe/changes/index.ts +1 -0
  181. package/dist/preview-middleware/dist/client/cpe/changes/service.js +527 -0
  182. package/dist/preview-middleware/dist/client/cpe/changes/service.ts +595 -0
  183. package/dist/preview-middleware/dist/client/cpe/changes/validator.js +41 -0
  184. package/dist/preview-middleware/dist/client/cpe/changes/validator.ts +35 -0
  185. package/dist/preview-middleware/dist/client/cpe/communication-service.js +44 -0
  186. package/dist/preview-middleware/dist/client/cpe/communication-service.ts +41 -0
  187. package/dist/preview-middleware/dist/client/cpe/connector-service.js +88 -0
  188. package/dist/preview-middleware/dist/client/cpe/connector-service.ts +74 -0
  189. package/dist/preview-middleware/dist/client/cpe/context-menu-service.js +90 -0
  190. package/dist/preview-middleware/dist/client/cpe/context-menu-service.ts +77 -0
  191. package/dist/preview-middleware/dist/client/cpe/control-data.js +366 -0
  192. package/dist/preview-middleware/dist/client/cpe/control-data.ts +400 -0
  193. package/dist/preview-middleware/dist/client/cpe/documentation.js +191 -0
  194. package/dist/preview-middleware/dist/client/cpe/documentation.ts +187 -0
  195. package/dist/preview-middleware/dist/client/cpe/feature-service.js +39 -0
  196. package/dist/preview-middleware/dist/client/cpe/feature-service.ts +25 -0
  197. package/dist/preview-middleware/dist/client/cpe/init.js +92 -0
  198. package/dist/preview-middleware/dist/client/cpe/init.ts +114 -0
  199. package/dist/preview-middleware/dist/client/cpe/logger.js +32 -0
  200. package/dist/preview-middleware/dist/client/cpe/logger.ts +24 -0
  201. package/dist/preview-middleware/dist/client/cpe/odata-health/odata-health-checker.js +136 -0
  202. package/dist/preview-middleware/dist/client/cpe/odata-health/odata-health-checker.ts +160 -0
  203. package/dist/preview-middleware/dist/client/cpe/odata-health/odata-health-status.js +63 -0
  204. package/dist/preview-middleware/dist/client/cpe/odata-health/odata-health-status.ts +52 -0
  205. package/dist/preview-middleware/dist/client/cpe/outline/editable.js +38 -0
  206. package/dist/preview-middleware/dist/client/cpe/outline/editable.ts +30 -0
  207. package/dist/preview-middleware/dist/client/cpe/outline/nodes.js +212 -0
  208. package/dist/preview-middleware/dist/client/cpe/outline/nodes.ts +236 -0
  209. package/dist/preview-middleware/dist/client/cpe/outline/service.js +62 -0
  210. package/dist/preview-middleware/dist/client/cpe/outline/service.ts +66 -0
  211. package/dist/preview-middleware/dist/client/cpe/quick-actions/quick-action-service.js +161 -0
  212. package/dist/preview-middleware/dist/client/cpe/quick-actions/quick-action-service.ts +184 -0
  213. package/dist/preview-middleware/dist/client/cpe/quick-actions/registry.js +145 -0
  214. package/dist/preview-middleware/dist/client/cpe/quick-actions/registry.ts +157 -0
  215. package/dist/preview-middleware/dist/client/cpe/quick-actions/utils.js +94 -0
  216. package/dist/preview-middleware/dist/client/cpe/quick-actions/utils.ts +113 -0
  217. package/dist/preview-middleware/dist/client/cpe/rta-service.js +94 -0
  218. package/dist/preview-middleware/dist/client/cpe/rta-service.ts +86 -0
  219. package/dist/preview-middleware/dist/client/cpe/selection.js +249 -0
  220. package/dist/preview-middleware/dist/client/cpe/selection.ts +267 -0
  221. package/dist/preview-middleware/dist/client/cpe/ui5-utils.js +35 -0
  222. package/dist/preview-middleware/dist/client/cpe/ui5-utils.ts +28 -0
  223. package/dist/preview-middleware/dist/client/cpe/utils.js +113 -0
  224. package/dist/preview-middleware/dist/client/cpe/utils.ts +162 -0
  225. package/dist/preview-middleware/dist/client/flp/WorkspaceConnector.js +97 -0
  226. package/dist/preview-middleware/dist/client/flp/WorkspaceConnector.ts +101 -0
  227. package/dist/preview-middleware/dist/client/flp/common.js +30 -0
  228. package/dist/preview-middleware/dist/client/flp/common.ts +28 -0
  229. package/dist/preview-middleware/dist/client/flp/enableFakeConnector.js +92 -0
  230. package/dist/preview-middleware/dist/client/flp/enableFakeConnector.ts +113 -0
  231. package/dist/preview-middleware/dist/client/flp/homepage/Component.js +16 -0
  232. package/dist/preview-middleware/dist/client/flp/homepage/Component.ts +10 -0
  233. package/dist/preview-middleware/dist/client/flp/homepage/controller/MyHome.controller.js +54 -0
  234. package/dist/preview-middleware/dist/client/flp/homepage/controller/MyHome.controller.ts +41 -0
  235. package/dist/preview-middleware/dist/client/flp/homepage/css/style.css +3 -0
  236. package/dist/preview-middleware/dist/client/flp/homepage/manifest.json +41 -0
  237. package/dist/preview-middleware/dist/client/flp/homepage/view/MyHome.view.xml +18 -0
  238. package/dist/preview-middleware/dist/client/flp/init.js +418 -0
  239. package/dist/preview-middleware/dist/client/flp/init.ts +448 -0
  240. package/dist/preview-middleware/dist/client/flp/initCdm.js +117 -0
  241. package/dist/preview-middleware/dist/client/flp/initCdm.ts +111 -0
  242. package/dist/preview-middleware/dist/client/flp/initConnectors.js +31 -0
  243. package/dist/preview-middleware/dist/client/flp/initConnectors.ts +20 -0
  244. package/dist/preview-middleware/dist/client/flp/initRta.js +180 -0
  245. package/dist/preview-middleware/dist/client/flp/initRta.ts +194 -0
  246. package/dist/preview-middleware/dist/client/i18n.js +56 -0
  247. package/dist/preview-middleware/dist/client/i18n.ts +49 -0
  248. package/dist/preview-middleware/dist/client/manifest.json +8 -0
  249. package/dist/preview-middleware/dist/client/messagebundle.properties +143 -0
  250. package/dist/preview-middleware/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +486 -0
  251. package/dist/preview-middleware/dist/client/utils/additional-change-info.js +69 -0
  252. package/dist/preview-middleware/dist/client/utils/additional-change-info.ts +73 -0
  253. package/dist/preview-middleware/dist/client/utils/application.js +34 -0
  254. package/dist/preview-middleware/dist/client/utils/application.ts +27 -0
  255. package/dist/preview-middleware/dist/client/utils/core.js +144 -0
  256. package/dist/preview-middleware/dist/client/utils/core.ts +145 -0
  257. package/dist/preview-middleware/dist/client/utils/error.js +28 -0
  258. package/dist/preview-middleware/dist/client/utils/error.ts +18 -0
  259. package/dist/preview-middleware/dist/client/utils/fe-v2.js +58 -0
  260. package/dist/preview-middleware/dist/client/utils/fe-v2.ts +61 -0
  261. package/dist/preview-middleware/dist/client/utils/fe-v4.js +168 -0
  262. package/dist/preview-middleware/dist/client/utils/fe-v4.ts +186 -0
  263. package/dist/preview-middleware/dist/client/utils/info-center-message.js +60 -0
  264. package/dist/preview-middleware/dist/client/utils/info-center-message.ts +60 -0
  265. package/dist/preview-middleware/dist/client/utils/version.js +126 -0
  266. package/dist/preview-middleware/dist/client/utils/version.ts +138 -0
  267. package/dist/preview-middleware/templates/flp/cdm.base.json +47 -0
  268. package/dist/preview-middleware/templates/flp/cdm.ejs +72 -0
  269. package/dist/preview-middleware/templates/flp/editor.ejs +28 -0
  270. package/dist/preview-middleware/templates/flp/sandbox.ejs +88 -0
  271. package/dist/preview-middleware/templates/flp/sandbox2.ejs +86 -0
  272. package/dist/preview-middleware/templates/test/qunit.ejs +26 -0
  273. package/dist/preview-middleware/templates/test/qunit.js +29 -0
  274. package/dist/preview-middleware/templates/test/testsuite.qunit.ejs +10 -0
  275. package/dist/preview-middleware/templates/test/testsuite.qunit.js +8 -0
  276. package/dist/tasks/cf-deploy/index.js +3916 -3521
  277. package/dist/tasks/deploy/index.js +17204 -11133
  278. package/package.json +36 -39
  279. package/prebuilds/keyring.darwin-arm64.node +0 -0
  280. package/prebuilds/keyring.darwin-x64.node +0 -0
  281. package/prebuilds/keyring.linux-arm-gnueabihf.node +0 -0
  282. package/prebuilds/keyring.linux-arm64-gnu.node +0 -0
  283. package/prebuilds/keyring.linux-arm64-musl.node +0 -0
  284. package/prebuilds/keyring.linux-ia32-gnu.node +0 -0
  285. package/prebuilds/keyring.linux-x64-gnu.node +0 -0
  286. package/prebuilds/keyring.linux-x64-musl.node +0 -0
  287. package/prebuilds/keyring.win32-arm64-msvc.node +0 -0
  288. package/prebuilds/keyring.win32-ia32-msvc.node +0 -0
  289. package/prebuilds/keyring.win32-x64-msvc.node +0 -0
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+
3
+ sap.ui.define(["open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common"], function (___sap_ux_private_control_property_editor_common) {
4
+ "use strict";
5
+
6
+ const setAppMode = ___sap_ux_private_control_property_editor_common["setAppMode"];
7
+ const setUndoRedoEnablement = ___sap_ux_private_control_property_editor_common["setUndoRedoEnablement"];
8
+ const setSaveEnablement = ___sap_ux_private_control_property_editor_common["setSaveEnablement"];
9
+ const undo = ___sap_ux_private_control_property_editor_common["undo"];
10
+ const redo = ___sap_ux_private_control_property_editor_common["redo"];
11
+ const save = ___sap_ux_private_control_property_editor_common["save"];
12
+ const reloadApplication = ___sap_ux_private_control_property_editor_common["reloadApplication"];
13
+ const applicationModeChanged = ___sap_ux_private_control_property_editor_common["applicationModeChanged"];
14
+ /**
15
+ * A Class of RtaService
16
+ */
17
+ class RtaService {
18
+ /**
19
+ *
20
+ * @param rta Runtime Authoring Instance
21
+ */
22
+ constructor(rta) {
23
+ this.rta = rta;
24
+ }
25
+
26
+ /**
27
+ * Initializes rta service.
28
+ *
29
+ * @param sendAction action sender function
30
+ * @param subscribe subscriber function
31
+ */
32
+ async init(sendAction, subscribe) {
33
+ return new Promise(resolve => {
34
+ sendAction(applicationModeChanged(this.rta.getMode()));
35
+ subscribe(async action => {
36
+ if (setAppMode.match(action)) {
37
+ this.rta.setMode(action.payload);
38
+ }
39
+ if (undo.match(action)) {
40
+ this.rta.undo();
41
+ }
42
+ if (redo.match(action)) {
43
+ this.rta.redo();
44
+ }
45
+ if (reloadApplication.match(action)) {
46
+ if (action.payload.save === true) {
47
+ await this.save();
48
+ }
49
+ await this.rta.stop(false, true);
50
+ }
51
+ if (save.match(action)) {
52
+ await this.save();
53
+ }
54
+ });
55
+ this.rta.attachStop(() => {
56
+ // eslint-disable-next-line @sap-ux/fiori-tools/sap-no-location-reload
57
+ location.reload();
58
+ });
59
+ this.rta.attachStart(() => {
60
+ resolve();
61
+ });
62
+ this.rta.attachModeChanged(modeAndStackChangeHandler(sendAction, this.rta));
63
+ });
64
+ }
65
+ save() {
66
+ if (this.rta.save) {
67
+ // v1.107.x and above
68
+ return this.rta.save();
69
+ } else {
70
+ // v1.71.x and above
71
+ return this.rta?._serializeToLrep();
72
+ }
73
+ }
74
+ }
75
+ function modeAndStackChangeHandler(sendAction, rta) {
76
+ return () => {
77
+ const canUndo = rta.canUndo();
78
+ const canRedo = rta.canRedo();
79
+ const saveAllowed = rta?.canSave ? rta?.canSave() : canUndo; /* canSave v1.112.x and above only*/
80
+ sendAction(setUndoRedoEnablement({
81
+ canUndo,
82
+ canRedo
83
+ }));
84
+ sendAction(setSaveEnablement(saveAllowed));
85
+ };
86
+ }
87
+ var __exports = {
88
+ __esModule: true
89
+ };
90
+ __exports.RtaService = RtaService;
91
+ __exports.modeAndStackChangeHandler = modeAndStackChangeHandler;
92
+ return __exports;
93
+ });
94
+ //# sourceMappingURL=rta-service.js.map
@@ -0,0 +1,86 @@
1
+ import type { ExternalAction } from '@sap-ux-private/control-property-editor-common';
2
+ import {
3
+ setAppMode,
4
+ setUndoRedoEnablement,
5
+ setSaveEnablement,
6
+ undo,
7
+ redo,
8
+ save,
9
+ reloadApplication,
10
+ applicationModeChanged
11
+ } from '@sap-ux-private/control-property-editor-common';
12
+ import type { ActionSenderFunction, SubscribeFunction } from './types';
13
+ import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
14
+
15
+ /**
16
+ * A Class of RtaService
17
+ */
18
+ export class RtaService {
19
+ /**
20
+ *
21
+ * @param rta Runtime Authoring Instance
22
+ */
23
+ constructor(private readonly rta: RuntimeAuthoring) {}
24
+
25
+ /**
26
+ * Initializes rta service.
27
+ *
28
+ * @param sendAction action sender function
29
+ * @param subscribe subscriber function
30
+ */
31
+ public async init(sendAction: ActionSenderFunction, subscribe: SubscribeFunction): Promise<void> {
32
+ return new Promise((resolve) => {
33
+ sendAction(applicationModeChanged(this.rta.getMode()));
34
+ subscribe(async (action): Promise<void> => {
35
+ if (setAppMode.match(action)) {
36
+ this.rta.setMode(action.payload);
37
+ }
38
+ if (undo.match(action)) {
39
+ this.rta.undo();
40
+ }
41
+ if (redo.match(action)) {
42
+ this.rta.redo();
43
+ }
44
+ if (reloadApplication.match(action)) {
45
+ if (action.payload.save === true) {
46
+ await this.save();
47
+ }
48
+ await this.rta.stop(false, true);
49
+ }
50
+
51
+ if (save.match(action)) {
52
+ await this.save();
53
+ }
54
+ });
55
+
56
+ this.rta.attachStop(() => {
57
+ // eslint-disable-next-line @sap-ux/fiori-tools/sap-no-location-reload
58
+ location.reload();
59
+ });
60
+ this.rta.attachStart(() => {
61
+ resolve();
62
+ });
63
+ this.rta.attachModeChanged(modeAndStackChangeHandler(sendAction, this.rta));
64
+ });
65
+ }
66
+
67
+ private save(): Promise<void> {
68
+ if (this.rta.save) {
69
+ // v1.107.x and above
70
+ return this.rta.save();
71
+ } else {
72
+ // v1.71.x and above
73
+ return this.rta?._serializeToLrep();
74
+ }
75
+ }
76
+ }
77
+
78
+ export function modeAndStackChangeHandler(sendAction: (action: ExternalAction) => void, rta: RuntimeAuthoring) {
79
+ return () => {
80
+ const canUndo = rta.canUndo();
81
+ const canRedo = rta.canRedo();
82
+ const saveAllowed = rta?.canSave ? rta?.canSave() : canUndo; /* canSave v1.112.x and above only*/
83
+ sendAction(setUndoRedoEnablement({ canUndo, canRedo }));
84
+ sendAction(setSaveEnablement(saveAllowed));
85
+ };
86
+ }
@@ -0,0 +1,249 @@
1
+ "use strict";
2
+
3
+ sap.ui.define(["open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "./control-data", "./utils", "sap/base/Log", "sap/ui/dt/OverlayRegistry", "sap/ui/dt/OverlayUtil", "../utils/core", "../utils/error", "./documentation"], function (___sap_ux_private_control_property_editor_common, ___control_data, ___utils, Log, OverlayRegistry, OverlayUtil, ___utils_core, ___utils_error, ___documentation) {
4
+ "use strict";
5
+
6
+ const changeProperty = ___sap_ux_private_control_property_editor_common["changeProperty"];
7
+ const controlSelected = ___sap_ux_private_control_property_editor_common["controlSelected"];
8
+ const propertyChanged = ___sap_ux_private_control_property_editor_common["propertyChanged"];
9
+ const PropertyType = ___sap_ux_private_control_property_editor_common["PropertyType"];
10
+ const reportTelemetry = ___sap_ux_private_control_property_editor_common["reportTelemetry"];
11
+ const selectControl = ___sap_ux_private_control_property_editor_common["selectControl"];
12
+ const buildControlData = ___control_data["buildControlData"];
13
+ const getOverlay = ___utils["getOverlay"];
14
+ const getRuntimeControl = ___utils["getRuntimeControl"];
15
+ const getComponent = ___utils_core["getComponent"];
16
+ const getControlById = ___utils_core["getControlById"];
17
+ const getError = ___utils_error["getError"];
18
+ const getDocumentation = ___documentation["getDocumentation"];
19
+ /**
20
+ * Change id is a combination of controlId and propertyName.
21
+ *
22
+ * @param controlId unique identifier for a control.
23
+ * @param propertyName name of the control property.
24
+ * @returns string
25
+ */
26
+ function propertyChangeId(controlId, propertyName) {
27
+ return [controlId, propertyName].join(',');
28
+ }
29
+
30
+ /**
31
+ * Return document of a property.
32
+ *
33
+ * @param property - control metadata props.
34
+ * @param ui5Type - ui5 type
35
+ * @param document - property that is ignored during design time
36
+ * @returns PropertiesInfo
37
+ */
38
+ function getPropertyDocument(property, ui5Type, document) {
39
+ return document?.[property.name] ? document[property.name] : {
40
+ defaultValue: property.defaultValue ?? '-',
41
+ description: '',
42
+ propertyName: property.name,
43
+ type: ui5Type ?? '-',
44
+ propertyType: ui5Type ?? '-'
45
+ };
46
+ }
47
+ async function addDocumentationForProperties(control, controlData) {
48
+ try {
49
+ const controlMetadata = control.getMetadata();
50
+ const allProperties = controlMetadata.getAllProperties();
51
+ const selectedControlName = controlMetadata.getName();
52
+ const selContLibName = controlMetadata.getLibraryName();
53
+ // Add the control's properties
54
+ const document = await getDocumentation(selectedControlName, selContLibName);
55
+ controlData.properties.forEach(controlProp => {
56
+ if (controlProp.propertyType === PropertyType.ControlProperty) {
57
+ const property = allProperties[controlProp.name];
58
+ controlProp.documentation = getPropertyDocument(property, controlProp.ui5Type, document);
59
+ }
60
+ });
61
+ } catch (e) {
62
+ Log.error('Document loading failed', getError(e));
63
+ }
64
+ }
65
+
66
+ /**
67
+ *
68
+ */
69
+ class SelectionService {
70
+ appliedChangeCache = new Map();
71
+ activeChangeHandlers = new Set();
72
+ /**
73
+ *
74
+ * @param rta - rta object.
75
+ * @param ui5 - facade for ui5 framework methods
76
+ * @param changeService - change service instance.
77
+ */
78
+ constructor(rta, changeService) {
79
+ this.rta = rta;
80
+ this.changeService = changeService;
81
+ }
82
+
83
+ /**
84
+ * Initialize selection service.
85
+ *
86
+ * @param sendAction action sender function
87
+ * @param subscribe subscriber function
88
+ */
89
+ init(sendAction, subscribe) {
90
+ const eventOrigin = new Set();
91
+ const onselectionChange = this.createOnSelectionChangeHandler(sendAction, eventOrigin);
92
+ this.rta.attachSelectionChange(event => {
93
+ onselectionChange(event).catch(error => Log.error('Event interrupted: ', getError(error)));
94
+ });
95
+ subscribe(async action => {
96
+ if (changeProperty.match(action)) {
97
+ this.applyControlPropertyChange(action.payload.controlId, action.payload.propertyName);
98
+ } else if (selectControl.match(action)) {
99
+ const id = action.payload;
100
+ const control = getControlById(id);
101
+ if (!control) {
102
+ const component = getComponent(id);
103
+ if (component) {
104
+ await this.buildProperties(component, sendAction);
105
+ }
106
+ return;
107
+ }
108
+ this.currentSelection = control;
109
+ eventOrigin.add('outline');
110
+ let controlOverlay = OverlayRegistry.getOverlay(control);
111
+ const selectedOverlayControls = this.rta.getSelection() ?? [];
112
+ //remove previous selection
113
+ for (const selectedOverlayControl of selectedOverlayControls) {
114
+ selectedOverlayControl.setSelected(false); //deselect previously selected control
115
+ }
116
+ const controlRef = controlOverlay?.getDomRef?.();
117
+ controlRef?.scrollIntoView({
118
+ behavior: 'smooth',
119
+ block: 'center',
120
+ inline: 'nearest'
121
+ });
122
+ if (!controlRef) {
123
+ //look for closest control in order to highlight in UI the (without firing the selection event)
124
+ controlOverlay = OverlayUtil.getClosestOverlayFor(control);
125
+ }
126
+ if (controlOverlay?.isSelectable()) {
127
+ controlOverlay.setSelected(true); //highlight without firing event only if the layer is selectable
128
+ } else {
129
+ await this.buildProperties(control, sendAction);
130
+ }
131
+ }
132
+ });
133
+ // rebuild config properties in panel for the selected control onStackChange event
134
+ this.changeService.onStackChange(async event => {
135
+ const control = event.detail.controls.find(ctrl => ctrl === this.currentSelection);
136
+ if (control) {
137
+ const overlay = getOverlay(control);
138
+ await this.buildProperties(control, sendAction, overlay);
139
+ }
140
+ });
141
+ }
142
+ async buildProperties(control, sendAction, overlay) {
143
+ const controlData = buildControlData(control, this.changeService, overlay);
144
+ await addDocumentationForProperties(control, controlData);
145
+ const action = controlSelected(controlData);
146
+ sendAction(action);
147
+ }
148
+
149
+ /**
150
+ *
151
+ * @param controlId unique identifier for a control
152
+ * @param propertyName name of the control property.
153
+ */
154
+ applyControlPropertyChange(controlId, propertyName) {
155
+ const changeId = propertyChangeId(controlId, propertyName);
156
+ this.appliedChangeCache.set(changeId, Date.now());
157
+ }
158
+
159
+ /**
160
+ * Create handler for onSelectionChange.
161
+ *
162
+ * @param sendAction sending action method
163
+ * @param eventOrigin origin of the event.
164
+ * @returns (event: Event) => Promise<void>
165
+ */
166
+ createOnSelectionChangeHandler(sendAction, eventOrigin) {
167
+ return async event => {
168
+ const selection = event.getParameter('selection');
169
+ for (const dispose of this.activeChangeHandlers) {
170
+ dispose();
171
+ }
172
+ this.activeChangeHandlers.clear();
173
+ if (Array.isArray(selection) && selection.length === 1) {
174
+ const overlayControl = sap.ui.getCore().byId(selection[0].getId());
175
+ if (overlayControl) {
176
+ const runtimeControl = getRuntimeControl(overlayControl);
177
+ this.currentSelection = runtimeControl;
178
+ const controlName = runtimeControl.getMetadata().getName();
179
+ this.handlePropertyChanges(runtimeControl, sendAction);
180
+ try {
181
+ const isOutline = eventOrigin.has('outline');
182
+ const name = controlName.toLowerCase().startsWith('sap') ? controlName : 'Other Control Types';
183
+ if (isOutline) {
184
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
185
+ reportTelemetry({
186
+ category: 'Outline Selection',
187
+ controlName: name
188
+ });
189
+ } else {
190
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
191
+ reportTelemetry({
192
+ category: 'Overlay Selection',
193
+ controlName: name
194
+ });
195
+ }
196
+ } catch (error) {
197
+ const extendedError = getError(error);
198
+ Log.error('Failed to report telemetry', extendedError);
199
+ } finally {
200
+ await this.buildProperties(runtimeControl, sendAction, overlayControl);
201
+ eventOrigin.delete('outline');
202
+ }
203
+ }
204
+ }
205
+ };
206
+ }
207
+
208
+ /**
209
+ *
210
+ * @param runtimeControl sap/ui/base/ManagedObject
211
+ * @param sendAction send action method.
212
+ */
213
+ handlePropertyChanges(runtimeControl, sendAction) {
214
+ const handler = e => {
215
+ const propertyName = e.getParameter('name');
216
+ const controlId = e.getParameter('id');
217
+ const changeId = propertyChangeId(controlId, propertyName);
218
+ const timestamp = this.appliedChangeCache.get(changeId);
219
+ if (timestamp) {
220
+ // Change originated from control property editor, we do not need to notify it
221
+ this.appliedChangeCache.delete(changeId);
222
+ return;
223
+ }
224
+ const info = runtimeControl.getBindingInfo(propertyName);
225
+ const newValue = info?.bindingString ?? e.getParameter('newValue');
226
+ const change = propertyChanged({
227
+ controlId,
228
+ propertyName,
229
+ newValue
230
+ });
231
+ sendAction(change);
232
+ };
233
+ runtimeControl.attachEvent('_change', handler);
234
+ this.activeChangeHandlers.add(() => {
235
+ try {
236
+ runtimeControl.detachEvent('_change', handler);
237
+ } catch {
238
+ // control has already been cleaned up, nothing to do here
239
+ }
240
+ });
241
+ }
242
+ }
243
+ var __exports = {
244
+ __esModule: true
245
+ };
246
+ __exports.SelectionService = SelectionService;
247
+ return __exports;
248
+ });
249
+ //# sourceMappingURL=selection.js.map
@@ -0,0 +1,267 @@
1
+ import type { Control, ExternalAction, Properties } from '@sap-ux-private/control-property-editor-common';
2
+ import {
3
+ changeProperty,
4
+ controlSelected,
5
+ propertyChanged,
6
+ PropertyType,
7
+ reportTelemetry,
8
+ selectControl
9
+ } from '@sap-ux-private/control-property-editor-common';
10
+ import { buildControlData } from './control-data';
11
+ import type { ActionSenderFunction, Service, SubscribeFunction } from './types';
12
+ import { getOverlay, getRuntimeControl, ManagedObjectMetadataProperties, PropertiesInfo } from './utils';
13
+
14
+ import Log from 'sap/base/Log';
15
+ import type Event from 'sap/ui/base/Event';
16
+ import type ManagedObject from 'sap/ui/base/ManagedObject';
17
+ import type ElementOverlay from 'sap/ui/dt/ElementOverlay';
18
+ import OverlayRegistry from 'sap/ui/dt/OverlayRegistry';
19
+ import OverlayUtil from 'sap/ui/dt/OverlayUtil';
20
+ import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
21
+ import type { SelectionChangeEvent } from 'sap/ui/rta/RuntimeAuthoring';
22
+ import { getComponent, getControlById } from '../utils/core';
23
+ import { getError } from '../utils/error';
24
+ import { ChangeService } from './changes';
25
+ import { getDocumentation } from './documentation';
26
+
27
+ export interface PropertyChangeParams {
28
+ name: string;
29
+ id: string;
30
+ newValue: string;
31
+ }
32
+ export type PropertyChangeEvent = Event<PropertyChangeParams>;
33
+
34
+ /**
35
+ * Change id is a combination of controlId and propertyName.
36
+ *
37
+ * @param controlId unique identifier for a control.
38
+ * @param propertyName name of the control property.
39
+ * @returns string
40
+ */
41
+ function propertyChangeId(controlId: string, propertyName: string): string {
42
+ return [controlId, propertyName].join(',');
43
+ }
44
+
45
+ /**
46
+ * Return document of a property.
47
+ *
48
+ * @param property - control metadata props.
49
+ * @param ui5Type - ui5 type
50
+ * @param document - property that is ignored during design time
51
+ * @returns PropertiesInfo
52
+ */
53
+ function getPropertyDocument(
54
+ property: ManagedObjectMetadataProperties,
55
+ ui5Type?: string,
56
+ document?: Properties
57
+ ): PropertiesInfo {
58
+ return document?.[property.name]
59
+ ? document[property.name]
60
+ : ({
61
+ defaultValue: (property.defaultValue as string) ?? '-',
62
+ description: '',
63
+ propertyName: property.name,
64
+ type: ui5Type ?? '-',
65
+ propertyType: ui5Type ?? '-'
66
+ } as PropertiesInfo);
67
+ }
68
+
69
+ async function addDocumentationForProperties(control: ManagedObject, controlData: Control): Promise<void> {
70
+ try {
71
+ const controlMetadata = control.getMetadata();
72
+ const allProperties = controlMetadata.getAllProperties() as unknown as {
73
+ [name: string]: ManagedObjectMetadataProperties;
74
+ };
75
+ const selectedControlName = controlMetadata.getName();
76
+ const selContLibName = controlMetadata.getLibraryName();
77
+ // Add the control's properties
78
+ const document = await getDocumentation(selectedControlName, selContLibName);
79
+ controlData.properties.forEach((controlProp) => {
80
+ if (controlProp.propertyType === PropertyType.ControlProperty) {
81
+ const property = allProperties[controlProp.name];
82
+ controlProp.documentation = getPropertyDocument(property, controlProp.ui5Type, document);
83
+ }
84
+ });
85
+ } catch (e) {
86
+ Log.error('Document loading failed', getError(e));
87
+ }
88
+ }
89
+
90
+ /**
91
+ *
92
+ */
93
+ export class SelectionService implements Service {
94
+ private readonly appliedChangeCache = new Map<string, number>();
95
+ private readonly activeChangeHandlers = new Set<() => void>();
96
+ private currentSelection: ManagedObject;
97
+ /**
98
+ *
99
+ * @param rta - rta object.
100
+ * @param ui5 - facade for ui5 framework methods
101
+ * @param changeService - change service instance.
102
+ */
103
+ constructor(
104
+ private readonly rta: RuntimeAuthoring,
105
+ private readonly changeService: ChangeService
106
+ ) {}
107
+
108
+ /**
109
+ * Initialize selection service.
110
+ *
111
+ * @param sendAction action sender function
112
+ * @param subscribe subscriber function
113
+ */
114
+ public init(sendAction: ActionSenderFunction, subscribe: SubscribeFunction): void {
115
+ const eventOrigin: Set<string> = new Set();
116
+ const onselectionChange = this.createOnSelectionChangeHandler(sendAction, eventOrigin);
117
+ this.rta.attachSelectionChange((event) => {
118
+ onselectionChange(event).catch((error) => Log.error('Event interrupted: ', getError(error)));
119
+ });
120
+ subscribe(async (action: ExternalAction): Promise<void> => {
121
+ if (changeProperty.match(action)) {
122
+ this.applyControlPropertyChange(action.payload.controlId, action.payload.propertyName);
123
+ } else if (selectControl.match(action)) {
124
+ const id = action.payload;
125
+ const control = getControlById(id);
126
+ if (!control) {
127
+ const component = getComponent(id);
128
+ if (component) {
129
+ await this.buildProperties(component, sendAction);
130
+ }
131
+ return;
132
+ }
133
+ this.currentSelection = control;
134
+ eventOrigin.add('outline');
135
+ let controlOverlay = OverlayRegistry.getOverlay(control);
136
+ const selectedOverlayControls = this.rta.getSelection() ?? [];
137
+ //remove previous selection
138
+ for (const selectedOverlayControl of selectedOverlayControls) {
139
+ selectedOverlayControl.setSelected(false); //deselect previously selected control
140
+ }
141
+
142
+ const controlRef = controlOverlay?.getDomRef?.();
143
+ controlRef?.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'nearest' });
144
+ if (!controlRef) {
145
+ //look for closest control in order to highlight in UI the (without firing the selection event)
146
+ controlOverlay = OverlayUtil.getClosestOverlayFor(control);
147
+ }
148
+
149
+ if (controlOverlay?.isSelectable()) {
150
+ controlOverlay.setSelected(true); //highlight without firing event only if the layer is selectable
151
+ } else {
152
+ await this.buildProperties(control, sendAction);
153
+ }
154
+ }
155
+ });
156
+ // rebuild config properties in panel for the selected control onStackChange event
157
+ this.changeService.onStackChange(async (event) => {
158
+ const control = event.detail.controls.find((ctrl) => ctrl === this.currentSelection);
159
+ if (control) {
160
+ const overlay = getOverlay(control);
161
+ await this.buildProperties(control, sendAction, overlay);
162
+ }
163
+ });
164
+ }
165
+
166
+ private async buildProperties(
167
+ control: ManagedObject,
168
+ sendAction: ActionSenderFunction,
169
+ overlay?: ElementOverlay
170
+ ): Promise<void> {
171
+ const controlData = buildControlData(control, this.changeService, overlay);
172
+ await addDocumentationForProperties(control, controlData);
173
+ const action = controlSelected(controlData);
174
+ sendAction(action);
175
+ }
176
+
177
+ /**
178
+ *
179
+ * @param controlId unique identifier for a control
180
+ * @param propertyName name of the control property.
181
+ */
182
+ public applyControlPropertyChange(controlId: string, propertyName: string): void {
183
+ const changeId = propertyChangeId(controlId, propertyName);
184
+ this.appliedChangeCache.set(changeId, Date.now());
185
+ }
186
+
187
+ /**
188
+ * Create handler for onSelectionChange.
189
+ *
190
+ * @param sendAction sending action method
191
+ * @param eventOrigin origin of the event.
192
+ * @returns (event: Event) => Promise<void>
193
+ */
194
+ private createOnSelectionChangeHandler(
195
+ sendAction: (action: ExternalAction) => void,
196
+ eventOrigin: Set<string>
197
+ ): (event: SelectionChangeEvent) => Promise<void> {
198
+ return async (event: SelectionChangeEvent): Promise<void> => {
199
+ const selection = event.getParameter('selection');
200
+ for (const dispose of this.activeChangeHandlers) {
201
+ dispose();
202
+ }
203
+ this.activeChangeHandlers.clear();
204
+ if (Array.isArray(selection) && selection.length === 1) {
205
+ const overlayControl = sap.ui.getCore().byId(selection[0].getId()) as ElementOverlay;
206
+ if (overlayControl) {
207
+ const runtimeControl = getRuntimeControl(overlayControl);
208
+ this.currentSelection = runtimeControl;
209
+ const controlName = runtimeControl.getMetadata().getName();
210
+ this.handlePropertyChanges(runtimeControl, sendAction);
211
+ try {
212
+ const isOutline = eventOrigin.has('outline');
213
+ const name = controlName.toLowerCase().startsWith('sap') ? controlName : 'Other Control Types';
214
+ if (isOutline) {
215
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
216
+ reportTelemetry({ category: 'Outline Selection', controlName: name });
217
+ } else {
218
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
219
+ reportTelemetry({ category: 'Overlay Selection', controlName: name });
220
+ }
221
+ } catch (error) {
222
+ const extendedError = getError(error);
223
+ Log.error('Failed to report telemetry', extendedError);
224
+ } finally {
225
+ await this.buildProperties(runtimeControl, sendAction, overlayControl);
226
+ eventOrigin.delete('outline');
227
+ }
228
+ }
229
+ }
230
+ };
231
+ }
232
+
233
+ /**
234
+ *
235
+ * @param runtimeControl sap/ui/base/ManagedObject
236
+ * @param sendAction send action method.
237
+ */
238
+ private handlePropertyChanges(runtimeControl: ManagedObject, sendAction: (action: ExternalAction) => void): void {
239
+ const handler = (e: PropertyChangeEvent) => {
240
+ const propertyName = e.getParameter('name');
241
+ const controlId = e.getParameter('id');
242
+ const changeId = propertyChangeId(controlId, propertyName);
243
+ const timestamp = this.appliedChangeCache.get(changeId);
244
+ if (timestamp) {
245
+ // Change originated from control property editor, we do not need to notify it
246
+ this.appliedChangeCache.delete(changeId);
247
+ return;
248
+ }
249
+ const info = runtimeControl.getBindingInfo(propertyName) as { bindingString?: string };
250
+ const newValue = info?.bindingString ?? e.getParameter('newValue');
251
+ const change = propertyChanged({
252
+ controlId,
253
+ propertyName,
254
+ newValue
255
+ });
256
+ sendAction(change);
257
+ };
258
+ runtimeControl.attachEvent('_change', handler);
259
+ this.activeChangeHandlers.add(() => {
260
+ try {
261
+ runtimeControl.detachEvent('_change', handler);
262
+ } catch {
263
+ // control has already been cleaned up, nothing to do here
264
+ }
265
+ });
266
+ }
267
+ }