|
|
|
@ -1,13 +1,14 @@
|
|
|
|
|
import { NodeButton } from "../../../base/single/button/button.node"; |
|
|
|
|
import { shortcut, extend } from "../../../core"; |
|
|
|
|
import { Label, NodeButton } from "@/base"; |
|
|
|
|
import { shortcut, extend, VerticalAdaptLayout } from "@/core"; |
|
|
|
|
import { TreeNodeSwitcher } from "@/case"; |
|
|
|
|
|
|
|
|
|
@shortcut() |
|
|
|
|
export class BasicTreeNode extends NodeButton { |
|
|
|
|
static xtype = "bi.tree_node"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_defaultConfig(props) { |
|
|
|
|
const conf = super._defaultConfig.apply(this, arguments); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return extend(conf, { |
|
|
|
|
baseCls: `${conf.baseCls || ""} bi-tree-node ${props.selectable ? "bi-list-item-active" : "bi-list-item"}`, |
|
|
|
|
id: "", |
|
|
|
@ -27,7 +28,7 @@ export class BasicTreeNode extends NodeButton {
|
|
|
|
|
const o = this.options; |
|
|
|
|
|
|
|
|
|
const checkbox = { |
|
|
|
|
type: "bi.tree_node_switcher", |
|
|
|
|
type: TreeNodeSwitcher.xtype, |
|
|
|
|
ref: _ref => { |
|
|
|
|
this.switcher = _ref; |
|
|
|
|
}, |
|
|
|
@ -39,7 +40,7 @@ export class BasicTreeNode extends NodeButton {
|
|
|
|
|
layer: o.layer, |
|
|
|
|
...o.switcherIcon, |
|
|
|
|
stopPropagation: o.selectable, |
|
|
|
|
mounted () { |
|
|
|
|
mounted() { |
|
|
|
|
this.setEnable(true); |
|
|
|
|
}, |
|
|
|
|
listeners: [ |
|
|
|
@ -55,7 +56,7 @@ export class BasicTreeNode extends NodeButton {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
type: "bi.vertical_adapt", |
|
|
|
|
type: VerticalAdaptLayout.xtype, |
|
|
|
|
columnSize: [o.iconWrapperWidth || o.height, "fill"], |
|
|
|
|
items: [ |
|
|
|
|
{ |
|
|
|
@ -63,7 +64,7 @@ export class BasicTreeNode extends NodeButton {
|
|
|
|
|
lgap: o.layer * BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2, // 偏移公式为每一层的偏移量为节点高度的一半
|
|
|
|
|
}, { |
|
|
|
|
el: { |
|
|
|
|
type: "bi.label", |
|
|
|
|
type: Label.xtype, |
|
|
|
|
ref: _ref => { |
|
|
|
|
this.text = _ref; |
|
|
|
|
}, |
|
|
|
|