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.1 KiB

import { BasicButton } from "../button.basic"
import { extend, shortcut } from "../../../../core"
8 years ago
/**
* guy
* 一个button和一行数 组成的一行listitem
*
* Created by GUY on 2015/9/9.
* @class TextItem
* @extends BasicButton
8 years ago
*/
@shortcut
export class TextItem extends BasicButton {
static xtype = "bi.text_item";
static EVENT_CHANGE = "EVENT_CHANGE";
8 years ago
_defaultConfig() {
const conf = super._defaultConfig(arguments);
return extend(conf, {
8 years ago
baseCls: (conf.baseCls || "") + " bi-text-item",
textAlign: "left",
whiteSpace: "nowrap",
textHgap: 0,
textVgap: 0,
textLgap: 0,
textRgap: 0,
7 years ago
});
}
render() {
const o = this.options;
8 years ago
this.text = BI.createWidget({
type: "bi.label",
8 years ago
element: this,
8 years ago
textAlign: o.textAlign,
whiteSpace: o.whiteSpace,
textHeight: o.whiteSpace === "nowrap" ? o.height : o.textHeight,
8 years ago
height: o.height,
hgap: o.textHgap,
vgap: o.textVgap,
lgap: o.textLgap,
rgap: o.textRgap,
text: o.text,
value: o.value,
keyword: o.keyword,
py: o.py,
8 years ago
});
}
8 years ago
doClick() {
super.doClick.apply(this, arguments);
8 years ago
if (this.isValid()) {
this.fireEvent(BI.TextItem.EVENT_CHANGE, this.getValue(), this);
}
}
8 years ago
doRedMark() {
8 years ago
this.text.doRedMark.apply(this.text, arguments);
}
8 years ago
unRedMark() {
8 years ago
this.text.unRedMark.apply(this.text, arguments);
}
8 years ago
doHighLight() {
8 years ago
this.text.doHighLight.apply(this.text, arguments);
}
8 years ago
unHighLight() {
8 years ago
this.text.unHighLight.apply(this.text, arguments);
}
8 years ago
setValue() {
8 years ago
if (!this.isReadOnly()) {
this.text.setValue.apply(this.text, arguments);
}
}
8 years ago
getValue() {
8 years ago
return this.text.getValue();
}
8 years ago
setText() {
8 years ago
this.text.setText.apply(this.text, arguments);
}
8 years ago
getText() {
8 years ago
return this.text.getText();
}
}