element-ps 2.0.36 → 2.0.37

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 (326) hide show
  1. package/dist/index.full.js +3 -1
  2. package/dist/index.full.min.js +1 -1
  3. package/dist/index.full.min.js.map +1 -1
  4. package/dist/index.full.min.mjs +1 -1
  5. package/dist/index.full.min.mjs.map +1 -1
  6. package/dist/index.full.mjs +3 -1
  7. package/es/components/alert/index.mjs +2 -2
  8. package/es/components/alert/src/alert.mjs +83 -33
  9. package/es/components/alert/src/alert.mjs.map +1 -1
  10. package/es/components/alert/src/alert2.mjs +33 -83
  11. package/es/components/alert/src/alert2.mjs.map +1 -1
  12. package/es/components/autocomplete/index.mjs +2 -2
  13. package/es/components/autocomplete/src/autocomplete.mjs +58 -94
  14. package/es/components/autocomplete/src/autocomplete.mjs.map +1 -1
  15. package/es/components/autocomplete/src/autocomplete2.mjs +94 -58
  16. package/es/components/autocomplete/src/autocomplete2.mjs.map +1 -1
  17. package/es/components/avatar/index.mjs +2 -2
  18. package/es/components/avatar/src/avatar.mjs +29 -61
  19. package/es/components/avatar/src/avatar.mjs.map +1 -1
  20. package/es/components/avatar/src/avatar2.mjs +61 -29
  21. package/es/components/avatar/src/avatar2.mjs.map +1 -1
  22. package/es/components/badge/index.mjs +2 -2
  23. package/es/components/badge/src/badge.mjs +17 -54
  24. package/es/components/badge/src/badge.mjs.map +1 -1
  25. package/es/components/badge/src/badge2.mjs +54 -17
  26. package/es/components/badge/src/badge2.mjs.map +1 -1
  27. package/es/components/button/index.mjs +2 -2
  28. package/es/components/button/src/button-group.mjs +1 -1
  29. package/es/components/button/src/button.mjs +96 -48
  30. package/es/components/button/src/button.mjs.map +1 -1
  31. package/es/components/button/src/button2.mjs +48 -96
  32. package/es/components/button/src/button2.mjs.map +1 -1
  33. package/es/components/calendar/index.mjs +2 -2
  34. package/es/components/calendar/src/calendar.mjs +188 -9
  35. package/es/components/calendar/src/calendar.mjs.map +1 -1
  36. package/es/components/calendar/src/calendar2.mjs +9 -188
  37. package/es/components/calendar/src/calendar2.mjs.map +1 -1
  38. package/es/components/card/index.mjs +2 -2
  39. package/es/components/card/src/card.mjs +35 -15
  40. package/es/components/card/src/card.mjs.map +1 -1
  41. package/es/components/card/src/card2.mjs +15 -35
  42. package/es/components/card/src/card2.mjs.map +1 -1
  43. package/es/components/carousel/index.mjs +2 -2
  44. package/es/components/carousel/src/carousel.mjs +43 -201
  45. package/es/components/carousel/src/carousel.mjs.map +1 -1
  46. package/es/components/carousel/src/carousel2.mjs +201 -43
  47. package/es/components/carousel/src/carousel2.mjs.map +1 -1
  48. package/es/components/collection/index.mjs +1 -1
  49. package/es/components/collection/src/collection.mjs +30 -10
  50. package/es/components/collection/src/collection.mjs.map +1 -1
  51. package/es/components/collection/src/collection2.mjs +10 -30
  52. package/es/components/collection/src/collection2.mjs.map +1 -1
  53. package/es/components/dialog/src/dialog-content.mjs +34 -79
  54. package/es/components/dialog/src/dialog-content.mjs.map +1 -1
  55. package/es/components/dialog/src/dialog-content2.mjs +79 -34
  56. package/es/components/dialog/src/dialog-content2.mjs.map +1 -1
  57. package/es/components/dialog/src/dialog.mjs +1 -1
  58. package/es/components/dialog/src/dialog2.mjs +1 -1
  59. package/es/components/divider/index.mjs +2 -2
  60. package/es/components/divider/src/divider.mjs +34 -17
  61. package/es/components/divider/src/divider.mjs.map +1 -1
  62. package/es/components/divider/src/divider2.mjs +17 -34
  63. package/es/components/divider/src/divider2.mjs.map +1 -1
  64. package/es/components/drawer/index.mjs +2 -2
  65. package/es/components/drawer/src/drawer.mjs +117 -23
  66. package/es/components/drawer/src/drawer.mjs.map +1 -1
  67. package/es/components/drawer/src/drawer2.mjs +23 -117
  68. package/es/components/drawer/src/drawer2.mjs.map +1 -1
  69. package/es/components/dropdown/index.mjs +2 -2
  70. package/es/components/dropdown/src/dropdown-item-impl.mjs +1 -1
  71. package/es/components/dropdown/src/dropdown-item.mjs +1 -1
  72. package/es/components/dropdown/src/dropdown-menu.mjs +1 -1
  73. package/es/components/dropdown/src/dropdown.mjs +100 -109
  74. package/es/components/dropdown/src/dropdown.mjs.map +1 -1
  75. package/es/components/dropdown/src/dropdown2.mjs +109 -100
  76. package/es/components/dropdown/src/dropdown2.mjs.map +1 -1
  77. package/es/components/empty/index.mjs +2 -2
  78. package/es/components/empty/src/empty.mjs +11 -56
  79. package/es/components/empty/src/empty.mjs.map +1 -1
  80. package/es/components/empty/src/empty2.mjs +56 -11
  81. package/es/components/empty/src/empty2.mjs.map +1 -1
  82. package/es/components/form/index.mjs +4 -4
  83. package/es/components/form/src/form-item.mjs +171 -46
  84. package/es/components/form/src/form-item.mjs.map +1 -1
  85. package/es/components/form/src/form-item2.mjs +46 -171
  86. package/es/components/form/src/form-item2.mjs.map +1 -1
  87. package/es/components/form/src/form.mjs +45 -40
  88. package/es/components/form/src/form.mjs.map +1 -1
  89. package/es/components/form/src/form2.mjs +40 -45
  90. package/es/components/form/src/form2.mjs.map +1 -1
  91. package/es/components/icon/index.mjs +2 -2
  92. package/es/components/icon/src/icon.mjs +35 -8
  93. package/es/components/icon/src/icon.mjs.map +1 -1
  94. package/es/components/icon/src/icon2.mjs +8 -35
  95. package/es/components/icon/src/icon2.mjs.map +1 -1
  96. package/es/components/image/index.mjs +2 -2
  97. package/es/components/image/src/image.mjs +50 -127
  98. package/es/components/image/src/image.mjs.map +1 -1
  99. package/es/components/image/src/image2.mjs +127 -50
  100. package/es/components/image/src/image2.mjs.map +1 -1
  101. package/es/components/image-viewer/index.mjs +2 -2
  102. package/es/components/image-viewer/src/image-viewer.mjs +31 -210
  103. package/es/components/image-viewer/src/image-viewer.mjs.map +1 -1
  104. package/es/components/image-viewer/src/image-viewer2.mjs +210 -31
  105. package/es/components/image-viewer/src/image-viewer2.mjs.map +1 -1
  106. package/es/components/index.mjs +27 -27
  107. package/es/components/menu/index.mjs +2 -2
  108. package/es/components/menu/src/menu-item-group.mjs +35 -4
  109. package/es/components/menu/src/menu-item-group.mjs.map +1 -1
  110. package/es/components/menu/src/menu-item-group2.mjs +4 -35
  111. package/es/components/menu/src/menu-item-group2.mjs.map +1 -1
  112. package/es/components/page-header/index.mjs +2 -2
  113. package/es/components/page-header/src/page-header.mjs +14 -55
  114. package/es/components/page-header/src/page-header.mjs.map +1 -1
  115. package/es/components/page-header/src/page-header2.mjs +55 -14
  116. package/es/components/page-header/src/page-header2.mjs.map +1 -1
  117. package/es/components/popconfirm/src/popconfirm.mjs +1 -1
  118. package/es/components/popconfirm/src/popconfirm2.mjs +4 -2
  119. package/es/components/popconfirm/src/popconfirm2.mjs.map +1 -1
  120. package/es/components/popover/src/popover.mjs +1 -1
  121. package/es/components/popper/index.mjs +4 -4
  122. package/es/components/popper/src/arrow.mjs +31 -7
  123. package/es/components/popper/src/arrow.mjs.map +1 -1
  124. package/es/components/popper/src/arrow2.mjs +7 -31
  125. package/es/components/popper/src/arrow2.mjs.map +1 -1
  126. package/es/components/popper/src/content.mjs +64 -52
  127. package/es/components/popper/src/content.mjs.map +1 -1
  128. package/es/components/popper/src/content2.mjs +52 -64
  129. package/es/components/popper/src/content2.mjs.map +1 -1
  130. package/es/components/rate/index.mjs +2 -2
  131. package/es/components/rate/src/rate.mjs +84 -169
  132. package/es/components/rate/src/rate.mjs.map +1 -1
  133. package/es/components/rate/src/rate2.mjs +169 -84
  134. package/es/components/rate/src/rate2.mjs.map +1 -1
  135. package/es/components/roving-focus-group/src/roving-focus-group.mjs +1 -1
  136. package/es/components/tabs/index.mjs +1 -1
  137. package/es/components/tabs/src/tab-bar.mjs +76 -7
  138. package/es/components/tabs/src/tab-bar.mjs.map +1 -1
  139. package/es/components/tabs/src/tab-bar2.mjs +7 -76
  140. package/es/components/tabs/src/tab-bar2.mjs.map +1 -1
  141. package/es/components/tabs/src/tab-nav.mjs +1 -1
  142. package/es/components/tooltip/src/tooltip.mjs +1 -1
  143. package/es/components/tooltip/src/tooltip2.mjs +1 -1
  144. package/es/components/tooltip-v2/index.mjs +2 -2
  145. package/es/components/tooltip-v2/src/arrow.mjs +22 -38
  146. package/es/components/tooltip-v2/src/arrow.mjs.map +1 -1
  147. package/es/components/tooltip-v2/src/arrow2.mjs +38 -22
  148. package/es/components/tooltip-v2/src/arrow2.mjs.map +1 -1
  149. package/es/components/tooltip-v2/src/tooltip.mjs +2 -2
  150. package/es/components/tooltip-v2/src/tooltip2.mjs +4 -4
  151. package/es/components/tooltip-v2/src/trigger.mjs +11 -89
  152. package/es/components/tooltip-v2/src/trigger.mjs.map +1 -1
  153. package/es/components/tooltip-v2/src/trigger2.mjs +89 -11
  154. package/es/components/tooltip-v2/src/trigger2.mjs.map +1 -1
  155. package/es/components/upload/index.mjs +2 -2
  156. package/es/components/upload/src/upload-content.mjs +46 -15
  157. package/es/components/upload/src/upload-content.mjs.map +1 -1
  158. package/es/components/upload/src/upload-content2.mjs +15 -46
  159. package/es/components/upload/src/upload-content2.mjs.map +1 -1
  160. package/es/components/upload/src/upload-dragger.mjs +32 -11
  161. package/es/components/upload/src/upload-dragger.mjs.map +1 -1
  162. package/es/components/upload/src/upload-dragger2.mjs +11 -32
  163. package/es/components/upload/src/upload-dragger2.mjs.map +1 -1
  164. package/es/components/upload/src/upload2.mjs +1 -1
  165. package/es/index.mjs +27 -27
  166. package/lib/components/alert/index.js +2 -2
  167. package/lib/components/alert/src/alert.js +82 -33
  168. package/lib/components/alert/src/alert.js.map +1 -1
  169. package/lib/components/alert/src/alert2.js +33 -82
  170. package/lib/components/alert/src/alert2.js.map +1 -1
  171. package/lib/components/autocomplete/index.js +2 -2
  172. package/lib/components/autocomplete/src/autocomplete.js +58 -94
  173. package/lib/components/autocomplete/src/autocomplete.js.map +1 -1
  174. package/lib/components/autocomplete/src/autocomplete2.js +94 -58
  175. package/lib/components/autocomplete/src/autocomplete2.js.map +1 -1
  176. package/lib/components/avatar/index.js +2 -2
  177. package/lib/components/avatar/src/avatar.js +29 -61
  178. package/lib/components/avatar/src/avatar.js.map +1 -1
  179. package/lib/components/avatar/src/avatar2.js +61 -29
  180. package/lib/components/avatar/src/avatar2.js.map +1 -1
  181. package/lib/components/badge/index.js +2 -2
  182. package/lib/components/badge/src/badge.js +17 -54
  183. package/lib/components/badge/src/badge.js.map +1 -1
  184. package/lib/components/badge/src/badge2.js +54 -17
  185. package/lib/components/badge/src/badge2.js.map +1 -1
  186. package/lib/components/button/index.js +2 -2
  187. package/lib/components/button/src/button-group.js +1 -1
  188. package/lib/components/button/src/button.js +96 -50
  189. package/lib/components/button/src/button.js.map +1 -1
  190. package/lib/components/button/src/button2.js +50 -96
  191. package/lib/components/button/src/button2.js.map +1 -1
  192. package/lib/components/calendar/index.js +2 -2
  193. package/lib/components/calendar/src/calendar.js +192 -9
  194. package/lib/components/calendar/src/calendar.js.map +1 -1
  195. package/lib/components/calendar/src/calendar2.js +9 -192
  196. package/lib/components/calendar/src/calendar2.js.map +1 -1
  197. package/lib/components/card/index.js +2 -2
  198. package/lib/components/card/src/card.js +35 -15
  199. package/lib/components/card/src/card.js.map +1 -1
  200. package/lib/components/card/src/card2.js +15 -35
  201. package/lib/components/card/src/card2.js.map +1 -1
  202. package/lib/components/carousel/index.js +2 -2
  203. package/lib/components/carousel/src/carousel.js +43 -201
  204. package/lib/components/carousel/src/carousel.js.map +1 -1
  205. package/lib/components/carousel/src/carousel2.js +201 -43
  206. package/lib/components/carousel/src/carousel2.js.map +1 -1
  207. package/lib/components/collection/index.js +1 -1
  208. package/lib/components/collection/src/collection.js +30 -9
  209. package/lib/components/collection/src/collection.js.map +1 -1
  210. package/lib/components/collection/src/collection2.js +9 -30
  211. package/lib/components/collection/src/collection2.js.map +1 -1
  212. package/lib/components/dialog/src/dialog-content.js +33 -78
  213. package/lib/components/dialog/src/dialog-content.js.map +1 -1
  214. package/lib/components/dialog/src/dialog-content2.js +78 -33
  215. package/lib/components/dialog/src/dialog-content2.js.map +1 -1
  216. package/lib/components/dialog/src/dialog.js +1 -1
  217. package/lib/components/dialog/src/dialog2.js +1 -1
  218. package/lib/components/divider/index.js +2 -2
  219. package/lib/components/divider/src/divider.js +34 -17
  220. package/lib/components/divider/src/divider.js.map +1 -1
  221. package/lib/components/divider/src/divider2.js +17 -34
  222. package/lib/components/divider/src/divider2.js.map +1 -1
  223. package/lib/components/drawer/index.js +2 -2
  224. package/lib/components/drawer/src/drawer.js +117 -23
  225. package/lib/components/drawer/src/drawer.js.map +1 -1
  226. package/lib/components/drawer/src/drawer2.js +23 -117
  227. package/lib/components/drawer/src/drawer2.js.map +1 -1
  228. package/lib/components/dropdown/index.js +2 -2
  229. package/lib/components/dropdown/src/dropdown-item-impl.js +1 -1
  230. package/lib/components/dropdown/src/dropdown-item.js +1 -1
  231. package/lib/components/dropdown/src/dropdown-menu.js +1 -1
  232. package/lib/components/dropdown/src/dropdown.js +109 -109
  233. package/lib/components/dropdown/src/dropdown.js.map +1 -1
  234. package/lib/components/dropdown/src/dropdown2.js +109 -109
  235. package/lib/components/dropdown/src/dropdown2.js.map +1 -1
  236. package/lib/components/empty/index.js +2 -2
  237. package/lib/components/empty/src/empty.js +11 -56
  238. package/lib/components/empty/src/empty.js.map +1 -1
  239. package/lib/components/empty/src/empty2.js +56 -11
  240. package/lib/components/empty/src/empty2.js.map +1 -1
  241. package/lib/components/form/index.js +4 -4
  242. package/lib/components/form/src/form-item.js +171 -47
  243. package/lib/components/form/src/form-item.js.map +1 -1
  244. package/lib/components/form/src/form-item2.js +47 -171
  245. package/lib/components/form/src/form-item2.js.map +1 -1
  246. package/lib/components/form/src/form.js +45 -40
  247. package/lib/components/form/src/form.js.map +1 -1
  248. package/lib/components/form/src/form2.js +40 -45
  249. package/lib/components/form/src/form2.js.map +1 -1
  250. package/lib/components/icon/index.js +2 -2
  251. package/lib/components/icon/src/icon.js +35 -8
  252. package/lib/components/icon/src/icon.js.map +1 -1
  253. package/lib/components/icon/src/icon2.js +8 -35
  254. package/lib/components/icon/src/icon2.js.map +1 -1
  255. package/lib/components/image/index.js +2 -2
  256. package/lib/components/image/src/image.js +50 -127
  257. package/lib/components/image/src/image.js.map +1 -1
  258. package/lib/components/image/src/image2.js +127 -50
  259. package/lib/components/image/src/image2.js.map +1 -1
  260. package/lib/components/image-viewer/index.js +2 -2
  261. package/lib/components/image-viewer/src/image-viewer.js +31 -210
  262. package/lib/components/image-viewer/src/image-viewer.js.map +1 -1
  263. package/lib/components/image-viewer/src/image-viewer2.js +210 -31
  264. package/lib/components/image-viewer/src/image-viewer2.js.map +1 -1
  265. package/lib/components/index.js +27 -27
  266. package/lib/components/menu/index.js +2 -2
  267. package/lib/components/menu/src/menu-item-group.js +35 -4
  268. package/lib/components/menu/src/menu-item-group.js.map +1 -1
  269. package/lib/components/menu/src/menu-item-group2.js +4 -35
  270. package/lib/components/menu/src/menu-item-group2.js.map +1 -1
  271. package/lib/components/page-header/index.js +2 -2
  272. package/lib/components/page-header/src/page-header.js +14 -55
  273. package/lib/components/page-header/src/page-header.js.map +1 -1
  274. package/lib/components/page-header/src/page-header2.js +55 -14
  275. package/lib/components/page-header/src/page-header2.js.map +1 -1
  276. package/lib/components/popconfirm/src/popconfirm.js +1 -1
  277. package/lib/components/popconfirm/src/popconfirm2.js +3 -1
  278. package/lib/components/popconfirm/src/popconfirm2.js.map +1 -1
  279. package/lib/components/popover/src/popover.js +1 -1
  280. package/lib/components/popper/index.js +4 -4
  281. package/lib/components/popper/src/arrow.js +31 -7
  282. package/lib/components/popper/src/arrow.js.map +1 -1
  283. package/lib/components/popper/src/arrow2.js +7 -31
  284. package/lib/components/popper/src/arrow2.js.map +1 -1
  285. package/lib/components/popper/src/content.js +65 -52
  286. package/lib/components/popper/src/content.js.map +1 -1
  287. package/lib/components/popper/src/content2.js +52 -65
  288. package/lib/components/popper/src/content2.js.map +1 -1
  289. package/lib/components/rate/index.js +2 -2
  290. package/lib/components/rate/src/rate.js +84 -169
  291. package/lib/components/rate/src/rate.js.map +1 -1
  292. package/lib/components/rate/src/rate2.js +169 -84
  293. package/lib/components/rate/src/rate2.js.map +1 -1
  294. package/lib/components/roving-focus-group/src/roving-focus-group.js +1 -1
  295. package/lib/components/tabs/index.js +1 -1
  296. package/lib/components/tabs/src/tab-bar.js +76 -7
  297. package/lib/components/tabs/src/tab-bar.js.map +1 -1
  298. package/lib/components/tabs/src/tab-bar2.js +7 -76
  299. package/lib/components/tabs/src/tab-bar2.js.map +1 -1
  300. package/lib/components/tabs/src/tab-nav.js +1 -1
  301. package/lib/components/tooltip/src/tooltip.js +1 -1
  302. package/lib/components/tooltip/src/tooltip2.js +1 -1
  303. package/lib/components/tooltip-v2/index.js +2 -2
  304. package/lib/components/tooltip-v2/src/arrow.js +23 -38
  305. package/lib/components/tooltip-v2/src/arrow.js.map +1 -1
  306. package/lib/components/tooltip-v2/src/arrow2.js +38 -23
  307. package/lib/components/tooltip-v2/src/arrow2.js.map +1 -1
  308. package/lib/components/tooltip-v2/src/tooltip.js +2 -2
  309. package/lib/components/tooltip-v2/src/tooltip2.js +4 -4
  310. package/lib/components/tooltip-v2/src/trigger.js +11 -89
  311. package/lib/components/tooltip-v2/src/trigger.js.map +1 -1
  312. package/lib/components/tooltip-v2/src/trigger2.js +89 -11
  313. package/lib/components/tooltip-v2/src/trigger2.js.map +1 -1
  314. package/lib/components/upload/index.js +2 -2
  315. package/lib/components/upload/src/upload-content.js +46 -15
  316. package/lib/components/upload/src/upload-content.js.map +1 -1
  317. package/lib/components/upload/src/upload-content2.js +15 -46
  318. package/lib/components/upload/src/upload-content2.js.map +1 -1
  319. package/lib/components/upload/src/upload-dragger.js +32 -12
  320. package/lib/components/upload/src/upload-dragger.js.map +1 -1
  321. package/lib/components/upload/src/upload-dragger2.js +12 -32
  322. package/lib/components/upload/src/upload-dragger2.js.map +1 -1
  323. package/lib/components/upload/src/upload2.js +1 -1
  324. package/lib/index.js +27 -27
  325. package/package.json +1 -1
  326. package/web-types.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"badge2.mjs","sources":["../../../../../../packages/components/badge/src/badge.ts"],"sourcesContent":["import { buildProps } from '@element-ps/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type Badge from './badge.vue'\n\nexport const badgeProps = buildProps({\n value: {\n type: [String, Number],\n default: '',\n },\n max: {\n type: Number,\n default: 99,\n },\n isDot: Boolean,\n hidden: Boolean,\n type: {\n type: String,\n values: ['primary', 'success', 'warning', 'info', 'danger'],\n default: 'danger',\n },\n} as const)\nexport type BadgeProps = ExtractPropTypes<typeof badgeProps>\n\nexport type BadgeInstance = InstanceType<typeof Badge>\n"],"names":[],"mappings":";;;AACY,MAAC,UAAU,GAAG,UAAU,CAAC;AACrC,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,GAAG,EAAE;AACP,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,KAAK,EAAE,OAAO;AAChB,EAAE,MAAM,EAAE,OAAO;AACjB,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC;AAC/D,IAAI,OAAO,EAAE,QAAQ;AACrB,GAAG;AACH,CAAC;;;;"}
