@angular/material
Version:
Angular Material
23 lines • 18.9 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("tslib"),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"),require("@angular/common")):"function"==typeof define&&define.amd?define("@angular/material/checkbox",["exports","tslib","@angular/cdk/a11y","@angular/cdk/coercion","@angular/core","@angular/forms","@angular/material/core","@angular/platform-browser/animations","@angular/cdk/observers","@angular/common"],t):t(((e=e||self).ng=e.ng||{},e.ng.material=e.ng.material||{},e.ng.material.checkbox={}),e.tslib,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,e.ng.common)}(this,(function(e,t,n,a,i,c,o,r,s,m){"use strict";
/**
* @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 i.InjectionToken("mat-checkbox-default-options",{providedIn:"root",factory:d});function d(){return{color:"accent",clickAction:"check-indeterminate"}}var k,l=new i.InjectionToken("mat-checkbox-click-action"),b=0,u={provide:c.NG_VALUE_ACCESSOR,useExisting:i.forwardRef((function(){return x})),multi:!0};
/**
* @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
*/(k=e.TransitionCheckState||(e.TransitionCheckState={}))[k.Init=0]="Init",k[k.Checked=1]="Checked",k[k.Unchecked=2]="Unchecked",k[k.Indeterminate=3]="Indeterminate";var p=function p(){},x=function(c){function s(t,n,a,o,r,s,m,h){var d=c.call(this,t)||this;return d._changeDetectorRef=n,d._focusMonitor=a,d._ngZone=o,d._clickAction=s,d._animationMode=m,d._options=h,d.ariaLabel="",d.ariaLabelledby=null,d._uniqueId="mat-checkbox-"+ ++b,d.id=d._uniqueId,d.labelPosition="after",d.name=null,d.change=new i.EventEmitter,d.indeterminateChange=new i.EventEmitter,d._onTouched=function(){},d._currentAnimationClass="",d._currentCheckState=e.TransitionCheckState.Init,d._controlValueAccessorChangeFn=function(){},d._checked=!1,d._disabled=!1,d._indeterminate=!1,d._options=d._options||{},d._options.color&&(d.color=d._options.color),d.tabIndex=parseInt(r)||0,d._focusMonitor.monitor(t,!0).subscribe((function(e){e||Promise.resolve().then((function(){d._onTouched(),n.markForCheck()}))})),d._clickAction=d._clickAction||d._options.clickAction,d}return t.__extends(s,c),Object.defineProperty(s.prototype,"inputId",{get:function(){return(this.id||this._uniqueId)+"-input"},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"required",{get:function(){return this._required},set:function(e){this._required=a.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),s.prototype.ngAfterViewInit=function(){this._syncIndeterminate(this._indeterminate)},s.prototype.ngAfterViewChecked=function(){},s.prototype.ngOnDestroy=function(){this._focusMonitor.stopMonitoring(this._elementRef)},Object.defineProperty(s.prototype,"checked",{get:function(){return this._checked},set:function(e){e!=this.checked&&(this._checked=e,this._changeDetectorRef.markForCheck())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"disabled",{get:function(){return this._disabled},set:function(e){var t=a.coerceBooleanProperty(e);t!==this.disabled&&(this._disabled=t,this._changeDetectorRef.markForCheck())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"indeterminate",{get:function(){return this._indeterminate},set:function(t){var n=t!=this._indeterminate;this._indeterminate=a.coerceBooleanProperty(t),n&&(this._transitionCheckState(this._indeterminate?e.TransitionCheckState.Indeterminate:this.checked?e.TransitionCheckState.Checked:e.TransitionCheckState.Unchecked),this.indeterminateChange.emit(this._indeterminate)),this._syncIndeterminate(this._indeterminate)},enumerable:!0,configurable:!0}),s.prototype._isRippleDisabled=function(){return this.disableRipple||this.disabled},s.prototype._onLabelTextChange=function(){this._changeDetectorRef.detectChanges()},s.prototype.writeValue=function(e){this.checked=!!e},s.prototype.registerOnChange=function(e){this._controlValueAccessorChangeFn=e},s.prototype.registerOnTouched=function(e){this._onTouched=e},s.prototype.setDisabledState=function(e){this.disabled=e},s.prototype._getAriaChecked=function(){return this.checked?"true":this.indeterminate?"mixed":"false"},s.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)}))}},s.prototype._emitChangeEvent=function(){var e=new p;e.source=this,e.checked=this.checked,this._controlValueAccessorChangeFn(this.checked),this.change.emit(e)},s.prototype.toggle=function(){this.checked=!this.checked},s.prototype._onInputClick=function(t){var n=this;t.stopPropagation(),this.disabled||"noop"===this._clickAction?this.disabled||"noop"!==this._clickAction||(this._inputElement.nativeElement.checked=this.checked,this._inputElement.nativeElement.indeterminate=this.indeterminate):(this.indeterminate&&"check"!==this._clickAction&&Promise.resolve().then((function(){n._indeterminate=!1,n.indeterminateChange.emit(n._indeterminate)})),this.toggle(),this._transitionCheckState(this._checked?e.TransitionCheckState.Checked:e.TransitionCheckState.Unchecked),this._emitChangeEvent())},s.prototype.focus=function(e,t){void 0===e&&(e="keyboard"),this._focusMonitor.focusVia(this._inputElement,e,t)},s.prototype._onInteractionEvent=function(e){e.stopPropagation()},s.prototype._getAnimationClassForCheckStateTransition=function(t,n){if("NoopAnimations"===this._animationMode)return"";var a="";switch(t){case e.TransitionCheckState.Init:if(n===e.TransitionCheckState.Checked)a="unchecked-checked";else{if(n!=e.TransitionCheckState.Indeterminate)return"";a="unchecked-indeterminate"}break;case e.TransitionCheckState.Unchecked:a=n===e.TransitionCheckState.Checked?"unchecked-checked":"unchecked-indeterminate";break;case e.TransitionCheckState.Checked:a=n===e.TransitionCheckState.Unchecked?"checked-unchecked":"checked-indeterminate";break;case e.TransitionCheckState.Indeterminate:a=n===e.TransitionCheckState.Checked?"indeterminate-checked":"indeterminate-unchecked"}return"mat-checkbox-anim-"+a},s.prototype._syncIndeterminate=function(e){var t=this._inputElement;t&&(t.nativeElement.indeterminate=e)},s.decorators=[{type:i.Component,args:[{selector:"mat-checkbox",template:'<label [attr.for]="inputId" class="mat-checkbox-layout" #label>\n <div 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 (change)="_onInteractionEvent($event)"\n (click)="_onInputClick($event)">\n <div matRipple class="mat-checkbox-ripple"\n [matRippleTrigger]="label"\n [matRippleDisabled]="_isRippleDisabled()"\n [matRippleRadius]="20"\n [matRippleCentered]="true"\n [matRippleAnimation]="{enterDuration: 150}">\n <div class="mat-ripple-element mat-checkbox-persistent-ripple"></div>\n </div>\n <div class="mat-checkbox-frame"></div>\n <div 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 <div class="mat-checkbox-mixedmark"></div>\n </div>\n </div>\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:[u],inputs:["disableRipple","color","tabIndex"],encapsulation:i.ViewEncapsulation.None,changeDetection:i.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{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}.mat-checkbox.cdk-keyboard-focused .cdk-high-contrast-active .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{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"]}]}],s.ctorParameters=function(){return[{type:i.ElementRef},{type:i.ChangeDetectorRef},{type:n.FocusMonitor},{type:i.NgZone},{type:String,decorators:[{type:i.Attribute,args:["tabindex"]}]},{type:void 0,decorators:[{type:i.Optional},{type:i.Inject,args:[l]}]},{type:String,decorators:[{type:i.Optional},{type:i.Inject,args:[r.ANIMATION_MODULE_TYPE]}]},{type:void 0,decorators:[{type:i.Optional},{type:i.Inject,args:[h]}]}]},s.propDecorators={ariaLabel:[{type:i.Input,args:["aria-label"]}],ariaLabelledby:[{type:i.Input,args:["aria-labelledby"]}],id:[{type:i.Input}],required:[{type:i.Input}],labelPosition:[{type:i.Input}],name:[{type:i.Input}],change:[{type:i.Output}],indeterminateChange:[{type:i.Output}],value:[{type:i.Input}],_inputElement:[{type:i.ViewChild,args:["input"]}],ripple:[{type:i.ViewChild,args:[o.MatRipple]}],checked:[{type:i.Input}],disabled:[{type:i.Input}],indeterminate:[{type:i.Input}]},s}(o.mixinTabIndex(o.mixinColor(o.mixinDisableRipple(o.mixinDisabled((function f(e){this._elementRef=e})))))),g={provide:c.NG_VALIDATORS,useExisting:i.forwardRef((function(){return y})),multi:!0},y=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(n,e),n.decorators=[{type:i.Directive,args:[{selector:"mat-checkbox[required][formControlName],\n mat-checkbox[required][formControl], mat-checkbox[required][ngModel]",providers:[g]}]}],n}(c.CheckboxRequiredValidator),_=function(){function e(){}return e.decorators=[{type:i.NgModule,args:[{exports:[y],declarations:[y]}]}],e}(),C=function(){function e(){}return e.decorators=[{type:i.NgModule,args:[{imports:[m.CommonModule,o.MatRippleModule,o.MatCommonModule,s.ObserversModule,_],exports:[x,o.MatCommonModule,_],declarations:[x]}]}],e}();
/**
* @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_CLICK_ACTION=l,e.MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR=u,e.MAT_CHECKBOX_DEFAULT_OPTIONS=h,e.MAT_CHECKBOX_DEFAULT_OPTIONS_FACTORY=d,e.MAT_CHECKBOX_REQUIRED_VALIDATOR=g,e.MatCheckbox=x,e.MatCheckboxChange=p,e.MatCheckboxModule=C,e.MatCheckboxRequiredValidator=y,e._MatCheckboxRequiredValidatorModule=_,Object.defineProperty(e,"__esModule",{value:!0})}));