Browse Source

Merge pull request #70 in FUI/fineui from ~GUY/fineui:master to master

* commit 'e77a0c5f9490dec40d0be2289ae8c54121bc7542':
  add
  add
  basicButton enable处理
  add
  add
  尺寸更改
  ad
  add
  add
  add
master
guy 7 years ago
parent
commit
86fa2ca171
  1. 8
      bi/base.css
  2. 75
      bi/base.js
  3. 728
      bi/core.js
  4. 19
      bi/polyfill.js
  5. 9
      bi/widget.js
  6. 8
      docs/base.css
  7. 75
      docs/base.js
  8. 728
      docs/core.js
  9. 19
      docs/polyfill.js
  10. 9
      docs/widget.js
  11. 3
      src/base/single/button/button.basic.js
  12. 8
      src/base/single/button/buttons/button.js
  13. 58
      src/base/single/text.js
  14. 6
      src/base/tree/treeview.js
  15. 4
      src/core/utils/lru.js
  16. 706
      src/core/utils/xml.js
  17. 8
      src/css/base/single/text.css
  18. 1
      src/less/base/single/text.less
  19. 0
      src/polyfill/set.js
  20. 2
      src/polyfill/sort.js
  21. 3
      src/widget/finetuningnumbereditor/finetuning.number.editor.js
  22. 6
      src/widget/sequencetable/sequencetable.js

8
bi/base.css

