modal: allow disabling popupLabel and set default value to auto

This commit is contained in:
bordun 2020-04-30 09:49:07 +02:00
parent 3f647ad4e0
commit 768b00d070
3 changed files with 11 additions and 3 deletions

View file

@ -33,7 +33,7 @@ class Editor {
if (propName === 'address' && value === '') {
// special case
w.props[propName] = '/' + w.props.id
} else if (propName === 'label' && value === true) {
} else if ((propName === 'label' || propName === 'popupLabel') && value === true) {
w.props[propName] = 'auto'
} else {
w.props[propName] = value !== '' ? value : deepCopy(defaults[w.props.type][propName].value)

View file

@ -30,7 +30,7 @@ class Modal extends Panel {
_modalWidgets: 'modal: popup',
popupLabel: {type: 'string', value: '', help: 'Alternative label for the modal popup'},
popupLabel: {type: 'string|boolean', value: 'auto', help: 'Alternative label for the modal popup'},
popupWidth: {type: 'number|percentage', value: '80%', help: 'Modal popup\'s size'},
popupHeight: {type: 'number|percentage', value: '80%', help: 'Modal popup\'s size'},
popupLeft: {type: 'number|percentage', value: 'auto', help: 'Modal popup\'s position'},
@ -229,8 +229,11 @@ class Modal extends Panel {
if (!this.popup) return
var label = this.getProp('popupLabel') ? iconify(this.getProp('popupLabel')) : this.label.innerHTML
var label = this.getProp('popupLabel') !== 'auto' ? iconify(this.getProp('popupLabel')) : this.label.innerHTML
DOM.get(this.popup, '.popup-title .popup-label')[0].innerHTML = label
this.popup.classList.toggle('no-label', this.getProp('popupLabel') === false)
this.labelChange = false
}

View file

@ -443,6 +443,7 @@
> .popup-wrapper {
width: var(--width, 100%);
height: var(--height, 100%);
> .popup-content {
// contain:unset; // == no restrain
padding: 0;
@ -456,6 +457,10 @@
}
}
&.no-label > .popup-wrapper > .popup-title {
display: none;
}
&.x-positionned {
justify-content: flex-start;
> .popup-wrapper {