element-ps 2.0.34 → 2.0.35

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 +65 -373
  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 +65 -373
  7. package/es/components/alert/index.mjs +2 -2
  8. package/es/components/alert/src/alert.mjs +33 -83
  9. package/es/components/alert/src/alert.mjs.map +1 -1
  10. package/es/components/alert/src/alert2.mjs +83 -33
  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 +94 -58
  14. package/es/components/autocomplete/src/autocomplete.mjs.map +1 -1
  15. package/es/components/autocomplete/src/autocomplete2.mjs +58 -94
  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 +61 -29
  19. package/es/components/avatar/src/avatar.mjs.map +1 -1
  20. package/es/components/avatar/src/avatar2.mjs +29 -61
  21. package/es/components/avatar/src/avatar2.mjs.map +1 -1
  22. package/es/components/backtop/index.mjs +2 -2
  23. package/es/components/backtop/src/backtop.mjs +59 -18
  24. package/es/components/backtop/src/backtop.mjs.map +1 -1
  25. package/es/components/backtop/src/backtop2.mjs +18 -59
  26. package/es/components/backtop/src/backtop2.mjs.map +1 -1
  27. package/es/components/badge/index.mjs +2 -2
  28. package/es/components/badge/src/badge.mjs +54 -17
  29. package/es/components/badge/src/badge.mjs.map +1 -1
  30. package/es/components/badge/src/badge2.mjs +17 -54
  31. package/es/components/badge/src/badge2.mjs.map +1 -1
  32. package/es/components/button/index.mjs +2 -2
  33. package/es/components/button/src/button-group2.mjs +1 -1
  34. package/es/components/button/src/button.mjs +96 -48
  35. package/es/components/button/src/button.mjs.map +1 -1
  36. package/es/components/button/src/button2.mjs +48 -96
  37. package/es/components/button/src/button2.mjs.map +1 -1
  38. package/es/components/calendar/src/calendar2.mjs +1 -1
  39. package/es/components/calendar/src/date-table.mjs +146 -27
  40. package/es/components/calendar/src/date-table.mjs.map +1 -1
  41. package/es/components/calendar/src/date-table2.mjs +27 -146
  42. package/es/components/calendar/src/date-table2.mjs.map +1 -1
  43. package/es/components/card/index.mjs +2 -2
  44. package/es/components/card/src/card.mjs +15 -35
  45. package/es/components/card/src/card.mjs.map +1 -1
  46. package/es/components/card/src/card2.mjs +35 -15
  47. package/es/components/card/src/card2.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/drawer/index.mjs +2 -2
  54. package/es/components/drawer/src/drawer.mjs +117 -23
  55. package/es/components/drawer/src/drawer.mjs.map +1 -1
  56. package/es/components/drawer/src/drawer2.mjs +23 -117
  57. package/es/components/drawer/src/drawer2.mjs.map +1 -1
  58. package/es/components/dropdown/src/dropdown2.mjs +1 -1
  59. package/es/components/form/index.mjs +2 -2
  60. package/es/components/form/src/form-item2.mjs +2 -8
  61. package/es/components/form/src/form-item2.mjs.map +1 -1
  62. package/es/components/form/src/form.mjs +45 -40
  63. package/es/components/form/src/form.mjs.map +1 -1
  64. package/es/components/form/src/form2.mjs +40 -45
  65. package/es/components/form/src/form2.mjs.map +1 -1
  66. package/es/components/icon/index.mjs +2 -2
  67. package/es/components/icon/src/icon.mjs +35 -8
  68. package/es/components/icon/src/icon.mjs.map +1 -1
  69. package/es/components/icon/src/icon2.mjs +8 -35
  70. package/es/components/icon/src/icon2.mjs.map +1 -1
  71. package/es/components/image/index.mjs +2 -2
  72. package/es/components/image/src/image.mjs +50 -127
  73. package/es/components/image/src/image.mjs.map +1 -1
  74. package/es/components/image/src/image2.mjs +127 -50
  75. package/es/components/image/src/image2.mjs.map +1 -1
  76. package/es/components/image-viewer/index.mjs +2 -2
  77. package/es/components/image-viewer/src/image-viewer.mjs +210 -31
  78. package/es/components/image-viewer/src/image-viewer.mjs.map +1 -1
  79. package/es/components/image-viewer/src/image-viewer2.mjs +31 -210
  80. package/es/components/image-viewer/src/image-viewer2.mjs.map +1 -1
  81. package/es/components/index.mjs +26 -26
  82. package/es/components/input/index.mjs +2 -2
  83. package/es/components/input/src/input.mjs +295 -85
  84. package/es/components/input/src/input.mjs.map +1 -1
  85. package/es/components/input/src/input2.mjs +85 -295
  86. package/es/components/input/src/input2.mjs.map +1 -1
  87. package/es/components/menu/index.mjs +2 -2
  88. package/es/components/menu/src/menu-item-group.mjs +4 -35
  89. package/es/components/menu/src/menu-item-group.mjs.map +1 -1
  90. package/es/components/menu/src/menu-item-group2.mjs +35 -4
  91. package/es/components/menu/src/menu-item-group2.mjs.map +1 -1
  92. package/es/components/popconfirm/src/popconfirm2.mjs +1 -1
  93. package/es/components/popper/index.mjs +2 -2
  94. package/es/components/popper/src/trigger.mjs +17 -28
  95. package/es/components/popper/src/trigger.mjs.map +1 -1
  96. package/es/components/popper/src/trigger2.mjs +28 -17
  97. package/es/components/popper/src/trigger2.mjs.map +1 -1
  98. package/es/components/radio/index.mjs +4 -4
  99. package/es/components/radio/src/radio-button.mjs +1 -1
  100. package/es/components/radio/src/radio-button2.mjs +1 -1
  101. package/es/components/radio/src/radio-group.mjs +37 -18
  102. package/es/components/radio/src/radio-group.mjs.map +1 -1
  103. package/es/components/radio/src/radio-group2.mjs +18 -37
  104. package/es/components/radio/src/radio-group2.mjs.map +1 -1
  105. package/es/components/radio/src/radio.mjs +74 -62
  106. package/es/components/radio/src/radio.mjs.map +1 -1
  107. package/es/components/radio/src/radio2.mjs +62 -74
  108. package/es/components/radio/src/radio2.mjs.map +1 -1
  109. package/es/components/result/index.mjs +2 -2
  110. package/es/components/result/src/result.mjs +73 -28
  111. package/es/components/result/src/result.mjs.map +1 -1
  112. package/es/components/result/src/result2.mjs +28 -73
  113. package/es/components/result/src/result2.mjs.map +1 -1
  114. package/es/components/roving-focus-group/src/roving-focus-group2.mjs +1 -1
  115. package/es/components/scrollbar/index.mjs +2 -2
  116. package/es/components/scrollbar/src/scrollbar.mjs +112 -42
  117. package/es/components/scrollbar/src/scrollbar.mjs.map +1 -1
  118. package/es/components/scrollbar/src/scrollbar2.mjs +42 -112
  119. package/es/components/scrollbar/src/scrollbar2.mjs.map +1 -1
  120. package/es/components/skeleton/index.mjs +2 -2
  121. package/es/components/skeleton/src/skeleton.mjs +49 -22
  122. package/es/components/skeleton/src/skeleton.mjs.map +1 -1
  123. package/es/components/skeleton/src/skeleton2.mjs +22 -49
  124. package/es/components/skeleton/src/skeleton2.mjs.map +1 -1
  125. package/es/components/switch/index.mjs +2 -2
  126. package/es/components/switch/src/switch.mjs +81 -176
  127. package/es/components/switch/src/switch.mjs.map +1 -1
  128. package/es/components/switch/src/switch2.mjs +176 -81
  129. package/es/components/switch/src/switch2.mjs.map +1 -1
  130. package/es/components/tabs/index.mjs +1 -1
  131. package/es/components/tabs/src/tab-bar.mjs +76 -7
  132. package/es/components/tabs/src/tab-bar.mjs.map +1 -1
  133. package/es/components/tabs/src/tab-bar2.mjs +7 -76
  134. package/es/components/tabs/src/tab-bar2.mjs.map +1 -1
  135. package/es/components/tabs/src/tab-nav.mjs +1 -1
  136. package/es/components/timeline/index.mjs +2 -2
  137. package/es/components/timeline/src/timeline-item.mjs +39 -73
  138. package/es/components/timeline/src/timeline-item.mjs.map +1 -1
  139. package/es/components/timeline/src/timeline-item2.mjs +73 -39
  140. package/es/components/timeline/src/timeline-item2.mjs.map +1 -1
  141. package/es/components/tooltip/src/tooltip.mjs +1 -1
  142. package/es/components/tooltip/src/trigger.mjs +1 -1
  143. package/es/components/tooltip-v2/index.mjs +2 -2
  144. package/es/components/tooltip-v2/src/root.mjs +17 -81
  145. package/es/components/tooltip-v2/src/root.mjs.map +1 -1
  146. package/es/components/tooltip-v2/src/root2.mjs +81 -17
  147. package/es/components/tooltip-v2/src/root2.mjs.map +1 -1
  148. package/es/components/tooltip-v2/src/tooltip.mjs +2 -2
  149. package/es/components/tooltip-v2/src/tooltip2.mjs +4 -4
  150. package/es/components/tooltip-v2/src/trigger.mjs +11 -89
  151. package/es/components/tooltip-v2/src/trigger.mjs.map +1 -1
  152. package/es/components/tooltip-v2/src/trigger2.mjs +89 -11
  153. package/es/components/tooltip-v2/src/trigger2.mjs.map +1 -1
  154. package/es/components/upload/index.mjs +2 -2
  155. package/es/components/upload/src/upload-content2.mjs +1 -1
  156. package/es/components/upload/src/upload-dragger.mjs +11 -32
  157. package/es/components/upload/src/upload-dragger.mjs.map +1 -1
  158. package/es/components/upload/src/upload-dragger2.mjs +32 -11
  159. package/es/components/upload/src/upload-dragger2.mjs.map +1 -1
  160. package/es/components/upload/src/upload-list.mjs +155 -26
  161. package/es/components/upload/src/upload-list.mjs.map +1 -1
  162. package/es/components/upload/src/upload-list2.mjs +26 -155
  163. package/es/components/upload/src/upload-list2.mjs.map +1 -1
  164. package/es/components/upload/src/upload2.mjs +1 -1
  165. package/es/index.mjs +26 -26
  166. package/lib/components/alert/index.js +2 -2
  167. package/lib/components/alert/src/alert.js +33 -82
  168. package/lib/components/alert/src/alert.js.map +1 -1
  169. package/lib/components/alert/src/alert2.js +82 -33
  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 +94 -58
  173. package/lib/components/autocomplete/src/autocomplete.js.map +1 -1
  174. package/lib/components/autocomplete/src/autocomplete2.js +58 -94
  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 +61 -29
  178. package/lib/components/avatar/src/avatar.js.map +1 -1
  179. package/lib/components/avatar/src/avatar2.js +29 -61
  180. package/lib/components/avatar/src/avatar2.js.map +1 -1
  181. package/lib/components/backtop/index.js +2 -2
  182. package/lib/components/backtop/src/backtop.js +59 -18
  183. package/lib/components/backtop/src/backtop.js.map +1 -1
  184. package/lib/components/backtop/src/backtop2.js +18 -59
  185. package/lib/components/backtop/src/backtop2.js.map +1 -1
  186. package/lib/components/badge/index.js +2 -2
  187. package/lib/components/badge/src/badge.js +54 -17
  188. package/lib/components/badge/src/badge.js.map +1 -1
  189. package/lib/components/badge/src/badge2.js +17 -54
  190. package/lib/components/badge/src/badge2.js.map +1 -1
  191. package/lib/components/button/index.js +2 -2
  192. package/lib/components/button/src/button-group2.js +1 -1
  193. package/lib/components/button/src/button.js +96 -50
  194. package/lib/components/button/src/button.js.map +1 -1
  195. package/lib/components/button/src/button2.js +50 -96
  196. package/lib/components/button/src/button2.js.map +1 -1
  197. package/lib/components/calendar/src/calendar2.js +1 -1
  198. package/lib/components/calendar/src/date-table.js +151 -30
  199. package/lib/components/calendar/src/date-table.js.map +1 -1
  200. package/lib/components/calendar/src/date-table2.js +30 -151
  201. package/lib/components/calendar/src/date-table2.js.map +1 -1
  202. package/lib/components/card/index.js +2 -2
  203. package/lib/components/card/src/card.js +15 -35
  204. package/lib/components/card/src/card.js.map +1 -1
  205. package/lib/components/card/src/card2.js +35 -15
  206. package/lib/components/card/src/card2.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/drawer/index.js +2 -2
  213. package/lib/components/drawer/src/drawer.js +117 -23
  214. package/lib/components/drawer/src/drawer.js.map +1 -1
  215. package/lib/components/drawer/src/drawer2.js +23 -117
  216. package/lib/components/drawer/src/drawer2.js.map +1 -1
  217. package/lib/components/dropdown/src/dropdown2.js +1 -1
  218. package/lib/components/form/index.js +2 -2
  219. package/lib/components/form/src/form-item2.js +1 -7
  220. package/lib/components/form/src/form-item2.js.map +1 -1
  221. package/lib/components/form/src/form.js +45 -40
  222. package/lib/components/form/src/form.js.map +1 -1
  223. package/lib/components/form/src/form2.js +40 -45
  224. package/lib/components/form/src/form2.js.map +1 -1
  225. package/lib/components/icon/index.js +2 -2
  226. package/lib/components/icon/src/icon.js +35 -8
  227. package/lib/components/icon/src/icon.js.map +1 -1
  228. package/lib/components/icon/src/icon2.js +8 -35
  229. package/lib/components/icon/src/icon2.js.map +1 -1
  230. package/lib/components/image/index.js +2 -2
  231. package/lib/components/image/src/image.js +50 -127
  232. package/lib/components/image/src/image.js.map +1 -1
  233. package/lib/components/image/src/image2.js +127 -50
  234. package/lib/components/image/src/image2.js.map +1 -1
  235. package/lib/components/image-viewer/index.js +2 -2
  236. package/lib/components/image-viewer/src/image-viewer.js +210 -31
  237. package/lib/components/image-viewer/src/image-viewer.js.map +1 -1
  238. package/lib/components/image-viewer/src/image-viewer2.js +31 -210
  239. package/lib/components/image-viewer/src/image-viewer2.js.map +1 -1
  240. package/lib/components/index.js +26 -26
  241. package/lib/components/input/index.js +2 -2
  242. package/lib/components/input/src/input.js +294 -84
  243. package/lib/components/input/src/input.js.map +1 -1
  244. package/lib/components/input/src/input2.js +84 -294
  245. package/lib/components/input/src/input2.js.map +1 -1
  246. package/lib/components/menu/index.js +2 -2
  247. package/lib/components/menu/src/menu-item-group.js +4 -35
  248. package/lib/components/menu/src/menu-item-group.js.map +1 -1
  249. package/lib/components/menu/src/menu-item-group2.js +35 -4
  250. package/lib/components/menu/src/menu-item-group2.js.map +1 -1
  251. package/lib/components/popconfirm/src/popconfirm2.js +1 -1
  252. package/lib/components/popper/index.js +2 -2
  253. package/lib/components/popper/src/trigger.js +17 -28
  254. package/lib/components/popper/src/trigger.js.map +1 -1
  255. package/lib/components/popper/src/trigger2.js +28 -17
  256. package/lib/components/popper/src/trigger2.js.map +1 -1
  257. package/lib/components/radio/index.js +4 -4
  258. package/lib/components/radio/src/radio-button.js +1 -1
  259. package/lib/components/radio/src/radio-button2.js +1 -1
  260. package/lib/components/radio/src/radio-group.js +37 -18
  261. package/lib/components/radio/src/radio-group.js.map +1 -1
  262. package/lib/components/radio/src/radio-group2.js +18 -37
  263. package/lib/components/radio/src/radio-group2.js.map +1 -1
  264. package/lib/components/radio/src/radio.js +73 -64
  265. package/lib/components/radio/src/radio.js.map +1 -1
  266. package/lib/components/radio/src/radio2.js +64 -73
  267. package/lib/components/radio/src/radio2.js.map +1 -1
  268. package/lib/components/result/index.js +2 -2
  269. package/lib/components/result/src/result.js +73 -30
  270. package/lib/components/result/src/result.js.map +1 -1
  271. package/lib/components/result/src/result2.js +30 -73
  272. package/lib/components/result/src/result2.js.map +1 -1
  273. package/lib/components/roving-focus-group/src/roving-focus-group2.js +1 -1
  274. package/lib/components/scrollbar/index.js +2 -2
  275. package/lib/components/scrollbar/src/scrollbar.js +112 -42
  276. package/lib/components/scrollbar/src/scrollbar.js.map +1 -1
  277. package/lib/components/scrollbar/src/scrollbar2.js +42 -112
  278. package/lib/components/scrollbar/src/scrollbar2.js.map +1 -1
  279. package/lib/components/skeleton/index.js +2 -2
  280. package/lib/components/skeleton/src/skeleton.js +49 -22
  281. package/lib/components/skeleton/src/skeleton.js.map +1 -1
  282. package/lib/components/skeleton/src/skeleton2.js +22 -49
  283. package/lib/components/skeleton/src/skeleton2.js.map +1 -1
  284. package/lib/components/switch/index.js +2 -2
  285. package/lib/components/switch/src/switch.js +81 -176
  286. package/lib/components/switch/src/switch.js.map +1 -1
  287. package/lib/components/switch/src/switch2.js +176 -81
  288. package/lib/components/switch/src/switch2.js.map +1 -1
  289. package/lib/components/tabs/index.js +1 -1
  290. package/lib/components/tabs/src/tab-bar.js +76 -7
  291. package/lib/components/tabs/src/tab-bar.js.map +1 -1
  292. package/lib/components/tabs/src/tab-bar2.js +7 -76
  293. package/lib/components/tabs/src/tab-bar2.js.map +1 -1
  294. package/lib/components/tabs/src/tab-nav.js +1 -1
  295. package/lib/components/timeline/index.js +2 -2
  296. package/lib/components/timeline/src/timeline-item.js +39 -73
  297. package/lib/components/timeline/src/timeline-item.js.map +1 -1
  298. package/lib/components/timeline/src/timeline-item2.js +73 -39
  299. package/lib/components/timeline/src/timeline-item2.js.map +1 -1
  300. package/lib/components/tooltip/src/tooltip.js +1 -1
  301. package/lib/components/tooltip/src/trigger.js +1 -1
  302. package/lib/components/tooltip-v2/index.js +2 -2
  303. package/lib/components/tooltip-v2/src/root.js +17 -81
  304. package/lib/components/tooltip-v2/src/root.js.map +1 -1
  305. package/lib/components/tooltip-v2/src/root2.js +81 -17
  306. package/lib/components/tooltip-v2/src/root2.js.map +1 -1
  307. package/lib/components/tooltip-v2/src/tooltip.js +2 -2
  308. package/lib/components/tooltip-v2/src/tooltip2.js +4 -4
  309. package/lib/components/tooltip-v2/src/trigger.js +11 -89
  310. package/lib/components/tooltip-v2/src/trigger.js.map +1 -1
  311. package/lib/components/tooltip-v2/src/trigger2.js +89 -11
  312. package/lib/components/tooltip-v2/src/trigger2.js.map +1 -1
  313. package/lib/components/upload/index.js +2 -2
  314. package/lib/components/upload/src/upload-content2.js +1 -1
  315. package/lib/components/upload/src/upload-dragger.js +12 -32
  316. package/lib/components/upload/src/upload-dragger.js.map +1 -1
  317. package/lib/components/upload/src/upload-dragger2.js +32 -12
  318. package/lib/components/upload/src/upload-dragger2.js.map +1 -1
  319. package/lib/components/upload/src/upload-list.js +155 -27
  320. package/lib/components/upload/src/upload-list.js.map +1 -1
  321. package/lib/components/upload/src/upload-list2.js +27 -155
  322. package/lib/components/upload/src/upload-list2.js.map +1 -1
  323. package/lib/components/upload/src/upload2.js +1 -1
  324. package/lib/index.js +26 -26
  325. package/package.json +1 -1
  326. package/web-types.json +1 -1
