import { BooleanInput } from '@angular/cdk/coercion'; import * as i0 from '@angular/core'; import { OnDestroy, ChangeDetectorRef, Type, Provider, TemplateRef, ViewContainerRef, ElementRef, OnInit, AfterContentInit, QueryList, EventEmitter, InjectionToken } from '@angular/core'; import { MapEmit } from '@k5cjs/selection-model'; import { Subject, Observable } from 'rxjs'; import * as i18 from '@angular/cdk/overlay'; import { CdkOverlayOrigin, OverlayConfig, ConnectedPosition, Overlay } from '@angular/cdk/overlay'; import { ConfigurableFocusTrapFactory } from '@angular/cdk/a11y'; import { ControlValueAccessor } from '@angular/forms'; import { KcControl, KcControlType } from '@k5cjs/control'; import * as i17 from '@angular/common'; type Options = KcOption[] | KcOption[][] | KcGroup; type Value = KcOptionValue | KcOptionGroupValue; declare const getSelectedOptions: (options: Options, value: Value | undefined) => [K | V, KcOption][] | undefined; type OptionsValue = KcOptionGroupValue | KcOptionValue; declare function getValues(values: KcOptionSelection): OptionsValue | undefined; declare const isOptionChunks: (option: KcOption[] | KcOption[][] | KcGroup) => option is KcOption[][]; declare class MapEmitSelect extends MapEmit { constructor(multiple: T, initiallyValues?: T extends false ? [K, V] : [K, V][]); get test(): T extends false ? V | null : V[]; private _isMapEmitSelect; private _isUnion; } declare class KcOptionComponent implements OnDestroy { protected _selection: MapEmitSelect, K | V, boolean>; protected _cdr: ChangeDetectorRef; option: KcOption; protected _destroy: Subject; constructor(_selection: MapEmitSelect, K | V, boolean>, _cdr: ChangeDetectorRef); ngOnDestroy(): void; get selected(): boolean; click(): void; toggle(): void; select(): void; deselect(): void; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵcmp: i0.ɵɵComponentDeclaration, "kc-option", never, { "option": { "alias": "option"; "required": false; }; }, {}, never, never, false, never>; } declare function provideKcOption>(type: Type): Provider; declare function filterNestedOptions(options: KcOption[], search: string): KcOption[]; declare function filterNestedOptions(options: KcOption[][], search: string): KcOption[][]; declare function filterNestedOptions(options: KcGroup, search: string): KcGroup; /** * options type for input options */ interface KcOption { value: V; key?: K; label?: L; compareFn?: (selectedOption: V | KcOptionGroupValue, currentOption: V) => boolean; } type KcGroup = { [K: string]: KcGroup | OptionGroup; }; interface OptionGroup { value: KcOption[] | KcOption[][]; label?: string; } /** * options type for output options */ type KcOptionValue = V | V[]; type KcOptionGroupValue = { [K: string]: KcOptionValue | KcOptionGroupValue; }; /** * options for internal structure */ type KcOptionSelection = MapEmitSelect | KcOptionSelection, string | V | K, boolean>; interface KcSelect { allSelected: boolean; allSelectedChanged: Observable; multiple: boolean; focused: boolean; click: (event: MouseEvent) => void; open: (event?: MouseEvent) => void; close: (event?: MouseEvent) => void; submit: () => void; selectAll: () => void; deselectAll: () => void; toggle: () => void; clear: () => void; get value(): KcOptionValue | KcOptionGroupValue; } declare class KcClearDirective { private _kcSelect; constructor(_kcSelect: KcSelect); onClick(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class KcCloseDirective { private _kcSelect; kcClose: boolean; constructor(_kcSelect: KcSelect); onClick(event: MouseEvent): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; static ngAcceptInputType_kcClose: any; } declare class KcDeselectAllDirective { private _kcSelect; constructor(_kcSelect: KcSelect); click(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } type Context$2 = { $implicit: KcGroup; }; declare class KcGroupDirective { private _template; private _viewContainer; private _cdr; private _embeddedViewRef; constructor(_template: TemplateRef>, _viewContainer: ViewContainerRef, _cdr: ChangeDetectorRef); static ngTemplateContextGuard(_dir: KcGroupDirective, _ctx: Context$2): _ctx is Context$2; render(options: KcGroup): void; clear(): void; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵdir: i0.ɵɵDirectiveDeclaration, "[kcGroup]", never, {}, {}, never, never, false, never>; } type Context$1 = { $implicit: KcOption; }; declare class KcOptionDirective { template: TemplateRef>; type: KcOption; constructor(template: TemplateRef>); static ngTemplateContextGuard(_dir: KcOptionDirective, _ctx: Context$1): _ctx is Context$1; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵdir: i0.ɵɵDirectiveDeclaration, "[kcOption]", never, { "type": { "alias": "kcOptionType"; "required": false; }; }, {}, never, never, false, never>; } type Context = { $implicit: KcOption[]; }; declare class KcOptionsDirective { private _template; private _viewContainer; private _cdr; type: KcOption; private _embeddedViewRef; constructor(_template: TemplateRef>, _viewContainer: ViewContainerRef, _cdr: ChangeDetectorRef); static ngTemplateContextGuard(_dir: KcOptionsDirective, _ctx: Context): _ctx is Context; render(options: KcOption[]): void; clear(): void; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵdir: i0.ɵɵDirectiveDeclaration, "[kcOptions]", never, { "type": { "alias": "kcOptionsType"; "required": false; }; }, {}, never, never, false, never>; } declare class KcOriginDirective extends CdkOverlayOrigin { elementRef: ElementRef; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class KcSelectAllDirective { private _kcSelect; constructor(_kcSelect: KcSelect); click(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class KcSubmitDirective { private _kcSelect; constructor(_kcSelect: KcSelect); click(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class KcToggleDirective { private _kcSelect; constructor(_kcSelect: KcSelect); click(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class KcValueDirective { template: TemplateRef; private _cdr; constructor(template: TemplateRef, _cdr: ChangeDetectorRef); render(viewContainer: ViewContainerRef): void; clear(viewContainer: ViewContainerRef): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class KcGroupComponent implements OnInit, AfterContentInit, OnDestroy { private _selection; private _select; get options(): KcGroup; set options(options: KcGroup); private _options; key: string; get multiple(): boolean; set multiple(value: BooleanInput); private _multiple; groups: QueryList>; option: QueryList>; selection: MapEmitSelect | KcOptionSelection, string | K | V, boolean>; private _destroy; constructor(_selection: MapEmitSelect, string, boolean>, _select: KcSelect); get value(): KcOptionValue | KcOptionGroupValue; ngAfterContentInit(): void; ngOnInit(): void; ngOnDestroy(): void; private _initSelection; private _render; private _getSelection; private _getOption; private _getGroup; private _getOptionGroup; private _getOptions; private _isOptionGroup; private _isOptionGroupValue; private _isOptionChunks; static ɵfac: i0.ɵɵFactoryDeclaration, [{ skipSelf: true; }, { skipSelf: true; }]>; static ɵcmp: i0.ɵɵComponentDeclaration, "kc-group", never, { "options": { "alias": "options"; "required": false; }; "key": { "alias": "key"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; }, {}, ["groups", "option"], ["*", "[footer]"], false, never>; } declare class KcOptionsComponent { get options(): KcOption[]; set options(options: KcOption[]); private _options; /** * { static: true } needs to be set when you want to access the ViewChild in ngOnInit. */ optionTemplate: KcOptionDirective; protected _outlet: ViewContainerRef; protected _render(): void; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵcmp: i0.ɵɵComponentDeclaration, "kc-options", never, { "options": { "alias": "options"; "required": false; }; }, {}, ["optionTemplate"], ["*", "[footer]"], false, never>; } declare class KcValueComponent { private _selection; value: Observable; constructor(_selection: MapEmitSelect, string, T>); get preventClose(): boolean; removeTag(event: Event): void; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵcmp: i0.ɵɵComponentDeclaration, "kc-value", never, {}, {}, never, ["*", "*"], false, never>; } declare class KcSelectComponent extends KcControl | KcOptionGroupValue> implements OnInit, AfterContentInit, ControlValueAccessor, KcSelect, KcControlType | KcOptionGroupValue> { private _overlay; private _viewContainerRef; private _cdr; private _trap; get options(): Observable[] | KcOption[][] | KcGroup>; set options(options: Observable[] | KcOption[][] | KcGroup> | KcOption[] | KcOption[][] | KcGroup); private _options; private _optionsCache; /** * allow user to open selection in modal */ get multiple(): boolean; set multiple(value: boolean | string); private _multiple; /** * allow user to open selection in modal */ get dialog(): boolean; set dialog(value: boolean | string); private _dialog; /** * allow user to change origin from where selection will be opened */ origin: KcOriginDirective | undefined; cdkOverlayConfig: OverlayConfig; positions: ConnectedPosition[]; closed: EventEmitter | KcOptionGroupValue>; submitted: EventEmitter | KcOptionGroupValue>; private _valueRef; templateRef: TemplateRef; optionComponents: QueryList>; private _valueDirective?; private _groupDirectives; private _optionsDirectives; set value(val: KcOptionValue | KcOptionGroupValue); get value(): KcOptionValue | KcOptionGroupValue; private _value; /** * selectionOpened variable is for check if the overlay or dialog is open */ selectionOpened: boolean; selection: KcOptionSelection; allSelected: boolean; allSelectedChanged: Observable; private _allSelectedChanged; private _dialogOverlayRef; private _tabIndex; private _subscriptionOptions?; private _subscriptionChanges?; constructor(_overlay: Overlay, _viewContainerRef: ViewContainerRef, _cdr: ChangeDetectorRef, _trap: ConfigurableFocusTrapFactory, tabIndex: string); ngOnInit(): void; ngAfterContentInit(): void; writeValue(obj: KcOptionValue | KcOptionGroupValue): void; /** * allow element to be focusable */ get tabindex(): number; protected _keydown(event: KeyboardEvent): void; /** * open selection when user click on element */ click(): void; /** * focus on element when user press tab to focus on element * and don't open selection, to open selection user need to press space */ _focus(): void; /** * close selection when user press tab to blur on element */ _blur(): void; open(): void; close(): void; submit(): void; keydown(event: KeyboardEvent): void; selectAll(): void; deselectAll(): void; toggle(): void; clear(): void; private _removeOptionsSubscription; private _initSelectionModel; private _updateSelectionModel; private _getOptions; /** * check selected options */ private get _getSelectedOptions(); private _createObservableOptions; private _openOverlay; private _getPositionStrategy; private _closeOverlay; /** Invoked when an option is clicked. */ private _onSelect; static ɵfac: i0.ɵɵFactoryDeclaration, [null, null, null, null, { attribute: "tabindex"; }]>; static ɵcmp: i0.ɵɵComponentDeclaration, "kc-select", ["kcSelect"], { "options": { "alias": "options"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "dialog": { "alias": "dialog"; "required": false; }; "origin": { "alias": "origin"; "required": false; }; "cdkOverlayConfig": { "alias": "cdkOverlayConfig"; "required": false; }; "positions": { "alias": "positions"; "required": false; }; }, { "closed": "closed"; "submitted": "submitted"; }, ["_valueDirective", "optionComponents", "_groupDirectives", "_optionsDirectives"], ["*"], false, never>; } declare class KcSelectModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } declare const KC_SELECT: InjectionToken>; declare const KC_SELECTION: InjectionToken>; declare const KC_VALUE: InjectionToken; export { KC_SELECT, KC_SELECTION, KC_VALUE, KcClearDirective, KcCloseDirective, KcDeselectAllDirective, KcGroupComponent, KcGroupDirective, KcOptionComponent, KcOptionDirective, KcOptionsComponent, KcOptionsDirective, KcOriginDirective, KcSelectAllDirective, KcSelectComponent, KcSelectModule, KcSubmitDirective, KcToggleDirective, KcValueComponent, KcValueDirective, MapEmitSelect, filterNestedOptions, getSelectedOptions, getValues, isOptionChunks, provideKcOption }; export type { KcGroup, KcOption, KcOptionGroupValue, KcOptionSelection, KcOptionValue, KcSelect, OptionGroup };