@phelan/design 0.0.1

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 (676) hide show
  1. package/.changeset/README.md +8 -0
  2. package/.changeset/config.json +11 -0
  3. package/.specstory/history/2025-11-28_08-55Z-/345/210/235/345/247/213/345/214/226/345/211/215/347/253/257/347/273/204/344/273/266/345/272/223/351/241/271/347/233/256.md +4742 -0
  4. package/.specstory/history/2025-12-01_01-58Z-/345/210/235/345/247/213/345/214/226/345/211/215/347/253/257/347/273/204/344/273/266/345/272/223/351/241/271/347/233/256.md +14912 -0
  5. package/.specstory/history/2025-12-22_01-38Z-scss-/345/217/230/351/207/217/345/274/225/345/205/245/351/227/256/351/242/230.md +67163 -0
  6. package/.specstory/history/2026-01-08_03-51Z-pnpm-lines-88-95.md +304 -0
  7. package/README.en.md +36 -0
  8. package/README.md +37 -0
  9. package/SETUP_GUIDE.md +2530 -0
  10. package/docs/.vitepress/config.ts +298 -0
  11. package/docs/.vitepress/theme/index.ts +30 -0
  12. package/docs/.vitepress/theme/style.css +150 -0
  13. package/docs/CHANGELOG.md +7 -0
  14. package/docs/DEPLOY.md +183 -0
  15. package/docs/api-examples.md +49 -0
  16. package/docs/components/Changelog.vue +176 -0
  17. package/docs/components/ComponentOverview.vue +613 -0
  18. package/docs/components/ComponentSearch.vue +39 -0
  19. package/docs/components/basic/action-menu.md +63 -0
  20. package/docs/components/basic/arrow-steps.md +55 -0
  21. package/docs/components/basic/badge.md +22 -0
  22. package/docs/components/basic/batch-copy.md +44 -0
  23. package/docs/components/basic/batch-editor.md +52 -0
  24. package/docs/components/basic/border.md +22 -0
  25. package/docs/components/basic/breadcrumb.md +38 -0
  26. package/docs/components/basic/button.md +109 -0
  27. package/docs/components/basic/calendar.md +111 -0
  28. package/docs/components/basic/card.md +59 -0
  29. package/docs/components/basic/carousel.md +22 -0
  30. package/docs/components/basic/cascader.md +162 -0
  31. package/docs/components/basic/checkbox.md +171 -0
  32. package/docs/components/basic/collapse.md +22 -0
  33. package/docs/components/basic/column-table.md +123 -0
  34. package/docs/components/basic/date-picker.md +92 -0
  35. package/docs/components/basic/date-time-picker.md +110 -0
  36. package/docs/components/basic/demo.md +29 -0
  37. package/docs/components/basic/description.md +56 -0
  38. package/docs/components/basic/dialog.md +142 -0
  39. package/docs/components/basic/drawer.md +159 -0
  40. package/docs/components/basic/editor.md +76 -0
  41. package/docs/components/basic/empty.md +59 -0
  42. package/docs/components/basic/file-task-dialog.md +41 -0
  43. package/docs/components/basic/form.md +112 -0
  44. package/docs/components/basic/icon.md +53 -0
  45. package/docs/components/basic/image.md +110 -0
  46. package/docs/components/basic/import-dialog.md +54 -0
  47. package/docs/components/basic/independent-nav.md +45 -0
  48. package/docs/components/basic/input-number.md +61 -0
  49. package/docs/components/basic/input.md +98 -0
  50. package/docs/components/basic/layout.md +141 -0
  51. package/docs/components/basic/link.md +65 -0
  52. package/docs/components/basic/mention.md +22 -0
  53. package/docs/components/basic/message.md +167 -0
  54. package/docs/components/basic/nav.md +29 -0
  55. package/docs/components/basic/pagination.md +93 -0
  56. package/docs/components/basic/popover.md +116 -0
  57. package/docs/components/basic/progress.md +22 -0
  58. package/docs/components/basic/radio.md +152 -0
  59. package/docs/components/basic/result.md +22 -0
  60. package/docs/components/basic/scrollbar.md +105 -0
  61. package/docs/components/basic/search-panel.md +53 -0
  62. package/docs/components/basic/select.md +256 -0
  63. package/docs/components/basic/slider.md +22 -0
  64. package/docs/components/basic/space.md +140 -0
  65. package/docs/components/basic/steps.md +60 -0
  66. package/docs/components/basic/switch.md +115 -0
  67. package/docs/components/basic/table-grid.md +116 -0
  68. package/docs/components/basic/table-head-editor.md +135 -0
  69. package/docs/components/basic/table.md +433 -0
  70. package/docs/components/basic/tabs.md +62 -0
  71. package/docs/components/basic/tag.md +75 -0
  72. package/docs/components/basic/text.md +22 -0
  73. package/docs/components/basic/time-picker.md +77 -0
  74. package/docs/components/basic/time-select.md +65 -0
  75. package/docs/components/basic/tooltip.md +112 -0
  76. package/docs/components/basic/tour.md +22 -0
  77. package/docs/components/basic/tree-select.md +132 -0
  78. package/docs/components/basic/tree.md +163 -0
  79. package/docs/components/button.md +113 -0
  80. package/docs/components/calendar.md +111 -0
  81. package/docs/components/design/color.md +137 -0
  82. package/docs/components/index.md +3 -0
  83. package/docs/components/link.md +65 -0
  84. package/docs/components/search-panel.md +53 -0
  85. package/docs/components/table-grid.md +120 -0
  86. package/docs/components/table.md +433 -0
  87. package/docs/examples/action-menu/basic.vue +70 -0
  88. package/docs/examples/action-menu/default.vue +88 -0
  89. package/docs/examples/action-menu/index.vue +76 -0
  90. package/docs/examples/arrow-steps/index.vue +15 -0
  91. package/docs/examples/badge/index.vue +3 -0
  92. package/docs/examples/batch-copy/index.vue +30 -0
  93. package/docs/examples/batch-copy/validator.vue +73 -0
  94. package/docs/examples/batch-editor/basic.vue +120 -0
  95. package/docs/examples/batch-editor/customization.vue +167 -0
  96. package/docs/examples/border/index.vue +3 -0
  97. package/docs/examples/breadcrumb/index.vue +33 -0
  98. package/docs/examples/button/demo1.vue +119 -0
  99. package/docs/examples/button/demo2.vue +18 -0
  100. package/docs/examples/button/demo3.vue +32 -0
  101. package/docs/examples/button/demo4.vue +41 -0
  102. package/docs/examples/button/demo5.vue +46 -0
  103. package/docs/examples/button/demo6.vue +35 -0
  104. package/docs/examples/calendar/calendar01.vue +46 -0
  105. package/docs/examples/calendar/calendar02.vue +16 -0
  106. package/docs/examples/calendar/calendar03.vue +6 -0
  107. package/docs/examples/calendar/calendar04.vue +54 -0
  108. package/docs/examples/calendar/calendar05.vue +36 -0
  109. package/docs/examples/calendar/calendar06.vue +53 -0
  110. package/docs/examples/card/basic-card.vue +7 -0
  111. package/docs/examples/card/card-title.vue +6 -0
  112. package/docs/examples/card/collapsible-card.vue +26 -0
  113. package/docs/examples/card/title-card.vue +32 -0
  114. package/docs/examples/carousel/index.vue +3 -0
  115. package/docs/examples/cascader/clearable.vue +52 -0
  116. package/docs/examples/cascader/collapse-tags.vue +84 -0
  117. package/docs/examples/cascader/disabled-select.vue +52 -0
  118. package/docs/examples/cascader/disabled.vue +54 -0
  119. package/docs/examples/cascader/filterable.vue +82 -0
  120. package/docs/examples/cascader/index.vue +173 -0
  121. package/docs/examples/cascader/multiple.vue +74 -0
  122. package/docs/examples/cascader/show-all-levels.vue +63 -0
  123. package/docs/examples/cascader/sizes.vue +71 -0
  124. package/docs/examples/checkbox/basic.vue +47 -0
  125. package/docs/examples/checkbox/button-style.vue +73 -0
  126. package/docs/examples/checkbox/disabled.vue +20 -0
  127. package/docs/examples/checkbox/grouping.vue +32 -0
  128. package/docs/examples/checkbox/intermediate.vue +43 -0
  129. package/docs/examples/checkbox/limitation.vue +23 -0
  130. package/docs/examples/checkbox/with-border.vue +74 -0
  131. package/docs/examples/collapse/index.vue +3 -0
  132. package/docs/examples/column-table/basic.vue +47 -0
  133. package/docs/examples/column-table/column-title.vue +48 -0
  134. package/docs/examples/column-table/custom.vue +125 -0
  135. package/docs/examples/column-table/index.vue +209 -0
  136. package/docs/examples/column-table/nested.vue +123 -0
  137. package/docs/examples/column-table/no-header.vue +50 -0
  138. package/docs/examples/date-picker/default.vue +106 -0
  139. package/docs/examples/date-picker/index.vue +98 -0
  140. package/docs/examples/date-picker/otherUnits.vue +118 -0
  141. package/docs/examples/date-picker/periodTime.vue +108 -0
  142. package/docs/examples/date-time-picker/default.vue +83 -0
  143. package/docs/examples/date-time-picker/format.vue +90 -0
  144. package/docs/examples/date-time-picker/index.vue +110 -0
  145. package/docs/examples/date-time-picker/range.vue +111 -0
  146. package/docs/examples/date-time-picker/time-format.vue +78 -0
  147. package/docs/examples/demo/demo1.vue +3 -0
  148. package/docs/examples/demo/demo2.vue +3 -0
  149. package/docs/examples/description/custom-description.vue +30 -0
  150. package/docs/examples/description/index.vue +13 -0
  151. package/docs/examples/description/labelJustify.vue +58 -0
  152. package/docs/examples/description/merge-description.vue +15 -0
  153. package/docs/examples/design/color-palette.vue +225 -0
  154. package/docs/examples/dialog/align-center.vue +34 -0
  155. package/docs/examples/dialog/basic.vue +31 -0
  156. package/docs/examples/dialog/centered-content.vue +34 -0
  157. package/docs/examples/dialog/customization-content.vue +129 -0
  158. package/docs/examples/dialog/customization-header.vue +60 -0
  159. package/docs/examples/dialog/msg-dialog.vue +63 -0
  160. package/docs/examples/dialog/nested-dialog.vue +43 -0
  161. package/docs/examples/dialog/title-icon.vue +32 -0
  162. package/docs/examples/drawer/custom-content.vue +182 -0
  163. package/docs/examples/drawer/custom-header.vue +30 -0
  164. package/docs/examples/drawer/index.vue +101 -0
  165. package/docs/examples/drawer/modal.vue +40 -0
  166. package/docs/examples/drawer/nested.vue +44 -0
  167. package/docs/examples/drawer/no-title.vue +22 -0
  168. package/docs/examples/drawer/resizable.vue +28 -0
  169. package/docs/examples/editor/basic.vue +53 -0
  170. package/docs/examples/editor/customization-desc.vue +56 -0
  171. package/docs/examples/editor/more-demo.vue +54 -0
  172. package/docs/examples/editor/more-form.vue +56 -0
  173. package/docs/examples/editor/number-desc.vue +55 -0
  174. package/docs/examples/empty/basic.vue +4 -0
  175. package/docs/examples/empty/bottom-content.vue +5 -0
  176. package/docs/examples/empty/custom-image.vue +6 -0
  177. package/docs/examples/empty/image-size.vue +6 -0
  178. package/docs/examples/file-task-dialog/index.vue +52 -0
  179. package/docs/examples/form/accessibility.vue +48 -0
  180. package/docs/examples/form/alignment.vue +68 -0
  181. package/docs/examples/form/basic-form.vue +120 -0
  182. package/docs/examples/form/custom-validation.vue +121 -0
  183. package/docs/examples/form/form-items.vue +111 -0
  184. package/docs/examples/form/inline-form.vue +70 -0
  185. package/docs/examples/form/number-validate.vue +60 -0
  186. package/docs/examples/form/size-control.vue +140 -0
  187. package/docs/examples/form/validation.vue +265 -0
  188. package/docs/examples/icon/icon.vue +52 -0
  189. package/docs/examples/icon/index.vue +7 -0
  190. package/docs/examples/image/error.vue +69 -0
  191. package/docs/examples/image/index.vue +47 -0
  192. package/docs/examples/image/lazy.vue +39 -0
  193. package/docs/examples/image/placeholder.vue +69 -0
  194. package/docs/examples/image/preview.vue +37 -0
  195. package/docs/examples/import-dialog/multiple.vue +35 -0
  196. package/docs/examples/import-dialog/single.vue +37 -0
  197. package/docs/examples/independent-nav/icon-slot.vue +7 -0
  198. package/docs/examples/independent-nav/index.vue +12 -0
  199. package/docs/examples/input/icon.vue +26 -0
  200. package/docs/examples/input/index.vue +9 -0
  201. package/docs/examples/input-number/index.vue +19 -0
  202. package/docs/examples/layout/gutter.vue +51 -0
  203. package/docs/examples/layout/index.vue +97 -0
  204. package/docs/examples/layout/justify.vue +122 -0
  205. package/docs/examples/layout/mixed.vue +70 -0
  206. package/docs/examples/layout/offset.vue +70 -0
  207. package/docs/examples/layout/responsive.vue +69 -0
  208. package/docs/examples/link/index01.vue +20 -0
  209. package/docs/examples/link/index02.vue +41 -0
  210. package/docs/examples/link/index03.vue +43 -0
  211. package/docs/examples/link/index04.vue +131 -0
  212. package/docs/examples/mention/index.vue +3 -0
  213. package/docs/examples/message/closeable.vue +92 -0
  214. package/docs/examples/message/grouping.vue +22 -0
  215. package/docs/examples/message/html.vue +21 -0
  216. package/docs/examples/message/index.vue +34 -0
  217. package/docs/examples/message/placement.vue +96 -0
  218. package/docs/examples/message/plain.vue +80 -0
  219. package/docs/examples/message/types.vue +66 -0
  220. package/docs/examples/nav/index.vue +20 -0
  221. package/docs/examples/pagination/background-color.vue +17 -0
  222. package/docs/examples/pagination/basic.vue +43 -0
  223. package/docs/examples/pagination/disabled.vue +17 -0
  224. package/docs/examples/pagination/more.vue +43 -0
  225. package/docs/examples/pagination/number-of-pagers.vue +17 -0
  226. package/docs/examples/pagination/small.vue +17 -0
  227. package/docs/examples/popover/basic.vue +81 -0
  228. package/docs/examples/popover/index.vue +144 -0
  229. package/docs/examples/popover/nested.vue +36 -0
  230. package/docs/examples/popover/rich-content.vue +100 -0
  231. package/docs/examples/popover/virtual-trigger.vue +32 -0
  232. package/docs/examples/progress/index.vue +3 -0
  233. package/docs/examples/radio/basic-usage.vue +44 -0
  234. package/docs/examples/radio/button-fill-textcolor.vue +82 -0
  235. package/docs/examples/radio/button-style.vue +77 -0
  236. package/docs/examples/radio/disabled.vue +21 -0
  237. package/docs/examples/radio/radio-button-group.vue +13 -0
  238. package/docs/examples/radio/with-borders.vue +77 -0
  239. package/docs/examples/result/index.vue +3 -0
  240. package/docs/examples/scrollbar/horizontal.vue +39 -0
  241. package/docs/examples/scrollbar/index.vue +31 -0
  242. package/docs/examples/scrollbar/infinite.vue +43 -0
  243. package/docs/examples/scrollbar/manual.vue +68 -0
  244. package/docs/examples/scrollbar/max-height.vue +44 -0
  245. package/docs/examples/search-panel/index.vue +108 -0
  246. package/docs/examples/search-panel/nowrap.vue +115 -0
  247. package/docs/examples/select/allow-create.vue +36 -0
  248. package/docs/examples/select/clearable.vue +29 -0
  249. package/docs/examples/select/collapse-tags.vue +54 -0
  250. package/docs/examples/select/custom-template.vue +40 -0
  251. package/docs/examples/select/disabled-option.vue +29 -0
  252. package/docs/examples/select/disabled-select.vue +29 -0
  253. package/docs/examples/select/empty.vue +21 -0
  254. package/docs/examples/select/filterable.vue +37 -0
  255. package/docs/examples/select/grouping.vue +40 -0
  256. package/docs/examples/select/header-footer.vue +38 -0
  257. package/docs/examples/select/index.vue +28 -0
  258. package/docs/examples/select/loading.vue +41 -0
  259. package/docs/examples/select/multiple-limit.vue +36 -0
  260. package/docs/examples/select/multiple.vue +37 -0
  261. package/docs/examples/select/remote-search.vue +56 -0
  262. package/docs/examples/select/sizes.vue +62 -0
  263. package/docs/examples/select/value-key.vue +33 -0
  264. package/docs/examples/slider/index.vue +3 -0
  265. package/docs/examples/space/alignment.vue +47 -0
  266. package/docs/examples/space/custom-size.vue +58 -0
  267. package/docs/examples/space/fill-ratio.vue +77 -0
  268. package/docs/examples/space/fill.vue +57 -0
  269. package/docs/examples/space/index.vue +52 -0
  270. package/docs/examples/space/size.vue +70 -0
  271. package/docs/examples/space/spacer.vue +35 -0
  272. package/docs/examples/space/vertical.vue +52 -0
  273. package/docs/examples/space/wrap.vue +16 -0
  274. package/docs/examples/steps/index.vue +50 -0
  275. package/docs/examples/steps/navigation.vue +37 -0
  276. package/docs/examples/switch/disabled.vue +19 -0
  277. package/docs/examples/switch/icon.vue +21 -0
  278. package/docs/examples/switch/index.vue +17 -0
  279. package/docs/examples/switch/loading.vue +19 -0
  280. package/docs/examples/switch/size.vue +29 -0
  281. package/docs/examples/switch/text.vue +37 -0
  282. package/docs/examples/switch/validate-value.vue +16 -0
  283. package/docs/examples/table/basic.vue +60 -0
  284. package/docs/examples/table/check-strictly.vue +98 -0
  285. package/docs/examples/table/custom-column.vue +98 -0
  286. package/docs/examples/table/custom-header.vue +87 -0
  287. package/docs/examples/table/custom-index.vue +71 -0
  288. package/docs/examples/table/expandable-row.vue +285 -0
  289. package/docs/examples/table/filter.vue +116 -0
  290. package/docs/examples/table/fixed-column-and-group-header.vue +101 -0
  291. package/docs/examples/table/fixed-column-and-header.vue +101 -0
  292. package/docs/examples/table/fixed-column.vue +107 -0
  293. package/docs/examples/table/fixed-header-with-fluid-header.vue +114 -0
  294. package/docs/examples/table/fixed-header.vue +64 -0
  295. package/docs/examples/table/grouping-header.vue +103 -0
  296. package/docs/examples/table/multi-select.vue +116 -0
  297. package/docs/examples/table/rowspan-and-colspan.vue +147 -0
  298. package/docs/examples/table/show-overflow-tooltip.vue +64 -0
  299. package/docs/examples/table/single-select.vue +78 -0
  300. package/docs/examples/table/sort.vue +63 -0
  301. package/docs/examples/table/striped.vue +49 -0
  302. package/docs/examples/table/summary.vue +150 -0
  303. package/docs/examples/table/table-layout.vue +56 -0
  304. package/docs/examples/table/tooltip-formatter.vue +93 -0
  305. package/docs/examples/table/tree-and-lazy.vue +149 -0
  306. package/docs/examples/table/with-border.vue +49 -0
  307. package/docs/examples/table/with-status.vue +73 -0
  308. package/docs/examples/table-grid/basic.vue +51 -0
  309. package/docs/examples/table-grid/complete.vue +258 -0
  310. package/docs/examples/table-head-editor/grouping-header.vue +409 -0
  311. package/docs/examples/table-head-editor/index.vue +246 -0
  312. package/docs/examples/tabs/default.vue +47 -0
  313. package/docs/examples/tabs/index.vue +46 -0
  314. package/docs/examples/tag/basic.vue +20 -0
  315. package/docs/examples/tag/closable.vue +31 -0
  316. package/docs/examples/tag/dot.vue +21 -0
  317. package/docs/examples/tag/effect.vue +35 -0
  318. package/docs/examples/tag/icon.vue +21 -0
  319. package/docs/examples/text/index.vue +3 -0
  320. package/docs/examples/time-picker/disabled.vue +53 -0
  321. package/docs/examples/time-picker/index.vue +49 -0
  322. package/docs/examples/time-picker/range.vue +36 -0
  323. package/docs/examples/time-select/disabled.vue +30 -0
  324. package/docs/examples/time-select/index.vue +29 -0
  325. package/docs/examples/tooltip/disabled.vue +20 -0
  326. package/docs/examples/tooltip/index.vue +63 -0
  327. package/docs/examples/tooltip/more-content.vue +19 -0
  328. package/docs/examples/tooltip/theme.vue +32 -0
  329. package/docs/examples/tooltip/virtual-trigger.vue +31 -0
  330. package/docs/examples/tour/index.vue +3 -0
  331. package/docs/examples/tree/basic.vue +86 -0
  332. package/docs/examples/tree/checkable.vue +65 -0
  333. package/docs/examples/tree/custom-node.vue +123 -0
  334. package/docs/examples/tree/default-expanded.vue +73 -0
  335. package/docs/examples/tree/draggable.vue +123 -0
  336. package/docs/examples/tree/filter.vue +96 -0
  337. package/docs/examples/tree/index.vue +86 -0
  338. package/docs/examples/tree-select/basic.vue +96 -0
  339. package/docs/examples/tree-select/check-strictly.vue +109 -0
  340. package/docs/examples/tree-select/custom-content.vue +110 -0
  341. package/docs/examples/tree-select/disabled.vue +89 -0
  342. package/docs/examples/tree-select/filterable.vue +112 -0
  343. package/docs/examples/tree-select/index.vue +87 -0
  344. package/docs/examples/tree-select/lazy.vue +43 -0
  345. package/docs/examples/tree-select/multiple.vue +111 -0
  346. package/docs/examples/tree-select/node-key.vue +35 -0
  347. package/docs/guide/changelog.md +6 -0
  348. package/docs/guide/import-on-demand.md +49 -0
  349. package/docs/guide/index.md +55 -0
  350. package/docs/guide/introduction.md +21 -0
  351. package/docs/guide/quickstart.md +35 -0
  352. package/docs/guide/start.md +113 -0
  353. package/docs/index.md +27 -0
  354. package/docs/markdown-examples.md +85 -0
  355. package/docs/package.json +26 -0
  356. package/docs/postcss.config.mjs +9 -0
  357. package/docs/toolkit/domain.md +55 -0
  358. package/docs/toolkit/env.md +73 -0
  359. package/docs/toolkit/examples/domain-aim.vue +35 -0
  360. package/docs/toolkit/examples/domain-supplier.vue +34 -0
  361. package/docs/toolkit/examples/env-basic.vue +28 -0
  362. package/docs/toolkit/examples/env-constants.vue +39 -0
  363. package/docs/toolkit/examples/env-node-constants.vue +38 -0
  364. package/docs/toolkit/examples/env-node.vue +34 -0
  365. package/docs/toolkit/examples/monitor-init.vue +53 -0
  366. package/docs/toolkit/examples/monitor-vue-error.vue +31 -0
  367. package/docs/toolkit/examples/request-baseurl.vue +66 -0
  368. package/docs/toolkit/examples/request-basic.vue +48 -0
  369. package/docs/toolkit/examples/request-cache.vue +137 -0
  370. package/docs/toolkit/examples/wujie-logout.vue +42 -0
  371. package/docs/toolkit/examples/wujie-token.vue +63 -0
  372. package/docs/toolkit/monitor.md +69 -0
  373. package/docs/toolkit/request.md +127 -0
  374. package/docs/toolkit/start.md +110 -0
  375. package/docs/toolkit/wujie.md +34 -0
  376. package/docs/tsconfig.json +29 -0
  377. package/package.json +47 -0
  378. package/packages/components/CHANGELOG.md +81 -0
  379. package/packages/components/README.md +83 -0
  380. package/packages/components/package.json +36 -0
  381. package/packages/components/src/action-menu/index.ts +5 -0
  382. package/packages/components/src/action-menu/src/action-menu.ts +34 -0
  383. package/packages/components/src/action-menu/src/action-menu.vue +364 -0
  384. package/packages/components/src/arrow-steps/index.ts +11 -0
  385. package/packages/components/src/arrow-steps/src/arrow-step.ts +8 -0
  386. package/packages/components/src/arrow-steps/src/arrow-step.vue +90 -0
  387. package/packages/components/src/arrow-steps/src/arrow-steps.ts +16 -0
  388. package/packages/components/src/arrow-steps/src/arrow-steps.vue +42 -0
  389. package/packages/components/src/badge/index.ts +5 -0
  390. package/packages/components/src/badge/src/badge.ts +8 -0
  391. package/packages/components/src/badge/src/badge.vue +20 -0
  392. package/packages/components/src/batch-copy/index.ts +5 -0
  393. package/packages/components/src/batch-copy/src/batch-copy.ts +39 -0
  394. package/packages/components/src/batch-copy/src/batch-copy.vue +214 -0
  395. package/packages/components/src/batch-editor/index.ts +5 -0
  396. package/packages/components/src/batch-editor/src/batch-editor.ts +21 -0
  397. package/packages/components/src/batch-editor/src/batch-editor.vue +73 -0
  398. package/packages/components/src/border/index.ts +5 -0
  399. package/packages/components/src/border/src/border.ts +8 -0
  400. package/packages/components/src/border/src/border.vue +20 -0
  401. package/packages/components/src/breadcrumb/index.ts +8 -0
  402. package/packages/components/src/breadcrumb/src/breadcrumb-item.ts +8 -0
  403. package/packages/components/src/breadcrumb/src/breadcrumb-item.vue +20 -0
  404. package/packages/components/src/breadcrumb/src/breadcrumb.ts +8 -0
  405. package/packages/components/src/breadcrumb/src/breadcrumb.vue +20 -0
  406. package/packages/components/src/button/index.ts +5 -0
  407. package/packages/components/src/button/src/button.ts +12 -0
  408. package/packages/components/src/button/src/button.vue +132 -0
  409. package/packages/components/src/calendar/index.ts +5 -0
  410. package/packages/components/src/calendar/src/calendar.ts +36 -0
  411. package/packages/components/src/calendar/src/calendar.vue +962 -0
  412. package/packages/components/src/card/index.ts +8 -0
  413. package/packages/components/src/card/src/card.ts +29 -0
  414. package/packages/components/src/card/src/card.vue +106 -0
  415. package/packages/components/src/card/src/title.ts +8 -0
  416. package/packages/components/src/card/src/title.vue +14 -0
  417. package/packages/components/src/carousel/index.ts +5 -0
  418. package/packages/components/src/carousel/src/carousel.ts +8 -0
  419. package/packages/components/src/carousel/src/carousel.vue +20 -0
  420. package/packages/components/src/cascader/index.ts +5 -0
  421. package/packages/components/src/cascader/src/cascader.ts +3 -0
  422. package/packages/components/src/cascader/src/cascader.vue +62 -0
  423. package/packages/components/src/checkbox/index.ts +11 -0
  424. package/packages/components/src/checkbox/src/checkbox.vue +19 -0
  425. package/packages/components/src/collapse/index.ts +5 -0
  426. package/packages/components/src/collapse/src/collapse.ts +8 -0
  427. package/packages/components/src/collapse/src/collapse.vue +20 -0
  428. package/packages/components/src/column-table/index.ts +7 -0
  429. package/packages/components/src/column-table/src/column-table-row.ts +30 -0
  430. package/packages/components/src/column-table/src/column-table-row.vue +17 -0
  431. package/packages/components/src/column-table/src/column-table.ts +60 -0
  432. package/packages/components/src/column-table/src/column-table.vue +141 -0
  433. package/packages/components/src/column-table/src/tokens.ts +6 -0
  434. package/packages/components/src/date-picker/index.ts +5 -0
  435. package/packages/components/src/date-picker/src/date-picker.ts +3 -0
  436. package/packages/components/src/date-picker/src/date-picker.vue +14 -0
  437. package/packages/components/src/demo/index.ts +5 -0
  438. package/packages/components/src/demo/src/demo.ts +8 -0
  439. package/packages/components/src/demo/src/demo.vue +20 -0
  440. package/packages/components/src/description/index.ts +8 -0
  441. package/packages/components/src/description/src/description-item.ts +12 -0
  442. package/packages/components/src/description/src/description-item.vue +103 -0
  443. package/packages/components/src/description/src/description.ts +20 -0
  444. package/packages/components/src/description/src/description.vue +28 -0
  445. package/packages/components/src/dialog/index.ts +6 -0
  446. package/packages/components/src/dialog/src/dialog.ts +62 -0
  447. package/packages/components/src/dialog/src/dialog.vue +121 -0
  448. package/packages/components/src/dialog/src/msg-dialog.ts +84 -0
  449. package/packages/components/src/dialog/src/types.ts +8 -0
  450. package/packages/components/src/drawer/index.ts +5 -0
  451. package/packages/components/src/drawer/src/drawer.ts +8 -0
  452. package/packages/components/src/drawer/src/drawer.vue +24 -0
  453. package/packages/components/src/editor/index.ts +5 -0
  454. package/packages/components/src/editor/src/editor.ts +13 -0
  455. package/packages/components/src/editor/src/editor.vue +70 -0
  456. package/packages/components/src/empty/index.ts +5 -0
  457. package/packages/components/src/empty/src/empty.ts +3 -0
  458. package/packages/components/src/empty/src/empty.vue +37 -0
  459. package/packages/components/src/empty/src/img-empty.vue +39 -0
  460. package/packages/components/src/file-task-dialog/index.ts +5 -0
  461. package/packages/components/src/file-task-dialog/src/file-task-dialog.ts +32 -0
  462. package/packages/components/src/file-task-dialog/src/file-task-dialog.vue +228 -0
  463. package/packages/components/src/form/index.ts +3 -0
  464. package/packages/components/src/icon/index.ts +5 -0
  465. package/packages/components/src/icon/src/icon.ts +10 -0
  466. package/packages/components/src/icon/src/icon.vue +29 -0
  467. package/packages/components/src/image/index.ts +5 -0
  468. package/packages/components/src/image/src/image.ts +8 -0
  469. package/packages/components/src/image/src/image.vue +57 -0
  470. package/packages/components/src/import-dialog/index.ts +5 -0
  471. package/packages/components/src/import-dialog/src/import-dialog.ts +11 -0
  472. package/packages/components/src/import-dialog/src/import-dialog.vue +207 -0
  473. package/packages/components/src/independent-nav/index.ts +5 -0
  474. package/packages/components/src/independent-nav/src/independent-nav.ts +7 -0
  475. package/packages/components/src/independent-nav/src/independent-nav.vue +61 -0
  476. package/packages/components/src/index.ts +235 -0
  477. package/packages/components/src/input/index.ts +5 -0
  478. package/packages/components/src/input/src/input.ts +3 -0
  479. package/packages/components/src/input/src/input.vue +53 -0
  480. package/packages/components/src/input-number/index.ts +5 -0
  481. package/packages/components/src/input-number/src/input-number.ts +3 -0
  482. package/packages/components/src/input-number/src/input-number.vue +25 -0
  483. package/packages/components/src/layout/index.ts +7 -0
  484. package/packages/components/src/layout/src/col.vue +43 -0
  485. package/packages/components/src/layout/src/layout.ts +13 -0
  486. package/packages/components/src/layout/src/row.vue +43 -0
  487. package/packages/components/src/link/index.ts +5 -0
  488. package/packages/components/src/link/src/link.ts +13 -0
  489. package/packages/components/src/link/src/link.vue +74 -0
  490. package/packages/components/src/mention/index.ts +5 -0
  491. package/packages/components/src/mention/src/mention.ts +8 -0
  492. package/packages/components/src/mention/src/mention.vue +20 -0
  493. package/packages/components/src/message/index.ts +1 -0
  494. package/packages/components/src/message/src/message.ts +161 -0
  495. package/packages/components/src/nav/index.ts +7 -0
  496. package/packages/components/src/nav/src/nav.ts +19 -0
  497. package/packages/components/src/nav/src/nav.vue +66 -0
  498. package/packages/components/src/nav/src/types.ts +11 -0
  499. package/packages/components/src/pagination/index.ts +5 -0
  500. package/packages/components/src/pagination/src/pagination.ts +60 -0
  501. package/packages/components/src/pagination/src/pagination.vue +38 -0
  502. package/packages/components/src/popover/index.ts +5 -0
  503. package/packages/components/src/popover/src/popover.ts +14 -0
  504. package/packages/components/src/popover/src/popover.vue +60 -0
  505. package/packages/components/src/progress/index.ts +5 -0
  506. package/packages/components/src/progress/src/progress.ts +8 -0
  507. package/packages/components/src/progress/src/progress.vue +20 -0
  508. package/packages/components/src/radio/index.ts +11 -0
  509. package/packages/components/src/radio/src/radio.vue +13 -0
  510. package/packages/components/src/result/index.ts +5 -0
  511. package/packages/components/src/result/src/result.ts +8 -0
  512. package/packages/components/src/result/src/result.vue +20 -0
  513. package/packages/components/src/scrollbar/index.ts +5 -0
  514. package/packages/components/src/scrollbar/src/scrollbar.ts +8 -0
  515. package/packages/components/src/scrollbar/src/scrollbar.vue +54 -0
  516. package/packages/components/src/search-panel/index.ts +5 -0
  517. package/packages/components/src/search-panel/src/search-panel.ts +8 -0
  518. package/packages/components/src/search-panel/src/search-panel.vue +251 -0
  519. package/packages/components/src/select/index.ts +9 -0
  520. package/packages/components/src/select/src/select.ts +3 -0
  521. package/packages/components/src/select/src/select.vue +43 -0
  522. package/packages/components/src/slider/index.ts +5 -0
  523. package/packages/components/src/slider/src/slider.ts +8 -0
  524. package/packages/components/src/slider/src/slider.vue +20 -0
  525. package/packages/components/src/space/index.ts +5 -0
  526. package/packages/components/src/space/src/space.ts +8 -0
  527. package/packages/components/src/space/src/space.vue +43 -0
  528. package/packages/components/src/steps/index.ts +8 -0
  529. package/packages/components/src/steps/src/step.ts +15 -0
  530. package/packages/components/src/steps/src/step.vue +18 -0
  531. package/packages/components/src/steps/src/steps.ts +20 -0
  532. package/packages/components/src/steps/src/steps.vue +95 -0
  533. package/packages/components/src/steps/src/tokens.ts +6 -0
  534. package/packages/components/src/switch/index.ts +5 -0
  535. package/packages/components/src/switch/src/switch.ts +8 -0
  536. package/packages/components/src/switch/src/switch.vue +51 -0
  537. package/packages/components/src/table/index.ts +7 -0
  538. package/packages/components/src/table/src/table.ts +34 -0
  539. package/packages/components/src/table/src/table.vue +47 -0
  540. package/packages/components/src/table-grid/index.ts +7 -0
  541. package/packages/components/src/table-grid/src/render-cell.vue +44 -0
  542. package/packages/components/src/table-grid/src/table-grid.ts +159 -0
  543. package/packages/components/src/table-grid/src/table-grid.vue +334 -0
  544. package/packages/components/src/table-head-editor/index.ts +5 -0
  545. package/packages/components/src/table-head-editor/src/table-head-editor.ts +59 -0
  546. package/packages/components/src/table-head-editor/src/table-head-editor.vue +780 -0
  547. package/packages/components/src/table-head-editor/src/utils.ts +192 -0
  548. package/packages/components/src/tabs/index.ts +7 -0
  549. package/packages/components/src/tabs/src/tabs.ts +8 -0
  550. package/packages/components/src/tabs/src/tabs.vue +23 -0
  551. package/packages/components/src/tag/index.ts +5 -0
  552. package/packages/components/src/tag/src/tag.ts +47 -0
  553. package/packages/components/src/tag/src/tag.vue +60 -0
  554. package/packages/components/src/tag/src/types.ts +8 -0
  555. package/packages/components/src/text/index.ts +5 -0
  556. package/packages/components/src/text/src/text.ts +8 -0
  557. package/packages/components/src/text/src/text.vue +20 -0
  558. package/packages/components/src/time-picker/index.ts +5 -0
  559. package/packages/components/src/time-picker/src/time-picker.ts +3 -0
  560. package/packages/components/src/time-picker/src/time-picker.vue +14 -0
  561. package/packages/components/src/time-select/index.ts +5 -0
  562. package/packages/components/src/time-select/src/time-select.ts +5 -0
  563. package/packages/components/src/time-select/src/time-select.vue +14 -0
  564. package/packages/components/src/tooltip/index.ts +5 -0
  565. package/packages/components/src/tooltip/src/tooltip.ts +6 -0
  566. package/packages/components/src/tooltip/src/tooltip.vue +71 -0
  567. package/packages/components/src/tour/index.ts +5 -0
  568. package/packages/components/src/tour/src/tour.ts +8 -0
  569. package/packages/components/src/tour/src/tour.vue +20 -0
  570. package/packages/components/src/tree/index.ts +5 -0
  571. package/packages/components/src/tree/src/tree.ts +8 -0
  572. package/packages/components/src/tree/src/tree.vue +77 -0
  573. package/packages/components/src/tree-select/index.ts +3 -0
  574. package/packages/components/src/tree-select/src/tree-select.vue +96 -0
  575. package/packages/components/tsconfig.json +19 -0
  576. package/packages/components/vite.config.ts +32 -0
  577. package/packages/icons/CHANGELOG.md +45 -0
  578. package/packages/icons/README.md +86 -0
  579. package/packages/icons/package.json +30 -0
  580. package/packages/icons/src/components/arrow-down.vue +12 -0
  581. package/packages/icons/src/components/arrow-left.vue +12 -0
  582. package/packages/icons/src/components/arrow-right.vue +12 -0
  583. package/packages/icons/src/components/arrow-up.vue +12 -0
  584. package/packages/icons/src/components/circle-check.vue +15 -0
  585. package/packages/icons/src/components/circle-close.vue +15 -0
  586. package/packages/icons/src/components/close.vue +13 -0
  587. package/packages/icons/src/components/copy.vue +12 -0
  588. package/packages/icons/src/components/delete.vue +12 -0
  589. package/packages/icons/src/components/download.vue +15 -0
  590. package/packages/icons/src/components/edit.vue +12 -0
  591. package/packages/icons/src/components/error.vue +12 -0
  592. package/packages/icons/src/components/export.vue +17 -0
  593. package/packages/icons/src/components/file.vue +21 -0
  594. package/packages/icons/src/components/import.vue +19 -0
  595. package/packages/icons/src/components/index.ts +37 -0
  596. package/packages/icons/src/components/info.vue +13 -0
  597. package/packages/icons/src/components/list-process.vue +37 -0
  598. package/packages/icons/src/components/log.vue +17 -0
  599. package/packages/icons/src/components/minus.vue +13 -0
  600. package/packages/icons/src/components/money-bubble.vue +21 -0
  601. package/packages/icons/src/components/plane.vue +30 -0
  602. package/packages/icons/src/components/plus.vue +17 -0
  603. package/packages/icons/src/components/printer.vue +17 -0
  604. package/packages/icons/src/components/reset.vue +21 -0
  605. package/packages/icons/src/components/right.vue +21 -0
  606. package/packages/icons/src/components/search.vue +15 -0
  607. package/packages/icons/src/components/select.vue +17 -0
  608. package/packages/icons/src/components/semi-select.vue +17 -0
  609. package/packages/icons/src/components/setting.vue +25 -0
  610. package/packages/icons/src/components/stamp.vue +35 -0
  611. package/packages/icons/src/components/success.vue +13 -0
  612. package/packages/icons/src/components/tree-triangle.vue +17 -0
  613. package/packages/icons/src/components/upload.vue +21 -0
  614. package/packages/icons/src/components/view.vue +15 -0
  615. package/packages/icons/src/components/warning.vue +13 -0
  616. package/packages/icons/src/components/zoom-in.vue +27 -0
  617. package/packages/icons/src/components/zoom-out.vue +27 -0
  618. package/packages/icons/src/index.ts +9 -0
  619. package/packages/icons/tsconfig.json +10 -0
  620. package/packages/icons/vite.config.ts +33 -0
  621. package/packages/styles/CHANGELOG.md +99 -0
  622. package/packages/styles/README.md +107 -0
  623. package/packages/styles/package.json +23 -0
  624. package/packages/styles/src/action-menu.scss +103 -0
  625. package/packages/styles/src/arrow-step.scss +138 -0
  626. package/packages/styles/src/arrow-steps.scss +8 -0
  627. package/packages/styles/src/batch-copy.scss +40 -0
  628. package/packages/styles/src/batch-editor.scss +36 -0
  629. package/packages/styles/src/breadcrumb.scss +29 -0
  630. package/packages/styles/src/button.scss +127 -0
  631. package/packages/styles/src/calendar.scss +327 -0
  632. package/packages/styles/src/card.scss +85 -0
  633. package/packages/styles/src/cascader.scss +59 -0
  634. package/packages/styles/src/checkbox.scss +46 -0
  635. package/packages/styles/src/column-table.scss +13 -0
  636. package/packages/styles/src/date-picker.scss +547 -0
  637. package/packages/styles/src/description.scss +38 -0
  638. package/packages/styles/src/dialog.scss +120 -0
  639. package/packages/styles/src/drawer.scss +22 -0
  640. package/packages/styles/src/editor.scss +13 -0
  641. package/packages/styles/src/empty.scss +12 -0
  642. package/packages/styles/src/file-task-dialog.scss +13 -0
  643. package/packages/styles/src/image.scss +6 -0
  644. package/packages/styles/src/import-dialog.scss +122 -0
  645. package/packages/styles/src/independent-nav.scss +37 -0
  646. package/packages/styles/src/index.scss +46 -0
  647. package/packages/styles/src/input-number.scss +34 -0
  648. package/packages/styles/src/input.scss +28 -0
  649. package/packages/styles/src/link.scss +70 -0
  650. package/packages/styles/src/message.scss +12 -0
  651. package/packages/styles/src/mixins.scss +60 -0
  652. package/packages/styles/src/nav.scss +12 -0
  653. package/packages/styles/src/overrides.scss +25 -0
  654. package/packages/styles/src/pagination.scss +161 -0
  655. package/packages/styles/src/popover.scss +4 -0
  656. package/packages/styles/src/radio.scss +54 -0
  657. package/packages/styles/src/search-panel.scss +51 -0
  658. package/packages/styles/src/select.scss +44 -0
  659. package/packages/styles/src/steps.scss +336 -0
  660. package/packages/styles/src/switch.scss +35 -0
  661. package/packages/styles/src/table-grid.scss +37 -0
  662. package/packages/styles/src/table-head-editor.scss +112 -0
  663. package/packages/styles/src/table.scss +33 -0
  664. package/packages/styles/src/tabs.scss +45 -0
  665. package/packages/styles/src/tag.scss +29 -0
  666. package/packages/styles/src/theme.scss +101 -0
  667. package/packages/styles/src/time-picker.scss +225 -0
  668. package/packages/styles/src/time-select.scss +141 -0
  669. package/packages/styles/src/tooltip.scss +21 -0
  670. package/packages/styles/src/tree-select.scss +52 -0
  671. package/packages/styles/src/tree.scss +8 -0
  672. package/packages/styles/src/utilities.scss +81 -0
  673. package/packages/styles/src/variables.scss +56 -0
  674. package/packages/styles/vite.config.ts +28 -0
  675. package/pnpm-workspace.yaml +3 -0
  676. package/tsconfig.json +46 -0
