@element-plus/nightly 0.0.20250319 → 0.0.20250320

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 (497) hide show
  1. package/README.md +9 -4
  2. package/attributes.json +1 -1
  3. package/dist/index.full.js +11 -3
  4. package/dist/index.full.min.js +3 -3
  5. package/dist/index.full.min.js.map +1 -1
  6. package/dist/index.full.min.mjs +3 -3
  7. package/dist/index.full.min.mjs.map +1 -1
  8. package/dist/index.full.mjs +11 -3
  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-eg.js +1 -1
  14. package/dist/locale/ar-eg.min.js +1 -1
  15. package/dist/locale/ar-eg.min.mjs +1 -1
  16. package/dist/locale/ar-eg.mjs +1 -1
  17. package/dist/locale/ar.js +1 -1
  18. package/dist/locale/ar.min.js +1 -1
  19. package/dist/locale/ar.min.mjs +1 -1
  20. package/dist/locale/ar.mjs +1 -1
  21. package/dist/locale/az.js +1 -1
  22. package/dist/locale/az.min.js +1 -1
  23. package/dist/locale/az.min.mjs +1 -1
  24. package/dist/locale/az.mjs +1 -1
  25. package/dist/locale/bg.js +1 -1
  26. package/dist/locale/bg.min.js +1 -1
  27. package/dist/locale/bg.min.mjs +1 -1
  28. package/dist/locale/bg.mjs +1 -1
  29. package/dist/locale/bn.js +1 -1
  30. package/dist/locale/bn.min.js +1 -1
  31. package/dist/locale/bn.min.mjs +1 -1
  32. package/dist/locale/bn.mjs +1 -1
  33. package/dist/locale/ca.js +1 -1
  34. package/dist/locale/ca.min.js +1 -1
  35. package/dist/locale/ca.min.mjs +1 -1
  36. package/dist/locale/ca.mjs +1 -1
  37. package/dist/locale/ckb.js +1 -1
  38. package/dist/locale/ckb.min.js +1 -1
  39. package/dist/locale/ckb.min.mjs +1 -1
  40. package/dist/locale/ckb.mjs +1 -1
  41. package/dist/locale/cs.js +1 -1
  42. package/dist/locale/cs.min.js +1 -1
  43. package/dist/locale/cs.min.mjs +1 -1
  44. package/dist/locale/cs.mjs +1 -1
  45. package/dist/locale/da.js +1 -1
  46. package/dist/locale/da.min.js +1 -1
  47. package/dist/locale/da.min.mjs +1 -1
  48. package/dist/locale/da.mjs +1 -1
  49. package/dist/locale/de.js +1 -1
  50. package/dist/locale/de.min.js +1 -1
  51. package/dist/locale/de.min.mjs +1 -1
  52. package/dist/locale/de.mjs +1 -1
  53. package/dist/locale/el.js +1 -1
  54. package/dist/locale/el.min.js +1 -1
  55. package/dist/locale/el.min.mjs +1 -1
  56. package/dist/locale/el.mjs +1 -1
  57. package/dist/locale/en.js +1 -1
  58. package/dist/locale/en.min.js +1 -1
  59. package/dist/locale/en.min.mjs +1 -1
  60. package/dist/locale/en.mjs +1 -1
  61. package/dist/locale/eo.js +1 -1
  62. package/dist/locale/eo.min.js +1 -1
  63. package/dist/locale/eo.min.mjs +1 -1
  64. package/dist/locale/eo.mjs +1 -1
  65. package/dist/locale/es.js +1 -1
  66. package/dist/locale/es.min.js +1 -1
  67. package/dist/locale/es.min.mjs +1 -1
  68. package/dist/locale/es.mjs +1 -1
  69. package/dist/locale/et.js +1 -1
  70. package/dist/locale/et.min.js +1 -1
  71. package/dist/locale/et.min.mjs +1 -1
  72. package/dist/locale/et.mjs +1 -1
  73. package/dist/locale/eu.js +1 -1
  74. package/dist/locale/eu.min.js +1 -1
  75. package/dist/locale/eu.min.mjs +1 -1
  76. package/dist/locale/eu.mjs +1 -1
  77. package/dist/locale/fa.js +1 -1
  78. package/dist/locale/fa.min.js +1 -1
  79. package/dist/locale/fa.min.mjs +1 -1
  80. package/dist/locale/fa.mjs +1 -1
  81. package/dist/locale/fi.js +1 -1
  82. package/dist/locale/fi.min.js +1 -1
  83. package/dist/locale/fi.min.mjs +1 -1
  84. package/dist/locale/fi.mjs +1 -1
  85. package/dist/locale/fr.js +1 -1
  86. package/dist/locale/fr.min.js +1 -1
  87. package/dist/locale/fr.min.mjs +1 -1
  88. package/dist/locale/fr.mjs +1 -1
  89. package/dist/locale/he.js +1 -1
  90. package/dist/locale/he.min.js +1 -1
  91. package/dist/locale/he.min.mjs +1 -1
  92. package/dist/locale/he.mjs +1 -1
  93. package/dist/locale/hi.js +1 -1
  94. package/dist/locale/hi.min.js +1 -1
  95. package/dist/locale/hi.min.mjs +1 -1
  96. package/dist/locale/hi.mjs +1 -1
  97. package/dist/locale/hr.js +1 -1
  98. package/dist/locale/hr.min.js +1 -1
  99. package/dist/locale/hr.min.mjs +1 -1
  100. package/dist/locale/hr.mjs +1 -1
  101. package/dist/locale/hu.js +1 -1
  102. package/dist/locale/hu.min.js +1 -1
  103. package/dist/locale/hu.min.mjs +1 -1
  104. package/dist/locale/hu.mjs +1 -1
  105. package/dist/locale/hy-am.js +1 -1
  106. package/dist/locale/hy-am.min.js +1 -1
  107. package/dist/locale/hy-am.min.mjs +1 -1
  108. package/dist/locale/hy-am.mjs +1 -1
  109. package/dist/locale/id.js +1 -1
  110. package/dist/locale/id.min.js +1 -1
  111. package/dist/locale/id.min.mjs +1 -1
  112. package/dist/locale/id.mjs +1 -1
  113. package/dist/locale/it.js +1 -1
  114. package/dist/locale/it.min.js +1 -1
  115. package/dist/locale/it.min.mjs +1 -1
  116. package/dist/locale/it.mjs +1 -1
  117. package/dist/locale/ja.js +1 -1
  118. package/dist/locale/ja.min.js +1 -1
  119. package/dist/locale/ja.min.mjs +1 -1
  120. package/dist/locale/ja.mjs +1 -1
  121. package/dist/locale/kk.js +1 -1
  122. package/dist/locale/kk.min.js +1 -1
  123. package/dist/locale/kk.min.mjs +1 -1
  124. package/dist/locale/kk.mjs +1 -1
  125. package/dist/locale/km.js +1 -1
  126. package/dist/locale/km.min.js +1 -1
  127. package/dist/locale/km.min.mjs +1 -1
  128. package/dist/locale/km.mjs +1 -1
  129. package/dist/locale/ko.js +1 -1
  130. package/dist/locale/ko.min.js +1 -1
  131. package/dist/locale/ko.min.mjs +1 -1
  132. package/dist/locale/ko.mjs +1 -1
  133. package/dist/locale/ku.js +1 -1
  134. package/dist/locale/ku.min.js +1 -1
  135. package/dist/locale/ku.min.mjs +1 -1
  136. package/dist/locale/ku.mjs +1 -1
  137. package/dist/locale/ky.js +1 -1
  138. package/dist/locale/ky.min.js +1 -1
  139. package/dist/locale/ky.min.mjs +1 -1
  140. package/dist/locale/ky.mjs +1 -1
  141. package/dist/locale/lt.js +1 -1
  142. package/dist/locale/lt.min.js +1 -1
  143. package/dist/locale/lt.min.mjs +1 -1
  144. package/dist/locale/lt.mjs +1 -1
  145. package/dist/locale/lv.js +1 -1
  146. package/dist/locale/lv.min.js +1 -1
  147. package/dist/locale/lv.min.mjs +1 -1
  148. package/dist/locale/lv.mjs +1 -1
  149. package/dist/locale/mg.js +1 -1
  150. package/dist/locale/mg.min.js +1 -1
  151. package/dist/locale/mg.min.mjs +1 -1
  152. package/dist/locale/mg.mjs +1 -1
  153. package/dist/locale/mn.js +1 -1
  154. package/dist/locale/mn.min.js +1 -1
  155. package/dist/locale/mn.min.mjs +1 -1
  156. package/dist/locale/mn.mjs +1 -1
  157. package/dist/locale/ms.js +1 -1
  158. package/dist/locale/ms.min.js +1 -1
  159. package/dist/locale/ms.min.mjs +1 -1
  160. package/dist/locale/ms.mjs +1 -1
  161. package/dist/locale/my.js +1 -1
  162. package/dist/locale/my.min.js +1 -1
  163. package/dist/locale/my.min.mjs +1 -1
  164. package/dist/locale/my.mjs +1 -1
  165. package/dist/locale/nb-no.js +1 -1
  166. package/dist/locale/nb-no.min.js +1 -1
  167. package/dist/locale/nb-no.min.mjs +1 -1
  168. package/dist/locale/nb-no.mjs +1 -1
  169. package/dist/locale/nl.js +1 -1
  170. package/dist/locale/nl.min.js +1 -1
  171. package/dist/locale/nl.min.mjs +1 -1
  172. package/dist/locale/nl.mjs +1 -1
  173. package/dist/locale/no.js +1 -1
  174. package/dist/locale/no.min.js +1 -1
  175. package/dist/locale/no.min.mjs +1 -1
  176. package/dist/locale/no.mjs +1 -1
  177. package/dist/locale/pa.js +1 -1
  178. package/dist/locale/pa.min.js +1 -1
  179. package/dist/locale/pa.min.mjs +1 -1
  180. package/dist/locale/pa.mjs +1 -1
  181. package/dist/locale/pl.js +1 -1
  182. package/dist/locale/pl.min.js +1 -1
  183. package/dist/locale/pl.min.mjs +1 -1
  184. package/dist/locale/pl.mjs +1 -1
  185. package/dist/locale/pt-br.js +1 -1
  186. package/dist/locale/pt-br.min.js +1 -1
  187. package/dist/locale/pt-br.min.mjs +1 -1
  188. package/dist/locale/pt-br.mjs +1 -1
  189. package/dist/locale/pt.js +1 -1
  190. package/dist/locale/pt.min.js +1 -1
  191. package/dist/locale/pt.min.mjs +1 -1
  192. package/dist/locale/pt.mjs +1 -1
  193. package/dist/locale/ro.js +1 -1
  194. package/dist/locale/ro.min.js +1 -1
  195. package/dist/locale/ro.min.mjs +1 -1
  196. package/dist/locale/ro.mjs +1 -1
  197. package/dist/locale/ru.js +1 -1
  198. package/dist/locale/ru.min.js +1 -1
  199. package/dist/locale/ru.min.mjs +1 -1
  200. package/dist/locale/ru.mjs +1 -1
  201. package/dist/locale/sk.js +1 -1
  202. package/dist/locale/sk.min.js +1 -1
  203. package/dist/locale/sk.min.mjs +1 -1
  204. package/dist/locale/sk.mjs +1 -1
  205. package/dist/locale/sl.js +1 -1
  206. package/dist/locale/sl.min.js +1 -1
  207. package/dist/locale/sl.min.mjs +1 -1
  208. package/dist/locale/sl.mjs +1 -1
  209. package/dist/locale/sr.js +1 -1
  210. package/dist/locale/sr.min.js +1 -1
  211. package/dist/locale/sr.min.mjs +1 -1
  212. package/dist/locale/sr.mjs +1 -1
  213. package/dist/locale/sv.js +1 -1
  214. package/dist/locale/sv.min.js +1 -1
  215. package/dist/locale/sv.min.mjs +1 -1
  216. package/dist/locale/sv.mjs +1 -1
  217. package/dist/locale/sw.js +1 -1
  218. package/dist/locale/sw.min.js +1 -1
  219. package/dist/locale/sw.min.mjs +1 -1
  220. package/dist/locale/sw.mjs +1 -1
  221. package/dist/locale/ta.js +1 -1
  222. package/dist/locale/ta.min.js +1 -1
  223. package/dist/locale/ta.min.mjs +1 -1
  224. package/dist/locale/ta.mjs +1 -1
  225. package/dist/locale/te.js +1 -1
  226. package/dist/locale/te.min.js +1 -1
  227. package/dist/locale/te.min.mjs +1 -1
  228. package/dist/locale/te.mjs +1 -1
  229. package/dist/locale/th.js +1 -1
  230. package/dist/locale/th.min.js +1 -1
  231. package/dist/locale/th.min.mjs +1 -1
  232. package/dist/locale/th.mjs +1 -1
  233. package/dist/locale/tk.js +1 -1
  234. package/dist/locale/tk.min.js +1 -1
  235. package/dist/locale/tk.min.mjs +1 -1
  236. package/dist/locale/tk.mjs +1 -1
  237. package/dist/locale/tr.js +1 -1
  238. package/dist/locale/tr.min.js +1 -1
  239. package/dist/locale/tr.min.mjs +1 -1
  240. package/dist/locale/tr.mjs +1 -1
  241. package/dist/locale/ug-cn.js +1 -1
  242. package/dist/locale/ug-cn.min.js +1 -1
  243. package/dist/locale/ug-cn.min.mjs +1 -1
  244. package/dist/locale/ug-cn.mjs +1 -1
  245. package/dist/locale/uk.js +1 -1
  246. package/dist/locale/uk.min.js +1 -1
  247. package/dist/locale/uk.min.mjs +1 -1
  248. package/dist/locale/uk.mjs +1 -1
  249. package/dist/locale/uz-uz.js +1 -1
  250. package/dist/locale/uz-uz.min.js +1 -1
  251. package/dist/locale/uz-uz.min.mjs +1 -1
  252. package/dist/locale/uz-uz.mjs +1 -1
  253. package/dist/locale/vi.js +1 -1
  254. package/dist/locale/vi.min.js +1 -1
  255. package/dist/locale/vi.min.mjs +1 -1
  256. package/dist/locale/vi.mjs +1 -1
  257. package/dist/locale/zh-cn.js +1 -1
  258. package/dist/locale/zh-cn.min.js +1 -1
  259. package/dist/locale/zh-cn.min.mjs +1 -1
  260. package/dist/locale/zh-cn.mjs +1 -1
  261. package/dist/locale/zh-hk.js +1 -1
  262. package/dist/locale/zh-hk.min.js +1 -1
  263. package/dist/locale/zh-hk.min.mjs +1 -1
  264. package/dist/locale/zh-hk.mjs +1 -1
  265. package/dist/locale/zh-mo.js +1 -1
  266. package/dist/locale/zh-mo.min.js +1 -1
  267. package/dist/locale/zh-mo.min.mjs +1 -1
  268. package/dist/locale/zh-mo.mjs +1 -1
  269. package/dist/locale/zh-tw.js +1 -1
  270. package/dist/locale/zh-tw.min.js +1 -1
  271. package/dist/locale/zh-tw.min.mjs +1 -1
  272. package/dist/locale/zh-tw.mjs +1 -1
  273. package/es/components/affix/index.mjs +2 -2
  274. package/es/components/affix/src/affix.mjs +24 -119
  275. package/es/components/affix/src/affix.mjs.map +1 -1
  276. package/es/components/affix/src/affix2.mjs +119 -24
  277. package/es/components/affix/src/affix2.mjs.map +1 -1
  278. package/es/components/autocomplete/src/autocomplete.mjs +1 -1
  279. package/es/components/backtop/index.mjs +2 -2
  280. package/es/components/backtop/src/backtop.mjs +21 -53
  281. package/es/components/backtop/src/backtop.mjs.map +1 -1
  282. package/es/components/backtop/src/backtop2.mjs +53 -21
  283. package/es/components/backtop/src/backtop2.mjs.map +1 -1
  284. package/es/components/cascader/src/cascader.mjs +1 -1
  285. package/es/components/collapse/index.mjs +2 -2
  286. package/es/components/collapse/src/collapse.mjs +28 -16
  287. package/es/components/collapse/src/collapse.mjs.map +1 -1
  288. package/es/components/collapse/src/collapse2.mjs +16 -28
  289. package/es/components/collapse/src/collapse2.mjs.map +1 -1
  290. package/es/components/color-picker/index.mjs +2 -2
  291. package/es/components/color-picker/src/color-picker.mjs +401 -39
  292. package/es/components/color-picker/src/color-picker.mjs.map +1 -1
  293. package/es/components/color-picker/src/color-picker2.mjs +39 -401
  294. package/es/components/color-picker/src/color-picker2.mjs.map +1 -1
  295. package/es/components/color-picker/src/components/predefine.mjs +1 -1
  296. package/es/components/dropdown/src/dropdown.mjs +1 -1
  297. package/es/components/index.mjs +13 -13
  298. package/es/components/input-tag/src/composables/use-input-tag.mjs +5 -1
  299. package/es/components/input-tag/src/composables/use-input-tag.mjs.map +1 -1
  300. package/es/components/input-tag/src/input-tag.d.ts +1 -0
  301. package/es/components/input-tag/src/input-tag.mjs +4 -0
  302. package/es/components/input-tag/src/input-tag.mjs.map +1 -1
  303. package/es/components/input-tag/src/input-tag.vue.d.ts +3 -0
  304. package/es/components/menu/index.mjs +2 -2
  305. package/es/components/menu/src/menu-item-group.mjs +33 -4
  306. package/es/components/menu/src/menu-item-group.mjs.map +1 -1
  307. package/es/components/menu/src/menu-item-group2.mjs +4 -33
  308. package/es/components/menu/src/menu-item-group2.mjs.map +1 -1
  309. package/es/components/popconfirm/src/popconfirm.mjs +1 -1
  310. package/es/components/popover/src/popover.mjs +1 -1
  311. package/es/components/rate/index.mjs +2 -2
  312. package/es/components/rate/src/rate.mjs +83 -258
  313. package/es/components/rate/src/rate.mjs.map +1 -1
  314. package/es/components/rate/src/rate2.mjs +258 -83
  315. package/es/components/rate/src/rate2.mjs.map +1 -1
  316. package/es/components/select/index.mjs +1 -1
  317. package/es/components/select/src/select.mjs +429 -113
  318. package/es/components/select/src/select.mjs.map +1 -1
  319. package/es/components/select/src/select2.mjs +113 -429
  320. package/es/components/select/src/select2.mjs.map +1 -1
  321. package/es/components/select-v2/src/defaults.mjs +1 -1
  322. package/es/components/slider/src/button.mjs +19 -91
  323. package/es/components/slider/src/button.mjs.map +1 -1
  324. package/es/components/slider/src/button2.mjs +91 -19
  325. package/es/components/slider/src/button2.mjs.map +1 -1
  326. package/es/components/slider/src/slider2.mjs +1 -1
  327. package/es/components/steps/index.mjs +2 -2
  328. package/es/components/steps/src/item.mjs +19 -190
  329. package/es/components/steps/src/item.mjs.map +1 -1
  330. package/es/components/steps/src/item2.mjs +190 -19
  331. package/es/components/steps/src/item2.mjs.map +1 -1
  332. package/es/components/time-select/index.mjs +2 -2
  333. package/es/components/time-select/src/time-select.mjs +132 -54
  334. package/es/components/time-select/src/time-select.mjs.map +1 -1
  335. package/es/components/time-select/src/time-select2.mjs +54 -132
  336. package/es/components/time-select/src/time-select2.mjs.map +1 -1
  337. package/es/components/tooltip/index.mjs +3 -3
  338. package/es/components/tooltip/src/content.mjs +192 -28
  339. package/es/components/tooltip/src/content.mjs.map +1 -1
  340. package/es/components/tooltip/src/content2.mjs +28 -192
  341. package/es/components/tooltip/src/content2.mjs.map +1 -1
  342. package/es/components/tooltip/src/tooltip.mjs +166 -30
  343. package/es/components/tooltip/src/tooltip.mjs.map +1 -1
  344. package/es/components/tooltip/src/tooltip2.mjs +30 -166
  345. package/es/components/tooltip/src/tooltip2.mjs.map +1 -1
  346. package/es/components/tooltip-v2/index.mjs +4 -4
  347. package/es/components/tooltip-v2/src/arrow.mjs +37 -21
  348. package/es/components/tooltip-v2/src/arrow.mjs.map +1 -1
  349. package/es/components/tooltip-v2/src/arrow2.mjs +21 -37
  350. package/es/components/tooltip-v2/src/arrow2.mjs.map +1 -1
  351. package/es/components/tooltip-v2/src/tooltip.mjs +78 -20
  352. package/es/components/tooltip-v2/src/tooltip.mjs.map +1 -1
  353. package/es/components/tooltip-v2/src/tooltip2.mjs +20 -78
  354. package/es/components/tooltip-v2/src/tooltip2.mjs.map +1 -1
  355. package/es/components/tooltip-v2/src/trigger.mjs +12 -89
  356. package/es/components/tooltip-v2/src/trigger.mjs.map +1 -1
  357. package/es/components/tooltip-v2/src/trigger2.mjs +89 -12
  358. package/es/components/tooltip-v2/src/trigger2.mjs.map +1 -1
  359. package/es/components/transfer/index.mjs +2 -2
  360. package/es/components/transfer/src/composables/use-checked-change.mjs +1 -1
  361. package/es/components/transfer/src/transfer-panel.mjs +1 -1
  362. package/es/components/transfer/src/transfer.mjs +164 -68
  363. package/es/components/transfer/src/transfer.mjs.map +1 -1
  364. package/es/components/transfer/src/transfer2.mjs +68 -164
  365. package/es/components/transfer/src/transfer2.mjs.map +1 -1
  366. package/es/components/upload/index.mjs +2 -2
  367. package/es/components/upload/src/upload-content.mjs +1 -1
  368. package/es/components/upload/src/upload-content2.mjs +1 -1
  369. package/es/components/upload/src/upload-list.mjs +1 -1
  370. package/es/components/upload/src/upload.mjs +125 -97
  371. package/es/components/upload/src/upload.mjs.map +1 -1
  372. package/es/components/upload/src/upload2.mjs +97 -125
  373. package/es/components/upload/src/upload2.mjs.map +1 -1
  374. package/es/components/upload/src/use-handlers.mjs +1 -1
  375. package/es/components/watermark/index.mjs +2 -2
  376. package/es/components/watermark/src/watermark.mjs +27 -210
  377. package/es/components/watermark/src/watermark.mjs.map +1 -1
  378. package/es/components/watermark/src/watermark2.mjs +210 -27
  379. package/es/components/watermark/src/watermark2.mjs.map +1 -1
  380. package/es/index.mjs +13 -13
  381. package/es/version.d.ts +1 -1
  382. package/es/version.mjs +1 -1
  383. package/es/version.mjs.map +1 -1
  384. package/lib/components/affix/index.js +2 -2
  385. package/lib/components/affix/src/affix.js +25 -119
  386. package/lib/components/affix/src/affix.js.map +1 -1
  387. package/lib/components/affix/src/affix2.js +119 -25
  388. package/lib/components/affix/src/affix2.js.map +1 -1
  389. package/lib/components/autocomplete/src/autocomplete.js +1 -1
  390. package/lib/components/backtop/index.js +2 -2
  391. package/lib/components/backtop/src/backtop.js +22 -53
  392. package/lib/components/backtop/src/backtop.js.map +1 -1
  393. package/lib/components/backtop/src/backtop2.js +53 -22
  394. package/lib/components/backtop/src/backtop2.js.map +1 -1
  395. package/lib/components/cascader/src/cascader.js +1 -1
  396. package/lib/components/collapse/index.js +2 -2
  397. package/lib/components/collapse/src/collapse.js +28 -18
  398. package/lib/components/collapse/src/collapse.js.map +1 -1
  399. package/lib/components/collapse/src/collapse2.js +18 -28
  400. package/lib/components/collapse/src/collapse2.js.map +1 -1
  401. package/lib/components/color-picker/index.js +2 -2
  402. package/lib/components/color-picker/src/color-picker.js +400 -40
  403. package/lib/components/color-picker/src/color-picker.js.map +1 -1
  404. package/lib/components/color-picker/src/color-picker2.js +40 -400
  405. package/lib/components/color-picker/src/color-picker2.js.map +1 -1
  406. package/lib/components/color-picker/src/components/predefine.js +1 -1
  407. package/lib/components/dropdown/src/dropdown.js +1 -1
  408. package/lib/components/index.js +13 -13
  409. package/lib/components/input-tag/src/composables/use-input-tag.js +5 -1
  410. package/lib/components/input-tag/src/composables/use-input-tag.js.map +1 -1
  411. package/lib/components/input-tag/src/input-tag.d.ts +1 -0
  412. package/lib/components/input-tag/src/input-tag.js +4 -0
  413. package/lib/components/input-tag/src/input-tag.js.map +1 -1
  414. package/lib/components/input-tag/src/input-tag.vue.d.ts +3 -0
  415. package/lib/components/menu/index.js +2 -2
  416. package/lib/components/menu/src/menu-item-group.js +33 -4
  417. package/lib/components/menu/src/menu-item-group.js.map +1 -1
  418. package/lib/components/menu/src/menu-item-group2.js +4 -33
  419. package/lib/components/menu/src/menu-item-group2.js.map +1 -1
  420. package/lib/components/popconfirm/src/popconfirm.js +1 -1
  421. package/lib/components/popover/src/popover.js +1 -1
  422. package/lib/components/rate/index.js +2 -2
  423. package/lib/components/rate/src/rate.js +83 -257
  424. package/lib/components/rate/src/rate.js.map +1 -1
  425. package/lib/components/rate/src/rate2.js +257 -83
  426. package/lib/components/rate/src/rate2.js.map +1 -1
  427. package/lib/components/select/index.js +1 -1
  428. package/lib/components/select/src/select.js +429 -113
  429. package/lib/components/select/src/select.js.map +1 -1
  430. package/lib/components/select/src/select2.js +113 -429
  431. package/lib/components/select/src/select2.js.map +1 -1
  432. package/lib/components/select-v2/src/defaults.js +1 -1
  433. package/lib/components/slider/src/button.js +20 -91
  434. package/lib/components/slider/src/button.js.map +1 -1
  435. package/lib/components/slider/src/button2.js +91 -20
  436. package/lib/components/slider/src/button2.js.map +1 -1
  437. package/lib/components/slider/src/slider2.js +1 -1
  438. package/lib/components/steps/index.js +2 -2
  439. package/lib/components/steps/src/item.js +19 -190
  440. package/lib/components/steps/src/item.js.map +1 -1
  441. package/lib/components/steps/src/item2.js +190 -19
  442. package/lib/components/steps/src/item2.js.map +1 -1
  443. package/lib/components/time-select/index.js +2 -2
  444. package/lib/components/time-select/src/time-select.js +137 -54
  445. package/lib/components/time-select/src/time-select.js.map +1 -1
  446. package/lib/components/time-select/src/time-select2.js +54 -137
  447. package/lib/components/time-select/src/time-select2.js.map +1 -1
  448. package/lib/components/tooltip/index.js +3 -3
  449. package/lib/components/tooltip/src/content.js +192 -28
  450. package/lib/components/tooltip/src/content.js.map +1 -1
  451. package/lib/components/tooltip/src/content2.js +28 -192
  452. package/lib/components/tooltip/src/content2.js.map +1 -1
  453. package/lib/components/tooltip/src/tooltip.js +165 -33
  454. package/lib/components/tooltip/src/tooltip.js.map +1 -1
  455. package/lib/components/tooltip/src/tooltip2.js +33 -165
  456. package/lib/components/tooltip/src/tooltip2.js.map +1 -1
  457. package/lib/components/tooltip-v2/index.js +4 -4
  458. package/lib/components/tooltip-v2/src/arrow.js +37 -22
  459. package/lib/components/tooltip-v2/src/arrow.js.map +1 -1
  460. package/lib/components/tooltip-v2/src/arrow2.js +22 -37
  461. package/lib/components/tooltip-v2/src/arrow2.js.map +1 -1
  462. package/lib/components/tooltip-v2/src/tooltip.js +78 -20
  463. package/lib/components/tooltip-v2/src/tooltip.js.map +1 -1
  464. package/lib/components/tooltip-v2/src/tooltip2.js +20 -78
  465. package/lib/components/tooltip-v2/src/tooltip2.js.map +1 -1
  466. package/lib/components/tooltip-v2/src/trigger.js +12 -89
  467. package/lib/components/tooltip-v2/src/trigger.js.map +1 -1
  468. package/lib/components/tooltip-v2/src/trigger2.js +89 -12
  469. package/lib/components/tooltip-v2/src/trigger2.js.map +1 -1
  470. package/lib/components/transfer/index.js +2 -2
  471. package/lib/components/transfer/src/composables/use-checked-change.js +1 -1
  472. package/lib/components/transfer/src/transfer-panel.js +1 -1
  473. package/lib/components/transfer/src/transfer.js +164 -72
  474. package/lib/components/transfer/src/transfer.js.map +1 -1
  475. package/lib/components/transfer/src/transfer2.js +72 -164
  476. package/lib/components/transfer/src/transfer2.js.map +1 -1
  477. package/lib/components/upload/index.js +2 -2
  478. package/lib/components/upload/src/upload-content.js +1 -1
  479. package/lib/components/upload/src/upload-content2.js +1 -1
  480. package/lib/components/upload/src/upload-list.js +1 -1
  481. package/lib/components/upload/src/upload.js +125 -100
  482. package/lib/components/upload/src/upload.js.map +1 -1
  483. package/lib/components/upload/src/upload2.js +100 -125
  484. package/lib/components/upload/src/upload2.js.map +1 -1
  485. package/lib/components/upload/src/use-handlers.js +1 -1
  486. package/lib/components/watermark/index.js +2 -2
  487. package/lib/components/watermark/src/watermark.js +27 -210
  488. package/lib/components/watermark/src/watermark.js.map +1 -1
  489. package/lib/components/watermark/src/watermark2.js +210 -27
  490. package/lib/components/watermark/src/watermark2.js.map +1 -1
  491. package/lib/index.js +13 -13
  492. package/lib/version.d.ts +1 -1
  493. package/lib/version.js +1 -1
  494. package/lib/version.js.map +1 -1
  495. package/package.json +2 -2
  496. package/tags.json +1 -1
  497. package/web-types.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"use-input-tag.mjs","sources":["../../../../../../../packages/components/input-tag/src/composables/use-input-tag.ts"],"sourcesContent":["import { computed, ref, shallowRef, watch } from 'vue'\nimport {\n CHANGE_EVENT,\n EVENT_CODE,\n INPUT_EVENT,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { type EmitFn, debugWarn, isUndefined } from '@element-plus/utils'\nimport { useComposition, useFocusController } from '@element-plus/hooks'\nimport {\n type FormItemContext,\n useFormDisabled,\n useFormSize,\n} from '@element-plus/components/form'\nimport type { InputTagEmits, InputTagProps } from '../input-tag'\n\ninterface UseInputTagOptions {\n props: InputTagProps\n emit: EmitFn<InputTagEmits>\n formItem?: FormItemContext\n}\n\nexport function useInputTag({ props, emit, formItem }: UseInputTagOptions) {\n const disabled = useFormDisabled()\n const size = useFormSize()\n\n const inputRef = shallowRef<HTMLInputElement>()\n const inputValue = ref<string>()\n\n const tagSize = computed(() => {\n return ['small'].includes(size.value) ? 'small' : 'default'\n })\n const placeholder = computed(() => {\n return props.modelValue?.length ? undefined : props.placeholder\n })\n const closable = computed(() => !(props.readonly || disabled.value))\n const inputLimit = computed(() => {\n return isUndefined(props.max)\n ? false\n : (props.modelValue?.length ?? 0) >= props.max\n })\n\n const handleInput = (event: Event) => {\n if (inputLimit.value) {\n inputValue.value = undefined\n return\n }\n\n if (isComposing.value) return\n emit(INPUT_EVENT, (event.target as HTMLInputElement).value)\n }\n\n const handleKeydown = (event: KeyboardEvent) => {\n if (isComposing.value) return\n switch (event.code) {\n case props.trigger:\n event.preventDefault()\n event.stopPropagation()\n handleAddTag()\n break\n case EVENT_CODE.numpadEnter:\n if (props.trigger === EVENT_CODE.enter) {\n event.preventDefault()\n event.stopPropagation()\n handleAddTag()\n }\n break\n case EVENT_CODE.backspace:\n if (!inputValue.value && props.modelValue?.length) {\n event.preventDefault()\n event.stopPropagation()\n handleRemoveTag(props.modelValue.length - 1)\n }\n break\n }\n }\n\n const handleAddTag = () => {\n const value = inputValue.value?.trim()\n if (!value || inputLimit.value) return\n const list = [...(props.modelValue ?? []), value]\n\n emit(UPDATE_MODEL_EVENT, list)\n emit(CHANGE_EVENT, list)\n emit('add-tag', value)\n inputValue.value = undefined\n }\n\n const handleRemoveTag = (index: number) => {\n const value = (props.modelValue ?? []).slice()\n const [item] = value.splice(index, 1)\n\n emit(UPDATE_MODEL_EVENT, value)\n emit(CHANGE_EVENT, value)\n emit('remove-tag', item)\n }\n\n const handleClear = () => {\n inputValue.value = undefined\n emit(UPDATE_MODEL_EVENT, undefined)\n emit(CHANGE_EVENT, undefined)\n emit('clear')\n }\n\n const handleDragged = (\n draggingIndex: number,\n dropIndex: number,\n type: 'before' | 'after'\n ) => {\n const value = (props.modelValue ?? []).slice()\n const [draggedItem] = value.splice(draggingIndex, 1)\n const step =\n dropIndex > draggingIndex && type === 'before'\n ? -1\n : dropIndex < draggingIndex && type === 'after'\n ? 1\n : 0\n\n value.splice(dropIndex + step, 0, draggedItem)\n emit(UPDATE_MODEL_EVENT, value)\n emit(CHANGE_EVENT, value)\n }\n\n const focus = () => {\n inputRef.value?.focus()\n }\n\n const blur = () => {\n inputRef.value?.blur()\n }\n\n const { wrapperRef, isFocused } = useFocusController(inputRef, {\n beforeFocus() {\n return disabled.value\n },\n afterBlur() {\n handleAddTag()\n if (props.validateEvent) {\n formItem?.validate?.('blur').catch((err) => debugWarn(err))\n }\n },\n })\n\n const {\n isComposing,\n handleCompositionStart,\n handleCompositionUpdate,\n handleCompositionEnd,\n } = useComposition({ afterComposition: handleInput })\n\n watch(\n () => props.modelValue,\n () => {\n if (props.validateEvent) {\n formItem?.validate?.(CHANGE_EVENT).catch((err) => debugWarn(err))\n }\n }\n )\n\n return {\n inputRef,\n wrapperRef,\n isFocused,\n isComposing,\n inputValue,\n size,\n tagSize,\n placeholder,\n closable,\n disabled,\n inputLimit,\n handleDragged,\n handleInput,\n handleKeydown,\n handleAddTag,\n handleRemoveTag,\n handleClear,\n handleCompositionStart,\n handleCompositionUpdate,\n handleCompositionEnd,\n focus,\n blur,\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AAaO,SAAS,WAAW,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;AACvD,EAAE,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAC;AACrC,EAAE,MAAM,IAAI,GAAG,WAAW,EAAE,CAAC;AAC7B,EAAE,MAAM,QAAQ,GAAG,UAAU,EAAE,CAAC;AAChC,EAAE,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC;AAC3B,EAAE,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM;AACjC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO,GAAG,SAAS,CAAC;AAChE,GAAG,CAAC,CAAC;AACL,EAAE,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM;AACrC,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,OAAO,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,UAAU,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,CAAC,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;AACzI,OAAO;AACP,KAAK;AACL,GAAG,CAAC,CAAC;AACL,EAAE,MAAM;AACR,IAAI,WAAW;AACf,IAAI,sBAAsB;AAC1B,IAAI,uBAAuB;AAC3B,IAAI,oBAAoB;AACxB,GAAG,GAAG,cAAc,CAAC,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC,CAAC;AACxD,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,UAAU,EAAE,MAAM;AACtC,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,IAAI,KAAK,CAAC,aAAa,EAAE;AAC7B,MAAM,CAAC,EAAE,GAAG,QAAQ,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,QAAQ,CAAC,QAAQ,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7I,KAAK;AACL,GAAG,CAAC,CAAC;AACL,EAAE,OAAO;AACT,IAAI,QAAQ;AACZ,IAAI,UAAU;AACd,IAAI,SAAS;AACb,IAAI,WAAW;AACf,IAAI,UAAU;AACd,IAAI,IAAI;AACR,IAAI,OAAO;AACX,IAAI,WAAW;AACf,IAAI,QAAQ;AACZ,IAAI,QAAQ;AACZ,IAAI,UAAU;AACd,IAAI,aAAa;AACjB,IAAI,WAAW;AACf,IAAI,aAAa;AACjB,IAAI,YAAY;AAChB,IAAI,eAAe;AACnB,IAAI,WAAW;AACf,IAAI,sBAAsB;AAC1B,IAAI,uBAAuB;AAC3B,IAAI,oBAAoB;AACxB,IAAI,KAAK;AACT,IAAI,IAAI;AACR,GAAG,CAAC;AACJ;;;;"}
