UNPKG

ng-zorro-antd

Version:

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

2 lines 12.6 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/common"),require("ng-zorro-antd/icon"),require("@angular/forms"),require("@angular/cdk/layout"),require("@angular/cdk/platform"),require("ng-zorro-antd/grid"),require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("ng-zorro-antd/core")):"function"==typeof define&&define.amd?define("ng-zorro-antd/form",["exports","@angular/common","ng-zorro-antd/icon","@angular/forms","@angular/cdk/layout","@angular/cdk/platform","ng-zorro-antd/grid","@angular/core","rxjs","rxjs/operators","ng-zorro-antd/core"],e):e((t["ng-zorro-antd"]=t["ng-zorro-antd"]||{},t["ng-zorro-antd"].form={}),t.ng.common,t["ng-zorro-antd"].icon,t.ng.forms,t.ng.cdk.layout,t.ng.cdk.platform,t["ng-zorro-antd"].grid,t.ng.core,t.rxjs,t.rxjs.operators,t["ng-zorro-antd"].core)}(this,function(t,e,n,o,r,a,s,i,l,p,c){"use strict";var u=function(t,e){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function d(t,e){function n(){this.constructor=t}u(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function h(t,e,n,o){var r,a=arguments.length,s=a<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var i=t.length-1;0<=i;i--)(r=t[i])&&(s=(a<3?r(s):3<a?r(e,n,s):r(e,n))||s);return 3<a&&s&&Object.defineProperty(e,n,s),s}function f(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}var m=(y.decorators=[{type:i.Component,args:[{selector:"nz-form-explain",exportAs:"nzFormExplain",preserveWhitespaces:!1,encapsulation:i.ViewEncapsulation.None,changeDetection:i.ChangeDetectionStrategy.OnPush,animations:[c.helpMotion],template:"<div [@helpMotion]>\n <ng-content></ng-content>\n</div>",styles:["\n nz-form-explain {\n display: block;\n }\n "]}]}],y.ctorParameters=function(){return[{type:i.ElementRef},{type:i.Renderer2}]},y);function y(t,e){this.elementRef=t,this.renderer=e,this.renderer.addClass(this.elementRef.nativeElement,"ant-form-explain")}var g,C=(d(v,g=s.NzRowDirective),v.prototype.updateFlexStyle=function(){this.nzFlex?this.renderer.setStyle(this.elementRef.nativeElement,"display","flex"):this.renderer.removeStyle(this.elementRef.nativeElement,"display")},v.prototype.ngAfterContentInit=function(){var t=this;this.listOfNzFormExplainComponent&&this.listOfNzFormExplainComponent.changes.pipe(p.takeUntil(this.destroy$)).subscribe(function(){t.cdr.markForCheck()})},v.prototype.ngOnInit=function(){g.prototype.ngOnInit.call(this),this.updateFlexStyle()},v.prototype.ngOnDestroy=function(){g.prototype.ngOnDestroy.call(this)},v.prototype.ngOnChanges=function(t){g.prototype.ngOnChanges.call(this,t),t.hasOwnProperty("nzFlex")&&this.updateFlexStyle()},v.decorators=[{type:i.Component,args:[{selector:"nz-form-item",exportAs:"nzFormItem",preserveWhitespaces:!1,changeDetection:i.ChangeDetectionStrategy.OnPush,encapsulation:i.ViewEncapsulation.None,providers:[c.NzUpdateHostClassService],template:"<ng-content></ng-content>",host:{"[class.ant-form-item-with-help]":"listOfNzFormExplainComponent && (listOfNzFormExplainComponent.length > 0)"},styles:["\n nz-form-item {\n display: block;\n }\n "]}]}],v.ctorParameters=function(){return[{type:i.ElementRef},{type:i.Renderer2},{type:c.NzUpdateHostClassService},{type:r.MediaMatcher},{type:i.NgZone},{type:a.Platform},{type:i.ChangeDetectorRef}]},v.propDecorators={nzFlex:[{type:i.Input}],listOfNzFormExplainComponent:[{type:i.ContentChildren,args:[m,{descendants:!0}]}]},h([c.InputBoolean(),f("design:type",Boolean)],v.prototype,"nzFlex",void 0),v);function v(t,e,n,o,r,a,s){var i=g.call(this,t,e,n,o,r,a)||this;return i.cdr=s,i.nzFlex=!1,e.addClass(t.nativeElement,"ant-form-item"),i}var z,N=(d(b,z=s.NzColDirective),Object.defineProperty(b.prototype,"nzHasFeedback",{get:function(){return this._hasFeedback},set:function(t){this._hasFeedback=c.toBoolean(t),this.setControlClassMap()},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"nzValidateStatus",{set:function(t){t instanceof o.FormControl||t instanceof o.NgModel?(this.validateControl=t,this.validateString=null,this.watchControl()):t instanceof o.FormControlName?(this.validateControl=t.control,this.validateString=null,this.watchControl()):(this.validateString=t,this.validateControl=null,this.setControlClassMap())},enumerable:!0,configurable:!0}),b.prototype.removeSubscribe=function(){this.validateChanges&&(this.validateChanges.unsubscribe(),this.validateChanges=null)},b.prototype.watchControl=function(){var t=this;this.removeSubscribe(),this.validateControl&&this.validateControl.statusChanges&&(this.validateChanges=this.validateControl.statusChanges.pipe(p.startWith(null)).subscribe(function(){t.setControlClassMap(),t.cdr.markForCheck()}))},b.prototype.validateControlStatus=function(t){return!!this.validateControl&&(this.validateControl.dirty||this.validateControl.touched)&&this.validateControl.status===t},b.prototype.setControlClassMap=function(){var t;"warning"===this.validateString?(this.status="warning",this.iconType="exclamation-circle-fill"):"validating"===this.validateString||"pending"===this.validateString||this.validateControlStatus("PENDING")?(this.status="validating",this.iconType="loading"):"error"===this.validateString||this.validateControlStatus("INVALID")?(this.status="error",this.iconType="close-circle-fill"):"success"===this.validateString||this.validateControlStatus("VALID")?(this.status="success",this.iconType="check-circle-fill"):(this.status="init",this.iconType=""),this.controlClassMap=((t={})["has-warning"]="warning"===this.status,t["is-validating"]="validating"===this.status,t["has-error"]="error"===this.status,t["has-success"]="success"===this.status,t["has-feedback"]=this.nzHasFeedback,t)},b.prototype.ngOnInit=function(){z.prototype.ngOnInit.call(this),this.setControlClassMap()},b.prototype.ngOnDestroy=function(){this.removeSubscribe(),z.prototype.ngOnDestroy.call(this)},b.prototype.ngAfterContentInit=function(){!this.defaultValidateControl||this.validateControl||this.validateString||(this.nzValidateStatus=this.defaultValidateControl)},b.prototype.ngAfterViewInit=function(){z.prototype.ngAfterViewInit.call(this)},b.decorators=[{type:i.Component,args:[{selector:"nz-form-control",exportAs:"nzFormControl",preserveWhitespaces:!1,encapsulation:i.ViewEncapsulation.None,changeDetection:i.ChangeDetectionStrategy.OnPush,providers:[c.NzUpdateHostClassService],template:'<div class="ant-form-item-control" [ngClass]="controlClassMap">\n <span class="ant-form-item-children">\n <ng-content></ng-content>\n <span class="ant-form-item-children-icon">\n <i *ngIf="nzHasFeedback && iconType" nz-icon [type]="iconType"></i>\n </span>\n </span>\n <ng-content select="nz-form-explain"></ng-content>\n</div>',styles:["\n nz-form-control {\n display: block;\n }\n "]}]}],b.ctorParameters=function(){return[{type:c.NzUpdateHostClassService},{type:i.ElementRef},{type:C,decorators:[{type:i.Optional},{type:i.Host}]},{type:s.NzRowDirective,decorators:[{type:i.Optional},{type:i.Host}]},{type:i.ChangeDetectorRef},{type:i.Renderer2}]},b.propDecorators={defaultValidateControl:[{type:i.ContentChild,args:[o.NgControl]}],nzHasFeedback:[{type:i.Input}],nzValidateStatus:[{type:i.Input}]},b);function b(t,e,n,o,r,a){var s=z.call(this,t,e,n||o,a)||this;return s.cdr=r,s._hasFeedback=!1,s.controlClassMap={},a.addClass(e.nativeElement,"ant-form-item-control-wrapper"),s}var x=(F.decorators=[{type:i.Component,args:[{selector:"nz-form-extra",exportAs:"nzFormExtra",template:"<ng-content></ng-content>",preserveWhitespaces:!1,encapsulation:i.ViewEncapsulation.None,changeDetection:i.ChangeDetectionStrategy.OnPush,styles:["\n nz-form-extra {\n display: block;\n }\n "]}]}],F.ctorParameters=function(){return[{type:i.ElementRef},{type:i.Renderer2}]},F);function F(t,e){this.elementRef=t,this.renderer=e,this.renderer.addClass(this.elementRef.nativeElement,"ant-form-extra")}var O,D=(d(R,O=s.NzColDirective),Object.defineProperty(R.prototype,"nzNoColon",{get:function(){return!!this.noColon},set:function(t){this.noColon=c.toBoolean(t)},enumerable:!0,configurable:!0}),R.prototype.setDefaultNoColon=function(t){this.defaultNoColon=c.toBoolean(t),this.cdr.markForCheck()},R.prototype.ngOnDestroy=function(){O.prototype.ngOnDestroy.call(this)},R.prototype.ngAfterViewInit=function(){O.prototype.ngAfterViewInit.call(this)},R.decorators=[{type:i.Component,args:[{selector:"nz-form-label",exportAs:"nzFormLabel",providers:[c.NzUpdateHostClassService],preserveWhitespaces:!1,encapsulation:i.ViewEncapsulation.None,changeDetection:i.ChangeDetectionStrategy.OnPush,template:'<label [attr.for]="nzFor"\n [class.ant-form-item-no-colon]="noColon === \'default\' ? defaultNoColon : nzNoColon"\n [class.ant-form-item-required]="nzRequired">\n <ng-content></ng-content>\n</label>'}]}],R.ctorParameters=function(){return[{type:c.NzUpdateHostClassService},{type:i.ElementRef},{type:C,decorators:[{type:i.Optional},{type:i.Host}]},{type:s.NzRowDirective,decorators:[{type:i.Optional},{type:i.Host}]},{type:i.Renderer2},{type:i.ChangeDetectorRef}]},R.propDecorators={nzFor:[{type:i.Input}],nzRequired:[{type:i.Input}],nzNoColon:[{type:i.Input}]},h([c.InputBoolean(),f("design:type",Object)],R.prototype,"nzRequired",void 0),R);function R(t,e,n,o,r,a){var s=O.call(this,t,e,n||o,r)||this;return s.cdr=a,s.nzRequired=!1,s.defaultNoColon=!1,s.noColon="default",r.addClass(e.nativeElement,"ant-form-item-label"),s}var S=(E.decorators=[{type:i.Component,args:[{selector:"nz-form-split",exportAs:"nzFormSplit",preserveWhitespaces:!1,encapsulation:i.ViewEncapsulation.None,changeDetection:i.ChangeDetectionStrategy.OnPush,template:"<ng-content></ng-content>"}]}],E.ctorParameters=function(){return[{type:i.ElementRef},{type:i.Renderer2}]},E);function E(t,e){this.elementRef=t,this.renderer=e,this.renderer.addClass(this.elementRef.nativeElement,"ant-form-split")}var I=(w.decorators=[{type:i.Component,args:[{selector:"nz-form-text",exportAs:"nzFormText",preserveWhitespaces:!1,changeDetection:i.ChangeDetectionStrategy.OnPush,encapsulation:i.ViewEncapsulation.None,template:"<ng-content></ng-content>"}]}],w.ctorParameters=function(){return[{type:i.ElementRef},{type:i.Renderer2}]},w);function w(t,e){this.elementRef=t,this.renderer=e,this.renderer.addClass(this.elementRef.nativeElement,"ant-form-text")}var P=(k.prototype.setClassMap=function(){var t;this.nzUpdateHostClassService.updateHostClass(this.elementRef.nativeElement,((t={})["ant-form-"+this.nzLayout]=this.nzLayout,t))},k.prototype.updateItemsDefaultColon=function(){var e=this;this.nzFormLabelComponent&&this.nzFormLabelComponent.forEach(function(t){return t.setDefaultNoColon(e.nzNoColon)})},k.prototype.ngOnInit=function(){this.setClassMap()},k.prototype.ngOnChanges=function(t){this.setClassMap(),t.hasOwnProperty("nzNoColon")&&this.updateItemsDefaultColon()},k.prototype.ngAfterContentInit=function(){var t=this;this.nzFormLabelComponent.changes.pipe(p.startWith(null),p.takeUntil(this.destroy$)).subscribe(function(){t.updateItemsDefaultColon()})},k.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},k.decorators=[{type:i.Directive,args:[{selector:"[nz-form]",exportAs:"nzForm",providers:[c.NzUpdateHostClassService]}]}],k.ctorParameters=function(){return[{type:i.ElementRef},{type:i.Renderer2},{type:c.NzUpdateHostClassService}]},k.propDecorators={nzLayout:[{type:i.Input}],nzNoColon:[{type:i.Input}],nzFormLabelComponent:[{type:i.ContentChildren,args:[D,{descendants:!0}]}]},h([c.InputBoolean(),f("design:type",Boolean)],k.prototype,"nzNoColon",void 0),k);function k(t,e,n){this.elementRef=t,this.renderer=e,this.nzUpdateHostClassService=n,this.nzLayout="horizontal",this.nzNoColon=!1,this.destroy$=new l.Subject,this.renderer.addClass(t.nativeElement,"ant-form")}var M=(j.decorators=[{type:i.NgModule,args:[{declarations:[x,D,P,C,N,m,I,S],exports:[x,D,P,C,N,m,I,S],imports:[e.CommonModule,s.NzGridModule,n.NzIconModule,r.LayoutModule,a.PlatformModule]}]}],j);function j(){}t.NzFormModule=M,t.NzFormDirective=P,t.NzFormControlComponent=N,t.NzFormExplainComponent=m,t.NzFormItemComponent=C,t.NzFormExtraComponent=x,t.NzFormLabelComponent=D,t.NzFormSplitComponent=S,t.NzFormTextComponent=I,Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceMappingURL=ng-zorro-antd-form.umd.min.js.map