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.
 
 
 

68 lines
1.6 KiB

import { CenterAdaptLayout, Layout, shortcut, emptyFn } from "@/core";
import { BasicButton } from "../../button";
/**
* guy
* @extends Single
* @type {*|void|Object}
*/
@shortcut()
export class Radio extends BasicButton {
static xtype = "bi.radio";
static EVENT_CHANGE = "EVENT_CHANGE";
props = {
baseCls: "bi-radio",
selected: false,
handler: emptyFn,
width: 16,
height: 16,
iconWidth: 16,
iconHeight: 16,
};
render() {
const { iconWidth, iconHeight } = this.options;
return {
type: CenterAdaptLayout.xtype,
items: [
{
type: Layout.xtype,
cls: "radio-content",
ref: _ref => {
this.radio = _ref;
},
width: iconWidth,
height: iconHeight,
}
],
};
}
_setEnable(enable) {
super._setEnable(enable);
if (enable === true) {
this.radio.element.removeClass("base-disabled disabled");
} else {
this.radio.element.addClass("base-disabled disabled");
}
}
doClick() {
super.doClick(arguments);
if (this.isValid()) {
this.fireEvent(Radio.EVENT_CHANGE);
}
}
setSelected(b) {
super.setSelected(b);
if (b) {
this.radio.element.addClass("bi-high-light-background");
} else {
this.radio.element.removeClass("bi-high-light-background");
}
}
}