From 816f59ec0a260db00dd3d6b1835cfcc2f4700a7c Mon Sep 17 00:00:00 2001 From: jian Date: Thu, 23 Nov 2023 14:34:38 +0800 Subject: [PATCH 1/4] =?UTF-8?q?BI-134635=20fix:=20=E7=A9=BA=E7=99=BD?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E9=AB=98=E5=BA=A6=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fineui/src/base/list/virtualgrouplist.js | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/fineui/src/base/list/virtualgrouplist.js b/packages/fineui/src/base/list/virtualgrouplist.js index e2e0d5ddf..bdccaed3d 100644 --- a/packages/fineui/src/base/list/virtualgrouplist.js +++ b/packages/fineui/src/base/list/virtualgrouplist.js @@ -26,6 +26,7 @@ export class VirtualGroupList extends Widget { init() { this.renderedIndex = -1; + this._initSummaryHeight(); } static xtype = "bi.virtual_group_list"; @@ -44,7 +45,7 @@ export class VirtualGroupList extends Widget { }, { type: VirtualGroup.xtype, - height: rowHeight * items.length, + height: this.summaryHeight, ref: (ref) => { this.container = ref; }, @@ -83,8 +84,10 @@ export class VirtualGroupList extends Widget { o.scrollTop = this.element.scrollTop(); if (!this.ticking) { requestAnimationFrame(() => { + const start = new Date().getTime(); this._calculateBlocksToRender(); this.ticking = false; + console.log(new Date().getTime() - start); }); this.ticking = true; } @@ -200,16 +203,21 @@ export class VirtualGroupList extends Widget { _restore() { const o = this.options; this.renderedIndex = -1; - if (isFunction(o.rowHeight)) { - this.summaryHeight = sum(o.items, o.rowHeight); - } else { - this.summaryHeight = this._isAutoHeight() ? 0 : o.rowHeight * o.items.length; - } + this._initSummaryHeight(); // 依赖于cache的占位元素也要初始化 this.topBlank.setHeight(0); this.bottomBlank.setHeight(0); } + _initSummaryHeight() { + const { rowHeight, items } = this.options; + if (isFunction(rowHeight)) { + this.summaryHeight = sum(items, rowHeight); + } else { + this.summaryHeight = this._isAutoHeight() ? 0 : rowHeight * items.length; + } + } + // 暂时只支持固定行高的场景 scrollTo(scrollTop) { this.options.scrollTop = scrollTop; From 4e019804a4870dbf8a388fbeced0bc50f1a7eaf8 Mon Sep 17 00:00:00 2001 From: jian Date: Thu, 23 Nov 2023 14:36:48 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20=E5=A4=9A?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/base/list/virtualgrouplist.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/fineui/src/base/list/virtualgrouplist.js b/packages/fineui/src/base/list/virtualgrouplist.js index bdccaed3d..caf29c909 100644 --- a/packages/fineui/src/base/list/virtualgrouplist.js +++ b/packages/fineui/src/base/list/virtualgrouplist.js @@ -84,10 +84,8 @@ export class VirtualGroupList extends Widget { o.scrollTop = this.element.scrollTop(); if (!this.ticking) { requestAnimationFrame(() => { - const start = new Date().getTime(); this._calculateBlocksToRender(); this.ticking = false; - console.log(new Date().getTime() - start); }); this.ticking = true; } From f9b49d724175a0ced0a5acf10ce1d933e9c7646f Mon Sep 17 00:00:00 2001 From: jian Date: Thu, 23 Nov 2023 15:14:22 +0800 Subject: [PATCH 3/4] =?UTF-8?q?Revert=20"=E6=97=A0jira=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=20=E5=A4=9A=E6=8F=90=E4=BA=A4=E7=9A=84"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 4e019804a4870dbf8a388fbeced0bc50f1a7eaf8. --- packages/fineui/src/base/list/virtualgrouplist.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/fineui/src/base/list/virtualgrouplist.js b/packages/fineui/src/base/list/virtualgrouplist.js index caf29c909..bdccaed3d 100644 --- a/packages/fineui/src/base/list/virtualgrouplist.js +++ b/packages/fineui/src/base/list/virtualgrouplist.js @@ -84,8 +84,10 @@ export class VirtualGroupList extends Widget { o.scrollTop = this.element.scrollTop(); if (!this.ticking) { requestAnimationFrame(() => { + const start = new Date().getTime(); this._calculateBlocksToRender(); this.ticking = false; + console.log(new Date().getTime() - start); }); this.ticking = true; } From 17e768f7d324cf2231d12c1f271a366f4b5fce7d Mon Sep 17 00:00:00 2001 From: jian Date: Thu, 23 Nov 2023 15:14:25 +0800 Subject: [PATCH 4/4] =?UTF-8?q?Revert=20"BI-134635=20fix:=20=E7=A9=BA?= =?UTF-8?q?=E7=99=BD=E9=97=AE=E9=A2=98=EF=BC=8C=E9=AB=98=E5=BA=A6=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 816f59ec0a260db00dd3d6b1835cfcc2f4700a7c. --- .../fineui/src/base/list/virtualgrouplist.js | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/packages/fineui/src/base/list/virtualgrouplist.js b/packages/fineui/src/base/list/virtualgrouplist.js index bdccaed3d..e2e0d5ddf 100644 --- a/packages/fineui/src/base/list/virtualgrouplist.js +++ b/packages/fineui/src/base/list/virtualgrouplist.js @@ -26,7 +26,6 @@ export class VirtualGroupList extends Widget { init() { this.renderedIndex = -1; - this._initSummaryHeight(); } static xtype = "bi.virtual_group_list"; @@ -45,7 +44,7 @@ export class VirtualGroupList extends Widget { }, { type: VirtualGroup.xtype, - height: this.summaryHeight, + height: rowHeight * items.length, ref: (ref) => { this.container = ref; }, @@ -84,10 +83,8 @@ export class VirtualGroupList extends Widget { o.scrollTop = this.element.scrollTop(); if (!this.ticking) { requestAnimationFrame(() => { - const start = new Date().getTime(); this._calculateBlocksToRender(); this.ticking = false; - console.log(new Date().getTime() - start); }); this.ticking = true; } @@ -203,21 +200,16 @@ export class VirtualGroupList extends Widget { _restore() { const o = this.options; this.renderedIndex = -1; - this._initSummaryHeight(); + if (isFunction(o.rowHeight)) { + this.summaryHeight = sum(o.items, o.rowHeight); + } else { + this.summaryHeight = this._isAutoHeight() ? 0 : o.rowHeight * o.items.length; + } // 依赖于cache的占位元素也要初始化 this.topBlank.setHeight(0); this.bottomBlank.setHeight(0); } - _initSummaryHeight() { - const { rowHeight, items } = this.options; - if (isFunction(rowHeight)) { - this.summaryHeight = sum(items, rowHeight); - } else { - this.summaryHeight = this._isAutoHeight() ? 0 : rowHeight * items.length; - } - } - // 暂时只支持固定行高的场景 scrollTo(scrollTop) { this.options.scrollTop = scrollTop;