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.
100 lines
2.4 KiB
100 lines
2.4 KiB
import { CenterAdaptLayout, shortcut, extend, createWidget } from "@/core"; |
|
import { Icon, Label, BasicButton } from "@/base"; |
|
|
|
@shortcut() |
|
export class IconTreeLeafItem extends BasicButton { |
|
static xtype = "bi.icon_tree_leaf_item"; |
|
|
|
_defaultConfig() { |
|
return extend(super._defaultConfig(...arguments), { |
|
extraCls: "bi-icon-tree-leaf-item bi-list-item-active", |
|
logic: { |
|
dynamic: false, |
|
}, |
|
height: 24, |
|
iconWidth: 16, |
|
iconHeight: 16, |
|
iconCls: "", |
|
}); |
|
} |
|
|
|
_init() { |
|
super._init(...arguments); |
|
const o = this.options; |
|
|
|
const icon = createWidget({ |
|
type: CenterAdaptLayout.xtype, |
|
width: 24, |
|
cls: o.iconCls, |
|
items: [ |
|
{ |
|
type: Icon.xtype, |
|
width: o.iconWidth, |
|
height: o.iconHeight, |
|
}, |
|
], |
|
}); |
|
|
|
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, |
|
py: o.py, |
|
keyword: o.keyword, |
|
}); |
|
const type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); |
|
const items = BI.LogicFactory.createLogicItemsByDirection( |
|
BI.Direction.Left, |
|
{ |
|
width: 16, |
|
el: icon, |
|
}, |
|
{ |
|
el: this.text, |
|
} |
|
); |
|
createWidget( |
|
extend( |
|
{ |
|
element: this, |
|
}, |
|
BI.LogicFactory.createLogic( |
|
type, |
|
extend(o.logic, { |
|
items, |
|
hgap: 5, |
|
}) |
|
) |
|
) |
|
); |
|
} |
|
|
|
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; |
|
} |
|
}
|
|
|