@syncfusion/ej2-navigations 20.1.48 → 20.1.51-10460

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 (415) hide show
  1. package/.eslintrc.json +243 -243
  2. package/CHANGELOG.md +1601 -1585
  3. package/README.md +194 -194
  4. package/dist/ej2-navigations.min.js +1 -0
  5. package/dist/ej2-navigations.umd.min.js +1 -10
  6. package/dist/ej2-navigations.umd.min.js.map +1 -1
  7. package/dist/es6/ej2-navigations.es2015.js +78 -76
  8. package/dist/es6/ej2-navigations.es2015.js.map +1 -1
  9. package/dist/es6/ej2-navigations.es5.js +234 -232
  10. package/dist/es6/ej2-navigations.es5.js.map +1 -1
  11. package/dist/global/ej2-navigations.min.js +1 -10
  12. package/dist/global/ej2-navigations.min.js.map +1 -1
  13. package/dist/global/index.d.ts +0 -9
  14. package/dist/ts/accordion/accordion.ts +1545 -0
  15. package/dist/ts/breadcrumb/breadcrumb.ts +873 -0
  16. package/dist/ts/carousel/carousel.ts +1181 -0
  17. package/dist/ts/common/h-scroll.ts +477 -0
  18. package/dist/ts/common/menu-base.ts +2357 -0
  19. package/dist/ts/common/menu-scroll.ts +105 -0
  20. package/dist/ts/common/v-scroll.ts +454 -0
  21. package/{src/context-menu/context-menu.d.ts → dist/ts/context-menu/context-menu.ts} +134 -88
  22. package/dist/ts/menu/menu.ts +302 -0
  23. package/dist/ts/sidebar/sidebar.ts +874 -0
  24. package/dist/ts/tab/tab.ts +2637 -0
  25. package/dist/ts/toolbar/toolbar.ts +2378 -0
  26. package/dist/ts/treeview/treeview.ts +5768 -0
  27. package/helpers/e2e/accordionHelper.js +70 -53
  28. package/helpers/e2e/contextmenuHelper.js +52 -35
  29. package/helpers/e2e/index.js +14 -12
  30. package/helpers/e2e/menuHelper.js +52 -35
  31. package/helpers/e2e/sidebarHelper.js +109 -92
  32. package/helpers/e2e/tabHelper.js +73 -56
  33. package/helpers/e2e/toolbarHelper.js +73 -56
  34. package/helpers/e2e/treeview.js +79 -61
  35. package/license +10 -10
  36. package/package.json +164 -164
  37. package/src/accordion/accordion-model.d.ts +190 -190
  38. package/src/accordion/accordion.js +19 -19
  39. package/src/breadcrumb/breadcrumb-model.d.ts +105 -105
  40. package/src/breadcrumb/breadcrumb.js +19 -19
  41. package/src/carousel/carousel-model.d.ts +148 -148
  42. package/src/carousel/carousel.js +19 -19
  43. package/src/common/h-scroll-model.d.ts +6 -6
  44. package/src/common/h-scroll.js +19 -19
  45. package/src/common/menu-base-model.d.ts +206 -206
  46. package/src/common/menu-base.js +22 -20
  47. package/src/common/v-scroll-model.d.ts +6 -6
  48. package/src/common/v-scroll.js +19 -19
  49. package/src/context-menu/context-menu-model.d.ts +18 -18
  50. package/src/context-menu/context-menu.js +19 -19
  51. package/src/menu/menu-model.d.ts +43 -43
  52. package/src/menu/menu.js +19 -19
  53. package/src/sidebar/sidebar-model.d.ts +191 -191
  54. package/src/sidebar/sidebar.js +19 -19
  55. package/src/tab/tab-model.d.ts +291 -291
  56. package/src/tab/tab.js +21 -21
  57. package/src/toolbar/toolbar-model.d.ts +195 -195
  58. package/src/toolbar/toolbar.js +19 -19
  59. package/src/treeview/treeview-model.d.ts +411 -411
  60. package/src/treeview/treeview.js +20 -20
  61. package/styles/accordion/_bds-definition.scss +167 -0
  62. package/styles/accordion/_bigger.scss +121 -0
  63. package/styles/accordion/_bootstrap5.3-definition.scss +168 -0
  64. package/styles/accordion/_fluent2-definition.scss +167 -0
  65. package/styles/accordion/_fusionnew-definition.scss +168 -0
  66. package/styles/accordion/_material3-dark-definition.scss +1 -0
  67. package/styles/accordion/_material3-definition.scss +168 -0
  68. package/styles/accordion/fluent2.scss +4 -0
  69. package/styles/accordion/icons/_bds.scss +15 -0
  70. package/styles/accordion/icons/_bootstrap5.3.scss +15 -0
  71. package/styles/accordion/icons/_fluent2.scss +15 -0
  72. package/styles/accordion/icons/_fusionnew.scss +15 -0
  73. package/styles/accordion/icons/_material3-dark.scss +1 -0
  74. package/styles/accordion/icons/_material3.scss +15 -0
  75. package/styles/accordion/material3-dark.scss +4 -0
  76. package/styles/accordion/material3.scss +4 -0
  77. package/styles/appbar/_all.scss +2 -0
  78. package/styles/appbar/_bds-definition.scss +25 -0
  79. package/styles/appbar/_bigger.scss +15 -0
  80. package/styles/appbar/_bootstrap-dark-definition.scss +6 -0
  81. package/styles/appbar/_bootstrap-definition.scss +6 -0
  82. package/styles/appbar/_bootstrap4-definition.scss +6 -0
  83. package/styles/appbar/_bootstrap5-definition.scss +6 -0
  84. package/styles/appbar/_bootstrap5.3-definition.scss +6 -0
  85. package/styles/appbar/_fabric-dark-definition.scss +6 -0
  86. package/styles/appbar/_fabric-definition.scss +6 -0
  87. package/styles/appbar/_fluent-definition.scss +6 -0
  88. package/styles/appbar/_fluent2-definition.scss +24 -0
  89. package/styles/appbar/_fusionnew-definition.scss +6 -0
  90. package/styles/appbar/_highcontrast-definition.scss +6 -0
  91. package/styles/appbar/_highcontrast-light-definition.scss +6 -0
  92. package/styles/appbar/_layout.scss +76 -0
  93. package/styles/appbar/_material-dark-definition.scss +6 -0
  94. package/styles/appbar/_material-definition.scss +6 -0
  95. package/styles/appbar/_material3-definition.scss +6 -0
  96. package/styles/appbar/_tailwind-definition.scss +6 -0
  97. package/styles/appbar/_theme.scss +216 -0
  98. package/styles/bootstrap-dark.css +1 -1
  99. package/styles/bootstrap.css +1 -1
  100. package/styles/bootstrap4.css +1 -1
  101. package/styles/bootstrap5-dark.css +1 -1
  102. package/styles/bootstrap5.css +1 -1
  103. package/styles/breadcrumb/_bds-definition.scss +60 -0
  104. package/styles/breadcrumb/_bigger.scss +160 -0
  105. package/styles/breadcrumb/_bootstrap5.3-definition.scss +61 -0
  106. package/styles/breadcrumb/_fluent2-definition.scss +61 -0
  107. package/styles/breadcrumb/_fusionnew-definition.scss +59 -0
  108. package/styles/breadcrumb/_layout.scss +1 -1
  109. package/styles/breadcrumb/_material3-dark-definition.scss +1 -0
  110. package/styles/breadcrumb/_material3-definition.scss +60 -0
  111. package/styles/breadcrumb/bootstrap-dark.css +1 -1
  112. package/styles/breadcrumb/bootstrap.css +1 -1
  113. package/styles/breadcrumb/bootstrap4.css +1 -1
  114. package/styles/breadcrumb/bootstrap5-dark.css +1 -1
  115. package/styles/breadcrumb/bootstrap5.css +1 -1
  116. package/styles/breadcrumb/fabric-dark.css +1 -1
  117. package/styles/breadcrumb/fabric.css +1 -1
  118. package/styles/breadcrumb/fluent-dark.css +1 -1
  119. package/styles/breadcrumb/fluent.css +1 -1
  120. package/styles/breadcrumb/fluent2.scss +4 -0
  121. package/styles/breadcrumb/highcontrast-light.css +1 -1
  122. package/styles/breadcrumb/highcontrast.css +1 -1
  123. package/styles/breadcrumb/icons/_bds.scss +23 -0
  124. package/styles/breadcrumb/icons/_bootstrap5.3.scss +23 -0
  125. package/styles/breadcrumb/icons/_fluent2.scss +23 -0
  126. package/styles/breadcrumb/icons/_fusionnew.scss +23 -0
  127. package/styles/breadcrumb/icons/_material3-dark.scss +1 -0
  128. package/styles/breadcrumb/icons/_material3.scss +12 -0
  129. package/styles/breadcrumb/material-dark.css +1 -1
  130. package/styles/breadcrumb/material.css +1 -1
  131. package/styles/breadcrumb/material3-dark.scss +4 -0
  132. package/styles/breadcrumb/material3.scss +4 -0
  133. package/styles/breadcrumb/tailwind-dark.css +1 -1
  134. package/styles/breadcrumb/tailwind.css +1 -1
  135. package/styles/carousel/_bds-definition.scss +20 -0
  136. package/styles/carousel/_bootstrap5.3-definition.scss +20 -0
  137. package/styles/carousel/_fluent2-definition.scss +23 -0
  138. package/styles/carousel/_fusionnew-definition.scss +20 -0
  139. package/styles/carousel/_material3-dark-definition.scss +1 -0
  140. package/styles/carousel/_material3-definition.scss +21 -0
  141. package/styles/carousel/fluent2.scss +4 -0
  142. package/styles/carousel/icons/_bds.scss +30 -0
  143. package/styles/carousel/icons/_bootstrap5.3.scss +30 -0
  144. package/styles/carousel/icons/_fluent2.scss +30 -0
  145. package/styles/carousel/icons/_fusionnew.scss +30 -0
  146. package/styles/carousel/icons/_material3-dark.scss +1 -0
  147. package/styles/carousel/icons/_material3.scss +30 -0
  148. package/styles/carousel/material3-dark.scss +4 -0
  149. package/styles/carousel/material3.scss +4 -0
  150. package/styles/context-menu/_bds-definition.scss +68 -0
  151. package/styles/context-menu/_bigger.scss +96 -0
  152. package/styles/context-menu/_bootstrap5.3-definition.scss +52 -0
  153. package/styles/context-menu/_fluent2-definition.scss +52 -0
  154. package/styles/context-menu/_fusionnew-definition.scss +51 -0
  155. package/styles/context-menu/_material3-dark-definition.scss +1 -0
  156. package/styles/context-menu/_material3-definition.scss +51 -0
  157. package/styles/context-menu/fluent2.scss +4 -0
  158. package/styles/context-menu/icons/_bds.scss +31 -0
  159. package/styles/context-menu/icons/_bootstrap5.3.scss +31 -0
  160. package/styles/context-menu/icons/_fluent2.scss +31 -0
  161. package/styles/context-menu/icons/_fusionnew.scss +31 -0
  162. package/styles/context-menu/icons/_material3-dark.scss +1 -0
  163. package/styles/context-menu/icons/_material3.scss +31 -0
  164. package/styles/context-menu/material3-dark.scss +4 -0
  165. package/styles/context-menu/material3.scss +4 -0
  166. package/styles/fabric-dark.css +1 -1
  167. package/styles/fabric.css +1 -1
  168. package/styles/fluent-dark.css +1 -1
  169. package/styles/fluent.css +1 -1
  170. package/styles/fluent2.scss +34 -0
  171. package/styles/h-scroll/_bds-definition.scss +83 -0
  172. package/styles/h-scroll/_bigger.scss +39 -0
  173. package/styles/h-scroll/_bootstrap5.3-definition.scss +83 -0
  174. package/styles/h-scroll/_fluent2-definition.scss +83 -0
  175. package/styles/h-scroll/_fusionnew-definition.scss +83 -0
  176. package/styles/h-scroll/_material3-dark-definition.scss +1 -0
  177. package/styles/h-scroll/_material3-definition.scss +83 -0
  178. package/styles/h-scroll/fluent2.scss +4 -0
  179. package/styles/h-scroll/icons/_bds.scss +49 -0
  180. package/styles/h-scroll/icons/_bootstrap5.3.scss +49 -0
  181. package/styles/h-scroll/icons/_fluent2.scss +49 -0
  182. package/styles/h-scroll/icons/_fusionnew.scss +49 -0
  183. package/styles/h-scroll/icons/_material3-dark.scss +1 -0
  184. package/styles/h-scroll/icons/_material3.scss +49 -0
  185. package/styles/h-scroll/material3-dark.scss +4 -0
  186. package/styles/h-scroll/material3.scss +4 -0
  187. package/styles/highcontrast-light.css +1 -1
  188. package/styles/highcontrast.css +1 -1
  189. package/styles/material-dark.css +1 -1
  190. package/styles/material.css +1 -1
  191. package/styles/material3-dark.scss +34 -0
  192. package/styles/material3.scss +34 -0
  193. package/styles/menu/_bds-definition.scss +65 -0
  194. package/styles/menu/_bigger.scss +355 -0
  195. package/styles/menu/_bootstrap5.3-definition.scss +66 -0
  196. package/styles/menu/_fluent2-definition.scss +67 -0
  197. package/styles/menu/_fusionnew-definition.scss +66 -0
  198. package/styles/menu/_material3-dark-definition.scss +1 -0
  199. package/styles/menu/_material3-definition.scss +66 -0
  200. package/styles/menu/fluent2.scss +7 -0
  201. package/styles/menu/icons/_bds.scss +104 -0
  202. package/styles/menu/icons/_bootstrap5.3.scss +104 -0
  203. package/styles/menu/icons/_fluent2.scss +104 -0
  204. package/styles/menu/icons/_fusionnew.scss +104 -0
  205. package/styles/menu/icons/_material3-dark.scss +1 -0
  206. package/styles/menu/icons/_material3.scss +104 -0
  207. package/styles/menu/material3-dark.scss +7 -0
  208. package/styles/menu/material3.scss +7 -0
  209. package/styles/pager/_all.scss +2 -0
  210. package/styles/pager/_bds-definition.scss +152 -0
  211. package/styles/pager/_bigger.scss +311 -0
  212. package/styles/pager/_bootstrap-dark-definition.scss +151 -0
  213. package/styles/pager/_bootstrap-definition.scss +151 -0
  214. package/styles/pager/_bootstrap4-definition.scss +151 -0
  215. package/styles/pager/_bootstrap5-definition.scss +166 -0
  216. package/styles/pager/_bootstrap5.3-definition.scss +166 -0
  217. package/styles/pager/_fabric-dark-definition.scss +149 -0
  218. package/styles/pager/_fabric-definition.scss +149 -0
  219. package/styles/pager/_fluent-definition.scss +153 -0
  220. package/styles/pager/_fluent2-definition.scss +152 -0
  221. package/styles/pager/_fusionnew-definition.scss +166 -0
  222. package/styles/pager/_highcontrast-definition.scss +149 -0
  223. package/styles/pager/_highcontrast-light-definition.scss +149 -0
  224. package/styles/pager/_layout.scss +742 -0
  225. package/styles/pager/_material-dark-definition.scss +150 -0
  226. package/styles/pager/_material-definition.scss +150 -0
  227. package/styles/pager/_material3-definition.scss +166 -0
  228. package/styles/pager/_tailwind-definition.scss +152 -0
  229. package/styles/pager/_theme.scss +189 -0
  230. package/styles/pager/icons/_bds.scss +50 -0
  231. package/styles/pager/icons/_bootstrap-dark.scss +50 -0
  232. package/styles/pager/icons/_bootstrap.scss +50 -0
  233. package/styles/pager/icons/_bootstrap4.scss +50 -0
  234. package/styles/pager/icons/_bootstrap5.3.scss +50 -0
  235. package/styles/pager/icons/_bootstrap5.scss +50 -0
  236. package/styles/pager/icons/_fabric-dark.scss +50 -0
  237. package/styles/pager/icons/_fabric.scss +50 -0
  238. package/styles/pager/icons/_fluent.scss +50 -0
  239. package/styles/pager/icons/_fluent2.scss +50 -0
  240. package/styles/pager/icons/_fusionnew.scss +50 -0
  241. package/styles/pager/icons/_highcontrast-light.scss +50 -0
  242. package/styles/pager/icons/_highcontrast.scss +46 -0
  243. package/styles/pager/icons/_material-dark.scss +50 -0
  244. package/styles/pager/icons/_material.scss +46 -0
  245. package/styles/pager/icons/_material3.scss +50 -0
  246. package/styles/pager/icons/_tailwind.scss +50 -0
  247. package/styles/sidebar/_bds-definition.scss +53 -0
  248. package/styles/sidebar/_bootstrap5.3-definition.scss +6 -0
  249. package/styles/sidebar/_fluent2-definition.scss +8 -0
  250. package/styles/sidebar/_fusionnew-definition.scss +6 -0
  251. package/styles/sidebar/_material3-dark-definition.scss +1 -0
  252. package/styles/sidebar/_material3-definition.scss +4 -0
  253. package/styles/sidebar/fluent2.scss +3 -0
  254. package/styles/sidebar/material3-dark.scss +3 -0
  255. package/styles/sidebar/material3.scss +3 -0
  256. package/styles/stepper/_all.scss +2 -0
  257. package/styles/stepper/_bds-definition.scss +72 -0
  258. package/styles/stepper/_bigger.scss +53 -0
  259. package/styles/stepper/_bootstrap-dark-definition.scss +72 -0
  260. package/styles/stepper/_bootstrap-definition.scss +72 -0
  261. package/styles/stepper/_bootstrap4-definition.scss +72 -0
  262. package/styles/stepper/_bootstrap5-definition.scss +73 -0
  263. package/styles/stepper/_bootstrap5.3-definition.scss +72 -0
  264. package/styles/stepper/_fabric-dark-definition.scss +72 -0
  265. package/styles/stepper/_fabric-definition.scss +72 -0
  266. package/styles/stepper/_fluent-definition.scss +72 -0
  267. package/styles/stepper/_fluent2-definition.scss +72 -0
  268. package/styles/stepper/_fusionnew-definition.scss +72 -0
  269. package/styles/stepper/_highcontrast-definition.scss +72 -0
  270. package/styles/stepper/_highcontrast-light-definition.scss +72 -0
  271. package/styles/stepper/_layout.scss +431 -0
  272. package/styles/stepper/_material-dark-definition.scss +72 -0
  273. package/styles/stepper/_material-definition.scss +72 -0
  274. package/styles/stepper/_material3-definition.scss +72 -0
  275. package/styles/stepper/_tailwind-definition.scss +72 -0
  276. package/styles/stepper/_theme.scss +195 -0
  277. package/styles/stepper/icons/_bds.scss +5 -0
  278. package/styles/stepper/icons/_bootstrap-dark.scss +5 -0
  279. package/styles/stepper/icons/_bootstrap.scss +5 -0
  280. package/styles/stepper/icons/_bootstrap4.scss +5 -0
  281. package/styles/stepper/icons/_bootstrap5.3.scss +5 -0
  282. package/styles/stepper/icons/_bootstrap5.scss +5 -0
  283. package/styles/stepper/icons/_fabric-dark.scss +5 -0
  284. package/styles/stepper/icons/_fabric.scss +5 -0
  285. package/styles/stepper/icons/_fluent.scss +5 -0
  286. package/styles/stepper/icons/_fluent2.scss +5 -0
  287. package/styles/stepper/icons/_fusionnew.scss +5 -0
  288. package/styles/stepper/icons/_highcontrast-light.scss +5 -0
  289. package/styles/stepper/icons/_highcontrast.scss +5 -0
  290. package/styles/stepper/icons/_material-dark.scss +5 -0
  291. package/styles/stepper/icons/_material.scss +5 -0
  292. package/styles/stepper/icons/_material3.scss +5 -0
  293. package/styles/stepper/icons/_tailwind.scss +5 -0
  294. package/styles/tab/_bds-definition.scss +661 -0
  295. package/styles/tab/_bigger.scss +1270 -0
  296. package/styles/tab/_bootstrap5.3-definition.scss +636 -0
  297. package/styles/tab/_fluent2-definition.scss +667 -0
  298. package/styles/tab/_fusionnew-definition.scss +634 -0
  299. package/styles/tab/_material3-dark-definition.scss +1 -0
  300. package/styles/tab/_material3-definition.scss +636 -0
  301. package/styles/tab/fluent2.scss +5 -0
  302. package/styles/tab/icons/_bds.scss +90 -0
  303. package/styles/tab/icons/_bootstrap5.3.scss +90 -0
  304. package/styles/tab/icons/_fluent2.scss +98 -0
  305. package/styles/tab/icons/_fusionnew.scss +90 -0
  306. package/styles/tab/icons/_material3-dark.scss +1 -0
  307. package/styles/tab/icons/_material3.scss +90 -0
  308. package/styles/tab/material3-dark.scss +5 -0
  309. package/styles/tab/material3.scss +5 -0
  310. package/styles/tailwind-dark.css +1 -1
  311. package/styles/tailwind.css +1 -1
  312. package/styles/toolbar/_bds-definition.scss +197 -0
  313. package/styles/toolbar/_bigger.scss +309 -0
  314. package/styles/toolbar/_bootstrap5.3-definition.scss +198 -0
  315. package/styles/toolbar/_fluent2-definition.scss +198 -0
  316. package/styles/toolbar/_fusionnew-definition.scss +198 -0
  317. package/styles/toolbar/_material3-dark-definition.scss +1 -0
  318. package/styles/toolbar/_material3-definition.scss +199 -0
  319. package/styles/toolbar/fluent2.scss +6 -0
  320. package/styles/toolbar/icons/_bds.scss +14 -0
  321. package/styles/toolbar/icons/_bootstrap5.3.scss +14 -0
  322. package/styles/toolbar/icons/_fluent2.scss +14 -0
  323. package/styles/toolbar/icons/_fusionnew.scss +14 -0
  324. package/styles/toolbar/icons/_material3-dark.scss +1 -0
  325. package/styles/toolbar/icons/_material3.scss +14 -0
  326. package/styles/toolbar/material3-dark.scss +6 -0
  327. package/styles/toolbar/material3.scss +6 -0
  328. package/styles/treeview/_bds-definition.scss +132 -0
  329. package/styles/treeview/_bigger.scss +393 -0
  330. package/styles/treeview/_bootstrap5.3-definition.scss +119 -0
  331. package/styles/treeview/_fluent2-definition.scss +128 -0
  332. package/styles/treeview/_fusionnew-definition.scss +120 -0
  333. package/styles/treeview/_material3-dark-definition.scss +1 -0
  334. package/styles/treeview/_material3-definition.scss +110 -0
  335. package/styles/treeview/fluent2.scss +4 -0
  336. package/styles/treeview/icons/_bds.scss +44 -0
  337. package/styles/treeview/icons/_bootstrap5.3.scss +44 -0
  338. package/styles/treeview/icons/_fluent2.scss +44 -0
  339. package/styles/treeview/icons/_fusionnew.scss +44 -0
  340. package/styles/treeview/icons/_material3-dark.scss +1 -0
  341. package/styles/treeview/icons/_material3.scss +44 -0
  342. package/styles/treeview/material3-dark.scss +4 -0
  343. package/styles/treeview/material3.scss +4 -0
  344. package/styles/v-scroll/_bds-definition.scss +49 -0
  345. package/styles/v-scroll/_bigger.scss +28 -0
  346. package/styles/v-scroll/_bootstrap5.3-definition.scss +49 -0
  347. package/styles/v-scroll/_fluent2-definition.scss +49 -0
  348. package/styles/v-scroll/_fusionnew-definition.scss +49 -0
  349. package/styles/v-scroll/_material3-dark-definition.scss +1 -0
  350. package/styles/v-scroll/_material3-definition.scss +49 -0
  351. package/styles/v-scroll/fluent2.scss +4 -0
  352. package/styles/v-scroll/icons/_bds.scss +27 -0
  353. package/styles/v-scroll/icons/_bootstrap5.3.scss +27 -0
  354. package/styles/v-scroll/icons/_fluent2.scss +27 -0
  355. package/styles/v-scroll/icons/_fusionnew.scss +27 -0
  356. package/styles/v-scroll/icons/_material3-dark.scss +1 -0
  357. package/styles/v-scroll/icons/_material3.scss +27 -0
  358. package/styles/v-scroll/material3-dark.scss +4 -0
  359. package/styles/v-scroll/material3.scss +4 -0
  360. package/tslint.json +111 -111
  361. package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -63
  362. package/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -39
  363. package/accordion.d.ts +0 -4
  364. package/accordion.js +0 -4
  365. package/breadcrumb.d.ts +0 -4
  366. package/breadcrumb.js +0 -4
  367. package/carousel.d.ts +0 -4
  368. package/carousel.js +0 -4
  369. package/common.d.ts +0 -4
  370. package/common.js +0 -4
  371. package/context-menu.d.ts +0 -4
  372. package/context-menu.js +0 -4
  373. package/helpers/e2e/accordionHelper.d.ts +0 -56
  374. package/helpers/e2e/contextmenuHelper.d.ts +0 -37
  375. package/helpers/e2e/index.d.ts +0 -7
  376. package/helpers/e2e/menuHelper.d.ts +0 -37
  377. package/helpers/e2e/sidebarHelper.d.ts +0 -94
  378. package/helpers/e2e/tabHelper.d.ts +0 -60
  379. package/helpers/e2e/toolbarHelper.d.ts +0 -60
  380. package/helpers/e2e/treeview.d.ts +0 -50
  381. package/index.d.ts +0 -4
  382. package/index.js +0 -4
  383. package/menu.d.ts +0 -4
  384. package/menu.js +0 -4
  385. package/sidebar.d.ts +0 -4
  386. package/sidebar.js +0 -4
  387. package/src/accordion/accordion.d.ts +0 -440
  388. package/src/accordion/index.d.ts +0 -5
  389. package/src/breadcrumb/breadcrumb.d.ts +0 -255
  390. package/src/breadcrumb/index.d.ts +0 -5
  391. package/src/carousel/carousel.d.ts +0 -338
  392. package/src/carousel/index.d.ts +0 -3
  393. package/src/common/h-scroll.d.ts +0 -105
  394. package/src/common/index.d.ts +0 -9
  395. package/src/common/menu-base.d.ts +0 -526
  396. package/src/common/menu-scroll.d.ts +0 -29
  397. package/src/common/v-scroll.d.ts +0 -106
  398. package/src/context-menu/index.d.ts +0 -5
  399. package/src/index.d.ts +0 -13
  400. package/src/menu/index.d.ts +0 -5
  401. package/src/menu/menu.d.ts +0 -121
  402. package/src/sidebar/index.d.ts +0 -5
  403. package/src/sidebar/sidebar.d.ts +0 -321
  404. package/src/tab/index.d.ts +0 -5
  405. package/src/tab/tab.d.ts +0 -650
  406. package/src/toolbar/index.d.ts +0 -5
  407. package/src/toolbar/toolbar.d.ts +0 -470
  408. package/src/treeview/index.d.ts +0 -5
  409. package/src/treeview/treeview.d.ts +0 -1256
  410. package/tab.d.ts +0 -4
  411. package/tab.js +0 -4
  412. package/toolbar.d.ts +0 -4
  413. package/toolbar.js +0 -4
  414. package/treeview.d.ts +0 -4
  415. package/treeview.js +0 -4
