@@ -40,7 +40,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
4040 var _this = this ;
4141
4242 return function ( evtData ) {
43- if ( _this . list !== null ) {
43+ if ( _this . realList !== null ) {
4444 _this [ 'onDrag' + evtName ] ( evtData ) ;
4545 }
4646 emit . call ( _this , evtName , evtData ) ;
@@ -61,6 +61,11 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
6161 required : false ,
6262 default : null
6363 } ,
64+ value : {
65+ type : Array ,
66+ required : false ,
67+ default : null
68+ } ,
6469 clone : {
6570 type : Function ,
6671 default : function _default ( original ) {
@@ -123,6 +128,9 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
123128 } ,
124129 isCloning : function isCloning ( ) {
125130 return ! ! this . options && this . options . group !== null && this . options . group . pull === 'clone' ;
131+ } ,
132+ realList : function realList ( ) {
133+ return ! ! this . list ? this . list : this . value ;
126134 }
127135 } ,
128136
@@ -134,7 +142,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
134142 }
135143 }
136144 } ,
137- list : function list ( ) {
145+ realList : function realList ( ) {
138146 this . computeIndexes ( ) ;
139147 }
140148 } ,
@@ -153,7 +161,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
153161 } ,
154162 getUnderlyingVm : function getUnderlyingVm ( htmlElt ) {
155163 var index = computeVmIndex ( this . getChildrenNodes ( ) , htmlElt ) ;
156- var element = this . list [ index ] ;
164+ var element = this . realList [ index ] ;
157165 return { index : index , element : element } ;
158166 } ,
159167 getUnderlyingPotencialDraggableComponent : function getUnderlyingPotencialDraggableComponent ( _ref ) {
@@ -171,23 +179,38 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
171179 _this4 . $emit ( 'change' , evt ) ;
172180 } ) ;
173181 } ,
182+ alterList : function alterList ( onList ) {
183+ if ( ! ! this . list ) {
184+ onList ( this . list ) ;
185+ } else {
186+ var newList = [ ] . concat ( _toConsumableArray ( this . value ) ) ;
187+ onList ( newList ) ;
188+ this . $emit ( 'input' , newList ) ;
189+ }
190+ } ,
174191 spliceList : function spliceList ( ) {
175- var _list ;
192+ var _arguments = arguments ;
176193
177- ( _list = this . list ) . splice . apply ( _list , arguments ) ;
194+ var spliceList = function spliceList ( list ) {
195+ return list . splice . apply ( list , _arguments ) ;
196+ } ;
197+ this . alterList ( spliceList ) ;
178198 } ,
179199 updatePosition : function updatePosition ( oldIndex , newIndex ) {
180- this . list . splice ( newIndex , 0 , this . list . splice ( oldIndex , 1 ) [ 0 ] ) ;
200+ var updatePosition = function updatePosition ( list ) {
201+ return list . splice ( newIndex , 0 , list . splice ( oldIndex , 1 ) [ 0 ] ) ;
202+ } ;
203+ this . alterList ( updatePosition ) ;
181204 } ,
182205 getRelatedContextFromMoveEvent : function getRelatedContextFromMoveEvent ( _ref2 ) {
183- var to = _ref2 . to ,
184- related = _ref2 . related ;
206+ var to = _ref2 . to ;
207+ var related = _ref2 . related ;
185208
186209 var component = this . getUnderlyingPotencialDraggableComponent ( to ) ;
187210 if ( ! component ) {
188211 return { component : component } ;
189212 }
190- var list = component . list ;
213+ var list = component . realList ;
191214 var context = { list : list , component : component } ;
192215 if ( to !== related && list && component . getUnderlyingVm ) {
193216 var destination = component . getUnderlyingVm ( related ) ;
@@ -250,7 +273,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
250273 } ,
251274 onDragMove : function onDragMove ( evt ) {
252275 var onMove = this . move ;
253- if ( ! onMove || ! this . list ) {
276+ if ( ! onMove || ! this . realList ) {
254277 return true ;
255278 }
256279
0 commit comments