@element-plus/nightly 0.0.20220104 → 0.0.20220108

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 (367) hide show
  1. package/attributes.json +1 -1
  2. package/dist/index.css +1 -1
  3. package/dist/index.full.js +655 -617
  4. package/dist/index.full.min.js +8 -8
  5. package/dist/index.full.min.js.map +1 -1
  6. package/dist/index.full.min.mjs +8 -8
  7. package/dist/index.full.min.mjs.map +1 -1
  8. package/dist/index.full.mjs +653 -614
  9. package/es/components/cascader/index.d.ts +4 -0
  10. package/es/components/cascader/src/index.vue.d.ts +2 -0
  11. package/es/components/cascader-panel/src/index.vue_vue_type_script_lang.mjs +5 -4
  12. package/es/components/cascader-panel/src/index.vue_vue_type_script_lang.mjs.map +1 -1
  13. package/es/components/cascader-panel/src/index.vue_vue_type_template_id_97c48f5c_lang.mjs.map +1 -1
  14. package/es/components/cascader-panel/src/menu.vue.d.ts +1 -0
  15. package/es/components/cascader-panel/src/menu.vue_vue_type_script_lang.mjs +6 -0
  16. package/es/components/cascader-panel/src/menu.vue_vue_type_script_lang.mjs.map +1 -1
  17. package/es/components/cascader-panel/src/menu.vue_vue_type_template_id_9c79e4e2_lang.mjs +19 -2
  18. package/es/components/cascader-panel/src/menu.vue_vue_type_template_id_9c79e4e2_lang.mjs.map +1 -1
  19. package/es/components/cascader-panel/src/types.d.ts +1 -0
  20. package/es/components/cascader-panel/src/types.mjs.map +1 -1
  21. package/es/components/checkbox/index.d.ts +6 -6
  22. package/es/components/checkbox/src/checkbox-button.vue.d.ts +2 -2
  23. package/es/components/checkbox/src/checkbox.vue.d.ts +2 -2
  24. package/es/components/config-provider/index.d.ts +6 -2
  25. package/es/components/config-provider/index.mjs +1 -1
  26. package/es/components/config-provider/src/config-provider.d.ts +13 -5
  27. package/es/components/config-provider/src/config-provider.mjs +12 -5
  28. package/es/components/config-provider/src/config-provider.mjs.map +1 -1
  29. package/es/components/date-picker/index.d.ts +4 -4
  30. package/es/components/date-picker/src/date-picker-com/basic-cell-render.mjs +1 -1
  31. package/es/components/date-picker/src/date-picker-com/basic-cell-render.mjs.map +1 -1
  32. package/es/components/date-picker/src/date-picker.d.ts +2 -2
  33. package/es/components/form/index.d.ts +1 -0
  34. package/es/components/form/src/form.vue.d.ts +1 -0
  35. package/es/components/form/src/form.vue_vue_type_script_lang.mjs +14 -0
  36. package/es/components/form/src/form.vue_vue_type_script_lang.mjs.map +1 -1
  37. package/es/components/form/src/form.vue_vue_type_template_id_602d6cf6_lang.mjs +1 -4
  38. package/es/components/form/src/form.vue_vue_type_template_id_602d6cf6_lang.mjs.map +1 -1
  39. package/es/components/index.mjs +2 -2
  40. package/es/components/input/index.d.ts +1 -0
  41. package/es/components/input/src/input.vue.d.ts +1 -0
  42. package/es/components/input/src/input.vue_vue_type_script_lang.mjs +1 -0
  43. package/es/components/input/src/input.vue_vue_type_script_lang.mjs.map +1 -1
  44. package/es/components/input/src/input.vue_vue_type_template_id_3290dcb6_lang.mjs +1 -1
  45. package/es/components/input/src/input.vue_vue_type_template_id_3290dcb6_lang.mjs.map +1 -1
  46. package/es/components/input-number/index.d.ts +5 -1
  47. package/es/components/input-number/src/input-number.vue.d.ts +5 -1
  48. package/es/components/input-number/src/input-number.vue_vue_type_script_lang.mjs +15 -1
  49. package/es/components/input-number/src/input-number.vue_vue_type_script_lang.mjs.map +1 -1
  50. package/es/components/input-number/src/input-number.vue_vue_type_template_id_dec60af6_lang.mjs +5 -4
  51. package/es/components/input-number/src/input-number.vue_vue_type_template_id_dec60af6_lang.mjs.map +1 -1
  52. package/es/components/message/src/message-method.mjs +5 -1
  53. package/es/components/message/src/message-method.mjs.map +1 -1
  54. package/es/components/message/src/message.d.ts +3 -0
  55. package/es/components/message/src/message.mjs.map +1 -1
  56. package/es/components/message/src/message.vue.d.ts +2 -2
  57. package/es/components/message-box/src/index.vue_vue_type_script_lang.mjs.map +1 -1
  58. package/es/components/message-box/src/index.vue_vue_type_template_id_7035e868_lang.mjs +1 -0
  59. package/es/components/message-box/src/index.vue_vue_type_template_id_7035e868_lang.mjs.map +1 -1
  60. package/es/components/notification/src/notification.vue.d.ts +4 -4
  61. package/es/components/popper/src/content.vue_vue_type_script_lang.mjs.map +1 -1
  62. package/es/components/popper/src/content.vue_vue_type_template_id_611b76f0_lang.mjs +1 -0
  63. package/es/components/popper/src/content.vue_vue_type_template_id_611b76f0_lang.mjs.map +1 -1
  64. package/es/components/radio/index.d.ts +6 -6
  65. package/es/components/radio/index.mjs +2 -2
  66. package/es/components/radio/src/radio-button.mjs +11 -5
  67. package/es/components/radio/src/radio-button.mjs.map +1 -1
  68. package/es/components/radio/src/radio-button.vue.d.ts +2 -2
  69. package/es/components/radio/src/radio-button.vue_vue_type_script_lang.mjs +1 -1
  70. package/es/components/radio/src/radio-button2.mjs +5 -11
  71. package/es/components/radio/src/radio-button2.mjs.map +1 -1
  72. package/es/components/radio/src/radio.vue.d.ts +2 -2
  73. package/es/components/rate/index.d.ts +7 -1
  74. package/es/components/rate/src/rate.d.ts +2 -0
  75. package/es/components/rate/src/rate.mjs +5 -0
  76. package/es/components/rate/src/rate.mjs.map +1 -1
  77. package/es/components/rate/src/rate.vue.d.ts +7 -1
  78. package/es/components/rate/src/rate.vue_vue_type_script_lang.mjs +6 -0
  79. package/es/components/rate/src/rate.vue_vue_type_script_lang.mjs.map +1 -1
  80. package/es/components/rate/src/rate.vue_vue_type_template_id_38c42df6_lang.mjs +3 -3
  81. package/es/components/rate/src/rate.vue_vue_type_template_id_38c42df6_lang.mjs.map +1 -1
  82. package/es/components/select/index.d.ts +1 -1
  83. package/es/components/select/src/select.vue.d.ts +1 -1
  84. package/es/components/select-v2/index.d.ts +2 -2
  85. package/es/components/select-v2/src/select.vue.d.ts +1 -1
  86. package/es/components/slider/index.d.ts +22 -6
  87. package/es/components/slider/src/index.vue.d.ts +11 -3
  88. package/es/components/slider/src/index.vue_vue_type_script_lang.mjs +21 -2
  89. package/es/components/slider/src/index.vue_vue_type_script_lang.mjs.map +1 -1
  90. package/es/components/slider/src/index.vue_vue_type_template_id_24c42d04_lang.mjs +19 -19
  91. package/es/components/slider/src/index.vue_vue_type_template_id_24c42d04_lang.mjs.map +1 -1
  92. package/es/components/switch/index.d.ts +7 -2
  93. package/es/components/switch/src/switch.d.ts +2 -0
  94. package/es/components/switch/src/switch.mjs +5 -0
  95. package/es/components/switch/src/switch.mjs.map +1 -1
  96. package/es/components/switch/src/switch.vue.d.ts +7 -2
  97. package/es/components/switch/src/switch.vue_vue_type_script_lang.mjs +10 -1
  98. package/es/components/switch/src/switch.vue_vue_type_script_lang.mjs.map +1 -1
  99. package/es/components/switch/src/switch.vue_vue_type_template_id_538fbc85_lang.mjs +1 -1
  100. package/es/components/switch/src/switch.vue_vue_type_template_id_538fbc85_lang.mjs.map +1 -1
  101. package/es/components/table/index.d.ts +9 -0
  102. package/es/components/table/src/table/style-helper.d.ts +7 -0
  103. package/es/components/table/src/table/style-helper.mjs +20 -17
  104. package/es/components/table/src/table/style-helper.mjs.map +1 -1
  105. package/es/components/table/src/table-body/index.mjs +5 -3
  106. package/es/components/table/src/table-body/index.mjs.map +1 -1
  107. package/es/components/table/src/table-body/styles-helper.d.ts +0 -1
  108. package/es/components/table/src/table-body/styles-helper.mjs +10 -17
  109. package/es/components/table/src/table-body/styles-helper.mjs.map +1 -1
  110. package/es/components/table/src/table-column/defaults.d.ts +1 -0
  111. package/es/components/table/src/table-column/defaults.mjs.map +1 -1
  112. package/es/components/table/src/table-column/index.mjs +1 -0
  113. package/es/components/table/src/table-column/index.mjs.map +1 -1
  114. package/es/components/table/src/table-footer/index.d.ts +4 -2
  115. package/es/components/table/src/table-footer/index.mjs +33 -18
  116. package/es/components/table/src/table-footer/index.mjs.map +1 -1
  117. package/es/components/table/src/table-footer/style-helper.d.ts +4 -2
  118. package/es/components/table/src/table-footer/style-helper.mjs +28 -31
  119. package/es/components/table/src/table-footer/style-helper.mjs.map +1 -1
  120. package/es/components/table/src/table-header/index.d.ts +3 -2
  121. package/es/components/table/src/table-header/index.mjs +89 -51
  122. package/es/components/table/src/table-header/index.mjs.map +1 -1
  123. package/es/components/table/src/table-header/style.helper.d.ts +1 -1
  124. package/es/components/table/src/table-header/style.helper.mjs +14 -24
  125. package/es/components/table/src/table-header/style.helper.mjs.map +1 -1
  126. package/es/components/table/src/table-header/utils-helper.mjs +1 -0
  127. package/es/components/table/src/table-header/utils-helper.mjs.map +1 -1
  128. package/es/components/table/src/table-layout.d.ts +1 -0
  129. package/es/components/table/src/table-layout.mjs +8 -3
  130. package/es/components/table/src/table-layout.mjs.map +1 -1
  131. package/es/components/table/src/table.vue.d.ts +9 -0
  132. package/es/components/table/src/table.vue_vue_type_script_lang.mjs +12 -2
  133. package/es/components/table/src/table.vue_vue_type_script_lang.mjs.map +1 -1
  134. package/es/components/table/src/table.vue_vue_type_template_id_4a1660ad_lang.mjs +62 -213
  135. package/es/components/table/src/table.vue_vue_type_template_id_4a1660ad_lang.mjs.map +1 -1
  136. package/es/components/table/src/util.d.ts +16 -2
  137. package/es/components/table/src/util.mjs +99 -6
  138. package/es/components/table/src/util.mjs.map +1 -1
  139. package/es/components/tabs/index.d.ts +4 -4
  140. package/es/components/tabs/src/tab-pane.vue.d.ts +2 -2
  141. package/es/components/time-picker/index.d.ts +4 -4
  142. package/es/components/time-picker/src/common/picker.vue.d.ts +2 -2
  143. package/es/components/time-picker/src/time-picker.d.ts +2 -2
  144. package/es/components/transfer/src/transfer-panel.vue.d.ts +1 -2
  145. package/es/components/transfer/src/transfer-panel.vue_vue_type_script_lang.mjs +2 -13
  146. package/es/components/transfer/src/transfer-panel.vue_vue_type_script_lang.mjs.map +1 -1
  147. package/es/components/transfer/src/transfer-panel.vue_vue_type_template_id_1a7d1f9c_lang.mjs +5 -18
  148. package/es/components/transfer/src/transfer-panel.vue_vue_type_template_id_1a7d1f9c_lang.mjs.map +1 -1
  149. package/es/defaults.d.ts +3 -1
  150. package/es/hooks/index.mjs +1 -1
  151. package/es/hooks/use-global-config/index.d.ts +3 -1
  152. package/es/hooks/use-global-config/index.mjs +3 -2
  153. package/es/hooks/use-global-config/index.mjs.map +1 -1
  154. package/es/hooks/use-id/index.mjs +2 -2
  155. package/es/hooks/use-id/index.mjs.map +1 -1
  156. package/es/hooks/use-locale/index.d.ts +2 -253
  157. package/es/hooks/use-locale/index.mjs +9 -29
  158. package/es/hooks/use-locale/index.mjs.map +1 -1
  159. package/es/hooks/use-popper-container/index.mjs +2 -2
  160. package/es/hooks/use-popper-container/index.mjs.map +1 -1
  161. package/es/index.d.ts +4 -1
  162. package/es/index.mjs +4 -3
  163. package/es/index.mjs.map +1 -1
  164. package/es/version.d.ts +1 -1
  165. package/es/version.mjs +1 -1
  166. package/es/version.mjs.map +1 -1
  167. package/lib/components/cascader/index.d.ts +4 -0
  168. package/lib/components/cascader/src/index.vue.d.ts +2 -0
  169. package/lib/components/cascader-panel/src/index.vue_vue_type_script_lang.js +5 -4
  170. package/lib/components/cascader-panel/src/index.vue_vue_type_script_lang.js.map +1 -1
  171. package/lib/components/cascader-panel/src/index.vue_vue_type_template_id_97c48f5c_lang.js.map +1 -1
  172. package/lib/components/cascader-panel/src/menu.vue.d.ts +1 -0
  173. package/lib/components/cascader-panel/src/menu.vue_vue_type_script_lang.js +10 -4
  174. package/lib/components/cascader-panel/src/menu.vue_vue_type_script_lang.js.map +1 -1
  175. package/lib/components/cascader-panel/src/menu.vue_vue_type_template_id_9c79e4e2_lang.js +18 -1
  176. package/lib/components/cascader-panel/src/menu.vue_vue_type_template_id_9c79e4e2_lang.js.map +1 -1
  177. package/lib/components/cascader-panel/src/types.d.ts +1 -0
  178. package/lib/components/cascader-panel/src/types.js.map +1 -1
  179. package/lib/components/checkbox/index.d.ts +6 -6
  180. package/lib/components/checkbox/src/checkbox-button.vue.d.ts +2 -2
  181. package/lib/components/checkbox/src/checkbox.vue.d.ts +2 -2
  182. package/lib/components/config-provider/index.d.ts +6 -2
  183. package/lib/components/config-provider/index.js +1 -0
  184. package/lib/components/config-provider/index.js.map +1 -1
  185. package/lib/components/config-provider/src/config-provider.d.ts +13 -5
  186. package/lib/components/config-provider/src/config-provider.js +13 -5
  187. package/lib/components/config-provider/src/config-provider.js.map +1 -1
  188. package/lib/components/date-picker/index.d.ts +4 -4
  189. package/lib/components/date-picker/src/date-picker-com/basic-cell-render.js +1 -1
  190. package/lib/components/date-picker/src/date-picker-com/basic-cell-render.js.map +1 -1
  191. package/lib/components/date-picker/src/date-picker.d.ts +2 -2
  192. package/lib/components/form/index.d.ts +1 -0
  193. package/lib/components/form/src/form.vue.d.ts +1 -0
  194. package/lib/components/form/src/form.vue_vue_type_script_lang.js +14 -0
  195. package/lib/components/form/src/form.vue_vue_type_script_lang.js.map +1 -1
  196. package/lib/components/form/src/form.vue_vue_type_template_id_602d6cf6_lang.js +1 -4
  197. package/lib/components/form/src/form.vue_vue_type_template_id_602d6cf6_lang.js.map +1 -1
  198. package/lib/components/index.js +2 -1
  199. package/lib/components/index.js.map +1 -1
  200. package/lib/components/input/index.d.ts +1 -0
  201. package/lib/components/input/src/input.vue.d.ts +1 -0
  202. package/lib/components/input/src/input.vue_vue_type_script_lang.js +1 -0
  203. package/lib/components/input/src/input.vue_vue_type_script_lang.js.map +1 -1
  204. package/lib/components/input/src/input.vue_vue_type_template_id_3290dcb6_lang.js +1 -1
  205. package/lib/components/input/src/input.vue_vue_type_template_id_3290dcb6_lang.js.map +1 -1
  206. package/lib/components/input-number/index.d.ts +5 -1
  207. package/lib/components/input-number/src/input-number.vue.d.ts +5 -1
  208. package/lib/components/input-number/src/input-number.vue_vue_type_script_lang.js +18 -4
  209. package/lib/components/input-number/src/input-number.vue_vue_type_script_lang.js.map +1 -1
  210. package/lib/components/input-number/src/input-number.vue_vue_type_template_id_dec60af6_lang.js +5 -4
  211. package/lib/components/input-number/src/input-number.vue_vue_type_template_id_dec60af6_lang.js.map +1 -1
  212. package/lib/components/message/src/message-method.js +5 -1
  213. package/lib/components/message/src/message-method.js.map +1 -1
  214. package/lib/components/message/src/message.d.ts +3 -0
  215. package/lib/components/message/src/message.js.map +1 -1
  216. package/lib/components/message/src/message.vue.d.ts +2 -2
  217. package/lib/components/message-box/src/index.vue_vue_type_script_lang.js.map +1 -1
  218. package/lib/components/message-box/src/index.vue_vue_type_template_id_7035e868_lang.js +1 -0
  219. package/lib/components/message-box/src/index.vue_vue_type_template_id_7035e868_lang.js.map +1 -1
  220. package/lib/components/notification/src/notification.vue.d.ts +4 -4
  221. package/lib/components/popper/src/content.vue_vue_type_script_lang.js.map +1 -1
  222. package/lib/components/popper/src/content.vue_vue_type_template_id_611b76f0_lang.js +1 -0
  223. package/lib/components/popper/src/content.vue_vue_type_template_id_611b76f0_lang.js.map +1 -1
  224. package/lib/components/radio/index.d.ts +6 -6
  225. package/lib/components/radio/index.js +2 -2
  226. package/lib/components/radio/src/radio-button.js +10 -5
  227. package/lib/components/radio/src/radio-button.js.map +1 -1
  228. package/lib/components/radio/src/radio-button.vue.d.ts +2 -2
  229. package/lib/components/radio/src/radio-button.vue_vue_type_script_lang.js +1 -1
  230. package/lib/components/radio/src/radio-button2.js +5 -10
  231. package/lib/components/radio/src/radio-button2.js.map +1 -1
  232. package/lib/components/radio/src/radio.vue.d.ts +2 -2
  233. package/lib/components/rate/index.d.ts +7 -1
  234. package/lib/components/rate/src/rate.d.ts +2 -0
  235. package/lib/components/rate/src/rate.js +5 -0
  236. package/lib/components/rate/src/rate.js.map +1 -1
  237. package/lib/components/rate/src/rate.vue.d.ts +7 -1
  238. package/lib/components/rate/src/rate.vue_vue_type_script_lang.js +6 -0
  239. package/lib/components/rate/src/rate.vue_vue_type_script_lang.js.map +1 -1
  240. package/lib/components/rate/src/rate.vue_vue_type_template_id_38c42df6_lang.js +2 -2
  241. package/lib/components/rate/src/rate.vue_vue_type_template_id_38c42df6_lang.js.map +1 -1
  242. package/lib/components/select/index.d.ts +1 -1
  243. package/lib/components/select/src/select.vue.d.ts +1 -1
  244. package/lib/components/select-v2/index.d.ts +2 -2
  245. package/lib/components/select-v2/src/select.vue.d.ts +1 -1
  246. package/lib/components/slider/index.d.ts +22 -6
  247. package/lib/components/slider/src/index.vue.d.ts +11 -3
  248. package/lib/components/slider/src/index.vue_vue_type_script_lang.js +21 -2
  249. package/lib/components/slider/src/index.vue_vue_type_script_lang.js.map +1 -1
  250. package/lib/components/slider/src/index.vue_vue_type_template_id_24c42d04_lang.js +18 -18
  251. package/lib/components/slider/src/index.vue_vue_type_template_id_24c42d04_lang.js.map +1 -1
  252. package/lib/components/switch/index.d.ts +7 -2
  253. package/lib/components/switch/src/switch.d.ts +2 -0
  254. package/lib/components/switch/src/switch.js +5 -0
  255. package/lib/components/switch/src/switch.js.map +1 -1
  256. package/lib/components/switch/src/switch.vue.d.ts +7 -2
  257. package/lib/components/switch/src/switch.vue_vue_type_script_lang.js +9 -0
  258. package/lib/components/switch/src/switch.vue_vue_type_script_lang.js.map +1 -1
  259. package/lib/components/switch/src/switch.vue_vue_type_template_id_538fbc85_lang.js +1 -1
  260. package/lib/components/switch/src/switch.vue_vue_type_template_id_538fbc85_lang.js.map +1 -1
  261. package/lib/components/table/index.d.ts +9 -0
  262. package/lib/components/table/src/table/style-helper.d.ts +7 -0
  263. package/lib/components/table/src/table/style-helper.js +20 -21
  264. package/lib/components/table/src/table/style-helper.js.map +1 -1
  265. package/lib/components/table/src/table-body/index.js +5 -3
  266. package/lib/components/table/src/table-body/index.js.map +1 -1
  267. package/lib/components/table/src/table-body/styles-helper.d.ts +0 -1
  268. package/lib/components/table/src/table-body/styles-helper.js +10 -17
  269. package/lib/components/table/src/table-body/styles-helper.js.map +1 -1
  270. package/lib/components/table/src/table-column/defaults.d.ts +1 -0
  271. package/lib/components/table/src/table-column/defaults.js.map +1 -1
  272. package/lib/components/table/src/table-column/index.js +1 -0
  273. package/lib/components/table/src/table-column/index.js.map +1 -1
  274. package/lib/components/table/src/table-footer/index.d.ts +4 -2
  275. package/lib/components/table/src/table-footer/index.js +32 -17
  276. package/lib/components/table/src/table-footer/index.js.map +1 -1
  277. package/lib/components/table/src/table-footer/style-helper.d.ts +4 -2
  278. package/lib/components/table/src/table-footer/style-helper.js +28 -31
  279. package/lib/components/table/src/table-footer/style-helper.js.map +1 -1
  280. package/lib/components/table/src/table-header/index.d.ts +3 -2
  281. package/lib/components/table/src/table-header/index.js +89 -51
  282. package/lib/components/table/src/table-header/index.js.map +1 -1
  283. package/lib/components/table/src/table-header/style.helper.d.ts +1 -1
  284. package/lib/components/table/src/table-header/style.helper.js +14 -24
  285. package/lib/components/table/src/table-header/style.helper.js.map +1 -1
  286. package/lib/components/table/src/table-header/utils-helper.js +1 -0
  287. package/lib/components/table/src/table-header/utils-helper.js.map +1 -1
  288. package/lib/components/table/src/table-layout.d.ts +1 -0
  289. package/lib/components/table/src/table-layout.js +8 -3
  290. package/lib/components/table/src/table-layout.js.map +1 -1
  291. package/lib/components/table/src/table.vue.d.ts +9 -0
  292. package/lib/components/table/src/table.vue_vue_type_script_lang.js +12 -2
  293. package/lib/components/table/src/table.vue_vue_type_script_lang.js.map +1 -1
  294. package/lib/components/table/src/table.vue_vue_type_template_id_4a1660ad_lang.js +62 -213
  295. package/lib/components/table/src/table.vue_vue_type_template_id_4a1660ad_lang.js.map +1 -1
  296. package/lib/components/table/src/util.d.ts +16 -2
  297. package/lib/components/table/src/util.js +104 -5
  298. package/lib/components/table/src/util.js.map +1 -1
  299. package/lib/components/tabs/index.d.ts +4 -4
  300. package/lib/components/tabs/src/tab-pane.vue.d.ts +2 -2
  301. package/lib/components/time-picker/index.d.ts +4 -4
  302. package/lib/components/time-picker/src/common/picker.vue.d.ts +2 -2
  303. package/lib/components/time-picker/src/time-picker.d.ts +2 -2
  304. package/lib/components/transfer/src/transfer-panel.vue.d.ts +1 -2
  305. package/lib/components/transfer/src/transfer-panel.vue_vue_type_script_lang.js +3 -14
  306. package/lib/components/transfer/src/transfer-panel.vue_vue_type_script_lang.js.map +1 -1
  307. package/lib/components/transfer/src/transfer-panel.vue_vue_type_template_id_1a7d1f9c_lang.js +4 -17
  308. package/lib/components/transfer/src/transfer-panel.vue_vue_type_template_id_1a7d1f9c_lang.js.map +1 -1
  309. package/lib/defaults.d.ts +3 -1
  310. package/lib/hooks/index.js +1 -4
  311. package/lib/hooks/index.js.map +1 -1
  312. package/lib/hooks/use-global-config/index.d.ts +3 -1
  313. package/lib/hooks/use-global-config/index.js +3 -2
  314. package/lib/hooks/use-global-config/index.js.map +1 -1
  315. package/lib/hooks/use-id/index.js +2 -2
  316. package/lib/hooks/use-id/index.js.map +1 -1
  317. package/lib/hooks/use-locale/index.d.ts +2 -253
  318. package/lib/hooks/use-locale/index.js +8 -31
  319. package/lib/hooks/use-locale/index.js.map +1 -1
  320. package/lib/hooks/use-popper-container/index.js +2 -2
  321. package/lib/hooks/use-popper-container/index.js.map +1 -1
  322. package/lib/index.d.ts +4 -1
  323. package/lib/index.js +5 -5
  324. package/lib/index.js.map +1 -1
  325. package/lib/version.d.ts +1 -1
  326. package/lib/version.js +1 -1
  327. package/lib/version.js.map +1 -1
  328. package/package.json +2 -2
  329. package/tags.json +1 -1
  330. package/theme-chalk/el-cascader.css +1 -1
  331. package/theme-chalk/el-checkbox.css +1 -1
  332. package/theme-chalk/el-date-picker.css +1 -1
  333. package/theme-chalk/el-form.css +1 -1
  334. package/theme-chalk/el-pagination.css +1 -1
  335. package/theme-chalk/el-radio.css +1 -1
  336. package/theme-chalk/el-rate.css +1 -1
  337. package/theme-chalk/el-select-v2.css +1 -1
  338. package/theme-chalk/el-slider.css +1 -1
  339. package/theme-chalk/el-switch.css +1 -1
  340. package/theme-chalk/el-table.css +1 -1
  341. package/theme-chalk/el-tag.css +1 -1
  342. package/theme-chalk/el-time-picker.css +1 -1
  343. package/theme-chalk/el-time-select.css +1 -1
  344. package/theme-chalk/el-transfer.css +1 -1
  345. package/theme-chalk/index.css +1 -1
  346. package/theme-chalk/src/cascader.scss +4 -0
  347. package/theme-chalk/src/checkbox.scss +40 -6
  348. package/theme-chalk/src/common/var.scss +2 -4
  349. package/theme-chalk/src/date-picker/picker-panel.scss +1 -1
  350. package/theme-chalk/src/date-picker/picker.scss +1 -0
  351. package/theme-chalk/src/form.scss +101 -24
  352. package/theme-chalk/src/pagination.scss +0 -3
  353. package/theme-chalk/src/radio.scss +21 -0
  354. package/theme-chalk/src/rate.scss +19 -2
  355. package/theme-chalk/src/select-v2.scss +2 -3
  356. package/theme-chalk/src/slider.scss +28 -77
  357. package/theme-chalk/src/switch.scss +43 -4
  358. package/theme-chalk/src/table.scss +176 -124
  359. package/theme-chalk/src/tag.scss +3 -3
  360. package/theme-chalk/src/transfer.scss +27 -31
  361. package/web-types.json +1 -1
  362. package/es/utils/isServer.d.ts +0 -2
  363. package/es/utils/isServer.mjs +0 -4
  364. package/es/utils/isServer.mjs.map +0 -1
  365. package/lib/utils/isServer.d.ts +0 -2
  366. package/lib/utils/isServer.js +0 -8
  367. package/lib/utils/isServer.js.map +0 -1
