primeng
Version:
PrimeNG is a premium UI library for Angular featuring a rich set of 90+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBlock,
136 lines (133 loc) • 3.7 kB
TypeScript
import { TemplateRef } from '@angular/core';
import { MotionOptions } from '@primeuix/motion';
import { MenuItem, PassThrough, PassThroughOption } from 'primeng/api';
/**
* Custom pass-through(pt) options.
* @template I Type of instance.
*
* @see {@link ContextMenu.pt}
* @group Interface
*/
interface ContextMenuPassThroughOptions<I = unknown> {
/**
* Used to pass attributes to the root's DOM element.
*/
root?: PassThroughOption<HTMLDivElement, I>;
/**
* Used to pass attributes to the root list's DOM element.
*/
rootList?: PassThroughOption<HTMLUListElement, I>;
/**
* Used to pass attributes to the submenu's DOM element.
*/
submenu?: PassThroughOption<HTMLUListElement, I>;
/**
* Used to pass attributes to the separator's DOM element.
*/
separator?: PassThroughOption<HTMLLIElement, I>;
/**
* Used to pass attributes to the item's DOM element.
*/
item?: PassThroughOption<HTMLLIElement, I>;
/**
* Used to pass attributes to the item content's DOM element.
*/
itemContent?: PassThroughOption<HTMLDivElement, I>;
/**
* Used to pass attributes to the item link's DOM element.
*/
itemLink?: PassThroughOption<HTMLAnchorElement, I>;
/**
* Used to pass attributes to the item icon's DOM element.
*/
itemIcon?: PassThroughOption<HTMLSpanElement, I>;
/**
* Used to pass attributes to the item label's DOM element.
*/
itemLabel?: PassThroughOption<HTMLSpanElement, I>;
/**
* Used to pass attributes to the submenu icon's DOM element.
*/
submenuIcon?: PassThroughOption<SVGElement, I>;
/**
* Used to pass options to the motion component/directive.
*/
motion?: MotionOptions;
}
/**
* Defines valid pass-through options in ContextMenu.
* @see {@link ContextMenuPassThroughOptions}
*
* @template I Type of instance.
*/
type ContextMenuPassThrough<I = unknown> = PassThrough<I, ContextMenuPassThroughOptions<I>>;
/**
* Processed menu item used internally.
*/
interface ContextMenuProcessedItem {
/**
* Menu item instance.
*/
item: MenuItem;
/**
* Index of the item in its parent.
*/
index: number;
/**
* Nesting level of the item.
*/
level: number;
/**
* Unique key of the item.
*/
key: string;
/**
* Parent processed item.
*/
parent: ContextMenuProcessedItem | Record<string, never>;
/**
* Parent key.
*/
parentKey: string;
/**
* Child processed items.
*/
items?: ContextMenuProcessedItem[];
}
/**
* Custom item template context.
* @group Interface
*/
interface ContextMenuItemTemplateContext {
/**
* Menu item instance.
*/
$implicit: MenuItem;
}
/**
* Custom submenu icon template context.
* @group Interface
*/
interface ContextMenuSubmenuIconTemplateContext {
/**
* Style class of the submenu icon.
*/
class: string;
}
/**
* Defines valid templates in ContextMenu.
* @group Templates
*/
interface ContextMenuTemplates {
/**
* Custom item template.
* @param {Object} context - item context.
*/
item(context: ContextMenuItemTemplateContext): TemplateRef<ContextMenuItemTemplateContext>;
/**
* Custom submenu icon template.
* @param {Object} context - icon context.
*/
submenuicon(context: ContextMenuSubmenuIconTemplateContext): TemplateRef<ContextMenuSubmenuIconTemplateContext>;
}
export type { ContextMenuItemTemplateContext, ContextMenuPassThrough, ContextMenuPassThroughOptions, ContextMenuProcessedItem, ContextMenuSubmenuIconTemplateContext, ContextMenuTemplates };