| 67 | }, |
| 68 | }) |
| 69 | export class MatChipInput implements MatChipTextControl, OnChanges, OnDestroy { |
| 70 | protected _elementRef = inject<ElementRef<HTMLInputElement>>(ElementRef); |
| 71 | |
| 72 | /** Whether the control is focused. */ |
| 73 | focused: boolean = false; |
| 74 | |
| 75 | /** Register input for chip list */ |
| 76 | @Input('matChipInputFor') |
| 77 | get chipGrid(): MatChipGrid { |
| 78 | return this._chipGrid; |
| 79 | } |
| 80 | set chipGrid(value: MatChipGrid) { |
| 81 | if (value) { |
| 82 | this._chipGrid = value; |
| 83 | this._chipGrid.registerInput(this); |
| 84 | } |
| 85 | } |
| 86 | protected _chipGrid!: MatChipGrid; |
| 87 | |
| 88 | /** |
| 89 | * Whether or not the chipEnd event will be emitted when the input is blurred. |
| 90 | */ |
| 91 | @Input({alias: 'matChipInputAddOnBlur', transform: booleanAttribute}) |
| 92 | addOnBlur: boolean = false; |
| 93 | |
| 94 | /** |
| 95 | * The list of key codes that will trigger a chipEnd event. |
| 96 | * |
| 97 | * Defaults to `[ENTER]`. |
| 98 | */ |
| 99 | @Input('matChipInputSeparatorKeyCodes') |
| 100 | separatorKeyCodes: readonly (number | SeparatorKey)[] | ReadonlySet<number | SeparatorKey>; |
| 101 | |
| 102 | /** Emitted when a chip is to be added. */ |
| 103 | @Output('matChipInputTokenEnd') |
| 104 | readonly chipEnd: EventEmitter<MatChipInputEvent> = new EventEmitter<MatChipInputEvent>(); |
| 105 | |
| 106 | /** The input's placeholder text. */ |
| 107 | @Input() placeholder: string = ''; |
| 108 | |
| 109 | /** Unique id for the input. */ |
| 110 | @Input() id: string = inject(_IdGenerator).getId('mat-mdc-chip-list-input-'); |
| 111 | |
| 112 | /** Whether the input is disabled. */ |
| 113 | @Input({transform: booleanAttribute}) |
| 114 | get disabled(): boolean { |
| 115 | return this._disabled || (this._chipGrid && this._chipGrid.disabled); |
| 116 | } |
| 117 | set disabled(value: boolean) { |
| 118 | this._disabled = value; |
| 119 | } |
| 120 | private _disabled: boolean = false; |
| 121 | |
| 122 | /** Whether the input is readonly. */ |
| 123 | @Input({transform: booleanAttribute}) |
| 124 | readonly: boolean = false; |
| 125 | |
| 126 | /** Whether the input should remain interactive when it is disabled. */ |
nothing calls this directly
no test coverage detected
searching dependent graphs…