@funidata/ngx-fudis
Version:
Funidata Design System.
58 lines (57 loc) • 3.17 kB
TypeScript
import { EventEmitter, OnInit, WritableSignal } from '@angular/core';
import { FormControl } from '@angular/forms';
import { FudisTranslationService } from '../../../../services/translation/translation.service';
import { FudisFocusService } from '../../../../services/focus/focus.service';
import { FudisIdService } from '../../../../services/id/id.service';
import { SelectBaseDirective } from '../common/select-base/select-base.directive';
import { FudisSelectOption } from '../../../../types/forms';
import { MultiselectControlValueAccessorDirective } from '../common/select-control-value-accessor/select-control-value-accessor.directive';
import { BaseSelectableComponent } from '../common/interfaces/base-selectable.interface';
import * as i0 from "@angular/core";
export declare class MultiselectComponent extends SelectBaseDirective implements OnInit, BaseSelectableComponent {
protected _translationService: FudisTranslationService;
constructor(_document: Document, _translationService: FudisTranslationService, _idService: FudisIdService, _focusService: FudisFocusService);
_multiselectCVA: MultiselectControlValueAccessorDirective;
/**
* Array type control for selected FudisSelectOptions
*/
control: FormControl<FudisSelectOption<object>[] | null>;
/**
* Hide or show selection chips rendered below input
*/
showSelectionChips: boolean;
/**
* Value output event on selection change
*/
selectionUpdate: EventEmitter<FudisSelectOption<object>[] | null>;
/**
* When app language and option labels are changed, selected Multiselect Options push themselves
* here, which will be then used to update visible UI labels managed by MultiselectCVA
*/
selectedOptionsFromLangChange: FudisSelectOption<object>[];
/**
* When selecting / deselecting options, variable for storing them in the order of their id's
* (usually the DOM order)
*/
protected _sortedSelectedOptions: WritableSignal<FudisSelectOption<object>[] | null>;
/**
* Set component's id and subscribe to value changes for form control coming from application
*/
ngOnInit(): void;
/**
* Handler for adding / removing selections
*
* @param option FudisSelectOption to handle
* @param type Add or remove multiselect option
*/
handleMultiSelectionChange(option: FudisSelectOption<object>, type: 'add' | 'remove'): void;
protected _updateSortedSelectedOptions(newValue: FudisSelectOption<object>[] | null): void;
/**
* Handle chip remove. If there are no selections done, focus back to input on last item removal.
*
* @param option Removed option
*/
protected _handleRemoveChip(option: FudisSelectOption<object>): void;
static ɵfac: i0.ɵɵFactoryDeclaration<MultiselectComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<MultiselectComponent, "fudis-multiselect", never, { "control": { "alias": "control"; "required": true; }; "showSelectionChips": { "alias": "showSelectionChips"; "required": false; }; }, { "selectionUpdate": "selectionUpdate"; }, never, ["fudis-error-message"], false, never>;
}