-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #438 from eyra/next/port-task-builder
Next/port task builder
- Loading branch information
Showing
101 changed files
with
1,580 additions
and
758 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
const COLLAPSED = "collapsed"; | ||
const EXPANDED = "expanded"; | ||
|
||
const COLLAPSED_VIEW = "cell-collapsed-view"; | ||
const EXPANDED_VIEW = "cell-expanded-view"; | ||
|
||
const COLLAPSE_BUTTON = "cell-collapse-button"; | ||
const EXPAND_BUTTON = "cell-expand-button"; | ||
|
||
export const Cell = { | ||
mounted() { | ||
this.collapseButton = this.el.getElementsByClassName(COLLAPSE_BUTTON)[0]; | ||
this.collapsedView = this.el.getElementsByClassName(COLLAPSED_VIEW)[0]; | ||
|
||
this.expandButton = this.el.getElementsByClassName(EXPAND_BUTTON)[0]; | ||
this.expandedView = this.el.getElementsByClassName(EXPANDED_VIEW)[0]; | ||
|
||
this.collapseButton.addEventListener("click", (event) => { | ||
event.stopPropagation(); | ||
this.updateStatus(COLLAPSED); | ||
}); | ||
|
||
this.expandButton.addEventListener("click", (event) => { | ||
event.stopPropagation(); | ||
this.updateStatus(EXPANDED); | ||
}); | ||
|
||
var initialStatus = this.el.dataset.initialStatus | ||
? this.el.dataset.initialTab | ||
: COLLAPSED; | ||
|
||
var savedStatus = this.loadStatus(); | ||
this.status = savedStatus ? savedStatus : initialStatus; | ||
this.updateUI(); | ||
}, | ||
|
||
updated() { | ||
this.updateUI(); | ||
}, | ||
|
||
loadStatus() { | ||
const key = this.getStatusKey(); | ||
const status = window.localStorage.getItem(key); | ||
if (typeof status === "string") { | ||
return status; | ||
} | ||
return undefined; | ||
}, | ||
|
||
saveStatus() { | ||
console.info("saveStatus ", this.status); | ||
window.localStorage.setItem(this.getStatusKey(), this.status); | ||
}, | ||
|
||
getStatusKey() { | ||
return "cell://" + this.el.id + "/status"; | ||
}, | ||
|
||
updateStatus(status) { | ||
this.status = status; | ||
this.saveStatus(); | ||
this.updateUI(); | ||
}, | ||
|
||
updateUI() { | ||
if (this.status == EXPANDED) { | ||
this.hide(this.collapsedView); | ||
this.show(this.expandedView); | ||
} else { | ||
this.show(this.collapsedView); | ||
this.hide(this.expandedView); | ||
} | ||
}, | ||
hide(element) { | ||
if (!element.classList.contains("hidden")) { | ||
element.classList.add("hidden"); | ||
} | ||
}, | ||
show(element) { | ||
element.classList.remove("hidden"); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,42 @@ | ||
const maxBottomMargin = 62; | ||
const maxBottomMargin = 63; | ||
|
||
export const SidePanel = { | ||
mounted() { | ||
this.mainContent = document.getElementById("main-content"); | ||
this.parent = document.getElementById(this.el.dataset.parent); | ||
this.panel = this.el.getElementsByClassName("panel")[0]; | ||
this.panel.style = `height: 0px;`; | ||
this.make_absolute(); | ||
this.panel.style = `position: fixed; height: 0px; top: 0px`; | ||
this.updateFrame(); | ||
|
||
window.addEventListener("tab-activated", (event) => { | ||
new ResizeObserver(() => { | ||
this.updateFrame(); | ||
}); | ||
}).observe(this.parent); | ||
|
||
window.addEventListener("scroll", (event) => { | ||
this.mainContent.addEventListener("scroll", (event) => { | ||
this.updateFrame(); | ||
}); | ||
|
||
window.addEventListener("resize", (event) => { | ||
this.updateFrame(); | ||
}); | ||
}, | ||
make_absolute() { | ||
this.el.classList.remove("relative"); | ||
this.el.classList.add("absolute"); | ||
|
||
window.addEventListener("tab-activated", (event) => { | ||
this.updateFrame(); | ||
}); | ||
}, | ||
updated() { | ||
this.make_absolute(); | ||
this.updateFrame(); | ||
}, | ||
updateFrame() { | ||
this.updateHeight(); | ||
this.updatePosition(); | ||
}, | ||
updateHeight() { | ||
const bottomMarginDelta = Math.min( | ||
maxBottomMargin, | ||
document.documentElement.scrollHeight - | ||
window.scrollY - | ||
window.innerHeight | ||
); | ||
const bottomMargin = maxBottomMargin - bottomMarginDelta; | ||
const bottomDistance = | ||
this.mainContent.scrollHeight - | ||
this.mainContent.scrollTop - | ||
window.innerHeight; | ||
const bottomMargin = | ||
maxBottomMargin - Math.min(maxBottomMargin, bottomDistance); | ||
const topMargin = Math.max(0, this.parent.getBoundingClientRect().top); | ||
const height = window.innerHeight - (topMargin + bottomMargin); | ||
|
||
const height = | ||
window.innerHeight - | ||
(this.parent.getBoundingClientRect().top + bottomMargin); | ||
this.panel.style = `height: ${height}px;`; | ||
}, | ||
updatePosition() { | ||
const top = | ||
Math.max(0, this.parent.getBoundingClientRect().top) + window.scrollY; | ||
this.el.style = `top: ${top}px; right: 0px`; | ||
this.panel.style = `position: fixed; height: ${height}px; top: ${topMargin}px`; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.