1 | import { Widget } from '@lumino/widgets';
|
2 | /**
|
3 | * Options when add a command to a semantic group.
|
4 | */
|
5 | interface ISemanticCommand {
|
6 | /**
|
7 | * Command id
|
8 | */
|
9 | id: string;
|
10 | /**
|
11 | * Whether this command is enabled for a given widget
|
12 | * @param widget Widget
|
13 | */
|
14 | isEnabled?(widget: Widget): boolean;
|
15 | /**
|
16 | * Command rank in the semantic group
|
17 | *
|
18 | * #### Note
|
19 | * If multiple commands are enabled at the same time,
|
20 | * the one with the smallest rank will be executed.
|
21 | */
|
22 | rank?: number;
|
23 | }
|
24 | /**
|
25 | * Semantic group of commands
|
26 | */
|
27 | export declare class SemanticCommand {
|
28 | /**
|
29 | * Default rank for semantic command
|
30 | */
|
31 | static readonly DEFAULT_RANK = 500;
|
32 | /**
|
33 | * Add a command to the semantic group
|
34 | *
|
35 | * @param command Command to add
|
36 | */
|
37 | add(command: ISemanticCommand): void;
|
38 | /**
|
39 | * Get the command id of the enabled command from this group
|
40 | * for the given widget.
|
41 | *
|
42 | * @param widget Widget
|
43 | * @returns Command id
|
44 | */
|
45 | getActiveCommandId(widget: Widget): string | null;
|
46 | protected _commands: Required<ISemanticCommand>[];
|
47 | }
|
48 | export {};
|