element-ps 2.0.20 → 2.0.21

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 (340) hide show
  1. package/dist/index.full.js +2 -41
  2. package/dist/index.full.min.js +5 -5
  3. package/dist/index.full.min.js.map +1 -1
  4. package/dist/index.full.min.mjs +5 -5
  5. package/dist/index.full.min.mjs.map +1 -1
  6. package/dist/index.full.mjs +2 -41
  7. package/es/components/affix/index.mjs +2 -2
  8. package/es/components/affix/src/affix.mjs +19 -82
  9. package/es/components/affix/src/affix.mjs.map +1 -1
  10. package/es/components/affix/src/affix2.mjs +82 -19
  11. package/es/components/affix/src/affix2.mjs.map +1 -1
  12. package/es/components/alert/index.mjs +2 -2
  13. package/es/components/alert/src/alert.mjs +33 -83
  14. package/es/components/alert/src/alert.mjs.map +1 -1
  15. package/es/components/alert/src/alert2.mjs +83 -33
  16. package/es/components/alert/src/alert2.mjs.map +1 -1
  17. package/es/components/autocomplete/index.d.ts +5 -5
  18. package/es/components/autocomplete/index.mjs +2 -2
  19. package/es/components/autocomplete/src/autocomplete.mjs +94 -58
  20. package/es/components/autocomplete/src/autocomplete.mjs.map +1 -1
  21. package/es/components/autocomplete/src/autocomplete.vue.d.ts +5 -5
  22. package/es/components/autocomplete/src/autocomplete2.mjs +58 -94
  23. package/es/components/autocomplete/src/autocomplete2.mjs.map +1 -1
  24. package/es/components/avatar/index.mjs +2 -2
  25. package/es/components/avatar/src/avatar.mjs +29 -61
  26. package/es/components/avatar/src/avatar.mjs.map +1 -1
  27. package/es/components/avatar/src/avatar2.mjs +61 -29
  28. package/es/components/avatar/src/avatar2.mjs.map +1 -1
  29. package/es/components/calendar/index.mjs +2 -2
  30. package/es/components/calendar/src/calendar.mjs +9 -188
  31. package/es/components/calendar/src/calendar.mjs.map +1 -1
  32. package/es/components/calendar/src/calendar2.mjs +188 -9
  33. package/es/components/calendar/src/calendar2.mjs.map +1 -1
  34. package/es/components/calendar/src/date-table.mjs +27 -146
  35. package/es/components/calendar/src/date-table.mjs.map +1 -1
  36. package/es/components/calendar/src/date-table2.mjs +146 -27
  37. package/es/components/calendar/src/date-table2.mjs.map +1 -1
  38. package/es/components/carousel/index.mjs +4 -4
  39. package/es/components/carousel/src/carousel-item.mjs +7 -148
  40. package/es/components/carousel/src/carousel-item.mjs.map +1 -1
  41. package/es/components/carousel/src/carousel-item2.mjs +148 -7
  42. package/es/components/carousel/src/carousel-item2.mjs.map +1 -1
  43. package/es/components/carousel/src/carousel.mjs +43 -201
  44. package/es/components/carousel/src/carousel.mjs.map +1 -1
  45. package/es/components/carousel/src/carousel2.mjs +201 -43
  46. package/es/components/carousel/src/carousel2.mjs.map +1 -1
  47. package/es/components/cascader-panel/src/config.mjs +1 -1
  48. package/es/components/cascader-panel/src/index.mjs +1 -1
  49. package/es/components/cascader-panel/src/menu.mjs +1 -1
  50. package/es/components/cascader-panel/src/node.mjs +200 -120
  51. package/es/components/cascader-panel/src/node.mjs.map +1 -1
  52. package/es/components/cascader-panel/src/node2.mjs +120 -200
  53. package/es/components/cascader-panel/src/node2.mjs.map +1 -1
  54. package/es/components/cascader-panel/src/store.mjs +1 -1
  55. package/es/components/collection/src/collection.mjs +1 -34
  56. package/es/components/collection/src/collection.mjs.map +1 -1
  57. package/es/components/divider/index.mjs +2 -2
  58. package/es/components/divider/src/divider.mjs +34 -17
  59. package/es/components/divider/src/divider.mjs.map +1 -1
  60. package/es/components/divider/src/divider2.mjs +17 -34
  61. package/es/components/divider/src/divider2.mjs.map +1 -1
  62. package/es/components/dropdown/index.d.ts +3 -3
  63. package/es/components/dropdown/src/dropdown-item-impl.mjs +3 -12
  64. package/es/components/dropdown/src/dropdown-item-impl.mjs.map +1 -1
  65. package/es/components/dropdown/src/dropdown-item-impl.vue.d.ts +0 -3
  66. package/es/components/dropdown/src/dropdown.d.ts +1 -1
  67. package/es/components/dropdown/src/dropdown.vue.d.ts +3 -3
  68. package/es/components/form/index.mjs +4 -4
  69. package/es/components/form/src/form-item.mjs +177 -46
  70. package/es/components/form/src/form-item.mjs.map +1 -1
  71. package/es/components/form/src/form-item2.mjs +46 -177
  72. package/es/components/form/src/form-item2.mjs.map +1 -1
  73. package/es/components/form/src/form.mjs +40 -45
  74. package/es/components/form/src/form.mjs.map +1 -1
  75. package/es/components/form/src/form2.mjs +45 -40
  76. package/es/components/form/src/form2.mjs.map +1 -1
  77. package/es/components/image/index.mjs +2 -2
  78. package/es/components/image/src/image.mjs +170 -46
  79. package/es/components/image/src/image.mjs.map +1 -1
  80. package/es/components/image/src/image2.mjs +46 -170
  81. package/es/components/image/src/image2.mjs.map +1 -1
  82. package/es/components/image-viewer/index.mjs +2 -2
  83. package/es/components/image-viewer/src/image-viewer.mjs +31 -210
  84. package/es/components/image-viewer/src/image-viewer.mjs.map +1 -1
  85. package/es/components/image-viewer/src/image-viewer2.mjs +210 -31
  86. package/es/components/image-viewer/src/image-viewer2.mjs.map +1 -1
  87. package/es/components/index.mjs +23 -23
  88. package/es/components/input-number/index.mjs +2 -2
  89. package/es/components/input-number/src/input-number.mjs +46 -171
  90. package/es/components/input-number/src/input-number.mjs.map +1 -1
  91. package/es/components/input-number/src/input-number2.mjs +171 -46
  92. package/es/components/input-number/src/input-number2.mjs.map +1 -1
  93. package/es/components/menu/index.d.ts +3 -3
  94. package/es/components/menu/src/menu.d.ts +4 -4
  95. package/es/components/popover/index.d.ts +6 -6
  96. package/es/components/popover/src/index.vue.d.ts +3 -3
  97. package/es/components/popover/src/popover.d.ts +1 -1
  98. package/es/components/popper/index.mjs +2 -2
  99. package/es/components/popper/src/arrow.mjs +7 -31
  100. package/es/components/popper/src/arrow.mjs.map +1 -1
  101. package/es/components/popper/src/arrow2.mjs +31 -7
  102. package/es/components/popper/src/arrow2.mjs.map +1 -1
  103. package/es/components/radio/index.mjs +2 -2
  104. package/es/components/radio/src/radio-button.mjs +1 -1
  105. package/es/components/radio/src/radio-button2.mjs +1 -1
  106. package/es/components/radio/src/radio.mjs +62 -74
  107. package/es/components/radio/src/radio.mjs.map +1 -1
  108. package/es/components/radio/src/radio2.mjs +74 -62
  109. package/es/components/radio/src/radio2.mjs.map +1 -1
  110. package/es/components/rate/index.mjs +2 -2
  111. package/es/components/rate/src/rate.mjs +84 -169
  112. package/es/components/rate/src/rate.mjs.map +1 -1
  113. package/es/components/rate/src/rate2.mjs +169 -84
  114. package/es/components/rate/src/rate2.mjs.map +1 -1
  115. package/es/components/result/index.mjs +2 -2
  116. package/es/components/result/src/result.mjs +28 -73
  117. package/es/components/result/src/result.mjs.map +1 -1
  118. package/es/components/result/src/result2.mjs +73 -28
  119. package/es/components/result/src/result2.mjs.map +1 -1
  120. package/es/components/select/index.d.ts +5 -5
  121. package/es/components/select/src/select.vue.d.ts +5 -5
  122. package/es/components/select/src/useSelect.d.ts +5 -5
  123. package/es/components/select-v2/index.d.ts +10 -10
  124. package/es/components/select-v2/src/option-item.vue.d.ts +1 -1
  125. package/es/components/select-v2/src/select.vue.d.ts +5 -5
  126. package/es/components/select-v2/src/useSelect.d.ts +5 -5
  127. package/es/components/skeleton/index.mjs +4 -4
  128. package/es/components/skeleton/src/skeleton-item.mjs +18 -23
  129. package/es/components/skeleton/src/skeleton-item.mjs.map +1 -1
  130. package/es/components/skeleton/src/skeleton-item2.mjs +23 -18
  131. package/es/components/skeleton/src/skeleton-item2.mjs.map +1 -1
  132. package/es/components/skeleton/src/skeleton.mjs +22 -49
  133. package/es/components/skeleton/src/skeleton.mjs.map +1 -1
  134. package/es/components/skeleton/src/skeleton2.mjs +49 -22
  135. package/es/components/skeleton/src/skeleton2.mjs.map +1 -1
  136. package/es/components/table/index.d.ts +1 -1
  137. package/es/components/table/src/filter-panel.vue.d.ts +5 -5
  138. package/es/components/table/src/table.vue.d.ts +1 -1
  139. package/es/components/tabs/index.mjs +3 -3
  140. package/es/components/tabs/src/tab-bar.mjs +76 -7
  141. package/es/components/tabs/src/tab-bar.mjs.map +1 -1
  142. package/es/components/tabs/src/tab-bar2.mjs +7 -76
  143. package/es/components/tabs/src/tab-bar2.mjs.map +1 -1
  144. package/es/components/tabs/src/tab-nav.mjs +1 -1
  145. package/es/components/tabs/src/tab-pane.mjs +14 -60
  146. package/es/components/tabs/src/tab-pane.mjs.map +1 -1
  147. package/es/components/tabs/src/tab-pane2.mjs +60 -14
  148. package/es/components/tabs/src/tab-pane2.mjs.map +1 -1
  149. package/es/components/time-picker/src/common/picker.vue.d.ts +5 -5
  150. package/es/components/tooltip/index.d.ts +3 -3
  151. package/es/components/tooltip/src/tooltip.d.ts +1 -1
  152. package/es/components/tooltip/src/tooltip.mjs +1 -1
  153. package/es/components/tooltip/src/tooltip.vue.d.ts +3 -3
  154. package/es/components/tooltip/src/trigger.vue.d.ts +3 -3
  155. package/es/components/tooltip-v2/index.mjs +2 -2
  156. package/es/components/tooltip-v2/src/arrow.mjs +22 -38
  157. package/es/components/tooltip-v2/src/arrow.mjs.map +1 -1
  158. package/es/components/tooltip-v2/src/arrow2.mjs +38 -22
  159. package/es/components/tooltip-v2/src/arrow2.mjs.map +1 -1
  160. package/es/components/tooltip-v2/src/tooltip.mjs +2 -2
  161. package/es/components/tooltip-v2/src/tooltip2.mjs +4 -4
  162. package/es/components/tooltip-v2/src/trigger.mjs +89 -11
  163. package/es/components/tooltip-v2/src/trigger.mjs.map +1 -1
  164. package/es/components/tooltip-v2/src/trigger2.mjs +11 -89
  165. package/es/components/tooltip-v2/src/trigger2.mjs.map +1 -1
  166. package/es/components/upload/index.mjs +1 -1
  167. package/es/components/upload/src/upload-content.mjs +1 -1
  168. package/es/components/upload/src/upload-dragger.mjs +32 -11
  169. package/es/components/upload/src/upload-dragger.mjs.map +1 -1
  170. package/es/components/upload/src/upload-dragger2.mjs +11 -32
  171. package/es/components/upload/src/upload-dragger2.mjs.map +1 -1
  172. package/es/index.mjs +23 -23
  173. package/lib/components/affix/index.js +2 -2
  174. package/lib/components/affix/src/affix.js +19 -82
  175. package/lib/components/affix/src/affix.js.map +1 -1
  176. package/lib/components/affix/src/affix2.js +82 -19
  177. package/lib/components/affix/src/affix2.js.map +1 -1
  178. package/lib/components/alert/index.js +2 -2
  179. package/lib/components/alert/src/alert.js +33 -82
  180. package/lib/components/alert/src/alert.js.map +1 -1
  181. package/lib/components/alert/src/alert2.js +82 -33
  182. package/lib/components/alert/src/alert2.js.map +1 -1
  183. package/lib/components/autocomplete/index.d.ts +5 -5
  184. package/lib/components/autocomplete/index.js +2 -2
  185. package/lib/components/autocomplete/src/autocomplete.js +94 -58
  186. package/lib/components/autocomplete/src/autocomplete.js.map +1 -1
  187. package/lib/components/autocomplete/src/autocomplete.vue.d.ts +5 -5
  188. package/lib/components/autocomplete/src/autocomplete2.js +58 -94
  189. package/lib/components/autocomplete/src/autocomplete2.js.map +1 -1
  190. package/lib/components/avatar/index.js +2 -2
  191. package/lib/components/avatar/src/avatar.js +29 -61
  192. package/lib/components/avatar/src/avatar.js.map +1 -1
  193. package/lib/components/avatar/src/avatar2.js +61 -29
  194. package/lib/components/avatar/src/avatar2.js.map +1 -1
  195. package/lib/components/calendar/index.js +2 -2
  196. package/lib/components/calendar/src/calendar.js +9 -192
  197. package/lib/components/calendar/src/calendar.js.map +1 -1
  198. package/lib/components/calendar/src/calendar2.js +192 -9
  199. package/lib/components/calendar/src/calendar2.js.map +1 -1
  200. package/lib/components/calendar/src/date-table.js +30 -151
  201. package/lib/components/calendar/src/date-table.js.map +1 -1
  202. package/lib/components/calendar/src/date-table2.js +151 -30
  203. package/lib/components/calendar/src/date-table2.js.map +1 -1
  204. package/lib/components/carousel/index.js +4 -4
  205. package/lib/components/carousel/src/carousel-item.js +7 -148
  206. package/lib/components/carousel/src/carousel-item.js.map +1 -1
  207. package/lib/components/carousel/src/carousel-item2.js +148 -7
  208. package/lib/components/carousel/src/carousel-item2.js.map +1 -1
  209. package/lib/components/carousel/src/carousel.js +43 -201
  210. package/lib/components/carousel/src/carousel.js.map +1 -1
  211. package/lib/components/carousel/src/carousel2.js +201 -43
  212. package/lib/components/carousel/src/carousel2.js.map +1 -1
  213. package/lib/components/cascader-panel/src/config.js +1 -1
  214. package/lib/components/cascader-panel/src/index.js +1 -1
  215. package/lib/components/cascader-panel/src/menu.js +1 -1
  216. package/lib/components/cascader-panel/src/node.js +200 -121
  217. package/lib/components/cascader-panel/src/node.js.map +1 -1
  218. package/lib/components/cascader-panel/src/node2.js +121 -200
  219. package/lib/components/cascader-panel/src/node2.js.map +1 -1
  220. package/lib/components/cascader-panel/src/store.js +1 -1
  221. package/lib/components/collection/src/collection.js +0 -33
  222. package/lib/components/collection/src/collection.js.map +1 -1
  223. package/lib/components/divider/index.js +2 -2
  224. package/lib/components/divider/src/divider.js +34 -17
  225. package/lib/components/divider/src/divider.js.map +1 -1
  226. package/lib/components/divider/src/divider2.js +17 -34
  227. package/lib/components/divider/src/divider2.js.map +1 -1
  228. package/lib/components/dropdown/index.d.ts +3 -3
  229. package/lib/components/dropdown/src/dropdown-item-impl.js +1 -10
  230. package/lib/components/dropdown/src/dropdown-item-impl.js.map +1 -1
  231. package/lib/components/dropdown/src/dropdown-item-impl.vue.d.ts +0 -3
  232. package/lib/components/dropdown/src/dropdown.d.ts +1 -1
  233. package/lib/components/dropdown/src/dropdown.vue.d.ts +3 -3
  234. package/lib/components/form/index.js +4 -4
  235. package/lib/components/form/src/form-item.js +177 -47
  236. package/lib/components/form/src/form-item.js.map +1 -1
  237. package/lib/components/form/src/form-item2.js +47 -177
  238. package/lib/components/form/src/form-item2.js.map +1 -1
  239. package/lib/components/form/src/form.js +40 -45
  240. package/lib/components/form/src/form.js.map +1 -1
  241. package/lib/components/form/src/form2.js +45 -40
  242. package/lib/components/form/src/form2.js.map +1 -1
  243. package/lib/components/image/index.js +2 -2
  244. package/lib/components/image/src/image.js +170 -46
  245. package/lib/components/image/src/image.js.map +1 -1
  246. package/lib/components/image/src/image2.js +46 -170
  247. package/lib/components/image/src/image2.js.map +1 -1
  248. package/lib/components/image-viewer/index.js +2 -2
  249. package/lib/components/image-viewer/src/image-viewer.js +31 -210
  250. package/lib/components/image-viewer/src/image-viewer.js.map +1 -1
  251. package/lib/components/image-viewer/src/image-viewer2.js +210 -31
  252. package/lib/components/image-viewer/src/image-viewer2.js.map +1 -1
  253. package/lib/components/index.js +23 -23
  254. package/lib/components/input-number/index.js +2 -2
  255. package/lib/components/input-number/src/input-number.js +46 -171
  256. package/lib/components/input-number/src/input-number.js.map +1 -1
  257. package/lib/components/input-number/src/input-number2.js +171 -46
  258. package/lib/components/input-number/src/input-number2.js.map +1 -1
  259. package/lib/components/menu/index.d.ts +3 -3
  260. package/lib/components/menu/src/menu.d.ts +4 -4
  261. package/lib/components/popover/index.d.ts +6 -6
  262. package/lib/components/popover/src/index.vue.d.ts +3 -3
  263. package/lib/components/popover/src/popover.d.ts +1 -1
  264. package/lib/components/popper/index.js +2 -2
  265. package/lib/components/popper/src/arrow.js +7 -31
  266. package/lib/components/popper/src/arrow.js.map +1 -1
  267. package/lib/components/popper/src/arrow2.js +31 -7
  268. package/lib/components/popper/src/arrow2.js.map +1 -1
  269. package/lib/components/radio/index.js +2 -2
  270. package/lib/components/radio/src/radio-button.js +1 -1
  271. package/lib/components/radio/src/radio-button2.js +1 -1
  272. package/lib/components/radio/src/radio.js +64 -73
  273. package/lib/components/radio/src/radio.js.map +1 -1
  274. package/lib/components/radio/src/radio2.js +73 -64
  275. package/lib/components/radio/src/radio2.js.map +1 -1
  276. package/lib/components/rate/index.js +2 -2
  277. package/lib/components/rate/src/rate.js +84 -169
  278. package/lib/components/rate/src/rate.js.map +1 -1
  279. package/lib/components/rate/src/rate2.js +169 -84
  280. package/lib/components/rate/src/rate2.js.map +1 -1
  281. package/lib/components/result/index.js +2 -2
  282. package/lib/components/result/src/result.js +30 -73
  283. package/lib/components/result/src/result.js.map +1 -1
  284. package/lib/components/result/src/result2.js +73 -30
  285. package/lib/components/result/src/result2.js.map +1 -1
  286. package/lib/components/select/index.d.ts +5 -5
  287. package/lib/components/select/src/select.vue.d.ts +5 -5
  288. package/lib/components/select/src/useSelect.d.ts +5 -5
  289. package/lib/components/select-v2/index.d.ts +10 -10
  290. package/lib/components/select-v2/src/option-item.vue.d.ts +1 -1
  291. package/lib/components/select-v2/src/select.vue.d.ts +5 -5
  292. package/lib/components/select-v2/src/useSelect.d.ts +5 -5
  293. package/lib/components/skeleton/index.js +4 -4
  294. package/lib/components/skeleton/src/skeleton-item.js +18 -23
  295. package/lib/components/skeleton/src/skeleton-item.js.map +1 -1
  296. package/lib/components/skeleton/src/skeleton-item2.js +23 -18
  297. package/lib/components/skeleton/src/skeleton-item2.js.map +1 -1
  298. package/lib/components/skeleton/src/skeleton.js +22 -49
  299. package/lib/components/skeleton/src/skeleton.js.map +1 -1
  300. package/lib/components/skeleton/src/skeleton2.js +49 -22
  301. package/lib/components/skeleton/src/skeleton2.js.map +1 -1
  302. package/lib/components/table/index.d.ts +1 -1
  303. package/lib/components/table/src/filter-panel.vue.d.ts +5 -5
  304. package/lib/components/table/src/table.vue.d.ts +1 -1
  305. package/lib/components/tabs/index.js +3 -3
  306. package/lib/components/tabs/src/tab-bar.js +76 -7
  307. package/lib/components/tabs/src/tab-bar.js.map +1 -1
  308. package/lib/components/tabs/src/tab-bar2.js +7 -76
  309. package/lib/components/tabs/src/tab-bar2.js.map +1 -1
  310. package/lib/components/tabs/src/tab-nav.js +1 -1
  311. package/lib/components/tabs/src/tab-pane.js +14 -60
  312. package/lib/components/tabs/src/tab-pane.js.map +1 -1
  313. package/lib/components/tabs/src/tab-pane2.js +60 -14
  314. package/lib/components/tabs/src/tab-pane2.js.map +1 -1
  315. package/lib/components/time-picker/src/common/picker.vue.d.ts +5 -5
  316. package/lib/components/tooltip/index.d.ts +3 -3
  317. package/lib/components/tooltip/src/tooltip.d.ts +1 -1
  318. package/lib/components/tooltip/src/tooltip.js +1 -1
  319. package/lib/components/tooltip/src/tooltip.vue.d.ts +3 -3
  320. package/lib/components/tooltip/src/trigger.vue.d.ts +3 -3
  321. package/lib/components/tooltip-v2/index.js +2 -2
  322. package/lib/components/tooltip-v2/src/arrow.js +23 -38
  323. package/lib/components/tooltip-v2/src/arrow.js.map +1 -1
  324. package/lib/components/tooltip-v2/src/arrow2.js +38 -23
  325. package/lib/components/tooltip-v2/src/arrow2.js.map +1 -1
  326. package/lib/components/tooltip-v2/src/tooltip.js +2 -2
  327. package/lib/components/tooltip-v2/src/tooltip2.js +4 -4
  328. package/lib/components/tooltip-v2/src/trigger.js +89 -11
  329. package/lib/components/tooltip-v2/src/trigger.js.map +1 -1
  330. package/lib/components/tooltip-v2/src/trigger2.js +11 -89
  331. package/lib/components/tooltip-v2/src/trigger2.js.map +1 -1
  332. package/lib/components/upload/index.js +1 -1
  333. package/lib/components/upload/src/upload-content.js +1 -1
  334. package/lib/components/upload/src/upload-dragger.js +32 -12
  335. package/lib/components/upload/src/upload-dragger.js.map +1 -1
  336. package/lib/components/upload/src/upload-dragger2.js +12 -32
  337. package/lib/components/upload/src/upload-dragger2.js.map +1 -1
  338. package/lib/index.js +23 -23
  339. package/package.json +1 -1
  340. package/web-types.json +1 -1