@@ -1,35 +1,154 @@
1
- import '../../../utils/index.mjs';
1
+ import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, Fragment, renderList, toDisplayString, createCommentVNode, createElementVNode, renderSlot } from 'vue';
2
+ import dayjs from 'dayjs';
3
+ import localeData from 'dayjs/plugin/localeData.js';
4
+ import '../../../hooks/index.mjs';
2
5
  import '../../time-picker/index.mjs';
6
+ import '../../../constants/index.mjs';
7
+ import { dateTableProps, getPrevMonthLastDays, getMonthDays, toNestedArr } from './date-table2.mjs';
8
+ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
9
+ import { useLocale } from '../../../hooks/use-locale/index.mjs';
10
+ import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
3
11
  import { rangeArr } from '../../time-picker/src/common/date-utils.mjs';
4
- import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
12
+ import { WEEK_DAYS } from '../../../constants/date.mjs';
5
13
 
6
- const getPrevMonthLastDays = (date, count) => {
7
- const lastDay = date.subtract(1, "month").endOf("month").date();
8
- return rangeArr(count).map((_, index) => lastDay - (count - index - 1));
14
+ const _hoisted_1 = { key: 0 };
15
+ const __default__ = {
16
+ name: "DateTable"
9
17
  };
10
- const getMonthDays = (date) => {
11
- const days = date.daysInMonth();
12
- return rangeArr(days).map((_, index) => index + 1);
13
- };
14
- const toNestedArr = (days) => rangeArr(days.length / 7).map((index) => {
15
- const start = index * 7;
16
- return days.slice(start, start + 7);
17
- });
18
- const dateTableProps = buildProps({
19
- selectedDay: {
20
- type: definePropType(Object)
21
- },
22
- range: {
23
- type: definePropType(Array)
24
- },
25
- date: {
26
- type: definePropType(Object),
27
- required: true
28
- },
29
- hideHeader: {
30
- type: Boolean
18
+ const _sfc_main = /* @__PURE__ */ defineComponent({
19
+ ...__default__,
20
+ props: dateTableProps,
21
+ setup(__props, { expose }) {
22
+ const props = __props;
23
+ dayjs.extend(localeData);
24
+ const { t, lang } = useLocale();
25
+ const nsTable = useNamespace("calendar-table");
26
+ const nsDay = useNamespace("calendar-day");
27
+ const now = dayjs().locale(lang.value);
28
+ const firstDayOfWeek = now.$locale().weekStart || 0;
29
+ const isInRange = computed(() => !!props.range && !!props.range.length);
30
+ const rows = computed(() => {
31
+ let days = [];
32
+ if (isInRange.value) {
33
+ const [start, end] = props.range;
34
+ const currentMonthRange = rangeArr(end.date() - start.date() + 1).map((index) => ({
35
+ text: start.date() + index,
36
+ type: "current"
37
+ }));
38
+ let remaining = currentMonthRange.length % 7;
39
+ remaining = remaining === 0 ? 0 : 7 - remaining;
40
+ const nextMonthRange = rangeArr(remaining).map((_, index) => ({
41
+ text: index + 1,
42
+ type: "next"
43
+ }));
44
+ days = currentMonthRange.concat(nextMonthRange);
45
+ } else {
46
+ const firstDay = props.date.startOf("month").day();
47
+ const prevMonthDays = getPrevMonthLastDays(props.date, firstDay - firstDayOfWeek).map((day) => ({
48
+ text: day,
49
+ type: "prev"
50
+ }));
51
+ const currentMonthDays = getMonthDays(props.date).map((day) => ({
52
+ text: day,
53
+ type: "current"
54
+ }));
55
+ days = [...prevMonthDays, ...currentMonthDays];
56
+ const remaining = 7 - (days.length % 7 || 7);
57
+ const nextMonthDays = rangeArr(remaining).map((_, index) => ({
58
+ text: index + 1,
59
+ type: "next"
60
+ }));
61
+ days = days.concat(nextMonthDays);
62
+ }
63
+ return toNestedArr(days);
64
+ });
65
+ const weekDays = computed(() => {
66
+ const start = firstDayOfWeek;
67
+ if (start === 0) {
68
+ return WEEK_DAYS.map((_) => t(`el.datepicker.weeks.${_}`));
69
+ } else {
70
+ return WEEK_DAYS.slice(start).concat(WEEK_DAYS.slice(0, start)).map((_) => t(`el.datepicker.weeks.${_}`));
71
+ }
72
+ });
73
+ const getFormattedDate = (day, type) => {
74
+ switch (type) {
75
+ case "prev":
76
+ return props.date.startOf("month").subtract(1, "month").date(day);
77
+ case "next":
78
+ return props.date.startOf("month").add(1, "month").date(day);
79
+ case "current":
80
+ return props.date.date(day);
81
+ }
82
+ };
83
+ const getCellClass = ({ text, type }) => {
84
+ const classes = [type];
85
+ if (type === "current") {
86
+ const date = getFormattedDate(text, type);
87
+ if (date.isSame(props.selectedDay, "day")) {
88
+ classes.push(nsDay.is("selected"));
89
+ }
90
+ if (date.isSame(now, "day")) {
91
+ classes.push(nsDay.is("today"));
92
+ }
93
+ }
94
+ return classes;
95
+ };
96
+ const getSlotData = ({ text, type }) => {
97
+ const day = getFormattedDate(text, type);
98
+ return {
99
+ isSelected: day.isSame(props.selectedDay),
100
+ type: `${type}-month`,
101
+ day: day.format("YYYY-MM-DD"),
102
+ date: day.toDate()
103
+ };
104
+ };
105
+ expose({
106
+ getFormattedDate
107
+ });
108
+ return (_ctx, _cache) => {
109
+ return openBlock(), createElementBlock("table", {
110
+ class: normalizeClass([unref(nsTable).b(), unref(nsTable).is("range", unref(isInRange))]),
111
+ cellspacing: "0",
112
+ cellpadding: "0"
113
+ }, [
114
+ !_ctx.hideHeader ? (openBlock(), createElementBlock("thead", _hoisted_1, [
115
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(weekDays), (day) => {
116
+ return openBlock(), createElementBlock("th", { key: day }, toDisplayString(day), 1);
117
+ }), 128))
118
+ ])) : createCommentVNode("v-if", true),
119
+ createElementVNode("tbody", null, [
120
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, index) => {
121
+ return openBlock(), createElementBlock("tr", {
122
+ key: index,
123
+ class: normalizeClass({
124
+ [unref(nsTable).e("row")]: true,
125
+ [unref(nsTable).em("row", "hide-border")]: index === 0 && _ctx.hideHeader
126
+ })
127
+ }, [
128
+ (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key) => {
129
+ return openBlock(), createElementBlock("td", {
130
+ key,
131
+ class: normalizeClass(getCellClass(cell))
132
+ }, [
133
+ createElementVNode("div", {
134
+ class: normalizeClass(unref(nsDay).b())
135
+ }, [
136
+ renderSlot(_ctx.$slots, "dateCell", {
137
+ data: getSlotData(cell)
138
+ }, () => [
139
+ createElementVNode("span", null, toDisplayString(cell.text), 1)
140
+ ])
141
+ ], 2)
142
+ ], 2);
143
+ }), 128))
144
+ ], 2);
145
+ }), 128))
146
+ ])
147
+ ], 2);
148
+ };
31
149
  }
