cbvirtua 1.0.37 → 1.0.39

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 (473) hide show
  1. package/package.json +1 -1
  2. package/src/packages/alert/index.js +8 -0
  3. package/src/packages/alert/src/main.vue +94 -0
  4. package/src/packages/aside/index.js +8 -0
  5. package/src/packages/aside/src/main.vue +20 -0
  6. package/src/packages/autocomplete/index.js +8 -0
  7. package/src/packages/autocomplete/src/autocomplete-suggestions.vue +76 -0
  8. package/src/packages/autocomplete/src/autocomplete.vue +285 -0
  9. package/src/packages/avatar/index.js +8 -0
  10. package/src/packages/avatar/src/main.vue +107 -0
  11. package/src/packages/backtop/index.js +8 -0
  12. package/src/packages/backtop/src/main.vue +110 -0
  13. package/src/packages/badge/index.js +8 -0
  14. package/src/packages/badge/src/main.vue +53 -0
  15. package/src/packages/breadcrumb/index.js +8 -0
  16. package/src/packages/breadcrumb/src/breadcrumb-item.vue +41 -0
  17. package/src/packages/breadcrumb/src/breadcrumb.vue +34 -0
  18. package/src/packages/breadcrumb-item/index.js +8 -0
  19. package/src/packages/button/index.js +8 -0
  20. package/src/packages/button/src/button-group.vue +10 -0
  21. package/src/packages/button/src/button.vue +78 -0
  22. package/src/packages/button-group/index.js +8 -0
  23. package/src/packages/calendar/index.js +8 -0
  24. package/src/packages/calendar/src/date-table.vue +200 -0
  25. package/src/packages/calendar/src/main.vue +280 -0
  26. package/src/packages/card/index.js +8 -0
  27. package/src/packages/card/src/main.vue +23 -0
  28. package/src/packages/carousel/index.js +8 -0
  29. package/src/packages/carousel/src/item.vue +138 -0
  30. package/src/packages/carousel/src/main.vue +315 -0
  31. package/src/packages/carousel-item/index.js +8 -0
  32. package/src/packages/cascader/index.js +8 -0
  33. package/src/packages/cascader/src/cascader.vue +663 -0
  34. package/src/packages/cascader-panel/index.js +8 -0
  35. package/src/packages/cascader-panel/src/cascader-menu.vue +138 -0
  36. package/src/packages/cascader-panel/src/cascader-node.vue +246 -0
  37. package/src/packages/cascader-panel/src/cascader-panel.vue +391 -0
  38. package/src/packages/cascader-panel/src/node.js +166 -0
  39. package/src/packages/cascader-panel/src/store.js +58 -0
  40. package/src/packages/checkbox/index.js +8 -0
  41. package/src/packages/checkbox/src/checkbox-button.vue +199 -0
  42. package/src/packages/checkbox/src/checkbox-group.vue +48 -0
  43. package/src/packages/checkbox/src/checkbox.vue +222 -0
  44. package/src/packages/checkbox-button/index.js +8 -0
  45. package/src/packages/checkbox-group/index.js +8 -0
  46. package/src/packages/col/index.js +9 -0
  47. package/src/packages/col/src/col.js +71 -0
  48. package/src/packages/collapse/index.js +9 -0
  49. package/src/packages/collapse/src/collapse-item.vue +114 -0
  50. package/src/packages/collapse/src/collapse.vue +73 -0
  51. package/src/packages/collapse-item/index.js +8 -0
  52. package/src/packages/color-picker/index.js +8 -0
  53. package/src/packages/color-picker/src/color.js +317 -0
  54. package/src/packages/color-picker/src/components/alpha-slider.vue +132 -0
  55. package/src/packages/color-picker/src/components/hue-slider.vue +123 -0
  56. package/src/packages/color-picker/src/components/picker-dropdown.vue +121 -0
  57. package/src/packages/color-picker/src/components/predefine.vue +61 -0
  58. package/src/packages/color-picker/src/components/sv-panel.vue +100 -0
  59. package/src/packages/color-picker/src/draggable.js +36 -0
  60. package/src/packages/color-picker/src/main.vue +188 -0
  61. package/src/packages/container/index.js +8 -0
  62. package/src/packages/container/src/main.vue +33 -0
  63. package/src/packages/date-picker/index.js +8 -0
  64. package/src/packages/date-picker/src/basic/date-table.vue +441 -0
  65. package/src/packages/date-picker/src/basic/month-table.vue +269 -0
  66. package/src/packages/date-picker/src/basic/time-spinner.vue +304 -0
  67. package/src/packages/date-picker/src/basic/year-table.vue +111 -0
  68. package/src/packages/date-picker/src/panel/date-range.vue +680 -0
  69. package/src/packages/date-picker/src/panel/date.vue +609 -0
  70. package/src/packages/date-picker/src/panel/month-range.vue +289 -0
  71. package/src/packages/date-picker/src/panel/time-range.vue +248 -0
  72. package/src/packages/date-picker/src/panel/time-select.vue +178 -0
  73. package/src/packages/date-picker/src/panel/time.vue +186 -0
  74. package/src/packages/date-picker/src/picker/date-picker.js +43 -0
  75. package/src/packages/date-picker/src/picker/time-picker.js +39 -0
  76. package/src/packages/date-picker/src/picker/time-select.js +21 -0
  77. package/src/packages/date-picker/src/picker.vue +956 -0
  78. package/src/packages/descriptions/index.js +8 -0
  79. package/src/packages/descriptions/src/descriptions-item.js +30 -0
  80. package/src/packages/descriptions/src/descriptions-row.js +116 -0
  81. package/src/packages/descriptions/src/index.js +180 -0
  82. package/src/packages/descriptions-item/index.js +8 -0
  83. package/src/packages/dialog/index.js +8 -0
  84. package/src/packages/dialog/src/component.vue +212 -0
  85. package/src/packages/divider/index.js +8 -0
  86. package/src/packages/divider/src/main.vue +37 -0
  87. package/src/packages/drawer/index.js +8 -0
  88. package/src/packages/drawer/src/main.vue +205 -0
  89. package/src/packages/dropdown/index.js +8 -0
  90. package/src/packages/dropdown/src/dropdown-item.vue +37 -0
  91. package/src/packages/dropdown/src/dropdown-menu.vue +63 -0
  92. package/src/packages/dropdown/src/dropdown.vue +293 -0
  93. package/src/packages/dropdown-item/index.js +8 -0
  94. package/src/packages/dropdown-menu/index.js +8 -0
  95. package/src/packages/empty/index.js +7 -0
  96. package/src/packages/empty/src/img-empty.vue +132 -0
  97. package/src/packages/empty/src/index.vue +50 -0
  98. package/src/packages/footer/index.js +8 -0
  99. package/src/packages/footer/src/main.vue +20 -0
  100. package/src/packages/form/index.js +8 -0
  101. package/src/packages/form/src/form-item.vue +324 -0
  102. package/src/packages/form/src/form.vue +182 -0
  103. package/src/packages/form/src/label-wrap.vue +78 -0
  104. package/src/packages/form-item/index.js +8 -0
  105. package/src/packages/header/index.js +8 -0
  106. package/src/packages/header/src/main.vue +20 -0
  107. package/src/packages/icon/index.js +8 -0
  108. package/src/packages/icon/src/icon.vue +13 -0
  109. package/src/packages/image/index.js +8 -0
  110. package/src/packages/image/src/image-viewer.vue +330 -0
  111. package/src/packages/image/src/main.vue +249 -0
  112. package/src/packages/infinite-scroll/index.js +8 -0
  113. package/src/packages/infinite-scroll/src/main.js +150 -0
  114. package/src/packages/input/index.js +8 -0
  115. package/src/packages/input/src/calcTextareaHeight.js +104 -0
  116. package/src/packages/input/src/input.vue +440 -0
  117. package/src/packages/input-number/index.js +8 -0
  118. package/src/packages/input-number/src/input-number.vue +283 -0
  119. package/src/packages/link/index.js +8 -0
  120. package/src/packages/link/src/main.vue +53 -0
  121. package/src/packages/loading/index.js +11 -0
  122. package/src/packages/loading/src/directive.js +133 -0
  123. package/src/packages/loading/src/index.js +106 -0
  124. package/src/packages/loading/src/loading.vue +41 -0
  125. package/src/packages/main/index.js +8 -0
  126. package/src/packages/main/src/main.vue +12 -0
  127. package/src/packages/menu/index.js +8 -0
  128. package/src/packages/menu/src/menu-item-group.vue +45 -0
  129. package/src/packages/menu/src/menu-item.vue +112 -0
  130. package/src/packages/menu/src/menu-mixin.js +44 -0
  131. package/src/packages/menu/src/menu.vue +325 -0
  132. package/src/packages/menu/src/submenu.vue +349 -0
  133. package/src/packages/menu-item/index.js +8 -0
  134. package/src/packages/menu-item-group/index.js +8 -0
  135. package/src/packages/message/index.js +2 -0
  136. package/src/packages/message/src/main.js +91 -0
  137. package/src/packages/message/src/main.vue +117 -0
  138. package/src/packages/message-box/index.js +2 -0
  139. package/src/packages/message-box/src/main.js +216 -0
  140. package/src/packages/message-box/src/main.vue +332 -0
  141. package/src/packages/notification/index.js +2 -0
  142. package/src/packages/notification/src/main.js +94 -0
  143. package/src/packages/notification/src/main.vue +152 -0
  144. package/src/packages/option/index.js +8 -0
  145. package/src/packages/option-group/index.js +8 -0
  146. package/src/packages/page-header/index.js +8 -0
  147. package/src/packages/page-header/src/main.vue +30 -0
  148. package/src/packages/pagination/index.js +8 -0
  149. package/src/packages/pagination/src/pager.vue +163 -0
  150. package/src/packages/pagination/src/pagination.js +386 -0
  151. package/src/packages/popconfirm/index.js +8 -0
  152. package/src/packages/popconfirm/src/main.vue +104 -0
  153. package/src/packages/popover/index.js +14 -0
  154. package/src/packages/popover/src/directive.js +20 -0
  155. package/src/packages/popover/src/main.vue +237 -0
  156. package/src/packages/progress/index.js +8 -0
  157. package/src/packages/progress/src/progress.vue +235 -0
  158. package/src/packages/radio/index.js +8 -0
  159. package/src/packages/radio/src/radio-button.vue +115 -0
  160. package/src/packages/radio/src/radio-group.vue +113 -0
  161. package/src/packages/radio/src/radio.vue +134 -0
  162. package/src/packages/radio-button/index.js +8 -0
  163. package/src/packages/radio-group/index.js +8 -0
  164. package/src/packages/rate/index.js +8 -0
  165. package/src/packages/rate/src/main.vue +348 -0
  166. package/src/packages/result/index.js +8 -0
  167. package/src/packages/result/src/icon-error.vue +13 -0
  168. package/src/packages/result/src/icon-info.vue +13 -0
  169. package/src/packages/result/src/icon-success.vue +13 -0
  170. package/src/packages/result/src/icon-warning.vue +13 -0
  171. package/src/packages/result/src/index.vue +65 -0
  172. package/src/packages/row/index.js +9 -0
  173. package/src/packages/row/src/row.js +44 -0
  174. package/src/packages/scrollbar/index.js +8 -0
  175. package/src/packages/scrollbar/src/bar.js +92 -0
  176. package/src/packages/scrollbar/src/main.js +130 -0
  177. package/src/packages/scrollbar/src/util.js +34 -0
  178. package/src/packages/select/index.js +8 -0
  179. package/src/packages/select/src/navigation-mixin.js +54 -0
  180. package/src/packages/select/src/option-group.vue +60 -0
  181. package/src/packages/select/src/option.vue +168 -0
  182. package/src/packages/select/src/select-dropdown.vue +74 -0
  183. package/src/packages/select/src/select.vue +900 -0
  184. package/src/packages/skeleton/index.js +8 -0
  185. package/src/packages/skeleton/src/img-placeholder.vue +16 -0
  186. package/src/packages/skeleton/src/index.vue +76 -0
  187. package/src/packages/skeleton/src/item.vue +22 -0
  188. package/src/packages/skeleton-item/index.js +8 -0
  189. package/src/packages/slider/index.js +8 -0
  190. package/src/packages/slider/src/button.vue +238 -0
  191. package/src/packages/slider/src/main.vue +427 -0
  192. package/src/packages/slider/src/marker.js +18 -0
  193. package/src/packages/spinner/index.js +8 -0
  194. package/src/packages/spinner/src/spinner.vue +27 -0
  195. package/src/packages/statistic/index.js +8 -0
  196. package/src/packages/statistic/src/main.vue +204 -0
  197. package/src/packages/step/index.js +8 -0
  198. package/src/packages/steps/README.md +69 -0
  199. package/src/packages/steps/index.js +8 -0
  200. package/src/packages/steps/src/step.vue +184 -0
  201. package/src/packages/steps/src/steps.vue +68 -0
  202. package/src/packages/submenu/index.js +8 -0
  203. package/src/packages/switch/index.js +9 -0
  204. package/src/packages/switch/src/component.vue +174 -0
  205. package/src/packages/tab-pane/index.js +8 -0
  206. package/src/packages/table/index.js +8 -0
  207. package/src/packages/table/src/config.js +124 -0
  208. package/src/packages/table/src/dropdown.js +28 -0
  209. package/src/packages/table/src/filter-panel.vue +194 -0
  210. package/src/packages/table/src/layout-observer.js +68 -0
  211. package/src/packages/table/src/store/current.js +76 -0
  212. package/src/packages/table/src/store/expand.js +65 -0
  213. package/src/packages/table/src/store/helper.js +41 -0
  214. package/src/packages/table/src/store/index.js +147 -0
  215. package/src/packages/table/src/store/tree.js +209 -0
  216. package/src/packages/table/src/store/watcher.js +381 -0
  217. package/src/packages/table/src/table-body.js +469 -0
  218. package/src/packages/table/src/table-column.js +319 -0
  219. package/src/packages/table/src/table-footer.js +153 -0
  220. package/src/packages/table/src/table-header.js +511 -0
  221. package/src/packages/table/src/table-layout.js +249 -0
  222. package/src/packages/table/src/table-row.js +101 -0
  223. package/src/packages/table/src/table.vue +712 -0
  224. package/src/packages/table/src/util.js +273 -0
  225. package/src/packages/table-column/index.js +8 -0
  226. package/src/packages/tabs/index.js +8 -0
  227. package/src/packages/tabs/src/tab-bar.vue +57 -0
  228. package/src/packages/tabs/src/tab-nav.vue +294 -0
  229. package/src/packages/tabs/src/tab-pane.vue +56 -0
  230. package/src/packages/tabs/src/tabs.vue +191 -0
  231. package/src/packages/tag/index.js +8 -0
  232. package/src/packages/tag/src/tag.vue +58 -0
  233. package/src/packages/theme-chalk/README.md +33 -0
  234. package/src/packages/theme-chalk/gulpfile.js +25 -0
  235. package/src/packages/theme-chalk/package.json +35 -0
  236. package/src/packages/theme-chalk/src/alert.scss +147 -0
  237. package/src/packages/theme-chalk/src/aside.scss +7 -0
  238. package/src/packages/theme-chalk/src/autocomplete.scss +80 -0
  239. package/src/packages/theme-chalk/src/avatar.scss +51 -0
  240. package/src/packages/theme-chalk/src/backtop.scss +22 -0
  241. package/src/packages/theme-chalk/src/badge.scss +57 -0
  242. package/src/packages/theme-chalk/src/base.scss +2 -0
  243. package/src/packages/theme-chalk/src/breadcrumb-item.scss +0 -0
  244. package/src/packages/theme-chalk/src/breadcrumb.scss +55 -0
  245. package/src/packages/theme-chalk/src/button-group.scss +0 -0
  246. package/src/packages/theme-chalk/src/button.scss +262 -0
  247. package/src/packages/theme-chalk/src/calendar.scss +79 -0
  248. package/src/packages/theme-chalk/src/card.scss +32 -0
  249. package/src/packages/theme-chalk/src/carousel-item.scss +50 -0
  250. package/src/packages/theme-chalk/src/carousel.scss +161 -0
  251. package/src/packages/theme-chalk/src/cascader-panel.scss +120 -0
  252. package/src/packages/theme-chalk/src/cascader.scss +182 -0
  253. package/src/packages/theme-chalk/src/checkbox-button.scss +0 -0
  254. package/src/packages/theme-chalk/src/checkbox-group.scss +0 -0
  255. package/src/packages/theme-chalk/src/checkbox.scss +359 -0
  256. package/src/packages/theme-chalk/src/col.scss +156 -0
  257. package/src/packages/theme-chalk/src/collapse-item.scss +0 -0
  258. package/src/packages/theme-chalk/src/collapse.scss +63 -0
  259. package/src/packages/theme-chalk/src/color-picker.scss +384 -0
  260. package/src/packages/theme-chalk/src/common/popup.scss +42 -0
  261. package/src/packages/theme-chalk/src/common/transition.scss +99 -0
  262. package/src/packages/theme-chalk/src/common/var.scss +1028 -0
  263. package/src/packages/theme-chalk/src/container.scss +14 -0
  264. package/src/packages/theme-chalk/src/date-picker/date-picker.scss +97 -0
  265. package/src/packages/theme-chalk/src/date-picker/date-range-picker.scss +101 -0
  266. package/src/packages/theme-chalk/src/date-picker/date-table.scss +151 -0
  267. package/src/packages/theme-chalk/src/date-picker/month-table.scss +82 -0
  268. package/src/packages/theme-chalk/src/date-picker/picker-panel.scss +117 -0
  269. package/src/packages/theme-chalk/src/date-picker/picker.scss +197 -0
  270. package/src/packages/theme-chalk/src/date-picker/time-picker.scss +85 -0
  271. package/src/packages/theme-chalk/src/date-picker/time-range-picker.scss +31 -0
  272. package/src/packages/theme-chalk/src/date-picker/time-spinner.scss +110 -0
  273. package/src/packages/theme-chalk/src/date-picker/year-table.scss +51 -0
  274. package/src/packages/theme-chalk/src/date-picker.scss +12 -0
  275. package/src/packages/theme-chalk/src/descriptions-item.scss +42 -0
  276. package/src/packages/theme-chalk/src/descriptions.scss +111 -0
  277. package/src/packages/theme-chalk/src/dialog.scss +123 -0
  278. package/src/packages/theme-chalk/src/display.scss +12 -0
  279. package/src/packages/theme-chalk/src/divider.scss +47 -0
  280. package/src/packages/theme-chalk/src/drawer.scss +219 -0
  281. package/src/packages/theme-chalk/src/dropdown-item.scss +0 -0
  282. package/src/packages/theme-chalk/src/dropdown-menu.scss +0 -0
  283. package/src/packages/theme-chalk/src/dropdown.scss +182 -0
  284. package/src/packages/theme-chalk/src/empty.scss +45 -0
  285. package/src/packages/theme-chalk/src/fonts/element-icons.ttf +0 -0
  286. package/src/packages/theme-chalk/src/fonts/element-icons.woff +0 -0
  287. package/src/packages/theme-chalk/src/footer.scss +8 -0
  288. package/src/packages/theme-chalk/src/form-item.scss +0 -0
  289. package/src/packages/theme-chalk/src/form.scss +167 -0
  290. package/src/packages/theme-chalk/src/header.scss +8 -0
  291. package/src/packages/theme-chalk/src/icon.scss +1167 -0
  292. package/src/packages/theme-chalk/src/image.scss +179 -0
  293. package/src/packages/theme-chalk/src/index.scss +87 -0
  294. package/src/packages/theme-chalk/src/infinite-scroll.scss +0 -0
  295. package/src/packages/theme-chalk/src/infiniteScroll.scss +0 -0
  296. package/src/packages/theme-chalk/src/input-number.scss +180 -0
  297. package/src/packages/theme-chalk/src/input.scss +360 -0
  298. package/src/packages/theme-chalk/src/link.scss +81 -0
  299. package/src/packages/theme-chalk/src/loading.scss +96 -0
  300. package/src/packages/theme-chalk/src/main.scss +12 -0
  301. package/src/packages/theme-chalk/src/menu-item-group.scss +0 -0
  302. package/src/packages/theme-chalk/src/menu-item.scss +0 -0
  303. package/src/packages/theme-chalk/src/menu.scss +289 -0
  304. package/src/packages/theme-chalk/src/message-box.scss +226 -0
  305. package/src/packages/theme-chalk/src/message.scss +120 -0
  306. package/src/packages/theme-chalk/src/mixins/_button.scss +81 -0
  307. package/src/packages/theme-chalk/src/mixins/config.scss +4 -0
  308. package/src/packages/theme-chalk/src/mixins/function.scss +44 -0
  309. package/src/packages/theme-chalk/src/mixins/mixins.scss +190 -0
  310. package/src/packages/theme-chalk/src/mixins/utils.scss +39 -0
  311. package/src/packages/theme-chalk/src/notification.scss +99 -0
  312. package/src/packages/theme-chalk/src/option-group.scss +42 -0
  313. package/src/packages/theme-chalk/src/option.scss +36 -0
  314. package/src/packages/theme-chalk/src/page-header.scss +41 -0
  315. package/src/packages/theme-chalk/src/pagination.scss +295 -0
  316. package/src/packages/theme-chalk/src/popconfirm.scss +16 -0
  317. package/src/packages/theme-chalk/src/popover.scss +40 -0
  318. package/src/packages/theme-chalk/src/popper.scss +101 -0
  319. package/src/packages/theme-chalk/src/progress.scss +141 -0
  320. package/src/packages/theme-chalk/src/radio-button.scss +113 -0
  321. package/src/packages/theme-chalk/src/radio-group.scss +9 -0
  322. package/src/packages/theme-chalk/src/radio.scss +199 -0
  323. package/src/packages/theme-chalk/src/rate.scss +49 -0
  324. package/src/packages/theme-chalk/src/reset.scss +79 -0
  325. package/src/packages/theme-chalk/src/result.scss +61 -0
  326. package/src/packages/theme-chalk/src/row.scss +43 -0
  327. package/src/packages/theme-chalk/src/scrollbar.scss +72 -0
  328. package/src/packages/theme-chalk/src/select-dropdown.scss +62 -0
  329. package/src/packages/theme-chalk/src/select.scss +152 -0
  330. package/src/packages/theme-chalk/src/skeleton-item.scss +84 -0
  331. package/src/packages/theme-chalk/src/skeleton.scss +40 -0
  332. package/src/packages/theme-chalk/src/slider.scss +250 -0
  333. package/src/packages/theme-chalk/src/spinner.scss +44 -0
  334. package/src/packages/theme-chalk/src/statistic.scss +38 -0
  335. package/src/packages/theme-chalk/src/step.scss +317 -0
  336. package/src/packages/theme-chalk/src/steps.scss +20 -0
  337. package/src/packages/theme-chalk/src/submenu.scss +0 -0
  338. package/src/packages/theme-chalk/src/switch.scss +116 -0
  339. package/src/packages/theme-chalk/src/tab-pane.scss +0 -0
  340. package/src/packages/theme-chalk/src/table-column.scss +97 -0
  341. package/src/packages/theme-chalk/src/table.scss +564 -0
  342. package/src/packages/theme-chalk/src/tabs.scss +602 -0
  343. package/src/packages/theme-chalk/src/tag.scss +163 -0
  344. package/src/packages/theme-chalk/src/time-picker.scss +8 -0
  345. package/src/packages/theme-chalk/src/time-select.scss +37 -0
  346. package/src/packages/theme-chalk/src/timeline-item.scss +86 -0
  347. package/src/packages/theme-chalk/src/timeline.scss +14 -0
  348. package/src/packages/theme-chalk/src/tooltip.scss +141 -0
  349. package/src/packages/theme-chalk/src/transfer.scss +227 -0
  350. package/src/packages/theme-chalk/src/tree.scss +123 -0
  351. package/src/packages/theme-chalk/src/upload.scss +603 -0
  352. package/src/packages/time-picker/index.js +8 -0
  353. package/src/packages/time-select/index.js +8 -0
  354. package/src/packages/timeline/index.js +8 -0
  355. package/src/packages/timeline/src/item.vue +73 -0
  356. package/src/packages/timeline/src/main.vue +33 -0
  357. package/src/packages/timeline-item/index.js +8 -0
  358. package/src/packages/tooltip/index.js +8 -0
  359. package/src/packages/tooltip/src/main.js +242 -0
  360. package/src/packages/transfer/index.js +8 -0
  361. package/src/packages/transfer/src/main.vue +231 -0
  362. package/src/packages/transfer/src/transfer-panel.vue +251 -0
  363. package/src/packages/tree/index.js +8 -0
  364. package/src/packages/tree/src/model/node.js +484 -0
  365. package/src/packages/tree/src/model/tree-store.js +340 -0
  366. package/src/packages/tree/src/model/util.js +27 -0
  367. package/src/packages/tree/src/tree-node.vue +279 -0
  368. package/src/packages/tree/src/tree.vue +496 -0
  369. package/src/packages/upload/index.js +8 -0
  370. package/src/packages/upload/src/ajax.js +85 -0
  371. package/src/packages/upload/src/index.vue +338 -0
  372. package/src/packages/upload/src/upload-dragger.vue +70 -0
  373. package/src/packages/upload/src/upload-list.vue +105 -0
  374. package/src/packages/upload/src/upload.vue +211 -0
  375. package/src/src/directives/mousewheel.js +18 -0
  376. package/src/src/directives/repeat-click.js +26 -0
  377. package/src/src/index.js +309 -0
  378. package/src/src/locale/format.js +46 -0
  379. package/src/src/locale/index.js +48 -0
  380. package/src/src/locale/lang/af-ZA.js +123 -0
  381. package/src/src/locale/lang/ar.js +122 -0
  382. package/src/src/locale/lang/az.js +126 -0
  383. package/src/src/locale/lang/bg.js +123 -0
  384. package/src/src/locale/lang/bn.js +126 -0
  385. package/src/src/locale/lang/ca.js +122 -0
  386. package/src/src/locale/lang/cs-CZ.js +125 -0
  387. package/src/src/locale/lang/da.js +122 -0
  388. package/src/src/locale/lang/de.js +124 -0
  389. package/src/src/locale/lang/ee.js +123 -0
  390. package/src/src/locale/lang/el.js +123 -0
  391. package/src/src/locale/lang/en.js +123 -0
  392. package/src/src/locale/lang/eo.js +123 -0
  393. package/src/src/locale/lang/es.js +122 -0
  394. package/src/src/locale/lang/eu.js +123 -0
  395. package/src/src/locale/lang/fa.js +123 -0
  396. package/src/src/locale/lang/fi.js +123 -0
  397. package/src/src/locale/lang/fr.js +122 -0
  398. package/src/src/locale/lang/he.js +123 -0
  399. package/src/src/locale/lang/hr.js +123 -0
  400. package/src/src/locale/lang/hu.js +122 -0
  401. package/src/src/locale/lang/hy-AM.js +123 -0
  402. package/src/src/locale/lang/id.js +123 -0
  403. package/src/src/locale/lang/is.js +124 -0
  404. package/src/src/locale/lang/it.js +122 -0
  405. package/src/src/locale/lang/ja.js +123 -0
  406. package/src/src/locale/lang/kg.js +123 -0
  407. package/src/src/locale/lang/km.js +123 -0
  408. package/src/src/locale/lang/ko.js +123 -0
  409. package/src/src/locale/lang/ku.js +123 -0
  410. package/src/src/locale/lang/kz.js +123 -0
  411. package/src/src/locale/lang/lo-LA.js +126 -0
  412. package/src/src/locale/lang/lt.js +123 -0
  413. package/src/src/locale/lang/lv.js +123 -0
  414. package/src/src/locale/lang/mn.js +123 -0
  415. package/src/src/locale/lang/ms.js +122 -0
  416. package/src/src/locale/lang/nb-NO.js +122 -0
  417. package/src/src/locale/lang/nl.js +123 -0
  418. package/src/src/locale/lang/pl.js +123 -0
  419. package/src/src/locale/lang/pt-br.js +123 -0
  420. package/src/src/locale/lang/pt.js +123 -0
  421. package/src/src/locale/lang/ro.js +123 -0
  422. package/src/src/locale/lang/ru-RU.js +123 -0
  423. package/src/src/locale/lang/si.js +123 -0
  424. package/src/src/locale/lang/sk.js +125 -0
  425. package/src/src/locale/lang/sl.js +123 -0
  426. package/src/src/locale/lang/sr-Latn.js +123 -0
  427. package/src/src/locale/lang/sr.js +123 -0
  428. package/src/src/locale/lang/sv-SE.js +123 -0
  429. package/src/src/locale/lang/sw.js +123 -0
  430. package/src/src/locale/lang/ta.js +122 -0
  431. package/src/src/locale/lang/th.js +123 -0
  432. package/src/src/locale/lang/tk.js +123 -0
  433. package/src/src/locale/lang/tr-TR.js +123 -0
  434. package/src/src/locale/lang/ua.js +123 -0
  435. package/src/src/locale/lang/ug-CN.js +123 -0
  436. package/src/src/locale/lang/uz-UZ.js +123 -0
  437. package/src/src/locale/lang/vi.js +123 -0
  438. package/src/src/locale/lang/zh-CN.js +123 -0
  439. package/src/src/locale/lang/zh-TW.js +123 -0
  440. package/src/src/mixins/emitter.js +33 -0
  441. package/src/src/mixins/focus.js +9 -0
  442. package/src/src/mixins/locale.js +9 -0
  443. package/src/src/mixins/migrating.js +54 -0
  444. package/src/src/transitions/collapse-transition.js +77 -0
  445. package/src/src/utils/after-leave.js +27 -0
  446. package/src/src/utils/aria-dialog.js +90 -0
  447. package/src/src/utils/aria-utils.js +122 -0
  448. package/src/src/utils/clickoutside.js +76 -0
  449. package/src/src/utils/date-util.js +282 -0
  450. package/src/src/utils/date.js +368 -0
  451. package/src/src/utils/dom.js +227 -0
  452. package/src/src/utils/lodash.js +18075 -0
  453. package/src/src/utils/menu/aria-menubar.js +14 -0
  454. package/src/src/utils/menu/aria-menuitem.js +49 -0
  455. package/src/src/utils/menu/aria-submenu.js +59 -0
  456. package/src/src/utils/merge.js +15 -0
  457. package/src/src/utils/popper.js +1276 -0
  458. package/src/src/utils/popup/index.js +218 -0
  459. package/src/src/utils/popup/popup-manager.js +194 -0
  460. package/src/src/utils/resize-event.js +36 -0
  461. package/src/src/utils/scroll-into-view.js +27 -0
  462. package/src/src/utils/scrollbar-width.js +29 -0
  463. package/src/src/utils/shared.js +7 -0
  464. package/src/src/utils/types.js +40 -0
  465. package/src/src/utils/util.js +245 -0
  466. package/src/src/utils/vdom.js +5 -0
  467. package/src/src/utils/vue-popper.js +198 -0
  468. package/src//346/226/260/345/273/272 /346/226/207/346/234/254/346/226/207/346/241/243.txt" +131 -0
  469. package/.postcssrc.js +0 -18
  470. package/asy.js +0 -32
  471. package/catch.js +0 -176
  472. package/queue.js +0 -125
  473. package/ske.txt +0 -76
