* Value modifier - modifies the value of the component, validates the new value and enables/disables increment and * decrement buttons according to the value and min/max values (if set). Fires `change` event when requested * @private * @param modifier modifies the value of the component with t
(modifier: number, fireChangeEvent = false)
| 570 | * @param fireChangeEvent if `true`, fires `change` event when the value is changed |
| 571 | */ |
| 572 | _modifyValue(modifier: number, fireChangeEvent = false) { |
| 573 | let value; |
| 574 | value = this.value + modifier; |
| 575 | if (this.min !== undefined && value < this.min) { |
| 576 | value = this.min; |
| 577 | } |
| 578 | if (this.max !== undefined && value > this.max) { |
| 579 | value = this.max; |
| 580 | } |
| 581 | value = this._preciseValue(value); |
| 582 | if (value !== this.value) { |
| 583 | this.value = value; |
| 584 | this.input.value = this._formatNumber(value); |
| 585 | this._validate(); |
| 586 | this._setButtonState(); |
| 587 | this.focused = true; |
| 588 | this.inputOuter.setAttribute("focused", ""); |
| 589 | if (fireChangeEvent) { |
| 590 | this._fireChangeEvent(); |
| 591 | } else { |
| 592 | this.input.focus(); |
| 593 | } |
| 594 | } |
| 595 | } |
| 596 | |
| 597 | /** |
| 598 | * Formats a number with thousands separator based on current locale |
no test coverage detected