@@ -1,90 +1,175 @@
1
- import { StarFilled, Star } from '@element-plus/icons-vue';
1
+ import { defineComponent, inject, ref, computed, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, Fragment, renderList, createVNode, withCtx, createBlock, resolveDynamicComponent, createCommentVNode, toDisplayString } from 'vue';
2
2
  import '../../../utils/index.mjs';
3
- import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
4
- import { mutable } from '../../../utils/typescript.mjs';
5
- import { iconPropType } from '../../../utils/vue/icon.mjs';
6
- import { isValidComponentSize } from '../../../utils/vue/validator.mjs';
3
+ import '../../../tokens/index.mjs';
4
+ import { PsIcon } from '../../icon/index.mjs';
5
+ import '../../../hooks/index.mjs';
6
+ import { rateProps } from './rate.mjs';
7
+ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
8
+ import { isObject, isArray } from '@vue/shared';
9
+ import { formContextKey } from '../../../tokens/form.mjs';
10
+ import { useSize } from '../../../hooks/use-common-props/index.mjs';
11
+ import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
12
+ import { hasClass } from '../../../utils/dom/style.mjs';
7
13
 
8
- const rateProps = buildProps({
9
- modelValue: {
10
- type: Number,
11
- default: 0
12
- },
13
- lowThreshold: {
14
- type: Number,
15
- default: 2
16
- },
17
- highThreshold: {
18
- type: Number,
19
- default: 4
20
- },
21
- max: {
22
- type: Number,
23
- default: 5
24
- },
25
- colors: {
26
- type: definePropType([Array, Object]),
27
- default: () => mutable(["", "", ""])
28
- },
29
- voidColor: {
30
- type: String,
31
- default: ""
32
- },
33
- disabledVoidColor: {
34
- type: String,
35
- default: ""
36
- },
37
- icons: {
38
- type: definePropType([Array, Object]),
39
- default: () => [StarFilled, StarFilled, StarFilled]
40
- },
41
- voidIcon: {
42
- type: iconPropType,
43
- default: () => Star
44
- },
45
- disabledVoidIcon: {
46
- type: iconPropType,
47
- default: () => StarFilled
48
- },
49
- disabled: {
50
- type: Boolean,
51
- default: false
52
- },
53
- allowHalf: {
54
- type: Boolean,
55
- default: false
56
- },
57
- showText: {
58
- type: Boolean,
59
- default: false
60
- },
61
- showScore: {
62
- type: Boolean,
63
- default: false
64
- },
65
- textColor: {
66
- type: String,
67
- default: ""
68
- },
69
- texts: {
70
- type: definePropType(Array),
71
- default: () => mutable([
72
- "Extremely bad",
73
- "Disappointed",
74
- "Fair",
75
- "Satisfied",
76
- "Surprise"
77
- ])
78
- },
79
- scoreTemplate: {
80
- type: String,
81
- default: "{value}"
82
- },
83
- size: {
84
- type: String,
85
- validator: isValidComponentSize
14
+ const _hoisted_1 = ["aria-valuenow", "aria-valuetext", "aria-valuemax"];
15
+ const __default__ = {
16
+ name: "PsRate"
17
+ };
18
+ const _sfc_main = /* @__PURE__ */ defineComponent({
19
+ ...__default__,
20
+ props: rateProps,
21
+ setup(__props, { expose }) {
22
+ const props = __props;
23
+ function getValueFromMap(value, map) {
24
+ const isExcludedObject = (val) => isObject(val);
25
+ const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
26
+ const val = map[key];
27
+ const excluded = isExcludedObject(val) ? val.excluded : false;
28
+ return excluded ? value < key : value <= key;
29
+ }).sort((a, b) => a - b);
30
+ const matchedValue = map[matchedKeys[0]];
31
+ return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
32
+ }
33
+ const formContext = inject(formContextKey, void 0);
34
+ const rateSize = useSize();
35
+ const ns = useNamespace("rate");
36
+ const currentValue = ref(props.modelValue);
37
+ const hoverIndex = ref(-1);
38
+ const pointerAtLeftHalf = ref(true);
39
+ const rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)]);
40
+ const rateDisabled = computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
41
+ const rateStyles = computed(() => {
42
+ return {
43
+ "--el-rate-void-color": props.voidColor,
44
+ "--el-rate-disabled-void-color": props.disabledVoidColor,
45
+ "--el-rate-fill-color": activeColor.value
46
+ };
47
+ });
48
+ const text = computed(() => {
49
+ let result = "";
50
+ if (props.showScore) {
51
+ result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
52
+ } else if (props.showText) {
53
+ result = props.texts[Math.ceil(currentValue.value) - 1];
54
+ }
55
+ return result;
56
+ });
57
+ const valueDecimal = computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
58
+ const colorMap = computed(() => isArray(props.colors) ? {
59
+ [props.lowThreshold]: props.colors[0],
60
+ [props.highThreshold]: { value: props.colors[1], excluded: true },
61
+ [props.max]: props.colors[2]
62
+ } : props.colors);
63
+ const activeColor = computed(() => {
64
+ const color = getValueFromMap(currentValue.value, colorMap.value);
65
+ return isObject(color) ? "" : color;
66
+ });
67
+ const decimalStyle = computed(() => {
68
+ let width = "";
69
+ if (rateDisabled.value) {
70
+ width = `${valueDecimal.value}%`;
71
+ } else if (props.allowHalf) {
72
+ width = "50%";
73
+ }
74
+ return {
75
+ color: activeColor.value,
76
+ width
77
+ };
78
+ });
79
+ const componentMap = computed(() => isArray(props.icons) ? {
80
+ [props.lowThreshold]: props.icons[0],
81
+ [props.highThreshold]: {
82
+ value: props.icons[1],
83
+ excluded: true
84
+ },
85
+ [props.max]: props.icons[2]
86
+ } : props.icons);
87
+ const decimalIconComponent = computed(() => getValueFromMap(props.modelValue, componentMap.value));
88
+ const voidComponent = computed(() => rateDisabled.value ? props.disabledVoidIcon : props.voidIcon);
89
+ const activeComponent = computed(() => getValueFromMap(currentValue.value, componentMap.value));
90
+ const iconComponents = computed(() => {
91
+ const result = Array.from({ length: props.max });
92
+ const threshold = currentValue.value;
93
+ result.fill(activeComponent.value, 0, threshold);
94
+ result.fill(voidComponent.value, threshold, props.max);
95
+ return result;
96
+ });
97
+ function showDecimalIcon(item) {
98
+ const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
99
+ const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
100
+ return showWhenDisabled || showWhenAllowHalf;
101
+ }
102
+ function setCurrentValue(value, event) {
103
+ if (rateDisabled.value) {
104
+ return;
105
+ }
106
+ if (props.allowHalf) {
107
+ let target = event.target;
108
+ if (hasClass(target, ns.e("item"))) {
109
+ target = target.querySelector(`.${ns.e("icon")}`);
110
+ }
111
+ if (target.clientWidth === 0 || hasClass(target, ns.e("decimal"))) {
112
+ target = target.parentNode;
113
+ }
114
+ pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth;
115
+ currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
116
+ } else {
117
+ currentValue.value = value;
118
+ }
119
+ hoverIndex.value = value;
120
+ }
121
+ expose({
122
+ setCurrentValue
123
+ });
124
+ return (_ctx, _cache) => {
125
+ return openBlock(), createElementBlock("div", {
126
+ class: normalizeClass([unref(rateClasses), unref(ns).is("disabled", unref(rateDisabled))]),
127
+ role: "slider",
128
+ "aria-valuenow": currentValue.value,
129
+ "aria-valuetext": unref(text),
130
+ "aria-valuemin": "0",
131
+ "aria-valuemax": _ctx.max,
132
+ tabindex: "0",
133
+ style: normalizeStyle(unref(rateStyles))
134
+ }, [
135
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.max, (item, key) => {
136
+ return openBlock(), createElementBlock("span", {
137
+ key,
138
+ class: normalizeClass(unref(ns).e("item"))
139
+ }, [
140
+ createVNode(unref(PsIcon), {
141
+ class: normalizeClass([
142
+ unref(ns).e("icon"),
143
+ { hover: hoverIndex.value === item },
144
+ unref(ns).is("active", item <= currentValue.value)
145
+ ])
146
+ }, {
147
+ default: withCtx(() => [
148
+ !showDecimalIcon(item) ? (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponents)[item - 1]), { key: 0 })) : createCommentVNode("v-if", true),
149
+ showDecimalIcon(item) ? (openBlock(), createBlock(unref(PsIcon), {
150
+ key: 1,
151
+ style: normalizeStyle(unref(decimalStyle)),
152
+ class: normalizeClass([unref(ns).e("icon"), unref(ns).e("decimal")])
153
+ }, {
154
+ default: withCtx(() => [
155
+ (openBlock(), createBlock(resolveDynamicComponent(unref(decimalIconComponent))))
156
+ ]),
157
+ _: 1
158
+ }, 8, ["style", "class"])) : createCommentVNode("v-if", true)
159
+ ]),
160
+ _: 2
161
+ }, 1032, ["class"])
162
+ ], 2);
163
+ }), 128)),
164
+ _ctx.showText || _ctx.showScore ? (openBlock(), createElementBlock("span", {
165
+ key: 0,
166
+ class: normalizeClass(unref(ns).e("text"))
167
+ }, toDisplayString(unref(text)), 3)) : createCommentVNode("v-if", true)
168
+ ], 14, _hoisted_1);
169
+ };
86
170
  }
