panel: replace verticalTabs property with tabsPosition (supports 4 directions)

This commit is contained in:
jean-emmanuel 2023-04-06 00:16:49 +02:00
parent 13ce9ebe0d
commit afcd9787db
4 changed files with 23 additions and 12 deletions

View file

@ -318,6 +318,10 @@ var converters = [
if (data.type === 'patchbay' && data.exclusive === true) {
data.exclusive = 'in'
}
else if ((data.type === 'panel' || data.type === 'root') && data.verticalTabs === true) {
data.tabsPosition = 'left'
delete data.verticalTabs
}
}
}
]

View file

@ -33,7 +33,7 @@ class Panel extends Container() {
contain: {type: 'boolean', value: true, help:'If `layout` is `vertical` or `horizontal`, prevents children from overflowing the panel.'},
scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
innerPadding: {type : 'boolean', value: true, help: 'Set to `false` to make the `padding` property apply only between children and not at the container\'s inner boundaries.'},
verticalTabs: {type: 'boolean', value: false, help: 'Set to `true` to display for vertical tab layout'},
tabsPosition: {type: 'string', value: 'top', choices: ['top', 'bottom', 'left', 'right'], help: 'Defines the position of the navigation bar if the panel contains tabs'},
},
value: {
value: {type: 'integer|array', value: '', help: [
@ -80,7 +80,7 @@ class Panel extends Container() {
if (this.getProp('tabs') && this.getProp('tabs').length) {
this.container.classList.add('contains-tabs')
this.container.classList.toggle('vertical-tabs', this.getProp('verticalTabs'))
this.container.classList.add('tabs-' + this.getProp('tabsPosition'))
} else {
@ -175,7 +175,7 @@ class Panel extends Container() {
this.value = -1
this.navigation = this.widget.appendChild(html`<div class="navigation ${this.getProp('verticalTabs') ? 'vertical' : ''}"></div>`)
this.navigation = this.widget.appendChild(html`<div class="navigation ${'tabs-' + this.getProp('tabsPosition')}"></div>`)
this.children = options.children || new Array(this.getProp('tabs').length)
for (let i = 0; i < this.children.length; i++) {

View file

@ -132,13 +132,18 @@
}
}
&.vertical-tabs {
> inner {
flex-direction: row;
}
&.tabs-left > inner {
flex-direction: row;
}
&.tabs-right > inner {
flex-direction: row-reverse;
}
&.tabs-bottom > inner {
flex-direction: column-reverse;
}
}
}
@ -167,7 +172,8 @@
.tablink.editing:after {
margin: 2rem 2rem 4rem;
}
.vertical > .tablink.editing:after {
.tabs-left > .tablink.editing:after,
.tabs-right > .tablink.editing:after {
margin: 2rem 4rem 2rem 2rem;
}
@ -337,7 +343,7 @@
}
}
&.vertical {
&.tabs-left, &.tabs-right {
flex-direction: column;
height: 100%;
padding-bottom: 0;