|
|
|
import {
|
|
|
|
shortcut,
|
|
|
|
extend,
|
|
|
|
createWidget,
|
|
|
|
Controller,
|
|
|
|
Events,
|
|
|
|
isNotNull, LogicFactory
|
|
|
|
} from "@/core";
|
|
|
|
import { NodeButton, Label } from "@/base";
|
|
|
|
import { TreeNodeCheckbox } from "@/case";
|
|
|
|
|
|
|
|
@shortcut()
|
|
|
|
export class SelectTreePlusGroupNode extends NodeButton {
|
|
|
|
static xtype = "bi.select_tree_plus_group_node";
|
|
|
|
|
|
|
|
_defaultConfig() {
|
|
|
|
const conf = super._defaultConfig(...arguments);
|
|
|
|
|
|
|
|
return extend(conf, {
|
|
|
|
baseCls:
|
|
|
|
`${conf.baseCls || ""
|
|
|
|
} bi-select-tree-plus-group-node bi-list-item-active`,
|
|
|
|
logic: {
|
|
|
|
dynamic: false,
|
|
|
|
},
|
|
|
|
id: "",
|
|
|
|
pId: "",
|
|
|
|
readonly: true,
|
|
|
|
open: false,
|
|
|
|
height: 24,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_init() {
|
|
|
|
super._init(...arguments);
|
|
|
|
const self = this,
|
|
|
|
o = this.options;
|
|
|
|
this.checkbox = createWidget({
|
|
|
|
type: TreeNodeCheckbox.xtype,
|
|
|
|
stopPropagation: true,
|
|
|
|
iconHeight: o.height,
|
|
|
|
iconWidth: o.iconWrapperWidth || o.height,
|
|
|
|
});
|
|
|
|
this.text = createWidget({
|
|
|
|
type: Label.xtype,
|
|
|
|
textAlign: "left",
|
|
|
|
whiteSpace: "nowrap",
|
|
|
|
textHeight: o.height,
|
|
|
|
height: o.height,
|
|
|
|
hgap: o.hgap,
|
|
|
|
text: o.text,
|
|
|
|
value: o.value,
|
|
|
|
keyword: o.keyword,
|
|
|
|
py: o.py,
|
|
|
|
});
|
|
|
|
this.checkbox.on(Controller.EVENT_CHANGE, function (type) {
|
|
|
|
if (type === Events.CLICK) {
|
|
|
|
if (this.isSelected()) {
|
|
|
|
self.triggerExpand();
|
|
|
|
} else {
|
|
|
|
self.triggerCollapse();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
const type = LogicFactory.createLogicTypeByDirection(
|
|
|
|
BI.Direction.Left
|
|
|
|
);
|
|
|
|
const items = LogicFactory.createLogicItemsByDirection(
|
|
|
|
BI.Direction.Left,
|
|
|
|
{
|
|
|
|
width: 24,
|
|
|
|
el: this.checkbox,
|
|
|
|
},
|
|
|
|
this.text
|
|
|
|
);
|
|
|
|
createWidget(
|
|
|
|
extend(
|
|
|
|
{
|
|
|
|
element: this,
|
|
|
|
},
|
|
|
|
LogicFactory.createLogic(
|
|
|
|
type,
|
|
|
|
extend(o.logic, {
|
|
|
|
items,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
isOnce() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
doRedMark() {
|
|
|
|
this.text.doRedMark(...arguments);
|
|
|
|
}
|
|
|
|
|
|
|
|
unRedMark() {
|
|
|
|
this.text.unRedMark(...arguments);
|
|
|
|
}
|
|
|
|
|
|
|
|
setOpened(v) {
|
|
|
|
super.setOpened(...arguments);
|
|
|
|
if (isNotNull(this.checkbox)) {
|
|
|
|
this.checkbox.setSelected(v);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|