@openui5/sap.ui.core 1.113.0 → 1.114.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 (372) hide show
  1. package/.dtsgenrc +86 -0
  2. package/THIRDPARTY.txt +1 -1
  3. package/package.json +1 -1
  4. package/src/jquery.sap.global.js +10 -4
  5. package/src/jquery.sap.properties.js +1 -1
  6. package/src/jquery.sap.resources.js +1 -1
  7. package/src/jquery.sap.script.js +1 -1
  8. package/src/jquery.sap.storage.js +3 -3
  9. package/src/jquery.sap.trace.js +14 -14
  10. package/src/sap/base/Log.js +92 -8
  11. package/src/sap/base/assert.js +1 -1
  12. package/src/sap/base/config/MemoryConfigurationProvider.js +22 -0
  13. package/src/sap/base/config.js +54 -0
  14. package/src/sap/base/util/Deferred.js +3 -2
  15. package/src/sap/base/util/restricted/_CancelablePromise.js +1 -1
  16. package/src/sap/base/util/restricted/_castArray.js +1 -1
  17. package/src/sap/base/util/restricted/_compact.js +1 -1
  18. package/src/sap/base/util/restricted/_curry.js +1 -1
  19. package/src/sap/base/util/restricted/_debounce.js +1 -1
  20. package/src/sap/base/util/restricted/_difference.js +1 -1
  21. package/src/sap/base/util/restricted/_differenceBy.js +1 -1
  22. package/src/sap/base/util/restricted/_differenceWith.js +1 -1
  23. package/src/sap/base/util/restricted/_flatMap.js +1 -1
  24. package/src/sap/base/util/restricted/_flatMapDeep.js +1 -1
  25. package/src/sap/base/util/restricted/_flatMapDepth.js +1 -1
  26. package/src/sap/base/util/restricted/_flatten.js +1 -1
  27. package/src/sap/base/util/restricted/_flattenDeep.js +1 -1
  28. package/src/sap/base/util/restricted/_flattenDepth.js +1 -1
  29. package/src/sap/base/util/restricted/_intersection.js +1 -1
  30. package/src/sap/base/util/restricted/_intersectionBy.js +1 -1
  31. package/src/sap/base/util/restricted/_intersectionWith.js +1 -1
  32. package/src/sap/base/util/restricted/_isEqual.js +1 -1
  33. package/src/sap/base/util/restricted/_isEqualWith.js +1 -1
  34. package/src/sap/base/util/restricted/_isNil.js +1 -1
  35. package/src/sap/base/util/restricted/_max.js +1 -1
  36. package/src/sap/base/util/restricted/_merge.js +1 -1
  37. package/src/sap/base/util/restricted/_mergeWith.js +1 -1
  38. package/src/sap/base/util/restricted/_min.js +1 -1
  39. package/src/sap/base/util/restricted/_omit.js +1 -1
  40. package/src/sap/base/util/restricted/_pick.js +1 -1
  41. package/src/sap/base/util/restricted/_pickBy.js +1 -1
  42. package/src/sap/base/util/restricted/_throttle.js +1 -1
  43. package/src/sap/base/util/restricted/_toArray.js +1 -1
  44. package/src/sap/base/util/restricted/_union.js +1 -1
  45. package/src/sap/base/util/restricted/_unionBy.js +1 -1
  46. package/src/sap/base/util/restricted/_unionWith.js +1 -1
  47. package/src/sap/base/util/restricted/_uniq.js +1 -1
  48. package/src/sap/base/util/restricted/_uniqBy.js +1 -1
  49. package/src/sap/base/util/restricted/_uniqWith.js +1 -1
  50. package/src/sap/base/util/restricted/_without.js +1 -1
  51. package/src/sap/base/util/restricted/_xor.js +1 -1
  52. package/src/sap/base/util/restricted/_xorBy.js +1 -1
  53. package/src/sap/base/util/restricted/_xorWith.js +1 -1
  54. package/src/sap/base/util/restricted/_zipObject.js +1 -1
  55. package/src/sap/base/util/restricted/_zipObjectDeep.js +1 -1
  56. package/src/sap/ui/Device.js +8 -3
  57. package/src/sap/ui/Global.js +4 -4
  58. package/src/sap/ui/base/BindingParser.js +79 -18
  59. package/src/sap/ui/base/Event.js +1 -1
  60. package/src/sap/ui/base/EventProvider.js +1 -1
  61. package/src/sap/ui/base/Interface.js +1 -1
  62. package/src/sap/ui/base/ManagedObject.js +13 -12
  63. package/src/sap/ui/base/ManagedObjectMetadata.js +26 -24
  64. package/src/sap/ui/base/Metadata.js +1 -1
  65. package/src/sap/ui/base/Object.js +1 -1
  66. package/src/sap/ui/base/ObjectPool.js +1 -1
  67. package/src/sap/ui/core/.library +1 -1
  68. package/src/sap/ui/core/BusyIndicator.js +4 -4
  69. package/src/sap/ui/core/Component.js +3 -3
  70. package/src/sap/ui/core/ComponentContainer.js +1 -1
  71. package/src/sap/ui/core/ComponentMetadata.js +3 -1
  72. package/src/sap/ui/core/ComponentSupport.js +1 -1
  73. package/src/sap/ui/core/Configuration.js +47 -37
  74. package/src/sap/ui/core/Control.js +2 -2
  75. package/src/sap/ui/core/Core.js +36 -15
  76. package/src/sap/ui/core/CustomData.js +1 -1
  77. package/src/sap/ui/core/DeclarativeSupport.js +1 -1
  78. package/src/sap/ui/core/Element.js +1 -1
  79. package/src/sap/ui/core/ElementMetadata.js +17 -3
  80. package/src/sap/ui/core/EnabledPropagator.js +1 -1
  81. package/src/sap/ui/core/EventBus.js +4 -4
  82. package/src/sap/ui/core/Fragment.js +1 -1
  83. package/src/sap/ui/core/HTML.js +1 -1
  84. package/src/sap/ui/core/History.js +1 -1
  85. package/src/sap/ui/core/Icon.js +1 -1
  86. package/src/sap/ui/core/IconPool.js +17 -2
  87. package/src/sap/ui/core/IndicationColorSupport.js +1 -1
  88. package/src/sap/ui/core/IntervalTrigger.js +1 -1
  89. package/src/sap/ui/core/InvisibleMessage.js +1 -1
  90. package/src/sap/ui/core/InvisibleRenderer.js +1 -1
  91. package/src/sap/ui/core/InvisibleText.js +1 -1
  92. package/src/sap/ui/core/Item.js +1 -1
  93. package/src/sap/ui/core/LabelEnablement.js +1 -1
  94. package/src/sap/ui/core/LayoutData.js +1 -1
  95. package/src/sap/ui/core/Lib.js +27 -1
  96. package/src/sap/ui/core/ListItem.js +1 -1
  97. package/src/sap/ui/core/LocalBusyIndicator.js +1 -1
  98. package/src/sap/ui/core/Locale.js +1 -1
  99. package/src/sap/ui/core/LocaleData.js +2 -2
  100. package/src/sap/ui/core/Manifest.js +2 -2
  101. package/src/sap/ui/core/Message.js +1 -1
  102. package/src/sap/ui/core/Popup.js +15 -9
  103. package/src/sap/ui/core/RenderManager.js +2 -2
  104. package/src/sap/ui/core/Renderer.js +1 -1
  105. package/src/sap/ui/core/Rendering.js +2 -3
  106. package/src/sap/ui/core/ResizeHandler.js +2 -2
  107. package/src/sap/ui/core/ScrollBar.js +1 -1
  108. package/src/sap/ui/core/SeparatorItem.js +1 -1
  109. package/src/sap/ui/core/Title.js +1 -1
  110. package/src/sap/ui/core/TooltipBase.js +1 -1
  111. package/src/sap/ui/core/UIArea.js +9 -2
  112. package/src/sap/ui/core/UIComponent.js +14 -12
  113. package/src/sap/ui/core/UIComponentMetadata.js +1 -1
  114. package/src/sap/ui/core/ValueStateSupport.js +1 -1
  115. package/src/sap/ui/core/VariantLayoutData.js +1 -1
  116. package/src/sap/ui/core/XMLComposite.js +1 -1
  117. package/src/sap/ui/core/XMLCompositeMetadata.js +1 -1
  118. package/src/sap/ui/core/XMLTemplateProcessor.js +30 -6
  119. package/src/sap/ui/core/date/UI5Date.js +14 -8
  120. package/src/sap/ui/core/date/UniversalDate.js +15 -53
  121. package/src/sap/ui/core/delegate/ItemNavigation.js +1 -1
  122. package/src/sap/ui/core/delegate/ScrollEnablement.js +1 -1
  123. package/src/sap/ui/core/dnd/DragDropBase.js +1 -1
  124. package/src/sap/ui/core/dnd/DragDropInfo.js +1 -1
  125. package/src/sap/ui/core/dnd/DragInfo.js +1 -1
  126. package/src/sap/ui/core/dnd/DropInfo.js +1 -1
  127. package/src/sap/ui/core/format/DateFormat.js +63 -29
  128. package/src/sap/ui/core/format/TimezoneUtil.js +1 -1
  129. package/src/sap/ui/core/hyphenation/Hyphenation.js +1 -1
  130. package/src/sap/ui/core/library.js +3 -3
  131. package/src/sap/ui/core/message/ControlMessageProcessor.js +1 -1
  132. package/src/sap/ui/core/message/Message.js +1 -1
  133. package/src/sap/ui/core/message/MessageManager.js +1 -1
  134. package/src/sap/ui/core/message/MessageParser.js +1 -1
  135. package/src/sap/ui/core/message/MessageProcessor.js +1 -1
  136. package/src/sap/ui/core/messagebundle.properties +2 -0
  137. package/src/sap/ui/core/messagebundle_ar.properties +1 -0
  138. package/src/sap/ui/core/messagebundle_bg.properties +1 -0
  139. package/src/sap/ui/core/messagebundle_ca.properties +1 -0
  140. package/src/sap/ui/core/messagebundle_cs.properties +1 -0
  141. package/src/sap/ui/core/messagebundle_cy.properties +1 -0
  142. package/src/sap/ui/core/messagebundle_da.properties +1 -0
  143. package/src/sap/ui/core/messagebundle_de.properties +1 -0
  144. package/src/sap/ui/core/messagebundle_el.properties +1 -0
  145. package/src/sap/ui/core/messagebundle_en.properties +1 -0
  146. package/src/sap/ui/core/messagebundle_en_GB.properties +1 -0
  147. package/src/sap/ui/core/messagebundle_en_US_sappsd.properties +1 -0
  148. package/src/sap/ui/core/messagebundle_en_US_saprigi.properties +1 -0
  149. package/src/sap/ui/core/messagebundle_es.properties +1 -0
  150. package/src/sap/ui/core/messagebundle_es_MX.properties +1 -0
  151. package/src/sap/ui/core/messagebundle_et.properties +1 -0
  152. package/src/sap/ui/core/messagebundle_fi.properties +1 -0
  153. package/src/sap/ui/core/messagebundle_fr.properties +1 -0
  154. package/src/sap/ui/core/messagebundle_fr_CA.properties +1 -0
  155. package/src/sap/ui/core/messagebundle_hi.properties +1 -0
  156. package/src/sap/ui/core/messagebundle_hr.properties +1 -0
  157. package/src/sap/ui/core/messagebundle_hu.properties +1 -0
  158. package/src/sap/ui/core/messagebundle_id.properties +1 -0
  159. package/src/sap/ui/core/messagebundle_it.properties +1 -0
  160. package/src/sap/ui/core/messagebundle_iw.properties +1 -0
  161. package/src/sap/ui/core/messagebundle_ja.properties +1 -0
  162. package/src/sap/ui/core/messagebundle_kk.properties +1 -0
  163. package/src/sap/ui/core/messagebundle_ko.properties +2 -1
  164. package/src/sap/ui/core/messagebundle_lt.properties +1 -0
  165. package/src/sap/ui/core/messagebundle_lv.properties +1 -0
  166. package/src/sap/ui/core/messagebundle_ms.properties +2 -1
  167. package/src/sap/ui/core/messagebundle_nl.properties +1 -0
  168. package/src/sap/ui/core/messagebundle_no.properties +1 -0
  169. package/src/sap/ui/core/messagebundle_pl.properties +1 -0
  170. package/src/sap/ui/core/messagebundle_pt.properties +1 -0
  171. package/src/sap/ui/core/messagebundle_pt_PT.properties +1 -0
  172. package/src/sap/ui/core/messagebundle_ro.properties +1 -0
  173. package/src/sap/ui/core/messagebundle_ru.properties +2 -1
  174. package/src/sap/ui/core/messagebundle_sh.properties +1 -0
  175. package/src/sap/ui/core/messagebundle_sk.properties +1 -0
  176. package/src/sap/ui/core/messagebundle_sl.properties +1 -0
  177. package/src/sap/ui/core/messagebundle_sv.properties +1 -0
  178. package/src/sap/ui/core/messagebundle_th.properties +1 -0
  179. package/src/sap/ui/core/messagebundle_tr.properties +1 -0
  180. package/src/sap/ui/core/messagebundle_uk.properties +1 -0
  181. package/src/sap/ui/core/messagebundle_vi.properties +1 -0
  182. package/src/sap/ui/core/messagebundle_zh_CN.properties +1 -0
  183. package/src/sap/ui/core/messagebundle_zh_TW.properties +1 -0
  184. package/src/sap/ui/core/mvc/Controller.js +2 -3
  185. package/src/sap/ui/core/mvc/ControllerExtension.js +1 -1
  186. package/src/sap/ui/core/mvc/HTMLView.js +1 -1
  187. package/src/sap/ui/core/mvc/JSONView.js +1 -1
  188. package/src/sap/ui/core/mvc/JSView.js +1 -1
  189. package/src/sap/ui/core/mvc/TemplateView.js +1 -1
  190. package/src/sap/ui/core/mvc/View.js +22 -15
  191. package/src/sap/ui/core/mvc/XMLView.js +2 -2
  192. package/src/sap/ui/core/plugin/DeclarativeSupport.js +1 -1
  193. package/src/sap/ui/core/plugin/LessSupport.js +1 -1
  194. package/src/sap/ui/core/plugin/TemplatingSupport.js +1 -1
  195. package/src/sap/ui/core/postmessage/Bus.js +1 -1
  196. package/src/sap/ui/core/postmessage/confirmationDialog.js +1 -1
  197. package/src/sap/ui/core/routing/Route.js +30 -22
  198. package/src/sap/ui/core/routing/Router.js +5 -3
  199. package/src/sap/ui/core/routing/Target.js +169 -2
  200. package/src/sap/ui/core/routing/Targets.js +4 -213
  201. package/src/sap/ui/core/routing/Views.js +1 -1
  202. package/src/sap/ui/core/search/OpenSearchProvider.js +1 -1
  203. package/src/sap/ui/core/search/SearchProvider.js +1 -1
  204. package/src/sap/ui/core/service/Service.js +1 -1
  205. package/src/sap/ui/core/service/ServiceFactory.js +1 -1
  206. package/src/sap/ui/core/service/ServiceFactoryRegistry.js +1 -1
  207. package/src/sap/ui/core/support/Plugin.js +1 -1
  208. package/src/sap/ui/core/support/Support.js +1 -1
  209. package/src/sap/ui/core/support/controls/InteractionTree.js +5 -3
  210. package/src/sap/ui/core/support/plugins/Breakpoint.js +2 -2
  211. package/src/sap/ui/core/support/plugins/ControlTree.js +1 -1
  212. package/src/sap/ui/core/support/plugins/Interaction.js +6 -4
  213. package/src/sap/ui/core/support/plugins/LocalStorage.js +1 -1
  214. package/src/sap/ui/core/support/plugins/Performance.js +1 -1
  215. package/src/sap/ui/core/support/plugins/Selector.js +1 -1
  216. package/src/sap/ui/core/support/plugins/TechInfo.js +1 -1
  217. package/src/sap/ui/core/support/plugins/Trace.js +4 -3
  218. package/src/sap/ui/core/support/plugins/ViewInfo.js +1 -1
  219. package/src/sap/ui/core/themes/base/base.less +1133 -90
  220. package/src/sap/ui/core/themes/base/global.less +114 -8
  221. package/src/sap/ui/core/themes/sap_hcb/global.less +114 -8
  222. package/src/sap/ui/core/theming/Parameters.js +10 -2
  223. package/src/sap/ui/core/theming/ThemeManager.js +10 -9
  224. package/src/sap/ui/core/tmpl/DOMAttribute.js +1 -1
  225. package/src/sap/ui/core/tmpl/DOMElement.js +1 -1
  226. package/src/sap/ui/core/tmpl/HandlebarsTemplate.js +1 -1
  227. package/src/sap/ui/core/tmpl/Template.js +1 -1
  228. package/src/sap/ui/core/tmpl/TemplateControl.js +1 -1
  229. package/src/sap/ui/core/util/AsyncHintsHelper.js +1 -1
  230. package/src/sap/ui/core/util/Export.js +1 -1
  231. package/src/sap/ui/core/util/ExportCell.js +1 -1
  232. package/src/sap/ui/core/util/ExportColumn.js +1 -1
  233. package/src/sap/ui/core/util/ExportRow.js +1 -1
  234. package/src/sap/ui/core/util/ExportType.js +1 -1
  235. package/src/sap/ui/core/util/ExportTypeCSV.js +1 -1
  236. package/src/sap/ui/core/util/File.js +1 -1
  237. package/src/sap/ui/core/util/LibraryInfo.js +1 -1
  238. package/src/sap/ui/core/util/MockServer.js +1 -1
  239. package/src/sap/ui/core/util/PasteHelper.js +1 -1
  240. package/src/sap/ui/core/util/serializer/HTMLViewSerializer.js +1 -1
  241. package/src/sap/ui/core/util/serializer/Serializer.js +1 -1
  242. package/src/sap/ui/core/util/serializer/ViewSerializer.js +1 -1
  243. package/src/sap/ui/core/util/serializer/XMLViewSerializer.js +1 -1
  244. package/src/sap/ui/core/util/serializer/delegate/Delegate.js +1 -1
  245. package/src/sap/ui/core/util/serializer/delegate/HTML.js +1 -1
  246. package/src/sap/ui/core/util/serializer/delegate/XML.js +1 -1
  247. package/src/sap/ui/core/ws/ReadyState.js +1 -1
  248. package/src/sap/ui/core/ws/SapPcpWebSocket.js +1 -1
  249. package/src/sap/ui/core/ws/WebSocket.js +1 -1
  250. package/src/sap/ui/debug/ControlTree.js +1 -1
  251. package/src/sap/ui/debug/DebugEnv.js +1 -1
  252. package/src/sap/ui/debug/PropertyList.js +1 -1
  253. package/src/sap/ui/dom/includeScript.js +3 -3
  254. package/src/sap/ui/dom/includeStylesheet.js +3 -3
  255. package/src/sap/ui/events/ControlEvents.js +2 -2
  256. package/src/sap/ui/events/PseudoEvents.js +4 -2
  257. package/src/sap/ui/model/ClientModel.js +1 -1
  258. package/src/sap/ui/model/CompositeDataState.js +1 -1
  259. package/src/sap/ui/model/CompositeType.js +1 -1
  260. package/src/sap/ui/model/DataState.js +1 -1
  261. package/src/sap/ui/model/ManagedObjectBindingSupport.js +19 -2
  262. package/src/sap/ui/model/MetaModel.js +1 -1
  263. package/src/sap/ui/model/Model.js +1 -1
  264. package/src/sap/ui/model/SelectionModel.js +1 -1
  265. package/src/sap/ui/model/SimpleType.js +1 -1
  266. package/src/sap/ui/model/TreeAutoExpandMode.js +1 -1
  267. package/src/sap/ui/model/Type.js +1 -1
  268. package/src/sap/ui/model/base/ManagedObjectModel.js +12 -4
  269. package/src/sap/ui/model/controlhelper/TreeBindingProxy.js +2 -0
  270. package/src/sap/ui/model/json/JSONModel.js +1 -1
  271. package/src/sap/ui/model/message/MessageModel.js +1 -1
  272. package/src/sap/ui/model/odata/ODataAnnotations.js +1 -1
  273. package/src/sap/ui/model/odata/ODataMessageParser.js +1 -1
  274. package/src/sap/ui/model/odata/ODataMetaModel.js +1 -1
  275. package/src/sap/ui/model/odata/ODataMetadata.js +1 -1
  276. package/src/sap/ui/model/odata/ODataModel.js +1 -1
  277. package/src/sap/ui/model/odata/type/Boolean.js +1 -1
  278. package/src/sap/ui/model/odata/type/Byte.js +1 -1
  279. package/src/sap/ui/model/odata/type/Currency.js +1 -1
  280. package/src/sap/ui/model/odata/type/Date.js +49 -21
  281. package/src/sap/ui/model/odata/type/DateTime.js +51 -8
  282. package/src/sap/ui/model/odata/type/DateTimeBase.js +20 -26
  283. package/src/sap/ui/model/odata/type/DateTimeOffset.js +42 -1
  284. package/src/sap/ui/model/odata/type/DateTimeWithTimezone.js +34 -21
  285. package/src/sap/ui/model/odata/type/Decimal.js +28 -33
  286. package/src/sap/ui/model/odata/type/Double.js +21 -26
  287. package/src/sap/ui/model/odata/type/Guid.js +1 -1
  288. package/src/sap/ui/model/odata/type/Int.js +15 -20
  289. package/src/sap/ui/model/odata/type/Int16.js +1 -1
  290. package/src/sap/ui/model/odata/type/Int32.js +1 -1
  291. package/src/sap/ui/model/odata/type/Int64.js +16 -21
  292. package/src/sap/ui/model/odata/type/ODataType.js +33 -6
  293. package/src/sap/ui/model/odata/type/Raw.js +1 -1
  294. package/src/sap/ui/model/odata/type/SByte.js +1 -1
  295. package/src/sap/ui/model/odata/type/Single.js +20 -25
  296. package/src/sap/ui/model/odata/type/Stream.js +1 -1
  297. package/src/sap/ui/model/odata/type/String.js +1 -1
  298. package/src/sap/ui/model/odata/type/Time.js +60 -21
  299. package/src/sap/ui/model/odata/type/TimeOfDay.js +52 -24
  300. package/src/sap/ui/model/odata/type/Unit.js +1 -1
  301. package/src/sap/ui/model/odata/v2/Context.js +1 -1
  302. package/src/sap/ui/model/odata/v2/ODataAnnotations.js +1 -1
  303. package/src/sap/ui/model/odata/v2/ODataModel.js +65 -21
  304. package/src/sap/ui/model/odata/v2/ODataTreeBinding.js +1 -1
  305. package/src/sap/ui/model/odata/v4/Context.js +4 -2
  306. package/src/sap/ui/model/odata/v4/ODataContextBinding.js +7 -25
  307. package/src/sap/ui/model/odata/v4/ODataListBinding.js +48 -16
  308. package/src/sap/ui/model/odata/v4/ODataMetaModel.js +1 -1
  309. package/src/sap/ui/model/odata/v4/ODataModel.js +1 -1
  310. package/src/sap/ui/model/odata/v4/ODataParentBinding.js +7 -3
  311. package/src/sap/ui/model/odata/v4/ODataPropertyBinding.js +1 -1
  312. package/src/sap/ui/model/odata/v4/lib/_AggregationCache.js +13 -3
  313. package/src/sap/ui/model/odata/v4/lib/_Helper.js +18 -0
  314. package/src/sap/ui/model/odata/v4/lib/_Requestor.js +6 -0
  315. package/src/sap/ui/model/resource/ResourceModel.js +1 -1
  316. package/src/sap/ui/model/type/Boolean.js +1 -1
  317. package/src/sap/ui/model/type/Currency.js +1 -1
  318. package/src/sap/ui/model/type/Date.js +15 -1
  319. package/src/sap/ui/model/type/DateInterval.js +15 -1
  320. package/src/sap/ui/model/type/DateTime.js +1 -1
  321. package/src/sap/ui/model/type/DateTimeInterval.js +1 -1
  322. package/src/sap/ui/model/type/FileSize.js +1 -1
  323. package/src/sap/ui/model/type/Float.js +1 -1
  324. package/src/sap/ui/model/type/Integer.js +1 -1
  325. package/src/sap/ui/model/type/String.js +1 -1
  326. package/src/sap/ui/model/type/Time.js +1 -1
  327. package/src/sap/ui/model/type/TimeInterval.js +1 -1
  328. package/src/sap/ui/model/type/Unit.js +1 -1
  329. package/src/sap/ui/model/xml/XMLModel.js +1 -1
  330. package/src/sap/ui/performance/Measurement.js +9 -9
  331. package/src/sap/ui/performance/trace/Interaction.js +50 -4
  332. package/src/sap/ui/performance/trace/initTraces.js +20 -14
  333. package/src/sap/ui/qunit/utils/ControlIterator.js +1 -1
  334. package/src/sap/ui/qunit/utils/MemoryLeakCheck.js +1 -1
  335. package/src/sap/ui/test/OpaPlugin.js +19 -25
  336. package/src/sap/ui/test/PageObjectFactory.js +17 -7
  337. package/src/sap/ui/test/_ParameterValidator.js +3 -3
  338. package/src/sap/ui/test/_UsageReport.js +3 -3
  339. package/src/sap/ui/test/_ValidationParameters.js +8 -10
  340. package/src/sap/ui/test/actions/Action.js +3 -3
  341. package/src/sap/ui/test/actions/Press.js +4 -4
  342. package/src/sap/ui/test/autowaiter/WaiterBase.js +5 -3
  343. package/src/sap/ui/test/autowaiter/_autoWaiter.js +6 -3
  344. package/src/sap/ui/test/autowaiter/_cssAnimationWaiter.js +3 -3
  345. package/src/sap/ui/test/autowaiter/_cssTransitionWaiter.js +3 -3
  346. package/src/sap/ui/test/autowaiter/_fetchWaiter.js +73 -0
  347. package/src/sap/ui/test/autowaiter/_moduleWaiter.js +2 -2
  348. package/src/sap/ui/test/autowaiter/_promiseWaiter.js +4 -4
  349. package/src/sap/ui/test/autowaiter/_resourceWaiter.js +2 -2
  350. package/src/sap/ui/test/autowaiter/_timeoutWaiter.js +4 -4
  351. package/src/sap/ui/test/generic/TestBase.js +1 -1
  352. package/src/sap/ui/test/gherkin/GherkinTestGenerator.js +424 -423
  353. package/src/sap/ui/test/gherkin/StepDefinitions.js +160 -158
  354. package/src/sap/ui/test/gherkin/dataTableUtils.js +387 -385
  355. package/src/sap/ui/test/gherkin/opa5TestHarness.js +188 -189
  356. package/src/sap/ui/test/gherkin/qUnitTestHarness.js +74 -71
  357. package/src/sap/ui/test/gherkin/simpleGherkinParser.js +195 -193
  358. package/src/sap/ui/test/launchers/componentLauncher.js +11 -9
  359. package/src/sap/ui/test/launchers/iFrameLauncher.js +34 -20
  360. package/src/sap/ui/test/matchers/Descendant.js +1 -1
  361. package/src/sap/ui/test/matchers/Interactable.js +2 -2
  362. package/src/sap/ui/test/matchers/LabelFor.js +2 -2
  363. package/src/sap/ui/test/matchers/MatcherFactory.js +10 -9
  364. package/src/sap/ui/test/matchers/Properties.js +5 -4
  365. package/src/sap/ui/test/matchers/Sibling.js +1 -1
  366. package/src/sap/ui/test/matchers/matchers.js +35 -3
  367. package/src/sap/ui/test/qunitPause.js +3 -2
  368. package/src/sap/ui/test/starter/_utils.js +3 -3
  369. package/src/sap/ui/util/Mobile.js +8 -1
  370. package/src/sap/ui/util/Storage.js +1 -1
  371. package/src/ui5loader-autoconfig.js +661 -51
  372. package/src/ui5loader.js +18 -5
