@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.
- package/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- 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
- 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
- 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
- package/.specstory/history/2026-01-08_03-51Z-pnpm-lines-88-95.md +304 -0
- package/README.en.md +36 -0
- package/README.md +37 -0
- package/SETUP_GUIDE.md +2530 -0
- package/docs/.vitepress/config.ts +298 -0
- package/docs/.vitepress/theme/index.ts +30 -0
- package/docs/.vitepress/theme/style.css +150 -0
- package/docs/CHANGELOG.md +7 -0
- package/docs/DEPLOY.md +183 -0
- package/docs/api-examples.md +49 -0
- package/docs/components/Changelog.vue +176 -0
- package/docs/components/ComponentOverview.vue +613 -0
- package/docs/components/ComponentSearch.vue +39 -0
- package/docs/components/basic/action-menu.md +63 -0
- package/docs/components/basic/arrow-steps.md +55 -0
- package/docs/components/basic/badge.md +22 -0
- package/docs/components/basic/batch-copy.md +44 -0
- package/docs/components/basic/batch-editor.md +52 -0
- package/docs/components/basic/border.md +22 -0
- package/docs/components/basic/breadcrumb.md +38 -0
- package/docs/components/basic/button.md +109 -0
- package/docs/components/basic/calendar.md +111 -0
- package/docs/components/basic/card.md +59 -0
- package/docs/components/basic/carousel.md +22 -0
- package/docs/components/basic/cascader.md +162 -0
- package/docs/components/basic/checkbox.md +171 -0
- package/docs/components/basic/collapse.md +22 -0
- package/docs/components/basic/column-table.md +123 -0
- package/docs/components/basic/date-picker.md +92 -0
- package/docs/components/basic/date-time-picker.md +110 -0
- package/docs/components/basic/demo.md +29 -0
- package/docs/components/basic/description.md +56 -0
- package/docs/components/basic/dialog.md +142 -0
- package/docs/components/basic/drawer.md +159 -0
- package/docs/components/basic/editor.md +76 -0
- package/docs/components/basic/empty.md +59 -0
- package/docs/components/basic/file-task-dialog.md +41 -0
- package/docs/components/basic/form.md +112 -0
- package/docs/components/basic/icon.md +53 -0
- package/docs/components/basic/image.md +110 -0
- package/docs/components/basic/import-dialog.md +54 -0
- package/docs/components/basic/independent-nav.md +45 -0
- package/docs/components/basic/input-number.md +61 -0
- package/docs/components/basic/input.md +98 -0
- package/docs/components/basic/layout.md +141 -0
- package/docs/components/basic/link.md +65 -0
- package/docs/components/basic/mention.md +22 -0
- package/docs/components/basic/message.md +167 -0
- package/docs/components/basic/nav.md +29 -0
- package/docs/components/basic/pagination.md +93 -0
- package/docs/components/basic/popover.md +116 -0
- package/docs/components/basic/progress.md +22 -0
- package/docs/components/basic/radio.md +152 -0
- package/docs/components/basic/result.md +22 -0
- package/docs/components/basic/scrollbar.md +105 -0
- package/docs/components/basic/search-panel.md +53 -0
- package/docs/components/basic/select.md +256 -0
- package/docs/components/basic/slider.md +22 -0
- package/docs/components/basic/space.md +140 -0
- package/docs/components/basic/steps.md +60 -0
- package/docs/components/basic/switch.md +115 -0
- package/docs/components/basic/table-grid.md +116 -0
- package/docs/components/basic/table-head-editor.md +135 -0
- package/docs/components/basic/table.md +433 -0
- package/docs/components/basic/tabs.md +62 -0
- package/docs/components/basic/tag.md +75 -0
- package/docs/components/basic/text.md +22 -0
- package/docs/components/basic/time-picker.md +77 -0
- package/docs/components/basic/time-select.md +65 -0
- package/docs/components/basic/tooltip.md +112 -0
- package/docs/components/basic/tour.md +22 -0
- package/docs/components/basic/tree-select.md +132 -0
- package/docs/components/basic/tree.md +163 -0
- package/docs/components/button.md +113 -0
- package/docs/components/calendar.md +111 -0
- package/docs/components/design/color.md +137 -0
- package/docs/components/index.md +3 -0
- package/docs/components/link.md +65 -0
- package/docs/components/search-panel.md +53 -0
- package/docs/components/table-grid.md +120 -0
- package/docs/components/table.md +433 -0
- package/docs/examples/action-menu/basic.vue +70 -0
- package/docs/examples/action-menu/default.vue +88 -0
- package/docs/examples/action-menu/index.vue +76 -0
- package/docs/examples/arrow-steps/index.vue +15 -0
- package/docs/examples/badge/index.vue +3 -0
- package/docs/examples/batch-copy/index.vue +30 -0
- package/docs/examples/batch-copy/validator.vue +73 -0
- package/docs/examples/batch-editor/basic.vue +120 -0
- package/docs/examples/batch-editor/customization.vue +167 -0
- package/docs/examples/border/index.vue +3 -0
- package/docs/examples/breadcrumb/index.vue +33 -0
- package/docs/examples/button/demo1.vue +119 -0
- package/docs/examples/button/demo2.vue +18 -0
- package/docs/examples/button/demo3.vue +32 -0
- package/docs/examples/button/demo4.vue +41 -0
- package/docs/examples/button/demo5.vue +46 -0
- package/docs/examples/button/demo6.vue +35 -0
- package/docs/examples/calendar/calendar01.vue +46 -0
- package/docs/examples/calendar/calendar02.vue +16 -0
- package/docs/examples/calendar/calendar03.vue +6 -0
- package/docs/examples/calendar/calendar04.vue +54 -0
- package/docs/examples/calendar/calendar05.vue +36 -0
- package/docs/examples/calendar/calendar06.vue +53 -0
- package/docs/examples/card/basic-card.vue +7 -0
- package/docs/examples/card/card-title.vue +6 -0
- package/docs/examples/card/collapsible-card.vue +26 -0
- package/docs/examples/card/title-card.vue +32 -0
- package/docs/examples/carousel/index.vue +3 -0
- package/docs/examples/cascader/clearable.vue +52 -0
- package/docs/examples/cascader/collapse-tags.vue +84 -0
- package/docs/examples/cascader/disabled-select.vue +52 -0
- package/docs/examples/cascader/disabled.vue +54 -0
- package/docs/examples/cascader/filterable.vue +82 -0
- package/docs/examples/cascader/index.vue +173 -0
- package/docs/examples/cascader/multiple.vue +74 -0
- package/docs/examples/cascader/show-all-levels.vue +63 -0
- package/docs/examples/cascader/sizes.vue +71 -0
- package/docs/examples/checkbox/basic.vue +47 -0
- package/docs/examples/checkbox/button-style.vue +73 -0
- package/docs/examples/checkbox/disabled.vue +20 -0
- package/docs/examples/checkbox/grouping.vue +32 -0
- package/docs/examples/checkbox/intermediate.vue +43 -0
- package/docs/examples/checkbox/limitation.vue +23 -0
- package/docs/examples/checkbox/with-border.vue +74 -0
- package/docs/examples/collapse/index.vue +3 -0
- package/docs/examples/column-table/basic.vue +47 -0
- package/docs/examples/column-table/column-title.vue +48 -0
- package/docs/examples/column-table/custom.vue +125 -0
- package/docs/examples/column-table/index.vue +209 -0
- package/docs/examples/column-table/nested.vue +123 -0
- package/docs/examples/column-table/no-header.vue +50 -0
- package/docs/examples/date-picker/default.vue +106 -0
- package/docs/examples/date-picker/index.vue +98 -0
- package/docs/examples/date-picker/otherUnits.vue +118 -0
- package/docs/examples/date-picker/periodTime.vue +108 -0
- package/docs/examples/date-time-picker/default.vue +83 -0
- package/docs/examples/date-time-picker/format.vue +90 -0
- package/docs/examples/date-time-picker/index.vue +110 -0
- package/docs/examples/date-time-picker/range.vue +111 -0
- package/docs/examples/date-time-picker/time-format.vue +78 -0
- package/docs/examples/demo/demo1.vue +3 -0
- package/docs/examples/demo/demo2.vue +3 -0
- package/docs/examples/description/custom-description.vue +30 -0
- package/docs/examples/description/index.vue +13 -0
- package/docs/examples/description/labelJustify.vue +58 -0
- package/docs/examples/description/merge-description.vue +15 -0
- package/docs/examples/design/color-palette.vue +225 -0
- package/docs/examples/dialog/align-center.vue +34 -0
- package/docs/examples/dialog/basic.vue +31 -0
- package/docs/examples/dialog/centered-content.vue +34 -0
- package/docs/examples/dialog/customization-content.vue +129 -0
- package/docs/examples/dialog/customization-header.vue +60 -0
- package/docs/examples/dialog/msg-dialog.vue +63 -0
- package/docs/examples/dialog/nested-dialog.vue +43 -0
- package/docs/examples/dialog/title-icon.vue +32 -0
- package/docs/examples/drawer/custom-content.vue +182 -0
- package/docs/examples/drawer/custom-header.vue +30 -0
- package/docs/examples/drawer/index.vue +101 -0
- package/docs/examples/drawer/modal.vue +40 -0
- package/docs/examples/drawer/nested.vue +44 -0
- package/docs/examples/drawer/no-title.vue +22 -0
- package/docs/examples/drawer/resizable.vue +28 -0
- package/docs/examples/editor/basic.vue +53 -0
- package/docs/examples/editor/customization-desc.vue +56 -0
- package/docs/examples/editor/more-demo.vue +54 -0
- package/docs/examples/editor/more-form.vue +56 -0
- package/docs/examples/editor/number-desc.vue +55 -0
- package/docs/examples/empty/basic.vue +4 -0
- package/docs/examples/empty/bottom-content.vue +5 -0
- package/docs/examples/empty/custom-image.vue +6 -0
- package/docs/examples/empty/image-size.vue +6 -0
- package/docs/examples/file-task-dialog/index.vue +52 -0
- package/docs/examples/form/accessibility.vue +48 -0
- package/docs/examples/form/alignment.vue +68 -0
- package/docs/examples/form/basic-form.vue +120 -0
- package/docs/examples/form/custom-validation.vue +121 -0
- package/docs/examples/form/form-items.vue +111 -0
- package/docs/examples/form/inline-form.vue +70 -0
- package/docs/examples/form/number-validate.vue +60 -0
- package/docs/examples/form/size-control.vue +140 -0
- package/docs/examples/form/validation.vue +265 -0
- package/docs/examples/icon/icon.vue +52 -0
- package/docs/examples/icon/index.vue +7 -0
- package/docs/examples/image/error.vue +69 -0
- package/docs/examples/image/index.vue +47 -0
- package/docs/examples/image/lazy.vue +39 -0
- package/docs/examples/image/placeholder.vue +69 -0
- package/docs/examples/image/preview.vue +37 -0
- package/docs/examples/import-dialog/multiple.vue +35 -0
- package/docs/examples/import-dialog/single.vue +37 -0
- package/docs/examples/independent-nav/icon-slot.vue +7 -0
- package/docs/examples/independent-nav/index.vue +12 -0
- package/docs/examples/input/icon.vue +26 -0
- package/docs/examples/input/index.vue +9 -0
- package/docs/examples/input-number/index.vue +19 -0
- package/docs/examples/layout/gutter.vue +51 -0
- package/docs/examples/layout/index.vue +97 -0
- package/docs/examples/layout/justify.vue +122 -0
- package/docs/examples/layout/mixed.vue +70 -0
- package/docs/examples/layout/offset.vue +70 -0
- package/docs/examples/layout/responsive.vue +69 -0
- package/docs/examples/link/index01.vue +20 -0
- package/docs/examples/link/index02.vue +41 -0
- package/docs/examples/link/index03.vue +43 -0
- package/docs/examples/link/index04.vue +131 -0
- package/docs/examples/mention/index.vue +3 -0
- package/docs/examples/message/closeable.vue +92 -0
- package/docs/examples/message/grouping.vue +22 -0
- package/docs/examples/message/html.vue +21 -0
- package/docs/examples/message/index.vue +34 -0
- package/docs/examples/message/placement.vue +96 -0
- package/docs/examples/message/plain.vue +80 -0
- package/docs/examples/message/types.vue +66 -0
- package/docs/examples/nav/index.vue +20 -0
- package/docs/examples/pagination/background-color.vue +17 -0
- package/docs/examples/pagination/basic.vue +43 -0
- package/docs/examples/pagination/disabled.vue +17 -0
- package/docs/examples/pagination/more.vue +43 -0
- package/docs/examples/pagination/number-of-pagers.vue +17 -0
- package/docs/examples/pagination/small.vue +17 -0
- package/docs/examples/popover/basic.vue +81 -0
- package/docs/examples/popover/index.vue +144 -0
- package/docs/examples/popover/nested.vue +36 -0
- package/docs/examples/popover/rich-content.vue +100 -0
- package/docs/examples/popover/virtual-trigger.vue +32 -0
- package/docs/examples/progress/index.vue +3 -0
- package/docs/examples/radio/basic-usage.vue +44 -0
- package/docs/examples/radio/button-fill-textcolor.vue +82 -0
- package/docs/examples/radio/button-style.vue +77 -0
- package/docs/examples/radio/disabled.vue +21 -0
- package/docs/examples/radio/radio-button-group.vue +13 -0
- package/docs/examples/radio/with-borders.vue +77 -0
- package/docs/examples/result/index.vue +3 -0
- package/docs/examples/scrollbar/horizontal.vue +39 -0
- package/docs/examples/scrollbar/index.vue +31 -0
- package/docs/examples/scrollbar/infinite.vue +43 -0
- package/docs/examples/scrollbar/manual.vue +68 -0
- package/docs/examples/scrollbar/max-height.vue +44 -0
- package/docs/examples/search-panel/index.vue +108 -0
- package/docs/examples/search-panel/nowrap.vue +115 -0
- package/docs/examples/select/allow-create.vue +36 -0
- package/docs/examples/select/clearable.vue +29 -0
- package/docs/examples/select/collapse-tags.vue +54 -0
- package/docs/examples/select/custom-template.vue +40 -0
- package/docs/examples/select/disabled-option.vue +29 -0
- package/docs/examples/select/disabled-select.vue +29 -0
- package/docs/examples/select/empty.vue +21 -0
- package/docs/examples/select/filterable.vue +37 -0
- package/docs/examples/select/grouping.vue +40 -0
- package/docs/examples/select/header-footer.vue +38 -0
- package/docs/examples/select/index.vue +28 -0
- package/docs/examples/select/loading.vue +41 -0
- package/docs/examples/select/multiple-limit.vue +36 -0
- package/docs/examples/select/multiple.vue +37 -0
- package/docs/examples/select/remote-search.vue +56 -0
- package/docs/examples/select/sizes.vue +62 -0
- package/docs/examples/select/value-key.vue +33 -0
- package/docs/examples/slider/index.vue +3 -0
- package/docs/examples/space/alignment.vue +47 -0
- package/docs/examples/space/custom-size.vue +58 -0
- package/docs/examples/space/fill-ratio.vue +77 -0
- package/docs/examples/space/fill.vue +57 -0
- package/docs/examples/space/index.vue +52 -0
- package/docs/examples/space/size.vue +70 -0
- package/docs/examples/space/spacer.vue +35 -0
- package/docs/examples/space/vertical.vue +52 -0
- package/docs/examples/space/wrap.vue +16 -0
- package/docs/examples/steps/index.vue +50 -0
- package/docs/examples/steps/navigation.vue +37 -0
- package/docs/examples/switch/disabled.vue +19 -0
- package/docs/examples/switch/icon.vue +21 -0
- package/docs/examples/switch/index.vue +17 -0
- package/docs/examples/switch/loading.vue +19 -0
- package/docs/examples/switch/size.vue +29 -0
- package/docs/examples/switch/text.vue +37 -0
- package/docs/examples/switch/validate-value.vue +16 -0
- package/docs/examples/table/basic.vue +60 -0
- package/docs/examples/table/check-strictly.vue +98 -0
- package/docs/examples/table/custom-column.vue +98 -0
- package/docs/examples/table/custom-header.vue +87 -0
- package/docs/examples/table/custom-index.vue +71 -0
- package/docs/examples/table/expandable-row.vue +285 -0
- package/docs/examples/table/filter.vue +116 -0
- package/docs/examples/table/fixed-column-and-group-header.vue +101 -0
- package/docs/examples/table/fixed-column-and-header.vue +101 -0
- package/docs/examples/table/fixed-column.vue +107 -0
- package/docs/examples/table/fixed-header-with-fluid-header.vue +114 -0
- package/docs/examples/table/fixed-header.vue +64 -0
- package/docs/examples/table/grouping-header.vue +103 -0
- package/docs/examples/table/multi-select.vue +116 -0
- package/docs/examples/table/rowspan-and-colspan.vue +147 -0
- package/docs/examples/table/show-overflow-tooltip.vue +64 -0
- package/docs/examples/table/single-select.vue +78 -0
- package/docs/examples/table/sort.vue +63 -0
- package/docs/examples/table/striped.vue +49 -0
- package/docs/examples/table/summary.vue +150 -0
- package/docs/examples/table/table-layout.vue +56 -0
- package/docs/examples/table/tooltip-formatter.vue +93 -0
- package/docs/examples/table/tree-and-lazy.vue +149 -0
- package/docs/examples/table/with-border.vue +49 -0
- package/docs/examples/table/with-status.vue +73 -0
- package/docs/examples/table-grid/basic.vue +51 -0
- package/docs/examples/table-grid/complete.vue +258 -0
- package/docs/examples/table-head-editor/grouping-header.vue +409 -0
- package/docs/examples/table-head-editor/index.vue +246 -0
- package/docs/examples/tabs/default.vue +47 -0
- package/docs/examples/tabs/index.vue +46 -0
- package/docs/examples/tag/basic.vue +20 -0
- package/docs/examples/tag/closable.vue +31 -0
- package/docs/examples/tag/dot.vue +21 -0
- package/docs/examples/tag/effect.vue +35 -0
- package/docs/examples/tag/icon.vue +21 -0
- package/docs/examples/text/index.vue +3 -0
- package/docs/examples/time-picker/disabled.vue +53 -0
- package/docs/examples/time-picker/index.vue +49 -0
- package/docs/examples/time-picker/range.vue +36 -0
- package/docs/examples/time-select/disabled.vue +30 -0
- package/docs/examples/time-select/index.vue +29 -0
- package/docs/examples/tooltip/disabled.vue +20 -0
- package/docs/examples/tooltip/index.vue +63 -0
- package/docs/examples/tooltip/more-content.vue +19 -0
- package/docs/examples/tooltip/theme.vue +32 -0
- package/docs/examples/tooltip/virtual-trigger.vue +31 -0
- package/docs/examples/tour/index.vue +3 -0
- package/docs/examples/tree/basic.vue +86 -0
- package/docs/examples/tree/checkable.vue +65 -0
- package/docs/examples/tree/custom-node.vue +123 -0
- package/docs/examples/tree/default-expanded.vue +73 -0
- package/docs/examples/tree/draggable.vue +123 -0
- package/docs/examples/tree/filter.vue +96 -0
- package/docs/examples/tree/index.vue +86 -0
- package/docs/examples/tree-select/basic.vue +96 -0
- package/docs/examples/tree-select/check-strictly.vue +109 -0
- package/docs/examples/tree-select/custom-content.vue +110 -0
- package/docs/examples/tree-select/disabled.vue +89 -0
- package/docs/examples/tree-select/filterable.vue +112 -0
- package/docs/examples/tree-select/index.vue +87 -0
- package/docs/examples/tree-select/lazy.vue +43 -0
- package/docs/examples/tree-select/multiple.vue +111 -0
- package/docs/examples/tree-select/node-key.vue +35 -0
- package/docs/guide/changelog.md +6 -0
- package/docs/guide/import-on-demand.md +49 -0
- package/docs/guide/index.md +55 -0
- package/docs/guide/introduction.md +21 -0
- package/docs/guide/quickstart.md +35 -0
- package/docs/guide/start.md +113 -0
- package/docs/index.md +27 -0
- package/docs/markdown-examples.md +85 -0
- package/docs/package.json +26 -0
- package/docs/postcss.config.mjs +9 -0
- package/docs/toolkit/domain.md +55 -0
- package/docs/toolkit/env.md +73 -0
- package/docs/toolkit/examples/domain-aim.vue +35 -0
- package/docs/toolkit/examples/domain-supplier.vue +34 -0
- package/docs/toolkit/examples/env-basic.vue +28 -0
- package/docs/toolkit/examples/env-constants.vue +39 -0
- package/docs/toolkit/examples/env-node-constants.vue +38 -0
- package/docs/toolkit/examples/env-node.vue +34 -0
- package/docs/toolkit/examples/monitor-init.vue +53 -0
- package/docs/toolkit/examples/monitor-vue-error.vue +31 -0
- package/docs/toolkit/examples/request-baseurl.vue +66 -0
- package/docs/toolkit/examples/request-basic.vue +48 -0
- package/docs/toolkit/examples/request-cache.vue +137 -0
- package/docs/toolkit/examples/wujie-logout.vue +42 -0
- package/docs/toolkit/examples/wujie-token.vue +63 -0
- package/docs/toolkit/monitor.md +69 -0
- package/docs/toolkit/request.md +127 -0
- package/docs/toolkit/start.md +110 -0
- package/docs/toolkit/wujie.md +34 -0
- package/docs/tsconfig.json +29 -0
- package/package.json +47 -0
- package/packages/components/CHANGELOG.md +81 -0
- package/packages/components/README.md +83 -0
- package/packages/components/package.json +36 -0
- package/packages/components/src/action-menu/index.ts +5 -0
- package/packages/components/src/action-menu/src/action-menu.ts +34 -0
- package/packages/components/src/action-menu/src/action-menu.vue +364 -0
- package/packages/components/src/arrow-steps/index.ts +11 -0
- package/packages/components/src/arrow-steps/src/arrow-step.ts +8 -0
- package/packages/components/src/arrow-steps/src/arrow-step.vue +90 -0
- package/packages/components/src/arrow-steps/src/arrow-steps.ts +16 -0
- package/packages/components/src/arrow-steps/src/arrow-steps.vue +42 -0
- package/packages/components/src/badge/index.ts +5 -0
- package/packages/components/src/badge/src/badge.ts +8 -0
- package/packages/components/src/badge/src/badge.vue +20 -0
- package/packages/components/src/batch-copy/index.ts +5 -0
- package/packages/components/src/batch-copy/src/batch-copy.ts +39 -0
- package/packages/components/src/batch-copy/src/batch-copy.vue +214 -0
- package/packages/components/src/batch-editor/index.ts +5 -0
- package/packages/components/src/batch-editor/src/batch-editor.ts +21 -0
- package/packages/components/src/batch-editor/src/batch-editor.vue +73 -0
- package/packages/components/src/border/index.ts +5 -0
- package/packages/components/src/border/src/border.ts +8 -0
- package/packages/components/src/border/src/border.vue +20 -0
- package/packages/components/src/breadcrumb/index.ts +8 -0
- package/packages/components/src/breadcrumb/src/breadcrumb-item.ts +8 -0
- package/packages/components/src/breadcrumb/src/breadcrumb-item.vue +20 -0
- package/packages/components/src/breadcrumb/src/breadcrumb.ts +8 -0
- package/packages/components/src/breadcrumb/src/breadcrumb.vue +20 -0
- package/packages/components/src/button/index.ts +5 -0
- package/packages/components/src/button/src/button.ts +12 -0
- package/packages/components/src/button/src/button.vue +132 -0
- package/packages/components/src/calendar/index.ts +5 -0
- package/packages/components/src/calendar/src/calendar.ts +36 -0
- package/packages/components/src/calendar/src/calendar.vue +962 -0
- package/packages/components/src/card/index.ts +8 -0
- package/packages/components/src/card/src/card.ts +29 -0
- package/packages/components/src/card/src/card.vue +106 -0
- package/packages/components/src/card/src/title.ts +8 -0
- package/packages/components/src/card/src/title.vue +14 -0
- package/packages/components/src/carousel/index.ts +5 -0
- package/packages/components/src/carousel/src/carousel.ts +8 -0
- package/packages/components/src/carousel/src/carousel.vue +20 -0
- package/packages/components/src/cascader/index.ts +5 -0
- package/packages/components/src/cascader/src/cascader.ts +3 -0
- package/packages/components/src/cascader/src/cascader.vue +62 -0
- package/packages/components/src/checkbox/index.ts +11 -0
- package/packages/components/src/checkbox/src/checkbox.vue +19 -0
- package/packages/components/src/collapse/index.ts +5 -0
- package/packages/components/src/collapse/src/collapse.ts +8 -0
- package/packages/components/src/collapse/src/collapse.vue +20 -0
- package/packages/components/src/column-table/index.ts +7 -0
- package/packages/components/src/column-table/src/column-table-row.ts +30 -0
- package/packages/components/src/column-table/src/column-table-row.vue +17 -0
- package/packages/components/src/column-table/src/column-table.ts +60 -0
- package/packages/components/src/column-table/src/column-table.vue +141 -0
- package/packages/components/src/column-table/src/tokens.ts +6 -0
- package/packages/components/src/date-picker/index.ts +5 -0
- package/packages/components/src/date-picker/src/date-picker.ts +3 -0
- package/packages/components/src/date-picker/src/date-picker.vue +14 -0
- package/packages/components/src/demo/index.ts +5 -0
- package/packages/components/src/demo/src/demo.ts +8 -0
- package/packages/components/src/demo/src/demo.vue +20 -0
- package/packages/components/src/description/index.ts +8 -0
- package/packages/components/src/description/src/description-item.ts +12 -0
- package/packages/components/src/description/src/description-item.vue +103 -0
- package/packages/components/src/description/src/description.ts +20 -0
- package/packages/components/src/description/src/description.vue +28 -0
- package/packages/components/src/dialog/index.ts +6 -0
- package/packages/components/src/dialog/src/dialog.ts +62 -0
- package/packages/components/src/dialog/src/dialog.vue +121 -0
- package/packages/components/src/dialog/src/msg-dialog.ts +84 -0
- package/packages/components/src/dialog/src/types.ts +8 -0
- package/packages/components/src/drawer/index.ts +5 -0
- package/packages/components/src/drawer/src/drawer.ts +8 -0
- package/packages/components/src/drawer/src/drawer.vue +24 -0
- package/packages/components/src/editor/index.ts +5 -0
- package/packages/components/src/editor/src/editor.ts +13 -0
- package/packages/components/src/editor/src/editor.vue +70 -0
- package/packages/components/src/empty/index.ts +5 -0
- package/packages/components/src/empty/src/empty.ts +3 -0
- package/packages/components/src/empty/src/empty.vue +37 -0
- package/packages/components/src/empty/src/img-empty.vue +39 -0
- package/packages/components/src/file-task-dialog/index.ts +5 -0
- package/packages/components/src/file-task-dialog/src/file-task-dialog.ts +32 -0
- package/packages/components/src/file-task-dialog/src/file-task-dialog.vue +228 -0
- package/packages/components/src/form/index.ts +3 -0
- package/packages/components/src/icon/index.ts +5 -0
- package/packages/components/src/icon/src/icon.ts +10 -0
- package/packages/components/src/icon/src/icon.vue +29 -0
- package/packages/components/src/image/index.ts +5 -0
- package/packages/components/src/image/src/image.ts +8 -0
- package/packages/components/src/image/src/image.vue +57 -0
- package/packages/components/src/import-dialog/index.ts +5 -0
- package/packages/components/src/import-dialog/src/import-dialog.ts +11 -0
- package/packages/components/src/import-dialog/src/import-dialog.vue +207 -0
- package/packages/components/src/independent-nav/index.ts +5 -0
- package/packages/components/src/independent-nav/src/independent-nav.ts +7 -0
- package/packages/components/src/independent-nav/src/independent-nav.vue +61 -0
- package/packages/components/src/index.ts +235 -0
- package/packages/components/src/input/index.ts +5 -0
- package/packages/components/src/input/src/input.ts +3 -0
- package/packages/components/src/input/src/input.vue +53 -0
- package/packages/components/src/input-number/index.ts +5 -0
- package/packages/components/src/input-number/src/input-number.ts +3 -0
- package/packages/components/src/input-number/src/input-number.vue +25 -0
- package/packages/components/src/layout/index.ts +7 -0
- package/packages/components/src/layout/src/col.vue +43 -0
- package/packages/components/src/layout/src/layout.ts +13 -0
- package/packages/components/src/layout/src/row.vue +43 -0
- package/packages/components/src/link/index.ts +5 -0
- package/packages/components/src/link/src/link.ts +13 -0
- package/packages/components/src/link/src/link.vue +74 -0
- package/packages/components/src/mention/index.ts +5 -0
- package/packages/components/src/mention/src/mention.ts +8 -0
- package/packages/components/src/mention/src/mention.vue +20 -0
- package/packages/components/src/message/index.ts +1 -0
- package/packages/components/src/message/src/message.ts +161 -0
- package/packages/components/src/nav/index.ts +7 -0
- package/packages/components/src/nav/src/nav.ts +19 -0
- package/packages/components/src/nav/src/nav.vue +66 -0
- package/packages/components/src/nav/src/types.ts +11 -0
- package/packages/components/src/pagination/index.ts +5 -0
- package/packages/components/src/pagination/src/pagination.ts +60 -0
- package/packages/components/src/pagination/src/pagination.vue +38 -0
- package/packages/components/src/popover/index.ts +5 -0
- package/packages/components/src/popover/src/popover.ts +14 -0
- package/packages/components/src/popover/src/popover.vue +60 -0
- package/packages/components/src/progress/index.ts +5 -0
- package/packages/components/src/progress/src/progress.ts +8 -0
- package/packages/components/src/progress/src/progress.vue +20 -0
- package/packages/components/src/radio/index.ts +11 -0
- package/packages/components/src/radio/src/radio.vue +13 -0
- package/packages/components/src/result/index.ts +5 -0
- package/packages/components/src/result/src/result.ts +8 -0
- package/packages/components/src/result/src/result.vue +20 -0
- package/packages/components/src/scrollbar/index.ts +5 -0
- package/packages/components/src/scrollbar/src/scrollbar.ts +8 -0
- package/packages/components/src/scrollbar/src/scrollbar.vue +54 -0
- package/packages/components/src/search-panel/index.ts +5 -0
- package/packages/components/src/search-panel/src/search-panel.ts +8 -0
- package/packages/components/src/search-panel/src/search-panel.vue +251 -0
- package/packages/components/src/select/index.ts +9 -0
- package/packages/components/src/select/src/select.ts +3 -0
- package/packages/components/src/select/src/select.vue +43 -0
- package/packages/components/src/slider/index.ts +5 -0
- package/packages/components/src/slider/src/slider.ts +8 -0
- package/packages/components/src/slider/src/slider.vue +20 -0
- package/packages/components/src/space/index.ts +5 -0
- package/packages/components/src/space/src/space.ts +8 -0
- package/packages/components/src/space/src/space.vue +43 -0
- package/packages/components/src/steps/index.ts +8 -0
- package/packages/components/src/steps/src/step.ts +15 -0
- package/packages/components/src/steps/src/step.vue +18 -0
- package/packages/components/src/steps/src/steps.ts +20 -0
- package/packages/components/src/steps/src/steps.vue +95 -0
- package/packages/components/src/steps/src/tokens.ts +6 -0
- package/packages/components/src/switch/index.ts +5 -0
- package/packages/components/src/switch/src/switch.ts +8 -0
- package/packages/components/src/switch/src/switch.vue +51 -0
- package/packages/components/src/table/index.ts +7 -0
- package/packages/components/src/table/src/table.ts +34 -0
- package/packages/components/src/table/src/table.vue +47 -0
- package/packages/components/src/table-grid/index.ts +7 -0
- package/packages/components/src/table-grid/src/render-cell.vue +44 -0
- package/packages/components/src/table-grid/src/table-grid.ts +159 -0
- package/packages/components/src/table-grid/src/table-grid.vue +334 -0
- package/packages/components/src/table-head-editor/index.ts +5 -0
- package/packages/components/src/table-head-editor/src/table-head-editor.ts +59 -0
- package/packages/components/src/table-head-editor/src/table-head-editor.vue +780 -0
- package/packages/components/src/table-head-editor/src/utils.ts +192 -0
- package/packages/components/src/tabs/index.ts +7 -0
- package/packages/components/src/tabs/src/tabs.ts +8 -0
- package/packages/components/src/tabs/src/tabs.vue +23 -0
- package/packages/components/src/tag/index.ts +5 -0
- package/packages/components/src/tag/src/tag.ts +47 -0
- package/packages/components/src/tag/src/tag.vue +60 -0
- package/packages/components/src/tag/src/types.ts +8 -0
- package/packages/components/src/text/index.ts +5 -0
- package/packages/components/src/text/src/text.ts +8 -0
- package/packages/components/src/text/src/text.vue +20 -0
- package/packages/components/src/time-picker/index.ts +5 -0
- package/packages/components/src/time-picker/src/time-picker.ts +3 -0
- package/packages/components/src/time-picker/src/time-picker.vue +14 -0
- package/packages/components/src/time-select/index.ts +5 -0
- package/packages/components/src/time-select/src/time-select.ts +5 -0
- package/packages/components/src/time-select/src/time-select.vue +14 -0
- package/packages/components/src/tooltip/index.ts +5 -0
- package/packages/components/src/tooltip/src/tooltip.ts +6 -0
- package/packages/components/src/tooltip/src/tooltip.vue +71 -0
- package/packages/components/src/tour/index.ts +5 -0
- package/packages/components/src/tour/src/tour.ts +8 -0
- package/packages/components/src/tour/src/tour.vue +20 -0
- package/packages/components/src/tree/index.ts +5 -0
- package/packages/components/src/tree/src/tree.ts +8 -0
- package/packages/components/src/tree/src/tree.vue +77 -0
- package/packages/components/src/tree-select/index.ts +3 -0
- package/packages/components/src/tree-select/src/tree-select.vue +96 -0
- package/packages/components/tsconfig.json +19 -0
- package/packages/components/vite.config.ts +32 -0
- package/packages/icons/CHANGELOG.md +45 -0
- package/packages/icons/README.md +86 -0
- package/packages/icons/package.json +30 -0
- package/packages/icons/src/components/arrow-down.vue +12 -0
- package/packages/icons/src/components/arrow-left.vue +12 -0
- package/packages/icons/src/components/arrow-right.vue +12 -0
- package/packages/icons/src/components/arrow-up.vue +12 -0
- package/packages/icons/src/components/circle-check.vue +15 -0
- package/packages/icons/src/components/circle-close.vue +15 -0
- package/packages/icons/src/components/close.vue +13 -0
- package/packages/icons/src/components/copy.vue +12 -0
- package/packages/icons/src/components/delete.vue +12 -0
- package/packages/icons/src/components/download.vue +15 -0
- package/packages/icons/src/components/edit.vue +12 -0
- package/packages/icons/src/components/error.vue +12 -0
- package/packages/icons/src/components/export.vue +17 -0
- package/packages/icons/src/components/file.vue +21 -0
- package/packages/icons/src/components/import.vue +19 -0
- package/packages/icons/src/components/index.ts +37 -0
- package/packages/icons/src/components/info.vue +13 -0
- package/packages/icons/src/components/list-process.vue +37 -0
- package/packages/icons/src/components/log.vue +17 -0
- package/packages/icons/src/components/minus.vue +13 -0
- package/packages/icons/src/components/money-bubble.vue +21 -0
- package/packages/icons/src/components/plane.vue +30 -0
- package/packages/icons/src/components/plus.vue +17 -0
- package/packages/icons/src/components/printer.vue +17 -0
- package/packages/icons/src/components/reset.vue +21 -0
- package/packages/icons/src/components/right.vue +21 -0
- package/packages/icons/src/components/search.vue +15 -0
- package/packages/icons/src/components/select.vue +17 -0
- package/packages/icons/src/components/semi-select.vue +17 -0
- package/packages/icons/src/components/setting.vue +25 -0
- package/packages/icons/src/components/stamp.vue +35 -0
- package/packages/icons/src/components/success.vue +13 -0
- package/packages/icons/src/components/tree-triangle.vue +17 -0
- package/packages/icons/src/components/upload.vue +21 -0
- package/packages/icons/src/components/view.vue +15 -0
- package/packages/icons/src/components/warning.vue +13 -0
- package/packages/icons/src/components/zoom-in.vue +27 -0
- package/packages/icons/src/components/zoom-out.vue +27 -0
- package/packages/icons/src/index.ts +9 -0
- package/packages/icons/tsconfig.json +10 -0
- package/packages/icons/vite.config.ts +33 -0
- package/packages/styles/CHANGELOG.md +99 -0
- package/packages/styles/README.md +107 -0
- package/packages/styles/package.json +23 -0
- package/packages/styles/src/action-menu.scss +103 -0
- package/packages/styles/src/arrow-step.scss +138 -0
- package/packages/styles/src/arrow-steps.scss +8 -0
- package/packages/styles/src/batch-copy.scss +40 -0
- package/packages/styles/src/batch-editor.scss +36 -0
- package/packages/styles/src/breadcrumb.scss +29 -0
- package/packages/styles/src/button.scss +127 -0
- package/packages/styles/src/calendar.scss +327 -0
- package/packages/styles/src/card.scss +85 -0
- package/packages/styles/src/cascader.scss +59 -0
- package/packages/styles/src/checkbox.scss +46 -0
- package/packages/styles/src/column-table.scss +13 -0
- package/packages/styles/src/date-picker.scss +547 -0
- package/packages/styles/src/description.scss +38 -0
- package/packages/styles/src/dialog.scss +120 -0
- package/packages/styles/src/drawer.scss +22 -0
- package/packages/styles/src/editor.scss +13 -0
- package/packages/styles/src/empty.scss +12 -0
- package/packages/styles/src/file-task-dialog.scss +13 -0
- package/packages/styles/src/image.scss +6 -0
- package/packages/styles/src/import-dialog.scss +122 -0
- package/packages/styles/src/independent-nav.scss +37 -0
- package/packages/styles/src/index.scss +46 -0
- package/packages/styles/src/input-number.scss +34 -0
- package/packages/styles/src/input.scss +28 -0
- package/packages/styles/src/link.scss +70 -0
- package/packages/styles/src/message.scss +12 -0
- package/packages/styles/src/mixins.scss +60 -0
- package/packages/styles/src/nav.scss +12 -0
- package/packages/styles/src/overrides.scss +25 -0
- package/packages/styles/src/pagination.scss +161 -0
- package/packages/styles/src/popover.scss +4 -0
- package/packages/styles/src/radio.scss +54 -0
- package/packages/styles/src/search-panel.scss +51 -0
- package/packages/styles/src/select.scss +44 -0
- package/packages/styles/src/steps.scss +336 -0
- package/packages/styles/src/switch.scss +35 -0
- package/packages/styles/src/table-grid.scss +37 -0
- package/packages/styles/src/table-head-editor.scss +112 -0
- package/packages/styles/src/table.scss +33 -0
- package/packages/styles/src/tabs.scss +45 -0
- package/packages/styles/src/tag.scss +29 -0
- package/packages/styles/src/theme.scss +101 -0
- package/packages/styles/src/time-picker.scss +225 -0
- package/packages/styles/src/time-select.scss +141 -0
- package/packages/styles/src/tooltip.scss +21 -0
- package/packages/styles/src/tree-select.scss +52 -0
- package/packages/styles/src/tree.scss +8 -0
- package/packages/styles/src/utilities.scss +81 -0
- package/packages/styles/src/variables.scss +56 -0
- package/packages/styles/vite.config.ts +28 -0
- package/pnpm-workspace.yaml +3 -0
- 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>
|