From 93dd40d3621344ab39a581dce04856e62868cf80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=E5=B1=8F=E5=B1=B1=E6=9C=80=E9=80=9F=E4=B8=8B?= =?UTF-8?q?=E5=B1=B1=E4=BC=A0=E8=AF=B4?= Date: Tue, 2 Jul 2024 17:28:51 +0800 Subject: [PATCH 1/4] =?UTF-8?q?REPORT-125909=20fix:=20=E3=80=90=E5=85=AC?= =?UTF-8?q?=E5=85=B1=E6=A8=A1=E5=9E=8B=E5=BC=95=E5=85=A5BI=E3=80=91?= =?UTF-8?q?=E4=BD=8E=E7=89=88=E6=9C=ACchrome=EF=BC=8C=E7=BB=B4=E5=BA=A6?= =?UTF-8?q?=E6=8C=87=E6=A0=87=E9=9B=86=E5=9C=A8=E7=BB=84=E4=BB=B6=E5=88=86?= =?UTF-8?q?=E6=9E=90=E5=8C=BA=E5=9F=9F=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/fineui/package.json b/packages/fineui/package.json index f467aa097..17ef6a00a 100644 --- a/packages/fineui/package.json +++ b/packages/fineui/package.json @@ -57,7 +57,7 @@ "jquery": "3.6.3" }, "devDependencies": { - "core-js": "^3.30.2", + "core-js": "^3.37.1", "cross-env": "^7.0.3" } -} \ No newline at end of file +} From f0750f646f8cf8a6de071f6ae73b192a853ff951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=E5=B1=8F=E5=B1=B1=E6=9C=80=E9=80=9F=E4=B8=8B?= =?UTF-8?q?=E5=B1=B1=E4=BC=A0=E8=AF=B4?= Date: Wed, 10 Jul 2024 09:08:30 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=97=A0JIRA=20layout=20=E7=9A=84updateChi?= =?UTF-8?q?ldren=E8=BF=87=E7=A8=8B=E4=B8=AD=E4=BC=A0=E9=80=92context?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/core/wrapper/layout.js | 154 ++++++++++++--------- 1 file changed, 86 insertions(+), 68 deletions(-) diff --git a/packages/fineui/src/core/wrapper/layout.js b/packages/fineui/src/core/wrapper/layout.js index 288d586eb..adaf5d351 100644 --- a/packages/fineui/src/core/wrapper/layout.js +++ b/packages/fineui/src/core/wrapper/layout.js @@ -1,4 +1,17 @@ -import { isNull, isFunction, each, stripEL, keys, isArray, contains, isKey, isOdd, isWidget, isNotNull, has } from "../2.base"; +import { + isNull, + isFunction, + each, + stripEL, + keys, + isArray, + contains, + isKey, + isOdd, + isWidget, + isNotNull, + has +} from "../2.base"; import { Widget } from "../4.widget"; import { _lazyCreateWidget, Providers } from "../5.inject"; import { shortcut } from "../decorator"; @@ -65,38 +78,38 @@ export class Layout extends Widget { _init4Scroll() { switch (this.options.scrollable) { - case true: - case "xy": - this.element.css("overflow", "auto"); - - return; - case false: - this.element.css("overflow", "hidden"); - - return; - case "x": - this.element.css({ - "overflow-x": "auto", - "overflow-y": "hidden", - }); - - return; - case "y": - this.element.css({ - "overflow-x": "hidden", - "overflow-y": "auto", - }); - - return; - default : - break; + case true: + case "xy": + this.element.css("overflow", "auto"); + + return; + case false: + this.element.css("overflow", "hidden"); + + return; + case "x": + this.element.css({ + "overflow-x": "auto", + "overflow-y": "hidden", + }); + + return; + case "y": + this.element.css({ + "overflow-x": "hidden", + "overflow-y": "auto", + }); + + return; + default : + break; } if (this.options.scrollx) { this.element.css({ "overflow-x": "auto", "overflow-y": "hidden", }); - + return; } if (this.options.scrolly) { @@ -149,7 +162,7 @@ export class Layout extends Widget { } else { w = this.getWidgetByName(this._getChildName(i)); } - + return w; } @@ -163,7 +176,7 @@ export class Layout extends Widget { } }); }); - + return this._addElement(i, item, context, w); } @@ -175,7 +188,7 @@ export class Layout extends Widget { if (item instanceof Widget) { item = item.options; } - + return item; } @@ -190,19 +203,19 @@ export class Layout extends Widget { } const className = Object.prototype.toString.call(a); switch (className) { - case "[object RegExp]": - case "[object String]": - return `${a}` === `${b}`; - case "[object Number]": - if (+a !== +a) { - return +b !== +b; - } - - return +a === 0 ? 1 / +a === 1 / b : +a === +b; - case "[object Date]": - case "[object Boolean]": - return +a === +b; - default: + case "[object RegExp]": + case "[object String]": + return `${a}` === `${b}`; + case "[object Number]": + if (+a !== +a) { + return +b !== +b; + } + + return +a === 0 ? 1 / +a === 1 / b : +a === +b; + case "[object Date]": + case "[object Boolean]": + return +a === +b; + default: } const areArrays = className === "[object Array]"; @@ -252,10 +265,10 @@ export class Layout extends Widget { } aStack.pop(); bStack.pop(); - + return true; }; - + return eq(item1, item2); } @@ -264,9 +277,9 @@ export class Layout extends Widget { } // 不依赖于this.options.items进行更新 - _updateItemAt(oldIndex, newIndex, item) { + _updateItemAt(oldIndex, newIndex, item, context) { const del = this._children[this._getChildName(oldIndex)]; - const w = this._newElement(newIndex, item); + const w = this._newElement(newIndex, item, context); // 需要有个地方临时存一下新建的组件,否则如果直接使用newIndex的话,newIndex位置的元素可能会被用到 this._children[`${this._getChildName(newIndex)}-temp`] = w; const nextSibling = del.element.next(); @@ -277,7 +290,7 @@ export class Layout extends Widget { } del._destroy(); w._mount(); - + return true; } @@ -314,42 +327,47 @@ export class Layout extends Widget { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._lgap || 0) + (item.lgap || 0)) : item._lgap) || 0; } - + return (item._lgap || 0) + (item.lgap || 0); } + _optimiseItemRgap(item) { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._rgap || 0) + (item.rgap || 0)) : item._rgap) || 0; } - + return (item._rgap || 0) + (item.rgap || 0); } + _optimiseItemTgap(item) { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._tgap || 0) + (item.tgap || 0)) : item._tgap) || 0; } - + return (item._tgap || 0) + (item.tgap || 0); } + _optimiseItemBgap(item) { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._bgap || 0) + (item.bgap || 0)) : item._bgap) || 0; } - + return (item._bgap || 0) + (item.bgap || 0); } + _optimiseItemHgap(item) { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._hgap || 0) + (item.hgap || 0)) : item._hgap) || 0; } - + return (item._hgap || 0) + (item.hgap || 0); } + _optimiseItemVgap(item) { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._vgap || 0) + (item.vgap || 0)) : item._vgap) || 0; } - + return (item._vgap || 0) + (item.vgap || 0); } @@ -450,7 +468,7 @@ export class Layout extends Widget { w.element.prependTo(this._getWrapper()); } w._mount(); - + return w; } @@ -479,7 +497,7 @@ export class Layout extends Widget { if (!child || !child.shouldUpdate) { return null; } - + return child.shouldUpdate(this._getOptions(item)); } @@ -532,7 +550,7 @@ export class Layout extends Widget { value = value.concat(v); } }); - + return value; } @@ -552,19 +570,19 @@ export class Layout extends Widget { }); } - patchItem(oldVnode, vnode, oldIndex, newIndex) { + patchItem(oldVnode, vnode, oldIndex, newIndex, context) { const shouldUpdate = this.shouldUpdateItem(oldIndex, vnode); const child = this._children[this._getChildName(oldIndex)]; if (shouldUpdate) { this._children[`${this._getChildName(newIndex)}-temp`] = child; - + return child._update(this._getOptions(vnode), shouldUpdate); } if (shouldUpdate === null && !this._compare(oldVnode, vnode)) { // if (child.update) { // return child.update(this._getOptions(vnode)); // } - return this._updateItemAt(oldIndex, newIndex, vnode); + return this._updateItemAt(oldIndex, newIndex, vnode, context); } } @@ -647,7 +665,7 @@ export class Layout extends Widget { findIndex = i; } } - + return [found, findIndex]; }; @@ -665,26 +683,26 @@ export class Layout extends Widget { } else if (isNull(oldEndVnode)) { oldEndVnode = oldCh[--oldEndIdx]; } else if (sameVnode(oldStartVnode, newStartVnode, oldStartIdx, newStartIdx)) { - const willUpdate = this.patchItem(oldStartVnode, newStartVnode, oldStartIdx, newStartIdx); + const willUpdate = this.patchItem(oldStartVnode, newStartVnode, oldStartIdx, newStartIdx, context); updated = willUpdate || updated; children[isNull(oldStartVnode.key) ? oldStartIdx : oldStartVnode.key] = willUpdate ? this._children[`${this._getChildName(newStartIdx)}-temp`] : this._children[this._getChildName(oldStartIdx)]; oldStartVnode = oldCh[++oldStartIdx]; newStartVnode = newCh[++newStartIdx]; } else if (sameVnode(oldEndVnode, newEndVnode, oldEndIdx, newEndIdx)) { - const willUpdate = this.patchItem(oldEndVnode, newEndVnode, oldEndIdx, newEndIdx); + const willUpdate = this.patchItem(oldEndVnode, newEndVnode, oldEndIdx, newEndIdx, context); updated = willUpdate || updated; children[isNull(oldEndVnode.key) ? oldEndIdx : oldEndVnode.key] = willUpdate ? this._children[`${this._getChildName(newEndIdx)}-temp`] : this._children[this._getChildName(oldEndIdx)]; oldEndVnode = oldCh[--oldEndIdx]; newEndVnode = newCh[--newEndIdx]; } else if (sameVnode(oldStartVnode, newEndVnode)) { - const willUpdate = this.patchItem(oldStartVnode, newEndVnode, oldStartIdx, newStartIdx); + const willUpdate = this.patchItem(oldStartVnode, newEndVnode, oldStartIdx, newStartIdx, context); updated = willUpdate || updated; children[isNull(oldStartVnode.key) ? oldStartIdx : oldStartVnode.key] = willUpdate ? this._children[`${this._getChildName(newStartIdx)}-temp`] : this._children[this._getChildName(oldStartIdx)]; insertBefore(oldStartVnode, oldEndVnode, true); oldStartVnode = oldCh[++oldStartIdx]; newEndVnode = newCh[--newEndIdx]; } else if (sameVnode(oldEndVnode, newStartVnode)) { - const willUpdate = this.patchItem(oldEndVnode, newStartVnode, oldEndIdx, newEndIdx); + const willUpdate = this.patchItem(oldEndVnode, newStartVnode, oldEndIdx, newEndIdx, context); updated = willUpdate || updated; children[isNull(oldEndVnode) ? oldEndIdx : oldEndVnode.key] = willUpdate ? this._children[`${this._getChildName(newEndIdx)}-temp`] : this._children[this._getChildName(oldEndIdx)]; insertBefore(oldEndVnode, oldStartVnode); @@ -697,7 +715,7 @@ export class Layout extends Widget { insertBefore(node, oldStartVnode); } else { // 如果新节点在旧节点区间中存在就复用一下 const sameOldIndex = sameOldVnode[1]; - const willUpdate = this.patchItem(sameOldVnode[0], newStartVnode, sameOldIndex, newStartIdx); + const willUpdate = this.patchItem(sameOldVnode[0], newStartVnode, sameOldIndex, newStartIdx, context); updated = willUpdate || updated; children[isNull(sameOldVnode[0].key) ? newStartIdx : sameOldVnode[0].key] = willUpdate ? this._children[`${this._getChildName(newStartIdx)}-temp`] : this._children[this._getChildName(sameOldIndex)]; oldCh[sameOldIndex] = undefined; @@ -744,7 +762,7 @@ export class Layout extends Widget { const context = opt.context; const oldItems = o.items; this.options.items = items; - + return this.updateChildren(oldItems, items, context); } @@ -808,7 +826,7 @@ export class Layout extends Widget { items, context: options.context, }); - + return; } this.options.items = items; From df79823d5acdeee937b3349018fa259e38110b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=E5=B1=8F=E5=B1=B1=E6=9C=80=E9=80=9F=E4=B8=8B?= =?UTF-8?q?=E5=B1=B1=E4=BC=A0=E8=AF=B4?= Date: Mon, 26 Aug 2024 11:13:47 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=97=A0JIRA=20tab=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=AD=90card=20destory=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/base/combination/tab.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/fineui/src/base/combination/tab.js b/packages/fineui/src/base/combination/tab.js index c9f79278a..8c6da9f4d 100644 --- a/packages/fineui/src/base/combination/tab.js +++ b/packages/fineui/src/base/combination/tab.js @@ -13,7 +13,8 @@ import { contains, any, isEqual, - LogicFactory + LogicFactory, + Events, } from "@/core"; /** @@ -106,7 +107,11 @@ export class Tab extends Widget { Widget.execWithContext(this, () => { this.cardMap[v] = cardCreator(v); }); - this.layout.addCardByName(v, this.cardMap[v]); + const card = this.layout.addCardByName(v, this.cardMap[v]); + card.on(Events.DESTROY, () => { + this.layout.deleteCardByName(v); + delete this.cardMap[v]; + }); } } From 1cc207c31cab4b89a0af7a907bbea1d0e3ea54b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=E5=B1=8F=E5=B1=B1=E6=9C=80=E9=80=9F=E4=B8=8B?= =?UTF-8?q?=E5=B1=B1=E4=BC=A0=E8=AF=B4?= Date: Mon, 26 Aug 2024 11:16:16 +0800 Subject: [PATCH 4/4] =?UTF-8?q?Revert=20"=E6=97=A0JIRA=20layout=20?= =?UTF-8?q?=E7=9A=84updateChildren=E8=BF=87=E7=A8=8B=E4=B8=AD=E4=BC=A0?= =?UTF-8?q?=E9=80=92context"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit f0750f646f8cf8a6de071f6ae73b192a853ff951. --- packages/fineui/src/core/wrapper/layout.js | 154 +++++++++------------ 1 file changed, 68 insertions(+), 86 deletions(-) diff --git a/packages/fineui/src/core/wrapper/layout.js b/packages/fineui/src/core/wrapper/layout.js index adaf5d351..288d586eb 100644 --- a/packages/fineui/src/core/wrapper/layout.js +++ b/packages/fineui/src/core/wrapper/layout.js @@ -1,17 +1,4 @@ -import { - isNull, - isFunction, - each, - stripEL, - keys, - isArray, - contains, - isKey, - isOdd, - isWidget, - isNotNull, - has -} from "../2.base"; +import { isNull, isFunction, each, stripEL, keys, isArray, contains, isKey, isOdd, isWidget, isNotNull, has } from "../2.base"; import { Widget } from "../4.widget"; import { _lazyCreateWidget, Providers } from "../5.inject"; import { shortcut } from "../decorator"; @@ -78,38 +65,38 @@ export class Layout extends Widget { _init4Scroll() { switch (this.options.scrollable) { - case true: - case "xy": - this.element.css("overflow", "auto"); - - return; - case false: - this.element.css("overflow", "hidden"); - - return; - case "x": - this.element.css({ - "overflow-x": "auto", - "overflow-y": "hidden", - }); - - return; - case "y": - this.element.css({ - "overflow-x": "hidden", - "overflow-y": "auto", - }); - - return; - default : - break; + case true: + case "xy": + this.element.css("overflow", "auto"); + + return; + case false: + this.element.css("overflow", "hidden"); + + return; + case "x": + this.element.css({ + "overflow-x": "auto", + "overflow-y": "hidden", + }); + + return; + case "y": + this.element.css({ + "overflow-x": "hidden", + "overflow-y": "auto", + }); + + return; + default : + break; } if (this.options.scrollx) { this.element.css({ "overflow-x": "auto", "overflow-y": "hidden", }); - + return; } if (this.options.scrolly) { @@ -162,7 +149,7 @@ export class Layout extends Widget { } else { w = this.getWidgetByName(this._getChildName(i)); } - + return w; } @@ -176,7 +163,7 @@ export class Layout extends Widget { } }); }); - + return this._addElement(i, item, context, w); } @@ -188,7 +175,7 @@ export class Layout extends Widget { if (item instanceof Widget) { item = item.options; } - + return item; } @@ -203,19 +190,19 @@ export class Layout extends Widget { } const className = Object.prototype.toString.call(a); switch (className) { - case "[object RegExp]": - case "[object String]": - return `${a}` === `${b}`; - case "[object Number]": - if (+a !== +a) { - return +b !== +b; - } - - return +a === 0 ? 1 / +a === 1 / b : +a === +b; - case "[object Date]": - case "[object Boolean]": - return +a === +b; - default: + case "[object RegExp]": + case "[object String]": + return `${a}` === `${b}`; + case "[object Number]": + if (+a !== +a) { + return +b !== +b; + } + + return +a === 0 ? 1 / +a === 1 / b : +a === +b; + case "[object Date]": + case "[object Boolean]": + return +a === +b; + default: } const areArrays = className === "[object Array]"; @@ -265,10 +252,10 @@ export class Layout extends Widget { } aStack.pop(); bStack.pop(); - + return true; }; - + return eq(item1, item2); } @@ -277,9 +264,9 @@ export class Layout extends Widget { } // 不依赖于this.options.items进行更新 - _updateItemAt(oldIndex, newIndex, item, context) { + _updateItemAt(oldIndex, newIndex, item) { const del = this._children[this._getChildName(oldIndex)]; - const w = this._newElement(newIndex, item, context); + const w = this._newElement(newIndex, item); // 需要有个地方临时存一下新建的组件,否则如果直接使用newIndex的话,newIndex位置的元素可能会被用到 this._children[`${this._getChildName(newIndex)}-temp`] = w; const nextSibling = del.element.next(); @@ -290,7 +277,7 @@ export class Layout extends Widget { } del._destroy(); w._mount(); - + return true; } @@ -327,47 +314,42 @@ export class Layout extends Widget { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._lgap || 0) + (item.lgap || 0)) : item._lgap) || 0; } - + return (item._lgap || 0) + (item.lgap || 0); } - _optimiseItemRgap(item) { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._rgap || 0) + (item.rgap || 0)) : item._rgap) || 0; } - + return (item._rgap || 0) + (item.rgap || 0); } - _optimiseItemTgap(item) { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._tgap || 0) + (item.tgap || 0)) : item._tgap) || 0; } - + return (item._tgap || 0) + (item.tgap || 0); } - _optimiseItemBgap(item) { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._bgap || 0) + (item.bgap || 0)) : item._bgap) || 0; } - + return (item._bgap || 0) + (item.bgap || 0); } - _optimiseItemHgap(item) { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._hgap || 0) + (item.hgap || 0)) : item._hgap) || 0; } - + return (item._hgap || 0) + (item.hgap || 0); } - _optimiseItemVgap(item) { if (Providers.getProvider(SystemProvider.xtype).getLayoutOptimize()) { return ((!item.type && item.el) ? ((item._vgap || 0) + (item.vgap || 0)) : item._vgap) || 0; } - + return (item._vgap || 0) + (item.vgap || 0); } @@ -468,7 +450,7 @@ export class Layout extends Widget { w.element.prependTo(this._getWrapper()); } w._mount(); - + return w; } @@ -497,7 +479,7 @@ export class Layout extends Widget { if (!child || !child.shouldUpdate) { return null; } - + return child.shouldUpdate(this._getOptions(item)); } @@ -550,7 +532,7 @@ export class Layout extends Widget { value = value.concat(v); } }); - + return value; } @@ -570,19 +552,19 @@ export class Layout extends Widget { }); } - patchItem(oldVnode, vnode, oldIndex, newIndex, context) { + patchItem(oldVnode, vnode, oldIndex, newIndex) { const shouldUpdate = this.shouldUpdateItem(oldIndex, vnode); const child = this._children[this._getChildName(oldIndex)]; if (shouldUpdate) { this._children[`${this._getChildName(newIndex)}-temp`] = child; - + return child._update(this._getOptions(vnode), shouldUpdate); } if (shouldUpdate === null && !this._compare(oldVnode, vnode)) { // if (child.update) { // return child.update(this._getOptions(vnode)); // } - return this._updateItemAt(oldIndex, newIndex, vnode, context); + return this._updateItemAt(oldIndex, newIndex, vnode); } } @@ -665,7 +647,7 @@ export class Layout extends Widget { findIndex = i; } } - + return [found, findIndex]; }; @@ -683,26 +665,26 @@ export class Layout extends Widget { } else if (isNull(oldEndVnode)) { oldEndVnode = oldCh[--oldEndIdx]; } else if (sameVnode(oldStartVnode, newStartVnode, oldStartIdx, newStartIdx)) { - const willUpdate = this.patchItem(oldStartVnode, newStartVnode, oldStartIdx, newStartIdx, context); + const willUpdate = this.patchItem(oldStartVnode, newStartVnode, oldStartIdx, newStartIdx); updated = willUpdate || updated; children[isNull(oldStartVnode.key) ? oldStartIdx : oldStartVnode.key] = willUpdate ? this._children[`${this._getChildName(newStartIdx)}-temp`] : this._children[this._getChildName(oldStartIdx)]; oldStartVnode = oldCh[++oldStartIdx]; newStartVnode = newCh[++newStartIdx]; } else if (sameVnode(oldEndVnode, newEndVnode, oldEndIdx, newEndIdx)) { - const willUpdate = this.patchItem(oldEndVnode, newEndVnode, oldEndIdx, newEndIdx, context); + const willUpdate = this.patchItem(oldEndVnode, newEndVnode, oldEndIdx, newEndIdx); updated = willUpdate || updated; children[isNull(oldEndVnode.key) ? oldEndIdx : oldEndVnode.key] = willUpdate ? this._children[`${this._getChildName(newEndIdx)}-temp`] : this._children[this._getChildName(oldEndIdx)]; oldEndVnode = oldCh[--oldEndIdx]; newEndVnode = newCh[--newEndIdx]; } else if (sameVnode(oldStartVnode, newEndVnode)) { - const willUpdate = this.patchItem(oldStartVnode, newEndVnode, oldStartIdx, newStartIdx, context); + const willUpdate = this.patchItem(oldStartVnode, newEndVnode, oldStartIdx, newStartIdx); updated = willUpdate || updated; children[isNull(oldStartVnode.key) ? oldStartIdx : oldStartVnode.key] = willUpdate ? this._children[`${this._getChildName(newStartIdx)}-temp`] : this._children[this._getChildName(oldStartIdx)]; insertBefore(oldStartVnode, oldEndVnode, true); oldStartVnode = oldCh[++oldStartIdx]; newEndVnode = newCh[--newEndIdx]; } else if (sameVnode(oldEndVnode, newStartVnode)) { - const willUpdate = this.patchItem(oldEndVnode, newStartVnode, oldEndIdx, newEndIdx, context); + const willUpdate = this.patchItem(oldEndVnode, newStartVnode, oldEndIdx, newEndIdx); updated = willUpdate || updated; children[isNull(oldEndVnode) ? oldEndIdx : oldEndVnode.key] = willUpdate ? this._children[`${this._getChildName(newEndIdx)}-temp`] : this._children[this._getChildName(oldEndIdx)]; insertBefore(oldEndVnode, oldStartVnode); @@ -715,7 +697,7 @@ export class Layout extends Widget { insertBefore(node, oldStartVnode); } else { // 如果新节点在旧节点区间中存在就复用一下 const sameOldIndex = sameOldVnode[1]; - const willUpdate = this.patchItem(sameOldVnode[0], newStartVnode, sameOldIndex, newStartIdx, context); + const willUpdate = this.patchItem(sameOldVnode[0], newStartVnode, sameOldIndex, newStartIdx); updated = willUpdate || updated; children[isNull(sameOldVnode[0].key) ? newStartIdx : sameOldVnode[0].key] = willUpdate ? this._children[`${this._getChildName(newStartIdx)}-temp`] : this._children[this._getChildName(sameOldIndex)]; oldCh[sameOldIndex] = undefined; @@ -762,7 +744,7 @@ export class Layout extends Widget { const context = opt.context; const oldItems = o.items; this.options.items = items; - + return this.updateChildren(oldItems, items, context); } @@ -826,7 +808,7 @@ export class Layout extends Widget { items, context: options.context, }); - + return; } this.options.items = items;