2
0
mirror of https://github.com/frappe/books.git synced 2024-12-25 12:10:06 +00:00
books/client/view/controls/float.js

20 lines
507 B
JavaScript
Raw Normal View History

const BaseControl = require('./base');
class FloatControl extends BaseControl {
make() {
super.make();
2018-02-21 09:43:21 +00:00
this.input.setAttribute('type', 'text');
2018-02-07 13:23:52 +00:00
this.input.classList.add('text-right');
this.input.addEventListener('focus', () => {
setTimeout(() => {
this.input.select();
}, 100);
})
}
2018-02-08 11:45:32 +00:00
parse(value) {
value = parseFloat(value);
2018-03-05 16:45:21 +00:00
return isNaN(value) ? 0 : value;
2018-02-08 11:45:32 +00:00
}
};
module.exports = FloatControl;