87
171
  });
172
+ var Rate = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/rate/src/rate.vue"]]);
88
173
 
89
- export { rateProps };
174
+ export { Rate as default };
90
175
  //# sourceMappingURL=rate2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"rate2.mjs","sources":["../../../../../../packages/components/rate/src/rate.ts"],"sourcesContent":["import { Star, StarFilled } from '@element-plus/icons-vue'\nimport { UPDATE_MODEL_EVENT } from '@element-ps/constants'\nimport {\n buildProps,\n definePropType,\n iconPropType,\n isValidComponentSize,\n mutable,\n} from '@element-ps/utils'\nimport type { ComponentSize } from '@element-ps/constants'\nimport type { Component, ExtractPropTypes, PropType } from 'vue'\nimport type Rate from './rate.vue'\n\nexport const rateProps = buildProps({\n modelValue: {\n type: Number,\n default: 0,\n },\n lowThreshold: {\n type: Number,\n default: 2,\n },\n highThreshold: {\n type: Number,\n default: 4,\n },\n max: {\n type: Number,\n default: 5,\n },\n colors: {\n type: definePropType<string[] | Record<number, string>>([Array, Object]),\n default: () => mutable(['', '', ''] as const),\n },\n voidColor: {\n type: String,\n default: '',\n },\n disabledVoidColor: {\n type: String,\n default: '',\n },\n icons: {\n type: definePropType<\n Array<string | Component> | Record<number, string | Component>\n >([Array, Object]),\n default: () => [StarFilled, StarFilled, StarFilled],\n },\n voidIcon: {\n type: iconPropType,\n default: () => Star,\n },\n disabledVoidIcon: {\n type: iconPropType,\n default: () => StarFilled,\n },\n disabled: {\n type: Boolean,\n default: false,\n },\n allowHalf: {\n type: Boolean,\n default: false,\n },\n showText: {\n type: Boolean,\n default: false,\n },\n showScore: {\n type: Boolean,\n default: false,\n },\n textColor: {\n type: String,\n default: '',\n },\n texts: {\n type: definePropType<string[]>(Array),\n default: () =>\n mutable([\n 'Extremely bad',\n 'Disappointed',\n 'Fair',\n 'Satisfied',\n 'Surprise',\n ] as const),\n },\n scoreTemplate: {\n type: String,\n default: '{value}',\n },\n size: {\n type: String as PropType<ComponentSize>,\n validator: isValidComponentSize,\n },\n} as const)\n\nexport type RateProps = ExtractPropTypes<typeof rateProps>\n\nexport type RateInstance = InstanceType<typeof Rate>\n"],"names":[],"mappings":";;;;;;;AAQY,MAAC,SAAS,GAAG,UAAU,CAAC;AACpC,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO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I,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3B,MAAM,eAAe;AACrB,MAAM,cAAc;AACpB,MAAM,MAAM;AACZ,MAAM,WAAW;AACjB,MAAM,UAAU;AAChB,KAAK,CAAC;AACN,GAAG;AACH,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,SAAS;AACtB,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,SAAS,EAAE,oBAAoB;AACnC,GAAG;AACH,CAAC;;;;"}
