* Select only the decimal part in the formatted element content, whatever the value of `selectNumberOnly` * Multiple cases are possible : * +1.234,57suffixText * * € +1.234,57suffixText * +€ 1.234,57suffixText * € 1.234,57+suffixText * * 1.234,57+ €suffixText
()
| 2791 | * @returns {AutoNumeric} |
| 2792 | */ |
| 2793 | selectDecimal() { |
| 2794 | let start = AutoNumericHelper.getElementValue(this.domElement).indexOf(this.settings.decimalCharacter); |
| 2795 | let end; |
| 2796 | |
| 2797 | if (start === -1) { |
| 2798 | // The decimal character has not been found, we deselect all |
| 2799 | start = 0; |
| 2800 | end = 0; |
| 2801 | } else { |
| 2802 | // A decimal character has been found |
| 2803 | start = start + 1; // We add 1 to exclude the decimal character from the selection |
| 2804 | |
| 2805 | let decimalCount; |
| 2806 | if (this.isFocused) { |
| 2807 | decimalCount = this.settings.decimalPlacesShownOnFocus; |
| 2808 | } else { |
| 2809 | decimalCount = this.settings.decimalPlacesShownOnBlur; |
| 2810 | } |
| 2811 | |
| 2812 | end = start + Number(decimalCount); |
| 2813 | } |
| 2814 | |
| 2815 | AutoNumericHelper.setElementSelection(this.domElement, start, end); |
| 2816 | |
| 2817 | return this; |
| 2818 | } |
| 2819 | |
| 2820 | /** |
| 2821 | * Return the DOM element reference of the autoNumeric-managed element |
no test coverage detected