Skip to content

Commit 81579aa

Browse files
committed
#7202 Colors.view.Viewport: using 3 panels as wrappers (drag handles)
1 parent f9a9947 commit 81579aa

1 file changed

Lines changed: 52 additions & 6 deletions

File tree

apps/colors/view/Viewport.mjs

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import BarChartComponent from './BarChartComponent.mjs';
33
import HeaderToolbar from './HeaderToolbar.mjs';
44
import PieChartComponent from './PieChartComponent.mjs';
55
import GridContainer from './GridContainer.mjs';
6+
import Panel from '../../../src/container/Panel.mjs';
7+
import SortZone from '../../../src/draggable/container/SortZone.mjs';
68
import ViewportController from './ViewportController.mjs';
79
import ViewportStateProvider from './ViewportStateProvider.mjs';
810

@@ -31,30 +33,74 @@ class Viewport extends BaseViewport {
3133
* @member {Object} layout
3234
*/
3335
layout: {ntype: 'vbox', align: 'stretch'},
36+
/**
37+
* @member {Boolean} sortable_=true
38+
*/
39+
sortable_: true,
3440
/**
3541
* @member {Object[]} items
3642
*/
3743
items: [{
3844
module: HeaderToolbar,
3945
flex : 'none'
4046
}, {
41-
module : GridContainer,
42-
reference: 'grid'
47+
module: Panel,
48+
flex : 1,
49+
reference: 'grid-panel',
50+
headers: [{
51+
dock: 'top',
52+
cls : ['neo-draggable'],
53+
text: 'Grid'
54+
}],
55+
items: [
56+
{module: GridContainer, reference: 'grid'}
57+
]
4358
}, {
44-
module : PieChartComponent,
59+
module : Panel,
4560
flex : 1.3,
46-
reference: 'pie-chart'
61+
reference: 'pie-chart-panel',
62+
headers: [{
63+
dock: 'top',
64+
cls : ['neo-draggable'],
65+
text: 'Pie Chart'
66+
}],
67+
items: [
68+
{module: PieChartComponent, reference: 'pie-chart'}
69+
]
4770
}, {
48-
module : BarChartComponent,
71+
module : Panel,
4972
flex : 1.3,
50-
reference: 'bar-chart'
73+
reference: 'bar-chart-panel',
74+
headers: [{
75+
dock: 'top',
76+
cls : ['neo-draggable'],
77+
text: 'Bar Chart'
78+
}],
79+
items: [
80+
{module: BarChartComponent, reference: 'bar-chart'}
81+
]
5182
}],
5283
/**
5384
* @member {Neo.state.Provider} stateProvider=ViewportStateProvider
5485
* @reactive
5586
*/
5687
stateProvider: ViewportStateProvider
5788
}
89+
90+
/**
91+
*
92+
*/
93+
onConstructed() {
94+
super.onConstructed();
95+
96+
if (this.sortable) {
97+
this.dragZone = Neo.create({
98+
module : SortZone,
99+
owner : this,
100+
boundaryContainerId: this.id
101+
});
102+
}
103+
}
58104
}
59105

60106
export default Neo.setupClass(Viewport);

0 commit comments

Comments
 (0)