@fesjs/fes-design
Version:
fes-design for PC
121 lines (120 loc) • 4 kB
TypeScript
import type { ComputedRef, InjectionKey, PropType, Ref } from 'vue';
import type { ComponentInnerProps, ExtractPublicPropTypes } from '../_util/interface';
import type { MenuItemType, MenuOption } from './interface';
export type MODE = 'vertical' | 'horizontal';
export type TRIGGER = 'click' | 'hover';
export declare const COMPONENT_NAME: {
MENU: string;
SUB_MENU: string;
MENU_ITEM: string;
MENU_GROUP: string;
};
export declare const CHILDREN_KEY: unique symbol;
export interface SubMenuInject {
handleItemClick: () => void;
}
export declare const SUB_MENU_KEY: InjectionKey<SubMenuInject>;
export interface MenuNode {
name: string;
uid: number | string;
}
export declare const MENU_KEY: InjectionKey<{
parentPath: ComputedRef<MenuNode[]>;
}>;
export declare const menuProps: {
readonly modelValue: {
readonly type: PropType<string | number>;
};
readonly mode: {
readonly type: PropType<MODE>;
readonly default: "horizontal";
readonly validator: (value: MODE) => boolean;
};
readonly collapsed: {
readonly type: BooleanConstructor;
readonly default: false;
};
readonly inverted: {
readonly type: BooleanConstructor;
readonly default: false;
};
readonly defaultExpandAll: {
readonly type: BooleanConstructor;
readonly default: false;
};
readonly expandedKeys: {
readonly type: PropType<(string | number)[]>;
readonly default: () => (number | string)[];
};
readonly accordion: {
readonly type: BooleanConstructor;
readonly default: false;
};
readonly options: {
readonly type: PropType<MenuOption[]>;
readonly default: () => MenuOption[];
};
readonly disabled: {
readonly type: PropType<boolean | (() => boolean)>;
readonly default: false;
};
readonly trigger: {
readonly type: PropType<"click" | "hover" | "contextmenu" | "focus">;
readonly default: "hover";
};
readonly arrow: {
readonly type: BooleanConstructor;
readonly default: false;
};
readonly getContainer: {
readonly type: FunctionConstructor;
};
readonly appendToContainer: {
readonly type: BooleanConstructor;
readonly default: true;
};
readonly popperClass: PropType<string | object | []>;
readonly placement: {
readonly type: PropType<"left" | "right" | "top" | "bottom" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end">;
readonly default: "bottom";
};
readonly offset: {
readonly type: NumberConstructor;
readonly default: 6;
};
readonly popperStyle: {
readonly type: PropType<import("vue").StyleValue>;
readonly default: () => {};
};
readonly showAfter: {
readonly type: NumberConstructor;
readonly default: 0;
};
readonly hideAfter: {
readonly type: NumberConstructor;
readonly default: 200;
};
readonly lazy: {
readonly type: BooleanConstructor;
readonly default: true;
};
readonly onlyShowTrigger: {
readonly type: BooleanConstructor;
};
readonly passive: {
readonly type: BooleanConstructor;
readonly default: true;
};
};
export type MenuProps = ExtractPublicPropTypes<typeof menuProps>;
export type RootMenuInjection = {
props: ComponentInnerProps<typeof menuProps>;
currentValue: Ref<string | number>;
clickMenuItem: (value: string | number) => void;
renderWithPopper: ComputedRef<boolean>;
currentExpandedKeys: Ref<(string | number)[]>;
accordion: ComputedRef<boolean>;
updateExpandedKeys: (val: string | number | (string | number)[]) => void;
handleSubMenuExpand: (subMenu: MenuItemType, indexPath: Ref<MenuNode[]>) => void;
};
export declare const ROOT_MENU_KEY: InjectionKey<RootMenuInjection>;