2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 15:50:56 +00:00
books/client/view/controls/float.js
2018-03-05 22:15:21 +05:30

20 lines
507 B
JavaScript

const BaseControl = require('./base');
class FloatControl extends BaseControl {
make() {
super.make();
this.input.setAttribute('type', 'text');
this.input.classList.add('text-right');
this.input.addEventListener('focus', () => {
setTimeout(() => {
this.input.select();
}, 100);
})
}
parse(value) {
value = parseFloat(value);
return isNaN(value) ? 0 : value;
}
};
module.exports = FloatControl;