webshims-rails 1.12.0 → 1.12.2

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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/lib/webshims-rails/version.rb +2 -2
  3. data/vendor/assets/javascripts/webshims/extras/modernizr-custom.js +440 -440
  4. data/vendor/assets/javascripts/webshims/polyfiller.js +132 -91
  5. data/vendor/assets/javascripts/webshims/shims/combos/10.js +248 -91
  6. data/vendor/assets/javascripts/webshims/shims/combos/11.js +237 -84
  7. data/vendor/assets/javascripts/webshims/shims/combos/15.js +21 -8
  8. data/vendor/assets/javascripts/webshims/shims/combos/16.js +21 -8
  9. data/vendor/assets/javascripts/webshims/shims/combos/17.js +237 -84
  10. data/vendor/assets/javascripts/webshims/shims/combos/18.js +237 -84
  11. data/vendor/assets/javascripts/webshims/shims/combos/19.js +11 -7
  12. data/vendor/assets/javascripts/webshims/shims/combos/2.js +18 -8
  13. data/vendor/assets/javascripts/webshims/shims/combos/20.js +11 -7
  14. data/vendor/assets/javascripts/webshims/shims/combos/21.js +1 -1
  15. data/vendor/assets/javascripts/webshims/shims/combos/22.js +1 -1
  16. data/vendor/assets/javascripts/webshims/shims/combos/24.js +9 -6
  17. data/vendor/assets/javascripts/webshims/shims/combos/25.js +11 -7
  18. data/vendor/assets/javascripts/webshims/shims/combos/26.js +11 -7
  19. data/vendor/assets/javascripts/webshims/shims/combos/28.js +10 -1
  20. data/vendor/assets/javascripts/webshims/shims/combos/3.js +11 -7
  21. data/vendor/assets/javascripts/webshims/shims/combos/30.js +18 -8
  22. data/vendor/assets/javascripts/webshims/shims/combos/31.js +18 -8
  23. data/vendor/assets/javascripts/webshims/shims/combos/32.js +7 -1
  24. data/vendor/assets/javascripts/webshims/shims/combos/33.js +7 -1
  25. data/vendor/assets/javascripts/webshims/shims/combos/4.js +11 -7
  26. data/vendor/assets/javascripts/webshims/shims/combos/5.js +237 -84
  27. data/vendor/assets/javascripts/webshims/shims/combos/6.js +244 -85
  28. data/vendor/assets/javascripts/webshims/shims/combos/7.js +18 -8
  29. data/vendor/assets/javascripts/webshims/shims/combos/8.js +11 -7
  30. data/vendor/assets/javascripts/webshims/shims/combos/9.js +255 -92
  31. data/vendor/assets/javascripts/webshims/shims/details.js +1 -1
  32. data/vendor/assets/javascripts/webshims/shims/dom-extend.js +10 -7
  33. data/vendor/assets/javascripts/webshims/shims/form-datalist-lazy.js +53 -56
  34. data/vendor/assets/javascripts/webshims/shims/form-datalist.js +7 -1
  35. data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +175 -60
  36. data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +3 -0
  37. data/vendor/assets/javascripts/webshims/shims/form-shim-extend2.js +6 -6
  38. data/vendor/assets/javascripts/webshims/shims/form-validation.js +77 -28
  39. data/vendor/assets/javascripts/webshims/shims/form-validators.js +24 -16
  40. data/vendor/assets/javascripts/webshims/shims/forms-picker.js +40 -68
  41. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-pl.js +4 -4
  42. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-sv.js +13 -6
  43. data/vendor/assets/javascripts/webshims/shims/range-ui.js +61 -24
  44. data/vendor/assets/javascripts/webshims/shims/styles/forms-ext.css +278 -95
  45. data/vendor/assets/javascripts/webshims/shims/styles/progress.gif +0 -0
  46. data/vendor/assets/javascripts/webshims/shims/styles/scss/_api-forms-ext.scss +203 -0
  47. data/vendor/assets/javascripts/webshims/shims/styles/scss/_api-shim.scss +115 -0
  48. data/vendor/assets/javascripts/webshims/shims/styles/scss/_extends.scss +18 -2
  49. data/vendor/assets/javascripts/webshims/shims/styles/scss/forms-ext.scss +227 -113
  50. data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +168 -159
  51. data/vendor/assets/javascripts/webshims/shims/styles/shim.css +106 -69
  52. metadata +4 -7
  53. data/vendor/assets/javascripts/webshims/shims/styles/details-arrows.png +0 -0
  54. data/vendor/assets/javascripts/webshims/shims/styles/polyfill-loader.gif +0 -0
  55. data/vendor/assets/javascripts/webshims/shims/styles/range-track.png +0 -0
  56. data/vendor/assets/javascripts/webshims/shims/styles/vertical-range.png +0 -0
  57. data/vendor/assets/javascripts/webshims/shims/swf/localStorage.swf +0 -0
