cy-element-ui 1.1.14 → 1.1.16

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 (526) hide show
  1. package/README.md +35 -5
  2. package/lib/alert.js +68 -68
  3. package/lib/aside.js +11 -11
  4. package/lib/autocomplete.js +287 -287
  5. package/lib/avatar.js +121 -121
  6. package/lib/backtop.js +91 -91
  7. package/lib/badge.js +32 -32
  8. package/lib/breadcrumb-item.js +33 -33
  9. package/lib/breadcrumb.js +27 -27
  10. package/lib/button-group.js +4 -4
  11. package/lib/button.js +53 -53
  12. package/lib/calendar.js +426 -426
  13. package/lib/card.js +11 -11
  14. package/lib/carousel-item.js +108 -108
  15. package/lib/carousel.js +244 -244
  16. package/lib/cascader-panel.js +1045 -1045
  17. package/lib/cascader.js +577 -577
  18. package/lib/checkbox-button.js +137 -137
  19. package/lib/checkbox-group.js +39 -39
  20. package/lib/checkbox.js +151 -151
  21. package/lib/col.js +64 -64
  22. package/lib/collapse-item.js +66 -66
  23. package/lib/collapse.js +63 -63
  24. package/lib/color-picker.js +944 -944
  25. package/lib/container.js +24 -24
  26. package/lib/date-picker.js +2968 -2967
  27. package/lib/descriptions-item.js +29 -29
  28. package/lib/descriptions.js +324 -324
  29. package/lib/dialog.js +170 -170
  30. package/lib/divider.js +20 -20
  31. package/lib/drawer.js +156 -156
  32. package/lib/dropdown-item.js +19 -19
  33. package/lib/dropdown-menu.js +56 -56
  34. package/lib/dropdown.js +329 -329
  35. package/lib/element-ui.common.js +44918 -0
  36. package/lib/empty.js +39 -39
  37. package/lib/footer.js +11 -11
  38. package/lib/form-item.js +369 -369
  39. package/lib/form.js +181 -181
  40. package/lib/header.js +11 -11
  41. package/lib/icon.js +7 -7
  42. package/lib/image.js +520 -520
  43. package/lib/index.js +1 -1
  44. package/lib/infinite-scroll.js +127 -127
  45. package/lib/input-number.js +260 -260
  46. package/lib/input.js +370 -370
  47. package/lib/link.js +28 -28
  48. package/lib/loading.js +219 -219
  49. package/lib/main.js +5 -5
  50. package/lib/menu-item-group.js +33 -33
  51. package/lib/menu-item.js +116 -116
  52. package/lib/menu.js +490 -490
  53. package/lib/message-box.js +421 -421
  54. package/lib/message.js +150 -150
  55. package/lib/notification.js +184 -184
  56. package/lib/option-group.js +46 -46
  57. package/lib/option.js +145 -145
  58. package/lib/page-header.js +14 -14
  59. package/lib/pagination.js +530 -530
  60. package/lib/popconfirm.js +68 -68
  61. package/lib/popover.js +225 -225
  62. package/lib/progress.js +183 -183
  63. package/lib/radio-button.js +78 -78
  64. package/lib/radio-group.js +103 -103
  65. package/lib/radio.js +86 -86
  66. package/lib/rate.js +283 -283
  67. package/lib/result.js +61 -61
  68. package/lib/row.js +32 -32
  69. package/lib/scrollbar.js +247 -247
  70. package/lib/select.js +999 -999
  71. package/lib/selectDisplayInput.js +61 -61
  72. package/lib/skeleton-item.js +19 -19
  73. package/lib/skeleton.js +53 -53
  74. package/lib/slider.js +550 -550
  75. package/lib/spinner.js +19 -19
  76. package/lib/statistic.js +198 -198
  77. package/lib/step.js +125 -125
  78. package/lib/steps.js +54 -54
  79. package/lib/subTitle.js +24 -24
  80. package/lib/submenu.js +405 -406
  81. package/lib/switch.js +135 -135
  82. package/lib/tab-pane.js +43 -43
  83. package/lib/tabDialog.js +508 -508
  84. package/lib/table-column.js +713 -713
  85. package/lib/table.js +3432 -3432
  86. package/lib/tabs.js +578 -578
  87. package/lib/tag.js +60 -60
  88. package/lib/time-picker.js +1350 -1350
  89. package/lib/time-select.js +949 -949
  90. package/lib/timeline-item.js +25 -25
  91. package/lib/timeline.js +30 -30
  92. package/lib/tooltip.js +255 -255
  93. package/lib/transfer.js +385 -385
  94. package/lib/tree.js +1547 -1547
  95. package/lib/treeSelect.js +2618 -2618
  96. package/lib/umd/locale/en.js +137 -137
  97. package/lib/umd/locale/zh-CN.js +137 -137
  98. package/lib/umd/locale/zh-TW.js +137 -137
  99. package/lib/upload.js +738 -738
  100. package/package.json +9 -7
  101. package/packages/alert/index.js +1 -1
  102. package/packages/alert/src/main.vue +82 -82
  103. package/packages/aside/index.js +1 -1
  104. package/packages/aside/src/main.vue +13 -13
  105. package/packages/autocomplete/index.js +1 -1
  106. package/packages/autocomplete/src/autocomplete-suggestions.vue +64 -64
  107. package/packages/autocomplete/src/autocomplete.vue +272 -272
  108. package/packages/avatar/index.js +1 -1
  109. package/packages/avatar/src/main.vue +88 -88
  110. package/packages/backtop/index.js +1 -1
  111. package/packages/backtop/src/main.vue +92 -92
  112. package/packages/badge/index.js +1 -1
  113. package/packages/badge/src/main.vue +41 -41
  114. package/packages/breadcrumb/index.js +1 -1
  115. package/packages/breadcrumb/src/breadcrumb-item.vue +35 -35
  116. package/packages/breadcrumb/src/breadcrumb.vue +27 -27
  117. package/packages/breadcrumb-item/index.js +1 -1
  118. package/packages/button/index.js +1 -1
  119. package/packages/button/src/button-group.vue +6 -6
  120. package/packages/button/src/button.vue +70 -70
  121. package/packages/button-group/index.js +1 -1
  122. package/packages/calendar/index.js +1 -1
  123. package/packages/calendar/src/date-table.vue +193 -193
  124. package/packages/calendar/src/main.vue +242 -242
  125. package/packages/card/index.js +1 -1
  126. package/packages/card/src/main.vue +18 -18
  127. package/packages/carousel/index.js +1 -1
  128. package/packages/carousel/src/item.vue +122 -122
  129. package/packages/carousel/src/main.vue +305 -305
  130. package/packages/carousel-item/index.js +1 -1
  131. package/packages/cascader/index.js +1 -1
  132. package/packages/cascader/src/cascader.vue +626 -626
  133. package/packages/cascader-panel/index.js +1 -1
  134. package/packages/cascader-panel/src/cascader-menu.vue +128 -128
  135. package/packages/cascader-panel/src/cascader-node.vue +244 -244
  136. package/packages/cascader-panel/src/cascader-panel.vue +334 -334
  137. package/packages/cascader-panel/src/node.js +157 -158
  138. package/packages/cascader-panel/src/store.js +49 -50
  139. package/packages/checkbox/index.js +1 -1
  140. package/packages/checkbox/src/checkbox-button.vue +195 -195
  141. package/packages/checkbox/src/checkbox-group.vue +43 -43
  142. package/packages/checkbox/src/checkbox.vue +218 -218
  143. package/packages/checkbox-button/index.js +1 -1
  144. package/packages/checkbox-group/index.js +1 -1
  145. package/packages/col/index.js +1 -1
  146. package/packages/col/src/col.js +63 -63
  147. package/packages/collapse/index.js +1 -1
  148. package/packages/collapse/src/collapse-item.vue +101 -101
  149. package/packages/collapse/src/collapse.vue +61 -61
  150. package/packages/collapse-item/index.js +1 -1
  151. package/packages/color-picker/index.js +1 -1
  152. package/packages/color-picker/src/color.js +263 -263
  153. package/packages/color-picker/src/components/alpha-slider.vue +127 -127
  154. package/packages/color-picker/src/components/hue-slider.vue +118 -118
  155. package/packages/color-picker/src/components/picker-dropdown.vue +105 -105
  156. package/packages/color-picker/src/components/predefine.vue +55 -55
  157. package/packages/color-picker/src/components/sv-panel.vue +95 -95
  158. package/packages/color-picker/src/draggable.js +27 -27
  159. package/packages/color-picker/src/main.vue +183 -183
  160. package/packages/container/index.js +1 -1
  161. package/packages/container/src/main.vue +25 -25
  162. package/packages/date-picker/index.js +1 -1
  163. package/packages/date-picker/src/basic/date-table.vue +435 -435
  164. package/packages/date-picker/src/basic/month-table.vue +239 -240
  165. package/packages/date-picker/src/basic/time-spinner.vue +279 -279
  166. package/packages/date-picker/src/basic/year-table.vue +99 -99
  167. package/packages/date-picker/src/panel/date-range.vue +675 -675
  168. package/packages/date-picker/src/panel/date.vue +604 -604
  169. package/packages/date-picker/src/panel/month-range.vue +260 -260
  170. package/packages/date-picker/src/panel/time-range.vue +242 -242
  171. package/packages/date-picker/src/panel/time-select.vue +173 -173
  172. package/packages/date-picker/src/panel/time.vue +181 -181
  173. package/packages/date-picker/src/picker/date-picker.js +29 -29
  174. package/packages/date-picker/src/picker/time-picker.js +28 -28
  175. package/packages/date-picker/src/picker/time-select.js +12 -12
  176. package/packages/date-picker/src/picker.vue +900 -900
  177. package/packages/descriptions/index.js +1 -1
  178. package/packages/descriptions/src/descriptions-item.js +28 -28
  179. package/packages/descriptions/src/descriptions-row.js +114 -114
  180. package/packages/descriptions/src/index.js +168 -168
  181. package/packages/descriptions-item/index.js +1 -1
  182. package/packages/dialog/index.js +1 -1
  183. package/packages/dialog/src/component.vue +207 -207
  184. package/packages/divider/index.js +1 -1
  185. package/packages/divider/src/main.vue +29 -29
  186. package/packages/drawer/index.js +1 -1
  187. package/packages/drawer/src/main.vue +195 -195
  188. package/packages/dropdown/index.js +1 -1
  189. package/packages/dropdown/src/dropdown-item.vue +29 -29
  190. package/packages/dropdown/src/dropdown-menu.vue +59 -59
  191. package/packages/dropdown/src/dropdown.vue +271 -271
  192. package/packages/dropdown-item/index.js +1 -1
  193. package/packages/dropdown-menu/index.js +1 -1
  194. package/packages/empty/index.js +1 -1
  195. package/packages/empty/src/img-empty.vue +124 -124
  196. package/packages/empty/src/index.vue +40 -40
  197. package/packages/footer/index.js +1 -1
  198. package/packages/footer/src/main.vue +13 -13
  199. package/packages/form/index.js +1 -1
  200. package/packages/form/src/form-item.vue +294 -294
  201. package/packages/form/src/form.vue +169 -169
  202. package/packages/form/src/label-wrap.vue +65 -65
  203. package/packages/form-item/index.js +1 -1
  204. package/packages/header/index.js +1 -1
  205. package/packages/header/src/main.vue +13 -13
  206. package/packages/icon/index.js +1 -1
  207. package/packages/icon/src/icon.vue +7 -7
  208. package/packages/image/index.js +1 -1
  209. package/packages/image/src/image-viewer.vue +309 -309
  210. package/packages/image/src/main.vue +242 -242
  211. package/packages/infinite-scroll/index.js +1 -1
  212. package/packages/infinite-scroll/src/main.js +113 -114
  213. package/packages/input/index.js +1 -1
  214. package/packages/input/src/calcTextareaHeight.js +70 -70
  215. package/packages/input/src/input.vue +416 -416
  216. package/packages/input-number/index.js +1 -1
  217. package/packages/input-number/src/input-number.vue +272 -272
  218. package/packages/link/index.js +1 -1
  219. package/packages/link/src/main.vue +40 -40
  220. package/packages/loading/index.js +6 -6
  221. package/packages/loading/src/directive.js +105 -105
  222. package/packages/loading/src/index.js +74 -74
  223. package/packages/loading/src/loading.vue +35 -35
  224. package/packages/main/index.js +1 -1
  225. package/packages/main/src/main.vue +7 -7
  226. package/packages/menu/index.js +1 -1
  227. package/packages/menu/src/menu-item-group.vue +38 -38
  228. package/packages/menu/src/menu-item.vue +103 -103
  229. package/packages/menu/src/menu-mixin.js +39 -39
  230. package/packages/menu/src/menu.vue +298 -298
  231. package/packages/menu/src/submenu.vue +330 -331
  232. package/packages/menu-item/index.js +1 -1
  233. package/packages/menu-item-group/index.js +1 -1
  234. package/packages/message/src/main.js +65 -65
  235. package/packages/message/src/main.vue +105 -105
  236. package/packages/message-box/src/main.js +172 -172
  237. package/packages/message-box/src/main.vue +309 -309
  238. package/packages/notification/src/main.js +63 -63
  239. package/packages/notification/src/main.vue +135 -135
  240. package/packages/option/index.js +1 -1
  241. package/packages/option-group/index.js +1 -1
  242. package/packages/page-header/index.js +1 -1
  243. package/packages/page-header/src/main.vue +21 -21
  244. package/packages/pagination/index.js +1 -1
  245. package/packages/pagination/src/pager.vue +158 -158
  246. package/packages/pagination/src/pagination.js +377 -377
  247. package/packages/popconfirm/index.js +1 -1
  248. package/packages/popconfirm/src/main.vue +94 -94
  249. package/packages/popover/index.js +2 -2
  250. package/packages/popover/src/directive.js +15 -15
  251. package/packages/popover/src/main.vue +214 -214
  252. package/packages/progress/index.js +1 -1
  253. package/packages/progress/src/progress.vue +228 -228
  254. package/packages/radio/index.js +1 -1
  255. package/packages/radio/src/radio-button.vue +106 -106
  256. package/packages/radio/src/radio-group.vue +101 -101
  257. package/packages/radio/src/radio.vue +122 -122
  258. package/packages/radio-button/index.js +1 -1
  259. package/packages/radio-group/index.js +1 -1
  260. package/packages/rate/index.js +1 -1
  261. package/packages/rate/src/main.vue +316 -316
  262. package/packages/result/index.js +1 -1
  263. package/packages/result/src/icon-error.vue +6 -6
  264. package/packages/result/src/icon-info.vue +6 -6
  265. package/packages/result/src/icon-success.vue +6 -6
  266. package/packages/result/src/icon-warning.vue +6 -6
  267. package/packages/result/src/index.vue +51 -51
  268. package/packages/row/index.js +1 -1
  269. package/packages/row/src/row.js +36 -36
  270. package/packages/scrollbar/index.js +1 -1
  271. package/packages/scrollbar/src/bar.js +86 -86
  272. package/packages/scrollbar/src/main.js +120 -120
  273. package/packages/scrollbar/src/util.js +27 -27
  274. package/packages/select/index.js +1 -1
  275. package/packages/select/src/navigation-mixin.js +47 -47
  276. package/packages/select/src/option-group.vue +55 -55
  277. package/packages/select/src/option.vue +163 -163
  278. package/packages/select/src/select-dropdown.vue +57 -57
  279. package/packages/select/src/select.vue +895 -895
  280. package/packages/selectDisplayInput/index.js +1 -1
  281. package/packages/selectDisplayInput/src/main.vue +61 -61
  282. package/packages/skeleton/index.js +1 -1
  283. package/packages/skeleton/src/img-placeholder.vue +9 -9
  284. package/packages/skeleton/src/index.vue +70 -70
  285. package/packages/skeleton/src/item.vue +17 -17
  286. package/packages/skeleton-item/index.js +1 -1
  287. package/packages/slider/index.js +1 -1
  288. package/packages/slider/src/button.vue +230 -230
  289. package/packages/slider/src/main.vue +422 -422
  290. package/packages/slider/src/marker.js +14 -14
  291. package/packages/spinner/index.js +1 -1
  292. package/packages/spinner/src/spinner.vue +23 -23
  293. package/packages/statistic/index.js +1 -1
  294. package/packages/statistic/src/main.vue +196 -197
  295. package/packages/step/index.js +1 -1
  296. package/packages/steps/index.js +1 -1
  297. package/packages/steps/src/step.vue +177 -177
  298. package/packages/steps/src/steps.vue +53 -53
  299. package/packages/subTitle/index.js +1 -1
  300. package/packages/subTitle/src/main.vue +29 -29
  301. package/packages/submenu/index.js +1 -1
  302. package/packages/switch/index.js +1 -1
  303. package/packages/switch/src/component.vue +169 -169
  304. package/packages/tab-pane/index.js +1 -1
  305. package/packages/tabDialog/index.js +10 -10
  306. package/packages/tabDialog/src/dialog/drag.js +50 -50
  307. package/packages/tabDialog/src/dialog/dragHeight.js +27 -27
  308. package/packages/tabDialog/src/dialog/dragWidth.js +23 -23
  309. package/packages/tabDialog/src/main.vue +257 -257
  310. package/packages/table/index.js +1 -1
  311. package/packages/table/src/config.js +108 -108
  312. package/packages/table/src/dropdown.js +19 -19
  313. package/packages/table/src/filter-panel.vue +189 -189
  314. package/packages/table/src/layout-observer.js +60 -60
  315. package/packages/table/src/store/current.js +65 -65
  316. package/packages/table/src/store/expand.js +57 -57
  317. package/packages/table/src/store/helper.js +32 -32
  318. package/packages/table/src/store/index.js +133 -133
  319. package/packages/table/src/store/tree.js +194 -194
  320. package/packages/table/src/store/watcher.js +366 -366
  321. package/packages/table/src/table-body.js +456 -456
  322. package/packages/table/src/table-column.js +311 -311
  323. package/packages/table/src/table-footer.js +139 -139
  324. package/packages/table/src/table-header.js +496 -496
  325. package/packages/table/src/table-layout.js +241 -241
  326. package/packages/table/src/table-row.js +97 -97
  327. package/packages/table/src/table.vue +666 -666
  328. package/packages/table/src/util.js +214 -214
  329. package/packages/table-column/index.js +1 -1
  330. package/packages/tabs/index.js +1 -1
  331. package/packages/tabs/src/tab-bar.vue +47 -47
  332. package/packages/tabs/src/tab-nav.vue +268 -268
  333. package/packages/tabs/src/tab-pane.vue +47 -47
  334. package/packages/tabs/src/tabs.vue +174 -174
  335. package/packages/tag/index.js +1 -1
  336. package/packages/tag/src/tag.vue +55 -55
  337. package/packages/theme-chalk/gulpfile.js +11 -11
  338. package/packages/theme-chalk/src/alert.scss +138 -138
  339. package/packages/theme-chalk/src/aside.scss +3 -3
  340. package/packages/theme-chalk/src/autocomplete.scss +58 -58
  341. package/packages/theme-chalk/src/avatar.scss +46 -46
  342. package/packages/theme-chalk/src/backtop.scss +16 -16
  343. package/packages/theme-chalk/src/badge.scss +47 -47
  344. package/packages/theme-chalk/src/breadcrumb.scss +49 -49
  345. package/packages/theme-chalk/src/button.scss +229 -229
  346. package/packages/theme-chalk/src/calendar.scss +57 -57
  347. package/packages/theme-chalk/src/card.scss +23 -23
  348. package/packages/theme-chalk/src/carousel-item.scss +41 -41
  349. package/packages/theme-chalk/src/carousel.scss +148 -148
  350. package/packages/theme-chalk/src/cascader-panel.scss +106 -106
  351. package/packages/theme-chalk/src/cascader.scss +173 -173
  352. package/packages/theme-chalk/src/checkbox.scss +346 -346
  353. package/packages/theme-chalk/src/col.scss +130 -130
  354. package/packages/theme-chalk/src/collapse.scss +52 -52
  355. package/packages/theme-chalk/src/color-picker.scss +364 -364
  356. package/packages/theme-chalk/src/common/popup.scss +22 -22
  357. package/packages/theme-chalk/src/common/transition.scss +33 -33
  358. package/packages/theme-chalk/src/common/var.scss +16 -16
  359. package/packages/theme-chalk/src/container.scss +9 -9
  360. package/packages/theme-chalk/src/cy/base.scss +1 -1
  361. package/packages/theme-chalk/src/date-picker/date-picker.scss +91 -91
  362. package/packages/theme-chalk/src/date-picker/date-range-picker.scss +97 -97
  363. package/packages/theme-chalk/src/date-picker/date-table.scss +146 -146
  364. package/packages/theme-chalk/src/date-picker/month-table.scss +69 -69
  365. package/packages/theme-chalk/src/date-picker/picker-panel.scss +105 -105
  366. package/packages/theme-chalk/src/date-picker/picker.scss +188 -188
  367. package/packages/theme-chalk/src/date-picker/time-picker.scss +72 -72
  368. package/packages/theme-chalk/src/date-picker/time-range-picker.scss +23 -23
  369. package/packages/theme-chalk/src/date-picker/time-spinner.scss +106 -106
  370. package/packages/theme-chalk/src/date-picker/year-table.scss +47 -47
  371. package/packages/theme-chalk/src/descriptions-item.scss +33 -33
  372. package/packages/theme-chalk/src/descriptions.scss +105 -105
  373. package/packages/theme-chalk/src/dialog.scss +104 -104
  374. package/packages/theme-chalk/src/display.scss +7 -7
  375. package/packages/theme-chalk/src/divider.scss +36 -36
  376. package/packages/theme-chalk/src/drawer.scss +185 -185
  377. package/packages/theme-chalk/src/dropdown.scss +172 -172
  378. package/packages/theme-chalk/src/empty.scss +34 -34
  379. package/packages/theme-chalk/src/footer.scss +3 -3
  380. package/packages/theme-chalk/src/form.scss +149 -149
  381. package/packages/theme-chalk/src/header.scss +3 -3
  382. package/packages/theme-chalk/src/icon.scss +309 -309
  383. package/packages/theme-chalk/src/image.scss +153 -153
  384. package/packages/theme-chalk/src/input-number.scss +255 -255
  385. package/packages/theme-chalk/src/input.scss +345 -345
  386. package/packages/theme-chalk/src/link.scss +67 -67
  387. package/packages/theme-chalk/src/loading.scss +67 -67
  388. package/packages/theme-chalk/src/main.scss +7 -7
  389. package/packages/theme-chalk/src/menu.scss +248 -248
  390. package/packages/theme-chalk/src/message-box.scss +205 -205
  391. package/packages/theme-chalk/src/message.scss +111 -111
  392. package/packages/theme-chalk/src/mixins/_button.scss +64 -64
  393. package/packages/theme-chalk/src/mixins/function.scss +18 -18
  394. package/packages/theme-chalk/src/mixins/mixins.scss +126 -126
  395. package/packages/theme-chalk/src/mixins/utils.scss +26 -26
  396. package/packages/theme-chalk/src/notification.scss +88 -88
  397. package/packages/theme-chalk/src/option-group.scss +31 -31
  398. package/packages/theme-chalk/src/option.scss +27 -27
  399. package/packages/theme-chalk/src/page-header.scss +31 -31
  400. package/packages/theme-chalk/src/pagination.scss +284 -284
  401. package/packages/theme-chalk/src/popconfirm.scss +11 -11
  402. package/packages/theme-chalk/src/popover.scss +30 -30
  403. package/packages/theme-chalk/src/popper.scss +82 -82
  404. package/packages/theme-chalk/src/progress.scss +128 -128
  405. package/packages/theme-chalk/src/radio-button.scss +94 -94
  406. package/packages/theme-chalk/src/radio-group.scss +4 -4
  407. package/packages/theme-chalk/src/radio.scss +192 -192
  408. package/packages/theme-chalk/src/rate.scss +38 -38
  409. package/packages/theme-chalk/src/reset.scss +39 -39
  410. package/packages/theme-chalk/src/result.scss +56 -56
  411. package/packages/theme-chalk/src/row.scss +31 -31
  412. package/packages/theme-chalk/src/scrollbar.scss +57 -57
  413. package/packages/theme-chalk/src/select-dropdown.scss +47 -47
  414. package/packages/theme-chalk/src/select.scss +140 -140
  415. package/packages/theme-chalk/src/skeleton-item.scss +75 -75
  416. package/packages/theme-chalk/src/skeleton.scss +27 -27
  417. package/packages/theme-chalk/src/slider.scss +238 -238
  418. package/packages/theme-chalk/src/spinner.scss +27 -27
  419. package/packages/theme-chalk/src/statistic.scss +32 -32
  420. package/packages/theme-chalk/src/step.scss +312 -312
  421. package/packages/theme-chalk/src/steps.scss +13 -13
  422. package/packages/theme-chalk/src/switch.scss +101 -101
  423. package/packages/theme-chalk/src/table-column.scss +87 -87
  424. package/packages/theme-chalk/src/table.scss +556 -556
  425. package/packages/theme-chalk/src/tabs.scss +576 -576
  426. package/packages/theme-chalk/src/tag.scss +155 -155
  427. package/packages/theme-chalk/src/time-select.scss +14 -14
  428. package/packages/theme-chalk/src/timeline-item.scss +71 -71
  429. package/packages/theme-chalk/src/timeline.scss +8 -8
  430. package/packages/theme-chalk/src/tooltip.scss +136 -136
  431. package/packages/theme-chalk/src/transfer.scss +214 -214
  432. package/packages/theme-chalk/src/tree.scss +110 -110
  433. package/packages/theme-chalk/src/upload.scss +587 -587
  434. package/packages/time-picker/index.js +1 -1
  435. package/packages/time-select/index.js +1 -1
  436. package/packages/timeline/index.js +1 -1
  437. package/packages/timeline/src/item.vue +56 -56
  438. package/packages/timeline/src/main.vue +28 -28
  439. package/packages/timeline-item/index.js +1 -1
  440. package/packages/tooltip/index.js +1 -1
  441. package/packages/tooltip/src/main.js +234 -234
  442. package/packages/transfer/index.js +1 -1
  443. package/packages/transfer/src/main.vue +225 -225
  444. package/packages/transfer/src/transfer-panel.vue +245 -245
  445. package/packages/tree/index.js +1 -1
  446. package/packages/tree/src/model/node.js +467 -467
  447. package/packages/tree/src/model/tree-store.js +335 -335
  448. package/packages/tree/src/model/util.js +17 -17
  449. package/packages/tree/src/tree-node.vue +247 -247
  450. package/packages/tree/src/tree.vue +491 -491
  451. package/packages/treeSelect/index.js +1 -1
  452. package/packages/treeSelect/src/main.vue +275 -275
  453. package/packages/upload/index.js +1 -1
  454. package/packages/upload/src/ajax.js +77 -77
  455. package/packages/upload/src/index.vue +304 -304
  456. package/packages/upload/src/upload-dragger.vue +65 -65
  457. package/packages/upload/src/upload-list.vue +96 -96
  458. package/packages/upload/src/upload.vue +194 -194
  459. package/src/directives/mousewheel.js +9 -9
  460. package/src/directives/repeat-click.js +20 -20
  461. package/src/index.js +209 -210
  462. package/src/locale/format.js +24 -25
  463. package/src/locale/index.js +25 -25
  464. package/src/locale/lang/en.js +121 -121
  465. package/src/locale/lang/zh-CN.js +121 -121
  466. package/src/locale/lang/zh-TW.js +121 -121
  467. package/src/mixins/emitter.js +26 -26
  468. package/src/mixins/focus.js +7 -7
  469. package/src/mixins/locale.js +5 -5
  470. package/src/mixins/migrating.js +28 -28
  471. package/src/transitions/collapse-transition.js +60 -60
  472. package/src/utils/after-leave.js +17 -17
  473. package/src/utils/aria-dialog.js +48 -48
  474. package/src/utils/aria-utils.js +64 -64
  475. package/src/utils/clickoutside.js +34 -34
  476. package/src/utils/date-util.js +163 -163
  477. package/src/utils/dom.js +165 -165
  478. package/src/utils/menu/aria-menubar.js +5 -5
  479. package/src/utils/menu/aria-menuitem.js +36 -36
  480. package/src/utils/menu/aria-submenu.js +44 -44
  481. package/src/utils/merge.js +12 -12
  482. package/src/utils/popup/index.js +203 -203
  483. package/src/utils/popup/popup-manager.js +169 -169
  484. package/src/utils/resize-event.js +20 -20
  485. package/src/utils/scroll-into-view.js +20 -20
  486. package/src/utils/scrollbar-width.js +18 -18
  487. package/src/utils/shared.js +3 -3
  488. package/src/utils/types.js +12 -12
  489. package/src/utils/util.js +157 -157
  490. package/src/utils/vdom.js +1 -1
  491. package/src/utils/vue-popper.js +179 -179
  492. package/lib/directives/mousewheel.js +0 -26
  493. package/lib/directives/repeat-click.js +0 -33
  494. package/lib/locale/format.js +0 -56
  495. package/lib/locale/index.js +0 -63
  496. package/lib/locale/lang/en.js +0 -126
  497. package/lib/locale/lang/zh-CN.js +0 -126
  498. package/lib/locale/lang/zh-TW.js +0 -126
  499. package/lib/mixins/emitter.js +0 -36
  500. package/lib/mixins/focus.js +0 -15
  501. package/lib/mixins/locale.js +0 -17
  502. package/lib/mixins/migrating.js +0 -69
  503. package/lib/transitions/collapse-transition.js +0 -91
  504. package/lib/utils/after-leave.js +0 -35
  505. package/lib/utils/aria-dialog.js +0 -104
  506. package/lib/utils/aria-utils.js +0 -126
  507. package/lib/utils/clickoutside.js +0 -79
  508. package/lib/utils/date-util.js +0 -310
  509. package/lib/utils/date.js +0 -369
  510. package/lib/utils/dom.js +0 -234
  511. package/lib/utils/lodash.js +0 -9421
  512. package/lib/utils/menu/aria-menubar.js +0 -24
  513. package/lib/utils/menu/aria-menuitem.js +0 -62
  514. package/lib/utils/menu/aria-submenu.js +0 -69
  515. package/lib/utils/merge.js +0 -21
  516. package/lib/utils/popper.js +0 -1261
  517. package/lib/utils/popup/index.js +0 -233
  518. package/lib/utils/popup/popup-manager.js +0 -205
  519. package/lib/utils/resize-event.js +0 -59
  520. package/lib/utils/scroll-into-view.js +0 -38
  521. package/lib/utils/scrollbar-width.js +0 -39
  522. package/lib/utils/shared.js +0 -12
  523. package/lib/utils/types.js +0 -52
  524. package/lib/utils/util.js +0 -272
  525. package/lib/utils/vdom.js +0 -13
  526. package/lib/utils/vue-popper.js +0 -202
