diff --git a/plugins/daterangepicker/daterangepicker.js b/plugins/daterangepicker/daterangepicker.js index 228612b9b..be710052f 100755 --- a/plugins/daterangepicker/daterangepicker.js +++ b/plugins/daterangepicker/daterangepicker.js @@ -1,5 +1,5 @@ /** -* @version: 1.3.21 +* @version: 2.1.19 * @author: Dan Grossman http://www.dangrossman.info/ * @copyright: Copyright (c) 2012-2015 Dan Grossman. All rights reserved. * @license: Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php @@ -14,544 +14,991 @@ }); } else if (typeof exports !== 'undefined') { - var momentjs = require('moment'); - var jQuery; - try { - jQuery = require('jquery'); - } catch (err) { - jQuery = window.jQuery; - if (!jQuery) throw new Error('jQuery dependency not found'); - } + var momentjs = require('moment'); + var jQuery = (typeof window != 'undefined') ? window.jQuery : undefined; //isomorphic issue + if (!jQuery) { + try { + jQuery = require('jquery'); + if (!jQuery.fn) jQuery.fn = {}; //isomorphic issue + } catch (err) { + if (!jQuery) throw new Error('jQuery dependency not found'); + } + } factory(root, exports, momentjs, jQuery); // Finally, as a browser global. } else { - root.daterangepicker = factory(root, {}, root.moment, (root.jQuery || root.Zepto || root.ender || root.$)); + root.daterangepicker = factory(root, {}, root.moment || moment, (root.jQuery || root.Zepto || root.ender || root.$)); } -}(this, function(root, daterangepicker, moment, $) { +}(this || {}, function(root, daterangepicker, moment, $) { // 'this' doesn't exist on a server - var DateRangePicker = function (element, options, cb) { + var DateRangePicker = function(element, options, cb) { - // by default, the daterangepicker element is placed at the bottom of HTML body + //default settings for options this.parentEl = 'body'; - - //element that triggered the date range picker this.element = $(element); - - //tracks visible state + this.startDate = moment().startOf('day'); + this.endDate = moment().endOf('day'); + this.minDate = false; + this.maxDate = false; + this.dateLimit = false; + this.autoApply = false; + this.singleDatePicker = false; + this.showDropdowns = false; + this.showWeekNumbers = false; + this.showISOWeekNumbers = false; + this.timePicker = false; + this.timePicker24Hour = false; + this.timePickerIncrement = 1; + this.timePickerSeconds = false; + this.linkedCalendars = true; + this.autoUpdateInput = true; + this.alwaysShowCalendars = false; + this.ranges = {}; + + this.opens = 'right'; + if (this.element.hasClass('pull-right')) + this.opens = 'left'; + + this.drops = 'down'; + if (this.element.hasClass('dropup')) + this.drops = 'up'; + + this.buttonClasses = 'btn btn-sm'; + this.applyClass = 'btn-success'; + this.cancelClass = 'btn-default'; + + this.locale = { + format: 'MM/DD/YYYY', + separator: ' - ', + applyLabel: 'Apply', + cancelLabel: 'Cancel', + weekLabel: 'W', + customRangeLabel: 'Custom Range', + daysOfWeek: moment.weekdaysMin(), + monthNames: moment.monthsShort(), + firstDay: moment.localeData().firstDayOfWeek() + }; + + this.callback = function() { }; + + //some state information this.isShowing = false; + this.leftCalendar = {}; + this.rightCalendar = {}; - //create the picker HTML object - var DRPTemplate = '