import '@sebgroup/green-core/components/icon/icons/triangle-exclamation.js'; import { ChangeDetectorRef, EventEmitter, OnChanges, OnDestroy, SimpleChanges, TemplateRef } from '@angular/core'; import { NgControl } from '@angular/forms'; import { TranslocoScope } from '@jsverse/transloco'; import { NggvBaseControlValueAccessorComponent } from '@sebgroup/green-angular/src/v-angular/base-control-value-accessor'; import { DropdownUtils, Option, OptionBase, OptionGroup } from '@sebgroup/green-angular/src/v-angular/core'; import * as i0 from "@angular/core"; /** * A dropdown allows the user to select an option from a list. * Dropdowns enables users to make a quick selection of the available options for a specific entry. * https://designlibrary.sebgroup.com/components/component-dropdown */ export declare class NggvDropdownComponent = Option> extends NggvBaseControlValueAccessorComponent implements OnDestroy, OnChanges { ngControl: NgControl; protected translocoScope: TranslocoScope; protected cdr: ChangeDetectorRef; protected dropdownUtils: DropdownUtils; /** Custom template for displaying options and groups. */ selectedContentTpl: TemplateRef> | undefined; optionContentTpl: TemplateRef> | undefined; groupLabelTpl: TemplateRef> | undefined; /** * Special property used for selecting DOM elements during automated UI testing. */ thook: string | null | undefined; get isSmall(): boolean; get isLarge(): boolean; /** * Sets the displayed size of the dropdown. */ size: 'small' | 'large'; /** Text shown before an option is selected. */ placeholder?: string; /** Specific value for aria-label. If not provided, label/labelTpl will be used. */ ariaLabel?: string; /** If the dropdown should close when scrolling the viewport. Default: false */ closeOnScroll: boolean; /** List of {@link Option} and {@link OptionGroup} listed when dropdown is expanded. */ set options(value: OptionBase[]); get options(): OptionBase[]; /** The additional amount to show when option is scrolled into view. */ scrollOffset: number; /** * Allow this component to add/ remove nullish options based on wether the control is required or not * Defaults to true. */ allowControlNullishOption: boolean; /** Text to highlight in option */ textToHighlight?: string; /** * If only one option exists in options[], default is to select it. * This input can be used to alter that behaviour so it doesn't automatically * select a value if it's the only one. * Defaults to true. */ selectOnSingleOption: boolean; /** * Used to control if the dropdown list should select the current active element, when Space is pressed on the keyboard. * Primary usage is for typeahead, where the should be able to write a filter query containing spaces, * but not select the current active element with Space. */ selectWithSpace: boolean; /** * Used to determine which changes should be handled by the dropdown. * If set to false, all changes will be handled by the dropdown. * If set to true, only changes that are distinct from the current value will be handled. * Defaults to true. */ onlyHandleDistinctChanges: boolean; /** * Emits changes of the expanded state of the dropdown */ expandedChange: EventEmitter; /** @internal nullish option. */ get defaultNullishOption(): OptionBase; /** The current expanded state of the dropdown options. */ expanded: boolean; /** The current option selected based on numeric index. */ activeIndex: number; /** Subscribe if dropdown expanded to listen to click outside to close dropdown. */ private onClickSubscription; /** Subscribe if dropdown expanded to listen to scroll outside to close dropdown. */ private onScrollSubscription; keyEvent: KeyboardEvent; private _options; constructor(ngControl: NgControl, translocoScope: TranslocoScope, cdr: ChangeDetectorRef, dropdownUtils: DropdownUtils); ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; /** @internal override to correctly set state from form value */ writeValue(value: any): void; /** @internal */ onSelectChange(option: T): void; onKeyUp(event: KeyboardEvent): void; /** * Closes the dropdown on click outside. */ subscribeToOutsideClickEvent(): void; subscribeToOutsideScrollEvent(): void; /** * Set the dropdown value to given option. * @param value the dropdown option to select. */ private updateModel; /** Toggle the expanded state of the dropdown options. */ toggleDropdown(): void; /** * Set the expanded state of the dropdown options. If true the options are shown below the field. * Activate on click event to be able to close dropdown on click outside. * @param state the expanded state which to set. */ setExpanded(state?: boolean): void; /** * Typecast anything to an {@link Option}. * @param option the object to typecast. */ castOption(option: any): T; /** * Typecast anything to an {@link OptionGroup}. * @param group the object to typecast. */ castGroup(group: any): OptionGroup; /** * Returns true if argument is an {@link Option}. * @param option the object to check. */ isOption(option: OptionBase): option is OptionGroup; static ɵfac: i0.ɵɵFactoryDeclaration, [{ optional: true; self: true; }, { optional: true; }, null, null]>; static ɵcmp: i0.ɵɵComponentDeclaration, "nggv-dropdown", never, { "thook": { "alias": "thook"; "required": false; }; "size": { "alias": "size"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "closeOnScroll": { "alias": "closeOnScroll"; "required": false; }; "options": { "alias": "options"; "required": false; }; "scrollOffset": { "alias": "scrollOffset"; "required": false; }; "allowControlNullishOption": { "alias": "allowControlNullishOption"; "required": false; }; "textToHighlight": { "alias": "textToHighlight"; "required": false; }; "selectOnSingleOption": { "alias": "selectOnSingleOption"; "required": false; }; "selectWithSpace": { "alias": "selectWithSpace"; "required": false; }; "onlyHandleDistinctChanges": { "alias": "onlyHandleDistinctChanges"; "required": false; }; }, { "expandedChange": "expandedChange"; }, ["selectedContentTpl", "optionContentTpl", "groupLabelTpl"], ["*"], false, never>; }