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.
 
 
 

96 lines
2.3 KiB

import { BasicButton } from "../button.basic";
import { shortcut, extend, createWidget } from "../../../../core";
/**
* guy
* 可以点击的一行文字
* @class TextButton
* @extends BasicButton
* 文字button
*/
@shortcut()
export class TextButton extends BasicButton {
static xtype = "bi.text_button";
static EVENT_CHANGE = "EVENT_CHANGE";
_defaultConfig() {
const conf = super._defaultConfig(arguments);
return extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-button",
textAlign: "center",
whiteSpace: "nowrap",
textWidth: null,
textHeight: null,
hgap: 0,
lgap: 0,
rgap: 0,
vgap: 0,
py: "",
});
}
render() {
const o = this.options;
this.text = createWidget({
type: "bi.label",
element: this,
textAlign: o.textAlign,
whiteSpace: o.whiteSpace,
textWidth: o.textWidth,
textHeight: o.textHeight,
width: o.width,
height: o.height,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
text: o.text,
value: o.value,
py: o.py,
keyword: o.keyword,
});
}
doClick() {
super.doClick.apply(this, arguments);
if (this.isValid()) {
this.fireEvent(BI.TextButton.EVENT_CHANGE, this.getValue(), this);
}
}
doRedMark() {
this.text.doRedMark.apply(this.text, arguments);
}
unRedMark() {
this.text.unRedMark.apply(this.text, arguments);
}
doHighLight() {
this.text.doHighLight.apply(this.text, arguments);
}
unHighLight() {
this.text.unHighLight.apply(this.text, arguments);
}
setText(text) {
super.setText.apply(this, arguments);
text = BI.isArray(text) ? text.join(",") : text;
this.text.setText(text);
}
setStyle(style) {
this.text.setStyle(style);
}
setValue(text) {
super.setValue.apply(this, arguments);
if (!this.isReadOnly()) {
text = BI.isArray(text) ? text.join(",") : text;
this.text.setValue(text);
}
}
}