From e5ec26d2e98c27dbefa45a35bed5c35683f9b22c Mon Sep 17 00:00:00 2001 From: Sujith Sreedhar Date: Thu, 4 May 2017 18:17:28 +0530 Subject: [PATCH] require wrapped --- dist/daterangepicker.js | 24 ++++++++++++++++++++++++ dist/daterangepicker.min.js | 24 +++++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/dist/daterangepicker.js b/dist/daterangepicker.js index 721791f..d12f9da 100644 --- a/dist/daterangepicker.js +++ b/dist/daterangepicker.js @@ -5,6 +5,28 @@ * license: MIT * https://sensortower.github.io/daterangepicker */ + +(function(factory) { + var jQuery, ko, moment; + if (typeof define === 'function' && define.amd) { + define(['jquery', 'moment', 'knockout'], factory); + } else if (typeof exports !== 'undefined') { + try { + jQuery = require('jquery'); + } catch (_error) {} + try { + moment = require('moment'); + } catch (_error) {} + try { + ko = require('knockout'); + } catch (_error) {} + factory(jQuery, moment, ko); + } else { + factory(jQuery, moment, ko); + } +})(function($, moment, ko) { + + (function() { var AllTimeDateRange, ArrayUtils, CalendarHeaderView, CalendarView, Config, CustomDateRange, DateRange, DateRangePickerView, MomentIterator, MomentUtil, Period, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, @@ -1205,3 +1227,5 @@ }); }).call(this); + +}); \ No newline at end of file diff --git a/dist/daterangepicker.min.js b/dist/daterangepicker.min.js index e97c228..45b738e 100644 --- a/dist/daterangepicker.min.js +++ b/dist/daterangepicker.min.js @@ -5,4 +5,26 @@ * license: MIT * https://sensortower.github.io/daterangepicker */ -(function(){var t,e,n,a,r,i,o,s,c,u,d,l=function(t,e){function n(){this.constructor=t}for(var a in e)h.call(e,a)&&(t[a]=e[a]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty,p=function(t,e){return function(){return t.apply(e,arguments)}};u=function(){function t(){}return t.patchCurrentLocale=function(t){return moment.locale(moment.locale(),t)},t.setFirstDayOfTheWeek=function(t){var e;if(t=(t%7+7)%7,moment.localeData().firstDayOfWeek()!==t)return e=t-moment.localeData().firstDayOfWeek(),this.patchCurrentLocale({week:{dow:t,doy:moment.localeData().firstDayOfYear()}})},t.tz=function(t){var e,n;return e=Array.prototype.slice.call(arguments,0,-1),n=arguments[arguments.length-1],moment.tz?moment.tz.apply(null,e.concat([n])):n&&"utc"===n.toLowerCase()?moment.utc.apply(null,e):moment.apply(null,e)},t}(),c=function(){function t(t,e){this.date=t.clone(),this.period=e}return t.array=function(t,e,n){var a,r,i,o,s;for(r=new this(t,n),s=[],a=i=0,o=e-1;0<=o?i<=o:i>=o;a=0<=o?++i:--i)s.push(r.next());return s},t.prototype.next=function(){var t;return t=this.date,this.date=t.clone().add(1,this.period),t.clone()},t}(),e=function(){function t(){}return t.rotateArray=function(t,e){return e%=t.length,t.slice(e).concat(t.slice(0,e))},t.uniqArray=function(t){var e,n,a,r;for(r=[],n=0,a=t.length;n=t;e<=t?a++:a--)n.push(a);return n}.apply(this)},t.prototype.yearOptions=function(){var t,e;return function(){e=[];for(var n=t=this.currentDate.minBoundary().year(),a=this.currentDate.maxBoundary().year();t<=a?n<=a:n>=a;t<=a?n++:n--)e.push(n);return e}.apply(this)},t.prototype.decadeOptions=function(){return e.uniqArray(this.yearOptions().map(function(t){return function(e){var n;return n=u.tz([e],t.timeZone()),t.firstYearOfDecade(n).year()}}(this)))},t.prototype.monthSelectorAvailable=function(){var t;return"day"===(t=this.period())||"week"===t},t.prototype.yearSelectorAvailable=function(){return"year"!==this.period()},t.prototype.decadeSelectorAvailable=function(){return"year"===this.period()},t.prototype.monthFormatter=function(t){return moment.utc([2015,t]).format("MMM")},t.prototype.yearFormatter=function(t){return moment.utc([t]).format("YYYY")},t.prototype.decadeFormatter=function(t){var e,n,a,r;return n=d.dimentions("year"),e=n[0],a=n[1],r=t+e*a-1,t+" – "+r},t}(),a=function(){function t(t,e,a){this.cssForDate=p(this.cssForDate,this),this.eventsForDate=p(this.eventsForDate,this),this.formatDateTemplate=p(this.formatDateTemplate,this),this.tableValues=p(this.tableValues,this),this.inRange=p(this.inRange,this),this.period=t.period,this.single=t.single,this.timeZone=t.timeZone,this.locale=t.locale,this.startDate=t.startDate,this.endDate=t.endDate,this.isCustomPeriodRangeActive=t.isCustomPeriodRangeActive,this.type=a,this.label=t.locale[a+"Label"]||"",this.hoverDate=ko.observable(null),this.activeDate=e,this.currentDate=e.clone(),this.inputDate=ko.computed({read:function(t){return function(){return(t.hoverDate()||t.activeDate()).format(t.locale.inputFormat)}}(this),write:function(t){return function(e){var n;if(n=u.tz(e,t.locale.inputFormat,t.timeZone()),n.isValid())return t.activeDate(n)}}(this),pure:!0}),this.firstDate=ko.pureComputed(function(t){return function(){var e,n;switch(e=t.currentDate().clone().startOf(t.period.scale()),t.period()){case"day":case"week":n=e.clone(),e.weekday(0),(e.isAfter(n)||e.isSame(n,"day"))&&e.subtract(1,"week");break;case"year":e=t.firstYearOfDecade(e)}return e}}(this)),this.activeDate.subscribe(function(t){return function(e){return t.currentDate(e)}}(this)),this.headerView=new n(this)}return t.prototype.calendar=function(){var t,e,n,a,r,i,o,s,u,d;for(i=this.period.dimentions(),e=i[0],d=i[1],a=new c(this.firstDate(),this.period()),s=[],u=r=1,o=d;1<=o?r<=o:r>=o;u=1<=o?++r:--r)s.push(function(){var r,i,o;for(o=[],t=r=1,i=e;1<=i?r<=i:r>=i;t=1<=i?++r:--r)n=a.next(),"end"===this.type?o.push(n.endOf(this.period())):o.push(n.startOf(this.period()));return o}.call(this));return s},t.prototype.weekDayNames=function(){return e.rotateArray(moment.weekdaysMin(),moment.localeData().firstDayOfWeek())},t.prototype.inRange=function(t){return t.isAfter(this.startDate(),this.period())&&t.isBefore(this.endDate(),this.period())||t.isSame(this.startDate(),this.period())||t.isSame(this.endDate(),this.period())},t.prototype.tableValues=function(t){var e,n,a;switch(e=this.period.format(),this.period()){case"day":case"month":case"year":return[{html:t.format(e)}];case"week":return t=t.clone().startOf(this.period()),c.array(t,7,"day").map(function(t){return function(n){return{html:n.format(e),css:{"week-day":!0,unavailable:t.cssForDate(n,!0).unavailable}}}}(this));case"quarter":return a=t.format(e),t=t.clone().startOf("quarter"),n=c.array(t,3,"month").map(function(t){return t.format("MMM")}),[{html:a+"
"+n.join(", ")+""}]}},t.prototype.formatDateTemplate=function(t){return{nodes:$("
"+this.formatDate(t)+"
").children()}},t.prototype.eventsForDate=function(t){return{click:function(e){return function(){if(e.activeDate.isWithinBoundaries(t))return e.activeDate(t)}}(this),mouseenter:function(e){return function(){if(e.activeDate.isWithinBoundaries(t))return e.hoverDate(e.activeDate.fit(t))}}(this),mouseleave:function(t){return function(){return t.hoverDate(null)}}(this)}},t.prototype.cssForDate=function(t,e){var n,a,r,i,o;return i=t.isSame(this.activeDate(),this.period()),o=this.activeDate.isWithinBoundaries(t),e||(e="day"===this.period()),n=!t.isSame(this.currentDate(),"month"),a=this.inRange(t),r={"in-range":!this.single()&&(a||i)},r[this.type+"-date"]=i,r.clickable=o&&!this.isCustomPeriodRangeActive(),r["out-of-boundaries"]=!o||this.isCustomPeriodRangeActive(),r.unavailable=e&&n,r},t.prototype.firstYearOfDecade=function(t){var e,n,a,r;return e=u.tz(moment(),this.timeZone()).year(),n=e-4,a=Math.floor((t.year()-n)/9),r=n+9*a,u.tz([r],this.timeZone())},t}(),s=function(){function t(t){var e,n,i,o;null==t&&(t={}),this.outsideClick=p(this.outsideClick,this),this.setCustomPeriodRange=p(this.setCustomPeriodRange,this),this.setDateRange=p(this.setDateRange,this),new r(t).extend(this),this.startCalendar=new a(this,this.startDate,"start"),this.endCalendar=new a(this,this.endDate,"end"),this.startDateInput=this.startCalendar.inputDate,this.endDateInput=this.endCalendar.inputDate,this.dateRange=ko.observable([this.startDate(),this.endDate()]),this.startDate.subscribe(function(t){return function(e){return t.single()?(t.endDate(e.clone().endOf(t.period())),t.updateDateRange(),t.close()):(t.endDate().isSame(e)&&t.endDate(t.endDate().clone().endOf(t.period())),t.standalone()?t.updateDateRange():void 0)}}(this)),this.style=ko.observable({}),this.callback&&(this.dateRange.subscribe(function(t){return function(e){var n,a;return a=e[0],n=e[1],t.callback(a.clone(),n.clone(),t.period())}}(this)),this.forceUpdate&&(n=this.dateRange(),i=n[0],e=n[1],this.callback(i.clone(),e.clone(),this.period()))),this.anchorElement&&(o=$('
').appendTo(this.parentElement),this.containerElement=$(this.constructor.template).appendTo(o),ko.applyBindings(this,this.containerElement.get(0)),this.anchorElement.click(function(t){return function(){return t.updatePosition(),t.toggle()}}(this)),this.standalone()||$(document).on("mousedown.daterangepicker",this.outsideClick).on("touchend.daterangepicker",this.outsideClick).on("click.daterangepicker","[data-toggle=dropdown]",this.outsideClick).on("focusin.daterangepicker",this.outsideClick)),this.opened()&&this.updatePosition()}return t.prototype.periodProxy=d,t.prototype.calendars=function(){return this.single()?[this.startCalendar]:[this.startCalendar,this.endCalendar]},t.prototype.updateDateRange=function(){return this.dateRange([this.startDate(),this.endDate()])},t.prototype.cssClasses=function(){var t,e,n,a,r;for(n={single:this.single(),opened:this.standalone()||this.opened(),expanded:this.standalone()||this.single()||this.expanded(),standalone:this.standalone(),"hide-weekdays":this.hideWeekdays(),"hide-periods":this.periods().length+this.customPeriodRanges.length===1,"orientation-left":"left"===this.orientation(),"orientation-right":"right"===this.orientation()},r=d.allPeriods,t=0,e=r.length;t$(window).width()?n.right="0":n.left=this.anchorElement.offset().left-t.left+"px"}return this.style(n)}},t.prototype.outsideClick=function(t){var e;if(e=$(t.target),!("focusin"===t.type||e.closest(this.anchorElement).length||e.closest(this.containerElement).length||e.closest(".calendar").length))return this.close()},t}(),s.template='
',$.extend($.fn.daterangepicker,{ArrayUtils:e,MomentIterator:c,MomentUtil:u,Period:d,Config:r,DateRange:o,AllTimeDateRange:t,CustomDateRange:i,DateRangePickerView:s,CalendarView:a,CalendarHeaderView:n})}).call(this); \ No newline at end of file +(function(factory) { + var jQuery, ko, moment; + if (typeof define === 'function' && define.amd) { + define(['jquery', 'moment', 'knockout'], factory); + } else if (typeof exports !== 'undefined') { + try { + jQuery = require('jquery'); + } catch (_error) {} + try { + moment = require('moment'); + } catch (_error) {} + try { + ko = require('knockout'); + } catch (_error) {} + factory(jQuery, moment, ko); + } else { + factory(jQuery, moment, ko); + } +})(function($, moment, ko) { + +(function(){var t,e,n,a,r,i,o,s,c,u,d,l=function(t,e){function n(){this.constructor=t}for(var a in e)h.call(e,a)&&(t[a]=e[a]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty,p=function(t,e){return function(){return t.apply(e,arguments)}};u=function(){function t(){}return t.patchCurrentLocale=function(t){return moment.locale(moment.locale(),t)},t.setFirstDayOfTheWeek=function(t){var e;if(t=(t%7+7)%7,moment.localeData().firstDayOfWeek()!==t)return e=t-moment.localeData().firstDayOfWeek(),this.patchCurrentLocale({week:{dow:t,doy:moment.localeData().firstDayOfYear()}})},t.tz=function(t){var e,n;return e=Array.prototype.slice.call(arguments,0,-1),n=arguments[arguments.length-1],moment.tz?moment.tz.apply(null,e.concat([n])):n&&"utc"===n.toLowerCase()?moment.utc.apply(null,e):moment.apply(null,e)},t}(),c=function(){function t(t,e){this.date=t.clone(),this.period=e}return t.array=function(t,e,n){var a,r,i,o,s;for(r=new this(t,n),s=[],a=i=0,o=e-1;0<=o?i<=o:i>=o;a=0<=o?++i:--i)s.push(r.next());return s},t.prototype.next=function(){var t;return t=this.date,this.date=t.clone().add(1,this.period),t.clone()},t}(),e=function(){function t(){}return t.rotateArray=function(t,e){return e%=t.length,t.slice(e).concat(t.slice(0,e))},t.uniqArray=function(t){var e,n,a,r;for(r=[],n=0,a=t.length;n=t;e<=t?a++:a--)n.push(a);return n}.apply(this)},t.prototype.yearOptions=function(){var t,e;return function(){e=[];for(var n=t=this.currentDate.minBoundary().year(),a=this.currentDate.maxBoundary().year();t<=a?n<=a:n>=a;t<=a?n++:n--)e.push(n);return e}.apply(this)},t.prototype.decadeOptions=function(){return e.uniqArray(this.yearOptions().map(function(t){return function(e){var n;return n=u.tz([e],t.timeZone()),t.firstYearOfDecade(n).year()}}(this)))},t.prototype.monthSelectorAvailable=function(){var t;return"day"===(t=this.period())||"week"===t},t.prototype.yearSelectorAvailable=function(){return"year"!==this.period()},t.prototype.decadeSelectorAvailable=function(){return"year"===this.period()},t.prototype.monthFormatter=function(t){return moment.utc([2015,t]).format("MMM")},t.prototype.yearFormatter=function(t){return moment.utc([t]).format("YYYY")},t.prototype.decadeFormatter=function(t){var e,n,a,r;return n=d.dimentions("year"),e=n[0],a=n[1],r=t+e*a-1,t+" – "+r},t}(),a=function(){function t(t,e,a){this.cssForDate=p(this.cssForDate,this),this.eventsForDate=p(this.eventsForDate,this),this.formatDateTemplate=p(this.formatDateTemplate,this),this.tableValues=p(this.tableValues,this),this.inRange=p(this.inRange,this),this.period=t.period,this.single=t.single,this.timeZone=t.timeZone,this.locale=t.locale,this.startDate=t.startDate,this.endDate=t.endDate,this.isCustomPeriodRangeActive=t.isCustomPeriodRangeActive,this.type=a,this.label=t.locale[a+"Label"]||"",this.hoverDate=ko.observable(null),this.activeDate=e,this.currentDate=e.clone(),this.inputDate=ko.computed({read:function(t){return function(){return(t.hoverDate()||t.activeDate()).format(t.locale.inputFormat)}}(this),write:function(t){return function(e){var n;if(n=u.tz(e,t.locale.inputFormat,t.timeZone()),n.isValid())return t.activeDate(n)}}(this),pure:!0}),this.firstDate=ko.pureComputed(function(t){return function(){var e,n;switch(e=t.currentDate().clone().startOf(t.period.scale()),t.period()){case"day":case"week":n=e.clone(),e.weekday(0),(e.isAfter(n)||e.isSame(n,"day"))&&e.subtract(1,"week");break;case"year":e=t.firstYearOfDecade(e)}return e}}(this)),this.activeDate.subscribe(function(t){return function(e){return t.currentDate(e)}}(this)),this.headerView=new n(this)}return t.prototype.calendar=function(){var t,e,n,a,r,i,o,s,u,d;for(i=this.period.dimentions(),e=i[0],d=i[1],a=new c(this.firstDate(),this.period()),s=[],u=r=1,o=d;1<=o?r<=o:r>=o;u=1<=o?++r:--r)s.push(function(){var r,i,o;for(o=[],t=r=1,i=e;1<=i?r<=i:r>=i;t=1<=i?++r:--r)n=a.next(),"end"===this.type?o.push(n.endOf(this.period())):o.push(n.startOf(this.period()));return o}.call(this));return s},t.prototype.weekDayNames=function(){return e.rotateArray(moment.weekdaysMin(),moment.localeData().firstDayOfWeek())},t.prototype.inRange=function(t){return t.isAfter(this.startDate(),this.period())&&t.isBefore(this.endDate(),this.period())||t.isSame(this.startDate(),this.period())||t.isSame(this.endDate(),this.period())},t.prototype.tableValues=function(t){var e,n,a;switch(e=this.period.format(),this.period()){case"day":case"month":case"year":return[{html:t.format(e)}];case"week":return t=t.clone().startOf(this.period()),c.array(t,7,"day").map(function(t){return function(n){return{html:n.format(e),css:{"week-day":!0,unavailable:t.cssForDate(n,!0).unavailable}}}}(this));case"quarter":return a=t.format(e),t=t.clone().startOf("quarter"),n=c.array(t,3,"month").map(function(t){return t.format("MMM")}),[{html:a+"
"+n.join(", ")+""}]}},t.prototype.formatDateTemplate=function(t){return{nodes:$("
"+this.formatDate(t)+"
").children()}},t.prototype.eventsForDate=function(t){return{click:function(e){return function(){if(e.activeDate.isWithinBoundaries(t))return e.activeDate(t)}}(this),mouseenter:function(e){return function(){if(e.activeDate.isWithinBoundaries(t))return e.hoverDate(e.activeDate.fit(t))}}(this),mouseleave:function(t){return function(){return t.hoverDate(null)}}(this)}},t.prototype.cssForDate=function(t,e){var n,a,r,i,o;return i=t.isSame(this.activeDate(),this.period()),o=this.activeDate.isWithinBoundaries(t),e||(e="day"===this.period()),n=!t.isSame(this.currentDate(),"month"),a=this.inRange(t),r={"in-range":!this.single()&&(a||i)},r[this.type+"-date"]=i,r.clickable=o&&!this.isCustomPeriodRangeActive(),r["out-of-boundaries"]=!o||this.isCustomPeriodRangeActive(),r.unavailable=e&&n,r},t.prototype.firstYearOfDecade=function(t){var e,n,a,r;return e=u.tz(moment(),this.timeZone()).year(),n=e-4,a=Math.floor((t.year()-n)/9),r=n+9*a,u.tz([r],this.timeZone())},t}(),s=function(){function t(t){var e,n,i,o;null==t&&(t={}),this.outsideClick=p(this.outsideClick,this),this.setCustomPeriodRange=p(this.setCustomPeriodRange,this),this.setDateRange=p(this.setDateRange,this),new r(t).extend(this),this.startCalendar=new a(this,this.startDate,"start"),this.endCalendar=new a(this,this.endDate,"end"),this.startDateInput=this.startCalendar.inputDate,this.endDateInput=this.endCalendar.inputDate,this.dateRange=ko.observable([this.startDate(),this.endDate()]),this.startDate.subscribe(function(t){return function(e){return t.single()?(t.endDate(e.clone().endOf(t.period())),t.updateDateRange(),t.close()):(t.endDate().isSame(e)&&t.endDate(t.endDate().clone().endOf(t.period())),t.standalone()?t.updateDateRange():void 0)}}(this)),this.style=ko.observable({}),this.callback&&(this.dateRange.subscribe(function(t){return function(e){var n,a;return a=e[0],n=e[1],t.callback(a.clone(),n.clone(),t.period())}}(this)),this.forceUpdate&&(n=this.dateRange(),i=n[0],e=n[1],this.callback(i.clone(),e.clone(),this.period()))),this.anchorElement&&(o=$('
').appendTo(this.parentElement),this.containerElement=$(this.constructor.template).appendTo(o),ko.applyBindings(this,this.containerElement.get(0)),this.anchorElement.click(function(t){return function(){return t.updatePosition(),t.toggle()}}(this)),this.standalone()||$(document).on("mousedown.daterangepicker",this.outsideClick).on("touchend.daterangepicker",this.outsideClick).on("click.daterangepicker","[data-toggle=dropdown]",this.outsideClick).on("focusin.daterangepicker",this.outsideClick)),this.opened()&&this.updatePosition()}return t.prototype.periodProxy=d,t.prototype.calendars=function(){return this.single()?[this.startCalendar]:[this.startCalendar,this.endCalendar]},t.prototype.updateDateRange=function(){return this.dateRange([this.startDate(),this.endDate()])},t.prototype.cssClasses=function(){var t,e,n,a,r;for(n={single:this.single(),opened:this.standalone()||this.opened(),expanded:this.standalone()||this.single()||this.expanded(),standalone:this.standalone(),"hide-weekdays":this.hideWeekdays(),"hide-periods":this.periods().length+this.customPeriodRanges.length===1,"orientation-left":"left"===this.orientation(),"orientation-right":"right"===this.orientation()},r=d.allPeriods,t=0,e=r.length;t$(window).width()?n.right="0":n.left=this.anchorElement.offset().left-t.left+"px"}return this.style(n)}},t.prototype.outsideClick=function(t){var e;if(e=$(t.target),!("focusin"===t.type||e.closest(this.anchorElement).length||e.closest(this.containerElement).length||e.closest(".calendar").length))return this.close()},t}(),s.template='
',$.extend($.fn.daterangepicker,{ArrayUtils:e,MomentIterator:c,MomentUtil:u,Period:d,Config:r,DateRange:o,AllTimeDateRange:t,CustomDateRange:i,DateRangePickerView:s,CalendarView:a,CalendarHeaderView:n})}).call(this); + +}); \ No newline at end of file