@@ -0,0 +1,962 @@
1
+ <template>
2
+ <el-calendar
3
+ ref="calendarRef"
4
+ class="m-calendar"
5
+ v-model="innerValue"
6
+ v-bind="calendarAttrs"
7
+ :range="props.range"
8
+ @update:model-value="handleUpdateModelValue"
9
+ >
10
+ <!-- 甘特图模式:使用自定义的 date-cell slot -->
11
+ <template
12
+ v-if="isGanttMode"
13
+ #date-cell="{ data: { day, type } }"
14
+ >
15
+ <div class="gantt-calendar-cell">
16
+ <!-- 日期 start -->
17
+ <div
18
+ class="gantt-calendar-cell-day"
19
+ :class="dataClass(type)"
20
+ v-text="dayLabel(day)"
21
+ ></div>
22
+ <!-- 日期 end -->
23
+
24
+ <!-- 甘特图任务 start -->
25
+ <div class="gantt-calendar-cell-tasks">
26
+ <el-popover
27
+ v-for="task in ganttTasks(day)"
28
+ trigger="click"
29
+ :key="task.id"
30
+ placement="bottom-start"
31
+ :teleported="false"
32
+ @show="handlePopoverShow($event, task)"
33
+ @hide="handlePopoverHide($event, task)"
34
+ :hide-after="0"
35
+ :disabled="task.type == 'empty'"
36
+ :popper-style="{
37
+ padding: 0,
38
+ 'border-radius': '6px',
39
+ overflow: 'hidden',
40
+ width: '220px',
41
+ }"
42
+ >
43
+ <!-- reference start -->
44
+ <template #reference>
45
+ <!-- 如果用户提供了 task-item 插槽,则使用自定义插槽 -->
46
+ <slot
47
+ v-if="slots['task-item']"
48
+ name="task-item"
49
+ :day="day"
50
+ :task="task"
51
+ :taskClass="taskClass(task)"
52
+ :taskLabel="taskLabel(task)"
53
+ :shouldShowTaskName="shouldShowTaskName(task)"
54
+ :taskStyle="{
55
+ width: isExtraTask(task)
56
+ ? '100%'
57
+ : `calc(100% * ${(task as GanttTask).weekDuration ?? 1})`,
58
+ }"
59
+ ></slot>
60
+ <!-- 否则使用默认样式 -->
61
+ <template v-else>
62
+ <!-- +N 数据处理 -->
63
+ <div
64
+ class="gantt-calendar-cell-task is-extra"
65
+ @click.stop
66
+ v-if="isExtraTask(task)"
67
+ >
68
+ <div
69
+ class="gantt-calendar-cell-task-name"
70
+ v-text="taskLabel(task)"
71
+ ></div>
72
+ </div>
73
+
74
+ <!-- 单日任务的处理 -->
75
+ <div
76
+ class="gantt-calendar-cell-task is-single"
77
+ @click.stop
78
+ :class="{ 'task-ended': task.isEnded, 'task-clicked': task.isClicked }"
79
+ :style="{
80
+ backgroundColor: task?.bgColor ?? '',
81
+ color: task?.brandColor ?? '',
82
+ }"
83
+ v-else-if="(task as GanttTask).taskNodeFlag === 'single'"
84
+ >
85
+ <div
86
+ class="gantt-calendar-cell-task-name"
87
+ v-text="taskLabel(task)"
88
+ ></div>
89
+ </div>
90
+
91
+ <!-- 跨天任务的head的处理 -->
92
+ <div
93
+ class="gantt-calendar-cell-task is-head"
94
+ @click.stop
95
+ v-else-if="(task as GanttTask).taskNodeFlag === 'head'"
96
+ :class="{
97
+ 'task-ended': task.isEnded,
98
+ 'task-clicked': task.isClicked,
99
+ 'is-week-head': task.weekSegmentIndex === 1,
100
+ }"
101
+ :style="{
102
+ width: `calc(100% * ${(task as GanttTask).weekDuration ?? 1} + ${(task as GanttTask).weekDuration ?? 1}px - ${task.weekSegmentIndex === 1 ? 6 : 0}px)`,
103
+ backgroundColor: task?.bgColor ?? '',
104
+ color: task?.brandColor ?? '',
105
+ }"
106
+ >
107
+ <div
108
+ v-if="shouldShowTaskName(task)"
109
+ class="gantt-calendar-cell-task-name"
110
+ v-text="taskLabel(task)"
111
+ ></div>
112
+ </div>
113
+
114
+ <!-- 跨周任务任其他节点的处理 -->
115
+ <div
116
+ class="gantt-calendar-cell-task"
117
+ @click.stop
118
+ v-else-if="
119
+ (task as GanttTask).taskNodeFlag === 'middle' ||
120
+ (task as GanttTask).taskNodeFlag === 'end'
121
+ "
122
+ :class="[...taskClass(task), task.isEnded ? 'task-ended' : '']"
123
+ >
124
+ <div
125
+ class="gantt-calendar-cell-task-name"
126
+ v-text="task.taskNodeFlag"
127
+ ></div>
128
+ </div>
129
+ <!-- 占位任务的处理 -->
130
+ <div
131
+ class="gantt-calendar-cell-task is-empty"
132
+ @click.stop
133
+ v-else-if="task.type === 'empty'"
134
+ >
135
+ <div
136
+ class="gantt-calendar-cell-task-name"
137
+ v-text="task.type"
138
+ ></div>
139
+ </div>
140
+ <div
141
+ class="gantt-calendar-cell-task"
142
+ @click.stop
143
+ v-else
144
+ :class="{ 'task-ended': task.isEnded }"
145
+ >
146
+ <div
147
+ class="gantt-calendar-cell-task-name"
148
+ v-text="task.name"
149
+ ></div>
150
+ </div>
151
+ </template>
152
+ </template>
153
+ <!-- reference end -->
154
+
155
+ <!-- 浮层 start -->
156
+ <template #default>
157
+ <!-- 如果用户提供了 task-popover 插槽,则使用自定义插槽 -->
158
+ <slot
159
+ v-if="slots['task-popover']"
160
+ name="task-popover"
161
+ :day="day"
162
+ :task="task"
163
+ :isExtraTask="isExtraTask(task)"
164
+ :hoverTasks="hoverTasks(day, task)"
165
+ ></slot>
166
+ <!-- 否则使用默认样式 -->
167
+ <div
168
+ v-else
169
+ class="gantt-calendar-cell-task-popover"
170
+ >
171
+ <div
172
+ class="gantt-calendar-cell-task-popover-header"
173
+ :style="{ backgroundColor: task?.brandColor ?? '' }"
174
+ ></div>
175
+ <div
176
+ class="gantt-calendar-cell-task-popover-title"
177
+ v-text="dayjs(day).format('YYYY/MM/DD')"
178
+ ></div>
179
+ <div
180
+ v-if="isExtraTask(task)"
181
+ class="gantt-calendar-cell-task-popover-body"
182
+ >
183
+ <div
184
+ class="gantt-calendar-cell-task-popover-body-group"
185
+ :style="{ color: item?.brandColor ?? '' }"
186
+ v-for="item in hoverTasks(day, task)"
187
+ :key="task.id"
188
+ >
189
+ <div
190
+ class="gantt-calendar-cell-task-popover-body-group-title"
191
+ v-text="dayjs(item.startTime).format('HH:mm')"
192
+ ></div>
193
+ <div
194
+ class="gantt-calendar-cell-task-popover-body-group-content"
195
+ v-text="item.name"
196
+ ></div>
197
+ </div>
198
+ </div>
199
+ <div
200
+ v-else
201
+ class="gantt-calendar-cell-task-popover-content"
202
+ v-text="task.name"
203
+ ></div>
204
+ </div>
205
+ </template>
206
+ <!-- 浮层 end -->
207
+ </el-popover>
208
+ </div>
209
+ <!-- 甘特图任务 end -->
210
+ </div>
211
+ </template>
212
+
213
+ <!-- 默认模式:透传用户自定义的 date-cell slot -->
214
+ <template
215
+ v-else-if="slots['date-cell']"
216
+ #date-cell="props"
217
+ >
218
+ <slot
219
+ name="date-cell"
220
+ v-bind="props"
221
+ ></slot>
222
+ </template>
223
+
224
+ <!-- 透传所有其他 Element Plus Calendar 的插槽(如 header 等) -->
225
+ <template
226
+ v-for="name in calendarSlots"
227
+ :key="name"
228
+ #[name]="slotProps"
229
+ >
230
+ <slot
231
+ :name="name"
232
+ v-bind="slotProps || {}"
233
+ ></slot>
234
+ </template>
235
+ </el-calendar>
236
+ </template>
237
+
238
+ <script lang="ts" setup>
239
+ import {
240
+ computed,
241
+ onBeforeUnmount,
242
+ onMounted,
243
+ nextTick,
244
+ ref,
245
+ useAttrs,
246
+ useSlots,
247
+ watch,
248
+ } from 'vue';
249
+ import type { MaybeDate, GanttTask, CalendarProps, TaskNodeFlag } from './calendar';
250
+ import { dayjs } from 'element-plus';
251
+
252
+ const props = withDefaults(defineProps<CalendarProps>(), {});
253
+
254
+ // 定义所有可能的事件,透传 Element Plus Calendar 的所有事件
255
+ const emit = defineEmits<{
256
+ (e: 'update:modelValue', value: MaybeDate): void;
257
+ // 透传 Element Plus Calendar 的其他事件
258
+ [key: string]: (...args: any[]) => void;
259
+ }>();
260
+
261
+ const attrs = useAttrs();
262
+ const slots = useSlots();
263
+
264
+ // 计算需要透传给 el-calendar 的插槽(排除组件内部使用的插槽)
265
+ const calendarSlots = computed(() => {
266
+ const excludedSlots = ['date-cell', 'task-item', 'task-popover'];
267
+ const slotNames: string[] = [];
268
+ Object.keys(slots).forEach((name) => {
269
+ if (!excludedSlots.includes(name)) {
270
+ slotNames.push(name);
271
+ }
272
+ });
273
+ return slotNames;
274
+ });
275
+
276
+ // 过滤掉组件自己的 props,只保留需要透传给 el-calendar 的属性
277
+ const calendarAttrs = computed(() => {
278
+ const excludedKeys = ['tasks', 'range'];
279
+ const filtered: Record<string, any> = {};
280
+
281
+ Object.keys(attrs).forEach((key) => {
282
+ // 排除组件自己的 props
283
+ if (!excludedKeys.includes(key)) {
284
+ filtered[key] = attrs[key];
285
+ }
286
+ });
287
+
288
+ return filtered;
289
+ });
290
+
291
+ // 处理 modelValue 更新事件
292
+ const handleUpdateModelValue = (value: MaybeDate) => {
293
+ innerValue.value = value ?? dayjs().toDate();
294
+ emit('update:modelValue', value);
295
+ };
296
+
297
+ // 默认选中日期,初始取父层 modelValue 或当前时间
298
+ const innerValue = ref<MaybeDate>(props.modelValue ?? dayjs().toDate());
299
+ const calendarRef = ref<any>(null);
300
+
301
+ const TASK_HEIGHT = 20;
302
+ const TASK_GAP = 8;
303
+ const maxDisplay = ref(3);
304
+ const isGanttMode = computed(() => Array.isArray(props.tasks) && props.tasks.length > 0);
305
+
306
+ let resizeObserver: ResizeObserver | null = null;
307
+
308
+ const calcMaxDisplay = () => {
309
+ const root = calendarRef.value?.$el as HTMLElement | null;
310
+ if (!root) return;
311
+ const cell = root.querySelector('.gantt-calendar-cell') as HTMLElement | null;
312
+ if (!cell) return;
313
+ const dayEl = cell.querySelector('.gantt-calendar-cell-day') as HTMLElement | null;
314
+ const tasksEl = cell.querySelector('.gantt-calendar-cell-tasks') as HTMLElement | null;
315
+ const availableHeight = tasksEl?.clientHeight ?? cell.clientHeight - (dayEl?.clientHeight ?? 0);
316
+ if (!availableHeight || availableHeight <= 0) return;
317
+ const rowHeight = TASK_HEIGHT + TASK_GAP;
318
+ const display = Math.max(1, Math.floor((availableHeight + TASK_GAP) / rowHeight));
319
+ maxDisplay.value = display;
320
+ };
321
+
322
+ const handlePopoverShow = (_event: Event, task: GanttTask) => {
323
+ // 将所有与当前 task.id 相同的任务标记为已点击
324
+ Object.values(normalizedTasks.value).forEach((dayTasks) => {
325
+ dayTasks?.forEach((item) => {
326
+ if (item.id === task.id) {
327
+ item.isClicked = true;
328
+ }
329
+ });
330
+ });
331
+ };
332
+
333
+ const handlePopoverHide = (_event: Event, task: GanttTask) => {
334
+ // 将所有与当前 task.id 相同的任务还原为未点击
335
+ Object.values(normalizedTasks.value).forEach((dayTasks) => {
336
+ dayTasks?.forEach((item) => {
337
+ if (item.id === task.id) {
338
+ item.isClicked = false;
339
+ }
340
+ });
341
+ });
342
+ };
343
+ // 获取某日需要展示的任务列表(使用 ref,便于后续在任务对象上做响应式修改)
344
+ const normalizedTasks = ref<Record<string, GanttTask[]>>({});
345
+
346
+ // 监听父层传入的 v-model,同步到内部
347
+ watch(
348
+ () => props.modelValue,
349
+ (v: MaybeDate | undefined) => {
350
+ if (v !== innerValue.value) innerValue.value = v ?? dayjs().toDate();
351
+ },
352
+ );
353
+
354
+ // 内部变动回推父层 v-model
355
+ watch(innerValue, (v: MaybeDate) => emit('update:modelValue', v));
356
+
357
+ onMounted(() => {
358
+ nextTick(() => {
359
+ calcMaxDisplay();
360
+ const root = calendarRef.value?.$el as HTMLElement | null;
361
+ const cell = root?.querySelector('.m-calendar') as HTMLElement | null;
362
+ if (cell && typeof ResizeObserver !== 'undefined') {
363
+ resizeObserver = new ResizeObserver(() => calcMaxDisplay());
364
+ resizeObserver.observe(cell);
365
+ // const tasksEl = cell.querySelector('.gantt-calendar-cell-tasks') as HTMLElement | null;
366
+ // if (tasksEl) resizeObserver.observe(tasksEl);
367
+ }
368
+ window.addEventListener('resize', calcMaxDisplay);
369
+ });
370
+ });
371
+
372
+ onBeforeUnmount(() => {
373
+ if (resizeObserver) {
374
+ resizeObserver.disconnect();
375
+ resizeObserver = null;
376
+ }
377
+ window.removeEventListener('resize', calcMaxDisplay);
378
+ });
379
+
380
+ // 将 yyyy-MM-dd 提取日数字展示
381
+ const dayLabel = (day: string) => {
382
+ const d = dayjs(day);
383
+ return d.isValid() ? String(d.date()) : day;
384
+ };
385
+
386
+ // 补齐数组,确保laneIndex从0开始连续
387
+ const fillArrayFromZero = (arr: GanttTask[]): GanttTask[] => {
388
+ if (arr.length === 0) return arr;
389
+
390
+ // 找到最小的laneIndex
391
+ const laneIndexes = arr.map(
392
+ (item: GanttTask) => (item as GanttTask & { laneIndex?: number }).laneIndex ?? 0,
393
+ );
394
+ const minIndex = Math.min(...laneIndexes);
395
+
396
+ // 如果最小laneIndex已经是0,直接返回原数组
397
+ if (minIndex === 0) {
398
+ return arr;
399
+ }
400
+
401
+ // 需要补齐的元素数量
402
+ const fillCount = minIndex;
403
+
404
+ // 创建补齐的占位元素(从0到minIndex-1)
405
+ // 使用null作为占位符,后续在渲染时过滤掉
406
+ const fillItems: any[] = [];
407
+ for (let i = 0; i < fillCount; i++) {
408
+ fillItems.push({
409
+ id: `empty${i}`,
410
+ name: 'empty',
411
+ startTime: '',
412
+ endTime: '',
413
+ type: 'empty',
414
+ taskNodeFlag: null,
415
+ disabled: true,
416
+ laneIndex: i,
417
+ });
418
+ }
419
+
420
+ // 合并补齐的元素和原数组
421
+ return [...fillItems, ...arr] as GanttTask[];
422
+ };
423
+
424
+ // 处理甘特图展示的任务
425
+ const ganttTasks = (day: string): GanttTask[] => {
426
+ if (
427
+ day &&
428
+ Object.prototype.hasOwnProperty.call(normalizedTasks.value, day) &&
429
+ normalizedTasks.value[day]
430
+ ) {
431
+ const curDayTasks = normalizedTasks.value[day] || [];
432
+ const filledTasks = fillArrayFromZero(curDayTasks);
433
+ const taskNum = filledTasks.length;
434
+ if (taskNum > maxDisplay.value) {
435
+ const extraTask: GanttTask = {
436
+ id: `extra-${day}`,
437
+ name: 'extra',
438
+ startTime: '--',
439
+ endTime: '--',
440
+ isExtra: true,
441
+ type: 'extra',
442
+ extraCount: taskNum - maxDisplay.value + 1,
443
+ };
444
+ return [...filledTasks.slice(0, maxDisplay.value - 1), extraTask] as GanttTask[];
445
+ } else {
446
+ return filledTasks as GanttTask[];
447
+ }
448
+ } else {
449
+ return [];
450
+ }
451
+ };
452
+
453
+ // 处理鼠标悬浮展示的任务
454
+ const hoverTasks = (day: string, task: GanttTask): GanttTask[] => {
455
+ if (isExtraTask(task)) {
456
+ if (
457
+ day &&
458
+ Object.prototype.hasOwnProperty.call(normalizedTasks.value, day) &&
459
+ normalizedTasks.value[day]
460
+ ) {
461
+ return normalizedTasks.value[day];
462
+ } else {
463
+ return [];
464
+ }
465
+ } else {
466
+ return [task];
467
+ }
468
+ };
469
+
470
+ // 类型守卫:识别额外占位任务
471
+ const isExtraTask = (task: GanttTask): boolean => task.isExtra === true;
472
+
473
+ // 任务展示文本,额外任务显示 +N
474
+ const taskLabel = (task: GanttTask) => {
475
+ if (isExtraTask(task)) {
476
+ return `+${task.extraCount}`;
477
+ } else {
478
+ if (task.startTime) {
479
+ const d = dayjs(task.startTime);
480
+ if (d.isValid()) {
481
+ return `${d.format('HH:mm:ss')} ${task.name}`;
482
+ }
483
+ }
484
+ return task.name;
485
+ }
486
+ };
487
+
488
+ // 判断是否应该显示任务名称
489
+ // head 和 single 显示,middle 和 end 不显示
490
+ const shouldShowTaskName = (task: GanttTask) => {
491
+ if (isExtraTask(task)) return true; // 额外任务始终显示
492
+ const { taskNodeFlag } = task as GanttTask;
493
+ return taskNodeFlag === 'head' || taskNodeFlag === 'single';
494
+ };
495
+
496
+ // 日期 class
497
+ const dataClass = (type: 'prev-month' | 'next-month' | 'current-month') => {
498
+ const classes = [];
499
+ if (type === 'prev-month') classes.push('is-prev-month');
500
+ if (type === 'next-month') classes.push('is-next-month');
501
+ if (type === 'current-month') classes.push('is-current-month');
502
+ return classes.join(' ');
503
+ };
504
+
505
+ // 任务 class,包含类型与区间位置
506
+ const taskClass = (task: GanttTask) => {
507
+ const { taskNodeFlag } = task as GanttTask;
508
+ const posClass = [];
509
+ if (taskNodeFlag === 'head') {
510
+ posClass.push('is-head');
511
+ } else if (taskNodeFlag === 'middle') {
512
+ posClass.push('is-middle');
513
+ } else if (taskNodeFlag === 'end') {
514
+ posClass.push('is-end');
515
+ } else if (taskNodeFlag === 'single') {
516
+ posClass.push('is-single');
517
+ }
518
+ return posClass.filter(Boolean);
519
+ };
520
+
521
+ // 获取月份的周数据
522
+ // @param month - 月份,可以是 Date、dayjs 对象或字符串(如 '2024-12' 或 '2024-12-01')
523
+ // @param startOfWeek - 每周开始的天数,0=周日,1=周一,2=周二...,默认1(周一)
524
+ // @returns 返回对象,格式如 {week1: ['11-30', '12-01', '12-02', ...], week2: [...]},每周数组长度为7
525
+ const getMonthWeekData = (
526
+ month: string | Date | ReturnType<typeof dayjs>,
527
+ startOfWeek: number = 1,
528
+ ): Record<string, string[]> => {
529
+ const monthStart = dayjs(month).startOf('month');
530
+ const monthEnd = dayjs(month).endOf('month');
531
+
532
+ if (!monthStart.isValid()) {
533
+ return {};
534
+ }
535
+
536
+ const result: Record<string, string[]> = {};
537
+
538
+ // dayjs中0=周日, 1=周一, ..., 6=周六
539
+ const dayjsStartOfWeek = startOfWeek === 0 ? 0 : startOfWeek;
540
+
541
+ // 计算月份第一天的周起始日期(可能是上个月的日期)
542
+ const firstDayOfWeek = monthStart.day();
543
+ let daysToFirstWeekStart = 0;
544
+
545
+ if (firstDayOfWeek >= dayjsStartOfWeek) {
546
+ daysToFirstWeekStart = firstDayOfWeek - dayjsStartOfWeek;
547
+ } else {
548
+ daysToFirstWeekStart = 7 - (dayjsStartOfWeek - firstDayOfWeek);
549
+ }
550
+ const firstWeekStart = monthStart.clone().subtract(daysToFirstWeekStart, 'day');
551
+
552
+ // 计算月份最后一天的周结束日期(可能是下个月的日期)
553
+ const lastDayOfWeek = monthEnd.day();
554
+
555
+ // 计算周结束日(周起始日的前一天)
556
+ // 如果 startOfWeek = 1(周一),周结束日是 0(周日)
557
+ // 如果 startOfWeek = 0(周日),周结束日是 6(周六)
558
+ const weekEndDay = (dayjsStartOfWeek + 6) % 7;
559
+
560
+ let daysToLastWeekEnd = 0;
561
+ if (lastDayOfWeek <= weekEndDay) {
562
+ daysToLastWeekEnd = weekEndDay - lastDayOfWeek;
563
+ } else {
564
+ daysToLastWeekEnd = 7 - (lastDayOfWeek - weekEndDay);
565
+ }
566
+ const lastWeekEnd = monthEnd.clone().add(daysToLastWeekEnd, 'day');
567
+
568
+ // 按周遍历,确保每周都有7天
569
+ let weekStart = firstWeekStart.clone();
570
+ let weekIndex = 1;
571
+
572
+ while (weekStart.isBefore(lastWeekEnd, 'day') || weekStart.isSame(lastWeekEnd, 'day')) {
573
+ const weekKey = `week${weekIndex}`;
574
+ result[weekKey] = [];
575
+
576
+ // 每周添加7天
577
+ for (let i = 0; i < 7; i++) {
578
+ const currentDate = weekStart.clone().add(i, 'day');
579
+ result[weekKey].push(currentDate.format('MM-DD'));
580
+ }
581
+
582
+ // 移动到下一周
583
+ weekStart = weekStart.add(7, 'day');
584
+ weekIndex++;
585
+ }
586
+
587
+ return result;
588
+ };
589
+
590
+ // 将平铺任务数组转为按日期的map,便于直接使用
591
+ const toDateMap = (tasks: GanttTask[]): Record<string, GanttTask[]> => {
592
+ // 使用当前选中的日期或当前日期来获取月份数据
593
+ const currentDate = innerValue.value ? dayjs(innerValue.value) : dayjs();
594
+ const monthWeekData = getMonthWeekData(currentDate.format('YYYY-MM'), props.firstDayOfWeek ?? 0);
595
+ // 按开始时间排序任务
596
+ const sortedTasksByStartTime = [...tasks].sort((a, b) => {
597
+ if (!a.startTime || !b.startTime) return 0;
598
+ const startA = dayjs(a.startTime);
599
+ const startB = dayjs(b.startTime);
600
+ if (!startA.isValid() || !startB.isValid()) return 0;
601
+ return startA.valueOf() - startB.valueOf();
602
+ });
603
+
604
+ // 将任务拆分到周维度,并标注交集
605
+ const weekTaskMap: Record<
606
+ string,
607
+ Array<
608
+ GanttTask & {
609
+ weekStart?: string; // 交集开始时间(包含时分秒)
610
+ weekEnd?: string; // 交集结束时间(包含时分秒)
611
+ weekDuration?: number; // 周期长度(天数)
612
+ weekDailyDates?: string[]; // 每天的日期数组
613
+ }
614
+ >
615
+ > = {};
616
+
617
+ // 获取当前月份信息,用于解析周日期
618
+ const currentMonth = dayjs(currentDate.format('YYYY-MM'));
619
+ const currentYear = currentMonth.year();
620
+
621
+ // 辅助函数:将 'MM-DD' 格式转换为完整的日期
622
+ // 注意:monthWeekData 只存 MM-DD,需要结合当前月份判断是上个月、当月还是下个月
623
+ const parseWeekDate = (dateStr: string): ReturnType<typeof dayjs> => {
624
+ const parts = dateStr.split('-');
625
+ if (parts.length !== 2) {
626
+ return dayjs().startOf('day');
627
+ }
628
+ const month = Number(parts[0]);
629
+ const day = Number(parts[1]);
630
+
631
+ if (isNaN(month) || isNaN(day)) {
632
+ return dayjs().startOf('day');
633
+ }
634
+
635
+ // 当前月索引(0-11)
636
+ const curMonthIndex = currentMonth.month(); // 0-11
637
+ const targetMonthIndex = month - 1; // 0-11
638
+ const diff = (targetMonthIndex - curMonthIndex + 12) % 12;
639
+
640
+ // diff 含义:
641
+ // 0 -> 当月
642
+ // 1 -> 下一个月
643
+ // 11 -> 上一个月
644
+ if (diff === 11) {
645
+ // 上一个月(可能跨年,例如:当前是 1 月,上一月是上一年的 12 月)
646
+ const prevMonth = currentMonth.subtract(1, 'month');
647
+ return dayjs(
648
+ `${prevMonth.year()}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`,
649
+ );
650
+ } else if (diff === 1) {
651
+ // 下一个月(可能跨年,例如:当前是 12 月,下一个月是下一年的 1 月)
652
+ const nextMonth = currentMonth.add(1, 'month');
653
+ return dayjs(
654
+ `${nextMonth.year()}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`,
655
+ );
656
+ } else {
657
+ // 当月
658
+ return dayjs(
659
+ `${currentYear}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`,
660
+ );
661
+ }
662
+ };
663
+
664
+ // 遍历每一周
665
+ Object.keys(monthWeekData).forEach((weekKey) => {
666
+ const weekDays = monthWeekData[weekKey];
667
+ if (!weekDays || weekDays.length === 0) return;
668
+
669
+ // 获取该周的第一天和最后一天
670
+ const firstDayStr = weekDays?.[0];
671
+ const lastDayStr = weekDays?.[weekDays.length - 1];
672
+
673
+ if (!firstDayStr || !lastDayStr) return;
674
+
675
+ const weekStart = parseWeekDate(firstDayStr).startOf('day');
676
+ const weekEnd = parseWeekDate(lastDayStr).endOf('day');
677
+
678
+ if (!weekStart.isValid() || !weekEnd.isValid()) return;
679
+
680
+ // 遍历所有任务,检查是否与该周有交集
681
+ sortedTasksByStartTime.forEach((task) => {
682
+ if (!task.startTime || !task.endTime) return;
683
+
684
+ const taskStart = dayjs(task.startTime).startOf('day');
685
+ const taskEnd = dayjs(task.endTime).endOf('day');
686
+
687
+ if (!taskStart.isValid() || !taskEnd.isValid()) return;
688
+
689
+ // 检查任务周期是否与该周有交集
690
+ // 有交集的条件:taskStart <= weekEnd && taskEnd >= weekStart
691
+ const isBeforeOrSame = taskStart.isBefore(weekEnd, 'day') || taskStart.isSame(weekEnd, 'day');
692
+ const isAfterOrSame = taskEnd.isAfter(weekStart, 'day') || taskEnd.isSame(weekStart, 'day');
693
+ if (isBeforeOrSame && isAfterOrSame) {
694
+ // 计算交集部分(日期级别)
695
+ const intersectionStartDate = taskStart.isAfter(weekStart) ? taskStart : weekStart;
696
+ const intersectionEndDate = taskEnd.isBefore(weekEnd) ? taskEnd : weekEnd;
697
+
698
+ // 获取任务的时分秒信息
699
+ const taskStartDateTime = dayjs(task.startTime);
700
+ const taskEndDateTime = dayjs(task.endTime);
701
+
702
+ // 构建交集的开始时间(使用任务的时分秒,如果交集开始日期是任务开始日期)
703
+ // 否则使用当天的 00:00:00
704
+ let intersectionStartDateTime: ReturnType<typeof dayjs>;
705
+ if (intersectionStartDate.isSame(taskStart, 'day')) {
706
+ // 交集开始日期就是任务开始日期,使用任务的时分秒
707
+ intersectionStartDateTime = taskStartDateTime;
708
+ } else {
709
+ // 交集开始日期是周的开始日期,使用当天的 00:00:00
710
+ intersectionStartDateTime = intersectionStartDate.startOf('day');
711
+ }
712
+
713
+ // 构建交集的结束时间(使用任务的时分秒,如果交集结束日期是任务结束日期)
714
+ // 否则使用当天的 23:59:59
715
+ let intersectionEndDateTime: ReturnType<typeof dayjs>;
716
+ if (intersectionEndDate.isSame(taskEnd, 'day')) {
717
+ // 交集结束日期就是任务结束日期,使用任务的时分秒
718
+ intersectionEndDateTime = taskEndDateTime;
719
+ } else {
720
+ // 交集结束日期是周的结束日期,使用当天的 23:59:59
721
+ intersectionEndDateTime = intersectionEndDate.endOf('day');
722
+ }
723
+
724
+ // 计算周期长度(包含首尾的天数)
725
+ const duration = intersectionEndDate.diff(intersectionStartDate, 'day') + 1;
726
+
727
+ // 生成每天的日期数组
728
+ const dailyDates: string[] = [];
729
+ let iterDate = intersectionStartDate.startOf('day');
730
+ while (
731
+ iterDate.isBefore(intersectionEndDate, 'day') ||
732
+ iterDate.isSame(intersectionEndDate, 'day')
733
+ ) {
734
+ dailyDates.push(iterDate.format('YYYY-MM-DD'));
735
+ iterDate = iterDate.add(1, 'day');
736
+ }
737
+
738
+ // 初始化该周的任务数组
739
+ if (!weekTaskMap[weekKey]) {
740
+ weekTaskMap[weekKey] = [];
741
+ }
742
+
743
+ // 添加任务,并标注交集信息
744
+ weekTaskMap[weekKey].push({
745
+ ...task,
746
+ weekStart: intersectionStartDateTime.format('YYYY-MM-DD HH:mm:ss'),
747
+ weekEnd: intersectionEndDateTime.format('YYYY-MM-DD HH:mm:ss'),
748
+ weekDuration: duration,
749
+ weekDailyDates: dailyDates,
750
+ });
751
+ }
752
+ });
753
+ });
754
+
755
+ // 对每周的数据进行排序:先按 weekStart 排序,如果相同则按 weekDuration 排序
756
+ Object.keys(weekTaskMap).forEach((weekKey) => {
757
+ const weekTasks = weekTaskMap[weekKey];
758
+ if (!weekTasks) return;
759
+ weekTasks.sort((a, b) => {
760
+ // 先按 weekStart 排序
761
+ const weekStartA = (a as GanttTask & { weekStart?: string }).weekStart;
762
+ const weekStartB = (b as GanttTask & { weekStart?: string }).weekStart;
763
+ if (weekStartA && weekStartB) {
764
+ const startA = dayjs(weekStartA);
765
+ const startB = dayjs(weekStartB);
766
+ if (startA.isValid() && startB.isValid()) {
767
+ const diff = startA.valueOf() - startB.valueOf();
768
+ if (diff !== 0) {
769
+ return diff;
770
+ }
771
+ }
772
+ }
773
+
774
+ // 如果 weekStart 相同或不存在,按 weekDuration 排序
775
+ const durationA = (a as GanttTask & { weekDuration?: number }).weekDuration ?? 0;
776
+ const durationB = (b as GanttTask & { weekDuration?: number }).weekDuration ?? 0;
777
+ return durationA - durationB;
778
+ });
779
+ });
780
+
781
+ // 为每周的任务分配车道索引
782
+ Object.keys(weekTaskMap).forEach((weekKey) => {
783
+ const weekTasks = weekTaskMap[weekKey];
784
+ if (!weekTasks) return;
785
+ const laneMap = new Map<string | number, number>();
786
+ // 维护每个车道的最后结束时间
787
+ const laneEndTimes: number[] = [];
788
+
789
+ // 遍历已排序的任务,分配车道
790
+ weekTasks.forEach((task) => {
791
+ const taskWithWeek = task as GanttTask & { weekStart?: string; weekEnd?: string };
792
+ if (!taskWithWeek.weekStart || !taskWithWeek.weekEnd) return;
793
+
794
+ const start = dayjs(taskWithWeek.weekStart);
795
+ const end = dayjs(taskWithWeek.weekEnd);
796
+ if (!start.isValid() || !end.isValid()) return;
797
+
798
+ const startTime = start.valueOf();
799
+ const endTime = end.valueOf();
800
+
801
+ // 找到第一个可用的车道(车道的结束时间 <= 任务开始时间)
802
+ let assignedLane = -1;
803
+ for (let i = 0; i < laneEndTimes.length; i++) {
804
+ const laneEndTime = laneEndTimes[i];
805
+ if (laneEndTime !== undefined && laneEndTime <= startTime) {
806
+ assignedLane = i;
807
+ break;
808
+ }
809
+ }
810
+
811
+ // 如果没有可用车道,创建新车道
812
+ if (assignedLane === -1) {
813
+ assignedLane = laneEndTimes.length;
814
+ laneEndTimes.push(endTime);
815
+ } else {
816
+ // 更新车道的结束时间
817
+ laneEndTimes[assignedLane] = endTime;
818
+ }
819
+
820
+ laneMap.set(task.id, assignedLane);
821
+ });
822
+
823
+ // 将车道索引添加到任务中
824
+ weekTasks.forEach((task) => {
825
+ const laneIndex = laneMap.get(task.id);
826
+ if (laneIndex !== undefined) {
827
+ task.laneIndex = laneIndex;
828
+ }
829
+ });
830
+ });
831
+
832
+ // 为跨周任务打上「第几周」的片段标记(weekSegmentIndex)
833
+ const weekKeysSorted = Object.keys(weekTaskMap).sort((a, b) => {
834
+ const numA = Number(a.replace('week', '')) || 0;
835
+ const numB = Number(b.replace('week', '')) || 0;
836
+ return numA - numB;
837
+ });
838
+ const segmentIndexMap = new Map<string | number, number>();
839
+ weekKeysSorted.forEach((weekKey) => {
840
+ const weekTasks = weekTaskMap[weekKey];
841
+ if (!weekTasks) return;
842
+ weekTasks.forEach((task) => {
843
+ const prev = segmentIndexMap.get(task.id) ?? 0;
844
+ const next = prev + 1;
845
+ segmentIndexMap.set(task.id, next);
846
+ (task as GanttTask & { weekSegmentIndex?: number }).weekSegmentIndex = next;
847
+ });
848
+ });
849
+
850
+ const dayTaskMap: Record<string, GanttTask[]> = {};
851
+
852
+ // 将 weekTaskMap 拆分成按天为维度的数据
853
+ Object.keys(weekTaskMap).forEach((weekKey) => {
854
+ const weekTasks = weekTaskMap[weekKey];
855
+ if (!weekTasks) return;
856
+
857
+ weekTasks.forEach((task) => {
858
+ // 如果没有 weekDailyDates,跳过
859
+ if (!task.weekDailyDates || task.weekDailyDates.length === 0) return;
860
+
861
+ const dailyDates = task.weekDailyDates;
862
+ const duration = task.weekDuration ?? 1;
863
+
864
+ // 遍历该任务的每一天
865
+ dailyDates.forEach((dateStr, index) => {
866
+ // 判断任务在该天的位置标识
867
+ let taskNodeFlag: TaskNodeFlag;
868
+ if (duration === 1) {
869
+ // 单天任务
870
+ taskNodeFlag = 'single';
871
+ } else if (index === 0) {
872
+ // 第一天:开始
873
+ taskNodeFlag = 'head';
874
+ } else if (index === dailyDates.length - 1) {
875
+ // 最后一天:结束
876
+ taskNodeFlag = 'end';
877
+ } else {
878
+ // 中间天
879
+ taskNodeFlag = 'middle';
880
+ }
881
+
882
+ // 将日期格式转换为 YYYY-MM-DD
883
+ // weekDailyDates 中已经是 YYYY-MM-DD 格式,直接使用
884
+ const fullDateStr = dateStr;
885
+
886
+ // 初始化该日期的任务数组
887
+ if (!dayTaskMap[fullDateStr]) {
888
+ dayTaskMap[fullDateStr] = [];
889
+ }
890
+
891
+ // 判断任务是否已结束(比较任务结束日期和当前日期)
892
+ const taskEndDate = dayjs(task.endTime).startOf('day');
893
+ const today = dayjs().startOf('day');
894
+ const isEnded = taskEndDate.isValid() && today.isValid() && taskEndDate.isBefore(today);
895
+
896
+ // 添加任务到该日期,包含位置标识、车道索引、结束状态以及跨周标记
897
+ dayTaskMap[fullDateStr].push({
898
+ ...task,
899
+ taskNodeFlag,
900
+ laneIndex: task.laneIndex ?? 0,
901
+ isEnded,
902
+ weekSegmentIndex: (task as GanttTask & { weekSegmentIndex?: number }).weekSegmentIndex,
903
+ });
904
+ });
905
+ });
906
+ });
907
+
908
+ // 对每个日期的任务按车道索引排序,确保跨天对齐
909
+ Object.keys(dayTaskMap).forEach((day) => {
910
+ const dayTasks = dayTaskMap[day];
911
+ if (!dayTasks) return;
912
+ dayTasks.sort((a, b) => {
913
+ const laneA = a.laneIndex ?? 0;
914
+ const laneB = b.laneIndex ?? 0;
915
+ if (laneA !== laneB) {
916
+ return laneA - laneB;
917
+ }
918
+ // 同一车道内,按周期长短排序(周期长的优先)
919
+ const durationA = a.weekDuration ?? 0;
920
+ const durationB = b.weekDuration ?? 0;
921
+ if (durationB !== durationA) {
922
+ return durationB - durationA;
923
+ }
924
+ // 周期相同时按开始时间排序
925
+ const weekStartA = (a as GanttTask & { weekStart?: string }).weekStart;
926
+ const weekStartB = (b as GanttTask & { weekStart?: string }).weekStart;
927
+ if (weekStartA && weekStartB) {
928
+ const startA = dayjs(weekStartA);
929
+ const startB = dayjs(weekStartB);
930
+ if (startA.isValid() && startB.isValid()) {
931
+ return startA.valueOf() - startB.valueOf();
932
+ }
933
+ }
934
+ return 0;
935
+ });
936
+ });
937
+ return dayTaskMap;
938
+ };
939
+
940
+ watch(
941
+ () => props.tasks,
942
+ (tasks) => {
943
+ if (tasks && Array.isArray(tasks)) {
944
+ // 将传入的 tasks 转换为按日期分组的甘特任务映射
945
+ normalizedTasks.value = toDateMap(tasks as GanttTask[]);
946
+ } else {
947
+ normalizedTasks.value = {};
948
+ }
949
+ },
950
+ { immediate: true, deep: true },
951
+ );
952
+
953
+ watch(
954
+ () => props.firstDayOfWeek,
955
+ (firstDayOfWeek) => {
956
+ if (firstDayOfWeek !== undefined) {
957
+ (dayjs as any).en.weekStart = firstDayOfWeek;
958
+ }
959
+ },
960
+ { immediate: true, deep: true },
961
+ );
962
+ </script>