tg-ganttchart 0.0.5 → 0.0.7
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 +9232 -0
- package/dist/tgganttchart.common.js.map +1 -0
- package/dist/tgganttchart.css +1 -0
- package/dist/tgganttchart.umd.js +9243 -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,282 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<template>
|
|
3
|
-
<div class="gantt-elastic__main-view" :style="{ ...root.style['main-view'] }">
|
|
4
|
-
<div
|
|
5
|
-
class="gantt-elastic__main-container-wrapper"
|
|
6
|
-
:style="{ ...root.style['main-container-wrapper'], height: root.state.options.height + 'px' }"
|
|
7
|
-
>
|
|
8
|
-
<div
|
|
9
|
-
class="gantt-elastic__main-container"
|
|
10
|
-
:style="{
|
|
11
|
-
...root.style['main-container'],
|
|
12
|
-
width: root.state.options.clientWidth + 'px',
|
|
13
|
-
height: root.state.options.height + 'px'
|
|
14
|
-
}"
|
|
15
|
-
ref="mainView"
|
|
16
|
-
>
|
|
17
|
-
<div
|
|
18
|
-
class="gantt-elastic__container"
|
|
19
|
-
:style="{ ...root.style['container'] }"
|
|
20
|
-
@mousemove="mouseMove"
|
|
21
|
-
@mouseup="mouseUp"
|
|
22
|
-
>
|
|
23
|
-
<div
|
|
24
|
-
ref="taskList"
|
|
25
|
-
class="gantt-elastic__task-list-container"
|
|
26
|
-
:style="{
|
|
27
|
-
...root.style['task-list-container'],
|
|
28
|
-
width: root.state.options.taskList.finalWidth + 'px',
|
|
29
|
-
height: root.state.options.height + 'px'
|
|
30
|
-
}"
|
|
31
|
-
v-show="root.state.options.taskList.display"
|
|
32
|
-
>
|
|
33
|
-
<task-list></task-list>
|
|
34
|
-
</div>
|
|
35
|
-
<div
|
|
36
|
-
class="gantt-elastic__main-view-container"
|
|
37
|
-
:style="{ ...root.style['main-view-container'] }"
|
|
38
|
-
ref="chartContainer"
|
|
39
|
-
@mousedown="chartMouseDown"
|
|
40
|
-
@touchstart="chartMouseDown"
|
|
41
|
-
@mouseup="chartMouseUp"
|
|
42
|
-
@touchend="chartMouseUp"
|
|
43
|
-
@mousemove.prevent="chartMouseMove"
|
|
44
|
-
@touchmove.prevent="chartMouseMove"
|
|
45
|
-
@wheel.prevent="chartWheel"
|
|
46
|
-
>
|
|
47
|
-
<chart></chart>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
<div
|
|
52
|
-
class="gantt-elastic__chart-scroll-container gantt-elastic__chart-scroll-container--vertical"
|
|
53
|
-
:style="{
|
|
54
|
-
...root.style['chart-scroll-container'],
|
|
55
|
-
...root.style['chart-scroll-container--vertical'],
|
|
56
|
-
...verticalStyle
|
|
57
|
-
}"
|
|
58
|
-
ref="chartScrollContainerVertical"
|
|
59
|
-
@scroll="onVerticalScroll"
|
|
60
|
-
>
|
|
61
|
-
<div
|
|
62
|
-
class="gantt-elastic__chart-scroll--vertical"
|
|
63
|
-
:style="{ width: '1px', height: root.state.options.allVisibleTasksHeight + 'px' }"
|
|
64
|
-
></div>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
<div
|
|
68
|
-
class="gantt-elastic__chart-scroll-container gantt-elastic__chart-scroll-container--horizontal"
|
|
69
|
-
:style="{
|
|
70
|
-
...root.style['chart-scroll-container'],
|
|
71
|
-
...root.style['chart-scroll-container--horizontal'],
|
|
72
|
-
marginLeft: getMarginLeft
|
|
73
|
-
}"
|
|
74
|
-
@scroll="onHorizontalScroll"
|
|
75
|
-
ref="chartScrollContainerHorizontal"
|
|
76
|
-
>
|
|
77
|
-
<div
|
|
78
|
-
class="gantt-elastic__chart-scroll--horizontal"
|
|
79
|
-
:style="{ height: '1px', width: root.state.options.width + 'px' }"
|
|
80
|
-
></div>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
</template>
|
|
84
|
-
|
|
85
|
-
<script>
|
|
86
|
-
import TaskList from './TaskList/TaskList.vue';
|
|
87
|
-
import Chart from './Chart/Chart.vue';
|
|
88
|
-
|
|
89
|
-
let ignoreScrollEvents = false;
|
|
90
|
-
|
|
91
|
-
export default {
|
|
92
|
-
name: 'MainView',
|
|
93
|
-
components: {
|
|
94
|
-
TaskList,
|
|
95
|
-
Chart
|
|
96
|
-
},
|
|
97
|
-
inject: ['root'],
|
|
98
|
-
data() {
|
|
99
|
-
return {
|
|
100
|
-
defs: '',
|
|
101
|
-
mousePos: {
|
|
102
|
-
x: 0,
|
|
103
|
-
y: 0,
|
|
104
|
-
movementX: 0,
|
|
105
|
-
movementY: 0,
|
|
106
|
-
lastX: 0,
|
|
107
|
-
lastY: 0,
|
|
108
|
-
positiveX: 0,
|
|
109
|
-
positiveY: 0,
|
|
110
|
-
currentX: 0,
|
|
111
|
-
currentY: 0
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
},
|
|
115
|
-
/**
|
|
116
|
-
* Mounted
|
|
117
|
-
*/
|
|
118
|
-
mounted() {
|
|
119
|
-
this.viewBoxWidth = this.$el.clientWidth;
|
|
120
|
-
this.root.state.refs.mainView = this.$refs.mainView;
|
|
121
|
-
this.root.state.refs.chartContainer = this.$refs.chartContainer;
|
|
122
|
-
this.root.state.refs.taskList = this.$refs.taskList;
|
|
123
|
-
this.root.state.refs.chartScrollContainerHorizontal = this.$refs.chartScrollContainerHorizontal;
|
|
124
|
-
this.root.state.refs.chartScrollContainerVertical = this.$refs.chartScrollContainerVertical;
|
|
125
|
-
document.addEventListener('mouseup', this.chartMouseUp.bind(this));
|
|
126
|
-
document.addEventListener('mousemove', this.chartMouseMove.bind(this));
|
|
127
|
-
document.addEventListener('touchmove', this.chartMouseMove.bind(this));
|
|
128
|
-
document.addEventListener('touchend', this.chartMouseUp.bind(this));
|
|
129
|
-
},
|
|
130
|
-
computed: {
|
|
131
|
-
/**
|
|
132
|
-
* Get margin left
|
|
133
|
-
*
|
|
134
|
-
* @returns {string}
|
|
135
|
-
*/
|
|
136
|
-
getMarginLeft() {
|
|
137
|
-
if (!this.root.state.options.taskList.display) {
|
|
138
|
-
return '0px';
|
|
139
|
-
}
|
|
140
|
-
return this.root.state.options.taskList.finalWidth + 'px';
|
|
141
|
-
},
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Get vertical style
|
|
145
|
-
*
|
|
146
|
-
* @returns {object}
|
|
147
|
-
*/
|
|
148
|
-
verticalStyle() {
|
|
149
|
-
return {
|
|
150
|
-
width: this.root.state.options.scrollBarHeight + 'px',
|
|
151
|
-
height: this.root.state.options.rowsHeight + 'px',
|
|
152
|
-
'margin-top': this.root.state.options.calendar.height + this.root.state.options.calendar.gap + 'px'
|
|
153
|
-
};
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Get view box
|
|
158
|
-
*
|
|
159
|
-
* @returns {string}
|
|
160
|
-
*/
|
|
161
|
-
getViewBox() {
|
|
162
|
-
if (this.root.state.options.clientWidth) {
|
|
163
|
-
return `0 0 ${this.root.state.options.clientWidth - this.root.state.options.scrollBarHeight} ${
|
|
164
|
-
this.root.state.options.height
|
|
165
|
-
}`;
|
|
166
|
-
}
|
|
167
|
-
return `0 0 0 ${this.root.state.options.height}`;
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
methods: {
|
|
171
|
-
/**
|
|
172
|
-
* Emit event when mouse is moving inside main view
|
|
173
|
-
*/
|
|
174
|
-
mouseMove(event) {
|
|
175
|
-
this.root.$emit('main-view-mousemove', event);
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Emit mouseup event inside main view
|
|
180
|
-
*/
|
|
181
|
-
mouseUp(event) {
|
|
182
|
-
this.root.$emit('main-view-mouseup', event);
|
|
183
|
-
},
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Horizontal scroll event handler
|
|
187
|
-
*/
|
|
188
|
-
onHorizontalScroll(ev) {
|
|
189
|
-
this.root.$emit('chart-scroll-horizontal', ev);
|
|
190
|
-
},
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Vertical scroll event handler
|
|
194
|
-
*/
|
|
195
|
-
onVerticalScroll(ev) {
|
|
196
|
-
this.root.$emit('chart-scroll-vertical', ev);
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Mouse wheel event handler
|
|
201
|
-
*/
|
|
202
|
-
chartWheel(ev) {
|
|
203
|
-
this.root.$emit('chart-wheel', ev);
|
|
204
|
-
},
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Chart mousedown event handler
|
|
208
|
-
* Initiates drag scrolling mode
|
|
209
|
-
*/
|
|
210
|
-
chartMouseDown(ev) {
|
|
211
|
-
if (typeof ev.touches !== 'undefined') {
|
|
212
|
-
this.mousePos.x = this.mousePos.lastX = ev.touches[0].screenX;
|
|
213
|
-
this.mousePos.y = this.mousePos.lastY = ev.touches[0].screenY;
|
|
214
|
-
this.mousePos.movementX = 0;
|
|
215
|
-
this.mousePos.movementY = 0;
|
|
216
|
-
this.mousePos.currentX = this.$refs.chartScrollContainerHorizontal.scrollLeft;
|
|
217
|
-
this.mousePos.currentY = this.$refs.chartScrollContainerVertical.scrollTop;
|
|
218
|
-
}
|
|
219
|
-
this.root.state.options.scroll.scrolling = true;
|
|
220
|
-
},
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Chart mouseup event handler
|
|
224
|
-
* Deactivates drag scrolling mode
|
|
225
|
-
*/
|
|
226
|
-
chartMouseUp(ev) {
|
|
227
|
-
this.root.state.options.scroll.scrolling = false;
|
|
228
|
-
},
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Chart mousemove event handler
|
|
232
|
-
* When in drag scrolling mode this method calculate scroll movement
|
|
233
|
-
*/
|
|
234
|
-
chartMouseMove(ev) {
|
|
235
|
-
if (this.root.state.options.scroll.scrolling) {
|
|
236
|
-
ev.preventDefault();
|
|
237
|
-
ev.stopImmediatePropagation();
|
|
238
|
-
ev.stopPropagation();
|
|
239
|
-
const touch = typeof ev.touches !== 'undefined';
|
|
240
|
-
let movementX, movementY;
|
|
241
|
-
if (touch) {
|
|
242
|
-
const screenX = ev.touches[0].screenX;
|
|
243
|
-
const screenY = ev.touches[0].screenY;
|
|
244
|
-
movementX = this.mousePos.x - screenX;
|
|
245
|
-
movementY = this.mousePos.y - screenY;
|
|
246
|
-
this.mousePos.lastX = screenX;
|
|
247
|
-
this.mousePos.lastY = screenY;
|
|
248
|
-
} else {
|
|
249
|
-
movementX = ev.movementX;
|
|
250
|
-
movementY = ev.movementY;
|
|
251
|
-
}
|
|
252
|
-
const horizontal = this.$refs.chartScrollContainerHorizontal;
|
|
253
|
-
const vertical = this.$refs.chartScrollContainerVertical;
|
|
254
|
-
let x = 0,
|
|
255
|
-
y = 0;
|
|
256
|
-
if (touch) {
|
|
257
|
-
x = this.mousePos.currentX + movementX * this.root.state.options.scroll.dragXMoveMultiplier;
|
|
258
|
-
} else {
|
|
259
|
-
x = horizontal.scrollLeft - movementX * this.root.state.options.scroll.dragXMoveMultiplier;
|
|
260
|
-
}
|
|
261
|
-
horizontal.scrollLeft = x;
|
|
262
|
-
if (touch) {
|
|
263
|
-
y = this.mousePos.currentY + movementY * this.root.state.options.scroll.dragYMoveMultiplier;
|
|
264
|
-
} else {
|
|
265
|
-
y = vertical.scrollTop - movementY * this.root.state.options.scroll.dragYMoveMultiplier;
|
|
266
|
-
}
|
|
267
|
-
vertical.scrollTop = y;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Before destroy event - clean up
|
|
274
|
-
*/
|
|
275
|
-
// beforeDestroy() {
|
|
276
|
-
// document.removeEventListener('mouseup', this.chartMouseUp);
|
|
277
|
-
// document.removeEventListener('mousemove', this.chartMouseMove);
|
|
278
|
-
// document.removeEventListener('touchmove', this.chartMouseMove);
|
|
279
|
-
// document.removeEventListener('touchend', this.chartMouseUp);
|
|
280
|
-
// }
|
|
281
|
-
};
|
|
282
|
-
</script>
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="gantt-elastic__task-list-item-column" :style="itemColumnStyle">
|
|
3
|
-
<div class="gantt-elastic__task-list-item-value-wrapper" :style="wrapperStyle">
|
|
4
|
-
<slot></slot>
|
|
5
|
-
<div class="gantt-elastic__task-list-item-value-container" :style="containerStyle">
|
|
6
|
-
<div
|
|
7
|
-
v-if="!html"
|
|
8
|
-
class="gantt-elastic__task-list-item-value"
|
|
9
|
-
:style="valueStyle"
|
|
10
|
-
@click="emitEvent('click', $event)"
|
|
11
|
-
@mouseenter="emitEvent('mouseenter', $event)"
|
|
12
|
-
@mouseover="emitEvent('mouseover', $event)"
|
|
13
|
-
@mouseout="emitEvent('mouseout', $event)"
|
|
14
|
-
@mousemove="emitEvent('mousemove', $event)"
|
|
15
|
-
@mousedown="emitEvent('mousedown', $event)"
|
|
16
|
-
@mouseup="emitEvent('mouseup', $event)"
|
|
17
|
-
@mousewheel="emitEvent('mousewheel', $event)"
|
|
18
|
-
@touchstart="emitEvent('touchstart', $event)"
|
|
19
|
-
@touchmove="emitEvent('touchmove', $event)"
|
|
20
|
-
@touchend="emitEvent('touchend', $event)"
|
|
21
|
-
>
|
|
22
|
-
{{ value }}
|
|
23
|
-
</div>
|
|
24
|
-
<div
|
|
25
|
-
v-else
|
|
26
|
-
class="gantt-elastic__task-list-item-value"
|
|
27
|
-
:style="valueStyle"
|
|
28
|
-
@click="emitEvent('click', $event)"
|
|
29
|
-
@mouseenter="emitEvent('mouseenter', $event)"
|
|
30
|
-
@mouseover="emitEvent('mouseover', $event)"
|
|
31
|
-
@mouseout="emitEvent('mouseout', $event)"
|
|
32
|
-
@mousemove="emitEvent('mousemove', $event)"
|
|
33
|
-
@mousedown="emitEvent('mousedown', $event)"
|
|
34
|
-
@mouseup="emitEvent('mouseup', $event)"
|
|
35
|
-
@mousewheel="emitEvent('mousewheel', $event)"
|
|
36
|
-
@touchstart="emitEvent('touchstart', $event)"
|
|
37
|
-
@touchmove="emitEvent('touchmove', $event)"
|
|
38
|
-
@touchend="emitEvent('touchend', $event)"
|
|
39
|
-
v-html="value"
|
|
40
|
-
></div>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</template>
|
|
45
|
-
|
|
46
|
-
<script>
|
|
47
|
-
export default {
|
|
48
|
-
name: 'ItemColumn',
|
|
49
|
-
inject: ['root'],
|
|
50
|
-
props: ['column', 'task'],
|
|
51
|
-
data() {
|
|
52
|
-
return {};
|
|
53
|
-
},
|
|
54
|
-
methods: {
|
|
55
|
-
/**
|
|
56
|
-
* Emit event
|
|
57
|
-
*
|
|
58
|
-
* @param {String} eventName
|
|
59
|
-
* @param {Event} event
|
|
60
|
-
*/
|
|
61
|
-
emitEvent(eventName, event) {
|
|
62
|
-
if (typeof this.column.events !== 'undefined' && typeof this.column.events[eventName] === 'function') {
|
|
63
|
-
this.column.events[eventName]({ event, data: this.task, column: this.column });
|
|
64
|
-
}
|
|
65
|
-
this.root.$emit(`taskList-${this.task.type}-${eventName}`, { event, data: this.task, column: this.column });
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
computed: {
|
|
69
|
-
/**
|
|
70
|
-
* Should we display html or just text?
|
|
71
|
-
*
|
|
72
|
-
* @returns {boolean}
|
|
73
|
-
*/
|
|
74
|
-
html() {
|
|
75
|
-
if (typeof this.column.html !== 'undefined' && this.column.html === true) {
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
return false;
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Get column value
|
|
83
|
-
*
|
|
84
|
-
* @returns {any|string}
|
|
85
|
-
*/
|
|
86
|
-
value() {
|
|
87
|
-
if (typeof this.column.value === 'function') {
|
|
88
|
-
return this.column.value(this.task);
|
|
89
|
-
}
|
|
90
|
-
return this.task[this.column.value];
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
itemColumnStyle() {
|
|
94
|
-
return {
|
|
95
|
-
...this.root.style['task-list-item-column'],
|
|
96
|
-
...this.column.style['task-list-item-column'],
|
|
97
|
-
width: this.column.finalWidth + 'px',
|
|
98
|
-
height: this.column.height + 'px'
|
|
99
|
-
};
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
wrapperStyle() {
|
|
103
|
-
return {
|
|
104
|
-
...this.root.style['task-list-item-value-wrapper'],
|
|
105
|
-
...this.column.style['task-list-item-value-wrapper']
|
|
106
|
-
};
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
containerStyle() {
|
|
110
|
-
return {
|
|
111
|
-
...this.root.style['task-list-item-value-container'],
|
|
112
|
-
...this.column.style['task-list-item-value-container']
|
|
113
|
-
};
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
valueStyle() {
|
|
117
|
-
return { ...this.root.style['task-list-item-value'], ...this.column.style['task-list-item-value'] };
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
</script>
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<template>
|
|
3
|
-
<div
|
|
4
|
-
class="gantt-elastic__task-list-wrapper"
|
|
5
|
-
ref="taskListWrapper"
|
|
6
|
-
:style="{ ...root.style['task-list-wrapper'], width: '100%', height: '100%' }"
|
|
7
|
-
v-show="root.state.options.taskList.display"
|
|
8
|
-
>
|
|
9
|
-
<div class="gantt-elastic__task-list" :style="{ ...root.style['task-list'] }" ref="taskList">
|
|
10
|
-
<task-list-header></task-list-header>
|
|
11
|
-
<div
|
|
12
|
-
class="gantt-elastic__task-list-items"
|
|
13
|
-
ref="taskListItems"
|
|
14
|
-
:style="{ ...root.style['task-list-items'], height: root.state.options.rowsHeight + 'px' }"
|
|
15
|
-
>
|
|
16
|
-
<task-list-item v-for="task in root.visibleTasks" :key="task.id" :task="task"></task-list-item>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script>
|
|
23
|
-
import TaskListHeader from './TaskListHeader.vue';
|
|
24
|
-
import TaskListItem from './TaskListItem.vue';
|
|
25
|
-
export default {
|
|
26
|
-
name: 'TaskList',
|
|
27
|
-
components: {
|
|
28
|
-
TaskListHeader,
|
|
29
|
-
TaskListItem
|
|
30
|
-
},
|
|
31
|
-
inject: ['root'],
|
|
32
|
-
data() {
|
|
33
|
-
return {};
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Mounted
|
|
38
|
-
*/
|
|
39
|
-
mounted() {
|
|
40
|
-
this.root.state.refs.taskListWrapper = this.$refs.taskListWrapper;
|
|
41
|
-
this.root.state.refs.taskList = this.$refs.taskList;
|
|
42
|
-
this.root.state.refs.taskListItems = this.$refs.taskListItems;
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
</script>
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="gantt-elastic__task-list-header"
|
|
4
|
-
:style="headerStyle"
|
|
5
|
-
>
|
|
6
|
-
<div
|
|
7
|
-
class="gantt-elastic__task-list-header-column"
|
|
8
|
-
v-for="column in root.getTaskListColumns"
|
|
9
|
-
:key="column._id"
|
|
10
|
-
:style="columnStyle(column)"
|
|
11
|
-
>
|
|
12
|
-
<task-list-expander
|
|
13
|
-
v-if="column.expander"
|
|
14
|
-
:tasks="collapsible"
|
|
15
|
-
:options="root.state.options.taskList.expander"
|
|
16
|
-
></task-list-expander>
|
|
17
|
-
<div
|
|
18
|
-
class="gantt-elastic__task-list-header-label"
|
|
19
|
-
:style="headerLabelStyle(column)"
|
|
20
|
-
:column="column"
|
|
21
|
-
@mouseup="resizerMouseUp"
|
|
22
|
-
>
|
|
23
|
-
{{ column.label }}
|
|
24
|
-
</div>
|
|
25
|
-
<div
|
|
26
|
-
class="gantt-elastic__task-list-header-resizer-wrapper"
|
|
27
|
-
:style="resizerWrapperStyle(column)"
|
|
28
|
-
:column="column"
|
|
29
|
-
@mousedown="resizerMouseDown($event, column)"
|
|
30
|
-
>
|
|
31
|
-
<div class="gantt-elastic__task-list-header-resizer" :style="resizerStyle(column)">
|
|
32
|
-
<div
|
|
33
|
-
class="gantt-elastic__task-list-header-resizer-dot"
|
|
34
|
-
v-for="dot in 3"
|
|
35
|
-
:key="dot"
|
|
36
|
-
:style="resizerDotStyle(column)"
|
|
37
|
-
></div>
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
</template>
|
|
43
|
-
|
|
44
|
-
<script>
|
|
45
|
-
import TaskListExpander from '../Expander.vue';
|
|
46
|
-
|
|
47
|
-
export default {
|
|
48
|
-
name: 'TaskListHeader',
|
|
49
|
-
components: {
|
|
50
|
-
TaskListExpander
|
|
51
|
-
},
|
|
52
|
-
inject: ['root'],
|
|
53
|
-
data() {
|
|
54
|
-
return {
|
|
55
|
-
resizer: {
|
|
56
|
-
moving: false,
|
|
57
|
-
x: 0
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
},
|
|
61
|
-
computed: {
|
|
62
|
-
collapsible() {
|
|
63
|
-
return this.root.state.tasks.filter(task => task.allChildren.length > 0);
|
|
64
|
-
},
|
|
65
|
-
headerStyle() {
|
|
66
|
-
return {
|
|
67
|
-
...this.root.style['task-list-header'],
|
|
68
|
-
height: `${this.root.state.options.calendar.height}px`,
|
|
69
|
-
marginBottom: `${this.root.state.options.calendar.gap}px`
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
methods: {
|
|
74
|
-
columnStyle(column) {
|
|
75
|
-
return {
|
|
76
|
-
...this.root.style['task-list-header-column'],
|
|
77
|
-
...column.style['task-list-header-column'],
|
|
78
|
-
width: `${column.finalWidth}px`
|
|
79
|
-
};
|
|
80
|
-
},
|
|
81
|
-
headerLabelStyle(column) {
|
|
82
|
-
return {
|
|
83
|
-
...this.root.style['task-list-header-label'],
|
|
84
|
-
...column.style['task-list-header-label']
|
|
85
|
-
};
|
|
86
|
-
},
|
|
87
|
-
resizerWrapperStyle(column) {
|
|
88
|
-
return {
|
|
89
|
-
...this.root.style['task-list-header-resizer-wrapper'],
|
|
90
|
-
...column.style['task-list-header-resizer-wrapper']
|
|
91
|
-
};
|
|
92
|
-
},
|
|
93
|
-
resizerStyle(column) {
|
|
94
|
-
return {
|
|
95
|
-
...this.root.style['task-list-header-resizer'],
|
|
96
|
-
...column.style['task-list-header-resizer']
|
|
97
|
-
};
|
|
98
|
-
},
|
|
99
|
-
resizerDotStyle(column) {
|
|
100
|
-
return {
|
|
101
|
-
...this.root.style['task-list-header-resizer-dot'],
|
|
102
|
-
...column.style['task-list-header-resizer-dot']
|
|
103
|
-
};
|
|
104
|
-
},
|
|
105
|
-
resizerMouseDown(event, column) {
|
|
106
|
-
if (!this.resizer.moving) {
|
|
107
|
-
this.resizer.moving = column;
|
|
108
|
-
this.resizer.x = event.clientX;
|
|
109
|
-
this.resizer.initialWidth = column.width;
|
|
110
|
-
this.root.$emit('taskList-column-width-change-start', this.resizer.moving);
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
resizerMouseMove(event) {
|
|
114
|
-
if (this.resizer.moving) {
|
|
115
|
-
const lastWidth = this.resizer.moving.width;
|
|
116
|
-
this.resizer.moving.width = this.resizer.initialWidth + event.clientX - this.resizer.x;
|
|
117
|
-
if (this.resizer.moving.width < this.root.state.options.taskList.minWidth) {
|
|
118
|
-
this.resizer.moving.width = this.root.state.options.taskList.minWidth;
|
|
119
|
-
}
|
|
120
|
-
if (lastWidth !== this.resizer.moving.width) {
|
|
121
|
-
this.root.$emit('taskList-column-width-change', this.resizer.moving);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
resizerMouseUp() {
|
|
126
|
-
if (this.resizer.moving) {
|
|
127
|
-
this.root.$emit('taskList-column-width-change-stop', this.resizer.moving);
|
|
128
|
-
this.resizer.moving = false;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
created() {
|
|
133
|
-
document.addEventListener('mouseup', this.resizerMouseUp);
|
|
134
|
-
document.addEventListener('mousemove', this.resizerMouseMove);
|
|
135
|
-
this.root.$on('main-view-mousemove', this.resizerMouseMove);
|
|
136
|
-
this.root.$on('main-view-mouseup', this.resizerMouseUp);
|
|
137
|
-
},
|
|
138
|
-
// beforeDestroy() {
|
|
139
|
-
// document.removeEventListener('mouseup', this.resizerMouseUp);
|
|
140
|
-
// document.removeEventListener('mousemove', this.resizerMouseMove);
|
|
141
|
-
// }
|
|
142
|
-
};
|
|
143
|
-
</script>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<template>
|
|
3
|
-
<div class="gantt-elastic__task-list-item" :style="{ ...root.style['task-list-item'] }">
|
|
4
|
-
<item-column v-for="column in columns" :key="column._id" :column="column" :task="task">
|
|
5
|
-
<task-list-expander
|
|
6
|
-
v-if="column.expander"
|
|
7
|
-
:tasks="[task]"
|
|
8
|
-
:options="root.state.options.taskList.expander"
|
|
9
|
-
type="taskList"
|
|
10
|
-
></task-list-expander>
|
|
11
|
-
</item-column>
|
|
12
|
-
</div>
|
|
13
|
-
</template>
|
|
14
|
-
<script>
|
|
15
|
-
import TaskListExpander from '../Expander.vue';
|
|
16
|
-
import ItemColumn from './ItemColumn.vue';
|
|
17
|
-
|
|
18
|
-
export default {
|
|
19
|
-
name: 'TaskListItem',
|
|
20
|
-
components: {
|
|
21
|
-
TaskListExpander,
|
|
22
|
-
ItemColumn
|
|
23
|
-
},
|
|
24
|
-
inject: ['root'],
|
|
25
|
-
props: ['task'],
|
|
26
|
-
data() {
|
|
27
|
-
return {};
|
|
28
|
-
},
|
|
29
|
-
computed: {
|
|
30
|
-
columns() {
|
|
31
|
-
return this.root.state.options.taskList.columns;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
</script>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import Vue from 'vue';
|
|
3
|
-
import { mergeDeep } from '../GanttElastic.vue';
|
|
4
|
-
import GanttElasticStandalone from '../GanttElastic.standalone.vue';
|
|
5
|
-
|
|
6
|
-
window.GanttElastic = {
|
|
7
|
-
component: GanttElasticStandalone,
|
|
8
|
-
mount(config) {
|
|
9
|
-
const ready = typeof config.ready === 'function' ? config.ready : () => { };
|
|
10
|
-
const cfg = mergeDeep({}, config);
|
|
11
|
-
if (typeof cfg.dynamicStyle === 'undefined') {
|
|
12
|
-
cfg.dynamicStyle = {};
|
|
13
|
-
}
|
|
14
|
-
const ganttElastic = { ...GanttElasticStandalone };
|
|
15
|
-
for (let prop in cfg) {
|
|
16
|
-
if (['el', 'ready'].includes(prop)) {
|
|
17
|
-
continue;
|
|
18
|
-
}
|
|
19
|
-
if (typeof ganttElastic[prop] !== 'undefined') {
|
|
20
|
-
ganttElastic[prop] = { ...ganttElastic[prop], ...cfg[prop] };
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
ganttElastic[prop] = cfg[prop];
|
|
24
|
-
}
|
|
25
|
-
return new Vue(ganttElastic).$on('gantt-elastic-ready', ready).$mount(cfg.el);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
export default GanttElasticStandalone;
|