@@ -1993,6 +1993,10 @@ class MatChipInput {
19931993 this . _disabled = value ;
19941994 }
19951995 _disabled = false ;
1996+ /** Whether the input is readonly. */
1997+ readonly = false ;
1998+ /** Whether the input should remain interactive when it is disabled. */
1999+ disabledInteractive ;
19962000 /** Whether the input is empty. */
19972001 get empty ( ) {
19982002 return ! this . inputElement . value ;
@@ -2004,6 +2008,7 @@ class MatChipInput {
20042008 const formField = inject ( MAT_FORM_FIELD , { optional : true } ) ;
20052009 this . inputElement = this . _elementRef . nativeElement ;
20062010 this . separatorKeyCodes = defaultOptions . separatorKeyCodes ;
2011+ this . disabledInteractive = defaultOptions . inputDisabledInteractive ?? false ;
20072012 if ( formField ) {
20082013 this . inputElement . classList . add ( 'mat-mdc-form-field-input-control' ) ;
20092014 }
@@ -2082,8 +2087,12 @@ class MatChipInput {
20822087 _isSeparatorKey ( event ) {
20832088 return ! hasModifierKey ( event ) && new Set ( this . separatorKeyCodes ) . has ( event . keyCode ) ;
20842089 }
2090+ /** Gets the value to set on the `readonly` attribute. */
2091+ _getReadonlyAttribute ( ) {
2092+ return this . readonly || ( this . disabled && this . disabledInteractive ) ? 'true' : null ;
2093+ }
20852094 static ɵfac = i0 . ɵɵngDeclareFactory ( { minVersion : "12.0.0" , version : "20.0.0-next.1" , ngImport : i0 , type : MatChipInput , deps : [ ] , target : i0 . ɵɵFactoryTarget . Directive } ) ;
2086- static ɵdir = i0 . ɵɵngDeclareDirective ( { minVersion : "16.1.0" , version : "20.0.0-next.1" , type : MatChipInput , isStandalone : true , selector : "input[matChipInputFor]" , inputs : { chipGrid : [ "matChipInputFor" , "chipGrid" ] , addOnBlur : [ "matChipInputAddOnBlur" , "addOnBlur" , booleanAttribute ] , separatorKeyCodes : [ "matChipInputSeparatorKeyCodes" , "separatorKeyCodes" ] , placeholder : "placeholder" , id : "id" , disabled : [ "disabled" , "disabled" , booleanAttribute ] } , outputs : { chipEnd : "matChipInputTokenEnd" } , host : { listeners : { "keydown" : "_keydown($event)" , "blur" : "_blur()" , "focus" : "_focus()" , "input" : "_onInput()" } , properties : { "id" : "id" , "attr.disabled" : "disabled || null" , "attr.placeholder" : "placeholder || null" , "attr.aria-invalid" : "_chipGrid && _chipGrid.ngControl ? _chipGrid.ngControl.invalid : null" , "attr.aria-required" : "_chipGrid && _chipGrid.required || null" , "attr.required" : "_chipGrid && _chipGrid.required || null" } , classAttribute : "mat-mdc-chip-input mat-mdc-input-element mdc-text-field__input mat-input-element" } , exportAs : [ "matChipInput" , "matChipInputFor" ] , usesOnChanges : true , ngImport : i0 } ) ;
2095+ static ɵdir = i0 . ɵɵngDeclareDirective ( { minVersion : "16.1.0" , version : "20.0.0-next.1" , type : MatChipInput , isStandalone : true , selector : "input[matChipInputFor]" , inputs : { chipGrid : [ "matChipInputFor" , "chipGrid" ] , addOnBlur : [ "matChipInputAddOnBlur" , "addOnBlur" , booleanAttribute ] , separatorKeyCodes : [ "matChipInputSeparatorKeyCodes" , "separatorKeyCodes" ] , placeholder : "placeholder" , id : "id" , disabled : [ "disabled" , "disabled" , booleanAttribute ] , readonly : [ "readonly" , "readonly" , booleanAttribute ] , disabledInteractive : [ "matChipInputDisabledInteractive" , "disabledInteractive" , booleanAttribute ] } , outputs : { chipEnd : "matChipInputTokenEnd" } , host : { listeners : { "keydown" : "_keydown($event)" , "blur" : "_blur()" , "focus" : "_focus()" , "input" : "_onInput()" } , properties : { "id" : "id" , "attr.disabled" : "disabled && !disabledInteractive ? \"\" : null" , "attr.placeholder" : "placeholder || null" , "attr.aria-invalid" : "_chipGrid && _chipGrid.ngControl ? _chipGrid.ngControl.invalid : null" , "attr.aria-required" : "_chipGrid && _chipGrid.required || null" , "attr.aria-disabled" : "disabled && disabledInteractive ? \"true\" : null" , "attr.readonly" : "_getReadonlyAttribute()" , "attr.required" : "_chipGrid && _chipGrid.required || null" } , classAttribute : "mat-mdc-chip-input mat-mdc-input-element mdc-text-field__input mat-input-element" } , exportAs : [ "matChipInput" , "matChipInputFor" ] , usesOnChanges : true , ngImport : i0 } ) ;
20872096}
20882097i0 . ɵɵngDeclareClassMetadata ( { minVersion : "12.0.0" , version : "20.0.0-next.1" , ngImport : i0 , type : MatChipInput , decorators : [ {
20892098 type : Directive ,
@@ -2100,10 +2109,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-next.1",
21002109 '(focus)' : '_focus()' ,
21012110 '(input)' : '_onInput()' ,
21022111 '[id]' : 'id' ,
2103- '[attr.disabled]' : 'disabled || null' ,
2112+ '[attr.disabled]' : 'disabled && !disabledInteractive ? "" : null' ,
21042113 '[attr.placeholder]' : 'placeholder || null' ,
21052114 '[attr.aria-invalid]' : '_chipGrid && _chipGrid.ngControl ? _chipGrid.ngControl.invalid : null' ,
21062115 '[attr.aria-required]' : '_chipGrid && _chipGrid.required || null' ,
2116+ '[attr.aria-disabled]' : 'disabled && disabledInteractive ? "true" : null' ,
2117+ '[attr.readonly]' : '_getReadonlyAttribute()' ,
21072118 '[attr.required]' : '_chipGrid && _chipGrid.required || null' ,
21082119 } ,
21092120 } ]
@@ -2126,6 +2137,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-next.1",
21262137 } ] , disabled : [ {
21272138 type : Input ,
21282139 args : [ { transform : booleanAttribute } ]
2140+ } ] , readonly : [ {
2141+ type : Input ,
2142+ args : [ { transform : booleanAttribute } ]
2143+ } ] , disabledInteractive : [ {
2144+ type : Input ,
2145+ args : [ { alias : 'matChipInputDisabledInteractive' , transform : booleanAttribute } ]
21292146 } ] } } ) ;
21302147
21312148const CHIP_DECLARATIONS = [
0 commit comments