1
+ {"version":3,"file":"use-input-tag.mjs","sources":["../../../../../../../packages/components/input-tag/src/composables/use-input-tag.ts"],"sourcesContent":["import { computed, ref, shallowRef, watch } from 'vue'\nimport {\n CHANGE_EVENT,\n EVENT_CODE,\n INPUT_EVENT,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { type EmitFn, debugWarn, isUndefined } from '@element-plus/utils'\nimport { useComposition, useFocusController } from '@element-plus/hooks'\nimport {\n type FormItemContext,\n useFormDisabled,\n useFormSize,\n} from '@element-plus/components/form'\nimport type { InputTagEmits, InputTagProps } from '../input-tag'\n\ninterface UseInputTagOptions {\n props: InputTagProps\n emit: EmitFn<InputTagEmits>\n formItem?: FormItemContext\n}\n\nexport function useInputTag({ props, emit, formItem }: UseInputTagOptions) {\n const disabled = useFormDisabled()\n const size = useFormSize()\n\n const inputRef = shallowRef<HTMLInputElement>()\n const inputValue = ref<string>()\n\n const tagSize = computed(() => {\n return ['small'].includes(size.value) ? 'small' : 'default'\n })\n const placeholder = computed(() => {\n return props.modelValue?.length ? undefined : props.placeholder\n })\n const closable = computed(() => !(props.readonly || disabled.value))\n const inputLimit = computed(() => {\n return isUndefined(props.max)\n ? false\n : (props.modelValue?.length ?? 0) >= props.max\n })\n\n const handleInput = (event: Event) => {\n if (inputLimit.value) {\n inputValue.value = undefined\n return\n }\n\n if (isComposing.value) return\n emit(INPUT_EVENT, (event.target as HTMLInputElement).value)\n }\n\n const handleKeydown = (event: KeyboardEvent) => {\n if (isComposing.value) return\n switch (event.code) {\n case props.trigger:\n event.preventDefault()\n event.stopPropagation()\n handleAddTag()\n break\n case EVENT_CODE.numpadEnter:\n if (props.trigger === EVENT_CODE.enter) {\n event.preventDefault()\n event.stopPropagation()\n handleAddTag()\n }\n break\n case EVENT_CODE.backspace:\n if (!inputValue.value && props.modelValue?.length) {\n event.preventDefault()\n event.stopPropagation()\n handleRemoveTag(props.modelValue.length - 1)\n }\n break\n }\n }\n\n const handleAddTag = () => {\n const value = inputValue.value?.trim()\n if (!value || inputLimit.value) return\n const list = [...(props.modelValue ?? []), value]\n\n emit(UPDATE_MODEL_EVENT, list)\n emit(CHANGE_EVENT, list)\n emit('add-tag', value)\n inputValue.value = undefined\n }\n\n const handleRemoveTag = (index: number) => {\n const value = (props.modelValue ?? []).slice()\n const [item] = value.splice(index, 1)\n\n emit(UPDATE_MODEL_EVENT, value)\n emit(CHANGE_EVENT, value)\n emit('remove-tag', item)\n }\n\n const handleClear = () => {\n inputValue.value = undefined\n emit(UPDATE_MODEL_EVENT, undefined)\n emit(CHANGE_EVENT, undefined)\n emit('clear')\n }\n\n const handleDragged = (\n draggingIndex: number,\n dropIndex: number,\n type: 'before' | 'after'\n ) => {\n const value = (props.modelValue ?? []).slice()\n const [draggedItem] = value.splice(draggingIndex, 1)\n const step =\n dropIndex > draggingIndex && type === 'before'\n ? -1\n : dropIndex < draggingIndex && type === 'after'\n ? 1\n : 0\n\n value.splice(dropIndex + step, 0, draggedItem)\n emit(UPDATE_MODEL_EVENT, value)\n emit(CHANGE_EVENT, value)\n }\n\n const focus = () => {\n inputRef.value?.focus()\n }\n\n const blur = () => {\n inputRef.value?.blur()\n }\n\n const { wrapperRef, isFocused } = useFocusController(inputRef, {\n beforeFocus() {\n return disabled.value\n },\n afterBlur() {\n if (props.saveOnBlur) {\n handleAddTag()\n } else {\n inputValue.value = undefined\n }\n\n if (props.validateEvent) {\n formItem?.validate?.('blur').catch((err) => debugWarn(err))\n }\n },\n })\n\n const {\n isComposing,\n handleCompositionStart,\n handleCompositionUpdate,\n handleCompositionEnd,\n } = useComposition({ afterComposition: handleInput })\n\n watch(\n () => props.modelValue,\n () => {\n if (props.validateEvent) {\n formItem?.validate?.(CHANGE_EVENT).catch((err) => debugWarn(err))\n }\n }\n )\n\n return {\n inputRef,\n wrapperRef,\n isFocused,\n isComposing,\n inputValue,\n size,\n tagSize,\n placeholder,\n closable,\n disabled,\n inputLimit,\n handleDragged,\n handleInput,\n handleKeydown,\n handleAddTag,\n handleRemoveTag,\n handleClear,\n handleCompositionStart,\n handleCompositionUpdate,\n handleCompositionEnd,\n focus,\n blur,\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AAaO,SAAS,WAAW,CAAC,EAAE,KAAK,EAAE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AK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7I,KAAK;AACL,GAAG,CAAC,CAAC;AACL,EAAE,OAAO;AACT,IAAI,QAAQ;AACZ,IAAI,UAAU;AACd,IAAI,SAAS;AACb,IAAI,WAAW;AACf,IAAI,UAAU;AACd,IAAI,IAAI;AACR,IAAI,OAAO;AACX,IAAI,WAAW;AACf,IAAI,QAAQ;AACZ,IAAI,QAAQ;AACZ,IAAI,UAAU;AACd,IAAI,aAAa;AACjB,IAAI,WAAW;AACf,IAAI,aAAa;AACjB,IAAI,YAAY;AAChB,IAAI,eAAe;AACnB,IAAI,WAAW;AACf,IAAI,sBAAsB;AAC1B,IAAI,uBAAuB;AAC3B,IAAI,oBAAoB;AACxB,IAAI,KAAK;AACT,IAAI,IAAI;AACR,GAAG,CAAC;AACJ;;;;"}
@@ -44,6 +44,7 @@ export declare const inputTagProps: {
44
44
  };
45
45
  readonly placeholder: StringConstructor;
46
46
  readonly autocomplete: import("@element-plus/nightly/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "off", boolean>;
47
+ readonly saveOnBlur: import("@element-plus/nightly/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
47
48
  readonly ariaLabel: StringConstructor;
48
49
  };
49
50
  export type InputTagProps = ExtractPropTypes<typeof inputTagProps>;
@@ -52,6 +52,10 @@ const inputTagProps = buildProps({
52
52
  type: String,
53
53
  default: "off"
54
54
  },
55
+ saveOnBlur: {
56
+ type: Boolean,
57
+ default: true
58
+ },
55
59
  ariaLabel: String
56
60
  });
57
61
  const inputTagEmits = {
@@ -1 +1 @@
1
- {"version":3,"file":"input-tag.mjs","sources":["../../../../../../packages/components/input-tag/src/input-tag.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n isArray,\n isString,\n isUndefined,\n} from '@element-plus/utils'\nimport { useSizeProp } from '@element-plus/hooks'\nimport {\n CHANGE_EVENT,\n EVENT_CODE,\n INPUT_EVENT,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { tagProps } from '@element-plus/components/tag/src/tag'\n\nimport type { ExtractPropTypes } from 'vue'\n\nexport const inputTagProps = buildProps({\n /**\n * @description binding value\n */\n modelValue: {\n type: definePropType<string[]>(Array),\n },\n /**\n * @description max number tags that can be enter\n */\n max: Number,\n /**\n * @description tag type\n */\n tagType: { ...tagProps.type, default: 'info' },\n /**\n * @description tag effect\n */\n tagEffect: tagProps.effect,\n /**\n * @description the key to trigger input tag\n */\n trigger: {\n type: definePropType<'Enter' | 'Space'>(String),\n default: EVENT_CODE.enter,\n },\n /**\n * @description whether tags can be dragged\n */\n draggable: {\n type: Boolean,\n default: false,\n },\n /**\n * @description input box size\n */\n size: useSizeProp,\n /**\n * @description whether to show clear button\n */\n clearable: Boolean,\n /**\n * @description whether to disable input-tag\n */\n disabled: {\n type: Boolean,\n default: undefined,\n },\n /**\n * @description whether to trigger form validation\n */\n validateEvent: {\n type: Boolean,\n default: true,\n },\n /**\n * @description native input readonly\n */\n readonly: Boolean,\n /**\n * @description native input autofocus\n */\n autofocus: Boolean,\n /**\n * @description same as `id` in native input\n */\n id: {\n type: String,\n default: undefined,\n },\n /**\n * @description same as `tabindex` in native input\n */\n tabindex: {\n type: [String, Number],\n default: 0,\n },\n /**\n * @description same as `maxlength` in native input\n */\n maxlength: {\n type: [String, Number],\n },\n /**\n * @description same as `minlength` in native input\n */\n minlength: {\n type: [String, Number],\n },\n /**\n * @description placeholder of input\n */\n placeholder: String,\n /**\n * @description native input autocomplete\n */\n autocomplete: {\n type: String,\n default: 'off',\n },\n /**\n * @description native `aria-label` attribute\n */\n ariaLabel: String,\n} as const)\nexport type InputTagProps = ExtractPropTypes<typeof inputTagProps>\n\nexport const inputTagEmits = {\n [UPDATE_MODEL_EVENT]: (value?: string[]) =>\n isArray(value) || isUndefined(value),\n [CHANGE_EVENT]: (value?: string[]) => isArray(value) || isUndefined(value),\n [INPUT_EVENT]: (value: string) => isString(value),\n 'add-tag': (value: string) => isString(value),\n 'remove-tag': (value: string) => isString(value),\n focus: (evt: FocusEvent) => evt instanceof FocusEvent,\n blur: (evt: FocusEvent) => evt instanceof FocusEvent,\n clear: () => true,\n}\nexport type InputTagEmits = typeof inputTagEmits\n"],"names":[],"mappings":";;;;;;;;AAeY,MAAC,aAAa,GAAG,UAAU,CAAC;AACxC,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,GAAG;AACH,EAAE,GAAG,EAAE,MAAM;AACb,EAAE,OAAO,EAAE,EAAE,GAAG,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE;AAChD,EAAE,SAAS,EAAE,QAAQ,CAAC,MAAM;AAC5B,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,UAAU,CAAC,KAAK;AAC7B,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE,SAAS,EAAE,OAAO;AACpB,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,SAAS,EAAE,OAAO;AACpB,EAAE,EAAE,EAAE;AACN,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,GAAG;AACH,EAAE,WAAW,EAAE,MAAM;AACrB,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,SAAS,EAAE,MAAM;AACnB,CAAC,EAAE;AACS,MAAC,aAAa,GAAG;AAC7B,EAAE,CAAC,kBAAkB,GAAG,CAAC,KAAK,KAAK,OAAO,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC;AACvE,EAAE,CAAC,YAAY,GAAG,CAAC,KAAK,KAAK,OAAO,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC;AACjE,EAAE,CAAC,WAAW,GAAG,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AAC3C,EAAE,SAAS,EAAE,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AACvC,EAAE,YAAY,EAAE,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AAC1C,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,GAAG,YAAY,UAAU;AAC3C,EAAE,IAAI,EAAE,CAAC,GAAG,KAAK,GAAG,YAAY,UAAU;AAC1C,EAAE,KAAK,EAAE,MAAM,IAAI;AACnB;;;;"}
1
+ {"version":3,"file":"input-tag.mjs","sources":["../../../../../../packages/components/input-tag/src/input-tag.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n isArray,\n isString,\n isUndefined,\n} from '@element-plus/utils'\nimport { useSizeProp } from '@element-plus/hooks'\nimport {\n CHANGE_EVENT,\n EVENT_CODE,\n INPUT_EVENT,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { tagProps } from '@element-plus/components/tag/src/tag'\n\nimport type { ExtractPropTypes } from 'vue'\n\nexport const inputTagProps = buildProps({\n /**\n * @description binding value\n */\n modelValue: {\n type: definePropType<string[]>(Array),\n },\n /**\n * @description max number tags that can be enter\n */\n max: Number,\n /**\n * @description tag type\n */\n tagType: { ...tagProps.type, default: 'info' },\n /**\n * @description tag effect\n */\n tagEffect: tagProps.effect,\n /**\n * @description the key to trigger input tag\n */\n trigger: {\n type: definePropType<'Enter' | 'Space'>(String),\n default: EVENT_CODE.enter,\n },\n /**\n * @description whether tags can be dragged\n */\n draggable: {\n type: Boolean,\n default: false,\n },\n /**\n * @description input box size\n */\n size: useSizeProp,\n /**\n * @description whether to show clear button\n */\n clearable: Boolean,\n /**\n * @description whether to disable input-tag\n */\n disabled: {\n type: Boolean,\n default: undefined,\n },\n /**\n * @description whether to trigger form validation\n */\n validateEvent: {\n type: Boolean,\n default: true,\n },\n /**\n * @description native input readonly\n */\n readonly: Boolean,\n /**\n * @description native input autofocus\n */\n autofocus: Boolean,\n /**\n * @description same as `id` in native input\n */\n id: {\n type: String,\n default: undefined,\n },\n /**\n * @description same as `tabindex` in native input\n */\n tabindex: {\n type: [String, Number],\n default: 0,\n },\n /**\n * @description same as `maxlength` in native input\n */\n maxlength: {\n type: [String, Number],\n },\n /**\n * @description same as `minlength` in native input\n */\n minlength: {\n type: [String, Number],\n },\n /**\n * @description placeholder of input\n */\n placeholder: String,\n /**\n * @description native input autocomplete\n */\n autocomplete: {\n type: String,\n default: 'off',\n },\n /**\n * @description whether to save the input value when the input loses focus\n */\n saveOnBlur: {\n type: Boolean,\n default: true,\n },\n /**\n * @description native `aria-label` attribute\n */\n ariaLabel: String,\n} as const)\nexport type InputTagProps = ExtractPropTypes<typeof inputTagProps>\n\nexport const inputTagEmits = {\n [UPDATE_MODEL_EVENT]: (value?: string[]) =>\n isArray(value) || isUndefined(value),\n [CHANGE_EVENT]: (value?: string[]) => isArray(value) || isUndefined(value),\n [INPUT_EVENT]: (value: string) => isString(value),\n 'add-tag': (value: string) => isString(value),\n 'remove-tag': (value: string) => isString(value),\n focus: (evt: FocusEvent) => evt instanceof FocusEvent,\n blur: (evt: FocusEvent) => evt instanceof FocusEvent,\n clear: () => true,\n}\nexport type InputTagEmits = typeof inputTagEmits\n"],"names":[],"mappings":";;;;;;;;AAeY,MAAC,aAAa,GAAG,UAAU,CAAC;AACxC,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,GAAG;AACH,EAAE,GAAG,EAAE,MAAM;AACb,EAAE,OAAO,EAAE,EAAE,GAAG,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE;AAChD,EAAE,SAAS,EAAE,QAAQ,CAAC,MAAM;AAC5B,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,UAAU,CAAC,KAAK;AAC7B,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE,SAAS,EAAE,OAAO;AACpB,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,SAAS,EAAE,OAAO;AACpB,EAAE,EAAE,EAAE;AACN,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,GAAG;AACH,EAAE,WAAW,EAAE,MAAM;AACrB,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,SAAS,EAAE,MAAM;AACnB,CAAC,EAAE;AACS,MAAC,aAAa,GAAG;AAC7B,EAAE,CAAC,kBAAkB,GAAG,CAAC,KAAK,KAAK,OAAO,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC;AACvE,EAAE,CAAC,YAAY,GAAG,CAAC,KAAK,KAAK,OAAO,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC;AACjE,EAAE,CAAC,WAAW,GAAG,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AAC3C,EAAE,SAAS,EAAE,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AACvC,EAAE,YAAY,EAAE,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AAC1C,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,GAAG,YAAY,UAAU;AAC3C,EAAE,IAAI,EAAE,CAAC,GAAG,KAAK,GAAG,YAAY,UAAU;AAC1C,EAAE,KAAK,EAAE,MAAM,IAAI;AACnB;;;;"}
@@ -51,6 +51,7 @@ declare const __VLS_component: import("vue").DefineComponent<{
51
51
  };
52
52
  readonly placeholder: StringConstructor;
53
53
  readonly autocomplete: import("@element-plus/nightly/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "off", boolean>;
54
+ readonly saveOnBlur: import("@element-plus/nightly/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
54
55
  readonly ariaLabel: StringConstructor;
55
56
  }, {
56
57
  focus: () => void;
@@ -109,6 +110,7 @@ declare const __VLS_component: import("vue").DefineComponent<{
109
110
  };
110
111
  readonly placeholder: StringConstructor;
111
112
  readonly autocomplete: import("@element-plus/nightly/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "off", boolean>;
113
+ readonly saveOnBlur: import("@element-plus/nightly/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
112
114
  readonly ariaLabel: StringConstructor;
113
115
  }>> & {
114
116
  "onUpdate:modelValue"?: ((value?: string[] | undefined) => any) | undefined;
@@ -132,6 +134,7 @@ declare const __VLS_component: import("vue").DefineComponent<{
132
134
  readonly tagType: import("@element-plus/nightly/es/utils").EpPropMergeType<StringConstructor, "success" | "warning" | "info" | "primary" | "danger", unknown>;
133
135
  readonly tagEffect: import("@element-plus/nightly/es/utils").EpPropMergeType<StringConstructor, "dark" | "light" | "plain", unknown>;
134
136
  readonly draggable: import("@element-plus/nightly/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
137
+ readonly saveOnBlur: import("@element-plus/nightly/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
135
138
  }>;
136
139
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
137
140
  export default _default;
@@ -1,11 +1,11 @@
1
1
  import Menu from './src/menu.mjs';
2
2
  export { menuEmits, menuProps } from './src/menu.mjs';
3
3
  import MenuItem from './src/menu-item2.mjs';
4
- import MenuItemGroup from './src/menu-item-group2.mjs';
4
+ import MenuItemGroup from './src/menu-item-group.mjs';
5
5
  import SubMenu from './src/sub-menu.mjs';
6
6
  export { subMenuProps } from './src/sub-menu.mjs';
7
7
  export { menuItemEmits, menuItemProps } from './src/menu-item.mjs';
8
- export { menuItemGroupProps } from './src/menu-item-group.mjs';
8
+ export { menuItemGroupProps } from './src/menu-item-group2.mjs';
9
9
  import { withInstall, withNoopInstall } from '../../utils/vue/install.mjs';
10
10
 
11
11
  const ElMenu = withInstall(Menu, {
@@ -1,6 +1,35 @@
1
- const menuItemGroupProps = {
2
- title: String
3
- };
1
+ import { defineComponent, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, Fragment, createTextVNode, toDisplayString, renderSlot } from 'vue';
2
+ import { menuItemGroupProps } from './menu-item-group2.mjs';
3
+ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
4
+ import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
4
5
 
5
- export { menuItemGroupProps };
6
+ const __default__ = defineComponent({
7
+ name: "ElMenuItemGroup"
8
+ });
9
+ const _sfc_main = /* @__PURE__ */ defineComponent({
10
+ ...__default__,
11
+ props: menuItemGroupProps,
12
+ setup(__props) {
13
+ const ns = useNamespace("menu-item-group");
14
+ return (_ctx, _cache) => {
15
+ return openBlock(), createElementBlock("li", {
16
+ class: normalizeClass(unref(ns).b())
17
+ }, [
18
+ createElementVNode("div", {
19
+ class: normalizeClass(unref(ns).e("title"))
20
+ }, [
21
+ !_ctx.$slots.title ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
22
+ createTextVNode(toDisplayString(_ctx.title), 1)
23
+ ], 64)) : renderSlot(_ctx.$slots, "title", { key: 1 })
24
+ ], 2),
25
+ createElementVNode("ul", null, [
26
+ renderSlot(_ctx.$slots, "default")
27
+ ])
28
+ ], 2);
29
+ };
30
+ }
31
+ });
32
+ var MenuItemGroup = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "menu-item-group.vue"]]);
33
+
34
+ export { MenuItemGroup as default };
6
35
  //# sourceMappingURL=menu-item-group.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"menu-item-group.mjs","sources":["../../../../../../packages/components/menu/src/menu-item-group.ts"],"sourcesContent":["import type { ExtractPropTypes } from 'vue'\n\nexport const menuItemGroupProps = {\n /**\n * @description group title\n */\n title: String,\n} as const\nexport type MenuItemGroupProps = ExtractPropTypes<typeof menuItemGroupProps>\n"],"names":[],"mappings":"AAAY,MAAC,kBAAkB,GAAG;AAClC,EAAE,KAAK,EAAE,MAAM;AACf;;;;"}
1
+ {"version":3,"file":"menu-item-group.mjs","sources":["../../../../../../packages/components/menu/src/menu-item-group.vue"],"sourcesContent":["<template>\n <li :class=\"ns.b()\">\n <div :class=\"ns.e('title')\">\n <template v-if=\"!$slots.title\">{{ title }}</template>\n <slot v-else name=\"title\" />\n </div>\n <ul>\n <slot />\n </ul>\n </li>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useNamespace } from '@element-plus/hooks'\nimport { menuItemGroupProps } from './menu-item-group'\n\ndefineOptions({\n name: 'ElMenuItemGroup',\n})\ndefineProps(menuItemGroupProps)\nconst ns = useNamespace('menu-item-group')\n</script>\n"],"names":[],"mappings":";;;;;mCAgBc,CAAA;AAAA,EACZ,IAAM,EAAA,iBAAA;AACR,CAAA,CAAA,CAAA;;;;;AAEA,IAAM,MAAA,EAAA,GAAK,aAAa,iBAAiB,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,35 +1,6 @@
1
- import { defineComponent, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, Fragment, createTextVNode, toDisplayString, renderSlot } from 'vue';
2
- import { menuItemGroupProps } from './menu-item-group.mjs';
3
- import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
4
- import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
1
+ const menuItemGroupProps = {
2
+ title: String
3
+ };
5
4
 
6
- const __default__ = defineComponent({
7
- name: "ElMenuItemGroup"
8
- });
9
- const _sfc_main = /* @__PURE__ */ defineComponent({
10
- ...__default__,
11
- props: menuItemGroupProps,
12
- setup(__props) {
13
- const ns = useNamespace("menu-item-group");
14
- return (_ctx, _cache) => {
15
- return openBlock(), createElementBlock("li", {
16
- class: normalizeClass(unref(ns).b())
17
- }, [
18
- createElementVNode("div", {
19
- class: normalizeClass(unref(ns).e("title"))
20
- }, [
21
- !_ctx.$slots.title ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
22
- createTextVNode(toDisplayString(_ctx.title), 1)
23
- ], 64)) : renderSlot(_ctx.$slots, "title", { key: 1 })
24
- ], 2),
25
- createElementVNode("ul", null, [
26
- renderSlot(_ctx.$slots, "default")
27
- ])
28
- ], 2);
29
- };
30
- }
31
- });
32
- var MenuItemGroup = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "menu-item-group.vue"]]);
33
-
34
- export { MenuItemGroup as default };
5
+ export { menuItemGroupProps };
35
6
  //# sourceMappingURL=menu-item-group2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"menu-item-group2.mjs","sources":["../../../../../../packages/components/menu/src/menu-item-group.vue"],"sourcesContent":["<template>\n <li :class=\"ns.b()\">\n <div :class=\"ns.e('title')\">\n <template v-if=\"!$slots.title\">{{ title }}</template>\n <slot v-else name=\"title\" />\n </div>\n <ul>\n <slot />\n </ul>\n </li>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useNamespace } from '@element-plus/hooks'\nimport { menuItemGroupProps } from './menu-item-group'\n\ndefineOptions({\n name: 'ElMenuItemGroup',\n})\ndefineProps(menuItemGroupProps)\nconst ns = useNamespace('menu-item-group')\n</script>\n"],"names":[],"mappings":";;;;;mCAgBc,CAAA;AAAA,EACZ,IAAM,EAAA,iBAAA;AACR,CAAA,CAAA,CAAA;;;;;AAEA,IAAM,MAAA,EAAA,GAAK,aAAa,iBAAiB,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"menu-item-group2.mjs","sources":["../../../../../../packages/components/menu/src/menu-item-group.ts"],"sourcesContent":["import type { ExtractPropTypes } from 'vue'\n\nexport const menuItemGroupProps = {\n /**\n * @description group title\n */\n title: String,\n} as const\nexport type MenuItemGroupProps = ExtractPropTypes<typeof menuItemGroupProps>\n"],"names":[],"mappings":"AAAY,MAAC,kBAAkB,GAAG;AAClC,EAAE,KAAK,EAAE,MAAM;AACf;;;;"}
