root: add hideMenu option
This commit is contained in:
parent
2577a6ea72
commit
f04c506ce3
1 changed files with 36 additions and 2 deletions
|
|
@ -1,5 +1,10 @@
|
|||
var Panel = require('./panel'),
|
||||
StaticProperties = require('../mixins/static_properties')
|
||||
StaticProperties = require('../mixins/static_properties'),
|
||||
mainMenu
|
||||
|
||||
setTimeout(()=>{
|
||||
mainMenu= require('../../ui/main-menu')
|
||||
})
|
||||
|
||||
class Root extends StaticProperties(Panel, {visible: true, label: false, id: 'root'}) {
|
||||
|
||||
|
|
@ -25,7 +30,10 @@ class Root extends StaticProperties(Panel, {visible: true, label: false, id: 'ro
|
|||
colorStroke: null,
|
||||
alphaStroke: null,
|
||||
alphaFillOff: null,
|
||||
lineWidth: null
|
||||
lineWidth: null,
|
||||
_separator_root_style: 'Root style',
|
||||
hideMenu: {type: 'boolean', value: false, help: 'Set to `true` to hide the main menu button.'},
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -40,6 +48,7 @@ class Root extends StaticProperties(Panel, {visible: true, label: false, id: 'ro
|
|||
|
||||
this.widget.classList.add('root')
|
||||
|
||||
this.checkMenuVisibility()
|
||||
|
||||
DOM.each(this.widget, '> .navigation', (el)=>{
|
||||
el.classList.add('main')
|
||||
|
|
@ -47,12 +56,33 @@ class Root extends StaticProperties(Panel, {visible: true, label: false, id: 'ro
|
|||
|
||||
}
|
||||
|
||||
checkMenuVisibility() {
|
||||
if (this.getProp('hideMenu')) {
|
||||
mainMenu.container.style.display = 'none'
|
||||
} else {
|
||||
mainMenu.container.style.display = ''
|
||||
}
|
||||
}
|
||||
|
||||
isVisible() {
|
||||
|
||||
return true
|
||||
|
||||
}
|
||||
|
||||
onPropChanged(propName, options, oldPropValue) {
|
||||
|
||||
if (super.onPropChanged(...arguments)) return true
|
||||
|
||||
switch (propName) {
|
||||
|
||||
case 'hideMenu':
|
||||
this.checkMenuVisibility()
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
setContainerStyles(styles) {
|
||||
|
||||
|
|
@ -65,5 +95,9 @@ class Root extends StaticProperties(Panel, {visible: true, label: false, id: 'ro
|
|||
|
||||
}
|
||||
|
||||
Root.dynamicProps = Root.prototype.constructor.dynamicProps.concat(
|
||||
'hideMenu'
|
||||
)
|
||||
|
||||
|
||||
module.exports = Root
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue