cy-element-ui 1.1.13 → 1.1.15

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 (523) hide show
  1. package/README.md +35 -5
  2. package/lib/alert.js +68 -68
  3. package/lib/aside.js +11 -11
  4. package/lib/autocomplete.js +287 -287
  5. package/lib/avatar.js +121 -121
  6. package/lib/backtop.js +91 -91
  7. package/lib/badge.js +32 -32
  8. package/lib/breadcrumb-item.js +33 -33
  9. package/lib/breadcrumb.js +27 -27
  10. package/lib/button-group.js +4 -4
  11. package/lib/button.js +53 -53
  12. package/lib/calendar.js +426 -426
  13. package/lib/card.js +11 -11
  14. package/lib/carousel-item.js +108 -108
  15. package/lib/carousel.js +244 -244
  16. package/lib/cascader-panel.js +1045 -1045
  17. package/lib/cascader.js +577 -577
  18. package/lib/checkbox-button.js +137 -137
  19. package/lib/checkbox-group.js +39 -39
  20. package/lib/checkbox.js +151 -151
  21. package/lib/col.js +64 -64
  22. package/lib/collapse-item.js +66 -66
  23. package/lib/collapse.js +63 -63
  24. package/lib/color-picker.js +944 -944
  25. package/lib/container.js +24 -24
  26. package/lib/date-picker.js +2968 -2967
  27. package/lib/descriptions-item.js +29 -29
  28. package/lib/descriptions.js +324 -324
  29. package/lib/dialog.js +170 -170
  30. package/lib/directives/mousewheel.js +9 -9
  31. package/lib/directives/repeat-click.js +22 -22
  32. package/lib/divider.js +20 -20
  33. package/lib/drawer.js +156 -156
  34. package/lib/dropdown-item.js +19 -19
  35. package/lib/dropdown-menu.js +56 -56
  36. package/lib/dropdown.js +329 -329
  37. package/lib/element-ui.common.js +44918 -0
  38. package/lib/empty.js +39 -39
  39. package/lib/footer.js +11 -11
  40. package/lib/form-item.js +369 -369
  41. package/lib/form.js +181 -181
  42. package/lib/header.js +11 -11
  43. package/lib/icon.js +7 -7
  44. package/lib/image.js +520 -520
  45. package/lib/index.js +1 -1
  46. package/lib/infinite-scroll.js +127 -127
  47. package/lib/input-number.js +260 -260
  48. package/lib/input.js +370 -370
  49. package/lib/link.js +28 -28
  50. package/lib/loading.js +219 -219
  51. package/lib/locale/format.js +25 -26
  52. package/lib/locale/index.js +24 -24
  53. package/lib/locale/lang/en.js +121 -121
  54. package/lib/locale/lang/zh-CN.js +121 -121
  55. package/lib/locale/lang/zh-TW.js +121 -121
  56. package/lib/main.js +5 -5
  57. package/lib/menu-item-group.js +33 -33
  58. package/lib/menu-item.js +116 -116
  59. package/lib/menu.js +490 -490
  60. package/lib/message-box.js +421 -421
  61. package/lib/message.js +150 -150
  62. package/lib/mixins/emitter.js +26 -26
  63. package/lib/mixins/focus.js +7 -7
  64. package/lib/mixins/locale.js +8 -8
  65. package/lib/mixins/migrating.js +34 -34
  66. package/lib/notification.js +184 -184
  67. package/lib/option-group.js +46 -46
  68. package/lib/option.js +145 -145
  69. package/lib/page-header.js +14 -14
  70. package/lib/pagination.js +530 -530
  71. package/lib/popconfirm.js +68 -68
  72. package/lib/popover.js +225 -225
  73. package/lib/progress.js +183 -183
  74. package/lib/radio-button.js +78 -78
  75. package/lib/radio-group.js +103 -103
  76. package/lib/radio.js +86 -86
  77. package/lib/rate.js +283 -283
  78. package/lib/result.js +61 -61
  79. package/lib/row.js +32 -32
  80. package/lib/scrollbar.js +247 -247
  81. package/lib/select.js +999 -999
  82. package/lib/selectDisplayInput.js +61 -61
  83. package/lib/skeleton-item.js +19 -19
  84. package/lib/skeleton.js +53 -53
  85. package/lib/slider.js +550 -550
  86. package/lib/spinner.js +19 -19
  87. package/lib/statistic.js +198 -198
  88. package/lib/step.js +125 -125
  89. package/lib/steps.js +54 -54
  90. package/lib/subTitle.js +24 -24
  91. package/lib/submenu.js +405 -406
  92. package/lib/switch.js +135 -135
  93. package/lib/tab-pane.js +43 -43
  94. package/lib/tabDialog.js +508 -508
  95. package/lib/table-column.js +713 -713
  96. package/lib/table.js +3432 -3432
  97. package/lib/tabs.js +578 -578
  98. package/lib/tag.js +60 -60
  99. package/lib/time-picker.js +1350 -1350
  100. package/lib/time-select.js +949 -949
  101. package/lib/timeline-item.js +25 -25
  102. package/lib/timeline.js +30 -30
  103. package/lib/tooltip.js +255 -255
  104. package/lib/transfer.js +385 -385
  105. package/lib/transitions/collapse-transition.js +76 -76
  106. package/lib/tree.js +1547 -1547
  107. package/lib/treeSelect.js +2618 -2618
  108. package/lib/umd/locale/en.js +137 -137
  109. package/lib/umd/locale/zh-CN.js +137 -137
  110. package/lib/umd/locale/zh-TW.js +137 -137
  111. package/lib/upload.js +738 -738
  112. package/lib/utils/after-leave.js +19 -19
  113. package/lib/utils/aria-dialog.js +56 -56
  114. package/lib/utils/aria-utils.js +66 -66
  115. package/lib/utils/clickoutside.js +39 -39
  116. package/lib/utils/date-util.js +177 -177
  117. package/lib/utils/dom.js +161 -161
  118. package/lib/utils/menu/aria-menubar.js +8 -8
  119. package/lib/utils/menu/aria-menuitem.js +38 -38
  120. package/lib/utils/menu/aria-submenu.js +45 -45
  121. package/lib/utils/merge.js +12 -12
  122. package/lib/utils/popup/index.js +201 -201
  123. package/lib/utils/popup/popup-manager.js +171 -171
  124. package/lib/utils/resize-event.js +33 -33
  125. package/lib/utils/scroll-into-view.js +25 -25
  126. package/lib/utils/scrollbar-width.js +18 -18
  127. package/lib/utils/shared.js +3 -3
  128. package/lib/utils/types.js +10 -10
  129. package/lib/utils/util.js +170 -170
  130. package/lib/utils/vdom.js +1 -1
  131. package/lib/utils/vue-popper.js +176 -176
  132. package/package.json +9 -7
  133. package/packages/alert/index.js +1 -1
  134. package/packages/alert/src/main.vue +82 -82
  135. package/packages/aside/index.js +1 -1
  136. package/packages/aside/src/main.vue +13 -13
  137. package/packages/autocomplete/index.js +1 -1
  138. package/packages/autocomplete/src/autocomplete-suggestions.vue +64 -64
  139. package/packages/autocomplete/src/autocomplete.vue +272 -272
  140. package/packages/avatar/index.js +1 -1
  141. package/packages/avatar/src/main.vue +88 -88
  142. package/packages/backtop/index.js +1 -1
  143. package/packages/backtop/src/main.vue +92 -92
  144. package/packages/badge/index.js +1 -1
  145. package/packages/badge/src/main.vue +41 -41
  146. package/packages/breadcrumb/index.js +1 -1
  147. package/packages/breadcrumb/src/breadcrumb-item.vue +35 -35
  148. package/packages/breadcrumb/src/breadcrumb.vue +27 -27
  149. package/packages/breadcrumb-item/index.js +1 -1
  150. package/packages/button/index.js +1 -1
  151. package/packages/button/src/button-group.vue +6 -6
  152. package/packages/button/src/button.vue +70 -70
  153. package/packages/button-group/index.js +1 -1
  154. package/packages/calendar/index.js +1 -1
  155. package/packages/calendar/src/date-table.vue +193 -193
  156. package/packages/calendar/src/main.vue +242 -242
  157. package/packages/card/index.js +1 -1
  158. package/packages/card/src/main.vue +18 -18
  159. package/packages/carousel/index.js +1 -1
  160. package/packages/carousel/src/item.vue +122 -122
  161. package/packages/carousel/src/main.vue +305 -305
  162. package/packages/carousel-item/index.js +1 -1
  163. package/packages/cascader/index.js +1 -1
  164. package/packages/cascader/src/cascader.vue +626 -626
  165. package/packages/cascader-panel/index.js +1 -1
  166. package/packages/cascader-panel/src/cascader-menu.vue +128 -128
  167. package/packages/cascader-panel/src/cascader-node.vue +244 -244
  168. package/packages/cascader-panel/src/cascader-panel.vue +334 -334
  169. package/packages/cascader-panel/src/node.js +157 -158
  170. package/packages/cascader-panel/src/store.js +49 -50
  171. package/packages/checkbox/index.js +1 -1
  172. package/packages/checkbox/src/checkbox-button.vue +195 -195
  173. package/packages/checkbox/src/checkbox-group.vue +43 -43
  174. package/packages/checkbox/src/checkbox.vue +218 -218
  175. package/packages/checkbox-button/index.js +1 -1
  176. package/packages/checkbox-group/index.js +1 -1
  177. package/packages/col/index.js +1 -1
  178. package/packages/col/src/col.js +63 -63
  179. package/packages/collapse/index.js +1 -1
  180. package/packages/collapse/src/collapse-item.vue +101 -101
  181. package/packages/collapse/src/collapse.vue +61 -61
  182. package/packages/collapse-item/index.js +1 -1
  183. package/packages/color-picker/index.js +1 -1
  184. package/packages/color-picker/src/color.js +263 -263
  185. package/packages/color-picker/src/components/alpha-slider.vue +127 -127
  186. package/packages/color-picker/src/components/hue-slider.vue +118 -118
  187. package/packages/color-picker/src/components/picker-dropdown.vue +105 -105
  188. package/packages/color-picker/src/components/predefine.vue +55 -55
  189. package/packages/color-picker/src/components/sv-panel.vue +95 -95
  190. package/packages/color-picker/src/draggable.js +27 -27
  191. package/packages/color-picker/src/main.vue +183 -183
  192. package/packages/container/index.js +1 -1
  193. package/packages/container/src/main.vue +25 -25
  194. package/packages/date-picker/index.js +1 -1
  195. package/packages/date-picker/src/basic/date-table.vue +435 -435
  196. package/packages/date-picker/src/basic/month-table.vue +239 -240
  197. package/packages/date-picker/src/basic/time-spinner.vue +279 -279
  198. package/packages/date-picker/src/basic/year-table.vue +99 -99
  199. package/packages/date-picker/src/panel/date-range.vue +675 -675
  200. package/packages/date-picker/src/panel/date.vue +604 -604
  201. package/packages/date-picker/src/panel/month-range.vue +260 -260
  202. package/packages/date-picker/src/panel/time-range.vue +242 -242
  203. package/packages/date-picker/src/panel/time-select.vue +173 -173
  204. package/packages/date-picker/src/panel/time.vue +181 -181
  205. package/packages/date-picker/src/picker/date-picker.js +29 -29
  206. package/packages/date-picker/src/picker/time-picker.js +28 -28
  207. package/packages/date-picker/src/picker/time-select.js +12 -12
  208. package/packages/date-picker/src/picker.vue +900 -900
  209. package/packages/descriptions/index.js +1 -1
  210. package/packages/descriptions/src/descriptions-item.js +28 -28
  211. package/packages/descriptions/src/descriptions-row.js +114 -114
  212. package/packages/descriptions/src/index.js +168 -168
  213. package/packages/descriptions-item/index.js +1 -1
  214. package/packages/dialog/index.js +1 -1
  215. package/packages/dialog/src/component.vue +207 -207
  216. package/packages/divider/index.js +1 -1
  217. package/packages/divider/src/main.vue +29 -29
  218. package/packages/drawer/index.js +1 -1
  219. package/packages/drawer/src/main.vue +195 -195
  220. package/packages/dropdown/index.js +1 -1
  221. package/packages/dropdown/src/dropdown-item.vue +29 -29
  222. package/packages/dropdown/src/dropdown-menu.vue +59 -59
  223. package/packages/dropdown/src/dropdown.vue +271 -271
  224. package/packages/dropdown-item/index.js +1 -1
  225. package/packages/dropdown-menu/index.js +1 -1
  226. package/packages/empty/index.js +1 -1
  227. package/packages/empty/src/img-empty.vue +124 -124
  228. package/packages/empty/src/index.vue +40 -40
  229. package/packages/footer/index.js +1 -1
  230. package/packages/footer/src/main.vue +13 -13
  231. package/packages/form/index.js +1 -1
  232. package/packages/form/src/form-item.vue +294 -294
  233. package/packages/form/src/form.vue +169 -169
  234. package/packages/form/src/label-wrap.vue +65 -65
  235. package/packages/form-item/index.js +1 -1
  236. package/packages/header/index.js +1 -1
  237. package/packages/header/src/main.vue +13 -13
  238. package/packages/icon/index.js +1 -1
  239. package/packages/icon/src/icon.vue +7 -7
  240. package/packages/image/index.js +1 -1
  241. package/packages/image/src/image-viewer.vue +309 -309
  242. package/packages/image/src/main.vue +242 -242
  243. package/packages/infinite-scroll/index.js +1 -1
  244. package/packages/infinite-scroll/src/main.js +113 -114
  245. package/packages/input/index.js +1 -1
  246. package/packages/input/src/calcTextareaHeight.js +70 -70
  247. package/packages/input/src/input.vue +416 -416
  248. package/packages/input-number/index.js +1 -1
  249. package/packages/input-number/src/input-number.vue +272 -272
  250. package/packages/link/index.js +1 -1
  251. package/packages/link/src/main.vue +40 -40
  252. package/packages/loading/index.js +6 -6
  253. package/packages/loading/src/directive.js +105 -105
  254. package/packages/loading/src/index.js +74 -74
  255. package/packages/loading/src/loading.vue +35 -35
  256. package/packages/main/index.js +1 -1
  257. package/packages/main/src/main.vue +7 -7
  258. package/packages/menu/index.js +1 -1
  259. package/packages/menu/src/menu-item-group.vue +38 -38
  260. package/packages/menu/src/menu-item.vue +103 -103
  261. package/packages/menu/src/menu-mixin.js +39 -39
  262. package/packages/menu/src/menu.vue +298 -298
  263. package/packages/menu/src/submenu.vue +330 -331
  264. package/packages/menu-item/index.js +1 -1
  265. package/packages/menu-item-group/index.js +1 -1
  266. package/packages/message/src/main.js +65 -65
  267. package/packages/message/src/main.vue +105 -105
  268. package/packages/message-box/src/main.js +172 -172
  269. package/packages/message-box/src/main.vue +309 -309
  270. package/packages/notification/src/main.js +63 -63
  271. package/packages/notification/src/main.vue +135 -135
  272. package/packages/option/index.js +1 -1
  273. package/packages/option-group/index.js +1 -1
  274. package/packages/page-header/index.js +1 -1
  275. package/packages/page-header/src/main.vue +21 -21
  276. package/packages/pagination/index.js +1 -1
  277. package/packages/pagination/src/pager.vue +158 -158
  278. package/packages/pagination/src/pagination.js +377 -377
  279. package/packages/popconfirm/index.js +1 -1
  280. package/packages/popconfirm/src/main.vue +94 -94
  281. package/packages/popover/index.js +2 -2
  282. package/packages/popover/src/directive.js +15 -15
  283. package/packages/popover/src/main.vue +214 -214
  284. package/packages/progress/index.js +1 -1
  285. package/packages/progress/src/progress.vue +228 -228
  286. package/packages/radio/index.js +1 -1
  287. package/packages/radio/src/radio-button.vue +106 -106
  288. package/packages/radio/src/radio-group.vue +101 -101
  289. package/packages/radio/src/radio.vue +122 -122
  290. package/packages/radio-button/index.js +1 -1
  291. package/packages/radio-group/index.js +1 -1
  292. package/packages/rate/index.js +1 -1
  293. package/packages/rate/src/main.vue +316 -316
  294. package/packages/result/index.js +1 -1
  295. package/packages/result/src/icon-error.vue +6 -6
  296. package/packages/result/src/icon-info.vue +6 -6
  297. package/packages/result/src/icon-success.vue +6 -6
  298. package/packages/result/src/icon-warning.vue +6 -6
  299. package/packages/result/src/index.vue +51 -51
  300. package/packages/row/index.js +1 -1
  301. package/packages/row/src/row.js +36 -36
  302. package/packages/scrollbar/index.js +1 -1
  303. package/packages/scrollbar/src/bar.js +86 -86
  304. package/packages/scrollbar/src/main.js +120 -120
  305. package/packages/scrollbar/src/util.js +27 -27
  306. package/packages/select/index.js +1 -1
  307. package/packages/select/src/navigation-mixin.js +47 -47
  308. package/packages/select/src/option-group.vue +55 -55
  309. package/packages/select/src/option.vue +163 -163
  310. package/packages/select/src/select-dropdown.vue +57 -57
  311. package/packages/select/src/select.vue +895 -895
  312. package/packages/selectDisplayInput/index.js +1 -1
  313. package/packages/selectDisplayInput/src/main.vue +61 -61
  314. package/packages/skeleton/index.js +1 -1
  315. package/packages/skeleton/src/img-placeholder.vue +9 -9
  316. package/packages/skeleton/src/index.vue +70 -70
  317. package/packages/skeleton/src/item.vue +17 -17
  318. package/packages/skeleton-item/index.js +1 -1
  319. package/packages/slider/index.js +1 -1
  320. package/packages/slider/src/button.vue +230 -230
  321. package/packages/slider/src/main.vue +422 -422
  322. package/packages/slider/src/marker.js +14 -14
  323. package/packages/spinner/index.js +1 -1
  324. package/packages/spinner/src/spinner.vue +23 -23
  325. package/packages/statistic/index.js +1 -1
  326. package/packages/statistic/src/main.vue +196 -197
  327. package/packages/step/index.js +1 -1
  328. package/packages/steps/index.js +1 -1
  329. package/packages/steps/src/step.vue +177 -177
  330. package/packages/steps/src/steps.vue +53 -53
  331. package/packages/subTitle/index.js +1 -1
  332. package/packages/subTitle/src/main.vue +29 -29
  333. package/packages/submenu/index.js +1 -1
  334. package/packages/switch/index.js +1 -1
  335. package/packages/switch/src/component.vue +169 -169
  336. package/packages/tab-pane/index.js +1 -1
  337. package/packages/tabDialog/index.js +10 -10
  338. package/packages/tabDialog/src/dialog/drag.js +50 -50
  339. package/packages/tabDialog/src/dialog/dragHeight.js +27 -27
  340. package/packages/tabDialog/src/dialog/dragWidth.js +23 -23
  341. package/packages/tabDialog/src/main.vue +257 -257
  342. package/packages/table/index.js +1 -1
  343. package/packages/table/src/config.js +108 -108
  344. package/packages/table/src/dropdown.js +19 -19
  345. package/packages/table/src/filter-panel.vue +189 -189
  346. package/packages/table/src/layout-observer.js +60 -60
  347. package/packages/table/src/store/current.js +65 -65
  348. package/packages/table/src/store/expand.js +57 -57
  349. package/packages/table/src/store/helper.js +32 -32
  350. package/packages/table/src/store/index.js +133 -133
  351. package/packages/table/src/store/tree.js +194 -194
  352. package/packages/table/src/store/watcher.js +366 -366
  353. package/packages/table/src/table-body.js +456 -456
  354. package/packages/table/src/table-column.js +311 -311
  355. package/packages/table/src/table-footer.js +139 -139
  356. package/packages/table/src/table-header.js +496 -496
  357. package/packages/table/src/table-layout.js +241 -241
  358. package/packages/table/src/table-row.js +97 -97
  359. package/packages/table/src/table.vue +666 -666
  360. package/packages/table/src/util.js +214 -214
  361. package/packages/table-column/index.js +1 -1
  362. package/packages/tabs/index.js +1 -1
  363. package/packages/tabs/src/tab-bar.vue +47 -47
  364. package/packages/tabs/src/tab-nav.vue +268 -268
  365. package/packages/tabs/src/tab-pane.vue +47 -47
  366. package/packages/tabs/src/tabs.vue +174 -174
  367. package/packages/tag/index.js +1 -1
  368. package/packages/tag/src/tag.vue +55 -55
  369. package/packages/theme-chalk/gulpfile.js +11 -11
  370. package/packages/theme-chalk/src/alert.scss +138 -138
  371. package/packages/theme-chalk/src/aside.scss +3 -3
  372. package/packages/theme-chalk/src/autocomplete.scss +58 -58
  373. package/packages/theme-chalk/src/avatar.scss +46 -46
  374. package/packages/theme-chalk/src/backtop.scss +16 -16
  375. package/packages/theme-chalk/src/badge.scss +47 -47
  376. package/packages/theme-chalk/src/breadcrumb.scss +49 -49
  377. package/packages/theme-chalk/src/button.scss +229 -229
  378. package/packages/theme-chalk/src/calendar.scss +57 -57
  379. package/packages/theme-chalk/src/card.scss +23 -23
  380. package/packages/theme-chalk/src/carousel-item.scss +41 -41
  381. package/packages/theme-chalk/src/carousel.scss +148 -148
  382. package/packages/theme-chalk/src/cascader-panel.scss +106 -106
  383. package/packages/theme-chalk/src/cascader.scss +173 -173
  384. package/packages/theme-chalk/src/checkbox.scss +346 -346
  385. package/packages/theme-chalk/src/col.scss +130 -130
  386. package/packages/theme-chalk/src/collapse.scss +52 -52
  387. package/packages/theme-chalk/src/color-picker.scss +364 -364
  388. package/packages/theme-chalk/src/common/popup.scss +22 -22
  389. package/packages/theme-chalk/src/common/transition.scss +33 -33
  390. package/packages/theme-chalk/src/common/var.scss +16 -16
  391. package/packages/theme-chalk/src/container.scss +9 -9
  392. package/packages/theme-chalk/src/cy/base.scss +1 -1
  393. package/packages/theme-chalk/src/date-picker/date-picker.scss +91 -91
  394. package/packages/theme-chalk/src/date-picker/date-range-picker.scss +97 -97
  395. package/packages/theme-chalk/src/date-picker/date-table.scss +146 -146
  396. package/packages/theme-chalk/src/date-picker/month-table.scss +69 -69
  397. package/packages/theme-chalk/src/date-picker/picker-panel.scss +105 -105
  398. package/packages/theme-chalk/src/date-picker/picker.scss +188 -188
  399. package/packages/theme-chalk/src/date-picker/time-picker.scss +72 -72
  400. package/packages/theme-chalk/src/date-picker/time-range-picker.scss +23 -23
  401. package/packages/theme-chalk/src/date-picker/time-spinner.scss +106 -106
  402. package/packages/theme-chalk/src/date-picker/year-table.scss +47 -47
  403. package/packages/theme-chalk/src/descriptions-item.scss +33 -33
  404. package/packages/theme-chalk/src/descriptions.scss +105 -105
  405. package/packages/theme-chalk/src/dialog.scss +104 -104
  406. package/packages/theme-chalk/src/display.scss +7 -7
  407. package/packages/theme-chalk/src/divider.scss +36 -36
  408. package/packages/theme-chalk/src/drawer.scss +185 -185
  409. package/packages/theme-chalk/src/dropdown.scss +172 -172
  410. package/packages/theme-chalk/src/empty.scss +34 -34
  411. package/packages/theme-chalk/src/footer.scss +3 -3
  412. package/packages/theme-chalk/src/form.scss +149 -149
  413. package/packages/theme-chalk/src/header.scss +3 -3
  414. package/packages/theme-chalk/src/icon.scss +309 -309
  415. package/packages/theme-chalk/src/image.scss +153 -153
  416. package/packages/theme-chalk/src/input-number.scss +255 -255
  417. package/packages/theme-chalk/src/input.scss +345 -345
  418. package/packages/theme-chalk/src/link.scss +67 -67
  419. package/packages/theme-chalk/src/loading.scss +67 -67
  420. package/packages/theme-chalk/src/main.scss +7 -7
  421. package/packages/theme-chalk/src/menu.scss +248 -248
  422. package/packages/theme-chalk/src/message-box.scss +205 -205
  423. package/packages/theme-chalk/src/message.scss +111 -111
  424. package/packages/theme-chalk/src/mixins/_button.scss +64 -64
  425. package/packages/theme-chalk/src/mixins/function.scss +18 -18
  426. package/packages/theme-chalk/src/mixins/mixins.scss +126 -126
  427. package/packages/theme-chalk/src/mixins/utils.scss +26 -26
  428. package/packages/theme-chalk/src/notification.scss +88 -88
  429. package/packages/theme-chalk/src/option-group.scss +31 -31
  430. package/packages/theme-chalk/src/option.scss +27 -27
  431. package/packages/theme-chalk/src/page-header.scss +31 -31
  432. package/packages/theme-chalk/src/pagination.scss +284 -284
  433. package/packages/theme-chalk/src/popconfirm.scss +11 -11
  434. package/packages/theme-chalk/src/popover.scss +30 -30
  435. package/packages/theme-chalk/src/popper.scss +82 -82
  436. package/packages/theme-chalk/src/progress.scss +128 -128
  437. package/packages/theme-chalk/src/radio-button.scss +94 -94
  438. package/packages/theme-chalk/src/radio-group.scss +4 -4
  439. package/packages/theme-chalk/src/radio.scss +192 -192
  440. package/packages/theme-chalk/src/rate.scss +38 -38
  441. package/packages/theme-chalk/src/reset.scss +39 -39
  442. package/packages/theme-chalk/src/result.scss +56 -56
  443. package/packages/theme-chalk/src/row.scss +31 -31
  444. package/packages/theme-chalk/src/scrollbar.scss +57 -57
  445. package/packages/theme-chalk/src/select-dropdown.scss +47 -47
  446. package/packages/theme-chalk/src/select.scss +140 -140
  447. package/packages/theme-chalk/src/skeleton-item.scss +75 -75
  448. package/packages/theme-chalk/src/skeleton.scss +27 -27
  449. package/packages/theme-chalk/src/slider.scss +238 -238
  450. package/packages/theme-chalk/src/spinner.scss +27 -27
  451. package/packages/theme-chalk/src/statistic.scss +32 -32
  452. package/packages/theme-chalk/src/step.scss +312 -312
  453. package/packages/theme-chalk/src/steps.scss +13 -13
  454. package/packages/theme-chalk/src/switch.scss +101 -101
  455. package/packages/theme-chalk/src/table-column.scss +87 -87
  456. package/packages/theme-chalk/src/table.scss +556 -556
  457. package/packages/theme-chalk/src/tabs.scss +576 -576
  458. package/packages/theme-chalk/src/tag.scss +155 -155
  459. package/packages/theme-chalk/src/time-select.scss +14 -14
  460. package/packages/theme-chalk/src/timeline-item.scss +71 -71
  461. package/packages/theme-chalk/src/timeline.scss +8 -8
  462. package/packages/theme-chalk/src/tooltip.scss +136 -136
  463. package/packages/theme-chalk/src/transfer.scss +214 -214
  464. package/packages/theme-chalk/src/tree.scss +110 -110
  465. package/packages/theme-chalk/src/upload.scss +587 -587
  466. package/packages/time-picker/index.js +1 -1
  467. package/packages/time-select/index.js +1 -1
  468. package/packages/timeline/index.js +1 -1
  469. package/packages/timeline/src/item.vue +56 -56
  470. package/packages/timeline/src/main.vue +28 -28
  471. package/packages/timeline-item/index.js +1 -1
  472. package/packages/tooltip/index.js +1 -1
  473. package/packages/tooltip/src/main.js +234 -234
  474. package/packages/transfer/index.js +1 -1
  475. package/packages/transfer/src/main.vue +225 -225
  476. package/packages/transfer/src/transfer-panel.vue +245 -245
  477. package/packages/tree/index.js +1 -1
  478. package/packages/tree/src/model/node.js +467 -467
  479. package/packages/tree/src/model/tree-store.js +335 -335
  480. package/packages/tree/src/model/util.js +17 -17
  481. package/packages/tree/src/tree-node.vue +247 -247
  482. package/packages/tree/src/tree.vue +491 -491
  483. package/packages/treeSelect/index.js +1 -1
  484. package/packages/treeSelect/src/main.vue +275 -275
  485. package/packages/upload/index.js +1 -1
  486. package/packages/upload/src/ajax.js +77 -77
  487. package/packages/upload/src/index.vue +304 -304
  488. package/packages/upload/src/upload-dragger.vue +65 -65
  489. package/packages/upload/src/upload-list.vue +96 -96
  490. package/packages/upload/src/upload.vue +194 -194
  491. package/src/directives/mousewheel.js +9 -9
  492. package/src/directives/repeat-click.js +20 -20
  493. package/src/index.js +209 -210
  494. package/src/locale/format.js +24 -25
  495. package/src/locale/index.js +25 -25
  496. package/src/locale/lang/en.js +121 -121
  497. package/src/locale/lang/zh-CN.js +121 -121
  498. package/src/locale/lang/zh-TW.js +121 -121
  499. package/src/mixins/emitter.js +26 -26
  500. package/src/mixins/focus.js +7 -7
  501. package/src/mixins/locale.js +5 -5
  502. package/src/mixins/migrating.js +28 -28
  503. package/src/transitions/collapse-transition.js +60 -60
  504. package/src/utils/after-leave.js +17 -17
  505. package/src/utils/aria-dialog.js +48 -48
  506. package/src/utils/aria-utils.js +64 -64
  507. package/src/utils/clickoutside.js +34 -34
  508. package/src/utils/date-util.js +163 -163
  509. package/src/utils/dom.js +165 -165
  510. package/src/utils/menu/aria-menubar.js +5 -5
  511. package/src/utils/menu/aria-menuitem.js +36 -36
  512. package/src/utils/menu/aria-submenu.js +44 -44
  513. package/src/utils/merge.js +12 -12
  514. package/src/utils/popup/index.js +203 -203
  515. package/src/utils/popup/popup-manager.js +169 -169
  516. package/src/utils/resize-event.js +20 -20
  517. package/src/utils/scroll-into-view.js +20 -20
  518. package/src/utils/scrollbar-width.js +18 -18
  519. package/src/utils/shared.js +3 -3
  520. package/src/utils/types.js +12 -12
  521. package/src/utils/util.js +157 -157
  522. package/src/utils/vdom.js +1 -1
  523. package/src/utils/vue-popper.js +179 -179
