From 1c6de465d49a65bbf32236cf8f7338cd72652136 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 2 Apr 2022 14:15:57 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20ztree=E7=9A=84node=E5=85=8B=E9=9A=86?= =?UTF-8?q?=E4=B8=80=E4=B8=8B=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/case/ztree/0.treeview.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/case/ztree/0.treeview.js b/src/case/ztree/0.treeview.js index 79ffd5bb6..ea9f22b54 100644 --- a/src/case/ztree/0.treeview.js +++ b/src/case/ztree/0.treeview.js @@ -347,33 +347,32 @@ BI.TreeView = BI.inherit(BI.Pane, { _dealWidthNodes: function (nodes) { var self = this, o = this.options; var ns = BI.Tree.arrayFormat(nodes); - BI.each(ns, function (i, n) { - n.isParent = n.isParent || n.parent; + return BI.map(ns, function (i, n) { + var newNode = BI.extend({}, n); + newNode.isParent = newNode.isParent || newNode.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 = ""; // } - if (BI.isNull(n.title)) { - n.title = n.text; + if (BI.isNull(newNode.title)) { + newNode.title = newNode.text; } - if (n.disabled) { - n.title = n.warningTitle || n.title; + if (newNode.disabled) { + newNode.title = newNode.warningTitle || newNode.title; } var text = BI.createWidget(BI.extend({ cls: "tree-node-text", - css: { - display: "inline" - }, + tagName: "span", whiteSpace: "nowrap", root: true, keyword: o.paras.keyword - }, n, { + }, newNode, { type: "bi.text" })); var fragment = BI.Widget._renderEngine.createElement("
"); fragment.append(text.element[0]); - n.text = fragment.html(); + newNode.text = fragment.html(); // // 处理标红 // if (BI.isNotNull(n.text)) { // if (BI.isKey(o.paras.keyword)) { @@ -382,8 +381,8 @@ BI.TreeView = BI.inherit(BI.Pane, { // n.text = BI.htmlEncode(BI.Text.formatText(n.text + "")); // } // } + return newNode; }); - return nodes; }, _loadMore: function () {