diff --git a/dist/date-util.d.ts b/dist/date-util.d.ts new file mode 100644 index 0000000..7b3a0cc --- /dev/null +++ b/dist/date-util.d.ts @@ -0,0 +1,21 @@ +export interface MonthTracker { + years: Object; + current?: Date; +} +export declare const monthTracker: MonthTracker; +export declare const months: string[]; +export declare const days: string[]; +export declare function scrapeMonth(date: Date): { + date: Date; + month: undefined; +}; +export declare function scrapePreviousMonth(): { + date: Date; + month: undefined; +}; +export declare function scrapeNextMonth(): { + date: Date; + month: undefined; +}; +export declare function getDisplayDate(_date: any): string; +export declare function formatTimeFromInputElement(input: string): string; diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..3bcdd22 --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,57 @@ +declare type SimplePickerEvent = 'submit' | 'close'; +interface SimplePickerOpts { + zIndex?: number; + compactMode?: boolean; + disableTimeSection?: boolean; + selectedDate?: Date; +} +declare type HandlerFunction = (...args: unknown[]) => void; +interface EventHandlers { + [key: string]: HandlerFunction[]; +} +declare class SimplePicker { + selectedDate: Date; + $simplePicker: HTMLElement; + readableDate: string; + _eventHandlers: EventHandlers; + _validOnListeners: readonly ["submit", "close"]; + private opts; + private $; + private $$; + private $simplepicker; + private $simplepickerWrapper; + private $trs; + private $tds; + private $headerMonthAndYear; + private $monthAndYear; + private $date; + private $day; + private $time; + private $timeInput; + private $timeSectionIcon; + private $cancel; + private $ok; + private $displayDateElements; + constructor(arg1?: HTMLElement | string | SimplePickerOpts, arg2?: SimplePickerOpts); + initElMethod(el: any): void; + init(el: HTMLElement, opts: SimplePickerOpts): void; + reset(newDate?: Date): void; + compactMode(): void; + disableTimeSection(): void; + enableTimeSection(): void; + injectTemplate(el: HTMLElement): void; + clearRows(): void; + updateDateComponents(date: Date): void; + render(data: any): void; + updateSelectedDate(el?: HTMLElement): void; + selectDateElement(el: HTMLElement): void; + findElementWithDate(date: any, returnLastIfNotFound?: boolean): any; + handleIconButtonClick(el: HTMLElement): void; + initListeners(): void; + callEvent(event: SimplePickerEvent, dispatcher: (a: HandlerFunction) => void): void; + open(): void; + close(): void; + on(event: SimplePickerEvent, handler: HandlerFunction): void; + toogleDisplayFade(): void; +} +export = SimplePicker; diff --git a/dist/simplepicker.js b/dist/simplepicker.js index e73934a..6793be9 100644 --- a/dist/simplepicker.js +++ b/dist/simplepicker.js @@ -1,2 +1,2 @@ -var SimplePicker=function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=0)}({0:function(e,t,i){i("iyB0"),e.exports=i("TYVf")},"0DyV":function(e,t,i){"use strict";function n(e,t){e=[].concat(e);for(var i=0;i=12;return r&&n>12&&(n-=12),r||0!==n||(n=12),t+=n<10?"0"+n:n,t+=":"+i[1]+" ",t+=r?"PM":"AM"}},TYVf:function(e,t,i){"use strict";var n=i("0DyV"),r=i("ht6X"),s=new Date,a=function(){function e(e,t){var i=void 0,n=t;if("string"==typeof e){var r=document.querySelector(e);if(null===r)throw new Error("Invalid selector passed to SimplePicker!");i=r}else e instanceof HTMLElement?i=e:"object"==typeof e&&(n=e);i||(i=document.querySelector("body")),n||(n={}),this.selectedDate=new Date,this.injectTemplate(i),this.init(i,n),this.initListeners(),this._eventHandlers={},this._validOnListeners=["submit","close"]}return e.prototype.initElMethod=function(e){this.$=function(t){return e.querySelector(t)},this.$$=function(t){return e.querySelectorAll(t)}},e.prototype.init=function(e,t){this.$simplepickerWrapper=e.querySelector(".simplepicker-wrapper"),this.initElMethod(this.$simplepickerWrapper);var i=this.$,r=this.$$;this.$simplepicker=i(".simpilepicker-date-picker"),this.$trs=r(".simplepicker-calender tbody tr"),this.$tds=r(".simplepicker-calender tbody td"),this.$headerMonthAndYear=i(".simplepicker-month-and-year"),this.$monthAndYear=i(".simplepicker-selected-date"),this.$date=i(".simplepicker-date"),this.$day=i(".simplepicker-day-header"),this.$time=i(".simplepicker-time"),this.$timeInput=i(".simplepicker-time-section input"),this.$timeSectionIcon=i(".simplepicker-icon-time"),this.$cancel=i(".simplepicker-cancel-btn"),this.$ok=i(".simplepicker-ok-btn"),this.$displayDateElements=[this.$day,this.$headerMonthAndYear,this.$date],this.$time.classList.add("simplepicker-fade"),this.render(n.scrapeMonth(s)),t=t||{},this.opts=t,this.reset(s),void 0!==t.zIndex&&(this.$simplepickerWrapper.style.zIndex=t.zIndex.toString()),t.disableTimeSection&&this.disableTimeSection(),t.compactMode&&this.compactMode()},e.prototype.reset=function(e){var t=e||new Date;this.render(n.scrapeMonth(t));var i=t.toTimeString().split(" ")[0].replace(/\:\d\d$/,"");this.$timeInput.value=i,this.$time.innerText=n.formatTimeFromInputElement(i);var r=t.getDate().toString(),s=this.findElementWithDate(r);s.classList.contains("active")||(this.selectDateElement(s),this.updateDateComponents(t))},e.prototype.compactMode=function(){this.$date.style.display="none"},e.prototype.disableTimeSection=function(){this.$timeSectionIcon.style.visibility="hidden"},e.prototype.enableTimeSection=function(){this.$timeSectionIcon.style.visibility="visible"},e.prototype.injectTemplate=function(e){var t=document.createElement("template");t.innerHTML=r.htmlTemplate,e.appendChild(t.content.cloneNode(!0))},e.prototype.clearRows=function(){this.$tds.forEach(function(e){e.innerHTML="",e.classList.remove("active")})},e.prototype.updateDateComponents=function(e){var t=n.days[e.getDay()],i=n.months[e.getMonth()]+" "+e.getFullYear();this.$headerMonthAndYear.innerHTML=i,this.$monthAndYear.innerHTML=i,this.$day.innerHTML=t,this.$date.innerHTML=n.getDisplayDate(e)},e.prototype.render=function(e){var t=this.$$,i=this.$trs,n=e.month,r=e.date;this.clearRows(),n.forEach(function(e,t){var n=i[t].children;e.forEach(function(e,t){var i=n[t];e?(i.removeAttribute("data-empty"),i.innerHTML=e):i.setAttribute("data-empty","")})});var s=t("table tbody tr:last-child td"),a=!0;s.forEach(function(e){void 0===e.dataset.empty&&(a=!1)});var c=s[0].parentElement;c.style.display=a&&c?"none":"table-row",this.updateDateComponents(r)},e.prototype.updateSelectedDate=function(e){var t,i=this.$monthAndYear,r=this.$time;this.$date;t=e?e.innerHTML.trim():this.$date.innerHTML.replace(/[a-z]+/,"");var s=i.innerHTML.split(" "),a=s[0],c=s[1],o=n.months.indexOf(a),l=r.innerHTML.split(":"),p=+l[0],d=l[1].split(" "),m=d[0],u=d[1];"AM"===u&&12==p&&(p=0),"PM"===u&&p<12&&(p+=12);var h=new Date(+c,+o,+t,+p,+m);this.selectedDate=h;var v=t+" ";v+=i.innerHTML.trim()+" ",v+=r.innerHTML.trim(),this.readableDate=v.replace(/^\d+/,h.getDate().toString())},e.prototype.selectDateElement=function(e){var t=this.$(".simplepicker-calender tbody .active");e.classList.add("active"),t&&t.classList.remove("active"),this.updateSelectedDate(e),this.updateDateComponents(this.selectedDate)},e.prototype.findElementWithDate=function(e,t){var i,n;return void 0===t&&(t=!1),this.$tds.forEach(function(t){var r=t.innerHTML.trim();r===e&&(i=t),""!==r&&(n=t)}),void 0===i&&t&&(i=n),i},e.prototype.handleIconButtonClick=function(e){var t,i=this.$;if(e.classList.contains("simplepicker-icon-calender")){var r=i(".simplepicker-icon-time"),s=i(".simplepicker-time-section");return(c=i(".simplepicker-calender-section")).style.display="block",s.style.display="none",r.classList.remove("active"),e.classList.add("active"),void this.toogleDisplayFade()}if(e.classList.contains("simplepicker-icon-time")){var a=i(".simplepicker-icon-calender"),c=i(".simplepicker-calender-section");return(s=i(".simplepicker-time-section")).style.display="block",c.style.display="none",a.classList.remove("active"),e.classList.add("active"),void this.toogleDisplayFade()}var o=i(".simplepicker-calender td.active");if(o&&(t=o.innerHTML.trim()),e.classList.contains("simplepicker-icon-next")&&this.render(n.scrapeNextMonth()),e.classList.contains("simplepicker-icon-previous")&&this.render(n.scrapePreviousMonth()),t){var l=this.findElementWithDate(t,!0);this.selectDateElement(l)}},e.prototype.initListeners=function(){var e=this,t=e.$simplepicker,i=e.$timeInput,r=e.$ok,s=e.$cancel,a=e.$simplepickerWrapper,c=this;function o(){c.close(),c.callEvent("close",function(e){e()})}t.addEventListener("click",function(e){var t=e.target,i=t.tagName.toLowerCase();e.stopPropagation(),"td"!==i?"button"===i&&t.classList.contains("simplepicker-icon")&&c.handleIconButtonClick(t):c.selectDateElement(t)}),i.addEventListener("input",function(e){if(""!==e.target.value){var t=n.formatTimeFromInputElement(e.target.value);c.$time.innerHTML=t,c.updateSelectedDate()}}),r.addEventListener("click",function(){c.close(),c.callEvent("submit",function(e){e(c.selectedDate,c.readableDate)})}),s.addEventListener("click",o),a.addEventListener("click",o)},e.prototype.callEvent=function(e,t){(this._eventHandlers[e]||[]).forEach(function(e){t(e)})},e.prototype.open=function(){this.$simplepickerWrapper.classList.add("active")},e.prototype.close=function(){this.$simplepickerWrapper.classList.remove("active")},e.prototype.on=function(e,t){var i=this._validOnListeners,n=this._eventHandlers;if(!i.includes(e))throw new Error("Not a valid event!");n[e]=n[e]||[],n[e].push(t)},e.prototype.toogleDisplayFade=function(){this.$time.classList.toggle("simplepicker-fade"),this.$displayDateElements.forEach(function(e){e.classList.toggle("simplepicker-fade")})},e}();e.exports=a},ht6X:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.htmlTemplate='\n
\n
\n
\n
\n
\n
\n
\n \n
12:00 PM
\n \n
\n
\n
\n
\n
\n \n
\n \n
\n
\n \n \n \n \n \n '+function(e,t){for(var i="",n=1;n<=t;n++)i+=e;return i}("",6)+'\n \n
SunMonTueWedThuFriSat
\n
\n
\n
\n \n
\n
\n
\n \n \n
\n
\n
\n'},iyB0:function(e,t,i){}}); +var SimplePicker=function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=0)}({0:function(e,t,i){i("iyB0"),e.exports=i("TYVf")},"0DyV":function(e,t,i){"use strict";function n(e,t){e=[].concat(e);for(var i=0;i=12;return r&&n>12&&(n-=12),r||0!==n||(n=12),t+=n<10?"0"+n:n,t+=":"+i[1]+" ",t+=r?"PM":"AM"}},TYVf:function(e,t,i){"use strict";var n=i("0DyV"),r=i("ht6X"),s=["submit","close"],a=new Date,c=function(){function e(e,t){this._validOnListeners=s;var i=void 0,n=t;if("string"==typeof e){var r=document.querySelector(e);if(null===r)throw new Error("Invalid selector passed to SimplePicker!");i=r}else e instanceof HTMLElement?i=e:"object"==typeof e&&(n=e);i||(i=document.querySelector("body")),n||(n={}),this.selectedDate=new Date,this.injectTemplate(i),this.init(i,n),this.initListeners(),this._eventHandlers={}}return e.prototype.initElMethod=function(e){this.$=function(t){return e.querySelector(t)},this.$$=function(t){return e.querySelectorAll(t)}},e.prototype.init=function(e,t){this.$simplepickerWrapper=e.querySelector(".simplepicker-wrapper"),this.initElMethod(this.$simplepickerWrapper);var i=this.$,r=this.$$;this.$simplepicker=i(".simpilepicker-date-picker"),this.$trs=r(".simplepicker-calender tbody tr"),this.$tds=r(".simplepicker-calender tbody td"),this.$headerMonthAndYear=i(".simplepicker-month-and-year"),this.$monthAndYear=i(".simplepicker-selected-date"),this.$date=i(".simplepicker-date"),this.$day=i(".simplepicker-day-header"),this.$time=i(".simplepicker-time"),this.$timeInput=i(".simplepicker-time-section input"),this.$timeSectionIcon=i(".simplepicker-icon-time"),this.$cancel=i(".simplepicker-cancel-btn"),this.$ok=i(".simplepicker-ok-btn"),this.$displayDateElements=[this.$day,this.$headerMonthAndYear,this.$date],this.$time.classList.add("simplepicker-fade"),this.render(n.scrapeMonth(a)),t=t||{},this.opts=t,this.reset(t.selectedDate||a),void 0!==t.zIndex&&(this.$simplepickerWrapper.style.zIndex=t.zIndex.toString()),t.disableTimeSection&&this.disableTimeSection(),t.compactMode&&this.compactMode()},e.prototype.reset=function(e){var t=e||new Date;this.render(n.scrapeMonth(t));var i=t.toTimeString().split(" ")[0].replace(/\:\d\d$/,"");this.$timeInput.value=i,this.$time.innerText=n.formatTimeFromInputElement(i);var r=t.getDate().toString(),s=this.findElementWithDate(r);s.classList.contains("active")||(this.selectDateElement(s),this.updateDateComponents(t))},e.prototype.compactMode=function(){this.$date.style.display="none"},e.prototype.disableTimeSection=function(){this.$timeSectionIcon.style.visibility="hidden"},e.prototype.enableTimeSection=function(){this.$timeSectionIcon.style.visibility="visible"},e.prototype.injectTemplate=function(e){var t=document.createElement("template");t.innerHTML=r.htmlTemplate,e.appendChild(t.content.cloneNode(!0))},e.prototype.clearRows=function(){this.$tds.forEach(function(e){e.innerHTML="",e.classList.remove("active")})},e.prototype.updateDateComponents=function(e){var t=n.days[e.getDay()],i=n.months[e.getMonth()]+" "+e.getFullYear();this.$headerMonthAndYear.innerHTML=i,this.$monthAndYear.innerHTML=i,this.$day.innerHTML=t,this.$date.innerHTML=n.getDisplayDate(e)},e.prototype.render=function(e){var t=this.$$,i=this.$trs,n=e.month,r=e.date;this.clearRows(),n.forEach(function(e,t){var n=i[t].children;e.forEach(function(e,t){var i=n[t];e?(i.removeAttribute("data-empty"),i.innerHTML=e):i.setAttribute("data-empty","")})});var s=t("table tbody tr:last-child td"),a=!0;s.forEach(function(e){void 0===e.dataset.empty&&(a=!1)});var c=s[0].parentElement;c.style.display=a&&c?"none":"table-row",this.updateDateComponents(r)},e.prototype.updateSelectedDate=function(e){var t,i=this.$monthAndYear,r=this.$time;this.$date;t=e?e.innerHTML.trim():this.$date.innerHTML.replace(/[a-z]+/,"");var s=i.innerHTML.split(" "),a=s[0],c=s[1],o=n.months.indexOf(a),l=r.innerHTML.split(":"),p=+l[0],d=l[1].split(" "),m=d[0],u=d[1];"AM"===u&&12==p&&(p=0),"PM"===u&&p<12&&(p+=12);var h=new Date(+c,+o,+t,+p,+m);this.selectedDate=h;var v=t+" ";v+=i.innerHTML.trim()+" ",v+=r.innerHTML.trim(),this.readableDate=v.replace(/^\d+/,h.getDate().toString())},e.prototype.selectDateElement=function(e){var t=this.$(".simplepicker-calender tbody .active");e.classList.add("active"),t&&t.classList.remove("active"),this.updateSelectedDate(e),this.updateDateComponents(this.selectedDate)},e.prototype.findElementWithDate=function(e,t){var i,n;return void 0===t&&(t=!1),this.$tds.forEach(function(t){var r=t.innerHTML.trim();r===e&&(i=t),""!==r&&(n=t)}),void 0===i&&t&&(i=n),i},e.prototype.handleIconButtonClick=function(e){var t,i=this.$;if(e.classList.contains("simplepicker-icon-calender")){var r=i(".simplepicker-icon-time"),s=i(".simplepicker-time-section");return(c=i(".simplepicker-calender-section")).style.display="block",s.style.display="none",r.classList.remove("active"),e.classList.add("active"),void this.toogleDisplayFade()}if(e.classList.contains("simplepicker-icon-time")){var a=i(".simplepicker-icon-calender"),c=i(".simplepicker-calender-section");return(s=i(".simplepicker-time-section")).style.display="block",c.style.display="none",a.classList.remove("active"),e.classList.add("active"),void this.toogleDisplayFade()}var o=i(".simplepicker-calender td.active");if(o&&(t=o.innerHTML.trim()),e.classList.contains("simplepicker-icon-next")&&this.render(n.scrapeNextMonth()),e.classList.contains("simplepicker-icon-previous")&&this.render(n.scrapePreviousMonth()),t){var l=this.findElementWithDate(t,!0);this.selectDateElement(l)}},e.prototype.initListeners=function(){var e=this,t=e.$simplepicker,i=e.$timeInput,r=e.$ok,s=e.$cancel,a=e.$simplepickerWrapper,c=this;function o(){c.close(),c.callEvent("close",function(e){e()})}t.addEventListener("click",function(e){var t=e.target,i=t.tagName.toLowerCase();e.stopPropagation(),"td"!==i?"button"===i&&t.classList.contains("simplepicker-icon")&&c.handleIconButtonClick(t):c.selectDateElement(t)}),i.addEventListener("input",function(e){if(""!==e.target.value){var t=n.formatTimeFromInputElement(e.target.value);c.$time.innerHTML=t,c.updateSelectedDate()}}),r.addEventListener("click",function(){c.close(),c.callEvent("submit",function(e){e(c.selectedDate,c.readableDate)})}),s.addEventListener("click",o),a.addEventListener("click",o)},e.prototype.callEvent=function(e,t){(this._eventHandlers[e]||[]).forEach(function(e){t(e)})},e.prototype.open=function(){this.$simplepickerWrapper.classList.add("active")},e.prototype.close=function(){this.$simplepickerWrapper.classList.remove("active")},e.prototype.on=function(e,t){var i=this._validOnListeners,n=this._eventHandlers;if(!i.includes(e))throw new Error("Not a valid event!");n[e]=n[e]||[],n[e].push(t)},e.prototype.toogleDisplayFade=function(){this.$time.classList.toggle("simplepicker-fade"),this.$displayDateElements.forEach(function(e){e.classList.toggle("simplepicker-fade")})},e}();e.exports=c},ht6X:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.htmlTemplate='\n
\n
\n
\n
\n
\n
\n
\n \n
12:00 PM
\n \n
\n
\n
\n
\n
\n \n
\n \n
\n
\n \n \n \n \n \n '+function(e,t){for(var i="",n=1;n<=t;n++)i+=e;return i}("",6)+'\n \n
SunMonTueWedThuFriSat
\n
\n
\n
\n \n
\n
\n
\n \n \n
\n
\n
\n'},iyB0:function(e,t,i){}}); //# sourceMappingURL=simplepicker.js.map \ No newline at end of file diff --git a/dist/simplepicker.js.map b/dist/simplepicker.js.map index 09bc024..b3930cc 100644 --- a/dist/simplepicker.js.map +++ b/dist/simplepicker.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://SimplePicker/webpack/bootstrap","webpack://SimplePicker/./lib/date-util.ts","webpack://SimplePicker/./lib/index.ts","webpack://SimplePicker/./lib/template.ts"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","fill","arr","upto","concat","undefined","scrapeMonth","date","originalDate","Date","getTime","year","getFullYear","month","getMonth","data","monthTracker","current","setDate","years","tracker","rowTracker","_date","getDate","day","getDay","lastRow","lastRowLength","length","filled","months","days","scrapePreviousMonth","Error","setMonth","scrapeNextMonth","dateEndings","st","nd","rd","getDisplayDate","indexOf","formatTimeFromInputElement","input","timeString","_a","split","hour","isPM","dateUtil","template_1","today","SimplePicker","arg1","arg2","el","opts","element","document","querySelector","HTMLElement","this","selectedDate","injectTemplate","init","initListeners","_eventHandlers","_validOnListeners","initElMethod","$","sel","$$","querySelectorAll","$simplepickerWrapper","$simplepicker","$trs","$tds","$headerMonthAndYear","$monthAndYear","$date","$day","$time","$timeInput","$timeSectionIcon","$cancel","$ok","$displayDateElements","classList","add","render","reset","zIndex","style","toString","disableTimeSection","compactMode","newDate","time","toTimeString","replace","innerText","dateString","$dateEl","findElementWithDate","contains","selectDateElement","updateDateComponents","display","visibility","enableTimeSection","$template","createElement","innerHTML","htmlTemplate","appendChild","content","cloneNode","clearRows","forEach","td","remove","monthAndYear","week","index","children","removeAttribute","setAttribute","$lastRowDates","lasRowIsEmpty","dataset","empty","$lastRow","parentElement","updateSelectedDate","trim","_b","monthName","timeComponents","hours","_c","minutes","meridium","readableDate","alreadyActive","returnLastIfNotFound","lastTd","handleIconButtonClick","baseClass","$timeIcon","$timeSection","$calenderSection","toogleDisplayFade","$calenderIcon","$active","$dateTd","_this","close","callEvent","f","addEventListener","e","target","tagName","toLowerCase","stopPropagation","formattedTime","func","event","dispatcher","open","on","handler","includes","push","toggle","$el","str","times","repeated","repeat"],"mappings":"6BACA,IAAAA,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,GAAA,CACAG,EAAAH,EACAI,GAAA,EACAH,QAAA,IAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QA0DA,OArDAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,EAAA,CAA0CK,YAAA,EAAAC,IAAAL,KAK1CZ,EAAAkB,EAAA,SAAAhB,GACA,oBAAAiB,eAAAC,aACAN,OAAAC,eAAAb,EAAAiB,OAAAC,YAAA,CAAwDC,MAAA,WAExDP,OAAAC,eAAAb,EAAA,cAAiDmB,OAAA,KAQjDrB,EAAAsB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAArB,EAAAqB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,iBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAX,OAAAY,OAAA,MAGA,GAFA1B,EAAAkB,EAAAO,GACAX,OAAAC,eAAAU,EAAA,WAAyCT,YAAA,EAAAK,UACzC,EAAAE,GAAA,iBAAAF,EAA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H,EAAAP,2BAAAsH,EAAAC,OAAA/K,OACAyK,EAAA1E,MAAA+B,UAAAqD,EACAV,EAAAtB,wBAEAhD,EAAA0E,iBAAA,mBACAJ,EAAAC,QACAD,EAAAE,UAAA,kBAAAS,GACAA,EAAAX,EAAA7F,aAAA6F,EAAAb,kBAQA1D,EAAA2E,iBAAA,QAAAH,GACAnF,EAAAsF,iBAAA,QAAAH,IAEAxG,EAAAvD,UAAAgK,UAAA,SAAAU,EAAAC,IACA3G,KAAAK,eAAAqG,IAAA,IACAjD,QAAA,SAAAgD,GACAE,EAAAF,MAGAlH,EAAAvD,UAAA4K,KAAA,WACA5G,KAAAY,qBAAAc,UAAAC,IAAA,WAGApC,EAAAvD,UAAA+J,MAAA,WACA/F,KAAAY,qBAAAc,UAAAiC,OAAA,WAEApE,EAAAvD,UAAA6K,GAAA,SAAAH,EAAAI,GACA,IAAAxG,EAAAN,KAAAM,kBAAAD,EAAAL,KAAAK,eACA,IAAAC,EAAAyG,SAAAL,GACA,UAAAtI,MAAA,sBAEAiC,EAAAqG,GAAArG,EAAAqG,IAAA,GACArG,EAAAqG,GAAAM,KAAAF,IAEAvH,EAAAvD,UAAA0J,kBAAA,WACA1F,KAAAoB,MAAAM,UAAAuF,OAAA,qBACAjH,KAAAyB,qBAAAgC,QAAA,SAAAyD,GACAA,EAAAxF,UAAAuF,OAAA,wBAGA1H,EAxUA,GA0UApF,EAAAD,QAAAqF,qCC7UAzE,OAAAC,eAAAb,EAAA,cAA8CmB,OAAA,IAQ9CnB,EAAAkJ,aAAA,gzCAPA,SAAA+D,EAAAC,GAEA,IADA,IAAAC,EAAA,GACAjN,EAAA,EAAmBA,GAAAgN,EAAYhN,IAC/BiN,GAAAF,EAEA,OAAAE,EAEAC,CAAA","file":"simplepicker.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n;\r\nexports.monthTracker = {\r\n years: {}\r\n};\r\nexports.months = [\r\n 'January',\r\n 'February',\r\n 'March',\r\n 'April',\r\n 'May',\r\n 'June',\r\n 'July',\r\n 'August',\r\n 'September',\r\n 'October',\r\n 'November',\r\n 'December'\r\n];\r\nexports.days = [\r\n 'Sunday',\r\n 'Monday',\r\n 'Tuesday',\r\n 'Wednesday',\r\n 'Thursday',\r\n 'Friday',\r\n 'Saturday'\r\n];\r\nfunction fill(arr, upto) {\r\n var temp = [];\r\n arr = temp.concat(arr);\r\n for (var i = 0; i < upto; i++) {\r\n arr[i] = undefined;\r\n }\r\n return arr;\r\n}\r\n// builds the calender for one month given a date\r\n// which is end, start or in middle of the month\r\nfunction scrapeMonth(date) {\r\n var originalDate = new Date(date.getTime());\r\n var year = date.getFullYear();\r\n var month = date.getMonth();\r\n var data = {\r\n date: originalDate,\r\n month: undefined\r\n };\r\n exports.monthTracker.current = new Date(date.getTime());\r\n exports.monthTracker.current.setDate(1);\r\n exports.monthTracker.years[year] = exports.monthTracker.years[year] || {};\r\n if (exports.monthTracker.years[year][month] !== undefined) {\r\n data.month = exports.monthTracker.years[year][month];\r\n return data;\r\n }\r\n date = new Date(date.getTime());\r\n date.setDate(1);\r\n exports.monthTracker.years[year][month] = [];\r\n var tracker = exports.monthTracker.years[year][month];\r\n var rowTracker = 0;\r\n while (date.getMonth() === month) {\r\n var _date = date.getDate();\r\n var day = date.getDay();\r\n if (_date === 1) {\r\n tracker[rowTracker] = fill([], day);\r\n }\r\n tracker[rowTracker] = tracker[rowTracker] || [];\r\n tracker[rowTracker][day] = _date;\r\n if (day === 6) {\r\n rowTracker++;\r\n }\r\n date.setDate(date.getDate() + 1);\r\n }\r\n var lastRow = 5;\r\n if (tracker[5] === undefined) {\r\n lastRow = 4;\r\n tracker[5] = fill([], 7);\r\n }\r\n var lastRowLength = tracker[lastRow].length;\r\n if (lastRowLength < 7) {\r\n var filled = tracker[lastRow].concat(fill([], 7 - lastRowLength));\r\n tracker[lastRow] = filled;\r\n }\r\n data.month = tracker;\r\n return data;\r\n}\r\nexports.scrapeMonth = scrapeMonth;\r\nfunction scrapePreviousMonth() {\r\n var date = exports.monthTracker.current;\r\n if (!date) {\r\n throw Error('scrapePrevoisMonth called without setting monthTracker.current!');\r\n }\r\n date.setMonth(date.getMonth() - 1);\r\n return scrapeMonth(date);\r\n}\r\nexports.scrapePreviousMonth = scrapePreviousMonth;\r\nfunction scrapeNextMonth() {\r\n var date = exports.monthTracker.current;\r\n if (!date) {\r\n throw Error('scrapePrevoisMonth called without setting monthTracker.current!');\r\n }\r\n date.setMonth(date.getMonth() + 1);\r\n return scrapeMonth(date);\r\n}\r\nexports.scrapeNextMonth = scrapeNextMonth;\r\nvar dateEndings = {\r\n st: [1, 21, 31],\r\n nd: [2, 22],\r\n rd: [3, 23]\r\n};\r\nfunction getDisplayDate(_date) {\r\n var date = _date.getDate();\r\n if (dateEndings.st.indexOf(date) !== -1) {\r\n return date + 'st';\r\n }\r\n if (dateEndings.nd.indexOf(date) !== -1) {\r\n return date + 'nd';\r\n }\r\n if (dateEndings.rd.indexOf(date) !== -1) {\r\n return date + 'rd';\r\n }\r\n return date + 'th';\r\n}\r\nexports.getDisplayDate = getDisplayDate;\r\nfunction formatTimeFromInputElement(input) {\r\n var timeString = '';\r\n var _a = input.split(':'), hour = _a[0], minute = _a[1];\r\n hour = +hour;\r\n var isPM = hour >= 12;\r\n if (isPM && hour > 12) {\r\n hour = hour - 12;\r\n }\r\n if (!isPM && hour === 0) {\r\n hour = 12;\r\n }\r\n timeString += hour < 10 ? '0' + hour : hour;\r\n timeString += ':' + minute + ' ';\r\n timeString += isPM ? 'PM' : 'AM';\r\n return timeString;\r\n}\r\nexports.formatTimeFromInputElement = formatTimeFromInputElement;\r\n","\"use strict\";\r\nvar dateUtil = require(\"./date-util\");\r\nvar template_1 = require(\"./template\");\r\nvar today = new Date();\r\nvar SimplePicker = /** @class */ (function () {\r\n function SimplePicker(arg1, arg2) {\r\n var el = undefined;\r\n var opts = arg2;\r\n if (typeof arg1 === 'string') {\r\n var element = document.querySelector(arg1);\r\n if (element !== null) {\r\n el = element;\r\n }\r\n else {\r\n throw new Error('Invalid selector passed to SimplePicker!');\r\n }\r\n }\r\n else if (arg1 instanceof HTMLElement) {\r\n el = arg1;\r\n }\r\n else if (typeof arg1 === 'object') {\r\n opts = arg1;\r\n }\r\n if (!el) {\r\n el = document.querySelector('body');\r\n }\r\n if (!opts) {\r\n opts = {};\r\n }\r\n this.selectedDate = new Date();\r\n this.injectTemplate(el);\r\n this.init(el, opts);\r\n this.initListeners();\r\n this._eventHandlers = {};\r\n this._validOnListeners = [\r\n 'submit',\r\n 'close',\r\n ];\r\n }\r\n // We use $, $$ as helper method to conviently select\r\n // element we need for simplepicker.\r\n // Also, Limit the query to the wrapper class to avoid\r\n // selecting elements on the other instance.\r\n SimplePicker.prototype.initElMethod = function (el) {\r\n this.$ = function (sel) { return el.querySelector(sel); };\r\n this.$$ = function (sel) { return el.querySelectorAll(sel); };\r\n };\r\n SimplePicker.prototype.init = function (el, opts) {\r\n this.$simplepickerWrapper = el.querySelector('.simplepicker-wrapper');\r\n this.initElMethod(this.$simplepickerWrapper);\r\n var _a = this, $ = _a.$, $$ = _a.$$;\r\n this.$simplepicker = $('.simpilepicker-date-picker');\r\n this.$trs = $$('.simplepicker-calender tbody tr');\r\n this.$tds = $$('.simplepicker-calender tbody td');\r\n this.$headerMonthAndYear = $('.simplepicker-month-and-year');\r\n this.$monthAndYear = $('.simplepicker-selected-date');\r\n this.$date = $('.simplepicker-date');\r\n this.$day = $('.simplepicker-day-header');\r\n this.$time = $('.simplepicker-time');\r\n this.$timeInput = $('.simplepicker-time-section input');\r\n this.$timeSectionIcon = $('.simplepicker-icon-time');\r\n this.$cancel = $('.simplepicker-cancel-btn');\r\n this.$ok = $('.simplepicker-ok-btn');\r\n this.$displayDateElements = [\r\n this.$day,\r\n this.$headerMonthAndYear,\r\n this.$date\r\n ];\r\n this.$time.classList.add('simplepicker-fade');\r\n this.render(dateUtil.scrapeMonth(today));\r\n opts = opts || {};\r\n this.opts = opts;\r\n this.reset(today);\r\n if (opts.zIndex !== undefined) {\r\n this.$simplepickerWrapper.style.zIndex = opts.zIndex.toString();\r\n }\r\n if (opts.disableTimeSection) {\r\n this.disableTimeSection();\r\n }\r\n if (opts.compactMode) {\r\n this.compactMode();\r\n }\r\n };\r\n // Reset by selecting current date.\r\n SimplePicker.prototype.reset = function (newDate) {\r\n var date = newDate || new Date();\r\n this.render(dateUtil.scrapeMonth(date));\r\n // The timeFull variable below will be formatted as HH:mm:ss.\r\n // Using regular experssion we remove the :ss parts.\r\n var timeFull = date.toTimeString().split(\" \")[0];\r\n var time = timeFull.replace(/\\:\\d\\d$/, \"\");\r\n this.$timeInput.value = time;\r\n this.$time.innerText = dateUtil.formatTimeFromInputElement(time);\r\n var dateString = date.getDate().toString();\r\n var $dateEl = this.findElementWithDate(dateString);\r\n if (!$dateEl.classList.contains('active')) {\r\n this.selectDateElement($dateEl);\r\n this.updateDateComponents(date);\r\n }\r\n };\r\n SimplePicker.prototype.compactMode = function () {\r\n var $date = this.$date;\r\n $date.style.display = 'none';\r\n };\r\n SimplePicker.prototype.disableTimeSection = function () {\r\n var $timeSectionIcon = this.$timeSectionIcon;\r\n $timeSectionIcon.style.visibility = 'hidden';\r\n };\r\n SimplePicker.prototype.enableTimeSection = function () {\r\n var $timeSectionIcon = this.$timeSectionIcon;\r\n $timeSectionIcon.style.visibility = 'visible';\r\n };\r\n SimplePicker.prototype.injectTemplate = function (el) {\r\n var $template = document.createElement('template');\r\n $template.innerHTML = template_1.htmlTemplate;\r\n el.appendChild($template.content.cloneNode(true));\r\n };\r\n SimplePicker.prototype.clearRows = function () {\r\n this.$tds.forEach(function (td) {\r\n td.innerHTML = '';\r\n td.classList.remove('active');\r\n });\r\n };\r\n SimplePicker.prototype.updateDateComponents = function (date) {\r\n var day = dateUtil.days[date.getDay()];\r\n var month = dateUtil.months[date.getMonth()];\r\n var year = date.getFullYear();\r\n var monthAndYear = month + ' ' + year;\r\n this.$headerMonthAndYear.innerHTML = monthAndYear;\r\n this.$monthAndYear.innerHTML = monthAndYear;\r\n this.$day.innerHTML = day;\r\n this.$date.innerHTML = dateUtil.getDisplayDate(date);\r\n };\r\n SimplePicker.prototype.render = function (data) {\r\n var _a = this, $$ = _a.$$, $trs = _a.$trs;\r\n var month = data.month, date = data.date;\r\n this.clearRows();\r\n month.forEach(function (week, index) {\r\n var $tds = $trs[index].children;\r\n week.forEach(function (day, index) {\r\n var td = $tds[index];\r\n if (!day) {\r\n td.setAttribute('data-empty', '');\r\n return;\r\n }\r\n td.removeAttribute('data-empty');\r\n td.innerHTML = day;\r\n });\r\n });\r\n var $lastRowDates = $$('table tbody tr:last-child td');\r\n var lasRowIsEmpty = true;\r\n $lastRowDates.forEach(function (date) {\r\n if (date.dataset.empty === undefined) {\r\n lasRowIsEmpty = false;\r\n }\r\n });\r\n // hide last row if it's empty to avoid\r\n // extra spacing due to last row\r\n var $lastRow = $lastRowDates[0].parentElement;\r\n if (lasRowIsEmpty && $lastRow) {\r\n $lastRow.style.display = 'none';\r\n }\r\n else {\r\n $lastRow.style.display = 'table-row';\r\n }\r\n this.updateDateComponents(date);\r\n };\r\n SimplePicker.prototype.updateSelectedDate = function (el) {\r\n var _a = this, $monthAndYear = _a.$monthAndYear, $time = _a.$time, $date = _a.$date;\r\n var day;\r\n if (el) {\r\n day = el.innerHTML.trim();\r\n }\r\n else {\r\n day = this.$date.innerHTML.replace(/[a-z]+/, '');\r\n }\r\n var _b = $monthAndYear.innerHTML.split(' '), monthName = _b[0], year = _b[1];\r\n var month = dateUtil.months.indexOf(monthName);\r\n var timeComponents = $time.innerHTML.split(':');\r\n var hours = +timeComponents[0];\r\n var _c = timeComponents[1].split(' '), minutes = _c[0], meridium = _c[1];\r\n if (meridium === 'AM' && hours == 12) {\r\n hours = 0;\r\n }\r\n if (meridium === 'PM' && hours < 12) {\r\n hours += 12;\r\n }\r\n var date = new Date(+year, +month, +day, +hours, +minutes);\r\n this.selectedDate = date;\r\n var _date = day + ' ';\r\n _date += $monthAndYear.innerHTML.trim() + ' ';\r\n _date += $time.innerHTML.trim();\r\n this.readableDate = _date.replace(/^\\d+/, date.getDate().toString());\r\n };\r\n SimplePicker.prototype.selectDateElement = function (el) {\r\n var alreadyActive = this.$('.simplepicker-calender tbody .active');\r\n el.classList.add('active');\r\n if (alreadyActive) {\r\n alreadyActive.classList.remove('active');\r\n }\r\n this.updateSelectedDate(el);\r\n this.updateDateComponents(this.selectedDate);\r\n };\r\n SimplePicker.prototype.findElementWithDate = function (date, returnLastIfNotFound) {\r\n if (returnLastIfNotFound === void 0) { returnLastIfNotFound = false; }\r\n var $tds = this.$tds;\r\n var el, lastTd;\r\n $tds.forEach(function (td) {\r\n var content = td.innerHTML.trim();\r\n if (content === date) {\r\n el = td;\r\n }\r\n if (content !== '') {\r\n lastTd = td;\r\n }\r\n });\r\n if (el === undefined && returnLastIfNotFound) {\r\n el = lastTd;\r\n }\r\n return el;\r\n };\r\n SimplePicker.prototype.handleIconButtonClick = function (el) {\r\n var $ = this.$;\r\n var baseClass = 'simplepicker-icon-';\r\n var nextIcon = baseClass + 'next';\r\n var previousIcon = baseClass + 'previous';\r\n var calenderIcon = baseClass + 'calender';\r\n var timeIcon = baseClass + 'time';\r\n if (el.classList.contains(calenderIcon)) {\r\n var $timeIcon = $('.' + timeIcon);\r\n var $timeSection = $('.simplepicker-time-section');\r\n var $calenderSection = $('.simplepicker-calender-section');\r\n $calenderSection.style.display = 'block';\r\n $timeSection.style.display = 'none';\r\n $timeIcon.classList.remove('active');\r\n el.classList.add('active');\r\n this.toogleDisplayFade();\r\n return;\r\n }\r\n if (el.classList.contains(timeIcon)) {\r\n var $calenderIcon = $('.' + calenderIcon);\r\n var $calenderSection = $('.simplepicker-calender-section');\r\n var $timeSection = $('.simplepicker-time-section');\r\n $timeSection.style.display = 'block';\r\n $calenderSection.style.display = 'none';\r\n $calenderIcon.classList.remove('active');\r\n el.classList.add('active');\r\n this.toogleDisplayFade();\r\n return;\r\n }\r\n var selectedDate;\r\n var $active = $('.simplepicker-calender td.active');\r\n if ($active) {\r\n selectedDate = $active.innerHTML.trim();\r\n }\r\n if (el.classList.contains(nextIcon)) {\r\n this.render(dateUtil.scrapeNextMonth());\r\n }\r\n if (el.classList.contains(previousIcon)) {\r\n this.render(dateUtil.scrapePreviousMonth());\r\n }\r\n if (selectedDate) {\r\n var $dateTd = this.findElementWithDate(selectedDate, true);\r\n this.selectDateElement($dateTd);\r\n }\r\n };\r\n SimplePicker.prototype.initListeners = function () {\r\n var _a = this, $simplepicker = _a.$simplepicker, $timeInput = _a.$timeInput, $ok = _a.$ok, $cancel = _a.$cancel, $simplepickerWrapper = _a.$simplepickerWrapper;\r\n var _this = this;\r\n $simplepicker.addEventListener('click', function (e) {\r\n var target = e.target;\r\n var tagName = target.tagName.toLowerCase();\r\n e.stopPropagation();\r\n if (tagName === 'td') {\r\n _this.selectDateElement(target);\r\n return;\r\n }\r\n if (tagName === 'button' &&\r\n target.classList.contains('simplepicker-icon')) {\r\n _this.handleIconButtonClick(target);\r\n return;\r\n }\r\n });\r\n $timeInput.addEventListener('input', function (e) {\r\n if (e.target.value === '') {\r\n return;\r\n }\r\n var formattedTime = dateUtil.formatTimeFromInputElement(e.target.value);\r\n _this.$time.innerHTML = formattedTime;\r\n _this.updateSelectedDate();\r\n });\r\n $ok.addEventListener('click', function () {\r\n _this.close();\r\n _this.callEvent('submit', function (func) {\r\n func(_this.selectedDate, _this.readableDate);\r\n });\r\n });\r\n function close() {\r\n _this.close();\r\n _this.callEvent('close', function (f) { f(); });\r\n }\r\n ;\r\n $cancel.addEventListener('click', close);\r\n $simplepickerWrapper.addEventListener('click', close);\r\n };\r\n SimplePicker.prototype.callEvent = function (event, dispatcher) {\r\n var listeners = this._eventHandlers[event] || [];\r\n listeners.forEach(function (func) {\r\n dispatcher(func);\r\n });\r\n };\r\n SimplePicker.prototype.open = function () {\r\n this.$simplepickerWrapper.classList.add('active');\r\n };\r\n // can be called by user or by click the cancel btn.\r\n SimplePicker.prototype.close = function () {\r\n this.$simplepickerWrapper.classList.remove('active');\r\n };\r\n SimplePicker.prototype.on = function (event, handler) {\r\n var _a = this, _validOnListeners = _a._validOnListeners, _eventHandlers = _a._eventHandlers;\r\n if (!_validOnListeners.includes(event)) {\r\n throw new Error('Not a valid event!');\r\n }\r\n _eventHandlers[event] = _eventHandlers[event] || [];\r\n _eventHandlers[event].push(handler);\r\n };\r\n SimplePicker.prototype.toogleDisplayFade = function () {\r\n this.$time.classList.toggle('simplepicker-fade');\r\n this.$displayDateElements.forEach(function ($el) {\r\n $el.classList.toggle('simplepicker-fade');\r\n });\r\n };\r\n return SimplePicker;\r\n}());\r\nmodule.exports = SimplePicker;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nfunction repeat(str, times) {\r\n var repeated = '';\r\n for (var i = 1; i <= times; i++) {\r\n repeated += str;\r\n }\r\n return repeated;\r\n}\r\nexports.htmlTemplate = \"\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n \\n
12:00 PM
\\n \\n
\\n
\\n
\\n
\\n
\\n \\n
\\n \\n
\\n
\\n \\n \\n \\n \\n \\n \" + repeat('', 6) + \"\\n \\n
SunMonTueWedThuFriSat
\\n
\\n
\\n
\\n \\n
\\n
\\n
\\n \\n \\n
\\n
\\n
\\n\";\r\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://SimplePicker/webpack/bootstrap","webpack://SimplePicker/./lib/date-util.ts","webpack://SimplePicker/./lib/index.ts","webpack://SimplePicker/./lib/template.ts"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","fill","arr","upto","concat","undefined","scrapeMonth","date","originalDate","Date","getTime","year","getFullYear","month","getMonth","data","monthTracker","current","setDate","years","tracker","rowTracker","_date","getDate","day","getDay","lastRow","lastRowLength","length","filled","months","days","scrapePreviousMonth","Error","setMonth","scrapeNextMonth","dateEndings","st","nd","rd","getDisplayDate","indexOf","formatTimeFromInputElement","input","timeString","_a","split","hour","isPM","dateUtil","template_1","validListeners","today","SimplePicker","arg1","arg2","this","_validOnListeners","el","opts","element","document","querySelector","HTMLElement","selectedDate","injectTemplate","init","initListeners","_eventHandlers","initElMethod","$","sel","$$","querySelectorAll","$simplepickerWrapper","$simplepicker","$trs","$tds","$headerMonthAndYear","$monthAndYear","$date","$day","$time","$timeInput","$timeSectionIcon","$cancel","$ok","$displayDateElements","classList","add","render","reset","zIndex","style","toString","disableTimeSection","compactMode","newDate","time","toTimeString","replace","innerText","dateString","$dateEl","findElementWithDate","contains","selectDateElement","updateDateComponents","display","visibility","enableTimeSection","$template","createElement","innerHTML","htmlTemplate","appendChild","content","cloneNode","clearRows","forEach","td","remove","monthAndYear","week","index","children","removeAttribute","setAttribute","$lastRowDates","lasRowIsEmpty","dataset","empty","$lastRow","parentElement","updateSelectedDate","trim","_b","monthName","timeComponents","hours","_c","minutes","meridium","readableDate","alreadyActive","returnLastIfNotFound","lastTd","handleIconButtonClick","baseClass","$timeIcon","$timeSection","$calenderSection","toogleDisplayFade","$calenderIcon","$active","$dateTd","_this","close","callEvent","f","addEventListener","e","target","tagName","toLowerCase","stopPropagation","formattedTime","func","event","dispatcher","open","on","handler","includes","push","toggle","$el","str","times","repeated","repeat"],"mappings":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C,IACAjH,KAAAY,eAAAoG,IAAA,IACAjD,QAAA,SAAAgD,GACAE,EAAAF,MAGAlH,EAAAxD,UAAA6K,KAAA,WACAlH,KAAAkB,qBAAAc,UAAAC,IAAA,WAGApC,EAAAxD,UAAAgK,MAAA,WACArG,KAAAkB,qBAAAc,UAAAiC,OAAA,WAEApE,EAAAxD,UAAA8K,GAAA,SAAAH,EAAAI,GACA,IAAAnH,EAAAD,KAAAC,kBAAAW,EAAAZ,KAAAY,eACA,IAAAX,EAAAoH,SAAAL,GACA,UAAAvI,MAAA,sBAEAmC,EAAAoG,GAAApG,EAAAoG,IAAA,GACApG,EAAAoG,GAAAM,KAAAF,IAEAvH,EAAAxD,UAAA2J,kBAAA,WACAhG,KAAA0B,MAAAM,UAAAuF,OAAA,qBACAvH,KAAA+B,qBAAAgC,QAAA,SAAAyD,GACAA,EAAAxF,UAAAuF,OAAA,wBAGA1H,EArUA,GAuUArF,EAAAD,QAAAsF,qCC9UA1E,OAAAC,eAAAb,EAAA,cAA8CmB,OAAA,IAQ9CnB,EAAAmJ,aAAA,gzCAPA,SAAA+D,EAAAC,GAEA,IADA,IAAAC,EAAA,GACAlN,EAAA,EAAmBA,GAAAiN,EAAYjN,IAC/BkN,GAAAF,EAEA,OAAAE,EAEAC,CAAA","file":"simplepicker.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n;\r\nexports.monthTracker = {\r\n years: {}\r\n};\r\nexports.months = [\r\n 'January',\r\n 'February',\r\n 'March',\r\n 'April',\r\n 'May',\r\n 'June',\r\n 'July',\r\n 'August',\r\n 'September',\r\n 'October',\r\n 'November',\r\n 'December'\r\n];\r\nexports.days = [\r\n 'Sunday',\r\n 'Monday',\r\n 'Tuesday',\r\n 'Wednesday',\r\n 'Thursday',\r\n 'Friday',\r\n 'Saturday'\r\n];\r\nfunction fill(arr, upto) {\r\n var temp = [];\r\n arr = temp.concat(arr);\r\n for (var i = 0; i < upto; i++) {\r\n arr[i] = undefined;\r\n }\r\n return arr;\r\n}\r\n// builds the calender for one month given a date\r\n// which is end, start or in middle of the month\r\nfunction scrapeMonth(date) {\r\n var originalDate = new Date(date.getTime());\r\n var year = date.getFullYear();\r\n var month = date.getMonth();\r\n var data = {\r\n date: originalDate,\r\n month: undefined\r\n };\r\n exports.monthTracker.current = new Date(date.getTime());\r\n exports.monthTracker.current.setDate(1);\r\n exports.monthTracker.years[year] = exports.monthTracker.years[year] || {};\r\n if (exports.monthTracker.years[year][month] !== undefined) {\r\n data.month = exports.monthTracker.years[year][month];\r\n return data;\r\n }\r\n date = new Date(date.getTime());\r\n date.setDate(1);\r\n exports.monthTracker.years[year][month] = [];\r\n var tracker = exports.monthTracker.years[year][month];\r\n var rowTracker = 0;\r\n while (date.getMonth() === month) {\r\n var _date = date.getDate();\r\n var day = date.getDay();\r\n if (_date === 1) {\r\n tracker[rowTracker] = fill([], day);\r\n }\r\n tracker[rowTracker] = tracker[rowTracker] || [];\r\n tracker[rowTracker][day] = _date;\r\n if (day === 6) {\r\n rowTracker++;\r\n }\r\n date.setDate(date.getDate() + 1);\r\n }\r\n var lastRow = 5;\r\n if (tracker[5] === undefined) {\r\n lastRow = 4;\r\n tracker[5] = fill([], 7);\r\n }\r\n var lastRowLength = tracker[lastRow].length;\r\n if (lastRowLength < 7) {\r\n var filled = tracker[lastRow].concat(fill([], 7 - lastRowLength));\r\n tracker[lastRow] = filled;\r\n }\r\n data.month = tracker;\r\n return data;\r\n}\r\nexports.scrapeMonth = scrapeMonth;\r\nfunction scrapePreviousMonth() {\r\n var date = exports.monthTracker.current;\r\n if (!date) {\r\n throw Error('scrapePrevoisMonth called without setting monthTracker.current!');\r\n }\r\n date.setMonth(date.getMonth() - 1);\r\n return scrapeMonth(date);\r\n}\r\nexports.scrapePreviousMonth = scrapePreviousMonth;\r\nfunction scrapeNextMonth() {\r\n var date = exports.monthTracker.current;\r\n if (!date) {\r\n throw Error('scrapePrevoisMonth called without setting monthTracker.current!');\r\n }\r\n date.setMonth(date.getMonth() + 1);\r\n return scrapeMonth(date);\r\n}\r\nexports.scrapeNextMonth = scrapeNextMonth;\r\nvar dateEndings = {\r\n st: [1, 21, 31],\r\n nd: [2, 22],\r\n rd: [3, 23]\r\n};\r\nfunction getDisplayDate(_date) {\r\n var date = _date.getDate();\r\n if (dateEndings.st.indexOf(date) !== -1) {\r\n return date + 'st';\r\n }\r\n if (dateEndings.nd.indexOf(date) !== -1) {\r\n return date + 'nd';\r\n }\r\n if (dateEndings.rd.indexOf(date) !== -1) {\r\n return date + 'rd';\r\n }\r\n return date + 'th';\r\n}\r\nexports.getDisplayDate = getDisplayDate;\r\nfunction formatTimeFromInputElement(input) {\r\n var timeString = '';\r\n var _a = input.split(':'), hour = _a[0], minute = _a[1];\r\n hour = +hour;\r\n var isPM = hour >= 12;\r\n if (isPM && hour > 12) {\r\n hour = hour - 12;\r\n }\r\n if (!isPM && hour === 0) {\r\n hour = 12;\r\n }\r\n timeString += hour < 10 ? '0' + hour : hour;\r\n timeString += ':' + minute + ' ';\r\n timeString += isPM ? 'PM' : 'AM';\r\n return timeString;\r\n}\r\nexports.formatTimeFromInputElement = formatTimeFromInputElement;\r\n","\"use strict\";\r\nvar dateUtil = require(\"./date-util\");\r\nvar template_1 = require(\"./template\");\r\nvar validListeners = [\r\n 'submit',\r\n 'close',\r\n];\r\nvar today = new Date();\r\nvar SimplePicker = /** @class */ (function () {\r\n function SimplePicker(arg1, arg2) {\r\n this._validOnListeners = validListeners;\r\n var el = undefined;\r\n var opts = arg2;\r\n if (typeof arg1 === 'string') {\r\n var element = document.querySelector(arg1);\r\n if (element !== null) {\r\n el = element;\r\n }\r\n else {\r\n throw new Error('Invalid selector passed to SimplePicker!');\r\n }\r\n }\r\n else if (arg1 instanceof HTMLElement) {\r\n el = arg1;\r\n }\r\n else if (typeof arg1 === 'object') {\r\n opts = arg1;\r\n }\r\n if (!el) {\r\n el = document.querySelector('body');\r\n }\r\n if (!opts) {\r\n opts = {};\r\n }\r\n this.selectedDate = new Date();\r\n this.injectTemplate(el);\r\n this.init(el, opts);\r\n this.initListeners();\r\n this._eventHandlers = {};\r\n }\r\n // We use $, $$ as helper method to conviently select\r\n // element we need for simplepicker.\r\n // Also, Limit the query to the wrapper class to avoid\r\n // selecting elements on the other instance.\r\n SimplePicker.prototype.initElMethod = function (el) {\r\n this.$ = function (sel) { return el.querySelector(sel); };\r\n this.$$ = function (sel) { return el.querySelectorAll(sel); };\r\n };\r\n SimplePicker.prototype.init = function (el, opts) {\r\n this.$simplepickerWrapper = el.querySelector('.simplepicker-wrapper');\r\n this.initElMethod(this.$simplepickerWrapper);\r\n var _a = this, $ = _a.$, $$ = _a.$$;\r\n this.$simplepicker = $('.simpilepicker-date-picker');\r\n this.$trs = $$('.simplepicker-calender tbody tr');\r\n this.$tds = $$('.simplepicker-calender tbody td');\r\n this.$headerMonthAndYear = $('.simplepicker-month-and-year');\r\n this.$monthAndYear = $('.simplepicker-selected-date');\r\n this.$date = $('.simplepicker-date');\r\n this.$day = $('.simplepicker-day-header');\r\n this.$time = $('.simplepicker-time');\r\n this.$timeInput = $('.simplepicker-time-section input');\r\n this.$timeSectionIcon = $('.simplepicker-icon-time');\r\n this.$cancel = $('.simplepicker-cancel-btn');\r\n this.$ok = $('.simplepicker-ok-btn');\r\n this.$displayDateElements = [\r\n this.$day,\r\n this.$headerMonthAndYear,\r\n this.$date\r\n ];\r\n this.$time.classList.add('simplepicker-fade');\r\n this.render(dateUtil.scrapeMonth(today));\r\n opts = opts || {};\r\n this.opts = opts;\r\n this.reset(opts.selectedDate || today);\r\n if (opts.zIndex !== undefined) {\r\n this.$simplepickerWrapper.style.zIndex = opts.zIndex.toString();\r\n }\r\n if (opts.disableTimeSection) {\r\n this.disableTimeSection();\r\n }\r\n if (opts.compactMode) {\r\n this.compactMode();\r\n }\r\n };\r\n // Reset by selecting current date.\r\n SimplePicker.prototype.reset = function (newDate) {\r\n var date = newDate || new Date();\r\n this.render(dateUtil.scrapeMonth(date));\r\n // The timeFull variable below will be formatted as HH:mm:ss.\r\n // Using regular experssion we remove the :ss parts.\r\n var timeFull = date.toTimeString().split(\" \")[0];\r\n var time = timeFull.replace(/\\:\\d\\d$/, \"\");\r\n this.$timeInput.value = time;\r\n this.$time.innerText = dateUtil.formatTimeFromInputElement(time);\r\n var dateString = date.getDate().toString();\r\n var $dateEl = this.findElementWithDate(dateString);\r\n if (!$dateEl.classList.contains('active')) {\r\n this.selectDateElement($dateEl);\r\n this.updateDateComponents(date);\r\n }\r\n };\r\n SimplePicker.prototype.compactMode = function () {\r\n var $date = this.$date;\r\n $date.style.display = 'none';\r\n };\r\n SimplePicker.prototype.disableTimeSection = function () {\r\n var $timeSectionIcon = this.$timeSectionIcon;\r\n $timeSectionIcon.style.visibility = 'hidden';\r\n };\r\n SimplePicker.prototype.enableTimeSection = function () {\r\n var $timeSectionIcon = this.$timeSectionIcon;\r\n $timeSectionIcon.style.visibility = 'visible';\r\n };\r\n SimplePicker.prototype.injectTemplate = function (el) {\r\n var $template = document.createElement('template');\r\n $template.innerHTML = template_1.htmlTemplate;\r\n el.appendChild($template.content.cloneNode(true));\r\n };\r\n SimplePicker.prototype.clearRows = function () {\r\n this.$tds.forEach(function (td) {\r\n td.innerHTML = '';\r\n td.classList.remove('active');\r\n });\r\n };\r\n SimplePicker.prototype.updateDateComponents = function (date) {\r\n var day = dateUtil.days[date.getDay()];\r\n var month = dateUtil.months[date.getMonth()];\r\n var year = date.getFullYear();\r\n var monthAndYear = month + ' ' + year;\r\n this.$headerMonthAndYear.innerHTML = monthAndYear;\r\n this.$monthAndYear.innerHTML = monthAndYear;\r\n this.$day.innerHTML = day;\r\n this.$date.innerHTML = dateUtil.getDisplayDate(date);\r\n };\r\n SimplePicker.prototype.render = function (data) {\r\n var _a = this, $$ = _a.$$, $trs = _a.$trs;\r\n var month = data.month, date = data.date;\r\n this.clearRows();\r\n month.forEach(function (week, index) {\r\n var $tds = $trs[index].children;\r\n week.forEach(function (day, index) {\r\n var td = $tds[index];\r\n if (!day) {\r\n td.setAttribute('data-empty', '');\r\n return;\r\n }\r\n td.removeAttribute('data-empty');\r\n td.innerHTML = day;\r\n });\r\n });\r\n var $lastRowDates = $$('table tbody tr:last-child td');\r\n var lasRowIsEmpty = true;\r\n $lastRowDates.forEach(function (date) {\r\n if (date.dataset.empty === undefined) {\r\n lasRowIsEmpty = false;\r\n }\r\n });\r\n // hide last row if it's empty to avoid\r\n // extra spacing due to last row\r\n var $lastRow = $lastRowDates[0].parentElement;\r\n if (lasRowIsEmpty && $lastRow) {\r\n $lastRow.style.display = 'none';\r\n }\r\n else {\r\n $lastRow.style.display = 'table-row';\r\n }\r\n this.updateDateComponents(date);\r\n };\r\n SimplePicker.prototype.updateSelectedDate = function (el) {\r\n var _a = this, $monthAndYear = _a.$monthAndYear, $time = _a.$time, $date = _a.$date;\r\n var day;\r\n if (el) {\r\n day = el.innerHTML.trim();\r\n }\r\n else {\r\n day = this.$date.innerHTML.replace(/[a-z]+/, '');\r\n }\r\n var _b = $monthAndYear.innerHTML.split(' '), monthName = _b[0], year = _b[1];\r\n var month = dateUtil.months.indexOf(monthName);\r\n var timeComponents = $time.innerHTML.split(':');\r\n var hours = +timeComponents[0];\r\n var _c = timeComponents[1].split(' '), minutes = _c[0], meridium = _c[1];\r\n if (meridium === 'AM' && hours == 12) {\r\n hours = 0;\r\n }\r\n if (meridium === 'PM' && hours < 12) {\r\n hours += 12;\r\n }\r\n var date = new Date(+year, +month, +day, +hours, +minutes);\r\n this.selectedDate = date;\r\n var _date = day + ' ';\r\n _date += $monthAndYear.innerHTML.trim() + ' ';\r\n _date += $time.innerHTML.trim();\r\n this.readableDate = _date.replace(/^\\d+/, date.getDate().toString());\r\n };\r\n SimplePicker.prototype.selectDateElement = function (el) {\r\n var alreadyActive = this.$('.simplepicker-calender tbody .active');\r\n el.classList.add('active');\r\n if (alreadyActive) {\r\n alreadyActive.classList.remove('active');\r\n }\r\n this.updateSelectedDate(el);\r\n this.updateDateComponents(this.selectedDate);\r\n };\r\n SimplePicker.prototype.findElementWithDate = function (date, returnLastIfNotFound) {\r\n if (returnLastIfNotFound === void 0) { returnLastIfNotFound = false; }\r\n var $tds = this.$tds;\r\n var el, lastTd;\r\n $tds.forEach(function (td) {\r\n var content = td.innerHTML.trim();\r\n if (content === date) {\r\n el = td;\r\n }\r\n if (content !== '') {\r\n lastTd = td;\r\n }\r\n });\r\n if (el === undefined && returnLastIfNotFound) {\r\n el = lastTd;\r\n }\r\n return el;\r\n };\r\n SimplePicker.prototype.handleIconButtonClick = function (el) {\r\n var $ = this.$;\r\n var baseClass = 'simplepicker-icon-';\r\n var nextIcon = baseClass + 'next';\r\n var previousIcon = baseClass + 'previous';\r\n var calenderIcon = baseClass + 'calender';\r\n var timeIcon = baseClass + 'time';\r\n if (el.classList.contains(calenderIcon)) {\r\n var $timeIcon = $('.' + timeIcon);\r\n var $timeSection = $('.simplepicker-time-section');\r\n var $calenderSection = $('.simplepicker-calender-section');\r\n $calenderSection.style.display = 'block';\r\n $timeSection.style.display = 'none';\r\n $timeIcon.classList.remove('active');\r\n el.classList.add('active');\r\n this.toogleDisplayFade();\r\n return;\r\n }\r\n if (el.classList.contains(timeIcon)) {\r\n var $calenderIcon = $('.' + calenderIcon);\r\n var $calenderSection = $('.simplepicker-calender-section');\r\n var $timeSection = $('.simplepicker-time-section');\r\n $timeSection.style.display = 'block';\r\n $calenderSection.style.display = 'none';\r\n $calenderIcon.classList.remove('active');\r\n el.classList.add('active');\r\n this.toogleDisplayFade();\r\n return;\r\n }\r\n var selectedDate;\r\n var $active = $('.simplepicker-calender td.active');\r\n if ($active) {\r\n selectedDate = $active.innerHTML.trim();\r\n }\r\n if (el.classList.contains(nextIcon)) {\r\n this.render(dateUtil.scrapeNextMonth());\r\n }\r\n if (el.classList.contains(previousIcon)) {\r\n this.render(dateUtil.scrapePreviousMonth());\r\n }\r\n if (selectedDate) {\r\n var $dateTd = this.findElementWithDate(selectedDate, true);\r\n this.selectDateElement($dateTd);\r\n }\r\n };\r\n SimplePicker.prototype.initListeners = function () {\r\n var _a = this, $simplepicker = _a.$simplepicker, $timeInput = _a.$timeInput, $ok = _a.$ok, $cancel = _a.$cancel, $simplepickerWrapper = _a.$simplepickerWrapper;\r\n var _this = this;\r\n $simplepicker.addEventListener('click', function (e) {\r\n var target = e.target;\r\n var tagName = target.tagName.toLowerCase();\r\n e.stopPropagation();\r\n if (tagName === 'td') {\r\n _this.selectDateElement(target);\r\n return;\r\n }\r\n if (tagName === 'button' &&\r\n target.classList.contains('simplepicker-icon')) {\r\n _this.handleIconButtonClick(target);\r\n return;\r\n }\r\n });\r\n $timeInput.addEventListener('input', function (e) {\r\n if (e.target.value === '') {\r\n return;\r\n }\r\n var formattedTime = dateUtil.formatTimeFromInputElement(e.target.value);\r\n _this.$time.innerHTML = formattedTime;\r\n _this.updateSelectedDate();\r\n });\r\n $ok.addEventListener('click', function () {\r\n _this.close();\r\n _this.callEvent('submit', function (func) {\r\n func(_this.selectedDate, _this.readableDate);\r\n });\r\n });\r\n function close() {\r\n _this.close();\r\n _this.callEvent('close', function (f) { f(); });\r\n }\r\n ;\r\n $cancel.addEventListener('click', close);\r\n $simplepickerWrapper.addEventListener('click', close);\r\n };\r\n SimplePicker.prototype.callEvent = function (event, dispatcher) {\r\n var listeners = this._eventHandlers[event] || [];\r\n listeners.forEach(function (func) {\r\n dispatcher(func);\r\n });\r\n };\r\n SimplePicker.prototype.open = function () {\r\n this.$simplepickerWrapper.classList.add('active');\r\n };\r\n // can be called by user or by click the cancel btn.\r\n SimplePicker.prototype.close = function () {\r\n this.$simplepickerWrapper.classList.remove('active');\r\n };\r\n SimplePicker.prototype.on = function (event, handler) {\r\n var _a = this, _validOnListeners = _a._validOnListeners, _eventHandlers = _a._eventHandlers;\r\n if (!_validOnListeners.includes(event)) {\r\n throw new Error('Not a valid event!');\r\n }\r\n _eventHandlers[event] = _eventHandlers[event] || [];\r\n _eventHandlers[event].push(handler);\r\n };\r\n SimplePicker.prototype.toogleDisplayFade = function () {\r\n this.$time.classList.toggle('simplepicker-fade');\r\n this.$displayDateElements.forEach(function ($el) {\r\n $el.classList.toggle('simplepicker-fade');\r\n });\r\n };\r\n return SimplePicker;\r\n}());\r\nmodule.exports = SimplePicker;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nfunction repeat(str, times) {\r\n var repeated = '';\r\n for (var i = 1; i <= times; i++) {\r\n repeated += str;\r\n }\r\n return repeated;\r\n}\r\nexports.htmlTemplate = \"\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n \\n
12:00 PM
\\n \\n
\\n
\\n
\\n
\\n
\\n \\n
\\n \\n
\\n
\\n \\n \\n \\n \\n \\n \" + repeat('', 6) + \"\\n \\n
SunMonTueWedThuFriSat
\\n
\\n
\\n
\\n \\n
\\n
\\n
\\n \\n \\n
\\n
\\n
\\n\";\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/simplepicker.node.js b/dist/simplepicker.node.js index bcfe8e0..798afaf 100644 --- a/dist/simplepicker.node.js +++ b/dist/simplepicker.node.js @@ -1,2 +1,2 @@ -module.exports=function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s="TYVf")}({"0DyV":function(e,t,i){"use strict";function n(e,t){e=[].concat(e);for(var i=0;i=12;return r&&n>12&&(n-=12),r||0!==n||(n=12),t+=n<10?"0"+n:n,t+=":"+i[1]+" ",t+=r?"PM":"AM"}},TYVf:function(e,t,i){"use strict";var n=i("0DyV"),r=i("ht6X"),s=new Date,a=function(){function e(e,t){var i=void 0,n=t;if("string"==typeof e){var r=document.querySelector(e);if(null===r)throw new Error("Invalid selector passed to SimplePicker!");i=r}else e instanceof HTMLElement?i=e:"object"==typeof e&&(n=e);i||(i=document.querySelector("body")),n||(n={}),this.selectedDate=new Date,this.injectTemplate(i),this.init(i,n),this.initListeners(),this._eventHandlers={},this._validOnListeners=["submit","close"]}return e.prototype.initElMethod=function(e){this.$=function(t){return e.querySelector(t)},this.$$=function(t){return e.querySelectorAll(t)}},e.prototype.init=function(e,t){this.$simplepickerWrapper=e.querySelector(".simplepicker-wrapper"),this.initElMethod(this.$simplepickerWrapper);var i=this.$,r=this.$$;this.$simplepicker=i(".simpilepicker-date-picker"),this.$trs=r(".simplepicker-calender tbody tr"),this.$tds=r(".simplepicker-calender tbody td"),this.$headerMonthAndYear=i(".simplepicker-month-and-year"),this.$monthAndYear=i(".simplepicker-selected-date"),this.$date=i(".simplepicker-date"),this.$day=i(".simplepicker-day-header"),this.$time=i(".simplepicker-time"),this.$timeInput=i(".simplepicker-time-section input"),this.$timeSectionIcon=i(".simplepicker-icon-time"),this.$cancel=i(".simplepicker-cancel-btn"),this.$ok=i(".simplepicker-ok-btn"),this.$displayDateElements=[this.$day,this.$headerMonthAndYear,this.$date],this.$time.classList.add("simplepicker-fade"),this.render(n.scrapeMonth(s)),t=t||{},this.opts=t,this.reset(s),void 0!==t.zIndex&&(this.$simplepickerWrapper.style.zIndex=t.zIndex.toString()),t.disableTimeSection&&this.disableTimeSection(),t.compactMode&&this.compactMode()},e.prototype.reset=function(e){var t=e||new Date;this.render(n.scrapeMonth(t));var i=t.toTimeString().split(" ")[0].replace(/\:\d\d$/,"");this.$timeInput.value=i,this.$time.innerText=n.formatTimeFromInputElement(i);var r=t.getDate().toString(),s=this.findElementWithDate(r);s.classList.contains("active")||(this.selectDateElement(s),this.updateDateComponents(t))},e.prototype.compactMode=function(){this.$date.style.display="none"},e.prototype.disableTimeSection=function(){this.$timeSectionIcon.style.visibility="hidden"},e.prototype.enableTimeSection=function(){this.$timeSectionIcon.style.visibility="visible"},e.prototype.injectTemplate=function(e){var t=document.createElement("template");t.innerHTML=r.htmlTemplate,e.appendChild(t.content.cloneNode(!0))},e.prototype.clearRows=function(){this.$tds.forEach(function(e){e.innerHTML="",e.classList.remove("active")})},e.prototype.updateDateComponents=function(e){var t=n.days[e.getDay()],i=n.months[e.getMonth()]+" "+e.getFullYear();this.$headerMonthAndYear.innerHTML=i,this.$monthAndYear.innerHTML=i,this.$day.innerHTML=t,this.$date.innerHTML=n.getDisplayDate(e)},e.prototype.render=function(e){var t=this.$$,i=this.$trs,n=e.month,r=e.date;this.clearRows(),n.forEach(function(e,t){var n=i[t].children;e.forEach(function(e,t){var i=n[t];e?(i.removeAttribute("data-empty"),i.innerHTML=e):i.setAttribute("data-empty","")})});var s=t("table tbody tr:last-child td"),a=!0;s.forEach(function(e){void 0===e.dataset.empty&&(a=!1)});var o=s[0].parentElement;o.style.display=a&&o?"none":"table-row",this.updateDateComponents(r)},e.prototype.updateSelectedDate=function(e){var t,i=this.$monthAndYear,r=this.$time;this.$date;t=e?e.innerHTML.trim():this.$date.innerHTML.replace(/[a-z]+/,"");var s=i.innerHTML.split(" "),a=s[0],o=s[1],c=n.months.indexOf(a),l=r.innerHTML.split(":"),p=+l[0],d=l[1].split(" "),m=d[0],h=d[1];"AM"===h&&12==p&&(p=0),"PM"===h&&p<12&&(p+=12);var u=new Date(+o,+c,+t,+p,+m);this.selectedDate=u;var v=t+" ";v+=i.innerHTML.trim()+" ",v+=r.innerHTML.trim(),this.readableDate=v.replace(/^\d+/,u.getDate().toString())},e.prototype.selectDateElement=function(e){var t=this.$(".simplepicker-calender tbody .active");e.classList.add("active"),t&&t.classList.remove("active"),this.updateSelectedDate(e),this.updateDateComponents(this.selectedDate)},e.prototype.findElementWithDate=function(e,t){var i,n;return void 0===t&&(t=!1),this.$tds.forEach(function(t){var r=t.innerHTML.trim();r===e&&(i=t),""!==r&&(n=t)}),void 0===i&&t&&(i=n),i},e.prototype.handleIconButtonClick=function(e){var t,i=this.$;if(e.classList.contains("simplepicker-icon-calender")){var r=i(".simplepicker-icon-time"),s=i(".simplepicker-time-section");return(o=i(".simplepicker-calender-section")).style.display="block",s.style.display="none",r.classList.remove("active"),e.classList.add("active"),void this.toogleDisplayFade()}if(e.classList.contains("simplepicker-icon-time")){var a=i(".simplepicker-icon-calender"),o=i(".simplepicker-calender-section");return(s=i(".simplepicker-time-section")).style.display="block",o.style.display="none",a.classList.remove("active"),e.classList.add("active"),void this.toogleDisplayFade()}var c=i(".simplepicker-calender td.active");if(c&&(t=c.innerHTML.trim()),e.classList.contains("simplepicker-icon-next")&&this.render(n.scrapeNextMonth()),e.classList.contains("simplepicker-icon-previous")&&this.render(n.scrapePreviousMonth()),t){var l=this.findElementWithDate(t,!0);this.selectDateElement(l)}},e.prototype.initListeners=function(){var e=this,t=e.$simplepicker,i=e.$timeInput,r=e.$ok,s=e.$cancel,a=e.$simplepickerWrapper,o=this;function c(){o.close(),o.callEvent("close",function(e){e()})}t.addEventListener("click",function(e){var t=e.target,i=t.tagName.toLowerCase();e.stopPropagation(),"td"!==i?"button"===i&&t.classList.contains("simplepicker-icon")&&o.handleIconButtonClick(t):o.selectDateElement(t)}),i.addEventListener("input",function(e){if(""!==e.target.value){var t=n.formatTimeFromInputElement(e.target.value);o.$time.innerHTML=t,o.updateSelectedDate()}}),r.addEventListener("click",function(){o.close(),o.callEvent("submit",function(e){e(o.selectedDate,o.readableDate)})}),s.addEventListener("click",c),a.addEventListener("click",c)},e.prototype.callEvent=function(e,t){(this._eventHandlers[e]||[]).forEach(function(e){t(e)})},e.prototype.open=function(){this.$simplepickerWrapper.classList.add("active")},e.prototype.close=function(){this.$simplepickerWrapper.classList.remove("active")},e.prototype.on=function(e,t){var i=this._validOnListeners,n=this._eventHandlers;if(!i.includes(e))throw new Error("Not a valid event!");n[e]=n[e]||[],n[e].push(t)},e.prototype.toogleDisplayFade=function(){this.$time.classList.toggle("simplepicker-fade"),this.$displayDateElements.forEach(function(e){e.classList.toggle("simplepicker-fade")})},e}();e.exports=a},ht6X:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.htmlTemplate='\n
\n
\n
\n
\n
\n
\n
\n \n
12:00 PM
\n \n
\n
\n
\n
\n
\n \n
\n \n
\n
\n \n \n \n \n \n '+function(e,t){for(var i="",n=1;n<=t;n++)i+=e;return i}("",6)+'\n \n
SunMonTueWedThuFriSat
\n
\n
\n
\n \n
\n
\n
\n \n \n
\n
\n
\n'}}); +module.exports=function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s="TYVf")}({"0DyV":function(e,t,i){"use strict";function n(e,t){e=[].concat(e);for(var i=0;i=12;return r&&n>12&&(n-=12),r||0!==n||(n=12),t+=n<10?"0"+n:n,t+=":"+i[1]+" ",t+=r?"PM":"AM"}},TYVf:function(e,t,i){"use strict";var n=i("0DyV"),r=i("ht6X"),s=["submit","close"],a=new Date,o=function(){function e(e,t){this._validOnListeners=s;var i=void 0,n=t;if("string"==typeof e){var r=document.querySelector(e);if(null===r)throw new Error("Invalid selector passed to SimplePicker!");i=r}else e instanceof HTMLElement?i=e:"object"==typeof e&&(n=e);i||(i=document.querySelector("body")),n||(n={}),this.selectedDate=new Date,this.injectTemplate(i),this.init(i,n),this.initListeners(),this._eventHandlers={}}return e.prototype.initElMethod=function(e){this.$=function(t){return e.querySelector(t)},this.$$=function(t){return e.querySelectorAll(t)}},e.prototype.init=function(e,t){this.$simplepickerWrapper=e.querySelector(".simplepicker-wrapper"),this.initElMethod(this.$simplepickerWrapper);var i=this.$,r=this.$$;this.$simplepicker=i(".simpilepicker-date-picker"),this.$trs=r(".simplepicker-calender tbody tr"),this.$tds=r(".simplepicker-calender tbody td"),this.$headerMonthAndYear=i(".simplepicker-month-and-year"),this.$monthAndYear=i(".simplepicker-selected-date"),this.$date=i(".simplepicker-date"),this.$day=i(".simplepicker-day-header"),this.$time=i(".simplepicker-time"),this.$timeInput=i(".simplepicker-time-section input"),this.$timeSectionIcon=i(".simplepicker-icon-time"),this.$cancel=i(".simplepicker-cancel-btn"),this.$ok=i(".simplepicker-ok-btn"),this.$displayDateElements=[this.$day,this.$headerMonthAndYear,this.$date],this.$time.classList.add("simplepicker-fade"),this.render(n.scrapeMonth(a)),t=t||{},this.opts=t,this.reset(t.selectedDate||a),void 0!==t.zIndex&&(this.$simplepickerWrapper.style.zIndex=t.zIndex.toString()),t.disableTimeSection&&this.disableTimeSection(),t.compactMode&&this.compactMode()},e.prototype.reset=function(e){var t=e||new Date;this.render(n.scrapeMonth(t));var i=t.toTimeString().split(" ")[0].replace(/\:\d\d$/,"");this.$timeInput.value=i,this.$time.innerText=n.formatTimeFromInputElement(i);var r=t.getDate().toString(),s=this.findElementWithDate(r);s.classList.contains("active")||(this.selectDateElement(s),this.updateDateComponents(t))},e.prototype.compactMode=function(){this.$date.style.display="none"},e.prototype.disableTimeSection=function(){this.$timeSectionIcon.style.visibility="hidden"},e.prototype.enableTimeSection=function(){this.$timeSectionIcon.style.visibility="visible"},e.prototype.injectTemplate=function(e){var t=document.createElement("template");t.innerHTML=r.htmlTemplate,e.appendChild(t.content.cloneNode(!0))},e.prototype.clearRows=function(){this.$tds.forEach(function(e){e.innerHTML="",e.classList.remove("active")})},e.prototype.updateDateComponents=function(e){var t=n.days[e.getDay()],i=n.months[e.getMonth()]+" "+e.getFullYear();this.$headerMonthAndYear.innerHTML=i,this.$monthAndYear.innerHTML=i,this.$day.innerHTML=t,this.$date.innerHTML=n.getDisplayDate(e)},e.prototype.render=function(e){var t=this.$$,i=this.$trs,n=e.month,r=e.date;this.clearRows(),n.forEach(function(e,t){var n=i[t].children;e.forEach(function(e,t){var i=n[t];e?(i.removeAttribute("data-empty"),i.innerHTML=e):i.setAttribute("data-empty","")})});var s=t("table tbody tr:last-child td"),a=!0;s.forEach(function(e){void 0===e.dataset.empty&&(a=!1)});var o=s[0].parentElement;o.style.display=a&&o?"none":"table-row",this.updateDateComponents(r)},e.prototype.updateSelectedDate=function(e){var t,i=this.$monthAndYear,r=this.$time;this.$date;t=e?e.innerHTML.trim():this.$date.innerHTML.replace(/[a-z]+/,"");var s=i.innerHTML.split(" "),a=s[0],o=s[1],c=n.months.indexOf(a),l=r.innerHTML.split(":"),p=+l[0],d=l[1].split(" "),m=d[0],h=d[1];"AM"===h&&12==p&&(p=0),"PM"===h&&p<12&&(p+=12);var u=new Date(+o,+c,+t,+p,+m);this.selectedDate=u;var v=t+" ";v+=i.innerHTML.trim()+" ",v+=r.innerHTML.trim(),this.readableDate=v.replace(/^\d+/,u.getDate().toString())},e.prototype.selectDateElement=function(e){var t=this.$(".simplepicker-calender tbody .active");e.classList.add("active"),t&&t.classList.remove("active"),this.updateSelectedDate(e),this.updateDateComponents(this.selectedDate)},e.prototype.findElementWithDate=function(e,t){var i,n;return void 0===t&&(t=!1),this.$tds.forEach(function(t){var r=t.innerHTML.trim();r===e&&(i=t),""!==r&&(n=t)}),void 0===i&&t&&(i=n),i},e.prototype.handleIconButtonClick=function(e){var t,i=this.$;if(e.classList.contains("simplepicker-icon-calender")){var r=i(".simplepicker-icon-time"),s=i(".simplepicker-time-section");return(o=i(".simplepicker-calender-section")).style.display="block",s.style.display="none",r.classList.remove("active"),e.classList.add("active"),void this.toogleDisplayFade()}if(e.classList.contains("simplepicker-icon-time")){var a=i(".simplepicker-icon-calender"),o=i(".simplepicker-calender-section");return(s=i(".simplepicker-time-section")).style.display="block",o.style.display="none",a.classList.remove("active"),e.classList.add("active"),void this.toogleDisplayFade()}var c=i(".simplepicker-calender td.active");if(c&&(t=c.innerHTML.trim()),e.classList.contains("simplepicker-icon-next")&&this.render(n.scrapeNextMonth()),e.classList.contains("simplepicker-icon-previous")&&this.render(n.scrapePreviousMonth()),t){var l=this.findElementWithDate(t,!0);this.selectDateElement(l)}},e.prototype.initListeners=function(){var e=this,t=e.$simplepicker,i=e.$timeInput,r=e.$ok,s=e.$cancel,a=e.$simplepickerWrapper,o=this;function c(){o.close(),o.callEvent("close",function(e){e()})}t.addEventListener("click",function(e){var t=e.target,i=t.tagName.toLowerCase();e.stopPropagation(),"td"!==i?"button"===i&&t.classList.contains("simplepicker-icon")&&o.handleIconButtonClick(t):o.selectDateElement(t)}),i.addEventListener("input",function(e){if(""!==e.target.value){var t=n.formatTimeFromInputElement(e.target.value);o.$time.innerHTML=t,o.updateSelectedDate()}}),r.addEventListener("click",function(){o.close(),o.callEvent("submit",function(e){e(o.selectedDate,o.readableDate)})}),s.addEventListener("click",c),a.addEventListener("click",c)},e.prototype.callEvent=function(e,t){(this._eventHandlers[e]||[]).forEach(function(e){t(e)})},e.prototype.open=function(){this.$simplepickerWrapper.classList.add("active")},e.prototype.close=function(){this.$simplepickerWrapper.classList.remove("active")},e.prototype.on=function(e,t){var i=this._validOnListeners,n=this._eventHandlers;if(!i.includes(e))throw new Error("Not a valid event!");n[e]=n[e]||[],n[e].push(t)},e.prototype.toogleDisplayFade=function(){this.$time.classList.toggle("simplepicker-fade"),this.$displayDateElements.forEach(function(e){e.classList.toggle("simplepicker-fade")})},e}();e.exports=o},ht6X:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.htmlTemplate='\n
\n
\n
\n
\n
\n
\n
\n \n
12:00 PM
\n \n
\n
\n
\n
\n
\n \n
\n \n
\n
\n \n \n \n \n \n '+function(e,t){for(var i="",n=1;n<=t;n++)i+=e;return i}("",6)+'\n \n
SunMonTueWedThuFriSat
\n
\n
\n
\n \n
\n
\n
\n \n \n
\n
\n
\n'}}); //# sourceMappingURL=simplepicker.node.js.map \ No newline at end of file diff --git a/dist/simplepicker.node.js.map b/dist/simplepicker.node.js.map index c6df3bb..a214658 100644 --- a/dist/simplepicker.node.js.map +++ b/dist/simplepicker.node.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./lib/date-util.ts","webpack:///./lib/index.ts","webpack:///./lib/template.ts"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","fill","arr","upto","concat","undefined","scrapeMonth","date","originalDate","Date","getTime","year","getFullYear","month","getMonth","data","monthTracker","current","setDate","years","tracker","rowTracker","_date","getDate","day","getDay","lastRow","lastRowLength","length","filled","months","days","scrapePreviousMonth","Error","setMonth","scrapeNextMonth","dateEndings","st","nd","rd","getDisplayDate","indexOf","formatTimeFromInputElement","input","timeString","_a","split","hour","isPM","dateUtil","template_1","today","SimplePicker","arg1","arg2","el","opts","element","document","querySelector","HTMLElement","this","selectedDate","injectTemplate","init","initListeners","_eventHandlers","_validOnListeners","initElMethod","$","sel","$$","querySelectorAll","$simplepickerWrapper","$simplepicker","$trs","$tds","$headerMonthAndYear","$monthAndYear","$date","$day","$time","$timeInput","$timeSectionIcon","$cancel","$ok","$displayDateElements","classList","add","render","reset","zIndex","style","toString","disableTimeSection","compactMode","newDate","time","toTimeString","replace","innerText","dateString","$dateEl","findElementWithDate","contains","selectDateElement","updateDateComponents","display","visibility","enableTimeSection","$template","createElement","innerHTML","htmlTemplate","appendChild","content","cloneNode","clearRows","forEach","td","remove","monthAndYear","week","index","children","removeAttribute","setAttribute","$lastRowDates","lasRowIsEmpty","dataset","empty","$lastRow","parentElement","updateSelectedDate","trim","_b","monthName","timeComponents","hours","_c","minutes","meridium","readableDate","alreadyActive","returnLastIfNotFound","lastTd","handleIconButtonClick","baseClass","$timeIcon","$timeSection","$calenderSection","toogleDisplayFade","$calenderIcon","$active","$dateTd","_this","close","callEvent","f","addEventListener","e","target","tagName","toLowerCase","stopPropagation","formattedTime","func","event","dispatcher","open","on","handler","includes","push","toggle","$el","str","times","repeated","repeat"],"mappings":"2BACA,IAAAA,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,GAAA,CACAG,EAAAH,EACAI,GAAA,EACAH,QAAA,IAUA,OANAI,EAAAL,GAAAM,KAAAJ,E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I,GACA,IAAAxG,EAAAN,KAAAM,kBAAAD,EAAAL,KAAAK,eACA,IAAAC,EAAAyG,SAAAL,GACA,UAAAtI,MAAA,sBAEAiC,EAAAqG,GAAArG,EAAAqG,IAAA,GACArG,EAAAqG,GAAAM,KAAAF,IAEAvH,EAAAvD,UAAA0J,kBAAA,WACA1F,KAAAoB,MAAAM,UAAAuF,OAAA,qBACAjH,KAAAyB,qBAAAgC,QAAA,SAAAyD,GACAA,EAAAxF,UAAAuF,OAAA,wBAGA1H,EAxUA,GA0UApF,EAAAD,QAAAqF,qCC7UAzE,OAAAC,eAAAb,EAAA,cAA8CmB,OAAA,IAQ9CnB,EAAAkJ,aAAA,gzCAPA,SAAA+D,EAAAC,GAEA,IADA,IAAAC,EAAA,GACAjN,EAAA,EAAmBA,GAAAgN,EAAYhN,IAC/BiN,GAAAF,EAEA,OAAAE,EAEAC,CAAA","file":"simplepicker.node.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"TYVf\");\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n;\r\nexports.monthTracker = {\r\n years: {}\r\n};\r\nexports.months = [\r\n 'January',\r\n 'February',\r\n 'March',\r\n 'April',\r\n 'May',\r\n 'June',\r\n 'July',\r\n 'August',\r\n 'September',\r\n 'October',\r\n 'November',\r\n 'December'\r\n];\r\nexports.days = [\r\n 'Sunday',\r\n 'Monday',\r\n 'Tuesday',\r\n 'Wednesday',\r\n 'Thursday',\r\n 'Friday',\r\n 'Saturday'\r\n];\r\nfunction fill(arr, upto) {\r\n var temp = [];\r\n arr = temp.concat(arr);\r\n for (var i = 0; i < upto; i++) {\r\n arr[i] = undefined;\r\n }\r\n return arr;\r\n}\r\n// builds the calender for one month given a date\r\n// which is end, start or in middle of the month\r\nfunction scrapeMonth(date) {\r\n var originalDate = new Date(date.getTime());\r\n var year = date.getFullYear();\r\n var month = date.getMonth();\r\n var data = {\r\n date: originalDate,\r\n month: undefined\r\n };\r\n exports.monthTracker.current = new Date(date.getTime());\r\n exports.monthTracker.current.setDate(1);\r\n exports.monthTracker.years[year] = exports.monthTracker.years[year] || {};\r\n if (exports.monthTracker.years[year][month] !== undefined) {\r\n data.month = exports.monthTracker.years[year][month];\r\n return data;\r\n }\r\n date = new Date(date.getTime());\r\n date.setDate(1);\r\n exports.monthTracker.years[year][month] = [];\r\n var tracker = exports.monthTracker.years[year][month];\r\n var rowTracker = 0;\r\n while (date.getMonth() === month) {\r\n var _date = date.getDate();\r\n var day = date.getDay();\r\n if (_date === 1) {\r\n tracker[rowTracker] = fill([], day);\r\n }\r\n tracker[rowTracker] = tracker[rowTracker] || [];\r\n tracker[rowTracker][day] = _date;\r\n if (day === 6) {\r\n rowTracker++;\r\n }\r\n date.setDate(date.getDate() + 1);\r\n }\r\n var lastRow = 5;\r\n if (tracker[5] === undefined) {\r\n lastRow = 4;\r\n tracker[5] = fill([], 7);\r\n }\r\n var lastRowLength = tracker[lastRow].length;\r\n if (lastRowLength < 7) {\r\n var filled = tracker[lastRow].concat(fill([], 7 - lastRowLength));\r\n tracker[lastRow] = filled;\r\n }\r\n data.month = tracker;\r\n return data;\r\n}\r\nexports.scrapeMonth = scrapeMonth;\r\nfunction scrapePreviousMonth() {\r\n var date = exports.monthTracker.current;\r\n if (!date) {\r\n throw Error('scrapePrevoisMonth called without setting monthTracker.current!');\r\n }\r\n date.setMonth(date.getMonth() - 1);\r\n return scrapeMonth(date);\r\n}\r\nexports.scrapePreviousMonth = scrapePreviousMonth;\r\nfunction scrapeNextMonth() {\r\n var date = exports.monthTracker.current;\r\n if (!date) {\r\n throw Error('scrapePrevoisMonth called without setting monthTracker.current!');\r\n }\r\n date.setMonth(date.getMonth() + 1);\r\n return scrapeMonth(date);\r\n}\r\nexports.scrapeNextMonth = scrapeNextMonth;\r\nvar dateEndings = {\r\n st: [1, 21, 31],\r\n nd: [2, 22],\r\n rd: [3, 23]\r\n};\r\nfunction getDisplayDate(_date) {\r\n var date = _date.getDate();\r\n if (dateEndings.st.indexOf(date) !== -1) {\r\n return date + 'st';\r\n }\r\n if (dateEndings.nd.indexOf(date) !== -1) {\r\n return date + 'nd';\r\n }\r\n if (dateEndings.rd.indexOf(date) !== -1) {\r\n return date + 'rd';\r\n }\r\n return date + 'th';\r\n}\r\nexports.getDisplayDate = getDisplayDate;\r\nfunction formatTimeFromInputElement(input) {\r\n var timeString = '';\r\n var _a = input.split(':'), hour = _a[0], minute = _a[1];\r\n hour = +hour;\r\n var isPM = hour >= 12;\r\n if (isPM && hour > 12) {\r\n hour = hour - 12;\r\n }\r\n if (!isPM && hour === 0) {\r\n hour = 12;\r\n }\r\n timeString += hour < 10 ? '0' + hour : hour;\r\n timeString += ':' + minute + ' ';\r\n timeString += isPM ? 'PM' : 'AM';\r\n return timeString;\r\n}\r\nexports.formatTimeFromInputElement = formatTimeFromInputElement;\r\n","\"use strict\";\r\nvar dateUtil = require(\"./date-util\");\r\nvar template_1 = require(\"./template\");\r\nvar today = new Date();\r\nvar SimplePicker = /** @class */ (function () {\r\n function SimplePicker(arg1, arg2) {\r\n var el = undefined;\r\n var opts = arg2;\r\n if (typeof arg1 === 'string') {\r\n var element = document.querySelector(arg1);\r\n if (element !== null) {\r\n el = element;\r\n }\r\n else {\r\n throw new Error('Invalid selector passed to SimplePicker!');\r\n }\r\n }\r\n else if (arg1 instanceof HTMLElement) {\r\n el = arg1;\r\n }\r\n else if (typeof arg1 === 'object') {\r\n opts = arg1;\r\n }\r\n if (!el) {\r\n el = document.querySelector('body');\r\n }\r\n if (!opts) {\r\n opts = {};\r\n }\r\n this.selectedDate = new Date();\r\n this.injectTemplate(el);\r\n this.init(el, opts);\r\n this.initListeners();\r\n this._eventHandlers = {};\r\n this._validOnListeners = [\r\n 'submit',\r\n 'close',\r\n ];\r\n }\r\n // We use $, $$ as helper method to conviently select\r\n // element we need for simplepicker.\r\n // Also, Limit the query to the wrapper class to avoid\r\n // selecting elements on the other instance.\r\n SimplePicker.prototype.initElMethod = function (el) {\r\n this.$ = function (sel) { return el.querySelector(sel); };\r\n this.$$ = function (sel) { return el.querySelectorAll(sel); };\r\n };\r\n SimplePicker.prototype.init = function (el, opts) {\r\n this.$simplepickerWrapper = el.querySelector('.simplepicker-wrapper');\r\n this.initElMethod(this.$simplepickerWrapper);\r\n var _a = this, $ = _a.$, $$ = _a.$$;\r\n this.$simplepicker = $('.simpilepicker-date-picker');\r\n this.$trs = $$('.simplepicker-calender tbody tr');\r\n this.$tds = $$('.simplepicker-calender tbody td');\r\n this.$headerMonthAndYear = $('.simplepicker-month-and-year');\r\n this.$monthAndYear = $('.simplepicker-selected-date');\r\n this.$date = $('.simplepicker-date');\r\n this.$day = $('.simplepicker-day-header');\r\n this.$time = $('.simplepicker-time');\r\n this.$timeInput = $('.simplepicker-time-section input');\r\n this.$timeSectionIcon = $('.simplepicker-icon-time');\r\n this.$cancel = $('.simplepicker-cancel-btn');\r\n this.$ok = $('.simplepicker-ok-btn');\r\n this.$displayDateElements = [\r\n this.$day,\r\n this.$headerMonthAndYear,\r\n this.$date\r\n ];\r\n this.$time.classList.add('simplepicker-fade');\r\n this.render(dateUtil.scrapeMonth(today));\r\n opts = opts || {};\r\n this.opts = opts;\r\n this.reset(today);\r\n if (opts.zIndex !== undefined) {\r\n this.$simplepickerWrapper.style.zIndex = opts.zIndex.toString();\r\n }\r\n if (opts.disableTimeSection) {\r\n this.disableTimeSection();\r\n }\r\n if (opts.compactMode) {\r\n this.compactMode();\r\n }\r\n };\r\n // Reset by selecting current date.\r\n SimplePicker.prototype.reset = function (newDate) {\r\n var date = newDate || new Date();\r\n this.render(dateUtil.scrapeMonth(date));\r\n // The timeFull variable below will be formatted as HH:mm:ss.\r\n // Using regular experssion we remove the :ss parts.\r\n var timeFull = date.toTimeString().split(\" \")[0];\r\n var time = timeFull.replace(/\\:\\d\\d$/, \"\");\r\n this.$timeInput.value = time;\r\n this.$time.innerText = dateUtil.formatTimeFromInputElement(time);\r\n var dateString = date.getDate().toString();\r\n var $dateEl = this.findElementWithDate(dateString);\r\n if (!$dateEl.classList.contains('active')) {\r\n this.selectDateElement($dateEl);\r\n this.updateDateComponents(date);\r\n }\r\n };\r\n SimplePicker.prototype.compactMode = function () {\r\n var $date = this.$date;\r\n $date.style.display = 'none';\r\n };\r\n SimplePicker.prototype.disableTimeSection = function () {\r\n var $timeSectionIcon = this.$timeSectionIcon;\r\n $timeSectionIcon.style.visibility = 'hidden';\r\n };\r\n SimplePicker.prototype.enableTimeSection = function () {\r\n var $timeSectionIcon = this.$timeSectionIcon;\r\n $timeSectionIcon.style.visibility = 'visible';\r\n };\r\n SimplePicker.prototype.injectTemplate = function (el) {\r\n var $template = document.createElement('template');\r\n $template.innerHTML = template_1.htmlTemplate;\r\n el.appendChild($template.content.cloneNode(true));\r\n };\r\n SimplePicker.prototype.clearRows = function () {\r\n this.$tds.forEach(function (td) {\r\n td.innerHTML = '';\r\n td.classList.remove('active');\r\n });\r\n };\r\n SimplePicker.prototype.updateDateComponents = function (date) {\r\n var day = dateUtil.days[date.getDay()];\r\n var month = dateUtil.months[date.getMonth()];\r\n var year = date.getFullYear();\r\n var monthAndYear = month + ' ' + year;\r\n this.$headerMonthAndYear.innerHTML = monthAndYear;\r\n this.$monthAndYear.innerHTML = monthAndYear;\r\n this.$day.innerHTML = day;\r\n this.$date.innerHTML = dateUtil.getDisplayDate(date);\r\n };\r\n SimplePicker.prototype.render = function (data) {\r\n var _a = this, $$ = _a.$$, $trs = _a.$trs;\r\n var month = data.month, date = data.date;\r\n this.clearRows();\r\n month.forEach(function (week, index) {\r\n var $tds = $trs[index].children;\r\n week.forEach(function (day, index) {\r\n var td = $tds[index];\r\n if (!day) {\r\n td.setAttribute('data-empty', '');\r\n return;\r\n }\r\n td.removeAttribute('data-empty');\r\n td.innerHTML = day;\r\n });\r\n });\r\n var $lastRowDates = $$('table tbody tr:last-child td');\r\n var lasRowIsEmpty = true;\r\n $lastRowDates.forEach(function (date) {\r\n if (date.dataset.empty === undefined) {\r\n lasRowIsEmpty = false;\r\n }\r\n });\r\n // hide last row if it's empty to avoid\r\n // extra spacing due to last row\r\n var $lastRow = $lastRowDates[0].parentElement;\r\n if (lasRowIsEmpty && $lastRow) {\r\n $lastRow.style.display = 'none';\r\n }\r\n else {\r\n $lastRow.style.display = 'table-row';\r\n }\r\n this.updateDateComponents(date);\r\n };\r\n SimplePicker.prototype.updateSelectedDate = function (el) {\r\n var _a = this, $monthAndYear = _a.$monthAndYear, $time = _a.$time, $date = _a.$date;\r\n var day;\r\n if (el) {\r\n day = el.innerHTML.trim();\r\n }\r\n else {\r\n day = this.$date.innerHTML.replace(/[a-z]+/, '');\r\n }\r\n var _b = $monthAndYear.innerHTML.split(' '), monthName = _b[0], year = _b[1];\r\n var month = dateUtil.months.indexOf(monthName);\r\n var timeComponents = $time.innerHTML.split(':');\r\n var hours = +timeComponents[0];\r\n var _c = timeComponents[1].split(' '), minutes = _c[0], meridium = _c[1];\r\n if (meridium === 'AM' && hours == 12) {\r\n hours = 0;\r\n }\r\n if (meridium === 'PM' && hours < 12) {\r\n hours += 12;\r\n }\r\n var date = new Date(+year, +month, +day, +hours, +minutes);\r\n this.selectedDate = date;\r\n var _date = day + ' ';\r\n _date += $monthAndYear.innerHTML.trim() + ' ';\r\n _date += $time.innerHTML.trim();\r\n this.readableDate = _date.replace(/^\\d+/, date.getDate().toString());\r\n };\r\n SimplePicker.prototype.selectDateElement = function (el) {\r\n var alreadyActive = this.$('.simplepicker-calender tbody .active');\r\n el.classList.add('active');\r\n if (alreadyActive) {\r\n alreadyActive.classList.remove('active');\r\n }\r\n this.updateSelectedDate(el);\r\n this.updateDateComponents(this.selectedDate);\r\n };\r\n SimplePicker.prototype.findElementWithDate = function (date, returnLastIfNotFound) {\r\n if (returnLastIfNotFound === void 0) { returnLastIfNotFound = false; }\r\n var $tds = this.$tds;\r\n var el, lastTd;\r\n $tds.forEach(function (td) {\r\n var content = td.innerHTML.trim();\r\n if (content === date) {\r\n el = td;\r\n }\r\n if (content !== '') {\r\n lastTd = td;\r\n }\r\n });\r\n if (el === undefined && returnLastIfNotFound) {\r\n el = lastTd;\r\n }\r\n return el;\r\n };\r\n SimplePicker.prototype.handleIconButtonClick = function (el) {\r\n var $ = this.$;\r\n var baseClass = 'simplepicker-icon-';\r\n var nextIcon = baseClass + 'next';\r\n var previousIcon = baseClass + 'previous';\r\n var calenderIcon = baseClass + 'calender';\r\n var timeIcon = baseClass + 'time';\r\n if (el.classList.contains(calenderIcon)) {\r\n var $timeIcon = $('.' + timeIcon);\r\n var $timeSection = $('.simplepicker-time-section');\r\n var $calenderSection = $('.simplepicker-calender-section');\r\n $calenderSection.style.display = 'block';\r\n $timeSection.style.display = 'none';\r\n $timeIcon.classList.remove('active');\r\n el.classList.add('active');\r\n this.toogleDisplayFade();\r\n return;\r\n }\r\n if (el.classList.contains(timeIcon)) {\r\n var $calenderIcon = $('.' + calenderIcon);\r\n var $calenderSection = $('.simplepicker-calender-section');\r\n var $timeSection = $('.simplepicker-time-section');\r\n $timeSection.style.display = 'block';\r\n $calenderSection.style.display = 'none';\r\n $calenderIcon.classList.remove('active');\r\n el.classList.add('active');\r\n this.toogleDisplayFade();\r\n return;\r\n }\r\n var selectedDate;\r\n var $active = $('.simplepicker-calender td.active');\r\n if ($active) {\r\n selectedDate = $active.innerHTML.trim();\r\n }\r\n if (el.classList.contains(nextIcon)) {\r\n this.render(dateUtil.scrapeNextMonth());\r\n }\r\n if (el.classList.contains(previousIcon)) {\r\n this.render(dateUtil.scrapePreviousMonth());\r\n }\r\n if (selectedDate) {\r\n var $dateTd = this.findElementWithDate(selectedDate, true);\r\n this.selectDateElement($dateTd);\r\n }\r\n };\r\n SimplePicker.prototype.initListeners = function () {\r\n var _a = this, $simplepicker = _a.$simplepicker, $timeInput = _a.$timeInput, $ok = _a.$ok, $cancel = _a.$cancel, $simplepickerWrapper = _a.$simplepickerWrapper;\r\n var _this = this;\r\n $simplepicker.addEventListener('click', function (e) {\r\n var target = e.target;\r\n var tagName = target.tagName.toLowerCase();\r\n e.stopPropagation();\r\n if (tagName === 'td') {\r\n _this.selectDateElement(target);\r\n return;\r\n }\r\n if (tagName === 'button' &&\r\n target.classList.contains('simplepicker-icon')) {\r\n _this.handleIconButtonClick(target);\r\n return;\r\n }\r\n });\r\n $timeInput.addEventListener('input', function (e) {\r\n if (e.target.value === '') {\r\n return;\r\n }\r\n var formattedTime = dateUtil.formatTimeFromInputElement(e.target.value);\r\n _this.$time.innerHTML = formattedTime;\r\n _this.updateSelectedDate();\r\n });\r\n $ok.addEventListener('click', function () {\r\n _this.close();\r\n _this.callEvent('submit', function (func) {\r\n func(_this.selectedDate, _this.readableDate);\r\n });\r\n });\r\n function close() {\r\n _this.close();\r\n _this.callEvent('close', function (f) { f(); });\r\n }\r\n ;\r\n $cancel.addEventListener('click', close);\r\n $simplepickerWrapper.addEventListener('click', close);\r\n };\r\n SimplePicker.prototype.callEvent = function (event, dispatcher) {\r\n var listeners = this._eventHandlers[event] || [];\r\n listeners.forEach(function (func) {\r\n dispatcher(func);\r\n });\r\n };\r\n SimplePicker.prototype.open = function () {\r\n this.$simplepickerWrapper.classList.add('active');\r\n };\r\n // can be called by user or by click the cancel btn.\r\n SimplePicker.prototype.close = function () {\r\n this.$simplepickerWrapper.classList.remove('active');\r\n };\r\n SimplePicker.prototype.on = function (event, handler) {\r\n var _a = this, _validOnListeners = _a._validOnListeners, _eventHandlers = _a._eventHandlers;\r\n if (!_validOnListeners.includes(event)) {\r\n throw new Error('Not a valid event!');\r\n }\r\n _eventHandlers[event] = _eventHandlers[event] || [];\r\n _eventHandlers[event].push(handler);\r\n };\r\n SimplePicker.prototype.toogleDisplayFade = function () {\r\n this.$time.classList.toggle('simplepicker-fade');\r\n this.$displayDateElements.forEach(function ($el) {\r\n $el.classList.toggle('simplepicker-fade');\r\n });\r\n };\r\n return SimplePicker;\r\n}());\r\nmodule.exports = SimplePicker;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nfunction repeat(str, times) {\r\n var repeated = '';\r\n for (var i = 1; i <= times; i++) {\r\n repeated += str;\r\n }\r\n return repeated;\r\n}\r\nexports.htmlTemplate = \"\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n \\n
12:00 PM
\\n \\n
\\n
\\n
\\n
\\n
\\n \\n
\\n \\n
\\n
\\n \\n \\n \\n \\n \\n \" + repeat('', 6) + \"\\n \\n
SunMonTueWedThuFriSat
\\n
\\n
\\n
\\n \\n
\\n
\\n
\\n \\n \\n
\\n
\\n
\\n\";\r\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./lib/date-util.ts","webpack:///./lib/index.ts","webpack:///./lib/template.ts"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","fill","arr","upto","concat","undefined","scrapeMonth","date","originalDate","Date","getTime","year","getFullYear","month","getMonth","data","monthTracker","current","setDate","years","tracker","rowTracker","_date","getDate","day","getDay","lastRow","lastRowLength","length","filled","months","days","scrapePreviousMonth","Error","setMonth","scrapeNextMonth","dateEndings","st","nd","rd","getDisplayDate","indexOf","formatTimeFromInputElement","input","timeString","_a","split","hour","isPM","dateUtil","template_1","validListeners","today","SimplePicker","arg1","arg2","this","_validOnListeners","el","opts","element","document","querySelector","HTMLElement","selectedDate","injectTemplate","init","initListeners","_eventHandlers","initElMethod","$","sel","$$","querySelectorAll","$simplepickerWrapper","$simplepicker","$trs","$tds","$headerMonthAndYear","$monthAndYear","$date","$day","$time","$timeInput","$timeSectionIcon","$cancel","$ok","$displayDateElements","classList","add","render","reset","zIndex","style","toString","disableTimeSection","compactMode","newDate","time","toTimeString","replace","innerText","dateString","$dateEl","findElementWithDate","contains","selectDateElement","updateDateComponents","display","visibility","enableTimeSection","$template","createElement","innerHTML","htmlTemplate","appendChild","content","cloneNode","clearRows","forEach","td","remove","monthAndYear","week","index","children","removeAttribute","setAttribute","$lastRowDates","lasRowIsEmpty","dataset","empty","$lastRow","parentElement","updateSelectedDate","trim","_b","monthName","timeComponents","hours","_c","minutes","meridium","readableDate","alreadyActive","returnLastIfNotFound","lastTd","handleIconButtonClick","baseClass","$timeIcon","$timeSection","$calenderSection","toogleDisplayFade","$calenderIcon","$active","$dateTd","_this","close","callEvent","f","addEventListener","e","target","tagName","toLowerCase","stopPropagation","formattedTime","func","event","dispatcher","open","on","handler","includes","push","toggle","$el","str","times","repeated","repeat"],"mappings":"2BACA,IAAAA,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,GAAA,CACAG,EAAAH,EACAI,GAAA,EACAH,QAAA,IAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QA0DA,OArDAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,EAAA,CAA0CK,YAAA,EAAAC,IAAAL,KAK1CZ,EAAAkB,EAAA,SAAAhB,GACA,oBAAAiB,eAAAC,aACAN,OAAAC,eAAAb,EAAAiB,OAAAC,YAAA,CAAwDC,MAAA,WA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GA1H,EArUA,GAuUArF,EAAAD,QAAAsF,qCC9UA1E,OAAAC,eAAAb,EAAA,cAA8CmB,OAAA,IAQ9CnB,EAAAmJ,aAAA,gzCAPA,SAAA+D,EAAAC,GAEA,IADA,IAAAC,EAAA,GACAlN,EAAA,EAAmBA,GAAAiN,EAAYjN,IAC/BkN,GAAAF,EAEA,OAAAE,EAEAC,CAAA","file":"simplepicker.node.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"TYVf\");\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n;\r\nexports.monthTracker = {\r\n years: {}\r\n};\r\nexports.months = [\r\n 'January',\r\n 'February',\r\n 'March',\r\n 'April',\r\n 'May',\r\n 'June',\r\n 'July',\r\n 'August',\r\n 'September',\r\n 'October',\r\n 'November',\r\n 'December'\r\n];\r\nexports.days = [\r\n 'Sunday',\r\n 'Monday',\r\n 'Tuesday',\r\n 'Wednesday',\r\n 'Thursday',\r\n 'Friday',\r\n 'Saturday'\r\n];\r\nfunction fill(arr, upto) {\r\n var temp = [];\r\n arr = temp.concat(arr);\r\n for (var i = 0; i < upto; i++) {\r\n arr[i] = undefined;\r\n }\r\n return arr;\r\n}\r\n// builds the calender for one month given a date\r\n// which is end, start or in middle of the month\r\nfunction scrapeMonth(date) {\r\n var originalDate = new Date(date.getTime());\r\n var year = date.getFullYear();\r\n var month = date.getMonth();\r\n var data = {\r\n date: originalDate,\r\n month: undefined\r\n };\r\n exports.monthTracker.current = new Date(date.getTime());\r\n exports.monthTracker.current.setDate(1);\r\n exports.monthTracker.years[year] = exports.monthTracker.years[year] || {};\r\n if (exports.monthTracker.years[year][month] !== undefined) {\r\n data.month = exports.monthTracker.years[year][month];\r\n return data;\r\n }\r\n date = new Date(date.getTime());\r\n date.setDate(1);\r\n exports.monthTracker.years[year][month] = [];\r\n var tracker = exports.monthTracker.years[year][month];\r\n var rowTracker = 0;\r\n while (date.getMonth() === month) {\r\n var _date = date.getDate();\r\n var day = date.getDay();\r\n if (_date === 1) {\r\n tracker[rowTracker] = fill([], day);\r\n }\r\n tracker[rowTracker] = tracker[rowTracker] || [];\r\n tracker[rowTracker][day] = _date;\r\n if (day === 6) {\r\n rowTracker++;\r\n }\r\n date.setDate(date.getDate() + 1);\r\n }\r\n var lastRow = 5;\r\n if (tracker[5] === undefined) {\r\n lastRow = 4;\r\n tracker[5] = fill([], 7);\r\n }\r\n var lastRowLength = tracker[lastRow].length;\r\n if (lastRowLength < 7) {\r\n var filled = tracker[lastRow].concat(fill([], 7 - lastRowLength));\r\n tracker[lastRow] = filled;\r\n }\r\n data.month = tracker;\r\n return data;\r\n}\r\nexports.scrapeMonth = scrapeMonth;\r\nfunction scrapePreviousMonth() {\r\n var date = exports.monthTracker.current;\r\n if (!date) {\r\n throw Error('scrapePrevoisMonth called without setting monthTracker.current!');\r\n }\r\n date.setMonth(date.getMonth() - 1);\r\n return scrapeMonth(date);\r\n}\r\nexports.scrapePreviousMonth = scrapePreviousMonth;\r\nfunction scrapeNextMonth() {\r\n var date = exports.monthTracker.current;\r\n if (!date) {\r\n throw Error('scrapePrevoisMonth called without setting monthTracker.current!');\r\n }\r\n date.setMonth(date.getMonth() + 1);\r\n return scrapeMonth(date);\r\n}\r\nexports.scrapeNextMonth = scrapeNextMonth;\r\nvar dateEndings = {\r\n st: [1, 21, 31],\r\n nd: [2, 22],\r\n rd: [3, 23]\r\n};\r\nfunction getDisplayDate(_date) {\r\n var date = _date.getDate();\r\n if (dateEndings.st.indexOf(date) !== -1) {\r\n return date + 'st';\r\n }\r\n if (dateEndings.nd.indexOf(date) !== -1) {\r\n return date + 'nd';\r\n }\r\n if (dateEndings.rd.indexOf(date) !== -1) {\r\n return date + 'rd';\r\n }\r\n return date + 'th';\r\n}\r\nexports.getDisplayDate = getDisplayDate;\r\nfunction formatTimeFromInputElement(input) {\r\n var timeString = '';\r\n var _a = input.split(':'), hour = _a[0], minute = _a[1];\r\n hour = +hour;\r\n var isPM = hour >= 12;\r\n if (isPM && hour > 12) {\r\n hour = hour - 12;\r\n }\r\n if (!isPM && hour === 0) {\r\n hour = 12;\r\n }\r\n timeString += hour < 10 ? '0' + hour : hour;\r\n timeString += ':' + minute + ' ';\r\n timeString += isPM ? 'PM' : 'AM';\r\n return timeString;\r\n}\r\nexports.formatTimeFromInputElement = formatTimeFromInputElement;\r\n","\"use strict\";\r\nvar dateUtil = require(\"./date-util\");\r\nvar template_1 = require(\"./template\");\r\nvar validListeners = [\r\n 'submit',\r\n 'close',\r\n];\r\nvar today = new Date();\r\nvar SimplePicker = /** @class */ (function () {\r\n function SimplePicker(arg1, arg2) {\r\n this._validOnListeners = validListeners;\r\n var el = undefined;\r\n var opts = arg2;\r\n if (typeof arg1 === 'string') {\r\n var element = document.querySelector(arg1);\r\n if (element !== null) {\r\n el = element;\r\n }\r\n else {\r\n throw new Error('Invalid selector passed to SimplePicker!');\r\n }\r\n }\r\n else if (arg1 instanceof HTMLElement) {\r\n el = arg1;\r\n }\r\n else if (typeof arg1 === 'object') {\r\n opts = arg1;\r\n }\r\n if (!el) {\r\n el = document.querySelector('body');\r\n }\r\n if (!opts) {\r\n opts = {};\r\n }\r\n this.selectedDate = new Date();\r\n this.injectTemplate(el);\r\n this.init(el, opts);\r\n this.initListeners();\r\n this._eventHandlers = {};\r\n }\r\n // We use $, $$ as helper method to conviently select\r\n // element we need for simplepicker.\r\n // Also, Limit the query to the wrapper class to avoid\r\n // selecting elements on the other instance.\r\n SimplePicker.prototype.initElMethod = function (el) {\r\n this.$ = function (sel) { return el.querySelector(sel); };\r\n this.$$ = function (sel) { return el.querySelectorAll(sel); };\r\n };\r\n SimplePicker.prototype.init = function (el, opts) {\r\n this.$simplepickerWrapper = el.querySelector('.simplepicker-wrapper');\r\n this.initElMethod(this.$simplepickerWrapper);\r\n var _a = this, $ = _a.$, $$ = _a.$$;\r\n this.$simplepicker = $('.simpilepicker-date-picker');\r\n this.$trs = $$('.simplepicker-calender tbody tr');\r\n this.$tds = $$('.simplepicker-calender tbody td');\r\n this.$headerMonthAndYear = $('.simplepicker-month-and-year');\r\n this.$monthAndYear = $('.simplepicker-selected-date');\r\n this.$date = $('.simplepicker-date');\r\n this.$day = $('.simplepicker-day-header');\r\n this.$time = $('.simplepicker-time');\r\n this.$timeInput = $('.simplepicker-time-section input');\r\n this.$timeSectionIcon = $('.simplepicker-icon-time');\r\n this.$cancel = $('.simplepicker-cancel-btn');\r\n this.$ok = $('.simplepicker-ok-btn');\r\n this.$displayDateElements = [\r\n this.$day,\r\n this.$headerMonthAndYear,\r\n this.$date\r\n ];\r\n this.$time.classList.add('simplepicker-fade');\r\n this.render(dateUtil.scrapeMonth(today));\r\n opts = opts || {};\r\n this.opts = opts;\r\n this.reset(opts.selectedDate || today);\r\n if (opts.zIndex !== undefined) {\r\n this.$simplepickerWrapper.style.zIndex = opts.zIndex.toString();\r\n }\r\n if (opts.disableTimeSection) {\r\n this.disableTimeSection();\r\n }\r\n if (opts.compactMode) {\r\n this.compactMode();\r\n }\r\n };\r\n // Reset by selecting current date.\r\n SimplePicker.prototype.reset = function (newDate) {\r\n var date = newDate || new Date();\r\n this.render(dateUtil.scrapeMonth(date));\r\n // The timeFull variable below will be formatted as HH:mm:ss.\r\n // Using regular experssion we remove the :ss parts.\r\n var timeFull = date.toTimeString().split(\" \")[0];\r\n var time = timeFull.replace(/\\:\\d\\d$/, \"\");\r\n this.$timeInput.value = time;\r\n this.$time.innerText = dateUtil.formatTimeFromInputElement(time);\r\n var dateString = date.getDate().toString();\r\n var $dateEl = this.findElementWithDate(dateString);\r\n if (!$dateEl.classList.contains('active')) {\r\n this.selectDateElement($dateEl);\r\n this.updateDateComponents(date);\r\n }\r\n };\r\n SimplePicker.prototype.compactMode = function () {\r\n var $date = this.$date;\r\n $date.style.display = 'none';\r\n };\r\n SimplePicker.prototype.disableTimeSection = function () {\r\n var $timeSectionIcon = this.$timeSectionIcon;\r\n $timeSectionIcon.style.visibility = 'hidden';\r\n };\r\n SimplePicker.prototype.enableTimeSection = function () {\r\n var $timeSectionIcon = this.$timeSectionIcon;\r\n $timeSectionIcon.style.visibility = 'visible';\r\n };\r\n SimplePicker.prototype.injectTemplate = function (el) {\r\n var $template = document.createElement('template');\r\n $template.innerHTML = template_1.htmlTemplate;\r\n el.appendChild($template.content.cloneNode(true));\r\n };\r\n SimplePicker.prototype.clearRows = function () {\r\n this.$tds.forEach(function (td) {\r\n td.innerHTML = '';\r\n td.classList.remove('active');\r\n });\r\n };\r\n SimplePicker.prototype.updateDateComponents = function (date) {\r\n var day = dateUtil.days[date.getDay()];\r\n var month = dateUtil.months[date.getMonth()];\r\n var year = date.getFullYear();\r\n var monthAndYear = month + ' ' + year;\r\n this.$headerMonthAndYear.innerHTML = monthAndYear;\r\n this.$monthAndYear.innerHTML = monthAndYear;\r\n this.$day.innerHTML = day;\r\n this.$date.innerHTML = dateUtil.getDisplayDate(date);\r\n };\r\n SimplePicker.prototype.render = function (data) {\r\n var _a = this, $$ = _a.$$, $trs = _a.$trs;\r\n var month = data.month, date = data.date;\r\n this.clearRows();\r\n month.forEach(function (week, index) {\r\n var $tds = $trs[index].children;\r\n week.forEach(function (day, index) {\r\n var td = $tds[index];\r\n if (!day) {\r\n td.setAttribute('data-empty', '');\r\n return;\r\n }\r\n td.removeAttribute('data-empty');\r\n td.innerHTML = day;\r\n });\r\n });\r\n var $lastRowDates = $$('table tbody tr:last-child td');\r\n var lasRowIsEmpty = true;\r\n $lastRowDates.forEach(function (date) {\r\n if (date.dataset.empty === undefined) {\r\n lasRowIsEmpty = false;\r\n }\r\n });\r\n // hide last row if it's empty to avoid\r\n // extra spacing due to last row\r\n var $lastRow = $lastRowDates[0].parentElement;\r\n if (lasRowIsEmpty && $lastRow) {\r\n $lastRow.style.display = 'none';\r\n }\r\n else {\r\n $lastRow.style.display = 'table-row';\r\n }\r\n this.updateDateComponents(date);\r\n };\r\n SimplePicker.prototype.updateSelectedDate = function (el) {\r\n var _a = this, $monthAndYear = _a.$monthAndYear, $time = _a.$time, $date = _a.$date;\r\n var day;\r\n if (el) {\r\n day = el.innerHTML.trim();\r\n }\r\n else {\r\n day = this.$date.innerHTML.replace(/[a-z]+/, '');\r\n }\r\n var _b = $monthAndYear.innerHTML.split(' '), monthName = _b[0], year = _b[1];\r\n var month = dateUtil.months.indexOf(monthName);\r\n var timeComponents = $time.innerHTML.split(':');\r\n var hours = +timeComponents[0];\r\n var _c = timeComponents[1].split(' '), minutes = _c[0], meridium = _c[1];\r\n if (meridium === 'AM' && hours == 12) {\r\n hours = 0;\r\n }\r\n if (meridium === 'PM' && hours < 12) {\r\n hours += 12;\r\n }\r\n var date = new Date(+year, +month, +day, +hours, +minutes);\r\n this.selectedDate = date;\r\n var _date = day + ' ';\r\n _date += $monthAndYear.innerHTML.trim() + ' ';\r\n _date += $time.innerHTML.trim();\r\n this.readableDate = _date.replace(/^\\d+/, date.getDate().toString());\r\n };\r\n SimplePicker.prototype.selectDateElement = function (el) {\r\n var alreadyActive = this.$('.simplepicker-calender tbody .active');\r\n el.classList.add('active');\r\n if (alreadyActive) {\r\n alreadyActive.classList.remove('active');\r\n }\r\n this.updateSelectedDate(el);\r\n this.updateDateComponents(this.selectedDate);\r\n };\r\n SimplePicker.prototype.findElementWithDate = function (date, returnLastIfNotFound) {\r\n if (returnLastIfNotFound === void 0) { returnLastIfNotFound = false; }\r\n var $tds = this.$tds;\r\n var el, lastTd;\r\n $tds.forEach(function (td) {\r\n var content = td.innerHTML.trim();\r\n if (content === date) {\r\n el = td;\r\n }\r\n if (content !== '') {\r\n lastTd = td;\r\n }\r\n });\r\n if (el === undefined && returnLastIfNotFound) {\r\n el = lastTd;\r\n }\r\n return el;\r\n };\r\n SimplePicker.prototype.handleIconButtonClick = function (el) {\r\n var $ = this.$;\r\n var baseClass = 'simplepicker-icon-';\r\n var nextIcon = baseClass + 'next';\r\n var previousIcon = baseClass + 'previous';\r\n var calenderIcon = baseClass + 'calender';\r\n var timeIcon = baseClass + 'time';\r\n if (el.classList.contains(calenderIcon)) {\r\n var $timeIcon = $('.' + timeIcon);\r\n var $timeSection = $('.simplepicker-time-section');\r\n var $calenderSection = $('.simplepicker-calender-section');\r\n $calenderSection.style.display = 'block';\r\n $timeSection.style.display = 'none';\r\n $timeIcon.classList.remove('active');\r\n el.classList.add('active');\r\n this.toogleDisplayFade();\r\n return;\r\n }\r\n if (el.classList.contains(timeIcon)) {\r\n var $calenderIcon = $('.' + calenderIcon);\r\n var $calenderSection = $('.simplepicker-calender-section');\r\n var $timeSection = $('.simplepicker-time-section');\r\n $timeSection.style.display = 'block';\r\n $calenderSection.style.display = 'none';\r\n $calenderIcon.classList.remove('active');\r\n el.classList.add('active');\r\n this.toogleDisplayFade();\r\n return;\r\n }\r\n var selectedDate;\r\n var $active = $('.simplepicker-calender td.active');\r\n if ($active) {\r\n selectedDate = $active.innerHTML.trim();\r\n }\r\n if (el.classList.contains(nextIcon)) {\r\n this.render(dateUtil.scrapeNextMonth());\r\n }\r\n if (el.classList.contains(previousIcon)) {\r\n this.render(dateUtil.scrapePreviousMonth());\r\n }\r\n if (selectedDate) {\r\n var $dateTd = this.findElementWithDate(selectedDate, true);\r\n this.selectDateElement($dateTd);\r\n }\r\n };\r\n SimplePicker.prototype.initListeners = function () {\r\n var _a = this, $simplepicker = _a.$simplepicker, $timeInput = _a.$timeInput, $ok = _a.$ok, $cancel = _a.$cancel, $simplepickerWrapper = _a.$simplepickerWrapper;\r\n var _this = this;\r\n $simplepicker.addEventListener('click', function (e) {\r\n var target = e.target;\r\n var tagName = target.tagName.toLowerCase();\r\n e.stopPropagation();\r\n if (tagName === 'td') {\r\n _this.selectDateElement(target);\r\n return;\r\n }\r\n if (tagName === 'button' &&\r\n target.classList.contains('simplepicker-icon')) {\r\n _this.handleIconButtonClick(target);\r\n return;\r\n }\r\n });\r\n $timeInput.addEventListener('input', function (e) {\r\n if (e.target.value === '') {\r\n return;\r\n }\r\n var formattedTime = dateUtil.formatTimeFromInputElement(e.target.value);\r\n _this.$time.innerHTML = formattedTime;\r\n _this.updateSelectedDate();\r\n });\r\n $ok.addEventListener('click', function () {\r\n _this.close();\r\n _this.callEvent('submit', function (func) {\r\n func(_this.selectedDate, _this.readableDate);\r\n });\r\n });\r\n function close() {\r\n _this.close();\r\n _this.callEvent('close', function (f) { f(); });\r\n }\r\n ;\r\n $cancel.addEventListener('click', close);\r\n $simplepickerWrapper.addEventListener('click', close);\r\n };\r\n SimplePicker.prototype.callEvent = function (event, dispatcher) {\r\n var listeners = this._eventHandlers[event] || [];\r\n listeners.forEach(function (func) {\r\n dispatcher(func);\r\n });\r\n };\r\n SimplePicker.prototype.open = function () {\r\n this.$simplepickerWrapper.classList.add('active');\r\n };\r\n // can be called by user or by click the cancel btn.\r\n SimplePicker.prototype.close = function () {\r\n this.$simplepickerWrapper.classList.remove('active');\r\n };\r\n SimplePicker.prototype.on = function (event, handler) {\r\n var _a = this, _validOnListeners = _a._validOnListeners, _eventHandlers = _a._eventHandlers;\r\n if (!_validOnListeners.includes(event)) {\r\n throw new Error('Not a valid event!');\r\n }\r\n _eventHandlers[event] = _eventHandlers[event] || [];\r\n _eventHandlers[event].push(handler);\r\n };\r\n SimplePicker.prototype.toogleDisplayFade = function () {\r\n this.$time.classList.toggle('simplepicker-fade');\r\n this.$displayDateElements.forEach(function ($el) {\r\n $el.classList.toggle('simplepicker-fade');\r\n });\r\n };\r\n return SimplePicker;\r\n}());\r\nmodule.exports = SimplePicker;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nfunction repeat(str, times) {\r\n var repeated = '';\r\n for (var i = 1; i <= times; i++) {\r\n repeated += str;\r\n }\r\n return repeated;\r\n}\r\nexports.htmlTemplate = \"\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n \\n
12:00 PM
\\n \\n
\\n
\\n
\\n
\\n
\\n \\n
\\n \\n
\\n
\\n \\n \\n \\n \\n \\n \" + repeat('', 6) + \"\\n \\n
SunMonTueWedThuFriSat
\\n
\\n
\\n
\\n \\n
\\n
\\n
\\n \\n \\n
\\n
\\n
\\n\";\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/template.d.ts b/dist/template.d.ts new file mode 100644 index 0000000..e9d692d --- /dev/null +++ b/dist/template.d.ts @@ -0,0 +1 @@ +export declare const htmlTemplate: string; diff --git a/package.json b/package.json index a4d54ae..e768680 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simplepicker", - "version": "2.0.3", + "version": "2.0.4", "description": "Simple date picker written in vanilla js.", "main": "./dist/simplepicker.node.js", "types": "./dist/index.d.ts",