webshims-rails 0.4.7 → 1.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/lib/webshims-rails/version.rb +2 -2
- data/vendor/assets/javascripts/webshims/extras/custom-validity.js +1 -1
- data/vendor/assets/javascripts/webshims/extras/mousepress.js +1 -1
- data/vendor/assets/javascripts/webshims/polyfiller.js +197 -166
- data/vendor/assets/javascripts/webshims/shims/combos/1.js +1711 -1609
- data/vendor/assets/javascripts/webshims/shims/combos/10.js +2575 -2253
- data/vendor/assets/javascripts/webshims/shims/combos/11.js +2452 -1476
- data/vendor/assets/javascripts/webshims/shims/combos/12.js +1405 -1159
- data/vendor/assets/javascripts/webshims/shims/combos/13.js +1316 -963
- data/vendor/assets/javascripts/webshims/shims/combos/14.js +1862 -179
- data/vendor/assets/javascripts/webshims/shims/combos/15.js +4327 -287
- data/vendor/assets/javascripts/webshims/shims/combos/16.js +3887 -586
- data/vendor/assets/javascripts/webshims/shims/combos/17.js +2911 -2159
- data/vendor/assets/javascripts/webshims/shims/combos/18.js +3425 -1730
- data/vendor/assets/javascripts/webshims/shims/combos/19.js +2854 -1203
- data/vendor/assets/javascripts/webshims/shims/combos/2.js +3351 -2130
- data/vendor/assets/javascripts/webshims/shims/combos/20.js +2426 -581
- data/vendor/assets/javascripts/webshims/shims/combos/21.js +1915 -1574
- data/vendor/assets/javascripts/webshims/shims/combos/22.js +864 -2275
- data/vendor/assets/javascripts/webshims/shims/combos/23.js +609 -1811
- data/vendor/assets/javascripts/webshims/shims/combos/3.js +1655 -2736
- data/vendor/assets/javascripts/webshims/shims/combos/4.js +1037 -603
- data/vendor/assets/javascripts/webshims/shims/combos/5.js +3100 -773
- data/vendor/assets/javascripts/webshims/shims/combos/6.js +3631 -840
- data/vendor/assets/javascripts/webshims/shims/combos/7.js +3596 -1354
- data/vendor/assets/javascripts/webshims/shims/combos/8.js +1731 -188
- data/vendor/assets/javascripts/webshims/shims/combos/9.js +3243 -1431
- data/vendor/assets/javascripts/webshims/shims/dom-extend.js +107 -18
- data/vendor/assets/javascripts/webshims/shims/es5.js +1 -0
- data/vendor/assets/javascripts/webshims/shims/form-core.js +553 -464
- data/vendor/assets/javascripts/webshims/shims/form-datalist.js +160 -154
- data/vendor/assets/javascripts/webshims/shims/form-message.js +73 -49
- data/vendor/assets/javascripts/webshims/shims/form-native-extend.js +18 -1
- data/vendor/assets/javascripts/webshims/shims/form-number-date-api.js +161 -36
- data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +2130 -813
- data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +206 -58
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-ar.js → formcfg-ar.js} +30 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-ch-ZN.js → formcfg-ch-ZN.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-de.txt → formcfg-de.txt} +50 -11
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-el.js → formcfg-el.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-en.txt → formcfg-en.txt} +44 -11
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-es.js → formcfg-es.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-fr.js → formcfg-fr.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-he.js → formcfg-he.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-hi.js → formcfg-hi.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-hu.js → formcfg-hu.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-it.js → formcfg-it.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-ja.js → formcfg-ja.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-nl.js → formcfg-nl.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-pt-PT.js → formcfg-pt-PT.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-ru.js → formcfg-ru.js} +31 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{errormessages-sv.js → formcfg-sv.js} +32 -0
- data/vendor/assets/javascripts/webshims/shims/json-storage.js +16 -10
- data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +155 -122
- data/vendor/assets/javascripts/webshims/shims/mediaelement-jaris.js +76 -41
- data/vendor/assets/javascripts/webshims/shims/mediaelement-yt.js +8 -16
- data/vendor/assets/javascripts/webshims/shims/range-ui.js +388 -0
- data/vendor/assets/javascripts/webshims/shims/styles/config.rb +12 -0
- data/vendor/assets/javascripts/webshims/shims/styles/forms.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +1186 -0
- data/vendor/assets/javascripts/webshims/shims/styles/shim.css +868 -548
- data/vendor/assets/javascripts/webshims/shims/styles/vertical-range.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/swf/JarisFLVPlayer.swf +0 -0
- data/vendor/assets/javascripts/webshims/shims/swfmini.js +497 -0
- data/vendor/assets/javascripts/webshims/shims/track-ui.js +3 -0
- data/vendor/assets/javascripts/webshims/shims/track.js +29 -29
- metadata +26 -125
- data/vendor/assets/javascripts/webshims/minified/extras/custom-validity.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/extras/modernizr-custom.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/extras/mousepress.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/polyfiller.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvas/canvas2png.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvas/flashcanvas.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvas/flashcanvas.swf +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvas/proxy.php +0 -73
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvas/save.php +0 -49
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvasPro/canvas2png.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvasPro/flash10canvas.swf +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvasPro/flash9canvas.swf +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvasPro/flashcanvas.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvasPro/proxy.php +0 -73
- data/vendor/assets/javascripts/webshims/minified/shims/FlashCanvasPro/save.php +0 -49
- data/vendor/assets/javascripts/webshims/minified/shims/combos/1.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/10.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/11.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/12.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/13.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/14.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/15.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/16.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/17.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/18.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/19.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/2.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/20.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/21.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/22.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/23.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/24.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/25.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/26.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/27.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/3.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/4.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/5.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/59.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/6.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/7.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/8.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/combos/9.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/details.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/dom-extend.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/es5.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/excanvas.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/form-core.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/form-datalist.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/form-message.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/form-native-extend.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/form-number-date-api.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/form-number-date-ui.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/form-shim-extend.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/geolocation.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-ar.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-ch-ZN.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-de.txt +0 -33
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-el.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-en.txt +0 -34
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-es.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-fr.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-he.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-hi.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-hu.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-it.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-ja.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-nl.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-pt-PT.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-ru.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/i18n/errormessages-sv.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/json-storage.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/jwplayer/license.txt +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/jwplayer/player.swf +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/jwplayer/readme.html +0 -87
- data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-core.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-jaris.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-native-fix.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-swf.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/mediaelement-yt.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/styles/details-arrows.png +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/styles/forms.png +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/styles/polyfill-loader.gif +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/styles/shim.css +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/swf/JarisFLVPlayer.swf +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/swf/jwwebshims.swf +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/swf/localStorage.swf +0 -0
- data/vendor/assets/javascripts/webshims/minified/shims/track-ui.js +0 -1
- data/vendor/assets/javascripts/webshims/minified/shims/track.js +0 -1
- data/vendor/assets/javascripts/webshims/shims/FlashCanvas/README +0 -62
- data/vendor/assets/javascripts/webshims/shims/FlashCanvasPro/README +0 -82
- data/vendor/assets/javascripts/webshims/shims/combos/24.js +0 -2872
- data/vendor/assets/javascripts/webshims/shims/combos/25.js +0 -2376
- data/vendor/assets/javascripts/webshims/shims/combos/26.js +0 -3009
- data/vendor/assets/javascripts/webshims/shims/combos/27.js +0 -4150
- data/vendor/assets/javascripts/webshims/shims/combos/59.js +0 -1747
- data/vendor/assets/javascripts/webshims/shims/jwplayer/license.txt +0 -1
- data/vendor/assets/javascripts/webshims/shims/jwplayer/player.swf +0 -0
- data/vendor/assets/javascripts/webshims/shims/jwplayer/readme.html +0 -87
- data/vendor/assets/javascripts/webshims/shims/mediaelement-swf.js +0 -972
@@ -1,906 +1,2223 @@
|
|
1
|
-
/* number-date-ui */
|
2
|
-
/* https://github.com/aFarkas/webshim/issues#issue/23 */
|
3
1
|
jQuery.webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
|
4
2
|
"use strict";
|
3
|
+
var curCfg;
|
4
|
+
var formcfg = $.webshims.formcfg;
|
5
5
|
|
6
|
-
var
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
var stopPropagation = function(e){
|
7
|
+
e.stopImmediatePropagation(e);
|
8
|
+
};
|
9
|
+
var createFormat = function(name){
|
10
|
+
if(!curCfg.patterns[name+'Obj']){
|
11
|
+
var obj = {};
|
12
|
+
$.each(curCfg.patterns[name].split(curCfg[name+'Format']), function(i, name){
|
13
|
+
obj[name] = i;
|
14
|
+
});
|
15
|
+
curCfg.patterns[name+'Obj'] = obj;
|
16
|
+
}
|
17
|
+
};
|
18
|
+
var splitInputs = {
|
19
|
+
date: {
|
20
|
+
_create: function(){
|
21
|
+
var obj = {
|
22
|
+
splits: [$('<input type="text" class="yy" size="4" maxlength />')[0], $('<input type="text" class="mm" maxlength="2" size="2" />')[0], $('<input type="text" class="dd ws-spin" maxlength="2" size="2" />')[0]]
|
23
|
+
};
|
24
|
+
obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1], $('<span class="ws-input-seperator" />')[0], obj.splits[2]];
|
25
|
+
return obj;
|
26
|
+
},
|
27
|
+
sort: function(element){
|
28
|
+
createFormat('d');
|
29
|
+
var i = 0;
|
30
|
+
var seperators = $('.ws-input-seperator', element).html(curCfg.dFormat);
|
31
|
+
var inputs = $('input', element);
|
32
|
+
$.each(curCfg.patterns.dObj, function(name, value){
|
33
|
+
var input = inputs.filter('.'+ name);
|
34
|
+
if(input[0]){
|
35
|
+
|
36
|
+
input.appendTo(element);
|
37
|
+
if(i < seperators.length){
|
38
|
+
seperators.eq(i).insertAfter(input);
|
39
|
+
}
|
40
|
+
i++;
|
41
|
+
}
|
42
|
+
});
|
43
|
+
}
|
44
|
+
},
|
45
|
+
month: {
|
46
|
+
_create: function(){
|
47
|
+
var obj = {
|
48
|
+
splits: [$('<input type="text" class="yy" size="4" />')[0], $('<input type="text" class="mm ws-spin" />')[0]]
|
49
|
+
};
|
50
|
+
obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1]];
|
51
|
+
return obj;
|
52
|
+
},
|
53
|
+
sort: function(element){
|
54
|
+
var seperator = $('.ws-input-seperator', element).html(curCfg.dFormat);
|
55
|
+
var mm = $('input.mm', element);
|
56
|
+
var action;
|
57
|
+
if(curCfg.date.showMonthAfterYear){
|
58
|
+
mm.appendTo(element);
|
59
|
+
action = 'insertBefore';
|
60
|
+
} else {
|
61
|
+
mm.prependTo(element);
|
62
|
+
action = 'insertAfter';
|
63
|
+
}
|
64
|
+
seperator[action](mm);
|
65
|
+
}
|
66
|
+
}
|
67
|
+
};
|
68
|
+
var labelWidth = (function(){
|
69
|
+
var getId = function(){
|
70
|
+
return webshims.getID(this);
|
71
|
+
};
|
72
|
+
return function(element, labels, noFocus){
|
73
|
+
$(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')});
|
74
|
+
if(!noFocus){
|
75
|
+
labels.on('click', function(e){
|
76
|
+
element.getShadowFocusElement().focus();
|
77
|
+
e.preventDefault();
|
78
|
+
return false;
|
79
|
+
});
|
80
|
+
}
|
81
|
+
};
|
82
|
+
})();
|
83
|
+
var addZero = function(val){
|
84
|
+
if(!val){return "";}
|
85
|
+
val = val+'';
|
86
|
+
return val.length == 1 ? '0'+val : val;
|
87
|
+
};
|
88
|
+
|
89
|
+
|
90
|
+
(function(){
|
91
|
+
var monthDigits = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
|
92
|
+
formcfg.de = {
|
93
|
+
numberFormat: {
|
94
|
+
",": ".",
|
95
|
+
".": ","
|
96
|
+
},
|
97
|
+
timeSigns: ":. ",
|
98
|
+
numberSigns: ',',
|
99
|
+
dateSigns: '.',
|
100
|
+
dFormat: ".",
|
101
|
+
patterns: {
|
102
|
+
d: "dd.mm.yy"
|
103
|
+
},
|
104
|
+
month: {
|
105
|
+
currentText: 'Aktueller Monat'
|
106
|
+
},
|
107
|
+
date: {
|
108
|
+
close: 'schließen',
|
109
|
+
clear: 'Löschen',
|
110
|
+
prevText: 'Zurück',
|
111
|
+
nextText: 'Vor',
|
112
|
+
currentText: 'Heute',
|
113
|
+
monthNames: ['Januar','Februar','März','April','Mai','Juni',
|
114
|
+
'Juli','August','September','Oktober','November','Dezember'],
|
115
|
+
monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
|
116
|
+
'Jul','Aug','Sep','Okt','Nov','Dez'],
|
117
|
+
dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
|
118
|
+
dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
|
119
|
+
dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
|
120
|
+
weekHeader: 'KW',
|
121
|
+
firstDay: 1,
|
122
|
+
isRTL: false,
|
123
|
+
showMonthAfterYear: false,
|
124
|
+
yearSuffix: ''
|
125
|
+
}
|
126
|
+
};
|
127
|
+
|
128
|
+
formcfg.en = {
|
129
|
+
numberFormat: {
|
130
|
+
".": ".",
|
131
|
+
",": ","
|
132
|
+
},
|
133
|
+
numberSigns: '.',
|
134
|
+
dateSigns: '/',
|
135
|
+
timeSigns: ":. ",
|
136
|
+
dFormat: "/",
|
137
|
+
patterns: {
|
138
|
+
d: "mm/dd/yy"
|
139
|
+
},
|
140
|
+
month: {
|
141
|
+
currentText: 'This month'
|
142
|
+
},
|
143
|
+
date: {
|
144
|
+
"closeText": "Done",
|
145
|
+
clear: 'Clear',
|
146
|
+
"prevText": "Prev",
|
147
|
+
"nextText": "Next",
|
148
|
+
"currentText": "Today",
|
149
|
+
"monthNames": ["January","February","March","April","May","June","July","August","September","October","November","December"],
|
150
|
+
"monthNamesShort": ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],
|
151
|
+
"dayNames": ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],
|
152
|
+
"dayNamesShort": ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],
|
153
|
+
"dayNamesMin": ["Su","Mo","Tu","We","Th","Fr","Sa"],
|
154
|
+
"weekHeader": "Wk",
|
155
|
+
"firstDay": 0,
|
156
|
+
"isRTL": false,
|
157
|
+
"showMonthAfterYear": false,
|
158
|
+
"yearSuffix": ""
|
159
|
+
}
|
160
|
+
};
|
161
|
+
|
162
|
+
formcfg['en-US'] = formcfg['en-US'] || formcfg['en'];
|
163
|
+
formcfg[''] = formcfg[''] || formcfg['en-US'];
|
164
|
+
curCfg = formcfg[''];
|
165
|
+
|
166
|
+
var createMonthKeys = function(langCfg){
|
167
|
+
if(!langCfg.date.monthkeys){
|
168
|
+
var create = function(i, name){
|
169
|
+
var strNum;
|
170
|
+
var num = i + 1;
|
171
|
+
strNum = (num < 10) ? '0'+num : ''+num;
|
172
|
+
langCfg.date.monthkeys[num] = strNum;
|
173
|
+
langCfg.date.monthkeys[name] = strNum;
|
174
|
+
langCfg.date.monthkeys[name.toLowerCase()] = strNum;
|
175
|
+
};
|
176
|
+
langCfg.date.monthkeys = {};
|
177
|
+
langCfg.date.monthDigits = monthDigits;
|
178
|
+
langCfg.numberSigns += '-';
|
179
|
+
$.each(langCfg.date.monthNames, create);
|
180
|
+
$.each(langCfg.date.monthNamesShort, create);
|
181
|
+
}
|
182
|
+
};
|
183
|
+
|
184
|
+
createMonthKeys(curCfg);
|
185
|
+
|
186
|
+
$.webshims.ready('dom-extend', function(){
|
187
|
+
$.webshims.activeLang({
|
188
|
+
register: 'form-core',
|
189
|
+
callback: function(){
|
190
|
+
$.each(arguments, function(i, val){
|
191
|
+
if(formcfg[val]){
|
192
|
+
curCfg = formcfg[val];
|
193
|
+
createMonthKeys(curCfg);
|
194
|
+
$(document).triggerHandler('wslocalechange');
|
195
|
+
return false;
|
196
|
+
}
|
197
|
+
});
|
198
|
+
}
|
199
|
+
});
|
200
|
+
});
|
201
|
+
})();
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
(function(){
|
206
|
+
|
207
|
+
|
208
|
+
var mousePress = function(e){
|
209
|
+
$(this)[e.type == 'mousepressstart' ? 'addClass' : 'removeClass']('mousepress-ui');
|
210
|
+
};
|
211
|
+
|
212
|
+
var retDefault = function(val, def){
|
213
|
+
if(!(typeof val == 'number' || (val && val == val * 1))){
|
214
|
+
return def;
|
215
|
+
}
|
216
|
+
return val * 1;
|
217
|
+
};
|
218
|
+
|
219
|
+
var createOpts = ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'value'];
|
220
|
+
|
221
|
+
|
222
|
+
var formatVal = {
|
223
|
+
number: function(val){
|
224
|
+
return (val+'').replace(/\,/g, '').replace(/\./, curCfg.numberFormat['.']);
|
225
|
+
},
|
226
|
+
time: function(val){
|
227
|
+
return val;
|
228
|
+
},
|
229
|
+
//todo empty val for month/split
|
230
|
+
month: function(val, options){
|
231
|
+
var names;
|
232
|
+
var p = val.split('-');
|
233
|
+
if(p[0] && p[1]){
|
234
|
+
names = curCfg.date[options.formatMonthNames] || curCfg.date[options.monthNames] || curCfg.date.monthNames;
|
235
|
+
p[1] = names[(p[1] * 1) - 1];
|
236
|
+
if(options && options.splitInput){
|
237
|
+
val = [p[0] || '', p[1] || ''];
|
238
|
+
} else if(p[1]){
|
239
|
+
val = curCfg.date.showMonthAfterYear ? p.join(' ') : p[1]+' '+p[0];
|
240
|
+
}
|
241
|
+
}
|
242
|
+
return val;
|
243
|
+
},
|
244
|
+
date: function(val, opts){
|
245
|
+
var p = (val+'').split('-');
|
246
|
+
if(p[2] && p[1] && p[0]){
|
247
|
+
if(opts && opts.splitInput){
|
248
|
+
val = p;
|
249
|
+
} else {
|
250
|
+
val = curCfg.patterns.d.replace('yy', p[0] || '');
|
251
|
+
val = val.replace('mm', p[1] || '');
|
252
|
+
val = val.replace('dd', p[2] || '');
|
253
|
+
}
|
254
|
+
} else if(opts && opts.splitInput){
|
255
|
+
val = [p[0] || '', p[1] || '', p[2] || ''];
|
256
|
+
}
|
257
|
+
|
258
|
+
return val;
|
259
|
+
}
|
260
|
+
};
|
261
|
+
|
262
|
+
var parseVal = {
|
263
|
+
number: function(val){
|
264
|
+
return (val+'').replace(curCfg.numberFormat[','], '').replace(curCfg.numberFormat['.'], '.');
|
265
|
+
},
|
266
|
+
time: function(val){
|
267
|
+
return val;
|
268
|
+
},
|
269
|
+
month: function(val, opts){
|
270
|
+
|
271
|
+
var p = (!opts.splitInput) ? val.trim().split(/[\.\s-\/\\]+/) : val;
|
272
|
+
|
273
|
+
if(p.length == 2){
|
274
|
+
p[0] = curCfg.date.monthkeys[p[0]] || p[0];
|
275
|
+
p[1] = curCfg.date.monthkeys[p[1]] || p[1];
|
276
|
+
if(p[1].length == 2){
|
277
|
+
val = p[0]+'-'+p[1];
|
278
|
+
} else if(p[0].length == 2){
|
279
|
+
val = p[1]+'-'+p[0];
|
280
|
+
} else {
|
281
|
+
val = '';
|
282
|
+
}
|
283
|
+
} else if(opts.splitInput) {
|
284
|
+
val = '';
|
285
|
+
}
|
286
|
+
return val;
|
287
|
+
},
|
288
|
+
date: function(val, opts){
|
289
|
+
createFormat('d');
|
290
|
+
var i;
|
291
|
+
var obj;
|
292
|
+
if(opts.splitInput){
|
293
|
+
obj = {yy: 0, mm: 1, dd: 2};
|
294
|
+
} else {
|
295
|
+
obj = curCfg.patterns.dObj;
|
296
|
+
val = val.split(curCfg.dFormat);
|
297
|
+
}
|
298
|
+
|
299
|
+
return (val.length == 3 && val[0] && val[1] && val[2]) ?
|
300
|
+
([addZero(val[obj.yy]), addZero(val[obj.mm]), addZero(val[obj.dd])]).join('-') :
|
301
|
+
''
|
302
|
+
;
|
303
|
+
}
|
304
|
+
};
|
305
|
+
|
306
|
+
var steps = {
|
307
|
+
number: {
|
308
|
+
step: 1
|
309
|
+
},
|
310
|
+
time: {
|
311
|
+
step: 60
|
312
|
+
},
|
313
|
+
month: {
|
314
|
+
step: 1,
|
315
|
+
start: new Date()
|
316
|
+
},
|
317
|
+
date: {
|
318
|
+
step: 1,
|
319
|
+
start: new Date()
|
320
|
+
}
|
321
|
+
};
|
322
|
+
|
323
|
+
|
324
|
+
var placeholderFormat = {
|
325
|
+
date: function(val, opts){
|
326
|
+
var hintValue = (val || '').split('-');
|
327
|
+
if(hintValue.length == 3){
|
328
|
+
hintValue = opts.splitInput ?
|
329
|
+
hintValue :
|
330
|
+
curCfg.patterns.d.replace('yy', hintValue[0]).replace('mm', hintValue[1]).replace('dd', hintValue[2]);
|
331
|
+
} else {
|
332
|
+
hintValue = opts.splitInput ?
|
333
|
+
[val, val, val] :
|
334
|
+
val;
|
335
|
+
}
|
336
|
+
return hintValue;
|
337
|
+
},
|
338
|
+
month: function(val, opts){
|
339
|
+
var hintValue = (val || '').split('-');
|
340
|
+
|
341
|
+
if(hintValue.length == 2){
|
342
|
+
hintValue = opts.splitInput ?
|
343
|
+
hintValue :
|
344
|
+
curCfg.patterns.d.replace('yy', hintValue[0]).replace('mm', hintValue[1]);
|
345
|
+
} else {
|
346
|
+
hintValue = opts.splitInput ?
|
347
|
+
[val, val] :
|
348
|
+
val;
|
349
|
+
}
|
350
|
+
return hintValue;
|
351
|
+
}
|
352
|
+
};
|
353
|
+
|
354
|
+
var createHelper = (function(){
|
355
|
+
var types = {};
|
356
|
+
return function(type){
|
357
|
+
var input;
|
358
|
+
if(!types[type]){
|
359
|
+
input = $('<input type="'+type+'" />');
|
360
|
+
types[type] = {
|
361
|
+
asNumber: function(val){
|
362
|
+
var type = (typeof val == 'object') ? 'valueAsDate' : 'value';
|
363
|
+
return input.prop(type, val).prop('valueAsNumber');
|
364
|
+
},
|
365
|
+
asValue: function(val){
|
366
|
+
var type = (typeof val == 'object') ? 'valueAsDate' : 'valueAsNumber';
|
367
|
+
return input.prop(type, val).prop('value');
|
368
|
+
}
|
369
|
+
};
|
370
|
+
}
|
371
|
+
return types[type];
|
372
|
+
};
|
373
|
+
})();
|
374
|
+
|
375
|
+
steps.range = steps.number;
|
376
|
+
|
377
|
+
|
378
|
+
var spinBtnProto = {
|
379
|
+
_create: function(){
|
380
|
+
var i;
|
381
|
+
var o = this.options;
|
382
|
+
var helper = createHelper(o.type);
|
383
|
+
this.type = o.type;
|
384
|
+
this.orig = o.orig;
|
385
|
+
|
386
|
+
this.elemHelper = $('<input type="'+ this.type+'" />');
|
387
|
+
this.asNumber = helper.asNumber;
|
388
|
+
this.asValue = helper.asValue;
|
389
|
+
|
390
|
+
this.buttonWrapper = $('<span class="input-buttons '+this.type+'-input-buttons"><span unselectable="on" class="step-controls"><span class="step-up"></span><span class="step-down"></span></span></span>')
|
391
|
+
.insertAfter(this.element)
|
392
|
+
;
|
393
|
+
|
394
|
+
if(o.splitInput){
|
395
|
+
this._addSplitInputs();
|
396
|
+
} else {
|
397
|
+
this.inputElements = this.element;
|
398
|
+
}
|
399
|
+
|
400
|
+
this.options.containerElements.push(this.buttonWrapper[0]);
|
401
|
+
|
402
|
+
if(typeof steps[this.type].start == 'object'){
|
403
|
+
steps[this.type].start = this.asNumber(steps[this.type].start);
|
404
|
+
}
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
for(i = 0; i < createOpts.length; i++){
|
409
|
+
this[createOpts[i]](o[createOpts[i]]);
|
410
|
+
}
|
411
|
+
|
412
|
+
this.element.data('wsspinner', this);
|
413
|
+
|
414
|
+
this.addBindings();
|
415
|
+
|
416
|
+
if(!o.min && typeof o.relMin == 'number'){
|
417
|
+
o.min = this.asValue(this.getRelNumber(o.relMin));
|
418
|
+
$.prop(this.orig, 'min', o.min);
|
419
|
+
}
|
420
|
+
|
421
|
+
if(!o.max && typeof o.relMax == 'number'){
|
422
|
+
o.max = this.asValue(this.getRelNumber(o.relMax));
|
423
|
+
$.prop(this.orig, 'max', o.max);
|
424
|
+
}
|
425
|
+
|
426
|
+
this._init = true;
|
427
|
+
},
|
428
|
+
_addSplitInputs: function(){
|
429
|
+
if(!this.inputElements){
|
430
|
+
var create = splitInputs[this.type]._create();
|
431
|
+
this.splits = create.splits;
|
432
|
+
this.inputElements = $(create.elements).prependTo(this.element).filter('input');
|
433
|
+
}
|
434
|
+
},
|
435
|
+
parseValue: function(){
|
436
|
+
var value = this.inputElements.map(function(){
|
437
|
+
return $.prop(this, 'value');
|
438
|
+
}).get();
|
439
|
+
if(!this.options.splitInput){
|
440
|
+
value = value[0];
|
441
|
+
}
|
442
|
+
return parseVal[this.type](value, this.options);
|
443
|
+
},
|
444
|
+
formatValue: function(val, noSplit){
|
445
|
+
return formatVal[this.type](val, noSplit === false ? false : this.options);
|
446
|
+
},
|
447
|
+
placeholder: function(val){
|
448
|
+
var options = this.options;
|
449
|
+
options.placeholder = val;
|
450
|
+
var placeholder = val;
|
451
|
+
if(placeholderFormat[this.type]){
|
452
|
+
placeholder = placeholderFormat[this.type](val, this.options);
|
453
|
+
}
|
454
|
+
if(options.splitInput && typeof placeholder == 'object'){
|
455
|
+
$.each(this.splits, function(i, elem){
|
456
|
+
$.prop(elem, 'placeholder', placeholder[i]);
|
457
|
+
});
|
458
|
+
} else {
|
459
|
+
this.element.prop('placeholder', placeholder);
|
460
|
+
}
|
461
|
+
},
|
462
|
+
getRelNumber: function(rel){
|
463
|
+
var start = steps[this.type].start || 0;
|
464
|
+
if(rel){
|
465
|
+
start += rel;
|
466
|
+
}
|
467
|
+
return start;
|
468
|
+
},
|
469
|
+
addZero: addZero,
|
470
|
+
_setStartInRange: function(){
|
471
|
+
var start = this.getRelNumber(this.options.relDefaultValue);
|
472
|
+
if(!isNaN(this.minAsNumber) && start < this.minAsNumber){
|
473
|
+
start = this.minAsNumber;
|
474
|
+
} else if(!isNaN(this.maxAsNumber) && start > this.maxAsNumber){
|
475
|
+
start = this.maxAsNumber;
|
476
|
+
}
|
477
|
+
this.elemHelper.prop('valueAsNumber', start);
|
478
|
+
this.options.defValue = this.elemHelper.prop('value');
|
479
|
+
|
480
|
+
},
|
481
|
+
reorderInputs: function(){
|
482
|
+
if(splitInputs[this.type]){
|
483
|
+
var element = this.element;
|
484
|
+
splitInputs[this.type].sort(element);
|
485
|
+
setTimeout(function(){
|
486
|
+
var data = webshims.data(element);
|
487
|
+
if(data && data.shadowData){
|
488
|
+
data.shadowData.shadowFocusElement = element.find('input')[0] || element[0];
|
489
|
+
}
|
490
|
+
}, 9);
|
491
|
+
}
|
492
|
+
},
|
493
|
+
value: function(val){
|
494
|
+
this.valueAsNumber = this.asNumber(val);
|
495
|
+
this.options.value = val;
|
496
|
+
if(isNaN(this.valueAsNumber) || (!isNaN(this.minAsNumber) && this.valueAsNumber < this.minAsNumber) || (!isNaN(this.maxAsNumber) && this.valueAsNumber > this.maxAsNumber)){
|
497
|
+
this._setStartInRange();
|
498
|
+
} else {
|
499
|
+
this.elemHelper.prop('value', val);
|
500
|
+
this.options.defValue = "";
|
501
|
+
}
|
502
|
+
|
503
|
+
val = formatVal[this.type](val, this.options);
|
504
|
+
if(this.options.splitInput){
|
505
|
+
|
506
|
+
$.each(this.splits, function(i, elem){
|
507
|
+
$.prop(elem, 'value', val[i]);
|
508
|
+
});
|
509
|
+
} else {
|
510
|
+
this.element.prop('value', val);
|
511
|
+
}
|
512
|
+
|
513
|
+
this._propertyChange('value');
|
514
|
+
},
|
515
|
+
initDataList: function(){
|
516
|
+
var listTimer;
|
517
|
+
var that = this;
|
518
|
+
var updateList = function(){
|
519
|
+
$(that.orig)
|
520
|
+
.jProp('list')
|
521
|
+
.off('updateDatalist', updateList)
|
522
|
+
.on('updateDatalist', updateList)
|
523
|
+
;
|
524
|
+
clearTimeout(listTimer);
|
525
|
+
listTimer = setTimeout(function(){
|
526
|
+
if(that.list){
|
527
|
+
that.list();
|
528
|
+
}
|
529
|
+
}, 9);
|
530
|
+
|
531
|
+
};
|
532
|
+
|
533
|
+
$(this.orig).onTrigger('listdatalistchange', updateList);
|
534
|
+
},
|
535
|
+
getOptions: function(){
|
536
|
+
var options = {};
|
537
|
+
var datalist = $(this.orig).jProp('list');
|
538
|
+
datalist.find('option').each(function(){
|
539
|
+
options[$.prop(this, 'value')] = $.prop(this, 'label');
|
540
|
+
});
|
541
|
+
return [options, datalist.data('label')];
|
542
|
+
},
|
543
|
+
list: function(val){
|
544
|
+
if(this.type == 'number' || this.type == 'time'){
|
545
|
+
this.element.attr('list', $.attr(this.orig, 'list'));
|
546
|
+
}
|
547
|
+
this.options.list = val;
|
548
|
+
this._propertyChange('list');
|
549
|
+
},
|
550
|
+
_propertyChange: $.noop,
|
551
|
+
tabindex: function(val){
|
552
|
+
this.options.tabindex = val;
|
553
|
+
this.inputElements.prop('tabindex', this.options.tabindex);
|
554
|
+
},
|
555
|
+
title: function(val){
|
556
|
+
this.options.title = val;
|
557
|
+
this.element.prop('title', this.options.title);
|
558
|
+
},
|
559
|
+
|
560
|
+
min: function(val){
|
561
|
+
this.elemHelper.prop('min', val);
|
562
|
+
this.minAsNumber = this.asNumber(val);
|
563
|
+
if(this.valueAsNumber != null && isNaN(this.valueAsNumber)){
|
564
|
+
this._setStartInRange();
|
565
|
+
}
|
566
|
+
this.options.min = val;
|
567
|
+
this._propertyChange('min');
|
568
|
+
},
|
569
|
+
max: function(val){
|
570
|
+
this.elemHelper.prop('max', val);
|
571
|
+
this.maxAsNumber = this.asNumber(val);
|
572
|
+
if(this.valueAsNumber != null && isNaN(this.valueAsNumber)){
|
573
|
+
this._setStartInRange();
|
574
|
+
}
|
575
|
+
this.options.max = val;
|
576
|
+
this._propertyChange('max');
|
577
|
+
},
|
578
|
+
step: function(val){
|
579
|
+
var defStep = steps[this.type];
|
580
|
+
this.options.step = val;
|
581
|
+
this.elemHelper.prop('step', retDefault(val, defStep.step));
|
582
|
+
},
|
583
|
+
addBindings: function(){
|
584
|
+
var isFocused;
|
585
|
+
|
586
|
+
var that = this;
|
587
|
+
var o = this.options;
|
588
|
+
|
589
|
+
var eventTimer = (function(){
|
590
|
+
var events = {};
|
591
|
+
return {
|
592
|
+
init: function(name, curVal, fn){
|
593
|
+
if(!events[name]){
|
594
|
+
events[name] = {fn: fn};
|
595
|
+
$(that.orig).on(name, function(){
|
596
|
+
events[name].val = $.prop(that.orig, 'value');
|
597
|
+
});
|
598
|
+
}
|
599
|
+
events[name].val = curVal;
|
600
|
+
},
|
601
|
+
call: function(name, val){
|
602
|
+
if(events[name] && events[name].val != val){
|
603
|
+
clearTimeout(events[name].timer);
|
604
|
+
events[name].val = val;
|
605
|
+
events[name].timer = setTimeout(function(){
|
606
|
+
events[name].fn(val, that);
|
607
|
+
}, 9);
|
608
|
+
}
|
609
|
+
}
|
610
|
+
};
|
611
|
+
})();
|
612
|
+
var initChangeEvents = function(){
|
613
|
+
eventTimer.init('input', $.prop(that.orig, 'value'), that.options.input);
|
614
|
+
eventTimer.init('change', $.prop(that.orig, 'value'), that.options.change);
|
615
|
+
};
|
616
|
+
|
617
|
+
var step = {};
|
618
|
+
|
619
|
+
var preventBlur = function(e){
|
620
|
+
if(preventBlur.prevent){
|
621
|
+
e.preventDefault();
|
622
|
+
(isFocused || that.element.getShadowFocusElement()).focus();
|
623
|
+
e.stopImmediatePropagation();
|
624
|
+
return true;
|
625
|
+
}
|
626
|
+
};
|
627
|
+
var callSplitChange = (function(){
|
628
|
+
var timer;
|
629
|
+
|
630
|
+
var call = function(e){
|
631
|
+
var val;
|
632
|
+
clearTimeout(timer);
|
633
|
+
val = that.parseValue();
|
634
|
+
$.prop(that.orig, 'value', val);
|
635
|
+
eventTimer.call('input', val);
|
636
|
+
if(!e || e.type != 'wsupdatevalue'){
|
637
|
+
eventTimer.call('change', val);
|
638
|
+
}
|
639
|
+
};
|
640
|
+
|
641
|
+
var onFocus = function(){
|
642
|
+
clearTimeout(timer);
|
643
|
+
};
|
644
|
+
var onBlur = function(e){
|
645
|
+
clearTimeout(timer);
|
646
|
+
timer = setTimeout(call, 0);
|
647
|
+
|
648
|
+
if(e.type == 'change'){
|
649
|
+
stopPropagation(e);
|
650
|
+
if(!o.splitInput){
|
651
|
+
call();
|
652
|
+
}
|
653
|
+
}
|
654
|
+
};
|
655
|
+
|
656
|
+
that.element.on('wsupdatevalue', call);
|
657
|
+
|
658
|
+
that.inputElements
|
659
|
+
.add(that.buttonWrapper)
|
660
|
+
.add(that.element)
|
661
|
+
.on(
|
662
|
+
{
|
663
|
+
'focus focusin': onFocus,
|
664
|
+
'blur focusout change': onBlur
|
665
|
+
}
|
666
|
+
)
|
667
|
+
;
|
668
|
+
setTimeout(function(){
|
669
|
+
if(that.popover){
|
670
|
+
$('> *', that.popover.element)
|
671
|
+
.on({
|
672
|
+
'focusin': onFocus,
|
673
|
+
'focusout': onBlur
|
674
|
+
})
|
675
|
+
;
|
676
|
+
}
|
677
|
+
}, 0);
|
678
|
+
})();
|
679
|
+
|
680
|
+
var spinEvents = {};
|
681
|
+
var spinElement = o.splitInput ? this.inputElements.filter('.ws-spin') : this.inputElements.eq(0);
|
682
|
+
var elementEvts = {
|
683
|
+
blur: function(e){
|
684
|
+
if(!preventBlur(e) && !o.disabled && !o.readonly){
|
685
|
+
if(!preventBlur.prevent){
|
686
|
+
isFocused = false;
|
687
|
+
}
|
688
|
+
}
|
689
|
+
stopPropagation(e);
|
690
|
+
},
|
691
|
+
focus: function(e){
|
692
|
+
if(!isFocused){
|
693
|
+
initChangeEvents();
|
694
|
+
isFocused = this;
|
695
|
+
}
|
696
|
+
},
|
697
|
+
keypress: function(e){
|
698
|
+
if(e.isDefaultPrevented()){return;}
|
699
|
+
var chr;
|
700
|
+
var stepped = true;
|
701
|
+
var code = e.keyCode;
|
702
|
+
if(!e.ctrlKey && !e.metaKey && curCfg[that.type+'Signs']){
|
703
|
+
chr = String.fromCharCode(e.charCode == null ? code : e.charCode);
|
704
|
+
stepped = !(chr < " " || (curCfg[that.type+'Signs']+'0123456789').indexOf(chr) > -1);
|
705
|
+
} else {
|
706
|
+
stepped = false;
|
707
|
+
}
|
708
|
+
if(stepped){
|
709
|
+
e.preventDefault();
|
710
|
+
}
|
711
|
+
},
|
712
|
+
'input keydown keypress': (function(){
|
713
|
+
var timer;
|
714
|
+
var isStopped = false;
|
715
|
+
var releaseTab = function(){
|
716
|
+
if(isStopped === true){
|
717
|
+
isStopped = 'semi';
|
718
|
+
timer = setTimeout(releaseTab, 250);
|
719
|
+
} else {
|
720
|
+
isStopped = false;
|
721
|
+
}
|
722
|
+
};
|
723
|
+
var stopTab = function(){
|
724
|
+
isStopped = true;
|
725
|
+
clearTimeout(timer);
|
726
|
+
timer = setTimeout(releaseTab, 300);
|
727
|
+
};
|
728
|
+
var select = function(){
|
729
|
+
this.focus();
|
730
|
+
this.select();
|
731
|
+
stopTab();
|
732
|
+
};
|
733
|
+
|
734
|
+
return function(e){
|
735
|
+
if(o.splitInput && o.jumpInputs){
|
736
|
+
if(e.type == 'input'){
|
737
|
+
if($.prop(this, 'value').length === $.prop(this, 'maxLength')){
|
738
|
+
try {
|
739
|
+
$(this)
|
740
|
+
.next()
|
741
|
+
.next('input')
|
742
|
+
.each(select)
|
743
|
+
;
|
744
|
+
} catch(er){}
|
745
|
+
}
|
746
|
+
} else if(!e.shiftKey && !e.crtlKey && e.keyCode == 9 && (isStopped === true || (isStopped && !$.prop(this, 'value')))){
|
747
|
+
e.preventDefault();
|
748
|
+
}
|
749
|
+
}
|
750
|
+
}
|
751
|
+
})()
|
752
|
+
};
|
753
|
+
var mouseDownInit = function(){
|
754
|
+
if(!o.disabled && !isFocused){
|
755
|
+
that.element.getShadowFocusElement().focus();
|
756
|
+
}
|
757
|
+
preventBlur.set();
|
758
|
+
|
759
|
+
return false;
|
760
|
+
};
|
761
|
+
|
762
|
+
preventBlur.set = (function(){
|
763
|
+
var timer;
|
764
|
+
var reset = function(){
|
765
|
+
preventBlur.prevent = false;
|
766
|
+
};
|
767
|
+
return function(){
|
768
|
+
clearTimeout(timer);
|
769
|
+
preventBlur.prevent = true;
|
770
|
+
setTimeout(reset, 9);
|
771
|
+
};
|
772
|
+
})();
|
773
|
+
|
774
|
+
['stepUp', 'stepDown'].forEach(function(name){
|
775
|
+
step[name] = function(factor){
|
776
|
+
if(!o.disabled && !o.readonly){
|
777
|
+
if(!isFocused){
|
778
|
+
mouseDownInit();
|
779
|
+
}
|
780
|
+
var ret = false;
|
781
|
+
if (!factor) {
|
782
|
+
factor = 1;
|
783
|
+
}
|
784
|
+
try {
|
785
|
+
that.elemHelper[name](factor);
|
786
|
+
ret = that.elemHelper.prop('value');
|
787
|
+
that.value(ret);
|
788
|
+
eventTimer.call('input', ret);
|
789
|
+
} catch (er) {}
|
790
|
+
return ret;
|
791
|
+
}
|
792
|
+
};
|
793
|
+
});
|
794
|
+
|
795
|
+
|
796
|
+
|
797
|
+
this.buttonWrapper.on('mousedown', mouseDownInit);
|
798
|
+
|
799
|
+
this.setInput = function(value){
|
800
|
+
that.value(value);
|
801
|
+
eventTimer.call('input', value);
|
802
|
+
};
|
803
|
+
this.setChange = function(value){
|
804
|
+
that.setInput(value);
|
805
|
+
eventTimer.call('change', value);
|
806
|
+
};
|
807
|
+
|
808
|
+
|
809
|
+
|
810
|
+
this.inputElements.on(elementEvts);
|
811
|
+
|
812
|
+
if(!o.noSpinbtn){
|
813
|
+
spinEvents[$.fn.mwheelIntent ? 'mwheelIntent' : 'mousewheel'] = function(e, delta){
|
814
|
+
if(delta && isFocused && !o.disabled){
|
815
|
+
step[delta > 0 ? 'stepUp' : 'stepDown']();
|
816
|
+
e.preventDefault();
|
817
|
+
}
|
818
|
+
};
|
819
|
+
spinEvents.keydown = function(e){
|
820
|
+
if(o.list || e.isDefaultPrevented() || $.attr(this, 'list')){return;}
|
821
|
+
var stepped = true;
|
822
|
+
var code = e.keyCode;
|
823
|
+
if (code == 38) {
|
824
|
+
step.stepUp();
|
825
|
+
} else if (code == 40) {
|
826
|
+
step.stepDown();
|
827
|
+
} else {
|
828
|
+
stepped = false;
|
829
|
+
}
|
830
|
+
if(stepped){
|
831
|
+
e.preventDefault();
|
832
|
+
}
|
833
|
+
};
|
834
|
+
|
835
|
+
spinElement.attr({'autocomplete': 'off', role: 'spinbutton'}).on(spinEvents);
|
836
|
+
}
|
837
|
+
|
838
|
+
|
839
|
+
if(!o.splitInput){
|
840
|
+
$(document).on('wslocalechange',function(){
|
841
|
+
if(o.value){
|
842
|
+
that.value(o.value);
|
843
|
+
}
|
844
|
+
|
845
|
+
if(placeholderFormat[that.type] && o.placeholder){
|
846
|
+
that.placeholder(o.placeholder);
|
847
|
+
}
|
848
|
+
});
|
849
|
+
} else {
|
850
|
+
$(document).onTrigger('wslocalechange',function(){
|
851
|
+
that.reorderInputs();
|
852
|
+
});
|
853
|
+
}
|
854
|
+
|
855
|
+
$('.step-up', this.buttonWrapper)
|
856
|
+
.on({
|
857
|
+
'mousepressstart mousepressend': mousePress,
|
858
|
+
'mousedown mousepress': function(e){
|
859
|
+
step.stepUp();
|
860
|
+
}
|
861
|
+
})
|
862
|
+
;
|
863
|
+
$('.step-down', this.buttonWrapper)
|
864
|
+
.on({
|
865
|
+
'mousepressstart mousepressend': mousePress,
|
866
|
+
'mousedown mousepress': function(e){
|
867
|
+
step.stepDown();
|
868
|
+
}
|
869
|
+
})
|
870
|
+
;
|
871
|
+
initChangeEvents();
|
872
|
+
}
|
873
|
+
};
|
874
|
+
|
875
|
+
['readonly', 'disabled'].forEach(function(name){
|
876
|
+
spinBtnProto[name] = function(val){
|
877
|
+
if(this.options[name] != val || !this._init){
|
878
|
+
this.options[name] = !!val;
|
879
|
+
if(name == 'readonly' && this.options.noInput){
|
880
|
+
this.element
|
881
|
+
.prop(name, true)
|
882
|
+
.attr({'aria-readonly': this.options[name]})
|
883
|
+
;
|
884
|
+
} else {
|
885
|
+
this.element.prop(name, this.options[name]);
|
886
|
+
}
|
887
|
+
this.buttonWrapper[this.options[name] ? 'addClass' : 'removeClass']('ws-'+name);
|
888
|
+
}
|
889
|
+
};
|
890
|
+
});
|
891
|
+
|
892
|
+
|
893
|
+
$.fn.spinbtnUI = function(opts){
|
894
|
+
opts = $.extend({
|
895
|
+
monthNames: 'monthNames',
|
896
|
+
size: 1,
|
897
|
+
startView: 0
|
898
|
+
}, opts);
|
899
|
+
return this.each(function(){
|
900
|
+
$.webshims.objectCreate(spinBtnProto, {
|
901
|
+
element: {
|
902
|
+
value: $(this)
|
903
|
+
}
|
904
|
+
}, opts);
|
905
|
+
});
|
906
|
+
};
|
907
|
+
})();
|
908
|
+
|
909
|
+
(function(){
|
910
|
+
var picker = {};
|
911
|
+
var disable = {
|
912
|
+
|
913
|
+
};
|
914
|
+
|
915
|
+
var getDateArray = function(date){
|
916
|
+
var ret = [date.getFullYear(), addZero(date.getMonth() + 1), addZero(date.getDate())];
|
917
|
+
ret.month = ret[0]+'-'+ret[1];
|
918
|
+
ret.date = ret[0]+'-'+ret[1]+'-'+ret[2];
|
919
|
+
return ret;
|
920
|
+
};
|
921
|
+
var today = getDateArray(new Date());
|
11
922
|
|
12
|
-
var
|
13
|
-
var
|
14
|
-
|
15
|
-
|
923
|
+
var _setFocus = function(element, _noFocus){
|
924
|
+
var setFocus, that;
|
925
|
+
element = $(element || this.activeButton);
|
926
|
+
this.activeButton.attr({tabindex: '-1', 'aria-selected': 'false'});
|
927
|
+
this.activeButton = element.attr({tabindex: '0', 'aria-selected': 'true'});
|
928
|
+
this.index = this.buttons.index(this.activeButton[0]);
|
929
|
+
|
930
|
+
clearTimeout(this.timer);
|
931
|
+
|
932
|
+
if(!this.popover.openedByFocus && !_noFocus){
|
933
|
+
that = this;
|
934
|
+
setFocus = function(noTrigger){
|
935
|
+
clearTimeout(that.timer);
|
936
|
+
that.timer = setTimeout(function(){
|
937
|
+
if(element[0]){
|
938
|
+
element[0].focus();
|
939
|
+
if(noTrigger !== true && !element.is(':focus')){
|
940
|
+
setFocus(true);
|
941
|
+
}
|
942
|
+
}
|
943
|
+
}, that.popover.isVisible ? 99 : 360);
|
944
|
+
};
|
945
|
+
this.popover.activateElement(element);
|
946
|
+
setFocus();
|
16
947
|
}
|
17
948
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
949
|
+
};
|
950
|
+
|
951
|
+
var _initialFocus = function(){
|
952
|
+
var sel;
|
953
|
+
if(this.popover.navedInitFocus){
|
954
|
+
sel = this.popover.navedInitFocus.sel || this.popover.navedInitFocus;
|
955
|
+
if((!this.activeButton || !this.activeButton[0]) && this.buttons[sel]){
|
956
|
+
this.activeButton = this.buttons[sel]();
|
957
|
+
} else if(sel){
|
958
|
+
this.activeButton = $(sel, this.element);
|
959
|
+
}
|
960
|
+
|
961
|
+
if(!this.activeButton[0] && this.popover.navedInitFocus.alt){
|
962
|
+
this.activeButton = this.buttons[this.popover.navedInitFocus.alt]();
|
963
|
+
}
|
964
|
+
}
|
965
|
+
|
966
|
+
if(!this.activeButton || !this.activeButton[0]){
|
967
|
+
this.activeButton = this.buttons.filter('.checked-value');
|
968
|
+
}
|
22
969
|
|
970
|
+
if(!this.activeButton[0]){
|
971
|
+
this.activeButton = this.buttons.filter('.this-value');
|
972
|
+
}
|
973
|
+
if(!this.activeButton[0]){
|
974
|
+
this.activeButton = this.buttons.eq(0);
|
975
|
+
}
|
976
|
+
|
977
|
+
this.setFocus(this.activeButton, this.opts.noFocus);
|
23
978
|
};
|
24
979
|
|
25
980
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
981
|
+
webshims.ListBox = function (element, popover, opts){
|
982
|
+
this.element = $('ul', element);
|
983
|
+
this.popover = popover;
|
984
|
+
this.opts = opts || {};
|
985
|
+
this.buttons = $('button:not(:disabled)', this.element);
|
986
|
+
|
987
|
+
|
988
|
+
this.ons(this);
|
989
|
+
this._initialFocus();
|
990
|
+
};
|
991
|
+
|
992
|
+
webshims.ListBox.prototype = {
|
993
|
+
setFocus: _setFocus,
|
994
|
+
_initialFocus: _initialFocus,
|
995
|
+
prev: function(){
|
996
|
+
var index = this.index - 1;
|
997
|
+
if(index < 0){
|
998
|
+
if(this.opts.prev){
|
999
|
+
this.popover.navedInitFocus = 'last';
|
1000
|
+
this.popover.actionFn(this.opts.prev);
|
1001
|
+
this.popover.navedInitFocus = false;
|
1002
|
+
}
|
1003
|
+
} else {
|
1004
|
+
this.setFocus(this.buttons.eq(index));
|
1005
|
+
}
|
1006
|
+
},
|
1007
|
+
next: function(){
|
1008
|
+
var index = this.index + 1;
|
1009
|
+
if(index >= this.buttons.length){
|
1010
|
+
if(this.opts.next){
|
1011
|
+
this.popover.navedInitFocus = 'first';
|
1012
|
+
this.popover.actionFn(this.opts.next);
|
1013
|
+
this.popover.navedInitFocus = false;
|
1014
|
+
}
|
1015
|
+
} else {
|
1016
|
+
this.setFocus(this.buttons.eq(index));
|
43
1017
|
}
|
44
|
-
}
|
45
|
-
|
46
|
-
|
1018
|
+
},
|
1019
|
+
ons: function(that){
|
1020
|
+
this.element
|
1021
|
+
.on({
|
1022
|
+
'keydown': function(e){
|
1023
|
+
var handled;
|
1024
|
+
var key = e.keyCode;
|
1025
|
+
if(e.ctrlKey){return;}
|
1026
|
+
if(key == 36 || key == 33){
|
1027
|
+
that.setFocus(that.buttons.eq(0));
|
1028
|
+
handled = true;
|
1029
|
+
} else if(key == 34 || key == 35){
|
1030
|
+
that.setFocus(that.buttons.eq(that.buttons.length - 1));
|
1031
|
+
handled = true;
|
1032
|
+
} else if(key == 38 || key == 37){
|
1033
|
+
that.prev();
|
1034
|
+
handled = true;
|
1035
|
+
} else if(key == 40 || key == 39){
|
1036
|
+
that.next();
|
1037
|
+
handled = true;
|
1038
|
+
}
|
1039
|
+
if(handled){
|
1040
|
+
return false;
|
1041
|
+
}
|
1042
|
+
}
|
1043
|
+
})
|
1044
|
+
;
|
47
1045
|
}
|
48
1046
|
};
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
if(
|
60
|
-
|
1047
|
+
|
1048
|
+
webshims.Grid = function (element, popover, opts){
|
1049
|
+
this.element = $('tbody', element);
|
1050
|
+
this.popover = popover;
|
1051
|
+
this.opts = opts || {};
|
1052
|
+
this.buttons = $('button:not(:disabled,.othermonth)', this.element);
|
1053
|
+
|
1054
|
+
this.ons(this);
|
1055
|
+
|
1056
|
+
this._initialFocus();
|
1057
|
+
if(this.popover.openedByFocus){
|
1058
|
+
this.popover.activeElement = this.activeButton;
|
1059
|
+
}
|
1060
|
+
};
|
1061
|
+
|
1062
|
+
|
1063
|
+
|
1064
|
+
webshims.Grid.prototype = {
|
1065
|
+
setFocus: _setFocus,
|
1066
|
+
_initialFocus: _initialFocus,
|
1067
|
+
|
1068
|
+
first: function(){
|
1069
|
+
this.setFocus(this.buttons.eq(0));
|
1070
|
+
},
|
1071
|
+
last: function(){
|
1072
|
+
this.setFocus(this.buttons.eq(this.buttons.length - 1));
|
1073
|
+
},
|
1074
|
+
upPage: function(){
|
1075
|
+
$('.ws-picker-header > button:not(:disabled)', this.popover.element).trigger('click');
|
1076
|
+
},
|
1077
|
+
downPage: function(){
|
1078
|
+
this.activeButton.filter(':not([data-action="changeInput"])').trigger('click');
|
1079
|
+
},
|
1080
|
+
ons: function(that){
|
1081
|
+
this.element
|
1082
|
+
.on({
|
1083
|
+
'keydown': function(e){
|
1084
|
+
var handled;
|
1085
|
+
var key = e.keyCode;
|
1086
|
+
|
1087
|
+
if(e.shiftKey){return;}
|
1088
|
+
|
1089
|
+
if((e.ctrlKey && key == 40)){
|
1090
|
+
handled = 'downPage';
|
1091
|
+
} else if((e.ctrlKey && key == 38)){
|
1092
|
+
handled = 'upPage';
|
1093
|
+
} else if(key == 33 || (e.ctrlKey && key == 37)){
|
1094
|
+
handled = 'prevPage';
|
1095
|
+
} else if(key == 34 || (e.ctrlKey && key == 39)){
|
1096
|
+
handled = 'nextPage';
|
1097
|
+
} else if(e.keyCode == 36 || e.keyCode == 33){
|
1098
|
+
handled = 'first';
|
1099
|
+
} else if(e.keyCode == 35){
|
1100
|
+
handled = 'last';
|
1101
|
+
} else if(e.keyCode == 38){
|
1102
|
+
handled = 'up';
|
1103
|
+
} else if(e.keyCode == 37){
|
1104
|
+
handled = 'prev';
|
1105
|
+
} else if(e.keyCode == 40){
|
1106
|
+
handled = 'down';
|
1107
|
+
} else if(e.keyCode == 39){
|
1108
|
+
handled = 'next';
|
1109
|
+
}
|
1110
|
+
if(handled){
|
1111
|
+
that[handled]();
|
1112
|
+
return false;
|
1113
|
+
}
|
1114
|
+
}
|
1115
|
+
})
|
1116
|
+
;
|
61
1117
|
}
|
1118
|
+
};
|
1119
|
+
$.each({
|
1120
|
+
prevPage: {get: 'last', action: 'prev'},
|
1121
|
+
nextPage: {get: 'first', action: 'next'}
|
1122
|
+
}, function(name, val){
|
1123
|
+
webshims.Grid.prototype[name] = function(){
|
1124
|
+
if(this.opts[val.action]){
|
1125
|
+
this.popover.navedInitFocus = {
|
1126
|
+
sel: 'button[data-id="'+ this.activeButton.attr('data-id') +'"]:not(:disabled,.othermonth)',
|
1127
|
+
alt: val.get
|
1128
|
+
};
|
1129
|
+
this.popover.actionFn(this.opts[val.action]);
|
1130
|
+
this.popover.navedInitFocus = false;
|
1131
|
+
}
|
1132
|
+
};
|
62
1133
|
});
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
orig.off('invalid.replacedwidgetbubble').on('invalid.replacedwidgetbubble', function(evt){
|
115
|
-
if(!e.isInvalidUIPrevented() && !evt.isDefaultPrevented()){
|
116
|
-
webshims.validityAlert.showFor( e.target );
|
117
|
-
e.preventDefault();
|
118
|
-
evt.preventDefault();
|
1134
|
+
|
1135
|
+
$.each({
|
1136
|
+
up: {traverse: 'prevAll', get: 'last', action: 'prev', reverse: true},
|
1137
|
+
down: {traverse: 'nextAll', get: 'first', action: 'next'}
|
1138
|
+
}, function(name, val){
|
1139
|
+
webshims.Grid.prototype[name] = function(){
|
1140
|
+
var cellIndex = this.activeButton.closest('td').prop('cellIndex');
|
1141
|
+
var sel = 'td:nth-child('+(cellIndex + 1)+') button:not(:disabled,.othermonth)';
|
1142
|
+
var button = this.activeButton.closest('tr')[val.traverse]();
|
1143
|
+
|
1144
|
+
if(val.reverse){
|
1145
|
+
button = $(button.get().reverse());
|
1146
|
+
}
|
1147
|
+
button = button.find(sel)[val.get]();
|
1148
|
+
|
1149
|
+
if(!button[0]){
|
1150
|
+
if(this.opts[val.action]){
|
1151
|
+
this.popover.navedInitFocus = sel+':'+val.get;
|
1152
|
+
this.popover.actionFn(this.opts[val.action]);
|
1153
|
+
this.popover.navedInitFocus = false;
|
1154
|
+
}
|
1155
|
+
} else {
|
1156
|
+
this.setFocus(button.eq(0));
|
1157
|
+
}
|
1158
|
+
};
|
1159
|
+
});
|
1160
|
+
|
1161
|
+
$.each({
|
1162
|
+
prev: {traverse: 'prevAll',get: 'last', reverse: true},
|
1163
|
+
next: {traverse: 'nextAll', get: 'first'}
|
1164
|
+
}, function(name, val){
|
1165
|
+
webshims.Grid.prototype[name] = function(){
|
1166
|
+
var sel = 'button:not(:disabled,.othermonth)';
|
1167
|
+
var button = this.activeButton.closest('td')[val.traverse]('td');
|
1168
|
+
if(val.reverse){
|
1169
|
+
button = $(button.get().reverse());
|
1170
|
+
}
|
1171
|
+
button = button.find(sel)[val.get]();
|
1172
|
+
if(!button[0]){
|
1173
|
+
button = this.activeButton.closest('tr')[val.traverse]('tr');
|
1174
|
+
if(val.reverse){
|
1175
|
+
button = $(button.get().reverse());
|
1176
|
+
}
|
1177
|
+
button = button.find(sel)[val.get]();
|
1178
|
+
}
|
1179
|
+
|
1180
|
+
if(!button[0]){
|
1181
|
+
if(this.opts[name]){
|
1182
|
+
this.popover.navedInitFocus = val.get;
|
1183
|
+
this.popover.actionFn(this.opts[name]);
|
1184
|
+
this.popover.navedInitFocus = false;
|
119
1185
|
}
|
120
|
-
orig.off('invalid.replacedwidgetbubble');
|
121
|
-
});
|
122
|
-
});
|
123
|
-
}
|
124
|
-
var i, prop;
|
125
|
-
var focusElement = $('input, span.ui-slider-handle', shim);
|
126
|
-
var attrs = orig[0].attributes;
|
127
|
-
for(i in options.copyAttrs){
|
128
|
-
if ((prop = attrs[i]) && prop.specified) {
|
129
|
-
if(focusAttrs[i] && focusElement[0]){
|
130
|
-
focusElement.attr(i, prop.nodeValue);
|
131
1186
|
} else {
|
132
|
-
|
1187
|
+
this.setFocus(button.eq(0));
|
133
1188
|
}
|
1189
|
+
};
|
1190
|
+
});
|
1191
|
+
|
1192
|
+
picker.getWeek = function(date){
|
1193
|
+
var onejan = new Date(date.getFullYear(),0,1);
|
1194
|
+
return Math.ceil((((date - onejan) / 86400000) + onejan.getDay()+1)/7);
|
1195
|
+
};
|
1196
|
+
picker.getYearList = function(value, data){
|
1197
|
+
var j, i, val, disabled, lis, prevDisabled, nextDisabled, classStr, classArray, start;
|
1198
|
+
|
1199
|
+
|
1200
|
+
var size = data.options.size;
|
1201
|
+
var max = data.options.max.split('-');
|
1202
|
+
var min = data.options.min.split('-');
|
1203
|
+
var currentValue = data.options.value.split('-');
|
1204
|
+
var xthCorrect = 0;
|
1205
|
+
var enabled = 0;
|
1206
|
+
var str = '';
|
1207
|
+
var rowNum = 0;
|
1208
|
+
|
1209
|
+
if(data.options.useDecadeBase == 'max' && max[0]){
|
1210
|
+
xthCorrect = 11 - (max[0] % 12);
|
1211
|
+
} else if(data.options.useDecadeBase == 'min' && min[0]){
|
1212
|
+
xthCorrect = 11 - (min[0] % 12);
|
134
1213
|
}
|
135
|
-
|
1214
|
+
|
1215
|
+
value = value[0] * 1;
|
1216
|
+
start = value - ((value + xthCorrect) % (12 * size));
|
1217
|
+
|
1218
|
+
|
1219
|
+
|
1220
|
+
for(j = 0; j < size; j++){
|
1221
|
+
if(j){
|
1222
|
+
start += 12;
|
1223
|
+
} else {
|
1224
|
+
prevDisabled = picker.isInRange([start-1], max, min) ? {'data-action': 'setYearList','value': start-1} : false;
|
1225
|
+
}
|
1226
|
+
|
1227
|
+
str += '<div class="year-list picker-list ws-index-'+ j +'"><div class="ws-picker-header"><button disabled="disabled">'+ start +' – '+(start + 11)+'</button></div>';
|
1228
|
+
lis = [];
|
1229
|
+
for(i = 0; i < 12; i++){
|
1230
|
+
val = start + i ;
|
1231
|
+
classArray = [];
|
1232
|
+
if( !picker.isInRange([val], max, min) ){
|
1233
|
+
disabled = ' disabled=""';
|
1234
|
+
} else {
|
1235
|
+
disabled = '';
|
1236
|
+
enabled++;
|
1237
|
+
}
|
1238
|
+
|
1239
|
+
if(val == today[0]){
|
1240
|
+
classArray.push('this-value');
|
1241
|
+
}
|
1242
|
+
|
1243
|
+
if(currentValue[0] == val){
|
1244
|
+
classArray.push('checked-value');
|
1245
|
+
}
|
1246
|
+
|
1247
|
+
classStr = classArray.length ? ' class="'+ (classArray.join(' ')) +'"' : '';
|
1248
|
+
|
1249
|
+
if(i && !(i % 3)){
|
1250
|
+
rowNum++;
|
1251
|
+
lis.push('</tr><tr class="ws-row-'+ rowNum +'">');
|
1252
|
+
}
|
1253
|
+
lis.push('<td class="ws-item-'+ i +'" role="presentation"><button data-id="year-'+ i +'" type="button"'+ disabled + classStr +' data-action="setMonthList" value="'+val+'" tabindex="-1" role="gridcell">'+val+'</button></td>');
|
1254
|
+
}
|
1255
|
+
if(j == size - 1){
|
1256
|
+
nextDisabled = picker.isInRange([val+1], max, min) ? {'data-action': 'setYearList','value': val+1} : false;
|
1257
|
+
}
|
1258
|
+
str += '<div class="picker-grid"><table role="grid" aria-label="'+ start +' – '+(start + 11)+'"><tbody><tr class="ws-row-0">'+ (lis.join(''))+ '</tr></tbody></table></div></div>';
|
1259
|
+
}
|
1260
|
+
|
1261
|
+
return {
|
1262
|
+
enabled: enabled,
|
1263
|
+
main: str,
|
1264
|
+
next: nextDisabled,
|
1265
|
+
prev: prevDisabled,
|
1266
|
+
type: 'Grid'
|
1267
|
+
};
|
1268
|
+
};
|
136
1269
|
|
137
|
-
var id = orig.attr('id'),
|
138
|
-
label = (id) ? $('label[for="'+ id +'"]', orig[0].form) : emptyJ
|
139
|
-
;
|
140
1270
|
|
1271
|
+
picker.getMonthList = function(value, data){
|
1272
|
+
|
1273
|
+
var j, i, name, val, disabled, lis, fullyDisabled, prevDisabled, nextDisabled, classStr, classArray;
|
1274
|
+
var o = data.options;
|
1275
|
+
var size = o.size;
|
1276
|
+
var max = o.max.split('-');
|
1277
|
+
var min = o.min.split('-');
|
1278
|
+
var currentValue = o.value.split('-');
|
1279
|
+
var enabled = 0;
|
1280
|
+
var rowNum = 0;
|
1281
|
+
var str = '';
|
1282
|
+
|
1283
|
+
value = value[0] - Math.floor((size - 1) / 2);
|
1284
|
+
for(j = 0; j < size; j++){
|
1285
|
+
if(j){
|
1286
|
+
value++;
|
1287
|
+
} else {
|
1288
|
+
prevDisabled = picker.isInRange([value-1], max, min) ? {'data-action': 'setMonthList','value': value-1} : false;
|
1289
|
+
}
|
1290
|
+
if(j == size - 1){
|
1291
|
+
nextDisabled = picker.isInRange([value+1], max, min) ? {'data-action': 'setMonthList','value': value+1} : false;
|
1292
|
+
}
|
1293
|
+
lis = [];
|
1294
|
+
|
1295
|
+
if( !picker.isInRange([value, '01'], max, min) && !picker.isInRange([value, '12'], max, min)){
|
1296
|
+
disabled = ' disabled=""';
|
1297
|
+
fullyDisabled = true;
|
1298
|
+
} else {
|
1299
|
+
fullyDisabled = false;
|
1300
|
+
disabled = '';
|
1301
|
+
}
|
1302
|
+
|
1303
|
+
if(o.minView >= 1){
|
1304
|
+
disabled = ' disabled=""';
|
1305
|
+
}
|
1306
|
+
|
1307
|
+
str += '<div class="month-list picker-list ws-index-'+ j +'"><div class="ws-picker-header">';
|
1308
|
+
|
1309
|
+
str += o.selectNav ?
|
1310
|
+
'<select data-action="setMonthList" class="year-select">'+ picker.createYearSelect(value, max, min).join('') +'</select>' :
|
1311
|
+
'<button data-action="setYearList"'+disabled+' value="'+ value +'" tabindex="-1">'+ value +'</button>';
|
1312
|
+
str += '</div>';
|
1313
|
+
|
1314
|
+
for(i = 0; i < 12; i++){
|
1315
|
+
val = curCfg.date.monthkeys[i+1];
|
1316
|
+
name = (curCfg.date[o.monthNames] || curCfg.date.monthNames)[i];
|
1317
|
+
classArray = [];
|
1318
|
+
if(fullyDisabled || !picker.isInRange([value, val], max, min) ){
|
1319
|
+
disabled = ' disabled=""';
|
1320
|
+
} else {
|
1321
|
+
disabled = '';
|
1322
|
+
enabled++;
|
1323
|
+
}
|
1324
|
+
|
1325
|
+
if(value == today[0] && today[1] == val){
|
1326
|
+
classArray.push('this-value');
|
1327
|
+
}
|
1328
|
+
|
1329
|
+
if(currentValue[0] == value && currentValue[1] == val){
|
1330
|
+
classArray.push('checked-value');
|
1331
|
+
}
|
1332
|
+
|
1333
|
+
classStr = (classArray.length) ? ' class="'+ (classArray.join(' ')) +'"' : '';
|
1334
|
+
if(i && !(i % 3)){
|
1335
|
+
rowNum++;
|
1336
|
+
lis.push('</tr><tr class="ws-row-'+ rowNum +'">');
|
1337
|
+
}
|
1338
|
+
|
1339
|
+
lis.push('<td class="ws-item-'+ i +'" role="presentation"><button data-id="month-'+ i +'" type="button"'+ disabled + classStr +' data-action="'+ (data.type == 'month' ? 'changeInput' : 'setDayList' ) +'" value="'+value+'-'+val+'" tabindex="-1" role="gridcell" aria-label="'+ curCfg.date.monthNames[i] +'">'+name+'</button></td>');
|
1340
|
+
|
1341
|
+
}
|
1342
|
+
|
1343
|
+
str += '<div class="picker-grid"><table role="grid" aria-label="'+value+'"><tbody><tr class="ws-row-0">'+ (lis.join(''))+ '</tr></tbody></table></div></div>';
|
1344
|
+
}
|
1345
|
+
|
1346
|
+
return {
|
1347
|
+
enabled: enabled,
|
1348
|
+
main: str,
|
1349
|
+
prev: prevDisabled,
|
1350
|
+
next: nextDisabled,
|
1351
|
+
type: 'Grid'
|
1352
|
+
};
|
1353
|
+
};
|
141
1354
|
|
142
1355
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
1356
|
+
picker.getDayList = function(value, data){
|
1357
|
+
|
1358
|
+
var j, i, k, day, nDay, name, val, disabled, lis, prevDisabled, nextDisabled, addTr, week, rowNum;
|
1359
|
+
|
1360
|
+
var lastMotnh, curMonth, otherMonth, dateArray, monthName, fullMonthName, buttonStr, date2, classArray;
|
1361
|
+
var o = data.options;
|
1362
|
+
var size = o.size;
|
1363
|
+
var max = o.max.split('-');
|
1364
|
+
var min = o.min.split('-');
|
1365
|
+
var currentValue = o.value.split('-');
|
1366
|
+
var monthNames = curCfg.date[o.monthNamesHead] || curCfg.date[o.monthNames] || curCfg.date.monthNames;
|
1367
|
+
var enabled = 0;
|
1368
|
+
var str = [];
|
1369
|
+
var date = new Date(value[0], value[1] - 1, 1);
|
1370
|
+
|
1371
|
+
date.setMonth(date.getMonth() - Math.floor((size - 1) / 2));
|
1372
|
+
|
1373
|
+
for(j = 0; j < size; j++){
|
1374
|
+
date.setDate(1);
|
1375
|
+
lastMotnh = date.getMonth();
|
1376
|
+
rowNum = 0;
|
1377
|
+
if(!j){
|
1378
|
+
date2 = new Date(date.getTime());
|
1379
|
+
date2.setDate(-1);
|
1380
|
+
dateArray = getDateArray(date2);
|
1381
|
+
prevDisabled = picker.isInRange(dateArray, max, min) ? {'data-action': 'setDayList','value': dateArray[0]+'-'+dateArray[1]} : false;
|
1382
|
+
}
|
1383
|
+
|
1384
|
+
dateArray = getDateArray(date);
|
1385
|
+
|
1386
|
+
str.push('<div class="day-list picker-list ws-index-'+ j +'"><div class="ws-picker-header">');
|
1387
|
+
if( o.selectNav ){
|
1388
|
+
monthName = ['<select data-action="setDayList" class="month-select" tabindex="0">'+ picker.createMonthSelect(dateArray, max, min, monthNames).join('') +'</select>', '<select data-action="setDayList" class="year-select" tabindex="0">'+ picker.createYearSelect(dateArray[0], max, min, '-'+dateArray[1]).join('') +'</select>'];
|
1389
|
+
if(curCfg.date.showMonthAfterYear){
|
1390
|
+
monthName.reverse();
|
1391
|
+
}
|
1392
|
+
str.push( monthName.join(' ') );
|
1393
|
+
}
|
1394
|
+
|
1395
|
+
fullMonthName = [curCfg.date.monthNames[(dateArray[1] * 1) - 1], dateArray[0]];
|
1396
|
+
monthName = [monthNames[(dateArray[1] * 1) - 1], dateArray[0]];
|
1397
|
+
if(curCfg.date.showMonthAfterYear){
|
1398
|
+
monthName.reverse();
|
1399
|
+
fullMonthName.reverse();
|
1400
|
+
}
|
1401
|
+
|
1402
|
+
if(!data.options.selectNav) {
|
1403
|
+
str.push(
|
1404
|
+
'<button data-action="setMonthList"'+ (o.minView >= 2 ? ' disabled="" ' : '') +' value="'+ dateArray.date +'" tabindex="-1">'+ monthName.join(' ') +'</button>'
|
1405
|
+
);
|
1406
|
+
}
|
1407
|
+
|
1408
|
+
|
1409
|
+
str.push('</div><div class="picker-grid"><table role="grid" aria-label="'+ fullMonthName.join(' ') +'"><thead><tr>');
|
1410
|
+
|
1411
|
+
if(data.options.showWeek){
|
1412
|
+
str.push('<th class="week-header">'+ curCfg.date.weekHeader +'</th>');
|
1413
|
+
}
|
1414
|
+
for(k = curCfg.date.firstDay; k < curCfg.date.dayNamesShort.length; k++){
|
1415
|
+
str.push('<th class="day-'+ k +'"><abbr title="'+ curCfg.date.dayNames[k] +'">'+ curCfg.date.dayNamesShort[k] +'</abbr></th>');
|
1416
|
+
}
|
1417
|
+
k = curCfg.date.firstDay;
|
1418
|
+
while(k--){
|
1419
|
+
str.push('<th class="day-'+ k +'"><abbr title="'+ curCfg.date.dayNames[k] +'">'+ curCfg.date.dayNamesShort[k] +'</abbr></th>');
|
1420
|
+
}
|
1421
|
+
str.push('</tr></thead><tbody><tr class="ws-row-0">');
|
1422
|
+
|
1423
|
+
if(data.options.showWeek) {
|
1424
|
+
week = picker.getWeek(date);
|
1425
|
+
str.push('<td class="week-cell">'+ week +'</td>');
|
1426
|
+
}
|
1427
|
+
|
1428
|
+
for (i = 0; i < 99; i++) {
|
1429
|
+
addTr = (i && !(i % 7));
|
1430
|
+
curMonth = date.getMonth();
|
1431
|
+
otherMonth = lastMotnh != curMonth;
|
1432
|
+
day = date.getDay();
|
1433
|
+
classArray = [];
|
1434
|
+
|
1435
|
+
if(addTr && otherMonth ){
|
1436
|
+
str.push('</tr>');
|
1437
|
+
break;
|
1438
|
+
}
|
1439
|
+
if(addTr){
|
1440
|
+
rowNum++;
|
1441
|
+
str.push('</tr><tr class="ws-row-'+ rowNum +'">');
|
1442
|
+
if(data.options.showWeek) {
|
1443
|
+
week++;
|
1444
|
+
str.push('<td class="week-cell">'+ week +'</td>');
|
1445
|
+
}
|
1446
|
+
}
|
1447
|
+
|
1448
|
+
if(!i){
|
1449
|
+
|
1450
|
+
if(day != curCfg.date.firstDay){
|
1451
|
+
nDay = day - curCfg.date.firstDay;
|
1452
|
+
if(nDay < 0){
|
1453
|
+
nDay += 7;
|
1454
|
+
}
|
1455
|
+
date.setDate(date.getDate() - nDay);
|
1456
|
+
day = date.getDay();
|
1457
|
+
curMonth = date.getMonth();
|
1458
|
+
otherMonth = lastMotnh != curMonth;
|
1459
|
+
}
|
1460
|
+
}
|
1461
|
+
|
1462
|
+
dateArray = getDateArray(date);
|
1463
|
+
buttonStr = '<td role="presentation" class="day-'+ day +'"><button data-id="day-'+ date.getDate() +'" role="gridcell" data-action="changeInput" value="'+ (dateArray.join('-')) +'"';
|
1464
|
+
|
1465
|
+
if(otherMonth){
|
1466
|
+
classArray.push('othermonth');
|
1467
|
+
} else {
|
1468
|
+
classArray.push('day-'+date.getDate());
|
1469
|
+
}
|
1470
|
+
|
1471
|
+
if(dateArray[0] == today[0] && today[1] == dateArray[1] && today[2] == dateArray[2]){
|
1472
|
+
classArray.push('this-value');
|
1473
|
+
}
|
1474
|
+
|
1475
|
+
if(currentValue[0] == dateArray[0] && dateArray[1] == currentValue[1] && dateArray[2] == currentValue[2]){
|
1476
|
+
classArray.push('checked-value');
|
1477
|
+
}
|
1478
|
+
|
1479
|
+
if(classArray.length){
|
1480
|
+
buttonStr += ' class="'+ classArray.join(' ') +'"';
|
1481
|
+
}
|
1482
|
+
|
1483
|
+
if(!picker.isInRange(dateArray, max, min) || (data.options.disableDays && $.inArray(day, data.options.disableDays) != -1)){
|
1484
|
+
buttonStr += ' disabled=""';
|
1485
|
+
}
|
1486
|
+
|
1487
|
+
str.push(buttonStr+' tabindex="-1">'+ date.getDate() +'</button></td>');
|
1488
|
+
|
1489
|
+
date.setDate(date.getDate() + 1);
|
1490
|
+
}
|
1491
|
+
str.push('</tbody></table></div></div>');
|
1492
|
+
if(j == size - 1){
|
1493
|
+
dateArray = getDateArray(date);
|
1494
|
+
dateArray[2] = 1;
|
1495
|
+
nextDisabled = picker.isInRange(dateArray, max, min) ? {'data-action': 'setDayList','value': dateArray.date} : false;
|
1496
|
+
}
|
1497
|
+
}
|
1498
|
+
|
1499
|
+
|
1500
|
+
return {
|
1501
|
+
enabled: 9,
|
1502
|
+
main: str.join(''),
|
1503
|
+
prev: prevDisabled,
|
1504
|
+
next: nextDisabled,
|
1505
|
+
type: 'Grid'
|
1506
|
+
};
|
1507
|
+
};
|
1508
|
+
|
1509
|
+
picker.isInRange = function(values, max, min){
|
1510
|
+
var i;
|
1511
|
+
var ret = true;
|
1512
|
+
for(i = 0; i < values.length; i++){
|
1513
|
+
|
1514
|
+
if(min[i] && min[i] > values[i]){
|
1515
|
+
ret = false;
|
1516
|
+
break;
|
1517
|
+
} else if( !(min[i] && min[i] == values[i]) ){
|
1518
|
+
break;
|
1519
|
+
}
|
1520
|
+
}
|
1521
|
+
if(ret){
|
1522
|
+
for(i = 0; i < values.length; i++){
|
1523
|
+
|
1524
|
+
if((max[i] && max[i] < values[i])){
|
1525
|
+
ret = false;
|
1526
|
+
break;
|
1527
|
+
} else if( !(max[i] && max[i] == values[i]) ){
|
1528
|
+
break;
|
1529
|
+
}
|
1530
|
+
}
|
1531
|
+
}
|
1532
|
+
return ret;
|
1533
|
+
};
|
149
1534
|
|
150
|
-
|
1535
|
+
picker.createMonthSelect = function(value, max, min, monthNames){
|
1536
|
+
if(!monthNames){
|
1537
|
+
monthNames = curCfg.date.monthNames;
|
1538
|
+
}
|
1539
|
+
|
1540
|
+
var selected;
|
1541
|
+
var i = 0;
|
1542
|
+
var options = [];
|
1543
|
+
var tempVal = value[1]-1;
|
1544
|
+
for(; i < monthNames.length; i++){
|
1545
|
+
selected = tempVal == i ? ' selected=""' : '';
|
1546
|
+
if(selected || picker.isInRange([value[0], i+1], max, min)){
|
1547
|
+
options.push('<option value="'+ value[0]+'-'+addZero(i+1) + '"'+selected+'>'+ monthNames[i] +'</option>');
|
1548
|
+
}
|
1549
|
+
}
|
1550
|
+
return options;
|
1551
|
+
};
|
151
1552
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
1553
|
+
picker.createYearSelect = function(value, max, min, valueAdd){
|
1554
|
+
|
1555
|
+
var temp;
|
1556
|
+
var goUp = true;
|
1557
|
+
var goDown = true;
|
1558
|
+
var options = ['<option selected="">'+ value + '</option>'];
|
1559
|
+
var i = 0;
|
1560
|
+
if(!valueAdd){
|
1561
|
+
valueAdd = '';
|
1562
|
+
}
|
1563
|
+
while(i < 8 && (goUp || goDown)){
|
1564
|
+
i++;
|
1565
|
+
temp = value-i;
|
1566
|
+
if(goUp && picker.isInRange([temp], max, min)){
|
1567
|
+
options.unshift('<option value="'+ (temp+valueAdd) +'">'+ temp +'</option>');
|
1568
|
+
} else {
|
1569
|
+
goUp = false;
|
156
1570
|
}
|
157
|
-
|
158
|
-
|
1571
|
+
temp = value + i;
|
1572
|
+
if(goDown && picker.isInRange([temp], max, min)){
|
1573
|
+
options.push('<option value="'+ (temp+valueAdd) +'">'+ temp +'</option>');
|
1574
|
+
} else {
|
1575
|
+
goDown = false;
|
1576
|
+
}
|
1577
|
+
}
|
1578
|
+
return options;
|
1579
|
+
};
|
1580
|
+
|
1581
|
+
var actions = {
|
1582
|
+
changeInput: function(val, popover, data){
|
1583
|
+
popover.stopOpen = true;
|
1584
|
+
data.element.getShadowFocusElement().focus();
|
1585
|
+
setTimeout(function(){
|
1586
|
+
popover.stopOpen = false;
|
1587
|
+
}, 9);
|
1588
|
+
popover.hide();
|
1589
|
+
data.setChange(val);
|
1590
|
+
}
|
1591
|
+
};
|
159
1592
|
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
1593
|
+
(function(){
|
1594
|
+
var retNames = function(name){
|
1595
|
+
return 'get'+name+'List';
|
1596
|
+
};
|
1597
|
+
var retSetNames = function(name){
|
1598
|
+
return 'set'+name+'List';
|
1599
|
+
};
|
1600
|
+
var stops = {
|
1601
|
+
date: 'Day',
|
1602
|
+
week: 'Day',
|
1603
|
+
month: 'Month'
|
1604
|
+
};
|
1605
|
+
|
1606
|
+
$.each({'setYearList' : ['Year', 'Month', 'Day'], 'setMonthList': ['Month', 'Day'], 'setDayList': ['Day']}, function(setName, names){
|
1607
|
+
var getNames = names.map(retNames);
|
1608
|
+
var setNames = names.map(retSetNames);
|
1609
|
+
actions[setName] = function(val, popover, data, startAt){
|
1610
|
+
val = ''+val;
|
1611
|
+
var o = data.options;
|
1612
|
+
var values = val.split('-');
|
1613
|
+
if(!startAt){
|
1614
|
+
startAt = 0;
|
1615
|
+
}
|
1616
|
+
$.each(getNames, function(i, item){
|
1617
|
+
if(i >= startAt){
|
1618
|
+
var content = picker[item](values, data);
|
1619
|
+
|
1620
|
+
if( values.length < 2 || content.enabled > 1 || stops[data.type] === names[i]){
|
1621
|
+
popover.element
|
1622
|
+
.attr({'data-currentview': setNames[i]})
|
1623
|
+
.addClass('ws-size-'+o.size)
|
1624
|
+
.data('pickercontent', {
|
1625
|
+
data: data,
|
1626
|
+
content: content,
|
1627
|
+
values: values
|
1628
|
+
})
|
1629
|
+
;
|
1630
|
+
popover.bodyElement.html(content.main);
|
1631
|
+
if(content.prev){
|
1632
|
+
popover.prevElement
|
1633
|
+
.attr(content.prev)
|
1634
|
+
.prop({disabled: false})
|
1635
|
+
;
|
1636
|
+
} else {
|
1637
|
+
popover.prevElement
|
1638
|
+
.removeAttr('data-action')
|
1639
|
+
.prop({disabled: true})
|
1640
|
+
;
|
1641
|
+
}
|
1642
|
+
if(content.next){
|
1643
|
+
popover.nextElement
|
1644
|
+
.attr(content.next)
|
1645
|
+
.prop({disabled: false})
|
1646
|
+
;
|
1647
|
+
} else {
|
1648
|
+
popover.nextElement
|
1649
|
+
.removeAttr('data-action')
|
1650
|
+
.prop({disabled: true})
|
1651
|
+
;
|
1652
|
+
}
|
1653
|
+
if(webshims[content.type]){
|
1654
|
+
new webshims[content.type](popover.bodyElement.children(), popover, content);
|
1655
|
+
}
|
1656
|
+
popover.element.trigger('pickerchange');
|
1657
|
+
return false;
|
1658
|
+
}
|
1659
|
+
}
|
1660
|
+
});
|
1661
|
+
};
|
165
1662
|
});
|
166
|
-
}
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
1663
|
+
})();
|
1664
|
+
|
1665
|
+
picker.commonInit = function(data, popover){
|
1666
|
+
var actionfn = function(e){
|
1667
|
+
if(!$(this).is('.othermonth') || $(this).css('cursor') == 'pointer'){
|
1668
|
+
popover.actionFn({
|
1669
|
+
'data-action': $.attr(this, 'data-action'),
|
1670
|
+
value: $(this).val() || $.attr(this, 'value')
|
1671
|
+
});
|
1672
|
+
}
|
1673
|
+
return false;
|
1674
|
+
};
|
1675
|
+
var id = new Date().getTime();
|
1676
|
+
var generateList = function(o, max, min){
|
1677
|
+
var options = [];
|
1678
|
+
var label = '';
|
1679
|
+
var labelId = '';
|
1680
|
+
o.options = data.getOptions() || {};
|
1681
|
+
$('div.ws-options', popover.contentElement).remove();
|
1682
|
+
$.each(o.options[0], function(val, label){
|
1683
|
+
var disabled = picker.isInRange(val.split('-'), o.maxS, o.minS) ?
|
1684
|
+
'' :
|
1685
|
+
' disabled="" '
|
1686
|
+
;
|
1687
|
+
options.push('<li role="presentation"><button value="'+ val +'" '+disabled+' data-action="changeInput" tabindex="-1" role="option">'+ (label || data.formatValue(val, false)) +'</button></li>');
|
1688
|
+
});
|
1689
|
+
if(options.length){
|
1690
|
+
id++;
|
1691
|
+
if(o.options[1]){
|
1692
|
+
labelId = 'datalist-'+id;
|
1693
|
+
label = '<h5 id="'+labelId+'">'+ o.options[1] +'</h5>';
|
1694
|
+
labelId = ' aria-labelledbyid="'+ labelId +'" ';
|
178
1695
|
}
|
1696
|
+
new webshims.ListBox($('<div class="ws-options">'+label+'<ul role="listbox" '+ labelId +'>'+ options.join('') +'</div>').insertAfter(popover.bodyElement)[0], popover, {noFocus: true});
|
179
1697
|
}
|
180
|
-
});
|
181
|
-
});
|
182
|
-
}
|
183
|
-
//date and datetime-local implement if we have to replace
|
184
|
-
if(!modernizrInputTypes['date'] /*||!modernizrInputTypes['datetime-local']*/ || options.replaceUI){
|
185
|
-
|
186
|
-
var datetimeFactor = {
|
187
|
-
trigger: [0.595,0.395],
|
188
|
-
normal: [0.565,0.425]
|
189
|
-
};
|
190
|
-
|
191
|
-
var configureDatePicker = function(elem, datePicker, change, _wrapper){
|
192
|
-
var stopFocusout;
|
193
|
-
var focusedOut;
|
194
|
-
var resetFocusHandler = function(){
|
195
|
-
data.dpDiv.unbind('mousedown.webshimsmousedownhandler');
|
196
|
-
stopFocusout = false;
|
197
|
-
focusedOut = false;
|
198
1698
|
};
|
199
|
-
var
|
200
|
-
.
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
1699
|
+
var updateContent = function(){
|
1700
|
+
if(popover.isDirty){
|
1701
|
+
var o = data.options;
|
1702
|
+
o.maxS = o.max.split('-');
|
1703
|
+
o.minS = o.min.split('-');
|
1704
|
+
|
1705
|
+
$('button', popover.buttonRow).each(function(){
|
1706
|
+
var text;
|
1707
|
+
if($(this).is('.ws-empty')){
|
1708
|
+
text = curCfg.date.clear;
|
1709
|
+
if(!text){
|
1710
|
+
text = formcfg[''].date.clear || 'clear';
|
1711
|
+
webshims.warn("could not get clear text from form cfg");
|
1712
|
+
}
|
1713
|
+
} else if($(this).is('.ws-current')){
|
1714
|
+
text = (curCfg[data.type] || {}).currentText;
|
1715
|
+
if(!text){
|
1716
|
+
text = (formcfg[''][[data.type]] || {}).currentText || 'current';
|
1717
|
+
webshims.warn("could not get currentText from form cfg");
|
1718
|
+
}
|
1719
|
+
$.prop(this, 'disabled', !picker.isInRange(today[data.type].split('-'), o.maxS, o.minS));
|
211
1720
|
}
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
resetFocusHandler();
|
218
|
-
datePicker.trigger('focusout');
|
219
|
-
datePicker.triggerHandler('blur');
|
220
|
-
} else {
|
221
|
-
resetFocusHandler();
|
1721
|
+
if(text){
|
1722
|
+
$(this).text(text).attr({'aria-label': text});
|
1723
|
+
if(webshims.assumeARIA){
|
1724
|
+
$.attr(this, 'aria-label', text);
|
1725
|
+
}
|
222
1726
|
}
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
1727
|
+
|
1728
|
+
});
|
1729
|
+
popover.nextElement.attr({'aria-label': curCfg.date.nextText});
|
1730
|
+
$('> span', popover.nextElement).html(curCfg.date.nextText);
|
1731
|
+
popover.prevElement.attr({'aria-label': curCfg.date.prevText});
|
1732
|
+
$('> span', popover.prevElement).html(curCfg.date.prevText);
|
1733
|
+
|
1734
|
+
generateList(o, o.maxS, o.minS);
|
1735
|
+
|
1736
|
+
}
|
1737
|
+
$('button.ws-empty', popover.buttonRow).prop('disabled', $.prop(data.orig, 'required'));
|
1738
|
+
popover.isDirty = false;
|
1739
|
+
};
|
1740
|
+
|
1741
|
+
popover.actionFn = function(obj){
|
1742
|
+
if(actions[obj['data-action']]){
|
1743
|
+
actions[obj['data-action']](obj.value, popover, data, 0);
|
1744
|
+
} else {
|
1745
|
+
webshims.warn('no action for '+ obj['data-action']);
|
1746
|
+
}
|
1747
|
+
};
|
1748
|
+
|
1749
|
+
popover.contentElement.html('<button class="ws-prev" tabindex="0"><span></span></button> <button class="ws-next" tabindex="0"><span></span></button><div class="ws-picker-body"></div><div class="ws-button-row"><button type="button" class="ws-current" data-action="changeInput" value="'+today[data.type]+'" tabindex="0"></button> <button type="button" data-action="changeInput" value="" class="ws-empty" tabindex="0"></button></div>');
|
1750
|
+
popover.nextElement = $('button.ws-next', popover.contentElement);
|
1751
|
+
popover.prevElement = $('button.ws-prev', popover.contentElement);
|
1752
|
+
popover.bodyElement = $('div.ws-picker-body', popover.contentElement);
|
1753
|
+
popover.buttonRow = $('div.ws-button-row', popover.contentElement);
|
1754
|
+
|
1755
|
+
popover.isDirty = true;
|
1756
|
+
|
1757
|
+
popover.contentElement
|
1758
|
+
.on('click', 'button[data-action]', actionfn)
|
1759
|
+
.on('change', 'select[data-action]', actionfn)
|
227
1760
|
;
|
228
|
-
data.dpDiv.addClass('input-date-datepicker-control');
|
229
1761
|
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
1762
|
+
popover.contentElement.on({
|
1763
|
+
keydown: function(e){
|
1764
|
+
if(e.keyCode == 9){
|
1765
|
+
var tabbable = $('[tabindex="0"]:not(:disabled)', this).filter(':visible');
|
1766
|
+
var index = tabbable.index(e.target);
|
1767
|
+
if(e.shiftKey && index <= 0){
|
1768
|
+
tabbable.last().focus();
|
1769
|
+
return false;
|
1770
|
+
}
|
1771
|
+
if(!e.shiftKey && index >= tabbable.length - 1){
|
1772
|
+
tabbable.first().focus();
|
1773
|
+
return false;
|
1774
|
+
}
|
1775
|
+
} else if(e.keyCode == 27){
|
1776
|
+
data.element.getShadowFocusElement().focus();
|
1777
|
+
popover.hide();
|
1778
|
+
return false;
|
1779
|
+
}
|
238
1780
|
}
|
239
1781
|
});
|
240
1782
|
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
// timeVal = ''
|
254
|
-
// ;
|
255
|
-
// if(options.lazyDate){
|
256
|
-
// var timer = $.data(datePicker[0], 'setDateLazyTimer');
|
257
|
-
// if(timer){
|
258
|
-
// clearTimeout(timer);
|
259
|
-
// $.removeData(datePicker[0], 'setDateLazyTimer');
|
260
|
-
// }
|
261
|
-
// }
|
262
|
-
//
|
263
|
-
// if(value){
|
264
|
-
// timeVal = $('input.input-datetime-local-time', date).prop('value') || '00:00';
|
265
|
-
// try {
|
266
|
-
// value = $.datepicker.parseDate(datePicker.datepicker('option', 'dateFormat'), value);
|
267
|
-
// value = (value) ? $.datepicker.formatDate('yy-mm-dd', value) : datePicker.prop('value');
|
268
|
-
// } catch (e) {value = datePicker.prop('value');}
|
269
|
-
// }
|
270
|
-
// value = (!value && !timeVal) ? '' : value + 'T' + timeVal;
|
271
|
-
// replaceInputUI['datetime-local'].blockAttr = true;
|
272
|
-
// elem.prop('value', value);
|
273
|
-
// replaceInputUI['datetime-local'].blockAttr = false;
|
274
|
-
// e.stopImmediatePropagation();
|
275
|
-
// triggerInlineForm(elem[0], 'input');
|
276
|
-
// triggerInlineForm(elem[0], 'change');
|
277
|
-
// },
|
278
|
-
// data = configureDatePicker(elem, datePicker, datePickerChange, date)
|
279
|
-
// ;
|
280
|
-
//
|
281
|
-
//
|
282
|
-
// $('input.input-datetime-local-time', date).bind('change', function(e){
|
283
|
-
// var timeVal = $.prop(this, 'value');
|
284
|
-
// var val = ['', ''];
|
285
|
-
// if(timeVal){
|
286
|
-
// val = elem.prop('value').split('T');
|
287
|
-
// if((val.length < 2 || !val[0])){
|
288
|
-
// val[0] = $.datepicker.formatDate('yy-mm-dd', new Date());
|
289
|
-
// }
|
290
|
-
// val[1] = timeVal;
|
291
|
-
//
|
292
|
-
// if (timeVal) {
|
293
|
-
// try {
|
294
|
-
// datePicker.prop('value', $.datepicker.formatDate(datePicker.datepicker('option', 'dateFormat'), $.datepicker.parseDate('yy-mm-dd', val[0])));
|
295
|
-
// } catch (e) {}
|
296
|
-
// }
|
297
|
-
// }
|
298
|
-
// val = (!val[0] && !val[1]) ? '' : val.join('T');
|
299
|
-
// replaceInputUI['datetime-local'].blockAttr = true;
|
300
|
-
// elem.prop('value', val);
|
301
|
-
// replaceInputUI['datetime-local'].blockAttr = false;
|
302
|
-
// e.stopImmediatePropagation();
|
303
|
-
// triggerInlineForm(elem[0], 'input');
|
304
|
-
// triggerInlineForm(elem[0], 'change');
|
305
|
-
// });
|
306
|
-
//
|
307
|
-
//
|
308
|
-
//
|
309
|
-
// date.attr('aria-labelledby', attr.label.attr('id'));
|
310
|
-
// attr.label.bind('click', function(){
|
311
|
-
// datePicker.focus();
|
312
|
-
// return false;
|
313
|
-
// });
|
314
|
-
//
|
315
|
-
// if(attr.css){
|
316
|
-
// date.css(attr.css);
|
317
|
-
// if(attr.outerWidth){
|
318
|
-
// date.outerWidth(attr.outerWidth);
|
319
|
-
// var width = date.width();
|
320
|
-
// var widthFac = (data.trigger[0]) ? datetimeFactor.trigger : datetimeFactor.normal;
|
321
|
-
// datePicker.outerWidth(Math.floor((width * widthFac[0]) - subPixelCorrect), true);
|
322
|
-
// $('input.input-datetime-local-time', date).outerWidth(Math.floor((width * widthFac[1]) - subPixelCorrect), true);
|
323
|
-
// if(data.trigger[0]){
|
324
|
-
// adjustInputWithBtn(datePicker, data.trigger);
|
325
|
-
// }
|
326
|
-
// }
|
327
|
-
// }
|
328
|
-
//
|
329
|
-
//
|
330
|
-
// };
|
331
|
-
//
|
332
|
-
// replaceInputUI['datetime-local'].attrs = {
|
333
|
-
// disabled: function(orig, shim, value){
|
334
|
-
// $('input.input-datetime-local-date', shim).prop('disabled', !!value);
|
335
|
-
// $('input.input-datetime-local-time', shim).prop('disabled', !!value);
|
336
|
-
// },
|
337
|
-
// step: function(orig, shim, value){
|
338
|
-
// $('input.input-datetime-local-time', shim).attr('step', value);
|
339
|
-
// },
|
340
|
-
// //ToDo: use min also on time
|
341
|
-
// min: function(orig, shim, value){
|
342
|
-
// if(value){
|
343
|
-
// value = (value.split) ? value.split('T') : [];
|
344
|
-
// try {
|
345
|
-
// value = $.datepicker.parseDate('yy-mm-dd', value[0]);
|
346
|
-
// } catch(e){value = false;}
|
347
|
-
// }
|
348
|
-
// if(!value){
|
349
|
-
// value = null;
|
350
|
-
// }
|
351
|
-
// $('input.input-datetime-local-date', shim).datepicker('option', 'minDate', value);
|
352
|
-
//
|
353
|
-
// },
|
354
|
-
// //ToDo: use max also on time
|
355
|
-
// max: function(orig, shim, value){
|
356
|
-
// if(value){
|
357
|
-
// value = (value.split) ? value.split('T') : [];
|
358
|
-
// try {
|
359
|
-
// value = $.datepicker.parseDate('yy-mm-dd', value[0]);
|
360
|
-
// } catch(e){value = false;}
|
361
|
-
// }
|
362
|
-
// if(!value){
|
363
|
-
// value = null;
|
364
|
-
// }
|
365
|
-
// $('input.input-datetime-local-date', shim).datepicker('option', 'maxDate', value);
|
366
|
-
// },
|
367
|
-
// value: function(orig, shim, value){
|
368
|
-
// var dateValue;
|
369
|
-
// if(value){
|
370
|
-
// value = (value.split) ? value.split('T') : [];
|
371
|
-
// try {
|
372
|
-
// dateValue = $.datepicker.parseDate('yy-mm-dd', value[0]);
|
373
|
-
// } catch(e){dateValue = false;}
|
374
|
-
// }
|
375
|
-
// if(dateValue){
|
376
|
-
// if(!replaceInputUI['datetime-local'].blockAttr){
|
377
|
-
// lazySetDate($('input.input-datetime-local-date', shim), dateValue);
|
378
|
-
// }
|
379
|
-
// $('input.input-datetime-local-time', shim).prop('value', value[1] || '00:00');
|
380
|
-
// } else {
|
381
|
-
// $('input.input-datetime-local-date', shim).prop('value', value[0] || '');
|
382
|
-
// $('input.input-datetime-local-time', shim).prop('value', value[1] || '');
|
383
|
-
// }
|
384
|
-
//
|
385
|
-
//
|
386
|
-
// }
|
387
|
-
// };
|
388
|
-
|
389
|
-
|
390
|
-
replaceInputUI.date = function(elem){
|
391
|
-
|
392
|
-
if(!$.fn.datepicker){return;}
|
393
|
-
var date = $('<input class="input-date" type="text" />'),
|
394
|
-
|
395
|
-
change = function(e){
|
396
|
-
|
397
|
-
replaceInputUI.date.blockAttr = true;
|
398
|
-
var value;
|
399
|
-
if(options.lazyDate){
|
400
|
-
var timer = $.data(date[0], 'setDateLazyTimer');
|
401
|
-
if(timer){
|
402
|
-
clearTimeout(timer);
|
403
|
-
$.removeData(date[0], 'setDateLazyTimer');
|
404
|
-
}
|
1783
|
+
$(data.options.orig).on('input', function(){
|
1784
|
+
var currentView;
|
1785
|
+
if(data.options.updateOnInput && popover.isVisible && data.options.value && (currentView = popover.element.attr('data-currentview'))){
|
1786
|
+
actions[currentView]( data.options.value , popover, data, 0);
|
1787
|
+
}
|
1788
|
+
});
|
1789
|
+
|
1790
|
+
data._propertyChange = (function(){
|
1791
|
+
var timer;
|
1792
|
+
var update = function(){
|
1793
|
+
if(popover.isVisible){
|
1794
|
+
updateContent();
|
405
1795
|
}
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
1796
|
+
};
|
1797
|
+
return function(prop){
|
1798
|
+
if(prop == 'value'){return;}
|
1799
|
+
popover.isDirty = true;
|
1800
|
+
if(popover.isVisible){
|
1801
|
+
clearTimeout(timer);
|
1802
|
+
timer = setTimeout(update, 9);
|
411
1803
|
}
|
412
|
-
|
413
|
-
|
414
|
-
e.stopImmediatePropagation();
|
415
|
-
triggerInlineForm(elem[0], 'input');
|
416
|
-
triggerInlineForm(elem[0], 'change');
|
417
|
-
},
|
418
|
-
data
|
419
|
-
|
420
|
-
;
|
1804
|
+
};
|
1805
|
+
})();
|
421
1806
|
|
422
|
-
|
1807
|
+
popover.activeElement = $([]);
|
423
1808
|
|
424
|
-
|
1809
|
+
popover.activateElement = function(element){
|
1810
|
+
element = $(element);
|
1811
|
+
if(element[0] != popover.activeElement[0]){
|
1812
|
+
popover.activeElement.removeClass('ws-focus');
|
1813
|
+
element.addClass('ws-focus');
|
1814
|
+
}
|
1815
|
+
popover.activeElement = element;
|
1816
|
+
};
|
1817
|
+
popover.element.on({
|
1818
|
+
wspopoverbeforeshow: function(){
|
1819
|
+
data.element.triggerHandler('wsupdatevalue');
|
1820
|
+
updateContent();
|
1821
|
+
}
|
1822
|
+
});
|
425
1823
|
|
426
|
-
$(document)
|
427
|
-
.onTrigger('updateshadowdom', function(){
|
428
|
-
if (data.trigger[0]) {
|
429
|
-
elem.css({display: ''});
|
430
|
-
if(elem[0].offsetWidth || elem[0].offsetHeight){
|
431
|
-
var attr = getDimensions(elem);
|
432
|
-
if (attr.css) {
|
433
|
-
date.css(attr.css);
|
434
|
-
if (attr.outerWidth) {
|
435
|
-
date.outerWidth(attr.outerWidth);
|
436
|
-
}
|
437
|
-
adjustInputWithBtn(date, data.trigger);
|
438
|
-
}
|
439
|
-
}
|
440
|
-
}
|
441
|
-
elem.css({display: 'none'});
|
442
|
-
})
|
443
|
-
;
|
1824
|
+
$(document).onTrigger('wslocalechange', data._propertyChange);
|
444
1825
|
};
|
445
1826
|
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
}
|
458
|
-
},
|
459
|
-
max: function(orig, shim, value){
|
460
|
-
try {
|
461
|
-
value = $.datepicker.parseDate('yy-mm-dd', value);
|
462
|
-
} catch(e){value = false;}
|
463
|
-
if(value){
|
464
|
-
$(shim).datepicker('option', 'maxDate', value);
|
465
|
-
}
|
466
|
-
},
|
467
|
-
'data-placeholder': function(orig, shim, value){
|
468
|
-
var hintValue = (value || '').split('-');
|
469
|
-
var dateFormat;
|
470
|
-
if(hintValue.length == 3){
|
471
|
-
value = $(shim).datepicker('option','dateFormat').replace('yy', hintValue[0]).replace('mm', hintValue[1]).replace('dd', hintValue[2]);
|
472
|
-
}
|
473
|
-
$.prop(shim, 'placeholder', value);
|
474
|
-
},
|
475
|
-
value: function(orig, shim, value){
|
476
|
-
if(!replaceInputUI.date.blockAttr){
|
477
|
-
try {
|
478
|
-
var dateValue = $.datepicker.parseDate('yy-mm-dd', value);
|
479
|
-
} catch(e){var dateValue = false;}
|
1827
|
+
picker._common = function(data){
|
1828
|
+
var popover = webshims.objectCreate(webshims.wsPopover, {}, {prepareFor: data.element});
|
1829
|
+
var opener = $('<button type="button" class="ws-popover-opener"><span /></button>').appendTo(data.buttonWrapper);
|
1830
|
+
var options = data.options;
|
1831
|
+
var init = false;
|
1832
|
+
|
1833
|
+
var show = function(){
|
1834
|
+
if(!options.disabled && !options.readonly && !popover.isVisible){
|
1835
|
+
if(!init){
|
1836
|
+
picker.commonInit(data, popover);
|
1837
|
+
}
|
480
1838
|
|
481
|
-
if(
|
482
|
-
|
1839
|
+
if(!init || data.options.restartView) {
|
1840
|
+
actions.setYearList( options.defValue || options.value, popover, data, data.options.startView);
|
483
1841
|
} else {
|
484
|
-
|
485
|
-
}
|
486
|
-
}
|
487
|
-
}
|
488
|
-
};
|
489
|
-
}
|
490
|
-
if (!modernizrInputTypes.range || options.replaceUI) {
|
491
|
-
replaceInputUI.range = function(elem){
|
492
|
-
if(!$.fn.slider){return;}
|
493
|
-
var range = $('<span class="input-range"><span class="ui-slider-handle" role="slider" tabindex="0" /></span>'),
|
494
|
-
change = function(e, ui){
|
495
|
-
if(e.originalEvent){
|
496
|
-
replaceInputUI.range.blockAttr = true;
|
497
|
-
elem.prop('value', ui.value);
|
498
|
-
replaceInputUI.range.blockAttr = false;
|
499
|
-
triggerInlineForm(elem[0], 'input');
|
1842
|
+
actions[popover.element.attr('data-currentview') || 'setYearList']( options.defValue || options.value, popover, data, 0);
|
500
1843
|
}
|
1844
|
+
|
1845
|
+
init = true;
|
1846
|
+
popover.show(data.element);
|
501
1847
|
}
|
502
|
-
;
|
1848
|
+
};
|
503
1849
|
|
504
|
-
|
1850
|
+
options.containerElements.push(popover.element[0]);
|
505
1851
|
|
1852
|
+
if(!options.startView){
|
1853
|
+
options.startView = 0;
|
1854
|
+
}
|
1855
|
+
if(!options.minView){
|
1856
|
+
options.minView = 0;
|
1857
|
+
}
|
1858
|
+
if(options.startView < options.minView){
|
1859
|
+
options.minView = options.startView;
|
1860
|
+
webshims.warn("wrong config for minView/startView.");
|
1861
|
+
}
|
1862
|
+
if(!options.size){
|
1863
|
+
options.size = 1;
|
1864
|
+
}
|
506
1865
|
|
507
|
-
|
508
|
-
.
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
1866
|
+
popover.element
|
1867
|
+
.addClass(data.type+'-popover input-picker')
|
1868
|
+
.attr({role: 'application'})
|
1869
|
+
.on({
|
1870
|
+
wspopoverhide: function(){
|
1871
|
+
popover.openedByFocus = false;
|
1872
|
+
},
|
1873
|
+
focusin: function(e){
|
1874
|
+
if(popover.activateElement){
|
1875
|
+
popover.openedByFocus = false;
|
1876
|
+
popover.activateElement(e.target);
|
1877
|
+
}
|
1878
|
+
},
|
1879
|
+
focusout: function(){
|
1880
|
+
if(popover.activeElement){
|
1881
|
+
popover.activeElement.removeClass('ws-focus');
|
517
1882
|
}
|
518
1883
|
}
|
519
|
-
elem.css({display: 'none'});
|
520
1884
|
})
|
521
1885
|
;
|
522
1886
|
|
1887
|
+
labelWidth(popover.element.children('div.ws-po-outerbox').attr({role: 'group'}), options.labels, true);
|
1888
|
+
labelWidth(opener, options.labels, true);
|
523
1889
|
|
524
|
-
|
1890
|
+
opener
|
1891
|
+
.attr({
|
1892
|
+
'tabindex': options.labels.length ? 0 : '-1'
|
1893
|
+
})
|
525
1894
|
.on({
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
1895
|
+
mousedown: function(){
|
1896
|
+
stopPropagation.apply(this, arguments);
|
1897
|
+
popover.preventBlur();
|
1898
|
+
},
|
1899
|
+
click: function(){
|
1900
|
+
if(popover.isVisible && popover.activeElement){
|
1901
|
+
popover.openedByFocus = false;
|
1902
|
+
popover.activeElement.focus();
|
530
1903
|
}
|
1904
|
+
show();
|
1905
|
+
},
|
1906
|
+
focus: function(){
|
1907
|
+
popover.preventBlur();
|
531
1908
|
}
|
532
1909
|
})
|
533
1910
|
;
|
534
1911
|
|
535
|
-
|
536
|
-
var
|
537
|
-
var
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
1912
|
+
(function(){
|
1913
|
+
var mouseFocus = false;
|
1914
|
+
var resetMouseFocus = function(){
|
1915
|
+
mouseFocus = false;
|
1916
|
+
};
|
1917
|
+
data.inputElements.on({
|
1918
|
+
focus: function(){
|
1919
|
+
if(!popover.stopOpen && (data.options.openOnFocus || (mouseFocus && options.openOnMouseFocus))){
|
1920
|
+
popover.openedByFocus = !options.noInput;
|
1921
|
+
show();
|
1922
|
+
} else {
|
1923
|
+
popover.preventBlur();
|
1924
|
+
}
|
1925
|
+
},
|
1926
|
+
mousedown: function(){
|
1927
|
+
mouseFocus = true;
|
1928
|
+
setTimeout(resetMouseFocus, 9);
|
1929
|
+
if(data.element.is(':focus')){
|
1930
|
+
popover.openedByFocus = !options.noInput;
|
1931
|
+
show();
|
1932
|
+
}
|
1933
|
+
popover.preventBlur();
|
543
1934
|
}
|
544
|
-
}
|
545
|
-
|
546
|
-
|
547
|
-
}
|
548
|
-
});
|
1935
|
+
});
|
1936
|
+
})();
|
1937
|
+
data.popover = popover;
|
549
1938
|
};
|
550
1939
|
|
551
|
-
|
552
|
-
|
553
|
-
value = !!value;
|
554
|
-
$(shim).slider( "option", "disabled", value );
|
555
|
-
$('span', shim)
|
556
|
-
.attr({
|
557
|
-
'aria-disabled': value+'',
|
558
|
-
'tabindex': (value) ? '-1' : '0'
|
559
|
-
})
|
560
|
-
;
|
561
|
-
},
|
562
|
-
min: function(orig, shim, value){
|
563
|
-
value = (value) ? value * 1 || 0 : 0;
|
564
|
-
$(shim).slider( "option", "min", value );
|
565
|
-
$('span', shim).attr({'aria-valuemin': value});
|
566
|
-
},
|
567
|
-
max: function(orig, shim, value){
|
568
|
-
value = (value || value === 0) ? value * 1 || 100 : 100;
|
569
|
-
$(shim).slider( "option", "max", value );
|
570
|
-
$('span', shim).attr({'aria-valuemax': value});
|
571
|
-
},
|
572
|
-
value: function(orig, shim, value){
|
573
|
-
value = $(orig).prop('valueAsNumber');
|
574
|
-
if(!isNaN(value)){
|
575
|
-
if(!replaceInputUI.range.blockAttr){
|
576
|
-
$(shim).slider( "option", "value", value );
|
577
|
-
}
|
578
|
-
$('span', shim).attr({'aria-valuenow': value, 'aria-valuetext': value});
|
579
|
-
}
|
580
|
-
},
|
581
|
-
step: function(orig, shim, value){
|
582
|
-
value = (value && $.trim(value)) ? value * 1 || 1 : 1;
|
583
|
-
$(shim).slider( "option", "step", value );
|
584
|
-
}
|
585
|
-
};
|
586
|
-
}
|
587
|
-
|
588
|
-
if(options.replaceUI || !Modernizr.inputtypes.date /*|| !Modernizr.inputtypes["datetime-local"]*/ || !Modernizr.inputtypes.range){
|
589
|
-
var reflectFn = function(val){
|
590
|
-
if(webshims.data(this, 'hasShadow')){
|
591
|
-
$.prop(this, 'value', $.prop(this, 'value'));
|
592
|
-
}
|
593
|
-
};
|
1940
|
+
picker.month = picker._common;
|
1941
|
+
picker.date = picker.month;
|
594
1942
|
|
595
|
-
webshims.
|
596
|
-
webshims.onNodeNamesPropertyModify('input', 'valueAsDate', reflectFn);
|
597
|
-
}
|
598
|
-
|
599
|
-
$.each(['disabled', 'min', 'max', 'value', 'step', 'data-placeholder'], function(i, attr){
|
600
|
-
webshims.onNodeNamesPropertyModify('input', attr, function(val){
|
601
|
-
var shadowData = webshims.data(this, 'shadowData');
|
602
|
-
if(shadowData && shadowData.data && shadowData.data[attr] && shadowData.nativeElement === this){
|
603
|
-
shadowData.data[attr](this, shadowData.shadowElement, val);
|
604
|
-
}
|
605
|
-
}
|
606
|
-
);
|
607
|
-
});
|
608
|
-
if(!options.availabeLangs){
|
609
|
-
options.availabeLangs = 'af ar ar-DZ az bg bs ca cs da de el en-AU en-GB en-NZ eo es et eu fa fi fo fr fr-CH gl he hr hu hy id is it ja ko kz lt lv ml ms nl no pl pt-BR rm ro ru sk sl sq sr sr-SR sv ta th tr uk vi zh-CN zh-HK zh-TW'.split(' ');
|
610
|
-
}
|
611
|
-
|
612
|
-
var getDefaults = function(){
|
613
|
-
if(!$.datepicker){return;}
|
614
|
-
|
615
|
-
webshims.activeLang({
|
616
|
-
langObj: $.datepicker.regional,
|
617
|
-
module: 'form-number-date-ui',
|
618
|
-
callback: function(langObj){
|
619
|
-
var datepickerCFG = $.extend({}, defaultDatepicker, langObj, options.datepicker);
|
620
|
-
|
621
|
-
|
622
|
-
if(datepickerCFG.dateFormat && options.datepicker.dateFormat != datepickerCFG.dateFormat ){
|
623
|
-
$('input.hasDatepicker')
|
624
|
-
.filter('.input-date, .input-datetime-local-date')
|
625
|
-
.datepicker('option', 'dateFormat', datepickerCFG.dateFormat)
|
626
|
-
.getNativeElement()
|
627
|
-
.filter('[data-placeholder]')
|
628
|
-
.attr('data-placeholder', function(i, val){
|
629
|
-
return val;
|
630
|
-
})
|
631
|
-
;
|
632
|
-
}
|
633
|
-
$.datepicker.setDefaults(datepickerCFG);
|
634
|
-
}
|
635
|
-
});
|
636
|
-
$(document).unbind('jquery-uiReady.langchange input-widgetsReady.langchange');
|
637
|
-
};
|
638
|
-
|
639
|
-
$(document).on('jquery-uiReady.langchange input-widgetsReady.langchange', getDefaults);
|
640
|
-
getDefaults();
|
641
|
-
|
642
|
-
//implement set/arrow controls
|
643
|
-
(function(){
|
644
|
-
var supportsType = (function(){
|
645
|
-
var types = {};
|
646
|
-
return function(type){
|
647
|
-
if(type in types){
|
648
|
-
return types[type];
|
649
|
-
}
|
650
|
-
return (types[type] = ($('<input type="'+type+'" />')[0].type === type));
|
651
|
-
};
|
1943
|
+
webshims.picker = picker;
|
652
1944
|
})();
|
653
1945
|
|
654
|
-
|
655
|
-
var doc = document;
|
656
|
-
var options = webshims.cfg["forms-ext"];
|
657
|
-
var typeModels = webshims.inputTypes;
|
658
|
-
var allowedChars = {
|
659
|
-
number: '0123456789.',
|
660
|
-
time: '0123456789:.'
|
661
|
-
};
|
662
|
-
|
663
|
-
var getNextStep = function(input, upDown, cache){
|
1946
|
+
(function(){
|
664
1947
|
|
665
|
-
|
1948
|
+
var stopCircular, isCheckValidity;
|
666
1949
|
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
ret = cache.valueAsNumber + (delta * upDown);
|
693
|
-
//using NUMBER.MIN/MAX is really stupid | ToDo: either use disabled state or make this more usable
|
694
|
-
if(!isNaN(cache.minAsNumber) && ret < cache.minAsNumber){
|
695
|
-
ret = (cache.valueAsNumber * upDown < cache.minAsNumber) ? cache.minAsNumber : isNaN(cache.maxAsNumber) ? cache.valueAsNumber : cache.maxAsNumber;
|
696
|
-
} else if(!isNaN(cache.maxAsNumber) && ret > cache.maxAsNumber){
|
697
|
-
ret = (cache.valueAsNumber * upDown > cache.maxAsNumber) ? cache.maxAsNumber : isNaN(cache.minAsNumber) ? cache.valueAsNumber : cache.minAsNumber;
|
698
|
-
} else {
|
699
|
-
ret = Math.round( ret * 1e7) / 1e7;
|
700
|
-
}
|
701
|
-
return ret;
|
702
|
-
};
|
703
|
-
|
704
|
-
webshims.modules["form-number-date-ui"].getNextStep = getNextStep;
|
705
|
-
|
706
|
-
|
707
|
-
if(options.stepArrows){
|
708
|
-
var stepDisableEnable = {
|
709
|
-
// don't change getter
|
710
|
-
set: function(value){
|
711
|
-
var stepcontrols = webshims.data(this, 'step-controls');
|
712
|
-
if(stepcontrols){
|
713
|
-
stepcontrols[ (this.disabled || this.readonly) ? 'addClass' : 'removeClass' ]('disabled-step-control');
|
714
|
-
}
|
715
|
-
}
|
716
|
-
};
|
717
|
-
webshims.onNodeNamesPropertyModify('input', 'disabled', stepDisableEnable);
|
718
|
-
webshims.onNodeNamesPropertyModify('input', 'readonly', $.extend({}, stepDisableEnable));
|
719
|
-
}
|
720
|
-
var stepKeys = {
|
721
|
-
38: 1,
|
722
|
-
40: -1
|
723
|
-
};
|
724
|
-
|
725
|
-
var changeInput = function(elem, type){
|
726
|
-
var blockBlurChange = false;
|
727
|
-
var DELAY = 9;
|
728
|
-
var doChangeValue, blockChangeValue;
|
729
|
-
|
730
|
-
function step(dir){
|
731
|
-
if($.prop(elem, 'disabled') || elem.readOnly || !dir){return;}
|
732
|
-
doChangeValue = typeModels[type].numberToString(getNextStep(elem, dir, {type: type}));
|
733
|
-
$.prop(elem, 'value', doChangeValue);
|
734
|
-
triggerInlineForm(elem, 'input');
|
735
|
-
}
|
736
|
-
|
737
|
-
function setFocus(){
|
738
|
-
blockBlurChange = true;
|
739
|
-
setTimeout(function(){
|
740
|
-
blockBlurChange = false;
|
741
|
-
}, DELAY + 9);
|
742
|
-
setTimeout(function(){
|
743
|
-
if(!$(elem).is(':focus')){
|
744
|
-
try{
|
745
|
-
elem.focus();
|
746
|
-
} catch(e){}
|
747
|
-
}
|
748
|
-
}, 1);
|
749
|
-
}
|
750
|
-
|
751
|
-
function triggerChange(){
|
752
|
-
var curValue = $.prop(elem, 'value');
|
753
|
-
if(curValue == doChangeValue && curValue != blockChangeValue && typeof curValue == 'string'){
|
754
|
-
triggerInlineForm(elem, 'change');
|
755
|
-
}
|
756
|
-
blockChangeValue = curValue;
|
757
|
-
}
|
758
|
-
|
759
|
-
function init(){
|
760
|
-
blockChangeValue = $(elem)
|
761
|
-
.on({
|
762
|
-
'change.stepcontrol focus.stepcontrol': function(e){
|
763
|
-
if(!blockBlurChange || e.type != 'focus'){
|
764
|
-
blockChangeValue = $.prop(elem, 'value');
|
765
|
-
}
|
766
|
-
},
|
767
|
-
'blur.stepcontrol': function(){
|
768
|
-
if(!blockBlurChange){
|
769
|
-
setTimeout(function(){
|
770
|
-
if(!blockBlurChange && !$(elem).is(':focus')){
|
771
|
-
triggerChange();
|
772
|
-
}
|
773
|
-
doChangeValue = false;
|
774
|
-
}, DELAY);
|
775
|
-
}
|
1950
|
+
var modernizrInputTypes = Modernizr.inputtypes;
|
1951
|
+
var inputTypes = {
|
1952
|
+
|
1953
|
+
};
|
1954
|
+
var copyProps = [
|
1955
|
+
'disabled',
|
1956
|
+
'readonly',
|
1957
|
+
'value',
|
1958
|
+
'min',
|
1959
|
+
'max',
|
1960
|
+
'step',
|
1961
|
+
'title',
|
1962
|
+
'placeholder'
|
1963
|
+
];
|
1964
|
+
|
1965
|
+
//
|
1966
|
+
var copyAttrs = ['data-placeholder', 'tabindex'];
|
1967
|
+
|
1968
|
+
$.each(copyProps.concat(copyAttrs), function(i, name){
|
1969
|
+
var fnName = name.replace(/^data\-/, '');
|
1970
|
+
webshims.onNodeNamesPropertyModify('input', name, function(val){
|
1971
|
+
if(!stopCircular){
|
1972
|
+
var shadowData = webshims.data(this, 'shadowData');
|
1973
|
+
if(shadowData && shadowData.data && shadowData.nativeElement === this && shadowData.data[fnName]){
|
1974
|
+
shadowData.data[fnName](val);
|
776
1975
|
}
|
777
|
-
}
|
778
|
-
|
779
|
-
|
1976
|
+
}
|
1977
|
+
});
|
1978
|
+
});
|
1979
|
+
|
1980
|
+
if(options.replaceUI && 'valueAsNumber' in document.createElement('input')){
|
1981
|
+
var reflectFn = function(val){
|
1982
|
+
if(webshims.data(this, 'hasShadow')){
|
1983
|
+
$.prop(this, 'value', $.prop(this, 'value'));
|
1984
|
+
}
|
1985
|
+
};
|
1986
|
+
|
1987
|
+
webshims.onNodeNamesPropertyModify('input', 'valueAsNumber', reflectFn);
|
1988
|
+
webshims.onNodeNamesPropertyModify('input', 'valueAsDate', reflectFn);
|
780
1989
|
}
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
1990
|
+
|
1991
|
+
var extendType = (function(){
|
1992
|
+
return function(name, data){
|
1993
|
+
inputTypes[name] = data;
|
1994
|
+
data.attrs = $.merge([], copyAttrs, data.attrs);
|
1995
|
+
data.props = $.merge([], copyProps, data.props);
|
1996
|
+
};
|
1997
|
+
})();
|
1998
|
+
|
1999
|
+
var isVisible = function(){
|
2000
|
+
return $.css(this, 'display') != 'none';
|
787
2001
|
};
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
2002
|
+
var sizeInput = function(data){
|
2003
|
+
var init;
|
2004
|
+
var updateStyles = function(){
|
2005
|
+
$.style( data.orig, 'display', '' );
|
2006
|
+
var hasButtons, marginR, marginL;
|
2007
|
+
var correctWidth = 0.6;
|
2008
|
+
if(!init || data.orig.offsetWidth){
|
2009
|
+
hasButtons = data.buttonWrapper && data.buttonWrapper.filter(isVisible).length;
|
2010
|
+
marginR = $.css( data.orig, 'marginRight');
|
2011
|
+
data.element.css({
|
2012
|
+
marginLeft: $.css( data.orig, 'marginLeft'),
|
2013
|
+
marginRight: hasButtons ? 0 : marginR
|
2014
|
+
});
|
2015
|
+
|
2016
|
+
if(hasButtons){
|
2017
|
+
marginL = (parseInt(data.buttonWrapper.css('marginLeft'), 10) || 0);
|
2018
|
+
data.element.css({paddingRight: ''});
|
2019
|
+
|
2020
|
+
if(marginL < 0){
|
2021
|
+
marginR = (parseInt(marginR, 10) || 0) + ((data.buttonWrapper.outerWidth() + marginL) * -1);
|
2022
|
+
data.buttonWrapper.css('marginRight', marginR);
|
2023
|
+
data.element
|
2024
|
+
.css({paddingRight: ''})
|
2025
|
+
.css({
|
2026
|
+
paddingRight: (parseInt( data.element.css('paddingRight'), 10) || 0) + data.buttonWrapper.outerWidth()
|
2027
|
+
})
|
2028
|
+
;
|
2029
|
+
} else {
|
2030
|
+
data.buttonWrapper.css('marginRight', marginR);
|
2031
|
+
correctWidth = data.buttonWrapper.outerWidth(true) + 0.6;
|
814
2032
|
}
|
815
|
-
})
|
816
|
-
;
|
817
|
-
var mwheelUpDown = function(e, d){
|
818
|
-
if(d){
|
819
|
-
uiEvents.step(d);
|
820
|
-
return false;
|
821
2033
|
}
|
822
|
-
|
2034
|
+
|
2035
|
+
data.element.outerWidth( $(data.orig).outerWidth() - correctWidth );
|
2036
|
+
}
|
2037
|
+
init = true;
|
2038
|
+
$.style( data.orig, 'display', 'none' );
|
2039
|
+
};
|
2040
|
+
$(document).onTrigger('updateshadowdom', updateStyles);
|
2041
|
+
};
|
2042
|
+
|
2043
|
+
|
2044
|
+
var implementType = function(){
|
2045
|
+
var type = $.prop(this, 'type');
|
2046
|
+
|
2047
|
+
var i, opts, data, optsName, labels;
|
2048
|
+
if(inputTypes[type] && webshims.implement(this, 'inputwidgets')){
|
2049
|
+
data = {};
|
2050
|
+
optsName = type;
|
823
2051
|
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
2052
|
+
//todo: do we need deep extend?
|
2053
|
+
|
2054
|
+
labels = $(this).jProp('labels');
|
2055
|
+
|
2056
|
+
opts = $.extend({}, options.widgets, options[type], $($.prop(this, 'form')).data(type) || {}, $(this).data(type) || {}, {
|
2057
|
+
orig: this,
|
2058
|
+
type: type,
|
2059
|
+
labels: labels,
|
2060
|
+
options: {},
|
2061
|
+
input: function(val){
|
2062
|
+
opts._change(val, 'input');
|
2063
|
+
},
|
2064
|
+
change: function(val){
|
2065
|
+
opts._change(val, 'change');
|
2066
|
+
},
|
2067
|
+
_change: function(val, trigger){
|
2068
|
+
stopCircular = true;
|
2069
|
+
$.prop(opts.orig, 'value', val);
|
2070
|
+
stopCircular = false;
|
2071
|
+
if(trigger){
|
2072
|
+
$(opts.orig).trigger(trigger);
|
843
2073
|
}
|
844
|
-
}
|
845
|
-
|
2074
|
+
},
|
2075
|
+
containerElements: []
|
2076
|
+
});
|
846
2077
|
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
return function(event){
|
851
|
-
var chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode);
|
852
|
-
return event.ctrlKey || event.metaKey || (chr < ' ' || chars.indexOf(chr) > -1);
|
853
|
-
};
|
854
|
-
})());
|
2078
|
+
|
2079
|
+
for(i = 0; i < copyProps.length; i++){
|
2080
|
+
opts[copyProps[i]] = $.prop(this, copyProps[i]);
|
855
2081
|
}
|
856
2082
|
|
857
|
-
|
858
|
-
.
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
}
|
868
|
-
;
|
2083
|
+
for(i = 0; i < copyAttrs.length; i++){
|
2084
|
+
optsName = copyAttrs[i].replace(/^data\-/, '');
|
2085
|
+
if(optsName == 'placeholder' || !opts[optsName]){
|
2086
|
+
opts[optsName] = $.attr(this, copyAttrs[i]) || opts[optsName];
|
2087
|
+
}
|
2088
|
+
}
|
2089
|
+
|
2090
|
+
data.shim = inputTypes[type]._create(opts);
|
2091
|
+
|
2092
|
+
webshims.addShadowDom(this, data.shim.element, {
|
2093
|
+
data: data.shim || {}
|
2094
|
+
});
|
2095
|
+
|
2096
|
+
data.shim.options.containerElements.push(data.shim.element[0]);
|
869
2097
|
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
.
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
2098
|
+
labelWidth($(this).getShadowFocusElement(), labels);
|
2099
|
+
$.attr(this, 'required', $.attr(this, 'required'));
|
2100
|
+
$(this).on('change', function(e){
|
2101
|
+
if(!stopCircular){
|
2102
|
+
data.shim.value($.prop(this, 'value'));
|
2103
|
+
}
|
2104
|
+
});
|
2105
|
+
|
2106
|
+
(function(){
|
2107
|
+
var has = {
|
2108
|
+
focusin: true,
|
2109
|
+
focus: true
|
2110
|
+
};
|
2111
|
+
var timer;
|
2112
|
+
var hasFocusTriggered = false;
|
2113
|
+
var hasFocus = false;
|
2114
|
+
|
2115
|
+
$(data.shim.options.containerElements)
|
2116
|
+
.on({
|
2117
|
+
'focusin focus focusout blur': function(e){
|
2118
|
+
e.stopImmediatePropagation();
|
2119
|
+
hasFocus = has[e.type];
|
2120
|
+
clearTimeout(timer);
|
2121
|
+
timer = setTimeout(function(){
|
2122
|
+
if(hasFocus != hasFocusTriggered){
|
2123
|
+
hasFocusTriggered = hasFocus;
|
2124
|
+
$(opts.orig).triggerHandler(hasFocus ? 'focus' : 'blur');
|
2125
|
+
$(opts.orig).trigger(hasFocus ? 'focusin' : 'focusout');
|
2126
|
+
}
|
2127
|
+
hasFocusTriggered = hasFocus;
|
2128
|
+
}, 0);
|
879
2129
|
}
|
880
2130
|
})
|
881
2131
|
;
|
2132
|
+
})();
|
2133
|
+
|
2134
|
+
|
2135
|
+
data.shim.element.on('change input', stopPropagation);
|
2136
|
+
|
2137
|
+
if(Modernizr.formvalidation){
|
2138
|
+
$(opts.orig).on('firstinvalid', function(e){
|
2139
|
+
if(!webshims.fromSubmit && isCheckValidity){return;}
|
2140
|
+
$(opts.orig).off('invalid.replacedwidgetbubble').on('invalid.replacedwidgetbubble', function(evt){
|
2141
|
+
if(!e.isInvalidUIPrevented() && !evt.isDefaultPrevented()){
|
2142
|
+
webshims.validityAlert.showFor( e.target );
|
2143
|
+
e.preventDefault();
|
2144
|
+
evt.preventDefault();
|
2145
|
+
}
|
2146
|
+
$(opts.orig).off('invalid.replacedwidgetbubble');
|
2147
|
+
});
|
2148
|
+
});
|
882
2149
|
}
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
if($.datepicker || $.fn.slider){
|
892
|
-
if($.datepicker && !defaultDatepicker.dateFormat){
|
893
|
-
defaultDatepicker.dateFormat = $.datepicker._defaults.dateFormat;
|
2150
|
+
|
2151
|
+
|
2152
|
+
if(data.shim.buttonWrapper && data.shim.buttonWrapper.filter(isVisible).length){
|
2153
|
+
data.shim.element.addClass('has-input-buttons');
|
2154
|
+
}
|
2155
|
+
|
2156
|
+
if(opts.calculateWidth){
|
2157
|
+
sizeInput(data.shim);
|
894
2158
|
}
|
895
|
-
|
2159
|
+
$(this).css({display: 'none'});
|
896
2160
|
}
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
2161
|
+
};
|
2162
|
+
|
2163
|
+
if(!modernizrInputTypes.range || options.replaceUI){
|
2164
|
+
extendType('range', {
|
2165
|
+
_create: function(opts, set){
|
2166
|
+
return $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi');
|
2167
|
+
}
|
2168
|
+
});
|
2169
|
+
}
|
2170
|
+
|
2171
|
+
if(Modernizr.formvalidation){
|
2172
|
+
['input', 'form'].forEach(function(name){
|
2173
|
+
var desc = webshims.defineNodeNameProperty(name, 'checkValidity', {
|
2174
|
+
prop: {
|
2175
|
+
value: function(){
|
2176
|
+
isCheckValidity = true;
|
2177
|
+
var ret = desc.prop._supvalue.apply(this, arguments);
|
2178
|
+
isCheckValidity = false;
|
2179
|
+
return ret;
|
2180
|
+
}
|
2181
|
+
}
|
2182
|
+
});
|
2183
|
+
});
|
2184
|
+
}
|
2185
|
+
|
2186
|
+
|
2187
|
+
['number', 'time', 'month', 'date'].forEach(function(name){
|
2188
|
+
if(!modernizrInputTypes[name] || options.replaceUI){
|
2189
|
+
extendType(name, {
|
2190
|
+
_create: function(opts, set){
|
2191
|
+
|
2192
|
+
if(opts.splitInput && !splitInputs[name]){
|
2193
|
+
webshims.warn('splitInput not supported for '+ name);
|
2194
|
+
opts.splitInput = false;
|
2195
|
+
}
|
2196
|
+
var markup = opts.splitInput ?
|
2197
|
+
'<span class="ws-'+name+' ws-input" role="group"></span>' :
|
2198
|
+
'<input class="ws-'+name+'" type="text" />';
|
2199
|
+
var data = $(markup) //role="spinbutton"???
|
2200
|
+
.insertAfter(opts.orig)
|
2201
|
+
.spinbtnUI(opts)
|
2202
|
+
.data('wsspinner')
|
2203
|
+
;
|
2204
|
+
if(webshims.picker && webshims.picker[name]){
|
2205
|
+
webshims.picker[name](data);
|
2206
|
+
}
|
2207
|
+
data.buttonWrapper.addClass('input-button-size-'+(data.buttonWrapper.children().filter(isVisible).length));
|
2208
|
+
return data;
|
2209
|
+
}
|
2210
|
+
});
|
901
2211
|
}
|
902
2212
|
});
|
903
|
-
|
904
|
-
|
2213
|
+
|
2214
|
+
|
2215
|
+
webshims.addReady(function(context, contextElem){
|
2216
|
+
$('input', context)
|
2217
|
+
.add(contextElem.filter('input'))
|
2218
|
+
.each(implementType)
|
2219
|
+
;
|
2220
|
+
});
|
2221
|
+
})();
|
905
2222
|
});
|
906
2223
|
|