UNPKG

@true-directive/grid

Version:

Angular Data Grid from Yopsilon.

1 lines 224 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@true-directive/base"),require("@angular/core"),require("rxjs"),require("@angular/forms"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define("@true-directive/grid",["exports","@true-directive/base","@angular/core","rxjs","@angular/forms","rxjs/operators","@angular/common"],e):e(((t=t||self)["true-directive"]=t["true-directive"]||{},t["true-directive"].grid={}),t.base,t.ng.core,t.rxjs,t.ng.forms,t.rxjs.operators,t.ng.common)}(this,function(t,e,i,n,r,o,s){"use strict";var a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};function l(t,e){function i(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function u(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s}function c(t,e){return function(i,n){e(i,n,t)}}function p(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}var h=function(t){function e(){var e=t.call(this)||this;return e._onLocaleChanged=new n.BehaviorSubject(e.locale),e.onLocaleChanged=e._onLocaleChanged.asObservable(),e}return l(e,t),e.prototype.localeChangedEvent=function(t){this._onLocaleChanged.next(t)},e=u([i.Injectable(),p("design:paramtypes",[])],e)}(e.Internationalization),d=function(){function t(t){this.intl=t}return t.prototype.transform=function(t){return this.intl.translate(t)},t=u([i.Pipe({name:"trueTranslate",pure:!1}),p("design:paramtypes",[h])],t)}(),f=function(){function t(){this.name="events",this._onDataQuery=new n.Subject,this.onDataQuery=this._onDataQuery.asObservable(),this._onDataFetch=new n.Subject,this.onDataFetch=this._onDataFetch.asObservable(),this._onColumnsChanged=new n.Subject,this.onColumnsChanged=this._onColumnsChanged.asObservable(),this._onQueryChanged=new n.Subject,this.onQueryChanged=this._onQueryChanged.asObservable(),this._onSummariesChanged=new n.Subject,this.onSummariesChanged=this._onSummariesChanged.asObservable(),this._onValueChanged=new n.Subject,this.onValueChanged=this._onValueChanged.asObservable(),this._onCheckedChanged=new n.Subject,this.onCheckedChanged=this._onCheckedChanged.asObservable(),this._onDrag=new n.Subject,this.onDrag=this._onDrag.asObservable(),this._onDrop=new n.Subject,this.onDrop=this._onDrop.asObservable(),this._onColumnResizing=new n.Subject,this.onColumnResizing=this._onColumnResizing.asObservable(),this._onColumnResize=new n.Subject,this.onColumnResize=this._onColumnResize.asObservable(),this._onFilterShow=new n.Subject,this.onFilterShow=this._onFilterShow.asObservable(),this._onSelect=new n.Subject,this.onSelect=this._onSelect.asObservable(),this._onStartEditing=new n.Subject,this.onStartEditing=this._onStartEditing.asObservable(),this._onStopEditing=new n.Subject,this.onStopEditing=this._onStopEditing.asObservable(),this._onRowUnfiltered=new n.Subject,this.onRowUnfiltered=this._onRowUnfiltered.asObservable(),this._onHeaderContextMenu=new n.Subject,this.onHeaderContextMenu=this._onHeaderContextMenu.asObservable(),this._onCustomCellEvent=new n.Subject,this.onCustomCellEvent=this._onCustomCellEvent.asObservable()}return t.prototype.dataQueryEvent=function(t){this._onDataQuery.next(t)},t.prototype.dataFetchEvent=function(t){t.subject&&(t.subject.next(),t.subject.complete()),this._onDataFetch.next(t)},t.prototype.columnsChangedEvent=function(){this._onColumnsChanged.next()},t.prototype.queryChangedEvent=function(t){this._onQueryChanged.next(t)},t.prototype.summariesChangedEvent=function(t){this._onSummariesChanged.next(t)},t.prototype.valueChangedEvent=function(t){this._onValueChanged.next(t)},t.prototype.checkedChangedEvent=function(t){this._onCheckedChanged.next(t)},t.prototype.dragEvent=function(t){this._onDrag.next(t)},t.prototype.dropEvent=function(t){this._onDrop.next(t)},t.prototype.columnResizeEvent=function(t){this._onColumnResize.next(t)},t.prototype.filterShowEvent=function(t){this._onFilterShow.next(t)},t.prototype.selectEvent=function(t){this._onSelect.next(t)},t.prototype.startEditingEvent=function(t){this._onStartEditing.next(t)},t.prototype.stopEditingEvent=function(t){this._onStopEditing.next(t)},t.prototype.headerContextMenuEvent=function(t){this._onHeaderContextMenu.next(t)},t.prototype.customCellEvent=function(t){this._onCustomCellEvent.next(t)},t}(),g=function(t){function e(){var e=t.call(this)||this;return e._onFocusChanged=new n.Subject,e.onFocusChanged=e._onFocusChanged.asObservable(),e._onSelectionChanged=new n.Subject,e.onSelectionChanged=e._onSelectionChanged.asObservable(),e}return l(e,t),e.prototype.selectionChangedEvent=function(t){this._onSelectionChanged.next(t)},e.prototype.focusChangedEvent=function(t){this._onFocusChanged.next(t)},e}(e.Selection),y=function(){function t(){}return t.focusAndOpenKeyboard=function(t,e){if(t){var i=document.createElement("input");i.style.position="absolute",i.style.top=t.offsetTop+7+"px",i.style.left=t.offsetLeft+"px",i.style.height="0",i.style.opacity="0",document.body.appendChild(i),i.focus(),setTimeout(function(){t.focus(),t.click(),document.body.removeChild(i)},e)}},t.downloadCSV=function(t,e){var i=document.createElement("a");i.setAttribute("href","data:text/csv;charset=utf-8,%EF%BB%BF"+encodeURIComponent(e)),i.setAttribute("download",t),i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i)},t.copyToClipboard=function(t){var e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0.0",e.style.width="20px",e.style.height="20px",e.style.top="-40px",e.style.left="-40px",document.body.appendChild(e),e.focus(),e.select();try{return document.execCommand("copy")}catch(i){return!1}document.body.removeChild(e)},t}(),m=function(t){function r(e){var i=t.call(this)||this;return i.internationalization=e,i.focusChangedSubscription=i.selection.onFocusChanged.subscribe(function(t){i.layoutsHandler.updateLayoutSelections(t),i.focusChanged(t)}),i.selectionChangedSubscription=i.selection.onSelectionChanged.subscribe(function(t){i.layoutsHandler.updateLayoutSelections(t),i.events.selectEvent(t)}),i.localeChangedSubscription=i.internationalization.onLocaleChanged.subscribe(function(t){i.dataSource.valueFormatter.setLocale(t)}),i}return l(r,t),r.prototype.updateDataAsync=function(){var t=this,i=new n.Subject;return this.settings.requestData?(this.doQuery(i),this.events.columnsChangedEvent(),i):(this.recalcData().then(function(){var n;t.fetchData(new e.DataQuery(t._dataQueryCounter)),t.dataSource.resultRows&&(n=t.dataSource.resultRows.length),i.next(n),i.complete()}),i)},r.prototype.copySelectionToClipboard=function(t){y.copyToClipboard(this.getSelectedData(this.selection).toString(t,"\t"))},r.prototype.exportToCSV=function(t,e){void 0===e&&(e=","),y.downloadCSV(t,this.dataToExport().toString(!0,e,!0))},r.prototype.ngOnDestroy=function(){this.focusChangedSubscription.unsubscribe(),this.selectionChangedSubscription.unsubscribe(),this.localeChangedSubscription.unsubscribe()},r.prototype.registerHandlers=function(){t.prototype.registerHandlers.call(this),this.handlers.events=f,this.handlers.selection=g},u([e.AxInject("events"),p("design:type",f)],r.prototype,"events",void 0),u([e.AxInject("selection"),p("design:type",g)],r.prototype,"selection",void 0),r=u([i.Injectable(),p("design:paramtypes",[h])],r)}(e.GridState),v=function(){function t(){this.onChange=function(t){},this.onTouched=function(){},this.caption=""}var e;return e=t,t.prototype.registerOnChange=function(t){this.onChange=t},t.prototype.registerOnTouched=function(t){this.onTouched=t},Object.defineProperty(t.prototype,"value",{get:function(){return this._value},set:function(t){t!==this._value&&(this._value=t,this.onChange(t))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inversed",{get:function(){return this._inversed},enumerable:!0,configurable:!0}),t.prototype.blur=function(){this.onTouched()},t.prototype.writeValue=function(t){this._value!==t&&(this._value=t)},u([i.Input("caption"),p("design:type",String)],t.prototype,"caption",void 0),u([i.Input("inversed"),p("design:type",Object)],t.prototype,"_inversed",void 0),u([i.HostBinding("class.inversed"),p("design:type",Object),p("design:paramtypes",[])],t.prototype,"inversed",null),t=e=u([i.Component({selector:"true-checkbox",template:'\n <true-checkbox-wrapper [class.inversed]="inversed">\n <input type="checkbox" [(ngModel)]="value" (blur)="blur()"/>\n <span caption>{{caption}}</span>\n </true-checkbox-wrapper>\n ',providers:[{provide:r.NG_VALUE_ACCESSOR,useExisting:i.forwardRef(function(){return e}),multi:!0}]})],t)}(),b=function(){function t(){}return t=u([i.Component({selector:"true-checkbox-wrapper",template:'<label class="true-checkbox"><ng-content select="[caption]"></ng-content>\n <ng-content select="input"></ng-content>\n <span class="true-checkbox__checkmark"></span>\n </label>'})],t)}(),w=function(){function t(){this.showError=!0,this.disabled=null,this.onBtnClick=new i.EventEmitter}return Object.defineProperty(t.prototype,"hasBtn",{get:function(){return this.icon!==undefined&&""!==this.icon},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasError",{get:function(){return this.error!==undefined&&""!==this.error},enumerable:!0,configurable:!0}),t.prototype.btnClick=function(t){this.onBtnClick.emit(t),t.stopPropagation()},u([i.HostBinding("class.true-input_with-btn"),p("design:type",Object),p("design:paramtypes",[])],t.prototype,"hasBtn",null),u([i.HostBinding("class.true-input_with-error"),p("design:type",Object),p("design:paramtypes",[])],t.prototype,"hasError",null),u([i.Input("icon"),p("design:type",String)],t.prototype,"icon",void 0),u([i.Input("error"),p("design:type",String)],t.prototype,"error",void 0),u([i.Input("showError"),p("design:type",Boolean)],t.prototype,"showError",void 0),u([i.Input("disabled"),p("design:type",Boolean)],t.prototype,"disabled",void 0),u([i.Output("btnClick"),p("design:type",i.EventEmitter)],t.prototype,"onBtnClick",void 0),t=u([i.Component({selector:"true-input-wrapper",template:'\n <div>\n <ng-content></ng-content><button\n *ngIf="icon"\n type="button"\n tabindex="-1"\n class="true-input__btn"\n [attr.disabled]="disabled"\n (click)="btnClick($event)">\n <div [ngClass]="icon"></div>\n </button>\n </div>\n <div *ngIf="showError" class="true-input__err-msg">{{error}}</div>\n ',host:{"class":"true-input"},styles:["\n :host {\n overflow-x: visible;\n word-wrap: normal;\n display: inline-block;\n vertical-align: baseline;\n padding: 0;\n margin: 0;\n }\n\n :host > div:first-child {\n width: 100%;\n height: 100%;\n display: inline-flex;\n }\n\n .true-input__err-msg {\n position: absolute;\n display: none;\n }\n\n :host.true-input_with-error > .true-input__err-msg {\n display: block;\n }\n\n "]})],t)}(),C=function(){function t(t,e,n){this.elementRef=t,this.changeDetector=e,this._renderer=n,this.transform0="translateX(15px)",this.transform1="translateX(0)",this.modalTransform0="translateY(-20px)",this.modalTransform1="translateY(0)",this.modalTransform2="translateY(20px)",this.snackTransform0="scale(0.85)",this.snackTransform1="scale(1.0)",this.snackTransform2="scale(1.5)",this.shiftDx=6,this.close=new i.EventEmitter,this.closed=new i.EventEmitter,this.show=new i.EventEmitter,this.position="RELATIVE",this.keepOnTargetClick=!0,this._x=-1,this._y=-1,this._visible=!1,this._stillVisible=!1,this._animating=!1,this._overlay=null}var n;return n=t,t.prototype.getZ=function(){return this.zIndex},t.prototype.getNextElement=function(t,e,i,n){void 0===e&&(e=!1),void 0===i&&(i=null),void 0===n&&(n=!1),null===t&&(n=!0),null===i&&(i=this.popup.nativeElement);for(var r=0;r<i.children.length;r++){var o=e?i.children[i.children.length-r-1]:i.children[r];if(!o.hidden&&!o.disabled)if(o!==t){if(null!==o.offsetParent){if(n&&-1!==o.tabIndex&&("INPUT"===o.nodeName||"BUTTON"===o.nodeName||"SELECT"===o.nodeName||"TEXTAREA"===o.nodeName||o.tabIndex>0))return{found:n,element:o};var s=this.getNextElement(t,e,o,n);if(n=s.found,s.element)return s}}else n=!0}return{found:n,element:null}},t.prototype.popupMouseDown=function(t){this.zIndex>=n.z&&t.stopPropagation()},t.prototype.popupTouchStart=function(t){t.stopPropagation()},t.prototype.popupKeyDown=function(t){if(t.keyCode===e.Keys.ESCAPE&&(this.closePopup(),t.preventDefault(),t.stopPropagation()),t.keyCode===e.Keys.TAB){var i=this.getNextElement(t.target,t.shiftKey);null===i.element&&(i=this.getNextElement(null,t.shiftKey)),i.element&&i.element.focus(),t.preventDefault(),t.stopPropagation()}},t.prototype.addDocumentListeners=function(){this.documentContextMenuBound||(this.documentContextMenuBound=this.documentContextMenu.bind(this)),this.documentMouseDownBound||(this.documentMouseDownBound=this.documentMouseDown.bind(this)),this.documentTouchStartBound||(this.documentTouchStartBound=this.documentTouchStart.bind(this)),this.documentScrollBound||(this.documentScrollBound=this.documentScroll.bind(this)),this.documentResizeBound||(this.documentResizeBound=this.documentResize.bind(this)),document.addEventListener("contextmenu",this.documentContextMenuBound,!1),document.addEventListener("mousedown",this.documentMouseDownBound,!1),document.addEventListener("touchstart",this.documentTouchStartBound,!1),window.addEventListener("scroll",this.documentScrollBound,!1),window.addEventListener("resize",this.documentResizeBound,!1)},t.prototype.removeDocumentListeners=function(){document.removeEventListener("contextmenu",this.documentContextMenuBound,!1),document.removeEventListener("mousedown",this.documentMouseDownBound,!1),document.removeEventListener("touchstart",this.documentTouchStartBound,!1),window.removeEventListener("scroll",this.documentScrollBound,!1),window.removeEventListener("resize",this.documentResizeBound,!1)},t.prototype.maxZIndex=function(t){for(var e=0,i=t.parentNode;i&&i.style;)!isNaN(i.style.zIndex)&&i.style.zIndex>e&&(e=i.style.zIndex),i=i.parentNode;return+e},t.prototype.documentScroll=function(t){this.updatePosition()},t.prototype.documentResize=function(t){this.updatePosition()},t.prototype.checkClose=function(t){var i=t;return(this._target!==i||!this.keepOnTargetClick)&&(!(this._target&&e.Utils.isAncestor(this._target,i)&&this.keepOnTargetClick)&&(!e.Utils.isAncestor(this.popup.nativeElement,i)&&(!(this.zIndex<this.maxZIndex(i))&&(n.freeze>0?(n.freeze--,!1):(this.closePopup(),!0)))))},t.prototype.documentTouchStart=function(t){this.checkClose(t.target)},t.prototype.documentMouseDown=function(t){this.checkClose(t.target)},t.prototype.documentContextMenu=function(t){this.checkClose(t.target)},Object.defineProperty(t.prototype,"visible",{get:function(){return this._visible},enumerable:!0,configurable:!0}),t.prototype.makeOverlay=function(){var t=this;n.z++;var e=n.z;return this._overlay=this._renderer.createElement("div"),this._renderer.setStyle(this._overlay,"z-index",e),this._renderer.addClass(this._overlay,"true-modal-overlay"),this._renderer.appendChild(document.body,this._overlay),this._renderer.listen(this._overlay,"touchstart",function(e){t.closePopup(),e.stopPropagation(),e.preventDefault()}),this._renderer.listen(this._overlay,"mousedown",function(e){t.closePopup(),e.stopPropagation(),e.preventDefault()}),setTimeout(function(){t._renderer.setStyle(t._overlay,"opacity","1.0")},50),this._overlay},t.prototype.removeOverlay=function(){this._overlay&&(document.body.removeChild(this._overlay),n.z--),this._overlay=null},t.prototype.resetPosition=function(){this.popup.nativeElement.style.transform="scale(1.0)",this.popup.nativeElement.style.top="0px",this.popup.nativeElement.style.left="0px"},t.prototype.updatePosition=function(){if(-1!==this._x||-1!==this._y)return n.renderToBody&&(this.popup.nativeElement.style.position="fixed"),this.popup.nativeElement.style.left=this._x+"px",void(this.popup.nativeElement.style.top=this._y+"px");if("ABSOLUTE"===this.position)return this.popup.nativeElement.style.position="absolute",this.popup.nativeElement.style.top="unset",void(this.popup.nativeElement.style.left="unset");var t=this.popup.nativeElement.getBoundingClientRect();if("MODAL"===this.position||"SNACK"===this.position){var e=document.body.clientWidth,i=t.width,r=(e-i)/2;return r<=10&&(r=10,i=e-20),this.popup.nativeElement.style.left=r+"px",void(this.popup.nativeElement.style.top="35px")}var o=this._target.getBoundingClientRect(),s=o.left,a=o.bottom;"left"===this._direction.toLowerCase()&&(s=o.right-t.width+this.shiftDx),"right"===this._direction.toLowerCase()&&(s=o.right,a=o.top-this.shiftDx),a+t.height>window.innerHeight&&"right"!==this._direction&&(a=o.top-t.height),a+t.height>window.innerHeight&&"right"===this._direction&&(a=o.bottom-t.height+4),"AboveLeft"===this._direction&&(s=o.right-t.width+6,a=o.top-t.height),"AboveRight"===this._direction&&(s=o.left-6,a=o.top-t.height),s=s+t.width>window.innerWidth?window.innerWidth-t.width-4:s<0?4:s,a=a<0?4:a,this.popup.nativeElement.style.position="fixed",this.popup.nativeElement.style.left=s+"px",this.popup.nativeElement.style.top=a+"px"},t.prototype.resetAnimation=function(){var t=this.transform0;"MODAL"===this.position&&(t=this.modalTransform0),"SNACK"===this.position&&(t=this.snackTransform0),this.popup.nativeElement.style.opacity="0",this.popup.nativeElement.style.transform=t},t.prototype.startAnimation=function(){var t=this.transform1;"MODAL"===this.position&&(t=this.modalTransform1),"SNACK"===this.position&&(t=this.snackTransform1),this.popup.nativeElement.style.opacity="1.0",this.popup.nativeElement.style.transform=t},t.prototype.display=function(){var t=this;this._visible||(this._visible=!0,this.popup.nativeElement.style.display="none",this.resetAnimation(),this.resetPosition(),setTimeout(function(){"MODAL"===t.position||"SNACK"===t.position?(t.popup.nativeElement.style.position="fixed",t.popup.nativeElement.style.display="block","MODAL"===t.position?(t.makeOverlay(),t._overlay.appendChild(t.popup.nativeElement),t.resetAnimation()):(t._renderer.removeChild(t.elementRef.nativeElement,t.popup.nativeElement),t.changeDetector.detectChanges(),document.body.appendChild(t.popup.nativeElement),t.resetAnimation()),t.updatePosition()):(t.popup.nativeElement.style.display="block",t.updatePosition(),"RELATIVE"===t.position&&n.renderToBody&&(t.popup.nativeElement.style.opacity="0",t._renderer.removeChild(t.elementRef.nativeElement,t.popup.nativeElement),t.changeDetector.detectChanges(),document.body.appendChild(t.popup.nativeElement))),n.z++,t.zIndex=n.z,t.popup.nativeElement.style.zIndex=t.zIndex,t.resetAnimation(),setTimeout(function(){t.startAnimation(),"SNACK"===t.position&&t.closeSnack()},50),t.addDocumentListeners(),t.show.emit()}))},t.prototype.closeSnack=function(){var t=this;this._stillVisible=!0,setTimeout(function(){t._stillVisible&&(t.popup.nativeElement.style.opacity="0",t.popup.nativeElement.style.transform=t.snackTransform2,setTimeout(function(){t.closePopup()},300))},1e3)},t.prototype.showByXY=function(t,e){this._x=t,this._y=e,this.display()},t.prototype.showByTarget=function(t,e){void 0===t&&(t=null),void 0===e&&(e=""),this._target=t,this._direction=e,this.display()},t.prototype.showPopup=function(){this._visible&&this.closePopup(),this.showByTarget()},t.prototype.closePopup=function(t,i){if(void 0===t&&(t=null),void 0===i&&(i=!1),this._visible){this._visible=!1,this._stillVisible=!1;var r=new e.CloseEvent(t);r.confirmed=i,this.close.emit(r),r.isCanceled||(n.z--,n.z<=9&&(n.z=9),"MODAL"===this.position&&(this._overlay.removeChild(this.popup.nativeElement),this.removeOverlay(),this.elementRef.nativeElement.appendChild(this.popup.nativeElement)),"SNACK"===this.position&&(document.body.removeChild(this.popup.nativeElement),this.elementRef.nativeElement.appendChild(this.popup.nativeElement)),this._target=null,this._x=-1,this._y=-1,this.popup.nativeElement.style.display="none",this.resetAnimation(),"RELATIVE"===this.position&&n.renderToBody?(this._renderer.removeChild(document.body,this.popup.nativeElement),this.changeDetector.detectChanges(),this.elementRef.nativeElement.appendChild(this.popup.nativeElement)):this.changeDetector.detectChanges(),this.removeDocumentListeners(),this.closed.emit(t))}},t.prototype.toggle=function(t,e){this._visible?this.closePopup():this.showByTarget(t,e)},t.freeze=0,t.z=19,t.renderToBody=!0,u([i.ViewChild("popup",{"static":!0}),p("design:type",Object)],t.prototype,"popup",void 0),u([i.Output("close"),p("design:type",i.EventEmitter)],t.prototype,"close",void 0),u([i.Output("closed"),p("design:type",i.EventEmitter)],t.prototype,"closed",void 0),u([i.Output("show"),p("design:type",i.EventEmitter)],t.prototype,"show",void 0),u([i.Input("position"),p("design:type",String)],t.prototype,"position",void 0),u([i.Input("keepOnTargetClick"),p("design:type",Object)],t.prototype,"keepOnTargetClick",void 0),t=n=u([i.Component({selector:"true-popup",template:'\n <div [style.zIndex]="getZ()" class="true-popup"\n [class.true-snack]="position===\'SNACK\'"\n (mousedown)="popupMouseDown($event)"\n (touchstart)="popupTouchStart($event)"\n (keydown)="popupKeyDown($event)" #popup>\n <ng-content #content></ng-content>\n </div>',host:{"(touchend)":"$event.stopPropagation()"},styles:["\n :host > div {\n position: fixed;\n display: none;\n opacity: 0.0;\n }\n\n .true-modal-overlay {\n position: fixed;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n opacity: 0.0;\n overflow-y: auto;\n }\n "]}),p("design:paramtypes",[i.ElementRef,i.ChangeDetectorRef,i.Renderer2])],t)}(),_=function(){function t(t,e,n){this.intl=t,this.cd=e,this.el=n,this.onChange=function(t){},this.onTouched=function(){},this._value=null,this.mode="days",this.dateClick=new i.EventEmitter,this.escape=new i.EventEmitter,this.dayNames=[],this.weeks=[],this.monthRows=[],this.yearRows=[],this._minYear=0,this._maxYear=0}var n;return n=t,Object.defineProperty(t.prototype,"value",{get:function(){return this._value},set:function(t){t!==this._value&&(this._value=t,this.createWeeks(this._value),this.onChange(t))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"valueTime",{get:function(){var t=0;return null===this.value||isNaN(this.value.getTime())||(t=this.value.getTime()),t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"monthYear",{get:function(){var t=this.calendarDateStart.getMonth(),e=this.calendarDateStart.getFullYear();return"days"===this.mode?this.intl.locale.longMonthNames[t]+" "+e:"months"===this.mode?e:"years"===this.mode?this._minYear+" - "+this._maxYear:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"today",{get:function(){return e.Dates.today()},enumerable:!0,configurable:!0}),t.prototype.registerOnChange=function(t){this.onChange=t},t.prototype.registerOnTouched=function(t){this.onTouched=t},t.prototype.blur=function(){this.onTouched()},t.prototype.writeValue=function(t){this.value!==t&&(this.value=t)},t.prototype.setFocus=function(){this.days.nativeElement.focus()},t.prototype.isCurrentMonth=function(t){return e.Dates.dateBetween(t,this.calendarDateStart,this.calendarDateEnd)},t.prototype.go=function(t){if("days"===this.mode){var i=void 0;i=t>0?e.Dates.firstDateOfNextMonth(this.calendarDateStart):e.Dates.firstDateOfPrevMonth(this.calendarDateStart),this.createWeeks(i)}"months"===this.mode&&(this.calendarDateStart=new Date(this.calendarDateStart.getFullYear()+t,0,1),this.createMonths()),"years"===this.mode&&(this.calendarDateStart=new Date(this.calendarDateStart.getFullYear()+24*t,0,1),this.createYears())},t.prototype.toggleMode=function(){"years"===this.mode?(this.mode="days",this.createWeeks(this.calendarDateStart)):"months"===this.mode?(this.mode="years",this.createYears()):"days"===this.mode&&(this.mode="months",this.createMonths()),this.setMode()},t.prototype.setMode=function(){this.el.nativeElement.classList.remove("true-mode-days"),this.el.nativeElement.classList.remove("true-mode-months"),this.el.nativeElement.classList.remove("true-mode-years"),this.el.nativeElement.classList.add("true-mode-"+this.mode)},t.prototype.mousedown=function(t){t.stopPropagation()},t.prototype.calendarDateClick=function(t,e){"days"===this.mode&&(this.value=new Date(e),this.dateClick.emit(e)),"months"===this.mode&&(this.mode="days",this.createWeeks(new Date(e))),"years"===this.mode&&(this.calendarDateStart=new Date(e),this.mode="months",this.createMonths()),this.setMode(),t.preventDefault(),t.stopPropagation()},t.prototype.createDayNames=function(){this.dayNames=[];for(var t=e.Dates.firstDateOfWeek(e.Dates.today(),this.intl.locale.firstDayOfWeek),i=e.Dates.lastDateOfWeek(t,this.intl.locale.firstDayOfWeek),n=new Date(t);n.getTime()<=i.getTime();n=e.Dates.nextDate(n)){var r=n.getDay(),o=this.intl.locale.shortDayNames[r];this.dayNames.push(o)}},t.prototype.createMonths=function(){var t=this.calendarDateStart.getFullYear(),i=e.Dates.firstDateOfMonth(e.Dates.today()),n=-3;this.monthRows=[];for(var r=0;r<6;r++){for(var o=[],s=0;s<3;s++){var a=new Date(t,n,1);o.push({name:this.intl.locale.shortMonthNames[a.getMonth()]+" "+e.Dates.yearTwoDigits(a),date:a,selected:e.Dates.isSameMonth(a,this.value),today:a.getTime()===i.getTime(),current:e.Dates.isSameYear(a,this.calendarDateStart)}),n++}this.monthRows.push(o)}},t.prototype.createYears=function(){var t=this.calendarDateStart.getFullYear(),i=new Date(e.Dates.today().getFullYear(),0,1);new Date(this.calendarDateStart.getFullYear(),0,1);this._minYear=t-11;var n=this._minYear;this.yearRows=[];for(var r=0;r<6;r++){for(var o=[],s=0;s<4;s++){var a=new Date(n,0,1);o.push({name:n+"",date:a,selected:e.Dates.isSameYear(a,this.value),today:a.getTime()===i.getTime(),current:!0}),n++}this.yearRows.push(o)}this._maxYear=n-1},t.prototype.createWeeks=function(t){(null===t||isNaN(t.getTime()))&&(t=e.Dates.today());var i=this.intl.locale.firstDayOfWeek,n=e.Dates.firstDateOfMonth(t),r=e.Dates.lastDateOfMonth(t);if(!(this.weeks.length>0&&this.calendarDateStart!==undefined&&this.calendarDateStart.getTime()===n.getTime()&&this.calendarDateEnd!==undefined&&this.calendarDateEnd.getTime()===r.getTime())){this.weeks=[],this.calendarDateStart=n,this.calendarDateEnd=r;for(var o=e.Dates.firstDateOfWeek(n,i),s=new Date(o),a=0;a<6;){for(var l=[],u=e.Dates.lastDateOfWeek(s,i),c=new Date(s);c.getTime()<=u.getTime();c=e.Dates.nextDate(c))l.push(c);this.weeks.push(l),s=e.Dates.nextDate(u),a++}}},t.prototype.daysKeyDown=function(t){var i=0;t.keyCode===e.Keys.LEFT&&(i=-1),t.keyCode===e.Keys.UP&&(i=-7),t.keyCode===e.Keys.RIGHT&&(i=1),t.keyCode===e.Keys.DOWN&&(i=7),t.keyCode===e.Keys.ENTER&&(this.dateClick.emit(this.value),t.stopPropagation()),t.keyCode===e.Keys.ESCAPE&&(this.escape.emit(this.value),t.stopPropagation()),0!==i&&(this.value=e.Dates.addDays(null===this.value?e.Dates.today():this.value,i),t.stopPropagation())},t.prototype.ngOnInit=function(){this.createDayNames(),this.createWeeks(e.Dates.today())},u([i.ViewChild("days",{"static":!0}),p("design:type",Object)],t.prototype,"days",void 0),u([i.Output("dateClick"),p("design:type",i.EventEmitter)],t.prototype,"dateClick",void 0),u([i.Output("escape"),p("design:type",i.EventEmitter)],t.prototype,"escape",void 0),t=n=u([i.Component({selector:"true-calendar",template:'\x3c!-- Buttons --\x3e\r\n<div class="true-calendar__controls">\r\n <div>\r\n <button class="true-button" (click)="toggleMode()" ><b>{{monthYear}}</b></button>\r\n </div>\r\n <div>\r\n <button class="true-button prev" (click)="go(-1)"><span class="true-icon-left-open"></span></button>\r\n <button class="true-button next" (click)="go(1)"><span class="true-icon-right-open"></span></button>\r\n </div>\r\n</div>\r\n\r\n\x3c!-- Day names in header --\x3e\r\n<table class="true-day-names">\r\n <colGroup>\r\n <col *ngFor="let d of dayNames" />\r\n </colGroup>\r\n <thead>\r\n <tr>\r\n <td *ngFor="let d of dayNames" [class.true-transparent]="mode!=\'days\'">{{d}}</td>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr><td colspan="7"></td></tr>\r\n </tbody>\r\n</table>\r\n\r\n\x3c!-- Month days --\x3e\r\n<table #days class="true-days" tabindex="1" (keydown)="daysKeyDown($event)">\r\n <colGroup>\r\n <col *ngFor="let d of dayNames" />\r\n </colGroup>\r\n <tbody>\r\n <tr *ngFor="let w of weeks">\r\n <td *ngFor="let d of w"\r\n (click)="calendarDateClick($event, d)"\r\n [class.true-selected]="d.getTime() === valueTime"\r\n [class.true-today]="d.getTime() === today.getTime()"\r\n [class.true-current]="isCurrentMonth(d)">{{d.getDate()}}</td>\r\n </tr>\r\n </tbody>\r\n</table>\r\n\x3c!-- Months --\x3e\r\n<table class="true-months">\r\n <colGroup>\r\n <col *ngFor="let r of monthRows[0]" />\r\n </colGroup>\r\n <tbody>\r\n <tr *ngFor="let r of monthRows">\r\n <td *ngFor="let m of r"\r\n (click)="calendarDateClick($event, m.date)"\r\n [class.true-transparent]="m.hide"\r\n [class.true-selected]="m.selected"\r\n [class.true-today]="m.today"\r\n [class.true-current]="m.current">{{m.name}}</td>\r\n </tr>\r\n </tbody>\r\n</table>\r\n\x3c!-- Years --\x3e\r\n<table class="true-years">\r\n <colGroup>\r\n <col *ngFor="let r of yearRows[0]" />\r\n </colGroup>\r\n <tbody>\r\n <tr *ngFor="let r of yearRows">\r\n <td *ngFor="let y of r"\r\n (click)="calendarDateClick($event, y.date)"\r\n [class.true-selected]="y.selected"\r\n [class.true-today]="y.today"\r\n [class.true-current]="1==1">{{y.name}}</td>\r\n </tr>\r\n </tbody>\r\n</table>\r\n',host:{"class":"true-calendar true-mode-days","(mousedown)":"mousedown($event)","(touchend)":"$event.stopPropagation()"},providers:[{provide:r.NG_VALUE_ACCESSOR,useExisting:i.forwardRef(function(){return n}),multi:!0}],styles:[":host>table{table-layout:fixed;border-collapse:separate}:host>table:focus{outline:0}:host table.true-days,:host table.true-months,:host table.true-years{display:none}:host.true-mode-days table.true-days,:host.true-mode-months table.true-months,:host.true-mode-years table.true-years{display:table}.true-calendar__controls{display:-webkit-box;display:flex;flex-wrap:nowrap;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;-webkit-box-pack:justify;justify-content:space-between}.true-calendar__controls div:last-child{display:-webkit-box;display:flex;flex-wrap:nowrap;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row}"]}),p("design:paramtypes",[h,i.ChangeDetectorRef,i.ElementRef])],t)}(),E=function(){function t(t,e){this._elementRef=t,this._renderer=e,this.usePopup=!0,this.currentPopupVisible=!1,this.disableTextEditor=!1,this.disabled=null,this.maxDropDownHeight="300px",this.blur=new i.EventEmitter,this.keydown=new i.EventEmitter,this.onChange=function(t){},this.onTouched=function(){},this._validBlur=!1,this._useAltDown=!0,this.shownByKey=!1,this._touched=!1,this._skipFocusOnPopupClose=!1}return Object.defineProperty(t.prototype,"popupPosition",{get:function(){return this.popup.position},set:function(t){this.currentPopupPosition=t,this.popup&&(this.popup.position=t)},enumerable:!0,configurable:!0}),t.prototype.registerOnChange=function(t){this.onChange=t},t.prototype.registerOnTouched=function(t){this.onTouched=t},Object.defineProperty(t.prototype,"useAltDown",{get:function(){return this._useAltDown},set:function(t){this._useAltDown=t},enumerable:!0,configurable:!0}),t.prototype.fetchData=function(t,e){},t.prototype.inputBlur=function(t){this.onTouched();var i=t.relatedTarget;null===i||e.Utils.isAncestor(this.popup.popup.nativeElement,i)||null===i||e.Utils.isAncestor(this._elementRef.nativeElement,i)||(this.popup.visible&&!this._validBlur&&(this._skipFocusOnPopupClose=!0,this.popup.closePopup()),this._validBlur=!1,this.blur.emit(t))},t.prototype.inputClick=function(t){this.disabled||this.disableTextEditor&&(this.popupVisible?this.closePopup():this.showByTarget(),t.stopPropagation(),t.preventDefault())},t.prototype.inputTouchStart=function(t){this._touched=!0,this.disableTextEditor&&(t.stopPropagation(),t.preventDefault())},t.prototype.inputTouchMove=function(t){this._touched=!1},t.prototype.inputTouchEnd=function(t){!this.disabled&&this.disableTextEditor&&(!this.popupVisible&&this._touched&&(this.showByTarget(),t.cancelable&&t.preventDefault()),t.stopPropagation())},Object.defineProperty(t.prototype,"value",{get:function(){return this._value},set:function(t){t!==this._value&&(this._value=t,this.onChange(t))},enumerable:!0,configurable:!0}),t.prototype.writeValue=function(t){this.value!==t&&(this.value=t)},Object.defineProperty(t.prototype,"popupVisible",{get:function(){return!!this.popup&&this.popup.visible},enumerable:!0,configurable:!0}),t.prototype.focusPopup=function(){},t.prototype.processKey=function(t){return!1},t.prototype.showByTarget=function(){this.usePopup&&this.popup.showByTarget(this.input.nativeElement)},t.prototype.closePopup=function(){this.popup.closePopup()},t.prototype.inputInput=function(t){},t.prototype.inputKeyDown=function(t){var i=this;return t.keyCode===e.Keys.ESCAPE&&this.popup.visible?(this.closePopup(),t.stopPropagation(),void t.preventDefault()):t.keyCode!==e.Keys.DOWN||!t.altKey&&this.useAltDown||this.popup.visible?void(this.processKey(t)||this.keydown.emit(t)):(this.shownByKey=!0,this.showByTarget(),setTimeout(function(){return i.focusPopup()}),t.preventDefault(),void t.stopPropagation())},t.prototype.focus=function(){this.input.nativeElement.focus()},t.prototype.popupClose=function(t){var i=this;this._skipFocusOnPopupClose?this._skipFocusOnPopupClose=!1:e.Utils.detectMobile()||(this.input.nativeElement.focus(),setTimeout(function(){var t=i.input.nativeElement.value;t!==undefined&&!i.disableTextEditor&&i._renderer&&(i._renderer.setProperty(i.input.nativeElement,"selectionStart",0),i._renderer.setProperty(i.input.nativeElement,"selectionEnd",t.length))}))},t.prototype.inputFocus=function(t){if(this.disableTextEditor)this._renderer.setProperty(this.input.nativeElement,"selectionStart",0),this._renderer.setProperty(this.input.nativeElement,"selectionEnd",0);else{var e=this.input.nativeElement.value;this._renderer.setProperty(this.input.nativeElement,"selectionStart",0),this._renderer.setProperty(this.input.nativeElement,"selectionEnd",e.length)}},t.prototype.togglePopup=function(){var t=this;this.disabled||(this.popup.toggle(this.input.nativeElement,""),setTimeout(function(){t.popupVisible&&t.focusPopup()}))},t.prototype.btnClick=function(t){this.togglePopup()},t.prototype.setValueFromDisplayed=function(){},t.prototype.ngAfterViewInit=function(){this.popup.position=this.currentPopupPosition},t.prototype.ngOnDestroy=function(){this.popupVisible&&this.popup.closePopup()},u([i.ViewChild("popup",{"static":!1}),p("design:type",C)],t.prototype,"popup",void 0),u([i.ViewChild("input",{"static":!0}),p("design:type",Object)],t.prototype,"input",void 0),u([i.Input("disableTextEditor"),p("design:type",Object)],t.prototype,"disableTextEditor",void 0),u([i.Input("disabled"),p("design:type",Boolean)],t.prototype,"disabled",void 0),u([i.Input("maxDropDownHeight"),p("design:type",Object)],t.prototype,"maxDropDownHeight",void 0),u([i.Input("popupPosition"),p("design:type",String),p("design:paramtypes",[String])],t.prototype,"popupPosition",null),u([i.Output("blur"),p("design:type",i.EventEmitter)],t.prototype,"blur",void 0),u([i.Output("keydown"),p("design:type",i.EventEmitter)],t.prototype,"keydown",void 0),u([i.Input("useAltDown"),p("design:type",Boolean),p("design:paramtypes",[Boolean])],t.prototype,"useAltDown",null),t=u([i.Component({selector:"true-drop-down-base",template:"",styles:[""]}),p("design:paramtypes",[i.ElementRef,i.Renderer2])],t)}(),k=function(){function t(t,n,r){var o=this;this._renderer=t,this._elementRef=n,this.intl=r,this._undo=[],this._redo=[],this._txtValue="",this._mask=new e.Mask,this.android_behavior=!1,this.stateChange=new i.EventEmitter,this.maskValueChanged=new i.EventEmitter,this._state=null,this._localeSubscription=this.intl.onLocaleChanged.subscribe(function(t){return o.setLocale(t)})}return Object.defineProperty(t.prototype,"state",{get:function(){return this._state},set:function(t){this._state!==t&&(this._state=t,this.stateChange.emit(this._state))},enumerable:!0,configurable:!0}),t.prototype.updateState=function(){},t.prototype.processAndroid=function(t){var i=this.currentRes(),n=e.Keys.whichKeyHasBeenPressed(this.last_res.newValue,t,this.last_res.selStart,i.selStart,this.last_res.selLength);this.processKey({keyCode:-1,key:n.code,char:n.char,shiftKey:!1,ctrlKey:!1,target:{selectionStart:this.last_res.selStart,selectionEnd:0},preventDefault:function(t){}})||this.setRes(this.last_res),this.android_behavior=!1},t.prototype.doInput=function(t){if(this.android_behavior)this.processAndroid(t);else{var e=this._mask.applyMask(t);e!==this._txtValue&&this.setText(e,!0)}},t.prototype.processKey=function(t){if(229===t.keyCode||0===t.keyCode||t.keyCode===undefined)return this.android_behavior=!0,void(this.last_res=this.currentRes());var i=t.char;i===undefined&&(i=t.key);var n=t.target.selectionStart,r=t.target.selectionEnd,o=this._txtValue;if(e.Keys.isFunctional(t.keyCode))return!0;if(t.keyCode===e.Keys.TAB||t.keyCode===e.Keys.ESCAPE)return!0;if(t.keyCode===e.Keys.HOME||t.keyCode===e.Keys.END)return!0;if(t.shiftKey&&(t.keyCode===e.Keys.DELETE||t.keyCode===e.Keys.INSERT))return!0;if(t.altKey&&(t.keyCode===e.Keys.DOWN||t.keyCode===e.Keys.UP))return!0;if(t.ctrlKey&&t.keyCode===e.Keys.Z){var s=this._undo.pop();return s&&(this._redo.push(this.getRes(o,n,r)),this.setRes(s)),t.preventDefault(),!1}if(t.ctrlKey&&t.keyCode===e.Keys.Y){var a=this._redo.pop();return a&&(this._undo.push(this.getRes(o,n,r)),this.setRes(a)),t.preventDefault(),!1}if(t.ctrlKey)return!0;if(0===n&&r===this._txtValue.length){if(t.keyCode===e.Keys.DELETE||t.keyCode===e.Keys.BACKSPACE)return!0;if(t.keyCode===e.Keys.LEFT)return!0;if(t.keyCode===e.Keys.RIGHT)return!0}0===n&&r===this._txtValue.length&&(o="",n=0,r=0);var l=this._mask.applyKeyAtPos(o,t.keyCode,i,n,r);if(null!==l&&l.action===e.MaskSectionAction.APPLY){if(l.newValue!==o&&(this._undo.push(this.getRes(o,n,r)),this._redo=[]),this.setRes(l),this.android_behavior)return!0;t.preventDefault()}return!1},t.prototype.setRes=function(t){this.android_behavior&&(t.selLength=0),this.setText(t.newValue),this._renderer.setProperty(this._elementRef.nativeElement,"selectionStart",t.selStart),this._renderer.setProperty(this._elementRef.nativeElement,"selectionEnd",t.selStart+t.selLength)},t.prototype.currentRes=function(){var t=new e.MaskResult(this._txtValue,e.MaskSectionAction.APPLY,0);return t.selStart=this._elementRef.nativeElement.selectionStart,t.selLength=this._elementRef.nativeElement.selectionEnd-t.selStart,t},t.prototype.getRes=function(t,i,n){var r=new e.MaskResult(t,e.MaskSectionAction.APPLY,0);return r.selStart=i,r.selLength=n-i,r},t.prototype.toModel=function(){},t.prototype.setText=function(t,e){void 0===e&&(e=!0),this._txtValue=t,this._renderer.setProperty(this._elementRef.nativeElement,"value",this._txtValue),e&&this.toModel()},t.prototype.setLocale=function(t){this._mask.setLocale(t)},t.prototype.ngOnDestroy=function(){this._localeSubscription.unsubscribe()},u([i.Output("stateChange"),p("design:type",Object)],t.prototype,"stateChange",void 0),u([i.Output("maskValueChanged"),p("design:type",Object)],t.prototype,"maskValueChanged",void 0),t=u([i.Directive({selector:"true-mask-base"}),p("design:paramtypes",[i.Renderer2,i.ElementRef,h])],t)}(),x=function(t){function n(e,i,n){var r=t.call(this,e,i,n)||this;return r._renderer=e,r._elementRef=i,r.intl=n,r.onChange=function(t){},r.onTouched=function(){},r}var o;return l(n,t),o=n,n.prototype.registerOnChange=function(t){this.onChange=t},n.prototype.registerOnTouched=function(t){this.onTouched=t},n.prototype.onInput=function(t){this.input(t.target.value)},n.prototype.blur=function(t){var e=this._mask.applyMask(this._txtValue);e!==this._txtValue&&this.setText(e),(null===this._dateValue||isNaN(this._dateValue.getTime()))&&(this._mask.settings.allowIncomplete||this.setText("")),this.onTouched()},n.prototype.updateState=function(){this._dateValue?isNaN(this._dateValue.getTime())?this.state=e.MaskState.TYPING:this.state=e.MaskState.OK:this.state=e.MaskState.EMPTY},n.prototype.toModel=function(){this._dateValue=e.DateParserFormatter.parse(this._txtValue,this._mask),this.maskValueChanged.emit(this._dateValue),this.onChange(this._dateValue),this.updateState()},n.prototype.processKey=function(e){return t.prototype.processKey.call(this,e)},n.prototype.input=function(t){this.doInput(t.target.value)},n.prototype.writeValue=function(t){this._dateValue=t;var i=e.DateParserFormatter.format(t,this._mask);i!==this._txtValue&&this.setText(i,!1),this.updateState()},Object.defineProperty(n.prototype,"pattern",{get:function(){return this._mask.pattern},set:function(t){this._mask.pattern=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"settings",{set:function(t){this._mask.settings=t},enumerable:!0,configurable:!0}),n.prototype.keyDown=function(t){return this.processKey(t)},n.prototype.setLocale=function(e){t.prototype.setLocale.call(this,e),this._mask.updateMask(),this.writeValue(this._dateValue)},u([i.HostListener("input",["$event"]),p("design:type",Function),p("design:paramtypes",[Object]),p("design:returntype",void 0)],n.prototype,"onInput",null),u([i.HostListener("blur",["$event"]),p("design:type",Function),p("design:paramtypes",[Object]),p("design:returntype",void 0)],n.prototype,"blur",null),u([i.HostListener("input",["$event"]),p("design:type",Function),p("design:paramtypes",[Object]),p("design:returntype",void 0)],n.prototype,"input",null),u([i.Input("true-mask-date"),p("design:type",String),p("design:paramtypes",[String])],n.prototype,"pattern",null),u([i.Input("true-mask-settings"),p("design:type",e.MaskSettings),p("design:paramtypes",[e.MaskSettings])],n.prototype,"settings",null),u([i.HostListener("keydown",["$event"]),p("design:type",Function),p("design:paramtypes",[Object]),p("design:returntype",void 0)],n.prototype,"keyDown",null),n=o=u([i.Directive({selector:"[true-mask-date]",providers:[{provide:r.NG_VALUE_ACCESSOR,useExisting:i.forwardRef(function(){return o}),multi:!0}]}),p("design:paramtypes",[i.Renderer2,i.ElementRef,h])],n)}(k),S=function(t){function n(e,i,n){var r=t.call(this,i,n)||this;return r.intl=e,r._elementRef=i,r._renderer=n,r._pattern="",r.showError=!0,r.inputClass="",r}var o;return l(n,t),o=n,Object.defineProperty(n.prototype,"pattern",{get:function(){return this._pattern},set:function(t){this._pattern=t,this.checkPattern()},enumerable:!0,configurable:!0}),n.prototype.checkPattern=function(){var t=!1;e.Mask.maskWithPattern(this.intl,this._pattern).sections.forEach(function(e){"d"!==e.sectionType.datePart&&"m"!==e.sectionType.datePart&&"y"!==e.sectionType.datePart&&"yy"!==e.sectionType.datePart&&"yyyy"!==e.sectionType.datePart||(t=!0)}),this.usePopup=t},n.prototype.getIcon=function(){return this.usePopup?"true-icon-calendar-empty":""},n.prototype.dateClick=function(t){this.popup.closePopup()},n.prototype.escape=function(t){this.popup.closePopup()},n.prototype.focusPopup=function(){this.calendar.setFocus()},n.prototype.acceptKey=function(t){this.maskDateDirective.keyDown(e.Keys.generateEvent(this.input.nativeElement,-1,e.Keys.keyChar(t),t.shiftKey,t.ctrlKey))},u([i.Input("pattern"),p("design:type",String),p("design:paramtypes",[String])],n.prototype,"pattern",null),u([i.Input("error"),p("design:type",String)],n.prototype,"error",void 0),u([i.Input("showError"),p("design:type",Boolean)],n.prototype,"showError",void 0),u([i.Input("inputClass"),p("design:type",String)],n.prototype,"inputClass",void 0),u([i.ViewChild("calendar",{"static":!1}),p("design:type",_)],n.prototype,"calendar",void 0),u([i.ViewChild("input",{"static":!0}),p("design:type",Object)],n.prototype,"input",void 0),u([i.ViewChild("input",{"static":!0,read:x}),p("design:type",x)],n.prototype,"maskDateDirective",void 0),n=o=u([i.Component({selector:"true-datepicker",template:'<true-input-wrapper\r\n (btnClick)="btnClick($event)"\r\n class="true-datepicker__input"\r\n [class.true-input_popup-visible]="popupVisible"\r\n [disabled]="disabled"\r\n [error]="error"\r\n [showError]="showError"\r\n [icon]="getIcon()"><input #input\r\n [ngClass]="inputClass"\r\n [true-mask-date]="pattern"\r\n [readonly]="disableTextEditor"\r\n [attr.disabled]="disabled"\r\n [(ngModel)]="value"\r\n (blur)="inputBlur($event)"\r\n (focus)="inputFocus($event)"\r\n (mousedown)="$event.stopPropagation()"\r\n (keydown)="inputKeyDown($event)" />\r\n</true-input-wrapper><true-popup #popup (close)="popupClose($event)">\r\n <true-calendar #calendar\r\n *ngIf="popupVisible"\r\n [(ngModel)]="value"\r\n (escape)="escape($event)"\r\n (dateClick)="dateClick($event)">\r\n </true-calendar>\r\n</true-popup>\r\n',providers:[{provide:r.NG_VALUE_ACCESSOR,useExisting:i.forwardRef(function(){return o}),multi:!0}],styles:["\n :host {\n padding: 0;\n }\n .true-datepicker__input {\n width: 100%;\n height: 100%;\n padding: 0;\n margin: 0;\n }\n\n input {\n box-sizing: border-box;\n width: 100%;\n margin: 0;\n }\n "]}),p("design:paramtypes",[h,i.ElementRef,i.Renderer2])],n)}(E),D=function(){function t(t,e,n,r){this.state=t,this.elementRef=e,this.changeDetector=n,this.renderer=r,this.maxHeight=null,this.autoscrollx=new i.EventEmitter,this.scroll=new i.EventEmitter,this.scrollX=0,this.scrollY=0,this.scrollTimer=null,this.scrollSubscription=null,this.autoScrollInProgress=!1,this.scrollSpeedX=0,this.scrollSpeedY=0,this._scrollRect=null}return Object.defineProperty(t.prototype,"maxHeightU",{get:function(){return null===this.maxHeight?"unset":this.maxHeight},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"autoWidth",{get:function(){return this.state.settings.columnAutoWidth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"touchFix",{get:function(){return(this.state.iOS||this.state.android)&&this.state.settings.enableTouchScroll},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scrollerH",{get:function(){return this.touchFix?this.datah:this.data},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scrollerV",{get:function(){return this.touchFix?this.dataArea:this.data},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"clientRect",{get:function(){return this.elementRef.nativeElement.getBoundingClientRect()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"centerRect",{get:function(){return this.touchFix?this.datah.nativeElement.getBoundingClientRect():this.data.nativeElement.getBoundingClientRect()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"headerRect",{get:function(){return this.header.nativeElement.getBoundingClientRect()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"headerRectLeft",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"headerRectRight",{get:function(){return null},enumerable:!0,configurable:!0}),t.prototype.dataScroll=function(t){this.doScroll(t),this.scroll.emit(t)},t.prototype.dataScrollH=function(t){this.doScroll(t,!0),this.scroll.emit(t)},Object.defineProperty(t.prototype,"isAutoScroll",{get:function(){return this.autoScrollInProgress},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scrollTop",{get:function(){return this.touchFix?this.dataArea.nativeElement.scrollTop:this.data.nativeElement.scrollTop},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scrollLeft",{get:function(){return this.touchFix?this.datah.nativeElement.scrollLeft:this.data.nativeElement.scrollLeft},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scrollWidth",{get:function(){return this.touchFix?this.datah.nativeElement.scrollWidth:this.data.nativeElement.scrollWidth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scrollHeight",{get:function(){return this.data.nativeElement.scrollHeight},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"viewPortHeight",{get:function(){return this.touchFix?this.dataArea.nativeElement.clientHeight:this.data.nativeElement.clientHeight},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"viewPortWidth",{get:function(){return this.touchFix?this.dataArea.nativeElement.clientWidth:this.data.nativeElement.clientWidth},enumerable:!0,configurable:!0}),t.prototype.prepareAutoScroll=function(){this._scrollRect=this.centerRect},t.prototype.startAutoScroll=function(){var t=this;this.autoScrollInProgress||(this.scrollTimer||(this.scrollTimer=n.timer(this.state.st.autoScrollInterval,this.state.st.autoScrollInterval),this.scrollSubscription=this.scrollTimer.subscribe(function(e){return t.scrollIfNeeded()})),this.autoScrollInProgress=!0)},t.prototype.stopAutoScroll=function(){this._scrollRect=null,this.scrollSpeedY=0,this.scrollSpeedX=0,this.scrollSubscription&&(this.scrollSubscription.unsubscribe(),this.scrollTimer=null),this.autoScrollInProgress=!1},t.prototype.scrollIfNeeded=function(){var t=this.scrollLeft,e=this.scrollTop,i=this.scrollWidth,n=this.scrollHeight,r=t,o=e;this.elementRef.nativeElement