UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

16 lines (14 loc) 9.4 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/a11y"),require("@angular/cdk/bidi"),require("@angular/core"),require("@angular/forms"),require("ng-zorro-antd/core/util"),require("rxjs"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define("ng-zorro-antd/checkbox",["exports","@angular/cdk/a11y","@angular/cdk/bidi","@angular/core","@angular/forms","ng-zorro-antd/core/util","rxjs","rxjs/operators","@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.cdk.bidi,e.ng.core,e.ng.forms,e["ng-zorro-antd"].core.util,e.rxjs,e.rxjs.operators,e.ng.common)}(this,(function(e,t,n,o,i,r,c,s,a){"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 p(e,t,n,o){var i,r=arguments.length,c=r<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--)(i=e[s])&&(c=(r<3?i(c):r>3?i(t,n,c):i(t,n))||c);return r>3&&c&&Object.defineProperty(t,n,c),c}function h(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}Object.create;Object.create;var u=function(){function e(e,t){this.nzOnChange=new o.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}();u.decorators=[{type:o.Component,args:[{selector:"nz-checkbox-wrapper",exportAs:"nzCheckboxWrapper",preserveWhitespaces:!1,changeDetection:o.ChangeDetectionStrategy.OnPush,encapsulation:o.ViewEncapsulation.None,template:"\n <ng-content></ng-content>\n "}]}],u.ctorParameters=function(){return[{type:o.Renderer2},{type:o.ElementRef}]},u.propDecorators={nzOnChange:[{type:o.Output}]};var d=function(){function e(e,t,n,i,r){this.elementRef=e,this.nzCheckboxWrapperComponent=t,this.cdr=n,this.focusMonitor=i,this.directionality=r,this.dir="ltr",this.destroy$=new c.Subject,this.onChange=function(){},this.onTouched=function(){},this.nzCheckedChange=new o.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,t=this;this.focusMonitor.monitor(this.elementRef,!0).subscribe((function(e){e||Promise.resolve().then((function(){return t.onTouched()}))})),this.nzCheckboxWrapperComponent&&this.nzCheckboxWrapperComponent.addCheckbox(this),null===(e=this.directionality.change)||void 0===e||e.pipe(s.takeUntil(this.destroy$)).subscribe((function(e){t.dir=e,t.cdr.detectChanges()})),this.dir=this.directionality.value},e.prototype.ngAfterViewInit=function(){this.nzAutoFocus&&this.focus()},e.prototype.ngOnDestroy=function(){this.focusMonitor.stopMonitoring(this.elementRef),this.nzCheckboxWrapperComponent&&this.nzCheckboxWrapperComponent.removeCheckbox(this),this.destroy$.next(),this.destroy$.complete()},e}();d.decorators=[{type:o.Component,args:[{selector:"[nz-checkbox]",exportAs:"nzCheckbox",preserveWhitespaces:!1,changeDetection:o.ChangeDetectionStrategy.OnPush,encapsulation:o.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:i.NG_VALUE_ACCESSOR,useExisting:o.forwardRef((function(){return d})),multi:!0}],host:{"[class.ant-checkbox-wrapper-checked]":"nzChecked","[class.ant-checkbox-rtl]":"dir === 'rtl'","(click)":"hostClick($event)"}}]}],d.ctorParameters=function(){return[{type:o.ElementRef},{type:u,decorators:[{type:o.Optional}]},{type:o.ChangeDetectorRef},{type:t.FocusMonitor},{type:n.Directionality,decorators:[{type:o.Optional}]}]},d.propDecorators={inputElement:[{type:o.ViewChild,args:["inputElement",{static:!0}]}],nzCheckedChange:[{type:o.Output}],nzValue:[{type:o.Input}],nzAutoFocus:[{type:o.Input}],nzDisabled:[{type:o.Input}],nzIndeterminate:[{type:o.Input}],nzChecked:[{type:o.Input}]},p([r.InputBoolean(),h("design:type",Object)],d.prototype,"nzAutoFocus",void 0),p([r.InputBoolean(),h("design:type",Object)],d.prototype,"nzDisabled",void 0),p([r.InputBoolean(),h("design:type",Object)],d.prototype,"nzIndeterminate",void 0),p([r.InputBoolean(),h("design:type",Object)],d.prototype,"nzChecked",void 0);var l=function(){function e(e,t,n,o){this.elementRef=e,this.focusMonitor=t,this.cdr=n,this.directionality=o,this.onChange=function(){},this.onTouched=function(){},this.options=[],this.nzDisabled=!1,this.dir="ltr",this.destroy$=new c.Subject,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,t=this;this.focusMonitor.monitor(this.elementRef,!0).subscribe((function(e){e||Promise.resolve().then((function(){return t.onTouched()}))})),null===(e=this.directionality.change)||void 0===e||e.pipe(s.takeUntil(this.destroy$)).subscribe((function(e){t.dir=e,t.cdr.detectChanges()})),this.dir=this.directionality.value},e.prototype.ngOnDestroy=function(){this.focusMonitor.stopMonitoring(this.elementRef),this.destroy$.next(),this.destroy$.complete()},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}();l.decorators=[{type:o.Component,args:[{selector:"nz-checkbox-group",exportAs:"nzCheckboxGroup",preserveWhitespaces:!1,encapsulation:o.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:i.NG_VALUE_ACCESSOR,useExisting:o.forwardRef((function(){return l})),multi:!0}],host:{"[class.ant-checkbox-group-rtl]":"dir === 'rtl'"}}]}],l.ctorParameters=function(){return[{type:o.ElementRef},{type:t.FocusMonitor},{type:o.ChangeDetectorRef},{type:n.Directionality,decorators:[{type:o.Optional}]}]},l.propDecorators={nzDisabled:[{type:o.Input}]},p([r.InputBoolean(),h("design:type",Object)],l.prototype,"nzDisabled",void 0);var f=function(){};f.decorators=[{type:o.NgModule,args:[{imports:[n.BidiModule,a.CommonModule,i.FormsModule,t.A11yModule],declarations:[d,l,u],exports:[d,l,u]}]}],e.NzCheckboxComponent=d,e.NzCheckboxGroupComponent=l,e.NzCheckboxModule=f,e.NzCheckboxWrapperComponent=u,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=ng-zorro-antd-checkbox.umd.min.js.map