UNPKG

ng-zorro-antd

Version:

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

16 lines (14 loc) 6.59 kB
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("ng-zorro-antd/core/config"),require("ng-zorro-antd/core/util"),require("ng-zorro-antd/icon"),require("rxjs"),require("rxjs/operators"),require("@angular/common"),require("ng-zorro-antd/core/transition-patch"),require("ng-zorro-antd/core/wave")):"function"==typeof define&&define.amd?define("ng-zorro-antd/button",["exports","@angular/core","ng-zorro-antd/core/config","ng-zorro-antd/core/util","ng-zorro-antd/icon","rxjs","rxjs/operators","@angular/common","ng-zorro-antd/core/transition-patch","ng-zorro-antd/core/wave"],e):e(((n=n||self)["ng-zorro-antd"]=n["ng-zorro-antd"]||{},n["ng-zorro-antd"].button={}),n.ng.core,n["ng-zorro-antd"].core.config,n["ng-zorro-antd"].core.util,n["ng-zorro-antd"].icon,n.rxjs,n.rxjs.operators,n.ng.common,n["ng-zorro-antd"].core["transition-patch"],n["ng-zorro-antd"].core.wave)}(this,(function(n,e,t,o,r,a,i,s,c,p){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */function l(n,e,t,o){var r,a=arguments.length,i=a<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,t):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(n,e,t,o);else for(var s=n.length-1;s>=0;s--)(r=n[s])&&(i=(a<3?r(i):a>3?r(e,t,i):r(e,t))||i);return a>3&&i&&Object.defineProperty(e,t,i),i}function u(n,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(n,e)}var d=function(){function n(n,e,t,o){var r=this;this.elementRef=n,this.cdr=e,this.renderer=t,this.nzConfigService=o,this.nzBlock=!1,this.nzGhost=!1,this.nzSearch=!1,this.nzLoading=!1,this.nzDanger=!1,this.nzType=null,this.nzShape=null,this.destroy$=new a.Subject,this.loading$=new a.Subject,this.nzConfigService.getConfigChangeEventForComponent("button").pipe(i.takeUntil(this.destroy$)).subscribe((function(){r.cdr.markForCheck()}))}return n.prototype.insertSpan=function(n,e){n.forEach((function(n){if("#text"===n.nodeName){var t=e.createElement("span"),o=e.parentNode(n);e.insertBefore(o,t,n),e.appendChild(t,n)}}))},n.prototype.assertIconOnly=function(n,e){var t=Array.from(n.childNodes),o=t.filter((function(n){return"I"===n.nodeName})).length,r=t.every((function(n){return"#text"!==n.nodeName}));t.every((function(n){return"SPAN"!==n.nodeName}))&&r&&1===o&&e.addClass(n,"ant-btn-icon-only")},n.prototype.ngOnChanges=function(n){n.nzLoading&&this.loading$.next(this.nzLoading)},n.prototype.ngAfterViewInit=function(){this.assertIconOnly(this.elementRef.nativeElement,this.renderer),this.insertSpan(this.elementRef.nativeElement.childNodes,this.renderer)},n.prototype.ngAfterContentInit=function(){var n=this;this.loading$.pipe(i.startWith(this.nzLoading),i.filter((function(){return!!n.nzIconDirectiveElement})),i.takeUntil(this.destroy$)).subscribe((function(e){var t=n.nzIconDirectiveElement.nativeElement;e?n.renderer.setStyle(t,"display","none"):n.renderer.removeStyle(t,"display")}))},n.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},n.decorators=[{type:e.Component,args:[{selector:"button[nz-button], a[nz-button]",exportAs:"nzButton",preserveWhitespaces:!1,changeDetection:e.ChangeDetectionStrategy.OnPush,encapsulation:e.ViewEncapsulation.None,template:'\n <i nz-icon nzType="loading" *ngIf="nzLoading"></i>\n <ng-content></ng-content>\n ',host:{"[class.ant-btn]":"true","[class.ant-btn-primary]":"nzType === 'primary'","[class.ant-btn-dashed]":"nzType === 'dashed'","[class.ant-btn-link]":"nzType === 'link'","[class.ant-btn-danger]":"nzType === 'danger'","[class.ant-btn-circle]":"nzShape === 'circle'","[class.ant-btn-round]":"nzShape === 'round'","[class.ant-btn-lg]":"nzSize === 'large'","[class.ant-btn-sm]":"nzSize === 'small'","[class.ant-btn-dangerous]":"nzDanger","[class.ant-btn-loading]":"nzLoading","[class.ant-btn-background-ghost]":"nzGhost","[class.ant-btn-block]":"nzBlock","[class.ant-input-search-button]":"nzSearch"}}]}],n.ctorParameters=function(){return[{type:e.ElementRef},{type:e.ChangeDetectorRef},{type:e.Renderer2},{type:t.NzConfigService}]},n.propDecorators={nzIconDirectiveElement:[{type:e.ContentChild,args:[r.NzIconDirective,{read:e.ElementRef}]}],nzBlock:[{type:e.Input}],nzGhost:[{type:e.Input}],nzSearch:[{type:e.Input}],nzLoading:[{type:e.Input}],nzDanger:[{type:e.Input}],nzType:[{type:e.Input}],nzShape:[{type:e.Input}],nzSize:[{type:e.Input}]},l([o.InputBoolean(),u("design:type",Boolean)],n.prototype,"nzBlock",void 0),l([o.InputBoolean(),u("design:type",Boolean)],n.prototype,"nzGhost",void 0),l([o.InputBoolean(),u("design:type",Boolean)],n.prototype,"nzSearch",void 0),l([o.InputBoolean(),u("design:type",Boolean)],n.prototype,"nzLoading",void 0),l([o.InputBoolean(),u("design:type",Boolean)],n.prototype,"nzDanger",void 0),l([t.WithConfig("button","default"),u("design:type",String)],n.prototype,"nzSize",void 0),n}();var g=function(){function n(){this.nzSize="default"}return n.decorators=[{type:e.Component,args:[{selector:"nz-button-group",exportAs:"nzButtonGroup",changeDetection:e.ChangeDetectionStrategy.OnPush,encapsulation:e.ViewEncapsulation.None,host:{"[class.ant-btn-group]":"true","[class.ant-btn-group-lg]":"nzSize === 'large'","[class.ant-btn-group-sm]":"nzSize === 'small'"},preserveWhitespaces:!1,template:"\n <ng-content></ng-content>\n "}]}],n.propDecorators={nzSize:[{type:e.Input}]},n}();var z=function(){function n(){}return n.decorators=[{type:e.NgModule,args:[{declarations:[d,g],exports:[d,g,c.ɵNzTransitionPatchModule,p.NzWaveModule],imports:[s.CommonModule,p.NzWaveModule,r.NzIconModule,c.ɵNzTransitionPatchModule]}]}],n}();n.NzButtonComponent=d,n.NzButtonGroupComponent=g,n.NzButtonModule=z,Object.defineProperty(n,"__esModule",{value:!0})})); //# sourceMappingURL=ng-zorro-antd-button.umd.min.js.map