ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
2 lines • 26.1 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("ng-zorro-antd/core"),require("rxjs"),require("@angular/router"),require("@angular/cdk/observers"),require("@angular/cdk/platform"),require("@angular/common"),require("ng-zorro-antd/icon"),require("@angular/cdk/bidi"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("ng-zorro-antd/tabs",["exports","@angular/core","ng-zorro-antd/core","rxjs","@angular/router","@angular/cdk/observers","@angular/cdk/platform","@angular/common","ng-zorro-antd/icon","@angular/cdk/bidi","rxjs/operators"],e):e(((t=t||self)["ng-zorro-antd"]=t["ng-zorro-antd"]||{},t["ng-zorro-antd"].tabs={}),t.ng.core,t["ng-zorro-antd"].core,t.rxjs,t.ng.router,t.ng.cdk.observers,t.ng.cdk.platform,t.ng.common,t["ng-zorro-antd"].icon,t.ng.cdk.bidi,t.rxjs.operators)}(this,function(t,e,n,i,o,a,r,s,l,c,p){"use strict";function d(t,e,n,i){var o,a=arguments.length,r=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(r=(a<3?o(r):a>3?o(e,n,r):o(e,n))||r);return a>3&&r&&Object.defineProperty(e,n,r),r}function h(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function b(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,o,a=n.call(t),r=[];try{for(;(void 0===e||e-- >0)&&!(i=a.next()).done;)r.push(i.value)}catch(t){o={error:t}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return r}var u=function(){function t(){this.active=!1,this.forceRender=!1}return t.decorators=[{type:e.Component,args:[{selector:"[nz-tab-body]",exportAs:"nzTabBody",preserveWhitespaces:!1,encapsulation:e.ViewEncapsulation.None,changeDetection:e.ChangeDetectionStrategy.OnPush,template:'<ng-container *ngIf="active || forceRender">\n <ng-template [ngTemplateOutlet]="content"></ng-template>\n</ng-container>',host:{"[class.ant-tabs-tabpane-active]":"active","[class.ant-tabs-tabpane-inactive]":"!active"}}]}],t.propDecorators={content:[{type:e.Input}],active:[{type:e.Input}],forceRender:[{type:e.Input}]},t}();var f=function(){function t(t,e){this.elementRef=t,this.disabled=!1,e.addClass(t.nativeElement,"ant-tabs-tab")}return t.prototype.getOffsetLeft=function(){return this.elementRef.nativeElement.offsetLeft},t.prototype.getOffsetWidth=function(){return this.elementRef.nativeElement.offsetWidth},t.prototype.getOffsetTop=function(){return this.elementRef.nativeElement.offsetTop},t.prototype.getOffsetHeight=function(){return this.elementRef.nativeElement.offsetHeight},t.decorators=[{type:e.Directive,args:[{selector:"[nz-tab-label]",exportAs:"nzTabLabel",host:{"[class.ant-tabs-tab-disabled]":"disabled"}}]}],t.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer2}]},t.propDecorators={disabled:[{type:e.Input}]},d([n.InputBoolean(),h("design:type",Object)],t.prototype,"disabled",void 0),t}();var g=function(){function t(t,e){this.routerLink=t,this.routerLinkWithHref=e}return t.decorators=[{type:e.Directive,args:[{selector:"a[nz-tab-link]",exportAs:"nzTabLink"}]}],t.ctorParameters=function(){return[{type:o.RouterLink,decorators:[{type:e.Optional},{type:e.Self}]},{type:o.RouterLinkWithHref,decorators:[{type:e.Optional},{type:e.Self}]}]},t}();var z=function(){function t(){}return t.decorators=[{type:e.Directive,args:[{selector:"[nz-tab]",exportAs:"nzTab"}]}],t}(),m=function(){function t(t,n){this.elementRef=t,this.renderer=n,this.position=null,this.origin=null,this.isActive=!1,this.stateChanges=new i.Subject,this.nzForceRender=!1,this.nzDisabled=!1,this.nzClick=new e.EventEmitter,this.nzSelect=new e.EventEmitter,this.nzDeselect=new e.EventEmitter,this.renderer.addClass(t.nativeElement,"ant-tabs-tabpane")}return t.prototype.ngOnChanges=function(t){(t.nzTitle||t.nzForceRender||t.nzDisabled)&&this.stateChanges.next()},t.prototype.ngOnDestroy=function(){this.stateChanges.complete()},t.decorators=[{type:e.Component,args:[{selector:"nz-tab",exportAs:"nzTab",preserveWhitespaces:!1,encapsulation:e.ViewEncapsulation.None,changeDetection:e.ChangeDetectionStrategy.OnPush,template:'<ng-template #titleTpl>\n <ng-content select="[nz-tab-link]"></ng-content>\n</ng-template>\n<ng-template #bodyTpl>\n <ng-content></ng-content>\n</ng-template>'}]}],t.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer2}]},t.propDecorators={content:[{type:e.ViewChild,args:["bodyTpl",{static:!0}]}],title:[{type:e.ViewChild,args:["titleTpl",{static:!0}]}],template:[{type:e.ContentChild,args:[z,{static:!1,read:e.TemplateRef}]}],linkDirective:[{type:e.ContentChild,args:[g,{static:!1}]}],nzTitle:[{type:e.Input}],nzRouterIdentifier:[{type:e.Input}],nzForceRender:[{type:e.Input}],nzDisabled:[{type:e.Input}],nzClick:[{type:e.Output}],nzSelect:[{type:e.Output}],nzDeselect:[{type:e.Output}]},d([n.InputBoolean(),h("design:type",Object)],t.prototype,"nzForceRender",void 0),d([n.InputBoolean(),h("design:type",Object)],t.prototype,"nzDisabled",void 0),t}();var y=function(){function t(t,e,n){this.renderer=t,this.elementRef=e,this.ngZone=n,this.nzAnimated=!1,this.nzPositionMode="horizontal",t.addClass(e.nativeElement,"ant-tabs-ink-bar")}return t.prototype.alignToElement=function(t){var e=this;"undefined"!=typeof requestAnimationFrame?this.ngZone.runOutsideAngular(function(){requestAnimationFrame(function(){return e.setStyles(t)})}):this.setStyles(t)},t.prototype.setStyles=function(t){"horizontal"===this.nzPositionMode?(this.renderer.removeStyle(this.elementRef.nativeElement,"height"),this.renderer.setStyle(this.elementRef.nativeElement,"transform","translate3d("+this.getLeftPosition(t)+", 0px, 0px)"),this.renderer.setStyle(this.elementRef.nativeElement,"width",this.getElementWidth(t))):(this.renderer.removeStyle(this.elementRef.nativeElement,"width"),this.renderer.setStyle(this.elementRef.nativeElement,"transform","translate3d(0px, "+this.getTopPosition(t)+", 0px)"),this.renderer.setStyle(this.elementRef.nativeElement,"height",this.getElementHeight(t)))},t.prototype.getLeftPosition=function(t){return t?t.offsetLeft+"px":"0"},t.prototype.getElementWidth=function(t){return t?t.offsetWidth+"px":"0"},t.prototype.getTopPosition=function(t){return t?t.offsetTop+"px":"0"},t.prototype.getElementHeight=function(t){return t?t.offsetHeight+"px":"0"},t.decorators=[{type:e.Directive,args:[{selector:"[nz-tabs-ink-bar]",exportAs:"nzTabsInkBar",host:{"[class.ant-tabs-ink-bar-animated]":"nzAnimated","[class.ant-tabs-ink-bar-no-animated]":"!nzAnimated"}}]}],t.ctorParameters=function(){return[{type:e.Renderer2},{type:e.ElementRef},{type:e.NgZone}]},t.propDecorators={nzAnimated:[{type:e.Input}],nzPositionMode:[{type:e.Input}]},d([n.InputBoolean(),h("design:type",Object)],t.prototype,"nzAnimated",void 0),t}();var v=function(){function t(t,n,o,a,r,s,l){this.elementRef=t,this.ngZone=n,this.renderer=o,this.cdr=a,this.platform=r,this.nzDomEventService=s,this.dir=l,this._tabPositionMode="horizontal",this._scrollDistance=0,this._selectedIndex=0,this.destroy$=new i.Subject,this.showPaginationControls=!1,this.disableScrollAfter=!0,this.disableScrollBefore=!0,this.selectedIndexChanged=!1,this.realignInkBar=null,this.nzOnNextClick=new e.EventEmitter,this.nzOnPrevClick=new e.EventEmitter,this.nzAnimated=!0,this.nzHideBar=!1,this.nzShowPagination=!0,this.nzType="line"}return Object.defineProperty(t.prototype,"nzPositionMode",{get:function(){return this._tabPositionMode},set:function(t){var e=this;this._tabPositionMode=t,this.alignInkBarToSelectedTab(),this.nzShowPagination&&Promise.resolve().then(function(){e.updatePagination()})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"selectedIndex",{get:function(){return this._selectedIndex},set:function(t){this.selectedIndexChanged=this._selectedIndex!==t,this._selectedIndex=t},enumerable:!0,configurable:!0}),t.prototype.onContentChanges=function(){var t=this,e=this.elementRef.nativeElement.textContent;e!==this.currentTextContent&&(this.currentTextContent=e,this.ngZone.run(function(){t.nzShowPagination&&t.updatePagination(),t.alignInkBarToSelectedTab(),t.cdr.markForCheck()}))},t.prototype.scrollHeader=function(t){"before"!==t||this.disableScrollBefore?"after"!==t||this.disableScrollAfter||this.nzOnNextClick.emit():this.nzOnPrevClick.emit(),this.scrollDistance+=("before"===t?-1:1)*this.viewWidthHeightPix/3},t.prototype.ngAfterContentChecked=function(){this.tabLabelCount!==this.listOfNzTabLabelDirective.length&&(this.nzShowPagination&&this.updatePagination(),this.tabLabelCount=this.listOfNzTabLabelDirective.length,this.cdr.markForCheck()),this.selectedIndexChanged&&(this.scrollToLabel(this._selectedIndex),this.nzShowPagination&&this.checkScrollingControls(),this.alignInkBarToSelectedTab(),this.selectedIndexChanged=!1,this.cdr.markForCheck()),this.scrollDistanceChanged&&(this.nzShowPagination&&this.updateTabScrollPosition(),this.scrollDistanceChanged=!1,this.cdr.markForCheck())},t.prototype.ngAfterContentInit=function(){var t=this;this.realignInkBar=this.ngZone.runOutsideAngular(function(){var e=t.dir?t.dir.change:i.of(null),n="undefined"!=typeof window?t.nzDomEventService.registerResizeListener().pipe(p.takeUntil(t.destroy$),p.finalize(function(){return t.nzDomEventService.unregisterResizeListener()})):i.of(null);return i.merge(e,n).pipe(p.startWith(null)).subscribe(function(){t.nzShowPagination&&t.updatePagination(),t.alignInkBarToSelectedTab()})})},t.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete(),this.realignInkBar&&this.realignInkBar.unsubscribe()},t.prototype.updateTabScrollPosition=function(){var t=this.scrollDistance;if("horizontal"===this.nzPositionMode){var e="ltr"===this.getLayoutDirection()?-t:t;this.renderer.setStyle(this.navListElement.nativeElement,"transform","translate3d("+e+"px, 0, 0)")}else this.renderer.setStyle(this.navListElement.nativeElement,"transform","translate3d(0,"+-t+"px, 0)")},t.prototype.updatePagination=function(){this.checkPaginationEnabled(),this.checkScrollingControls(),this.updateTabScrollPosition()},t.prototype.checkPaginationEnabled=function(){var t=this.tabListScrollWidthHeightPix>this.tabListScrollOffSetWidthHeight;t||(this.scrollDistance=0),t!==this.showPaginationControls&&this.cdr.markForCheck(),this.showPaginationControls=t},t.prototype.scrollToLabel=function(t){var e=this.listOfNzTabLabelDirective?this.listOfNzTabLabelDirective.toArray()[t]:null;if(e){var n=void 0,i=void 0;"horizontal"===this.nzPositionMode?"ltr"===this.getLayoutDirection()?i=(n=e.getOffsetLeft())+e.getOffsetWidth():n=(i=this.navListElement.nativeElement.offsetWidth-e.getOffsetLeft())-e.getOffsetWidth():i=(n=e.getOffsetTop())+e.getOffsetHeight();var o=this.scrollDistance,a=this.scrollDistance+this.viewWidthHeightPix;n<o?this.scrollDistance-=o-n+64:i>a&&(this.scrollDistance+=i-a+64)}},t.prototype.checkScrollingControls=function(){this.disableScrollBefore=0===this.scrollDistance,this.disableScrollAfter=this.scrollDistance===this.getMaxScrollDistance(),this.cdr.markForCheck()},t.prototype.getMaxScrollDistance=function(){return this.tabListScrollWidthHeightPix-this.viewWidthHeightPix||0},Object.defineProperty(t.prototype,"scrollDistance",{get:function(){return this._scrollDistance},set:function(t){this._scrollDistance=Math.max(0,Math.min(this.getMaxScrollDistance(),t)),this.scrollDistanceChanged=!0,this.checkScrollingControls()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"viewWidthHeightPix",{get:function(){var t=0;return this.showPaginationControls&&(t=this.navContainerScrollPaddingPix),"horizontal"===this.nzPositionMode?this.navContainerElement.nativeElement.offsetWidth-t:this.navContainerElement.nativeElement.offsetHeight-t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"navContainerScrollPaddingPix",{get:function(){if(this.platform.isBrowser){var t=this.navContainerElement.nativeElement,e=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle;return"horizontal"===this.nzPositionMode?n.pxToNumber(e.paddingLeft)+n.pxToNumber(e.paddingRight):n.pxToNumber(e.paddingTop)+n.pxToNumber(e.paddingBottom)}return 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tabListScrollWidthHeightPix",{get:function(){return"horizontal"===this.nzPositionMode?this.navListElement.nativeElement.scrollWidth:this.navListElement.nativeElement.scrollHeight},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tabListScrollOffSetWidthHeight",{get:function(){return"horizontal"===this.nzPositionMode?this.scrollListElement.nativeElement.offsetWidth:this.elementRef.nativeElement.offsetHeight},enumerable:!0,configurable:!0}),t.prototype.getLayoutDirection=function(){return this.dir&&"rtl"===this.dir.value?"rtl":"ltr"},t.prototype.alignInkBarToSelectedTab=function(){if("line"===this.nzType){var t=this.listOfNzTabLabelDirective&&this.listOfNzTabLabelDirective.length?this.listOfNzTabLabelDirective.toArray()[this.selectedIndex].elementRef.nativeElement:null;this.nzTabsInkBarDirective&&this.nzTabsInkBarDirective.alignToElement(t)}},t.decorators=[{type:e.Component,args:[{selector:"[nz-tabs-nav]",exportAs:"nzTabsNav",preserveWhitespaces:!1,changeDetection:e.ChangeDetectionStrategy.OnPush,encapsulation:e.ViewEncapsulation.None,template:'<div style="float:right;" *ngIf="nzTabBarExtraContent" class="ant-tabs-extra-content">\n <ng-template [ngTemplateOutlet]="nzTabBarExtraContent"></ng-template>\n</div>\n<div class="ant-tabs-nav-container"\n [class.ant-tabs-nav-container-scrolling]="showPaginationControls"\n #navContainerElement>\n <span class="ant-tabs-tab-prev"\n (click)="scrollHeader(\'before\')"\n [class.ant-tabs-tab-btn-disabled]="disableScrollBefore"\n [class.ant-tabs-tab-arrow-show]="showPaginationControls">\n <span class="ant-tabs-tab-prev-icon">\n <i nz-icon [nzType]="nzPositionMode === \'horizontal\' ? \'left\' : \'up\'" class="ant-tabs-tab-prev-icon-target"></i>\n </span>\n </span>\n <span class="ant-tabs-tab-next"\n (click)="scrollHeader(\'after\')"\n [class.ant-tabs-tab-btn-disabled]="disableScrollAfter"\n [class.ant-tabs-tab-arrow-show]="showPaginationControls">\n <span class="ant-tabs-tab-next-icon">\n <i nz-icon [nzType]="nzPositionMode === \'horizontal\' ? \'right\' : \'down\'" class="ant-tabs-tab-next-icon-target"></i>\n </span>\n </span>\n <div class="ant-tabs-nav-wrap">\n <div class="ant-tabs-nav-scroll" #scrollListElement>\n <div class="ant-tabs-nav"\n [class.ant-tabs-nav-animated]="nzAnimated"\n #navListElement\n (cdkObserveContent)="onContentChanges()">\n <div>\n <ng-content></ng-content>\n </div>\n <div nz-tabs-ink-bar [hidden]="nzHideBar" [nzAnimated]="nzAnimated" [nzPositionMode]="nzPositionMode" style="display: block;"></div>\n </div>\n </div>\n </div>\n</div>'}]}],t.ctorParameters=function(){return[{type:e.ElementRef},{type:e.NgZone},{type:e.Renderer2},{type:e.ChangeDetectorRef},{type:r.Platform},{type:n.NzDomEventService},{type:c.Directionality,decorators:[{type:e.Optional}]}]},t.propDecorators={listOfNzTabLabelDirective:[{type:e.ContentChildren,args:[f]}],nzTabsInkBarDirective:[{type:e.ViewChild,args:[y,{static:!0}]}],navContainerElement:[{type:e.ViewChild,args:["navContainerElement",{static:!0}]}],navListElement:[{type:e.ViewChild,args:["navListElement",{static:!0}]}],scrollListElement:[{type:e.ViewChild,args:["scrollListElement",{static:!0}]}],nzOnNextClick:[{type:e.Output}],nzOnPrevClick:[{type:e.Output}],nzTabBarExtraContent:[{type:e.Input}],nzAnimated:[{type:e.Input}],nzHideBar:[{type:e.Input}],nzShowPagination:[{type:e.Input}],nzType:[{type:e.Input}],nzPositionMode:[{type:e.Input}],selectedIndex:[{type:e.Input}]},d([n.InputBoolean(),h("design:type",Object)],t.prototype,"nzAnimated",void 0),d([n.InputBoolean(),h("design:type",Object)],t.prototype,"nzHideBar",void 0),d([n.InputBoolean(),h("design:type",Object)],t.prototype,"nzShowPagination",void 0),t}();var C=function(){};var T=function(){function t(t,n,o,a,r,s){this.nzConfigService=t,this.renderer=n,this.nzUpdateHostClassService=o,this.elementRef=a,this.cdr=r,this.router=s,this.indexToSelect=0,this.el=this.elementRef.nativeElement,this._selectedIndex=null,this.tabsSubscription=i.Subscription.EMPTY,this.tabLabelSubscription=i.Subscription.EMPTY,this.destroy$=new i.Subject,this.tabPositionMode="horizontal",this.nzHideAll=!1,this.nzTabPosition="top",this.nzLinkRouter=!1,this.nzLinkExact=!0,this.nzOnNextClick=new e.EventEmitter,this.nzOnPrevClick=new e.EventEmitter,this.nzSelectChange=new e.EventEmitter(!0),this.nzSelectedIndexChange=new e.EventEmitter}return Object.defineProperty(t.prototype,"nzSelectedIndex",{get:function(){return this._selectedIndex},set:function(t){this.indexToSelect=t?n.toNumber(t,null):null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inkBarAnimated",{get:function(){return!0===this.nzAnimated||!0===this.nzAnimated.inkBar},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tabPaneAnimated",{get:function(){return!0===this.nzAnimated||!0===this.nzAnimated.tabPane},enumerable:!0,configurable:!0}),t.prototype.setPosition=function(t){this.tabContent&&("bottom"===t?this.renderer.insertBefore(this.el,this.tabContent.nativeElement,this.nzTabsNavComponent.elementRef.nativeElement):this.renderer.insertBefore(this.el,this.nzTabsNavComponent.elementRef.nativeElement,this.tabContent.nativeElement))},t.prototype.setClassMap=function(){var t;this.nzUpdateHostClassService.updateHostClass(this.el,((t={})["ant-tabs"]=!0,t["ant-tabs-vertical"]="left"===this.nzTabPosition||"right"===this.nzTabPosition,t["ant-tabs-"+this.nzTabPosition]=this.nzTabPosition,t["ant-tabs-no-animation"]=!1===this.nzAnimated||!1===this.nzAnimated.tabPane,t["ant-tabs-"+this.nzType]=this.nzType,t["ant-tabs-large"]="large"===this.nzSize,t["ant-tabs-small"]="small"===this.nzSize,t))},t.prototype.clickLabel=function(t,e){if(!e){var n=this.listOfNzTabComponent.toArray();this.nzSelectedIndex=t,n[t].nzClick.emit()}},t.prototype.createChangeEvent=function(t){var e=new C;return e.index=t,this.listOfNzTabComponent&&this.listOfNzTabComponent.length&&(e.tab=this.listOfNzTabComponent.toArray()[t],this.listOfNzTabComponent.forEach(function(e,n){n!==t&&e.nzDeselect.emit()}),e.tab.nzSelect.emit()),e},t.prototype.clampTabIndex=function(t){return Math.min(this.listOfNzTabComponent.length-1,Math.max(t||0,0))},t.prototype.subscribeToTabLabels=function(){var t=this;this.tabLabelSubscription&&this.tabLabelSubscription.unsubscribe(),this.tabLabelSubscription=i.merge.apply(void 0,function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(b(arguments[e]));return t}(this.listOfNzTabComponent.map(function(t){return t.stateChanges}))).subscribe(function(){return t.cdr.markForCheck()})},t.prototype.ngOnChanges=function(t){t.nzTabPosition&&("top"===this.nzTabPosition||"bottom"===this.nzTabPosition?this.tabPositionMode="horizontal":this.tabPositionMode="vertical",this.setPosition(this.nzTabPosition)),t.nzType&&"card"===this.nzType&&(this.nzAnimated=!1),(t.nzSize||t.nzAnimated||t.nzTabPosition||t.nzType)&&this.setClassMap()},t.prototype.ngOnInit=function(){this.setClassMap()},t.prototype.ngAfterContentChecked=function(){var t=this;if(this.listOfNzTabComponent&&this.listOfNzTabComponent.length){var e=this.indexToSelect=this.clampTabIndex(this.indexToSelect);if(this._selectedIndex!==e){var n=null==this._selectedIndex;n||this.nzSelectChange.emit(this.createChangeEvent(e)),Promise.resolve().then(function(){t.listOfNzTabComponent.forEach(function(t,n){return t.isActive=n===e}),n||t.nzSelectedIndexChange.emit(e)})}this.listOfNzTabComponent.forEach(function(n,i){n.position=i-e,null==t._selectedIndex||0!==n.position||n.origin||(n.origin=e-t._selectedIndex)}),this._selectedIndex!==e&&(this._selectedIndex=e,this.cdr.markForCheck())}},t.prototype.ngAfterContentInit=function(){var t=this;this.subscribeToTabLabels(),this.tabsSubscription=this.listOfNzTabComponent.changes.subscribe(function(){if(t.clampTabIndex(t.indexToSelect)===t._selectedIndex)for(var e=t.listOfNzTabComponent.toArray(),n=0;n<e.length;n++)if(e[n].isActive){t.indexToSelect=t._selectedIndex=n;break}t.subscribeToTabLabels(),t.cdr.markForCheck()})},t.prototype.ngOnDestroy=function(){this.tabsSubscription.unsubscribe(),this.tabLabelSubscription.unsubscribe(),this.destroy$.next(),this.destroy$.complete()},t.prototype.ngAfterViewInit=function(){var t=this;if(this.setPosition(this.nzTabPosition),this.nzLinkRouter){if(!this.router)throw new Error(n.PREFIX+" you should import 'RouterModule' if you want to use 'nzLinkRouter'!");this.router.events.pipe(p.takeUntil(this.destroy$),p.filter(function(t){return t instanceof o.NavigationEnd}),p.startWith(!0)).subscribe(function(){t.updateRouterActive(),t.cdr.markForCheck()})}},t.prototype.updateRouterActive=function(){if(this.router.navigated){var t=this.findShouldActiveTabIndex();t!==this._selectedIndex&&(this.nzSelectedIndex=t,this.nzSelectedIndexChange.emit(t)),this.nzHideAll=-1===t}},t.prototype.findShouldActiveTabIndex=function(){var t=this.listOfNzTabComponent.toArray(),e=this.isLinkActive(this.router);return t.findIndex(function(t){var n=t.linkDirective;return!!n&&(e(n.routerLink)||e(n.routerLinkWithHref))})},t.prototype.isLinkActive=function(t){var e=this;return function(n){return!!n&&t.isActive(n.urlTree,e.nzLinkExact)}},t.decorators=[{type:e.Component,args:[{selector:"nz-tabset",exportAs:"nzTabset",preserveWhitespaces:!1,encapsulation:e.ViewEncapsulation.None,changeDetection:e.ChangeDetectionStrategy.OnPush,providers:[n.NzUpdateHostClassService],template:'<ng-container *ngIf="listOfNzTabComponent">\n <div nz-tabs-nav\n role="tablist"\n tabindex="0"\n class="ant-tabs-bar"\n [class.ant-tabs-card-bar]="nzType === \'card\'"\n [class.ant-tabs-top-bar]="nzTabPosition === \'top\'"\n [class.ant-tabs-bottom-bar]="nzTabPosition === \'bottom\'"\n [class.ant-tabs-left-bar]="nzTabPosition === \'left\'"\n [class.ant-tabs-right-bar]="nzTabPosition === \'right\'"\n [class.ant-tabs-small-bar]="nzSize === \'small\'"\n [class.ant-tabs-default-bar]="nzSize === \'default\'"\n [class.ant-tabs-large-bar]="nzSize === \'large\'"\n [nzType]="nzType"\n [nzShowPagination]="nzShowPagination"\n [nzPositionMode]="tabPositionMode"\n [nzAnimated]="inkBarAnimated"\n [ngStyle]="nzTabBarStyle"\n [nzHideBar]="nzHideAll"\n [nzTabBarExtraContent]="nzTabBarExtraContent"\n [selectedIndex]="nzSelectedIndex"\n (nzOnNextClick)="nzOnNextClick.emit()"\n (nzOnPrevClick)="nzOnPrevClick.emit()">\n <div nz-tab-label\n role="tab"\n [style.margin-right.px]="nzTabBarGutter"\n [class.ant-tabs-tab-active]="(nzSelectedIndex == i) && !nzHideAll"\n [disabled]="tab.nzDisabled"\n (click)="clickLabel(i,tab.nzDisabled)"\n *ngFor="let tab of listOfNzTabComponent; let i = index">\n <ng-container *nzStringTemplateOutlet="tab.nzTitle || tab.title">{{ tab.nzTitle }}</ng-container>\n </div>\n </div>\n <div #tabContent\n class="ant-tabs-content"\n [class.ant-tabs-top-content]="nzTabPosition === \'top\'"\n [class.ant-tabs-bottom-content]="nzTabPosition === \'bottom\'"\n [class.ant-tabs-left-content]="nzTabPosition === \'left\'"\n [class.ant-tabs-right-content]="nzTabPosition === \'right\'"\n [class.ant-tabs-content-animated]="tabPaneAnimated"\n [class.ant-tabs-card-content]="nzType === \'card\'"\n [class.ant-tabs-content-no-animated]="!tabPaneAnimated"\n [style.margin-left.%]="(tabPositionMode === \'horizontal\') && tabPaneAnimated && (-(nzSelectedIndex || 0 ) * 100)">\n <div nz-tab-body\n class="ant-tabs-tabpane"\n *ngFor="let tab of listOfNzTabComponent; let i = index"\n [active]="(nzSelectedIndex == i) && !nzHideAll"\n [forceRender]="tab.nzForceRender"\n [content]="tab.template || tab.content">\n </div>\n </div>\n</ng-container>',styles:["\n nz-tabset {\n display: block;\n }\n "]}]}],t.ctorParameters=function(){return[{type:n.NzConfigService},{type:e.Renderer2},{type:n.NzUpdateHostClassService},{type:e.ElementRef},{type:e.ChangeDetectorRef},{type:o.Router,decorators:[{type:e.Optional}]}]},t.propDecorators={listOfNzTabComponent:[{type:e.ContentChildren,args:[m]}],nzTabsNavComponent:[{type:e.ViewChild,args:[v,{static:!1}]}],tabContent:[{type:e.ViewChild,args:["tabContent",{static:!1}]}],nzTabBarExtraContent:[{type:e.Input}],nzShowPagination:[{type:e.Input}],nzAnimated:[{type:e.Input}],nzHideAll:[{type:e.Input}],nzTabPosition:[{type:e.Input}],nzSize:[{type:e.Input}],nzTabBarGutter:[{type:e.Input}],nzTabBarStyle:[{type:e.Input}],nzType:[{type:e.Input}],nzLinkRouter:[{type:e.Input}],nzLinkExact:[{type:e.Input}],nzOnNextClick:[{type:e.Output}],nzOnPrevClick:[{type:e.Output}],nzSelectChange:[{type:e.Output}],nzSelectedIndexChange:[{type:e.Output}],nzSelectedIndex:[{type:e.Input}]},d([n.WithConfig(!0),h("design:type",Boolean)],t.prototype,"nzShowPagination",void 0),d([n.WithConfig(!0),h("design:type",Object)],t.prototype,"nzAnimated",void 0),d([n.WithConfig("default"),h("design:type",String)],t.prototype,"nzSize",void 0),d([n.WithConfig(),h("design:type",Number)],t.prototype,"nzTabBarGutter",void 0),d([n.WithConfig("line"),h("design:type",String)],t.prototype,"nzType",void 0),d([n.InputBoolean(),h("design:type",Object)],t.prototype,"nzLinkRouter",void 0),d([n.InputBoolean(),h("design:type",Object)],t.prototype,"nzLinkExact",void 0),t}();var P=function(){function t(){}return t.decorators=[{type:e.NgModule,args:[{declarations:[m,z,T,v,f,y,u,g],exports:[m,z,T,v,f,y,u,g],imports:[s.CommonModule,a.ObserversModule,l.NzIconModule,n.NzAddOnModule,r.PlatformModule]}]}],t}();t.NzTabBodyComponent=u,t.NzTabChangeEvent=C,t.NzTabComponent=m,t.NzTabDirective=z,t.NzTabLabelDirective=f,t.NzTabLinkDirective=g,t.NzTabSetComponent=T,t.NzTabsInkBarDirective=y,t.NzTabsModule=P,t.NzTabsNavComponent=v,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=ng-zorro-antd-tabs.umd.min.js.map