blob: f4ddb7facfa7bb125aeff04de1f375f7c0a839f8 [file] [log] [blame]
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/common"),require("@angular/material/icon"),require("rxjs"),require("rxjs/operators"),require("@angular/core")):"function"==typeof define&&define.amd?define("@covalent/core/breadcrumbs",["exports","@angular/common","@angular/material/icon","rxjs","rxjs/operators","@angular/core"],t):t((e.covalent=e.covalent||{},e.covalent.core=e.covalent.core||{},e.covalent.core.breadcrumbs={}),e.ng.common,e.ng.material.icon,e.rxjs,e.rxjs.operators,e.ng.core)}(this,function(e,t,n,r,i,o){"use strict";var a=(Object.defineProperty(c.prototype,"displayCrumb",{get:function(){return this._displayCrumb},set:function(e){this._displayCrumb=e,this._changeDetectorRef.markForCheck()},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"displayBinding",{get:function(){return this._displayCrumb?undefined:"none"},enumerable:!0,configurable:!0}),c.prototype.ngAfterViewInit=function(){var e=this;setTimeout(function(){e._width=e._elementRef.nativeElement.getBoundingClientRect().width,e._changeDetectorRef.markForCheck()})},c.prototype._handleIconClick=function(e){e.stopPropagation(),e.preventDefault()},c.decorators=[{type:o.Component,args:[{selector:"td-breadcrumb, a[td-breadcrumb]",template:'<ng-content></ng-content>\n<mat-icon *ngIf="_displayIcon"\n class="td-breadcrumb-separator-icon"\n [style.cursor]="\'default\'"\n (click)="_handleIconClick($event)">\n {{separatorIcon}}\n</mat-icon>\n',host:{"class":"mat-button td-breadcrumb"},changeDetection:o.ChangeDetectionStrategy.OnPush,styles:[":host.td-breadcrumb{display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-ms-flex-line-pack:center;align-content:center;max-width:100%;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}:host.td-breadcrumb ::ng-deep>*{margin:0 10px}:host .td-breadcrumb-separator-icon{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;vertical-align:middle}:host.mat-button{min-width:0;padding:0}"]}]}],c.ctorParameters=function(){return[{type:o.ElementRef},{type:o.ChangeDetectorRef}]},c.propDecorators={displayBinding:[{type:o.HostBinding,args:["style.display"]}]},c);function c(e,t){this._elementRef=e,this._changeDetectorRef=t,this._displayCrumb=!0,this._width=0,this.separatorIcon="chevron_right",this._displayIcon=!0}var s=(d.prototype.ngOnInit=function(){var e=this;this._resizeSubscription=r.merge(r.fromEvent(window,"resize").pipe(i.debounceTime(10)),this._widthSubject.asObservable().pipe(i.distinctUntilChanged())).subscribe(function(){e._resizing||(e._resizing=!0,setTimeout(function(){e._calculateVisibility(),e._resizing=!1,e._changeDetectorRef.markForCheck()},100))})},d.prototype.ngDoCheck=function(){this._elementRef&&this._elementRef.nativeElement&&this._widthSubject.next(this.nativeElementWidth)},d.prototype.ngAfterContentInit=function(){this.setCrumbIcons(),this._changeDetectorRef.markForCheck()},d.prototype.ngOnDestroy=function(){this._resizeSubscription.unsubscribe()},Object.defineProperty(d.prototype,"nativeElementWidth",{get:function(){var e=this._elementRef.nativeElement,t=window.getComputedStyle(e),n=parseInt(t.borderLeft,10),r=parseInt(t.borderRight,10),i=parseInt(t.marginLeft,10),o=parseInt(t.marginRight,10),a=parseInt(t.paddingLeft,10),c=parseInt(t.paddingRight,10);return e.getBoundingClientRect().width-n-r-i-o-a-c},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"count",{get:function(){return this._breadcrumbs?this._breadcrumbs.length:0},enumerable:!0,configurable:!0}),d.prototype.setCrumbIcons=function(){var t=this,e=this._breadcrumbs.toArray();0<e.length&&(e[e.length-1]._displayIcon=!1),e.forEach(function(e){e.separatorIcon=t.separatorIcon})},d.prototype._calculateVisibility=function(){for(var e=this._breadcrumbs.toArray(),t=0,n=[],r=e.length-1;0<=r;r--){var i=e[r];t+i.width>this.nativeElementWidth?(i.displayCrumb=!1,n.push(i)):i.displayCrumb=!0,t+=i.width}this.hiddenBreadcrumbs=n,this._changeDetectorRef.markForCheck()},d.decorators=[{type:o.Component,args:[{selector:"td-breadcrumbs",template:"<ng-content></ng-content>\n",host:{"class":"td-breadcrumbs"},changeDetection:o.ChangeDetectionStrategy.OnPush,styles:[":host{display:block;width:100%}:host.td-breadcrumbs{white-space:nowrap}"]}]}],d.ctorParameters=function(){return[{type:o.ElementRef},{type:o.ChangeDetectorRef}]},d.propDecorators={_breadcrumbs:[{type:o.ContentChildren,args:[a]}],separatorIcon:[{type:o.Input,args:["separatorIcon"]}]},d);function d(e,t){this._elementRef=e,this._changeDetectorRef=t,this._resizeSubscription=r.Subscription.EMPTY,this._widthSubject=new r.Subject,this._resizing=!1,this.hiddenBreadcrumbs=[],this.separatorIcon="chevron_right"}var l=(u.decorators=[{type:o.NgModule,args:[{imports:[t.CommonModule,n.MatIconModule],declarations:[s,a],exports:[s,a]}]}],u);function u(){}e.CovalentBreadcrumbsModule=l,e.TdBreadcrumbsComponent=s,ea=a,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=covalent-core-breadcrumbs.umd.min.js.map