@ -873,6 +873,14 @@ li.CodeMirror-hint-active {
overflow-x: hidden; overflow-x: hidden;
overflow-y: hidden; overflow-y: hidden;
white-space: nowrap; 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; word-break: break-word;
} }
.bi-bubble { .bi-bubble {

75
bi/base.js

@ -478,6 +478,7 @@ BI.Text = BI.inherit(BI.Single, {
textAlign: "left", textAlign: "left",
whiteSpace: "normal", whiteSpace: "normal",
lineHeight: null, lineHeight: null,
handler: null,//如果传入handler,表示处理文字的点击事件,不是区域的
hgap: 0, hgap: 0,
vgap: 0, vgap: 0,
lgap: 0, lgap: 0,
@ -491,39 +492,25 @@ BI.Text = BI.inherit(BI.Single, {
_init: function () { _init: function () {
BI.Text.superclass._init.apply(this, arguments); BI.Text.superclass._init.apply(this, arguments);
var o = this.options; var self = this, 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);
}
if (o.hgap + o.lgap > 0) { if (o.hgap + o.lgap > 0) {
this.text.element.css({ this.element.css({
"margin-left": o.hgap + o.lgap + "px" "padding-left": o.hgap + o.lgap + "px"
}) })
} }
if (o.hgap + o.rgap > 0) { if (o.hgap + o.rgap > 0) {
this.text.element.css({ this.element.css({
"margin-right": o.hgap + o.rgap + "px" "padding-right": o.hgap + o.rgap + "px"
}) })
} }
if (o.vgap + o.tgap > 0) { if (o.vgap + o.tgap > 0) {
this.text.element.css({ this.element.css({
"margin-top": o.vgap + o.tgap + "px" "padding-top": o.vgap + o.tgap + "px"
}) })
} }
if (o.vgap + o.bgap > 0) { if (o.vgap + o.bgap > 0) {
this.text.element.css({ this.element.css({
"margin-bottom": o.vgap + o.bgap + "px" "padding-bottom": o.vgap + o.bgap + "px"
}) })
} }
if (BI.isNumber(o.height)) { if (BI.isNumber(o.height)) {
@ -532,14 +519,31 @@ BI.Text = BI.inherit(BI.Single, {
if (BI.isNumber(o.lineHeight)) { if (BI.isNumber(o.lineHeight)) {
this.element.css({"lineHeight": o.lineHeight + "px"}); this.element.css({"lineHeight": o.lineHeight + "px"});
} }
this.text.element.css({
"textAlign": o.textAlign,
"whiteSpace": o.whiteSpace
});
this.element.css({ this.element.css({
"textAlign": o.textAlign, "textAlign": o.textAlign,
"whiteSpace": o.whiteSpace "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)) { if (BI.isKey(o.keyword)) {
this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py);
} }
@ -803,6 +807,9 @@ BI.BasicButton = BI.inherit(BI.Single, {
_trigger: function () { _trigger: function () {
var o = this.options; var o = this.options;
if(!this.isEnabled()){
return;
}
if (!this.isDisableSelected()) { if (!this.isDisableSelected()) {
this.isForceSelected() ? this.setSelected(true) : this.isForceSelected() ? this.setSelected(true) :
(this.isForceNotSelected() ? this.setSelected(false) : (this.isForceNotSelected() ? this.setSelected(false) :
@ -1516,7 +1523,6 @@ BI.TreeView = BI.inherit(BI.Pane, {
_init: function () { _init: function () {
BI.TreeView.superclass._init.apply(this, arguments); BI.TreeView.superclass._init.apply(this, arguments);
this._stop = false; this._stop = false;
this.container = BI.createWidget();
this._createTree(); this._createTree();
this.tip = BI.createWidget({ this.tip = BI.createWidget({
@ -1529,7 +1535,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
scrollable: true, scrollable: true,
scrolly: false, scrolly: false,
element: this, element: this,
items: [this.container, this.tip] items: [this.tip]
}); });
}, },
@ -1548,7 +1554,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
}); });
BI.createWidget({ BI.createWidget({
type: "bi.default", type: "bi.default",
element: this.container, element: this.element,
items: [this.tree] items: [this.tree]
}); });
}, },
@ -1943,6 +1949,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
setNode(child.children); setNode(child.children);
}); });
} }
BI.each(this.nodes.getNodes(), function (i, node) { BI.each(this.nodes.getNodes(), function (i, node) {
node.halfCheck = false; node.halfCheck = false;
setNode(node.children); setNode(node.children);
@ -16341,9 +16348,9 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) {
BI.Button.superclass._init.apply(this, arguments); BI.Button.superclass._init.apply(this, arguments);
var o = this.options, self = this; var o = this.options, self = this;
if (BI.isNumber(o.height) && !o.clear && !o.block) { 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 { } else {
this.element.css({lineHeight: o.height + 'px'}); this.element.css({lineHeight: o.height + "px"});
} }
if (BI.isKey(o.iconClass)) { if (BI.isKey(o.iconClass)) {
this.icon = BI.createWidget({ this.icon = BI.createWidget({
@ -16396,8 +16403,8 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) {
if (o.clear === true) { if (o.clear === true) {
this.element.addClass("clear"); this.element.addClass("clear");
} }
if (o.minWidth > 2) { if (o.minWidth > 0) {
this.element.css({"min-width": o.minWidth - 2 + "px"}); this.element.css({"min-width": o.minWidth + "px"});
} }
}, },

728
bi/core.js

@ -9348,6 +9348,10 @@ $.extend(BI, {
? entry ? entry
: entry.value : entry.value
}; };
p.has = function (key) {
return this._keymap[key] != null;
}
})();; })();;
!(function () { !(function () {
var MD5 = function (hexcase) { 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 () { (function () {
var clamp = function (value, min, max) { var clamp = function (value, min, max) {
if (value < min) { if (value < min) {
@ -10656,359 +10645,360 @@ BI.Region.prototype = {
pos.push(this.y + this.h / 2); pos.push(this.y + this.h / 2);
return pos; return pos;
} }
};; };// ;
!(function (BI) { // !(function (BI) {
//
if (BI.isIE()) { // if (BI.isIE()) {
XMLSerializer = null; // XMLSerializer = null;
DOMParser = null; // DOMParser = null;
} // }
//
//
var XML = { // var XML = {
Document: { // Document: {
NodeType: { // NodeType: {
ELEMENT: 1, // ELEMENT: 1,
ATTRIBUTE: 2, // ATTRIBUTE: 2,
TEXT: 3, // TEXT: 3,
CDATA_SECTION: 4, // CDATA_SECTION: 4,
ENTITY_REFERENCE: 5, // ENTITY_REFERENCE: 5,
ENTITY: 6, // ENTITY: 6,
PROCESSING_INSTRUCTION: 7, // PROCESSING_INSTRUCTION: 7,
COMMENT: 8, // COMMENT: 8,
DOCUMENT: 9, // DOCUMENT: 9,
DOCUMENT_TYPE: 10, // DOCUMENT_TYPE: 10,
DOCUMENT_FRAGMENT: 11, // DOCUMENT_FRAGMENT: 11,
NOTATION: 12 // NOTATION: 12
} // }
} // }
}; // };
//
XML.ResultType = { // XML.ResultType = {
single: 'single', // single: 'single',
array: 'array' // array: 'array'
}; // };
//
XML.fromString = function (xmlStr) { // XML.fromString = function (xmlStr) {
try { // try {
var parser = new DOMParser(); // var parser = new DOMParser();
return parser.parseFromString(xmlStr, "text/xml"); // return parser.parseFromString(xmlStr, "text/xml");
} catch (e) { // } catch (e) {
var arrMSXML = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0"]; // var arrMSXML = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0"];
for (var i = 0; i < arrMSXML.length; i++) { // for (var i = 0; i < arrMSXML.length; i++) {
try { // try {
var xmlDoc = new ActiveXObject(arrMSXML[i]); // var xmlDoc = new ActiveXObject(arrMSXML[i]);
xmlDoc.setProperty("SelectionLanguage", "XPath"); // xmlDoc.setProperty("SelectionLanguage", "XPath");
xmlDoc.async = false; // xmlDoc.async = false;
xmlDoc.loadXML(xmlStr); // xmlDoc.loadXML(xmlStr);
return xmlDoc; // return xmlDoc;
} catch (xmlError) { // } catch (xmlError) {
} // }
} // }
} // }
}; // };
//
XML.toString = function (xmlNode) { // XML.toString = function (xmlNode) {
if (!BI.isIE()) { // if (!BI.isIE()) {
var xmlSerializer = new XMLSerializer(); // var xmlSerializer = new XMLSerializer();
return xmlSerializer.serializeToString(xmlNode); // return xmlSerializer.serializeToString(xmlNode);
} else // } else
return xmlNode.xml; // return xmlNode.xml;
}; // };
//
XML.getNSResolver = function (str) { // XML.getNSResolver = function (str) {
if (!str) { // if (!str) {
return null; // return null;
} // }
var list = str.split(' '); // var list = str.split(' ');
var namespaces = {}; // var namespaces = {};
for (var i = 0; i < list.length; i++) { // for (var i = 0; i < list.length; i++) {
var pair = list[i].split('='); // var pair = list[i].split('=');
var fix = BI.trim(pair[0]).replace("xmlns:", ""); // var fix = BI.trim(pair[0]).replace("xmlns:", "");
namespaces[fix] = BI.trim(pair[1]).replace(/"/g, "").replace(/'/g, ""); // namespaces[fix] = BI.trim(pair[1]).replace(/"/g, "").replace(/'/g, "");
} // }
return function (prefix) { // return function (prefix) {
return namespaces[prefix]; // return namespaces[prefix];
}; // };
}; // };
//
XML.eval = function (context, xpathExp, resultType, namespaces) { // XML.eval = function (context, xpathExp, resultType, namespaces) {
if ((BI.isIE() && ('undefined' === typeof(context.selectSingleNode) || 'undefined' === typeof(context.selectNodes)))) { // if ((BI.isIE() && ('undefined' === typeof(context.selectSingleNode) || 'undefined' === typeof(context.selectNodes)))) {
return XML.eval2(context, xpathExp, resultType, namespaces); // return XML.eval2(context, xpathExp, resultType, namespaces);
} else { // } else {
if (BI.isIE()) { // if (BI.isIE()) {
namespaces = namespaces ? namespaces : ""; // namespaces = namespaces ? namespaces : "";
var doc = (context.nodeType == XML.Document.NodeType.DOCUMENT) ? context : context.ownerDocument; // var doc = (context.nodeType == XML.Document.NodeType.DOCUMENT) ? context : context.ownerDocument;
doc.setProperty("SelectionNamespaces", namespaces); // doc.setProperty("SelectionNamespaces", namespaces);
var result; // var result;
if (resultType == this.ResultType.single) { // if (resultType == this.ResultType.single) {
result = context.selectSingleNode(xpathExp); // result = context.selectSingleNode(xpathExp);
} else { // } else {
result = context.selectNodes(xpathExp) || []; // result = context.selectNodes(xpathExp) || [];
} // }
doc.setProperty("SelectionNamespaces", ""); // doc.setProperty("SelectionNamespaces", "");
return result; // return result;
} else { // } else {
var node = context; // var node = context;
var xmlDoc = (context.nodeName.indexOf("document") == -1) ? context.ownerDocument : 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 retType = (resultType == this.ResultType.single) ? XPathResult.FIRST_ORDERED_NODE_TYPE : XPathResult.ANY_TYPE;
var col = xmlDoc.evaluate(xpathExp, node, XML.getNSResolver(namespaces), retType, null); // var col = xmlDoc.evaluate(xpathExp, node, XML.getNSResolver(namespaces), retType, null);
//
if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE) { // if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE) {
return col.singleNodeValue; // return col.singleNodeValue;
} else { // } else {
var thisColMemb = col.iterateNext(); // var thisColMemb = col.iterateNext();
var rowsCol = []; // var rowsCol = [];
while (thisColMemb) { // while (thisColMemb) {
rowsCol[rowsCol.length] = thisColMemb; // rowsCol[rowsCol.length] = thisColMemb;
thisColMemb = col.iterateNext(); // thisColMemb = col.iterateNext();
} // }
return rowsCol; // return rowsCol;
} // }
} // }
} // }
}; // };
//
XML.eval2 = function (context, xpathExp, resultType, namespaces) { // XML.eval2 = function (context, xpathExp, resultType, namespaces) {
if (resultType !== "single" && resultType !== undefined && resultType !== null) { // if (resultType !== "single" && resultType !== undefined && resultType !== null) {
throw new Error("justep.SimpleXML.eval only be resultType='single', not" + resultType); // throw new Error("justep.SimpleXML.eval only be resultType='single', not" + resultType);
} // }
//
if (context === null || context === undefined || xpathExp === null || xpathExp === undefined) { // if (context === null || context === undefined || xpathExp === null || xpathExp === undefined) {
return context; // return context;
} // }
//
if (context.nodeType == XML.Document.NodeType.DOCUMENT) { // if (context.nodeType == XML.Document.NodeType.DOCUMENT) {
context = context.documentElement; // context = context.documentElement;
} // }
//
var childs, i; // var childs, i;
if (xpathExp.indexOf("/") != -1) { // if (xpathExp.indexOf("/") != -1) {
var items = xpathExp.split("/"); // var items = xpathExp.split("/");
var isAbs = xpathExp.substring(0, 1) == "/"; // var isAbs = xpathExp.substring(0, 1) == "/";
for (i = 0; i < items.length; i++) { // for (i = 0; i < items.length; i++) {
var item = items[i]; // var item = items[i];
if (item === "") { // if (item === "") {
continue; // continue;
} else { // } else {
var next = null; // var next = null;
var ii = i + 1; // var ii = i + 1;
for (; ii < items.length; ii++) { // for (; ii < items.length; ii++) {
if (next === null) { // if (next === null) {
next = items[ii]; // next = items[ii];
} else { // } else {
next = next + "/" + items[ii]; // next = next + "/" + items[ii];
} // }
} // }
//
if (item == ".") { // if (item == ".") {
return this.eval(context, next, resultType); // return this.eval(context, next, resultType);
//
} else if (item == "..") { // } else if (item == "..") {
return this.eval2(context.parentNode, next, resultType); // return this.eval2(context.parentNode, next, resultType);
//
} else if (item == "*") { // } else if (item == "*") {
if (isAbs) { // if (isAbs) {
return this.eval2(context, next, resultType); // return this.eval2(context, next, resultType);
//
} else { // } else {
childs = context.childNodes; // childs = context.childNodes;
for (var j = 0; j < childs.length; j++) { // for (var j = 0; j < childs.length; j++) {
var tmp = this.eval2(childs[j], next, resultType); // var tmp = this.eval2(childs[j], next, resultType);
if (tmp !== null) { // if (tmp !== null) {
return tmp; // return tmp;
} // }
} // }
return null; // return null;
} // }
//
} else { // } else {
if (isAbs) { // if (isAbs) {
if (context.nodeName == item) { // if (context.nodeName == item) {
return this.eval2(context, next, resultType); // return this.eval2(context, next, resultType);
} else { // } else {
return null; // return null;
} // }
} else { // } else {
var child = this.getChildByName(context, item); // var child = this.getChildByName(context, item);
if (child !== null) { // if (child !== null) {
return this.eval2(child, next, resultType); // return this.eval2(child, next, resultType);
} else { // } else {
return null; // return null;
} // }
//
} // }
} // }
//
} // }
} // }
//
return null; // return null;
//
} else { // } else {
if ("text()" == xpathExp) { // if ("text()" == xpathExp) {
childs = context.childNodes; // childs = context.childNodes;
for (i = 0; i < childs.length; i++) { // for (i = 0; i < childs.length; i++) {
if (childs[i].nodeType == XML.Document.NodeType.TEXT) { // if (childs[i].nodeType == XML.Document.NodeType.TEXT) {
return childs[i]; // return childs[i];
} // }
} // }
return null; // return null;
} else { // } else {
return this.getChildByName(context, xpathExp); // return this.getChildByName(context, xpathExp);
} // }
} // }
}; // };
//
XML.getChildByName = function (context, name) { // XML.getChildByName = function (context, name) {
if (context === null || context === undefined || name === null || name === undefined) { // if (context === null || context === undefined || name === null || name === undefined) {
return null; // return null;
} // }
//
if (context.nodeType == XML.Document.NodeType.DOCUMENT) { // if (context.nodeType == XML.Document.NodeType.DOCUMENT) {
context = context.documentElement; // context = context.documentElement;
} // }
//
var childs = context.childNodes; // var childs = context.childNodes;
for (var i = 0; i < childs.length; i++) { // for (var i = 0; i < childs.length; i++) {
if (childs[i].nodeType == XML.Document.NodeType.ELEMENT && (childs[i].nodeName == name || name == "*")) { // if (childs[i].nodeType == XML.Document.NodeType.ELEMENT && (childs[i].nodeName == name || name == "*")) {
return childs[i]; // return childs[i];
} // }
} // }
//
return null; // return null;
}; // };
//
XML.appendChildren = function (context, xpathExp, nodes, isBefore) { // XML.appendChildren = function (context, xpathExp, nodes, isBefore) {
nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; // nodes = (typeof nodes.length != "undefined") ? nodes : [nodes];
var finded = this.eval(context, xpathExp); // var finded = this.eval(context, xpathExp);
var count = finded.length; // var count = finded.length;
for (var i = 0; i < count; i++) { // for (var i = 0; i < count; i++) {
if (isBefore && finded[i].firstNode) { // if (isBefore && finded[i].firstNode) {
this._insertBefore(finded[i], nodes, finded[i].firstNode); // this._insertBefore(finded[i], nodes, finded[i].firstNode);
} else { // } else {
for (var j = 0; j < nodes.length; j++) { // for (var j = 0; j < nodes.length; j++) {
finded[i].appendChild(nodes[j]); // finded[i].appendChild(nodes[j]);
} // }
} // }
} // }
return count; // return count;
}; // };
//
XML.removeNodes = function (context, xpathExp) { // XML.removeNodes = function (context, xpathExp) {
var nodes = this.eval(context, xpathExp); // var nodes = this.eval(context, xpathExp);
for (var i = 0; i < nodes.length; i++) { // for (var i = 0; i < nodes.length; i++) {
nodes[i].parentNode.removeChild(nodes[i]); // nodes[i].parentNode.removeChild(nodes[i]);
} // }
}; // };
//
XML._insertBefore = function (parent, newchildren, refchild) { // XML._insertBefore = function (parent, newchildren, refchild) {
for (var i = 0; i < newchildren.length; i++) { // for (var i = 0; i < newchildren.length; i++) {
parent.insertBefore(newchildren[i], refchild); // parent.insertBefore(newchildren[i], refchild);
} // }
}; // };
//
XML.insertNodes = function (context, xpathExp, nodes, isBefore) { // XML.insertNodes = function (context, xpathExp, nodes, isBefore) {
nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; // nodes = (typeof nodes.length != "undefined") ? nodes : [nodes];
var finded = this.eval(context, xpathExp); // var finded = this.eval(context, xpathExp);
var count = finded.length; // var count = finded.length;
for (var i = 0; i < count; i++) { // for (var i = 0; i < count; i++) {
var refnode = (isBefore) ? finded[i] : finded[i].nextSibling; // var refnode = (isBefore) ? finded[i] : finded[i].nextSibling;
this._insertBefore(finded[i].parentNode, nodes, refnode); // this._insertBefore(finded[i].parentNode, nodes, refnode);
} // }
return count; // return count;
}; // };
//
XML.replaceNodes = function (context, xpathExp, nodes) { // XML.replaceNodes = function (context, xpathExp, nodes) {
nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; // nodes = (typeof nodes.length != "undefined") ? nodes : [nodes];
var finded = this.eval(context, xpathExp); // var finded = this.eval(context, xpathExp);
var count = finded.length; // var count = finded.length;
for (var i = 0; i < count; i++) { // for (var i = 0; i < count; i++) {
var refnode = finded[i]; // var refnode = finded[i];
var parent = refnode.parentNode; // var parent = refnode.parentNode;
this._insertBefore(parent, nodes, refnode); // this._insertBefore(parent, nodes, refnode);
parent.removeChild(refnode); // parent.removeChild(refnode);
} // }
return count; // return count;
}; // };
//
XML.setNodeText = function (context, xpathExp, text) { // XML.setNodeText = function (context, xpathExp, text) {
var finded = this.eval(context, xpathExp, this.ResultType.single); // var finded = this.eval(context, xpathExp, this.ResultType.single);
if (finded === null) { // if (finded === null) {
return; // return;
} // }
if (finded.nodeType == XML.Document.NodeType.ELEMENT) { // if (finded.nodeType == XML.Document.NodeType.ELEMENT) {
var textNode = this.eval(finded, "./text()", this.ResultType.single); // var textNode = this.eval(finded, "./text()", this.ResultType.single);
if (!textNode) { // if (!textNode) {
textNode = finded.ownerDocument.createTextNode(""); // textNode = finded.ownerDocument.createTextNode("");
finded.appendChild(textNode); // finded.appendChild(textNode);
} // }
textNode.nodeValue = text; // textNode.nodeValue = text;
} else { // } else {
finded.nodeValue = text; // finded.nodeValue = text;
} // }
return; // return;
}; // };
//
XML.getNodeText = function (context, xpathExp, defaultValue) { // XML.getNodeText = function (context, xpathExp, defaultValue) {
var finded = xpathExp ? this.eval(context, xpathExp, this.ResultType.single) : context; // var finded = xpathExp ? this.eval(context, xpathExp, this.ResultType.single) : context;
if (finded && (finded.nodeType == XML.Document.NodeType.ELEMENT)) { // if (finded && (finded.nodeType == XML.Document.NodeType.ELEMENT)) {
finded = this.eval(finded, "./text()", this.ResultType.single); // finded = this.eval(finded, "./text()", this.ResultType.single);
} // }
return (finded && finded.nodeValue) ? "" + finded.nodeValue : (defaultValue !== undefined) ? defaultValue : null; // return (finded && finded.nodeValue) ? "" + finded.nodeValue : (defaultValue !== undefined) ? defaultValue : null;
}; // };
//
XML.Namespaces = { // XML.Namespaces = {
XMLSCHEMA: "http://www.w3.org/2001/XMLSchema#", // XMLSCHEMA: "http://www.w3.org/2001/XMLSchema#",
XMLSCHEMA_STRING: "http://www.w3.org/2001/XMLSchema#String", // XMLSCHEMA_STRING: "http://www.w3.org/2001/XMLSchema#String",
XMLSCHEMA_LONG: "http://www.w3.org/2001/XMLSchema#Long", // XMLSCHEMA_LONG: "http://www.w3.org/2001/XMLSchema#Long",
XMLSCHEMA_INTEGER: 'http://www.w3.org/2001/XMLSchema#Integer', // XMLSCHEMA_INTEGER: 'http://www.w3.org/2001/XMLSchema#Integer',
XMLSCHEMA_FLOAT: 'http://www.w3.org/2001/XMLSchema#Float', // XMLSCHEMA_FLOAT: 'http://www.w3.org/2001/XMLSchema#Float',
XMLSCHEMA_DOUBLE: 'http://www.w3.org/2001/XMLSchema#Double', // XMLSCHEMA_DOUBLE: 'http://www.w3.org/2001/XMLSchema#Double',
XMLSCHEMA_DECIMAL: 'http://www.w3.org/2001/XMLSchema#Decimal', // XMLSCHEMA_DECIMAL: 'http://www.w3.org/2001/XMLSchema#Decimal',
XMLSCHEMA_DATE: 'http://www.w3.org/2001/XMLSchema#Date', // XMLSCHEMA_DATE: 'http://www.w3.org/2001/XMLSchema#Date',
XMLSCHEMA_TIME: 'http://www.w3.org/2001/XMLSchema#Time', // XMLSCHEMA_TIME: 'http://www.w3.org/2001/XMLSchema#Time',
XMLSCHEMA_DATETIME: 'http://www.w3.org/2001/XMLSchema#DateTime', // XMLSCHEMA_DATETIME: 'http://www.w3.org/2001/XMLSchema#DateTime',
XMLSCHEMA_BOOLEAN: 'http://www.w3.org/2001/XMLSchema#Boolean', // XMLSCHEMA_BOOLEAN: 'http://www.w3.org/2001/XMLSchema#Boolean',
XMLSCHEMA_SYMBOL: 'http://www.w3.org/2001/XMLSchema#Symbol', // XMLSCHEMA_SYMBOL: 'http://www.w3.org/2001/XMLSchema#Symbol',
JUSTEPSCHEMA: "http://www.justep.com/xbiz#", // JUSTEPSCHEMA: "http://www.justep.com/xbiz#",
RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#", // RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
JUSTEP: "http://www.justep.com/x5#", // JUSTEP: "http://www.justep.com/x5#",
'get': function (type) { // 'get': function (type) {
type = type ? type.toLowerCase() : "string"; // type = type ? type.toLowerCase() : "string";
if ("string" == type) { // if ("string" == type) {
return XML.Namespaces.XMLSCHEMA_STRING; // return XML.Namespaces.XMLSCHEMA_STRING;
} // }
else if ("integer" == type) { // else if ("integer" == type) {
return XML.Namespaces.XMLSCHEMA_INTEGER; // return XML.Namespaces.XMLSCHEMA_INTEGER;
} // }
else if ("long" == type) { // else if ("long" == type) {
return XML.Namespaces.XMLSCHEMA_LONG; // return XML.Namespaces.XMLSCHEMA_LONG;
} // }
else if ("float" == type) { // else if ("float" == type) {
return XML.Namespaces.XMLSCHEMA_FLOAT; // return XML.Namespaces.XMLSCHEMA_FLOAT;
} // }
else if ("double" == type) { // else if ("double" == type) {
return XML.Namespaces.XMLSCHEMA_DOUBLE; // return XML.Namespaces.XMLSCHEMA_DOUBLE;
} // }
else if ("decimal" == type) { // else if ("decimal" == type) {
return XML.Namespaces.XMLSCHEMA_DECIMAL; // return XML.Namespaces.XMLSCHEMA_DECIMAL;
} // }
else if ("date" == type) { // else if ("date" == type) {
return XML.Namespaces.XMLSCHEMA_DATE; // return XML.Namespaces.XMLSCHEMA_DATE;
} // }
else if ("time" == type) { // else if ("time" == type) {
return XML.Namespaces.XMLSCHEMA_TIME; // return XML.Namespaces.XMLSCHEMA_TIME;
} // }
else if ("datetime" == type) { // else if ("datetime" == type) {
return XML.Namespaces.XMLSCHEMA_DATETIME; // return XML.Namespaces.XMLSCHEMA_DATETIME;
} // }
else if ("boolean" == type) { // else if ("boolean" == type) {
return XML.Namespaces.XMLSCHEMA_BOOLEAN; // return XML.Namespaces.XMLSCHEMA_BOOLEAN;
} // }
} // }
}; // };
})(BI);BI.BehaviorFactory = { // })(BI);
BI.BehaviorFactory = {
createBehavior: function(key, options){ createBehavior: function(key, options){
var behavior; var behavior;
switch (key){ switch (key){

19
bi/polyfill.js

@ -60,8 +60,23 @@ window.localStorage || (window.localStorage = {
clear: function () { clear: function () {
this.items = {}; this.items = {};
} }
});//修复ie9下sort方法的bug });if (typeof Set !== 'undefined' && Set.toString().match(/native code/)) {
!function (window) {
} 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(), var ua = window.navigator.userAgent.toLowerCase(),
reg = /msie|applewebkit.+safari/; reg = /msie|applewebkit.+safari/;
if (reg.test(ua)) { if (reg.test(ua)) {

9
bi/widget.js

@ -5502,6 +5502,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
this.editor = BI.createWidget({ this.editor = BI.createWidget({
type: "bi.sign_editor", type: "bi.sign_editor",
height: o.height,
value: this._alertInEditorValue(o.value), value: this._alertInEditorValue(o.value),
errorText: BI.i18nText("BI-Please_Input_Natural_Number"), errorText: BI.i18nText("BI-Please_Input_Natural_Number"),
validationChecker: function(v){ validationChecker: function(v){
@ -5549,7 +5550,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, {
el: this.bottomBtn el: this.bottomBtn
}] }]
}, },
width: 30 width: 23
}] }]
}); });
}, },
@ -14632,12 +14633,6 @@ BI.SequenceTable = BI.inherit(BI.Widget, {
_populate: function () { _populate: function () {
var o = this.options; var o = this.options;
this.sequence.attr({
items: o.items,
header: o.header,
crossItems: o.crossItems,
crossHeader: o.crossHeader
});
if (o.showSequence === true) { if (o.showSequence === true) {
this.sequence.setVisible(true); this.sequence.setVisible(true);
this.table.element.css("left", "60px"); this.table.element.css("left", "60px");

8
docs/base.css

@ -873,6 +873,14 @@ li.CodeMirror-hint-active {
overflow-x: hidden; overflow-x: hidden;
overflow-y: hidden; overflow-y: hidden;
white-space: nowrap; 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; word-break: break-word;
} }
.bi-bubble { .bi-bubble {

75
docs/base.js

@ -478,6 +478,7 @@ BI.Text = BI.inherit(BI.Single, {
textAlign: "left", textAlign: "left",
whiteSpace: "normal", whiteSpace: "normal",
lineHeight: null, lineHeight: null,
handler: null,//如果传入handler,表示处理文字的点击事件,不是区域的
hgap: 0, hgap: 0,
vgap: 0, vgap: 0,
lgap: 0, lgap: 0,
@ -491,39 +492,25 @@ BI.Text = BI.inherit(BI.Single, {
_init: function () { _init: function () {
BI.Text.superclass._init.apply(this, arguments); BI.Text.superclass._init.apply(this, arguments);
var o = this.options; var self = this, 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);
}
if (o.hgap + o.lgap > 0) { if (o.hgap + o.lgap > 0) {
this.text.element.css({ this.element.css({
"margin-left": o.hgap + o.lgap + "px" "padding-left": o.hgap + o.lgap + "px"
}) })
} }
if (o.hgap + o.rgap > 0) { if (o.hgap + o.rgap > 0) {
this.text.element.css({ this.element.css({
"margin-right": o.hgap + o.rgap + "px" "padding-right": o.hgap + o.rgap + "px"
}) })
} }
if (o.vgap + o.tgap > 0) { if (o.vgap + o.tgap > 0) {
this.text.element.css({ this.element.css({
"margin-top": o.vgap + o.tgap + "px" "padding-top": o.vgap + o.tgap + "px"
}) })
} }
if (o.vgap + o.bgap > 0) { if (o.vgap + o.bgap > 0) {
this.text.element.css({ this.element.css({
"margin-bottom": o.vgap + o.bgap + "px" "padding-bottom": o.vgap + o.bgap + "px"
}) })
} }
if (BI.isNumber(o.height)) { if (BI.isNumber(o.height)) {
@ -532,14 +519,31 @@ BI.Text = BI.inherit(BI.Single, {
if (BI.isNumber(o.lineHeight)) { if (BI.isNumber(o.lineHeight)) {
this.element.css({"lineHeight": o.lineHeight + "px"}); this.element.css({"lineHeight": o.lineHeight + "px"});
} }
this.text.element.css({
"textAlign": o.textAlign,
"whiteSpace": o.whiteSpace
});
this.element.css({ this.element.css({
"textAlign": o.textAlign, "textAlign": o.textAlign,
"whiteSpace": o.whiteSpace "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)) { if (BI.isKey(o.keyword)) {
this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py);
} }
@ -803,6 +807,9 @@ BI.BasicButton = BI.inherit(BI.Single, {
_trigger: function () { _trigger: function () {
var o = this.options; var o = this.options;
if(!this.isEnabled()){
return;
}
if (!this.isDisableSelected()) { if (!this.isDisableSelected()) {
this.isForceSelected() ? this.setSelected(true) : this.isForceSelected() ? this.setSelected(true) :
(this.isForceNotSelected() ? this.setSelected(false) : (this.isForceNotSelected() ? this.setSelected(false) :
@ -1516,7 +1523,6 @@ BI.TreeView = BI.inherit(BI.Pane, {
_init: function () { _init: function () {
BI.TreeView.superclass._init.apply(this, arguments); BI.TreeView.superclass._init.apply(this, arguments);
this._stop = false; this._stop = false;
this.container = BI.createWidget();
this._createTree(); this._createTree();
this.tip = BI.createWidget({ this.tip = BI.createWidget({
@ -1529,7 +1535,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
scrollable: true, scrollable: true,
scrolly: false, scrolly: false,
element: this, element: this,
items: [this.container, this.tip] items: [this.tip]
}); });
}, },
@ -1548,7 +1554,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
}); });
BI.createWidget({ BI.createWidget({
type: "bi.default", type: "bi.default",
element: this.container, element: this.element,
items: [this.tree] items: [this.tree]
}); });
}, },
@ -1943,6 +1949,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
setNode(child.children); setNode(child.children);
}); });
} }
BI.each(this.nodes.getNodes(), function (i, node) { BI.each(this.nodes.getNodes(), function (i, node) {
node.halfCheck = false; node.halfCheck = false;
setNode(node.children); setNode(node.children);
@ -16341,9 +16348,9 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) {
BI.Button.superclass._init.apply(this, arguments); BI.Button.superclass._init.apply(this, arguments);
var o = this.options, self = this; var o = this.options, self = this;
if (BI.isNumber(o.height) && !o.clear && !o.block) { 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 { } else {
this.element.css({lineHeight: o.height + 'px'}); this.element.css({lineHeight: o.height + "px"});
} }
if (BI.isKey(o.iconClass)) { if (BI.isKey(o.iconClass)) {
this.icon = BI.createWidget({ this.icon = BI.createWidget({
@ -16396,8 +16403,8 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) {
if (o.clear === true) { if (o.clear === true) {
this.element.addClass("clear"); this.element.addClass("clear");
} }
if (o.minWidth > 2) { if (o.minWidth > 0) {
this.element.css({"min-width": o.minWidth - 2 + "px"}); this.element.css({"min-width": o.minWidth + "px"});
} }
}, },

728
docs/core.js

@ -17795,6 +17795,10 @@ $.extend(BI, {
? entry ? entry
: entry.value : entry.value
}; };
p.has = function (key) {
return this._keymap[key] != null;
}
})();; })();;
!(function () { !(function () {
var MD5 = function (hexcase) { 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 () { (function () {
var clamp = function (value, min, max) { var clamp = function (value, min, max) {
if (value < min) { if (value < min) {
@ -19103,359 +19092,360 @@ BI.Region.prototype = {
pos.push(this.y + this.h / 2); pos.push(this.y + this.h / 2);
return pos; return pos;
} }
};; };// ;
!(function (BI) { // !(function (BI) {
//
if (BI.isIE()) { // if (BI.isIE()) {
XMLSerializer = null; // XMLSerializer = null;
DOMParser = null; // DOMParser = null;
} // }
//
//
var XML = { // var XML = {
Document: { // Document: {
NodeType: { // NodeType: {
ELEMENT: 1, // ELEMENT: 1,
ATTRIBUTE: 2, // ATTRIBUTE: 2,
TEXT: 3, // TEXT: 3,
CDATA_SECTION: 4, // CDATA_SECTION: 4,
ENTITY_REFERENCE: 5, // ENTITY_REFERENCE: 5,
ENTITY: 6, // ENTITY: 6,
PROCESSING_INSTRUCTION: 7, // PROCESSING_INSTRUCTION: 7,
COMMENT: 8, // COMMENT: 8,
DOCUMENT: 9, // DOCUMENT: 9,
DOCUMENT_TYPE: 10, // DOCUMENT_TYPE: 10,
DOCUMENT_FRAGMENT: 11, // DOCUMENT_FRAGMENT: 11,
NOTATION: 12 // NOTATION: 12
} // }
} // }
}; // };
//
XML.ResultType = { // XML.ResultType = {
single: 'single', // single: 'single',
array: 'array' // array: 'array'
}; // };
//
XML.fromString = function (xmlStr) { // XML.fromString = function (xmlStr) {
try { // try {
var parser = new DOMParser(); // var parser = new DOMParser();
return parser.parseFromString(xmlStr, "text/xml"); // return parser.parseFromString(xmlStr, "text/xml");
} catch (e) { // } catch (e) {
var arrMSXML = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0"]; // var arrMSXML = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0"];
for (var i = 0; i < arrMSXML.length; i++) { // for (var i = 0; i < arrMSXML.length; i++) {
try { // try {
var xmlDoc = new ActiveXObject(arrMSXML[i]); // var xmlDoc = new ActiveXObject(arrMSXML[i]);
xmlDoc.setProperty("SelectionLanguage", "XPath"); // xmlDoc.setProperty("SelectionLanguage", "XPath");
xmlDoc.async = false; // xmlDoc.async = false;
xmlDoc.loadXML(xmlStr); // xmlDoc.loadXML(xmlStr);
return xmlDoc; // return xmlDoc;
} catch (xmlError) { // } catch (xmlError) {
} // }
} // }
} // }
}; // };
//
XML.toString = function (xmlNode) { // XML.toString = function (xmlNode) {
if (!BI.isIE()) { // if (!BI.isIE()) {
var xmlSerializer = new XMLSerializer(); // var xmlSerializer = new XMLSerializer();
return xmlSerializer.serializeToString(xmlNode); // return xmlSerializer.serializeToString(xmlNode);
} else // } else
return xmlNode.xml; // return xmlNode.xml;
}; // };
//
XML.getNSResolver = function (str) { // XML.getNSResolver = function (str) {
if (!str) { // if (!str) {
return null; // return null;
} // }
var list = str.split(' '); // var list = str.split(' ');
var namespaces = {}; // var namespaces = {};
for (var i = 0; i < list.length; i++) { // for (var i = 0; i < list.length; i++) {
var pair = list[i].split('='); // var pair = list[i].split('=');
var fix = BI.trim(pair[0]).replace("xmlns:", ""); // var fix = BI.trim(pair[0]).replace("xmlns:", "");
namespaces[fix] = BI.trim(pair[1]).replace(/"/g, "").replace(/'/g, ""); // namespaces[fix] = BI.trim(pair[1]).replace(/"/g, "").replace(/'/g, "");
} // }
return function (prefix) { // return function (prefix) {
return namespaces[prefix]; // return namespaces[prefix];
}; // };
}; // };
//
XML.eval = function (context, xpathExp, resultType, namespaces) { // XML.eval = function (context, xpathExp, resultType, namespaces) {
if ((BI.isIE() && ('undefined' === typeof(context.selectSingleNode) || 'undefined' === typeof(context.selectNodes)))) { // if ((BI.isIE() && ('undefined' === typeof(context.selectSingleNode) || 'undefined' === typeof(context.selectNodes)))) {
return XML.eval2(context, xpathExp, resultType, namespaces); // return XML.eval2(context, xpathExp, resultType, namespaces);
} else { // } else {
if (BI.isIE()) { // if (BI.isIE()) {
namespaces = namespaces ? namespaces : ""; // namespaces = namespaces ? namespaces : "";
var doc = (context.nodeType == XML.Document.NodeType.DOCUMENT) ? context : context.ownerDocument; // var doc = (context.nodeType == XML.Document.NodeType.DOCUMENT) ? context : context.ownerDocument;
doc.setProperty("SelectionNamespaces", namespaces); // doc.setProperty("SelectionNamespaces", namespaces);
var result; // var result;
if (resultType == this.ResultType.single) { // if (resultType == this.ResultType.single) {
result = context.selectSingleNode(xpathExp); // result = context.selectSingleNode(xpathExp);
} else { // } else {
result = context.selectNodes(xpathExp) || []; // result = context.selectNodes(xpathExp) || [];
} // }
doc.setProperty("SelectionNamespaces", ""); // doc.setProperty("SelectionNamespaces", "");
return result; // return result;
} else { // } else {
var node = context; // var node = context;
var xmlDoc = (context.nodeName.indexOf("document") == -1) ? context.ownerDocument : 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 retType = (resultType == this.ResultType.single) ? XPathResult.FIRST_ORDERED_NODE_TYPE : XPathResult.ANY_TYPE;
var col = xmlDoc.evaluate(xpathExp, node, XML.getNSResolver(namespaces), retType, null); // var col = xmlDoc.evaluate(xpathExp, node, XML.getNSResolver(namespaces), retType, null);
//
if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE) { // if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE) {
return col.singleNodeValue; // return col.singleNodeValue;
} else { // } else {
var thisColMemb = col.iterateNext(); // var thisColMemb = col.iterateNext();
var rowsCol = []; // var rowsCol = [];
while (thisColMemb) { // while (thisColMemb) {
rowsCol[rowsCol.length] = thisColMemb; // rowsCol[rowsCol.length] = thisColMemb;
thisColMemb = col.iterateNext(); // thisColMemb = col.iterateNext();
} // }
return rowsCol; // return rowsCol;
} // }
} // }
} // }
}; // };
//
XML.eval2 = function (context, xpathExp, resultType, namespaces) { // XML.eval2 = function (context, xpathExp, resultType, namespaces) {
if (resultType !== "single" && resultType !== undefined && resultType !== null) { // if (resultType !== "single" && resultType !== undefined && resultType !== null) {
throw new Error("justep.SimpleXML.eval only be resultType='single', not" + resultType); // throw new Error("justep.SimpleXML.eval only be resultType='single', not" + resultType);
} // }
//
if (context === null || context === undefined || xpathExp === null || xpathExp === undefined) { // if (context === null || context === undefined || xpathExp === null || xpathExp === undefined) {
return context; // return context;
} // }
//
if (context.nodeType == XML.Document.NodeType.DOCUMENT) { // if (context.nodeType == XML.Document.NodeType.DOCUMENT) {
context = context.documentElement; // context = context.documentElement;
} // }
//
var childs, i; // var childs, i;
if (xpathExp.indexOf("/") != -1) { // if (xpathExp.indexOf("/") != -1) {
var items = xpathExp.split("/"); // var items = xpathExp.split("/");
var isAbs = xpathExp.substring(0, 1) == "/"; // var isAbs = xpathExp.substring(0, 1) == "/";
for (i = 0; i < items.length; i++) { // for (i = 0; i < items.length; i++) {
var item = items[i]; // var item = items[i];
if (item === "") { // if (item === "") {
continue; // continue;
} else { // } else {
var next = null; // var next = null;
var ii = i + 1; // var ii = i + 1;
for (; ii < items.length; ii++) { // for (; ii < items.length; ii++) {
if (next === null) { // if (next === null) {
next = items[ii]; // next = items[ii];
} else { // } else {
next = next + "/" + items[ii]; // next = next + "/" + items[ii];
} // }
} // }
//
if (item == ".") { // if (item == ".") {
return this.eval(context, next, resultType); // return this.eval(context, next, resultType);
//
} else if (item == "..") { // } else if (item == "..") {
return this.eval2(context.parentNode, next, resultType); // return this.eval2(context.parentNode, next, resultType);
//
} else if (item == "*") { // } else if (item == "*") {
if (isAbs) { // if (isAbs) {
return this.eval2(context, next, resultType); // return this.eval2(context, next, resultType);
//
} else { // } else {
childs = context.childNodes; // childs = context.childNodes;
for (var j = 0; j < childs.length; j++) { // for (var j = 0; j < childs.length; j++) {
var tmp = this.eval2(childs[j], next, resultType); // var tmp = this.eval2(childs[j], next, resultType);
if (tmp !== null) { // if (tmp !== null) {
return tmp; // return tmp;
} // }
} // }
return null; // return null;
} // }
//
} else { // } else {
if (isAbs) { // if (isAbs) {
if (context.nodeName == item) { // if (context.nodeName == item) {
return this.eval2(context, next, resultType); // return this.eval2(context, next, resultType);
} else { // } else {
return null; // return null;
} // }
} else { // } else {
var child = this.getChildByName(context, item); // var child = this.getChildByName(context, item);
if (child !== null) { // if (child !== null) {
return this.eval2(child, next, resultType); // return this.eval2(child, next, resultType);
} else { // } else {
return null; // return null;
} // }
//
} // }
} // }
//
} // }
} // }
//
return null; // return null;
//
} else { // } else {
if ("text()" == xpathExp) { // if ("text()" == xpathExp) {
childs = context.childNodes; // childs = context.childNodes;
for (i = 0; i < childs.length; i++) { // for (i = 0; i < childs.length; i++) {
if (childs[i].nodeType == XML.Document.NodeType.TEXT) { // if (childs[i].nodeType == XML.Document.NodeType.TEXT) {
return childs[i]; // return childs[i];
} // }
} // }
return null; // return null;
} else { // } else {
return this.getChildByName(context, xpathExp); // return this.getChildByName(context, xpathExp);
} // }
} // }
}; // };
//
XML.getChildByName = function (context, name) { // XML.getChildByName = function (context, name) {
if (context === null || context === undefined || name === null || name === undefined) { // if (context === null || context === undefined || name === null || name === undefined) {
return null; // return null;
} // }
//
if (context.nodeType == XML.Document.NodeType.DOCUMENT) { // if (context.nodeType == XML.Document.NodeType.DOCUMENT) {
context = context.documentElement; // context = context.documentElement;
} // }
//
var childs = context.childNodes; // var childs = context.childNodes;
for (var i = 0; i < childs.length; i++) { // for (var i = 0; i < childs.length; i++) {
if (childs[i].nodeType == XML.Document.NodeType.ELEMENT && (childs[i].nodeName == name || name == "*")) { // if (childs[i].nodeType == XML.Document.NodeType.ELEMENT && (childs[i].nodeName == name || name == "*")) {
return childs[i]; // return childs[i];
} // }
} // }
//
return null; // return null;
}; // };
//
XML.appendChildren = function (context, xpathExp, nodes, isBefore) { // XML.appendChildren = function (context, xpathExp, nodes, isBefore) {
nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; // nodes = (typeof nodes.length != "undefined") ? nodes : [nodes];
var finded = this.eval(context, xpathExp); // var finded = this.eval(context, xpathExp);
var count = finded.length; // var count = finded.length;
for (var i = 0; i < count; i++) { // for (var i = 0; i < count; i++) {
if (isBefore && finded[i].firstNode) { // if (isBefore && finded[i].firstNode) {
this._insertBefore(finded[i], nodes, finded[i].firstNode); // this._insertBefore(finded[i], nodes, finded[i].firstNode);
} else { // } else {
for (var j = 0; j < nodes.length; j++) { // for (var j = 0; j < nodes.length; j++) {
finded[i].appendChild(nodes[j]); // finded[i].appendChild(nodes[j]);
} // }
} // }
} // }
return count; // return count;
}; // };
//
XML.removeNodes = function (context, xpathExp) { // XML.removeNodes = function (context, xpathExp) {
var nodes = this.eval(context, xpathExp); // var nodes = this.eval(context, xpathExp);
for (var i = 0; i < nodes.length; i++) { // for (var i = 0; i < nodes.length; i++) {
nodes[i].parentNode.removeChild(nodes[i]); // nodes[i].parentNode.removeChild(nodes[i]);
} // }
}; // };
//
XML._insertBefore = function (parent, newchildren, refchild) { // XML._insertBefore = function (parent, newchildren, refchild) {
for (var i = 0; i < newchildren.length; i++) { // for (var i = 0; i < newchildren.length; i++) {
parent.insertBefore(newchildren[i], refchild); // parent.insertBefore(newchildren[i], refchild);
} // }
}; // };
//
XML.insertNodes = function (context, xpathExp, nodes, isBefore) { // XML.insertNodes = function (context, xpathExp, nodes, isBefore) {
nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; // nodes = (typeof nodes.length != "undefined") ? nodes : [nodes];
var finded = this.eval(context, xpathExp); // var finded = this.eval(context, xpathExp);
var count = finded.length; // var count = finded.length;
for (var i = 0; i < count; i++) { // for (var i = 0; i < count; i++) {
var refnode = (isBefore) ? finded[i] : finded[i].nextSibling; // var refnode = (isBefore) ? finded[i] : finded[i].nextSibling;
this._insertBefore(finded[i].parentNode, nodes, refnode); // this._insertBefore(finded[i].parentNode, nodes, refnode);
} // }
return count; // return count;
}; // };
//
XML.replaceNodes = function (context, xpathExp, nodes) { // XML.replaceNodes = function (context, xpathExp, nodes) {
nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; // nodes = (typeof nodes.length != "undefined") ? nodes : [nodes];
var finded = this.eval(context, xpathExp); // var finded = this.eval(context, xpathExp);
var count = finded.length; // var count = finded.length;
for (var i = 0; i < count; i++) { // for (var i = 0; i < count; i++) {
var refnode = finded[i]; // var refnode = finded[i];
var parent = refnode.parentNode; // var parent = refnode.parentNode;
this._insertBefore(parent, nodes, refnode); // this._insertBefore(parent, nodes, refnode);
parent.removeChild(refnode); // parent.removeChild(refnode);
} // }
return count; // return count;
}; // };
//
XML.setNodeText = function (context, xpathExp, text) { // XML.setNodeText = function (context, xpathExp, text) {
var finded = this.eval(context, xpathExp, this.ResultType.single); // var finded = this.eval(context, xpathExp, this.ResultType.single);
if (finded === null) { // if (finded === null) {
return; // return;
} // }
if (finded.nodeType == XML.Document.NodeType.ELEMENT) { // if (finded.nodeType == XML.Document.NodeType.ELEMENT) {
var textNode = this.eval(finded, "./text()", this.ResultType.single); // var textNode = this.eval(finded, "./text()", this.ResultType.single);
if (!textNode) { // if (!textNode) {
textNode = finded.ownerDocument.createTextNode(""); // textNode = finded.ownerDocument.createTextNode("");
finded.appendChild(textNode); // finded.appendChild(textNode);
} // }
textNode.nodeValue = text; // textNode.nodeValue = text;
} else { // } else {
finded.nodeValue = text; // finded.nodeValue = text;
} // }
return; // return;
}; // };
//
XML.getNodeText = function (context, xpathExp, defaultValue) { // XML.getNodeText = function (context, xpathExp, defaultValue) {
var finded = xpathExp ? this.eval(context, xpathExp, this.ResultType.single) : context; // var finded = xpathExp ? this.eval(context, xpathExp, this.ResultType.single) : context;
if (finded && (finded.nodeType == XML.Document.NodeType.ELEMENT)) { // if (finded && (finded.nodeType == XML.Document.NodeType.ELEMENT)) {
finded = this.eval(finded, "./text()", this.ResultType.single); // finded = this.eval(finded, "./text()", this.ResultType.single);
} // }
return (finded && finded.nodeValue) ? "" + finded.nodeValue : (defaultValue !== undefined) ? defaultValue : null; // return (finded && finded.nodeValue) ? "" + finded.nodeValue : (defaultValue !== undefined) ? defaultValue : null;
}; // };
//
XML.Namespaces = { // XML.Namespaces = {
XMLSCHEMA: "http://www.w3.org/2001/XMLSchema#", // XMLSCHEMA: "http://www.w3.org/2001/XMLSchema#",
XMLSCHEMA_STRING: "http://www.w3.org/2001/XMLSchema#String", // XMLSCHEMA_STRING: "http://www.w3.org/2001/XMLSchema#String",
XMLSCHEMA_LONG: "http://www.w3.org/2001/XMLSchema#Long", // XMLSCHEMA_LONG: "http://www.w3.org/2001/XMLSchema#Long",
XMLSCHEMA_INTEGER: 'http://www.w3.org/2001/XMLSchema#Integer', // XMLSCHEMA_INTEGER: 'http://www.w3.org/2001/XMLSchema#Integer',
XMLSCHEMA_FLOAT: 'http://www.w3.org/2001/XMLSchema#Float', // XMLSCHEMA_FLOAT: 'http://www.w3.org/2001/XMLSchema#Float',
XMLSCHEMA_DOUBLE: 'http://www.w3.org/2001/XMLSchema#Double', // XMLSCHEMA_DOUBLE: 'http://www.w3.org/2001/XMLSchema#Double',
XMLSCHEMA_DECIMAL: 'http://www.w3.org/2001/XMLSchema#Decimal', // XMLSCHEMA_DECIMAL: 'http://www.w3.org/2001/XMLSchema#Decimal',
XMLSCHEMA_DATE: 'http://www.w3.org/2001/XMLSchema#Date', // XMLSCHEMA_DATE: 'http://www.w3.org/2001/XMLSchema#Date',
XMLSCHEMA_TIME: 'http://www.w3.org/2001/XMLSchema#Time', // XMLSCHEMA_TIME: 'http://www.w3.org/2001/XMLSchema#Time',
XMLSCHEMA_DATETIME: 'http://www.w3.org/2001/XMLSchema#DateTime', // XMLSCHEMA_DATETIME: 'http://www.w3.org/2001/XMLSchema#DateTime',
XMLSCHEMA_BOOLEAN: 'http://www.w3.org/2001/XMLSchema#Boolean', // XMLSCHEMA_BOOLEAN: 'http://www.w3.org/2001/XMLSchema#Boolean',
XMLSCHEMA_SYMBOL: 'http://www.w3.org/2001/XMLSchema#Symbol', // XMLSCHEMA_SYMBOL: 'http://www.w3.org/2001/XMLSchema#Symbol',
JUSTEPSCHEMA: "http://www.justep.com/xbiz#", // JUSTEPSCHEMA: "http://www.justep.com/xbiz#",
RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#", // RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
JUSTEP: "http://www.justep.com/x5#", // JUSTEP: "http://www.justep.com/x5#",
'get': function (type) { // 'get': function (type) {
type = type ? type.toLowerCase() : "string"; // type = type ? type.toLowerCase() : "string";
if ("string" == type) { // if ("string" == type) {
return XML.Namespaces.XMLSCHEMA_STRING; // return XML.Namespaces.XMLSCHEMA_STRING;
} // }
else if ("integer" == type) { // else if ("integer" == type) {
return XML.Namespaces.XMLSCHEMA_INTEGER; // return XML.Namespaces.XMLSCHEMA_INTEGER;
} // }
else if ("long" == type) { // else if ("long" == type) {
return XML.Namespaces.XMLSCHEMA_LONG; // return XML.Namespaces.XMLSCHEMA_LONG;
} // }
else if ("float" == type) { // else if ("float" == type) {
return XML.Namespaces.XMLSCHEMA_FLOAT; // return XML.Namespaces.XMLSCHEMA_FLOAT;
} // }
else if ("double" == type) { // else if ("double" == type) {
return XML.Namespaces.XMLSCHEMA_DOUBLE; // return XML.Namespaces.XMLSCHEMA_DOUBLE;
} // }
else if ("decimal" == type) { // else if ("decimal" == type) {
return XML.Namespaces.XMLSCHEMA_DECIMAL; // return XML.Namespaces.XMLSCHEMA_DECIMAL;
} // }
else if ("date" == type) { // else if ("date" == type) {
return XML.Namespaces.XMLSCHEMA_DATE; // return XML.Namespaces.XMLSCHEMA_DATE;
} // }
else if ("time" == type) { // else if ("time" == type) {
return XML.Namespaces.XMLSCHEMA_TIME; // return XML.Namespaces.XMLSCHEMA_TIME;
} // }
else if ("datetime" == type) { // else if ("datetime" == type) {
return XML.Namespaces.XMLSCHEMA_DATETIME; // return XML.Namespaces.XMLSCHEMA_DATETIME;
} // }
else if ("boolean" == type) { // else if ("boolean" == type) {
return XML.Namespaces.XMLSCHEMA_BOOLEAN; // return XML.Namespaces.XMLSCHEMA_BOOLEAN;
} // }
} // }
}; // };
})(BI);BI.BehaviorFactory = { // })(BI);
BI.BehaviorFactory = {
createBehavior: function(key, options){ createBehavior: function(key, options){
var behavior; var behavior;
switch (key){ switch (key){

19
docs/polyfill.js

@ -60,8 +60,23 @@ window.localStorage || (window.localStorage = {
clear: function () { clear: function () {
this.items = {}; this.items = {};
} }
});//修复ie9下sort方法的bug });if (typeof Set !== 'undefined' && Set.toString().match(/native code/)) {
!function (window) {
} 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(), var ua = window.navigator.userAgent.toLowerCase(),
reg = /msie|applewebkit.+safari/; reg = /msie|applewebkit.+safari/;
if (reg.test(ua)) { if (reg.test(ua)) {

9
docs/widget.js

@ -5502,6 +5502,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
this.editor = BI.createWidget({ this.editor = BI.createWidget({
type: "bi.sign_editor", type: "bi.sign_editor",
height: o.height,
value: this._alertInEditorValue(o.value), value: this._alertInEditorValue(o.value),
errorText: BI.i18nText("BI-Please_Input_Natural_Number"), errorText: BI.i18nText("BI-Please_Input_Natural_Number"),
validationChecker: function(v){ validationChecker: function(v){
@ -5549,7 +5550,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, {
el: this.bottomBtn el: this.bottomBtn
}] }]
}, },
width: 30 width: 23
}] }]
}); });
}, },
@ -14632,12 +14633,6 @@ BI.SequenceTable = BI.inherit(BI.Widget, {
_populate: function () { _populate: function () {
var o = this.options; var o = this.options;
this.sequence.attr({
items: o.items,
header: o.header,
crossItems: o.crossItems,
crossHeader: o.crossHeader
});
if (o.showSequence === true) { if (o.showSequence === true) {
this.sequence.setVisible(true); this.sequence.setVisible(true);
this.table.element.css("left", "60px"); this.table.element.css("left", "60px");

3
src/base/single/button/button.basic.js

@ -220,6 +220,9 @@ BI.BasicButton = BI.inherit(BI.Single, {
_trigger: function () { _trigger: function () {
var o = this.options; var o = this.options;
if(!this.isEnabled()){
return;
}
if (!this.isDisableSelected()) { if (!this.isDisableSelected()) {
this.isForceSelected() ? this.setSelected(true) : this.isForceSelected() ? this.setSelected(true) :
(this.isForceNotSelected() ? this.setSelected(false) : (this.isForceNotSelected() ? this.setSelected(false) :

8
src/base/single/button/buttons/button.js

@ -40,9 +40,9 @@
BI.Button.superclass._init.apply(this, arguments); BI.Button.superclass._init.apply(this, arguments);
var o = this.options, self = this; var o = this.options, self = this;
if (BI.isNumber(o.height) && !o.clear && !o.block) { 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 { } else {
this.element.css({lineHeight: o.height + 'px'}); this.element.css({lineHeight: o.height + "px"});
} }
if (BI.isKey(o.iconClass)) { if (BI.isKey(o.iconClass)) {
this.icon = BI.createWidget({ this.icon = BI.createWidget({
@ -95,8 +95,8 @@
if (o.clear === true) { if (o.clear === true) {
this.element.addClass("clear"); this.element.addClass("clear");
} }
if (o.minWidth > 2) { if (o.minWidth > 0) {
this.element.css({"min-width": o.minWidth - 2 + "px"}); this.element.css({"min-width": o.minWidth + "px"});
} }
}, },

58
src/base/single/text.js

@ -11,6 +11,7 @@ BI.Text = BI.inherit(BI.Single, {
textAlign: "left", textAlign: "left",
whiteSpace: "normal", whiteSpace: "normal",
lineHeight: null, lineHeight: null,
handler: null,//如果传入handler,表示处理文字的点击事件,不是区域的
hgap: 0, hgap: 0,
vgap: 0, vgap: 0,
lgap: 0, lgap: 0,
@ -24,39 +25,25 @@ BI.Text = BI.inherit(BI.Single, {
_init: function () { _init: function () {
BI.Text.superclass._init.apply(this, arguments); BI.Text.superclass._init.apply(this, arguments);
var o = this.options; var self = this, 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);
}
if (o.hgap + o.lgap > 0) { if (o.hgap + o.lgap > 0) {
this.text.element.css({ this.element.css({
"margin-left": o.hgap + o.lgap + "px" "padding-left": o.hgap + o.lgap + "px"
}) })
} }
if (o.hgap + o.rgap > 0) { if (o.hgap + o.rgap > 0) {
this.text.element.css({ this.element.css({
"margin-right": o.hgap + o.rgap + "px" "padding-right": o.hgap + o.rgap + "px"
}) })
} }
if (o.vgap + o.tgap > 0) { if (o.vgap + o.tgap > 0) {
this.text.element.css({ this.element.css({
"margin-top": o.vgap + o.tgap + "px" "padding-top": o.vgap + o.tgap + "px"
}) })
} }
if (o.vgap + o.bgap > 0) { if (o.vgap + o.bgap > 0) {
this.text.element.css({ this.element.css({
"margin-bottom": o.vgap + o.bgap + "px" "padding-bottom": o.vgap + o.bgap + "px"
}) })
} }
if (BI.isNumber(o.height)) { if (BI.isNumber(o.height)) {
@ -65,14 +52,31 @@ BI.Text = BI.inherit(BI.Single, {
if (BI.isNumber(o.lineHeight)) { if (BI.isNumber(o.lineHeight)) {
this.element.css({"lineHeight": o.lineHeight + "px"}); this.element.css({"lineHeight": o.lineHeight + "px"});
} }
this.text.element.css({
"textAlign": o.textAlign,
"whiteSpace": o.whiteSpace
});
this.element.css({ this.element.css({
"textAlign": o.textAlign, "textAlign": o.textAlign,
"whiteSpace": o.whiteSpace "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)) { if (BI.isKey(o.keyword)) {
this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py);
} }

6
src/base/tree/treeview.js

@ -15,7 +15,6 @@ BI.TreeView = BI.inherit(BI.Pane, {
_init: function () { _init: function () {
BI.TreeView.superclass._init.apply(this, arguments); BI.TreeView.superclass._init.apply(this, arguments);
this._stop = false; this._stop = false;
this.container = BI.createWidget();
this._createTree(); this._createTree();
this.tip = BI.createWidget({ this.tip = BI.createWidget({
@ -28,7 +27,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
scrollable: true, scrollable: true,
scrolly: false, scrolly: false,
element: this, element: this,
items: [this.container, this.tip] items: [this.tip]
}); });
}, },
@ -47,7 +46,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
}); });
BI.createWidget({ BI.createWidget({
type: "bi.default", type: "bi.default",
element: this.container, element: this.element,
items: [this.tree] items: [this.tree]
}); });
}, },
@ -442,6 +441,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
setNode(child.children); setNode(child.children);
}); });
} }
BI.each(this.nodes.getNodes(), function (i, node) { BI.each(this.nodes.getNodes(), function (i, node) {
node.halfCheck = false; node.halfCheck = false;
setNode(node.children); setNode(node.children);

4
src/core/utils/lru.js

@ -79,4 +79,8 @@
? entry ? entry
: entry.value : entry.value
}; };
p.has = function (key) {
return this._keymap[key] != null;
}
})(); })();

706
src/core/utils/xml.js

@ -1,353 +1,353 @@
; // ;
!(function (BI) { // !(function (BI) {
//
if (BI.isIE()) { // if (BI.isIE()) {
XMLSerializer = null; // XMLSerializer = null;
DOMParser = null; // DOMParser = null;
} // }
//
//
var XML = { // var XML = {
Document: { // Document: {
NodeType: { // NodeType: {
ELEMENT: 1, // ELEMENT: 1,
ATTRIBUTE: 2, // ATTRIBUTE: 2,
TEXT: 3, // TEXT: 3,
CDATA_SECTION: 4, // CDATA_SECTION: 4,
ENTITY_REFERENCE: 5, // ENTITY_REFERENCE: 5,
ENTITY: 6, // ENTITY: 6,
PROCESSING_INSTRUCTION: 7, // PROCESSING_INSTRUCTION: 7,
COMMENT: 8, // COMMENT: 8,
DOCUMENT: 9, // DOCUMENT: 9,
DOCUMENT_TYPE: 10, // DOCUMENT_TYPE: 10,
DOCUMENT_FRAGMENT: 11, // DOCUMENT_FRAGMENT: 11,
NOTATION: 12 // NOTATION: 12
} // }
} // }
}; // };
//
XML.ResultType = { // XML.ResultType = {
single: 'single', // single: 'single',
array: 'array' // array: 'array'
}; // };
//
XML.fromString = function (xmlStr) { // XML.fromString = function (xmlStr) {
try { // try {
var parser = new DOMParser(); // var parser = new DOMParser();
return parser.parseFromString(xmlStr, "text/xml"); // return parser.parseFromString(xmlStr, "text/xml");
} catch (e) { // } catch (e) {
var arrMSXML = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0"]; // var arrMSXML = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0"];
for (var i = 0; i < arrMSXML.length; i++) { // for (var i = 0; i < arrMSXML.length; i++) {
try { // try {
var xmlDoc = new ActiveXObject(arrMSXML[i]); // var xmlDoc = new ActiveXObject(arrMSXML[i]);
xmlDoc.setProperty("SelectionLanguage", "XPath"); // xmlDoc.setProperty("SelectionLanguage", "XPath");
xmlDoc.async = false; // xmlDoc.async = false;
xmlDoc.loadXML(xmlStr); // xmlDoc.loadXML(xmlStr);
return xmlDoc; // return xmlDoc;
} catch (xmlError) { // } catch (xmlError) {
} // }
} // }
} // }
}; // };
//
XML.toString = function (xmlNode) { // XML.toString = function (xmlNode) {
if (!BI.isIE()) { // if (!BI.isIE()) {
var xmlSerializer = new XMLSerializer(); // var xmlSerializer = new XMLSerializer();
return xmlSerializer.serializeToString(xmlNode); // return xmlSerializer.serializeToString(xmlNode);
} else // } else
return xmlNode.xml; // return xmlNode.xml;
}; // };
//
XML.getNSResolver = function (str) { // XML.getNSResolver = function (str) {
if (!str) { // if (!str) {
return null; // return null;
} // }
var list = str.split(' '); // var list = str.split(' ');
var namespaces = {}; // var namespaces = {};
for (var i = 0; i < list.length; i++) { // for (var i = 0; i < list.length; i++) {
var pair = list[i].split('='); // var pair = list[i].split('=');
var fix = BI.trim(pair[0]).replace("xmlns:", ""); // var fix = BI.trim(pair[0]).replace("xmlns:", "");
namespaces[fix] = BI.trim(pair[1]).replace(/"/g, "").replace(/'/g, ""); // namespaces[fix] = BI.trim(pair[1]).replace(/"/g, "").replace(/'/g, "");
} // }
return function (prefix) { // return function (prefix) {
return namespaces[prefix]; // return namespaces[prefix];
}; // };
}; // };
//
XML.eval = function (context, xpathExp, resultType, namespaces) { // XML.eval = function (context, xpathExp, resultType, namespaces) {
if ((BI.isIE() && ('undefined' === typeof(context.selectSingleNode) || 'undefined' === typeof(context.selectNodes)))) { // if ((BI.isIE() && ('undefined' === typeof(context.selectSingleNode) || 'undefined' === typeof(context.selectNodes)))) {
return XML.eval2(context, xpathExp, resultType, namespaces); // return XML.eval2(context, xpathExp, resultType, namespaces);
} else { // } else {
if (BI.isIE()) { // if (BI.isIE()) {
namespaces = namespaces ? namespaces : ""; // namespaces = namespaces ? namespaces : "";
var doc = (context.nodeType == XML.Document.NodeType.DOCUMENT) ? context : context.ownerDocument; // var doc = (context.nodeType == XML.Document.NodeType.DOCUMENT) ? context : context.ownerDocument;
doc.setProperty("SelectionNamespaces", namespaces); // doc.setProperty("SelectionNamespaces", namespaces);
var result; // var result;
if (resultType == this.ResultType.single) { // if (resultType == this.ResultType.single) {
result = context.selectSingleNode(xpathExp); // result = context.selectSingleNode(xpathExp);
} else { // } else {
result = context.selectNodes(xpathExp) || []; // result = context.selectNodes(xpathExp) || [];
} // }
doc.setProperty("SelectionNamespaces", ""); // doc.setProperty("SelectionNamespaces", "");
return result; // return result;
} else { // } else {
var node = context; // var node = context;
var xmlDoc = (context.nodeName.indexOf("document") == -1) ? context.ownerDocument : 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 retType = (resultType == this.ResultType.single) ? XPathResult.FIRST_ORDERED_NODE_TYPE : XPathResult.ANY_TYPE;
var col = xmlDoc.evaluate(xpathExp, node, XML.getNSResolver(namespaces), retType, null); // var col = xmlDoc.evaluate(xpathExp, node, XML.getNSResolver(namespaces), retType, null);
//
if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE) { // if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE) {
return col.singleNodeValue; // return col.singleNodeValue;
} else { // } else {
var thisColMemb = col.iterateNext(); // var thisColMemb = col.iterateNext();
var rowsCol = []; // var rowsCol = [];
while (thisColMemb) { // while (thisColMemb) {
rowsCol[rowsCol.length] = thisColMemb; // rowsCol[rowsCol.length] = thisColMemb;
thisColMemb = col.iterateNext(); // thisColMemb = col.iterateNext();
} // }
return rowsCol; // return rowsCol;
} // }
} // }
} // }
}; // };
//
XML.eval2 = function (context, xpathExp, resultType, namespaces) { // XML.eval2 = function (context, xpathExp, resultType, namespaces) {
if (resultType !== "single" && resultType !== undefined && resultType !== null) { // if (resultType !== "single" && resultType !== undefined && resultType !== null) {
throw new Error("justep.SimpleXML.eval only be resultType='single', not" + resultType); // throw new Error("justep.SimpleXML.eval only be resultType='single', not" + resultType);
} // }
//
if (context === null || context === undefined || xpathExp === null || xpathExp === undefined) { // if (context === null || context === undefined || xpathExp === null || xpathExp === undefined) {
return context; // return context;
} // }
//
if (context.nodeType == XML.Document.NodeType.DOCUMENT) { // if (context.nodeType == XML.Document.NodeType.DOCUMENT) {
context = context.documentElement; // context = context.documentElement;
} // }
//
var childs, i; // var childs, i;
if (xpathExp.indexOf("/") != -1) { // if (xpathExp.indexOf("/") != -1) {
var items = xpathExp.split("/"); // var items = xpathExp.split("/");
var isAbs = xpathExp.substring(0, 1) == "/"; // var isAbs = xpathExp.substring(0, 1) == "/";
for (i = 0; i < items.length; i++) { // for (i = 0; i < items.length; i++) {
var item = items[i]; // var item = items[i];
if (item === "") { // if (item === "") {
continue; // continue;
} else { // } else {
var next = null; // var next = null;
var ii = i + 1; // var ii = i + 1;
for (; ii < items.length; ii++) { // for (; ii < items.length; ii++) {
if (next === null) { // if (next === null) {
next = items[ii]; // next = items[ii];
} else { // } else {
next = next + "/" + items[ii]; // next = next + "/" + items[ii];
} // }
} // }
//
if (item == ".") { // if (item == ".") {
return this.eval(context, next, resultType); // return this.eval(context, next, resultType);
//
} else if (item == "..") { // } else if (item == "..") {
return this.eval2(context.parentNode, next, resultType); // return this.eval2(context.parentNode, next, resultType);
//
} else if (item == "*") { // } else if (item == "*") {
if (isAbs) { // if (isAbs) {
return this.eval2(context, next, resultType); // return this.eval2(context, next, resultType);
//
} else { // } else {
childs = context.childNodes; // childs = context.childNodes;
for (var j = 0; j < childs.length; j++) { // for (var j = 0; j < childs.length; j++) {
var tmp = this.eval2(childs[j], next, resultType); // var tmp = this.eval2(childs[j], next, resultType);
if (tmp !== null) { // if (tmp !== null) {
return tmp; // return tmp;
} // }
} // }
return null; // return null;
} // }
//
} else { // } else {
if (isAbs) { // if (isAbs) {
if (context.nodeName == item) { // if (context.nodeName == item) {
return this.eval2(context, next, resultType); // return this.eval2(context, next, resultType);
} else { // } else {
return null; // return null;
} // }
} else { // } else {
var child = this.getChildByName(context, item); // var child = this.getChildByName(context, item);
if (child !== null) { // if (child !== null) {
return this.eval2(child, next, resultType); // return this.eval2(child, next, resultType);
} else { // } else {
return null; // return null;
} // }
//
} // }
} // }
//
} // }
} // }
//
return null; // return null;
//
} else { // } else {
if ("text()" == xpathExp) { // if ("text()" == xpathExp) {
childs = context.childNodes; // childs = context.childNodes;
for (i = 0; i < childs.length; i++) { // for (i = 0; i < childs.length; i++) {
if (childs[i].nodeType == XML.Document.NodeType.TEXT) { // if (childs[i].nodeType == XML.Document.NodeType.TEXT) {
return childs[i]; // return childs[i];
} // }
} // }
return null; // return null;
} else { // } else {
return this.getChildByName(context, xpathExp); // return this.getChildByName(context, xpathExp);
} // }
} // }
}; // };
//
XML.getChildByName = function (context, name) { // XML.getChildByName = function (context, name) {
if (context === null || context === undefined || name === null || name === undefined) { // if (context === null || context === undefined || name === null || name === undefined) {
return null; // return null;
} // }
//
if (context.nodeType == XML.Document.NodeType.DOCUMENT) { // if (context.nodeType == XML.Document.NodeType.DOCUMENT) {
context = context.documentElement; // context = context.documentElement;
} // }
//
var childs = context.childNodes; // var childs = context.childNodes;
for (var i = 0; i < childs.length; i++) { // for (var i = 0; i < childs.length; i++) {
if (childs[i].nodeType == XML.Document.NodeType.ELEMENT && (childs[i].nodeName == name || name == "*")) { // if (childs[i].nodeType == XML.Document.NodeType.ELEMENT && (childs[i].nodeName == name || name == "*")) {
return childs[i]; // return childs[i];
} // }
} // }
//
return null; // return null;
}; // };
//
XML.appendChildren = function (context, xpathExp, nodes, isBefore) { // XML.appendChildren = function (context, xpathExp, nodes, isBefore) {
nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; // nodes = (typeof nodes.length != "undefined") ? nodes : [nodes];
var finded = this.eval(context, xpathExp); // var finded = this.eval(context, xpathExp);
var count = finded.length; // var count = finded.length;
for (var i = 0; i < count; i++) { // for (var i = 0; i < count; i++) {
if (isBefore && finded[i].firstNode) { // if (isBefore && finded[i].firstNode) {
this._insertBefore(finded[i], nodes, finded[i].firstNode); // this._insertBefore(finded[i], nodes, finded[i].firstNode);
} else { // } else {
for (var j = 0; j < nodes.length; j++) { // for (var j = 0; j < nodes.length; j++) {
finded[i].appendChild(nodes[j]); // finded[i].appendChild(nodes[j]);
} // }
} // }
} // }
return count; // return count;
}; // };
//
XML.removeNodes = function (context, xpathExp) { // XML.removeNodes = function (context, xpathExp) {
var nodes = this.eval(context, xpathExp); // var nodes = this.eval(context, xpathExp);
for (var i = 0; i < nodes.length; i++) { // for (var i = 0; i < nodes.length; i++) {
nodes[i].parentNode.removeChild(nodes[i]); // nodes[i].parentNode.removeChild(nodes[i]);
} // }
}; // };
//
XML._insertBefore = function (parent, newchildren, refchild) { // XML._insertBefore = function (parent, newchildren, refchild) {
for (var i = 0; i < newchildren.length; i++) { // for (var i = 0; i < newchildren.length; i++) {
parent.insertBefore(newchildren[i], refchild); // parent.insertBefore(newchildren[i], refchild);
} // }
}; // };
//
XML.insertNodes = function (context, xpathExp, nodes, isBefore) { // XML.insertNodes = function (context, xpathExp, nodes, isBefore) {
nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; // nodes = (typeof nodes.length != "undefined") ? nodes : [nodes];
var finded = this.eval(context, xpathExp); // var finded = this.eval(context, xpathExp);
var count = finded.length; // var count = finded.length;
for (var i = 0; i < count; i++) { // for (var i = 0; i < count; i++) {
var refnode = (isBefore) ? finded[i] : finded[i].nextSibling; // var refnode = (isBefore) ? finded[i] : finded[i].nextSibling;
this._insertBefore(finded[i].parentNode, nodes, refnode); // this._insertBefore(finded[i].parentNode, nodes, refnode);
} // }
return count; // return count;
}; // };
//
XML.replaceNodes = function (context, xpathExp, nodes) { // XML.replaceNodes = function (context, xpathExp, nodes) {
nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; // nodes = (typeof nodes.length != "undefined") ? nodes : [nodes];
var finded = this.eval(context, xpathExp); // var finded = this.eval(context, xpathExp);
var count = finded.length; // var count = finded.length;
for (var i = 0; i < count; i++) { // for (var i = 0; i < count; i++) {
var refnode = finded[i]; // var refnode = finded[i];
var parent = refnode.parentNode; // var parent = refnode.parentNode;
this._insertBefore(parent, nodes, refnode); // this._insertBefore(parent, nodes, refnode);
parent.removeChild(refnode); // parent.removeChild(refnode);
} // }
return count; // return count;
}; // };
//
XML.setNodeText = function (context, xpathExp, text) { // XML.setNodeText = function (context, xpathExp, text) {
var finded = this.eval(context, xpathExp, this.ResultType.single); // var finded = this.eval(context, xpathExp, this.ResultType.single);
if (finded === null) { // if (finded === null) {
return; // return;
} // }
if (finded.nodeType == XML.Document.NodeType.ELEMENT) { // if (finded.nodeType == XML.Document.NodeType.ELEMENT) {
var textNode = this.eval(finded, "./text()", this.ResultType.single); // var textNode = this.eval(finded, "./text()", this.ResultType.single);
if (!textNode) { // if (!textNode) {
textNode = finded.ownerDocument.createTextNode(""); // textNode = finded.ownerDocument.createTextNode("");
finded.appendChild(textNode); // finded.appendChild(textNode);
} // }
textNode.nodeValue = text; // textNode.nodeValue = text;
} else { // } else {
finded.nodeValue = text; // finded.nodeValue = text;
} // }
return; // return;
}; // };
//
XML.getNodeText = function (context, xpathExp, defaultValue) { // XML.getNodeText = function (context, xpathExp, defaultValue) {
var finded = xpathExp ? this.eval(context, xpathExp, this.ResultType.single) : context; // var finded = xpathExp ? this.eval(context, xpathExp, this.ResultType.single) : context;
if (finded && (finded.nodeType == XML.Document.NodeType.ELEMENT)) { // if (finded && (finded.nodeType == XML.Document.NodeType.ELEMENT)) {
finded = this.eval(finded, "./text()", this.ResultType.single); // finded = this.eval(finded, "./text()", this.ResultType.single);
} // }
return (finded && finded.nodeValue) ? "" + finded.nodeValue : (defaultValue !== undefined) ? defaultValue : null; // return (finded && finded.nodeValue) ? "" + finded.nodeValue : (defaultValue !== undefined) ? defaultValue : null;
}; // };
//
XML.Namespaces = { // XML.Namespaces = {
XMLSCHEMA: "http://www.w3.org/2001/XMLSchema#", // XMLSCHEMA: "http://www.w3.org/2001/XMLSchema#",
XMLSCHEMA_STRING: "http://www.w3.org/2001/XMLSchema#String", // XMLSCHEMA_STRING: "http://www.w3.org/2001/XMLSchema#String",
XMLSCHEMA_LONG: "http://www.w3.org/2001/XMLSchema#Long", // XMLSCHEMA_LONG: "http://www.w3.org/2001/XMLSchema#Long",
XMLSCHEMA_INTEGER: 'http://www.w3.org/2001/XMLSchema#Integer', // XMLSCHEMA_INTEGER: 'http://www.w3.org/2001/XMLSchema#Integer',
XMLSCHEMA_FLOAT: 'http://www.w3.org/2001/XMLSchema#Float', // XMLSCHEMA_FLOAT: 'http://www.w3.org/2001/XMLSchema#Float',
XMLSCHEMA_DOUBLE: 'http://www.w3.org/2001/XMLSchema#Double', // XMLSCHEMA_DOUBLE: 'http://www.w3.org/2001/XMLSchema#Double',
XMLSCHEMA_DECIMAL: 'http://www.w3.org/2001/XMLSchema#Decimal', // XMLSCHEMA_DECIMAL: 'http://www.w3.org/2001/XMLSchema#Decimal',
XMLSCHEMA_DATE: 'http://www.w3.org/2001/XMLSchema#Date', // XMLSCHEMA_DATE: 'http://www.w3.org/2001/XMLSchema#Date',
XMLSCHEMA_TIME: 'http://www.w3.org/2001/XMLSchema#Time', // XMLSCHEMA_TIME: 'http://www.w3.org/2001/XMLSchema#Time',
XMLSCHEMA_DATETIME: 'http://www.w3.org/2001/XMLSchema#DateTime', // XMLSCHEMA_DATETIME: 'http://www.w3.org/2001/XMLSchema#DateTime',
XMLSCHEMA_BOOLEAN: 'http://www.w3.org/2001/XMLSchema#Boolean', // XMLSCHEMA_BOOLEAN: 'http://www.w3.org/2001/XMLSchema#Boolean',
XMLSCHEMA_SYMBOL: 'http://www.w3.org/2001/XMLSchema#Symbol', // XMLSCHEMA_SYMBOL: 'http://www.w3.org/2001/XMLSchema#Symbol',
JUSTEPSCHEMA: "http://www.justep.com/xbiz#", // JUSTEPSCHEMA: "http://www.justep.com/xbiz#",
RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#", // RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
JUSTEP: "http://www.justep.com/x5#", // JUSTEP: "http://www.justep.com/x5#",
'get': function (type) { // 'get': function (type) {
type = type ? type.toLowerCase() : "string"; // type = type ? type.toLowerCase() : "string";
if ("string" == type) { // if ("string" == type) {
return XML.Namespaces.XMLSCHEMA_STRING; // return XML.Namespaces.XMLSCHEMA_STRING;
} // }
else if ("integer" == type) { // else if ("integer" == type) {
return XML.Namespaces.XMLSCHEMA_INTEGER; // return XML.Namespaces.XMLSCHEMA_INTEGER;
} // }
else if ("long" == type) { // else if ("long" == type) {
return XML.Namespaces.XMLSCHEMA_LONG; // return XML.Namespaces.XMLSCHEMA_LONG;
} // }
else if ("float" == type) { // else if ("float" == type) {
return XML.Namespaces.XMLSCHEMA_FLOAT; // return XML.Namespaces.XMLSCHEMA_FLOAT;
} // }
else if ("double" == type) { // else if ("double" == type) {
return XML.Namespaces.XMLSCHEMA_DOUBLE; // return XML.Namespaces.XMLSCHEMA_DOUBLE;
} // }
else if ("decimal" == type) { // else if ("decimal" == type) {
return XML.Namespaces.XMLSCHEMA_DECIMAL; // return XML.Namespaces.XMLSCHEMA_DECIMAL;
} // }
else if ("date" == type) { // else if ("date" == type) {
return XML.Namespaces.XMLSCHEMA_DATE; // return XML.Namespaces.XMLSCHEMA_DATE;
} // }
else if ("time" == type) { // else if ("time" == type) {
return XML.Namespaces.XMLSCHEMA_TIME; // return XML.Namespaces.XMLSCHEMA_TIME;
} // }
else if ("datetime" == type) { // else if ("datetime" == type) {
return XML.Namespaces.XMLSCHEMA_DATETIME; // return XML.Namespaces.XMLSCHEMA_DATETIME;
} // }
else if ("boolean" == type) { // else if ("boolean" == type) {
return XML.Namespaces.XMLSCHEMA_BOOLEAN; // return XML.Namespaces.XMLSCHEMA_BOOLEAN;
} // }
} // }
}; // };
})(BI); // })(BI);

8
src/css/base/single/text.css

@ -3,5 +3,13 @@
overflow-x: hidden; overflow-x: hidden;
overflow-y: hidden; overflow-y: hidden;
white-space: nowrap; 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; word-break: break-word;
} }

1
src/less/base/single/text.less

@ -2,5 +2,6 @@
.bi-text { .bi-text {
.overflow-dot(); .overflow-dot();
.box-sizing(border-box);
word-break: break-word; word-break: break-word;
} }

0
src/core/utils/set.js → src/polyfill/set.js

2
src/polyfill/sort.js

@ -1,5 +1,5 @@
//修复ie9下sort方法的bug //修复ie9下sort方法的bug
!function (window) { ;!function (window) {
var ua = window.navigator.userAgent.toLowerCase(), var ua = window.navigator.userAgent.toLowerCase(),
reg = /msie|applewebkit.+safari/; reg = /msie|applewebkit.+safari/;
if (reg.test(ua)) { if (reg.test(ua)) {

3
src/widget/finetuningnumbereditor/finetuning.number.editor.js

@ -15,6 +15,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
this.editor = BI.createWidget({ this.editor = BI.createWidget({
type: "bi.sign_editor", type: "bi.sign_editor",
height: o.height,
value: this._alertInEditorValue(o.value), value: this._alertInEditorValue(o.value),
errorText: BI.i18nText("BI-Please_Input_Natural_Number"), errorText: BI.i18nText("BI-Please_Input_Natural_Number"),
validationChecker: function(v){ validationChecker: function(v){
@ -62,7 +63,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, {
el: this.bottomBtn el: this.bottomBtn
}] }]
}, },
width: 30 width: 23
}] }]
}); });
}, },

6
src/widget/sequencetable/sequencetable.js

@ -141,12 +141,6 @@ BI.SequenceTable = BI.inherit(BI.Widget, {
_populate: function () { _populate: function () {
var o = this.options; var o = this.options;
this.sequence.attr({
items: o.items,
header: o.header,
crossItems: o.crossItems,
crossHeader: o.crossHeader
});
if (o.showSequence === true) { if (o.showSequence === true) {
this.sequence.setVisible(true); this.sequence.setVisible(true);
this.table.element.css("left", "60px"); this.table.element.css("left", "60px");

Loading…
Cancel
Save