diff --git a/dist/fix/fix.js b/dist/fix/fix.js index 7a68bb52c..52a6a7907 100644 --- a/dist/fix/fix.js +++ b/dist/fix/fix.js @@ -11,47 +11,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons return typeof Ctor === 'function' && /native code/.test(Ctor.toString()); } - var rhashcode = /\d\.\d{4}/; - - //生成UUID http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript - function makeHashCode(prefix) { - /* istanbul ignore next*/ - prefix = prefix || 'bi'; - /* istanbul ignore next*/ - return String(Math.random() + Math.random()).replace(rhashcode, prefix); - } - var hasProto = '__proto__' in {}; - var isIE = function isIE() { - if (typeof navigator === "undefined") { - return false; - } - return (/(msie|trident)/i.test(navigator.userAgent.toLowerCase()) - ); - }; - - var getIEVersion = function getIEVersion() { - var version = 0; - if (typeof navigator === "undefined") { - return false; - } - var agent = navigator.userAgent.toLowerCase(); - var v1 = agent.match(/(?:msie\s([\w.]+))/); - var v2 = agent.match(/(?:trident.*rv:([\w.]+))/); - if (v1 && v2 && v1[1] && v2[1]) { - version = Math.max(v1[1] * 1, v2[1] * 1); - } else if (v1 && v1[1]) { - version = v1[1] * 1; - } else if (v2 && v2[1]) { - version = v2[1] * 1; - } else { - version = 0; - } - return version; - }; - var isIE9Below = isIE() && getIEVersion() < 9; - var _toString = Object.prototype.toString; function isPlainObject(obj) { @@ -266,7 +227,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons var createViewModel = Object.defineProperties; var defineProperty = void 0; - var timeBucket = new Date() - 0; /* istanbul ignore if*/ if (!canHideProperty) { if ('__defineGetter__' in {}) { @@ -291,76 +251,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons return obj; }; } - /* istanbul ignore if*/ - if (isIE9Below) { - var VBClassPool = {}; - window.execScript([// jshint ignore:line - 'Function parseVB(code)', '\tExecuteGlobal(code)', 'End Function' //转换一段文本为VB代码 - ].join('\n'), 'VBScript'); - - var VBMediator = function VBMediator(instance, accessors, name, value) { - // jshint ignore:line - var accessor = accessors[name]; - if (arguments.length === 4) { - accessor.set.call(instance, value); - } else { - return accessor.get.call(instance); - } - }; - createViewModel = function createViewModel(name, accessors, properties) { - // jshint ignore:line - var buffer = []; - buffer.push('\tPrivate [$vbsetter]', '\tPublic [$accessors]', '\tPublic Default Function [$vbthis](ac' + timeBucket + ', s' + timeBucket + ')', '\t\tSet [$accessors] = ac' + timeBucket + ': set [$vbsetter] = s' + timeBucket, '\t\tSet [$vbthis] = Me', //链式调用 - '\tEnd Function'); - //添加普通属性,因为VBScript对象不能像JS那样随意增删属性,必须在这里预先定义好 - var uniq = { - $vbthis: true, - $vbsetter: true, - $accessors: true - }; - for (name in $$skipArray) { - if (!uniq[name]) { - buffer.push('\tPublic [' + name + ']'); - uniq[name] = true; - } - } - //添加访问器属性 - for (name in accessors) { - if (uniq[name]) { - continue; - } - uniq[name] = true; - buffer.push( - //由于不知对方会传入什么,因此set, let都用上 - '\tPublic Property Let [' + name + '](val' + timeBucket + ')', //setter - '\t\tCall [$vbsetter](Me, [$accessors], "' + name + '", val' + timeBucket + ')', '\tEnd Property', '\tPublic Property Set [' + name + '](val' + timeBucket + ')', //setter - '\t\tCall [$vbsetter](Me, [$accessors], "' + name + '", val' + timeBucket + ')', '\tEnd Property', '\tPublic Property Get [' + name + ']', //getter - '\tOn Error Resume Next', //必须优先使用set语句,否则它会误将数组当字符串返回 - '\t\tSet[' + name + '] = [$vbsetter](Me, [$accessors],"' + name + '")', '\tIf Err.Number <> 0 Then', '\t\t[' + name + '] = [$vbsetter](Me, [$accessors],"' + name + '")', '\tEnd If', '\tOn Error Goto 0', '\tEnd Property'); - } - - for (name in properties) { - if (!uniq[name]) { - uniq[name] = true; - buffer.push('\tPublic [' + name + ']'); - } - } - - buffer.push('\tPublic [hasOwnProperty]'); - buffer.push('End Class'); - var body = buffer.join('\r\n'); - var className = VBClassPool[body]; - if (!className) { - className = makeHashCode('VBClass'); - window.parseVB('Class ' + className + body); - window.parseVB(['Function ' + className + 'Factory(acc, vbm)', //创建实例并传入两个关键的参数 - '\tDim o', '\tSet o = (New ' + className + ')(acc, vbm)', '\tSet ' + className + 'Factory = o', 'End Function'].join('\r\n')); - VBClassPool[body] = className; - } - var ret = window[className + 'Factory'](accessors, VBMediator); //得到其产品 - return ret; //得到其产品 - }; - } } var createViewModel$1 = createViewModel; @@ -700,11 +590,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons } else { this.model = this.walk(value); } - if (isIE9Below) { - this.model['__ob__'] = this; - } else { - def(this.model, "__ob__", this); - } + def(this.model, "__ob__", this); } Observer.prototype.walk = function walk(obj) { diff --git a/src/case/tree/treeexpander/tree.expander.popup.js b/src/case/tree/treeexpander/tree.expander.popup.js index bf2c6addb..96f9fe259 100644 --- a/src/case/tree/treeexpander/tree.expander.popup.js +++ b/src/case/tree/treeexpander/tree.expander.popup.js @@ -22,8 +22,8 @@ this.popupView.on(BI.Controller.EVENT_CHANGE, function () { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); - this.popupView.element.css("margin-left", -offset * o.layer); - this.element.css("margin-left", offset * o.layer); + this.popupView.element.css("margin-left", -offset * (o.layer + 1)); + this.element.css("margin-left", offset * (o.layer + 1)); return { type: "bi.vertical", diff --git a/src/case/ztree/0.treeview.js b/src/case/ztree/0.treeview.js index 2ee02010f..2ba474460 100644 --- a/src/case/ztree/0.treeview.js +++ b/src/case/ztree/0.treeview.js @@ -110,7 +110,7 @@ BI.TreeView = BI.inherit(BI.Pane, { }; var className = "dark", perTime = 100; - function onClick (event, treeId, treeNode) { + function onClick(event, treeId, treeNode) { // 当前点击节点的状态是半选,且为true_part, 则将其改为false_part,使得点击半选后切换到的是全选 var checked = treeNode.checked; var status = treeNode.getCheckStatus(); @@ -121,7 +121,7 @@ BI.TreeView = BI.inherit(BI.Pane, { self.nodes.checkNode(treeNode, !checked, true, true); } - function getUrl (treeId, treeNode) { + function getUrl(treeId, treeNode) { var parentNode = self._getParentValues(treeNode); treeNode.times = treeNode.times || 1; var param = "id=" + treeNode.id @@ -132,7 +132,7 @@ BI.TreeView = BI.inherit(BI.Pane, { return "&" + param; } - function beforeExpand (treeId, treeNode) { + function beforeExpand(treeId, treeNode) { if (!treeNode.isAjaxing) { if (!treeNode.children) { treeNode.times = 1; @@ -147,7 +147,7 @@ BI.TreeView = BI.inherit(BI.Pane, { } - function onAsyncSuccess (event, treeId, treeNode, msg) { + function onAsyncSuccess(event, treeId, treeNode, msg) { treeNode.halfCheck = false; if (!msg || msg.length === 0 || /^[\s,\S]*<\/html>$/gi.test(msg) || self._stop) { return; @@ -170,14 +170,14 @@ BI.TreeView = BI.inherit(BI.Pane, { } } - function onAsyncError (event, treeId, treeNode, XMLHttpRequest, textStatus, errorThrown) { + function onAsyncError(event, treeId, treeNode, XMLHttpRequest, textStatus, errorThrown) { var zTree = self.nodes; BI.Msg.toast("Error!", "warning"); // treeNode.icon = ""; // zTree.updateNode(treeNode); } - function ajaxGetNodes (treeNode, reloadType) { + function ajaxGetNodes(treeNode, reloadType) { var zTree = self.nodes; if (reloadType == "refresh") { zTree.updateNode(treeNode); // 刷新一下当前节点,如果treeNode.xxx被改了的话 @@ -185,7 +185,7 @@ BI.TreeView = BI.inherit(BI.Pane, { zTree.reAsyncChildNodes(treeNode, reloadType, true); // 强制加载子节点,reloadType === refresh为先清空再加载,否则为追加到现有子节点之后 } - function beforeCheck (treeId, treeNode) { + function beforeCheck(treeId, treeNode) { if (treeNode.disabled) { return false; } @@ -195,7 +195,7 @@ BI.TreeView = BI.inherit(BI.Pane, { if (treeNode.checked === true) { // 将展开的节点halfCheck设为false,解决展开节点存在halfCheck=true的情况 guy // 所有的半选状态都需要取消halfCheck=true的情况 - function track (children) { + function track(children) { BI.each(children, function (i, ch) { if (ch.halfCheck === true) { ch.halfCheck = false; @@ -217,24 +217,18 @@ BI.TreeView = BI.inherit(BI.Pane, { } } - function onCheck (event, treeId, treeNode) { + function onCheck(event, treeId, treeNode) { if (treeNode.disabled) { return false; } self._selectTreeNode(treeId, treeNode); } - function onExpand (event, treeId, treeNode) { - if (treeNode.disabled) { - return false; - } + function onExpand(event, treeId, treeNode) { treeNode.halfCheck = false; } - function onCollapse (event, treeId, treeNode) { - if (treeNode.disabled) { - return false; - } + function onCollapse(event, treeId, treeNode) { } return setting; @@ -325,7 +319,7 @@ BI.TreeView = BI.inherit(BI.Pane, { var hashMap = {}; var rootNoots = this.nodes.getNodes(); track(rootNoots); // 可以看到这个方法没有递归调用,所以在_getHalfSelectedValues中需要关心全选的节点 - function track (nodes) { + function track(nodes) { BI.each(nodes, function (i, node) { var checkState = node.getCheckStatus(); if (checkState.checked === true || checkState.half === true) { @@ -503,7 +497,7 @@ BI.TreeView = BI.inherit(BI.Pane, { }, checkAll: function (checked) { - function setNode (children) { + function setNode(children) { BI.each(children, function (i, child) { child.halfCheck = false; setNode(child.children); @@ -545,7 +539,7 @@ BI.TreeView = BI.inherit(BI.Pane, { BI.each(values, function (v, op) { var nodes = treeObj.getNodesByParam(param, v, null); BI.each(nodes, function (j, node) { - BI.extend(node, {checked: true}, op); + BI.extend(node, { checked: true }, op); treeObj.updateNode(node); }); }); diff --git a/src/case/ztree/1.asynctree.js b/src/case/ztree/1.asynctree.js index 261f2d112..0bc90c55b 100644 --- a/src/case/ztree/1.asynctree.js +++ b/src/case/ztree/1.asynctree.js @@ -58,7 +58,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, { } }; - function onClick (event, treeId, treeNode) { + function onClick(event, treeId, treeNode) { if (treeNode.disabled) { return false; } @@ -72,7 +72,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, { zTree.checkNode(treeNode, !checked, true, true); } - function beforeCheck (treeId, treeNode) { + function beforeCheck(treeId, treeNode) { if (treeNode.disabled) { return false; } @@ -82,7 +82,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, { if (treeNode.checked === true) { // 将展开的节点halfCheck设为false,解决展开节点存在halfCheck=true的情况 guy // 所有的半选状态都需要取消halfCheck=true的情况 - function track (children) { + function track(children) { BI.each(children, function (i, ch) { ch.halfCheck = false; track(ch.children); @@ -103,31 +103,22 @@ BI.AsyncTree = BI.inherit(BI.TreeView, { } } - function beforeExpand (treeId, treeNode) { - if (treeNode.disabled) { - return false; - } + function beforeExpand(treeId, treeNode) { self._beforeExpandNode(treeId, treeNode); } - function onCheck (event, treeId, treeNode) { + function onCheck(event, treeId, treeNode) { if (treeNode.disabled) { return false; } self._selectTreeNode(treeId, treeNode); } - function onExpand (event, treeId, treeNode) { - if (treeNode.disabled) { - return false; - } + function onExpand(event, treeId, treeNode) { treeNode.halfCheck = false; } - function onCollapse (event, treeId, treeNode) { - if (treeNode.disabled) { - return false; - } + function onCollapse(event, treeId, treeNode) { treeNode.halfCheck = false; } @@ -216,7 +207,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, { track([], valueA, valueB); track([], valueB, valueA); - function track (parent, node, compare) { + function track(parent, node, compare) { BI.each(node, function (n, item) { if (BI.isNull(compare[n])) { self._addTreeNode(map, parent, n, item); diff --git a/src/less/base/tree/tree.expander.less b/src/less/base/tree/tree.expander.less index 04bdd64ac..b0e6ce76a 100644 --- a/src/less/base/tree/tree.expander.less +++ b/src/less/base/tree/tree.expander.less @@ -1,28 +1,42 @@ @import "../../index.less"; -@import "../../image.less"; @import "../../lib/icon.less"; -.bi-tree-expander-popup.line:before { - position: absolute; - content: ""; - height: 100%; - width: 24px; - .imagePath(@icon-tree-vertical-line-1, 0, 0, repeat-y); -} -.bi-tree-expander-popup.line.solid:before { - .imagePath(@icon-tree-solid-vertical-line-1, 0, 0, repeat-y); - width: 24px; - left: 8px; +.bi-tree-expander-popup.line { + + &:before { + border-left: 1px dashed @border-color-dark-gray-line; + position: absolute; + content: ""; + height: 100%; + left: -1px; + } + + &.solid:before { + border-left: 1px solid @border-color-dark-gray-line; + position: absolute; + content: ""; + height: 100%; + left: -1px; + } } .bi-theme-dark { - .bi-tree-expander-popup.line:before { - width: 24px; - .imagePath(@icon-tree-vertical-line-1-theme-dark, 0, 0, repeat-y); - } - .bi-tree-expander-popup.line.solid:before { - .imagePath(@icon-tree-solid-vertical-line-1-theme-dark, 0, 0, repeat-y); - width: 24px; - left: 8px; + .bi-tree-expander-popup.line { + + &:before { + border-left: 1px dashed @border-color-dark-gray-line-theme-dark; + position: absolute; + content: ""; + height: 100%; + left: -1px; + } + + &.solid:before { + border-left: 1px solid @border-color-dark-gray-line-theme-dark; + position: absolute; + content: ""; + height: 100%; + left: -1px; + } } }