From 770fad272359e9b9be23718d9cf4b10e158ea9f8 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 9 Aug 2017 16:02:07 +0800 Subject: [PATCH 01/10] add --- bi/base.js | 60 ++++++++++++++++++++++------------------- docs/base.js | 60 ++++++++++++++++++++++------------------- src/base/single/text.js | 60 ++++++++++++++++++++++------------------- 3 files changed, 96 insertions(+), 84 deletions(-) diff --git a/bi/base.js b/bi/base.js index 7e2f494d7..214fc6bb3 100644 --- a/bi/base.js +++ b/bi/base.js @@ -478,6 +478,7 @@ BI.Text = BI.inherit(BI.Single, { textAlign: "left", whiteSpace: "normal", lineHeight: null, + handler: null,//如果传入handler,表示处理文字的点击事件,不是区域的 hgap: 0, vgap: 0, lgap: 0, @@ -491,39 +492,25 @@ BI.Text = BI.inherit(BI.Single, { _init: function () { BI.Text.superclass._init.apply(this, arguments); - var o = this.options; - this.text = BI.createWidget({ - type: "bi.layout", - cls: "bi-text" - }); - BI.createWidget({ - type: "bi.default", - element: this, - items: [this.text] - }); - if (BI.isKey(o.text)) { - this.setText(o.text); - } else if (BI.isKey(o.value)) { - this.setText(o.value); - } + var self = this, o = this.options; if (o.hgap + o.lgap > 0) { - this.text.element.css({ - "margin-left": o.hgap + o.lgap + "px" + this.element.css({ + "padding-left": o.hgap + o.lgap + "px" }) } if (o.hgap + o.rgap > 0) { - this.text.element.css({ - "margin-right": o.hgap + o.rgap + "px" + this.element.css({ + "padding-right": o.hgap + o.rgap + "px" }) } if (o.vgap + o.tgap > 0) { - this.text.element.css({ - "margin-top": o.vgap + o.tgap + "px" + this.element.css({ + "padding-top": o.vgap + o.tgap + "px" }) } if (o.vgap + o.bgap > 0) { - this.text.element.css({ - "margin-bottom": o.vgap + o.bgap + "px" + this.element.css({ + "padding-bottom": o.vgap + o.bgap + "px" }) } if (BI.isNumber(o.height)) { @@ -532,16 +519,33 @@ BI.Text = BI.inherit(BI.Single, { if (BI.isNumber(o.lineHeight)) { this.element.css({"lineHeight": o.lineHeight + "px"}); } - this.text.element.css({ - "textAlign": o.textAlign, - "whiteSpace": o.whiteSpace - }); this.element.css({ "textAlign": o.textAlign, "whiteSpace": o.whiteSpace }); + if (o.handler) { + this.text = BI.createWidget({ + type: "bi.layout", + tagName: 'span' + }); + this.text.element.click(function () { + o.handler(self.getValue()); + }); + BI.createWidget({ + type: "bi.default", + element: this, + items: [this.text] + }); + } else { + this.text = this; + } + if (BI.isKey(o.text)) { + this.setText(o.text); + } else if (BI.isKey(o.value)) { + this.setText(o.value); + } if (BI.isKey(o.keyword)) { - this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); + this.element.__textKeywordMarked__(o.text, o.keyword, o.py); } }, diff --git a/docs/base.js b/docs/base.js index 7e2f494d7..214fc6bb3 100644 --- a/docs/base.js +++ b/docs/base.js @@ -478,6 +478,7 @@ BI.Text = BI.inherit(BI.Single, { textAlign: "left", whiteSpace: "normal", lineHeight: null, + handler: null,//如果传入handler,表示处理文字的点击事件,不是区域的 hgap: 0, vgap: 0, lgap: 0, @@ -491,39 +492,25 @@ BI.Text = BI.inherit(BI.Single, { _init: function () { BI.Text.superclass._init.apply(this, arguments); - var o = this.options; - this.text = BI.createWidget({ - type: "bi.layout", - cls: "bi-text" - }); - BI.createWidget({ - type: "bi.default", - element: this, - items: [this.text] - }); - if (BI.isKey(o.text)) { - this.setText(o.text); - } else if (BI.isKey(o.value)) { - this.setText(o.value); - } + var self = this, o = this.options; if (o.hgap + o.lgap > 0) { - this.text.element.css({ - "margin-left": o.hgap + o.lgap + "px" + this.element.css({ + "padding-left": o.hgap + o.lgap + "px" }) } if (o.hgap + o.rgap > 0) { - this.text.element.css({ - "margin-right": o.hgap + o.rgap + "px" + this.element.css({ + "padding-right": o.hgap + o.rgap + "px" }) } if (o.vgap + o.tgap > 0) { - this.text.element.css({ - "margin-top": o.vgap + o.tgap + "px" + this.element.css({ + "padding-top": o.vgap + o.tgap + "px" }) } if (o.vgap + o.bgap > 0) { - this.text.element.css({ - "margin-bottom": o.vgap + o.bgap + "px" + this.element.css({ + "padding-bottom": o.vgap + o.bgap + "px" }) } if (BI.isNumber(o.height)) { @@ -532,16 +519,33 @@ BI.Text = BI.inherit(BI.Single, { if (BI.isNumber(o.lineHeight)) { this.element.css({"lineHeight": o.lineHeight + "px"}); } - this.text.element.css({ - "textAlign": o.textAlign, - "whiteSpace": o.whiteSpace - }); this.element.css({ "textAlign": o.textAlign, "whiteSpace": o.whiteSpace }); + if (o.handler) { + this.text = BI.createWidget({ + type: "bi.layout", + tagName: 'span' + }); + this.text.element.click(function () { + o.handler(self.getValue()); + }); + BI.createWidget({ + type: "bi.default", + element: this, + items: [this.text] + }); + } else { + this.text = this; + } + if (BI.isKey(o.text)) { + this.setText(o.text); + } else if (BI.isKey(o.value)) { + this.setText(o.value); + } if (BI.isKey(o.keyword)) { - this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); + this.element.__textKeywordMarked__(o.text, o.keyword, o.py); } }, diff --git a/src/base/single/text.js b/src/base/single/text.js index 12efd184a..f8067923b 100644 --- a/src/base/single/text.js +++ b/src/base/single/text.js @@ -11,6 +11,7 @@ BI.Text = BI.inherit(BI.Single, { textAlign: "left", whiteSpace: "normal", lineHeight: null, + handler: null,//如果传入handler,表示处理文字的点击事件,不是区域的 hgap: 0, vgap: 0, lgap: 0, @@ -24,39 +25,25 @@ BI.Text = BI.inherit(BI.Single, { _init: function () { BI.Text.superclass._init.apply(this, arguments); - var o = this.options; - this.text = BI.createWidget({ - type: "bi.layout", - cls: "bi-text" - }); - BI.createWidget({ - type: "bi.default", - element: this, - items: [this.text] - }); - if (BI.isKey(o.text)) { - this.setText(o.text); - } else if (BI.isKey(o.value)) { - this.setText(o.value); - } + var self = this, o = this.options; if (o.hgap + o.lgap > 0) { - this.text.element.css({ - "margin-left": o.hgap + o.lgap + "px" + this.element.css({ + "padding-left": o.hgap + o.lgap + "px" }) } if (o.hgap + o.rgap > 0) { - this.text.element.css({ - "margin-right": o.hgap + o.rgap + "px" + this.element.css({ + "padding-right": o.hgap + o.rgap + "px" }) } if (o.vgap + o.tgap > 0) { - this.text.element.css({ - "margin-top": o.vgap + o.tgap + "px" + this.element.css({ + "padding-top": o.vgap + o.tgap + "px" }) } if (o.vgap + o.bgap > 0) { - this.text.element.css({ - "margin-bottom": o.vgap + o.bgap + "px" + this.element.css({ + "padding-bottom": o.vgap + o.bgap + "px" }) } if (BI.isNumber(o.height)) { @@ -65,16 +52,33 @@ BI.Text = BI.inherit(BI.Single, { if (BI.isNumber(o.lineHeight)) { this.element.css({"lineHeight": o.lineHeight + "px"}); } - this.text.element.css({ - "textAlign": o.textAlign, - "whiteSpace": o.whiteSpace - }); this.element.css({ "textAlign": o.textAlign, "whiteSpace": o.whiteSpace }); + if (o.handler) { + this.text = BI.createWidget({ + type: "bi.layout", + tagName: 'span' + }); + this.text.element.click(function () { + o.handler(self.getValue()); + }); + BI.createWidget({ + type: "bi.default", + element: this, + items: [this.text] + }); + } else { + this.text = this; + } + if (BI.isKey(o.text)) { + this.setText(o.text); + } else if (BI.isKey(o.value)) { + this.setText(o.value); + } if (BI.isKey(o.keyword)) { - this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); + this.element.__textKeywordMarked__(o.text, o.keyword, o.py); } }, From 9f4d0328cb7c177c33d4dcb6294b2f189da890ab Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 9 Aug 2017 16:15:28 +0800 Subject: [PATCH 02/10] add --- bi/base.css | 8 ++++++++ docs/base.css | 8 ++++++++ src/css/base/single/text.css | 8 ++++++++ src/less/base/single/text.less | 3 ++- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/bi/base.css b/bi/base.css index e30476362..1e6e4b8f4 100644 --- a/bi/base.css +++ b/bi/base.css @@ -873,6 +873,14 @@ li.CodeMirror-hint-active { overflow-x: hidden; overflow-y: hidden; white-space: nowrap; + -webkit-box-sizing: border-box; + /*Safari3.2+*/ + -moz-box-sizing: border-box; + /*Firefox3.5+*/ + -ms-box-sizing: border-box; + /*IE8*/ + box-sizing: border-box; + /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ word-break: break-word; } .bi-bubble { diff --git a/docs/base.css b/docs/base.css index e30476362..1e6e4b8f4 100644 --- a/docs/base.css +++ b/docs/base.css @@ -873,6 +873,14 @@ li.CodeMirror-hint-active { overflow-x: hidden; overflow-y: hidden; white-space: nowrap; + -webkit-box-sizing: border-box; + /*Safari3.2+*/ + -moz-box-sizing: border-box; + /*Firefox3.5+*/ + -ms-box-sizing: border-box; + /*IE8*/ + box-sizing: border-box; + /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ word-break: break-word; } .bi-bubble { diff --git a/src/css/base/single/text.css b/src/css/base/single/text.css index 69603a5a6..b8bc83e73 100644 --- a/src/css/base/single/text.css +++ b/src/css/base/single/text.css @@ -3,5 +3,13 @@ overflow-x: hidden; overflow-y: hidden; white-space: nowrap; + -webkit-box-sizing: border-box; + /*Safari3.2+*/ + -moz-box-sizing: border-box; + /*Firefox3.5+*/ + -ms-box-sizing: border-box; + /*IE8*/ + box-sizing: border-box; + /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ word-break: break-word; } diff --git a/src/less/base/single/text.less b/src/less/base/single/text.less index a6f1d83cd..fa6594810 100644 --- a/src/less/base/single/text.less +++ b/src/less/base/single/text.less @@ -1,6 +1,7 @@ @import "../../bibase"; -.bi-text{ +.bi-text { .overflow-dot(); + .box-sizing(border-box); word-break: break-word; } \ No newline at end of file From e49224c91851c37420a4059fbd7185fa9aae00a1 Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 10 Aug 2017 09:06:14 +0800 Subject: [PATCH 03/10] add --- bi/base.js | 10 +++++----- docs/base.js | 10 +++++----- src/base/single/button/buttons/button.js | 8 ++++---- src/base/single/text.js | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/bi/base.js b/bi/base.js index 214fc6bb3..0efb36640 100644 --- a/bi/base.js +++ b/bi/base.js @@ -545,7 +545,7 @@ BI.Text = BI.inherit(BI.Single, { this.setText(o.value); } if (BI.isKey(o.keyword)) { - this.element.__textKeywordMarked__(o.text, o.keyword, o.py); + this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); } }, @@ -16345,9 +16345,9 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) { BI.Button.superclass._init.apply(this, arguments); var o = this.options, self = this; if (BI.isNumber(o.height) && !o.clear && !o.block) { - this.element.css({height: o.height - 2, lineHeight: (o.height - 2) + 'px'}); + this.element.css({height: o.height + "px", lineHeight: o.height + "px"}); } else { - this.element.css({lineHeight: o.height + 'px'}); + this.element.css({lineHeight: o.height + "px"}); } if (BI.isKey(o.iconClass)) { this.icon = BI.createWidget({ @@ -16400,8 +16400,8 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) { if (o.clear === true) { this.element.addClass("clear"); } - if (o.minWidth > 2) { - this.element.css({"min-width": o.minWidth - 2 + "px"}); + if (o.minWidth > 0) { + this.element.css({"min-width": o.minWidth + "px"}); } }, diff --git a/docs/base.js b/docs/base.js index 214fc6bb3..0efb36640 100644 --- a/docs/base.js +++ b/docs/base.js @@ -545,7 +545,7 @@ BI.Text = BI.inherit(BI.Single, { this.setText(o.value); } if (BI.isKey(o.keyword)) { - this.element.__textKeywordMarked__(o.text, o.keyword, o.py); + this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); } }, @@ -16345,9 +16345,9 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) { BI.Button.superclass._init.apply(this, arguments); var o = this.options, self = this; if (BI.isNumber(o.height) && !o.clear && !o.block) { - this.element.css({height: o.height - 2, lineHeight: (o.height - 2) + 'px'}); + this.element.css({height: o.height + "px", lineHeight: o.height + "px"}); } else { - this.element.css({lineHeight: o.height + 'px'}); + this.element.css({lineHeight: o.height + "px"}); } if (BI.isKey(o.iconClass)) { this.icon = BI.createWidget({ @@ -16400,8 +16400,8 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) { if (o.clear === true) { this.element.addClass("clear"); } - if (o.minWidth > 2) { - this.element.css({"min-width": o.minWidth - 2 + "px"}); + if (o.minWidth > 0) { + this.element.css({"min-width": o.minWidth + "px"}); } }, diff --git a/src/base/single/button/buttons/button.js b/src/base/single/button/buttons/button.js index 9e02af048..f5450b38f 100644 --- a/src/base/single/button/buttons/button.js +++ b/src/base/single/button/buttons/button.js @@ -40,9 +40,9 @@ BI.Button.superclass._init.apply(this, arguments); var o = this.options, self = this; if (BI.isNumber(o.height) && !o.clear && !o.block) { - this.element.css({height: o.height - 2, lineHeight: (o.height - 2) + 'px'}); + this.element.css({height: o.height + "px", lineHeight: o.height + "px"}); } else { - this.element.css({lineHeight: o.height + 'px'}); + this.element.css({lineHeight: o.height + "px"}); } if (BI.isKey(o.iconClass)) { this.icon = BI.createWidget({ @@ -95,8 +95,8 @@ if (o.clear === true) { this.element.addClass("clear"); } - if (o.minWidth > 2) { - this.element.css({"min-width": o.minWidth - 2 + "px"}); + if (o.minWidth > 0) { + this.element.css({"min-width": o.minWidth + "px"}); } }, diff --git a/src/base/single/text.js b/src/base/single/text.js index f8067923b..4efe5143b 100644 --- a/src/base/single/text.js +++ b/src/base/single/text.js @@ -78,7 +78,7 @@ BI.Text = BI.inherit(BI.Single, { this.setText(o.value); } if (BI.isKey(o.keyword)) { - this.element.__textKeywordMarked__(o.text, o.keyword, o.py); + this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); } }, From fbf3d4840e2f4366928231ae5069ff2425c838c5 Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 10 Aug 2017 11:23:06 +0800 Subject: [PATCH 04/10] ad --- bi/base.js | 6 +++--- docs/base.js | 6 +++--- src/base/tree/treeview.js | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bi/base.js b/bi/base.js index 0efb36640..00175165d 100644 --- a/bi/base.js +++ b/bi/base.js @@ -1520,7 +1520,6 @@ BI.TreeView = BI.inherit(BI.Pane, { _init: function () { BI.TreeView.superclass._init.apply(this, arguments); this._stop = false; - this.container = BI.createWidget(); this._createTree(); this.tip = BI.createWidget({ @@ -1533,7 +1532,7 @@ BI.TreeView = BI.inherit(BI.Pane, { scrollable: true, scrolly: false, element: this, - items: [this.container, this.tip] + items: [this.tip] }); }, @@ -1552,7 +1551,7 @@ BI.TreeView = BI.inherit(BI.Pane, { }); BI.createWidget({ type: "bi.default", - element: this.container, + element: this.element, items: [this.tree] }); }, @@ -1947,6 +1946,7 @@ BI.TreeView = BI.inherit(BI.Pane, { setNode(child.children); }); } + BI.each(this.nodes.getNodes(), function (i, node) { node.halfCheck = false; setNode(node.children); diff --git a/docs/base.js b/docs/base.js index 0efb36640..00175165d 100644 --- a/docs/base.js +++ b/docs/base.js @@ -1520,7 +1520,6 @@ BI.TreeView = BI.inherit(BI.Pane, { _init: function () { BI.TreeView.superclass._init.apply(this, arguments); this._stop = false; - this.container = BI.createWidget(); this._createTree(); this.tip = BI.createWidget({ @@ -1533,7 +1532,7 @@ BI.TreeView = BI.inherit(BI.Pane, { scrollable: true, scrolly: false, element: this, - items: [this.container, this.tip] + items: [this.tip] }); }, @@ -1552,7 +1551,7 @@ BI.TreeView = BI.inherit(BI.Pane, { }); BI.createWidget({ type: "bi.default", - element: this.container, + element: this.element, items: [this.tree] }); }, @@ -1947,6 +1946,7 @@ BI.TreeView = BI.inherit(BI.Pane, { setNode(child.children); }); } + BI.each(this.nodes.getNodes(), function (i, node) { node.halfCheck = false; setNode(node.children); diff --git a/src/base/tree/treeview.js b/src/base/tree/treeview.js index 6ada95083..118a65088 100644 --- a/src/base/tree/treeview.js +++ b/src/base/tree/treeview.js @@ -15,7 +15,6 @@ BI.TreeView = BI.inherit(BI.Pane, { _init: function () { BI.TreeView.superclass._init.apply(this, arguments); this._stop = false; - this.container = BI.createWidget(); this._createTree(); this.tip = BI.createWidget({ @@ -28,7 +27,7 @@ BI.TreeView = BI.inherit(BI.Pane, { scrollable: true, scrolly: false, element: this, - items: [this.container, this.tip] + items: [this.tip] }); }, @@ -47,7 +46,7 @@ BI.TreeView = BI.inherit(BI.Pane, { }); BI.createWidget({ type: "bi.default", - element: this.container, + element: this.element, items: [this.tree] }); }, @@ -442,6 +441,7 @@ BI.TreeView = BI.inherit(BI.Pane, { setNode(child.children); }); } + BI.each(this.nodes.getNodes(), function (i, node) { node.halfCheck = false; setNode(node.children); From bc8510dad9e9831b85e23400c46661d6737714b1 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 17 Aug 2017 16:00:53 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E5=B0=BA=E5=AF=B8=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bi/base.js | 518 +++++++++--------- bi/widget.js | 3 +- docs/base.js | 518 +++++++++--------- docs/widget.js | 3 +- .../finetuning.number.editor.js | 3 +- 5 files changed, 524 insertions(+), 521 deletions(-) diff --git a/bi/base.js b/bi/base.js index 00175165d..3cc5e306d 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 @@ -922,82 +922,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 @@ -20297,32 +20297,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/widget.js b/bi/widget.js index 9799dd01a..8486ebdf1 100644 --- a/bi/widget.js +++ b/bi/widget.js @@ -5502,6 +5502,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, { var self = this, o = this.options; this.editor = BI.createWidget({ type: "bi.sign_editor", + height: o.height, value: this._alertInEditorValue(o.value), errorText: BI.i18nText("BI-Please_Input_Natural_Number"), validationChecker: function(v){ @@ -5549,7 +5550,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, { el: this.bottomBtn }] }, - width: 30 + width: 23 }] }); }, diff --git a/docs/base.js b/docs/base.js index 00175165d..3cc5e306d 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 @@ -922,82 +922,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 @@ -20297,32 +20297,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/widget.js b/docs/widget.js index 9799dd01a..8486ebdf1 100644 --- a/docs/widget.js +++ b/docs/widget.js @@ -5502,6 +5502,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, { var self = this, o = this.options; this.editor = BI.createWidget({ type: "bi.sign_editor", + height: o.height, value: this._alertInEditorValue(o.value), errorText: BI.i18nText("BI-Please_Input_Natural_Number"), validationChecker: function(v){ @@ -5549,7 +5550,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, { el: this.bottomBtn }] }, - width: 30 + width: 23 }] }); }, diff --git a/src/widget/finetuningnumbereditor/finetuning.number.editor.js b/src/widget/finetuningnumbereditor/finetuning.number.editor.js index f1832685d..af8502371 100644 --- a/src/widget/finetuningnumbereditor/finetuning.number.editor.js +++ b/src/widget/finetuningnumbereditor/finetuning.number.editor.js @@ -15,6 +15,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, { var self = this, o = this.options; this.editor = BI.createWidget({ type: "bi.sign_editor", + height: o.height, value: this._alertInEditorValue(o.value), errorText: BI.i18nText("BI-Please_Input_Natural_Number"), validationChecker: function(v){ @@ -62,7 +63,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, { el: this.bottomBtn }] }, - width: 30 + width: 23 }] }); }, From 7420cb20c4993e3795e08b545895d1658d93b8cd Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 17 Aug 2017 16:06:18 +0800 Subject: [PATCH 06/10] add --- bi/core.js | 728 ++++++++++++++-------------- bi/polyfill.js | 19 +- docs/core.js | 728 ++++++++++++++-------------- docs/polyfill.js | 19 +- src/core/utils/lru.js | 4 + src/core/utils/xml.js | 706 +++++++++++++-------------- src/{core/utils => polyfill}/set.js | 0 src/polyfill/sort.js | 2 +- 8 files changed, 1110 insertions(+), 1096 deletions(-) rename src/{core/utils => polyfill}/set.js (100%) diff --git a/bi/core.js b/bi/core.js index 219e5e21e..ab4d1a5eb 100644 --- a/bi/core.js +++ b/bi/core.js @@ -9348,6 +9348,10 @@ $.extend(BI, { ? entry : entry.value }; + + p.has = function (key) { + return this._keymap[key] != null; + } })();; !(function () { var MD5 = function (hexcase) { @@ -9944,22 +9948,7 @@ $.extend(BI, { }); } } -})();if (typeof Set !== 'undefined' && Set.toString().match(/native code/)) { - -} else { - Set = function () { - this.set = {} - }; - Set.prototype.has = function (key) { - return this.set[key] !== undefined; - }; - Set.prototype.add = function (key) { - this.set[key] = 1 - }; - Set.prototype.clear = function () { - this.set = {} - }; -}; +})();; (function () { var clamp = function (value, min, max) { if (value < min) { @@ -10656,359 +10645,360 @@ BI.Region.prototype = { pos.push(this.y + this.h / 2); return pos; } -};; -!(function (BI) { - - if (BI.isIE()) { - XMLSerializer = null; - DOMParser = null; - } - - - var XML = { - Document: { - NodeType: { - ELEMENT: 1, - ATTRIBUTE: 2, - TEXT: 3, - CDATA_SECTION: 4, - ENTITY_REFERENCE: 5, - ENTITY: 6, - PROCESSING_INSTRUCTION: 7, - COMMENT: 8, - DOCUMENT: 9, - DOCUMENT_TYPE: 10, - DOCUMENT_FRAGMENT: 11, - NOTATION: 12 - } - } - }; - - XML.ResultType = { - single: 'single', - array: 'array' - }; - - XML.fromString = function (xmlStr) { - try { - var parser = new DOMParser(); - return parser.parseFromString(xmlStr, "text/xml"); - } catch (e) { - var arrMSXML = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0"]; - for (var i = 0; i < arrMSXML.length; i++) { - try { - var xmlDoc = new ActiveXObject(arrMSXML[i]); - xmlDoc.setProperty("SelectionLanguage", "XPath"); - xmlDoc.async = false; - xmlDoc.loadXML(xmlStr); - return xmlDoc; - } catch (xmlError) { - } - } - } - }; - - XML.toString = function (xmlNode) { - if (!BI.isIE()) { - var xmlSerializer = new XMLSerializer(); - return xmlSerializer.serializeToString(xmlNode); - } else - return xmlNode.xml; - }; - - XML.getNSResolver = function (str) { - if (!str) { - return null; - } - var list = str.split(' '); - var namespaces = {}; - for (var i = 0; i < list.length; i++) { - var pair = list[i].split('='); - var fix = BI.trim(pair[0]).replace("xmlns:", ""); - namespaces[fix] = BI.trim(pair[1]).replace(/"/g, "").replace(/'/g, ""); - } - return function (prefix) { - return namespaces[prefix]; - }; - }; - - XML.eval = function (context, xpathExp, resultType, namespaces) { - if ((BI.isIE() && ('undefined' === typeof(context.selectSingleNode) || 'undefined' === typeof(context.selectNodes)))) { - return XML.eval2(context, xpathExp, resultType, namespaces); - } else { - if (BI.isIE()) { - namespaces = namespaces ? namespaces : ""; - var doc = (context.nodeType == XML.Document.NodeType.DOCUMENT) ? context : context.ownerDocument; - doc.setProperty("SelectionNamespaces", namespaces); - var result; - if (resultType == this.ResultType.single) { - result = context.selectSingleNode(xpathExp); - } else { - result = context.selectNodes(xpathExp) || []; - } - doc.setProperty("SelectionNamespaces", ""); - return result; - } else { - var node = context; - var xmlDoc = (context.nodeName.indexOf("document") == -1) ? context.ownerDocument : context; - var retType = (resultType == this.ResultType.single) ? XPathResult.FIRST_ORDERED_NODE_TYPE : XPathResult.ANY_TYPE; - var col = xmlDoc.evaluate(xpathExp, node, XML.getNSResolver(namespaces), retType, null); - - if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE) { - return col.singleNodeValue; - } else { - var thisColMemb = col.iterateNext(); - var rowsCol = []; - while (thisColMemb) { - rowsCol[rowsCol.length] = thisColMemb; - thisColMemb = col.iterateNext(); - } - return rowsCol; - } - } - } - }; - - XML.eval2 = function (context, xpathExp, resultType, namespaces) { - if (resultType !== "single" && resultType !== undefined && resultType !== null) { - throw new Error("justep.SimpleXML.eval only be resultType='single', not" + resultType); - } - - if (context === null || context === undefined || xpathExp === null || xpathExp === undefined) { - return context; - } - - if (context.nodeType == XML.Document.NodeType.DOCUMENT) { - context = context.documentElement; - } - - var childs, i; - if (xpathExp.indexOf("/") != -1) { - var items = xpathExp.split("/"); - var isAbs = xpathExp.substring(0, 1) == "/"; - for (i = 0; i < items.length; i++) { - var item = items[i]; - if (item === "") { - continue; - } else { - var next = null; - var ii = i + 1; - for (; ii < items.length; ii++) { - if (next === null) { - next = items[ii]; - } else { - next = next + "/" + items[ii]; - } - } - - if (item == ".") { - return this.eval(context, next, resultType); - - } else if (item == "..") { - return this.eval2(context.parentNode, next, resultType); - - } else if (item == "*") { - if (isAbs) { - return this.eval2(context, next, resultType); - - } else { - childs = context.childNodes; - for (var j = 0; j < childs.length; j++) { - var tmp = this.eval2(childs[j], next, resultType); - if (tmp !== null) { - return tmp; - } - } - return null; - } - - } else { - if (isAbs) { - if (context.nodeName == item) { - return this.eval2(context, next, resultType); - } else { - return null; - } - } else { - var child = this.getChildByName(context, item); - if (child !== null) { - return this.eval2(child, next, resultType); - } else { - return null; - } - - } - } - - } - } - - return null; - - } else { - if ("text()" == xpathExp) { - childs = context.childNodes; - for (i = 0; i < childs.length; i++) { - if (childs[i].nodeType == XML.Document.NodeType.TEXT) { - return childs[i]; - } - } - return null; - } else { - return this.getChildByName(context, xpathExp); - } - } - }; - - XML.getChildByName = function (context, name) { - if (context === null || context === undefined || name === null || name === undefined) { - return null; - } - - if (context.nodeType == XML.Document.NodeType.DOCUMENT) { - context = context.documentElement; - } - - var childs = context.childNodes; - for (var i = 0; i < childs.length; i++) { - if (childs[i].nodeType == XML.Document.NodeType.ELEMENT && (childs[i].nodeName == name || name == "*")) { - return childs[i]; - } - } - - return null; - }; - - XML.appendChildren = function (context, xpathExp, nodes, isBefore) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - if (isBefore && finded[i].firstNode) { - this._insertBefore(finded[i], nodes, finded[i].firstNode); - } else { - for (var j = 0; j < nodes.length; j++) { - finded[i].appendChild(nodes[j]); - } - } - } - return count; - }; - - XML.removeNodes = function (context, xpathExp) { - var nodes = this.eval(context, xpathExp); - for (var i = 0; i < nodes.length; i++) { - nodes[i].parentNode.removeChild(nodes[i]); - } - }; - - XML._insertBefore = function (parent, newchildren, refchild) { - for (var i = 0; i < newchildren.length; i++) { - parent.insertBefore(newchildren[i], refchild); - } - }; - - XML.insertNodes = function (context, xpathExp, nodes, isBefore) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - var refnode = (isBefore) ? finded[i] : finded[i].nextSibling; - this._insertBefore(finded[i].parentNode, nodes, refnode); - } - return count; - }; - - XML.replaceNodes = function (context, xpathExp, nodes) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - var refnode = finded[i]; - var parent = refnode.parentNode; - this._insertBefore(parent, nodes, refnode); - parent.removeChild(refnode); - } - return count; - }; - - XML.setNodeText = function (context, xpathExp, text) { - var finded = this.eval(context, xpathExp, this.ResultType.single); - if (finded === null) { - return; - } - if (finded.nodeType == XML.Document.NodeType.ELEMENT) { - var textNode = this.eval(finded, "./text()", this.ResultType.single); - if (!textNode) { - textNode = finded.ownerDocument.createTextNode(""); - finded.appendChild(textNode); - } - textNode.nodeValue = text; - } else { - finded.nodeValue = text; - } - return; - }; - - XML.getNodeText = function (context, xpathExp, defaultValue) { - var finded = xpathExp ? this.eval(context, xpathExp, this.ResultType.single) : context; - if (finded && (finded.nodeType == XML.Document.NodeType.ELEMENT)) { - finded = this.eval(finded, "./text()", this.ResultType.single); - } - return (finded && finded.nodeValue) ? "" + finded.nodeValue : (defaultValue !== undefined) ? defaultValue : null; - }; - - XML.Namespaces = { - XMLSCHEMA: "http://www.w3.org/2001/XMLSchema#", - XMLSCHEMA_STRING: "http://www.w3.org/2001/XMLSchema#String", - XMLSCHEMA_LONG: "http://www.w3.org/2001/XMLSchema#Long", - XMLSCHEMA_INTEGER: 'http://www.w3.org/2001/XMLSchema#Integer', - XMLSCHEMA_FLOAT: 'http://www.w3.org/2001/XMLSchema#Float', - XMLSCHEMA_DOUBLE: 'http://www.w3.org/2001/XMLSchema#Double', - XMLSCHEMA_DECIMAL: 'http://www.w3.org/2001/XMLSchema#Decimal', - XMLSCHEMA_DATE: 'http://www.w3.org/2001/XMLSchema#Date', - XMLSCHEMA_TIME: 'http://www.w3.org/2001/XMLSchema#Time', - XMLSCHEMA_DATETIME: 'http://www.w3.org/2001/XMLSchema#DateTime', - XMLSCHEMA_BOOLEAN: 'http://www.w3.org/2001/XMLSchema#Boolean', - XMLSCHEMA_SYMBOL: 'http://www.w3.org/2001/XMLSchema#Symbol', - JUSTEPSCHEMA: "http://www.justep.com/xbiz#", - RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - JUSTEP: "http://www.justep.com/x5#", - 'get': function (type) { - type = type ? type.toLowerCase() : "string"; - if ("string" == type) { - return XML.Namespaces.XMLSCHEMA_STRING; - } - else if ("integer" == type) { - return XML.Namespaces.XMLSCHEMA_INTEGER; - } - else if ("long" == type) { - return XML.Namespaces.XMLSCHEMA_LONG; - } - else if ("float" == type) { - return XML.Namespaces.XMLSCHEMA_FLOAT; - } - else if ("double" == type) { - return XML.Namespaces.XMLSCHEMA_DOUBLE; - } - else if ("decimal" == type) { - return XML.Namespaces.XMLSCHEMA_DECIMAL; - } - else if ("date" == type) { - return XML.Namespaces.XMLSCHEMA_DATE; - } - else if ("time" == type) { - return XML.Namespaces.XMLSCHEMA_TIME; - } - else if ("datetime" == type) { - return XML.Namespaces.XMLSCHEMA_DATETIME; - } - else if ("boolean" == type) { - return XML.Namespaces.XMLSCHEMA_BOOLEAN; - } - } - }; -})(BI);BI.BehaviorFactory = { +};// ; +// !(function (BI) { +// +// if (BI.isIE()) { +// XMLSerializer = null; +// DOMParser = null; +// } +// +// +// var XML = { +// Document: { +// NodeType: { +// ELEMENT: 1, +// ATTRIBUTE: 2, +// TEXT: 3, +// CDATA_SECTION: 4, +// ENTITY_REFERENCE: 5, +// ENTITY: 6, +// PROCESSING_INSTRUCTION: 7, +// COMMENT: 8, +// DOCUMENT: 9, +// DOCUMENT_TYPE: 10, +// DOCUMENT_FRAGMENT: 11, +// NOTATION: 12 +// } +// } +// }; +// +// XML.ResultType = { +// single: 'single', +// array: 'array' +// }; +// +// XML.fromString = function (xmlStr) { +// try { +// var parser = new DOMParser(); +// return parser.parseFromString(xmlStr, "text/xml"); +// } catch (e) { +// var arrMSXML = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0"]; +// for (var i = 0; i < arrMSXML.length; i++) { +// try { +// var xmlDoc = new ActiveXObject(arrMSXML[i]); +// xmlDoc.setProperty("SelectionLanguage", "XPath"); +// xmlDoc.async = false; +// xmlDoc.loadXML(xmlStr); +// return xmlDoc; +// } catch (xmlError) { +// } +// } +// } +// }; +// +// XML.toString = function (xmlNode) { +// if (!BI.isIE()) { +// var xmlSerializer = new XMLSerializer(); +// return xmlSerializer.serializeToString(xmlNode); +// } else +// return xmlNode.xml; +// }; +// +// XML.getNSResolver = function (str) { +// if (!str) { +// return null; +// } +// var list = str.split(' '); +// var namespaces = {}; +// for (var i = 0; i < list.length; i++) { +// var pair = list[i].split('='); +// var fix = BI.trim(pair[0]).replace("xmlns:", ""); +// namespaces[fix] = BI.trim(pair[1]).replace(/"/g, "").replace(/'/g, ""); +// } +// return function (prefix) { +// return namespaces[prefix]; +// }; +// }; +// +// XML.eval = function (context, xpathExp, resultType, namespaces) { +// if ((BI.isIE() && ('undefined' === typeof(context.selectSingleNode) || 'undefined' === typeof(context.selectNodes)))) { +// return XML.eval2(context, xpathExp, resultType, namespaces); +// } else { +// if (BI.isIE()) { +// namespaces = namespaces ? namespaces : ""; +// var doc = (context.nodeType == XML.Document.NodeType.DOCUMENT) ? context : context.ownerDocument; +// doc.setProperty("SelectionNamespaces", namespaces); +// var result; +// if (resultType == this.ResultType.single) { +// result = context.selectSingleNode(xpathExp); +// } else { +// result = context.selectNodes(xpathExp) || []; +// } +// doc.setProperty("SelectionNamespaces", ""); +// return result; +// } else { +// var node = context; +// var xmlDoc = (context.nodeName.indexOf("document") == -1) ? context.ownerDocument : context; +// var retType = (resultType == this.ResultType.single) ? XPathResult.FIRST_ORDERED_NODE_TYPE : XPathResult.ANY_TYPE; +// var col = xmlDoc.evaluate(xpathExp, node, XML.getNSResolver(namespaces), retType, null); +// +// if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE) { +// return col.singleNodeValue; +// } else { +// var thisColMemb = col.iterateNext(); +// var rowsCol = []; +// while (thisColMemb) { +// rowsCol[rowsCol.length] = thisColMemb; +// thisColMemb = col.iterateNext(); +// } +// return rowsCol; +// } +// } +// } +// }; +// +// XML.eval2 = function (context, xpathExp, resultType, namespaces) { +// if (resultType !== "single" && resultType !== undefined && resultType !== null) { +// throw new Error("justep.SimpleXML.eval only be resultType='single', not" + resultType); +// } +// +// if (context === null || context === undefined || xpathExp === null || xpathExp === undefined) { +// return context; +// } +// +// if (context.nodeType == XML.Document.NodeType.DOCUMENT) { +// context = context.documentElement; +// } +// +// var childs, i; +// if (xpathExp.indexOf("/") != -1) { +// var items = xpathExp.split("/"); +// var isAbs = xpathExp.substring(0, 1) == "/"; +// for (i = 0; i < items.length; i++) { +// var item = items[i]; +// if (item === "") { +// continue; +// } else { +// var next = null; +// var ii = i + 1; +// for (; ii < items.length; ii++) { +// if (next === null) { +// next = items[ii]; +// } else { +// next = next + "/" + items[ii]; +// } +// } +// +// if (item == ".") { +// return this.eval(context, next, resultType); +// +// } else if (item == "..") { +// return this.eval2(context.parentNode, next, resultType); +// +// } else if (item == "*") { +// if (isAbs) { +// return this.eval2(context, next, resultType); +// +// } else { +// childs = context.childNodes; +// for (var j = 0; j < childs.length; j++) { +// var tmp = this.eval2(childs[j], next, resultType); +// if (tmp !== null) { +// return tmp; +// } +// } +// return null; +// } +// +// } else { +// if (isAbs) { +// if (context.nodeName == item) { +// return this.eval2(context, next, resultType); +// } else { +// return null; +// } +// } else { +// var child = this.getChildByName(context, item); +// if (child !== null) { +// return this.eval2(child, next, resultType); +// } else { +// return null; +// } +// +// } +// } +// +// } +// } +// +// return null; +// +// } else { +// if ("text()" == xpathExp) { +// childs = context.childNodes; +// for (i = 0; i < childs.length; i++) { +// if (childs[i].nodeType == XML.Document.NodeType.TEXT) { +// return childs[i]; +// } +// } +// return null; +// } else { +// return this.getChildByName(context, xpathExp); +// } +// } +// }; +// +// XML.getChildByName = function (context, name) { +// if (context === null || context === undefined || name === null || name === undefined) { +// return null; +// } +// +// if (context.nodeType == XML.Document.NodeType.DOCUMENT) { +// context = context.documentElement; +// } +// +// var childs = context.childNodes; +// for (var i = 0; i < childs.length; i++) { +// if (childs[i].nodeType == XML.Document.NodeType.ELEMENT && (childs[i].nodeName == name || name == "*")) { +// return childs[i]; +// } +// } +// +// return null; +// }; +// +// XML.appendChildren = function (context, xpathExp, nodes, isBefore) { +// nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; +// var finded = this.eval(context, xpathExp); +// var count = finded.length; +// for (var i = 0; i < count; i++) { +// if (isBefore && finded[i].firstNode) { +// this._insertBefore(finded[i], nodes, finded[i].firstNode); +// } else { +// for (var j = 0; j < nodes.length; j++) { +// finded[i].appendChild(nodes[j]); +// } +// } +// } +// return count; +// }; +// +// XML.removeNodes = function (context, xpathExp) { +// var nodes = this.eval(context, xpathExp); +// for (var i = 0; i < nodes.length; i++) { +// nodes[i].parentNode.removeChild(nodes[i]); +// } +// }; +// +// XML._insertBefore = function (parent, newchildren, refchild) { +// for (var i = 0; i < newchildren.length; i++) { +// parent.insertBefore(newchildren[i], refchild); +// } +// }; +// +// XML.insertNodes = function (context, xpathExp, nodes, isBefore) { +// nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; +// var finded = this.eval(context, xpathExp); +// var count = finded.length; +// for (var i = 0; i < count; i++) { +// var refnode = (isBefore) ? finded[i] : finded[i].nextSibling; +// this._insertBefore(finded[i].parentNode, nodes, refnode); +// } +// return count; +// }; +// +// XML.replaceNodes = function (context, xpathExp, nodes) { +// nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; +// var finded = this.eval(context, xpathExp); +// var count = finded.length; +// for (var i = 0; i < count; i++) { +// var refnode = finded[i]; +// var parent = refnode.parentNode; +// this._insertBefore(parent, nodes, refnode); +// parent.removeChild(refnode); +// } +// return count; +// }; +// +// XML.setNodeText = function (context, xpathExp, text) { +// var finded = this.eval(context, xpathExp, this.ResultType.single); +// if (finded === null) { +// return; +// } +// if (finded.nodeType == XML.Document.NodeType.ELEMENT) { +// var textNode = this.eval(finded, "./text()", this.ResultType.single); +// if (!textNode) { +// textNode = finded.ownerDocument.createTextNode(""); +// finded.appendChild(textNode); +// } +// textNode.nodeValue = text; +// } else { +// finded.nodeValue = text; +// } +// return; +// }; +// +// XML.getNodeText = function (context, xpathExp, defaultValue) { +// var finded = xpathExp ? this.eval(context, xpathExp, this.ResultType.single) : context; +// if (finded && (finded.nodeType == XML.Document.NodeType.ELEMENT)) { +// finded = this.eval(finded, "./text()", this.ResultType.single); +// } +// return (finded && finded.nodeValue) ? "" + finded.nodeValue : (defaultValue !== undefined) ? defaultValue : null; +// }; +// +// XML.Namespaces = { +// XMLSCHEMA: "http://www.w3.org/2001/XMLSchema#", +// XMLSCHEMA_STRING: "http://www.w3.org/2001/XMLSchema#String", +// XMLSCHEMA_LONG: "http://www.w3.org/2001/XMLSchema#Long", +// XMLSCHEMA_INTEGER: 'http://www.w3.org/2001/XMLSchema#Integer', +// XMLSCHEMA_FLOAT: 'http://www.w3.org/2001/XMLSchema#Float', +// XMLSCHEMA_DOUBLE: 'http://www.w3.org/2001/XMLSchema#Double', +// XMLSCHEMA_DECIMAL: 'http://www.w3.org/2001/XMLSchema#Decimal', +// XMLSCHEMA_DATE: 'http://www.w3.org/2001/XMLSchema#Date', +// XMLSCHEMA_TIME: 'http://www.w3.org/2001/XMLSchema#Time', +// XMLSCHEMA_DATETIME: 'http://www.w3.org/2001/XMLSchema#DateTime', +// XMLSCHEMA_BOOLEAN: 'http://www.w3.org/2001/XMLSchema#Boolean', +// XMLSCHEMA_SYMBOL: 'http://www.w3.org/2001/XMLSchema#Symbol', +// JUSTEPSCHEMA: "http://www.justep.com/xbiz#", +// RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#", +// JUSTEP: "http://www.justep.com/x5#", +// 'get': function (type) { +// type = type ? type.toLowerCase() : "string"; +// if ("string" == type) { +// return XML.Namespaces.XMLSCHEMA_STRING; +// } +// else if ("integer" == type) { +// return XML.Namespaces.XMLSCHEMA_INTEGER; +// } +// else if ("long" == type) { +// return XML.Namespaces.XMLSCHEMA_LONG; +// } +// else if ("float" == type) { +// return XML.Namespaces.XMLSCHEMA_FLOAT; +// } +// else if ("double" == type) { +// return XML.Namespaces.XMLSCHEMA_DOUBLE; +// } +// else if ("decimal" == type) { +// return XML.Namespaces.XMLSCHEMA_DECIMAL; +// } +// else if ("date" == type) { +// return XML.Namespaces.XMLSCHEMA_DATE; +// } +// else if ("time" == type) { +// return XML.Namespaces.XMLSCHEMA_TIME; +// } +// else if ("datetime" == type) { +// return XML.Namespaces.XMLSCHEMA_DATETIME; +// } +// else if ("boolean" == type) { +// return XML.Namespaces.XMLSCHEMA_BOOLEAN; +// } +// } +// }; +// })(BI); +BI.BehaviorFactory = { createBehavior: function(key, options){ var behavior; switch (key){ diff --git a/bi/polyfill.js b/bi/polyfill.js index f493c89a5..1bf548f0a 100644 --- a/bi/polyfill.js +++ b/bi/polyfill.js @@ -60,8 +60,23 @@ window.localStorage || (window.localStorage = { clear: function () { this.items = {}; } -});//修复ie9下sort方法的bug -!function (window) { +});if (typeof Set !== 'undefined' && Set.toString().match(/native code/)) { + +} else { + Set = function () { + this.set = {} + }; + Set.prototype.has = function (key) { + return this.set[key] !== undefined; + }; + Set.prototype.add = function (key) { + this.set[key] = 1 + }; + Set.prototype.clear = function () { + this.set = {} + }; +}//修复ie9下sort方法的bug +;!function (window) { var ua = window.navigator.userAgent.toLowerCase(), reg = /msie|applewebkit.+safari/; if (reg.test(ua)) { diff --git a/docs/core.js b/docs/core.js index 1c727cb83..cf66ba0af 100644 --- a/docs/core.js +++ b/docs/core.js @@ -17795,6 +17795,10 @@ $.extend(BI, { ? entry : entry.value }; + + p.has = function (key) { + return this._keymap[key] != null; + } })();; !(function () { var MD5 = function (hexcase) { @@ -18391,22 +18395,7 @@ $.extend(BI, { }); } } -})();if (typeof Set !== 'undefined' && Set.toString().match(/native code/)) { - -} else { - Set = function () { - this.set = {} - }; - Set.prototype.has = function (key) { - return this.set[key] !== undefined; - }; - Set.prototype.add = function (key) { - this.set[key] = 1 - }; - Set.prototype.clear = function () { - this.set = {} - }; -}; +})();; (function () { var clamp = function (value, min, max) { if (value < min) { @@ -19103,359 +19092,360 @@ BI.Region.prototype = { pos.push(this.y + this.h / 2); return pos; } -};; -!(function (BI) { - - if (BI.isIE()) { - XMLSerializer = null; - DOMParser = null; - } - - - var XML = { - Document: { - NodeType: { - ELEMENT: 1, - ATTRIBUTE: 2, - TEXT: 3, - CDATA_SECTION: 4, - ENTITY_REFERENCE: 5, - ENTITY: 6, - PROCESSING_INSTRUCTION: 7, - COMMENT: 8, - DOCUMENT: 9, - DOCUMENT_TYPE: 10, - DOCUMENT_FRAGMENT: 11, - NOTATION: 12 - } - } - }; - - XML.ResultType = { - single: 'single', - array: 'array' - }; - - XML.fromString = function (xmlStr) { - try { - var parser = new DOMParser(); - return parser.parseFromString(xmlStr, "text/xml"); - } catch (e) { - var arrMSXML = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0"]; - for (var i = 0; i < arrMSXML.length; i++) { - try { - var xmlDoc = new ActiveXObject(arrMSXML[i]); - xmlDoc.setProperty("SelectionLanguage", "XPath"); - xmlDoc.async = false; - xmlDoc.loadXML(xmlStr); - return xmlDoc; - } catch (xmlError) { - } - } - } - }; - - XML.toString = function (xmlNode) { - if (!BI.isIE()) { - var xmlSerializer = new XMLSerializer(); - return xmlSerializer.serializeToString(xmlNode); - } else - return xmlNode.xml; - }; - - XML.getNSResolver = function (str) { - if (!str) { - return null; - } - var list = str.split(' '); - var namespaces = {}; - for (var i = 0; i < list.length; i++) { - var pair = list[i].split('='); - var fix = BI.trim(pair[0]).replace("xmlns:", ""); - namespaces[fix] = BI.trim(pair[1]).replace(/"/g, "").replace(/'/g, ""); - } - return function (prefix) { - return namespaces[prefix]; - }; - }; - - XML.eval = function (context, xpathExp, resultType, namespaces) { - if ((BI.isIE() && ('undefined' === typeof(context.selectSingleNode) || 'undefined' === typeof(context.selectNodes)))) { - return XML.eval2(context, xpathExp, resultType, namespaces); - } else { - if (BI.isIE()) { - namespaces = namespaces ? namespaces : ""; - var doc = (context.nodeType == XML.Document.NodeType.DOCUMENT) ? context : context.ownerDocument; - doc.setProperty("SelectionNamespaces", namespaces); - var result; - if (resultType == this.ResultType.single) { - result = context.selectSingleNode(xpathExp); - } else { - result = context.selectNodes(xpathExp) || []; - } - doc.setProperty("SelectionNamespaces", ""); - return result; - } else { - var node = context; - var xmlDoc = (context.nodeName.indexOf("document") == -1) ? context.ownerDocument : context; - var retType = (resultType == this.ResultType.single) ? XPathResult.FIRST_ORDERED_NODE_TYPE : XPathResult.ANY_TYPE; - var col = xmlDoc.evaluate(xpathExp, node, XML.getNSResolver(namespaces), retType, null); - - if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE) { - return col.singleNodeValue; - } else { - var thisColMemb = col.iterateNext(); - var rowsCol = []; - while (thisColMemb) { - rowsCol[rowsCol.length] = thisColMemb; - thisColMemb = col.iterateNext(); - } - return rowsCol; - } - } - } - }; - - XML.eval2 = function (context, xpathExp, resultType, namespaces) { - if (resultType !== "single" && resultType !== undefined && resultType !== null) { - throw new Error("justep.SimpleXML.eval only be resultType='single', not" + resultType); - } - - if (context === null || context === undefined || xpathExp === null || xpathExp === undefined) { - return context; - } - - if (context.nodeType == XML.Document.NodeType.DOCUMENT) { - context = context.documentElement; - } - - var childs, i; - if (xpathExp.indexOf("/") != -1) { - var items = xpathExp.split("/"); - var isAbs = xpathExp.substring(0, 1) == "/"; - for (i = 0; i < items.length; i++) { - var item = items[i]; - if (item === "") { - continue; - } else { - var next = null; - var ii = i + 1; - for (; ii < items.length; ii++) { - if (next === null) { - next = items[ii]; - } else { - next = next + "/" + items[ii]; - } - } - - if (item == ".") { - return this.eval(context, next, resultType); - - } else if (item == "..") { - return this.eval2(context.parentNode, next, resultType); - - } else if (item == "*") { - if (isAbs) { - return this.eval2(context, next, resultType); - - } else { - childs = context.childNodes; - for (var j = 0; j < childs.length; j++) { - var tmp = this.eval2(childs[j], next, resultType); - if (tmp !== null) { - return tmp; - } - } - return null; - } - - } else { - if (isAbs) { - if (context.nodeName == item) { - return this.eval2(context, next, resultType); - } else { - return null; - } - } else { - var child = this.getChildByName(context, item); - if (child !== null) { - return this.eval2(child, next, resultType); - } else { - return null; - } - - } - } - - } - } - - return null; - - } else { - if ("text()" == xpathExp) { - childs = context.childNodes; - for (i = 0; i < childs.length; i++) { - if (childs[i].nodeType == XML.Document.NodeType.TEXT) { - return childs[i]; - } - } - return null; - } else { - return this.getChildByName(context, xpathExp); - } - } - }; - - XML.getChildByName = function (context, name) { - if (context === null || context === undefined || name === null || name === undefined) { - return null; - } - - if (context.nodeType == XML.Document.NodeType.DOCUMENT) { - context = context.documentElement; - } - - var childs = context.childNodes; - for (var i = 0; i < childs.length; i++) { - if (childs[i].nodeType == XML.Document.NodeType.ELEMENT && (childs[i].nodeName == name || name == "*")) { - return childs[i]; - } - } - - return null; - }; - - XML.appendChildren = function (context, xpathExp, nodes, isBefore) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - if (isBefore && finded[i].firstNode) { - this._insertBefore(finded[i], nodes, finded[i].firstNode); - } else { - for (var j = 0; j < nodes.length; j++) { - finded[i].appendChild(nodes[j]); - } - } - } - return count; - }; - - XML.removeNodes = function (context, xpathExp) { - var nodes = this.eval(context, xpathExp); - for (var i = 0; i < nodes.length; i++) { - nodes[i].parentNode.removeChild(nodes[i]); - } - }; - - XML._insertBefore = function (parent, newchildren, refchild) { - for (var i = 0; i < newchildren.length; i++) { - parent.insertBefore(newchildren[i], refchild); - } - }; - - XML.insertNodes = function (context, xpathExp, nodes, isBefore) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - var refnode = (isBefore) ? finded[i] : finded[i].nextSibling; - this._insertBefore(finded[i].parentNode, nodes, refnode); - } - return count; - }; - - XML.replaceNodes = function (context, xpathExp, nodes) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - var refnode = finded[i]; - var parent = refnode.parentNode; - this._insertBefore(parent, nodes, refnode); - parent.removeChild(refnode); - } - return count; - }; - - XML.setNodeText = function (context, xpathExp, text) { - var finded = this.eval(context, xpathExp, this.ResultType.single); - if (finded === null) { - return; - } - if (finded.nodeType == XML.Document.NodeType.ELEMENT) { - var textNode = this.eval(finded, "./text()", this.ResultType.single); - if (!textNode) { - textNode = finded.ownerDocument.createTextNode(""); - finded.appendChild(textNode); - } - textNode.nodeValue = text; - } else { - finded.nodeValue = text; - } - return; - }; - - XML.getNodeText = function (context, xpathExp, defaultValue) { - var finded = xpathExp ? this.eval(context, xpathExp, this.ResultType.single) : context; - if (finded && (finded.nodeType == XML.Document.NodeType.ELEMENT)) { - finded = this.eval(finded, "./text()", this.ResultType.single); - } - return (finded && finded.nodeValue) ? "" + finded.nodeValue : (defaultValue !== undefined) ? defaultValue : null; - }; - - XML.Namespaces = { - XMLSCHEMA: "http://www.w3.org/2001/XMLSchema#", - XMLSCHEMA_STRING: "http://www.w3.org/2001/XMLSchema#String", - XMLSCHEMA_LONG: "http://www.w3.org/2001/XMLSchema#Long", - XMLSCHEMA_INTEGER: 'http://www.w3.org/2001/XMLSchema#Integer', - XMLSCHEMA_FLOAT: 'http://www.w3.org/2001/XMLSchema#Float', - XMLSCHEMA_DOUBLE: 'http://www.w3.org/2001/XMLSchema#Double', - XMLSCHEMA_DECIMAL: 'http://www.w3.org/2001/XMLSchema#Decimal', - XMLSCHEMA_DATE: 'http://www.w3.org/2001/XMLSchema#Date', - XMLSCHEMA_TIME: 'http://www.w3.org/2001/XMLSchema#Time', - XMLSCHEMA_DATETIME: 'http://www.w3.org/2001/XMLSchema#DateTime', - XMLSCHEMA_BOOLEAN: 'http://www.w3.org/2001/XMLSchema#Boolean', - XMLSCHEMA_SYMBOL: 'http://www.w3.org/2001/XMLSchema#Symbol', - JUSTEPSCHEMA: "http://www.justep.com/xbiz#", - RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - JUSTEP: "http://www.justep.com/x5#", - 'get': function (type) { - type = type ? type.toLowerCase() : "string"; - if ("string" == type) { - return XML.Namespaces.XMLSCHEMA_STRING; - } - else if ("integer" == type) { - return XML.Namespaces.XMLSCHEMA_INTEGER; - } - else if ("long" == type) { - return XML.Namespaces.XMLSCHEMA_LONG; - } - else if ("float" == type) { - return XML.Namespaces.XMLSCHEMA_FLOAT; - } - else if ("double" == type) { - return XML.Namespaces.XMLSCHEMA_DOUBLE; - } - else if ("decimal" == type) { - return XML.Namespaces.XMLSCHEMA_DECIMAL; - } - else if ("date" == type) { - return XML.Namespaces.XMLSCHEMA_DATE; - } - else if ("time" == type) { - return XML.Namespaces.XMLSCHEMA_TIME; - } - else if ("datetime" == type) { - return XML.Namespaces.XMLSCHEMA_DATETIME; - } - else if ("boolean" == type) { - return XML.Namespaces.XMLSCHEMA_BOOLEAN; - } - } - }; -})(BI);BI.BehaviorFactory = { +};// ; +// !(function (BI) { +// +// if (BI.isIE()) { +// XMLSerializer = null; +// DOMParser = null; +// } +// +// +// var XML = { +// Document: { +// NodeType: { +// ELEMENT: 1, +// ATTRIBUTE: 2, +// TEXT: 3, +// CDATA_SECTION: 4, +// ENTITY_REFERENCE: 5, +// ENTITY: 6, +// PROCESSING_INSTRUCTION: 7, +// COMMENT: 8, +// DOCUMENT: 9, +// DOCUMENT_TYPE: 10, +// DOCUMENT_FRAGMENT: 11, +// NOTATION: 12 +// } +// } +// }; +// +// XML.ResultType = { +// single: 'single', +// array: 'array' +// }; +// +// XML.fromString = function (xmlStr) { +// try { +// var parser = new DOMParser(); +// return parser.parseFromString(xmlStr, "text/xml"); +// } catch (e) { +// var arrMSXML = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0"]; +// for (var i = 0; i < arrMSXML.length; i++) { +// try { +// var xmlDoc = new ActiveXObject(arrMSXML[i]); +// xmlDoc.setProperty("SelectionLanguage", "XPath"); +// xmlDoc.async = false; +// xmlDoc.loadXML(xmlStr); +// return xmlDoc; +// } catch (xmlError) { +// } +// } +// } +// }; +// +// XML.toString = function (xmlNode) { +// if (!BI.isIE()) { +// var xmlSerializer = new XMLSerializer(); +// return xmlSerializer.serializeToString(xmlNode); +// } else +// return xmlNode.xml; +// }; +// +// XML.getNSResolver = function (str) { +// if (!str) { +// return null; +// } +// var list = str.split(' '); +// var namespaces = {}; +// for (var i = 0; i < list.length; i++) { +// var pair = list[i].split('='); +// var fix = BI.trim(pair[0]).replace("xmlns:", ""); +// namespaces[fix] = BI.trim(pair[1]).replace(/"/g, "").replace(/'/g, ""); +// } +// return function (prefix) { +// return namespaces[prefix]; +// }; +// }; +// +// XML.eval = function (context, xpathExp, resultType, namespaces) { +// if ((BI.isIE() && ('undefined' === typeof(context.selectSingleNode) || 'undefined' === typeof(context.selectNodes)))) { +// return XML.eval2(context, xpathExp, resultType, namespaces); +// } else { +// if (BI.isIE()) { +// namespaces = namespaces ? namespaces : ""; +// var doc = (context.nodeType == XML.Document.NodeType.DOCUMENT) ? context : context.ownerDocument; +// doc.setProperty("SelectionNamespaces", namespaces); +// var result; +// if (resultType == this.ResultType.single) { +// result = context.selectSingleNode(xpathExp); +// } else { +// result = context.selectNodes(xpathExp) || []; +// } +// doc.setProperty("SelectionNamespaces", ""); +// return result; +// } else { +// var node = context; +// var xmlDoc = (context.nodeName.indexOf("document") == -1) ? context.ownerDocument : context; +// var retType = (resultType == this.ResultType.single) ? XPathResult.FIRST_ORDERED_NODE_TYPE : XPathResult.ANY_TYPE; +// var col = xmlDoc.evaluate(xpathExp, node, XML.getNSResolver(namespaces), retType, null); +// +// if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE) { +// return col.singleNodeValue; +// } else { +// var thisColMemb = col.iterateNext(); +// var rowsCol = []; +// while (thisColMemb) { +// rowsCol[rowsCol.length] = thisColMemb; +// thisColMemb = col.iterateNext(); +// } +// return rowsCol; +// } +// } +// } +// }; +// +// XML.eval2 = function (context, xpathExp, resultType, namespaces) { +// if (resultType !== "single" && resultType !== undefined && resultType !== null) { +// throw new Error("justep.SimpleXML.eval only be resultType='single', not" + resultType); +// } +// +// if (context === null || context === undefined || xpathExp === null || xpathExp === undefined) { +// return context; +// } +// +// if (context.nodeType == XML.Document.NodeType.DOCUMENT) { +// context = context.documentElement; +// } +// +// var childs, i; +// if (xpathExp.indexOf("/") != -1) { +// var items = xpathExp.split("/"); +// var isAbs = xpathExp.substring(0, 1) == "/"; +// for (i = 0; i < items.length; i++) { +// var item = items[i]; +// if (item === "") { +// continue; +// } else { +// var next = null; +// var ii = i + 1; +// for (; ii < items.length; ii++) { +// if (next === null) { +// next = items[ii]; +// } else { +// next = next + "/" + items[ii]; +// } +// } +// +// if (item == ".") { +// return this.eval(context, next, resultType); +// +// } else if (item == "..") { +// return this.eval2(context.parentNode, next, resultType); +// +// } else if (item == "*") { +// if (isAbs) { +// return this.eval2(context, next, resultType); +// +// } else { +// childs = context.childNodes; +// for (var j = 0; j < childs.length; j++) { +// var tmp = this.eval2(childs[j], next, resultType); +// if (tmp !== null) { +// return tmp; +// } +// } +// return null; +// } +// +// } else { +// if (isAbs) { +// if (context.nodeName == item) { +// return this.eval2(context, next, resultType); +// } else { +// return null; +// } +// } else { +// var child = this.getChildByName(context, item); +// if (child !== null) { +// return this.eval2(child, next, resultType); +// } else { +// return null; +// } +// +// } +// } +// +// } +// } +// +// return null; +// +// } else { +// if ("text()" == xpathExp) { +// childs = context.childNodes; +// for (i = 0; i < childs.length; i++) { +// if (childs[i].nodeType == XML.Document.NodeType.TEXT) { +// return childs[i]; +// } +// } +// return null; +// } else { +// return this.getChildByName(context, xpathExp); +// } +// } +// }; +// +// XML.getChildByName = function (context, name) { +// if (context === null || context === undefined || name === null || name === undefined) { +// return null; +// } +// +// if (context.nodeType == XML.Document.NodeType.DOCUMENT) { +// context = context.documentElement; +// } +// +// var childs = context.childNodes; +// for (var i = 0; i < childs.length; i++) { +// if (childs[i].nodeType == XML.Document.NodeType.ELEMENT && (childs[i].nodeName == name || name == "*")) { +// return childs[i]; +// } +// } +// +// return null; +// }; +// +// XML.appendChildren = function (context, xpathExp, nodes, isBefore) { +// nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; +// var finded = this.eval(context, xpathExp); +// var count = finded.length; +// for (var i = 0; i < count; i++) { +// if (isBefore && finded[i].firstNode) { +// this._insertBefore(finded[i], nodes, finded[i].firstNode); +// } else { +// for (var j = 0; j < nodes.length; j++) { +// finded[i].appendChild(nodes[j]); +// } +// } +// } +// return count; +// }; +// +// XML.removeNodes = function (context, xpathExp) { +// var nodes = this.eval(context, xpathExp); +// for (var i = 0; i < nodes.length; i++) { +// nodes[i].parentNode.removeChild(nodes[i]); +// } +// }; +// +// XML._insertBefore = function (parent, newchildren, refchild) { +// for (var i = 0; i < newchildren.length; i++) { +// parent.insertBefore(newchildren[i], refchild); +// } +// }; +// +// XML.insertNodes = function (context, xpathExp, nodes, isBefore) { +// nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; +// var finded = this.eval(context, xpathExp); +// var count = finded.length; +// for (var i = 0; i < count; i++) { +// var refnode = (isBefore) ? finded[i] : finded[i].nextSibling; +// this._insertBefore(finded[i].parentNode, nodes, refnode); +// } +// return count; +// }; +// +// XML.replaceNodes = function (context, xpathExp, nodes) { +// nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; +// var finded = this.eval(context, xpathExp); +// var count = finded.length; +// for (var i = 0; i < count; i++) { +// var refnode = finded[i]; +// var parent = refnode.parentNode; +// this._insertBefore(parent, nodes, refnode); +// parent.removeChild(refnode); +// } +// return count; +// }; +// +// XML.setNodeText = function (context, xpathExp, text) { +// var finded = this.eval(context, xpathExp, this.ResultType.single); +// if (finded === null) { +// return; +// } +// if (finded.nodeType == XML.Document.NodeType.ELEMENT) { +// var textNode = this.eval(finded, "./text()", this.ResultType.single); +// if (!textNode) { +// textNode = finded.ownerDocument.createTextNode(""); +// finded.appendChild(textNode); +// } +// textNode.nodeValue = text; +// } else { +// finded.nodeValue = text; +// } +// return; +// }; +// +// XML.getNodeText = function (context, xpathExp, defaultValue) { +// var finded = xpathExp ? this.eval(context, xpathExp, this.ResultType.single) : context; +// if (finded && (finded.nodeType == XML.Document.NodeType.ELEMENT)) { +// finded = this.eval(finded, "./text()", this.ResultType.single); +// } +// return (finded && finded.nodeValue) ? "" + finded.nodeValue : (defaultValue !== undefined) ? defaultValue : null; +// }; +// +// XML.Namespaces = { +// XMLSCHEMA: "http://www.w3.org/2001/XMLSchema#", +// XMLSCHEMA_STRING: "http://www.w3.org/2001/XMLSchema#String", +// XMLSCHEMA_LONG: "http://www.w3.org/2001/XMLSchema#Long", +// XMLSCHEMA_INTEGER: 'http://www.w3.org/2001/XMLSchema#Integer', +// XMLSCHEMA_FLOAT: 'http://www.w3.org/2001/XMLSchema#Float', +// XMLSCHEMA_DOUBLE: 'http://www.w3.org/2001/XMLSchema#Double', +// XMLSCHEMA_DECIMAL: 'http://www.w3.org/2001/XMLSchema#Decimal', +// XMLSCHEMA_DATE: 'http://www.w3.org/2001/XMLSchema#Date', +// XMLSCHEMA_TIME: 'http://www.w3.org/2001/XMLSchema#Time', +// XMLSCHEMA_DATETIME: 'http://www.w3.org/2001/XMLSchema#DateTime', +// XMLSCHEMA_BOOLEAN: 'http://www.w3.org/2001/XMLSchema#Boolean', +// XMLSCHEMA_SYMBOL: 'http://www.w3.org/2001/XMLSchema#Symbol', +// JUSTEPSCHEMA: "http://www.justep.com/xbiz#", +// RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#", +// JUSTEP: "http://www.justep.com/x5#", +// 'get': function (type) { +// type = type ? type.toLowerCase() : "string"; +// if ("string" == type) { +// return XML.Namespaces.XMLSCHEMA_STRING; +// } +// else if ("integer" == type) { +// return XML.Namespaces.XMLSCHEMA_INTEGER; +// } +// else if ("long" == type) { +// return XML.Namespaces.XMLSCHEMA_LONG; +// } +// else if ("float" == type) { +// return XML.Namespaces.XMLSCHEMA_FLOAT; +// } +// else if ("double" == type) { +// return XML.Namespaces.XMLSCHEMA_DOUBLE; +// } +// else if ("decimal" == type) { +// return XML.Namespaces.XMLSCHEMA_DECIMAL; +// } +// else if ("date" == type) { +// return XML.Namespaces.XMLSCHEMA_DATE; +// } +// else if ("time" == type) { +// return XML.Namespaces.XMLSCHEMA_TIME; +// } +// else if ("datetime" == type) { +// return XML.Namespaces.XMLSCHEMA_DATETIME; +// } +// else if ("boolean" == type) { +// return XML.Namespaces.XMLSCHEMA_BOOLEAN; +// } +// } +// }; +// })(BI); +BI.BehaviorFactory = { createBehavior: function(key, options){ var behavior; switch (key){ diff --git a/docs/polyfill.js b/docs/polyfill.js index f493c89a5..1bf548f0a 100644 --- a/docs/polyfill.js +++ b/docs/polyfill.js @@ -60,8 +60,23 @@ window.localStorage || (window.localStorage = { clear: function () { this.items = {}; } -});//修复ie9下sort方法的bug -!function (window) { +});if (typeof Set !== 'undefined' && Set.toString().match(/native code/)) { + +} else { + Set = function () { + this.set = {} + }; + Set.prototype.has = function (key) { + return this.set[key] !== undefined; + }; + Set.prototype.add = function (key) { + this.set[key] = 1 + }; + Set.prototype.clear = function () { + this.set = {} + }; +}//修复ie9下sort方法的bug +;!function (window) { var ua = window.navigator.userAgent.toLowerCase(), reg = /msie|applewebkit.+safari/; if (reg.test(ua)) { diff --git a/src/core/utils/lru.js b/src/core/utils/lru.js index dac7016d9..028a35adb 100644 --- a/src/core/utils/lru.js +++ b/src/core/utils/lru.js @@ -79,4 +79,8 @@ ? entry : entry.value }; + + p.has = function (key) { + return this._keymap[key] != null; + } })(); \ No newline at end of file diff --git a/src/core/utils/xml.js b/src/core/utils/xml.js index a8e9397ed..771a06a94 100644 --- a/src/core/utils/xml.js +++ b/src/core/utils/xml.js @@ -1,353 +1,353 @@ -; -!(function (BI) { - - if (BI.isIE()) { - XMLSerializer = null; - DOMParser = null; - } - - - var XML = { - Document: { - NodeType: { - ELEMENT: 1, - ATTRIBUTE: 2, - TEXT: 3, - CDATA_SECTION: 4, - ENTITY_REFERENCE: 5, - ENTITY: 6, - PROCESSING_INSTRUCTION: 7, - COMMENT: 8, - DOCUMENT: 9, - DOCUMENT_TYPE: 10, - DOCUMENT_FRAGMENT: 11, - NOTATION: 12 - } - } - }; - - XML.ResultType = { - single: 'single', - array: 'array' - }; - - XML.fromString = function (xmlStr) { - try { - var parser = new DOMParser(); - return parser.parseFromString(xmlStr, "text/xml"); - } catch (e) { - var arrMSXML = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0"]; - for (var i = 0; i < arrMSXML.length; i++) { - try { - var xmlDoc = new ActiveXObject(arrMSXML[i]); - xmlDoc.setProperty("SelectionLanguage", "XPath"); - xmlDoc.async = false; - xmlDoc.loadXML(xmlStr); - return xmlDoc; - } catch (xmlError) { - } - } - } - }; - - XML.toString = function (xmlNode) { - if (!BI.isIE()) { - var xmlSerializer = new XMLSerializer(); - return xmlSerializer.serializeToString(xmlNode); - } else - return xmlNode.xml; - }; - - XML.getNSResolver = function (str) { - if (!str) { - return null; - } - var list = str.split(' '); - var namespaces = {}; - for (var i = 0; i < list.length; i++) { - var pair = list[i].split('='); - var fix = BI.trim(pair[0]).replace("xmlns:", ""); - namespaces[fix] = BI.trim(pair[1]).replace(/"/g, "").replace(/'/g, ""); - } - return function (prefix) { - return namespaces[prefix]; - }; - }; - - XML.eval = function (context, xpathExp, resultType, namespaces) { - if ((BI.isIE() && ('undefined' === typeof(context.selectSingleNode) || 'undefined' === typeof(context.selectNodes)))) { - return XML.eval2(context, xpathExp, resultType, namespaces); - } else { - if (BI.isIE()) { - namespaces = namespaces ? namespaces : ""; - var doc = (context.nodeType == XML.Document.NodeType.DOCUMENT) ? context : context.ownerDocument; - doc.setProperty("SelectionNamespaces", namespaces); - var result; - if (resultType == this.ResultType.single) { - result = context.selectSingleNode(xpathExp); - } else { - result = context.selectNodes(xpathExp) || []; - } - doc.setProperty("SelectionNamespaces", ""); - return result; - } else { - var node = context; - var xmlDoc = (context.nodeName.indexOf("document") == -1) ? context.ownerDocument : context; - var retType = (resultType == this.ResultType.single) ? XPathResult.FIRST_ORDERED_NODE_TYPE : XPathResult.ANY_TYPE; - var col = xmlDoc.evaluate(xpathExp, node, XML.getNSResolver(namespaces), retType, null); - - if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE) { - return col.singleNodeValue; - } else { - var thisColMemb = col.iterateNext(); - var rowsCol = []; - while (thisColMemb) { - rowsCol[rowsCol.length] = thisColMemb; - thisColMemb = col.iterateNext(); - } - return rowsCol; - } - } - } - }; - - XML.eval2 = function (context, xpathExp, resultType, namespaces) { - if (resultType !== "single" && resultType !== undefined && resultType !== null) { - throw new Error("justep.SimpleXML.eval only be resultType='single', not" + resultType); - } - - if (context === null || context === undefined || xpathExp === null || xpathExp === undefined) { - return context; - } - - if (context.nodeType == XML.Document.NodeType.DOCUMENT) { - context = context.documentElement; - } - - var childs, i; - if (xpathExp.indexOf("/") != -1) { - var items = xpathExp.split("/"); - var isAbs = xpathExp.substring(0, 1) == "/"; - for (i = 0; i < items.length; i++) { - var item = items[i]; - if (item === "") { - continue; - } else { - var next = null; - var ii = i + 1; - for (; ii < items.length; ii++) { - if (next === null) { - next = items[ii]; - } else { - next = next + "/" + items[ii]; - } - } - - if (item == ".") { - return this.eval(context, next, resultType); - - } else if (item == "..") { - return this.eval2(context.parentNode, next, resultType); - - } else if (item == "*") { - if (isAbs) { - return this.eval2(context, next, resultType); - - } else { - childs = context.childNodes; - for (var j = 0; j < childs.length; j++) { - var tmp = this.eval2(childs[j], next, resultType); - if (tmp !== null) { - return tmp; - } - } - return null; - } - - } else { - if (isAbs) { - if (context.nodeName == item) { - return this.eval2(context, next, resultType); - } else { - return null; - } - } else { - var child = this.getChildByName(context, item); - if (child !== null) { - return this.eval2(child, next, resultType); - } else { - return null; - } - - } - } - - } - } - - return null; - - } else { - if ("text()" == xpathExp) { - childs = context.childNodes; - for (i = 0; i < childs.length; i++) { - if (childs[i].nodeType == XML.Document.NodeType.TEXT) { - return childs[i]; - } - } - return null; - } else { - return this.getChildByName(context, xpathExp); - } - } - }; - - XML.getChildByName = function (context, name) { - if (context === null || context === undefined || name === null || name === undefined) { - return null; - } - - if (context.nodeType == XML.Document.NodeType.DOCUMENT) { - context = context.documentElement; - } - - var childs = context.childNodes; - for (var i = 0; i < childs.length; i++) { - if (childs[i].nodeType == XML.Document.NodeType.ELEMENT && (childs[i].nodeName == name || name == "*")) { - return childs[i]; - } - } - - return null; - }; - - XML.appendChildren = function (context, xpathExp, nodes, isBefore) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - if (isBefore && finded[i].firstNode) { - this._insertBefore(finded[i], nodes, finded[i].firstNode); - } else { - for (var j = 0; j < nodes.length; j++) { - finded[i].appendChild(nodes[j]); - } - } - } - return count; - }; - - XML.removeNodes = function (context, xpathExp) { - var nodes = this.eval(context, xpathExp); - for (var i = 0; i < nodes.length; i++) { - nodes[i].parentNode.removeChild(nodes[i]); - } - }; - - XML._insertBefore = function (parent, newchildren, refchild) { - for (var i = 0; i < newchildren.length; i++) { - parent.insertBefore(newchildren[i], refchild); - } - }; - - XML.insertNodes = function (context, xpathExp, nodes, isBefore) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - var refnode = (isBefore) ? finded[i] : finded[i].nextSibling; - this._insertBefore(finded[i].parentNode, nodes, refnode); - } - return count; - }; - - XML.replaceNodes = function (context, xpathExp, nodes) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - var refnode = finded[i]; - var parent = refnode.parentNode; - this._insertBefore(parent, nodes, refnode); - parent.removeChild(refnode); - } - return count; - }; - - XML.setNodeText = function (context, xpathExp, text) { - var finded = this.eval(context, xpathExp, this.ResultType.single); - if (finded === null) { - return; - } - if (finded.nodeType == XML.Document.NodeType.ELEMENT) { - var textNode = this.eval(finded, "./text()", this.ResultType.single); - if (!textNode) { - textNode = finded.ownerDocument.createTextNode(""); - finded.appendChild(textNode); - } - textNode.nodeValue = text; - } else { - finded.nodeValue = text; - } - return; - }; - - XML.getNodeText = function (context, xpathExp, defaultValue) { - var finded = xpathExp ? this.eval(context, xpathExp, this.ResultType.single) : context; - if (finded && (finded.nodeType == XML.Document.NodeType.ELEMENT)) { - finded = this.eval(finded, "./text()", this.ResultType.single); - } - return (finded && finded.nodeValue) ? "" + finded.nodeValue : (defaultValue !== undefined) ? defaultValue : null; - }; - - XML.Namespaces = { - XMLSCHEMA: "http://www.w3.org/2001/XMLSchema#", - XMLSCHEMA_STRING: "http://www.w3.org/2001/XMLSchema#String", - XMLSCHEMA_LONG: "http://www.w3.org/2001/XMLSchema#Long", - XMLSCHEMA_INTEGER: 'http://www.w3.org/2001/XMLSchema#Integer', - XMLSCHEMA_FLOAT: 'http://www.w3.org/2001/XMLSchema#Float', - XMLSCHEMA_DOUBLE: 'http://www.w3.org/2001/XMLSchema#Double', - XMLSCHEMA_DECIMAL: 'http://www.w3.org/2001/XMLSchema#Decimal', - XMLSCHEMA_DATE: 'http://www.w3.org/2001/XMLSchema#Date', - XMLSCHEMA_TIME: 'http://www.w3.org/2001/XMLSchema#Time', - XMLSCHEMA_DATETIME: 'http://www.w3.org/2001/XMLSchema#DateTime', - XMLSCHEMA_BOOLEAN: 'http://www.w3.org/2001/XMLSchema#Boolean', - XMLSCHEMA_SYMBOL: 'http://www.w3.org/2001/XMLSchema#Symbol', - JUSTEPSCHEMA: "http://www.justep.com/xbiz#", - RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - JUSTEP: "http://www.justep.com/x5#", - 'get': function (type) { - type = type ? type.toLowerCase() : "string"; - if ("string" == type) { - return XML.Namespaces.XMLSCHEMA_STRING; - } - else if ("integer" == type) { - return XML.Namespaces.XMLSCHEMA_INTEGER; - } - else if ("long" == type) { - return XML.Namespaces.XMLSCHEMA_LONG; - } - else if ("float" == type) { - return XML.Namespaces.XMLSCHEMA_FLOAT; - } - else if ("double" == type) { - return XML.Namespaces.XMLSCHEMA_DOUBLE; - } - else if ("decimal" == type) { - return XML.Namespaces.XMLSCHEMA_DECIMAL; - } - else if ("date" == type) { - return XML.Namespaces.XMLSCHEMA_DATE; - } - else if ("time" == type) { - return XML.Namespaces.XMLSCHEMA_TIME; - } - else if ("datetime" == type) { - return XML.Namespaces.XMLSCHEMA_DATETIME; - } - else if ("boolean" == type) { - return XML.Namespaces.XMLSCHEMA_BOOLEAN; - } - } - }; -})(BI); \ No newline at end of file +// ; +// !(function (BI) { +// +// if (BI.isIE()) { +// XMLSerializer = null; +// DOMParser = null; +// } +// +// +// var XML = { +// Document: { +// NodeType: { +// ELEMENT: 1, +// ATTRIBUTE: 2, +// TEXT: 3, +// CDATA_SECTION: 4, +// ENTITY_REFERENCE: 5, +// ENTITY: 6, +// PROCESSING_INSTRUCTION: 7, +// COMMENT: 8, +// DOCUMENT: 9, +// DOCUMENT_TYPE: 10, +// DOCUMENT_FRAGMENT: 11, +// NOTATION: 12 +// } +// } +// }; +// +// XML.ResultType = { +// single: 'single', +// array: 'array' +// }; +// +// XML.fromString = function (xmlStr) { +// try { +// var parser = new DOMParser(); +// return parser.parseFromString(xmlStr, "text/xml"); +// } catch (e) { +// var arrMSXML = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0"]; +// for (var i = 0; i < arrMSXML.length; i++) { +// try { +// var xmlDoc = new ActiveXObject(arrMSXML[i]); +// xmlDoc.setProperty("SelectionLanguage", "XPath"); +// xmlDoc.async = false; +// xmlDoc.loadXML(xmlStr); +// return xmlDoc; +// } catch (xmlError) { +// } +// } +// } +// }; +// +// XML.toString = function (xmlNode) { +// if (!BI.isIE()) { +// var xmlSerializer = new XMLSerializer(); +// return xmlSerializer.serializeToString(xmlNode); +// } else +// return xmlNode.xml; +// }; +// +// XML.getNSResolver = function (str) { +// if (!str) { +// return null; +// } +// var list = str.split(' '); +// var namespaces = {}; +// for (var i = 0; i < list.length; i++) { +// var pair = list[i].split('='); +// var fix = BI.trim(pair[0]).replace("xmlns:", ""); +// namespaces[fix] = BI.trim(pair[1]).replace(/"/g, "").replace(/'/g, ""); +// } +// return function (prefix) { +// return namespaces[prefix]; +// }; +// }; +// +// XML.eval = function (context, xpathExp, resultType, namespaces) { +// if ((BI.isIE() && ('undefined' === typeof(context.selectSingleNode) || 'undefined' === typeof(context.selectNodes)))) { +// return XML.eval2(context, xpathExp, resultType, namespaces); +// } else { +// if (BI.isIE()) { +// namespaces = namespaces ? namespaces : ""; +// var doc = (context.nodeType == XML.Document.NodeType.DOCUMENT) ? context : context.ownerDocument; +// doc.setProperty("SelectionNamespaces", namespaces); +// var result; +// if (resultType == this.ResultType.single) { +// result = context.selectSingleNode(xpathExp); +// } else { +// result = context.selectNodes(xpathExp) || []; +// } +// doc.setProperty("SelectionNamespaces", ""); +// return result; +// } else { +// var node = context; +// var xmlDoc = (context.nodeName.indexOf("document") == -1) ? context.ownerDocument : context; +// var retType = (resultType == this.ResultType.single) ? XPathResult.FIRST_ORDERED_NODE_TYPE : XPathResult.ANY_TYPE; +// var col = xmlDoc.evaluate(xpathExp, node, XML.getNSResolver(namespaces), retType, null); +// +// if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE) { +// return col.singleNodeValue; +// } else { +// var thisColMemb = col.iterateNext(); +// var rowsCol = []; +// while (thisColMemb) { +// rowsCol[rowsCol.length] = thisColMemb; +// thisColMemb = col.iterateNext(); +// } +// return rowsCol; +// } +// } +// } +// }; +// +// XML.eval2 = function (context, xpathExp, resultType, namespaces) { +// if (resultType !== "single" && resultType !== undefined && resultType !== null) { +// throw new Error("justep.SimpleXML.eval only be resultType='single', not" + resultType); +// } +// +// if (context === null || context === undefined || xpathExp === null || xpathExp === undefined) { +// return context; +// } +// +// if (context.nodeType == XML.Document.NodeType.DOCUMENT) { +// context = context.documentElement; +// } +// +// var childs, i; +// if (xpathExp.indexOf("/") != -1) { +// var items = xpathExp.split("/"); +// var isAbs = xpathExp.substring(0, 1) == "/"; +// for (i = 0; i < items.length; i++) { +// var item = items[i]; +// if (item === "") { +// continue; +// } else { +// var next = null; +// var ii = i + 1; +// for (; ii < items.length; ii++) { +// if (next === null) { +// next = items[ii]; +// } else { +// next = next + "/" + items[ii]; +// } +// } +// +// if (item == ".") { +// return this.eval(context, next, resultType); +// +// } else if (item == "..") { +// return this.eval2(context.parentNode, next, resultType); +// +// } else if (item == "*") { +// if (isAbs) { +// return this.eval2(context, next, resultType); +// +// } else { +// childs = context.childNodes; +// for (var j = 0; j < childs.length; j++) { +// var tmp = this.eval2(childs[j], next, resultType); +// if (tmp !== null) { +// return tmp; +// } +// } +// return null; +// } +// +// } else { +// if (isAbs) { +// if (context.nodeName == item) { +// return this.eval2(context, next, resultType); +// } else { +// return null; +// } +// } else { +// var child = this.getChildByName(context, item); +// if (child !== null) { +// return this.eval2(child, next, resultType); +// } else { +// return null; +// } +// +// } +// } +// +// } +// } +// +// return null; +// +// } else { +// if ("text()" == xpathExp) { +// childs = context.childNodes; +// for (i = 0; i < childs.length; i++) { +// if (childs[i].nodeType == XML.Document.NodeType.TEXT) { +// return childs[i]; +// } +// } +// return null; +// } else { +// return this.getChildByName(context, xpathExp); +// } +// } +// }; +// +// XML.getChildByName = function (context, name) { +// if (context === null || context === undefined || name === null || name === undefined) { +// return null; +// } +// +// if (context.nodeType == XML.Document.NodeType.DOCUMENT) { +// context = context.documentElement; +// } +// +// var childs = context.childNodes; +// for (var i = 0; i < childs.length; i++) { +// if (childs[i].nodeType == XML.Document.NodeType.ELEMENT && (childs[i].nodeName == name || name == "*")) { +// return childs[i]; +// } +// } +// +// return null; +// }; +// +// XML.appendChildren = function (context, xpathExp, nodes, isBefore) { +// nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; +// var finded = this.eval(context, xpathExp); +// var count = finded.length; +// for (var i = 0; i < count; i++) { +// if (isBefore && finded[i].firstNode) { +// this._insertBefore(finded[i], nodes, finded[i].firstNode); +// } else { +// for (var j = 0; j < nodes.length; j++) { +// finded[i].appendChild(nodes[j]); +// } +// } +// } +// return count; +// }; +// +// XML.removeNodes = function (context, xpathExp) { +// var nodes = this.eval(context, xpathExp); +// for (var i = 0; i < nodes.length; i++) { +// nodes[i].parentNode.removeChild(nodes[i]); +// } +// }; +// +// XML._insertBefore = function (parent, newchildren, refchild) { +// for (var i = 0; i < newchildren.length; i++) { +// parent.insertBefore(newchildren[i], refchild); +// } +// }; +// +// XML.insertNodes = function (context, xpathExp, nodes, isBefore) { +// nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; +// var finded = this.eval(context, xpathExp); +// var count = finded.length; +// for (var i = 0; i < count; i++) { +// var refnode = (isBefore) ? finded[i] : finded[i].nextSibling; +// this._insertBefore(finded[i].parentNode, nodes, refnode); +// } +// return count; +// }; +// +// XML.replaceNodes = function (context, xpathExp, nodes) { +// nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; +// var finded = this.eval(context, xpathExp); +// var count = finded.length; +// for (var i = 0; i < count; i++) { +// var refnode = finded[i]; +// var parent = refnode.parentNode; +// this._insertBefore(parent, nodes, refnode); +// parent.removeChild(refnode); +// } +// return count; +// }; +// +// XML.setNodeText = function (context, xpathExp, text) { +// var finded = this.eval(context, xpathExp, this.ResultType.single); +// if (finded === null) { +// return; +// } +// if (finded.nodeType == XML.Document.NodeType.ELEMENT) { +// var textNode = this.eval(finded, "./text()", this.ResultType.single); +// if (!textNode) { +// textNode = finded.ownerDocument.createTextNode(""); +// finded.appendChild(textNode); +// } +// textNode.nodeValue = text; +// } else { +// finded.nodeValue = text; +// } +// return; +// }; +// +// XML.getNodeText = function (context, xpathExp, defaultValue) { +// var finded = xpathExp ? this.eval(context, xpathExp, this.ResultType.single) : context; +// if (finded && (finded.nodeType == XML.Document.NodeType.ELEMENT)) { +// finded = this.eval(finded, "./text()", this.ResultType.single); +// } +// return (finded && finded.nodeValue) ? "" + finded.nodeValue : (defaultValue !== undefined) ? defaultValue : null; +// }; +// +// XML.Namespaces = { +// XMLSCHEMA: "http://www.w3.org/2001/XMLSchema#", +// XMLSCHEMA_STRING: "http://www.w3.org/2001/XMLSchema#String", +// XMLSCHEMA_LONG: "http://www.w3.org/2001/XMLSchema#Long", +// XMLSCHEMA_INTEGER: 'http://www.w3.org/2001/XMLSchema#Integer', +// XMLSCHEMA_FLOAT: 'http://www.w3.org/2001/XMLSchema#Float', +// XMLSCHEMA_DOUBLE: 'http://www.w3.org/2001/XMLSchema#Double', +// XMLSCHEMA_DECIMAL: 'http://www.w3.org/2001/XMLSchema#Decimal', +// XMLSCHEMA_DATE: 'http://www.w3.org/2001/XMLSchema#Date', +// XMLSCHEMA_TIME: 'http://www.w3.org/2001/XMLSchema#Time', +// XMLSCHEMA_DATETIME: 'http://www.w3.org/2001/XMLSchema#DateTime', +// XMLSCHEMA_BOOLEAN: 'http://www.w3.org/2001/XMLSchema#Boolean', +// XMLSCHEMA_SYMBOL: 'http://www.w3.org/2001/XMLSchema#Symbol', +// JUSTEPSCHEMA: "http://www.justep.com/xbiz#", +// RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#", +// JUSTEP: "http://www.justep.com/x5#", +// 'get': function (type) { +// type = type ? type.toLowerCase() : "string"; +// if ("string" == type) { +// return XML.Namespaces.XMLSCHEMA_STRING; +// } +// else if ("integer" == type) { +// return XML.Namespaces.XMLSCHEMA_INTEGER; +// } +// else if ("long" == type) { +// return XML.Namespaces.XMLSCHEMA_LONG; +// } +// else if ("float" == type) { +// return XML.Namespaces.XMLSCHEMA_FLOAT; +// } +// else if ("double" == type) { +// return XML.Namespaces.XMLSCHEMA_DOUBLE; +// } +// else if ("decimal" == type) { +// return XML.Namespaces.XMLSCHEMA_DECIMAL; +// } +// else if ("date" == type) { +// return XML.Namespaces.XMLSCHEMA_DATE; +// } +// else if ("time" == type) { +// return XML.Namespaces.XMLSCHEMA_TIME; +// } +// else if ("datetime" == type) { +// return XML.Namespaces.XMLSCHEMA_DATETIME; +// } +// else if ("boolean" == type) { +// return XML.Namespaces.XMLSCHEMA_BOOLEAN; +// } +// } +// }; +// })(BI); diff --git a/src/core/utils/set.js b/src/polyfill/set.js similarity index 100% rename from src/core/utils/set.js rename to src/polyfill/set.js diff --git a/src/polyfill/sort.js b/src/polyfill/sort.js index 6ad73ba9c..c2581f68a 100644 --- a/src/polyfill/sort.js +++ b/src/polyfill/sort.js @@ -1,5 +1,5 @@ //修复ie9下sort方法的bug -!function (window) { +;!function (window) { var ua = window.navigator.userAgent.toLowerCase(), reg = /msie|applewebkit.+safari/; if (reg.test(ua)) { From 7756bae9759313903fb77823c12ef8b31abc3d2f Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 17 Aug 2017 16:06:41 +0800 Subject: [PATCH 07/10] add --- bi/base.js | 518 +++++++++++++++++++++++++-------------------------- docs/base.js | 518 +++++++++++++++++++++++++-------------------------- 2 files changed, 518 insertions(+), 518 deletions(-) diff --git a/bi/base.js b/bi/base.js index 3cc5e306d..00175165d 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 @@ -922,82 +922,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 @@ -20297,32 +20297,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/base.js b/docs/base.js index 3cc5e306d..00175165d 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 @@ -922,82 +922,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 @@ -20297,32 +20297,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"); From f1fad2ab01b11fa41d573ee77b1343552ddeaaab Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Fri, 18 Aug 2017 16:09:55 +0800 Subject: [PATCH 08/10] =?UTF-8?q?basicButton=20enable=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bi/base.js | 521 +++++++++++++------------ docs/base.js | 521 +++++++++++++------------ src/base/single/button/button.basic.js | 3 + 3 files changed, 527 insertions(+), 518 deletions(-) diff --git a/bi/base.js b/bi/base.js index 00175165d..2660cc3ac 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 @@ -807,6 +807,9 @@ BI.BasicButton = BI.inherit(BI.Single, { _trigger: function () { var o = this.options; + if(!this.isEnabled()){ + return; + } if (!this.isDisableSelected()) { this.isForceSelected() ? this.setSelected(true) : (this.isForceNotSelected() ? this.setSelected(false) : @@ -922,82 +925,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 @@ -20297,32 +20300,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/base.js b/docs/base.js index 00175165d..2660cc3ac 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 @@ -807,6 +807,9 @@ BI.BasicButton = BI.inherit(BI.Single, { _trigger: function () { var o = this.options; + if(!this.isEnabled()){ + return; + } if (!this.isDisableSelected()) { this.isForceSelected() ? this.setSelected(true) : (this.isForceNotSelected() ? this.setSelected(false) : @@ -922,82 +925,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 @@ -20297,32 +20300,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/src/base/single/button/button.basic.js b/src/base/single/button/button.basic.js index 919325d51..3d62b80f0 100644 --- a/src/base/single/button/button.basic.js +++ b/src/base/single/button/button.basic.js @@ -220,6 +220,9 @@ BI.BasicButton = BI.inherit(BI.Single, { _trigger: function () { var o = this.options; + if(!this.isEnabled()){ + return; + } if (!this.isDisableSelected()) { this.isForceSelected() ? this.setSelected(true) : (this.isForceNotSelected() ? this.setSelected(false) : From d3146491e5f3e1e9bceabe21bd0c28405b53a9ff Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 22 Aug 2017 15:33:38 +0800 Subject: [PATCH 09/10] add --- bi/widget.js | 6 ------ docs/widget.js | 6 ------ src/widget/sequencetable/sequencetable.js | 6 ------ 3 files changed, 18 deletions(-) diff --git a/bi/widget.js b/bi/widget.js index 8486ebdf1..2812c570b 100644 --- a/bi/widget.js +++ b/bi/widget.js @@ -14633,12 +14633,6 @@ BI.SequenceTable = BI.inherit(BI.Widget, { _populate: function () { var o = this.options; - this.sequence.attr({ - items: o.items, - header: o.header, - crossItems: o.crossItems, - crossHeader: o.crossHeader - }); if (o.showSequence === true) { this.sequence.setVisible(true); this.table.element.css("left", "60px"); diff --git a/docs/widget.js b/docs/widget.js index 8486ebdf1..2812c570b 100644 --- a/docs/widget.js +++ b/docs/widget.js @@ -14633,12 +14633,6 @@ BI.SequenceTable = BI.inherit(BI.Widget, { _populate: function () { var o = this.options; - this.sequence.attr({ - items: o.items, - header: o.header, - crossItems: o.crossItems, - crossHeader: o.crossHeader - }); if (o.showSequence === true) { this.sequence.setVisible(true); this.table.element.css("left", "60px"); diff --git a/src/widget/sequencetable/sequencetable.js b/src/widget/sequencetable/sequencetable.js index 52adfdd93..1b6380042 100644 --- a/src/widget/sequencetable/sequencetable.js +++ b/src/widget/sequencetable/sequencetable.js @@ -141,12 +141,6 @@ BI.SequenceTable = BI.inherit(BI.Widget, { _populate: function () { var o = this.options; - this.sequence.attr({ - items: o.items, - header: o.header, - crossItems: o.crossItems, - crossHeader: o.crossHeader - }); if (o.showSequence === true) { this.sequence.setVisible(true); this.table.element.css("left", "60px"); From e77a0c5f9490dec40d0be2289ae8c54121bc7542 Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 22 Aug 2017 15:34:02 +0800 Subject: [PATCH 10/10] add --- bi/base.js | 518 +++++++++++++++++++++++++-------------------------- docs/base.js | 518 +++++++++++++++++++++++++-------------------------- 2 files changed, 518 insertions(+), 518 deletions(-) diff --git a/bi/base.js b/bi/base.js index 2660cc3ac..13c386850 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 @@ -925,82 +925,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 @@ -20300,32 +20300,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/base.js b/docs/base.js index 2660cc3ac..13c386850 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 @@ -925,82 +925,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 @@ -20300,32 +20300,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");