webshims-rails 1.10.6 → 1.10.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/webshims-rails/version.rb +2 -2
- data/vendor/assets/javascripts/webshims/polyfiller.js +14 -7
- data/vendor/assets/javascripts/webshims/shims/color-picker.js +1 -0
- data/vendor/assets/javascripts/webshims/shims/combos/1.js +153 -155
- data/vendor/assets/javascripts/webshims/shims/combos/10.js +168 -136
- data/vendor/assets/javascripts/webshims/shims/combos/11.js +116 -44
- data/vendor/assets/javascripts/webshims/shims/combos/12.js +100 -95
- data/vendor/assets/javascripts/webshims/shims/combos/13.js +100 -95
- data/vendor/assets/javascripts/webshims/shims/combos/14.js +51 -91
- data/vendor/assets/javascripts/webshims/shims/combos/15.js +129 -232
- data/vendor/assets/javascripts/webshims/shims/combos/16.js +228 -326
- data/vendor/assets/javascripts/webshims/shims/combos/17.js +116 -44
- data/vendor/assets/javascripts/webshims/shims/combos/18.js +116 -44
- data/vendor/assets/javascripts/webshims/shims/combos/19.js +210 -214
- data/vendor/assets/javascripts/webshims/shims/combos/2.js +204 -246
- data/vendor/assets/javascripts/webshims/shims/combos/20.js +210 -214
- data/vendor/assets/javascripts/webshims/shims/combos/21.js +59 -28
- data/vendor/assets/javascripts/webshims/shims/combos/23.js +100 -95
- data/vendor/assets/javascripts/webshims/shims/combos/24.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/combos/25.js +210 -214
- data/vendor/assets/javascripts/webshims/shims/combos/26.js +51 -91
- data/vendor/assets/javascripts/webshims/shims/combos/28.js +110 -119
- data/vendor/assets/javascripts/webshims/shims/combos/29.js +6 -0
- data/vendor/assets/javascripts/webshims/shims/combos/3.js +126 -156
- data/vendor/assets/javascripts/webshims/shims/combos/30.js +126 -155
- data/vendor/assets/javascripts/webshims/shims/combos/31.js +104 -151
- data/vendor/assets/javascripts/webshims/shims/combos/4.js +73 -96
- data/vendor/assets/javascripts/webshims/shims/combos/5.js +116 -44
- data/vendor/assets/javascripts/webshims/shims/combos/6.js +116 -44
- data/vendor/assets/javascripts/webshims/shims/combos/7.js +226 -250
- data/vendor/assets/javascripts/webshims/shims/combos/8.js +226 -250
- data/vendor/assets/javascripts/webshims/shims/combos/9.js +168 -136
- data/vendor/assets/javascripts/webshims/shims/dom-extend.js +51 -91
- data/vendor/assets/javascripts/webshims/shims/form-core.js +53 -60
- data/vendor/assets/javascripts/webshims/shims/form-message.js +22 -5
- data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +87 -30
- data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +2 -76
- data/vendor/assets/javascripts/webshims/shims/form-validation.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/forms-picker.js +1 -1
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-fr.js +18 -8
- data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +100 -95
- data/vendor/assets/javascripts/webshims/shims/mediaelement-jaris.js +59 -28
- data/vendor/assets/javascripts/webshims/shims/mediaelement-yt.js +9 -2
- data/vendor/assets/javascripts/webshims/shims/range-ui.js +29 -14
- data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +21 -7
- data/vendor/assets/javascripts/webshims/shims/styles/shim.css +30 -15
- data/vendor/assets/javascripts/webshims/shims/track-ui.js +6 -0
- metadata +2 -2
@@ -921,16 +921,20 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
921
921
|
this.thumb.on({
|
922
922
|
mousedown: add
|
923
923
|
});
|
924
|
-
|
925
|
-
webshims.ready('
|
926
|
-
|
927
|
-
|
924
|
+
if (window.webshims) {
|
925
|
+
webshims.ready('WINDOWLOAD', function(){
|
926
|
+
webshims.ready('dom-support', function(){
|
927
|
+
if ($.fn.onWSOff) {
|
928
|
+
that.element.onWSOff('updateshadowdom', function(){
|
929
|
+
that.updateMetrics();
|
930
|
+
});
|
931
|
+
}
|
928
932
|
});
|
933
|
+
if (!$.fn.onWSOff && webshims._polyfill) {
|
934
|
+
webshims._polyfill(['dom-support']);
|
935
|
+
}
|
929
936
|
});
|
930
|
-
|
931
|
-
webshims._polyfill(['dom-support']);
|
932
|
-
}
|
933
|
-
});
|
937
|
+
}
|
934
938
|
},
|
935
939
|
posCenter: function(elem, outerWidth){
|
936
940
|
var temp;
|
@@ -972,6 +976,12 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
972
976
|
}
|
973
977
|
};
|
974
978
|
|
979
|
+
var oCreate = function (o) {
|
980
|
+
function F() {}
|
981
|
+
F.prototype = o;
|
982
|
+
return new F();
|
983
|
+
};
|
984
|
+
|
975
985
|
$.fn.rangeUI = function(opts){
|
976
986
|
opts = $.extend({
|
977
987
|
readonly: false,
|
@@ -990,14 +1000,19 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
990
1000
|
calcTrail: true
|
991
1001
|
}, opts);
|
992
1002
|
return this.each(function(){
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
}
|
997
|
-
}, opts);
|
1003
|
+
var obj = $.extend(oCreate(rangeProto), {element: $(this)});
|
1004
|
+
obj.options = opts;
|
1005
|
+
obj._create.call(obj);
|
998
1006
|
});
|
999
1007
|
};
|
1000
|
-
webshims.isReady
|
1008
|
+
if(window.webshims && webshims.isReady){
|
1009
|
+
webshims.ready('es5', function(){
|
1010
|
+
webshims.isReady('range-ui', true);
|
1011
|
+
});
|
1012
|
+
if(webshims._polyfill){
|
1013
|
+
webshims._polyfill(['es5']);
|
1014
|
+
}
|
1015
|
+
}
|
1001
1016
|
})(jQuery);
|
1002
1017
|
webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
|
1003
1018
|
"use strict";
|
@@ -1044,10 +1059,14 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1044
1059
|
}
|
1045
1060
|
},
|
1046
1061
|
month: {
|
1047
|
-
_create: function(){
|
1062
|
+
_create: function(opts){
|
1063
|
+
|
1048
1064
|
var obj = {
|
1049
1065
|
splits: [$('<input type="text" class="yy" inputmode="numeric" size="4" />')[0], $('<input type="text" class="mm ws-spin" />')[0]]
|
1050
1066
|
};
|
1067
|
+
if(opts.onlyMonthDigits){
|
1068
|
+
$(obj.splits[1]).attr({inputmode: 'numeric', size: 2, maxlength: 2});
|
1069
|
+
}
|
1051
1070
|
obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1]];
|
1052
1071
|
return obj;
|
1053
1072
|
},
|
@@ -1067,6 +1086,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1067
1086
|
}
|
1068
1087
|
};
|
1069
1088
|
|
1089
|
+
var nowDate = new Date().getTime() - (new Date().getTimezoneOffset() * 60 * 1000 );
|
1070
1090
|
var steps = {
|
1071
1091
|
number: {
|
1072
1092
|
step: 1
|
@@ -1076,11 +1096,11 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1076
1096
|
},
|
1077
1097
|
month: {
|
1078
1098
|
step: 1,
|
1079
|
-
start: new Date()
|
1099
|
+
start: new Date(nowDate)
|
1080
1100
|
},
|
1081
1101
|
date: {
|
1082
1102
|
step: 1,
|
1083
|
-
start: new Date()
|
1103
|
+
start: new Date(nowDate)
|
1084
1104
|
}
|
1085
1105
|
};
|
1086
1106
|
var labelWidth = (function(){
|
@@ -1176,9 +1196,19 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1176
1196
|
"showMonthAfterYear": false,
|
1177
1197
|
"yearSuffix": ""
|
1178
1198
|
}
|
1179
|
-
}, formcfg
|
1199
|
+
}, formcfg.en || {});
|
1200
|
+
|
1180
1201
|
if(!formcfg['en-US']){
|
1181
|
-
formcfg['en-US'] = formcfg['en'];
|
1202
|
+
formcfg['en-US'] = $.extend(true, {}, formcfg['en']);
|
1203
|
+
}
|
1204
|
+
if(!formcfg['en-GB']){
|
1205
|
+
formcfg['en-GB'] = $.extend(true, {}, formcfg.en, {
|
1206
|
+
date: {firstDay: 1},
|
1207
|
+
patterns: {d: "dd/mm/yy"}
|
1208
|
+
});
|
1209
|
+
}
|
1210
|
+
if(!formcfg['en-AU']){
|
1211
|
+
formcfg['en-AU'] = $.extend(true, {}, formcfg['en-GB']);
|
1182
1212
|
}
|
1183
1213
|
if(!formcfg['']){
|
1184
1214
|
formcfg[''] = formcfg['en-US'];
|
@@ -1206,22 +1236,37 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1206
1236
|
langCfg.colorSigns = '#abcdefABCDEF';
|
1207
1237
|
}
|
1208
1238
|
};
|
1239
|
+
var triggerLocaleChange = function(){
|
1240
|
+
processLangCFG(curCfg);
|
1241
|
+
$(document).triggerHandler('wslocalechange');
|
1242
|
+
};
|
1209
1243
|
|
1210
|
-
|
1244
|
+
triggerLocaleChange();
|
1211
1245
|
|
1212
|
-
|
1213
|
-
register: 'form-core',
|
1246
|
+
webshims.activeLang({
|
1247
|
+
register: 'form-core',
|
1214
1248
|
callback: function(){
|
1215
1249
|
$.each(arguments, function(i, val){
|
1216
1250
|
if(formcfg[val]){
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1251
|
+
if(formcfg[val] != curCfg){
|
1252
|
+
curCfg = formcfg[val];
|
1253
|
+
triggerLocaleChange();
|
1254
|
+
}
|
1220
1255
|
return false;
|
1221
1256
|
}
|
1222
1257
|
});
|
1223
1258
|
}
|
1224
1259
|
});
|
1260
|
+
webshims.activeLang({
|
1261
|
+
langObj: formcfg,
|
1262
|
+
module: 'form-core',
|
1263
|
+
callback: function(val){
|
1264
|
+
if(curCfg != val){
|
1265
|
+
curCfg = val;
|
1266
|
+
triggerLocaleChange();
|
1267
|
+
}
|
1268
|
+
}
|
1269
|
+
});
|
1225
1270
|
})();
|
1226
1271
|
|
1227
1272
|
|
@@ -1260,6 +1305,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1260
1305
|
} else if(p[1]){
|
1261
1306
|
val = curCfg.date.showMonthAfterYear ? p.join(' ') : p[1]+' '+p[0];
|
1262
1307
|
}
|
1308
|
+
} else if(options && options.splitInput){
|
1309
|
+
val = [p[0] || '', p[1] || ''];
|
1263
1310
|
}
|
1264
1311
|
return val;
|
1265
1312
|
},
|
@@ -1298,16 +1345,16 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1298
1345
|
time: function(val){
|
1299
1346
|
return val;
|
1300
1347
|
},
|
1301
|
-
month: function(val, opts){
|
1348
|
+
month: function(val, opts, noCorrect){
|
1302
1349
|
|
1303
1350
|
var p = (!opts.splitInput) ? val.trim().split(/[\.\s-\/\\]+/) : val;
|
1304
1351
|
|
1305
1352
|
if(p.length == 2 && p[0] && p[1]){
|
1306
|
-
p[0] = curCfg.date.monthkeys[p[0]] || p[0];
|
1307
|
-
p[1] = curCfg.date.monthkeys[p[1]] || p[1];
|
1308
|
-
if(p[1].length == 2){
|
1353
|
+
p[0] = !noCorrect && curCfg.date.monthkeys[p[0]] || p[0];
|
1354
|
+
p[1] = !noCorrect && curCfg.date.monthkeys[p[1]] || p[1];
|
1355
|
+
if(p[1].length == 2 && p[0].length > 3){
|
1309
1356
|
val = p[0]+'-'+p[1];
|
1310
|
-
} else if(p[0].length == 2){
|
1357
|
+
} else if(p[0].length == 2 && p[1].length > 3){
|
1311
1358
|
val = p[1]+'-'+p[0];
|
1312
1359
|
} else {
|
1313
1360
|
val = '';
|
@@ -1317,7 +1364,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1317
1364
|
}
|
1318
1365
|
return val;
|
1319
1366
|
},
|
1320
|
-
date: function(val, opts){
|
1367
|
+
date: function(val, opts, noCorrect){
|
1321
1368
|
createFormat('d');
|
1322
1369
|
var i;
|
1323
1370
|
var obj;
|
@@ -1328,7 +1375,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1328
1375
|
val = val.split(curCfg.dFormat);
|
1329
1376
|
}
|
1330
1377
|
|
1331
|
-
return (val.length == 3 && val[0] && val[1] && val[2]) ?
|
1378
|
+
return (val.length == 3 && val[0] && val[1] && val[2] && (!noCorrect || (val[obj.yy].length > 3 && val[obj.mm].length == 2 && val[obj.dd].length == 2))) ?
|
1332
1379
|
([addZero(val[obj.yy]), addZero(val[obj.mm]), addZero(val[obj.dd])]).join('-') :
|
1333
1380
|
''
|
1334
1381
|
;
|
@@ -1386,7 +1433,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1386
1433
|
return function(type){
|
1387
1434
|
var input;
|
1388
1435
|
if(!types[type]){
|
1389
|
-
input = $('<input type="'+type+'" />');
|
1436
|
+
input = $('<input type="'+type+'" step="any" />');
|
1390
1437
|
types[type] = {
|
1391
1438
|
asNumber: function(val){
|
1392
1439
|
var type = (typeof val == 'object') ? 'valueAsDate' : 'value';
|
@@ -1615,6 +1662,22 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1615
1662
|
e.preventDefault();
|
1616
1663
|
}
|
1617
1664
|
},
|
1665
|
+
input: (this.type == 'color' && this.isValid) ?
|
1666
|
+
$.noop :
|
1667
|
+
(function(){
|
1668
|
+
var timer;
|
1669
|
+
var check = function(){
|
1670
|
+
var val = that.parseValue(true);
|
1671
|
+
if(val && that.isValid(val)){
|
1672
|
+
that.setInput(val);
|
1673
|
+
}
|
1674
|
+
|
1675
|
+
};
|
1676
|
+
return function(){
|
1677
|
+
clearTimeout(timer);
|
1678
|
+
timer = setTimeout(check, 200);
|
1679
|
+
};
|
1680
|
+
})(),
|
1618
1681
|
'input keydown keypress': (function(){
|
1619
1682
|
var timer;
|
1620
1683
|
var isStopped = false;
|
@@ -1632,8 +1695,12 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1632
1695
|
timer = setTimeout(releaseTab, 300);
|
1633
1696
|
};
|
1634
1697
|
var select = function(){
|
1635
|
-
this
|
1636
|
-
|
1698
|
+
var elem = this;
|
1699
|
+
setTimeout(function(){
|
1700
|
+
elem.focus();
|
1701
|
+
elem.select();
|
1702
|
+
}, 4);
|
1703
|
+
|
1637
1704
|
stopTab();
|
1638
1705
|
};
|
1639
1706
|
|
@@ -1754,8 +1821,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1754
1821
|
var localeChange ;
|
1755
1822
|
if(!o.splitInput){
|
1756
1823
|
localeChange = function(){
|
1824
|
+
|
1757
1825
|
if(o.value){
|
1758
|
-
that.value(o.value);
|
1826
|
+
that.value(o.value, true);
|
1759
1827
|
}
|
1760
1828
|
|
1761
1829
|
if(placeholderFormat[that.type] && o.placeholder){
|
@@ -1774,8 +1842,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1774
1842
|
|
1775
1843
|
initChangeEvents();
|
1776
1844
|
},
|
1777
|
-
value: function(val){
|
1778
|
-
if(!this._init || val !== this.options.value){
|
1845
|
+
value: function(val, force){
|
1846
|
+
if(!this._init || force || val !== this.options.value){
|
1779
1847
|
this.element.val(this.formatValue(val));
|
1780
1848
|
this.options.value = val;
|
1781
1849
|
this._propertyChange('value');
|
@@ -1787,14 +1855,14 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1787
1855
|
this.inputElements.attr({'aria-required': ''+boolVal});
|
1788
1856
|
this.mirrorValidity();
|
1789
1857
|
},
|
1790
|
-
parseValue: function(){
|
1858
|
+
parseValue: function(noCorrect){
|
1791
1859
|
var value = this.inputElements.map(function(){
|
1792
1860
|
return $.prop(this, 'value');
|
1793
1861
|
}).get();
|
1794
1862
|
if(!this.options.splitInput){
|
1795
1863
|
value = value[0];
|
1796
1864
|
}
|
1797
|
-
return parseVal[this.type](value, this.options);
|
1865
|
+
return parseVal[this.type](value, this.options, noCorrect);
|
1798
1866
|
},
|
1799
1867
|
formatValue: function(val, noSplit){
|
1800
1868
|
return formatVal[this.type](val, noSplit === false ? false : this.options);
|
@@ -1892,6 +1960,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1892
1960
|
this.elemHelper = $('<input type="'+ o.type+'" />');
|
1893
1961
|
this.asNumber = helper.asNumber;
|
1894
1962
|
this.asValue = helper.asValue;
|
1963
|
+
this.isValid = helper.isValid;
|
1964
|
+
|
1895
1965
|
|
1896
1966
|
wsWidgetProto._create.apply(this, arguments);
|
1897
1967
|
this._init = false;
|
@@ -1917,7 +1987,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1917
1987
|
createOpts: ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'value', 'required'],
|
1918
1988
|
_addSplitInputs: function(){
|
1919
1989
|
if(!this.inputElements){
|
1920
|
-
var create = splitInputs[this.type]._create();
|
1990
|
+
var create = splitInputs[this.type]._create(this.options);
|
1921
1991
|
this.splits = create.splits;
|
1922
1992
|
this.inputElements = $(create.elements).prependTo(this.element).filter('input');
|
1923
1993
|
}
|
@@ -1954,9 +2024,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1954
2024
|
}, 9);
|
1955
2025
|
}
|
1956
2026
|
},
|
1957
|
-
value: function(val){
|
2027
|
+
value: function(val, force){
|
1958
2028
|
|
1959
|
-
if(!this._init || this.options.value !== val){
|
2029
|
+
if(!this._init || force || this.options.value !== val){
|
1960
2030
|
this.valueAsNumber = this.asNumber(val);
|
1961
2031
|
this.options.value = val;
|
1962
2032
|
|
@@ -2468,7 +2538,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2468
2538
|
opts[optsName] = $.attr(this, copyAttrs[i]) || opts[optsName];
|
2469
2539
|
}
|
2470
2540
|
}
|
2471
|
-
|
2541
|
+
if(opts.onlyMonthDigits){
|
2542
|
+
opts.formatMonthNames = 'monthDigits';
|
2543
|
+
}
|
2472
2544
|
data.shim = inputTypes[type]._create(opts);
|
2473
2545
|
|
2474
2546
|
webshims.addShadowDom(this, data.shim.element, {
|
@@ -1724,16 +1724,20 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
1724
1724
|
this.thumb.on({
|
1725
1725
|
mousedown: add
|
1726
1726
|
});
|
1727
|
-
|
1728
|
-
webshims.ready('
|
1729
|
-
|
1730
|
-
|
1727
|
+
if (window.webshims) {
|
1728
|
+
webshims.ready('WINDOWLOAD', function(){
|
1729
|
+
webshims.ready('dom-support', function(){
|
1730
|
+
if ($.fn.onWSOff) {
|
1731
|
+
that.element.onWSOff('updateshadowdom', function(){
|
1732
|
+
that.updateMetrics();
|
1733
|
+
});
|
1734
|
+
}
|
1731
1735
|
});
|
1736
|
+
if (!$.fn.onWSOff && webshims._polyfill) {
|
1737
|
+
webshims._polyfill(['dom-support']);
|
1738
|
+
}
|
1732
1739
|
});
|
1733
|
-
|
1734
|
-
webshims._polyfill(['dom-support']);
|
1735
|
-
}
|
1736
|
-
});
|
1740
|
+
}
|
1737
1741
|
},
|
1738
1742
|
posCenter: function(elem, outerWidth){
|
1739
1743
|
var temp;
|
@@ -1775,6 +1779,12 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
1775
1779
|
}
|
1776
1780
|
};
|
1777
1781
|
|
1782
|
+
var oCreate = function (o) {
|
1783
|
+
function F() {}
|
1784
|
+
F.prototype = o;
|
1785
|
+
return new F();
|
1786
|
+
};
|
1787
|
+
|
1778
1788
|
$.fn.rangeUI = function(opts){
|
1779
1789
|
opts = $.extend({
|
1780
1790
|
readonly: false,
|
@@ -1793,14 +1803,19 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
1793
1803
|
calcTrail: true
|
1794
1804
|
}, opts);
|
1795
1805
|
return this.each(function(){
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
}
|
1800
|
-
}, opts);
|
1806
|
+
var obj = $.extend(oCreate(rangeProto), {element: $(this)});
|
1807
|
+
obj.options = opts;
|
1808
|
+
obj._create.call(obj);
|
1801
1809
|
});
|
1802
1810
|
};
|
1803
|
-
webshims.isReady
|
1811
|
+
if(window.webshims && webshims.isReady){
|
1812
|
+
webshims.ready('es5', function(){
|
1813
|
+
webshims.isReady('range-ui', true);
|
1814
|
+
});
|
1815
|
+
if(webshims._polyfill){
|
1816
|
+
webshims._polyfill(['es5']);
|
1817
|
+
}
|
1818
|
+
}
|
1804
1819
|
})(jQuery);
|
1805
1820
|
webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
|
1806
1821
|
"use strict";
|
@@ -1847,10 +1862,14 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1847
1862
|
}
|
1848
1863
|
},
|
1849
1864
|
month: {
|
1850
|
-
_create: function(){
|
1865
|
+
_create: function(opts){
|
1866
|
+
|
1851
1867
|
var obj = {
|
1852
1868
|
splits: [$('<input type="text" class="yy" inputmode="numeric" size="4" />')[0], $('<input type="text" class="mm ws-spin" />')[0]]
|
1853
1869
|
};
|
1870
|
+
if(opts.onlyMonthDigits){
|
1871
|
+
$(obj.splits[1]).attr({inputmode: 'numeric', size: 2, maxlength: 2});
|
1872
|
+
}
|
1854
1873
|
obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1]];
|
1855
1874
|
return obj;
|
1856
1875
|
},
|
@@ -1870,6 +1889,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1870
1889
|
}
|
1871
1890
|
};
|
1872
1891
|
|
1892
|
+
var nowDate = new Date().getTime() - (new Date().getTimezoneOffset() * 60 * 1000 );
|
1873
1893
|
var steps = {
|
1874
1894
|
number: {
|
1875
1895
|
step: 1
|
@@ -1879,11 +1899,11 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1879
1899
|
},
|
1880
1900
|
month: {
|
1881
1901
|
step: 1,
|
1882
|
-
start: new Date()
|
1902
|
+
start: new Date(nowDate)
|
1883
1903
|
},
|
1884
1904
|
date: {
|
1885
1905
|
step: 1,
|
1886
|
-
start: new Date()
|
1906
|
+
start: new Date(nowDate)
|
1887
1907
|
}
|
1888
1908
|
};
|
1889
1909
|
var labelWidth = (function(){
|
@@ -1979,9 +1999,19 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1979
1999
|
"showMonthAfterYear": false,
|
1980
2000
|
"yearSuffix": ""
|
1981
2001
|
}
|
1982
|
-
}, formcfg
|
2002
|
+
}, formcfg.en || {});
|
2003
|
+
|
1983
2004
|
if(!formcfg['en-US']){
|
1984
|
-
formcfg['en-US'] = formcfg['en'];
|
2005
|
+
formcfg['en-US'] = $.extend(true, {}, formcfg['en']);
|
2006
|
+
}
|
2007
|
+
if(!formcfg['en-GB']){
|
2008
|
+
formcfg['en-GB'] = $.extend(true, {}, formcfg.en, {
|
2009
|
+
date: {firstDay: 1},
|
2010
|
+
patterns: {d: "dd/mm/yy"}
|
2011
|
+
});
|
2012
|
+
}
|
2013
|
+
if(!formcfg['en-AU']){
|
2014
|
+
formcfg['en-AU'] = $.extend(true, {}, formcfg['en-GB']);
|
1985
2015
|
}
|
1986
2016
|
if(!formcfg['']){
|
1987
2017
|
formcfg[''] = formcfg['en-US'];
|
@@ -2009,22 +2039,37 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2009
2039
|
langCfg.colorSigns = '#abcdefABCDEF';
|
2010
2040
|
}
|
2011
2041
|
};
|
2042
|
+
var triggerLocaleChange = function(){
|
2043
|
+
processLangCFG(curCfg);
|
2044
|
+
$(document).triggerHandler('wslocalechange');
|
2045
|
+
};
|
2012
2046
|
|
2013
|
-
|
2047
|
+
triggerLocaleChange();
|
2014
2048
|
|
2015
|
-
|
2016
|
-
register: 'form-core',
|
2049
|
+
webshims.activeLang({
|
2050
|
+
register: 'form-core',
|
2017
2051
|
callback: function(){
|
2018
2052
|
$.each(arguments, function(i, val){
|
2019
2053
|
if(formcfg[val]){
|
2020
|
-
|
2021
|
-
|
2022
|
-
|
2054
|
+
if(formcfg[val] != curCfg){
|
2055
|
+
curCfg = formcfg[val];
|
2056
|
+
triggerLocaleChange();
|
2057
|
+
}
|
2023
2058
|
return false;
|
2024
2059
|
}
|
2025
2060
|
});
|
2026
2061
|
}
|
2027
2062
|
});
|
2063
|
+
webshims.activeLang({
|
2064
|
+
langObj: formcfg,
|
2065
|
+
module: 'form-core',
|
2066
|
+
callback: function(val){
|
2067
|
+
if(curCfg != val){
|
2068
|
+
curCfg = val;
|
2069
|
+
triggerLocaleChange();
|
2070
|
+
}
|
2071
|
+
}
|
2072
|
+
});
|
2028
2073
|
})();
|
2029
2074
|
|
2030
2075
|
|
@@ -2063,6 +2108,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2063
2108
|
} else if(p[1]){
|
2064
2109
|
val = curCfg.date.showMonthAfterYear ? p.join(' ') : p[1]+' '+p[0];
|
2065
2110
|
}
|
2111
|
+
} else if(options && options.splitInput){
|
2112
|
+
val = [p[0] || '', p[1] || ''];
|
2066
2113
|
}
|
2067
2114
|
return val;
|
2068
2115
|
},
|
@@ -2101,16 +2148,16 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2101
2148
|
time: function(val){
|
2102
2149
|
return val;
|
2103
2150
|
},
|
2104
|
-
month: function(val, opts){
|
2151
|
+
month: function(val, opts, noCorrect){
|
2105
2152
|
|
2106
2153
|
var p = (!opts.splitInput) ? val.trim().split(/[\.\s-\/\\]+/) : val;
|
2107
2154
|
|
2108
2155
|
if(p.length == 2 && p[0] && p[1]){
|
2109
|
-
p[0] = curCfg.date.monthkeys[p[0]] || p[0];
|
2110
|
-
p[1] = curCfg.date.monthkeys[p[1]] || p[1];
|
2111
|
-
if(p[1].length == 2){
|
2156
|
+
p[0] = !noCorrect && curCfg.date.monthkeys[p[0]] || p[0];
|
2157
|
+
p[1] = !noCorrect && curCfg.date.monthkeys[p[1]] || p[1];
|
2158
|
+
if(p[1].length == 2 && p[0].length > 3){
|
2112
2159
|
val = p[0]+'-'+p[1];
|
2113
|
-
} else if(p[0].length == 2){
|
2160
|
+
} else if(p[0].length == 2 && p[1].length > 3){
|
2114
2161
|
val = p[1]+'-'+p[0];
|
2115
2162
|
} else {
|
2116
2163
|
val = '';
|
@@ -2120,7 +2167,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2120
2167
|
}
|
2121
2168
|
return val;
|
2122
2169
|
},
|
2123
|
-
date: function(val, opts){
|
2170
|
+
date: function(val, opts, noCorrect){
|
2124
2171
|
createFormat('d');
|
2125
2172
|
var i;
|
2126
2173
|
var obj;
|
@@ -2131,7 +2178,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2131
2178
|
val = val.split(curCfg.dFormat);
|
2132
2179
|
}
|
2133
2180
|
|
2134
|
-
return (val.length == 3 && val[0] && val[1] && val[2]) ?
|
2181
|
+
return (val.length == 3 && val[0] && val[1] && val[2] && (!noCorrect || (val[obj.yy].length > 3 && val[obj.mm].length == 2 && val[obj.dd].length == 2))) ?
|
2135
2182
|
([addZero(val[obj.yy]), addZero(val[obj.mm]), addZero(val[obj.dd])]).join('-') :
|
2136
2183
|
''
|
2137
2184
|
;
|
@@ -2189,7 +2236,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2189
2236
|
return function(type){
|
2190
2237
|
var input;
|
2191
2238
|
if(!types[type]){
|
2192
|
-
input = $('<input type="'+type+'" />');
|
2239
|
+
input = $('<input type="'+type+'" step="any" />');
|
2193
2240
|
types[type] = {
|
2194
2241
|
asNumber: function(val){
|
2195
2242
|
var type = (typeof val == 'object') ? 'valueAsDate' : 'value';
|
@@ -2418,6 +2465,22 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2418
2465
|
e.preventDefault();
|
2419
2466
|
}
|
2420
2467
|
},
|
2468
|
+
input: (this.type == 'color' && this.isValid) ?
|
2469
|
+
$.noop :
|
2470
|
+
(function(){
|
2471
|
+
var timer;
|
2472
|
+
var check = function(){
|
2473
|
+
var val = that.parseValue(true);
|
2474
|
+
if(val && that.isValid(val)){
|
2475
|
+
that.setInput(val);
|
2476
|
+
}
|
2477
|
+
|
2478
|
+
};
|
2479
|
+
return function(){
|
2480
|
+
clearTimeout(timer);
|
2481
|
+
timer = setTimeout(check, 200);
|
2482
|
+
};
|
2483
|
+
})(),
|
2421
2484
|
'input keydown keypress': (function(){
|
2422
2485
|
var timer;
|
2423
2486
|
var isStopped = false;
|
@@ -2435,8 +2498,12 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2435
2498
|
timer = setTimeout(releaseTab, 300);
|
2436
2499
|
};
|
2437
2500
|
var select = function(){
|
2438
|
-
this
|
2439
|
-
|
2501
|
+
var elem = this;
|
2502
|
+
setTimeout(function(){
|
2503
|
+
elem.focus();
|
2504
|
+
elem.select();
|
2505
|
+
}, 4);
|
2506
|
+
|
2440
2507
|
stopTab();
|
2441
2508
|
};
|
2442
2509
|
|
@@ -2557,8 +2624,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2557
2624
|
var localeChange ;
|
2558
2625
|
if(!o.splitInput){
|
2559
2626
|
localeChange = function(){
|
2627
|
+
|
2560
2628
|
if(o.value){
|
2561
|
-
that.value(o.value);
|
2629
|
+
that.value(o.value, true);
|
2562
2630
|
}
|
2563
2631
|
|
2564
2632
|
if(placeholderFormat[that.type] && o.placeholder){
|
@@ -2577,8 +2645,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2577
2645
|
|
2578
2646
|
initChangeEvents();
|
2579
2647
|
},
|
2580
|
-
value: function(val){
|
2581
|
-
if(!this._init || val !== this.options.value){
|
2648
|
+
value: function(val, force){
|
2649
|
+
if(!this._init || force || val !== this.options.value){
|
2582
2650
|
this.element.val(this.formatValue(val));
|
2583
2651
|
this.options.value = val;
|
2584
2652
|
this._propertyChange('value');
|
@@ -2590,14 +2658,14 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2590
2658
|
this.inputElements.attr({'aria-required': ''+boolVal});
|
2591
2659
|
this.mirrorValidity();
|
2592
2660
|
},
|
2593
|
-
parseValue: function(){
|
2661
|
+
parseValue: function(noCorrect){
|
2594
2662
|
var value = this.inputElements.map(function(){
|
2595
2663
|
return $.prop(this, 'value');
|
2596
2664
|
}).get();
|
2597
2665
|
if(!this.options.splitInput){
|
2598
2666
|
value = value[0];
|
2599
2667
|
}
|
2600
|
-
return parseVal[this.type](value, this.options);
|
2668
|
+
return parseVal[this.type](value, this.options, noCorrect);
|
2601
2669
|
},
|
2602
2670
|
formatValue: function(val, noSplit){
|
2603
2671
|
return formatVal[this.type](val, noSplit === false ? false : this.options);
|
@@ -2695,6 +2763,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2695
2763
|
this.elemHelper = $('<input type="'+ o.type+'" />');
|
2696
2764
|
this.asNumber = helper.asNumber;
|
2697
2765
|
this.asValue = helper.asValue;
|
2766
|
+
this.isValid = helper.isValid;
|
2767
|
+
|
2698
2768
|
|
2699
2769
|
wsWidgetProto._create.apply(this, arguments);
|
2700
2770
|
this._init = false;
|
@@ -2720,7 +2790,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2720
2790
|
createOpts: ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'value', 'required'],
|
2721
2791
|
_addSplitInputs: function(){
|
2722
2792
|
if(!this.inputElements){
|
2723
|
-
var create = splitInputs[this.type]._create();
|
2793
|
+
var create = splitInputs[this.type]._create(this.options);
|
2724
2794
|
this.splits = create.splits;
|
2725
2795
|
this.inputElements = $(create.elements).prependTo(this.element).filter('input');
|
2726
2796
|
}
|
@@ -2757,9 +2827,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2757
2827
|
}, 9);
|
2758
2828
|
}
|
2759
2829
|
},
|
2760
|
-
value: function(val){
|
2830
|
+
value: function(val, force){
|
2761
2831
|
|
2762
|
-
if(!this._init || this.options.value !== val){
|
2832
|
+
if(!this._init || force || this.options.value !== val){
|
2763
2833
|
this.valueAsNumber = this.asNumber(val);
|
2764
2834
|
this.options.value = val;
|
2765
2835
|
|
@@ -3271,7 +3341,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
3271
3341
|
opts[optsName] = $.attr(this, copyAttrs[i]) || opts[optsName];
|
3272
3342
|
}
|
3273
3343
|
}
|
3274
|
-
|
3344
|
+
if(opts.onlyMonthDigits){
|
3345
|
+
opts.formatMonthNames = 'monthDigits';
|
3346
|
+
}
|
3275
3347
|
data.shim = inputTypes[type]._create(opts);
|
3276
3348
|
|
3277
3349
|
webshims.addShadowDom(this, data.shim.element, {
|