element-ps 2.0.34 → 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 (338) hide show
  1. package/dist/index.full.js +71 -375
  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 +71 -375
  7. package/es/components/affix/index.mjs +2 -2
  8. package/es/components/affix/src/affix.mjs +82 -19
  9. package/es/components/affix/src/affix.mjs.map +1 -1
  10. package/es/components/affix/src/affix2.mjs +19 -82
  11. package/es/components/affix/src/affix2.mjs.map +1 -1
  12. package/es/components/breadcrumb/index.mjs +2 -2
  13. package/es/components/breadcrumb/src/breadcrumb-item.mjs +11 -46
  14. package/es/components/breadcrumb/src/breadcrumb-item.mjs.map +1 -1
  15. package/es/components/breadcrumb/src/breadcrumb-item2.mjs +46 -11
  16. package/es/components/breadcrumb/src/breadcrumb-item2.mjs.map +1 -1
  17. package/es/components/button/index.mjs +3 -3
  18. package/es/components/button/src/button-group.mjs +5 -30
  19. package/es/components/button/src/button-group.mjs.map +1 -1
  20. package/es/components/button/src/button-group2.mjs +30 -5
  21. package/es/components/button/src/button-group2.mjs.map +1 -1
  22. package/es/components/button/src/button.mjs +96 -48
  23. package/es/components/button/src/button.mjs.map +1 -1
  24. package/es/components/button/src/button2.mjs +48 -96
  25. package/es/components/button/src/button2.mjs.map +1 -1
  26. package/es/components/calendar/index.mjs +2 -2
  27. package/es/components/calendar/src/calendar.mjs +188 -9
  28. package/es/components/calendar/src/calendar.mjs.map +1 -1
  29. package/es/components/calendar/src/calendar2.mjs +9 -188
  30. package/es/components/calendar/src/calendar2.mjs.map +1 -1
  31. package/es/components/carousel/index.mjs +4 -4
  32. package/es/components/carousel/src/carousel-item.mjs +7 -148
  33. package/es/components/carousel/src/carousel-item.mjs.map +1 -1
  34. package/es/components/carousel/src/carousel-item2.mjs +148 -7
  35. package/es/components/carousel/src/carousel-item2.mjs.map +1 -1
  36. package/es/components/carousel/src/carousel.mjs +43 -201
  37. package/es/components/carousel/src/carousel.mjs.map +1 -1
  38. package/es/components/carousel/src/carousel2.mjs +201 -43
  39. package/es/components/carousel/src/carousel2.mjs.map +1 -1
  40. package/es/components/cascader-panel/src/config.mjs +1 -1
  41. package/es/components/cascader-panel/src/index.mjs +1 -1
  42. package/es/components/cascader-panel/src/menu.mjs +1 -1
  43. package/es/components/cascader-panel/src/node.mjs +200 -120
  44. package/es/components/cascader-panel/src/node.mjs.map +1 -1
  45. package/es/components/cascader-panel/src/node2.mjs +120 -200
  46. package/es/components/cascader-panel/src/node2.mjs.map +1 -1
  47. package/es/components/cascader-panel/src/store.mjs +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/form/index.mjs +4 -4
  78. package/es/components/form/src/form-item.mjs +171 -46
  79. package/es/components/form/src/form-item.mjs.map +1 -1
  80. package/es/components/form/src/form-item2.mjs +46 -177
  81. package/es/components/form/src/form-item2.mjs.map +1 -1
  82. package/es/components/form/src/form.mjs +45 -40
  83. package/es/components/form/src/form.mjs.map +1 -1
  84. package/es/components/form/src/form2.mjs +40 -45
  85. package/es/components/form/src/form2.mjs.map +1 -1
  86. package/es/components/icon/index.mjs +2 -2
  87. package/es/components/icon/src/icon.mjs +35 -8
  88. package/es/components/icon/src/icon.mjs.map +1 -1
  89. package/es/components/icon/src/icon2.mjs +8 -35
  90. package/es/components/icon/src/icon2.mjs.map +1 -1
  91. package/es/components/image/index.mjs +2 -2
  92. package/es/components/image/src/image.mjs +50 -127
  93. package/es/components/image/src/image.mjs.map +1 -1
  94. package/es/components/image/src/image2.mjs +127 -50
  95. package/es/components/image/src/image2.mjs.map +1 -1
  96. package/es/components/index.mjs +23 -23
  97. package/es/components/menu/index.mjs +2 -2
  98. package/es/components/menu/src/menu-item.mjs +15 -74
  99. package/es/components/menu/src/menu-item.mjs.map +1 -1
  100. package/es/components/menu/src/menu-item2.mjs +74 -15
  101. package/es/components/menu/src/menu-item2.mjs.map +1 -1
  102. package/es/components/popconfirm/index.mjs +2 -2
  103. package/es/components/popconfirm/src/popconfirm.mjs +53 -20
  104. package/es/components/popconfirm/src/popconfirm.mjs.map +1 -1
  105. package/es/components/popconfirm/src/popconfirm2.mjs +22 -53
  106. package/es/components/popconfirm/src/popconfirm2.mjs.map +1 -1
  107. package/es/components/popover/src/popover.mjs +1 -1
  108. package/es/components/popper/index.mjs +2 -2
  109. package/es/components/popper/src/trigger.mjs +17 -28
  110. package/es/components/popper/src/trigger.mjs.map +1 -1
  111. package/es/components/popper/src/trigger2.mjs +28 -17
  112. package/es/components/popper/src/trigger2.mjs.map +1 -1
  113. package/es/components/progress/index.mjs +2 -2
  114. package/es/components/progress/src/progress.mjs +57 -230
  115. package/es/components/progress/src/progress.mjs.map +1 -1
  116. package/es/components/progress/src/progress2.mjs +230 -57
  117. package/es/components/progress/src/progress2.mjs.map +1 -1
  118. package/es/components/roving-focus-group/index.mjs +3 -3
  119. package/es/components/roving-focus-group/src/roving-focus-group-impl.mjs +1 -1
  120. package/es/components/roving-focus-group/src/roving-focus-group.mjs +29 -27
  121. package/es/components/roving-focus-group/src/roving-focus-group.mjs.map +1 -1
  122. package/es/components/roving-focus-group/src/roving-focus-group2.mjs +27 -29
  123. package/es/components/roving-focus-group/src/roving-focus-group2.mjs.map +1 -1
  124. package/es/components/roving-focus-group/src/roving-focus-item.mjs +1 -1
  125. package/es/components/skeleton/index.mjs +2 -2
  126. package/es/components/skeleton/src/skeleton-item.mjs +23 -18
  127. package/es/components/skeleton/src/skeleton-item.mjs.map +1 -1
  128. package/es/components/skeleton/src/skeleton-item2.mjs +18 -23
  129. package/es/components/skeleton/src/skeleton-item2.mjs.map +1 -1
  130. package/es/components/skeleton/src/skeleton2.mjs +1 -1
  131. package/es/components/tabs/index.mjs +3 -3
  132. package/es/components/tabs/src/tab-bar.mjs +76 -7
  133. package/es/components/tabs/src/tab-bar.mjs.map +1 -1
  134. package/es/components/tabs/src/tab-bar2.mjs +7 -76
  135. package/es/components/tabs/src/tab-bar2.mjs.map +1 -1
  136. package/es/components/tabs/src/tab-nav.mjs +1 -1
  137. package/es/components/tabs/src/tab-pane.mjs +15 -61
  138. package/es/components/tabs/src/tab-pane.mjs.map +1 -1
  139. package/es/components/tabs/src/tab-pane2.mjs +61 -15
  140. package/es/components/tabs/src/tab-pane2.mjs.map +1 -1
  141. package/es/components/timeline/index.mjs +2 -2
  142. package/es/components/timeline/src/timeline-item.mjs +39 -73
  143. package/es/components/timeline/src/timeline-item.mjs.map +1 -1
  144. package/es/components/timeline/src/timeline-item2.mjs +73 -39
  145. package/es/components/timeline/src/timeline-item2.mjs.map +1 -1
  146. package/es/components/tooltip/src/tooltip.mjs +1 -1
  147. package/es/components/tooltip/src/tooltip2.mjs +4 -2
  148. package/es/components/tooltip/src/tooltip2.mjs.map +1 -1
  149. package/es/components/tooltip/src/trigger.mjs +1 -1
  150. package/es/components/tooltip-v2/index.mjs +3 -3
  151. package/es/components/tooltip-v2/src/content.mjs +50 -113
  152. package/es/components/tooltip-v2/src/content.mjs.map +1 -1
  153. package/es/components/tooltip-v2/src/content2.mjs +113 -50
  154. package/es/components/tooltip-v2/src/content2.mjs.map +1 -1
  155. package/es/components/tooltip-v2/src/root.mjs +17 -81
  156. package/es/components/tooltip-v2/src/root.mjs.map +1 -1
  157. package/es/components/tooltip-v2/src/root2.mjs +81 -17
  158. package/es/components/tooltip-v2/src/root2.mjs.map +1 -1
  159. package/es/components/tooltip-v2/src/tooltip.mjs +3 -3
  160. package/es/components/tooltip-v2/src/tooltip2.mjs +6 -6
  161. package/es/components/tooltip-v2/src/trigger.mjs +11 -89
  162. package/es/components/tooltip-v2/src/trigger.mjs.map +1 -1
  163. package/es/components/tooltip-v2/src/trigger2.mjs +89 -11
  164. package/es/components/tooltip-v2/src/trigger2.mjs.map +1 -1
  165. package/es/components/upload/index.mjs +1 -1
  166. package/es/components/upload/src/upload-content.mjs +46 -15
  167. package/es/components/upload/src/upload-content.mjs.map +1 -1
  168. package/es/components/upload/src/upload-content2.mjs +15 -46
  169. package/es/components/upload/src/upload-content2.mjs.map +1 -1
  170. package/es/components/upload/src/upload2.mjs +1 -1
  171. package/es/index.mjs +23 -23
  172. package/lib/components/affix/index.js +2 -2
  173. package/lib/components/affix/src/affix.js +82 -19
  174. package/lib/components/affix/src/affix.js.map +1 -1
  175. package/lib/components/affix/src/affix2.js +19 -82
  176. package/lib/components/affix/src/affix2.js.map +1 -1
  177. package/lib/components/breadcrumb/index.js +2 -2
  178. package/lib/components/breadcrumb/src/breadcrumb-item.js +11 -46
  179. package/lib/components/breadcrumb/src/breadcrumb-item.js.map +1 -1
  180. package/lib/components/breadcrumb/src/breadcrumb-item2.js +46 -11
  181. package/lib/components/breadcrumb/src/breadcrumb-item2.js.map +1 -1
  182. package/lib/components/button/index.js +3 -3
  183. package/lib/components/button/src/button-group.js +5 -30
  184. package/lib/components/button/src/button-group.js.map +1 -1
  185. package/lib/components/button/src/button-group2.js +30 -5
  186. package/lib/components/button/src/button-group2.js.map +1 -1
  187. package/lib/components/button/src/button.js +96 -50
  188. package/lib/components/button/src/button.js.map +1 -1
  189. package/lib/components/button/src/button2.js +50 -96
  190. package/lib/components/button/src/button2.js.map +1 -1
  191. package/lib/components/calendar/index.js +2 -2
  192. package/lib/components/calendar/src/calendar.js +192 -9
  193. package/lib/components/calendar/src/calendar.js.map +1 -1
  194. package/lib/components/calendar/src/calendar2.js +9 -192
  195. package/lib/components/calendar/src/calendar2.js.map +1 -1
  196. package/lib/components/carousel/index.js +4 -4
  197. package/lib/components/carousel/src/carousel-item.js +7 -148
  198. package/lib/components/carousel/src/carousel-item.js.map +1 -1
  199. package/lib/components/carousel/src/carousel-item2.js +148 -7
  200. package/lib/components/carousel/src/carousel-item2.js.map +1 -1
  201. package/lib/components/carousel/src/carousel.js +43 -201
  202. package/lib/components/carousel/src/carousel.js.map +1 -1
  203. package/lib/components/carousel/src/carousel2.js +201 -43
  204. package/lib/components/carousel/src/carousel2.js.map +1 -1
  205. package/lib/components/cascader-panel/src/config.js +1 -1
  206. package/lib/components/cascader-panel/src/index.js +1 -1
  207. package/lib/components/cascader-panel/src/menu.js +1 -1
  208. package/lib/components/cascader-panel/src/node.js +200 -121
  209. package/lib/components/cascader-panel/src/node.js.map +1 -1
  210. package/lib/components/cascader-panel/src/node2.js +121 -200
  211. package/lib/components/cascader-panel/src/node2.js.map +1 -1
  212. package/lib/components/cascader-panel/src/store.js +1 -1
  213. package/lib/components/collection/index.js +1 -1
  214. package/lib/components/collection/src/collection.js +30 -9
  215. package/lib/components/collection/src/collection.js.map +1 -1
  216. package/lib/components/collection/src/collection2.js +9 -30
  217. package/lib/components/collection/src/collection2.js.map +1 -1
  218. package/lib/components/dialog/src/dialog-content.js +33 -78
  219. package/lib/components/dialog/src/dialog-content.js.map +1 -1
  220. package/lib/components/dialog/src/dialog-content2.js +78 -33
  221. package/lib/components/dialog/src/dialog-content2.js.map +1 -1
  222. package/lib/components/dialog/src/dialog.js +1 -1
  223. package/lib/components/dialog/src/dialog2.js +1 -1
  224. package/lib/components/divider/index.js +2 -2
  225. package/lib/components/divider/src/divider.js +34 -17
  226. package/lib/components/divider/src/divider.js.map +1 -1
  227. package/lib/components/divider/src/divider2.js +17 -34
  228. package/lib/components/divider/src/divider2.js.map +1 -1
  229. package/lib/components/drawer/index.js +2 -2
  230. package/lib/components/drawer/src/drawer.js +117 -23
  231. package/lib/components/drawer/src/drawer.js.map +1 -1
  232. package/lib/components/drawer/src/drawer2.js +23 -117
  233. package/lib/components/drawer/src/drawer2.js.map +1 -1
  234. package/lib/components/dropdown/index.js +2 -2
  235. package/lib/components/dropdown/src/dropdown-item-impl.js +1 -1
  236. package/lib/components/dropdown/src/dropdown-item.js +1 -1
  237. package/lib/components/dropdown/src/dropdown-menu.js +1 -1
  238. package/lib/components/dropdown/src/dropdown.js +109 -109
  239. package/lib/components/dropdown/src/dropdown.js.map +1 -1
  240. package/lib/components/dropdown/src/dropdown2.js +109 -109
  241. package/lib/components/dropdown/src/dropdown2.js.map +1 -1
  242. package/lib/components/form/index.js +4 -4
  243. package/lib/components/form/src/form-item.js +171 -47
  244. package/lib/components/form/src/form-item.js.map +1 -1
  245. package/lib/components/form/src/form-item2.js +47 -177
  246. package/lib/components/form/src/form-item2.js.map +1 -1
  247. package/lib/components/form/src/form.js +45 -40
  248. package/lib/components/form/src/form.js.map +1 -1
  249. package/lib/components/form/src/form2.js +40 -45
  250. package/lib/components/form/src/form2.js.map +1 -1
  251. package/lib/components/icon/index.js +2 -2
  252. package/lib/components/icon/src/icon.js +35 -8
  253. package/lib/components/icon/src/icon.js.map +1 -1
  254. package/lib/components/icon/src/icon2.js +8 -35
  255. package/lib/components/icon/src/icon2.js.map +1 -1
  256. package/lib/components/image/index.js +2 -2
  257. package/lib/components/image/src/image.js +50 -127
  258. package/lib/components/image/src/image.js.map +1 -1
  259. package/lib/components/image/src/image2.js +127 -50
  260. package/lib/components/image/src/image2.js.map +1 -1
  261. package/lib/components/index.js +23 -23
  262. package/lib/components/menu/index.js +2 -2
  263. package/lib/components/menu/src/menu-item.js +16 -74
  264. package/lib/components/menu/src/menu-item.js.map +1 -1
  265. package/lib/components/menu/src/menu-item2.js +74 -16
  266. package/lib/components/menu/src/menu-item2.js.map +1 -1
  267. package/lib/components/popconfirm/index.js +2 -2
  268. package/lib/components/popconfirm/src/popconfirm.js +53 -20
  269. package/lib/components/popconfirm/src/popconfirm.js.map +1 -1
  270. package/lib/components/popconfirm/src/popconfirm2.js +22 -53
  271. package/lib/components/popconfirm/src/popconfirm2.js.map +1 -1
  272. package/lib/components/popover/src/popover.js +1 -1
  273. package/lib/components/popper/index.js +2 -2
  274. package/lib/components/popper/src/trigger.js +17 -28
  275. package/lib/components/popper/src/trigger.js.map +1 -1
  276. package/lib/components/popper/src/trigger2.js +28 -17
  277. package/lib/components/popper/src/trigger2.js.map +1 -1
  278. package/lib/components/progress/index.js +2 -2
  279. package/lib/components/progress/src/progress.js +57 -230
  280. package/lib/components/progress/src/progress.js.map +1 -1
  281. package/lib/components/progress/src/progress2.js +230 -57
  282. package/lib/components/progress/src/progress2.js.map +1 -1
  283. package/lib/components/roving-focus-group/index.js +2 -2
  284. package/lib/components/roving-focus-group/src/roving-focus-group-impl.js +1 -1
  285. package/lib/components/roving-focus-group/src/roving-focus-group.js +33 -27
  286. package/lib/components/roving-focus-group/src/roving-focus-group.js.map +1 -1
  287. package/lib/components/roving-focus-group/src/roving-focus-group2.js +27 -33
  288. package/lib/components/roving-focus-group/src/roving-focus-group2.js.map +1 -1
  289. package/lib/components/roving-focus-group/src/roving-focus-item.js +1 -1
  290. package/lib/components/skeleton/index.js +2 -2
  291. package/lib/components/skeleton/src/skeleton-item.js +23 -18
  292. package/lib/components/skeleton/src/skeleton-item.js.map +1 -1
  293. package/lib/components/skeleton/src/skeleton-item2.js +18 -23
  294. package/lib/components/skeleton/src/skeleton-item2.js.map +1 -1
  295. package/lib/components/skeleton/src/skeleton2.js +1 -1
  296. package/lib/components/tabs/index.js +3 -3
  297. package/lib/components/tabs/src/tab-bar.js +76 -7
  298. package/lib/components/tabs/src/tab-bar.js.map +1 -1
  299. package/lib/components/tabs/src/tab-bar2.js +7 -76
  300. package/lib/components/tabs/src/tab-bar2.js.map +1 -1
  301. package/lib/components/tabs/src/tab-nav.js +1 -1
  302. package/lib/components/tabs/src/tab-pane.js +15 -61
  303. package/lib/components/tabs/src/tab-pane.js.map +1 -1
  304. package/lib/components/tabs/src/tab-pane2.js +61 -15
  305. package/lib/components/tabs/src/tab-pane2.js.map +1 -1
  306. package/lib/components/timeline/index.js +2 -2
  307. package/lib/components/timeline/src/timeline-item.js +39 -73
  308. package/lib/components/timeline/src/timeline-item.js.map +1 -1
  309. package/lib/components/timeline/src/timeline-item2.js +73 -39
  310. package/lib/components/timeline/src/timeline-item2.js.map +1 -1
  311. package/lib/components/tooltip/src/tooltip.js +1 -1
  312. package/lib/components/tooltip/src/tooltip2.js +3 -1
  313. package/lib/components/tooltip/src/tooltip2.js.map +1 -1
  314. package/lib/components/tooltip/src/trigger.js +1 -1
  315. package/lib/components/tooltip-v2/index.js +3 -3
  316. package/lib/components/tooltip-v2/src/content.js +50 -113
  317. package/lib/components/tooltip-v2/src/content.js.map +1 -1
  318. package/lib/components/tooltip-v2/src/content2.js +113 -50
  319. package/lib/components/tooltip-v2/src/content2.js.map +1 -1
  320. package/lib/components/tooltip-v2/src/root.js +17 -81
  321. package/lib/components/tooltip-v2/src/root.js.map +1 -1
  322. package/lib/components/tooltip-v2/src/root2.js +81 -17
  323. package/lib/components/tooltip-v2/src/root2.js.map +1 -1
  324. package/lib/components/tooltip-v2/src/tooltip.js +3 -3
  325. package/lib/components/tooltip-v2/src/tooltip2.js +6 -6
  326. package/lib/components/tooltip-v2/src/trigger.js +11 -89
  327. package/lib/components/tooltip-v2/src/trigger.js.map +1 -1
  328. package/lib/components/tooltip-v2/src/trigger2.js +89 -11
  329. package/lib/components/tooltip-v2/src/trigger2.js.map +1 -1
  330. package/lib/components/upload/index.js +1 -1
  331. package/lib/components/upload/src/upload-content.js +46 -15
  332. package/lib/components/upload/src/upload-content.js.map +1 -1
  333. package/lib/components/upload/src/upload-content2.js +15 -46
  334. package/lib/components/upload/src/upload-content2.js.map +1 -1
  335. package/lib/components/upload/src/upload2.js +1 -1
  336. package/lib/index.js +23 -23
  337. package/package.json +1 -1
  338. package/web-types.json +1 -1