@@ -1,1261 +0,0 @@
1
- 'use strict';
2
-
3
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4
-
5
- /**
6
- * @fileOverview Kickass library to create and place poppers near their reference elements.
7
- * @version {{version}}
8
- * @license
9
- * Copyright (c) 2016 Federico Zivolo and contributors
10
- *
11
- * Permission is hereby granted, free of charge, to any person obtaining a copy
12
- * of this software and associated documentation files (the "Software"), to deal
13
- * in the Software without restriction, including without limitation the rights
14
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
- * copies of the Software, and to permit persons to whom the Software is
16
- * furnished to do so, subject to the following conditions:
17
- *
18
- * The above copyright notice and this permission notice shall be included in all
19
- * copies or substantial portions of the Software.
20
- *
21
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
- * SOFTWARE.
28
- */
29
-
30
- //
31
- // Cross module loader
32
- // Supported: Node, AMD, Browser globals
33
- //
34
- ;(function (root, factory) {
35
- if (typeof define === 'function' && define.amd) {
36
- // AMD. Register as an anonymous module.
37
- define(factory);
38
- } else if ((typeof module === 'undefined' ? 'undefined' : _typeof(module)) === 'object' && module.exports) {
39
- // Node. Does not work with strict CommonJS, but
40
- // only CommonJS-like environments that support module.exports,
41
- // like Node.
42
- module.exports = factory();
43
- } else {
44
- // Browser globals (root is window)
45
- root.Popper = factory();
46
- }
47
- })(undefined, function () {
48
-
49
- 'use strict';
50
-
51
- var root = window;
52
-
53
- // default options
54
- var DEFAULTS = {
55
- // placement of the popper
56
- placement: 'bottom',
57
-
58
- gpuAcceleration: true,
59
-
60
- // shift popper from its origin by the given amount of pixels (can be negative)
61
- offset: 0,
62
-
63
- // the element which will act as boundary of the popper
64
- boundariesElement: 'viewport',
65
-
66
- // amount of pixel used to define a minimum distance between the boundaries and the popper
67
- boundariesPadding: 5,
68
-
69
- // popper will try to prevent overflow following this order,
70
- // by default, then, it could overflow on the left and on top of the boundariesElement
71
- preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
72
-
73
- // the behavior used by flip to change the placement of the popper
74
- flipBehavior: 'flip',
75
-
76
- arrowElement: '[x-arrow]',
77
-
78
- arrowOffset: 0,
79
-
80
- // list of functions used to modify the offsets before they are applied to the popper
81
- modifiers: ['shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle'],
82
-
83
- modifiersIgnored: [],
84
-
85
- forceAbsolute: false
86
- };
87
-
88
- /**
89
- * Create a new Popper.js instance
90
- * @constructor Popper
91
- * @param {HTMLElement} reference - The reference element used to position the popper
92
- * @param {HTMLElement|Object} popper
93
- * The HTML element used as popper, or a configuration used to generate the popper.
94
- * @param {String} [popper.tagName='div'] The tag name of the generated popper.
95
- * @param {Array} [popper.classNames=['popper']] Array of classes to apply to the generated popper.
96
- * @param {Array} [popper.attributes] Array of attributes to apply, specify `attr:value` to assign a value to it.
97
- * @param {HTMLElement|String} [popper.parent=window.document.body] The parent element, given as HTMLElement or as query string.
98
- * @param {String} [popper.content=''] The content of the popper, it can be text, html, or node; if it is not text, set `contentType` to `html` or `node`.
99
- * @param {String} [popper.contentType='text'] If `html`, the `content` will be parsed as HTML. If `node`, it will be appended as-is.
100
- * @param {String} [popper.arrowTagName='div'] Same as `popper.tagName` but for the arrow element.
101
- * @param {Array} [popper.arrowClassNames='popper__arrow'] Same as `popper.classNames` but for the arrow element.
102
- * @param {String} [popper.arrowAttributes=['x-arrow']] Same as `popper.attributes` but for the arrow element.
103
- * @param {Object} options
104
- * @param {String} [options.placement=bottom]
105
- * Placement of the popper accepted values: `top(-start, -end), right(-start, -end), bottom(-start, -right),
106
- * left(-start, -end)`
107
- *
108
- * @param {HTMLElement|String} [options.arrowElement='[x-arrow]']
109
- * The DOM Node used as arrow for the popper, or a CSS selector used to get the DOM node. It must be child of
110
- * its parent Popper. Popper.js will apply to the given element the style required to align the arrow with its
111
- * reference element.
112
- * By default, it will look for a child node of the popper with the `x-arrow` attribute.
113
- *
114
- * @param {Boolean} [options.gpuAcceleration=true]
115
- * When this property is set to true, the popper position will be applied using CSS3 translate3d, allowing the
116
- * browser to use the GPU to accelerate the rendering.
117
- * If set to false, the popper will be placed using `top` and `left` properties, not using the GPU.
118
- *
119
- * @param {Number} [options.offset=0]
120
- * Amount of pixels the popper will be shifted (can be negative).
121
- *
122
- * @param {String|Element} [options.boundariesElement='viewport']
123
- * The element which will define the boundaries of the popper position, the popper will never be placed outside
124
- * of the defined boundaries (except if `keepTogether` is enabled)
125
- *
126
- * @param {Number} [options.boundariesPadding=5]
127
- * Additional padding for the boundaries
128
- *
129
- * @param {Array} [options.preventOverflowOrder=['left', 'right', 'top', 'bottom']]
130
- * Order used when Popper.js tries to avoid overflows from the boundaries, they will be checked in order,
131
- * this means that the last ones will never overflow
132
- *
133
- * @param {String|Array} [options.flipBehavior='flip']
134
- * The behavior used by the `flip` modifier to change the placement of the popper when the latter is trying to
135
- * overlap its reference element. Defining `flip` as value, the placement will be flipped on
136
- * its axis (`right - left`, `top - bottom`).
137
- * You can even pass an array of placements (eg: `['right', 'left', 'top']` ) to manually specify
138
- * how alter the placement when a flip is needed. (eg. in the above example, it would first flip from right to left,
139
- * then, if even in its new placement, the popper is overlapping its reference element, it will be moved to top)
140
- *
141
- * @param {Array} [options.modifiers=[ 'shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle']]
142
- * List of functions used to modify the data before they are applied to the popper, add your custom functions
143
- * to this array to edit the offsets and placement.
144
- * The function should reflect the @params and @returns of preventOverflow
145
- *
146
- * @param {Array} [options.modifiersIgnored=[]]
147
- * Put here any built-in modifier name you want to exclude from the modifiers list
148
- * The function should reflect the @params and @returns of preventOverflow
149
- *
150
- * @param {Boolean} [options.removeOnDestroy=false]
151
- * Set to true if you want to automatically remove the popper when you call the `destroy` method.
152
- */
153
- function Popper(reference, popper, options) {
154
- this._reference = reference.jquery ? reference[0] : reference;
155
- this.state = {};
156
-
157
- // if the popper variable is a configuration object, parse it to generate an HTMLElement
158
- // generate a default popper if is not defined
159
- var isNotDefined = typeof popper === 'undefined' || popper === null;
160
- var isConfig = popper && Object.prototype.toString.call(popper) === '[object Object]';
161
- if (isNotDefined || isConfig) {
162
- this._popper = this.parse(isConfig ? popper : {});
163
- }
164
- // otherwise, use the given HTMLElement as popper
165
- else {
166
- this._popper = popper.jquery ? popper[0] : popper;
167
- }
168
-
169
- // with {} we create a new object with the options inside it
170
- this._options = Object.assign({}, DEFAULTS, options);
171
-
172
- // refactoring modifiers' list
173
- this._options.modifiers = this._options.modifiers.map(function (modifier) {
174
- // remove ignored modifiers
175
- if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
176
-
177
- // set the x-placement attribute before everything else because it could be used to add margins to the popper
178
- // margins needs to be calculated to get the correct popper offsets
179
- if (modifier === 'applyStyle') {
180
- this._popper.setAttribute('x-placement', this._options.placement);
181
- }
182
-
183
- // return predefined modifier identified by string or keep the custom one
184
- return this.modifiers[modifier] || modifier;
185
- }.bind(this));
186
-
187
- // make sure to apply the popper position before any computation
188
- this.state.position = this._getPosition(this._popper, this._reference);
189
- setStyle(this._popper, { position: this.state.position, top: 0 });
190
-
191
- // fire the first update to position the popper in the right place
192
- this.update();
193
-
194
- // setup event listeners, they will take care of update the position in specific situations
195
- this._setupEventListeners();
196
- return this;
197
- }
198
-
199
- //
200
- // Methods
201
- //
202
- /**
203
- * Destroy the popper
204
- * @method
205
- * @memberof Popper
206
- */
207
- Popper.prototype.destroy = function () {
208
- this._popper.removeAttribute('x-placement');
209
- this._popper.style.left = '';
210
- this._popper.style.position = '';
211
- this._popper.style.top = '';
212
- this._popper.style[getSupportedPropertyName('transform')] = '';
213
- this._removeEventListeners();
214
-
215
- // remove the popper if user explicity asked for the deletion on destroy
216
- if (this._options.removeOnDestroy) {
217
- this._popper.remove();
218
- }
219
- return this;
220
- };
221
-
222
- /**
223
- * Updates the position of the popper, computing the new offsets and applying the new style
224
- * @method
225
- * @memberof Popper
226
- */
227
- Popper.prototype.update = function () {
228
- var data = { instance: this, styles: {} };
229
-
230
- // store placement inside the data object, modifiers will be able to edit `placement` if needed
231
- // and refer to _originalPlacement to know the original value
232
- data.placement = this._options.placement;
233
- data._originalPlacement = this._options.placement;
234
-
235
- // compute the popper and reference offsets and put them inside data.offsets
236
- data.offsets = this._getOffsets(this._popper, this._reference, data.placement);
237
-
238
- // get boundaries
239
- data.boundaries = this._getBoundaries(data, this._options.boundariesPadding, this._options.boundariesElement);
240
-
241
- data = this.runModifiers(data, this._options.modifiers);
242
-
243
- if (typeof this.state.updateCallback === 'function') {
244
- this.state.updateCallback(data);
245
- }
246
- };
247
-
248
- /**
249
- * If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.
250
- * @method
251
- * @memberof Popper
252
- * @param {Function} callback
253
- */
254
- Popper.prototype.onCreate = function (callback) {
255
- // the createCallbacks return as first argument the popper instance
256
- callback(this);
257
- return this;
258
- };
259
-
260
- /**
261
- * If a function is passed, it will be executed after each update of popper with as first argument the set of coordinates and informations
262
- * used to style popper and its arrow.
263
- * NOTE: it doesn't get fired on the first call of the `Popper.update()` method inside the `Popper` constructor!
264
- * @method
265
- * @memberof Popper
266
- * @param {Function} callback
267
- */
268
- Popper.prototype.onUpdate = function (callback) {
269
- this.state.updateCallback = callback;
270
- return this;
271
- };
272
-
273
- /**
274
- * Helper used to generate poppers from a configuration file
275
- * @method
276
- * @memberof Popper
277
- * @param config {Object} configuration
278
- * @returns {HTMLElement} popper
279
- */
280
- Popper.prototype.parse = function (config) {
281
- var defaultConfig = {
282
- tagName: 'div',
283
- classNames: ['popper'],
284
- attributes: [],
285
- parent: root.document.body,
286
- content: '',
287
- contentType: 'text',
288
- arrowTagName: 'div',
289
- arrowClassNames: ['popper__arrow'],
290
- arrowAttributes: ['x-arrow']
291
- };
292
- config = Object.assign({}, defaultConfig, config);
293
-
294
- var d = root.document;
295
-
296
- var popper = d.createElement(config.tagName);
297
- addClassNames(popper, config.classNames);
298
- addAttributes(popper, config.attributes);
299
- if (config.contentType === 'node') {
300
- popper.appendChild(config.content.jquery ? config.content[0] : config.content);
301
- } else if (config.contentType === 'html') {
302
- popper.innerHTML = config.content;
303
- } else {
304
- popper.textContent = config.content;
305
- }
306
-
307
- if (config.arrowTagName) {
308
- var arrow = d.createElement(config.arrowTagName);
309
- addClassNames(arrow, config.arrowClassNames);
310
- addAttributes(arrow, config.arrowAttributes);
311
- popper.appendChild(arrow);
312
- }
313
-
314
- var parent = config.parent.jquery ? config.parent[0] : config.parent;
315
-
316
- // if the given parent is a string, use it to match an element
317
- // if more than one element is matched, the first one will be used as parent
318
- // if no elements are matched, the script will throw an error
319
- if (typeof parent === 'string') {
320
- parent = d.querySelectorAll(config.parent);
321
- if (parent.length > 1) {
322
- console.warn('WARNING: the given `parent` query(' + config.parent + ') matched more than one element, the first one will be used');
323
- }
324
- if (parent.length === 0) {
325
- throw 'ERROR: the given `parent` doesn\'t exists!';
326
- }
327
- parent = parent[0];
328
- }
329
- // if the given parent is a DOM nodes list or an array of nodes with more than one element,
330
- // the first one will be used as parent
331
- if (parent.length > 1 && parent instanceof Element === false) {
332
- console.warn('WARNING: you have passed as parent a list of elements, the first one will be used');
333
- parent = parent[0];
334
- }
335
-
336
- // append the generated popper to its parent
337
- parent.appendChild(popper);
338
-
339
- return popper;
340
-
341
- /**
342
- * Adds class names to the given element
343
- * @function
344
- * @ignore
345
- * @param {HTMLElement} target
346
- * @param {Array} classes
347
- */
348
- function addClassNames(element, classNames) {
349
- classNames.forEach(function (className) {
350
- element.classList.add(className);
351
- });
352
- }
353
-
354
- /**
355
- * Adds attributes to the given element
356
- * @function
357
- * @ignore
358
- * @param {HTMLElement} target
359
- * @param {Array} attributes
360
- * @example
361
- * addAttributes(element, [ 'data-info:foobar' ]);
362
- */
363
- function addAttributes(element, attributes) {
364
- attributes.forEach(function (attribute) {
365
- element.setAttribute(attribute.split(':')[0], attribute.split(':')[1] || '');
366
- });
367
- }
368
- };
369
-
370
- /**
371
- * Helper used to get the position which will be applied to the popper
372
- * @method
373
- * @memberof Popper
374
- * @param config {HTMLElement} popper element
375
- * @param reference {HTMLElement} reference element
376
- * @returns {String} position
377
- */
378
- Popper.prototype._getPosition = function (popper, reference) {
379
- var container = getOffsetParent(reference);
380
-
381
- if (this._options.forceAbsolute) {
382
- return 'absolute';
383
- }
384
-
385
- // Decide if the popper will be fixed
386
- // If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
387
- var isParentFixed = isFixed(reference, container);
388
- return isParentFixed ? 'fixed' : 'absolute';
389
- };
390
-
391
- /**
392
- * Get offsets to the popper
393
- * @method
394
- * @memberof Popper
395
- * @access private
396
- * @param {Element} popper - the popper element
397
- * @param {Element} reference - the reference element (the popper will be relative to this)
398
- * @returns {Object} An object containing the offsets which will be applied to the popper
399
- */
400
- Popper.prototype._getOffsets = function (popper, reference, placement) {
401
- placement = placement.split('-')[0];
402
- var popperOffsets = {};
403
-
404
- popperOffsets.position = this.state.position;
405
- var isParentFixed = popperOffsets.position === 'fixed';
406
-
407
- //
408
- // Get reference element position
409
- //
410
- var referenceOffsets = getOffsetRectRelativeToCustomParent(reference, getOffsetParent(popper), isParentFixed);
411
-
412
- //
413
- // Get popper sizes
414
- //
415
- var popperRect = getOuterSizes(popper);
416
-
417
- //
418
- // Compute offsets of popper
419
- //
420
-
421
- // depending by the popper placement we have to compute its offsets slightly differently
422
- if (['right', 'left'].indexOf(placement) !== -1) {
423
- popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - popperRect.height / 2;
424
- if (placement === 'left') {
425
- popperOffsets.left = referenceOffsets.left - popperRect.width;
426
- } else {
427
- popperOffsets.left = referenceOffsets.right;
428
- }
429
- } else {
430
- popperOffsets.left = referenceOffsets.left + referenceOffsets.width / 2 - popperRect.width / 2;
431
- if (placement === 'top') {
432
- popperOffsets.top = referenceOffsets.top - popperRect.height;
433
- } else {
434
- popperOffsets.top = referenceOffsets.bottom;
435
- }
436
- }
437
-
438
- // Add width and height to our offsets object
439
- popperOffsets.width = popperRect.width;
440
- popperOffsets.height = popperRect.height;
441
-
442
- return {
443
- popper: popperOffsets,
444
- reference: referenceOffsets
445
- };
446
- };
447
-
448
- /**
449
- * Setup needed event listeners used to update the popper position
450
- * @method
451
- * @memberof Popper
452
- * @access private
453
- */
454
- Popper.prototype._setupEventListeners = function () {
455
- // NOTE: 1 DOM access here
456
- this.state.updateBound = this.update.bind(this);
457
- root.addEventListener('resize', this.state.updateBound);
458
- // if the boundariesElement is window we don't need to listen for the scroll event
459
- if (this._options.boundariesElement !== 'window') {
460
- var target = getScrollParent(this._reference);
461
- // here it could be both `body` or `documentElement` thanks to Firefox, we then check both
462
- if (target === root.document.body || target === root.document.documentElement) {
463
- target = root;
464
- }
465
- target.addEventListener('scroll', this.state.updateBound);
466
- this.state.scrollTarget = target;
467
- }
468
- };
469
-
470
- /**
471
- * Remove event listeners used to update the popper position
472
- * @method
473
- * @memberof Popper
474
- * @access private
475
- */
476
- Popper.prototype._removeEventListeners = function () {
477
- // NOTE: 1 DOM access here
478
- root.removeEventListener('resize', this.state.updateBound);
479
- if (this._options.boundariesElement !== 'window' && this.state.scrollTarget) {
480
- this.state.scrollTarget.removeEventListener('scroll', this.state.updateBound);
481
- this.state.scrollTarget = null;
482
- }
483
- this.state.updateBound = null;
484
- };
485
-
486
- /**
487
- * Computed the boundaries limits and return them
488
- * @method
489
- * @memberof Popper
490
- * @access private
491
- * @param {Object} data - Object containing the property "offsets" generated by `_getOffsets`
492
- * @param {Number} padding - Boundaries padding
493
- * @param {Element} boundariesElement - Element used to define the boundaries
494
- * @returns {Object} Coordinates of the boundaries
495
- */
496
- Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
497
- // NOTE: 1 DOM access here
498
- var boundaries = {};
499
- var width, height;
500
- if (boundariesElement === 'window') {
501
- var body = root.document.body,
502
- html = root.document.documentElement;
503
-
504
- height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
505
- width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
506
-
507
- boundaries = {
508
- top: 0,
509
- right: width,
510
- bottom: height,
511
- left: 0
512
- };
513
- } else if (boundariesElement === 'viewport') {
514
- var offsetParent = getOffsetParent(this._popper);
515
- var scrollParent = getScrollParent(this._popper);
516
- var offsetParentRect = getOffsetRect(offsetParent);
517
-
518
- // Thanks the fucking native API, `document.body.scrollTop` & `document.documentElement.scrollTop`
519
- var getScrollTopValue = function getScrollTopValue(element) {
520
- return element == document.body ? Math.max(document.documentElement.scrollTop, document.body.scrollTop) : element.scrollTop;
521
- };
522
- var getScrollLeftValue = function getScrollLeftValue(element) {
523
- return element == document.body ? Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) : element.scrollLeft;
524
- };
525
-
526
- // if the popper is fixed we don't have to substract scrolling from the boundaries
527
- var scrollTop = data.offsets.popper.position === 'fixed' ? 0 : getScrollTopValue(scrollParent);
528
- var scrollLeft = data.offsets.popper.position === 'fixed' ? 0 : getScrollLeftValue(scrollParent);
529
-
530
- boundaries = {
531
- top: 0 - (offsetParentRect.top - scrollTop),
532
- right: root.document.documentElement.clientWidth - (offsetParentRect.left - scrollLeft),
533
- bottom: root.document.documentElement.clientHeight - (offsetParentRect.top - scrollTop),
534
- left: 0 - (offsetParentRect.left - scrollLeft)
535
- };
536
- } else {
537
- if (getOffsetParent(this._popper) === boundariesElement) {
538
- boundaries = {
539
- top: 0,
540
- left: 0,
541
- right: boundariesElement.clientWidth,
542
- bottom: boundariesElement.clientHeight
543
- };
544
- } else {
545
- boundaries = getOffsetRect(boundariesElement);
546
- }
547
- }
548
- boundaries.left += padding;
549
- boundaries.right -= padding;
550
- boundaries.top = boundaries.top + padding;
551
- boundaries.bottom = boundaries.bottom - padding;
552
- return boundaries;
553
- };
554
-
555
- /**
556
- * Loop trough the list of modifiers and run them in order, each of them will then edit the data object
557
- * @method
558
- * @memberof Popper
559
- * @access public
560
- * @param {Object} data
561
- * @param {Array} modifiers
562
- * @param {Function} ends
563
- */
564
- Popper.prototype.runModifiers = function (data, modifiers, ends) {
565
- var modifiersToRun = modifiers.slice();
566
- if (ends !== undefined) {
567
- modifiersToRun = this._options.modifiers.slice(0, getArrayKeyIndex(this._options.modifiers, ends));
568
- }
569
-
570
- modifiersToRun.forEach(function (modifier) {
571
- if (isFunction(modifier)) {
572
- data = modifier.call(this, data);
573
- }
574
- }.bind(this));
575
-
576
- return data;
577
- };
578
-
579
- /**
580
- * Helper used to know if the given modifier depends from another one.
581
- * @method
582
- * @memberof Popper
583
- * @param {String} requesting - name of requesting modifier
584
- * @param {String} requested - name of requested modifier
585
- * @returns {Boolean}
586
- */
587
- Popper.prototype.isModifierRequired = function (requesting, requested) {
588
- var index = getArrayKeyIndex(this._options.modifiers, requesting);
589
- return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
590
- return modifier === requested;
591
- }).length;
592
- };
593
-
594
- //
595
- // Modifiers
596
- //
597
-
598
- /**
599
- * Modifiers list
600
- * @namespace Popper.modifiers
601
- * @memberof Popper
602
- * @type {Object}
603
- */
604
- Popper.prototype.modifiers = {};
605
-
606
- /**
607
- * Apply the computed styles to the popper element
608
- * @method
609
- * @memberof Popper.modifiers
610
- * @argument {Object} data - The data object generated by `update` method
611
- * @returns {Object} The same data object
612
- */
613
- Popper.prototype.modifiers.applyStyle = function (data) {
614
- // apply the final offsets to the popper
615
- // NOTE: 1 DOM access here
616
- var styles = {
617
- position: data.offsets.popper.position
618
- };
619
-
620
- // round top and left to avoid blurry text
621
- var left = Math.round(data.offsets.popper.left);
622
- var top = Math.round(data.offsets.popper.top);
623
-
624
- // if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
625
- // we automatically use the supported prefixed version if needed
626
- var prefixedProperty;
627
- if (this._options.gpuAcceleration && (prefixedProperty = getSupportedPropertyName('transform'))) {
628
- styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
629
- styles.top = 0;
630
- styles.left = 0;
631
- }
632
- // othwerise, we use the standard `left` and `top` properties
633
- else {
634
- styles.left = left;
635
- styles.top = top;
636
- }
637
-
638
- // any property present in `data.styles` will be applied to the popper,
639
- // in this way we can make the 3rd party modifiers add custom styles to it
640
- // Be aware, modifiers could override the properties defined in the previous
641
- // lines of this modifier!
642
- Object.assign(styles, data.styles);
643
-
644
- setStyle(this._popper, styles);
645
-
646
- // set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
647
- // NOTE: 1 DOM access here
648
- this._popper.setAttribute('x-placement', data.placement);
649
-
650
- // if the arrow modifier is required and the arrow style has been computed, apply the arrow style
651
- if (this.isModifierRequired(this.modifiers.applyStyle, this.modifiers.arrow) && data.offsets.arrow) {
652
- setStyle(data.arrowElement, data.offsets.arrow);
653
- }
654
-
655
- return data;
656
- };
657
-
658
- /**
659
- * Modifier used to shift the popper on the start or end of its reference element side
660
- * @method
661
- * @memberof Popper.modifiers
662
- * @argument {Object} data - The data object generated by `update` method
663
- * @returns {Object} The data object, properly modified
664
- */
665
- Popper.prototype.modifiers.shift = function (data) {
666
- var placement = data.placement;
667
- var basePlacement = placement.split('-')[0];
668
- var shiftVariation = placement.split('-')[1];
669
-
670
- // if shift shiftVariation is specified, run the modifier
671
- if (shiftVariation) {
672
- var reference = data.offsets.reference;
673
- var popper = getPopperClientRect(data.offsets.popper);
674
-
675
- var shiftOffsets = {
676
- y: {
677
- start: { top: reference.top },
678
- end: { top: reference.top + reference.height - popper.height }
679
- },
680
- x: {
681
- start: { left: reference.left },
682
- end: { left: reference.left + reference.width - popper.width }
683
- }
684
- };
685
-
686
- var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
687
-
688
- data.offsets.popper = Object.assign(popper, shiftOffsets[axis][shiftVariation]);
689
- }
690
-
691
- return data;
692
- };
693
-
694
- /**
695
- * Modifier used to make sure the popper does not overflows from it's boundaries
696
- * @method
697
- * @memberof Popper.modifiers
698
- * @argument {Object} data - The data object generated by `update` method
699
- * @returns {Object} The data object, properly modified
700
- */
701
- Popper.prototype.modifiers.preventOverflow = function (data) {
702
- var order = this._options.preventOverflowOrder;
703
- var popper = getPopperClientRect(data.offsets.popper);
704
-
705
- var check = {
706
- left: function left() {
707
- var left = popper.left;
708
- if (popper.left < data.boundaries.left) {
709
- left = Math.max(popper.left, data.boundaries.left);
710
- }
711
- return { left: left };
712
- },
713
- right: function right() {
714
- var left = popper.left;
715
- if (popper.right > data.boundaries.right) {
716
- left = Math.min(popper.left, data.boundaries.right - popper.width);
717
- }
718
- return { left: left };
719
- },
720
- top: function top() {
721
- var top = popper.top;
722
- if (popper.top < data.boundaries.top) {
723
- top = Math.max(popper.top, data.boundaries.top);
724
- }
725
- return { top: top };
726
- },
727
- bottom: function bottom() {
728
- var top = popper.top;
729
- if (popper.bottom > data.boundaries.bottom) {
730
- top = Math.min(popper.top, data.boundaries.bottom - popper.height);
731
- }
732
- return { top: top };
733
- }
734
- };
735
-
736
- order.forEach(function (direction) {
737
- data.offsets.popper = Object.assign(popper, check[direction]());
738
- });
739
-
740
- return data;
741
- };
742
-
743
- /**
744
- * Modifier used to make sure the popper is always near its reference
745
- * @method
746
- * @memberof Popper.modifiers
747
- * @argument {Object} data - The data object generated by _update method
748
- * @returns {Object} The data object, properly modified
749
- */
750
- Popper.prototype.modifiers.keepTogether = function (data) {
751
- var popper = getPopperClientRect(data.offsets.popper);
752
- var reference = data.offsets.reference;
753
- var f = Math.floor;
754
-
755
- if (popper.right < f(reference.left)) {
756
- data.offsets.popper.left = f(reference.left) - popper.width;
757
- }
758
- if (popper.left > f(reference.right)) {
759
- data.offsets.popper.left = f(reference.right);
760
- }
761
- if (popper.bottom < f(reference.top)) {
762
- data.offsets.popper.top = f(reference.top) - popper.height;
763
- }
764
- if (popper.top > f(reference.bottom)) {
765
- data.offsets.popper.top = f(reference.bottom);
766
- }
767
-
768
- return data;
769
- };
770
-
771
- /**
772
- * Modifier used to flip the placement of the popper when the latter is starting overlapping its reference element.
773
- * Requires the `preventOverflow` modifier before it in order to work.
774
- * **NOTE:** This modifier will run all its previous modifiers everytime it tries to flip the popper!
775
- * @method
776
- * @memberof Popper.modifiers
777
- * @argument {Object} data - The data object generated by _update method
778
- * @returns {Object} The data object, properly modified
779
- */
780
- Popper.prototype.modifiers.flip = function (data) {
781
- // check if preventOverflow is in the list of modifiers before the flip modifier.
782
- // otherwise flip would not work as expected.
783
- if (!this.isModifierRequired(this.modifiers.flip, this.modifiers.preventOverflow)) {
784
- console.warn('WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!');
785
- return data;
786
- }
787
-
788
- if (data.flipped && data.placement === data._originalPlacement) {
789
- // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
790
- return data;
791
- }
792
-
793
- var placement = data.placement.split('-')[0];
794
- var placementOpposite = getOppositePlacement(placement);
795
- var variation = data.placement.split('-')[1] || '';
796
-
797
- var flipOrder = [];
798
- if (this._options.flipBehavior === 'flip') {
799
- flipOrder = [placement, placementOpposite];
800
- } else {
801
- flipOrder = this._options.flipBehavior;
802
- }
803
-
804
- flipOrder.forEach(function (step, index) {
805
- if (placement !== step || flipOrder.length === index + 1) {
806
- return;
807
- }
808
-
809
- placement = data.placement.split('-')[0];
810
- placementOpposite = getOppositePlacement(placement);
811
-
812
- var popperOffsets = getPopperClientRect(data.offsets.popper);
813
-
814
- // this boolean is used to distinguish right and bottom from top and left
815
- // they need different computations to get flipped
816
- var a = ['right', 'bottom'].indexOf(placement) !== -1;
817
-
818
- // using Math.floor because the reference offsets may contain decimals we are not going to consider here
819
- if (a && Math.floor(data.offsets.reference[placement]) > Math.floor(popperOffsets[placementOpposite]) || !a && Math.floor(data.offsets.reference[placement]) < Math.floor(popperOffsets[placementOpposite])) {
820
- // we'll use this boolean to detect any flip loop
821
- data.flipped = true;
822
- data.placement = flipOrder[index + 1];
823
- if (variation) {
824
- data.placement += '-' + variation;
825
- }
826
- data.offsets.popper = this._getOffsets(this._popper, this._reference, data.placement).popper;
827
-
828
- data = this.runModifiers(data, this._options.modifiers, this._flip);
829
- }
830
- }.bind(this));
831
- return data;
832
- };
833
-
834
- /**
835
- * Modifier used to add an offset to the popper, useful if you more granularity positioning your popper.
836
- * The offsets will shift the popper on the side of its reference element.
837
- * @method
838
- * @memberof Popper.modifiers
839
- * @argument {Object} data - The data object generated by _update method
840
- * @returns {Object} The data object, properly modified
841
- */
842
- Popper.prototype.modifiers.offset = function (data) {
843
- var offset = this._options.offset;
844
- var popper = data.offsets.popper;
845
-
846
- if (data.placement.indexOf('left') !== -1) {
847
- popper.top -= offset;
848
- } else if (data.placement.indexOf('right') !== -1) {
849
- popper.top += offset;
850
- } else if (data.placement.indexOf('top') !== -1) {
851
- popper.left -= offset;
852
- } else if (data.placement.indexOf('bottom') !== -1) {
853
- popper.left += offset;
854
- }
855
- return data;
856
- };
857
-
858
- /**
859
- * Modifier used to move the arrows on the edge of the popper to make sure them are always between the popper and the reference element
860
- * It will use the CSS outer size of the arrow element to know how many pixels of conjuction are needed
861
- * @method
862
- * @memberof Popper.modifiers
863
- * @argument {Object} data - The data object generated by _update method
864
- * @returns {Object} The data object, properly modified
865
- */
866
- Popper.prototype.modifiers.arrow = function (data) {
867
- var arrow = this._options.arrowElement;
868
- var arrowOffset = this._options.arrowOffset;
869
-
870
- // if the arrowElement is a string, suppose it's a CSS selector
871
- if (typeof arrow === 'string') {
872
- arrow = this._popper.querySelector(arrow);
873
- }
874
-
875
- // if arrow element is not found, don't run the modifier
876
- if (!arrow) {
877
- return data;
878
- }
879
-
880
- // the arrow element must be child of its popper
881
- if (!this._popper.contains(arrow)) {
882
- console.warn('WARNING: `arrowElement` must be child of its popper element!');
883
- return data;
884
- }
885
-
886
- // arrow depends on keepTogether in order to work
887
- if (!this.isModifierRequired(this.modifiers.arrow, this.modifiers.keepTogether)) {
888
- console.warn('WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!');
889
- return data;
890
- }
891
-
892
- var arrowStyle = {};
893
- var placement = data.placement.split('-')[0];
894
- var popper = getPopperClientRect(data.offsets.popper);
895
- var reference = data.offsets.reference;
896
- var isVertical = ['left', 'right'].indexOf(placement) !== -1;
897
-
898
- var len = isVertical ? 'height' : 'width';
899
- var side = isVertical ? 'top' : 'left';
900
- var translate = isVertical ? 'translateY' : 'translateX';
901
- var altSide = isVertical ? 'left' : 'top';
902
- var opSide = isVertical ? 'bottom' : 'right';
903
- var arrowSize = getOuterSizes(arrow)[len];
904
-
905
- //
906
- // extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
907
- //
908
-
909
- // top/left side
910
- if (reference[opSide] - arrowSize < popper[side]) {
911
- data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowSize);
912
- }
913
- // bottom/right side
914
- if (reference[side] + arrowSize > popper[opSide]) {
915
- data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
916
- }
917
-
918
- // compute center of the popper
919
- var center = reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
920
-
921
- var sideValue = center - popper[side];
922
-
923
- // prevent arrow from being placed not contiguously to its popper
924
- sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
925
- arrowStyle[side] = sideValue;
926
- arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
927
-
928
- data.offsets.arrow = arrowStyle;
929
- data.arrowElement = arrow;
930
-
931
- return data;
932
- };
933
-
934
- //
935
- // Helpers
936
- //
937
-
938
- /**
939
- * Get the outer sizes of the given element (offset size + margins)
940
- * @function
941
- * @ignore
942
- * @argument {Element} element
943
- * @returns {Object} object containing width and height properties
944
- */
945
- function getOuterSizes(element) {
946
- // NOTE: 1 DOM access here
947
- var _display = element.style.display,
948
- _visibility = element.style.visibility;
949
- element.style.display = 'block';element.style.visibility = 'hidden';
950
- var calcWidthToForceRepaint = element.offsetWidth;
951
-
952
- // original method
953
- var styles = root.getComputedStyle(element);
954
- var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
955
- var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
956
- var result = { width: element.offsetWidth + y, height: element.offsetHeight + x };
957
-
958
- // reset element styles
959
- element.style.display = _display;element.style.visibility = _visibility;
960
- return result;
961
- }
962
-
963
- /**
964
- * Get the opposite placement of the given one/
965
- * @function
966
- * @ignore
967
- * @argument {String} placement
968
- * @returns {String} flipped placement
969
- */
970
- function getOppositePlacement(placement) {
971
- var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
972
- return placement.replace(/left|right|bottom|top/g, function (matched) {
973
- return hash[matched];
974
- });
975
- }
976
-
977
- /**
978
- * Given the popper offsets, generate an output similar to getBoundingClientRect
979
- * @function
980
- * @ignore
981
- * @argument {Object} popperOffsets
982
- * @returns {Object} ClientRect like output
983
- */
984
- function getPopperClientRect(popperOffsets) {
985
- var offsets = Object.assign({}, popperOffsets);
986
- offsets.right = offsets.left + offsets.width;
987
- offsets.bottom = offsets.top + offsets.height;
988
- return offsets;
989
- }
990
-
991
- /**
992
- * Given an array and the key to find, returns its index
993
- * @function
994
- * @ignore
995
- * @argument {Array} arr
996
- * @argument keyToFind
997
- * @returns index or null
998
- */
999
- function getArrayKeyIndex(arr, keyToFind) {
1000
- var i = 0,
1001
- key;
1002
- for (key in arr) {
1003
- if (arr[key] === keyToFind) {
1004
- return i;
1005
- }
1006
- i++;
1007
- }
1008
- return null;
1009
- }
1010
-
1011
- /**
1012
- * Get CSS computed property of the given element
1013
- * @function
1014
- * @ignore
1015
- * @argument {Eement} element
1016
- * @argument {String} property
1017
- */
1018
- function getStyleComputedProperty(element, property) {
1019
- // NOTE: 1 DOM access here
1020
- var css = root.getComputedStyle(element, null);
1021
- return css[property];
1022
- }
1023
-
1024
- /**
1025
- * Returns the offset parent of the given element
1026
- * @function
1027
- * @ignore
1028
- * @argument {Element} element
1029
- * @returns {Element} offset parent
1030
- */
1031
- function getOffsetParent(element) {
1032
- // NOTE: 1 DOM access here
1033
- var offsetParent = element.offsetParent;
1034
- return offsetParent === root.document.body || !offsetParent ? root.document.documentElement : offsetParent;
1035
- }
1036
-
1037
- /**
1038
- * Returns the scrolling parent of the given element
1039
- * @function
1040
- * @ignore
1041
- * @argument {Element} element
1042
- * @returns {Element} offset parent
1043
- */
1044
- function getScrollParent(element) {
1045
- var parent = element.parentNode;
1046
-
1047
- if (!parent) {
1048
- return element;
1049
- }
1050
-
1051
- if (parent === root.document) {
1052
- // Firefox puts the scrollTOp value on `documentElement` instead of `body`, we then check which of them is
1053
- // greater than 0 and return the proper element
1054
- if (root.document.body.scrollTop || root.document.body.scrollLeft) {
1055
- return root.document.body;
1056
- } else {
1057
- return root.document.documentElement;
1058
- }
1059
- }
1060
-
1061
- // Firefox want us to check `-x` and `-y` variations as well
1062
- if (['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-x')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-y')) !== -1) {
1063
- // If the detected scrollParent is body, we perform an additional check on its parentNode
1064
- // in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
1065
- // fixes issue #65
1066
- return parent;
1067
- }
1068
- return getScrollParent(element.parentNode);
1069
- }
1070
-
1071
- /**
1072
- * Check if the given element is fixed or is inside a fixed parent
1073
- * @function
1074
- * @ignore
1075
- * @argument {Element} element
1076
- * @argument {Element} customContainer
1077
- * @returns {Boolean} answer to "isFixed?"
1078
- */
1079
- function isFixed(element) {
1080
- if (element === root.document.body) {
1081
- return false;
1082
- }
1083
- if (getStyleComputedProperty(element, 'position') === 'fixed') {
1084
- return true;
1085
- }
1086
- return element.parentNode ? isFixed(element.parentNode) : element;
1087
- }
1088
-
1089
- /**
1090
- * Set the style to the given popper
1091
- * @function
1092
- * @ignore
1093
- * @argument {Element} element - Element to apply the style to
1094
- * @argument {Object} styles - Object with a list of properties and values which will be applied to the element
1095
- */
1096
- function setStyle(element, styles) {
1097
- function is_numeric(n) {
1098
- return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
1099
- }
1100
- Object.keys(styles).forEach(function (prop) {
1101
- var unit = '';
1102
- // add unit if the value is numeric and is one of the following
1103
- if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && is_numeric(styles[prop])) {
1104
- unit = 'px';
1105
- }
1106
- element.style[prop] = styles[prop] + unit;
1107
- });
1108
- }
1109
-
1110
- /**
1111
- * Check if the given variable is a function
1112
- * @function
1113
- * @ignore
1114
- * @argument {*} functionToCheck - variable to check
1115
- * @returns {Boolean} answer to: is a function?
1116
- */
1117
- function isFunction(functionToCheck) {
1118
- var getType = {};
1119
- return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
1120
- }
1121
-
1122
- /**
1123
- * Get the position of the given element, relative to its offset parent
1124
- * @function
1125
- * @ignore
1126
- * @param {Element} element
1127
- * @return {Object} position - Coordinates of the element and its `scrollTop`
1128
- */
1129
- function getOffsetRect(element) {
1130
- var elementRect = {
1131
- width: element.offsetWidth,
1132
- height: element.offsetHeight,
1133
- left: element.offsetLeft,
1134
- top: element.offsetTop
1135
- };
1136
-
1137
- elementRect.right = elementRect.left + elementRect.width;
1138
- elementRect.bottom = elementRect.top + elementRect.height;
1139
-
1140
- // position
1141
- return elementRect;
1142
- }
1143
-
1144
- /**
1145
- * Get bounding client rect of given element
1146
- * @function
1147
- * @ignore
1148
- * @param {HTMLElement} element
1149
- * @return {Object} client rect
1150
- */
1151
- function getBoundingClientRect(element) {
1152
- var rect = element.getBoundingClientRect();
1153
-
1154
- // whether the IE version is lower than 11
1155
- var isIE = navigator.userAgent.indexOf("MSIE") != -1;
1156
-
1157
- // fix ie document bounding top always 0 bug
1158
- var rectTop = isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
1159
-
1160
- return {
1161
- left: rect.left,
1162
- top: rectTop,
1163
- right: rect.right,
1164
- bottom: rect.bottom,
1165
- width: rect.right - rect.left,
1166
- height: rect.bottom - rectTop
1167
- };
1168
- }
1169
-
1170
- /**
1171
- * Given an element and one of its parents, return the offset
1172
- * @function
1173
- * @ignore
1174
- * @param {HTMLElement} element
1175
- * @param {HTMLElement} parent
1176
- * @return {Object} rect
1177
- */
1178
- function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
1179
- var elementRect = getBoundingClientRect(element);
1180
- var parentRect = getBoundingClientRect(parent);
1181
-
1182
- if (fixed) {
1183
- var scrollParent = getScrollParent(parent);
1184
- parentRect.top += scrollParent.scrollTop;
1185
- parentRect.bottom += scrollParent.scrollTop;
1186
- parentRect.left += scrollParent.scrollLeft;
1187
- parentRect.right += scrollParent.scrollLeft;
1188
- }
1189
-
1190
- var rect = {
1191
- top: elementRect.top - parentRect.top,
1192
- left: elementRect.left - parentRect.left,
1193
- bottom: elementRect.top - parentRect.top + elementRect.height,
1194
- right: elementRect.left - parentRect.left + elementRect.width,
1195
- width: elementRect.width,
1196
- height: elementRect.height
1197
- };
1198
- return rect;
1199
- }
1200
-
1201
- /**
1202
- * Get the prefixed supported property name
1203
- * @function
1204
- * @ignore
1205
- * @argument {String} property (camelCase)
1206
- * @returns {String} prefixed property (camelCase)
1207
- */
1208
- function getSupportedPropertyName(property) {
1209
- var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
1210
-
1211
- for (var i = 0; i < prefixes.length; i++) {
1212
- var toCheck = prefixes[i] ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1) : property;
1213
- if (typeof root.document.body.style[toCheck] !== 'undefined') {
1214
- return toCheck;
1215
- }
1216
- }
1217
- return null;
1218
- }
1219
-
1220
- /**
1221
- * The Object.assign() method is used to copy the values of all enumerable own properties from one or more source
1222
- * objects to a target object. It will return the target object.
1223
- * This polyfill doesn't support symbol properties, since ES5 doesn't have symbols anyway
1224
- * Source: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
1225
- * @function
1226
- * @ignore
1227
- */
1228
- if (!Object.assign) {
1229
- Object.defineProperty(Object, 'assign', {
1230
- enumerable: false,
1231
- configurable: true,
1232
- writable: true,
1233
- value: function value(target) {
1234
- if (target === undefined || target === null) {
1235
- throw new TypeError('Cannot convert first argument to object');
1236
- }
1237
-
1238
- var to = Object(target);
1239
- for (var i = 1; i < arguments.length; i++) {
1240
- var nextSource = arguments[i];
1241
- if (nextSource === undefined || nextSource === null) {
1242
- continue;
1243
- }
1244
- nextSource = Object(nextSource);
1245
-
1246
- var keysArray = Object.keys(nextSource);
1247
- for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
1248
- var nextKey = keysArray[nextIndex];
1249
- var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
1250
- if (desc !== undefined && desc.enumerable) {
1251
- to[nextKey] = nextSource[nextKey];
1252
- }
1253
- }
1254
- }
1255
- return to;
1256
- }
1257
- });
1258
- }
1259
-
1260
- return Popper;
1261
- });