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
@@ -2066,8 +2066,7 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2066
2066
  _create: function(){
2067
2067
  var i;
2068
2068
 
2069
-
2070
- 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>');
2069
+ 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>');
2071
2070
  this.trail = $('.ws-range-track', this.element);
2072
2071
  this.range = $('.ws-range-progress', this.element);
2073
2072
  this.thumb = $('.ws-range-thumb', this.trail);
@@ -2089,7 +2088,7 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2089
2088
  },
2090
2089
  value: $.noop,
2091
2090
  _value: function(val, _noNormalize, animate){
2092
- var left, posDif, textValue;
2091
+ var left, posDif;
2093
2092
  var o = this.options;
2094
2093
  var oVal = val;
2095
2094
  var thumbStyle = {};
@@ -2105,7 +2104,7 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2105
2104
  left = 100 * ((val - o.min) / (o.max - o.min));
2106
2105
 
2107
2106
  if(this._init && val == o.value && oVal == val){return;}
2108
- this.options.value = val;
2107
+ o.value = val;
2109
2108
 
2110
2109
  if($.fn.stop){
2111
2110
  this.thumb.stop();
@@ -2113,6 +2112,7 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2113
2112
  }
2114
2113
 
2115
2114
  rangeStyle[this.dirs.width] = left+'%';
2115
+
2116
2116
  if(this.vertical){
2117
2117
  left = Math.abs(left - 100);
2118
2118
  }
@@ -2139,15 +2139,26 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2139
2139
  this.options._change(val);
2140
2140
  }
2141
2141
 
