0
1
Fork 0
hedera-web-mindshore/js/htk/field/button.js

62 lines
1.1 KiB
JavaScript

module.exports = new Class({
Extends: Htk.Field
,Tag: 'htk-button'
,Properties: {
image: {
type: String
,set: function(x) {
this.iconNode.name = x;
}
},
icon: {
type: String
,set: function(x) {
this.iconNode.name = x;
}
},
tip: {
type: String
,set: function(x) {
this.node.title = x ? _(x) : '';
this.renderContent();
}
,get: function() {
return this.node.title;
}
},
showText: {
type: Boolean
,set: function(x) {
this._showText = x;
this.renderContent();
}
,get: function() {
return this._showText;
}
}
}
,_showText: false
,render: function() {
var node = this.createRoot('button');
node.className = 'htk-button';
this.iconNode = new Htk.Icon();
node.appendChild(this.iconNode.node);
}
,renderContent: function() {
if (this._textNode)
Vn.Node.remove(this._textNode);
if (this._showText && this.node.title) {
this._textNode = this.createElement('span');
this._textNode.className = 'text';
this._textNode.appendChild(this.createTextNode(this.node.title));
this.node.appendChild(this._textNode);
}
}
});