@odoo/o-spreadsheet
Version:
A spreadsheet component
84 lines (83 loc) • 2.53 kB
TypeScript
import { Component } from "@odoo/owl";
import { Action, MenuItemOrSeparator } from "../../actions/action";
import { Pixel, Rect } from "../../types";
import { SpreadsheetChildEnv } from "../../types/spreadsheet_env";
export type MenuItemRects = {
[menuItemId: string]: Rect;
};
export interface MenuProps {
menuItems: MenuItemOrSeparator[];
onClose: () => void;
onScroll?: (ev: CustomEvent) => void;
onClickMenu?: (menu: Action, ev: PointerEvent) => void;
onMouseEnter?: (menu: Action, ev: PointerEvent) => void;
onMouseLeave?: (menu: Action, ev: PointerEvent) => void;
hoveredMenuId?: string;
isHoveredMenuFocused?: boolean;
width?: number;
onKeyDown?: (ev: KeyboardEvent) => void;
disableKeyboardNavigation?: boolean;
}
export interface MenuState {
isOpen: boolean;
parentMenu?: Action;
scrollOffset?: Pixel;
menuItems: Action[];
isHoveringChild?: boolean;
}
export declare class Menu extends Component<MenuProps, SpreadsheetChildEnv> {
static template: string;
static props: {
menuItems: ArrayConstructor;
onClose: FunctionConstructor;
onClickMenu: {
type: FunctionConstructor;
optional: boolean;
};
onMouseEnter: {
type: FunctionConstructor;
optional: boolean;
};
onMouseLeave: {
type: FunctionConstructor;
optional: boolean;
};
width: {
type: NumberConstructor;
optional: boolean;
};
hoveredMenuId: {
type: StringConstructor;
optional: boolean;
};
isHoveredMenuFocused: {
type: BooleanConstructor;
optional: boolean;
};
onScroll: {
type: FunctionConstructor;
optional: boolean;
};
onKeyDown: {
type: FunctionConstructor;
optional: boolean;
};
disableKeyboardNavigation: {
type: BooleanConstructor;
optional: boolean;
};
};
static components: {};
static defaultProps: {};
private menuRef;
setup(): void;
get childrenHaveIcon(): boolean;
getIconName(menu: Action): string;
getColor(menu: Action): string;
getIconColor(menu: Action): string;
getName(menu: Action): string;
isRoot(menu: Action): boolean;
isEnabled(menu: Action): boolean;
get menuStyle(): string;
onClickMenu(menu: Action, ev: PointerEvent): void;
}