panels: add contain property to allow scrolling in vertical/horizontal layouts (#645)

This commit is contained in:
bordun 2020-08-10 19:35:52 +02:00
parent b79bcf491d
commit e247f90af0
6 changed files with 20 additions and 6 deletions

View file

@ -14,7 +14,7 @@ module.exports = class File extends Widget {
return super.defaults({
_class_specific: 'input',
_class_specific: 'file',
align: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], help: 'Set to `left` or `right` to change text alignment (otherwise center)'},
directory: {type: 'string', value: 'auto', help: 'Default browsing directory'},

View file

@ -27,6 +27,7 @@ class Modal extends Panel {
]},
doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the modal require a double tap to open instead of a single tap'},
variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'},
traversing: {type: 'boolean', value: false, help: 'Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget'},
_separator: 'popup',
@ -36,9 +37,11 @@ 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'},
_separator1: 'widget container',
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help: 'Defines how children are laid out.'},
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
traversing: {type: 'boolean', value: false, help: 'Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget'},
contain: {type: 'boolean', value: true, help:'If `layout` is `vertical` or `horizontal`, prevents children from overflowing the panel.'},
scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
innerPadding: {type : 'boolean', value: true, help: 'Set to `false` to make the `padding` property apply only between children and not at the container\'s inner boundaries.'},

View file

@ -27,6 +27,7 @@ class Panel extends Container() {
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:'Defines how children are laid out.'},
justify: {type: 'string', value: 'start', choices: ['start', 'end', 'center', 'space-around', 'space-between'], help:'If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.'},
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
contain: {type: 'boolean', value: true, help:'If `layout` is `vertical` or `horizontal`, prevents children from overflowing the panel.'},
scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
innerPadding: {type : 'boolean', value: true, help: 'Set to `false` to make the `padding` property apply only between children and not at the container\'s inner boundaries.'},
@ -61,6 +62,7 @@ class Panel extends Container() {
this.container.classList.toggle('no-inner-padding', !this.getProp('innerPadding'))
this.container.classList.toggle('no-scroll', !this.getProp('scroll'))
this.container.classList.add('layout-' + this.getProp('layout'))
this.container.classList.toggle('layout-contain', this.getProp('contain'))
this.modalBreakout = 0

View file

@ -24,6 +24,7 @@ class Root extends StaticProperties(Panel, {visible: true, label: false, id: 'ro
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:'Defines how children are laid out.'},
justify: {type: 'string', value: 'start', choices: ['start', 'end', 'center', 'space-around', 'space-between'], help:'If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.'},
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
contain: {type: 'boolean', value: true, help:'If `layout` is `vertical` or `horizontal`, prevents children from overflowing the panel.'},
scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
innerPadding: {type : 'boolean', value: true, help: 'Set to `false` to make the `padding` property apply only between children and not at the container\'s inner boundaries.'},

View file

@ -32,6 +32,7 @@ class Tab extends Panel {
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:'Defines how children are laid out.'},
justify: {type: 'string', value: 'start', choices: ['start', 'end', 'center', 'space-around', 'space-between'], help:'If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.'},
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
contain: {type: 'boolean', value: true, help:'If `layout` is `vertical` or `horizontal`, prevents children from overflowing the panel.'},
scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
innerPadding: {type : 'boolean', value: true, help: 'Set to `false` to make the `padding` property apply only between children and not at the container\'s inner boundaries.'},