widgets: folder container
This commit is contained in:
parent
4868ef77d9
commit
d68c0f6c0a
5 changed files with 94 additions and 7 deletions
|
|
@ -2,7 +2,7 @@ var UiWidget = require('./ui-widget'),
|
|||
keyboardJS = require('keyboardjs/dist/keyboard.min.js'),
|
||||
html = require('nanohtml'),
|
||||
fastdom = require('fastdom'),
|
||||
Tab, Root
|
||||
Tab, Root, Folder
|
||||
|
||||
class UiDragResize extends UiWidget {
|
||||
|
||||
|
|
@ -10,6 +10,7 @@ class UiDragResize extends UiWidget {
|
|||
|
||||
Tab = require('../widgets/containers/tab')
|
||||
Root = require('../widgets/containers/root')
|
||||
Folder = require('../widgets/containers/folder')
|
||||
|
||||
super(options)
|
||||
|
||||
|
|
@ -144,7 +145,12 @@ class UiDragResize extends UiWidget {
|
|||
|
||||
this.clear()
|
||||
|
||||
this.widgets = widgets.slice().filter(w=>w.getProp('visible') && !(w instanceof Tab) && !(w instanceof Root))
|
||||
this.widgets = widgets.slice().filter(
|
||||
w=>w.getProp('visible') &&
|
||||
!(w instanceof Tab) &&
|
||||
!(w instanceof Root) &&
|
||||
!(w instanceof Folder)
|
||||
)
|
||||
|
||||
if (!this.widgets.length) return
|
||||
|
||||
|
|
|
|||
|
|
@ -12,11 +12,12 @@ var UiWidget = require('./ui-widget'),
|
|||
var widgetIcons = {
|
||||
root: 'bookmark',
|
||||
tab: 'window-maximize',
|
||||
folder: 'folder',
|
||||
menu: 'list',
|
||||
dropdown: 'list',
|
||||
switch: 'list',
|
||||
input: 'i-cursor',
|
||||
file: 'folder-open',
|
||||
file: 'file-import',
|
||||
modal: 'window-restore',
|
||||
clone: 'cube',
|
||||
fragment: 'cube',
|
||||
|
|
@ -27,7 +28,7 @@ var widgetIcons = {
|
|||
|
||||
var categoryIcons = {
|
||||
'Basics': 'toggle-on',
|
||||
'Containers': 'th-large',
|
||||
'Containers': 'table-list',
|
||||
'Frames': 'images',
|
||||
'Graphs': 'chart-area',
|
||||
'Indicators': 'info-circle',
|
||||
|
|
|
|||
61
src/client/widgets/containers/folder.js
Normal file
61
src/client/widgets/containers/folder.js
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
var Panel = require('./panel'),
|
||||
StaticProperties = require('../mixins/static_properties')
|
||||
|
||||
class Folder extends Panel {
|
||||
|
||||
static description() {
|
||||
|
||||
return 'Generic matrix for creating rows/columns of widgets.'
|
||||
|
||||
}
|
||||
|
||||
static defaults() {
|
||||
|
||||
var defaults = super.defaults().extend({
|
||||
class_specific: {
|
||||
traversing: null
|
||||
},
|
||||
style: {
|
||||
|
||||
},
|
||||
geometry: null,
|
||||
osc: null,
|
||||
scripting: null,
|
||||
value: null,
|
||||
children: {
|
||||
widgets: {type: 'array', value: [], help: 'Each element of the array must be a widget object. A panel cannot contain widgets and tabs simultaneously.'},
|
||||
}
|
||||
})
|
||||
|
||||
defaults.style = {
|
||||
colorText: defaults.style.colorText,
|
||||
colorWidget: defaults.style.colorWidget,
|
||||
css: defaults.style.css,
|
||||
}
|
||||
|
||||
return defaults
|
||||
|
||||
}
|
||||
|
||||
constructor(options) {
|
||||
|
||||
super(options)
|
||||
|
||||
}
|
||||
|
||||
getProp(propName) {
|
||||
|
||||
if (propName === 'layout') {
|
||||
return this.parent.getProp('layout')
|
||||
} else {
|
||||
return super.getProp(propName)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
module.exports = Folder
|
||||
|
|
@ -11,6 +11,7 @@ module.exports.widgets = {
|
|||
|
||||
// containers
|
||||
panel: require('./containers/panel'),
|
||||
folder: require('./containers/folder'),
|
||||
root: require('./containers/root'),
|
||||
tab: require('./containers/tab'),
|
||||
modal: require('./containers/modal'),
|
||||
|
|
@ -56,7 +57,7 @@ module.exports.widgets = {
|
|||
|
||||
module.exports.categories = {
|
||||
'Basics':['button', 'switch', 'dropdown', 'menu', 'input', 'textarea', 'file'],
|
||||
'Containers':['panel', 'modal', 'clone', 'fragment', 'matrix', 'keyboard', 'patchbay'],
|
||||
'Containers':['panel', 'modal', 'clone', 'fragment', 'matrix', 'keyboard', 'patchbay', 'folder'],
|
||||
'Frames':['frame', 'svg', 'html', 'image'],
|
||||
'Graphs':['plot','eq','visualizer'],
|
||||
'Indicators':['led', 'text'],
|
||||
|
|
|
|||
|
|
@ -73,7 +73,8 @@
|
|||
max-width: 100%;
|
||||
}
|
||||
|
||||
&.layout-vertical > inner {
|
||||
&.layout-vertical > inner,
|
||||
&.layout-vertical .folder-container > inner {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
|
|
@ -94,7 +95,8 @@
|
|||
max-height: 100%;
|
||||
}
|
||||
|
||||
&.layout-grid > inner {
|
||||
&.layout-grid > inner,
|
||||
&.layout-grid .folder-container > inner {
|
||||
display: grid;
|
||||
> .widget {
|
||||
top:auto!important;
|
||||
|
|
@ -201,6 +203,22 @@
|
|||
|
||||
}
|
||||
|
||||
.folder-container {
|
||||
display: contents;
|
||||
overflow: visible;
|
||||
contain: unset;
|
||||
min-width: 0;
|
||||
width: 0;
|
||||
min-height: 0;
|
||||
height: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
> inner {
|
||||
display: contents!important;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.root-container {
|
||||
|
||||
@extend .widget-panel-base;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue