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.
 
 
 

69 lines
1.7 KiB

import { extend } from "@/core";
import { TreeView } from "./treeview";
/**
* guy
* 异步树
* @class BI.DisplayTree
* @extends BI.TreeView
*/
export class DisplayTree extends TreeView {
static xtype = "bi.display_tree";
static EVENT_CHANGE = "EVENT_CHANGE";
_defaultConfig() {
return extend(super._defaultConfig(...arguments), {
extraCls: "bi-display-tree",
});
}
// 配置属性
_configSetting() {
function beforeCollapse(treeId, treeNode) {
return false;
}
return {
view: {
selectedMulti: false,
dblClickExpand: false,
showIcon: false,
nameIsHTML: true,
showTitle: false,
},
data: {
key: {
title: "title",
name: "text",
},
simpleData: {
enable: true,
},
},
callback: {
beforeCollapse,
},
};
}
_dealWidthNodes(nodes) {
nodes = super._dealWidthNodes(...arguments);
BI.each(nodes, (i, node) => {
node.isParent = node.isParent || node.parent;
if (node.text == null) {
if (node.count > 0) {
node.text = `${node.value}(${BI.i18nText("BI-Basic_Altogether")}${node.count}${BI.i18nText(
"BI-Basic_Count"
)})`;
}
}
});
return nodes;
}
initTree(nodes, setting) {
this.nodes = BI.$.fn.zTree.init(this.tree.element, setting || this._configSetting(), nodes);
}
}