@@ -232,7 +232,7 @@ module.exports = require("element-ui/lib/utils/dom");
232
232
 
233
233
  "use strict";
234
234
 
235
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/time.vue?vue&type=template&id=4d3998b5
235
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/time.vue?vue&type=template&id=f9778e26
236
236
  var render = function () {
237
237
  var _vm = this
238
238
  var _h = _vm.$createElement
@@ -320,7 +320,7 @@ var staticRenderFns = []
320
320
  render._withStripped = true
321
321
 
322
322
 
323
- // CONCATENATED MODULE: ./packages/date-picker/src/panel/time.vue?vue&type=template&id=4d3998b5
323
+ // CONCATENATED MODULE: ./packages/date-picker/src/panel/time.vue?vue&type=template&id=f9778e26
324
324
 
325
325
  // EXTERNAL MODULE: external "element-ui/lib/utils/date-util"
326
326
  var date_util_ = __webpack_require__(1);
@@ -371,158 +371,158 @@ var time_spinner = __webpack_require__(34);
371
371
 
372
372
 
373
373
  /* harmony default export */ var timevue_type_script_lang_js = ({
374
- mixins: [locale_default.a],
375
-
376
- components: {
377
- TimeSpinner: time_spinner["a" /* default */]
378
- },
379
-
380
- props: {
381
- visible: Boolean,
382
- timeArrowControl: Boolean
383
- },
384
-
385
- watch: {
386
- visible: function visible(val) {
387
- var _this = this;
388
-
389
- if (val) {
390
- this.oldValue = this.value;
391
- this.$nextTick(function () {
392
- return _this.$refs.spinner.emitSelectRange('hours');
393
- });
394
- } else {
395
- this.needInitAdjust = true;
396
- }
397
- },
398
- value: function value(newVal) {
399
- var _this2 = this;
400
-
401
- var date = void 0;
402
- if (newVal instanceof Date) {
403
- date = Object(date_util_["limitTimeRange"])(newVal, this.selectableRange, this.format);
404
- } else if (!newVal) {
405
- date = this.defaultValue ? new Date(this.defaultValue) : new Date();
406
- }
407
-
408
- this.date = date;
409
- if (this.visible && this.needInitAdjust) {
410
- this.$nextTick(function (_) {
411
- return _this2.adjustSpinners();
412
- });
413
- this.needInitAdjust = false;
414
- }
415
- },
416
- selectableRange: function selectableRange(val) {
417
- this.$refs.spinner.selectableRange = val;
418
- },
419
- defaultValue: function defaultValue(val) {
420
- if (!Object(date_util_["isDate"])(this.value)) {
421
- this.date = val ? new Date(val) : new Date();
422
- }
423
- }
424
- },
425
-
426
- data: function data() {
427
- return {
428
- popperClass: '',
429
- format: 'HH:mm:ss',
430
- value: '',
431
- defaultValue: null,
432
- date: new Date(),
433
- oldValue: new Date(),
434
- selectableRange: [],
435
- selectionRange: [0, 2],
436
- disabled: false,
437
- arrowControl: false,
438
- needInitAdjust: true
439
- };
440
- },
441
-
442
-
443
- computed: {
444
- showSeconds: function showSeconds() {
445
- return (this.format || '').indexOf('ss') !== -1;
446
- },
447
- useArrow: function useArrow() {
448
- return this.arrowControl || this.timeArrowControl || false;
449
- },
450
- amPmMode: function amPmMode() {
451
- if ((this.format || '').indexOf('A') !== -1) return 'A';
452
- if ((this.format || '').indexOf('a') !== -1) return 'a';
453
- return '';
454
- }
455
- },
456
-
457
- methods: {
458
- handleCancel: function handleCancel() {
459
- this.$emit('pick', this.oldValue, false);
460
- },
461
- handleChange: function handleChange(date) {
462
- // this.visible avoids edge cases, when use scrolls during panel closing animation
463
- if (this.visible) {
464
- this.date = Object(date_util_["clearMilliseconds"])(date);
465
- // if date is out of range, do not emit
466
- if (this.isValidValue(this.date)) {
467
- this.$emit('pick', this.date, true);
468
- }
469
- }
470
- },
471
- setSelectionRange: function setSelectionRange(start, end) {
472
- this.$emit('select-range', start, end);
473
- this.selectionRange = [start, end];
474
- },
475
- handleConfirm: function handleConfirm() {
476
- var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
477
- var first = arguments[1];
478
-
479
- if (first) return;
480
- var date = Object(date_util_["clearMilliseconds"])(Object(date_util_["limitTimeRange"])(this.date, this.selectableRange, this.format));
481
- this.$emit('pick', date, visible, first);
482
- },
483
- handleKeydown: function handleKeydown(event) {
484
- var keyCode = event.keyCode;
485
- var mapping = { 38: -1, 40: 1, 37: -1, 39: 1 };
486
-
487
- // Left or Right
488
- if (keyCode === 37 || keyCode === 39) {
489
- var step = mapping[keyCode];
490
- this.changeSelectionRange(step);
491
- event.preventDefault();
492
- return;
493
- }
494
-
495
- // Up or Down
496
- if (keyCode === 38 || keyCode === 40) {
497
- var _step = mapping[keyCode];
498
- this.$refs.spinner.scrollDown(_step);
499
- event.preventDefault();
500
- return;
501
- }
502
- },
503
- isValidValue: function isValidValue(date) {
504
- return Object(date_util_["timeWithinRange"])(date, this.selectableRange, this.format);
505
- },
506
- adjustSpinners: function adjustSpinners() {
507
- return this.$refs.spinner.adjustSpinners();
508
- },
509
- changeSelectionRange: function changeSelectionRange(step) {
510
- var list = [0, 3].concat(this.showSeconds ? [6] : []);
511
- var mapping = ['hours', 'minutes'].concat(this.showSeconds ? ['seconds'] : []);
512
- var index = list.indexOf(this.selectionRange[0]);
513
- var next = (index + step + list.length) % list.length;
514
- this.$refs.spinner.emitSelectRange(mapping[next]);
515
- }
516
- },
517
-
518
- mounted: function mounted() {
519
- var _this3 = this;
520
-
521
- this.$nextTick(function () {
522
- return _this3.handleConfirm(true, true);
523
- });
524
- this.$emit('mounted');
525
- }
374
+ mixins: [locale_default.a],
375
+
376
+ components: {
377
+ TimeSpinner: time_spinner["a" /* default */]
378
+ },
379
+
380
+ props: {
381
+ visible: Boolean,
382
+ timeArrowControl: Boolean
383
+ },
384
+
385
+ watch: {
386
+ visible: function visible(val) {
387
+ var _this = this;
388
+
389
+ if (val) {
390
+ this.oldValue = this.value;
391
+ this.$nextTick(function () {
392
+ return _this.$refs.spinner.emitSelectRange('hours');
393
+ });
394
+ } else {
395
+ this.needInitAdjust = true;
396
+ }
397
+ },
398
+ value: function value(newVal) {
399
+ var _this2 = this;
400
+
401
+ var date = void 0;
402
+ if (newVal instanceof Date) {
403
+ date = Object(date_util_["limitTimeRange"])(newVal, this.selectableRange, this.format);
404
+ } else if (!newVal) {
405
+ date = this.defaultValue ? new Date(this.defaultValue) : new Date();
406
+ }
407
+
408
+ this.date = date;
409
+ if (this.visible && this.needInitAdjust) {
410
+ this.$nextTick(function (_) {
411
+ return _this2.adjustSpinners();
412
+ });
413
+ this.needInitAdjust = false;
414
+ }
415
+ },
416
+ selectableRange: function selectableRange(val) {
417
+ this.$refs.spinner.selectableRange = val;
418
+ },
419
+ defaultValue: function defaultValue(val) {
420
+ if (!Object(date_util_["isDate"])(this.value)) {
421
+ this.date = val ? new Date(val) : new Date();
422
+ }
423
+ }
424
+ },
425
+
426
+ data: function data() {
427
+ return {
428
+ popperClass: '',
429
+ format: 'HH:mm:ss',
430
+ value: '',
431
+ defaultValue: null,
432
+ date: new Date(),
433
+ oldValue: new Date(),
434
+ selectableRange: [],
435
+ selectionRange: [0, 2],
436
+ disabled: false,
437
+ arrowControl: false,
438
+ needInitAdjust: true
439
+ };
440
+ },
441
+
442
+
443
+ computed: {
444
+ showSeconds: function showSeconds() {
445
+ return (this.format || '').indexOf('ss') !== -1;
446
+ },
447
+ useArrow: function useArrow() {
448
+ return this.arrowControl || this.timeArrowControl || false;
449
+ },
450
+ amPmMode: function amPmMode() {
451
+ if ((this.format || '').indexOf('A') !== -1) return 'A';
452
+ if ((this.format || '').indexOf('a') !== -1) return 'a';
453
+ return '';
454
+ }
455
+ },
456
+
457
+ methods: {
458
+ handleCancel: function handleCancel() {
459
+ this.$emit('pick', this.oldValue, false);
460
+ },
461
+ handleChange: function handleChange(date) {
462
+ // this.visible avoids edge cases, when use scrolls during panel closing animation
463
+ if (this.visible) {
464
+ this.date = Object(date_util_["clearMilliseconds"])(date);
465
+ // if date is out of range, do not emit
466
+ if (this.isValidValue(this.date)) {
467
+ this.$emit('pick', this.date, true);
468
+ }
469
+ }
470
+ },
471
+ setSelectionRange: function setSelectionRange(start, end) {
472
+ this.$emit('select-range', start, end);
473
+ this.selectionRange = [start, end];
474
+ },
475
+ handleConfirm: function handleConfirm() {
476
+ var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
477
+ var first = arguments[1];
478
+
479
+ if (first) return;
480
+ var date = Object(date_util_["clearMilliseconds"])(Object(date_util_["limitTimeRange"])(this.date, this.selectableRange, this.format));
481
+ this.$emit('pick', date, visible, first);
482
+ },
483
+ handleKeydown: function handleKeydown(event) {
484
+ var keyCode = event.keyCode;
485
+ var mapping = { 38: -1, 40: 1, 37: -1, 39: 1 };
486
+
487
+ // Left or Right
488
+ if (keyCode === 37 || keyCode === 39) {
489
+ var step = mapping[keyCode];
490
+ this.changeSelectionRange(step);
491
+ event.preventDefault();
492
+ return;
493
+ }
494
+
495
+ // Up or Down
496
+ if (keyCode === 38 || keyCode === 40) {
497
+ var _step = mapping[keyCode];
498
+ this.$refs.spinner.scrollDown(_step);
499
+ event.preventDefault();
500
+ return;
501
+ }
502
+ },
503
+ isValidValue: function isValidValue(date) {
504
+ return Object(date_util_["timeWithinRange"])(date, this.selectableRange, this.format);
505
+ },
506
+ adjustSpinners: function adjustSpinners() {
507
+ return this.$refs.spinner.adjustSpinners();
508
+ },
509
+ changeSelectionRange: function changeSelectionRange(step) {
510
+ var list = [0, 3].concat(this.showSeconds ? [6] : []);
511
+ var mapping = ['hours', 'minutes'].concat(this.showSeconds ? ['seconds'] : []);
512
+ var index = list.indexOf(this.selectionRange[0]);
513
+ var next = (index + step + list.length) % list.length;
514
+ this.$refs.spinner.emitSelectRange(mapping[next]);
515
+ }
516
+ },
517
+
518
+ mounted: function mounted() {
519
+ var _this3 = this;
520
+
521
+ this.$nextTick(function () {
522
+ return _this3.handleConfirm(true, true);
523
+ });
524
+ this.$emit('mounted');
525
+ }
526
526
  });
527
527
  // CONCATENATED MODULE: ./packages/date-picker/src/panel/time.vue?vue&type=script&lang=js
528
528
  /* harmony default export */ var panel_timevue_type_script_lang_js = (timevue_type_script_lang_js);
@@ -571,29 +571,29 @@ module.exports = require("element-ui/lib/utils/util");
571
571
 
572
572
 
573
573
  /* harmony default export */ __webpack_exports__["a"] = ({
574
- bind: function bind(el, binding, vnode) {
575
- var interval = null;
576
- var startTime = void 0;
577
- var maxIntervals = Object(element_ui_src_utils_util__WEBPACK_IMPORTED_MODULE_1__["isMac"])() ? 100 : 200;
578
- var handler = function handler() {
579
- return vnode.context[binding.expression].apply();
580
- };
581
- var clear = function clear() {
582
- if (Date.now() - startTime < maxIntervals) {
583
- handler();
584
- }
585
- clearInterval(interval);
586
- interval = null;
587
- };
588
-
589
- Object(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__["on"])(el, 'mousedown', function (e) {
590
- if (e.button !== 0) return;
591
- startTime = Date.now();
592
- Object(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__["once"])(document, 'mouseup', clear);
593
- clearInterval(interval);
594
- interval = setInterval(handler, maxIntervals);
595
- });
596
- }
574
+ bind: function bind(el, binding, vnode) {
575
+ var interval = null;
576
+ var startTime = void 0;
577
+ var maxIntervals = Object(element_ui_src_utils_util__WEBPACK_IMPORTED_MODULE_1__["isMac"])() ? 100 : 200;
578
+ var handler = function handler() {
579
+ return vnode.context[binding.expression].apply();
580
+ };
581
+ var clear = function clear() {
582
+ if (Date.now() - startTime < maxIntervals) {
583
+ handler();
584
+ }
585
+ clearInterval(interval);
586
+ interval = null;
587
+ };
588
+
589
+ Object(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__["on"])(el, 'mousedown', function (e) {
590
+ if (e.button !== 0) return;
591
+ startTime = Date.now();
592
+ Object(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__["once"])(document, 'mouseup', clear);
593
+ clearInterval(interval);
594
+ interval = setInterval(handler, maxIntervals);
595
+ });
596
+ }
597
597
  });
598
598
 
599
599
  /***/ }),
