mirror of
https://github.com/frappe/books.git
synced 2024-11-10 15:50:56 +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; |