tg-ganttchart 0.0.2 → 0.0.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 +2 -0
- package/package.json +5 -2
- package/src/components/GanttElastic.standalone.vue +13 -314
- package/src/components/GanttElastic.vue +7 -4
- package/src/components/components/Calendar/CalendarRow.vue +26 -15
- package/src/components/components/Chart/Chart.vue +1 -0
- package/src/components/components/Chart/DaysHighlight.vue +1 -0
- package/src/components/components/Chart/ProgressBar.vue +1 -0
- package/src/components/components/Chart/Row/Task.mixin.js +0 -1
- package/src/components/components/Header/Header.vue +0 -2
- package/src/components/components/TaskList/ItemColumn.vue +40 -17
- package/src/components/components/TaskList/TaskList.vue +10 -7
- package/src/components/components/TaskList/TaskListItem.vue +6 -10
- package/src/index.js +1 -2
package/README.md
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tg-ganttchart",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Vue js compnonet for dynamic list in which we can provide and schema and data. It will render the table view according to the dynamic fields",
|
|
5
5
|
"main": "./dist/tgganttchart.umd.cjs",
|
|
6
6
|
"module": "./dist/tgganttchart.es.js",
|
|
@@ -51,7 +51,10 @@
|
|
|
51
51
|
"parserOptions": {
|
|
52
52
|
"parser": "@babel/eslint-parser"
|
|
53
53
|
},
|
|
54
|
-
"rules": {
|
|
54
|
+
"rules": {
|
|
55
|
+
"vue/no-deprecated-slot-attribute": "off",
|
|
56
|
+
"no-prototype-builtins": "off"
|
|
57
|
+
}
|
|
55
58
|
},
|
|
56
59
|
"browserslist": [
|
|
57
60
|
"> 1%",
|
|
@@ -1,40 +1,32 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
2
|
<gantt-elastic :tasks="tasks" :options="options" :dynamicStyle="dynamicStyle">
|
|
4
3
|
<component v-if="components.header" :is="components.header" slot="header"></component>
|
|
5
4
|
<component v-if="components.footer" :is="components.footer" slot="footer"></component>
|
|
6
|
-
<gantt-header slot="header"></gantt-header>
|
|
7
5
|
</gantt-elastic>
|
|
8
6
|
</template>
|
|
9
7
|
|
|
10
8
|
<script>
|
|
11
9
|
import GanttElastic from './GanttElastic.vue';
|
|
12
|
-
import GanttHeader from './components/Header/Header.vue';
|
|
13
|
-
import dayjs from "dayjs";
|
|
14
|
-
|
|
15
|
-
function getDate(hours) {
|
|
16
|
-
const currentDate = new Date();
|
|
17
|
-
const currentYear = currentDate.getFullYear();
|
|
18
|
-
const currentMonth = currentDate.getMonth();
|
|
19
|
-
const currentDay = currentDate.getDate();
|
|
20
|
-
const timeStamp = new Date(
|
|
21
|
-
currentYear,
|
|
22
|
-
currentMonth,
|
|
23
|
-
currentDay,
|
|
24
|
-
0,
|
|
25
|
-
0,
|
|
26
|
-
0
|
|
27
|
-
).getTime();
|
|
28
|
-
return new Date(timeStamp + hours * 60 * 60 * 1000).getTime();
|
|
29
|
-
}
|
|
30
10
|
|
|
31
11
|
export default {
|
|
32
12
|
name: 'GanttElasticStandalone',
|
|
33
13
|
components: {
|
|
34
14
|
'gantt-elastic': GanttElastic,
|
|
35
|
-
'gantt-header': GanttHeader
|
|
36
15
|
},
|
|
37
16
|
props: {
|
|
17
|
+
// Props to receive from parent
|
|
18
|
+
tasks: {
|
|
19
|
+
type: Array,
|
|
20
|
+
default: () => [],
|
|
21
|
+
},
|
|
22
|
+
options: {
|
|
23
|
+
type: Object,
|
|
24
|
+
default: () => ({}),
|
|
25
|
+
},
|
|
26
|
+
dynamicStyle: {
|
|
27
|
+
type: Object,
|
|
28
|
+
default: () => ({}),
|
|
29
|
+
},
|
|
38
30
|
header: {
|
|
39
31
|
type: Object,
|
|
40
32
|
default: () => ({}),
|
|
@@ -50,299 +42,6 @@ export default {
|
|
|
50
42
|
header: this.header,
|
|
51
43
|
footer: this.footer,
|
|
52
44
|
},
|
|
53
|
-
tasks: [
|
|
54
|
-
{
|
|
55
|
-
id: 1,
|
|
56
|
-
label: "Make some noise",
|
|
57
|
-
user:
|
|
58
|
-
'<a href="https://www.google.com/search?q=John+Doe" target="_blank" style="color:#0077c0;">John Doe</a>',
|
|
59
|
-
start: getDate(-24 * 5),
|
|
60
|
-
duration: 15 * 24 * 60 * 60 * 1000,
|
|
61
|
-
percent: 10,
|
|
62
|
-
type: "project"
|
|
63
|
-
//collapsed: true,
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
id: 2,
|
|
67
|
-
label: "With great power comes great responsibility",
|
|
68
|
-
user:
|
|
69
|
-
'<a href="https://www.google.com/search?q=Peter+Parker" target="_blank" style="color:#0077c0;">Peter Parker</a>',
|
|
70
|
-
parentId: 1,
|
|
71
|
-
start: getDate(-24 * 4),
|
|
72
|
-
duration: 4 * 24 * 60 * 60 * 1000,
|
|
73
|
-
percent: 50,
|
|
74
|
-
type: "milestone",
|
|
75
|
-
collapsed: true,
|
|
76
|
-
style: {
|
|
77
|
-
base: {
|
|
78
|
-
fill: "#1EBC61",
|
|
79
|
-
stroke: "#0EAC51"
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
id: 3,
|
|
85
|
-
label: "Courage is being scared to death, but saddling up anyway.",
|
|
86
|
-
user:
|
|
87
|
-
'<a href="https://www.google.com/search?q=John+Wayne" target="_blank" style="color:#0077c0;">John Wayne</a>',
|
|
88
|
-
parentId: 2,
|
|
89
|
-
start: getDate(-24 * 3),
|
|
90
|
-
duration: 2 * 24 * 60 * 60 * 1000,
|
|
91
|
-
percent: 100,
|
|
92
|
-
type: "task"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
id: 4,
|
|
96
|
-
label: "Put that toy AWAY!",
|
|
97
|
-
user:
|
|
98
|
-
'<a href="https://www.google.com/search?q=Clark+Kent" target="_blank" style="color:#0077c0;">Clark Kent</a>',
|
|
99
|
-
start: getDate(-24 * 2),
|
|
100
|
-
duration: 2 * 24 * 60 * 60 * 1000,
|
|
101
|
-
percent: 50,
|
|
102
|
-
type: "task",
|
|
103
|
-
dependentOn: [3]
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
id: 5,
|
|
107
|
-
label:
|
|
108
|
-
"One billion, gajillion, fafillion... shabadylu...mil...shabady......uh, Yen.",
|
|
109
|
-
user:
|
|
110
|
-
'<a href="https://www.google.com/search?q=Austin+Powers" target="_blank" style="color:#0077c0;">Austin Powers</a>',
|
|
111
|
-
parentId: 4,
|
|
112
|
-
start: getDate(0),
|
|
113
|
-
duration: 2 * 24 * 60 * 60 * 1000,
|
|
114
|
-
percent: 10,
|
|
115
|
-
type: "milestone",
|
|
116
|
-
style: {
|
|
117
|
-
base: {
|
|
118
|
-
fill: "#0287D0",
|
|
119
|
-
stroke: "#0077C0"
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
id: 6,
|
|
125
|
-
label: "Butch Mario and the Luigi Kid",
|
|
126
|
-
user:
|
|
127
|
-
'<a href="https://www.google.com/search?q=Mario+Bros" target="_blank" style="color:#0077c0;">Mario Bros</a>',
|
|
128
|
-
parentId: 5,
|
|
129
|
-
start: getDate(24),
|
|
130
|
-
duration: 1 * 24 * 60 * 60 * 1000,
|
|
131
|
-
percent: 50,
|
|
132
|
-
type: "task",
|
|
133
|
-
collapsed: true,
|
|
134
|
-
style: {
|
|
135
|
-
base: {
|
|
136
|
-
fill: "#8E44AD",
|
|
137
|
-
stroke: "#7E349D"
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
id: 7,
|
|
143
|
-
label: "Devon, the old man wanted me, it was his dying request",
|
|
144
|
-
user:
|
|
145
|
-
'<a href="https://www.google.com/search?q=Knight+Rider" target="_blank" style="color:#0077c0;">Knight Rider</a>',
|
|
146
|
-
parentId: 2,
|
|
147
|
-
dependentOn: [6],
|
|
148
|
-
start: getDate(24 * 2),
|
|
149
|
-
duration: 4 * 60 * 60 * 1000,
|
|
150
|
-
percent: 20,
|
|
151
|
-
type: "task",
|
|
152
|
-
collapsed: true
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
id: 8,
|
|
156
|
-
label: "Hey, Baby! Anybody ever tell you I have beautiful eyes?",
|
|
157
|
-
user:
|
|
158
|
-
'<a href="https://www.google.com/search?q=Johhny+Bravo" target="_blank" style="color:#0077c0;">Johhny Bravo</a>',
|
|
159
|
-
parentId: 7,
|
|
160
|
-
dependentOn: [7],
|
|
161
|
-
start: getDate(24 * 3),
|
|
162
|
-
duration: 1 * 24 * 60 * 60 * 1000,
|
|
163
|
-
percent: 0,
|
|
164
|
-
type: "task"
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
id: 9,
|
|
168
|
-
label:
|
|
169
|
-
"This better be important, woman. You are interrupting my very delicate calculations.",
|
|
170
|
-
user:
|
|
171
|
-
'<a href="https://www.google.com/search?q=Dexter\'s+Laboratory" target="_blank" style="color:#0077c0;">Dexter\'s Laboratory</a>',
|
|
172
|
-
parentId: 8,
|
|
173
|
-
dependentOn: [8, 7],
|
|
174
|
-
start: getDate(24 * 4),
|
|
175
|
-
duration: 4 * 60 * 60 * 1000,
|
|
176
|
-
percent: 20,
|
|
177
|
-
type: "task",
|
|
178
|
-
style: {
|
|
179
|
-
base: {
|
|
180
|
-
fill: "#8E44AD",
|
|
181
|
-
stroke: "#7E349D"
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
id: 10,
|
|
187
|
-
label: "current task",
|
|
188
|
-
user:
|
|
189
|
-
'<a href="https://www.google.com/search?q=Johnattan+Owens" target="_blank" style="color:#0077c0;">Johnattan Owens</a>',
|
|
190
|
-
start: getDate(24 * 5),
|
|
191
|
-
duration: 24 * 60 * 60 * 1000,
|
|
192
|
-
percent: 0,
|
|
193
|
-
type: "task"
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
id: 11,
|
|
197
|
-
label: "test task",
|
|
198
|
-
user:
|
|
199
|
-
'<a href="https://www.google.com/search?q=Johnattan+Owens" target="_blank" style="color:#0077c0;">Johnattan Owens</a>',
|
|
200
|
-
start: getDate(24 * 6),
|
|
201
|
-
duration: 24 * 60 * 60 * 1000,
|
|
202
|
-
percent: 0,
|
|
203
|
-
type: "task"
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
id: 12,
|
|
207
|
-
label: "test task",
|
|
208
|
-
user:
|
|
209
|
-
'<a href="https://www.google.com/search?q=Johnattan+Owens" target="_blank" style="color:#0077c0;">Johnattan Owens</a>',
|
|
210
|
-
start: getDate(24 * 7),
|
|
211
|
-
duration: 24 * 60 * 60 * 1000,
|
|
212
|
-
percent: 0,
|
|
213
|
-
type: "task",
|
|
214
|
-
parentId: 11
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
id: 13,
|
|
218
|
-
label: "test task",
|
|
219
|
-
user:
|
|
220
|
-
'<a href="https://www.google.com/search?q=Johnattan+Owens" target="_blank" style="color:#0077c0;">Johnattan Owens</a>',
|
|
221
|
-
start: getDate(24 * 8),
|
|
222
|
-
duration: 24 * 60 * 60 * 1000,
|
|
223
|
-
percent: 0,
|
|
224
|
-
type: "task"
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
id: 14,
|
|
228
|
-
label: "test task",
|
|
229
|
-
user:
|
|
230
|
-
'<a href="https://www.google.com/search?q=Johnattan+Owens" target="_blank" style="color:#0077c0;">Johnattan Owens</a>',
|
|
231
|
-
start: getDate(24 * 9),
|
|
232
|
-
duration: 24 * 60 * 60 * 1000,
|
|
233
|
-
percent: 0,
|
|
234
|
-
type: "task"
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
id: 15,
|
|
238
|
-
label: "test task",
|
|
239
|
-
user:
|
|
240
|
-
'<a href="https://www.google.com/search?q=Johnattan+Owens" target="_blank" style="color:#0077c0;">Johnattan Owens</a>',
|
|
241
|
-
start: getDate(24 * 16),
|
|
242
|
-
duration: 24 * 60 * 60 * 1000,
|
|
243
|
-
percent: 0,
|
|
244
|
-
type: "task"
|
|
245
|
-
}
|
|
246
|
-
],
|
|
247
|
-
options: {
|
|
248
|
-
taskMapping: {
|
|
249
|
-
progress: "percent"
|
|
250
|
-
},
|
|
251
|
-
maxRows: 100,
|
|
252
|
-
maxHeight: 500,
|
|
253
|
-
title: {
|
|
254
|
-
label: "Your project title as html (link or whatever...)",
|
|
255
|
-
html: false
|
|
256
|
-
},
|
|
257
|
-
row: {
|
|
258
|
-
height: 24
|
|
259
|
-
},
|
|
260
|
-
calendar: {
|
|
261
|
-
hour: {
|
|
262
|
-
display: true
|
|
263
|
-
}
|
|
264
|
-
},
|
|
265
|
-
chart: {
|
|
266
|
-
progress: {
|
|
267
|
-
bar: false
|
|
268
|
-
},
|
|
269
|
-
expander: {
|
|
270
|
-
display: true
|
|
271
|
-
}
|
|
272
|
-
},
|
|
273
|
-
taskList: {
|
|
274
|
-
expander: {
|
|
275
|
-
straight: false
|
|
276
|
-
},
|
|
277
|
-
columns: [
|
|
278
|
-
{
|
|
279
|
-
id: 1,
|
|
280
|
-
label: "ID",
|
|
281
|
-
value: "id",
|
|
282
|
-
width: 10
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
id: 2,
|
|
286
|
-
label: "Description",
|
|
287
|
-
value: "label",
|
|
288
|
-
width: 200,
|
|
289
|
-
expander: true,
|
|
290
|
-
html: true,
|
|
291
|
-
events: {
|
|
292
|
-
click({ data }) {
|
|
293
|
-
alert("description clicked!\n" + data.label);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
id: 3,
|
|
299
|
-
label: "Assigned to",
|
|
300
|
-
value: "user",
|
|
301
|
-
width: 130,
|
|
302
|
-
html: true
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
id: 3,
|
|
306
|
-
label: "Start",
|
|
307
|
-
value: task => dayjs(task.start).format("YYYY-MM-DD"),
|
|
308
|
-
width: 78
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
id: 4,
|
|
312
|
-
label: "Type",
|
|
313
|
-
value: "type",
|
|
314
|
-
width: 68
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
id: 5,
|
|
318
|
-
label: "%",
|
|
319
|
-
value: "progress",
|
|
320
|
-
width: 35,
|
|
321
|
-
style: {
|
|
322
|
-
"task-list-header-label": {
|
|
323
|
-
"text-align": "center",
|
|
324
|
-
width: "100%"
|
|
325
|
-
},
|
|
326
|
-
"task-list-item-value-container": {
|
|
327
|
-
"text-align": "center",
|
|
328
|
-
width: "100%"
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
]
|
|
333
|
-
},
|
|
334
|
-
locale: {
|
|
335
|
-
name: "en",
|
|
336
|
-
Now: "Now",
|
|
337
|
-
"X-Scale": "Zoom-X",
|
|
338
|
-
"Y-Scale": "Zoom-Y",
|
|
339
|
-
"Task list width": "Task list",
|
|
340
|
-
"Before/After": "Expand",
|
|
341
|
-
"Display task list": "Task list"
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
,
|
|
345
|
-
dynamicStyle: {},
|
|
346
45
|
};
|
|
347
46
|
},
|
|
348
47
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
1
|
<template>
|
|
3
2
|
<div class="gantt-elastic" style="width:100%">
|
|
3
|
+
<gantt-header slot="header"></gantt-header>
|
|
4
4
|
<slot name="header"></slot>
|
|
5
5
|
<main-view ref="mainView"></main-view>
|
|
6
6
|
<slot name="footer"></slot>
|
|
@@ -13,6 +13,8 @@ import dayjs from 'dayjs';
|
|
|
13
13
|
import MainView from './components/MainView.vue';
|
|
14
14
|
import getStyle from './style.js';
|
|
15
15
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
16
|
+
import GanttHeader from './components/Header/Header.vue';
|
|
17
|
+
|
|
16
18
|
|
|
17
19
|
const ctx = document.createElement('canvas').getContext('2d');
|
|
18
20
|
// let VueInst = VueInstance;
|
|
@@ -23,7 +25,7 @@ const ctx = document.createElement('canvas').getContext('2d');
|
|
|
23
25
|
// }
|
|
24
26
|
// initVue();
|
|
25
27
|
|
|
26
|
-
let hourWidthCache = null;
|
|
28
|
+
// let hourWidthCache = null;
|
|
27
29
|
|
|
28
30
|
/**
|
|
29
31
|
* Helper function to fill out empty options in user settings
|
|
@@ -444,7 +446,8 @@ export function notEqualDeep(left, right, cache = [], path = '') {
|
|
|
444
446
|
const GanttElastic = {
|
|
445
447
|
name: 'GanttElastic',
|
|
446
448
|
components: {
|
|
447
|
-
MainView
|
|
449
|
+
MainView,
|
|
450
|
+
'gantt-header': GanttHeader
|
|
448
451
|
},
|
|
449
452
|
props: ['tasks', 'options', 'dynamicStyle'],
|
|
450
453
|
provide() {
|
|
@@ -473,7 +476,7 @@ const GanttElastic = {
|
|
|
473
476
|
refs: {},
|
|
474
477
|
tasksById: {},
|
|
475
478
|
taskTree: {},
|
|
476
|
-
ctx,
|
|
479
|
+
ctx: ctx,
|
|
477
480
|
emitTasksChanges: true, // some operations may pause emitting changes to parent component
|
|
478
481
|
emitOptionsChanges: true, // some operations may pause emitting changes to parent component
|
|
479
482
|
resizeObserver: null,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
<template>
|
|
2
3
|
<div :class="'gantt-elastic__calendar-row gantt-elastic__calendar-row--' + which" :style="rowStyle">
|
|
3
4
|
<div
|
|
@@ -7,9 +8,9 @@
|
|
|
7
8
|
:style="rectStyle"
|
|
8
9
|
>
|
|
9
10
|
<div
|
|
11
|
+
:class="'gantt-elastic__calendar-row-rect-child gantt-elastic__calendar-row-rect-child--' + which"
|
|
10
12
|
v-for="(child, childIndex) in item.children"
|
|
11
13
|
:key="child.key"
|
|
12
|
-
:class="'gantt-elastic__calendar-row-rect-child gantt-elastic__calendar-row-rect-child--' + which"
|
|
13
14
|
:style="rectChildStyle[itemIndex][childIndex]"
|
|
14
15
|
>
|
|
15
16
|
<div
|
|
@@ -32,12 +33,16 @@ export default {
|
|
|
32
33
|
return {};
|
|
33
34
|
},
|
|
34
35
|
methods: {
|
|
36
|
+
/**
|
|
37
|
+
* Get x position
|
|
38
|
+
*
|
|
39
|
+
* @returns {number}
|
|
40
|
+
*/
|
|
35
41
|
getTextX(item) {
|
|
36
42
|
let x = item.x + item.width / 2 - item.textWidth / 2;
|
|
37
43
|
if (this.which === 'month' && this.root.isInsideViewPort(item.x, item.width, 0)) {
|
|
38
|
-
|
|
44
|
+
let scrollWidth = this.root.state.options.scroll.chart.right - this.root.state.options.scroll.chart.left;
|
|
39
45
|
x = this.root.state.options.scroll.chart.left + scrollWidth / 2 - item.textWidth / 2 + 2;
|
|
40
|
-
|
|
41
46
|
if (x + item.textWidth + 2 > item.x + item.width) {
|
|
42
47
|
x = item.x + item.width - item.textWidth - 2;
|
|
43
48
|
} else if (x < item.x) {
|
|
@@ -49,33 +54,39 @@ export default {
|
|
|
49
54
|
},
|
|
50
55
|
computed: {
|
|
51
56
|
rowStyle() {
|
|
52
|
-
return { ...this.root.style['calendar-row'], ...this.root.style[
|
|
57
|
+
return { ...this.root.style['calendar-row'], ...this.root.style['calendar-row--' + this.which] };
|
|
53
58
|
},
|
|
54
59
|
rectStyle() {
|
|
55
|
-
return { ...this.root.style['calendar-row-rect'], ...this.root.style[
|
|
60
|
+
return { ...this.root.style['calendar-row-rect'], ...this.root.style['calendar-row-rect--' + this.which] };
|
|
56
61
|
},
|
|
57
62
|
rectChildStyle() {
|
|
58
63
|
const basicStyle = {
|
|
59
64
|
...this.root.style['calendar-row-rect-child'],
|
|
60
|
-
...this.root.style[
|
|
65
|
+
...this.root.style['calendar-row-rect-child--' + this.which]
|
|
61
66
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
const style = [];
|
|
68
|
+
for (let item of this.items) {
|
|
69
|
+
const childrenStyle = [];
|
|
70
|
+
for (let child of item.children) {
|
|
71
|
+
childrenStyle.push({
|
|
72
|
+
...basicStyle,
|
|
73
|
+
width: child.width + 'px',
|
|
74
|
+
height: child.height + 'px'
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
style.push(childrenStyle);
|
|
78
|
+
}
|
|
79
|
+
return style;
|
|
69
80
|
},
|
|
70
81
|
textStyle() {
|
|
71
82
|
const basicStyle = {
|
|
72
83
|
...this.root.style['calendar-row-text'],
|
|
73
|
-
...this.root.style[
|
|
84
|
+
...this.root.style['calendar-row-text--' + this.which]
|
|
74
85
|
};
|
|
75
86
|
return child => {
|
|
76
87
|
const style = { ...basicStyle };
|
|
77
88
|
if (this.which === 'month') {
|
|
78
|
-
style.left =
|
|
89
|
+
style.left = this.getTextX(child) + 'px';
|
|
79
90
|
}
|
|
80
91
|
return style;
|
|
81
92
|
};
|
|
@@ -159,8 +159,6 @@ export default {
|
|
|
159
159
|
};
|
|
160
160
|
},
|
|
161
161
|
created() {
|
|
162
|
-
debugger; // eslint-disable-line no-debugger
|
|
163
|
-
console.log("this.localScale", this.root);
|
|
164
162
|
this.localScale = this.root.state.options.times.timeZoom;
|
|
165
163
|
this.localHeight = this.root.state.options.row.height;
|
|
166
164
|
this.localBefore = this.root.state.options.scope.before;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
<slot></slot>
|
|
5
5
|
<div class="gantt-elastic__task-list-item-value-container" :style="containerStyle">
|
|
6
6
|
<div
|
|
7
|
+
v-if="!html"
|
|
7
8
|
class="gantt-elastic__task-list-item-value"
|
|
8
9
|
:style="valueStyle"
|
|
9
10
|
@click="emitEvent('click', $event)"
|
|
@@ -17,15 +18,13 @@
|
|
|
17
18
|
@touchstart="emitEvent('touchstart', $event)"
|
|
18
19
|
@touchmove="emitEvent('touchmove', $event)"
|
|
19
20
|
@touchend="emitEvent('touchend', $event)"
|
|
20
|
-
v-if="!html"
|
|
21
21
|
>
|
|
22
22
|
{{ value }}
|
|
23
23
|
</div>
|
|
24
24
|
<div
|
|
25
|
+
v-else
|
|
25
26
|
class="gantt-elastic__task-list-item-value"
|
|
26
27
|
:style="valueStyle"
|
|
27
|
-
v-else
|
|
28
|
-
v-html="value"
|
|
29
28
|
@click="emitEvent('click', $event)"
|
|
30
29
|
@mouseenter="emitEvent('mouseenter', $event)"
|
|
31
30
|
@mouseover="emitEvent('mouseover', $event)"
|
|
@@ -37,6 +36,7 @@
|
|
|
37
36
|
@touchstart="emitEvent('touchstart', $event)"
|
|
38
37
|
@touchmove="emitEvent('touchmove', $event)"
|
|
39
38
|
@touchend="emitEvent('touchend', $event)"
|
|
39
|
+
v-html="value"
|
|
40
40
|
></div>
|
|
41
41
|
</div>
|
|
42
42
|
</div>
|
|
@@ -47,51 +47,74 @@
|
|
|
47
47
|
export default {
|
|
48
48
|
name: 'ItemColumn',
|
|
49
49
|
inject: ['root'],
|
|
50
|
-
props:
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
props: ['column', 'task'],
|
|
51
|
+
data() {
|
|
52
|
+
return {};
|
|
53
53
|
},
|
|
54
54
|
methods: {
|
|
55
|
+
/**
|
|
56
|
+
* Emit event
|
|
57
|
+
*
|
|
58
|
+
* @param {String} eventName
|
|
59
|
+
* @param {Event} event
|
|
60
|
+
*/
|
|
55
61
|
emitEvent(eventName, event) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
eventHandler({ event, data: this.task, column: this.column });
|
|
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 });
|
|
59
64
|
}
|
|
60
65
|
this.root.$emit(`taskList-${this.task.type}-${eventName}`, { event, data: this.task, column: this.column });
|
|
61
66
|
}
|
|
62
67
|
},
|
|
63
68
|
computed: {
|
|
69
|
+
/**
|
|
70
|
+
* Should we display html or just text?
|
|
71
|
+
*
|
|
72
|
+
* @returns {boolean}
|
|
73
|
+
*/
|
|
64
74
|
html() {
|
|
65
|
-
|
|
75
|
+
if (typeof this.column.html !== 'undefined' && this.column.html === true) {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
66
79
|
},
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Get column value
|
|
83
|
+
*
|
|
84
|
+
* @returns {any|string}
|
|
85
|
+
*/
|
|
67
86
|
value() {
|
|
68
|
-
|
|
87
|
+
if (typeof this.column.value === 'function') {
|
|
88
|
+
return this.column.value(this.task);
|
|
89
|
+
}
|
|
90
|
+
return this.task[this.column.value];
|
|
69
91
|
},
|
|
92
|
+
|
|
70
93
|
itemColumnStyle() {
|
|
71
94
|
return {
|
|
72
95
|
...this.root.style['task-list-item-column'],
|
|
73
96
|
...this.column.style['task-list-item-column'],
|
|
74
|
-
width:
|
|
75
|
-
height:
|
|
97
|
+
width: this.column.finalWidth + 'px',
|
|
98
|
+
height: this.column.height + 'px'
|
|
76
99
|
};
|
|
77
100
|
},
|
|
101
|
+
|
|
78
102
|
wrapperStyle() {
|
|
79
103
|
return {
|
|
80
104
|
...this.root.style['task-list-item-value-wrapper'],
|
|
81
105
|
...this.column.style['task-list-item-value-wrapper']
|
|
82
106
|
};
|
|
83
107
|
},
|
|
108
|
+
|
|
84
109
|
containerStyle() {
|
|
85
110
|
return {
|
|
86
111
|
...this.root.style['task-list-item-value-container'],
|
|
87
112
|
...this.column.style['task-list-item-value-container']
|
|
88
113
|
};
|
|
89
114
|
},
|
|
115
|
+
|
|
90
116
|
valueStyle() {
|
|
91
|
-
return {
|
|
92
|
-
...this.root.style['task-list-item-value'],
|
|
93
|
-
...this.column.style['task-list-item-value']
|
|
94
|
-
};
|
|
117
|
+
return { ...this.root.style['task-list-item-value'], ...this.column.style['task-list-item-value'] };
|
|
95
118
|
}
|
|
96
119
|
}
|
|
97
120
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
<template>
|
|
2
3
|
<div
|
|
3
4
|
class="gantt-elastic__task-list-wrapper"
|
|
@@ -10,13 +11,9 @@
|
|
|
10
11
|
<div
|
|
11
12
|
class="gantt-elastic__task-list-items"
|
|
12
13
|
ref="taskListItems"
|
|
13
|
-
:style="{ ...root.style['task-list-items'], height:
|
|
14
|
+
:style="{ ...root.style['task-list-items'], height: root.state.options.rowsHeight + 'px' }"
|
|
14
15
|
>
|
|
15
|
-
<task-list-item
|
|
16
|
-
v-for="task in root.visibleTasks"
|
|
17
|
-
:key="task.id"
|
|
18
|
-
:task="task"
|
|
19
|
-
></task-list-item>
|
|
16
|
+
<task-list-item v-for="task in root.visibleTasks" :key="task.id" :task="task"></task-list-item>
|
|
20
17
|
</div>
|
|
21
18
|
</div>
|
|
22
19
|
</div>
|
|
@@ -25,7 +22,6 @@
|
|
|
25
22
|
<script>
|
|
26
23
|
import TaskListHeader from './TaskListHeader.vue';
|
|
27
24
|
import TaskListItem from './TaskListItem.vue';
|
|
28
|
-
|
|
29
25
|
export default {
|
|
30
26
|
name: 'TaskList',
|
|
31
27
|
components: {
|
|
@@ -33,6 +29,13 @@ export default {
|
|
|
33
29
|
TaskListItem
|
|
34
30
|
},
|
|
35
31
|
inject: ['root'],
|
|
32
|
+
data() {
|
|
33
|
+
return {};
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Mounted
|
|
38
|
+
*/
|
|
36
39
|
mounted() {
|
|
37
40
|
this.root.state.refs.taskListWrapper = this.$refs.taskListWrapper;
|
|
38
41
|
this.root.state.refs.taskList = this.$refs.taskList;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
+
|
|
1
2
|
<template>
|
|
2
|
-
<div class="gantt-elastic__task-list-item" :style="root.style['task-list-item']">
|
|
3
|
-
<item-column
|
|
4
|
-
v-for="column in columns"
|
|
5
|
-
:key="column._id"
|
|
6
|
-
:column="column"
|
|
7
|
-
:task="task"
|
|
8
|
-
>
|
|
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">
|
|
9
5
|
<task-list-expander
|
|
10
6
|
v-if="column.expander"
|
|
11
7
|
:tasks="[task]"
|
|
@@ -15,7 +11,6 @@
|
|
|
15
11
|
</item-column>
|
|
16
12
|
</div>
|
|
17
13
|
</template>
|
|
18
|
-
|
|
19
14
|
<script>
|
|
20
15
|
import TaskListExpander from '../Expander.vue';
|
|
21
16
|
import ItemColumn from './ItemColumn.vue';
|
|
@@ -27,8 +22,9 @@ export default {
|
|
|
27
22
|
ItemColumn
|
|
28
23
|
},
|
|
29
24
|
inject: ['root'],
|
|
30
|
-
props:
|
|
31
|
-
|
|
25
|
+
props: ['task'],
|
|
26
|
+
data() {
|
|
27
|
+
return {};
|
|
32
28
|
},
|
|
33
29
|
computed: {
|
|
34
30
|
columns() {
|