1
+ {"version":3,"file":"badge2.mjs","sources":["../../../../../../packages/components/badge/src/badge.vue"],"sourcesContent":["<template>\n <div :class=\"ns.b()\">\n <slot />\n <transition :name=\"`${ns.namespace.value}-zoom-in-center`\">\n <sup\n v-show=\"!hidden && (content || content === '0' || isDot)\"\n :class=\"[\n ns.e('content'),\n ns.em('content', type),\n ns.is('fixed', !!$slots.default),\n ns.is('dot', isDot),\n ]\"\n v-text=\"content\"\n />\n </transition>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport { useNamespace } from '@element-ps/hooks'\nimport { isNumber } from '@element-ps/utils'\nimport { badgeProps } from './badge'\n\ndefineOptions({\n name: 'PsBadge',\n})\n\nconst props = defineProps(badgeProps)\n\nconst ns = useNamespace('badge')\n\nconst content = computed<string>(() => {\n if (props.isDot) return ''\n\n if (isNumber(props.value) && isNumber(props.max)) {\n return props.max < props.value ? `${props.max}+` : `${props.value}`\n }\n return `${props.value}`\n})\n\ndefineExpose({\n /** @description badge content */\n content,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA8BA,IAAA,MAAA,EAAA,GAAA,aAAA,OAAA,CAAA,CAAA;AAEA,IAAA,MAAA,OAAA,GAAA,SAAA,MAAA;AACA,MAAA,IAAA,KAAA,CAAA,KAAA;AAAA,QAAA,OAAA,EAAA,CAAA;AAEA,MAAA,IAAA,SAAA,KAAA,CAAA,KAAA,KAAA,QAAA,CAAA,KAAA,CAAA,GAAA,CAAA,EAAA;AACA,QAAA,OAAA,KAAA,CAAA,MAAA,KAAA,CAAA,KAAA,GAAA,GAAA,KAAA,CAAA,GAAA,CAAA,CAAA,CAAA,GAAA,GAAA,KAAA,CAAA,KAAA,CAAA,CAAA,CAAA;AAAA,OACA;AACA,MAAA,OAAA,GAAA,KAAA,CAAA,KAAA,CAAA,CAAA,CAAA;AAAA,KACA,CAAA,CAAA;AAEA,IAAA,MAAA,CAAA;AAAA,MAEA,OAAA;AAAA,KACA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  import '../../utils/index.mjs';
2
- import Button from './src/button2.mjs';
2
+ import Button from './src/button.mjs';
3
3
  import ButtonGroup from './src/button-group2.mjs';
4
- export { buttonNativeTypes, buttonProps, buttonTypes } from './src/button.mjs';
4
+ export { buttonNativeTypes, buttonProps, buttonTypes } from './src/button2.mjs';
5
5
  import { withInstall, withNoopInstall } from '../../utils/vue/install.mjs';
6
6
 
7
7
  const PsButton = withInstall(Button, {
@@ -1,4 +1,4 @@
1
- import { buttonProps } from './button.mjs';
1
+ import { buttonProps } from './button2.mjs';
2
2
 
3
3
  const buttonGroupProps = {
4
4
  size: buttonProps.size,
@@ -1,54 +1,102 @@
1
+ import { defineComponent, useSlots, inject, computed, ref, Text, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, Fragment, renderSlot, createBlock, withCtx, resolveDynamicComponent, createCommentVNode } from 'vue';
2
+ import { PsIcon } from '../../icon/index.mjs';
1
3
  import '../../../hooks/index.mjs';
2
- import '../../../utils/index.mjs';
3
- import { Loading } from '@element-plus/icons-vue';
4
- import { buildProps } from '../../../utils/vue/props.mjs';
5
- import { useSizeProp } from '../../../hooks/use-common-props/index.mjs';
6
- import { iconPropType } from '../../../utils/vue/icon.mjs';
4
+ import '../../../tokens/index.mjs';
5
+ import { buttonProps } from './button2.mjs';
6
+ import { useButtonCustomStyle } from './button-custom.mjs';
7
+ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
8
+ import { buttonGroupContextKey } from '../../../tokens/button.mjs';
9
+ import { useGlobalConfig } from '../../../hooks/use-global-config/index.mjs';
10
+ import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
11
+ import { useSize, useDisabled } from '../../../hooks/use-common-props/index.mjs';
7
12
 
8
- const buttonTypes = [
9
- "default",
10
- "primary",
11
- "success",
12
- "warning",
13
- "info",
14
- "danger",
15
- "text",
16
- ""
17
- ];
18
- const buttonNativeTypes = ["button", "submit", "reset"];
19
- const buttonProps = buildProps({
20
- size: useSizeProp,
21
- disabled: Boolean,
22
- type: {
23
- type: String,
24
- values: buttonTypes,
25
- default: ""
26
- },
27
- icon: {
28
- type: iconPropType,
29
- default: ""
30
- },
31
- nativeType: {
32
- type: String,
33
- values: buttonNativeTypes,
34
- default: "button"
35
- },
36
- loading: Boolean,
37
- loadingIcon: {
38
- type: iconPropType,
39
- default: () => Loading
40
- },
41
- plain: Boolean,
42
- autofocus: Boolean,
43
- round: Boolean,
44
- circle: Boolean,
45
- color: String,
46
- dark: Boolean,
47
- autoInsertSpace: {
48
- type: Boolean,
49
- default: void 0
13
+ const _hoisted_1 = ["disabled", "autofocus", "type"];
14
+ const __default__ = {
15
+ name: "PsButton"
16
+ };
17
+ const _sfc_main = /* @__PURE__ */ defineComponent({
18
+ ...__default__,
19
+ props: buttonProps,
20
+ setup(__props, { expose }) {
21
+ const props = __props;
22
+ const slots = useSlots();
23
+ const buttonGroupContext = inject(buttonGroupContextKey, void 0);
24
+ const globalConfig = useGlobalConfig("button");
25
+ const ns = useNamespace("button");
26
+ const _size = useSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
27
+ const _disabled = useDisabled();
28
+ const _ref = ref();
29
+ const _type = computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
30
+ const autoInsertSpace = computed(() => {
31
+ var _a, _b, _c;
32
+ return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false;
33
+ });
34
+ const shouldAddSpace = computed(() => {
35
+ var _a;
36
+ const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots);
37
+ if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
38
+ const slot = defaultSlot[0];
39
+ if ((slot == null ? void 0 : slot.type) === Text) {
40
+ const text = slot.children;
41
+ return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
42
+ }
43
+ }
44
+ return false;
45
+ });
46
+ const buttonStyle = useButtonCustomStyle(props);
47
+ expose({
48
+ ref: _ref,
49
+ size: _size,
50
+ type: _type,
51
+ disabled: _disabled,
52
+ shouldAddSpace
53
+ });
54
+ return (_ctx, _cache) => {
55
+ return openBlock(), createElementBlock("button", {
56
+ ref_key: "_ref",
57
+ ref: _ref,
58
+ class: normalizeClass([
59
+ unref(ns).b(),
60
+ unref(ns).m(unref(_type)),
61
+ unref(ns).m(unref(_size)),
62
+ unref(ns).is("disabled", unref(_disabled)),
63
+ unref(ns).is("loading", _ctx.loading),
64
+ unref(ns).is("plain", _ctx.plain),
65
+ unref(ns).is("round", _ctx.round),
66
+ unref(ns).is("circle", _ctx.circle)
67
+ ]),
68
+ disabled: unref(_disabled) || _ctx.loading,
69
+ autofocus: _ctx.autofocus,
70
+ type: _ctx.nativeType,
71
+ style: normalizeStyle(unref(buttonStyle))
72
+ }, [
73
+ _ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
74
+ _ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(PsIcon), {
75
+ key: 1,
76
+ class: normalizeClass(unref(ns).is("loading"))
77
+ }, {
78
+ default: withCtx(() => [
79
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
80
+ ]),
81
+ _: 1
82
+ }, 8, ["class"]))
83
+ ], 2112)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(PsIcon), { key: 1 }, {
84
+ default: withCtx(() => [
85
+ _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
86
+ ]),
87
+ _: 3
88
+ })) : createCommentVNode("v-if", true),
89
+ _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
90
+ key: 2,
91
+ class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
92
+ }, [
93
+ renderSlot(_ctx.$slots, "default")
94
+ ], 2)) : createCommentVNode("v-if", true)
95
+ ], 14, _hoisted_1);
96
+ };
50
97
  }
51
98
  });
99
+ var Button = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/button/src/button.vue"]]);
52
100
 
53
- export { buttonNativeTypes, buttonProps, buttonTypes };
101
+ export { Button as default };
54
102
  //# sourceMappingURL=button.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"button.mjs","sources":["../../../../../../packages/components/button/src/button.ts"],"sourcesContent":["import { useSizeProp } from '@element-ps/hooks'\nimport { buildProps, iconPropType } from '@element-ps/utils'\nimport { Loading } from '@element-plus/icons-vue'\nimport type { ExtractPropTypes } from 'vue'\nimport type button from './button.vue'\n\nexport const buttonTypes = [\n 'default',\n 'primary',\n 'success',\n 'warning',\n 'info',\n 'danger',\n 'text',\n '',\n] as const\nexport const buttonNativeTypes = ['button', 'submit', 'reset'] as const\n\nexport const buttonProps = buildProps({\n size: useSizeProp,\n disabled: Boolean,\n type: {\n type: String,\n values: buttonTypes,\n default: '',\n },\n icon: {\n type: iconPropType,\n default: '',\n },\n nativeType: {\n type: String,\n values: buttonNativeTypes,\n default: 'button',\n },\n loading: Boolean,\n loadingIcon: {\n type: iconPropType,\n default: () => Loading,\n },\n plain: Boolean,\n autofocus: Boolean,\n round: Boolean,\n circle: Boolean,\n color: String,\n dark: Boolean,\n autoInsertSpace: {\n type: Boolean,\n default: undefined,\n },\n} as const)\n\nexport type ButtonProps = ExtractPropTypes<typeof buttonProps>\n\nexport type ButtonType = ButtonProps['type']\nexport type ButtonNativeType = ButtonProps['nativeType']\n\nexport type ButtonInstance = InstanceType<typeof button>\n\nexport interface ButtonConfigContext {\n autoInsertSpace?: boolean\n}\n"],"names":[],"mappings":";;;;;;;AAGY,MAAC,WAAW,GAAG;AAC3B,EAAE,SAAS;AACX,EAAE,SAAS;AACX,EAAE,SAAS;AACX,EAAE,SAAS;AACX,EAAE,MAAM;AACR,EAAE,QAAQ;AACV,EAAE,MAAM;AACR,EAAE,EAAE;AACJ,EAAE;AACU,MAAC,iBAAiB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE;AACnD,MAAC,WAAW,GAAG,UAAU,CAAC;AACtC,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,WAAW;AACvB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,YAAY;AACtB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,iBAAiB;AAC7B,IAAI,OAAO,EAAE,QAAQ;AACrB,GAAG;AACH,EAAE,OAAO,EAAE,OAAO;AAClB,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,YAAY;AACtB,IAAI,OAAO,EAAE,MAAM,OAAO;AAC1B,GAAG;AACH,EAAE,KAAK,EAAE,OAAO;AAChB,EAAE,SAAS,EAAE,OAAO;AACpB,EAAE,KAAK,EAAE,OAAO;AAChB,EAAE,MAAM,EAAE,OAAO;AACjB,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,IAAI,EAAE,OAAO;AACf,EAAE,eAAe,EAAE;AACnB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,CAAC;;;;"}