2142
- textValue = this.options.textValue ? this.options.textValue(this.options.value) : this.options.options[this.options.value] || this.options.value;
2142
+ this._setValueMarkup();
2143
+ },
2144
+ _setValueMarkup: function(){
2145
+ var o = this.options;
2146
+ var textValue = o.textValue ? o.textValue(this.options.value) : o.options[o.value] || o.value;
2143
2147
  this.element.attr({
2144
2148
  'aria-valuenow': this.options.value,
2145
2149
  'aria-valuetext': textValue
2146
2150
  });
2147
- this.thumb.attr({
2151
+ $('span', this.thumb).attr({
2148
2152
  'data-value': this.options.value,
2149
2153
  'data-valuetext': textValue
2150
2154
  });
2155
+ if(o.selectedOption){
2156
+ $(o.selectedOption).removeClass('ws-selected-option');
2157
+ o.selectedOption = null;
2158
+ }
2159
+ if(o.value in o.options){
2160
+ o.selectedOption = $('[data-value="'+o.value+'"].ws-range-ticks').addClass('ws-selected-option');
2161
+ }
2151
2162
  },
2152
2163
  initDataList: function(){
2153
2164
  if(this.orig){
@@ -2190,9 +2201,9 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2190
2201
  $.each(o.options, function(val, label){
2191
2202
  if(!isNumber(val) || val < min || val > max){return;}
2192
2203
  var left = 100 * ((val - min) / (max - min));
2193
- var attr = '';
2204
+ var attr = 'data-value="'+val+'"';
2194
2205
  if(label){
2195
- attr += 'data-label="'+label+'"';
2206
+ attr += ' data-label="'+label+'"';
2196
2207
  if(o.showLabels){
2197
2208
  attr += ' title="'+label+'"';
2198
2209
  }
@@ -2205,6 +2216,9 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2205
2216
  $('<span class="ws-range-ticks"'+ attr +' style="'+(that.dirs.left)+': '+left+'%;" />').appendTo(trail)
2206
2217
  );
2207
2218
  });
2219
+ if(o.value in o.options){
2220
+ this._setValueMarkup();
2221
+ }
2208
2222
  },
2209
2223
  readonly: function(val){
2210
2224
  val = !!val;
@@ -2248,12 +2262,13 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2248
2262
  var step = val == 'any' ? 'any' : retDefault(val, 1);
2249
2263
 
2250
2264
  if(o.stepping){
2251
- if(step != 'any' && o.stepping % step){
2252
- webshims.error('wrong stepping value for type range:'+ (o.stepping % step));
2253
- } else {
2254
- step = o.stepping;
2255
- }
2265
+ webshims.error('stepping was removed. Use stepfactor instead.');
2266
+ }
2267
+
2268
+ if(o.stepfactor && step != 'any'){
2269
+ step *= o.stepfactor;
2256
2270
  }
2271
+
2257
2272
  o.step = step;
2258
2273
  this.value(this.options.value);
2259
2274
  },
@@ -2291,11 +2306,11 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2291
2306
  var val, valModStep, alignValue, step;
2292
2307
 
2293
2308
  if(pos <= 0){
2294
- val = this.options[this.dirs.min];
2309
+ val = this.options[this.dirs[this.isRtl ? 'max' : 'min']];
2295
2310
  } else if(pos > 100) {
2296
- val = this.options[this.dirs.max];
2311
+ val = this.options[this.dirs[this.isRtl ? 'min' : 'max']];
2297
2312
  } else {
2298
- if(this.vertical){
2313
+ if(this.vertical || this.isRtl){
2299
2314
  pos = Math.abs(pos - 100);
2300
2315
  }
2301
2316
  val = ((this.options.max - this.options.min) * (pos / 100)) + this.options.min;
@@ -2380,17 +2395,20 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2380
2395
  return e;
2381
2396
  };
2382
2397
  })();
2398
+ var updateValue = function(val, animate){
2399
+ if(val != o.value){
2400
+ that.value(val, false, animate);
2401
+ eventTimer.call('input', val);
2402
+ }
2403
+ };
2383
2404
  var setValueFromPos = function(e, animate){
2384
2405
  if(e.type == 'touchmove'){
2385
2406
  e.preventDefault();
2386
2407
  normalizeTouch(e);
2387
2408
  }
2388
2409
 
2389
- var val = that.getStepedValueFromPos((e[that.dirs.mouse] - leftOffset) * widgetUnits);
2390
- if(val != o.value){
2391
- that.value(val, false, animate);
2392
- eventTimer.call('input', val);
2393
- }
2410
+ updateValue(that.getStepedValueFromPos((e[that.dirs.mouse] - leftOffset) * widgetUnits), animate);
2411
+
2394
2412
  if(e && e.type == 'mousemove'){
2395
2413
  e.preventDefault();
2396
2414
  }
@@ -2428,7 +2446,12 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2428
2446
  outerWidth = that.thumb[that.dirs.outerWidth]();
2429
2447
  leftOffset = leftOffset[that.dirs.pos];
2430
2448
  widgetUnits = 100 / widgetUnits;
2431
- setValueFromPos(e, o.animate);
2449
+
2450
+ if(e.target.className == 'ws-range-ticks'){
2451
+ updateValue(e.target.getAttribute('data-value'), o.animate);
2452
+ } else {
2453
+ setValueFromPos(e, o.animate);
2454
+ }
2432
2455
  isActive = true;
2433
2456
  $(document)
2434
2457
  .on(e.type == 'touchstart' ?
@@ -2474,6 +2497,13 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2474
2497
  var step = true;
2475
2498
  var code = e.keyCode;
2476
2499
  if(!o.readonly && !o.disabled){
2500
+ if(that.isRtl){
2501
+ if(code == 39){
2502
+ code = 37;
2503
+ } else if(code == 37){
2504
+ code = 39;
2505
+ }
2506
+ }
2477
2507
  if (code == 39 || code == 38) {
2478
2508
  that.doStep(1);
2479
2509
  } else if (code == 37 || code == 40) {
@@ -2573,10 +2603,17 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2573
2603
  {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'} :
2574
2604
  {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'}
2575
2605
  ;
2606
+ if(!this.vertical && this.element.css('direction') == 'rtl'){
2607
+ this.isRtl = true;
2608
+ this.dirs.left = 'right';
2609
+ this.dirs.right = 'left';
2610
+ this.dirs.marginLeft = 'marginRight';
2611
+ }
2576
2612
  this.element
2577
2613
  [this.vertical ? 'addClass' : 'removeClass']('vertical-range')
2578
- [this.vertical ? 'addClass' : 'removeClass']('horizontal-range')
2614
+ [this.isRtl ? 'addClass' : 'removeClass']('ws-is-rtl')
2579
2615
  ;
2616
+ this.updateMetrics = this.posCenter;
2580
2617
  this.posCenter();
2581
2618
  }
2582
2619
  };
@@ -2613,7 +2650,8 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2613
2650
  if(window.webshims && webshims.isReady){
2614
2651
  webshims.isReady('range-ui', true);
2615
2652
  }
2616
- })(window.webshims ? webshims.$ : jQuery);;webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
2653
+ })(window.webshims ? webshims.$ : jQuery);
2654
+ ;webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
2617
2655
  "use strict";
2618
2656
  var curCfg;
2619
2657
  var formcfg = webshims.formcfg;
@@ -2623,9 +2661,9 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2623
2661
  e.stopImmediatePropagation();
2624
2662
  };
2625
2663
  var getMonthOptions = function(opts){
2626
- var selectName = 'monthSelect'+opts.formatMonthNames;
2664
+ var selectName = 'monthSelect'+opts.monthNames;
2627
2665
  if(!curCfg[selectName]){
2628
- var labels = curCfg.date[opts.formatMonthNames] || monthDigits;
2666
+ var labels = curCfg.date[opts.monthNames] || monthDigits;
2629
2667
  curCfg[selectName] = ('<option value=""></option>')+$.map(monthDigits, function(val, i){
2630
2668
  return '<option value="'+val+'"]>'+labels[i]+'</option>';
2631
2669
  }).join('');
@@ -2650,13 +2688,39 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2650
2688
  curCfg.patterns[name+'Obj'] = obj;
2651
2689
  }
2652
2690
  };
2691
+ var createYearSelect = function(obj, opts){
2692
+ var options, nowY, max, min;
2693
+ if(opts.yearSelect){
2694
+ nowY = parseInt(opts.value.split('-')[0], 10);
2695
+ max = opts.max.split('-');
2696
+ min = opts.min.split('-');
2697
+ options = webshims.picker.createYearSelect(nowY || parseInt(min[0], 10) || parseInt(max[0], 10) || nowYear, max, min);
2698
+ options.unshift('<option />');
2699
+ $(obj.elements)
2700
+ .filter('select.yy')
2701
+ .html(options.join(''))
2702
+ .each(function(){
2703
+ if(!nowY){
2704
+ $('option[selected]', this).removeAttr('selected');
2705
+ $(this).val();
2706
+ }
2707
+ })
2708
+ ;
2709
+ }
2710
+ };
2653
2711
  var splitInputs = {
2654
2712
  date: {
2655
2713
  _create: function(opts){
2656
2714
  var obj = {
2657
- splits: [$('<input type="text" class="yy" size="4" inputmode="numeric" maxlength="4" />')[0]]
2715
+ splits: []
2658
2716
  };
2659
2717
 
2718
+ if(opts.yearSelect){
2719
+ obj.splits.push($('<select class="yy"></select>')[0]);
2720
+ } else {
2721
+ obj.splits.push($('<input type="text" class="yy" size="4" inputmode="numeric" maxlength="4" />')[0]);
2722
+ }
2723
+
2660
2724
  if(opts.monthSelect){
2661
2725
  obj.splits.push($('<select class="mm">'+getMonthOptions(opts)+'</select>')[0]);
2662
2726
  } else {
@@ -2669,6 +2733,7 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2669
2733
  }
2670
2734
 
2671
2735
  obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1], $('<span class="ws-input-seperator" />')[0], obj.splits[2]];
2736
+ createYearSelect(obj, opts);
2672
2737
  return obj;
2673
2738
  },
2674
2739
  sort: function(element){
@@ -2693,8 +2758,15 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2693
2758
  _create: function(opts){
2694
2759
 
2695
2760
  var obj = {
2696
- splits: [$('<input type="text" class="yy" inputmode="numeric" size="4" />')[0]]
2761
+ splits: []
2697
2762
  };
2763
+
2764
+ if(opts.yearSelect){
2765
+ obj.splits.push($('<select class="yy"></select>')[0]);
2766
+ } else {
2767
+ obj.splits.push($('<input type="text" class="yy" size="4" inputmode="numeric" maxlength="4" />')[0]);
2768
+ }
2769
+
2698
2770
  if(opts.monthSelect){
2699
2771
  obj.splits.push($('<select class="mm">'+getMonthOptions(opts)+'</select>')[0]);
2700
2772
  } else {
@@ -2705,6 +2777,7 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2705
2777
  }
2706
2778
 
2707
2779
  obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1]];
2780
+ createYearSelect(obj, opts);
2708
2781
  return obj;
2709
2782
  },
