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

Method fireEventByAction

packages/main/src/Input.ts:1599–1630  ·  view source on GitHub ↗
(action: INPUT_ACTIONS, e: InputEvent)

Source from the content-addressed store, hash-verified

1597 }
1598
1599 fireEventByAction(action: INPUT_ACTIONS, e: InputEvent) {
1600 const valueBeforeInput = this.value;
1601 const inputRef = this.getInputDOMRefSync();
1602
1603 if (this.disabled || this.readonly) {
1604 return;
1605 }
1606
1607 const inputValue = this.getInputValue();
1608 const isUserInput = action === INPUT_ACTIONS.ACTION_ENTER;
1609
1610 this.value = inputValue;
1611 this.typedInValue = inputValue;
1612 this.valueBeforeSelectionStart = inputValue;
1613 const valueAfterInput = this.value;
1614
1615 if (isUserInput) { // input
1616 const inputType = e.inputType || "";
1617 const prevented = !this.fireDecoratorEvent(INPUT_EVENTS.INPUT, { inputType });
1618
1619 if (prevented) {
1620 // if the value is not changed after preventing the input event, revert the value
1621 if (valueAfterInput === this.value) {
1622 this.value = valueBeforeInput;
1623 }
1624
1625 inputRef && (inputRef.value = this.value);
1626 }
1627
1628 this.fireResetSelectionChange();
1629 }
1630 }
1631
1632 getInputValue() {
1633 const domRef = this.getDomRef();

Callers 1

_inputMethod · 0.95

Calls 3

getInputDOMRefSyncMethod · 0.95
getInputValueMethod · 0.95

Tested by

no test coverage detected