@@ -603,7 +603,7 @@ module.exports = require("element-ui/lib/utils/util");
603
603
 
604
604
  "use strict";
605
605
 
606
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/picker.vue?vue&type=template&id=a845df9c
606
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/picker.vue?vue&type=template&id=2d3bd15e
607
607
  var render = function () {
608
608
  var _vm = this
609
609
  var _h = _vm.$createElement
@@ -781,7 +781,7 @@ var staticRenderFns = []
781
781
  render._withStripped = true
782
782
 
783
783
 
784
- // CONCATENATED MODULE: ./packages/date-picker/src/picker.vue?vue&type=template&id=a845df9c
784
+ // CONCATENATED MODULE: ./packages/date-picker/src/picker.vue?vue&type=template&id=2d3bd15e
785
785
 
786
786
  // EXTERNAL MODULE: external "vue"
787
787
  var external_vue_ = __webpack_require__(6);
@@ -906,205 +906,205 @@ var merge_default = /*#__PURE__*/__webpack_require__.n(merge_);
906
906
 
907
907
 
908
908
  var NewPopper = {
909
- props: {
910
- appendToBody: vue_popper_default.a.props.appendToBody,
911
- offset: vue_popper_default.a.props.offset,
912
- boundariesPadding: vue_popper_default.a.props.boundariesPadding,
913
- arrowOffset: vue_popper_default.a.props.arrowOffset,
914
- transformOrigin: vue_popper_default.a.props.transformOrigin
915
- },
916
- methods: vue_popper_default.a.methods,
917
- data: function data() {
918
- return merge_default()({ visibleArrow: true }, vue_popper_default.a.data);
919
- },
920
-
921
- beforeDestroy: vue_popper_default.a.beforeDestroy
909
+ props: {
910
+ appendToBody: vue_popper_default.a.props.appendToBody,
911
+ offset: vue_popper_default.a.props.offset,
912
+ boundariesPadding: vue_popper_default.a.props.boundariesPadding,
913
+ arrowOffset: vue_popper_default.a.props.arrowOffset,
914
+ transformOrigin: vue_popper_default.a.props.transformOrigin
915
+ },
916
+ methods: vue_popper_default.a.methods,
917
+ data: function data() {
918
+ return merge_default()({ visibleArrow: true }, vue_popper_default.a.data);
919
+ },
920
+
921
+ beforeDestroy: vue_popper_default.a.beforeDestroy
922
922
  };
923
923
 
924
924
  var DEFAULT_FORMATS = {
925
- date: 'yyyy-MM-dd',
926
- month: 'yyyy-MM',
927
- months: 'yyyy-MM',
928
- datetime: 'yyyy-MM-dd HH:mm:ss',
929
- time: 'HH:mm:ss',
930
- week: 'yyyywWW',
931
- timerange: 'HH:mm:ss',
932
- daterange: 'yyyy-MM-dd',
933
- monthrange: 'yyyy-MM',
934
- datetimerange: 'yyyy-MM-dd HH:mm:ss',
935
- year: 'yyyy',
936
- years: 'yyyy'
925
+ date: 'yyyy-MM-dd',
926
+ month: 'yyyy-MM',
927
+ months: 'yyyy-MM',
928
+ datetime: 'yyyy-MM-dd HH:mm:ss',
929
+ time: 'HH:mm:ss',
930
+ week: 'yyyywWW',
931
+ timerange: 'HH:mm:ss',
932
+ daterange: 'yyyy-MM-dd',
933
+ monthrange: 'yyyy-MM',
934
+ datetimerange: 'yyyy-MM-dd HH:mm:ss',
935
+ year: 'yyyy',
936
+ years: 'yyyy'
937
937
  };
938
938
  var HAVE_TRIGGER_TYPES = ['date', 'datetime', 'time', 'time-select', 'week', 'month', 'year', 'daterange', 'monthrange', 'timerange', 'datetimerange', 'dates', 'months', 'years'];
939
939
  var pickervue_type_script_lang_js_DATE_FORMATTER = function DATE_FORMATTER(value, format) {
940
- if (format === 'timestamp') return value.getTime();
941
- return Object(date_util_["formatDate"])(value, format);
940
+ if (format === 'timestamp') return value.getTime();
941
+ return Object(date_util_["formatDate"])(value, format);
942
942
  };
943
943
  var pickervue_type_script_lang_js_DATE_PARSER = function DATE_PARSER(text, format) {
944
- if (format === 'timestamp') return new Date(Number(text));
945
- return Object(date_util_["parseDate"])(text, format);
944
+ if (format === 'timestamp') return new Date(Number(text));
945
+ return Object(date_util_["parseDate"])(text, format);
946
946
  };
947
947
  var RANGE_FORMATTER = function RANGE_FORMATTER(value, format) {
948
- if (Array.isArray(value) && value.length === 2) {
949
- var start = value[0];
950
- var end = value[1];
951
-
952
- if (start && end) {
953
- return [pickervue_type_script_lang_js_DATE_FORMATTER(start, format), pickervue_type_script_lang_js_DATE_FORMATTER(end, format)];
954
- }
955
- }
956
- return '';
948
+ if (Array.isArray(value) && value.length === 2) {
949
+ var start = value[0];
950
+ var end = value[1];
951
+
952
+ if (start && end) {
953
+ return [pickervue_type_script_lang_js_DATE_FORMATTER(start, format), pickervue_type_script_lang_js_DATE_FORMATTER(end, format)];
954
+ }
955
+ }
956
+ return '';
957
957
  };
958
958
  var RANGE_PARSER = function RANGE_PARSER(array, format, separator) {
959
- if (!Array.isArray(array)) {
960
- array = array.split(separator);
961
- }
962
- if (array.length === 2) {
963
- var range1 = array[0];
964
- var range2 = array[1];
965
-
966
- return [pickervue_type_script_lang_js_DATE_PARSER(range1, format), pickervue_type_script_lang_js_DATE_PARSER(range2, format)];
967
- }
968
- return [];
959
+ if (!Array.isArray(array)) {
960
+ array = array.split(separator);
961
+ }
962
+ if (array.length === 2) {
963
+ var range1 = array[0];
964
+ var range2 = array[1];
965
+
966
+ return [pickervue_type_script_lang_js_DATE_PARSER(range1, format), pickervue_type_script_lang_js_DATE_PARSER(range2, format)];
967
+ }
968
+ return [];
969
969
  };
970
970
  var TYPE_VALUE_RESOLVER_MAP = {
971
- default: {
972
- formatter: function formatter(value) {
973
- if (!value) return '';
974
- return '' + value;
975
- },
976
- parser: function parser(text) {
977
- if (text === undefined || text === '') return null;
978
- return text;
979
- }
980
- },
981
- week: {
982
- formatter: function formatter(value, format) {
983
- var week = Object(date_util_["getWeekNumber"])(value);
984
- var month = value.getMonth();
985
- var trueDate = new Date(value);
986
- if (week === 1 && month === 11) {
987
- trueDate.setHours(0, 0, 0, 0);
988
- trueDate.setDate(trueDate.getDate() + 3 - (trueDate.getDay() + 6) % 7);
989
- }
990
- var date = Object(date_util_["formatDate"])(trueDate, format);
991
-
992
- date = /WW/.test(date) ? date.replace(/WW/, week < 10 ? '0' + week : week) : date.replace(/W/, week);
993
- return date;
994
- },
995
- parser: function parser(text, format) {
996
- // parse as if a normal date
997
- return TYPE_VALUE_RESOLVER_MAP.date.parser(text, format);
998
- }
999
- },
1000
- date: {
1001
- formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
1002
- parser: pickervue_type_script_lang_js_DATE_PARSER
1003
- },
1004
- datetime: {
1005
- formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
1006
- parser: pickervue_type_script_lang_js_DATE_PARSER
1007
- },
1008
- daterange: {
1009
- formatter: RANGE_FORMATTER,
1010
- parser: RANGE_PARSER
1011
- },
1012
- monthrange: {
1013
- formatter: RANGE_FORMATTER,
1014
- parser: RANGE_PARSER
1015
- },
1016
- datetimerange: {
1017
- formatter: RANGE_FORMATTER,
1018
- parser: RANGE_PARSER
1019
- },
1020
- timerange: {
1021
- formatter: RANGE_FORMATTER,
1022
- parser: RANGE_PARSER
1023
- },
1024
- time: {
1025
- formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
1026
- parser: pickervue_type_script_lang_js_DATE_PARSER
1027
- },
1028
- month: {
1029
- formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
1030
- parser: pickervue_type_script_lang_js_DATE_PARSER
1031
- },
1032
- year: {
1033
- formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
1034
- parser: pickervue_type_script_lang_js_DATE_PARSER
1035
- },
1036
- number: {
1037
- formatter: function formatter(value) {
1038
- if (!value) return '';
1039
- return '' + value;
1040
- },
1041
- parser: function parser(text) {
1042
- var result = Number(text);
1043
-
1044
- if (!isNaN(text)) {
1045
- return result;
1046
- } else {
1047
- return null;
1048
- }
1049
- }
1050
- },
1051
- dates: {
1052
- formatter: function formatter(value, format) {
1053
- return value.map(function (date) {
1054
- return pickervue_type_script_lang_js_DATE_FORMATTER(date, format);
1055
- });
1056
- },
1057
- parser: function parser(value, format) {
1058
- return (typeof value === 'string' ? value.split(', ') : value).map(function (date) {
1059
- return date instanceof Date ? date : pickervue_type_script_lang_js_DATE_PARSER(date, format);
1060
- });
1061
- }
1062
- },
1063
- months: {
1064
- formatter: function formatter(value, format) {
1065
- return value.map(function (date) {
1066
- return pickervue_type_script_lang_js_DATE_FORMATTER(date, format);
1067
- });
1068
- },
1069
- parser: function parser(value, format) {
1070
- return (typeof value === 'string' ? value.split(', ') : value).map(function (date) {
1071
- return date instanceof Date ? date : pickervue_type_script_lang_js_DATE_PARSER(date, format);
1072
- });
1073
- }
1074
- },
1075
- years: {
1076
- formatter: function formatter(value, format) {
1077
- return value.map(function (date) {
1078
- return pickervue_type_script_lang_js_DATE_FORMATTER(date, format);
1079
- });
1080
- },
1081
- parser: function parser(value, format) {
1082
- return (typeof value === 'string' ? value.split(', ') : value).map(function (date) {
1083
- return date instanceof Date ? date : pickervue_type_script_lang_js_DATE_PARSER(date, format);
1084
- });
1085
- }
1086
- }
971
+ default: {
972
+ formatter: function formatter(value) {
973
+ if (!value) return '';
974
+ return '' + value;
975
+ },
976
+ parser: function parser(text) {
977
+ if (text === undefined || text === '') return null;
978
+ return text;
979
+ }
980
+ },
981
+ week: {
982
+ formatter: function formatter(value, format) {
983
+ var week = Object(date_util_["getWeekNumber"])(value);
984
+ var month = value.getMonth();
985
+ var trueDate = new Date(value);
986
+ if (week === 1 && month === 11) {
987
+ trueDate.setHours(0, 0, 0, 0);
988
+ trueDate.setDate(trueDate.getDate() + 3 - (trueDate.getDay() + 6) % 7);
989
+ }
990
+ var date = Object(date_util_["formatDate"])(trueDate, format);
991
+
992
+ date = /WW/.test(date) ? date.replace(/WW/, week < 10 ? '0' + week : week) : date.replace(/W/, week);
993
+ return date;
994
+ },
995
+ parser: function parser(text, format) {
996
+ // parse as if a normal date
997
+ return TYPE_VALUE_RESOLVER_MAP.date.parser(text, format);
998
+ }
999
+ },
1000
+ date: {
1001
+ formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
1002
+ parser: pickervue_type_script_lang_js_DATE_PARSER
1003
+ },
1004
+ datetime: {
1005
+ formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
1006
+ parser: pickervue_type_script_lang_js_DATE_PARSER
1007
+ },
1008
+ daterange: {
1009
+ formatter: RANGE_FORMATTER,
1010
+ parser: RANGE_PARSER
1011
+ },
1012
+ monthrange: {
1013
+ formatter: RANGE_FORMATTER,
1014
+ parser: RANGE_PARSER
1015
+ },
1016
+ datetimerange: {
1017
+ formatter: RANGE_FORMATTER,
1018
+ parser: RANGE_PARSER
1019
+ },
1020
+ timerange: {
1021
+ formatter: RANGE_FORMATTER,
1022
+ parser: RANGE_PARSER
1023
+ },
1024
+ time: {
1025
+ formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
1026
+ parser: pickervue_type_script_lang_js_DATE_PARSER
1027
+ },
1028
+ month: {
1029
+ formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
1030
+ parser: pickervue_type_script_lang_js_DATE_PARSER
1031
+ },
1032
+ year: {
1033
+ formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
1034
+ parser: pickervue_type_script_lang_js_DATE_PARSER
1035
+ },
1036
+ number: {
1037
+ formatter: function formatter(value) {
1038
+ if (!value) return '';
1039
+ return '' + value;
1040
+ },
1041
+ parser: function parser(text) {
1042
+ var result = Number(text);
1043
+
1044
+ if (!isNaN(text)) {
1045
+ return result;
1046
+ } else {
1047
+ return null;
1048
+ }
1049
+ }
1050
+ },
1051
+ dates: {
1052
+ formatter: function formatter(value, format) {
1053
+ return value.map(function (date) {
1054
+ return pickervue_type_script_lang_js_DATE_FORMATTER(date, format);
1055
+ });
1056
+ },
1057
+ parser: function parser(value, format) {
1058
+ return (typeof value === 'string' ? value.split(', ') : value).map(function (date) {
1059
+ return date instanceof Date ? date : pickervue_type_script_lang_js_DATE_PARSER(date, format);
1060
+ });
1061
+ }
1062
+ },
1063
+ months: {
1064
+ formatter: function formatter(value, format) {
1065
+ return value.map(function (date) {
1066
+ return pickervue_type_script_lang_js_DATE_FORMATTER(date, format);
1067
+ });
1068
+ },
1069
+ parser: function parser(value, format) {
1070
+ return (typeof value === 'string' ? value.split(', ') : value).map(function (date) {
1071
+ return date instanceof Date ? date : pickervue_type_script_lang_js_DATE_PARSER(date, format);
1072
+ });
1073
+ }
1074
+ },
1075
+ years: {
1076
+ formatter: function formatter(value, format) {
1077
+ return value.map(function (date) {
1078
+ return pickervue_type_script_lang_js_DATE_FORMATTER(date, format);
1079
+ });
1080
+ },
1081
+ parser: function parser(value, format) {
1082
+ return (typeof value === 'string' ? value.split(', ') : value).map(function (date) {
1083
+ return date instanceof Date ? date : pickervue_type_script_lang_js_DATE_PARSER(date, format);
1084
+ });
1085
+ }
1086
+ }
1087
1087
  };
1088
1088
  var PLACEMENT_MAP = {
1089
- left: 'bottom-start',
1090
- center: 'bottom',
1091
- right: 'bottom-end'
1089
+ left: 'bottom-start',
1090
+ center: 'bottom',
1091
+ right: 'bottom-end'
1092
1092
  };
1093
1093
 
1094
1094
  var parseAsFormatAndType = function parseAsFormatAndType(value, customFormat, type) {
1095
- var rangeSeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '-';
1095
+ var rangeSeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '-';
1096
1096
 
1097
- if (!value) return null;
1098
- var parser = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP['default']).parser;
1099
- var format = customFormat || DEFAULT_FORMATS[type];
1100
- return parser(value, format, rangeSeparator);
1097
+ if (!value) return null;
1098
+ var parser = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP['default']).parser;
1099
+ var format = customFormat || DEFAULT_FORMATS[type];
1100
+ return parser(value, format, rangeSeparator);
1101
1101
  };
