ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
2 lines • 4.92 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/router"),require("rxjs"),require("rxjs/internal/operators/startWith"),require("rxjs/operators"),require("ng-zorro-antd/core"),require("@angular/common")):"function"==typeof define&&define.amd?define("ng-zorro-antd/breadcrumb",["exports","@angular/core","@angular/router","rxjs","rxjs/internal/operators/startWith","rxjs/operators","ng-zorro-antd/core","@angular/common"],t):t(((e=e||self)["ng-zorro-antd"]=e["ng-zorro-antd"]||{},e["ng-zorro-antd"].breadcrumb={}),e.ng.core,e.ng.router,e.rxjs,e.rxjs["internal/operators/startWith"],e.rxjs.operators,e["ng-zorro-antd"].core,e.ng.common)}(this,function(e,t,r,n,o,a,u,c){"use strict";function i(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}var s=function(){function e(e,t,r,o,a){this.injector=e,this.ngZone=t,this.cdr=r,this.nzAutoGenerate=!1,this.nzSeparator="/",this.breadcrumbs=[],this.destroy$=new n.Subject,a.addClass(o.nativeElement,"ant-breadcrumb")}return e.prototype.ngOnInit=function(){this.nzAutoGenerate&&this.registerRouterChange()},e.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},e.prototype.navigate=function(e,t){var n=this;t.preventDefault(),this.ngZone.run(function(){return n.injector.get(r.Router).navigateByUrl(e).then()}).then()},e.prototype.registerRouterChange=function(){var e=this;try{var t=this.injector.get(r.Router),n=this.injector.get(r.ActivatedRoute);t.events.pipe(a.filter(function(e){return e instanceof r.NavigationEnd}),a.takeUntil(this.destroy$),o.startWith(!0)).subscribe(function(){e.breadcrumbs=e.getBreadcrumbs(n.root),e.cdr.markForCheck()})}catch(c){throw new Error(u.PREFIX+" You should import RouterModule if you want to use 'NzAutoGenerate'.")}},e.prototype.getBreadcrumbs=function(e,t,n){var o,a;void 0===t&&(t=""),void 0===n&&(n=[]);var u=e.children;if(0===u.length)return n;try{for(var c=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}(u),i=c.next();!i.done;i=c.next()){var s=i.value;if(s.outlet===r.PRIMARY_OUTLET){var p=s.snapshot.url.map(function(e){return e.path}).join("/"),d=t+"/"+p,l=s.snapshot.data.breadcrumb;if(p&&l){var m={label:l,params:s.snapshot.params,url:d};n.push(m)}return this.getBreadcrumbs(s,d,n)}}}catch(b){o={error:b}}finally{try{i&&!i.done&&(a=c["return"])&&a.call(c)}finally{if(o)throw o.error}}},e.decorators=[{type:t.Component,args:[{changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None,selector:"nz-breadcrumb",exportAs:"nzBreadcrumb",preserveWhitespaces:!1,template:'<ng-content></ng-content>\n<ng-container *ngIf="nzAutoGenerate">\n <nz-breadcrumb-item *ngFor="let breadcrumb of breadcrumbs">\n <a [attr.href]="breadcrumb.url" (click)="navigate(breadcrumb.url, $event)">{{ breadcrumb.label }}</a>\n </nz-breadcrumb-item>\n</ng-container>',styles:["\n nz-breadcrumb {\n display: block;\n }\n "]}]}],e.ctorParameters=function(){return[{type:t.Injector},{type:t.NgZone},{type:t.ChangeDetectorRef},{type:t.ElementRef},{type:t.Renderer2}]},e.propDecorators={nzAutoGenerate:[{type:t.Input}],nzSeparator:[{type:t.Input}]},function(e,t,r,n){var o,a=arguments.length,u=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(u=(a<3?o(u):a>3?o(t,r,u):o(t,r))||u);a>3&&u&&Object.defineProperty(t,r,u)}([u.InputBoolean(),i("design:type",Object)],e.prototype,"nzAutoGenerate",void 0),e}(),p=function(){function e(e){this.nzBreadCrumbComponent=e}return e.decorators=[{type:t.Component,args:[{changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None,selector:"nz-breadcrumb-item",exportAs:"nzBreadcrumbItem",preserveWhitespaces:!1,template:'<span class="ant-breadcrumb-link">\n <ng-content></ng-content>\n</span>\n<span class="ant-breadcrumb-separator">\n <ng-container *nzStringTemplateOutlet="nzBreadCrumbComponent.nzSeparator">\n {{ nzBreadCrumbComponent.nzSeparator }}\n </ng-container>\n</span>\n',styles:["\n nz-breadcrumb-item:last-child {\n color: rgba(0, 0, 0, 0.65);\n }\n\n nz-breadcrumb-item:last-child .ant-breadcrumb-separator {\n display: none;\n }\n "]}]}],e.ctorParameters=function(){return[{type:s}]},e}(),d=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{imports:[c.CommonModule,u.NzAddOnModule],declarations:[s,p],exports:[s,p]}]}],e}();e.NZ_ROUTE_DATA_BREADCRUMB="breadcrumb",e.NzBreadCrumbComponent=s,e.NzBreadCrumbItemComponent=p,e.NzBreadCrumbModule=d,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=ng-zorro-antd-breadcrumb.umd.min.js.map