diff --git a/src/case/ztree/0.treeview.js b/src/case/ztree/0.treeview.js index 5bf3188dc..66544e347 100644 --- a/src/case/ztree/0.treeview.js +++ b/src/case/ztree/0.treeview.js @@ -140,7 +140,9 @@ BI.TreeView = BI.inherit(BI.Pane, { } return true; } - BI.Msg.toast("Please Wait。", "warning"); // 不展开节点,也不触发onExpand事件 + BI.Msg.toast("Please Wait。", { + level: "warning" + }); // 不展开节点,也不触发onExpand事件 return false; } @@ -184,6 +186,9 @@ BI.TreeView = BI.inherit(BI.Pane, { } function beforeCheck (treeId, treeNode) { + if (treeNode.disabled) { + return false; + } // 下面主动修改了node的halfCheck属性, 节点属性的判断依赖halfCheck,改之前就获取一下 var status = treeNode.getCheckStatus(); treeNode.halfCheck = false; @@ -213,14 +218,23 @@ BI.TreeView = BI.inherit(BI.Pane, { } function onCheck (event, treeId, treeNode) { + if (treeNode.disabled) { + return false; + } self._selectTreeNode(treeId, treeNode); } function onExpand (event, treeId, treeNode) { + if (treeNode.disabled) { + return false; + } treeNode.halfCheck = false; } function onCollapse (event, treeId, treeNode) { + if (treeNode.disabled) { + return false; + } } return setting; @@ -335,22 +349,33 @@ BI.TreeView = BI.inherit(BI.Pane, { var ns = BI.Tree.arrayFormat(nodes); BI.each(ns, function (i, n) { n.isParent = n.isParent || n.parent; - n.value = BI.isUndefined(n.value) ? n.text : n.value; - n.text = BI.isUndefined(n.text) ? n.value : n.text; - if (n.text === null) { - n.text = ""; - } + // n.value = BI.isUndefined(n.value) ? n.text : n.value; + // n.text = BI.isUndefined(n.text) ? n.value : n.text; + // if (n.text === null) { + // n.text = ""; + // } if (BI.isNull(n.title)) { n.title = n.text; } - // 处理标红 - if (BI.isNotNull(n.text)) { - if (BI.isKey(o.paras.keyword)) { - n.text = BI.$("
").__textKeywordMarked__(BI.Text.formatText(n.text + ""), o.paras.keyword, n.py).html(); - } else { - n.text = BI.htmlEncode(BI.Text.formatText(n.text + "")); - } - } + var text = BI.createWidget(BI.extend({ + type: "bi.text", + cls: "tree-node-text", + css: { + display: "inline" + }, + root: true + }, n)); + var fragment = BI.Widget._renderEngine.createElement("
"); + fragment.append(text.element[0]); + n.text = fragment.html(); + // // 处理标红 + // if (BI.isNotNull(n.text)) { + // if (BI.isKey(o.paras.keyword)) { + // n.text = BI.$("
").__textKeywordMarked__(BI.Text.formatText(n.text + ""), o.paras.keyword, n.py).html(); + // } else { + // n.text = BI.htmlEncode(BI.Text.formatText(n.text + "")); + // } + // } }); return nodes; }, diff --git a/src/case/ztree/1.asynctree.js b/src/case/ztree/1.asynctree.js index 9bff9ee63..261f2d112 100644 --- a/src/case/ztree/1.asynctree.js +++ b/src/case/ztree/1.asynctree.js @@ -59,6 +59,9 @@ BI.AsyncTree = BI.inherit(BI.TreeView, { }; function onClick (event, treeId, treeNode) { + if (treeNode.disabled) { + return false; + } var zTree = BI.$.fn.zTree.getZTreeObj(treeId); // 当前点击节点的状态是半选,且为true_part, 则将其改为false_part,使得点击半选后切换到的是全选 var checked = treeNode.checked; @@ -70,6 +73,9 @@ BI.AsyncTree = BI.inherit(BI.TreeView, { } function beforeCheck (treeId, treeNode) { + if (treeNode.disabled) { + return false; + } // 下面主动修改了node的halfCheck属性, 节点属性的判断依赖halfCheck,改之前就获取一下 var status = treeNode.getCheckStatus(); treeNode.halfCheck = false; @@ -98,18 +104,30 @@ BI.AsyncTree = BI.inherit(BI.TreeView, { } function beforeExpand (treeId, treeNode) { + if (treeNode.disabled) { + return false; + } self._beforeExpandNode(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; + } treeNode.halfCheck = false; } function onCollapse (event, treeId, treeNode) { + if (treeNode.disabled) { + return false; + } treeNode.halfCheck = false; } @@ -245,4 +263,4 @@ BI.AsyncTree = BI.inherit(BI.TreeView, { } }); -BI.shortcut("bi.async_tree", BI.AsyncTree); \ No newline at end of file +BI.shortcut("bi.async_tree", BI.AsyncTree); diff --git a/src/less/base/single/input/checkbox.less b/src/less/base/single/input/checkbox.less index 21088cdc7..89c9b205b 100644 --- a/src/less/base/single/input/checkbox.less +++ b/src/less/base/single/input/checkbox.less @@ -27,7 +27,7 @@ border-color: @color-bi-border-hover-active-checkbox; } } - &.active, &:active { + &.active { & .checkbox-content, &.checkbox-content{ border-color: @color-bi-border-hover-active-checkbox; background-color: @color-bi-background-active-checkbox; @@ -65,7 +65,7 @@ border-color: @color-bi-border-hover-active-checkbox-theme-dark; } } - &.active, &:active { + &.active { & .checkbox-content, &.checkbox-content { border-color: @color-bi-border-hover-active-checkbox-theme-dark; background-color: @color-bi-background-active-checkbox-theme-dark; diff --git a/src/less/base/single/input/radio.less b/src/less/base/single/input/radio.less index 53dfc7952..1f5383177 100644 --- a/src/less/base/single/input/radio.less +++ b/src/less/base/single/input/radio.less @@ -13,7 +13,7 @@ border-color: @color-bi-border-hover-active-radio; } } - &:active, &.active { + &.active { & .radio-content, &.radio-content { border-color: @color-bi-border-hover-active-radio; background-color: @color-bi-background-active-radio; @@ -59,7 +59,7 @@ border-color: @color-bi-border-hover-active-radio-theme-dark; } } - &.active, &:active { + &.active { & .radio-content, &.radio-content { border-color:@color-bi-border-hover-active-radio-theme-dark; &:after { diff --git a/src/less/base/tree/ztree.less b/src/less/base/tree/ztree.less index eb20d2818..f3007f102 100644 --- a/src/less/base/tree/ztree.less +++ b/src/less/base/tree/ztree.less @@ -76,12 +76,16 @@ text-decoration: none; vertical-align: top; display: inline-block; - &:hover { - .background-color(@color-bi-background-highlight, 10%); - } - &:active { - color: @color-bi-text-highlight; - .background-color(@color-bi-background-highlight, 15%); + .tree-node-text { + &:not(.disabled) { + &:hover { + .background-color(@color-bi-background-highlight, 10%); + } + &:active { + color: @color-bi-text-highlight; + .background-color(@color-bi-background-highlight, 15%); + } + } } }