@element-plus/nightly 0.0.20260720 → 0.0.20260722

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 (568) hide show
  1. package/es/components/affix/src/affix.vue.d.ts +4 -4
  2. package/es/components/alert/src/alert.d.ts +1 -1
  3. package/es/components/alert/src/alert.vue.d.ts +1 -1
  4. package/es/components/anchor/src/anchor.vue.d.ts +2 -2
  5. package/es/components/autocomplete/src/autocomplete.d.ts +6 -107
  6. package/es/components/autocomplete/src/autocomplete.mjs.map +1 -1
  7. package/es/components/autocomplete/src/autocomplete.vue.d.ts +5 -5
  8. package/es/components/autocomplete/src/autocomplete.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  9. package/es/components/autocomplete/src/autocomplete2.mjs.map +1 -1
  10. package/es/components/avatar/src/avatar-group-props.d.ts +8 -105
  11. package/es/components/avatar/src/avatar-group-props.mjs +9 -1
  12. package/es/components/avatar/src/avatar-group-props.mjs.map +1 -1
  13. package/es/components/avatar/src/avatar-group.d.ts +17 -210
  14. package/es/components/avatar/src/avatar.d.ts +2 -2
  15. package/es/components/backtop/src/backtop.vue.d.ts +1 -1
  16. package/es/components/badge/src/badge.d.ts +3 -7
  17. package/es/components/badge/src/badge.mjs +9 -1
  18. package/es/components/badge/src/badge.mjs.map +1 -1
  19. package/es/components/badge/src/badge.vue.d.ts +2 -0
  20. package/es/components/badge/src/badge.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  21. package/es/components/badge/src/badge2.mjs.map +1 -1
  22. package/es/components/button/src/button-group.d.ts +1 -1
  23. package/es/components/button/src/button-group.vue.d.ts +1 -1
  24. package/es/components/button/src/button.d.ts +1 -1
  25. package/es/components/button/src/button.vue.d.ts +3 -3
  26. package/es/components/button/src/use-button.d.ts +1 -1
  27. package/es/components/calendar/src/calendar.mjs.map +1 -1
  28. package/es/components/calendar/src/calendar.vue.d.ts +1 -1
  29. package/es/components/calendar/style/css.mjs +1 -1
  30. package/es/components/calendar/style/index.mjs +1 -1
  31. package/es/components/card/src/card.d.ts +8 -7
  32. package/es/components/card/src/card.mjs +27 -3
  33. package/es/components/card/src/card.mjs.map +1 -1
  34. package/es/components/card/src/card.vue.d.ts +5 -1
  35. package/es/components/card/src/card.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  36. package/es/components/card/src/card2.mjs.map +1 -1
  37. package/es/components/carousel/src/carousel.d.ts +2 -2
  38. package/es/components/carousel/src/carousel.vue.d.ts +4 -4
  39. package/es/components/cascader/src/cascader.d.ts +6 -107
  40. package/es/components/cascader/src/cascader.mjs.map +1 -1
  41. package/es/components/cascader/src/cascader.vue.d.ts +20 -18
  42. package/es/components/cascader/src/cascader.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  43. package/es/components/cascader/src/cascader2.mjs.map +1 -1
  44. package/es/components/cascader-panel/src/index.vue.d.ts +3 -3
  45. package/es/components/checkbox/src/checkbox-button.vue.d.ts +5 -5
  46. package/es/components/checkbox/src/checkbox-group.vue.d.ts +4 -4
  47. package/es/components/checkbox/src/checkbox.d.ts +8 -8
  48. package/es/components/checkbox/src/checkbox.vue.d.ts +5 -5
  49. package/es/components/col/src/col.vue.d.ts +1 -1
  50. package/es/components/collapse/src/collapse.d.ts +1 -1
  51. package/es/components/collapse/src/collapse.vue.d.ts +1 -1
  52. package/es/components/color-picker/src/color-picker.d.ts +3 -102
  53. package/es/components/color-picker/src/color-picker.mjs +1 -0
  54. package/es/components/color-picker/src/color-picker.mjs.map +1 -1
  55. package/es/components/color-picker/src/color-picker.vue.d.ts +13 -11
  56. package/es/components/color-picker-panel/src/color-picker-panel.d.ts +3 -9
  57. package/es/components/color-picker-panel/src/color-picker-panel.mjs +9 -5
  58. package/es/components/color-picker-panel/src/color-picker-panel.mjs.map +1 -1
  59. package/es/components/color-picker-panel/src/color-picker-panel.vue.d.ts +4 -1
  60. package/es/components/color-picker-panel/src/color-picker-panel.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  61. package/es/components/color-picker-panel/src/color-picker-panel2.mjs.map +1 -1
  62. package/es/components/config-provider/src/config-provider.d.ts +1 -1
  63. package/es/components/date-picker/src/date-picker.d.ts +16 -216
  64. package/es/components/date-picker/src/props.d.ts +4 -104
  65. package/es/components/date-picker-panel/src/composables/use-basic-date-table.d.ts +1 -1
  66. package/es/components/date-picker-panel/src/date-picker-com/panel-date-pick.vue.d.ts +1 -1
  67. package/es/components/date-picker-panel/src/date-picker-com/panel-date-range.vue.d.ts +1 -1
  68. package/es/components/date-picker-panel/src/date-picker-com/panel-month-range.vue.d.ts +1 -1
  69. package/es/components/date-picker-panel/src/date-picker-com/panel-year-range.vue.d.ts +1 -1
  70. package/es/components/date-picker-panel/src/date-picker-panel.d.ts +4 -4
  71. package/es/components/date-picker-panel/src/panel-utils.d.ts +9 -9
  72. package/es/components/date-picker-panel/src/props/basic-date-table.mjs.map +1 -1
  73. package/es/components/date-picker-panel/src/props/date-picker-panel.d.ts +1 -1
  74. package/es/components/descriptions/src/description-item.d.ts +18 -18
  75. package/es/components/descriptions/src/description.vue.d.ts +1 -1
  76. package/es/components/dialog/src/dialog-content.d.ts +10 -6
  77. package/es/components/dialog/src/dialog-content.mjs +32 -5
  78. package/es/components/dialog/src/dialog-content.mjs.map +1 -1
  79. package/es/components/dialog/src/dialog-content.vue.d.ts +4 -0
  80. package/es/components/dialog/src/dialog.d.ts +10 -5
  81. package/es/components/dialog/src/dialog.mjs +11 -14
  82. package/es/components/dialog/src/dialog.mjs.map +1 -1
  83. package/es/components/dialog/src/dialog.vue.d.ts +8 -3
  84. package/es/components/divider/src/divider.d.ts +1 -1
  85. package/es/components/divider/src/divider.vue.d.ts +1 -1
  86. package/es/components/drawer/src/drawer.d.ts +5 -4
  87. package/es/components/drawer/src/drawer.vue.d.ts +8 -3
  88. package/es/components/dropdown/src/dropdown-item-impl.vue.d.ts +1 -1
  89. package/es/components/dropdown/src/dropdown-item.vue.d.ts +3 -3
  90. package/es/components/dropdown/src/dropdown-menu.vue.d.ts +1 -1
  91. package/es/components/dropdown/src/dropdown.d.ts +6 -107
  92. package/es/components/dropdown/src/dropdown.vue.d.ts +97 -295
  93. package/es/components/dropdown/style/css.mjs +1 -1
  94. package/es/components/dropdown/style/index.mjs +1 -1
  95. package/es/components/form/src/form-item.d.ts +2 -2
  96. package/es/components/form/src/form-item.vue.d.ts +1 -1
  97. package/es/components/form/src/form.d.ts +2 -2
  98. package/es/components/image/src/image.mjs.map +1 -1
  99. package/es/components/image/src/image.vue.d.ts +3 -3
  100. package/es/components/image-viewer/src/image-viewer.mjs.map +1 -1
  101. package/es/components/image-viewer/src/image-viewer.vue.d.ts +1 -1
  102. package/es/components/input/src/input.d.ts +3 -3
  103. package/es/components/input/src/input.vue.d.ts +16 -16
  104. package/es/components/input-number/src/input-number.d.ts +2 -2
  105. package/es/components/input-number/src/input-number.vue.d.ts +7 -7
  106. package/es/components/input-otp/src/input-otp.vue.d.ts +4 -4
  107. package/es/components/input-tag/src/input-tag.d.ts +1 -1
  108. package/es/components/input-tag/src/input-tag.vue.d.ts +10 -10
  109. package/es/components/link/src/link.d.ts +1 -1
  110. package/es/components/link/src/link.mjs.map +1 -1
  111. package/es/components/link/src/link.vue.d.ts +1 -1
  112. package/es/components/mention/src/mention.d.ts +5 -106
  113. package/es/components/mention/src/mention.vue.d.ts +5 -5
  114. package/es/components/mention/src/mention.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  115. package/es/components/mention/src/mention2.mjs.map +1 -1
  116. package/es/components/menu/src/menu.d.ts +17 -29
  117. package/es/components/menu/src/menu.mjs +18 -2
  118. package/es/components/menu/src/menu.mjs.map +1 -1
  119. package/es/components/menu/src/sub-menu.d.ts +10 -22
  120. package/es/components/menu/src/sub-menu.mjs +18 -2
  121. package/es/components/menu/src/sub-menu.mjs.map +1 -1
  122. package/es/components/message/src/message.d.ts +4 -4
  123. package/es/components/message/src/message.mjs +6 -1
  124. package/es/components/message/src/message.mjs.map +1 -1
  125. package/es/components/message/src/message.vue.d.ts +6 -5
  126. package/es/components/message/src/method.mjs.map +1 -1
  127. package/es/components/message-box/src/index.vue.d.ts +59 -67
  128. package/es/components/notification/src/notification.d.ts +4 -3
  129. package/es/components/notification/src/notification.mjs +6 -1
  130. package/es/components/notification/src/notification.mjs.map +1 -1
  131. package/es/components/notification/src/notification.vue.d.ts +5 -4
  132. package/es/components/overlay/index.d.ts +4 -12
  133. package/es/components/overlay/src/overlay.d.ts +5 -18
  134. package/es/components/overlay/src/overlay.mjs +9 -5
  135. package/es/components/overlay/src/overlay.mjs.map +1 -1
  136. package/es/components/pagination/src/components/sizes.d.ts +4 -13
  137. package/es/components/pagination/src/components/sizes.mjs +18 -2
  138. package/es/components/pagination/src/components/sizes.mjs.map +1 -1
  139. package/es/components/pagination/src/components/sizes.vue.d.ts +7 -24
  140. package/es/components/pagination/src/pagination.d.ts +12 -25
  141. package/es/components/pagination/src/pagination.mjs +15 -2
  142. package/es/components/pagination/src/pagination.mjs.map +1 -1
  143. package/es/components/popconfirm/src/popconfirm.d.ts +2 -2
  144. package/es/components/popconfirm/src/popconfirm.vue.d.ts +5 -5
  145. package/es/components/popover/src/popover.d.ts +5 -105
  146. package/es/components/popover/src/popover.mjs +1 -0
  147. package/es/components/popover/src/popover.mjs.map +1 -1
  148. package/es/components/popover/src/popover.vue.d.ts +13 -12
  149. package/es/components/popper/src/composables/use-content-dom.d.ts +2 -25
  150. package/es/components/popper/src/composables/use-content.d.ts +4 -4
  151. package/es/components/popper/src/content.d.ts +8 -18
  152. package/es/components/popper/src/content.mjs +13 -7
  153. package/es/components/popper/src/content.mjs.map +1 -1
  154. package/es/components/popper/src/content.vue.d.ts +17 -15
  155. package/es/components/popper/src/popper.d.ts +2 -2
  156. package/es/components/popper/src/popper.mjs.map +1 -1
  157. package/es/components/progress/src/progress.d.ts +1 -1
  158. package/es/components/progress/src/progress.vue.d.ts +1 -1
  159. package/es/components/radio/src/radio-button.d.ts +3 -3
  160. package/es/components/radio/src/radio-button.vue.d.ts +2 -2
  161. package/es/components/radio/src/radio-group.vue.d.ts +5 -5
  162. package/es/components/radio/src/radio.d.ts +6 -6
  163. package/es/components/radio/src/radio.vue.d.ts +3 -3
  164. package/es/components/rate/src/rate.vue.d.ts +1 -1
  165. package/es/components/rate/src/rate.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  166. package/es/components/rate/src/rate2.mjs.map +1 -1
  167. package/es/components/result/src/result.d.ts +1 -1
  168. package/es/components/row/src/row.d.ts +1 -1
  169. package/es/components/scrollbar/src/scrollbar.d.ts +5 -4
  170. package/es/components/scrollbar/src/scrollbar.mjs +12 -2
  171. package/es/components/scrollbar/src/scrollbar.mjs.map +1 -1
  172. package/es/components/scrollbar/src/scrollbar.vue.d.ts +4 -3
  173. package/es/components/scrollbar/src/thumb.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  174. package/es/components/scrollbar/src/thumb2.mjs.map +1 -1
  175. package/es/components/segmented/index.d.ts +3 -3
  176. package/es/components/segmented/src/segmented.d.ts +1 -1
  177. package/es/components/segmented/src/segmented.vue.d.ts +1 -1
  178. package/es/components/select/src/option.d.ts +2 -2
  179. package/es/components/select/src/option.vue.d.ts +5 -5
  180. package/es/components/select/src/select-dropdown.vue.d.ts +2 -1
  181. package/es/components/select/src/select.d.ts +9 -13
  182. package/es/components/select/src/select.mjs +15 -2
  183. package/es/components/select/src/select.mjs.map +1 -1
  184. package/es/components/select/src/select.vue.d.ts +113 -119
  185. package/es/components/select/src/select.vue_vue_type_script_lang.mjs.map +1 -1
  186. package/es/components/select/src/select2.mjs.map +1 -1
  187. package/es/components/select/src/useOption.d.ts +2 -2
  188. package/es/components/select/src/useSelect.d.ts +5 -5
  189. package/es/components/select/src/useSelect.mjs.map +1 -1
  190. package/es/components/select-v2/src/defaults.d.ts +3 -103
  191. package/es/components/select-v2/src/option-item.vue.d.ts +1 -1
  192. package/es/components/select-v2/src/select.vue.d.ts +89 -287
  193. package/es/components/select-v2/src/useSelect.d.ts +1 -1
  194. package/es/components/skeleton/src/skeleton-item.d.ts +1 -1
  195. package/es/components/skeleton/src/skeleton.vue.d.ts +1 -1
  196. package/es/components/slider/src/button.d.ts +2 -1
  197. package/es/components/slider/src/button.mjs +10 -2
  198. package/es/components/slider/src/button.mjs.map +1 -1
  199. package/es/components/slider/src/button.vue.d.ts +5 -3
  200. package/es/components/slider/src/composables/use-marks.mjs.map +1 -1
  201. package/es/components/slider/src/slider.d.ts +2 -2
  202. package/es/components/slider/src/slider.mjs +6 -1
  203. package/es/components/slider/src/slider.mjs.map +1 -1
  204. package/es/components/slider/src/slider.vue.d.ts +8 -8
  205. package/es/components/space/src/space.d.ts +7 -7
  206. package/es/components/space/src/space.mjs +2 -1
  207. package/es/components/space/src/space.mjs.map +1 -1
  208. package/es/components/space/src/use-space.d.ts +2 -3
  209. package/es/components/splitter/src/split-bar.vue.d.ts +1 -1
  210. package/es/components/steps/src/item.d.ts +1 -1
  211. package/es/components/steps/src/item.vue.d.ts +1 -1
  212. package/es/components/steps/src/steps.d.ts +2 -2
  213. package/es/components/steps/src/steps.vue.d.ts +1 -1
  214. package/es/components/switch/src/switch.vue.d.ts +3 -3
  215. package/es/components/table/src/filter-panel.vue.d.ts +89 -86
  216. package/es/components/table/src/table/defaults.d.ts +5 -5
  217. package/es/components/table/src/table/defaults.mjs.map +1 -1
  218. package/es/components/table/src/table/style-helper.d.ts +1 -1
  219. package/es/components/table/src/table-body/events-helper.mjs.map +1 -1
  220. package/es/components/table/src/table-column/defaults.d.ts +4 -4
  221. package/es/components/table/src/table-header/index.d.ts +14 -14
  222. package/es/components/table/src/table.vue.d.ts +4 -4
  223. package/es/components/tabs/src/tab-nav.d.ts +1 -1
  224. package/es/components/tabs/src/tab-pane.vue.d.ts +1 -1
  225. package/es/components/tabs/src/tabs.d.ts +5 -5
  226. package/es/components/tag/src/tag.vue.d.ts +2 -2
  227. package/es/components/text/src/text.vue.d.ts +1 -1
  228. package/es/components/time-picker/src/common/picker-range-trigger.vue.d.ts +6 -6
  229. package/es/components/time-picker/src/common/picker.vue.d.ts +22 -222
  230. package/es/components/time-picker/src/common/props.d.ts +4 -104
  231. package/es/components/time-picker/src/time-picker-com/panel-time-pick.vue.d.ts +2 -2
  232. package/es/components/time-picker/src/time-picker-com/panel-time-range.vue.d.ts +2 -2
  233. package/es/components/time-picker/src/time-picker.d.ts +16 -216
  234. package/es/components/time-select/src/time-select.d.ts +6 -10
  235. package/es/components/time-select/src/time-select.mjs +15 -2
  236. package/es/components/time-select/src/time-select.mjs.map +1 -1
  237. package/es/components/time-select/src/time-select.vue.d.ts +11 -10
  238. package/es/components/timeline/src/timeline-item.vue.d.ts +2 -2
  239. package/es/components/tooltip/src/content.d.ts +4 -199
  240. package/es/components/tooltip/src/content.vue.d.ts +18 -16
  241. package/es/components/tooltip/src/tooltip.d.ts +5 -202
  242. package/es/components/tooltip/src/tooltip.vue.d.ts +19 -18
  243. package/es/components/tooltip/src/trigger.d.ts +1 -1
  244. package/es/components/tour/src/content.d.ts +1 -1
  245. package/es/components/tour/src/content.vue.d.ts +1 -1
  246. package/es/components/tour/src/step.d.ts +1 -1
  247. package/es/components/tour/src/tour.d.ts +1 -1
  248. package/es/components/tour/src/tour.vue.d.ts +3 -3
  249. package/es/components/transfer/src/transfer.vue.d.ts +1 -1
  250. package/es/components/tree/src/tree-node.vue.d.ts +14 -14
  251. package/es/components/tree/src/tree.vue.d.ts +16 -16
  252. package/es/components/tree-select/src/select.mjs +1 -5
  253. package/es/components/tree-select/src/select.mjs.map +1 -1
  254. package/es/components/tree-select/src/tree-select-option.d.ts +5 -5
  255. package/es/components/tree-select/src/tree-select.vue.d.ts +33 -41
  256. package/es/components/tree-v2/src/composables/useTree.d.ts +9 -8
  257. package/es/components/tree-v2/src/tree.vue.d.ts +2 -2
  258. package/es/components/upload/src/upload-content.d.ts +1 -1
  259. package/es/components/upload/src/upload-content.vue.d.ts +2 -2
  260. package/es/components/upload/src/upload-list.d.ts +1 -1
  261. package/es/components/upload/src/upload.d.ts +2 -2
  262. package/es/components/upload/src/upload.mjs.map +1 -1
  263. package/es/components/upload/src/upload.vue.d.ts +3 -3
  264. package/es/components/virtual-list/src/builders/build-grid.d.ts +4 -3
  265. package/es/components/virtual-list/src/builders/build-list.d.ts +5 -4
  266. package/es/components/virtual-list/src/components/dynamic-size-grid.d.ts +4 -3
  267. package/es/components/virtual-list/src/components/dynamic-size-list.d.ts +5 -4
  268. package/es/components/virtual-list/src/components/fixed-size-grid.d.ts +4 -3
  269. package/es/components/virtual-list/src/components/fixed-size-list.d.ts +5 -4
  270. package/es/components/virtual-list/src/components/scrollbar.d.ts +5 -3
  271. package/es/components/virtual-list/src/props.d.ts +5 -4
  272. package/es/components/virtual-list/src/props.mjs +15 -2
  273. package/es/components/virtual-list/src/props.mjs.map +1 -1
  274. package/es/components/watermark/src/watermark.mjs.map +1 -1
  275. package/es/hooks/use-floating/index.d.ts +8 -8
  276. package/es/hooks/use-popper/index.d.ts +4 -4
  277. package/es/hooks/use-throttle-render/index.mjs.map +1 -1
  278. package/es/utils/index.d.ts +2 -2
  279. package/es/utils/typescript.d.ts +2 -1
  280. package/es/utils/typescript.mjs.map +1 -1
  281. package/es/version.d.ts +1 -1
  282. package/es/version.mjs +1 -1
  283. package/es/version.mjs.map +1 -1
  284. package/lib/components/affix/src/affix.vue.d.ts +4 -4
  285. package/lib/components/alert/src/alert.d.ts +1 -1
  286. package/lib/components/alert/src/alert.vue.d.ts +1 -1
  287. package/lib/components/anchor/src/anchor.vue.d.ts +2 -2
  288. package/lib/components/autocomplete/src/autocomplete.d.ts +6 -107
  289. package/lib/components/autocomplete/src/autocomplete.js.map +1 -1
  290. package/lib/components/autocomplete/src/autocomplete.vue.d.ts +5 -5
  291. package/lib/components/autocomplete/src/autocomplete.vue_vue_type_script_setup_true_lang.js.map +1 -1
  292. package/lib/components/autocomplete/src/autocomplete2.js.map +1 -1
  293. package/lib/components/avatar/src/avatar-group-props.d.ts +8 -105
  294. package/lib/components/avatar/src/avatar-group-props.js +9 -1
  295. package/lib/components/avatar/src/avatar-group-props.js.map +1 -1
  296. package/lib/components/avatar/src/avatar-group.d.ts +17 -210
  297. package/lib/components/avatar/src/avatar.d.ts +2 -2
  298. package/lib/components/backtop/src/backtop.vue.d.ts +1 -1
  299. package/lib/components/badge/src/badge.d.ts +3 -7
  300. package/lib/components/badge/src/badge.js +9 -1
  301. package/lib/components/badge/src/badge.js.map +1 -1
  302. package/lib/components/badge/src/badge.vue.d.ts +2 -0
  303. package/lib/components/badge/src/badge.vue_vue_type_script_setup_true_lang.js.map +1 -1
  304. package/lib/components/badge/src/badge2.js.map +1 -1
  305. package/lib/components/button/src/button-group.d.ts +1 -1
  306. package/lib/components/button/src/button-group.vue.d.ts +1 -1
  307. package/lib/components/button/src/button.d.ts +1 -1
  308. package/lib/components/button/src/button.vue.d.ts +3 -3
  309. package/lib/components/button/src/use-button.d.ts +1 -1
  310. package/lib/components/calendar/src/calendar.js.map +1 -1
  311. package/lib/components/calendar/src/calendar.vue.d.ts +1 -1
  312. package/lib/components/calendar/style/css.js +1 -1
  313. package/lib/components/calendar/style/index.js +1 -1
  314. package/lib/components/card/src/card.d.ts +8 -7
  315. package/lib/components/card/src/card.js +27 -3
  316. package/lib/components/card/src/card.js.map +1 -1
  317. package/lib/components/card/src/card.vue.d.ts +5 -1
  318. package/lib/components/card/src/card.vue_vue_type_script_setup_true_lang.js.map +1 -1
  319. package/lib/components/card/src/card2.js.map +1 -1
  320. package/lib/components/carousel/src/carousel.d.ts +2 -2
  321. package/lib/components/carousel/src/carousel.vue.d.ts +4 -4
  322. package/lib/components/cascader/src/cascader.d.ts +6 -107
  323. package/lib/components/cascader/src/cascader.js.map +1 -1
  324. package/lib/components/cascader/src/cascader.vue.d.ts +20 -18
  325. package/lib/components/cascader/src/cascader.vue_vue_type_script_setup_true_lang.js.map +1 -1
  326. package/lib/components/cascader/src/cascader2.js.map +1 -1
  327. package/lib/components/cascader-panel/src/index.vue.d.ts +3 -3
  328. package/lib/components/checkbox/src/checkbox-button.vue.d.ts +5 -5
  329. package/lib/components/checkbox/src/checkbox-group.vue.d.ts +4 -4
  330. package/lib/components/checkbox/src/checkbox.d.ts +8 -8
  331. package/lib/components/checkbox/src/checkbox.vue.d.ts +5 -5
  332. package/lib/components/col/src/col.vue.d.ts +1 -1
  333. package/lib/components/collapse/src/collapse.d.ts +1 -1
  334. package/lib/components/collapse/src/collapse.vue.d.ts +1 -1
  335. package/lib/components/color-picker/src/color-picker.d.ts +3 -102
  336. package/lib/components/color-picker/src/color-picker.js +1 -0
  337. package/lib/components/color-picker/src/color-picker.js.map +1 -1
  338. package/lib/components/color-picker/src/color-picker.vue.d.ts +13 -11
  339. package/lib/components/color-picker-panel/src/color-picker-panel.d.ts +3 -9
  340. package/lib/components/color-picker-panel/src/color-picker-panel.js +9 -5
  341. package/lib/components/color-picker-panel/src/color-picker-panel.js.map +1 -1
  342. package/lib/components/color-picker-panel/src/color-picker-panel.vue.d.ts +4 -1
  343. package/lib/components/color-picker-panel/src/color-picker-panel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  344. package/lib/components/color-picker-panel/src/color-picker-panel2.js.map +1 -1
  345. package/lib/components/config-provider/src/config-provider.d.ts +1 -1
  346. package/lib/components/date-picker/src/date-picker.d.ts +16 -216
  347. package/lib/components/date-picker/src/props.d.ts +4 -104
  348. package/lib/components/date-picker-panel/src/composables/use-basic-date-table.d.ts +1 -1
  349. package/lib/components/date-picker-panel/src/date-picker-com/panel-date-pick.vue.d.ts +1 -1
  350. package/lib/components/date-picker-panel/src/date-picker-com/panel-date-range.vue.d.ts +1 -1
  351. package/lib/components/date-picker-panel/src/date-picker-com/panel-month-range.vue.d.ts +1 -1
  352. package/lib/components/date-picker-panel/src/date-picker-com/panel-year-range.vue.d.ts +1 -1
  353. package/lib/components/date-picker-panel/src/date-picker-panel.d.ts +4 -4
  354. package/lib/components/date-picker-panel/src/panel-utils.d.ts +9 -9
  355. package/lib/components/date-picker-panel/src/props/basic-date-table.js.map +1 -1
  356. package/lib/components/date-picker-panel/src/props/date-picker-panel.d.ts +1 -1
  357. package/lib/components/descriptions/src/description-item.d.ts +18 -18
  358. package/lib/components/descriptions/src/description.vue.d.ts +1 -1
  359. package/lib/components/dialog/src/dialog-content.d.ts +10 -6
  360. package/lib/components/dialog/src/dialog-content.js +31 -4
  361. package/lib/components/dialog/src/dialog-content.js.map +1 -1
  362. package/lib/components/dialog/src/dialog-content.vue.d.ts +4 -0
  363. package/lib/components/dialog/src/dialog.d.ts +10 -5
  364. package/lib/components/dialog/src/dialog.js +11 -14
  365. package/lib/components/dialog/src/dialog.js.map +1 -1
  366. package/lib/components/dialog/src/dialog.vue.d.ts +8 -3
  367. package/lib/components/divider/src/divider.d.ts +1 -1
  368. package/lib/components/divider/src/divider.vue.d.ts +1 -1
  369. package/lib/components/drawer/src/drawer.d.ts +5 -4
  370. package/lib/components/drawer/src/drawer.vue.d.ts +8 -3
  371. package/lib/components/dropdown/src/dropdown-item-impl.vue.d.ts +1 -1
  372. package/lib/components/dropdown/src/dropdown-item.vue.d.ts +3 -3
  373. package/lib/components/dropdown/src/dropdown-menu.vue.d.ts +1 -1
  374. package/lib/components/dropdown/src/dropdown.d.ts +6 -107
  375. package/lib/components/dropdown/src/dropdown.vue.d.ts +97 -295
  376. package/lib/components/dropdown/style/css.js +1 -1
  377. package/lib/components/dropdown/style/index.js +1 -1
  378. package/lib/components/form/src/form-item.d.ts +2 -2
  379. package/lib/components/form/src/form-item.vue.d.ts +1 -1
  380. package/lib/components/form/src/form.d.ts +2 -2
  381. package/lib/components/image/src/image.js.map +1 -1
  382. package/lib/components/image/src/image.vue.d.ts +3 -3
  383. package/lib/components/image-viewer/src/image-viewer.js.map +1 -1
  384. package/lib/components/image-viewer/src/image-viewer.vue.d.ts +1 -1
  385. package/lib/components/input/src/input.d.ts +3 -3
  386. package/lib/components/input/src/input.vue.d.ts +16 -16
  387. package/lib/components/input-number/src/input-number.d.ts +2 -2
  388. package/lib/components/input-number/src/input-number.vue.d.ts +7 -7
  389. package/lib/components/input-otp/src/input-otp.vue.d.ts +4 -4
  390. package/lib/components/input-tag/src/input-tag.d.ts +1 -1
  391. package/lib/components/input-tag/src/input-tag.vue.d.ts +10 -10
  392. package/lib/components/link/src/link.d.ts +1 -1
  393. package/lib/components/link/src/link.js.map +1 -1
  394. package/lib/components/link/src/link.vue.d.ts +1 -1
  395. package/lib/components/mention/src/mention.d.ts +5 -106
  396. package/lib/components/mention/src/mention.vue.d.ts +5 -5
  397. package/lib/components/mention/src/mention.vue_vue_type_script_setup_true_lang.js.map +1 -1
  398. package/lib/components/mention/src/mention2.js.map +1 -1
  399. package/lib/components/menu/src/menu.d.ts +17 -29
  400. package/lib/components/menu/src/menu.js +18 -2
  401. package/lib/components/menu/src/menu.js.map +1 -1
  402. package/lib/components/menu/src/sub-menu.d.ts +10 -22
  403. package/lib/components/menu/src/sub-menu.js +18 -2
  404. package/lib/components/menu/src/sub-menu.js.map +1 -1
  405. package/lib/components/message/src/message.d.ts +4 -4
  406. package/lib/components/message/src/message.js +6 -1
  407. package/lib/components/message/src/message.js.map +1 -1
  408. package/lib/components/message/src/message.vue.d.ts +6 -5
  409. package/lib/components/message/src/method.js.map +1 -1
  410. package/lib/components/message-box/src/index.vue.d.ts +59 -67
  411. package/lib/components/notification/src/notification.d.ts +4 -3
  412. package/lib/components/notification/src/notification.js +6 -1
  413. package/lib/components/notification/src/notification.js.map +1 -1
  414. package/lib/components/notification/src/notification.vue.d.ts +5 -4
  415. package/lib/components/overlay/index.d.ts +4 -12
  416. package/lib/components/overlay/src/overlay.d.ts +5 -18
  417. package/lib/components/overlay/src/overlay.js +9 -5
  418. package/lib/components/overlay/src/overlay.js.map +1 -1
  419. package/lib/components/pagination/src/components/sizes.d.ts +4 -13
  420. package/lib/components/pagination/src/components/sizes.js +18 -2
  421. package/lib/components/pagination/src/components/sizes.js.map +1 -1
  422. package/lib/components/pagination/src/components/sizes.vue.d.ts +7 -24
  423. package/lib/components/pagination/src/pagination.d.ts +12 -25
  424. package/lib/components/pagination/src/pagination.js +15 -2
  425. package/lib/components/pagination/src/pagination.js.map +1 -1
  426. package/lib/components/popconfirm/src/popconfirm.d.ts +2 -2
  427. package/lib/components/popconfirm/src/popconfirm.vue.d.ts +5 -5
  428. package/lib/components/popover/src/popover.d.ts +5 -105
  429. package/lib/components/popover/src/popover.js +1 -0
  430. package/lib/components/popover/src/popover.js.map +1 -1
  431. package/lib/components/popover/src/popover.vue.d.ts +13 -12
  432. package/lib/components/popper/src/composables/use-content-dom.d.ts +2 -25
  433. package/lib/components/popper/src/composables/use-content.d.ts +4 -4
  434. package/lib/components/popper/src/content.d.ts +8 -18
  435. package/lib/components/popper/src/content.js +13 -7
  436. package/lib/components/popper/src/content.js.map +1 -1
  437. package/lib/components/popper/src/content.vue.d.ts +17 -15
  438. package/lib/components/popper/src/popper.d.ts +2 -2
  439. package/lib/components/popper/src/popper.js.map +1 -1
  440. package/lib/components/progress/src/progress.d.ts +1 -1
  441. package/lib/components/progress/src/progress.vue.d.ts +1 -1
  442. package/lib/components/radio/src/radio-button.d.ts +3 -3
  443. package/lib/components/radio/src/radio-button.vue.d.ts +2 -2
  444. package/lib/components/radio/src/radio-group.vue.d.ts +5 -5
  445. package/lib/components/radio/src/radio.d.ts +6 -6
  446. package/lib/components/radio/src/radio.vue.d.ts +3 -3
  447. package/lib/components/rate/src/rate.vue.d.ts +1 -1
  448. package/lib/components/rate/src/rate.vue_vue_type_script_setup_true_lang.js.map +1 -1
  449. package/lib/components/rate/src/rate2.js.map +1 -1
  450. package/lib/components/result/src/result.d.ts +1 -1
  451. package/lib/components/row/src/row.d.ts +1 -1
  452. package/lib/components/scrollbar/src/scrollbar.d.ts +5 -4
  453. package/lib/components/scrollbar/src/scrollbar.js +12 -2
  454. package/lib/components/scrollbar/src/scrollbar.js.map +1 -1
  455. package/lib/components/scrollbar/src/scrollbar.vue.d.ts +4 -3
  456. package/lib/components/scrollbar/src/thumb.vue_vue_type_script_setup_true_lang.js.map +1 -1
  457. package/lib/components/scrollbar/src/thumb2.js.map +1 -1
  458. package/lib/components/segmented/index.d.ts +3 -3
  459. package/lib/components/segmented/src/segmented.d.ts +1 -1
  460. package/lib/components/segmented/src/segmented.vue.d.ts +1 -1
  461. package/lib/components/select/src/option.d.ts +2 -2
  462. package/lib/components/select/src/option.vue.d.ts +5 -5
  463. package/lib/components/select/src/select-dropdown.vue.d.ts +2 -1
  464. package/lib/components/select/src/select.d.ts +9 -13
  465. package/lib/components/select/src/select.js +15 -2
  466. package/lib/components/select/src/select.js.map +1 -1
  467. package/lib/components/select/src/select.vue.d.ts +113 -119
  468. package/lib/components/select/src/select.vue_vue_type_script_lang.js.map +1 -1
  469. package/lib/components/select/src/select2.js.map +1 -1
  470. package/lib/components/select/src/useOption.d.ts +2 -2
  471. package/lib/components/select/src/useSelect.d.ts +5 -5
  472. package/lib/components/select/src/useSelect.js.map +1 -1
  473. package/lib/components/select-v2/src/defaults.d.ts +3 -103
  474. package/lib/components/select-v2/src/option-item.vue.d.ts +1 -1
  475. package/lib/components/select-v2/src/select.vue.d.ts +89 -287
  476. package/lib/components/select-v2/src/useSelect.d.ts +1 -1
  477. package/lib/components/skeleton/src/skeleton-item.d.ts +1 -1
  478. package/lib/components/skeleton/src/skeleton.vue.d.ts +1 -1
  479. package/lib/components/slider/src/button.d.ts +2 -1
  480. package/lib/components/slider/src/button.js +9 -1
  481. package/lib/components/slider/src/button.js.map +1 -1
  482. package/lib/components/slider/src/button.vue.d.ts +5 -3
  483. package/lib/components/slider/src/composables/use-marks.js.map +1 -1
  484. package/lib/components/slider/src/slider.d.ts +2 -2
  485. package/lib/components/slider/src/slider.js +6 -1
  486. package/lib/components/slider/src/slider.js.map +1 -1
  487. package/lib/components/slider/src/slider.vue.d.ts +8 -8
  488. package/lib/components/space/src/space.d.ts +7 -7
  489. package/lib/components/space/src/space.js +2 -1
  490. package/lib/components/space/src/space.js.map +1 -1
  491. package/lib/components/space/src/use-space.d.ts +2 -3
  492. package/lib/components/splitter/src/split-bar.vue.d.ts +1 -1
  493. package/lib/components/steps/src/item.d.ts +1 -1
  494. package/lib/components/steps/src/item.vue.d.ts +1 -1
  495. package/lib/components/steps/src/steps.d.ts +2 -2
  496. package/lib/components/steps/src/steps.vue.d.ts +1 -1
  497. package/lib/components/switch/src/switch.vue.d.ts +3 -3
  498. package/lib/components/table/src/filter-panel.vue.d.ts +89 -86
  499. package/lib/components/table/src/table/defaults.d.ts +5 -5
  500. package/lib/components/table/src/table/defaults.js.map +1 -1
  501. package/lib/components/table/src/table/style-helper.d.ts +1 -1
  502. package/lib/components/table/src/table-body/events-helper.js.map +1 -1
  503. package/lib/components/table/src/table-column/defaults.d.ts +4 -4
  504. package/lib/components/table/src/table-header/index.d.ts +14 -14
  505. package/lib/components/table/src/table.vue.d.ts +4 -4
  506. package/lib/components/tabs/src/tab-nav.d.ts +1 -1
  507. package/lib/components/tabs/src/tab-pane.vue.d.ts +1 -1
  508. package/lib/components/tabs/src/tabs.d.ts +5 -5
  509. package/lib/components/tag/src/tag.vue.d.ts +2 -2
  510. package/lib/components/text/src/text.vue.d.ts +1 -1
  511. package/lib/components/time-picker/src/common/picker-range-trigger.vue.d.ts +6 -6
  512. package/lib/components/time-picker/src/common/picker.vue.d.ts +22 -222
  513. package/lib/components/time-picker/src/common/props.d.ts +4 -104
  514. package/lib/components/time-picker/src/time-picker-com/panel-time-pick.vue.d.ts +2 -2
  515. package/lib/components/time-picker/src/time-picker-com/panel-time-range.vue.d.ts +2 -2
  516. package/lib/components/time-picker/src/time-picker.d.ts +16 -216
  517. package/lib/components/time-select/src/time-select.d.ts +6 -10
  518. package/lib/components/time-select/src/time-select.js +15 -2
  519. package/lib/components/time-select/src/time-select.js.map +1 -1
  520. package/lib/components/time-select/src/time-select.vue.d.ts +11 -10
  521. package/lib/components/timeline/src/timeline-item.vue.d.ts +2 -2
  522. package/lib/components/tooltip/src/content.d.ts +4 -199
  523. package/lib/components/tooltip/src/content.vue.d.ts +18 -16
  524. package/lib/components/tooltip/src/tooltip.d.ts +5 -202
  525. package/lib/components/tooltip/src/tooltip.vue.d.ts +19 -18
  526. package/lib/components/tooltip/src/trigger.d.ts +1 -1
  527. package/lib/components/tour/src/content.d.ts +1 -1
  528. package/lib/components/tour/src/content.vue.d.ts +1 -1
  529. package/lib/components/tour/src/step.d.ts +1 -1
  530. package/lib/components/tour/src/tour.d.ts +1 -1
  531. package/lib/components/tour/src/tour.vue.d.ts +3 -3
  532. package/lib/components/transfer/src/transfer.vue.d.ts +1 -1
  533. package/lib/components/tree/src/tree-node.vue.d.ts +14 -14
  534. package/lib/components/tree/src/tree.vue.d.ts +16 -16
  535. package/lib/components/tree-select/src/select.js +1 -5
  536. package/lib/components/tree-select/src/select.js.map +1 -1
  537. package/lib/components/tree-select/src/tree-select-option.d.ts +5 -5
  538. package/lib/components/tree-select/src/tree-select.vue.d.ts +33 -41
  539. package/lib/components/tree-v2/src/composables/useTree.d.ts +9 -8
  540. package/lib/components/tree-v2/src/tree.vue.d.ts +2 -2
  541. package/lib/components/upload/src/upload-content.d.ts +1 -1
  542. package/lib/components/upload/src/upload-content.vue.d.ts +2 -2
  543. package/lib/components/upload/src/upload-list.d.ts +1 -1
  544. package/lib/components/upload/src/upload.d.ts +2 -2
  545. package/lib/components/upload/src/upload.js.map +1 -1
  546. package/lib/components/upload/src/upload.vue.d.ts +3 -3
  547. package/lib/components/virtual-list/src/builders/build-grid.d.ts +4 -3
  548. package/lib/components/virtual-list/src/builders/build-list.d.ts +5 -4
  549. package/lib/components/virtual-list/src/components/dynamic-size-grid.d.ts +4 -3
  550. package/lib/components/virtual-list/src/components/dynamic-size-list.d.ts +5 -4
  551. package/lib/components/virtual-list/src/components/fixed-size-grid.d.ts +4 -3
  552. package/lib/components/virtual-list/src/components/fixed-size-list.d.ts +5 -4
  553. package/lib/components/virtual-list/src/components/scrollbar.d.ts +5 -3
  554. package/lib/components/virtual-list/src/props.d.ts +5 -4
  555. package/lib/components/virtual-list/src/props.js +15 -2
  556. package/lib/components/virtual-list/src/props.js.map +1 -1
  557. package/lib/components/watermark/src/watermark.js.map +1 -1
  558. package/lib/hooks/use-floating/index.d.ts +8 -8
  559. package/lib/hooks/use-popper/index.d.ts +4 -4
  560. package/lib/hooks/use-throttle-render/index.js.map +1 -1
  561. package/lib/utils/index.d.ts +2 -2
  562. package/lib/utils/typescript.d.ts +2 -1
  563. package/lib/utils/typescript.js.map +1 -1
  564. package/lib/version.d.ts +1 -1
  565. package/lib/version.js +1 -1
  566. package/lib/version.js.map +1 -1
  567. package/package.json +2 -2
  568. package/web-types.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"rate.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../../../../packages/components/rate/src/rate.vue"],"sourcesContent":["<template>\n <div\n :id=\"inputId\"\n :class=\"[rateClasses, ns.is('disabled', rateDisabled)]\"\n role=\"slider\"\n :aria-label=\"!isLabeledByFormItem ? ariaLabel || 'rating' : undefined\"\n :aria-labelledby=\"\n isLabeledByFormItem ? formItemContext?.labelId : undefined\n \"\n :aria-valuenow=\"currentValue\"\n :aria-valuetext=\"text || undefined\"\n aria-valuemin=\"0\"\n :aria-valuemax=\"max\"\n :style=\"rateStyles\"\n :tabindex=\"rateDisabled ? undefined : 0\"\n :aria-disabled=\"rateDisabled\"\n @keydown=\"handleKey\"\n >\n <span\n v-for=\"(item, key) in max\"\n :key=\"key\"\n :class=\"ns.e('item')\"\n @mousemove=\"setCurrentValue(item, $event)\"\n @mouseleave=\"resetCurrentValue\"\n @click=\"selectValue(item)\"\n >\n <el-icon\n ref=\"iconRefs\"\n :class=\"[\n ns.e('icon'),\n { hover: hoverIndex === item },\n ns.is('active', item <= currentValue),\n ns.is('focus-visible', item === Math.ceil(currentValue || 1)),\n ]\"\n >\n <component\n :is=\"activeComponent\"\n v-show=\"!showDecimalIcon(item) && item <= currentValue\"\n />\n <component\n :is=\"voidComponent\"\n v-show=\"!showDecimalIcon(item) && item > currentValue\"\n />\n <component\n :is=\"voidComponent\"\n v-show=\"showDecimalIcon(item)\"\n :class=\"[ns.em('decimal', 'box')]\"\n />\n <el-icon\n v-show=\"showDecimalIcon(item)\"\n :style=\"decimalStyle\"\n :class=\"[ns.e('icon'), ns.e('decimal')]\"\n >\n <component :is=\"decimalIconComponent\" />\n </el-icon>\n </el-icon>\n </span>\n <span\n v-if=\"showText || showScore\"\n :class=\"ns.e('text')\"\n :style=\"{ color: textColor }\"\n >\n {{ text }}\n </span>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, markRaw, ref, watch } from 'vue'\nimport { clamp } from 'lodash-unified'\nimport {\n CHANGE_EVENT,\n EVENT_CODE,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { getEventCode, isArray, isObject, isString } from '@element-plus/utils'\nimport {\n formItemContextKey,\n useFormDisabled,\n useFormItemInputId,\n useFormSize,\n} from '@element-plus/components/form'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { Star, StarFilled } from '@element-plus/icons-vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { rateEmits } from './rate'\n\nimport type { CSSProperties, Component } from 'vue'\nimport type { IconInstance } from '@element-plus/components/icon'\nimport type { RateProps } from './rate'\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\ndefineOptions({\n name: 'ElRate',\n})\n\nconst props = withDefaults(defineProps<RateProps>(), {\n modelValue: 0,\n id: undefined,\n lowThreshold: 2,\n highThreshold: 4,\n max: 5,\n colors: () => ['', '', ''],\n voidColor: '',\n disabledVoidColor: '',\n icons: () => [StarFilled, StarFilled, StarFilled],\n voidIcon: () => Star,\n disabledVoidIcon: () => StarFilled,\n disabled: undefined,\n textColor: '',\n texts: () => [\n 'Extremely bad',\n 'Disappointed',\n 'Fair',\n 'Satisfied',\n 'Surprise',\n ],\n scoreTemplate: '{value}',\n})\nconst emit = defineEmits(rateEmits)\n\nconst formItemContext = inject(formItemContextKey, undefined)\nconst rateSize = useFormSize()\nconst ns = useNamespace('rate')\nconst { inputId, isLabeledByFormItem } = useFormItemInputId(props, {\n formItemContext,\n})\n\nconst currentValue = ref(clamp(props.modelValue, 0, props.max))\nconst hoverIndex = ref(-1)\nconst pointerAtLeftHalf = ref(true)\n\nconst iconRefs = ref<IconInstance[]>([])\nconst iconClientWidths = computed<number[]>(() =>\n iconRefs.value.map((icon) => icon.$el.clientWidth)\n)\nconst rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)])\nconst rateDisabled = useFormDisabled()\nconst rateStyles = computed(() => {\n return ns.cssVarBlock({\n 'void-color': props.voidColor,\n 'disabled-void-color': props.disabledVoidColor,\n 'fill-color': activeColor.value,\n }) as CSSProperties\n})\n\nconst 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})\nconst valueDecimal = computed(\n () => props.modelValue * 100 - Math.floor(props.modelValue) * 100\n)\nconst 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)\nconst activeColor = computed(() => {\n const color = getValueFromMap(currentValue.value, colorMap.value)\n // {value: '', excluded: true} returned\n return isObject(color) ? '' : color\n})\nconst 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})\nconst componentMap = computed(() => {\n let icons = isArray(props.icons) ? [...props.icons] : { ...props.icons }\n icons = markRaw(icons) as\n | Array<string | Component>\n | Record<number, string | Component>\n return isArray(icons)\n ? {\n [props.lowThreshold]: icons[0],\n [props.highThreshold]: {\n value: icons[1],\n excluded: true,\n },\n [props.max]: icons[2],\n }\n : icons\n})\nconst decimalIconComponent = computed(() =>\n getValueFromMap(props.modelValue, componentMap.value)\n)\nconst voidComponent = computed(() =>\n rateDisabled.value\n ? isString(props.disabledVoidIcon)\n ? props.disabledVoidIcon\n : (markRaw(props.disabledVoidIcon) as Component)\n : isString(props.voidIcon)\n ? props.voidIcon\n : (markRaw(props.voidIcon) as Component)\n)\nconst activeComponent = computed(() =>\n getValueFromMap(currentValue.value, componentMap.value)\n)\n\nfunction 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\nfunction emitValue(value: number) {\n // if allow clear, and selected value is same as modelValue, reset value to 0\n if (props.clearable && value === props.modelValue) {\n value = 0\n }\n\n emit(UPDATE_MODEL_EVENT, value)\n if (props.modelValue !== value) {\n emit(CHANGE_EVENT, value)\n }\n}\n\nfunction selectValue(value: number) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf && pointerAtLeftHalf.value) {\n emitValue(currentValue.value)\n } else {\n emitValue(value)\n }\n}\n\nfunction handleKey(e: KeyboardEvent) {\n if (rateDisabled.value) {\n return\n }\n const code = getEventCode(e)\n const step = props.allowHalf ? 0.5 : 1\n let _currentValue = currentValue.value\n\n switch (code) {\n case EVENT_CODE.up:\n case EVENT_CODE.right:\n _currentValue += step\n break\n case EVENT_CODE.left:\n case EVENT_CODE.down:\n _currentValue -= step\n break\n }\n\n _currentValue = clamp(_currentValue, 0, props.max)\n\n if (_currentValue === currentValue.value) {\n return\n }\n\n e.stopPropagation()\n e.preventDefault()\n emit(UPDATE_MODEL_EVENT, _currentValue)\n emit(CHANGE_EVENT, _currentValue)\n return _currentValue\n}\n\nfunction setCurrentValue(value: number, event?: MouseEvent) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf && event) {\n pointerAtLeftHalf.value =\n event.offsetX * 2 <= iconClientWidths.value[value - 1]\n currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value\n } else {\n currentValue.value = value\n }\n hoverIndex.value = value\n}\n\nfunction resetCurrentValue() {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf) {\n pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue)\n }\n currentValue.value = clamp(props.modelValue, 0, props.max)\n hoverIndex.value = -1\n}\n\nwatch(\n () => props.modelValue,\n (val) => {\n currentValue.value = clamp(val, 0, props.max)\n pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue)\n }\n)\n\nif (!props.modelValue) {\n emit(UPDATE_MODEL_EVENT, 0)\n}\n\ndefineExpose({\n /** @description set current value */\n setCurrentValue,\n /** @description reset current value */\n resetCurrentValue,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2FA,SAAS,gBACP,OACA,KACA;GACA,MAAM,oBACJ,SAAA,GAAA,YAAA,UACkE,IAAG;GAUvE,MAAM,eAAe,IARD,OAAO,KAAK,IAAG,CAChC,KAAK,QAAQ,CAAC,IAAG,CACjB,QAAQ,QAAQ;IACf,MAAM,MAAM,IAAI;IAEhB,QADiB,iBAAiB,IAAI,GAAG,IAAI,WAAW,SACtC,QAAQ,MAAM,SAAS;KAC1C,CACA,MAAM,GAAG,MAAM,IAAI,EACc,CAAC;GACrC,OAAQ,iBAAiB,aAAa,IAAI,aAAa,SAAU;;EAOnE,MAAM,Q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AA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAKb,QAAA;;IAJJ,QAAA,GAAA,IAAA,iBAAA,GAAA,IAAA,OAAO,GAAE,CAAC,EAAC,OAAA,CAAA;IACX,QAAA,GAAA,IAAA,gBAAK,EAAA,OAAW,QAAA,WAAS,CAAA;+BAEvB,KAAA,MAAI,EAAA,EAAA,KAAA,GAAA,IAAA,oBAAA,QAAA,KAAA,CAAA,EAAA,IAAA,WAAA"}