1
+ {"version":3,"file":"button.mjs","sources":["../../../../../../packages/components/button/src/button.vue"],"sourcesContent":["<template>\n <button\n ref=\"_ref\"\n :class=\"[\n ns.b(),\n ns.m(_type),\n ns.m(_size),\n ns.is('disabled', _disabled),\n ns.is('loading', loading),\n ns.is('plain', plain),\n ns.is('round', round),\n ns.is('circle', circle),\n ]\"\n :disabled=\"_disabled || loading\"\n :autofocus=\"autofocus\"\n :type=\"nativeType\"\n :style=\"buttonStyle\"\n >\n <template v-if=\"loading\">\n <slot v-if=\"$slots.loading\" name=\"loading\" />\n <ps-icon v-else :class=\"ns.is('loading')\">\n <component :is=\"loadingIcon\" />\n </ps-icon>\n </template>\n <ps-icon v-else-if=\"icon || $slots.icon\">\n <component :is=\"icon\" v-if=\"icon\" />\n <slot v-else name=\"icon\" />\n </ps-icon>\n <span\n v-if=\"$slots.default\"\n :class=\"{ [ns.em('text', 'expand')]: shouldAddSpace }\"\n >\n <slot />\n </span>\n </button>\n</template>\n\n<script lang=\"ts\" setup>\nimport { Text, computed, inject, ref, useSlots } from 'vue'\nimport { PsIcon } from '@element-ps/components/icon'\nimport {\n useDisabled,\n useGlobalConfig,\n useNamespace,\n useSize,\n} from '@element-ps/hooks'\nimport { buttonGroupContextKey } from '@element-ps/tokens'\nimport { buttonProps } from './button'\nimport { useButtonCustomStyle } from './button-custom'\n\ndefineOptions({\n name: 'PsButton',\n})\n\nconst props = defineProps(buttonProps)\nconst slots = useSlots()\n\nconst buttonGroupContext = inject(buttonGroupContextKey, undefined)\nconst globalConfig = useGlobalConfig('button')\nconst ns = useNamespace('button')\nconst _size = useSize(computed(() => buttonGroupContext?.size))\nconst _disabled = useDisabled()\nconst _ref = ref<HTMLButtonElement>()\n\nconst _type = computed(() => props.type || buttonGroupContext?.type || '')\nconst autoInsertSpace = computed(\n () => props.autoInsertSpace ?? globalConfig.value?.autoInsertSpace ?? false\n)\n\n// add space between two characters in Chinese\nconst shouldAddSpace = computed(() => {\n const defaultSlot = slots.default?.()\n if (autoInsertSpace.value && defaultSlot?.length === 1) {\n const slot = defaultSlot[0]\n if (slot?.type === Text) {\n const text = slot.children as string\n return /^\\p{Unified_Ideograph}{2}$/u.test(text.trim())\n }\n }\n return false\n})\n\nconst buttonStyle = useButtonCustomStyle(props)\n\ndefineExpose({\n /** @description button html element */\n ref: _ref,\n /** @description button size */\n size: _size,\n /** @description button type */\n type: _type,\n /** @description button disabled */\n disabled: _disabled,\n /** @description whether adding space */\n shouldAddSpace,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuDA,IAAA,MAAA,QAAA,QAAA,EAAA,CAAA;AAEA,IAAA,MAAA,kBAAA,GAAA,MAAA,CAAA,qBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AACA,IAAA,MAAA,YAAA,GAAA,gBAAA,QAAA,CAAA,CAAA;AACA,IAAA,MAAA,EAAA,GAAA,aAAA,QAAA,CAAA,CAAA;AACA,IAAA,MAAA,QAAA,OAAA,CAAA,QAAA,CAAA,MAAA,kBAAA,QAAA,GAAA,KAAA,CAAA,GAAA,kBAAA,CAAA,IAAA,CAAA,CAAA,CAAA;AACA,IAAA,MAAA,YAAA,WAAA,EAAA,CAAA;AACA,IAAA,MAAA,OAAA,GAAA,EAAA,CAAA;AAEA,IAAA,MAAA,QAAA,QAAA,CAAA,MAAA,MAAA,IAAA,KAAA,kBAAA,WAAA,KAAA,CAAA,GAAA,kBAAA,CAAA,IAAA,CAAA,IAAA,EAAA,CAAA,CAAA;AACA,IAAA,MAAA,eAAA,GAAA,SACA,MAAA;AAIA,MAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AACA,MAAA,OAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,qBAAA,KAAA,IAAA,GAAA,EAAA,GAAA,CAAA,EAAA,GAAA,YAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,eAAA,KAAA,IAAA,GAAA,EAAA,GAAA,KAAA,CAAA;AACA,KAAA,CAAA,CAAA;AACA,IAAA,MAAA,cAAA,GAAA,QAAA,CAAA,MAAA;AACA,MAAA,IAAA,EAAA,CAAA;AACA,MAAA,MAAA,WAAA,GAAA,CAAA,EAAA,GAAA,KAAA,CAAA,OAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,KAAA,CAAA,CAAA;AACA,MAAA,IAAA,eAAA,CAAA,KAAA,IAAA,CAAA,WAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,WAAA,CAAA,MAAA,MAAA,CAAA,EAAA;AAAA,QACA,MAAA,IAAA,GAAA,WAAA,CAAA,CAAA,CAAA,CAAA;AAAA,QACA,IAAA,CAAA,IAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,IAAA,CAAA,IAAA,MAAA,IAAA,EAAA;AACA,UAAA,MAAA,IAAA,GAAA,IAAA,CAAA,QAAA,CAAA;AAAA,UACA,OAAA,6BAAA,CAAA,IAAA,CAAA,IAAA,CAAA,IAAA,EAAA,CAAA,CAAA;AAEA,SAAA;AAEA,OAAA;AAAA,MAEA,OAAA,KAAA,CAAA;AAAA,KAAA,CAEA,CAAA;AAAA,IAAA,MAEA,WAAA,GAAA,oBAAA,CAAA,KAAA,CAAA,CAAA;AAAA,IAAA,MAEA,CAAA;AAAA,MAEA,GAAA,EAAA,IAAA;AAAA,MACA,IAAA,EAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,102 +1,54 @@
1
- import { defineComponent, useSlots, inject, computed, ref, Text, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, Fragment, renderSlot, createBlock, withCtx, resolveDynamicComponent, createCommentVNode } from 'vue';
2
- import { PsIcon } from '../../icon/index.mjs';
3
1
  import '../../../hooks/index.mjs';
4
- import '../../../tokens/index.mjs';
5
- import { buttonProps } from './button.mjs';
6
- import { useButtonCustomStyle } from './button-custom.mjs';
7
- import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
8
- import { buttonGroupContextKey } from '../../../tokens/button.mjs';
9
- import { useGlobalConfig } from '../../../hooks/use-global-config/index.mjs';
10
- import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
11
- import { useSize, useDisabled } from '../../../hooks/use-common-props/index.mjs';
2
+ import '../../../utils/index.mjs';
3
+ import { Loading } from '@element-plus/icons-vue';
4
+ import { buildProps } from '../../../utils/vue/props.mjs';
5
+ import { useSizeProp } from '../../../hooks/use-common-props/index.mjs';
6
+ import { iconPropType } from '../../../utils/vue/icon.mjs';
12
7
 
13
- const _hoisted_1 = ["disabled", "autofocus", "type"];
14
- const __default__ = {
15
- name: "PsButton"
16
- };
17
- const _sfc_main = /* @__PURE__ */ defineComponent({
18
- ...__default__,
19
- props: buttonProps,
20
- setup(__props, { expose }) {
21
- const props = __props;
22
- const slots = useSlots();
23
- const buttonGroupContext = inject(buttonGroupContextKey, void 0);
24
- const globalConfig = useGlobalConfig("button");
25
- const ns = useNamespace("button");
26
- const _size = useSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
27
- const _disabled = useDisabled();
28
- const _ref = ref();
29
- const _type = computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
30
- const autoInsertSpace = computed(() => {
31
- var _a, _b, _c;
32
- return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false;
33
- });
34
- const shouldAddSpace = computed(() => {
35
- var _a;
36
- const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots);
37
- if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
38
- const slot = defaultSlot[0];
39
- if ((slot == null ? void 0 : slot.type) === Text) {
40
- const text = slot.children;
41
- return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
42
- }
43
- }
44
- return false;
45
- });
46
- const buttonStyle = useButtonCustomStyle(props);
47
- expose({
48
- ref: _ref,
49
- size: _size,
50
- type: _type,
51
- disabled: _disabled,
52
- shouldAddSpace
53
- });
54
- return (_ctx, _cache) => {
55
- return openBlock(), createElementBlock("button", {
56
- ref_key: "_ref",
57
- ref: _ref,
58
- class: normalizeClass([
59
- unref(ns).b(),
60
- unref(ns).m(unref(_type)),
61
- unref(ns).m(unref(_size)),
62
- unref(ns).is("disabled", unref(_disabled)),
63
- unref(ns).is("loading", _ctx.loading),
64
- unref(ns).is("plain", _ctx.plain),
65
- unref(ns).is("round", _ctx.round),
66
- unref(ns).is("circle", _ctx.circle)
67
- ]),
68
- disabled: unref(_disabled) || _ctx.loading,
69
- autofocus: _ctx.autofocus,
70
- type: _ctx.nativeType,
71
- style: normalizeStyle(unref(buttonStyle))
72
- }, [
73
- _ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
74
- _ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(PsIcon), {
75
- key: 1,
76
- class: normalizeClass(unref(ns).is("loading"))
77
- }, {
78
- default: withCtx(() => [
79
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
80
- ]),
81
- _: 1
82
- }, 8, ["class"]))
83
- ], 2112)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(PsIcon), { key: 1 }, {
84
- default: withCtx(() => [
85
- _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
86
- ]),
87
- _: 3
88
- })) : createCommentVNode("v-if", true),
89
- _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
90
- key: 2,
91
- class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
92
- }, [
93
- renderSlot(_ctx.$slots, "default")
94
- ], 2)) : createCommentVNode("v-if", true)
95
- ], 14, _hoisted_1);
96
- };
8
+ const buttonTypes = [
9
+ "default",
10
+ "primary",
11
+ "success",
12
+ "warning",
13
+ "info",
14
+ "danger",
15
+ "text",
16
+ ""
17
+ ];
18
+ const buttonNativeTypes = ["button", "submit", "reset"];
19
+ const buttonProps = buildProps({
20
+ size: useSizeProp,
21
+ disabled: Boolean,
22
+ type: {
23
+ type: String,
24
+ values: buttonTypes,
25
+ default: ""
26
+ },
27
+ icon: {
28
+ type: iconPropType,
29
+ default: ""
30
+ },
31
+ nativeType: {
32
+ type: String,
33
+ values: buttonNativeTypes,
34
+ default: "button"
35
+ },
36
+ loading: Boolean,
37
+ loadingIcon: {
38
+ type: iconPropType,
39
+ default: () => Loading
40
+ },
41
+ plain: Boolean,
42
+ autofocus: Boolean,
43
+ round: Boolean,
44
+ circle: Boolean,
45
+ color: String,
46
+ dark: Boolean,
47
+ autoInsertSpace: {
48
+ type: Boolean,
49
+ default: void 0
97
50
  }
98
51
  });
