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.
 
 
 

91 lines
2.0 KiB

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