1
+ {"version":3,"file":"rate.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../../../../packages/components/rate/src/rate.vue"],"sourcesContent":["<template>\n <div\n :id=\"inputId\"\n :class=\"[rateClasses, ns.is('disabled', rateDisabled)]\"\n role=\"slider\"\n :aria-label=\"!isLabeledByFormItem ? ariaLabel || 'rating' : undefined\"\n :aria-labelledby=\"\n isLabeledByFormItem ? formItemContext?.labelId : undefined\n \"\n :aria-valuenow=\"currentValue\"\n :aria-valuetext=\"text || undefined\"\n aria-valuemin=\"0\"\n :aria-valuemax=\"max\"\n :style=\"rateStyles\"\n :tabindex=\"rateDisabled ? undefined : 0\"\n :aria-disabled=\"rateDisabled\"\n @keydown=\"handleKey\"\n >\n <span\n v-for=\"(item, key) in max\"\n :key=\"key\"\n :class=\"ns.e('item')\"\n @mousemove=\"setCurrentValue(item, $event)\"\n @mouseleave=\"resetCurrentValue\"\n @click=\"selectValue(item)\"\n >\n <el-icon\n ref=\"iconRefs\"\n :class=\"[\n ns.e('icon'),\n { hover: hoverIndex === item },\n ns.is('active', item <= currentValue),\n ns.is('focus-visible', item === Math.ceil(currentValue || 1)),\n ]\"\n >\n <component\n :is=\"activeComponent\"\n v-show=\"!showDecimalIcon(item) && item <= currentValue\"\n />\n <component\n :is=\"voidComponent\"\n v-show=\"!showDecimalIcon(item) && item > currentValue\"\n />\n <component\n :is=\"voidComponent\"\n v-show=\"showDecimalIcon(item)\"\n :class=\"[ns.em('decimal', 'box')]\"\n />\n <el-icon\n v-show=\"showDecimalIcon(item)\"\n :style=\"decimalStyle\"\n :class=\"[ns.e('icon'), ns.e('decimal')]\"\n >\n <component :is=\"decimalIconComponent\" />\n </el-icon>\n </el-icon>\n </span>\n <span\n v-if=\"showText || showScore\"\n :class=\"ns.e('text')\"\n :style=\"{ color: textColor }\"\n >\n {{ text }}\n </span>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, markRaw, ref, watch } from 'vue'\nimport { clamp } from 'lodash-unified'\nimport {\n CHANGE_EVENT,\n EVENT_CODE,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { getEventCode, isArray, isObject, isString } from '@element-plus/utils'\nimport {\n formItemContextKey,\n useFormDisabled,\n useFormItemInputId,\n useFormSize,\n} from '@element-plus/components/form'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { Star, StarFilled } from '@element-plus/icons-vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { rateEmits } from './rate'\n\nimport type { CSSProperties, Component } from 'vue'\nimport type { IconInstance } from '@element-plus/components/icon'\nimport type { RateProps } from './rate'\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\ndefineOptions({\n name: 'ElRate',\n})\n\nconst props = withDefaults(defineProps<RateProps>(), {\n modelValue: 0,\n id: undefined,\n lowThreshold: 2,\n highThreshold: 4,\n max: 5,\n colors: () => ['', '', ''],\n voidColor: '',\n disabledVoidColor: '',\n icons: () => [StarFilled, StarFilled, StarFilled],\n voidIcon: () => Star,\n disabledVoidIcon: () => StarFilled,\n disabled: undefined,\n textColor: '',\n texts: () => [\n 'Extremely bad',\n 'Disappointed',\n 'Fair',\n 'Satisfied',\n 'Surprise',\n ],\n scoreTemplate: '{value}',\n})\nconst emit = defineEmits(rateEmits)\n\nconst formItemContext = inject(formItemContextKey, undefined)\nconst rateSize = useFormSize()\nconst ns = useNamespace('rate')\nconst { inputId, isLabeledByFormItem } = useFormItemInputId(props, {\n formItemContext,\n})\n\nconst currentValue = ref(clamp(props.modelValue, 0, props.max))\nconst hoverIndex = ref(-1)\nconst pointerAtLeftHalf = ref(true)\n\nconst iconRefs = ref<IconInstance[]>([])\nconst iconClientWidths = computed<number[]>(() =>\n iconRefs.value.map((icon) => icon.$el.clientWidth)\n)\nconst rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)])\nconst rateDisabled = useFormDisabled()\nconst rateStyles = computed(() => {\n return ns.cssVarBlock({\n 'void-color': props.voidColor,\n 'disabled-void-color': props.disabledVoidColor,\n 'fill-color': activeColor.value,\n }) as CSSProperties\n})\n\nconst 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})\nconst valueDecimal = computed(\n () => props.modelValue * 100 - Math.floor(props.modelValue) * 100\n)\nconst 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)\nconst activeColor = computed(() => {\n const color = getValueFromMap(currentValue.value, colorMap.value)\n // {value: '', excluded: true} returned\n return isObject(color) ? '' : color\n})\nconst 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})\nconst componentMap = computed(() => {\n let icons = isArray(props.icons) ? [...props.icons] : { ...props.icons }\n icons = markRaw(icons) as\n Array<string | Component> | Record<number, string | Component>\n return isArray(icons)\n ? {\n [props.lowThreshold]: icons[0],\n [props.highThreshold]: {\n value: icons[1],\n excluded: true,\n },\n [props.max]: icons[2],\n }\n : icons\n})\nconst decimalIconComponent = computed(() =>\n getValueFromMap(props.modelValue, componentMap.value)\n)\nconst voidComponent = computed(() =>\n rateDisabled.value\n ? isString(props.disabledVoidIcon)\n ? props.disabledVoidIcon\n : (markRaw(props.disabledVoidIcon) as Component)\n : isString(props.voidIcon)\n ? props.voidIcon\n : (markRaw(props.voidIcon) as Component)\n)\nconst activeComponent = computed(() =>\n getValueFromMap(currentValue.value, componentMap.value)\n)\n\nfunction 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\nfunction emitValue(value: number) {\n // if allow clear, and selected value is same as modelValue, reset value to 0\n if (props.clearable && value === props.modelValue) {\n value = 0\n }\n\n emit(UPDATE_MODEL_EVENT, value)\n if (props.modelValue !== value) {\n emit(CHANGE_EVENT, value)\n }\n}\n\nfunction selectValue(value: number) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf && pointerAtLeftHalf.value) {\n emitValue(currentValue.value)\n } else {\n emitValue(value)\n }\n}\n\nfunction handleKey(e: KeyboardEvent) {\n if (rateDisabled.value) {\n return\n }\n const code = getEventCode(e)\n const step = props.allowHalf ? 0.5 : 1\n let _currentValue = currentValue.value\n\n switch (code) {\n case EVENT_CODE.up:\n case EVENT_CODE.right:\n _currentValue += step\n break\n case EVENT_CODE.left:\n case EVENT_CODE.down:\n _currentValue -= step\n break\n }\n\n _currentValue = clamp(_currentValue, 0, props.max)\n\n if (_currentValue === currentValue.value) {\n return\n }\n\n e.stopPropagation()\n e.preventDefault()\n emit(UPDATE_MODEL_EVENT, _currentValue)\n emit(CHANGE_EVENT, _currentValue)\n return _currentValue\n}\n\nfunction setCurrentValue(value: number, event?: MouseEvent) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf && event) {\n pointerAtLeftHalf.value =\n event.offsetX * 2 <= iconClientWidths.value[value - 1]\n currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value\n } else {\n currentValue.value = value\n }\n hoverIndex.value = value\n}\n\nfunction resetCurrentValue() {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf) {\n pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue)\n }\n currentValue.value = clamp(props.modelValue, 0, props.max)\n hoverIndex.value = -1\n}\n\nwatch(\n () => props.modelValue,\n (val) => {\n currentValue.value = clamp(val, 0, props.max)\n pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue)\n }\n)\n\nif (!props.modelValue) {\n emit(UPDATE_MODEL_EVENT, 0)\n}\n\ndefineExpose({\n /** @description set current value */\n setCurrentValue,\n /** @description reset current value */\n resetCurrentValue,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2FA,SAAS,gBACP,OACA,KACA;GACA,MAAM,oBACJ,SAAA,GAAA,YAAA,UACkE,IAAG;GAUvE,MAAM,eAAe,IARD,OAAO,KAAK,IAAG,CAChC,KAAK,QAAQ,CAAC,IAAG,CACjB,QAAQ,QAAQ;IACf,MAAM,MAAM,IAAI;IAEhB,QADiB,iBAAiB,IAAI,GAAG,IAAI,WAAW,SACtC,QAAQ,MAAM,SAAS;KAC1C,CACA,MAAM,GAAG,MAAM,IAAI,EACc,CAAC;GACrC,OAAQ,iBAAiB,aAAa,IAAI,aAAa,SAAU;;EAOnE,MAAM,QAAQ;EAuBd,MAAM,OAAO;EAEb,MAAM,mBAAA,GAAA,IAAA,QAAyB,kBAAA,oBAAoB,KAAA,EAAS;EAC5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O,GAAE,CAAC,EAAC,OAAA,CAAA;IACX,QAAA,GAAA,IAAA,gBAAK,EAAA,OAAW,QAAA,WAAS,CAAA;+BAEvB,KAAA,MAAI,EAAA,EAAA,KAAA,GAAA,IAAA,oBAAA,QAAA,KAAA,CAAA,EAAA,IAAA,WAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"rate2.js","names":[],"sources":["../../../../../../packages/components/rate/src/rate.vue"],"sourcesContent":["<template>\n <div\n :id=\"inputId\"\n :class=\"[rateClasses, ns.is('disabled', rateDisabled)]\"\n role=\"slider\"\n :aria-label=\"!isLabeledByFormItem ? ariaLabel || 'rating' : undefined\"\n :aria-labelledby=\"\n isLabeledByFormItem ? formItemContext?.labelId : undefined\n \"\n :aria-valuenow=\"currentValue\"\n :aria-valuetext=\"text || undefined\"\n aria-valuemin=\"0\"\n :aria-valuemax=\"max\"\n :style=\"rateStyles\"\n :tabindex=\"rateDisabled ? undefined : 0\"\n :aria-disabled=\"rateDisabled\"\n @keydown=\"handleKey\"\n >\n <span\n v-for=\"(item, key) in max\"\n :key=\"key\"\n :class=\"ns.e('item')\"\n @mousemove=\"setCurrentValue(item, $event)\"\n @mouseleave=\"resetCurrentValue\"\n @click=\"selectValue(item)\"\n >\n <el-icon\n ref=\"iconRefs\"\n :class=\"[\n ns.e('icon'),\n { hover: hoverIndex === item },\n ns.is('active', item <= currentValue),\n ns.is('focus-visible', item === Math.ceil(currentValue || 1)),\n ]\"\n >\n <component\n :is=\"activeComponent\"\n v-show=\"!showDecimalIcon(item) && item <= currentValue\"\n />\n <component\n :is=\"voidComponent\"\n v-show=\"!showDecimalIcon(item) && item > currentValue\"\n />\n <component\n :is=\"voidComponent\"\n v-show=\"showDecimalIcon(item)\"\n :class=\"[ns.em('decimal', 'box')]\"\n />\n <el-icon\n v-show=\"showDecimalIcon(item)\"\n :style=\"decimalStyle\"\n :class=\"[ns.e('icon'), ns.e('decimal')]\"\n >\n <component :is=\"decimalIconComponent\" />\n </el-icon>\n </el-icon>\n </span>\n <span\n v-if=\"showText || showScore\"\n :class=\"ns.e('text')\"\n :style=\"{ color: textColor }\"\n >\n {{ text }}\n </span>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, markRaw, ref, watch } from 'vue'\nimport { clamp } from 'lodash-unified'\nimport {\n CHANGE_EVENT,\n EVENT_CODE,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { getEventCode, isArray, isObject, isString } from '@element-plus/utils'\nimport {\n formItemContextKey,\n useFormDisabled,\n useFormItemInputId,\n useFormSize,\n} from '@element-plus/components/form'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { Star, StarFilled } from '@element-plus/icons-vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { rateEmits } from './rate'\n\nimport type { CSSProperties, Component } from 'vue'\nimport type { IconInstance } from '@element-plus/components/icon'\nimport type { RateProps } from './rate'\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\ndefineOptions({\n name: 'ElRate',\n})\n\nconst props = withDefaults(defineProps<RateProps>(), {\n modelValue: 0,\n id: undefined,\n lowThreshold: 2,\n highThreshold: 4,\n max: 5,\n colors: () => ['', '', ''],\n voidColor: '',\n disabledVoidColor: '',\n icons: () => [StarFilled, StarFilled, StarFilled],\n voidIcon: () => Star,\n disabledVoidIcon: () => StarFilled,\n disabled: undefined,\n textColor: '',\n texts: () => [\n 'Extremely bad',\n 'Disappointed',\n 'Fair',\n 'Satisfied',\n 'Surprise',\n ],\n scoreTemplate: '{value}',\n})\nconst emit = defineEmits(rateEmits)\n\nconst formItemContext = inject(formItemContextKey, undefined)\nconst rateSize = useFormSize()\nconst ns = useNamespace('rate')\nconst { inputId, isLabeledByFormItem } = useFormItemInputId(props, {\n formItemContext,\n})\n\nconst currentValue = ref(clamp(props.modelValue, 0, props.max))\nconst hoverIndex = ref(-1)\nconst pointerAtLeftHalf = ref(true)\n\nconst iconRefs = ref<IconInstance[]>([])\nconst iconClientWidths = computed<number[]>(() =>\n iconRefs.value.map((icon) => icon.$el.clientWidth)\n)\nconst rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)])\nconst rateDisabled = useFormDisabled()\nconst rateStyles = computed(() => {\n return ns.cssVarBlock({\n 'void-color': props.voidColor,\n 'disabled-void-color': props.disabledVoidColor,\n 'fill-color': activeColor.value,\n }) as CSSProperties\n})\n\nconst 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})\nconst valueDecimal = computed(\n () => props.modelValue * 100 - Math.floor(props.modelValue) * 100\n)\nconst 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)\nconst activeColor = computed(() => {\n const color = getValueFromMap(currentValue.value, colorMap.value)\n // {value: '', excluded: true} returned\n return isObject(color) ? '' : color\n})\nconst 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})\nconst componentMap = computed(() => {\n let icons = isArray(props.icons) ? [...props.icons] : { ...props.icons }\n icons = markRaw(icons) as\n | Array<string | Component>\n | Record<number, string | Component>\n return isArray(icons)\n ? {\n [props.lowThreshold]: icons[0],\n [props.highThreshold]: {\n value: icons[1],\n excluded: true,\n },\n [props.max]: icons[2],\n }\n : icons\n})\nconst decimalIconComponent = computed(() =>\n getValueFromMap(props.modelValue, componentMap.value)\n)\nconst voidComponent = computed(() =>\n rateDisabled.value\n ? isString(props.disabledVoidIcon)\n ? props.disabledVoidIcon\n : (markRaw(props.disabledVoidIcon) as Component)\n : isString(props.voidIcon)\n ? props.voidIcon\n : (markRaw(props.voidIcon) as Component)\n)\nconst activeComponent = computed(() =>\n getValueFromMap(currentValue.value, componentMap.value)\n)\n\nfunction 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\nfunction emitValue(value: number) {\n // if allow clear, and selected value is same as modelValue, reset value to 0\n if (props.clearable && value === props.modelValue) {\n value = 0\n }\n\n emit(UPDATE_MODEL_EVENT, value)\n if (props.modelValue !== value) {\n emit(CHANGE_EVENT, value)\n }\n}\n\nfunction selectValue(value: number) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf && pointerAtLeftHalf.value) {\n emitValue(currentValue.value)\n } else {\n emitValue(value)\n }\n}\n\nfunction handleKey(e: KeyboardEvent) {\n if (rateDisabled.value) {\n return\n }\n const code = getEventCode(e)\n const step = props.allowHalf ? 0.5 : 1\n let _currentValue = currentValue.value\n\n switch (code) {\n case EVENT_CODE.up:\n case EVENT_CODE.right:\n _currentValue += step\n break\n case EVENT_CODE.left:\n case EVENT_CODE.down:\n _currentValue -= step\n break\n }\n\n _currentValue = clamp(_currentValue, 0, props.max)\n\n if (_currentValue === currentValue.value) {\n return\n }\n\n e.stopPropagation()\n e.preventDefault()\n emit(UPDATE_MODEL_EVENT, _currentValue)\n emit(CHANGE_EVENT, _currentValue)\n return _currentValue\n}\n\nfunction setCurrentValue(value: number, event?: MouseEvent) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf && event) {\n pointerAtLeftHalf.value =\n event.offsetX * 2 <= iconClientWidths.value[value - 1]\n currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value\n } else {\n currentValue.value = value\n }\n hoverIndex.value = value\n}\n\nfunction resetCurrentValue() {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf) {\n pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue)\n }\n currentValue.value = clamp(props.modelValue, 0, props.max)\n hoverIndex.value = -1\n}\n\nwatch(\n () => props.modelValue,\n (val) => {\n currentValue.value = clamp(val, 0, props.max)\n pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue)\n }\n)\n\nif (!props.modelValue) {\n emit(UPDATE_MODEL_EVENT, 0)\n}\n\ndefineExpose({\n /** @description set current value */\n setCurrentValue,\n /** @description reset current value */\n resetCurrentValue,\n})\n</script>\n"],"mappings":""}
1
+ {"version":3,"file":"rate2.js","names":[],"sources":["../../../../../../packages/components/rate/src/rate.vue"],"sourcesContent":["<template>\n <div\n :id=\"inputId\"\n :class=\"[rateClasses, ns.is('disabled', rateDisabled)]\"\n role=\"slider\"\n :aria-label=\"!isLabeledByFormItem ? ariaLabel || 'rating' : undefined\"\n :aria-labelledby=\"\n isLabeledByFormItem ? formItemContext?.labelId : undefined\n \"\n :aria-valuenow=\"currentValue\"\n :aria-valuetext=\"text || undefined\"\n aria-valuemin=\"0\"\n :aria-valuemax=\"max\"\n :style=\"rateStyles\"\n :tabindex=\"rateDisabled ? undefined : 0\"\n :aria-disabled=\"rateDisabled\"\n @keydown=\"handleKey\"\n >\n <span\n v-for=\"(item, key) in max\"\n :key=\"key\"\n :class=\"ns.e('item')\"\n @mousemove=\"setCurrentValue(item, $event)\"\n @mouseleave=\"resetCurrentValue\"\n @click=\"selectValue(item)\"\n >\n <el-icon\n ref=\"iconRefs\"\n :class=\"[\n ns.e('icon'),\n { hover: hoverIndex === item },\n ns.is('active', item <= currentValue),\n ns.is('focus-visible', item === Math.ceil(currentValue || 1)),\n ]\"\n >\n <component\n :is=\"activeComponent\"\n v-show=\"!showDecimalIcon(item) && item <= currentValue\"\n />\n <component\n :is=\"voidComponent\"\n v-show=\"!showDecimalIcon(item) && item > currentValue\"\n />\n <component\n :is=\"voidComponent\"\n v-show=\"showDecimalIcon(item)\"\n :class=\"[ns.em('decimal', 'box')]\"\n />\n <el-icon\n v-show=\"showDecimalIcon(item)\"\n :style=\"decimalStyle\"\n :class=\"[ns.e('icon'), ns.e('decimal')]\"\n >\n <component :is=\"decimalIconComponent\" />\n </el-icon>\n </el-icon>\n </span>\n <span\n v-if=\"showText || showScore\"\n :class=\"ns.e('text')\"\n :style=\"{ color: textColor }\"\n >\n {{ text }}\n </span>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, markRaw, ref, watch } from 'vue'\nimport { clamp } from 'lodash-unified'\nimport {\n CHANGE_EVENT,\n EVENT_CODE,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { getEventCode, isArray, isObject, isString } from '@element-plus/utils'\nimport {\n formItemContextKey,\n useFormDisabled,\n useFormItemInputId,\n useFormSize,\n} from '@element-plus/components/form'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { Star, StarFilled } from '@element-plus/icons-vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { rateEmits } from './rate'\n\nimport type { CSSProperties, Component } from 'vue'\nimport type { IconInstance } from '@element-plus/components/icon'\nimport type { RateProps } from './rate'\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\ndefineOptions({\n name: 'ElRate',\n})\n\nconst props = withDefaults(defineProps<RateProps>(), {\n modelValue: 0,\n id: undefined,\n lowThreshold: 2,\n highThreshold: 4,\n max: 5,\n colors: () => ['', '', ''],\n voidColor: '',\n disabledVoidColor: '',\n icons: () => [StarFilled, StarFilled, StarFilled],\n voidIcon: () => Star,\n disabledVoidIcon: () => StarFilled,\n disabled: undefined,\n textColor: '',\n texts: () => [\n 'Extremely bad',\n 'Disappointed',\n 'Fair',\n 'Satisfied',\n 'Surprise',\n ],\n scoreTemplate: '{value}',\n})\nconst emit = defineEmits(rateEmits)\n\nconst formItemContext = inject(formItemContextKey, undefined)\nconst rateSize = useFormSize()\nconst ns = useNamespace('rate')\nconst { inputId, isLabeledByFormItem } = useFormItemInputId(props, {\n formItemContext,\n})\n\nconst currentValue = ref(clamp(props.modelValue, 0, props.max))\nconst hoverIndex = ref(-1)\nconst pointerAtLeftHalf = ref(true)\n\nconst iconRefs = ref<IconInstance[]>([])\nconst iconClientWidths = computed<number[]>(() =>\n iconRefs.value.map((icon) => icon.$el.clientWidth)\n)\nconst rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)])\nconst rateDisabled = useFormDisabled()\nconst rateStyles = computed(() => {\n return ns.cssVarBlock({\n 'void-color': props.voidColor,\n 'disabled-void-color': props.disabledVoidColor,\n 'fill-color': activeColor.value,\n }) as CSSProperties\n})\n\nconst 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})\nconst valueDecimal = computed(\n () => props.modelValue * 100 - Math.floor(props.modelValue) * 100\n)\nconst 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)\nconst activeColor = computed(() => {\n const color = getValueFromMap(currentValue.value, colorMap.value)\n // {value: '', excluded: true} returned\n return isObject(color) ? '' : color\n})\nconst 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})\nconst componentMap = computed(() => {\n let icons = isArray(props.icons) ? [...props.icons] : { ...props.icons }\n icons = markRaw(icons) as\n Array<string | Component> | Record<number, string | Component>\n return isArray(icons)\n ? {\n [props.lowThreshold]: icons[0],\n [props.highThreshold]: {\n value: icons[1],\n excluded: true,\n },\n [props.max]: icons[2],\n }\n : icons\n})\nconst decimalIconComponent = computed(() =>\n getValueFromMap(props.modelValue, componentMap.value)\n)\nconst voidComponent = computed(() =>\n rateDisabled.value\n ? isString(props.disabledVoidIcon)\n ? props.disabledVoidIcon\n : (markRaw(props.disabledVoidIcon) as Component)\n : isString(props.voidIcon)\n ? props.voidIcon\n : (markRaw(props.voidIcon) as Component)\n)\nconst activeComponent = computed(() =>\n getValueFromMap(currentValue.value, componentMap.value)\n)\n\nfunction 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\nfunction emitValue(value: number) {\n // if allow clear, and selected value is same as modelValue, reset value to 0\n if (props.clearable && value === props.modelValue) {\n value = 0\n }\n\n emit(UPDATE_MODEL_EVENT, value)\n if (props.modelValue !== value) {\n emit(CHANGE_EVENT, value)\n }\n}\n\nfunction selectValue(value: number) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf && pointerAtLeftHalf.value) {\n emitValue(currentValue.value)\n } else {\n emitValue(value)\n }\n}\n\nfunction handleKey(e: KeyboardEvent) {\n if (rateDisabled.value) {\n return\n }\n const code = getEventCode(e)\n const step = props.allowHalf ? 0.5 : 1\n let _currentValue = currentValue.value\n\n switch (code) {\n case EVENT_CODE.up:\n case EVENT_CODE.right:\n _currentValue += step\n break\n case EVENT_CODE.left:\n case EVENT_CODE.down:\n _currentValue -= step\n break\n }\n\n _currentValue = clamp(_currentValue, 0, props.max)\n\n if (_currentValue === currentValue.value) {\n return\n }\n\n e.stopPropagation()\n e.preventDefault()\n emit(UPDATE_MODEL_EVENT, _currentValue)\n emit(CHANGE_EVENT, _currentValue)\n return _currentValue\n}\n\nfunction setCurrentValue(value: number, event?: MouseEvent) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf && event) {\n pointerAtLeftHalf.value =\n event.offsetX * 2 <= iconClientWidths.value[value - 1]\n currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value\n } else {\n currentValue.value = value\n }\n hoverIndex.value = value\n}\n\nfunction resetCurrentValue() {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf) {\n pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue)\n }\n currentValue.value = clamp(props.modelValue, 0, props.max)\n hoverIndex.value = -1\n}\n\nwatch(\n () => props.modelValue,\n (val) => {\n currentValue.value = clamp(val, 0, props.max)\n pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue)\n }\n)\n\nif (!props.modelValue) {\n emit(UPDATE_MODEL_EVENT, 0)\n}\n\ndefineExpose({\n /** @description set current value */\n setCurrentValue,\n /** @description reset current value */\n resetCurrentValue,\n})\n</script>\n"],"mappings":""}
@@ -31,7 +31,7 @@ interface ResultProps {
31
31
  declare const resultProps: {
32
32
  readonly title: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
33
33
  readonly subTitle: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
34
- readonly icon: EpPropFinalized<StringConstructor, "error" | "info" | "primary" | "success" | "warning", unknown, "info", boolean>;
34
+ readonly icon: EpPropFinalized<StringConstructor, "info" | "primary" | "success" | "warning" | "error", unknown, "info", boolean>;
35
35
  };
36
36
  /**
37
37
  * @deprecated Removed after 3.0.0, Use `ResultProps` instead.
@@ -30,7 +30,7 @@ interface RowProps {
30
30
  declare const rowProps: {
31
31
  readonly tag: EpPropFinalized<StringConstructor, unknown, unknown, "div", boolean>;
32
32
  readonly gutter: EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
33
- readonly justify: EpPropFinalized<StringConstructor, "space-around" | "space-between" | "space-evenly" | "center" | "end" | "start", unknown, "start", boolean>;
33
+ readonly justify: EpPropFinalized<StringConstructor, "center" | "space-around" | "space-between" | "space-evenly" | "end" | "start", unknown, "start", boolean>;
34
34
  readonly align: {
35
35
  readonly type: _$vue.PropType<EpPropMergeType<StringConstructor, "top" | "bottom" | "middle", unknown>>;
36
36
  readonly required: false;
@@ -1,4 +1,5 @@
1
1
  import { EpPropFinalized } from "../../../utils/vue/props/types.js";
2
+ import { ClassValue } from "../../../utils/typescript.js";
2
3
  import _default from "./scrollbar.vue.js";
3
4
  import * as _$vue from "vue";
4
5
  import { ExtractPublicPropTypes, StyleValue } from "vue";
@@ -33,12 +34,12 @@ interface ScrollbarProps {
33
34
  * @description class of wrap
34
35
  * @default ''
35
36
  */
36
- wrapClass?: string | string[];
37
+ wrapClass?: ClassValue;
37
38
  /**
38
39
  * @description class of view
39
40
  * @default ''
40
41
  */
41
- viewClass?: string | string[];
42
+ viewClass?: ClassValue;
42
43
  /**
43
44
  * @description style of view
44
45
  * @default ''
@@ -100,8 +101,8 @@ declare const scrollbarProps: {
100
101
  readonly maxHeight: EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
101
102
  readonly native: BooleanConstructor;
102
103
  readonly wrapStyle: EpPropFinalized<(new (...args: any[]) => string | false | _$vue.CSSProperties | StyleValue[]) | (() => StyleValue) | (((new (...args: any[]) => string | false | _$vue.CSSProperties | StyleValue[]) | (() => StyleValue)) | null)[], unknown, unknown, "", boolean>;
103
- readonly wrapClass: EpPropFinalized<readonly [StringConstructor, ArrayConstructor], unknown, unknown, "", boolean>;
104
- readonly viewClass: EpPropFinalized<readonly [StringConstructor, ArrayConstructor], unknown, unknown, "", boolean>;
104
+ readonly wrapClass: EpPropFinalized<(new (...args: any[]) => string | false | Record<string, any> | ClassValue[]) | (() => ClassValue) | (((new (...args: any[]) => string | false | Record<string, any> | ClassValue[]) | (() => ClassValue)) | null)[], unknown, unknown, "", boolean>;
105
+ readonly viewClass: EpPropFinalized<(new (...args: any[]) => string | false | Record<string, any> | ClassValue[]) | (() => ClassValue) | (((new (...args: any[]) => string | false | Record<string, any> | ClassValue[]) | (() => ClassValue)) | null)[], unknown, unknown, "", boolean>;
105
106
  readonly viewStyle: EpPropFinalized<(new (...args: any[]) => string | false | _$vue.CSSProperties | StyleValue[]) | (() => StyleValue) | (((new (...args: any[]) => string | false | _$vue.CSSProperties | StyleValue[]) | (() => StyleValue)) | null)[], unknown, unknown, "", boolean>;
106
107
  readonly noresize: BooleanConstructor;
107
108
  readonly tag: EpPropFinalized<StringConstructor, unknown, unknown, "div", boolean>;
@@ -48,14 +48,24 @@ const scrollbarProps = require_runtime.buildProps({
48
48
  * @description class of wrap
49
49
  */
50
50
  wrapClass: {
51
- type: [String, Array],
51
+ type: require_runtime.definePropType([
52
+ String,
53
+ Array,
54
+ Object,
55
+ Boolean
56
+ ]),
52
57
  default: ""
53
58
  },
54
59
  /**
55
60
  * @description class of view
56
61
  */
57
62
  viewClass: {
58
- type: [String, Array],
63
+ type: require_runtime.definePropType([
64
+ String,
65
+ Array,
66
+ Object,
67
+ Boolean
68
+ ]),
59
69
  default: ""
60
70
  },
61
71
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"scrollbar.js","names":["buildProps","definePropType","useAriaProps","isNumber"],"sources":["../../../../../../packages/components/scrollbar/src/scrollbar.ts"],"sourcesContent":["import { buildProps, definePropType, isNumber } from '@element-plus/utils'\nimport { useAriaProps } from '@element-plus/hooks'\n\nimport type { ExtractPublicPropTypes, StyleValue } from 'vue'\nimport type Scrollbar from './scrollbar.vue'\n\nexport interface ScrollbarProps {\n /**\n * @description trigger distance(px)\n * @default 0\n */\n distance?: number\n /**\n * @description height of scrollbar\n * @default ''\n */\n height?: number | string\n /**\n * @description max height of scrollbar\n * @default ''\n */\n maxHeight?: number | string\n /**\n * @description whether to use the native scrollbar\n */\n native?: boolean\n /**\n * @description style of wrap\n * @default ''\n */\n wrapStyle?: StyleValue\n /**\n * @description class of wrap\n * @default ''\n */\n wrapClass?: string | string[]\n /**\n * @description class of view\n * @default ''\n */\n viewClass?: string | string[]\n /**\n * @description style of view\n * @default ''\n */\n viewStyle?: StyleValue\n /**\n * @description do not respond to container size changes, if the container size does not change, it is better to set it to optimize performance\n */\n noresize?: boolean\n /**\n * @description element tag of the view\n * @default 'div'\n */\n tag?: keyof HTMLElementTagNameMap | (string & {})\n /**\n * @description always show\n */\n always?: boolean\n /**\n * @description minimum size of scrollbar\n * @default 20\n */\n minSize?: number\n /**\n * @description Wrap tabindex\n * @default undefined\n */\n tabindex?: number | string\n /**\n * @description id of view\n */\n id?: string\n /**\n * @description role of view\n */\n role?: string\n /**\n * @description native `aria-label` attribute\n */\n ariaLabel?: string\n /**\n * @description native `aria-orientation` attribute\n */\n ariaOrientation?: 'horizontal' | 'vertical' | 'undefined'\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `ScrollbarProps` instead.\n */\nexport const scrollbarProps = buildProps({\n /**\n * @description trigger distance(px)\n */\n distance: {\n type: Number,\n default: 0,\n },\n /**\n * @description height of scrollbar\n */\n height: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description max height of scrollbar\n */\n maxHeight: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description whether to use the native scrollbar\n */\n native: Boolean,\n /**\n * @description style of wrap\n */\n wrapStyle: {\n type: definePropType<StyleValue>([String, Object, Array, Boolean]),\n default: '',\n },\n /**\n * @description class of wrap\n */\n wrapClass: {\n type: [String, Array],\n default: '',\n },\n /**\n * @description class of view\n */\n viewClass: {\n type: [String, Array],\n default: '',\n },\n /**\n * @description style of view\n */\n viewStyle: {\n type: definePropType<StyleValue>([String, Object, Array, Boolean]),\n default: '',\n },\n /**\n * @description do not respond to container size changes, if the container size does not change, it is better to set it to optimize performance\n */\n noresize: Boolean, // 如果 container 尺寸不会发生变化,最好设置它可以优化性能\n /**\n * @description element tag of the view\n */\n tag: {\n type: String,\n default: 'div',\n },\n /**\n * @description always show\n */\n always: Boolean,\n /**\n * @description minimum size of scrollbar\n */\n minSize: {\n type: Number,\n default: 20,\n },\n /**\n * @description Wrap tabindex\n */\n tabindex: {\n type: [String, Number],\n default: undefined,\n },\n /**\n * @description id of view\n */\n id: String,\n /**\n * @description role of view\n */\n role: String,\n ...useAriaProps(['ariaLabel', 'ariaOrientation']),\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `ScrollbarProps` instead.\n */\nexport type ScrollbarPropsPublic = ExtractPublicPropTypes<typeof scrollbarProps>\n\nexport const scrollbarEmits = {\n 'end-reached': (direction: ScrollbarDirection) =>\n ['left', 'right', 'top', 'bottom'].includes(direction),\n scroll: ({\n scrollTop,\n scrollLeft,\n }: {\n scrollTop: number\n scrollLeft: number\n }) => [scrollTop, scrollLeft].every(isNumber),\n}\nexport type ScrollbarEmits = typeof scrollbarEmits\nexport type ScrollbarDirection = 'top' | 'bottom' | 'left' | 'right'\n\nexport type ScrollbarInstance = InstanceType<typeof Scrollbar> & unknown\n"],"mappings":";;;;;;;;AA0FA,MAAa,iBAAiBA,gBAAAA,WAAW;;;;CAIvC,UAAU;EACR,MAAM;EACN,SAAS;EACV;;;;CAID,QAAQ;EACN,MAAM,CAAC,QAAQ,OAAO;EACtB,SAAS;EACV;;;;CAID,WAAW;EACT,MAAM,CAAC,QAAQ,OAAO;EACtB,SAAS;EACV;;;;CAID,QAAQ;;;;CAIR,WAAW;EACT,MAAMC,gBAAAA,eAA2B;GAAC;GAAQ;GAAQ;GAAO;GAAQ,CAAC;EAClE,SAAS;EACV;;;;CAID,WAAW;EACT,MAAM,CAAC,QAAQ,MAAM;EACrB,SAAS;EACV;;;;CAID,WAAW;EACT,MAAM,CAAC,QAAQ,MAAM;EACrB,SAAS;EACV;;;;CAID,WAAW;EACT,MAAMA,gBAAAA,eAA2B;GAAC;GAAQ;GAAQ;GAAO;GAAQ,CAAC;EAClE,SAAS;EACV;;;;CAID,UAAU;;;;CAIV,KAAK;EACH,MAAM;EACN,SAAS;EACV;;;;CAID,QAAQ;;;;CAIR,SAAS;EACP,MAAM;EACN,SAAS;EACV;;;;CAID,UAAU;EACR,MAAM,CAAC,QAAQ,OAAO;EACtB,SAAS,KAAA;EACV;;;;CAID,IAAI;;;;CAIJ,MAAM;CACN,GAAGC,cAAAA,aAAa,CAAC,aAAa,kBAAkB,CAAC;CAClD,CAAU;AAOX,MAAa,iBAAiB;CAC5B,gBAAgB,cACd;EAAC;EAAQ;EAAS;EAAO;EAAS,CAAC,SAAS,UAAU;CACxD,SAAS,EACP,WACA,iBAII,CAAC,WAAW,WAAW,CAAC,MAAMC,cAAAA,SAAS;CAC9C"}
1
+ {"version":3,"file":"scrollbar.js","names":["buildProps","definePropType","useAriaProps","isNumber"],"sources":["../../../../../../packages/components/scrollbar/src/scrollbar.ts"],"sourcesContent":["import { buildProps, definePropType, isNumber } from '@element-plus/utils'\nimport { useAriaProps } from '@element-plus/hooks'\n\nimport type { ClassValue } from '@element-plus/utils'\nimport type { ExtractPublicPropTypes, StyleValue } from 'vue'\nimport type Scrollbar from './scrollbar.vue'\n\nexport interface ScrollbarProps {\n /**\n * @description trigger distance(px)\n * @default 0\n */\n distance?: number\n /**\n * @description height of scrollbar\n * @default ''\n */\n height?: number | string\n /**\n * @description max height of scrollbar\n * @default ''\n */\n maxHeight?: number | string\n /**\n * @description whether to use the native scrollbar\n */\n native?: boolean\n /**\n * @description style of wrap\n * @default ''\n */\n wrapStyle?: StyleValue\n /**\n * @description class of wrap\n * @default ''\n */\n wrapClass?: ClassValue\n /**\n * @description class of view\n * @default ''\n */\n viewClass?: ClassValue\n /**\n * @description style of view\n * @default ''\n */\n viewStyle?: StyleValue\n /**\n * @description do not respond to container size changes, if the container size does not change, it is better to set it to optimize performance\n */\n noresize?: boolean\n /**\n * @description element tag of the view\n * @default 'div'\n */\n tag?: keyof HTMLElementTagNameMap | (string & {})\n /**\n * @description always show\n */\n always?: boolean\n /**\n * @description minimum size of scrollbar\n * @default 20\n */\n minSize?: number\n /**\n * @description Wrap tabindex\n * @default undefined\n */\n tabindex?: number | string\n /**\n * @description id of view\n */\n id?: string\n /**\n * @description role of view\n */\n role?: string\n /**\n * @description native `aria-label` attribute\n */\n ariaLabel?: string\n /**\n * @description native `aria-orientation` attribute\n */\n ariaOrientation?: 'horizontal' | 'vertical' | 'undefined'\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `ScrollbarProps` instead.\n */\nexport const scrollbarProps = buildProps({\n /**\n * @description trigger distance(px)\n */\n distance: {\n type: Number,\n default: 0,\n },\n /**\n * @description height of scrollbar\n */\n height: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description max height of scrollbar\n */\n maxHeight: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description whether to use the native scrollbar\n */\n native: Boolean,\n /**\n * @description style of wrap\n */\n wrapStyle: {\n type: definePropType<StyleValue>([String, Object, Array, Boolean]),\n default: '',\n },\n /**\n * @description class of wrap\n */\n wrapClass: {\n type: definePropType<ClassValue>([String, Array, Object, Boolean]),\n default: '',\n },\n /**\n * @description class of view\n */\n viewClass: {\n type: definePropType<ClassValue>([String, Array, Object, Boolean]),\n default: '',\n },\n /**\n * @description style of view\n */\n viewStyle: {\n type: definePropType<StyleValue>([String, Object, Array, Boolean]),\n default: '',\n },\n /**\n * @description do not respond to container size changes, if the container size does not change, it is better to set it to optimize performance\n */\n noresize: Boolean, // 如果 container 尺寸不会发生变化,最好设置它可以优化性能\n /**\n * @description element tag of the view\n */\n tag: {\n type: String,\n default: 'div',\n },\n /**\n * @description always show\n */\n always: Boolean,\n /**\n * @description minimum size of scrollbar\n */\n minSize: {\n type: Number,\n default: 20,\n },\n /**\n * @description Wrap tabindex\n */\n tabindex: {\n type: [String, Number],\n default: undefined,\n },\n /**\n * @description id of view\n */\n id: String,\n /**\n * @description role of view\n */\n role: String,\n ...useAriaProps(['ariaLabel', 'ariaOrientation']),\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `ScrollbarProps` instead.\n */\nexport type ScrollbarPropsPublic = ExtractPublicPropTypes<typeof scrollbarProps>\n\nexport const scrollbarEmits = {\n 'end-reached': (direction: ScrollbarDirection) =>\n ['left', 'right', 'top', 'bottom'].includes(direction),\n scroll: ({\n scrollTop,\n scrollLeft,\n }: {\n scrollTop: number\n scrollLeft: number\n }) => [scrollTop, scrollLeft].every(isNumber),\n}\nexport type ScrollbarEmits = typeof scrollbarEmits\nexport type ScrollbarDirection = 'top' | 'bottom' | 'left' | 'right'\n\nexport type ScrollbarInstance = InstanceType<typeof Scrollbar> & unknown\n"],"mappings":";;;;;;;;AA2FA,MAAa,iBAAiBA,gBAAAA,WAAW;;;;CAIvC,UAAU;EACR,MAAM;EACN,SAAS;EACV;;;;CAID,QAAQ;EACN,MAAM,CAAC,QAAQ,OAAO;EACtB,SAAS;EACV;;;;CAID,WAAW;EACT,MAAM,CAAC,QAAQ,OAAO;EACtB,SAAS;EACV;;;;CAID,QAAQ;;;;CAIR,WAAW;EACT,MAAMC,gBAAAA,eAA2B;GAAC;GAAQ;GAAQ;GAAO;GAAQ,CAAC;EAClE,SAAS;EACV;;;;CAID,WAAW;EACT,MAAMA,gBAAAA,eAA2B;GAAC;GAAQ;GAAO;GAAQ;GAAQ,CAAC;EAClE,SAAS;EACV;;;;CAID,WAAW;EACT,MAAMA,gBAAAA,eAA2B;GAAC;GAAQ;GAAO;GAAQ;GAAQ,CAAC;EAClE,SAAS;EACV;;;;CAID,WAAW;EACT,MAAMA,gBAAAA,eAA2B;GAAC;GAAQ;GAAQ;GAAO;GAAQ,CAAC;EAClE,SAAS;EACV;;;;CAID,UAAU;;;;CAIV,KAAK;EACH,MAAM;EACN,SAAS;EACV;;;;CAID,QAAQ;;;;CAIR,SAAS;EACP,MAAM;EACN,SAAS;EACV;;;;CAID,UAAU;EACR,MAAM,CAAC,QAAQ,OAAO;EACtB,SAAS,KAAA;EACV;;;;CAID,IAAI;;;;CAIJ,MAAM;CACN,GAAGC,cAAAA,aAAa,CAAC,aAAa,kBAAkB,CAAC;CAClD,CAAU;AAOX,MAAa,iBAAiB;CAC5B,gBAAgB,cACd;EAAC;EAAQ;EAAS;EAAO;EAAS,CAAC,SAAS,UAAU;CACxD,SAAS,EACP,WACA,iBAII,CAAC,WAAW,WAAW,CAAC,MAAMC,cAAAA,SAAS;CAC9C"}
@@ -1,3 +1,4 @@
1
+ import { ClassValue } from "../../../utils/typescript.js";
1
2
  import { ScrollbarDirection, ScrollbarProps } from "./scrollbar.js";
