cy-element-ui 1.0.3 → 1.0.5

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 (416) hide show
  1. package/README.md +163 -59
  2. package/lib/alert.js +211 -203
  3. package/lib/aside.js +29 -29
  4. package/lib/autocomplete.js +4615 -483
  5. package/lib/avatar.js +152 -126
  6. package/lib/backtop.js +117 -125
  7. package/lib/badge.js +128 -134
  8. package/lib/breadcrumb-item.js +146 -122
  9. package/lib/breadcrumb.js +97 -96
  10. package/lib/button-group.js +68 -65
  11. package/lib/button.js +67 -87
  12. package/lib/calendar.js +2475 -603
  13. package/lib/card.js +101 -100
  14. package/lib/carousel-item.js +854 -210
  15. package/lib/carousel.js +575 -408
  16. package/lib/cascader-panel.js +3546 -1153
  17. package/lib/cascader.js +7376 -970
  18. package/lib/checkbox-button.js +337 -290
  19. package/lib/checkbox-group.js +176 -105
  20. package/lib/checkbox.js +240 -220
  21. package/lib/col.js +113 -68
  22. package/lib/collapse-item.js +1228 -225
  23. package/lib/collapse.js +163 -123
  24. package/lib/color-picker.js +5223 -1251
  25. package/lib/container.js +98 -88
  26. package/lib/date-picker.js +8396 -3945
  27. package/lib/descriptions-item.js +53 -32
  28. package/lib/descriptions.js +697 -334
  29. package/lib/dialog.js +1725 -247
  30. package/lib/directives/mousewheel.js +14 -20
  31. package/lib/directives/repeat-click.js +27 -30
  32. package/lib/divider.js +38 -45
  33. package/lib/drawer.js +1032 -238
  34. package/lib/dropdown-item.js +159 -111
  35. package/lib/dropdown-menu.js +2445 -117
  36. package/lib/dropdown.js +1675 -366
  37. package/lib/element-ui.common.js +49110 -39985
  38. package/lib/empty.js +1084 -203
  39. package/lib/fileUpload.js +3900 -0
  40. package/lib/footer.js +29 -29
  41. package/lib/form-item.js +1236 -467
  42. package/lib/form.js +326 -258
  43. package/lib/header.js +80 -80
  44. package/lib/icon.js +71 -68
  45. package/lib/image.js +2389 -743
  46. package/lib/index.js +1 -1
  47. package/lib/infinite-scroll.js +814 -150
  48. package/lib/input-number.js +2181 -444
  49. package/lib/input.js +1197 -517
  50. package/lib/link.js +117 -135
  51. package/lib/loading.js +1130 -363
  52. package/lib/locale/format.js +38 -49
  53. package/lib/locale/index.js +38 -52
  54. package/lib/locale/lang/af-ZA.js +130 -123
  55. package/lib/locale/lang/ar.js +123 -122
  56. package/lib/locale/lang/az.js +122 -121
  57. package/lib/locale/lang/bg.js +133 -123
  58. package/lib/locale/lang/bn.js +121 -121
  59. package/lib/locale/lang/ca.js +123 -122
  60. package/lib/locale/lang/cs-CZ.js +127 -125
  61. package/lib/locale/lang/da.js +124 -122
  62. package/lib/locale/lang/de.js +126 -124
  63. package/lib/locale/lang/ee.js +125 -123
  64. package/lib/locale/lang/el.js +125 -123
  65. package/lib/locale/lang/en.js +127 -123
  66. package/lib/locale/lang/eo.js +125 -123
  67. package/lib/locale/lang/es.js +123 -122
  68. package/lib/locale/lang/eu.js +128 -123
  69. package/lib/locale/lang/fa.js +125 -123
  70. package/lib/locale/lang/fi.js +125 -123
  71. package/lib/locale/lang/fr.js +125 -122
  72. package/lib/locale/lang/he.js +130 -123
  73. package/lib/locale/lang/hr.js +128 -123
  74. package/lib/locale/lang/hu.js +124 -122
  75. package/lib/locale/lang/hy-AM.js +125 -123
  76. package/lib/locale/lang/id.js +124 -123
  77. package/lib/locale/lang/is.js +124 -123
  78. package/lib/locale/lang/it.js +123 -122
  79. package/lib/locale/lang/ja.js +125 -123
  80. package/lib/locale/lang/kg.js +125 -123
  81. package/lib/locale/lang/km.js +124 -123
  82. package/lib/locale/lang/ko.js +125 -123
  83. package/lib/locale/lang/ku.js +125 -123
  84. package/lib/locale/lang/kz.js +125 -123
  85. package/lib/locale/lang/lo-LA.js +121 -121
  86. package/lib/locale/lang/lt.js +125 -123
  87. package/lib/locale/lang/lv.js +125 -123
  88. package/lib/locale/lang/mn.js +125 -123
  89. package/lib/locale/lang/ms.js +123 -122
  90. package/lib/locale/lang/nb-NO.js +123 -122
  91. package/lib/locale/lang/nl.js +125 -123
  92. package/lib/locale/lang/pl.js +125 -123
  93. package/lib/locale/lang/pt-br.js +124 -123
  94. package/lib/locale/lang/pt.js +133 -123
  95. package/lib/locale/lang/ro.js +125 -123
  96. package/lib/locale/lang/ru-RU.js +124 -123
  97. package/lib/locale/lang/si.js +127 -123
  98. package/lib/locale/lang/sk.js +126 -125
  99. package/lib/locale/lang/sl.js +125 -123
  100. package/lib/locale/lang/sr-Latn.js +124 -123
  101. package/lib/locale/lang/sr.js +128 -123
  102. package/lib/locale/lang/sv-SE.js +128 -123
  103. package/lib/locale/lang/sw.js +127 -123
  104. package/lib/locale/lang/ta.js +130 -122
  105. package/lib/locale/lang/th.js +127 -123
  106. package/lib/locale/lang/tk.js +129 -123
  107. package/lib/locale/lang/tr-TR.js +125 -123
  108. package/lib/locale/lang/ua.js +124 -123
  109. package/lib/locale/lang/ug-CN.js +124 -123
  110. package/lib/locale/lang/uz-UZ.js +124 -123
  111. package/lib/locale/lang/vi.js +124 -123
  112. package/lib/locale/lang/zh-CN.js +124 -123
  113. package/lib/locale/lang/zh-TW.js +128 -123
  114. package/lib/main.js +23 -21
  115. package/lib/menu-item-group.js +105 -111
  116. package/lib/menu-item.js +3558 -253
  117. package/lib/menu.js +1680 -528
  118. package/lib/message-box.js +3427 -684
  119. package/lib/message.js +1677 -229
  120. package/lib/mixins/emitter.js +28 -30
  121. package/lib/mixins/focus.js +10 -11
  122. package/lib/mixins/locale.js +12 -14
  123. package/lib/mixins/migrating.js +38 -45
  124. package/lib/notification.js +1707 -269
  125. package/lib/option-group.js +190 -139
  126. package/lib/option.js +949 -196
  127. package/lib/page-header.js +964 -42
  128. package/lib/pagination.js +6947 -641
  129. package/lib/popconfirm.js +3951 -223
  130. package/lib/popover.js +3247 -369
  131. package/lib/progress.js +254 -244
  132. package/lib/radio-button.js +259 -226
  133. package/lib/radio-group.js +249 -186
  134. package/lib/radio.js +263 -253
  135. package/lib/rate.js +1399 -420
  136. package/lib/result.js +183 -227
  137. package/lib/row.js +58 -41
  138. package/lib/scrollbar.js +1331 -278
  139. package/lib/select.js +5816 -1428
  140. package/lib/skeleton-item.js +133 -145
  141. package/lib/skeleton.js +82 -91
  142. package/lib/slider.js +5157 -702
  143. package/lib/spinner.js +113 -101
  144. package/lib/statistic.js +10205 -254
  145. package/lib/step.js +274 -311
  146. package/lib/steps.js +854 -117
  147. package/lib/subTitle.js +292 -0
  148. package/lib/submenu.js +2867 -429
  149. package/lib/switch.js +1051 -291
  150. package/lib/tab-pane.js +125 -135
  151. package/lib/tabDialog.js +2658 -0
  152. package/lib/table-column.js +1975 -751
  153. package/lib/table.js +8019 -3979
  154. package/lib/tabs.js +1455 -605
  155. package/lib/tag.js +73 -68
  156. package/lib/theme-chalk/src/index.scss +3 -0
  157. package/lib/time-picker.js +6821 -1944
  158. package/lib/time-select.js +6297 -1186
  159. package/lib/timeline-item.js +43 -84
  160. package/lib/timeline.js +43 -39
  161. package/lib/tooltip.js +3185 -287
  162. package/lib/transfer.js +2943 -625
  163. package/lib/transitions/collapse-transition.js +69 -87
  164. package/lib/tree.js +3312 -1791
  165. package/lib/treeSelect.js +4436 -0
  166. package/lib/umd/locale/af-ZA.js +145 -138
  167. package/lib/umd/locale/ar.js +138 -137
  168. package/lib/umd/locale/az.js +139 -137
  169. package/lib/umd/locale/bg.js +148 -138
  170. package/lib/umd/locale/bn.js +138 -137
  171. package/lib/umd/locale/ca.js +138 -137
  172. package/lib/umd/locale/cs-CZ.js +142 -140
  173. package/lib/umd/locale/da.js +139 -137
  174. package/lib/umd/locale/de.js +141 -139
  175. package/lib/umd/locale/ee.js +140 -138
  176. package/lib/umd/locale/el.js +140 -138
  177. package/lib/umd/locale/en.js +142 -138
  178. package/lib/umd/locale/eo.js +140 -138
  179. package/lib/umd/locale/es.js +138 -137
  180. package/lib/umd/locale/eu.js +143 -138
  181. package/lib/umd/locale/fa.js +140 -138
  182. package/lib/umd/locale/fi.js +140 -138
  183. package/lib/umd/locale/fr.js +140 -137
  184. package/lib/umd/locale/he.js +145 -138
  185. package/lib/umd/locale/hr.js +143 -138
  186. package/lib/umd/locale/hu.js +139 -137
  187. package/lib/umd/locale/hy-AM.js +140 -138
  188. package/lib/umd/locale/id.js +139 -138
  189. package/lib/umd/locale/is.js +139 -138
  190. package/lib/umd/locale/it.js +138 -137
  191. package/lib/umd/locale/ja.js +140 -138
  192. package/lib/umd/locale/kg.js +140 -138
  193. package/lib/umd/locale/km.js +139 -138
  194. package/lib/umd/locale/ko.js +140 -138
  195. package/lib/umd/locale/ku.js +140 -138
  196. package/lib/umd/locale/kz.js +140 -138
  197. package/lib/umd/locale/lo-LA.js +138 -137
  198. package/lib/umd/locale/lt.js +140 -138
  199. package/lib/umd/locale/lv.js +140 -138
  200. package/lib/umd/locale/mn.js +140 -138
  201. package/lib/umd/locale/ms.js +138 -137
  202. package/lib/umd/locale/nb-NO.js +138 -137
  203. package/lib/umd/locale/nl.js +140 -138
  204. package/lib/umd/locale/pl.js +140 -138
  205. package/lib/umd/locale/pt-br.js +139 -138
  206. package/lib/umd/locale/pt.js +148 -138
  207. package/lib/umd/locale/ro.js +140 -138
  208. package/lib/umd/locale/ru-RU.js +139 -138
  209. package/lib/umd/locale/si.js +142 -138
  210. package/lib/umd/locale/sk.js +141 -140
  211. package/lib/umd/locale/sl.js +140 -138
  212. package/lib/umd/locale/sr-Latn.js +139 -138
  213. package/lib/umd/locale/sr.js +143 -138
  214. package/lib/umd/locale/sv-SE.js +143 -138
  215. package/lib/umd/locale/sw.js +142 -138
  216. package/lib/umd/locale/ta.js +145 -137
  217. package/lib/umd/locale/th.js +142 -138
  218. package/lib/umd/locale/tk.js +144 -138
  219. package/lib/umd/locale/tr-TR.js +140 -138
  220. package/lib/umd/locale/ua.js +139 -138
  221. package/lib/umd/locale/ug-CN.js +139 -138
  222. package/lib/umd/locale/uz-UZ.js +139 -138
  223. package/lib/umd/locale/vi.js +139 -138
  224. package/lib/umd/locale/zh-CN.js +139 -138
  225. package/lib/umd/locale/zh-TW.js +143 -138
  226. package/lib/upload.js +2377 -987
  227. package/lib/utils/after-leave.js +36 -33
  228. package/lib/utils/aria-dialog.js +55 -73
  229. package/lib/utils/aria-utils.js +67 -76
  230. package/lib/utils/clickoutside.js +52 -60
  231. package/lib/utils/date-util.js +198 -241
  232. package/lib/utils/date.js +6 -368
  233. package/lib/utils/date_source.js +349 -0
  234. package/lib/utils/dom.js +167 -183
  235. package/lib/utils/lodash.js +13 -9421
  236. package/lib/utils/lodash_source.js +9421 -0
  237. package/lib/utils/menu/aria-menubar.js +13 -18
  238. package/lib/utils/menu/aria-menuitem.js +43 -54
  239. package/lib/utils/menu/aria-submenu.js +50 -59
  240. package/lib/utils/merge.js +15 -17
  241. package/lib/utils/popper.js +1141 -1170
  242. package/lib/utils/popup/index.js +186 -230
  243. package/lib/utils/popup/popup-manager.js +159 -191
  244. package/lib/utils/resize-event.js +29 -44
  245. package/lib/utils/scroll-into-view.js +25 -33
  246. package/lib/utils/scrollbar-width.js +25 -36
  247. package/lib/utils/shared.js +3 -3
  248. package/lib/utils/types.js +19 -32
  249. package/lib/utils/util.js +187 -221
  250. package/lib/utils/vdom.js +5 -9
  251. package/lib/utils/vue-popper.js +166 -188
  252. package/package.json +20 -19
  253. package/packages/alert/src/main.vue +63 -63
  254. package/packages/aside/src/main.vue +9 -9
  255. package/packages/autocomplete/src/autocomplete-suggestions.vue +46 -46
  256. package/packages/autocomplete/src/autocomplete.vue +198 -198
  257. package/packages/avatar/src/main.vue +5 -5
  258. package/packages/backtop/src/main.vue +3 -3
  259. package/packages/badge/src/main.vue +1 -1
  260. package/packages/breadcrumb/src/breadcrumb-item.vue +26 -26
  261. package/packages/breadcrumb/src/breadcrumb.vue +22 -22
  262. package/packages/button/src/button-group.vue +3 -3
  263. package/packages/button/src/button.vue +44 -44
  264. package/packages/calendar/src/date-table.vue +3 -3
  265. package/packages/calendar/src/main.vue +7 -7
  266. package/packages/card/src/main.vue +9 -9
  267. package/packages/carousel/src/item.vue +98 -98
  268. package/packages/carousel/src/main.vue +2 -2
  269. package/packages/cascader/src/cascader.vue +4 -4
  270. package/packages/cascader-panel/src/cascader-menu.vue +4 -4
  271. package/packages/cascader-panel/src/cascader-node.vue +232 -232
  272. package/packages/cascader-panel/src/cascader-panel.vue +3 -3
  273. package/packages/cascader-panel/src/node.js +2 -3
  274. package/packages/cascader-panel/src/store.js +0 -1
  275. package/packages/checkbox/src/checkbox-button.vue +139 -139
  276. package/packages/checkbox/src/checkbox-group.vue +33 -33
  277. package/packages/checkbox/src/checkbox.vue +140 -140
  278. package/packages/col/src/col.js +5 -5
  279. package/packages/collapse/src/collapse-item.vue +55 -55
  280. package/packages/collapse/src/collapse.vue +54 -54
  281. package/packages/color-picker/src/color.js +4 -4
  282. package/packages/color-picker/src/components/alpha-slider.vue +100 -100
  283. package/packages/color-picker/src/components/hue-slider.vue +91 -91
  284. package/packages/color-picker/src/components/picker-dropdown.vue +64 -64
  285. package/packages/color-picker/src/components/predefine.vue +43 -43
  286. package/packages/color-picker/src/components/sv-panel.vue +70 -70
  287. package/packages/color-picker/src/main.vue +141 -141
  288. package/packages/container/src/main.vue +20 -20
  289. package/packages/date-picker/src/basic/date-table.vue +360 -360
  290. package/packages/date-picker/src/basic/month-table.vue +222 -223
  291. package/packages/date-picker/src/basic/time-spinner.vue +174 -174
  292. package/packages/date-picker/src/basic/year-table.vue +91 -91
  293. package/packages/date-picker/src/panel/date-range.vue +415 -415
  294. package/packages/date-picker/src/panel/date.vue +423 -423
  295. package/packages/date-picker/src/panel/month-range.vue +177 -177
  296. package/packages/date-picker/src/panel/time-range.vue +173 -173
  297. package/packages/date-picker/src/panel/time-select.vue +131 -131
  298. package/packages/date-picker/src/panel/time.vue +131 -131
  299. package/packages/date-picker/src/picker.vue +7 -7
  300. package/packages/descriptions/src/descriptions-row.js +3 -3
  301. package/packages/descriptions/src/index.js +1 -1
  302. package/packages/dialog/src/component.vue +155 -155
  303. package/packages/divider/src/main.vue +1 -1
  304. package/packages/drawer/src/main.vue +2 -2
  305. package/packages/dropdown/src/dropdown-item.vue +15 -15
  306. package/packages/dropdown/src/dropdown-menu.vue +47 -47
  307. package/packages/dropdown/src/dropdown.vue +260 -260
  308. package/packages/empty/src/index.vue +1 -1
  309. package/packages/fileUpload/index.js +8 -0
  310. package/packages/fileUpload/src/main.vue +430 -0
  311. package/packages/footer/src/main.vue +9 -9
  312. package/packages/form/src/form-item.vue +245 -245
  313. package/packages/form/src/form.vue +154 -154
  314. package/packages/header/src/main.vue +9 -9
  315. package/packages/icon/src/icon.vue +6 -6
  316. package/packages/image/src/image-viewer.vue +9 -9
  317. package/packages/image/src/main.vue +206 -206
  318. package/packages/infinite-scroll/src/main.js +1 -2
  319. package/packages/input/src/calcTextareaHeight.js +2 -2
  320. package/packages/input/src/input.vue +311 -311
  321. package/packages/input-number/src/input-number.vue +205 -205
  322. package/packages/loading/src/loading.vue +19 -19
  323. package/packages/main/src/main.vue +4 -4
  324. package/packages/menu/src/menu-item-group.vue +27 -27
  325. package/packages/menu/src/menu-item.vue +69 -69
  326. package/packages/menu/src/menu.vue +284 -284
  327. package/packages/menu/src/submenu.vue +308 -309
  328. package/packages/message/src/main.js +1 -1
  329. package/packages/message/src/main.vue +72 -72
  330. package/packages/message-box/src/main.vue +216 -216
  331. package/packages/notification/src/main.js +1 -1
  332. package/packages/notification/src/main.vue +93 -93
  333. package/packages/pagination/src/pager.vue +99 -99
  334. package/packages/popconfirm/src/main.vue +28 -28
  335. package/packages/popover/src/main.vue +6 -6
  336. package/packages/progress/src/progress.vue +174 -174
  337. package/packages/radio/src/radio-button.vue +64 -64
  338. package/packages/radio/src/radio-group.vue +88 -88
  339. package/packages/radio/src/radio.vue +74 -74
  340. package/packages/rate/src/main.vue +270 -270
  341. package/packages/row/src/row.js +3 -3
  342. package/packages/scrollbar/src/main.js +2 -2
  343. package/packages/scrollbar/src/util.js +1 -1
  344. package/packages/select/src/option-group.vue +46 -46
  345. package/packages/select/src/option.vue +122 -122
  346. package/packages/select/src/select-dropdown.vue +49 -49
  347. package/packages/select/src/select.vue +676 -676
  348. package/packages/skeleton/src/item.vue +12 -12
  349. package/packages/slider/src/button.vue +191 -191
  350. package/packages/slider/src/main.vue +314 -314
  351. package/packages/spinner/src/spinner.vue +16 -16
  352. package/packages/statistic/src/main.vue +5 -6
  353. package/packages/steps/src/step.vue +2 -2
  354. package/packages/steps/src/steps.vue +4 -4
  355. package/packages/subTitle/index.js +8 -0
  356. package/packages/subTitle/src/main.vue +33 -0
  357. package/packages/switch/src/component.vue +123 -123
  358. package/packages/tabDialog/index.js +23 -0
  359. package/packages/tabDialog/src/dialog/drag.js +63 -0
  360. package/packages/tabDialog/src/dialog/dragHeight.js +34 -0
  361. package/packages/tabDialog/src/dialog/dragWidth.js +30 -0
  362. package/packages/tabDialog/src/main.vue +277 -0
  363. package/packages/table/src/filter-panel.vue +128 -128
  364. package/packages/table/src/store/index.js +1 -1
  365. package/packages/table/src/table-body.js +2 -2
  366. package/packages/table/src/table-column.js +1 -1
  367. package/packages/table/src/table-header.js +1 -1
  368. package/packages/table/src/table-layout.js +1 -1
  369. package/packages/table/src/table.vue +416 -416
  370. package/packages/tabs/src/tab-bar.vue +43 -43
  371. package/packages/tabs/src/tab-nav.vue +250 -250
  372. package/packages/tabs/src/tab-pane.vue +34 -34
  373. package/packages/tabs/src/tabs.vue +165 -165
  374. package/packages/tag/src/tag.vue +52 -52
  375. package/packages/theme-chalk/src/index.scss +3 -0
  376. package/packages/theme-cy/lib/element.css +1 -0
  377. package/packages/theme-cy/lib/fileUpload.css +1 -0
  378. package/packages/theme-cy/lib/index.css +1 -1
  379. package/packages/theme-cy/lib/subTitle.css +1 -0
  380. package/packages/theme-cy/lib/tabDialog.css +1 -0
  381. package/packages/theme-cy/lib/treeselect.css +1 -1
  382. package/packages/theme-cy/src/element.scss +45 -0
  383. package/packages/theme-cy/src/fileUpload.scss +30 -0
  384. package/packages/theme-cy/src/index.scss +4 -0
  385. package/packages/theme-cy/src/subTitle.scss +26 -0
  386. package/packages/theme-cy/src/tabDialog.scss +43 -0
  387. package/packages/theme-cy/src/treeselect.scss +20 -14
  388. package/packages/timeline/src/item.vue +24 -24
  389. package/packages/timeline/src/main.vue +27 -27
  390. package/packages/tooltip/src/main.js +1 -1
  391. package/packages/transfer/src/main.vue +169 -169
  392. package/packages/transfer/src/transfer-panel.vue +164 -164
  393. package/packages/tree/src/tree-node.vue +169 -169
  394. package/packages/tree/src/tree.vue +408 -408
  395. package/packages/treeSelect/index.js +8 -0
  396. package/packages/{treeselect → treeSelect}/src/main.vue +19 -19
  397. package/packages/upload/src/ajax.js +3 -3
  398. package/packages/upload/src/upload-dragger.vue +50 -50
  399. package/packages/upload/src/upload-list.vue +33 -33
  400. package/packages/upload/src/upload.vue +1 -1
  401. package/src/index.js +13 -5
  402. package/src/locale/format.js +0 -1
  403. package/src/mixins/migrating.js +2 -2
  404. package/src/utils/date.js +2 -368
  405. package/src/utils/date_source.js +368 -0
  406. package/src/utils/lodash.js +9 -18075
  407. package/src/utils/lodash_source.js +18075 -0
  408. package/src/utils/types.js +1 -1
  409. package/types/element-ui.d.ts +16 -3
  410. package/types/fileUpload.d.ts +5 -0
  411. package/types/subTitle.d.ts +5 -0
  412. package/types/tabDialog.d.ts +5 -0
  413. package/types/treeSelect.d.ts +5 -0
  414. package/lib/treeselect.js +0 -682
  415. package/packages/treeselect/index.js +0 -8
  416. package/types/treeselect.d.ts +0 -5