2710
2783
  sort: function(element){
@@ -2724,7 +2797,8 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2724
2797
  };
2725
2798
 
2726
2799
  var nowDate = new Date(new Date().getTime() - (new Date().getTimezoneOffset() * 60 * 1000 ));
2727
- nowDate = new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate(), nowDate.getHours()).getTime()
2800
+ var nowYear = nowDate.getFullYear();
2801
+ nowDate = new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate(), nowDate.getHours()).getTime();
2728
2802
  var steps = {
2729
2803
  number: {
2730
2804
  step: 1
@@ -2934,9 +3008,6 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2934
3008
  $(document).triggerHandler('wslocalechange');
2935
3009
  };
2936
3010
 
2937
-
2938
-
2939
-
2940
3011
  curCfg = webshims.activeLang(formcfg);
2941
3012
 
2942
3013
  triggerLocaleChange();
@@ -2961,7 +3032,7 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2961
3032
 
2962
3033
 
2963
3034
  var formatVal = {
2964
- number: function(val){
3035
+ number: function(val, o){
2965
3036
  return (val+'').replace(/\,/g, '').replace(/\./, curCfg.numberFormat['.']);
2966
3037
  },
2967
3038
  time: function(val){
@@ -2998,7 +3069,7 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
2998
3069
  var names;
2999
3070
  var p = val.split('-');
3000
3071
  if(p[0] && p[1]){
3001
- names = curCfg.date[options.formatMonthNames] || curCfg.date[options.monthNames] || curCfg.date.monthNames;
3072
+ names = curCfg.date[options.monthNames] || curCfg.date.monthNames;
3002
3073
  p[1] = names[(p[1] * 1) - 1];
3003
3074
  if(options && options.splitInput){
3004
3075
  val = [p[0] || '', p[1] || ''];
@@ -3319,7 +3390,15 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
3319
3390
  })
3320
3391
  .on({
3321
3392
  'change input focus focusin blur focusout': function(e){
3393
+ var oVal, nVal;
3322
3394
  $(e.target).trigger('ws__'+e.type);
3395
+ if(o.toFixed && o.type == 'number' && e.type == 'change'){
3396
+ oVal = that.element.prop('value');
3397
+ nVal = that.toFixed(oVal, true);
3398
+ if(oVal != nVal){
3399
+ that.element[0].value = nVal;
3400
+ }
3401
+ }
3323
3402
  }
3324
3403
  })
3325
3404
 
@@ -3468,11 +3547,14 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
3468
3547
  this.inputElements.attr('inputmode', 'numeric');
3469
3548
  }
3470
3549
 
3471
-
3472
-
3473
3550
  if((!o.max && typeof o.relMax == 'number') || (!o.min && typeof o.relMin == 'number')){
3474
- webshims.error('relMax/relMin are not supported anymore')
3551
+ webshims.error('relMax/relMin are not supported anymore calculate at set it your own.');
3475
3552
  }
3553
+
3554
+ if(this.options.relDefaultValue){
3555
+ webshims.warn('relDefaultValue was removed use startValue instead!');
3556
+ }
3557
+
3476
3558
  this._init = true;
3477
3559
  },
3478
3560
  createOpts: ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'defaultValue', 'value', 'required'],
@@ -3483,17 +3565,9 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
3483
3565
  this.inputElements = $(create.elements).prependTo(this.element).filter('input, select');
3484
3566
  }
