UNPKG

ng-zorro-antd

Version:

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

16 lines (14 loc) 7.04 kB
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("ng-zorro-antd/core/animation"),require("ng-zorro-antd/core/config"),require("ng-zorro-antd/core/util"),require("rxjs"),require("rxjs/operators"),require("@angular/common"),require("ng-zorro-antd/core/outlet"),require("ng-zorro-antd/icon")):"function"==typeof define&&define.amd?define("ng-zorro-antd/collapse",["exports","@angular/core","ng-zorro-antd/core/animation","ng-zorro-antd/core/config","ng-zorro-antd/core/util","rxjs","rxjs/operators","@angular/common","ng-zorro-antd/core/outlet","ng-zorro-antd/icon"],e):e(((n=n||self)["ng-zorro-antd"]=n["ng-zorro-antd"]||{},n["ng-zorro-antd"].collapse={}),n.ng.core,n["ng-zorro-antd"].core.animation,n["ng-zorro-antd"].core.config,n["ng-zorro-antd"].core.util,n.rxjs,n.rxjs.operators,n.ng.common,n["ng-zorro-antd"].core.outlet,n["ng-zorro-antd"].icon)}(this,(function(n,e,t,o,r,i,a,c,s,l){"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 p(n,e,t,o){var r,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,t):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(n,e,t,o);else for(var c=n.length-1;c>=0;c--)(r=n[c])&&(a=(i<3?r(a):i>3?r(e,t,a):r(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a}function d(n,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(n,e)}var u=function(){function n(n,e){var t=this;this.nzConfigService=n,this.cdr=e,this.nzExpandIconPosition="left",this.listOfNzCollapsePanelComponent=[],this.destroy$=new i.Subject,this.nzConfigService.getConfigChangeEventForComponent("collapse").pipe(a.takeUntil(this.destroy$)).subscribe((function(){t.cdr.markForCheck()}))}return n.prototype.addPanel=function(n){this.listOfNzCollapsePanelComponent.push(n)},n.prototype.removePanel=function(n){this.listOfNzCollapsePanelComponent.splice(this.listOfNzCollapsePanelComponent.indexOf(n),1)},n.prototype.click=function(n){this.nzAccordion&&!n.nzActive&&this.listOfNzCollapsePanelComponent.filter((function(e){return e!==n})).forEach((function(n){n.nzActive&&(n.nzActive=!1,n.nzActiveChange.emit(n.nzActive),n.markForCheck())})),n.nzActive=!n.nzActive,n.nzActiveChange.emit(n.nzActive)},n.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},n.decorators=[{type:e.Component,args:[{selector:"nz-collapse",exportAs:"nzCollapse",changeDetection:e.ChangeDetectionStrategy.OnPush,encapsulation:e.ViewEncapsulation.None,template:" <ng-content></ng-content> ",host:{"[class.ant-collapse]":"true","[class.ant-collapse-icon-position-left]":"nzExpandIconPosition === 'left'","[class.ant-collapse-icon-position-right]":"nzExpandIconPosition === 'right'","[class.ant-collapse-borderless]":"!nzBordered"}}]}],n.ctorParameters=function(){return[{type:o.NzConfigService},{type:e.ChangeDetectorRef}]},n.propDecorators={nzAccordion:[{type:e.Input}],nzBordered:[{type:e.Input}],nzExpandIconPosition:[{type:e.Input}]},p([o.WithConfig("collapse",!1),r.InputBoolean(),d("design:type",Boolean)],n.prototype,"nzAccordion",void 0),p([o.WithConfig("collapse",!0),r.InputBoolean(),d("design:type",Boolean)],n.prototype,"nzBordered",void 0),n}();var z=function(){function n(n,t,o){var r=this;this.nzConfigService=n,this.cdr=t,this.nzCollapseComponent=o,this.nzActive=!1,this.nzDisabled=!1,this.nzActiveChange=new e.EventEmitter,this.destroy$=new i.Subject,this.nzConfigService.getConfigChangeEventForComponent("collapsePanel").pipe(a.takeUntil(this.destroy$)).subscribe((function(){r.cdr.markForCheck()}))}return n.prototype.clickHeader=function(){this.nzDisabled||this.nzCollapseComponent.click(this)},n.prototype.markForCheck=function(){this.cdr.markForCheck()},n.prototype.ngOnInit=function(){this.nzCollapseComponent.addPanel(this)},n.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete(),this.nzCollapseComponent.removePanel(this)},n.decorators=[{type:e.Component,args:[{selector:"nz-collapse-panel",exportAs:"nzCollapsePanel",changeDetection:e.ChangeDetectionStrategy.OnPush,encapsulation:e.ViewEncapsulation.None,animations:[t.collapseMotion],template:'\n <div role="tab" [attr.aria-expanded]="nzActive" class="ant-collapse-header" (click)="clickHeader()">\n <ng-container *ngIf="nzShowArrow">\n <ng-container *nzStringTemplateOutlet="nzExpandedIcon">\n <i nz-icon [nzType]="nzExpandedIcon || \'right\'" class="ant-collapse-arrow" [nzRotate]="nzActive ? 90 : 0"></i>\n </ng-container>\n </ng-container>\n <ng-container *nzStringTemplateOutlet="nzHeader">{{ nzHeader }}</ng-container>\n <div class="ant-collapse-extra" *ngIf="nzExtra">\n <ng-container *nzStringTemplateOutlet="nzExtra">{{ nzExtra }}</ng-container>\n </div>\n </div>\n <div class="ant-collapse-content" [class.ant-collapse-content-active]="nzActive" [@collapseMotion]="nzActive ? \'expanded\' : \'hidden\'">\n <div class="ant-collapse-content-box">\n <ng-content></ng-content>\n </div>\n </div>\n ',host:{"[class.ant-collapse-item]":"true","[class.ant-collapse-no-arrow]":"!nzShowArrow","[class.ant-collapse-item-active]":"nzActive","[class.ant-collapse-item-disabled]":"nzDisabled"}}]}],n.ctorParameters=function(){return[{type:o.NzConfigService},{type:e.ChangeDetectorRef},{type:u,decorators:[{type:e.Host}]}]},n.propDecorators={nzActive:[{type:e.Input}],nzDisabled:[{type:e.Input}],nzShowArrow:[{type:e.Input}],nzExtra:[{type:e.Input}],nzHeader:[{type:e.Input}],nzExpandedIcon:[{type:e.Input}],nzActiveChange:[{type:e.Output}]},p([r.InputBoolean(),d("design:type",Object)],n.prototype,"nzActive",void 0),p([r.InputBoolean(),d("design:type",Object)],n.prototype,"nzDisabled",void 0),p([o.WithConfig("collapsePanel",!0),r.InputBoolean(),d("design:type",Boolean)],n.prototype,"nzShowArrow",void 0),n}();var g=function(){function n(){}return n.decorators=[{type:e.NgModule,args:[{declarations:[z,u],exports:[z,u],imports:[c.CommonModule,l.NzIconModule,s.NzOutletModule]}]}],n}();n.NzCollapseComponent=u,n.NzCollapseModule=g,n.NzCollapsePanelComponent=z,Object.defineProperty(n,"__esModule",{value:!0})})); //# sourceMappingURL=ng-zorro-antd-collapse.umd.min.js.map