1102
1102
 
1103
1103
  var formatAsFormatAndType = function formatAsFormatAndType(value, customFormat, type) {
1104
- if (!value) return null;
1105
- var formatter = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP['default']).formatter;
1106
- var format = customFormat || DEFAULT_FORMATS[type];
1107
- return formatter(value, format);
1104
+ if (!value) return null;
1105
+ var formatter = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP['default']).formatter;
1106
+ var format = customFormat || DEFAULT_FORMATS[type];
1107
+ return formatter(value, format);
1108
1108
  };
1109
1109
 
1110
1110
  /*
@@ -1114,625 +1114,625 @@ var formatAsFormatAndType = function formatAsFormatAndType(value, customFormat,
1114
1114
  * 3. array of 1 or 2
1115
1115
  */
1116
1116
  var valueEquals = function valueEquals(a, b) {
1117
- // considers Date object and string
1118
- var dateEquals = function dateEquals(a, b) {
1119
- var aIsDate = a instanceof Date;
1120
- var bIsDate = b instanceof Date;
1121
- if (aIsDate && bIsDate) {
1122
- return a.getTime() === b.getTime();
1123
- }
1124
- if (!aIsDate && !bIsDate) {
1125
- return a === b;
1126
- }
1127
- return false;
1128
- };
1129
-
1130
- var aIsArray = a instanceof Array;
1131
- var bIsArray = b instanceof Array;
1132
- if (aIsArray && bIsArray) {
1133
- if (a.length !== b.length) {
1134
- return false;
1135
- }
1136
- return a.every(function (item, index) {
1137
- return dateEquals(item, b[index]);
1138
- });
1139
- }
1140
- if (!aIsArray && !bIsArray) {
1141
- return dateEquals(a, b);
1142
- }
1143
- return false;
1117
+ // considers Date object and string
1118
+ var dateEquals = function dateEquals(a, b) {
1119
+ var aIsDate = a instanceof Date;
1120
+ var bIsDate = b instanceof Date;
1121
+ if (aIsDate && bIsDate) {
1122
+ return a.getTime() === b.getTime();
1123
+ }
1124
+ if (!aIsDate && !bIsDate) {
1125
+ return a === b;
1126
+ }
1127
+ return false;
1128
+ };
1129
+
1130
+ var aIsArray = a instanceof Array;
1131
+ var bIsArray = b instanceof Array;
1132
+ if (aIsArray && bIsArray) {
1133
+ if (a.length !== b.length) {
1134
+ return false;
1135
+ }
1136
+ return a.every(function (item, index) {
1137
+ return dateEquals(item, b[index]);
1138
+ });
1139
+ }
1140
+ if (!aIsArray && !bIsArray) {
1141
+ return dateEquals(a, b);
1142
+ }
1143
+ return false;
1144
1144
  };
1145
1145
 
1146
1146
  var isString = function isString(val) {
1147
- return typeof val === 'string' || val instanceof String;
1147
+ return typeof val === 'string' || val instanceof String;
1148
1148
  };
1149
1149
 
1150
1150
  var validator = function validator(val) {
1151
- // either: String, Array of String, null / undefined
1152
- return val === null || val === undefined || isString(val) || Array.isArray(val) && val.length === 2 && val.every(isString);
1151
+ // either: String, Array of String, null / undefined
1152
+ return val === null || val === undefined || isString(val) || Array.isArray(val) && val.length === 2 && val.every(isString);
1153
1153
  };
1154
1154
 
