cy-element-ui 1.0.27 → 1.0.29

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