tg-ganttchart 0.0.7 → 0.0.8

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 (66) hide show
  1. package/babel.config.js +5 -0
  2. package/package.json +1 -4
  3. package/src/.eslintrc.js +18 -0
  4. package/src/App.vue +780 -0
  5. package/src/GanttElastic.standalone.vue +48 -0
  6. package/src/GanttElastic.vue +2305 -0
  7. package/src/assets/logo.png +0 -0
  8. package/src/components/Calendar/Calendar.vue +559 -0
  9. package/src/components/Calendar/CalendarRow.vue +112 -0
  10. package/src/components/Chart/Chart.vue +117 -0
  11. package/src/components/Chart/DaysHighlight.vue +60 -0
  12. package/src/components/Chart/DependencyLines.vue +112 -0
  13. package/src/components/Chart/Grid.vue +205 -0
  14. package/src/components/Chart/ProgressBar.vue +110 -0
  15. package/src/components/Chart/Row/Epic.vue +131 -0
  16. package/src/components/Chart/Row/Milestone.vue +117 -0
  17. package/src/components/Chart/Row/Project.vue +132 -0
  18. package/src/components/Chart/Row/Story.vue +127 -0
  19. package/src/components/Chart/Row/Subtask.vue +117 -0
  20. package/src/components/Chart/Row/Task.mixin.js +47 -0
  21. package/src/components/Chart/Row/Task.vue +82 -0
  22. package/src/components/Chart/Text.vue +105 -0
  23. package/src/components/Expander.vue +114 -0
  24. package/src/components/GanttElastic.standalone.vue +48 -0
  25. package/src/components/GanttElastic.vue +1646 -0
  26. package/src/components/Header/GanttViewFilter.vue +154 -0
  27. package/src/components/Header/Header.vue +266 -0
  28. package/src/components/MainView.vue +283 -0
  29. package/src/components/TaskList/ItemColumn.vue +212 -0
  30. package/src/components/TaskList/TaskList.vue +45 -0
  31. package/src/components/TaskList/TaskListHeader.vue +143 -0
  32. package/src/components/TaskList/TaskListItem.vue +35 -0
  33. package/src/components/bundle.js +28 -0
  34. package/src/components/components/Calendar/Calendar.vue +332 -0
  35. package/src/components/components/Calendar/CalendarRow.vue +96 -0
  36. package/src/components/components/Chart/Chart.vue +111 -0
  37. package/src/components/components/Chart/DaysHighlight.vue +71 -0
  38. package/src/components/components/Chart/DependencyLines.vue +112 -0
  39. package/src/components/components/Chart/Grid.vue +164 -0
  40. package/src/components/components/Chart/ProgressBar.vue +110 -0
  41. package/src/components/components/Chart/Row/Milestone.vue +117 -0
  42. package/src/components/components/Chart/Row/Project.vue +131 -0
  43. package/src/components/components/Chart/Row/Task.mixin.js +46 -0
  44. package/src/components/components/Chart/Row/Task.vue +107 -0
  45. package/src/components/components/Chart/Text.vue +105 -0
  46. package/src/components/components/Expander.vue +126 -0
  47. package/src/components/components/Header/Header.vue +265 -0
  48. package/src/components/components/MainView.vue +282 -0
  49. package/src/components/components/TaskList/ItemColumn.vue +121 -0
  50. package/src/components/components/TaskList/TaskList.vue +45 -0
  51. package/src/components/components/TaskList/TaskListHeader.vue +143 -0
  52. package/src/components/components/TaskList/TaskListItem.vue +35 -0
  53. package/src/components/components/bundle.js +28 -0
  54. package/src/components/style.js +308 -0
  55. package/src/index.js +12 -0
  56. package/src/main.js +6 -0
  57. package/src/style.js +398 -0
  58. package/vue.config.js +42 -0
  59. package/dist/demo.html +0 -1
  60. package/dist/tgganttchart.common.js +0 -9232
  61. package/dist/tgganttchart.common.js.map +0 -1
  62. package/dist/tgganttchart.css +0 -1
  63. package/dist/tgganttchart.umd.js +0 -9243
  64. package/dist/tgganttchart.umd.js.map +0 -1
  65. package/dist/tgganttchart.umd.min.js +0 -7
  66. package/dist/tgganttchart.umd.min.js.map +0 -1
