@sap/ux-ui5-tooling 1.20.4 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/adp-tooling/templates/cf/_gitignore +6 -0
  3. package/dist/adp-tooling/templates/cf/approuter/package.json +13 -0
  4. package/dist/adp-tooling/templates/cf/approuter/xs-app.json +15 -0
  5. package/dist/adp-tooling/templates/cf/i18n/i18n.properties +3 -0
  6. package/dist/adp-tooling/templates/cf/package.json +35 -0
  7. package/dist/adp-tooling/templates/cf/ui5.yaml +5 -0
  8. package/dist/adp-tooling/templates/cf/xs-security.json +7 -0
  9. package/dist/adp-tooling/templates/changes/annotation.xml +18 -0
  10. package/dist/adp-tooling/templates/project/gitignore.tmpl +5 -0
  11. package/dist/adp-tooling/templates/project/package.json +31 -0
  12. package/dist/adp-tooling/templates/project/ui5.yaml +6 -0
  13. package/dist/adp-tooling/templates/project/webapp/i18n/i18n.properties +6 -0
  14. package/dist/adp-tooling/templates/project/webapp/manifest.appdescr_variant +10 -0
  15. package/dist/adp-tooling/templates/rta/common/analytical-custom-column.xml +25 -0
  16. package/dist/adp-tooling/templates/rta/common/custom-action.xml +8 -0
  17. package/dist/adp-tooling/templates/rta/common/grid-tree-custom-column.xml +22 -0
  18. package/dist/adp-tooling/templates/rta/common/header-field.xml +13 -0
  19. package/dist/adp-tooling/templates/rta/common/op-custom-section.xml +20 -0
  20. package/dist/adp-tooling/templates/rta/common/v4-table-action.xml +8 -0
  21. package/dist/adp-tooling/templates/rta/controller.ejs +80 -0
  22. package/dist/adp-tooling/templates/rta/fragment.xml +7 -0
  23. package/dist/adp-tooling/templates/rta/ts-controller.ejs +18 -0
  24. package/dist/adp-tooling/templates/rta/v2/m-table-custom-column-cell.xml +7 -0
  25. package/dist/adp-tooling/templates/rta/v2/m-table-custom-column.xml +18 -0
  26. package/dist/adp-tooling/templates/rta/v4/custom-section.xml +12 -0
  27. package/dist/adp-tooling/templates/rta/v4/mdc-custom-column-config.xml +6 -0
  28. package/dist/adp-tooling/templates/rta/v4/mdc-custom-column.xml +11 -0
  29. package/dist/adp-tooling/templates/typescript/tsconfig.json +19 -0
  30. package/dist/cli/index.js +15811 -9929
  31. package/dist/control-property-editor/app.css +2 -0
  32. package/dist/control-property-editor/app.js +175 -0
  33. package/dist/livereload-js/livereload.js +3795 -0
  34. package/dist/middlewares/fiori-tools-appreload.js +43486 -41472
  35. package/dist/middlewares/fiori-tools-preview.js +56962 -3066
  36. package/dist/middlewares/fiori-tools-proxy.js +55281 -32282
  37. package/dist/middlewares/fiori-tools-servestatic.js +31629 -29
  38. package/dist/preview-middleware/dist/client/adp/add-fragment.js +48 -0
  39. package/dist/preview-middleware/dist/client/adp/add-fragment.ts +51 -0
  40. package/dist/preview-middleware/dist/client/adp/api-handler.js +162 -0
  41. package/dist/preview-middleware/dist/client/adp/api-handler.ts +188 -0
  42. package/dist/preview-middleware/dist/client/adp/command-executor.js +100 -0
  43. package/dist/preview-middleware/dist/client/adp/command-executor.ts +105 -0
  44. package/dist/preview-middleware/dist/client/adp/control-utils.js +46 -0
  45. package/dist/preview-middleware/dist/client/adp/control-utils.ts +48 -0
  46. package/dist/preview-middleware/dist/client/adp/controllers/AddActionFragment.controller.js +198 -0
  47. package/dist/preview-middleware/dist/client/adp/controllers/AddActionFragment.controller.ts +232 -0
  48. package/dist/preview-middleware/dist/client/adp/controllers/AddCustomFragment.controller.js +223 -0
  49. package/dist/preview-middleware/dist/client/adp/controllers/AddCustomFragment.controller.ts +257 -0
  50. package/dist/preview-middleware/dist/client/adp/controllers/AddFragment.controller.js +195 -0
  51. package/dist/preview-middleware/dist/client/adp/controllers/AddFragment.controller.ts +264 -0
  52. package/dist/preview-middleware/dist/client/adp/controllers/AddSubpage.controller.js +146 -0
  53. package/dist/preview-middleware/dist/client/adp/controllers/AddSubpage.controller.ts +209 -0
  54. package/dist/preview-middleware/dist/client/adp/controllers/AddTableColumnFragments.controller.js +232 -0
  55. package/dist/preview-middleware/dist/client/adp/controllers/AddTableColumnFragments.controller.ts +306 -0
  56. package/dist/preview-middleware/dist/client/adp/controllers/BaseDialog.controller.js +187 -0
  57. package/dist/preview-middleware/dist/client/adp/controllers/BaseDialog.controller.ts +254 -0
  58. package/dist/preview-middleware/dist/client/adp/controllers/ControllerExtension.controller.js +330 -0
  59. package/dist/preview-middleware/dist/client/adp/controllers/ControllerExtension.controller.ts +408 -0
  60. package/dist/preview-middleware/dist/client/adp/controllers/ExtensionPoint.controller.js +160 -0
  61. package/dist/preview-middleware/dist/client/adp/controllers/ExtensionPoint.controller.ts +195 -0
  62. package/dist/preview-middleware/dist/client/adp/controllers/FileExistsDialog.controller.js +68 -0
  63. package/dist/preview-middleware/dist/client/adp/controllers/FileExistsDialog.controller.ts +86 -0
  64. package/dist/preview-middleware/dist/client/adp/controllers/types.js +2 -0
  65. package/dist/preview-middleware/dist/client/adp/controllers/types.ts +10 -0
  66. package/dist/preview-middleware/dist/client/adp/dialog-factory.js +151 -0
  67. package/dist/preview-middleware/dist/client/adp/dialog-factory.ts +210 -0
  68. package/dist/preview-middleware/dist/client/adp/extend-controller.js +48 -0
  69. package/dist/preview-middleware/dist/client/adp/extend-controller.ts +49 -0
  70. package/dist/preview-middleware/dist/client/adp/extension-point.js +83 -0
  71. package/dist/preview-middleware/dist/client/adp/extension-point.ts +116 -0
  72. package/dist/preview-middleware/dist/client/adp/init-dialogs.js +142 -0
  73. package/dist/preview-middleware/dist/client/adp/init-dialogs.ts +178 -0
  74. package/dist/preview-middleware/dist/client/adp/init.js +102 -0
  75. package/dist/preview-middleware/dist/client/adp/init.ts +85 -0
  76. package/dist/preview-middleware/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.js +97 -0
  77. package/dist/preview-middleware/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.ts +140 -0
  78. package/dist/preview-middleware/dist/client/adp/quick-actions/common/add-controller-to-page.js +74 -0
  79. package/dist/preview-middleware/dist/client/adp/quick-actions/common/add-controller-to-page.ts +92 -0
  80. package/dist/preview-middleware/dist/client/adp/quick-actions/common/add-new-annotation-file.js +171 -0
  81. package/dist/preview-middleware/dist/client/adp/quick-actions/common/add-new-annotation-file.ts +174 -0
  82. package/dist/preview-middleware/dist/client/adp/quick-actions/common/create-page-action.js +56 -0
  83. package/dist/preview-middleware/dist/client/adp/quick-actions/common/create-page-action.ts +56 -0
  84. package/dist/preview-middleware/dist/client/adp/quick-actions/common/op-add-custom-section.js +41 -0
  85. package/dist/preview-middleware/dist/client/adp/quick-actions/common/op-add-custom-section.ts +51 -0
  86. package/dist/preview-middleware/dist/client/adp/quick-actions/common/op-add-header-field.js +69 -0
  87. package/dist/preview-middleware/dist/client/adp/quick-actions/common/op-add-header-field.ts +81 -0
  88. package/dist/preview-middleware/dist/client/adp/quick-actions/common/utils.js +20 -0
  89. package/dist/preview-middleware/dist/client/adp/quick-actions/common/utils.ts +7 -0
  90. package/dist/preview-middleware/dist/client/adp/quick-actions/control-types.js +25 -0
  91. package/dist/preview-middleware/dist/client/adp/quick-actions/control-types.ts +7 -0
  92. package/dist/preview-middleware/dist/client/adp/quick-actions/dialog-enablement-validator.js +26 -0
  93. package/dist/preview-middleware/dist/client/adp/quick-actions/dialog-enablement-validator.ts +18 -0
  94. package/dist/preview-middleware/dist/client/adp/quick-actions/enablement-validator.js +2 -0
  95. package/dist/preview-middleware/dist/client/adp/quick-actions/enablement-validator.ts +19 -0
  96. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/add-new-subpage.js +82 -0
  97. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/add-new-subpage.ts +87 -0
  98. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/change-table-actions.js +69 -0
  99. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/change-table-actions.ts +71 -0
  100. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +103 -0
  101. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/change-table-columns.ts +105 -0
  102. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/create-table-action.js +111 -0
  103. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/create-table-action.ts +110 -0
  104. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +108 -0
  105. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.ts +141 -0
  106. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +80 -0
  107. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.ts +93 -0
  108. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +79 -0
  109. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.ts +102 -0
  110. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.js +71 -0
  111. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.ts +98 -0
  112. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +61 -0
  113. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.ts +77 -0
  114. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.js +95 -0
  115. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.ts +102 -0
  116. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.js +86 -0
  117. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.ts +116 -0
  118. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/registry.js +79 -0
  119. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/registry.ts +121 -0
  120. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/utils.js +138 -0
  121. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/utils.ts +134 -0
  122. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/add-new-subpage.js +140 -0
  123. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/add-new-subpage.ts +181 -0
  124. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/change-table-actions.js +81 -0
  125. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/change-table-actions.ts +81 -0
  126. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +90 -0
  127. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/change-table-columns.ts +97 -0
  128. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-page-action.js +81 -0
  129. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-page-action.ts +98 -0
  130. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-table-action-config-change.js +129 -0
  131. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-table-action-config-change.ts +149 -0
  132. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-table-custom-column-config-change.js +142 -0
  133. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-table-custom-column-config-change.ts +178 -0
  134. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/enable-variant-management.js +83 -0
  135. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/enable-variant-management.ts +96 -0
  136. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +58 -0
  137. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.ts +70 -0
  138. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +86 -0
  139. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.ts +96 -0
  140. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +55 -0
  141. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.ts +61 -0
  142. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/op-add-custom-section.js +73 -0
  143. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/op-add-custom-section.ts +91 -0
  144. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.js +91 -0
  145. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.ts +88 -0
  146. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/registry.js +62 -0
  147. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/registry.ts +86 -0
  148. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/utils.js +158 -0
  149. package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/utils.ts +175 -0
  150. package/dist/preview-middleware/dist/client/adp/quick-actions/load.js +46 -0
  151. package/dist/preview-middleware/dist/client/adp/quick-actions/load.ts +23 -0
  152. package/dist/preview-middleware/dist/client/adp/quick-actions/quick-action-base.js +64 -0
  153. package/dist/preview-middleware/dist/client/adp/quick-actions/quick-action-base.ts +71 -0
  154. package/dist/preview-middleware/dist/client/adp/quick-actions/simple-quick-action-base.js +44 -0
  155. package/dist/preview-middleware/dist/client/adp/quick-actions/simple-quick-action-base.ts +51 -0
  156. package/dist/preview-middleware/dist/client/adp/quick-actions/supported-ui5versions.md +40 -0
  157. package/dist/preview-middleware/dist/client/adp/quick-actions/table-quick-action-base.js +372 -0
  158. package/dist/preview-middleware/dist/client/adp/quick-actions/table-quick-action-base.ts +433 -0
  159. package/dist/preview-middleware/dist/client/adp/sync-views-utils.js +123 -0
  160. package/dist/preview-middleware/dist/client/adp/sync-views-utils.ts +90 -0
  161. package/dist/preview-middleware/dist/client/adp/ui/AddAction.fragment.xml +49 -0
  162. package/dist/preview-middleware/dist/client/adp/ui/AddCustomFragment.fragment.xml +48 -0
  163. package/dist/preview-middleware/dist/client/adp/ui/AddFragment.fragment.xml +83 -0
  164. package/dist/preview-middleware/dist/client/adp/ui/AddSubpage.fragment.xml +73 -0
  165. package/dist/preview-middleware/dist/client/adp/ui/AddTableColumnFragments.fragment.xml +63 -0
  166. package/dist/preview-middleware/dist/client/adp/ui/ControllerExtension.fragment.xml +63 -0
  167. package/dist/preview-middleware/dist/client/adp/ui/ExtensionPoint.fragment.xml +61 -0
  168. package/dist/preview-middleware/dist/client/adp/ui/FileExistsDialog.fragment.xml +43 -0
  169. package/dist/preview-middleware/dist/client/adp/utils.js +199 -0
  170. package/dist/preview-middleware/dist/client/adp/utils.ts +200 -0
  171. package/dist/preview-middleware/dist/client/cpe/additional-change-info/add-xml-additional-info.js +85 -0
  172. package/dist/preview-middleware/dist/client/cpe/additional-change-info/add-xml-additional-info.ts +107 -0
  173. package/dist/preview-middleware/dist/client/cpe/changes/flex-change.js +66 -0
  174. package/dist/preview-middleware/dist/client/cpe/changes/flex-change.ts +66 -0
  175. package/dist/preview-middleware/dist/client/cpe/changes/generic-change.js +321 -0
  176. package/dist/preview-middleware/dist/client/cpe/changes/generic-change.ts +462 -0
  177. package/dist/preview-middleware/dist/client/cpe/changes/index.js +12 -0
  178. package/dist/preview-middleware/dist/client/cpe/changes/index.ts +1 -0
  179. package/dist/preview-middleware/dist/client/cpe/changes/service.js +527 -0
  180. package/dist/preview-middleware/dist/client/cpe/changes/service.ts +595 -0
  181. package/dist/preview-middleware/dist/client/cpe/changes/validator.js +41 -0
  182. package/dist/preview-middleware/dist/client/cpe/changes/validator.ts +35 -0
  183. package/dist/preview-middleware/dist/client/cpe/communication-service.js +44 -0
  184. package/dist/preview-middleware/dist/client/cpe/communication-service.ts +41 -0
  185. package/dist/preview-middleware/dist/client/cpe/connector-service.js +88 -0
  186. package/dist/preview-middleware/dist/client/cpe/connector-service.ts +74 -0
  187. package/dist/preview-middleware/dist/client/cpe/context-menu-service.js +90 -0
  188. package/dist/preview-middleware/dist/client/cpe/context-menu-service.ts +77 -0
  189. package/dist/preview-middleware/dist/client/cpe/control-data.js +366 -0
  190. package/dist/preview-middleware/dist/client/cpe/control-data.ts +400 -0
  191. package/dist/preview-middleware/dist/client/cpe/documentation.js +191 -0
  192. package/dist/preview-middleware/dist/client/cpe/documentation.ts +187 -0
  193. package/dist/preview-middleware/dist/client/cpe/feature-service.js +39 -0
  194. package/dist/preview-middleware/dist/client/cpe/feature-service.ts +25 -0
  195. package/dist/preview-middleware/dist/client/cpe/init.js +92 -0
  196. package/dist/preview-middleware/dist/client/cpe/init.ts +114 -0
  197. package/dist/preview-middleware/dist/client/cpe/logger.js +32 -0
  198. package/dist/preview-middleware/dist/client/cpe/logger.ts +24 -0
  199. package/dist/preview-middleware/dist/client/cpe/odata-health/odata-health-checker.js +126 -0
  200. package/dist/preview-middleware/dist/client/cpe/odata-health/odata-health-checker.ts +150 -0
  201. package/dist/preview-middleware/dist/client/cpe/odata-health/odata-health-status.js +63 -0
  202. package/dist/preview-middleware/dist/client/cpe/odata-health/odata-health-status.ts +52 -0
  203. package/dist/preview-middleware/dist/client/cpe/outline/editable.js +38 -0
  204. package/dist/preview-middleware/dist/client/cpe/outline/editable.ts +30 -0
  205. package/dist/preview-middleware/dist/client/cpe/outline/nodes.js +212 -0
  206. package/dist/preview-middleware/dist/client/cpe/outline/nodes.ts +236 -0
  207. package/dist/preview-middleware/dist/client/cpe/outline/service.js +62 -0
  208. package/dist/preview-middleware/dist/client/cpe/outline/service.ts +66 -0
  209. package/dist/preview-middleware/dist/client/cpe/quick-actions/quick-action-service.js +161 -0
  210. package/dist/preview-middleware/dist/client/cpe/quick-actions/quick-action-service.ts +184 -0
  211. package/dist/preview-middleware/dist/client/cpe/quick-actions/registry.js +145 -0
  212. package/dist/preview-middleware/dist/client/cpe/quick-actions/registry.ts +157 -0
  213. package/dist/preview-middleware/dist/client/cpe/quick-actions/utils.js +94 -0
  214. package/dist/preview-middleware/dist/client/cpe/quick-actions/utils.ts +113 -0
  215. package/dist/preview-middleware/dist/client/cpe/rta-service.js +94 -0
  216. package/dist/preview-middleware/dist/client/cpe/rta-service.ts +86 -0
  217. package/dist/preview-middleware/dist/client/cpe/selection.js +249 -0
  218. package/dist/preview-middleware/dist/client/cpe/selection.ts +267 -0
  219. package/dist/preview-middleware/dist/client/cpe/ui5-utils.js +35 -0
  220. package/dist/preview-middleware/dist/client/cpe/ui5-utils.ts +28 -0
  221. package/dist/preview-middleware/dist/client/cpe/utils.js +113 -0
  222. package/dist/preview-middleware/dist/client/cpe/utils.ts +162 -0
  223. package/dist/preview-middleware/dist/client/flp/WorkspaceConnector.js +96 -0
  224. package/dist/preview-middleware/dist/client/flp/WorkspaceConnector.ts +99 -0
  225. package/dist/preview-middleware/dist/client/flp/common.js +30 -0
  226. package/dist/preview-middleware/dist/client/flp/common.ts +28 -0
  227. package/dist/preview-middleware/dist/client/flp/enableFakeConnector.js +92 -0
  228. package/dist/preview-middleware/dist/client/flp/enableFakeConnector.ts +113 -0
  229. package/dist/preview-middleware/dist/client/flp/homepage/Component.js +16 -0
  230. package/dist/preview-middleware/dist/client/flp/homepage/Component.ts +10 -0
  231. package/dist/preview-middleware/dist/client/flp/homepage/controller/MyHome.controller.js +54 -0
  232. package/dist/preview-middleware/dist/client/flp/homepage/controller/MyHome.controller.ts +41 -0
  233. package/dist/preview-middleware/dist/client/flp/homepage/css/style.css +3 -0
  234. package/dist/preview-middleware/dist/client/flp/homepage/manifest.json +41 -0
  235. package/dist/preview-middleware/dist/client/flp/homepage/view/MyHome.view.xml +18 -0
  236. package/dist/preview-middleware/dist/client/flp/init.js +418 -0
  237. package/dist/preview-middleware/dist/client/flp/init.ts +448 -0
  238. package/dist/preview-middleware/dist/client/flp/initCdm.js +117 -0
  239. package/dist/preview-middleware/dist/client/flp/initCdm.ts +111 -0
  240. package/dist/preview-middleware/dist/client/flp/initConnectors.js +31 -0
  241. package/dist/preview-middleware/dist/client/flp/initConnectors.ts +20 -0
  242. package/dist/preview-middleware/dist/client/flp/initRta.js +180 -0
  243. package/dist/preview-middleware/dist/client/flp/initRta.ts +194 -0
  244. package/dist/preview-middleware/dist/client/i18n.js +56 -0
  245. package/dist/preview-middleware/dist/client/i18n.ts +49 -0
  246. package/dist/preview-middleware/dist/client/manifest.json +8 -0
  247. package/dist/preview-middleware/dist/client/messagebundle.properties +143 -0
  248. package/dist/preview-middleware/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +486 -0
  249. package/dist/preview-middleware/dist/client/utils/additional-change-info.js +69 -0
  250. package/dist/preview-middleware/dist/client/utils/additional-change-info.ts +73 -0
  251. package/dist/preview-middleware/dist/client/utils/application.js +34 -0
  252. package/dist/preview-middleware/dist/client/utils/application.ts +27 -0
  253. package/dist/preview-middleware/dist/client/utils/core.js +144 -0
  254. package/dist/preview-middleware/dist/client/utils/core.ts +145 -0
  255. package/dist/preview-middleware/dist/client/utils/error.js +28 -0
  256. package/dist/preview-middleware/dist/client/utils/error.ts +18 -0
  257. package/dist/preview-middleware/dist/client/utils/fe-v2.js +58 -0
  258. package/dist/preview-middleware/dist/client/utils/fe-v2.ts +61 -0
  259. package/dist/preview-middleware/dist/client/utils/fe-v4.js +168 -0
  260. package/dist/preview-middleware/dist/client/utils/fe-v4.ts +186 -0
  261. package/dist/preview-middleware/dist/client/utils/info-center-message.js +60 -0
  262. package/dist/preview-middleware/dist/client/utils/info-center-message.ts +60 -0
  263. package/dist/preview-middleware/dist/client/utils/version.js +126 -0
  264. package/dist/preview-middleware/dist/client/utils/version.ts +138 -0
  265. package/dist/preview-middleware/templates/flp/cdm.base.json +47 -0
  266. package/dist/preview-middleware/templates/flp/cdm.ejs +72 -0
  267. package/dist/preview-middleware/templates/flp/editor.ejs +28 -0
  268. package/dist/preview-middleware/templates/flp/sandbox.ejs +88 -0
  269. package/dist/preview-middleware/templates/flp/sandbox2.ejs +86 -0
  270. package/dist/preview-middleware/templates/test/qunit.ejs +26 -0
  271. package/dist/preview-middleware/templates/test/qunit.js +29 -0
  272. package/dist/preview-middleware/templates/test/testsuite.qunit.ejs +10 -0
  273. package/dist/preview-middleware/templates/test/testsuite.qunit.js +8 -0
  274. package/dist/tasks/cf-deploy/index.js +1780 -1464
  275. package/dist/tasks/deploy/index.js +14857 -9062
  276. package/package.json +31 -34
  277. package/prebuilds/keyring.darwin-arm64.node +0 -0
  278. package/prebuilds/keyring.darwin-x64.node +0 -0
  279. package/prebuilds/keyring.linux-arm-gnueabihf.node +0 -0
  280. package/prebuilds/keyring.linux-arm64-gnu.node +0 -0
  281. package/prebuilds/keyring.linux-arm64-musl.node +0 -0
  282. package/prebuilds/keyring.linux-ia32-gnu.node +0 -0
  283. package/prebuilds/keyring.linux-x64-gnu.node +0 -0
  284. package/prebuilds/keyring.linux-x64-musl.node +0 -0
  285. package/prebuilds/keyring.win32-arm64-msvc.node +0 -0
  286. package/prebuilds/keyring.win32-ia32-msvc.node +0 -0
  287. package/prebuilds/keyring.win32-x64-msvc.node +0 -0
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ sap.ui.define(["../utils/version"], function (___utils_version) {
4
+ "use strict";
5
+
6
+ const getUi5Version = ___utils_version["getUi5Version"];
7
+ const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
8
+ /**
9
+ * Initializes UI5 connectors based on the current UI5 version.
10
+ *
11
+ * For UI5 versions below 1.84, this function dynamically requires and executes a FakeLrepConnector.
12
+ * For UI5 versions 1.84 and above, a local connector that reuses the WorkspaceConnector is being defined in preview-middleware/src/base/config.ts.
13
+ * This setup allows for flexibility in using different connectors based on the UI5 version.
14
+ *
15
+ * @example
16
+ * intiConnectors(); // Simply call the function without any arguments.
17
+ */
18
+ async function initConnectors() {
19
+ const ui5Version = await getUi5Version();
20
+ if (isLowerThanMinimalUi5Version(ui5Version, {
21
+ major: 1,
22
+ minor: 84
23
+ }) && ui5Version.isCdn) {
24
+ sap.ui.require(['open/ux/preview/client/flp/enableFakeConnector'], function (enableFakeConnector) {
25
+ enableFakeConnector();
26
+ });
27
+ }
28
+ }
29
+ return initConnectors;
30
+ });
31
+ //# sourceMappingURL=initConnectors.js.map
@@ -0,0 +1,20 @@
1
+ import { getUi5Version, isLowerThanMinimalUi5Version } from '../utils/version';
2
+
3
+ /**
4
+ * Initializes UI5 connectors based on the current UI5 version.
5
+ *
6
+ * For UI5 versions below 1.84, this function dynamically requires and executes a FakeLrepConnector.
7
+ * For UI5 versions 1.84 and above, a local connector that reuses the WorkspaceConnector is being defined in preview-middleware/src/base/config.ts.
8
+ * This setup allows for flexibility in using different connectors based on the UI5 version.
9
+ *
10
+ * @example
11
+ * intiConnectors(); // Simply call the function without any arguments.
12
+ */
13
+ export default async function initConnectors(): Promise<void> {
14
+ const ui5Version = await getUi5Version();
15
+ if (isLowerThanMinimalUi5Version(ui5Version, { major: 1, minor: 84 }) && ui5Version.isCdn) {
16
+ sap.ui.require(['open/ux/preview/client/flp/enableFakeConnector'], function (enableFakeConnector: () => void) {
17
+ enableFakeConnector();
18
+ });
19
+ }
20
+ }
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/base/util/merge", "sap/ui/core/Control", "sap/ui/core/UIComponent", "sap/ui/fl/Utils", "sap/ui/fl/write/api/FeaturesAPI", "sap/ui/rta/RuntimeAuthoring"], function (merge, Control, UIComponent, Utils, FeaturesAPI, RuntimeAuthoring) {
4
+ "use strict";
5
+
6
+ const defaultOptions = {
7
+ flexSettings: {
8
+ developerMode: false,
9
+ layer: 'CUSTOMER'
10
+ }
11
+ };
12
+ const layers = {
13
+ BASE: 'BASE',
14
+ CUSTOMER: 'CUSTOMER',
15
+ CUSTOMER_BASE: 'CUSTOMER_BASE',
16
+ PARTNER: 'PARTNER',
17
+ PUBLIC: 'PUBLIC',
18
+ USER: 'USER',
19
+ VENDOR: 'VENDOR'
20
+ };
21
+
22
+ /**
23
+ * Checks if the given layer is a valid layer.
24
+ *
25
+ * @param {string} layer - The layer name to be validated.
26
+ * @returns {boolean} Returns true if the layer is valid, otherwise false.
27
+ */
28
+ function isValidLayer(layer) {
29
+ return Object.keys(layers).some(existingLayer => existingLayer === layer);
30
+ }
31
+
32
+ /**
33
+ * Validates a given layer and throws an error if it is invalid.
34
+ *
35
+ * @param {string} layer - The layer name to be checked.
36
+ * @throws {Error} Throws an error if the layer is not valid.
37
+ */
38
+ function checkLayer(layer) {
39
+ if (!isValidLayer(layer)) {
40
+ throw new Error('An invalid layer is passed');
41
+ }
42
+ }
43
+
44
+ /**
45
+ * Checks if the given root control is an instance of Control or UIComponent.
46
+ *
47
+ * @param {Component} rootControl - The root control to be checked.
48
+ * @throws {Error} Throws an error if the root control is not an instance of Control or UIComponent.
49
+ */
50
+ function checkRootControl(rootControl) {
51
+ if (!(rootControl instanceof Control) && !(rootControl instanceof UIComponent)) {
52
+ throw new Error('An invalid root control was passed');
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Checks if key user adaptation is enabled for the specified component.
58
+ * Fiori tools mode is considered a developer scenario where the `flexEnabled` flag should not be evaluated.
59
+ *
60
+ * @param {Component} component - The UI5 control component to check for flex (key user adaptation) enabled status.
61
+ * @throws {Error} Throws an error if key user adaptation is explicitly disabled in the component's manifest.
62
+ */
63
+ function checkFlexEnabled(component) {
64
+ // fiori tools is always a developer scenario where the flexEnabled flag should not be evaluated
65
+ const fioriToolsMode = new URLSearchParams(window.location.search).get('fiori-tools-rta-mode');
66
+ if (!fioriToolsMode || fioriToolsMode === 'false') {
67
+ const manifest = component.getManifest() || {};
68
+ const flexEnabled = manifest['sap.ui5']?.flexEnabled;
69
+ if (flexEnabled === false) {
70
+ throw new Error('This app is not enabled for key user adaptation');
71
+ }
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Checks if the current user is a key user for the given layer.
77
+ * Specifically, it checks for key user rights if the layer is the CUSTOMER layer.
78
+ * If the user is not a key user and the layer is CUSTOMER, an error is thrown.
79
+ *
80
+ * Note: The function assumes the presence of 'layers.CUSTOMER'. In case of non-CUSTOMER layers,
81
+ * it simply resolves the promise without any additional checks.
82
+ *
83
+ * @param {string} layer - The layer for which to check key user rights.
84
+ * @returns {Promise<void>} A promise that resolves if the user is a key user or the layer is not CUSTOMER.
85
+ * Rejects with an error if the user is not a key user for the CUSTOMER layer.
86
+ * @throws {Error} Throws an error with the message 'No key user rights found' if the user lacks key user rights.
87
+ */
88
+ async function checkKeyUser(layer) {
89
+ if (layers.CUSTOMER === layer) {
90
+ const isKeyUser = await FeaturesAPI.isKeyUser();
91
+ if (!isKeyUser) {
92
+ throw new Error('No key user rights found');
93
+ }
94
+ }
95
+ }
96
+
97
+ /**
98
+ * Checks the validity of the specified layer and root control.
99
+ * It ensures that the layer is valid and the root control is an instance of Control or UIComponent.
100
+ * Additionally, it checks key user permissions for the specified layer.
101
+ *
102
+ * @param {Control} rootControl - The root control to be validated.
103
+ * @param {string} layer - The layer name to be validated.
104
+ * @returns {Promise<void>} A promise that resolves when all checks pass without errors.
105
+ * @throws {Error} Throws an error if any of the checks fail.
106
+ */
107
+ async function checkLayerAndControl(rootControl, layer) {
108
+ checkLayer(layer);
109
+ checkRootControl(rootControl);
110
+ await checkKeyUser(layer);
111
+ }
112
+
113
+ /**
114
+ * Retrieves the first HTML element with the specified title attribute.
115
+ *
116
+ * @param {string} title - The title attribute value to search for in the HTML elements.
117
+ * @param {Element | null} element - The target element that will be searched.
118
+ * @returns {Element | null} The first HTML element that matches the given title attribute value, or null if no such element is found.
119
+ */
120
+ function getElementByTitle(title, element) {
121
+ const selector = `[title="${title}"]`;
122
+ return element ? element.querySelector(selector) : document.querySelector(selector);
123
+ }
124
+
125
+ /**
126
+ * Hides a UI5 Button control with the specified ID.
127
+ *
128
+ * This function attempts to find a UI5 Button control by its ID and then sets its visibility to false.
129
+ *
130
+ * @param {string | undefined} buttonId - The ID of the Button control to hide. If undefined, no action is taken.
131
+ * @returns {void}
132
+ */
133
+ function hideButtonById(buttonId) {
134
+ const button = sap.ui.getCore().byId(buttonId);
135
+ button?.setVisible(false);
136
+ }
137
+
138
+ /**
139
+ * Hides specific buttons by ID from the RTA toolbar.
140
+ * This function specifically targets buttons 'Reset' and 'Publish'.
141
+ */
142
+ function removeExtraBtnsFromToolbar() {
143
+ const rtaToolbarEl = document.querySelector('.sapUiRtaToolbar');
144
+ const resetEl = getElementByTitle('Reset', rtaToolbarEl);
145
+ const publishEl = getElementByTitle('Publish', rtaToolbarEl);
146
+ hideButtonById(resetEl?.id);
147
+ hideButtonById(publishEl?.id);
148
+ }
149
+
150
+ /**
151
+ * Initializes custom RuntimeAuthoring for UI5 Versions < 1.72 and start UI Adaptation.
152
+ * Ensures that the passed options are valid.
153
+ *
154
+ * @param {RTAOptions} options - Options that are passed to RuntimeAuthoring upon initialization.
155
+ * @param {RTAPlugin} loadPlugins - Script that needs to be executed after rta is initialized.
156
+ * @returns {Promise<void>} A promise that resolves when all the checks have passed and RuntimeAuthoring is started.
157
+ */
158
+ var __exports = async function (options, loadPlugins) {
159
+ options = merge(defaultOptions, options);
160
+ const layer = options.flexSettings.layer;
161
+ const rootControl = options.rootControl;
162
+ await checkLayerAndControl(rootControl, layer);
163
+ options.rootControl = Utils.getAppComponentForControl(rootControl);
164
+ checkFlexEnabled(options.rootControl);
165
+ const rta = new RuntimeAuthoring(options);
166
+ rta.attachEvent('stop', () => rta.destroy());
167
+ if (loadPlugins) {
168
+ await loadPlugins(rta);
169
+ }
170
+ await rta.start();
171
+ removeExtraBtnsFromToolbar();
172
+ };
173
+ __exports.isValidLayer = isValidLayer;
174
+ __exports.checkLayer = checkLayer;
175
+ __exports.checkRootControl = checkRootControl;
176
+ __exports.checkFlexEnabled = checkFlexEnabled;
177
+ __exports.checkKeyUser = checkKeyUser;
178
+ return __exports;
179
+ });
180
+ //# sourceMappingURL=initRta.js.map
@@ -0,0 +1,194 @@
1
+ import type Button from 'sap/m/Button';
2
+
3
+ import merge from 'sap/base/util/merge';
4
+
5
+ import Control from 'sap/ui/core/Control';
6
+ import Component from 'sap/ui/core/Component';
7
+ import UIComponent from 'sap/ui/core/UIComponent';
8
+
9
+ import Utils from 'sap/ui/fl/Utils';
10
+ import FeaturesAPI from 'sap/ui/fl/write/api/FeaturesAPI';
11
+
12
+ import type { RTAPlugin } from 'sap/ui/rta/api/startAdaptation';
13
+ import RuntimeAuthoring, { type Manifest, type RTAOptions } from 'sap/ui/rta/RuntimeAuthoring';
14
+
15
+ const defaultOptions = {
16
+ flexSettings: {
17
+ developerMode: false,
18
+ layer: 'CUSTOMER'
19
+ }
20
+ };
21
+
22
+ const layers = {
23
+ BASE: 'BASE',
24
+ CUSTOMER: 'CUSTOMER',
25
+ CUSTOMER_BASE: 'CUSTOMER_BASE',
26
+ PARTNER: 'PARTNER',
27
+ PUBLIC: 'PUBLIC',
28
+ USER: 'USER',
29
+ VENDOR: 'VENDOR'
30
+ };
31
+
32
+ /**
33
+ * Checks if the given layer is a valid layer.
34
+ *
35
+ * @param {string} layer - The layer name to be validated.
36
+ * @returns {boolean} Returns true if the layer is valid, otherwise false.
37
+ */
38
+ export function isValidLayer(layer: string): boolean {
39
+ return Object.keys(layers).some((existingLayer) => existingLayer === layer);
40
+ }
41
+
42
+ /**
43
+ * Validates a given layer and throws an error if it is invalid.
44
+ *
45
+ * @param {string} layer - The layer name to be checked.
46
+ * @throws {Error} Throws an error if the layer is not valid.
47
+ */
48
+ export function checkLayer(layer: string): void {
49
+ if (!isValidLayer(layer)) {
50
+ throw new Error('An invalid layer is passed');
51
+ }
52
+ }
53
+
54
+ /**
55
+ * Checks if the given root control is an instance of Control or UIComponent.
56
+ *
57
+ * @param {Component} rootControl - The root control to be checked.
58
+ * @throws {Error} Throws an error if the root control is not an instance of Control or UIComponent.
59
+ */
60
+ export function checkRootControl(rootControl: Component): void {
61
+ if (!(rootControl instanceof Control) && !(rootControl instanceof UIComponent)) {
62
+ throw new Error('An invalid root control was passed');
63
+ }
64
+ }
65
+
66
+ /**
67
+ * Checks if key user adaptation is enabled for the specified component.
68
+ * Fiori tools mode is considered a developer scenario where the `flexEnabled` flag should not be evaluated.
69
+ *
70
+ * @param {Component} component - The UI5 control component to check for flex (key user adaptation) enabled status.
71
+ * @throws {Error} Throws an error if key user adaptation is explicitly disabled in the component's manifest.
72
+ */
73
+ export function checkFlexEnabled(component: Component): void {
74
+ // fiori tools is always a developer scenario where the flexEnabled flag should not be evaluated
75
+ const fioriToolsMode = new URLSearchParams(window.location.search).get('fiori-tools-rta-mode');
76
+ if (!fioriToolsMode || fioriToolsMode === 'false') {
77
+ const manifest = ((component as Component& { getManifest: () => Manifest }).getManifest() || {}) as Manifest;
78
+ const flexEnabled = manifest['sap.ui5']?.flexEnabled;
79
+
80
+ if (flexEnabled === false) {
81
+ throw new Error('This app is not enabled for key user adaptation');
82
+ }
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Checks if the current user is a key user for the given layer.
88
+ * Specifically, it checks for key user rights if the layer is the CUSTOMER layer.
89
+ * If the user is not a key user and the layer is CUSTOMER, an error is thrown.
90
+ *
91
+ * Note: The function assumes the presence of 'layers.CUSTOMER'. In case of non-CUSTOMER layers,
92
+ * it simply resolves the promise without any additional checks.
93
+ *
94
+ * @param {string} layer - The layer for which to check key user rights.
95
+ * @returns {Promise<void>} A promise that resolves if the user is a key user or the layer is not CUSTOMER.
96
+ * Rejects with an error if the user is not a key user for the CUSTOMER layer.
97
+ * @throws {Error} Throws an error with the message 'No key user rights found' if the user lacks key user rights.
98
+ */
99
+ export async function checkKeyUser(layer: string): Promise<void> {
100
+ if (layers.CUSTOMER === layer) {
101
+ const isKeyUser = await FeaturesAPI.isKeyUser();
102
+ if (!isKeyUser) {
103
+ throw new Error('No key user rights found');
104
+ }
105
+ }
106
+ }
107
+
108
+ /**
109
+ * Checks the validity of the specified layer and root control.
110
+ * It ensures that the layer is valid and the root control is an instance of Control or UIComponent.
111
+ * Additionally, it checks key user permissions for the specified layer.
112
+ *
113
+ * @param {Control} rootControl - The root control to be validated.
114
+ * @param {string} layer - The layer name to be validated.
115
+ * @returns {Promise<void>} A promise that resolves when all checks pass without errors.
116
+ * @throws {Error} Throws an error if any of the checks fail.
117
+ */
118
+ async function checkLayerAndControl(rootControl: Component, layer: string): Promise<void> {
119
+ checkLayer(layer);
120
+
121
+ checkRootControl(rootControl);
122
+
123
+ await checkKeyUser(layer);
124
+ }
125
+
126
+ /**
127
+ * Retrieves the first HTML element with the specified title attribute.
128
+ *
129
+ * @param {string} title - The title attribute value to search for in the HTML elements.
130
+ * @param {Element | null} element - The target element that will be searched.
131
+ * @returns {Element | null} The first HTML element that matches the given title attribute value, or null if no such element is found.
132
+ */
133
+ function getElementByTitle(title: string, element?: Element | null): Element | null {
134
+ const selector = `[title="${title}"]`;
135
+ return element ? element.querySelector(selector) : document.querySelector(selector);
136
+ }
137
+
138
+ /**
139
+ * Hides a UI5 Button control with the specified ID.
140
+ *
141
+ * This function attempts to find a UI5 Button control by its ID and then sets its visibility to false.
142
+ *
143
+ * @param {string | undefined} buttonId - The ID of the Button control to hide. If undefined, no action is taken.
144
+ * @returns {void}
145
+ */
146
+ function hideButtonById(buttonId: string | undefined): void {
147
+ const button = sap.ui.getCore().byId(buttonId) as Button;
148
+ button?.setVisible(false);
149
+ }
150
+
151
+ /**
152
+ * Hides specific buttons by ID from the RTA toolbar.
153
+ * This function specifically targets buttons 'Reset' and 'Publish'.
154
+ */
155
+ function removeExtraBtnsFromToolbar(): void {
156
+ const rtaToolbarEl = document.querySelector('.sapUiRtaToolbar');
157
+ const resetEl = getElementByTitle('Reset', rtaToolbarEl);
158
+ const publishEl = getElementByTitle('Publish', rtaToolbarEl);
159
+
160
+ hideButtonById(resetEl?.id);
161
+ hideButtonById(publishEl?.id);
162
+ }
163
+
164
+ /**
165
+ * Initializes custom RuntimeAuthoring for UI5 Versions < 1.72 and start UI Adaptation.
166
+ * Ensures that the passed options are valid.
167
+ *
168
+ * @param {RTAOptions} options - Options that are passed to RuntimeAuthoring upon initialization.
169
+ * @param {RTAPlugin} loadPlugins - Script that needs to be executed after rta is initialized.
170
+ * @returns {Promise<void>} A promise that resolves when all the checks have passed and RuntimeAuthoring is started.
171
+ */
172
+ export default async function (options: RTAOptions, loadPlugins: RTAPlugin): Promise<void> {
173
+ options = merge(defaultOptions, options) as RTAOptions;
174
+
175
+ const layer = options.flexSettings.layer;
176
+ const rootControl = options.rootControl;
177
+
178
+ await checkLayerAndControl(rootControl, layer);
179
+
180
+ options.rootControl = Utils.getAppComponentForControl(rootControl);
181
+
182
+ checkFlexEnabled(options.rootControl);
183
+
184
+ const rta = new RuntimeAuthoring(options);
185
+ rta.attachEvent('stop', () => rta.destroy());
186
+
187
+ if (loadPlugins) {
188
+ await loadPlugins(rta);
189
+ }
190
+
191
+ await rta.start();
192
+
193
+ removeExtraBtnsFromToolbar();
194
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/base/i18n/ResourceBundle", "sap/ui/model/resource/ResourceModel"], function (ResourceBundle, ResourceModel) {
4
+ "use strict";
5
+
6
+ const BUNDLE_CACHE = {};
7
+ const MODEL_CACHE = {};
8
+ async function getResourceBundle(key) {
9
+ const cachedBundle = BUNDLE_CACHE[key];
10
+ if (cachedBundle) {
11
+ return cachedBundle;
12
+ }
13
+ const bundle = await ResourceBundle.create({
14
+ bundleUrl: '/preview/client/messagebundle.properties',
15
+ url: '/preview/client/messagebundle.properties',
16
+ supportedLocales: [''],
17
+ locale: '',
18
+ async: true
19
+ });
20
+ BUNDLE_CACHE[key] = bundle;
21
+ return bundle;
22
+ }
23
+ async function getResourceModel(key = 'open.ux.preview.client') {
24
+ const cachedModel = MODEL_CACHE[key];
25
+ if (cachedModel) {
26
+ return cachedModel;
27
+ }
28
+ const bundle = await getResourceBundle(key);
29
+ const model = new ResourceModel({
30
+ bundle
31
+ });
32
+ MODEL_CACHE[key] = model;
33
+ return model;
34
+ }
35
+ class TextBundle {
36
+ constructor(bundle) {
37
+ this.bundle = bundle;
38
+ }
39
+ getText(key, args) {
40
+ return this.bundle.getText(key, args) ?? key;
41
+ }
42
+ }
43
+ async function getTextBundle(key = 'open.ux.preview.client') {
44
+ const bundle = await getResourceBundle(key);
45
+ return new TextBundle(bundle);
46
+ }
47
+ var __exports = {
48
+ __esModule: true
49
+ };
50
+ __exports.getResourceBundle = getResourceBundle;
51
+ __exports.getResourceModel = getResourceModel;
52
+ __exports.TextBundle = TextBundle;
53
+ __exports.getTextBundle = getTextBundle;
54
+ return __exports;
55
+ });
56
+ //# sourceMappingURL=i18n.js.map
@@ -0,0 +1,49 @@
1
+ import ResourceBundle from 'sap/base/i18n/ResourceBundle';
2
+ import ResourceModel from 'sap/ui/model/resource/ResourceModel';
3
+
4
+ const BUNDLE_CACHE: Record<string, ResourceBundle> = {};
5
+ const MODEL_CACHE: Record<string, ResourceModel> = {};
6
+
7
+ export async function getResourceBundle(key: string): Promise<ResourceBundle> {
8
+ const cachedBundle = BUNDLE_CACHE[key];
9
+
10
+ if (cachedBundle) {
11
+ return cachedBundle;
12
+ }
13
+
14
+ const bundle = await ResourceBundle.create({
15
+ bundleUrl: '/preview/client/messagebundle.properties',
16
+ url: '/preview/client/messagebundle.properties',
17
+ supportedLocales: [''],
18
+ locale: '',
19
+ async: true
20
+ });
21
+ BUNDLE_CACHE[key] = bundle;
22
+ return bundle;
23
+ }
24
+
25
+ export async function getResourceModel(key = 'open.ux.preview.client'): Promise<ResourceModel> {
26
+ const cachedModel = MODEL_CACHE[key];
27
+
28
+ if (cachedModel) {
29
+ return cachedModel;
30
+ }
31
+
32
+ const bundle = await getResourceBundle(key);
33
+ const model = new ResourceModel({ bundle });
34
+ MODEL_CACHE[key] = model;
35
+ return model;
36
+ }
37
+
38
+ export class TextBundle {
39
+ constructor(private readonly bundle: ResourceBundle) {}
40
+
41
+ getText(key: string, args?: string[]): string {
42
+ return this.bundle.getText(key, args) ?? key;
43
+ }
44
+ }
45
+
46
+ export async function getTextBundle(key = 'open.ux.preview.client'): Promise<TextBundle> {
47
+ const bundle = await getResourceBundle(key);
48
+ return new TextBundle(bundle);
49
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "sap.app": {
3
+ "id": "open.ux.preview.client"
4
+ },
5
+ "sap.ui5": {
6
+ "flexBundle": false
7
+ }
8
+ }