From 5d3016f46a80b981434fdbe2ff861929f7788b2d Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Tue, 31 Mar 2020 11:59:33 +0800 Subject: [PATCH] js:fix list renderBunchedItems array size <0 --- doric-js/bundle/doric-lib.es5.js | 2 +- doric-js/bundle/doric-lib.js | 2 +- doric-js/bundle/doric-vm.js | 2 +- doric-js/lib/src/widget/list.js | 2 +- doric-js/src/widget/list.ts | 2 +- doric-web/dist/index.js | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doric-js/bundle/doric-lib.es5.js b/doric-js/bundle/doric-lib.es5.js index e2572521..364d30cd 100644 --- a/doric-js/bundle/doric-lib.es5.js +++ b/doric-js/bundle/doric-lib.es5.js @@ -1839,7 +1839,7 @@ var List = /** @class */ (function (_super) { List.prototype.renderBunchedItems = function (start, length) { var _this = this; this.ignoreDirtyCallOnce = true; - return new Array(Math.min(length, this.itemCount - start)).fill(0).map(function (_, idx) { + return new Array(Math.max(0, Math.min(length, this.itemCount - start))).fill(0).map(function (_, idx) { var listItem = _this.getItem(start + idx); return listItem.toModel(); }); diff --git a/doric-js/bundle/doric-lib.js b/doric-js/bundle/doric-lib.js index 947a3dae..89d7110f 100644 --- a/doric-js/bundle/doric-lib.js +++ b/doric-js/bundle/doric-lib.js @@ -1360,7 +1360,7 @@ class List extends Superview { } renderBunchedItems(start, length) { this.ignoreDirtyCallOnce = true; - return new Array(Math.min(length, this.itemCount - start)).fill(0).map((_, idx) => { + return new Array(Math.max(0, Math.min(length, this.itemCount - start))).fill(0).map((_, idx) => { const listItem = this.getItem(start + idx); return listItem.toModel(); }); diff --git a/doric-js/bundle/doric-vm.js b/doric-js/bundle/doric-vm.js index 559fe603..d7938f32 100644 --- a/doric-js/bundle/doric-vm.js +++ b/doric-js/bundle/doric-vm.js @@ -2819,7 +2819,7 @@ class List extends Superview { } renderBunchedItems(start, length) { this.ignoreDirtyCallOnce = true; - return new Array(Math.min(length, this.itemCount - start)).fill(0).map((_, idx) => { + return new Array(Math.max(0, Math.min(length, this.itemCount - start))).fill(0).map((_, idx) => { const listItem = this.getItem(start + idx); return listItem.toModel(); }); diff --git a/doric-js/lib/src/widget/list.js b/doric-js/lib/src/widget/list.js index 14df5f68..e38db723 100644 --- a/doric-js/lib/src/widget/list.js +++ b/doric-js/lib/src/widget/list.js @@ -67,7 +67,7 @@ export class List extends Superview { } renderBunchedItems(start, length) { this.ignoreDirtyCallOnce = true; - return new Array(Math.min(length, this.itemCount - start)).fill(0).map((_, idx) => { + return new Array(Math.max(0, Math.min(length, this.itemCount - start))).fill(0).map((_, idx) => { const listItem = this.getItem(start + idx); return listItem.toModel(); }); diff --git a/doric-js/src/widget/list.ts b/doric-js/src/widget/list.ts index e148c208..5d39cf9f 100644 --- a/doric-js/src/widget/list.ts +++ b/doric-js/src/widget/list.ts @@ -106,7 +106,7 @@ export class List extends Superview implements IList { private renderBunchedItems(start: number, length: number) { this.ignoreDirtyCallOnce = true - return new Array(Math.min(length, this.itemCount - start)).fill(0).map((_, idx) => { + return new Array(Math.max(0, Math.min(length, this.itemCount - start))).fill(0).map((_, idx) => { const listItem = this.getItem(start + idx) return listItem.toModel() }) diff --git a/doric-web/dist/index.js b/doric-web/dist/index.js index 9aa68934..0a8701f9 100644 --- a/doric-web/dist/index.js +++ b/doric-web/dist/index.js @@ -2877,7 +2877,7 @@ class List extends Superview { } renderBunchedItems(start, length) { this.ignoreDirtyCallOnce = true; - return new Array(Math.min(length, this.itemCount - start)).fill(0).map((_, idx) => { + return new Array(Math.max(0, Math.min(length, this.itemCount - start))).fill(0).map((_, idx) => { const listItem = this.getItem(start + idx); return listItem.toModel(); });