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.
 
 
 

93 lines
2.4 KiB

import { BasicButton } from "../../base/single/button/button.basic";
import { shortcut, extend } from "../../core";
/**
* guy
* 单选框item
* @type {*|void|Object}
*/
@shortcut()
export class SingleSelectRadioItem extends BasicButton {
static xtype = "bi.single_select_radio_item";
static EVENT_CHANGE = "EVENT_CHANGE";
_defaultConfig() {
return extend(super._defaultConfig(arguments), {
extraCls: "bi-single-select-radio-item",
attributes: {
tabIndex: 1,
},
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
iconWrapperWidth: 16,
textHgap: 10,
});
}
render() {
const o = this.options;
return {
type: "bi.vertical_adapt",
columnSize: [o.iconWrapperWidth || o.height, "fill"],
items: [{
type: "bi.center_adapt",
items: [{
type: "bi.radio",
ref: _ref => {
this.radio = _ref;
},
}],
}, {
el: {
type: "bi.label",
ref: _ref => {
this.text = _ref;
},
cls: "list-item-text",
textAlign: "left",
whiteSpace: "nowrap",
textHeight: o.height,
height: o.height,
hgap: o.hgap || o.textHgap,
vgap: o.textVgap,
lgap: o.textLgap,
rgap: o.textRgap,
text: o.text,
keyword: o.keyword,
value: o.value,
py: o.py,
},
}],
};
}
_setEnable(enable) {
super._setEnable(...arguments);
if (enable === true) {
this.element.attr("tabIndex", 1);
} else if (enable === false) {
this.element.removeAttr("tabIndex");
}
}
doRedMark() {
this.text.doRedMark(...arguments);
}
unRedMark() {
this.text.unRedMark(...arguments);
}
doClick() {
super.doClick(...arguments);
if (this.isValid()) {
this.fireEvent(SingleSelectRadioItem.EVENT_CHANGE, this.isSelected(), this);
}
}
setSelected(v) {
super.setSelected(...arguments);
this.radio.setSelected(v);
}
}