source: trip-planner-front/node_modules/@angular/material/chips/chip-list.d.ts@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 11.7 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { FocusKeyManager } from '@angular/cdk/a11y';
9import { Directionality } from '@angular/cdk/bidi';
10import { BooleanInput } from '@angular/cdk/coercion';
11import { SelectionModel } from '@angular/cdk/collections';
12import { AfterContentInit, ChangeDetectorRef, DoCheck, ElementRef, EventEmitter, OnDestroy, OnInit, QueryList } from '@angular/core';
13import { ControlValueAccessor, FormGroupDirective, NgControl, NgForm } from '@angular/forms';
14import { CanUpdateErrorState, ErrorStateMatcher } from '@angular/material/core';
15import { MatFormFieldControl } from '@angular/material/form-field';
16import { Observable } from 'rxjs';
17import { MatChip, MatChipEvent, MatChipSelectionChange } from './chip';
18import { MatChipTextControl } from './chip-text-control';
19/** @docs-private */
20import * as ɵngcc0 from '@angular/core';
21declare const _MatChipListBase: import("@angular/material/core/common-behaviors/constructor").Constructor<CanUpdateErrorState> & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor<CanUpdateErrorState> & {
22 new (_defaultErrorStateMatcher: ErrorStateMatcher, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, ngControl: NgControl): {
23 _defaultErrorStateMatcher: ErrorStateMatcher;
24 _parentForm: NgForm;
25 _parentFormGroup: FormGroupDirective;
26 /** @docs-private */
27 ngControl: NgControl;
28 };
29};
30/** Change event object that is emitted when the chip list value has changed. */
31export declare class MatChipListChange {
32 /** Chip list that emitted the event. */
33 source: MatChipList;
34 /** Value of the chip list when the event was emitted. */
35 value: any;
36 constructor(
37 /** Chip list that emitted the event. */
38 source: MatChipList,
39 /** Value of the chip list when the event was emitted. */
40 value: any);
41}
42/**
43 * A material design chips component (named ChipList for its similarity to the List component).
44 */
45export declare class MatChipList extends _MatChipListBase implements MatFormFieldControl<any>, ControlValueAccessor, AfterContentInit, DoCheck, OnInit, OnDestroy, CanUpdateErrorState {
46 protected _elementRef: ElementRef<HTMLElement>;
47 private _changeDetectorRef;
48 private _dir;
49 /**
50 * Implemented as part of MatFormFieldControl.
51 * @docs-private
52 */
53 readonly controlType: string;
54 /**
55 * When a chip is destroyed, we store the index of the destroyed chip until the chips
56 * query list notifies about the update. This is necessary because we cannot determine an
57 * appropriate chip that should receive focus until the array of chips updated completely.
58 */
59 private _lastDestroyedChipIndex;
60 /** Subject that emits when the component has been destroyed. */
61 private readonly _destroyed;
62 /** Subscription to focus changes in the chips. */
63 private _chipFocusSubscription;
64 /** Subscription to blur changes in the chips. */
65 private _chipBlurSubscription;
66 /** Subscription to selection changes in chips. */
67 private _chipSelectionSubscription;
68 /** Subscription to remove changes in chips. */
69 private _chipRemoveSubscription;
70 /** The chip input to add more chips */
71 protected _chipInput: MatChipTextControl;
72 /** Uid of the chip list */
73 _uid: string;
74 /** The aria-describedby attribute on the chip list for improved a11y. */
75 _ariaDescribedby: string;
76 /** Tab index for the chip list. */
77 _tabIndex: number;
78 /**
79 * User defined tab index.
80 * When it is not null, use user defined tab index. Otherwise use _tabIndex
81 */
82 _userTabIndex: number | null;
83 /** The FocusKeyManager which handles focus. */
84 _keyManager: FocusKeyManager<MatChip>;
85 /** Function when touched */
86 _onTouched: () => void;
87 /** Function when changed */
88 _onChange: (value: any) => void;
89 _selectionModel: SelectionModel<MatChip>;
90 /** The array of selected chips inside chip list. */
91 get selected(): MatChip[] | MatChip;
92 /** The ARIA role applied to the chip list. */
93 get role(): string | null;
94 /** An object used to control when error messages are shown. */
95 errorStateMatcher: ErrorStateMatcher;
96 /** Whether the user should be allowed to select multiple chips. */
97 get multiple(): boolean;
98 set multiple(value: boolean);
99 private _multiple;
100 /**
101 * A function to compare the option values with the selected values. The first argument
102 * is a value from an option. The second is a value from the selection. A boolean
103 * should be returned.
104 */
105 get compareWith(): (o1: any, o2: any) => boolean;
106 set compareWith(fn: (o1: any, o2: any) => boolean);
107 private _compareWith;
108 /**
109 * Implemented as part of MatFormFieldControl.
110 * @docs-private
111 */
112 get value(): any;
113 set value(value: any);
114 protected _value: any;
115 /**
116 * Implemented as part of MatFormFieldControl.
117 * @docs-private
118 */
119 get id(): string;
120 /**
121 * Implemented as part of MatFormFieldControl.
122 * @docs-private
123 */
124 get required(): boolean;
125 set required(value: boolean);
126 protected _required: boolean;
127 /**
128 * Implemented as part of MatFormFieldControl.
129 * @docs-private
130 */
131 get placeholder(): string;
132 set placeholder(value: string);
133 protected _placeholder: string;
134 /** Whether any chips or the matChipInput inside of this chip-list has focus. */
135 get focused(): boolean;
136 /**
137 * Implemented as part of MatFormFieldControl.
138 * @docs-private
139 */
140 get empty(): boolean;
141 /**
142 * Implemented as part of MatFormFieldControl.
143 * @docs-private
144 */
145 get shouldLabelFloat(): boolean;
146 /**
147 * Implemented as part of MatFormFieldControl.
148 * @docs-private
149 */
150 get disabled(): boolean;
151 set disabled(value: boolean);
152 protected _disabled: boolean;
153 /** Orientation of the chip list. */
154 ariaOrientation: 'horizontal' | 'vertical';
155 /**
156 * Whether or not this chip list is selectable. When a chip list is not selectable,
157 * the selected states for all the chips inside the chip list are always ignored.
158 */
159 get selectable(): boolean;
160 set selectable(value: boolean);
161 protected _selectable: boolean;
162 set tabIndex(value: number);
163 /** Combined stream of all of the child chips' selection change events. */
164 get chipSelectionChanges(): Observable<MatChipSelectionChange>;
165 /** Combined stream of all of the child chips' focus change events. */
166 get chipFocusChanges(): Observable<MatChipEvent>;
167 /** Combined stream of all of the child chips' blur change events. */
168 get chipBlurChanges(): Observable<MatChipEvent>;
169 /** Combined stream of all of the child chips' remove change events. */
170 get chipRemoveChanges(): Observable<MatChipEvent>;
171 /** Event emitted when the selected chip list value has been changed by the user. */
172 readonly change: EventEmitter<MatChipListChange>;
173 /**
174 * Event that emits whenever the raw value of the chip-list changes. This is here primarily
175 * to facilitate the two-way binding for the `value` input.
176 * @docs-private
177 */
178 readonly valueChange: EventEmitter<any>;
179 /** The chip components contained within this chip list. */
180 chips: QueryList<MatChip>;
181 constructor(_elementRef: ElementRef<HTMLElement>, _changeDetectorRef: ChangeDetectorRef, _dir: Directionality, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, _defaultErrorStateMatcher: ErrorStateMatcher, ngControl: NgControl);
182 ngAfterContentInit(): void;
183 ngOnInit(): void;
184 ngDoCheck(): void;
185 ngOnDestroy(): void;
186 /** Associates an HTML input element with this chip list. */
187 registerInput(inputElement: MatChipTextControl): void;
188 /**
189 * Implemented as part of MatFormFieldControl.
190 * @docs-private
191 */
192 setDescribedByIds(ids: string[]): void;
193 writeValue(value: any): void;
194 registerOnChange(fn: (value: any) => void): void;
195 registerOnTouched(fn: () => void): void;
196 setDisabledState(isDisabled: boolean): void;
197 /**
198 * Implemented as part of MatFormFieldControl.
199 * @docs-private
200 */
201 onContainerClick(event: MouseEvent): void;
202 /**
203 * Focuses the first non-disabled chip in this chip list, or the associated input when there
204 * are no eligible chips.
205 */
206 focus(options?: FocusOptions): void;
207 /** Attempt to focus an input if we have one. */
208 _focusInput(options?: FocusOptions): void;
209 /**
210 * Pass events to the keyboard manager. Available here for tests.
211 */
212 _keydown(event: KeyboardEvent): void;
213 /**
214 * Check the tab index as you should not be allowed to focus an empty list.
215 */
216 protected _updateTabIndex(): void;
217 /**
218 * If the amount of chips changed, we need to update the
219 * key manager state and focus the next closest chip.
220 */
221 protected _updateFocusForDestroyedChips(): void;
222 /**
223 * Utility to ensure all indexes are valid.
224 *
225 * @param index The index to be checked.
226 * @returns True if the index is valid for our list of chips.
227 */
228 private _isValidIndex;
229 _setSelectionByValue(value: any, isUserInput?: boolean): void;
230 /**
231 * Finds and selects the chip based on its value.
232 * @returns Chip that has the corresponding value.
233 */
234 private _selectValue;
235 private _initializeSelection;
236 /**
237 * Deselects every chip in the list.
238 * @param skip Chip that should not be deselected.
239 */
240 private _clearSelection;
241 /**
242 * Sorts the model values, ensuring that they keep the same
243 * order that they have in the panel.
244 */
245 private _sortValues;
246 /** Emits change event to set the model value. */
247 private _propagateChanges;
248 /** When blurred, mark the field as touched when focus moved outside the chip list. */
249 _blur(): void;
250 /** Mark the field as touched */
251 _markAsTouched(): void;
252 /**
253 * Removes the `tabindex` from the chip list and resets it back afterwards, allowing the
254 * user to tab out of it. This prevents the list from capturing focus and redirecting
255 * it back to the first chip, creating a focus trap, if it user tries to tab away.
256 */
257 _allowFocusEscape(): void;
258 private _resetChips;
259 private _dropSubscriptions;
260 /** Listens to user-generated selection events on each chip. */
261 private _listenToChipsSelection;
262 /** Listens to user-generated selection events on each chip. */
263 private _listenToChipsFocus;
264 private _listenToChipsRemoved;
265 /** Checks whether an event comes from inside a chip element. */
266 private _originatesFromChip;
267 /** Checks whether any of the chips is focused. */
268 private _hasFocusedChip;
269 /** Syncs the list's state with the individual chips. */
270 private _syncChipsState;
271 static ngAcceptInputType_multiple: BooleanInput;
272 static ngAcceptInputType_required: BooleanInput;
273 static ngAcceptInputType_disabled: BooleanInput;
274 static ngAcceptInputType_selectable: BooleanInput;
275 static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MatChipList, [null, null, { optional: true; }, { optional: true; }, { optional: true; }, null, { optional: true; self: true; }]>;
276 static ɵcmp: ɵngcc0.ɵɵComponentDeclaration<MatChipList, "mat-chip-list", ["matChipList"], { "ariaOrientation": "aria-orientation"; "multiple": "multiple"; "compareWith": "compareWith"; "value": "value"; "required": "required"; "placeholder": "placeholder"; "disabled": "disabled"; "selectable": "selectable"; "tabIndex": "tabIndex"; "errorStateMatcher": "errorStateMatcher"; }, { "change": "change"; "valueChange": "valueChange"; }, ["chips"], ["*"]>;
277}
278export {};
279
280//# sourceMappingURL=chip-list.d.ts.map
Note: See TracBrowser for help on using the repository browser.