type AnyParsedKeyValue = number | string | undefined; type ParsedEventInfo = [AnyParsedKeyValue, AnyParsedKeyValue | null]; interface KeyEventSupportedModifier { shiftKey: boolean; } /** * General methods to map and handle keys, and change keyboard mode */ declare class UIGeneralKeyboard { /** * Define if backspace button should be enabled */ static backspaceEnabled: boolean; /** * Define if keyboard is alphanumeric or numeric */ static alphanumericEnabled: boolean; /** * Check Keyboard instance * @returns Returns if instance exist or not */ static hasKeyboardInstance(): boolean; static checkInstanceIsValid(): boolean; /** * Keyboard method wrapper to validate Keyboard instance if something happens to it (eg. destroyed) * @param method Keybaord method */ static bindWrapper(method: (...args: any[]) => any | void): any | void; /** * Internal control for virtual keyboard when Sets the kernel keyboard to enter numbers only. */ static setKeyboardAsNumeric(): void; /** * Internal control for virtual keyboard when Sets the kernek keyboard to type alphanumeric characters. */ static setKeyboardAsAlphanumeric(): void; /** * Find the key code of given list and key map * * @param list Key list to find * @param map Map object with { keyCode : value } * @param keyName Key name to find its code * @returns Found key code or `null` */ static getMappedKeyCode(list: any[], map: { [key: number]: string | string[]; }, keyName: string): string | null; /** * Find the key name of given list and map for an KeyboardEvent * * @param keyCode Key code to find its name * @param modifiers Keyboard event modifierds * @returns Found key name or `null` */ static getEventMappedKeyName(keyCode: number, modifiers: KeyEventSupportedModifier): string | null; /** * Get the key code relative to a specific key name compatible with POS * @param keyName Key name * @returns Relative key code */ static getKeyCode(keyName: string): number | null; /** * Get UTF key code relative to a specific key name compatible with POS * @param keyName Key name * @param inferCharCode IF should infer via UTF table code (String.charCodeAt) * @returns Relative key code */ static getTableKeyCode(keyName: string, inferCharCode?: boolean): any; /** * Get the key name relative to a specific key code * @param keyCode Key code * @returns Relative key name */ static getKeyName(keyCode: number | undefined): string | undefined; /** * Get the mamba normalized key code from user input event * * - Use e.key{string} on some events on simulator or POS * - Use e.keyIdentifier{string} to work on POS values * - Use e.code{number} to work with alphabet keyboard * * @param event User input event * @returns Relative key code */ static parseEventKeyCode(event: KeyboardEvent): any; /** * Get the mamba normalized key name from user input event * @param event User input event * @returns The key name relative to its number */ static parseEventKeyName(event: KeyboardEvent): string | undefined; /** * Gets the normalized key code and name according to the POS key map through a keyboard input event. * @param event User input event * @returns A tuple containing the key code and key name respectively. Ex.: [13, "enter"] */ static parseEventKeys(event: KeyboardEvent): ParsedEventInfo; /** * Check if a certain key is a numeric key * @param keyCode Key code * @returns */ static isNumericKey(keyCode: number): boolean; /** * Check if a certain key is key that have an functionality * @param keyCode Key code * @returns */ static isFunctionKey(keyCode: number): boolean; /** * Check if a certain key is an action key * @param keyCode Key code * @deprecated Use `isFunctionKey(keyCode)` * @returns */ static isActionKey(keyCode: number): boolean; /** * Return if the backspace button is enabled * @returns */ static isBackspaceEnabled(): boolean; /** * Switch OFF backspace key */ static disableBackspace(): void; /** * Switch ON backspace key */ static enableBackspace(): void; } export { UIGeneralKeyboard }; declare const GeneralKeyboard: typeof UIGeneralKeyboard; export default GeneralKeyboard;