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 { FocusableOption } from '@angular/cdk/a11y';
|
---|
9 | import { BooleanInput, NumberInput } from '@angular/cdk/coercion';
|
---|
10 | import { Platform } from '@angular/cdk/platform';
|
---|
11 | import { ChangeDetectorRef, ElementRef, EventEmitter, InjectionToken, NgZone, OnDestroy } from '@angular/core';
|
---|
12 | import { CanColor, CanDisable, CanDisableRipple, HasTabIndex, RippleConfig, RippleGlobalOptions, RippleTarget } from '@angular/material/core';
|
---|
13 | import { Subject } from 'rxjs';
|
---|
14 | /** Represents an event fired on an individual `mat-chip`. */
|
---|
15 | export interface MatChipEvent {
|
---|
16 | /** The chip the event was fired on. */
|
---|
17 | chip: MatChip;
|
---|
18 | }
|
---|
19 | /** Event object emitted by MatChip when selected or deselected. */
|
---|
20 | export declare class MatChipSelectionChange {
|
---|
21 | /** Reference to the chip that emitted the event. */
|
---|
22 | source: MatChip;
|
---|
23 | /** Whether the chip that emitted the event is selected. */
|
---|
24 | selected: boolean;
|
---|
25 | /** Whether the selection change was a result of a user interaction. */
|
---|
26 | isUserInput: boolean;
|
---|
27 | constructor(
|
---|
28 | /** Reference to the chip that emitted the event. */
|
---|
29 | source: MatChip,
|
---|
30 | /** Whether the chip that emitted the event is selected. */
|
---|
31 | selected: boolean,
|
---|
32 | /** Whether the selection change was a result of a user interaction. */
|
---|
33 | isUserInput?: boolean);
|
---|
34 | }
|
---|
35 | /**
|
---|
36 | * Injection token that can be used to reference instances of `MatChipRemove`. It serves as
|
---|
37 | * alternative token to the actual `MatChipRemove` class which could cause unnecessary
|
---|
38 | * retention of the class and its directive metadata.
|
---|
39 | */
|
---|
40 | export declare const MAT_CHIP_REMOVE: InjectionToken<MatChipRemove>;
|
---|
41 | /**
|
---|
42 | * Injection token that can be used to reference instances of `MatChipAvatar`. It serves as
|
---|
43 | * alternative token to the actual `MatChipAvatar` class which could cause unnecessary
|
---|
44 | * retention of the class and its directive metadata.
|
---|
45 | */
|
---|
46 | export declare const MAT_CHIP_AVATAR: InjectionToken<MatChipAvatar>;
|
---|
47 | /**
|
---|
48 | * Injection token that can be used to reference instances of `MatChipTrailingIcon`. It serves as
|
---|
49 | * alternative token to the actual `MatChipTrailingIcon` class which could cause unnecessary
|
---|
50 | * retention of the class and its directive metadata.
|
---|
51 | */
|
---|
52 | export declare const MAT_CHIP_TRAILING_ICON: InjectionToken<MatChipTrailingIcon>;
|
---|
53 | /** @docs-private */
|
---|
54 | declare abstract class MatChipBase {
|
---|
55 | _elementRef: ElementRef;
|
---|
56 | abstract disabled: boolean;
|
---|
57 | constructor(_elementRef: ElementRef);
|
---|
58 | }
|
---|
59 | declare const _MatChipMixinBase: import("@angular/material/core/common-behaviors/constructor").Constructor<HasTabIndex> & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor<HasTabIndex> & import("@angular/material/core/common-behaviors/constructor").Constructor<CanColor> & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor<CanColor> & import("@angular/material/core/common-behaviors/constructor").Constructor<CanDisableRipple> & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor<CanDisableRipple> & typeof MatChipBase;
|
---|
60 | /**
|
---|
61 | * Dummy directive to add CSS class to chip avatar.
|
---|
62 | * @docs-private
|
---|
63 | */
|
---|
64 | export declare class MatChipAvatar {
|
---|
65 | }
|
---|
66 | /**
|
---|
67 | * Dummy directive to add CSS class to chip trailing icon.
|
---|
68 | * @docs-private
|
---|
69 | */
|
---|
70 | export declare class MatChipTrailingIcon {
|
---|
71 | }
|
---|
72 | /**
|
---|
73 | * Material design styled Chip component. Used inside the MatChipList component.
|
---|
74 | */
|
---|
75 | export declare class MatChip extends _MatChipMixinBase implements FocusableOption, OnDestroy, CanColor, CanDisableRipple, RippleTarget, HasTabIndex, CanDisable {
|
---|
76 | private _ngZone;
|
---|
77 | private _changeDetectorRef;
|
---|
78 | /** Reference to the RippleRenderer for the chip. */
|
---|
79 | private _chipRipple;
|
---|
80 | /**
|
---|
81 | * Reference to the element that acts as the chip's ripple target. This element is
|
---|
82 | * dynamically added as a child node of the chip. The chip itself cannot be used as the
|
---|
83 | * ripple target because it must be the host of the focus indicator.
|
---|
84 | */
|
---|
85 | private _chipRippleTarget;
|
---|
86 | /**
|
---|
87 | * Ripple configuration for ripples that are launched on pointer down. The ripple config
|
---|
88 | * is set to the global ripple options since we don't have any configurable options for
|
---|
89 | * the chip ripples.
|
---|
90 | * @docs-private
|
---|
91 | */
|
---|
92 | rippleConfig: RippleConfig & RippleGlobalOptions;
|
---|
93 | /**
|
---|
94 | * Whether ripples are disabled on interaction
|
---|
95 | * @docs-private
|
---|
96 | */
|
---|
97 | get rippleDisabled(): boolean;
|
---|
98 | /** Whether the chip has focus. */
|
---|
99 | _hasFocus: boolean;
|
---|
100 | /** Whether animations for the chip are enabled. */
|
---|
101 | _animationsDisabled: boolean;
|
---|
102 | /** Whether the chip list is selectable */
|
---|
103 | chipListSelectable: boolean;
|
---|
104 | /** Whether the chip list is in multi-selection mode. */
|
---|
105 | _chipListMultiple: boolean;
|
---|
106 | /** Whether the chip list as a whole is disabled. */
|
---|
107 | _chipListDisabled: boolean;
|
---|
108 | /** The chip avatar */
|
---|
109 | avatar: MatChipAvatar;
|
---|
110 | /** The chip's trailing icon. */
|
---|
111 | trailingIcon: MatChipTrailingIcon;
|
---|
112 | /** The chip's remove toggler. */
|
---|
113 | removeIcon: MatChipRemove;
|
---|
114 | /** Whether the chip is selected. */
|
---|
115 | get selected(): boolean;
|
---|
116 | set selected(value: boolean);
|
---|
117 | protected _selected: boolean;
|
---|
118 | /** The value of the chip. Defaults to the content inside `<mat-chip>` tags. */
|
---|
119 | get value(): any;
|
---|
120 | set value(value: any);
|
---|
121 | protected _value: any;
|
---|
122 | /**
|
---|
123 | * Whether or not the chip is selectable. When a chip is not selectable,
|
---|
124 | * changes to its selected state are always ignored. By default a chip is
|
---|
125 | * selectable, and it becomes non-selectable if its parent chip list is
|
---|
126 | * not selectable.
|
---|
127 | */
|
---|
128 | get selectable(): boolean;
|
---|
129 | set selectable(value: boolean);
|
---|
130 | protected _selectable: boolean;
|
---|
131 | /** Whether the chip is disabled. */
|
---|
132 | get disabled(): boolean;
|
---|
133 | set disabled(value: boolean);
|
---|
134 | protected _disabled: boolean;
|
---|
135 | /**
|
---|
136 | * Determines whether or not the chip displays the remove styling and emits (removed) events.
|
---|
137 | */
|
---|
138 | get removable(): boolean;
|
---|
139 | set removable(value: boolean);
|
---|
140 | protected _removable: boolean;
|
---|
141 | /** Emits when the chip is focused. */
|
---|
142 | readonly _onFocus: Subject<MatChipEvent>;
|
---|
143 | /** Emits when the chip is blured. */
|
---|
144 | readonly _onBlur: Subject<MatChipEvent>;
|
---|
145 | /** Emitted when the chip is selected or deselected. */
|
---|
146 | readonly selectionChange: EventEmitter<MatChipSelectionChange>;
|
---|
147 | /** Emitted when the chip is destroyed. */
|
---|
148 | readonly destroyed: EventEmitter<MatChipEvent>;
|
---|
149 | /** Emitted when a chip is to be removed. */
|
---|
150 | readonly removed: EventEmitter<MatChipEvent>;
|
---|
151 | /** The ARIA selected applied to the chip. */
|
---|
152 | get ariaSelected(): string | null;
|
---|
153 | constructor(elementRef: ElementRef<HTMLElement>, _ngZone: NgZone, platform: Platform, globalRippleOptions: RippleGlobalOptions | null, _changeDetectorRef: ChangeDetectorRef, _document: any, animationMode?: string, tabIndex?: string);
|
---|
154 | _addHostClassName(): void;
|
---|
155 | ngOnDestroy(): void;
|
---|
156 | /** Selects the chip. */
|
---|
157 | select(): void;
|
---|
158 | /** Deselects the chip. */
|
---|
159 | deselect(): void;
|
---|
160 | /** Select this chip and emit selected event */
|
---|
161 | selectViaInteraction(): void;
|
---|
162 | /** Toggles the current selected state of this chip. */
|
---|
163 | toggleSelected(isUserInput?: boolean): boolean;
|
---|
164 | /** Allows for programmatic focusing of the chip. */
|
---|
165 | focus(): void;
|
---|
166 | /**
|
---|
167 | * Allows for programmatic removal of the chip. Called by the MatChipList when the DELETE or
|
---|
168 | * BACKSPACE keys are pressed.
|
---|
169 | *
|
---|
170 | * Informs any listeners of the removal request. Does not remove the chip from the DOM.
|
---|
171 | */
|
---|
172 | remove(): void;
|
---|
173 | /** Handles click events on the chip. */
|
---|
174 | _handleClick(event: Event): void;
|
---|
175 | /** Handle custom key presses. */
|
---|
176 | _handleKeydown(event: KeyboardEvent): void;
|
---|
177 | _blur(): void;
|
---|
178 | private _dispatchSelectionChange;
|
---|
179 | static ngAcceptInputType_selected: BooleanInput;
|
---|
180 | static ngAcceptInputType_selectable: BooleanInput;
|
---|
181 | static ngAcceptInputType_removable: BooleanInput;
|
---|
182 | static ngAcceptInputType_disabled: BooleanInput;
|
---|
183 | static ngAcceptInputType_disableRipple: BooleanInput;
|
---|
184 | static ngAcceptInputType_tabIndex: NumberInput;
|
---|
185 | }
|
---|
186 | /**
|
---|
187 | * Applies proper (click) support and adds styling for use with the Material Design "cancel" icon
|
---|
188 | * available at https://material.io/icons/#ic_cancel.
|
---|
189 | *
|
---|
190 | * Example:
|
---|
191 | *
|
---|
192 | * `<mat-chip>
|
---|
193 | * <mat-icon matChipRemove>cancel</mat-icon>
|
---|
194 | * </mat-chip>`
|
---|
195 | *
|
---|
196 | * You *may* use a custom icon, but you may need to override the `mat-chip-remove` positioning
|
---|
197 | * styles to properly center the icon within the chip.
|
---|
198 | */
|
---|
199 | export declare class MatChipRemove {
|
---|
200 | protected _parentChip: MatChip;
|
---|
201 | constructor(_parentChip: MatChip, elementRef: ElementRef<HTMLElement>);
|
---|
202 | /** Calls the parent chip's public `remove()` method if applicable. */
|
---|
203 | _handleClick(event: Event): void;
|
---|
204 | }
|
---|
205 | export {};
|
---|