1
+ {"version":3,"file":"rate2.mjs","sources":["../../../../../../packages/components/rate/src/rate.vue"],"sourcesContent":["<template>\n <div\n :class=\"[rateClasses, ns.is('disabled', rateDisabled)]\"\n role=\"slider\"\n :aria-valuenow=\"currentValue\"\n :aria-valuetext=\"text\"\n aria-valuemin=\"0\"\n :aria-valuemax=\"max\"\n tabindex=\"0\"\n :style=\"rateStyles\"\n >\n <span\n v-for=\"(item, key) in max\"\n :key=\"key\"\n :class=\"ns.e('item')\"\n >\n <ps-icon\n :class=\"[\n ns.e('icon'),\n { hover: hoverIndex === item },\n ns.is('active', item <= currentValue),\n ]\"\n >\n <component\n :is=\"iconComponents[item - 1]\"\n v-if=\"!showDecimalIcon(item)\"\n />\n <ps-icon\n v-if=\"showDecimalIcon(item)\"\n :style=\"decimalStyle\"\n :class=\"[ns.e('icon'), ns.e('decimal')]\"\n >\n <component :is=\"decimalIconComponent\" />\n </ps-icon>\n </ps-icon>\n </span>\n <span v-if=\"showText || showScore\" :class=\"ns.e('text')\">\n {{ text }}\n </span>\n </div>\n</template>\n<script lang=\"ts\" setup>\nimport { type CSSProperties, computed, inject, ref } from 'vue'\nimport { EVENT_CODE, UPDATE_MODEL_EVENT } from '@element-ps/constants'\nimport { hasClass, isArray, isObject } from '@element-ps/utils'\nimport { formContextKey } from '@element-ps/tokens'\nimport { PsIcon } from '@element-ps/components/icon'\nimport { useNamespace, useSize } from '@element-ps/hooks'\nimport { 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: 'PsRate',\n})\n\nconst props = defineProps(rateProps)\n\nconst formContext = inject(formContextKey, undefined)\nconst rateSize = useSize()\nconst ns = useNamespace('rate')\n\nconst currentValue = ref(props.modelValue)\nconst hoverIndex = ref(-1)\nconst pointerAtLeftHalf = ref(true)\n\nconst rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)])\nconst rateDisabled = computed(() => props.disabled || formContext?.disabled)\nconst rateStyles = computed(() => {\n return {\n '--el-rate-void-color': props.voidColor,\n '--el-rate-disabled-void-color': props.disabledVoidColor,\n '--el-rate-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 isArray(props.icons)\n ? {\n [props.lowThreshold]: props.icons[0],\n [props.highThreshold]: {\n value: props.icons[1],\n excluded: true,\n },\n [props.max]: props.icons[2],\n }\n : props.icons\n)\nconst decimalIconComponent = computed(() =>\n getValueFromMap(props.modelValue, componentMap.value)\n)\nconst voidComponent = computed(() =>\n rateDisabled.value ? props.disabledVoidIcon : props.voidIcon\n)\nconst activeComponent = computed(() =>\n getValueFromMap(currentValue.value, componentMap.value)\n)\nconst iconComponents = computed(() => {\n const result = Array.from({ length: props.max })\n const threshold = currentValue.value\n result.fill(activeComponent.value, 0, threshold)\n result.fill(voidComponent.value, threshold, props.max)\n return result\n})\n\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 setCurrentValue(value: number, event: MouseEvent) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf) {\n // TODO: use cache via computed https://github.com/element-ps/element-ps/pull/5456#discussion_r786472092\n let target = event.target as HTMLElement\n if (hasClass(target, ns.e('item'))) {\n target = target.querySelector(`.${ns.e('icon')}`)!\n }\n if (target.clientWidth === 0 || hasClass(target, ns.e('decimal'))) {\n target = target.parentNode as HTMLElement\n }\n pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth\n currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value\n } else {\n currentValue.value = value\n }\n hoverIndex.value = value\n}\n\ndefineExpose({\n /** @description set current value */\n setCurrentValue,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkDA,IAAA,SAAA,eAAA,CACA,OACA,GACA,EAAA;AACA,MAAA,MAAA,gBAAA,GAAA,CACA,GACA,KAAA,QAAA,CAAA,GAAA,CAAA,CAAA;AAEA,MAAA,MAAA,WAAA,GAAA,MAAA,CAAA,IAAA,CAAA,GAAA,CACA,CAAA,GAAA,CAAA,CAAA,GAAA,KAAA,CAAA,GAAA,CACA,CAAA,MAAA,CAAA,CAAA,GAAA,KAAA;AACA,QAAA,MAAA,MAAA,GAAA,CAAA,GAAA,CAAA,CAAA;AACA,QAAA,MAAA,QAAA,GAAA,gBAAA,CAAA,GAAA,CAAA,GAAA,IAAA,QAAA,GAAA,KAAA,CAAA;AACA,QAAA,OAAA,QAAA,GAAA,KAAA,GAAA,GAAA,GAAA,KAAA,IAAA,GAAA,CAAA;AAAA,OACA,CACA,CAAA,IAAA,CAAA,CAAA,CAAA,EAAA,CAAA,KAAA,IAAA,CAAA,CAAA,CAAA;AACA,MAAA,MAAA,YAAA,GAAA,IAAA,WAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACA,MAAA,OAAA,gBAAA,CAAA,YAAA,CAAA,IAAA,YAAA,CAAA,KAAA,IAAA,YAAA,CAAA;AAAA,KACA;AAQA,IAAA,MAAA,WAAA,GAAA,MAAA,CAAA,cAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AACA,IAAA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A;AAAA,KACA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  import '../../utils/index.mjs';
2
- import Result from './src/result.mjs';
3
- export { IconComponentMap, IconMap, resultProps } from './src/result2.mjs';
2
+ import Result from './src/result2.mjs';
3
+ export { IconComponentMap, IconMap, resultProps } from './src/result.mjs';
4
4
  import { withInstall } from '../../utils/vue/install.mjs';
5
5
 
6
6
  const PsResult = withInstall(Result);
@@ -1,78 +1,33 @@
1
- import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, createElementVNode, renderSlot, createBlock, resolveDynamicComponent, createCommentVNode, toDisplayString } from 'vue';
2
- import '../../../hooks/index.mjs';
3
- import { resultProps, IconMap, IconComponentMap } from './result2.mjs';
4
- import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
5
- import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
6
- import { useDeprecated } from '../../../hooks/use-deprecated/index.mjs';
1
+ import '../../../utils/index.mjs';
2
+ import { CircleCheckFilled, WarningFilled, CircleCloseFilled, InfoFilled } from '@element-plus/icons-vue';
3
+ import { buildProps } from '../../../utils/vue/props.mjs';
7
4
 
8
- const COMPONENT_NAME = "PsResult";
9
- const _sfc_main = defineComponent({
10
- name: COMPONENT_NAME,
11
- props: resultProps,
12
- setup(props, { slots }) {
13
- const ns = useNamespace("result");
14
- useDeprecated({
15
- scope: COMPONENT_NAME,
16
- type: "Slot",
17
- from: "subTitle",
18
- replacement: "sub-title",
19
- version: "2.1.3",
20
- ref: "https://github.com/element-ps/element-ps/pull/6636/"
21
- }, computed(() => !!slots.subTitle));
22
- const resultIcon = computed(() => {
23
- const icon = props.icon;
24
- const iconClass = icon && IconMap[icon] ? IconMap[icon] : "icon-info";
25
- const iconComponent = IconComponentMap[iconClass] || IconComponentMap["icon-info"];
26
- return {
27
- class: iconClass,
28
- component: iconComponent
29
- };
30
- });
31
- return {
32
- ns,
33
- resultIcon
34
- };
5
+ const IconMap = {
6
+ success: "icon-success",
7
+ warning: "icon-warning",
8
+ error: "icon-error",
9
+ info: "icon-info"
10
+ };
11
+ const IconComponentMap = {
12
+ [IconMap.success]: CircleCheckFilled,
13
+ [IconMap.warning]: WarningFilled,
14
+ [IconMap.error]: CircleCloseFilled,
15
+ [IconMap.info]: InfoFilled
16
+ };
17
+ const resultProps = buildProps({
18
+ title: {
19
+ type: String,
20
+ default: ""
21
+ },
22
+ subTitle: {
23
+ type: String,
24
+ default: ""
25
+ },
26
+ icon: {
27
+ values: ["success", "warning", "info", "error"],
28
+ default: "info"
35
29
  }
36
30
  });
37
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
38
- return openBlock(), createElementBlock("div", {
39
- class: normalizeClass(_ctx.ns.b())
40
- }, [
41
- createElementVNode("div", {
42
- class: normalizeClass(_ctx.ns.e("icon"))
43
- }, [
44
- renderSlot(_ctx.$slots, "icon", {}, () => [
45
- _ctx.resultIcon.component ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.resultIcon.component), {
46
- key: 0,
47
- class: normalizeClass(_ctx.resultIcon.class)
48
- }, null, 8, ["class"])) : createCommentVNode("v-if", true)
49
- ])
50
- ], 2),
51
- _ctx.title || _ctx.$slots.title ? (openBlock(), createElementBlock("div", {
52
- key: 0,
53
- class: normalizeClass(_ctx.ns.e("title"))
54
- }, [
55
- renderSlot(_ctx.$slots, "title", {}, () => [
56
- createElementVNode("p", null, toDisplayString(_ctx.title), 1)
57
- ])
58
- ], 2)) : createCommentVNode("v-if", true),
59
- _ctx.subTitle || _ctx.$slots["sub-title"] ? (openBlock(), createElementBlock("div", {
60
- key: 1,
61
- class: normalizeClass(_ctx.ns.e("subtitle"))
62
- }, [
63
- renderSlot(_ctx.$slots, "sub-title", {}, () => [
64
- createElementVNode("p", null, toDisplayString(_ctx.subTitle), 1)
65
- ])
66
- ], 2)) : createCommentVNode("v-if", true),
67
- _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
68
- key: 2,
69
- class: normalizeClass(_ctx.ns.e("extra"))
70
- }, [
71
- renderSlot(_ctx.$slots, "extra")
72
- ], 2)) : createCommentVNode("v-if", true)
73
- ], 2);
74
- }
75
- var Result = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/meng/workspace/element-ps/packages/components/result/src/result.vue"]]);
76
31
 
