UNPKG

1.89 kBTypeScriptView Raw
1import { SchemaType } from './parts/Schema';
2import { Intent } from './Intent';
3import { Partial } from './Partial';
4import { SortItem, Ordering } from './Sort';
5import { SerializeOptions, Serializable, SerializePath } from './StructureNodes';
6export declare function maybeSerializeMenuItem(item: MenuItem | MenuItemBuilder, index: number, path: SerializePath): MenuItem;
7declare type ShowAsAction = {
8 whenCollapsed: boolean;
9};
10export interface MenuItem {
11 title: string;
12 action?: string | Function;
13 intent?: Intent;
14 group?: string;
15 icon?: Function;
16 params?: object;
17 showAsAction?: boolean | ShowAsAction;
18}
19export declare type PartialMenuItem = Partial<MenuItem>;
20export declare class MenuItemBuilder implements Serializable {
21 protected spec: PartialMenuItem;
22 constructor(spec?: MenuItem);
23 action(action: string | Function): MenuItemBuilder;
24 getAction(): string | Function | undefined;
25 intent(intent: Intent): MenuItemBuilder;
26 getIntent(): Intent | undefined;
27 title(title: string): MenuItemBuilder;
28 getTitle(): string | undefined;
29 group(group: string): MenuItemBuilder;
30 getGroup(): string | undefined;
31 icon(icon: Function): MenuItemBuilder;
32 getIcon(): Function | undefined;
33 params(params: object): MenuItemBuilder;
34 getParams(): object | undefined;
35 showAsAction(showAsAction: boolean | ShowAsAction): MenuItemBuilder;
36 getShowAsAction(): boolean | ShowAsAction | undefined;
37 serialize(options?: SerializeOptions): MenuItem;
38 clone(withSpec?: PartialMenuItem): MenuItemBuilder;
39}
40export interface SortMenuItem extends MenuItem {
41 params: {
42 by: SortItem[];
43 };
44}
45export declare function getOrderingMenuItem(ordering: Ordering, extendedProjection?: string): MenuItemBuilder;
46export declare function getOrderingMenuItemsForSchemaType(typeName: SchemaType | string): any;
47export {};