2
3
  import * as _$vue from "vue";
3
4
  import { CSSProperties, StyleValue } from "vue";
@@ -29,14 +30,14 @@ declare const __VLS_base: _$vue.DefineComponent<ScrollbarProps, {
29
30
  }) => any) | undefined;
30
31
  "onEnd-reached"?: ((direction: ScrollbarDirection) => any) | undefined;
31
32
  }>, {
33
+ tabindex: number | string;
32
34
  height: number | string;
33
35
  maxHeight: number | string;
34
- tabindex: number | string;
35
36
  tag: keyof HTMLElementTagNameMap | (string & {});
36
37
  distance: number;
37
38
  wrapStyle: string | false | CSSProperties | StyleValue[] | null;
38
- wrapClass: string | string[];
39
- viewClass: string | string[];
39
+ wrapClass: string | false | Record<string, any> | ClassValue[] | null;
40
+ viewClass: string | false | Record<string, any> | ClassValue[] | null;
40
41
  viewStyle: string | false | CSSProperties | StyleValue[] | null;
41
42
  minSize: number;
42
43
  }, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
@@ -1 +1 @@
1
- {"version":3,"file":"thumb.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../../../../packages/components/scrollbar/src/thumb.vue"],"sourcesContent":["<template>\n <transition :name=\"ns.b('fade')\">\n <div\n v-show=\"always || visible\"\n ref=\"instance\"\n :class=\"[ns.e('bar'), ns.is(bar.key)]\"\n @mousedown=\"clickTrackHandler\"\n @click.stop\n >\n <div\n ref=\"thumb\"\n :class=\"ns.e('thumb')\"\n :style=\"thumbStyle\"\n @mousedown=\"clickThumbHandler\"\n />\n </div>\n </transition>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, onBeforeUnmount, ref, toRef } from 'vue'\nimport { useEventListener } from '@vueuse/core'\nimport { isClient, throwError } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { scrollbarContextKey } from './constants'\nimport { BAR_MAP, renderThumbStyle } from './util'\n\nimport type { ThumbProps } from './thumb'\n\nconst COMPONENT_NAME = 'Thumb'\nconst props = defineProps<ThumbProps>()\n\nconst scrollbar = inject(scrollbarContextKey)\nconst ns = useNamespace('scrollbar')\n\nif (!scrollbar) throwError(COMPONENT_NAME, 'can not inject scrollbar context')\n\nconst instance = ref<HTMLDivElement>()\nconst thumb = ref<HTMLDivElement>()\n\nconst thumbState = ref<Partial<Record<'X' | 'Y', number>>>({})\nconst visible = ref(false)\n\nlet cursorDown = false\nlet cursorLeave = false\nlet baseScrollHeight = 0\nlet baseScrollWidth = 0\nlet originalOnSelectStart:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = isClient ? document.onselectstart : null\n\nconst bar = computed(() => BAR_MAP[props.vertical ? 'vertical' : 'horizontal'])\n\nconst thumbStyle = computed(() =>\n renderThumbStyle({\n size: props.size,\n move: props.move,\n bar: bar.value,\n })\n)\n\nconst offsetRatio = computed(\n () =>\n // offsetRatioX = original width of thumb / current width of thumb / ratioX\n // offsetRatioY = original height of thumb / current height of thumb / ratioY\n // instance height = wrap height - GAP\n instance.value![bar.value.offset] ** 2 /\n scrollbar.wrapElement![bar.value.scrollSize] /\n props.ratio /\n thumb.value![bar.value.offset]\n)\n\nconst clickThumbHandler = (e: MouseEvent) => {\n // prevent click event of middle and right button\n e.stopPropagation()\n if (e.ctrlKey || [1, 2].includes(e.button)) return\n\n window.getSelection()?.removeAllRanges()\n startDrag(e)\n\n const el = e.currentTarget as HTMLDivElement\n if (!el) return\n thumbState.value[bar.value.axis] =\n el[bar.value.offset] -\n (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction])\n}\n\nconst clickTrackHandler = (e: MouseEvent) => {\n if (!thumb.value || !instance.value || !scrollbar.wrapElement) return\n\n const offset = Math.abs(\n (e.target as HTMLElement).getBoundingClientRect()[bar.value.direction] -\n e[bar.value.client]\n )\n const thumbHalf = thumb.value[bar.value.offset] / 2\n const thumbPositionPercentage =\n ((offset - thumbHalf) * 100 * offsetRatio.value) /\n instance.value[bar.value.offset]\n\n scrollbar.wrapElement[bar.value.scroll] =\n (thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize]) /\n 100\n}\n\nconst startDrag = (e: MouseEvent) => {\n e.stopImmediatePropagation()\n cursorDown = true\n baseScrollHeight = scrollbar.wrapElement!.scrollHeight\n baseScrollWidth = scrollbar.wrapElement!.scrollWidth\n document.addEventListener('mousemove', mouseMoveDocumentHandler)\n document.addEventListener('mouseup', mouseUpDocumentHandler)\n originalOnSelectStart = document.onselectstart\n document.onselectstart = () => false\n}\n\nconst mouseMoveDocumentHandler = (e: MouseEvent) => {\n if (!instance.value || !thumb.value) return\n if (cursorDown === false) return\n\n const prevPage = thumbState.value[bar.value.axis]\n if (!prevPage) return\n\n const offset =\n (instance.value.getBoundingClientRect()[bar.value.direction] -\n e[bar.value.client]) *\n -1\n const thumbClickPosition = thumb.value[bar.value.offset] - prevPage\n const thumbPositionPercentage =\n ((offset - thumbClickPosition) * 100 * offsetRatio.value) /\n instance.value[bar.value.offset]\n\n if (bar.value.scroll === 'scrollLeft') {\n scrollbar.wrapElement![bar.value.scroll] =\n (thumbPositionPercentage * baseScrollWidth) / 100\n } else {\n scrollbar.wrapElement![bar.value.scroll] =\n (thumbPositionPercentage * baseScrollHeight) / 100\n }\n}\n\nconst mouseUpDocumentHandler = () => {\n cursorDown = false\n thumbState.value[bar.value.axis] = 0\n document.removeEventListener('mousemove', mouseMoveDocumentHandler)\n document.removeEventListener('mouseup', mouseUpDocumentHandler)\n restoreOnselectstart()\n if (cursorLeave) visible.value = false\n}\n\nconst mouseMoveScrollbarHandler = () => {\n cursorLeave = false\n visible.value = !!props.size\n}\n\nconst mouseLeaveScrollbarHandler = () => {\n cursorLeave = true\n visible.value = cursorDown\n}\n\nonBeforeUnmount(() => {\n restoreOnselectstart()\n document.removeEventListener('mouseup', mouseUpDocumentHandler)\n})\n\nconst restoreOnselectstart = () => {\n if (document.onselectstart !== originalOnSelectStart)\n document.onselectstart = originalOnSelectStart\n}\n\nuseEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mousemove',\n mouseMoveScrollbarHandler\n)\nuseEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mouseleave',\n mouseLeaveScrollbarHandler\n)\n</script>\n"],"mappings":";;;;;;;;;AA6BA,MAAM,iBAAiB;;;;;EACvB,MAAM,QAAQ;EAEd,MAAM,aAAA,GAAA,IAAA,QAAmB,kBAAA,oBAAmB;EAC5C,MAAM,KAAK,cAAA,aAAa,YAAW;EAEnC,IAAI,CAAC,WAAW,cAAA,WAAW,gBAAgB,mCAAkC;EAE7E,MAAM,YAAA,GAAA,IAAA,MAA+B;EACrC,MAAM,SAAA,GAAA,IAAA,MAA4B;EAElC,MAAM,cAAA,GAAA,IAAA,KAAqD,EAAE,CAAA;EAC7D,MAAM,WAAA,GAAA,IAAA,KAAc,MAAK;EAEzB,IAAI,aAAa;EACjB,IAAI,cAAc;EAClB,IAAI,mBAAmB;EACvB,IAAI,kBAAkB;EACtB,IAAI,wBAEO,aAAA,WAAW,SAAS,gBAAgB;EAE/C,MAAM,OAAA,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CAcQ,EAAA,GAAA,IAAA,iBAAA,GAAA,IAAA,oBAAA,OAAA;cAXA;KAAJ,KAAI;KACH,QAAA,GAAA,IAAA,gBAAK,EAAA,GAAA,IAAA,OAAG,GAAE,CAAC,EAAC,MAAA,GAAA,GAAA,IAAA,OAAS,GAAE,CAAC,GAAG,IAAA,MAAI,IAAG,CAAA,CAAA;KAClC,aAAW;KACX,SAAK,OAAA,OAAA,OAAA,MAAA,GAAA,IAAA,qBAAN,IAAW,CAAA,OAAA,CAAA;oCAOT,OAAA;cAJI;KAAJ,KAAI;KACH,QAAA,GAAA,IAAA,iBAAA,GAAA,IAAA,OAAO,GAAE,CAAC,EAAC,QAAA,CAAA;KACX,QAAA,GAAA,IAAA,gBAAO,WAAA,MAAU;KACjB,aAAW;qCAVN,QAAA,UAAU,QAAA,MAAO,CAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"thumb.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../../../../packages/components/scrollbar/src/thumb.vue"],"sourcesContent":["<template>\n <transition :name=\"ns.b('fade')\">\n <div\n v-show=\"always || visible\"\n ref=\"instance\"\n :class=\"[ns.e('bar'), ns.is(bar.key)]\"\n @mousedown=\"clickTrackHandler\"\n @click.stop\n >\n <div\n ref=\"thumb\"\n :class=\"ns.e('thumb')\"\n :style=\"thumbStyle\"\n @mousedown=\"clickThumbHandler\"\n />\n </div>\n </transition>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, onBeforeUnmount, ref, toRef } from 'vue'\nimport { useEventListener } from '@vueuse/core'\nimport { isClient, throwError } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { scrollbarContextKey } from './constants'\nimport { BAR_MAP, renderThumbStyle } from './util'\n\nimport type { ThumbProps } from './thumb'\n\nconst COMPONENT_NAME = 'Thumb'\nconst props = defineProps<ThumbProps>()\n\nconst scrollbar = inject(scrollbarContextKey)\nconst ns = useNamespace('scrollbar')\n\nif (!scrollbar) throwError(COMPONENT_NAME, 'can not inject scrollbar context')\n\nconst instance = ref<HTMLDivElement>()\nconst thumb = ref<HTMLDivElement>()\n\nconst thumbState = ref<Partial<Record<'X' | 'Y', number>>>({})\nconst visible = ref(false)\n\nlet cursorDown = false\nlet cursorLeave = false\nlet baseScrollHeight = 0\nlet baseScrollWidth = 0\nlet originalOnSelectStart:\n ((this: GlobalEventHandlers, ev: Event) => any) | null = isClient\n ? document.onselectstart\n : null\n\nconst bar = computed(() => BAR_MAP[props.vertical ? 'vertical' : 'horizontal'])\n\nconst thumbStyle = computed(() =>\n renderThumbStyle({\n size: props.size,\n move: props.move,\n bar: bar.value,\n })\n)\n\nconst offsetRatio = computed(\n () =>\n // offsetRatioX = original width of thumb / current width of thumb / ratioX\n // offsetRatioY = original height of thumb / current height of thumb / ratioY\n // instance height = wrap height - GAP\n instance.value![bar.value.offset] ** 2 /\n scrollbar.wrapElement![bar.value.scrollSize] /\n props.ratio /\n thumb.value![bar.value.offset]\n)\n\nconst clickThumbHandler = (e: MouseEvent) => {\n // prevent click event of middle and right button\n e.stopPropagation()\n if (e.ctrlKey || [1, 2].includes(e.button)) return\n\n window.getSelection()?.removeAllRanges()\n startDrag(e)\n\n const el = e.currentTarget as HTMLDivElement\n if (!el) return\n thumbState.value[bar.value.axis] =\n el[bar.value.offset] -\n (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction])\n}\n\nconst clickTrackHandler = (e: MouseEvent) => {\n if (!thumb.value || !instance.value || !scrollbar.wrapElement) return\n\n const offset = Math.abs(\n (e.target as HTMLElement).getBoundingClientRect()[bar.value.direction] -\n e[bar.value.client]\n )\n const thumbHalf = thumb.value[bar.value.offset] / 2\n const thumbPositionPercentage =\n ((offset - thumbHalf) * 100 * offsetRatio.value) /\n instance.value[bar.value.offset]\n\n scrollbar.wrapElement[bar.value.scroll] =\n (thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize]) /\n 100\n}\n\nconst startDrag = (e: MouseEvent) => {\n e.stopImmediatePropagation()\n cursorDown = true\n baseScrollHeight = scrollbar.wrapElement!.scrollHeight\n baseScrollWidth = scrollbar.wrapElement!.scrollWidth\n document.addEventListener('mousemove', mouseMoveDocumentHandler)\n document.addEventListener('mouseup', mouseUpDocumentHandler)\n originalOnSelectStart = document.onselectstart\n document.onselectstart = () => false\n}\n\nconst mouseMoveDocumentHandler = (e: MouseEvent) => {\n if (!instance.value || !thumb.value) return\n if (cursorDown === false) return\n\n const prevPage = thumbState.value[bar.value.axis]\n if (!prevPage) return\n\n const offset =\n (instance.value.getBoundingClientRect()[bar.value.direction] -\n e[bar.value.client]) *\n -1\n const thumbClickPosition = thumb.value[bar.value.offset] - prevPage\n const thumbPositionPercentage =\n ((offset - thumbClickPosition) * 100 * offsetRatio.value) /\n instance.value[bar.value.offset]\n\n if (bar.value.scroll === 'scrollLeft') {\n scrollbar.wrapElement![bar.value.scroll] =\n (thumbPositionPercentage * baseScrollWidth) / 100\n } else {\n scrollbar.wrapElement![bar.value.scroll] =\n (thumbPositionPercentage * baseScrollHeight) / 100\n }\n}\n\nconst mouseUpDocumentHandler = () => {\n cursorDown = false\n thumbState.value[bar.value.axis] = 0\n document.removeEventListener('mousemove', mouseMoveDocumentHandler)\n document.removeEventListener('mouseup', mouseUpDocumentHandler)\n restoreOnselectstart()\n if (cursorLeave) visible.value = false\n}\n\nconst mouseMoveScrollbarHandler = () => {\n cursorLeave = false\n visible.value = !!props.size\n}\n\nconst mouseLeaveScrollbarHandler = () => {\n cursorLeave = true\n visible.value = cursorDown\n}\n\nonBeforeUnmount(() => {\n restoreOnselectstart()\n document.removeEventListener('mouseup', mouseUpDocumentHandler)\n})\n\nconst restoreOnselectstart = () => {\n if (document.onselectstart !== originalOnSelectStart)\n document.onselectstart = originalOnSelectStart\n}\n\nuseEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mousemove',\n mouseMoveScrollbarHandler\n)\nuseEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mouseleave',\n mouseLeaveSc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EAGnC,MAAM,kCAAkC;GACtC,cAAc;GACd,QAAQ,QAAQ,CAAC,CAAC,MAAM;;EAG1B,MAAM,mCAAmC;GACvC,cAAc;GACd,QAAQ,QAAQ;;EAGlB,CAAA,GAAA,IAAA,uBAAsB;GACpB,sBAAqB;GACrB,SAAS,oBAAoB,WAAW,uBAAsB;IAC/D;EAED,MAAM,6BAA6B;GACjC,IAAI,SAAS,kBAAkB,uBAC7B,SAAS,gBAAgB;;EAG7B,CAAA,GAAA,aAAA,mBAAA,GAAA,IAAA,OACQ,WAAW,mBAAmB,EACpC,aACA,0BACF;EACA,CAAA,GAAA,aAAA,mBAAA,GAAA,IAAA,OACQ,WAAW,mBAAmB,EACpC,cACA,2BACF;;qDAnKe,IAAA,YAAA;IAfA,OAAA,GAAA,IAAA,OAAM,GAAE,CAAC,EAAC,OAAA;IAAvB,WAAA;;oCAcQ,EAAA,GAAA,IAAA,iBAAA,GAAA,IAAA,oBAAA,OAAA;cAXA;KAAJ,KAAI;KACH,QAAA,GAAA,IAAA,gBAAK,EAAA,GAAA,IAAA,OAAG,GAAE,CAAC,EAAC,MAAA,GAAA,GAAA,IAAA,OAAS,GAAE,CAAC,GAAG,IAAA,MAAI,IAAG,CAAA,CAAA;KAClC,aAAW;KACX,SAAK,OAAA,OAAA,OAAA,MAAA,GAAA,IAAA,qBAAN,IAAW,CAAA,OAAA,CAAA;oCAOT,OAAA;cAJI;KAAJ,KAAI;KACH,QAAA,GAAA,IAAA,iBAAA,GAAA,IAAA,OAAO,GAAE,CAAC,EAAC,QAAA,CAAA;KACX,QAAA,GAAA,IAAA,gBAAO,WAAA,MAAU;KACjB,aAAW;qCAVN,QAAA,UAAU,QAAA,MAAO,CAAA,CAAA,CAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"thumb2.js","names":[],"sources":["../../../../../../packages/components/scrollbar/src/thumb.vue"],"sourcesContent":["<template>\n <transition :name=\"ns.b('fade')\">\n <div\n v-show=\"always || visible\"\n ref=\"instance\"\n :class=\"[ns.e('bar'), ns.is(bar.key)]\"\n @mousedown=\"clickTrackHandler\"\n @click.stop\n >\n <div\n ref=\"thumb\"\n :class=\"ns.e('thumb')\"\n :style=\"thumbStyle\"\n @mousedown=\"clickThumbHandler\"\n />\n </div>\n </transition>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, onBeforeUnmount, ref, toRef } from 'vue'\nimport { useEventListener } from '@vueuse/core'\nimport { isClient, throwError } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { scrollbarContextKey } from './constants'\nimport { BAR_MAP, renderThumbStyle } from './util'\n\nimport type { ThumbProps } from './thumb'\n\nconst COMPONENT_NAME = 'Thumb'\nconst props = defineProps<ThumbProps>()\n\nconst scrollbar = inject(scrollbarContextKey)\nconst ns = useNamespace('scrollbar')\n\nif (!scrollbar) throwError(COMPONENT_NAME, 'can not inject scrollbar context')\n\nconst instance = ref<HTMLDivElement>()\nconst thumb = ref<HTMLDivElement>()\n\nconst thumbState = ref<Partial<Record<'X' | 'Y', number>>>({})\nconst visible = ref(false)\n\nlet cursorDown = false\nlet cursorLeave = false\nlet baseScrollHeight = 0\nlet baseScrollWidth = 0\nlet originalOnSelectStart:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = isClient ? document.onselectstart : null\n\nconst bar = computed(() => BAR_MAP[props.vertical ? 'vertical' : 'horizontal'])\n\nconst thumbStyle = computed(() =>\n renderThumbStyle({\n size: props.size,\n move: props.move,\n bar: bar.value,\n })\n)\n\nconst offsetRatio = computed(\n () =>\n // offsetRatioX = original width of thumb / current width of thumb / ratioX\n // offsetRatioY = original height of thumb / current height of thumb / ratioY\n // instance height = wrap height - GAP\n instance.value![bar.value.offset] ** 2 /\n scrollbar.wrapElement![bar.value.scrollSize] /\n props.ratio /\n thumb.value![bar.value.offset]\n)\n\nconst clickThumbHandler = (e: MouseEvent) => {\n // prevent click event of middle and right button\n e.stopPropagation()\n if (e.ctrlKey || [1, 2].includes(e.button)) return\n\n window.getSelection()?.removeAllRanges()\n startDrag(e)\n\n const el = e.currentTarget as HTMLDivElement\n if (!el) return\n thumbState.value[bar.value.axis] =\n el[bar.value.offset] -\n (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction])\n}\n\nconst clickTrackHandler = (e: MouseEvent) => {\n if (!thumb.value || !instance.value || !scrollbar.wrapElement) return\n\n const offset = Math.abs(\n (e.target as HTMLElement).getBoundingClientRect()[bar.value.direction] -\n e[bar.value.client]\n )\n const thumbHalf = thumb.value[bar.value.offset] / 2\n const thumbPositionPercentage =\n ((offset - thumbHalf) * 100 * offsetRatio.value) /\n instance.value[bar.value.offset]\n\n scrollbar.wrapElement[bar.value.scroll] =\n (thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize]) /\n 100\n}\n\nconst startDrag = (e: MouseEvent) => {\n e.stopImmediatePropagation()\n cursorDown = true\n baseScrollHeight = scrollbar.wrapElement!.scrollHeight\n baseScrollWidth = scrollbar.wrapElement!.scrollWidth\n document.addEventListener('mousemove', mouseMoveDocumentHandler)\n document.addEventListener('mouseup', mouseUpDocumentHandler)\n originalOnSelectStart = document.onselectstart\n document.onselectstart = () => false\n}\n\nconst mouseMoveDocumentHandler = (e: MouseEvent) => {\n if (!instance.value || !thumb.value) return\n if (cursorDown === false) return\n\n const prevPage = thumbState.value[bar.value.axis]\n if (!prevPage) return\n\n const offset =\n (instance.value.getBoundingClientRect()[bar.value.direction] -\n e[bar.value.client]) *\n -1\n const thumbClickPosition = thumb.value[bar.value.offset] - prevPage\n const thumbPositionPercentage =\n ((offset - thumbClickPosition) * 100 * offsetRatio.value) /\n instance.value[bar.value.offset]\n\n if (bar.value.scroll === 'scrollLeft') {\n scrollbar.wrapElement![bar.value.scroll] =\n (thumbPositionPercentage * baseScrollWidth) / 100\n } else {\n scrollbar.wrapElement![bar.value.scroll] =\n (thumbPositionPercentage * baseScrollHeight) / 100\n }\n}\n\nconst mouseUpDocumentHandler = () => {\n cursorDown = false\n thumbState.value[bar.value.axis] = 0\n document.removeEventListener('mousemove', mouseMoveDocumentHandler)\n document.removeEventListener('mouseup', mouseUpDocumentHandler)\n restoreOnselectstart()\n if (cursorLeave) visible.value = false\n}\n\nconst mouseMoveScrollbarHandler = () => {\n cursorLeave = false\n visible.value = !!props.size\n}\n\nconst mouseLeaveScrollbarHandler = () => {\n cursorLeave = true\n visible.value = cursorDown\n}\n\nonBeforeUnmount(() => {\n restoreOnselectstart()\n document.removeEventListener('mouseup', mouseUpDocumentHandler)\n})\n\nconst restoreOnselectstart = () => {\n if (document.onselectstart !== originalOnSelectStart)\n document.onselectstart = originalOnSelectStart\n}\n\nuseEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mousemove',\n mouseMoveScrollbarHandler\n)\nuseEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mouseleave',\n mouseLeaveScrollbarHandler\n)\n</script>\n"],"mappings":""}
1
+ {"version":3,"file":"thumb2.js","names":[],"sources":["../../../../../../packages/components/scrollbar/src/thumb.vue"],"sourcesContent":["<template>\n <transition :name=\"ns.b('fade')\">\n <div\n v-show=\"always || visible\"\n ref=\"instance\"\n :class=\"[ns.e('bar'), ns.is(bar.key)]\"\n @mousedown=\"clickTrackHandler\"\n @click.stop\n >\n <div\n ref=\"thumb\"\n :class=\"ns.e('thumb')\"\n :style=\"thumbStyle\"\n @mousedown=\"clickThumbHandler\"\n />\n </div>\n </transition>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, onBeforeUnmount, ref, toRef } from 'vue'\nimport { useEventListener } from '@vueuse/core'\nimport { isClient, throwError } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { scrollbarContextKey } from './constants'\nimport { BAR_MAP, renderThumbStyle } from './util'\n\nimport type { ThumbProps } from './thumb'\n\nconst COMPONENT_NAME = 'Thumb'\nconst props = defineProps<ThumbProps>()\n\nconst scrollbar = inject(scrollbarContextKey)\nconst ns = useNamespace('scrollbar')\n\nif (!scrollbar) throwError(COMPONENT_NAME, 'can not inject scrollbar context')\n\nconst instance = ref<HTMLDivElement>()\nconst thumb = ref<HTMLDivElement>()\n\nconst thumbState = ref<Partial<Record<'X' | 'Y', number>>>({})\nconst visible = ref(false)\n\nlet cursorDown = false\nlet cursorLeave = false\nlet baseScrollHeight = 0\nlet baseScrollWidth = 0\nlet originalOnSelectStart:\n ((this: GlobalEventHandlers, ev: Event) => any) | null = isClient\n ? document.onselectstart\n : null\n\nconst bar = computed(() => BAR_MAP[props.vertical ? 'vertical' : 'horizontal'])\n\nconst thumbStyle = computed(() =>\n renderThumbStyle({\n size: props.size,\n move: props.move,\n bar: bar.value,\n })\n)\n\nconst offsetRatio = computed(\n () =>\n // offsetRatioX = original width of thumb / current width of thumb / ratioX\n // offsetRatioY = original height of thumb / current height of thumb / ratioY\n // instance height = wrap height - GAP\n instance.value![bar.value.offset] ** 2 /\n scrollbar.wrapElement![bar.value.scrollSize] /\n props.ratio /\n thumb.value![bar.value.offset]\n)\n\nconst clickThumbHandler = (e: MouseEvent) => {\n // prevent click event of middle and right button\n e.stopPropagation()\n if (e.ctrlKey || [1, 2].includes(e.button)) return\n\n window.getSelection()?.removeAllRanges()\n startDrag(e)\n\n const el = e.currentTarget as HTMLDivElement\n if (!el) return\n thumbState.value[bar.value.axis] =\n el[bar.value.offset] -\n (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction])\n}\n\nconst clickTrackHandler = (e: MouseEvent) => {\n if (!thumb.value || !instance.value || !scrollbar.wrapElement) return\n\n const offset = Math.abs(\n (e.target as HTMLElement).getBoundingClientRect()[bar.value.direction] -\n e[bar.value.client]\n )\n const thumbHalf = thumb.value[bar.value.offset] / 2\n const thumbPositionPercentage =\n ((offset - thumbHalf) * 100 * offsetRatio.value) /\n instance.value[bar.value.offset]\n\n scrollbar.wrapElement[bar.value.scroll] =\n (thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize]) /\n 100\n}\n\nconst startDrag = (e: MouseEvent) => {\n e.stopImmediatePropagation()\n cursorDown = true\n baseScrollHeight = scrollbar.wrapElement!.scrollHeight\n baseScrollWidth = scrollbar.wrapElement!.scrollWidth\n document.addEventListener('mousemove', mouseMoveDocumentHandler)\n document.addEventListener('mouseup', mouseUpDocumentHandler)\n originalOnSelectStart = document.onselectstart\n document.onselectstart = () => false\n}\n\nconst mouseMoveDocumentHandler = (e: MouseEvent) => {\n if (!instance.value || !thumb.value) return\n if (cursorDown === false) return\n\n const prevPage = thumbState.value[bar.value.axis]\n if (!prevPage) return\n\n const offset =\n (instance.value.getBoundingClientRect()[bar.value.direction] -\n e[bar.value.client]) *\n -1\n const thumbClickPosition = thumb.value[bar.value.offset] - prevPage\n const thumbPositionPercentage =\n ((offset - thumbClickPosition) * 100 * offsetRatio.value) /\n instance.value[bar.value.offset]\n\n if (bar.value.scroll === 'scrollLeft') {\n scrollbar.wrapElement![bar.value.scroll] =\n (thumbPositionPercentage * baseScrollWidth) / 100\n } else {\n scrollbar.wrapElement![bar.value.scroll] =\n (thumbPositionPercentage * baseScrollHeight) / 100\n }\n}\n\nconst mouseUpDocumentHandler = () => {\n cursorDown = false\n thumbState.value[bar.value.axis] = 0\n document.removeEventListener('mousemove', mouseMoveDocumentHandler)\n document.removeEventListener('mouseup', mouseUpDocumentHandler)\n restoreOnselectstart()\n if (cursorLeave) visible.value = false\n}\n\nconst mouseMoveScrollbarHandler = () => {\n cursorLeave = false\n visible.value = !!props.size\n}\n\nconst mouseLeaveScrollbarHandler = () => {\n cursorLeave = true\n visible.value = cursorDown\n}\n\nonBeforeUnmount(() => {\n restoreOnselectstart()\n document.removeEventListener('mouseup', mouseUpDocumentHandler)\n})\n\nconst restoreOnselectstart = () => {\n if (document.onselectstart !== originalOnSelectStart)\n document.onselectstart = originalOnSelectStart\n}\n\nuseEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mousemove',\n mouseMoveScrollbarHandler\n)\nuseEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mouseleave',\n mouseLeaveScrollbarHandler\n)\n</script>\n"],"mappings":""}
@@ -5,13 +5,13 @@ import * as _$vue from "vue";
5
5
 
