gantt: better variable passing from task into markup

This commit is contained in:
STEINNI
2026-09-01 18:55:05 +00:00
parent d027002cb9
commit 2d80fcf447
+8 -5
View File
@@ -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"] })