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.

93 lines
2.5 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 FirstPlusGroupNode
* @extends NodeButton
8 years ago
*/
@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`,
8 years ago
logic: {
dynamic: false,
8 years ago
},
id: "",
pId: "",
open: false,
height: 24,
7 years ago
});
}
_init() {
super._init.apply(this, arguments);
const o = this.options;
this.checkbox = createWidget({
8 years ago
type: "bi.first_tree_node_checkbox",
stopPropagation: true,
iconHeight: o.height,
iconWidth: o.height,
8 years ago
});
this.text = createWidget({
8 years ago
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,
8 years ago
});
this.checkbox.on(Controller.EVENT_CHANGE, function (type) {
8 years ago
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,
8 years ago
}, this.text);
BI.createWidget(BI.extend({
element: this,
8 years ago
}, BI.LogicFactory.createLogic(type, BI.extend(o.logic, {
items,
8 years ago
}))));
}
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 (BI.isNotNull(this.checkbox)) {
this.checkbox.setSelected(v);
}
}
}
8 years ago