You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
3.0 KiB
90 lines
3.0 KiB
BI.BasicTreeItem = BI.inherit(BI.NodeButton, { |
|
_defaultConfig: function () { |
|
var conf = BI.BasicTreeItem.superclass._defaultConfig.apply(this, arguments); |
|
return BI.extend(conf, { |
|
baseCls: (conf.baseCls || "") + " bi-tree-item bi-list-item-active", |
|
id: "", |
|
pId: "", |
|
height: 24, |
|
readonly: true, |
|
isFirstNode: false, |
|
isLastNode: false, |
|
switcherIcon: {}, |
|
selectable: true, |
|
disabled: false, // disabled不会影响展开收起功能 |
|
}); |
|
}, |
|
|
|
render: function () { |
|
var self = this, o = this.options; |
|
|
|
return { |
|
type: "bi.vertical_adapt", |
|
columnSize: ["", "fill"], |
|
items: [ |
|
{ |
|
el: { |
|
type: "bi.layout", |
|
width: 24, |
|
height: o.height, |
|
width: o.height, |
|
cls: this.getLineCls(), |
|
}, |
|
lgap: o.layer * BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2, // 偏移公式为每一层的偏移量为节点高度的一半 |
|
}, |
|
{ |
|
el: { |
|
type: "bi.label", |
|
ref: function (_ref) { |
|
self.text = _ref; |
|
}, |
|
textAlign: "left", |
|
whiteSpace: "nowrap", |
|
textHeight: o.height, |
|
height: o.height, |
|
hgap: o.hgap || o.textHgap, |
|
vgap: o.textVgap, |
|
lgap: o.textLgap, |
|
rgap: o.textRgap, |
|
text: o.text, |
|
value: o.value, |
|
keyword: o.keyword, |
|
py: o.py |
|
}, |
|
} |
|
] |
|
}; |
|
}, |
|
|
|
getLineCls: function () { |
|
var options = this.options; |
|
if (options.layer === 0 && options.isFirstNode && options.isLastNode) { |
|
return ""; |
|
} else if (options.layer === 0 && options.isFirstNode) { |
|
return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "first-solid-line-conn-background" : "first-line-conn-background"; |
|
} else if (options.isLastNode) { |
|
return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "last-solid-line-conn-background" : "last-line-conn-background"; |
|
} else { |
|
return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "mid-solid-line-conn-background" : "mid-line-conn-background"; |
|
} |
|
}, |
|
|
|
doRedMark: function () { |
|
this.text.doRedMark.apply(this.text, arguments); |
|
}, |
|
|
|
unRedMark: function () { |
|
this.text.unRedMark.apply(this.text, arguments); |
|
}, |
|
|
|
getId: function () { |
|
return this.options.id; |
|
}, |
|
|
|
getPId: function () { |
|
return this.options.pId; |
|
} |
|
|
|
}); |
|
|
|
BI.shortcut("bi.tree_item", BI.BasicTreeItem);
|
|
|