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",
|
||||
"datetimepicker"
|
||||
],
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"author": {
|
||||
"name": "Chupurnov Valeriy",
|
||||
"url": "http://xdsoft.net/contacts.html"
|
||||
|
14
doc.tpl
14
doc.tpl
@ -228,7 +228,7 @@ $('#_datetimepicker7').datetimepicker({
|
||||
<script>$(function(){
|
||||
$('#_datetimepicker_mask').datetimepicker({
|
||||
timepicker:false,
|
||||
mask:'9999/19/39'
|
||||
mask:'9999/19/39',
|
||||
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> default</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>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -365,12 +365,10 @@ $('#_datetimepicker_mask').datetimepicker({
|
||||
<td>mask</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><pre><code data-language="javascript">
|
||||
{mask:'9999/19/39',format:'Y/m/d'}
|
||||
{mask:true,format:'Y/m/d'} // automatically generate a mask 9999/99/99
|
||||
{mask:'29:59',format:'H:i'} //
|
||||
{mask:true,format:'H:i'} //automatically generate a mask 99:99
|
||||
</code></pre></td>
|
||||
<td><pre>{mask:'9999/19/39',format:'Y/m/d'}
|
||||
{mask:true,format:'Y/m/d'} // automatically generate a mask 9999/99/99
|
||||
{mask:'29:59',format:'H:i'} //
|
||||
{mask:true,format:'H:i'} //automatically generate a mask 99:99</pre></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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/
|
||||
* (c) 2013, Chupurnov Valeriy.
|
||||
*/
|
||||
@ -91,7 +91,8 @@
|
||||
scrollMonth:true,
|
||||
scrollTime:true,
|
||||
scrollInput:true,
|
||||
mask:false
|
||||
mask:false,
|
||||
validateOnBlur:true
|
||||
};
|
||||
var options = ($.isPlainObject(opt)||!opt)?$.extend({},default_options,opt):$.extend({},default_options);
|
||||
var createDateTimePicker = function( input ){
|
||||
@ -227,10 +228,11 @@
|
||||
case (([AKEY,CKEY,VKEY,ZKEY,YKEY].indexOf(key)!==-1)&&(ctrlDown)):
|
||||
case [ESC,ARROWUP,ARROWDOWN,ARROWLEFT,ARROWRIGHT,F5,CTRLKEY].indexOf(key)!==-1:
|
||||
return true;
|
||||
case [ENTER,TAB].indexOf(options.mask,key)!==-1:
|
||||
case [ENTER].indexOf(key)!==-1:
|
||||
var elementSelector = "input:visible,textarea:visible";
|
||||
$(elementSelector ).eq($(elementSelector ).index(this) + 1).focus();
|
||||
return false;
|
||||
case [TAB].indexOf(key)!==-1:return true;
|
||||
}
|
||||
event.preventDefault();
|
||||
return false;
|
||||
@ -238,6 +240,13 @@
|
||||
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;
|
||||
};
|
||||
datetimepicker.data('options',options);
|
||||
@ -281,7 +290,7 @@
|
||||
percent = offset/(height-pheight);
|
||||
scroller.css('margin-top',sbh*percent);
|
||||
})
|
||||
.on('open.xdsoft',function( event ){
|
||||
.on('afterOpen.xdsoft',function( event ){
|
||||
if( !options.timepickerScrollbar )
|
||||
return;
|
||||
var pheight = timeboxparent[0].offsetHeight-2;
|
||||
@ -412,6 +421,8 @@
|
||||
$([document.body,window]).off('mouseup.xdsoft',arguments.callee);
|
||||
});
|
||||
});
|
||||
|
||||
// generating a calendar and timepicker
|
||||
datetimepicker.on('change.xdsoft',function(){
|
||||
var xd = $(this).data('xdsoft_datetime'),
|
||||
table = '';
|
||||
@ -482,14 +493,15 @@
|
||||
timebox.html(time);
|
||||
//timebox.find('.xdsoft_current').length&&timebox.css('marginTop','-'+parseInt(timebox.find('.xdsoft_current').index()*options.timeHeightInTimePicker)+'px');
|
||||
});
|
||||
datetimepicker.on('open.xdsoft',function(){
|
||||
if( timebox.find('.xdsoft_current').length ){
|
||||
datetimepicker.on('afterOpen.xdsoft',function(){
|
||||
if( options.timepicker && timebox.find('.xdsoft_current').length ){
|
||||
var pheight = timeboxparent[0].offsetHeight-2,
|
||||
height = timebox[0].offsetHeight,
|
||||
top = timebox.find('.xdsoft_current').index()*options.timeHeightInTimePicker+1;
|
||||
if( (height-pheight)<top )
|
||||
top = height-pheight;
|
||||
timebox.css('marginTop','-'+parseInt(top)+'px');
|
||||
datetimepicker.trigger('scroll.timebox',[parseInt(top)]);
|
||||
}
|
||||
});
|
||||
calendar.on('mousedown.xdsoft','td',function(){
|
||||
@ -580,6 +592,7 @@
|
||||
});
|
||||
};
|
||||
datetimepicker.show();
|
||||
datetimepicker.trigger('afterOpen.xdsoft');
|
||||
setPos();
|
||||
$(window).on('resize.xdsoft',setPos);
|
||||
|
||||
@ -631,7 +644,7 @@
|
||||
datetimepicker.remove();
|
||||
delete datetimepicker;
|
||||
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,document.body]).off('mousedown.xdsoft');
|
||||
input.unmousewheel&&input.unmousewheel();
|
||||
|
Loading…
Reference in New Issue
Block a user