32
150
  });
151
+ var DateTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/calendar/src/date-table.vue"]]);
33
152
 
34
- export { dateTableProps, getMonthDays, getPrevMonthLastDays, toNestedArr };
153
+ export { DateTable as default };
35
154
  //# sourceMappingURL=date-table.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-table.mjs","sources":["../../../../../../packages/components/calendar/src/date-table.ts"],"sourcesContent":["import { buildProps, definePropType, isObject } from '@element-ps/utils'\nimport { rangeArr } from '@element-ps/components/time-picker'\nimport type { ExtractPropTypes } from 'vue'\nimport type { Dayjs } from 'dayjs'\nimport type DateTable from './date-table.vue'\n\nexport type CalendarDateCellType = 'next' | 'prev' | 'current'\nexport type CalendarDateCell = {\n text: number\n type: CalendarDateCellType\n}\n\nexport const getPrevMonthLastDays = (date: Dayjs, count: number) => {\n const lastDay = date.subtract(1, 'month').endOf('month').date()\n return rangeArr(count).map((_, index) => lastDay - (count - index - 1))\n}\n\nexport const getMonthDays = (date: Dayjs) => {\n const days = date.daysInMonth()\n return rangeArr(days).map((_, index) => index + 1)\n}\n\nexport const toNestedArr = (days: CalendarDateCell[]) =>\n rangeArr(days.length / 7).map((index) => {\n const start = index * 7\n return days.slice(start, start + 7)\n })\n\nexport const dateTableProps = buildProps({\n selectedDay: {\n type: definePropType<Dayjs>(Object),\n },\n range: {\n type: definePropType<[Dayjs, Dayjs]>(Array),\n },\n date: {\n type: definePropType<Dayjs>(Object),\n required: true,\n },\n hideHeader: {\n type: Boolean,\n },\n} as const)\nexport type DateTableProps = ExtractPropTypes<typeof dateTableProps>\n\nexport type DateTableInstance = InstanceType<typeof DateTable>\n"],"names":[],"mappings":";;;;;AAEY,MAAC,oBAAoB,GAAG,CAAC,IAAI,EAAE,KAAK,KAAK;AACrD,EAAE,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;AAClE,EAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,OAAO,IAAI,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;AAC1E,EAAE;AACU,MAAC,YAAY,GAAG,CAAC,IAAI,KAAK;AACtC,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;AAClC,EAAE,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,KAAK,GAAG,CAAC,CAAC,CAAC;AACrD,EAAE;AACU,MAAC,WAAW,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK;AAC9E,EAAE,MAAM,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC;AAC1B,EAAE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;AACtC,CAAC,EAAE;AACS,MAAC,cAAc,GAAG,UAAU,CAAC;AACzC,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,QAAQ,EAAE,IAAI;AAClB,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,OAAO;AACjB,GAAG;AACH,CAAC;;;;"}