77
- export { Result as default };
32
+ export { IconComponentMap, IconMap, resultProps };
78
33
  //# sourceMappingURL=result.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"result.mjs","sources":["../../../../../../packages/components/result/src/result.vue"],"sourcesContent":["<template>\n <div :class=\"ns.b()\">\n <div :class=\"ns.e('icon')\">\n <slot name=\"icon\">\n <component\n :is=\"resultIcon.component\"\n v-if=\"resultIcon.component\"\n :class=\"resultIcon.class\"\n />\n </slot>\n </div>\n <div v-if=\"title || $slots.title\" :class=\"ns.e('title')\">\n <slot name=\"title\">\n <p>{{ title }}</p>\n </slot>\n </div>\n <div v-if=\"subTitle || $slots['sub-title']\" :class=\"ns.e('subtitle')\">\n <slot name=\"sub-title\">\n <p>{{ subTitle }}</p>\n </slot>\n </div>\n <div v-if=\"$slots.extra\" :class=\"ns.e('extra')\">\n <slot name=\"extra\" />\n </div>\n </div>\n</template>\n<script lang=\"ts\">\nimport { computed, defineComponent } from 'vue'\nimport { useDeprecated, useNamespace } from '@element-ps/hooks'\nimport { IconComponentMap, IconMap, resultProps } from './result'\nconst COMPONENT_NAME = 'PsResult'\nexport default defineComponent({\n name: COMPONENT_NAME,\n props: resultProps,\n setup(props, { slots }) {\n const ns = useNamespace('result')\n\n useDeprecated(\n {\n scope: COMPONENT_NAME,\n type: 'Slot',\n from: 'subTitle',\n replacement: 'sub-title',\n version: '2.1.3',\n ref: 'https://github.com/element-ps/element-ps/pull/6636/',\n },\n computed(() => !!slots.subTitle)\n )\n\n const resultIcon = computed(() => {\n const icon = props.icon\n const iconClass = icon && IconMap[icon] ? IconMap[icon] : 'icon-info'\n const iconComponent =\n IconComponentMap[iconClass] || IconComponentMap['icon-info']\n\n return {\n class: iconClass,\n component: iconComponent,\n }\n })\n\n return {\n ns,\n resultIcon,\n }\n },\n})\n</script>\n"],"names":["_createElementBlock","_normalizeClass","_createElementVNode","_renderSlot","_openBlock","_createBlock","_resolveDynamicComponent","_createCommentVNode"],"mappings":";;;;;;;AA8BA,MAAM,cAAiB,GAAA,UAAA,CAAA;AACvB,MAAK,YAAa,eAAa,CAAA;AAAA,EAC7B,IAAM,EAAA,cAAA;AAAA,EACN,KAAO,EAAA,WAAA;AAAA,EACP,KAAA,CAAM,KAAO,EAAA,EAAE,KAAS,EAAA,EAAA;AACtB,IAAM,MAAA,EAAA,GAAK,aAAa,QAAQ,CAAA,CAAA;AAEhC,IACE,aAAA,CAAA;AAAA,MACE,KAAO,EAAA,cAAA;AAAA,MACP,IAAM,EAAA,MAAA;AAAA,MACN,IAAM,EAAA,UAAA;AAAA,MACN,WAAa,EAAA,WAAA;AAAA,MACb,OAAS,EAAA,OAAA;AAAA,MACT,GAAK,EAAA,qDAAA;AAAA,OAEP,QAAS,CAAA,MAAM,CAAC,CAAC,KAAA,CAAM,QAAQ,CACjC,CAAA,CAAA;AAEA,IAAM,MAAA,UAAA,GAAa,SAAS,MAAM;AAChC,MAAA,MAAM,OAAO,KAAM,CAAA,IAAA,CAAA;AACnB,MAAA,MAAM,SAAY,GAAA,IAAA,IAAQ,OAAQ,CAAA,IAAA,CAAA,GAAQ,QAAQ,IAAQ,CAAA,GAAA,WAAA,CAAA;AAC1D,MAAM,MAAA,aAAA,GACJ,gBAAiB,CAAA,SAAA,CAAA,IAAc,gBAAiB,CAAA,WAAA,CAAA,CAAA;AAElD,MAAO,OAAA;AAAA,QACL,KAAO,EAAA,SAAA;AAAA,QACP,SAAW,EAAA,aAAA;AAAA,OACb,CAAA;AAAA,KACD,CAAA,CAAA;AAED,IAAO,OAAA;AAAA,MACL,EAAA;AAAA,MACA,UAAA;AAAA,KACF,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A,CAEO,8BAFP,MAEO;AAAA,QADLD,kBAAA,CAAqB,2BAAf,IAAQ,CAAA,QAAA,CAAA,EAAA,CAAA,CAAA;AAAA,OAAA,CAAA;;AAGP,IAAA,IAAA,CAAA,MAAA,CAAO,sBAAlBF,kBAEM,CAAA,KAAA,EAAA;AAAA,MAAA,GAAA,EAAA,CAAA;MAFoB,KAAK,EAAAC,cAAA,CAAE,QAAG,CAAC,CAAA,OAAA,CAAA,CAAA;AAAA,KAAA,EAAA;MACnCE,UAAqB,CAAA,IAAA,CAAA,MAAA,EAAA,OAAA,CAAA;AAAA,KAAA,EAAA,CAAA,CAAA,IAAAI,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA;;;;;;;"}
