forked from fanruan/fineui
84 lines
2.2 KiB
84 lines
2.2 KiB
import { ArrowTreeGroupNodeCheckbox } from "../../checkbox"; |
|
import { VerticalAdaptLayout, shortcut, extend, createWidget } from "@/core"; |
|
import { Label, NodeButton } from "@/base"; |
|
|
|
/** |
|
* Created by roy on 15/10/16. |
|
*/ |
|
@shortcut() |
|
export class ArrowNode extends NodeButton { |
|
static xtype = "bi.arrow_group_node"; |
|
|
|
_defaultConfig() { |
|
const conf = super._defaultConfig(...arguments); |
|
|
|
return extend(conf, { |
|
baseCls: `${conf.baseCls || ""} bi-arrow-group-node bi-list-item`, |
|
id: "", |
|
pId: "", |
|
open: false, |
|
height: 24, |
|
iconWrapperWidth: 16, |
|
}); |
|
} |
|
|
|
render() { |
|
const o = this.options; |
|
this.checkbox = createWidget({ |
|
type: ArrowTreeGroupNodeCheckbox.xtype, |
|
expandIcon: o.expandIcon, |
|
collapseIcon: o.collapseIcon, |
|
}); |
|
|
|
return { |
|
type: VerticalAdaptLayout.xtype, |
|
columnSize: [o.iconWrapperWidth || o.height, "fill"], |
|
items: [ |
|
this.checkbox, |
|
{ |
|
el: { |
|
type: Label.xtype, |
|
ref: (_ref) => { |
|
this.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, |
|
py: o.py, |
|
keyword: o.keyword, |
|
}, |
|
}, |
|
], |
|
}; |
|
} |
|
|
|
doRedMark() { |
|
this.text.doRedMark(...arguments); |
|
} |
|
|
|
unRedMark() { |
|
this.text.unRedMark(...arguments); |
|
} |
|
|
|
doClick() { |
|
super.doClick(...arguments); |
|
this.checkbox.setSelected(this.isOpened()); |
|
} |
|
|
|
setText(text) { |
|
super.setText(...arguments); |
|
this.text.setText(text); |
|
} |
|
|
|
setOpened(v) { |
|
super.setOpened(...arguments); |
|
this.checkbox.setSelected(v); |
|
} |
|
}
|
|
|