clarity-angular
Version:
Angular components for Clarity
1 lines • 212 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("rxjs/Subject"),require("@angular/forms"),require("rxjs/BehaviorSubject"),require("rxjs/add/operator/map"),require("@angular/animations"),require("@angular/platform-browser")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/common","rxjs/Subject","@angular/forms","rxjs/BehaviorSubject","rxjs/add/operator/map","@angular/animations","@angular/platform-browser"],t):t(e["clarity-angular"]={},e.ng.core,e.ng.common,e.Rx,e.ng.forms,e.Rx,e.Rx.Observable.prototype,e.ng.animations,e.ng.platformBrowser)}(this,function(e,t,n,r,i,o,s,a,c){"use strict";function l(e){return e||new Pt}function u(){return++wt}function p(e){return e||new Rt}function d(e){return e||new nn}function h(){return"clr-tabs-"+_n++}var g=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),f=function(){return function(){}}();f.decorators=[{type:t.Directive,args:[{selector:"clr-icon"}]}],f.ctorParameters=function(){return[]};var b=[f],y=function(){return function(){}}();y.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],declarations:[b],exports:[b]}]}],y.ctorParameters=function(){return[]};var m={};m.RIGHT_CENTER=0,m.RIGHT_TOP=1,m.RIGHT_BOTTOM=2,m.TOP_CENTER=3,m.TOP_RIGHT=4,m.TOP_LEFT=5,m.BOTTOM_CENTER=6,m.BOTTOM_RIGHT=7,m.BOTTOM_LEFT=8,m.LEFT_CENTER=9,m.LEFT_TOP=10,m.LEFT_BOTTOM=11,m[m.RIGHT_CENTER]="RIGHT_CENTER",m[m.RIGHT_TOP]="RIGHT_TOP",m[m.RIGHT_BOTTOM]="RIGHT_BOTTOM",m[m.TOP_CENTER]="TOP_CENTER",m[m.TOP_RIGHT]="TOP_RIGHT",m[m.TOP_LEFT]="TOP_LEFT",m[m.BOTTOM_CENTER]="BOTTOM_CENTER",m[m.BOTTOM_RIGHT]="BOTTOM_RIGHT",m[m.BOTTOM_LEFT]="BOTTOM_LEFT",m[m.LEFT_CENTER]="LEFT_CENTER",m[m.LEFT_TOP]="LEFT_TOP",m[m.LEFT_BOTTOM]="LEFT_BOTTOM";var v="absolute",C=function(){function e(e){this.element=e,this.scrollableElements=[],this.boundOnScrollListener=this.emitScrollEvent.bind(this),e.style.position=v,e.style.top=0,e.style.bottom="auto",e.style.left=0,e.style.right="auto"}return e.prototype.anchor=function(e,t,n,r){var i=void 0===r?{}:r,o=i.offsetX,s=void 0===o?0:o,a=i.offsetY,c=void 0===a?0:a,l=i.useAnchorParent,u=void 0!==l&&l;this.addScrollEventListeners(e),u&&(e=e.parentNode),e.style.position="static";var p=e.getBoundingClientRect(),d=this.element.getBoundingClientRect(),h=p.left-d.left+s,g=p.top-d.top+c;switch(t){case m.LEFT_TOP:case m.TOP_LEFT:break;case m.TOP_CENTER:h+=p.width/2;break;case m.TOP_RIGHT:case m.RIGHT_TOP:h+=p.width;break;case m.LEFT_BOTTOM:case m.BOTTOM_LEFT:g+=p.height;break;case m.BOTTOM_CENTER:g+=p.height,h+=p.width/2;break;case m.BOTTOM_RIGHT:case m.RIGHT_BOTTOM:g+=p.height,h+=p.width;break;case m.LEFT_CENTER:g+=p.height/2;break;case m.RIGHT_CENTER:g+=p.height/2,h+=p.width}switch(n){case m.LEFT_TOP:case m.TOP_LEFT:break;case m.TOP_CENTER:h-=d.width/2;break;case m.TOP_RIGHT:case m.RIGHT_TOP:h-=d.width;break;case m.LEFT_BOTTOM:case m.BOTTOM_LEFT:g-=d.height;break;case m.BOTTOM_CENTER:g-=d.height,h-=d.width/2;break;case m.BOTTOM_RIGHT:case m.RIGHT_BOTTOM:g-=d.height,h-=d.width;break;case m.LEFT_CENTER:g-=d.height/2;break;case m.RIGHT_CENTER:g-=d.height/2,h-=d.width}var f=getComputedStyle(this.element),b=parseInt(f.marginLeft,10),y=parseInt(f.marginRight,10),v=parseInt(f.marginTop,10),C=parseInt(f.marginBottom,10);switch(t){case m.LEFT_TOP:case m.TOP_LEFT:case m.TOP_RIGHT:case m.RIGHT_TOP:n!==m.BOTTOM_RIGHT&&n!==m.RIGHT_BOTTOM||(g-=C,h-=y),n!==m.BOTTOM_LEFT&&n!==m.LEFT_BOTTOM||(g-=v,h+=b),n!==m.TOP_LEFT&&n!==m.LEFT_TOP||(g+=v,h+=b),n!==m.TOP_RIGHT&&n!==m.RIGHT_TOP||(g+=v,h-=y);break;case m.LEFT_BOTTOM:case m.BOTTOM_LEFT:case m.BOTTOM_RIGHT:case m.RIGHT_BOTTOM:n!==m.BOTTOM_LEFT&&n!==m.LEFT_BOTTOM||(g-=C,h+=b),n!==m.BOTTOM_RIGHT&&n!==m.RIGHT_BOTTOM||(g-=C,h-=y),n!==m.TOP_LEFT&&n!==m.LEFT_TOP||(g+=v,h+=b),n!==m.TOP_RIGHT&&n!==m.RIGHT_TOP||(g+=v,h-=y);break;case m.TOP_CENTER:g-=C,h+=b,h-=y;break;case m.BOTTOM_CENTER:g+=v,h+=b,h-=y;break;case m.LEFT_CENTER:g+=v,g-=C,h-=y;break;case m.RIGHT_CENTER:g+=v,g-=C,h+=b}return this.element.style.transform="translateX("+h+"px) translateY("+g+"px)",this._scroll.asObservable()},e.prototype.release=function(){this.element.style.transform="",this.removeScrollEventListeners()},e.prototype.isPositioned=function(e){var t=getComputedStyle(e).position;return"relative"===t||t===v||"fixed"===t},e.prototype.emitScrollEvent=function(){this._scroll.next()},e.prototype.addScrollEventListeners=function(e){this._scroll=new r.Subject;for(var t=e,n=e;n&&n!==document&&(this.scrolls(n)&&(n.addEventListener("scroll",this.boundOnScrollListener),this.scrollableElements.push(n)),n===t||!this.isPositioned(n));)n=n.parentNode},e.prototype.removeScrollEventListeners=function(){for(var e=0,t=this.scrollableElements;e<t.length;e++){t[e].removeEventListener("scroll",this.boundOnScrollListener)}this.scrollableElements.length=0,this._scroll&&(this._scroll.complete(),delete this._scroll)},e.prototype.scrolls=function(e){var t=getComputedStyle(e);return"scroll"===t.overflowX||"auto"===t.overflowX||"scroll"===t.overflowY||"auto"===t.overflowY},e}(),_=0,P=[],O=function(){function e(e,n){this.templateRef=e,this.viewContainer=n,this.popoverOptions={},this.clrPopoverOldChange=new t.EventEmitter(!1)}return Object.defineProperty(e.prototype,"clrPopoverOld",{set:function(e){var t=this;if(e)this.popoverOptions.allowMultipleOpen?this.createPopover():0===_?this.createPopover():P.push(function(){t.createPopover()});else if(this.viewContainer.clear(),this.destroyPopover(),!this.popoverOptions.allowMultipleOpen&&P.length>0){P.shift()()}},enumerable:!0,configurable:!0}),e.prototype.createPopover=function(){var e=this,t=this.viewContainer.createEmbeddedView(this.templateRef);t.detectChanges();var n=t.rootNodes.filter(function(e){return 1===e.nodeType});this._popoverInstance=new C(n[0]),this._subscription=this._popoverInstance.anchor(this.anchorElem,this.anchorPoint,this.popoverPoint,this.popoverOptions).subscribe(function(){e.clrPopoverOldChange.emit(!1)}),_++},e.prototype.destroyPopover=function(){this._popoverInstance&&(this._subscription.unsubscribe(),this._popoverInstance.release(),delete this._popoverInstance,_--)},e.prototype.ngOnDestroy=function(){this.destroyPopover()},e}();O.decorators=[{type:t.Directive,args:[{selector:"[clrPopoverOld]"}]}],O.ctorParameters=function(){return[{type:t.TemplateRef},{type:t.ViewContainerRef}]},O.propDecorators={anchorElem:[{type:t.Input,args:["clrPopoverOldAnchor"]}],anchorPoint:[{type:t.Input,args:["clrPopoverOldAnchorPoint"]}],popoverPoint:[{type:t.Input,args:["clrPopoverOldPopoverPoint"]}],popoverOptions:[{type:t.Input,args:["clrPopoverOldOptions"]}],clrPopoverOldChange:[{type:t.Output,args:["clrPopoverOldChange"]}],clrPopoverOld:[{type:t.Input}]};var S=[O],T=function(){return function(){}}();T.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],declarations:[S],exports:[S]}]}],T.ctorParameters=function(){return[]};var E=function(){function e(){this._changes=new r.Subject}return Object.defineProperty(e.prototype,"changes",{get:function(){return this._changes.asObservable()},enumerable:!0,configurable:!0}),e.prototype.updateButtonGroup=function(e){this._changes.next(e)},e}();E.decorators=[{type:t.Injectable}],E.ctorParameters=function(){return[]};var w=function(){function e(e){this.buttonInGroupService=e,this._enableService=!1,this._inMenu=!1,this._classNames="btn",this._name=null,this._type=null,this._disabled=null,this._click=new t.EventEmitter(!1)}return Object.defineProperty(e.prototype,"inMenu",{get:function(){return this._inMenu},set:function(e){e=!!e,this._inMenu!==e&&(this._inMenu=e,this._enableService&&this.buttonInGroupService&&this.buttonInGroupService.updateButtonGroup(this))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"classNames",{get:function(){return this._classNames},set:function(e){if("string"==typeof e){var t=e.split(" ");-1===t.indexOf("btn")&&t.push("btn"),this._classNames=t.join(" ")}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},set:function(e){"string"==typeof e&&(this._name=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this._type},set:function(e){"string"==typeof e&&(this._type=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"disabled",{get:function(){return this._disabled},set:function(e){this._disabled=null!==e&&!1!==e?"":null},enumerable:!0,configurable:!0}),e.prototype.emitClick=function(){this._click.emit(!0)},e.prototype.ngAfterViewInit=function(){this._enableService=!0},e}();w.decorators=[{type:t.Component,args:[{selector:"clr-button",template:'\n <ng-template #buttonProjectedRef>\n <button \n [class]="classNames" \n (click)="emitClick()"\n [attr.type]="type"\n [attr.name]="name"\n [attr.disabled]="disabled">\n <ng-content></ng-content>\n </button>\n </ng-template>\n '}]}],w.ctorParameters=function(){return[{type:E,decorators:[{type:t.SkipSelf},{type:t.Optional}]}]},w.propDecorators={templateRef:[{type:t.ViewChild,args:["buttonProjectedRef"]}],inMenu:[{type:t.Input,args:["clrInMenu"]}],classNames:[{type:t.Input,args:["class"]}],name:[{type:t.Input,args:["name"]}],type:[{type:t.Input,args:["type"]}],disabled:[{type:t.Input,args:["disabled"]}],_click:[{type:t.Output,args:["click"]}]};var I=["bottom-left","bottom-right","top-left","top-right","left-bottom","left-top","right-bottom","right-top"],x=function(){function e(e,t){this.buttonGroupNewService=e,this.elementRef=t,this.inlineButtons=[],this.menuButtons=[],this._openMenu=!1,this.anchorPoint=m.BOTTOM_LEFT,this.popoverPoint=m.LEFT_TOP,this._overflowMenuToggleClicked=!1}return e.prototype.ngAfterContentInit=function(){var e=this;this.initializeButtons(),this.buttonGroupNewService.changes.subscribe(function(t){return e.rearrangeButton(t)}),this.buttons.changes.subscribe(function(){e.initializeButtons()})},e.prototype.rearrangeButton=function(e){var t,n;e.inMenu?(t=this.inlineButtons,n=this.menuButtons):(t=this.menuButtons,n=this.inlineButtons);var r=t.indexOf(e);if(r>-1){t.splice(r,1);var i=this.getMoveIndex(e);i<=n.length&&n.splice(i,0,e)}},e.prototype.getMoveIndex=function(e){return this.buttons.filter(function(t){return t.inMenu===e.inMenu}).indexOf(e)},e.prototype.initializeButtons=function(){var e=[],t=[];this.buttons.forEach(function(n){n.inMenu?t.push(n):e.push(n)}),this.inlineButtons=e,this.menuButtons=t},Object.defineProperty(e.prototype,"menuPosition",{get:function(){return this._menuPosition},set:function(e){switch(e&&I.indexOf(e)>-1?this._menuPosition=e:this._menuPosition="bottom-left",this._menuPosition){case"top-right":this.anchorPoint=m.TOP_RIGHT,this.popoverPoint=m.RIGHT_BOTTOM;break;case"top-left":this.anchorPoint=m.TOP_LEFT,this.popoverPoint=m.LEFT_BOTTOM;break;case"bottom-right":this.anchorPoint=m.BOTTOM_RIGHT,this.popoverPoint=m.RIGHT_TOP;break;case"bottom-left":this.anchorPoint=m.BOTTOM_LEFT,this.popoverPoint=m.LEFT_TOP;break;case"right-top":this.anchorPoint=m.RIGHT_TOP,this.popoverPoint=m.LEFT_TOP;break;case"right-bottom":this.anchorPoint=m.RIGHT_BOTTOM,this.popoverPoint=m.LEFT_BOTTOM;break;case"left-top":this.anchorPoint=m.LEFT_TOP,this.popoverPoint=m.RIGHT_TOP;break;case"left-bottom":this.anchorPoint=m.LEFT_BOTTOM,this.popoverPoint=m.RIGHT_BOTTOM;break;default:this.anchorPoint=m.BOTTOM_LEFT,this.popoverPoint=m.LEFT_TOP}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"openMenu",{get:function(){return this._openMenu},set:function(e){this._openMenu=e},enumerable:!0,configurable:!0}),e.prototype.toggleMenu=function(){this.openMenu=!this.openMenu,this._overflowMenuToggleClicked=!0},e.prototype.onMouseClick=function(e){if(this.openMenu&&!this._overflowMenuToggleClicked){this._overflowMenuToggleClicked=!1;var t=e,n=this.elementRef.nativeElement;if(t.classList.contains("dropdown-menu"))for(t=t.parentNode;t;){if(t===document)return void(this.openMenu=!1);if(t===n)return;t=t.parentNode}this.openMenu=!1}this._overflowMenuToggleClicked=!1},e}();x.decorators=[{type:t.Component,args:[{selector:"clr-button-group",template:'\n <ng-container *ngFor="let inlineButton of inlineButtons">\n <ng-template [ngTemplateOutlet]="inlineButton.templateRef"></ng-template>\n </ng-container>\n <ng-container *ngIf="menuButtons.length > 0">\n <div\n class="btn-group-overflow open"\n [ngClass]="menuPosition"\n #anchor>\n <button\n class="btn dropdown-toggle"\n (click)="toggleMenu()">\n <clr-icon shape="ellipsis-horizontal"></clr-icon>\n </button>\n <div\n class="dropdown-menu"\n *clrPopoverOld="openMenu; anchor: anchor; anchorPoint: anchorPoint; popoverPoint: popoverPoint;">\n <ng-template [ngTemplateOutlet]="ref"></ng-template>\n </div>\n </div>\n </ng-container>\n <ng-template #ref>\n <ng-container *ngFor="let menuButton of menuButtons">\n <ng-template [ngTemplateOutlet]="menuButton.templateRef"></ng-template>\n </ng-container>\n </ng-template>\n ',providers:[E],host:{"[class.btn-group]":"true"}}]}],x.ctorParameters=function(){return[{type:E},{type:t.ElementRef}]},x.propDecorators={buttons:[{type:t.ContentChildren,args:[w]}],menuPosition:[{type:t.Input,args:["clrMenuPosition"]}],onMouseClick:[{type:t.HostListener,args:["document:click",["$event.target"]]}]};var A=[w,x],k=function(){return function(){}}();k.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,y,T],declarations:[A],exports:[A]}]}],k.ctorParameters=function(){return[]};var D=function(){function e(){}return e.prototype.startLoading=function(){},e.prototype.doneLoading=function(){},e}(),N=function(){function e(e){this.listener=e,this._loading=!1}return Object.defineProperty(e.prototype,"loading",{get:function(){return this._loading},set:function(e){(e=!!e)!==this._loading&&(this._loading=e,this.listener&&(e?this.listener.startLoading():this.listener.doneLoading()))},enumerable:!0,configurable:!0}),e.prototype.ngOnDestroy=function(){this.loading=!1},e}();N.decorators=[{type:t.Directive,args:[{selector:"[clrLoading]"}]}],N.ctorParameters=function(){return[{type:D,decorators:[{type:t.Optional}]}]},N.propDecorators={loading:[{type:t.Input,args:["clrLoading"]}]};var j=[N],R=function(){return function(){}}();R.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],declarations:[j],exports:[j]}]}],R.ctorParameters=function(){return[]};var L=function(){function e(){}return e.prototype.startLoading=function(){this.loading=!0},e.prototype.doneLoading=function(){this.loading=!1},e}();L.decorators=[{type:t.Component,args:[{selector:"button[clrLoading]",template:'\n <span class="spinner spinner-inline" *ngIf="loading"></span>\n <ng-content></ng-content>\n ',providers:[{provide:D,useExisting:L}]}]}],L.ctorParameters=function(){return[]};var M=[L],z=function(){return function(){}}();z.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,R],declarations:[M],exports:[M,R]}]}],z.ctorParameters=function(){return[]};var B=function(){return function(){}}();B.decorators=[{type:t.NgModule,args:[{exports:[z,k]}]}],B.ctorParameters=function(){return[]};var F=function(){function e(e,t){this._el=e,this.renderer=t,this._highlight=""}return e.prototype.ngAfterContentInit=function(){this.redraw()},e.prototype.redraw=function(){this._el&&this._el.nativeElement&&Prism.highlightElement(this._el.nativeElement)},Object.defineProperty(e.prototype,"highlight",{get:function(){return this._highlight},set:function(e){e&&""!==e.trim()&&(this._highlight=e,this.renderer.addClass(this._el.nativeElement,this._highlight))},enumerable:!0,configurable:!0}),e}();F.decorators=[{type:t.Directive,args:[{selector:"code[clr-code-highlight]"}]}],F.ctorParameters=function(){return[{type:t.ElementRef},{type:t.Renderer2}]},F.propDecorators={highlight:[{type:t.Input,args:["clr-code-highlight"]}]};var V=[F],G=function(){return function(){}}();G.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],declarations:[V],exports:[V]}]}],G.ctorParameters=function(){return[]};var H=function(){return function(){}}();H.decorators=[{type:t.NgModule,args:[{exports:[G]}]}],H.ctorParameters=function(){return[]};var W=0,U=function(){function e(){this._id=(W++).toString(),this.name=null,this.disabled=!1,this.inline=!1,this._checked=!1,this._indeterminate=!1,this.indeterminateChange=new t.EventEmitter(!1),this.change=new t.EventEmitter(!1),this.onChangeCallback=function(e){},this.onTouchedCallback=function(){}}return Object.defineProperty(e.prototype,"id",{get:function(){return"clr-checkbox-"+this._id},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"checked",{get:function(){return this._checked},set:function(e){e!==this._checked&&(this._indeterminate&&this.setIndeterminate(!1),this.setChecked(e))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"indeterminate",{get:function(){return this._indeterminate},set:function(e){this._indeterminate!==e&&(this._checked&&this.setChecked(!1),this.setIndeterminate(e))},enumerable:!0,configurable:!0}),e.prototype.setIndeterminate=function(e){this._indeterminate=e,this.indeterminateChange.emit(this._indeterminate)},e.prototype.setChecked=function(e){this._checked=e,this.change.emit(this._checked)},e.prototype.toggle=function(){this.checked=!this.checked,this.onChangeCallback(this.checked)},e.prototype.writeValue=function(e){null===e&&(e=!1),e!==this.checked&&(this.checked=e)},e.prototype.registerOnChange=function(e){this.onChangeCallback=e},e.prototype.registerOnTouched=function(e){this.onTouchedCallback=e},e.prototype.touch=function(){this.onTouchedCallback()},e.prototype.checkIndeterminateState=function(){this.disabled||this.toggle()},e}();U.decorators=[{type:t.Component,args:[{selector:"clr-checkbox",template:'\n \x3c!--\n FIXME: We are not subscribed to the change event but the click event here.\n The reason for that is because checkboxes behave differently on IE & Edge.\n https://stackoverflow.com/a/19447939\n \n To fix that, we listen to every click event and then toggle the checkbox manually\n to make it behave the same way across the browsers we support.\n \n This works for cases when users toggle the checkbox using the keyboard too:\n https://stackoverflow.com/questions/27878940/spacebar-triggering-click-event-on-checkbox\n --\x3e\n <input type="checkbox" [id]="id" [name]="name" [checked]="checked"\n [indeterminate]="indeterminate" [disabled]="disabled"\n (blur)="touch()" (click)="checkIndeterminateState()">\n <label [attr.for]="id">\n <ng-content></ng-content>\n </label>\n ',host:{"[class.checkbox]":"!inline","[class.checkbox-inline]":"inline","[class.disabled]":"disabled"},providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:t.forwardRef(function(){return U}),multi:!0}]}]}],U.ctorParameters=function(){return[]},U.propDecorators={_id:[{type:t.Input,args:["id"]}],name:[{type:t.Input,args:["name"]}],disabled:[{type:t.Input,args:["clrDisabled"]}],inline:[{type:t.Input,args:["clrInline"]}],checked:[{type:t.Input,args:["clrChecked"]}],indeterminate:[{type:t.Input,args:["clrIndeterminate"]}],indeterminateChange:[{type:t.Output,args:["clrIndeterminateChange"]}],change:[{type:t.Output,args:["clrCheckedChange"]}]};var X=[U],Y=function(){return function(){}}();Y.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],declarations:[X],exports:[X]}]}],Y.ctorParameters=function(){return[]};var q=function(){function e(){this.expandable=0,this.replace=!1,this._loading=!1,this._expanded=!1,this._animate=new r.Subject,this._expandChange=new r.Subject}return Object.defineProperty(e.prototype,"loading",{get:function(){return this._loading},set:function(e){(e=!!e)!==this._loading&&(this._loading=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"expanded",{get:function(){return this._expanded},set:function(e){(e=!!e)!==this._expanded&&(this._expanded=e,this._animate.next(),this._expandChange.next(e))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"animate",{get:function(){return this._animate.asObservable()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"expandChange",{get:function(){return this._expandChange.asObservable()},enumerable:!0,configurable:!0}),e.prototype.startLoading=function(){this.loading=!0},e.prototype.doneLoading=function(){this.loading=!1,this._animate.next()},e}();q.decorators=[{type:t.Injectable}],q.ctorParameters=function(){return[]};var $=function(){function e(e,n,r){var i=this;this.template=e,this.container=n,this.expand=r,this._expanded=!1,this.expandedChange=new t.EventEmitter(!0),this._subscriptions=[],r.expandable++,this._subscriptions.push(r.expandChange.subscribe(function(){i.updateView(),i.expandedChange.emit(i.expand.expanded)}))}return Object.defineProperty(e.prototype,"expanded",{get:function(){return this._expanded},set:function(e){"boolean"==typeof e&&(this.expand.expanded=e,this._expanded=e)},enumerable:!0,configurable:!0}),e.prototype.updateView=function(){this.expand.expanded&&0!==this.container.length||(this.expand.expanded?this.container.createEmbeddedView(this.template):this.container.clear())},e.prototype.ngOnInit=function(){this.updateView()},e.prototype.ngOnDestroy=function(){this.expand.expandable--,this._subscriptions.forEach(function(e){return e.unsubscribe()})},e}();$.decorators=[{type:t.Directive,args:[{selector:"[clrIfExpanded]"}]}],$.ctorParameters=function(){return[{type:t.TemplateRef},{type:t.ViewContainerRef},{type:q}]},$.propDecorators={expanded:[{type:t.Input,args:["clrIfExpanded"]}],expandedChange:[{type:t.Output,args:["clrIfExpandedChange"]}]};var K=[$],Z=function(){return function(){}}();Z.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],declarations:[K],exports:[K]}]}],Z.ctorParameters=function(){return[]};var Q=function(){function e(e){this.el=e,this.strict=!1,this.outsideClick=new t.EventEmitter(!1)}return e.prototype.documentClick=function(e){var t=e.target,n=this.el.nativeElement;t!==n&&(!this.strict&&n.contains(t)||this.outsideClick.emit(e))},e}();Q.decorators=[{type:t.Directive,args:[{selector:"[clrOutsideClick]"}]}],Q.ctorParameters=function(){return[{type:t.ElementRef}]},Q.propDecorators={strict:[{type:t.Input,args:["clrStrict"]}],outsideClick:[{type:t.Output,args:["clrOutsideClick"]}],documentClick:[{type:t.HostListener,args:["document:click",["$event"]]}]};var J=[Q],ee=function(){return function(){}}();ee.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],declarations:[J],exports:[J]}]}],ee.ctorParameters=function(){return[]};var te=function(){function e(){}return e.prototype.userDefinedWidth=function(e){e.classList.add("datagrid-cell-width-zero");var t=parseInt(getComputedStyle(e).getPropertyValue("width"),10);return e.classList.remove("datagrid-cell-width-zero"),t},e.prototype.scrollBarWidth=function(e){return e.offsetWidth-e.clientWidth},e.prototype.scrollWidth=function(e){return e.scrollWidth||0},e.prototype.computedHeight=function(e){return parseInt(getComputedStyle(e).getPropertyValue("height"),10)},e.prototype.clientRectRight=function(e){return parseInt(e.getBoundingClientRect().right,10)},e.prototype.clientRectWidth=function(e){return parseInt(e.getBoundingClientRect().width,10)},e.prototype.minWidth=function(e){return parseInt(getComputedStyle(e).getPropertyValue("min-width"),10)},e.prototype.focus=function(e){e.focus()},e}();te.decorators=[{type:t.Injectable}],te.ctorParameters=function(){return[]};var ne=function(){function e(){this.alreadySized=!1,this.widths=[],this._noLayout=new r.Subject,this._clearWidths=new r.Subject,this._detectStrictWidths=new r.Subject,this._tableMode=new r.Subject,this._computeWidths=new r.Subject,this._alignColumns=new r.Subject,this.scrollbar=new r.Subject,this.scrollbarWidth=new r.Subject,this._done=new r.Subject}return Object.defineProperty(e.prototype,"noLayout",{get:function(){return this._noLayout.asObservable()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"clearWidths",{get:function(){return this._clearWidths.asObservable()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"detectStrictWidths",{get:function(){return this._detectStrictWidths.asObservable()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tableMode",{get:function(){return this._tableMode.asObservable()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"computeWidths",{get:function(){return this._computeWidths.asObservable()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alignColumns",{get:function(){return this._alignColumns.asObservable()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"done",{get:function(){return this._done.asObservable()},enumerable:!0,configurable:!0}),e.prototype.resize=function(){this.widths.length=0,this._noLayout.next(!0),this.alreadySized&&this._clearWidths.next(),this._detectStrictWidths.next(),this._tableMode.next(!0),this._computeWidths.next(),this._tableMode.next(!1),this._alignColumns.next(),this._noLayout.next(!1),this.scrollbar.next(),this.alreadySized=!0,this._done.next()},e}();ne.decorators=[{type:t.Injectable}],ne.ctorParameters=function(){return[]};var re=function(){function e(e,t,n,r,i){var o=this;this.el=e,this.domAdapter=t,this.renderer=n,this.expand=r,this.renderOrganizer=i,r.animate.subscribe(function(){o.oldHeight?setTimeout(function(){return o.run()}):o.animate()})}return e.prototype.animate=function(){var e=this;this.el.nativeElement.animate&&(this.running&&this.running.finish(),this.oldHeight=this.domAdapter.computedHeight(this.el.nativeElement),this.renderer.setStyle(this.el.nativeElement,"height",this.oldHeight+"px"),this.renderer.setStyle(this.el.nativeElement,"overflow-y","hidden"),setTimeout(function(){e.expand.loading||e.run()}))},e.prototype.run=function(){var e=this;this.renderer.setStyle(this.el.nativeElement,"height",null),this.renderOrganizer.scrollbar.next();var t=this.domAdapter.computedHeight(this.el.nativeElement);this.running=this.el.nativeElement.animate({height:[this.oldHeight+"px",t+"px"],overflowY:["hidden","hidden"],easing:"ease-in-out"},{duration:200}),this.running.onfinish=function(){e.renderer.setStyle(e.el.nativeElement,"overflow-y",null),delete e.running},delete this.oldHeight},e}();re.decorators=[{type:t.Directive,args:[{selector:"clr-dg-row"}]}],re.ctorParameters=function(){return[{type:t.ElementRef},{type:te},{type:t.Renderer2},{type:q},{type:ne}]};var ie=function(){return function(){}}(),oe=function(){function e(){this._change=new r.Subject,this.nbChanges=0}return Object.defineProperty(e.prototype,"change",{get:function(){return this._change.asObservable()},enumerable:!0,configurable:!0}),e.prototype.changeStart=function(){this.nbChanges++},e.prototype.changeDone=function(){0==--this.nbChanges&&this._change.next()},e}();oe.decorators=[{type:t.Injectable}],oe.ctorParameters=function(){return[]};var se=function(){function e(e){this.stateDebouncer=e,this._size=0,this._totalItems=0,this._change=new r.Subject,this._sizeChange=new r.Subject,this._current=1}return Object.defineProperty(e.prototype,"size",{get:function(){return this._size},set:function(e){var t=this._size;e!==t&&(this._size=e,this._current=Math.floor(t/e*(this._current-1))+1,this._change.next(this._current),this._sizeChange.next(this._size))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"totalItems",{get:function(){return this._totalItems},set:function(e){this._totalItems=e,this.current>this.last&&(this.current=this.last)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"last",{get:function(){return this._last?this._last:this.size>0&&this.totalItems?Math.ceil(this.totalItems/this.size):1},set:function(e){this._last=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"change",{get:function(){return this._change.asObservable()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sizeChange",{get:function(){return this._sizeChange.asObservable()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"current",{get:function(){return this._current},set:function(e){e!==this._current&&(this.stateDebouncer.changeStart(),this._current=e,this._change.next(e),this.stateDebouncer.changeDone())},enumerable:!0,configurable:!0}),e.prototype.previous=function(){this.current>1&&this.current--},e.prototype.next=function(){this.current<this.last&&this.current++},Object.defineProperty(e.prototype,"firstItem",{get:function(){return 0===this.size?0:(this.current-1)*this.size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastItem",{get:function(){if(0===this.size)return this.totalItems-1;var e=this.current*this.size-1;return this.totalItems&&(e=Math.min(e,this.totalItems-1)),e},enumerable:!0,configurable:!0}),e}();se.decorators=[{type:t.Injectable}],se.ctorParameters=function(){return[{type:oe}]};var ae=function(){function e(e,t){this._page=e,this.stateDebouncer=t,this._change=new r.Subject,this._all=[]}return Object.defineProperty(e.prototype,"change",{get:function(){return this._change.asObservable()},enumerable:!0,configurable:!0}),e.prototype.hasActiveFilters=function(){for(var e=0,t=this._all;e<t.length;e++){var n=t[e].filter;if(n&&n.isActive())return!0}return!1},e.prototype.getActiveFilters=function(){for(var e=[],t=0,n=this._all;t<n.length;t++){var r=n[t].filter;r&&r.isActive()&&e.push(r)}return e},e.prototype.add=function(e){var t=this,n=this._all.length,r=e.changes.subscribe(function(){return t.resetPageAndEmitFilterChange([e])}),i=!1,o=new ce(e,function(){i||(r.unsubscribe(),t._all.splice(n,1),e.isActive()&&t.resetPageAndEmitFilterChange([]),i=!0)});return this._all.push(o),e.isActive()&&this.resetPageAndEmitFilterChange([e]),o},e.prototype.accepts=function(e){for(var t=0,n=this._all;t<n.length;t++){var r=n[t].filter;if(r&&r.isActive()&&!r.accepts(e))return!1}return!0},e.prototype.resetPageAndEmitFilterChange=function(e){this.stateDebouncer.changeStart(),this._page.current=1,this._change.next(e),this.stateDebouncer.changeDone()},e}();ae.decorators=[{type:t.Injectable}],ae.ctorParameters=function(){return[{type:se},{type:oe}]};var ce=function(){return function(e,t){this.filter=e,this.unregister=t}}(),le=function(){function e(e){this.filters=e}return Object.defineProperty(e.prototype,"filter",{get:function(){return this.registered&&this.registered.filter},enumerable:!0,configurable:!0}),e.prototype.setFilter=function(e){this.deleteFilter(),e instanceof ce?this.registered=e:e&&(this.registered=this.filters.add(e))},e.prototype.deleteFilter=function(){this.registered&&(this.registered.unregister(),delete this.registered)},e.prototype.ngOnDestroy=function(){this.deleteFilter()},e}(),ue=function(e){function n(n){var r=e.call(this,n)||this;return r.anchorPoint=m.RIGHT_BOTTOM,r.popoverPoint=m.RIGHT_TOP,r.popoverOptions={allowMultipleOpen:!0},r._open=!1,r.openChanged=new t.EventEmitter(!1),r}return g(n,e),Object.defineProperty(n.prototype,"open",{get:function(){return this._open},set:function(e){var t=!!e;t!==this._open&&(this._open=t,this.openChanged.emit(t))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"customFilter",{set:function(e){this.setFilter(e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"active",{get:function(){return!!this.filter&&this.filter.isActive()},enumerable:!0,configurable:!0}),n.prototype.toggle=function(){this.open=!this.open},n}(le);ue.decorators=[{type:t.Component,args:[{selector:"clr-dg-filter",providers:[{provide:ie,useExisting:ue}],template:'\n <button #anchor class="datagrid-filter-toggle" (click)="toggle()"\n [class.datagrid-filter-open]="open" [class.datagrid-filtered]="active"\n type="button"></button>\n\n <ng-template [(clrPopoverOld)]="open" [clrPopoverOldAnchor]="anchor" [clrPopoverOldAnchorPoint]="anchorPoint"\n [clrPopoverOldPopoverPoint]="popoverPoint" [clrPopoverOldOptions]="popoverOptions">\n <div class="datagrid-filter">\n \x3c!-- FIXME: this whole filter part needs a final design before we can try to have a cleaner DOM --\x3e\n <div class="datagrid-filter-close-wrapper">\n <button type="button" class="close" \n aria-label="Close" (click)="open = false"\n type="button">\n <clr-icon aria-hidden="true" shape="close"></clr-icon>\n </button>\n </div>\n \n <ng-content></ng-content>\n </div>\n </ng-template>\n '}]}],ue.ctorParameters=function(){return[{type:ae}]},ue.propDecorators={open:[{type:t.Input,args:["clrDgFilterOpen"]}],openChanged:[{type:t.Output,args:["clrDgFilterOpenChange"]}],customFilter:[{type:t.Input,args:["clrDgFilter"]}]};var pe=function(){function e(e){this.filterFn=e,this._changes=new r.Subject,this._rawValue="",this._lowerCaseValue=""}return Object.defineProperty(e.prototype,"changes",{get:function(){return this._changes.asObservable()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._rawValue},set:function(e){e||(e=""),e!==this._rawValue&&(this._rawValue=e,this._lowerCaseValue=e.toLowerCase().trim(),this._changes.next(e))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lowerCaseValue",{get:function(){return this._lowerCaseValue},enumerable:!0,configurable:!0}),e.prototype.isActive=function(){return!!this.value},e.prototype.accepts=function(e){return this.filterFn.accepts(e,this.lowerCaseValue)},e}(),de=function(e){function n(n,r,i){var o=e.call(this,r)||this;return o.renderer=n,o.domAdapter=i,o.open=!1,o.filterValueChange=new t.EventEmitter,o}return g(n,e),Object.defineProperty(n.prototype,"customStringFilter",{set:function(e){e instanceof ce?this.setFilter(e):this.setFilter(new pe(e))},enumerable:!0,configurable:!0}),n.prototype.ngAfterViewInit=function(){var e=this;this.filterContainer.openChanged.subscribe(function(t){t&&setTimeout(function(){e.domAdapter.focus(e.input.nativeElement)})})},Object.defineProperty(n.prototype,"value",{get:function(){return this.filter.value},set:function(e){this.filter&&(e||(e=""),e!==this.filter.value&&(this.filter.value=e,this.filterValueChange.emit(e)))},enumerable:!0,configurable:!0}),n.prototype.close=function(){this.open=!1},n}(le);de.decorators=[{type:t.Component,args:[{selector:"clr-dg-string-filter",providers:[{provide:ie,useExisting:de}],template:'\n <clr-dg-filter [clrDgFilter]="registered" [(clrDgFilterOpen)]="open">\n \x3c!--\n Even though this *ngIf looks useless because the filter container already has one,\n it prevents NgControlStatus and other directives automatically added by Angular\n on inputs with NgModel from freaking out because of their host binding changing\n mid-change detection when the input is destroyed.\n --\x3e\n <input #input type="text" name="search" [(ngModel)]="value" *ngIf="open"\n (keyup.enter)="close()" (keyup.escape)="close()"/>\n </clr-dg-filter>\n '}]}],de.ctorParameters=function(){return[{type:t.Renderer2},{type:ae},{type:te}]},de.propDecorators={customStringFilter:[{type:t.Input,args:["clrDgStringFilter"]}],input:[{type:t.ViewChild,args:["input"]}],filterContainer:[{type:t.ViewChild,args:[ue]}],value:[{type:t.Input,args:["clrFilterValue"]}],filterValueChange:[{type:t.Output,args:["clrFilterValueChange"]}]};var he=function(){function e(e,t){var n=this;this.subscription=t.chocolate.subscribe(function(){n.latestFlavor!==n.flavor&&e.detectChanges()})}return e.prototype.flavor=function(){},e.prototype.ngAfterContentChecked=function(){this.latestFlavor=this.flavor},e.prototype.ngOnDestroy=function(){this.subscription.unsubscribe()},e}(),ge=function(){function e(){this.actionableCount=0}return e.prototype.register=function(){this.actionableCount++},e.prototype.unregister=function(){this.actionableCount--},Object.defineProperty(e.prototype,"hasActionableRow",{get:function(){return this.actionableCount>0},enumerable:!0,configurable:!0}),e}();ge.decorators=[{type:t.Injectable}],ge.ctorParameters=function(){return[]};var fe=function(){function e(){this._chocolate=new r.Subject}return Object.defineProperty(e.prototype,"chocolate",{get:function(){return this._chocolate.asObservable()},enumerable:!0,configurable:!0}),e.prototype.ngAfterViewChecked=function(){this._chocolate.next()},e}(),be=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return g(t,e),t}(fe);be.decorators=[{type:t.Directive,args:[{selector:"clr-datagrid"}]}],be.ctorParameters=function(){return[]};var ye=function(e){function t(t,n,r){var i=this;if(!n)throw new Error("clr-dg-row should only be used inside of a clr-datagrid");return i=e.call(this,t,n)||this,i.rowActions=r,i}return g(t,e),Object.defineProperty(t.prototype,"flavor",{get:function(){return this.rowActions.hasActionableRow},enumerable:!0,configurable:!0}),t}(he);ye.decorators=[{type:t.Directive,args:[{selector:"clr-datagrid, clr-dg-row"}]}],ye.ctorParameters=function(){return[{type:t.ChangeDetectorRef},{type:be,decorators:[{type:t.Optional}]},{type:ge}]};var me=function(){function e(){this.expandableCount=0}return e.prototype.register=function(){this.expandableCount++},e.prototype.unregister=function(){this.expandableCount--},Object.defineProperty(e.prototype,"hasExpandableRow",{get:function(){return this.expandableCount>0},enumerable:!0,configurable:!0}),e}();me.decorators=[{type:t.Injectable}],me.ctorParameters=function(){return[]};var ve=function(e){function t(t,n,r){var i=this;if(!n)throw new Error("clr-dg-row should only be used inside of a clr-datagrid");return i=e.call(this,t,n)||this,i.expandableCount=r,i}return g(t,e),Object.defineProperty(t.prototype,"flavor",{get:function(){return this.expandableCount.hasExpandableRow},enumerable:!0,configurable:!0}),t}(he);ve.decorators=[{type:t.Directive,args:[{selector:"clr-datagrid, clr-dg-row"}]}],ve.ctorParameters=function(){return[{type:t.ChangeDetectorRef},{type:be,decorators:[{type:t.Optional}]},{type:me}]};var Ce=function(){function e(e){this.prop=e,e.indexOf(".")>=0&&(this.splitProp=e.split("."))}return e.prototype.getPropValue=function(e){if(this.splitProp){for(var t=e,n=0,r=this.splitProp;n<r.length;n++){var i=r[n];if(null==t||void 0===t||"undefined"==typeof t[i])return undefined;t=t[i]}return t}return e[this.prop]},e}(),_e=function(){function e(e){this.prop=e,this.nestedProp=new Ce(e)}return e.prototype.compare=function(e,t){var n=this.nestedProp.getPropValue(e),r=this.nestedProp.getPropValue(t);return"string"==typeof n&&(n=n.toLowerCase()),"string"==typeof r&&(r=r.toLowerCase()),void 0===n||null===n?void 0===r||null===r?0:1:void 0===r||null===r?-1:n<r?-1:n>r?1:0},e}(),Pe=function(){function e(e,t){void 0===t&&(t=!1),this.prop=e,this.exact=t,this.nestedProp=new Ce(e)}return e.prototype.accepts=function(e,t){var n=this.nestedProp.getPropValue(e);return void 0!==n&&(this.exact?(""+n).toLowerCase()===t:(""+n).toLowerCase().indexOf(t)>=0)},e}(),Oe={};Oe.Unsorted=0,Oe.Asc=1,Oe.Desc=-1,Oe[Oe.Unsorted]="Unsorted",Oe[Oe.Asc]="Asc",Oe[Oe.Desc]="Desc";var Se=function(){function e(e,t){this._ngZone=e,this._renderer=t,this._onDragStart=new r.Subject,this._onDragMove=new r.Subject,this._onDragEnd=new r.Subject}return Object.defineProperty(e.prototype,"onDragStart",{get:function(){return this._onDragStart},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onDragMove",{get:function(){return this._onDragMove},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onDragEnd",{get:function(){return this._onDragEnd},enumerable:!0,configurable:!0}),e.prototype.addDragListener=function(){var e=this.handleRef.nativeElement;this._listeners=[this.customDragEvent(e,"mousedown","mousemove","mouseup"),this.customDragEvent(e,"touchstart","touchmove","touchend")]},e.prototype.customDragEvent=function(e,t,n,r){var i,o,s=this;return this._renderer.listen(e,t,function(e){s.notifyDragStart(e),i=s._ngZone.runOutsideAngular(function(){return s._renderer.listen("document",n,function(e){s.notifyDragMove(e)})}),o=s._renderer.listen("document",r,function(e){i(),s.notifyDragEnd(e),o()})})},e.prototype.notifyDragStart=function(e){return this._onDragStart.next(e)},e.prototype.notifyDragMove=function(e){return this._onDragMove.next(e)},e.prototype.notifyDragEnd=function(e){return this._onDragEnd.next(e)},e.prototype.destroy=function(){this._listeners.map(function(e){return e()})},e}();Se.decorators=[{type:t.Injectable}],Se.ctorParameters=function(){return[{type:t.NgZone},{type:t.Renderer2}]};var Te=function(){function e(e){this.stateDebouncer=e,this._reverse=!1,this._change=new r.Subject}return Object.defineProperty(e.prototype,"comparator",{get:function(){return this._comparator},set:function(e){this.stateDebouncer.changeStart(),this._comparator=e,this.emitChange(),this.stateDebouncer.changeDone()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"reverse",{get:function(){return this._reverse},set:function(e){this.stateDebouncer.changeStart(),this._reverse=e,this.emitChange(),this.stateDebouncer.changeDone()},enumerable:!0,configurable:!0}),e.prototype.emitChange=function(){this._change.next(this)},Object.defineProperty(e.prototype,"change",{get:function(){return this._change.asObservable()},enumerable:!0,configurable:!0}),e.prototype.toggle=function(e,t){this.stateDebouncer.changeStart(),this.comparator===e?this._reverse=void 0!==t?t||!this._reverse:!this._reverse:(this._comparator=e,this._reverse=void 0!==t&&t),this.emitChange(),this.stateDebouncer.changeDone()},e.prototype.clear=function(){this.comparator=null},e.prototype.compare=function(e,t){return(this.reverse?-1:1)*this.comparator.compare(e,t)},e}();Te.decorators=[{type:t.Injectable}],Te.ctorParameters=function(){return[{type:oe}]};var Ee=0,we=function(e){function n(n,r,i){var o=e.call(this,r)||this;return o._sort=n,o._dragDispatcher=i,o._sorted=!1,o.sortedChange=new t.EventEmitter,o._sortOrder=Oe.Unsorted,o.sortOrderChange=new t.EventEmitter,o.customFilter=!1,o.filterValueChange=new t.EventEmitter,o._sortSubscription=n.change.subscribe(function(e){o.sortOrder!==Oe.Unsorted&&e.comparator!==o._sortBy&&(o._sortOrder=Oe.Unsorted,o.sortOrderChange.emit(o._sortOrder)),o.sorted&&e.comparator!==o._sortBy&&(o._sorted=!1,o.sortedChange.emit(!1))}),o.columnId="dg-col-"+Ee.toString(),Ee++,o}return g(n,e),Object.defineProperty(n.prototype,"hidden",{get:function(){return!!this.hideable&&this.hideable.hidden},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"handleElRef",{set:function(e){this._dragDispatcher.handleRef=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"handleTrackerElRef",{set:function(e){this._dragDispatcher.handleTrackerRef=e},enumerable:!0,configurable:!0}),n.prototype.ngOnDestroy=function(){this._sortSubscription.unsubscribe()},Object.defineProperty(n.prototype,"field",{get:function(){return this._field},set:function(e){"string"==typeof e&&(this._field=e,this.customFilter||this.setFilter(new pe(new Pe(e))),this._sortBy||(this._sortBy=new _e(e)))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"sortBy",{get:function(){return this._sortBy},set:function(e){"string"==typeof e?this._sortBy=new _e(e):e?this._sortBy=e:this._field?this._sortBy=new _e(this._field):delete this._sortBy},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"sortable",{get:function(){return!!this._sortBy},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"sorted",{get:function(){return this._sorted},set:function(e){!e&&this.sorted?(this._sorted=!1,this._sort.clear()):e&&!this.sorted&&this.sort()},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"sortOrder",{get:function(){return this._sortOrder},set:function(e){if(void 0!==e&&this._sortOrder!==e)switch(e){default:case Oe.Unsorted:this._sort.clear();break;case Oe.Asc:this.sort(!1);break;case Oe.Desc:this.sort(!0)}},enumerable:!0,configurable:!0}),n.prototype.sort=function(e){this.sortable&&(this._sort.toggle(this._sortBy,e),this._sortOrder=this._sort.reverse?Oe.Desc:Oe.Asc,this.sortOrderChange.emit(this._sortOrder),this._sorted=!0,this.sortedChange.emit(!0))},Object.defineProperty(n.prototype,"asc",{get:function(){return"undefined"==typeof this.sortOrder?this.sorted&&!this._sort.reverse:this.sortOrder===Oe.Asc},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"desc",{get:function(){return"undefined"==typeof this.sortOrder?this.sorted&&this._sort.reverse:this.sortOrder===Oe.Desc},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"projectedFilter",{set:function(e){e&&(this.deleteFilter(),this.customFilter=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"filterValue",{get:function(){return this.filter.value},set:function(e){this.filter&&(e||(e=""),e!==this.filter.value&&(this.filter.value=e,this.filterValueChange.emit(e)))},enumerable:!0,configurable:!0}),n}(le);we.decorators=[{type:t.Component,args:[{selector:"clr-dg-column",template:'\n <div class="datagrid-column-flex">\n \x3c!-- I\'m really not happy with that select since it\'s not very scalable --\x3e\n <ng-content select="clr-dg-filter, clr-dg-string-filter"></ng-content>\n\n <clr-dg-string-filter\n *ngIf="field && !customFilter"\n [clrDgStringFilter]="registered"\n [(clrFilterValue)]="filterValue"></clr-dg-string-filter>\n\n <ng-template #columnTitle><ng-content></ng-content></ng-template>\n\n <button class="datagrid-column-title" *ngIf="sortable" (click)="sort()" type="button">\n <ng-container *ngTemplateOutlet="columnTitle"></ng-container>\n </button>\n\n <span class="datagrid-column-title" *ngIf="!sortable">\n <ng-container *ngTemplateOutlet="columnTitle"></ng-container>\n </span>\n\n <div class="datagrid-column-separator">\n <button #columnHandle class="datagrid-column-handle" tabindex="-1" type="button"></button>\n <div #columnHandleTracker class="datagrid-column-handle-tracker"></div>\n </div>\n </div>\n ',host:{"[class.datagrid-column]":"true","[class.datagrid-column--hidden]":"hidden"}}]}],we.ctorParameters=function(){return[{type:Te},{type:ae},{type:Se}]},we.propDecorators={handleElRef:[{type:t.ViewChild,args:["columnHandle"]}],handleTrackerElRef:[{type:t.ViewChild,args:["columnHandleTracker"]}],field:[{type:t.Input,args:["clrDgField"]}],sortBy:[{type:t.Input,args:["clrDgSortBy"]}],sorted:[{type:t.Input,args:["clrDgSorted"]}],sortedChange:[{type:t.Output,args:["clrDgSortedChange"]}],sortOrder:[{type:t.Input,args:["clrDgSortOrder"]}],sortOrderChange:[{type:t.Output,args:["clrDgSortOrderChange"]}],asc:[{type:t.HostBinding,args:["class.asc"]}],desc:[{type:t.HostBinding,args:["class.desc"]}],projectedFilter:[{type:t.ContentChild,args:[ie]}],filterValue:[{type:t.Input,args:["clrFilterValue"]}],filterValueChange:[{type:t.Output,args:["clrFilterValueChange"]}]};var Ie=function(){function e(e,t,n){this._filters=e,this._sort=t,this._page=n,this.loading=!1,this.trackBy=function(e,t){return t},this._smart=!1,this._displayed=[],this._change=new r.Subject,this._allChanges=new r.Subject}return e.prototype.destroy=function(){this._filtersSub&&this._filtersSub.unsubscribe(),this._sortSub&&this._sortSub.unsubscribe(),this._pageSub&&this._pageSub.unsubscribe()},Object.defineProperty(e.prototype,"smart",{get:function(){return this._smart},enumerable:!0,configurable:!0}),e.prototype.smartenUp=function(){var e=this;this._smart=!0,this._filtersSub=this._filters.change.subscribe(function(){return e._filterItems()}),this._sortSub=this._sort.change.subscribe(function(){e._sort.comparator?e._sortItems():e._filterItems()}),this._pageSub=this._page.change.subscribe(function(){return e._changePage()})},Object.defineProperty(e.prototype,"all",{set:function(e){this.smart?(this._all=e,this.emitAllChanges(),this._filterItems()):(this._displayed=e,this.emitChange())},enumerable:!0,configurable:!0}),e.prototype.refresh=function(){this.smart&&this._filterItems()},Object.defineProperty(e.prototype,"displayed",{get:function(){return this._displayed},enumerable:!0,configurable:!0}),e.prototype.emitChange=function(){this._change.next(this.displayed)},Object.defineProperty(e.prototype,"change",{get:function(){return this._change.asObservable()},enumerable:!0,configurable:!0}),e.prototype.emitAllChanges=function(){this.smart&&this._allChanges.next(this._all)},Object.defineProperty(e.prototype,"allChanges",{get:function(){return this._allChanges.asObservable()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"uninitialized",{get:function(){return!this._all},enumerable:!0,configurable:!0}),e.prototype._filterItems=function(){var e=this;this.uninitialized||(this._filters.hasActiveFilters()?this._filtered=this._all.filter(function(t){return e._filters.accepts(t)}):this._filtered=this._all.slice(),this._page.totalItems=this._filtered.length,this._s