Browse Source

性能优化

es6
guy 8 years ago
parent
commit
407dba1645
  1. 34
      bi/base.js
  2. 2
      bi/case.js
  3. 34
      docs/base.js
  4. 2
      docs/case.js
  5. 10
      src/base/collection/collection.js
  6. 8
      src/base/grid/grid.js
  7. 8
      src/base/table/table.collection.js
  8. 8
      src/base/table/table.grid.js
  9. 2
      src/case/table/table.adaptive.js

34
bi/base.js

@ -2775,8 +2775,12 @@ BI.CollectionView = BI.inherit(BI.Widget, {
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.options.overflowY ? BI.DOM.getScrollWidth() : 0));
}, },
_populate: function () { _populate: function (items) {
var o = this.options; var o = this.options;
if (items && items !== this.options.items) {
this.options.items = items;
this._calculateSizeAndPositionData();
}
if (o.items.length > 0) { if (o.items.length > 0) {
this.container.setWidth(this._width); this.container.setWidth(this._width);
this.container.setHeight(this._height); this.container.setHeight(this._height);
@ -2868,11 +2872,9 @@ BI.CollectionView = BI.inherit(BI.Widget, {
populate: function (items) { populate: function (items) {
if (items && items !== this.options.items) { if (items && items !== this.options.items) {
this.options.items = items;
this._calculateSizeAndPositionData();
this.restore(); this.restore();
} }
this._populate(); this._populate(items);
} }
}); });
BI.CollectionView.EVENT_SCROLL = "EVENT_SCROLL"; BI.CollectionView.EVENT_SCROLL = "EVENT_SCROLL";
@ -14869,8 +14871,11 @@ BI.GridView = BI.inherit(BI.Widget, {
return Math.max(0, this._rowSizeAndPositionManager.getTotalSize() - this.options.height + (this.options.overflowY ? BI.DOM.getScrollWidth() : 0)); return Math.max(0, this._rowSizeAndPositionManager.getTotalSize() - this.options.height + (this.options.overflowY ? BI.DOM.getScrollWidth() : 0));
}, },
_populate: function () { _populate: function (items) {
var self = this, o = this.options; var self = this, o = this.options;
if (items && items !== this.options.items) {
this.options.items = items;
}
if (o.items.length > 0) { if (o.items.length > 0) {
this.columnCount = o.items[0].length; this.columnCount = o.items[0].length;
this.rowCount = o.items.length; this.rowCount = o.items.length;
@ -14978,10 +14983,9 @@ BI.GridView = BI.inherit(BI.Widget, {
populate: function (items) { populate: function (items) {
if (items && items !== this.options.items) { if (items && items !== this.options.items) {
this.options.items = items;
this.restore(); this.restore();
} }
this._populate(); this._populate(items);
} }
}); });
BI.GridView.EVENT_SCROLL = "EVENT_SCROLL"; BI.GridView.EVENT_SCROLL = "EVENT_SCROLL";
@ -28866,10 +28870,10 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
run(this.bottomLeftItems, o.items, leftItems); run(this.bottomLeftItems, o.items, leftItems);
run(this.bottomRightItems, o.items, rightItems); run(this.bottomRightItems, o.items, rightItems);
this.topLeftCollection.populate(leftHeader); this.topLeftCollection._populate(leftHeader);
this.topRightCollection.populate(rightHeader); this.topRightCollection._populate(rightHeader);
this.bottomLeftCollection.populate(leftItems); this.bottomLeftCollection._populate(leftItems);
this.bottomRightCollection.populate(rightItems); this.bottomRightCollection._populate(rightItems);
}, },
_digest: function () { _digest: function () {
@ -29696,10 +29700,10 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.contextLayout.attr("items", items); this.contextLayout.attr("items", items);
this.contextLayout.resize(); this.contextLayout.resize();
this.topLeftGrid.populate(this.header[0]); this.topLeftGrid._populate(this.header[0]);
this.topRightGrid.populate(this.header[1]); this.topRightGrid._populate(this.header[1]);
this.bottomLeftGrid.populate(this.items[0]); this.bottomLeftGrid._populate(this.items[0]);
this.bottomRightGrid.populate(this.items[1]); this.bottomRightGrid._populate(this.items[1]);
}, },
_populate: function () { _populate: function () {

2
bi/case.js

@ -8762,7 +8762,7 @@ BI.AdaptiveTable = BI.inherit(BI.Widget, {
freezeCols = []; freezeCols = [];
} }
if (!BI.isNumber(columnSize[0])) { if (!BI.isNumber(columnSize[0])) {
columnSize = o.minColumnSize; columnSize = o.minColumnSize.slice();
} }
var summaryFreezeColumnSize = 0, summaryColumnSize = 0; var summaryFreezeColumnSize = 0, summaryColumnSize = 0;
BI.each(columnSize, function (i, size) { BI.each(columnSize, function (i, size) {

34
docs/base.js

@ -2775,8 +2775,12 @@ BI.CollectionView = BI.inherit(BI.Widget, {
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.options.overflowY ? BI.DOM.getScrollWidth() : 0));
}, },
_populate: function () { _populate: function (items) {
var o = this.options; var o = this.options;
if (items && items !== this.options.items) {
this.options.items = items;
this._calculateSizeAndPositionData();
}
if (o.items.length > 0) { if (o.items.length > 0) {
this.container.setWidth(this._width); this.container.setWidth(this._width);
this.container.setHeight(this._height); this.container.setHeight(this._height);
@ -2868,11 +2872,9 @@ BI.CollectionView = BI.inherit(BI.Widget, {
populate: function (items) { populate: function (items) {
if (items && items !== this.options.items) { if (items && items !== this.options.items) {
this.options.items = items;
this._calculateSizeAndPositionData();
this.restore(); this.restore();
} }
this._populate(); this._populate(items);
} }
}); });
BI.CollectionView.EVENT_SCROLL = "EVENT_SCROLL"; BI.CollectionView.EVENT_SCROLL = "EVENT_SCROLL";
@ -14869,8 +14871,11 @@ BI.GridView = BI.inherit(BI.Widget, {
return Math.max(0, this._rowSizeAndPositionManager.getTotalSize() - this.options.height + (this.options.overflowY ? BI.DOM.getScrollWidth() : 0)); return Math.max(0, this._rowSizeAndPositionManager.getTotalSize() - this.options.height + (this.options.overflowY ? BI.DOM.getScrollWidth() : 0));
}, },
_populate: function () { _populate: function (items) {
var self = this, o = this.options; var self = this, o = this.options;
if (items && items !== this.options.items) {
this.options.items = items;
}
if (o.items.length > 0) { if (o.items.length > 0) {
this.columnCount = o.items[0].length; this.columnCount = o.items[0].length;
this.rowCount = o.items.length; this.rowCount = o.items.length;
@ -14978,10 +14983,9 @@ BI.GridView = BI.inherit(BI.Widget, {
populate: function (items) { populate: function (items) {
if (items && items !== this.options.items) { if (items && items !== this.options.items) {
this.options.items = items;
this.restore(); this.restore();
} }
this._populate(); this._populate(items);
} }
}); });
BI.GridView.EVENT_SCROLL = "EVENT_SCROLL"; BI.GridView.EVENT_SCROLL = "EVENT_SCROLL";
@ -28866,10 +28870,10 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
run(this.bottomLeftItems, o.items, leftItems); run(this.bottomLeftItems, o.items, leftItems);
run(this.bottomRightItems, o.items, rightItems); run(this.bottomRightItems, o.items, rightItems);
this.topLeftCollection.populate(leftHeader); this.topLeftCollection._populate(leftHeader);
this.topRightCollection.populate(rightHeader); this.topRightCollection._populate(rightHeader);
this.bottomLeftCollection.populate(leftItems); this.bottomLeftCollection._populate(leftItems);
this.bottomRightCollection.populate(rightItems); this.bottomRightCollection._populate(rightItems);
}, },
_digest: function () { _digest: function () {
@ -29696,10 +29700,10 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.contextLayout.attr("items", items); this.contextLayout.attr("items", items);
this.contextLayout.resize(); this.contextLayout.resize();
this.topLeftGrid.populate(this.header[0]); this.topLeftGrid._populate(this.header[0]);
this.topRightGrid.populate(this.header[1]); this.topRightGrid._populate(this.header[1]);
this.bottomLeftGrid.populate(this.items[0]); this.bottomLeftGrid._populate(this.items[0]);
this.bottomRightGrid.populate(this.items[1]); this.bottomRightGrid._populate(this.items[1]);
}, },
_populate: function () { _populate: function () {

2
docs/case.js

@ -8762,7 +8762,7 @@ BI.AdaptiveTable = BI.inherit(BI.Widget, {
freezeCols = []; freezeCols = [];
} }
if (!BI.isNumber(columnSize[0])) { if (!BI.isNumber(columnSize[0])) {
columnSize = o.minColumnSize; columnSize = o.minColumnSize.slice();
} }
var summaryFreezeColumnSize = 0, summaryColumnSize = 0; var summaryFreezeColumnSize = 0, summaryColumnSize = 0;
BI.each(columnSize, function (i, size) { BI.each(columnSize, function (i, size) {

10
src/base/collection/collection.js

@ -265,8 +265,12 @@ BI.CollectionView = BI.inherit(BI.Widget, {
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.options.overflowY ? BI.DOM.getScrollWidth() : 0));
}, },
_populate: function () { _populate: function (items) {
var o = this.options; var o = this.options;
if (items && items !== this.options.items) {
this.options.items = items;
this._calculateSizeAndPositionData();
}
if (o.items.length > 0) { if (o.items.length > 0) {
this.container.setWidth(this._width); this.container.setWidth(this._width);
this.container.setHeight(this._height); this.container.setHeight(this._height);
@ -358,11 +362,9 @@ BI.CollectionView = BI.inherit(BI.Widget, {
populate: function (items) { populate: function (items) {
if (items && items !== this.options.items) { if (items && items !== this.options.items) {
this.options.items = items;
this._calculateSizeAndPositionData();
this.restore(); this.restore();
} }
this._populate(); this._populate(items);
} }
}); });
BI.CollectionView.EVENT_SCROLL = "EVENT_SCROLL"; BI.CollectionView.EVENT_SCROLL = "EVENT_SCROLL";

8
src/base/grid/grid.js

@ -221,8 +221,11 @@ BI.GridView = BI.inherit(BI.Widget, {
return Math.max(0, this._rowSizeAndPositionManager.getTotalSize() - this.options.height + (this.options.overflowY ? BI.DOM.getScrollWidth() : 0)); return Math.max(0, this._rowSizeAndPositionManager.getTotalSize() - this.options.height + (this.options.overflowY ? BI.DOM.getScrollWidth() : 0));
}, },
_populate: function () { _populate: function (items) {
var self = this, o = this.options; var self = this, o = this.options;
if (items && items !== this.options.items) {
this.options.items = items;
}
if (o.items.length > 0) { if (o.items.length > 0) {
this.columnCount = o.items[0].length; this.columnCount = o.items[0].length;
this.rowCount = o.items.length; this.rowCount = o.items.length;
@ -330,10 +333,9 @@ BI.GridView = BI.inherit(BI.Widget, {
populate: function (items) { populate: function (items) {
if (items && items !== this.options.items) { if (items && items !== this.options.items) {
this.options.items = items;
this.restore(); this.restore();
} }
this._populate(); this._populate(items);
} }
}); });
BI.GridView.EVENT_SCROLL = "EVENT_SCROLL"; BI.GridView.EVENT_SCROLL = "EVENT_SCROLL";

8
src/base/table/table.collection.js

@ -306,10 +306,10 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
run(this.bottomLeftItems, o.items, leftItems); run(this.bottomLeftItems, o.items, leftItems);
run(this.bottomRightItems, o.items, rightItems); run(this.bottomRightItems, o.items, rightItems);
this.topLeftCollection.populate(leftHeader); this.topLeftCollection._populate(leftHeader);
this.topRightCollection.populate(rightHeader); this.topRightCollection._populate(rightHeader);
this.bottomLeftCollection.populate(leftItems); this.bottomLeftCollection._populate(leftItems);
this.bottomRightCollection.populate(rightItems); this.bottomRightCollection._populate(rightItems);
}, },
_digest: function () { _digest: function () {

8
src/base/table/table.grid.js

@ -347,10 +347,10 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.contextLayout.attr("items", items); this.contextLayout.attr("items", items);
this.contextLayout.resize(); this.contextLayout.resize();
this.topLeftGrid.populate(this.header[0]); this.topLeftGrid._populate(this.header[0]);
this.topRightGrid.populate(this.header[1]); this.topRightGrid._populate(this.header[1]);
this.bottomLeftGrid.populate(this.items[0]); this.bottomLeftGrid._populate(this.items[0]);
this.bottomRightGrid.populate(this.items[1]); this.bottomRightGrid._populate(this.items[1]);
}, },
_populate: function () { _populate: function () {

2
src/case/table/table.adaptive.js

@ -115,7 +115,7 @@ BI.AdaptiveTable = BI.inherit(BI.Widget, {
freezeCols = []; freezeCols = [];
} }
if (!BI.isNumber(columnSize[0])) { if (!BI.isNumber(columnSize[0])) {
columnSize = o.minColumnSize; columnSize = o.minColumnSize.slice();
} }
var summaryFreezeColumnSize = 0, summaryColumnSize = 0; var summaryFreezeColumnSize = 0, summaryColumnSize = 0;
BI.each(columnSize, function (i, size) { BI.each(columnSize, function (i, size) {

Loading…
Cancel
Save