@@ -18,11 +18,8 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
1818 }
1919
2020 function insertNodeAt ( fatherNode , node , position ) {
21- if ( position < fatherNode . children . length ) {
22- fatherNode . insertBefore ( node , fatherNode . children [ position ] ) ;
23- } else {
24- fatherNode . appendChild ( node ) ;
25- }
21+ var refNode = position === 0 ? fatherNode . children [ 0 ] : fatherNode . children [ position - 1 ] . nextSibling ;
22+ fatherNode . insertBefore ( node , refNode ) ;
2623 }
2724
2825 function computeVmIndex ( vnodes , element ) {
@@ -31,17 +28,20 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
3128 } ) . indexOf ( element ) ;
3229 }
3330
34- function _computeIndexes ( slots , children ) {
31+ function _computeIndexes ( slots , children , isTransition ) {
3532 if ( ! slots ) {
3633 return [ ] ;
3734 }
3835
3936 var elmFromNodes = slots . map ( function ( elt ) {
4037 return elt . elm ;
4138 } ) ;
42- return [ ] . concat ( _toConsumableArray ( children ) ) . map ( function ( elt ) {
39+ var rawIndexes = [ ] . concat ( _toConsumableArray ( children ) ) . map ( function ( elt ) {
4340 return elmFromNodes . indexOf ( elt ) ;
4441 } ) ;
42+ return isTransition ? rawIndexes . filter ( function ( ind ) {
43+ return ind !== - 1 ;
44+ } ) : rawIndexes ;
4545 }
4646
4747 function emit ( evtName , evtData ) {
@@ -114,13 +114,20 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
114114 } ;
115115 } ,
116116 render : function render ( h ) {
117- if ( this . $slots . default && this . $slots . default . length === 1 ) {
118- var child = this . $slots . default [ 0 ] ;
117+ var slots = this . $slots . default ;
118+ if ( slots && slots . length === 1 ) {
119+ var child = slots [ 0 ] ;
119120 if ( child . componentOptions && child . componentOptions . tag === "transition-group" ) {
120121 this . transitionMode = true ;
121122 }
122123 }
123- return h ( this . element , null , this . $slots . default ) ;
124+ var children = [ ] . concat ( _toConsumableArray ( slots ) ) ;
125+ var footer = this . $slots . footer ;
126+
127+ if ( footer ) {
128+ children = [ ] . concat ( _toConsumableArray ( slots ) , _toConsumableArray ( footer ) ) ;
129+ }
130+ return h ( this . element , null , children ) ;
124131 } ,
125132 mounted : function mounted ( ) {
126133 var _this3 = this ;
@@ -192,11 +199,16 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
192199 var _this4 = this ;
193200
194201 this . $nextTick ( function ( ) {
195- _this4 . visibleIndexes = _computeIndexes ( _this4 . getChildrenNodes ( ) , _this4 . rootContainer . children ) ;
202+ _this4 . visibleIndexes = _computeIndexes ( _this4 . getChildrenNodes ( ) , _this4 . rootContainer . children , _this4 . transitionMode ) ;
196203 } ) ;
197204 } ,
198205 getUnderlyingVm : function getUnderlyingVm ( htmlElt ) {
199- var index = computeVmIndex ( this . getChildrenNodes ( ) , htmlElt ) ;
206+ var index = computeVmIndex ( this . getChildrenNodes ( ) || [ ] , htmlElt ) ;
207+ if ( index === - 1 ) {
208+ //Edge case during move callback: related element might be
209+ //an element different from collection
210+ return null ;
211+ }
200212 var element = this . realList [ index ] ;
201213 return { index : index , element : element } ;
202214 } ,
@@ -250,7 +262,9 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
250262 var context = { list : list , component : component } ;
251263 if ( to !== related && list && component . getUnderlyingVm ) {
252264 var destination = component . getUnderlyingVm ( related ) ;
253- return _extends ( destination , context ) ;
265+ if ( destination ) {
266+ return _extends ( destination , context ) ;
267+ }
254268 }
255269
256270 return context ;
0 commit comments