@@ -831,8 +831,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
831
831
  _create: function(){
832
832
  var i;
833
833
 
834
-
835
- this.element.addClass('ws-range').attr({role: 'slider'}).append('<span class="ws-range-min ws-range-progress" /><span class="ws-range-rail ws-range-track"><span class="ws-range-thumb" /></span>');
834
+ this.element.addClass('ws-range').attr({role: 'slider'}).append('<span class="ws-range-min ws-range-progress" /><span class="ws-range-rail ws-range-track"><span class="ws-range-thumb"><span data-value="" data-valuetext="" /></span></span>');
836
835
  this.trail = $('.ws-range-track', this.element);
837
836
  this.range = $('.ws-range-progress', this.element);
838
837
  this.thumb = $('.ws-range-thumb', this.trail);
@@ -854,7 +853,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
854
853
  },
855
854
  value: $.noop,
856
855
  _value: function(val, _noNormalize, animate){
857
- var left, posDif, textValue;
856
+ var left, posDif;
858
857
  var o = this.options;
859
858
  var oVal = val;
860
859
  var thumbStyle = {};
@@ -870,7 +869,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
870
869
  left = 100 * ((val - o.min) / (o.max - o.min));
871
870
 
872
871
  if(this._init && val == o.value && oVal == val){return;}
873
- this.options.value = val;
872
+ o.value = val;
874
873
 
875
874
  if($.fn.stop){
876
875
  this.thumb.stop();
@@ -878,6 +877,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
878
877
  }
879
878
 
880
879
  rangeStyle[this.dirs.width] = left+'%';
880
+
881
881
  if(this.vertical){
882
882
  left = Math.abs(left - 100);
883
883
  }
@@ -904,15 +904,26 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
904
904
  this.options._change(val);
905
905
  }
906
906
 
