@eclipse-scout/core
Version:
Eclipse Scout runtime
69 lines • 3.3 kB
TypeScript
import { Action, KeyboardEventWithMetaData, KeyStroke, KeyStrokeContextOptions, ScoutKeyboardEvent } from '../index';
/**
* Contains a list of {@link KeyStroke}s that can be activated by pressing the corresponding keys if the focus is inside the {@link $bindTarget}.
*/
export declare class KeyStrokeContext implements KeyStrokeContextOptions {
invokeAcceptInputOnActiveValueField: boolean;
keyStrokes: KeyStroke[];
stopPropagationInterceptors: ((event: ScoutKeyboardEvent) => void)[];
$bindTarget: JQuery | (() => JQuery);
$scopeTarget: JQuery | (() => JQuery);
/** @internal */
_handler: ((event: KeyboardEventWithMetaData) => boolean) & {
$target?: JQuery;
};
/**
* Arrays with combinations of keys to prevent from bubbling up in the DOM tree.
*/
protected _stopPropagationKeys: Record<number, number[]>;
constructor(options?: KeyStrokeContextOptions);
/**
* Registers the given keys as 'stopPropagation' keys, meaning that any keystroke event with that key and matching the modifier bit mask is prevented from bubbling the DOM tree up.
*
* @param modifierBitMask bitwise OR modifier constants to match a keystroke event. (KeyStrokeModifier.js)
* @param keys the keys to match a keystroke event.
*/
registerStopPropagationKeys(modifierBitMask: number, keys: number[]): void;
/**
* Unregisters the given keys as 'stopPropagation' keys.
*
* @param modifierBitMask bitwise OR modifier constants to match a keystroke event. (KeyStrokeModifier.js)
* @param keys the keys to match a keystroke event.
*/
unregisterStopPropagationKeys(modifierBitMask: number, keys: number[]): void;
toggleStopPropagationKeys(modifierBitMask: number, keys: number[], condition: boolean): void;
/**
* Use this method to register an interceptor to set propagation flags on context level.
*/
registerStopPropagationInterceptor(interceptor: (event: ScoutKeyboardEvent) => void): void;
/**
* Returns true if this event is handled by this context, and if so sets the propagation flags accordingly.
*/
accept(event: ScoutKeyboardEvent): boolean;
/**
* Sets the propagation flags to the given event.
*/
protected _applyPropagationFlags(event: ScoutKeyboardEvent): void;
protected _accept(event: ScoutKeyboardEvent): boolean;
registerKeyStroke(keyStroke: KeyStroke | Action): void;
/**
* Registers the given keystroke(s) if not installed yet.
*/
registerKeyStrokes(keyStrokes: KeyStroke | KeyStroke[] | Action | Action[]): void;
/**
* Uninstalls the given keystroke. Has no effect if not installed.
*/
unregisterKeyStroke(keyStroke: KeyStroke | Action): void;
unregisterKeyStrokes(keyStrokes: KeyStroke | KeyStroke[] | Action | Action[]): void;
protected _resolveKeyStroke(keyStroke: KeyStroke | Action): KeyStroke;
/**
* Returns the $target where to bind this context as keydown listener.
*/
$getBindTarget(): JQuery;
/**
* Returns the scope of this context and is used to determine the context's accessibility, meaning not covert by a glasspane.
*/
$getScopeTarget(): JQuery;
clone(): KeyStrokeContext;
}
//# sourceMappingURL=KeyStrokeContext.d.ts.map