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.

95 lines
2.7 KiB

8 years ago
/**
* guy
* 单选框item
* @type {*|void|Object}
*/
BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
_defaultConfig: function () {
return BI.extend(BI.SingleSelectRadioItem.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-single-select-radio-item",
attributes: {
tabIndex: 1
},
8 years ago
logic: {
dynamic: false
},
height: 24,
iconWrapperWidth: 16,
hgap: 10,
4 years ago
textHgap: 0,
textLgap: 0,
textRgap: 0
7 years ago
});
8 years ago
},
render: function () {
var self = this, o = this.options;
return {
type: "bi.vertical_adapt",
columnSize: [o.iconWrapperWidth || o.height, "fill"],
items: [{
8 years ago
type: "bi.center_adapt",
items: [{
type: "bi.radio",
ref: function (_ref) {
self.radio = _ref;
},
}]
}, {
el: {
type: "bi.label",
ref: function (_ref) {
self.text = _ref;
},
cls: "list-item-text",
textAlign: "left",
whiteSpace: "nowrap",
textHeight: o.height,
height: o.height,
hgap: o.hgap,
rgap: o.textRgap,
lgap: o.textLgap,
text: o.text,
keyword: o.keyword,
value: o.value,
py: o.py
}
}]
};
8 years ago
},
_setEnable: function (enable) {
BI.SingleSelectRadioItem.superclass._setEnable.apply(this, arguments);
if (enable === true) {
this.element.attr("tabIndex", 1);
} else if (enable === false) {
this.element.removeAttr("tabIndex");
}
},
8 years ago
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments);
},
doClick: function () {
BI.SingleSelectRadioItem.superclass.doClick.apply(this, arguments);
this.radio.setSelected(this.isSelected());
if (this.isValid()) {
this.fireEvent(BI.SingleSelectRadioItem.EVENT_CHANGE, this.isSelected(), this);
}
8 years ago
},
setSelected: function (v) {
BI.SingleSelectRadioItem.superclass.setSelected.apply(this, arguments);
this.radio.setSelected(v);
}
});
BI.SingleSelectRadioItem.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.single_select_radio_item", BI.SingleSelectRadioItem);