1155
1155
  /* harmony default export */ var pickervue_type_script_lang_js = ({
1156
- mixins: [emitter_default.a, NewPopper],
1157
-
1158
- inject: {
1159
- elForm: {
1160
- default: ''
1161
- },
1162
- elFormItem: {
1163
- default: ''
1164
- }
1165
- },
1166
-
1167
- props: {
1168
- size: String,
1169
- format: String,
1170
- valueFormat: String,
1171
- readonly: Boolean,
1172
- placeholder: String,
1173
- startPlaceholder: String,
1174
- endPlaceholder: String,
1175
- prefixIcon: String,
1176
- clearIcon: {
1177
- type: String,
1178
- default: 'el-icon-circle-close'
1179
- },
1180
- name: {
1181
- default: '',
1182
- validator: validator
1183
- },
1184
- disabled: Boolean,
1185
- clearable: {
1186
- type: Boolean,
1187
- default: true
1188
- },
1189
- id: {
1190
- default: '',
1191
- validator: validator
1192
- },
1193
- popperClass: String,
1194
- editable: {
1195
- type: Boolean,
1196
- default: true
1197
- },
1198
- align: {
1199
- type: String,
1200
- default: 'left'
1201
- },
1202
- value: {},
1203
- defaultValue: {},
1204
- defaultTime: {},
1205
- rangeSeparator: {
1206
- default: '-'
1207
- },
1208
- pickerOptions: {},
1209
- unlinkPanels: Boolean,
1210
- validateEvent: {
1211
- type: Boolean,
1212
- default: true
1213
- }
1214
- },
1215
-
1216
- components: { ElInput: input_default.a },
1217
-
1218
- directives: { Clickoutside: clickoutside_default.a },
1219
-
1220
- data: function data() {
1221
- return {
1222
- pickerVisible: false,
1223
- showClose: false,
1224
- userInput: null,
1225
- valueOnOpen: null, // value when picker opens, used to determine whether to emit change
1226
- unwatchPickerOptions: null
1227
- };
1228
- },
1229
-
1230
-
1231
- watch: {
1232
- pickerVisible: function pickerVisible(val) {
1233
- if (this.readonly || this.pickerDisabled) return;
1234
- if (val) {
1235
- this.showPicker();
1236
- this.valueOnOpen = Array.isArray(this.value) ? [].concat(this.value) : this.value;
1237
- } else {
1238
- this.hidePicker();
1239
- this.emitChange(this.value);
1240
- this.userInput = null;
1241
- if (this.validateEvent) {
1242
- this.dispatch('ElFormItem', 'el.form.blur');
1243
- }
1244
- this.$emit('blur', this);
1245
- this.blur();
1246
- }
1247
- },
1248
-
1249
- parsedValue: {
1250
- immediate: true,
1251
- handler: function handler(val) {
1252
- if (this.picker) {
1253
- this.picker.value = val;
1254
- }
1255
- }
1256
- },
1257
- defaultValue: function defaultValue(val) {
1258
- // NOTE: should eventually move to jsx style picker + panel ?
1259
- if (this.picker) {
1260
- this.picker.defaultValue = val;
1261
- }
1262
- },
1263
- value: function value(val, oldVal) {
1264
- if (!valueEquals(val, oldVal) && !this.pickerVisible && this.validateEvent) {
1265
- this.dispatch('ElFormItem', 'el.form.change', val);
1266
- }
1267
- }
1268
- },
1269
-
1270
- computed: {
1271
- ranged: function ranged() {
1272
- return this.type.indexOf('range') > -1;
1273
- },
1274
- reference: function reference() {
1275
- var reference = this.$refs.reference;
1276
- return reference.$el || reference;
1277
- },
1278
- refInput: function refInput() {
1279
- if (this.reference) {
1280
- return [].slice.call(this.reference.querySelectorAll('input'));
1281
- }
1282
- return [];
1283
- },
1284
- valueIsEmpty: function valueIsEmpty() {
1285
- var val = this.value;
1286
- if (Array.isArray(val)) {
1287
- for (var i = 0, len = val.length; i < len; i++) {
1288
- if (val[i]) {
1289
- return false;
1290
- }
1291
- }
1292
- } else {
1293
- if (val) {
1294
- return false;
1295
- }
1296
- }
1297
- return true;
1298
- },
1299
- triggerClass: function triggerClass() {
1300
- return this.prefixIcon || (this.type.indexOf('time') !== -1 ? 'el-icon-time' : 'el-icon-date');
1301
- },
1302
- selectionMode: function selectionMode() {
1303
- if (this.type === 'week') {
1304
- return 'week';
1305
- } else if (this.type === 'month') {
1306
- return 'month';
1307
- } else if (this.type === 'year') {
1308
- return 'year';
1309
- } else if (this.type === 'dates') {
1310
- return 'dates';
1311
- } else if (this.type === 'months') {
1312
- return 'months';
1313
- } else if (this.type === 'years') {
1314
- return 'years';
1315
- }
1316
-
1317
- return 'day';
1318
- },
1319
- haveTrigger: function haveTrigger() {
1320
- if (typeof this.showTrigger !== 'undefined') {
1321
- return this.showTrigger;
1322
- }
1323
- return HAVE_TRIGGER_TYPES.indexOf(this.type) !== -1;
1324
- },
1325
- displayValue: function displayValue() {
1326
- var formattedValue = formatAsFormatAndType(this.parsedValue, this.format, this.type, this.rangeSeparator);
1327
- if (Array.isArray(this.userInput)) {
1328
- return [this.userInput[0] || formattedValue && formattedValue[0] || '', this.userInput[1] || formattedValue && formattedValue[1] || ''];
1329
- } else if (this.userInput !== null) {
1330
- return this.userInput;
1331
- } else if (formattedValue) {
1332
- return this.type === 'dates' || this.type === 'years' || this.type === 'months' ? formattedValue.join(', ') : formattedValue;
1333
- } else {
1334
- return '';
1335
- }
1336
- },
1337
- parsedValue: function parsedValue() {
1338
- if (!this.value) return this.value; // component value is not set
1339
- if (this.type === 'time-select') return this.value; // time-select does not require parsing, this might change in next major version
1340
-
1341
- var valueIsDateObject = Object(date_util_["isDateObject"])(this.value) || Array.isArray(this.value) && this.value.every(date_util_["isDateObject"]);
1342
- if (valueIsDateObject) {
1343
- return this.value;
1344
- }
1345
-
1346
- if (this.valueFormat) {
1347
- return parseAsFormatAndType(this.value, this.valueFormat, this.type, this.rangeSeparator) || this.value;
1348
- }
1349
-
1350
- // NOTE: deal with common but incorrect usage, should remove in next major version
1351
- // user might provide string / timestamp without value-format, coerce them into date (or array of date)
1352
- return Array.isArray(this.value) ? this.value.map(function (val) {
1353
- return new Date(val);
1354
- }) : new Date(this.value);
1355
- },
1356
- _elFormItemSize: function _elFormItemSize() {
1357
- return (this.elFormItem || {}).elFormItemSize;
1358
- },
1359
- pickerSize: function pickerSize() {
1360
- return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
1361
- },
1362
- pickerDisabled: function pickerDisabled() {
1363
- return this.disabled || (this.elForm || {}).disabled;
1364
- },
1365
- firstInputId: function firstInputId() {
1366
- var obj = {};
1367
- var id = void 0;
1368
- if (this.ranged) {
1369
- id = this.id && this.id[0];
1370
- } else {
1371
- id = this.id;
1372
- }
1373
- if (id) obj.id = id;
1374
- return obj;
1375
- },
1376
- secondInputId: function secondInputId() {
1377
- var obj = {};
1378
- var id = void 0;
1379
- if (this.ranged) {
1380
- id = this.id && this.id[1];
1381
- }
1382
- if (id) obj.id = id;
1383
- return obj;
1384
- }
1385
- },
1386
-
1387
- created: function created() {
1388
- // vue-popper
1389
- this.popperOptions = {
1390
- boundariesPadding: 0,
1391
- gpuAcceleration: false
1392
- };
1393
- this.placement = PLACEMENT_MAP[this.align] || PLACEMENT_MAP.left;
1394
-
1395
- this.$on('fieldReset', this.handleFieldReset);
1396
- },
1397
-
1398
-
1399
- methods: {
1400
- focus: function focus() {
1401
- if (!this.ranged) {
1402
- this.$refs.reference.focus();
1403
- } else {
1404
- this.handleFocus();
1405
- }
1406
- },
1407
- blur: function blur() {
1408
- this.refInput.forEach(function (input) {
1409
- return input.blur();
1410
- });
1411
- },
1412
-
1413
-
1414
- // {parse, formatTo} Value deals maps component value with internal Date
1415
- parseValue: function parseValue(value) {
1416
- var isParsed = Object(date_util_["isDateObject"])(value) || Array.isArray(value) && value.every(date_util_["isDateObject"]);
1417
- if (this.valueFormat && !isParsed) {
1418
- return parseAsFormatAndType(value, this.valueFormat, this.type, this.rangeSeparator) || value;
1419
- } else {
1420
- return value;
1421
- }
1422
- },
1423
- formatToValue: function formatToValue(date) {
1424
- var isFormattable = Object(date_util_["isDateObject"])(date) || Array.isArray(date) && date.every(date_util_["isDateObject"]);
1425
- if (this.valueFormat && isFormattable) {
1426
- return formatAsFormatAndType(date, this.valueFormat, this.type, this.rangeSeparator);
1427
- } else {
1428
- return date;
1429
- }
1430
- },
1431
-
1432
-
1433
- // {parse, formatTo} String deals with user input
1434
- parseString: function parseString(value) {
1435
- var type = Array.isArray(value) ? this.type : this.type.replace('range', '');
1436
- return parseAsFormatAndType(value, this.format, type);
1437
- },
1438
- formatToString: function formatToString(value) {
1439
- var type = Array.isArray(value) ? this.type : this.type.replace('range', '');
1440
- return formatAsFormatAndType(value, this.format, type);
1441
- },
1442
- handleMouseEnter: function handleMouseEnter() {
1443
- if (this.readonly || this.pickerDisabled) return;
1444
- if (!this.valueIsEmpty && this.clearable) {
1445
- this.showClose = true;
1446
- }
1447
- },
1448
- handleChange: function handleChange() {
1449
- if (this.userInput) {
1450
- var value = this.parseString(this.displayValue);
1451
- if (value) {
1452
- this.picker.value = value;
1453
- if (this.isValidValue(value)) {
1454
- this.emitInput(value);
1455
- this.userInput = null;
1456
- }
1457
- }
1458
- }
1459
- if (this.userInput === '') {
1460
- this.emitInput(null);
1461
- this.emitChange(null);
1462
- this.userInput = null;
1463
- }
1464
- },
1465
- handleStartInput: function handleStartInput(event) {
1466
- if (this.userInput) {
1467
- this.userInput = [event.target.value, this.userInput[1]];
1468
- } else {
1469
- this.userInput = [event.target.value, null];
1470
- }
1471
- },
1472
- handleEndInput: function handleEndInput(event) {
1473
- if (this.userInput) {
1474
- this.userInput = [this.userInput[0], event.target.value];
1475
- } else {
1476
- this.userInput = [null, event.target.value];
1477
- }
1478
- },
1479
- handleStartChange: function handleStartChange(event) {
1480
- var value = this.parseString(this.userInput && this.userInput[0]);
1481
- if (value) {
1482
- this.userInput = [this.formatToString(value), this.displayValue[1]];
1483
- var newValue = [value, this.picker.value && this.picker.value[1]];
1484
- this.picker.value = newValue;
1485
- if (this.isValidValue(newValue)) {
1486
- this.emitInput(newValue);
1487
- this.userInput = null;
1488
- }
1489
- }
1490
- },
1491
- handleEndChange: function handleEndChange(event) {
1492
- var value = this.parseString(this.userInput && this.userInput[1]);
1493
- if (value) {
1494
- this.userInput = [this.displayValue[0], this.formatToString(value)];
1495
- var newValue = [this.picker.value && this.picker.value[0], value];
1496
- this.picker.value = newValue;
1497
- if (this.isValidValue(newValue)) {
1498
- this.emitInput(newValue);
1499
- this.userInput = null;
1500
- }
1501
- }
1502
- },
1503
- handleClickIcon: function handleClickIcon(event) {
1504
- if (this.readonly || this.pickerDisabled) return;
1505
- if (this.showClose) {
1506
- this.valueOnOpen = this.value;
1507
- event.stopPropagation();
1508
- this.emitInput(null);
1509
- this.emitChange(null);
1510
- this.showClose = false;
1511
- if (this.picker && typeof this.picker.handleClear === 'function') {
1512
- this.picker.handleClear();
1513
- }
1514
- } else {
1515
- this.pickerVisible = !this.pickerVisible;
1516
- }
1517
- },
1518
- handleClose: function handleClose() {
1519
- if (!this.pickerVisible) return;
1520
- this.pickerVisible = false;
1521
-
1522
- if (this.type === 'dates' || this.type === 'years' || this.type === 'months') {
1523
- // restore to former value
1524
- var oldValue = parseAsFormatAndType(this.valueOnOpen, this.valueFormat, this.type, this.rangeSeparator) || this.valueOnOpen;
1525
- this.emitInput(oldValue);
1526
- }
1527
- },
1528
- handleFieldReset: function handleFieldReset(initialValue) {
1529
- this.userInput = initialValue === '' ? null : initialValue;
1530
- },
1531
- handleFocus: function handleFocus() {
1532
- var type = this.type;
1533
-
1534
- if (HAVE_TRIGGER_TYPES.indexOf(type) !== -1 && !this.pickerVisible) {
1535
- this.pickerVisible = true;
1536
- }
1537
- this.$emit('focus', this);
1538
- },
1539
- handleKeydown: function handleKeydown(event) {
1540
- var _this = this;
1541
-
1542
- var keyCode = event.keyCode;
1543
-
1544
- // ESC
1545
- if (keyCode === 27) {
1546
- this.pickerVisible = false;
1547
- event.stopPropagation();
1548
- return;
1549
- }
1550
-
1551
- // Tab
1552
- if (keyCode === 9) {
1553
- if (!this.ranged) {
1554
- this.handleChange();
1555
- this.pickerVisible = this.picker.visible = false;
1556
- this.blur();
1557
- event.stopPropagation();
1558
- } else {
1559
- // user may change focus between two input
1560
- setTimeout(function () {
1561
- if (_this.refInput.indexOf(document.activeElement) === -1) {
1562
- _this.pickerVisible = false;
1563
- _this.blur();
1564
- event.stopPropagation();
1565
- }
1566
- }, 0);
1567
- }
1568
- return;
1569
- }
1570
-
1571
- // Enter
1572
- if (keyCode === 13) {
1573
- if (this.userInput === '' || this.isValidValue(this.parseString(this.displayValue))) {
1574
- this.handleChange();
1575
- this.pickerVisible = this.picker.visible = false;
1576
- this.blur();
1577
- }
1578
- event.stopPropagation();
1579
- return;
1580
- }
1581
-
1582
- // if user is typing, do not let picker handle key input
1583
- if (this.userInput) {
1584
- event.stopPropagation();
1585
- return;
1586
- }
1587
-
1588
- // delegate other keys to panel
1589
- if (this.picker && this.picker.handleKeydown) {
1590
- this.picker.handleKeydown(event);
1591
- }
1592
- },
1593
- handleRangeClick: function handleRangeClick() {
1594
- var type = this.type;
1595
-
1596
- if (HAVE_TRIGGER_TYPES.indexOf(type) !== -1 && !this.pickerVisible) {
1597
- this.pickerVisible = true;
1598
- }
1599
- this.$emit('focus', this);
1600
- },
1601
- hidePicker: function hidePicker() {
1602
- if (this.picker) {
1603
- this.picker.resetView && this.picker.resetView();
1604
- this.pickerVisible = this.picker.visible = false;
1605
- this.destroyPopper();
1606
- }
1607
- },
1608
- showPicker: function showPicker() {
1609
- var _this2 = this;
1610
-
1611
- if (this.$isServer) return;
1612
- if (!this.picker) {
1613
- this.mountPicker();
1614
- }
1615
- this.pickerVisible = this.picker.visible = true;
1616
-
1617
- this.updatePopper();
1618
-
1619
- this.picker.value = this.parsedValue;
1620
- this.picker.resetView && this.picker.resetView();
1621
-
1622
- this.$nextTick(function () {
1623
- _this2.picker.adjustSpinners && _this2.picker.adjustSpinners();
1624
- });
1625
- },
1626
- mountPicker: function mountPicker() {
1627
- var _this3 = this;
1628
-
1629
- this.picker = new external_vue_default.a(this.panel).$mount();
1630
- this.picker.defaultValue = this.defaultValue;
1631
- this.picker.defaultTime = this.defaultTime;
1632
- this.picker.popperClass = this.popperClass;
1633
- this.popperElm = this.picker.$el;
1634
- this.picker.width = this.reference.getBoundingClientRect().width;
1635
- this.picker.showTime = this.type === 'datetime' || this.type === 'datetimerange';
1636
- this.picker.selectionMode = this.selectionMode;
1637
- this.picker.unlinkPanels = this.unlinkPanels;
1638
- this.picker.arrowControl = this.arrowControl || this.timeArrowControl || false;
1639
- this.$watch('format', function (format) {
1640
- _this3.picker.format = format;
1641
- });
1642
-
1643
- var updateOptions = function updateOptions() {
1644
- var options = _this3.pickerOptions;
1645
-
1646
- if (options && options.selectableRange) {
1647
- var ranges = options.selectableRange;
1648
- var parser = TYPE_VALUE_RESOLVER_MAP.datetimerange.parser;
1649
- var format = DEFAULT_FORMATS.timerange;
1650
-
1651
- ranges = Array.isArray(ranges) ? ranges : [ranges];
1652
- _this3.picker.selectableRange = ranges.map(function (range) {
1653
- return parser(range, format, _this3.rangeSeparator);
1654
- });
1655
- }
1656
-
1657
- for (var option in options) {
1658
- if (options.hasOwnProperty(option) &&
1659
- // 忽略 time-picker 的该配置项
1660
- option !== 'selectableRange') {
1661
- _this3.picker[option] = options[option];
1662
- }
1663
- }
1664
-
1665
- // main format must prevail over undocumented pickerOptions.format
1666
- if (_this3.format) {
1667
- _this3.picker.format = _this3.format;
1668
- }
1669
- };
1670
- updateOptions();
1671
- this.unwatchPickerOptions = this.$watch('pickerOptions', function () {
1672
- return updateOptions();
1673
- }, { deep: true });
1674
- this.$el.appendChild(this.picker.$el);
1675
- this.picker.resetView && this.picker.resetView();
1676
-
1677
- this.picker.$on('dodestroy', this.doDestroy);
1678
- this.picker.$on('pick', function () {
1679
- var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
1680
- var visible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1681
-
1682
- _this3.userInput = null;
1683
- _this3.pickerVisible = _this3.picker.visible = visible;
1684
- _this3.emitInput(date);
1685
- _this3.picker.resetView && _this3.picker.resetView();
1686
- });
1687
-
1688
- this.picker.$on('select-range', function (start, end, pos) {
1689
- if (_this3.refInput.length === 0) return;
1690
- if (!pos || pos === 'min') {
1691
- _this3.refInput[0].setSelectionRange(start, end);
1692
- _this3.refInput[0].focus();
1693
- } else if (pos === 'max') {
1694
- _this3.refInput[1].setSelectionRange(start, end);
1695
- _this3.refInput[1].focus();
1696
- }
1697
- });
1698
- },
1699
- unmountPicker: function unmountPicker() {
1700
- if (this.picker) {
1701
- this.picker.$destroy();
1702
- this.picker.$off();
1703
- if (typeof this.unwatchPickerOptions === 'function') {
1704
- this.unwatchPickerOptions();
1705
- }
1706
- this.picker.$el.parentNode.removeChild(this.picker.$el);
1707
- }
1708
- },
1709
- emitChange: function emitChange(val) {
1710
- // determine user real change only
1711
- if (!valueEquals(val, this.valueOnOpen)) {
1712
- this.$emit('change', val);
1713
- this.valueOnOpen = val;
1714
- if (this.validateEvent) {
1715
- this.dispatch('ElFormItem', 'el.form.change', val);
1716
- }
1717
- }
1718
- },
1719
- emitInput: function emitInput(val) {
1720
- var formatted = this.formatToValue(val);
1721
- if (!valueEquals(this.value, formatted)) {
1722
- this.$emit('input', formatted);
1723
- }
1724
- },
1725
- isValidValue: function isValidValue(value) {
1726
- if (!this.picker) {
1727
- this.mountPicker();
1728
- }
1729
- if (this.picker.isValidValue) {
1730
- return value && this.picker.isValidValue(value);
1731
- } else {
1732
- return true;
1733
- }
1734
- }
1735
- }
1156
+ mixins: [emitter_default.a, NewPopper],
1157
+
1158
+ inject: {
1159
+ elForm: {
1160
+ default: ''
1161
+ },
1162
+ elFormItem: {
1163
+ default: ''
1164
+ }
1165
+ },
1166
+
1167
+ props: {
1168
+ size: String,
1169
+ format: String,
1170
+ valueFormat: String,
1171
+ readonly: Boolean,
1172
+ placeholder: String,
1173
+ startPlaceholder: String,
1174
+ endPlaceholder: String,
1175
+ prefixIcon: String,
1176
+ clearIcon: {
1177
+ type: String,
1178
+ default: 'el-icon-circle-close'
1179
+ },
1180
+ name: {
1181
+ default: '',
1182
+ validator: validator
1183
+ },
1184
+ disabled: Boolean,
1185
+ clearable: {
1186
+ type: Boolean,
1187
+ default: true
1188
+ },
1189
+ id: {
1190
+ default: '',
1191
+ validator: validator
1192
+ },
1193
+ popperClass: String,
1194
+ editable: {
1195
+ type: Boolean,
1196
+ default: true
1197
+ },
1198
+ align: {
1199
+ type: String,
1200
+ default: 'left'
1201
+ },
1202
+ value: {},
1203
+ defaultValue: {},
1204
+ defaultTime: {},
1205
+ rangeSeparator: {
1206
+ default: '-'
1207
+ },
1208
+ pickerOptions: {},
1209
+ unlinkPanels: Boolean,
1210
+ validateEvent: {
1211
+ type: Boolean,
1212
+ default: true
1213
+ }
1214
+ },
1215
+
1216
+ components: { ElInput: input_default.a },
1217
+
1218
+ directives: { Clickoutside: clickoutside_default.a },
1219
+
1220
+ data: function data() {
1221
+ return {
1222
+ pickerVisible: false,
1223
+ showClose: false,
1224
+ userInput: null,
1225
+ valueOnOpen: null, // value when picker opens, used to determine whether to emit change
1226
+ unwatchPickerOptions: null
1227
+ };
1228
+ },
1229
+
1230
+
1231
+ watch: {
1232
+ pickerVisible: function pickerVisible(val) {
1233
+ if (this.readonly || this.pickerDisabled) return;
1234
+ if (val) {
1235
+ this.showPicker();
1236
+ this.valueOnOpen = Array.isArray(this.value) ? [].concat(this.value) : this.value;
1237
+ } else {
1238
+ this.hidePicker();
1239
+ this.emitChange(this.value);
1240
+ this.userInput = null;
1241
+ if (this.validateEvent) {
1242
+ this.dispatch('ElFormItem', 'el.form.blur');
1243
+ }
1244
+ this.$emit('blur', this);
1245
+ this.blur();
1246
+ }
1247
+ },
1248
+
1249
+ parsedValue: {
1250
+ immediate: true,
1251
+ handler: function handler(val) {
1252
+ if (this.picker) {
1253
+ this.picker.value = val;
1254
+ }
1255
+ }
1256
+ },
1257
+ defaultValue: function defaultValue(val) {
1258
+ // NOTE: should eventually move to jsx style picker + panel ?
1259
+ if (this.picker) {
1260
+ this.picker.defaultValue = val;
1261
+ }
1262
+ },
1263
+ value: function value(val, oldVal) {
1264
+ if (!valueEquals(val, oldVal) && !this.pickerVisible && this.validateEvent) {
1265
+ this.dispatch('ElFormItem', 'el.form.change', val);
1266
+ }
1267
+ }
1268
+ },
1269
+
1270
+ computed: {
1271
+ ranged: function ranged() {
1272
+ return this.type.indexOf('range') > -1;
1273
+ },
1274
+ reference: function reference() {
1275
+ var reference = this.$refs.reference;
1276
+ return reference.$el || reference;
1277
+ },
1278
+ refInput: function refInput() {
1279
+ if (this.reference) {
1280
+ return [].slice.call(this.reference.querySelectorAll('input'));
1281
+ }
1282
+ return [];
1283
+ },
1284
+ valueIsEmpty: function valueIsEmpty() {
1285
+ var val = this.value;
1286
+ if (Array.isArray(val)) {
1287
+ for (var i = 0, len = val.length; i < len; i++) {
1288
+ if (val[i]) {
1289
+ return false;
1290
+ }
1291
+ }
1292
+ } else {
1293
+ if (val) {
1294
+ return false;
1295
+ }
1296
+ }
1297
+ return true;
1298
+ },
1299
+ triggerClass: function triggerClass() {
1300
+ return this.prefixIcon || (this.type.indexOf('time') !== -1 ? 'el-icon-time' : 'el-icon-date');
1301
+ },
1302
+ selectionMode: function selectionMode() {
1303
+ if (this.type === 'week') {
1304
+ return 'week';
1305
+ } else if (this.type === 'month') {
1306
+ return 'month';
1307
+ } else if (this.type === 'year') {
1308
+ return 'year';
1309
+ } else if (this.type === 'dates') {
1310
+ return 'dates';
1311
+ } else if (this.type === 'months') {
1312
+ return 'months';
1313
+ } else if (this.type === 'years') {
1314
+ return 'years';
1315
+ }
1316
+
1317
+ return 'day';
1318
+ },
1319
+ haveTrigger: function haveTrigger() {
1320
+ if (typeof this.showTrigger !== 'undefined') {
1321
+ return this.showTrigger;
1322
+ }
1323
+ return HAVE_TRIGGER_TYPES.indexOf(this.type) !== -1;
1324
+ },
1325
+ displayValue: function displayValue() {
1326
+ var formattedValue = formatAsFormatAndType(this.parsedValue, this.format, this.type, this.rangeSeparator);
1327
+ if (Array.isArray(this.userInput)) {
1328
+ return [this.userInput[0] || formattedValue && formattedValue[0] || '', this.userInput[1] || formattedValue && formattedValue[1] || ''];
1329
+ } else if (this.userInput !== null) {
1330
+ return this.userInput;
1331
+ } else if (formattedValue) {
1332
+ return this.type === 'dates' || this.type === 'years' || this.type === 'months' ? formattedValue.join(', ') : formattedValue;
1333
+ } else {
1334
+ return '';
1335
+ }
1336
+ },
1337
+ parsedValue: function parsedValue() {
1338
+ if (!this.value) return this.value; // component value is not set
1339
+ if (this.type === 'time-select') return this.value; // time-select does not require parsing, this might change in next major version
1340
+
1341
+ var valueIsDateObject = Object(date_util_["isDateObject"])(this.value) || Array.isArray(this.value) && this.value.every(date_util_["isDateObject"]);
1342
+ if (valueIsDateObject) {
1343
+ return this.value;
1344
+ }
1345
+
1346
+ if (this.valueFormat) {
1347
+ return parseAsFormatAndType(this.value, this.valueFormat, this.type, this.rangeSeparator) || this.value;
1348
+ }
1349
+
1350
+ // NOTE: deal with common but incorrect usage, should remove in next major version
1351
+ // user might provide string / timestamp without value-format, coerce them into date (or array of date)
1352
+ return Array.isArray(this.value) ? this.value.map(function (val) {
1353
+ return new Date(val);
1354
+ }) : new Date(this.value);
1355
+ },
1356
+ _elFormItemSize: function _elFormItemSize() {
1357
+ return (this.elFormItem || {}).elFormItemSize;
1358
+ },
1359
+ pickerSize: function pickerSize() {
1360
+ return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
1361
+ },
1362
+ pickerDisabled: function pickerDisabled() {
1363
+ return this.disabled || (this.elForm || {}).disabled;
1364
+ },
1365
+ firstInputId: function firstInputId() {
1366
+ var obj = {};
1367
+ var id = void 0;
1368
+ if (this.ranged) {
1369
+ id = this.id && this.id[0];
1370
+ } else {
1371
+ id = this.id;
1372
+ }
1373
+ if (id) obj.id = id;
1374
+ return obj;
1375
+ },
1376
+ secondInputId: function secondInputId() {
1377
+ var obj = {};
1378
+ var id = void 0;
1379
+ if (this.ranged) {
1380
+ id = this.id && this.id[1];
1381
+ }
1382
+ if (id) obj.id = id;
1383
+ return obj;
1384
+ }
1385
+ },
1386
+
1387
+ created: function created() {
1388
+ // vue-popper
1389
+ this.popperOptions = {
1390
+ boundariesPadding: 0,
1391
+ gpuAcceleration: false
1392
+ };
1393
+ this.placement = PLACEMENT_MAP[this.align] || PLACEMENT_MAP.left;
1394
+
1395
+ this.$on('fieldReset', this.handleFieldReset);
1396
+ },
1397
+
1398
+
1399
+ methods: {
1400
+ focus: function focus() {
1401
+ if (!this.ranged) {
1402
+ this.$refs.reference.focus();
1403
+ } else {
1404
+ this.handleFocus();
1405
+ }
1406
+ },
1407
+ blur: function blur() {
1408
+ this.refInput.forEach(function (input) {
1409
+ return input.blur();
1410
+ });
1411
+ },
1412
+
1413
+
1414
+ // {parse, formatTo} Value deals maps component value with internal Date
1415
+ parseValue: function parseValue(value) {
1416
+ var isParsed = Object(date_util_["isDateObject"])(value) || Array.isArray(value) && value.every(date_util_["isDateObject"]);
1417
+ if (this.valueFormat && !isParsed) {
1418
+ return parseAsFormatAndType(value, this.valueFormat, this.type, this.rangeSeparator) || value;
1419
+ } else {
1420
+ return value;
1421
+ }
1422
+ },
1423
+ formatToValue: function formatToValue(date) {
1424
+ var isFormattable = Object(date_util_["isDateObject"])(date) || Array.isArray(date) && date.every(date_util_["isDateObject"]);
1425
+ if (this.valueFormat && isFormattable) {
1426
+ return formatAsFormatAndType(date, this.valueFormat, this.type, this.rangeSeparator);
1427
+ } else {
1428
+ return date;
1429
+ }
1430
+ },
1431
+
1432
+
1433
+ // {parse, formatTo} String deals with user input
1434
+ parseString: function parseString(value) {
1435
+ var type = Array.isArray(value) ? this.type : this.type.replace('range', '');
1436
+ return parseAsFormatAndType(value, this.format, type);
1437
+ },
1438
+ formatToString: function formatToString(value) {
1439
+ var type = Array.isArray(value) ? this.type : this.type.replace('range', '');
1440
+ return formatAsFormatAndType(value, this.format, type);
1441
+ },
1442
+ handleMouseEnter: function handleMouseEnter() {
1443
+ if (this.readonly || this.pickerDisabled) return;
1444
+ if (!this.valueIsEmpty && this.clearable) {
1445
+ this.showClose = true;
1446
+ }
1447
+ },
1448
+ handleChange: function handleChange() {
1449
+ if (this.userInput) {
1450
+ var value = this.parseString(this.displayValue);
1451
+ if (value) {
1452
+ this.picker.value = value;
1453
+ if (this.isValidValue(value)) {
1454
+ this.emitInput(value);
1455
+ this.userInput = null;
1456
+ }
1457
+ }
1458
+ }
1459
+ if (this.userInput === '') {
1460
+ this.emitInput(null);
1461
+ this.emitChange(null);
1462
+ this.userInput = null;
1463
+ }
1464
+ },
1465
+ handleStartInput: function handleStartInput(event) {
1466
+ if (this.userInput) {
1467
+ this.userInput = [event.target.value, this.userInput[1]];
1468
+ } else {
1469
+ this.userInput = [event.target.value, null];
1470
+ }
1471
+ },
1472
+ handleEndInput: function handleEndInput(event) {
1473
+ if (this.userInput) {
1474
+ this.userInput = [this.userInput[0], event.target.value];
1475
+ } else {
1476
+ this.userInput = [null, event.target.value];
1477
+ }
1478
+ },
1479
+ handleStartChange: function handleStartChange(event) {
1480
+ var value = this.parseString(this.userInput && this.userInput[0]);
1481
+ if (value) {
1482
+ this.userInput = [this.formatToString(value), this.displayValue[1]];
1483
+ var newValue = [value, this.picker.value && this.picker.value[1]];
1484
+ this.picker.value = newValue;
1485
+ if (this.isValidValue(newValue)) {
1486
+ this.emitInput(newValue);
1487
+ this.userInput = null;
1488
+ }
1489
+ }
1490
+ },
1491
+ handleEndChange: function handleEndChange(event) {
1492
+ var value = this.parseString(this.userInput && this.userInput[1]);
1493
+ if (value) {
1494
+ this.userInput = [this.displayValue[0], this.formatToString(value)];
1495
+ var newValue = [this.picker.value && this.picker.value[0], value];
1496
+ this.picker.value = newValue;
1497
+ if (this.isValidValue(newValue)) {
1498
+ this.emitInput(newValue);
1499
+ this.userInput = null;
1500
+ }
1501
+ }
1502
+ },
1503
+ handleClickIcon: function handleClickIcon(event) {
1504
+ if (this.readonly || this.pickerDisabled) return;
1505
+ if (this.showClose) {
1506
+ this.valueOnOpen = this.value;
1507
+ event.stopPropagation();
1508
+ this.emitInput(null);
1509
+ this.emitChange(null);
1510
+ this.showClose = false;
1511
+ if (this.picker && typeof this.picker.handleClear === 'function') {
1512
+ this.picker.handleClear();
1513
+ }
1514
+ } else {
1515
+ this.pickerVisible = !this.pickerVisible;
1516
+ }
1517
+ },
1518
+ handleClose: function handleClose() {
1519
+ if (!this.pickerVisible) return;
1520
+ this.pickerVisible = false;
1521
+
1522
+ if (this.type === 'dates' || this.type === 'years' || this.type === 'months') {
1523
+ // restore to former value
1524
+ var oldValue = parseAsFormatAndType(this.valueOnOpen, this.valueFormat, this.type, this.rangeSeparator) || this.valueOnOpen;
1525
+ this.emitInput(oldValue);
1526
+ }
1527
+ },
1528
+ handleFieldReset: function handleFieldReset(initialValue) {
1529
+ this.userInput = initialValue === '' ? null : initialValue;
1530
+ },
1531
+ handleFocus: function handleFocus() {
1532
+ var type = this.type;
1533
+
1534
+ if (HAVE_TRIGGER_TYPES.indexOf(type) !== -1 && !this.pickerVisible) {
1535
+ this.pickerVisible = true;
1536
+ }
1537
+ this.$emit('focus', this);
1538
+ },
1539
+ handleKeydown: function handleKeydown(event) {
1540
+ var _this = this;
1541
+
1542
+ var keyCode = event.keyCode;
1543
+
1544
+ // ESC
1545
+ if (keyCode === 27) {
1546
+ this.pickerVisible = false;
1547
+ event.stopPropagation();
1548
+ return;
1549
+ }
1550
+
1551
+ // Tab
1552
+ if (keyCode === 9) {
1553
+ if (!this.ranged) {
1554
+ this.handleChange();
1555
+ this.pickerVisible = this.picker.visible = false;
1556
+ this.blur();
1557
+ event.stopPropagation();
1558
+ } else {
1559
+ // user may change focus between two input
1560
+ setTimeout(function () {
1561
+ if (_this.refInput.indexOf(document.activeElement) === -1) {
1562
+ _this.pickerVisible = false;
1563
+ _this.blur();
1564
+ event.stopPropagation();
1565
+ }
1566
+ }, 0);
1567
+ }
1568
+ return;
1569
+ }
1570
+
1571
+ // Enter
1572
+ if (keyCode === 13) {
1573
+ if (this.userInput === '' || this.isValidValue(this.parseString(this.displayValue))) {
1574
+ this.handleChange();
1575
+ this.pickerVisible = this.picker.visible = false;
1576
+ this.blur();
1577
+ }
1578
+ event.stopPropagation();
1579
+ return;
1580
+ }
1581
+
1582
+ // if user is typing, do not let picker handle key input
1583
+ if (this.userInput) {
1584
+ event.stopPropagation();
1585
+ return;
1586
+ }
1587
+
1588
+ // delegate other keys to panel
1589
+ if (this.picker && this.picker.handleKeydown) {
1590
+ this.picker.handleKeydown(event);
1591
+ }
1592
+ },
1593
+ handleRangeClick: function handleRangeClick() {
1594
+ var type = this.type;
1595
+
1596
+ if (HAVE_TRIGGER_TYPES.indexOf(type) !== -1 && !this.pickerVisible) {
1597
+ this.pickerVisible = true;
1598
+ }
1599
+ this.$emit('focus', this);
1600
+ },
1601
+ hidePicker: function hidePicker() {
1602
+ if (this.picker) {
1603
+ this.picker.resetView && this.picker.resetView();
1604
+ this.pickerVisible = this.picker.visible = false;
1605
+ this.destroyPopper();
1606
+ }
1607
+ },
1608
+ showPicker: function showPicker() {
1609
+ var _this2 = this;
1610
+
1611
+ if (this.$isServer) return;
1612
+ if (!this.picker) {
1613
+ this.mountPicker();
1614
+ }
1615
+ this.pickerVisible = this.picker.visible = true;
1616
+
1617
+ this.updatePopper();
1618
+
1619
+ this.picker.value = this.parsedValue;
1620
+ this.picker.resetView && this.picker.resetView();
1621
+
1622
+ this.$nextTick(function () {
1623
+ _this2.picker.adjustSpinners && _this2.picker.adjustSpinners();
1624
+ });
1625
+ },
1626
+ mountPicker: function mountPicker() {
1627
+ var _this3 = this;
1628
+
1629
+ this.picker = new external_vue_default.a(this.panel).$mount();
1630
+ this.picker.defaultValue = this.defaultValue;
1631
+ this.picker.defaultTime = this.defaultTime;
1632
+ this.picker.popperClass = this.popperClass;
1633
+ this.popperElm = this.picker.$el;
1634
+ this.picker.width = this.reference.getBoundingClientRect().width;
1635
+ this.picker.showTime = this.type === 'datetime' || this.type === 'datetimerange';
1636
+ this.picker.selectionMode = this.selectionMode;
1637
+ this.picker.unlinkPanels = this.unlinkPanels;
1638
+ this.picker.arrowControl = this.arrowControl || this.timeArrowControl || false;
1639
+ this.$watch('format', function (format) {
1640
+ _this3.picker.format = format;
1641
+ });
1642
+
1643
+ var updateOptions = function updateOptions() {
1644
+ var options = _this3.pickerOptions;
1645
+
1646
+ if (options && options.selectableRange) {
1647
+ var ranges = options.selectableRange;
1648
+ var parser = TYPE_VALUE_RESOLVER_MAP.datetimerange.parser;
1649
+ var format = DEFAULT_FORMATS.timerange;
1650
+
1651
+ ranges = Array.isArray(ranges) ? ranges : [ranges];
1652
+ _this3.picker.selectableRange = ranges.map(function (range) {
1653
+ return parser(range, format, _this3.rangeSeparator);
1654
+ });
1655
+ }
1656
+
1657
+ for (var option in options) {
1658
+ if (options.hasOwnProperty(option) &&
1659
+ // 忽略 time-picker 的该配置项
1660
+ option !== 'selectableRange') {
1661
+ _this3.picker[option] = options[option];
1662
+ }
1663
+ }
1664
+
1665
+ // main format must prevail over undocumented pickerOptions.format
1666
+ if (_this3.format) {
1667
+ _this3.picker.format = _this3.format;
1668
+ }
1669
+ };
1670
+ updateOptions();
1671
+ this.unwatchPickerOptions = this.$watch('pickerOptions', function () {
1672
+ return updateOptions();
1673
+ }, { deep: true });
1674
+ this.$el.appendChild(this.picker.$el);
1675
+ this.picker.resetView && this.picker.resetView();
1676
+
1677
+ this.picker.$on('dodestroy', this.doDestroy);
1678
+ this.picker.$on('pick', function () {
1679
+ var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
1680
+ var visible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1681
+
1682
+ _this3.userInput = null;
1683
+ _this3.pickerVisible = _this3.picker.visible = visible;
1684
+ _this3.emitInput(date);
1685
+ _this3.picker.resetView && _this3.picker.resetView();
1686
+ });
1687
+
1688
+ this.picker.$on('select-range', function (start, end, pos) {
1689
+ if (_this3.refInput.length === 0) return;
1690
+ if (!pos || pos === 'min') {
1691
+ _this3.refInput[0].setSelectionRange(start, end);
1692
+ _this3.refInput[0].focus();
1693
+ } else if (pos === 'max') {
1694
+ _this3.refInput[1].setSelectionRange(start, end);
1695
+ _this3.refInput[1].focus();
1696
+ }
1697
+ });
1698
+ },
1699
+ unmountPicker: function unmountPicker() {
1700
+ if (this.picker) {
1701
+ this.picker.$destroy();
1702
+ this.picker.$off();
1703
+ if (typeof this.unwatchPickerOptions === 'function') {
1704
+ this.unwatchPickerOptions();
1705
+ }
1706
+ this.picker.$el.parentNode.removeChild(this.picker.$el);
1707
+ }
1708
+ },
1709
+ emitChange: function emitChange(val) {
1710
+ // determine user real change only
1711
+ if (!valueEquals(val, this.valueOnOpen)) {
1712
+ this.$emit('change', val);
1713
+ this.valueOnOpen = val;
1714
+ if (this.validateEvent) {
1715
+ this.dispatch('ElFormItem', 'el.form.change', val);
1716
+ }
1717
+ }
1718
+ },
1719
+ emitInput: function emitInput(val) {
1720
+ var formatted = this.formatToValue(val);
1721
+ if (!valueEquals(this.value, formatted)) {
1722
+ this.$emit('input', formatted);
1723
+ }
1724
+ },
1725
+ isValidValue: function isValidValue(value) {
1726
+ if (!this.picker) {
1727
+ this.mountPicker();
1728
+ }
1729
+ if (this.picker.isValidValue) {
1730
+ return value && this.picker.isValidValue(value);
1731
+ } else {
1732
+ return true;
1733
+ }
1734
+ }
1735
+ }
1736
1736
  });
