g6/packages/site/docs/apis/plugins/WIP-MenuConfig.en.md
2023-11-07 21:39:59 +08:00

5.8 KiB

title
MenuConfig

Overview - v5.0.0-alpha.9 / Modules / plugins / MenuConfig

plugins.MenuConfig

The MenuConfig interface contains the following properties:

  • handleMenuClick: An optional function for handling menu click events. It takes two arguments: target (of type HTMLElement) and item (of type Item), and has no return value.
  • getContent: An optional function for getting the content of the menu. It takes an optional argument of type IG6GraphEvent, and returns a value of type HTMLDivElement, string, or Promise (resolving to HTMLDivElement or string).
  • offsetX: An optional number representing the offset of the menu in the X direction.
  • offsetY: An optional number representing the offset of the menu in the Y direction.
  • shouldBegin: An optional function for determining whether the menu should be displayed. It takes an optional argument of type IG6GraphEvent, and returns a boolean value.
  • itemTypes: An optional array of strings representing the types of items for which the menu is allowed to be displayed.
  • trigger: An optional string, either 'click' or 'contextmenu', representing the event type that triggers the display of the menu.
  • onHide: An optional function to be executed when the menu is hidden. It takes no arguments and returns a boolean value.
  • loadingContent: An optional HTMLDivElement or string representing the loading DOM.
  • liHoverStyle: An optional object representing the style of li elements when hovered over. It can contain any number of key-value pairs, where the key is a style name and the value is a string.

Hierarchy

  • IPluginBaseConfig

    MenuConfig

Properties

className

Optional className: string

Inherited from

IPluginBaseConfig.className

Defined in

packages/g6/src/types/plugin.ts:6


container

Optional container: string | HTMLDivElement

Inherited from

IPluginBaseConfig.container

Defined in

packages/g6/src/types/plugin.ts:5


getContent

Optional getContent: (evt?: IG6GraphEvent) => string | HTMLDivElement | Promise<string | HTMLDivElement>

Type declaration

▸ (evt?): string | HTMLDivElement | Promise<string | HTMLDivElement>

Parameters
Name Type
evt? IG6GraphEvent
Returns

string | HTMLDivElement | Promise<string | HTMLDivElement>

Defined in

packages/g6/src/stdlib/plugin/menu/index.ts:54


graph

Optional graph: IGraph<BehaviorRegistry, ThemeRegistry>

Inherited from

IPluginBaseConfig.graph

Defined in

packages/g6/src/types/plugin.ts:7


handleMenuClick

Optional handleMenuClick: (target: HTMLElement, item: default) => void

Type declaration

▸ (target, item): void

Parameters
Name Type
target HTMLElement
item default
Returns

void

Defined in

packages/g6/src/stdlib/plugin/menu/index.ts:52


itemTypes

Optional itemTypes: string[]

Defined in

packages/g6/src/stdlib/plugin/menu/index.ts:60


liHoverStyle

Optional liHoverStyle: Object

Index signature

▪ [key: string]: string

Defined in

packages/g6/src/stdlib/plugin/menu/index.ts:65


loadingContent

Optional loadingContent: string | HTMLDivElement

Defined in

packages/g6/src/stdlib/plugin/menu/index.ts:64


offsetX

Optional offsetX: number

Defined in

packages/g6/src/stdlib/plugin/menu/index.ts:57


offsetY

Optional offsetY: number

Defined in

packages/g6/src/stdlib/plugin/menu/index.ts:58


onHide

Optional onHide: () => boolean

Type declaration

▸ (): boolean

Returns

boolean

Defined in

packages/g6/src/stdlib/plugin/menu/index.ts:62


shouldBegin

Optional shouldBegin: (evt?: IG6GraphEvent) => boolean

Type declaration

▸ (evt?): boolean

Parameters
Name Type
evt? IG6GraphEvent
Returns

boolean

Defined in

packages/g6/src/stdlib/plugin/menu/index.ts:59


trigger

Optional trigger: "contextmenu" | "click"

Defined in

packages/g6/src/stdlib/plugin/menu/index.ts:61