blob: 1bdbad0bf9268c9501ff46d09df5f29af492d1ce [file] [log] [blame]
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/material/core"),require("@angular/cdk/a11y"),require("@angular/cdk/coercion"),require("@angular/cdk/collections"),require("@angular/forms"),require("@angular/platform-browser/animations")):"function"==typeof define&&define.amd?define("@angular/material/radio",["exports","@angular/core","@angular/material/core","@angular/cdk/a11y","@angular/cdk/coercion","@angular/cdk/collections","@angular/forms","@angular/platform-browser/animations"],t):t(((e=e||self).ng=e.ng||{},e.ng.material=e.ng.material||{},e.ng.material.radio={}),e.ng.core,e.ng.material.core,e.ng.cdk.a11y,e.ng.cdk.coercion,e.ng.cdk.collections,e.ng.forms,e.ng.platformBrowser.animations)}(this,(function(e,t,i,o,r,n,a,s){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var c=function(e,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)};function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}c(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var d=new t.InjectionToken("mat-radio-default-options",{providedIn:"root",factory:p});function p(){return{color:"accent"}}var u=0,h={provide:a.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return y})),multi:!0},m=function m(e,t){this.source=e,this.value=t},b=new t.InjectionToken("MatRadioGroup"),f=function(){function e(e){this._changeDetector=e,this._value=null,this._name="mat-radio-group-"+u++,this._selected=null,this._isInitialized=!1,this._labelPosition="after",this._disabled=!1,this._required=!1,this._controlValueAccessorChangeFn=function(){},this.onTouched=function(){},this.change=new t.EventEmitter}return Object.defineProperty(e.prototype,"name",{get:function(){return this._name},set:function(e){this._name=e,this._updateRadioButtonNames()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"labelPosition",{get:function(){return this._labelPosition},set:function(e){this._labelPosition="before"===e?"before":"after",this._markRadiosForCheck()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(e){this._value!==e&&(this._value=e,this._updateSelectedRadioFromValue(),this._checkSelectedRadioButton())},enumerable:!1,configurable:!0}),e.prototype._checkSelectedRadioButton=function(){this._selected&&!this._selected.checked&&(this._selected.checked=!0)},Object.defineProperty(e.prototype,"selected",{get:function(){return this._selected},set:function(e){this._selected=e,this.value=e?e.value:null,this._checkSelectedRadioButton()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"disabled",{get:function(){return this._disabled},set:function(e){this._disabled=r.coerceBooleanProperty(e),this._markRadiosForCheck()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"required",{get:function(){return this._required},set:function(e){this._required=r.coerceBooleanProperty(e),this._markRadiosForCheck()},enumerable:!1,configurable:!0}),e.prototype.ngAfterContentInit=function(){this._isInitialized=!0},e.prototype._touch=function(){this.onTouched&&this.onTouched()},e.prototype._updateRadioButtonNames=function(){var e=this;this._radios&&this._radios.forEach((function(t){t.name=e.name,t._markForCheck()}))},e.prototype._updateSelectedRadioFromValue=function(){var e=this;this._radios&&(null===this._selected||this._selected.value!==this._value)&&(this._selected=null,this._radios.forEach((function(t){t.checked=e.value===t.value,t.checked&&(e._selected=t)})))},e.prototype._emitChangeEvent=function(){this._isInitialized&&this.change.emit(new m(this._selected,this._value))},e.prototype._markRadiosForCheck=function(){this._radios&&this._radios.forEach((function(e){return e._markForCheck()}))},e.prototype.writeValue=function(e){this.value=e,this._changeDetector.markForCheck()},e.prototype.registerOnChange=function(e){this._controlValueAccessorChangeFn=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e.prototype.setDisabledState=function(e){this.disabled=e,this._changeDetector.markForCheck()},e}();f.decorators=[{type:t.Directive}],f.ctorParameters=function(){return[{type:t.ChangeDetectorRef}]},f.propDecorators={change:[{type:t.Output}],color:[{type:t.Input}],name:[{type:t.Input}],labelPosition:[{type:t.Input}],value:[{type:t.Input}],selected:[{type:t.Input}],disabled:[{type:t.Input}],required:[{type:t.Input}]};var y=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l(t,e),t}(f);y.decorators=[{type:t.Directive,args:[{selector:"mat-radio-group",exportAs:"matRadioGroup",providers:[h,{provide:b,useExisting:y}],host:{role:"radiogroup",class:"mat-radio-group"}}]}],y.propDecorators={_radios:[{type:t.ContentChildren,args:[t.forwardRef((function(){return k})),{descendants:!0}]}]};var g=function(e){function i(i,o,n,a,s,c,l,d){var p=e.call(this,o)||this;return p._changeDetector=n,p._focusMonitor=a,p._radioDispatcher=s,p._animationMode=c,p._providerOverride=l,p._uniqueId="mat-radio-"+ ++u,p.id=p._uniqueId,p.change=new t.EventEmitter,p._checked=!1,p._value=null,p._removeUniqueSelectionListener=function(){},p.radioGroup=i,d&&(p.tabIndex=r.coerceNumberProperty(d,0)),p._removeUniqueSelectionListener=s.listen((function(e,t){e!==p.id&&t===p.name&&(p.checked=!1)})),p}return l(i,e),Object.defineProperty(i.prototype,"checked",{get:function(){return this._checked},set:function(e){var t=r.coerceBooleanProperty(e);this._checked!==t&&(this._checked=t,t&&this.radioGroup&&this.radioGroup.value!==this.value?this.radioGroup.selected=this:!t&&this.radioGroup&&this.radioGroup.value===this.value&&(this.radioGroup.selected=null),t&&this._radioDispatcher.notify(this.id,this.name),this._changeDetector.markForCheck())},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"value",{get:function(){return this._value},set:function(e){this._value!==e&&(this._value=e,null!==this.radioGroup&&(this.checked||(this.checked=this.radioGroup.value===e),this.checked&&(this.radioGroup.selected=this)))},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"labelPosition",{get:function(){return this._labelPosition||this.radioGroup&&this.radioGroup.labelPosition||"after"},set:function(e){this._labelPosition=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"disabled",{get:function(){return this._disabled||null!==this.radioGroup&&this.radioGroup.disabled},set:function(e){this._setDisabled(r.coerceBooleanProperty(e))},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"required",{get:function(){return this._required||this.radioGroup&&this.radioGroup.required},set:function(e){this._required=r.coerceBooleanProperty(e)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"color",{get:function(){return this._color||this.radioGroup&&this.radioGroup.color||this._providerOverride&&this._providerOverride.color||"accent"},set:function(e){this._color=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"inputId",{get:function(){return(this.id||this._uniqueId)+"-input"},enumerable:!1,configurable:!0}),i.prototype.focus=function(e,t){t?this._focusMonitor.focusVia(this._inputElement,t,e):this._inputElement.nativeElement.focus(e)},i.prototype._markForCheck=function(){this._changeDetector.markForCheck()},i.prototype.ngOnInit=function(){this.radioGroup&&(this.checked=this.radioGroup.value===this._value,this.checked&&(this.radioGroup.selected=this),this.name=this.radioGroup.name)},i.prototype.ngAfterViewInit=function(){var e=this;this._focusMonitor.monitor(this._elementRef,!0).subscribe((function(t){!t&&e.radioGroup&&e.radioGroup._touch()}))},i.prototype.ngOnDestroy=function(){this._focusMonitor.stopMonitoring(this._elementRef),this._removeUniqueSelectionListener()},i.prototype._emitChangeEvent=function(){this.change.emit(new m(this,this._value))},i.prototype._isRippleDisabled=function(){return this.disableRipple||this.disabled},i.prototype._onInputClick=function(e){e.stopPropagation()},i.prototype._onInputChange=function(e){e.stopPropagation();var t=this.radioGroup&&this.value!==this.radioGroup.value;this.checked=!0,this._emitChangeEvent(),this.radioGroup&&(this.radioGroup._controlValueAccessorChangeFn(this.value),t&&this.radioGroup._emitChangeEvent())},i.prototype._setDisabled=function(e){this._disabled!==e&&(this._disabled=e,this._changeDetector.markForCheck())},i}(i.mixinDisableRipple(i.mixinTabIndex((function _(e){this._elementRef=e}))));g.decorators=[{type:t.Directive}],g.ctorParameters=function(){return[{type:f},{type:t.ElementRef},{type:t.ChangeDetectorRef},{type:o.FocusMonitor},{type:n.UniqueSelectionDispatcher},{type:String},{type:void 0},{type:String}]},g.propDecorators={id:[{type:t.Input}],name:[{type:t.Input}],ariaLabel:[{type:t.Input,args:["aria-label"]}],ariaLabelledby:[{type:t.Input,args:["aria-labelledby"]}],ariaDescribedby:[{type:t.Input,args:["aria-describedby"]}],checked:[{type:t.Input}],value:[{type:t.Input}],labelPosition:[{type:t.Input}],disabled:[{type:t.Input}],required:[{type:t.Input}],color:[{type:t.Input}],change:[{type:t.Output}],_inputElement:[{type:t.ViewChild,args:["input"]}]};var v,k=function(e){function t(t,i,o,r,n,a,s,c){return e.call(this,t,i,o,r,n,a,s,c)||this}return l(t,e),t}(g);k.decorators=[{type:t.Component,args:[{selector:"mat-radio-button",template:'\x3c!-- TODO(jelbourn): render the radio on either side of the content --\x3e\n\x3c!-- TODO(mtlin): Evaluate trade-offs of using native radio vs. cost of additional bindings. --\x3e\n<label [attr.for]="inputId" class="mat-radio-label" #label>\n \x3c!-- The actual \'radio\' part of the control. --\x3e\n <span class="mat-radio-container">\n <span class="mat-radio-outer-circle"></span>\n <span class="mat-radio-inner-circle"></span>\n <input #input class="mat-radio-input cdk-visually-hidden" type="radio"\n [id]="inputId"\n [checked]="checked"\n [disabled]="disabled"\n [tabIndex]="tabIndex"\n [attr.name]="name"\n [attr.value]="value"\n [required]="required"\n [attr.aria-label]="ariaLabel"\n [attr.aria-labelledby]="ariaLabelledby"\n [attr.aria-describedby]="ariaDescribedby"\n (change)="_onInputChange($event)"\n (click)="_onInputClick($event)">\n\n \x3c!-- The ripple comes after the input so that we can target it with a CSS\n sibling selector when the input is focused. --\x3e\n <span mat-ripple class="mat-radio-ripple mat-focus-indicator"\n [matRippleTrigger]="label"\n [matRippleDisabled]="_isRippleDisabled()"\n [matRippleCentered]="true"\n [matRippleRadius]="20"\n [matRippleAnimation]="{enterDuration: 150}">\n\n <span class="mat-ripple-element mat-radio-persistent-ripple"></span>\n </span>\n </span>\n\n \x3c!-- The label content for radio control. --\x3e\n <span class="mat-radio-label-content" [class.mat-radio-label-before]="labelPosition == \'before\'">\n \x3c!-- Add an invisible span so JAWS can read the label --\x3e\n <span style="display:none">&nbsp;</span>\n <ng-content></ng-content>\n </span>\n</label>\n',inputs:["disableRipple","tabIndex"],encapsulation:t.ViewEncapsulation.None,exportAs:"matRadioButton",host:{class:"mat-radio-button","[class.mat-radio-checked]":"checked","[class.mat-radio-disabled]":"disabled","[class._mat-animation-noopable]":'_animationMode === "NoopAnimations"',"[class.mat-primary]":'color === "primary"',"[class.mat-accent]":'color === "accent"',"[class.mat-warn]":'color === "warn"',"[attr.tabindex]":"null","[attr.id]":"id","[attr.aria-label]":"null","[attr.aria-labelledby]":"null","[attr.aria-describedby]":"null","(focus)":"_inputElement.nativeElement.focus()"},changeDetection:t.ChangeDetectionStrategy.OnPush,styles:[".mat-radio-button{display:inline-block;-webkit-tap-highlight-color:transparent;outline:0}.mat-radio-label{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;display:inline-flex;align-items:center;white-space:nowrap;vertical-align:middle;width:100%}.mat-radio-container{box-sizing:border-box;display:inline-block;position:relative;width:20px;height:20px;flex-shrink:0}.mat-radio-outer-circle{box-sizing:border-box;display:block;height:20px;left:0;position:absolute;top:0;transition:border-color ease 280ms;width:20px;border-width:2px;border-style:solid;border-radius:50%}._mat-animation-noopable .mat-radio-outer-circle{transition:none}.mat-radio-inner-circle{border-radius:50%;box-sizing:border-box;display:block;height:20px;left:0;position:absolute;top:0;transition:transform ease 280ms,background-color ease 280ms;width:20px;transform:scale(0.001);-webkit-print-color-adjust:exact;color-adjust:exact}._mat-animation-noopable .mat-radio-inner-circle{transition:none}.mat-radio-checked .mat-radio-inner-circle{transform:scale(0.5)}.cdk-high-contrast-active .mat-radio-checked .mat-radio-inner-circle{border:solid 10px}.mat-radio-label-content{-webkit-user-select:auto;-moz-user-select:auto;-ms-user-select:auto;user-select:auto;display:inline-block;order:0;line-height:inherit;padding-left:8px;padding-right:0}[dir=rtl] .mat-radio-label-content{padding-right:8px;padding-left:0}.mat-radio-label-content.mat-radio-label-before{order:-1;padding-left:0;padding-right:8px}[dir=rtl] .mat-radio-label-content.mat-radio-label-before{padding-right:0;padding-left:8px}.mat-radio-disabled,.mat-radio-disabled .mat-radio-label{cursor:default}.mat-radio-button .mat-radio-ripple{position:absolute;left:calc(50% - 20px);top:calc(50% - 20px);height:40px;width:40px;z-index:1;pointer-events:none}.mat-radio-button .mat-radio-ripple .mat-ripple-element:not(.mat-radio-persistent-ripple){opacity:.16}.mat-radio-persistent-ripple{width:100%;height:100%;transform:none;top:0;left:0}.mat-radio-container:hover .mat-radio-persistent-ripple{opacity:.04}.mat-radio-button:not(.mat-radio-disabled).cdk-keyboard-focused .mat-radio-persistent-ripple,.mat-radio-button:not(.mat-radio-disabled).cdk-program-focused .mat-radio-persistent-ripple{opacity:.12}.mat-radio-persistent-ripple,.mat-radio-disabled .mat-radio-container:hover .mat-radio-persistent-ripple{opacity:0}@media(hover: none){.mat-radio-container:hover .mat-radio-persistent-ripple{display:none}}.mat-radio-input{bottom:0;left:50%}.cdk-high-contrast-active .mat-radio-disabled{opacity:.5}\n"]}]}],k.ctorParameters=function(){return[{type:y,decorators:[{type:t.Optional},{type:t.Inject,args:[b]}]},{type:t.ElementRef},{type:t.ChangeDetectorRef},{type:o.FocusMonitor},{type:n.UniqueSelectionDispatcher},{type:String,decorators:[{type:t.Optional},{type:t.Inject,args:[s.ANIMATION_MODULE_TYPE]}]},{type:void 0,decorators:[{type:t.Optional},{type:t.Inject,args:[d]}]},{type:String,decorators:[{type:t.Attribute,args:["tabindex"]}]}]},(v=function v(){}).decorators=[{type:t.NgModule,args:[{imports:[i.MatRippleModule,i.MatCommonModule],exports:[y,k,i.MatCommonModule],declarations:[y,k]}]}],
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
e.MAT_RADIO_DEFAULT_OPTIONS=d,e.MAT_RADIO_DEFAULT_OPTIONS_FACTORY=p,e.MAT_RADIO_GROUP=b,e.MAT_RADIO_GROUP_CONTROL_VALUE_ACCESSOR=h,e.MatRadioButton=k,e.MatRadioChange=m,e.MatRadioGroup=y,e.MatRadioModule=v,e._MatRadioButtonBase=g,e._MatRadioGroupBase=f,Object.defineProperty(e,"__esModule",{value:!0})}));