3485
3567
  },
3486
-
3487
- getRelNumber: function(rel){
3488
- var start = steps[this.type].start || 0;
3489
- if(rel){
3490
- start += rel;
3491
- }
3492
- return start;
3493
- },
3494
3568
  addZero: addZero,
3495
3569
  _setStartInRange: function(){
3496
- var start = this.getRelNumber(this.options.relDefaultValue);
3570
+ var start = this.options.startValue && this.asNumber( this.options.startValue ) || steps[this.type].start || 0;
3497
3571
  if(!isNaN(this.minAsNumber) && start < this.minAsNumber){
3498
3572
  start = this.minAsNumber;
3499
3573
  } else if(!isNaN(this.maxAsNumber) && start > this.maxAsNumber){
@@ -3505,7 +3579,7 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
3505
3579
  },
3506
3580
  reorderInputs: function(){
3507
3581
  if(splitInputs[this.type]){
3508
- var element = this.element;
3582
+ var element = this.element.attr('dir', curCfg.date.isRTL ? 'rtl' : 'ltr');
3509
3583
  splitInputs[this.type].sort(element, this.options);
3510
3584
  setTimeout(function(){
3511
3585
  var data = webshims.data(element);
@@ -3531,6 +3605,13 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
3531
3605
  this.elemHelper.prop('value', val);
3532
3606
  this.options.defValue = "";
3533
3607
  }
3608
+ },
3609
+ toFixed: function(val, force){
3610
+ var o = this.options;
3611
+ if(o.toFixed && o.type == 'number' && val && this.valueAsNumber && (force || !this.element.is(':focus')) && (!o.fixOnlyFloat || (this.valueAsNumber % 1)) && !$(this.orig).is(':invalid')){
3612
+ val = formatVal[this.type](this.valueAsNumber.toFixed(o.toFixed), this.options);
3613
+ }
3614
+ return val;
3534
3615
  }
3535
3616
  });
3536
3617
 
@@ -3543,7 +3624,7 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
3543
3624
  } else {
3544
3625
  this.elemHelper.prop(name, val);
3545
3626
  }
