39 lines
591 B
JavaScript
39 lines
591 B
JavaScript
|
|
module.exports = new Class
|
|
({
|
|
Extends: Htk.Field
|
|
,Tag: 'htk-entry'
|
|
|
|
,render: function ()
|
|
{
|
|
var node = this.createRoot ('input');
|
|
node.type = 'text';
|
|
node.addEventListener ('change', this._onChange.bind (this));
|
|
}
|
|
|
|
,_onChange: function (event)
|
|
{
|
|
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;
|
|
}
|
|
});
|