@@ -2,7 +2,7 @@ import { QuestionFilled } from '@element-plus/icons-vue';
2
2
  import { buttonTypes } from '../../button/src/button.mjs';
3
3
  import { buildProps } from '../../../utils/vue/props/runtime.mjs';
4
4
  import { iconPropType } from '../../../utils/vue/icon.mjs';
5
- import { useTooltipContentProps } from '../../tooltip/src/content.mjs';
5
+ import { useTooltipContentProps } from '../../tooltip/src/content2.mjs';
6
6
 
7
7
  const popconfirmProps = buildProps({
8
8
  title: String,
@@ -1,7 +1,7 @@
1
1
  import { dropdownProps } from '../../dropdown/src/dropdown.mjs';
2
2
  import { buildProps } from '../../../utils/vue/props/runtime.mjs';
3
3
  import { useTooltipTriggerProps } from '../../tooltip/src/trigger.mjs';
4
- import { useTooltipContentProps } from '../../tooltip/src/content.mjs';
4
+ import { useTooltipContentProps } from '../../tooltip/src/content2.mjs';
5
5
  import { isBoolean } from '../../../utils/types.mjs';
6
6
 
7
7
  const popoverProps = buildProps({
@@ -1,5 +1,5 @@
1
- import Rate from './src/rate.mjs';
2
- export { rateEmits, rateProps } from './src/rate2.mjs';
1
+ import Rate from './src/rate2.mjs';
2
+ export { rateEmits, rateProps } from './src/rate.mjs';
3
3
  import { withInstall } from '../../utils/vue/install.mjs';
4
4
 
5
5
  const ElRate = withInstall(Rate);
@@ -1,262 +1,87 @@
1
- import { defineComponent, inject, ref, computed, markRaw, watch, openBlock, createElementBlock, unref, normalizeClass, normalizeStyle, Fragment, renderList, createVNode, withCtx, withDirectives, createBlock, resolveDynamicComponent, vShow, createCommentVNode, toDisplayString } from 'vue';
2
- import { ElIcon } from '../../icon/index.mjs';
3
- import { rateProps, rateEmits } from './rate2.mjs';
4
- import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
5
- import { formContextKey, formItemContextKey } from '../../form/src/constants.mjs';
6
- import { useFormSize } from '../../form/src/hooks/use-form-common-props.mjs';
7
- import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
8
- import { useFormItemInputId } from '../../form/src/hooks/use-form-item.mjs';
9
- import { isArray, isObject, isString } from '@vue/shared';
10
- import { UPDATE_MODEL_EVENT, CHANGE_EVENT } from '../../../constants/event.mjs';
11
- import { EVENT_CODE } from '../../../constants/aria.mjs';
12
- import { hasClass } from '../../../utils/dom/style.mjs';
1
+ import { StarFilled, Star } from '@element-plus/icons-vue';
2
+ import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
3
+ import { mutable } from '../../../utils/typescript.mjs';
4
+ import { iconPropType } from '../../../utils/vue/icon.mjs';
5
+ import { useSizeProp } from '../../../hooks/use-size/index.mjs';
6
+ import { useAriaProps } from '../../../hooks/use-aria/index.mjs';
7
+ import { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '../../../constants/event.mjs';
8
+ import { isNumber } from '../../../utils/types.mjs';
13
9
 
14
- const __default__ = defineComponent({
15
- name: "ElRate"
10
+ const rateProps = buildProps({
11
+ modelValue: {
12
+ type: Number,
13
+ default: 0
14
+ },
15
+ id: {
16
+ type: String,
17
+ default: void 0
18
+ },
19
+ lowThreshold: {
20
+ type: Number,
21
+ default: 2
22
+ },
23
+ highThreshold: {
24
+ type: Number,
25
+ default: 4
26
+ },
27
+ max: {
28
+ type: Number,
29
+ default: 5
30
+ },
31
+ colors: {
32
+ type: definePropType([Array, Object]),
33
+ default: () => mutable(["", "", ""])
34
+ },
35
+ voidColor: {
36
+ type: String,
37
+ default: ""
38
+ },
39
+ disabledVoidColor: {
40
+ type: String,
41
+ default: ""
42
+ },
43
+ icons: {
44
+ type: definePropType([Array, Object]),
45
+ default: () => [StarFilled, StarFilled, StarFilled]
46
+ },
47
+ voidIcon: {
48
+ type: iconPropType,
49
+ default: () => Star
50
+ },
51
+ disabledVoidIcon: {
52
+ type: iconPropType,
53
+ default: () => StarFilled
54
+ },
55
+ disabled: Boolean,
56
+ allowHalf: Boolean,
57
+ showText: Boolean,
58
+ showScore: Boolean,
59
+ textColor: {
60
+ type: String,
61
+ default: ""
62
+ },
63
+ texts: {
64
+ type: definePropType(Array),
65
+ default: () => mutable([
66
+ "Extremely bad",
67
+ "Disappointed",
68
+ "Fair",
69
+ "Satisfied",
70
+ "Surprise"
71
+ ])
72
+ },
73
+ scoreTemplate: {
74
+ type: String,
75
+ default: "{value}"
76
+ },
77
+ size: useSizeProp,
78
+ clearable: Boolean,
79
+ ...useAriaProps(["ariaLabel"])
16
80
  });
17
- const _sfc_main = /* @__PURE__ */ defineComponent({
18
- ...__default__,
19
- props: rateProps,
20
- emits: rateEmits,
21
- setup(__props, { expose, emit }) {
22
- const props = __props;
23
- function getValueFromMap(value, map) {
24
- const isExcludedObject = (val) => isObject(val);
25
- const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
26
- const val = map[key];
27
- const excluded = isExcludedObject(val) ? val.excluded : false;
28
- return excluded ? value < key : value <= key;
29
- }).sort((a, b) => a - b);
30
- const matchedValue = map[matchedKeys[0]];
31
- return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
32
- }
33
- const formContext = inject(formContextKey, void 0);
34
- const formItemContext = inject(formItemContextKey, void 0);
35
- const rateSize = useFormSize();
36
- const ns = useNamespace("rate");
37
- const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
38
- formItemContext
39
- });
40
- const currentValue = ref(props.modelValue);
41
- const hoverIndex = ref(-1);
42
- const pointerAtLeftHalf = ref(true);
43
- const rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)]);
44
- const rateDisabled = computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
45
- const rateStyles = computed(() => {
46
- return ns.cssVarBlock({
47
- "void-color": props.voidColor,
48
- "disabled-void-color": props.disabledVoidColor,
49
- "fill-color": activeColor.value
50
- });
51
- });
52
- const text = computed(() => {
53
- let result = "";
54
- if (props.showScore) {
55
- result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
56
- } else if (props.showText) {
57
- result = props.texts[Math.ceil(currentValue.value) - 1];
58
- }
59
- return result;
60
- });
61
- const valueDecimal = computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
62
- const colorMap = computed(() => isArray(props.colors) ? {
63
- [props.lowThreshold]: props.colors[0],
64
- [props.highThreshold]: { value: props.colors[1], excluded: true },
65
- [props.max]: props.colors[2]
66
- } : props.colors);
67
- const activeColor = computed(() => {
68
- const color = getValueFromMap(currentValue.value, colorMap.value);
69
- return isObject(color) ? "" : color;
70
- });
71
- const decimalStyle = computed(() => {
72
- let width = "";
73
- if (rateDisabled.value) {
74
- width = `${valueDecimal.value}%`;
75
- } else if (props.allowHalf) {
76
- width = "50%";
77
- }
78
- return {
79
- color: activeColor.value,
80
- width
81
- };
82
- });
83
- const componentMap = computed(() => {
84
- let icons = isArray(props.icons) ? [...props.icons] : { ...props.icons };
85
- icons = markRaw(icons);
86
- return isArray(icons) ? {
87
- [props.lowThreshold]: icons[0],
88
- [props.highThreshold]: {
89
- value: icons[1],
90
- excluded: true
91
- },
92
- [props.max]: icons[2]
93
- } : icons;
94
- });
95
- const decimalIconComponent = computed(() => getValueFromMap(props.modelValue, componentMap.value));
96
- const voidComponent = computed(() => rateDisabled.value ? isString(props.disabledVoidIcon) ? props.disabledVoidIcon : markRaw(props.disabledVoidIcon) : isString(props.voidIcon) ? props.voidIcon : markRaw(props.voidIcon));
97
- const activeComponent = computed(() => getValueFromMap(currentValue.value, componentMap.value));
98
- function showDecimalIcon(item) {
99
- const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
100
- const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
101
- return showWhenDisabled || showWhenAllowHalf;
102
- }
103
- function emitValue(value) {
104
- if (props.clearable && value === props.modelValue) {
105
- value = 0;
106
- }
107
- emit(UPDATE_MODEL_EVENT, value);
108
- if (props.modelValue !== value) {
109
- emit(CHANGE_EVENT, value);
110
- }
111
- }
112
- function selectValue(value) {
113
- if (rateDisabled.value) {
114
- return;
115
- }
116
- if (props.allowHalf && pointerAtLeftHalf.value) {
117
- emitValue(currentValue.value);
118
- } else {
119
- emitValue(value);
120
- }
121
- }
122
- function handleKey(e) {
123
- if (rateDisabled.value) {
124
- return;
125
- }
126
- let _currentValue = currentValue.value;
127
- const code = e.code;
128
- if (code === EVENT_CODE.up || code === EVENT_CODE.right) {
129
- if (props.allowHalf) {
130
- _currentValue += 0.5;
131
- } else {
132
- _currentValue += 1;
133
- }
134
- e.stopPropagation();
135
- e.preventDefault();
136
- } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {
137
- if (props.allowHalf) {
138
- _currentValue -= 0.5;
139
- } else {
140
- _currentValue -= 1;
141
- }
142
- e.stopPropagation();
143
- e.preventDefault();
144
- }
145
- _currentValue = _currentValue < 0 ? 0 : _currentValue;
146
- _currentValue = _currentValue > props.max ? props.max : _currentValue;
147
- emit(UPDATE_MODEL_EVENT, _currentValue);
148
- emit(CHANGE_EVENT, _currentValue);
149
- return _currentValue;
150
- }
151
- function setCurrentValue(value, event) {
152
- if (rateDisabled.value) {
153
- return;
154
- }
155
- if (props.allowHalf && event) {
156
- let target = event.target;
157
- if (hasClass(target, ns.e("item"))) {
158
- target = target.querySelector(`.${ns.e("icon")}`);
159
- }
160
- if (target.clientWidth === 0 || hasClass(target, ns.e("decimal"))) {
161
- target = target.parentNode;
162
- }
163
- pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth;
164
- currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
165
- } else {
166
- currentValue.value = value;
167
- }
168
- hoverIndex.value = value;
169
- }
170
- function resetCurrentValue() {
171
- if (rateDisabled.value) {
172
- return;
173
- }
174
- if (props.allowHalf) {
175
- pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
176
- }
177
- currentValue.value = props.modelValue;
178
- hoverIndex.value = -1;
179
- }
180
- watch(() => props.modelValue, (val) => {
181
- currentValue.value = val;
182
- pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
183
- });
184
- if (!props.modelValue) {
185
- emit(UPDATE_MODEL_EVENT, 0);
186
- }
187
- expose({
188
- setCurrentValue,
189
- resetCurrentValue
190
- });
191
- return (_ctx, _cache) => {
192
- var _a;
193
- return openBlock(), createElementBlock("div", {
194
- id: unref(inputId),
195
- class: normalizeClass([unref(rateClasses), unref(ns).is("disabled", unref(rateDisabled))]),
196
- role: "slider",
197
- "aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "rating" : void 0,
198
- "aria-labelledby": unref(isLabeledByFormItem) ? (_a = unref(formItemContext)) == null ? void 0 : _a.labelId : void 0,
199
- "aria-valuenow": currentValue.value,
200
- "aria-valuetext": unref(text) || void 0,
201
- "aria-valuemin": "0",
202
- "aria-valuemax": _ctx.max,
203
- tabindex: "0",
204
- style: normalizeStyle(unref(rateStyles)),
205
- onKeydown: handleKey
206
- }, [
207
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.max, (item, key) => {
208
- return openBlock(), createElementBlock("span", {
209
- key,
210
- class: normalizeClass(unref(ns).e("item")),
211
- onMousemove: ($event) => setCurrentValue(item, $event),
212
- onMouseleave: resetCurrentValue,
213
- onClick: ($event) => selectValue(item)
214
- }, [
215
- createVNode(unref(ElIcon), {
216
- class: normalizeClass([
217
- unref(ns).e("icon"),
218
- { hover: hoverIndex.value === item },
219
- unref(ns).is("active", item <= currentValue.value)
220
- ])
221
- }, {
222
- default: withCtx(() => [
223
- !showDecimalIcon(item) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
224
- withDirectives((openBlock(), createBlock(resolveDynamicComponent(unref(activeComponent)), null, null, 512)), [
225
- [vShow, item <= currentValue.value]
226
- ]),
227
- withDirectives((openBlock(), createBlock(resolveDynamicComponent(unref(voidComponent)), null, null, 512)), [
228
- [vShow, !(item <= currentValue.value)]
229
- ])
230
- ], 64)) : createCommentVNode("v-if", true),
231
- showDecimalIcon(item) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
232
- (openBlock(), createBlock(resolveDynamicComponent(unref(voidComponent)), {
233
- class: normalizeClass([unref(ns).em("decimal", "box")])
234
- }, null, 8, ["class"])),
235
- createVNode(unref(ElIcon), {
236
- style: normalizeStyle(unref(decimalStyle)),
237
- class: normalizeClass([unref(ns).e("icon"), unref(ns).e("decimal")])
238
- }, {
239
- default: withCtx(() => [
240
- (openBlock(), createBlock(resolveDynamicComponent(unref(decimalIconComponent))))
241
- ]),
242
- _: 1
243
- }, 8, ["style", "class"])
244
- ], 64)) : createCommentVNode("v-if", true)
245
- ]),
246
- _: 2
247
- }, 1032, ["class"])
248
- ], 42, ["onMousemove", "onClick"]);
249
- }), 128)),
250
- _ctx.showText || _ctx.showScore ? (openBlock(), createElementBlock("span", {
251
- key: 0,
252
- class: normalizeClass(unref(ns).e("text")),
253
- style: normalizeStyle({ color: _ctx.textColor })
254
- }, toDisplayString(unref(text)), 7)) : createCommentVNode("v-if", true)
255
- ], 46, ["id", "aria-label", "aria-labelledby", "aria-valuenow", "aria-valuetext", "aria-valuemax"]);
256
- };
257
- }
258
- });
259
- var Rate = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "rate.vue"]]);
81
+ const rateEmits = {
82
+ [CHANGE_EVENT]: (value) => isNumber(value),
83
+ [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
84
+ };
260
85
 
261
- export { Rate as default };
86
+ export { rateEmits, rateProps };
262
87
  //# sourceMappingURL=rate.mjs.map