|
|
@ -400,27 +400,9 @@ BI.Layout = BI.inherit(BI.Widget, { |
|
|
|
oldEndVnode = oldCh[--oldEndIdx]; |
|
|
|
oldEndVnode = oldCh[--oldEndIdx]; |
|
|
|
newStartVnode = newCh[++newStartIdx]; |
|
|
|
newStartVnode = newCh[++newStartIdx]; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (oldKeyToIdx === undefined) { |
|
|
|
var node = addNode(newStartVnode); |
|
|
|
oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); |
|
|
|
insertBefore(node, oldStartVnode); |
|
|
|
} |
|
|
|
newStartVnode = newCh[++newStartIdx]; |
|
|
|
idxInOld = oldKeyToIdx[newStartVnode.key]; |
|
|
|
|
|
|
|
if (BI.isNull(idxInOld)) { |
|
|
|
|
|
|
|
var node = addNode(newStartVnode); |
|
|
|
|
|
|
|
insertBefore(node, oldStartVnode); |
|
|
|
|
|
|
|
newStartVnode = newCh[++newStartIdx]; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
elmToMove = oldCh[idxInOld]; |
|
|
|
|
|
|
|
var node = addNode(newStartVnode); |
|
|
|
|
|
|
|
insertBefore(node, oldStartVnode); |
|
|
|
|
|
|
|
// if (elmToMove.sel !== newStartVnode.sel) {
|
|
|
|
|
|
|
|
// api.insertBefore(parentElm, createElm(newStartVnode), oldStartVnode.elm);
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// updated = this.patchItem(elmToMove, newStartVnode, idxInOld) || updated;
|
|
|
|
|
|
|
|
// oldCh[idxInOld] = undefined;
|
|
|
|
|
|
|
|
// api.insertBefore(parentElm, (elmToMove.elm), oldStartVnode.elm);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
newStartVnode = newCh[++newStartIdx]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (oldStartIdx > oldEndIdx) { |
|
|
|
if (oldStartIdx > oldEndIdx) { |
|
|
@ -493,15 +475,6 @@ BI.Layout = BI.inherit(BI.Widget, { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function createKeyToOldIdx(children, beginIdx, endIdx) { |
|
|
|
|
|
|
|
var i, map = {}, key; |
|
|
|
|
|
|
|
for (i = beginIdx; i <= endIdx; ++i) { |
|
|
|
|
|
|
|
key = children[i].key; |
|
|
|
|
|
|
|
if (key !== undefined) map[key] = i; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return map; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return updated; |
|
|
|
return updated; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|