1
+ {"version":3,"file":"date-table.mjs","sources":["../../../../../../packages/components/calendar/src/date-table.vue"],"sourcesContent":["<template>\n <table\n :class=\"[nsTable.b(), nsTable.is('range', isInRange)]\"\n cellspacing=\"0\"\n cellpadding=\"0\"\n >\n <thead v-if=\"!hideHeader\">\n <th v-for=\"day in weekDays\" :key=\"day\">{{ day }}</th>\n </thead>\n\n <tbody>\n <tr\n v-for=\"(row, index) in rows\"\n :key=\"index\"\n :class=\"{\n [nsTable.e('row')]: true,\n [nsTable.em('row', 'hide-border')]: index === 0 && hideHeader,\n }\"\n >\n <td\n v-for=\"(cell, key) in row\"\n :key=\"key\"\n :class=\"getCellClass(cell)\"\n >\n <div :class=\"nsDay.b()\">\n <slot name=\"dateCell\" :data=\"getSlotData(cell)\">\n <span>{{ cell.text }}</span>\n </slot>\n </div>\n </td>\n </tr>\n </tbody>\n </table>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport dayjs from 'dayjs'\nimport localeData from 'dayjs/plugin/localeData.js'\nimport { useLocale, useNamespace } from '@element-ps/hooks'\nimport { rangeArr } from '@element-ps/components/time-picker'\nimport { WEEK_DAYS } from '@element-ps/constants'\nimport {\n dateTableProps,\n getMonthDays,\n getPrevMonthLastDays,\n toNestedArr,\n} from './date-table'\nimport type { CalendarDateCell, CalendarDateCellType } from './date-table'\nimport type { Dayjs } from 'dayjs'\n\ndayjs.extend(localeData)\n\ndefineOptions({\n name: 'DateTable',\n})\n\nconst props = defineProps(dateTableProps)\n\nconst { t, lang } = useLocale()\nconst nsTable = useNamespace('calendar-table')\nconst nsDay = useNamespace('calendar-day')\n\nconst now = dayjs().locale(lang.value)\n// todo better way to get Day.js locale object\nconst firstDayOfWeek: number = (now as any).$locale().weekStart || 0\n\nconst isInRange = computed(() => !!props.range && !!props.range.length)\n\nconst rows = computed(() => {\n let days: CalendarDateCell[] = []\n if (isInRange.value) {\n const [start, end] = props.range!\n const currentMonthRange: CalendarDateCell[] = rangeArr(\n end.date() - start.date() + 1\n ).map((index) => ({\n text: start.date() + index,\n type: 'current',\n }))\n\n let remaining = currentMonthRange.length % 7\n remaining = remaining === 0 ? 0 : 7 - remaining\n const nextMonthRange: CalendarDateCell[] = rangeArr(remaining).map(\n (_, index) => ({\n text: index + 1,\n type: 'next',\n })\n )\n days = currentMonthRange.concat(nextMonthRange)\n } else {\n const firstDay = props.date.startOf('month').day()\n const prevMonthDays: CalendarDateCell[] = getPrevMonthLastDays(\n props.date,\n firstDay - firstDayOfWeek\n ).map((day) => ({\n text: day,\n type: 'prev',\n }))\n const currentMonthDays: CalendarDateCell[] = getMonthDays(props.date).map(\n (day) => ({\n text: day,\n type: 'current',\n })\n )\n days = [...prevMonthDays, ...currentMonthDays]\n const remaining = 7 - (days.length % 7 || 7)\n const nextMonthDays: CalendarDateCell[] = rangeArr(remaining).map(\n (_, index) => ({\n text: index + 1,\n type: 'next',\n })\n )\n days = days.concat(nextMonthDays)\n }\n return toNestedArr(days)\n})\n\nconst weekDays = computed(() => {\n const start = firstDayOfWeek\n if (start === 0) {\n return WEEK_DAYS.map((_) => t(`el.datepicker.weeks.${_}`))\n } else {\n return WEEK_DAYS.slice(start)\n .concat(WEEK_DAYS.slice(0, start))\n .map((_) => t(`el.datepicker.weeks.${_}`))\n }\n})\n\nconst getFormattedDate = (day: number, type: CalendarDateCellType): Dayjs => {\n switch (type) {\n case 'prev':\n return props.date.startOf('month').subtract(1, 'month').date(day)\n case 'next':\n return props.date.startOf('month').add(1, 'month').date(day)\n case 'current':\n return props.date.date(day)\n }\n}\n\nconst getCellClass = ({ text, type }: CalendarDateCell) => {\n const classes: string[] = [type]\n if (type === 'current') {\n const date = getFormattedDate(text, type)\n if (date.isSame(props.selectedDay, 'day')) {\n classes.push(nsDay.is('selected'))\n }\n if (date.isSame(now, 'day')) {\n classes.push(nsDay.is('today'))\n }\n }\n return classes\n}\n\nconst getSlotData = ({ text, type }: CalendarDateCell) => {\n const day = getFormattedDate(text, type)\n return {\n isSelected: day.isSame(props.selectedDay),\n type: `${type}-month`,\n day: day.format('YYYY-MM-DD'),\n date: day.toDate(),\n }\n}\n\ndefineExpose({\n /** @description toggle date panel */\n getFormattedDate,\n})\n</script>\n"],"names":[],"mappings":";;;;;;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A,CAAA,EAAA,CAAA,UAAA,CAAA,CAAA,CAAA;AAAA,SACA;AACA,QAAA,IAAA,IAAA,CAAA,MAAA,CAAA,GAAA,EAAA,KAAA,CAAA,EAAA;AACA,UAAA,OAAA,CAAA,IAAA,CAAA,KAAA,CAAA,EAAA,CAAA,OAAA,CAAA,CAAA,CAAA;AAAA,SACA;AAAA,OACA;AACA,MAAA,OAAA,OAAA,CAAA;AAAA,KACA,CAAA;AAEA,IAAA,MAAA,WAAA,GAAA,CAAA,EAAA,IAAA,EAAA,IAAA,EAAA,KAAA;AACA,MAAA,MAAA,GAAA,GAAA,gBAAA,CAAA,IAAA,EAAA,IAAA,CAAA,CAAA;AACA,MAAA,OAAA;AAAA,QACA,UAAA,EAAA,GAAA,CAAA,MAAA,CAAA,KAAA,CAAA,WAAA,CAAA;AAAA,QACA,MAAA,CAAA,EAAA,IAAA,CAAA,MAAA,CAAA;AAAA,QACA,GAAA,EAAA,GAAA,CAAA,MAAA,CAAA,YAAA,CAAA;AAAA,QACA,IAAA,EAAA,IAAA,MAAA,EAAA;AAAA,OACA,CAAA;AAAA,KACA,CAAA;AAEA,IAAA,MAAA,CAAA;AAAA,MAEA,gBAAA;AAAA,KACA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,154 +1,35 @@
1
- import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, Fragment, renderList, toDisplayString, createCommentVNode, createElementVNode, renderSlot } from 'vue';
2
- import dayjs from 'dayjs';
3
- import localeData from 'dayjs/plugin/localeData.js';
4
- import '../../../hooks/index.mjs';
1
+ import '../../../utils/index.mjs';
5
2
  import '../../time-picker/index.mjs';
