@timelinekit/vue 1.0.8 → 1.0.9

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 (2) hide show
  1. package/README.md +25 -26
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -28,23 +28,30 @@ All types from `@timelinekit/core` are re-exported from this package for conveni
28
28
 
29
29
  ```vue
30
30
  <script setup lang="ts">
31
- import { ref, onMounted } from 'vue';
32
- import { GanttChart, type GanttChartRef, Task, TaskLink } from '@timelinekit/vue';
31
+ import { ref } from 'vue';
32
+ import { GanttChart, type GanttChartRef } from '@timelinekit/vue';
33
33
  import '@timelinekit/core/styles';
34
34
 
35
35
  const ganttRef = ref<GanttChartRef>();
36
36
 
37
- onMounted(() => {
38
- const gantt = ganttRef.value!;
39
- const taskA = gantt.list.addTask(new Task({ id: '1', name: 'Design', startTime: '2027-01-05', endTime: '2027-01-09' }));
40
- const taskB = gantt.list.addTask(new Task({ id: '2', name: 'Development', startTime: '2027-01-12', endTime: '2027-01-23' }));
41
- gantt.list.addLink(new TaskLink({ id: 'l1', from: taskA, to: taskB, type: 'finishToStart' }));
42
- gantt.zoomToFit();
43
- });
37
+ const data = {
38
+ tasks: [
39
+ { id: '1', name: 'Design', startTime: '2027-01-05', endTime: '2027-01-09', type: 'task', progress: 100 },
40
+ { id: '2', name: 'Development', startTime: '2027-01-12', endTime: '2027-01-23', type: 'task' },
41
+ ],
42
+ links: [
43
+ { id: 'l1', from: '1', to: '2', type: 'finishToStart' },
44
+ ],
45
+ };
46
+
47
+ function handleReady() {
48
+ ganttRef.value!.load(JSON.stringify(data));
49
+ ganttRef.value!.zoomToFit();
50
+ }
44
51
  </script>
45
52
 
46
53
  <template>
47
- <GanttChart ref="ganttRef" style="height: 600px" />
54
+ <GanttChart ref="ganttRef" @ready="handleReady" style="height: 600px" />
48
55
  </template>
49
56
  ```
50
57
 
@@ -60,14 +67,8 @@ const schedulerRef = ref<ResourceSchedulerRef>();
60
67
 
61
68
  onMounted(() => {
62
69
  const scheduler = schedulerRef.value!;
63
- const resource = scheduler.data.addResource(new SchedulerResource({ id: '1', name: 'Room A' }));
64
- scheduler.data.addEvent(new SchedulerEvent({
65
- id: 'e1',
66
- resourceId: resource.id,
67
- name: 'Meeting',
68
- startTime: '2027-01-05T09:00',
69
- endTime: '2027-01-05T10:30',
70
- }));
70
+ scheduler.data.addResource(new SchedulerResource('1', 'Room A'));
71
+ scheduler.data.addEvent(new SchedulerEvent('e1', '1', 'Meeting', new Date('2027-01-05T09:00'), new Date('2027-01-05T10:30')));
71
72
  });
72
73
  </script>
73
74
 
@@ -81,19 +82,17 @@ onMounted(() => {
81
82
  ```vue
82
83
  <script setup lang="ts">
83
84
  import { ref, onMounted } from 'vue';
84
- import { EventCalendar, type EventCalendarRef, CalendarItem } from '@timelinekit/vue';
85
+ import { EventCalendar, type EventCalendarRef } from '@timelinekit/vue';
85
86
  import '@timelinekit/core/styles';
86
87
 
87
88
  const calendarRef = ref<EventCalendarRef>();
88
89
 
89
90
  onMounted(() => {
90
91
  const calendar = calendarRef.value!;
91
- calendar.data.addItem(new CalendarItem({
92
- id: '1',
93
- name: 'Team Standup',
94
- startTime: '2027-01-05T09:00',
95
- endTime: '2027-01-05T09:30',
96
- type: 'Meeting',
92
+ calendar.load(JSON.stringify({
93
+ items: [
94
+ { id: '1', name: 'Team Standup', startTime: '2027-01-05T09:00', endTime: '2027-01-05T09:30', type: 'Meeting' },
95
+ ],
97
96
  }));
98
97
  });
99
98
  </script>
@@ -115,7 +114,7 @@ import { GanttChart, type GanttChartRef } from '@timelinekit/vue';
115
114
  const ganttRef = ref<GanttChartRef>();
116
115
 
117
116
  function handleReady() {
118
- ganttRef.value!.list.addTask(...);
117
+ ganttRef.value!.load(JSON.stringify(data));
119
118
  ganttRef.value!.zoomIn();
120
119
  ganttRef.value!.undo();
121
120
  ganttRef.value!.exportToImage();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timelinekit/vue",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -12,10 +12,10 @@
12
12
  },
13
13
  "peerDependencies": {
14
14
  "vue": ">=3.3.0",
15
- "@timelinekit/core": "1.0.8"
15
+ "@timelinekit/core": "1.0.9"
16
16
  },
17
17
  "dependencies": {
18
- "@timelinekit/core": "1.0.8"
18
+ "@timelinekit/core": "1.0.9"
19
19
  },
20
20
  "devDependencies": {
21
21
  "vue": "^3.5.0",