fineui是帆软报表和BI产品线所使用的前端框架。
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.

87 lines
2.4 KiB

import { NodeButton } from "../../../base/single/button/button.node";
import { shortcut, extend, createWidget, Controller } from "../../../core";
8 years ago
/**
* 加号表示的组节点
* Created by GUY on 2015/9/6.
* @class PlusGroupNode
* @extends NodeButton
8 years ago
*/
@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`,
8 years ago
id: "",
pId: "",
open: false,
height: 24,
7 years ago
});
}
render() {
const o = this.options;
this.checkbox = createWidget({
type: "bi.tree_node_checkbox",
iconHeight: o.height,
iconWidth: o.iconWrapperWidth || o.height,
8 years ago
});
this.checkbox.on(Controller.EVENT_CHANGE, (...args) => {
const [type] = args;
8 years ago
if (type === BI.Events.CLICK) {
this.setSelected(this.isSelected());
8 years ago
}
this.fireEvent(Controller.EVENT_CHANGE, args);
8 years ago
});
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,
3 years ago
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,
},
}],
};
}
8 years ago
doRedMark() {
this.text.doRedMark(...arguments);
}
8 years ago
unRedMark() {
this.text.unRedMark(...arguments);
}
8 years ago
doClick() {
super.doClick(...arguments);
8 years ago
this.checkbox.setSelected(this.isSelected());
}
8 years ago
setOpened(v) {
super.setOpened(...arguments);
8 years ago
if (this.checkbox) {
this.checkbox.setSelected(v);
}
}
}