UNPKG

ant-design-x-vue-next

Version:

Ant Design X for Vue — community continuation aligned with @ant-design/x

48 lines (47 loc) 1.83 kB
/** Modifier prefixes aligned with @ant-design/x ShortcutKeys. */ export type PrefixKeysType = 'Ctrl' | 'Alt' | 'Meta' | 'Shift'; export type CodeKeyType = number | 'number' | PrefixKeysType; /** * Tuple form used by React `@ant-design/x` (KeyCode number or `'number'` for 1–9). * @example `['Ctrl', 78]` for Ctrl+N · `['Ctrl', 'number']` for Ctrl+1…9 */ export type ShortcutKeys<CustomKey = number | 'number'> = [PrefixKeysType, PrefixKeysType, CustomKey] | [PrefixKeysType, CustomKey]; export type ShortcutKeyActionType = { actionShortcutKey: ShortcutKeys<number>; actionKeyCode: number; name: string; timeStamp: number; actionKeyCodeNumber: number | false; index?: number; }; export type ShortcutKeyInfoType = { shortcutKeys: ShortcutKeys | ShortcutKeys[]; shortcutKeysIcon: string[] | string[][]; }; /** Minimal KeyCode map (KeyboardEvent.keyCode) for common shortcuts. */ export declare const ShortcutKeyCode: { readonly N: 78; readonly UP: 38; readonly DOWN: 40; readonly ONE: 49; readonly TWO: 50; readonly THREE: 51; readonly FOUR: 52; readonly FIVE: 53; readonly SIX: 54; readonly SEVEN: 55; readonly EIGHT: 56; readonly NINE: 57; }; export declare const getShortcutKeysIcon: (key: CodeKeyType) => string; export declare const getShortcutAction: (shortcutKey: ShortcutKeys<number>, event: KeyboardEvent) => Omit<ShortcutKeyActionType, "name" | "index"> | false; type FlatEntry = { name: string; shortcutKey: ShortcutKeys<number>; index?: number; }; export declare const flattenShortcutKeys: (componentShortcutKeys?: Record<string, ShortcutKeys | ShortcutKeys[]>, contextShortcutKeys?: Record<string, ShortcutKeys | ShortcutKeys[]>) => { flatten: FlatEntry[]; info: Record<string, ShortcutKeyInfoType>; }; export {};