@@ -0,0 +1,900 @@
1
+ <template>
2
+ <div
3
+ class="el-select"
4
+ :class="[selectSize ? 'el-select--' + selectSize : '']"
5
+ @click.stop="toggleMenu"
6
+ v-clickoutside="handleClose">
7
+ <div
8
+ class="el-select__tags"
9
+ v-if="multiple"
10
+ ref="tags"
11
+ :style="{ 'max-width': inputWidth - 32 + 'px', width: '100%' }">
12
+ <span v-if="collapseTags && selected.length">
13
+ <el-tag
14
+ :closable="!selectDisabled"
15
+ :size="collapseTagSize"
16
+ :hit="selected[0].hitState"
17
+ type="info"
18
+ @close="deleteTag($event, selected[0])"
19
+ disable-transitions>
20
+ <span class="el-select__tags-text">{{ selected[0].currentLabel }}</span>
21
+ </el-tag>
22
+ <el-tag
23
+ v-if="selected.length > 1"
24
+ :closable="false"
25
+ :size="collapseTagSize"
26
+ type="info"
27
+ disable-transitions>
28
+ <span class="el-select__tags-text">+ {{ selected.length - 1 }}</span>
29
+ </el-tag>
30
+ </span>
31
+ <transition-group @after-leave="resetInputHeight" v-if="!collapseTags">
32
+ <el-tag
33
+ v-for="item in selected"
34
+ :key="getValueKey(item)"
35
+ :closable="!selectDisabled"
36
+ :size="collapseTagSize"
37
+ :hit="item.hitState"
38
+ type="info"
39
+ @close="deleteTag($event, item)"
40
+ disable-transitions>
41
+ <span class="el-select__tags-text">{{ item.currentLabel }}</span>
42
+ </el-tag>
43
+ </transition-group>
44
+
45
+ <input
46
+ type="text"
47
+ class="el-select__input"
48
+ :class="[selectSize ? `is-${ selectSize }` : '']"
49
+ :disabled="selectDisabled"
50
+ :autocomplete="autoComplete || autocomplete"
51
+ @focus="handleFocus"
52
+ @blur="softFocus = false"
53
+ @keyup="managePlaceholder"
54
+ @keydown="resetInputState"
55
+ @keydown.down.prevent="handleNavigate('next')"
56
+ @keydown.up.prevent="handleNavigate('prev')"
57
+ @keydown.enter.prevent="selectOption"
58
+ @keydown.esc.stop.prevent="visible = false"
59
+ @keydown.delete="deletePrevTag"
60
+ @keydown.tab="visible = false"
61
+ @compositionstart="handleComposition"
62
+ @compositionupdate="handleComposition"
63
+ @compositionend="handleComposition"
64
+ v-model="query"
65
+ @input="debouncedQueryChange"
66
+ v-if="filterable"
67
+ :style="{ 'flex-grow': '1', width: inputLength / (inputWidth - 32) + '%', 'max-width': inputWidth - 42 + 'px' }"
68
+ ref="input">
69
+ </div>
70
+ <el-input
71
+ ref="reference"
72
+ v-model="selectedLabel"
73
+ type="text"
74
+ :placeholder="currentPlaceholder"
75
+ :name="name"
76
+ :id="id"
77
+ :autocomplete="autoComplete || autocomplete"
78
+ :size="selectSize"
79
+ :disabled="selectDisabled"
80
+ :readonly="readonly"
81
+ :validate-event="false"
82
+ :class="{ 'is-focus': visible }"
83
+ :tabindex="(multiple && filterable) ? '-1' : null"
84
+ @focus="handleFocus"
85
+ @blur="handleBlur"
86
+ @input="debouncedOnInputChange"
87
+ @keydown.native.down.stop.prevent="handleNavigate('next')"
88
+ @keydown.native.up.stop.prevent="handleNavigate('prev')"
89
+ @keydown.native.enter.prevent="selectOption"
90
+ @keydown.native.esc.stop.prevent="visible = false"
91
+ @keydown.native.tab="visible = false"
92
+ @compositionstart="handleComposition"
93
+ @compositionupdate="handleComposition"
94
+ @compositionend="handleComposition"
95
+ @mouseenter.native="inputHovering = true"
96
+ @mouseleave.native="inputHovering = false">
97
+ <template slot="prefix" v-if="$slots.prefix">
98
+ <slot name="prefix"></slot>
99
+ </template>
100
+ <template slot="suffix">
101
+ <i v-show="!showClose" :class="['el-select__caret', 'el-input__icon', 'el-icon-' + iconClass]"></i>
102
+ <i v-if="showClose" class="el-select__caret el-input__icon el-icon-circle-close" @click="handleClearClick"></i>
103
+ </template>
104
+ </el-input>
105
+ <transition
106
+ name="el-zoom-in-top"
107
+ @before-enter="handleMenuEnter"
108
+ @after-leave="doDestroy">
109
+ <el-select-menu
110
+ ref="popper"
111
+ :append-to-body="popperAppendToBody"
112
+ v-show="visible && emptyText !== false">
113
+ <el-scrollbar
114
+ tag="ul"
115
+ wrap-class="el-select-dropdown__wrap"
116
+ view-class="el-select-dropdown__list"
117
+ ref="scrollbar"
118
+ :class="{ 'is-empty': !allowCreate && query && filteredOptionsCount === 0 }"
119
+ v-show="options.length > 0 && !loading">
120
+ <el-option
121
+ :value="query"
122
+ created
123
+ v-if="showNewOption">
124
+ </el-option>
125
+ <slot></slot>
126
+ </el-scrollbar>
127
+ <template v-if="emptyText && (!allowCreate || loading || (allowCreate && options.length === 0 ))">
128
+ <slot name="empty" v-if="$slots.empty"></slot>
129
+ <p class="el-select-dropdown__empty" v-else>
130
+ {{ emptyText }}
131
+ </p>
132
+ </template>
133
+ </el-select-menu>
134
+ </transition>
135
+ </div>
136
+ </template>
137
+
138
+ <script type="text/babel">
139
+ import Emitter from 'element-ui/src/mixins/emitter';
140
+ import Focus from 'element-ui/src/mixins/focus';
141
+ import Locale from 'element-ui/src/mixins/locale';
142
+ import ElInput from 'element-ui/packages/input';
143
+ import ElSelectMenu from './select-dropdown.vue';
144
+ import ElOption from './option.vue';
145
+ import ElTag from 'element-ui/packages/tag';
146
+ import ElScrollbar from 'element-ui/packages/scrollbar';
147
+ import debounce from 'throttle-debounce/debounce';
148
+ import Clickoutside from 'element-ui/src/utils/clickoutside';
149
+ import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/resize-event';
150
+ import scrollIntoView from 'element-ui/src/utils/scroll-into-view';
151
+ import { getValueByPath, valueEquals, isIE, isEdge } from 'element-ui/src/utils/util';
152
+ import NavigationMixin from './navigation-mixin';
153
+ import { isKorean } from 'element-ui/src/utils/shared';
154
+
155
+ export default {
156
+ mixins: [Emitter, Locale, Focus('reference'), NavigationMixin],
157
+
158
+ name: 'ElSelect',
159
+
160
+ componentName: 'ElSelect',
161
+
162
+ inject: {
163
+ elForm: {
164
+ default: ''
165
+ },
166
+
167
+ elFormItem: {
168
+ default: ''
169
+ }
170
+ },
171
+
172
+ provide() {
173
+ return {
174
+ 'select': this
175
+ };
176
+ },
177
+
178
+ computed: {
179
+ _elFormItemSize() {
180
+ return (this.elFormItem || {}).elFormItemSize;
181
+ },
182
+
183
+ readonly() {
184
+ return !this.filterable || this.multiple || (!isIE() && !isEdge() && !this.visible);
185
+ },
186
+
187
+ showClose() {
188
+ let hasValue = this.multiple
189
+ ? Array.isArray(this.value) && this.value.length > 0
190
+ : this.value !== undefined && this.value !== null && this.value !== '';
191
+ let criteria = this.clearable &&
192
+ !this.selectDisabled &&
193
+ this.inputHovering &&
194
+ hasValue;
195
+ return criteria;
196
+ },
197
+
198
+ iconClass() {
199
+ return this.remote && this.filterable ? '' : (this.visible ? 'arrow-up is-reverse' : 'arrow-up');
200
+ },
201
+
202
+ debounce() {
203
+ return this.remote ? 300 : 0;
204
+ },
205
+
206
+ emptyText() {
207
+ if (this.loading) {
208
+ return this.loadingText || this.t('el.select.loading');
209
+ } else {
210
+ if (this.remote && this.query === '' && this.options.length === 0) return false;
211
+ if (this.filterable && this.query && this.options.length > 0 && this.filteredOptionsCount === 0) {
212
+ return this.noMatchText || this.t('el.select.noMatch');
213
+ }
214
+ if (this.options.length === 0) {
215
+ return this.noDataText || this.t('el.select.noData');
216
+ }
217
+ }
218
+ return null;
219
+ },
220
+
221
+ showNewOption() {
222
+ let hasExistingOption = this.options.filter(option => !option.created)
223
+ .some(option => option.currentLabel === this.query);
224
+ return this.filterable && this.allowCreate && this.query !== '' && !hasExistingOption;
225
+ },
226
+
227
+ selectSize() {
228
+ return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
229
+ },
230
+
231
+ selectDisabled() {
232
+ return this.disabled || (this.elForm || {}).disabled;
233
+ },
234
+
235
+ collapseTagSize() {
236
+ return ['small', 'mini'].indexOf(this.selectSize) > -1
237
+ ? 'mini'
238
+ : 'small';
239
+ },
240
+ propPlaceholder() {
241
+ return typeof this.placeholder !== 'undefined' ? this.placeholder : this.t('el.select.placeholder');
242
+ }
243
+ },
244
+
245
+ components: {
246
+ ElInput,
247
+ ElSelectMenu,
248
+ ElOption,
249
+ ElTag,
250
+ ElScrollbar
251
+ },
252
+
253
+ directives: { Clickoutside },
254
+
255
+ props: {
256
+ name: String,
257
+ id: String,
258
+ value: {
259
+ required: true
260
+ },
261
+ autocomplete: {
262
+ type: String,
263
+ default: 'off'
264
+ },
265
+ /** @Deprecated in next major version */
266
+ autoComplete: {
267
+ type: String,
268
+ validator(val) {
269
+ process.env.NODE_ENV !== 'production' &&
270
+ console.warn('[Element Warn][Select]\'auto-complete\' property will be deprecated in next major version. please use \'autocomplete\' instead.');
271
+ return true;
272
+ }
273
+ },
274
+ automaticDropdown: Boolean,
275
+ size: String,
276
+ disabled: Boolean,
277
+ clearable: Boolean,
278
+ filterable: Boolean,
279
+ allowCreate: Boolean,
280
+ loading: Boolean,
281
+ popperClass: String,
282
+ remote: Boolean,
283
+ loadingText: String,
284
+ noMatchText: String,
285
+ noDataText: String,
286
+ remoteMethod: Function,
287
+ filterMethod: Function,
288
+ multiple: Boolean,
289
+ multipleLimit: {
290
+ type: Number,
291
+ default: 0
292
+ },
293
+ placeholder: {
294
+ type: String,
295
+ required: false
296
+ },
297
+ defaultFirstOption: Boolean,
298
+ reserveKeyword: Boolean,
299
+ valueKey: {
300
+ type: String,
301
+ default: 'value'
302
+ },
303
+ collapseTags: Boolean,
304
+ popperAppendToBody: {
305
+ type: Boolean,
306
+ default: true
307
+ }
308
+ },
309
+
310
+ data() {
311
+ return {
312
+ options: [],
313
+ cachedOptions: [],
314
+ createdLabel: null,
315
+ createdSelected: false,
316
+ selected: this.multiple ? [] : {},
317
+ inputLength: 20,
318
+ inputWidth: 0,
319
+ initialInputHeight: 0,
320
+ cachedPlaceHolder: '',
321
+ optionsCount: 0,
322
+ filteredOptionsCount: 0,
323
+ visible: false,
324
+ softFocus: false,
325
+ selectedLabel: '',
326
+ hoverIndex: -1,
327
+ query: '',
328
+ previousQuery: null,
329
+ inputHovering: false,
330
+ currentPlaceholder: '',
331
+ menuVisibleOnFocus: false,
332
+ isOnComposition: false,
333
+ isSilentBlur: false
334
+ };
335
+ },
336
+
337
+ watch: {
338
+ selectDisabled() {
339
+ this.$nextTick(() => {
340
+ this.resetInputHeight();
341
+ });
342
+ },
343
+
344
+ propPlaceholder(val) {
345
+ this.cachedPlaceHolder = this.currentPlaceholder = val;
346
+ },
347
+
348
+ value(val, oldVal) {
349
+ if (this.multiple) {
350
+ this.resetInputHeight();
351
+ if ((val && val.length > 0) || (this.$refs.input && this.query !== '')) {
352
+ this.currentPlaceholder = '';
353
+ } else {
354
+ this.currentPlaceholder = this.cachedPlaceHolder;
355
+ }
356
+ if (this.filterable && !this.reserveKeyword) {
357
+ this.query = '';
358
+ this.handleQueryChange(this.query);
359
+ }
360
+ }
361
+ this.setSelected();
362
+ if (this.filterable && !this.multiple) {
363
+ this.inputLength = 20;
364
+ }
365
+ if (!valueEquals(val, oldVal)) {
366
+ this.dispatch('ElFormItem', 'el.form.change', val);
367
+ }
368
+ },
369
+
370
+ visible(val) {
371
+ if (!val) {
372
+ this.broadcast('ElSelectDropdown', 'destroyPopper');
373
+ if (this.$refs.input) {
374
+ this.$refs.input.blur();
375
+ }
376
+ this.query = '';
377
+ this.previousQuery = null;
378
+ this.selectedLabel = '';
379
+ this.inputLength = 20;
380
+ this.menuVisibleOnFocus = false;
381
+ this.resetHoverIndex();
382
+ this.$nextTick(() => {
383
+ if (this.$refs.input &&
384
+ this.$refs.input.value === '' &&
385
+ this.selected.length === 0) {
386
+ this.currentPlaceholder = this.cachedPlaceHolder;
387
+ }
388
+ });
389
+ if (!this.multiple) {
390
+ if (this.selected) {
391
+ if (this.filterable && this.allowCreate &&
392
+ this.createdSelected && this.createdLabel) {
393
+ this.selectedLabel = this.createdLabel;
394
+ } else {
395
+ this.selectedLabel = this.selected.currentLabel;
396
+ }
397
+ if (this.filterable) this.query = this.selectedLabel;
398
+ }
399
+
400
+ if (this.filterable) {
401
+ this.currentPlaceholder = this.cachedPlaceHolder;
402
+ }
403
+ }
404
+ } else {
405
+ this.broadcast('ElSelectDropdown', 'updatePopper');
406
+ if (this.filterable) {
407
+ this.query = this.remote ? '' : this.selectedLabel;
408
+ this.handleQueryChange(this.query);
409
+ if (this.multiple) {
410
+ this.$refs.input.focus();
411
+ } else {
412
+ if (!this.remote) {
413
+ this.broadcast('ElOption', 'queryChange', '');
414
+ this.broadcast('ElOptionGroup', 'queryChange');
415
+ }
416
+
417
+ if (this.selectedLabel) {
418
+ this.currentPlaceholder = this.selectedLabel;
419
+ this.selectedLabel = '';
420
+ }
421
+ }
422
+ }
423
+ }
424
+ this.$emit('visible-change', val);
425
+ },
426
+
427
+ options() {
428
+ if (this.$isServer) return;
429
+ this.$nextTick(() => {
430
+ this.broadcast('ElSelectDropdown', 'updatePopper');
431
+ });
432
+ if (this.multiple) {
433
+ this.resetInputHeight();
434
+ }
435
+ let inputs = this.$el.querySelectorAll('input');
436
+ if ([].indexOf.call(inputs, document.activeElement) === -1) {
437
+ this.setSelected();
438
+ }
439
+ if (this.defaultFirstOption && (this.filterable || this.remote) && this.filteredOptionsCount) {
440
+ this.checkDefaultFirstOption();
441
+ }
442
+ }
443
+ },
444
+
445
+ methods: {
446
+ handleNavigate(direction) {
447
+ if (this.isOnComposition) return;
448
+
449
+ this.navigateOptions(direction);
450
+ },
451
+ handleComposition(event) {
452
+ const text = event.target.value;
453
+ if (event.type === 'compositionend') {
454
+ this.isOnComposition = false;
455
+ this.$nextTick(_ => this.handleQueryChange(text));
456
+ } else {
457
+ const lastCharacter = text[text.length - 1] || '';
458
+ this.isOnComposition = !isKorean(lastCharacter);
459
+ }
460
+ },
461
+ handleQueryChange(val) {
462
+ if (this.previousQuery === val || this.isOnComposition) return;
463
+ if (
464
+ this.previousQuery === null &&
465
+ (typeof this.filterMethod === 'function' || typeof this.remoteMethod === 'function')
466
+ ) {
467
+ this.previousQuery = val;
468
+ return;
469
+ }
470
+ this.previousQuery = val;
471
+ this.$nextTick(() => {
472
+ if (this.visible) this.broadcast('ElSelectDropdown', 'updatePopper');
473
+ });
474
+ this.hoverIndex = -1;
475
+ if (this.multiple && this.filterable) {
476
+ this.$nextTick(() => {
477
+ const length = this.$refs.input.value.length * 15 + 20;
478
+ this.inputLength = this.collapseTags ? Math.min(50, length) : length;
479
+ this.managePlaceholder();
480
+ this.resetInputHeight();
481
+ });
482
+ }
483
+ if (this.remote && typeof this.remoteMethod === 'function') {
484
+ this.hoverIndex = -1;
485
+ this.remoteMethod(val);
486
+ } else if (typeof this.filterMethod === 'function') {
487
+ this.filterMethod(val);
488
+ this.broadcast('ElOptionGroup', 'queryChange');
489
+ } else {
490
+ this.filteredOptionsCount = this.optionsCount;
491
+ this.broadcast('ElOption', 'queryChange', val);
492
+ this.broadcast('ElOptionGroup', 'queryChange');
493
+ }
494
+ if (this.defaultFirstOption && (this.filterable || this.remote) && this.filteredOptionsCount) {
495
+ this.checkDefaultFirstOption();
496
+ }
497
+ },
498
+
499
+ scrollToOption(option) {
500
+ const target = Array.isArray(option) && option[0] ? option[0].$el : option.$el;
501
+ if (this.$refs.popper && target) {
502
+ const menu = this.$refs.popper.$el.querySelector('.el-select-dropdown__wrap');
503
+ scrollIntoView(menu, target);
504
+ }
505
+ this.$refs.scrollbar && this.$refs.scrollbar.handleScroll();
506
+ },
507
+
508
+ handleMenuEnter() {
509
+ this.$nextTick(() => this.scrollToOption(this.selected));
510
+ },
511
+
512
+ emitChange(val) {
513
+ if (!valueEquals(this.value, val)) {
514
+ this.$emit('change', val);
515
+ }
516
+ },
517
+
518
+ getOption(value) {
519
+ let option;
520
+ const isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
521
+ const isNull = Object.prototype.toString.call(value).toLowerCase() === '[object null]';
522
+ const isUndefined = Object.prototype.toString.call(value).toLowerCase() === '[object undefined]';
523
+
524
+ for (let i = this.cachedOptions.length - 1; i >= 0; i--) {
525
+ const cachedOption = this.cachedOptions[i];
526
+ const isEqual = isObject
527
+ ? getValueByPath(cachedOption.value, this.valueKey) === getValueByPath(value, this.valueKey)
528
+ : cachedOption.value === value;
529
+ if (isEqual) {
530
+ option = cachedOption;
531
+ break;
532
+ }
533
+ }
534
+ if (option) return option;
535
+ const label = (!isObject && !isNull && !isUndefined)
536
+ ? String(value) : '';
537
+ let newOption = {
538
+ value: value,
539
+ currentLabel: label
540
+ };
541
+ if (this.multiple) {
542
+ newOption.hitState = false;
543
+ }
544
+ return newOption;
545
+ },
546
+
547
+ setSelected() {
548
+ if (!this.multiple) {
549
+ let option = this.getOption(this.value);
550
+ if (option.created) {
551
+ this.createdLabel = option.currentLabel;
552
+ this.createdSelected = true;
553
+ } else {
554
+ this.createdSelected = false;
555
+ }
556
+ this.selectedLabel = option.currentLabel;
557
+ this.selected = option;
558
+ if (this.filterable) this.query = this.selectedLabel;
559
+ return;
560
+ }
561
+ let result = [];
562
+ if (Array.isArray(this.value)) {
563
+ this.value.forEach(value => {
564
+ result.push(this.getOption(value));
565
+ });
566
+ }
567
+ this.selected = result;
568
+ this.$nextTick(() => {
569
+ this.resetInputHeight();
570
+ });
571
+ },
572
+
573
+ handleFocus(event) {
574
+ if (!this.softFocus) {
575
+ if (this.automaticDropdown || this.filterable) {
576
+ if (this.filterable && !this.visible) {
577
+ this.menuVisibleOnFocus = true;
578
+ }
579
+ this.visible = true;
580
+ }
581
+ this.$emit('focus', event);
582
+ } else {
583
+ this.softFocus = false;
584
+ }
585
+ },
586
+
587
+ blur() {
588
+ this.visible = false;
589
+ this.$refs.reference.blur();
590
+ },
591
+
592
+ handleBlur(event) {
593
+ setTimeout(() => {
594
+ if (this.isSilentBlur) {
595
+ this.isSilentBlur = false;
596
+ } else {
597
+ this.$emit('blur', event);
598
+ }
599
+ }, 50);
600
+ this.softFocus = false;
601
+ },
602
+
603
+ handleClearClick(event) {
604
+ this.deleteSelected(event);
605
+ },
606
+
607
+ doDestroy() {
608
+ this.$refs.popper && this.$refs.popper.doDestroy();
609
+ },
610
+
611
+ handleClose() {
612
+ this.visible = false;
613
+ },
614
+
615
+ toggleLastOptionHitState(hit) {
616
+ if (!Array.isArray(this.selected)) return;
617
+ const option = this.selected[this.selected.length - 1];
618
+ if (!option) return;
619
+
620
+ if (hit === true || hit === false) {
621
+ option.hitState = hit;
622
+ return hit;
623
+ }
624
+
625
+ option.hitState = !option.hitState;
626
+ return option.hitState;
627
+ },
628
+
629
+ deletePrevTag(e) {
630
+ if (e.target.value.length <= 0 && !this.toggleLastOptionHitState()) {
631
+ const value = this.value.slice();
632
+ value.pop();
633
+ this.$emit('input', value);
634
+ this.emitChange(value);
635
+ }
636
+ },
637
+
638
+ managePlaceholder() {
639
+ if (this.currentPlaceholder !== '') {
640
+ this.currentPlaceholder = this.$refs.input.value ? '' : this.cachedPlaceHolder;
641
+ }
642
+ },
643
+
644
+ resetInputState(e) {
645
+ if (e.keyCode !== 8) this.toggleLastOptionHitState(false);
646
+ this.inputLength = this.$refs.input.value.length * 15 + 20;
647
+ this.resetInputHeight();
648
+ },
649
+
650
+ resetInputHeight() {
651
+ if (this.collapseTags && !this.filterable) return;
652
+ this.$nextTick(() => {
653
+ if (!this.$refs.reference) return;
654
+ let inputChildNodes = this.$refs.reference.$el.childNodes;
655
+ let input = [].filter.call(inputChildNodes, item => item.tagName === 'INPUT')[0];
656
+ const tags = this.$refs.tags;
657
+ const tagsHeight = tags ? Math.round(tags.getBoundingClientRect().height) : 0;
658
+ const sizeInMap = this.initialInputHeight || 40;
659
+ input.style.height = this.selected.length === 0
660
+ ? sizeInMap + 'px'
661
+ : Math.max(
662
+ tags ? (tagsHeight + (tagsHeight > sizeInMap ? 6 : 0)) : 0,
663
+ sizeInMap
664
+ ) + 'px';
665
+ if (this.visible && this.emptyText !== false) {
666
+ this.broadcast('ElSelectDropdown', 'updatePopper');
667
+ }
668
+ });
669
+ },
670
+
671
+ resetHoverIndex() {
672
+ setTimeout(() => {
673
+ if (!this.multiple) {
674
+ this.hoverIndex = this.options.indexOf(this.selected);
675
+ } else {
676
+ if (this.selected.length > 0) {
677
+ this.hoverIndex = Math.min.apply(null, this.selected.map(item => this.options.indexOf(item)));
678
+ } else {
679
+ this.hoverIndex = -1;
680
+ }
681
+ }
682
+ }, 300);
683
+ },
684
+
685
+ handleOptionSelect(option, byClick) {
686
+ if (this.multiple) {
687
+ const value = (this.value || []).slice();
688
+ const optionIndex = this.getValueIndex(value, option.value);
689
+ if (optionIndex > -1) {
690
+ value.splice(optionIndex, 1);
691
+ } else if (this.multipleLimit <= 0 || value.length < this.multipleLimit) {
692
+ value.push(option.value);
693
+ }
694
+ this.$emit('input', value);
695
+ this.emitChange(value);
696
+ if (option.created) {
697
+ this.query = '';
698
+ this.handleQueryChange('');
699
+ this.inputLength = 20;
700
+ }
701
+ if (this.filterable) this.$refs.input.focus();
702
+ } else {
703
+ this.$emit('input', option.value);
704
+ this.emitChange(option.value);
705
+ this.visible = false;
706
+ }
707
+ this.isSilentBlur = byClick;
708
+ this.setSoftFocus();
709
+ if (this.visible) return;
710
+ this.$nextTick(() => {
711
+ this.scrollToOption(option);
712
+ });
713
+ },
714
+
715
+ setSoftFocus() {
716
+ this.softFocus = true;
717
+ const input = this.$refs.input || this.$refs.reference;
718
+ if (input) {
719
+ input.focus();
720
+ }
721
+ },
722
+
723
+ getValueIndex(arr = [], value) {
724
+ const isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
725
+ if (!isObject) {
726
+ return arr.indexOf(value);
727
+ } else {
728
+ const valueKey = this.valueKey;
729
+ let index = -1;
730
+ arr.some((item, i) => {
731
+ if (getValueByPath(item, valueKey) === getValueByPath(value, valueKey)) {
732
+ index = i;
733
+ return true;
734
+ }
735
+ return false;
736
+ });
737
+ return index;
738
+ }
739
+ },
740
+
741
+ toggleMenu() {
742
+ if (!this.selectDisabled) {
743
+ if (this.menuVisibleOnFocus) {
744
+ this.menuVisibleOnFocus = false;
745
+ } else {
746
+ this.visible = !this.visible;
747
+ }
748
+ if (this.visible) {
749
+ (this.$refs.input || this.$refs.reference).focus();
750
+ }
751
+ }
752
+ },
753
+
754
+ selectOption() {
755
+ if (!this.visible) {
756
+ this.toggleMenu();
757
+ } else {
758
+ if (this.options[this.hoverIndex]) {
759
+ this.handleOptionSelect(this.options[this.hoverIndex]);
760
+ }
761
+ }
762
+ },
763
+
764
+ deleteSelected(event) {
765
+ event.stopPropagation();
766
+ const value = this.multiple ? [] : '';
767
+ this.$emit('input', value);
768
+ this.emitChange(value);
769
+ this.visible = false;
770
+ this.$emit('clear');
771
+ },
772
+
773
+ deleteTag(event, tag) {
774
+ let index = this.selected.indexOf(tag);
775
+ if (index > -1 && !this.selectDisabled) {
776
+ const value = this.value.slice();
777
+ value.splice(index, 1);
778
+ this.$emit('input', value);
779
+ this.emitChange(value);
780
+ this.$emit('remove-tag', tag.value);
781
+ }
782
+ event.stopPropagation();
783
+ },
784
+
785
+ onInputChange() {
786
+ if (this.filterable && this.query !== this.selectedLabel) {
787
+ this.query = this.selectedLabel;
788
+ this.handleQueryChange(this.query);
789
+ }
790
+ },
791
+
792
+ onOptionDestroy(index) {
793
+ if (index > -1) {
794
+ this.optionsCount--;
795
+ this.filteredOptionsCount--;
796
+ this.options.splice(index, 1);
797
+ }
798
+ },
799
+
800
+ resetInputWidth() {
801
+ this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width;
802
+ },
803
+
804
+ handleResize() {
805
+ this.resetInputWidth();
806
+ if (this.multiple) this.resetInputHeight();
807
+ },
808
+
809
+ checkDefaultFirstOption() {
810
+ this.hoverIndex = -1;
811
+ // highlight the created option
812
+ let hasCreated = false;
813
+ for (let i = this.options.length - 1; i >= 0; i--) {
814
+ if (this.options[i].created) {
815
+ hasCreated = true;
816
+ this.hoverIndex = i;
817
+ break;
818
+ }
819
+ }
820
+ if (hasCreated) return;
821
+ for (let i = 0; i !== this.options.length; ++i) {
822
+ const option = this.options[i];
823
+ if (this.query) {
824
+ // highlight first options that passes the filter
825
+ if (!option.disabled && !option.groupDisabled && option.visible) {
826
+ this.hoverIndex = i;
827
+ break;
828
+ }
829
+ } else {
830
+ // highlight currently selected option
831
+ if (option.itemSelected) {
832
+ this.hoverIndex = i;
833
+ break;
834
+ }
835
+ }
836
+ }
837
+ },
838
+
839
+ getValueKey(item) {
840
+ if (Object.prototype.toString.call(item.value).toLowerCase() !== '[object object]') {
841
+ return item.value;
842
+ } else {
843
+ return getValueByPath(item.value, this.valueKey);
844
+ }
845
+ }
846
+ },
847
+
848
+ created() {
849
+ this.cachedPlaceHolder = this.currentPlaceholder = this.propPlaceholder;
850
+ if (this.multiple && !Array.isArray(this.value)) {
851
+ this.$emit('input', []);
852
+ }
853
+ if (!this.multiple && Array.isArray(this.value)) {
854
+ this.$emit('input', '');
855
+ }
856
+
857
+ this.debouncedOnInputChange = debounce(this.debounce, () => {
858
+ this.onInputChange();
859
+ });
860
+
861
+ this.debouncedQueryChange = debounce(this.debounce, (e) => {
862
+ this.handleQueryChange(e.target.value);
863
+ });
864
+
865
+ this.$on('handleOptionClick', this.handleOptionSelect);
866
+ this.$on('setSelected', this.setSelected);
867
+ },
868
+
869
+ mounted() {
870
+ if (this.multiple && Array.isArray(this.value) && this.value.length > 0) {
871
+ this.currentPlaceholder = '';
872
+ }
873
+ addResizeListener(this.$el, this.handleResize);
874
+
875
+ const reference = this.$refs.reference;
876
+ if (reference && reference.$el) {
877
+ const sizeMap = {
878
+ medium: 36,
879
+ small: 32,
880
+ mini: 28
881
+ };
882
+ const input = reference.$el.querySelector('input');
883
+ this.initialInputHeight = input.getBoundingClientRect().height || sizeMap[this.selectSize];
884
+ }
885
+ if (this.remote && this.multiple) {
886
+ this.resetInputHeight();
887
+ }
888
+ this.$nextTick(() => {
889
+ if (reference && reference.$el) {
890
+ this.inputWidth = reference.$el.getBoundingClientRect().width;
891
+ }
892
+ });
893
+ this.setSelected();
894
+ },
895
+
896
+ beforeDestroy() {
897
+ if (this.$el && this.handleResize) removeResizeListener(this.$el, this.handleResize);
898
+ }
899
+ };
900
+ </script>