907
- textValue = this.options.textValue ? this.options.textValue(this.options.value) : this.options.options[this.options.value] || this.options.value;
907
+ this._setValueMarkup();
908
+ },
909
+ _setValueMarkup: function(){
910
+ var o = this.options;
911
+ var textValue = o.textValue ? o.textValue(this.options.value) : o.options[o.value] || o.value;
908
912
  this.element.attr({
909
913
  'aria-valuenow': this.options.value,
910
914
  'aria-valuetext': textValue
911
915
  });
912
- this.thumb.attr({
916
+ $('span', this.thumb).attr({
913
917
  'data-value': this.options.value,
914
918
  'data-valuetext': textValue
915
919
  });
920
+ if(o.selectedOption){
921
+ $(o.selectedOption).removeClass('ws-selected-option');
922
+ o.selectedOption = null;
923
+ }
924
+ if(o.value in o.options){
925
+ o.selectedOption = $('[data-value="'+o.value+'"].ws-range-ticks').addClass('ws-selected-option');
926
+ }
916
927
  },
917
928
  initDataList: function(){
918
929
  if(this.orig){
@@ -955,9 +966,9 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
955
966
  $.each(o.options, function(val, label){
956
967
  if(!isNumber(val) || val < min || val > max){return;}
957
968
  var left = 100 * ((val - min) / (max - min));
958
- var attr = '';
969
+ var attr = 'data-value="'+val+'"';
959
970
  if(label){
960
- attr += 'data-label="'+label+'"';
971
+ attr += ' data-label="'+label+'"';
961
972
  if(o.showLabels){
962
973
  attr += ' title="'+label+'"';
963
974
  }
@@ -970,6 +981,9 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
970
981
  $('<span class="ws-range-ticks"'+ attr +' style="'+(that.dirs.left)+': '+left+'%;" />').appendTo(trail)
971
982
  );
972
983
  });
984
+ if(o.value in o.options){
985
+ this._setValueMarkup();
986
+ }
973
987
  },
974
988
  readonly: function(val){
975
989
  val = !!val;
@@ -1013,12 +1027,13 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
1013
1027
  var step = val == 'any' ? 'any' : retDefault(val, 1);
1014
1028
 
1015
1029
  if(o.stepping){
1016
- if(step != 'any' && o.stepping % step){
1017
- webshims.error('wrong stepping value for type range:'+ (o.stepping % step));
1018
- } else {
1019
- step = o.stepping;
1020
- }
1030
+ webshims.error('stepping was removed. Use stepfactor instead.');
1031
+ }
1032
+
1033
+ if(o.stepfactor && step != 'any'){
1034
+ step *= o.stepfactor;
1021
1035
  }
1036
+
1022
1037
  o.step = step;
1023
1038
  this.value(this.options.value);
1024
1039
  },
@@ -1056,11 +1071,11 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
1056
1071
  var val, valModStep, alignValue, step;
1057
1072
 
1058
1073
  if(pos <= 0){
1059
- val = this.options[this.dirs.min];
1074
+ val = this.options[this.dirs[this.isRtl ? 'max' : 'min']];
1060
1075
  } else if(pos > 100) {
1061
- val = this.options[this.dirs.max];
1076
+ val = this.options[this.dirs[this.isRtl ? 'min' : 'max']];
1062
1077
  } else {
1063
- if(this.vertical){
1078
+ if(this.vertical || this.isRtl){
1064
1079
  pos = Math.abs(pos - 100);
1065
1080
  }
1066
1081
  val = ((this.options.max - this.options.min) * (pos / 100)) + this.options.min;
@@ -1145,17 +1160,20 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
1145
1160
  return e;
1146
1161
  };
1147
1162
  })();
1163
+ var updateValue = function(val, animate){
1164
+ if(val != o.value){
1165
+ that.value(val, false, animate);
1166
+ eventTimer.call('input', val);
1167
+ }
1168
+ };
1148
1169
  var setValueFromPos = function(e, animate){
1149
1170
  if(e.type == 'touchmove'){
1150
1171
  e.preventDefault();
1151
1172
  normalizeTouch(e);
1152
1173
  }
1153
1174
 
1154
- var val = that.getStepedValueFromPos((e[that.dirs.mouse] - leftOffset) * widgetUnits);
1155
- if(val != o.value){
1156
- that.value(val, false, animate);
1157
- eventTimer.call('input', val);
1158
- }
1175
+ updateValue(that.getStepedValueFromPos((e[that.dirs.mouse] - leftOffset) * widgetUnits), animate);
1176
+
1159
1177
  if(e && e.type == 'mousemove'){
1160
1178
  e.preventDefault();
1161
1179
  }
@@ -1193,7 +1211,12 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
1193
1211
  outerWidth = that.thumb[that.dirs.outerWidth]();
1194
1212
  leftOffset = leftOffset[that.dirs.pos];
1195
1213
  widgetUnits = 100 / widgetUnits;
1196
- setValueFromPos(e, o.animate);
1214
+
1215
+ if(e.target.className == 'ws-range-ticks'){
1216
+ updateValue(e.target.getAttribute('data-value'), o.animate);
1217
+ } else {
1218
+ setValueFromPos(e, o.animate);
1219
+ }
1197
1220
  isActive = true;
1198
1221
  $(document)
1199
1222
  .on(e.type == 'touchstart' ?
@@ -1239,6 +1262,13 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
1239
1262
  var step = true;
1240
1263
  var code = e.keyCode;
1241
1264
  if(!o.readonly && !o.disabled){
1265
+ if(that.isRtl){
1266
+ if(code == 39){
1267
+ code = 37;
1268
+ } else if(code == 37){
1269
+ code = 39;
1270
+ }
1271
+ }
1242
1272
  if (code == 39 || code == 38) {
1243
1273
  that.doStep(1);
1244
1274
  } else if (code == 37 || code == 40) {
@@ -1338,10 +1368,17 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
1338
1368
  {mouse: 'pageY', pos: 'top', min: 'max', max: 'min', left: 'top', right: 'bottom', width: 'height', innerWidth: 'innerHeight', innerHeight: 'innerWidth', outerWidth: 'outerHeight', outerHeight: 'outerWidth', marginTop: 'marginLeft', marginLeft: 'marginTop'} :
1339
1369
  {mouse: 'pageX', pos: 'left', min: 'min', max: 'max', left: 'left', right: 'right', width: 'width', innerWidth: 'innerWidth', innerHeight: 'innerHeight', outerWidth: 'outerWidth', outerHeight: 'outerHeight', marginTop: 'marginTop', marginLeft: 'marginLeft'}
1340
1370
  ;
1371
+ if(!this.vertical && this.element.css('direction') == 'rtl'){
1372
+ this.isRtl = true;
1373
+ this.dirs.left = 'right';
1374
+ this.dirs.right = 'left';
1375
+ this.dirs.marginLeft = 'marginRight';
1376
+ }
1341
1377
  this.element
1342
1378
  [this.vertical ? 'addClass' : 'removeClass']('vertical-range')
1343
- [this.vertical ? 'addClass' : 'removeClass']('horizontal-range')
1379
+ [this.isRtl ? 'addClass' : 'removeClass']('ws-is-rtl')
1344
1380
  ;
1381
+ this.updateMetrics = this.posCenter;
1345
1382
  this.posCenter();
1346
1383
  }
1347
1384
  };
@@ -1378,7 +1415,8 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
1378
1415
  if(window.webshims && webshims.isReady){
1379
1416
  webshims.isReady('range-ui', true);
1380
1417
  }
1381
- })(window.webshims ? webshims.$ : jQuery);;webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
1418
+ })(window.webshims ? webshims.$ : jQuery);
1419
+ ;webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
1382
1420
  "use strict";
