Compare commits

..
Author SHA1 Message Date
STEINNI df194dcb65 better columns VS nodes width and placement 2026-10-14 12:26:44 +00:00
STEINNI fcb1e535ca Merge branch 'main' of https://gitea.internike.com/nike/buildoz 2026-10-12 13:51:14 +00:00
STEINNI e71800bd1d taskid as data in gantt 2026-10-12 13:50:42 +00:00
STEINNI 256349d23e Merge branch 'main' of https://gitea.internike.com/nike/buildoz 2026-10-07 09:25:27 +00:00
STEINNI bb1e64218a better gantt vertical alignment 2026-10-07 08:59:22 +00:00
STEINNI 731d6cf55b .gitignore 2026-09-03 13:04:39 +00:00
STEINNI a2c5e1f394 gantt: small css fix 2026-09-02 06:33:47 +00:00
STEINNI 2d80fcf447 gantt: better variable passing from task into markup 2026-09-01 18:55:05 +00:00
STEINNI d027002cb9 gantt: fixed minstart date max endDate to grid on all days 2026-09-01 15:51:15 +00:00
STEINNI 4625067352 gantt days 2026-08-29 14:43:51 +00:00
STEINNI 5a8f93e376 gantt css, dynamic css and colors 2026-08-29 10:13:06 +00:00
STEINNI 6e902b91fd Started bs-gantt 2026-08-28 19:40:56 +00:00
STEINNI 7471a37220 graflow autofit back to percent, and get tween from attr tween 2026-07-30 14:05:33 +00:00
STEINNI 9b0cb2582e better autofit signature 2026-07-30 12:24:26 +00:00
STEINNI 43cd6a85b1 Graflow: Added tween to autofit 2026-07-30 08:48:55 +00:00
STEINNI 47f4e3e6c8 autofit fixed and simplified, thx Mike ! (Mike code readapted for edge cases) 2026-07-29 13:50:47 +00:00
STEINNI dfb1190e7b Merge branch 'main' of https://gitea.internike.com/nike/buildoz 2026-06-22 11:55:06 +00:00
STEINNI 6292a64d82 Merge branch 'main' of https://gitea.internike.com/nike/buildoz 2026-06-22 10:12:40 +00:00
STEINNI e397ee3b2d Merge branch 'main' of https://gitea.internike.com/nike/buildoz 2026-06-22 10:11:28 +00:00
STEINNI 9690401dad Merge branch 'main' of https://gitea.internike.com/nike/buildoz 2026-06-05 15:16:04 +00:00
STEINNI 63f894f526 portal trick on bz-select options 2026-06-05 15:16:01 +00:00
STEINNI 345be1aa23 Merge branch 'main' of https://gitea.internike.com/nike/buildoz 2026-06-04 11:27:24 +00:00
STEINNI e14b0c0214 Merge branch 'main' of https://gitea.internike.com/nike/buildoz 2026-06-04 11:26:51 +00:00
STEINNI d073a2e804 better layout complete events 2026-06-04 11:22:39 +00:00
STEINNI 8f41a39a6e Merge branch 'main' of https://gitea.internike.com/nike/buildoz 2026-05-22 09:17:50 +00:00
STEINNI df6ba88040 Merge branch 'main' of https://gitea.internike.com/nike/buildoz 2026-05-22 09:16:32 +00:00
STEINNI 0b34b37aaf Merge branch 'main' of https://gitea.internike.com/nike/buildoz 2026-05-22 09:15:42 +00:00
STEINNI 694e610ebb fixed bad autoplace if unfocused while autoplacing 2026-05-22 09:13:52 +00:00
STEINNI 3503fd90ab Merge branch 'main' of https://gitea.internike.com/nike/buildoz 2026-05-05 13:26:49 +00:00
STEINNI 0c21f7b772 Graflow: unique refs for arrows to fix arrows in subflows 2026-05-05 13:26:29 +00:00
STEINNI 53ed4eea07 Merge branch 'main' of https://gitea.internike.com/nike/buildoz 2026-04-21 13:58:50 +00:00
STEINNI 7f4e13c5e0 Merge branch 'main' of https://gitea.internike.com/nike/buildoz 2026-03-11 22:07:45 +00:00
STEINNI f39f27efee Merge branch 'main' of https://gitea.internike.com/nike/buildoz 2026-03-10 21:18:42 +00:00
STEINNI bd43063230 Merge branch 'main' of https://gitea.internike.com/nike/buildoz 2026-03-10 21:17:25 +00:00
STEINNI 7d10993b66 Merge branch 'main' of https://gitea.internike.com/nike/buildoz 2026-03-10 21:15:02 +00:00
STEINNI fd270d27da Merge branch 'main' of https://gitea.internike.com/nike/buildoz 2026-03-10 21:09:25 +00:00
13 changed files with 832 additions and 92 deletions

No files matched your search

