From 55a14bfbe7516d44dae6c6b1b546649c80e5ec44 Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 1 Aug 2017 15:05:15 +0800 Subject: [PATCH] add --- bi/base.js | 74 ++++++++++++++++++- bi/core.js | 25 +++++-- bi/widget.js | 5 ++ docs/base.js | 74 ++++++++++++++++++- docs/core.js | 25 +++++-- docs/widget.js | 5 ++ src/base/table/table.grid.js | 35 +++++++++ src/base/table/table.grid.quick.js | 39 +++++++++- src/core/base.js | 18 +++-- src/core/widget.js | 7 ++ .../adaptivearrangement.js | 5 ++ 11 files changed, 294 insertions(+), 18 deletions(-) diff --git a/bi/base.js b/bi/base.js index a2540ebd6..9e9bbe813 100644 --- a/bi/base.js +++ b/bi/base.js @@ -30103,6 +30103,41 @@ BI.GridTable = BI.inherit(BI.Widget, { this.contextLayout.attr("items", items); this.contextLayout.resize(); + this.topLeftGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.topRightGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.bottomLeftGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.bottomRightGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + + function overscan(grid, w, h, rSize, cSize) { + var rCount = h / rSize; + var cCount = w / cSize; + if (cCount * (120 / rSize) >= 60 || rCount * (120 / cSize) >= 60) { + grid.attr("overscanRowCount", 100); + grid.attr("overscanColumnCount", 100); + } + } + + if (freezeColLength > 0) { + overscan(this.topLeftGrid, tlw, tlh, o.headerRowSize, totalLeftColumnSize / freezeColLength); + overscan(this.bottomLeftGrid, blw, blh, o.rowSize, totalLeftColumnSize / freezeColLength); + } + if (o.columnSize.length - freezeColLength > 0) { + overscan(this.topRight, trw, trh, o.headerRowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength)); + overscan(this.bottomRightGrid, brw, brh, o.rowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength)); + } + this.topLeftGrid._populate(this.header[0]); this.topRightGrid._populate(this.header[1]); this.bottomLeftGrid._populate(this.items[0]); @@ -30329,7 +30364,8 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, { _populateTable: function () { var self = this, o = this.options; - var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = []; + var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, + summaryColumnSizeArray = []; var freezeColLength = this._getFreezeColLength(); BI.each(o.columnSize, function (i, size) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { @@ -30420,6 +30456,42 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, { } }); }); + + this.topLeftGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.topRightGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.bottomLeftGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.bottomRightGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + + function overscan(grid, w, h, rSize, cSize) { + var rCount = h / rSize; + var cCount = w / cSize; + if (cCount * (120 / rSize) >= 60 || rCount * (120 / cSize) >= 60) { + grid.attr("overscanRowCount", 100); + grid.attr("overscanColumnCount", 100); + } + } + + if (freezeColLength > 0) { + overscan(this.topLeftGrid, otlw, otlh, o.headerRowSize, totalLeftColumnSize / freezeColLength); + overscan(this.bottomLeftGrid, oblw, oblh, o.rowSize, totalLeftColumnSize / freezeColLength); + } + if (o.columnSize.length - freezeColLength > 0) { + overscan(this.topRight, otrw, otrh, o.headerRowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength)); + overscan(this.bottomRightGrid, obrw, obrh, o.rowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength)); + } + this.topLeftGrid.populate(leftHeader); this.topRightGrid.populate(rightHeader); this.bottomLeftGrid.populate(leftItems); diff --git a/bi/core.js b/bi/core.js index e1be123e0..e4b54a49a 100644 --- a/bi/core.js +++ b/bi/core.js @@ -2940,10 +2940,7 @@ if (!window.BI) { return /(msie|trident)/i.test(navigator.userAgent.toLowerCase()); }, - isIE9Below: function () { - if (!BI.isIE()) { - return false; - } + getIEVersion: function () { var version = 0; var agent = navigator.userAgent.toLowerCase(); var v1 = agent.match(/(?:msie\s([\w.]+))/); @@ -2957,7 +2954,18 @@ if (!window.BI) { } else { version = 0; } - return version < 9; + return version; + }, + + isIE9Below: function () { + if (!BI.isIE()) { + return false; + } + return this.getIEVersion() < 9; + }, + + isIE9: function () { + return this.getIEVersion() === 9; }, isEdge: function () { @@ -4672,6 +4680,13 @@ BI.Widget = BI.inherit(BI.OB, { }, attr: function (key, value) { + var self = this; + if (BI.isPlainObject(key)) { + BI.each(key, function (k, v) { + self.attr(k, v); + }) + return; + } if (BI.isNotNull(value)) { return this.options[key] = value; } diff --git a/bi/widget.js b/bi/widget.js index 95a2afefa..c0cbf8170 100644 --- a/bi/widget.js +++ b/bi/widget.js @@ -629,7 +629,12 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, { clearInterval(self._scrollInterval); self._scrollInterval = null; } + var count = 0; self._scrollInterval = setInterval(function () { + count++; + if (count <= 3) { + return; + } var offset = self._getScrollOffset(); var t = offset.top + map[direction][0] * 40; var l = offset.left + map[direction][1] * 40; diff --git a/docs/base.js b/docs/base.js index a2540ebd6..9e9bbe813 100644 --- a/docs/base.js +++ b/docs/base.js @@ -30103,6 +30103,41 @@ BI.GridTable = BI.inherit(BI.Widget, { this.contextLayout.attr("items", items); this.contextLayout.resize(); + this.topLeftGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.topRightGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.bottomLeftGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.bottomRightGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + + function overscan(grid, w, h, rSize, cSize) { + var rCount = h / rSize; + var cCount = w / cSize; + if (cCount * (120 / rSize) >= 60 || rCount * (120 / cSize) >= 60) { + grid.attr("overscanRowCount", 100); + grid.attr("overscanColumnCount", 100); + } + } + + if (freezeColLength > 0) { + overscan(this.topLeftGrid, tlw, tlh, o.headerRowSize, totalLeftColumnSize / freezeColLength); + overscan(this.bottomLeftGrid, blw, blh, o.rowSize, totalLeftColumnSize / freezeColLength); + } + if (o.columnSize.length - freezeColLength > 0) { + overscan(this.topRight, trw, trh, o.headerRowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength)); + overscan(this.bottomRightGrid, brw, brh, o.rowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength)); + } + this.topLeftGrid._populate(this.header[0]); this.topRightGrid._populate(this.header[1]); this.bottomLeftGrid._populate(this.items[0]); @@ -30329,7 +30364,8 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, { _populateTable: function () { var self = this, o = this.options; - var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = []; + var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, + summaryColumnSizeArray = []; var freezeColLength = this._getFreezeColLength(); BI.each(o.columnSize, function (i, size) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { @@ -30420,6 +30456,42 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, { } }); }); + + this.topLeftGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.topRightGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.bottomLeftGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.bottomRightGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + + function overscan(grid, w, h, rSize, cSize) { + var rCount = h / rSize; + var cCount = w / cSize; + if (cCount * (120 / rSize) >= 60 || rCount * (120 / cSize) >= 60) { + grid.attr("overscanRowCount", 100); + grid.attr("overscanColumnCount", 100); + } + } + + if (freezeColLength > 0) { + overscan(this.topLeftGrid, otlw, otlh, o.headerRowSize, totalLeftColumnSize / freezeColLength); + overscan(this.bottomLeftGrid, oblw, oblh, o.rowSize, totalLeftColumnSize / freezeColLength); + } + if (o.columnSize.length - freezeColLength > 0) { + overscan(this.topRight, otrw, otrh, o.headerRowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength)); + overscan(this.bottomRightGrid, obrw, obrh, o.rowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength)); + } + this.topLeftGrid.populate(leftHeader); this.topRightGrid.populate(rightHeader); this.bottomLeftGrid.populate(leftItems); diff --git a/docs/core.js b/docs/core.js index 21e835a88..6fe5dd752 100644 --- a/docs/core.js +++ b/docs/core.js @@ -14082,10 +14082,7 @@ if (!window.BI) { return /(msie|trident)/i.test(navigator.userAgent.toLowerCase()); }, - isIE9Below: function () { - if (!BI.isIE()) { - return false; - } + getIEVersion: function () { var version = 0; var agent = navigator.userAgent.toLowerCase(); var v1 = agent.match(/(?:msie\s([\w.]+))/); @@ -14099,7 +14096,18 @@ if (!window.BI) { } else { version = 0; } - return version < 9; + return version; + }, + + isIE9Below: function () { + if (!BI.isIE()) { + return false; + } + return this.getIEVersion() < 9; + }, + + isIE9: function () { + return this.getIEVersion() === 9; }, isEdge: function () { @@ -14668,6 +14676,13 @@ BI.Widget = BI.inherit(BI.OB, { }, attr: function (key, value) { + var self = this; + if (BI.isPlainObject(key)) { + BI.each(key, function (k, v) { + self.attr(k, v); + }) + return; + } if (BI.isNotNull(value)) { return this.options[key] = value; } diff --git a/docs/widget.js b/docs/widget.js index 95a2afefa..c0cbf8170 100644 --- a/docs/widget.js +++ b/docs/widget.js @@ -629,7 +629,12 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, { clearInterval(self._scrollInterval); self._scrollInterval = null; } + var count = 0; self._scrollInterval = setInterval(function () { + count++; + if (count <= 3) { + return; + } var offset = self._getScrollOffset(); var t = offset.top + map[direction][0] * 40; var l = offset.left + map[direction][1] * 40; diff --git a/src/base/table/table.grid.js b/src/base/table/table.grid.js index 1eae8487b..c18baa2ef 100644 --- a/src/base/table/table.grid.js +++ b/src/base/table/table.grid.js @@ -362,6 +362,41 @@ BI.GridTable = BI.inherit(BI.Widget, { this.contextLayout.attr("items", items); this.contextLayout.resize(); + this.topLeftGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.topRightGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.bottomLeftGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.bottomRightGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + + function overscan(grid, w, h, rSize, cSize) { + var rCount = h / rSize; + var cCount = w / cSize; + if (cCount * (120 / rSize) >= 60 || rCount * (120 / cSize) >= 60) { + grid.attr("overscanRowCount", 100); + grid.attr("overscanColumnCount", 100); + } + } + + if (freezeColLength > 0) { + overscan(this.topLeftGrid, tlw, tlh, o.headerRowSize, totalLeftColumnSize / freezeColLength); + overscan(this.bottomLeftGrid, blw, blh, o.rowSize, totalLeftColumnSize / freezeColLength); + } + if (o.columnSize.length - freezeColLength > 0) { + overscan(this.topRight, trw, trh, o.headerRowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength)); + overscan(this.bottomRightGrid, brw, brh, o.rowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength)); + } + this.topLeftGrid._populate(this.header[0]); this.topRightGrid._populate(this.header[1]); this.bottomLeftGrid._populate(this.items[0]); diff --git a/src/base/table/table.grid.quick.js b/src/base/table/table.grid.quick.js index 878f1bcd2..c5c98a337 100644 --- a/src/base/table/table.grid.quick.js +++ b/src/base/table/table.grid.quick.js @@ -116,7 +116,8 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, { _populateTable: function () { var self = this, o = this.options; - var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = []; + var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, + summaryColumnSizeArray = []; var freezeColLength = this._getFreezeColLength(); BI.each(o.columnSize, function (i, size) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { @@ -207,6 +208,42 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, { } }); }); + + this.topLeftGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.topRightGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.bottomLeftGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.bottomRightGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + + function overscan(grid, w, h, rSize, cSize) { + var rCount = h / rSize; + var cCount = w / cSize; + if (cCount * (120 / rSize) >= 60 || rCount * (120 / cSize) >= 60) { + grid.attr("overscanRowCount", 100); + grid.attr("overscanColumnCount", 100); + } + } + + if (freezeColLength > 0) { + overscan(this.topLeftGrid, otlw, otlh, o.headerRowSize, totalLeftColumnSize / freezeColLength); + overscan(this.bottomLeftGrid, oblw, oblh, o.rowSize, totalLeftColumnSize / freezeColLength); + } + if (o.columnSize.length - freezeColLength > 0) { + overscan(this.topRight, otrw, otrh, o.headerRowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength)); + overscan(this.bottomRightGrid, obrw, obrh, o.rowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength)); + } + this.topLeftGrid.populate(leftHeader); this.topRightGrid.populate(rightHeader); this.bottomLeftGrid.populate(leftItems); diff --git a/src/core/base.js b/src/core/base.js index 35ddfdead..9071f40ba 100644 --- a/src/core/base.js +++ b/src/core/base.js @@ -1048,10 +1048,7 @@ if (!window.BI) { return /(msie|trident)/i.test(navigator.userAgent.toLowerCase()); }, - isIE9Below: function () { - if (!BI.isIE()) { - return false; - } + getIEVersion: function () { var version = 0; var agent = navigator.userAgent.toLowerCase(); var v1 = agent.match(/(?:msie\s([\w.]+))/); @@ -1065,7 +1062,18 @@ if (!window.BI) { } else { version = 0; } - return version < 9; + return version; + }, + + isIE9Below: function () { + if (!BI.isIE()) { + return false; + } + return this.getIEVersion() < 9; + }, + + isIE9: function () { + return this.getIEVersion() === 9; }, isEdge: function () { diff --git a/src/core/widget.js b/src/core/widget.js index 62775547e..a7536dcf5 100644 --- a/src/core/widget.js +++ b/src/core/widget.js @@ -343,6 +343,13 @@ BI.Widget = BI.inherit(BI.OB, { }, attr: function (key, value) { + var self = this; + if (BI.isPlainObject(key)) { + BI.each(key, function (k, v) { + self.attr(k, v); + }) + return; + } if (BI.isNotNull(value)) { return this.options[key] = value; } diff --git a/src/widget/adaptivearrangement/adaptivearrangement.js b/src/widget/adaptivearrangement/adaptivearrangement.js index 0891d19a9..ee4d56348 100644 --- a/src/widget/adaptivearrangement/adaptivearrangement.js +++ b/src/widget/adaptivearrangement/adaptivearrangement.js @@ -210,7 +210,12 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, { clearInterval(self._scrollInterval); self._scrollInterval = null; } + var count = 0; self._scrollInterval = setInterval(function () { + count++; + if (count <= 3) { + return; + } var offset = self._getScrollOffset(); var t = offset.top + map[direction][0] * 40; var l = offset.left + map[direction][1] * 40;