mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
New version 1.1.1
Fixed bug shift+tab keypress
This commit is contained in:
parent
8528af4b96
commit
5a2b509d51
@ -11,7 +11,7 @@
|
|||||||
"timepicker",
|
"timepicker",
|
||||||
"datetimepicker"
|
"datetimepicker"
|
||||||
],
|
],
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Chupurnov Valeriy",
|
"name": "Chupurnov Valeriy",
|
||||||
"url": "http://xdsoft.net/contacts.html"
|
"url": "http://xdsoft.net/contacts.html"
|
||||||
|
14
doc.tpl
14
doc.tpl
@ -228,7 +228,7 @@ $('#_datetimepicker7').datetimepicker({
|
|||||||
<script>$(function(){
|
<script>$(function(){
|
||||||
$('#_datetimepicker_mask').datetimepicker({
|
$('#_datetimepicker_mask').datetimepicker({
|
||||||
timepicker:false,
|
timepicker:false,
|
||||||
mask:'9999/19/39'
|
mask:'9999/19/39',
|
||||||
format:'Y/m/d'
|
format:'Y/m/d'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -240,7 +240,7 @@ $('#_datetimepicker_mask').datetimepicker({
|
|||||||
<th style="text-align: center;"><strong>Name</strong></th>
|
<th style="text-align: center;"><strong>Name</strong></th>
|
||||||
<th style="text-align: center;"><strong> default</strong></th>
|
<th style="text-align: center;"><strong> default</strong></th>
|
||||||
<th style="text-align: center;"><strong>Descr</strong></th>
|
<th style="text-align: center;"><strong>Descr</strong></th>
|
||||||
<th style="text-align: center;"><strong>Ex.</strong></th>
|
<th style="width:200px;text-align: center;"><strong>Ex.</strong></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -365,12 +365,10 @@ $('#_datetimepicker_mask').datetimepicker({
|
|||||||
<td>mask</td>
|
<td>mask</td>
|
||||||
<td>false</td>
|
<td>false</td>
|
||||||
<td>Use mask for input. true - automatically generates a mask on the field 'format', Digit from 0 to 9, set the highest possible digit for the value. For example: the first digit of hours can not be greater than 2, and the first digit of the minutes can not be greater than 5</td>
|
<td>Use mask for input. true - automatically generates a mask on the field 'format', Digit from 0 to 9, set the highest possible digit for the value. For example: the first digit of hours can not be greater than 2, and the first digit of the minutes can not be greater than 5</td>
|
||||||
<td><pre><code data-language="javascript">
|
<td><pre>{mask:'9999/19/39',format:'Y/m/d'}
|
||||||
{mask:'9999/19/39',format:'Y/m/d'}
|
{mask:true,format:'Y/m/d'} // automatically generate a mask 9999/99/99
|
||||||
{mask:true,format:'Y/m/d'} // automatically generate a mask 9999/99/99
|
{mask:'29:59',format:'H:i'} //
|
||||||
{mask:'29:59',format:'H:i'} //
|
{mask:true,format:'H:i'} //automatically generate a mask 99:99</pre></td>
|
||||||
{mask:true,format:'H:i'} //automatically generate a mask 99:99
|
|
||||||
</code></pre></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>opened</td>
|
<td>opened</td>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @preserve jQuery DateTimePicker plugin v1.1.0
|
* @preserve jQuery DateTimePicker plugin v1.1.1
|
||||||
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
|
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
|
||||||
* (c) 2013, Chupurnov Valeriy.
|
* (c) 2013, Chupurnov Valeriy.
|
||||||
*/
|
*/
|
||||||
@ -91,7 +91,8 @@
|
|||||||
scrollMonth:true,
|
scrollMonth:true,
|
||||||
scrollTime:true,
|
scrollTime:true,
|
||||||
scrollInput:true,
|
scrollInput:true,
|
||||||
mask:false
|
mask:false,
|
||||||
|
validateOnBlur:true
|
||||||
};
|
};
|
||||||
var options = ($.isPlainObject(opt)||!opt)?$.extend({},default_options,opt):$.extend({},default_options);
|
var options = ($.isPlainObject(opt)||!opt)?$.extend({},default_options,opt):$.extend({},default_options);
|
||||||
var createDateTimePicker = function( input ){
|
var createDateTimePicker = function( input ){
|
||||||
@ -227,10 +228,11 @@
|
|||||||
case (([AKEY,CKEY,VKEY,ZKEY,YKEY].indexOf(key)!==-1)&&(ctrlDown)):
|
case (([AKEY,CKEY,VKEY,ZKEY,YKEY].indexOf(key)!==-1)&&(ctrlDown)):
|
||||||
case [ESC,ARROWUP,ARROWDOWN,ARROWLEFT,ARROWRIGHT,F5,CTRLKEY].indexOf(key)!==-1:
|
case [ESC,ARROWUP,ARROWDOWN,ARROWLEFT,ARROWRIGHT,F5,CTRLKEY].indexOf(key)!==-1:
|
||||||
return true;
|
return true;
|
||||||
case [ENTER,TAB].indexOf(options.mask,key)!==-1:
|
case [ENTER].indexOf(key)!==-1:
|
||||||
var elementSelector = "input:visible,textarea:visible";
|
var elementSelector = "input:visible,textarea:visible";
|
||||||
$(elementSelector ).eq($(elementSelector ).index(this) + 1).focus();
|
$(elementSelector ).eq($(elementSelector ).index(this) + 1).focus();
|
||||||
return false;
|
return false;
|
||||||
|
case [TAB].indexOf(key)!==-1:return true;
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
@ -238,6 +240,13 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if( options.validateOnBlur ){
|
||||||
|
input.off('blur.xdsoft')
|
||||||
|
.on('blur.xdsoft',function(){
|
||||||
|
if( !Date.parseDate( $(this).val(), options.format ) )
|
||||||
|
$(this).val((new Date()).dateFormat( options.format ));
|
||||||
|
});
|
||||||
|
}
|
||||||
options.dayOfWeekStartPrev = (options.dayOfWeekStart==0)?6:options.dayOfWeekStart-1;
|
options.dayOfWeekStartPrev = (options.dayOfWeekStart==0)?6:options.dayOfWeekStart-1;
|
||||||
};
|
};
|
||||||
datetimepicker.data('options',options);
|
datetimepicker.data('options',options);
|
||||||
@ -281,7 +290,7 @@
|
|||||||
percent = offset/(height-pheight);
|
percent = offset/(height-pheight);
|
||||||
scroller.css('margin-top',sbh*percent);
|
scroller.css('margin-top',sbh*percent);
|
||||||
})
|
})
|
||||||
.on('open.xdsoft',function( event ){
|
.on('afterOpen.xdsoft',function( event ){
|
||||||
if( !options.timepickerScrollbar )
|
if( !options.timepickerScrollbar )
|
||||||
return;
|
return;
|
||||||
var pheight = timeboxparent[0].offsetHeight-2;
|
var pheight = timeboxparent[0].offsetHeight-2;
|
||||||
@ -412,6 +421,8 @@
|
|||||||
$([document.body,window]).off('mouseup.xdsoft',arguments.callee);
|
$([document.body,window]).off('mouseup.xdsoft',arguments.callee);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// generating a calendar and timepicker
|
||||||
datetimepicker.on('change.xdsoft',function(){
|
datetimepicker.on('change.xdsoft',function(){
|
||||||
var xd = $(this).data('xdsoft_datetime'),
|
var xd = $(this).data('xdsoft_datetime'),
|
||||||
table = '';
|
table = '';
|
||||||
@ -482,14 +493,15 @@
|
|||||||
timebox.html(time);
|
timebox.html(time);
|
||||||
//timebox.find('.xdsoft_current').length&&timebox.css('marginTop','-'+parseInt(timebox.find('.xdsoft_current').index()*options.timeHeightInTimePicker)+'px');
|
//timebox.find('.xdsoft_current').length&&timebox.css('marginTop','-'+parseInt(timebox.find('.xdsoft_current').index()*options.timeHeightInTimePicker)+'px');
|
||||||
});
|
});
|
||||||
datetimepicker.on('open.xdsoft',function(){
|
datetimepicker.on('afterOpen.xdsoft',function(){
|
||||||
if( timebox.find('.xdsoft_current').length ){
|
if( options.timepicker && timebox.find('.xdsoft_current').length ){
|
||||||
var pheight = timeboxparent[0].offsetHeight-2,
|
var pheight = timeboxparent[0].offsetHeight-2,
|
||||||
height = timebox[0].offsetHeight,
|
height = timebox[0].offsetHeight,
|
||||||
top = timebox.find('.xdsoft_current').index()*options.timeHeightInTimePicker+1;
|
top = timebox.find('.xdsoft_current').index()*options.timeHeightInTimePicker+1;
|
||||||
if( (height-pheight)<top )
|
if( (height-pheight)<top )
|
||||||
top = height-pheight;
|
top = height-pheight;
|
||||||
timebox.css('marginTop','-'+parseInt(top)+'px');
|
timebox.css('marginTop','-'+parseInt(top)+'px');
|
||||||
|
datetimepicker.trigger('scroll.timebox',[parseInt(top)]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
calendar.on('mousedown.xdsoft','td',function(){
|
calendar.on('mousedown.xdsoft','td',function(){
|
||||||
@ -580,6 +592,7 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
datetimepicker.show();
|
datetimepicker.show();
|
||||||
|
datetimepicker.trigger('afterOpen.xdsoft');
|
||||||
setPos();
|
setPos();
|
||||||
$(window).on('resize.xdsoft',setPos);
|
$(window).on('resize.xdsoft',setPos);
|
||||||
|
|
||||||
@ -631,7 +644,7 @@
|
|||||||
datetimepicker.remove();
|
datetimepicker.remove();
|
||||||
delete datetimepicker;
|
delete datetimepicker;
|
||||||
input.data( 'xdsoft_datetimepicker',null );
|
input.data( 'xdsoft_datetimepicker',null );
|
||||||
input.off( 'open.xdsoft focusin.xdsoft focusout.xdsoft mousedown.xdsoft' );
|
input.off( 'open.xdsoft focusin.xdsoft focusout.xdsoft mousedown.xdsoft blur.xdsoft' );
|
||||||
$(window).off('resize.xdsoft');
|
$(window).off('resize.xdsoft');
|
||||||
$([window,document.body]).off('mousedown.xdsoft');
|
$([window,document.body]).off('mousedown.xdsoft');
|
||||||
input.unmousewheel&&input.unmousewheel();
|
input.unmousewheel&&input.unmousewheel();
|
||||||
|
Loading…
Reference in New Issue
Block a user