Browse Source

Pull request #3179: KERNEL-13158: 优化

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit '12d2fc5d5443b0b828c6e3a4ca3a2af3bdf7bce2':
  update
  update
  update
  KERNEL-13158: 优化
es6
guy-王川 2 years ago
parent
commit
c5e004e906
  1. 36
      src/base/collection/collection.js
  2. 36
      src/base/grid/grid.js

36
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 () { _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 () { _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) { _populate: function (items) {

36
src/base/grid/grid.js

@ -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 () { _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 () { _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 () { _getContainerWidth: function () {

Loading…
Cancel
Save