import { FocusKeyManager } from '@angular/cdk/a11y'; import { AfterContentInit, ChangeDetectorRef, DoCheck, ElementRef, EventEmitter, OnDestroy, OnInit, QueryList } from '@angular/core'; import { ControlValueAccessor, FormGroupDirective, NgControl, NgForm } from '@angular/forms'; import { BooleanInput } from '@ngx-simple/core/coercion'; import { CanUpdateErrorState, CanUpdateErrorStateCtor, ErrorStateMatcher } from '@ngx-simple/core/common-behaviors'; import { OnChangeType, OnTouchedType } from '@ngx-simple/core/types'; import { SimFormFieldControl } from '@ngx-simple/simple-ui/form-field'; import { Observable } from 'rxjs'; import { SimChipTextControl } from './chip-text-control'; import { SimChipComponent, SimChipEvent, SimChipSelectionChange } from './chip.component'; /** @docs-private */ declare class SimChipListBase { _defaultErrorStateMatcher: ErrorStateMatcher; _parentForm: NgForm; _parentFormGroup: FormGroupDirective; /** @docs-private */ ngControl: NgControl; constructor(_defaultErrorStateMatcher: ErrorStateMatcher, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, /** @docs-private */ ngControl: NgControl); } declare const _SimChipListMixinBase: CanUpdateErrorStateCtor & typeof SimChipListBase; /** 当芯片列表值发生更改时发出的更改事件对象 */ export declare class SimChipListChange { /** Chip list that emitted the event. */ source: SimChipListComponent; /** Value of the chip list when the event was emitted. */ value: any; constructor( /** Chip list that emitted the event. */ source: SimChipListComponent, /** Value of the chip list when the event was emitted. */ value: any); } /** * 芯片列表组件 */ export declare class SimChipListComponent extends _SimChipListMixinBase implements SimFormFieldControl, ControlValueAccessor, AfterContentInit, DoCheck, OnInit, OnDestroy, CanUpdateErrorState { protected _elementRef: ElementRef; private _changeDetectorRef; /** @docs-private */ ngControl: NgControl; /** 兼容ivy编译 */ static ngAcceptInputType_multiple: BooleanInput; static ngAcceptInputType_required: BooleanInput; static ngAcceptInputType_disabled: BooleanInput; static ngAcceptInputType_selectable: BooleanInput; /** * 这个芯片列表是否可选择的。当芯片列表不可选时,芯片列表内所有芯片的选择状态总是被忽略。 */ get selectable(): boolean; set selectable(value: boolean); private _selectable; /** 用户是否应该被允许选择多个芯片 */ get multiple(): boolean; set multiple(value: boolean); private _multiple; /** * Implemented as part of SimFormFieldControl. * @docs-private */ get value(): T; set value(value: T); private _value; /** * Implemented as part of SimFormFieldControl. * @docs-private */ get required(): boolean; set required(value: boolean); protected _required: boolean; /** * Implemented as part of SimFormFieldControl. * @docs-private */ get placeholder(): string; set placeholder(value: string); protected _placeholder: string; /** * Implemented as part of SimFormFieldControl. * @docs-private */ get disabled(): boolean; set disabled(value: boolean); protected _disabled: boolean; /** * 将选项值与所选值进行比较的函数。 * - 第一个参数是选项的值 * - 第二个是选择的值 * - 返回一个布尔值 */ get compareWith(): (o1: any, o2: any) => boolean; set compareWith(fn: (o1: any, o2: any) => boolean); private _compareWith; set tabIndex(value: number); /** 当用户更改所选芯片列表的值时发出的事件 */ readonly change: EventEmitter>; /** * 每当芯片列表的原始值发生更改时发出。这里主要是为了方便`value`输入的双向绑定。 * @docs-private */ readonly valueChange: EventEmitter; /** 包含在此芯片列表中的芯片组件 */ chips: QueryList>; /** 芯片列表的Uid */ _uid: string; /** * Implemented as part of SimFormFieldControl. * @docs-private */ get id(): string; /** 是否任何芯片或simChipInput内部的这个芯片列表有焦点 */ get focused(): boolean; /** * Implemented as part of SimFormFieldControl. * @docs-private */ get empty(): boolean; /** * Implemented as part of SimFormFieldControl. * @docs-private */ controlType: string; /** * Implemented as part of SimFormFieldControl. * @docs-private */ get shouldLabelFloat(): boolean; /** 芯片列表中所选芯片的数组 */ get selected(): SimChipComponent[] | SimChipComponent; /** 芯片列表的tabindex */ _tabIndex: number; /** * 用户定义tabindex * 当不为空时,使用用户定义的tabindex。否则使用_tabIndex */ _userTabIndex: number | null; /** 处理焦点的 FocusKeyManager */ _keyManager: FocusKeyManager>; _controlValueAccessorChangeFn: OnChangeType; _onTouched: OnTouchedType; /** 合并所有子芯片的选择变化事件的组合流 */ get chipSelectionChanges(): Observable>; /** 合并所有子芯片的聚焦变化事件的组合流 */ get chipFocusChanges(): Observable>; /** 合并所有子芯片的失焦变化事件的组合流 */ get chipBlurChanges(): Observable>; /** 合并所有子芯片的移除更改事件的组合流 */ get chipRemoveChanges(): Observable>; /** * 当芯片被销毁时,我们存储被销毁芯片的索引,直到芯片查询列表通知更新。 * 这是必要的,因为我们不能确定一个适当的芯片应该接收焦点,直到芯片阵列更新完全。 */ private _lastDestroyedChipIndex; private _selectionModel; private _chipInput; /** 当组件被销毁时发送 */ private _destroyed; /** 订阅聚焦于芯片的变化 */ private _chipFocusSubscription; /** 订阅芯片的失焦变化 */ private _chipBlurSubscription; /** 订阅芯片的选择变化 */ private _chipSelectionSubscription; /** 订阅删除芯片中的更改 */ private _chipRemoveSubscription; constructor(_elementRef: ElementRef, _changeDetectorRef: ChangeDetectorRef, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, _defaultErrorStateMatcher: ErrorStateMatcher, /** @docs-private */ ngControl: NgControl); ngOnInit(): void; ngAfterContentInit(): void; ngDoCheck(): void; ngOnDestroy(): void; writeValue(value: any): void; registerOnChange(fn: (value: any) => void): void; registerOnTouched(fn: () => void): void; setDisabledState(isDisabled: boolean): void; /** * Implemented as part of SimFormFieldControl. * @docs-private */ setDescribedByIds(ids: string[]): void; /** * Implemented as part of SimFormFieldControl. * @docs-private */ onContainerClick(event: MouseEvent): void; /** 将事件传递给键盘管理器 */ _keydown(event: KeyboardEvent): void; /** 允许编程聚焦芯片 */ focus(options?: FocusOptions): void; /** 当失去焦点时,当焦点移到芯片列表外时,将字段标记为touched。 */ _blur(): void; /** 如果我们有一个输入,尝试集中注意力 */ _focusInput(options?: FocusOptions): void; /** 将字段标记为touched */ _markAsTouched(): void; /** 将一个input元素与这个芯片列表关联 */ registerInput(inputElement: SimChipTextControl): void; /** * 从芯片列表中移除`tabindex`,然后将其重新设置,允许用户从它中退出。 * 这将防止列表捕获焦点并将其重定向回第一个芯片,从而在用户试图离开时创建一个焦点捕获。 */ _allowFocusEscape(): void; _setSelectionByValue(value: any, isUserInput?: boolean): void; /** 检查事件是否来自芯片元素内部 */ private _originatesFromChip; private _resetChips; /** 在每个芯片上侦听用户生成的选择事件 */ private _listenToChipsSelection; /** 在每个芯片上侦听用户生成的焦点事件 */ private _listenToChipsFocus; private _listenToChipsRemoved; private _dropSubscriptions; /** 发出更改事件来设置模型值 */ private _propagateChanges; /** * 实用程序以确保所有tabindex都是有效的 * * @param index 要检查的tabindex值 * @returns 如果tabindex对我们的芯片列表有效,则为true */ private _isValidIndex; /** * 检查tabindex,因为不允许对空列表进行聚焦。 */ private _updateTabIndex; /** * 如果芯片的数量发生了变化,我们需要更新密钥管理器状态并聚焦下一个最近的芯片。 */ protected _updateFocusForDestroyedChips(): void; /** * 对模型值进行排序,确保它们保持与面板中相同的顺序。 */ private _sortValues; /** * 根据芯片的值查找并选择芯片 * @returns 具有相应值的芯片 */ private _selectValue; /** * 检查input的值是否为空 */ private _isInputEmpty; /** 检查是否有芯片被聚焦 */ private _hasFocusedChip; /** 初始化选择 */ private _initializeSelection; /** * 取消选择列表中的每一个芯片 * @param skip 跳过不应该被取消选中的芯片 */ private _clearSelection; /** 将列表的状态与各个芯片同步 */ private _syncChipsState; private _syncChipsSelectable; } export {};