From 78051c54312dbe8b34688f79699872f4dbd79eb7 Mon Sep 17 00:00:00 2001 From: bordun Date: Sun, 6 Dec 2020 17:57:15 +0100 Subject: [PATCH] =?UTF-8?q?menu=20&=20modal:=20add=C2=A0`ignoreTabs`=20opt?= =?UTF-8?q?ion=20(allows=20overflowing=20tab=20ancestors)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ src/client/widgets/basics/menu.js | 11 +++++++---- src/client/widgets/containers/modal.js | 6 ++++-- src/scss/widgets/containers.scss | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ed97a2c..93caaff0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/client/widgets/basics/menu.js b/src/client/widgets/basics/menu.js index 9aaf17ac..125fad85 100644 --- a/src/client/widgets/basics/menu.js +++ b/src/client/widgets/basics/menu.js @@ -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') diff --git a/src/client/widgets/containers/modal.js b/src/client/widgets/containers/modal.js index 453ef2c2..54ce553a 100644 --- a/src/client/widgets/containers/modal.js +++ b/src/client/widgets/containers/modal.js @@ -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') diff --git a/src/scss/widgets/containers.scss b/src/scss/widgets/containers.scss index c478987a..353f30d7 100644 --- a/src/scss/widgets/containers.scss +++ b/src/scss/widgets/containers.scss @@ -120,7 +120,7 @@ display: flex; flex-direction: column; - overflow: hidden; + // overflow: hidden; > .widget { flex: 1;