/** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ import { OnDestroy } from '@angular/core'; import { VtsSafeAny } from '@ui-vts-kit/ng-vts/core/types'; import { BehaviorSubject, Subject } from 'rxjs'; import { VtsCascaderComponentAsSource, VtsCascaderOption, VtsCascaderSearchOption } from './typings'; import * as i0 from "@angular/core"; /** * All data is stored and parsed in VtsCascaderService. */ export declare class VtsCascaderService implements OnDestroy { /** Activated options in each column. */ activatedOptions: VtsCascaderOption[]; /** An array to store cascader items arranged in different layers. */ columns: VtsCascaderOption[][]; /** If user has entered searching mode. */ inSearchingMode: boolean; /** Selected options would be output to user. */ selectedOptions: VtsCascaderOption[]; values: VtsSafeAny[]; readonly $loading: BehaviorSubject; /** * Emit an event to notify cascader it needs to redraw because activated or * selected options are changed. */ readonly $redraw: Subject; /** * Emit an event when an option gets selected. * Emit true if a leaf options is selected. */ readonly $optionSelected: Subject<{ option: VtsCascaderOption; index: number; }>; /** * Emit an event to notify cascader it needs to quit searching mode. * Only emit when user do select a searching option. */ readonly $quitSearching: Subject; /** To hold columns before entering searching mode. */ private columnsSnapshot; /** To hold activated options before entering searching mode. */ private activatedOptionsSnapshot; private cascaderComponent; /** Return cascader options in the first layer. */ get vtsOptions(): VtsCascaderOption[]; ngOnDestroy(): void; /** * Make sure that value matches what is displayed in the dropdown. */ syncOptions(first?: boolean): void; /** * Bind cascader component so this service could use inputs. */ withComponent(cascaderComponent: VtsCascaderComponentAsSource): void; /** * Reset all options. Rebuild searching options if in searching mode. */ withOptions(options: VtsCascaderOption[] | null): void; /** * Try to set a option as activated. * @param option Cascader option * @param columnIndex Of which column this option is in * @param performSelect Select * @param loadingChildren Try to load children asynchronously. */ setOptionActivated(option: VtsCascaderOption, columnIndex: number, performSelect?: boolean, loadingChildren?: boolean): void; setOptionSelected(option: VtsCascaderOption, index: number): void; setOptionDeactivatedSinceColumn(column: number): void; /** * Set a searching option as selected, finishing up things. * @param option */ setSearchOptionSelected(option: VtsCascaderSearchOption): void; /** * Filter cascader options to reset `columns`. * @param searchValue The string user wants to search. */ prepareSearchOptions(searchValue: string): void; /** * Toggle searching mode by UI. It deals with things not directly related to UI. * @param toSearching If this cascader is entering searching mode */ toggleSearchingMode(toSearching: boolean): void; /** * Clear selected options. */ clear(): void; getOptionLabel(o: VtsCascaderOption): string; getOptionValue(o: VtsCascaderOption): VtsSafeAny; /** * Try to insert options into a column. * @param options Options to insert * @param columnIndex Position */ private setColumnData; /** * Set all ancestor options as activated. */ private trackAncestorActivatedOptions; private dropBehindActivatedOptions; private dropBehindColumns; /** * Load children of an option asynchronously. */ loadChildren(option: VtsCascaderOption | VtsSafeAny, columnIndex: number, success?: VoidFunction, failure?: VoidFunction): void; private isLoaded; /** * Find a option that has a given value in a given column. */ private findOptionWithValue; private prepareEmitValue; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; }