1383
1421
  var curCfg;
1384
1422
  var formcfg = webshims.formcfg;
@@ -1388,9 +1426,9 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
1388
1426
  e.stopImmediatePropagation();
1389
1427
  };
1390
1428
  var getMonthOptions = function(opts){
1391
- var selectName = 'monthSelect'+opts.formatMonthNames;
1429
+ var selectName = 'monthSelect'+opts.monthNames;
1392
1430
  if(!curCfg[selectName]){
1393
- var labels = curCfg.date[opts.formatMonthNames] || monthDigits;
1431
+ var labels = curCfg.date[opts.monthNames] || monthDigits;
1394
1432
  curCfg[selectName] = ('<option value=""></option>')+$.map(monthDigits, function(val, i){
1395
1433
  return '<option value="'+val+'"]>'+labels[i]+'</option>';
1396
1434
  }).join('');
@@ -1415,13 +1453,39 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
1415
1453
  curCfg.patterns[name+'Obj'] = obj;
1416
1454
  }
1417
1455
  };
1456
+ var createYearSelect = function(obj, opts){
1457
+ var options, nowY, max, min;
1458
+ if(opts.yearSelect){
1459
+ nowY = parseInt(opts.value.split('-')[0], 10);
1460
+ max = opts.max.split('-');
1461
+ min = opts.min.split('-');
1462
+ options = webshims.picker.createYearSelect(nowY || parseInt(min[0], 10) || parseInt(max[0], 10) || nowYear, max, min);
1463
+ options.unshift('<option />');
1464
+ $(obj.elements)
1465
+ .filter('select.yy')
1466
+ .html(options.join(''))
1467
+ .each(function(){
1468
+ if(!nowY){
1469
+ $('option[selected]', this).removeAttr('selected');
1470
+ $(this).val();
1471
+ }
1472
+ })
1473
+ ;
1474
+ }
1475
+ };
1418
1476
  var splitInputs = {
1419
1477
  date: {
1420
1478
  _create: function(opts){
1421
1479
  var obj = {
1422
- splits: [$('<input type="text" class="yy" size="4" inputmode="numeric" maxlength="4" />')[0]]
1480
+ splits: []
1423
1481
  };
1424
1482
 
1483
+ if(opts.yearSelect){
1484
+ obj.splits.push($('<select class="yy"></select>')[0]);
1485
+ } else {
1486
+ obj.splits.push($('<input type="text" class="yy" size="4" inputmode="numeric" maxlength="4" />')[0]);
1487
+ }
1488
+
1425
1489
  if(opts.monthSelect){
1426
1490
  obj.splits.push($('<select class="mm">'+getMonthOptions(opts)+'</select>')[0]);
1427
1491
  } else {
@@ -1434,6 +1498,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
1434
1498
  }
1435
1499
 
1436
1500
  obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1], $('<span class="ws-input-seperator" />')[0], obj.splits[2]];
1501
+ createYearSelect(obj, opts);
1437
1502
  return obj;
1438
1503
  },
1439
1504
  sort: function(element){
@@ -1458,8 +1523,15 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
1458
1523
  _create: function(opts){
1459
1524
 
1460
1525
  var obj = {
1461
- splits: [$('<input type="text" class="yy" inputmode="numeric" size="4" />')[0]]
1526
+ splits: []
1462
1527
  };
1528
+
1529
+ if(opts.yearSelect){
1530
+ obj.splits.push($('<select class="yy"></select>')[0]);
1531
+ } else {
1532
+ obj.splits.push($('<input type="text" class="yy" size="4" inputmode="numeric" maxlength="4" />')[0]);
1533
+ }
1534
+
1463
1535
  if(opts.monthSelect){
1464
1536
  obj.splits.push($('<select class="mm">'+getMonthOptions(opts)+'</select>')[0]);
1465
1537
  } else {
@@ -1470,6 +1542,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
1470
1542
  }
1471
1543
 
1472
1544
  obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1]];
