|
|
|
import { NodeButton } from "../button.node";
|
|
|
|
import { extend, shortcut } from "../../../../core";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by GUY on 2015/9/9.
|
|
|
|
* @class TextIconNode
|
|
|
|
* @extends NodeButton
|
|
|
|
*/
|
|
|
|
@shortcut()
|
|
|
|
export class TextIconNode extends NodeButton {
|
|
|
|
|
|
|
|
static EVENT_CHANGE = "EVENT_CHANGE";
|
|
|
|
static xtype = "bi.text_icon_node";
|
|
|
|
|
|
|
|
_defaultConfig() {
|
|
|
|
const conf = super._defaultConfig(arguments);
|
|
|
|
|
|
|
|
return extend(conf, {
|
|
|
|
baseCls: `${conf.baseCls || ""} bi-text-icon-node`,
|
|
|
|
cls: "close-ha-font",
|
|
|
|
iconHeight: null,
|
|
|
|
iconWidth: null,
|
|
|
|
textHgap: 0,
|
|
|
|
textVgap: 0,
|
|
|
|
textLgap: 0,
|
|
|
|
textRgap: 0,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const o = this.options;
|
|
|
|
|
|
|
|
return {
|
|
|
|
type: "bi.vertical_adapt",
|
|
|
|
columnSize: ["fill", o.iconWrapperWidth || o.height],
|
|
|
|
items: [{
|
|
|
|
el: {
|
|
|
|
type: "bi.label",
|
|
|
|
ref: _ref => {
|
|
|
|
this.text = _ref;
|
|
|
|
},
|
|
|
|
cls: "list-item-text",
|
|
|
|
textAlign: "left",
|
|
|
|
hgap: o.textHgap,
|
|
|
|
vgap: o.textVgap,
|
|
|
|
lgap: o.textLgap,
|
|
|
|
rgap: o.textRgap,
|
|
|
|
text: o.text,
|
|
|
|
value: o.value,
|
|
|
|
keyword: o.keyword,
|
|
|
|
height: o.height,
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
type: "bi.icon_label",
|
|
|
|
cls: o.iconCls,
|
|
|
|
width: o.iconWrapperWidth || o.height,
|
|
|
|
height: o.height,
|
|
|
|
iconWidth: o.iconWidth,
|
|
|
|
iconHeight: o.iconHeight,
|
|
|
|
}],
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
doClick() {
|
|
|
|
super.doClick(...arguments);
|
|
|
|
if (this.isValid()) {
|
|
|
|
this.fireEvent(TextIconNode.EVENT_CHANGE, this.getValue(), this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setValue() {
|
|
|
|
if (!this.isReadOnly()) {
|
|
|
|
this.text.setValue(...arguments);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
getValue() {
|
|
|
|
return this.text.getValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
setText() {
|
|
|
|
this.text.setText(...arguments);
|
|
|
|
}
|
|
|
|
|
|
|
|
getText() {
|
|
|
|
return this.text.getText();
|
|
|
|
}
|
|
|
|
|
|
|
|
doRedMark() {
|
|
|
|
this.text.doRedMark(...arguments);
|
|
|
|
}
|
|
|
|
|
|
|
|
unRedMark() {
|
|
|
|
this.text.unRedMark(...arguments);
|
|
|
|
}
|
|
|
|
}
|