|
|
@ -58,7 +58,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { |
|
|
|
if (o.overflowY === false) { |
|
|
|
if (o.overflowY === false) { |
|
|
|
scrollable = false; |
|
|
|
scrollable = false; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
scrollable = "y" |
|
|
|
scrollable = "y"; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (o.overflowY === false) { |
|
|
|
if (o.overflowY === false) { |
|
|
@ -84,7 +84,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { |
|
|
|
|
|
|
|
|
|
|
|
// mounted之后绑定事件
|
|
|
|
// mounted之后绑定事件
|
|
|
|
mounted: function () { |
|
|
|
mounted: function () { |
|
|
|
var o = this.options; |
|
|
|
var o = this.options; |
|
|
|
if (o.scrollLeft !== 0 || o.scrollTop !== 0) { |
|
|
|
if (o.scrollLeft !== 0 || o.scrollTop !== 0) { |
|
|
|
this.element.scrollTop(o.scrollTop); |
|
|
|
this.element.scrollTop(o.scrollTop); |
|
|
|
this.element.scrollLeft(o.scrollLeft); |
|
|
|
this.element.scrollLeft(o.scrollLeft); |
|
|
@ -101,10 +101,10 @@ BI.CollectionView = BI.inherit(BI.Widget, { |
|
|
|
for (var index = 0, len = o.items.length; index < len; index++) { |
|
|
|
for (var index = 0, len = o.items.length; index < len; index++) { |
|
|
|
var cellMetadatum = o.cellSizeAndPositionGetter(index); |
|
|
|
var cellMetadatum = o.cellSizeAndPositionGetter(index); |
|
|
|
|
|
|
|
|
|
|
|
if (cellMetadatum.height == null || isNaN(cellMetadatum.height) || |
|
|
|
if (BI.isNull(cellMetadatum.height) || isNaN(cellMetadatum.height) || |
|
|
|
cellMetadatum.width == null || isNaN(cellMetadatum.width) || |
|
|
|
BI.isNull(cellMetadatum.width) || isNaN(cellMetadatum.width) || |
|
|
|
cellMetadatum.x == null || isNaN(cellMetadatum.x) || |
|
|
|
BI.isNull(cellMetadatum.x) || isNaN(cellMetadatum.x) || |
|
|
|
cellMetadatum.y == null || isNaN(cellMetadatum.y)) { |
|
|
|
BI.isNull(cellMetadatum.y) || isNaN(cellMetadatum.y)) { |
|
|
|
throw Error(); |
|
|
|
throw Error(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -124,16 +124,18 @@ BI.CollectionView = BI.inherit(BI.Widget, { |
|
|
|
|
|
|
|
|
|
|
|
_cellRenderers: function (height, width, x, y) { |
|
|
|
_cellRenderers: function (height, width, x, y) { |
|
|
|
this._lastRenderedCellIndices = this._sectionManager.getCellIndices(height, width, x, y); |
|
|
|
this._lastRenderedCellIndices = this._sectionManager.getCellIndices(height, width, x, y); |
|
|
|
|
|
|
|
|
|
|
|
return this._cellGroupRenderer(); |
|
|
|
return this._cellGroupRenderer(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_cellGroupRenderer: function () { |
|
|
|
_cellGroupRenderer: function () { |
|
|
|
var self = this, o = this.options; |
|
|
|
var self = this; |
|
|
|
var rendered = []; |
|
|
|
var rendered = []; |
|
|
|
BI.each(this._lastRenderedCellIndices, function (i, index) { |
|
|
|
BI.each(this._lastRenderedCellIndices, function (i, index) { |
|
|
|
var cellMetadata = self._sectionManager.getCellMetadata(index); |
|
|
|
var cellMetadata = self._sectionManager.getCellMetadata(index); |
|
|
|
rendered.push(cellMetadata); |
|
|
|
rendered.push(cellMetadata); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return rendered; |
|
|
|
return rendered; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -167,16 +169,16 @@ BI.CollectionView = BI.inherit(BI.Widget, { |
|
|
|
var topMap = BI.invert(tops); |
|
|
|
var topMap = BI.invert(tops); |
|
|
|
// 存储上下左右四个边界
|
|
|
|
// 存储上下左右四个边界
|
|
|
|
var leftBorder = {}, rightBorder = {}, topBorder = {}, bottomBorder = {}; |
|
|
|
var leftBorder = {}, rightBorder = {}, topBorder = {}, bottomBorder = {}; |
|
|
|
var assertMinBorder = function (border, offset) { |
|
|
|
function assertMinBorder(border, offset) { |
|
|
|
if (border[offset] == null) { |
|
|
|
if (BI.isNull(border[offset])) { |
|
|
|
border[offset] = Number.MAX_VALUE; |
|
|
|
border[offset] = Number.MAX_VALUE; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
var assertMaxBorder = function (border, offset) { |
|
|
|
function assertMaxBorder(border, offset) { |
|
|
|
if (border[offset] == null) { |
|
|
|
if (BI.isNull(border[offset])) { |
|
|
|
border[offset] = 0; |
|
|
|
border[offset] = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
for (var i = 0, len = childrenToDisplay.length; i < len; i++) { |
|
|
|
for (var i = 0, len = childrenToDisplay.length; i < len; i++) { |
|
|
|
var datum = childrenToDisplay[i]; |
|
|
|
var datum = childrenToDisplay[i]; |
|
|
|
var index = this.renderedKeys[datum.index] && this.renderedKeys[datum.index][1]; |
|
|
|
var index = this.renderedKeys[datum.index] && this.renderedKeys[datum.index][1]; |
|
|
@ -194,7 +196,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { |
|
|
|
this.renderedCells[index].el.element.css("left", datum.x / BI.pixRatio + BI.pixUnit); |
|
|
|
this.renderedCells[index].el.element.css("left", datum.x / BI.pixRatio + BI.pixUnit); |
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// if (this.renderedCells[index]._top !== datum.y) {
|
|
|
|
// if (this.renderedCells[index]._top !== datum.y) {
|
|
|
|
this.renderedCells[index].el.element.css("top", datum.y / BI.pixRatio + BI.pixUnit); |
|
|
|
this.renderedCells[index].el.element.css("top", datum.y / BI.pixRatio + BI.pixUnit); |
|
|
|
// }
|
|
|
|
// }
|
|
|
|
renderedCells.push(child = this.renderedCells[index]); |
|
|
|
renderedCells.push(child = this.renderedCells[index]); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -213,7 +215,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { |
|
|
|
left: datum.x, |
|
|
|
left: datum.x, |
|
|
|
top: datum.y, |
|
|
|
top: datum.y, |
|
|
|
_left: datum.x, |
|
|
|
_left: datum.x, |
|
|
|
_top: datum.y, |
|
|
|
_top: datum.y |
|
|
|
// _width: datum.width,
|
|
|
|
// _width: datum.width,
|
|
|
|
// _height: datum.height
|
|
|
|
// _height: datum.height
|
|
|
|
}); |
|
|
|
}); |
|
|
@ -280,7 +282,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { |
|
|
|
var minY = BI.max(topBorder); |
|
|
|
var minY = BI.max(topBorder); |
|
|
|
var maxY = BI.min(bottomBorder); |
|
|
|
var maxY = BI.min(bottomBorder); |
|
|
|
|
|
|
|
|
|
|
|
this.renderRange = {minX: minX, minY: minY, maxX: maxX, maxY: maxY}; |
|
|
|
this.renderRange = { minX: minX, minY: minY, maxX: maxX, maxY: maxY }; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -339,7 +341,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { |
|
|
|
if (this.options.overflowX !== !!b) { |
|
|
|
if (this.options.overflowX !== !!b) { |
|
|
|
this.options.overflowX = !!b; |
|
|
|
this.options.overflowX = !!b; |
|
|
|
BI.nextTick(function () { |
|
|
|
BI.nextTick(function () { |
|
|
|
self.element.css({overflowX: b ? "auto" : "hidden"}); |
|
|
|
self.element.css({ overflowX: b ? "auto" : "hidden" }); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
@ -349,7 +351,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { |
|
|
|
if (this.options.overflowY !== !!b) { |
|
|
|
if (this.options.overflowY !== !!b) { |
|
|
|
this.options.overflowY = !!b; |
|
|
|
this.options.overflowY = !!b; |
|
|
|
BI.nextTick(function () { |
|
|
|
BI.nextTick(function () { |
|
|
|
self.element.css({overflowY: b ? "auto" : "hidden"}); |
|
|
|
self.element.css({ overflowY: b ? "auto" : "hidden" }); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|