ngx-touch-keyboard
Version: 
Virtual Keyboard for Angular applications
209 lines (208 loc) • 5.76 kB
TypeScript
import { SafeHtml } from '@angular/platform-browser';
import { Locale } from './Locale/type';
import * as i0 from "@angular/core";
export declare class NgxTouchKeyboardComponent {
    private _sanitizer;
    private _elementRef;
    private _defaultLocale;
    locale: Locale;
    layoutMode: string;
    layoutName: string;
    debug: boolean;
    closePanel: import("@angular/core").OutputEmitterRef<void>;
    private _activeButtonClass;
    private _holdInteractionTimeout;
    private _holdTimeout;
    private _isMouseHold;
    private _caretPosition;
    private _caretPositionEnd;
    private _activeInputElement;
    /**
     * Getter for maxLength
     */
    get maxLength(): number;
    /**
     * Getter for type of input
     */
    get isTextarea(): boolean;
    /**
     * On keyup
     */
    handleKeyUp(event: KeyboardEvent): void;
    /**
     * On keydown
     */
    handleKeyDown(event: KeyboardEvent): void;
    /**
     * On pointerup (mouseup or touchend)
     */
    handleMouseUp(event: PointerEvent): void;
    /**
     * On select
     */
    handleSelect(event: Event): void;
    /**
     * On selectionchange
     */
    handleSelectionChange(event: Event): void;
    /**
     * Set locale
     *
     * @param value Locale
     */
    setLocale(value?: Locale): void;
    /**
     * Set active input
     *
     * @param input Input native element
     */
    setActiveInput(input: HTMLInputElement | HTMLTextAreaElement): void;
    /**
     * Check whether the button is a standard button
     */
    isStandardButton: (button: string) => boolean | "";
    /**
     * Retrieve button type
     *
     * @param button The button's layout name
     * @return The button type
     */
    getButtonType(button: string): 'standard-key' | 'function-key';
    /**
     * Adds default classes to a given button
     *
     * @param button The button's layout name
     * @return The classes to be added to the button
     */
    getButtonClass(button: string): string;
    /**
     * Returns the display (label) name for a given button
     *
     * @param button The button's layout name
     * @return The display name to be show to the button
     */
    getButtonDisplayName(button: string): SafeHtml;
    /**
     * Handles clicks made to keyboard buttons
     *
     * @param button The button layout name.
     * @param event The button event.
     */
    handleButtonPress(button: string, e?: Event): void;
    /**
     * Handles button down
     *
     * @param button The button layout name.
     * @param event The button event.
     */
    handleButtonDown(button: string, e?: Event): void;
    /**
     * Handles button up
     *
     * @param button The button layout name.
     * @param event The button event.
     */
    handleButtonUp(button: string, e?: Event): void;
    /**
     * Handles button hold
     */
    handleButtonHold(button: string): void;
    /**
     * Changes the internal caret position
     *
     * @private
     * @param position The caret's start position
     * @param positionEnd The caret's end position
     */
    private _setCaretPosition;
    /**
     * Moves the cursor position by a given amount
     *
     * @private
     * @param length Represents by how many characters the input should be moved
     * @param minus Whether the cursor should be moved to the left or not.
     */
    private _updateCaretPos;
    /**
     * Action method of updateCaretPos
     *
     * @private
     * @param length Represents by how many characters the input should be moved
     * @param minus Whether the cursor should be moved to the left or not.
     */
    private _updateCaretPosAction;
    /**
     * Removes an amount of characters before a given position
     *
     * @private
     * @param source The source input
     * @param position The (cursor) position from where the characters should be removed
     * @param moveCaret Whether to update input cursor
     */
    private _removeAt;
    /**
     * Adds a string to the input at a given position
     *
     * @private
     * @param source The source input
     * @param str The string to add
     * @param position The (cursor) position where the string should be added
     * @param moveCaret Whether to update virtual-keyboard cursor
     */
    private _addStringAt;
    /**
     * Method to dispatch necessary keyboard events to current input element.
     * @see https://w3c.github.io/uievents/tools/key-event-viewer.html
     *
     * @param button
     */
    private _dispatchEvents;
    /**
     * Called when an event that warrants a cursor position update is triggered
     *
     * @private
     * @param event
     */
    private _caretEventHandler;
    /**
     * Focus to input
     *
     * @private
     */
    private _focusActiveInput;
    /**
     * Handel highlight on key down
     *
     * @private
     * @param event The KeyboardEvent
     */
    private _handleHighlightKeyDown;
    /**
     * Handel highlight on key up
     *
     * @private
     * @param event The KeyboardEvent
     */
    private _handleHighlightKeyUp;
    /**
     * Transforms a KeyboardEvent's "key.code" string into a virtual-keyboard layout format
     *
     * @private
     * @param event The KeyboardEvent
     */
    private _getKeyboardLayoutKey;
    /**
     * Set active class in button
     *
     * @param buttonName
     */
    private _setActiveButton;
    /**
     * Remove active button
     *
     * @param buttonName
     */
    private _removeActiveButton;
    static ɵfac: i0.ɵɵFactoryDeclaration<NgxTouchKeyboardComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<NgxTouchKeyboardComponent, "ngx-touch-keyboard", never, {}, { "closePanel": "closePanel"; }, never, never, false, never>;
}