UNPKG

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,

155 lines (152 loc) 4.03 kB
import { TemplateRef } from '@angular/core'; import { PassThrough, PassThroughOption } from 'primeng/api'; import { MenuPassThrough } from 'primeng/types/menu'; /** * Defines valid pass-through options in CommandMenu component. * @template I Type of instance. * * @see {@link CommandMenu.pt} * @group Interface */ interface CommandMenuPassThroughOptions<I = unknown> { /** * Used to pass attributes to the root's DOM element. */ root?: PassThroughOption<HTMLDivElement, I>; /** * Used to pass attributes to the header's DOM element. */ header?: PassThroughOption<HTMLDivElement, I>; /** * Used to pass attributes to the input's DOM element. */ input?: PassThroughOption<HTMLInputElement, I>; /** * Used to pass attributes to the Menu component. */ pcMenu?: MenuPassThrough; /** * Used to pass attributes to the empty message's DOM element. */ emptyMessage?: PassThroughOption<HTMLDivElement, I>; /** * Used to pass attributes to the footer's DOM element. */ footer?: PassThroughOption<HTMLDivElement, I>; } /** * Defines valid pass-through options in CommandMenu component. * @see {@link CommandMenuPassThroughOptions} * * @template I Type of instance. */ type CommandMenuPassThrough<I = unknown> = PassThrough<I, CommandMenuPassThroughOptions<I>>; /** * Custom item select event. * @group Events */ interface CommandMenuItemSelectEvent { /** * Browser event. */ originalEvent: Event; /** * Selected menu item. */ item: any; } /** * Custom search change event. * @group Events */ interface CommandMenuSearchChangeEvent { /** * Browser event. */ originalEvent: Event; /** * Search query value. */ query: string; } /** * Custom item template context. * @group Interface */ interface CommandMenuItemTemplateContext<T = any> { /** * Data of the option. */ $implicit: T; } /** * Custom header template context. * @group Interface */ interface CommandMenuHeaderTemplateContext { /** * Current search value. */ $implicit: string; } /** * Custom footer template context. * @group Interface */ interface CommandMenuFooterTemplateContext { /** * Current search value. */ $implicit: string; } /** * Custom empty template context. * @group Interface */ interface CommandMenuEmptyMessageTemplateContext { /** * Current search value. */ $implicit: string; } /** * Defines valid templates in CommandMenu. * @group Templates */ interface CommandMenuTemplates { /** * Custom item template. * @param {Object} context - item data. */ item(context: CommandMenuItemTemplateContext): TemplateRef<CommandMenuItemTemplateContext>; /** * Custom header template. * @param {Object} context - header context. */ header(context: CommandMenuHeaderTemplateContext): TemplateRef<CommandMenuHeaderTemplateContext>; /** * Custom footer template. * @param {Object} context - footer context. */ footer(context: CommandMenuFooterTemplateContext): TemplateRef<CommandMenuFooterTemplateContext>; /** * Custom empty message template. * @param {Object} context - empty message context. */ emptyMessage(context: CommandMenuEmptyMessageTemplateContext): TemplateRef<CommandMenuEmptyMessageTemplateContext>; } /** * Defines context options for CommandMenu passthrough. * @group Interface */ interface CommandMenuContext { /** * Whether the option is focused. */ focused?: boolean; /** * Whether the option is disabled. */ disabled?: boolean; } export type { CommandMenuContext, CommandMenuEmptyMessageTemplateContext, CommandMenuFooterTemplateContext, CommandMenuHeaderTemplateContext, CommandMenuItemSelectEvent, CommandMenuItemTemplateContext, CommandMenuPassThrough, CommandMenuPassThroughOptions, CommandMenuSearchChangeEvent, CommandMenuTemplates };