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,
279 lines (276 loc) • 7.79 kB
TypeScript
import { ElementRef, TemplateRef } from '@angular/core';
import { PassThrough, PassThroughOption } from 'primeng/api';
/**
* Processed option structure used internally.
*/
interface CascadeSelectProcessedOption {
option: unknown;
index: number;
level: number;
key: string;
parent?: CascadeSelectProcessedOption | Record<string, unknown>;
parentKey: string;
children?: CascadeSelectProcessedOption[];
selected?: boolean;
}
/**
* Focused option info structure.
*/
interface CascadeSelectFocusedOptionInfo {
index: number;
level?: number;
parentKey: string;
}
/**
* Internal option change event (used by CascadeSelectSub).
*/
interface CascadeSelectSubChangeEvent {
originalEvent: Event;
processedOption: CascadeSelectProcessedOption;
isFocus?: boolean;
}
/**
* Internal focus change event (used by CascadeSelectSub).
*/
interface CascadeSelectSubFocusChangeEvent {
originalEvent: Event;
processedOption: CascadeSelectProcessedOption;
}
/**
* Internal option change event.
*/
interface CascadeSelectOptionChangeEvent {
originalEvent?: Event | null;
processedOption: CascadeSelectProcessedOption;
isHide?: boolean;
type?: 'hover';
}
/**
* Internal option click event.
*/
interface CascadeSelectOptionClickEvent {
originalEvent: Event;
processedOption: CascadeSelectProcessedOption;
isFocus?: boolean;
isHide?: boolean;
preventSelection?: boolean;
type?: 'hover';
}
/**
* Internal option mouse event.
*/
interface CascadeSelectOptionMouseEvent {
originalEvent: Event;
processedOption: CascadeSelectProcessedOption;
}
/**
* Custom pass-through(pt) options.
* @template I Type of instance.
*
* @see {@link CascadeSelect.pt}
* @group Interface
*/
interface CascadeSelectPassThroughOptions<I = unknown> {
/**
* Used to pass attributes to the root's DOM element.
*/
root?: PassThroughOption<HTMLDivElement, I>;
/**
* Used to pass attributes to the hidden input wrapper's DOM element.
*/
hiddenInputWrapper?: PassThroughOption<HTMLDivElement, I>;
/**
* Used to pass attributes to the hidden input's DOM element.
*/
hiddenInput?: PassThroughOption<HTMLInputElement, I>;
/**
* Used to pass attributes to the label's DOM element.
*/
label?: PassThroughOption<HTMLSpanElement, I>;
/**
* Used to pass attributes to the dropdown's DOM element.
*/
dropdown?: PassThroughOption<HTMLDivElement, I>;
/**
* Used to pass attributes to the loading icon's DOM element.
*/
loadingIcon?: PassThroughOption<HTMLSpanElement, I>;
/**
* Used to pass attributes to the dropdown icon's DOM element.
*/
dropdownIcon?: PassThroughOption<HTMLElement, I>;
/**
* Used to pass attributes to the clear icon's DOM element.
*/
clearIcon?: PassThroughOption<HTMLElement, I>;
/**
* Used to pass attributes to the overlay's DOM element.
*/
overlay?: PassThroughOption<HTMLDivElement, I>;
/**
* Used to pass attributes to the list container's DOM element.
*/
listContainer?: PassThroughOption<HTMLDivElement, I>;
/**
* Used to pass attributes to the list's DOM element.
*/
list?: PassThroughOption<HTMLUListElement, I>;
/**
* Used to pass attributes to the option list's DOM element.
*/
optionList?: PassThroughOption<HTMLUListElement, I>;
/**
* Used to pass attributes to the option's DOM element.
*/
option?: PassThroughOption<HTMLLIElement, I>;
/**
* Used to pass attributes to the option content's DOM element.
*/
optionContent?: PassThroughOption<HTMLDivElement, I>;
/**
* Used to pass attributes to the option text's DOM element.
*/
optionText?: PassThroughOption<HTMLSpanElement, I>;
/**
* Used to pass attributes to the group icon's DOM element.
*/
groupIcon?: PassThroughOption<HTMLElement, I>;
}
/**
* Defines valid pass-through options in CascadeSelect.
* @see {@link CascadeSelectPassThroughOptions}
*
* @template I Type of instance.
*/
type CascadeSelectPassThrough<I = unknown> = PassThrough<I, CascadeSelectPassThroughOptions<I>>;
/**
* Custom panel show event.
* @see {@link CascadeSelect.onShow}
* @group Events
*/
interface CascadeSelectShowEvent {
/**
* Overlay element.
*/
overlay?: ElementRef | TemplateRef<any> | HTMLElement | null | undefined;
/**
* Target element.
*/
target?: ElementRef | TemplateRef<any> | HTMLElement | null | undefined;
/**
* Overlay mode.
*/
overlayMode?: 'modal' | 'overlay' | string;
}
/**
* Custom panel hide event.
* @see {@link CascadeSelect.onHide}
* @extends {CascadeSelectShowEvent}
* @group Events
*/
interface CascadeSelectHideEvent extends CascadeSelectShowEvent {
}
/**
* Custom panel show event emits right before the panel is shown.
* @see {@link CascadeSelect.onBeforeShow}
* @extends {CascadeSelectShowEvent}
* @group Events
*/
interface CascadeSelectBeforeShowEvent extends CascadeSelectShowEvent {
}
/**
* Custom panel hide event emits right before the panel is hidden.
* @see {@link CascadeSelect.onBeforeHide}
* @extends {CascadeSelectShowEvent}
* @group Events
*/
interface CascadeSelectBeforeHideEvent extends CascadeSelectShowEvent {
}
/**
* Custom panel change event emits when selection changed.
* @see {@link CascadeSelect.onChange}
* @group Events
*/
interface CascadeSelectChangeEvent {
/**
* Browser event.
*/
originalEvent?: Event;
/**
* Selected value.
*/
value?: any;
/**
* Focus state.
*/
isFocus?: boolean;
}
/**
* Custom value template context.
* @group Interface
*/
interface CascadeSelectValueTemplateContext<T = any> {
/**
* Selected value.
*/
$implicit: T;
/**
* Placeholder text.
*/
placeholder: string;
}
/**
* Custom option template context.
* @group Interface
*/
interface CascadeSelectOptionTemplateContext<T = any> {
/**
* Option instance.
*/
$implicit: T;
/**
* Level of the option in the hierarchy.
*/
level: number;
}
/**
* Defines valid templates in CascadeSelect.
* @group Templates
*/
interface CascadeSelectTemplates<T = any> {
/**
* Custom value template.
* @param {Object} context - value data.
*/
value(context: CascadeSelectValueTemplateContext<T>): TemplateRef<CascadeSelectValueTemplateContext<T>>;
/**
* Custom option template.
* @param {Object} context - option data.
*/
option(context: CascadeSelectOptionTemplateContext<T>): TemplateRef<CascadeSelectOptionTemplateContext<T>>;
/**
* Custom header template.
*/
header(): TemplateRef<void>;
/**
* Custom footer template.
*/
footer(): TemplateRef<void>;
/**
* Custom dropdown trigger icon template.
*/
triggericon(): TemplateRef<void>;
/**
* Custom clear icon template.
*/
clearicon(): TemplateRef<void>;
/**
* Custom option group icon template.
*/
optiongroupicon(): TemplateRef<void>;
/**
* Custom loading icon template.
*/
loadingicon(): TemplateRef<void>;
}
export type { CascadeSelectBeforeHideEvent, CascadeSelectBeforeShowEvent, CascadeSelectChangeEvent, CascadeSelectFocusedOptionInfo, CascadeSelectHideEvent, CascadeSelectOptionChangeEvent, CascadeSelectOptionClickEvent, CascadeSelectOptionMouseEvent, CascadeSelectOptionTemplateContext, CascadeSelectPassThrough, CascadeSelectPassThroughOptions, CascadeSelectProcessedOption, CascadeSelectShowEvent, CascadeSelectSubChangeEvent, CascadeSelectSubFocusChangeEvent, CascadeSelectTemplates, CascadeSelectValueTemplateContext };