UNPKG

@difizen/mana-core

Version:

82 lines 3.06 kB
/// <reference types="react" /> import type { Disposable, Event } from '@difizen/mana-common'; import { Emitter } from '@difizen/mana-common'; import { CommandRegistry } from '../command/command-registry'; import type { MenuItem, MenuPath, ActionMenuNode, MenuNode } from './menu-protocol'; /** * Node representing a (sub)menu in the menu tree structure. */ export declare class DefaultActionMenuItem implements MenuNode, Disposable { readonly id: string; readonly key: string; disposed?: boolean | undefined; readonly order?: string | undefined; /** * Optional label for the item. */ label?: React.ReactNode | React.FC; /** * Optional icon for the item. */ readonly icon?: React.ReactNode | React.FC; readonly command?: string; execute?: (...args: any[]) => any; isEnabled?: ((...args: any[]) => boolean) | undefined; isVisible?: ((...args: any[]) => boolean) | undefined; isActive?: ((...args: any[]) => boolean) | undefined; protected disposedEventEmitter: Emitter<void>; protected readonly commands: CommandRegistry; protected readonly node: ActionMenuNode; protected readonly parentPath: MenuPath; onDisposed: Event<void>; constructor(commands: CommandRegistry, node: ActionMenuNode, parentPath: MenuPath); protected doCommandExecute: (...args: any[]) => any; dispose(): void; renderTitle: () => import("react/jsx-runtime").JSX.Element; renderIcon: () => import("react/jsx-runtime").JSX.Element; } /** * Node representing a (sub)menu in the menu tree structure. */ export declare class DefaultGeneralMenuItem implements MenuNode, Disposable { readonly id: string; readonly key: string; readonly path: MenuPath; get isSubmenu(): boolean; readonly children: (MenuItem | DefaultActionMenuItem)[]; disposed?: boolean | undefined; order?: string | undefined; /** * Optional label for the item. */ label?: React.ReactNode | React.FC; /** * Optional icon for the item. */ icon?: React.ReactNode | React.FC; execute?: (...args: any[]) => any; isEnabled?: (...args: any[]) => boolean; isVisible?: (...args: any[]) => boolean; protected disposedEventEmitter: Emitter<void>; protected readonly commands: CommandRegistry; protected readonly node: MenuNode; protected readonly parentPath: MenuPath; onDisposed: Event<void>; constructor(commands: CommandRegistry, node: MenuNode, parentPath: MenuPath); /** * Inserts the given node at the position indicated by `sortString`. * * @returns a disposable which, when called, will remove the given node again. */ addNode: (item: MenuItem) => MenuItem; /** * Removes the first node with the given id. * * @param id node id. */ removeNode(id: string): void; dispose(): void; renderTitle: () => import("react/jsx-runtime").JSX.Element; renderIcon: () => import("react/jsx-runtime").JSX.Element; } //# sourceMappingURL=default-menu-node.d.ts.map