6
- import '../../../constants/index.mjs';
7
- import { dateTableProps, getPrevMonthLastDays, getMonthDays, toNestedArr } from './date-table.mjs';
8
- import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
9
- import { useLocale } from '../../../hooks/use-locale/index.mjs';
10
- import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
11
3
  import { rangeArr } from '../../time-picker/src/common/date-utils.mjs';
12
- import { WEEK_DAYS } from '../../../constants/date.mjs';
4
+ import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
13
5
 
14
- const _hoisted_1 = { key: 0 };
15
- const __default__ = {
16
- name: "DateTable"
6
+ const getPrevMonthLastDays = (date, count) => {
7
+ const lastDay = date.subtract(1, "month").endOf("month").date();
8
+ return rangeArr(count).map((_, index) => lastDay - (count - index - 1));
17
9
  };
18
- const _sfc_main = /* @__PURE__ */ defineComponent({
19
- ...__default__,
20
- props: dateTableProps,
21
- setup(__props, { expose }) {
22
- const props = __props;
23
- dayjs.extend(localeData);
24
- const { t, lang } = useLocale();
25
- const nsTable = useNamespace("calendar-table");
26
- const nsDay = useNamespace("calendar-day");
27
- const now = dayjs().locale(lang.value);
28
- const firstDayOfWeek = now.$locale().weekStart || 0;
29
- const isInRange = computed(() => !!props.range && !!props.range.length);
30
- const rows = computed(() => {
31
- let days = [];
32
- if (isInRange.value) {
33
- const [start, end] = props.range;
34
- const currentMonthRange = rangeArr(end.date() - start.date() + 1).map((index) => ({
35
- text: start.date() + index,
36
- type: "current"
37
- }));
38
- let remaining = currentMonthRange.length % 7;
39
- remaining = remaining === 0 ? 0 : 7 - remaining;
40
- const nextMonthRange = rangeArr(remaining).map((_, index) => ({
41
- text: index + 1,
42
- type: "next"
43
- }));
44
- days = currentMonthRange.concat(nextMonthRange);
45
- } else {
46
- const firstDay = props.date.startOf("month").day();
47
- const prevMonthDays = getPrevMonthLastDays(props.date, firstDay - firstDayOfWeek).map((day) => ({
48
- text: day,
49
- type: "prev"
50
- }));
51
- const currentMonthDays = getMonthDays(props.date).map((day) => ({
52
- text: day,
53
- type: "current"
54
- }));
55
- days = [...prevMonthDays, ...currentMonthDays];
56
- const remaining = 7 - (days.length % 7 || 7);
57
- const nextMonthDays = rangeArr(remaining).map((_, index) => ({
58
- text: index + 1,
59
- type: "next"
60
- }));
61
- days = days.concat(nextMonthDays);
62
- }
63
- return toNestedArr(days);
64
- });
65
- const weekDays = computed(() => {
66
- const start = firstDayOfWeek;
67
- if (start === 0) {
68
- return WEEK_DAYS.map((_) => t(`el.datepicker.weeks.${_}`));
69
- } else {
70
- return WEEK_DAYS.slice(start).concat(WEEK_DAYS.slice(0, start)).map((_) => t(`el.datepicker.weeks.${_}`));
71
- }
72
- });
73
- const getFormattedDate = (day, type) => {
74
- switch (type) {
75
- case "prev":
76
- return props.date.startOf("month").subtract(1, "month").date(day);
77
- case "next":
78
- return props.date.startOf("month").add(1, "month").date(day);
79
- case "current":
80
- return props.date.date(day);
81
- }
82
- };
83
- const getCellClass = ({ text, type }) => {
84
- const classes = [type];
85
- if (type === "current") {
86
- const date = getFormattedDate(text, type);
87
- if (date.isSame(props.selectedDay, "day")) {
88
- classes.push(nsDay.is("selected"));
89
- }
90
- if (date.isSame(now, "day")) {
91
- classes.push(nsDay.is("today"));
92
- }
93
- }
94
- return classes;
95
- };
96
- const getSlotData = ({ text, type }) => {
97
- const day = getFormattedDate(text, type);
98
- return {
99
- isSelected: day.isSame(props.selectedDay),
100
- type: `${type}-month`,
101
- day: day.format("YYYY-MM-DD"),
102
- date: day.toDate()
103
- };
104
- };
105
- expose({
106
- getFormattedDate
107
- });
108
- return (_ctx, _cache) => {
109
- return openBlock(), createElementBlock("table", {
110
- class: normalizeClass([unref(nsTable).b(), unref(nsTable).is("range", unref(isInRange))]),
111
- cellspacing: "0",
112
- cellpadding: "0"
113
- }, [
114
- !_ctx.hideHeader ? (openBlock(), createElementBlock("thead", _hoisted_1, [
115
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(weekDays), (day) => {
116
- return openBlock(), createElementBlock("th", { key: day }, toDisplayString(day), 1);
117
- }), 128))
118
- ])) : createCommentVNode("v-if", true),
119
- createElementVNode("tbody", null, [
120
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, index) => {
121
- return openBlock(), createElementBlock("tr", {
122
- key: index,
123
- class: normalizeClass({
124
- [unref(nsTable).e("row")]: true,
125
- [unref(nsTable).em("row", "hide-border")]: index === 0 && _ctx.hideHeader
126
- })
127
- }, [
128
- (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key) => {
129
- return openBlock(), createElementBlock("td", {
130
- key,
131
- class: normalizeClass(getCellClass(cell))
132
- }, [
133
- createElementVNode("div", {
134
- class: normalizeClass(unref(nsDay).b())
135
- }, [
136
- renderSlot(_ctx.$slots, "dateCell", {
137
- data: getSlotData(cell)
138
- }, () => [
139
- createElementVNode("span", null, toDisplayString(cell.text), 1)
140
- ])
141
- ], 2)
142
- ], 2);
143
- }), 128))
144
- ], 2);
145
- }), 128))
146
- ])
147
- ], 2);
148
- };
10
+ const getMonthDays = (date) => {
11
+ const days = date.daysInMonth();
12
+ return rangeArr(days).map((_, index) => index + 1);
13
+ };
14
+ const toNestedArr = (days) => rangeArr(days.length / 7).map((index) => {
15
+ const start = index * 7;
16
+ return days.slice(start, start + 7);
17
+ });
18
+ const dateTableProps = buildProps({
19
+ selectedDay: {
20
+ type: definePropType(Object)
21
+ },
22
+ range: {
23
+ type: definePropType(Array)
24
+ },
25
+ date: {
26
+ type: definePropType(Object),
27
+ required: true
28
+ },
29
+ hideHeader: {
30
+ type: Boolean
149
31
  }
150
32
  });
