libs/upp-base/src/modules/kiosk.ts
This service is responsible for managing a virtual keyboard in an Angular application. It provides methods to show and hide the keyboard, simulate key presses, and interact with an associated input element. It also emits events when the keyboard is shown or hidden, allowing components to react accordingly.
The kioskService is designed to be injected at the root level of an Angular
application, ensuring a single instance of the service is available globally.
It provides the ability to bind a virtual keyboard to an HTML input element,
simulating various keypress actions. This is useful for scenarios where a
touchscreen or custom input method is required.
// Import the kioskService in a component
import { kioskService } from './kiosk.service';constructor(private kioskService: kioskService) {}
// Show the keyboard with numeric input type this.kioskService.show(inputElement, 'num');
// Hide the keyboard this.kioskService.hide();
Properties |
|
Methods |
Accessors |
constructor()
|
| ClearInput |
ClearInput()
|
|
Clears the value of the associated input field and triggers relevant events.
Returns :
void
|
| hide |
hide()
|
|
Hides the virtual keyboard and emits an event.
Returns :
void
|
| keyPress | ||||||||
keyPress(key: string)
|
||||||||
|
Simulates a key press on the virtual keyboard, modifying the input value accordingly.
Parameters :
Returns :
void
|
| show | ||||||||||||
show(input: HTMLInputElement | HTMLTextAreaElement, type: "num" | "price" | "all")
|
||||||||||||
|
Shows the virtual keyboard and emits the type of keyboard.
Parameters :
Returns :
void
|
| Public OnKeyBoardHide |
Default value : this._OnKeyboardHide.asObservable()
|
|
Emits when the keyboard is hidden. Subscribers do not receive any data. |
| value |
getvalue()
|
|
Gets the current value of the input field associated with the keyboard.
Returns :
string | null
|