element-plus 2.3.6 → 2.3.7

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 (481) hide show
  1. package/attributes.json +1 -1
  2. package/dist/index.css +1 -1
  3. package/dist/index.full.js +171 -152
  4. package/dist/index.full.min.js +16 -16
  5. package/dist/index.full.min.js.map +1 -1
  6. package/dist/index.full.min.mjs +18 -18
  7. package/dist/index.full.min.mjs.map +1 -1
  8. package/dist/index.full.mjs +171 -152
  9. package/dist/locale/af.js +1 -1
  10. package/dist/locale/af.min.js +1 -1
  11. package/dist/locale/af.min.mjs +1 -1
  12. package/dist/locale/af.mjs +1 -1
  13. package/dist/locale/ar.js +1 -1
  14. package/dist/locale/ar.min.js +1 -1
  15. package/dist/locale/ar.min.mjs +1 -1
  16. package/dist/locale/ar.mjs +1 -1
  17. package/dist/locale/az.js +1 -1
  18. package/dist/locale/az.min.js +1 -1
  19. package/dist/locale/az.min.mjs +1 -1
  20. package/dist/locale/az.mjs +1 -1
  21. package/dist/locale/bg.js +1 -1
  22. package/dist/locale/bg.min.js +1 -1
  23. package/dist/locale/bg.min.mjs +1 -1
  24. package/dist/locale/bg.mjs +1 -1
  25. package/dist/locale/bn.js +1 -1
  26. package/dist/locale/bn.min.js +1 -1
  27. package/dist/locale/bn.min.mjs +1 -1
  28. package/dist/locale/bn.mjs +1 -1
  29. package/dist/locale/ca.js +1 -1
  30. package/dist/locale/ca.min.js +1 -1
  31. package/dist/locale/ca.min.mjs +1 -1
  32. package/dist/locale/ca.mjs +1 -1
  33. package/dist/locale/ckb.js +1 -1
  34. package/dist/locale/ckb.min.js +1 -1
  35. package/dist/locale/ckb.min.mjs +1 -1
  36. package/dist/locale/ckb.mjs +1 -1
  37. package/dist/locale/cs.js +1 -1
  38. package/dist/locale/cs.min.js +1 -1
  39. package/dist/locale/cs.min.mjs +1 -1
  40. package/dist/locale/cs.mjs +1 -1
  41. package/dist/locale/da.js +1 -1
  42. package/dist/locale/da.min.js +1 -1
  43. package/dist/locale/da.min.mjs +1 -1
  44. package/dist/locale/da.mjs +1 -1
  45. package/dist/locale/de.js +1 -1
  46. package/dist/locale/de.min.js +1 -1
  47. package/dist/locale/de.min.mjs +1 -1
  48. package/dist/locale/de.mjs +1 -1
  49. package/dist/locale/el.js +1 -1
  50. package/dist/locale/el.min.js +1 -1
  51. package/dist/locale/el.min.mjs +1 -1
  52. package/dist/locale/el.mjs +1 -1
  53. package/dist/locale/en.js +1 -1
  54. package/dist/locale/en.min.js +1 -1
  55. package/dist/locale/en.min.mjs +1 -1
  56. package/dist/locale/en.mjs +1 -1
  57. package/dist/locale/eo.js +1 -1
  58. package/dist/locale/eo.min.js +1 -1
  59. package/dist/locale/eo.min.mjs +1 -1
  60. package/dist/locale/eo.mjs +1 -1
  61. package/dist/locale/es.js +1 -1
  62. package/dist/locale/es.min.js +1 -1
  63. package/dist/locale/es.min.mjs +1 -1
  64. package/dist/locale/es.mjs +1 -1
  65. package/dist/locale/et.js +1 -1
  66. package/dist/locale/et.min.js +1 -1
  67. package/dist/locale/et.min.mjs +1 -1
  68. package/dist/locale/et.mjs +1 -1
  69. package/dist/locale/eu.js +1 -1
  70. package/dist/locale/eu.min.js +1 -1
  71. package/dist/locale/eu.min.mjs +1 -1
  72. package/dist/locale/eu.mjs +1 -1
  73. package/dist/locale/fa.js +1 -1
  74. package/dist/locale/fa.min.js +1 -1
  75. package/dist/locale/fa.min.mjs +1 -1
  76. package/dist/locale/fa.mjs +1 -1
  77. package/dist/locale/fi.js +1 -1
  78. package/dist/locale/fi.min.js +1 -1
  79. package/dist/locale/fi.min.mjs +1 -1
  80. package/dist/locale/fi.mjs +1 -1
  81. package/dist/locale/fr.js +1 -1
  82. package/dist/locale/fr.min.js +1 -1
  83. package/dist/locale/fr.min.mjs +1 -1
  84. package/dist/locale/fr.mjs +1 -1
  85. package/dist/locale/he.js +1 -1
  86. package/dist/locale/he.min.js +1 -1
  87. package/dist/locale/he.min.mjs +1 -1
  88. package/dist/locale/he.mjs +1 -1
  89. package/dist/locale/hr.js +1 -1
  90. package/dist/locale/hr.min.js +1 -1
  91. package/dist/locale/hr.min.mjs +1 -1
  92. package/dist/locale/hr.mjs +1 -1
  93. package/dist/locale/hu.js +1 -1
  94. package/dist/locale/hu.min.js +1 -1
  95. package/dist/locale/hu.min.mjs +1 -1
  96. package/dist/locale/hu.mjs +1 -1
  97. package/dist/locale/hy-am.js +1 -1
  98. package/dist/locale/hy-am.min.js +1 -1
  99. package/dist/locale/hy-am.min.mjs +1 -1
  100. package/dist/locale/hy-am.mjs +1 -1
  101. package/dist/locale/id.js +1 -1
  102. package/dist/locale/id.min.js +1 -1
  103. package/dist/locale/id.min.mjs +1 -1
  104. package/dist/locale/id.mjs +1 -1
  105. package/dist/locale/it.js +1 -1
  106. package/dist/locale/it.min.js +1 -1
  107. package/dist/locale/it.min.mjs +1 -1
  108. package/dist/locale/it.mjs +1 -1
  109. package/dist/locale/ja.js +1 -1
  110. package/dist/locale/ja.min.js +1 -1
  111. package/dist/locale/ja.min.mjs +1 -1
  112. package/dist/locale/ja.mjs +1 -1
  113. package/dist/locale/kk.js +1 -1
  114. package/dist/locale/kk.min.js +1 -1
  115. package/dist/locale/kk.min.mjs +1 -1
  116. package/dist/locale/kk.mjs +1 -1
  117. package/dist/locale/km.js +1 -1
  118. package/dist/locale/km.min.js +1 -1
  119. package/dist/locale/km.min.mjs +1 -1
  120. package/dist/locale/km.mjs +1 -1
  121. package/dist/locale/ko.js +1 -1
  122. package/dist/locale/ko.min.js +1 -1
  123. package/dist/locale/ko.min.mjs +1 -1
  124. package/dist/locale/ko.mjs +1 -1
  125. package/dist/locale/ku.js +1 -1
  126. package/dist/locale/ku.min.js +1 -1
  127. package/dist/locale/ku.min.mjs +1 -1
  128. package/dist/locale/ku.mjs +1 -1
  129. package/dist/locale/ky.js +1 -1
  130. package/dist/locale/ky.min.js +1 -1
  131. package/dist/locale/ky.min.mjs +1 -1
  132. package/dist/locale/ky.mjs +1 -1
  133. package/dist/locale/lt.js +1 -1
  134. package/dist/locale/lt.min.js +1 -1
  135. package/dist/locale/lt.min.mjs +1 -1
  136. package/dist/locale/lt.mjs +1 -1
  137. package/dist/locale/lv.js +1 -1
  138. package/dist/locale/lv.min.js +1 -1
  139. package/dist/locale/lv.min.mjs +1 -1
  140. package/dist/locale/lv.mjs +1 -1
  141. package/dist/locale/mg.js +1 -1
  142. package/dist/locale/mg.min.js +1 -1
  143. package/dist/locale/mg.min.mjs +1 -1
  144. package/dist/locale/mg.mjs +1 -1
  145. package/dist/locale/mn.js +1 -1
  146. package/dist/locale/mn.min.js +1 -1
  147. package/dist/locale/mn.min.mjs +1 -1
  148. package/dist/locale/mn.mjs +1 -1
  149. package/dist/locale/nb-no.js +1 -1
  150. package/dist/locale/nb-no.min.js +1 -1
  151. package/dist/locale/nb-no.min.mjs +1 -1
  152. package/dist/locale/nb-no.mjs +1 -1
  153. package/dist/locale/nl.js +1 -1
  154. package/dist/locale/nl.min.js +1 -1
  155. package/dist/locale/nl.min.mjs +1 -1
  156. package/dist/locale/nl.mjs +1 -1
  157. package/dist/locale/pa.js +1 -1
  158. package/dist/locale/pa.min.js +1 -1
  159. package/dist/locale/pa.min.mjs +1 -1
  160. package/dist/locale/pa.mjs +1 -1
  161. package/dist/locale/pl.js +1 -1
  162. package/dist/locale/pl.min.js +1 -1
  163. package/dist/locale/pl.min.mjs +1 -1
  164. package/dist/locale/pl.mjs +1 -1
  165. package/dist/locale/pt-br.js +1 -1
  166. package/dist/locale/pt-br.min.js +1 -1
  167. package/dist/locale/pt-br.min.mjs +1 -1
  168. package/dist/locale/pt-br.mjs +1 -1
  169. package/dist/locale/pt.js +1 -1
  170. package/dist/locale/pt.min.js +1 -1
  171. package/dist/locale/pt.min.mjs +1 -1
  172. package/dist/locale/pt.mjs +1 -1
  173. package/dist/locale/ro.js +1 -1
  174. package/dist/locale/ro.min.js +1 -1
  175. package/dist/locale/ro.min.mjs +1 -1
  176. package/dist/locale/ro.mjs +1 -1
  177. package/dist/locale/ru.js +1 -1
  178. package/dist/locale/ru.min.js +1 -1
  179. package/dist/locale/ru.min.mjs +1 -1
  180. package/dist/locale/ru.mjs +1 -1
  181. package/dist/locale/sk.js +1 -1
  182. package/dist/locale/sk.min.js +1 -1
  183. package/dist/locale/sk.min.mjs +1 -1
  184. package/dist/locale/sk.mjs +1 -1
  185. package/dist/locale/sl.js +1 -1
  186. package/dist/locale/sl.min.js +1 -1
  187. package/dist/locale/sl.min.mjs +1 -1
  188. package/dist/locale/sl.mjs +1 -1
  189. package/dist/locale/sr.js +10 -10
  190. package/dist/locale/sr.min.js +1 -1
  191. package/dist/locale/sr.min.js.map +1 -1
  192. package/dist/locale/sr.min.mjs +1 -1
  193. package/dist/locale/sr.min.mjs.map +1 -1
  194. package/dist/locale/sr.mjs +10 -10
  195. package/dist/locale/sv.js +1 -1
  196. package/dist/locale/sv.min.js +1 -1
  197. package/dist/locale/sv.min.mjs +1 -1
  198. package/dist/locale/sv.mjs +1 -1
  199. package/dist/locale/ta.js +1 -1
  200. package/dist/locale/ta.min.js +1 -1
  201. package/dist/locale/ta.min.mjs +1 -1
  202. package/dist/locale/ta.mjs +1 -1
  203. package/dist/locale/th.js +1 -1
  204. package/dist/locale/th.min.js +1 -1
  205. package/dist/locale/th.min.mjs +1 -1
  206. package/dist/locale/th.mjs +1 -1
  207. package/dist/locale/tk.js +1 -1
  208. package/dist/locale/tk.min.js +1 -1
  209. package/dist/locale/tk.min.mjs +1 -1
  210. package/dist/locale/tk.mjs +1 -1
  211. package/dist/locale/tr.js +1 -1
  212. package/dist/locale/tr.min.js +1 -1
  213. package/dist/locale/tr.min.mjs +1 -1
  214. package/dist/locale/tr.mjs +1 -1
  215. package/dist/locale/ug-cn.js +1 -1
  216. package/dist/locale/ug-cn.min.js +1 -1
  217. package/dist/locale/ug-cn.min.mjs +1 -1
  218. package/dist/locale/ug-cn.mjs +1 -1
  219. package/dist/locale/uk.js +1 -1
  220. package/dist/locale/uk.min.js +1 -1
  221. package/dist/locale/uk.min.mjs +1 -1
  222. package/dist/locale/uk.mjs +1 -1
  223. package/dist/locale/uz-uz.js +1 -1
  224. package/dist/locale/uz-uz.min.js +1 -1
  225. package/dist/locale/uz-uz.min.mjs +1 -1
  226. package/dist/locale/uz-uz.mjs +1 -1
  227. package/dist/locale/vi.js +1 -1
  228. package/dist/locale/vi.min.js +1 -1
  229. package/dist/locale/vi.min.mjs +1 -1
  230. package/dist/locale/vi.mjs +1 -1
  231. package/dist/locale/zh-cn.js +1 -1
  232. package/dist/locale/zh-cn.min.js +1 -1
  233. package/dist/locale/zh-cn.min.mjs +1 -1
  234. package/dist/locale/zh-cn.mjs +1 -1
  235. package/dist/locale/zh-tw.js +1 -1
  236. package/dist/locale/zh-tw.min.js +1 -1
  237. package/dist/locale/zh-tw.min.mjs +1 -1
  238. package/dist/locale/zh-tw.mjs +1 -1
  239. package/es/components/backtop/src/use-backtop.mjs +1 -0
  240. package/es/components/backtop/src/use-backtop.mjs.map +1 -1
  241. package/es/components/calendar/index.d.ts +1 -1
  242. package/es/components/calendar/index.mjs.map +1 -1
  243. package/es/components/dialog/src/dialog-content.mjs.map +1 -1
  244. package/es/components/form/index.d.ts +4 -4
  245. package/es/components/form/src/form.d.ts +1 -1
  246. package/es/components/form/src/form.mjs +1 -4
  247. package/es/components/form/src/form.mjs.map +1 -1
  248. package/es/components/form/src/form.vue.d.ts +4 -4
  249. package/es/components/form/src/types.d.ts +62 -1
  250. package/es/components/image/index.d.ts +24 -21
  251. package/es/components/image/src/image.d.ts +3 -3
  252. package/es/components/image/src/image.mjs +3 -12
  253. package/es/components/image/src/image.mjs.map +1 -1
  254. package/es/components/image/src/image.vue.d.ts +24 -21
  255. package/es/components/image/src/image2.mjs +6 -5
  256. package/es/components/image/src/image2.mjs.map +1 -1
  257. package/es/components/image-viewer/index.d.ts +10 -8
  258. package/es/components/image-viewer/src/image-viewer.d.ts +2 -2
  259. package/es/components/image-viewer/src/image-viewer.mjs +2 -8
  260. package/es/components/image-viewer/src/image-viewer.mjs.map +1 -1
  261. package/es/components/image-viewer/src/image-viewer.vue.d.ts +10 -8
  262. package/es/components/image-viewer/src/image-viewer2.mjs +12 -10
  263. package/es/components/image-viewer/src/image-viewer2.mjs.map +1 -1
  264. package/es/components/index.mjs +2 -2
  265. package/es/components/input/src/input2.mjs +3 -3
  266. package/es/components/input/src/input2.mjs.map +1 -1
  267. package/es/components/pagination/src/components/sizes.vue.d.ts +0 -1
  268. package/es/components/radio/index.mjs +2 -2
  269. package/es/components/radio/src/radio-button.mjs +1 -1
  270. package/es/components/radio/src/radio-group.mjs +1 -1
  271. package/es/components/radio/src/radio.mjs +30 -71
  272. package/es/components/radio/src/radio.mjs.map +1 -1
  273. package/es/components/radio/src/radio2.mjs +71 -30
  274. package/es/components/radio/src/radio2.mjs.map +1 -1
  275. package/es/components/scrollbar/index.mjs +2 -2
  276. package/es/components/scrollbar/src/scrollbar.mjs +174 -46
  277. package/es/components/scrollbar/src/scrollbar.mjs.map +1 -1
  278. package/es/components/scrollbar/src/scrollbar2.mjs +46 -174
  279. package/es/components/scrollbar/src/scrollbar2.mjs.map +1 -1
  280. package/es/components/select/index.d.ts +0 -1
  281. package/es/components/select/src/select.mjs +7 -8
  282. package/es/components/select/src/select.mjs.map +1 -1
  283. package/es/components/select/src/select.vue.d.ts +0 -1
  284. package/es/components/select/src/useSelect.d.ts +0 -1
  285. package/es/components/select/src/useSelect.mjs +1 -4
  286. package/es/components/select/src/useSelect.mjs.map +1 -1
  287. package/es/components/select-v2/src/useSelect.mjs +19 -10
  288. package/es/components/select-v2/src/useSelect.mjs.map +1 -1
  289. package/es/components/switch/index.d.ts +38 -35
  290. package/es/components/switch/src/switch.d.ts +26 -11
  291. package/es/components/switch/src/switch.mjs +21 -21
  292. package/es/components/switch/src/switch.mjs.map +1 -1
  293. package/es/components/switch/src/switch.vue.d.ts +38 -35
  294. package/es/components/switch/src/switch2.mjs +33 -21
  295. package/es/components/switch/src/switch2.mjs.map +1 -1
  296. package/es/components/table/index.d.ts +21 -5
  297. package/es/components/table/src/store/watcher.mjs +1 -1
  298. package/es/components/table/src/store/watcher.mjs.map +1 -1
  299. package/es/components/table/src/table/defaults.d.ts +3 -0
  300. package/es/components/table/src/table/defaults.mjs +2 -1
  301. package/es/components/table/src/table/defaults.mjs.map +1 -1
  302. package/es/components/table/src/table/style-helper.mjs +4 -2
  303. package/es/components/table/src/table/style-helper.mjs.map +1 -1
  304. package/es/components/table/src/table/utils-helper.d.ts +1 -1
  305. package/es/components/table/src/table/utils-helper.mjs.map +1 -1
  306. package/es/components/table/src/table-column/defaults.d.ts +4 -1
  307. package/es/components/table/src/table-column/defaults.mjs +4 -1
  308. package/es/components/table/src/table-column/defaults.mjs.map +1 -1
  309. package/es/components/table/src/table-column/index.d.ts +9 -2
  310. package/es/components/table/src/table-column/index.mjs +3 -1
  311. package/es/components/table/src/table-column/index.mjs.map +1 -1
  312. package/es/components/table/src/table.vue.d.ts +3 -1
  313. package/es/components/teleport/index.mjs +2 -2
  314. package/es/components/teleport/src/teleport.mjs +18 -44
  315. package/es/components/teleport/src/teleport.mjs.map +1 -1
  316. package/es/components/teleport/src/teleport2.mjs +44 -18
  317. package/es/components/teleport/src/teleport2.mjs.map +1 -1
  318. package/es/components/time-picker/src/common/picker.mjs +19 -18
  319. package/es/components/time-picker/src/common/picker.mjs.map +1 -1
  320. package/es/components/time-picker/src/common/picker.vue.d.ts +5 -0
  321. package/es/components/time-picker/src/time-picker-com/basic-time-spinner.mjs +7 -1
  322. package/es/components/time-picker/src/time-picker-com/basic-time-spinner.mjs.map +1 -1
  323. package/es/components/time-picker/src/time-picker-com/basic-time-spinner.vue.d.ts +526 -526
  324. package/es/components/time-picker/src/time-picker-com/panel-time-range.mjs +14 -12
  325. package/es/components/time-picker/src/time-picker-com/panel-time-range.mjs.map +1 -1
  326. package/es/components/time-picker/src/time-picker-com/panel-time-range.vue.d.ts +2 -0
  327. package/es/components/time-select/index.d.ts +0 -4
  328. package/es/components/time-select/src/time-select.vue.d.ts +0 -2
  329. package/es/components/tooltip-v2/index.mjs +1 -1
  330. package/es/components/tooltip-v2/src/tooltip.mjs +1 -1
  331. package/es/components/tooltip-v2/src/tooltip2.mjs +2 -2
  332. package/es/components/tooltip-v2/src/trigger.mjs +89 -12
  333. package/es/components/tooltip-v2/src/trigger.mjs.map +1 -1
  334. package/es/components/tooltip-v2/src/trigger2.mjs +12 -89
  335. package/es/components/tooltip-v2/src/trigger2.mjs.map +1 -1
  336. package/es/components/upload/src/upload-list2.mjs +7 -5
  337. package/es/components/upload/src/upload-list2.mjs.map +1 -1
  338. package/es/index.mjs +2 -2
  339. package/es/locale/lang/sr.mjs +9 -9
  340. package/es/locale/lang/sr.mjs.map +1 -1
  341. package/es/version.d.ts +1 -1
  342. package/es/version.mjs +1 -1
  343. package/es/version.mjs.map +1 -1
  344. package/lib/components/backtop/src/use-backtop.js +1 -0
  345. package/lib/components/backtop/src/use-backtop.js.map +1 -1
  346. package/lib/components/calendar/index.d.ts +1 -1
  347. package/lib/components/calendar/index.js.map +1 -1
  348. package/lib/components/dialog/src/dialog-content.js.map +1 -1
  349. package/lib/components/form/index.d.ts +4 -4
  350. package/lib/components/form/src/form.d.ts +1 -1
  351. package/lib/components/form/src/form.js +1 -4
  352. package/lib/components/form/src/form.js.map +1 -1
  353. package/lib/components/form/src/form.vue.d.ts +4 -4
  354. package/lib/components/form/src/types.d.ts +62 -1
  355. package/lib/components/image/index.d.ts +24 -21
  356. package/lib/components/image/src/image.d.ts +3 -3
  357. package/lib/components/image/src/image.js +3 -12
  358. package/lib/components/image/src/image.js.map +1 -1
  359. package/lib/components/image/src/image.vue.d.ts +24 -21
  360. package/lib/components/image/src/image2.js +6 -5
  361. package/lib/components/image/src/image2.js.map +1 -1
  362. package/lib/components/image-viewer/index.d.ts +10 -8
  363. package/lib/components/image-viewer/src/image-viewer.d.ts +2 -2
  364. package/lib/components/image-viewer/src/image-viewer.js +2 -8
  365. package/lib/components/image-viewer/src/image-viewer.js.map +1 -1
  366. package/lib/components/image-viewer/src/image-viewer.vue.d.ts +10 -8
  367. package/lib/components/image-viewer/src/image-viewer2.js +12 -10
  368. package/lib/components/image-viewer/src/image-viewer2.js.map +1 -1
  369. package/lib/components/index.js +2 -2
  370. package/lib/components/input/src/input2.js +3 -3
  371. package/lib/components/input/src/input2.js.map +1 -1
  372. package/lib/components/pagination/src/components/sizes.vue.d.ts +0 -1
  373. package/lib/components/radio/index.js +2 -2
  374. package/lib/components/radio/src/radio-button.js +1 -1
  375. package/lib/components/radio/src/radio-group.js +1 -1
  376. package/lib/components/radio/src/radio.js +32 -71
  377. package/lib/components/radio/src/radio.js.map +1 -1
  378. package/lib/components/radio/src/radio2.js +71 -32
  379. package/lib/components/radio/src/radio2.js.map +1 -1
  380. package/lib/components/scrollbar/index.js +2 -2
  381. package/lib/components/scrollbar/src/scrollbar.js +174 -47
  382. package/lib/components/scrollbar/src/scrollbar.js.map +1 -1
  383. package/lib/components/scrollbar/src/scrollbar2.js +47 -174
  384. package/lib/components/scrollbar/src/scrollbar2.js.map +1 -1
  385. package/lib/components/select/index.d.ts +0 -1
  386. package/lib/components/select/src/select.js +7 -8
  387. package/lib/components/select/src/select.js.map +1 -1
  388. package/lib/components/select/src/select.vue.d.ts +0 -1
  389. package/lib/components/select/src/useSelect.d.ts +0 -1
  390. package/lib/components/select/src/useSelect.js +1 -4
  391. package/lib/components/select/src/useSelect.js.map +1 -1
  392. package/lib/components/select-v2/src/useSelect.js +19 -10
  393. package/lib/components/select-v2/src/useSelect.js.map +1 -1
  394. package/lib/components/switch/index.d.ts +38 -35
  395. package/lib/components/switch/src/switch.d.ts +26 -11
  396. package/lib/components/switch/src/switch.js +21 -21
  397. package/lib/components/switch/src/switch.js.map +1 -1
  398. package/lib/components/switch/src/switch.vue.d.ts +38 -35
  399. package/lib/components/switch/src/switch2.js +33 -21
  400. package/lib/components/switch/src/switch2.js.map +1 -1
  401. package/lib/components/table/index.d.ts +21 -5
  402. package/lib/components/table/src/store/watcher.js +1 -1
  403. package/lib/components/table/src/store/watcher.js.map +1 -1
  404. package/lib/components/table/src/table/defaults.d.ts +3 -0
  405. package/lib/components/table/src/table/defaults.js +2 -1
  406. package/lib/components/table/src/table/defaults.js.map +1 -1
  407. package/lib/components/table/src/table/style-helper.js +4 -2
  408. package/lib/components/table/src/table/style-helper.js.map +1 -1
  409. package/lib/components/table/src/table/utils-helper.d.ts +1 -1
  410. package/lib/components/table/src/table/utils-helper.js.map +1 -1
  411. package/lib/components/table/src/table-column/defaults.d.ts +4 -1
  412. package/lib/components/table/src/table-column/defaults.js +4 -1
  413. package/lib/components/table/src/table-column/defaults.js.map +1 -1
  414. package/lib/components/table/src/table-column/index.d.ts +9 -2
  415. package/lib/components/table/src/table-column/index.js +3 -1
  416. package/lib/components/table/src/table-column/index.js.map +1 -1
  417. package/lib/components/table/src/table.vue.d.ts +3 -1
  418. package/lib/components/teleport/index.js +2 -2
  419. package/lib/components/teleport/src/teleport.js +18 -44
  420. package/lib/components/teleport/src/teleport.js.map +1 -1
  421. package/lib/components/teleport/src/teleport2.js +44 -18
  422. package/lib/components/teleport/src/teleport2.js.map +1 -1
  423. package/lib/components/time-picker/src/common/picker.js +18 -17
  424. package/lib/components/time-picker/src/common/picker.js.map +1 -1
  425. package/lib/components/time-picker/src/common/picker.vue.d.ts +5 -0
  426. package/lib/components/time-picker/src/time-picker-com/basic-time-spinner.js +7 -1
  427. package/lib/components/time-picker/src/time-picker-com/basic-time-spinner.js.map +1 -1
  428. package/lib/components/time-picker/src/time-picker-com/basic-time-spinner.vue.d.ts +526 -526
  429. package/lib/components/time-picker/src/time-picker-com/panel-time-range.js +14 -12
  430. package/lib/components/time-picker/src/time-picker-com/panel-time-range.js.map +1 -1
  431. package/lib/components/time-picker/src/time-picker-com/panel-time-range.vue.d.ts +2 -0
  432. package/lib/components/time-select/index.d.ts +0 -4
  433. package/lib/components/time-select/src/time-select.vue.d.ts +0 -2
  434. package/lib/components/tooltip-v2/index.js +1 -1
  435. package/lib/components/tooltip-v2/src/tooltip.js +1 -1
  436. package/lib/components/tooltip-v2/src/tooltip2.js +2 -2
  437. package/lib/components/tooltip-v2/src/trigger.js +89 -12
  438. package/lib/components/tooltip-v2/src/trigger.js.map +1 -1
  439. package/lib/components/tooltip-v2/src/trigger2.js +12 -89
  440. package/lib/components/tooltip-v2/src/trigger2.js.map +1 -1
  441. package/lib/components/upload/src/upload-list2.js +7 -5
  442. package/lib/components/upload/src/upload-list2.js.map +1 -1
  443. package/lib/index.js +2 -2
  444. package/lib/locale/lang/sr.js +9 -9
  445. package/lib/locale/lang/sr.js.map +1 -1
  446. package/lib/version.d.ts +1 -1
  447. package/lib/version.js +1 -1
  448. package/lib/version.js.map +1 -1
  449. package/package.json +2 -2
  450. package/tags.json +1 -1
  451. package/theme-chalk/el-checkbox-button.css +1 -1
  452. package/theme-chalk/el-date-picker.css +1 -1
  453. package/theme-chalk/el-form.css +1 -1
  454. package/theme-chalk/el-input-number.css +1 -1
  455. package/theme-chalk/el-input.css +1 -1
  456. package/theme-chalk/el-tag.css +1 -1
  457. package/theme-chalk/el-time-picker.css +1 -1
  458. package/theme-chalk/el-time-select.css +1 -1
  459. package/theme-chalk/index.css +1 -1
  460. package/theme-chalk/src/alert.scss +0 -2
  461. package/theme-chalk/src/badge.scss +0 -3
  462. package/theme-chalk/src/carousel.scss +0 -2
  463. package/theme-chalk/src/check-tag.scss +0 -2
  464. package/theme-chalk/src/checkbox-button.scss +1 -1
  465. package/theme-chalk/src/common/var.scss +2 -0
  466. package/theme-chalk/src/dark/css-vars.scss +0 -2
  467. package/theme-chalk/src/date-picker/picker.scss +0 -1
  468. package/theme-chalk/src/form.scss +7 -0
  469. package/theme-chalk/src/icon.scss +0 -2
  470. package/theme-chalk/src/input-number.scss +1 -1
  471. package/theme-chalk/src/input.scss +1 -1
  472. package/theme-chalk/src/loading.scss +0 -2
  473. package/theme-chalk/src/message.scss +0 -2
  474. package/theme-chalk/src/mixins/_button.scss +0 -2
  475. package/theme-chalk/src/pagination.scss +0 -2
  476. package/theme-chalk/src/table-v2.scss +0 -2
  477. package/theme-chalk/src/tag.scss +1 -1
  478. package/theme-chalk/src/timeline-item.scss +0 -1
  479. package/theme-chalk/src/transfer.scss +0 -3
  480. package/theme-chalk/src/var.scss +0 -2
  481. package/web-types.json +1 -1