99
- var Button = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/button/src/button.vue"]]);
100
52
 
101
- export { Button as default };
53
+ export { buttonNativeTypes, buttonProps, buttonTypes };
102
54
  //# sourceMappingURL=button2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"button2.mjs","sources":["../../../../../../packages/components/button/src/button.vue"],"sourcesContent":["<template>\n <button\n ref=\"_ref\"\n :class=\"[\n ns.b(),\n ns.m(_type),\n ns.m(_size),\n ns.is('disabled', _disabled),\n ns.is('loading', loading),\n ns.is('plain', plain),\n ns.is('round', round),\n ns.is('circle', circle),\n ]\"\n :disabled=\"_disabled || loading\"\n :autofocus=\"autofocus\"\n :type=\"nativeType\"\n :style=\"buttonStyle\"\n >\n <template v-if=\"loading\">\n <slot v-if=\"$slots.loading\" name=\"loading\" />\n <ps-icon v-else :class=\"ns.is('loading')\">\n <component :is=\"loadingIcon\" />\n </ps-icon>\n </template>\n <ps-icon v-else-if=\"icon || $slots.icon\">\n <component :is=\"icon\" v-if=\"icon\" />\n <slot v-else name=\"icon\" />\n </ps-icon>\n <span\n v-if=\"$slots.default\"\n :class=\"{ [ns.em('text', 'expand')]: shouldAddSpace }\"\n >\n <slot />\n </span>\n </button>\n</template>\n\n<script lang=\"ts\" setup>\nimport { Text, computed, inject, ref, useSlots } from 'vue'\nimport { PsIcon } from '@element-ps/components/icon'\nimport {\n useDisabled,\n useGlobalConfig,\n useNamespace,\n useSize,\n} from '@element-ps/hooks'\nimport { buttonGroupContextKey } from '@element-ps/tokens'\nimport { buttonProps } from './button'\nimport { useButtonCustomStyle } from './button-custom'\n\ndefineOptions({\n name: 'PsButton',\n})\n\nconst props = defineProps(buttonProps)\nconst slots = useSlots()\n\nconst buttonGroupContext = inject(buttonGroupContextKey, undefined)\nconst globalConfig = useGlobalConfig('button')\nconst ns = useNamespace('button')\nconst _size = useSize(computed(() => buttonGroupContext?.size))\nconst _disabled = useDisabled()\nconst _ref = ref<HTMLButtonElement>()\n\nconst _type = computed(() => props.type || buttonGroupContext?.type || '')\nconst autoInsertSpace = computed(\n () => props.autoInsertSpace ?? globalConfig.value?.autoInsertSpace ?? false\n)\n\n// add space between two characters in Chinese\nconst shouldAddSpace = computed(() => {\n const defaultSlot = slots.default?.()\n if (autoInsertSpace.value && defaultSlot?.length === 1) {\n const slot = defaultSlot[0]\n if (slot?.type === Text) {\n const text = slot.children as string\n return /^\\p{Unified_Ideograph}{2}$/u.test(text.trim())\n }\n }\n return false\n})\n\nconst buttonStyle = useButtonCustomStyle(props)\n\ndefineExpose({\n /** @description button html element */\n ref: _ref,\n /** @description button size */\n size: _size,\n /** @description button type */\n type: _type,\n /** @description button disabled */\n disabled: _disabled,\n /** @description whether adding space */\n shouldAddSpace,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuDA,IAAA,MAAA,QAAA,QAAA,EAAA,CAAA;AAEA,IAAA,MAAA,kBAAA,GAAA,MAAA,CAAA,qBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AACA,IAAA,MAAA,YAAA,GAAA,gBAAA,QAAA,CAAA,CAAA;AACA,IAAA,MAAA,EAAA,GAAA,aAAA,QAAA,CAAA,CAAA;AACA,IAAA,MAAA,QAAA,OAAA,CAAA,QAAA,CAAA,MAAA,kBAAA,QAAA,GAAA,KAAA,CAAA,GAAA,kBAAA,CAAA,IAAA,CAAA,CAAA,CAAA;AACA,IAAA,MAAA,YAAA,WAAA,EAAA,CAAA;AACA,IAAA,MAAA,OAAA,GAAA,EAAA,CAAA;AAEA,IAAA,MAAA,QAAA,QAAA,CAAA,MAAA,MAAA,IAAA,KAAA,kBAAA,WAAA,KAAA,CAAA,GAAA,kBAAA,CAAA,IAAA,CAAA,IAAA,EAAA,CAAA,CAAA;AACA,IAAA,MAAA,eAAA,GAAA,SACA,MAAA;AAIA,MAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AACA,MAAA,OAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,qBAAA,KAAA,IAAA,GAAA,EAAA,GAAA,CAAA,EAAA,GAAA,YAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,eAAA,KAAA,IAAA,GAAA,EAAA,GAAA,KAAA,CAAA;AACA,KAAA,CAAA,CAAA;AACA,IAAA,MAAA,cAAA,GAAA,QAAA,CAAA,MAAA;AACA,MAAA,IAAA,EAAA,CAAA;AACA,MAAA,MAAA,WAAA,GAAA,CAAA,EAAA,GAAA,KAAA,CAAA,OAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,KAAA,CAAA,CAAA;AACA,MAAA,IAAA,eAAA,CAAA,KAAA,IAAA,CAAA,WAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,WAAA,CAAA,MAAA,MAAA,CAAA,EAAA;AAAA,QACA,MAAA,IAAA,GAAA,WAAA,CAAA,CAAA,CAAA,CAAA;AAAA,QACA,IAAA,CAAA,IAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,IAAA,CAAA,IAAA,MAAA,IAAA,EAAA;AACA,UAAA,MAAA,IAAA,GAAA,IAAA,CAAA,QAAA,CAAA;AAAA,UACA,OAAA,6BAAA,CAAA,IAAA,CAAA,IAAA,CAAA,IAAA,EAAA,CAAA,CAAA;AAEA,SAAA;AAEA,OAAA;AAAA,MAEA,OAAA,KAAA,CAAA;AAAA,KAAA,CAEA,CAAA;AAAA,IAAA,MAEA,WAAA,GAAA,oBAAA,CAAA,KAAA,CAAA,CAAA;AAAA,IAAA,MAEA,CAAA;AAAA,MAEA,GAAA,EAAA,IAAA;AAAA,MACA,IAAA,EAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"button2.mjs","sources":["../../../../../../packages/components/button/src/button.ts"],"sourcesContent":["import { useSizeProp } from '@element-ps/hooks'\nimport { buildProps, iconPropType } from '@element-ps/utils'\nimport { Loading } from '@element-plus/icons-vue'\nimport type { ExtractPropTypes } from 'vue'\nimport type button from './button.vue'\n\nexport const buttonTypes = [\n 'default',\n 'primary',\n 'success',\n 'warning',\n 'info',\n 'danger',\n 'text',\n '',\n] as const\nexport const buttonNativeTypes = ['button', 'submit', 'reset'] as const\n\nexport const buttonProps = buildProps({\n size: useSizeProp,\n disabled: Boolean,\n type: {\n type: String,\n values: buttonTypes,\n default: '',\n },\n icon: {\n type: iconPropType,\n default: '',\n },\n nativeType: {\n type: String,\n values: buttonNativeTypes,\n default: 'button',\n },\n loading: Boolean,\n loadingIcon: {\n type: iconPropType,\n default: () => Loading,\n },\n plain: Boolean,\n autofocus: Boolean,\n round: Boolean,\n circle: Boolean,\n color: String,\n dark: Boolean,\n autoInsertSpace: {\n type: Boolean,\n default: undefined,\n },\n} as const)\n\nexport type ButtonProps = ExtractPropTypes<typeof buttonProps>\n\nexport type ButtonType = ButtonProps['type']\nexport type ButtonNativeType = ButtonProps['nativeType']\n\nexport type ButtonInstance = InstanceType<typeof button>\n\nexport interface ButtonConfigContext {\n autoInsertSpace?: boolean\n}\n"],"names":[],"mappings":";;;;;;;AAGY,MAAC,WAAW,GAAG;AAC3B,EAAE,SAAS;AACX,EAAE,SAAS;AACX,EAAE,SAAS;AACX,EAAE,SAAS;AACX,EAAE,MAAM;AACR,EAAE,QAAQ;AACV,EAAE,MAAM;AACR,EAAE,EAAE;AACJ,EAAE;AACU,MAAC,iBAAiB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE;AACnD,MAAC,WAAW,GAAG,UAAU,CAAC;AACtC,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,WAAW;AACvB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,YAAY;AACtB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,iBAAiB;AAC7B,IAAI,OAAO,EAAE,QAAQ;AACrB,GAAG;AACH,EAAE,OAAO,EAAE,OAAO;AAClB,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,YAAY;AACtB,IAAI,OAAO,EAAE,MAAM,OAAO;AAC1B,GAAG;AACH,EAAE,KAAK,EAAE,OAAO;AAChB,EAAE,SAAS,EAAE,OAAO;AACpB,EAAE,KAAK,EAAE,OAAO;AAChB,EAAE,MAAM,EAAE,OAAO;AACjB,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,IAAI,EAAE,OAAO;AACf,EAAE,eAAe,EAAE;AACnB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,CAAC;;;;"}
@@ -1,6 +1,6 @@
1
1
  import '../../utils/index.mjs';
2
- import Calendar from './src/calendar2.mjs';
3
- export { calendarProps } from './src/calendar.mjs';
2
+ import Calendar from './src/calendar.mjs';
3
+ export { calendarProps } from './src/calendar2.mjs';
4
4
  import { withInstall } from '../../utils/vue/install.mjs';
5
5
 
6
6
  const PsCalendar = withInstall(Calendar);
@@ -1,15 +1,194 @@
1
+ import { defineComponent, ref, computed, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, renderSlot, toDisplayString, createVNode, withCtx, createTextVNode, createCommentVNode, createSlots, normalizeProps, guardReactiveProps, Fragment, renderList, createBlock } from 'vue';
2
+ import dayjs from 'dayjs';
3
+ import { PsButtonGroup, PsButton } from '../../button/index.mjs';
4
+ import '../../../hooks/index.mjs';
1
5
  import '../../../utils/index.mjs';
2
- import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
6
+ import DateTable from './date-table2.mjs';
7
+ import { calendarProps } from './calendar2.mjs';
8
+ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
9
+ import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
10
+ import { useLocale } from '../../../hooks/use-locale/index.mjs';
11
+ import { debugWarn } from '../../../utils/error.mjs';
3
12
 
