2018-01-25 10:04:48 +00:00
|
|
|
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-01-25 10:04:48 +00:00
|
|
|
}
|
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
|
|
|
}
|
2018-01-25 10:04:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = FloatControl;
|