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
@@ -198,7 +198,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
198
198
|
cache = {type: type};
|
199
199
|
if(!factor){
|
200
200
|
factor = 1;
|
201
|
-
webshims.
|
201
|
+
webshims.warn("you should always use a factor for stepUp/stepDown");
|
202
202
|
}
|
203
203
|
factor *= stepFactor;
|
204
204
|
|
@@ -234,13 +234,11 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
234
234
|
webshims.info("max/min overflow can't apply stepUp/stepDown");
|
235
235
|
throw('invalid state error');
|
236
236
|
}
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
} else if(stepDescriptor.prop && stepDescriptor.prop.value){
|
243
|
-
return stepDescriptor.prop.value.apply(this, arguments);
|
237
|
+
|
238
|
+
$.prop(this, 'valueAsNumber', val);
|
239
|
+
|
240
|
+
} else if(stepDescriptor.prop && stepDescriptor.prop._supvalue){
|
241
|
+
return stepDescriptor.prop._supvalue.apply(this, arguments);
|
244
242
|
} else {
|
245
243
|
webshims.info("no step method for type: "+ type);
|
246
244
|
throw('invalid state error');
|
@@ -607,9 +605,9 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
607
605
|
var i;
|
608
606
|
|
609
607
|
|
610
|
-
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>');
|
611
|
-
this.trail = $('.ws-range-
|
612
|
-
this.range = $('.ws-range-
|
608
|
+
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>');
|
609
|
+
this.trail = $('.ws-range-track', this.element);
|
610
|
+
this.range = $('.ws-range-progress ', this.element);
|
613
611
|
this.thumb = $('.ws-range-thumb', this.trail);
|
614
612
|
|
615
613
|
this.updateMetrics();
|
@@ -619,6 +617,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
619
617
|
for(i = 0; i < createOpts.length; i++){
|
620
618
|
this[createOpts[i]](this.options[createOpts[i]]);
|
621
619
|
}
|
620
|
+
|
622
621
|
this.value = this._value;
|
623
622
|
this.value(this.options.value);
|
624
623
|
this.initDataList();
|
@@ -857,7 +856,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
857
856
|
}
|
858
857
|
},
|
859
858
|
addBindings: function(){
|
860
|
-
var leftOffset, widgetUnits, hasFocus;
|
859
|
+
var leftOffset, widgetUnits, hasFocus, isActive;
|
861
860
|
var that = this;
|
862
861
|
var o = this.options;
|
863
862
|
|
@@ -887,8 +886,28 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
887
886
|
}
|
888
887
|
};
|
889
888
|
})();
|
890
|
-
|
889
|
+
var normalizeTouch = (function(){
|
890
|
+
var types = {
|
891
|
+
touchstart: 1,
|
892
|
+
touchend: 1,
|
893
|
+
touchmove: 1
|
894
|
+
};
|
895
|
+
var normalize = ['pageX', 'pageY'];
|
896
|
+
return function(e){
|
897
|
+
if(types[e.type] && e.originalEvent && e.originalEvent.touches && e.originalEvent.touches.length){
|
898
|
+
for(var i = 0; i < normalize.length; i++){
|
899
|
+
e[normalize[i]] = e.originalEvent.touches[0][normalize[i]];
|
900
|
+
}
|
901
|
+
|
902
|
+
}
|
903
|
+
return e;
|
904
|
+
};
|
905
|
+
})();
|
891
906
|
var setValueFromPos = function(e, animate){
|
907
|
+
if(e.type == 'touchmove'){
|
908
|
+
e.preventDefault();
|
909
|
+
normalizeTouch(e);
|
910
|
+
}
|
892
911
|
|
893
912
|
var val = that.getStepedValueFromPos((e[that.dirs.mouse] - leftOffset) * widgetUnits);
|
894
913
|
if(val != o.value){
|
@@ -905,18 +924,25 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
905
924
|
eventTimer.call('change', o.value);
|
906
925
|
}
|
907
926
|
that.addRemoveClass('ws-active');
|
908
|
-
$(document).off('mousemove', setValueFromPos).off('mouseup', remove);
|
927
|
+
$(document).off('mousemove touchmove', setValueFromPos).off('mouseup touchend', remove);
|
909
928
|
$(window).off('blur', removeWin);
|
929
|
+
isActive = false;
|
910
930
|
};
|
911
931
|
var removeWin = function(e){
|
912
932
|
if(e.target == window){remove();}
|
913
933
|
};
|
914
934
|
var add = function(e){
|
915
935
|
var outerWidth;
|
936
|
+
|
937
|
+
if(isActive || (e.type == 'touchstart' && (!e.originalEvent || !e.originalEvent.touches || e.originalEvent.touches.length != 1))){
|
938
|
+
return;
|
939
|
+
}
|
916
940
|
e.preventDefault();
|
917
|
-
|
941
|
+
|
942
|
+
$(document).off('mousemove touchmove', setValueFromPos).off('mouseup touchend', remove);
|
918
943
|
$(window).off('blur', removeWin);
|
919
944
|
if(!o.readonly && !o.disabled){
|
945
|
+
normalizeTouch(e);
|
920
946
|
that.element.focus();
|
921
947
|
that.addRemoveClass('ws-active', true);
|
922
948
|
leftOffset = that.element.focus().offset();
|
@@ -926,20 +952,27 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
926
952
|
leftOffset = leftOffset[that.dirs.pos];
|
927
953
|
widgetUnits = 100 / widgetUnits;
|
928
954
|
setValueFromPos(e, o.animate);
|
955
|
+
isActive = true;
|
929
956
|
$(document)
|
930
|
-
.on(
|
931
|
-
|
932
|
-
|
933
|
-
|
957
|
+
.on(e.type == 'touchstart' ?
|
958
|
+
{
|
959
|
+
touchend: remove,
|
960
|
+
touchmove: setValueFromPos
|
961
|
+
} :
|
962
|
+
{
|
963
|
+
mouseup: remove,
|
964
|
+
mousemove: setValueFromPos
|
965
|
+
}
|
966
|
+
)
|
934
967
|
;
|
935
968
|
$(window).on('blur', removeWin);
|
936
969
|
e.stopPropagation();
|
937
970
|
}
|
938
971
|
};
|
939
972
|
var elementEvts = {
|
940
|
-
mousedown: add,
|
973
|
+
'touchstart mousedown': add,
|
941
974
|
focus: function(e){
|
942
|
-
if(!o.disabled){
|
975
|
+
if(!o.disabled && !hasFocus){
|
943
976
|
eventTimer.init('input', o.value);
|
944
977
|
eventTimer.init('change', o.value);
|
945
978
|
that.addRemoveClass('ws-focus', true);
|
@@ -1002,6 +1035,20 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
1002
1035
|
this.thumb.on({
|
1003
1036
|
mousedown: add
|
1004
1037
|
});
|
1038
|
+
|
1039
|
+
if(this.orig){
|
1040
|
+
$(this.orig).jProp('form').on('reset', function(){
|
1041
|
+
var val = $.prop(that.orig, 'value');
|
1042
|
+
that.value(val);
|
1043
|
+
setTimeout(function(){
|
1044
|
+
var val2 = $.prop(that.orig, 'value');
|
1045
|
+
if(val != val2){
|
1046
|
+
that.value(val2);
|
1047
|
+
}
|
1048
|
+
}, 4);
|
1049
|
+
});
|
1050
|
+
}
|
1051
|
+
|
1005
1052
|
if (window.webshims) {
|
1006
1053
|
webshims.ready('WINDOWLOAD', function(){
|
1007
1054
|
webshims.ready('dom-support', function(){
|
@@ -1107,8 +1154,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1107
1154
|
var str;
|
1108
1155
|
return function(){
|
1109
1156
|
if(!str){
|
1110
|
-
str = ('<option></option>')+$.map(monthDigits, function(val){
|
1111
|
-
return '<option>'+val+'</option>';
|
1157
|
+
str = ('<option value=""></option>')+$.map(monthDigits, function(val){
|
1158
|
+
return '<option value="'+val+'"]>'+val+'</option>';
|
1112
1159
|
}).join('');
|
1113
1160
|
}
|
1114
1161
|
return str;
|
@@ -1130,7 +1177,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1130
1177
|
splits: [$('<input type="text" class="yy" size="4" inputmode="numeric" />')[0]]
|
1131
1178
|
};
|
1132
1179
|
if(opts.monthSelect){
|
1133
|
-
obj.splits.push($('<select class="mm">'+getMonthOptions()+'</select>')[0]);
|
1180
|
+
obj.splits.push($('<select class="mm">'+getMonthOptions(opts)+'</select>')[0]);
|
1134
1181
|
} else {
|
1135
1182
|
obj.splits.push($('<input type="text" class="mm" inputmode="numeric" maxlength="2" size="2" />')[0]);
|
1136
1183
|
}
|
@@ -1165,7 +1212,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1165
1212
|
splits: [$('<input type="text" class="yy" inputmode="numeric" size="4" />')[0]]
|
1166
1213
|
};
|
1167
1214
|
if(opts.monthSelect){
|
1168
|
-
obj.splits.push($('<select class="mm ws-spin">'+getMonthOptions()+'</select>')[0]);
|
1215
|
+
obj.splits.push($('<select class="mm ws-spin">'+getMonthOptions(opts)+'</select>')[0]);
|
1169
1216
|
} else {
|
1170
1217
|
obj.splits.push($('<input type="text" class="mm ws-spin" />')[0]);
|
1171
1218
|
if(opts.onlyMonthDigits){
|
@@ -1257,6 +1304,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1257
1304
|
month: {
|
1258
1305
|
currentText: 'Aktueller Monat'
|
1259
1306
|
},
|
1307
|
+
time: {
|
1308
|
+
currentText: 'Jetzt'
|
1309
|
+
},
|
1260
1310
|
date: {
|
1261
1311
|
close: 'schließen',
|
1262
1312
|
clear: 'Löschen',
|
@@ -1294,6 +1344,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1294
1344
|
month: {
|
1295
1345
|
currentText: 'This month'
|
1296
1346
|
},
|
1347
|
+
time: {
|
1348
|
+
"currentText": "Now"
|
1349
|
+
},
|
1297
1350
|
date: {
|
1298
1351
|
"closeText": "Done",
|
1299
1352
|
clear: 'Clear',
|
@@ -1356,6 +1409,12 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1356
1409
|
if(!langCfg['datetime-localSigns']){
|
1357
1410
|
langCfg['datetime-localSigns'] = langCfg.dateSigns+langCfg.timeSigns;
|
1358
1411
|
}
|
1412
|
+
if(!langCfg['datetime-local']){
|
1413
|
+
langCfg['datetime-local'] = {};
|
1414
|
+
}
|
1415
|
+
if(!langCfg['datetime-local'].currentText && langCfg.time.currentText){
|
1416
|
+
langCfg['datetime-local'].currentText = langCfg.time.currentText;
|
1417
|
+
}
|
1359
1418
|
};
|
1360
1419
|
var triggerLocaleChange = function(){
|
1361
1420
|
processLangCFG(curCfg);
|
@@ -1423,6 +1482,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1423
1482
|
} else {
|
1424
1483
|
fVal = 0;
|
1425
1484
|
}
|
1485
|
+
if(val[0] === '00'){
|
1486
|
+
val[0] = '12';
|
1487
|
+
}
|
1426
1488
|
val = $.trim(val.join(':')) + ' '+ curCfg.meridian[fVal];
|
1427
1489
|
}
|
1428
1490
|
return val;
|
@@ -1507,6 +1569,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1507
1569
|
time: function(val){
|
1508
1570
|
var fVal;
|
1509
1571
|
if(val && curCfg.meridian){
|
1572
|
+
if(val.substr(0,2) === "12"){
|
1573
|
+
val = "00" + val.substr(2);
|
1574
|
+
}
|
1510
1575
|
if(val.indexOf(curCfg.meridian[1]) != -1){
|
1511
1576
|
val = val.split(':');
|
1512
1577
|
fVal = (val[0] * 1);
|
@@ -1592,7 +1657,10 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1592
1657
|
if(hintValue.length == 2){
|
1593
1658
|
hintValue = opts.splitInput ?
|
1594
1659
|
hintValue :
|
1595
|
-
curCfg.
|
1660
|
+
curCfg.date.showMonthAfterYear ?
|
1661
|
+
hintValue[0] +' '+hintValue[1] :
|
1662
|
+
|
1663
|
+
hintValue[1] +' '+ hintValue[0];
|
1596
1664
|
} else {
|
1597
1665
|
hintValue = opts.splitInput ?
|
1598
1666
|
[val, val] :
|
@@ -1967,10 +2035,18 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1967
2035
|
}
|
1968
2036
|
try {
|
1969
2037
|
that.elemHelper[name](factor);
|
2038
|
+
|
1970
2039
|
ret = that.elemHelper.prop('value');
|
2040
|
+
|
2041
|
+
} catch (er) {
|
2042
|
+
if(!o.value && that.maxAsNumber >= that.minAsNumber){
|
2043
|
+
ret = o.defValue;
|
2044
|
+
}
|
2045
|
+
}
|
2046
|
+
if(ret !== false && o.value != ret){
|
1971
2047
|
that.value(ret);
|
1972
2048
|
eventTimer.call('input', ret);
|
1973
|
-
}
|
2049
|
+
}
|
1974
2050
|
return ret;
|
1975
2051
|
}
|
1976
2052
|
};
|
@@ -2036,15 +2112,6 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2036
2112
|
|
2037
2113
|
initChangeEvents();
|
2038
2114
|
},
|
2039
|
-
value: function(val, force){
|
2040
|
-
if(!this._init || force || val !== this.options.value){
|
2041
|
-
this.element.val(this.formatValue(val));
|
2042
|
-
this.options.value = val;
|
2043
|
-
this._propertyChange('value');
|
2044
|
-
this.mirrorValidity();
|
2045
|
-
}
|
2046
|
-
|
2047
|
-
},
|
2048
2115
|
required: function(val, boolVal){
|
2049
2116
|
this.inputElements.attr({'aria-required': ''+boolVal});
|
2050
2117
|
this.mirrorValidity();
|
@@ -2061,7 +2128,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2061
2128
|
formatValue: function(val, noSplit){
|
2062
2129
|
return formatVal[this.type](val, noSplit === false ? false : this.options);
|
2063
2130
|
},
|
2064
|
-
createOpts: ['readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'value', 'required'],
|
2131
|
+
createOpts: ['readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'defaultValue', 'value', 'required'],
|
2065
2132
|
placeholder: function(val){
|
2066
2133
|
var options = this.options;
|
2067
2134
|
options.placeholder = val;
|
@@ -2131,6 +2198,16 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2131
2198
|
}
|
2132
2199
|
};
|
2133
2200
|
|
2201
|
+
['defaultValue', 'value'].forEach(function(name){
|
2202
|
+
wsWidgetProto[name] = function(val, force){
|
2203
|
+
if(!this._init || force || val !== this.options[name]){
|
2204
|
+
this.element.prop(name, this.formatValue(val));
|
2205
|
+
this.options[name] = val;
|
2206
|
+
this._propertyChange(name);
|
2207
|
+
this.mirrorValidity();
|
2208
|
+
}
|
2209
|
+
};
|
2210
|
+
});
|
2134
2211
|
|
2135
2212
|
['readonly', 'disabled'].forEach(function(name){
|
2136
2213
|
var isDisabled = name == 'disabled';
|
@@ -2184,7 +2261,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2184
2261
|
}
|
2185
2262
|
this._init = true;
|
2186
2263
|
},
|
2187
|
-
createOpts: ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'value', 'required'],
|
2264
|
+
createOpts: ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'defaultValue', 'value', 'required'],
|
2188
2265
|
_addSplitInputs: function(){
|
2189
2266
|
if(!this.inputElements){
|
2190
2267
|
var create = splitInputs[this.type]._create(this.options);
|
@@ -2254,9 +2331,47 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2254
2331
|
this.options.step = val;
|
2255
2332
|
this.elemHelper.prop('step', retDefault(val, defStep.step));
|
2256
2333
|
this.mirrorValidity();
|
2334
|
+
},
|
2335
|
+
_beforeValue: function(val){
|
2336
|
+
this.valueAsNumber = this.asNumber(val);
|
2337
|
+
this.options.value = val;
|
2338
|
+
|
2339
|
+
if(isNaN(this.valueAsNumber) || (!isNaN(this.minAsNumber) && this.valueAsNumber < this.minAsNumber) || (!isNaN(this.maxAsNumber) && this.valueAsNumber > this.maxAsNumber)){
|
2340
|
+
this._setStartInRange();
|
2341
|
+
} else {
|
2342
|
+
this.elemHelper.prop('value', val);
|
2343
|
+
this.options.defValue = "";
|
2344
|
+
}
|
2257
2345
|
}
|
2258
2346
|
});
|
2259
2347
|
|
2348
|
+
['defaultValue', 'value'].forEach(function(name){
|
2349
|
+
var isValue = name == 'value';
|
2350
|
+
spinBtnProto[name] = function(val, force){
|
2351
|
+
if(!this._init || force || this.options[name] !== val){
|
2352
|
+
if(isValue){
|
2353
|
+
this._beforeValue(val);
|
2354
|
+
}
|
2355
|
+
|
2356
|
+
val = formatVal[this.type](val, this.options);
|
2357
|
+
if(this.options.splitInput){
|
2358
|
+
$.each(this.splits, function(i, elem){
|
2359
|
+
var setOption;
|
2360
|
+
if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
|
2361
|
+
$('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
|
2362
|
+
} else {
|
2363
|
+
$.prop(elem, name, val[i]);
|
2364
|
+
}
|
2365
|
+
});
|
2366
|
+
} else {
|
2367
|
+
this.element.prop(name, val);
|
2368
|
+
}
|
2369
|
+
this._propertyChange(name);
|
2370
|
+
this.mirrorValidity();
|
2371
|
+
}
|
2372
|
+
};
|
2373
|
+
});
|
2374
|
+
|
2260
2375
|
$.each({min: 1, max: -1}, function(name, factor){
|
2261
2376
|
var numName = name +'AsNumber';
|
2262
2377
|
spinBtnProto[name] = function(val){
|
@@ -2660,10 +2775,12 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2660
2775
|
var inputTypes = {
|
2661
2776
|
|
2662
2777
|
};
|
2778
|
+
var boolAttrs = {disabled: 1, required: 1, readonly: 1};
|
2663
2779
|
var copyProps = [
|
2664
2780
|
'disabled',
|
2665
2781
|
'readonly',
|
2666
2782
|
'value',
|
2783
|
+
'defaultValue',
|
2667
2784
|
'min',
|
2668
2785
|
'max',
|
2669
2786
|
'step',
|
@@ -2681,14 +2798,18 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2681
2798
|
if(!stopCircular){
|
2682
2799
|
var shadowData = webshims.data(this, 'shadowData');
|
2683
2800
|
if(shadowData && shadowData.data && shadowData.nativeElement === this && shadowData.data[fnName]){
|
2684
|
-
|
2801
|
+
if(boolAttrs[fnName]){
|
2802
|
+
shadowData.data[fnName](val, boolVal);
|
2803
|
+
} else {
|
2804
|
+
shadowData.data[fnName](val);
|
2805
|
+
}
|
2685
2806
|
}
|
2686
2807
|
}
|
2687
2808
|
});
|
2688
2809
|
});
|
2689
2810
|
|
2690
2811
|
if(options.replaceUI && 'valueAsNumber' in document.createElement('input')){
|
2691
|
-
var reflectFn = function(
|
2812
|
+
var reflectFn = function(){
|
2692
2813
|
if(webshims.data(this, 'hasShadow')){
|
2693
2814
|
$.prop(this, 'value', $.prop(this, 'value'));
|
2694
2815
|
}
|
@@ -2696,6 +2817,20 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2696
2817
|
|
2697
2818
|
webshims.onNodeNamesPropertyModify('input', 'valueAsNumber', reflectFn);
|
2698
2819
|
webshims.onNodeNamesPropertyModify('input', 'valueAsDate', reflectFn);
|
2820
|
+
$.each({stepUp: 1, stepDown: -1}, function(name, stepFactor){
|
2821
|
+
var stepDescriptor = webshims.defineNodeNameProperty('input', name, {
|
2822
|
+
prop: {
|
2823
|
+
value: function(){
|
2824
|
+
var ret;
|
2825
|
+
if(stepDescriptor.prop && stepDescriptor.prop._supvalue){
|
2826
|
+
ret = stepDescriptor.prop._supvalue.apply(this, arguments);
|
2827
|
+
reflectFn.apply(this, arguments);
|
2828
|
+
}
|
2829
|
+
return ret;
|
2830
|
+
}
|
2831
|
+
}
|
2832
|
+
});
|
2833
|
+
});
|
2699
2834
|
}
|
2700
2835
|
|
2701
2836
|
var extendType = (function(){
|
@@ -2715,7 +2850,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2715
2850
|
$(data.orig).removeClass('ws-important-hide');
|
2716
2851
|
$.style( data.orig, 'display', '' );
|
2717
2852
|
var hasButtons, marginR, marginL;
|
2718
|
-
var correctWidth = 0.
|
2853
|
+
var correctWidth = 0.8;
|
2719
2854
|
if(!init || data.orig.offsetWidth){
|
2720
2855
|
hasButtons = data.buttonWrapper && data.buttonWrapper.filter(isVisible).length;
|
2721
2856
|
marginR = $.css( data.orig, 'marginRight');
|
@@ -2739,7 +2874,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2739
2874
|
;
|
2740
2875
|
} else {
|
2741
2876
|
data.buttonWrapper.css('marginRight', marginR);
|
2742
|
-
correctWidth = data.buttonWrapper.outerWidth(true) +
|
2877
|
+
correctWidth = data.buttonWrapper.outerWidth(true) + correctWidth;
|
2743
2878
|
}
|
2744
2879
|
}
|
2745
2880
|
|
@@ -2897,7 +3032,29 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2897
3032
|
});
|
2898
3033
|
}
|
2899
3034
|
|
2900
|
-
|
3035
|
+
var replace = {};
|
3036
|
+
|
3037
|
+
|
3038
|
+
if(options.replaceUI){
|
3039
|
+
if( $.isPlainObject(options.replaceUI) ){
|
3040
|
+
$.extend(replace, options.replaceUI);
|
3041
|
+
} else {
|
3042
|
+
$.extend(replace, {
|
3043
|
+
'range': 1,
|
3044
|
+
'number': 1,
|
3045
|
+
'time': 1,
|
3046
|
+
'month': 1,
|
3047
|
+
'date': 1,
|
3048
|
+
'color': 1,
|
3049
|
+
'datetime-local': 1
|
3050
|
+
});
|
3051
|
+
}
|
3052
|
+
}
|
3053
|
+
if(modernizrInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)))){
|
3054
|
+
replace.number = 1;
|
3055
|
+
}
|
3056
|
+
|
3057
|
+
if(!modernizrInputTypes.range || replace.range){
|
2901
3058
|
extendType('range', {
|
2902
3059
|
_create: function(opts, set){
|
2903
3060
|
var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi');
|
@@ -2906,9 +3063,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2906
3063
|
});
|
2907
3064
|
}
|
2908
3065
|
|
2909
|
-
|
3066
|
+
|
2910
3067
|
['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){
|
2911
|
-
if(!modernizrInputTypes[name] ||
|
3068
|
+
if(!modernizrInputTypes[name] || replace[name]){
|
2912
3069
|
extendType(name, {
|
2913
3070
|
_create: function(opts, set){
|
2914
3071
|
if(opts.monthSelect){
|