1545
+ createYearSelect(obj, opts);
1473
1546
  return obj;
1474
1547
  },
1475
1548
  sort: function(element){
@@ -1489,7 +1562,8 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
1489
1562
  };
1490
1563
 
1491
1564
  var nowDate = new Date(new Date().getTime() - (new Date().getTimezoneOffset() * 60 * 1000 ));
1492
- nowDate = new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate(), nowDate.getHours()).getTime()
1565
+ var nowYear = nowDate.getFullYear();
1566
+ nowDate = new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate(), nowDate.getHours()).getTime();
1493
1567
  var steps = {
1494
1568
  number: {
1495
1569
  step: 1
@@ -1699,9 +1773,6 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
1699
1773
  $(document).triggerHandler('wslocalechange');
1700
1774
  };
1701
1775
 
1702
-
1703
-
1704
-
1705
1776
  curCfg = webshims.activeLang(formcfg);
1706
1777
 
1707
1778
  triggerLocaleChange();
@@ -1726,7 +1797,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
1726
1797
 
1727
1798
 
1728
1799
  var formatVal = {
1729
- number: function(val){
1800
+ number: function(val, o){
1730
1801
  return (val+'').replace(/\,/g, '').replace(/\./, curCfg.numberFormat['.']);
1731
1802
  },
1732
1803
  time: function(val){
@@ -1763,7 +1834,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
1763
1834
  var names;
1764
1835
  var p = val.split('-');
1765
1836
  if(p[0] && p[1]){
1766
- names = curCfg.date[options.formatMonthNames] || curCfg.date[options.monthNames] || curCfg.date.monthNames;
1837
+ names = curCfg.date[options.monthNames] || curCfg.date.monthNames;
1767
1838
  p[1] = names[(p[1] * 1) - 1];
1768
1839
  if(options && options.splitInput){
1769
1840
  val = [p[0] || '', p[1] || ''];
@@ -2084,7 +2155,15 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
2084
2155
  })
2085
2156
  .on({
2086
2157
  'change input focus focusin blur focusout': function(e){
2158
+ var oVal, nVal;
2087
2159
  $(e.target).trigger('ws__'+e.type);
2160
+ if(o.toFixed && o.type == 'number' && e.type == 'change'){
2161
+ oVal = that.element.prop('value');
2162
+ nVal = that.toFixed(oVal, true);
2163
+ if(oVal != nVal){
2164
+ that.element[0].value = nVal;
2165
+ }
2166
+ }
2088
2167
  }
2089
2168
  })
2090
2169
 
@@ -2233,11 +2312,14 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
2233
2312
  this.inputElements.attr('inputmode', 'numeric');
2234
2313
  }
2235
2314
 
2236
-
2237
-
2238
2315
  if((!o.max && typeof o.relMax == 'number') || (!o.min && typeof o.relMin == 'number')){
2239
- webshims.error('relMax/relMin are not supported anymore')
2316
+ webshims.error('relMax/relMin are not supported anymore calculate at set it your own.');
2317
+ }
2318
+
2319
+ if(this.options.relDefaultValue){
2320
+ webshims.warn('relDefaultValue was removed use startValue instead!');
2240
2321
  }
2322
+
2241
2323
  this._init = true;
2242
2324
  },
2243
2325
  createOpts: ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'defaultValue', 'value', 'required'],
@@ -2248,17 +2330,9 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
2248
2330
  this.inputElements = $(create.elements).prependTo(this.element).filter('input, select');
2249
2331
  }
2250
2332
  },
2251
-
2252
- getRelNumber: function(rel){
2253
- var start = steps[this.type].start || 0;
2254
- if(rel){
2255
- start += rel;
2256
- }
2257
- return start;
2258
- },
2259
2333
  addZero: addZero,
