@lee576/vue3-gantt 1.0.0 → 1.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/README.en-US.md CHANGED
@@ -39,6 +39,7 @@ A feature-rich, highly customizable Vue 3 Gantt chart component that supports ta
39
39
 
40
40
  - **Multiple View Modes** - Month, Day, Week, and Hour time granularity views
41
41
  - **Task Dependencies** - Support for FS, SS, FF, SF dependency types
42
+ - **Milestone Support** - Diamond markers for key project milestones with dependency support
42
43
  - **Theme System** - 5 built-in themes with custom theme support
43
44
  - **Internationalization** - Built-in 8 languages, easily extensible
44
45
  - **Progress Management** - Visual progress bars with drag-to-adjust
@@ -48,9 +49,24 @@ A feature-rich, highly customizable Vue 3 Gantt chart component that supports ta
48
49
 
49
50
  ## Installation
50
51
 
52
+ ### Option 1: Install via npm (Recommended)
53
+
54
+ ```bash
55
+ # Using npm
56
+ npm install @lee576/vue3-gantt
57
+
58
+ # Or using yarn
59
+ yarn add @lee576/vue3-gantt
60
+
61
+ # Or using pnpm
62
+ pnpm add @lee576/vue3-gantt
63
+ ```
64
+
65
+ ### Option 2: Build from Source
66
+
51
67
  ```bash
52
68
  # Clone repository
53
- git clone <repository-url>
69
+ git clone https://github.com/lee576/vue3-gantt.git
54
70
 
55
71
  # Install dependencies
56
72
  npm install
@@ -70,6 +86,23 @@ npm run dev
70
86
 
71
87
  ## Basic Usage
72
88
 
89
+ ### 1. Import Component and Styles
90
+
91
+ ```typescript
92
+ import { ref, onMounted } from 'vue';
93
+ import dayjs from 'dayjs';
94
+ // Import Gantt component and types
95
+ import Gantt, {
96
+ type DataConfig,
97
+ type StyleConfig,
98
+ type EventConfig
99
+ } from '@lee576/vue3-gantt';
100
+ // Import styles
101
+ import '@lee576/vue3-gantt/style.css';
102
+ import { LinkType } from '@lee576/vue3-gantt';
103
+
104
+ ### 2. Configure Component
105
+
73
106
  ```vue
74
107
  <template>
75
108
  <gantt
@@ -80,17 +113,7 @@ npm run dev
80
113
  </template>
81
114
  ```
82
115
 
83
-
84
116
  ```typescript
85
- import { ref, onMounted } from 'vue';
86
- import dayjs from 'dayjs';
87
- import Gantt, {
88
- type DataConfig,
89
- type StyleConfig,
90
- type EventConfig
91
- } from './components/gantt/Gantt.vue';
92
- import { LinkType } from './components/gantt/Types';
93
-
94
117
  // Style configuration
95
118
  const styleConfig = ref<StyleConfig>({
96
119
  headersHeight: 100, // Header height
@@ -234,6 +257,8 @@ interface ProgressUpdateDetail {
234
257
 
235
258
  ## Task Data Format
236
259
 
260
+ ### Regular Task
261
+
237
262
  ```typescript