3546
-
3627
+
3547
3628
  val = formatVal[this.type](val, this.options);
3548
3629
  if(this.options.splitInput){
3549
3630
  $.each(this.splits, function(i, elem){
@@ -3555,7 +3636,7 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
3555
3636
  }
3556
3637
  });
3557
3638
  } else {
3558
- this.element.prop(name, val);
3639
+ this.element.prop(name, this.toFixed(val));
3559
3640
  }
3560
3641
  this._propertyChange(name);
3561
3642
  this.mirrorValidity();
@@ -3572,6 +3653,9 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
3572
3653
  this._setStartInRange();
3573
3654
  }
3574
3655
  this.options[name] = val;
3656
+ if(this._init){
3657
+ createYearSelect({elements: this.inputElements}, this.options);
3658
+ }
3575
3659
  this._propertyChange(name);
3576
3660
  this.mirrorValidity();
3577
3661
  };
@@ -3592,7 +3676,7 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
3592
3676
 
3593
3677
  $.fn.spinbtnUI = function(opts){
3594
3678
  opts = $.extend({
3595
- monthNames: 'monthNames'
3679
+ monthNames: 'monthNamesShort'
3596
3680
  }, opts);
3597
3681
  return this.each(function(){
3598
3682
  $.webshims.objectCreate(spinBtnProto, {
@@ -3622,6 +3706,53 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
3622
3706
  isVisible: true
3623
3707
  };
3624
3708
 
3709
+ picker.isInRange = function(value, max, min){
3710
+ return !((min[0] && min[0] > value[0]) || (max[0] && max[0] < value[0]));
3711
+ };
3712
+
3713
+
3714
+ picker.createYearSelect = function(value, max, min, valueAdd, stepper){
3715
+ if(!stepper){
3716
+ stepper = {start: value, step: 1, label: value};
3717
+ }
3718
+ var temp;
3719
+ var goUp = true;
3720
+ var goDown = true;
3721
+ var options = ['<option selected="">'+ stepper.label + '</option>'];
3722
+ var i = 0;
3723
+ var createOption = function(value, add){
3724
+ var value2, label;
3725
+ if(stepper.step > 1){
3726
+ value2 = value + stepper.step - 1;
3727
+ label = value+' – '+value2;
3728
+ } else {
3729
+ label = value;
3730
+ }
3731
+
3732
+ if(picker.isInRange([value], max, min) || (value2 && picker.isInRange([value2], max, min))){
3733
+ options[add]('<option value="'+ (value+valueAdd) +'">'+ label +'</option>');
3734
+ return true;
3735
+ }
3736
+ };
3737
+ if(!valueAdd){
3738
+ valueAdd = '';
3739
+ }
3740
+ while(i < 18 && (goUp || goDown)){
3741
+ i++;
3742
+ if(goUp){
3743
+ temp = stepper.start - (i * stepper.step);
3744
+ goUp = createOption(temp, 'unshift');
3745
+ }
3746
+ if(goDown){
3747
+ temp = stepper.start + (i * stepper.step);
3748
+ goDown = createOption(temp, 'push');
3749
+ }
3750
+
3751
+ }
3752
+
3753
+ return options;
3754
+ };
3755
+
3625
3756
  picker._genericSetFocus = function(element, _noFocus){
3626
3757
  element = $(element || this.activeButton);
3627
3758
 
@@ -3631,12 +3762,12 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
3631
3762
  clearTimeout(that.timer);
3632
3763
  that.timer = setTimeout(function(){
3633
3764
  if(element[0]){
3634
- element[0].focus();
3765
+ element.trigger('focus');
3635
3766
  if(noTrigger !== true && !element.is(':focus')){
3636
3767
  setFocus(true);
3637
3768
  }
3638
3769
  }
3639
- }, that.popover.isVisible ? 99 : 360);
3770
+ }, that.popover.isVisible ? 0 : 360);
3640
3771
  };
3641
3772
  this.popover.activateElement(element);
3642
3773
  setFocus();
@@ -3849,7 +3980,7 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
3849
3980
  popover.preventBlur();
3850
3981
  }
3851
3982
  },