2260
2334
  _setStartInRange: function(){
2261
- var start = this.getRelNumber(this.options.relDefaultValue);
2335
+ var start = this.options.startValue && this.asNumber( this.options.startValue ) || steps[this.type].start || 0;
2262
2336
  if(!isNaN(this.minAsNumber) && start < this.minAsNumber){
2263
2337
  start = this.minAsNumber;
2264
2338
  } else if(!isNaN(this.maxAsNumber) && start > this.maxAsNumber){
@@ -2270,7 +2344,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
2270
2344
  },
2271
2345
  reorderInputs: function(){
2272
2346
  if(splitInputs[this.type]){
2273
- var element = this.element;
2347
+ var element = this.element.attr('dir', curCfg.date.isRTL ? 'rtl' : 'ltr');
2274
2348
  splitInputs[this.type].sort(element, this.options);
2275
2349
  setTimeout(function(){
2276
2350
  var data = webshims.data(element);
@@ -2296,6 +2370,13 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
2296
2370
  this.elemHelper.prop('value', val);
2297
2371
  this.options.defValue = "";
2298
2372
  }
2373
+ },
2374
+ toFixed: function(val, force){
2375
+ var o = this.options;
2376
+ if(o.toFixed && o.type == 'number' && val && this.valueAsNumber && (force || !this.element.is(':focus')) && (!o.fixOnlyFloat || (this.valueAsNumber % 1)) && !$(this.orig).is(':invalid')){
2377
+ val = formatVal[this.type](this.valueAsNumber.toFixed(o.toFixed), this.options);
2378
+ }
2379
+ return val;
2299
2380
  }
2300
2381
  });
2301
2382
 
@@ -2308,7 +2389,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
2308
2389
  } else {
2309
2390
  this.elemHelper.prop(name, val);
2310
2391
  }
2311
-
2392
+
2312
2393
  val = formatVal[this.type](val, this.options);
2313
2394
  if(this.options.splitInput){
2314
2395
  $.each(this.splits, function(i, elem){
@@ -2320,7 +2401,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
2320
2401
  }
2321
2402
  });
2322
2403
  } else {
2323
- this.element.prop(name, val);
2404
+ this.element.prop(name, this.toFixed(val));
2324
2405
  }
2325
2406
  this._propertyChange(name);
2326
2407
  this.mirrorValidity();
@@ -2337,6 +2418,9 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
2337
2418
  this._setStartInRange();
2338
2419
  }
2339
2420
  this.options[name] = val;
2421
+ if(this._init){
2422
+ createYearSelect({elements: this.inputElements}, this.options);
2423
+ }
2340
2424
  this._propertyChange(name);
2341
2425
  this.mirrorValidity();
2342
2426
  };
@@ -2357,7 +2441,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
2357
2441
 
2358
2442
  $.fn.spinbtnUI = function(opts){
2359
2443
  opts = $.extend({
2360
- monthNames: 'monthNames'
2444
+ monthNames: 'monthNamesShort'
2361
2445
  }, opts);
2362
2446
  return this.each(function(){
2363
2447
  $.webshims.objectCreate(spinBtnProto, {
@@ -2387,6 +2471,53 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
2387
2471
  isVisible: true
2388
2472
  };
2389
2473
 
2474
+ picker.isInRange = function(value, max, min){
2475
+ return !((min[0] && min[0] > value[0]) || (max[0] && max[0] < value[0]));
2476
+ };
2477
+
2478
+
2479
+ picker.createYearSelect = function(value, max, min, valueAdd, stepper){
2480
+ if(!stepper){
2481
+ stepper = {start: value, step: 1, label: value};
2482
+ }
2483
+ var temp;
2484
+ var goUp = true;
2485
+ var goDown = true;
2486
+ var options = ['<option selected="">'+ stepper.label + '</option>'];
2487
+ var i = 0;
2488
+ var createOption = function(value, add){
2489
+ var value2, label;
2490
+ if(stepper.step > 1){
2491
+ value2 = value + stepper.step - 1;
2492
+ label = value+' – '+value2;
2493
+ } else {
2494
+ label = value;
2495
+ }
2496
+
2497
+ if(picker.isInRange([value], max, min) || (value2 && picker.isInRange([value2], max, min))){
2498
+ options[add]('<option value="'+ (value+valueAdd) +'">'+ label +'</option>');
2499
+ return true;
2500
+ }
2501
+ };
2502
+ if(!valueAdd){
2503
+ valueAdd = '';
2504
+ }
2505
+ while(i < 18 && (goUp || goDown)){
2506
+ i++;
2507
+ if(goUp){
2508
+ temp = stepper.start - (i * stepper.step);
2509
+ goUp = createOption(temp, 'unshift');
2510
+ }
2511
+ if(goDown){
2512
+ temp = stepper.start + (i * stepper.step);
2513
+ goDown = createOption(temp, 'push');
2514
+ }
2515
+
2516
+ }
2517
+
2518
+ return options;
2519
+ };
2520
+
2390
2521
  picker._genericSetFocus = function(element, _noFocus){
2391
2522
  element = $(element || this.activeButton);
2392
2523
 
@@ -2396,12 +2527,12 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
2396
2527
  clearTimeout(that.timer);
2397
2528
  that.timer = setTimeout(function(){
2398
2529
  if(element[0]){
2399
- element[0].focus();
2530
+ element.trigger('focus');
2400
2531
  if(noTrigger !== true && !element.is(':focus')){
2401
2532
  setFocus(true);
2402
2533
  }
2403
2534
  }
2404
- }, that.popover.isVisible ? 99 : 360);
2535
+ }, that.popover.isVisible ? 0 : 360);
2405
2536
  };
2406
2537
  this.popover.activateElement(element);
2407
2538
  setFocus();
@@ -2614,7 +2745,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
2614
2745
  popover.preventBlur();
2615
2746
  }
2616
2747
  },
