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,
181 lines (178 loc) • 4.86 kB
TypeScript
import { TemplateRef } from '@angular/core';
import { MotionOptions } from '@primeuix/motion';
import { MenuItem, PassThrough, PassThroughOption } from 'primeng/api';
/**
* Processed menu item used internally by PanelMenu.
*/
interface ProcessedMenuItem {
/**
* Unique key for the item.
*/
key: string;
/**
* Original menu item.
*/
item: MenuItem;
/**
* Child items.
*/
items?: ProcessedMenuItem[];
/**
* Whether the item is expanded.
*/
expanded?: boolean;
/**
* Whether this is a separator.
*/
separator?: boolean;
/**
* Nesting level.
*/
level: number;
/**
* Index within siblings.
*/
index: number;
/**
* Parent processed item.
*/
parent?: ProcessedMenuItem;
/**
* Parent item's key.
*/
parentKey: string;
/**
* Item icon.
*/
icon?: string;
/**
* Item badge.
*/
badge?: string;
}
/**
* Custom pass-through(pt) options.
* @template I Type of instance.
*
* @see {@link PanelMenu.pt}
* @group Interface
*/
interface PanelMenuPassThroughOptions<I = unknown> {
/**
* Used to pass attributes to the root's DOM element.
*/
root?: PassThroughOption<HTMLDivElement, I>;
/**
* Used to pass attributes to the panel's DOM element.
*/
panel?: PassThroughOption<HTMLDivElement, I>;
/**
* Used to pass attributes to the header's DOM element.
*/
header?: PassThroughOption<HTMLDivElement, I>;
/**
* Used to pass attributes to the header content's DOM element.
*/
headerContent?: PassThroughOption<HTMLDivElement, I>;
/**
* Used to pass attributes to the header link's DOM element.
*/
headerLink?: PassThroughOption<HTMLAnchorElement, I>;
/**
* Used to pass attributes to the submenu icon's DOM element.
*/
submenuIcon?: PassThroughOption<SVGElement, I>;
/**
* Used to pass attributes to the header icon's DOM element.
*/
headerIcon?: PassThroughOption<HTMLSpanElement, I>;
/**
* Used to pass attributes to the header label's DOM element.
*/
headerLabel?: PassThroughOption<HTMLSpanElement, I>;
/**
* Used to pass attributes to the toggleable content's DOM element.
*/
contentContainer?: PassThroughOption<HTMLDivElement, I>;
/**
* Used to pass attributes to the toggleable content's DOM element.
*/
contentWrapper?: PassThroughOption<HTMLDivElement, I>;
/**
* Used to pass attributes to the menu content's DOM element.
*/
content?: 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 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 separator's DOM element.
*/
separator?: PassThroughOption<HTMLLIElement, I>;
/**
* Used to pass options to the motion component/directive.
*/
motion?: MotionOptions;
}
/**
* Defines valid pass-through options in PanelMenu.
* @see {@link PanelMenuPassThroughOptions}
*
* @template I Type of instance.
*/
type PanelMenuPassThrough<I = unknown> = PassThrough<I, PanelMenuPassThroughOptions<I>>;
/**
* Custom item template context.
* @group Interface
*/
interface PanelMenuItemTemplateContext {
/**
* Item instance.
*/
$implicit: MenuItem;
}
/**
* Defines valid templates in PanelMenu.
* @group Templates
*/
interface PanelMenuTemplates {
/**
* Custom item template.
* @param {PanelMenuItemTemplateContext} context - item context.
*/
item(context: PanelMenuItemTemplateContext): TemplateRef<PanelMenuItemTemplateContext>;
/**
* Custom template of submenuicon.
*/
submenuicon(): TemplateRef<void>;
/**
* Custom template of headericon.
*/
headericon(): TemplateRef<void>;
}
export type { PanelMenuItemTemplateContext, PanelMenuPassThrough, PanelMenuPassThroughOptions, PanelMenuTemplates, ProcessedMenuItem };