@angular/material
Version:
Angular Material
31 lines (29 loc) • 19.3 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/a11y"),require("@angular/cdk/coercion"),require("@angular/core"),require("@angular/forms"),require("@angular/material/core"),require("@angular/platform-browser/animations"),require("@angular/cdk/observers")):"function"==typeof define&&define.amd?define("@angular/material/checkbox",["exports","@angular/cdk/a11y","@angular/cdk/coercion","@angular/core","@angular/forms","@angular/material/core","@angular/platform-browser/animations","@angular/cdk/observers"],t):t(((e=e||self).ng=e.ng||{},e.ng.material=e.ng.material||{},e.ng.material.checkbox={}),e.ng.cdk.a11y,e.ng.cdk.coercion,e.ng.core,e.ng.forms,e.ng.material.core,e.ng.platformBrowser.animations,e.ng.cdk.observers)}(this,(function(e,t,n,a,i,c,o,r){"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 s=function(e,t){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}
/**
* @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
*/
var h=new a.InjectionToken("mat-checkbox-default-options",{providedIn:"root",factory:d});function d(){return{color:"accent",clickAction:"check-indeterminate"}}var l=0,k={color:"accent",clickAction:"check-indeterminate"},p={provide:i.NG_VALUE_ACCESSOR,useExisting:a.forwardRef((function(){return u})),multi:!0},b=function b(){},u=function(e){function t(t,n,i,c,o,r,s){var m=e.call(this,t)||this;return m._changeDetectorRef=n,m._focusMonitor=i,m._ngZone=c,m._animationMode=r,m._options=s,m.ariaLabel="",m.ariaLabelledby=null,m._uniqueId="mat-checkbox-"+ ++l,m.id=m._uniqueId,m.labelPosition="after",m.name=null,m.change=new a.EventEmitter,m.indeterminateChange=new a.EventEmitter,m._onTouched=function(){},m._currentAnimationClass="",m._currentCheckState=0,m._controlValueAccessorChangeFn=function(){},m._checked=!1,m._disabled=!1,m._indeterminate=!1,m._options=m._options||k,m.color=m.defaultColor=m._options.color||k.color,m.tabIndex=parseInt(o)||0,m}return m(t,e),Object.defineProperty(t.prototype,"inputId",{get:function(){return(this.id||this._uniqueId)+"-input"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"required",{get:function(){return this._required},set:function(e){this._required=n.coerceBooleanProperty(e)},enumerable:!1,configurable:!0}),t.prototype.ngAfterViewInit=function(){var e=this;this._focusMonitor.monitor(this._elementRef,!0).subscribe((function(t){t||Promise.resolve().then((function(){e._onTouched(),e._changeDetectorRef.markForCheck()}))})),this._syncIndeterminate(this._indeterminate)},t.prototype.ngAfterViewChecked=function(){},t.prototype.ngOnDestroy=function(){this._focusMonitor.stopMonitoring(this._elementRef)},Object.defineProperty(t.prototype,"checked",{get:function(){return this._checked},set:function(e){e!=this.checked&&(this._checked=e,this._changeDetectorRef.markForCheck())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return this._disabled},set:function(e){var t=n.coerceBooleanProperty(e);t!==this.disabled&&(this._disabled=t,this._changeDetectorRef.markForCheck())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"indeterminate",{get:function(){return this._indeterminate},set:function(e){var t=e!=this._indeterminate;this._indeterminate=n.coerceBooleanProperty(e),t&&(this._transitionCheckState(this._indeterminate?3:this.checked?1:2),this.indeterminateChange.emit(this._indeterminate)),this._syncIndeterminate(this._indeterminate)},enumerable:!1,configurable:!0}),t.prototype._isRippleDisabled=function(){return this.disableRipple||this.disabled},t.prototype._onLabelTextChange=function(){this._changeDetectorRef.detectChanges()},t.prototype.writeValue=function(e){this.checked=!!e},t.prototype.registerOnChange=function(e){this._controlValueAccessorChangeFn=e},t.prototype.registerOnTouched=function(e){this._onTouched=e},t.prototype.setDisabledState=function(e){this.disabled=e},t.prototype._getAriaChecked=function(){return this.checked?"true":this.indeterminate?"mixed":"false"},t.prototype._transitionCheckState=function(e){var t=this._currentCheckState,n=this._elementRef.nativeElement;if(t!==e&&(this._currentAnimationClass.length>0&&n.classList.remove(this._currentAnimationClass),this._currentAnimationClass=this._getAnimationClassForCheckStateTransition(t,e),this._currentCheckState=e,this._currentAnimationClass.length>0)){n.classList.add(this._currentAnimationClass);var a=this._currentAnimationClass;this._ngZone.runOutsideAngular((function(){setTimeout((function(){n.classList.remove(a)}),1e3)}))}},t.prototype._emitChangeEvent=function(){var e=new b;e.source=this,e.checked=this.checked,this._controlValueAccessorChangeFn(this.checked),this.change.emit(e)},t.prototype.toggle=function(){this.checked=!this.checked},t.prototype._onInputClick=function(e){var t,n=this,a=null===(t=this._options)||void 0===t?void 0:t.clickAction;e.stopPropagation(),this.disabled||"noop"===a?this.disabled||"noop"!==a||(this._inputElement.nativeElement.checked=this.checked,this._inputElement.nativeElement.indeterminate=this.indeterminate):(this.indeterminate&&"check"!==a&&Promise.resolve().then((function(){n._indeterminate=!1,n.indeterminateChange.emit(n._indeterminate)})),this.toggle(),this._transitionCheckState(this._checked?1:2),this._emitChangeEvent())},t.prototype.focus=function(e,t){e?this._focusMonitor.focusVia(this._inputElement,e,t):this._inputElement.nativeElement.focus(t)},t.prototype._onInteractionEvent=function(e){e.stopPropagation()},t.prototype._getAnimationClassForCheckStateTransition=function(e,t){if("NoopAnimations"===this._animationMode)return"";var n="";switch(e){case 0:if(1===t)n="unchecked-checked";else{if(3!=t)return"";n="unchecked-indeterminate"}break;case 2:n=1===t?"unchecked-checked":"unchecked-indeterminate";break;case 1:n=2===t?"checked-unchecked":"checked-indeterminate";break;case 3:n=1===t?"indeterminate-checked":"indeterminate-unchecked"}return"mat-checkbox-anim-"+n},t.prototype._syncIndeterminate=function(e){var t=this._inputElement;t&&(t.nativeElement.indeterminate=e)},t}(c.mixinTabIndex(c.mixinColor(c.mixinDisableRipple(c.mixinDisabled((function x(e){this._elementRef=e}))))));u.decorators=[{type:a.Component,args:[{selector:"mat-checkbox",template:'<label [attr.for]="inputId" class="mat-checkbox-layout" #label>\n <span class="mat-checkbox-inner-container"\n [class.mat-checkbox-inner-container-no-side-margin]="!checkboxLabel.textContent || !checkboxLabel.textContent.trim()">\n <input #input\n class="mat-checkbox-input cdk-visually-hidden" type="checkbox"\n [id]="inputId"\n [required]="required"\n [checked]="checked"\n [attr.value]="value"\n [disabled]="disabled"\n [attr.name]="name"\n [tabIndex]="tabIndex"\n [attr.aria-label]="ariaLabel || null"\n [attr.aria-labelledby]="ariaLabelledby"\n [attr.aria-checked]="_getAriaChecked()"\n [attr.aria-describedby]="ariaDescribedby"\n (change)="_onInteractionEvent($event)"\n (click)="_onInputClick($event)">\n <span matRipple class="mat-checkbox-ripple mat-focus-indicator"\n [matRippleTrigger]="label"\n [matRippleDisabled]="_isRippleDisabled()"\n [matRippleRadius]="20"\n [matRippleCentered]="true"\n [matRippleAnimation]="{enterDuration: 150}">\n <span class="mat-ripple-element mat-checkbox-persistent-ripple"></span>\n </span>\n <span class="mat-checkbox-frame"></span>\n <span class="mat-checkbox-background">\n <svg version="1.1"\n focusable="false"\n class="mat-checkbox-checkmark"\n viewBox="0 0 24 24"\n xml:space="preserve">\n <path class="mat-checkbox-checkmark-path"\n fill="none"\n stroke="white"\n d="M4.1,12.7 9,17.6 20.3,6.3"/>\n </svg>\n \x3c!-- Element for rendering the indeterminate state checkbox. --\x3e\n <span class="mat-checkbox-mixedmark"></span>\n </span>\n </span>\n <span class="mat-checkbox-label" #checkboxLabel (cdkObserveContent)="_onLabelTextChange()">\n \x3c!-- Add an invisible span so JAWS can read the label --\x3e\n <span style="display:none"> </span>\n <ng-content></ng-content>\n </span>\n</label>\n',exportAs:"matCheckbox",host:{class:"mat-checkbox","[id]":"id","[attr.tabindex]":"null","[class.mat-checkbox-indeterminate]":"indeterminate","[class.mat-checkbox-checked]":"checked","[class.mat-checkbox-disabled]":"disabled","[class.mat-checkbox-label-before]":'labelPosition == "before"',"[class._mat-animation-noopable]":"_animationMode === 'NoopAnimations'"},providers:[p],inputs:["disableRipple","color","tabIndex"],encapsulation:a.ViewEncapsulation.None,changeDetection:a.ChangeDetectionStrategy.OnPush,styles:["@keyframes mat-checkbox-fade-in-background{0%{opacity:0}50%{opacity:1}}@keyframes mat-checkbox-fade-out-background{0%,50%{opacity:1}100%{opacity:0}}@keyframes mat-checkbox-unchecked-checked-checkmark-path{0%,50%{stroke-dashoffset:22.910259}50%{animation-timing-function:cubic-bezier(0, 0, 0.2, 0.1)}100%{stroke-dashoffset:0}}@keyframes mat-checkbox-unchecked-indeterminate-mixedmark{0%,68.2%{transform:scaleX(0)}68.2%{animation-timing-function:cubic-bezier(0, 0, 0, 1)}100%{transform:scaleX(1)}}@keyframes mat-checkbox-checked-unchecked-checkmark-path{from{animation-timing-function:cubic-bezier(0.4, 0, 1, 1);stroke-dashoffset:0}to{stroke-dashoffset:-22.910259}}@keyframes mat-checkbox-checked-indeterminate-checkmark{from{animation-timing-function:cubic-bezier(0, 0, 0.2, 0.1);opacity:1;transform:rotate(0deg)}to{opacity:0;transform:rotate(45deg)}}@keyframes mat-checkbox-indeterminate-checked-checkmark{from{animation-timing-function:cubic-bezier(0.14, 0, 0, 1);opacity:0;transform:rotate(45deg)}to{opacity:1;transform:rotate(360deg)}}@keyframes mat-checkbox-checked-indeterminate-mixedmark{from{animation-timing-function:cubic-bezier(0, 0, 0.2, 0.1);opacity:0;transform:rotate(-45deg)}to{opacity:1;transform:rotate(0deg)}}@keyframes mat-checkbox-indeterminate-checked-mixedmark{from{animation-timing-function:cubic-bezier(0.14, 0, 0, 1);opacity:1;transform:rotate(0deg)}to{opacity:0;transform:rotate(315deg)}}@keyframes mat-checkbox-indeterminate-unchecked-mixedmark{0%{animation-timing-function:linear;opacity:1;transform:scaleX(1)}32.8%,100%{opacity:0;transform:scaleX(0)}}.mat-checkbox-background,.mat-checkbox-frame{top:0;left:0;right:0;bottom:0;position:absolute;border-radius:2px;box-sizing:border-box;pointer-events:none}.mat-checkbox{display:inline-block;transition:background 400ms cubic-bezier(0.25, 0.8, 0.25, 1),box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);cursor:pointer;-webkit-tap-highlight-color:transparent}._mat-animation-noopable.mat-checkbox{transition:none;animation:none}.mat-checkbox .mat-ripple-element:not(.mat-checkbox-persistent-ripple){opacity:.16}.mat-checkbox-layout{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:inherit;align-items:baseline;vertical-align:middle;display:inline-flex;white-space:nowrap}.mat-checkbox-label{-webkit-user-select:auto;-moz-user-select:auto;-ms-user-select:auto;user-select:auto}.mat-checkbox-inner-container{display:inline-block;height:16px;line-height:0;margin:auto;margin-right:8px;order:0;position:relative;vertical-align:middle;white-space:nowrap;width:16px;flex-shrink:0}[dir=rtl] .mat-checkbox-inner-container{margin-left:8px;margin-right:auto}.mat-checkbox-inner-container-no-side-margin{margin-left:0;margin-right:0}.mat-checkbox-frame{background-color:transparent;transition:border-color 90ms cubic-bezier(0, 0, 0.2, 0.1);border-width:2px;border-style:solid}._mat-animation-noopable .mat-checkbox-frame{transition:none}.cdk-high-contrast-active .mat-checkbox.cdk-keyboard-focused .mat-checkbox-frame{border-style:dotted}.mat-checkbox-background{align-items:center;display:inline-flex;justify-content:center;transition:background-color 90ms cubic-bezier(0, 0, 0.2, 0.1),opacity 90ms cubic-bezier(0, 0, 0.2, 0.1)}._mat-animation-noopable .mat-checkbox-background{transition:none}.cdk-high-contrast-active .mat-checkbox .mat-checkbox-background{background:none}.mat-checkbox-persistent-ripple{display:block;width:100%;height:100%;transform:none}.mat-checkbox-inner-container:hover .mat-checkbox-persistent-ripple{opacity:.04}.mat-checkbox.cdk-keyboard-focused .mat-checkbox-persistent-ripple{opacity:.12}.mat-checkbox-persistent-ripple,.mat-checkbox.mat-checkbox-disabled .mat-checkbox-inner-container:hover .mat-checkbox-persistent-ripple{opacity:0}@media(hover: none){.mat-checkbox-inner-container:hover .mat-checkbox-persistent-ripple{display:none}}.mat-checkbox-checkmark{top:0;left:0;right:0;bottom:0;position:absolute;width:100%}.mat-checkbox-checkmark-path{stroke-dashoffset:22.910259;stroke-dasharray:22.910259;stroke-width:2.1333333333px}.cdk-high-contrast-black-on-white .mat-checkbox-checkmark-path{stroke:#000 !important}.mat-checkbox-mixedmark{width:calc(100% - 6px);height:2px;opacity:0;transform:scaleX(0) rotate(0deg);border-radius:2px}.cdk-high-contrast-active .mat-checkbox-mixedmark{height:0;border-top:solid 2px;margin-top:2px}.mat-checkbox-label-before .mat-checkbox-inner-container{order:1;margin-left:8px;margin-right:auto}[dir=rtl] .mat-checkbox-label-before .mat-checkbox-inner-container{margin-left:auto;margin-right:8px}.mat-checkbox-checked .mat-checkbox-checkmark{opacity:1}.mat-checkbox-checked .mat-checkbox-checkmark-path{stroke-dashoffset:0}.mat-checkbox-checked .mat-checkbox-mixedmark{transform:scaleX(1) rotate(-45deg)}.mat-checkbox-indeterminate .mat-checkbox-checkmark{opacity:0;transform:rotate(45deg)}.mat-checkbox-indeterminate .mat-checkbox-checkmark-path{stroke-dashoffset:0}.mat-checkbox-indeterminate .mat-checkbox-mixedmark{opacity:1;transform:scaleX(1) rotate(0deg)}.mat-checkbox-unchecked .mat-checkbox-background{background-color:transparent}.mat-checkbox-disabled{cursor:default}.cdk-high-contrast-active .mat-checkbox-disabled{opacity:.5}.mat-checkbox-anim-unchecked-checked .mat-checkbox-background{animation:180ms linear 0ms mat-checkbox-fade-in-background}.mat-checkbox-anim-unchecked-checked .mat-checkbox-checkmark-path{animation:180ms linear 0ms mat-checkbox-unchecked-checked-checkmark-path}.mat-checkbox-anim-unchecked-indeterminate .mat-checkbox-background{animation:180ms linear 0ms mat-checkbox-fade-in-background}.mat-checkbox-anim-unchecked-indeterminate .mat-checkbox-mixedmark{animation:90ms linear 0ms mat-checkbox-unchecked-indeterminate-mixedmark}.mat-checkbox-anim-checked-unchecked .mat-checkbox-background{animation:180ms linear 0ms mat-checkbox-fade-out-background}.mat-checkbox-anim-checked-unchecked .mat-checkbox-checkmark-path{animation:90ms linear 0ms mat-checkbox-checked-unchecked-checkmark-path}.mat-checkbox-anim-checked-indeterminate .mat-checkbox-checkmark{animation:90ms linear 0ms mat-checkbox-checked-indeterminate-checkmark}.mat-checkbox-anim-checked-indeterminate .mat-checkbox-mixedmark{animation:90ms linear 0ms mat-checkbox-checked-indeterminate-mixedmark}.mat-checkbox-anim-indeterminate-checked .mat-checkbox-checkmark{animation:500ms linear 0ms mat-checkbox-indeterminate-checked-checkmark}.mat-checkbox-anim-indeterminate-checked .mat-checkbox-mixedmark{animation:500ms linear 0ms mat-checkbox-indeterminate-checked-mixedmark}.mat-checkbox-anim-indeterminate-unchecked .mat-checkbox-background{animation:180ms linear 0ms mat-checkbox-fade-out-background}.mat-checkbox-anim-indeterminate-unchecked .mat-checkbox-mixedmark{animation:300ms linear 0ms mat-checkbox-indeterminate-unchecked-mixedmark}.mat-checkbox-input{bottom:0;left:50%}.mat-checkbox .mat-checkbox-ripple{position:absolute;left:calc(50% - 20px);top:calc(50% - 20px);height:40px;width:40px;z-index:1;pointer-events:none}\n"]}]}],u.ctorParameters=function(){return[{type:a.ElementRef},{type:a.ChangeDetectorRef},{type:t.FocusMonitor},{type:a.NgZone},{type:String,decorators:[{type:a.Attribute,args:["tabindex"]}]},{type:String,decorators:[{type:a.Optional},{type:a.Inject,args:[o.ANIMATION_MODULE_TYPE]}]},{type:void 0,decorators:[{type:a.Optional},{type:a.Inject,args:[h]}]}]},u.propDecorators={ariaLabel:[{type:a.Input,args:["aria-label"]}],ariaLabelledby:[{type:a.Input,args:["aria-labelledby"]}],ariaDescribedby:[{type:a.Input,args:["aria-describedby"]}],id:[{type:a.Input}],required:[{type:a.Input}],labelPosition:[{type:a.Input}],name:[{type:a.Input}],change:[{type:a.Output}],indeterminateChange:[{type:a.Output}],value:[{type:a.Input}],_inputElement:[{type:a.ViewChild,args:["input"]}],ripple:[{type:a.ViewChild,args:[c.MatRipple]}],checked:[{type:a.Input}],disabled:[{type:a.Input}],indeterminate:[{type:a.Input}]};var f,g,y={provide:i.NG_VALIDATORS,useExisting:a.forwardRef((function(){return _})),multi:!0},_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(t,e),t}(i.CheckboxRequiredValidator);_.decorators=[{type:a.Directive,args:[{selector:"mat-checkbox[required][formControlName],\n mat-checkbox[required][formControl], mat-checkbox[required][ngModel]",providers:[y]}]}],(f=function f(){}).decorators=[{type:a.NgModule,args:[{exports:[_],declarations:[_]}]}],(g=function g(){}).decorators=[{type:a.NgModule,args:[{imports:[c.MatRippleModule,c.MatCommonModule,r.ObserversModule,f],exports:[u,c.MatCommonModule,f],declarations:[u]}]}],
/**
* @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_CHECKBOX_CONTROL_VALUE_ACCESSOR=p,e.MAT_CHECKBOX_DEFAULT_OPTIONS=h,e.MAT_CHECKBOX_DEFAULT_OPTIONS_FACTORY=d,e.MAT_CHECKBOX_REQUIRED_VALIDATOR=y,e.MatCheckbox=u,e.MatCheckboxChange=b,e.MatCheckboxModule=g,e.MatCheckboxRequiredValidator=_,e._MatCheckboxRequiredValidatorModule=f,Object.defineProperty(e,"__esModule",{value:!0})}));