UNPKG

@funidata/ngx-fudis

Version:

Funidata Design System.

79 lines (78 loc) 3.17 kB
import { ElementRef } from '@angular/core'; import { DropdownItemBaseDirective } from '../../../../../directives/form/dropdown-item-base/dropdown-item-base.directive'; import { SelectComponent } from '../../select/select.component'; import { SelectGroupComponent } from '../select-group/select-group.component'; import { FudisSelectOption } from '../../../../../types/forms'; import { MultiselectComponent } from '../../multiselect/multiselect.component'; import { FudisTranslationService } from '../../../../../services/translation/translation.service'; import { FudisIdService } from '../../../../../services/id/id.service'; import * as i0 from "@angular/core"; export declare class SelectOptionBaseDirective extends DropdownItemBaseDirective { protected _parentGroup: SelectGroupComponent; protected _translationService: FudisTranslationService; protected _idService: FudisIdService; constructor(_document: Document, _parentGroup: SelectGroupComponent, _translationService: FudisTranslationService, _idService: FudisIdService); /** * Reference of input or option element */ protected _optionInputRef: ElementRef<HTMLOptionElement | HTMLInputElement>; /** * Select option data */ data: FudisSelectOption<object>; /** * State of option visibility */ protected _optionVisible: boolean; /** * Focus state */ protected _focused: boolean; /** * Common parent and its properties for both Select and Multiselect */ protected _parent: SelectComponent | MultiselectComponent; /** * Get visibility status of this option */ get visible(): boolean; /** * User focus handler */ protected _focus(): void; /** * For autocompletes, compare if current filter text is contained in this option's label. If not, * hide the option from the dropdown list. * * @param filterText Autocomplete filter text from parent */ protected _isOptionVisible(filterText: string): void; /** * Update option visibility to parent component */ protected _updateVisibilityToParents(visible: boolean): void; /** * Handler for keydown keyboard events * * @param event Keyboard event */ protected _keyDown(event: KeyboardEvent): void; /** * Handler for blurring out from focused option * * @param event FocusEvent to emit */ protected _blur(event: FocusEvent): void; /** * Boilerplate function to be overriden by SelectOption's and MultiselectOption's own * implementations */ protected _checkVisibilityFromFilterText(filterText: string): void; /** * Boilerplate function to be overriden by SelectOption's and MultiselectOption's own * implementations */ protected _clickOption(event: Event): void; static ɵfac: i0.ɵɵFactoryDeclaration<SelectOptionBaseDirective, [null, { optional: true; host: true; }, null, null]>; static ɵdir: i0.ɵɵDirectiveDeclaration<SelectOptionBaseDirective, "[fudisSelectOptionBase]", never, { "data": { "alias": "data"; "required": true; }; }, {}, never, never, false, never>; }