|
|
|
import { NodeButton } from "../../../base/single/button/button.node";
|
|
|
|
import { shortcut, extend, createWidget, Controller } from "../../../core";
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 加号表示的组节点
|
|
|
|
* Created by GUY on 2015/9/6.
|
|
|
|
* @class FirstPlusGroupNode
|
|
|
|
* @extends NodeButton
|
|
|
|
*/
|
|
|
|
@shortcut()
|
|
|
|
export class FirstPlusGroupNode extends NodeButton {
|
|
|
|
static xtype = "bi.first_plus_group_node";
|
|
|
|
|
|
|
|
_defaultConfig() {
|
|
|
|
const conf = super._defaultConfig(...arguments);
|
|
|
|
|
|
|
|
return extend(conf, {
|
|
|
|
baseCls: `${conf.baseCls || ""} bi-first-plus-group-node bi-list-item`,
|
|
|
|
logic: {
|
|
|
|
dynamic: false,
|
|
|
|
},
|
|
|
|
id: "",
|
|
|
|
pId: "",
|
|
|
|
open: false,
|
|
|
|
height: 24,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_init() {
|
|
|
|
super._init.apply(this, arguments);
|
|
|
|
const o = this.options;
|
|
|
|
this.checkbox = createWidget({
|
|
|
|
type: "bi.first_tree_node_checkbox",
|
|
|
|
stopPropagation: true,
|
|
|
|
iconHeight: o.height,
|
|
|
|
iconWidth: o.height,
|
|
|
|
});
|
|
|
|
this.text = createWidget({
|
|
|
|
type: "bi.label",
|
|
|
|
textAlign: "left",
|
|
|
|
whiteSpace: "nowrap",
|
|
|
|
textHeight: o.height,
|
|
|
|
height: o.height,
|
|
|
|
hgap: o.hgap,
|
|
|
|
text: o.text,
|
|
|
|
value: o.value,
|
|
|
|
py: o.py,
|
|
|
|
keyword: o.keyword,
|
|
|
|
});
|
|
|
|
this.checkbox.on(Controller.EVENT_CHANGE, function (type) {
|
|
|
|
if (type === BI.Events.CLICK) {
|
|
|
|
if (this.isSelected()) {
|
|
|
|
self.triggerExpand();
|
|
|
|
} else {
|
|
|
|
self.triggerCollapse();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
const type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
|
|
|
|
const items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, {
|
|
|
|
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
|
|
|
|
el: this.checkbox,
|
|
|
|
}, this.text);
|
|
|
|
BI.createWidget(BI.extend({
|
|
|
|
element: this,
|
|
|
|
}, BI.LogicFactory.createLogic(type, BI.extend(o.logic, {
|
|
|
|
items,
|
|
|
|
}))));
|
|
|
|
}
|
|
|
|
|
|
|
|
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 (BI.isNotNull(this.checkbox)) {
|
|
|
|
this.checkbox.setSelected(v);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|