From f04c506ce3dd9241be3bed5cc076c5964a9a4ae2 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 14 Dec 2021 19:36:33 +0100 Subject: [PATCH] root: add hideMenu option --- src/client/widgets/containers/root.js | 38 +++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/client/widgets/containers/root.js b/src/client/widgets/containers/root.js index 875d54cf..51773a8f 100644 --- a/src/client/widgets/containers/root.js +++ b/src/client/widgets/containers/root.js @@ -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