gantt: better variable passing from task into markup
This commit is contained in:
+8
-5
@@ -149,6 +149,13 @@ class BZgantt extends Buildoz {
|
||||
for(const task of this.tasks){
|
||||
const startIdx = this.getDayIndex(firstDate, new Date(task.start))
|
||||
const taskEndIdx = this.getDayIndex(firstDate, new Date(task.end))
|
||||
const markup = {}
|
||||
for(const [key, value] of Object.entries(task)){
|
||||
if(value == null || typeof value === 'object') continue
|
||||
markup[`task.${key}`] = value
|
||||
}
|
||||
if(!markup['task.color']) markup['task.color'] = '#CCC'
|
||||
markup.width = (startIdx<taskEndIdx) ? (taskEndIdx-startIdx) * this.dayWidth : this.dayWidth
|
||||
flow.nodes.push({
|
||||
"nodeType": "bar",
|
||||
"id": task.id,
|
||||
@@ -156,11 +163,7 @@ class BZgantt extends Buildoz {
|
||||
"x": startIdx * this.dayWidth,
|
||||
"y": curY,
|
||||
},
|
||||
"markup": {
|
||||
"task": task.name,
|
||||
"color": task.color || '#CCC',
|
||||
"width": (startIdx<taskEndIdx) ? (taskEndIdx-startIdx) * this.dayWidth : this.dayWidth,
|
||||
}
|
||||
"markup": markup
|
||||
})
|
||||
for(const dep of task.dependsOn ?? []){
|
||||
flow.links.push({ "from": [dep, "out1"], "to": [task.id, "inp1"] })
|
||||
|
||||
Reference in New Issue
Block a user