@@ -6,389 +6,391 @@
6
6
 
7
7
  /* eslint-disable no-loop-func */
8
8
 
9
- sap.ui.define(["sap/ui/thirdparty/jquery"], function(jQueryDOM) {
10
- "use strict";
11
-
12
- /**
13
- * For example: " Sold-to (Party) " -> "Sold to Party"
14
- *
15
- * @param {string} sString - the string to normalize
16
- * @param {string} [sSpaceReplacement=" "] - string to fill the space between words. By default, just limits the
17
- * return value to a single space between each word.
18
- * @returns {string} the normalized input string
19
- * @private
20
- * @function
21
- * @static
22
- */
23
- function normalize(sString, sSpaceReplacement) {
24
- sSpaceReplacement = sSpaceReplacement || " ";
25
- return sString
26
- .replace(/[\-_]/g, " ") // replaces all dashes or underscores with spaces
27
- .trim()
28
- .replace(/(?!\s)\W/g, "") // removes all non alphanumeric characters (except for spaces)
29
- .replace(/\s+/g, sSpaceReplacement); // replaces any space between words with the input sSpaceReplacement
30
- }
31
-
32
- /**
33
- * Provides utility functions for formatting 2D arrays of strings (such as the raw data loaded from a Gherkin
34
- * feature file) into a more useful format such as an array of objects or a single object. Also handles normalization
35
- * of the raw strings.
36
- *
37
- * @author Rodrigo Jordao
38
- * @author Jonathan Benn
39
- * @alias sap.ui.test.gherkin.dataTableUtils
40
- * @since 1.40
41
- * @namespace
42
- * @static
43
- * @public
44
- */
45
- var dataTableUtils = {
46
-
47
- /**
48
- * A simple object containing a series of normalization functions that change a string according to a
49
- * particular strategy. All strategies do the following normalization as a minimum:
50
- *
51
- * <ul>
52
- * <li>Trim spaces off the string on both sides. For example: <code>" hello "</code> becomes
53
- * <code>"hello"</code>.</li>
54
- * <li>Assume that dashes and underscores are analogs for a space. For example: <code>"sold-to party"</code> and
55
- * <code>"sold to party"</code> are equivalent, and would both convert to the camelCase
56
- * <code>"soldToParty"</code>.</li>
57
- * <li>Trim multiple spaces between words. For example: <code>"hello____world"</code> becomes
58
- * <code>"hello world"</code>.</li>
59
- * <li>Remove any characters that are not alphanumeric or whitespace. For example: <code>"(hello)"</code> becomes
60
- * <code>"hello"</code>.</li>
61
- * </ul>
62
- *
63
- * @alias sap.ui.test.gherkin.dataTableUtils.normalization
64
- * @namespace
65
- * @static
66
- * @public
67
- */
68
- normalization: {
69
-
70
- /**
71
- * For example: "first name" -> "First Name"
72
- *
73
- * @param {string} sString - the string to normalize
74
- * @returns {string} the normalized input string with all words capitalized
75
- * @public
76
- * @function
77
- * @static
78
- */
79
- titleCase : function(sString) {
80
- dataTableUtils._testNormalizationInput(sString, "titleCase");
81
- return normalize(sString)
82
- .replace(/\w*/g, function(s){return s.charAt(0).toUpperCase() + s.substr(1).toLowerCase();});
83
- },
84
-
85
- /**
86
- * For example: "first name" -> "FirstName"
87
- *
88
- * @param {string} sString - the string to normalize
89
- * @returns {string} the normalized input string with all words capitalized and all spaces removed
90
- * @public
91
- * @function
92
- * @static
93
- */
94
- pascalCase : function(sString) {
95
- dataTableUtils._testNormalizationInput(sString, "pascalCase");
96
- return dataTableUtils.normalization.titleCase(sString).split(/\s/).join("");
97
- },
98
-
99
- /**
100
- * For example: "First Name" -> "firstName"
101
- *
102
- * @param {string} sString - the string to normalize
103
- * @returns {string} the normalized input string with all words after the first capitalized and all spaces
104
- * removed
105
- * @public
106
- * @function
107
- * @static
108
- */
109
- camelCase : function(sString) {
110
- dataTableUtils._testNormalizationInput(sString, "camelCase");
111
- return dataTableUtils.normalization.pascalCase(sString).replace(/^(\w)/, function(s){return s.toLowerCase();});
112
- },
113
-
114
- /**
115
- * For example: "First Name" -> "first-name"
116
- *
117
- * @param {string} sString - the string to normalize
118
- * @returns {string} the normalized input string changed to lower case and with space between words
119
- * replaced by a hyphen ("-")
120
- * @public
121
- * @function
122
- * @static
123
- */
124
- hyphenated : function(sString) {
125
- dataTableUtils._testNormalizationInput(sString, "hyphenated");
126
- return normalize(sString, "-").toLowerCase();
127
- },
128
-
129
- /**
130
- * For example: "First Name" -> "First Name"
131
- *
132
- * @param {string} sString - the string to normalize
133
- * @returns {string} the original unchanged input string
134
- * @public
135
- * @function
136
- * @static
137
- */
138
- none : function(sString) {
139
- dataTableUtils._testNormalizationInput(sString, "none");
140
- return sString;
141
- }
142
- },
143
-
144
- /**
145
- * Takes the inputed 2D array "aData" and returns an equivalent array of objects. The data is expected to
146
- * have a header row, with each subsequent row being an entity, and each column being a property of that
147
- * entity. E.g.
148
- * <pre>
149
- * [
150
- * ["Their Name", "Their Age"],
151
- * ["Alice", "16"],
152
- * ["Bob", "22"]
153
- * ]
154
- * </pre>
155
- *
156
- * The data's column headers become the returned objects' property names. The property names get normalized
157
- * according to the strategy defined by the parameter "vNorm". E.g. using hyphenation strategy this is returned:
158
- * <pre>
159
- * [
160
- * {their-name: "Alice", their-age: "16"},
161
- * {their-name: "Bob", their-age: "22"}
162
- * ]
163
- * </pre>
164
- *
165
- * @param {string[]} aData - the 2D array of strings to be converted, with a header row
166
- * @param {(string|function)} [vNorm="none"] - the normalization function to use to normalize property
167
- * names. Can also be a String with values "titleCase", "pascalCase",
168
- * "camelCase", "hyphenated" or "none".
169
- * @returns {object[]} - an array of objects equivalent to the input data, with property names normalized
170
- * @throws {Error} if the inputed array aData contains duplicate values in the header row
171
- * @public
172
- * @function
173
- * @static
174
- */
175
- toTable : function(aData, vNorm) {
176
-
177
- this._testArrayInput(aData, "toTable");
178
- var fnNorm = this._getNormalizationFunction(vNorm, "toTable");
179
-
180
- // first row are the object's keys (table column headers)
181
- var aKeys = aData[0].map(fnNorm);
182
-
183
- // transform the remaining rows
184
- return aData.slice(1).map(function(aRow) {
185
- var oGenerated = {};
186
-
187
- // for each key
188
- for (var i = 0; i < aKeys.length; ++i) {
189
- var sCurrentKey = aKeys[i];
190
-
191
- // if this is the first time the key is being used
192
- if (oGenerated.hasOwnProperty(sCurrentKey) === false) {
193
- // then add the new key and its associated value to the generated object
194
- oGenerated[sCurrentKey] = aRow[i];
195
-
196
- // else if this is a repeat use of the key
197
- } else {
198
- throw new Error("dataTableUtils.toTable: data table contains duplicate header: | " + sCurrentKey + " |");
199
- }
200
- }
201
- return oGenerated;
202
- });
203
- },
204
-
205
- /**
206
- * Takes the inputed 2D array "aData" and returns an equivalent object. Each row of data is expected to
207
- * be a property-value pair. To create nested objects, add extra columns to the data. E.g.
208
- * <pre>
209
- * [
210
- * ["Name", "Alice"],
211
- * ["Mass", "135 lbs"],
212
- * ["Telephone Number", "Home", "123-456-7890"],
213
- * ["Telephone Number", "Work", "123-456-0987"]
214
- * ]
215
- * </pre>
216
- * For each data row, the right-most element becomes a property value, and everything else is a property
217
- * name. The property names get normalized according to the strategy defined by the parameter "vNorm".
218
- * E.g. using camelCase strategy
219
- * <pre>
220
- * {
221
- * name: "Alice",
222
- * mass: "135 lbs",
223
- * telephoneNumber: {
224
- * home: "123-456-7890",
225
- * work: "123-456-0987"
226
- * }
227
- * }
228
- * </pre>
229
- * @param {string[]} aData - the 2D array of strings to be converted
230
- * @param {(string|function)} [vNorm="none"] - the normalization function to use to normalize property
231
- * names. Can also be a string with values "titleCase", "pascalCase",
232
- * "camelCase", "hyphenated" or "none".
233
- * @returns {object} - an object equivalent to the input data, with property names normalized
234
- * @throws {Error} if the inputed array aData contains duplicate keys such that a row would be overwritten
235
- * @public
236
- * @function
237
- * @static
238
- */
239
- toObject : function(aData, vNorm) {
240
-
241
- this._testArrayInput(aData, "toObject");
242
- var fnNorm = this._getNormalizationFunction(vNorm, "toObject");
243
- this._detectDuplicateKeys(aData, fnNorm);
244
- var oResult = {};
245
-
246
- // for each row in the inputed data
247
- aData.forEach(function(aRow) {
248
-
249
- var sKey = fnNorm(aRow[0]);
250
- var vValue = aRow.slice(1); // vValue starts as an array and becomes a string or object
251
-
252
- // if the value is an array with a single string
253
- if (vValue.length === 1) {
254
- // then transform vValue into a string
255
- vValue = vValue[0];
256
-
257
- // else if the value array contains multiple strings
258
- } else {
259
- // then transform vValue into an object (might be a nested object)
260
-
261
- // this function transforms the array into a nested object, e.g. ["A", "B", "C"] => {A: {B: "C"}}
262
- vValue = vValue.reduceRight(function(i,j) {var o = {}; o[fnNorm(j)] = i; return o;});
263
- }
264
-
265
- // if this is a new key
266
- if (!oResult.hasOwnProperty(sKey)) {
267
- // then just add the new string/object directly
268
- oResult[sKey] = vValue;
269
-
270
- // else if we are adding an object for a key that already contains an object
271
- } else {
272
- // then merge the new object with the existing one
273
- jQueryDOM.extend(oResult[sKey], vValue);
274
- }
275
-
276
- });
277
-
278
- return oResult;
279
- },
280
-
281
- /**
282
- * Detects errors in aData due to duplicate keys, and throws an Error if an issue was found
283
- *
284
- * @param {string[]} aData - a 2D array of strings
285
- * @param {function} fnNorm - the normalization function to use to normalize keys
286
- * @throws {Error} if the inputed array aData contains duplicate keys such that a row would be overwritten
287
- * @private
288
- */
289
- _detectDuplicateKeys: function(aData, fnNorm) {
290
-
291
- var oRowSet = {}; // used to help us identify duplicate keys
292
-
293
- // for each row in the inputed data
294
- aData.forEach(function(aRow) {
295
- var aKeys = aRow.slice(0, (aRow.length - 1)).map(fnNorm);
296
-
297
- // for each hierarchical level of the keys
298
- // e.g. when aKeys = ['A', 'B', 'C'], then sKeys will have the values 'A-B-C', 'A-B' and 'A', in that order
299
- for (var i = aKeys.length; i > 0; --i) {
300
- var sKeys = aKeys.slice(0, i).join('-');
301
-
302
- // if this set of keys is unique so far
303
- if (!oRowSet[sKeys]) {
304
- // then take note of it for next time
305
- oRowSet[sKeys] = aRow;
306
-
307
- // else if this set of keys is NOT unique
308
- } else {
309
-
310
- var aOldRow = oRowSet[sKeys];
311
- var aOldKeys = aOldRow.slice(0, (aOldRow.length - 1)).map(fnNorm);
312
-
313
- // if the new row would overwrite the old one
314
- if ( (aOldRow.length !== aRow.length) ||
315
- (aOldKeys.every(function(str, index) {return aKeys[index] === str;})) ) {
316
-
317
- var sOutput = "| " + aOldRow.join(" | ") + " |";
318
- throw new Error("dataTableUtils.toObject: data table row is being overwritten: " + sOutput);
319
- }
320
- }
321
- }
322
- });
323
- },
324
-
325
- /**
326
- * Finds the normalization function equivalent to input parameter "vFun"
327
- *
328
- * @param {(string|function)} [vFun="none"] - a normalization function. Can also be a string with values
329
- * "titleCase", "pascalCase", "camelCase", "hyphenated" or "none".
330
- * @param {string} sFunc - the name of the calling function, for error reporting
331
- * @returns {function} the normalization function equivalent to the inputed value, or <none> if the input was
332
- * undefined.
333
- * @throws {Error} if the input string is invalid
334
- * @private
335
- */
336
- _getNormalizationFunction: function(vFun, sFunc) {
337
-
338
- var sErrorMessage = "dataTableUtils." + sFunc + ": parameter 'vNorm' must be either a Function or a String with the value 'titleCase', 'pascalCase', 'camelCase', 'hyphenated' or 'none'";
339
-
340
- if (typeof vFun === "string" || vFun instanceof String) {
341
- var fnNormalize = this.normalization[vFun];
342
- if (fnNormalize === undefined) {
343
- throw new Error(sErrorMessage);
344
- }
345
- return fnNormalize;
346
- } else if (typeof vFun === "function") {
347
- return vFun;
348
- } else if (vFun === undefined || vFun === null) {
349
- return this.normalization.none;
350
- } else {
351
- throw new Error(sErrorMessage);
352
- }
353
- },
354
-
355
- /**
356
- * Tests a normalization function's input parameter to make sure it's valid
357
- *
358
- * @param {string} sString - the parameter to test
359
- * @param {string} sNormalizationFunction - the normalization function whose input we're testing
360
- * @throws {Error} if the input string is invalid
361
- * @private
362
- */
363
- _testNormalizationInput: function(sString, sNormalizationFunction) {
364
- if (typeof sString !== "string" && !(sString instanceof String)) {
365
- throw new Error("dataTableUtils.normalization." + sNormalizationFunction + ": parameter 'sString' must be a valid string");
366
- }
367
- },
368
-
369
- /**
370
- * Tests a conversion function's input parameter to make sure it's valid
371
- *
372
- * @param {array} aArray - the parameter to test
373
- * @param {string} sFunc - the conversion function whose input we're testing (e.g. "toObject" or "toTable")
374
- * @throws {Error} if the input parameter is invalid
375
- * @private
376
- */
377
- _testArrayInput: function(aArray, sFunc) {
378
-
379
- var sErrorMessage = "dataTableUtils." + sFunc + ": parameter 'aData' must be an Array of Array of Strings";
380
-
381
- if (!Array.isArray(aArray)) {
382
- throw new Error(sErrorMessage);
383
- }
384
-
385
- if (!aArray.every(function(a) {
386
- return Array.isArray(a) && (a.every(function(s){return (typeof s === "string" || s instanceof String);}));
387
- })) {
388
- throw new Error(sErrorMessage);
389
- }
390
- }
391
- };
392
-
393
- return dataTableUtils;
9
+ sap.ui.define([
10
+ "sap/base/util/extend"
11
+ ], function(extend) {
12
+ "use strict";
13
+
14
+ /**
15
+ * For example: " Sold-to (Party) " -> "Sold to Party"
16
+ *
17
+ * @param {string} sString - the string to normalize
18
+ * @param {string} [sSpaceReplacement=" "] - string to fill the space between words. By default, just limits the
19
+ * return value to a single space between each word.
20
+ * @returns {string} the normalized input string
21
+ * @private
22
+ * @function
23
+ * @static
24
+ */
25
+ function normalize(sString, sSpaceReplacement) {
26
+ sSpaceReplacement = sSpaceReplacement || " ";
27
+ return sString
28
+ .replace(/[\-_]/g, " ") // replaces all dashes or underscores with spaces
29
+ .trim()
30
+ .replace(/(?!\s)\W/g, "") // removes all non alphanumeric characters (except for spaces)
31
+ .replace(/\s+/g, sSpaceReplacement); // replaces any space between words with the input sSpaceReplacement
32
+ }
33
+
34
+ /**
35
+ * Provides utility functions for formatting 2D arrays of strings (such as the raw data loaded from a Gherkin
36
+ * feature file) into a more useful format such as an array of objects or a single object. Also handles normalization
37
+ * of the raw strings.
38
+ *
39
+ * @author Rodrigo Jordao
40
+ * @author Jonathan Benn
41
+ * @alias sap.ui.test.gherkin.dataTableUtils
42
+ * @since 1.40
43
+ * @namespace
44
+ * @static
45
+ * @public
46
+ */
47
+ var dataTableUtils = {
48
+
49
+ /**
50
+ * A simple object containing a series of normalization functions that change a string according to a
51
+ * particular strategy. All strategies do the following normalization as a minimum:
52
+ *
53
+ * <ul>
54
+ * <li>Trim spaces off the string on both sides. For example: <code>" hello "</code> becomes
55
+ * <code>"hello"</code>.</li>
56
+ * <li>Assume that dashes and underscores are analogs for a space. For example: <code>"sold-to party"</code> and
57
+ * <code>"sold to party"</code> are equivalent, and would both convert to the camelCase
58
+ * <code>"soldToParty"</code>.</li>
59
+ * <li>Trim multiple spaces between words. For example: <code>"hello____world"</code> becomes
60
+ * <code>"hello world"</code>.</li>
61
+ * <li>Remove any characters that are not alphanumeric or whitespace. For example: <code>"(hello)"</code> becomes
62
+ * <code>"hello"</code>.</li>
63
+ * </ul>
64
+ *
65
+ * @alias sap.ui.test.gherkin.dataTableUtils.normalization
66
+ * @namespace
67
+ * @static
68
+ * @public
69
+ */
70
+ normalization: {
71
+
72
+ /**
73
+ * For example: "first name" -> "First Name"
74
+ *
75
+ * @param {string} sString - the string to normalize
76
+ * @returns {string} the normalized input string with all words capitalized
77
+ * @public
78
+ * @function
79
+ * @static
80
+ */
81
+ titleCase : function(sString) {
82
+ dataTableUtils._testNormalizationInput(sString, "titleCase");
83
+ return normalize(sString)
84
+ .replace(/\w*/g, function(s){return s.charAt(0).toUpperCase() + s.substr(1).toLowerCase();});
85
+ },
86
+
87
+ /**
88
+ * For example: "first name" -> "FirstName"
89
+ *
90
+ * @param {string} sString - the string to normalize
91
+ * @returns {string} the normalized input string with all words capitalized and all spaces removed
92
+ * @public
93
+ * @function
94
+ * @static
95
+ */
96
+ pascalCase : function(sString) {
97
+ dataTableUtils._testNormalizationInput(sString, "pascalCase");
98
+ return dataTableUtils.normalization.titleCase(sString).split(/\s/).join("");
99
+ },
100
+
101
+ /**
102
+ * For example: "First Name" -> "firstName"
103
+ *
104
+ * @param {string} sString - the string to normalize
105
+ * @returns {string} the normalized input string with all words after the first capitalized and all spaces
106
+ * removed
107
+ * @public
108
+ * @function
109
+ * @static
110
+ */
111
+ camelCase : function(sString) {
112
+ dataTableUtils._testNormalizationInput(sString, "camelCase");
113
+ return dataTableUtils.normalization.pascalCase(sString).replace(/^(\w)/, function(s){return s.toLowerCase();});
114
+ },
115
+
116
+ /**
117
+ * For example: "First Name" -> "first-name"
118
+ *
119
+ * @param {string} sString - the string to normalize
120
+ * @returns {string} the normalized input string changed to lower case and with space between words
121
+ * replaced by a hyphen ("-")
122
+ * @public
123
+ * @function
124
+ * @static
125
+ */
126
+ hyphenated : function(sString) {
127
+ dataTableUtils._testNormalizationInput(sString, "hyphenated");
128
+ return normalize(sString, "-").toLowerCase();
129
+ },
130
+
131
+ /**
132
+ * For example: "First Name" -> "First Name"
133
+ *
134
+ * @param {string} sString - the string to normalize
135
+ * @returns {string} the original unchanged input string
136
+ * @public
137
+ * @function
138
+ * @static
139
+ */
140
+ none : function(sString) {
141
+ dataTableUtils._testNormalizationInput(sString, "none");
142
+ return sString;
143
+ }
144
+ },
145
+
146
+ /**
147
+ * Takes the inputed 2D array "aData" and returns an equivalent array of objects. The data is expected to
148
+ * have a header row, with each subsequent row being an entity, and each column being a property of that
149
+ * entity. E.g.
150
+ * <pre>
151
+ * [
152
+ * ["Their Name", "Their Age"],
153
+ * ["Alice", "16"],
154
+ * ["Bob", "22"]
155
+ * ]
156
+ * </pre>
157
+ *
158
+ * The data's column headers become the returned objects' property names. The property names get normalized
159
+ * according to the strategy defined by the parameter "vNorm". E.g. using hyphenation strategy this is returned:
160
+ * <pre>
161
+ * [
162
+ * {their-name: "Alice", their-age: "16"},
163
+ * {their-name: "Bob", their-age: "22"}
164
+ * ]
165
+ * </pre>
166
+ *
167
+ * @param {string[]} aData - the 2D array of strings to be converted, with a header row
168
+ * @param {(string|function)} [vNorm="none"] - the normalization function to use to normalize property
169
+ * names. Can also be a String with values "titleCase", "pascalCase",
170
+ * "camelCase", "hyphenated" or "none".
171
+ * @returns {object[]} - an array of objects equivalent to the input data, with property names normalized
172
+ * @throws {Error} if the inputed array aData contains duplicate values in the header row
173
+ * @public
174
+ * @function
175
+ * @static
176
+ */
177
+ toTable : function(aData, vNorm) {
178
+
179
+ this._testArrayInput(aData, "toTable");
180
+ var fnNorm = this._getNormalizationFunction(vNorm, "toTable");
181
+
182
+ // first row are the object's keys (table column headers)
183
+ var aKeys = aData[0].map(fnNorm);
184
+
185
+ // transform the remaining rows
186
+ return aData.slice(1).map(function(aRow) {
187
+ var oGenerated = {};
188
+
189
+ // for each key
190
+ for (var i = 0; i < aKeys.length; ++i) {
191
+ var sCurrentKey = aKeys[i];
192
+
193
+ // if this is the first time the key is being used
194
+ if (oGenerated.hasOwnProperty(sCurrentKey) === false) {
195
+ // then add the new key and its associated value to the generated object
196
+ oGenerated[sCurrentKey] = aRow[i];
197
+
198
+ // else if this is a repeat use of the key
199
+ } else {
200
+ throw new Error("dataTableUtils.toTable: data table contains duplicate header: | " + sCurrentKey + " |");
201
+ }
202
+ }
203
+ return oGenerated;
204
+ });
205
+ },
206
+
207
+ /**
208
+ * Takes the inputed 2D array "aData" and returns an equivalent object. Each row of data is expected to
209
+ * be a property-value pair. To create nested objects, add extra columns to the data. E.g.
210
+ * <pre>
211
+ * [
212
+ * ["Name", "Alice"],
213
+ * ["Mass", "135 lbs"],
214
+ * ["Telephone Number", "Home", "123-456-7890"],
215
+ * ["Telephone Number", "Work", "123-456-0987"]
216
+ * ]
217
+ * </pre>
218
+ * For each data row, the right-most element becomes a property value, and everything else is a property
219
+ * name. The property names get normalized according to the strategy defined by the parameter "vNorm".
220
+ * E.g. using camelCase strategy
221
+ * <pre>
222
+ * {
223
+ * name: "Alice",
224
+ * mass: "135 lbs",
225
+ * telephoneNumber: {
226
+ * home: "123-456-7890",
227
+ * work: "123-456-0987"
228
+ * }
229
+ * }
230
+ * </pre>
231
+ * @param {string[]} aData - the 2D array of strings to be converted
232
+ * @param {(string|function)} [vNorm="none"] - the normalization function to use to normalize property
233
+ * names. Can also be a string with values "titleCase", "pascalCase",
234
+ * "camelCase", "hyphenated" or "none".
235
+ * @returns {object} - an object equivalent to the input data, with property names normalized
236
+ * @throws {Error} if the inputed array aData contains duplicate keys such that a row would be overwritten
237
+ * @public
238
+ * @function
239
+ * @static
240
+ */
241
+ toObject : function(aData, vNorm) {
242
+
243
+ this._testArrayInput(aData, "toObject");
244
+ var fnNorm = this._getNormalizationFunction(vNorm, "toObject");
245
+ this._detectDuplicateKeys(aData, fnNorm);
246
+ var oResult = {};
247
+
248
+ // for each row in the inputed data
249
+ aData.forEach(function(aRow) {
250
+
251
+ var sKey = fnNorm(aRow[0]);
252
+ var vValue = aRow.slice(1); // vValue starts as an array and becomes a string or object
253
+
254
+ // if the value is an array with a single string
255
+ if (vValue.length === 1) {
256
+ // then transform vValue into a string
257
+ vValue = vValue[0];
258
+
259
+ // else if the value array contains multiple strings
260
+ } else {
261
+ // then transform vValue into an object (might be a nested object)
262
+
263
+ // this function transforms the array into a nested object, e.g. ["A", "B", "C"] => {A: {B: "C"}}
264
+ vValue = vValue.reduceRight(function(i,j) {var o = {}; o[fnNorm(j)] = i; return o;});
265
+ }
266
+
267
+ // if this is a new key
268
+ if (!oResult.hasOwnProperty(sKey)) {
269
+ // then just add the new string/object directly
270
+ oResult[sKey] = vValue;
271
+
272
+ // else if we are adding an object for a key that already contains an object
273
+ } else {
274
+ // then merge the new object with the existing one
275
+ extend(oResult[sKey], vValue);
276
+ }
277
+
278
+ });
279
+
280
+ return oResult;
281
+ },
282
+
283
+ /**
284
+ * Detects errors in aData due to duplicate keys, and throws an Error if an issue was found
285
+ *
286
+ * @param {string[]} aData - a 2D array of strings
287
+ * @param {function} fnNorm - the normalization function to use to normalize keys
288
+ * @throws {Error} if the inputed array aData contains duplicate keys such that a row would be overwritten
289
+ * @private
290
+ */
291
+ _detectDuplicateKeys: function(aData, fnNorm) {
292
+
293
+ var oRowSet = {}; // used to help us identify duplicate keys
294
+
295
+ // for each row in the inputed data
296
+ aData.forEach(function(aRow) {
297
+ var aKeys = aRow.slice(0, (aRow.length - 1)).map(fnNorm);
298
+
299
+ // for each hierarchical level of the keys
300
+ // e.g. when aKeys = ['A', 'B', 'C'], then sKeys will have the values 'A-B-C', 'A-B' and 'A', in that order
301
+ for (var i = aKeys.length; i > 0; --i) {
302
+ var sKeys = aKeys.slice(0, i).join('-');
303
+
304
+ // if this set of keys is unique so far
305
+ if (!oRowSet[sKeys]) {
306
+ // then take note of it for next time
307
+ oRowSet[sKeys] = aRow;
308
+
309
+ // else if this set of keys is NOT unique
310
+ } else {
311
+
312
+ var aOldRow = oRowSet[sKeys];
313
+ var aOldKeys = aOldRow.slice(0, (aOldRow.length - 1)).map(fnNorm);
314
+
315
+ // if the new row would overwrite the old one
316
+ if ( (aOldRow.length !== aRow.length) ||
317
+ (aOldKeys.every(function(str, index) {return aKeys[index] === str;})) ) {
318
+
319
+ var sOutput = "| " + aOldRow.join(" | ") + " |";
320
+ throw new Error("dataTableUtils.toObject: data table row is being overwritten: " + sOutput);
321
+ }
322
+ }
323
+ }
324
+ });
325
+ },
326
+
327
+ /**
328
+ * Finds the normalization function equivalent to input parameter "vFun"
329
+ *
330
+ * @param {(string|function)} [vFun="none"] - a normalization function. Can also be a string with values
331
+ * "titleCase", "pascalCase", "camelCase", "hyphenated" or "none".
332
+ * @param {string} sFunc - the name of the calling function, for error reporting
333
+ * @returns {function} the normalization function equivalent to the inputed value, or <none> if the input was
334
+ * undefined.
335
+ * @throws {Error} if the input string is invalid
336
+ * @private
337
+ */
338
+ _getNormalizationFunction: function(vFun, sFunc) {
339
+
340
+ var sErrorMessage = "dataTableUtils." + sFunc + ": parameter 'vNorm' must be either a Function or a String with the value 'titleCase', 'pascalCase', 'camelCase', 'hyphenated' or 'none'";
341
+
342
+ if (typeof vFun === "string" || vFun instanceof String) {
343
+ var fnNormalize = this.normalization[vFun];
344
+ if (fnNormalize === undefined) {
345
+ throw new Error(sErrorMessage);
346
+ }
347
+ return fnNormalize;
348
+ } else if (typeof vFun === "function") {
349
+ return vFun;
350
+ } else if (vFun === undefined || vFun === null) {
351
+ return this.normalization.none;
352
+ } else {
353
+ throw new Error(sErrorMessage);
354
+ }
355
+ },
356
+
357
+ /**
358
+ * Tests a normalization function's input parameter to make sure it's valid
359
+ *
360
+ * @param {string} sString - the parameter to test
361
+ * @param {string} sNormalizationFunction - the normalization function whose input we're testing
362
+ * @throws {Error} if the input string is invalid
363
+ * @private
364
+ */
365
+ _testNormalizationInput: function(sString, sNormalizationFunction) {
366
+ if (typeof sString !== "string" && !(sString instanceof String)) {
367
+ throw new Error("dataTableUtils.normalization." + sNormalizationFunction + ": parameter 'sString' must be a valid string");
368
+ }
369
+ },
370
+
371
+ /**
372
+ * Tests a conversion function's input parameter to make sure it's valid
373
+ *
374
+ * @param {array} aArray - the parameter to test
375
+ * @param {string} sFunc - the conversion function whose input we're testing (e.g. "toObject" or "toTable")
376
+ * @throws {Error} if the input parameter is invalid
377
+ * @private
378
+ */
379
+ _testArrayInput: function(aArray, sFunc) {
380
+
381
+ var sErrorMessage = "dataTableUtils." + sFunc + ": parameter 'aData' must be an Array of Array of Strings";
382
+
383
+ if (!Array.isArray(aArray)) {
384
+ throw new Error(sErrorMessage);
385
+ }
386
+
387
+ if (!aArray.every(function(a) {
388
+ return Array.isArray(a) && (a.every(function(s){return (typeof s === "string" || s instanceof String);}));
389
+ })) {
390
+ throw new Error(sErrorMessage);
391
+ }
392
+ }
393
+ };
394
+
395
+ return dataTableUtils;
394
396
  }, /* bExport= */ true);