diff --git a/CHANGELOG.md b/CHANGELOG.md index ad5960e3..68487013 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.48.1 + +- bug fixes + - modal: `popupLabel` update issues + ## 0.48.0 - bug fixes diff --git a/src/client/app/widgets/containers/modal.js b/src/client/app/widgets/containers/modal.js index 72c0e8fd..335e94e5 100644 --- a/src/client/app/widgets/containers/modal.js +++ b/src/client/app/widgets/containers/modal.js @@ -6,7 +6,7 @@ var Panel = require('./panel'), html = require('nanohtml'), raw = require('nanohtml/raw') -module.exports = class Modal extends Panel { +class Modal extends Panel { static description() { @@ -107,6 +107,7 @@ module.exports = class Modal extends Panel { this.parentScroll = [0,0] this.value = 0 this.init = false + this.labelChange = true } @@ -117,12 +118,14 @@ module.exports = class Modal extends Panel { this.value = v ? 1 : 0 if (!this.init && this.value) { - var label = this.getProp('popupLabel') ? iconify(this.getProp('popupLabel')) : DOM.get(this.container, '> .label')[0].innerHTML - DOM.get(this.popup, '.popup-title .popup-label')[0].innerHTML = label DOM.get(this.popup, '.popup-content')[0].appendChild(this.widget) this.init = true } + if (this.value && this.labelChange) { + this.updatePopupLabel() + } + this.popup.classList.toggle('show', this.value) this.container.classList.toggle('on', this.value) this.light.classList.toggle('on', this.value) @@ -188,4 +191,38 @@ module.exports = class Modal extends Panel { } + updatePopupLabel() { + + var label = this.getProp('popupLabel') ? iconify(this.getProp('popupLabel')) : DOM.get(this.container, '> .label')[0].innerHTML + DOM.get(this.popup, '.popup-title .popup-label')[0].innerHTML = label + this.labelChange = false + + } + + onPropChanged(propName, options, oldPropValue) { + + if (super.onPropChanged(...arguments)) return true + + switch (propName) { + + case 'popupLabel': + case 'label': + if (this.value) { + this.updatePopupLabel() + } else { + this.labelChange = true + } + + return + + } + + } + } + +Modal.dynamicProps = Modal.prototype.constructor.dynamicProps.concat( + 'popupLabel' +) + +module.exports = Modal