@@ -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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AA,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
@@ -1 +1 @@
1
- {"version":3,"file":"calendar.mjs","sources":["../../../../../../packages/components/calendar/src/calendar.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-ps/utils'\nimport { UPDATE_MODEL_EVENT } from '@element-ps/constants'\nimport type { ExtractPropTypes } from 'vue'\nimport type Calendar from './calendar.vue'\n\nexport type CalendarDateType =\n | 'prev-month'\n | 'next-month'\n | 'prev-year'\n | 'next-year'\n | 'today'\n\nexport const calendarProps = buildProps({\n modelValue: {\n type: Date,\n },\n range: {\n type: definePropType<[Date, Date]>(Array),\n validator: (range: unknown): range is [Date, Date] =>\n Array.isArray(range) &&\n range.length === 2 &&\n range.every((item) => item instanceof Date),\n },\n} as const)\nexport type CalendarProps = ExtractPropTypes<typeof calendarProps>\n\nexport type CalendarInstance = InstanceType<typeof Calendar>\n"],"names":[],"mappings":";;;AACY,MAAC,aAAa,GAAG,UAAU,CAAC;AACxC,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,IAAI;AACd,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,SAAS,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,IAAI,YAAY,IAAI,CAAC;AACnH,GAAG;AACH,CAAC;;;;"}
1
+ {"version":3,"file":"calendar.mjs","sources":["../../../../../../packages/components/calendar/src/calendar.vue"],"sourcesContent":["<template>\n <div :class=\"ns.b()\">\n <div :class=\"ns.e('header')\">\n <slot name=\"header\" :date=\"i18nDate\">\n <div :class=\"ns.e('title')\">{{ i18nDate }}</div>\n <div v-if=\"validatedRange.length === 0\" :class=\"ns.e('button-group')\">\n <ps-button-group>\n <ps-button size=\"small\">\n {{ t('el.datepicker.prevMonth') }}\n </ps-button>\n <ps-button size=\"small\">\n {{ t('el.datepicker.today') }}\n </ps-button>\n <ps-button size=\"small\">\n {{ t('el.datepicker.nextMonth') }}\n </ps-button>\n </ps-button-group>\n </div>\n </slot>\n </div>\n <div v-if=\"validatedRange.length === 0\" :class=\"ns.e('body')\">\n <date-table :date=\"date\" :selected-day=\"realSelectedDay\">\n <template v-if=\"$slots.dateCell\" #dateCell=\"data\">\n <slot name=\"dateCell\" v-bind=\"data\" />\n </template>\n </date-table>\n </div>\n <div v-else :class=\"ns.e('body')\">\n <date-table\n v-for=\"(range_, index) in validatedRange\"\n :key=\"index\"\n :date=\"range_[0]\"\n :selected-day=\"realSelectedDay\"\n :range=\"range_\"\n :hide-header=\"index !== 0\"\n >\n <template v-if=\"$slots.dateCell\" #dateCell=\"data\">\n <slot name=\"dateCell\" v-bind=\"data\" />\n </template>\n </date-table>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, ref } from 'vue'\nimport dayjs from 'dayjs'\nimport { PsButton, PsButtonGroup } from '@element-ps/components/button'\nimport { useLocale, useNamespace } from '@element-ps/hooks'\nimport { debugWarn } from '@element-ps/utils'\nimport DateTable from './date-table.vue'\nimport { calendarProps } from './calendar'\n\nimport type { ComputedRef } from 'vue'\nimport type { Dayjs } from 'dayjs'\n\nconst COMPONENT_NAME = 'PsCalendar'\n\ndefineOptions({\n name: 'PsCalendar',\n})\n\nconst props = defineProps(calendarProps)\n\nconst ns = useNamespace('calendar')\n\nconst { t, lang } = useLocale()\nconst selectedDay = ref<Dayjs>()\nconst now = dayjs().locale(lang.value)\n\nconst i18nDate = computed(() => {\n const pickedMonth = `el.datepicker.month${date.value.format('M')}`\n return `${date.value.year()} ${t('el.datepicker.year')} ${t(pickedMonth)}`\n})\n\nconst realSelectedDay = computed<Dayjs | undefined>({\n get() {\n if (!props.modelValue) return selectedDay.value\n return date.value\n },\n set(val) {\n if (!val) return\n selectedDay.value = val\n },\n})\n\nconst date: ComputedRef<Dayjs> = computed(() => {\n if (!props.modelValue) {\n if (realSelectedDay.value) {\n return realSelectedDay.value\n } else if (validatedRange.value.length) {\n return validatedRange.value[0][0]\n }\n return now\n } else {\n return dayjs(props.modelValue).locale(lang.value)\n }\n})\n\n// https://github.com/element-ps/element-ps/issues/3155\n// Calculate the validate date range according to the start and end dates\nconst calculateValidatedDateRange = (\n startDayjs: Dayjs,\n endDayjs: Dayjs\n): [Dayjs, Dayjs][] => {\n const firstDay = startDayjs.startOf('week')\n const lastDay = endDayjs.endOf('week')\n const firstMonth = firstDay.get('month')\n const lastMonth = lastDay.get('month')\n\n // Current mouth\n if (firstMonth === lastMonth) {\n return [[firstDay, lastDay]]\n }\n // Two adjacent months\n else if (firstMonth + 1 === lastMonth) {\n const firstMonthLastDay = firstDay.endOf('month')\n const lastMonthFirstDay = lastDay.startOf('month')\n\n // Whether the last day of the first month and the first day of the last month is in the same week\n const isSameWeek = firstMonthLastDay.isSame(lastMonthFirstDay, 'week')\n const lastMonthStartDay = isSameWeek\n ? lastMonthFirstDay.add(1, 'week')\n : lastMonthFirstDay\n\n return [\n [firstDay, firstMonthLastDay],\n [lastMonthStartDay.startOf('week'), lastDay],\n ]\n }\n // Three consecutive months (compatible: 2021-01-30 to 2021-02-28)\n else if (\n firstMonth + 2 === lastMonth ||\n (firstMonth + 1) % 11 === lastMonth\n ) {\n const firstMonthLastDay = firstDay.endOf('month')\n const secondMonthFirstDay = firstDay.add(1, 'month').startOf('month')\n\n // Whether the last day of the first month and the second month is in the same week\n const secondMonthStartDay = firstMonthLastDay.isSame(\n secondMonthFirstDay,\n 'week'\n )\n ? secondMonthFirstDay.add(1, 'week')\n : secondMonthFirstDay\n\n const secondMonthLastDay = secondMonthStartDay.endOf('month')\n const lastMonthFirstDay = lastDay.startOf('month')\n\n // Whether the last day of the second month and the last day of the last month is in the same week\n const lastMonthStartDay = secondMonthLastDay.isSame(\n lastMonthFirstDay,\n 'week'\n )\n ? lastMonthFirstDay.add(1, 'week')\n : lastMonthFirstDay\n\n return [\n [firstDay, firstMonthLastDay],\n [secondMonthStartDay.startOf('week'), secondMonthLastDay],\n [lastMonthStartDay.startOf('week'), lastDay],\n ]\n }\n // Other cases\n else {\n debugWarn(\n COMPONENT_NAME,\n 'start time and end time interval must not exceed two months'\n )\n return []\n }\n}\n\n// if range is valid, we get a two-digit array\nconst validatedRange = computed(() => {\n if (!props.range) return []\n const rangeArrDayjs = props.range.map((_) => dayjs(_).locale(lang.value))\n const [startDayjs, endDayjs] = rangeArrDayjs\n if (startDayjs.isAfter(endDayjs)) {\n debugWarn(COMPONENT_NAME, 'end time should be greater than start time')\n return []\n }\n if (startDayjs.isSame(endDayjs, 'month')) {\n // same month\n return calculateValidatedDateRange(startDayjs, endDayjs)\n } else {\n // two months\n if (startDayjs.add(1, 'month').month() !== endDayjs.month()) {\n debugWarn(\n COMPONENT_NAME,\n 'start time and end time interval must not exceed two months'\n )\n return []\n }\n return calculateValidatedDateRange(startDayjs, endDayjs)\n }\n})\n\ndefineExpose({\n /** @description currently selected date */\n selectedDay: realSelectedDay,\n /** @description Calculate the validate date range according to the start and end dates */\n calculateValidatedDateRange,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAwDA,IAAA,MAAA,cAAA,GAAA,YAAA,CAAA;AAQA,IAAA,MAAA,EAAA,GAAA,aAAA,UAAA,CAAA,CAAA;AAEA,IAAA,MAAA,EAAA,CAAA,EAAA,IAAA,EAAA,GAAA,SAAA,EAAA,CAAA;AACA,IAAA,MAAA,cAAA,GAAA,EAAA,CAAA;AACA,IAAA,MAAA,GAAA,GAAA,KAAA,EAAA,CAAA,MAAA,CAAA,KAAA,KAAA,CAAA,CAAA;AAEA,IAAA,MAAA,QAAA,GAAA,SAAA,MAAA;AACA,MAAA,MAAA,WAAA,GAAA,CAAA,mBAAA,EAAA,IAAA,CAAA,KAAA,CAAA,OA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