1
+ {"version":3,"file":"result.mjs","sources":["../../../../../../packages/components/result/src/result.ts"],"sourcesContent":["import { buildProps } from '@element-ps/utils'\nimport {\n CircleCheckFilled,\n CircleCloseFilled,\n InfoFilled,\n WarningFilled,\n} from '@element-plus/icons-vue'\nimport type { Component, ExtractPropTypes } from 'vue'\nimport type Result from './result.vue'\n\nexport const IconMap = {\n success: 'icon-success',\n warning: 'icon-warning',\n error: 'icon-error',\n info: 'icon-info',\n} as const\n\nexport const IconComponentMap: Record<\n typeof IconMap[keyof typeof IconMap],\n Component\n> = {\n [IconMap.success]: CircleCheckFilled,\n [IconMap.warning]: WarningFilled,\n [IconMap.error]: CircleCloseFilled,\n [IconMap.info]: InfoFilled,\n}\n\nexport const resultProps = buildProps({\n title: {\n type: String,\n default: '',\n },\n subTitle: {\n type: String,\n default: '',\n },\n icon: {\n values: ['success', 'warning', 'info', 'error'],\n default: 'info',\n },\n} as const)\n\nexport type ResultProps = ExtractPropTypes<typeof resultProps>\n\nexport type ResultInstance = InstanceType<typeof Result>\n"],"names":[],"mappings":";;;;AAOY,MAAC,OAAO,GAAG;AACvB,EAAE,OAAO,EAAE,cAAc;AACzB,EAAE,OAAO,EAAE,cAAc;AACzB,EAAE,KAAK,EAAE,YAAY;AACrB,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE;AACU,MAAC,gBAAgB,GAAG;AAChC,EAAE,CAAC,OAAO,CAAC,OAAO,GAAG,iBAAiB;AACtC,EAAE,CAAC,OAAO,CAAC,OAAO,GAAG,aAAa;AAClC,EAAE,CAAC,OAAO,CAAC,KAAK,GAAG,iBAAiB;AACpC,EAAE,CAAC,OAAO,CAAC,IAAI,GAAG,UAAU;AAC5B,EAAE;AACU,MAAC,WAAW,GAAG,UAAU,CAAC;AACtC,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC;AACnD,IAAI,OAAO,EAAE,MAAM;AACnB,GAAG;AACH,CAAC;;;;"}
@@ -1,33 +1,78 @@
1
- import '../../../utils/index.mjs';
2
- import { CircleCheckFilled, WarningFilled, CircleCloseFilled, InfoFilled } from '@element-plus/icons-vue';
3
- import { buildProps } from '../../../utils/vue/props.mjs';
1
+ import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, createElementVNode, renderSlot, createBlock, resolveDynamicComponent, createCommentVNode, toDisplayString } from 'vue';
2
+ import '../../../hooks/index.mjs';
3
+ import { resultProps, IconMap, IconComponentMap } from './result.mjs';
4
+ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
5
+ import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
6
+ import { useDeprecated } from '../../../hooks/use-deprecated/index.mjs';
4
7
 