1737
1737
  // CONCATENATED MODULE: ./packages/date-picker/src/picker.vue?vue&type=script&lang=js
1738
1738
  /* harmony default export */ var src_pickervue_type_script_lang_js = (pickervue_type_script_lang_js);
@@ -1767,7 +1767,7 @@ var component = Object(componentNormalizer["a" /* default */])(
1767
1767
 
1768
1768
  "use strict";
1769
1769
 
1770
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/basic/time-spinner.vue?vue&type=template&id=0a3ccf11
1770
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/basic/time-spinner.vue?vue&type=template&id=04c9bb6a
1771
1771
  var render = function () {
1772
1772
  var _vm = this
1773
1773
  var _h = _vm.$createElement
@@ -2034,13 +2034,13 @@ var render = function () {
2034
2034
  },
2035
2035
  [
2036
2036
  _vm._v(
2037
- "\n " +
2037
+ "\n\t\t\t\t\t" +
2038
2038
  _vm._s(
2039
2039
  minute === undefined
2040
2040
  ? ""
2041
2041
  : ("0" + minute).slice(-2)
2042
2042
  ) +
2043
- "\n "
2043
+ "\n\t\t\t\t"
2044
2044
  ),
2045
2045
  ]
2046
2046
  )
@@ -2096,13 +2096,13 @@ var render = function () {
2096
2096
  },
2097
2097
  [
2098
2098
  _vm._v(
2099
- "\n " +
2099
+ "\n\t\t\t\t\t" +
2100
2100
  _vm._s(
2101
2101
  second === undefined
2102
2102
  ? ""
2103
2103
  : ("0" + second).slice(-2)
2104
2104
  ) +
2105
- "\n "
2105
+ "\n\t\t\t\t"
2106
2106
  ),
2107
2107
  ]
2108
2108
  )
