modal/menu: layout breakout from everythinh except tab/root
This commit is contained in:
parent
5779443f79
commit
971709355b
5 changed files with 41 additions and 5 deletions
|
|
@ -137,6 +137,8 @@ class Menu extends MenuBase {
|
|||
if (this.opened) return
|
||||
|
||||
this.opened = true
|
||||
this.fixParents()
|
||||
|
||||
this.container.classList.add('on')
|
||||
this.widget.appendChild(this.menu)
|
||||
|
||||
|
|
@ -147,6 +149,7 @@ class Menu extends MenuBase {
|
|||
if (!this.opened) return
|
||||
|
||||
this.opened = false
|
||||
this.fixParents()
|
||||
DOM.each(this.menu, '.active', (el)=>{el.classList.remove('active')})
|
||||
this.container.classList.remove('on')
|
||||
this.widget.removeChild(this.menu)
|
||||
|
|
@ -249,6 +252,29 @@ class Menu extends MenuBase {
|
|||
|
||||
}
|
||||
|
||||
fixParents() {
|
||||
|
||||
var parent = this.parent,
|
||||
scrollX = 0,
|
||||
scrollY = 0
|
||||
|
||||
while (parent && parent.props && !parent.getProp('type').match(/tab|root/)) {
|
||||
|
||||
parent.modalBreakout += (this.opened ? 1 : -1)
|
||||
if (parent.modalBreakout > 0) parent.container.classList.add('modal-breakout')
|
||||
else if (parent.modalBreakout === 0) parent.container.classList.remove('modal-breakout')
|
||||
|
||||
scrollX += parent.widget.scrollLeft
|
||||
scrollY += parent.widget.scrollTop
|
||||
|
||||
parent = parent.parent
|
||||
}
|
||||
|
||||
this.container.style.setProperty('--parent-scroll-x', scrollX + 'px')
|
||||
this.container.style.setProperty('--parent-scroll-y', scrollY + 'px')
|
||||
|
||||
}
|
||||
|
||||
setValue(v,options={}) {
|
||||
|
||||
var i = this.getIndex(v)
|
||||
|
|
@ -299,6 +325,9 @@ class Menu extends MenuBase {
|
|||
if (this.getProp('toggle')) {
|
||||
document.removeEventListener('fast-click', this.toggleCloseHandler)
|
||||
}
|
||||
if (this.opened) {
|
||||
this.close()
|
||||
}
|
||||
super.onRemove()
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ class Modal extends Panel {
|
|||
|
||||
var parent = this.parent
|
||||
|
||||
while (parent && parent.props && !parent.getProp('type').match(/modal|tab|root/)) {
|
||||
while (parent && parent.props && !parent.getProp('type').match(/tab|root/)) {
|
||||
|
||||
parent.modalBreakout += (this.value ? 1 : -1)
|
||||
if (parent.modalBreakout > 0) parent.container.classList.add('modal-breakout')
|
||||
|
|
|
|||
|
|
@ -127,12 +127,16 @@
|
|||
|
||||
--size: 300rem;
|
||||
--grid-columns: 2;
|
||||
|
||||
--parent-scroll-x: 0;
|
||||
--parent-scroll-y: 0;
|
||||
|
||||
overflow: hidden;
|
||||
|
||||
|
||||
&.on {
|
||||
z-index: 9999999999999!important;
|
||||
contain: layout;
|
||||
contain: size;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
|
|
@ -219,8 +223,8 @@
|
|||
border-radius: 100%;
|
||||
width:var(--size);
|
||||
height:var(--size);
|
||||
margin-left: calc(- var(--size) / 2);
|
||||
margin-top: calc(- var(--size) / 2);
|
||||
margin-left: calc(-1 * var(--parent-scroll-x));
|
||||
margin-top: calc(-1 * var(--parent-scroll-y));
|
||||
|
||||
&:after {
|
||||
content:"";
|
||||
|
|
|
|||
|
|
@ -435,6 +435,9 @@
|
|||
&.no-inner-padding > .popup > .popup-wrapper > .popup-content > inner {
|
||||
margin: calc(var(--widget-spacing) * -1);
|
||||
}
|
||||
&.modal-breakout > .popup > .popup-wrapper > .popup-content {
|
||||
@extend .modal-breakout;
|
||||
}
|
||||
|
||||
|
||||
> .popup {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue