adopted-ember-addons / adopted-ember-addons/ember-inputmask
Pasting a value with decimal=false results in the radix being removed, but not the decimal portion
- 主要語言
- JavaScript
- 星號
- 67
- 分支
- 43
- PR 合併指標
- 30 天內沒有已合併 PR
描述
I had a `number-input` with `decimal=false` and though that does prevent a user from entering a decimal point, if the user instead pastes in a value like 100.32, the decimal point is just removed, leaving 10032, which is obviously way bigger. The expected behavior is that the decimal portion be trimmed off.
It works fine, however, if decimals are allowed and the user pastes in a number with more decimal digits. For example, if they paste in 100.321, with default options, the input will show just 100.32.
I tried setting `decimal=0` but that didn't fix it. I'm happy to submit a PR, but I don't know what to change to allow this. I'm guessing an `else` condition here, but I'm not sure:
```
//ember-inputmask/components/input-mask
...
updateMask: function() {
this.setProperties({
'options.autoGroup': this.get('group'),
'options.groupSeparator': this.get('separator'),
'options.radixPoint': this.get('radix'),
'options.groupSize': this.get('groupSize')
});
if (this.get('decimal') === true) {
this.set('mask', 'decimal');
this.set('options.digits', 2);
} else if (this.get('decimal')) {
this.set('mask', 'decimal');
this.set('options.digits', this.get('decimal'));
}
this._super();
}.observes('mask', 'group', 'decimal', 'separator', 'radix', 'groupSize')
```
貢獻指南
評估
這個 Issue 還沒有評估資料。