forked from fanruan/fineui
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.
87 lines
2.2 KiB
87 lines
2.2 KiB
import { shortcut, extend, createWidget, Controller, Events, makeArray, HorizontalAdaptLayout } from "@/core"; |
|
import { BasicButton } from "@/base"; |
|
|
|
@shortcut() |
|
export class MultiLayerSingleTreeFirstTreeLeafItem extends BasicButton { |
|
static xtype = "bi.multilayer_single_tree_first_tree_leaf_item"; |
|
|
|
_defaultConfig() { |
|
return extend(super._defaultConfig(...arguments), { |
|
extraCls: "bi-multilayer-single-tree-first-tree-leaf-item bi-list-item-active", |
|
logic: { |
|
dynamic: false, |
|
}, |
|
layer: 0, |
|
id: "", |
|
pId: "", |
|
height: 24, |
|
}); |
|
} |
|
|
|
_init() { |
|
super._init(...arguments); |
|
const self = this, |
|
o = this.options; |
|
this.item = createWidget({ |
|
type: "bi.first_tree_leaf_item", |
|
cls: "bi-list-item-none", |
|
logic: { |
|
dynamic: true, |
|
}, |
|
id: o.id, |
|
pId: o.pId, |
|
height: o.height, |
|
hgap: o.hgap, |
|
text: o.text, |
|
value: o.value, |
|
py: o.py, |
|
keyword: o.keyword, |
|
}); |
|
this.item.on(Controller.EVENT_CHANGE, function (type) { |
|
if (type === Events.CLICK) { |
|
// 本身实现click功能 |
|
return; |
|
} |
|
self.fireEvent(Controller.EVENT_CHANGE, arguments); |
|
}); |
|
|
|
const items = []; |
|
|
|
items.push({ |
|
el: this.item, |
|
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, |
|
}); |
|
} |
|
|
|
doHighLight() { |
|
this.item.doHighLight(...arguments); |
|
} |
|
|
|
unHighLight() { |
|
this.item.unHighLight(...arguments); |
|
} |
|
|
|
getId() { |
|
return this.options.id; |
|
} |
|
|
|
getPId() { |
|
return this.options.pId; |
|
} |
|
|
|
doClick() { |
|
super.doClick(...arguments); |
|
this.item.setSelected(this.isSelected()); |
|
} |
|
|
|
setSelected(v) { |
|
super.setSelected(...arguments); |
|
this.item.setSelected(v); |
|
} |
|
}
|
|
|