3852
- mousedown: function(){
3983
+ mousedown: function(e){
3853
3984
  mouseFocus = true;
3854
3985
  setTimeout(resetMouseFocus, 9);
3855
3986
  if(options.buttonOnly && popover.isVisible && popover.activeElement){
@@ -4007,31 +4138,41 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
4007
4138
  var updateStyles = function(){
4008
4139
  $(data.orig).removeClass('ws-important-hide');
4009
4140
  $.style( data.orig, 'display', '' );
4010
- var hasButtons, marginR, marginL;
4141
+ var hasButtons, marginR, marginL, left, right, isRtl;
4011
4142
  var correctWidth = 0.8;
4012
4143
  if(!init || data.orig.offsetWidth){
4013
4144
  hasButtons = data.buttonWrapper && data.buttonWrapper.filter(isVisible).length;
4014
- marginR = $.css( data.orig, 'marginRight');
4015
- data.element.css({
4016
- marginLeft: $.css( data.orig, 'marginLeft'),
4017
- marginRight: hasButtons ? 0 : marginR
4018
- });
4145
+
4146
+ isRtl = hasButtons && data.buttonWrapper.css('direction') == 'rtl';
4147
+ if(isRtl){
4148
+ left = 'Right';
4149
+ right = 'Left';
4150
+ } else {
4151
+ left = 'Left';
4152
+ right = 'Right';
4153
+ }
4154
+
4155
+ marginR = $.css( data.orig, 'margin'+right);
4156
+
4157
+ data.element
4158
+ .css('margin'+left, $.css( data.orig, 'margin'+left))
4159
+ .css('margin'+right, hasButtons ? 0 : marginR)
4160
+ ;
4019
4161
 
4020
4162
  if(hasButtons){
4021
- marginL = (parseInt(data.buttonWrapper.css('marginLeft'), 10) || 0);
4022
- data.element.css({paddingRight: ''});
4163
+ data.buttonWrapper[isRtl ? 'addClass' : 'removeClass']('ws-is-rtl');
4164
+ marginL = (parseInt(data.buttonWrapper.css('margin'+left), 10) || 0);
4165
+ data.element.css('padding'+right, '');
4023
4166
 
4024
4167
  if(marginL < 0){
4025
4168
  marginR = (parseInt(marginR, 10) || 0) + ((data.buttonWrapper.outerWidth() + marginL) * -1);
4026
- data.buttonWrapper.css('marginRight', marginR);
4169
+ data.buttonWrapper.css('margin'+right, marginR);
4027
4170
  data.element
4028
- .css({paddingRight: ''})
4029
- .css({
4030
- paddingRight: (parseInt( data.element.css('paddingRight'), 10) || 0) + data.buttonWrapper.outerWidth()
4031
- })
4171
+ .css('padding'+right, '')
4172
+ .css('padding'+right, (parseInt( data.element.css('padding'+right), 10) || 0) + data.buttonWrapper.outerWidth())
4032
4173
  ;
4033
4174
  } else {
4034
- data.buttonWrapper.css('marginRight', marginR);
4175
+ data.buttonWrapper.css('margin'+right, marginR);
4035
4176
  correctWidth = data.buttonWrapper.outerWidth(true) + correctWidth;
4036
4177
  }
4037
4178
  }
@@ -4049,7 +4190,7 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
4049
4190
 
4050
4191
  var type = $.prop(this, 'type');
4051
4192
 
4052
- var i, opts, data, optsName, labels;
4193
+ var i, opts, data, optsName, labels, cNames;
4053
4194
  if(inputTypes[type] && webshims.implement(this, 'inputwidgets')){
4054
4195
  data = {};
4055
4196
  optsName = type;
@@ -4087,17 +4228,38 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
4087
4228
  opts[optsName] = $.attr(this, copyAttrs[i]) || opts[optsName];
4088
4229
  }
4089
4230
  }
4090
-
4091
- if(opts.onlyMonthDigits || (!opts.formatMonthNames && opts.monthSelect)){
4092
- opts.formatMonthNames = 'monthDigits';
4231
+ if(opts.formatMonthNames){
4232
+ webshims.error('formatMonthNames was renamded to monthNames');
4233
+ }
4234
+ if(opts.onlyMonthDigits){
4235
+ opts.monthNames = 'monthDigits';
4093
4236
  }
4094
4237
  data.shim = inputTypes[type]._create(opts);
4095
-
4238
+
4096
4239
  webshims.addShadowDom(this, data.shim.element, {
4097
4240
  data: data.shim || {}
4098
4241
  });
4099
4242
 
4100
4243
  data.shim.options.containerElements.push(data.shim.element[0]);
4244
+ cNames = $.prop(this, 'className');
4245
+ if(opts.classes){
4246
+ cNames += ' '+opts.classes;
4247
+ }
4248
+
4249
+ if(opts.splitInput || type == 'range'){
4250
+ cNames = cNames.replace('form-control', '');
4251
+ }
4252
+
4253
+ data.shim.element.on('change input', stopPropagation).addClass(cNames);
4254
+
4255
+ if(data.shim.buttonWrapper){
4256
+
4257
+ data.shim.buttonWrapper.addClass('input-button-size-'+(data.shim.buttonWrapper.children().filter(isVisible).length));
4258
+
4259
+ if(data.shim.buttonWrapper.filter(isVisible).length){
4260
+ data.shim.element.addClass('has-input-buttons');
4261
+ }
4262
+ }
4101
4263
 
4102
4264
  labelWidth($(this).getShadowFocusElement(), labels);
4103
4265
 
@@ -4129,14 +4291,13 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
4129
4291
  $(opts.orig).trigger(hasFocus ? 'focusin' : 'focusout');
4130
4292
  }
4131
4293
  hasFocusTriggered = hasFocus;
4132
- }, 0);
4294
+ }, 9);
4133
4295
  }