@@ -0,0 +1,131 @@
1
+ <template>
2
+ <g
3
+ class="gantt-elastic__chart-row-bar-wrapper gantt-elastic__chart-row-epic-wrapper"
4
+ :style="{
5
+ ...root.style['chart-row-bar-wrapper'],
6
+ ...root.style['chart-row-epic-wrapper'],
7
+ ...task.style['chart-row-bar-wrapper']
8
+ }"
9
+ >
10
+ <foreignObject
11
+ class="gantt-elastic__chart-expander gantt-elastic__chart-expander--epic"
12
+ :style="{
13
+ ...root.style['chart-expander'],
14
+ ...root.style['chart-expander--epic'],
15
+ ...task.style['chart-expander']
16
+ }"
17
+ :x="task.x - root.state.options.chart.expander.offset - root.state.options.chart.expander.size"
18
+ :y="task.y + (root.state.options.row.height - root.state.options.chart.expander.size) / 2"
19
+ :width="root.state.options.chart.expander.size"
20
+ :height="root.state.options.chart.expander.size"
21
+ v-if="displayExpander"
22
+ >
23
+ <expander :tasks="[task]" :options="root.state.options.chart.expander" type="chart"></expander>
24
+ </foreignObject>
25
+ <svg
26
+ class="gantt-elastic__chart-row-bar gantt-elastic__chart-row-epic"
27
+ :style="{ ...root.style['chart-row-bar'], ...root.style['chart-row-epic'], ...task.style['chart-row-bar'] }"
28
+ :x="task.x"
29
+ :y="task.y"
30
+ :width="task.width"
31
+ :height="task.height"
32
+ :viewBox="`0 0 ${task.width} ${task.height}`"
33
+ @click="emitEvent('click', $event)"
34
+ @mouseenter="emitEvent('mouseenter', $event)"
35
+ @mouseover="emitEvent('mouseover', $event)"
36
+ @mouseout="emitEvent('mouseout', $event)"
37
+ @mousemove="emitEvent('mousemove', $event)"
38
+ @mousedown="emitEvent('mousedown', $event)"
39
+ @mouseup="emitEvent('mouseup', $event)"
40
+ @mousewheel="emitEvent('mousewheel', $event)"
41
+ @touchstart="emitEvent('touchstart', $event)"
42
+ @touchmove="emitEvent('touchmove', $event)"
43
+ @touchend="emitEvent('touchend', $event)"
44
+ xmlns="http://www.w3.org/2000/svg"
45
+ >
46
+ <defs>
47
+ <clipPath :id="clipPathId">
48
+ <path :d="getPoints"></path>
49
+ </clipPath>
50
+ </defs>
51
+ <path
52
+ class="gantt-elastic__chart-row-bar-polygon gantt-elastic__chart-row-epic-polygon"
53
+ :style="{
54
+ ...root.style['chart-row-bar-polygon'],
55
+ ...root.style['chart-row-epic-polygon'],
56
+ ...task.style['base'],
57
+ ...task.style['chart-row-bar-polygon']
58
+ }"
59
+ :d="getPoints"
60
+ ></path>
61
+ <progress-bar :task="task" :clip-path="'url(#' + clipPathId + ')'"></progress-bar>
62
+ </svg>
63
+ <chart-text :task="task" v-if="root.state.options.chart.text.display"></chart-text>
64
+ </g>
65
+ </template>
66
+
67
+ <script>
68
+ import ChartText from '../Text.vue';
69
+ import ProgressBar from '../ProgressBar.vue';
70
+ import Expander from '../../Expander.vue';
71
+ import taskMixin from './Task.mixin.js';
72
+ export default {
73
+ name: 'Epic',
74
+ components: {
75
+ ChartText,
76
+ ProgressBar,
77
+ Expander
78
+ },
79
+ inject: ['root'],
80
+ props: ['task'],
81
+ mixins: [taskMixin],
82
+ data() {
83
+ return {};
84
+ },
85
+ computed: {
86
+ /**
87
+ * Get clip path id
88
+ *
89
+ * @returns {string}
90
+ */
91
+ clipPathId() {
92
+ return 'gantt-elastic__epic-clip-path-' + this.task.id;
93
+ },
94
+
95
+ /**
96
+ * Get points (same shape as project)
97
+ *
98
+ * @returns {string}
99
+ */
100
+ getPoints() {
101
+ const task = this.task;
102
+ const bottom = task.height - task.height / 4;
103
+ const corner = task.height / 6;
104
+ const smallCorner = task.height / 8;
105
+ return `M ${smallCorner},0
106
+ L ${task.width - smallCorner} 0
107
+ L ${task.width} ${smallCorner}
108
+ L ${task.width} ${bottom}
109
+ L ${task.width - corner} ${task.height}
110
+ L ${task.width - corner * 2} ${bottom}
111
+ L ${corner * 2} ${bottom}
112
+ L ${corner} ${task.height}
113
+ L 0 ${bottom}
114
+ L 0 ${smallCorner}
115
+ Z
116
+ `;
117
+ },
118
+
119
+ /**
120
+ * Should we display expander?
121
+ *
122
+ * @returns {boolean}
123
+ */
124
+ displayExpander() {
125
+ const expander = this.root.state.options.chart.expander;
126
+ const hasChildren = this.task.allChildren && this.task.allChildren.length > 0;
127
+ return (expander.display || (expander.displayIfTaskListHidden && !this.root.state.options.taskList.display)) && hasChildren;
128
+ }
129
+ }
130
+ };
131
+ </script>
@@ -0,0 +1,117 @@
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>
@@ -0,0 +1,132 @@
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
+ const hasChildren = this.task.allChildren && this.task.allChildren.length > 0;
128
+ return (expander.display || (expander.displayIfTaskListHidden && !this.root.state.options.taskList.display)) && hasChildren;
129
+ }
130
+ }
131
+ };
132
+ </script>
@@ -0,0 +1,127 @@
1
+ <template>
2
+ <g
3
+ class="gantt-elastic__chart-row-bar-wrapper gantt-elastic__chart-row-story-wrapper"
4
+ :style="{
5
+ ...root.style['chart-row-bar-wrapper'],
6
+ ...root.style['chart-row-story-wrapper'],
7
+ ...task.style['chart-row-bar-wrapper']
8
+ }"
9
+ >
10
+ <foreignObject
11
+ class="gantt-elastic__chart-expander gantt-elastic__chart-expander--story"
12
+ :style="{
13
+ ...root.style['chart-expander'],
14
+ ...root.style['chart-expander--story'],
15
+ ...task.style['chart-expander']
16
+ }"
17
+ :x="task.x - root.state.options.chart.expander.offset - root.state.options.chart.expander.size"
18
+ :y="task.y + (root.state.options.row.height - root.state.options.chart.expander.size) / 2"
19
+ :width="root.state.options.chart.expander.size"
20
+ :height="root.state.options.chart.expander.size"
21
+ v-if="displayExpander"
22
+ >
23
+ <expander :tasks="[task]" :options="root.state.options.chart.expander" type="chart"></expander>
24
+ </foreignObject>
25
+ <svg
26
+ class="gantt-elastic__chart-row-bar gantt-elastic__chart-row-story"
27
+ :style="{ ...root.style['chart-row-bar'], ...root.style['chart-row-story'], ...task.style['chart-row-bar'] }"
28
+ :x="task.x"
29
+ :y="task.y"
30
+ :width="task.width"
31
+ :height="task.height"
32
+ :viewBox="`0 0 ${task.width} ${task.height}`"
33
+ @click="emitEvent('click', $event)"
34
+ @mouseenter="emitEvent('mouseenter', $event)"
35
+ @mouseover="emitEvent('mouseover', $event)"
36
+ @mouseout="emitEvent('mouseout', $event)"
37
+ @mousemove="emitEvent('mousemove', $event)"
38
+ @mousedown="emitEvent('mousedown', $event)"
39
+ @mouseup="emitEvent('mouseup', $event)"
40
+ @mousewheel="emitEvent('mousewheel', $event)"
41
+ @touchstart="emitEvent('touchstart', $event)"
42
+ @touchmove="emitEvent('touchmove', $event)"
43
+ @touchend="emitEvent('touchend', $event)"
44
+ xmlns="http://www.w3.org/2000/svg"
45
+ >
46
+ <defs>
47
+ <clipPath :id="clipPathId">
48
+ <path :d="getPoints"></path>
49
+ </clipPath>
50
+ </defs>
51
+ <path
52
+ class="gantt-elastic__chart-row-bar-polygon gantt-elastic__chart-row-story-polygon"
53
+ :style="{
54
+ ...root.style['chart-row-bar-polygon'],
55
+ ...root.style['chart-row-story-polygon'],
56
+ ...task.style['base'],
57
+ ...task.style['chart-row-bar-polygon']
58
+ }"
59
+ :d="getPoints"
60
+ ></path>
61
+ <progress-bar :task="task" :clip-path="'url(#' + clipPathId + ')'"></progress-bar>
62
+ </svg>
63
+ <chart-text :task="task" v-if="root.state.options.chart.text.display"></chart-text>
64
+ </g>
65
+ </template>
66
+
67
+ <script>
68
+ import ChartText from '../Text.vue';
69
+ import ProgressBar from '../ProgressBar.vue';
70
+ import Expander from '../../Expander.vue';
71
+ import taskMixin from './Task.mixin.js';
72
+ export default {
73
+ name: 'Story',
74
+ components: {
75
+ ChartText,
76
+ ProgressBar,
77
+ Expander
78
+ },
79
+ inject: ['root'],
80
+ props: ['task'],
81
+ mixins: [taskMixin],
82
+ data() {
83
+ return {};
84
+ },
85
+ computed: {
86
+ /**
87
+ * Get clip path id
88
+ *
89
+ * @returns {string}
90
+ */
91
+ clipPathId() {
92
+ return 'gantt-elastic__story-clip-path-' + this.task.id;
93
+ },
94
+
95
+ /**
96
+ * Get points (rounded rectangle for stories)
97
+ *
98
+ * @returns {string}
99
+ */
100
+ getPoints() {
101
+ const task = this.task;
102
+ const corner = Math.min(task.height / 4, 8); // Rounded corners
103
+ return `M ${corner},0
104
+ L ${task.width - corner} 0
105
+ Q ${task.width} 0 ${task.width} ${corner}
106
+ L ${task.width} ${task.height - corner}
107
+ Q ${task.width} ${task.height} ${task.width - corner} ${task.height}
108
+ L ${corner} ${task.height}
109
+ Q 0 ${task.height} 0 ${task.height - corner}
110
+ L 0 ${corner}
111
+ Q 0 0 ${corner} 0
112
+ Z`;
113
+ },
114
+
115
+ /**
116
+ * Should we display expander?
117
+ *
118
+ * @returns {boolean}
119
+ */
120
+ displayExpander() {
121
+ const expander = this.root.state.options.chart.expander;
122
+ const hasChildren = this.task.allChildren && this.task.allChildren.length > 0;
123
+ return (expander.display || (expander.displayIfTaskListHidden && !this.root.state.options.taskList.display)) && hasChildren;
124
+ }
125
+ }
126
+ };
127
+ </script>
@@ -0,0 +1,117 @@
1
+ <template>
2
+ <g
3
+ class="gantt-elastic__chart-row-bar-wrapper gantt-elastic__chart-row-subtask-wrapper"
4
+ :style="{
5
+ ...root.style['chart-row-bar-wrapper'],
6
+ ...root.style['chart-row-subtask-wrapper'],
7
+ ...task.style['chart-row-bar-wrapper']
8
+ }"
9
+ >
10
+ <foreignObject
11
+ class="gantt-elastic__chart-expander gantt-elastic__chart-expander--subtask"
12
+ :style="{
13
+ ...root.style['chart-expander'],
14
+ ...root.style['chart-expander--subtask'],
15
+ ...task.style['chart-expander']
16
+ }"
17
+ :x="task.x - root.state.options.chart.expander.offset - root.state.options.chart.expander.size"
18
+ :y="task.y + (root.state.options.row.height - root.state.options.chart.expander.size) / 2"
19
+ :width="root.state.options.chart.expander.size"
20
+ :height="root.state.options.chart.expander.size"
21
+ v-if="displayExpander"
22
+ >
23
+ <expander :tasks="[task]" :options="root.state.options.chart.expander" type="chart"></expander>
24
+ </foreignObject>
25
+ <svg
26
+ class="gantt-elastic__chart-row-bar gantt-elastic__chart-row-subtask"
27
+ :style="{ ...root.style['chart-row-bar'], ...root.style['chart-row-subtask'], ...task.style['chart-row-bar'] }"
28
+ :x="task.x"
29
+ :y="task.y"
30
+ :width="task.width"
31
+ :height="task.height"
32
+ :viewBox="`0 0 ${task.width} ${task.height}`"
33
+ @click="emitEvent('click', $event)"
34
+ @mouseenter="emitEvent('mouseenter', $event)"
35
+ @mouseover="emitEvent('mouseover', $event)"
36
+ @mouseout="emitEvent('mouseout', $event)"
37
+ @mousemove="emitEvent('mousemove', $event)"
38
+ @mousedown="emitEvent('mousedown', $event)"
39
+ @mouseup="emitEvent('mouseup', $event)"
40
+ @mousewheel="emitEvent('mousewheel', $event)"
41
+ @touchstart="emitEvent('touchstart', $event)"
42
+ @touchmove="emitEvent('touchmove', $event)"
43
+ @touchend="emitEvent('touchend', $event)"
44
+ xmlns="http://www.w3.org/2000/svg"
45
+ >
46
+ <defs>
47
+ <clipPath :id="clipPathId">
48
+ <polygon :points="getPoints"></polygon>
49
+ </clipPath>
50
+ </defs>
51
+ <polygon
52
+ class="gantt-elastic__chart-row-bar-polygon gantt-elastic__chart-row-subtask-polygon"
53
+ :style="{
54
+ ...root.style['chart-row-bar-polygon'],
55
+ ...root.style['chart-row-subtask-polygon'],
56
+ ...task.style['base'],
57
+ ...task.style['chart-row-bar-polygon']
58
+ }"
59
+ :points="getPoints"
60
+ ></polygon>
61
+ <progress-bar :task="task" :clip-path="'url(#' + clipPathId + ')'"></progress-bar>
62
+ </svg>
63
+ <chart-text :task="task" v-if="root.state.options.chart.text.display"></chart-text>
64
+ </g>
65
+ </template>
66
+
67
+ <script>
68
+ import ChartText from '../Text.vue';
69
+ import ProgressBar from '../ProgressBar.vue';
70
+ import Expander from '../../Expander.vue';
71
+ import taskMixin from './Task.mixin.js';
72
+ export default {
73
+ name: 'Subtask',
74
+ components: {
75
+ ChartText,
76
+ ProgressBar,
77
+ Expander
78
+ },
79
+ inject: ['root'],
80
+ props: ['task'],
81
+ mixins: [taskMixin],
82
+ data() {
83
+ return {};
84
+ },
85
+ computed: {
86
+ /**
87
+ * Get clip path id
88
+ *
89
+ * @returns {string}
90
+ */
91
+ clipPathId() {
92
+ return 'gantt-elastic__subtask-clip-path-' + this.task.id;
93
+ },
94
+
95
+ /**
96
+ * Get points (simple rectangle for subtasks)
97
+ *
98
+ * @returns {string}
99
+ */
100
+ getPoints() {
101
+ const task = this.task;
102
+ return `0,0 ${task.width},0 ${task.width},${task.height} 0,${task.height}`;
103
+ },
104
+
105
+ /**
106
+ * Should we display expander?
107
+ *
108
+ * @returns {boolean}
109
+ */
110
+ displayExpander() {
111
+ const expander = this.root.state.options.chart.expander;
112
+ const hasChildren = this.task.allChildren && this.task.allChildren.length > 0;
113
+ return (expander.display || (expander.displayIfTaskListHidden && !this.root.state.options.taskList.display)) && hasChildren;
114
+ }
115
+ }
116
+ };
117
+ </script>
@@ -0,0 +1,47 @@
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
+ const hasChildren = this.task.allChildren && this.task.allChildren.length > 0;
31
+ return (expander.display || (expander.displayIfTaskListHidden && !this.root.state.options.taskList.display)) && hasChildren;
32
+ }
33
+ },
34
+ methods: {
35
+ /**
36
+ * Emit event
37
+ *
38
+ * @param {string} eventName
39
+ * @param {Event} event
40
+ */
41
+ emitEvent(eventName, event) {
42
+ if (!this.root.state.options.scroll.scrolling) {
43
+ this.root.$emit(`chart-${this.task.type}-${eventName}`, { event, data: this.task });
44
+ }
45
+ }
46
+ }
47
+ };