File

libs/upp-base/src/modules/kiosk.ts

Description

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.

Example :
// 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();

Index

Properties
Methods
Accessors

Constructor

constructor()

Methods

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 :
Name Type Optional Description
key string No
  • The key to be pressed. Can be a character or special keys such as 'backspace' or 'breakline'.
Returns : void
show
show(input: HTMLInputElement | HTMLTextAreaElement, type: "num" | "price" | "all")

Shows the virtual keyboard and emits the type of keyboard.

Parameters :
Name Type Optional Description
input HTMLInputElement | HTMLTextAreaElement No
  • The HTML input element where the keyboard will be displayed.
type "num" | "price" | "all" No
  • The type of keyboard to be displayed ('num', 'price', or 'all').
Returns : void

Properties

Public OnKeyBoardHide
Default value : this._OnKeyboardHide.asObservable()

Emits when the keyboard is hidden. Subscribers do not receive any data.

Public OnKeyBoardShow
Default value : this._OnKeyboardShow.asObservable()

Emits when the keyboard is shown. Subscribers receive the type of keyboard being shown (either 'password', 'num', 'price', or 'all').

Accessors

value
getvalue()

Gets the current value of the input field associated with the keyboard.

Returns : string | null

results matching ""

    No results matching ""