diff --git a/package.json b/package.json index b86f38463..4ba289f11 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20221027160615", + "version": "2.0.20221028145548", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts", diff --git a/src/base/collection/collection.js b/src/base/collection/collection.js index d7f83a0f5..f45437627 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 === "xy" || 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 === "xy" || scrollable === "y") { + 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..944a82d4a 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 === "xy" || 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 === "xy" || scrollable === "y") { + 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 () { diff --git a/src/core/platform/web/detectElementResize.js b/src/core/platform/web/detectElementResize.js index 357e938a7..3183a57c4 100644 --- a/src/core/platform/web/detectElementResize.js +++ b/src/core/platform/web/detectElementResize.js @@ -553,7 +553,7 @@ var ResizeObserver = window.ResizeObserver || ResizeObserverPolyfill.ResizeObser if (!element.__resizeObserver__) { var resizeObserver = new ResizeObserver(function () { element.__resizeListeners__.forEach(function (listener) { - listener(); + BI.$(element).is(":visible") && listener(); }); }); resizeObserver.observe(element);