238
263
  {
239
264
  id: '1', // Task ID
@@ -247,6 +272,29 @@ interface ProgressUpdateDetail {
247
272
  }
248
273
  ```
249
274
 
275
+ ### Milestone Task
276
+
277
+ Milestones are key project checkpoints, displayed with diamond icons. The key characteristic is **start date equals end date**:
278
+
279
+ ```typescript
280
+ {
281
+ id: 'milestone-1', // Milestone ID
282
+ pid: '0', // Parent task ID
283
+ taskNo: '🎯 Requirements Complete', // Milestone name
284
+ level: 'Urgent', // Priority
285
+ start_date: '2024-12-02 18:00:00', // Start time
286
+ end_date: '2024-12-02 18:00:00', // End time (same as start)
287
+ job_progress: '1.0', // Milestones are usually 100%
288
+ spend_time: null,
289
+ type: 'milestone' // Optional: explicitly mark as milestone
290
+ }
291
+ ```
292
+
293
+ **Milestone Recognition Rules**:
294
+ 1. **Auto-detection**: Automatically displayed as diamond when `start_date === end_date`
295
+ 2. **Explicit marking**: Set `type: 'milestone'` field
296
+ 3. **Custom function**: Custom logic via `styleConfig.setTaskType`
297
+
250
298
  ## Task Dependencies
251
299
 
252
300
  ```
@@ -273,6 +321,8 @@ Finish-Start (FS) Start-Start (SS) Finish-Finish (FF) Start-Finish (SF)
273
321
 
274
322
  ### Configuration Example
275
323
 
324
+ #### Regular Task Dependencies
325
+
276
326
  ```typescript
277
327
  import { LinkType } from './components/gantt/Types';
278
328
 
@@ -280,14 +330,34 @@ dependencies: [
280
330
  // Task 2 starts after Task 1 finishes
281
331
  { sourceTaskId: '1', targetTaskId: '2', type: LinkType.FINISH_TO_START },
282
332
 
283
- // Task 3 and Task 4 start simultaneously
333
+ // Task 3 and Task 4 start together
284
334
  { sourceTaskId: '3', targetTaskId: '4', type: LinkType.START_TO_START },
285
335
 
286
- // Task 5 and Task 6 must finish simultaneously
336
+ // Task 5 and Task 6 must finish together
287
337
  { sourceTaskId: '5', targetTaskId: '6', type: LinkType.FINISH_TO_FINISH },
288
338
  ]
289
339
  ```
290
340
 
341
+ #### Milestone Dependencies
342
+
343
+ Milestones support being **source** or **target** in dependency relationships:
344
+
345
+ ```typescript
346
+ dependencies: [
347
+ // Task completion → Milestone
348
+ { sourceTaskId: 'task-5', targetTaskId: 'milestone-1', type: LinkType.FINISH_TO_START },
349
+
350
+ // Milestone → Task starts
351
+ { sourceTaskId: 'milestone-1', targetTaskId: 'task-6', type: LinkType.FINISH_TO_START },
352
+
353
+ // Multiple tasks → Same milestone
354
+ { sourceTaskId: 'frontend-dev', targetTaskId: 'milestone-2', type: LinkType.FINISH_TO_START },
355
+ { sourceTaskId: 'backend-dev', targetTaskId: 'milestone-2', type: LinkType.FINISH_TO_START },
356
+ ]
357
+ ```
358
+
359
+ ```
360
+
291
361
  ## View Modes
292
362
 
293
363
  | Mode | Time Unit | Header Example | Use Case |
package/README.md CHANGED
@@ -48,6 +48,7 @@
48
48
 
49
49
  - **多视图模式** - 支持月、日、周、时四种时间粒度视图
50
50
  - **任务依赖关系** - 支持 FS、SS、FF、SF 四种依赖类型
51
+ - **里程碑功能** - 菱形图标标记项目关键节点,支持作为依赖源和目标
51
52
  - **主题系统** - 内置 5 种主题,支持自定义主题
52
53
  - **国际化支持** - 内置 8 种语言,可扩展更多语言
53
54
  - **进度管理** - 可视化进度条,支持拖拽调整进度
@@ -57,9 +58,24 @@
57
58
 
58
59
  ## 安装
59
60
 
61
+ ### 方式一:通过 npm 安装(推荐)
62
+
63
+ ```bash
64
+ # 使用 npm 安装
65
+ npm install @lee576/vue3-gantt
66
+
67
+ # 或使用 yarn
68
+ yarn add @lee576/vue3-gantt
69
+
70
+ # 或使用 pnpm
71
+ pnpm add @lee576/vue3-gantt
72
+ ```
73
+
74
+ ### 方式二:从源码构建
75
+
60
76
  ```bash
61
77
  # 克隆项目
62
- git clone <repository-url>
78
+ git clone https://github.com/lee576/vue3-gantt.git
63
79
 
64
80
  # 安装依赖
65
81
  npm install
@@ -79,6 +95,23 @@ npm run dev
79
95
 
80
96
  ## 基本使用
81
97
 
98
+ ### 1. 引入组件和样式
99
+
100
+ ```typescript
101
+ import { ref, onMounted } from 'vue';
102
+ import dayjs from 'dayjs';
103
+ // 引入甘特图组件和类型
104
+ import Gantt, {
105
+ type DataConfig,
106
+ type StyleConfig,
107
+ type EventConfig
108
+ } from '@lee576/vue3-gantt';
109
+ // 引入样式文件
110
+ import '@lee576/vue3-gantt/style.css';
111
+ import { LinkType } from '@lee576/vue3-gantt';
112
+
113
+ ### 2. 配置组件
114
+
82
115
  ```vue
83
116
  <template>
84
117
  <gantt
@@ -89,17 +122,7 @@ npm run dev
89
122
  </template>
90
123
  ```
91
124
 
92
-
93
125
  ```typescript
94
- import { ref, onMounted } from 'vue';
95
- import dayjs from 'dayjs';
96
- import Gantt, {
97
- type DataConfig,
98
- type StyleConfig,
99
- type EventConfig
100
- } from './components/gantt/Gantt.vue';
101
- import { LinkType } from './components/gantt/Types';
102
-
103
126
  // 样式配置
104
127
  const styleConfig = ref<StyleConfig>({
105
128
  headersHeight: 100, // 表头高度
@@ -243,6 +266,8 @@ interface ProgressUpdateDetail {
243
266
 
244
267
  ## 任务数据格式
245
268
 
269
+ ### 普通任务
270
+
246
271
  ```typescript
247
272
  {
248
273
  id: '1', // 任务ID
@@ -256,6 +281,29 @@ interface ProgressUpdateDetail {
256
281
  }
257
282
  ```
258
283
 
284
+ ### 里程碑任务
285
+
286
+ 里程碑是项目中的关键节点,使用菱形图标显示,特点是**开始日期等于结束日期**:
287
+
288
+ ```typescript
289
+ {
290
+ id: 'milestone-1', // 里程碑ID
291
+ pid: '0', // 父任务ID
292
+ taskNo: '🎯 需求分析完成', // 里程碑名称
293
+ level: '紧急', // 优先级
294
+ start_date: '2024-12-02 18:00:00', // 开始时间
295
+ end_date: '2024-12-02 18:00:00', // 结束时间(与开始时间相同)
296
+ job_progress: '1.0', // 里程碑通常为100%
297
+ spend_time: null,
298
+ type: 'milestone' // 可选:显式标记为里程碑
299
+ }
300
+ ```
301
+
302
+ **里程碑识别规则**:
303
+ 1. **自动识别**:当 `start_date === end_date` 时自动显示为菱形
304
+ 2. **显式标记**:设置 `type: 'milestone'` 字段
305
+ 3. **自定义函数**:通过 `styleConfig.setTaskType` 自定义判断逻辑
306
+
259
307
  ## 任务依赖关系
260
308
 
261
309
  ```
@@ -281,6 +329,8 @@ interface ProgressUpdateDetail {
281
329
 
282
330
  ### 配置示例
283
331
 
332
+ #### 普通任务依赖
333
+
284
334
  ```typescript
285
335
  import { LinkType } from './components/gantt/Types';
286
336
 
@@ -296,6 +346,24 @@ dependencies: [
296
346
  ]
297
347
  ```
298
348
 
349
+ #### 里程碑依赖
350
+
351
+ 里程碑支持作为依赖关系的**源**或**目标**:
352
+
353
+ ```typescript
354
+ dependencies: [
355
+ // 任务完成 → 里程碑
356
+ { sourceTaskId: 'task-5', targetTaskId: 'milestone-1', type: LinkType.FINISH_TO_START },
357
+
358
+ // 里程碑 → 任务开始
359
+ { sourceTaskId: 'milestone-1', targetTaskId: 'task-6', type: LinkType.FINISH_TO_START },
360
+
361
+ // 多个任务 → 同一个里程碑
362
+ { sourceTaskId: 'frontend-dev', targetTaskId: 'milestone-2', type: LinkType.FINISH_TO_START },
363
+ { sourceTaskId: 'backend-dev', targetTaskId: 'milestone-2', type: LinkType.FINISH_TO_START },
364
+ ]
365
+ ```
366
+
299
367
  ## 视图模式
300
368
 
301
369
  | 模式 | 时间单位 | 表头示例 | 适用场景 |
@@ -702,6 +770,7 @@ A feature-rich, highly customizable Vue 3 Gantt chart component that supports ta
702
770
 
703
771
  - **Multiple View Modes** - Month, Day, Week, and Hour time granularity views
704
772
  - **Task Dependencies** - Support for FS, SS, FF, SF dependency types
773
+ - **Milestone Support** - Diamond markers for key project milestones with dependency support
705
774
  - **Theme System** - 5 built-in themes with custom theme support
706
775
  - **Internationalization** - Built-in 8 languages, easily extensible
707
776
  - **Progress Management** - Visual progress bars with drag-to-adjust