menu & modal: add ignoreTabs option (allows overflowing tab ancestors)

This commit is contained in:
bordun 2020-12-06 17:57:15 +01:00
parent 9e4362a1d2
commit 78051c5431
4 changed files with 16 additions and 7 deletions

View file

@ -8,6 +8,10 @@
- editor
- display color picked values with css rgba notation instead of hexadecimal
- widgets
- modal: add `ignoreTabs` option (allows overflowing tab ancestors)
- menu: add `ignoreTabs` option
## 1.7.5
- bug fixes

View file

@ -1,6 +1,6 @@
var MenuBase = require('./menu-base'),
{iconify} = require('../../ui/utils'),
doubletab = require('../mixins/double_tap'),
doubletap = require('../mixins/double_tap'),
html = require('nanohtml'),
raw = require('nanohtml/raw')
@ -21,6 +21,8 @@ class Menu extends MenuBase {
'- If `layout` is `circular`: diameter (in px)',
'- Else: square size or `[width, height]` array',
]},
ignoreTabs: {type: 'boolean', value: false, help: 'Set to `true` to allow the menu overflowing its tab ancestors.'},
},
style: {
_separator_menu_style: 'Menu style',
@ -80,7 +82,7 @@ class Menu extends MenuBase {
if (this.getProp('doubleTap')) {
doubletab(this.widget, (e)=>{
doubletap(this.widget, (e)=>{
if (this.opened) return
this.open(e)
})
@ -270,9 +272,10 @@ class Menu extends MenuBase {
var parent = this.parent,
scrollX = 0,
scrollY = 0
scrollY = 0,
stop = this.getProp('ignoreTabs') ? /root/ : /root|tab/
while (parent && parent.props && !parent.getProp('type').match(/tab|root/)) {
while (parent && parent.props && !parent.getProp('type').match(stop)) {
parent.modalBreakout += (this.opened ? 1 : -1)
if (parent.modalBreakout > 0) parent.container.classList.add('modal-breakout')

View file

@ -26,6 +26,7 @@ class Modal extends Panel {
popupLeft: {type: 'number|percentage', value: 'auto', help: 'Modal popup\'s position'},
popupTop: {type: 'number|percentage', value: 'auto', help: 'Modal popup\'s position'},
relative: {type: 'boolean', value: false, help: 'Set to `true` to make the modal\'s position relative to the button\'s position.'},
ignoreTabs: {type: 'boolean', value: false, help: 'Set to `true` to allow the modal overflowing its tab ancestors.'},
},
style: {
_separator_modal_style: 'Modal style',
@ -168,9 +169,10 @@ class Modal extends Panel {
fixParents() {
var parent = this.parent
var parent = this.parent,
stop = this.getProp('ignoreTabs') ? /root/ : /root|tab/
while (parent && parent.props && !parent.getProp('type').match(/tab|root/)) {
while (parent && parent.props && !parent.getProp('type').match(stop)) {
parent.modalBreakout += (this.value ? 1 : -1)
if (parent.modalBreakout > 0) parent.container.classList.add('modal-breakout')

View file

@ -120,7 +120,7 @@
display: flex;
flex-direction: column;
overflow: hidden;
// overflow: hidden;
> .widget {
flex: 1;