@@ -3,6 +3,8 @@ import BarChartComponent from './BarChartComponent.mjs';
33import HeaderToolbar from './HeaderToolbar.mjs' ;
44import PieChartComponent from './PieChartComponent.mjs' ;
55import GridContainer from './GridContainer.mjs' ;
6+ import Panel from '../../../src/container/Panel.mjs' ;
7+ import SortZone from '../../../src/draggable/container/SortZone.mjs' ;
68import ViewportController from './ViewportController.mjs' ;
79import 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
60106export default Neo . setupClass ( Viewport ) ;
0 commit comments