From 19ce7b32d6e8e505833a28c7e954e6f59fdc92dc Mon Sep 17 00:00:00 2001 From: Young Date: Mon, 31 Jul 2017 17:53:36 +0800 Subject: [PATCH 1/5] wartermark --- bi/base.js | 16 ++++++++-------- docs/base.js | 16 ++++++++-------- src/base/formula/formulaeditor.js | 6 +++--- src/base/single/editor/editor.js | 10 +++++----- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/bi/base.js b/bi/base.js index 5c099604d..a2540ebd6 100644 --- a/bi/base.js +++ b/bi/base.js @@ -14351,15 +14351,15 @@ BI.FormulaEditor = BI.inherit(BI.Single, { _checkWaterMark: function () { var o = this.options; - if (!this.disabledWarterMark && BI.isEmptyString(this.editor.getValue()) && BI.isKey(o.watermark)) { + if (!this.disabledWaterMark && BI.isEmptyString(this.editor.getValue()) && BI.isKey(o.watermark)) { this.watermark && this.watermark.visible(); } else { this.watermark && this.watermark.invisible(); } }, - disableWarterMark: function () { - this.disabledWarterMark = true; + disableWaterMark: function () { + this.disabledWaterMark = true; this._checkWaterMark(); }, @@ -18111,7 +18111,7 @@ BI.Editor = BI.inherit(BI.Single, { _checkWaterMark: function () { var o = this.options; - if (!this.disabledWarterMark && this.editor.getValue() === "" && BI.isKey(o.watermark)) { + if (!this.disabledWaterMark && this.editor.getValue() === "" && BI.isKey(o.watermark)) { this.watermark && this.watermark.visible(); } else { this.watermark && this.watermark.invisible(); @@ -18149,13 +18149,13 @@ BI.Editor = BI.inherit(BI.Single, { this._checkError(); }, - disableWarterMark: function () { - this.disabledWarterMark = true; + disableWaterMark: function () { + this.disabledWaterMark = true; this._checkWaterMark(); }, - enableWarterMark: function () { - this.disabledWarterMark = false; + enableWaterMark: function () { + this.disabledWaterMark = false; this._checkWaterMark(); }, diff --git a/docs/base.js b/docs/base.js index 5c099604d..a2540ebd6 100644 --- a/docs/base.js +++ b/docs/base.js @@ -14351,15 +14351,15 @@ BI.FormulaEditor = BI.inherit(BI.Single, { _checkWaterMark: function () { var o = this.options; - if (!this.disabledWarterMark && BI.isEmptyString(this.editor.getValue()) && BI.isKey(o.watermark)) { + if (!this.disabledWaterMark && BI.isEmptyString(this.editor.getValue()) && BI.isKey(o.watermark)) { this.watermark && this.watermark.visible(); } else { this.watermark && this.watermark.invisible(); } }, - disableWarterMark: function () { - this.disabledWarterMark = true; + disableWaterMark: function () { + this.disabledWaterMark = true; this._checkWaterMark(); }, @@ -18111,7 +18111,7 @@ BI.Editor = BI.inherit(BI.Single, { _checkWaterMark: function () { var o = this.options; - if (!this.disabledWarterMark && this.editor.getValue() === "" && BI.isKey(o.watermark)) { + if (!this.disabledWaterMark && this.editor.getValue() === "" && BI.isKey(o.watermark)) { this.watermark && this.watermark.visible(); } else { this.watermark && this.watermark.invisible(); @@ -18149,13 +18149,13 @@ BI.Editor = BI.inherit(BI.Single, { this._checkError(); }, - disableWarterMark: function () { - this.disabledWarterMark = true; + disableWaterMark: function () { + this.disabledWaterMark = true; this._checkWaterMark(); }, - enableWarterMark: function () { - this.disabledWarterMark = false; + enableWaterMark: function () { + this.disabledWaterMark = false; this._checkWaterMark(); }, diff --git a/src/base/formula/formulaeditor.js b/src/base/formula/formulaeditor.js index 74da71433..691e8b0e8 100644 --- a/src/base/formula/formulaeditor.js +++ b/src/base/formula/formulaeditor.js @@ -90,15 +90,15 @@ BI.FormulaEditor = BI.inherit(BI.Single, { _checkWaterMark: function () { var o = this.options; - if (!this.disabledWarterMark && BI.isEmptyString(this.editor.getValue()) && BI.isKey(o.watermark)) { + if (!this.disabledWaterMark && BI.isEmptyString(this.editor.getValue()) && BI.isKey(o.watermark)) { this.watermark && this.watermark.visible(); } else { this.watermark && this.watermark.invisible(); } }, - disableWarterMark: function () { - this.disabledWarterMark = true; + disableWaterMark: function () { + this.disabledWaterMark = true; this._checkWaterMark(); }, diff --git a/src/base/single/editor/editor.js b/src/base/single/editor/editor.js index a0a684474..c03bd8005 100644 --- a/src/base/single/editor/editor.js +++ b/src/base/single/editor/editor.js @@ -204,7 +204,7 @@ BI.Editor = BI.inherit(BI.Single, { _checkWaterMark: function () { var o = this.options; - if (!this.disabledWarterMark && this.editor.getValue() === "" && BI.isKey(o.watermark)) { + if (!this.disabledWaterMark && this.editor.getValue() === "" && BI.isKey(o.watermark)) { this.watermark && this.watermark.visible(); } else { this.watermark && this.watermark.invisible(); @@ -242,13 +242,13 @@ BI.Editor = BI.inherit(BI.Single, { this._checkError(); }, - disableWarterMark: function () { - this.disabledWarterMark = true; + disableWaterMark: function () { + this.disabledWaterMark = true; this._checkWaterMark(); }, - enableWarterMark: function () { - this.disabledWarterMark = false; + enableWaterMark: function () { + this.disabledWaterMark = false; this._checkWaterMark(); }, From 55a14bfbe7516d44dae6c6b1b546649c80e5ec44 Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 1 Aug 2017 15:05:15 +0800 Subject: [PATCH 2/5] 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; From 577b9e4ed1b5ab62c56748c067e57b2aef23e2e7 Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 1 Aug 2017 15:38:44 +0800 Subject: [PATCH 3/5] add --- Gruntfile.js | 1 + bi/core.js | 61 +++++++++++++++++++++++++++++++++++++++++++++++- docs/core.js | 61 +++++++++++++++++++++++++++++++++++++++++++++++- src/core/load.js | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 181 insertions(+), 2 deletions(-) create mode 100644 src/core/load.js diff --git a/Gruntfile.js b/Gruntfile.js index 1f1f46d42..0cdf1d2cb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -127,6 +127,7 @@ module.exports = function (grunt) { 'src/core/shortcut.js', 'src/core/plugin.js', 'src/core/controller.js', + 'src/core/load.js', 'src/core/proto/**/*.js', 'src/core/utils/**/*.js', 'src/core/behavior/behavior.js', diff --git a/bi/core.js b/bi/core.js index e4b54a49a..191ff2377 100644 --- a/bi/core.js +++ b/bi/core.js @@ -5926,7 +5926,66 @@ BI.Controller = BI.inherit(BI.OB, { } }); -BI.Controller.EVENT_CHANGE = "__EVENT_CHANGE__";/** +BI.Controller.EVENT_CHANGE = "__EVENT_CHANGE__";$.extend(BI, { + $defaultImport: function () { + var ars = arguments; + if (ars[0] != null) { + ars[0] = BI.servletURL + '?op=resource&resource=' + ars[0]; + } + this.$import.apply(null, ars); + }, + + $import: function () { + var _LOADED = {}; // alex:保存加载过的 + function loadReady(src, must) { + var $scripts = $("head script"); + $.each($scripts, function (i, item) { + if (item.src.indexOf(src) != -1) { + _LOADED[src] = true; + } + }); + var $links = $("head link"); + $.each($links, function (i, item) { + if (item.href.indexOf(src) != -1 && must) { + _LOADED[src] = false; + $(item).remove(); + } + }); + } + + // must=true 强行加载 + return function (src, ext, must) { + loadReady(src, must); + // alex:如果已经加载过了的,直接return + if (_LOADED[src] === true) return; + if (ext === 'css') { + var link = document.createElement('link'); + link.rel = 'stylesheet' + link.type = 'text/css'; + link.href = src; + var head = document.getElementsByTagName('head')[0]; + head.appendChild(link); + _LOADED[src] = true; + } else { + // alex:这里用同步调用的方式,必须等待ajax完成 + $.ajax({ + url: src, + dataType: "script", // alex:指定dataType为script,jquery会帮忙做globalEval的事情 + async: false, + complete: function (res, status) { + /* + * alex:发现jquery会很智能地判断一下返回的数据类型是不是script,然后做一个globalEval + * 所以当status为success时就不需要再把其中的内容加到script里面去了 + */ + if (status == 'success') { + _LOADED[src] = true; + } + } + }) + } + } + }() +});/** * 对数组对象的扩展 * @class Array */ diff --git a/docs/core.js b/docs/core.js index 6fe5dd752..672f7330b 100644 --- a/docs/core.js +++ b/docs/core.js @@ -23074,7 +23074,66 @@ BI.ShowListener = BI.inherit(BI.OB, { }) } }); -BI.ShowListener.EVENT_CHANGE = "ShowListener.EVENT_CHANGE";/** +BI.ShowListener.EVENT_CHANGE = "ShowListener.EVENT_CHANGE";$.extend(BI, { + $defaultImport: function () { + var ars = arguments; + if (ars[0] != null) { + ars[0] = BI.servletURL + '?op=resource&resource=' + ars[0]; + } + this.$import.apply(null, ars); + }, + + $import: function () { + var _LOADED = {}; // alex:保存加载过的 + function loadReady(src, must) { + var $scripts = $("head script"); + $.each($scripts, function (i, item) { + if (item.src.indexOf(src) != -1) { + _LOADED[src] = true; + } + }); + var $links = $("head link"); + $.each($links, function (i, item) { + if (item.href.indexOf(src) != -1 && must) { + _LOADED[src] = false; + $(item).remove(); + } + }); + } + + // must=true 强行加载 + return function (src, ext, must) { + loadReady(src, must); + // alex:如果已经加载过了的,直接return + if (_LOADED[src] === true) return; + if (ext === 'css') { + var link = document.createElement('link'); + link.rel = 'stylesheet' + link.type = 'text/css'; + link.href = src; + var head = document.getElementsByTagName('head')[0]; + head.appendChild(link); + _LOADED[src] = true; + } else { + // alex:这里用同步调用的方式,必须等待ajax完成 + $.ajax({ + url: src, + dataType: "script", // alex:指定dataType为script,jquery会帮忙做globalEval的事情 + async: false, + complete: function (res, status) { + /* + * alex:发现jquery会很智能地判断一下返回的数据类型是不是script,然后做一个globalEval + * 所以当status为success时就不需要再把其中的内容加到script里面去了 + */ + if (status == 'success') { + _LOADED[src] = true; + } + } + }) + } + } + }() +});/** * style加载管理器 * * Created by GUY on 2015/9/7. diff --git a/src/core/load.js b/src/core/load.js new file mode 100644 index 000000000..ae62faa72 --- /dev/null +++ b/src/core/load.js @@ -0,0 +1,60 @@ +$.extend(BI, { + $defaultImport: function () { + var ars = arguments; + if (ars[0] != null) { + ars[0] = BI.servletURL + '?op=resource&resource=' + ars[0]; + } + this.$import.apply(null, ars); + }, + + $import: function () { + var _LOADED = {}; // alex:保存加载过的 + function loadReady(src, must) { + var $scripts = $("head script"); + $.each($scripts, function (i, item) { + if (item.src.indexOf(src) != -1) { + _LOADED[src] = true; + } + }); + var $links = $("head link"); + $.each($links, function (i, item) { + if (item.href.indexOf(src) != -1 && must) { + _LOADED[src] = false; + $(item).remove(); + } + }); + } + + // must=true 强行加载 + return function (src, ext, must) { + loadReady(src, must); + // alex:如果已经加载过了的,直接return + if (_LOADED[src] === true) return; + if (ext === 'css') { + var link = document.createElement('link'); + link.rel = 'stylesheet' + link.type = 'text/css'; + link.href = src; + var head = document.getElementsByTagName('head')[0]; + head.appendChild(link); + _LOADED[src] = true; + } else { + // alex:这里用同步调用的方式,必须等待ajax完成 + $.ajax({ + url: src, + dataType: "script", // alex:指定dataType为script,jquery会帮忙做globalEval的事情 + async: false, + complete: function (res, status) { + /* + * alex:发现jquery会很智能地判断一下返回的数据类型是不是script,然后做一个globalEval + * 所以当status为success时就不需要再把其中的内容加到script里面去了 + */ + if (status == 'success') { + _LOADED[src] = true; + } + } + }) + } + } + }() +}); \ No newline at end of file From 53caebc6cc9b28e628cba26248c79cd08a83901f Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 1 Aug 2017 15:47:22 +0800 Subject: [PATCH 4/5] add --- Gruntfile.js | 1 - bi/core.js | 61 +----------------------------------------------- docs/core.js | 61 +----------------------------------------------- src/core/load.js | 60 ----------------------------------------------- 4 files changed, 2 insertions(+), 181 deletions(-) delete mode 100644 src/core/load.js diff --git a/Gruntfile.js b/Gruntfile.js index 0cdf1d2cb..1f1f46d42 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -127,7 +127,6 @@ module.exports = function (grunt) { 'src/core/shortcut.js', 'src/core/plugin.js', 'src/core/controller.js', - 'src/core/load.js', 'src/core/proto/**/*.js', 'src/core/utils/**/*.js', 'src/core/behavior/behavior.js', diff --git a/bi/core.js b/bi/core.js index 191ff2377..e4b54a49a 100644 --- a/bi/core.js +++ b/bi/core.js @@ -5926,66 +5926,7 @@ BI.Controller = BI.inherit(BI.OB, { } }); -BI.Controller.EVENT_CHANGE = "__EVENT_CHANGE__";$.extend(BI, { - $defaultImport: function () { - var ars = arguments; - if (ars[0] != null) { - ars[0] = BI.servletURL + '?op=resource&resource=' + ars[0]; - } - this.$import.apply(null, ars); - }, - - $import: function () { - var _LOADED = {}; // alex:保存加载过的 - function loadReady(src, must) { - var $scripts = $("head script"); - $.each($scripts, function (i, item) { - if (item.src.indexOf(src) != -1) { - _LOADED[src] = true; - } - }); - var $links = $("head link"); - $.each($links, function (i, item) { - if (item.href.indexOf(src) != -1 && must) { - _LOADED[src] = false; - $(item).remove(); - } - }); - } - - // must=true 强行加载 - return function (src, ext, must) { - loadReady(src, must); - // alex:如果已经加载过了的,直接return - if (_LOADED[src] === true) return; - if (ext === 'css') { - var link = document.createElement('link'); - link.rel = 'stylesheet' - link.type = 'text/css'; - link.href = src; - var head = document.getElementsByTagName('head')[0]; - head.appendChild(link); - _LOADED[src] = true; - } else { - // alex:这里用同步调用的方式,必须等待ajax完成 - $.ajax({ - url: src, - dataType: "script", // alex:指定dataType为script,jquery会帮忙做globalEval的事情 - async: false, - complete: function (res, status) { - /* - * alex:发现jquery会很智能地判断一下返回的数据类型是不是script,然后做一个globalEval - * 所以当status为success时就不需要再把其中的内容加到script里面去了 - */ - if (status == 'success') { - _LOADED[src] = true; - } - } - }) - } - } - }() -});/** +BI.Controller.EVENT_CHANGE = "__EVENT_CHANGE__";/** * 对数组对象的扩展 * @class Array */ diff --git a/docs/core.js b/docs/core.js index 672f7330b..6fe5dd752 100644 --- a/docs/core.js +++ b/docs/core.js @@ -23074,66 +23074,7 @@ BI.ShowListener = BI.inherit(BI.OB, { }) } }); -BI.ShowListener.EVENT_CHANGE = "ShowListener.EVENT_CHANGE";$.extend(BI, { - $defaultImport: function () { - var ars = arguments; - if (ars[0] != null) { - ars[0] = BI.servletURL + '?op=resource&resource=' + ars[0]; - } - this.$import.apply(null, ars); - }, - - $import: function () { - var _LOADED = {}; // alex:保存加载过的 - function loadReady(src, must) { - var $scripts = $("head script"); - $.each($scripts, function (i, item) { - if (item.src.indexOf(src) != -1) { - _LOADED[src] = true; - } - }); - var $links = $("head link"); - $.each($links, function (i, item) { - if (item.href.indexOf(src) != -1 && must) { - _LOADED[src] = false; - $(item).remove(); - } - }); - } - - // must=true 强行加载 - return function (src, ext, must) { - loadReady(src, must); - // alex:如果已经加载过了的,直接return - if (_LOADED[src] === true) return; - if (ext === 'css') { - var link = document.createElement('link'); - link.rel = 'stylesheet' - link.type = 'text/css'; - link.href = src; - var head = document.getElementsByTagName('head')[0]; - head.appendChild(link); - _LOADED[src] = true; - } else { - // alex:这里用同步调用的方式,必须等待ajax完成 - $.ajax({ - url: src, - dataType: "script", // alex:指定dataType为script,jquery会帮忙做globalEval的事情 - async: false, - complete: function (res, status) { - /* - * alex:发现jquery会很智能地判断一下返回的数据类型是不是script,然后做一个globalEval - * 所以当status为success时就不需要再把其中的内容加到script里面去了 - */ - if (status == 'success') { - _LOADED[src] = true; - } - } - }) - } - } - }() -});/** +BI.ShowListener.EVENT_CHANGE = "ShowListener.EVENT_CHANGE";/** * style加载管理器 * * Created by GUY on 2015/9/7. diff --git a/src/core/load.js b/src/core/load.js deleted file mode 100644 index ae62faa72..000000000 --- a/src/core/load.js +++ /dev/null @@ -1,60 +0,0 @@ -$.extend(BI, { - $defaultImport: function () { - var ars = arguments; - if (ars[0] != null) { - ars[0] = BI.servletURL + '?op=resource&resource=' + ars[0]; - } - this.$import.apply(null, ars); - }, - - $import: function () { - var _LOADED = {}; // alex:保存加载过的 - function loadReady(src, must) { - var $scripts = $("head script"); - $.each($scripts, function (i, item) { - if (item.src.indexOf(src) != -1) { - _LOADED[src] = true; - } - }); - var $links = $("head link"); - $.each($links, function (i, item) { - if (item.href.indexOf(src) != -1 && must) { - _LOADED[src] = false; - $(item).remove(); - } - }); - } - - // must=true 强行加载 - return function (src, ext, must) { - loadReady(src, must); - // alex:如果已经加载过了的,直接return - if (_LOADED[src] === true) return; - if (ext === 'css') { - var link = document.createElement('link'); - link.rel = 'stylesheet' - link.type = 'text/css'; - link.href = src; - var head = document.getElementsByTagName('head')[0]; - head.appendChild(link); - _LOADED[src] = true; - } else { - // alex:这里用同步调用的方式,必须等待ajax完成 - $.ajax({ - url: src, - dataType: "script", // alex:指定dataType为script,jquery会帮忙做globalEval的事情 - async: false, - complete: function (res, status) { - /* - * alex:发现jquery会很智能地判断一下返回的数据类型是不是script,然后做一个globalEval - * 所以当status为success时就不需要再把其中的内容加到script里面去了 - */ - if (status == 'success') { - _LOADED[src] = true; - } - } - }) - } - } - }() -}); \ No newline at end of file From e0b5f27db1ff2660411bb6254a77be7cf87cb2c1 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Tue, 1 Aug 2017 19:38:39 +0800 Subject: [PATCH 5/5] =?UTF-8?q?selectlist=E7=9A=84setEnable=E5=AF=B9?= =?UTF-8?q?=E5=85=A8=E9=80=89=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bi/base.js | 518 ++++++++++++------------- bi/case.js | 6 + docs/base.js | 518 ++++++++++++------------- docs/case.js | 6 + src/case/editor/editor.sign.initial.js | 1 + src/case/list/list.select.js | 5 + 6 files changed, 536 insertions(+), 518 deletions(-) diff --git a/bi/base.js b/bi/base.js index a2540ebd6..36f8e9564 100644 --- a/bi/base.js +++ b/bi/base.js @@ -308,163 +308,163 @@ BI.Pane = BI.inherit(BI.Widget, { } }); -BI.Pane.EVENT_LOADED = "EVENT_LOADED";/** - * guy - * 这仅仅只是一个超类, 所有简单控件的基类 - * 1、类的控制, - * 2、title的控制 - * 3、文字超过边界显示3个点 - * 4、cursor默认pointor - * @class BI.Single - * @extends BI.Widget - * @abstract - */ -BI.Single = BI.inherit(BI.Widget, { - _defaultConfig: function () { - var conf = BI.Single.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - baseCls: (conf.baseCls || "") + " bi-single", - readonly: false, - title: null, - warningTitle: null, - tipType: null, // success或warning - value: null - }) - }, - - _showToolTip: function (e, opt) { - opt || (opt = {}); - var self = this; - var type = this.getTipType() || (this.isEnabled() ? "success" : "warning"); - var title = type === "success" ? this.getTitle() : (this.getWarningTitle() || this.getTitle()); - if (BI.isKey(title)) { - BI.Tooltips.show(e, this.getName(), title, type, this, opt); - } - }, - - _hideTooltip: function () { - var self = this; - var tooltip = BI.Tooltips.get(this.getName()); - if (BI.isNotNull(tooltip)) { - tooltip.element.fadeOut(200, function () { - BI.Tooltips.remove(self.getName()); - }); - } - }, - - _init: function () { - BI.Single.superclass._init.apply(this, arguments); - var self = this, o = this.options; - if (BI.isKey(o.title) || BI.isKey(o.warningTitle) - || BI.isFunction(o.title) || BI.isFunction(o.warningTitle)) { - this.enableHover(); - } - }, - - enableHover: function (opt) { - opt || (opt = {}); - var self = this; - if (!this._hoverBinded) { - this.element.on("mouseenter.title" + this.getName(), function (e) { - self._e = e; - if (self.getTipType() === "warning" || (BI.isKey(self.getWarningTitle()) && !self.isEnabled())) { - self.timeout = BI.delay(function () { - self._showToolTip(self._e || e, opt); - }, 200); - } else if (self.getTipType() === "success" || self.isEnabled()) { - self.timeout = BI.delay(function () { - self._showToolTip(self._e || e, opt); - }, 500); - } - }); - this.element.on("mousemove.title" + this.getName(), function (e) { - self._e = e; - if (!self.element.__isMouseInBounds__(e)) { - if (BI.isNotNull(self.timeout)) { - clearTimeout(self.timeout); - } - self._hideTooltip(); - } - }); - this.element.on("mouseleave.title" + this.getName(), function () { - self._e = null; - if (BI.isNotNull(self.timeout)) { - clearTimeout(self.timeout); - } - self._hideTooltip(); - }); - this._hoverBinded = true; - } - }, - - disabledHover: function () { - //取消hover事件 - if (BI.isNotNull(this.timeout)) { - clearTimeout(this.timeout); - } - this._hideTooltip(); - $(this.element).unbind("mouseenter.title" + this.getName()) - .unbind("mousemove.title" + this.getName()) - .unbind("mouseleave.title" + this.getName()); - this._hoverBinded = false; - }, - - populate: function (items) { - this.items = items || []; - }, - - //opt: {container: '', belowMouse: false} - setTitle: function (title, opt) { - this.options.title = title; - if (BI.isKey(title)) { - this.enableHover(opt); - } else { - this.disabledHover(); - } - }, - - setWarningTitle: function (title, opt) { - this.options.warningTitle = title; - if (BI.isKey(title)) { - this.enableHover(opt); - } else { - this.disabledHover(); - } - }, - - getTipType: function () { - return this.options.tipType; - }, - - isReadOnly: function () { - return !!this.options.readonly; - }, - - getTitle: function () { - var title = this.options.title; - if(BI.isFunction(title)) { - return title(); - } - return title; - }, - - getWarningTitle: function () { - var title = this.options.warningTitle; - if(BI.isFunction(title)) { - return title(); - } - return title; - }, - - setValue: function (val) { - if (!this.options.readonly) { - this.options.value = val; - } - }, - - getValue: function () { - return this.options.value; - } +BI.Pane.EVENT_LOADED = "EVENT_LOADED";/** + * guy + * 这仅仅只是一个超类, 所有简单控件的基类 + * 1、类的控制, + * 2、title的控制 + * 3、文字超过边界显示3个点 + * 4、cursor默认pointor + * @class BI.Single + * @extends BI.Widget + * @abstract + */ +BI.Single = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.Single.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-single", + readonly: false, + title: null, + warningTitle: null, + tipType: null, // success或warning + value: null + }) + }, + + _showToolTip: function (e, opt) { + opt || (opt = {}); + var self = this; + var type = this.getTipType() || (this.isEnabled() ? "success" : "warning"); + var title = type === "success" ? this.getTitle() : (this.getWarningTitle() || this.getTitle()); + if (BI.isKey(title)) { + BI.Tooltips.show(e, this.getName(), title, type, this, opt); + } + }, + + _hideTooltip: function () { + var self = this; + var tooltip = BI.Tooltips.get(this.getName()); + if (BI.isNotNull(tooltip)) { + tooltip.element.fadeOut(200, function () { + BI.Tooltips.remove(self.getName()); + }); + } + }, + + _init: function () { + BI.Single.superclass._init.apply(this, arguments); + var self = this, o = this.options; + if (BI.isKey(o.title) || BI.isKey(o.warningTitle) + || BI.isFunction(o.title) || BI.isFunction(o.warningTitle)) { + this.enableHover(); + } + }, + + enableHover: function (opt) { + opt || (opt = {}); + var self = this; + if (!this._hoverBinded) { + this.element.on("mouseenter.title" + this.getName(), function (e) { + self._e = e; + if (self.getTipType() === "warning" || (BI.isKey(self.getWarningTitle()) && !self.isEnabled())) { + self.timeout = BI.delay(function () { + self._showToolTip(self._e || e, opt); + }, 200); + } else if (self.getTipType() === "success" || self.isEnabled()) { + self.timeout = BI.delay(function () { + self._showToolTip(self._e || e, opt); + }, 500); + } + }); + this.element.on("mousemove.title" + this.getName(), function (e) { + self._e = e; + if (!self.element.__isMouseInBounds__(e)) { + if (BI.isNotNull(self.timeout)) { + clearTimeout(self.timeout); + } + self._hideTooltip(); + } + }); + this.element.on("mouseleave.title" + this.getName(), function () { + self._e = null; + if (BI.isNotNull(self.timeout)) { + clearTimeout(self.timeout); + } + self._hideTooltip(); + }); + this._hoverBinded = true; + } + }, + + disabledHover: function () { + //取消hover事件 + if (BI.isNotNull(this.timeout)) { + clearTimeout(this.timeout); + } + this._hideTooltip(); + $(this.element).unbind("mouseenter.title" + this.getName()) + .unbind("mousemove.title" + this.getName()) + .unbind("mouseleave.title" + this.getName()); + this._hoverBinded = false; + }, + + populate: function (items) { + this.items = items || []; + }, + + //opt: {container: '', belowMouse: false} + setTitle: function (title, opt) { + this.options.title = title; + if (BI.isKey(title)) { + this.enableHover(opt); + } else { + this.disabledHover(); + } + }, + + setWarningTitle: function (title, opt) { + this.options.warningTitle = title; + if (BI.isKey(title)) { + this.enableHover(opt); + } else { + this.disabledHover(); + } + }, + + getTipType: function () { + return this.options.tipType; + }, + + isReadOnly: function () { + return !!this.options.readonly; + }, + + getTitle: function () { + var title = this.options.title; + if(BI.isFunction(title)) { + return title(); + } + return title; + }, + + getWarningTitle: function () { + var title = this.options.warningTitle; + if(BI.isFunction(title)) { + return title(); + } + return title; + }, + + setValue: function (val) { + if (!this.options.readonly) { + this.options.value = val; + } + }, + + getValue: function () { + return this.options.value; + } });/** * guy 表示一行数据,通过position来定位位置的数据 * @class BI.Text @@ -918,82 +918,82 @@ BI.BasicButton = BI.inherit(BI.Single, { BI.BasicButton.superclass.destroy.apply(this, arguments); } }); -BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE";/** - * 表示一个可以展开的节点, 不仅有选中状态而且有展开状态 - * - * Created by GUY on 2015/9/9. - * @class BI.NodeButton - * @extends BI.BasicButton - * @abstract - */ -BI.NodeButton = BI.inherit(BI.BasicButton, { - _defaultConfig: function() { - var conf = BI.NodeButton.superclass._defaultConfig.apply(this, arguments); - return BI.extend( conf, { - baseCls: (conf.baseCls || "") + " bi-node", - open: false - }) - }, - - _init:function() { - BI.NodeButton.superclass._init.apply(this, arguments); - var self = this; - BI.nextTick(function(){ - self.setOpened(self.isOpened()); - }) - }, - - doClick: function(){ - BI.NodeButton.superclass.doClick.apply(this, arguments); - this.setOpened(!this.isOpened()); - }, - - isOnce: function(){ - return false; - }, - - isOpened: function(){ - return !!this.options.open; - }, - - setOpened: function(b){ - this.options.open = !!b; - }, - - triggerCollapse: function(){ - if(this.isOpened()) { - this.setOpened(false); - this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, this.getValue(), this); - } - }, - - triggerExpand: function(){ - if(!this.isOpened()) { - this.setOpened(true); - this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, this.getValue(), this); - } - } -});/** - * guy - * tip提示 - * zIndex在10亿级别 - * @class BI.Tip - * @extends BI.Single - * @abstract - */ -BI.Tip = BI.inherit(BI.Single, { - _defaultConfig: function() { - var conf = BI.Link.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - baseCls: (conf.baseCls || "") + " bi-tip", - zIndex: BI.zIndex_tip - }) - }, - - _init : function() { - BI.Tip.superclass._init.apply(this, arguments); - this.element.css({"zIndex": this.options.zIndex}); - } +BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE";/** + * 表示一个可以展开的节点, 不仅有选中状态而且有展开状态 + * + * Created by GUY on 2015/9/9. + * @class BI.NodeButton + * @extends BI.BasicButton + * @abstract + */ +BI.NodeButton = BI.inherit(BI.BasicButton, { + _defaultConfig: function() { + var conf = BI.NodeButton.superclass._defaultConfig.apply(this, arguments); + return BI.extend( conf, { + baseCls: (conf.baseCls || "") + " bi-node", + open: false + }) + }, + + _init:function() { + BI.NodeButton.superclass._init.apply(this, arguments); + var self = this; + BI.nextTick(function(){ + self.setOpened(self.isOpened()); + }) + }, + + doClick: function(){ + BI.NodeButton.superclass.doClick.apply(this, arguments); + this.setOpened(!this.isOpened()); + }, + + isOnce: function(){ + return false; + }, + + isOpened: function(){ + return !!this.options.open; + }, + + setOpened: function(b){ + this.options.open = !!b; + }, + + triggerCollapse: function(){ + if(this.isOpened()) { + this.setOpened(false); + this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, this.getValue(), this); + } + }, + + triggerExpand: function(){ + if(!this.isOpened()) { + this.setOpened(true); + this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, this.getValue(), this); + } + } +});/** + * guy + * tip提示 + * zIndex在10亿级别 + * @class BI.Tip + * @extends BI.Single + * @abstract + */ +BI.Tip = BI.inherit(BI.Single, { + _defaultConfig: function() { + var conf = BI.Link.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-tip", + zIndex: BI.zIndex_tip + }) + }, + + _init : function() { + BI.Tip.superclass._init.apply(this, arguments); + this.element.css({"zIndex": this.options.zIndex}); + } });/** * Created by GUY on 2015/6/26. * @class BI.ButtonGroup @@ -20293,32 +20293,32 @@ BI.Tooltip = BI.inherit(BI.Tip, { } }); -BI.shortcut("bi.tooltip", BI.Tooltip);/** - * 下拉 - * @class BI.Trigger - * @extends BI.Single - * @abstract - */ -BI.Trigger = BI.inherit(BI.Single, { - _defaultConfig: function() { - var conf = BI.Trigger.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - baseCls: (conf.baseCls || "") + " bi-trigger cursor-pointer", - height: 30 - }) - }, - - _init : function() { - BI.Trigger.superclass._init.apply(this, arguments); - }, - - setKey: function(){ - - }, - - getKey: function(){ - - } +BI.shortcut("bi.tooltip", BI.Tooltip);/** + * 下拉 + * @class BI.Trigger + * @extends BI.Single + * @abstract + */ +BI.Trigger = BI.inherit(BI.Single, { + _defaultConfig: function() { + var conf = BI.Trigger.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-trigger cursor-pointer", + height: 30 + }) + }, + + _init : function() { + BI.Trigger.superclass._init.apply(this, arguments); + }, + + setKey: function(){ + + }, + + getKey: function(){ + + } });// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/bi/case.js b/bi/case.js index 7a8f9ea43..d13037250 100644 --- a/bi/case.js +++ b/bi/case.js @@ -7146,6 +7146,7 @@ BI.SignInitialEditor = BI.inherit(BI.Widget, { }, setState: function (v) { + var o = this.options; this._showHint(); v = (BI.isEmpty(v) || v == o.text) ? o.text : v + "(" + o.text + ")"; this.text.setValue(v); @@ -8790,6 +8791,11 @@ BI.SelectList = BI.inherit(BI.Widget, { this._checkAllSelected(); }, + _setEnable: function () { + BI.SelectList.superclass._setEnable.apply(this, arguments); + this.toolbar.setEnable(arguments); + }, + resetHeight: function (h) { var toolHeight = ( this.toolbar.element.outerHeight() || 25) * ( this.toolbar.isVisible() ? 1 : 0); this.list.resetHeight ? this.list.resetHeight(h - toolHeight) : diff --git a/docs/base.js b/docs/base.js index a2540ebd6..36f8e9564 100644 --- a/docs/base.js +++ b/docs/base.js @@ -308,163 +308,163 @@ BI.Pane = BI.inherit(BI.Widget, { } }); -BI.Pane.EVENT_LOADED = "EVENT_LOADED";/** - * guy - * 这仅仅只是一个超类, 所有简单控件的基类 - * 1、类的控制, - * 2、title的控制 - * 3、文字超过边界显示3个点 - * 4、cursor默认pointor - * @class BI.Single - * @extends BI.Widget - * @abstract - */ -BI.Single = BI.inherit(BI.Widget, { - _defaultConfig: function () { - var conf = BI.Single.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - baseCls: (conf.baseCls || "") + " bi-single", - readonly: false, - title: null, - warningTitle: null, - tipType: null, // success或warning - value: null - }) - }, - - _showToolTip: function (e, opt) { - opt || (opt = {}); - var self = this; - var type = this.getTipType() || (this.isEnabled() ? "success" : "warning"); - var title = type === "success" ? this.getTitle() : (this.getWarningTitle() || this.getTitle()); - if (BI.isKey(title)) { - BI.Tooltips.show(e, this.getName(), title, type, this, opt); - } - }, - - _hideTooltip: function () { - var self = this; - var tooltip = BI.Tooltips.get(this.getName()); - if (BI.isNotNull(tooltip)) { - tooltip.element.fadeOut(200, function () { - BI.Tooltips.remove(self.getName()); - }); - } - }, - - _init: function () { - BI.Single.superclass._init.apply(this, arguments); - var self = this, o = this.options; - if (BI.isKey(o.title) || BI.isKey(o.warningTitle) - || BI.isFunction(o.title) || BI.isFunction(o.warningTitle)) { - this.enableHover(); - } - }, - - enableHover: function (opt) { - opt || (opt = {}); - var self = this; - if (!this._hoverBinded) { - this.element.on("mouseenter.title" + this.getName(), function (e) { - self._e = e; - if (self.getTipType() === "warning" || (BI.isKey(self.getWarningTitle()) && !self.isEnabled())) { - self.timeout = BI.delay(function () { - self._showToolTip(self._e || e, opt); - }, 200); - } else if (self.getTipType() === "success" || self.isEnabled()) { - self.timeout = BI.delay(function () { - self._showToolTip(self._e || e, opt); - }, 500); - } - }); - this.element.on("mousemove.title" + this.getName(), function (e) { - self._e = e; - if (!self.element.__isMouseInBounds__(e)) { - if (BI.isNotNull(self.timeout)) { - clearTimeout(self.timeout); - } - self._hideTooltip(); - } - }); - this.element.on("mouseleave.title" + this.getName(), function () { - self._e = null; - if (BI.isNotNull(self.timeout)) { - clearTimeout(self.timeout); - } - self._hideTooltip(); - }); - this._hoverBinded = true; - } - }, - - disabledHover: function () { - //取消hover事件 - if (BI.isNotNull(this.timeout)) { - clearTimeout(this.timeout); - } - this._hideTooltip(); - $(this.element).unbind("mouseenter.title" + this.getName()) - .unbind("mousemove.title" + this.getName()) - .unbind("mouseleave.title" + this.getName()); - this._hoverBinded = false; - }, - - populate: function (items) { - this.items = items || []; - }, - - //opt: {container: '', belowMouse: false} - setTitle: function (title, opt) { - this.options.title = title; - if (BI.isKey(title)) { - this.enableHover(opt); - } else { - this.disabledHover(); - } - }, - - setWarningTitle: function (title, opt) { - this.options.warningTitle = title; - if (BI.isKey(title)) { - this.enableHover(opt); - } else { - this.disabledHover(); - } - }, - - getTipType: function () { - return this.options.tipType; - }, - - isReadOnly: function () { - return !!this.options.readonly; - }, - - getTitle: function () { - var title = this.options.title; - if(BI.isFunction(title)) { - return title(); - } - return title; - }, - - getWarningTitle: function () { - var title = this.options.warningTitle; - if(BI.isFunction(title)) { - return title(); - } - return title; - }, - - setValue: function (val) { - if (!this.options.readonly) { - this.options.value = val; - } - }, - - getValue: function () { - return this.options.value; - } +BI.Pane.EVENT_LOADED = "EVENT_LOADED";/** + * guy + * 这仅仅只是一个超类, 所有简单控件的基类 + * 1、类的控制, + * 2、title的控制 + * 3、文字超过边界显示3个点 + * 4、cursor默认pointor + * @class BI.Single + * @extends BI.Widget + * @abstract + */ +BI.Single = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.Single.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-single", + readonly: false, + title: null, + warningTitle: null, + tipType: null, // success或warning + value: null + }) + }, + + _showToolTip: function (e, opt) { + opt || (opt = {}); + var self = this; + var type = this.getTipType() || (this.isEnabled() ? "success" : "warning"); + var title = type === "success" ? this.getTitle() : (this.getWarningTitle() || this.getTitle()); + if (BI.isKey(title)) { + BI.Tooltips.show(e, this.getName(), title, type, this, opt); + } + }, + + _hideTooltip: function () { + var self = this; + var tooltip = BI.Tooltips.get(this.getName()); + if (BI.isNotNull(tooltip)) { + tooltip.element.fadeOut(200, function () { + BI.Tooltips.remove(self.getName()); + }); + } + }, + + _init: function () { + BI.Single.superclass._init.apply(this, arguments); + var self = this, o = this.options; + if (BI.isKey(o.title) || BI.isKey(o.warningTitle) + || BI.isFunction(o.title) || BI.isFunction(o.warningTitle)) { + this.enableHover(); + } + }, + + enableHover: function (opt) { + opt || (opt = {}); + var self = this; + if (!this._hoverBinded) { + this.element.on("mouseenter.title" + this.getName(), function (e) { + self._e = e; + if (self.getTipType() === "warning" || (BI.isKey(self.getWarningTitle()) && !self.isEnabled())) { + self.timeout = BI.delay(function () { + self._showToolTip(self._e || e, opt); + }, 200); + } else if (self.getTipType() === "success" || self.isEnabled()) { + self.timeout = BI.delay(function () { + self._showToolTip(self._e || e, opt); + }, 500); + } + }); + this.element.on("mousemove.title" + this.getName(), function (e) { + self._e = e; + if (!self.element.__isMouseInBounds__(e)) { + if (BI.isNotNull(self.timeout)) { + clearTimeout(self.timeout); + } + self._hideTooltip(); + } + }); + this.element.on("mouseleave.title" + this.getName(), function () { + self._e = null; + if (BI.isNotNull(self.timeout)) { + clearTimeout(self.timeout); + } + self._hideTooltip(); + }); + this._hoverBinded = true; + } + }, + + disabledHover: function () { + //取消hover事件 + if (BI.isNotNull(this.timeout)) { + clearTimeout(this.timeout); + } + this._hideTooltip(); + $(this.element).unbind("mouseenter.title" + this.getName()) + .unbind("mousemove.title" + this.getName()) + .unbind("mouseleave.title" + this.getName()); + this._hoverBinded = false; + }, + + populate: function (items) { + this.items = items || []; + }, + + //opt: {container: '', belowMouse: false} + setTitle: function (title, opt) { + this.options.title = title; + if (BI.isKey(title)) { + this.enableHover(opt); + } else { + this.disabledHover(); + } + }, + + setWarningTitle: function (title, opt) { + this.options.warningTitle = title; + if (BI.isKey(title)) { + this.enableHover(opt); + } else { + this.disabledHover(); + } + }, + + getTipType: function () { + return this.options.tipType; + }, + + isReadOnly: function () { + return !!this.options.readonly; + }, + + getTitle: function () { + var title = this.options.title; + if(BI.isFunction(title)) { + return title(); + } + return title; + }, + + getWarningTitle: function () { + var title = this.options.warningTitle; + if(BI.isFunction(title)) { + return title(); + } + return title; + }, + + setValue: function (val) { + if (!this.options.readonly) { + this.options.value = val; + } + }, + + getValue: function () { + return this.options.value; + } });/** * guy 表示一行数据,通过position来定位位置的数据 * @class BI.Text @@ -918,82 +918,82 @@ BI.BasicButton = BI.inherit(BI.Single, { BI.BasicButton.superclass.destroy.apply(this, arguments); } }); -BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE";/** - * 表示一个可以展开的节点, 不仅有选中状态而且有展开状态 - * - * Created by GUY on 2015/9/9. - * @class BI.NodeButton - * @extends BI.BasicButton - * @abstract - */ -BI.NodeButton = BI.inherit(BI.BasicButton, { - _defaultConfig: function() { - var conf = BI.NodeButton.superclass._defaultConfig.apply(this, arguments); - return BI.extend( conf, { - baseCls: (conf.baseCls || "") + " bi-node", - open: false - }) - }, - - _init:function() { - BI.NodeButton.superclass._init.apply(this, arguments); - var self = this; - BI.nextTick(function(){ - self.setOpened(self.isOpened()); - }) - }, - - doClick: function(){ - BI.NodeButton.superclass.doClick.apply(this, arguments); - this.setOpened(!this.isOpened()); - }, - - isOnce: function(){ - return false; - }, - - isOpened: function(){ - return !!this.options.open; - }, - - setOpened: function(b){ - this.options.open = !!b; - }, - - triggerCollapse: function(){ - if(this.isOpened()) { - this.setOpened(false); - this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, this.getValue(), this); - } - }, - - triggerExpand: function(){ - if(!this.isOpened()) { - this.setOpened(true); - this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, this.getValue(), this); - } - } -});/** - * guy - * tip提示 - * zIndex在10亿级别 - * @class BI.Tip - * @extends BI.Single - * @abstract - */ -BI.Tip = BI.inherit(BI.Single, { - _defaultConfig: function() { - var conf = BI.Link.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - baseCls: (conf.baseCls || "") + " bi-tip", - zIndex: BI.zIndex_tip - }) - }, - - _init : function() { - BI.Tip.superclass._init.apply(this, arguments); - this.element.css({"zIndex": this.options.zIndex}); - } +BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE";/** + * 表示一个可以展开的节点, 不仅有选中状态而且有展开状态 + * + * Created by GUY on 2015/9/9. + * @class BI.NodeButton + * @extends BI.BasicButton + * @abstract + */ +BI.NodeButton = BI.inherit(BI.BasicButton, { + _defaultConfig: function() { + var conf = BI.NodeButton.superclass._defaultConfig.apply(this, arguments); + return BI.extend( conf, { + baseCls: (conf.baseCls || "") + " bi-node", + open: false + }) + }, + + _init:function() { + BI.NodeButton.superclass._init.apply(this, arguments); + var self = this; + BI.nextTick(function(){ + self.setOpened(self.isOpened()); + }) + }, + + doClick: function(){ + BI.NodeButton.superclass.doClick.apply(this, arguments); + this.setOpened(!this.isOpened()); + }, + + isOnce: function(){ + return false; + }, + + isOpened: function(){ + return !!this.options.open; + }, + + setOpened: function(b){ + this.options.open = !!b; + }, + + triggerCollapse: function(){ + if(this.isOpened()) { + this.setOpened(false); + this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, this.getValue(), this); + } + }, + + triggerExpand: function(){ + if(!this.isOpened()) { + this.setOpened(true); + this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, this.getValue(), this); + } + } +});/** + * guy + * tip提示 + * zIndex在10亿级别 + * @class BI.Tip + * @extends BI.Single + * @abstract + */ +BI.Tip = BI.inherit(BI.Single, { + _defaultConfig: function() { + var conf = BI.Link.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-tip", + zIndex: BI.zIndex_tip + }) + }, + + _init : function() { + BI.Tip.superclass._init.apply(this, arguments); + this.element.css({"zIndex": this.options.zIndex}); + } });/** * Created by GUY on 2015/6/26. * @class BI.ButtonGroup @@ -20293,32 +20293,32 @@ BI.Tooltip = BI.inherit(BI.Tip, { } }); -BI.shortcut("bi.tooltip", BI.Tooltip);/** - * 下拉 - * @class BI.Trigger - * @extends BI.Single - * @abstract - */ -BI.Trigger = BI.inherit(BI.Single, { - _defaultConfig: function() { - var conf = BI.Trigger.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - baseCls: (conf.baseCls || "") + " bi-trigger cursor-pointer", - height: 30 - }) - }, - - _init : function() { - BI.Trigger.superclass._init.apply(this, arguments); - }, - - setKey: function(){ - - }, - - getKey: function(){ - - } +BI.shortcut("bi.tooltip", BI.Tooltip);/** + * 下拉 + * @class BI.Trigger + * @extends BI.Single + * @abstract + */ +BI.Trigger = BI.inherit(BI.Single, { + _defaultConfig: function() { + var conf = BI.Trigger.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-trigger cursor-pointer", + height: 30 + }) + }, + + _init : function() { + BI.Trigger.superclass._init.apply(this, arguments); + }, + + setKey: function(){ + + }, + + getKey: function(){ + + } });// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/docs/case.js b/docs/case.js index 7a8f9ea43..d13037250 100644 --- a/docs/case.js +++ b/docs/case.js @@ -7146,6 +7146,7 @@ BI.SignInitialEditor = BI.inherit(BI.Widget, { }, setState: function (v) { + var o = this.options; this._showHint(); v = (BI.isEmpty(v) || v == o.text) ? o.text : v + "(" + o.text + ")"; this.text.setValue(v); @@ -8790,6 +8791,11 @@ BI.SelectList = BI.inherit(BI.Widget, { this._checkAllSelected(); }, + _setEnable: function () { + BI.SelectList.superclass._setEnable.apply(this, arguments); + this.toolbar.setEnable(arguments); + }, + resetHeight: function (h) { var toolHeight = ( this.toolbar.element.outerHeight() || 25) * ( this.toolbar.isVisible() ? 1 : 0); this.list.resetHeight ? this.list.resetHeight(h - toolHeight) : diff --git a/src/case/editor/editor.sign.initial.js b/src/case/editor/editor.sign.initial.js index 2c8023b57..098fa8877 100644 --- a/src/case/editor/editor.sign.initial.js +++ b/src/case/editor/editor.sign.initial.js @@ -242,6 +242,7 @@ BI.SignInitialEditor = BI.inherit(BI.Widget, { }, setState: function (v) { + var o = this.options; this._showHint(); v = (BI.isEmpty(v) || v == o.text) ? o.text : v + "(" + o.text + ")"; this.text.setValue(v); diff --git a/src/case/list/list.select.js b/src/case/list/list.select.js index 26d1297b8..d644d899f 100644 --- a/src/case/list/list.select.js +++ b/src/case/list/list.select.js @@ -158,6 +158,11 @@ BI.SelectList = BI.inherit(BI.Widget, { this._checkAllSelected(); }, + _setEnable: function () { + BI.SelectList.superclass._setEnable.apply(this, arguments); + this.toolbar.setEnable(arguments); + }, + resetHeight: function (h) { var toolHeight = ( this.toolbar.element.outerHeight() || 25) * ( this.toolbar.isVisible() ? 1 : 0); this.list.resetHeight ? this.list.resetHeight(h - toolHeight) :