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.

85 lines
1.8 KiB

import { NodeButton } from "../button.node";
import { extend, shortcut } from "../../../../core";
8 years ago
/**
* guy
*
* Created by GUY on 2015/9/9.
* @class TextNode
* @extends NodeButton
8 years ago
*/
@shortcut()
export class TextNode extends NodeButton {
static xtype = "bi.text_node"
static EVENT_CHANGE = "EVENT_CHANGE"
8 years ago
_defaultConfig() {
const conf = super._defaultConfig(arguments);
return extend(conf, {
baseCls: `${conf.baseCls || ""} bi-text-node`,
8 years ago
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(TextNode.EVENT_CHANGE, this.getValue(), this);
8 years ago
}
}
8 years ago
doRedMark() {
this.text.doRedMark(...arguments);
}
8 years ago
unRedMark() {
this.text.unRedMark(...arguments);
}
8 years ago
setValue() {
8 years ago
if (!this.isReadOnly()) {
this.text.setValue(...arguments);
8 years ago
}
}
8 years ago
getValue() {
8 years ago
return this.text.getValue();
}
8 years ago
setText() {
this.text.setText(...arguments);
}
8 years ago
getText() {
8 years ago
return this.text.getText();
}
}