4134
4296
  })
4135
4297
  ;
4136
4298
  })();
4137
-
4138
4299
 
4139
- data.shim.element.on('change input', stopPropagation);
4300
+
4140
4301
 
4141
4302
  if(hasFormValidation){
4142
4303
  $(opts.orig).on('firstinvalid', function(e){
@@ -4152,13 +4313,6 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
4152
4313
  });
4153
4314
  }
4154
4315
 
4155
-
4156
- if(data.shim.buttonWrapper && data.shim.buttonWrapper.filter(isVisible).length){
4157
- data.shim.element.addClass('has-input-buttons');
4158
- }
4159
-
4160
- data.shim.element.addClass($.prop(this, 'className'));
4161
-
4162
4316
  if(opts.calculateWidth){
4163
4317
  sizeInput(data.shim);
4164
4318
  } else {
@@ -4220,7 +4374,7 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
4220
4374
  if(!modernizrInputTypes[name] || replace[name]){
4221
4375
  extendType(name, {
4222
4376
  _create: function(opts, set){
4223
- if(opts.monthSelect || opts.daySelect){
4377
+ if(opts.monthSelect || opts.daySelect || opts.yearSelect){
4224
4378
  opts.splitInput = true;
4225
4379
  }
4226
4380
  if(opts.splitInput && !splitInputs[name]){
@@ -4239,7 +4393,6 @@ if((!advancedObjectProperties || !Object.create || !Object.defineProperties || !
4239
4393
  if(webshims.picker && webshims.picker[name]){
4240
4394
  webshims.picker[name](data);
4241
4395
  }
4242
- data.buttonWrapper.addClass('input-button-size-'+(data.buttonWrapper.children().filter(isVisible).length));
4243
4396
  return data;
4244
4397
  }
4245
4398
  });