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.

57 lines
1.6 KiB

4 years ago
!(function () {
var Node = BI.inherit(BI.NodeButton, {
props: {
baseCls: "bi-list-item-active"
},
render: function () {
var self = this
return {
type: "bi.vertical_adapt",
items: [
{
el: {
type: "bi.text_button",
ref: function (_ref) {
self.icon = _ref
},
stopPropagation: true,
text: this.options.open ? "-" : "+",
height: 24,
width: 24,
handler: function () {
self.handleButtonClick()
}
},
lgap: this.options.layer * 24,
}, {
type: "bi.label",
textAlign: "left",
text: this.options.text
}
]
}
},
handleButtonClick: function () {
this.isOpened() ? this.triggerCollapse() : this.triggerExpand();
},
setOpened: function (b) {
Node.superclass.setOpened.apply(this, arguments);
this.icon.setText(b ? "-" : "+")
},
doClick: function () {
// 很重要
},
getValue: function () {
return this.options.id;
},
});
BI.shortcut("bi.example.select_custom_tree.node", Node);
}())