New version 2.5.5

This commit is contained in:
Chupurnov Valeriy 2017-10-12 13:18:22 +05:00
parent b5443286af
commit 6f86f8c9ca
13 changed files with 207 additions and 217 deletions

3
.gitignore vendored
View File

@ -1,3 +0,0 @@
parse.php
bower_components
node_modules

View File

@ -5,9 +5,9 @@ This file will be automatically displayed on the site
# Installation # Installation
``` ```
npm install datetimepicker-jquery npm install jquery-datetimepicker
OR OR
yarn add datetimepicker-jquery yarn add jquery-datetimepicker
``` ```
# datetimepicker # datetimepicker

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -70,7 +70,7 @@
} }
.xdsoft_datetimepicker .xdsoft_datepicker { .xdsoft_datetimepicker .xdsoft_datepicker {
width: 300px; width: 224px;
float: left; float: left;
margin-left: 8px; margin-left: 8px;
} }

343
jquery.datetimepicker.js Executable file → Normal file
View File

@ -1,22 +1,15 @@
/** /**
* @preserve jQuery DateTimePicker plugin v2.5.4 * @preserve jQuery DateTimePicker
* @homepage http://xdsoft.net/jqplugins/datetimepicker/ * @homepage http://xdsoft.net/jqplugins/datetimepicker/
* @author Chupurnov Valeriy (<chupurnov@gmail.com>) * @author Chupurnov Valeriy (<chupurnov@gmail.com>)
*/ */
/*global DateFormatter, document,window,jQuery,setTimeout,clearTimeout,HighlightedDate,getCurrentValue*/
;(function (factory) { /**
if ( typeof define === 'function' && define.amd ) { * @param {jQuery} $
// AMD. Register as an anonymous module. */
define(['jquery', 'jquery-mousewheel'], factory); var datetimepickerFactory = function ($) {
} else if (typeof exports === 'object') {
// Node/CommonJS style for Browserify
module.exports = factory;
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
'use strict'; 'use strict';
var default_options = { var default_options = {
i18n: { i18n: {
ar: { // Arabic ar: { // Arabic
@ -198,12 +191,12 @@
] ]
}, },
km: { // Khmer (ភាសាខ្មែរ) km: { // Khmer (ភាសាខ្មែរ)
months: [ months: [
"មករា​", "កុម្ភៈ", "មិនា​", "មេសា​", "ឧសភា​", "មិថុនា​", "កក្កដា​", "សីហា​", "កញ្ញា​", "តុលា​", "វិច្ឆិកា", "ធ្នូ​" "មករា​", "កុម្ភៈ", "មិនា​", "មេសា​", "ឧសភា​", "មិថុនា​", "កក្កដា​", "សីហា​", "កញ្ញា​", "តុលា​", "វិច្ឆិកា", "ធ្នូ​"
], ],
dayOfWeekShort: ["អាទិ​", "ច័ន្ទ​", "អង្គារ​", "ពុធ​", "ព្រហ​​", "សុក្រ​", "សៅរ៍"], dayOfWeekShort: ["អាទិ​", "ច័ន្ទ​", "អង្គារ​", "ពុធ​", "ព្រហ​​", "សុក្រ​", "សៅរ៍"],
dayOfWeek: ["អាទិត្យ​", "ច័ន្ទ​", "អង្គារ​", "ពុធ​", "ព្រហស្បតិ៍​", "សុក្រ​", "សៅរ៍"] dayOfWeek: ["អាទិត្យ​", "ច័ន្ទ​", "អង្គារ​", "ពុធ​", "ព្រហស្បតិ៍​", "សុក្រ​", "សៅរ៍"]
}, },
kr: { // Korean kr: { // Korean
months: [ months: [
"1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월" "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
@ -662,16 +655,18 @@
// for locale settings // for locale settings
$.datetimepicker = { $.datetimepicker = {
setLocale: function(locale){ setLocale: function(locale){
var newLocale = default_options.i18n[locale]?locale:globalLocaleDefault; var newLocale = default_options.i18n[locale] ? locale : globalLocaleDefault;
if(globalLocale != newLocale){ if (globalLocale !== newLocale) {
globalLocale = newLocale; globalLocale = newLocale;
// reinit date formatter // reinit date formatter
initDateFormatter(); initDateFormatter();
} }
}, },
setDateFormatter: function(dateFormatter) { setDateFormatter: function(dateFormatter) {
dateHelper = dateFormatter; dateHelper = dateFormatter;
}, },
RFC_2822: 'D, d M Y H:i:s O', RFC_2822: 'D, d M Y H:i:s O',
ATOM: 'Y-m-d\TH:i:sP', ATOM: 'Y-m-d\TH:i:sP',
ISO_8601: 'Y-m-d\TH:i:sO', ISO_8601: 'Y-m-d\TH:i:sO',
@ -688,10 +683,10 @@
// fix for ie8 // fix for ie8
if (!window.getComputedStyle) { if (!window.getComputedStyle) {
window.getComputedStyle = function (el, pseudo) { window.getComputedStyle = function (el) {
this.el = el; this.el = el;
this.getPropertyValue = function (prop) { this.getPropertyValue = function (prop) {
var re = /(\-([a-z]){1})/g; var re = /(-([a-z]))/g;
if (prop === 'float') { if (prop === 'float') {
prop = 'styleFloat'; prop = 'styleFloat';
} }
@ -714,9 +709,11 @@
return -1; return -1;
}; };
} }
Date.prototype.countDaysInMonth = function () { Date.prototype.countDaysInMonth = function () {
return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate(); return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate();
}; };
$.fn.xdsoftScroller = function (options, percent) { $.fn.xdsoftScroller = function (options, percent) {
return this.each(function () { return this.each(function () {
var timeboxparent = $(this), var timeboxparent = $(this),
@ -746,10 +743,12 @@
touchStart = false, touchStart = false,
startTopScroll = 0, startTopScroll = 0,
calcOffset = function () {}; calcOffset = function () {};
if (percent === 'hide') { if (percent === 'hide') {
timeboxparent.find('.xdsoft_scrollbar').hide(); timeboxparent.find('.xdsoft_scrollbar').hide();
return; return;
} }
if (!$(this).hasClass('xdsoft_scroller_box')) { if (!$(this).hasClass('xdsoft_scroller_box')) {
timebox = timeboxparent.children().eq(0); timebox = timeboxparent.children().eq(0);
parentHeight = timeboxparent[0].clientHeight; parentHeight = timeboxparent[0].clientHeight;
@ -966,14 +965,14 @@
month_picker month_picker
.find('.xdsoft_month span') .find('.xdsoft_month span')
.after(monthselect); .after(monthselect);
month_picker month_picker
.find('.xdsoft_year span') .find('.xdsoft_year span')
.after(yearselect); .after(yearselect);
month_picker month_picker
.find('.xdsoft_month,.xdsoft_year') .find('.xdsoft_month,.xdsoft_year')
.on('touchstart mousedown.xdsoft', function (event) { .on('touchstart mousedown.xdsoft', function (event) {
var select = $(this).find('.xdsoft_select').eq(0), var select = $(this).find('.xdsoft_select').eq(0),
val = 0, val = 0,
top = 0, top = 0,
@ -983,7 +982,7 @@
month_picker month_picker
.find('.xdsoft_select') .find('.xdsoft_select')
.hide(); .hide();
if (_xdsoft_datetime.currentTime) { if (_xdsoft_datetime.currentTime) {
val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month') ? 'getMonth' : 'getFullYear'](); val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month') ? 'getMonth' : 'getFullYear']();
} }
@ -1004,7 +1003,7 @@
month_picker month_picker
.find('.xdsoft_select') .find('.xdsoft_select')
.xdsoftScroller(options) .xdsoftScroller(options)
.on('touchstart mousedown.xdsoft', function (event) { .on('touchstart mousedown.xdsoft', function (event) {
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
@ -1181,15 +1180,15 @@
month_picker month_picker
.find('.xdsoft_today_button') .find('.xdsoft_today_button')
.css('visibility', !options.todayButton ? 'hidden' : 'visible'); .css('visibility', !options.todayButton ? 'hidden' : 'visible');
month_picker month_picker
.find('.' + options.prev) .find('.' + options.prev)
.css('visibility', !options.prevButton ? 'hidden' : 'visible'); .css('visibility', !options.prevButton ? 'hidden' : 'visible');
month_picker month_picker
.find('.' + options.next) .find('.' + options.next)
.css('visibility', !options.nextButton ? 'hidden' : 'visible'); .css('visibility', !options.nextButton ? 'hidden' : 'visible');
setMask(options); setMask(options);
@ -1197,7 +1196,8 @@
input input
.off('blur.xdsoft') .off('blur.xdsoft')
.on('blur.xdsoft', function () { .on('blur.xdsoft', function () {
if (options.allowBlank && (!$.trim($(this).val()).length || (typeof options.mask == "string" && $.trim($(this).val()) === options.mask.replace(/[0-9]/g, '_')))) { if (options.allowBlank && (!$.trim($(this).val()).length ||
(typeof options.mask === "string" && $.trim($(this).val()) === options.mask.replace(/[0-9]/g, '_')))) {
$(this).val(null); $(this).val(null);
datetimepicker.data('xdsoft_datetime').empty(); datetimepicker.data('xdsoft_datetime').empty();
} else { } else {
@ -1320,7 +1320,7 @@
_this.currentTime = null; _this.currentTime = null;
}; };
_this.getCurrentTime = function (dTime) { _this.getCurrentTime = function () {
return _this.currentTime; return _this.currentTime;
}; };
@ -1392,9 +1392,12 @@
} }
} }
var onejan = new Date(datetime.getFullYear(), 0, 1); var onejan = new Date(datetime.getFullYear(), 0, 1);
//First week of the year is th one with the first Thursday according to ISO8601 //First week of the year is th one with the first Thursday according to ISO8601
if(onejan.getDay()!=4) if (onejan.getDay() !== 4) {
onejan.setMonth(0, 1 + ((4 - onejan.getDay()+ 7) % 7)); onejan.setMonth(0, 1 + ((4 - onejan.getDay()+ 7) % 7));
}
return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7); return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7);
}; };
@ -1405,10 +1408,12 @@
return sDateTime; return sDateTime;
} }
tmpDate = /^(\+|\-)(.*)$/.exec(sDateTime); tmpDate = /^([+-]{1})(.*)$/.exec(sDateTime);
if (tmpDate) { if (tmpDate) {
tmpDate[2] = dateHelper.parseDate(tmpDate[2], options.formatDate); tmpDate[2] = dateHelper.parseDate(tmpDate[2], options.formatDate);
} }
if (tmpDate && tmpDate[2]) { if (tmpDate && tmpDate[2]) {
timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000; timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000;
currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset); currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset);
@ -1468,22 +1473,22 @@
_xdsoft_datetime.setCurrentTime(0, true); _xdsoft_datetime.setCurrentTime(0, true);
datetimepicker.trigger('afterOpen.xdsoft'); datetimepicker.trigger('afterOpen.xdsoft');
}).on('dblclick.xdsoft', function () { }).on('dblclick.xdsoft', function () {
var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate; var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate;
currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()); currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
minDate = _xdsoft_datetime.strToDate(options.minDate); minDate = _xdsoft_datetime.strToDate(options.minDate);
minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()); minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
if (currentDate < minDate) { if (currentDate < minDate) {
return; return;
} }
maxDate = _xdsoft_datetime.strToDate(options.maxDate); maxDate = _xdsoft_datetime.strToDate(options.maxDate);
maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()); maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate());
if (currentDate > maxDate) { if (currentDate > maxDate) {
return; return;
} }
input.val(_xdsoft_datetime.str()); input.val(_xdsoft_datetime.str());
input.trigger('change'); input.trigger('change');
datetimepicker.trigger('close.xdsoft'); datetimepicker.trigger('close.xdsoft');
}); });
month_picker month_picker
.find('.xdsoft_prev,.xdsoft_next') .find('.xdsoft_prev,.xdsoft_next')
.on('touchend mousedown.xdsoft', function () { .on('touchend mousedown.xdsoft', function () {
@ -1527,20 +1532,20 @@
} else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) { } else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) {
timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px'); timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px');
} }
/** /**
* Fixed bug: * Fixed bug:
* When using css3 transition, it will cause a bug that you cannot scroll the timepicker list. * When using css3 transition, it will cause a bug that you cannot scroll the timepicker list.
* The reason is that the transition-duration time, if you set it to 0, all things fine, otherwise, this * The reason is that the transition-duration time, if you set it to 0, all things fine, otherwise, this
* would cause a bug when you use jquery.css method. * would cause a bug when you use jquery.css method.
* Let's say: * { transition: all .5s ease; } * Let's say: * { transition: all .5s ease; }
* jquery timebox.css('marginTop') will return the original value which is before you clicking the next/prev button, * jquery timebox.css('marginTop') will return the original value which is before you clicking the next/prev button,
* meanwhile the timebox[0].style.marginTop will return the right value which is after you clicking the * meanwhile the timebox[0].style.marginTop will return the right value which is after you clicking the
* next/prev button. * next/prev button.
* *
* What we should do: * What we should do:
* Replace timebox.css('marginTop') with timebox[0].style.marginTop. * Replace timebox.css('marginTop') with timebox[0].style.marginTop.
*/ */
timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox[0].style.marginTop, 10) / (height - pheight))]); timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox[0].style.marginTop, 10) / (height - pheight))]);
period = (period > 10) ? 10 : period - 10; period = (period > 10) ? 10 : period - 10;
if (!stop) { if (!stop) {
timer = setTimeout(arguments_callee4, v || period); timer = setTimeout(arguments_callee4, v || period);
@ -1582,7 +1587,7 @@
customDateSettings, customDateSettings,
newRow = true, newRow = true,
time = '', time = '',
h = '', h,
line_time, line_time,
description; description;
@ -1689,8 +1694,8 @@
} }
table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '" title="' + description + '">' + table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '" title="' + description + '">' +
'<div>' + d + '</div>' + '<div>' + d + '</div>' +
'</td>'; '</td>';
if (start.getDay() === options.dayOfWeekStartPrev) { if (start.getDay() === options.dayOfWeekStartPrev) {
table += '</tr>'; table += '</tr>';
@ -1769,13 +1774,12 @@
timebox.html(time); timebox.html(time);
opt = ''; opt = '';
i = 0;
for (i = parseInt(options.yearStart, 10) + options.yearOffset; i <= parseInt(options.yearEnd, 10) + options.yearOffset; i += 1) { for (i = parseInt(options.yearStart, 10) + options.yearOffset; i <= parseInt(options.yearEnd, 10) + options.yearOffset; i += 1) {
opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getFullYear() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + i + '</div>'; opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getFullYear() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + i + '</div>';
} }
yearselect.children().eq(0) yearselect.children().eq(0)
.html(opt); .html(opt);
for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) { for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) {
opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[globalLocale].months[i] + '</div>'; opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[globalLocale].months[i] + '</div>';
@ -2011,9 +2015,9 @@
dateInputHasFixedAncestor = false; dateInputHasFixedAncestor = false;
forEachAncestorOf(dateInputElem, function (ancestorNode) { forEachAncestorOf(dateInputElem, function (ancestorNode) {
if (ancestorNode === null) { if (ancestorNode === null) {
return false; return false;
} }
if (options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position') === 'fixed') { if (options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position') === 'fixed') {
dateInputHasFixedAncestor = true; dateInputHasFixedAncestor = true;
@ -2096,8 +2100,8 @@
var onClose = true; var onClose = true;
month_picker month_picker
.find('.xdsoft_month,.xdsoft_year') .find('.xdsoft_month,.xdsoft_year')
.find('.xdsoft_select') .find('.xdsoft_select')
.hide(); .hide();
if (options.onClose && $.isFunction(options.onClose)) { if (options.onClose && $.isFunction(options.onClose)) {
onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event); onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
} }
@ -2151,69 +2155,71 @@
function setMask(options) { function setMask(options) {
var isValidValue = function (mask, value) { var isValidValue = function (mask, value) {
var reg = mask var reg = mask
.replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1') .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1')
.replace(/_/g, '{digit+}') .replace(/_/g, '{digit+}')
.replace(/([0-9]{1})/g, '{digit$1}') .replace(/([0-9]{1})/g, '{digit$1}')
.replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}') .replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}')
.replace(/\{digit[\+]\}/g, '[0-9_]{1}'); .replace(/\{digit[\+]\}/g, '[0-9_]{1}');
return (new RegExp(reg)).test(value); return (new RegExp(reg)).test(value);
}, },
getCaretPos = function (input) { getCaretPos = function (input) {
try { try {
if (options.ownerDocument.selection && options.ownerDocument.selection.createRange) { if (options.ownerDocument.selection && options.ownerDocument.selection.createRange) {
var range = options.ownerDocument.selection.createRange(); var range = options.ownerDocument.selection.createRange();
return range.getBookmark().charCodeAt(2) - 2; return range.getBookmark().charCodeAt(2) - 2;
}
if (input.setSelectionRange) {
return input.selectionStart;
}
} catch (e) {
return 0;
} }
if (input.setSelectionRange) { },
return input.selectionStart; setCaretPos = function (node, pos) {
node = (typeof node === "string" || node instanceof String) ? options.ownerDocument.getElementById(node) : node;
if (!node) {
return false;
}
if (node.createTextRange) {
var textRange = node.createTextRange();
textRange.collapse(true);
textRange.moveEnd('character', pos);
textRange.moveStart('character', pos);
textRange.select();
return true;
}
if (node.setSelectionRange) {
node.setSelectionRange(pos, pos);
return true;
} }
} catch (e) {
return 0;
}
},
setCaretPos = function (node, pos) {
node = (typeof node === "string" || node instanceof String) ? options.ownerDocument.getElementById(node) : node;
if (!node) {
return false; return false;
} };
if (node.createTextRange) {
var textRange = node.createTextRange();
textRange.collapse(true);
textRange.moveEnd('character', pos);
textRange.moveStart('character', pos);
textRange.select();
return true;
}
if (node.setSelectionRange) {
node.setSelectionRange(pos, pos);
return true;
}
return false;
};
if(options.mask) { if(options.mask) {
input.off('keydown.xdsoft'); input.off('keydown.xdsoft');
} }
if (options.mask === true) { if (options.mask === true) {
if (typeof moment != 'undefined') { if (typeof moment != 'undefined') {
options.mask = options.format options.mask = options.format
.replace(/Y{4}/g, '9999') .replace(/Y{4}/g, '9999')
.replace(/Y{2}/g, '99') .replace(/Y{2}/g, '99')
.replace(/M{2}/g, '19') .replace(/M{2}/g, '19')
.replace(/D{2}/g, '39') .replace(/D{2}/g, '39')
.replace(/H{2}/g, '29') .replace(/H{2}/g, '29')
.replace(/m{2}/g, '59') .replace(/m{2}/g, '59')
.replace(/s{2}/g, '59'); .replace(/s{2}/g, '59');
} else { } else {
options.mask = options.format options.mask = options.format
.replace(/Y/g, '9999') .replace(/Y/g, '9999')
.replace(/F/g, '9999') .replace(/F/g, '9999')
.replace(/m/g, '19') .replace(/m/g, '19')
.replace(/d/g, '39') .replace(/d/g, '39')
.replace(/H/g, '29') .replace(/H/g, '29')
.replace(/i/g, '59') .replace(/i/g, '59')
.replace(/s/g, '59'); .replace(/s/g, '59');
} }
} }
if ($.type(options.mask) === 'string') { if ($.type(options.mask) === 'string') {
@ -2242,6 +2248,7 @@
} }
val = val.substr(0, pos) + digit + val.substr(pos + 1); val = val.substr(0, pos) + digit + val.substr(pos + 1);
if ($.trim(val) === '') { if ($.trim(val) === '') {
val = options.mask.replace(/[0-9]/g, '_'); val = options.mask.replace(/[0-9]/g, '_');
} else { } else {
@ -2349,34 +2356,34 @@
if (datetimepicker) { if (datetimepicker) {
if ($.type(opt) === 'string') { if ($.type(opt) === 'string') {
switch (opt) { switch (opt) {
case 'show': case 'show':
$(this).select().focus(); $(this).select().focus();
datetimepicker.trigger('open.xdsoft'); datetimepicker.trigger('open.xdsoft');
break; break;
case 'hide': case 'hide':
datetimepicker.trigger('close.xdsoft'); datetimepicker.trigger('close.xdsoft');
break; break;
case 'toggle': case 'toggle':
datetimepicker.trigger('toggle.xdsoft'); datetimepicker.trigger('toggle.xdsoft');
break; break;
case 'destroy': case 'destroy':
destroyDateTimePicker($(this)); destroyDateTimePicker($(this));
break; break;
case 'reset': case 'reset':
this.value = this.defaultValue; this.value = this.defaultValue;
if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(dateHelper.parseDate(this.value, options.format))) { if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(dateHelper.parseDate(this.value, options.format))) {
datetimepicker.data('changed', false); datetimepicker.data('changed', false);
} }
datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value); datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value);
break; break;
case 'validate': case 'validate':
$input = datetimepicker.data('input'); $input = datetimepicker.data('input');
$input.trigger('blur.xdsoft'); $input.trigger('blur.xdsoft');
break; break;
default: default:
if (datetimepicker[opt] && $.isFunction(datetimepicker[opt])) { if (datetimepicker[opt] && $.isFunction(datetimepicker[opt])) {
result = datetimepicker[opt](opt2); result = datetimepicker[opt](opt2);
} }
} }
} else { } else {
datetimepicker datetimepicker
@ -2404,4 +2411,18 @@
this.desc = desc; this.desc = desc;
this.style = style; this.style = style;
} }
})); };
;(function (factory) {
if ( typeof define === 'function' && define.amd ) {
// AMD. Register as an anonymous module.
define(['jquery', 'jquery-mousewheel'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS style for Browserify
module.exports = factory;
} else {
// Browser globals
factory(jQuery);
}
}(datetimepickerFactory));

File diff suppressed because one or more lines are too long

6
jquery.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "jquery-datetimepicker", "name": "jquery-datetimepicker",
"version": "2.5.4", "version": "2.5.5",
"description": "jQuery Plugin DateTimePicker it is DatePicker and TimePicker in one", "description": "jQuery Plugin DateTimePicker it is DatePicker and TimePicker in one",
"main": "build/jquery.datetimepicker.full.min.js", "main": "build/jquery.datetimepicker.full.min.js",
"scripts": { "scripts": {
@ -9,7 +9,8 @@
"minify": "uglifyjs jquery.datetimepicker.js -c -m -o build/jquery.datetimepicker.min.js && uglifycss jquery.datetimepicker.css > build/jquery.datetimepicker.min.css", "minify": "uglifyjs jquery.datetimepicker.js -c -m -o build/jquery.datetimepicker.min.js && uglifycss jquery.datetimepicker.css > build/jquery.datetimepicker.min.css",
"minifyconcat": "uglifyjs build/jquery.datetimepicker.full.js -c -m -o build/jquery.datetimepicker.full.min.js", "minifyconcat": "uglifyjs build/jquery.datetimepicker.full.js -c -m -o build/jquery.datetimepicker.full.min.js",
"github": "git add --all && git commit -m \"New version %npm_package_version% \" && git tag %npm_package_version% && git push --tags origin HEAD:master && npm publish", "github": "git add --all && git commit -m \"New version %npm_package_version% \" && git tag %npm_package_version% && git push --tags origin HEAD:master && npm publish",
"build": "npm run minify && npm run concat && npm run minifyconcat" "build": "npm run minify && npm run concat && npm run minifyconcat",
"public": "npm version patch --no-git-tag-version && npm run build && npm run github && npm run newversiongit && npm publish ./"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -38,7 +39,7 @@
"devDependencies": { "devDependencies": {
"concat": "azer/concat", "concat": "azer/concat",
"concat-cli": "^4.0.0", "concat-cli": "^4.0.0",
"uglifycss": "0.0.20", "uglifycss": "^0.0.27",
"uglifyjs": "^2.4.10" "uglifyjs": "^2.4.10"
} }
} }

View File

0
tests/input_in_container_fixed_to_top_of_viewport.html Executable file → Normal file
View File

View File

@ -2,10 +2,6 @@
# yarn lockfile v1 # yarn lockfile v1
amdefine@>=0.0.4:
version "1.0.1"
resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5"
ansi-regex@^2.0.0: ansi-regex@^2.0.0:
version "2.1.1" version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
@ -14,10 +10,6 @@ ansi-styles@^2.2.1:
version "2.2.1" version "2.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
async@~0.2.6:
version "0.2.10"
resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1"
camelcase@^2.0.1: camelcase@^2.0.1:
version "2.1.1" version "2.1.1"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f"
@ -44,6 +36,10 @@ code-point-at@^1.0.0:
version "1.1.0" version "1.1.0"
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
commander@^2.9.0:
version "2.11.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563"
concat-cli@^4.0.0: concat-cli@^4.0.0:
version "4.0.0" version "4.0.0"
resolved "https://registry.yarnpkg.com/concat-cli/-/concat-cli-4.0.0.tgz#a73a0fb0d18b25804ebe703bcc35922324dbf74d" resolved "https://registry.yarnpkg.com/concat-cli/-/concat-cli-4.0.0.tgz#a73a0fb0d18b25804ebe703bcc35922324dbf74d"
@ -52,7 +48,13 @@ concat-cli@^4.0.0:
concat "^1.0.0" concat "^1.0.0"
yargs "^3.30.0" yargs "^3.30.0"
concat@^1.0.0, concat@azer/concat: concat@^1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/concat/-/concat-1.0.3.tgz#40f3353089d65467695cb1886b45edd637d8cca8"
dependencies:
commander "^2.9.0"
concat@azer/concat:
version "1.0.0" version "1.0.0"
resolved "https://codeload.github.com/azer/concat/tar.gz/c64c5cbc2e60b0bc1a8f4bceafed661f66f19dcf" resolved "https://codeload.github.com/azer/concat/tar.gz/c64c5cbc2e60b0bc1a8f4bceafed661f66f19dcf"
dependencies: dependencies:
@ -119,12 +121,6 @@ serial-loop@azer/serial-loop:
version "0.0.1" version "0.0.1"
resolved "https://codeload.github.com/azer/serial-loop/tar.gz/99c6271f80f075b7db089a1aadc7178a310a4570" resolved "https://codeload.github.com/azer/serial-loop/tar.gz/99c6271f80f075b7db089a1aadc7178a310a4570"
source-map@0.1.34:
version "0.1.34"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.34.tgz#a7cfe89aec7b1682c3b198d0acfb47d7d090566b"
dependencies:
amdefine ">=0.0.4"
string-width@^1.0.1: string-width@^1.0.1:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3"
@ -143,22 +139,13 @@ supports-color@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
uglify-to-browserify@~1.0.0: uglifycss@^0.0.27:
version "1.0.2" version "0.0.27"
resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" resolved "https://registry.yarnpkg.com/uglifycss/-/uglifycss-0.0.27.tgz#53553b8115de26dce57b42ba0b34e88dd80d0cde"
uglifycss@0.0.20:
version "0.0.20"
resolved "https://registry.yarnpkg.com/uglifycss/-/uglifycss-0.0.20.tgz#0f953c3cf989f9ff7447cba24f9999687c9a5910"
uglifyjs@^2.4.10: uglifyjs@^2.4.10:
version "2.4.10" version "2.4.11"
resolved "https://registry.yarnpkg.com/uglifyjs/-/uglifyjs-2.4.10.tgz#632927319fa6a3da3fc91f9773ac27bfe6c3ee92" resolved "https://registry.yarnpkg.com/uglifyjs/-/uglifyjs-2.4.11.tgz#3440d64e045759589524418eb641c68bb90d113e"
dependencies:
async "~0.2.6"
source-map "0.1.34"
uglify-to-browserify "~1.0.0"
yargs "~1.3.3"
window-size@^0.1.4: window-size@^0.1.4:
version "0.1.4" version "0.1.4"
@ -186,7 +173,3 @@ yargs@^3.30.0:
string-width "^1.0.1" string-width "^1.0.1"
window-size "^0.1.4" window-size "^0.1.4"
y18n "^3.2.0" y18n "^3.2.0"
yargs@~1.3.3:
version "1.3.3"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-1.3.3.tgz#054de8b61f22eefdb7207059eaef9d6b83fb931a"