@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,595 @@
1
+ import type {
2
+ ConfigurationValue,
3
+ ExternalAction,
4
+ PendingChange,
5
+ PendingGenericChange,
6
+ SavedChange,
7
+ SavedControlChange,
8
+ SavedGenericChange,
9
+ UnknownSavedChange
10
+ } from '@sap-ux-private/control-property-editor-common';
11
+ import {
12
+ changeProperty,
13
+ changeStackModified,
14
+ deletePropertyChanges,
15
+ FlexChangesEndPoints,
16
+ GENERIC_CHANGE_KIND,
17
+ MessageBarType,
18
+ PENDING_CHANGE_TYPE,
19
+ propertyChangeFailed,
20
+ reloadApplication,
21
+ save,
22
+ setApplicationRequiresReload,
23
+ UNKNOWN_CHANGE_KIND
24
+ } from '@sap-ux-private/control-property-editor-common';
25
+ import Log from 'sap/base/Log';
26
+ import type Event from 'sap/ui/base/Event';
27
+ import UI5Element from 'sap/ui/core/Element';
28
+ import { ChangeDefinition } from 'sap/ui/fl/Change';
29
+ import type FlexCommand from 'sap/ui/rta/command/FlexCommand';
30
+ import { getTextBundle } from '../../i18n';
31
+ import { setAdditionalChangeInfo } from '../../utils/additional-change-info';
32
+ import { getControlById, isA } from '../../utils/core';
33
+ import { getError } from '../../utils/error';
34
+ import { sendInfoCenterMessage } from '../../utils/info-center-message';
35
+ import { modeAndStackChangeHandler } from '../rta-service';
36
+ import type { ActionSenderFunction, SubscribeFunction, UI5AdaptationOptions } from '../types';
37
+ import { applyChange } from './flex-change';
38
+ import {
39
+ ChangeHandler,
40
+ ChangeType,
41
+ ConfigChange,
42
+ GENERIC_CHANGE_HANDLER,
43
+ getControlIdByChange,
44
+ getFlexObject,
45
+ type GenericChange
46
+ } from './generic-change';
47
+
48
+ const TITLE_MAP: { [key: string]: string } = {
49
+ appdescr_app_addAnnotationsToOData: 'Add New Annotation File'
50
+ };
51
+
52
+ export const STACK_CHANGE_EVENT = 'STACK_CHANGED';
53
+ export interface StackChangedEventDetail {
54
+ controls: UI5Element[];
55
+ }
56
+
57
+ type SavedChangesResponse = Record<string, ConfigChange | GenericChange>;
58
+
59
+ /**
60
+ * Modify rta message.
61
+ *
62
+ * @param errorMessage error message to be replaced
63
+ * @param id - control id
64
+ * @param type - control type
65
+ * @returns string
66
+ */
67
+ function modifyRTAErrorMessage(errorMessage: string, id: string, type: string): string {
68
+ return errorMessage.replace('Error: Applying property changes failed:', '').replace(`${type}#${id}`, '');
69
+ }
70
+
71
+ /**
72
+ * A Class of ChangeService
73
+ */
74
+ export class ChangeService extends EventTarget {
75
+ private savedChanges: SavedChange[] = [];
76
+ private changesRequiringReload = 0;
77
+ private sendAction: (action: ExternalAction) => void;
78
+ private pendingChanges: PendingChange[] = [];
79
+ private changedFiles: Record<string, object> = {};
80
+ private readonly eventStack: object[] = [];
81
+ private pendingConfigChangeMap: Map<string, PendingGenericChange[]> = new Map();
82
+ private configPropertyControlIdMap: Map<string, string[]> = new Map();
83
+ private readonly configPropertyPath: Set<string> = new Set();
84
+ /**
85
+ *
86
+ * @param options ui5 adaptation options.
87
+ * @param ui5 facade for ui5 framework methods.
88
+ * @param selectionService selection service instance.
89
+ */
90
+ constructor(private readonly options: UI5AdaptationOptions) {
91
+ super();
92
+ }
93
+
94
+ /**
95
+ * Initializes change service.
96
+ *
97
+ * @param sendAction action sender function
98
+ * @param subscribe subscriber function
99
+ */
100
+ public async init(sendAction: ActionSenderFunction, subscribe: SubscribeFunction): Promise<void> {
101
+ this.sendAction = sendAction;
102
+ subscribe(async (action): Promise<void> => {
103
+ if (changeProperty.match(action)) {
104
+ try {
105
+ await applyChange(this.options, action.payload);
106
+ } catch (exception) {
107
+ // send error information
108
+ let name = '';
109
+ const id = action.payload.controlId || '';
110
+ const control = sap.ui.getCore().byId(id);
111
+ if (control) {
112
+ name = control.getMetadata().getName();
113
+ }
114
+
115
+ const error = getError(exception);
116
+
117
+ const modifiedMessage = modifyRTAErrorMessage(error.toString(), id, name);
118
+ const errorMessage =
119
+ modifiedMessage || `RTA Exception applying expression "${action.payload.value}"`;
120
+ await sendInfoCenterMessage({
121
+ title: { key: 'CHANGE_CREATION_FAILED_TITLE' },
122
+ description: errorMessage,
123
+ type: MessageBarType.error
124
+ });
125
+ const propertyChangeFailedAction = propertyChangeFailed({ ...action.payload, errorMessage });
126
+ sendAction(propertyChangeFailedAction);
127
+ }
128
+ } else if (deletePropertyChanges.match(action)) {
129
+ await this.deleteChange(action.payload.controlId, action.payload.propertyName, action.payload.fileName);
130
+ } else if (reloadApplication.match(action)) {
131
+ this.sendAction(setApplicationRequiresReload(false));
132
+ } else if (save.match(action)) {
133
+ this.changesRequiringReload = 0;
134
+ this.sendAction(setApplicationRequiresReload(false));
135
+ }
136
+ });
137
+
138
+ await this.fetchSavedChanges();
139
+ this.updateStack();
140
+
141
+ this.options.rta.attachUndoRedoStackModified(this.createOnStackChangeHandler());
142
+ }
143
+
144
+ /**
145
+ * Send update to the editor with modified stack.
146
+ *
147
+ * @param pendingChanges Changes that are waiting to be saved
148
+ */
149
+ private updateStack() {
150
+ this.sendAction(
151
+ changeStackModified({
152
+ saved: this.savedChanges ?? [],
153
+ pending: this.pendingChanges ?? []
154
+ })
155
+ );
156
+ }
157
+
158
+ private isGenericChange(change: GenericChange): change is GenericChange {
159
+ return (
160
+ change.changeType === 'appdescr_app_addAnnotationsToOData' ||
161
+ change.changeType === 'rename' ||
162
+ change.changeType === 'moveControls' ||
163
+ change.changeType === 'addXML' ||
164
+ change.changeType === 'propertyChange' ||
165
+ change.changeType === 'propertyBindingChange' ||
166
+ change.changeType === 'appdescr_fe_changePageConfiguration' ||
167
+ change.changeType === 'appdescr_ui_generic_app_changePageConfiguration'
168
+ );
169
+ }
170
+
171
+ /**
172
+ * Fetches saved changes from the workspace and sorts them.
173
+ */
174
+ private async fetchSavedChanges(): Promise<void> {
175
+ this.changedFiles = {};
176
+ const savedChangesResponse = await fetch(FlexChangesEndPoints.changes + `?_=${Date.now()}`);
177
+ const savedChanges = (await savedChangesResponse.json()) as SavedChangesResponse;
178
+ const textBundle = await getTextBundle();
179
+ const changes = (
180
+ await Promise.all(
181
+ Object.keys(savedChanges ?? {}).map(
182
+ async (key): Promise<UnknownSavedChange | SavedControlChange | SavedGenericChange | undefined> => {
183
+ const change = savedChanges[key];
184
+ try {
185
+ const handler = GENERIC_CHANGE_HANDLER[
186
+ change.changeType
187
+ ] as unknown as ChangeHandler<GenericChange>;
188
+ if (this.isGenericChange(change)) {
189
+ const {
190
+ properties,
191
+ changeTitle,
192
+ controlId,
193
+ changeType: type,
194
+ subtitle
195
+ } = await handler(change as unknown as GenericChange, {
196
+ textBundle,
197
+ appComponent: this.options.rta.getRootControlInstance(),
198
+ configPropertyControlIdMap: this.configPropertyControlIdMap
199
+ });
200
+ this.changedFiles[change.fileName] = change;
201
+ return {
202
+ kind: GENERIC_CHANGE_KIND,
203
+ type: 'saved',
204
+ fileName: change.fileName,
205
+ ...(subtitle && { subtitle }),
206
+ changeType: type ?? change.changeType,
207
+ timestamp: new Date(change.creation).getTime(),
208
+ ...(controlId && { controlId }),
209
+ properties,
210
+ title: textBundle.getText(changeTitle)
211
+ };
212
+ }
213
+ throw new Error('Unknown change type');
214
+ } catch {
215
+ // Gracefully handle change files with invalid content
216
+ const flexObject = await getFlexObject(change);
217
+ const selectorId = await getControlIdByChange(
218
+ flexObject,
219
+ this.options.rta.getRootControlInstance()
220
+ );
221
+ if (change.fileName) {
222
+ this.changedFiles[change.fileName] = change;
223
+ const unknownChange: UnknownSavedChange = {
224
+ type: 'saved',
225
+ kind: 'unknown',
226
+ changeType: change.changeType,
227
+ fileName: change.fileName,
228
+ timestamp: new Date(change.creation).getTime()
229
+ };
230
+ if (change.creation) {
231
+ unknownChange.timestamp = new Date(change.creation).getTime();
232
+ }
233
+ if (selectorId) {
234
+ const controlChange: SavedControlChange = {
235
+ ...unknownChange,
236
+ kind: 'control',
237
+ controlId: selectorId
238
+ };
239
+
240
+ return controlChange;
241
+ }
242
+ return unknownChange;
243
+ }
244
+ return undefined;
245
+ }
246
+ }
247
+ )
248
+ )
249
+ )
250
+ .filter((change) => !!change)
251
+ .sort((a, b) => b.timestamp - a.timestamp);
252
+ this.savedChanges = changes;
253
+ }
254
+
255
+ /**
256
+ *
257
+ * @param controlId unique identifier for a control
258
+ * @param propertyName name of the property change to be deleted
259
+ * @param fileName name of the file.
260
+ */
261
+ public async deleteChange(controlId: string, propertyName: string, fileName?: string): Promise<void> {
262
+ const filesToDelete = this.savedChanges
263
+ .filter((change) => {
264
+ if (fileName) {
265
+ return fileName === change.fileName;
266
+ }
267
+
268
+ if (change.kind === 'control') {
269
+ return change.controlId === controlId;
270
+ }
271
+ return false;
272
+ })
273
+ .map((change) =>
274
+ fetch(FlexChangesEndPoints.changes, {
275
+ method: 'DELETE',
276
+ headers: {
277
+ 'Content-Type': 'application/json'
278
+ },
279
+ body: JSON.stringify({ fileName: change.fileName })
280
+ })
281
+ );
282
+
283
+ await Promise.all(filesToDelete).catch((error) => Log.error(getError(error).message));
284
+
285
+ await this.fetchSavedChanges();
286
+ this.updateStack();
287
+ }
288
+
289
+ /**
290
+ * Handler for undo/redo stack change.
291
+ *
292
+ * @param sendAction send action method
293
+ * @returns (event: sap.ui.base.Event) => Promise<void>
294
+ */
295
+ private createOnStackChangeHandler(): (event: Event) => Promise<void> {
296
+ const handleStackChange = modeAndStackChangeHandler(this.sendAction, this.options.rta);
297
+ return async (event): Promise<void> => {
298
+ const pendingChanges: PendingChange[] = [];
299
+ this.eventStack.push(event);
300
+ const stack = this.options.rta.getCommandStack();
301
+ const allCommands = stack.getCommands();
302
+ const executedCommands = stack.getAllExecutedCommands();
303
+ const allCommandsFlattened = allCommands.flatMap((command: FlexCommand) =>
304
+ typeof command.getCommands === 'function' ? command.getCommands() : [command]
305
+ );
306
+ const activeCommandCount = allCommandsFlattened.length - executedCommands.length;
307
+ this.pendingConfigChangeMap = new Map();
308
+ let i = 0;
309
+ for (const command of allCommands) {
310
+ try {
311
+ if (typeof command.getCommands === 'function') {
312
+ const subCommands = command.getCommands();
313
+ for (const subCommand of subCommands) {
314
+ await this.handleCommand(subCommand, activeCommandCount, i, pendingChanges);
315
+ i++;
316
+ }
317
+ } else {
318
+ await this.handleCommand(command, activeCommandCount, i, pendingChanges);
319
+ i++;
320
+ }
321
+ } catch (error) {
322
+ Log.error('CPE: Change creation Failed', getError(error));
323
+ }
324
+ }
325
+ const eventIndex = this.eventStack.indexOf(event);
326
+ if (this.eventStack.length - 1 === eventIndex) {
327
+ this.pendingChanges = pendingChanges.filter((change): boolean => !!change);
328
+ const changesRequiringReload = this.pendingChanges.reduce(
329
+ (sum, change) => (isGenericConfigChange(change) ? sum + 1 : sum),
330
+ 0
331
+ );
332
+ if (changesRequiringReload > this.changesRequiringReload) {
333
+ await sendInfoCenterMessage({
334
+ title: { key: 'CHANGES_VISIBLE_AFTER_SAVE_AND_RELOAD_TITLE' },
335
+ description: { key: 'CHANGES_VISIBLE_AFTER_SAVE_AND_RELOAD_DESCRIPTION' },
336
+ type: MessageBarType.info
337
+ });
338
+ this.sendAction(setApplicationRequiresReload(changesRequiringReload > 0));
339
+ }
340
+ this.changesRequiringReload = changesRequiringReload;
341
+ }
342
+ this.eventStack.splice(eventIndex, 1);
343
+ if (Array.isArray(allCommands) && allCommands.length === 0) {
344
+ this.pendingChanges = [];
345
+ this.pendingConfigChangeMap = new Map();
346
+ await this.fetchSavedChanges();
347
+ }
348
+
349
+ // Notify to update the ui for configuration changes.
350
+ const configurationChanges: PendingGenericChange[] = this.pendingChanges?.filter(isGenericConfigChange);
351
+ if (configurationChanges.length) {
352
+ const stackChangeEvent = new CustomEvent(STACK_CHANGE_EVENT, {
353
+ detail: {
354
+ controls: configurationChanges.reduce((acc: UI5Element[], item) => {
355
+ const controls = ([...(item.controlId ?? [])] as string[])
356
+ .map((id: string) => {
357
+ return getControlById(id);
358
+ })
359
+ .filter((ui5Element) => isA<UI5Element>('sap.ui.core.Element', ui5Element));
360
+ acc.push(...controls);
361
+ return acc;
362
+ }, [])
363
+ }
364
+ });
365
+ this.dispatchEvent(stackChangeEvent);
366
+ }
367
+ this.updateStack();
368
+ handleStackChange();
369
+ };
370
+ }
371
+ /**
372
+ * Cached configuration commands to set reset value during stack change event.
373
+ *
374
+ * @param controlId - control id of the config property.
375
+ * @param propertyName - config property name.
376
+ * @returns Configuration property value.
377
+ */
378
+ public getConfigurationPropertyValue(controlId: string, propertyName: string): ConfigurationValue | undefined {
379
+ const pendingChanges = this.pendingConfigChangeMap?.get(controlId);
380
+ return (pendingChanges || []).find((item) => item.isActive && item.properties[0].label === propertyName)
381
+ ?.properties[0].value;
382
+ }
383
+
384
+ /**
385
+ * Get all pending configuration changes.
386
+ *
387
+ * @returns array of pending generic changes
388
+ */
389
+ public getAllPendingConfigPropertyPath(): Set<string> {
390
+ return this.configPropertyPath ?? new Set();
391
+ }
392
+
393
+ /**
394
+ * Update config changes with associated controls.
395
+ *
396
+ * @param {Map<string, string[]>} configPropertyControlIdMap - config property path control id map.
397
+ */
398
+ public async updateConfigurationProps(configPropertyControlIdMap: Map<string, string[]>): Promise<void> {
399
+ this.configPropertyControlIdMap = configPropertyControlIdMap;
400
+ await this.fetchSavedChanges();
401
+ this.updateStack();
402
+ }
403
+
404
+ /**
405
+ * Handles a command by preparing a pending change and adding it to the list of pending changes.
406
+ *
407
+ * @param {FlexCommand} command - The command to process.
408
+ * @param {number} inactiveCommandCount - The number of inactive commands.
409
+ * @param {number} index - The index of the current command being processed.
410
+ * @param {PendingChange[]} pendingChanges - The list of pending changes to update.
411
+ * @returns {Promise<void>} A promise that resolves when the command is handled.
412
+ */
413
+ private async handleCommand(
414
+ command: FlexCommand,
415
+ inactiveCommandCount: number,
416
+ index: number,
417
+ pendingChanges: PendingChange[]
418
+ ): Promise<void> {
419
+ setAdditionalChangeInfo(command?.getPreparedChange?.(), this.options.rta.getRootControlInstance());
420
+ const pendingChange = await this.prepareChangeType(command, inactiveCommandCount, index);
421
+ if (pendingChange) {
422
+ pendingChanges.push(pendingChange);
423
+ }
424
+ }
425
+
426
+ private trackPendingConfigChanges(result: PendingGenericChange): void {
427
+ for (const id of result?.controlId ?? []) {
428
+ if (!this.pendingConfigChangeMap.get(id)) {
429
+ this.pendingConfigChangeMap.set(id, []);
430
+ }
431
+ const pendingChanges = this.pendingConfigChangeMap.get(id);
432
+ pendingChanges?.push(result);
433
+ }
434
+ }
435
+
436
+ /**
437
+ * Prepares the type of change based on the command and other parameters.
438
+ *
439
+ * @param {FlexCommand} command - The command to process.
440
+ * @param {number} inactiveCommandCount - The number of inactive commands.
441
+ * @param {number} index - The index of the current command being processed.
442
+ * @returns {Promise<PendingChange | undefined>} - A promise that resolves to a `PendingChange` or `undefined`.
443
+ */
444
+ private async prepareChangeType(
445
+ command: FlexCommand,
446
+ inactiveCommandCount: number,
447
+ index: number
448
+ ): Promise<PendingChange | undefined> {
449
+ const change = command?.getPreparedChange?.();
450
+ const textBundle = await getTextBundle();
451
+ const selectorId =
452
+ typeof change?.getSelector === 'function'
453
+ ? await getControlIdByChange(change, this.options.rta.getRootControlInstance())
454
+ : this.getCommandSelectorId(command);
455
+
456
+ const changeType = this.getCommandChangeType(command);
457
+
458
+ if (!changeType) {
459
+ return undefined;
460
+ }
461
+
462
+ const changeDefinition = change.getDefinition ? change.getDefinition() : (change.getJson() as ChangeDefinition);
463
+ const { fileName } = changeDefinition;
464
+ const handler = GENERIC_CHANGE_HANDLER[changeType as ChangeType] as unknown as ChangeHandler<GenericChange>;
465
+ if (handler) {
466
+ const {
467
+ properties,
468
+ changeTitle,
469
+ controlId,
470
+ changeType: type,
471
+ subtitle
472
+ } = await handler(changeDefinition as unknown as GenericChange, {
473
+ textBundle,
474
+ appComponent: this.options.rta.getRootControlInstance(),
475
+ configPropertyControlIdMap: this.configPropertyControlIdMap
476
+ });
477
+ const genericChange: PendingGenericChange = {
478
+ kind: GENERIC_CHANGE_KIND,
479
+ type: 'pending',
480
+ changeType: type ?? changeType,
481
+ ...(subtitle && { subtitle }),
482
+ isActive: index >= inactiveCommandCount,
483
+ title: textBundle.getText(changeTitle),
484
+ fileName,
485
+ ...(controlId && { controlId }),
486
+ properties
487
+ };
488
+ if (changeType === 'appdescr_fe_changePageConfiguration') {
489
+ const configChangePath = (changeDefinition as ConfigChange).content.entityPropertyChange.propertyPath;
490
+ if (genericChange.isActive) {
491
+ this.configPropertyPath.add(configChangePath);
492
+ } else {
493
+ // remove value from set if change is undone
494
+ this.configPropertyPath.delete(configChangePath);
495
+ }
496
+ this.trackPendingConfigChanges(genericChange);
497
+ }
498
+ return genericChange;
499
+ } else {
500
+ const title = TITLE_MAP[changeType] ?? '';
501
+ let result: PendingChange = {
502
+ type: PENDING_CHANGE_TYPE,
503
+ kind: UNKNOWN_CHANGE_KIND,
504
+ ...(title && { title }),
505
+ changeType,
506
+ isActive: index >= inactiveCommandCount,
507
+ fileName
508
+ };
509
+
510
+ if (selectorId) {
511
+ result = {
512
+ ...result,
513
+ kind: 'control',
514
+ controlId: selectorId
515
+ };
516
+ }
517
+ return result;
518
+ }
519
+ }
520
+
521
+ /**
522
+ * Retry operations.
523
+ *
524
+ * @param operations to be executed
525
+ * @returns first successfull operation result or undefined
526
+ */
527
+ private retryOperations<T>(operations: Array<() => T>): T | undefined {
528
+ for (const operation of operations) {
529
+ try {
530
+ const result = operation();
531
+ if (!result) {
532
+ continue;
533
+ }
534
+ return result;
535
+ } catch {
536
+ continue;
537
+ }
538
+ }
539
+ Log.error('All retry operations failed');
540
+ return undefined;
541
+ }
542
+
543
+ /**
544
+ * Get command change type.
545
+ *
546
+ * @param command to be executed for creating change
547
+ * @returns command change type or undefined
548
+ */
549
+ private getCommandChangeType(command: FlexCommand): string | undefined {
550
+ return this.retryOperations([
551
+ () => command.getChangeType(),
552
+ () => command.getPreparedChange().getDefinition().changeType
553
+ ]);
554
+ }
555
+
556
+ /**
557
+ * Get command selector id.
558
+ *
559
+ * @param command to be executed for creating change
560
+ * @returns command selector id or undefined
561
+ */
562
+ private getCommandSelectorId(command: FlexCommand): string | undefined {
563
+ return this.retryOperations([
564
+ () => command.getSelector().id,
565
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
566
+ () => command.getElement().getProperty('persistencyKey'),
567
+ () => command.getElement().getId(),
568
+ () => command.getParent()?.getElement().getId()
569
+ ]) as string | undefined;
570
+ }
571
+
572
+ /**
573
+ * Sync outline changes to place modification markers when outline is changed.
574
+ *
575
+ * @returns void
576
+ */
577
+ public async syncOutlineChanges(): Promise<void> {
578
+ for (const change of this.savedChanges) {
579
+ if (change.kind !== 'unknown' && change.changeType !== 'configuration') {
580
+ const flexObject = await getFlexObject(this.changedFiles[change.fileName]);
581
+ change.controlId =
582
+ (await getControlIdByChange(flexObject, this.options.rta.getRootControlInstance())) ?? '';
583
+ }
584
+ }
585
+ this.updateStack();
586
+ }
587
+
588
+ public onStackChange(handler: (event: CustomEvent<StackChangedEventDetail>) => void | Promise<void>): void {
589
+ this.addEventListener(STACK_CHANGE_EVENT, handler as EventListener);
590
+ }
591
+ }
592
+
593
+ function isGenericConfigChange(change: PendingChange): change is PendingGenericChange {
594
+ return change.kind === GENERIC_CHANGE_KIND && change.changeType === 'configuration';
595
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ sap.ui.define(["../../i18n"], function (____i18n) {
4
+ "use strict";
5
+
6
+ const getTextBundle = ____i18n["getTextBundle"];
7
+ /**
8
+ * Function to validate if a given value is a valid binding model.
9
+ *
10
+ * @param modifiedControl control to be modified.
11
+ * @param value value to be checked.
12
+ */
13
+ async function validateBindingModel(modifiedControl, value) {
14
+ const textBundle = await getTextBundle();
15
+ const bindingValue = value.replace(/[{}]/gi, '').trim();
16
+ const bindingParts = bindingValue.split('>').filter(el => el !== '');
17
+ if (!bindingParts.length) {
18
+ throw new SyntaxError(textBundle.getText('INVALID_BINDING_STRING'));
19
+ }
20
+ if (bindingParts.length === 2) {
21
+ const bindingModel = bindingParts[0];
22
+ const resourceKey = bindingParts[1].trim();
23
+ const resourceModel = modifiedControl.getModel(bindingModel);
24
+ if (!resourceModel) {
25
+ throw new SyntaxError(textBundle.getText('INVALID_BINDING_MODEL'));
26
+ }
27
+ const resourceBundle = resourceModel.getResourceBundle();
28
+ if (!resourceBundle.getText(resourceKey, undefined, true)) {
29
+ throw new SyntaxError(textBundle.getText('INVALID_BINDING_MODEL_KEY'));
30
+ }
31
+ } else {
32
+ throw new SyntaxError(textBundle.getText('INVALID_BINDING_STRING_FORMAT'));
33
+ }
34
+ }
35
+ var __exports = {
36
+ __esModule: true
37
+ };
38
+ __exports.validateBindingModel = validateBindingModel;
39
+ return __exports;
40
+ });
41
+ //# sourceMappingURL=validator.js.map
@@ -0,0 +1,35 @@
1
+ import type ResourceBundle from 'sap/base/i18n/ResourceBundle';
2
+ import type ResourceModel from 'sap/ui/model/resource/ResourceModel';
3
+ import type UI5Element from 'sap/ui/core/Element';
4
+ import { getTextBundle } from '../../i18n';
5
+
6
+ /**
7
+ * Function to validate if a given value is a valid binding model.
8
+ *
9
+ * @param modifiedControl control to be modified.
10
+ * @param value value to be checked.
11
+ */
12
+ export async function validateBindingModel(modifiedControl: UI5Element, value: string): Promise<void> {
13
+ const textBundle = await getTextBundle();
14
+ const bindingValue = value.replace(/[{}]/gi, '').trim();
15
+ const bindingParts = bindingValue.split('>').filter((el) => el !== '');
16
+
17
+ if (!bindingParts.length) {
18
+ throw new SyntaxError(textBundle.getText('INVALID_BINDING_STRING'));
19
+ }
20
+
21
+ if (bindingParts.length === 2) {
22
+ const bindingModel = bindingParts[0];
23
+ const resourceKey = bindingParts[1].trim();
24
+ const resourceModel = modifiedControl.getModel(bindingModel) as ResourceModel;
25
+ if (!resourceModel) {
26
+ throw new SyntaxError(textBundle.getText('INVALID_BINDING_MODEL'));
27
+ }
28
+ const resourceBundle = resourceModel.getResourceBundle() as ResourceBundle;
29
+ if (!resourceBundle.getText(resourceKey, undefined, true)) {
30
+ throw new SyntaxError(textBundle.getText('INVALID_BINDING_MODEL_KEY'));
31
+ }
32
+ } else {
33
+ throw new SyntaxError(textBundle.getText('INVALID_BINDING_STRING_FORMAT'));
34
+ }
35
+ }