MCPcopy Create free account
hub / github.com/UI5/webcomponents / _modifyValue

Method _modifyValue

packages/main/src/StepInput.ts:572–595  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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

Callers 6

_onMouseWheelMethod · 0.95
_incValueMethod · 0.95
_decValueMethod · 0.95
_onkeydownMethod · 0.95
_spinValueMethod · 0.95
_onkeydownMethod · 0.45

Calls 6

_preciseValueMethod · 0.95
_formatNumberMethod · 0.95
_validateMethod · 0.95
_setButtonStateMethod · 0.95
_fireChangeEventMethod · 0.95
focusMethod · 0.45

Tested by

no test coverage detected