@@ -18,11 +18,8 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
18
18
}
19
19
20
20
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 ) ;
26
23
}
27
24
28
25
function computeVmIndex ( vnodes , element ) {
@@ -31,17 +28,20 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
31
28
} ) . indexOf ( element ) ;
32
29
}
33
30
34
- function _computeIndexes ( slots , children ) {
31
+ function _computeIndexes ( slots , children , isTransition ) {
35
32
if ( ! slots ) {
36
33
return [ ] ;
37
34
}
38
35
39
36
var elmFromNodes = slots . map ( function ( elt ) {
40
37
return elt . elm ;
41
38
} ) ;
42
- return [ ] . concat ( _toConsumableArray ( children ) ) . map ( function ( elt ) {
39
+ var rawIndexes = [ ] . concat ( _toConsumableArray ( children ) ) . map ( function ( elt ) {
43
40
return elmFromNodes . indexOf ( elt ) ;
44
41
} ) ;
42
+ return isTransition ? rawIndexes . filter ( function ( ind ) {
43
+ return ind !== - 1 ;
44
+ } ) : rawIndexes ;
45
45
}
46
46
47
47
function emit ( evtName , evtData ) {
@@ -114,13 +114,20 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
114
114
} ;
115
115
} ,
116
116
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 ] ;
119
120
if ( child . componentOptions && child . componentOptions . tag === "transition-group" ) {
120
121
this . transitionMode = true ;
121
122
}
122
123
}
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 ) ;
124
131
} ,
125
132
mounted : function mounted ( ) {
126
133
var _this3 = this ;
@@ -192,11 +199,16 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
192
199
var _this4 = this ;
193
200
194
201
this . $nextTick ( function ( ) {
195
- _this4 . visibleIndexes = _computeIndexes ( _this4 . getChildrenNodes ( ) , _this4 . rootContainer . children ) ;
202
+ _this4 . visibleIndexes = _computeIndexes ( _this4 . getChildrenNodes ( ) , _this4 . rootContainer . children , _this4 . transitionMode ) ;
196
203
} ) ;
197
204
} ,
198
205
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
+ }
200
212
var element = this . realList [ index ] ;
201
213
return { index : index , element : element } ;
202
214
} ,
@@ -250,7 +262,9 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
250
262
var context = { list : list , component : component } ;
251
263
if ( to !== related && list && component . getUnderlyingVm ) {
252
264
var destination = component . getUnderlyingVm ( related ) ;
253
- return _extends ( destination , context ) ;
265
+ if ( destination ) {
266
+ return _extends ( destination , context ) ;
267
+ }
254
268
}
255
269
256
270
return context ;
0 commit comments