UNPKG

ngx-tempusdominus-bootstrap

Version:

Angular2+ directive for tempus dominus bootstrap library.

3 lines (2 loc) 4.77 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/forms"),require("moment"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-tempusdominus-bootstrap",["exports","@angular/core","@angular/forms","moment","@angular/common"],e):e(t["ngx-tempusdominus-bootstrap"]={},t.ng.core,t.ng.forms,t.moment,t.ng.common)}(this,function(t,n,e,i,o){"use strict";var r=i,s=function(){function t(t,e,i){this.changeDetector=t,this.el=e,this.differs=i,this._options={},this.click=new n.EventEmitter,this._onTouched=function(){},this._onChange=function(){},this.dpinitialized=!1;var o=$(e.nativeElement.parentNode);this.inputOnly=!o.hasClass("input-group"),this.dpElement=o.hasClass("input-group")?o:$(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){if(t){var e=t.target;if(!e||!this.inputOnly||this.options.inline)return;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 i=this;this.dpinitialized=!0,this.dpElement.datetimepicker(this.options),this.dpElement.on("change.datetimepicker",function(t){if(t.date&&t.date!==i.value)i.value=t.date||null;else{var e=r(t.target.value,i.options.format);e.isValid()&&(i.value=e)}}),this.dpElement.on("click",function(){i.click.emit()}),this.optionsDiffer=this.differs.find(this.options).create()},t.prototype.ngDoCheck=function(){var i=this;this.dpinitialized&&(this.optionsDiffer.diff(this.options)&&$.map(this.options,function(t,e){i.dpElement.datetimepicker(e,t)}))},t.prototype.ngOnDestroy=function(){this.dpElement.datetimepicker("destroy")},t.prototype.toggle=function(){this.dpElement.datetimepicker("toggle")},t}();s.decorators=[{type:n.Directive,args:[{selector:"[NgTempusdominusBootstrapInput]",exportAs:"NgTempusdominusBootstrapInput",providers:[{provide:e.NG_VALUE_ACCESSOR,useExisting:n.forwardRef(function(){return s}),multi:!0}]}]}],s.ctorParameters=function(){return[{type:n.ChangeDetectorRef},{type:n.ElementRef},{type:n.KeyValueDiffers}]},s.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"]]}]};var p=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}();p.decorators=[{type:n.Directive,args:[{selector:"[NgTempusdominusBootstrapToggle]"}]}],p.ctorParameters=function(){return[{type:undefined,decorators:[{type:n.Inject,args:[n.forwardRef(function(){return u})]}]},{type:n.ElementRef}]},p.propDecorators={cursor:[{type:n.HostBinding,args:["style.cursor"]}],click:[{type:n.HostListener,args:["click"]}]};var u=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}();u.decorators=[{type:n.Directive,args:[{selector:"[NgTempusdominusBootstrap]"}]}],u.ctorParameters=function(){return[{type:n.ElementRef}]},u.propDecorators={_input:[{type:n.ContentChild,args:[s]}],outsideClick:[{type:n.HostListener,args:["document:click",["$event","$event.target"]]}]};var a=function c(){};a.decorators=[{type:n.NgModule,args:[{imports:[o.CommonModule,e.FormsModule],declarations:[u,p,s],exports:[u,p,s]}]}],t.NgTempusdominusBootstrapModule=a,t.NgTempusdominusBootstrapToggleDirective=p,t.NgTempusdominusBootstrapDirective=u,t.NgTempusdominusBootstrapInputDirective=s,Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceMappingURL=ngx-tempusdominus-bootstrap.umd.min.js.map