chore: revert unrelated change
parent
200ae2ee00
commit
849598f9bf
|
@ -424,7 +424,7 @@ export default {
|
|||
|
||||
if (selectionStart === selectionEnd) {
|
||||
const deleteChar = inputValue.charAt(selectionStart - 1);
|
||||
const { decimalCharIndexWithoutPrefix } = this.getDecimalCharIndexes(inputValue);
|
||||
const { decimalCharIndex, decimalCharIndexWithoutPrefix } = this.getDecimalCharIndexes(inputValue);
|
||||
|
||||
if (this.isNumeralChar(deleteChar)) {
|
||||
const decimalLength = this.getDecimalLength(inputValue);
|
||||
|
@ -440,6 +440,10 @@ export default {
|
|||
} else {
|
||||
newValueStr = inputValue.slice(0, selectionStart - 1) + inputValue.slice(selectionStart);
|
||||
}
|
||||
} else if (decimalCharIndex > 0 && selectionStart > decimalCharIndex) {
|
||||
const insertedText = this.isDecimalMode() && (this.minFractionDigits || 0) < decimalLength ? '' : '0';
|
||||
|
||||
newValueStr = inputValue.slice(0, selectionStart - 1) + insertedText + inputValue.slice(selectionStart);
|
||||
} else if (decimalCharIndexWithoutPrefix === 1) {
|
||||
newValueStr = inputValue.slice(0, selectionStart - 1) + '0' + inputValue.slice(selectionStart);
|
||||
newValueStr = this.parseValue(newValueStr) > 0 ? newValueStr : '';
|
||||
|
@ -767,6 +771,7 @@ export default {
|
|||
newValue = this.parseValue(valueStr);
|
||||
newValue = !newValue && !this.allowEmpty ? 0 : newValue;
|
||||
this.updateInput(newValue, insertedValueStr, operation, valueStr);
|
||||
|
||||
this.handleOnInput(event, currentValue, newValue);
|
||||
}
|
||||
},
|
||||
|
@ -886,9 +891,9 @@ export default {
|
|||
this._decimal.lastIndex = 0;
|
||||
|
||||
if (this.suffixChar) {
|
||||
return decimalCharIndex !== -1 ? val1.replace(this.suffixChar, '').split(this._decimal)[0] + val2.replace(this.suffixChar, '').slice(decimalCharIndex) + this.suffixChar : val2;
|
||||
return decimalCharIndex !== -1 ? val1.replace(this.suffixChar, '').split(this._decimal)[0] + val2.replace(this.suffixChar, '').slice(decimalCharIndex) + this.suffixChar : val1;
|
||||
} else {
|
||||
return decimalCharIndex !== -1 ? val1.split(this._decimal)[0] + val2.slice(decimalCharIndex) : val2;
|
||||
return decimalCharIndex !== -1 ? val1.split(this._decimal)[0] + val2.slice(decimalCharIndex) : val1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue