webshims-rails 1.10.10 → 1.10.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/MIT_LICENSE.txt +3 -1
- data/lib/webshims-rails/version.rb +2 -2
- data/vendor/assets/javascripts/webshims/polyfiller.js +8 -9
- data/vendor/assets/javascripts/webshims/shims/combos/1.js +91 -58
- data/vendor/assets/javascripts/webshims/shims/combos/10.js +247 -101
- data/vendor/assets/javascripts/webshims/shims/combos/11.js +241 -96
- data/vendor/assets/javascripts/webshims/shims/combos/12.js +79 -58
- data/vendor/assets/javascripts/webshims/shims/combos/13.js +79 -12
- data/vendor/assets/javascripts/webshims/shims/combos/14.js +6 -5
- data/vendor/assets/javascripts/webshims/shims/combos/15.js +68 -75
- data/vendor/assets/javascripts/webshims/shims/combos/16.js +147 -133
- data/vendor/assets/javascripts/webshims/shims/combos/17.js +288 -143
- data/vendor/assets/javascripts/webshims/shims/combos/18.js +288 -143
- data/vendor/assets/javascripts/webshims/shims/combos/19.js +85 -63
- data/vendor/assets/javascripts/webshims/shims/combos/2.js +97 -91
- data/vendor/assets/javascripts/webshims/shims/combos/20.js +85 -17
- data/vendor/assets/javascripts/webshims/shims/combos/21.js +17 -17
- data/vendor/assets/javascripts/webshims/shims/combos/23.js +79 -58
- data/vendor/assets/javascripts/webshims/shims/combos/24.js +17 -16
- data/vendor/assets/javascripts/webshims/shims/combos/25.js +85 -63
- data/vendor/assets/javascripts/webshims/shims/combos/26.js +6 -5
- data/vendor/assets/javascripts/webshims/shims/combos/27.js +0 -46
- data/vendor/assets/javascripts/webshims/shims/combos/28.js +6 -5
- data/vendor/assets/javascripts/webshims/shims/combos/29.js +13 -6
- data/vendor/assets/javascripts/webshims/shims/combos/3.js +47 -31
- data/vendor/assets/javascripts/webshims/shims/combos/30.js +47 -59
- data/vendor/assets/javascripts/webshims/shims/combos/31.js +18 -33
- data/vendor/assets/javascripts/webshims/shims/combos/4.js +35 -31
- data/vendor/assets/javascripts/webshims/shims/combos/5.js +304 -157
- data/vendor/assets/javascripts/webshims/shims/combos/6.js +304 -185
- data/vendor/assets/javascripts/webshims/shims/combos/7.js +126 -117
- data/vendor/assets/javascripts/webshims/shims/combos/8.js +126 -89
- data/vendor/assets/javascripts/webshims/shims/combos/9.js +247 -129
- data/vendor/assets/javascripts/webshims/shims/dom-extend.js +6 -5
- data/vendor/assets/javascripts/webshims/shims/form-core.js +12 -0
- data/vendor/assets/javascripts/webshims/shims/form-datalist-lazy.js +3 -0
- data/vendor/assets/javascripts/webshims/shims/form-datalist.js +0 -28
- data/vendor/assets/javascripts/webshims/shims/form-message.js +29 -26
- data/vendor/assets/javascripts/webshims/shims/form-native-extend.js +16 -14
- data/vendor/assets/javascripts/webshims/shims/form-number-date-api.js +47 -47
- data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +241 -96
- data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +21 -16
- data/vendor/assets/javascripts/webshims/shims/form-validation.js +17 -16
- data/vendor/assets/javascripts/webshims/shims/forms-picker.js +173 -41
- data/vendor/assets/javascripts/webshims/shims/geolocation.js +17 -17
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ar.js +35 -33
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ch-ZN.js +32 -30
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-de.txt +17 -13
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-el.js +32 -30
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-en.txt +4 -1
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-es.js +30 -28
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-fr.js +35 -32
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-he.js +32 -30
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-hi.js +32 -30
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-hu.js +32 -30
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-it.js +32 -30
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ja.js +32 -30
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-lt.js +37 -36
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-nl.js +32 -30
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-pl.js +5 -2
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-pt-PT.js +33 -30
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ru.js +3 -1
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-sv.js +32 -30
- data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +79 -12
- data/vendor/assets/javascripts/webshims/shims/styles/forms.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +126 -121
- data/vendor/assets/javascripts/webshims/shims/styles/shim.css +100 -111
- data/vendor/assets/javascripts/webshims/shims/swfmini.js +0 -46
- data/vendor/assets/javascripts/webshims/shims/track-ui.js +13 -6
- data/webshims-rails.gemspec +1 -0
- metadata +4 -3
@@ -498,10 +498,21 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
498
498
|
"use strict";
|
499
499
|
var curCfg;
|
500
500
|
var formcfg = webshims.formcfg;
|
501
|
-
|
501
|
+
var monthDigits = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
|
502
502
|
var stopPropagation = function(e){
|
503
503
|
e.stopImmediatePropagation();
|
504
504
|
};
|
505
|
+
var getMonthOptions = (function(){
|
506
|
+
var str;
|
507
|
+
return function(){
|
508
|
+
if(!str){
|
509
|
+
str = ('<option></option>')+$.map(monthDigits, function(val){
|
510
|
+
return '<option>'+val+'</option>';
|
511
|
+
}).join('');
|
512
|
+
}
|
513
|
+
return str;
|
514
|
+
};
|
515
|
+
})();
|
505
516
|
var createFormat = function(name){
|
506
517
|
if(!curCfg.patterns[name+'Obj']){
|
507
518
|
var obj = {};
|
@@ -513,10 +524,18 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
513
524
|
};
|
514
525
|
var splitInputs = {
|
515
526
|
date: {
|
516
|
-
_create: function(){
|
527
|
+
_create: function(opts){
|
517
528
|
var obj = {
|
518
|
-
splits: [$('<input type="text" class="yy" size="4" inputmode="numeric" />')[0]
|
529
|
+
splits: [$('<input type="text" class="yy" size="4" inputmode="numeric" />')[0]]
|
519
530
|
};
|
531
|
+
if(opts.monthSelect){
|
532
|
+
obj.splits.push($('<select class="mm">'+getMonthOptions()+'</select>')[0]);
|
533
|
+
} else {
|
534
|
+
obj.splits.push($('<input type="text" class="mm" inputmode="numeric" maxlength="2" size="2" />')[0]);
|
535
|
+
}
|
536
|
+
obj.splits.push($('<input type="text" class="dd ws-spin" inputmode="numeric" maxlength="2" size="2" />')[0]);
|
537
|
+
|
538
|
+
|
520
539
|
obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1], $('<span class="ws-input-seperator" />')[0], obj.splits[2]];
|
521
540
|
return obj;
|
522
541
|
},
|
@@ -524,7 +543,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
524
543
|
createFormat('d');
|
525
544
|
var i = 0;
|
526
545
|
var seperators = $('.ws-input-seperator', element).html(curCfg.dFormat);
|
527
|
-
var inputs = $('input', element);
|
546
|
+
var inputs = $('input, select', element);
|
528
547
|
$.each(curCfg.patterns.dObj, function(name, value){
|
529
548
|
var input = inputs.filter('.'+ name);
|
530
549
|
if(input[0]){
|
@@ -542,17 +561,23 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
542
561
|
_create: function(opts){
|
543
562
|
|
544
563
|
var obj = {
|
545
|
-
splits: [$('<input type="text" class="yy" inputmode="numeric" size="4" />')[0]
|
564
|
+
splits: [$('<input type="text" class="yy" inputmode="numeric" size="4" />')[0]]
|
546
565
|
};
|
547
|
-
if(opts.
|
548
|
-
|
566
|
+
if(opts.monthSelect){
|
567
|
+
obj.splits.push($('<select class="mm ws-spin">'+getMonthOptions()+'</select>')[0]);
|
568
|
+
} else {
|
569
|
+
obj.splits.push($('<input type="text" class="mm ws-spin" />')[0]);
|
570
|
+
if(opts.onlyMonthDigits){
|
571
|
+
$(obj.splits[1]).attr({inputmode: 'numeric', size: 2, maxlength: 2});
|
572
|
+
}
|
549
573
|
}
|
574
|
+
|
550
575
|
obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1]];
|
551
576
|
return obj;
|
552
577
|
},
|
553
578
|
sort: function(element){
|
554
579
|
var seperator = $('.ws-input-seperator', element).html(curCfg.dFormat);
|
555
|
-
var mm = $('input.mm', element);
|
580
|
+
var mm = $('input.mm, select.mm', element);
|
556
581
|
var action;
|
557
582
|
if(curCfg.date.showMonthAfterYear){
|
558
583
|
mm.appendTo(element);
|
@@ -566,7 +591,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
566
591
|
}
|
567
592
|
};
|
568
593
|
|
569
|
-
var nowDate = new Date().getTime() - (new Date().getTimezoneOffset() * 60 * 1000 );
|
594
|
+
var nowDate = new Date(new Date().getTime() - (new Date().getTimezoneOffset() * 60 * 1000 ));
|
595
|
+
nowDate = new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate(), nowDate.getHours()).getTime()
|
570
596
|
var steps = {
|
571
597
|
number: {
|
572
598
|
step: 1
|
@@ -575,6 +601,10 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
575
601
|
// step: 1,
|
576
602
|
// start: new Date(nowDate)
|
577
603
|
// },
|
604
|
+
'datetime-local': {
|
605
|
+
step: 60,
|
606
|
+
start: new Date(nowDate).getTime()
|
607
|
+
},
|
578
608
|
time: {
|
579
609
|
step: 60
|
580
610
|
},
|
@@ -610,7 +640,6 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
610
640
|
|
611
641
|
|
612
642
|
(function(){
|
613
|
-
var monthDigits = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
|
614
643
|
|
615
644
|
formcfg.de = $.extend(true, {
|
616
645
|
numberFormat: {
|
@@ -660,6 +689,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
660
689
|
patterns: {
|
661
690
|
d: "mm/dd/yy"
|
662
691
|
},
|
692
|
+
meridian: ['AM', 'PM'],
|
663
693
|
month: {
|
664
694
|
currentText: 'This month'
|
665
695
|
},
|
@@ -713,12 +743,18 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
713
743
|
langCfg.date.monthkeys = {};
|
714
744
|
langCfg.date.monthDigits = monthDigits;
|
715
745
|
langCfg.numberSigns += '-';
|
746
|
+
if(langCfg.meridian){
|
747
|
+
langCfg.timeSigns += langCfg.meridian[0] + langCfg.meridian[1];
|
748
|
+
}
|
716
749
|
$.each(langCfg.date.monthNames, create);
|
717
750
|
$.each(langCfg.date.monthNamesShort, create);
|
718
751
|
}
|
719
752
|
if(!langCfg.colorSigns){
|
720
753
|
langCfg.colorSigns = '#abcdefABCDEF';
|
721
754
|
}
|
755
|
+
if(!langCfg['datetime-localSigns']){
|
756
|
+
langCfg['datetime-localSigns'] = langCfg.dateSigns+langCfg.timeSigns;
|
757
|
+
}
|
722
758
|
};
|
723
759
|
var triggerLocaleChange = function(){
|
724
760
|
processLangCFG(curCfg);
|
@@ -775,11 +811,31 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
775
811
|
return (val+'').replace(/\,/g, '').replace(/\./, curCfg.numberFormat['.']);
|
776
812
|
},
|
777
813
|
time: function(val){
|
814
|
+
var fVal;
|
815
|
+
if(val && curCfg.meridian){
|
816
|
+
val = val.split(':');
|
817
|
+
fVal = (val[0] * 1);
|
818
|
+
if(fVal && fVal >= 12){
|
819
|
+
val[0] = addZero(fVal - 12+'');
|
820
|
+
fVal = 1;
|
821
|
+
|
822
|
+
} else {
|
823
|
+
fVal = 0;
|
824
|
+
}
|
825
|
+
val = $.trim(val.join(':')) + ' '+ curCfg.meridian[fVal];
|
826
|
+
}
|
778
827
|
return val;
|
779
828
|
},
|
780
|
-
|
829
|
+
'datetime-local': function(val, o){
|
830
|
+
var fVal = $.trim(val || '').split('T');
|
831
|
+
if(fVal.length == 2){
|
832
|
+
val = this.date(fVal[0], o) +' '+this.time(fVal[1], o);
|
833
|
+
}
|
781
834
|
return val;
|
782
835
|
},
|
836
|
+
// week: function(val){
|
837
|
+
// return val;
|
838
|
+
// },
|
783
839
|
//todo empty val for month/split
|
784
840
|
month: function(val, options){
|
785
841
|
var names;
|
@@ -832,7 +888,32 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
832
888
|
// week: function(val){
|
833
889
|
// return val;
|
834
890
|
// },
|
891
|
+
'datetime-local': function(val, o){
|
892
|
+
var tmp;
|
893
|
+
var fVal = $.trim(val || '').split(/\s+/);
|
894
|
+
if(fVal.length == 2){
|
895
|
+
if(fVal[0].indexOf(':') != -1 && fVal[1].indexOf(':') == -1){
|
896
|
+
tmp = fVal[1];
|
897
|
+
fVal[1] = fVal[0];
|
898
|
+
fVal[0] = tmp;
|
899
|
+
}
|
900
|
+
val = this.date(fVal[0], o) +'T'+ this.time(fVal[1], o);
|
901
|
+
}
|
902
|
+
return val;
|
903
|
+
},
|
835
904
|
time: function(val){
|
905
|
+
var fVal;
|
906
|
+
if(val && curCfg.meridian){
|
907
|
+
if(val.indexOf(curCfg.meridian[1]) != -1){
|
908
|
+
val = val.split(':');
|
909
|
+
fVal = (val[0] * 1);
|
910
|
+
if(!isNaN(fVal)){
|
911
|
+
val[0] = fVal + 12;
|
912
|
+
}
|
913
|
+
val = val.join(':');
|
914
|
+
}
|
915
|
+
val = $.trim(val.replace(curCfg.meridian[0], '').replace(curCfg.meridian[1], ''));
|
916
|
+
}
|
836
917
|
return val;
|
837
918
|
},
|
838
919
|
month: function(val, opts, noCorrect){
|
@@ -933,8 +1014,16 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
933
1014
|
var type = (typeof val == 'object') ? 'valueAsDate' : 'valueAsNumber';
|
934
1015
|
return input.prop(type, val).prop('value');
|
935
1016
|
},
|
936
|
-
isValid: function(val){
|
937
|
-
|
1017
|
+
isValid: function(val, attrs){
|
1018
|
+
if(attrs && (attrs.nodeName || attrs.jquery)){
|
1019
|
+
attrs = {
|
1020
|
+
min: $(attrs).prop('min') || '',
|
1021
|
+
max: $(attrs).prop('max') || '',
|
1022
|
+
step: $(attrs).prop('step') || 'any'
|
1023
|
+
};
|
1024
|
+
}
|
1025
|
+
attrs = $.extend({step: 'any', min: '', max: ''}, attrs || {});
|
1026
|
+
return input.attr(attrs).prop('value', val).is(':valid') && input.prop('value') == val;
|
938
1027
|
}
|
939
1028
|
};
|
940
1029
|
}
|
@@ -959,6 +1048,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
959
1048
|
o.mirrorValidity = o.mirrorValidity && this.orig && Modernizr.formvalidation && !webshims.bugs.bustedValidity;
|
960
1049
|
|
961
1050
|
if(o.splitInput && this._addSplitInputs){
|
1051
|
+
if(o.monthSelect){
|
1052
|
+
this.element.addClass('ws-month-select');
|
1053
|
+
}
|
962
1054
|
this._addSplitInputs();
|
963
1055
|
} else {
|
964
1056
|
this.inputElements = this.element;
|
@@ -1210,7 +1302,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1210
1302
|
try {
|
1211
1303
|
$(this)
|
1212
1304
|
.next()
|
1213
|
-
.next('input')
|
1305
|
+
.next('input, select')
|
1214
1306
|
.each(select)
|
1215
1307
|
;
|
1216
1308
|
} catch(er){}
|
@@ -1288,7 +1380,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1288
1380
|
}
|
1289
1381
|
};
|
1290
1382
|
spinEvents.keydown = function(e){
|
1291
|
-
if(o.list || e.isDefaultPrevented() || $.attr(this, 'list')){return;}
|
1383
|
+
if(o.list || e.isDefaultPrevented() || (e.altKey && e.keyCode == 40) || $.attr(this, 'list')){return;}
|
1292
1384
|
var stepped = true;
|
1293
1385
|
var code = e.keyCode;
|
1294
1386
|
if (code == 38) {
|
@@ -1411,7 +1503,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1411
1503
|
return [options, datalist.data('label')];
|
1412
1504
|
},
|
1413
1505
|
list: function(val){
|
1414
|
-
if(this.type == 'number'
|
1506
|
+
if(this.type == 'number'){
|
1415
1507
|
this.element.attr('list', $.attr(this.orig, 'list'));
|
1416
1508
|
}
|
1417
1509
|
this.options.list = val;
|
@@ -1494,7 +1586,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1494
1586
|
if(!this.inputElements){
|
1495
1587
|
var create = splitInputs[this.type]._create(this.options);
|
1496
1588
|
this.splits = create.splits;
|
1497
|
-
this.inputElements = $(create.elements).prependTo(this.element).filter('input');
|
1589
|
+
this.inputElements = $(create.elements).prependTo(this.element).filter('input, select');
|
1498
1590
|
}
|
1499
1591
|
},
|
1500
1592
|
|
@@ -1520,11 +1612,11 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1520
1612
|
reorderInputs: function(){
|
1521
1613
|
if(splitInputs[this.type]){
|
1522
1614
|
var element = this.element;
|
1523
|
-
splitInputs[this.type].sort(element);
|
1615
|
+
splitInputs[this.type].sort(element, this.options);
|
1524
1616
|
setTimeout(function(){
|
1525
1617
|
var data = webshims.data(element);
|
1526
1618
|
if(data && data.shadowData){
|
1527
|
-
data.shadowData.shadowFocusElement = element.find('input')[0] || element[0];
|
1619
|
+
data.shadowData.shadowFocusElement = element.find('input, select')[0] || element[0];
|
1528
1620
|
}
|
1529
1621
|
}, 9);
|
1530
1622
|
}
|
@@ -1627,8 +1719,21 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1627
1719
|
options: options
|
1628
1720
|
});
|
1629
1721
|
|
1722
|
+
webshims.inlinePopover = {
|
1723
|
+
_create: function(){
|
1724
|
+
this.element = $('<div class="ws-inline-picker"><div class="ws-po-box" /></div>').data('wspopover', this);
|
1725
|
+
this.contentElement = $('.ws-po-box', this.element);
|
1726
|
+
this.element.insertAfter(this.options.prepareFor);
|
1727
|
+
},
|
1728
|
+
show: $.noop,
|
1729
|
+
hide: $.noop,
|
1730
|
+
preventBlur: $.noop,
|
1731
|
+
isVisible: true
|
1732
|
+
};
|
1733
|
+
|
1630
1734
|
picker._genericSetFocus = function(element, _noFocus){
|
1631
1735
|
element = $(element || this.activeButton);
|
1736
|
+
|
1632
1737
|
if(!this.popover.openedByFocus && !_noFocus){
|
1633
1738
|
var that = this;
|
1634
1739
|
var setFocus = function(noTrigger){
|
@@ -1653,12 +1758,14 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1653
1758
|
data.setChange(val);
|
1654
1759
|
},
|
1655
1760
|
cancel: function(val, popover, data){
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1761
|
+
if(!data.options.inlinePicker){
|
1762
|
+
popover.stopOpen = true;
|
1763
|
+
data.element.getShadowFocusElement().focus();
|
1764
|
+
setTimeout(function(){
|
1765
|
+
popover.stopOpen = false;
|
1766
|
+
}, 9);
|
1767
|
+
popover.hide();
|
1768
|
+
}
|
1662
1769
|
}
|
1663
1770
|
};
|
1664
1771
|
|
@@ -1671,28 +1778,31 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1671
1778
|
popover.element.on('updatepickercontent pickerchange', function(){
|
1672
1779
|
tabbable = false;
|
1673
1780
|
});
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
tabbable.
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1781
|
+
|
1782
|
+
if(!data.options.inlinePicker){
|
1783
|
+
popover.contentElement.on({
|
1784
|
+
keydown: function(e){
|
1785
|
+
if(e.keyCode == 9){
|
1786
|
+
if(!tabbable){
|
1787
|
+
tabbable = $('input:not(:disabled), [tabindex="0"]:not(:disabled)', this).filter(':visible');
|
1788
|
+
}
|
1789
|
+
var index = tabbable.index(e.target);
|
1790
|
+
if(e.shiftKey && index <= 0){
|
1791
|
+
tabbable.last().focus();
|
1792
|
+
return false;
|
1793
|
+
}
|
1794
|
+
if(!e.shiftKey && index >= tabbable.length - 1){
|
1795
|
+
tabbable.first().focus();
|
1796
|
+
return false;
|
1797
|
+
}
|
1798
|
+
} else if(e.keyCode == 27){
|
1799
|
+
data.element.getShadowFocusElement().focus();
|
1800
|
+
popover.hide();
|
1687
1801
|
return false;
|
1688
1802
|
}
|
1689
|
-
} else if(e.keyCode == 27){
|
1690
|
-
data.element.getShadowFocusElement().focus();
|
1691
|
-
popover.hide();
|
1692
|
-
return false;
|
1693
1803
|
}
|
1694
|
-
}
|
1695
|
-
}
|
1804
|
+
});
|
1805
|
+
}
|
1696
1806
|
|
1697
1807
|
data._propertyChange = (function(){
|
1698
1808
|
var timer;
|
@@ -1702,7 +1812,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1702
1812
|
}
|
1703
1813
|
};
|
1704
1814
|
return function(prop){
|
1705
|
-
if(prop == 'value'){return;}
|
1815
|
+
if(prop == 'value' && !data.options.inlinePicker){return;}
|
1706
1816
|
popover.isDirty = true;
|
1707
1817
|
if(popover.isVisible){
|
1708
1818
|
clearTimeout(timer);
|
@@ -1739,7 +1849,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1739
1849
|
|
1740
1850
|
picker._common = function(data){
|
1741
1851
|
var options = data.options;
|
1742
|
-
var popover = webshims.objectCreate(webshims.wsPopover, {}, {prepareFor: data.element, position: options.widgetPosition});
|
1852
|
+
var popover = webshims.objectCreate(options.inlinePicker ? webshims.inlinePopover : webshims.wsPopover, {}, {prepareFor: options.inlinePicker ? data.buttonWrapper : data.element, position: options.widgetPosition});
|
1743
1853
|
var opener = $('<button type="button" class="ws-popover-opener"><span /></button>').appendTo(data.buttonWrapper);
|
1744
1854
|
|
1745
1855
|
|
@@ -1748,18 +1858,34 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1748
1858
|
};
|
1749
1859
|
var show = function(){
|
1750
1860
|
var type = loadPicker(data.type, 'DOM');
|
1751
|
-
if(!options.disabled && !options.readonly && !popover.isVisible){
|
1861
|
+
if(!options.disabled && !options.readonly && (options.inlinePicker || !popover.isVisible)){
|
1752
1862
|
webshims.ready(type, showPickerContent);
|
1753
1863
|
popover.show(data.element);
|
1754
1864
|
}
|
1755
1865
|
};
|
1866
|
+
var open = function(){
|
1867
|
+
if((options.inlinePicker || popover.isVisible) && popover.activeElement){
|
1868
|
+
popover.openedByFocus = false;
|
1869
|
+
popover.activeElement.focus();
|
1870
|
+
}
|
1871
|
+
show();
|
1872
|
+
};
|
1873
|
+
|
1756
1874
|
|
1757
1875
|
options.containerElements.push(popover.element[0]);
|
1758
1876
|
|
1759
1877
|
if(data.type != 'color'){
|
1878
|
+
if(options.yearButtons){
|
1879
|
+
options.startView = 2;
|
1880
|
+
}
|
1760
1881
|
if(!options.startView){
|
1761
1882
|
options.startView = 0;
|
1762
1883
|
}
|
1884
|
+
|
1885
|
+
if(data.type == 'time'){
|
1886
|
+
options.minView = 3;
|
1887
|
+
options.startView = 3;
|
1888
|
+
}
|
1763
1889
|
if(!options.minView){
|
1764
1890
|
options.minView = 0;
|
1765
1891
|
}
|
@@ -1789,6 +1915,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1789
1915
|
if(popover.activeElement){
|
1790
1916
|
popover.activeElement.removeClass('ws-focus');
|
1791
1917
|
}
|
1918
|
+
if(options.inlinePicker){
|
1919
|
+
popover.openedByFocus = true;
|
1920
|
+
}
|
1792
1921
|
}
|
1793
1922
|
})
|
1794
1923
|
;
|
@@ -1804,57 +1933,63 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1804
1933
|
opener.prop({disabled: true});
|
1805
1934
|
}
|
1806
1935
|
|
1807
|
-
opener
|
1808
|
-
.on({
|
1809
|
-
mousedown: function(){
|
1810
|
-
stopPropagation.apply(this, arguments);
|
1811
|
-
popover.preventBlur();
|
1812
|
-
},
|
1813
|
-
click: function(){
|
1814
|
-
if(popover.isVisible && popover.activeElement){
|
1815
|
-
popover.openedByFocus = false;
|
1816
|
-
popover.activeElement.focus();
|
1817
|
-
}
|
1818
|
-
show();
|
1819
|
-
},
|
1820
|
-
focus: function(){
|
1821
|
-
popover.preventBlur();
|
1822
|
-
}
|
1823
|
-
})
|
1824
|
-
;
|
1825
1936
|
|
1826
|
-
(
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
1831
|
-
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1836
|
-
}
|
1937
|
+
opener.on({click: open});
|
1938
|
+
|
1939
|
+
if(options.inlinePicker){
|
1940
|
+
popover.openedByFocus = true;
|
1941
|
+
} else {
|
1942
|
+
opener
|
1943
|
+
.on({
|
1944
|
+
mousedown: function(){
|
1945
|
+
stopPropagation.apply(this, arguments);
|
1946
|
+
popover.preventBlur();
|
1947
|
+
},
|
1948
|
+
focus: function(){
|
1837
1949
|
popover.preventBlur();
|
1838
1950
|
}
|
1839
|
-
}
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1951
|
+
})
|
1952
|
+
;
|
1953
|
+
|
1954
|
+
(function(){
|
1955
|
+
var mouseFocus = false;
|
1956
|
+
var resetMouseFocus = function(){
|
1957
|
+
mouseFocus = false;
|
1958
|
+
};
|
1959
|
+
data.inputElements.on({
|
1960
|
+
keydown: function(e){
|
1961
|
+
if(e.keyCode == 40 && e.altKey){
|
1962
|
+
open();
|
1963
|
+
}
|
1964
|
+
},
|
1965
|
+
focus: function(){
|
1966
|
+
if(!popover.stopOpen && (options.buttonOnly || options.openOnFocus || (mouseFocus && options.openOnMouseFocus))){
|
1967
|
+
popover.openedByFocus = options.buttonOnly ? false : !options.noInput;
|
1968
|
+
show();
|
1969
|
+
} else {
|
1970
|
+
popover.preventBlur();
|
1971
|
+
}
|
1972
|
+
},
|
1973
|
+
mousedown: function(){
|
1974
|
+
mouseFocus = true;
|
1975
|
+
setTimeout(resetMouseFocus, 9);
|
1976
|
+
if(options.buttonOnly && popover.isVisible && popover.activeElement){
|
1846
1977
|
popover.openedByFocus = false;
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1978
|
+
setTimeout(function(){
|
1979
|
+
popover.openedByFocus = false;
|
1980
|
+
popover.activeElement.focus();
|
1981
|
+
}, 4);
|
1982
|
+
}
|
1983
|
+
if(data.element.is(':focus')){
|
1984
|
+
popover.openedByFocus = options.buttonOnly ? false : !options.noInput;
|
1985
|
+
show();
|
1986
|
+
}
|
1987
|
+
popover.preventBlur();
|
1853
1988
|
}
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1989
|
+
});
|
1990
|
+
})();
|
1991
|
+
}
|
1992
|
+
|
1858
1993
|
data.popover = popover;
|
1859
1994
|
data.opener = opener;
|
1860
1995
|
$(data.orig).on('remove', function(e){
|
@@ -1865,12 +2000,16 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1865
2000
|
}, 4);
|
1866
2001
|
}
|
1867
2002
|
});
|
1868
|
-
|
2003
|
+
if(options.inlinePicker){
|
2004
|
+
show();
|
2005
|
+
}
|
1869
2006
|
loadPicker(data.type, 'WINDOWLOAD');
|
1870
2007
|
};
|
1871
2008
|
|
1872
2009
|
picker.month = picker._common;
|
1873
2010
|
picker.date = picker._common;
|
2011
|
+
picker.time = picker._common;
|
2012
|
+
picker['datetime-local'] = picker._common;
|
1874
2013
|
// picker.week = picker._common;
|
1875
2014
|
picker.color = function(data){
|
1876
2015
|
var ret = picker._common.apply(this, arguments);
|
@@ -2054,6 +2193,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2054
2193
|
opts[optsName] = $.attr(this, copyAttrs[i]) || opts[optsName];
|
2055
2194
|
}
|
2056
2195
|
}
|
2196
|
+
if(opts.monthSelect){
|
2197
|
+
opts.onlyMonthDigits = true;
|
2198
|
+
}
|
2057
2199
|
if(opts.onlyMonthDigits){
|
2058
2200
|
opts.formatMonthNames = 'monthDigits';
|
2059
2201
|
}
|
@@ -2159,11 +2301,14 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2159
2301
|
});
|
2160
2302
|
}
|
2161
2303
|
|
2162
|
-
var isStupid = navigator.userAgent.indexOf('
|
2163
|
-
['number', 'time', 'month', 'date', 'color'].forEach(function(name){
|
2304
|
+
var isStupid = modernizrInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && (/MSIE 1[0|1]\.\d/.test(navigator.userAgent) || /Trident\/7\.0/.test(navigator.userAgent));
|
2305
|
+
['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){
|
2164
2306
|
if(!modernizrInputTypes[name] || options.replaceUI || (name == 'number' && isStupid)){
|
2165
2307
|
extendType(name, {
|
2166
2308
|
_create: function(opts, set){
|
2309
|
+
if(opts.monthSelect){
|
2310
|
+
opts.splitInput = true;
|
2311
|
+
}
|
2167
2312
|
if(opts.splitInput && !splitInputs[name]){
|
2168
2313
|
webshims.warn('splitInput not supported for '+ name);
|
2169
2314
|
opts.splitInput = false;
|