@@ -27,9 +27,9 @@ export declare const ElRadio: import("../../utils/types").SFCWithInstall<import(
27
27
  } & {
28
28
  size: import("../../utils/props").BuildPropType<StringConstructor, "" | "small" | "default" | "large", never>;
29
29
  disabled: boolean;
30
- name: string;
31
30
  modelValue: import("../../utils/props").BuildPropType<readonly [StringConstructor, NumberConstructor, BooleanConstructor], unknown, unknown>;
32
31
  label: import("../../utils/props").BuildPropType<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
32
+ name: string;
33
33
  border: boolean;
34
34
  } & {}> & {
35
35
  onChange?: ((val: string | number | boolean) => any) | undefined;
@@ -37,9 +37,9 @@ export declare const ElRadio: import("../../utils/types").SFCWithInstall<import(
37
37
  }, {
38
38
  size: import("../../utils/props").BuildPropType<StringConstructor, "" | "small" | "default" | "large", never>;
39
39
  disabled: boolean;
40
- name: string;
41
40
  modelValue: import("../../utils/props").BuildPropType<readonly [StringConstructor, NumberConstructor, BooleanConstructor], unknown, unknown>;
42
41
  label: import("../../utils/props").BuildPropType<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
42
+ name: string;
43
43
  border: boolean;
44
44
  }>> & {
45
45
  RadioButton: import("vue").DefineComponent<{
@@ -64,13 +64,13 @@ export declare const ElRadio: import("../../utils/types").SFCWithInstall<import(
64
64
  } & {
65
65
  size: import("../../utils/props").BuildPropType<StringConstructor, "" | "small" | "default" | "large", never>;
66
66
  disabled: boolean;
67
- name: string;
68
67
  label: import("../../utils/props").BuildPropType<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
68
+ name: string;
69
69
  } & {}>, {
70
70
  size: import("../../utils/props").BuildPropType<StringConstructor, "" | "small" | "default" | "large", never>;
71
71
  disabled: boolean;
72
- name: string;
73
72
  label: import("../../utils/props").BuildPropType<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
73
+ name: string;
74
74
  }>;
75
75
  RadioGroup: import("vue").DefineComponent<{
76
76
  readonly size: import("../../utils/props").BuildPropReturn<StringConstructor, "", false, "" | "small" | "default" | "large", never>;
@@ -164,13 +164,13 @@ export declare const ElRadioButton: import("../../utils/types").SFCWithInstall<i
164
164
  } & {
165
165
  size: import("../../utils/props").BuildPropType<StringConstructor, "" | "small" | "default" | "large", never>;
166
166
  disabled: boolean;
167
- name: string;
168
167
  label: import("../../utils/props").BuildPropType<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
168
+ name: string;
169
169
  } & {}>, {
170
170
  size: import("../../utils/props").BuildPropType<StringConstructor, "" | "small" | "default" | "large", never>;
171
171
  disabled: boolean;
172
- name: string;
173
172
  label: import("../../utils/props").BuildPropType<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
173
+ name: string;
174
174
  }>>;
175
175
  export * from './src/radio';
176
176
  export * from './src/radio-group';
@@ -1,10 +1,10 @@
1
1
  import { withInstall, withNoopInstall } from '../../utils/with-install.mjs';
2
2
  import './src/radio2.mjs';
3
- import './src/radio-button.mjs';
3
+ import './src/radio-button2.mjs';
4
4
  import './src/radio-group2.mjs';
5
5
  export { radioEmits, radioProps, radioPropsBase, useRadio } from './src/radio.mjs';
6
6
  export { radioGroupEmits, radioGroupProps } from './src/radio-group.mjs';
7
- export { radioButtonProps } from './src/radio-button2.mjs';
7
+ export { radioButtonProps } from './src/radio-button.mjs';
8
8
  import script from './src/radio.vue_vue_type_script_lang.mjs';
9
9
  import script$1 from './src/radio-button.vue_vue_type_script_lang.mjs';
10
10
  import script$2 from './src/radio-group.vue_vue_type_script_lang.mjs';
@@ -1,7 +1,13 @@
1
- import script from './radio-button.vue_vue_type_script_lang.mjs';
2
- export { default } from './radio-button.vue_vue_type_script_lang.mjs';
3
- import { render } from './radio-button.vue_vue_type_template_id_14e266b0_lang.mjs';
1
+ import { buildProps } from '../../../utils/props.mjs';
2
+ import { radioPropsBase } from './radio.mjs';
4
3
 
5
- script.render = render;
6
- script.__file = "packages/components/radio/src/radio-button.vue";
4
+ const radioButtonProps = buildProps({
5
+ ...radioPropsBase,
6
+ name: {
7
+ type: String,
8
+ default: ""
9
+ }
10
+ });
11
+
12
+ export { radioButtonProps };
7
13
  //# sourceMappingURL=radio-button.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio-button.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
1
+ {"version":3,"file":"radio-button.mjs","sources":["../../../../../../packages/components/radio/src/radio-button.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils/props'\nimport { radioPropsBase } from './radio'\nimport type { ExtractPropTypes } from 'vue'\n\nexport const radioButtonProps = buildProps({\n ...radioPropsBase,\n name: {\n type: String,\n default: '',\n },\n} as const)\n\nexport type RadioButtonProps = ExtractPropTypes<typeof radioButtonProps>\n"],"names":[],"mappings":";;;AAEY,MAAC,gBAAgB,GAAG,UAAU,CAAC;AAC3C,EAAE,GAAG,cAAc;AACnB,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,CAAC;;;;"}
@@ -21,12 +21,12 @@ declare const _default: import("vue").DefineComponent<{
21
21
  } & {
22
22
  size: import("../../../utils/props").BuildPropType<StringConstructor, "" | "small" | "default" | "large", never>;
23
23
  disabled: boolean;
24
- name: string;
25
24
  label: import("../../../utils/props").BuildPropType<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
25
+ name: string;
26
26
  } & {}>, {
27
27
  size: import("../../../utils/props").BuildPropType<StringConstructor, "" | "small" | "default" | "large", never>;
28
28
  disabled: boolean;
29
- name: string;
30
29
  label: import("../../../utils/props").BuildPropType<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
30
+ name: string;
31
31
  }>;
32
32
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed } from 'vue';
2
2
  import { useRadio } from './radio.mjs';
3
- import { radioButtonProps } from './radio-button2.mjs';
3
+ import { radioButtonProps } from './radio-button.mjs';
4
4
 
5
5
  var script = defineComponent({
6
6
  name: "ElRadioButton",
@@ -1,13 +1,7 @@
1
- import { buildProps } from '../../../utils/props.mjs';
2
- import { radioPropsBase } from './radio.mjs';
1
+ import script from './radio-button.vue_vue_type_script_lang.mjs';
2
+ export { default } from './radio-button.vue_vue_type_script_lang.mjs';
3
+ import { render } from './radio-button.vue_vue_type_template_id_14e266b0_lang.mjs';
3
4
 
4
- const radioButtonProps = buildProps({
5
- ...radioPropsBase,
6
- name: {
7
- type: String,
8
- default: ""
9
- }
10
- });
11
-
12
- export { radioButtonProps };
5
+ script.render = render;
6
+ script.__file = "packages/components/radio/src/radio-button.vue";
13
7
  //# sourceMappingURL=radio-button2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio-button2.mjs","sources":["../../../../../../packages/components/radio/src/radio-button.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils/props'\nimport { radioPropsBase } from './radio'\nimport type { ExtractPropTypes } from 'vue'\n\nexport const radioButtonProps = buildProps({\n ...radioPropsBase,\n name: {\n type: String,\n default: '',\n },\n} as const)\n\nexport type RadioButtonProps = ExtractPropTypes<typeof radioButtonProps>\n"],"names":[],"mappings":";;;AAEY,MAAC,gBAAgB,GAAG,UAAU,CAAC;AAC3C,EAAE,GAAG,cAAc;AACnB,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,CAAC;;;;"}
1
+ {"version":3,"file":"radio-button2.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -27,9 +27,9 @@ declare const _default: import("vue").DefineComponent<{
27
27
  } & {
28
28
  size: import("../../../utils/props").BuildPropType<StringConstructor, "" | "small" | "default" | "large", never>;
29
29
  disabled: boolean;
30
- name: string;
31
30
  modelValue: import("../../../utils/props").BuildPropType<readonly [StringConstructor, NumberConstructor, BooleanConstructor], unknown, unknown>;
32
31
  label: import("../../../utils/props").BuildPropType<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
32
+ name: string;
33
33
  border: boolean;
34
34
  } & {}> & {
35
35
  onChange?: ((val: string | number | boolean) => any) | undefined;
@@ -37,9 +37,9 @@ declare const _default: import("vue").DefineComponent<{
37
37
  }, {
38
38
  size: import("../../../utils/props").BuildPropType<StringConstructor, "" | "small" | "default" | "large", never>;
39
39
  disabled: boolean;
40
- name: string;
41
40
  modelValue: import("../../../utils/props").BuildPropType<readonly [StringConstructor, NumberConstructor, BooleanConstructor], unknown, unknown>;
42
41
  label: import("../../../utils/props").BuildPropType<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
42
+ name: string;
43
43
  border: boolean;
44
44
  }>;
45
45
  export default _default;
@@ -16,6 +16,7 @@ export declare const ElRate: import("../../utils/types").SFCWithInstall<import("
16
16
  readonly textColor: import("../../utils/props").BuildPropReturn<StringConstructor, "#1f2d3d", unknown, unknown, unknown>;
17
17
  readonly texts: import("../../utils/props").BuildPropReturn<import("../../utils/props").PropWrapper<string[]>, () => ["Extremely bad", "Disappointed", "Fair", "Satisfied", "Surprise"], unknown, unknown, unknown>;
18
18
  readonly scoreTemplate: import("../../utils/props").BuildPropReturn<StringConstructor, "{value}", unknown, unknown, unknown>;
19
+ readonly size: import("../../utils/props").BuildPropReturn<(new (...args: any[]) => import("../../utils/types").ComponentSize & {}) | (() => import("../../utils/types").ComponentSize) | ((new (...args: any[]) => import("../../utils/types").ComponentSize & {}) | (() => import("../../utils/types").ComponentSize))[], unknown, unknown, unknown, unknown>;
19
20
  }, {
20
21
  hoverIndex: import("vue").Ref<number>;
21
22
  currentValue: import("vue").Ref<number>;
@@ -43,6 +44,7 @@ export declare const ElRate: import("../../utils/types").SFCWithInstall<import("
43
44
  };
44
45
  }>;
45
46
  iconComponents: import("vue").ComputedRef<any[]>;
47
+ rateKls: import("vue").ComputedRef<string[]>;
46
48
  showDecimalIcon: (item: number) => boolean;
47
49
  getIconStyle: (item: number) => {
48
50
  color: string | {
@@ -75,6 +77,7 @@ export declare const ElRate: import("../../utils/types").SFCWithInstall<import("
75
77
  readonly textColor?: unknown;
76
78
  readonly texts?: unknown;
77
79
  readonly scoreTemplate?: unknown;
80
+ readonly size?: unknown;
78
81
  } & {
79
82
  disabled: import("../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
80
83
  modelValue: number;
@@ -93,10 +96,13 @@ export declare const ElRate: import("../../utils/types").SFCWithInstall<import("
93
96
  showScore: import("../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
94
97
  texts: string[];
95
98
  scoreTemplate: string;
96
- } & {}> & {
99
+ } & {
100
+ size?: import("../../utils/props").BuildPropType<(new (...args: any[]) => import("../../utils/types").ComponentSize & {}) | (() => import("../../utils/types").ComponentSize) | ((new (...args: any[]) => import("../../utils/types").ComponentSize & {}) | (() => import("../../utils/types").ComponentSize))[], unknown, unknown> | undefined;
101
+ }> & {
97
102
  onChange?: ((value: number) => any) | undefined;
98
103
  "onUpdate:modelValue"?: ((value: number) => any) | undefined;
99
104
  }, {
105
+ size: import("../../utils/props").BuildPropType<(new (...args: any[]) => import("../../utils/types").ComponentSize & {}) | (() => import("../../utils/types").ComponentSize) | ((new (...args: any[]) => import("../../utils/types").ComponentSize & {}) | (() => import("../../utils/types").ComponentSize))[], unknown, unknown>;
100
106
  disabled: import("../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
101
107
  modelValue: number;
102
108
  textColor: string;
@@ -1,3 +1,4 @@
1
+ import type { ComponentSize } from 'element-plus/es/utils/types';
1
2
  import type { Component, ExtractPropTypes } from 'vue';
2
3
  export declare const rateProps: {
3
4
  readonly modelValue: import("element-plus/es/utils/props").BuildPropReturn<NumberConstructor, 0, unknown, unknown, unknown>;
@@ -17,6 +18,7 @@ export declare const rateProps: {
17
18
  readonly textColor: import("element-plus/es/utils/props").BuildPropReturn<StringConstructor, "#1f2d3d", unknown, unknown, unknown>;
18
19
  readonly texts: import("element-plus/es/utils/props").BuildPropReturn<import("element-plus/es/utils/props").PropWrapper<string[]>, () => ["Extremely bad", "Disappointed", "Fair", "Satisfied", "Surprise"], unknown, unknown, unknown>;
19
20
  readonly scoreTemplate: import("element-plus/es/utils/props").BuildPropReturn<StringConstructor, "{value}", unknown, unknown, unknown>;
21
+ readonly size: import("element-plus/es/utils/props").BuildPropReturn<(new (...args: any[]) => ComponentSize & {}) | (() => ComponentSize) | ((new (...args: any[]) => ComponentSize & {}) | (() => ComponentSize))[], unknown, unknown, unknown, unknown>;
20
22
  };
21
23
  export declare type RateProps = ExtractPropTypes<typeof rateProps>;
22
24
  export declare const rateEmits: {
@@ -1,6 +1,7 @@
1
1
  import { StarFilled, Star } from '@element-plus/icons-vue';
2
2
  import { UPDATE_MODEL_EVENT } from '../../../utils/constants.mjs';
3
3
  import { buildProps, definePropType, mutable } from '../../../utils/props.mjs';
4
+ import { isValidComponentSize } from '../../../utils/validators.mjs';
4
5
 
5
6
  const rateProps = buildProps({
6
7
  modelValue: {
@@ -76,6 +77,10 @@ const rateProps = buildProps({
76
77
  scoreTemplate: {
77
78
  type: String,
78
79
  default: "{value}"
80
+ },
81
+ size: {
82
+ type: String,
83
+ validator: isValidComponentSize
79
84
  }
80
85
  });
81
86
  const rateEmits = {
@@ -1 +1 @@
1
- {"version":3,"file":"rate.mjs","sources":["../../../../../../packages/components/rate/src/rate.ts"],"sourcesContent":["import { Star, StarFilled } from '@element-plus/icons-vue'\nimport { UPDATE_MODEL_EVENT } from '@element-plus/utils/constants'\nimport { buildProps, definePropType, mutable } from '@element-plus/utils/props'\nimport type { Component, ExtractPropTypes } from 'vue'\n\nexport const rateProps = buildProps({\n modelValue: {\n type: Number,\n default: 0,\n },\n lowThreshold: {\n type: Number,\n default: 2,\n },\n highThreshold: {\n type: Number,\n default: 4,\n },\n max: {\n type: Number,\n default: 5,\n },\n colors: {\n type: definePropType<string[] | Record<number, string>>([Array, Object]),\n default: () => mutable(['#F7BA2A', '#F7BA2A', '#F7BA2A'] as const),\n },\n voidColor: {\n type: String,\n default: '#C6D1DE',\n },\n disabledVoidColor: {\n type: String,\n default: '#EFF2F7',\n },\n icons: {\n type: definePropType<\n Array<string | Component> | Record<number, string | Component>\n >([Array, Object]),\n default: () => [StarFilled, StarFilled, StarFilled],\n },\n voidIcon: {\n type: definePropType<string | Component>([String, Object]),\n default: () => Star,\n },\n disabledvoidIcon: {\n type: definePropType<string | Component>([String, Object]),\n default: () => StarFilled,\n },\n disabled: {\n type: Boolean,\n default: false,\n },\n allowHalf: {\n type: Boolean,\n default: false,\n },\n showText: {\n type: Boolean,\n default: false,\n },\n showScore: {\n type: Boolean,\n default: false,\n },\n textColor: {\n type: String,\n default: '#1f2d3d',\n },\n texts: {\n type: definePropType<string[]>([Array]),\n default: () =>\n mutable([\n 'Extremely bad',\n 'Disappointed',\n 'Fair',\n 'Satisfied',\n 'Surprise',\n ] as const),\n },\n scoreTemplate: {\n type: String,\n default: '{value}',\n },\n} as const)\n\nexport type RateProps = ExtractPropTypes<typeof rateProps>\n\nexport const rateEmits = {\n change: (value: number) => typeof value === 'number',\n [UPDATE_MODEL_EVENT]: (value: number) => typeof value === 'number',\n}\nexport type RateEmits = typeof rateEmits\n"],"names":[],"mappings":";;;;AAGY,MAAC,SAAS,GAAG,UAAU,CAAC;AACpC,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,GAAG,EAAE;AACP,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AACzC,IAAI,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAC7D,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,SAAS;AACtB,GAAG;AACH,EAAE,iBAAiB,EAAE;AACrB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,SAAS;AACtB,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AACzC,IAAI,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC;AACvD,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1C,IAAI,OAAO,EAAE,MAAM,IAAI;AACvB,GAAG;AACH,EAAE,gBAAgB,EAAE;AACpB,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1C,IAAI,OAAO,EAAE,MAAM,UAAU;AAC7B,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,SAAS;AACtB,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,KAAK,CAAC,CAAC;AACjC,IAAI,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3B,MAAM,eAAe;AACrB,MAAM,cAAc;AACpB,MAAM,MAAM;AACZ,MAAM,WAAW;AACjB,MAAM,UAAU;AAChB,KAAK,CAAC;AACN,GAAG;AACH,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,SAAS;AACtB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,SAAS,GAAG;AACzB,EAAE,MAAM,EAAE,CAAC,KAAK,KAAK,OAAO,KAAK,KAAK,QAAQ;AAC9C,EAAE,CAAC,kBAAkB,GAAG,CAAC,KAAK,KAAK,OAAO,KAAK,KAAK,QAAQ;AAC5D;;;;"}
1
+ {"version":3,"file":"rate.mjs","sources":["../../../../../../packages/components/rate/src/rate.ts"],"sourcesContent":["import { Star, StarFilled } from '@element-plus/icons-vue'\nimport { UPDATE_MODEL_EVENT } from '@element-plus/utils/constants'\nimport { buildProps, definePropType, mutable } from '@element-plus/utils/props'\nimport { isValidComponentSize } from '@element-plus/utils/validators'\nimport type { ComponentSize } from '@element-plus/utils/types'\nimport type { Component, ExtractPropTypes, PropType } from 'vue'\n\nexport const rateProps = buildProps({\n modelValue: {\n type: Number,\n default: 0,\n },\n lowThreshold: {\n type: Number,\n default: 2,\n },\n highThreshold: {\n type: Number,\n default: 4,\n },\n max: {\n type: Number,\n default: 5,\n },\n colors: {\n type: definePropType<string[] | Record<number, string>>([Array, Object]),\n default: () => mutable(['#F7BA2A', '#F7BA2A', '#F7BA2A'] as const),\n },\n voidColor: {\n type: String,\n default: '#C6D1DE',\n },\n disabledVoidColor: {\n type: String,\n default: '#EFF2F7',\n },\n icons: {\n type: definePropType<\n Array<string | Component> | Record<number, string | Component>\n >([Array, Object]),\n default: () => [StarFilled, StarFilled, StarFilled],\n },\n voidIcon: {\n type: definePropType<string | Component>([String, Object]),\n default: () => Star,\n },\n disabledvoidIcon: {\n type: definePropType<string | Component>([String, Object]),\n default: () => StarFilled,\n },\n disabled: {\n type: Boolean,\n default: false,\n },\n allowHalf: {\n type: Boolean,\n default: false,\n },\n showText: {\n type: Boolean,\n default: false,\n },\n showScore: {\n type: Boolean,\n default: false,\n },\n textColor: {\n type: String,\n default: '#1f2d3d',\n },\n texts: {\n type: definePropType<string[]>([Array]),\n default: () =>\n mutable([\n 'Extremely bad',\n 'Disappointed',\n 'Fair',\n 'Satisfied',\n 'Surprise',\n ] as const),\n },\n scoreTemplate: {\n type: String,\n default: '{value}',\n },\n size: {\n type: String as PropType<ComponentSize>,\n validator: isValidComponentSize,\n },\n} as const)\n\nexport type RateProps = ExtractPropTypes<typeof rateProps>\n\nexport const rateEmits = {\n change: (value: number) => typeof value === 'number',\n [UPDATE_MODEL_EVENT]: (value: number) => typeof value === 'number',\n}\nexport type RateEmits = typeof rateEmits\n"],"names":[],"mappings":";;;;;A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OAAO,EAAE,MAAM,UAAU;AAC7B,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,SAAS;AACtB,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,KAAK,CAAC,CAAC;AACjC,IAAI,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3B,MAAM,eAAe;AACrB,MAAM,cAAc;AACpB,MAAM,MAAM;AACZ,MAAM,WAAW;AACjB,MAAM,UAAU;AAChB,KAAK,CAAC;AACN,GAAG;AACH,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,SAAS;AACtB,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,SAAS,EAAE,oBAAoB;AACnC,GAAG;AACH,CAAC,EAAE;AACS,MAAC,SAAS,GAAG;AACzB,EAAE,MAAM,EAAE,CAAC,KAAK,KAAK,OAAO,KAAK,KAAK,QAAQ;AAC9C,EAAE,CAAC,kBAAkB,GAAG,CAAC,KAAK,KAAK,OAAO,KAAK,KAAK,QAAQ;AAC5D;;;;"}
@@ -16,6 +16,7 @@ declare const _default: import("vue").DefineComponent<{
16
16
  readonly textColor: import("../../../utils/props").BuildPropReturn<StringConstructor, "#1f2d3d", unknown, unknown, unknown>;
17
17
  readonly texts: import("../../../utils/props").BuildPropReturn<import("../../../utils/props").PropWrapper<string[]>, () => ["Extremely bad", "Disappointed", "Fair", "Satisfied", "Surprise"], unknown, unknown, unknown>;
18
18
  readonly scoreTemplate: import("../../../utils/props").BuildPropReturn<StringConstructor, "{value}", unknown, unknown, unknown>;
19
+ readonly size: import("../../../utils/props").BuildPropReturn<(new (...args: any[]) => import("../../../utils/types").ComponentSize & {}) | (() => import("../../../utils/types").ComponentSize) | ((new (...args: any[]) => import("../../../utils/types").ComponentSize & {}) | (() => import("../../../utils/types").ComponentSize))[], unknown, unknown, unknown, unknown>;
19
20
  }, {
20
21
  hoverIndex: import("vue").Ref<number>;
21
22
  currentValue: import("vue").Ref<number>;
@@ -43,6 +44,7 @@ declare const _default: import("vue").DefineComponent<{
43
44
  };
44
45
  }>;
45
46
  iconComponents: import("vue").ComputedRef<any[]>;
47
+ rateKls: import("vue").ComputedRef<string[]>;
46
48
  showDecimalIcon: (item: number) => boolean;
47
49
  getIconStyle: (item: number) => {
48
50
  color: string | {
@@ -75,6 +77,7 @@ declare const _default: import("vue").DefineComponent<{
75
77
  readonly textColor?: unknown;
76
78
  readonly texts?: unknown;
77
79
  readonly scoreTemplate?: unknown;
80
+ readonly size?: unknown;
78
81
  } & {
79
82
  disabled: import("../../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
80
83
  modelValue: number;
@@ -93,10 +96,13 @@ declare const _default: import("vue").DefineComponent<{
93
96
  showScore: import("../../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
94
97
  texts: string[];
95
98
  scoreTemplate: string;
96
- } & {}> & {
99
+ } & {
100
+ size?: import("../../../utils/props").BuildPropType<(new (...args: any[]) => import("../../../utils/types").ComponentSize & {}) | (() => import("../../../utils/types").ComponentSize) | ((new (...args: any[]) => import("../../../utils/types").ComponentSize & {}) | (() => import("../../../utils/types").ComponentSize))[], unknown, unknown> | undefined;
101
+ }> & {
97
102
  onChange?: ((value: number) => any) | undefined;
98
103
  "onUpdate:modelValue"?: ((value: number) => any) | undefined;
99
104
  }, {
105
+ size: import("../../../utils/props").BuildPropType<(new (...args: any[]) => import("../../../utils/types").ComponentSize & {}) | (() => import("../../../utils/types").ComponentSize) | ((new (...args: any[]) => import("../../../utils/types").ComponentSize & {}) | (() => import("../../../utils/types").ComponentSize))[], unknown, unknown>;
100
106
  disabled: import("../../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
101
107
  modelValue: number;
102
108
  textColor: string;
@@ -6,8 +6,10 @@ import { EVENT_CODE } from '../../../utils/aria.mjs';
6
6
  import { UPDATE_MODEL_EVENT } from '../../../utils/constants.mjs';
7
7
  import { ElIcon } from '../../icon/index.mjs';
8
8
  import { StarFilled, Star } from '@element-plus/icons-vue';
9
+ import '../../../hooks/index.mjs';
9
10
  import { rateProps, rateEmits } from './rate.mjs';
10
11
  import { elFormKey } from '../../../tokens/form.mjs';
12
+ import { useSize } from '../../../hooks/use-common-props/index.mjs';
11
13
 
12
14
  function getValueFromMap(value, map) {
13
15
  const isExcludedObject = (val) => isObject(val);
@@ -30,9 +32,12 @@ var script = defineComponent({
30
32
  emits: rateEmits,
31
33
  setup(props, { emit }) {
32
34
  const elForm = inject(elFormKey, {});
35
+ const rateSize = useSize();
33
36
  const currentValue = ref(props.modelValue);
34
37
  const hoverIndex = ref(-1);
35
38
  const pointerAtLeftHalf = ref(true);
39
+ const prefix = "el-rate";
40
+ const rateKls = computed(() => [prefix, `${prefix}--${rateSize.value}`]);
36
41
  const rateDisabled = computed(() => props.disabled || elForm.disabled);
37
42
  const text = computed(() => {
38
43
  let result = "";
@@ -180,6 +185,7 @@ var script = defineComponent({
180
185
  decimalStyle,
181
186
  decimalIconComponent,
182
187
  iconComponents,
188
+ rateKls,
183
189
  showDecimalIcon,
184
190
  getIconStyle,
185
191
  selectValue,
@@ -1 +1 @@
1
- {"version":3,"file":"rate.vue_vue_type_script_lang.mjs","sources":["../../../../../../packages/components/rate/src/rate.vue"],"sourcesContent":["<template>\n <div\n class=\"el-rate\"\n role=\"slider\"\n :aria-valuenow=\"currentValue\"\n :aria-valuetext=\"text\"\n aria-valuemin=\"0\"\n :aria-valuemax=\"max\"\n tabindex=\"0\"\n @keydown=\"handleKey\"\n >\n <span\n v-for=\"(item, key) in max\"\n :key=\"key\"\n class=\"el-rate__item\"\n :style=\"{ cursor: rateDisabled ? 'auto' : 'pointer' }\"\n @mousemove=\"setCurrentValue(item, $event)\"\n @mouseleave=\"resetCurrentValue\"\n @click=\"selectValue(item)\"\n >\n <el-icon\n :class=\"[{ hover: hoverIndex === item }]\"\n class=\"el-rate__icon\"\n :style=\"getIconStyle(item)\"\n >\n <component :is=\"iconComponents[item - 1]\" />\n <el-icon\n v-if=\"showDecimalIcon(item)\"\n :style=\"decimalStyle\"\n class=\"el-rate__icon el-rate__decimal\"\n >\n <component :is=\"decimalIconComponent\" />\n </el-icon>\n </el-icon>\n </span>\n <span\n v-if=\"showText || showScore\"\n class=\"el-rate__text\"\n :style=\"{ color: textColor }\"\n >\n {{ text }}\n </span>\n </div>\n</template>\n<script lang=\"ts\">\nimport { defineComponent, inject, computed, ref, watch } from 'vue'\nimport { isObject, isArray } from '@vue/shared'\nimport { elFormKey } from '@element-plus/tokens'\nimport { hasClass } from '@element-plus/utils/dom'\nimport { EVENT_CODE } from '@element-plus/utils/aria'\n\nimport { UPDATE_MODEL_EVENT } from '@element-plus/utils/constants'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { StarFilled, Star } from '@element-plus/icons-vue'\nimport { rateProps, rateEmits } from './rate'\nimport type { ElFormContext } from '@element-plus/tokens'\n\nfunction getValueFromMap<T>(\n value: number,\n map: Record<string, T | { excluded?: boolean; value: T }>\n) {\n const isExcludedObject = (\n val: unknown\n ): val is { excluded?: boolean } & Record<any, unknown> => isObject(val)\n\n const matchedKeys = Object.keys(map)\n .map((key) => +key)\n .filter((key) => {\n const val = map[key]\n const excluded = isExcludedObject(val) ? val.excluded : false\n return excluded ? value < key : value <= key\n })\n .sort((a, b) => a - b)\n const matchedValue = map[matchedKeys[0]]\n return (isExcludedObject(matchedValue) && matchedValue.value) || matchedValue\n}\n\nexport default defineComponent({\n name: 'ElRate',\n components: {\n ElIcon,\n StarFilled,\n Star,\n },\n props: rateProps,\n emits: rateEmits,\n\n setup(props, { emit }) {\n const elForm = inject(elFormKey, {} as ElFormContext)\n\n const currentValue = ref(props.modelValue)\n const hoverIndex = ref(-1)\n const pointerAtLeftHalf = ref(true)\n\n const rateDisabled = computed(() => props.disabled || elForm.disabled)\n const text = computed(() => {\n let result = ''\n if (props.showScore) {\n result = props.scoreTemplate.replace(\n /\\{\\s*value\\s*\\}/,\n rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`\n )\n } else if (props.showText) {\n result = props.texts[Math.ceil(currentValue.value) - 1]\n }\n return result\n })\n const valueDecimal = computed(\n () => props.modelValue * 100 - Math.floor(props.modelValue) * 100\n )\n const colorMap = computed(() =>\n isArray(props.colors)\n ? {\n [props.lowThreshold]: props.colors[0],\n [props.highThreshold]: { value: props.colors[1], excluded: true },\n [props.max]: props.colors[2],\n }\n : props.colors\n )\n const activeColor = computed(() =>\n getValueFromMap(currentValue.value, colorMap.value)\n )\n const decimalStyle = computed(() => {\n let width = ''\n if (rateDisabled.value) {\n width = `${valueDecimal.value}%`\n } else if (props.allowHalf) {\n width = '50%'\n }\n return {\n color: activeColor.value,\n width,\n }\n })\n const componentMap = computed(() =>\n isArray(props.icons)\n ? {\n [props.lowThreshold]: props.icons[0],\n [props.highThreshold]: {\n value: props.icons[1],\n excluded: true,\n },\n [props.max]: props.icons[2],\n }\n : props.icons\n )\n const decimalIconComponent = computed(() =>\n getValueFromMap(props.modelValue, componentMap.value)\n )\n const voidComponent = computed(() =>\n rateDisabled.value ? props.disabledvoidIcon : props.voidIcon\n )\n const activeComponent = computed(() =>\n getValueFromMap(currentValue.value, componentMap.value)\n )\n const iconComponents = computed(() => {\n const result = Array(props.max)\n const threshold = currentValue.value\n result.fill(activeComponent.value, 0, threshold)\n result.fill(voidComponent.value, threshold, props.max)\n return result\n })\n\n function showDecimalIcon(item: number) {\n const showWhenDisabled =\n rateDisabled.value &&\n valueDecimal.value > 0 &&\n item - 1 < props.modelValue &&\n item > props.modelValue\n const showWhenAllowHalf =\n props.allowHalf &&\n pointerAtLeftHalf.value &&\n item - 0.5 <= currentValue.value &&\n item > currentValue.value\n return showWhenDisabled || showWhenAllowHalf\n }\n\n function getIconStyle(item: number) {\n const voidColor = rateDisabled.value\n ? props.disabledVoidColor\n : props.voidColor\n return {\n color: item <= currentValue.value ? activeColor.value : voidColor,\n }\n }\n\n function selectValue(value: number) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf && pointerAtLeftHalf.value) {\n emit(UPDATE_MODEL_EVENT, currentValue.value)\n if (props.modelValue !== currentValue.value) {\n emit('change', currentValue.value)\n }\n } else {\n emit(UPDATE_MODEL_EVENT, value)\n if (props.modelValue !== value) {\n emit('change', value)\n }\n }\n }\n\n function handleKey(e: KeyboardEvent) {\n if (rateDisabled.value) {\n return\n }\n let _currentValue = currentValue.value\n const code = e.code\n if (code === EVENT_CODE.up || code === EVENT_CODE.right) {\n if (props.allowHalf) {\n _currentValue += 0.5\n } else {\n _currentValue += 1\n }\n e.stopPropagation()\n e.preventDefault()\n } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {\n if (props.allowHalf) {\n _currentValue -= 0.5\n } else {\n _currentValue -= 1\n }\n e.stopPropagation()\n e.preventDefault()\n }\n _currentValue = _currentValue < 0 ? 0 : _currentValue\n _currentValue = _currentValue > props.max ? props.max : _currentValue\n emit(UPDATE_MODEL_EVENT, _currentValue)\n emit('change', _currentValue)\n return _currentValue\n }\n\n function setCurrentValue(value: number, event: MouseEvent) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf) {\n let target = event.target as HTMLElement\n if (hasClass(target, 'el-rate__item')) {\n target = target.querySelector('.el-rate__icon')!\n }\n if (target.clientWidth === 0 || hasClass(target, 'el-rate__decimal')) {\n target = target.parentNode as HTMLElement\n }\n pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth\n currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value\n } else {\n currentValue.value = value\n }\n hoverIndex.value = value\n }\n\n function resetCurrentValue() {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf) {\n pointerAtLeftHalf.value =\n props.modelValue !== Math.floor(props.modelValue)\n }\n currentValue.value = props.modelValue\n hoverIndex.value = -1\n }\n\n watch(\n () => props.modelValue,\n (val) => {\n currentValue.value = val\n pointerAtLeftHalf.value =\n props.modelValue !== Math.floor(props.modelValue)\n }\n )\n\n if (!props.modelValue) {\n emit(UPDATE_MODEL_EVENT, 0)\n }\n\n return {\n hoverIndex,\n currentValue,\n rateDisabled,\n text,\n decimalStyle,\n decimalIconComponent,\n iconComponents,\n\n showDecimalIcon,\n getIconStyle,\n selectValue,\n handleKey,\n setCurrentValue,\n resetCurrentValue,\n }\n },\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;AAqDA,SAAS,eAAe,MAAM,KAAK,EAAE;AACrC,EAAE,sBAAsB,GAAG,CAAC,gBAAgB;AAC5C,EAAE,MAAM,WAAW,GAAG,MAAM,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG;;AAExD,IAAI,MAAM,QAAQ,GAAG;IACjB,OAAO;GACR,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE;AAC1B,EAAE;EACA,OAAO,gBAAgB;;aAEV,eAAe,CAAC;;EAE7B,UAAU,EAAE;IACV,MAAM;IACN,UAAU;QACN;;OAED,EAAE,SAAS;;OAEX,CAAC,OAAO,EAAE,QAAQ;IACrB,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACrC,MAAM,YAAY,GAAG,GAAG,CAAC,KAAK,CAAC,UAAU,CA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oBAEE;qBACC;MACf;MACA,WAAW;MACX,SAAS;MACT,eAAe;MACf,iBAAiB;MACjB;;;;;;"}
1
+ {"version":3,"file":"rate.vue_vue_type_script_lang.mjs","sources":["../../../../../../packages/components/rate/src/rate.vue"],"sourcesContent":["<template>\n <div\n :class=\"rateKls\"\n role=\"slider\"\n :aria-valuenow=\"currentValue\"\n :aria-valuetext=\"text\"\n aria-valuemin=\"0\"\n :aria-valuemax=\"max\"\n tabindex=\"0\"\n @keydown=\"handleKey\"\n >\n <span\n v-for=\"(item, key) in max\"\n :key=\"key\"\n class=\"el-rate__item\"\n :style=\"{ cursor: rateDisabled ? 'auto' : 'pointer' }\"\n @mousemove=\"setCurrentValue(item, $event)\"\n @mouseleave=\"resetCurrentValue\"\n @click=\"selectValue(item)\"\n >\n <el-icon\n :class=\"[{ hover: hoverIndex === item }]\"\n class=\"el-rate__icon\"\n :style=\"getIconStyle(item)\"\n >\n <component :is=\"iconComponents[item - 1]\" />\n <el-icon\n v-if=\"showDecimalIcon(item)\"\n :style=\"decimalStyle\"\n class=\"el-rate__icon el-rate__decimal\"\n >\n <component :is=\"decimalIconComponent\" />\n </el-icon>\n </el-icon>\n </span>\n <span\n v-if=\"showText || showScore\"\n class=\"el-rate__text\"\n :style=\"{ color: textColor }\"\n >\n {{ text }}\n </span>\n </div>\n</template>\n<script lang=\"ts\">\nimport { defineComponent, inject, computed, ref, watch } from 'vue'\nimport { isObject, isArray } from '@vue/shared'\nimport { elFormKey } from '@element-plus/tokens'\nimport { hasClass } from '@element-plus/utils/dom'\nimport { EVENT_CODE } from '@element-plus/utils/aria'\n\nimport { UPDATE_MODEL_EVENT } from '@element-plus/utils/constants'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { StarFilled, Star } from '@element-plus/icons-vue'\nimport { useSize } from '@element-plus/hooks'\nimport { rateProps, rateEmits } from './rate'\nimport type { ElFormContext } from '@element-plus/tokens'\n\nfunction getValueFromMap<T>(\n value: number,\n map: Record<string, T | { excluded?: boolean; value: T }>\n) {\n const isExcludedObject = (\n val: unknown\n ): val is { excluded?: boolean } & Record<any, unknown> => isObject(val)\n\n const matchedKeys = Object.keys(map)\n .map((key) => +key)\n .filter((key) => {\n const val = map[key]\n const excluded = isExcludedObject(val) ? val.excluded : false\n return excluded ? value < key : value <= key\n })\n .sort((a, b) => a - b)\n const matchedValue = map[matchedKeys[0]]\n return (isExcludedObject(matchedValue) && matchedValue.value) || matchedValue\n}\n\nexport default defineComponent({\n name: 'ElRate',\n components: {\n ElIcon,\n StarFilled,\n Star,\n },\n props: rateProps,\n emits: rateEmits,\n\n setup(props, { emit }) {\n const elForm = inject(elFormKey, {} as ElFormContext)\n\n const rateSize = useSize()\n const currentValue = ref(props.modelValue)\n const hoverIndex = ref(-1)\n const pointerAtLeftHalf = ref(true)\n\n const prefix = 'el-rate'\n const rateKls = computed(() => [prefix, `${prefix}--${rateSize.value}`])\n\n const rateDisabled = computed(() => props.disabled || elForm.disabled)\n const text = computed(() => {\n let result = ''\n if (props.showScore) {\n result = props.scoreTemplate.replace(\n /\\{\\s*value\\s*\\}/,\n rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`\n )\n } else if (props.showText) {\n result = props.texts[Math.ceil(currentValue.value) - 1]\n }\n return result\n })\n const valueDecimal = computed(\n () => props.modelValue * 100 - Math.floor(props.modelValue) * 100\n )\n const colorMap = computed(() =>\n isArray(props.colors)\n ? {\n [props.lowThreshold]: props.colors[0],\n [props.highThreshold]: { value: props.colors[1], excluded: true },\n [props.max]: props.colors[2],\n }\n : props.colors\n )\n const activeColor = computed(() =>\n getValueFromMap(currentValue.value, colorMap.value)\n )\n const decimalStyle = computed(() => {\n let width = ''\n if (rateDisabled.value) {\n width = `${valueDecimal.value}%`\n } else if (props.allowHalf) {\n width = '50%'\n }\n return {\n color: activeColor.value,\n width,\n }\n })\n const componentMap = computed(() =>\n isArray(props.icons)\n ? {\n [props.lowThreshold]: props.icons[0],\n [props.highThreshold]: {\n value: props.icons[1],\n excluded: true,\n },\n [props.max]: props.icons[2],\n }\n : props.icons\n )\n const decimalIconComponent = computed(() =>\n getValueFromMap(props.modelValue, componentMap.value)\n )\n const voidComponent = computed(() =>\n rateDisabled.value ? props.disabledvoidIcon : props.voidIcon\n )\n const activeComponent = computed(() =>\n getValueFromMap(currentValue.value, componentMap.value)\n )\n const iconComponents = computed(() => {\n const result = Array(props.max)\n const threshold = currentValue.value\n result.fill(activeComponent.value, 0, threshold)\n result.fill(voidComponent.value, threshold, props.max)\n return result\n })\n\n function showDecimalIcon(item: number) {\n const showWhenDisabled =\n rateDisabled.value &&\n valueDecimal.value > 0 &&\n item - 1 < props.modelValue &&\n item > props.modelValue\n const showWhenAllowHalf =\n props.allowHalf &&\n pointerAtLeftHalf.value &&\n item - 0.5 <= currentValue.value &&\n item > currentValue.value\n return showWhenDisabled || showWhenAllowHalf\n }\n\n function getIconStyle(item: number) {\n const voidColor = rateDisabled.value\n ? props.disabledVoidColor\n : props.voidColor\n return {\n color: item <= currentValue.value ? activeColor.value : voidColor,\n }\n }\n\n function selectValue(value: number) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf && pointerAtLeftHalf.value) {\n emit(UPDATE_MODEL_EVENT, currentValue.value)\n if (props.modelValue !== currentValue.value) {\n emit('change', currentValue.value)\n }\n } else {\n emit(UPDATE_MODEL_EVENT, value)\n if (props.modelValue !== value) {\n emit('change', value)\n }\n }\n }\n\n function handleKey(e: KeyboardEvent) {\n if (rateDisabled.value) {\n return\n }\n let _currentValue = currentValue.value\n const code = e.code\n if (code === EVENT_CODE.up || code === EVENT_CODE.right) {\n if (props.allowHalf) {\n _currentValue += 0.5\n } else {\n _currentValue += 1\n }\n e.stopPropagation()\n e.preventDefault()\n } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {\n if (props.allowHalf) {\n _currentValue -= 0.5\n } else {\n _currentValue -= 1\n }\n e.stopPropagation()\n e.preventDefault()\n }\n _currentValue = _currentValue < 0 ? 0 : _currentValue\n _currentValue = _currentValue > props.max ? props.max : _currentValue\n emit(UPDATE_MODEL_EVENT, _currentValue)\n emit('change', _currentValue)\n return _currentValue\n }\n\n function setCurrentValue(value: number, event: MouseEvent) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf) {\n let target = event.target as HTMLElement\n if (hasClass(target, 'el-rate__item')) {\n target = target.querySelector('.el-rate__icon')!\n }\n if (target.clientWidth === 0 || hasClass(target, 'el-rate__decimal')) {\n target = target.parentNode as HTMLElement\n }\n pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth\n currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value\n } else {\n currentValue.value = value\n }\n hoverIndex.value = value\n }\n\n function resetCurrentValue() {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf) {\n pointerAtLeftHalf.value =\n props.modelValue !== Math.floor(props.modelValue)\n }\n currentValue.value = props.modelValue\n hoverIndex.value = -1\n }\n\n watch(\n () => props.modelValue,\n (val) => {\n currentValue.value = val\n pointerAtLeftHalf.value =\n props.modelValue !== Math.floor(props.modelValue)\n }\n )\n\n if (!props.modelValue) {\n emit(UPDATE_MODEL_EVENT, 0)\n }\n\n return {\n hoverIndex,\n currentValue,\n rateDisabled,\n text,\n decimalStyle,\n decimalIconComponent,\n iconComponents,\n rateKls,\n\n showDecimalIcon,\n getIconStyle,\n selectValue,\n handleKey,\n setCurrentValue,\n resetCurrentValue,\n }\n },\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;AAsDA,SAAS,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE;AACrC,EAAE,sBAAsB,GAAG,CAAC,gBAAgB;AAC5C,EAAE,MAAM,WAAW,GAAG,MAAM,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG;;AAExD,IAAI,MAAM,QAAQ,GAAG;IACjB,OAAO;GACR,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE;AAC1B,EAAE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C;;MAED;;SAEG,CAAC,WAAW,CAAC;MAChB,aAAa,KAAK,GAAG,GAAG,CAAC;uBACR,CAAC,KAAK;;QAErB,OAAO;UACL,CAAC;;WAEA;gBACK;MACV,YAAY;kBACA;UACR;;;;aAIG;qBACQ;MACf;MACA,WAAW;MACX,SAAS;MACT,eAAe;MACf,iBAAiB;MACjB;;;;;;"}
@@ -1,11 +1,11 @@
1
- import { resolveComponent, openBlock, createElementBlock, Fragment, renderList, normalizeStyle, createVNode, normalizeClass, withCtx, createBlock, resolveDynamicComponent, createCommentVNode, toDisplayString } from 'vue';
1
+ import { resolveComponent, openBlock, createElementBlock, normalizeClass, Fragment, renderList, normalizeStyle, createVNode, withCtx, createBlock, resolveDynamicComponent, createCommentVNode, toDisplayString } from 'vue';
2
2
 
3
3
  const _hoisted_1 = ["aria-valuenow", "aria-valuetext", "aria-valuemax"];
4
4
  const _hoisted_2 = ["onMousemove", "onClick"];
5
5
  function render(_ctx, _cache, $props, $setup, $data, $options) {
6
6
  const _component_el_icon = resolveComponent("el-icon");
7
7
  return openBlock(), createElementBlock("div", {
8
- class: "el-rate",
8
+ class: normalizeClass(_ctx.rateKls),
9
9
  role: "slider",
10
10
  "aria-valuenow": _ctx.currentValue,
11
11
  "aria-valuetext": _ctx.text,
@@ -49,7 +49,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
49
49
  class: "el-rate__text",
50
50
  style: normalizeStyle({ color: _ctx.textColor })
51
51
  }, toDisplayString(_ctx.text), 5)) : createCommentVNode("v-if", true)
52
- ], 40, _hoisted_1);
52
+ ], 42, _hoisted_1);
53
53
  }
54
54
 
55
55
  export { render };
@@ -1 +1 @@
1
- {"version":3,"file":"rate.vue_vue_type_template_id_38c42df6_lang.mjs","sources":["../../../../../../packages/components/rate/src/rate.vue?vue&type=template&id=38c42df6&lang.js"],"sourcesContent":["<template>\n <div\n class=\"el-rate\"\n role=\"slider\"\n :aria-valuenow=\"currentValue\"\n :aria-valuetext=\"text\"\n aria-valuemin=\"0\"\n :aria-valuemax=\"max\"\n tabindex=\"0\"\n @keydown=\"handleKey\"\n >\n <span\n v-for=\"(item, key) in max\"\n :key=\"key\"\n class=\"el-rate__item\"\n :style=\"{ cursor: rateDisabled ? 'auto' : 'pointer' }\"\n @mousemove=\"setCurrentValue(item, $event)\"\n @mouseleave=\"resetCurrentValue\"\n @click=\"selectValue(item)\"\n >\n <el-icon\n :class=\"[{ hover: hoverIndex === item }]\"\n class=\"el-rate__icon\"\n :style=\"getIconStyle(item)\"\n >\n <component :is=\"iconComponents[item - 1]\" />\n <el-icon\n v-if=\"showDecimalIcon(item)\"\n :style=\"decimalStyle\"\n class=\"el-rate__icon el-rate__decimal\"\n >\n <component :is=\"decimalIconComponent\" />\n </el-icon>\n </el-icon>\n </span>\n <span\n v-if=\"showText || showScore\"\n class=\"el-rate__text\"\n :style=\"{ color: textColor }\"\n >\n {{ text }}\n </span>\n </div>\n</template>\n<script lang=\"ts\">\nimport { defineComponent, inject, computed, ref, watch } from 'vue'\nimport { isObject, isArray } from '@vue/shared'\nimport { elFormKey } from '@element-plus/tokens'\nimport { hasClass } from '@element-plus/utils/dom'\nimport { EVENT_CODE } from '@element-plus/utils/aria'\n\nimport { UPDATE_MODEL_EVENT } from '@element-plus/utils/constants'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { StarFilled, Star } from '@element-plus/icons-vue'\nimport { rateProps, rateEmits } from './rate'\nimport type { ElFormContext } from '@element-plus/tokens'\n\nfunction getValueFromMap<T>(\n value: number,\n map: Record<string, T | { excluded?: boolean; value: T }>\n) {\n const isExcludedObject = (\n val: unknown\n ): val is { excluded?: boolean } & Record<any, unknown> => isObject(val)\n\n const matchedKeys = Object.keys(map)\n .map((key) => +key)\n .filter((key) => {\n const val = map[key]\n const excluded = isExcludedObject(val) ? val.excluded : false\n return excluded ? value < key : value <= key\n })\n .sort((a, b) => a - b)\n const matchedValue = map[matchedKeys[0]]\n return (isExcludedObject(matchedValue) && matchedValue.value) || matchedValue\n}\n\nexport default defineComponent({\n name: 'ElRate',\n components: {\n ElIcon,\n StarFilled,\n Star,\n },\n props: rateProps,\n emits: rateEmits,\n\n setup(props, { emit }) {\n const elForm = inject(elFormKey, {} as ElFormContext)\n\n const currentValue = ref(props.modelValue)\n const hoverIndex = ref(-1)\n const pointerAtLeftHalf = ref(true)\n\n const rateDisabled = computed(() => props.disabled || elForm.disabled)\n const text = computed(() => {\n let result = ''\n if (props.showScore) {\n result = props.scoreTemplate.replace(\n /\\{\\s*value\\s*\\}/,\n rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`\n )\n } else if (props.showText) {\n result = props.texts[Math.ceil(currentValue.value) - 1]\n }\n return result\n })\n const valueDecimal = computed(\n () => props.modelValue * 100 - Math.floor(props.modelValue) * 100\n )\n const colorMap = computed(() =>\n isArray(props.colors)\n ? {\n [props.lowThreshold]: props.colors[0],\n [props.highThreshold]: { value: props.colors[1], excluded: true },\n [props.max]: props.colors[2],\n }\n : props.colors\n )\n const activeColor = computed(() =>\n getValueFromMap(currentValue.value, colorMap.value)\n )\n const decimalStyle = computed(() => {\n let width = ''\n if (rateDisabled.value) {\n width = `${valueDecimal.value}%`\n } else if (props.allowHalf) {\n width = '50%'\n }\n return {\n color: activeColor.value,\n width,\n }\n })\n const componentMap = computed(() =>\n isArray(props.icons)\n ? {\n [props.lowThreshold]: props.icons[0],\n [props.highThreshold]: {\n value: props.icons[1],\n excluded: true,\n },\n [props.max]: props.icons[2],\n }\n : props.icons\n )\n const decimalIconComponent = computed(() =>\n getValueFromMap(props.modelValue, componentMap.value)\n )\n const voidComponent = computed(() =>\n rateDisabled.value ? props.disabledvoidIcon : props.voidIcon\n )\n const activeComponent = computed(() =>\n getValueFromMap(currentValue.value, componentMap.value)\n )\n const iconComponents = computed(() => {\n const result = Array(props.max)\n const threshold = currentValue.value\n result.fill(activeComponent.value, 0, threshold)\n result.fill(voidComponent.value, threshold, props.max)\n return result\n })\n\n function showDecimalIcon(item: number) {\n const showWhenDisabled =\n rateDisabled.value &&\n valueDecimal.value > 0 &&\n item - 1 < props.modelValue &&\n item > props.modelValue\n const showWhenAllowHalf =\n props.allowHalf &&\n pointerAtLeftHalf.value &&\n item - 0.5 <= currentValue.value &&\n item > currentValue.value\n return showWhenDisabled || showWhenAllowHalf\n }\n\n function getIconStyle(item: number) {\n const voidColor = rateDisabled.value\n ? props.disabledVoidColor\n : props.voidColor\n return {\n color: item <= currentValue.value ? activeColor.value : voidColor,\n }\n }\n\n function selectValue(value: number) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf && pointerAtLeftHalf.value) {\n emit(UPDATE_MODEL_EVENT, currentValue.value)\n if (props.modelValue !== currentValue.value) {\n emit('change', currentValue.value)\n }\n } else {\n emit(UPDATE_MODEL_EVENT, value)\n if (props.modelValue !== value) {\n emit('change', value)\n }\n }\n }\n\n function handleKey(e: KeyboardEvent) {\n if (rateDisabled.value) {\n return\n }\n let _currentValue = currentValue.value\n const code = e.code\n if (code === EVENT_CODE.up || code === EVENT_CODE.right) {\n if (props.allowHalf) {\n _currentValue += 0.5\n } else {\n _currentValue += 1\n }\n e.stopPropagation()\n e.preventDefault()\n } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {\n if (props.allowHalf) {\n _currentValue -= 0.5\n } else {\n _currentValue -= 1\n }\n e.stopPropagation()\n e.preventDefault()\n }\n _currentValue = _currentValue < 0 ? 0 : _currentValue\n _currentValue = _currentValue > props.max ? props.max : _currentValue\n emit(UPDATE_MODEL_EVENT, _currentValue)\n emit('change', _currentValue)\n return _currentValue\n }\n\n function setCurrentValue(value: number, event: MouseEvent) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf) {\n let target = event.target as HTMLElement\n if (hasClass(target, 'el-rate__item')) {\n target = target.querySelector('.el-rate__icon')!\n }\n if (target.clientWidth === 0 || hasClass(target, 'el-rate__decimal')) {\n target = target.parentNode as HTMLElement\n }\n pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth\n currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value\n } else {\n currentValue.value = value\n }\n hoverIndex.value = value\n }\n\n function resetCurrentValue() {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf) {\n pointerAtLeftHalf.value =\n props.modelValue !== Math.floor(props.modelValue)\n }\n currentValue.value = props.modelValue\n hoverIndex.value = -1\n }\n\n watch(\n () => props.modelValue,\n (val) => {\n currentValue.value = val\n pointerAtLeftHalf.value =\n props.modelValue !== Math.floor(props.modelValue)\n }\n )\n\n if (!props.modelValue) {\n emit(UPDATE_MODEL_EVENT, 0)\n }\n\n return {\n hoverIndex,\n currentValue,\n rateDisabled,\n text,\n decimalStyle,\n decimalIconComponent,\n iconComponents,\n\n showDecimalIcon,\n getIconStyle,\n selectValue,\n handleKey,\n setCurrentValue,\n resetCurrentValue,\n }\n },\n})\n</script>\n"],"names":["_openBlock","_createVNode"],"mappings":";;;;;;;;;;IAEI;IACA;IACC,eAAa,EAAE;IACf;IACD,iBAAc;;;aAGNA,wCAAE;;;;QAIP;QACD;QACC;;QAEAC,WAAU;eACL,4BAAa,KAAK;;;UAGrB;;;;;;;;;;;;;;;;;;;;;;KAeG;;;;;"}
1
+ {"version":3,"file":"rate.vue_vue_type_template_id_38c42df6_lang.mjs","sources":["../../../../../../packages/components/rate/src/rate.vue?vue&type=template&id=38c42df6&lang.js"],"sourcesContent":["<template>\n <div\n :class=\"rateKls\"\n role=\"slider\"\n :aria-valuenow=\"currentValue\"\n :aria-valuetext=\"text\"\n aria-valuemin=\"0\"\n :aria-valuemax=\"max\"\n tabindex=\"0\"\n @keydown=\"handleKey\"\n >\n <span\n v-for=\"(item, key) in max\"\n :key=\"key\"\n class=\"el-rate__item\"\n :style=\"{ cursor: rateDisabled ? 'auto' : 'pointer' }\"\n @mousemove=\"setCurrentValue(item, $event)\"\n @mouseleave=\"resetCurrentValue\"\n @click=\"selectValue(item)\"\n >\n <el-icon\n :class=\"[{ hover: hoverIndex === item }]\"\n class=\"el-rate__icon\"\n :style=\"getIconStyle(item)\"\n >\n <component :is=\"iconComponents[item - 1]\" />\n <el-icon\n v-if=\"showDecimalIcon(item)\"\n :style=\"decimalStyle\"\n class=\"el-rate__icon el-rate__decimal\"\n >\n <component :is=\"decimalIconComponent\" />\n </el-icon>\n </el-icon>\n </span>\n <span\n v-if=\"showText || showScore\"\n class=\"el-rate__text\"\n :style=\"{ color: textColor }\"\n >\n {{ text }}\n </span>\n </div>\n</template>\n<script lang=\"ts\">\nimport { defineComponent, inject, computed, ref, watch } from 'vue'\nimport { isObject, isArray } from '@vue/shared'\nimport { elFormKey } from '@element-plus/tokens'\nimport { hasClass } from '@element-plus/utils/dom'\nimport { EVENT_CODE } from '@element-plus/utils/aria'\n\nimport { UPDATE_MODEL_EVENT } from '@element-plus/utils/constants'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { StarFilled, Star } from '@element-plus/icons-vue'\nimport { useSize } from '@element-plus/hooks'\nimport { rateProps, rateEmits } from './rate'\nimport type { ElFormContext } from '@element-plus/tokens'\n\nfunction getValueFromMap<T>(\n value: number,\n map: Record<string, T | { excluded?: boolean; value: T }>\n) {\n const isExcludedObject = (\n val: unknown\n ): val is { excluded?: boolean } & Record<any, unknown> => isObject(val)\n\n const matchedKeys = Object.keys(map)\n .map((key) => +key)\n .filter((key) => {\n const val = map[key]\n const excluded = isExcludedObject(val) ? val.excluded : false\n return excluded ? value < key : value <= key\n })\n .sort((a, b) => a - b)\n const matchedValue = map[matchedKeys[0]]\n return (isExcludedObject(matchedValue) && matchedValue.value) || matchedValue\n}\n\nexport default defineComponent({\n name: 'ElRate',\n components: {\n ElIcon,\n StarFilled,\n Star,\n },\n props: rateProps,\n emits: rateEmits,\n\n setup(props, { emit }) {\n const elForm = inject(elFormKey, {} as ElFormContext)\n\n const rateSize = useSize()\n const currentValue = ref(props.modelValue)\n const hoverIndex = ref(-1)\n const pointerAtLeftHalf = ref(true)\n\n const prefix = 'el-rate'\n const rateKls = computed(() => [prefix, `${prefix}--${rateSize.value}`])\n\n const rateDisabled = computed(() => props.disabled || elForm.disabled)\n const text = computed(() => {\n let result = ''\n if (props.showScore) {\n result = props.scoreTemplate.replace(\n /\\{\\s*value\\s*\\}/,\n rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`\n )\n } else if (props.showText) {\n result = props.texts[Math.ceil(currentValue.value) - 1]\n }\n return result\n })\n const valueDecimal = computed(\n () => props.modelValue * 100 - Math.floor(props.modelValue) * 100\n )\n const colorMap = computed(() =>\n isArray(props.colors)\n ? {\n [props.lowThreshold]: props.colors[0],\n [props.highThreshold]: { value: props.colors[1], excluded: true },\n [props.max]: props.colors[2],\n }\n : props.colors\n )\n const activeColor = computed(() =>\n getValueFromMap(currentValue.value, colorMap.value)\n )\n const decimalStyle = computed(() => {\n let width = ''\n if (rateDisabled.value) {\n width = `${valueDecimal.value}%`\n } else if (props.allowHalf) {\n width = '50%'\n }\n return {\n color: activeColor.value,\n width,\n }\n })\n const componentMap = computed(() =>\n isArray(props.icons)\n ? {\n [props.lowThreshold]: props.icons[0],\n [props.highThreshold]: {\n value: props.icons[1],\n excluded: true,\n },\n [props.max]: props.icons[2],\n }\n : props.icons\n )\n const decimalIconComponent = computed(() =>\n getValueFromMap(props.modelValue, componentMap.value)\n )\n const voidComponent = computed(() =>\n rateDisabled.value ? props.disabledvoidIcon : props.voidIcon\n )\n const activeComponent = computed(() =>\n getValueFromMap(currentValue.value, componentMap.value)\n )\n const iconComponents = computed(() => {\n const result = Array(props.max)\n const threshold = currentValue.value\n result.fill(activeComponent.value, 0, threshold)\n result.fill(voidComponent.value, threshold, props.max)\n return result\n })\n\n function showDecimalIcon(item: number) {\n const showWhenDisabled =\n rateDisabled.value &&\n valueDecimal.value > 0 &&\n item - 1 < props.modelValue &&\n item > props.modelValue\n const showWhenAllowHalf =\n props.allowHalf &&\n pointerAtLeftHalf.value &&\n item - 0.5 <= currentValue.value &&\n item > currentValue.value\n return showWhenDisabled || showWhenAllowHalf\n }\n\n function getIconStyle(item: number) {\n const voidColor = rateDisabled.value\n ? props.disabledVoidColor\n : props.voidColor\n return {\n color: item <= currentValue.value ? activeColor.value : voidColor,\n }\n }\n\n function selectValue(value: number) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf && pointerAtLeftHalf.value) {\n emit(UPDATE_MODEL_EVENT, currentValue.value)\n if (props.modelValue !== currentValue.value) {\n emit('change', currentValue.value)\n }\n } else {\n emit(UPDATE_MODEL_EVENT, value)\n if (props.modelValue !== value) {\n emit('change', value)\n }\n }\n }\n\n function handleKey(e: KeyboardEvent) {\n if (rateDisabled.value) {\n return\n }\n let _currentValue = currentValue.value\n const code = e.code\n if (code === EVENT_CODE.up || code === EVENT_CODE.right) {\n if (props.allowHalf) {\n _currentValue += 0.5\n } else {\n _currentValue += 1\n }\n e.stopPropagation()\n e.preventDefault()\n } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {\n if (props.allowHalf) {\n _currentValue -= 0.5\n } else {\n _currentValue -= 1\n }\n e.stopPropagation()\n e.preventDefault()\n }\n _currentValue = _currentValue < 0 ? 0 : _currentValue\n _currentValue = _currentValue > props.max ? props.max : _currentValue\n emit(UPDATE_MODEL_EVENT, _currentValue)\n emit('change', _currentValue)\n return _currentValue\n }\n\n function setCurrentValue(value: number, event: MouseEvent) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf) {\n let target = event.target as HTMLElement\n if (hasClass(target, 'el-rate__item')) {\n target = target.querySelector('.el-rate__icon')!\n }\n if (target.clientWidth === 0 || hasClass(target, 'el-rate__decimal')) {\n target = target.parentNode as HTMLElement\n }\n pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth\n currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value\n } else {\n currentValue.value = value\n }\n hoverIndex.value = value\n }\n\n function resetCurrentValue() {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf) {\n pointerAtLeftHalf.value =\n props.modelValue !== Math.floor(props.modelValue)\n }\n currentValue.value = props.modelValue\n hoverIndex.value = -1\n }\n\n watch(\n () => props.modelValue,\n (val) => {\n currentValue.value = val\n pointerAtLeftHalf.value =\n props.modelValue !== Math.floor(props.modelValue)\n }\n )\n\n if (!props.modelValue) {\n emit(UPDATE_MODEL_EVENT, 0)\n }\n\n return {\n hoverIndex,\n currentValue,\n rateDisabled,\n text,\n decimalStyle,\n decimalIconComponent,\n iconComponents,\n rateKls,\n\n showDecimalIcon,\n getIconStyle,\n selectValue,\n handleKey,\n setCurrentValue,\n resetCurrentValue,\n }\n },\n})\n</script>\n"],"names":["_openBlock","_createVNode"],"mappings":";;;;;;;;;;IAEK,uBAAO;IACR;IACC,eAAa,EAAE;IACf;IACD,iBAAc;;;aAGNA,wCAAE;;;;QAIP;QACD;QACC;;QAEAC,WAAU;eACL,4BAAa,KAAK;;;UAGrB;;;;;;;;;;;;;;;;;;;;;;KAeG;;;;;"}
@@ -844,8 +844,8 @@ export declare const ElSelect: import("../../utils/types").SFCWithInstall<import
844
844
  tagType: string;
845
845
  } & {
846
846
  size?: import("../../utils/types").ComponentSize | undefined;
847
- name?: string | undefined;
848
847
  modelValue?: string | number | boolean | unknown[] | Record<string, any> | undefined;
848
+ name?: string | undefined;
849
849
  id?: string | undefined;
850
850
  placeholder?: string | undefined;
851
851
  filterMethod?: Function | undefined;
@@ -847,8 +847,8 @@ declare const _default: import("vue").DefineComponent<{
847
847
  tagType: string;
848
848
  } & {
849
849
  size?: ComponentSize | undefined;
850
- name?: string | undefined;
851
850
  modelValue?: string | number | boolean | unknown[] | Record<string, any> | undefined;
851
+ name?: string | undefined;
852
852
  id?: string | undefined;
853
853
  placeholder?: string | undefined;
854
854
  filterMethod?: Function | undefined;
@@ -877,9 +877,9 @@ declare const _Select: SFCWithInstall<import("vue").DefineComponent<{
877
877
  scrollbarAlwaysOn: boolean;
878
878
  } & {
879
879
  size?: import("element-plus/es/utils/types").ComponentSize | undefined;
880
- name?: string | undefined;
881
880
  modelValue?: any;
882
881
  label?: string | undefined;
882
+ name?: string | undefined;
883
883
  id?: string | undefined;
884
884
  placeholder?: string | undefined;
885
885
  options?: import("./src/select.types").OptionType<any>[] | undefined;
@@ -1800,9 +1800,9 @@ export declare const ElSelectV2: SFCWithInstall<import("vue").DefineComponent<{
1800
1800
  scrollbarAlwaysOn: boolean;
1801
1801
  } & {
1802
1802
  size?: import("element-plus/es/utils/types").ComponentSize | undefined;
1803
- name?: string | undefined;
1804
1803
  modelValue?: any;
1805
1804
  label?: string | undefined;
1805
+ name?: string | undefined;
1806
1806
  id?: string | undefined;
1807
1807
  placeholder?: string | undefined;
1808
1808
  options?: import("./src/select.types").OptionType<any>[] | undefined;
@@ -876,9 +876,9 @@ declare const _default: import("vue").DefineComponent<{
876
876
  scrollbarAlwaysOn: boolean;
877
877
  } & {
878
878
  size?: import("../../../utils/types").ComponentSize | undefined;
879
- name?: string | undefined;
880
879
  modelValue?: any;
881
880
  label?: string | undefined;
881
+ name?: string | undefined;
882
882
  id?: string | undefined;
883
883
  placeholder?: string | undefined;
884
884
  options?: import("./select.types").OptionType<any>[] | undefined;