diff --git a/bi/base.css b/bi/base.css index e304763622..1e6e4b8f4c 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/bi/base.js b/bi/base.js index 7e2f494d72..13c386850e 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,14 +519,31 @@ 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); } @@ -803,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) : @@ -1516,7 +1523,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({ @@ -1529,7 +1535,7 @@ BI.TreeView = BI.inherit(BI.Pane, { scrollable: true, scrolly: false, element: this, - items: [this.container, this.tip] + items: [this.tip] }); }, @@ -1548,7 +1554,7 @@ BI.TreeView = BI.inherit(BI.Pane, { }); BI.createWidget({ type: "bi.default", - element: this.container, + element: this.element, items: [this.tree] }); }, @@ -1943,6 +1949,7 @@ BI.TreeView = BI.inherit(BI.Pane, { setNode(child.children); }); } + BI.each(this.nodes.getNodes(), function (i, node) { node.halfCheck = false; setNode(node.children); @@ -16341,9 +16348,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({ @@ -16396,8 +16403,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/bi/core.js b/bi/core.js index 219e5e21e9..ab4d1a5eb6 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 f493c89a5e..1bf548f0aa 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/bi/widget.js b/bi/widget.js index 9799dd01a7..2812c570b4 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 }] }); }, @@ -14632,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/base.css b/docs/base.css index e304763622..1e6e4b8f4c 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/docs/base.js b/docs/base.js index 7e2f494d72..13c386850e 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,14 +519,31 @@ 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); } @@ -803,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) : @@ -1516,7 +1523,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({ @@ -1529,7 +1535,7 @@ BI.TreeView = BI.inherit(BI.Pane, { scrollable: true, scrolly: false, element: this, - items: [this.container, this.tip] + items: [this.tip] }); }, @@ -1548,7 +1554,7 @@ BI.TreeView = BI.inherit(BI.Pane, { }); BI.createWidget({ type: "bi.default", - element: this.container, + element: this.element, items: [this.tree] }); }, @@ -1943,6 +1949,7 @@ BI.TreeView = BI.inherit(BI.Pane, { setNode(child.children); }); } + BI.each(this.nodes.getNodes(), function (i, node) { node.halfCheck = false; setNode(node.children); @@ -16341,9 +16348,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({ @@ -16396,8 +16403,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/core.js b/docs/core.js index 1c727cb83a..cf66ba0afa 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 f493c89a5e..1bf548f0aa 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/docs/widget.js b/docs/widget.js index 9799dd01a7..2812c570b4 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 }] }); }, @@ -14632,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/base/single/button/button.basic.js b/src/base/single/button/button.basic.js index 919325d512..3d62b80f05 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) : diff --git a/src/base/single/button/buttons/button.js b/src/base/single/button/buttons/button.js index 9e02af0481..f5450b38f2 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 12efd184a9..4efe5143b3 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,14 +52,31 @@ 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); } diff --git a/src/base/tree/treeview.js b/src/base/tree/treeview.js index 6ada95083e..118a65088d 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); diff --git a/src/core/utils/lru.js b/src/core/utils/lru.js index dac7016d93..028a35adb1 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 a8e9397ed2..771a06a94b 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/css/base/single/text.css b/src/css/base/single/text.css index 69603a5a61..b8bc83e730 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 a6f1d83cd4..fa6594810b 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 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 6ad73ba9c8..c2581f68ae 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)) { diff --git a/src/widget/finetuningnumbereditor/finetuning.number.editor.js b/src/widget/finetuningnumbereditor/finetuning.number.editor.js index f1832685d9..af85023710 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 }] }); }, diff --git a/src/widget/sequencetable/sequencetable.js b/src/widget/sequencetable/sequencetable.js index 52adfdd93d..1b63800426 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");