@@ -1,36 +1,77 @@
1
- import '../../../utils/index.mjs';
2
- import '../../../constants/index.mjs';
1
+ import { defineComponent, nextTick, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, withDirectives, isRef, vModelRadio, withModifiers, renderSlot, createTextVNode, toDisplayString } from 'vue';
3
2
  import '../../../hooks/index.mjs';
4
- import { buildProps } from '../../../utils/vue/props/runtime.mjs';
5
- import { useSizeProp } from '../../../hooks/use-size/index.mjs';
6
- import { UPDATE_MODEL_EVENT, CHANGE_EVENT } from '../../../constants/event.mjs';
7
- import { isString } from '@vue/shared';
8
- import { isNumber, isBoolean } from '../../../utils/types.mjs';
3
+ import { radioProps, radioEmits } from './radio.mjs';
4
+ import { useRadio } from './use-radio.mjs';
5
+ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
6
+ import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
9
7
 
10
- const radioPropsBase = buildProps({
11
- size: useSizeProp,
12
- disabled: Boolean,
13
- label: {
14
- type: [String, Number, Boolean],
15
- default: ""
16
- }
8
+ const _hoisted_1 = ["value", "name", "disabled"];
9
+ const __default__ = defineComponent({
10
+ name: "ElRadio"
17
11
  });
18
- const radioProps = buildProps({
19
- ...radioPropsBase,
20
- modelValue: {
21
- type: [String, Number, Boolean],
22
- default: ""
23
- },
24
- name: {
25
- type: String,
26
- default: ""
27
- },
28
- border: Boolean
12
+ const _sfc_main = /* @__PURE__ */ defineComponent({
13
+ ...__default__,
14
+ props: radioProps,
15
+ emits: radioEmits,
16
+ setup(__props, { emit }) {
17
+ const props = __props;
18
+ const ns = useNamespace("radio");
19
+ const { radioRef, radioGroup, focus, size, disabled, modelValue } = useRadio(props, emit);
20
+ function handleChange() {
21
+ nextTick(() => emit("change", modelValue.value));
22
+ }
23
+ return (_ctx, _cache) => {
24
+ var _a;
25
+ return openBlock(), createElementBlock("label", {
26
+ class: normalizeClass([
27
+ unref(ns).b(),
28
+ unref(ns).is("disabled", unref(disabled)),
29
+ unref(ns).is("focus", unref(focus)),
30
+ unref(ns).is("bordered", _ctx.border),
31
+ unref(ns).is("checked", unref(modelValue) === _ctx.label),
32
+ unref(ns).m(unref(size))
33
+ ])
34
+ }, [
35
+ createElementVNode("span", {
36
+ class: normalizeClass([
37
+ unref(ns).e("input"),
38
+ unref(ns).is("disabled", unref(disabled)),
39
+ unref(ns).is("checked", unref(modelValue) === _ctx.label)
40
+ ])
41
+ }, [
42
+ withDirectives(createElementVNode("input", {
43
+ ref_key: "radioRef",
44
+ ref: radioRef,
45
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
46
+ class: normalizeClass(unref(ns).e("original")),
47
+ value: _ctx.label,
48
+ name: _ctx.name || ((_a = unref(radioGroup)) == null ? void 0 : _a.name),
49
+ disabled: unref(disabled),
50
+ type: "radio",
51
+ onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
52
+ onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
53
+ onChange: handleChange
54
+ }, null, 42, _hoisted_1), [
55
+ [vModelRadio, unref(modelValue)]
56
+ ]),
57
+ createElementVNode("span", {
58
+ class: normalizeClass(unref(ns).e("inner"))
59
+ }, null, 2)
60
+ ], 2),
61
+ createElementVNode("span", {
62
+ class: normalizeClass(unref(ns).e("label")),
63
+ onKeydown: _cache[3] || (_cache[3] = withModifiers(() => {
64
+ }, ["stop"]))
65
+ }, [
66
+ renderSlot(_ctx.$slots, "default", {}, () => [
67
+ createTextVNode(toDisplayString(_ctx.label), 1)
68
+ ])
69
+ ], 34)
70
+ ], 2);
71
+ };
72
+ }
29
73
  });
30
- const radioEmits = {
31
- [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
32
- [CHANGE_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val)
33
- };
74
+ var Radio = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio.vue"]]);
34
75
 
35
- export { radioEmits, radioProps, radioPropsBase };
76
+ export { Radio as default };
36
77
  //# sourceMappingURL=radio2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio2.mjs","sources":["../../../../../../packages/components/radio/src/radio.ts"],"sourcesContent":["import { buildProps, isBoolean, isNumber, isString } from '@element-plus/utils'\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { useSizeProp } from '@element-plus/hooks'\nimport type { ExtractPropTypes } from 'vue'\nimport type Radio from './radio.vue'\n\nexport const radioPropsBase = buildProps({\n /**\n * @description size of the Radio\n */\n size: useSizeProp,\n /**\n * @description whether Radio is disabled\n */\n disabled: Boolean,\n /**\n * @description the value of Radio\n */\n label: {\n type: [String, Number, Boolean],\n default: '',\n },\n})\n\nexport const radioProps = buildProps({\n ...radioPropsBase,\n /**\n * @description binding value\n */\n modelValue: {\n type: [String, Number, Boolean],\n default: '',\n },\n /**\n * @description native `name` attribute\n */\n name: {\n type: String,\n default: '',\n },\n /**\n * @description whether to add a border around Radio\n */\n border: Boolean,\n} as const)\n\nexport const radioEmits = {\n [UPDATE_MODEL_EVENT]: (val: string | number | boolean) =>\n isString(val) || isNumber(val) || isBoolean(val),\n [CHANGE_EVENT]: (val: string | number | boolean) =>\n isString(val) || isNumber(val) || isBoolean(val),\n}\n\nexport type RadioProps = ExtractPropTypes<typeof radioProps>\nexport type RadioEmits = typeof radioEmits\nexport type RadioInstance = InstanceType<typeof Radio>\n"],"names":[],"mappings":";;;;;;;;;AAGY,MAAC,cAAc,GAAG,UAAU,CAAC;AACzC,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;AACnC,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,CAAC,EAAE;AACS,MAAC,UAAU,GAAG,UAAU,CAAC;AACrC,EAAE,GAAG,cAAc;AACnB,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;AACnC,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE,OAAO;AACjB,CAAC,EAAE;AACS,MAAC,UAAU,GAAG;AAC1B,EAAE,CAAC,kBAAkB,GAAG,CAAC,GAAG,KAAK,QAAQ,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC;AACjF,EAAE,CAAC,YAAY,GAAG,CAAC,GAAG,KAAK,QAAQ,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC;AAC3E;;;;"}
1
+ {"version":3,"file":"radio2.mjs","sources":["../../../../../../packages/components/radio/src/radio.vue"],"sourcesContent":["<template>\n <label\n :class=\"[\n ns.b(),\n ns.is('disabled', disabled),\n ns.is('focus', focus),\n ns.is('bordered', border),\n ns.is('checked', modelValue === label),\n ns.m(size),\n ]\"\n >\n <span\n :class=\"[\n ns.e('input'),\n ns.is('disabled', disabled),\n ns.is('checked', modelValue === label),\n ]\"\n >\n <input\n ref=\"radioRef\"\n v-model=\"modelValue\"\n :class=\"ns.e('original')\"\n :value=\"label\"\n :name=\"name || radioGroup?.name\"\n :disabled=\"disabled\"\n type=\"radio\"\n @focus=\"focus = true\"\n @blur=\"focus = false\"\n @change=\"handleChange\"\n />\n <span :class=\"ns.e('inner')\" />\n </span>\n <span :class=\"ns.e('label')\" @keydown.stop>\n <slot>\n {{ label }}\n </slot>\n </span>\n </label>\n</template>\n\n<script lang=\"ts\" setup>\nimport { nextTick } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { radioEmits, radioProps } from './radio'\nimport { useRadio } from './use-radio'\n\ndefineOptions({\n name: 'ElRadio',\n})\n\nconst props = defineProps(radioProps)\nconst emit = defineEmits(radioEmits)\n\nconst ns = useNamespace('radio')\nconst { radioRef, radioGroup, focus, size, disabled, modelValue } = useRadio(\n props,\n emit\n)\n\nfunction handleChange() {\n nextTick(() => emit('change', modelValue.value))\n}\n</script>\n"],"names":[],"mappings":";;;;;;;;mCA8Cc,CAAA;AAAA,EACZ,IAAM,EAAA,SAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAM,MAAA,EAAA,GAAK,aAAa,OAAO,CAAA,CAAA;AAC/B,IAAM,MAAA,EAAE,UAAU,UAAY,EAAA,KAAA,EAAO,MAAM,QAAU,EAAA,UAAA,EAAA,GAAe,QAClE,CAAA,KAAA,EACA,IACF,CAAA,CAAA;AAEA,IAAwB,SAAA,YAAA,GAAA;AACtB,MAAA,QAAA,CAAS,MAAM,IAAA,CAAK,QAAU,EAAA,UAAA,CAAW,KAAK,CAAC,CAAA,CAAA;AAAA,KACjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  import '../../utils/index.mjs';
2
- import Scrollbar from './src/scrollbar2.mjs';
2
+ import Scrollbar from './src/scrollbar.mjs';
3
3
  export { BAR_MAP, GAP, renderThumbStyle } from './src/util.mjs';
4
- export { scrollbarEmits, scrollbarProps } from './src/scrollbar.mjs';
4
+ export { scrollbarEmits, scrollbarProps } from './src/scrollbar2.mjs';
5
5
  export { thumbProps } from './src/thumb.mjs';
6
6
  export { scrollbarContextKey } from './src/constants.mjs';
7
7
  import { withInstall } from '../../utils/vue/install.mjs';
@@ -1,53 +1,181 @@
1
+ import { defineComponent, ref, computed, watch, nextTick, provide, reactive, onMounted, onUpdated, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, normalizeStyle, createBlock, resolveDynamicComponent, withCtx, renderSlot, createCommentVNode } from 'vue';
2
+ import { useResizeObserver, useEventListener } from '@vueuse/core';
1
3
  import '../../../utils/index.mjs';
2
- import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
4
+ import '../../../hooks/index.mjs';
5
+ import { GAP } from './util.mjs';
6
+ import Bar from './bar2.mjs';
7
+ import { scrollbarContextKey } from './constants.mjs';
8
+ import { scrollbarProps, scrollbarEmits } from './scrollbar2.mjs';
9
+ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
10
+ import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
11
+ import { addUnit } from '../../../utils/dom/style.mjs';
12
+ import { isObject } from '@vue/shared';
3
13
  import { isNumber } from '../../../utils/types.mjs';
14
+ import { debugWarn } from '../../../utils/error.mjs';
4
15
 
5
- const scrollbarProps = buildProps({
6
- height: {
7
- type: [String, Number],
8
- default: ""
9
- },
10
- maxHeight: {
11
- type: [String, Number],
12
- default: ""
13
- },
14
- native: {
15
- type: Boolean,
16
- default: false
17
- },
18
- wrapStyle: {
19
- type: definePropType([String, Object, Array]),
20
- default: ""
21
- },
22
- wrapClass: {
23
- type: [String, Array],
24
- default: ""
25
- },
26
- viewClass: {
27
- type: [String, Array],
28
- default: ""
29
- },
30
- viewStyle: {
31
- type: [String, Array, Object],
32
- default: ""
33
- },
34
- noresize: Boolean,
35
- tag: {
36
- type: String,
37
- default: "div"
38
- },
39
- always: Boolean,
40
- minSize: {
41
- type: Number,
42
- default: 20
16
+ const COMPONENT_NAME = "ElScrollbar";
17
+ const __default__ = defineComponent({
18
+ name: COMPONENT_NAME
19
+ });
20
+ const _sfc_main = /* @__PURE__ */ defineComponent({
21
+ ...__default__,
22
+ props: scrollbarProps,
23
+ emits: scrollbarEmits,
24
+ setup(__props, { expose, emit }) {
25
+ const props = __props;
26
+ const ns = useNamespace("scrollbar");
27
+ let stopResizeObserver = void 0;
28
+ let stopResizeListener = void 0;
29
+ const scrollbarRef = ref();
30
+ const wrapRef = ref();
31
+ const resizeRef = ref();
32
+ const sizeWidth = ref("0");
33
+ const sizeHeight = ref("0");
34
+ const barRef = ref();
35
+ const ratioY = ref(1);
36
+ const ratioX = ref(1);
37
+ const style = computed(() => {
38
+ const style2 = {};
39
+ if (props.height)
40
+ style2.height = addUnit(props.height);
41
+ if (props.maxHeight)
42
+ style2.maxHeight = addUnit(props.maxHeight);
43
+ return [props.wrapStyle, style2];
44
+ });
45
+ const wrapKls = computed(() => {
46
+ return [
47
+ props.wrapClass,
48
+ ns.e("wrap"),
49
+ { [ns.em("wrap", "hidden-default")]: !props.native }
50
+ ];
51
+ });
52
+ const resizeKls = computed(() => {
53
+ return [ns.e("view"), props.viewClass];
54
+ });
55
+ const handleScroll = () => {
56
+ var _a;
57
+ if (wrapRef.value) {
58
+ (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
59
+ emit("scroll", {
60
+ scrollTop: wrapRef.value.scrollTop,
61
+ scrollLeft: wrapRef.value.scrollLeft
62
+ });
63
+ }
64
+ };
65
+ function scrollTo(arg1, arg2) {
66
+ if (isObject(arg1)) {
67
+ wrapRef.value.scrollTo(arg1);
68
+ } else if (isNumber(arg1) && isNumber(arg2)) {
69
+ wrapRef.value.scrollTo(arg1, arg2);
70
+ }
71
+ }
72
+ const setScrollTop = (value) => {
73
+ if (!isNumber(value)) {
74
+ debugWarn(COMPONENT_NAME, "value must be a number");
75
+ return;
76
+ }
77
+ wrapRef.value.scrollTop = value;
78
+ };
79
+ const setScrollLeft = (value) => {
80
+ if (!isNumber(value)) {
81
+ debugWarn(COMPONENT_NAME, "value must be a number");
82
+ return;
83
+ }
84
+ wrapRef.value.scrollLeft = value;
85
+ };
86
+ const update = () => {
87
+ if (!wrapRef.value)
88
+ return;
89
+ const offsetHeight = wrapRef.value.offsetHeight - GAP;
90
+ const offsetWidth = wrapRef.value.offsetWidth - GAP;
91
+ const originalHeight = offsetHeight ** 2 / wrapRef.value.scrollHeight;
92
+ const originalWidth = offsetWidth ** 2 / wrapRef.value.scrollWidth;
93
+ const height = Math.max(originalHeight, props.minSize);
94
+ const width = Math.max(originalWidth, props.minSize);
95
+ ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
96
+ ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
97
+ sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
98
+ sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
99
+ };
100
+ watch(() => props.noresize, (noresize) => {
101
+ if (noresize) {
102
+ stopResizeObserver == null ? void 0 : stopResizeObserver();
103
+ stopResizeListener == null ? void 0 : stopResizeListener();
104
+ } else {
105
+ ;
106
+ ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
107
+ stopResizeListener = useEventListener("resize", update);
108
+ }
109
+ }, { immediate: true });
110
+ watch(() => [props.maxHeight, props.height], () => {
111
+ if (!props.native)
112
+ nextTick(() => {
113
+ var _a;
114
+ update();
115
+ if (wrapRef.value) {
116
+ (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
117
+ }
118
+ });
119
+ });
120
+ provide(scrollbarContextKey, reactive({
121
+ scrollbarElement: scrollbarRef,
122
+ wrapElement: wrapRef
123
+ }));
124
+ onMounted(() => {
125
+ if (!props.native)
126
+ nextTick(() => {
127
+ update();
128
+ });
129
+ });
130
+ onUpdated(() => update());
131
+ expose({
132
+ wrapRef,
133
+ update,
134
+ scrollTo,
135
+ setScrollTop,
136
+ setScrollLeft,
137
+ handleScroll
138
+ });
139
+ return (_ctx, _cache) => {
140
+ return openBlock(), createElementBlock("div", {
141
+ ref_key: "scrollbarRef",
142
+ ref: scrollbarRef,
143
+ class: normalizeClass(unref(ns).b())
144
+ }, [
145
+ createElementVNode("div", {
146
+ ref_key: "wrapRef",
147
+ ref: wrapRef,
148
+ class: normalizeClass(unref(wrapKls)),
149
+ style: normalizeStyle(unref(style)),
150
+ onScroll: handleScroll
151
+ }, [
152
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
153
+ ref_key: "resizeRef",
154
+ ref: resizeRef,
155
+ class: normalizeClass(unref(resizeKls)),
156
+ style: normalizeStyle(_ctx.viewStyle)
157
+ }, {
158
+ default: withCtx(() => [
159
+ renderSlot(_ctx.$slots, "default")
160
+ ]),
161
+ _: 3
162
+ }, 8, ["class", "style"]))
163
+ ], 38),
164
+ !_ctx.native ? (openBlock(), createBlock(Bar, {
165
+ key: 0,
166
+ ref_key: "barRef",
167
+ ref: barRef,
168
+ height: sizeHeight.value,
169
+ width: sizeWidth.value,
170
+ always: _ctx.always,
171
+ "ratio-x": ratioX.value,
172
+ "ratio-y": ratioY.value
173
+ }, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : createCommentVNode("v-if", true)
174
+ ], 2);
175
+ };
43
176
  }
44
177
  });
45
- const scrollbarEmits = {
46
- scroll: ({
47
- scrollTop,
48
- scrollLeft
49
- }) => [scrollTop, scrollLeft].every(isNumber)
50
- };
178
+ var Scrollbar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/scrollbar.vue"]]);
51
179
 
52
- export { scrollbarEmits, scrollbarProps };
180
+ export { Scrollbar as default };
53
181
  //# sourceMappingURL=scrollbar.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"scrollbar.mjs","sources":["../../../../../../packages/components/scrollbar/src/scrollbar.ts"],"sourcesContent":["import { buildProps, definePropType, isNumber } from '@element-plus/utils'\nimport type { ExtractPropTypes, StyleValue } from 'vue'\nimport type Scrollbar from './scrollbar.vue'\n\nexport const scrollbarProps = buildProps({\n /**\n * @description height of scrollbar\n */\n height: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description max height of scrollbar\n */\n maxHeight: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description whether to use the native scrollbar\n */\n native: {\n type: Boolean,\n default: false,\n },\n /**\n * @description style of wrap\n */\n wrapStyle: {\n type: definePropType<StyleValue>([String, Object, Array]),\n default: '',\n },\n /**\n * @description class of wrap\n */\n wrapClass: {\n type: [String, Array],\n default: '',\n },\n /**\n * @description class of view\n */\n viewClass: {\n type: [String, Array],\n default: '',\n },\n /**\n * @description style of view\n */\n viewStyle: {\n type: [String, Array, Object],\n default: '',\n },\n /**\n * @description do not respond to container size changes, if the container size does not change, it is better to set it to optimize performance\n */\n noresize: Boolean, // 如果 container 尺寸不会发生变化,最好设置它可以优化性能\n /**\n * @description element tag of the view\n */\n tag: {\n type: String,\n default: 'div',\n },\n /**\n * @description always show\n */\n always: Boolean,\n /**\n * @description minimum size of scrollbar\n */\n minSize: {\n type: Number,\n default: 20,\n },\n} as const)\nexport type ScrollbarProps = ExtractPropTypes<typeof scrollbarProps>\n\nexport const scrollbarEmits = {\n scroll: ({\n scrollTop,\n scrollLeft,\n }: {\n scrollTop: number\n scrollLeft: number\n }) => [scrollTop, scrollLeft].every(isNumber),\n}\nexport type ScrollbarEmits = typeof scrollbarEmits\n\nexport type ScrollbarInstance = InstanceType<typeof Scrollbar>\n"],"names":[],"mappings":";;;;AACY,MAAC,cAAc,GAAG,UAAU,CAAC;AACzC,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACjD,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;AACzB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;AACzB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC;AACjC,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,GAAG,EAAE;AACP,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,MAAM,EAAE,OAAO;AACjB,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,CAAC,EAAE;AACS,MAAC,cAAc,GAAG;AAC9B,EAAE,MAAM,EAAE,CAAC;AACX,IAAI,SAAS;AACb,IAAI,UAAU;AACd,GAAG,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC;AAC/C;;;;"}
1
+ {"version":3,"file":"scrollbar.mjs","sources":["../../../../../../packages/components/scrollbar/src/scrollbar.vue"],"sourcesContent":["<template>\n <div ref=\"scrollbarRef\" :class=\"ns.b()\">\n <div ref=\"wrapRef\" :class=\"wrapKls\" :style=\"style\" @scroll=\"handleScroll\">\n <component\n :is=\"tag\"\n ref=\"resizeRef\"\n :class=\"resizeKls\"\n :style=\"viewStyle\"\n >\n <slot />\n </component>\n </div>\n <template v-if=\"!native\">\n <bar\n ref=\"barRef\"\n :height=\"sizeHeight\"\n :width=\"sizeWidth\"\n :always=\"always\"\n :ratio-x=\"ratioX\"\n :ratio-y=\"ratioY\"\n />\n </template>\n </div>\n</template>\n<script lang=\"ts\" setup>\nimport {\n computed,\n nextTick,\n onMounted,\n onUpdated,\n provide,\n reactive,\n ref,\n watch,\n} from 'vue'\nimport { useEventListener, useResizeObserver } from '@vueuse/core'\nimport { addUnit, debugWarn, isNumber, isObject } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { GAP } from './util'\nimport Bar from './bar.vue'\nimport { scrollbarContextKey } from './constants'\nimport { scrollbarEmits, scrollbarProps } from './scrollbar'\nimport type { BarInstance } from './bar'\nimport type { CSSProperties, StyleValue } from 'vue'\n\nconst COMPONENT_NAME = 'ElScrollbar'\n\ndefineOptions({\n name: COMPONENT_NAME,\n})\n\nconst props = defineProps(scrollbarProps)\nconst emit = defineEmits(scrollbarEmits)\n\nconst ns = useNamespace('scrollbar')\n\nlet stopResizeObserver: (() => void) | undefined = undefined\nlet stopResizeListener: (() => void) | undefined = undefined\n\nconst scrollbarRef = ref<HTMLDivElement>()\nconst wrapRef = ref<HTMLDivElement>()\nconst resizeRef = ref<HTMLElement>()\n\nconst sizeWidth = ref('0')\nconst sizeHeight = ref('0')\nconst barRef = ref<BarInstance>()\nconst ratioY = ref(1)\nconst ratioX = ref(1)\n\nconst style = computed<StyleValue>(() => {\n const style: CSSProperties = {}\n if (props.height) style.height = addUnit(props.height)\n if (props.maxHeight) style.maxHeight = addUnit(props.maxHeight)\n return [props.wrapStyle, style]\n})\n\nconst wrapKls = computed(() => {\n return [\n props.wrapClass,\n ns.e('wrap'),\n { [ns.em('wrap', 'hidden-default')]: !props.native },\n ]\n})\n\nconst resizeKls = computed(() => {\n return [ns.e('view'), props.viewClass]\n})\n\nconst handleScroll = () => {\n if (wrapRef.value) {\n barRef.value?.handleScroll(wrapRef.value)\n\n emit('scroll', {\n scrollTop: wrapRef.value.scrollTop,\n scrollLeft: wrapRef.value.scrollLeft,\n })\n }\n}\n\n// TODO: refactor method overrides, due to script setup dts\n// @ts-nocheck\nfunction scrollTo(xCord: number, yCord?: number): void\nfunction scrollTo(options: ScrollToOptions): void\nfunction scrollTo(arg1: unknown, arg2?: number) {\n if (isObject(arg1)) {\n wrapRef.value!.scrollTo(arg1)\n } else if (isNumber(arg1) && isNumber(arg2)) {\n wrapRef.value!.scrollTo(arg1, arg2)\n }\n}\n\nconst setScrollTop = (value: number) => {\n if (!isNumber(value)) {\n debugWarn(COMPONENT_NAME, 'value must be a number')\n return\n }\n wrapRef.value!.scrollTop = value\n}\n\nconst setScrollLeft = (value: number) => {\n if (!isNumber(value)) {\n debugWarn(COMPONENT_NAME, 'value must be a number')\n return\n }\n wrapRef.value!.scrollLeft = value\n}\n\nconst update = () => {\n if (!wrapRef.value) return\n const offsetHeight = wrapRef.value.offsetHeight - GAP\n const offsetWidth = wrapRef.value.offsetWidth - GAP\n\n const originalHeight = offsetHeight ** 2 / wrapRef.value.scrollHeight\n const originalWidth = offsetWidth ** 2 / wrapRef.value.scrollWidth\n const height = Math.max(originalHeight, props.minSize)\n const width = Math.max(originalWidth, props.minSize)\n\n ratioY.value =\n originalHeight /\n (offsetHeight - originalHeight) /\n (height / (offsetHeight - height))\n ratioX.value =\n originalWidth /\n (offsetWidth - originalWidth) /\n (width / (offsetWidth - width))\n\n sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : ''\n sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : ''\n}\n\nwatch(\n () => props.noresize,\n (noresize) => {\n if (noresize) {\n stopResizeObserver?.()\n stopResizeListener?.()\n } else {\n ;({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update))\n stopResizeListener = useEventListener('resize', update)\n }\n },\n { immediate: true }\n)\n\nwatch(\n () => [props.maxHeight, props.height],\n () => {\n if (!props.native)\n nextTick(() => {\n update()\n if (wrapRef.value) {\n barRef.value?.handleScroll(wrapRef.value)\n }\n })\n }\n)\n\nprovide(\n scrollbarContextKey,\n reactive({\n scrollbarElement: scrollbarRef,\n wrapElement: wrapRef,\n })\n)\n\nonMounted(() => {\n if (!props.native)\n nextTick(() => {\n update()\n })\n})\nonUpdated(() => update())\n\ndefineExpose({\n /** @description scrollbar wrap ref */\n wrapRef,\n /** @description update scrollbar state manually */\n update,\n /** @description scrolls to a particular set of coordinates */\n scrollTo,\n /** @description set distance to scroll top */\n setScrollTop,\n /** @description set distance to scroll left */\n setScrollLeft,\n /** @description handle scroll event */\n handleScroll,\n})\n</script>\n"],"names":[],"mappings":"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"}
@@ -1,181 +1,53 @@
1
- import { defineComponent, ref, computed, watch, nextTick, provide, reactive, onMounted, onUpdated, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, normalizeStyle, createBlock, resolveDynamicComponent, withCtx, renderSlot, createCommentVNode } from 'vue';
2
- import { useResizeObserver, useEventListener } from '@vueuse/core';
3
1
  import '../../../utils/index.mjs';
4
- import '../../../hooks/index.mjs';
5
- import { GAP } from './util.mjs';
6
- import Bar from './bar2.mjs';
7
- import { scrollbarContextKey } from './constants.mjs';
8
- import { scrollbarProps, scrollbarEmits } from './scrollbar.mjs';
9
- import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
10
- import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
11
- import { addUnit } from '../../../utils/dom/style.mjs';
12
- import { isObject } from '@vue/shared';
2
+ import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
13
3
  import { isNumber } from '../../../utils/types.mjs';
14
- import { debugWarn } from '../../../utils/error.mjs';
15
4
 
16
- const COMPONENT_NAME = "ElScrollbar";
17
- const __default__ = defineComponent({
18
- name: COMPONENT_NAME
19
- });
20
- const _sfc_main = /* @__PURE__ */ defineComponent({
21
- ...__default__,
22
- props: scrollbarProps,
23
- emits: scrollbarEmits,
24
- setup(__props, { expose, emit }) {
25
- const props = __props;
26
- const ns = useNamespace("scrollbar");
27
- let stopResizeObserver = void 0;
28
- let stopResizeListener = void 0;
29
- const scrollbarRef = ref();
30
- const wrapRef = ref();
31
- const resizeRef = ref();
32
- const sizeWidth = ref("0");
33
- const sizeHeight = ref("0");
34
- const barRef = ref();
35
- const ratioY = ref(1);
36
- const ratioX = ref(1);
37
- const style = computed(() => {
38
- const style2 = {};
39
- if (props.height)
40
- style2.height = addUnit(props.height);
41
- if (props.maxHeight)
42
- style2.maxHeight = addUnit(props.maxHeight);
43
- return [props.wrapStyle, style2];
44
- });
45
- const wrapKls = computed(() => {
46
- return [
47
- props.wrapClass,
48
- ns.e("wrap"),
49
- { [ns.em("wrap", "hidden-default")]: !props.native }
50
- ];
51
- });
52
- const resizeKls = computed(() => {
53
- return [ns.e("view"), props.viewClass];
54
- });
55
- const handleScroll = () => {
56
- var _a;
57
- if (wrapRef.value) {
58
- (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
59
- emit("scroll", {
60
- scrollTop: wrapRef.value.scrollTop,
61
- scrollLeft: wrapRef.value.scrollLeft
62
- });
63
- }
64
- };
65
- function scrollTo(arg1, arg2) {
66
- if (isObject(arg1)) {
67
- wrapRef.value.scrollTo(arg1);
68
- } else if (isNumber(arg1) && isNumber(arg2)) {
69
- wrapRef.value.scrollTo(arg1, arg2);
70
- }
71
- }
72
- const setScrollTop = (value) => {
73
- if (!isNumber(value)) {
74
- debugWarn(COMPONENT_NAME, "value must be a number");
75
- return;
76
- }
77
- wrapRef.value.scrollTop = value;
78
- };
79
- const setScrollLeft = (value) => {
80
- if (!isNumber(value)) {
81
- debugWarn(COMPONENT_NAME, "value must be a number");
82
- return;
83
- }
84
- wrapRef.value.scrollLeft = value;
85
- };
86
- const update = () => {
87
- if (!wrapRef.value)
88
- return;
89
- const offsetHeight = wrapRef.value.offsetHeight - GAP;
90
- const offsetWidth = wrapRef.value.offsetWidth - GAP;
91
- const originalHeight = offsetHeight ** 2 / wrapRef.value.scrollHeight;
92
- const originalWidth = offsetWidth ** 2 / wrapRef.value.scrollWidth;
93
- const height = Math.max(originalHeight, props.minSize);
94
- const width = Math.max(originalWidth, props.minSize);
95
- ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
96
- ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
97
- sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
98
- sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
99
- };
100
- watch(() => props.noresize, (noresize) => {
101
- if (noresize) {
102
- stopResizeObserver == null ? void 0 : stopResizeObserver();
103
- stopResizeListener == null ? void 0 : stopResizeListener();
104
- } else {
105
- ;
106
- ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
107
- stopResizeListener = useEventListener("resize", update);
108
- }
109
- }, { immediate: true });
110
- watch(() => [props.maxHeight, props.height], () => {
111
- if (!props.native)
112
- nextTick(() => {
113
- var _a;
114
- update();
115
- if (wrapRef.value) {
116
- (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
117
- }
118
- });
119
- });
120
- provide(scrollbarContextKey, reactive({
121
- scrollbarElement: scrollbarRef,
122
- wrapElement: wrapRef
123
- }));
124
- onMounted(() => {
125
- if (!props.native)
126
- nextTick(() => {
127
- update();
128
- });
129
- });
130
- onUpdated(() => update());
131
- expose({
132
- wrapRef,
133
- update,
134
- scrollTo,
135
- setScrollTop,
136
- setScrollLeft,
137
- handleScroll
138
- });
139
- return (_ctx, _cache) => {
140
- return openBlock(), createElementBlock("div", {
141
- ref_key: "scrollbarRef",
142
- ref: scrollbarRef,
143
- class: normalizeClass(unref(ns).b())
144
- }, [
145
- createElementVNode("div", {
146
- ref_key: "wrapRef",
147
- ref: wrapRef,
148
- class: normalizeClass(unref(wrapKls)),
149
- style: normalizeStyle(unref(style)),
150
- onScroll: handleScroll
151
- }, [
152
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
153
- ref_key: "resizeRef",
154
- ref: resizeRef,
155
- class: normalizeClass(unref(resizeKls)),
156
- style: normalizeStyle(_ctx.viewStyle)
157
- }, {
158
- default: withCtx(() => [
159
- renderSlot(_ctx.$slots, "default")
160
- ]),
161
- _: 3
162
- }, 8, ["class", "style"]))
163
- ], 38),
164
- !_ctx.native ? (openBlock(), createBlock(Bar, {
165
- key: 0,
166
- ref_key: "barRef",
167
- ref: barRef,
168
- height: sizeHeight.value,
169
- width: sizeWidth.value,
170
- always: _ctx.always,
171
- "ratio-x": ratioX.value,
172
- "ratio-y": ratioY.value
173
- }, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : createCommentVNode("v-if", true)
174
- ], 2);
175
- };
5
+ const scrollbarProps = buildProps({
6
+ height: {
7
+ type: [String, Number],
8
+ default: ""
9
+ },
10
+ maxHeight: {
11
+ type: [String, Number],
12
+ default: ""
13
+ },
14
+ native: {
15
+ type: Boolean,
16
+ default: false
17
+ },
18
+ wrapStyle: {
19
+ type: definePropType([String, Object, Array]),
20
+ default: ""
21
+ },
22
+ wrapClass: {
23
+ type: [String, Array],
24
+ default: ""
25
+ },
26
+ viewClass: {
27
+ type: [String, Array],
28
+ default: ""
29
+ },
30
+ viewStyle: {
31
+ type: [String, Array, Object],
32
+ default: ""
33
+ },
34
+ noresize: Boolean,
35
+ tag: {
36
+ type: String,
37
+ default: "div"
38
+ },
39
+ always: Boolean,
40
+ minSize: {
41
+ type: Number,
42
+ default: 20
176
43
  }
177
44
  });
178
- var Scrollbar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/scrollbar.vue"]]);
45
+ const scrollbarEmits = {
46
+ scroll: ({
47
+ scrollTop,
48
+ scrollLeft
49
+ }) => [scrollTop, scrollLeft].every(isNumber)
50
+ };
179
51
 
180
- export { Scrollbar as default };
52
+ export { scrollbarEmits, scrollbarProps };
181
53
  //# sourceMappingURL=scrollbar2.mjs.map