2617
- mousedown: function(){
2748
+ mousedown: function(e){
2618
2749
  mouseFocus = true;
2619
2750
  setTimeout(resetMouseFocus, 9);
2620
2751
  if(options.buttonOnly && popover.isVisible && popover.activeElement){
@@ -2772,31 +2903,41 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
2772
2903
  var updateStyles = function(){
2773
2904
  $(data.orig).removeClass('ws-important-hide');
2774
2905
  $.style( data.orig, 'display', '' );
2775
- var hasButtons, marginR, marginL;
2906
+ var hasButtons, marginR, marginL, left, right, isRtl;
2776
2907
  var correctWidth = 0.8;
2777
2908
  if(!init || data.orig.offsetWidth){
2778
2909
  hasButtons = data.buttonWrapper && data.buttonWrapper.filter(isVisible).length;
2779
- marginR = $.css( data.orig, 'marginRight');
2780
- data.element.css({
2781
- marginLeft: $.css( data.orig, 'marginLeft'),
2782
- marginRight: hasButtons ? 0 : marginR
2783
- });
2910
+
2911
+ isRtl = hasButtons && data.buttonWrapper.css('direction') == 'rtl';
2912
+ if(isRtl){
2913
+ left = 'Right';
2914
+ right = 'Left';
2915
+ } else {
2916
+ left = 'Left';
2917
+ right = 'Right';
2918
+ }
2919
+
2920
+ marginR = $.css( data.orig, 'margin'+right);
2921
+
2922
+ data.element
2923
+ .css('margin'+left, $.css( data.orig, 'margin'+left))
2924
+ .css('margin'+right, hasButtons ? 0 : marginR)
2925
+ ;
2784
2926
 
2785
2927
  if(hasButtons){
2786
- marginL = (parseInt(data.buttonWrapper.css('marginLeft'), 10) || 0);
2787
- data.element.css({paddingRight: ''});
2928
+ data.buttonWrapper[isRtl ? 'addClass' : 'removeClass']('ws-is-rtl');
2929
+ marginL = (parseInt(data.buttonWrapper.css('margin'+left), 10) || 0);
2930
+ data.element.css('padding'+right, '');
2788
2931
 
2789
2932
  if(marginL < 0){
2790
2933
  marginR = (parseInt(marginR, 10) || 0) + ((data.buttonWrapper.outerWidth() + marginL) * -1);
2791
- data.buttonWrapper.css('marginRight', marginR);
2934
+ data.buttonWrapper.css('margin'+right, marginR);
2792
2935
  data.element
2793
- .css({paddingRight: ''})
2794
- .css({
2795
- paddingRight: (parseInt( data.element.css('paddingRight'), 10) || 0) + data.buttonWrapper.outerWidth()
2796
- })
2936
+ .css('padding'+right, '')
2937
+ .css('padding'+right, (parseInt( data.element.css('padding'+right), 10) || 0) + data.buttonWrapper.outerWidth())
2797
2938
  ;
2798
2939
  } else {
2799
- data.buttonWrapper.css('marginRight', marginR);
2940
+ data.buttonWrapper.css('margin'+right, marginR);
2800
2941
  correctWidth = data.buttonWrapper.outerWidth(true) + correctWidth;
2801
2942
  }
2802
2943
  }
@@ -2814,7 +2955,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
2814
2955
 
2815
2956
  var type = $.prop(this, 'type');
2816
2957
 
2817
- var i, opts, data, optsName, labels;
2958
+ var i, opts, data, optsName, labels, cNames;
2818
2959
  if(inputTypes[type] && webshims.implement(this, 'inputwidgets')){
2819
2960
  data = {};
2820
2961
  optsName = type;
@@ -2852,17 +2993,38 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
2852
2993
  opts[optsName] = $.attr(this, copyAttrs[i]) || opts[optsName];
2853
2994
  }
2854
2995
  }
2855
-
2856
- if(opts.onlyMonthDigits || (!opts.formatMonthNames && opts.monthSelect)){
2857
- opts.formatMonthNames = 'monthDigits';
2996
+ if(opts.formatMonthNames){
2997
+ webshims.error('formatMonthNames was renamded to monthNames');
2998
+ }
2999
+ if(opts.onlyMonthDigits){
3000
+ opts.monthNames = 'monthDigits';
2858
3001
  }
2859
3002
  data.shim = inputTypes[type]._create(opts);
2860
-
3003
+
2861
3004
  webshims.addShadowDom(this, data.shim.element, {
2862
3005
  data: data.shim || {}
2863
3006
  });
2864
3007
 
2865
3008
  data.shim.options.containerElements.push(data.shim.element[0]);
3009
+ cNames = $.prop(this, 'className');
3010
+ if(opts.classes){
3011
+ cNames += ' '+opts.classes;
3012
+ }
3013
+
3014
+ if(opts.splitInput || type == 'range'){
3015
+ cNames = cNames.replace('form-control', '');
3016
+ }
3017
+
3018
+ data.shim.element.on('change input', stopPropagation).addClass(cNames);
3019
+
3020
+ if(data.shim.buttonWrapper){
3021
+
3022
+ data.shim.buttonWrapper.addClass('input-button-size-'+(data.shim.buttonWrapper.children().filter(isVisible).length));
3023
+
3024
+ if(data.shim.buttonWrapper.filter(isVisible).length){
3025
+ data.shim.element.addClass('has-input-buttons');
3026
+ }
3027
+ }
2866
3028
 
2867
3029
  labelWidth($(this).getShadowFocusElement(), labels);
2868
3030
 
@@ -2894,14 +3056,13 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
2894
3056
  $(opts.orig).trigger(hasFocus ? 'focusin' : 'focusout');
2895
3057
  }
2896
3058
  hasFocusTriggered = hasFocus;
2897
- }, 0);
3059
+ }, 9);
2898
3060
  }