@@ -2122,7 +2122,7 @@ var staticRenderFns = []
2122
2122
  render._withStripped = true
2123
2123
 
2124
2124
 
2125
- // CONCATENATED MODULE: ./packages/date-picker/src/basic/time-spinner.vue?vue&type=template&id=0a3ccf11
2125
+ // CONCATENATED MODULE: ./packages/date-picker/src/basic/time-spinner.vue?vue&type=template&id=04c9bb6a
2126
2126
 
2127
2127
  // EXTERNAL MODULE: external "element-ui/lib/utils/date-util"
2128
2128
  var date_util_ = __webpack_require__(1);
@@ -2243,194 +2243,194 @@ var repeat_click = __webpack_require__(30);
2243
2243
 
2244
2244
 
2245
2245
  /* harmony default export */ var time_spinnervue_type_script_lang_js = ({
2246
- components: { ElScrollbar: scrollbar_default.a },
2247
-
2248
- directives: {
2249
- repeatClick: repeat_click["a" /* default */]
2250
- },
2251
-
2252
- props: {
2253
- date: {},
2254
- defaultValue: {}, // reserved for future use
2255
- showSeconds: {
2256
- type: Boolean,
2257
- default: true
2258
- },
2259
- arrowControl: Boolean,
2260
- amPmMode: {
2261
- type: String,
2262
- default: '' // 'a': am/pm; 'A': AM/PM
2263
- }
2264
- },
2265
-
2266
- computed: {
2267
- hours: function hours() {
2268
- return this.date.getHours();
2269
- },
2270
- minutes: function minutes() {
2271
- return this.date.getMinutes();
2272
- },
2273
- seconds: function seconds() {
2274
- return this.date.getSeconds();
2275
- },
2276
- hoursList: function hoursList() {
2277
- return Object(date_util_["getRangeHours"])(this.selectableRange);
2278
- },
2279
- minutesList: function minutesList() {
2280
- return Object(date_util_["getRangeMinutes"])(this.selectableRange, this.hours);
2281
- },
2282
- arrowHourList: function arrowHourList() {
2283
- var hours = this.hours;
2284
- return [hours > 0 ? hours - 1 : undefined, hours, hours < 23 ? hours + 1 : undefined];
2285
- },
2286
- arrowMinuteList: function arrowMinuteList() {
2287
- var minutes = this.minutes;
2288
- return [minutes > 0 ? minutes - 1 : undefined, minutes, minutes < 59 ? minutes + 1 : undefined];
2289
- },
2290
- arrowSecondList: function arrowSecondList() {
2291
- var seconds = this.seconds;
2292
- return [seconds > 0 ? seconds - 1 : undefined, seconds, seconds < 59 ? seconds + 1 : undefined];
2293
- }
2294
- },
2295
-
2296
- data: function data() {
2297
- return {
2298
- selectableRange: [],
2299
- currentScrollbar: null
2300
- };
2301
- },
2302
- mounted: function mounted() {
2303
- var _this = this;
2304
-
2305
- this.$nextTick(function () {
2306
- !_this.arrowControl && _this.bindScrollEvent();
2307
- });
2308
- },
2309
-
2310
-
2311
- methods: {
2312
- increase: function increase() {
2313
- this.scrollDown(1);
2314
- },
2315
- decrease: function decrease() {
2316
- this.scrollDown(-1);
2317
- },
2318
- modifyDateField: function modifyDateField(type, value) {
2319
- switch (type) {
2320
- case 'hours':
2321
- this.$emit('change', Object(date_util_["modifyTime"])(this.date, value, this.minutes, this.seconds));break;
2322
- case 'minutes':
2323
- this.$emit('change', Object(date_util_["modifyTime"])(this.date, this.hours, value, this.seconds));break;
2324
- case 'seconds':
2325
- this.$emit('change', Object(date_util_["modifyTime"])(this.date, this.hours, this.minutes, value));break;
2326
- }
2327
- },
2328
- handleClick: function handleClick(type, _ref) {
2329
- var value = _ref.value,
2330
- disabled = _ref.disabled;
2331
-
2332
- if (!disabled) {
2333
- this.modifyDateField(type, value);
2334
- this.emitSelectRange(type);
2335
- this.adjustSpinner(type, value);
2336
- }
2337
- },
2338
- emitSelectRange: function emitSelectRange(type) {
2339
- if (type === 'hours') {
2340
- this.$emit('select-range', 0, 2);
2341
- } else if (type === 'minutes') {
2342
- this.$emit('select-range', 3, 5);
2343
- } else if (type === 'seconds') {
2344
- this.$emit('select-range', 6, 8);
2345
- }
2346
- this.currentScrollbar = type;
2347
- },
2348
- bindScrollEvent: function bindScrollEvent() {
2349
- var _this2 = this;
2350
-
2351
- var bindFunction = function bindFunction(type) {
2352
- _this2.$refs[type].wrap.onscroll = function (e) {
2353
- // TODO: scroll is emitted when set scrollTop programatically
2354
- // should find better solutions in the future!
2355
- _this2.handleScroll(type, e);
2356
- };
2357
- };
2358
- bindFunction('hours');
2359
- bindFunction('minutes');
2360
- bindFunction('seconds');
2361
- },
2362
- handleScroll: function handleScroll(type) {
2363
- var value = Math.min(Math.round((this.$refs[type].wrap.scrollTop - (this.scrollBarHeight(type) * 0.5 - 10) / this.typeItemHeight(type) + 3) / this.typeItemHeight(type)), type === 'hours' ? 23 : 59);
2364
- this.modifyDateField(type, value);
2365
- },
2366
-
2367
-
2368
- // NOTE: used by datetime / date-range panel
2369
- // renamed from adjustScrollTop
2370
- // should try to refactory it
2371
- adjustSpinners: function adjustSpinners() {
2372
- this.adjustSpinner('hours', this.hours);
2373
- this.adjustSpinner('minutes', this.minutes);
2374
- this.adjustSpinner('seconds', this.seconds);
2375
- },
2376
- adjustCurrentSpinner: function adjustCurrentSpinner(type) {
2377
- this.adjustSpinner(type, this[type]);
2378
- },
2379
- adjustSpinner: function adjustSpinner(type, value) {
2380
- if (this.arrowControl) return;
2381
- var el = this.$refs[type].wrap;
2382
- if (el) {
2383
- el.scrollTop = Math.max(0, value * this.typeItemHeight(type));
2384
- }
2385
- },
2386
- scrollDown: function scrollDown(step) {
2387
- var _this3 = this;
2388
-
2389
- if (!this.currentScrollbar) {
2390
- this.emitSelectRange('hours');
2391
- }
2392
-
2393
- var label = this.currentScrollbar;
2394
- var hoursList = this.hoursList;
2395
- var now = this[label];
2396
-
2397
- if (this.currentScrollbar === 'hours') {
2398
- var total = Math.abs(step);
2399
- step = step > 0 ? 1 : -1;
2400
- var length = hoursList.length;
2401
- while (length-- && total) {
2402
- now = (now + step + hoursList.length) % hoursList.length;
2403
- if (hoursList[now]) {
2404
- continue;
2405
- }
2406
- total--;
2407
- }
2408
- if (hoursList[now]) return;
2409
- } else {
2410
- now = (now + step + 60) % 60;
2411
- }
2412
-
2413
- this.modifyDateField(label, now);
2414
- this.adjustSpinner(label, now);
2415
- this.$nextTick(function () {
2416
- return _this3.emitSelectRange(_this3.currentScrollbar);
2417
- });
2418
- },
2419
- amPm: function amPm(hour) {
2420
- var shouldShowAmPm = this.amPmMode.toLowerCase() === 'a';
2421
- if (!shouldShowAmPm) return '';
2422
- var isCapital = this.amPmMode === 'A';
2423
- var content = hour < 12 ? ' am' : ' pm';
2424
- if (isCapital) content = content.toUpperCase();
2425
- return content;
2426
- },
2427
- typeItemHeight: function typeItemHeight(type) {
2428
- return this.$refs[type].$el.querySelector('li').offsetHeight;
2429
- },
2430
- scrollBarHeight: function scrollBarHeight(type) {
2431
- return this.$refs[type].$el.offsetHeight;
2432
- }
2433
- }
2246
+ components: { ElScrollbar: scrollbar_default.a },
2247
+
2248
+ directives: {
2249
+ repeatClick: repeat_click["a" /* default */]
2250
+ },
2251
+
2252
+ props: {
2253
+ date: {},
2254
+ defaultValue: {}, // reserved for future use
2255
+ showSeconds: {
2256
+ type: Boolean,
2257
+ default: true
2258
+ },
2259
+ arrowControl: Boolean,
2260
+ amPmMode: {
2261
+ type: String,
2262
+ default: '' // 'a': am/pm; 'A': AM/PM
2263
+ }
2264
+ },
2265
+
2266
+ computed: {
2267
+ hours: function hours() {
2268
+ return this.date.getHours();
2269
+ },
2270
+ minutes: function minutes() {
2271
+ return this.date.getMinutes();
2272
+ },
2273
+ seconds: function seconds() {
2274
+ return this.date.getSeconds();
2275
+ },
2276
+ hoursList: function hoursList() {
2277
+ return Object(date_util_["getRangeHours"])(this.selectableRange);
2278
+ },
2279
+ minutesList: function minutesList() {
2280
+ return Object(date_util_["getRangeMinutes"])(this.selectableRange, this.hours);
2281
+ },
2282
+ arrowHourList: function arrowHourList() {
2283
+ var hours = this.hours;
2284
+ return [hours > 0 ? hours - 1 : undefined, hours, hours < 23 ? hours + 1 : undefined];
2285
+ },
2286
+ arrowMinuteList: function arrowMinuteList() {
2287
+ var minutes = this.minutes;
2288
+ return [minutes > 0 ? minutes - 1 : undefined, minutes, minutes < 59 ? minutes + 1 : undefined];
2289
+ },
2290
+ arrowSecondList: function arrowSecondList() {
2291
+ var seconds = this.seconds;
2292
+ return [seconds > 0 ? seconds - 1 : undefined, seconds, seconds < 59 ? seconds + 1 : undefined];
2293
+ }
2294
+ },
2295
+
2296
+ data: function data() {
2297
+ return {
2298
+ selectableRange: [],
2299
+ currentScrollbar: null
2300
+ };
2301
+ },
2302
+ mounted: function mounted() {
2303
+ var _this = this;
2304
+
2305
+ this.$nextTick(function () {
2306
+ !_this.arrowControl && _this.bindScrollEvent();
2307
+ });
2308
+ },
2309
+
2310
+
2311
+ methods: {
2312
+ increase: function increase() {
2313
+ this.scrollDown(1);
2314
+ },
2315
+ decrease: function decrease() {
2316
+ this.scrollDown(-1);
2317
+ },
2318
+ modifyDateField: function modifyDateField(type, value) {
2319
+ switch (type) {
2320
+ case 'hours':
2321
+ this.$emit('change', Object(date_util_["modifyTime"])(this.date, value, this.minutes, this.seconds));break;
2322
+ case 'minutes':
2323
+ this.$emit('change', Object(date_util_["modifyTime"])(this.date, this.hours, value, this.seconds));break;
2324
+ case 'seconds':
2325
+ this.$emit('change', Object(date_util_["modifyTime"])(this.date, this.hours, this.minutes, value));break;
2326
+ }
2327
+ },
2328
+ handleClick: function handleClick(type, _ref) {
2329
+ var value = _ref.value,
2330
+ disabled = _ref.disabled;
2331
+
2332
+ if (!disabled) {
2333
+ this.modifyDateField(type, value);
2334
+ this.emitSelectRange(type);
2335
+ this.adjustSpinner(type, value);
2336
+ }
2337
+ },
2338
+ emitSelectRange: function emitSelectRange(type) {
2339
+ if (type === 'hours') {
2340
+ this.$emit('select-range', 0, 2);
2341
+ } else if (type === 'minutes') {
2342
+ this.$emit('select-range', 3, 5);
2343
+ } else if (type === 'seconds') {
2344
+ this.$emit('select-range', 6, 8);
2345
+ }
2346
+ this.currentScrollbar = type;
2347
+ },
2348
+ bindScrollEvent: function bindScrollEvent() {
2349
+ var _this2 = this;
2350
+
2351
+ var bindFunction = function bindFunction(type) {
2352
+ _this2.$refs[type].wrap.onscroll = function (e) {
2353
+ // TODO: scroll is emitted when set scrollTop programatically
2354
+ // should find better solutions in the future!
2355
+ _this2.handleScroll(type, e);
2356
+ };
2357
+ };
2358
+ bindFunction('hours');
2359
+ bindFunction('minutes');
2360
+ bindFunction('seconds');
2361
+ },
2362
+ handleScroll: function handleScroll(type) {
2363
+ var value = Math.min(Math.round((this.$refs[type].wrap.scrollTop - (this.scrollBarHeight(type) * 0.5 - 10) / this.typeItemHeight(type) + 3) / this.typeItemHeight(type)), type === 'hours' ? 23 : 59);
2364
+ this.modifyDateField(type, value);
2365
+ },
2366
+
2367
+
2368
+ // NOTE: used by datetime / date-range panel
2369
+ // renamed from adjustScrollTop
2370
+ // should try to refactory it
2371
+ adjustSpinners: function adjustSpinners() {
2372
+ this.adjustSpinner('hours', this.hours);
2373
+ this.adjustSpinner('minutes', this.minutes);
2374
+ this.adjustSpinner('seconds', this.seconds);
2375
+ },
2376
+ adjustCurrentSpinner: function adjustCurrentSpinner(type) {
2377
+ this.adjustSpinner(type, this[type]);
2378
+ },
2379
+ adjustSpinner: function adjustSpinner(type, value) {
2380
+ if (this.arrowControl) return;
2381
+ var el = this.$refs[type].wrap;
2382
+ if (el) {
2383
+ el.scrollTop = Math.max(0, value * this.typeItemHeight(type));
2384
+ }
2385
+ },
2386
+ scrollDown: function scrollDown(step) {
2387
+ var _this3 = this;
2388
+
2389
+ if (!this.currentScrollbar) {
2390
+ this.emitSelectRange('hours');
2391
+ }
2392
+
2393
+ var label = this.currentScrollbar;
2394
+ var hoursList = this.hoursList;
2395
+ var now = this[label];
2396
+
2397
+ if (this.currentScrollbar === 'hours') {
2398
+ var total = Math.abs(step);
2399
+ step = step > 0 ? 1 : -1;
2400
+ var length = hoursList.length;
2401
+ while (length-- && total) {
2402
+ now = (now + step + hoursList.length) % hoursList.length;
2403
+ if (hoursList[now]) {
2404
+ continue;
2405
+ }
2406
+ total--;
2407
+ }
2408
+ if (hoursList[now]) return;
2409
+ } else {
2410
+ now = (now + step + 60) % 60;
2411
+ }
2412
+
2413
+ this.modifyDateField(label, now);
2414
+ this.adjustSpinner(label, now);
2415
+ this.$nextTick(function () {
2416
+ return _this3.emitSelectRange(_this3.currentScrollbar);
2417
+ });
2418
+ },
2419
+ amPm: function amPm(hour) {
2420
+ var shouldShowAmPm = this.amPmMode.toLowerCase() === 'a';
2421
+ if (!shouldShowAmPm) return '';
2422
+ var isCapital = this.amPmMode === 'A';
2423
+ var content = hour < 12 ? ' am' : ' pm';
2424
+ if (isCapital) content = content.toUpperCase();
2425
+ return content;
2426
+ },
2427
+ typeItemHeight: function typeItemHeight(type) {
2428
+ return this.$refs[type].$el.querySelector('li').offsetHeight;
2429
+ },
2430
+ scrollBarHeight: function scrollBarHeight(type) {
2431
+ return this.$refs[type].$el.offsetHeight;
2432
+ }
2433
+ }
2434
2434
  });
2435
2435
  // CONCATENATED MODULE: ./packages/date-picker/src/basic/time-spinner.vue?vue&type=script&lang=js
2436
2436
  /* harmony default export */ var basic_time_spinnervue_type_script_lang_js = (time_spinnervue_type_script_lang_js);
@@ -2501,7 +2501,7 @@ var picker = __webpack_require__(32);
2501
2501
  // EXTERNAL MODULE: ./packages/date-picker/src/panel/time.vue + 4 modules
2502
2502
  var time = __webpack_require__(28);
2503
2503
 
