fineui是帆软报表和BI产品线所使用的前端框架。
 
 
 

84 lines
1.8 KiB

import { NodeButton } from "../button.node";
import { extend, shortcut } from "../../../../core";
/**
* guy
*
* Created by GUY on 2015/9/9.
* @class TextNode
* @extends NodeButton
*/
@shortcut()
export class TextNode extends NodeButton {
static xtype = "bi.text_node"
static EVENT_CHANGE = "EVENT_CHANGE"
_defaultConfig() {
const conf = super._defaultConfig(arguments);
return extend(conf, {
baseCls: `${conf.baseCls || ""} bi-text-node`,
textAlign: "left",
whiteSpace: "nowrap",
textHgap: 0,
textVgap: 0,
textLgap: 0,
textRgap: 0,
});
}
render() {
const o = this.options;
this.text = BI.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.apply(this, arguments);
if (this.isValid()) {
this.fireEvent(TextNode.EVENT_CHANGE, this.getValue(), this);
}
}
doRedMark() {
this.text.doRedMark(...arguments);
}
unRedMark() {
this.text.unRedMark(...arguments);
}
setValue() {
if (!this.isReadOnly()) {
this.text.setValue(...arguments);
}
}
getValue() {
return this.text.getValue();
}
setText() {
this.text.setText(...arguments);
}
getText() {
return this.text.getText();
}
}