2016-09-26 09:28:47 +00:00
|
|
|
|
|
|
|
module.exports = new Class
|
2015-01-23 13:09:30 +00:00
|
|
|
({
|
|
|
|
Extends: Htk.Field
|
|
|
|
,Tag: 'htk-entry'
|
|
|
|
|
2016-10-16 14:16:08 +00:00
|
|
|
,render: function ()
|
2015-01-23 13:09:30 +00:00
|
|
|
{
|
2016-10-16 14:16:08 +00:00
|
|
|
var node = this.createRoot ('input');
|
|
|
|
node.type = 'text';
|
|
|
|
node.addEventListener ('change', this._onChange.bind (this));
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
2016-01-15 12:31:08 +00:00
|
|
|
,_onChange: function (event)
|
2015-01-23 13:09:30 +00:00
|
|
|
{
|
|
|
|
var newValue;
|
|
|
|
|
|
|
|
if (this.node.value == '')
|
|
|
|
newValue = null;
|
|
|
|
else
|
|
|
|
newValue = this.node.value;
|
|
|
|
|
|
|
|
this.valueChanged (newValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
,putValue: function (value)
|
|
|
|
{
|
|
|
|
if (!value)
|
|
|
|
this.node.value = '';
|
|
|
|
else
|
|
|
|
this.node.value = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
,setEditable: function (editable)
|
|
|
|
{
|
|
|
|
this.node.readOnly = !editable;
|
|
|
|
}
|
|
|
|
});
|