Aller au contenu

context-menu

Ce contenu n’est pas encore disponible dans votre langue.

Classes

ContextMenuState

This class is a singleton that represents the state of the context menu.

It autohides based on the hovered state and filters items based on a query.

Properties

expanded
expanded: boolean;

Is menu fully expanded

Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:76

filteredItems
filteredItems: MenuItem[];

Filtered items.

Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:91

hidingDelay
hidingDelay: number;

Delay before hiding menu in miliseconds.

Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:65

items
items: MenuItem[];

Items of the menu.

Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:73

minHeight
minHeight: undefined | number;
Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:40

minWidth
minWidth: undefined | number;
Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:41

onHide
onHide: undefined | () => void;
Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:70

pos
pos: Position;

Position of the menu, in client coordinates.

Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:38

searchbar: boolean;

Visibility of the searchbar.

Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:68

sort
sort: boolean;
Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:88

target
target: undefined | HTMLElement;
Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:35

Accessors

focused
get focused(): boolean
set focused(f): void
Parameters

f: boolean

Returns

boolean

Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:116

hovered
get hovered(): boolean

Returns hovered state.

set hovered(v): void

Sets hovered state and manages autohide.

Parameters

v: boolean

Returns

boolean

Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:151

query
get query(): string
set query(q): void
Parameters

q: string

Returns

string

Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:80

visible
get visible(): boolean
set visible(v): void
Parameters

v: boolean

Returns

boolean

Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:46

instance
get static instance(): ContextMenuState

Returns the singleton instance.

Returns

ContextMenuState

Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:28

Methods

triggerFirstItem()
triggerFirstItem(): void
Returns

void

Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:12

triggerItem()
triggerItem(i): void
Parameters

i: number

Returns

void

Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:15

Type Aliases

ShowContextMenu()

type ShowContextMenu: (params) => void;

Parameters

params

params.expand?: boolean

params.items: Partial<MenuItem>[]

params.onHide?

params.pos: Position

params.searchbar?: boolean

params.sort?: boolean

Whether to sort the items. Default to false.

params.target?: HTMLElement

Returns

void

Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:160

Variables

contextMenu

const contextMenu: ContextMenuState = ContextMenuState.instance;

Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:158

Functions

showContextMenu()

function showContextMenu(params): void

Shows the context menu with the given items at the given position.

Helper function to use the context menu singleton.

Parameters

params

params.expand?: boolean

params.items: Partial<MenuItem>[]

params.onHide?

params.pos: Position

params.searchbar?: boolean

params.sort?: boolean

Whether to sort the items. Default to false.

params.target?: HTMLElement

Returns

void

Defined in

tmp/commons/src/lib/components/menu/context-menu.svelte.ts:176