|
|
|
@ -31667,7 +31667,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
var childrenToDisplay = this._cellRenderers(bottom - top, right - left, left, top); |
|
|
|
|
var renderedCells = [], renderedKeys = [], renderedWidgets = {}; |
|
|
|
|
var renderedCells = [], renderedKeys = {}, renderedWidgets = {}; |
|
|
|
|
//存储所有的left和top
|
|
|
|
|
var lefts = {}, tops = {}; |
|
|
|
|
for (var i = 0, len = childrenToDisplay.length; i < len; i++) { |
|
|
|
@ -31695,9 +31695,9 @@ BI.CollectionView = BI.inherit(BI.Widget, {
|
|
|
|
|
}; |
|
|
|
|
for (var i = 0, len = childrenToDisplay.length; i < len; i++) { |
|
|
|
|
var datum = childrenToDisplay[i]; |
|
|
|
|
var index = BI.deepIndexOf(this.renderedKeys, datum.index); |
|
|
|
|
var index = this.renderedKeys[datum.index] && this.renderedKeys[datum.index][1]; |
|
|
|
|
var child; |
|
|
|
|
if (index > -1) { |
|
|
|
|
if (index >= 0) { |
|
|
|
|
if (datum.width !== this.renderedCells[index]._width) { |
|
|
|
|
this.renderedCells[index]._width = datum.width; |
|
|
|
|
this.renderedCells[index].el.setWidth(datum.width); |
|
|
|
@ -31752,34 +31752,34 @@ BI.CollectionView = BI.inherit(BI.Widget, {
|
|
|
|
|
bottomBorder[l] = Math.max(bottomBorder[l], datum.y + datum.height); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
renderedKeys.push(datum.index); |
|
|
|
|
renderedKeys[datum.index] = [datum.index, i]; |
|
|
|
|
renderedWidgets[i] = child; |
|
|
|
|
} |
|
|
|
|
//已存在的, 需要添加的和需要删除的
|
|
|
|
|
var existSet = {}, addSet = {}, deleteArray = []; |
|
|
|
|
BI.each(renderedKeys, function (i, key) { |
|
|
|
|
if (BI.deepContains(self.renderedKeys, key)) { |
|
|
|
|
if (self.renderedKeys[i]) { |
|
|
|
|
existSet[i] = key; |
|
|
|
|
} else { |
|
|
|
|
addSet[i] = key; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
BI.each(this.renderedKeys, function (i, key) { |
|
|
|
|
if (BI.deepContains(existSet, key)) { |
|
|
|
|
if (existSet[i]) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (BI.deepContains(addSet, key)) { |
|
|
|
|
if (addSet[i]) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
deleteArray.push(i); |
|
|
|
|
deleteArray.push(key[1]); |
|
|
|
|
}); |
|
|
|
|
BI.each(deleteArray, function (i, index) { |
|
|
|
|
//性能优化,不调用destroy方法防止触发destroy事件
|
|
|
|
|
self.renderedCells[index].el._destroy(); |
|
|
|
|
}); |
|
|
|
|
var addedItems = []; |
|
|
|
|
BI.each(addSet, function (index) { |
|
|
|
|
addedItems.push(renderedCells[index]) |
|
|
|
|
BI.each(addSet, function (index, key) { |
|
|
|
|
addedItems.push(renderedCells[key[1]]) |
|
|
|
|
}); |
|
|
|
|
this.container.addItems(addedItems); |
|
|
|
|
//拦截父子级关系
|
|
|
|
@ -43846,19 +43846,19 @@ BI.GridView = BI.inherit(BI.Widget, {
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var renderedCells = [], renderedKeys = [], renderedWidgets = {}; |
|
|
|
|
var renderedCells = [], renderedKeys = {}, renderedWidgets = {}; |
|
|
|
|
var minX = this._getMaxScrollLeft(), minY = this._getMaxScrollTop(), maxX = 0, maxY = 0; |
|
|
|
|
var count = 0; |
|
|
|
|
for (var rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) { |
|
|
|
|
var rowDatum = this._rowSizeAndPositionManager.getSizeAndPositionOfCell(rowIndex); |
|
|
|
|
|
|
|
|
|
for (var columnIndex = columnStartIndex; columnIndex <= columnStopIndex; columnIndex++) { |
|
|
|
|
var key = [rowIndex, columnIndex]; |
|
|
|
|
var key = rowIndex + "-" + columnIndex; |
|
|
|
|
var columnDatum = this._columnSizeAndPositionManager.getSizeAndPositionOfCell(columnIndex); |
|
|
|
|
|
|
|
|
|
var index = BI.deepIndexOf(this.renderedKeys, key); |
|
|
|
|
var index = this.renderedKeys[key] && this.renderedKeys[key][2]; |
|
|
|
|
var child; |
|
|
|
|
if (index > -1) { |
|
|
|
|
if (index >= 0) { |
|
|
|
|
if (columnDatum.size !== this.renderedCells[index]._width) { |
|
|
|
|
this.renderedCells[index]._width = columnDatum.size; |
|
|
|
|
this.renderedCells[index].el.setWidth(columnDatum.size); |
|
|
|
@ -43900,35 +43900,36 @@ BI.GridView = BI.inherit(BI.Widget, {
|
|
|
|
|
maxX = Math.max(maxX, columnDatum.offset + horizontalOffsetAdjustment + columnDatum.size); |
|
|
|
|
minY = Math.min(minY, rowDatum.offset + verticalOffsetAdjustment); |
|
|
|
|
maxY = Math.max(maxY, rowDatum.offset + verticalOffsetAdjustment + rowDatum.size); |
|
|
|
|
renderedKeys.push(key); |
|
|
|
|
renderedWidgets[count++] = child; |
|
|
|
|
renderedKeys[key] = [rowIndex, columnIndex, count]; |
|
|
|
|
renderedWidgets[count] = child; |
|
|
|
|
count++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//已存在的, 需要添加的和需要删除的
|
|
|
|
|
var existSet = {}, addSet = {}, deleteArray = []; |
|
|
|
|
BI.each(renderedKeys, function (i, key) { |
|
|
|
|
if (BI.deepContains(self.renderedKeys, key)) { |
|
|
|
|
if (self.renderedKeys[i]) { |
|
|
|
|
existSet[i] = key; |
|
|
|
|
} else { |
|
|
|
|
addSet[i] = key; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
BI.each(this.renderedKeys, function (i, key) { |
|
|
|
|
if (BI.deepContains(existSet, key)) { |
|
|
|
|
if (existSet[i]) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (BI.deepContains(addSet, key)) { |
|
|
|
|
if (addSet[i]) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
deleteArray.push(i); |
|
|
|
|
deleteArray.push(key[2]); |
|
|
|
|
}); |
|
|
|
|
BI.each(deleteArray, function (i, index) { |
|
|
|
|
//性能优化,不调用destroy方法防止触发destroy事件
|
|
|
|
|
self.renderedCells[index].el._destroy(); |
|
|
|
|
}); |
|
|
|
|
var addedItems = []; |
|
|
|
|
BI.each(addSet, function (index) { |
|
|
|
|
addedItems.push(renderedCells[index]) |
|
|
|
|
BI.each(addSet, function (index, key) { |
|
|
|
|
addedItems.push(renderedCells[key[2]]) |
|
|
|
|
}); |
|
|
|
|
this.container.addItems(addedItems); |
|
|
|
|
//拦截父子级关系
|
|
|
|
|