UNPKG

ng-tempusdominus-bootstrap4

Version:

Angular2+ directive for tempus dominus bootstrap 4 library.

3 lines (2 loc) 4.63 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/forms"),require("@angular/common")):"function"==typeof define&&define.amd?define("ng-tempusdominus-bootstrap4",["exports","@angular/core","@angular/forms","@angular/common"],e):e(t["ng-tempusdominus-bootstrap4"]={},t.ng.core,t.ng.forms,t.ng.common)}(this,function(t,n,e,o){"use strict";var i=function(){function t(t,e,o){this.changeDetector=t,this.el=e,this.differs=o,this._options={},this.click=new n.EventEmitter,this._onTouched=function(){},this._onChange=function(){},this.dpinitialized=!1;var i=$(e.nativeElement.parentNode);this.inputOnly=!i.hasClass("input-group"),this.dpElement=i.hasClass("input-group")?i:$(e.nativeElement)}return Object.defineProperty(t.prototype,"options",{get:function(){return this._options},set:function(t){null!==t&&(this._options=t)},enumerable:!0,configurable:!0}),t.prototype.onBlur=function(){this._onTouched()},t.prototype.onFocus=function(){this.inputOnly&&this.dpElement.datetimepicker("toggle")},t.prototype.outsideClick=function(t,e){e&&this.inputOnly&&!this.options.inline&&(this.el.nativeElement.contains(e)||this.dpElement.datetimepicker("hide"))},Object.defineProperty(t.prototype,"value",{get:function(){return this._value||null},set:function(t){this._value=t,this._onChange(t),t&&this._onTouched(),this.changeDetector.markForCheck()},enumerable:!0,configurable:!0}),t.prototype.writeValue=function(t){this._value&&!t&&(this.value=null,this.dpElement.datetimepicker("clear")),this.value=t,this.setDpValue(t)},t.prototype.registerOnChange=function(t){this._onChange=t},t.prototype.registerOnTouched=function(t){this._onTouched=t},t.prototype.setDpValue=function(t){this.dpinitialized&&t&&this.dpElement.datetimepicker("date",this.value)},t.prototype.setDisabledState=function(t){t?this.dpElement.datetimepicker("disable"):this.dpElement.datetimepicker("enable")},t.prototype.ngOnInit=function(){var e=this;this.dpinitialized=!0,this.dpElement.datetimepicker(this.options),this.dpElement.on("change.datetimepicker",function(t){t.date!==e.value&&(e.value=t.date||null)}),this.dpElement.on("click",function(){e.click.emit()}),this.optionsDiffer=this.differs.find(this.options).create()},t.prototype.ngDoCheck=function(){var o=this;this.dpinitialized&&(this.optionsDiffer.diff(this.options)&&$.map(this.options,function(t,e){o.dpElement.datetimepicker(e,t)}))},t.prototype.ngOnDestroy=function(){this.dpElement.datetimepicker("destroy")},t.prototype.toggle=function(){this.dpElement.datetimepicker("toggle")},t}();i.decorators=[{type:n.Directive,args:[{selector:"[NgTempusdominusBootstrapInput]",exportAs:"NgTempusdominusBootstrapInput",providers:[{provide:e.NG_VALUE_ACCESSOR,useExisting:n.forwardRef(function(){return i}),multi:!0}]}]}],i.ctorParameters=function(){return[{type:n.ChangeDetectorRef},{type:n.ElementRef},{type:n.KeyValueDiffers}]},i.propDecorators={options:[{type:n.Input}],click:[{type:n.Output}],onBlur:[{type:n.HostListener,args:["blur"]}],onFocus:[{type:n.HostListener,args:["focus"]}],outsideClick:[{type:n.HostListener,args:["document:click",["$event","$event.target"]]}]};var r=function(){function t(t,e){this.tempusDominus=t,this.cursor="pointer"}return t.prototype.click=function(){this.toggleOpen()},t.prototype.toggleOpen=function(){this.tempusDominus.toggle()},t}();r.decorators=[{type:n.Directive,args:[{selector:"[NgTempusdominusBootstrapToggle]"}]}],r.ctorParameters=function(){return[{type:undefined,decorators:[{type:n.Inject,args:[n.forwardRef(function(){return s})]}]},{type:n.ElementRef}]},r.propDecorators={cursor:[{type:n.HostBinding,args:["style.cursor"]}],click:[{type:n.HostListener,args:["click"]}]};var s=function(){function t(t){this.el=t}return t.prototype.outsideClick=function(t,e){e&&(this.el.nativeElement.contains(e)||this._input.dpElement.datetimepicker("hide"))},t.prototype.toggle=function(){this._input.toggle()},t}();s.decorators=[{type:n.Directive,args:[{selector:"[NgTempusdominusBootstrap]"}]}],s.ctorParameters=function(){return[{type:n.ElementRef}]},s.propDecorators={_input:[{type:n.ContentChild,args:[i]}],outsideClick:[{type:n.HostListener,args:["document:click",["$event","$event.target"]]}]};var p=function(){};p.decorators=[{type:n.NgModule,args:[{imports:[o.CommonModule,e.FormsModule],declarations:[s,r,i],exports:[s,r,i]}]}],t.NgTempusdominusBootstrapModule=p,t.NgTempusdominusBootstrapToggleDirective=r,t.NgTempusdominusBootstrapDirective=s,t.NgTempusdominusBootstrapInputDirective=i,Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceMappingURL=ng-tempusdominus-bootstrap4.umd.min.js.map