UNPKG

clarity-angular

Version:

Angular components for Clarity

1 lines 216 kB
!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";var l,u=this&&this.__extends||(l=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])},function(e,t){function n(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),p=function(){return function(){}}();p.decorators=[{type:t.Directive,args:[{selector:"clr-icon"}]}],p.ctorParameters=function(){return[]};var d=[p],h=function(){return function(){}}();h.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],declarations:[d],exports:[d]}]}],h.ctorParameters=function(){return[]};var g={RIGHT_CENTER:0,RIGHT_TOP:1,RIGHT_BOTTOM:2,TOP_CENTER:3,TOP_RIGHT:4,TOP_LEFT:5,BOTTOM_CENTER:6,BOTTOM_RIGHT:7,BOTTOM_LEFT:8,LEFT_CENTER:9,LEFT_TOP:10,LEFT_BOTTOM:11};g[g.RIGHT_CENTER]="RIGHT_CENTER",g[g.RIGHT_TOP]="RIGHT_TOP",g[g.RIGHT_BOTTOM]="RIGHT_BOTTOM",g[g.TOP_CENTER]="TOP_CENTER",g[g.TOP_RIGHT]="TOP_RIGHT",g[g.TOP_LEFT]="TOP_LEFT",g[g.BOTTOM_CENTER]="BOTTOM_CENTER",g[g.BOTTOM_RIGHT]="BOTTOM_RIGHT",g[g.BOTTOM_LEFT]="BOTTOM_LEFT",g[g.LEFT_CENTER]="LEFT_CENTER",g[g.LEFT_TOP]="LEFT_TOP",g[g.LEFT_BOTTOM]="LEFT_BOTTOM";var f="absolute",b="scroll",y="auto",m=function(){function e(e){this.element=e,this.scrollableElements=[],this.boundOnScrollListener=this.emitScrollEvent.bind(this),e.style.position=f,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,f=p.top-d.top+c;switch(t){case g.LEFT_TOP:case g.TOP_LEFT:break;case g.TOP_CENTER:h+=p.width/2;break;case g.TOP_RIGHT:case g.RIGHT_TOP:h+=p.width;break;case g.LEFT_BOTTOM:case g.BOTTOM_LEFT:f+=p.height;break;case g.BOTTOM_CENTER:f+=p.height,h+=p.width/2;break;case g.BOTTOM_RIGHT:case g.RIGHT_BOTTOM:f+=p.height,h+=p.width;break;case g.LEFT_CENTER:f+=p.height/2;break;case g.RIGHT_CENTER:f+=p.height/2,h+=p.width}switch(n){case g.LEFT_TOP:case g.TOP_LEFT:break;case g.TOP_CENTER:h-=d.width/2;break;case g.TOP_RIGHT:case g.RIGHT_TOP:h-=d.width;break;case g.LEFT_BOTTOM:case g.BOTTOM_LEFT:f-=d.height;break;case g.BOTTOM_CENTER:f-=d.height,h-=d.width/2;break;case g.BOTTOM_RIGHT:case g.RIGHT_BOTTOM:f-=d.height,h-=d.width;break;case g.LEFT_CENTER:f-=d.height/2;break;case g.RIGHT_CENTER:f-=d.height/2,h-=d.width}var b=getComputedStyle(this.element),y=parseInt(b.marginLeft,10),m=parseInt(b.marginRight,10),v=parseInt(b.marginTop,10),C=parseInt(b.marginBottom,10);switch(t){case g.LEFT_TOP:case g.TOP_LEFT:case g.TOP_RIGHT:case g.RIGHT_TOP:n!==g.BOTTOM_RIGHT&&n!==g.RIGHT_BOTTOM||(f-=C,h-=m),n!==g.BOTTOM_LEFT&&n!==g.LEFT_BOTTOM||(f-=v,h+=y),n!==g.TOP_LEFT&&n!==g.LEFT_TOP||(f+=v,h+=y),n!==g.TOP_RIGHT&&n!==g.RIGHT_TOP||(f+=v,h-=m);break;case g.LEFT_BOTTOM:case g.BOTTOM_LEFT:case g.BOTTOM_RIGHT:case g.RIGHT_BOTTOM:n!==g.BOTTOM_LEFT&&n!==g.LEFT_BOTTOM||(f-=C,h+=y),n!==g.BOTTOM_RIGHT&&n!==g.RIGHT_BOTTOM||(f-=C,h-=m),n!==g.TOP_LEFT&&n!==g.LEFT_TOP||(f+=v,h+=y),n!==g.TOP_RIGHT&&n!==g.RIGHT_TOP||(f+=v,h-=m);break;case g.TOP_CENTER:f-=C,h+=y,h-=m;break;case g.BOTTOM_CENTER:f+=v,h+=y,h-=m;break;case g.LEFT_CENTER:f+=v,f-=C,h-=m;break;case g.RIGHT_CENTER:f+=v,f-=C,h+=y}return this.element.style.transform="translateX("+h+"px) translateY("+f+"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===f||"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 t.overflowX===b||t.overflowX===y||t.overflowY===b||t.overflowY===y},e}(),v=0,C=[],_=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;e?this.popoverOptions.allowMultipleOpen?this.createPopover():0===v?this.createPopover():C.push(function(){t.createPopover()}):(this.viewContainer.clear(),this.destroyPopover(),this.popoverOptions.allowMultipleOpen||C.length>0&&C.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 m(n[0]),this._subscription=this._popoverInstance.anchor(this.anchorElem,this.anchorPoint,this.popoverPoint,this.popoverOptions).subscribe(function(){e.clrPopoverOldChange.emit(!1)}),v++},e.prototype.destroyPopover=function(){this._popoverInstance&&(this._subscription.unsubscribe(),this._popoverInstance.release(),delete this._popoverInstance,v--)},e.prototype.ngOnDestroy=function(){this.destroyPopover()},e}();_.decorators=[{type:t.Directive,args:[{selector:"[clrPopoverOld]"}]}],_.ctorParameters=function(){return[{type:t.TemplateRef},{type:t.ViewContainerRef}]},_.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 P=[_],O=function(){return function(){}}();O.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],declarations:[P],exports:[P]}]}],O.ctorParameters=function(){return[]};var S=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}();S.decorators=[{type:t.Injectable}],S.ctorParameters=function(){return[]};var T=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}();T.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 '}]}],T.ctorParameters=function(){return[{type:S,decorators:[{type:t.SkipSelf},{type:t.Optional}]}]},T.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 E=["bottom-left","bottom-right","top-left","top-right","left-bottom","left-top","right-bottom","right-top"],I=function(){function e(e,t){this.buttonGroupNewService=e,this.elementRef=t,this.inlineButtons=[],this.menuButtons=[],this._openMenu=!1,this.anchorPoint=g.BOTTOM_LEFT,this.popoverPoint=g.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&&E.indexOf(e)>-1?this._menuPosition=e:this._menuPosition="bottom-left",this._menuPosition){case"top-right":this.anchorPoint=g.TOP_RIGHT,this.popoverPoint=g.RIGHT_BOTTOM;break;case"top-left":this.anchorPoint=g.TOP_LEFT,this.popoverPoint=g.LEFT_BOTTOM;break;case"bottom-right":this.anchorPoint=g.BOTTOM_RIGHT,this.popoverPoint=g.RIGHT_TOP;break;case"bottom-left":this.anchorPoint=g.BOTTOM_LEFT,this.popoverPoint=g.LEFT_TOP;break;case"right-top":this.anchorPoint=g.RIGHT_TOP,this.popoverPoint=g.LEFT_TOP;break;case"right-bottom":this.anchorPoint=g.RIGHT_BOTTOM,this.popoverPoint=g.LEFT_BOTTOM;break;case"left-top":this.anchorPoint=g.LEFT_TOP,this.popoverPoint=g.RIGHT_TOP;break;case"left-bottom":this.anchorPoint=g.LEFT_BOTTOM,this.popoverPoint=g.RIGHT_BOTTOM;break;default:this.anchorPoint=g.BOTTOM_LEFT,this.popoverPoint=g.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}();I.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:[S],host:{"[class.btn-group]":"true"}}]}],I.ctorParameters=function(){return[{type:S},{type:t.ElementRef}]},I.propDecorators={buttons:[{type:t.ContentChildren,args:[T]}],menuPosition:[{type:t.Input,args:["clrMenuPosition"]}],onMouseClick:[{type:t.HostListener,args:["document:click",["$event.target"]]}]};var w=[T,I],x=function(){return function(){}}();x.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,h,O],declarations:[w],exports:[w]}]}],x.ctorParameters=function(){return[]};var A=function(){function e(){}return e.prototype.startLoading=function(){},e.prototype.doneLoading=function(){},e}(),k=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}();k.decorators=[{type:t.Directive,args:[{selector:"[clrLoading]"}]}],k.ctorParameters=function(){return[{type:A,decorators:[{type:t.Optional}]}]},k.propDecorators={loading:[{type:t.Input,args:["clrLoading"]}]};var D=[k],N=function(){return function(){}}();N.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],declarations:[D],exports:[D]}]}],N.ctorParameters=function(){return[]};var j=function(){function e(){}return e.prototype.startLoading=function(){this.loading=!0},e.prototype.doneLoading=function(){this.loading=!1},e}();j.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:A,useExisting:j}]}]}],j.ctorParameters=function(){return[]};var R=[j],L=function(){return function(){}}();L.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,N],declarations:[R],exports:[R,N]}]}],L.ctorParameters=function(){return[]};var M=function(){return function(){}}();M.decorators=[{type:t.NgModule,args:[{exports:[L,x]}]}],M.ctorParameters=function(){return[]};var z=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}();z.decorators=[{type:t.Directive,args:[{selector:"code[clr-code-highlight]"}]}],z.ctorParameters=function(){return[{type:t.ElementRef},{type:t.Renderer2}]},z.propDecorators={highlight:[{type:t.Input,args:["clr-code-highlight"]}]};var B=[z],F=function(){return function(){}}();F.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],declarations:[B],exports:[B]}]}],F.ctorParameters=function(){return[]};var V=function(){return function(){}}();V.decorators=[{type:t.NgModule,args:[{exports:[F]}]}],V.ctorParameters=function(){return[]};var G=0,H=function(){function e(){this._id=(G++).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}();H.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 H}),multi:!0}]}]}],H.ctorParameters=function(){return[]},H.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 W=[H],U=function(){return function(){}}();U.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],declarations:[W],exports:[W]}]}],U.ctorParameters=function(){return[]};var X=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}();X.decorators=[{type:t.Injectable}],X.ctorParameters=function(){return[]};var Y=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}();Y.decorators=[{type:t.Directive,args:[{selector:"[clrIfExpanded]"}]}],Y.ctorParameters=function(){return[{type:t.TemplateRef},{type:t.ViewContainerRef},{type:X}]},Y.propDecorators={expanded:[{type:t.Input,args:["clrIfExpanded"]}],expandedChange:[{type:t.Output,args:["clrIfExpandedChange"]}]};var q=[Y],$=function(){return function(){}}();$.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],declarations:[q],exports:[q]}]}],$.ctorParameters=function(){return[]};var K=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}();K.decorators=[{type:t.Directive,args:[{selector:"[clrOutsideClick]"}]}],K.ctorParameters=function(){return[{type:t.ElementRef}]},K.propDecorators={strict:[{type:t.Input,args:["clrStrict"]}],outsideClick:[{type:t.Output,args:["clrOutsideClick"]}],documentClick:[{type:t.HostListener,args:["document:click",["$event"]]}]};var Z=[K],Q=function(){return function(){}}();Q.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],declarations:[Z],exports:[Z]}]}],Q.ctorParameters=function(){return[]};var J=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}();J.decorators=[{type:t.Injectable}],J.ctorParameters=function(){return[]};var ee=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}();ee.decorators=[{type:t.Injectable}],ee.ctorParameters=function(){return[]};var te=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}();te.decorators=[{type:t.Directive,args:[{selector:"clr-dg-row"}]}],te.ctorParameters=function(){return[{type:t.ElementRef},{type:J},{type:t.Renderer2},{type:X},{type:ee}]};var ne=function(){return function(){}}(),re=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}();re.decorators=[{type:t.Injectable}],re.ctorParameters=function(){return[]};var ie=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=0===e?1: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.prototype.resetPageSize=function(){this.size=0},e}();ie.decorators=[{type:t.Injectable}],ie.ctorParameters=function(){return[{type:re}]};var oe=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 se(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}();oe.decorators=[{type:t.Injectable}],oe.ctorParameters=function(){return[{type:ie},{type:re}]};var se=function(){return function(e,t){this.filter=e,this.unregister=t}}(),ae=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 se?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}(),ce=function(e){function n(n){var r=e.call(this,n)||this;return r.anchorPoint=g.RIGHT_BOTTOM,r.popoverPoint=g.RIGHT_TOP,r.popoverOptions={allowMultipleOpen:!0},r._open=!1,r.openChanged=new t.EventEmitter(!1),r}return u(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}(ae);ce.decorators=[{type:t.Component,args:[{selector:"clr-dg-filter",providers:[{provide:ne,useExisting:ce}],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 '}]}],ce.ctorParameters=function(){return[{type:oe}]},ce.propDecorators={open:[{type:t.Input,args:["clrDgFilterOpen"]}],openChanged:[{type:t.Output,args:["clrDgFilterOpenChange"]}],customFilter:[{type:t.Input,args:["clrDgFilter"]}]};var le=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}(),ue=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 u(n,e),Object.defineProperty(n.prototype,"customStringFilter",{set:function(e){e instanceof se?this.setFilter(e):this.setFilter(new le(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}(ae);ue.decorators=[{type:t.Component,args:[{selector:"clr-dg-string-filter",providers:[{provide:ne,useExisting:ue}],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 '}]}],ue.ctorParameters=function(){return[{type:t.Renderer2},{type:oe},{type:J}]},ue.propDecorators={customStringFilter:[{type:t.Input,args:["clrDgStringFilter"]}],input:[{type:t.ViewChild,args:["input"]}],filterContainer:[{type:t.ViewChild,args:[ce]}],value:[{type:t.Input,args:["clrFilterValue"]}],filterValueChange:[{type:t.Output,args:["clrFilterValueChange"]}]};var pe=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}(),de=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}();de.decorators=[{type:t.Injectable}],de.ctorParameters=function(){return[]};var he=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}(),ge=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t}(he);ge.decorators=[{type:t.Directive,args:[{selector:"clr-datagrid"}]}],ge.ctorParameters=function(){return[]};var fe=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).rowActions=r,i}return u(t,e),Object.defineProperty(t.prototype,"flavor",{get:function(){return this.rowActions.hasActionableRow},enumerable:!0,configurable:!0}),t}(pe);fe.decorators=[{type:t.Directive,args:[{selector:"clr-datagrid, clr-dg-row"}]}],fe.ctorParameters=function(){return[{type:t.ChangeDetectorRef},{type:ge,decorators:[{type:t.Optional}]},{type:de}]};var be=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}();be.decorators=[{type:t.Injectable}],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).expandableCount=r,i}return u(t,e),Object.defineProperty(t.prototype,"flavor",{get:function(){return this.expandableCount.hasExpandableRow},enumerable:!0,configurable:!0}),t}(pe);ye.decorators=[{type:t.Directive,args:[{selector:"clr-datagrid, clr-dg-row"}]}],ye.ctorParameters=function(){return[{type:t.ChangeDetectorRef},{type:ge,decorators:[{type:t.Optional}]},{type:be}]};var me=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}(),ve=function(){function e(e){this.prop=e,this.nestedProp=new me(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()),null==n?null==r?0:1:null==r?-1:n<r?-1:n>r?1:0},e}(),Ce=function(){function e(e,t){void 0===t&&(t=!1),this.prop=e,this.exact=t,this.nestedProp=new me(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}(),_e={Unsorted:0,Asc:1,Desc:-1};_e[_e.Unsorted]="Unsorted",_e[_e.Asc]="Asc",_e[_e.Desc]="Desc";var Pe=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}();Pe.decorators=[{type:t.Injectable}],Pe.ctorParameters=function(){return[{type:t.NgZone},{type:t.Renderer2}]};var Oe=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._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}();Oe.decorators=[{type:t.Injectable}],Oe.ctorParameters=function(){return[{type:re}]};var Se=0,Te=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=_e.Unsorted,o.sortOrderChange=new t.EventEmitter,o.customFilter=!1,o.filterValueChange=new t.EventEmitter,o._sortSubscription=n.change.subscribe(function(e){o.sortOrder!==_e.Unsorted&&e.comparator!==o._sortBy&&(o._sortOrder=_e.Unsorted,o.sortOrderChange.emit(o._sortOrder)),o.sorted&&e.comparator!==o._sortBy&&(o._sorted=!1,o.sortedChange.emit(!1))}),o.columnId="dg-col-"+Se.toString(),Se++,o}return u(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 le(new Ce(e))),this._sortBy||(this._sortBy=new ve(e)))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"sortBy",{get:function(){return this._sortBy},set:function(e){"string"==typeof e?this._sortBy=new ve(e):e?this._sortBy=e:this._field?this._sortBy=new ve(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 _e.Unsorted:this._sort.clear();break;case _e.Asc:this.sort(!1);break;case _e.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?_e.Desc:_e.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===_e.Asc},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"desc",{get:function(){return"undefined"==typeof this.sortOrder?this.sorted&&this._sort.reverse:this.sortOrder===_e.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}(ae);Te.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"}}]}],Te.ctorParameters=function(){return[{type:Oe},{type:oe},{type:Pe}]},Te.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:[ne]}],filterValue:[{type:t.Input,args:["clrFilterValue"]}],filterValueChange:[{type:t.Output,args:["clrFilterValueChange"]}]};var Ee=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",{get:function(){return this._all},set:function(e){this._all=e,this.emitAllChanges(e),this.smart?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(e){this._allChanges.next(e)},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._sortItems())},e.prototype._sortItems=function(){var e=this;this.uninitialized||(this._sort.comparator&&this._filtered.sort(function(t,n){return e._sort.compare(t,n)}),this._changePage())},e.prototype._changePage=func