0
1
Fork 0
hedera-web-mindshore/js/htk/columns/text/index.js

51 lines
908 B
JavaScript
Raw Permalink Normal View History

2016-09-26 09:28:47 +00:00
2022-06-06 08:53:59 +00:00
module.exports = new Class({
Extends: Htk.Column
,Tag: 'htk-column-text'
2022-06-06 08:53:59 +00:00
,Properties: {
/**
* Format that applies to the value.
2022-05-26 06:08:31 +00:00
*/
2022-06-06 08:53:59 +00:00
format:{
type: String
2022-11-16 01:46:44 +00:00
,set(x) {
this._format = _(x);
}
2022-11-16 01:46:44 +00:00
,get() {
return this._format;
}
}
}
,_format: null
2022-11-16 01:46:44 +00:00
,initialize(props) {
this._cssClass = 'cell-text';
2022-06-06 16:02:17 +00:00
Htk.Column.prototype.initialize.call(this, props);
}
2022-11-16 01:46:44 +00:00
,render(tr) {
var node;
2022-05-26 06:08:31 +00:00
if (this.editable) {
var value = this.value ? this.value : '';
2022-05-26 06:08:31 +00:00
node = this.createElement('input');
node.type = 'text';
node.value = value;
2022-05-26 06:08:31 +00:00
node.addEventListener('changed',
this.inputChanged.bind(this, tr, node));
} else
node = this.createTextNode(
Vn.Value.format(this.value, this._format));
2022-06-06 16:02:17 +00:00
var td = Htk.Column.prototype.render.call(this, tr);
2022-05-26 06:08:31 +00:00
td.appendChild(node);
return td;
}
2022-11-16 01:46:44 +00:00
,inputChanged(tr, node) {
2022-05-26 06:08:31 +00:00
this.changed(tr, node.value);
}
});