2018-01-25 15:34:48 +05:30
|
|
|
const BaseControl = require('./base');
|
|
|
|
|
|
|
|
class FloatControl extends BaseControl {
|
|
|
|
make() {
|
|
|
|
super.make();
|
2018-02-21 15:13:21 +05:30
|
|
|
this.input.setAttribute('type', 'text');
|
2018-02-07 18:53:52 +05:30
|
|
|
this.input.classList.add('text-right');
|
|
|
|
this.input.addEventListener('focus', () => {
|
|
|
|
setTimeout(() => {
|
|
|
|
this.input.select();
|
|
|
|
}, 100);
|
|
|
|
})
|
2018-01-25 15:34:48 +05:30
|
|
|
}
|
2018-02-08 17:15:32 +05:30
|
|
|
parse(value) {
|
|
|
|
value = parseFloat(value);
|
2018-03-05 22:15:21 +05:30
|
|
|
return isNaN(value) ? 0 : value;
|
2018-02-08 17:15:32 +05:30
|
|
|
}
|
2018-01-25 15:34:48 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = FloatControl;
|