Update daterangepicker to v3.1.0 (#2713)

This commit is contained in:
XhmikosR 2020-05-30 13:10:52 +03:00 committed by GitHub
parent 45eae49936
commit 1877ee7431
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 43 additions and 29 deletions

8
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "admin-lte",
"version": "3.0.4",
"version": "3.0.6-pre",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -3301,9 +3301,9 @@
}
},
"daterangepicker": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/daterangepicker/-/daterangepicker-3.0.5.tgz",
"integrity": "sha512-BoVV+OjVARWNE15iF+3Y2QIMioAD2UODHvJwIq+NtG0vxh61dXRmOMXlw2dsvxS8KY4n5uvIcBfIPiEiiGJcBg==",
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/daterangepicker/-/daterangepicker-3.1.0.tgz",
"integrity": "sha512-DxWXvvPq4srWLCqFugqSV+6CBt/CvQ0dnpXhQ3gl0autcIDAruG1PuGG3gC7yPRNytAD1oU1AcUOzaYhOawhTw==",
"requires": {
"jquery": ">=1.10",
"moment": "^2.9.0"

View file

@ -95,7 +95,7 @@
"datatables.net-rowreorder-bs4": "^1.2.6",
"datatables.net-scroller-bs4": "^2.0.1",
"datatables.net-select-bs4": "^1.3.1",
"daterangepicker": "^3.0.5",
"daterangepicker": "^3.1.0",
"ekko-lightbox": "^5.3.0",
"fastclick": "^1.0.6",
"filterizr": "^2.2.3",

View file

@ -1,5 +1,5 @@
/**
* @version: 3.0.5
* @version: 3.1
* @author: Dan Grossman http://www.dangrossman.info/
* @copyright: Copyright (c) 2012-2019 Dan Grossman. All rights reserved.
* @license: Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php
@ -11,7 +11,7 @@
// AMD. Make globaly available as well
define(['moment', 'jquery'], function (moment, jquery) {
if (!jquery.fn) jquery.fn = {}; // webpack server rendering
if (typeof moment !== 'function' && moment.default) moment = moment.default
if (typeof moment !== 'function' && moment.hasOwnProperty('default')) moment = moment['default']
return factory(moment, jquery);
});
} else if (typeof module === 'object' && module.exports) {
@ -386,7 +386,7 @@
this.container.find('.drp-calendar.left').addClass('single');
this.container.find('.drp-calendar.left').show();
this.container.find('.drp-calendar.right').hide();
if (!this.timePicker) {
if (!this.timePicker && this.autoApply) {
this.container.addClass('auto-apply');
}
}
@ -417,14 +417,14 @@
.on('mouseenter.daterangepicker', 'td.available', $.proxy(this.hoverDate, this))
.on('change.daterangepicker', 'select.yearselect', $.proxy(this.monthOrYearChanged, this))
.on('change.daterangepicker', 'select.monthselect', $.proxy(this.monthOrYearChanged, this))
.on('change.daterangepicker', 'select.hourselect,select.minuteselect,select.secondselect,select.ampmselect', $.proxy(this.timeChanged, this))
.on('change.daterangepicker', 'select.hourselect,select.minuteselect,select.secondselect,select.ampmselect', $.proxy(this.timeChanged, this));
this.container.find('.ranges')
.on('click.daterangepicker', 'li', $.proxy(this.clickRange, this))
.on('click.daterangepicker', 'li', $.proxy(this.clickRange, this));
this.container.find('.drp-buttons')
.on('click.daterangepicker', 'button.applyBtn', $.proxy(this.clickApply, this))
.on('click.daterangepicker', 'button.cancelBtn', $.proxy(this.clickCancel, this))
.on('click.daterangepicker', 'button.cancelBtn', $.proxy(this.clickCancel, this));
if (this.element.is('input') || this.element.is('button')) {
this.element.on({
@ -526,9 +526,9 @@
this.renderTimePicker('left');
this.renderTimePicker('right');
if (!this.endDate) {
this.container.find('.right .calendar-time select').attr('disabled', 'disabled').addClass('disabled');
this.container.find('.right .calendar-time select').prop('disabled', true).addClass('disabled');
} else {
this.container.find('.right .calendar-time select').removeAttr('disabled').removeClass('disabled');
this.container.find('.right .calendar-time select').prop('disabled', false).removeClass('disabled');
}
}
if (this.endDate)
@ -1014,16 +1014,18 @@
updateFormInputs: function() {
if (this.singleDatePicker || (this.endDate && (this.startDate.isBefore(this.endDate) || this.startDate.isSame(this.endDate)))) {
this.container.find('button.applyBtn').removeAttr('disabled');
this.container.find('button.applyBtn').prop('disabled', false);
} else {
this.container.find('button.applyBtn').attr('disabled', 'disabled');
this.container.find('button.applyBtn').prop('disabled', true);
}
},
move: function() {
var parentOffset = { top: 0, left: 0 },
containerTop;
containerTop,
drops = this.drops;
var parentRightEdge = $(window).width();
if (!this.parentEl.is('body')) {
parentOffset = {
@ -1033,10 +1035,21 @@
parentRightEdge = this.parentEl[0].clientWidth + this.parentEl.offset().left;
}
if (this.drops == 'up')
containerTop = this.element.offset().top - this.container.outerHeight() - parentOffset.top;
else
switch (drops) {
case 'auto':
containerTop = this.element.offset().top + this.element.outerHeight() - parentOffset.top;
if (containerTop + this.container.outerHeight() >= this.parentEl[0].scrollHeight) {
containerTop = this.element.offset().top - this.container.outerHeight() - parentOffset.top;
drops = 'up';
}
break;
case 'up':
containerTop = this.element.offset().top - this.container.outerHeight() - parentOffset.top;
break;
default:
containerTop = this.element.offset().top + this.element.outerHeight() - parentOffset.top;
break;
}
// Force the container to it's actual width
this.container.css({
@ -1046,7 +1059,7 @@
});
var containerWidth = this.container.outerWidth();
this.container[this.drops == 'up' ? 'addClass' : 'removeClass']('drop-up');
this.container.toggleClass('drop-up', drops == 'up');
if (this.opens == 'left') {
var containerRight = parentRightEdge - this.element.offset().left - this.element.outerWidth();
@ -1341,7 +1354,7 @@
if (this.singleDatePicker) {
this.setEndDate(this.startDate);
if (!this.timePicker)
if (!this.timePicker && this.autoApply)
this.clickApply();
}

View file

@ -1,6 +1,6 @@
Package.describe({
name: 'dangrossman:bootstrap-daterangepicker',
version: '3.0.5',
version: '3.1.0',
summary: 'Date range picker component',
git: 'https://github.com/dangrossman/daterangepicker',
documentation: 'README.md'

View file

@ -263,7 +263,7 @@
}, cb);
cb(start, end);
});
</script>
@ -282,7 +282,7 @@
<div class="col-4">
<label>Produces:</label>
<input type="text" name="datefilter" class="form-control pull-right" value="" />
<script type="text/javascript">
$(function() {
@ -367,7 +367,7 @@
<code>opens</code>: ('left'/'right'/'center') Whether the picker appears aligned to the left, to the right, or centered under the HTML element it's attached to.
</li>
<li>
<code>drops</code>: ('down'/'up') Whether the picker appears below (default) or above the HTML element it's attached to.
<code>drops</code>: ('down'/'up'/'auto') Whether the picker appears below (default) or above the HTML element it's attached to.
</li>
<li>
<code>buttonClasses</code>: (string) CSS class names that will be added to both the apply and cancel buttons.
@ -416,14 +416,14 @@
<p>
You can programmatically update the <code>startDate</code> and <code>endDate</code>
in the picker using the <code>setStartDate</code> and <code>setEndDate</code> methods.
You can access the Date Range Picker object and its functions and properties through
You can access the Date Range Picker object and its functions and properties through
data properties of the element you attached it to.
</p>
<script src="https://gist.github.com/dangrossman/8ff9b1220c9b5682e8bd.js"></script>
<br/>
<ul class="nobullets">
<li>
<code>setStartDate(Date or string)</code>: Sets the date range picker's currently selected start date to the provided date
@ -482,7 +482,7 @@
<h1 style="margin-top: 30px"><a id="config" href="#config">Configuration Generator</a></h1>
<div class="well configurator">
<form>
<div class="row">
@ -527,6 +527,7 @@
<select id="drops" class="form-control">
<option value="down" selected>down</option>
<option value="up">up</option>
<option value="auto">auto</option>
</select>
</div>
@ -737,7 +738,7 @@
</script>
<div id="footer">
Copyright &copy; 2012-2018 <a href="http://www.dangrossman.info/">Dan Grossman</a>.
Copyright &copy; 2012-2018 <a href="http://www.dangrossman.info/">Dan Grossman</a>.
</div>
</body>