mirror of
https://github.com/uxsolutions/bootstrap-datepicker.git
synced 2026-02-01 17:27:05 +00:00
Regenerated dist files
This commit is contained in:
parent
ebf7449aa2
commit
1a33a3305d
284
dist/js/bootstrap-datepicker.js
vendored
284
dist/js/bootstrap-datepicker.js
vendored
@ -100,6 +100,15 @@
|
||||
this.component = false;
|
||||
|
||||
this.picker = $(DPGlobal.template);
|
||||
|
||||
// Checking templates and inserting
|
||||
if (this._check_template(this.o.templates.leftArrow)) {
|
||||
this.picker.find('.prev').html(this.o.templates.leftArrow);
|
||||
}
|
||||
if (this._check_template(this.o.templates.rightArrow)) {
|
||||
this.picker.find('.next').html(this.o.templates.rightArrow);
|
||||
}
|
||||
|
||||
this._buildEvents();
|
||||
this._attachEvents();
|
||||
|
||||
@ -165,6 +174,25 @@
|
||||
return default_value === undefined ? false : default_value;
|
||||
},
|
||||
|
||||
_check_template: function(tmp){
|
||||
try {
|
||||
// If empty
|
||||
if (tmp === undefined || tmp === "") {
|
||||
return false;
|
||||
}
|
||||
// If no html, everything ok
|
||||
if ((tmp.match(/[<>]/g) || []).length <= 0) {
|
||||
return true;
|
||||
}
|
||||
// Checking if html is fine
|
||||
var jDom = $(tmp);
|
||||
return jDom.length > 0;
|
||||
}
|
||||
catch (ex) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
_process_options: function(opts){
|
||||
// Store raw options for reference
|
||||
this._o = $.extend({}, this._o, opts);
|
||||
@ -608,6 +636,10 @@
|
||||
}).join(this.o.multidateSeparator);
|
||||
},
|
||||
|
||||
getStartDate: function(){
|
||||
return this.o.startDate;
|
||||
},
|
||||
|
||||
setStartDate: function(startDate){
|
||||
this._process_options({startDate: startDate});
|
||||
this.update();
|
||||
@ -615,6 +647,10 @@
|
||||
return this;
|
||||
},
|
||||
|
||||
getEndDate: function(){
|
||||
return this.o.endDate;
|
||||
},
|
||||
|
||||
setEndDate: function(endDate){
|
||||
this._process_options({endDate: endDate});
|
||||
this.update();
|
||||
@ -945,8 +981,8 @@
|
||||
before;
|
||||
if (isNaN(year) || isNaN(month))
|
||||
return;
|
||||
this.picker.find('.datepicker-days thead .datepicker-switch')
|
||||
.text(DPGlobal.formatDate(new UTCDate(year, month), titleFormat, this.o.language));
|
||||
this.picker.find('.datepicker-days .datepicker-switch')
|
||||
.text(DPGlobal.formatDate(d, titleFormat, this.o.language));
|
||||
this.picker.find('tfoot .today')
|
||||
.text(todaytxt)
|
||||
.toggle(this.o.todayBtn !== false);
|
||||
@ -1133,111 +1169,122 @@
|
||||
click: function(e){
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var target = $(e.target).closest('span, td, th'),
|
||||
year, month, day;
|
||||
if (target.length === 1){
|
||||
switch (target[0].nodeName.toLowerCase()){
|
||||
case 'th':
|
||||
switch (target[0].className){
|
||||
case 'datepicker-switch':
|
||||
this.showMode(1);
|
||||
break;
|
||||
case 'prev':
|
||||
case 'next':
|
||||
var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1);
|
||||
switch (this.viewMode){
|
||||
case 0:
|
||||
this.viewDate = this.moveMonth(this.viewDate, dir);
|
||||
this._trigger('changeMonth', this.viewDate);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
this.viewDate = this.moveYear(this.viewDate, dir);
|
||||
if (this.viewMode === 1)
|
||||
this._trigger('changeYear', this.viewDate);
|
||||
break;
|
||||
}
|
||||
this.fill();
|
||||
break;
|
||||
case 'today':
|
||||
this.showMode(-2);
|
||||
var which = this.o.todayBtn === 'linked' ? null : 'view';
|
||||
this._setDate(UTCToday(), which);
|
||||
break;
|
||||
case 'clear':
|
||||
this.clearDates();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'span':
|
||||
if (!target.hasClass('disabled')){
|
||||
this.viewDate.setUTCDate(1);
|
||||
if (target.hasClass('month')){
|
||||
day = 1;
|
||||
month = target.parent().find('span').index(target);
|
||||
year = this.viewDate.getUTCFullYear();
|
||||
this.viewDate.setUTCMonth(month);
|
||||
this._trigger('changeMonth', this.viewDate);
|
||||
if (this.o.minViewMode === 1){
|
||||
this._setDate(UTCDate(year, month, day));
|
||||
this.showMode();
|
||||
} else {
|
||||
this.showMode(-1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
day = 1;
|
||||
month = 0;
|
||||
year = parseInt(target.text(), 10)||0;
|
||||
this.viewDate.setUTCFullYear(year);
|
||||
|
||||
var trigger = target.hasClass('year') ? 'Year' : (
|
||||
target.hasClass('decade') ? 'Decade' : 'Century'
|
||||
);
|
||||
this._trigger('change' + trigger, this.viewDate);
|
||||
var target, dir, day, year, month;
|
||||
target = $(e.target);
|
||||
|
||||
var shouldSetDate = (this.o.minViewMode === 4 ||
|
||||
(this.o.minViewMode === 2 && target.hasClass('year')) ||
|
||||
(this.o.minViewMode === 3 && target.hasClass('decade'))
|
||||
);
|
||||
if (shouldSetDate){
|
||||
this._setDate(UTCDate(year, month, day));
|
||||
}
|
||||
this.showMode(-1);
|
||||
}
|
||||
this.fill();
|
||||
}
|
||||
break;
|
||||
case 'td':
|
||||
if (target.hasClass('day') && !target.hasClass('disabled')){
|
||||
day = parseInt(target.text(), 10)||1;
|
||||
year = this.viewDate.getUTCFullYear();
|
||||
month = this.viewDate.getUTCMonth();
|
||||
if (target.hasClass('old')){
|
||||
if (month === 0){
|
||||
month = 11;
|
||||
year -= 1;
|
||||
}
|
||||
else {
|
||||
month -= 1;
|
||||
}
|
||||
}
|
||||
else if (target.hasClass('new')){
|
||||
if (month === 11){
|
||||
month = 0;
|
||||
year += 1;
|
||||
}
|
||||
else {
|
||||
month += 1;
|
||||
}
|
||||
}
|
||||
// Clicked on the switch
|
||||
if (target.hasClass('datepicker-switch')){
|
||||
this.showMode(1);
|
||||
}
|
||||
|
||||
// Clicked on prev or next
|
||||
if (target.closest('.prev, .next').length > 0){
|
||||
dir = DPGlobal.modes[this.viewMode].navStep * (target.hasClass('prev') ? -1 : 1);
|
||||
if (this.viewMode === 0){
|
||||
this.viewDate = this.moveMonth(this.viewDate, dir);
|
||||
this._trigger('changeMonth', this.viewDate);
|
||||
} else {
|
||||
this.viewDate = this.moveYear(this.viewDate, dir);
|
||||
if (this.viewMode === 1){
|
||||
this._trigger('changeYear', this.viewDate);
|
||||
}
|
||||
}
|
||||
this.fill();
|
||||
}
|
||||
|
||||
// Clicked on today button
|
||||
if (target.hasClass('today')){
|
||||
this.showMode(-2);
|
||||
this._setDate(UTCToday(), this.o.todayBtn === 'linked' ? null : 'view');
|
||||
}
|
||||
|
||||
// Clicked on clear button
|
||||
if (target.hasClass('clear')){
|
||||
this.clearDates();
|
||||
}
|
||||
|
||||
if (!target.hasClass('disabled')){
|
||||
// Clicked on a day
|
||||
if (target.hasClass('day')){
|
||||
day = parseInt(target.text(), 10) || 1;
|
||||
year = this.viewDate.getUTCFullYear();
|
||||
month = this.viewDate.getUTCMonth();
|
||||
|
||||
// From last month
|
||||
if (target.hasClass('old')){
|
||||
if (month === 0) {
|
||||
month = 11;
|
||||
year = year - 1;
|
||||
} else {
|
||||
month = month - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// From next month
|
||||
if (target.hasClass('new')) {
|
||||
if (month === 11){
|
||||
month = 0;
|
||||
year = year + 1;
|
||||
} else {
|
||||
month = month + 1;
|
||||
}
|
||||
}
|
||||
this._setDate(UTCDate(year, month, day));
|
||||
}
|
||||
|
||||
// Clicked on a month
|
||||
if (target.hasClass('month')) {
|
||||
this.viewDate.setUTCDate(1);
|
||||
day = 1;
|
||||
month = target.parent().find('span').index(target);
|
||||
year = this.viewDate.getUTCFullYear();
|
||||
this.viewDate.setUTCMonth(month);
|
||||
this._trigger('changeMonth', this.viewDate);
|
||||
if (this.o.minViewMode === 1){
|
||||
this._setDate(UTCDate(year, month, day));
|
||||
this.showMode();
|
||||
} else {
|
||||
this.showMode(-1);
|
||||
}
|
||||
this.fill();
|
||||
}
|
||||
|
||||
// Clicked on a year
|
||||
if (target.hasClass('year')
|
||||
|| target.hasClass('decade')
|
||||
|| target.hasClass('century')) {
|
||||
this.viewDate.setUTCDate(1);
|
||||
|
||||
day = 1;
|
||||
month = 0;
|
||||
year = parseInt(target.text(), 10)||0;
|
||||
this.viewDate.setUTCFullYear(year);
|
||||
|
||||
if (target.hasClass('year')){
|
||||
this._trigger('changeYear', this.viewDate);
|
||||
if (this.o.minViewMode === 2){
|
||||
this._setDate(UTCDate(year, month, day));
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (target.hasClass('decade')){
|
||||
this._trigger('changeDecade', this.viewDate);
|
||||
if (this.o.minViewMode === 3){
|
||||
this._setDate(UTCDate(year, month, day));
|
||||
}
|
||||
}
|
||||
if (target.hasClass('century')){
|
||||
this._trigger('changeCentury', this.viewDate);
|
||||
if (this.o.minViewMode === 4){
|
||||
this._setDate(UTCDate(year, month, day));
|
||||
}
|
||||
}
|
||||
|
||||
this.showMode(-1);
|
||||
this.fill();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.picker.is(':visible') && this._focused_from){
|
||||
$(this._focused_from).focus();
|
||||
}
|
||||
@ -1696,7 +1743,11 @@
|
||||
enableOnReadonly: true,
|
||||
container: 'body',
|
||||
immediateUpdates: false,
|
||||
title: ''
|
||||
title: '',
|
||||
templates: {
|
||||
leftArrow: '<span class="glyphicon glyphicon-arrow-left"></span>',
|
||||
rightArrow: '<span class="glyphicon glyphicon-arrow-right"></span>'
|
||||
}
|
||||
};
|
||||
var locale_opts = $.fn.datepicker.locale_opts = [
|
||||
'format',
|
||||
@ -1751,7 +1802,7 @@
|
||||
return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
|
||||
},
|
||||
validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,
|
||||
nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,
|
||||
nonpunctuation: /[^ -\/:-@\u5e74\u6708\u65e5\[-`{-~\t\n\r]+/g,
|
||||
parseFormat: function(format){
|
||||
if (typeof format.toValue === 'function' && typeof format.toDisplay === 'function')
|
||||
return format;
|
||||
@ -1781,6 +1832,11 @@
|
||||
w: 'moveWeek',
|
||||
y: 'moveYear'
|
||||
},
|
||||
dateAliases = {
|
||||
yesterday: '-1d',
|
||||
today: '+0d',
|
||||
tomorrow: '+1d'
|
||||
},
|
||||
part, dir, i, fn;
|
||||
if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)){
|
||||
date = new Date();
|
||||
@ -1792,6 +1848,24 @@
|
||||
}
|
||||
return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
|
||||
}
|
||||
|
||||
if (typeof dateAliases[date] !== 'undefined') {
|
||||
date = dateAliases[date];
|
||||
parts = date.match(/([\-+]\d+)([dmwy])/g);
|
||||
|
||||
if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)){
|
||||
date = new Date();
|
||||
for (i=0; i < parts.length; i++){
|
||||
part = part_re.exec(parts[i]);
|
||||
dir = parseInt(part[1]);
|
||||
fn = fn_map[part[2]];
|
||||
date = Datepicker.prototype[fn](date, dir);
|
||||
}
|
||||
|
||||
return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
|
||||
}
|
||||
}
|
||||
|
||||
parts = date && date.match(this.nonpunctuation) || [];
|
||||
date = new Date();
|
||||
|
||||
@ -1917,9 +1991,9 @@
|
||||
'<th colspan="7" class="datepicker-title"></th>'+
|
||||
'</tr>'+
|
||||
'<tr>'+
|
||||
'<th class="prev">«</th>'+
|
||||
'<th class="prev"><span class="glyphicon glyphicon-arrow-left"></span></th>'+
|
||||
'<th colspan="5" class="datepicker-switch"></th>'+
|
||||
'<th class="next">»</th>'+
|
||||
'<th class="next"><span class="glyphicon glyphicon-arrow-right"></span></th>'+
|
||||
'</tr>'+
|
||||
'</thead>',
|
||||
contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
|
||||
|
||||
4
dist/js/bootstrap-datepicker.min.js
vendored
4
dist/js/bootstrap-datepicker.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user