webshims-rails 1.11.1 → 1.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/webshims-rails/version.rb +2 -2
- data/vendor/assets/javascripts/webshims/polyfiller.js +41 -20
- data/vendor/assets/javascripts/webshims/shims/combos/10.js +212 -42
- data/vendor/assets/javascripts/webshims/shims/combos/11.js +196 -37
- data/vendor/assets/javascripts/webshims/shims/combos/12.js +82 -36
- data/vendor/assets/javascripts/webshims/shims/combos/13.js +82 -36
- data/vendor/assets/javascripts/webshims/shims/combos/14.js +17 -6
- data/vendor/assets/javascripts/webshims/shims/combos/15.js +234 -1247
- data/vendor/assets/javascripts/webshims/shims/combos/16.js +234 -1247
- data/vendor/assets/javascripts/webshims/shims/combos/17.js +202 -45
- data/vendor/assets/javascripts/webshims/shims/combos/18.js +202 -45
- data/vendor/assets/javascripts/webshims/shims/combos/19.js +16 -5
- data/vendor/assets/javascripts/webshims/shims/combos/2.js +51 -11
- data/vendor/assets/javascripts/webshims/shims/combos/20.js +16 -5
- data/vendor/assets/javascripts/webshims/shims/combos/21.js +82 -36
- data/vendor/assets/javascripts/webshims/shims/combos/22.js +82 -36
- data/vendor/assets/javascripts/webshims/shims/combos/24.js +1689 -997
- data/vendor/assets/javascripts/webshims/shims/combos/25.js +16 -5
- data/vendor/assets/javascripts/webshims/shims/combos/26.js +16 -5
- data/vendor/assets/javascripts/webshims/shims/combos/3.js +16 -5
- data/vendor/assets/javascripts/webshims/shims/combos/30.js +51 -11
- data/vendor/assets/javascripts/webshims/shims/combos/31.js +51 -11
- data/vendor/assets/javascripts/webshims/shims/combos/4.js +16 -5
- data/vendor/assets/javascripts/webshims/shims/combos/5.js +202 -45
- data/vendor/assets/javascripts/webshims/shims/combos/6.js +237 -51
- data/vendor/assets/javascripts/webshims/shims/combos/7.js +51 -11
- data/vendor/assets/javascripts/webshims/shims/combos/8.js +16 -5
- data/vendor/assets/javascripts/webshims/shims/combos/9.js +247 -48
- data/vendor/assets/javascripts/webshims/shims/dom-extend.js +17 -5
- data/vendor/assets/javascripts/webshims/shims/form-datalist-lazy.js +21 -3
- data/vendor/assets/javascripts/webshims/shims/form-datalist.js +35 -6
- data/vendor/assets/javascripts/webshims/shims/form-number-date-api.js +6 -8
- data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +134 -24
- data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +152 -1205
- data/vendor/assets/javascripts/webshims/shims/form-shim-extend2.js +1076 -0
- data/vendor/assets/javascripts/webshims/shims/form-validation.js +47 -20
- data/vendor/assets/javascripts/webshims/shims/form-validators.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/forms-picker.js +1 -1
- data/vendor/assets/javascripts/webshims/shims/i18n/{formcfg-de.txt → formcfg-de.js} +3 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{formcfg-en.txt → formcfg-en.js} +5 -1
- data/vendor/assets/javascripts/webshims/shims/json-storage.js +1 -1
- data/vendor/assets/javascripts/webshims/shims/mediaelement-yt.js +1 -1
- data/vendor/assets/javascripts/webshims/shims/range-ui.js +62 -13
- data/vendor/assets/javascripts/webshims/shims/styles/forms-ext.css +610 -0
- data/vendor/assets/javascripts/webshims/shims/styles/scss/_extends.scss +10 -0
- data/vendor/assets/javascripts/webshims/shims/styles/scss/forms-ext.scss +743 -0
- data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +1 -755
- data/vendor/assets/javascripts/webshims/shims/styles/shim.css +0 -606
- data/vendor/assets/javascripts/webshims/shims/swf/JarisFLVPlayer.swf +0 -0
- data/vendor/assets/javascripts/webshims/shims/track-ui.js +36 -23
- data/vendor/assets/javascripts/webshims/shims/track.js +82 -36
- metadata +8 -6
- data/vendor/assets/javascripts/webshims/shims/combos/28.js +0 -2196
- data/vendor/assets/javascripts/webshims/shims/combos/29.js +0 -1167
@@ -1001,7 +1001,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
1001
1001
|
cache = {type: type};
|
1002
1002
|
if(!factor){
|
1003
1003
|
factor = 1;
|
1004
|
-
webshims.
|
1004
|
+
webshims.warn("you should always use a factor for stepUp/stepDown");
|
1005
1005
|
}
|
1006
1006
|
factor *= stepFactor;
|
1007
1007
|
|
@@ -1037,13 +1037,11 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
1037
1037
|
webshims.info("max/min overflow can't apply stepUp/stepDown");
|
1038
1038
|
throw('invalid state error');
|
1039
1039
|
}
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
} else if(stepDescriptor.prop && stepDescriptor.prop.value){
|
1046
|
-
return stepDescriptor.prop.value.apply(this, arguments);
|
1040
|
+
|
1041
|
+
$.prop(this, 'valueAsNumber', val);
|
1042
|
+
|
1043
|
+
} else if(stepDescriptor.prop && stepDescriptor.prop._supvalue){
|
1044
|
+
return stepDescriptor.prop._supvalue.apply(this, arguments);
|
1047
1045
|
} else {
|
1048
1046
|
webshims.info("no step method for type: "+ type);
|
1049
1047
|
throw('invalid state error');
|
@@ -1410,9 +1408,9 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
1410
1408
|
var i;
|
1411
1409
|
|
1412
1410
|
|
1413
|
-
this.element.addClass('ws-range').attr({role: 'slider'}).append('<span class="ws-range-min" /><span class="ws-range-rail"><span class="ws-range-thumb" /></span>');
|
1414
|
-
this.trail = $('.ws-range-
|
1415
|
-
this.range = $('.ws-range-
|
1411
|
+
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>');
|
1412
|
+
this.trail = $('.ws-range-track', this.element);
|
1413
|
+
this.range = $('.ws-range-progress ', this.element);
|
1416
1414
|
this.thumb = $('.ws-range-thumb', this.trail);
|
1417
1415
|
|
1418
1416
|
this.updateMetrics();
|
@@ -1422,6 +1420,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
1422
1420
|
for(i = 0; i < createOpts.length; i++){
|
1423
1421
|
this[createOpts[i]](this.options[createOpts[i]]);
|
1424
1422
|
}
|
1423
|
+
|
1425
1424
|
this.value = this._value;
|
1426
1425
|
this.value(this.options.value);
|
1427
1426
|
this.initDataList();
|
@@ -1660,7 +1659,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
1660
1659
|
}
|
1661
1660
|
},
|
1662
1661
|
addBindings: function(){
|
1663
|
-
var leftOffset, widgetUnits, hasFocus;
|
1662
|
+
var leftOffset, widgetUnits, hasFocus, isActive;
|
1664
1663
|
var that = this;
|
1665
1664
|
var o = this.options;
|
1666
1665
|
|
@@ -1690,8 +1689,28 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
1690
1689
|
}
|
1691
1690
|
};
|
1692
1691
|
})();
|
1693
|
-
|
1692
|
+
var normalizeTouch = (function(){
|
1693
|
+
var types = {
|
1694
|
+
touchstart: 1,
|
1695
|
+
touchend: 1,
|
1696
|
+
touchmove: 1
|
1697
|
+
};
|
1698
|
+
var normalize = ['pageX', 'pageY'];
|
1699
|
+
return function(e){
|
1700
|
+
if(types[e.type] && e.originalEvent && e.originalEvent.touches && e.originalEvent.touches.length){
|
1701
|
+
for(var i = 0; i < normalize.length; i++){
|
1702
|
+
e[normalize[i]] = e.originalEvent.touches[0][normalize[i]];
|
1703
|
+
}
|
1704
|
+
|
1705
|
+
}
|
1706
|
+
return e;
|
1707
|
+
};
|
1708
|
+
})();
|
1694
1709
|
var setValueFromPos = function(e, animate){
|
1710
|
+
if(e.type == 'touchmove'){
|
1711
|
+
e.preventDefault();
|
1712
|
+
normalizeTouch(e);
|
1713
|
+
}
|
1695
1714
|
|
1696
1715
|
var val = that.getStepedValueFromPos((e[that.dirs.mouse] - leftOffset) * widgetUnits);
|
1697
1716
|
if(val != o.value){
|
@@ -1708,18 +1727,25 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
1708
1727
|
eventTimer.call('change', o.value);
|
1709
1728
|
}
|
1710
1729
|
that.addRemoveClass('ws-active');
|
1711
|
-
$(document).off('mousemove', setValueFromPos).off('mouseup', remove);
|
1730
|
+
$(document).off('mousemove touchmove', setValueFromPos).off('mouseup touchend', remove);
|
1712
1731
|
$(window).off('blur', removeWin);
|
1732
|
+
isActive = false;
|
1713
1733
|
};
|
1714
1734
|
var removeWin = function(e){
|
1715
1735
|
if(e.target == window){remove();}
|
1716
1736
|
};
|
1717
1737
|
var add = function(e){
|
1718
1738
|
var outerWidth;
|
1739
|
+
|
1740
|
+
if(isActive || (e.type == 'touchstart' && (!e.originalEvent || !e.originalEvent.touches || e.originalEvent.touches.length != 1))){
|
1741
|
+
return;
|
1742
|
+
}
|
1719
1743
|
e.preventDefault();
|
1720
|
-
|
1744
|
+
|
1745
|
+
$(document).off('mousemove touchmove', setValueFromPos).off('mouseup touchend', remove);
|
1721
1746
|
$(window).off('blur', removeWin);
|
1722
1747
|
if(!o.readonly && !o.disabled){
|
1748
|
+
normalizeTouch(e);
|
1723
1749
|
that.element.focus();
|
1724
1750
|
that.addRemoveClass('ws-active', true);
|
1725
1751
|
leftOffset = that.element.focus().offset();
|
@@ -1729,20 +1755,27 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
1729
1755
|
leftOffset = leftOffset[that.dirs.pos];
|
1730
1756
|
widgetUnits = 100 / widgetUnits;
|
1731
1757
|
setValueFromPos(e, o.animate);
|
1758
|
+
isActive = true;
|
1732
1759
|
$(document)
|
1733
|
-
.on(
|
1734
|
-
|
1735
|
-
|
1736
|
-
|
1760
|
+
.on(e.type == 'touchstart' ?
|
1761
|
+
{
|
1762
|
+
touchend: remove,
|
1763
|
+
touchmove: setValueFromPos
|
1764
|
+
} :
|
1765
|
+
{
|
1766
|
+
mouseup: remove,
|
1767
|
+
mousemove: setValueFromPos
|
1768
|
+
}
|
1769
|
+
)
|
1737
1770
|
;
|
1738
1771
|
$(window).on('blur', removeWin);
|
1739
1772
|
e.stopPropagation();
|
1740
1773
|
}
|
1741
1774
|
};
|
1742
1775
|
var elementEvts = {
|
1743
|
-
mousedown: add,
|
1776
|
+
'touchstart mousedown': add,
|
1744
1777
|
focus: function(e){
|
1745
|
-
if(!o.disabled){
|
1778
|
+
if(!o.disabled && !hasFocus){
|
1746
1779
|
eventTimer.init('input', o.value);
|
1747
1780
|
eventTimer.init('change', o.value);
|
1748
1781
|
that.addRemoveClass('ws-focus', true);
|
@@ -1805,6 +1838,20 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
1805
1838
|
this.thumb.on({
|
1806
1839
|
mousedown: add
|
1807
1840
|
});
|
1841
|
+
|
1842
|
+
if(this.orig){
|
1843
|
+
$(this.orig).jProp('form').on('reset', function(){
|
1844
|
+
var val = $.prop(that.orig, 'value');
|
1845
|
+
that.value(val);
|
1846
|
+
setTimeout(function(){
|
1847
|
+
var val2 = $.prop(that.orig, 'value');
|
1848
|
+
if(val != val2){
|
1849
|
+
that.value(val2);
|
1850
|
+
}
|
1851
|
+
}, 4);
|
1852
|
+
});
|
1853
|
+
}
|
1854
|
+
|
1808
1855
|
if (window.webshims) {
|
1809
1856
|
webshims.ready('WINDOWLOAD', function(){
|
1810
1857
|
webshims.ready('dom-support', function(){
|
@@ -1910,8 +1957,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1910
1957
|
var str;
|
1911
1958
|
return function(){
|
1912
1959
|
if(!str){
|
1913
|
-
str = ('<option></option>')+$.map(monthDigits, function(val){
|
1914
|
-
return '<option>'+val+'</option>';
|
1960
|
+
str = ('<option value=""></option>')+$.map(monthDigits, function(val){
|
1961
|
+
return '<option value="'+val+'"]>'+val+'</option>';
|
1915
1962
|
}).join('');
|
1916
1963
|
}
|
1917
1964
|
return str;
|
@@ -1933,7 +1980,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1933
1980
|
splits: [$('<input type="text" class="yy" size="4" inputmode="numeric" />')[0]]
|
1934
1981
|
};
|
1935
1982
|
if(opts.monthSelect){
|
1936
|
-
obj.splits.push($('<select class="mm">'+getMonthOptions()+'</select>')[0]);
|
1983
|
+
obj.splits.push($('<select class="mm">'+getMonthOptions(opts)+'</select>')[0]);
|
1937
1984
|
} else {
|
1938
1985
|
obj.splits.push($('<input type="text" class="mm" inputmode="numeric" maxlength="2" size="2" />')[0]);
|
1939
1986
|
}
|
@@ -1968,7 +2015,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1968
2015
|
splits: [$('<input type="text" class="yy" inputmode="numeric" size="4" />')[0]]
|
1969
2016
|
};
|
1970
2017
|
if(opts.monthSelect){
|
1971
|
-
obj.splits.push($('<select class="mm ws-spin">'+getMonthOptions()+'</select>')[0]);
|
2018
|
+
obj.splits.push($('<select class="mm ws-spin">'+getMonthOptions(opts)+'</select>')[0]);
|
1972
2019
|
} else {
|
1973
2020
|
obj.splits.push($('<input type="text" class="mm ws-spin" />')[0]);
|
1974
2021
|
if(opts.onlyMonthDigits){
|
@@ -2060,6 +2107,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2060
2107
|
month: {
|
2061
2108
|
currentText: 'Aktueller Monat'
|
2062
2109
|
},
|
2110
|
+
time: {
|
2111
|
+
currentText: 'Jetzt'
|
2112
|
+
},
|
2063
2113
|
date: {
|
2064
2114
|
close: 'schließen',
|
2065
2115
|
clear: 'Löschen',
|
@@ -2097,6 +2147,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2097
2147
|
month: {
|
2098
2148
|
currentText: 'This month'
|
2099
2149
|
},
|
2150
|
+
time: {
|
2151
|
+
"currentText": "Now"
|
2152
|
+
},
|
2100
2153
|
date: {
|
2101
2154
|
"closeText": "Done",
|
2102
2155
|
clear: 'Clear',
|
@@ -2159,6 +2212,12 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2159
2212
|
if(!langCfg['datetime-localSigns']){
|
2160
2213
|
langCfg['datetime-localSigns'] = langCfg.dateSigns+langCfg.timeSigns;
|
2161
2214
|
}
|
2215
|
+
if(!langCfg['datetime-local']){
|
2216
|
+
langCfg['datetime-local'] = {};
|
2217
|
+
}
|
2218
|
+
if(!langCfg['datetime-local'].currentText && langCfg.time.currentText){
|
2219
|
+
langCfg['datetime-local'].currentText = langCfg.time.currentText;
|
2220
|
+
}
|
2162
2221
|
};
|
2163
2222
|
var triggerLocaleChange = function(){
|
2164
2223
|
processLangCFG(curCfg);
|
@@ -2226,6 +2285,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2226
2285
|
} else {
|
2227
2286
|
fVal = 0;
|
2228
2287
|
}
|
2288
|
+
if(val[0] === '00'){
|
2289
|
+
val[0] = '12';
|
2290
|
+
}
|
2229
2291
|
val = $.trim(val.join(':')) + ' '+ curCfg.meridian[fVal];
|
2230
2292
|
}
|
2231
2293
|
return val;
|
@@ -2310,6 +2372,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2310
2372
|
time: function(val){
|
2311
2373
|
var fVal;
|
2312
2374
|
if(val && curCfg.meridian){
|
2375
|
+
if(val.substr(0,2) === "12"){
|
2376
|
+
val = "00" + val.substr(2);
|
2377
|
+
}
|
2313
2378
|
if(val.indexOf(curCfg.meridian[1]) != -1){
|
2314
2379
|
val = val.split(':');
|
2315
2380
|
fVal = (val[0] * 1);
|
@@ -2395,7 +2460,10 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2395
2460
|
if(hintValue.length == 2){
|
2396
2461
|
hintValue = opts.splitInput ?
|
2397
2462
|
hintValue :
|
2398
|
-
curCfg.
|
2463
|
+
curCfg.date.showMonthAfterYear ?
|
2464
|
+
hintValue[0] +' '+hintValue[1] :
|
2465
|
+
|
2466
|
+
hintValue[1] +' '+ hintValue[0];
|
2399
2467
|
} else {
|
2400
2468
|
hintValue = opts.splitInput ?
|
2401
2469
|
[val, val] :
|
@@ -2770,10 +2838,18 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2770
2838
|
}
|
2771
2839
|
try {
|
2772
2840
|
that.elemHelper[name](factor);
|
2841
|
+
|
2773
2842
|
ret = that.elemHelper.prop('value');
|
2843
|
+
|
2844
|
+
} catch (er) {
|
2845
|
+
if(!o.value && that.maxAsNumber >= that.minAsNumber){
|
2846
|
+
ret = o.defValue;
|
2847
|
+
}
|
2848
|
+
}
|
2849
|
+
if(ret !== false && o.value != ret){
|
2774
2850
|
that.value(ret);
|
2775
2851
|
eventTimer.call('input', ret);
|
2776
|
-
}
|
2852
|
+
}
|
2777
2853
|
return ret;
|
2778
2854
|
}
|
2779
2855
|
};
|
@@ -2839,15 +2915,6 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2839
2915
|
|
2840
2916
|
initChangeEvents();
|
2841
2917
|
},
|
2842
|
-
value: function(val, force){
|
2843
|
-
if(!this._init || force || val !== this.options.value){
|
2844
|
-
this.element.val(this.formatValue(val));
|
2845
|
-
this.options.value = val;
|
2846
|
-
this._propertyChange('value');
|
2847
|
-
this.mirrorValidity();
|
2848
|
-
}
|
2849
|
-
|
2850
|
-
},
|
2851
2918
|
required: function(val, boolVal){
|
2852
2919
|
this.inputElements.attr({'aria-required': ''+boolVal});
|
2853
2920
|
this.mirrorValidity();
|
@@ -2864,7 +2931,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2864
2931
|
formatValue: function(val, noSplit){
|
2865
2932
|
return formatVal[this.type](val, noSplit === false ? false : this.options);
|
2866
2933
|
},
|
2867
|
-
createOpts: ['readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'value', 'required'],
|
2934
|
+
createOpts: ['readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'defaultValue', 'value', 'required'],
|
2868
2935
|
placeholder: function(val){
|
2869
2936
|
var options = this.options;
|
2870
2937
|
options.placeholder = val;
|
@@ -2934,6 +3001,16 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2934
3001
|
}
|
2935
3002
|
};
|
2936
3003
|
|
3004
|
+
['defaultValue', 'value'].forEach(function(name){
|
3005
|
+
wsWidgetProto[name] = function(val, force){
|
3006
|
+
if(!this._init || force || val !== this.options[name]){
|
3007
|
+
this.element.prop(name, this.formatValue(val));
|
3008
|
+
this.options[name] = val;
|
3009
|
+
this._propertyChange(name);
|
3010
|
+
this.mirrorValidity();
|
3011
|
+
}
|
3012
|
+
};
|
3013
|
+
});
|
2937
3014
|
|
2938
3015
|
['readonly', 'disabled'].forEach(function(name){
|
2939
3016
|
var isDisabled = name == 'disabled';
|
@@ -2987,7 +3064,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2987
3064
|
}
|
2988
3065
|
this._init = true;
|
2989
3066
|
},
|
2990
|
-
createOpts: ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'value', 'required'],
|
3067
|
+
createOpts: ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'defaultValue', 'value', 'required'],
|
2991
3068
|
_addSplitInputs: function(){
|
2992
3069
|
if(!this.inputElements){
|
2993
3070
|
var create = splitInputs[this.type]._create(this.options);
|
@@ -3057,9 +3134,47 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
3057
3134
|
this.options.step = val;
|
3058
3135
|
this.elemHelper.prop('step', retDefault(val, defStep.step));
|
3059
3136
|
this.mirrorValidity();
|
3137
|
+
},
|
3138
|
+
_beforeValue: function(val){
|
3139
|
+
this.valueAsNumber = this.asNumber(val);
|
3140
|
+
this.options.value = val;
|
3141
|
+
|
3142
|
+
if(isNaN(this.valueAsNumber) || (!isNaN(this.minAsNumber) && this.valueAsNumber < this.minAsNumber) || (!isNaN(this.maxAsNumber) && this.valueAsNumber > this.maxAsNumber)){
|
3143
|
+
this._setStartInRange();
|
3144
|
+
} else {
|
3145
|
+
this.elemHelper.prop('value', val);
|
3146
|
+
this.options.defValue = "";
|
3147
|
+
}
|
3060
3148
|
}
|
3061
3149
|
});
|
3062
3150
|
|
3151
|
+
['defaultValue', 'value'].forEach(function(name){
|
3152
|
+
var isValue = name == 'value';
|
3153
|
+
spinBtnProto[name] = function(val, force){
|
3154
|
+
if(!this._init || force || this.options[name] !== val){
|
3155
|
+
if(isValue){
|
3156
|
+
this._beforeValue(val);
|
3157
|
+
}
|
3158
|
+
|
3159
|
+
val = formatVal[this.type](val, this.options);
|
3160
|
+
if(this.options.splitInput){
|
3161
|
+
$.each(this.splits, function(i, elem){
|
3162
|
+
var setOption;
|
3163
|
+
if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
|
3164
|
+
$('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
|
3165
|
+
} else {
|
3166
|
+
$.prop(elem, name, val[i]);
|
3167
|
+
}
|
3168
|
+
});
|
3169
|
+
} else {
|
3170
|
+
this.element.prop(name, val);
|
3171
|
+
}
|
3172
|
+
this._propertyChange(name);
|
3173
|
+
this.mirrorValidity();
|
3174
|
+
}
|
3175
|
+
};
|
3176
|
+
});
|
3177
|
+
|
3063
3178
|
$.each({min: 1, max: -1}, function(name, factor){
|
3064
3179
|
var numName = name +'AsNumber';
|
3065
3180
|
spinBtnProto[name] = function(val){
|
@@ -3463,10 +3578,12 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
3463
3578
|
var inputTypes = {
|
3464
3579
|
|
3465
3580
|
};
|
3581
|
+
var boolAttrs = {disabled: 1, required: 1, readonly: 1};
|
3466
3582
|
var copyProps = [
|
3467
3583
|
'disabled',
|
3468
3584
|
'readonly',
|
3469
3585
|
'value',
|
3586
|
+
'defaultValue',
|
3470
3587
|
'min',
|
3471
3588
|
'max',
|
3472
3589
|
'step',
|
@@ -3484,14 +3601,18 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
3484
3601
|
if(!stopCircular){
|
3485
3602
|
var shadowData = webshims.data(this, 'shadowData');
|
3486
3603
|
if(shadowData && shadowData.data && shadowData.nativeElement === this && shadowData.data[fnName]){
|
3487
|
-
|
3604
|
+
if(boolAttrs[fnName]){
|
3605
|
+
shadowData.data[fnName](val, boolVal);
|
3606
|
+
} else {
|
3607
|
+
shadowData.data[fnName](val);
|
3608
|
+
}
|
3488
3609
|
}
|
3489
3610
|
}
|
3490
3611
|
});
|
3491
3612
|
});
|
3492
3613
|
|
3493
3614
|
if(options.replaceUI && 'valueAsNumber' in document.createElement('input')){
|
3494
|
-
var reflectFn = function(
|
3615
|
+
var reflectFn = function(){
|
3495
3616
|
if(webshims.data(this, 'hasShadow')){
|
3496
3617
|
$.prop(this, 'value', $.prop(this, 'value'));
|
3497
3618
|
}
|
@@ -3499,6 +3620,20 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
3499
3620
|
|
3500
3621
|
webshims.onNodeNamesPropertyModify('input', 'valueAsNumber', reflectFn);
|
3501
3622
|
webshims.onNodeNamesPropertyModify('input', 'valueAsDate', reflectFn);
|
3623
|
+
$.each({stepUp: 1, stepDown: -1}, function(name, stepFactor){
|
3624
|
+
var stepDescriptor = webshims.defineNodeNameProperty('input', name, {
|
3625
|
+
prop: {
|
3626
|
+
value: function(){
|
3627
|
+
var ret;
|
3628
|
+
if(stepDescriptor.prop && stepDescriptor.prop._supvalue){
|
3629
|
+
ret = stepDescriptor.prop._supvalue.apply(this, arguments);
|
3630
|
+
reflectFn.apply(this, arguments);
|
3631
|
+
}
|
3632
|
+
return ret;
|
3633
|
+
}
|
3634
|
+
}
|
3635
|
+
});
|
3636
|
+
});
|
3502
3637
|
}
|
3503
3638
|
|
3504
3639
|
var extendType = (function(){
|
@@ -3518,7 +3653,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
3518
3653
|
$(data.orig).removeClass('ws-important-hide');
|
3519
3654
|
$.style( data.orig, 'display', '' );
|
3520
3655
|
var hasButtons, marginR, marginL;
|
3521
|
-
var correctWidth = 0.
|
3656
|
+
var correctWidth = 0.8;
|
3522
3657
|
if(!init || data.orig.offsetWidth){
|
3523
3658
|
hasButtons = data.buttonWrapper && data.buttonWrapper.filter(isVisible).length;
|
3524
3659
|
marginR = $.css( data.orig, 'marginRight');
|
@@ -3542,7 +3677,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
3542
3677
|
;
|
3543
3678
|
} else {
|
3544
3679
|
data.buttonWrapper.css('marginRight', marginR);
|
3545
|
-
correctWidth = data.buttonWrapper.outerWidth(true) +
|
3680
|
+
correctWidth = data.buttonWrapper.outerWidth(true) + correctWidth;
|
3546
3681
|
}
|
3547
3682
|
}
|
3548
3683
|
|
@@ -3700,7 +3835,29 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
3700
3835
|
});
|
3701
3836
|
}
|
3702
3837
|
|
3703
|
-
|
3838
|
+
var replace = {};
|
3839
|
+
|
3840
|
+
|
3841
|
+
if(options.replaceUI){
|
3842
|
+
if( $.isPlainObject(options.replaceUI) ){
|
3843
|
+
$.extend(replace, options.replaceUI);
|
3844
|
+
} else {
|
3845
|
+
$.extend(replace, {
|
3846
|
+
'range': 1,
|
3847
|
+
'number': 1,
|
3848
|
+
'time': 1,
|
3849
|
+
'month': 1,
|
3850
|
+
'date': 1,
|
3851
|
+
'color': 1,
|
3852
|
+
'datetime-local': 1
|
3853
|
+
});
|
3854
|
+
}
|
3855
|
+
}
|
3856
|
+
if(modernizrInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)))){
|
3857
|
+
replace.number = 1;
|
3858
|
+
}
|
3859
|
+
|
3860
|
+
if(!modernizrInputTypes.range || replace.range){
|
3704
3861
|
extendType('range', {
|
3705
3862
|
_create: function(opts, set){
|
3706
3863
|
var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi');
|
@@ -3709,9 +3866,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
3709
3866
|
});
|
3710
3867
|
}
|
3711
3868
|
|
3712
|
-
|
3869
|
+
|
3713
3870
|
['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){
|
3714
|
-
if(!modernizrInputTypes[name] ||
|
3871
|
+
if(!modernizrInputTypes[name] || replace[name]){
|
3715
3872
|
extendType(name, {
|
3716
3873
|
_create: function(opts, set){
|
3717
3874
|
if(opts.monthSelect){
|