ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
2 lines • 12.7 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("ng-zorro-antd/core"),require("@angular/cdk/layout"),require("@angular/cdk/platform"),require("rxjs/operators"),require("ng-zorro-antd/grid"),require("@angular/forms"),require("rxjs"),require("@angular/common"),require("ng-zorro-antd/icon")):"function"==typeof define&&define.amd?define("ng-zorro-antd/form",["exports","@angular/core","ng-zorro-antd/core","@angular/cdk/layout","@angular/cdk/platform","rxjs/operators","ng-zorro-antd/grid","@angular/forms","rxjs","@angular/common","ng-zorro-antd/icon"],e):e((t["ng-zorro-antd"]=t["ng-zorro-antd"]||{},t["ng-zorro-antd"].form={}),t.ng.core,t["ng-zorro-antd"].core,t.ng.cdk.layout,t.ng.cdk.platform,t.rxjs.operators,t["ng-zorro-antd"].grid,t.ng.forms,t.rxjs,t.ng.common,t["ng-zorro-antd"].icon)}(this,function(t,e,n,o,r,a,i,l,s,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,i=a<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;0<=s;s--)(r=t[s])&&(i=(a<3?r(i):3<a?r(e,n,i):r(e,n))||i);return 3<a&&i&&Object.defineProperty(e,n,i),i}function f(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}var m=function(){function t(t,e){this.elementRef=t,this.renderer=e,this.renderer.addClass(this.elementRef.nativeElement,"ant-form-explain")}return t.decorators=[{type:e.Component,args:[{selector:"nz-form-explain",exportAs:"nzFormExplain",preserveWhitespaces:!1,encapsulation:e.ViewEncapsulation.None,changeDetection:e.ChangeDetectionStrategy.OnPush,animations:[n.helpMotion],template:"<div [@helpMotion]>\n <ng-content></ng-content>\n</div>",styles:["\n nz-form-explain {\n display: block;\n }\n "]}]}],t.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer2}]},t}(),y=function(l){function t(t,e,n,o,r,a,i){var s=l.call(this,t,e,n,o,r,a)||this;return s.cdr=i,s.nzFlex=!1,e.addClass(t.nativeElement,"ant-form-item"),s}return d(t,l),t.prototype.updateFlexStyle=function(){this.nzFlex?this.renderer.setStyle(this.elementRef.nativeElement,"display","flex"):this.renderer.removeStyle(this.elementRef.nativeElement,"display")},t.prototype.ngAfterContentInit=function(){var t=this;this.listOfNzFormExplainComponent&&this.listOfNzFormExplainComponent.changes.pipe(a.takeUntil(this.destroy$)).subscribe(function(){t.cdr.markForCheck()})},t.prototype.ngOnInit=function(){l.prototype.ngOnInit.call(this),this.updateFlexStyle()},t.prototype.ngOnDestroy=function(){l.prototype.ngOnDestroy.call(this)},t.prototype.ngOnChanges=function(t){l.prototype.ngOnChanges.call(this,t),t.hasOwnProperty("nzFlex")&&this.updateFlexStyle()},t.decorators=[{type:e.Component,args:[{selector:"nz-form-item",exportAs:"nzFormItem",preserveWhitespaces:!1,changeDetection:e.ChangeDetectionStrategy.OnPush,encapsulation:e.ViewEncapsulation.None,providers:[n.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 "]}]}],t.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer2},{type:n.NzUpdateHostClassService},{type:o.MediaMatcher},{type:e.NgZone},{type:r.Platform},{type:e.ChangeDetectorRef}]},t.propDecorators={nzFlex:[{type:e.Input}],listOfNzFormExplainComponent:[{type:e.ContentChildren,args:[m,{descendants:!0}]}]},h([n.InputBoolean(),f("design:type",Boolean)],t.prototype,"nzFlex",void 0),t}(i.NzRowDirective),g=function(s){function t(t,e,n,o,r,a){var i=s.call(this,t,e,n||o,a)||this;return i.cdr=r,i._hasFeedback=!1,i.controlClassMap={},a.addClass(e.nativeElement,"ant-form-item-control-wrapper"),i}return d(t,s),Object.defineProperty(t.prototype,"nzHasFeedback",{get:function(){return this._hasFeedback},set:function(t){this._hasFeedback=n.toBoolean(t),this.setControlClassMap()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nzValidateStatus",{set:function(t){t instanceof l.FormControl||t instanceof l.NgModel?(this.validateControl=t,this.validateString=null,this.watchControl()):t instanceof l.FormControlName?(this.validateControl=t.control,this.validateString=null,this.watchControl()):(this.validateString=t,this.validateControl=null,this.setControlClassMap())},enumerable:!0,configurable:!0}),t.prototype.removeSubscribe=function(){this.validateChanges&&(this.validateChanges.unsubscribe(),this.validateChanges=null)},t.prototype.watchControl=function(){var t=this;this.removeSubscribe(),this.validateControl&&this.validateControl.statusChanges&&(this.validateChanges=this.validateControl.statusChanges.pipe(a.startWith(null)).subscribe(function(){t.setControlClassMap(),t.cdr.markForCheck()}))},t.prototype.validateControlStatus=function(t){return!!this.validateControl&&(this.validateControl.dirty||this.validateControl.touched)&&this.validateControl.status===t},t.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)},t.prototype.ngOnInit=function(){s.prototype.ngOnInit.call(this),this.setControlClassMap()},t.prototype.ngOnDestroy=function(){this.removeSubscribe(),s.prototype.ngOnDestroy.call(this)},t.prototype.ngAfterContentInit=function(){!this.defaultValidateControl||this.validateControl||this.validateString||(this.nzValidateStatus=this.defaultValidateControl)},t.prototype.ngAfterViewInit=function(){s.prototype.ngAfterViewInit.call(this)},t.decorators=[{type:e.Component,args:[{selector:"nz-form-control",exportAs:"nzFormControl",preserveWhitespaces:!1,encapsulation:e.ViewEncapsulation.None,changeDetection:e.ChangeDetectionStrategy.OnPush,providers:[n.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 "]}]}],t.ctorParameters=function(){return[{type:n.NzUpdateHostClassService},{type:e.ElementRef},{type:y,decorators:[{type:e.Optional},{type:e.Host}]},{type:i.NzRowDirective,decorators:[{type:e.Optional},{type:e.Host}]},{type:e.ChangeDetectorRef},{type:e.Renderer2}]},t.propDecorators={defaultValidateControl:[{type:e.ContentChild,args:[l.NgControl]}],nzHasFeedback:[{type:e.Input}],nzValidateStatus:[{type:e.Input}]},t}(i.NzColDirective),C=function(){function t(t,e){this.elementRef=t,this.renderer=e,this.renderer.addClass(this.elementRef.nativeElement,"ant-form-extra")}return t.decorators=[{type:e.Component,args:[{selector:"nz-form-extra",exportAs:"nzFormExtra",template:"<ng-content></ng-content>",preserveWhitespaces:!1,encapsulation:e.ViewEncapsulation.None,changeDetection:e.ChangeDetectionStrategy.OnPush,styles:["\n nz-form-extra {\n display: block;\n }\n "]}]}],t.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer2}]},t}(),z=function(s){function t(t,e,n,o,r,a){var i=s.call(this,t,e,n||o,r)||this;return i.cdr=a,i.nzRequired=!1,i.defaultNoColon=!1,i.noColon="default",r.addClass(e.nativeElement,"ant-form-item-label"),i}return d(t,s),Object.defineProperty(t.prototype,"nzNoColon",{get:function(){return!!this.noColon},set:function(t){this.noColon=n.toBoolean(t)},enumerable:!0,configurable:!0}),t.prototype.setDefaultNoColon=function(t){this.defaultNoColon=n.toBoolean(t),this.cdr.markForCheck()},t.prototype.ngOnDestroy=function(){s.prototype.ngOnDestroy.call(this)},t.prototype.ngAfterViewInit=function(){s.prototype.ngAfterViewInit.call(this)},t.decorators=[{type:e.Component,args:[{selector:"nz-form-label",exportAs:"nzFormLabel",providers:[n.NzUpdateHostClassService],preserveWhitespaces:!1,encapsulation:e.ViewEncapsulation.None,changeDetection:e.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>'}]}],t.ctorParameters=function(){return[{type:n.NzUpdateHostClassService},{type:e.ElementRef},{type:y,decorators:[{type:e.Optional},{type:e.Host}]},{type:i.NzRowDirective,decorators:[{type:e.Optional},{type:e.Host}]},{type:e.Renderer2},{type:e.ChangeDetectorRef}]},t.propDecorators={nzFor:[{type:e.Input}],nzRequired:[{type:e.Input}],nzNoColon:[{type:e.Input}]},h([n.InputBoolean(),f("design:type",Object)],t.prototype,"nzRequired",void 0),t}(i.NzColDirective),v=function(){function t(t,e){this.elementRef=t,this.renderer=e,this.renderer.addClass(this.elementRef.nativeElement,"ant-form-split")}return t.decorators=[{type:e.Component,args:[{selector:"nz-form-split",exportAs:"nzFormSplit",preserveWhitespaces:!1,encapsulation:e.ViewEncapsulation.None,changeDetection:e.ChangeDetectionStrategy.OnPush,template:"<ng-content></ng-content>"}]}],t.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer2}]},t}(),N=function(){function t(t,e){this.elementRef=t,this.renderer=e,this.renderer.addClass(this.elementRef.nativeElement,"ant-form-text")}return t.decorators=[{type:e.Component,args:[{selector:"nz-form-text",exportAs:"nzFormText",preserveWhitespaces:!1,changeDetection:e.ChangeDetectionStrategy.OnPush,encapsulation:e.ViewEncapsulation.None,template:"<ng-content></ng-content>"}]}],t.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer2}]},t}(),b=function(){function t(t,e,n){this.elementRef=t,this.renderer=e,this.nzUpdateHostClassService=n,this.nzLayout="horizontal",this.nzNoColon=!1,this.destroy$=new s.Subject,this.renderer.addClass(t.nativeElement,"ant-form")}return t.prototype.setClassMap=function(){var t;this.nzUpdateHostClassService.updateHostClass(this.elementRef.nativeElement,((t={})["ant-form-"+this.nzLayout]=this.nzLayout,t))},t.prototype.updateItemsDefaultColon=function(){var e=this;this.nzFormLabelComponent&&this.nzFormLabelComponent.forEach(function(t){return t.setDefaultNoColon(e.nzNoColon)})},t.prototype.ngOnInit=function(){this.setClassMap()},t.prototype.ngOnChanges=function(t){this.setClassMap(),t.hasOwnProperty("nzNoColon")&&this.updateItemsDefaultColon()},t.prototype.ngAfterContentInit=function(){var t=this;this.nzFormLabelComponent.changes.pipe(a.startWith(null),a.takeUntil(this.destroy$)).subscribe(function(){t.updateItemsDefaultColon()})},t.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},t.decorators=[{type:e.Directive,args:[{selector:"[nz-form]",exportAs:"nzForm",providers:[n.NzUpdateHostClassService]}]}],t.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer2},{type:n.NzUpdateHostClassService}]},t.propDecorators={nzLayout:[{type:e.Input}],nzNoColon:[{type:e.Input}],nzFormLabelComponent:[{type:e.ContentChildren,args:[z,{descendants:!0}]}]},h([n.InputBoolean(),f("design:type",Boolean)],t.prototype,"nzNoColon",void 0),t}(),x=function(){function t(){}return t.decorators=[{type:e.NgModule,args:[{declarations:[C,z,b,y,g,m,N,v],exports:[C,z,b,y,g,m,N,v],imports:[p.CommonModule,i.NzGridModule,c.NzIconModule,o.LayoutModule,r.PlatformModule]}]}],t}();t.NzFormModule=x,t.NzFormDirective=b,t.NzFormControlComponent=g,t.NzFormExplainComponent=m,t.NzFormItemComponent=y,t.NzFormExtraComponent=C,t.NzFormLabelComponent=z,t.NzFormSplitComponent=v,t.NzFormTextComponent=N,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=ng-zorro-antd-form.umd.min.js.map