@@ -15,7 +15,7 @@
15
15
  class="el-picker-panel__shortcut"
16
16
  v-for="(shortcut, key) in shortcuts"
17
17
  :key="key"
18
- @click="handleShortcutClick(shortcut)">{{shortcut.text}}</button>
18
+ @click="handleShortcutClick(shortcut)">{{ shortcut.text }}</button>
19
19
  </div>
20
20
  <div class="el-picker-panel__body">
21
21
  <div class="el-date-range-picker__time-header" v-if="showTime">
@@ -188,493 +188,493 @@
188
188
  </template>
189
189
 
190
190
  <script type="text/babel">
191
- import {
192
- formatDate,
193
- parseDate,
194
- isDate,
195
- modifyDate,
196
- modifyTime,
197
- modifyWithTimeString,
198
- prevYear,
199
- nextYear,
200
- prevMonth,
201
- nextMonth,
202
- nextDate,
203
- extractDateFormat,
204
- extractTimeFormat
205
- } from 'element-ui/src/utils/date-util';
206
- import Clickoutside from 'element-ui/src/utils/clickoutside';
207
- import Locale from 'element-ui/src/mixins/locale';
208
- import TimePicker from './time';
209
- import DateTable from '../basic/date-table';
210
- import ElInput from 'element-ui/packages/input';
211
- import ElButton from 'element-ui/packages/button';
212
-
213
- const calcDefaultValue = (defaultValue) => {
214
- if (Array.isArray(defaultValue)) {
215
- return [new Date(defaultValue[0]), new Date(defaultValue[1])];
216
- } else if (defaultValue) {
217
- return [new Date(defaultValue), nextDate(new Date(defaultValue), 1)];
218
- } else {
219
- return [new Date(), nextDate(new Date(), 1)];
220
- }
221
- };
222
-
223
- export default {
224
- mixins: [Locale],
191
+ import {
192
+ formatDate,
193
+ parseDate,
194
+ isDate,
195
+ modifyDate,
196
+ modifyTime,
197
+ modifyWithTimeString,
198
+ prevYear,
199
+ nextYear,
200
+ prevMonth,
201
+ nextMonth,
202
+ nextDate,
203
+ extractDateFormat,
204
+ extractTimeFormat
205
+ } from 'element-ui/src/utils/date-util';
206
+ import Clickoutside from 'element-ui/src/utils/clickoutside';
207
+ import Locale from 'element-ui/src/mixins/locale';
208
+ import TimePicker from './time';
209
+ import DateTable from '../basic/date-table';
210
+ import ElInput from 'element-ui/packages/input';
211
+ import ElButton from 'element-ui/packages/button';
212
+
213
+ const calcDefaultValue = (defaultValue) => {
214
+ if (Array.isArray(defaultValue)) {
215
+ return [new Date(defaultValue[0]), new Date(defaultValue[1])];
216
+ } else if (defaultValue) {
217
+ return [new Date(defaultValue), nextDate(new Date(defaultValue), 1)];
218
+ } else {
219
+ return [new Date(), nextDate(new Date(), 1)];
220
+ }
221
+ };
222
+
223
+ export default {
224
+ mixins: [Locale],
225
+
226
+ directives: { Clickoutside },
227
+
228
+ computed: {
229
+ btnDisabled() {
230
+ return !(this.minDate && this.maxDate && !this.selecting && this.isValidValue([this.minDate, this.maxDate]));
231
+ },
225
232
 
226
- directives: { Clickoutside },
233
+ leftLabel() {
234
+ return this.leftDate.getFullYear() + ' ' + this.t('el.datepicker.year') + ' ' + this.t(`el.datepicker.month${ this.leftDate.getMonth() + 1 }`);
235
+ },
227
236
 
228
- computed: {
229
- btnDisabled() {
230
- return !(this.minDate && this.maxDate && !this.selecting && this.isValidValue([this.minDate, this.maxDate]));
231
- },
237
+ rightLabel() {
238
+ return this.rightDate.getFullYear() + ' ' + this.t('el.datepicker.year') + ' ' + this.t(`el.datepicker.month${ this.rightDate.getMonth() + 1 }`);
239
+ },
232
240
 
233
- leftLabel() {
234
- return this.leftDate.getFullYear() + ' ' + this.t('el.datepicker.year') + ' ' + this.t(`el.datepicker.month${ this.leftDate.getMonth() + 1 }`);
235
- },
241
+ leftYear() {
242
+ return this.leftDate.getFullYear();
243
+ },
236
244
 
237
- rightLabel() {
238
- return this.rightDate.getFullYear() + ' ' + this.t('el.datepicker.year') + ' ' + this.t(`el.datepicker.month${ this.rightDate.getMonth() + 1 }`);
239
- },
245
+ leftMonth() {
246
+ return this.leftDate.getMonth();
247
+ },
240
248
 
241
- leftYear() {
242
- return this.leftDate.getFullYear();
243
- },
249
+ leftMonthDate() {
250
+ return this.leftDate.getDate();
251
+ },
244
252
 
245
- leftMonth() {
246
- return this.leftDate.getMonth();
247
- },
253
+ rightYear() {
254
+ return this.rightDate.getFullYear();
255
+ },
248
256
 
249
- leftMonthDate() {
250
- return this.leftDate.getDate();
251
- },
257
+ rightMonth() {
258
+ return this.rightDate.getMonth();
259
+ },
252
260
 
253
- rightYear() {
254
- return this.rightDate.getFullYear();
255
- },
261
+ rightMonthDate() {
262
+ return this.rightDate.getDate();
263
+ },
256
264
 
257
- rightMonth() {
258
- return this.rightDate.getMonth();
259
- },
265
+ minVisibleDate() {
266
+ if (this.dateUserInput.min !== null) return this.dateUserInput.min;
267
+ if (this.minDate) return formatDate(this.minDate, this.dateFormat);
268
+ return '';
269
+ },
260
270
 
261
- rightMonthDate() {
262
- return this.rightDate.getDate();
263
- },
271
+ maxVisibleDate() {
272
+ if (this.dateUserInput.max !== null) return this.dateUserInput.max;
273
+ if (this.maxDate || this.minDate) return formatDate(this.maxDate || this.minDate, this.dateFormat);
274
+ return '';
275
+ },
264
276
 
265
- minVisibleDate() {
266
- if (this.dateUserInput.min !== null) return this.dateUserInput.min;
267
- if (this.minDate) return formatDate(this.minDate, this.dateFormat);
268
- return '';
269
- },
277
+ minVisibleTime() {
278
+ if (this.timeUserInput.min !== null) return this.timeUserInput.min;
279
+ if (this.minDate) return formatDate(this.minDate, this.timeFormat);
280
+ return '';
281
+ },
270
282
 
271
- maxVisibleDate() {
272
- if (this.dateUserInput.max !== null) return this.dateUserInput.max;
273
- if (this.maxDate || this.minDate) return formatDate(this.maxDate || this.minDate, this.dateFormat);
274
- return '';
275
- },
283
+ maxVisibleTime() {
284
+ if (this.timeUserInput.max !== null) return this.timeUserInput.max;
285
+ if (this.maxDate || this.minDate) return formatDate(this.maxDate || this.minDate, this.timeFormat);
286
+ return '';
287
+ },
276
288
 
277
- minVisibleTime() {
278
- if (this.timeUserInput.min !== null) return this.timeUserInput.min;
279
- if (this.minDate) return formatDate(this.minDate, this.timeFormat);
280
- return '';
281
- },
289
+ timeFormat() {
290
+ if (this.format) {
291
+ return extractTimeFormat(this.format);
292
+ } else {
293
+ return 'HH:mm:ss';
294
+ }
295
+ },
282
296
 
283
- maxVisibleTime() {
284
- if (this.timeUserInput.max !== null) return this.timeUserInput.max;
285
- if (this.maxDate || this.minDate) return formatDate(this.maxDate || this.minDate, this.timeFormat);
286
- return '';
287
- },
297
+ dateFormat() {
298
+ if (this.format) {
299
+ return extractDateFormat(this.format);
300
+ } else {
301
+ return 'yyyy-MM-dd';
302
+ }
303
+ },
288
304
 
289
- timeFormat() {
290
- if (this.format) {
291
- return extractTimeFormat(this.format);
292
- } else {
293
- return 'HH:mm:ss';
294
- }
295
- },
305
+ enableMonthArrow() {
306
+ const nextMonth = (this.leftMonth + 1) % 12;
307
+ const yearOffset = this.leftMonth + 1 >= 12 ? 1 : 0;
308
+ return this.unlinkPanels && new Date(this.leftYear + yearOffset, nextMonth) < new Date(this.rightYear, this.rightMonth);
309
+ },
296
310
 
297
- dateFormat() {
298
- if (this.format) {
299
- return extractDateFormat(this.format);
300
- } else {
301
- return 'yyyy-MM-dd';
311
+ enableYearArrow() {
312
+ return this.unlinkPanels && this.rightYear * 12 + this.rightMonth - (this.leftYear * 12 + this.leftMonth + 1) >= 12;
313
+ }
314
+ },
315
+
316
+ data() {
317
+ return {
318
+ popperClass: '',
319
+ value: [],
320
+ defaultValue: null,
321
+ defaultTime: null,
322
+ minDate: '',
323
+ maxDate: '',
324
+ leftDate: new Date(),
325
+ rightDate: nextMonth(new Date()),
326
+ rangeState: {
327
+ endDate: null,
328
+ selecting: false,
329
+ row: null,
330
+ column: null
331
+ },
332
+ showTime: false,
333
+ shortcuts: '',
334
+ visible: '',
335
+ disabledDate: '',
336
+ cellClassName: '',
337
+ firstDayOfWeek: 7,
338
+ minTimePickerVisible: false,
339
+ maxTimePickerVisible: false,
340
+ format: '',
341
+ arrowControl: false,
342
+ unlinkPanels: false,
343
+ dateUserInput: {
344
+ min: null,
345
+ max: null
346
+ },
347
+ timeUserInput: {
348
+ min: null,
349
+ max: null
350
+ }
351
+ };
352
+ },
353
+
354
+ watch: {
355
+ minDate(val) {
356
+ this.dateUserInput.min = null;
357
+ this.timeUserInput.min = null;
358
+ this.$nextTick(() => {
359
+ if (this.$refs.maxTimePicker && this.maxDate && this.maxDate < this.minDate) {
360
+ const format = 'HH:mm:ss';
361
+ this.$refs.maxTimePicker.selectableRange = [
362
+ [
363
+ parseDate(formatDate(this.minDate, format), format),
364
+ parseDate('23:59:59', format)
365
+ ]
366
+ ];
302
367
  }
303
- },
304
-
305
- enableMonthArrow() {
306
- const nextMonth = (this.leftMonth + 1) % 12;
307
- const yearOffset = this.leftMonth + 1 >= 12 ? 1 : 0;
308
- return this.unlinkPanels && new Date(this.leftYear + yearOffset, nextMonth) < new Date(this.rightYear, this.rightMonth);
309
- },
310
-
311
- enableYearArrow() {
312
- return this.unlinkPanels && this.rightYear * 12 + this.rightMonth - (this.leftYear * 12 + this.leftMonth + 1) >= 12;
368
+ });
369
+ if (val && this.$refs.minTimePicker) {
370
+ this.$refs.minTimePicker.date = val;
371
+ this.$refs.minTimePicker.value = val;
313
372
  }
314
373
  },
315
374
 
316
- data() {
317
- return {
318
- popperClass: '',
319
- value: [],
320
- defaultValue: null,
321
- defaultTime: null,
322
- minDate: '',
323
- maxDate: '',
324
- leftDate: new Date(),
325
- rightDate: nextMonth(new Date()),
326
- rangeState: {
327
- endDate: null,
328
- selecting: false,
329
- row: null,
330
- column: null
331
- },
332
- showTime: false,
333
- shortcuts: '',
334
- visible: '',
335
- disabledDate: '',
336
- cellClassName: '',
337
- firstDayOfWeek: 7,
338
- minTimePickerVisible: false,
339
- maxTimePickerVisible: false,
340
- format: '',
341
- arrowControl: false,
342
- unlinkPanels: false,
343
- dateUserInput: {
344
- min: null,
345
- max: null
346
- },
347
- timeUserInput: {
348
- min: null,
349
- max: null
350
- }
351
- };
375
+ maxDate(val) {
376
+ this.dateUserInput.max = null;
377
+ this.timeUserInput.max = null;
378
+ if (val && this.$refs.maxTimePicker) {
379
+ this.$refs.maxTimePicker.date = val;
380
+ this.$refs.maxTimePicker.value = val;
381
+ }
352
382
  },
353
383
 
354
- watch: {
355
- minDate(val) {
356
- this.dateUserInput.min = null;
357
- this.timeUserInput.min = null;
384
+ minTimePickerVisible(val) {
385
+ if (val) {
358
386
  this.$nextTick(() => {
359
- if (this.$refs.maxTimePicker && this.maxDate && this.maxDate < this.minDate) {
360
- const format = 'HH:mm:ss';
361
- this.$refs.maxTimePicker.selectableRange = [
362
- [
363
- parseDate(formatDate(this.minDate, format), format),
364
- parseDate('23:59:59', format)
365
- ]
366
- ];
367
- }
387
+ this.$refs.minTimePicker.date = this.minDate;
388
+ this.$refs.minTimePicker.value = this.minDate;
389
+ this.$refs.minTimePicker.adjustSpinners();
368
390
  });
369
- if (val && this.$refs.minTimePicker) {
370
- this.$refs.minTimePicker.date = val;
371
- this.$refs.minTimePicker.value = val;
372
- }
373
- },
374
-
375
- maxDate(val) {
376
- this.dateUserInput.max = null;
377
- this.timeUserInput.max = null;
378
- if (val && this.$refs.maxTimePicker) {
379
- this.$refs.maxTimePicker.date = val;
380
- this.$refs.maxTimePicker.value = val;
381
- }
382
- },
383
-
384
- minTimePickerVisible(val) {
385
- if (val) {
386
- this.$nextTick(() => {
387
- this.$refs.minTimePicker.date = this.minDate;
388
- this.$refs.minTimePicker.value = this.minDate;
389
- this.$refs.minTimePicker.adjustSpinners();
390
- });
391
- }
392
- },
391
+ }
392
+ },
393
393
 
394
- maxTimePickerVisible(val) {
395
- if (val) {
396
- this.$nextTick(() => {
397
- this.$refs.maxTimePicker.date = this.maxDate;
398
- this.$refs.maxTimePicker.value = this.maxDate;
399
- this.$refs.maxTimePicker.adjustSpinners();
400
- });
401
- }
402
- },
394
+ maxTimePickerVisible(val) {
395
+ if (val) {
396
+ this.$nextTick(() => {
397
+ this.$refs.maxTimePicker.date = this.maxDate;
398
+ this.$refs.maxTimePicker.value = this.maxDate;
399
+ this.$refs.maxTimePicker.adjustSpinners();
400
+ });
401
+ }
402
+ },
403
403
 
404
- value(newVal) {
405
- if (!newVal) {
406
- this.minDate = null;
407
- this.maxDate = null;
408
- } else if (Array.isArray(newVal)) {
409
- this.minDate = isDate(newVal[0]) ? new Date(newVal[0]) : null;
410
- this.maxDate = isDate(newVal[1]) ? new Date(newVal[1]) : null;
411
- if (this.minDate) {
412
- this.leftDate = this.minDate;
413
- if (this.unlinkPanels && this.maxDate) {
414
- const minDateYear = this.minDate.getFullYear();
415
- const minDateMonth = this.minDate.getMonth();
416
- const maxDateYear = this.maxDate.getFullYear();
417
- const maxDateMonth = this.maxDate.getMonth();
418
- this.rightDate = minDateYear === maxDateYear && minDateMonth === maxDateMonth
419
- ? nextMonth(this.maxDate)
420
- : this.maxDate;
421
- } else {
422
- this.rightDate = nextMonth(this.leftDate);
423
- }
404
+ value(newVal) {
405
+ if (!newVal) {
406
+ this.minDate = null;
407
+ this.maxDate = null;
408
+ } else if (Array.isArray(newVal)) {
409
+ this.minDate = isDate(newVal[0]) ? new Date(newVal[0]) : null;
410
+ this.maxDate = isDate(newVal[1]) ? new Date(newVal[1]) : null;
411
+ if (this.minDate) {
412
+ this.leftDate = this.minDate;
413
+ if (this.unlinkPanels && this.maxDate) {
414
+ const minDateYear = this.minDate.getFullYear();
415
+ const minDateMonth = this.minDate.getMonth();
416
+ const maxDateYear = this.maxDate.getFullYear();
417
+ const maxDateMonth = this.maxDate.getMonth();
418
+ this.rightDate = minDateYear === maxDateYear && minDateMonth === maxDateMonth
419
+ ? nextMonth(this.maxDate)
420
+ : this.maxDate;
424
421
  } else {
425
- this.leftDate = calcDefaultValue(this.defaultValue)[0];
426
422
  this.rightDate = nextMonth(this.leftDate);
427
423
  }
428
- }
429
- },
430
-
431
- defaultValue(val) {
432
- if (!Array.isArray(this.value)) {
433
- const [left, right] = calcDefaultValue(val);
434
- this.leftDate = left;
435
- this.rightDate = val && val[1] && this.unlinkPanels
436
- ? right
437
- : nextMonth(this.leftDate);
424
+ } else {
425
+ this.leftDate = calcDefaultValue(this.defaultValue)[0];
426
+ this.rightDate = nextMonth(this.leftDate);
438
427
  }
439
428
  }
440
429
  },
441
430
 
442
- methods: {
443
- handleClear() {
444
- this.minDate = null;
445
- this.maxDate = null;
446
- this.leftDate = calcDefaultValue(this.defaultValue)[0];
447
- this.rightDate = nextMonth(this.leftDate);
448
- this.$emit('pick', null);
449
- },
431
+ defaultValue(val) {
432
+ if (!Array.isArray(this.value)) {
433
+ const [left, right] = calcDefaultValue(val);
434
+ this.leftDate = left;
435
+ this.rightDate = val && val[1] && this.unlinkPanels
436
+ ? right
437
+ : nextMonth(this.leftDate);
438
+ }
439
+ }
440
+ },
441
+
442
+ methods: {
443
+ handleClear() {
444
+ this.minDate = null;
445
+ this.maxDate = null;
446
+ this.leftDate = calcDefaultValue(this.defaultValue)[0];
447
+ this.rightDate = nextMonth(this.leftDate);
448
+ this.$emit('pick', null);
449
+ },
450
450
 
451
- handleChangeRange(val) {
452
- this.minDate = val.minDate;
453
- this.maxDate = val.maxDate;
454
- this.rangeState = val.rangeState;
455
- },
451
+ handleChangeRange(val) {
452
+ this.minDate = val.minDate;
453
+ this.maxDate = val.maxDate;
454
+ this.rangeState = val.rangeState;
455
+ },
456
456
 
457
- handleDateInput(value, type) {
458
- this.dateUserInput[type] = value;
459
- if (value.length !== this.dateFormat.length) return;
460
- const parsedValue = parseDate(value, this.dateFormat);
457
+ handleDateInput(value, type) {
458
+ this.dateUserInput[type] = value;
459
+ if (value.length !== this.dateFormat.length) return;
460
+ const parsedValue = parseDate(value, this.dateFormat);
461
461
 
462
- if (parsedValue) {
463
- if (typeof this.disabledDate === 'function' &&
464
- this.disabledDate(new Date(parsedValue))) {
465
- return;
462
+ if (parsedValue) {
463
+ if (typeof this.disabledDate === 'function' &&
464
+ this.disabledDate(new Date(parsedValue))) {
465
+ return;
466
+ }
467
+ if (type === 'min') {
468
+ this.minDate = modifyDate(this.minDate || new Date(), parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
469
+ this.leftDate = new Date(parsedValue);
470
+ if (!this.unlinkPanels) {
471
+ this.rightDate = nextMonth(this.leftDate);
466
472
  }
467
- if (type === 'min') {
468
- this.minDate = modifyDate(this.minDate || new Date(), parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
469
- this.leftDate = new Date(parsedValue);
470
- if (!this.unlinkPanels) {
471
- this.rightDate = nextMonth(this.leftDate);
472
- }
473
- } else {
474
- this.maxDate = modifyDate(this.maxDate || new Date(), parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
475
- this.rightDate = new Date(parsedValue);
476
- if (!this.unlinkPanels) {
477
- this.leftDate = prevMonth(parsedValue);
478
- }
473
+ } else {
474
+ this.maxDate = modifyDate(this.maxDate || new Date(), parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
475
+ this.rightDate = new Date(parsedValue);
476
+ if (!this.unlinkPanels) {
477
+ this.leftDate = prevMonth(parsedValue);
479
478
  }
480
479
  }
481
- },
480
+ }
481
+ },
482
482
 
483
- handleDateChange(value, type) {
484
- const parsedValue = parseDate(value, this.dateFormat);
485
- if (parsedValue) {
486
- if (type === 'min') {
487
- this.minDate = modifyDate(this.minDate, parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
488
- if (this.minDate > this.maxDate) {
489
- this.maxDate = this.minDate;
490
- }
491
- } else {
492
- this.maxDate = modifyDate(this.maxDate, parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
493
- if (this.maxDate < this.minDate) {
494
- this.minDate = this.maxDate;
495
- }
483
+ handleDateChange(value, type) {
484
+ const parsedValue = parseDate(value, this.dateFormat);
485
+ if (parsedValue) {
486
+ if (type === 'min') {
487
+ this.minDate = modifyDate(this.minDate, parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
488
+ if (this.minDate > this.maxDate) {
489
+ this.maxDate = this.minDate;
490
+ }
491
+ } else {
492
+ this.maxDate = modifyDate(this.maxDate, parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
493
+ if (this.maxDate < this.minDate) {
494
+ this.minDate = this.maxDate;
496
495
  }
497
496
  }
498
- },
497
+ }
498
+ },
499
499
 
500
- handleTimeInput(value, type) {
501
- this.timeUserInput[type] = value;
502
- if (value.length !== this.timeFormat.length) return;
503
- const parsedValue = parseDate(value, this.timeFormat);
500
+ handleTimeInput(value, type) {
501
+ this.timeUserInput[type] = value;
502
+ if (value.length !== this.timeFormat.length) return;
503
+ const parsedValue = parseDate(value, this.timeFormat);
504
504
 
505
- if (parsedValue) {
506
- if (type === 'min') {
507
- this.minDate = modifyTime(this.minDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
508
- this.$nextTick(_ => this.$refs.minTimePicker.adjustSpinners());
509
- } else {
510
- this.maxDate = modifyTime(this.maxDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
511
- this.$nextTick(_ => this.$refs.maxTimePicker.adjustSpinners());
512
- }
505
+ if (parsedValue) {
506
+ if (type === 'min') {
507
+ this.minDate = modifyTime(this.minDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
508
+ this.$nextTick(_ => this.$refs.minTimePicker.adjustSpinners());
509
+ } else {
510
+ this.maxDate = modifyTime(this.maxDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
511
+ this.$nextTick(_ => this.$refs.maxTimePicker.adjustSpinners());
513
512
  }
514
- },
513
+ }
514
+ },
515
515
 
516
- handleTimeChange(value, type) {
517
- const parsedValue = parseDate(value, this.timeFormat);
518
- if (parsedValue) {
519
- if (type === 'min') {
520
- this.minDate = modifyTime(this.minDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
521
- if (this.minDate > this.maxDate) {
522
- this.maxDate = this.minDate;
523
- }
524
- this.$refs.minTimePicker.value = this.minDate;
525
- this.minTimePickerVisible = false;
526
- } else {
527
- this.maxDate = modifyTime(this.maxDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
528
- if (this.maxDate < this.minDate) {
529
- this.minDate = this.maxDate;
530
- }
531
- this.$refs.maxTimePicker.value = this.minDate;
532
- this.maxTimePickerVisible = false;
516
+ handleTimeChange(value, type) {
517
+ const parsedValue = parseDate(value, this.timeFormat);
518
+ if (parsedValue) {
519
+ if (type === 'min') {
520
+ this.minDate = modifyTime(this.minDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
521
+ if (this.minDate > this.maxDate) {
522
+ this.maxDate = this.minDate;
523
+ }
524
+ this.$refs.minTimePicker.value = this.minDate;
525
+ this.minTimePickerVisible = false;
526
+ } else {
527
+ this.maxDate = modifyTime(this.maxDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
528
+ if (this.maxDate < this.minDate) {
529
+ this.minDate = this.maxDate;
533
530
  }
531
+ this.$refs.maxTimePicker.value = this.minDate;
532
+ this.maxTimePickerVisible = false;
534
533
  }
535
- },
534
+ }
535
+ },
536
536
 
537
- handleRangePick(val, close = true) {
538
- const defaultTime = this.defaultTime || [];
539
- const minDate = modifyWithTimeString(val.minDate, defaultTime[0]);
540
- const maxDate = modifyWithTimeString(val.maxDate, defaultTime[1]);
537
+ handleRangePick(val, close = true) {
538
+ const defaultTime = this.defaultTime || [];
539
+ const minDate = modifyWithTimeString(val.minDate, defaultTime[0]);
540
+ const maxDate = modifyWithTimeString(val.maxDate, defaultTime[1]);
541
541
 
542
- if (this.maxDate === maxDate && this.minDate === minDate) {
543
- return;
544
- }
545
- this.onPick && this.onPick(val);
542
+ if (this.maxDate === maxDate && this.minDate === minDate) {
543
+ return;
544
+ }
545
+ this.onPick && this.onPick(val);
546
+ this.maxDate = maxDate;
547
+ this.minDate = minDate;
548
+
549
+ // workaround for https://github.com/ElemeFE/element/issues/7539, should remove this block when we don't have to care about Chromium 55 - 57
550
+ setTimeout(() => {
546
551
  this.maxDate = maxDate;
547
552
  this.minDate = minDate;
553
+ }, 10);
554
+ if (!close || this.showTime) return;
555
+ this.handleConfirm();
556
+ },
548
557
 
549
- // workaround for https://github.com/ElemeFE/element/issues/7539, should remove this block when we don't have to care about Chromium 55 - 57
550
- setTimeout(() => {
551
- this.maxDate = maxDate;
552
- this.minDate = minDate;
553
- }, 10);
554
- if (!close || this.showTime) return;
555
- this.handleConfirm();
556
- },
557
-
558
- handleShortcutClick(shortcut) {
559
- if (shortcut.onClick) {
560
- shortcut.onClick(this);
561
- }
562
- },
563
-
564
- handleMinTimePick(value, visible, first) {
565
- this.minDate = this.minDate || new Date();
566
- if (value) {
567
- this.minDate = modifyTime(this.minDate, value.getHours(), value.getMinutes(), value.getSeconds());
568
- }
569
-
570
- if (!first) {
571
- this.minTimePickerVisible = visible;
572
- }
558
+ handleShortcutClick(shortcut) {
559
+ if (shortcut.onClick) {
560
+ shortcut.onClick(this);
561
+ }
562
+ },
573
563
 
574
- if (!this.maxDate || this.maxDate && this.maxDate.getTime() < this.minDate.getTime()) {
575
- this.maxDate = new Date(this.minDate);
576
- }
577
- },
564
+ handleMinTimePick(value, visible, first) {
565
+ this.minDate = this.minDate || new Date();
566
+ if (value) {
567
+ this.minDate = modifyTime(this.minDate, value.getHours(), value.getMinutes(), value.getSeconds());
568
+ }
578
569
 
579
- handleMinTimeClose() {
580
- this.minTimePickerVisible = false;
581
- },
570
+ if (!first) {
571
+ this.minTimePickerVisible = visible;
572
+ }
582
573
 
583
- handleMaxTimePick(value, visible, first) {
584
- if (this.maxDate && value) {
585
- this.maxDate = modifyTime(this.maxDate, value.getHours(), value.getMinutes(), value.getSeconds());
586
- }
574
+ if (!this.maxDate || this.maxDate && this.maxDate.getTime() < this.minDate.getTime()) {
575
+ this.maxDate = new Date(this.minDate);
576
+ }
577
+ },
587
578
 
588
- if (!first) {
589
- this.maxTimePickerVisible = visible;
590
- }
579
+ handleMinTimeClose() {
580
+ this.minTimePickerVisible = false;
581
+ },
591
582
 
592
- if (this.maxDate && this.minDate && this.minDate.getTime() > this.maxDate.getTime()) {
593
- this.minDate = new Date(this.maxDate);
594
- }
595
- },
583
+ handleMaxTimePick(value, visible, first) {
584
+ if (this.maxDate && value) {
585
+ this.maxDate = modifyTime(this.maxDate, value.getHours(), value.getMinutes(), value.getSeconds());
586
+ }
596
587
 
597
- handleMaxTimeClose() {
598
- this.maxTimePickerVisible = false;
599
- },
588
+ if (!first) {
589
+ this.maxTimePickerVisible = visible;
590
+ }
600
591
 
601
- // leftPrev*, rightNext* need to take care of `unlinkPanels`
602
- leftPrevYear() {
603
- this.leftDate = prevYear(this.leftDate);
604
- if (!this.unlinkPanels) {
605
- this.rightDate = nextMonth(this.leftDate);
606
- }
607
- },
592
+ if (this.maxDate && this.minDate && this.minDate.getTime() > this.maxDate.getTime()) {
593
+ this.minDate = new Date(this.maxDate);
594
+ }
595
+ },
608
596
 
609
- leftPrevMonth() {
610
- this.leftDate = prevMonth(this.leftDate);
611
- if (!this.unlinkPanels) {
612
- this.rightDate = nextMonth(this.leftDate);
613
- }
614
- },
597
+ handleMaxTimeClose() {
598
+ this.maxTimePickerVisible = false;
599
+ },
615
600
 
616
- rightNextYear() {
617
- if (!this.unlinkPanels) {
618
- this.leftDate = nextYear(this.leftDate);
619
- this.rightDate = nextMonth(this.leftDate);
620
- } else {
621
- this.rightDate = nextYear(this.rightDate);
622
- }
623
- },
601
+ // leftPrev*, rightNext* need to take care of `unlinkPanels`
602
+ leftPrevYear() {
603
+ this.leftDate = prevYear(this.leftDate);
604
+ if (!this.unlinkPanels) {
605
+ this.rightDate = nextMonth(this.leftDate);
606
+ }
607
+ },
624
608
 
625
- rightNextMonth() {
626
- if (!this.unlinkPanels) {
627
- this.leftDate = nextMonth(this.leftDate);
628
- this.rightDate = nextMonth(this.leftDate);
629
- } else {
630
- this.rightDate = nextMonth(this.rightDate);
631
- }
632
- },
609
+ leftPrevMonth() {
610
+ this.leftDate = prevMonth(this.leftDate);
611
+ if (!this.unlinkPanels) {
612
+ this.rightDate = nextMonth(this.leftDate);
613
+ }
614
+ },
633
615
 
634
- // leftNext*, rightPrev* are called when `unlinkPanels` is true
635
- leftNextYear() {
616
+ rightNextYear() {
617
+ if (!this.unlinkPanels) {
636
618
  this.leftDate = nextYear(this.leftDate);
637
- },
619
+ this.rightDate = nextMonth(this.leftDate);
620
+ } else {
621
+ this.rightDate = nextYear(this.rightDate);
622
+ }
623
+ },
638
624
 
639
- leftNextMonth() {
625
+ rightNextMonth() {
626
+ if (!this.unlinkPanels) {
640
627
  this.leftDate = nextMonth(this.leftDate);
641
- },
628
+ this.rightDate = nextMonth(this.leftDate);
629
+ } else {
630
+ this.rightDate = nextMonth(this.rightDate);
631
+ }
632
+ },
642
633
 
643
- rightPrevYear() {
644
- this.rightDate = prevYear(this.rightDate);
645
- },
634
+ // leftNext*, rightPrev* are called when `unlinkPanels` is true
635
+ leftNextYear() {
636
+ this.leftDate = nextYear(this.leftDate);
637
+ },
646
638
 
647
- rightPrevMonth() {
648
- this.rightDate = prevMonth(this.rightDate);
649
- },
639
+ leftNextMonth() {
640
+ this.leftDate = nextMonth(this.leftDate);
641
+ },
650
642
 
651
- handleConfirm(visible = false) {
652
- if (this.isValidValue([this.minDate, this.maxDate])) {
653
- this.$emit('pick', [this.minDate, this.maxDate], visible);
654
- }
655
- },
643
+ rightPrevYear() {
644
+ this.rightDate = prevYear(this.rightDate);
645
+ },
656
646
 
657
- isValidValue(value) {
658
- return Array.isArray(value) &&
659
- value && value[0] && value[1] &&
660
- isDate(value[0]) && isDate(value[1]) &&
661
- value[0].getTime() <= value[1].getTime() && (
662
- typeof this.disabledDate === 'function'
663
- ? !this.disabledDate(value[0]) && !this.disabledDate(value[1])
664
- : true
665
- );
666
- },
647
+ rightPrevMonth() {
648
+ this.rightDate = prevMonth(this.rightDate);
649
+ },
667
650
 
668
- resetView() {
669
- // NOTE: this is a hack to reset {min, max}Date on picker open.
670
- // TODO: correct way of doing so is to refactor {min, max}Date to be dependent on value and internal selection state
671
- // an alternative would be resetView whenever picker becomes visible, should also investigate date-panel's resetView
672
- if (this.minDate && this.maxDate == null) this.rangeState.selecting = false;
673
- this.minDate = this.value && isDate(this.value[0]) ? new Date(this.value[0]) : null;
674
- this.maxDate = this.value && isDate(this.value[0]) ? new Date(this.value[1]) : null;
651
+ handleConfirm(visible = false) {
652
+ if (this.isValidValue([this.minDate, this.maxDate])) {
653
+ this.$emit('pick', [this.minDate, this.maxDate], visible);
675
654
  }
676
655
  },
677
656
 
678
- components: { TimePicker, DateTable, ElInput, ElButton }
679
- };
657
+ isValidValue(value) {
658
+ return Array.isArray(value) &&
659
+ value && value[0] && value[1] &&
660
+ isDate(value[0]) && isDate(value[1]) &&
661
+ value[0].getTime() <= value[1].getTime() && (
662
+ typeof this.disabledDate === 'function'
663
+ ? !this.disabledDate(value[0]) && !this.disabledDate(value[1])
664
+ : true
665
+ );
666
+ },
667
+
668
+ resetView() {
669
+ // NOTE: this is a hack to reset {min, max}Date on picker open.
670
+ // TODO: correct way of doing so is to refactor {min, max}Date to be dependent on value and internal selection state
671
+ // an alternative would be resetView whenever picker becomes visible, should also investigate date-panel's resetView
672
+ if (this.minDate && this.maxDate == null) this.rangeState.selecting = false;
673
+ this.minDate = this.value && isDate(this.value[0]) ? new Date(this.value[0]) : null;
674
+ this.maxDate = this.value && isDate(this.value[0]) ? new Date(this.value[1]) : null;
675
+ }
676
+ },
677
+
678
+ components: { TimePicker, DateTable, ElInput, ElButton }
679
+ };
680
680
  </script>