5
- const IconMap = {
6
- success: "icon-success",
7
- warning: "icon-warning",
8
- error: "icon-error",
9
- info: "icon-info"
10
- };
11
- const IconComponentMap = {
12
- [IconMap.success]: CircleCheckFilled,
13
- [IconMap.warning]: WarningFilled,
14
- [IconMap.error]: CircleCloseFilled,
15
- [IconMap.info]: InfoFilled
16
- };
17
- const resultProps = buildProps({
18
- title: {
19
- type: String,
20
- default: ""
21
- },
22
- subTitle: {
23
- type: String,
24
- default: ""
25
- },
26
- icon: {
27
- values: ["success", "warning", "info", "error"],
28
- default: "info"
8
+ const COMPONENT_NAME = "PsResult";
9
+ const _sfc_main = defineComponent({
10
+ name: COMPONENT_NAME,
11
+ props: resultProps,
12
+ setup(props, { slots }) {
13
+ const ns = useNamespace("result");
14
+ useDeprecated({
15
+ scope: COMPONENT_NAME,
16
+ type: "Slot",
17
+ from: "subTitle",
18
+ replacement: "sub-title",
19
+ version: "2.1.3",
20
+ ref: "https://github.com/element-ps/element-ps/pull/6636/"
21
+ }, computed(() => !!slots.subTitle));
22
+ const resultIcon = computed(() => {
23
+ const icon = props.icon;
24
+ const iconClass = icon && IconMap[icon] ? IconMap[icon] : "icon-info";
25
+ const iconComponent = IconComponentMap[iconClass] || IconComponentMap["icon-info"];
26
+ return {
27
+ class: iconClass,
28
+ component: iconComponent
29
+ };
30
+ });
31
+ return {
32
+ ns,
33
+ resultIcon
34
+ };
29
35
  }
30
36
  });
37
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
38
+ return openBlock(), createElementBlock("div", {
39
+ class: normalizeClass(_ctx.ns.b())
40
+ }, [
41
+ createElementVNode("div", {
42
+ class: normalizeClass(_ctx.ns.e("icon"))
43
+ }, [
44
+ renderSlot(_ctx.$slots, "icon", {}, () => [
45
+ _ctx.resultIcon.component ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.resultIcon.component), {
46
+ key: 0,
47
+ class: normalizeClass(_ctx.resultIcon.class)
48
+ }, null, 8, ["class"])) : createCommentVNode("v-if", true)
49
+ ])
50
+ ], 2),
51
+ _ctx.title || _ctx.$slots.title ? (openBlock(), createElementBlock("div", {
52
+ key: 0,
53
+ class: normalizeClass(_ctx.ns.e("title"))
54
+ }, [
55
+ renderSlot(_ctx.$slots, "title", {}, () => [
56
+ createElementVNode("p", null, toDisplayString(_ctx.title), 1)
57
+ ])
58
+ ], 2)) : createCommentVNode("v-if", true),
59
+ _ctx.subTitle || _ctx.$slots["sub-title"] ? (openBlock(), createElementBlock("div", {
60
+ key: 1,
61
+ class: normalizeClass(_ctx.ns.e("subtitle"))
62
+ }, [
63
+ renderSlot(_ctx.$slots, "sub-title", {}, () => [
64
+ createElementVNode("p", null, toDisplayString(_ctx.subTitle), 1)
65
+ ])
66
+ ], 2)) : createCommentVNode("v-if", true),
67
+ _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
68
+ key: 2,
69
+ class: normalizeClass(_ctx.ns.e("extra"))
70
+ }, [
71
+ renderSlot(_ctx.$slots, "extra")
72
+ ], 2)) : createCommentVNode("v-if", true)
73
+ ], 2);
74
+ }
75
+ var Result = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/meng/workspace/element-ps/packages/components/result/src/result.vue"]]);
31
76
 