2899
3061
  })
2900
3062
  ;
2901
3063
  })();
2902
-
2903
3064
 
2904
- data.shim.element.on('change input', stopPropagation);
3065
+
2905
3066
 
2906
3067
  if(hasFormValidation){
2907
3068
  $(opts.orig).on('firstinvalid', function(e){
@@ -2917,13 +3078,6 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
2917
3078
  });
2918
3079
  }
2919
3080
 
2920
-
2921
- if(data.shim.buttonWrapper && data.shim.buttonWrapper.filter(isVisible).length){
2922
- data.shim.element.addClass('has-input-buttons');
2923
- }
2924
-
2925
- data.shim.element.addClass($.prop(this, 'className'));
2926
-
2927
3081
  if(opts.calculateWidth){
2928
3082
  sizeInput(data.shim);
2929
3083
  } else {
@@ -2985,7 +3139,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
2985
3139
  if(!modernizrInputTypes[name] || replace[name]){
2986
3140
  extendType(name, {
2987
3141
  _create: function(opts, set){
2988
- if(opts.monthSelect || opts.daySelect){
3142
+ if(opts.monthSelect || opts.daySelect || opts.yearSelect){
2989
3143
  opts.splitInput = true;
2990
3144
  }
2991
3145
  if(opts.splitInput && !splitInputs[name]){
@@ -3004,7 +3158,6 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
3004
3158
  if(webshims.picker && webshims.picker[name]){
3005
3159
  webshims.picker[name](data);
3006
3160
  }
3007
- data.buttonWrapper.addClass('input-button-size-'+(data.buttonWrapper.children().filter(isVisible).length));
3008
3161
  return data;
3009
3162
  }
3010
3163
  });
@@ -3269,7 +3422,13 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
3269
3422
  lazyLoad('WINDOWLOAD');
3270
3423
 
3271
3424
  if(webshims.isReady('form-datalist-lazy')){
3272
- this._lazyCreate(opts);
3425
+ if(window.QUnit){
3426
+ that._lazyCreate(opts);
3427
+ } else {
3428
+ setTimeout(function(){
3429
+ that._lazyCreate(opts);
3430
+ }, 9);
3431
+ }
3273
3432
  } else {
3274
3433
  $(opts.input).one('focus', lazyLoad);
3275
3434
  webshims.ready('form-datalist-lazy', function(){