ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
16 lines (14 loc) • 8.43 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/a11y"),require("@angular/core"),require("@angular/forms"),require("ng-zorro-antd/core/util"),require("@angular/common")):"function"==typeof define&&define.amd?define("ng-zorro-antd/checkbox",["exports","@angular/cdk/a11y","@angular/core","@angular/forms","ng-zorro-antd/core/util","@angular/common"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self)["ng-zorro-antd"]=e["ng-zorro-antd"]||{},e["ng-zorro-antd"].checkbox={}),e.ng.cdk.a11y,e.ng.core,e.ng.forms,e["ng-zorro-antd"].core.util,e.ng.common)}(this,(function(e,t,n,o,r,i){"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.
***************************************************************************** */function c(e,t,n,o){var r,i=arguments.length,c=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,n,o);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(c=(i<3?r(c):i>3?r(t,n,c):r(t,n))||c);return i>3&&c&&Object.defineProperty(t,n,c),c}function s(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}Object.create;Object.create;var a=function(){function e(e,t){this.nzOnChange=new n.EventEmitter,this.checkboxList=[],e.addClass(t.nativeElement,"ant-checkbox-group")}return e.prototype.addCheckbox=function(e){this.checkboxList.push(e)},e.prototype.removeCheckbox=function(e){this.checkboxList.splice(this.checkboxList.indexOf(e),1)},e.prototype.onChange=function(){var e=this.checkboxList.filter((function(e){return e.nzChecked})).map((function(e){return e.nzValue}));this.nzOnChange.emit(e)},e}();a.decorators=[{type:n.Component,args:[{selector:"nz-checkbox-wrapper",exportAs:"nzCheckboxWrapper",preserveWhitespaces:!1,changeDetection:n.ChangeDetectionStrategy.OnPush,encapsulation:n.ViewEncapsulation.None,template:" <ng-content></ng-content> "}]}],a.ctorParameters=function(){return[{type:n.Renderer2},{type:n.ElementRef}]},a.propDecorators={nzOnChange:[{type:n.Output}]};var p=function(){function e(e,t,o,r){this.elementRef=e,this.nzCheckboxWrapperComponent=t,this.cdr=o,this.focusMonitor=r,this.onChange=function(){},this.onTouched=function(){},this.nzCheckedChange=new n.EventEmitter,this.nzValue=null,this.nzAutoFocus=!1,this.nzDisabled=!1,this.nzIndeterminate=!1,this.nzChecked=!1,this.elementRef.nativeElement.classList.add("ant-checkbox-wrapper")}return e.prototype.hostClick=function(e){e.preventDefault(),this.focus(),this.innerCheckedChange(!this.nzChecked)},e.prototype.innerCheckedChange=function(e){this.nzDisabled||(this.nzChecked=e,this.onChange(this.nzChecked),this.nzCheckedChange.emit(this.nzChecked),this.nzCheckboxWrapperComponent&&this.nzCheckboxWrapperComponent.onChange())},e.prototype.writeValue=function(e){this.nzChecked=e,this.cdr.markForCheck()},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e.prototype.setDisabledState=function(e){this.nzDisabled=e,this.cdr.markForCheck()},e.prototype.focus=function(){this.focusMonitor.focusVia(this.inputElement,"keyboard")},e.prototype.blur=function(){this.inputElement.nativeElement.blur()},e.prototype.ngOnInit=function(){var e=this;this.focusMonitor.monitor(this.elementRef,!0).subscribe((function(t){t||Promise.resolve().then((function(){return e.onTouched()}))})),this.nzCheckboxWrapperComponent&&this.nzCheckboxWrapperComponent.addCheckbox(this)},e.prototype.ngAfterViewInit=function(){this.nzAutoFocus&&this.focus()},e.prototype.ngOnDestroy=function(){this.focusMonitor.stopMonitoring(this.elementRef),this.nzCheckboxWrapperComponent&&this.nzCheckboxWrapperComponent.removeCheckbox(this)},e}();p.decorators=[{type:n.Component,args:[{selector:"[nz-checkbox]",exportAs:"nzCheckbox",preserveWhitespaces:!1,changeDetection:n.ChangeDetectionStrategy.OnPush,encapsulation:n.ViewEncapsulation.None,template:'\n <span\n class="ant-checkbox"\n [class.ant-checkbox-checked]="nzChecked && !nzIndeterminate"\n [class.ant-checkbox-disabled]="nzDisabled"\n [class.ant-checkbox-indeterminate]="nzIndeterminate"\n >\n <input\n #inputElement\n type="checkbox"\n class="ant-checkbox-input"\n [attr.autofocus]="nzAutoFocus ? \'autofocus\' : null"\n [checked]="nzChecked"\n [ngModel]="nzChecked"\n [disabled]="nzDisabled"\n (ngModelChange)="innerCheckedChange($event)"\n (click)="$event.stopPropagation()"\n />\n <span class="ant-checkbox-inner"></span>\n </span>\n <span><ng-content></ng-content></span>\n ',providers:[{provide:o.NG_VALUE_ACCESSOR,useExisting:n.forwardRef((function(){return p})),multi:!0}],host:{"[class.ant-checkbox-wrapper-checked]":"nzChecked","(click)":"hostClick($event)"}}]}],p.ctorParameters=function(){return[{type:n.ElementRef},{type:a,decorators:[{type:n.Optional}]},{type:n.ChangeDetectorRef},{type:t.FocusMonitor}]},p.propDecorators={inputElement:[{type:n.ViewChild,args:["inputElement",{static:!0}]}],nzCheckedChange:[{type:n.Output}],nzValue:[{type:n.Input}],nzAutoFocus:[{type:n.Input}],nzDisabled:[{type:n.Input}],nzIndeterminate:[{type:n.Input}],nzChecked:[{type:n.Input}]},c([r.InputBoolean(),s("design:type",Object)],p.prototype,"nzAutoFocus",void 0),c([r.InputBoolean(),s("design:type",Object)],p.prototype,"nzDisabled",void 0),c([r.InputBoolean(),s("design:type",Object)],p.prototype,"nzIndeterminate",void 0),c([r.InputBoolean(),s("design:type",Object)],p.prototype,"nzChecked",void 0);var h=function(){function e(e,t,n){this.elementRef=e,this.focusMonitor=t,this.cdr=n,this.onChange=function(){},this.onTouched=function(){},this.options=[],this.nzDisabled=!1,this.elementRef.nativeElement.classList.add("ant-checkbox-group")}return e.prototype.trackByOption=function(e,t){return t.value},e.prototype.onCheckedChange=function(e,t){e.checked=t,this.onChange(this.options)},e.prototype.ngOnInit=function(){var e=this;this.focusMonitor.monitor(this.elementRef,!0).subscribe((function(t){t||Promise.resolve().then((function(){return e.onTouched()}))}))},e.prototype.ngOnDestroy=function(){this.focusMonitor.stopMonitoring(this.elementRef)},e.prototype.writeValue=function(e){this.options=e,this.cdr.markForCheck()},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e.prototype.setDisabledState=function(e){this.nzDisabled=e,this.cdr.markForCheck()},e}();h.decorators=[{type:n.Component,args:[{selector:"nz-checkbox-group",exportAs:"nzCheckboxGroup",preserveWhitespaces:!1,encapsulation:n.ViewEncapsulation.None,template:'\n <label\n nz-checkbox\n class="ant-checkbox-group-item"\n *ngFor="let o of options; trackBy: trackByOption"\n [nzDisabled]="o.disabled || nzDisabled"\n [nzChecked]="o.checked!"\n (nzCheckedChange)="onCheckedChange(o, $event)"\n >\n <span>{{ o.label }}</span>\n </label>\n ',providers:[{provide:o.NG_VALUE_ACCESSOR,useExisting:n.forwardRef((function(){return h})),multi:!0}]}]}],h.ctorParameters=function(){return[{type:n.ElementRef},{type:t.FocusMonitor},{type:n.ChangeDetectorRef}]},h.propDecorators={nzDisabled:[{type:n.Input}]},c([r.InputBoolean(),s("design:type",Object)],h.prototype,"nzDisabled",void 0);var u=function(){};u.decorators=[{type:n.NgModule,args:[{imports:[i.CommonModule,o.FormsModule,t.A11yModule],declarations:[p,h,a],exports:[p,h,a]}]}],e.NzCheckboxComponent=p,e.NzCheckboxGroupComponent=h,e.NzCheckboxModule=u,e.NzCheckboxWrapperComponent=a,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=ng-zorro-antd-checkbox.umd.min.js.map