|
|
|
import { BasicButton } from "../../../base/single/button/button.basic";
|
|
|
|
import { shortcut, extend, createWidget } from "../../../core";
|
|
|
|
|
|
|
|
@shortcut()
|
|
|
|
export class MidTreeLeafItem extends BasicButton {
|
|
|
|
static xtype = "bi.mid_tree_leaf_item";
|
|
|
|
|
|
|
|
_defaultConfig() {
|
|
|
|
return extend(super._defaultConfig(arguments), {
|
|
|
|
extraCls: "bi-mid-tree-leaf-item bi-list-item-active",
|
|
|
|
logic: {
|
|
|
|
dynamic: false,
|
|
|
|
},
|
|
|
|
id: "",
|
|
|
|
pId: "",
|
|
|
|
layer: 0,
|
|
|
|
height: 24,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_init() {
|
|
|
|
super._init.apply(this, arguments);
|
|
|
|
const o = this.options;
|
|
|
|
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,
|
|
|
|
});
|
|
|
|
const type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
|
|
|
|
const items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, ((o.layer === 0) ? "" : {
|
|
|
|
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2,
|
|
|
|
el: {
|
|
|
|
type: "bi.layout",
|
|
|
|
cls: (o.pNode && o.pNode.isLastNode) ? "" : this._getBaseLineCls(),
|
|
|
|
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2,
|
|
|
|
height: o.height,
|
|
|
|
},
|
|
|
|
}), {
|
|
|
|
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
|
|
|
|
el: {
|
|
|
|
type: "bi.layout",
|
|
|
|
cls: this._getMidLineCls(),
|
|
|
|
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
|
|
|
|
height: o.height,
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
el: this.text,
|
|
|
|
});
|
|
|
|
createWidget(extend({
|
|
|
|
element: this,
|
|
|
|
}, BI.LogicFactory.createLogic(type, extend(o.logic, {
|
|
|
|
items,
|
|
|
|
}))));
|
|
|
|
}
|
|
|
|
|
|
|
|
_getBaseLineCls() {
|
|
|
|
switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
|
|
|
|
case "solid":
|
|
|
|
return "base-solid-line-conn-background";
|
|
|
|
default:
|
|
|
|
return "base-line-conn-background";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_getMidLineCls() {
|
|
|
|
switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
|
|
|
|
case "solid":
|
|
|
|
return "mid-solid-line-conn-background";
|
|
|
|
default:
|
|
|
|
return "mid-line-conn-background";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
doRedMark() {
|
|
|
|
this.text.doRedMark(...arguments);
|
|
|
|
}
|
|
|
|
|
|
|
|
unRedMark () {
|
|
|
|
this.text.unRedMark(...arguments);
|
|
|
|
}
|
|
|
|
|
|
|
|
doHighLight() {
|
|
|
|
this.text.doHighLight(...arguments);
|
|
|
|
}
|
|
|
|
|
|
|
|
unHighLight() {
|
|
|
|
this.text.unHighLight(...arguments);
|
|
|
|
}
|
|
|
|
|
|
|
|
getId() {
|
|
|
|
return this.options.id;
|
|
|
|
}
|
|
|
|
|
|
|
|
getPId() {
|
|
|
|
return this.options.pId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|