Schema expansion
This commit is contained in:
parent
d450418bf6
commit
c3f8bedea1
3 changed files with 39 additions and 11 deletions
|
|
@ -4,7 +4,7 @@
|
|||
border-radius: var(--border-radius);
|
||||
padding: 16px;
|
||||
margin-left: 0px;
|
||||
margin-top: 16px;
|
||||
margin-top: 8px;
|
||||
margin-bottom: 16px;
|
||||
width: min-content;
|
||||
}
|
||||
|
|
@ -29,11 +29,21 @@
|
|||
.je-object__controls > .je-modal button {
|
||||
margin: 8px 0px 8px 8px;
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
}
|
||||
.form-control > label {
|
||||
display: block;
|
||||
color: var(--je-color);
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
[data-schematype] {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
[data-schematype]:last-child {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
[data-schematype="array"] button {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ export class App {
|
|||
'NODE_DELETE',
|
||||
'NODE_EDIT_NAME',
|
||||
'NODE_MOVE',
|
||||
'NODE_REMOVED',
|
||||
'NODE_SELECTED',
|
||||
'TREE_RELOAD_NODE',
|
||||
'TYPES_LIST_FETCHED',
|
||||
|
|
@ -63,13 +62,6 @@ export class App {
|
|||
this.nodesMove(nodes, this.currentNode.ID)
|
||||
break
|
||||
|
||||
case 'NODE_REMOVED':
|
||||
// Event dispatched when a tree node is removed after an update.
|
||||
if (this.currentNode.ID !== event.detail)
|
||||
return
|
||||
mbus.dispatch('NODE_SELECTED', null)
|
||||
break
|
||||
|
||||
case 'EDITOR_NODE_SAVE':
|
||||
this.nodeUpdate()
|
||||
break
|
||||
|
|
@ -269,6 +261,7 @@ export class App {
|
|||
}
|
||||
|
||||
this.tree.updateNode(parseInt(parentID))
|
||||
mbus.dispatch('NODE_SELECTED', null)
|
||||
})
|
||||
.catch(err => showError(err))
|
||||
}// }}}
|
||||
|
|
@ -552,7 +545,11 @@ export class TreeNode {
|
|||
this.children = null
|
||||
this.nameElement = null
|
||||
this.expandEventListenerAdded = false
|
||||
this.expanded = false
|
||||
this.expanded = this.retrieveExpanded()
|
||||
|
||||
if (this.expanded)
|
||||
this.tree.fetchNodes(this.node.ID)
|
||||
.then(()=>this.render())
|
||||
}// }}}
|
||||
render() {// {{{
|
||||
if (this.element === null) {
|
||||
|
|
@ -633,6 +630,7 @@ export class TreeNode {
|
|||
else
|
||||
this.expanded = expanded
|
||||
|
||||
this.storeExpanded()
|
||||
this.updateExpandImages()
|
||||
|
||||
if (!this.childrenFetched && this.node.NumChildren > 0 && this.node.Children.length == 0) {
|
||||
|
|
@ -652,6 +650,13 @@ export class TreeNode {
|
|||
.catch(err => reject(err))
|
||||
})
|
||||
}// }}}
|
||||
|
||||
storeExpanded() {// {{{
|
||||
sessionStorage.setItem(`tree_expand_${this.node.ID}`, this.expanded ? '1' : '0')
|
||||
}// }}}
|
||||
retrieveExpanded() {// {{{
|
||||
return sessionStorage.getItem(`tree_expand_${this.node.ID}`) === '1'
|
||||
}// }}}
|
||||
}
|
||||
|
||||
export class TypesList {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
border-radius: var(--border-radius);
|
||||
padding: 16px;
|
||||
margin-left: 0px;
|
||||
margin-top: 16px;
|
||||
margin-top: 8px;
|
||||
margin-bottom: 16px;
|
||||
width: min-content;
|
||||
|
||||
|
|
@ -37,6 +37,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.form-control {
|
||||
& > label {
|
||||
display: block;
|
||||
|
|
@ -45,6 +50,14 @@
|
|||
}
|
||||
}
|
||||
|
||||
[data-schematype] {
|
||||
margin-bottom: 16px;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
[data-schematype="array"] {
|
||||
button {
|
||||
margin-right: 8px;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue