From ebbc5b2b674c75cc779d54513bd3520568dbac23 Mon Sep 17 00:00:00 2001 From: zsmj1994 Date: Fri, 13 Nov 2020 09:50:24 +0800 Subject: [PATCH] =?UTF-8?q?DEC-15891=20fix:=20=E8=A1=A5=E5=85=85=E5=94=AF?= =?UTF-8?q?=E4=B8=80=E6=A0=B9=E8=8A=82=E7=82=B9item=E5=9C=BA=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../button/treeitem/item.root.treeleaf.js | 72 +++++++++++++++++++ .../multilayerselecttree.leveltree.js | 4 +- .../multilayersingletree.leveltree.js | 2 +- 3 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 src/case/button/treeitem/item.root.treeleaf.js diff --git a/src/case/button/treeitem/item.root.treeleaf.js b/src/case/button/treeitem/item.root.treeleaf.js new file mode 100644 index 0000000000..49512e0d1b --- /dev/null +++ b/src/case/button/treeitem/item.root.treeleaf.js @@ -0,0 +1,72 @@ +BI.RootTreeLeafItem = BI.inherit(BI.BasicButton, { + _defaultConfig: function () { + return BI.extend(BI.RootTreeLeafItem.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-root-tree-leaf-item bi-list-item-active", + logic: { + dynamic: false + }, + id: "", + pId: "", + layer: 0, + height: 24 + }); + }, + _init: function () { + BI.RootTreeLeafItem.superclass._init.apply(this, arguments); + var o = this.options; + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py, + keyword: o.keyword + }); + var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); + var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { + width: 24, + el: { + type: "bi.layout", + width: 24, + height: o.height + } + }, { + el: this.text + }); + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { + items: items + })))); + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doHighLight: function () { + this.text.doHighLight.apply(this.text, arguments); + }, + + unHighLight: function () { + this.text.unHighLight.apply(this.text, arguments); + }, + + getId: function () { + return this.options.id; + }, + + getPId: function () { + return this.options.pId; + } +}); + +BI.shortcut("bi.root_tree_leaf_item", BI.RootTreeLeafItem); diff --git a/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js b/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js index 3f82022065..c6030caff7 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js @@ -54,14 +54,12 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Pane, { extend.type = "bi.multilayer_select_tree_mid_plus_group_node"; } - - BI.defaults(node, extend); self._formatItems(node.children, layer + 1, node); } else { if (layer === 0 && extend.isFirstNode && extend.isLastNode) { - extend.type = ""; // todo 缺一个根节点的item + extend.type = "bi.root_tree_leaf_item"; } else if (layer === 0 && extend.isFirstNode) { extend.type = "bi.multilayer_single_tree_first_tree_leaf_item"; } else if (extend.isLastNode) { diff --git a/src/widget/multilayersingletree/multilayersingletree.leveltree.js b/src/widget/multilayersingletree/multilayersingletree.leveltree.js index 858b5abb5a..da8bca702f 100644 --- a/src/widget/multilayersingletree/multilayersingletree.leveltree.js +++ b/src/widget/multilayersingletree/multilayersingletree.leveltree.js @@ -59,7 +59,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Pane, { } else { if (layer === 0 && extend.isFirstNode && extend.isLastNode) { - extend.type = ""; // todo 缺一个根节点的item + extend.type = "bi.root_tree_leaf_item"; } else if (layer === 0 && extend.isFirstNode) { extend.type = "bi.multilayer_single_tree_first_tree_leaf_item"; } else if (extend.isLastNode) {