Executable
+17
View File
@@ -0,0 +1,17 @@
.well-known
/brol
/ui/app/config/config.json
log2mail.php
/ui/log2mail.php
/ui/*.sh
/ui/s3sync*.*
/ui/s3sync*
*.sh
.sparcStudio
.~lock*
/ui/squeezed/*
/ui/app/assets/videos/*
/AGENTS.md
/CLAUDE.md
.vscode
.cursor
+62 -3
View File
@@ -72,7 +72,17 @@ bz-select > div.options-container{
transition: max-height 0.4s ease; transition: max-height 0.4s ease;
} }
bz-select > div.options-container.open{ pointer-events: auto; max-height: 10em;} bz-select > div.options-container.open{ pointer-events: auto; max-height: 10em;}
bz-select option{ div.options-container.portaled{
pointer-events: none;
position: fixed;
z-index: 10000;
max-height: 0;
overflow: auto;
transition: max-height 0.4s ease;
}
div.options-container.portaled.open{ pointer-events: auto; max-height: 10em;}
bz-select option,
div.options-container option{
background-color: #DDD; background-color: #DDD;
border: 1px solid black; border: 1px solid black;
color: #000; color: #000;
@@ -88,12 +98,14 @@ bz-select option{
margin-top 0.3s ease, margin-top 0.3s ease,
opacity 0.3s ease; opacity 0.3s ease;
} }
bz-select option.open{ bz-select option.open,
div.options-container option.open{
margin: 0; margin: 0;
opacity: 1; opacity: 1;
pointer-events: auto; pointer-events: auto;
} }
bz-select option:hover{ bz-select option:hover,
div.options-container option:hover{
background-color: #44F; background-color: #44F;
color: #FFF; color: #FFF;
} }
@@ -359,3 +371,50 @@ bz-grafloweditor .inner-console section .cols-2 input{
max-height: 2em; max-height: 2em;
align-self: center; align-self: center;
} }
bz-gantt{
display: block;
position: relative;
--row: 25px;
--bar-gap: 4px; /* space above & below each bar inside its row */
--chart-left: calc(var(--tasks-width, 7em) + 1em); /* where the chart area starts */
}
bz-gantt ul.tasks{
list-style: none;
padding: 0;
margin: 0;
width: 100%;
}
bz-gantt ul.tasks li{
box-sizing: border-box;
text-wrap: nowrap;
height: var(--row);
line-height: calc(var(--row) - 1px);
border-bottom: 1px dotted #555;
}
bz-gantt.gantt bz-graflow{
position: absolute;
left: var(--chart-left);
top: calc(var(--chart-top, var(--row)) + var(--bar-gap)); /* first task row, measured in refresh(), plus bar centering gap */
right: 0;
bottom: 0;
width: auto; /* cancel the global bz-graflow 100vw/100vh defaults, */
height: auto; /* so the box stretches between its anchored edges */
}
bz-gantt li.header div.day:first-of-type{ border-left: 1px dotted #555; }
bz-gantt li.header div.day{
position: absolute;
/* anchored to bz-gantt (nearest positioned ancestor): spans all rows */
top: var(--bar-gap);
bottom: 0;
border-right: 1px dotted #555;
font-size: .8em;
text-align: center;
}
bz-gantt li.header div.day.today{
background: #AD8;
z-index: 999;
opacity: .3;
}
+109 -15
View File
@@ -135,7 +135,7 @@ class BZselect extends Buildoz {
if(!this.optionscontainer) this.optionscontainer = document.createElement('div') if(!this.optionscontainer) this.optionscontainer = document.createElement('div')
this.optionscontainer.classList.add('options-container') this.optionscontainer.classList.add('options-container')
this.append(this.optionscontainer) this.append(this.optionscontainer)
this.options = this.querySelectorAll('option') this.syncOptions()
if(this.#fillFromMarkup){ //can only do it once and only if fillOptions was not already called !! if(this.#fillFromMarkup){ //can only do it once and only if fillOptions was not already called !!
for(const opt of this.options){ for(const opt of this.options){
this.optionscontainer.append(opt) // Will move is to the right parent this.optionscontainer.append(opt) // Will move is to the right parent
@@ -147,6 +147,15 @@ class BZselect extends Buildoz {
} }
disconnectedCallback() {
if(this.open || this._closing) this.closeDropdown(true)
}
syncOptions() {
if(this.optionscontainer) this.options = this.optionscontainer.querySelectorAll('option')
else this.options = []
}
// static get observedAttributes(){ // Only if you want actions on attr change // static get observedAttributes(){ // Only if you want actions on attr change
// return([...super.observedAttributes, 'disabled']) // return([...super.observedAttributes, 'disabled'])
// } // }
@@ -172,19 +181,104 @@ class BZselect extends Buildoz {
} }
toggle(){ toggle(){
for(const opt of this.options){ if(this.open) this.closeDropdown()
if(this.open) { else this.openDropdown()
opt.classList.remove('open') }
this.optionscontainer.classList.remove('open')
} else { openDropdown() {
document.querySelectorAll('bz-select').forEach((sel) => { document.querySelectorAll('bz-select').forEach((sel) => {
if((sel!==this) && sel.open) sel.toggle() if((sel!==this) && sel.open) sel.closeDropdown(true)
}) })
opt.classList.add('open') this.optionscontainer.classList.add('portaled')
document.body.appendChild(this.optionscontainer)
this.positionPortal()
this.bindPortalListeners()
this.open = true
requestAnimationFrame(() => {
requestAnimationFrame(() => {
if(!this.open) return
this.optionscontainer.classList.add('open') this.optionscontainer.classList.add('open')
for(const opt of this.options) opt.classList.add('open')
})
})
}
closeDropdown(immediate = false) {
if(!this.open) return
this.unbindPortalListeners()
for(const opt of this.options) opt.classList.remove('open')
this.optionscontainer.classList.remove('open')
if(immediate) {
this.clearCloseTransition()
this.finishCloseDropdown()
return
}
this._closing = true
this._onTransitionEnd = (evt) => {
if(evt.target !== this.optionscontainer) return
if(evt.propertyName !== 'max-height') return
this.finishCloseDropdownAfterTransition()
}
this.optionscontainer.addEventListener('transitionend', this._onTransitionEnd)
this._closeTimer = setTimeout(() => this.finishCloseDropdownAfterTransition(), 450)
}
finishCloseDropdownAfterTransition() {
if(!this._closing) return
this.clearCloseTransition()
this.finishCloseDropdown()
}
clearCloseTransition() {
this._closing = false
if(this._closeTimer) clearTimeout(this._closeTimer)
this._closeTimer = null
if(this._onTransitionEnd) {
this.optionscontainer.removeEventListener('transitionend', this._onTransitionEnd)
this._onTransitionEnd = null
}
}
finishCloseDropdown() {
this.optionscontainer.classList.remove('portaled')
this.clearPortalStyles()
if(this.optionscontainer.parentElement !== this) this.append(this.optionscontainer)
this.open = false
}
positionPortal() {
const rect = this.button.getBoundingClientRect()
this.optionscontainer.style.top = `${rect.bottom}px`
this.optionscontainer.style.left = `${rect.left}px`
this.optionscontainer.style.width = `${rect.width}px`
}
clearPortalStyles() {
this.optionscontainer.style.top = ''
this.optionscontainer.style.left = ''
this.optionscontainer.style.width = ''
}
bindPortalListeners() {
this._repositionBound = this.positionPortal.bind(this)
window.addEventListener('scroll', this._repositionBound, true)
window.addEventListener('resize', this._repositionBound)
this._outsideClickBound = (evt) => {
if(this.open && !this.contains(evt.target) && !this.optionscontainer.contains(evt.target)) {
this.closeDropdown()
} }
} }
this.open = !this.open this._outsideClickTimer = setTimeout(() => {
document.addEventListener('click', this._outsideClickBound, true)
}, 0)
}
unbindPortalListeners() {
if(this._repositionBound) window.removeEventListener('scroll', this._repositionBound, true)
if(this._repositionBound) window.removeEventListener('resize', this._repositionBound)
if(this._outsideClickBound) document.removeEventListener('click', this._outsideClickBound, true)
if(this._outsideClickTimer) clearTimeout(this._outsideClickTimer)
this._outsideClickTimer = null
} }
onClick(evt){ onClick(evt){
@@ -196,7 +290,7 @@ class BZselect extends Buildoz {
onOption(value, silent=false){ onOption(value, silent=false){
if(this.getAttribute('disabled') !== null) return if(this.getAttribute('disabled') !== null) return
this.value = value this.value = value
if(!silent) this.toggle() if(!silent && this.open) this.closeDropdown()
} }
addOption(value, markup){ addOption(value, markup){
@@ -207,16 +301,16 @@ class BZselect extends Buildoz {
opt.addEventListener('click',this.onClick.bind(this)) opt.addEventListener('click',this.onClick.bind(this))
if(!this.optionscontainer) this.optionscontainer = document.createElement('div') if(!this.optionscontainer) this.optionscontainer = document.createElement('div')
this.optionscontainer.append(opt) this.optionscontainer.append(opt)
this.options = this.querySelectorAll('option') this.syncOptions()
this.#fillFromMarkup = false this.#fillFromMarkup = false
} }
fillOptions(opts, erase = true){ fillOptions(opts, erase = true){
// Caution: you cannot count on connectedCallback to have run already, because one might fill before adding to the DOM // Caution: you cannot count on connectedCallback to have run already, because one might fill before adding to the DOM
if(erase){ if(erase){
this.options = this.querySelectorAll('option') this.syncOptions()
this.options.forEach(node => { node.remove() }) this.options.forEach(node => { node.remove() })
this.options = this.querySelectorAll('option') this.syncOptions()
this.onOption('', true) // unselect last this.onOption('', true) // unselect last
} }
for(const opt of opts) this.addOption(opt.value, opt.markup) for(const opt of opts) this.addOption(opt.value, opt.markup)
+236
View File
@@ -0,0 +1,236 @@
/**
* _ ___ Another
* / |/ (_)______ __ _____
* / / / __(_-</ // (_-<
* /_/|_/_/\__/___/\_, /___/
* /___/
* production !
*
* Licensed under the MIT License:
* This code is free to use and modify,
* as long as the copyright notice and license are kept.
*/
class BZgantt extends Buildoz {
constructor(){
super()
this.defaultAttrs = { }
}
async connectedCallback(){
await customElements.whenDefined('bz-graflow')
super.connectedCallback()
this.rowHeight = parseFloat(getComputedStyle(this).getPropertyValue('--row')) || 30
this.ul = document.createElement('ul')
this.ul.classList.add('tasks')
this.append(this.ul)
this.graflow = document.createElement('bz-graflow')
this._syncAttributesToGraflow()
this.append(this.graflow)
this.fireEvent('domConnected', { gantt: this })
this.dayWidth = this.getBZAttribute('daywidth') || 20
this.dayWidthPadding = 10
if(this.getBZAttribute('nodesfile')) this.nodesfile = this.getBZAttribute('nodesfile')
else this.initGantt()
const dataSrc = this.getBZAttribute('src')
if(dataSrc) this.loadData(dataSrc)
else this.gantt = { "tasks": [] }
}
_syncAttributesToGraflow(){
for(const attr of this.attributes){
if(attr.name === 'flow') continue
this.graflow.setAttribute(attr.name, attr.value)
}
}
async loadData(dataSrc){
let buf, ganttObj
if(dataSrc instanceof Blob){
buf = await dataSrc.text()
try{
ganttObj = JSON.parse(buf)
} catch(err){
this.error('Could not parse gantt data JSON!?', err)
return
}
} else if(typeof dataSrc == 'string') {
const url = dataSrc
const fetchUrl = (typeof url === 'string' && !url.startsWith('blob:') && !url.startsWith('data:'))
? (url + '?' + crypto.randomUUID())
: url
const res = await fetch(fetchUrl)
buf = await res.text()
try{
ganttObj = JSON.parse(buf)
} catch(err){
this.error('Could not parse gantt data JSON!?', err)
return
}
} else if(typeof dataSrc == 'object') {
ganttObj = structuredClone(dataSrc)
}
if(!ganttObj.nodesFile){
if(this.getBZAttribute('nodesfile')) ganttObj.nodesFile = this.getBZAttribute('nodesfile')
else {
this.error('No nodesFile in JSON!?')
return
}
}
this.tasks = ganttObj.tasks
this.reorder_tasks()
await this.graflow.loadNodes(ganttObj.nodesFile)
this.refresh()
this.fireEvent('ganttDataLoaded', {
component: this,
})
}
reorder_tasks(){
const byId = new Map(this.tasks.map(t => [t.id, t]))
const children = new Map(this.tasks.map(t => [t.id, []]))
for(const task of this.tasks){
for(const dep of task.dependsOn ?? []){
if(children.has(dep)) children.get(dep).push(task)
}
}
// Subtree weight: number of (unique) descendants of a task
const descendants = new Map()
const countDescendants = (task, seen) => {
for(const child of children.get(task.id)){
if(seen.has(child.id)) continue
seen.add(child.id)
countDescendants(child, seen)
}
return(seen.size)
}
for(const task of this.tasks) descendants.set(task.id, countDescendants(task, new Set()))
const byWeight = (a, b) => descendants.get(a.id) - descendants.get(b.id)
// Depth-first walk, a task is placed once all its dependencies are placed
const ordered = []
const placed = new Set()
const ready = task => (task.dependsOn ?? []).every(dep => placed.has(dep) || !byId.has(dep))
const visit = task => {
if(placed.has(task.id) || !ready(task)) return
placed.add(task.id)
ordered.push(task)
for(const child of [...children.get(task.id)].sort(byWeight)) visit(child)
}
const roots = this.tasks.filter(t => !(t.dependsOn?.length)).sort(byWeight)
for(const root of roots) visit(root)
// Leftovers (circular dependencies) keep their original order
for(const task of this.tasks) if(!placed.has(task.id)) ordered.push(task)
this.tasks = ordered
}
getDayIndex(firstDate, date){
return Math.ceil((date-firstDate)/86400000)
}
buildFlow(){
let firstDate = new Date(this.tasks[0].start)
let lastDate = new Date(this.tasks[0].end)
for(const task of this.tasks){
const startDate = new Date(task.start)
const endDate = new Date(task.end)
if(startDate < firstDate) firstDate = startDate
if(endDate > lastDate) lastDate = endDate
}
const flow = { "nodes": [], "links": [] }
let curY = 0
const endIdx = this.getDayIndex(firstDate, lastDate)
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,
"coords": {
"x": (startIdx * this.dayWidth) + (startIdx > 0 ? this.dayWidthPadding : 0),
"y": curY,
},
"markup": markup
})
for(const dep of task.dependsOn ?? []){
flow.links.push({ "from": [dep, "out1"], "to": [task.id, "inp1"] })
}
curY += this.rowHeight
}
return([flow, firstDate, endIdx])
}
refresh(){
this.ul.innerHTML = ''
this.headerLi = document.createElement('li')
this.headerLi.classList.add('header')
this.ul.appendChild(this.headerLi)
for(const task of this.tasks){
const li = document.createElement('li')
li.textContent = task.name
li.setAttribute('data-id', task.id)
this.ul.appendChild(li)
}
// Publish the widest label width, used by CSS to place the graflow
const range = document.createRange()
let maxWidth = 0
for(const li of this.ul.children){
range.selectNodeContents(li)
maxWidth = Math.max(maxWidth, range.getBoundingClientRect().width)
}
this.style.setProperty('--tasks-width', Math.ceil(maxWidth) + 'px')
const taskLis = [...this.ul.children].slice(1)
const row = parseFloat(getComputedStyle(this).getPropertyValue('--row')) || this.rowHeight || 25
if(taskLis[0] && taskLis[0].offsetHeight){
this.rowHeight = taskLis[1] ? (taskLis[1].offsetTop - taskLis[0].offsetTop) : taskLis[0].offsetHeight
this.style.setProperty('--chart-top', `${taskLis[0].offsetTop}px`)
} else {
this.rowHeight = row
this.style.setProperty('--chart-top', `${row}px`)
}
const [flow, firstDate, endIdx] = this.buildFlow()
let dayDate = new Date(firstDate)
for(let idx=0; idx<=endIdx; idx++){
const dayDiv = document.createElement('div')
dayDiv.classList.add('day')
dayDiv.style.left = `calc(var(--chart-left) + ${idx * (this.dayWidth + this.dayWidthPadding)}px)`
dayDiv.style.width = (this.dayWidth + this.dayWidthPadding) + 'px'
dayDiv.innerHTML = '&nbsp;' + dayDate.getDate()
if(dayDate.toISOString().substring(0,10) == (new Date()).toISOString().substring(0,10)) dayDiv.classList.add('today')
dayDiv.setAttribute('title', new Intl.DateTimeFormat('fr-FR', {
timeZone: 'Europe/Paris',
day: '2-digit',
month: '2-digit',
year: '2-digit'
}).format(dayDate))
dayDate.setDate(dayDate.getDate() + 1)
this.headerLi.appendChild(dayDiv)
}
this.graflow.loadFlow({
"nodesFile": this.nodesfile,
"flow": flow
})
this.graflow.refresh()
}
}
Buildoz.define('gantt', BZgantt)
-1
View File
@@ -14,7 +14,6 @@ class BZgrafloweditor extends Buildoz{
constructor(){ constructor(){
super() super()
this.defaultAttrs = { } this.defaultAttrs = { }
window.debugEditor = this
} }
async connectedCallback() { async connectedCallback() {
+151 -64
View File
@@ -30,6 +30,7 @@ class BZgraflow extends Buildoz{
this.stagedNodes = { } this.stagedNodes = { }
this.stagedWires = { } this.stagedWires = { }
this.arrowDefs = null this.arrowDefs = null
this.arrowMarkerId = `arrow-${crypto.randomUUID()}`
this.currentOrientation = null this.currentOrientation = null
} }
@@ -184,6 +185,8 @@ class BZgraflow extends Buildoz{
for(const tpl of doc.querySelectorAll('template')){ for(const tpl of doc.querySelectorAll('template')){
if(tpl.id=='svg-arrows'){ if(tpl.id=='svg-arrows'){
this.arrowDefs = tpl.querySelector('defs').cloneNode(true) this.arrowDefs = tpl.querySelector('defs').cloneNode(true)
const defaultArrow = this.arrowDefs.querySelector('#arrow')
if(defaultArrow) defaultArrow.id = this.arrowMarkerId
this.wiresContainer.appendChild(this.arrowDefs) this.wiresContainer.appendChild(this.arrowDefs)
} else { } else {
const rootEl = tpl.content.querySelector('.bzgf-node') const rootEl = tpl.content.querySelector('.bzgf-node')
@@ -227,8 +230,8 @@ class BZgraflow extends Buildoz{
} }
if(typeof(node.data)=='object') Object.assign(this.stagedNodes[id].dataset, node.data) if(typeof(node.data)=='object') Object.assign(this.stagedNodes[id].dataset, node.data)
const portEls = this.stagedNodes[id].querySelectorAll('.port') const portEls = this.stagedNodes[id].querySelectorAll('.port')
this.stagedNodes[id].style.left = (node.coords && node.coords.x) ? `${node.coords.x}px` : '10%' this.stagedNodes[id].style.left = (node.coords && node.coords.x != null) ? `${node.coords.x}px` : '10%'
this.stagedNodes[id].style.top = (node.coords && node.coords.y) ? `${node.coords.y}px` : '10%' this.stagedNodes[id].style.top = (node.coords && node.coords.y != null) ? `${node.coords.y}px` : '10%'
this.stagedNodes[id].dataset.id = id this.stagedNodes[id].dataset.id = id
this.stagedNodes[id].ports = Object.fromEntries(Array.from(portEls).map(item => ([item.dataset.id, { ...item.dataset, el:item }]))) this.stagedNodes[id].ports = Object.fromEntries(Array.from(portEls).map(item => ([item.dataset.id, { ...item.dataset, el:item }])))
if(node.subflow) { if(node.subflow) {
@@ -463,8 +466,8 @@ class BZgraflow extends Buildoz{
this.stagedWires[id] = document.createElementNS('http://www.w3.org/2000/svg', 'path') this.stagedWires[id] = document.createElementNS('http://www.w3.org/2000/svg', 'path')
this.stagedWires[id].setAttribute('d', path) this.stagedWires[id].setAttribute('d', path)
this.stagedWires[id].setAttribute('fill', 'none') this.stagedWires[id].setAttribute('fill', 'none')
if(this.arrowDefs && link.endArrow) this.stagedWires[id].setAttribute('marker-end','url(#arrow)') if(this.arrowDefs && link.endArrow) this.stagedWires[id].setAttribute('marker-end',`url(#${this.arrowMarkerId})`)
if(this.arrowDefs && link.startArrow) this.stagedWires[id].setAttribute('marker-start','url(#arrow)') if(this.arrowDefs && link.startArrow) this.stagedWires[id].setAttribute('marker-start',`url(#${this.arrowMarkerId})`)
this.stagedWires[id].classList.add('bzgf-wire') this.stagedWires[id].classList.add('bzgf-wire')
this.stagedWires[id].dataset.id = id this.stagedWires[id].dataset.id = id
this.stagedWires[id].link = link this.stagedWires[id].link = link
@@ -487,7 +490,7 @@ class BZgraflow extends Buildoz{
this.clear() this.clear()
let forceAutoplace = false let forceAutoplace = false
for(const node of this.flow.nodes){ for(const node of this.flow.nodes){
if((!node.coords) || (!node.coords.x) ||(!node.coords.y)) forceAutoplace=true if((!node.coords) || (node.coords.x == null) || (node.coords.y == null)) forceAutoplace=true
this.addNode(node) this.addNode(node)
} }
for(const link of this.flow.links){ for(const link of this.flow.links){
@@ -502,15 +505,97 @@ class BZgraflow extends Buildoz{
else this.currentOrientation = 'vertical' else this.currentOrientation = 'vertical'
} }
} }
if(forceAutoplace) this.autoPlace(this.currentOrientation, parseInt(this.getBZAttribute('gapx')) || 80, parseInt(this.getBZAttribute('gapy')) || 80) const gapx = parseInt(this.getBZAttribute('gapx')) || 80
this.fireEvent('refreshed', { }) const gapy = parseInt(this.getBZAttribute('gapy')) || 80
if(this.hasAttribute('autofit')){ const finishRefresh = () => {
const autofitAttr = this.getAttribute('autofit') this.fireEvent('refreshed', { })
const autofitPercent = (autofitAttr !== null && autofitAttr !== '' && !Number.isNaN(parseFloat(autofitAttr))) if(this.hasAttribute('autofit')){
? parseFloat(autofitAttr) const autofitAttr = this.getAttribute('autofit')
: undefined const autofitPerc = (autofitAttr !== null && autofitAttr !== '' && !Number.isNaN(parseFloat(autofitAttr)))
this.autofit(autofitPercent) ? parseFloat(autofitAttr)
: undefined
if(this._canRunAutoPlace()) this.autofit(autofitPerc)
else this._scheduleLayoutWhenReady(() => this.autofit(autofitPerc))
}
} }
const onLayoutComplete = () => {
this.fireEvent('layoutComplete', { })
finishRefresh()
}
if(forceAutoplace) this._scheduleAutoPlaceWhenReady(this.currentOrientation, gapx, gapy, onLayoutComplete)
else onLayoutComplete()
}
disconnectedCallback(){
this._disconnectLayoutObserver()
super.disconnectedCallback?.()
}
_disconnectLayoutObserver(){
if(this._layoutObserver) {
this._layoutObserver.disconnect()
this._layoutObserver = null
}
}
_canRunAutoPlace(){
let nodesHaveLayoutSize = false
const ids = Object.keys(this.stagedNodes || {})
if(ids.length === 0) return(true)
for(const nid of ids){
if(nid.startsWith('longLinkPlaceHolder_')) continue
const el = this.stagedNodes[nid]
if(el && (el.offsetWidth > 0 || el.offsetHeight > 0)) {
nodesHaveLayoutSize=true
break
}
}
return((this.clientWidth > 0 && this.clientHeight > 0) && nodesHaveLayoutSize)
}
/**
* autoPlace uses offsetWidth/offsetHeight; when the host is hidden (display:none / off-screen view)
* those are 0 and layout is wrong. Defer until the element is measurable.
*/
_scheduleLayoutWhenReady(callback){
this._layoutScheduleToken = (this._layoutScheduleToken || 0) + 1
const token = this._layoutScheduleToken
this._disconnectLayoutObserver()
const attempt = () => {
if(token !== this._layoutScheduleToken) return(true)
if(!this._canRunAutoPlace()) return(false)
this._disconnectLayoutObserver()
callback()
return(true)
}
if(attempt()) return
this._layoutObserver = new ResizeObserver(() => { attempt() })
this._layoutObserver.observe(this)
let frames = 0
const rafPoll = () => {
if(token !== this._layoutScheduleToken) return
if(attempt()) return
if(++frames < 12) requestAnimationFrame(rafPoll)
}
requestAnimationFrame(rafPoll)
}
_scheduleAutoPlaceWhenReady(orientation, gapx, gapy, onLayoutComplete){
this._scheduleLayoutWhenReady(() => {
this.autoPlace(orientation, gapx, gapy, null, null, onLayoutComplete)
})
}
_maybeFireLayoutComplete(){
if(this._layoutMovePending > 0) return
if(!this._layoutCompleteHandler) return
const fn = this._layoutCompleteHandler
this._layoutCompleteHandler = null
fn()
} }
// Convert viewport (client) coordinates to this instance's SVG local coordinates. // Convert viewport (client) coordinates to this instance's SVG local coordinates.
@@ -700,7 +785,7 @@ class BZgraflow extends Buildoz{
return(path) return(path)
} }
autoPlace(orientation = null, gapx = null, gapy = null, tween = null, align = null){ autoPlace(orientation = null, gapx = null, gapy = null, tween = null, align = null, onLayoutComplete = null){
if(orientation == null) orientation = this.getBZAttribute('orientation') || this.currentOrientation || 'horizontal' if(orientation == null) orientation = this.getBZAttribute('orientation') || this.currentOrientation || 'horizontal'
if(gapx == null) gapx = parseInt(this.getBZAttribute('gapx')) || 80 if(gapx == null) gapx = parseInt(this.getBZAttribute('gapx')) || 80
if(gapy == null) gapy = parseInt(this.getBZAttribute('gapy')) || 80 if(gapy == null) gapy = parseInt(this.getBZAttribute('gapy')) || 80
@@ -712,6 +797,9 @@ class BZgraflow extends Buildoz{
// moveNode() checks this token each frame and will no-op if superseded. // moveNode() checks this token each frame and will no-op if superseded.
this._autoPlaceToken = (this._autoPlaceToken || 0) + 1 this._autoPlaceToken = (this._autoPlaceToken || 0) + 1
const token = this._autoPlaceToken const token = this._autoPlaceToken
this._layoutMovePending = 0
this._layoutCompleteToken = token
this._layoutCompleteHandler = (typeof onLayoutComplete === 'function') ? onLayoutComplete : null
// Cleanup placeholders from previous autoPlace() runs. // Cleanup placeholders from previous autoPlace() runs.
// Each run creates new longLinkPlaceHolder_* IDs; without cleanup they accumulate in the DOM. // Each run creates new longLinkPlaceHolder_* IDs; without cleanup they accumulate in the DOM.
@@ -835,7 +923,7 @@ class BZgraflow extends Buildoz{
y = Math.max(parentsY[parents[nid][0]], y) //TODO handle multiple parents with avg y = Math.max(parentsY[parents[nid][0]], y) //TODO handle multiple parents with avg
} }
placedY = y placedY = y
this.moveNode(nid, x, y, orientation, tween, null, token) this.moveNode(nid, x, y, orientation, tween, token)
if((align == 'parent') && (nid in parents) && (parents[nid][0] in parentsY)) { if((align == 'parent') && (nid in parents) && (parents[nid][0] in parentsY)) {
parentsY[parents[nid][0]] += gapy + nodeHeight parentsY[parents[nid][0]] += gapy + nodeHeight
} else { } else {
@@ -848,7 +936,7 @@ class BZgraflow extends Buildoz{
} }
placedY = y placedY = y
this.addFakeNode(nid, x, y, wMax*0.75, fakeNodeHeight) this.addFakeNode(nid, x, y, wMax*0.75, fakeNodeHeight)
this.moveNode(nid, x, y, orientation, tween, null, token) this.moveNode(nid, x, y, orientation, tween, token)
// Never increment parentsY for fake nodes: they're placeholders and must not disalign real children // Never increment parentsY for fake nodes: they're placeholders and must not disalign real children
y = Math.max(y, placedY + gapy + fakeNodeHeight) y = Math.max(y, placedY + gapy + fakeNodeHeight)
} }
@@ -869,7 +957,7 @@ class BZgraflow extends Buildoz{
!nid.startsWith('longLinkPlaceHolder_') && nid in parents && parents[nid][0] === pid !nid.startsWith('longLinkPlaceHolder_') && nid in parents && parents[nid][0] === pid
) )
if(firstRealChild && nodeY[pid] !== nodeY[firstRealChild]){ if(firstRealChild && nodeY[pid] !== nodeY[firstRealChild]){
this.moveNode(pid, nodeX[pid], nodeY[firstRealChild], orientation, tween, null, token) this.moveNode(pid, nodeX[pid], nodeY[firstRealChild], orientation, tween, token)
nodeY[pid] = nodeY[firstRealChild] nodeY[pid] = nodeY[firstRealChild]
} }
} }
@@ -898,17 +986,18 @@ class BZgraflow extends Buildoz{
for(const nid of layer){ for(const nid of layer){
if(!nid.startsWith('longLinkPlaceHolder_')){ if(!nid.startsWith('longLinkPlaceHolder_')){
const bb = this.stagedNodes[nid].getBoundingClientRect() const bb = this.stagedNodes[nid].getBoundingClientRect()
this.moveNode(nid, x, y, orientation, tween, null, token) this.moveNode(nid, x, y, orientation, tween, token)
x += gapx + (this.stagedNodes[nid].offsetWidth || bb.width) x += gapx + (this.stagedNodes[nid].offsetWidth || bb.width)
} else { } else {
this.addFakeNode(nid, x, y, fakeNodeWidth, hMax*0.75) this.addFakeNode(nid, x, y, fakeNodeWidth, hMax*0.75)
this.moveNode(nid, x, y, orientation, tween, null, token) this.moveNode(nid, x, y, orientation, tween, token)
x += gapx + fakeNodeWidth x += gapx + fakeNodeWidth
} }
} }
y += hMax + gapy y += hMax + gapy
} }
} }
this._maybeFireLayoutComplete()
} }
clearFakeNodes(){ clearFakeNodes(){
@@ -1028,17 +1117,34 @@ class BZgraflow extends Buildoz{
} }
moveNode(nid, destx, desty, orientation, duration = 200, autoPlaceToken = null) { moveNode(nid, destx, desty, orientation, duration = 200, autoPlaceToken = null) {
const t0 = performance.now()
const el0 = this.stagedNodes?.[nid] const el0 = this.stagedNodes?.[nid]
if(!el0) return if(!el0) return
let layoutTracked = false
if(autoPlaceToken != null && autoPlaceToken === this._layoutCompleteToken) {
layoutTracked = true
this._layoutMovePending++
}
const finishLayoutMove = () => {
if(!layoutTracked) return
layoutTracked = false
this._layoutMovePending = Math.max(0, this._layoutMovePending - 1)
this._maybeFireLayoutComplete()
}
const t0 = performance.now()
const bb = el0.getBoundingClientRect() const bb = el0.getBoundingClientRect()
const parentbb = el0.parentElement.getBoundingClientRect() const parentbb = el0.parentElement.getBoundingClientRect()
const x0=bb.x - parentbb.x const x0=bb.x - parentbb.x
const y0 = bb.y - parentbb.y const y0 = bb.y - parentbb.y
function frame(t) { function frame(t) {
if(autoPlaceToken && autoPlaceToken !== this._autoPlaceToken) return if(autoPlaceToken && autoPlaceToken !== this._autoPlaceToken) {
finishLayoutMove()
return
}
const el = this.stagedNodes?.[nid] const el = this.stagedNodes?.[nid]
if(!el) return if(!el) {
finishLayoutMove()
return
}
const p = Math.min((t - t0) / duration, 1) const p = Math.min((t - t0) / duration, 1)
const k = p * p * (3 - 2 * p) // smoothstep const k = p * p * (3 - 2 * p) // smoothstep
const x = x0 + (destx - x0) * k const x = x0 + (destx - x0) * k
@@ -1056,6 +1162,7 @@ class BZgraflow extends Buildoz{
flowNode.coords.y = y flowNode.coords.y = y
} }
this.fireEvent('nodeMoved', { nid, x, y }) this.fireEvent('nodeMoved', { nid, x, y })
finishLayoutMove()
} }
} }
requestAnimationFrame(frame.bind(this)) requestAnimationFrame(frame.bind(this))
@@ -1226,50 +1333,30 @@ class BZgraflow extends Buildoz{
} }
autofit(percent=100){ autofit(percent=100){
if(!this.parentElement) return const outwidth = Math.max(this.clientWidth, 1)
const outheight = Math.max(this.clientHeight, 1)
const prevTransformOrigin = this.style.transformOrigin let inwidth = this.nodesContainer.scrollWidth
this.style.transform = 'none' let inheight = this.nodesContainer.scrollHeight
this.style.transformOrigin = 'top left' try { // SVG scrollWidth ignores overflowing paths; getBBox() covers wire extent.
const wireBB = this.wiresContainer.getBBox()
// Measure real content by unioning viewport-space bounding boxes. if(wireBB.width > 0 || wireBB.height > 0){
// This is robust with overflow:auto and absolute-positioned layers. inwidth = Math.max(inwidth, wireBB.x + wireBB.width)
let left = Infinity inheight = Math.max(inheight, wireBB.y + wireBB.height)
let top = Infinity }
let right = -Infinity } catch(_){ // getBBox throws if SVG not rendered yet, but should not happen as we have _canRunAutoPlace() / _scheduleLayoutWhenReady()
let bottom = -Infinity return
const includeBB = (bb) => {
if(!bb) return
left = Math.min(left, bb.left)
top = Math.min(top, bb.top)
right = Math.max(right, bb.right)
bottom = Math.max(bottom, bb.bottom)
} }
const ratio = Math.min( (outwidth / inwidth), (outheight / inheight) ) * (percent / 100)
this.nodesContainer?.querySelectorAll?.('.bzgf-node').forEach(nodeEl => includeBB(nodeEl.getBoundingClientRect())) const tween = parseInt(this.getBZAttribute('tween')) || 0
this.wiresContainer?.querySelectorAll?.('path.bzgf-wire').forEach(path => includeBB(path.getBoundingClientRect())) if(tween > 0){
const transition = `scale ${tween}ms ease-in-out`
const parentBB = this.parentElement.getBoundingClientRect() this.nodesContainer.style.transition = transition
const gapx = parseInt(this.getBZAttribute('gapx')) || 80 this.wiresContainer.style.transition = transition
const gapy = parseInt(this.getBZAttribute('gapy')) || 80
const rawW = Number.isFinite(left) && Number.isFinite(right) ? Math.max(right - left, 1) : Math.max(this.mainContainer?.clientWidth || this.offsetWidth || 1, 1)
const rawH = Number.isFinite(top) && Number.isFinite(bottom) ? Math.max(bottom - top, 1) : Math.max(this.mainContainer?.clientHeight || this.offsetHeight || 1, 1)
const contentW = rawW + (2 * gapx)
const contentH = rawH + (2 * gapy)
const sx = parentBB.width / contentW
const sy = parentBB.height / contentH
const scale = Math.min(sx, sy)*(percent/100) // uniform scale to fit inside parent
const tx = Number.isFinite(left) ? (-left + gapx) : gapx
const ty = Number.isFinite(top) ? (-top + gapy) : gapy
if(!this.isSubflow) {
this.style.transformOrigin = prevTransformOrigin || 'top left'
this.style.transform = `scale(${scale}) translate(${tx}px, ${ty}px)`
} else {
this.style.transform = `scale(${scale})`
this.style.width = `calc(100% / ${scale})` // means 100% of the parent node DESPITE the scaling
this.style.height = `calc(100% / ${scale})` // means 100% of the parent node DESPITE the scaling
} }
this.nodesContainer.style.scale = ratio
this.wiresContainer.style.scale = ratio
this.nodesContainer.style.transformOrigin = 'top left'
this.wiresContainer.style.transformOrigin = 'top left'
} }
} }
Buildoz.define('graflow', BZgraflow) Buildoz.define('graflow', BZgraflow)
+62
View File
@@ -0,0 +1,62 @@
{
"nodesFile": "./nodesLib/nodesGantt.html",
"flow": {
"nodes":[
{ "nodeType": "bar",
"id": "t1",
"coords": { "x": 20, "y": 0},
"markup": { "task": "Task 1", "color": "#0F0", "width": 160 }
},
{ "nodeType": "bar",
"id": "t2",
"coords": { "x": 510, "y": 180},
"markup": { "task": "Task 2", "color": "#CCF", "width": 60 }
},
{ "nodeType": "bar",
"id": "t3",
"coords": { "x": 570, "y": 240},
"markup": { "task": "Task 3", "color": "#FFC", "width": 100 }
},
{ "nodeType": "bar",
"id": "t4",
"coords": { "x": 20, "y": 60},
"markup": { "task": "Task 4", "color": "#FCF", "width": 260 }
},
{ "nodeType": "bar",
"id": "t5",
"coords": { "x": 280, "y": 90},
"markup": { "task": "Task 5", "color": "#CFF", "width": 30 }
},
{ "nodeType": "bar",
"id": "t6",
"coords": { "x": 310, "y": 120},
"markup": { "task": "Task 6", "color": "#FFC", "width": 40 }
},
{ "nodeType": "bar",
"id": "t7",
"coords": { "x": 180, "y": 30},
"markup": { "task": "Task 7", "color": "#FCF", "width": 80 }
},
{ "nodeType": "bar",
"id": "t8",
"coords": { "x": 350, "y": 150},
"markup": { "task": "Task 8", "color": "#CFF", "width": 160 }
},
{ "nodeType": "bar",
"id": "t9",
"coords": { "x": 510, "y": 210},
"markup": { "task": "Task 9", "color": "#FFC", "width": 60 }
}
],
"links": [
{ "from": ["t1", "out1"], "to": ["t7", "inp1"] },
{ "from": ["t7", "out1"], "to": ["t5", "inp1"] },
{ "from": ["t8", "out1"], "to": ["t2", "inp1"] },
{ "from": ["t9", "out1"], "to": ["t3", "inp1"] },
{ "from": ["t4", "out1"], "to": ["t5", "inp1"] },
{ "from": ["t5", "out1"], "to": ["t6", "inp1"] },
{ "from": ["t6", "out1"], "to": ["t8", "inp1"] },
{ "from": ["t8", "out1"], "to": ["t9", "inp1"] }
]
}
}
+38
View File
@@ -0,0 +1,38 @@
<style>
.bzgf-node {
font-family: Arial, Helvetica, sans-serif;
color: black;
text-align: center;
position: absolute;
}
.bzgf-node .body{
border-radius: 4px;
overflow: hidden;
height: calc(var(--row, 30px) - 2 * var(--bar-gap, 8px));
line-height: calc(var(--row, 30px) - 2 * var(--bar-gap, 8px));
text-overflow: ellipsis;
white-space: nowrap;
font-size: .9em;
padding: 0 2px 0 2px;
}
.bzgf-node .port{
position: absolute;
height: 1px;
width: 1px;
}
.bzgf-node [data-direction="w"]{ left: -4px; top: 50%; }
.bzgf-node [data-direction="e"]{ right: -4px; top: 50%; }
.bzgf-wire{ stroke: #AAA; stroke-width: 1; }
</style>
<template>
<div class="bzgf-node" data-nodetype="bar">
<div class="port" data-type="in" data-id="inp1" data-direction="w"></div>
<div class="port" data-type="out" data-id="out1" data-direction="e"></div>
<div class="body" style="background-color:{color};width:{width}px;" title="{task}">{task}</div>
</div>
</template>
+12
View File
@@ -126,6 +126,18 @@
<td>X</td> <td>X</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td><a target="test6" href="./test7.html">test7</a></td>
<td>Gantt chart 1</td>
<td>YES</td>
<td></td>
<td></td>
<td>Bezier</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody> </tbody>
</table> </table>
<br> <br>
+1 -1
View File
@@ -79,7 +79,7 @@
</head> </head>
<body> <body>
<bz-graflow class="eic" flow="./flows/testFlowEic.json" tension="60"> <bz-graflow class="eic" flow="./flows/testFlowEic.json" tension="60" autofit="500">
<div class="demooptions"> <!-- just for demo purposes --> <div class="demooptions"> <!-- just for demo purposes -->
<button data-trigger="onAutoplace2H">Auto-place Horizontal</button> <button data-trigger="onAutoplace2H">Auto-place Horizontal</button>
<button data-trigger="onAutoplace2V">Auto-place Vertical</button> <button data-trigger="onAutoplace2V">Auto-place Vertical</button>
+13 -8
View File
@@ -45,19 +45,25 @@
font-size: 1em; font-size: 1em;
} }
bz-graflow{ bz-graflow{
overflow: scroll;
border: 2px solid black; border: 2px solid black;
} }
bz-graflow.icmp{ grid-column: 1 / -1; width: 100vw; height: 80vh; background: var(--eicui-base-color-grey-10); } /* Fill the demo frame — autofit sizes to the graflow box, not the parent */
bz-graflow.icmp{
width: 100%;
height: 100%;
background: var(--eicui-base-color-grey-10);
}
.container { .container {
resize: both; resize: both;
overflow: auto; /* required in practice */ overflow: hidden;
min-width: 800px; width: 90vw;
min-height: 300px; height: 80vh;
border: 1px solid #999; min-width: 400px;
min-height: 240px;
padding: 0; padding: 0;
position: relative; position: relative;
border:2px solid #A00 border: 2px solid #A00;
box-sizing: border-box;
} }
.container::after { .container::after {
content: ""; content: "";
@@ -102,7 +108,6 @@
) )
const el = document.querySelector('.container') const el = document.querySelector('.container')
let timer = null // debounce
const ro = new ResizeObserver(([entry]) => { const ro = new ResizeObserver(([entry]) => {
const grfl = entry.target.querySelector('bz-graflow') const grfl = entry.target.querySelector('bz-graflow')
grfl.autofit() grfl.autofit()
+76
View File
@@ -0,0 +1,76 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>graflow</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link type="text/css" rel="stylesheet" href="../../eicui/eicui-2.0.css">
<link type="text/css" rel="stylesheet" href="../buildoz.css">
<script src="../buildoz.js"></script>
<script src="../bzGraflow.js"></script>
<style>
@font-face { /*FF does not indirectly load if inside a shawdow-dom */
font-family: 'glyphs';
src: url('/assets/styles/fonts/glyphs.eot');
src: url('/assets/styles/fonts/glyphs.eot') format('embedded-opentype'),
url('/assets/styles/fonts/glyphs.ttf') format('truetype'),
url('/assets/styles/fonts/glyphs.woff') format('woff'),
url('/assets/styles/fonts/glyphs.svg') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
}
body{
background:#888;
font-size: 16px;
}
.gantt-wrap{
position: relative;
--row: 30px;
}
ul.tasks{
list-style: none;
padding: 0;
margin: 0;
width: 100%;
}
ul.tasks li{
box-sizing: border-box;
text-wrap: nowrap;
height: var(--row);
line-height: calc(var(--row) - 1px);
border-bottom: 1px dotted #555;
}
bz-graflow.gantt{
position: absolute;
left: 10em;
top: 6px;
right: 0;
bottom: 0;
}
</style>
<script>
window.addEventListener('load',()=>{
let grflw1 = document.querySelector('bz-graflow.gantt')
})
</script>
</head>
<body>
<div class="gantt-wrap">
<ul class="tasks">
<li>Task 1</li>
<li>Task 7</li>
<li>Task 4</li>
<li>Task 5</li>
<li>Task 6</li>
<li>Task 8</li>
<li>Task 2</li>
<li>Task 9</li>
<li>Task 3</li>
</ul>
<bz-graflow class="gantt" flow="./flows/gantt.json" tension="60" isolated></bz-graflow>
</div>
</body>
</html>
+55
View File
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>graflow</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link type="text/css" rel="stylesheet" href="../../eicui/eicui-2.0.css">
<link type="text/css" rel="stylesheet" href="../buildoz.css">
<script src="../buildoz.js"></script>
<script src="../bzGraflow.js"></script>
<script src="../bzGantt.js"></script>
<style>
@font-face { /*FF does not indirectly load if inside a shawdow-dom */
font-family: 'glyphs';
src: url('/assets/styles/fonts/glyphs.eot');
src: url('/assets/styles/fonts/glyphs.eot') format('embedded-opentype'),
url('/assets/styles/fonts/glyphs.ttf') format('truetype'),
url('/assets/styles/fonts/glyphs.woff') format('woff'),
url('/assets/styles/fonts/glyphs.svg') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
}
body{
background:#888;
font-size: 16px;
}
</style>
<script>
const ganttData = {
"tasks": [
{ "id": "t1", "name": "Task 1", "start": "2026-08-25", "end":"2026-08-29", "color": "#8F8" },
{ "id": "t2", "name": "Task 2", "start": "2026-09-08", "end":"2026-09-13", "color": "#F8F", "dependsOn": ["t8"] },
{ "id": "t3", "name": "Task 3", "start": "2026-09-13", "end":"2026-09-18", "color": "#FF8", "dependsOn": ["t9"] },
{ "id": "t4", "name": "Task 4", "start": "2026-08-25", "end":"2026-09-03", "color": "#F88" },
{ "id": "t5", "name": "Task 5", "start": "2026-08-29", "end":"2026-08-31", "color": "#88F", "dependsOn": ["t4", "t7"] },
{ "id": "t6", "name": "Task 6", "start": "2026-08-31", "end":"2026-09-01", "color": "#8F8", "dependsOn": ["t5"] },
{ "id": "t7", "name": "Task 7", "start": "2026-08-29", "end":"2026-09-01", "color": "#88F", "dependsOn": ["t1"] },
{ "id": "t8", "name": "Task 8 which is quite long", "start": "2026-09-01", "end":"2026-09-08", "color": "#8F8", "dependsOn": ["t6"] },
{ "id": "t9", "name": "Task 9", "start": "2026-09-08", "end":"2026-09-11", "color": "#F8F", "dependsOn": ["t8"] },
]
}
window.addEventListener('load',()=>{
let gantt = document.querySelector('bz-gantt.gantt')
gantt.loadData(ganttData)
gantt.refresh()
})
</script>
</head>
<body>
<bz-gantt class="gantt" nodesfile="./nodesLib/nodesGantt.html" tension="60" isolated></bz-gantt>
</body>
</html>