From 160083cb8a6d46223ea7135ff5ffe1e121026c19 Mon Sep 17 00:00:00 2001 From: zsmj1994 Date: Tue, 3 Nov 2020 17:46:54 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-5989=20refactor:fineui=20tree=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/js/case/tree/demo.level_tree.js | 2 +- .../tree/demo.multilayer_select_level_tree.js | 2 +- src/case/button/node/node.first.plus.js | 2 +- src/case/tree/tree.level.js | 8 +-- src/case/tree/treeexpander/tree.expander.js | 72 +++++++++++++++++++ .../tree/treeexpander/tree.expander.popup.js | 47 ++++++++++++ src/less/base/tree/tree.expander.less | 9 +++ .../multilayerselecttree.leveltree.js | 44 +++++++----- .../node/node.first.plus.js | 30 ++++---- .../node/node.last.plus.js | 23 ++---- .../node/node.mid.plus.js | 23 ++---- .../multilayerselecttree/node/node.plus.js | 23 ++---- .../multilayersingletree.leveltree.js | 42 ++++++----- .../node/node.first.plus.js | 23 ++---- .../node/node.last.plus.js | 23 ++---- .../node/node.mid.plus.js | 23 ++---- .../treeitem/item.first.treeleaf.js | 24 ++----- .../treeitem/item.last.treeleaf.js | 23 ++---- .../treeitem/item.mid.treeleaf.js | 23 ++---- 19 files changed, 244 insertions(+), 222 deletions(-) create mode 100644 src/case/tree/treeexpander/tree.expander.js create mode 100644 src/case/tree/treeexpander/tree.expander.popup.js create mode 100644 src/less/base/tree/tree.expander.less diff --git a/demo/js/case/tree/demo.level_tree.js b/demo/js/case/tree/demo.level_tree.js index 9b6065489..f21c21707 100644 --- a/demo/js/case/tree/demo.level_tree.js +++ b/demo/js/case/tree/demo.level_tree.js @@ -84,4 +84,4 @@ Demo.Func = BI.inherit(BI.Widget, { }); } }); -BI.shortcut("demo.level_tree", Demo.Func); \ No newline at end of file +BI.shortcut("demo.level_tree", Demo.Func); diff --git a/demo/js/widget/tree/demo.multilayer_select_level_tree.js b/demo/js/widget/tree/demo.multilayer_select_level_tree.js index ecded9c90..0a9054c3a 100644 --- a/demo/js/widget/tree/demo.multilayer_select_level_tree.js +++ b/demo/js/widget/tree/demo.multilayer_select_level_tree.js @@ -44,4 +44,4 @@ Demo.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { } }); -BI.shortcut("demo.multilayer_select_level_tree", Demo.MultiLayerSelectLevelTree); \ No newline at end of file +BI.shortcut("demo.multilayer_select_level_tree", Demo.MultiLayerSelectLevelTree); diff --git a/src/case/button/node/node.first.plus.js b/src/case/button/node/node.first.plus.js index bb1f9c2dc..7969867fb 100644 --- a/src/case/button/node/node.first.plus.js +++ b/src/case/button/node/node.first.plus.js @@ -79,4 +79,4 @@ BI.FirstPlusGroupNode = BI.inherit(BI.NodeButton, { } }); -BI.shortcut("bi.first_plus_group_node", BI.FirstPlusGroupNode); \ No newline at end of file +BI.shortcut("bi.first_plus_group_node", BI.FirstPlusGroupNode); diff --git a/src/case/tree/tree.level.js b/src/case/tree/tree.level.js index 193ce0e7a..eb6d5099d 100644 --- a/src/case/tree/tree.level.js +++ b/src/case/tree/tree.level.js @@ -26,7 +26,7 @@ BI.LevelTree = BI.inherit(BI.Widget, { _formatItems: function (nodes, layer, pNode) { var self = this; BI.each(nodes, function (i, node) { - var extend = {layer: layer}; + var extend = { layer: layer }; if (!BI.isKey(node.id)) { node.id = BI.UUID(); } @@ -38,7 +38,7 @@ BI.LevelTree = BI.inherit(BI.Widget, { extend.isLastNode = true; } if (i === 0 && !pNode) { - extend.type = "bi.first_plus_group_node" + extend.type = "bi.first_plus_group_node"; } if (i === 0 && i === nodes.length - 1) { // 根 extend.type = "bi.plus_group_node"; @@ -48,7 +48,7 @@ BI.LevelTree = BI.inherit(BI.Widget, { } else { extend.type = "bi.mid_tree_leaf_item"; if (i === 0 && !pNode) { - extend.type = "bi.first_tree_leaf_item" + extend.type = "bi.first_tree_leaf_item"; } if (i === nodes.length - 1) { extend.type = "bi.last_tree_leaf_item"; @@ -133,4 +133,4 @@ BI.LevelTree = BI.inherit(BI.Widget, { }); BI.LevelTree.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.level_tree", BI.LevelTree); \ No newline at end of file +BI.shortcut("bi.level_tree", BI.LevelTree); diff --git a/src/case/tree/treeexpander/tree.expander.js b/src/case/tree/treeexpander/tree.expander.js new file mode 100644 index 000000000..dd151b2dc --- /dev/null +++ b/src/case/tree/treeexpander/tree.expander.js @@ -0,0 +1,72 @@ +!(function () { + var Widget = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-tree-expander", + layer: 0, // 第几层级 + isLastNode: false, // 是不是最后一个 + isFirstNode: false, // 是不是第一个 + selectable: false, + }, + + render: function () { + + var self = this; + var o = this.options; + + this.trigger = BI.createWidget(o.el, { + forceNotSelected: !o.selectable, + }); + this.trigger.on(BI.Controller.EVENT_CHANGE, function (type) { + o.selectable && self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + return { + type: "bi.expander", + ref: function (_ref) { + self.expander = _ref; + }, + trigger: o.selectable ? "" : "click", + el: this.trigger, + isDefaultInit: o.isDefaultInit, + popup: { + type: "bi.tree_expander.popup", + layer: o.layer || o.el.layer, + isLastNode: o.isLastNode || o.el.isLastNode, + isFirstNode: o.isFirstNode || o.el.isFirstNode, + el: o.popup, + }, + listeners: [ + { + eventName: BI.Controller.EVENT_CHANGE, + action: function (type) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }, + }, + ], + }; + }, + + setValue: function (v) { + if (BI.contains(v, this.trigger.getValue())) { + this.trigger.setSelected(true); + this.expander.setValue([]); + } else { + this.trigger.setSelected(false); + this.expander.setValue(v); + } + }, + + getValue: function () { + if (this.trigger.isSelected()) { + return [this.trigger.getValue()]; + } + return this.expander.getValue(); + }, + + populate: function (items) { + this.expander.populate(items); + }, + }); + + BI.shortcut("bi.tree_expander", Widget); +}()); diff --git a/src/case/tree/treeexpander/tree.expander.popup.js b/src/case/tree/treeexpander/tree.expander.popup.js new file mode 100644 index 000000000..a51d6711f --- /dev/null +++ b/src/case/tree/treeexpander/tree.expander.popup.js @@ -0,0 +1,47 @@ +!(function () { + var Widget = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-tree-expander-popup", + layer: 0, // 第几层级 + el: {}, + isLastNode: false, + }, + + render: function () { + + var self = this; + var o = this.options; + + this.popupView = BI.createWidget(o.el, this); + + this.popupView.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.popupView.element.css("margin-left", -12 * o.layer); + this.element.css("margin-left", 12 * o.layer); + + return { + type: "bi.vertical", + cls: !o.isLastNode ? "line" : "", + scrolly: null, + items: [ + this.popupView, + ], + }; + }, + + setValue: function (v) { + this.popupView.setValue(v); + }, + + getValue: function () { + return this.popupview.getValue(); + }, + + populate: function (items) { + this.popupview.populate(items); + }, + }); + + BI.shortcut("bi.tree_expander.popup", Widget); +}()); diff --git a/src/less/base/tree/tree.expander.less b/src/less/base/tree/tree.expander.less new file mode 100644 index 000000000..e4355b37e --- /dev/null +++ b/src/less/base/tree/tree.expander.less @@ -0,0 +1,9 @@ +@import "../../index"; +.bi-tree-expander-popup.line:before { + position: absolute; + content: ""; + border-left: 1px dashed #D0D4DA; + height: 100%; + left: 11px; +} + diff --git a/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js b/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js index 936e39211..3f8202206 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js @@ -32,7 +32,10 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Pane, { var self = this, o = this.options; var keyword = o.keywordGetter(); BI.each(nodes, function (i, node) { - var extend = {}; + var extend = { + isFirstNode: i === 0, + isLastNode: i === nodes.length - 1 + }; node.layer = layer; if (!BI.isKey(node.id)) { node.id = BI.UUID(); @@ -40,26 +43,31 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Pane, { node.keyword = node.keyword || keyword; extend.pNode = pNode; if (node.isParent === true || node.parent === true || BI.isNotEmptyArray(node.children)) { - extend.type = "bi.multilayer_select_tree_mid_plus_group_node"; - if (i === nodes.length - 1) { - extend.type = "bi.multilayer_select_tree_last_plus_group_node"; - extend.isLastNode = true; - } - if (i === 0 && !pNode) { - extend.type = "bi.multilayer_select_tree_first_plus_group_node"; - } - if (i === 0 && i === nodes.length - 1 && !pNode) { // 根 + + if (layer === 0 && extend.isFirstNode && extend.isLastNode) { extend.type = "bi.multilayer_select_tree_plus_group_node"; + } else if (layer === 0 && extend.isFirstNode) { + extend.type = "bi.multilayer_select_tree_first_plus_group_node"; + } else if (extend.isLastNode) { + extend.type = "bi.multilayer_select_tree_last_plus_group_node"; + } else { + extend.type = "bi.multilayer_select_tree_mid_plus_group_node"; } + + + BI.defaults(node, extend); self._formatItems(node.children, layer + 1, node); } else { - extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item"; - if (i === 0 && !pNode) { + + if (layer === 0 && extend.isFirstNode && extend.isLastNode) { + extend.type = ""; // todo 缺一个根节点的item + } else if (layer === 0 && extend.isFirstNode) { extend.type = "bi.multilayer_single_tree_first_tree_leaf_item"; - } - if (i === nodes.length - 1) { + } else if (extend.isLastNode) { extend.type = "bi.multilayer_single_tree_last_tree_leaf_item"; + } else { + extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item"; } BI.defaults(node, extend); } @@ -83,7 +91,9 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Pane, { type: "bi.custom_tree", cls: "tree-view display-table", expander: { - type: "bi.select_tree_expander", + // type: "bi.select_tree_expander", + type: "bi.tree_expander", + selectable: true, isDefaultInit: o.isDefaultInit, el: {}, popup: { @@ -151,7 +161,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Pane, { setValue: function (v) { // getValue依赖于storeValue, 那么不选的时候就不要更新storeValue了 - if(this.options.chooseType === BI.Selection.None) { + if (this.options.chooseType === BI.Selection.None) { } else { this.storeValue = v; this.tree.setValue(v); @@ -178,4 +188,4 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Pane, { }); BI.MultiLayerSelectLevelTree.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.multilayer_select_level_tree", BI.MultiLayerSelectLevelTree); \ No newline at end of file +BI.shortcut("bi.multilayer_select_level_tree", BI.MultiLayerSelectLevelTree); diff --git a/src/widget/multilayerselecttree/node/node.first.plus.js b/src/widget/multilayerselecttree/node/node.first.plus.js index e7cec6bd7..37e69704c 100644 --- a/src/widget/multilayerselecttree/node/node.first.plus.js +++ b/src/widget/multilayerselecttree/node/node.first.plus.js @@ -43,25 +43,19 @@ BI.MultiLayerSelectTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); - var needBlankLayers = []; - var pNode = o.pNode; - while (pNode) { - if (pNode.isLastNode) { - needBlankLayers.push(pNode.layer) - } - pNode = pNode.pNode; - } - var items = []; - BI.count(0, o.layer, function (index) { - items.push({ - type: "bi.layout", - cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background", - width: 12, - height: o.height - }); + // BI.count(0, o.layer, function (index) { + // items.push({ + // type: "bi.layout", + // cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background", + // width: 12, + // height: o.height + // }); + // }); + items.push({ + el: this.node, + lgap: o.layer * 12 }); - items.push(this.node); BI.createWidget({ type: "bi.horizontal_adapt", element: this, @@ -102,4 +96,4 @@ BI.MultiLayerSelectTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, { } }); -BI.shortcut("bi.multilayer_select_tree_first_plus_group_node", BI.MultiLayerSelectTreeFirstPlusGroupNode); \ No newline at end of file +BI.shortcut("bi.multilayer_select_tree_first_plus_group_node", BI.MultiLayerSelectTreeFirstPlusGroupNode); diff --git a/src/widget/multilayerselecttree/node/node.last.plus.js b/src/widget/multilayerselecttree/node/node.last.plus.js index facef2034..7fcaca78f 100644 --- a/src/widget/multilayerselecttree/node/node.last.plus.js +++ b/src/widget/multilayerselecttree/node/node.last.plus.js @@ -43,25 +43,12 @@ BI.MultiLayerSelectTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); - var needBlankLayers = []; - var pNode = o.pNode; - while (pNode) { - if (pNode.isLastNode) { - needBlankLayers.push(pNode.layer) - } - pNode = pNode.pNode; - } - var items = []; - BI.count(0, o.layer, function (index) { - items.push({ - type: "bi.layout", - cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background", - width: 12, - height: o.height - }); + + items.push({ + el: this.node, + lgap: o.layer * 12 }); - items.push(this.node); BI.createWidget({ type: "bi.horizontal_adapt", element: this, @@ -98,4 +85,4 @@ BI.MultiLayerSelectTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, { } }); -BI.shortcut("bi.multilayer_select_tree_last_plus_group_node", BI.MultiLayerSelectTreeLastPlusGroupNode); \ No newline at end of file +BI.shortcut("bi.multilayer_select_tree_last_plus_group_node", BI.MultiLayerSelectTreeLastPlusGroupNode); diff --git a/src/widget/multilayerselecttree/node/node.mid.plus.js b/src/widget/multilayerselecttree/node/node.mid.plus.js index b2e94a22a..84f14bb8d 100644 --- a/src/widget/multilayerselecttree/node/node.mid.plus.js +++ b/src/widget/multilayerselecttree/node/node.mid.plus.js @@ -43,25 +43,12 @@ BI.MultiLayerSelectTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); - var needBlankLayers = []; - var pNode = o.pNode; - while (pNode) { - if (pNode.isLastNode) { - needBlankLayers.push(pNode.layer) - } - pNode = pNode.pNode; - } - var items = []; - BI.count(0, o.layer, function (index) { - items.push({ - type: "bi.layout", - cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background", - width: 12, - height: o.height - }); + + items.push({ + el: this.node, + lgap: o.layer * 12 }); - items.push(this.node); BI.createWidget({ type: "bi.horizontal_adapt", element: this, @@ -98,4 +85,4 @@ BI.MultiLayerSelectTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, { } }); -BI.shortcut("bi.multilayer_select_tree_mid_plus_group_node", BI.MultiLayerSelectTreeMidPlusGroupNode); \ No newline at end of file +BI.shortcut("bi.multilayer_select_tree_mid_plus_group_node", BI.MultiLayerSelectTreeMidPlusGroupNode); diff --git a/src/widget/multilayerselecttree/node/node.plus.js b/src/widget/multilayerselecttree/node/node.plus.js index 8db2c31d5..911093fe2 100644 --- a/src/widget/multilayerselecttree/node/node.plus.js +++ b/src/widget/multilayerselecttree/node/node.plus.js @@ -43,25 +43,12 @@ BI.MultiLayerSelectTreePlusGroupNode = BI.inherit(BI.NodeButton, { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); - var needBlankLayers = []; - var pNode = o.pNode; - while (pNode) { - if (pNode.isLastNode) { - needBlankLayers.push(pNode.layer) - } - pNode = pNode.pNode; - } - var items = []; - BI.count(0, o.layer, function (index) { - items.push({ - type: "bi.layout", - cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background", - width: 12, - height: o.height - }); + + items.push({ + el: this.node, + lgap: o.layer * 12 }); - items.push(this.node); BI.createWidget({ type: "bi.horizontal_adapt", element: this, @@ -102,4 +89,4 @@ BI.MultiLayerSelectTreePlusGroupNode = BI.inherit(BI.NodeButton, { } }); -BI.shortcut("bi.multilayer_select_tree_plus_group_node", BI.MultiLayerSelectTreePlusGroupNode); \ No newline at end of file +BI.shortcut("bi.multilayer_select_tree_plus_group_node", BI.MultiLayerSelectTreePlusGroupNode); diff --git a/src/widget/multilayersingletree/multilayersingletree.leveltree.js b/src/widget/multilayersingletree/multilayersingletree.leveltree.js index d4eed85fa..858b5abb5 100644 --- a/src/widget/multilayersingletree/multilayersingletree.leveltree.js +++ b/src/widget/multilayersingletree/multilayersingletree.leveltree.js @@ -32,7 +32,10 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Pane, { var self = this, o = this.options; var keyword = o.keywordGetter(); BI.each(nodes, function (i, node) { - var extend = {}; + var extend = { + isFirstNode: i === 0, + isLastNode: i === nodes.length - 1 + }; node.layer = layer; if (!BI.isKey(node.id)) { node.id = BI.UUID(); @@ -40,27 +43,31 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Pane, { node.keyword = node.keyword || keyword; extend.pNode = pNode; if (node.isParent === true || node.parent === true || BI.isNotEmptyArray(node.children)) { - extend.type = "bi.multilayer_single_tree_mid_plus_group_node"; - if (i === nodes.length - 1) { - extend.type = "bi.multilayer_single_tree_last_plus_group_node"; - extend.isLastNode = true; - } - if (i === 0 && !pNode) { - extend.type = "bi.multilayer_single_tree_first_plus_group_node"; - } - if (i === 0 && i === nodes.length - 1 && !pNode) { // 根 + + if (layer === 0 && extend.isFirstNode && extend.isLastNode) { extend.type = "bi.multilayer_single_tree_plus_group_node"; + } else if (layer === 0 && extend.isFirstNode) { + extend.type = "bi.multilayer_single_tree_first_plus_group_node"; + } else if (extend.isLastNode) { + extend.type = "bi.multilayer_single_tree_last_plus_group_node"; + } else { + extend.type = "bi.multilayer_single_tree_mid_plus_group_node"; } + BI.defaults(node, extend); self._formatItems(node.children, layer + 1, node); } else { - extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item"; - if (i === 0 && !pNode) { + + if (layer === 0 && extend.isFirstNode && extend.isLastNode) { + extend.type = ""; // todo 缺一个根节点的item + } else if (layer === 0 && extend.isFirstNode) { extend.type = "bi.multilayer_single_tree_first_tree_leaf_item"; - } - if (i === nodes.length - 1) { + } else if (extend.isLastNode) { extend.type = "bi.multilayer_single_tree_last_tree_leaf_item"; + } else { + extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item"; } + BI.defaults(node, extend); } }); @@ -83,6 +90,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Pane, { type: "bi.custom_tree", cls: "tree-view display-table", expander: { + type: "bi.tree_expander", isDefaultInit: o.isDefaultInit, el: {}, popup: { @@ -150,7 +158,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Pane, { setValue: function (v) { // getValue依赖于storeValue, 那么不选的时候就不要更新storeValue了 - if(this.options.chooseType === BI.Selection.None) { + if (this.options.chooseType === BI.Selection.None) { } else { this.storeValue = v; this.tree.setValue(v); @@ -159,8 +167,8 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Pane, { getValue: function () { return BI.isArray(this.storeValue) ? - this.storeValue : BI.isNull(this.storeValue) ? - [] : [this.storeValue]; + this.storeValue : BI.isNull(this.storeValue) ? + [] : [this.storeValue]; }, getAllLeaves: function () { diff --git a/src/widget/multilayersingletree/node/node.first.plus.js b/src/widget/multilayersingletree/node/node.first.plus.js index ee9b54775..9d5794bcb 100644 --- a/src/widget/multilayersingletree/node/node.first.plus.js +++ b/src/widget/multilayersingletree/node/node.first.plus.js @@ -22,25 +22,12 @@ BI.MultiLayerSingleTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, { var self = this, o = this.options; this.node = this._createNode(); - var needBlankLayers = []; - var pNode = o.pNode; - while (pNode) { - if (pNode.isLastNode) { - needBlankLayers.push(pNode.layer) - } - pNode = pNode.pNode; - } - var items = []; - BI.count(0, o.layer, function (index) { - items.push({ - type: "bi.layout", - cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background", - width: 12, - height: o.height - }); + + items.push({ + el: this.node, + lgap: o.layer * 12 }); - items.push(this.node); BI.createWidget({ type: "bi.horizontal_adapt", element: this, @@ -101,4 +88,4 @@ BI.MultiLayerSingleTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, { } }); -BI.shortcut("bi.multilayer_single_tree_first_plus_group_node", BI.MultiLayerSingleTreeFirstPlusGroupNode); \ No newline at end of file +BI.shortcut("bi.multilayer_single_tree_first_plus_group_node", BI.MultiLayerSingleTreeFirstPlusGroupNode); diff --git a/src/widget/multilayersingletree/node/node.last.plus.js b/src/widget/multilayersingletree/node/node.last.plus.js index f7a8e6b20..18dd3eea7 100644 --- a/src/widget/multilayersingletree/node/node.last.plus.js +++ b/src/widget/multilayersingletree/node/node.last.plus.js @@ -22,25 +22,12 @@ BI.MultiLayerSingleTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, { var self = this, o = this.options; this.node = this._createNode(); - var needBlankLayers = []; - var pNode = o.pNode; - while (pNode) { - if (pNode.isLastNode) { - needBlankLayers.push(pNode.layer) - } - pNode = pNode.pNode; - } - var items = []; - BI.count(0, o.layer, function (index) { - items.push({ - type: "bi.layout", - cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background", - width: 12, - height: o.height - }); + + items.push({ + el: this.node, + lgap: o.layer * 12 }); - items.push(this.node); BI.createWidget({ type: "bi.horizontal_adapt", element: this, @@ -100,4 +87,4 @@ BI.MultiLayerSingleTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, { } }); -BI.shortcut("bi.multilayer_single_tree_last_plus_group_node", BI.MultiLayerSingleTreeLastPlusGroupNode); \ No newline at end of file +BI.shortcut("bi.multilayer_single_tree_last_plus_group_node", BI.MultiLayerSingleTreeLastPlusGroupNode); diff --git a/src/widget/multilayersingletree/node/node.mid.plus.js b/src/widget/multilayersingletree/node/node.mid.plus.js index 340305db4..9105de054 100644 --- a/src/widget/multilayersingletree/node/node.mid.plus.js +++ b/src/widget/multilayersingletree/node/node.mid.plus.js @@ -22,25 +22,12 @@ BI.MultiLayerSingleTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, { var self = this, o = this.options; this.node = this._createNode(); - var needBlankLayers = []; - var pNode = o.pNode; - while (pNode) { - if (pNode.isLastNode) { - needBlankLayers.push(pNode.layer) - } - pNode = pNode.pNode; - } - var items = []; - BI.count(0, o.layer, function (index) { - items.push({ - type: "bi.layout", - cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background", - width: 12, - height: o.height - }); + + items.push({ + el: this.node, + lgap: o.layer * 12 }); - items.push(this.node); BI.createWidget({ type: "bi.horizontal_adapt", element: this, @@ -100,4 +87,4 @@ BI.MultiLayerSingleTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, { } }); -BI.shortcut("bi.multilayer_single_tree_mid_plus_group_node", BI.MultiLayerSingleTreeMidPlusGroupNode); \ No newline at end of file +BI.shortcut("bi.multilayer_single_tree_mid_plus_group_node", BI.MultiLayerSingleTreeMidPlusGroupNode); diff --git a/src/widget/multilayersingletree/treeitem/item.first.treeleaf.js b/src/widget/multilayersingletree/treeitem/item.first.treeleaf.js index 39f3f65e2..c10cbcd01 100644 --- a/src/widget/multilayersingletree/treeitem/item.first.treeleaf.js +++ b/src/widget/multilayersingletree/treeitem/item.first.treeleaf.js @@ -42,26 +42,12 @@ BI.MultiLayerSingleTreeFirstTreeLeafItem = BI.inherit(BI.BasicButton, { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); - - var needBlankLayers = []; - var pNode = o.pNode; - while (pNode) { - if (pNode.isLastNode) { - needBlankLayers.push(pNode.layer) - } - pNode = pNode.pNode; - } - var items = []; - BI.count(0, o.layer, function (index) { - items.push({ - type: "bi.layout", - cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background", - width: 12, - height: o.height - }); + + items.push({ + el: this.item, + lgap: o.layer * 12 }); - items.push(this.item); BI.createWidget({ type: "bi.horizontal_adapt", element: this, @@ -97,4 +83,4 @@ BI.MultiLayerSingleTreeFirstTreeLeafItem = BI.inherit(BI.BasicButton, { } }); -BI.shortcut("bi.multilayer_single_tree_first_tree_leaf_item", BI.MultiLayerSingleTreeFirstTreeLeafItem); \ No newline at end of file +BI.shortcut("bi.multilayer_single_tree_first_tree_leaf_item", BI.MultiLayerSingleTreeFirstTreeLeafItem); diff --git a/src/widget/multilayersingletree/treeitem/item.last.treeleaf.js b/src/widget/multilayersingletree/treeitem/item.last.treeleaf.js index 0dc5390d2..4289108f0 100644 --- a/src/widget/multilayersingletree/treeitem/item.last.treeleaf.js +++ b/src/widget/multilayersingletree/treeitem/item.last.treeleaf.js @@ -42,25 +42,12 @@ BI.MultiLayerSingleTreeLastTreeLeafItem = BI.inherit(BI.BasicButton, { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); - var needBlankLayers = []; - var pNode = o.pNode; - while (pNode) { - if (pNode.isLastNode) { - needBlankLayers.push(pNode.layer) - } - pNode = pNode.pNode; - } - var items = []; - BI.count(0, o.layer, function (index) { - items.push({ - type: "bi.layout", - cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background", - width: 12, - height: o.height - }); + + items.push({ + el: this.item, + lgap: o.layer * 12 }); - items.push(this.item); BI.createWidget({ type: "bi.horizontal_adapt", element: this, @@ -96,4 +83,4 @@ BI.MultiLayerSingleTreeLastTreeLeafItem = BI.inherit(BI.BasicButton, { } }); -BI.shortcut("bi.multilayer_single_tree_last_tree_leaf_item", BI.MultiLayerSingleTreeLastTreeLeafItem); \ No newline at end of file +BI.shortcut("bi.multilayer_single_tree_last_tree_leaf_item", BI.MultiLayerSingleTreeLastTreeLeafItem); diff --git a/src/widget/multilayersingletree/treeitem/item.mid.treeleaf.js b/src/widget/multilayersingletree/treeitem/item.mid.treeleaf.js index 97bea42dd..92a9a626a 100644 --- a/src/widget/multilayersingletree/treeitem/item.mid.treeleaf.js +++ b/src/widget/multilayersingletree/treeitem/item.mid.treeleaf.js @@ -42,25 +42,12 @@ BI.MultiLayerSingleTreeMidTreeLeafItem = BI.inherit(BI.BasicButton, { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); - var needBlankLayers = []; - var pNode = o.pNode; - while (pNode) { - if (pNode.isLastNode) { - needBlankLayers.push(pNode.layer) - } - pNode = pNode.pNode; - } - var items = []; - BI.count(0, o.layer, function (index) { - items.push({ - type: "bi.layout", - cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background", - width: 12, - height: o.height - }); + + items.push({ + el: this.item, + lgap: o.layer * 12 }); - items.push(this.item); BI.createWidget({ type: "bi.horizontal_adapt", element: this, @@ -96,4 +83,4 @@ BI.MultiLayerSingleTreeMidTreeLeafItem = BI.inherit(BI.BasicButton, { } }); -BI.shortcut("bi.multilayer_single_tree_mid_tree_leaf_item", BI.MultiLayerSingleTreeMidTreeLeafItem); \ No newline at end of file +BI.shortcut("bi.multilayer_single_tree_mid_tree_leaf_item", BI.MultiLayerSingleTreeMidTreeLeafItem);