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