32
- export { IconComponentMap, IconMap, resultProps };
77
+ export { Result as default };
33
78
  //# sourceMappingURL=result2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"result2.mjs","sources":["../../../../../../packages/components/result/src/result.ts"],"sourcesContent":["import { buildProps } from '@element-ps/utils'\nimport {\n CircleCheckFilled,\n CircleCloseFilled,\n InfoFilled,\n WarningFilled,\n} from '@element-plus/icons-vue'\nimport type { Component, ExtractPropTypes } from 'vue'\nimport type Result from './result.vue'\n\nexport const IconMap = {\n success: 'icon-success',\n warning: 'icon-warning',\n error: 'icon-error',\n info: 'icon-info',\n} as const\n\nexport const IconComponentMap: Record<\n typeof IconMap[keyof typeof IconMap],\n Component\n> = {\n [IconMap.success]: CircleCheckFilled,\n [IconMap.warning]: WarningFilled,\n [IconMap.error]: CircleCloseFilled,\n [IconMap.info]: InfoFilled,\n}\n\nexport const resultProps = buildProps({\n title: {\n type: String,\n default: '',\n },\n subTitle: {\n type: String,\n default: '',\n },\n icon: {\n values: ['success', 'warning', 'info', 'error'],\n default: 'info',\n },\n} as const)\n\nexport type ResultProps = ExtractPropTypes<typeof resultProps>\n\nexport type ResultInstance = InstanceType<typeof Result>\n"],"names":[],"mappings":";;;;AAOY,MAAC,OAAO,GAAG;AACvB,EAAE,OAAO,EAAE,cAAc;AACzB,EAAE,OAAO,EAAE,cAAc;AACzB,EAAE,KAAK,EAAE,YAAY;AACrB,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE;AACU,MAAC,gBAAgB,GAAG;AAChC,EAAE,CAAC,OAAO,CAAC,OAAO,GAAG,iBAAiB;AACtC,EAAE,CAAC,OAAO,CAAC,OAAO,GAAG,aAAa;AAClC,EAAE,CAAC,OAAO,CAAC,KAAK,GAAG,iBAAiB;AACpC,EAAE,CAAC,OAAO,CAAC,IAAI,GAAG,UAAU;AAC5B,EAAE;AACU,MAAC,WAAW,GAAG,UAAU,CAAC;AACtC,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC;AACnD,IAAI,OAAO,EAAE,MAAM;AACnB,GAAG;AACH,CAAC;;;;"}
1
+ {"version":3,"file":"result2.mjs","sources":["../../../../../../packages/components/result/src/result.vue"],"sourcesContent":["<template>\n <div :class=\"ns.b()\">\n <div :class=\"ns.e('icon')\">\n <slot name=\"icon\">\n <component\n :is=\"resultIcon.component\"\n v-if=\"resultIcon.component\"\n :class=\"resultIcon.class\"\n />\n </slot>\n </div>\n <div v-if=\"title || $slots.title\" :class=\"ns.e('title')\">\n <slot name=\"title\">\n <p>{{ title }}</p>\n </slot>\n </div>\n <div v-if=\"subTitle || $slots['sub-title']\" :class=\"ns.e('subtitle')\">\n <slot name=\"sub-title\">\n <p>{{ subTitle }}</p>\n </slot>\n </div>\n <div v-if=\"$slots.extra\" :class=\"ns.e('extra')\">\n <slot name=\"extra\" />\n </div>\n </div>\n</template>\n<script lang=\"ts\">\nimport { computed, defineComponent } from 'vue'\nimport { useDeprecated, useNamespace } from '@element-ps/hooks'\nimport { IconComponentMap, IconMap, resultProps } from './result'\nconst COMPONENT_NAME = 'PsResult'\nexport default defineComponent({\n name: COMPONENT_NAME,\n props: resultProps,\n setup(props, { slots }) {\n const ns = useNamespace('result')\n\n useDeprecated(\n {\n scope: COMPONENT_NAME,\n type: 'Slot',\n from: 'subTitle',\n replacement: 'sub-title',\n version: '2.1.3',\n ref: 'https://github.com/element-ps/element-ps/pull/6636/',\n },\n computed(() => !!slots.subTitle)\n )\n\n const resultIcon = computed(() => {\n const icon = props.icon\n const iconClass = icon && IconMap[icon] ? IconMap[icon] : 'icon-info'\n const iconComponent =\n IconComponentMap[iconClass] || IconComponentMap['icon-info']\n\n return {\n class: iconClass,\n component: iconComponent,\n }\n })\n\n return {\n ns,\n resultIcon,\n }\n },\n})\n</script>\n"],"names":["_createElementBlock","_normalizeClass","_createElementVNode","_renderSlot","_openBlock","_createBlock","_resolveDynamicComponent","_createCommentVNode"],"mappings":";;;;;;;AA8BA,MAAM,cAAiB,GAAA,UAAA,CAAA;AACvB,MAAK,YAAa,eAAa,CAAA;AAAA,EAC7B,IAAM,EAAA,cAAA;AAAA,EACN,KAAO,EAAA,WAAA;AAAA,EACP,KAAA,CAAM,KAAO,EAAA,EAAE,KAAS,EAAA,EAAA;AACtB,IAAM,MAAA,EAAA,GAAK,aAAa,QAAQ,CAAA,CAAA;AAEhC,IACE,aAAA,CAAA;AAAA,MACE,KAAO,EAAA,cAAA;AAAA,MACP,IAAM,EAAA,MAAA;AAAA,MACN,IAAM,EAAA,UAAA;AAAA,MACN,WAAa,EAAA,WAAA;AAAA,MACb,OAAS,EAAA,OAAA;A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