From 3f8202499a966ffd3988fbe65f94071d10d411a6 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 28 Oct 2022 13:59:57 +0800 Subject: [PATCH 1/4] =?UTF-8?q?KERNEL-13158:=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/collection/collection.js | 36 +++++++++++++++++++++++++++-- src/base/grid/grid.js | 38 ++++++++++++++++++++++++++++--- 2 files changed, 69 insertions(+), 5 deletions(-) diff --git a/src/base/collection/collection.js b/src/base/collection/collection.js index d7f83a0f5..8d26825d5 100644 --- a/src/base/collection/collection.js +++ b/src/base/collection/collection.js @@ -280,12 +280,44 @@ BI.CollectionView = BI.inherit(BI.Widget, { } }, + _isOverflowX: function () { + var o = this.options; + // 兼容一下 + var scrollable = o.scrollable, scrollx = o.scrollx; + if (o.overflowX === false) { + return false; + } + if (scrollx) { + return true; + } + if (scrollable === true || scrollable === "x") { + return true; + } + return false; + }, + + _isOverflowY: function () { + var o = this.options; + // 兼容一下 + var scrollable = o.scrollable, scrolly = o.scrolly; + if (o.overflowX === false) { + return false; + } + if (scrolly) { + return true; + } + if (scrollable === true || scrollable === "x") { + return true; + } + return false; + }, + _getMaxScrollLeft: function () { - return Math.max(0, this._width - this.options.width + (this.options.overflowX ? BI.DOM.getScrollWidth() : 0)); + return Math.max(0, this._width - this.options.width + (this._isOverflowX() ? BI.DOM.getScrollWidth() : 0)); }, _getMaxScrollTop: function () { - return Math.max(0, this._height - this.options.height + (this.options.overflowY ? BI.DOM.getScrollWidth() : 0)); + return Math.max(0, this._height - this.options.height + (this._isOverflowY() ? BI.DOM.getScrollWidth() : 0)); }, _populate: function (items) { diff --git a/src/base/grid/grid.js b/src/base/grid/grid.js index d1385e4a1..f37201f73 100644 --- a/src/base/grid/grid.js +++ b/src/base/grid/grid.js @@ -96,7 +96,7 @@ BI.GridView = BI.inherit(BI.Widget, { this.element.scrollLeft(o.scrollLeft); } }, - + destroyed: function () { BI.each(this.renderedCells, function(i, cell) { cell.el._destroy(); @@ -262,12 +262,44 @@ BI.GridView = BI.inherit(BI.Widget, { } }, + _isOverflowX: function () { + var o = this.options; + // 兼容一下 + var scrollable = o.scrollable, scrollx = o.scrollx; + if (o.overflowX === false) { + return false; + } + if (scrollx) { + return true; + } + if (scrollable === true || scrollable === "x") { + return true; + } + return false; + }, + + _isOverflowY: function () { + var o = this.options; + // 兼容一下 + var scrollable = o.scrollable, scrolly = o.scrolly; + if (o.overflowX === false) { + return false; + } + if (scrolly) { + return true; + } + if (scrollable === true || scrollable === "x") { + return true; + } + return false; + }, + _getMaxScrollLeft: function () { - return Math.max(0, this._getContainerWidth() - this.options.width + (this.options.overflowX ? BI.DOM.getScrollWidth() : 0)); + return Math.max(0, this._getContainerWidth() - this.options.width + (this._isOverflowX() ? BI.DOM.getScrollWidth() : 0)); }, _getMaxScrollTop: function () { - return Math.max(0, this._getContainerHeight() - this.options.height + (this.options.overflowY ? BI.DOM.getScrollWidth() : 0)); + return Math.max(0, this._getContainerHeight() - this.options.height + (this._isOverflowY() ? BI.DOM.getScrollWidth() : 0)); }, _getContainerWidth: function () { From 35e914d9c36931b28d9094e0ae8e6d9124ea8558 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 28 Oct 2022 14:10:00 +0800 Subject: [PATCH 2/4] update --- server.js | 2 +- src/base/collection/collection.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index a9fd0cede..5e080f9d4 100644 --- a/server.js +++ b/server.js @@ -9,5 +9,5 @@ const port = 3000; app.use(express.static("./")); app.listen(port, function() { console.log("server start"); - open('http://localhost:' + port + '/index.html'); + open('http://localhost:' + port + '/examples/useContext.html'); }); diff --git a/src/base/collection/collection.js b/src/base/collection/collection.js index 8d26825d5..f45437627 100644 --- a/src/base/collection/collection.js +++ b/src/base/collection/collection.js @@ -290,7 +290,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { if (scrollx) { return true; } - if (scrollable === true || scrollable === "x") { + if (scrollable === true || scrollable === "xy" || scrollable === "x") { return true; } return false; @@ -306,7 +306,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { if (scrolly) { return true; } - if (scrollable === true || scrollable === "x") { + if (scrollable === true || scrollable === "xy" || scrollable === "y") { return true; } return false; From fbc43231b8a44e5e3383feb4fb5adbd1342187b9 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 28 Oct 2022 14:10:22 +0800 Subject: [PATCH 3/4] update --- server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.js b/server.js index 5e080f9d4..a9fd0cede 100644 --- a/server.js +++ b/server.js @@ -9,5 +9,5 @@ const port = 3000; app.use(express.static("./")); app.listen(port, function() { console.log("server start"); - open('http://localhost:' + port + '/examples/useContext.html'); + open('http://localhost:' + port + '/index.html'); }); From 12d2fc5d5443b0b828c6e3a4ca3a2af3bdf7bce2 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 28 Oct 2022 14:11:10 +0800 Subject: [PATCH 4/4] update --- src/base/grid/grid.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/base/grid/grid.js b/src/base/grid/grid.js index f37201f73..944a82d4a 100644 --- a/src/base/grid/grid.js +++ b/src/base/grid/grid.js @@ -272,7 +272,7 @@ BI.GridView = BI.inherit(BI.Widget, { if (scrollx) { return true; } - if (scrollable === true || scrollable === "x") { + if (scrollable === true || scrollable === "xy" || scrollable === "x") { return true; } return false; @@ -288,7 +288,7 @@ BI.GridView = BI.inherit(BI.Widget, { if (scrolly) { return true; } - if (scrollable === true || scrollable === "x") { + if (scrollable === true || scrollable === "xy" || scrollable === "y") { return true; } return false;