import { NodeButton } from "../../../base/single/button/button.node"; import { shortcut, extend, createWidget, Controller } from "../../../core"; /** * 加号表示的组节点 * Created by GUY on 2015/9/6. * @class PlusGroupNode * @extends NodeButton */ @shortcut() export class PlusGroupNode extends NodeButton { static xtype = "bi.plus_group_node"; _defaultConfig() { const conf = super._defaultConfig(arguments); return extend(conf, { baseCls: `${conf.baseCls || ""} bi-plus-group-node bi-list-item`, id: "", pId: "", open: false, height: 24, }); } render() { const o = this.options; this.checkbox = createWidget({ type: "bi.tree_node_checkbox", iconHeight: o.height, iconWidth: o.iconWrapperWidth || o.height, }); this.checkbox.on(Controller.EVENT_CHANGE, (...args) => { const [type] = args; if (type === BI.Events.CLICK) { this.setSelected(this.isSelected()); } this.fireEvent(Controller.EVENT_CHANGE, args); }); return { type: "bi.vertical_adapt", columnSize: [o.iconWrapperWidth || o.height, "fill"], items: [this.checkbox, { el: { type: "bi.label", 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, keyword: o.keyword, py: o.py, }, }], }; } doRedMark() { this.text.doRedMark(...arguments); } unRedMark() { this.text.unRedMark(...arguments); } doClick() { super.doClick.apply(this, arguments); this.checkbox.setSelected(this.isSelected()); } setOpened(v) { super.setOpened.apply(this, arguments); if (this.checkbox) { this.checkbox.setSelected(v); } } }