import { TemplateRef } from '@angular/core'; import { PassThroughOption, PassThrough, ScrollerOptions } from 'primeng/api'; /** * Defines valid pass-through options in ListBox component. * @template I Type of instance. * * @see {@link Listbox.pt} * @group Interface */ interface ListBoxPassThroughOptions { /** * Used to pass attributes to the root's DOM element. */ root?: PassThroughOption; /** * Used to pass attributes to the header's DOM element. */ header?: PassThroughOption; /** * Used to pass attributes to the Checkbox component. */ pcCheckbox?: any; /** * Used to pass attributes to the IconField component. */ pcFilterContainer?: any; /** * Used to pass attributes to the filter input's DOM element. */ pcFilter?: any; /** * Used to pass attributes to the InputIcon component. */ pcFilterIconContainer?: any; /** * Used to pass attributes to the filter icon's DOM element. */ filterIcon?: PassThroughOption; /** * Used to pass attributes to the hidden filter result's DOM element. */ hiddenFilterResult?: PassThroughOption; /** * Used to pass attributes to the list container's DOM element. */ listContainer?: PassThroughOption; /** * Used to pass attributes to the VirtualScroller component. */ virtualScroller?: any; /** * Used to pass attributes to the list's DOM element. */ list?: PassThroughOption; /** * Used to pass attributes to the option group's DOM element. */ optionGroup?: PassThroughOption; /** * Used to pass attributes to the option's DOM element. */ option?: PassThroughOption; /** * Used to pass attributes to the option check icon's DOM element. */ optionCheckIcon?: PassThroughOption; /** * Used to pass attributes to the option blank icon's DOM element. */ optionBlankIcon?: PassThroughOption; /** * Used to pass attributes to the empty message's DOM element. */ emptyMessage?: PassThroughOption; /** * Used to pass attributes to the hidden empty message's DOM element. */ hiddenEmptyMessage?: PassThroughOption; /** * Used to pass attributes to the hidden selected message's DOM element. */ hiddenSelectedMessage?: PassThroughOption; /** * Used to pass attributes to the first hidden focusable element. */ hiddenFirstFocusableEl?: PassThroughOption; /** * Used to pass attributes to the last hidden focusable element. */ hiddenLastFocusableEl?: PassThroughOption; } /** * Defines valid pass-through options in ListBox component. * @see {@link ListBoxPassThroughOptions} * * @template I Type of instance. */ type ListBoxPassThrough = PassThrough>; /** * Filter options of listbox. * @group Interface */ interface ListboxFilterOptions { /** * Callback to filter options. * @param {any} value - Filter value. */ filter?: (value?: any) => void; /** * Callback to reset filter. */ reset?: () => void; } /** * Custom change event. * @group Events */ interface ListboxChangeEvent { /** * Original event */ originalEvent: Event; /** * Selected option value */ value: any; } /** * Custom change event. * @group Events */ interface ListboxSelectAllChangeEvent { /** * Browser event. */ originalEvent: Event; /** * Boolean value indicates whether all data is selected. */ checked: boolean; } /** * Custom filter event. * @group Events */ interface ListboxFilterEvent { /** * Browser event. */ originalEvent: Event; /** * Filter value. */ filter: any; } /** * Custom change event. * @group Events */ interface ListboxClickEvent { /** * Browser event. */ originalEvent: Event; /** * Value of the component. */ value: any; /** * Selected option */ option?: any; } /** * Custom change event. * @group Events */ interface ListboxDoubleClickEvent extends ListboxClickEvent { } /** * Custom item template context. * @group Interface */ interface ListboxItemTemplateContext { /** * Data of the option. */ $implicit: T; /** * Index of the option. */ index: number; /** * Whether the option is selected. */ selected: boolean; /** * Whether the option is disabled. */ disabled: boolean; } /** * Custom group template context. * @group Interface */ interface ListboxGroupTemplateContext { /** * Group option data. */ $implicit: T; } /** * Custom header template context. * @group Interface */ interface ListboxHeaderTemplateContext { /** * Current model value. */ $implicit: T; /** * Visible options. */ options: any[]; } /** * Custom filter template context. * @group Interface */ interface ListboxFilterTemplateContext { /** * Filter options. */ options: ListboxFilterOptions; } /** * Custom footer template context. * @group Interface */ interface ListboxFooterTemplateContext { /** * Current model value. */ $implicit: T; /** * Visible options. */ options: any[]; } /** * Custom check icon template context. * @group Interface */ interface ListboxCheckIconTemplateContext { /** * Whether the item is selected. */ $implicit: boolean; } /** * Custom checkmark template context. * Note: Uses 'implicit' property instead of '$implicit'. * @group Interface */ interface ListboxCheckmarkTemplateContext { /** * Whether the item is selected. */ implicit: boolean; } /** * Custom loader template context. * @group Interface */ interface ListboxLoaderTemplateContext { /** * Scroller options. */ options: ScrollerOptions; } /** * Defines valid templates in Listbox. * @group Templates */ interface ListboxTemplates { /** * Custom item template. * @param {Object} context - item data. */ item(context: ListboxItemTemplateContext): TemplateRef; /** * Custom group template. * @param {Object} context - group data. */ group(context: ListboxGroupTemplateContext): TemplateRef; /** * Custom header template. * @param {Object} context - header context. */ header(context: ListboxHeaderTemplateContext): TemplateRef; /** * Custom filter template. * @param {Object} context - filter options. */ filter(context: ListboxFilterTemplateContext): TemplateRef; /** * Custom footer template. * @param {Object} context - footer context. */ footer(context: ListboxFooterTemplateContext): TemplateRef; /** * Custom empty template. */ empty(): TemplateRef; /** * Custom empty filter template. */ emptyfilter(): TemplateRef; /** * Custom filter icon template. */ filtericon(): TemplateRef; /** * Custom check icon template. * @param {Object} context - check icon context. */ checkicon(context: ListboxCheckIconTemplateContext): TemplateRef; /** * Custom checkmark template. * @param {Object} context - checkmark context. */ checkmark(context: ListboxCheckmarkTemplateContext): TemplateRef; /** * Custom loader template for virtual scroll. * @param {Object} context - loader context. */ loader(context: ListboxLoaderTemplateContext): TemplateRef; } /** * Defines context options for ListBox passthrough. * @group Interface */ interface ListBoxContext { /** * Whether the option is selected. */ selected?: boolean; /** * Whether the option is focused. */ focused?: boolean; /** * Whether the option is disabled. */ disabled?: boolean; } export type { ListBoxContext, ListBoxPassThrough, ListBoxPassThroughOptions, ListboxChangeEvent, ListboxCheckIconTemplateContext, ListboxCheckmarkTemplateContext, ListboxClickEvent, ListboxDoubleClickEvent, ListboxFilterEvent, ListboxFilterOptions, ListboxFilterTemplateContext, ListboxFooterTemplateContext, ListboxGroupTemplateContext, ListboxHeaderTemplateContext, ListboxItemTemplateContext, ListboxLoaderTemplateContext, ListboxSelectAllChangeEvent, ListboxTemplates };