@dhtmlx/trial-vue-gantt 1.1.2 → 9.1.4
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.md +126 -262
- package/dist/dhtmlxgantt.vue.es.d.ts +352 -0
- package/dist/dhtmlxgantt.vue.es.js +18052 -0
- package/dist/vue-gantt.css +1 -0
- package/license.txt +43 -0
- package/package.json +55 -62
- package/whatsnew.md +1157 -0
- package/public/dist/gantt.js +0 -1
- package/src/components/Gantt.vue +0 -238
- package/src/components/TimeScale.vue +0 -57
- package/src/components/chart/Bars.vue +0 -470
- package/src/components/chart/CellGrid.vue +0 -22
- package/src/components/chart/Chart.vue +0 -236
- package/src/components/chart/Links.vue +0 -35
- package/src/components/chart/NewLink.vue +0 -39
- package/src/components/grid/Body.vue +0 -256
- package/src/components/grid/Grid.vue +0 -98
- package/src/components/grid/Header.vue +0 -104
- package/src/components/grid/actions/reorder.js +0 -193
- package/src/components/sidebar/Links.vue +0 -147
- package/src/components/sidebar/Sidebar.vue +0 -219
- package/src/locales/cn.js +0 -21
- package/src/locales/en.js +0 -21
- package/src/locales/ru.js +0 -21
- package/src/main.js +0 -46
- package/src/state/local.js +0 -48
- package/src/wx/Button.vue +0 -54
- package/src/wx/CNLocale.js +0 -15
- package/src/wx/Calendar.vue +0 -194
- package/src/wx/Counter.vue +0 -154
- package/src/wx/Datepicker.vue +0 -153
- package/src/wx/DefaultTheme.vue +0 -104
- package/src/wx/ENLocale.js +0 -15
- package/src/wx/IconButton.vue +0 -39
- package/src/wx/MaterialTheme.vue +0 -107
- package/src/wx/RULocale.js +0 -15
- package/src/wx/Select.vue +0 -75
- package/src/wx/Slider.vue +0 -150
- package/src/wx/Text.vue +0 -73
- package/src/wx/Textarea.vue +0 -63
- package/src/wx/Tooltip.vue +0 -110
- package/src/wx/index.js +0 -35
- package/src/wx/locale.js +0 -1
- package/src/wx/locales/cn.js +0 -39
- package/src/wx/locales/en.js +0 -39
- package/src/wx/locales/ru.js +0 -39
|
@@ -1,470 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="bars"
|
|
4
|
-
ref="layer"
|
|
5
|
-
:style="lineHeight"
|
|
6
|
-
@contextmenu="contextmenu"
|
|
7
|
-
@mousedown="mousedown"
|
|
8
|
-
@mouseup="mouseup"
|
|
9
|
-
@mousemove="mousemove"
|
|
10
|
-
@touchstart="touchstart"
|
|
11
|
-
@touchmove="touchmove"
|
|
12
|
-
@touchend="touchend"
|
|
13
|
-
@click="click"
|
|
14
|
-
@dblclick="dblclick"
|
|
15
|
-
@dragstart="() => false"
|
|
16
|
-
>
|
|
17
|
-
<div
|
|
18
|
-
v-for="task in tasks"
|
|
19
|
-
:key="task.id"
|
|
20
|
-
:class="[
|
|
21
|
-
'bar',
|
|
22
|
-
task.type || 'task',
|
|
23
|
-
{ touch: touched && taskMove && task.id == taskMove.id },
|
|
24
|
-
]"
|
|
25
|
-
:style="taskStyle(task)"
|
|
26
|
-
:data-id="task.id"
|
|
27
|
-
:data-type="task.type"
|
|
28
|
-
:data-tooltip-id="task.id"
|
|
29
|
-
>
|
|
30
|
-
<div class="link left"></div>
|
|
31
|
-
|
|
32
|
-
<template v-if="task.type !== 'milestone'">
|
|
33
|
-
<div v-if="task.progress" class="progress-wrapper">
|
|
34
|
-
<div
|
|
35
|
-
class="progress-percent"
|
|
36
|
-
:style="{ width: task.progress + '%' }"
|
|
37
|
-
/>
|
|
38
|
-
</div>
|
|
39
|
-
|
|
40
|
-
<div v-if="task.textLeft" class="textLeft">{{ task.textLeft }}</div>
|
|
41
|
-
<div v-if="task.textRight" class="textRight">{{ task.textRight }}</div>
|
|
42
|
-
|
|
43
|
-
<component
|
|
44
|
-
v-if="template"
|
|
45
|
-
:is="templates.taskText"
|
|
46
|
-
:data="task"
|
|
47
|
-
></component>
|
|
48
|
-
|
|
49
|
-
<div v-else class="text">{{ task.text }}</div>
|
|
50
|
-
</template>
|
|
51
|
-
|
|
52
|
-
<template v-else>
|
|
53
|
-
<div class="content"></div>
|
|
54
|
-
<div class="textRight">{{ task.text || task.textRight }}</div>
|
|
55
|
-
</template>
|
|
56
|
-
|
|
57
|
-
<div class="link right"></div>
|
|
58
|
-
</div>
|
|
59
|
-
|
|
60
|
-
<NewLink
|
|
61
|
-
v-if="start && end && newLink"
|
|
62
|
-
:layer="$refs.layer"
|
|
63
|
-
:start="start"
|
|
64
|
-
:end="end"
|
|
65
|
-
/>
|
|
66
|
-
</div>
|
|
67
|
-
</template>
|
|
68
|
-
|
|
69
|
-
<script>
|
|
70
|
-
import { locate, locateID } from "@dhtmlx/trial-lib-gantt";
|
|
71
|
-
import NewLink from "./NewLink.vue";
|
|
72
|
-
|
|
73
|
-
export default {
|
|
74
|
-
components: {
|
|
75
|
-
NewLink,
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
props: ["tasks", "drag", "newLink", "cellWidth", "templates"],
|
|
79
|
-
|
|
80
|
-
data: () => ({
|
|
81
|
-
taskMove: null,
|
|
82
|
-
layer: null,
|
|
83
|
-
start: null,
|
|
84
|
-
end: null,
|
|
85
|
-
ignoreNextClick: false,
|
|
86
|
-
touched: null,
|
|
87
|
-
touchTimer: null,
|
|
88
|
-
}),
|
|
89
|
-
|
|
90
|
-
methods: {
|
|
91
|
-
mousedown(e) {
|
|
92
|
-
const node = locate(e);
|
|
93
|
-
if (!node) return;
|
|
94
|
-
|
|
95
|
-
this.down(node, e.target, e);
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
mousemove(e) {
|
|
99
|
-
this.move(e, e);
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
mouseup(e) {
|
|
103
|
-
this.up(e);
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
touchstart(e) {
|
|
107
|
-
const node = locate(e);
|
|
108
|
-
if (node) {
|
|
109
|
-
const target = e.target;
|
|
110
|
-
this.touchTimer = setTimeout(() => {
|
|
111
|
-
this.touched = true;
|
|
112
|
-
this.down(node, target, e.touches[0]);
|
|
113
|
-
}, 300);
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
touchmove(e) {
|
|
118
|
-
if (this.touched) {
|
|
119
|
-
e.preventDefault();
|
|
120
|
-
this.move(e, e.touches[0]);
|
|
121
|
-
} else if (this.touchTimer) {
|
|
122
|
-
clearTimeout(this.touchTimer);
|
|
123
|
-
this.touchTimer = null;
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
touchend(e) {
|
|
128
|
-
this.touched = null;
|
|
129
|
-
if (this.touchTimer) {
|
|
130
|
-
clearTimeout(this.touchTimer);
|
|
131
|
-
this.touchTimer = null;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
this.up(e.changedTouches[0]);
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
contextmenu(e) {
|
|
138
|
-
if (!this.touched || !this.touchTimer) {
|
|
139
|
-
e.preventDefault();
|
|
140
|
-
return false;
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
down(node, target, point) {
|
|
145
|
-
const { clientX, clientY } = point;
|
|
146
|
-
const id = node.dataset.id;
|
|
147
|
-
const css = target.classList;
|
|
148
|
-
|
|
149
|
-
if (css.contains("link")) {
|
|
150
|
-
this.start = {
|
|
151
|
-
id,
|
|
152
|
-
start: css.contains("left"),
|
|
153
|
-
x: clientX,
|
|
154
|
-
y: clientY,
|
|
155
|
-
};
|
|
156
|
-
this.startDrag();
|
|
157
|
-
} else {
|
|
158
|
-
let mode = this.getMoveMode(node, point) || "move";
|
|
159
|
-
|
|
160
|
-
this.taskMove = {
|
|
161
|
-
id,
|
|
162
|
-
mode,
|
|
163
|
-
node,
|
|
164
|
-
x: clientX,
|
|
165
|
-
dx: 0,
|
|
166
|
-
l: parseInt(node.style.left),
|
|
167
|
-
w: parseInt(node.style.width),
|
|
168
|
-
};
|
|
169
|
-
this.startDrag();
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
up(point) {
|
|
174
|
-
if (this.start) {
|
|
175
|
-
const { clientX, clientY } = point;
|
|
176
|
-
|
|
177
|
-
const source = this.start.id;
|
|
178
|
-
const fromStart = this.start.start;
|
|
179
|
-
this.start = this.end = null;
|
|
180
|
-
|
|
181
|
-
const targetNode = document.elementFromPoint(clientX, clientY);
|
|
182
|
-
const node = locate(targetNode);
|
|
183
|
-
if (!node) return;
|
|
184
|
-
|
|
185
|
-
const css = node.classList;
|
|
186
|
-
const target = node.dataset.id;
|
|
187
|
-
if (!target || source == target) return;
|
|
188
|
-
|
|
189
|
-
let toStart = true;
|
|
190
|
-
if (css.contains("link")) {
|
|
191
|
-
if (css.contains("right")) {
|
|
192
|
-
toStart = false;
|
|
193
|
-
}
|
|
194
|
-
} else {
|
|
195
|
-
const rect = node.getBoundingClientRect();
|
|
196
|
-
const x = clientX - rect.left;
|
|
197
|
-
const w = rect.width;
|
|
198
|
-
toStart = x < w / 2;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
const type = (fromStart ? 1 : 0) + (toStart ? 0 : 2);
|
|
202
|
-
if (this.newLink) {
|
|
203
|
-
this.$emit("action", {
|
|
204
|
-
action: "add-link",
|
|
205
|
-
obj: { source, target, type },
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
this.endDrag();
|
|
209
|
-
} else if (this.taskMove) {
|
|
210
|
-
const { id, mode, dx, node, l, w, start } = this.taskMove;
|
|
211
|
-
this.taskMove = null;
|
|
212
|
-
|
|
213
|
-
if (!start) return;
|
|
214
|
-
|
|
215
|
-
const time = Math.round(dx / this.cellWidth);
|
|
216
|
-
// restore node position
|
|
217
|
-
if (!time) {
|
|
218
|
-
node.style.left = `${l}px`;
|
|
219
|
-
node.style.width = `${w}px`;
|
|
220
|
-
}
|
|
221
|
-
this.$emit("action", {
|
|
222
|
-
action: "update-task-time",
|
|
223
|
-
id,
|
|
224
|
-
obj: { mode, time },
|
|
225
|
-
});
|
|
226
|
-
this.ignoreNextClick = true;
|
|
227
|
-
this.endDrag();
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
|
-
|
|
231
|
-
move(e, point) {
|
|
232
|
-
const { clientX, clientY } = point;
|
|
233
|
-
|
|
234
|
-
if (this.start) {
|
|
235
|
-
this.end = { x: clientX, y: clientY };
|
|
236
|
-
} else if (this.taskMove && this.drag) {
|
|
237
|
-
const { node, mode, l, w, x, id } = this.taskMove;
|
|
238
|
-
const dx = (this.taskMove.dx = clientX - x);
|
|
239
|
-
if (!this.start && Math.abs(dx) < 20) return;
|
|
240
|
-
|
|
241
|
-
if (mode === "start") {
|
|
242
|
-
node.style.left = `${l + dx}px`;
|
|
243
|
-
node.style.width = `${w - dx}px`;
|
|
244
|
-
} else if (mode === "end") {
|
|
245
|
-
node.style.width = `${w + dx}px`;
|
|
246
|
-
} else if (mode === "move") {
|
|
247
|
-
node.style.left = `${l + dx}px`;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
this.taskMove.start = true;
|
|
251
|
-
|
|
252
|
-
this.$emit("action", {
|
|
253
|
-
action: "move-task",
|
|
254
|
-
id,
|
|
255
|
-
obj: {
|
|
256
|
-
width: parseInt(node.style.width),
|
|
257
|
-
left: parseInt(node.style.left),
|
|
258
|
-
},
|
|
259
|
-
});
|
|
260
|
-
} else {
|
|
261
|
-
const mnode = locate(e);
|
|
262
|
-
if (mnode) {
|
|
263
|
-
const mode = this.getMoveMode(mnode, point);
|
|
264
|
-
mnode.style.cursor = mode ? "col-resize" : "pointer";
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
|
|
269
|
-
click(e) {
|
|
270
|
-
if (this.ignoreNextClick) {
|
|
271
|
-
this.ignoreNextClick = true;
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
const id = locateID(e.target);
|
|
276
|
-
|
|
277
|
-
if (id) {
|
|
278
|
-
this.$emit("action", { action: "select-task", id });
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
|
|
282
|
-
dblclick(e) {
|
|
283
|
-
const id = locateID(e.target);
|
|
284
|
-
|
|
285
|
-
if (id) {
|
|
286
|
-
this.$emit("action", { action: "show-details", id });
|
|
287
|
-
}
|
|
288
|
-
},
|
|
289
|
-
|
|
290
|
-
getMoveMode(node, e) {
|
|
291
|
-
if (this.getTask(node.dataset.id).type === "milestone") return "";
|
|
292
|
-
|
|
293
|
-
const rect = node.getBoundingClientRect();
|
|
294
|
-
const p = (e.clientX - rect.left) / rect.width;
|
|
295
|
-
let delta = 0.2 / (rect.width > 200 ? rect.width / 200 : 1);
|
|
296
|
-
|
|
297
|
-
if (p < delta) return "start";
|
|
298
|
-
if (p > 1 - delta) return "end";
|
|
299
|
-
return "";
|
|
300
|
-
},
|
|
301
|
-
|
|
302
|
-
getTask(id) {
|
|
303
|
-
return this.tasks.find(a => a.id == id);
|
|
304
|
-
},
|
|
305
|
-
|
|
306
|
-
taskStyle(task) {
|
|
307
|
-
return `left:${task.$x}px;top:${task.$y}px;width:${task.$w}px;height:${task.$h}px`;
|
|
308
|
-
},
|
|
309
|
-
|
|
310
|
-
startDrag() {
|
|
311
|
-
document.body.style.userSelect = "none";
|
|
312
|
-
},
|
|
313
|
-
|
|
314
|
-
endDrag() {
|
|
315
|
-
document.body.style.userSelect = "";
|
|
316
|
-
},
|
|
317
|
-
},
|
|
318
|
-
|
|
319
|
-
computed: {
|
|
320
|
-
addLink() {
|
|
321
|
-
const data = !!this.$refs.layer && !!this.start && !!this.end;
|
|
322
|
-
return data;
|
|
323
|
-
},
|
|
324
|
-
|
|
325
|
-
lineHeight() {
|
|
326
|
-
return `line-height: ${this.tasks.length ? this.tasks[0].$h : 0}px`;
|
|
327
|
-
},
|
|
328
|
-
|
|
329
|
-
template() {
|
|
330
|
-
return this.templates && this.templates.taskText;
|
|
331
|
-
},
|
|
332
|
-
},
|
|
333
|
-
};
|
|
334
|
-
</script>
|
|
335
|
-
|
|
336
|
-
<style scoped>
|
|
337
|
-
.bars {
|
|
338
|
-
position: absolute;
|
|
339
|
-
top: 0;
|
|
340
|
-
left: 0;
|
|
341
|
-
width: 100%;
|
|
342
|
-
height: 100%;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
.bar {
|
|
346
|
-
box-sizing: border-box;
|
|
347
|
-
position: absolute;
|
|
348
|
-
border-radius: var(--wx-gantt-bar-border-radius);
|
|
349
|
-
font: var(--wx-gantt-bar-font);
|
|
350
|
-
white-space: nowrap;
|
|
351
|
-
line-height: inherit;
|
|
352
|
-
text-align: center;
|
|
353
|
-
cursor: pointer;
|
|
354
|
-
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
.bar.touch {
|
|
358
|
-
opacity: 0.5;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
.task {
|
|
362
|
-
border: 1px solid var(--wx-gantt-task-border-color);
|
|
363
|
-
border-color: var(--wx-gantt-task-border-color);
|
|
364
|
-
color: var(--wx-gantt-task-font-color);
|
|
365
|
-
background-color: var(--wx-gantt-task-color);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
.project {
|
|
369
|
-
border: 1px solid var(--wx-gantt-project-border-color);
|
|
370
|
-
border-color: var(--wx-gantt-project-border-color);
|
|
371
|
-
color: var(--wx-gantt-project-font-color);
|
|
372
|
-
background-color: var(--wx-gantt-project-color);
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
.content {
|
|
376
|
-
position: absolute;
|
|
377
|
-
top: 0;
|
|
378
|
-
left: 0;
|
|
379
|
-
width: 100%;
|
|
380
|
-
height: 100%;
|
|
381
|
-
user-select: none;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
.text {
|
|
385
|
-
position: relative;
|
|
386
|
-
z-index: 2;
|
|
387
|
-
display: inline;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
.textRight,
|
|
391
|
-
.textLeft {
|
|
392
|
-
position: absolute;
|
|
393
|
-
line-height: normal;
|
|
394
|
-
display: block;
|
|
395
|
-
left: 100%;
|
|
396
|
-
color: var(--wx-font-color);
|
|
397
|
-
pointer-events: none;
|
|
398
|
-
padding: 0 10px;
|
|
399
|
-
}
|
|
400
|
-
.textLeft {
|
|
401
|
-
left: auto;
|
|
402
|
-
right: 100%;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
.milestone .textRight {
|
|
406
|
-
padding: 0;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
.milestone .content {
|
|
410
|
-
height: 100%;
|
|
411
|
-
background-color: var(--wx-gantt-milestone-color);
|
|
412
|
-
transform: rotate(45deg) scale(0.75);
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
.progress-wrapper {
|
|
416
|
-
position: absolute;
|
|
417
|
-
width: 100%;
|
|
418
|
-
height: 100%;
|
|
419
|
-
background-color: transparent;
|
|
420
|
-
border-radius: var(--wx-gantt-bar-border-radius);
|
|
421
|
-
overflow: hidden;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
.progress-percent {
|
|
425
|
-
height: 100%;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
.task .progress-percent {
|
|
429
|
-
background-color: var(--wx-gantt-task-fill-color);
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
.project .progress-percent {
|
|
433
|
-
background-color: var(--wx-gantt-project-fill-color);
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
.link {
|
|
437
|
-
position: absolute;
|
|
438
|
-
z-index: 2;
|
|
439
|
-
top: 50%;
|
|
440
|
-
transform: translateY(-50%);
|
|
441
|
-
width: 16px;
|
|
442
|
-
height: 16px;
|
|
443
|
-
border-radius: 50%;
|
|
444
|
-
border: 1px solid #929292;
|
|
445
|
-
background-color: #f0f0f0;
|
|
446
|
-
cursor: pointer;
|
|
447
|
-
user-select: none;
|
|
448
|
-
opacity: 0;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
.link.left {
|
|
452
|
-
left: -8px;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
.link.right {
|
|
456
|
-
right: -8px;
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
.bar:hover .link,
|
|
460
|
-
.link:hover {
|
|
461
|
-
opacity: 1;
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
.milestone .link.left {
|
|
465
|
-
left: -16px;
|
|
466
|
-
}
|
|
467
|
-
.milestone .link.right {
|
|
468
|
-
right: -16px;
|
|
469
|
-
}
|
|
470
|
-
</style>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :style="cellStyle"></div>
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
import { grid } from "@dhtmlx/trial-lib-gantt";
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
props: ["width", "height", "borders"],
|
|
10
|
-
|
|
11
|
-
computed: {
|
|
12
|
-
cellStyle() {
|
|
13
|
-
const img = grid(this.width, this.height, "#ebebeb", this.borders);
|
|
14
|
-
return {
|
|
15
|
-
width: "100%",
|
|
16
|
-
height: "100%",
|
|
17
|
-
backgroundImage: `url(${img})`,
|
|
18
|
-
};
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
</script>
|
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="chart" ref="chart" @scroll="scroll">
|
|
3
|
-
<div v-if="markers.length" class="markers" :style="markersStyle">
|
|
4
|
-
<div
|
|
5
|
-
v-for="(marker, index) in markers"
|
|
6
|
-
:key="index"
|
|
7
|
-
:class="['marker', marker.css || 'default']"
|
|
8
|
-
:style="{ left: marker.left + 'px' }"
|
|
9
|
-
>
|
|
10
|
-
<div class="content">{{ marker.text }}</div>
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
|
|
14
|
-
<div class="area" :style="areaStyle">
|
|
15
|
-
<CellGrid :width="cellWidth" :height="cellHeight" :borders="borders" />
|
|
16
|
-
|
|
17
|
-
<div v-if="selected" class="selection" :style="selectStyle"></div>
|
|
18
|
-
|
|
19
|
-
<Links :links="links" :width="fullWidth" :height="fullHeight" />
|
|
20
|
-
|
|
21
|
-
<Bars
|
|
22
|
-
:tasks="tasks"
|
|
23
|
-
:templates="templates"
|
|
24
|
-
:cellWidth="cellWidth"
|
|
25
|
-
:drag="drag"
|
|
26
|
-
:newLink="newLink"
|
|
27
|
-
@action="action"
|
|
28
|
-
/>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
</template>
|
|
32
|
-
|
|
33
|
-
<script>
|
|
34
|
-
import CellGrid from "./CellGrid";
|
|
35
|
-
import Links from "./Links";
|
|
36
|
-
import Bars from "./Bars";
|
|
37
|
-
|
|
38
|
-
export default {
|
|
39
|
-
components: {
|
|
40
|
-
CellGrid,
|
|
41
|
-
Links,
|
|
42
|
-
Bars,
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
props: [
|
|
46
|
-
"drag",
|
|
47
|
-
"newLink",
|
|
48
|
-
"markers",
|
|
49
|
-
"tasks",
|
|
50
|
-
"links",
|
|
51
|
-
"scrollTop",
|
|
52
|
-
"scrollLeft",
|
|
53
|
-
"cellWidth",
|
|
54
|
-
"cellHeight",
|
|
55
|
-
"fullWidth",
|
|
56
|
-
"fullHeight",
|
|
57
|
-
"selected",
|
|
58
|
-
"templates",
|
|
59
|
-
"borders",
|
|
60
|
-
],
|
|
61
|
-
|
|
62
|
-
data: () => ({
|
|
63
|
-
chart: {},
|
|
64
|
-
}),
|
|
65
|
-
|
|
66
|
-
methods: {
|
|
67
|
-
action(data) {
|
|
68
|
-
this.$emit("action", data);
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
scroll() {
|
|
72
|
-
this.$emit("action", {
|
|
73
|
-
action: "scroll-chart",
|
|
74
|
-
top: this.chart.scrollTop,
|
|
75
|
-
left: this.chart.scrollLeft,
|
|
76
|
-
});
|
|
77
|
-
this.dataRequest();
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
dataRequest() {
|
|
81
|
-
const clientHeight = this.chart.clientHeight || 0;
|
|
82
|
-
const num = Math.ceil(clientHeight / this.cellHeight) + 1;
|
|
83
|
-
const pos = Math.floor(this.chart.scrollTop / this.cellHeight);
|
|
84
|
-
const start = Math.max(0, pos);
|
|
85
|
-
const end = pos + num;
|
|
86
|
-
const from = start * this.cellHeight;
|
|
87
|
-
this.$emit("action", { action: "data-request", start, end, from });
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
scrollToTask(task) {
|
|
91
|
-
if (task) {
|
|
92
|
-
const { clientWidth, clientHeight } = this.chart;
|
|
93
|
-
|
|
94
|
-
let left = this.scrollLeft;
|
|
95
|
-
let top = this.scrollTop;
|
|
96
|
-
|
|
97
|
-
if (task.$x <= left) {
|
|
98
|
-
left = task.$x - this.cellWidth;
|
|
99
|
-
} else if (
|
|
100
|
-
task.$x + task.$w >= clientWidth + left &&
|
|
101
|
-
task.$w < clientWidth
|
|
102
|
-
) {
|
|
103
|
-
left = task.$x + task.$w - clientWidth + this.cellWidth;
|
|
104
|
-
} else if (task.$w > clientWidth) {
|
|
105
|
-
left = task.$x - this.cellWidth;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (task.$y < top) {
|
|
109
|
-
top = task.$y - this.cellHeight;
|
|
110
|
-
} else if (task.$y + task.$h >= clientHeight + top) {
|
|
111
|
-
top = task.$y - clientHeight + this.cellHeight;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
this.$emit("action", {
|
|
115
|
-
action: "scroll-chart",
|
|
116
|
-
top,
|
|
117
|
-
left,
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
|
|
123
|
-
mounted() {
|
|
124
|
-
window.addEventListener("resize", this.dataRequest);
|
|
125
|
-
this.chart = this.$refs.chart;
|
|
126
|
-
this.dataRequest();
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
updated() {
|
|
130
|
-
this.chart.scrollTop = this.scrollTop;
|
|
131
|
-
this.chart.scrollLeft = this.scrollLeft;
|
|
132
|
-
|
|
133
|
-
if (this.scrollTop !== this.chart.scrollTop) {
|
|
134
|
-
this.$emit("action", {
|
|
135
|
-
action: "scroll-chart",
|
|
136
|
-
top: this.chart.scrollTop,
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
|
|
141
|
-
unmounted() {
|
|
142
|
-
window.removeEventListener("resize", this.dataRequest);
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
computed: {
|
|
146
|
-
areaStyle() {
|
|
147
|
-
return {
|
|
148
|
-
width: `${this.fullWidth}px`,
|
|
149
|
-
height: `${this.fullHeight}px`,
|
|
150
|
-
};
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
markersHeight() {
|
|
154
|
-
return this.fullHeight > this.chart.clientHeight
|
|
155
|
-
? this.chart.clientHeight
|
|
156
|
-
: this.fullHeight;
|
|
157
|
-
},
|
|
158
|
-
|
|
159
|
-
markersStyle() {
|
|
160
|
-
return {
|
|
161
|
-
height: `${this.markersHeight}px`,
|
|
162
|
-
left: `${-this.scrollLeft}px`,
|
|
163
|
-
};
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
selectStyle() {
|
|
167
|
-
return {
|
|
168
|
-
height: this.cellHeight - 1 + "px",
|
|
169
|
-
top: this.selected.$y - 3 + "px",
|
|
170
|
-
};
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
watch: {
|
|
175
|
-
selected() {
|
|
176
|
-
if (this.selected) {
|
|
177
|
-
this.scrollToTask(this.selected);
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
|
|
181
|
-
cellHeight() {
|
|
182
|
-
this.scroll();
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
};
|
|
186
|
-
</script>
|
|
187
|
-
|
|
188
|
-
<style scoped>
|
|
189
|
-
.chart {
|
|
190
|
-
flex: 1 1 auto;
|
|
191
|
-
overflow: auto;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
.markers {
|
|
195
|
-
position: absolute;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.marker {
|
|
199
|
-
position: absolute;
|
|
200
|
-
z-index: 5;
|
|
201
|
-
width: 2px;
|
|
202
|
-
height: 100%;
|
|
203
|
-
text-align: center;
|
|
204
|
-
user-select: none;
|
|
205
|
-
transform: scaleX(-1);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.default {
|
|
209
|
-
background-color: var(--wx-gantt-marker-color);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
.content {
|
|
213
|
-
position: absolute;
|
|
214
|
-
min-width: 80px;
|
|
215
|
-
padding: 4px 8px;
|
|
216
|
-
border-top-left-radius: 4px;
|
|
217
|
-
border-bottom-left-radius: 4px;
|
|
218
|
-
font: var(--wx-gantt-marker-font);
|
|
219
|
-
color: var(--wx-gantt-marker-font-color);
|
|
220
|
-
background-color: inherit;
|
|
221
|
-
white-space: nowrap;
|
|
222
|
-
transform: scaleX(-1);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.area {
|
|
226
|
-
position: relative;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
.selection {
|
|
230
|
-
position: absolute;
|
|
231
|
-
box-sizing: border-box;
|
|
232
|
-
left: 0;
|
|
233
|
-
width: 100%;
|
|
234
|
-
background: var(--wx-gantt-select-color);
|
|
235
|
-
}
|
|
236
|
-
</style>
|