151
- var DateTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/calendar/src/date-table.vue"]]);
152
33
 
153
- export { DateTable as default };
34
+ export { dateTableProps, getMonthDays, getPrevMonthLastDays, toNestedArr };
154
35
  //# sourceMappingURL=date-table2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-table2.mjs","sources":["../../../../../../packages/components/calendar/src/date-table.vue"],"sourcesContent":["<template>\n <table\n :class=\"[nsTable.b(), nsTable.is('range', isInRange)]\"\n cellspacing=\"0\"\n cellpadding=\"0\"\n >\n <thead v-if=\"!hideHeader\">\n <th v-for=\"day in weekDays\" :key=\"day\">{{ day }}</th>\n </thead>\n\n <tbody>\n <tr\n v-for=\"(row, index) in rows\"\n :key=\"index\"\n :class=\"{\n [nsTable.e('row')]: true,\n [nsTable.em('row', 'hide-border')]: index === 0 && hideHeader,\n }\"\n >\n <td\n v-for=\"(cell, key) in row\"\n :key=\"key\"\n :class=\"getCellClass(cell)\"\n >\n <div :class=\"nsDay.b()\">\n <slot name=\"dateCell\" :data=\"getSlotData(cell)\">\n <span>{{ cell.text }}</span>\n </slot>\n </div>\n </td>\n </tr>\n </tbody>\n </table>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport dayjs from 'dayjs'\nimport localeData from 'dayjs/plugin/localeData.js'\nimport { useLocale, useNamespace } from '@element-ps/hooks'\nimport { rangeArr } from '@element-ps/components/time-picker'\nimport { WEEK_DAYS } from '@element-ps/constants'\nimport {\n dateTableProps,\n getMonthDays,\n getPrevMonthLastDays,\n toNestedArr,\n} from './date-table'\nimport type { CalendarDateCell, CalendarDateCellType } from './date-table'\nimport type { Dayjs } from 'dayjs'\n\ndayjs.extend(localeData)\n\ndefineOptions({\n name: 'DateTable',\n})\n\nconst props = defineProps(dateTableProps)\n\nconst { t, lang } = useLocale()\nconst nsTable = useNamespace('calendar-table')\nconst nsDay = useNamespace('calendar-day')\n\nconst now = dayjs().locale(lang.value)\n// todo better way to get Day.js locale object\nconst firstDayOfWeek: number = (now as any).$locale().weekStart || 0\n\nconst isInRange = computed(() => !!props.range && !!props.range.length)\n\nconst rows = computed(() => {\n let days: CalendarDateCell[] = []\n if (isInRange.value) {\n const [start, end] = props.range!\n const currentMonthRange: CalendarDateCell[] = rangeArr(\n end.date() - start.date() + 1\n ).map((index) => ({\n text: start.date() + index,\n type: 'current',\n }))\n\n let remaining = currentMonthRange.length % 7\n remaining = remaining === 0 ? 0 : 7 - remaining\n const nextMonthRange: CalendarDateCell[] = rangeArr(remaining).map(\n (_, index) => ({\n text: index + 1,\n type: 'next',\n })\n )\n days = currentMonthRange.concat(nextMonthRange)\n } else {\n const firstDay = props.date.startOf('month').day()\n const prevMonthDays: CalendarDateCell[] = getPrevMonthLastDays(\n props.date,\n firstDay - firstDayOfWeek\n ).map((day) => ({\n text: day,\n type: 'prev',\n }))\n const currentMonthDays: CalendarDateCell[] = getMonthDays(props.date).map(\n (day) => ({\n text: day,\n type: 'current',\n })\n )\n days = [...prevMonthDays, ...currentMonthDays]\n const remaining = 7 - (days.length % 7 || 7)\n const nextMonthDays: CalendarDateCell[] = rangeArr(remaining).map(\n (_, index) => ({\n text: index + 1,\n type: 'next',\n })\n )\n days = days.concat(nextMonthDays)\n }\n return toNestedArr(days)\n})\n\nconst weekDays = computed(() => {\n const start = firstDayOfWeek\n if (start === 0) {\n return WEEK_DAYS.map((_) => t(`el.datepicker.weeks.${_}`))\n } else {\n return WEEK_DAYS.slice(start)\n .concat(WEEK_DAYS.slice(0, start))\n .map((_) => t(`el.datepicker.weeks.${_}`))\n }\n})\n\nconst getFormattedDate = (day: number, type: CalendarDateCellType): Dayjs => {\n switch (type) {\n case 'prev':\n return props.date.startOf('month').subtract(1, 'month').date(day)\n case 'next':\n return props.date.startOf('month').add(1, 'month').date(day)\n case 'current':\n return props.date.date(day)\n }\n}\n\nconst getCellClass = ({ text, type }: CalendarDateCell) => {\n const classes: string[] = [type]\n if (type === 'current') {\n const date = getFormattedDate(text, type)\n if (date.isSame(props.selectedDay, 'day')) {\n classes.push(nsDay.is('selected'))\n }\n if (date.isSame(now, 'day')) {\n classes.push(nsDay.is('today'))\n }\n }\n return classes\n}\n\nconst getSlotData = ({ text, type }: CalendarDateCell) => {\n const day = getFormattedDate(text, type)\n return {\n isSelected: day.isSame(props.selectedDay),\n type: `${type}-month`,\n day: day.format('YYYY-MM-DD'),\n date: day.toDate(),\n }\n}\n\ndefineExpose({\n /** @description toggle date panel */\n getFormattedDate,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAA,KAAA,CAAA,OAAA,UAAA,CAA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QAAA,IAAA,IAAA,CAAA,MAAA,CAAA,GAAA,EAAA,KAAA,CAAA,EAAA;AACA,UAAA,OAAA,CAAA,IAAA,CAAA,KAAA,CAAA,EAAA,CAAA,OAAA,CAAA,CAAA,CAAA;AAAA,SACA;AAAA,OACA;AACA,MAAA,OAAA,OAAA,CAAA;AAAA,KACA,CAAA;AAEA,IAAA,MAAA,WAAA,GAAA,CAAA,EAAA,IAAA,EAAA,IAAA,EAAA,KAAA;AACA,MAAA,MAAA,GAAA,GAAA,gBAAA,CAAA,IAAA,EAAA,IAAA,CAAA,CAAA;AACA,MAAA,OAAA;AAAA,QACA,UAAA,EAAA,GAAA,CAAA,MAAA,CAAA,KAAA,CAAA,WAAA,CAAA;AAAA,QACA,MAAA,CAAA,EAAA,IAAA,CAAA,MAAA,CAAA;AAAA,QACA,GAAA,EAAA,GAAA,CAAA,MAAA,CAAA,YAAA,CAAA;AAAA,QACA,IAAA,EAAA,IAAA,MAAA,EAAA;AAAA,OACA,CAAA;AAAA,KACA,CAAA;AAEA,IAAA,MAAA,CAAA;AAAA,MAEA,gBAAA;AAAA,KACA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"date-table2.mjs","sources":["../../../../../../packages/components/calendar/src/date-table.ts"],"sourcesContent":["import { buildProps, definePropType, isObject } from '@element-ps/utils'\nimport { rangeArr } from '@element-ps/components/time-picker'\nimport type { ExtractPropTypes } from 'vue'\nimport type { Dayjs } from 'dayjs'\nimport type DateTable from './date-table.vue'\n\nexport type CalendarDateCellType = 'next' | 'prev' | 'current'\nexport type CalendarDateCell = {\n text: number\n type: CalendarDateCellType\n}\n\nexport const getPrevMonthLastDays = (date: Dayjs, count: number) => {\n const lastDay = date.subtract(1, 'month').endOf('month').date()\n return rangeArr(count).map((_, index) => lastDay - (count - index - 1))\n}\n\nexport const getMonthDays = (date: Dayjs) => {\n const days = date.daysInMonth()\n return rangeArr(days).map((_, index) => index + 1)\n}\n\nexport const toNestedArr = (days: CalendarDateCell[]) =>\n rangeArr(days.length / 7).map((index) => {\n const start = index * 7\n return days.slice(start, start + 7)\n })\n\nexport const dateTableProps = buildProps({\n selectedDay: {\n type: definePropType<Dayjs>(Object),\n },\n range: {\n type: definePropType<[Dayjs, Dayjs]>(Array),\n },\n date: {\n type: definePropType<Dayjs>(Object),\n required: true,\n },\n hideHeader: {\n type: Boolean,\n },\n} as const)\nexport type DateTableProps = ExtractPropTypes<typeof dateTableProps>\n\nexport type DateTableInstance = InstanceType<typeof DateTable>\n"],"names":[],"mappings":";;;;;AAEY,MAAC,oBAAoB,GAAG,CAAC,IAAI,EAAE,KAAK,KAAK;AACrD,EAAE,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;AAClE,EAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,OAAO,IAAI,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;AAC1E,EAAE;AACU,MAAC,YAAY,GAAG,CAAC,IAAI,KAAK;AACtC,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;AAClC,EAAE,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,KAAK,GAAG,CAAC,CAAC,CAAC;AACrD,EAAE;AACU,MAAC,WAAW,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK;AAC9E,EAAE,MAAM,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC;AAC1B,EAAE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;AACtC,CAAC,EAAE;AACS,MAAC,cAAc,GAAG,UAAU,CAAC;AACzC,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,QAAQ,EAAE,IAAI;AAClB,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,OAAO;AACjB,GAAG;AACH,CAAC;;;;"}
