UNPKG

1.34 kBTypeScriptView Raw
1import { CommandHandler } from './command';
2import { SelectionService } from '../common/selection-service';
3export declare class SelectionCommandHandler<S> implements CommandHandler {
4 protected readonly selectionService: SelectionService;
5 protected readonly toSelection: (arg: any) => S | undefined;
6 protected readonly options: SelectionCommandHandler.Options<S>;
7 constructor(selectionService: SelectionService, toSelection: (arg: any) => S | undefined, options: SelectionCommandHandler.Options<S>);
8 execute(...args: any[]): Object | undefined;
9 isVisible(...args: any[]): boolean;
10 isEnabled(...args: any[]): boolean;
11 protected isMulti(): boolean;
12 protected getSelection(...args: any[]): S | S[] | undefined;
13 protected getSingleSelection(arg: Object | undefined): S | undefined;
14 protected getMultiSelection(arg: Object | undefined): S[] | undefined;
15}
16export declare namespace SelectionCommandHandler {
17 type Options<S> = SelectionOptions<false, S> | SelectionOptions<true, S[]>;
18 interface SelectionOptions<Multi extends boolean, T> {
19 multi: Multi;
20 execute(selection: T, ...args: any[]): any;
21 isEnabled?(selection: T, ...args: any[]): boolean;
22 isVisible?(selection: T, ...args: any[]): boolean;
23 }
24}
25//# sourceMappingURL=selection-command-handler.d.ts.map
\No newline at end of file