@@ -0,0 +1,1181 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import { Component, EventHandler, Collection, Property, Event, EmitType, formatUnit, INotifyPropertyChanged, NotifyPropertyChanges } from '@syncfusion/ej2-base';
3
+ import { ChildProperty, addClass, removeClass, setStyleAttribute, attributes, getUniqueID, compile, Complex, getInstance, L10n } from '@syncfusion/ej2-base';
4
+ import { append, closest, isNullOrUndefined, remove, classList, Touch, SwipeEventArgs, KeyboardEvents, KeyboardEventArgs, BaseEventArgs } from '@syncfusion/ej2-base';
5
+ import { Button } from '@syncfusion/ej2-buttons';
6
+ import { CarouselModel, CarouselItemModel, CarouselAnimationSettingsModel } from './carousel-model';
7
+
8
+ // Constant variables
9
+ const CLS_CAROUSEL: string = 'e-carousel';
10
+ const CLS_ACTIVE: string = 'e-active';
11
+ const CLS_RTL: string = 'e-rtl';
12
+ const CLS_ITEMS: string = 'e-carousel-items';
13
+ const CLS_ITEM: string = 'e-carousel-item';
14
+ const CLS_PREVIOUS: string = 'e-previous';
15
+ const CLS_NEXT: string = 'e-next';
16
+ const CLS_PREV_ICON: string = 'e-previous-icon';
17
+ const CLS_NEXT_ICON: string = 'e-next-icon';
18
+ const CLS_NAVIGATORS: string = 'e-carousel-navigators';
19
+ const CLS_INDICATORS: string = 'e-carousel-indicators';
20
+ const CLS_INDICATOR_BARS: string = 'e-indicator-bars';
21
+ const CLS_INDICATOR_BAR: string = 'e-indicator-bar';
22
+ const CLS_INDICATOR: string = 'e-indicator';
23
+ const CLS_ICON: string = 'e-icons';
24
+ const CLS_PLAY_PAUSE: string = 'e-play-pause';
25
+ const CLS_PLAY_ICON: string = 'e-play-icon';
26
+ const CLS_PAUSE_ICON: string = 'e-pause-icon';
27
+ const CLS_PREV_BUTTON: string = 'e-previous-button';
28
+ const CLS_NEXT_BUTTON: string = 'e-next-button';
29
+ const CLS_PLAY_BUTTON: string = 'e-play-button';
30
+ const CLS_FLAT: string = 'e-flat';
31
+ const CLS_ROUND: string = 'e-round';
32
+ const CLS_HOVER_ARROWS: string = 'e-hover-arrows';
33
+ const CLS_HOVER: string = 'e-carousel-hover';
34
+ const CLS_TEMPLATE: string = 'e-template';
35
+ const CLS_SLIDE_ANIMATION: string = 'e-carousel-slide-animation';
36
+ const CLS_FADE_ANIMATION: string = 'e-carousel-fade-animation';
37
+ const CLS_PREV_SLIDE: string = 'e-prev';
38
+ const CLS_NEXT_SLIDE: string = 'e-next';
39
+ const CLS_TRANSITION_START: string = 'e-transition-start';
40
+ const CLS_TRANSITION_END: string = 'e-transition-end';
41
+
42
+ /**
43
+ * Specifies the direction of previous/next button navigations in carousel.
44
+ *
45
+ * * `Previous` - To determine the previous direction of carousel item transition.
46
+ * * `Next` - To determine the next direction of carousel item transition.
47
+ */
48
+ export type CarouselSlideDirection = 'Previous' | 'Next';
49
+
50
+ /**
51
+ * Specifies the state of navigation buttons displayed in carousel.
52
+ *
53
+ * * `Hidden` - Navigation buttons are hidden.
54
+ * * `Visible` - Navigation buttons are visible.
55
+ * * `VisibleOnHover` - Navigation buttons are visible only when we hover the carousel.
56
+ */
57
+ export type CarouselButtonVisibility = 'Hidden' | 'Visible' | 'VisibleOnHover';
58
+
59
+ /**
60
+ * Specifies the animation effects of carousel slide.
61
+ *
62
+ * * `None` - The carousel item transition happens without animation.
63
+ * * `Slide` - The carousel item transition happens with slide animation.
64
+ * * `Fade` - The Carousel item transition happens with fade animation.
65
+ */
66
+ export type CarouselAnimationEffect = 'None' | 'Fade' | 'Slide';
67
+
68
+ /** An interface that holds details when changing the slide. */
69
+ export interface SlideChangingEventArgs extends BaseEventArgs {
70
+ /** Specifies the index of current slide. */
71
+ currentIndex: number;
72
+ /** Specifies the element of current slide. */
73
+ currentSlide: HTMLElement;
74
+ /** Specifies the index of slide to be changed. */
75
+ nextIndex: number;
76
+ /** Specifies the element of slide to be changed. */
77
+ nextSlide: HTMLElement;
78
+ /** Specifies whether the slide transition occur through swiping or not. */
79
+ isSwiped: boolean;
80
+ /** Specifies the slide direction in which transition occurs. */
81
+ slideDirection: CarouselSlideDirection;
82
+ /** Specifies whether the slide transition should occur or not. */
83
+ cancel: boolean;
84
+ }
85
+
86
+ /** An interface that holds details once slide change done. */
87
+ export interface SlideChangedEventArgs extends BaseEventArgs {
88
+ /** Specifies the index of current slide. */
89
+ currentIndex: number;
90
+ /** Specifies the element of current slide. */
91
+ currentSlide: HTMLElement;
92
+ /** Specifies the index of slide from which it changed. */
93
+ previousIndex: number;
94
+ /** Specifies the element of slide from which it changed. */
95
+ previousSlide: HTMLElement;
96
+ /** Specifies whether the slide transition done through swiping or not. */
97
+ isSwiped: boolean;
98
+ /** Specifies the slide direction in which transition occurred. */
99
+ slideDirection: CarouselSlideDirection;
100
+ }
101
+
102
+ /** Specifies the carousel individual item. */
103
+ export class CarouselItem extends ChildProperty<CarouselItem> {
104
+
105
+ /**
106
+ * Accepts single/multiple classes (separated by a space) to be used for individual carousel item customization.
107
+ *
108
+ * @default null
109
+ */
110
+ @Property()
111
+ public cssClass: string;
112
+
113
+ /**
114
+ * Accepts the interval duration in milliseconds for individual carousel item transition.
115
+ *
116
+ * @default null
117
+ */
118
+ @Property()
119
+ public interval: number;
120
+
121
+ /**
122
+ * Accepts the template for individual carousel item.
123
+ *
124
+ * @default null
125
+ */
126
+ @Property()
127
+ public template: string;
128
+
129
+ /**
130
+ * Accepts HTML attributes/custom attributes to add in individual carousel item.
131
+ *
132
+ * @default null
133
+ */
134
+ @Property()
135
+ public htmlAttributes: Record<string, string>;
136
+
137
+ }
138
+
139
+ /** Specifies the animation configuration for carousel items. */
140
+ export class CarouselAnimationSettings extends ChildProperty<CarouselAnimationSettings> {
141
+
142
+ /**
143
+ * Specifies the type of animation. The possible values for this property as follows
144
+ * * None
145
+ * * Slide
146
+ * * Fade
147
+ *
148
+ * @default 'Slide'
149
+ */
150
+ @Property('Slide')
151
+ public effect: CarouselAnimationEffect;
152
+
153
+ /**
154
+ * Specifies the custom animation effect.
155
+ *
156
+ * @default null
157
+ */
158
+ @Property()
159
+ public customEffect: string;
160
+
161
+ }
162
+
163
+ @NotifyPropertyChanges
164
+ export class Carousel extends Component<HTMLElement> implements INotifyPropertyChanged {
165
+ private autoSlideInterval: any;
166
+ private slideItems: any[];
167
+ private touchModule: Touch;
168
+ private keyModule: KeyboardEvents;
169
+ private keyConfigs: Record<string, string>;
170
+ private slideChangedEventArgs: SlideChangedEventArgs;
171
+ private localeObj: L10n;
172
+
173
+ /**
174
+ * Allows defining the collection of carousel item to be displayed on the Carousel.
175
+ *
176
+ * @default []
177
+ */
178
+ @Collection<CarouselItemModel>([], CarouselItem)
179
+ public items: CarouselItemModel[];
180
+
181
+ /**
182
+ * Specifies the animation setting for the carousel component.
183
+ *
184
+ * @default { effect: 'Slide', customEffect: null }
185
+ */
186
+ @Complex<CarouselAnimationSettingsModel>({}, CarouselAnimationSettings)
187
+ public animation: CarouselAnimationSettingsModel;
188
+
189
+ /**
190
+ * Accepts the template for previous navigation button.
191
+ *
192
+ * @default null
193
+ */
194
+ @Property()
195
+ public previousButtonTemplate: string;
196
+
197
+ /**
198
+ * Accepts the template for next navigation button.
199
+ *
200
+ * @default null
201
+ */
202
+ @Property()
203
+ public nextButtonTemplate: string;
204
+
205
+ /**
206
+ * Accepts the template for indicator buttons.
207
+ *
208
+ * @default null
209
+ */
210
+ @Property()
211
+ public indicatorsTemplate: string;
212
+
213
+ /**
214
+ * Accepts the template for play/pause button.
215
+ *
216
+ * @default null
217
+ */
218
+ @Property()
219
+ public playButtonTemplate: string;
220
+
221
+ /**
222
+ * Accepts single/multiple classes (separated by a space) to be used for carousel customization.
223
+ *
224
+ * @default null
225
+ */
226
+ @Property()
227
+ public cssClass: string;
228
+
229
+ /**
230
+ * Specifies the datasource for the carousel items.
231
+ *
232
+ * @isdatamanager false
233
+ * @default []
234
+ */
235
+ @Property([])
236
+ public dataSource: Record<string, any>[];
237
+
238
+ /**
239
+ * Specifies the template option for carousel items.
240
+ *
241
+ * @default null
242
+ */
243
+ @Property()
244
+ public itemTemplate: string;
245
+
246
+ /**
247
+ * Specifies index of the current carousel item.
248
+ *
249
+ * @default 0
250
+ */
251
+ @Property(0)
252
+ public selectedIndex: number;
253
+
254
+ /**
255
+ * Specifies the width of the Carousel in pixels/number/percentage. The number value is considered as pixels.
256
+ *
257
+ * @default '100%'
258
+ */
259
+ @Property('100%')
260
+ public width: string | number;
261
+
262
+ /**
263
+ * Specifies the height of the Carousel in pixels/number/percentage. The number value is considered as pixels.
264
+ *
265
+ * @default '100%'
266
+ */
267
+ @Property('100%')
268
+ public height: string | number;
269
+
270
+ /**
271
+ * Specifies the interval duration in milliseconds for carousel item transition.
272
+ *
273
+ * @default 5000
274
+ */
275
+ @Property(5000)
276
+ public interval: number;
277
+
278
+ /**
279
+ * Defines whether the slide transition is automatic or manual.
280
+ *
281
+ * @default true
282
+ */
283
+ @Property(true)
284
+ public autoPlay: boolean;
285
+
286
+ /**
287
+ * Defines whether the slide transitions loop end or not. When set to false, the transition stops at last slide.
288
+ *
289
+ * @default true
290
+ */
291
+ @Property(true)
292
+ public loop: boolean;
293
+
294
+ /**
295
+ * Defines whether to show play button or not.
296
+ *
297
+ * @default false
298
+ */
299
+ @Property(false)
300
+ public showPlayButton: boolean;
301
+
302
+ /**
303
+ * Defines whether to enable swipe action in touch devices or not.
304
+ *
305
+ * @default true
306
+ */
307
+ @Property(true)
308
+ public enableTouchSwipe: boolean;
309
+
310
+ /**
311
+ * Defines whether to show the indicator positions or not. The indicator positions allow to know the current slide position of the carousel component.
312
+ *
313
+ * @default true
314
+ */
315
+ @Property(true)
316
+ public showIndicators: boolean;
317
+
318
+ /**
319
+ * Defines how to show the previous, next and play pause buttons visibility. The possible values for this property as follows
320
+ * * Hidden
321
+ * * Visible
322
+ * * VisibleOnHover
323
+ *
324
+ * @default 'Visible'
325
+ */
326
+ @Property('Visible')
327
+ public buttonsVisibility: CarouselButtonVisibility;
328
+
329
+ /**
330
+ * Accepts HTML attributes/custom attributes to add in individual carousel item.
331
+ *
332
+ * @default null
333
+ */
334
+ @Property()
335
+ public htmlAttributes: Record<string, string>;
336
+
337
+ /**
338
+ * The event will be fired before the slide change.
339
+ *
340
+ * @event slideChanging
341
+ */
342
+ @Event()
343
+ public slideChanging: EmitType<SlideChangingEventArgs>;
344
+
345
+ /**
346
+ * The event will be fired after the slide changed.
347
+ *
348
+ * @event slideChanged
349
+ */
350
+ @Event()
351
+ public slideChanged: EmitType<SlideChangedEventArgs>;
352
+
353
+ /**
354
+ * Constructor for creating the Carousel widget
355
+ *
356
+ * @param {CarouselModel} options Accepts the carousel model properties to initiate the rendering
357
+ * @param {string | HTMLElement} element Accepts the DOM element reference
358
+ */
359
+ constructor(options?: CarouselModel, element?: string | HTMLElement) {
360
+ super(options, <HTMLElement | string>element);
361
+ }
362
+
363
+ protected getModuleName(): string {
364
+ return CLS_CAROUSEL.replace('e-', '');
365
+ }
366
+
367
+ protected getPersistData(): string {
368
+ return this.addOnPersist(['selectedIndex']);
369
+ }
370
+
371
+ protected preRender(): void {
372
+ this.keyConfigs = {
373
+ home: 'home',
374
+ end: 'end',
375
+ space: 'space',
376
+ moveLeft: 'leftarrow',
377
+ moveRight: 'rightarrow',
378
+ moveUp: 'uparrow',
379
+ moveDown: 'downarrow'
380
+ };
381
+ const defaultLocale: Record<string, any> = {
382
+ nextSlide: 'Next slide',
383
+ of: 'of',
384
+ pauseSlideTransition: 'Pause slide transition',
385
+ playSlideTransition: 'Play slide transition',
386
+ previousSlide: 'Previous slide',
387
+ slide: 'Slide',
388
+ slideShow: 'Slide show'
389
+ };
390
+ this.localeObj = new L10n(this.getModuleName(), defaultLocale, this.locale);
391
+ }
392
+
393
+ protected render(): void {
394
+ this.initialize();
395
+ this.renderSlides();
396
+ this.renderNavigators();
397
+ this.renderPlayButton();
398
+ this.renderIndicators();
399
+ this.applyAnimation();
400
+ this.wireEvents();
401
+ }
402
+
403
+ public onPropertyChanged(newProp: CarouselModel, oldProp: CarouselModel): void {
404
+ let target: Element;
405
+ for (const prop of Object.keys(newProp)) {
406
+ switch (prop) {
407
+ case 'animation':
408
+ for (const propName of Object.keys(newProp.animation)) {
409
+ if (propName === 'customEffect' && !isNullOrUndefined(oldProp.animation.customEffect)) {
410
+ removeClass([this.element.querySelector(`.${CLS_ITEMS}`)], oldProp.animation.customEffect);
411
+ }
412
+ }
413
+ this.applyAnimation();
414
+ break;
415
+ case 'cssClass':
416
+ classList(this.element, [newProp.cssClass], [oldProp.cssClass]);
417
+ break;
418
+ case 'selectedIndex':
419
+ this.setActiveSlide(this.selectedIndex, oldProp.selectedIndex > this.selectedIndex ? 'Previous' : 'Next');
420
+ this.autoSlide();
421
+ break;
422
+ case 'htmlAttributes':
423
+ if (!isNullOrUndefined(this.htmlAttributes)) {
424
+ this.setHtmlAttributes(this.htmlAttributes, this.element);
425
+ }
426
+ break;
427
+ case 'enableTouchSwipe':
428
+ if (!this.enableTouchSwipe && this.touchModule) {
429
+ this.touchModule.destroy();
430
+ }
431
+ if (this.element.querySelector(`.${CLS_ITEMS}`)) {
432
+ this.renderTouchActions();
433
+ }
434
+ break;
435
+ case 'loop':
436
+ if (this.loop && isNullOrUndefined(this.autoSlideInterval)) {
437
+ this.applySlideInterval();
438
+ }
439
+ this.handleNavigatorsActions(this.selectedIndex);
440
+ break;
441
+ case 'enableRtl':
442
+ if (this.enableRtl) {
443
+ addClass([this.element], CLS_RTL);
444
+ } else {
445
+ removeClass([this.element], CLS_RTL);
446
+ }
447
+ break;
448
+ case 'buttonsVisibility':
449
+ target = this.element.querySelector(`.${CLS_NAVIGATORS}`);
450
+ if (target) {
451
+ switch (this.buttonsVisibility) {
452
+ case 'Hidden':
453
+ this.resetTemplates(['previousButtonTemplate', 'nextButtonTemplate']);
454
+ remove(target);
455
+ break;
456
+ case 'VisibleOnHover':
457
+ addClass([].slice.call(target.childNodes), CLS_HOVER_ARROWS);
458
+ break;
459
+ case 'Visible':
460
+ removeClass([].slice.call(target.childNodes), CLS_HOVER_ARROWS);
461
+ break;
462
+ }
463
+ } else {
464
+ this.renderNavigators();
465
+ this.renderPlayButton();
466
+ }
467
+ break;
468
+ case 'width':
469
+ setStyleAttribute(this.element, { 'width': formatUnit(this.width) });
470
+ break;
471
+ case 'height':
472
+ setStyleAttribute(this.element, { 'height': formatUnit(this.height) });
473
+ break;
474
+ case 'autoPlay':
475
+ if (this.showPlayButton && isNullOrUndefined(this.playButtonTemplate)) {
476
+ this.playButtonClickHandler(null, true);
477
+ }
478
+ this.autoSlide();
479
+ break;
480
+ case 'interval':
481
+ this.autoSlide();
482
+ break;
483
+ case 'showIndicators':
484
+ target = this.element.querySelector(`.${CLS_INDICATORS}`);
485
+ if (!this.showIndicators && target) {
486
+ this.resetTemplates(['indicatorsTemplate']);
487
+ remove(target);
488
+ }
489
+ this.renderIndicators();
490
+ break;
491
+ case 'showPlayButton':
492
+ target = this.element.querySelector(`.${CLS_PLAY_PAUSE}`);
493
+ if (!this.showPlayButton && target) {
494
+ remove(target);
495
+ this.resetTemplates(['playButtonTemplate']);
496
+ }
497
+ this.renderPlayButton();
498
+ break;
499
+ case 'items':
500
+ case 'dataSource':
501
+ target = this.element.querySelector(`.${CLS_ITEMS}`);
502
+ if (target) {
503
+ this.resetTemplates(['itemTemplate']);
504
+ remove(target);
505
+ }
506
+ this.renderSlides();
507
+ break;
508
+ }
509
+ }
510
+ }
511
+
512
+ private initialize(): void {
513
+ const carouselClasses: string[] = [];
514
+ if (this.cssClass) {
515
+ carouselClasses.push(this.cssClass);
516
+ }
517
+ if (this.enableRtl) {
518
+ carouselClasses.push(CLS_RTL);
519
+ }
520
+ addClass([this.element], carouselClasses);
521
+ setStyleAttribute(this.element, { 'width': formatUnit(this.width), 'height': formatUnit(this.height) });
522
+ attributes(this.element, { 'tabindex': '0', 'aria-roledescription': 'carousel', 'aria-label': this.localeObj.getConstant('slideShow') });
523
+ if (!isNullOrUndefined(this.htmlAttributes)) {
524
+ this.setHtmlAttributes(this.htmlAttributes, this.element);
525
+ }
526
+ }
527
+
528
+ private renderSlides(): void {
529
+ const itemsContainer: HTMLElement = this.createElement('div', { className: CLS_ITEMS, attrs: { 'aria-live': this.autoPlay ? 'off' : 'polite' } });
530
+ this.element.appendChild(itemsContainer);
531
+ if (this.items.length > 0) {
532
+ this.slideItems = this.items as Record<string, any>[];
533
+ this.items.forEach((item: CarouselItemModel, index: number) => {
534
+ this.renderSlide(item, item.template, index, itemsContainer);
535
+ });
536
+ } else if (this.dataSource.length > 0) {
537
+ this.slideItems = this.dataSource;
538
+ this.dataSource.forEach((item: Record<string, any>, index: number) => {
539
+ this.renderSlide(item, this.itemTemplate, index, itemsContainer);
540
+ });
541
+ }
542
+ this.renderTemplates();
543
+ this.autoSlide();
544
+ this.renderTouchActions();
545
+ this.renderKeyboardActions();
546
+ }
547
+
548
+ private renderSlide(item: Record<string, any>, itemTemplate: string, index: number, container: HTMLElement): void {
549
+ const itemEle: HTMLElement = this.createElement('div', {
550
+ id: getUniqueID('carousel_item'),
551
+ className: `${CLS_ITEM} ${item.cssClass ? item.cssClass : ''} ${this.selectedIndex === index ? CLS_ACTIVE : ''}`,
552
+ attrs: {
553
+ 'aria-hidden': this.selectedIndex === index ? 'false' : 'true', 'data-index': index.toString(),
554
+ 'aria-role': 'group', 'aria-roledescription': 'slide'
555
+ }
556
+ });
557
+ if (!isNullOrUndefined(item.htmlAttributes)) {
558
+ this.setHtmlAttributes(item.htmlAttributes, itemEle);
559
+ }
560
+ const templateId: string = this.element.id + '_template';
561
+ const template: HTMLElement[] = this.templateParser(itemTemplate)(item, this, 'itemTemplate', templateId, false);
562
+ append(template, itemEle);
563
+ container.appendChild(itemEle);
564
+ }
565
+
566
+ private renderNavigators(): void {
567
+ if (this.buttonsVisibility === 'Hidden') {
568
+ return;
569
+ }
570
+ const navigators: HTMLElement = this.createElement('div', { className: CLS_NAVIGATORS });
571
+ const itemsContainer: HTMLElement = this.element.querySelector(`.${CLS_ITEMS}`) as HTMLElement;
572
+ itemsContainer.insertAdjacentElement('afterend', navigators);
573
+ this.renderNavigatorButton('Previous');
574
+ this.renderNavigatorButton('Next');
575
+ this.renderTemplates();
576
+ }
577
+
578
+ private renderNavigatorButton(direction: CarouselSlideDirection): void {
579
+ const buttonContainer: HTMLElement = this.createElement('div', {
580
+ className: (direction === 'Previous' ? CLS_PREVIOUS : CLS_NEXT) + ' ' + (this.buttonsVisibility === 'VisibleOnHover' ? CLS_HOVER_ARROWS : ''),
581
+ attrs: { 'aria-label': this.localeObj.getConstant(direction === 'Previous' ? 'previousSlide' : 'nextSlide') }
582
+ });
583
+ if (direction === 'Previous' && this.previousButtonTemplate) {
584
+ addClass([buttonContainer], CLS_TEMPLATE);
585
+ const templateId: string = this.element.id + '_previousButtonTemplate';
586
+ const template: HTMLElement[] = this.templateParser(this.previousButtonTemplate)({ type: 'Previous' }, this, 'previousButtonTemplate', templateId, false);
587
+ append(template, buttonContainer);
588
+ } else if (direction === 'Next' && this.nextButtonTemplate) {
589
+ addClass([buttonContainer], CLS_TEMPLATE);
590
+ const templateId: string = this.element.id + '_nextButtonTemplate';
591
+ const template: HTMLElement[] = this.templateParser(this.nextButtonTemplate)({ type: 'Next' }, this, 'nextButtonTemplate', templateId, false);
592
+ append(template, buttonContainer);
593
+ } else {
594
+ const button: HTMLElement = this.createElement('button');
595
+ const buttonObj: Button = new Button({
596
+ cssClass: CLS_FLAT + ' ' + CLS_ROUND + ' ' + (direction === 'Previous' ? CLS_PREV_BUTTON : CLS_NEXT_BUTTON),
597
+ iconCss: CLS_ICON + ' ' + (direction === 'Previous' ? CLS_PREV_ICON : CLS_NEXT_ICON),
598
+ enableRtl: this.enableRtl,
599
+ disabled: !this.loop && this.selectedIndex === (direction === 'Previous' ? 0 : this.slideItems.length - 1)
600
+ });
601
+ buttonObj.appendTo(button);
602
+ buttonContainer.appendChild(button);
603
+ }
604
+ this.element.querySelector('.' + CLS_NAVIGATORS).appendChild(buttonContainer);
605
+ EventHandler.add(buttonContainer, 'click', this.navigatorClickHandler, this);
606
+ }
607
+
608
+ private renderPlayButton(): void {
609
+ if (this.buttonsVisibility === 'Hidden' || !this.showPlayButton) {
610
+ return;
611
+ }
612
+ const playPauseWrap: HTMLElement = this.createElement('div', {
613
+ className: CLS_PLAY_PAUSE + ' ' + (this.buttonsVisibility === 'VisibleOnHover' ? CLS_HOVER_ARROWS : '')
614
+ });
615
+ if (this.playButtonTemplate) {
616
+ addClass([playPauseWrap], CLS_TEMPLATE);
617
+ const templateId: string = this.element.id + '_playButtonTemplate';
618
+ const template: HTMLElement[] = this.templateParser(this.playButtonTemplate)({}, this, 'playButtonTemplate', templateId, false);
619
+ append(template, playPauseWrap);
620
+ } else {
621
+ const playButton: HTMLElement = this.createElement('button', {
622
+ attrs: { 'aria-label': this.localeObj.getConstant(this.autoPlay ? 'pauseSlideTransition' : 'playSlideTransition') }
623
+ });
624
+ const isLastSlide: boolean = this.selectedIndex === this.slideItems.length - 1 && !this.loop;
625
+ const buttonObj: Button = new Button({
626
+ cssClass: CLS_FLAT + ' ' + CLS_ROUND + ' ' + CLS_PLAY_BUTTON,
627
+ iconCss: CLS_ICON + ' ' + (this.autoPlay && !isLastSlide ? CLS_PAUSE_ICON : CLS_PLAY_ICON),
628
+ isToggle: true,
629
+ enableRtl: this.enableRtl
630
+ });
631
+ if (isLastSlide) {
632
+ this.setProperties({ autoPlay: false }, true);
633
+ playButton.setAttribute('aria-label', this.localeObj.getConstant('playSlideTransition'));
634
+ const itemsContainer: HTMLElement = this.element.querySelector(`.${CLS_ITEMS}`) as HTMLElement;
635
+ itemsContainer.setAttribute('aria-live', 'polite');
636
+ }
637
+ buttonObj.appendTo(playButton);
638
+ playPauseWrap.appendChild(playButton);
639
+ }
640
+ const navigators: Element = this.element.querySelector(`.${CLS_NAVIGATORS}`);
641
+ navigators.insertBefore(playPauseWrap, navigators.lastElementChild);
642
+ this.renderTemplates();
643
+ EventHandler.add(playPauseWrap, 'click', this.playButtonClickHandler, this);
644
+ }
645
+
646
+ private renderIndicators(): void {
647
+ if (!this.showIndicators) {
648
+ return;
649
+ }
650
+ const indicatorWrap: HTMLElement = this.createElement('div', { className: CLS_INDICATORS });
651
+ const indicatorBars: HTMLElement = this.createElement('div', { className: CLS_INDICATOR_BARS });
652
+ indicatorWrap.appendChild(indicatorBars);
653
+ if (this.slideItems) {
654
+ this.slideItems.forEach((item: Record<string, any>, index: number) => {
655
+ const indicatorBar: HTMLElement = this.createElement('div', {
656
+ className: CLS_INDICATOR_BAR + ' ' + (this.selectedIndex === index ? CLS_ACTIVE : ''),
657
+ attrs: { 'data-index': index.toString(), 'aria-current': this.selectedIndex === index ? 'true' : 'false' }
658
+ });
659
+ if (this.indicatorsTemplate) {
660
+ addClass([indicatorBar], CLS_TEMPLATE);
661
+ const templateId: string = this.element.id + '_indicatorsTemplate';
662
+ const template: HTMLElement[] = this.templateParser(this.indicatorsTemplate)({ index: index, selectedIndex: this.selectedIndex }, this, 'indicatorsTemplate', templateId, false);
663
+ append(template, indicatorBar);
664
+ } else {
665
+ const indicator: HTMLElement = this.createElement('button', { className: CLS_INDICATOR });
666
+ indicatorBar.appendChild(indicator);
667
+ indicator.appendChild(this.createElement('div', {
668
+ attrs: {
669
+ 'aria-label': this.localeObj.getConstant('slide') + ' ' + (index + 1) + ' ' + this.localeObj.getConstant('of') + ' ' + this.slideItems.length
670
+ }
671
+ }));
672
+ const buttonObj: Button = new Button({ cssClass: 'e-flat e-small' });
673
+ buttonObj.appendTo(indicator);
674
+ }
675
+ indicatorBars.appendChild(indicatorBar);
676
+ EventHandler.add(indicatorBar, 'click', this.indicatorClickHandler, this);
677
+ });
678
+ }
679
+ this.element.appendChild(indicatorWrap);
680
+ }
681
+
682
+ private renderKeyboardActions(): void {
683
+ this.keyModule = new KeyboardEvents(this.element, { keyAction: this.keyHandler.bind(this), keyConfigs: this.keyConfigs });
684
+ }
685
+
686
+ private renderTouchActions(): void {
687
+ if (!this.enableTouchSwipe) {
688
+ return;
689
+ }
690
+ this.touchModule = new Touch(this.element, { swipe: this.swipeHandler.bind(this) });
691
+ }
692
+
693
+ private applyAnimation(): void {
694
+ const animationTarget: HTMLElement = this.element.querySelector(`.${CLS_ITEMS}`) as HTMLElement;
695
+ removeClass([animationTarget], [CLS_FADE_ANIMATION, CLS_SLIDE_ANIMATION]);
696
+ if (this.animation.customEffect) {
697
+ addClass([animationTarget], this.animation.customEffect);
698
+ } else if (this.animation.effect !== 'None') {
699
+ const animationClass: string = this.animation.effect === 'Fade' ? CLS_FADE_ANIMATION : CLS_SLIDE_ANIMATION;
700
+ addClass([animationTarget], animationClass);
701
+ }
702
+ }
703
+
704
+ private autoSlide(): void {
705
+ this.resetSlideInterval();
706
+ this.applySlideInterval();
707
+ }
708
+
709
+ private autoSlideChange(): void {
710
+ const activeSlide: HTMLElement = this.element.querySelector(`.${CLS_ACTIVE}`) as HTMLElement;
711
+ if (isNullOrUndefined(activeSlide)) { return; }
712
+ const activeIndex: number = parseInt(activeSlide.dataset.index, 10);
713
+ if (!this.loop && activeIndex === this.slideItems.length - 1) {
714
+ this.resetSlideInterval();
715
+ } else {
716
+ const index: number = (activeIndex + 1) % this.slideItems.length;
717
+ if (!this.element.classList.contains(CLS_HOVER)) {
718
+ this.setActiveSlide(index, 'Next');
719
+ }
720
+ this.autoSlide();
721
+ }
722
+ }
723
+
724
+ private applySlideInterval(): void {
725
+ if (!this.autoPlay || this.element.classList.contains(CLS_HOVER)) {
726
+ return;
727
+ }
728
+ let itemInterval: number = this.interval;
729
+ if (this.items.length > 0 && !isNullOrUndefined(this.items[this.selectedIndex].interval)) {
730
+ itemInterval = this.items[this.selectedIndex].interval;
731
+ }
732
+ this.autoSlideInterval = setInterval(() => this.autoSlideChange(), itemInterval);
733
+ }
734
+
735
+ private resetSlideInterval(): void {
736
+ clearInterval(this.autoSlideInterval);
737
+ this.autoSlideInterval = null;
738
+ }
739
+
740
+ private getSlideIndex(direction: CarouselSlideDirection): number {
741
+ let currentIndex: number = this.selectedIndex;
742
+ if (direction === 'Previous') {
743
+ currentIndex--;
744
+ if (currentIndex < 0) {
745
+ currentIndex = this.slideItems.length - 1;
746
+ }
747
+ } else {
748
+ currentIndex++;
749
+ if (currentIndex === this.slideItems.length) {
750
+ currentIndex = 0;
751
+ }
752
+ }
753
+ return currentIndex;
754
+ }
755
+
756
+ private setActiveSlide(currentIndex: number, direction: CarouselSlideDirection, isSwiped: boolean = false): void {
757
+ if (this.element.querySelectorAll(`.${CLS_ITEM}.${CLS_PREV_SLIDE},.${CLS_ITEM}.${CLS_NEXT_SLIDE}`).length > 0) {
758
+ return;
759
+ }
760
+ const allSlides: HTMLElement[] = [].slice.call(this.element.querySelectorAll(`.${CLS_ITEM}`));
761
+ const activeSlide: HTMLElement = this.element.querySelector(`.${CLS_ITEM}.${CLS_ACTIVE}`);
762
+ if (isNullOrUndefined(activeSlide) && this.showIndicators) {
763
+ const activeIndicator: HTMLElement = this.element.querySelector(`.${CLS_INDICATOR_BAR}.${CLS_ACTIVE}`) as HTMLElement;
764
+ const activeIndex: number = parseInt(activeIndicator.dataset.index, 10);
765
+ addClass([allSlides[activeIndex]], CLS_ACTIVE);
766
+ return;
767
+ } else if (isNullOrUndefined(activeSlide)) {
768
+ addClass([allSlides[currentIndex]], CLS_ACTIVE);
769
+ return;
770
+ }
771
+ const activeIndex: number = parseInt(activeSlide.dataset.index, 10);
772
+ const currentSlide: HTMLElement = allSlides[currentIndex];
773
+ const eventArgs: SlideChangingEventArgs = {
774
+ currentIndex: activeIndex,
775
+ nextIndex: currentIndex,
776
+ currentSlide: activeSlide,
777
+ nextSlide: currentSlide,
778
+ slideDirection: direction,
779
+ isSwiped: isSwiped,
780
+ cancel: false
781
+ };
782
+ this.trigger('slideChanging', eventArgs, (args: SlideChangingEventArgs) => {
783
+ if (args.cancel) {
784
+ return;
785
+ }
786
+ this.setProperties({ selectedIndex: currentIndex }, true);
787
+ attributes(args.currentSlide, { 'aria-hidden': 'true' });
788
+ attributes(args.nextSlide, { 'aria-hidden': 'false' });
789
+ const slideIndicators: HTMLElement[] = [].slice.call(this.element.querySelectorAll(`.${CLS_INDICATOR_BAR}`));
790
+ if (slideIndicators.length > 0) {
791
+ attributes(slideIndicators[activeIndex], { 'aria-current': 'false' });
792
+ attributes(slideIndicators[currentIndex], { 'aria-current': 'true' });
793
+ removeClass(slideIndicators, CLS_ACTIVE);
794
+ addClass([slideIndicators[currentIndex]], CLS_ACTIVE);
795
+ }
796
+ this.slideChangedEventArgs = {
797
+ currentIndex: args.nextIndex,
798
+ previousIndex: args.currentIndex,
799
+ currentSlide: args.nextSlide,
800
+ previousSlide: args.currentSlide,
801
+ slideDirection: direction,
802
+ isSwiped: isSwiped
803
+ };
804
+ let slideHeight: number;
805
+ if (this.animation.effect === 'None' || this.animation.customEffect) {
806
+ this.onTransitionEnd();
807
+ } else if (this.animation.effect === 'Slide') {
808
+ if (direction === 'Previous') {
809
+ addClass([args.nextSlide], CLS_PREV_SLIDE);
810
+ slideHeight = args.nextSlide.offsetHeight;
811
+ addClass([args.currentSlide, args.nextSlide], CLS_TRANSITION_END);
812
+ } else {
813
+ addClass([args.nextSlide], CLS_NEXT_SLIDE);
814
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
815
+ slideHeight = args.nextSlide.offsetHeight;
816
+ addClass([args.currentSlide, args.nextSlide], CLS_TRANSITION_START);
817
+ }
818
+ } else if (this.animation.effect === 'Fade') {
819
+ removeClass([args.currentSlide], CLS_ACTIVE);
820
+ addClass([args.nextSlide], CLS_ACTIVE);
821
+ }
822
+ this.handleNavigatorsActions(currentIndex);
823
+ });
824
+ }
825
+
826
+ private onTransitionEnd(): void {
827
+ if (this.slideChangedEventArgs) {
828
+ addClass([this.slideChangedEventArgs.currentSlide], CLS_ACTIVE);
829
+ removeClass([this.slideChangedEventArgs.previousSlide], CLS_ACTIVE);
830
+ this.trigger('slideChanged', this.slideChangedEventArgs, () => {
831
+ removeClass(this.element.querySelectorAll(`.${CLS_ITEM}`), [CLS_PREV_SLIDE, CLS_NEXT_SLIDE, CLS_TRANSITION_START, CLS_TRANSITION_END]);
832
+ this.slideChangedEventArgs = null;
833
+ });
834
+ }
835
+ }
836
+
837
+ private setHtmlAttributes(attribute: Record<string, string>, element: HTMLElement): void {
838
+ const keys: string[] = Object.keys(attribute);
839
+ for (const key of keys) {
840
+ if (key === 'class') {
841
+ addClass([element], attribute[key]);
842
+ } else {
843
+ element.setAttribute(key, attribute[key]);
844
+ }
845
+ }
846
+ }
847
+
848
+ private templateParser(template: string): Function {
849
+ if (template) {
850
+ try {
851
+ if (document.querySelectorAll(template).length) {
852
+ return compile(document.querySelector(template).innerHTML.trim());
853
+ } else {
854
+ return compile(template);
855
+ }
856
+ } catch (error) {
857
+ return compile(template);
858
+ }
859
+ }
860
+ return undefined;
861
+ }
862
+
863
+ private getNavigatorState(target: HTMLElement, isPrevious: boolean): boolean {
864
+ const button: HTMLElement = target.querySelector(`.${isPrevious ? CLS_PREV_BUTTON : CLS_NEXT_BUTTON}`) as HTMLElement;
865
+ if (button) {
866
+ const buttonObj: Button = getInstance(button, Button) as Button;
867
+ return buttonObj.disabled;
868
+ }
869
+ return false;
870
+ }
871
+
872
+ private navigatorClickHandler(e: Event): void {
873
+ const target: HTMLElement = e.currentTarget as HTMLElement;
874
+ const isDisabled: boolean = this.getNavigatorState(target, target.classList.contains(CLS_PREVIOUS));
875
+ if (isDisabled) { return; }
876
+ const direction: CarouselSlideDirection = target.classList.contains(CLS_PREVIOUS) ? 'Previous' : 'Next';
877
+ this.setActiveSlide(this.getSlideIndex(direction), direction);
878
+ this.autoSlide();
879
+ }
880
+
881
+ private indicatorClickHandler(e: Event): void {
882
+ const target: HTMLElement = closest(e.target as Element, `.${CLS_INDICATOR_BAR}`) as HTMLElement;
883
+ const index: number = parseInt(target.dataset.index, 10);
884
+ if (this.selectedIndex !== index) {
885
+ this.setActiveSlide(index, this.selectedIndex > index ? 'Previous' : 'Next');
886
+ this.autoSlide();
887
+ }
888
+ }
889
+
890
+ private playButtonClickHandler(e: Event, isPropertyChange: boolean = false): void {
891
+ const playButton: HTMLElement = this.element.querySelector(`.${CLS_PLAY_BUTTON}`) as HTMLElement;
892
+ if (playButton) {
893
+ const buttonObj: Button = getInstance(playButton, Button) as Button;
894
+ if (!isPropertyChange) {
895
+ this.setProperties({ autoPlay: !this.autoPlay }, true);
896
+ }
897
+ playButton.setAttribute('aria-label', this.localeObj.getConstant(this.autoPlay ? 'pauseSlideTransition' : 'playSlideTransition'));
898
+ buttonObj.iconCss = CLS_ICON + ' ' + (this.autoPlay ? CLS_PAUSE_ICON : CLS_PLAY_ICON);
899
+ buttonObj.dataBind();
900
+ const itemsContainer: HTMLElement = this.element.querySelector(`.${CLS_ITEMS}`) as HTMLElement;
901
+ itemsContainer.setAttribute('aria-live', this.autoPlay ? 'off' : 'polite');
902
+ if (this.autoPlay && !this.loop && this.selectedIndex === this.slideItems.length - 1) {
903
+ this.setActiveSlide(0, 'Next');
904
+ }
905
+ this.autoSlide();
906
+ }
907
+ }
908
+
909
+ private keyHandler(e: KeyboardEventArgs): void {
910
+ let direction: CarouselSlideDirection;
911
+ let slideIndex: number;
912
+ let isSlideTransition: boolean = false;
913
+ const target: HTMLElement = e.target as HTMLElement;
914
+ e.preventDefault();
915
+ switch (e.action) {
916
+ case 'space':
917
+ if (this.showIndicators && target.classList.contains(CLS_INDICATOR)) {
918
+ target.click();
919
+ } else if (target.classList.contains(CLS_CAROUSEL) || target.classList.contains(CLS_PLAY_BUTTON)) {
920
+ this.playButtonClickHandler(e);
921
+ } else if (target.classList.contains(CLS_NEXT_BUTTON)) {
922
+ this.next();
923
+ } else if (target.classList.contains(CLS_PREV_BUTTON)) {
924
+ this.prev();
925
+ }
926
+ break;
927
+ case 'end':
928
+ slideIndex = this.slideItems.length - 1;
929
+ direction = 'Next';
930
+ isSlideTransition = true;
931
+ break;
932
+ case 'home':
933
+ slideIndex = 0;
934
+ direction = 'Previous';
935
+ isSlideTransition = true;
936
+ break;
937
+ case 'moveUp':
938
+ case 'moveLeft':
939
+ case 'moveDown':
940
+ case 'moveRight':
941
+ if (this.showIndicators && isNullOrUndefined(this.indicatorsTemplate)) {
942
+ this.element.focus();
943
+ }
944
+ direction = (e.action === 'moveUp' || e.action === 'moveLeft') ? 'Previous' : 'Next';
945
+ slideIndex = this.getSlideIndex(direction);
946
+ isSlideTransition = !this.isSuspendSlideTransition(slideIndex, direction);
947
+ break;
948
+ }
949
+ if (isSlideTransition) {
950
+ this.setActiveSlide(slideIndex, direction);
951
+ this.autoSlide();
952
+ isSlideTransition = false;
953
+ }
954
+ }
955
+
956
+ private swipeHandler(e: SwipeEventArgs): void {
957
+ if (this.element.classList.contains(CLS_HOVER)) {
958
+ return;
959
+ }
960
+ const direction: CarouselSlideDirection = (e.swipeDirection === 'Right') ? 'Previous' : 'Next';
961
+ const slideIndex: number = this.getSlideIndex(direction);
962
+ if (!this.isSuspendSlideTransition(slideIndex, direction)) {
963
+ this.setActiveSlide(slideIndex, direction, true);
964
+ this.autoSlide();
965
+ }
966
+ }
967
+
968
+ private isSuspendSlideTransition(index: number, direction: CarouselSlideDirection): boolean {
969
+ return !this.loop && (direction === 'Next' && index === 0 || direction === 'Previous' && index === this.slideItems.length - 1);
970
+ }
971
+
972
+ private handleNavigatorsActions(index: number): void {
973
+ if (this.buttonsVisibility === 'Hidden') {
974
+ return;
975
+ }
976
+ if (this.showPlayButton) {
977
+ const playButton: HTMLElement = this.element.querySelector(`.${CLS_PLAY_BUTTON}`) as HTMLElement;
978
+ const isLastSlide: boolean = this.selectedIndex === this.slideItems.length - 1 && !this.loop;
979
+ let isButtonUpdate: boolean = isNullOrUndefined(this.playButtonTemplate) && playButton && isLastSlide;
980
+ if (isNullOrUndefined(this.playButtonTemplate) && playButton && !isLastSlide) {
981
+ isButtonUpdate = !playButton.classList.contains(CLS_ACTIVE);
982
+ }
983
+ if (isButtonUpdate) {
984
+ this.setProperties({ autoPlay: !isLastSlide }, true);
985
+ playButton.setAttribute('aria-label', this.localeObj.getConstant(this.autoPlay ? 'pauseSlideTransition' : 'playSlideTransition'));
986
+ const itemsContainer: HTMLElement = this.element.querySelector(`.${CLS_ITEMS}`) as HTMLElement;
987
+ itemsContainer.setAttribute('aria-live', this.autoPlay ? 'off' : 'polite');
988
+ const buttonObj: Button = getInstance(playButton, Button) as Button;
989
+ buttonObj.iconCss = CLS_ICON + ' ' + (this.autoPlay ? CLS_PAUSE_ICON : CLS_PLAY_ICON);
990
+ buttonObj.dataBind();
991
+ }
992
+ }
993
+ const prevButton: HTMLElement = this.element.querySelector(`.${CLS_PREV_BUTTON}`) as HTMLElement;
994
+ if (prevButton && isNullOrUndefined(this.previousButtonTemplate)) {
995
+ const buttonObj: Button = getInstance(prevButton, Button) as Button;
996
+ buttonObj.disabled = !this.loop && index === 0;
997
+ buttonObj.dataBind();
998
+ }
999
+ const nextButton: HTMLElement = this.element.querySelector(`.${CLS_NEXT_BUTTON}`) as HTMLElement;
1000
+ if (nextButton && isNullOrUndefined(this.nextButtonTemplate)) {
1001
+ const buttonObj: Button = getInstance(nextButton, Button) as Button;
1002
+ buttonObj.disabled = !this.loop && index === this.slideItems.length - 1;
1003
+ buttonObj.dataBind();
1004
+ }
1005
+ }
1006
+
1007
+ private onHoverActions(e: Event): void {
1008
+ const navigator: HTMLElement = this.element.querySelector(`.${CLS_NAVIGATORS}`);
1009
+ switch (e.type) {
1010
+ case 'mouseenter':
1011
+ if (this.buttonsVisibility === 'VisibleOnHover' && navigator) {
1012
+ removeClass([].slice.call(navigator.childNodes), CLS_HOVER_ARROWS);
1013
+ }
1014
+ addClass([this.element], CLS_HOVER);
1015
+ break;
1016
+ case 'mouseleave':
1017
+ if (this.buttonsVisibility === 'VisibleOnHover' && navigator) {
1018
+ addClass([].slice.call(navigator.childNodes), CLS_HOVER_ARROWS);
1019
+ }
1020
+ removeClass([this.element], CLS_HOVER);
1021
+ break;
1022
+ }
1023
+ this.autoSlide();
1024
+ }
1025
+
1026
+ private onFocusActions(e: Event): void {
1027
+ switch (e.type) {
1028
+ case 'focusin':
1029
+ addClass([this.element], CLS_HOVER);
1030
+ break;
1031
+ case 'focusout':
1032
+ removeClass([this.element], CLS_HOVER);
1033
+ break;
1034
+ }
1035
+ this.autoSlide();
1036
+ }
1037
+
1038
+ private destroyButtons(): void {
1039
+ const buttonCollections: HTMLElement[] = [].slice.call(this.element.querySelectorAll('.e-control.e-btn'));
1040
+ for (const button of buttonCollections) {
1041
+ const instance: Button = getInstance(button, Button) as Button;
1042
+ if (instance) {
1043
+ instance.destroy();
1044
+ }
1045
+ }
1046
+ }
1047
+
1048
+ private wireEvents(): void {
1049
+ EventHandler.add(this.element, 'focusin focusout', this.onFocusActions, this);
1050
+ EventHandler.add(this.element, 'mouseenter mouseleave', this.onHoverActions, this);
1051
+ EventHandler.add(this.element.firstElementChild, 'transitionend', this.onTransitionEnd, this);
1052
+ }
1053
+
1054
+ private unWireEvents(): void {
1055
+ const indicators: HTMLElement[] = [].slice.call(this.element.querySelectorAll(`.${CLS_INDICATOR_BAR}`));
1056
+ indicators.forEach((indicator: Element) => {
1057
+ EventHandler.remove(indicator, 'click', this.indicatorClickHandler);
1058
+ });
1059
+ const navigators: HTMLElement[] = [].slice.call(this.element.querySelectorAll(`.${CLS_PREVIOUS},.${CLS_NEXT}`));
1060
+ navigators.forEach((navigator: HTMLElement) => {
1061
+ EventHandler.remove(navigator, 'click', this.navigatorClickHandler);
1062
+ });
1063
+ const playIcon: Element = this.element.querySelector(`.${CLS_PLAY_PAUSE}`);
1064
+ if (playIcon) {
1065
+ EventHandler.remove(playIcon, 'click', this.playButtonClickHandler);
1066
+ }
1067
+ EventHandler.remove(this.element.firstElementChild, 'transitionend', this.onTransitionEnd);
1068
+ EventHandler.clearEvents(this.element);
1069
+ }
1070
+
1071
+ /**
1072
+ * Method to transit from the current slide to the previous slide.
1073
+ *
1074
+ * @returns {void}
1075
+ */
1076
+ public prev(): void {
1077
+ if (!this.loop && this.selectedIndex === 0) {
1078
+ return;
1079
+ }
1080
+ const index: number = (this.selectedIndex === 0) ? this.slideItems.length - 1 : this.selectedIndex - 1;
1081
+ this.setActiveSlide(index, 'Previous');
1082
+ this.autoSlide();
1083
+ }
1084
+
1085
+ /**
1086
+ * Method to transit from the current slide to the next slide.
1087
+ *
1088
+ * @returns {void}
1089
+ */
1090
+ public next(): void {
1091
+ if (!this.loop && this.selectedIndex === this.slideItems.length - 1) {
1092
+ return;
1093
+ }
1094
+ const index: number = (this.selectedIndex === this.slideItems.length - 1) ? 0 : this.selectedIndex + 1;
1095
+ this.setActiveSlide(index, 'Next');
1096
+ this.autoSlide();
1097
+ }
1098
+
1099
+ /**
1100
+ * Method to play the slides programmatically.
1101
+ *
1102
+ * @returns {void}
1103
+ */
1104
+ public play(): void {
1105
+ const playIcon: Element = this.element.querySelector(`.${CLS_PLAY_ICON}`);
1106
+ if (this.showPlayButton && playIcon) {
1107
+ classList(playIcon, [CLS_PAUSE_ICON], [CLS_PLAY_ICON]);
1108
+ const playButton: HTMLElement = this.element.querySelector(`.${CLS_PLAY_BUTTON}`) as HTMLElement;
1109
+ playButton.setAttribute('aria-label', this.localeObj.getConstant('pauseSlideTransition'));
1110
+ }
1111
+ this.setProperties({ autoPlay: true }, true);
1112
+ const itemsContainer: HTMLElement = this.element.querySelector(`.${CLS_ITEMS}`) as HTMLElement;
1113
+ itemsContainer.setAttribute('aria-live', 'off');
1114
+ this.applySlideInterval();
1115
+ }
1116
+
1117
+ /**
1118
+ * Method to pause the slides programmatically.
1119
+ *
1120
+ * @returns {void}
1121
+ */
1122
+ public pause(): void {
1123
+ const pauseIcon: Element = this.element.querySelector(`.${CLS_PAUSE_ICON}`);
1124
+ if (this.showPlayButton && pauseIcon) {
1125
+ const playButton: HTMLElement = this.element.querySelector(`.${CLS_PLAY_BUTTON}`) as HTMLElement;
1126
+ playButton.setAttribute('aria-label', this.localeObj.getConstant('playSlideTransition'));
1127
+ classList(pauseIcon, [CLS_PLAY_ICON], [CLS_PAUSE_ICON]);
1128
+ }
1129
+ this.setProperties({ autoPlay: false }, true);
1130
+ const itemsContainer: HTMLElement = this.element.querySelector(`.${CLS_ITEMS}`) as HTMLElement;
1131
+ itemsContainer.setAttribute('aria-live', 'off');
1132
+ this.resetSlideInterval();
1133
+ }
1134
+
1135
+ /**
1136
+ * Method to render react and angular templates
1137
+ *
1138
+ * @returns {void}
1139
+ * @private
1140
+ */
1141
+ private renderTemplates(): void {
1142
+ if ((this as any).isAngular || (this as any).isReact) {
1143
+ this.renderReactTemplates();
1144
+ }
1145
+ }
1146
+
1147
+ /**
1148
+ * Method to reset react and angular templates
1149
+ *
1150
+ * @param {string[]} templates Accepts the template ID
1151
+ * @returns {void}
1152
+ * @private
1153
+ */
1154
+ private resetTemplates(templates?: string[]): void {
1155
+ if ((this as any).isAngular || (this as any).isReact) {
1156
+ this.clearTemplate(templates);
1157
+ }
1158
+ }
1159
+
1160
+ /**
1161
+ * Method for destroy the carousel component.
1162
+ *
1163
+ * @returns {void}
1164
+ */
1165
+ public destroy(): void {
1166
+ this.resetTemplates();
1167
+ if (this.touchModule) {
1168
+ this.touchModule.destroy();
1169
+ this.touchModule = null;
1170
+ }
1171
+ this.keyModule.destroy();
1172
+ this.keyModule = null;
1173
+ this.resetSlideInterval();
1174
+ this.destroyButtons();
1175
+ this.unWireEvents();
1176
+ [].slice.call(this.element.children).forEach((ele: HTMLElement) => { this.element.removeChild(ele); });
1177
+ removeClass([this.element], [CLS_CAROUSEL, this.cssClass, CLS_RTL]);
1178
+ ['tabindex', 'role', 'style'].forEach((attr: string): void => { this.element.removeAttribute(attr); });
1179
+ super.destroy();
1180
+ }
1181
+ }