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,73 @@
1
+ <template>
2
+ <div class="el-collapse" role="tablist" aria-multiselectable="true">
3
+ <slot></slot>
4
+ </div>
5
+ </template>
6
+ <script>
7
+ export default {
8
+ name: 'ElCollapse',
9
+
10
+ componentName: 'ElCollapse',
11
+
12
+ props: {
13
+ accordion: Boolean,
14
+ value: {
15
+ type: [Array, String, Number],
16
+ default() {
17
+ return [];
18
+ }
19
+ }
20
+ },
21
+
22
+ data() {
23
+ return {
24
+ activeNames: [].concat(this.value)
25
+ };
26
+ },
27
+
28
+ provide() {
29
+ return {
30
+ collapse: this
31
+ };
32
+ },
33
+
34
+ watch: {
35
+ value(value) {
36
+ this.activeNames = [].concat(value);
37
+ }
38
+ },
39
+
40
+ methods: {
41
+ setActiveNames(activeNames) {
42
+ activeNames = [].concat(activeNames);
43
+ let value = this.accordion ? activeNames[0] : activeNames;
44
+ this.activeNames = activeNames;
45
+ this.$emit('input', value);
46
+ this.$emit('change', value);
47
+ },
48
+ handleItemClick(item) {
49
+ if (this.accordion) {
50
+ this.setActiveNames(
51
+ (this.activeNames[0] || this.activeNames[0] === 0) &&
52
+ this.activeNames[0] === item.name
53
+ ? '' : item.name
54
+ );
55
+ } else {
56
+ let activeNames = this.activeNames.slice(0);
57
+ let index = activeNames.indexOf(item.name);
58
+
59
+ if (index > -1) {
60
+ activeNames.splice(index, 1);
61
+ } else {
62
+ activeNames.push(item.name);
63
+ }
64
+ this.setActiveNames(activeNames);
65
+ }
66
+ }
67
+ },
68
+
69
+ created() {
70
+ this.$on('item-click', this.handleItemClick);
71
+ }
72
+ };
73
+ </script>
@@ -0,0 +1,8 @@
1
+ import ElCollapseItem from '../collapse/src/collapse-item.vue';
2
+
3
+ /* istanbul ignore next */
4
+ ElCollapseItem.install = function(Vue) {
5
+ Vue.component(ElCollapseItem.name, ElCollapseItem);
6
+ };
7
+
8
+ export default ElCollapseItem;
@@ -0,0 +1,8 @@
1
+ import ColorPicker from './src/main';
2
+
3
+ /* istanbul ignore next */
4
+ ColorPicker.install = function(Vue) {
5
+ Vue.component(ColorPicker.name, ColorPicker);
6
+ };
7
+
8
+ export default ColorPicker;
@@ -0,0 +1,317 @@
1
+ const hsv2hsl = function(hue, sat, val) {
2
+ return [
3
+ hue,
4
+ (sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue)) || 0,
5
+ hue / 2
6
+ ];
7
+ };
8
+
9
+ // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
10
+ // <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
11
+ const isOnePointZero = function(n) {
12
+ return typeof n === 'string' && n.indexOf('.') !== -1 && parseFloat(n) === 1;
13
+ };
14
+
15
+ const isPercentage = function(n) {
16
+ return typeof n === 'string' && n.indexOf('%') !== -1;
17
+ };
18
+
19
+ // Take input from [0, n] and return it as [0, 1]
20
+ const bound01 = function(value, max) {
21
+ if (isOnePointZero(value)) value = '100%';
22
+
23
+ const processPercent = isPercentage(value);
24
+ value = Math.min(max, Math.max(0, parseFloat(value)));
25
+
26
+ // Automatically convert percentage into number
27
+ if (processPercent) {
28
+ value = parseInt(value * max, 10) / 100;
29
+ }
30
+
31
+ // Handle floating point rounding errors
32
+ if ((Math.abs(value - max) < 0.000001)) {
33
+ return 1;
34
+ }
35
+
36
+ // Convert into [0, 1] range if it isn't already
37
+ return (value % max) / parseFloat(max);
38
+ };
39
+
40
+ const INT_HEX_MAP = { 10: 'A', 11: 'B', 12: 'C', 13: 'D', 14: 'E', 15: 'F' };
41
+
42
+ const toHex = function({ r, g, b }) {
43
+ const hexOne = function(value) {
44
+ value = Math.min(Math.round(value), 255);
45
+ const high = Math.floor(value / 16);
46
+ const low = value % 16;
47
+ return '' + (INT_HEX_MAP[high] || high) + (INT_HEX_MAP[low] || low);
48
+ };
49
+
50
+ if (isNaN(r) || isNaN(g) || isNaN(b)) return '';
51
+
52
+ return '#' + hexOne(r) + hexOne(g) + hexOne(b);
53
+ };
54
+
55
+ const HEX_INT_MAP = { A: 10, B: 11, C: 12, D: 13, E: 14, F: 15 };
56
+
57
+ const parseHexChannel = function(hex) {
58
+ if (hex.length === 2) {
59
+ return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]);
60
+ }
61
+
62
+ return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
63
+ };
64
+
65
+ const hsl2hsv = function(hue, sat, light) {
66
+ sat = sat / 100;
67
+ light = light / 100;
68
+ let smin = sat;
69
+ const lmin = Math.max(light, 0.01);
70
+ let sv;
71
+ let v;
72
+
73
+ light *= 2;
74
+ sat *= (light <= 1) ? light : 2 - light;
75
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
76
+ v = (light + sat) / 2;
77
+ sv = light === 0 ? (2 * smin) / (lmin + smin) : (2 * sat) / (light + sat);
78
+
79
+ return {
80
+ h: hue,
81
+ s: sv * 100,
82
+ v: v * 100
83
+ };
84
+ };
85
+
86
+ // `rgbToHsv`
87
+ // Converts an RGB color value to HSV
88
+ // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
89
+ // *Returns:* { h, s, v } in [0,1]
90
+ const rgb2hsv = function(r, g, b) {
91
+ r = bound01(r, 255);
92
+ g = bound01(g, 255);
93
+ b = bound01(b, 255);
94
+
95
+ const max = Math.max(r, g, b);
96
+ const min = Math.min(r, g, b);
97
+ let h, s;
98
+ let v = max;
99
+
100
+ const d = max - min;
101
+ s = max === 0 ? 0 : d / max;
102
+
103
+ if (max === min) {
104
+ h = 0; // achromatic
105
+ } else {
106
+ switch (max) {
107
+ case r:
108
+ h = (g - b) / d + (g < b ? 6 : 0);
109
+ break;
110
+ case g:
111
+ h = (b - r) / d + 2;
112
+ break;
113
+ case b:
114
+ h = (r - g) / d + 4;
115
+ break;
116
+ }
117
+ h /= 6;
118
+ }
119
+
120
+ return { h: h * 360, s: s * 100, v: v * 100 };
121
+ };
122
+
123
+ // `hsvToRgb`
124
+ // Converts an HSV color value to RGB.
125
+ // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
126
+ // *Returns:* { r, g, b } in the set [0, 255]
127
+ const hsv2rgb = function(h, s, v) {
128
+ h = bound01(h, 360) * 6;
129
+ s = bound01(s, 100);
130
+ v = bound01(v, 100);
131
+
132
+ const i = Math.floor(h);
133
+ const f = h - i;
134
+ const p = v * (1 - s);
135
+ const q = v * (1 - f * s);
136
+ const t = v * (1 - (1 - f) * s);
137
+ const mod = i % 6;
138
+ const r = [v, q, p, p, t, v][mod];
139
+ const g = [t, v, v, q, p, p][mod];
140
+ const b = [p, p, t, v, v, q][mod];
141
+
142
+ return {
143
+ r: Math.round(r * 255),
144
+ g: Math.round(g * 255),
145
+ b: Math.round(b * 255)
146
+ };
147
+ };
148
+
149
+ export default class Color {
150
+ constructor(options) {
151
+ this._hue = 0;
152
+ this._saturation = 100;
153
+ this._value = 100;
154
+ this._alpha = 100;
155
+
156
+ this.enableAlpha = false;
157
+ this.format = 'hex';
158
+ this.value = '';
159
+
160
+ options = options || {};
161
+
162
+ for (let option in options) {
163
+ if (options.hasOwnProperty(option)) {
164
+ this[option] = options[option];
165
+ }
166
+ }
167
+
168
+ this.doOnChange();
169
+ }
170
+
171
+ set(prop, value) {
172
+ if (arguments.length === 1 && typeof prop === 'object') {
173
+ for (let p in prop) {
174
+ if (prop.hasOwnProperty(p)) {
175
+ this.set(p, prop[p]);
176
+ }
177
+ }
178
+
179
+ return;
180
+ }
181
+
182
+ this['_' + prop] = value;
183
+ this.doOnChange();
184
+ }
185
+
186
+ get(prop) {
187
+ return this['_' + prop];
188
+ }
189
+
190
+ toRgb() {
191
+ return hsv2rgb(this._hue, this._saturation, this._value);
192
+ }
193
+
194
+ fromString(value) {
195
+ if (!value) {
196
+ this._hue = 0;
197
+ this._saturation = 100;
198
+ this._value = 100;
199
+
200
+ this.doOnChange();
201
+ return;
202
+ }
203
+
204
+ const fromHSV = (h, s, v) => {
205
+ this._hue = Math.max(0, Math.min(360, h));
206
+ this._saturation = Math.max(0, Math.min(100, s));
207
+ this._value = Math.max(0, Math.min(100, v));
208
+
209
+ this.doOnChange();
210
+ };
211
+
212
+ if (value.indexOf('hsl') !== -1) {
213
+ const parts = value.replace(/hsla|hsl|\(|\)/gm, '')
214
+ .split(/\s|,/g).filter((val) => val !== '').map((val, index) => index > 2 ? parseFloat(val) : parseInt(val, 10));
215
+
216
+ if (parts.length === 4) {
217
+ this._alpha = Math.floor(parseFloat(parts[3]) * 100);
218
+ } else if (parts.length === 3) {
219
+ this._alpha = 100;
220
+ }
221
+ if (parts.length >= 3) {
222
+ const { h, s, v } = hsl2hsv(parts[0], parts[1], parts[2]);
223
+ fromHSV(h, s, v);
224
+ }
225
+ } else if (value.indexOf('hsv') !== -1) {
226
+ const parts = value.replace(/hsva|hsv|\(|\)/gm, '')
227
+ .split(/\s|,/g).filter((val) => val !== '').map((val, index) => index > 2 ? parseFloat(val) : parseInt(val, 10));
228
+
229
+ if (parts.length === 4) {
230
+ this._alpha = Math.floor(parseFloat(parts[3]) * 100);
231
+ } else if (parts.length === 3) {
232
+ this._alpha = 100;
233
+ }
234
+ if (parts.length >= 3) {
235
+ fromHSV(parts[0], parts[1], parts[2]);
236
+ }
237
+ } else if (value.indexOf('rgb') !== -1) {
238
+ const parts = value.replace(/rgba|rgb|\(|\)/gm, '')
239
+ .split(/\s|,/g).filter((val) => val !== '').map((val, index) => index > 2 ? parseFloat(val) : parseInt(val, 10));
240
+
241
+ if (parts.length === 4) {
242
+ this._alpha = Math.floor(parseFloat(parts[3]) * 100);
243
+ } else if (parts.length === 3) {
244
+ this._alpha = 100;
245
+ }
246
+ if (parts.length >= 3) {
247
+ const { h, s, v } = rgb2hsv(parts[0], parts[1], parts[2]);
248
+ fromHSV(h, s, v);
249
+ }
250
+ } else if (value.indexOf('#') !== -1) {
251
+ const hex = value.replace('#', '').trim();
252
+ if (!/^(?:[0-9a-fA-F]{3}){1,2}|[0-9a-fA-F]{8}$/.test(hex)) return;
253
+ let r, g, b;
254
+
255
+ if (hex.length === 3) {
256
+ r = parseHexChannel(hex[0] + hex[0]);
257
+ g = parseHexChannel(hex[1] + hex[1]);
258
+ b = parseHexChannel(hex[2] + hex[2]);
259
+ } else if (hex.length === 6 || hex.length === 8) {
260
+ r = parseHexChannel(hex.substring(0, 2));
261
+ g = parseHexChannel(hex.substring(2, 4));
262
+ b = parseHexChannel(hex.substring(4, 6));
263
+ }
264
+
265
+ if (hex.length === 8) {
266
+ this._alpha = Math.floor(parseHexChannel(hex.substring(6)) / 255 * 100);
267
+ } else if (hex.length === 3 || hex.length === 6) {
268
+ this._alpha = 100;
269
+ }
270
+
271
+ const { h, s, v } = rgb2hsv(r, g, b);
272
+ fromHSV(h, s, v);
273
+ }
274
+ }
275
+
276
+ compare(color) {
277
+ return Math.abs(color._hue - this._hue) < 2 &&
278
+ Math.abs(color._saturation - this._saturation) < 1 &&
279
+ Math.abs(color._value - this._value) < 1 &&
280
+ Math.abs(color._alpha - this._alpha) < 1;
281
+ }
282
+
283
+ doOnChange() {
284
+ const { _hue, _saturation, _value, _alpha, format } = this;
285
+
286
+ if (this.enableAlpha) {
287
+ switch (format) {
288
+ case 'hsl':
289
+ const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
290
+ this.value = `hsla(${ _hue }, ${ Math.round(hsl[1] * 100) }%, ${ Math.round(hsl[2] * 100) }%, ${ _alpha / 100})`;
291
+ break;
292
+ case 'hsv':
293
+ this.value = `hsva(${ _hue }, ${ Math.round(_saturation) }%, ${ Math.round(_value) }%, ${ _alpha / 100})`;
294
+ break;
295
+ default:
296
+ const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
297
+ this.value = `rgba(${r}, ${g}, ${b}, ${ _alpha / 100 })`;
298
+ }
299
+ } else {
300
+ switch (format) {
301
+ case 'hsl':
302
+ const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
303
+ this.value = `hsl(${ _hue }, ${ Math.round(hsl[1] * 100) }%, ${ Math.round(hsl[2] * 100) }%)`;
304
+ break;
305
+ case 'hsv':
306
+ this.value = `hsv(${ _hue }, ${ Math.round(_saturation) }%, ${ Math.round(_value) }%)`;
307
+ break;
308
+ case 'rgb':
309
+ const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
310
+ this.value = `rgb(${r}, ${g}, ${b})`;
311
+ break;
312
+ default:
313
+ this.value = toHex(hsv2rgb(_hue, _saturation, _value));
314
+ }
315
+ }
316
+ }
317
+ };
@@ -0,0 +1,132 @@
1
+ <template>
2
+ <div class="el-color-alpha-slider" :class="{ 'is-vertical': vertical }">
3
+ <div class="el-color-alpha-slider__bar"
4
+ @click="handleClick"
5
+ ref="bar"
6
+ :style="{
7
+ background: background
8
+ }">
9
+ </div>
10
+ <div class="el-color-alpha-slider__thumb"
11
+ ref="thumb"
12
+ :style="{
13
+ left: thumbLeft + 'px',
14
+ top: thumbTop + 'px'
15
+ }">
16
+ </div>
17
+ </div>
18
+ </template>
19
+
20
+ <script>
21
+ import draggable from '../draggable';
22
+
23
+ export default {
24
+ name: 'el-color-alpha-slider',
25
+
26
+ props: {
27
+ color: {
28
+ required: true
29
+ },
30
+ vertical: Boolean
31
+ },
32
+
33
+ watch: {
34
+ 'color._alpha'() {
35
+ this.update();
36
+ },
37
+
38
+ 'color.value'() {
39
+ this.update();
40
+ }
41
+ },
42
+
43
+ methods: {
44
+ handleClick(event) {
45
+ const thumb = this.$refs.thumb;
46
+ const target = event.target;
47
+
48
+ if (target !== thumb) {
49
+ this.handleDrag(event);
50
+ }
51
+ },
52
+
53
+ handleDrag(event) {
54
+ const rect = this.$el.getBoundingClientRect();
55
+ const { thumb } = this.$refs;
56
+
57
+ if (!this.vertical) {
58
+ let left = event.clientX - rect.left;
59
+ left = Math.max(thumb.offsetWidth / 2, left);
60
+ left = Math.min(left, rect.width - thumb.offsetWidth / 2);
61
+
62
+ this.color.set('alpha', Math.round((left - thumb.offsetWidth / 2) / (rect.width - thumb.offsetWidth) * 100));
63
+ } else {
64
+ let top = event.clientY - rect.top;
65
+ top = Math.max(thumb.offsetHeight / 2, top);
66
+ top = Math.min(top, rect.height - thumb.offsetHeight / 2);
67
+
68
+ this.color.set('alpha', Math.round((top - thumb.offsetHeight / 2) / (rect.height - thumb.offsetHeight) * 100));
69
+ }
70
+ },
71
+
72
+ getThumbLeft() {
73
+ if (this.vertical) return 0;
74
+ const el = this.$el;
75
+ const alpha = this.color._alpha;
76
+
77
+ if (!el) return 0;
78
+ const thumb = this.$refs.thumb;
79
+ return Math.round(alpha * (el.offsetWidth - thumb.offsetWidth / 2) / 100);
80
+ },
81
+
82
+ getThumbTop() {
83
+ if (!this.vertical) return 0;
84
+ const el = this.$el;
85
+ const alpha = this.color._alpha;
86
+
87
+ if (!el) return 0;
88
+ const thumb = this.$refs.thumb;
89
+ return Math.round(alpha * (el.offsetHeight - thumb.offsetHeight / 2) / 100);
90
+ },
91
+
92
+ getBackground() {
93
+ if (this.color && this.color.value) {
94
+ const { r, g, b } = this.color.toRgb();
95
+ return `linear-gradient(to right, rgba(${r}, ${g}, ${b}, 0) 0%, rgba(${r}, ${g}, ${b}, 1) 100%)`;
96
+ }
97
+ return null;
98
+ },
99
+
100
+ update() {
101
+ this.thumbLeft = this.getThumbLeft();
102
+ this.thumbTop = this.getThumbTop();
103
+ this.background = this.getBackground();
104
+ }
105
+ },
106
+
107
+ data() {
108
+ return {
109
+ thumbLeft: 0,
110
+ thumbTop: 0,
111
+ background: null
112
+ };
113
+ },
114
+
115
+ mounted() {
116
+ const { bar, thumb } = this.$refs;
117
+
118
+ const dragConfig = {
119
+ drag: (event) => {
120
+ this.handleDrag(event);
121
+ },
122
+ end: (event) => {
123
+ this.handleDrag(event);
124
+ }
125
+ };
126
+
127
+ draggable(bar, dragConfig);
128
+ draggable(thumb, dragConfig);
129
+ this.update();
130
+ }
131
+ };
132
+ </script>
@@ -0,0 +1,123 @@
1
+ <template>
2
+ <div class="el-color-hue-slider" :class="{ 'is-vertical': vertical }">
3
+ <div class="el-color-hue-slider__bar" @click="handleClick" ref="bar"></div>
4
+ <div class="el-color-hue-slider__thumb"
5
+ :style="{
6
+ left: thumbLeft + 'px',
7
+ top: thumbTop + 'px'
8
+ }"
9
+ ref="thumb">
10
+ </div>
11
+ </div>
12
+ </template>
13
+
14
+ <script>
15
+ import draggable from '../draggable';
16
+
17
+ export default {
18
+ name: 'el-color-hue-slider',
19
+
20
+ props: {
21
+ color: {
22
+ required: true
23
+ },
24
+
25
+ vertical: Boolean
26
+ },
27
+
28
+ data() {
29
+ return {
30
+ thumbLeft: 0,
31
+ thumbTop: 0
32
+ };
33
+ },
34
+
35
+ computed: {
36
+ hueValue() {
37
+ const hue = this.color.get('hue');
38
+ return hue;
39
+ }
40
+ },
41
+
42
+ watch: {
43
+ hueValue() {
44
+ this.update();
45
+ }
46
+ },
47
+
48
+ methods: {
49
+ handleClick(event) {
50
+ const thumb = this.$refs.thumb;
51
+ const target = event.target;
52
+
53
+ if (target !== thumb) {
54
+ this.handleDrag(event);
55
+ }
56
+ },
57
+
58
+ handleDrag(event) {
59
+ const rect = this.$el.getBoundingClientRect();
60
+ const { thumb } = this.$refs;
61
+ let hue;
62
+
63
+ if (!this.vertical) {
64
+ let left = event.clientX - rect.left;
65
+ left = Math.min(left, rect.width - thumb.offsetWidth / 2);
66
+ left = Math.max(thumb.offsetWidth / 2, left);
67
+
68
+ hue = Math.round((left - thumb.offsetWidth / 2) / (rect.width - thumb.offsetWidth) * 360);
69
+ } else {
70
+ let top = event.clientY - rect.top;
71
+ top = Math.min(top, rect.height - thumb.offsetHeight / 2);
72
+ top = Math.max(thumb.offsetHeight / 2, top);
73
+
74
+ hue = Math.round((top - thumb.offsetHeight / 2) / (rect.height - thumb.offsetHeight) * 360);
75
+ }
76
+
77
+ this.color.set('hue', hue);
78
+ },
79
+
80
+ getThumbLeft() {
81
+ if (this.vertical) return 0;
82
+ const el = this.$el;
83
+ const hue = this.color.get('hue');
84
+
85
+ if (!el) return 0;
86
+ const thumb = this.$refs.thumb;
87
+ return Math.round(hue * (el.offsetWidth - thumb.offsetWidth / 2) / 360);
88
+ },
89
+
90
+ getThumbTop() {
91
+ if (!this.vertical) return 0;
92
+ const el = this.$el;
93
+ const hue = this.color.get('hue');
94
+
95
+ if (!el) return 0;
96
+ const thumb = this.$refs.thumb;
97
+ return Math.round(hue * (el.offsetHeight - thumb.offsetHeight / 2) / 360);
98
+ },
99
+
100
+ update() {
101
+ this.thumbLeft = this.getThumbLeft();
102
+ this.thumbTop = this.getThumbTop();
103
+ }
104
+ },
105
+
106
+ mounted() {
107
+ const { bar, thumb } = this.$refs;
108
+
109
+ const dragConfig = {
110
+ drag: (event) => {
111
+ this.handleDrag(event);
112
+ },
113
+ end: (event) => {
114
+ this.handleDrag(event);
115
+ }
116
+ };
117
+
118
+ draggable(bar, dragConfig);
119
+ draggable(thumb, dragConfig);
120
+ this.update();
121
+ }
122
+ };
123
+ </script>