@@ -1,6 +1,6 @@
1
1
  import '../../utils/index.mjs';
2
- import Card from './src/card.mjs';
3
- export { cardProps } from './src/card2.mjs';
2
+ import Card from './src/card2.mjs';
3
+ export { cardProps } from './src/card.mjs';
4
4
  import { withInstall } from '../../utils/vue/install.mjs';
5
5
 
6
6
  const PsCard = withInstall(Card);
@@ -1,40 +1,20 @@
1
- import { defineComponent, openBlock, createElementBlock, normalizeClass, unref, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createElementVNode, normalizeStyle } from 'vue';
2
- import '../../../hooks/index.mjs';
3
- import { cardProps } from './card2.mjs';
4
- import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
5
- import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
1
+ import '../../../utils/index.mjs';
2
+ import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
6
3
 
7
- const __default__ = {
8
- name: "PsCard"
9
- };
10
- const _sfc_main = /* @__PURE__ */ defineComponent({
11
- ...__default__,
12
- props: cardProps,
13
- setup(__props) {
14
- const ns = useNamespace("card");
15
- return (_ctx, _cache) => {
16
- return openBlock(), createElementBlock("div", {
17
- class: normalizeClass([unref(ns).b(), unref(ns).is(`${_ctx.shadow}-shadow`)])
18
- }, [
19
- _ctx.$slots.header || _ctx.header ? (openBlock(), createElementBlock("div", {
20
- key: 0,
21
- class: normalizeClass(unref(ns).e("header"))
22
- }, [
23
- renderSlot(_ctx.$slots, "header", {}, () => [
24
- createTextVNode(toDisplayString(_ctx.header), 1)
25
- ])
26
- ], 2)) : createCommentVNode("v-if", true),
27
- createElementVNode("div", {
28
- class: normalizeClass(unref(ns).e("body")),
29
- style: normalizeStyle(_ctx.bodyStyle)
30
- }, [
31
- renderSlot(_ctx.$slots, "default")
32
- ], 6)
33
- ], 2);
34
- };
4
+ const cardProps = buildProps({
5
+ header: {
6
+ type: String,
7
+ default: ""
8
+ },
9
+ bodyStyle: {
10
+ type: definePropType([String, Object, Array]),
11
+ default: ""
12
+ },
13
+ shadow: {
14
+ type: String,
15
+ default: "always"
35
16
  }
36
17
  });
37
- var Card = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/card/src/card.vue"]]);
38
18
 
39
- export { Card as default };
19
+ export { cardProps };
40
20
  //# sourceMappingURL=card.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"card.mjs","sources":["../../../../../../packages/components/card/src/card.vue"],"sourcesContent":["<template>\n <div :class=\"[ns.b(), ns.is(`${shadow}-shadow`)]\">\n <div v-if=\"$slots.header || header\" :class=\"ns.e('header')\">\n <slot name=\"header\">{{ header }}</slot>\n </div>\n <div :class=\"ns.e('body')\" :style=\"bodyStyle\">\n <slot />\n </div>\n </div>\n</template>\n<script lang=\"ts\" setup>\nimport { useNamespace } from '@element-ps/hooks'\nimport { cardProps } from './card'\n\ndefineOptions({\n name: 'PsCard',\n})\n\ndefineProps(cardProps)\n\nconst ns = useNamespace('card')\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;AAoBA,IAAA,MAAA,EAAA,GAAA,aAAA,MAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"card.mjs","sources":["../../../../../../packages/components/card/src/card.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-ps/utils'\nimport type Card from './card.vue'\nimport type { ExtractPropTypes, StyleValue } from 'vue'\n\nexport const cardProps = buildProps({\n header: {\n type: String,\n default: '',\n },\n bodyStyle: {\n type: definePropType<StyleValue>([String, Object, Array]),\n default: '',\n },\n shadow: {\n type: String,\n default: 'always',\n },\n} as const)\nexport type CardProps = ExtractPropTypes<typeof cardProps>\nexport type CardInstance = InstanceType<typeof Card>\n"],"names":[],"mappings":";;;AACY,MAAC,SAAS,GAAG,UAAU,CAAC;AACpC,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACjD,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,QAAQ;AACrB,GAAG;AACH,CAAC;;;;"}
@@ -1,20 +1,40 @@
1
- import '../../../utils/index.mjs';
2
- import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
1
+ import { defineComponent, openBlock, createElementBlock, normalizeClass, unref, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createElementVNode, normalizeStyle } from 'vue';
2
+ import '../../../hooks/index.mjs';
3
+ import { cardProps } from './card.mjs';
4
+ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
5
+ import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
3
6
 
4
- const cardProps = buildProps({
5
- header: {
6
- type: String,
7
- default: ""
8
- },
9
- bodyStyle: {
10
- type: definePropType([String, Object, Array]),
11
- default: ""
12
- },
13
- shadow: {
14
- type: String,
15
- default: "always"
7
+ const __default__ = {
8
+ name: "PsCard"
9
+ };
10
+ const _sfc_main = /* @__PURE__ */ defineComponent({
11
+ ...__default__,
12
+ props: cardProps,
13
+ setup(__props) {
14
+ const ns = useNamespace("card");
15
+ return (_ctx, _cache) => {
16
+ return openBlock(), createElementBlock("div", {
17
+ class: normalizeClass([unref(ns).b(), unref(ns).is(`${_ctx.shadow}-shadow`)])
18
+ }, [
19
+ _ctx.$slots.header || _ctx.header ? (openBlock(), createElementBlock("div", {
20
+ key: 0,
21
+ class: normalizeClass(unref(ns).e("header"))
22
+ }, [
23
+ renderSlot(_ctx.$slots, "header", {}, () => [
24
+ createTextVNode(toDisplayString(_ctx.header), 1)
25
+ ])
26
+ ], 2)) : createCommentVNode("v-if", true),
27
+ createElementVNode("div", {
28
+ class: normalizeClass(unref(ns).e("body")),
29
+ style: normalizeStyle(_ctx.bodyStyle)
30
+ }, [
31
+ renderSlot(_ctx.$slots, "default")
32
+ ], 6)
33
+ ], 2);
34
+ };
16
35
  }
17
36
  });
37
+ var Card = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/card/src/card.vue"]]);
18
38
 
19
- export { cardProps };
39
+ export { Card as default };
20
40
  //# sourceMappingURL=card2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"card2.mjs","sources":["../../../../../../packages/components/card/src/card.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-ps/utils'\nimport type Card from './card.vue'\nimport type { ExtractPropTypes, StyleValue } from 'vue'\n\nexport const cardProps = buildProps({\n header: {\n type: String,\n default: '',\n },\n bodyStyle: {\n type: definePropType<StyleValue>([String, Object, Array]),\n default: '',\n },\n shadow: {\n type: String,\n default: 'always',\n },\n} as const)\nexport type CardProps = ExtractPropTypes<typeof cardProps>\nexport type CardInstance = InstanceType<typeof Card>\n"],"names":[],"mappings":";;;AACY,MAAC,SAAS,GAAG,UAAU,CAAC;AACpC,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACjD,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,QAAQ;AACrB,GAAG;AACH,CAAC;;;;"}
1
+ {"version":3,"file":"card2.mjs","sources":["../../../../../../packages/components/card/src/card.vue"],"sourcesContent":["<template>\n <div :class=\"[ns.b(), ns.is(`${shadow}-shadow`)]\">\n <div v-if=\"$slots.header || header\" :class=\"ns.e('header')\">\n <slot name=\"header\">{{ header }}</slot>\n </div>\n <div :class=\"ns.e('body')\" :style=\"bodyStyle\">\n <slot />\n </div>\n </div>\n</template>\n<script lang=\"ts\" setup>\nimport { useNamespace } from '@element-ps/hooks'\nimport { cardProps } from './card'\n\ndefineOptions({\n name: 'PsCard',\n})\n\ndefineProps(cardProps)\n\nconst ns = useNamespace('card')\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;AAoBA,IAAA,MAAA,EAAA,GAAA,aAAA,MAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,3 +1,3 @@
1
- export { COLLECTION_ITEM_SIGN, createCollectionWithScope } from './src/collection2.mjs';
1
+ export { COLLECTION_ITEM_SIGN, createCollectionWithScope } from './src/collection.mjs';
2
2
  import './src/tokens.mjs';
3
3
  //# sourceMappingURL=index.mjs.map