6
6
  //#region ../../packages/components/segmented/index.d.ts
7
7
  declare const ElSegmented: (<T extends Option = Option>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
8
+ attrs: any;
9
+ emit: ((event: "update:modelValue", val: any) => void) & ((event: "change", val: any) => void);
8
10
  slots: {
9
11
  default?: (props: {
10
12
  item: T;
11
13
  }) => any;
12
14
  };
13
- emit: ((event: "update:modelValue", val: any) => void) & ((event: "change", val: any) => void);
14
- attrs: any;
15
15
  }, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
16
16
  props: _$vue.PublicProps & {
17
17
  direction?: "vertical" | "horizontal" | undefined;
@@ -25,8 +25,8 @@ declare const ElSegmented: (<T extends Option = Option>(__VLS_props: NonNullable
25
25
  id?: string | undefined;
26
26
  name?: string | undefined;
27
27
  ariaLabel?: string | undefined;
28
- onChange?: ((val: any) => any) | undefined;
29
28
  "onUpdate:modelValue"?: ((val: any) => any) | undefined;
29
+ onChange?: ((val: any) => any) | undefined;
30
30
  } & (typeof globalThis extends {
31
31
  __VLS_PROPS_FALLBACK: infer P;
32
32
  } ? P : {});
@@ -63,7 +63,7 @@ declare const segmentedProps: {
63
63
  ariaLabel: StringConstructor;
64
64
  direction: EpPropFinalized<(new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical") | (((new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical")) | null)[], unknown, unknown, string, boolean>;
65
65
  options: EpPropFinalized<(new (...args: any[]) => Option[]) | (() => Option[]) | (((new (...args: any[]) => Option[]) | (() => Option[])) | null)[], unknown, unknown, () => never[], boolean>;
66
- modelValue: EpPropFinalized<(NumberConstructor | StringConstructor | BooleanConstructor)[], unknown, unknown, undefined, boolean>;
66
+ modelValue: EpPropFinalized<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown, undefined, boolean>;
67
67
  props: EpPropFinalized<(new (...args: any[]) => Props) | (() => Props) | (((new (...args: any[]) => Props) | (() => Props)) | null)[], unknown, unknown, () => Required<Props>, boolean>;
68
68
  block: BooleanConstructor;
69
69
  size: {
@@ -5,8 +5,8 @@ import * as _$vue from "vue";
5
5
  //#region ../../packages/components/segmented/src/segmented.vue.d.ts
6
6
  declare const __VLS_export: <T extends Option = Option>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
7
7
  props: _$vue.PublicProps & __VLS_PrettifyLocal<SegmentedProps<T> & {
8
- onChange?: ((val: any) => any) | undefined;
9
8
  "onUpdate:modelValue"?: ((val: any) => any) | undefined;
9
+ onChange?: ((val: any) => any) | undefined;
10
10
  }> & (typeof globalThis extends {
11
11
  __VLS_PROPS_FALLBACK: infer P;
12
12
  } ? P : {});
@@ -5,13 +5,13 @@ import * as _$vue from "vue";
5
5
  declare const COMPONENT_NAME = "ElOption";
6
6
  declare const optionProps: {
7
7
  value: {
8
- readonly type: _$vue.PropType<EpPropMergeType<(NumberConstructor | StringConstructor | BooleanConstructor | ObjectConstructor)[], unknown, unknown>>;
8
+ readonly type: _$vue.PropType<EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>>;
9
9
  readonly required: true;
10
10
  readonly validator: ((val: unknown) => boolean) | undefined;
11
11
  __epPropKey: true;
12
12
  };
13
13
  label: {
14
- readonly type: _$vue.PropType<EpPropMergeType<(NumberConstructor | StringConstructor)[], unknown, unknown>>;
14
+ readonly type: _$vue.PropType<EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>>;
15
15
  readonly required: false;
16
16
  readonly validator: ((val: unknown) => boolean) | undefined;
17
17
  __epPropKey: true;
@@ -6,13 +6,13 @@ import * as _$vue from "vue";
6
6
  declare const _default: typeof __VLS_export;
7
7
  declare const __VLS_export: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
8
8
  value: {
9
- readonly type: _$vue.PropType<EpPropMergeType<(NumberConstructor | StringConstructor | BooleanConstructor | ObjectConstructor)[], unknown, unknown>>;
9
+ readonly type: _$vue.PropType<EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>>;
10
10
  readonly required: true;
11
11
  readonly validator: ((val: unknown) => boolean) | undefined;
12
12
  __epPropKey: true;
13
13
  };
14
14
  label: {
15
- readonly type: _$vue.PropType<EpPropMergeType<(NumberConstructor | StringConstructor)[], unknown, unknown>>;
15
+ readonly type: _$vue.PropType<EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>>;
16
16
  readonly required: false;
17
17
  readonly validator: ((val: unknown) => boolean) | undefined;
18
18
  __epPropKey: true;
@@ -40,7 +40,7 @@ declare const __VLS_export: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
40
40
  };
41
41
  id: _$vue.Ref<string, string>;
42
42
  containerKls: _$vue.ComputedRef<string[]>;
43
- currentLabel: _$vue.ComputedRef<boolean | EpPropMergeType<(NumberConstructor | StringConstructor)[], unknown, unknown>>;
43
+ currentLabel: _$vue.ComputedRef<boolean | EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>>;
44
44
  itemSelected: _$vue.ComputedRef<boolean>;
45
45
  isDisabled: _$vue.ComputedRef<boolean>;
46
46
  select: SelectContext;
@@ -59,13 +59,13 @@ declare const __VLS_export: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
59
59
  selectOptionClick: () => void;
60
60
  }, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{
61
61
  value: {
62
- readonly type: _$vue.PropType<EpPropMergeType<(NumberConstructor | StringConstructor | BooleanConstructor | ObjectConstructor)[], unknown, unknown>>;
62
+ readonly type: _$vue.PropType<EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>>;
63
63
  readonly required: true;
64
64
  readonly validator: ((val: unknown) => boolean) | undefined;
65
65
  __epPropKey: true;
66
66
  };
67
67
  label: {
68
- readonly type: _$vue.PropType<EpPropMergeType<(NumberConstructor | StringConstructor)[], unknown, unknown>>;
68
+ readonly type: _$vue.PropType<EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>>;
69
69
  readonly required: false;
70
70
  readonly validator: ((val: unknown) => boolean) | undefined;
71
71
  __epPropKey: true;
@@ -1,3 +1,4 @@
1
+ import { ClassValue } from "../../../utils/typescript.js";
1
2
  import * as _$vue from "vue";
2
3
 
3
4
  //#region ../../packages/components/select/src/select-dropdown.vue.d.ts
@@ -22,7 +23,7 @@ declare const __VLS_export: _$vue.DefineComponent<{}, {
22
23
  cssVarBlockName: (name: string) => string;
23
24
  };
24
25
  minWidth: _$vue.Ref<string, string>;
25
- popperClass: _$vue.ComputedRef<string>;
26
+ popperClass: _$vue.ComputedRef<string | false | Record<string, any> | ClassValue[] | null>;
26
27
  isMultiple: _$vue.ComputedRef<boolean>;
27
28
  isFitInputWidth: _$vue.ComputedRef<boolean>;
28
29
  }, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
@@ -1,12 +1,13 @@
1
1
  import { EmitFn } from "../../../utils/vue/typescript.js";
2
2
  import { EpPropFinalized, EpPropMergeType } from "../../../utils/vue/props/types.js";
3
+ import { ClassValue } from "../../../utils/typescript.js";
3
4
  import { PopperEffect } from "../../popper/src/popper.js";
4
5
  import { Options, Placement } from "../../popper/index.js";
5
6
  import { ScrollbarDirection } from "../../scrollbar/src/scrollbar.js";
6
7
  import { Props } from "../../select-v2/src/useProps.js";
7
8
  import _default from "./select.vue.js";
8
9
  import * as _$vue from "vue";
9
- import { CSSProperties, ExtractPropTypes, ExtractPublicPropTypes } from "vue";
10
+ import { ExtractPropTypes, ExtractPublicPropTypes, StyleValue } from "vue";
10
11
 
11
12
  //#region ../../packages/components/select/src/select.d.ts
12
13
  /**
@@ -17,8 +18,8 @@ interface TagTooltipProps {
17
18
  placement?: Placement;
18
19
  fallbackPlacements?: Placement[];
19
20
  effect?: PopperEffect;
20
- popperClass?: string;
21
- popperStyle?: string | CSSProperties;
21
+ popperClass?: ClassValue;
22
+ popperStyle?: StyleValue;
22
23
  transition?: string;
23
24
  teleported?: boolean;
24
25
  popperOptions?: Partial<Options>;
@@ -33,7 +34,7 @@ declare const selectProps: {
33
34
  valueOnClear: EpPropFinalized<(new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null) | (((new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null)) | null)[], unknown, unknown, undefined, boolean>;
34
35
  name: StringConstructor;
35
36
  id: StringConstructor;
36
- modelValue: EpPropFinalized<(new (...args: any[]) => string | number | boolean | Record<string, any> | EpPropMergeType<(NumberConstructor | StringConstructor | BooleanConstructor | ObjectConstructor)[], unknown, unknown>[]) | (() => EpPropMergeType<(NumberConstructor | StringConstructor | BooleanConstructor | ObjectConstructor)[], unknown, unknown> | EpPropMergeType<(NumberConstructor | StringConstructor | BooleanConstructor | ObjectConstructor)[], unknown, unknown>[] | null) | (((new (...args: any[]) => string | number | boolean | Record<string, any> | EpPropMergeType<(NumberConstructor | StringConstructor | BooleanConstructor | ObjectConstructor)[], unknown, unknown>[]) | (() => EpPropMergeType<(NumberConstructor | StringConstructor | BooleanConstructor | ObjectConstructor)[], unknown, unknown> | EpPropMergeType<(NumberConstructor | StringConstructor | BooleanConstructor | ObjectConstructor)[], unknown, unknown>[] | null)) | null)[], unknown, unknown, undefined, boolean>;
37
+ modelValue: EpPropFinalized<(new (...args: any[]) => string | number | boolean | Record<string, any> | EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>[]) | (() => EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown> | EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>[] | null) | (((new (...args: any[]) => string | number | boolean | Record<string, any> | EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>[]) | (() => EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown> | EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>[] | null)) | null)[], unknown, unknown, undefined, boolean>;
37
38
  autocomplete: EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
38
39
  automaticDropdown: BooleanConstructor;
39
40
  size: {
@@ -48,13 +49,8 @@ declare const selectProps: {
48
49
  filterable: BooleanConstructor;
49
50
  allowCreate: BooleanConstructor;
50
51
  loading: BooleanConstructor;
51
- popperClass: EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
52
- popperStyle: {
53
- readonly type: _$vue.PropType<EpPropMergeType<(new (...args: any[]) => string | CSSProperties) | (() => string | CSSProperties) | (((new (...args: any[]) => string | CSSProperties) | (() => string | CSSProperties)) | null)[], unknown, unknown>>;
54
- readonly required: false;
55
- readonly validator: ((val: unknown) => boolean) | undefined;
56
- __epPropKey: true;
57
- };
52
+ popperClass: EpPropFinalized<(new (...args: any[]) => string | false | Record<string, any> | ClassValue[]) | (() => ClassValue) | (((new (...args: any[]) => string | false | Record<string, any> | ClassValue[]) | (() => ClassValue)) | null)[], unknown, unknown, string, boolean>;
53
+ popperStyle: EpPropFinalized<(new (...args: any[]) => string | false | _$vue.CSSProperties | StyleValue[]) | (() => StyleValue) | (((new (...args: any[]) => string | false | _$vue.CSSProperties | StyleValue[]) | (() => StyleValue)) | null)[], unknown, unknown, undefined, boolean>;
58
54
  popperOptions: EpPropFinalized<(new (...args: any[]) => Partial<Options>) | (() => Partial<Options>) | (((new (...args: any[]) => Partial<Options>) | (() => Partial<Options>)) | null)[], unknown, unknown, () => Partial<Options>, boolean>;
59
55
  remote: BooleanConstructor;
60
56
  debounce: EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
@@ -111,9 +107,9 @@ declare const selectProps: {
111
107
  remoteShowSuffix: BooleanConstructor;
112
108
  showArrow: EpPropFinalized<BooleanConstructor, unknown, unknown, boolean, boolean>;
113
109
  offset: EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
114
- placement: EpPropFinalized<(new (...args: any[]) => "auto" | "auto-start" | "auto-end" | "top" | "bottom" | "right" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => Placement) | (((new (...args: any[]) => "auto" | "auto-start" | "auto-end" | "top" | "bottom" | "right" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => Placement)) | null)[], Placement, unknown, string, boolean>;
110
+ placement: EpPropFinalized<(new (...args: any[]) => "left" | "right" | "top" | "auto" | "bottom" | "auto-start" | "auto-end" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => Placement) | (((new (...args: any[]) => "left" | "right" | "top" | "auto" | "bottom" | "auto-start" | "auto-end" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => Placement)) | null)[], Placement, unknown, string, boolean>;
115
111
  fallbackPlacements: EpPropFinalized<(new (...args: any[]) => Placement[]) | (() => Placement[]) | (((new (...args: any[]) => Placement[]) | (() => Placement[])) | null)[], unknown, unknown, string[], boolean>;
116
- tabindex: EpPropFinalized<(NumberConstructor | StringConstructor)[], unknown, unknown, number, boolean>;
112
+ tabindex: EpPropFinalized<(StringConstructor | NumberConstructor)[], unknown, unknown, number, boolean>;
117
113
  appendTo: {
118
114
  readonly type: _$vue.PropType<EpPropMergeType<(new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement) | (((new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement)) | null)[], unknown, unknown>>;
119
115
  readonly required: false;
@@ -84,13 +84,26 @@ const selectProps = require_runtime$1.buildProps({
84
84
  * @description custom class name for Select's dropdown
85
85
  */
86
86
  popperClass: {
87
- type: String,
87
+ type: require_runtime$1.definePropType([
88
+ String,
89
+ Array,
90
+ Object,
91
+ Boolean
92
+ ]),
88
93
  default: ""
89
94
  },
90
95
  /**
91
96
  * @description custom style for Select's dropdown
92
97
  */
93
- popperStyle: { type: require_runtime$1.definePropType([String, Object]) },
98
+ popperStyle: {
99
+ type: require_runtime$1.definePropType([
100
+ String,
101
+ Array,
102
+ Object,
103
+ Boolean
104
+ ]),
105
+ default: void 0
106
+ },
94
107
  /**
95
108
  * @description [popper.js](https://popper.js.org/docs/v2/) parameters
96
109
  */