UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

161 lines (152 loc) 6.88 kB
import * as i0 from '@angular/core'; import { AfterViewInit, ElementRef, EventEmitter, ExistingProvider, OnInit, OnChanges, TemplateRef, QueryList, SimpleChanges } from '@angular/core'; import { Direction } from '@angular/cdk/bidi'; import { OnChangeType, OnTouchedType, NzSafeAny, NzStatus, NgClassInterface, NzValidateStatus } from 'ng-zorro-antd/core/types'; import { ControlValueAccessor } from '@angular/forms'; import { Observable } from 'rxjs'; /** * 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 */ /** * @deprecated Internally used, will be removed in v21, please do not use it. */ declare const NZ_MENTION_TRIGGER_ACCESSOR: ExistingProvider; declare class NzMentionTriggerDirective implements ControlValueAccessor, AfterViewInit { readonly elementRef: ElementRef<HTMLInputElement | HTMLTextAreaElement>; private readonly ngZone; private readonly cdr; private readonly destroyRef; private readonly nzMentionService; readonly onFocusin: EventEmitter<FocusEvent>; readonly onBlur: EventEmitter<FocusEvent>; readonly onInput: EventEmitter<KeyboardEvent>; readonly onKeydown: EventEmitter<KeyboardEvent>; readonly onClick: EventEmitter<MouseEvent>; value?: string; constructor(); completeEvents(): void; focus(caretPos?: number | null): void; insertMention(mention: Mention): void; writeValue(value: string): void; onChange: OnChangeType; onTouched: OnTouchedType; registerOnChange(fn: (value: string) => void): void; registerOnTouched(fn: () => void): void; ngAfterViewInit(): void; private setupEventListener; static ɵfac: i0.ɵɵFactoryDeclaration<NzMentionTriggerDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<NzMentionTriggerDirective, "input[nzMentionTrigger], textarea[nzMentionTrigger]", ["nzMentionTrigger"], {}, { "onFocusin": "onFocusin"; "onBlur": "onBlur"; "onInput": "onInput"; "onKeydown": "onKeydown"; "onClick": "onClick"; }, never, never, 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 */ interface MentionOnSearchTypes { value: string; prefix: string; } interface Mention { startPos: number; endPos: number; mention: string; } type MentionPlacement = 'top' | 'bottom'; declare class NzMentionComponent implements OnInit, AfterViewInit, OnChanges { private ngZone; private directionality; private cdr; private overlay; private viewContainerRef; private elementRef; private renderer; private nzMentionService; private destroyRef; nzValueWith: (value: NzSafeAny) => string; nzPrefix: string | string[]; nzLoading: boolean; nzNotFoundContent: string; nzPlacement: MentionPlacement; nzSuggestions: NzSafeAny[]; nzStatus: NzStatus; readonly nzOnSelect: EventEmitter<any>; readonly nzOnSearchChange: EventEmitter<MentionOnSearchTypes>; trigger: NzMentionTriggerDirective; suggestionsTemp?: TemplateRef<void>; items: QueryList<ElementRef>; set suggestionChild(value: TemplateRef<{ $implicit: NzSafeAny; }>); isOpen: boolean; filteredSuggestions: string[]; suggestionTemplate: TemplateRef<{ $implicit: NzSafeAny; }> | null; activeIndex: number; dir: Direction; prefixCls: string; statusCls: NgClassInterface; status: NzValidateStatus; hasFeedback: boolean; private previousValue; private cursorMention; private cursorMentionStart?; private cursorMentionEnd?; private overlayRef; private portal?; private positionStrategy; private overlayOutsideClickSubscription; private document; private get triggerNativeElement(); private get focusItemElement(); private nzFormStatusService; private nzFormNoStatusService; constructor(); ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; ngAfterViewInit(): void; closeDropdown(): void; openDropdown(): void; getMentions(): string[]; selectSuggestion(suggestion: string | {}): void; private handleInput; private handleKeydown; private handleClick; private bindTriggerEvents; private suggestionsFilter; private resetDropdown; private setNextItemActive; private setPreviousItemActive; private scrollToFocusItem; private canOpen; private resetCursorMention; private updatePositions; private subscribeOverlayOutsideClick; private attachOverlay; private getOverlayConfig; private getOverlayPosition; private setStatusStyles; static ɵfac: i0.ɵɵFactoryDeclaration<NzMentionComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NzMentionComponent, "nz-mention", ["nzMention"], { "nzValueWith": { "alias": "nzValueWith"; "required": false; }; "nzPrefix": { "alias": "nzPrefix"; "required": false; }; "nzLoading": { "alias": "nzLoading"; "required": false; }; "nzNotFoundContent": { "alias": "nzNotFoundContent"; "required": false; }; "nzPlacement": { "alias": "nzPlacement"; "required": false; }; "nzSuggestions": { "alias": "nzSuggestions"; "required": false; }; "nzStatus": { "alias": "nzStatus"; "required": false; }; }, { "nzOnSelect": "nzOnSelect"; "nzOnSearchChange": "nzOnSearchChange"; }, ["suggestionChild"], ["*"], true, never>; static ngAcceptInputType_nzLoading: unknown; } declare class NzMentionSuggestionDirective { static ɵfac: i0.ɵɵFactoryDeclaration<NzMentionSuggestionDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<NzMentionSuggestionDirective, "[nzMentionSuggestion]", ["nzMentionSuggestion"], {}, {}, never, never, true, never>; } declare class NzMentionModule { static ɵfac: i0.ɵɵFactoryDeclaration<NzMentionModule, never>; static ɵmod: i0.ɵɵNgModuleDeclaration<NzMentionModule, never, [typeof NzMentionComponent, typeof NzMentionTriggerDirective, typeof NzMentionSuggestionDirective], [typeof NzMentionComponent, typeof NzMentionTriggerDirective, typeof NzMentionSuggestionDirective]>; static ɵinj: i0.ɵɵInjectorDeclaration<NzMentionModule>; } declare class NzMentionService { private trigger?; private triggerChange$; constructor(); triggerChanged(): Observable<NzMentionTriggerDirective>; registerTrigger(trigger: NzMentionTriggerDirective): void; static ɵfac: i0.ɵɵFactoryDeclaration<NzMentionService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<NzMentionService>; } export { NZ_MENTION_TRIGGER_ACCESSOR, NzMentionComponent, NzMentionModule, NzMentionService, NzMentionSuggestionDirective, NzMentionTriggerDirective }; export type { Mention, MentionOnSearchTypes, MentionPlacement };