From 5e9d0db206cf95324dd6decdeb7d97e7493b3661 Mon Sep 17 00:00:00 2001 From: "LINING-PC\\lining" Date: Thu, 15 Jan 2026 16:42:01 +0800 Subject: [PATCH] v1.7.2 - add enableLinkAnchor prop --- CHANGELOG.md | 6 ++++++ README-EN.md | 7 ++++++- README.md | 7 ++++++- demo/version-history.json | 10 ++++++++++ src/components/GanttChart.vue | 7 +++++++ src/components/TaskBar.vue | 7 +++++-- 6 files changed, 40 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 942fdf0..b4bae13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.7.2] - 2026-01-15 + +### Added +- 🎉 新增:GanttChart新增属性,enableLinkAnchor用于控制Taskbar的关系线锚点 +- 🎉 Added: New property in GanttChart - enableLinkAnchor to control the relationship line anchor points of Taskbar + ## [1.7.1] - 2026-01-11 ### Added diff --git a/README-EN.md b/README-EN.md index 8f7fc43..3f01bbe 100644 --- a/README-EN.md +++ b/README-EN.md @@ -36,8 +36,12 @@

+ + 📱 Gitee Live Demo + +   |   - 📱 Live Demo + 📱 Github Live Demo   |   @@ -205,6 +209,7 @@ npm run dev | `timeScale` ![v1.7.1](https://img.shields.io/badge/v1.7.1-409EFF?style=flat-square&labelColor=ECF5FF) | `'hour' \| 'day' \| 'week' \| 'month' \| 'quarter' \| 'year'` | `'week'` | Time scale (reactive). Timeline scale will follow changes | | `fullscreen` ![v1.7.1](https://img.shields.io/badge/v1.7.1-409EFF?style=flat-square&labelColor=ECF5FF) | `boolean` | `false` | Fullscreen state control (reactive). Component's fullscreen state will follow changes | | `expandAll` ![v1.7.1](https://img.shields.io/badge/v1.7.1-409EFF?style=flat-square&labelColor=ECF5FF) | `boolean` | `true` | Expand/collapse all tasks (reactive). All tasks' expand state will follow changes | +| `enableLinkAnchor` ![v1.7.2](https://img.shields.io/badge/v1.7.2-409EFF?style=flat-square&labelColor=ECF5FF) | `boolean` | `true` | Whether to enable Link Anchor,Default: true | #### TaskListColumn Component Props diff --git a/README.md b/README.md index df5cdca..f6b338c 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,12 @@

+ + 📱 Gitee在线演示 + +   |   - 📱 在线演示 + 📱 Github在线演示   |   @@ -203,6 +207,7 @@ npm run dev | `timeScale` ![v1.7.1](https://img.shields.io/badge/v1.7.1-409EFF?style=flat-square&labelColor=ECF5FF) | `'hour' \| 'day' \| 'week' \| 'month' \| 'quarter' \| 'year'` | `'week'` | 时间刻度(响应式)。设置后时间线刻度将跟随变化 | | `fullscreen` ![v1.7.1](https://img.shields.io/badge/v1.7.1-409EFF?style=flat-square&labelColor=ECF5FF) | `boolean` | `false` | 全屏状态控制(响应式)。设置后组件全屏状态将跟随变化 | | `expandAll` ![v1.7.1](https://img.shields.io/badge/v1.7.1-409EFF?style=flat-square&labelColor=ECF5FF) | `boolean` | `true` | 展开/收起所有任务(响应式)。设置后所有任务的展开状态将跟随变化 | +| `enableLinkAnchor` ![v1.7.2](https://img.shields.io/badge/v1.7.2-409EFF?style=flat-square&labelColor=ECF5FF) | `boolean` | `true` | 是否开启Taskbar的关系线锚点,默认值: true | #### TaskListColumn 属性 diff --git a/demo/version-history.json b/demo/version-history.json index 136c7da..bca4200 100644 --- a/demo/version-history.json +++ b/demo/version-history.json @@ -456,5 +456,15 @@ "🎉 Added: Exposed methods in GanttChart to scroll to today/task/specified date - scrollToToday & scrollToTask & scrollToDate", "Special thanks to name-hard@github for their use and suggestions" ] + }, + { + "version": "1.7.2", + "date": "2026-01-15", + "notes": [ + "🎉 新增:GanttChart新增属性,enableLinkAnchor用于控制Taskbar的关系线锚点", + "特别感谢 YQ6494@gitee的使用及建议", + "🎉 Added: New property in GanttChart - enableLinkAnchor to control the relationship line anchor points of Taskbar", + "Special thanks to YQ6494@gitee for their use and suggestions" + ] } ] diff --git a/src/components/GanttChart.vue b/src/components/GanttChart.vue index bc9db88..8f08849 100644 --- a/src/components/GanttChart.vue +++ b/src/components/GanttChart.vue @@ -58,6 +58,7 @@ const props = withDefaults(defineProps(), { taskListRowStyle: undefined, enableTaskListContextMenu: true, enableTaskBarContextMenu: true, + enableLinkAnchor: true, fullscreen: false, expandAll: true, locale: 'zh-CN', @@ -105,6 +106,9 @@ provide('gantt-column-slots', slots) provide('enable-task-list-context-menu', computed(() => props.enableTaskListContextMenu)) provide('enable-task-bar-context-menu', computed(() => props.enableTaskBarContextMenu)) +// 提供 LinkAnchor 配置给子组件 +provide('enable-link-anchor', computed(() => props.enableLinkAnchor)) + // 使用声明式右键菜单 composables const { hasDeclarativeContextMenu: hasDeclarativeTaskListContextMenu, declarativeContextMenu: declarativeTaskListContextMenu } = useTaskListContextMenu(slots) @@ -194,6 +198,9 @@ interface Props { // 当设置为 true 且声明了 TaskBarContextMenu 组件时,使用自定义菜单 // 当设置为 false 时,无论是否声明组件,TaskBar 右键菜单都失效 enableTaskBarContextMenu?: boolean + // 是否启用 LinkAnchor 连接触点功能(默认为 true) + // 当设置为 false 时,TaskBar 上不显示前置/后置任务的连接触点 + enableLinkAnchor?: boolean // 全屏状态控制(响应式) fullscreen?: boolean // 展开/收起所有任务(响应式) diff --git a/src/components/TaskBar.vue b/src/components/TaskBar.vue index b683630..412480a 100644 --- a/src/components/TaskBar.vue +++ b/src/components/TaskBar.vue @@ -10,6 +10,9 @@ import { useI18n } from '../composables/useI18n' import type { TaskBarConfig } from '../models/configs/TaskBarConfig' import { DEFAULT_TASK_BAR_CONFIG } from '../models/configs/TaskBarConfig' +// 从 GanttChart 注入 enableLinkAnchor 配置 +const enableLinkAnchor = inject>('enable-link-anchor', computed(() => true)) + interface Props { task: Task rowHeight: number @@ -2547,7 +2550,7 @@ const handleAnchorDragEnd = (anchorEvent: { taskId: number; type: 'predecessor'