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.
 
 
 

104 lines
2.6 KiB

import {
shortcut,
extend,
createWidget,
makeArray,
HorizontalAdaptLayout,
isNotNull,
Controller,
Events
} from "@/core";
import { NodeButton } from "@/base";
import { FirstPlusGroupNode } from "@/case";
@shortcut()
export class MultiLayerSingleTreeFirstPlusGroupNode extends NodeButton {
static xtype = "bi.multilayer_single_tree_first_plus_group_node";
_defaultConfig() {
const conf = super._defaultConfig(...arguments);
return extend(conf, {
extraCls: "bi-multilayer-single-tree-first-plus-group-node bi-list-item",
layer: 0, // 第几层级
id: "",
pId: "",
open: false,
height: 24,
});
}
_init() {
super._init(...arguments);
const o = this.options;
this.node = this._createNode();
const items = [];
items.push({
el: this.node,
lgap: (o.layer * BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT) / 2,
});
createWidget({
type: HorizontalAdaptLayout.xtype,
element: this,
columnSize: makeArray(o.layer, BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2),
items,
});
}
doRedMark() {
this.node.doRedMark(...arguments);
}
unRedMark() {
this.node.unRedMark(...arguments);
}
doClick() {
super.doClick(...arguments);
this.node.setSelected(this.isSelected());
}
setOpened(v) {
super.setOpened(...arguments);
if (isNotNull(this.node)) {
this.node.setOpened(v);
}
}
_createNode() {
const o = this.options;
return createWidget({
type: FirstPlusGroupNode.xtype,
cls: "bi-list-item-none",
logic: {
dynamic: true,
},
id: o.id,
pId: o.pId,
open: o.open,
isLastNode: o.isLastNode,
height: o.height,
hgap: o.hgap,
text: o.text,
value: o.value,
py: o.py,
keyword: o.keyword,
listeners: [
{
eventName: Controller.EVENT_CHANGE,
action: (...args) => {
const [type] = args;
if (type === Events.CLICK) {
// 本身实现click功能
return;
}
this.fireEvent(Controller.EVENT_CHANGE, ...args);
},
}
],
});
}
}