4
- const calendarProps = buildProps({
5
- modelValue: {
6
- type: Date
7
- },
8
- range: {
9
- type: definePropType(Array),
10
- validator: (range) => Array.isArray(range) && range.length === 2 && range.every((item) => item instanceof Date)
13
+ const __default__ = {
14
+ name: "PsCalendar"
15
+ };
16
+ const _sfc_main = /* @__PURE__ */ defineComponent({
17
+ ...__default__,
18
+ props: calendarProps,
19
+ setup(__props, { expose }) {
20
+ const props = __props;
21
+ const COMPONENT_NAME = "PsCalendar";
22
+ const ns = useNamespace("calendar");
23
+ const { t, lang } = useLocale();
24
+ const selectedDay = ref();
25
+ const now = dayjs().locale(lang.value);
26
+ const i18nDate = computed(() => {
27
+ const pickedMonth = `el.datepicker.month${date.value.format("M")}`;
28
+ return `${date.value.year()} ${t("el.datepicker.year")} ${t(pickedMonth)}`;
29
+ });
30
+ const realSelectedDay = computed({
31
+ get() {
32
+ if (!props.modelValue)
33
+ return selectedDay.value;
34
+ return date.value;
35
+ },
36
+ set(val) {
37
+ if (!val)
38
+ return;
39
+ selectedDay.value = val;
40
+ }
41
+ });
42
+ const date = computed(() => {
43
+ if (!props.modelValue) {
44
+ if (realSelectedDay.value) {
45
+ return realSelectedDay.value;
46
+ } else if (validatedRange.value.length) {
47
+ return validatedRange.value[0][0];
48
+ }
49
+ return now;
50
+ } else {
51
+ return dayjs(props.modelValue).locale(lang.value);
52
+ }
53
+ });
54
+ const calculateValidatedDateRange = (startDayjs, endDayjs) => {
55
+ const firstDay = startDayjs.startOf("week");
56
+ const lastDay = endDayjs.endOf("week");
57
+ const firstMonth = firstDay.get("month");
58
+ const lastMonth = lastDay.get("month");
59
+ if (firstMonth === lastMonth) {
60
+ return [[firstDay, lastDay]];
61
+ } else if (firstMonth + 1 === lastMonth) {
62
+ const firstMonthLastDay = firstDay.endOf("month");
63
+ const lastMonthFirstDay = lastDay.startOf("month");
64
+ const isSameWeek = firstMonthLastDay.isSame(lastMonthFirstDay, "week");
65
+ const lastMonthStartDay = isSameWeek ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
66
+ return [
67
+ [firstDay, firstMonthLastDay],
68
+ [lastMonthStartDay.startOf("week"), lastDay]
69
+ ];
70
+ } else if (firstMonth + 2 === lastMonth || (firstMonth + 1) % 11 === lastMonth) {
71
+ const firstMonthLastDay = firstDay.endOf("month");
72
+ const secondMonthFirstDay = firstDay.add(1, "month").startOf("month");
73
+ const secondMonthStartDay = firstMonthLastDay.isSame(secondMonthFirstDay, "week") ? secondMonthFirstDay.add(1, "week") : secondMonthFirstDay;
74
+ const secondMonthLastDay = secondMonthStartDay.endOf("month");
75
+ const lastMonthFirstDay = lastDay.startOf("month");
76
+ const lastMonthStartDay = secondMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
77
+ return [
78
+ [firstDay, firstMonthLastDay],
79
+ [secondMonthStartDay.startOf("week"), secondMonthLastDay],
80
+ [lastMonthStartDay.startOf("week"), lastDay]
81
+ ];
82
+ } else {
83
+ debugWarn(COMPONENT_NAME, "start time and end time interval must not exceed two months");
84
+ return [];
85
+ }
86
+ };
87
+ const validatedRange = computed(() => {
88
+ if (!props.range)
89
+ return [];
90
+ const rangeArrDayjs = props.range.map((_) => dayjs(_).locale(lang.value));
91
+ const [startDayjs, endDayjs] = rangeArrDayjs;
92
+ if (startDayjs.isAfter(endDayjs)) {
93
+ debugWarn(COMPONENT_NAME, "end time should be greater than start time");
94
+ return [];
95
+ }
96
+ if (startDayjs.isSame(endDayjs, "month")) {
97
+ return calculateValidatedDateRange(startDayjs, endDayjs);
98
+ } else {
99
+ if (startDayjs.add(1, "month").month() !== endDayjs.month()) {
100
+ debugWarn(COMPONENT_NAME, "start time and end time interval must not exceed two months");
101
+ return [];
102
+ }
103
+ return calculateValidatedDateRange(startDayjs, endDayjs);
104
+ }
105
+ });
106
+ expose({
107
+ selectedDay: realSelectedDay,
108
+ calculateValidatedDateRange
109
+ });
110
+ return (_ctx, _cache) => {
111
+ return openBlock(), createElementBlock("div", {
112
+ class: normalizeClass(unref(ns).b())
113
+ }, [
114
+ createElementVNode("div", {
115
+ class: normalizeClass(unref(ns).e("header"))
116
+ }, [
117
+ renderSlot(_ctx.$slots, "header", { date: unref(i18nDate) }, () => [
118
+ createElementVNode("div", {
119
+ class: normalizeClass(unref(ns).e("title"))
120
+ }, toDisplayString(unref(i18nDate)), 3),
121
+ unref(validatedRange).length === 0 ? (openBlock(), createElementBlock("div", {
122
+ key: 0,
123
+ class: normalizeClass(unref(ns).e("button-group"))
124
+ }, [
125
+ createVNode(unref(PsButtonGroup), null, {
126
+ default: withCtx(() => [
127
+ createVNode(unref(PsButton), { size: "small" }, {
128
+ default: withCtx(() => [
129
+ createTextVNode(toDisplayString(unref(t)("el.datepicker.prevMonth")), 1)
130
+ ]),
131
+ _: 1
132
+ }),
133
+ createVNode(unref(PsButton), { size: "small" }, {
134
+ default: withCtx(() => [
135
+ createTextVNode(toDisplayString(unref(t)("el.datepicker.today")), 1)
136
+ ]),
137
+ _: 1
138
+ }),
139
+ createVNode(unref(PsButton), { size: "small" }, {
140
+ default: withCtx(() => [
141
+ createTextVNode(toDisplayString(unref(t)("el.datepicker.nextMonth")), 1)
142
+ ]),
143
+ _: 1
144
+ })
145
+ ]),
146
+ _: 1
147
+ })
148
+ ], 2)) : createCommentVNode("v-if", true)
149
+ ])
150
+ ], 2),
151
+ unref(validatedRange).length === 0 ? (openBlock(), createElementBlock("div", {
152
+ key: 0,
153
+ class: normalizeClass(unref(ns).e("body"))
154
+ }, [
155
+ createVNode(DateTable, {
156
+ date: unref(date),
157
+ "selected-day": unref(realSelectedDay)
158
+ }, createSlots({ _: 2 }, [
159
+ _ctx.$slots.dateCell ? {
160
+ name: "dateCell",
161
+ fn: withCtx((data) => [
162
+ renderSlot(_ctx.$slots, "dateCell", normalizeProps(guardReactiveProps(data)))
163
+ ])
164
+ } : void 0
165
+ ]), 1032, ["date", "selected-day"])
166
+ ], 2)) : (openBlock(), createElementBlock("div", {
167
+ key: 1,
168
+ class: normalizeClass(unref(ns).e("body"))
169
+ }, [
170
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(validatedRange), (range_, index) => {
171
+ return openBlock(), createBlock(DateTable, {
172
+ key: index,
173
+ date: range_[0],
174
+ "selected-day": unref(realSelectedDay),
175
+ range: range_,
176
+ "hide-header": index !== 0
177
+ }, createSlots({ _: 2 }, [
178
+ _ctx.$slots.dateCell ? {
179
+ name: "dateCell",
180
+ fn: withCtx((data) => [
181
+ renderSlot(_ctx.$slots, "dateCell", normalizeProps(guardReactiveProps(data)))
182
+ ])
183
+ } : void 0
184
+ ]), 1032, ["date", "selected-day", "range", "hide-header"]);
185
+ }), 128))
186
+ ], 2))
187
+ ], 2);
188
+ };
11
189
  }
12
190
  });
191
+ var Calendar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/calendar/src/calendar.vue"]]);
13
192
 
14
- export { calendarProps };
193
+ export { Calendar as default };
15
194
  //# sourceMappingURL=calendar.mjs.map