tg-ganttchart 0.0.4 → 0.0.6
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/dist/demo.html +1 -0
- package/dist/tgganttchart.common.js +9231 -0
- package/dist/tgganttchart.common.js.map +1 -0
- package/dist/tgganttchart.css +1 -0
- package/dist/tgganttchart.umd.js +9242 -0
- package/dist/tgganttchart.umd.js.map +1 -0
- package/dist/tgganttchart.umd.min.js +7 -0
- package/dist/tgganttchart.umd.min.js.map +1 -0
- package/package.json +4 -1
- package/babel.config.js +0 -5
- package/src/components/GanttElastic.standalone.vue +0 -48
- package/src/components/GanttElastic.vue +0 -1646
- package/src/components/components/Calendar/Calendar.vue +0 -332
- package/src/components/components/Calendar/CalendarRow.vue +0 -96
- package/src/components/components/Chart/Chart.vue +0 -111
- package/src/components/components/Chart/DaysHighlight.vue +0 -71
- package/src/components/components/Chart/DependencyLines.vue +0 -112
- package/src/components/components/Chart/Grid.vue +0 -164
- package/src/components/components/Chart/ProgressBar.vue +0 -110
- package/src/components/components/Chart/Row/Milestone.vue +0 -117
- package/src/components/components/Chart/Row/Project.vue +0 -131
- package/src/components/components/Chart/Row/Task.mixin.js +0 -46
- package/src/components/components/Chart/Row/Task.vue +0 -107
- package/src/components/components/Chart/Text.vue +0 -105
- package/src/components/components/Expander.vue +0 -126
- package/src/components/components/Header/Header.vue +0 -264
- package/src/components/components/MainView.vue +0 -282
- package/src/components/components/TaskList/ItemColumn.vue +0 -121
- package/src/components/components/TaskList/TaskList.vue +0 -45
- package/src/components/components/TaskList/TaskListHeader.vue +0 -143
- package/src/components/components/TaskList/TaskListItem.vue +0 -35
- package/src/components/components/bundle.js +0 -28
- package/src/components/style.js +0 -308
- package/src/index.js +0 -12
- package/vue.config.js +0 -42
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<template>
|
|
3
|
-
<svg
|
|
4
|
-
x="0"
|
|
5
|
-
y="0"
|
|
6
|
-
width="100%"
|
|
7
|
-
height="100%"
|
|
8
|
-
class="gantt-elastic__chart-dependency-lines-container"
|
|
9
|
-
:style="{ ...root.style['chart-dependency-lines-container'] }"
|
|
10
|
-
>
|
|
11
|
-
<g v-for="task in dependencyTasks" :key="task.id" :task="task">
|
|
12
|
-
<path
|
|
13
|
-
class="gantt-elastic__chart-dependency-lines-path"
|
|
14
|
-
:style="{ ...root.style['chart-dependency-lines-path'], ...task.style['chart-dependency-lines-path'], ...task.style['chart-dependency-lines-path-' + dependencyLine.task_id] }"
|
|
15
|
-
v-for="dependencyLine in task.dependencyLines"
|
|
16
|
-
:key="dependencyLine.id"
|
|
17
|
-
:task="task"
|
|
18
|
-
:d="dependencyLine.points"
|
|
19
|
-
></path>
|
|
20
|
-
</g>
|
|
21
|
-
</svg>
|
|
22
|
-
</template>
|
|
23
|
-
|
|
24
|
-
<script>
|
|
25
|
-
export default {
|
|
26
|
-
name: 'DependencyLines',
|
|
27
|
-
inject: ['root'],
|
|
28
|
-
props: ['tasks'],
|
|
29
|
-
data() {
|
|
30
|
-
return {};
|
|
31
|
-
},
|
|
32
|
-
methods: {
|
|
33
|
-
/**
|
|
34
|
-
* Get path points
|
|
35
|
-
*
|
|
36
|
-
* @param {any} fromTaskId
|
|
37
|
-
* @param {any} toTaskId
|
|
38
|
-
* @returns {string}
|
|
39
|
-
*/
|
|
40
|
-
getPoints(fromTaskId, toTaskId) {
|
|
41
|
-
const fromTask = this.root.getTask(fromTaskId);
|
|
42
|
-
const toTask = this.root.getTask(toTaskId);
|
|
43
|
-
if (
|
|
44
|
-
fromTask === null ||
|
|
45
|
-
toTask === null ||
|
|
46
|
-
!this.root.isTaskVisible(toTask) ||
|
|
47
|
-
!this.root.isTaskVisible(fromTask)
|
|
48
|
-
) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
const startX = fromTask.x + fromTask.width;
|
|
52
|
-
const startY = fromTask.y + fromTask.height / 2;
|
|
53
|
-
const stopX = toTask.x;
|
|
54
|
-
const stopY = toTask.y + toTask.height / 2;
|
|
55
|
-
const distanceX = stopX - startX;
|
|
56
|
-
let distanceY;
|
|
57
|
-
let yMultiplier = 1;
|
|
58
|
-
if (stopY >= startY) {
|
|
59
|
-
distanceY = stopY - startY;
|
|
60
|
-
} else {
|
|
61
|
-
distanceY = startY - stopY;
|
|
62
|
-
yMultiplier = -1;
|
|
63
|
-
}
|
|
64
|
-
const offset = 10;
|
|
65
|
-
const roundness = 4;
|
|
66
|
-
const isBefore = distanceX <= offset + roundness;
|
|
67
|
-
let points = `M ${startX} ${startY}
|
|
68
|
-
L ${startX + offset},${startY} `;
|
|
69
|
-
if (isBefore) {
|
|
70
|
-
points += `Q ${startX + offset + roundness},${startY} ${startX + offset + roundness},${startY +
|
|
71
|
-
roundness * yMultiplier}
|
|
72
|
-
L ${startX + offset + roundness},${startY + (distanceY * yMultiplier) / 2 - roundness * yMultiplier}
|
|
73
|
-
Q ${startX + offset + roundness},${startY + (distanceY * yMultiplier) / 2} ${startX + offset},${startY +
|
|
74
|
-
(distanceY * yMultiplier) / 2}
|
|
75
|
-
L ${startX - offset + distanceX},${startY + (distanceY * yMultiplier) / 2}
|
|
76
|
-
Q ${startX - offset + distanceX - roundness},${startY + (distanceY * yMultiplier) / 2} ${startX -
|
|
77
|
-
offset +
|
|
78
|
-
distanceX -
|
|
79
|
-
roundness},${startY + (distanceY * yMultiplier) / 2 + roundness * yMultiplier}
|
|
80
|
-
L ${startX - offset + distanceX - roundness},${stopY - roundness * yMultiplier}
|
|
81
|
-
Q ${startX - offset + distanceX - roundness},${stopY} ${startX - offset + distanceX},${stopY}
|
|
82
|
-
L ${stopX},${stopY}`;
|
|
83
|
-
} else {
|
|
84
|
-
points += `L ${startX + distanceX / 2 - roundness},${startY}
|
|
85
|
-
Q ${startX + distanceX / 2},${startY} ${startX + distanceX / 2},${startY + roundness * yMultiplier}
|
|
86
|
-
L ${startX + distanceX / 2},${stopY - roundness * yMultiplier}
|
|
87
|
-
Q ${startX + distanceX / 2},${stopY} ${startX + distanceX / 2 + roundness},${stopY}
|
|
88
|
-
L ${stopX},${stopY}`;
|
|
89
|
-
}
|
|
90
|
-
return points;
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
computed: {
|
|
94
|
-
/**
|
|
95
|
-
* Get tasks which are dependent on other tasks
|
|
96
|
-
*
|
|
97
|
-
* @returns {array}
|
|
98
|
-
*/
|
|
99
|
-
dependencyTasks() {
|
|
100
|
-
return this.tasks
|
|
101
|
-
.filter(task => typeof task.dependentOn !== 'undefined')
|
|
102
|
-
.map(task => {
|
|
103
|
-
task.dependencyLines = task.dependentOn.map(id => {
|
|
104
|
-
return { points: this.getPoints(id, task.id), task_id: id };
|
|
105
|
-
});
|
|
106
|
-
return task;
|
|
107
|
-
})
|
|
108
|
-
.filter(task => task.dependencyLines.points !== null);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
</script>
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<template>
|
|
3
|
-
<svg
|
|
4
|
-
class="gantt-elastic__grid-lines-wrapper"
|
|
5
|
-
:style="{ ...root.style['grid-lines-wrapper'] }"
|
|
6
|
-
ref="chart"
|
|
7
|
-
x="0"
|
|
8
|
-
y="0"
|
|
9
|
-
:width="root.state.options.width"
|
|
10
|
-
:height="root.state.options.allVisibleTasksHeight"
|
|
11
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
12
|
-
>
|
|
13
|
-
<g class="gantt-elastic__grid-lines" :style="{ ...root.style['grid-lines'] }">
|
|
14
|
-
<line
|
|
15
|
-
class="gantt-elastic__grid-line-horizontal"
|
|
16
|
-
:style="{ ...root.style['grid-line-horizontal'] }"
|
|
17
|
-
v-for="line in horizontalLines"
|
|
18
|
-
:key="line.key"
|
|
19
|
-
:x1="line.x1"
|
|
20
|
-
:y1="line.y1"
|
|
21
|
-
:x2="line.x2"
|
|
22
|
-
:y2="line.y2"
|
|
23
|
-
></line>
|
|
24
|
-
<line
|
|
25
|
-
class="gantt-elastic__grid-line-vertical"
|
|
26
|
-
:style="{ ...root.style['grid-line-vertical'] }"
|
|
27
|
-
v-for="line in verticalLines"
|
|
28
|
-
:key="line.key"
|
|
29
|
-
:x1="line.x1"
|
|
30
|
-
:y1="line.y1"
|
|
31
|
-
:x2="line.x2"
|
|
32
|
-
:y2="line.y2"
|
|
33
|
-
></line>
|
|
34
|
-
<line
|
|
35
|
-
class="gantt-elastic__grid-line-time"
|
|
36
|
-
:style="{ ...root.style['grid-line-time'] }"
|
|
37
|
-
:x1="timeLinePosition.x"
|
|
38
|
-
:y1="timeLinePosition.y1"
|
|
39
|
-
:x2="timeLinePosition.x"
|
|
40
|
-
:y2="timeLinePosition.y2"
|
|
41
|
-
></line>
|
|
42
|
-
</g>
|
|
43
|
-
</svg>
|
|
44
|
-
</template>
|
|
45
|
-
|
|
46
|
-
<script>
|
|
47
|
-
export default {
|
|
48
|
-
name: 'Grid',
|
|
49
|
-
inject: ['root'],
|
|
50
|
-
data() {
|
|
51
|
-
return {};
|
|
52
|
-
},
|
|
53
|
-
/**
|
|
54
|
-
* Created
|
|
55
|
-
*/
|
|
56
|
-
created() {
|
|
57
|
-
this.root.$on('recenterPosition', this.recenterPosition);
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Mounted
|
|
62
|
-
*/
|
|
63
|
-
mounted() {
|
|
64
|
-
this.$nextTick(() => {
|
|
65
|
-
this.$nextTick(() => {
|
|
66
|
-
// because of stupid slider :/
|
|
67
|
-
this.root.scrollToTime(this.timeLinePosition.time);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
methods: {
|
|
73
|
-
/**
|
|
74
|
-
* Recenter position - go to current time line
|
|
75
|
-
*/
|
|
76
|
-
recenterPosition() {
|
|
77
|
-
this.root.scrollToTime(this.timeLinePosition.time);
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
computed: {
|
|
82
|
-
/**
|
|
83
|
-
* Generate vertical lines of the grid
|
|
84
|
-
*
|
|
85
|
-
* @returns {array}
|
|
86
|
-
*/
|
|
87
|
-
verticalLines() {
|
|
88
|
-
let lines = [];
|
|
89
|
-
const state = this.root.state;
|
|
90
|
-
state.options.times.steps.forEach(step => {
|
|
91
|
-
if (this.root.isInsideViewPort(step.offset.px, 1)) {
|
|
92
|
-
lines.push({
|
|
93
|
-
key: step.time,
|
|
94
|
-
x1: step.offset.px,
|
|
95
|
-
y1: 0,
|
|
96
|
-
x2: step.offset.px,
|
|
97
|
-
y2:
|
|
98
|
-
state.tasks.length * (state.options.row.height + state.options.chart.grid.horizontal.gap * 2) +
|
|
99
|
-
this.root.style['grid-line-vertical']['stroke-width']
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
return lines;
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Generate horizontal lines of the grid
|
|
108
|
-
*
|
|
109
|
-
* @returns {array}
|
|
110
|
-
*/
|
|
111
|
-
horizontalLines() {
|
|
112
|
-
let lines = [];
|
|
113
|
-
const state = this.root.state.options;
|
|
114
|
-
let tasks = this.root.visibleTasks;
|
|
115
|
-
for (let index = 0, len = tasks.length; index <= len; index++) {
|
|
116
|
-
const y =
|
|
117
|
-
index * (state.row.height + state.chart.grid.horizontal.gap * 2) +
|
|
118
|
-
this.root.style['grid-line-vertical']['stroke-width'] / 2;
|
|
119
|
-
lines.push({
|
|
120
|
-
key: 'hl' + index,
|
|
121
|
-
x1: 0,
|
|
122
|
-
y1: y,
|
|
123
|
-
x2: '100%',
|
|
124
|
-
y2: y
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
return lines;
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Check if specified line is inside viewport (visible)
|
|
132
|
-
*
|
|
133
|
-
* @returns {function}
|
|
134
|
-
*/
|
|
135
|
-
inViewPort() {
|
|
136
|
-
return line => {
|
|
137
|
-
const state = this.root.state.options;
|
|
138
|
-
return line.x1 >= state.scroll.chart.left && line.x1 <= state.scroll.chart.right;
|
|
139
|
-
};
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Get current time line position
|
|
144
|
-
*
|
|
145
|
-
* @returns {object}
|
|
146
|
-
*/
|
|
147
|
-
timeLinePosition() {
|
|
148
|
-
const d = new Date();
|
|
149
|
-
const current = d.getTime();
|
|
150
|
-
const currentOffset = this.root.timeToPixelOffsetX(current);
|
|
151
|
-
const timeLine = {
|
|
152
|
-
x: 0,
|
|
153
|
-
y1: 0,
|
|
154
|
-
y2: '100%',
|
|
155
|
-
dateTime: '',
|
|
156
|
-
time: current
|
|
157
|
-
};
|
|
158
|
-
timeLine.x = currentOffset;
|
|
159
|
-
timeLine.dateTime = d.toLocaleDateString();
|
|
160
|
-
return timeLine;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
</script>
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<template>
|
|
3
|
-
<g
|
|
4
|
-
class="gantt-elastic__chart-row-progress-bar-wrapper"
|
|
5
|
-
:style="{ ...root.style['chart-row-progress-bar-wrapper'], ...task.style['chart-row-progress-bar-wrapper'] }"
|
|
6
|
-
>
|
|
7
|
-
<defs>
|
|
8
|
-
<pattern
|
|
9
|
-
id="diagonalHatch"
|
|
10
|
-
:width="root.state.options.chart.progress.width"
|
|
11
|
-
:height="root.state.options.chart.progress.width"
|
|
12
|
-
patternTransform="rotate(45 0 0)"
|
|
13
|
-
patternUnits="userSpaceOnUse"
|
|
14
|
-
>
|
|
15
|
-
<line
|
|
16
|
-
class="chart-row-progress-bar-line"
|
|
17
|
-
:style="{ ...root.style['chart-row-progress-bar-line'], ...task.style['chart-row-progress-bar-line'] }"
|
|
18
|
-
x1="0"
|
|
19
|
-
y1="0"
|
|
20
|
-
x2="0"
|
|
21
|
-
:y2="root.state.options.chart.progress.width"
|
|
22
|
-
/>
|
|
23
|
-
</pattern>
|
|
24
|
-
</defs>
|
|
25
|
-
<rect
|
|
26
|
-
v-if="root.state.options.chart.progress.bar"
|
|
27
|
-
class="gantt-elastic__chart-row-progress-bar-solid"
|
|
28
|
-
:style="{ ...root.style['chart-row-progress-bar-solid'], ...task.style['chart-row-progress-bar-solid'] }"
|
|
29
|
-
x="0"
|
|
30
|
-
y="0"
|
|
31
|
-
:width="getProgressWidth"
|
|
32
|
-
></rect>
|
|
33
|
-
<g v-if="root.state.options.chart.progress.pattern">
|
|
34
|
-
<rect
|
|
35
|
-
class="gantt-elastic__chart-row-progress-bar-pattern"
|
|
36
|
-
:style="{ ...root.style['chart-row-progress-bar-pattern'], ...task.style['chart-row-progress-bar-pattern'] }"
|
|
37
|
-
:x="getProgressWidth"
|
|
38
|
-
y="0"
|
|
39
|
-
:width="100 - task.progress + '%'"
|
|
40
|
-
height="100%"
|
|
41
|
-
></rect>
|
|
42
|
-
<path
|
|
43
|
-
class="gantt-elastic__chart-row-progress-bar-outline"
|
|
44
|
-
:style="{
|
|
45
|
-
...root.style['chart-row-progress-bar-outline'],
|
|
46
|
-
...task.style['base'],
|
|
47
|
-
...task.style['chart-row-progress-bar-outline']
|
|
48
|
-
}"
|
|
49
|
-
:d="getLinePoints"
|
|
50
|
-
></path>
|
|
51
|
-
</g>
|
|
52
|
-
</g>
|
|
53
|
-
</template>
|
|
54
|
-
|
|
55
|
-
<script>
|
|
56
|
-
export default {
|
|
57
|
-
name: 'ProgressBar',
|
|
58
|
-
inject: ['root'],
|
|
59
|
-
props: ['task'],
|
|
60
|
-
data() {
|
|
61
|
-
return {};
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
computed: {
|
|
65
|
-
/**
|
|
66
|
-
* Get progress width
|
|
67
|
-
*
|
|
68
|
-
* @returns {string}
|
|
69
|
-
*/
|
|
70
|
-
getProgressWidth() {
|
|
71
|
-
return this.task.progress + '%';
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Get line points
|
|
76
|
-
*
|
|
77
|
-
* @returns {string}
|
|
78
|
-
*/
|
|
79
|
-
getLinePoints() {
|
|
80
|
-
const start = (this.task.width / 100) * this.task.progress;
|
|
81
|
-
return `M ${start} 0 L ${start} ${this.task.height}`;
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Get solid style
|
|
86
|
-
*
|
|
87
|
-
* @returns {object}
|
|
88
|
-
*/
|
|
89
|
-
getSolidStyle() {
|
|
90
|
-
return Object.assign({}, this.root.state.options.chart.progress.styles.bar.solid, this.task.progressBarStyle.bar);
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Get line style
|
|
95
|
-
*
|
|
96
|
-
* @returns {object}
|
|
97
|
-
*/
|
|
98
|
-
getLineStyle() {
|
|
99
|
-
return Object.assign(
|
|
100
|
-
{},
|
|
101
|
-
{
|
|
102
|
-
stroke: this.root.state.options.row.styles.bar.stroke + 'a0',
|
|
103
|
-
'stroke-width': this.root.state.options.row.styles.bar['stroke-width'] / 2
|
|
104
|
-
},
|
|
105
|
-
this.task.style
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
</script>
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<template>
|
|
3
|
-
<g
|
|
4
|
-
class="gantt-elastic__chart-row-bar-wrapper gantt-elastic__chart-row-milestone-wrapper"
|
|
5
|
-
:style="{
|
|
6
|
-
...root.style['chart-row-bar-wrapper'],
|
|
7
|
-
...root.style['chart-row-milestone-wrapper'],
|
|
8
|
-
...task.style['chart-row-bar-wrapper']
|
|
9
|
-
}"
|
|
10
|
-
>
|
|
11
|
-
<foreignObject
|
|
12
|
-
class="gantt-elastic__chart-expander gantt-elastic__chart-expander--milestone"
|
|
13
|
-
:style="{
|
|
14
|
-
...root.style['chart-expander'],
|
|
15
|
-
...root.style['chart-expander--milestone'],
|
|
16
|
-
...task.style['chart-expander']
|
|
17
|
-
}"
|
|
18
|
-
:x="task.x - root.state.options.chart.expander.offset - root.state.options.chart.expander.size"
|
|
19
|
-
:y="task.y + (root.state.options.row.height - root.state.options.chart.expander.size) / 2"
|
|
20
|
-
:width="root.state.options.chart.expander.size"
|
|
21
|
-
:height="root.state.options.chart.expander.size"
|
|
22
|
-
v-if="displayExpander"
|
|
23
|
-
>
|
|
24
|
-
<expander :tasks="[task]" :options="root.state.options.chart.expander" type="chart"></expander>
|
|
25
|
-
</foreignObject>
|
|
26
|
-
<svg
|
|
27
|
-
class="gantt-elastic__chart-row-bar gantt-elastic__chart-row-milestone"
|
|
28
|
-
:style="{ ...root.style['chart-row-bar'], ...root.style['chart-row-milestone'], ...task.style['chart-row-bar'] }"
|
|
29
|
-
:x="task.x"
|
|
30
|
-
:y="task.y"
|
|
31
|
-
:width="task.width"
|
|
32
|
-
:height="task.height"
|
|
33
|
-
:viewBox="`0 0 ${task.width} ${task.height}`"
|
|
34
|
-
@click="emitEvent('click', $event)"
|
|
35
|
-
@mouseenter="emitEvent('mouseenter', $event)"
|
|
36
|
-
@mouseover="emitEvent('mouseover', $event)"
|
|
37
|
-
@mouseout="emitEvent('mouseout', $event)"
|
|
38
|
-
@mousemove="emitEvent('mousemove', $event)"
|
|
39
|
-
@mousedown="emitEvent('mousedown', $event)"
|
|
40
|
-
@mouseup="emitEvent('mouseup', $event)"
|
|
41
|
-
@mousewheel="emitEvent('mousewheel', $event)"
|
|
42
|
-
@touchstart="emitEvent('touchstart', $event)"
|
|
43
|
-
@touchmove="emitEvent('touchmove', $event)"
|
|
44
|
-
@touchend="emitEvent('touchend', $event)"
|
|
45
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
46
|
-
>
|
|
47
|
-
<defs>
|
|
48
|
-
<clipPath :id="clipPathId">
|
|
49
|
-
<polygon :points="getPoints"></polygon>
|
|
50
|
-
</clipPath>
|
|
51
|
-
</defs>
|
|
52
|
-
<polygon
|
|
53
|
-
class="gantt-elastic__chart-row-bar-polygon gantt-elastic__chart-row-milestone-polygon"
|
|
54
|
-
:style="{
|
|
55
|
-
...root.style['chart-row-bar-polygon'],
|
|
56
|
-
...root.style['chart-row-milestone-polygon'],
|
|
57
|
-
...task.style['base'],
|
|
58
|
-
...task.style['chart-row-bar-polygon']
|
|
59
|
-
}"
|
|
60
|
-
:points="getPoints"
|
|
61
|
-
></polygon>
|
|
62
|
-
<progress-bar :task="task" :clip-path="'url(#' + clipPathId + ')'"></progress-bar>
|
|
63
|
-
</svg>
|
|
64
|
-
<chart-text :task="task" v-if="root.state.options.chart.text.display"></chart-text>
|
|
65
|
-
</g>
|
|
66
|
-
</template>
|
|
67
|
-
|
|
68
|
-
<script>
|
|
69
|
-
import ChartText from '../Text.vue';
|
|
70
|
-
import ProgressBar from '../ProgressBar.vue';
|
|
71
|
-
import Expander from '../../Expander.vue';
|
|
72
|
-
import taskMixin from './Task.mixin.js';
|
|
73
|
-
export default {
|
|
74
|
-
name: 'Milestone',
|
|
75
|
-
components: {
|
|
76
|
-
ChartText,
|
|
77
|
-
ProgressBar,
|
|
78
|
-
Expander
|
|
79
|
-
},
|
|
80
|
-
inject: ['root'],
|
|
81
|
-
props: ['task'],
|
|
82
|
-
mixins: [taskMixin],
|
|
83
|
-
data() {
|
|
84
|
-
return {};
|
|
85
|
-
},
|
|
86
|
-
computed: {
|
|
87
|
-
/**
|
|
88
|
-
* Get clip path id
|
|
89
|
-
*
|
|
90
|
-
* @returns {string}
|
|
91
|
-
*/
|
|
92
|
-
clipPathId() {
|
|
93
|
-
return 'gantt-elastic__milestone-clip-path-' + this.task.id;
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Get points
|
|
98
|
-
*
|
|
99
|
-
* @returns {string}
|
|
100
|
-
*/
|
|
101
|
-
getPoints() {
|
|
102
|
-
const task = this.task;
|
|
103
|
-
const fifty = task.height / 2;
|
|
104
|
-
let offset = fifty;
|
|
105
|
-
if (task.width / 2 - offset < 0) {
|
|
106
|
-
offset = task.width / 2;
|
|
107
|
-
}
|
|
108
|
-
return `0,${fifty}
|
|
109
|
-
${offset},0
|
|
110
|
-
${task.width - offset},0
|
|
111
|
-
${task.width},${fifty}
|
|
112
|
-
${task.width - offset},${task.height}
|
|
113
|
-
${offset},${task.height}`;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
</script>
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<template>
|
|
3
|
-
<g
|
|
4
|
-
class="gantt-elastic__chart-row-bar-wrapper gantt-elastic__chart-row-project-wrapper"
|
|
5
|
-
:style="{
|
|
6
|
-
...root.style['chart-row-bar-wrapper'],
|
|
7
|
-
...root.style['chart-row-project-wrapper'],
|
|
8
|
-
...task.style['chart-row-bar-wrapper']
|
|
9
|
-
}"
|
|
10
|
-
>
|
|
11
|
-
<foreignObject
|
|
12
|
-
class="gantt-elastic__chart-expander gantt-elastic__chart-expander--project"
|
|
13
|
-
:style="{
|
|
14
|
-
...root.style['chart-expander'],
|
|
15
|
-
...root.style['chart-expander--project'],
|
|
16
|
-
...task.style['chart-expander']
|
|
17
|
-
}"
|
|
18
|
-
:x="task.x - root.state.options.chart.expander.offset - root.state.options.chart.expander.size"
|
|
19
|
-
:y="task.y + (root.state.options.row.height - root.state.options.chart.expander.size) / 2"
|
|
20
|
-
:width="root.state.options.chart.expander.size"
|
|
21
|
-
:height="root.state.options.chart.expander.size"
|
|
22
|
-
v-if="displayExpander"
|
|
23
|
-
>
|
|
24
|
-
<expander :tasks="[task]" :options="root.state.options.chart.expander" type="chart"></expander>
|
|
25
|
-
</foreignObject>
|
|
26
|
-
<svg
|
|
27
|
-
class="gantt-elastic__chart-row-bar gantt-elastic__chart-row-project"
|
|
28
|
-
:style="{ ...root.style['chart-row-bar'], ...root.style['chart-row-project'], ...task.style['chart-row-bar'] }"
|
|
29
|
-
:x="task.x"
|
|
30
|
-
:y="task.y"
|
|
31
|
-
:width="task.width"
|
|
32
|
-
:height="task.height"
|
|
33
|
-
:viewBox="`0 0 ${task.width} ${task.height}`"
|
|
34
|
-
@click="emitEvent('click', $event)"
|
|
35
|
-
@mouseenter="emitEvent('mouseenter', $event)"
|
|
36
|
-
@mouseover="emitEvent('mouseover', $event)"
|
|
37
|
-
@mouseout="emitEvent('mouseout', $event)"
|
|
38
|
-
@mousemove="emitEvent('mousemove', $event)"
|
|
39
|
-
@mousedown="emitEvent('mousedown', $event)"
|
|
40
|
-
@mouseup="emitEvent('mouseup', $event)"
|
|
41
|
-
@mousewheel="emitEvent('mousewheel', $event)"
|
|
42
|
-
@touchstart="emitEvent('touchstart', $event)"
|
|
43
|
-
@touchmove="emitEvent('touchmove', $event)"
|
|
44
|
-
@touchend="emitEvent('touchend', $event)"
|
|
45
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
46
|
-
>
|
|
47
|
-
<defs>
|
|
48
|
-
<clipPath :id="clipPathId">
|
|
49
|
-
<path :d="getPoints"></path>
|
|
50
|
-
</clipPath>
|
|
51
|
-
</defs>
|
|
52
|
-
<path
|
|
53
|
-
class="gantt-elastic__chart-row-bar-polygon gantt-elastic__chart-row-project-polygon"
|
|
54
|
-
:style="{
|
|
55
|
-
...root.style['chart-row-bar-polygon'],
|
|
56
|
-
...root.style['chart-row-project-polygon'],
|
|
57
|
-
...task.style['base'],
|
|
58
|
-
...task.style['chart-row-bar-polygon']
|
|
59
|
-
}"
|
|
60
|
-
:d="getPoints"
|
|
61
|
-
></path>
|
|
62
|
-
<progress-bar :task="task" :clip-path="'url(#' + clipPathId + ')'"></progress-bar>
|
|
63
|
-
</svg>
|
|
64
|
-
<chart-text :task="task" v-if="root.state.options.chart.text.display"></chart-text>
|
|
65
|
-
</g>
|
|
66
|
-
</template>
|
|
67
|
-
|
|
68
|
-
<script>
|
|
69
|
-
import ChartText from '../Text.vue';
|
|
70
|
-
import ProgressBar from '../ProgressBar.vue';
|
|
71
|
-
import Expander from '../../Expander.vue';
|
|
72
|
-
import taskMixin from './Task.mixin.js';
|
|
73
|
-
export default {
|
|
74
|
-
name: 'Project',
|
|
75
|
-
components: {
|
|
76
|
-
ChartText,
|
|
77
|
-
ProgressBar,
|
|
78
|
-
Expander
|
|
79
|
-
},
|
|
80
|
-
inject: ['root'],
|
|
81
|
-
props: ['task'],
|
|
82
|
-
mixins: [taskMixin],
|
|
83
|
-
data() {
|
|
84
|
-
return {};
|
|
85
|
-
},
|
|
86
|
-
computed: {
|
|
87
|
-
/**
|
|
88
|
-
* Get clip path id
|
|
89
|
-
*
|
|
90
|
-
* @returns {string}
|
|
91
|
-
*/
|
|
92
|
-
clipPathId() {
|
|
93
|
-
return 'gantt-elastic__project-clip-path-' + this.task.id;
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Get points
|
|
98
|
-
*
|
|
99
|
-
* @returns {string}
|
|
100
|
-
*/
|
|
101
|
-
getPoints() {
|
|
102
|
-
const task = this.task;
|
|
103
|
-
const bottom = task.height - task.height / 4;
|
|
104
|
-
const corner = task.height / 6;
|
|
105
|
-
const smallCorner = task.height / 8;
|
|
106
|
-
return `M ${smallCorner},0
|
|
107
|
-
L ${task.width - smallCorner} 0
|
|
108
|
-
L ${task.width} ${smallCorner}
|
|
109
|
-
L ${task.width} ${bottom}
|
|
110
|
-
L ${task.width - corner} ${task.height}
|
|
111
|
-
L ${task.width - corner * 2} ${bottom}
|
|
112
|
-
L ${corner * 2} ${bottom}
|
|
113
|
-
L ${corner} ${task.height}
|
|
114
|
-
L 0 ${bottom}
|
|
115
|
-
L 0 ${smallCorner}
|
|
116
|
-
Z
|
|
117
|
-
`;
|
|
118
|
-
},
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Should we display expander?
|
|
122
|
-
*
|
|
123
|
-
* @returns {boolean}
|
|
124
|
-
*/
|
|
125
|
-
displayExpander() {
|
|
126
|
-
const expander = this.root.state.options.chart.expander;
|
|
127
|
-
return expander.display || (expander.displayIfTaskListHidden && !this.root.state.options.taskList.display);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
</script>
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export default {
|
|
3
|
-
computed: {
|
|
4
|
-
/**
|
|
5
|
-
* Get view box
|
|
6
|
-
*
|
|
7
|
-
* @returns {string}
|
|
8
|
-
*/
|
|
9
|
-
getViewBox() {
|
|
10
|
-
const task = this.task;
|
|
11
|
-
return `0 0 ${task.width} ${task.height}`;
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Get group transform
|
|
16
|
-
*
|
|
17
|
-
* @returns {string}
|
|
18
|
-
*/
|
|
19
|
-
getGroupTransform() {
|
|
20
|
-
return `translate(${this.task.x} ${this.task.y})`;
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Should we display expander?
|
|
25
|
-
*
|
|
26
|
-
* @returns {boolean}
|
|
27
|
-
*/
|
|
28
|
-
displayExpander() {
|
|
29
|
-
const expander = this.root.state.options.chart.expander;
|
|
30
|
-
return expander.display || (expander.displayIfTaskListHidden && !this.root.state.options.taskList.display);
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
methods: {
|
|
34
|
-
/**
|
|
35
|
-
* Emit event
|
|
36
|
-
*
|
|
37
|
-
* @param {string} eventName
|
|
38
|
-
* @param {Event} event
|
|
39
|
-
*/
|
|
40
|
-
emitEvent(eventName, event) {
|
|
41
|
-
if (!this.root.state.options.scroll.scrolling) {
|
|
42
|
-
this.root.$emit(`chart-${this.task.type}-${eventName}`, { event, data: this.task });
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
};
|