From a6e85eb8d312d486a8b7466f8b6c556bc981b89b Mon Sep 17 00:00:00 2001 From: zsmj Date: Wed, 18 May 2022 10:22:25 +0800 Subject: [PATCH 1/3] =?UTF-8?q?DESIGN-4160=20feat:=20=E5=A4=8D=E9=80=89?= =?UTF-8?q?=E6=A0=91=E8=8A=82=E7=82=B9=EF=BC=8C=E6=9F=90=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E6=94=AF=E6=8C=81=E7=81=B0=E5=8C=96=EF=BC=8C?= =?UTF-8?q?=E5=A4=8D=E9=80=89=E6=A1=86=E4=B9=9F=E7=81=B0=E5=8C=96=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E4=B8=94=E5=89=8D=E8=BE=B9=E7=9A=84=E5=B1=95=E5=BC=80?= =?UTF-8?q?=E6=94=B6=E8=B5=B7=E6=98=AF=E6=AD=A3=E5=B8=B8=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 即disabled属性不再限制展开收起 --- src/case/ztree/0.treeview.js | 34 ++++++++++++++-------------------- src/case/ztree/1.asynctree.js | 25 ++++++++----------------- 2 files changed, 22 insertions(+), 37 deletions(-) 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); From 7403bb8aad99941ff9d2f8f1d0a147ec086fbf19 Mon Sep 17 00:00:00 2001 From: zsmj Date: Wed, 18 May 2022 11:03:06 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=97=A0JIRA=20=E6=95=B4=E7=90=86=E5=8E=BB?= =?UTF-8?q?=E6=8E=89=E6=97=A0=E7=94=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/fix/fix.js | 116 +----------------------------------------------- 1 file changed, 1 insertion(+), 115 deletions(-) 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) { From 02430532f0dd251b821922f3522c0c714ba6ba7b Mon Sep 17 00:00:00 2001 From: zsmj Date: Wed, 18 May 2022 18:38:11 +0800 Subject: [PATCH 3/3] =?UTF-8?q?JSY-17842=20fix:=20=E8=A7=A3=E5=86=B3LIST?= =?UTF-8?q?=5FITEM=5FHEIGHT=E5=AF=B9=E7=BA=BF=E7=9A=84=E5=BD=B1=E5=93=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tree/treeexpander/tree.expander.popup.js | 4 +- src/less/base/tree/tree.expander.less | 54 ++++++++++++------- 2 files changed, 36 insertions(+), 22 deletions(-) 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/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; + } } }