2504
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/time-range.vue?vue&type=template&id=04ace734
2504
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/time-range.vue?vue&type=template&id=5ab13df6
2505
2505
  var render = function () {
2506
2506
  var _vm = this
2507
2507
  var _h = _vm.$createElement
@@ -2635,7 +2635,7 @@ var staticRenderFns = []
2635
2635
  render._withStripped = true
2636
2636
 
2637
2637
 
2638
- // CONCATENATED MODULE: ./packages/date-picker/src/panel/time-range.vue?vue&type=template&id=04ace734
2638
+ // CONCATENATED MODULE: ./packages/date-picker/src/panel/time-range.vue?vue&type=template&id=5ab13df6
2639
2639
 
2640
2640
  // EXTERNAL MODULE: external "element-ui/lib/utils/date-util"
2641
2641
  var date_util_ = __webpack_require__(1);
@@ -2714,170 +2714,170 @@ var MIN_TIME = Object(date_util_["parseDate"])('00:00:00', 'HH:mm:ss');
2714
2714
  var MAX_TIME = Object(date_util_["parseDate"])('23:59:59', 'HH:mm:ss');
2715
2715
 
2716
2716
  var time_rangevue_type_script_lang_js_minTimeOfDay = function minTimeOfDay(date) {
2717
- return Object(date_util_["modifyDate"])(MIN_TIME, date.getFullYear(), date.getMonth(), date.getDate());
2717
+ return Object(date_util_["modifyDate"])(MIN_TIME, date.getFullYear(), date.getMonth(), date.getDate());
2718
2718
  };
2719
2719
 
2720
2720
  var time_rangevue_type_script_lang_js_maxTimeOfDay = function maxTimeOfDay(date) {
2721
- return Object(date_util_["modifyDate"])(MAX_TIME, date.getFullYear(), date.getMonth(), date.getDate());
2721
+ return Object(date_util_["modifyDate"])(MAX_TIME, date.getFullYear(), date.getMonth(), date.getDate());
2722
2722
  };
2723
2723
 
2724
2724
  // increase time by amount of milliseconds, but within the range of day
2725
2725
  var advanceTime = function advanceTime(date, amount) {
2726
- return new Date(Math.min(date.getTime() + amount, time_rangevue_type_script_lang_js_maxTimeOfDay(date).getTime()));
2726
+ return new Date(Math.min(date.getTime() + amount, time_rangevue_type_script_lang_js_maxTimeOfDay(date).getTime()));
2727
2727
  };
2728
2728
 
2729
2729
  /* harmony default export */ var time_rangevue_type_script_lang_js = ({
2730
- mixins: [locale_default.a],
2731
-
2732
- components: { TimeSpinner: time_spinner["a" /* default */] },
2733
-
2734
- computed: {
2735
- showSeconds: function showSeconds() {
2736
- return (this.format || '').indexOf('ss') !== -1;
2737
- },
2738
- offset: function offset() {
2739
- return this.showSeconds ? 11 : 8;
2740
- },
2741
- spinner: function spinner() {
2742
- return this.selectionRange[0] < this.offset ? this.$refs.minSpinner : this.$refs.maxSpinner;
2743
- },
2744
- btnDisabled: function btnDisabled() {
2745
- return this.minDate.getTime() > this.maxDate.getTime();
2746
- },
2747
- amPmMode: function amPmMode() {
2748
- if ((this.format || '').indexOf('A') !== -1) return 'A';
2749
- if ((this.format || '').indexOf('a') !== -1) return 'a';
2750
- return '';
2751
- }
2752
- },
2753
-
2754
- data: function data() {
2755
- return {
2756
- popperClass: '',
2757
- minDate: new Date(),
2758
- maxDate: new Date(),
2759
- value: [],
2760
- oldValue: [new Date(), new Date()],
2761
- defaultValue: null,
2762
- format: 'HH:mm:ss',
2763
- visible: false,
2764
- selectionRange: [0, 2],
2765
- arrowControl: false
2766
- };
2767
- },
2768
-
2769
-
2770
- watch: {
2771
- value: function value(_value) {
2772
- if (Array.isArray(_value)) {
2773
- this.minDate = new Date(_value[0]);
2774
- this.maxDate = new Date(_value[1]);
2775
- } else {
2776
- if (Array.isArray(this.defaultValue)) {
2777
- this.minDate = new Date(this.defaultValue[0]);
2778
- this.maxDate = new Date(this.defaultValue[1]);
2779
- } else if (this.defaultValue) {
2780
- this.minDate = new Date(this.defaultValue);
2781
- this.maxDate = advanceTime(new Date(this.defaultValue), 60 * 60 * 1000);
2782
- } else {
2783
- this.minDate = new Date();
2784
- this.maxDate = advanceTime(new Date(), 60 * 60 * 1000);
2785
- }
2786
- }
2787
- },
2788
- visible: function visible(val) {
2789
- var _this = this;
2790
-
2791
- if (val) {
2792
- this.oldValue = this.value;
2793
- this.$nextTick(function () {
2794
- return _this.$refs.minSpinner.emitSelectRange('hours');
2795
- });
2796
- }
2797
- }
2798
- },
2799
-
2800
- methods: {
2801
- handleClear: function handleClear() {
2802
- this.$emit('pick', null);
2803
- },
2804
- handleCancel: function handleCancel() {
2805
- this.$emit('pick', this.oldValue);
2806
- },
2807
- handleMinChange: function handleMinChange(date) {
2808
- this.minDate = Object(date_util_["clearMilliseconds"])(date);
2809
- this.handleChange();
2810
- },
2811
- handleMaxChange: function handleMaxChange(date) {
2812
- this.maxDate = Object(date_util_["clearMilliseconds"])(date);
2813
- this.handleChange();
2814
- },
2815
- handleChange: function handleChange() {
2816
- if (this.isValidValue([this.minDate, this.maxDate])) {
2817
- this.$refs.minSpinner.selectableRange = [[time_rangevue_type_script_lang_js_minTimeOfDay(this.minDate), this.maxDate]];
2818
- this.$refs.maxSpinner.selectableRange = [[this.minDate, time_rangevue_type_script_lang_js_maxTimeOfDay(this.maxDate)]];
2819
- this.$emit('pick', [this.minDate, this.maxDate], true);
2820
- }
2821
- },
2822
- setMinSelectionRange: function setMinSelectionRange(start, end) {
2823
- this.$emit('select-range', start, end, 'min');
2824
- this.selectionRange = [start, end];
2825
- },
2826
- setMaxSelectionRange: function setMaxSelectionRange(start, end) {
2827
- this.$emit('select-range', start, end, 'max');
2828
- this.selectionRange = [start + this.offset, end + this.offset];
2829
- },
2830
- handleConfirm: function handleConfirm() {
2831
- var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
2832
-
2833
- var minSelectableRange = this.$refs.minSpinner.selectableRange;
2834
- var maxSelectableRange = this.$refs.maxSpinner.selectableRange;
2835
-
2836
- this.minDate = Object(date_util_["limitTimeRange"])(this.minDate, minSelectableRange, this.format);
2837
- this.maxDate = Object(date_util_["limitTimeRange"])(this.maxDate, maxSelectableRange, this.format);
2838
-
2839
- this.$emit('pick', [this.minDate, this.maxDate], visible);
2840
- },
2841
- adjustSpinners: function adjustSpinners() {
2842
- this.$refs.minSpinner.adjustSpinners();
2843
- this.$refs.maxSpinner.adjustSpinners();
2844
- },
2845
- changeSelectionRange: function changeSelectionRange(step) {
2846
- var list = this.showSeconds ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
2847
- var mapping = ['hours', 'minutes'].concat(this.showSeconds ? ['seconds'] : []);
2848
- var index = list.indexOf(this.selectionRange[0]);
2849
- var next = (index + step + list.length) % list.length;
2850
- var half = list.length / 2;
2851
- if (next < half) {
2852
- this.$refs.minSpinner.emitSelectRange(mapping[next]);
2853
- } else {
2854
- this.$refs.maxSpinner.emitSelectRange(mapping[next - half]);
2855
- }
2856
- },
2857
- isValidValue: function isValidValue(date) {
2858
- return Array.isArray(date) && Object(date_util_["timeWithinRange"])(this.minDate, this.$refs.minSpinner.selectableRange) && Object(date_util_["timeWithinRange"])(this.maxDate, this.$refs.maxSpinner.selectableRange);
2859
- },
2860
- handleKeydown: function handleKeydown(event) {
2861
- var keyCode = event.keyCode;
2862
- var mapping = { 38: -1, 40: 1, 37: -1, 39: 1 };
2863
-
2864
- // Left or Right
2865
- if (keyCode === 37 || keyCode === 39) {
2866
- var step = mapping[keyCode];
2867
- this.changeSelectionRange(step);
2868
- event.preventDefault();
2869
- return;
2870
- }
2871
-
2872
- // Up or Down
2873
- if (keyCode === 38 || keyCode === 40) {
2874
- var _step = mapping[keyCode];
2875
- this.spinner.scrollDown(_step);
2876
- event.preventDefault();
2877
- return;
2878
- }
2879
- }
2880
- }
2730
+ mixins: [locale_default.a],
2731
+
2732
+ components: { TimeSpinner: time_spinner["a" /* default */] },
2733
+
2734
+ computed: {
2735
+ showSeconds: function showSeconds() {
2736
+ return (this.format || '').indexOf('ss') !== -1;
2737
+ },
2738
+ offset: function offset() {
2739
+ return this.showSeconds ? 11 : 8;
2740
+ },
2741
+ spinner: function spinner() {
2742
+ return this.selectionRange[0] < this.offset ? this.$refs.minSpinner : this.$refs.maxSpinner;
2743
+ },
2744
+ btnDisabled: function btnDisabled() {
2745
+ return this.minDate.getTime() > this.maxDate.getTime();
2746
+ },
2747
+ amPmMode: function amPmMode() {
2748
+ if ((this.format || '').indexOf('A') !== -1) return 'A';
2749
+ if ((this.format || '').indexOf('a') !== -1) return 'a';
2750
+ return '';
2751
+ }
2752
+ },
2753
+
2754
+ data: function data() {
2755
+ return {
2756
+ popperClass: '',
2757
+ minDate: new Date(),
2758
+ maxDate: new Date(),
2759
+ value: [],
2760
+ oldValue: [new Date(), new Date()],
2761
+ defaultValue: null,
2762
+ format: 'HH:mm:ss',
2763
+ visible: false,
2764
+ selectionRange: [0, 2],
2765
+ arrowControl: false
2766
+ };
2767
+ },
2768
+
2769
+
2770
+ watch: {
2771
+ value: function value(_value) {
2772
+ if (Array.isArray(_value)) {
2773
+ this.minDate = new Date(_value[0]);
2774
+ this.maxDate = new Date(_value[1]);
2775
+ } else {
2776
+ if (Array.isArray(this.defaultValue)) {
2777
+ this.minDate = new Date(this.defaultValue[0]);
2778
+ this.maxDate = new Date(this.defaultValue[1]);
2779
+ } else if (this.defaultValue) {
2780
+ this.minDate = new Date(this.defaultValue);
2781
+ this.maxDate = advanceTime(new Date(this.defaultValue), 60 * 60 * 1000);
2782
+ } else {
2783
+ this.minDate = new Date();
2784
+ this.maxDate = advanceTime(new Date(), 60 * 60 * 1000);
2785
+ }
2786
+ }
2787
+ },
2788
+ visible: function visible(val) {
2789
+ var _this = this;
2790
+
2791
+ if (val) {
2792
+ this.oldValue = this.value;
2793
+ this.$nextTick(function () {
2794
+ return _this.$refs.minSpinner.emitSelectRange('hours');
2795
+ });
2796
+ }
2797
+ }
2798
+ },
2799
+
2800
+ methods: {
2801
+ handleClear: function handleClear() {
2802
+ this.$emit('pick', null);
2803
+ },
2804
+ handleCancel: function handleCancel() {
2805
+ this.$emit('pick', this.oldValue);
2806
+ },
2807
+ handleMinChange: function handleMinChange(date) {
2808
+ this.minDate = Object(date_util_["clearMilliseconds"])(date);
2809
+ this.handleChange();
2810
+ },
2811
+ handleMaxChange: function handleMaxChange(date) {
2812
+ this.maxDate = Object(date_util_["clearMilliseconds"])(date);
2813
+ this.handleChange();
2814
+ },
2815
+ handleChange: function handleChange() {
2816
+ if (this.isValidValue([this.minDate, this.maxDate])) {
2817
+ this.$refs.minSpinner.selectableRange = [[time_rangevue_type_script_lang_js_minTimeOfDay(this.minDate), this.maxDate]];
2818
+ this.$refs.maxSpinner.selectableRange = [[this.minDate, time_rangevue_type_script_lang_js_maxTimeOfDay(this.maxDate)]];
2819
+ this.$emit('pick', [this.minDate, this.maxDate], true);
2820
+ }
2821
+ },
2822
+ setMinSelectionRange: function setMinSelectionRange(start, end) {
2823
+ this.$emit('select-range', start, end, 'min');
2824
+ this.selectionRange = [start, end];
2825
+ },
2826
+ setMaxSelectionRange: function setMaxSelectionRange(start, end) {
2827
+ this.$emit('select-range', start, end, 'max');
2828
+ this.selectionRange = [start + this.offset, end + this.offset];
2829
+ },
2830
+ handleConfirm: function handleConfirm() {
2831
+ var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
2832
+
2833
+ var minSelectableRange = this.$refs.minSpinner.selectableRange;
2834
+ var maxSelectableRange = this.$refs.maxSpinner.selectableRange;
2835
+
2836
+ this.minDate = Object(date_util_["limitTimeRange"])(this.minDate, minSelectableRange, this.format);
2837
+ this.maxDate = Object(date_util_["limitTimeRange"])(this.maxDate, maxSelectableRange, this.format);
2838
+
2839
+ this.$emit('pick', [this.minDate, this.maxDate], visible);
2840
+ },
2841
+ adjustSpinners: function adjustSpinners() {
2842
+ this.$refs.minSpinner.adjustSpinners();
2843
+ this.$refs.maxSpinner.adjustSpinners();
2844
+ },
2845
+ changeSelectionRange: function changeSelectionRange(step) {
2846
+ var list = this.showSeconds ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
2847
+ var mapping = ['hours', 'minutes'].concat(this.showSeconds ? ['seconds'] : []);
2848
+ var index = list.indexOf(this.selectionRange[0]);
2849
+ var next = (index + step + list.length) % list.length;
2850
+ var half = list.length / 2;
2851
+ if (next < half) {
2852
+ this.$refs.minSpinner.emitSelectRange(mapping[next]);
2853
+ } else {
2854
+ this.$refs.maxSpinner.emitSelectRange(mapping[next - half]);
2855
+ }
2856
+ },
2857
+ isValidValue: function isValidValue(date) {
2858
+ return Array.isArray(date) && Object(date_util_["timeWithinRange"])(this.minDate, this.$refs.minSpinner.selectableRange) && Object(date_util_["timeWithinRange"])(this.maxDate, this.$refs.maxSpinner.selectableRange);
2859
+ },
2860
+ handleKeydown: function handleKeydown(event) {
2861
+ var keyCode = event.keyCode;
2862
+ var mapping = { 38: -1, 40: 1, 37: -1, 39: 1 };
2863
+
2864
+ // Left or Right
2865
+ if (keyCode === 37 || keyCode === 39) {
2866
+ var step = mapping[keyCode];
2867
+ this.changeSelectionRange(step);
2868
+ event.preventDefault();
2869
+ return;
2870
+ }
2871
+
2872
+ // Up or Down
2873
+ if (keyCode === 38 || keyCode === 40) {
2874
+ var _step = mapping[keyCode];
2875
+ this.spinner.scrollDown(_step);
2876
+ event.preventDefault();
2877
+ return;
2878
+ }
2879
+ }
2880
+ }
2881
2881
  });
2882
2882
  // CONCATENATED MODULE: ./packages/date-picker/src/panel/time-range.vue?vue&type=script&lang=js
2883
2883
  /* harmony default export */ var panel_time_rangevue_type_script_lang_js = (time_rangevue_type_script_lang_js);
@@ -2910,47 +2910,47 @@ var component = Object(componentNormalizer["a" /* default */])(
2910
2910
 
2911
2911
 
2912
2912
  /* harmony default export */ var time_picker = ({
2913
- mixins: [picker["a" /* default */]],
2914
-
2915
- name: 'ElTimePicker',
2916
-
2917
- props: {
2918
- isRange: Boolean,
2919
- arrowControl: Boolean
2920
- },
2921
-
2922
- data: function data() {
2923
- return {
2924
- type: ''
2925
- };
2926
- },
2927
-
2928
-
2929
- watch: {
2930
- isRange: function isRange(_isRange) {
2931
- if (this.picker) {
2932
- this.unmountPicker();
2933
- this.type = _isRange ? 'timerange' : 'time';
2934
- this.panel = _isRange ? time_range : time["a" /* default */];
2935
- this.mountPicker();
2936
- } else {
2937
- this.type = _isRange ? 'timerange' : 'time';
2938
- this.panel = _isRange ? time_range : time["a" /* default */];
2939
- }
2940
- }
2941
- },
2942
-
2943
- created: function created() {
2944
- this.type = this.isRange ? 'timerange' : 'time';
2945
- this.panel = this.isRange ? time_range : time["a" /* default */];
2946
- }
2913
+ mixins: [picker["a" /* default */]],
2914
+
2915
+ name: 'ElTimePicker',
2916
+
2917
+ props: {
2918
+ isRange: Boolean,
2919
+ arrowControl: Boolean
2920
+ },
2921
+
2922
+ data: function data() {
2923
+ return {
2924
+ type: ''
2925
+ };
2926
+ },
2927
+
2928
+
2929
+ watch: {
2930
+ isRange: function isRange(_isRange) {
2931
+ if (this.picker) {
2932
+ this.unmountPicker();
2933
+ this.type = _isRange ? 'timerange' : 'time';
2934
+ this.panel = _isRange ? time_range : time["a" /* default */];
2935
+ this.mountPicker();
2936
+ } else {
2937
+ this.type = _isRange ? 'timerange' : 'time';
2938
+ this.panel = _isRange ? time_range : time["a" /* default */];
2939
+ }
2940
+ }
2941
+ },
2942
+
2943
+ created: function created() {
2944
+ this.type = this.isRange ? 'timerange' : 'time';
2945
+ this.panel = this.isRange ? time_range : time["a" /* default */];
2946
+ }
2947
2947
  });
2948
2948
  // CONCATENATED MODULE: ./packages/time-picker/index.js
2949
2949
 
2950
2950
 
2951
2951
  /* istanbul ignore next */
2952
2952
  time_picker.install = function (Vue) {
2953
- Vue.component(time_picker.name, time_picker);
2953
+ Vue.component(time_picker.name, time_picker);
2954
2954
  };
2955
2955
 
2956
2956
  /* harmony default export */ var packages_time_picker = __webpack_exports__["default"] = (time_picker);