From d73cf9966690b7cc9c8bc981ee1c7e8fe1703145 Mon Sep 17 00:00:00 2001 From: Foulques du Peloux Date: Tue, 19 Apr 2016 16:46:52 +0200 Subject: [PATCH 1/7] Update Date Range Picker --- .../daterangepicker/daterangepicker-bs3.css | 335 ------------------ plugins/daterangepicker/daterangepicker.css | 232 ++++++++++++ 2 files changed, 232 insertions(+), 335 deletions(-) delete mode 100755 plugins/daterangepicker/daterangepicker-bs3.css create mode 100755 plugins/daterangepicker/daterangepicker.css diff --git a/plugins/daterangepicker/daterangepicker-bs3.css b/plugins/daterangepicker/daterangepicker-bs3.css deleted file mode 100755 index 7a501fb0e..000000000 --- a/plugins/daterangepicker/daterangepicker-bs3.css +++ /dev/null @@ -1,335 +0,0 @@ -/*! - * Stylesheet for the Date Range Picker, for use with Bootstrap 3.x - * - * Copyright 2013-2015 Dan Grossman ( http://www.dangrossman.info ) - * Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php - * - * Built for http://www.improvely.com - */ - - .daterangepicker.dropdown-menu { - max-width: none; - z-index: 3000; -} - -.daterangepicker.opensleft .ranges, .daterangepicker.opensleft .calendar { - float: left; - margin: 4px; -} - -.daterangepicker.opensright .ranges, .daterangepicker.opensright .calendar, -.daterangepicker.openscenter .ranges, .daterangepicker.openscenter .calendar { - float: right; - margin: 4px; -} - -.daterangepicker.single .ranges, .daterangepicker.single .calendar { - float: none; -} - -.daterangepicker .ranges { - width: 160px; - text-align: left; -} - -.daterangepicker .ranges .range_inputs>div { - float: left; -} - -.daterangepicker .ranges .range_inputs>div:nth-child(2) { - padding-left: 11px; -} - -.daterangepicker .calendar { - display: none; - max-width: 270px; -} - -.daterangepicker.show-calendar .calendar { - display: block; -} - -.daterangepicker .calendar.single .calendar-date { - border: none; -} - -.daterangepicker .calendar th, .daterangepicker .calendar td { - font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; - white-space: nowrap; - text-align: center; - min-width: 32px; -} - -.daterangepicker .daterangepicker_start_input label, -.daterangepicker .daterangepicker_end_input label { - color: #333; - display: block; - font-size: 11px; - font-weight: normal; - height: 20px; - line-height: 20px; - margin-bottom: 2px; - text-shadow: #fff 1px 1px 0px; - text-transform: uppercase; - width: 74px; -} - -.daterangepicker .ranges input { - font-size: 11px; -} - -.daterangepicker .ranges .input-mini { - border: 1px solid #ccc; - border-radius: 4px; - color: #555; - display: block; - font-size: 11px; - height: 30px; - line-height: 30px; - vertical-align: middle; - margin: 0 0 10px 0; - padding: 0 6px; - width: 74px; -} - -.daterangepicker .ranges ul { - list-style: none; - margin: 0; - padding: 0; -} - -.daterangepicker .ranges li { - font-size: 13px; - background: #f5f5f5; - border: 1px solid #f5f5f5; - color: #08c; - padding: 3px 12px; - margin-bottom: 8px; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; - cursor: pointer; -} - -.daterangepicker .ranges li.active, .daterangepicker .ranges li:hover { - background: #08c; - border: 1px solid #08c; - color: #fff; -} - -.daterangepicker .calendar-date { - border: 1px solid #ddd; - padding: 4px; - border-radius: 4px; - background: #fff; -} - -.daterangepicker .calendar-time { - text-align: center; - margin: 8px auto 0 auto; - line-height: 30px; -} - -.daterangepicker { - position: absolute; - background: #fff; - top: 100px; - left: 20px; - padding: 4px; - margin-top: 1px; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; -} - -.daterangepicker.opensleft:before { - position: absolute; - top: -7px; - right: 9px; - display: inline-block; - border-right: 7px solid transparent; - border-bottom: 7px solid #ccc; - border-left: 7px solid transparent; - border-bottom-color: rgba(0, 0, 0, 0.2); - content: ''; -} - -.daterangepicker.opensleft:after { - position: absolute; - top: -6px; - right: 10px; - display: inline-block; - border-right: 6px solid transparent; - border-bottom: 6px solid #fff; - border-left: 6px solid transparent; - content: ''; -} - -.daterangepicker.openscenter:before { - position: absolute; - top: -7px; - left: 0; - right: 0; - width: 0; - margin-left: auto; - margin-right: auto; - display: inline-block; - border-right: 7px solid transparent; - border-bottom: 7px solid #ccc; - border-left: 7px solid transparent; - border-bottom-color: rgba(0, 0, 0, 0.2); - content: ''; -} - -.daterangepicker.openscenter:after { - position: absolute; - top: -6px; - left: 0; - right: 0; - width: 0; - margin-left: auto; - margin-right: auto; - display: inline-block; - border-right: 6px solid transparent; - border-bottom: 6px solid #fff; - border-left: 6px solid transparent; - content: ''; -} - -.daterangepicker.opensright:before { - position: absolute; - top: -7px; - left: 9px; - display: inline-block; - border-right: 7px solid transparent; - border-bottom: 7px solid #ccc; - border-left: 7px solid transparent; - border-bottom-color: rgba(0, 0, 0, 0.2); - content: ''; -} - -.daterangepicker.opensright:after { - position: absolute; - top: -6px; - left: 10px; - display: inline-block; - border-right: 6px solid transparent; - border-bottom: 6px solid #fff; - border-left: 6px solid transparent; - content: ''; -} - -.daterangepicker.dropup{ - margin-top: -5px; -} -.daterangepicker.dropup:before{ - top: initial; - bottom:-7px; - border-bottom: initial; - border-top: 7px solid #ccc; -} -.daterangepicker.dropup:after{ - top: initial; - bottom:-6px; - border-bottom: initial; - border-top: 6px solid #fff; -} - -.daterangepicker table { - width: 100%; - margin: 0; -} - -.daterangepicker td, .daterangepicker th { - text-align: center; - width: 20px; - height: 20px; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; - cursor: pointer; - white-space: nowrap; -} - -.daterangepicker td.off { - color: #999; -} - -.daterangepicker td.disabled, .daterangepicker option.disabled { - color: #999; -} - -.daterangepicker td.available:hover, .daterangepicker th.available:hover { - background: #eee; -} - -.daterangepicker td.in-range { - background: #ebf4f8; - -webkit-border-radius: 0; - -moz-border-radius: 0; - border-radius: 0; -} - -.daterangepicker td.start-date { - -webkit-border-radius: 4px 0 0 4px; - -moz-border-radius: 4px 0 0 4px; - border-radius: 4px 0 0 4px; -} - -.daterangepicker td.end-date { - -webkit-border-radius: 0 4px 4px 0; - -moz-border-radius: 0 4px 4px 0; - border-radius: 0 4px 4px 0; -} - -.daterangepicker td.start-date.end-date { - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; -} - -.daterangepicker td.active, .daterangepicker td.active:hover { - background-color: #357ebd; - border-color: #3071a9; - color: #fff; -} - -.daterangepicker td.week, .daterangepicker th.week { - font-size: 80%; - color: #ccc; -} - -.daterangepicker select.monthselect, .daterangepicker select.yearselect { - font-size: 12px; - padding: 1px; - height: auto; - margin: 0; - cursor: default; -} - -.daterangepicker select.monthselect { - margin-right: 2%; - width: 56%; -} - -.daterangepicker select.yearselect { - width: 40%; -} - -.daterangepicker select.hourselect, .daterangepicker select.minuteselect, .daterangepicker select.secondselect, .daterangepicker select.ampmselect { - width: 50px; - margin-bottom: 0; -} - -.daterangepicker_start_input { - float: left; -} - -.daterangepicker_end_input { - float: left; - padding-left: 11px -} - -.daterangepicker th.month { - width: auto; -} diff --git a/plugins/daterangepicker/daterangepicker.css b/plugins/daterangepicker/daterangepicker.css new file mode 100755 index 000000000..dfce19cba --- /dev/null +++ b/plugins/daterangepicker/daterangepicker.css @@ -0,0 +1,232 @@ +.daterangepicker { + position: absolute; + color: inherit; + background: #fff; + border-radius: 4px; + width: 278px; + padding: 4px; + margin-top: 1px; + top: 100px; + left: 20px; + /* Calendars */ } + .daterangepicker:before, .daterangepicker:after { + position: absolute; + display: inline-block; + border-bottom-color: rgba(0, 0, 0, 0.2); + content: ''; } + .daterangepicker:before { + top: -7px; + border-right: 7px solid transparent; + border-left: 7px solid transparent; + border-bottom: 7px solid #ccc; } + .daterangepicker:after { + top: -6px; + border-right: 6px solid transparent; + border-bottom: 6px solid #fff; + border-left: 6px solid transparent; } + .daterangepicker.opensleft:before { + right: 9px; } + .daterangepicker.opensleft:after { + right: 10px; } + .daterangepicker.openscenter:before { + left: 0; + right: 0; + width: 0; + margin-left: auto; + margin-right: auto; } + .daterangepicker.openscenter:after { + left: 0; + right: 0; + width: 0; + margin-left: auto; + margin-right: auto; } + .daterangepicker.opensright:before { + left: 9px; } + .daterangepicker.opensright:after { + left: 10px; } + .daterangepicker.dropup { + margin-top: -5px; } + .daterangepicker.dropup:before { + top: initial; + bottom: -7px; + border-bottom: initial; + border-top: 7px solid #ccc; } + .daterangepicker.dropup:after { + top: initial; + bottom: -6px; + border-bottom: initial; + border-top: 6px solid #fff; } + .daterangepicker.dropdown-menu { + max-width: none; + z-index: 3001; } + .daterangepicker.single .ranges, .daterangepicker.single .calendar { + float: none; } + .daterangepicker.show-calendar .calendar { + display: block; } + .daterangepicker .calendar { + display: none; + max-width: 270px; + margin: 4px; } + .daterangepicker .calendar.single .calendar-table { + border: none; } + .daterangepicker .calendar th, .daterangepicker .calendar td { + white-space: nowrap; + text-align: center; + min-width: 32px; } + .daterangepicker .calendar-table { + border: 1px solid #fff; + padding: 4px; + border-radius: 4px; + background: #fff; } + .daterangepicker table { + width: 100%; + margin: 0; } + .daterangepicker td, .daterangepicker th { + text-align: center; + width: 20px; + height: 20px; + border-radius: 4px; + border: 1px solid transparent; + white-space: nowrap; + cursor: pointer; } + .daterangepicker td.available:hover, .daterangepicker th.available:hover { + background: #eee; } + .daterangepicker td.week, .daterangepicker th.week { + font-size: 80%; + color: #ccc; } + .daterangepicker td.off, .daterangepicker td.off.in-range, .daterangepicker td.off.start-date, .daterangepicker td.off.end-date { + background-color: #fff; + border-color: transparent; + color: #999; } + .daterangepicker td.in-range { + background-color: #ebf4f8; + border-color: transparent; + color: #000; + border-radius: 0; } + .daterangepicker td.start-date { + border-radius: 4px 0 0 4px; } + .daterangepicker td.end-date { + border-radius: 0 4px 4px 0; } + .daterangepicker td.start-date.end-date { + border-radius: 4px; } + .daterangepicker td.active, .daterangepicker td.active:hover { + background-color: #357ebd; + border-color: transparent; + color: #fff; } + .daterangepicker th.month { + width: auto; } + .daterangepicker td.disabled, .daterangepicker option.disabled { + color: #999; + cursor: not-allowed; + text-decoration: line-through; } + .daterangepicker select.monthselect, .daterangepicker select.yearselect { + font-size: 12px; + padding: 1px; + height: auto; + margin: 0; + cursor: default; } + .daterangepicker select.monthselect { + margin-right: 2%; + width: 56%; } + .daterangepicker select.yearselect { + width: 40%; } + .daterangepicker select.hourselect, .daterangepicker select.minuteselect, .daterangepicker select.secondselect, .daterangepicker select.ampmselect { + width: 50px; + margin-bottom: 0; } + .daterangepicker .input-mini { + border: 1px solid #ccc; + border-radius: 4px; + color: #555; + height: 30px; + line-height: 30px; + display: block; + vertical-align: middle; + margin: 0 0 5px 0; + padding: 0 6px 0 28px; + width: 100%; } + .daterangepicker .input-mini.active { + border: 1px solid #08c; + border-radius: 4px; } + .daterangepicker .daterangepicker_input { + position: relative; } + .daterangepicker .daterangepicker_input i { + position: absolute; + left: 8px; + top: 8px; } + .daterangepicker .calendar-time { + text-align: center; + margin: 5px auto; + line-height: 30px; + position: relative; + padding-left: 28px; } + .daterangepicker .calendar-time select.disabled { + color: #ccc; + cursor: not-allowed; } + +.ranges { + font-size: 11px; + float: none; + margin: 4px; + text-align: left; } + .ranges ul { + list-style: none; + margin: 0 auto; + padding: 0; + width: 100%; } + .ranges li { + font-size: 13px; + background: #f5f5f5; + border: 1px solid #f5f5f5; + border-radius: 4px; + color: #08c; + padding: 3px 12px; + margin-bottom: 8px; + cursor: pointer; } + .ranges li:hover { + background: #08c; + border: 1px solid #08c; + color: #fff; } + .ranges li.active { + background: #08c; + border: 1px solid #08c; + color: #fff; } + +/* Larger Screen Styling */ +@media (min-width: 564px) { + .daterangepicker { + width: auto; } + .daterangepicker .ranges ul { + width: 160px; } + .daterangepicker.single .ranges ul { + width: 100%; } + .daterangepicker.single .calendar.left { + clear: none; } + .daterangepicker.single .ranges, .daterangepicker.single .calendar { + float: left; } + .daterangepicker .calendar.left { + clear: left; + margin-right: 0; } + .daterangepicker .calendar.left .calendar-table { + border-right: none; + border-top-right-radius: 0; + border-bottom-right-radius: 0; } + .daterangepicker .calendar.right { + margin-left: 0; } + .daterangepicker .calendar.right .calendar-table { + border-left: none; + border-top-left-radius: 0; + border-bottom-left-radius: 0; } + .daterangepicker .left .daterangepicker_input { + padding-right: 12px; } + .daterangepicker .calendar.left .calendar-table { + padding-right: 12px; } + .daterangepicker .ranges, .daterangepicker .calendar { + float: left; } } + +@media (min-width: 730px) { + .daterangepicker .ranges { + width: auto; + float: left; } + .daterangepicker .calendar.left { + clear: none; } } + From 446b1cec52eebb57a189e333c6d4acf8492dfc7e Mon Sep 17 00:00:00 2001 From: Foulques du Peloux Date: Tue, 19 Apr 2016 16:47:19 +0200 Subject: [PATCH 2/7] Update Date Range Picker --- plugins/daterangepicker/daterangepicker.js | 1960 +++++++++++--------- 1 file changed, 1099 insertions(+), 861 deletions(-) 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 = '