chip-input.d.ts 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 { ElementRef, EventEmitter, OnChanges } from '@angular/core';
  9. import { MatChipsDefaultOptions } from './chip-default-options';
  10. import { MatChipList } from './chip-list';
  11. import { MatChipTextControl } from './chip-text-control';
  12. /** Represents an input event on a `matChipInput`. */
  13. export interface MatChipInputEvent {
  14. /** The native `<input>` element that the event is being fired for. */
  15. input: HTMLInputElement;
  16. /** The value of the input. */
  17. value: string;
  18. }
  19. /**
  20. * Directive that adds chip-specific behaviors to an input element inside `<mat-form-field>`.
  21. * May be placed inside or outside of an `<mat-chip-list>`.
  22. */
  23. export declare class MatChipInput implements MatChipTextControl, OnChanges {
  24. protected _elementRef: ElementRef<HTMLInputElement>;
  25. private _defaultOptions;
  26. /** Whether the control is focused. */
  27. focused: boolean;
  28. _chipList: MatChipList;
  29. /** Register input for chip list */
  30. chipList: MatChipList;
  31. /**
  32. * Whether or not the chipEnd event will be emitted when the input is blurred.
  33. */
  34. addOnBlur: boolean;
  35. _addOnBlur: boolean;
  36. /**
  37. * The list of key codes that will trigger a chipEnd event.
  38. *
  39. * Defaults to `[ENTER]`.
  40. */
  41. separatorKeyCodes: number[] | Set<number>;
  42. /** Emitted when a chip is to be added. */
  43. chipEnd: EventEmitter<MatChipInputEvent>;
  44. /** The input's placeholder text. */
  45. placeholder: string;
  46. /** Unique id for the input. */
  47. id: string;
  48. /** Whether the input is disabled. */
  49. disabled: boolean;
  50. private _disabled;
  51. /** Whether the input is empty. */
  52. readonly empty: boolean;
  53. /** The native input element to which this directive is attached. */
  54. protected _inputElement: HTMLInputElement;
  55. constructor(_elementRef: ElementRef<HTMLInputElement>, _defaultOptions: MatChipsDefaultOptions);
  56. ngOnChanges(): void;
  57. /** Utility method to make host definition/tests more clear. */
  58. _keydown(event?: KeyboardEvent): void;
  59. /** Checks to see if the blur should emit the (chipEnd) event. */
  60. _blur(): void;
  61. _focus(): void;
  62. /** Checks to see if the (chipEnd) event needs to be emitted. */
  63. _emitChipEnd(event?: KeyboardEvent): void;
  64. _onInput(): void;
  65. /** Focuses the input. */
  66. focus(options?: FocusOptions): void;
  67. /** Checks whether a keycode is one of the configured separators. */
  68. private _isSeparatorKey;
  69. }