mirror of
https://github.com/frappe/books.git
synced 2024-12-24 11:55:46 +00:00
20 lines
500 B
JavaScript
20 lines
500 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 value===NaN ? 0 : value;
|
|
}
|
|
};
|
|
|
|
module.exports = FloatControl; |