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