forked from fanruan/fineui
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.
90 lines
2.5 KiB
90 lines
2.5 KiB
import { TreeNodeCheckbox } from "../../checkbox"; |
|
import { VerticalAdaptLayout, shortcut, extend, createWidget, Controller } from "@/core"; |
|
import { Label, NodeButton } from "@/base"; |
|
|
|
/** |
|
* 加号表示的组节点 |
|
* 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: TreeNodeCheckbox.xtype, |
|
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: 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, |
|
keyword: o.keyword, |
|
py: o.py, |
|
}, |
|
}, |
|
], |
|
}; |
|
} |
|
|
|
doRedMark() { |
|
this.text.doRedMark(...arguments); |
|
} |
|
|
|
unRedMark() { |
|
this.text.unRedMark(...arguments); |
|
} |
|
|
|
doClick() { |
|
super.doClick(...arguments); |
|
this.checkbox.setSelected(this.isSelected()); |
|
} |
|
|
|
setOpened(v) { |
|
super.setOpened(...arguments); |
|
if (this.checkbox) { |
|
this.checkbox.setSelected(v); |
|
} |
|
} |
|
}
|
|
|