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 | */
|
---|
8 | import { BooleanInput } from '@angular/cdk/coercion';
|
---|
9 | import { AfterContentInit, ElementRef, EventEmitter, OnChanges, OnDestroy } from '@angular/core';
|
---|
10 | import { MatChipsDefaultOptions } from './chip-default-options';
|
---|
11 | import { MatChipList } from './chip-list';
|
---|
12 | import { MatChipTextControl } from './chip-text-control';
|
---|
13 | /** Represents an input event on a `matChipInput`. */
|
---|
14 | export interface MatChipInputEvent {
|
---|
15 | /**
|
---|
16 | * The native `<input>` element that the event is being fired for.
|
---|
17 | * @deprecated Use `MatChipInputEvent#chipInput.inputElement` instead.
|
---|
18 | * @breaking-change 13.0.0 This property will be removed.
|
---|
19 | */
|
---|
20 | input: HTMLInputElement;
|
---|
21 | /** The value of the input. */
|
---|
22 | value: string;
|
---|
23 | /**
|
---|
24 | * Reference to the chip input that emitted the event.
|
---|
25 | * @breaking-change 13.0.0 This property will be made required.
|
---|
26 | */
|
---|
27 | chipInput?: MatChipInput;
|
---|
28 | }
|
---|
29 | /**
|
---|
30 | * Directive that adds chip-specific behaviors to an input element inside `<mat-form-field>`.
|
---|
31 | * May be placed inside or outside of an `<mat-chip-list>`.
|
---|
32 | */
|
---|
33 | export declare class MatChipInput implements MatChipTextControl, OnChanges, OnDestroy, AfterContentInit {
|
---|
34 | protected _elementRef: ElementRef<HTMLInputElement>;
|
---|
35 | private _defaultOptions;
|
---|
36 | /** Used to prevent focus moving to chips while user is holding backspace */
|
---|
37 | private _focusLastChipOnBackspace;
|
---|
38 | /** Whether the control is focused. */
|
---|
39 | focused: boolean;
|
---|
40 | _chipList: MatChipList;
|
---|
41 | /** Register input for chip list */
|
---|
42 | set chipList(value: MatChipList);
|
---|
43 | /**
|
---|
44 | * Whether or not the chipEnd event will be emitted when the input is blurred.
|
---|
45 | */
|
---|
46 | get addOnBlur(): boolean;
|
---|
47 | set addOnBlur(value: boolean);
|
---|
48 | _addOnBlur: boolean;
|
---|
49 | /**
|
---|
50 | * The list of key codes that will trigger a chipEnd event.
|
---|
51 | *
|
---|
52 | * Defaults to `[ENTER]`.
|
---|
53 | */
|
---|
54 | separatorKeyCodes: readonly number[] | ReadonlySet<number>;
|
---|
55 | /** Emitted when a chip is to be added. */
|
---|
56 | readonly chipEnd: EventEmitter<MatChipInputEvent>;
|
---|
57 | /** The input's placeholder text. */
|
---|
58 | placeholder: string;
|
---|
59 | /** Unique id for the input. */
|
---|
60 | id: string;
|
---|
61 | /** Whether the input is disabled. */
|
---|
62 | get disabled(): boolean;
|
---|
63 | set disabled(value: boolean);
|
---|
64 | private _disabled;
|
---|
65 | /** Whether the input is empty. */
|
---|
66 | get empty(): boolean;
|
---|
67 | /** The native input element to which this directive is attached. */
|
---|
68 | readonly inputElement: HTMLInputElement;
|
---|
69 | constructor(_elementRef: ElementRef<HTMLInputElement>, _defaultOptions: MatChipsDefaultOptions);
|
---|
70 | ngOnChanges(): void;
|
---|
71 | ngOnDestroy(): void;
|
---|
72 | ngAfterContentInit(): void;
|
---|
73 | /** Utility method to make host definition/tests more clear. */
|
---|
74 | _keydown(event?: KeyboardEvent): void;
|
---|
75 | /**
|
---|
76 | * Pass events to the keyboard manager. Available here for tests.
|
---|
77 | */
|
---|
78 | _keyup(event: KeyboardEvent): void;
|
---|
79 | /** Checks to see if the blur should emit the (chipEnd) event. */
|
---|
80 | _blur(): void;
|
---|
81 | _focus(): void;
|
---|
82 | /** Checks to see if the (chipEnd) event needs to be emitted. */
|
---|
83 | _emitChipEnd(event?: KeyboardEvent): void;
|
---|
84 | _onInput(): void;
|
---|
85 | /** Focuses the input. */
|
---|
86 | focus(options?: FocusOptions): void;
|
---|
87 | /** Clears the input */
|
---|
88 | clear(): void;
|
---|
89 | /** Checks whether a keycode is one of the configured separators. */
|
---|
90 | private _isSeparatorKey;
|
---|
91 | static ngAcceptInputType_addOnBlur: BooleanInput;
|
---|
92 | static ngAcceptInputType_disabled: BooleanInput;
|
---|
93 | }
|
---|