ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
210 lines (200 loc) • 9.66 kB
TypeScript
import * as i0 from '@angular/core';
import { TemplateRef, OnInit, EventEmitter, AfterContentInit, AfterViewInit, OnChanges, QueryList, ElementRef, SimpleChanges, ExistingProvider } from '@angular/core';
import { AnimationEvent } from '@angular/animations';
import { Direction } from '@angular/cdk/bidi';
import { NzNoAnimationDirective } from 'ng-zorro-antd/core/no-animation';
import { NzSafeAny, CompareWith, OnChangeType, OnTouchedType } from 'ng-zorro-antd/core/types';
import { ControlValueAccessor } from '@angular/forms';
/**
* 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
*/
declare class NzAutocompleteOptgroupComponent {
nzLabel?: string | TemplateRef<void>;
static ɵfac: i0.ɵɵFactoryDeclaration<NzAutocompleteOptgroupComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<NzAutocompleteOptgroupComponent, "nz-auto-optgroup", ["nzAutoOptgroup"], { "nzLabel": { "alias": "nzLabel"; "required": false; }; }, {}, never, ["nz-auto-option"], true, never>;
}
/**
* 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
*/
declare class NzOptionSelectionChange {
source: NzAutocompleteOptionComponent;
isUserInput: boolean;
constructor(source: NzAutocompleteOptionComponent, isUserInput?: boolean);
}
declare class NzAutocompleteOptionComponent implements OnInit {
private ngZone;
private changeDetectorRef;
private element;
private destroyRef;
nzValue: NzSafeAny;
nzLabel?: string;
nzDisabled: boolean;
readonly selectionChange: EventEmitter<NzOptionSelectionChange>;
readonly mouseEntered: EventEmitter<NzAutocompleteOptionComponent>;
active: boolean;
selected: boolean;
nzAutocompleteOptgroupComponent: NzAutocompleteOptgroupComponent | null;
ngOnInit(): void;
select(emit?: boolean): void;
deselect(): void;
/** Git display label */
getLabel(): string;
/** Set active (only styles) */
setActiveStyles(): void;
/** Unset active (only styles) */
setInactiveStyles(): void;
scrollIntoViewIfNeeded(): void;
selectViaInteraction(): void;
private emitSelectionChangeEvent;
static ɵfac: i0.ɵɵFactoryDeclaration<NzAutocompleteOptionComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<NzAutocompleteOptionComponent, "nz-auto-option", ["nzAutoOption"], { "nzValue": { "alias": "nzValue"; "required": false; }; "nzLabel": { "alias": "nzLabel"; "required": false; }; "nzDisabled": { "alias": "nzDisabled"; "required": false; }; }, { "selectionChange": "selectionChange"; "mouseEntered": "mouseEntered"; }, never, ["*"], true, never>;
static ngAcceptInputType_nzDisabled: unknown;
}
/**
* 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
*/
interface AutocompleteDataSourceItem {
value: string;
label: string;
}
type AutocompleteDataSource = Array<AutocompleteDataSourceItem | string | number>;
declare class NzAutocompleteComponent implements AfterContentInit, AfterViewInit, OnInit, OnChanges {
private changeDetectorRef;
private directionality;
private destroyRef;
nzWidth?: number;
nzOverlayClassName: string;
nzOverlayStyle: Record<string, string>;
nzDefaultActiveFirstOption: boolean;
nzBackfill: boolean;
compareWith: CompareWith;
nzDataSource?: AutocompleteDataSource;
readonly selectionChange: EventEmitter<NzAutocompleteOptionComponent>;
showPanel: boolean;
isOpen: boolean;
activeItem: NzAutocompleteOptionComponent | null;
dir: Direction;
normalizedDataSource: AutocompleteDataSourceItem[];
animationStateChange: EventEmitter<AnimationEvent>;
/**
* Options accessor, its source may be content or dataSource
*/
get options(): QueryList<NzAutocompleteOptionComponent>;
/** Provided by content */
fromContentOptions: QueryList<NzAutocompleteOptionComponent>;
/** Provided by dataSource */
fromDataSourceOptions: QueryList<NzAutocompleteOptionComponent>;
/** cdk-overlay */
template?: TemplateRef<{}>;
panel?: ElementRef;
content?: ElementRef;
private activeItemIndex;
private selectionChangeSubscription;
private optionMouseEnterSubscription;
private dataSourceChangeSubscription;
/** Options changes listener */
private readonly optionSelectionChanges;
private readonly optionMouseEnter;
private afterNextRender$;
noAnimation: NzNoAnimationDirective | null;
constructor();
ngOnInit(): void;
ngOnChanges(changes: SimpleChanges): void;
onAnimationEvent(event: AnimationEvent): void;
ngAfterContentInit(): void;
ngAfterViewInit(): void;
setVisibility(): void;
setActiveItem(index: number): void;
setNextItemActive(): void;
setPreviousItemActive(): void;
getOptionIndex(value: NzSafeAny): number;
getOption(value: NzSafeAny): NzAutocompleteOptionComponent | null;
private optionsInit;
/**
* Clear the status of options
*/
clearSelectedOptions(skip?: NzAutocompleteOptionComponent | null, deselect?: boolean): void;
private subscribeOptionChanges;
static ɵfac: i0.ɵɵFactoryDeclaration<NzAutocompleteComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<NzAutocompleteComponent, "nz-autocomplete", ["nzAutocomplete"], { "nzWidth": { "alias": "nzWidth"; "required": false; }; "nzOverlayClassName": { "alias": "nzOverlayClassName"; "required": false; }; "nzOverlayStyle": { "alias": "nzOverlayStyle"; "required": false; }; "nzDefaultActiveFirstOption": { "alias": "nzDefaultActiveFirstOption"; "required": false; }; "nzBackfill": { "alias": "nzBackfill"; "required": false; }; "compareWith": { "alias": "compareWith"; "required": false; }; "nzDataSource": { "alias": "nzDataSource"; "required": false; }; }, { "selectionChange": "selectionChange"; }, ["fromContentOptions"], ["*"], true, never>;
static ngAcceptInputType_nzWidth: unknown;
static ngAcceptInputType_nzDefaultActiveFirstOption: unknown;
static ngAcceptInputType_nzBackfill: unknown;
}
/**
* @deprecated Internally used, will be removed in v21, please do not use it.
*/
declare const NZ_AUTOCOMPLETE_VALUE_ACCESSOR: ExistingProvider;
/**
* @deprecated Internally used, will not be exported in v21, please do not use it.
*/
declare function getNzAutocompleteMissingPanelError(): Error;
declare class NzAutocompleteTriggerDirective implements AfterViewInit, ControlValueAccessor {
private ngZone;
private elementRef;
private overlay;
private viewContainerRef;
private destroyRef;
/** Bind nzAutocomplete component */
nzAutocomplete: NzAutocompleteComponent;
onChange: OnChangeType;
onTouched: OnTouchedType;
panelOpen: boolean;
/** Current active option */
get activeOption(): NzAutocompleteOptionComponent | null;
private overlayRef;
private portal;
private positionStrategy;
private previousValue;
private selectionChangeSubscription;
private optionsChangeSubscription;
private overlayOutsideClickSubscription;
private document;
private nzInputGroupWhitSuffixOrPrefixDirective;
constructor();
ngAfterViewInit(): void;
writeValue(value: NzSafeAny): void;
registerOnChange(fn: (value: {}) => {}): void;
registerOnTouched(fn: () => {}): void;
setDisabledState(isDisabled: boolean): void;
openPanel(): void;
closePanel(): void;
handleKeydown(event: KeyboardEvent): void;
handleInput(event: KeyboardEvent): void;
handleFocus(): void;
handleClick(): void;
handleBlur(): void;
/**
* Subscription data source changes event
*/
private subscribeOptionsChange;
/**
* Subscription option changes event and set the value
*/
private subscribeSelectionChange;
private subscribeOverlayOutsideClick;
private attachOverlay;
private updateStatus;
private destroyPanel;
private getOverlayConfig;
private getConnectedElement;
private getHostWidth;
private getOverlayPosition;
private resetActiveItem;
private setValueAndClose;
private setTriggerValue;
private doBackfill;
private canOpen;
static ɵfac: i0.ɵɵFactoryDeclaration<NzAutocompleteTriggerDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<NzAutocompleteTriggerDirective, "input[nzAutocomplete], textarea[nzAutocomplete]", ["nzAutocompleteTrigger"], { "nzAutocomplete": { "alias": "nzAutocomplete"; "required": false; }; }, {}, never, never, true, never>;
}
declare class NzAutocompleteModule {
static ɵfac: i0.ɵɵFactoryDeclaration<NzAutocompleteModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<NzAutocompleteModule, never, [typeof NzAutocompleteComponent, typeof NzAutocompleteOptionComponent, typeof NzAutocompleteTriggerDirective, typeof NzAutocompleteOptgroupComponent], [typeof NzAutocompleteComponent, typeof NzAutocompleteOptionComponent, typeof NzAutocompleteTriggerDirective, typeof NzAutocompleteOptgroupComponent]>;
static ɵinj: i0.ɵɵInjectorDeclaration<NzAutocompleteModule>;
}
export { NZ_AUTOCOMPLETE_VALUE_ACCESSOR, NzAutocompleteComponent, NzAutocompleteModule, NzAutocompleteOptgroupComponent, NzAutocompleteOptionComponent, NzAutocompleteTriggerDirective, NzOptionSelectionChange, getNzAutocompleteMissingPanelError };
export type { AutocompleteDataSource, AutocompleteDataSourceItem };