vendor/assets/javascripts/webshims/shims/combos/17.js in webshims-rails-1.12.0 vs vendor/assets/javascripts/webshims/shims/combos/17.js in webshims-rails-1.12.2

- old
+ new

@@ -618,12 +618,11 @@ var createOpts = ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex']; var rangeProto = { _create: function(){ var i; - - 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>'); + 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>'); this.trail = $('.ws-range-track', this.element); this.range = $('.ws-range-progress', this.element); this.thumb = $('.ws-range-thumb', this.trail); this.updateMetrics(); @@ -641,11 +640,11 @@ this.addBindings(); this._init = true; }, value: $.noop, _value: function(val, _noNormalize, animate){ - var left, posDif, textValue; + var left, posDif; var o = this.options; var oVal = val; var thumbStyle = {}; var rangeStyle = {}; @@ -657,18 +656,19 @@ val = this.normalizeVal(val); } left = 100 * ((val - o.min) / (o.max - o.min)); if(this._init && val == o.value && oVal == val){return;} - this.options.value = val; + o.value = val; if($.fn.stop){ this.thumb.stop(); this.range.stop(); } rangeStyle[this.dirs.width] = left+'%'; + if(this.vertical){ left = Math.abs(left - 100); } thumbStyle[this.dirs.left] = left+'%'; @@ -691,19 +691,30 @@ } if(this.orig && (oVal != val || (!this._init && this.orig.value != val)) ){ this.options._change(val); } - textValue = this.options.textValue ? this.options.textValue(this.options.value) : this.options.options[this.options.value] || this.options.value; + this._setValueMarkup(); + }, + _setValueMarkup: function(){ + var o = this.options; + var textValue = o.textValue ? o.textValue(this.options.value) : o.options[o.value] || o.value; this.element.attr({ 'aria-valuenow': this.options.value, 'aria-valuetext': textValue }); - this.thumb.attr({ + $('span', this.thumb).attr({ 'data-value': this.options.value, 'data-valuetext': textValue }); + if(o.selectedOption){ + $(o.selectedOption).removeClass('ws-selected-option'); + o.selectedOption = null; + } + if(o.value in o.options){ + o.selectedOption = $('[data-value="'+o.value+'"].ws-range-ticks').addClass('ws-selected-option'); + } }, initDataList: function(){ if(this.orig){ var listTimer; var that = this; @@ -742,13 +753,13 @@ }); $.each(o.options, function(val, label){ if(!isNumber(val) || val < min || val > max){return;} var left = 100 * ((val - min) / (max - min)); - var attr = ''; + var attr = 'data-value="'+val+'"'; if(label){ - attr += 'data-label="'+label+'"'; + attr += ' data-label="'+label+'"'; if(o.showLabels){ attr += ' title="'+label+'"'; } } if(that.vertical){ @@ -757,10 +768,13 @@ that.posCenter( $('<span class="ws-range-ticks"'+ attr +' style="'+(that.dirs.left)+': '+left+'%;" />').appendTo(trail) ); }); + if(o.value in o.options){ + this._setValueMarkup(); + } }, readonly: function(val){ val = !!val; this.options.readonly = val; this.element.attr('aria-readonly', ''+val); @@ -800,16 +814,17 @@ step: function(val){ var o = this.options; var step = val == 'any' ? 'any' : retDefault(val, 1); if(o.stepping){ - if(step != 'any' && o.stepping % step){ - webshims.error('wrong stepping value for type range:'+ (o.stepping % step)); - } else { - step = o.stepping; - } + webshims.error('stepping was removed. Use stepfactor instead.'); } + + if(o.stepfactor && step != 'any'){ + step *= o.stepfactor; + } + o.step = step; this.value(this.options.value); }, normalizeVal: function(val){ @@ -843,15 +858,15 @@ getStepedValueFromPos: function(pos){ var val, valModStep, alignValue, step; if(pos <= 0){ - val = this.options[this.dirs.min]; + val = this.options[this.dirs[this.isRtl ? 'max' : 'min']]; } else if(pos > 100) { - val = this.options[this.dirs.max]; + val = this.options[this.dirs[this.isRtl ? 'min' : 'max']]; } else { - if(this.vertical){ + if(this.vertical || this.isRtl){ pos = Math.abs(pos - 100); } val = ((this.options.max - this.options.min) * (pos / 100)) + this.options.min; step = this.options.step; if(step != 'any'){ @@ -932,21 +947,24 @@ } return e; }; })(); + var updateValue = function(val, animate){ + if(val != o.value){ + that.value(val, false, animate); + eventTimer.call('input', val); + } + }; var setValueFromPos = function(e, animate){ if(e.type == 'touchmove'){ e.preventDefault(); normalizeTouch(e); } - var val = that.getStepedValueFromPos((e[that.dirs.mouse] - leftOffset) * widgetUnits); - if(val != o.value){ - that.value(val, false, animate); - eventTimer.call('input', val); - } + updateValue(that.getStepedValueFromPos((e[that.dirs.mouse] - leftOffset) * widgetUnits), animate); + if(e && e.type == 'mousemove'){ e.preventDefault(); } }; var remove = function(e){ @@ -980,11 +998,16 @@ widgetUnits = that.element[that.dirs.innerWidth](); if(!widgetUnits || !leftOffset){return;} outerWidth = that.thumb[that.dirs.outerWidth](); leftOffset = leftOffset[that.dirs.pos]; widgetUnits = 100 / widgetUnits; - setValueFromPos(e, o.animate); + + if(e.target.className == 'ws-range-ticks'){ + updateValue(e.target.getAttribute('data-value'), o.animate); + } else { + setValueFromPos(e, o.animate); + } isActive = true; $(document) .on(e.type == 'touchstart' ? { touchend: remove, @@ -1026,10 +1049,17 @@ keydown: function(e){ var step = true; var code = e.keyCode; if(!o.readonly && !o.disabled){ + if(that.isRtl){ + if(code == 39){ + code = 37; + } else if(code == 37){ + code = 39; + } + } if (code == 39 || code == 38) { that.doStep(1); } else if (code == 37 || code == 40) { that.doStep(-1); } else if (code == 33) { @@ -1125,14 +1155,21 @@ this.dirs = this.vertical ? {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'} : {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'} ; + if(!this.vertical && this.element.css('direction') == 'rtl'){ + this.isRtl = true; + this.dirs.left = 'right'; + this.dirs.right = 'left'; + this.dirs.marginLeft = 'marginRight'; + } this.element [this.vertical ? 'addClass' : 'removeClass']('vertical-range') - [this.vertical ? 'addClass' : 'removeClass']('horizontal-range') + [this.isRtl ? 'addClass' : 'removeClass']('ws-is-rtl') ; + this.updateMetrics = this.posCenter; this.posCenter(); } }; var oCreate = function (o) { @@ -1165,23 +1202,24 @@ }); }; if(window.webshims && webshims.isReady){ webshims.isReady('range-ui', true); } -})(window.webshims ? webshims.$ : jQuery);;webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){ +})(window.webshims ? webshims.$ : jQuery); +;webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){ "use strict"; var curCfg; var formcfg = webshims.formcfg; var hasFormValidation = Modernizr.formvalidation && !webshims.bugs.bustedValidity; var monthDigits = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']; var stopPropagation = function(e){ e.stopImmediatePropagation(); }; var getMonthOptions = function(opts){ - var selectName = 'monthSelect'+opts.formatMonthNames; + var selectName = 'monthSelect'+opts.monthNames; if(!curCfg[selectName]){ - var labels = curCfg.date[opts.formatMonthNames] || monthDigits; + var labels = curCfg.date[opts.monthNames] || monthDigits; curCfg[selectName] = ('<option value=""></option>')+$.map(monthDigits, function(val, i){ return '<option value="'+val+'"]>'+labels[i]+'</option>'; }).join(''); } return curCfg[selectName]; @@ -1202,17 +1240,43 @@ obj[name] = i; }); curCfg.patterns[name+'Obj'] = obj; } }; + var createYearSelect = function(obj, opts){ + var options, nowY, max, min; + if(opts.yearSelect){ + nowY = parseInt(opts.value.split('-')[0], 10); + max = opts.max.split('-'); + min = opts.min.split('-'); + options = webshims.picker.createYearSelect(nowY || parseInt(min[0], 10) || parseInt(max[0], 10) || nowYear, max, min); + options.unshift('<option />'); + $(obj.elements) + .filter('select.yy') + .html(options.join('')) + .each(function(){ + if(!nowY){ + $('option[selected]', this).removeAttr('selected'); + $(this).val(); + } + }) + ; + } + }; var splitInputs = { date: { _create: function(opts){ var obj = { - splits: [$('<input type="text" class="yy" size="4" inputmode="numeric" maxlength="4" />')[0]] + splits: [] }; + if(opts.yearSelect){ + obj.splits.push($('<select class="yy"></select>')[0]); + } else { + obj.splits.push($('<input type="text" class="yy" size="4" inputmode="numeric" maxlength="4" />')[0]); + } + if(opts.monthSelect){ obj.splits.push($('<select class="mm">'+getMonthOptions(opts)+'</select>')[0]); } else { obj.splits.push($('<input type="text" class="mm" inputmode="numeric" maxlength="2" size="2" />')[0]); } @@ -1221,10 +1285,11 @@ } else { obj.splits.push($('<input type="text" class="dd ws-spin" inputmode="numeric" maxlength="2" size="2" />')[0]); } obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1], $('<span class="ws-input-seperator" />')[0], obj.splits[2]]; + createYearSelect(obj, opts); return obj; }, sort: function(element){ createFormat('d'); var i = 0; @@ -1245,22 +1310,30 @@ }, month: { _create: function(opts){ var obj = { - splits: [$('<input type="text" class="yy" inputmode="numeric" size="4" />')[0]] + splits: [] }; + + if(opts.yearSelect){ + obj.splits.push($('<select class="yy"></select>')[0]); + } else { + obj.splits.push($('<input type="text" class="yy" size="4" inputmode="numeric" maxlength="4" />')[0]); + } + if(opts.monthSelect){ obj.splits.push($('<select class="mm">'+getMonthOptions(opts)+'</select>')[0]); } else { obj.splits.push($('<input type="text" class="mm ws-spin" />')[0]); if(opts.onlyMonthDigits){ $(obj.splits[1]).attr({inputmode: 'numeric', size: 2, maxlength: 2}); } } obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1]]; + createYearSelect(obj, opts); return obj; }, sort: function(element){ var seperator = $('.ws-input-seperator', element).html(curCfg.dFormat); var mm = $('input.mm, select.mm', element); @@ -1276,11 +1349,12 @@ } } }; var nowDate = new Date(new Date().getTime() - (new Date().getTimezoneOffset() * 60 * 1000 )); - nowDate = new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate(), nowDate.getHours()).getTime() + var nowYear = nowDate.getFullYear(); + nowDate = new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate(), nowDate.getHours()).getTime(); var steps = { number: { step: 1 }, // week: { @@ -1486,13 +1560,10 @@ var triggerLocaleChange = function(){ processLangCFG(curCfg); $(document).triggerHandler('wslocalechange'); }; - - - curCfg = webshims.activeLang(formcfg); triggerLocaleChange(); $(formcfg).on('change', function(){ @@ -1513,11 +1584,11 @@ return val * 1; }; var formatVal = { - number: function(val){ + number: function(val, o){ return (val+'').replace(/\,/g, '').replace(/\./, curCfg.numberFormat['.']); }, time: function(val){ var fVal; if(val && curCfg.meridian){ @@ -1550,11 +1621,11 @@ //todo empty val for month/split month: function(val, options){ var names; var p = val.split('-'); if(p[0] && p[1]){ - names = curCfg.date[options.formatMonthNames] || curCfg.date[options.monthNames] || curCfg.date.monthNames; + names = curCfg.date[options.monthNames] || curCfg.date.monthNames; p[1] = names[(p[1] * 1) - 1]; if(options && options.splitInput){ val = [p[0] || '', p[1] || '']; } else if(p[1]){ val = curCfg.date.showMonthAfterYear ? p.join(' ') : p[1]+' '+p[0]; @@ -1871,11 +1942,19 @@ .one('mousedown focusin', function(e){ loadPicker(that.type, 'DOM'); }) .on({ 'change input focus focusin blur focusout': function(e){ + var oVal, nVal; $(e.target).trigger('ws__'+e.type); + if(o.toFixed && o.type == 'number' && e.type == 'change'){ + oVal = that.element.prop('value'); + nVal = that.toFixed(oVal, true); + if(oVal != nVal){ + that.element[0].value = nVal; + } + } } }) ; @@ -2020,36 +2099,31 @@ if(this.type == 'number'){ this.inputElements.attr('inputmode', 'numeric'); } - - if((!o.max && typeof o.relMax == 'number') || (!o.min && typeof o.relMin == 'number')){ - webshims.error('relMax/relMin are not supported anymore') + webshims.error('relMax/relMin are not supported anymore calculate at set it your own.'); } + + if(this.options.relDefaultValue){ + webshims.warn('relDefaultValue was removed use startValue instead!'); + } + this._init = true; }, createOpts: ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'defaultValue', 'value', 'required'], _addSplitInputs: function(){ if(!this.inputElements){ var create = splitInputs[this.type]._create(this.options); this.splits = create.splits; this.inputElements = $(create.elements).prependTo(this.element).filter('input, select'); } }, - - getRelNumber: function(rel){ - var start = steps[this.type].start || 0; - if(rel){ - start += rel; - } - return start; - }, addZero: addZero, _setStartInRange: function(){ - var start = this.getRelNumber(this.options.relDefaultValue); + var start = this.options.startValue && this.asNumber( this.options.startValue ) || steps[this.type].start || 0; if(!isNaN(this.minAsNumber) && start < this.minAsNumber){ start = this.minAsNumber; } else if(!isNaN(this.maxAsNumber) && start > this.maxAsNumber){ start = this.maxAsNumber; } @@ -2057,11 +2131,11 @@ this.options.defValue = this.elemHelper.prop('value'); }, reorderInputs: function(){ if(splitInputs[this.type]){ - var element = this.element; + var element = this.element.attr('dir', curCfg.date.isRTL ? 'rtl' : 'ltr'); splitInputs[this.type].sort(element, this.options); setTimeout(function(){ var data = webshims.data(element); if(data && data.shadowData){ data.shadowData.shadowFocusElement = element.find('input, select')[0] || element[0]; @@ -2083,10 +2157,17 @@ this._setStartInRange(); } else { this.elemHelper.prop('value', val); this.options.defValue = ""; } + }, + toFixed: function(val, force){ + var o = this.options; + if(o.toFixed && o.type == 'number' && val && this.valueAsNumber && (force || !this.element.is(':focus')) && (!o.fixOnlyFloat || (this.valueAsNumber % 1)) && !$(this.orig).is(':invalid')){ + val = formatVal[this.type](this.valueAsNumber.toFixed(o.toFixed), this.options); + } + return val; } }); ['defaultValue', 'value'].forEach(function(name){ var isValue = name == 'value'; @@ -2095,11 +2176,11 @@ if(isValue){ this._beforeValue(val); } else { this.elemHelper.prop(name, val); } - + val = formatVal[this.type](val, this.options); if(this.options.splitInput){ $.each(this.splits, function(i, elem){ var setOption; if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){ @@ -2107,11 +2188,11 @@ } else { $.prop(elem, name, val[i]); } }); } else { - this.element.prop(name, val); + this.element.prop(name, this.toFixed(val)); } this._propertyChange(name); this.mirrorValidity(); } }; @@ -2124,10 +2205,13 @@ this[numName] = this.asNumber(val); if(this.valueAsNumber != null && (isNaN(this.valueAsNumber) || (!isNaN(this[numName]) && (this.valueAsNumber * factor) < (this[numName] * factor)))){ this._setStartInRange(); } this.options[name] = val; + if(this._init){ + createYearSelect({elements: this.inputElements}, this.options); + } this._propertyChange(name); this.mirrorValidity(); }; }); @@ -2144,11 +2228,11 @@ $.fn.wsBaseWidget.wsProto = wsWidgetProto; $.fn.spinbtnUI = function(opts){ opts = $.extend({ - monthNames: 'monthNames' + monthNames: 'monthNamesShort' }, opts); return this.each(function(){ $.webshims.objectCreate(spinBtnProto, { element: { value: $(this) @@ -2174,25 +2258,72 @@ hide: $.noop, preventBlur: $.noop, isVisible: true }; + picker.isInRange = function(value, max, min){ + return !((min[0] && min[0] > value[0]) || (max[0] && max[0] < value[0])); + }; + + + picker.createYearSelect = function(value, max, min, valueAdd, stepper){ + if(!stepper){ + stepper = {start: value, step: 1, label: value}; + } + var temp; + var goUp = true; + var goDown = true; + var options = ['<option selected="">'+ stepper.label + '</option>']; + var i = 0; + var createOption = function(value, add){ + var value2, label; + if(stepper.step > 1){ + value2 = value + stepper.step - 1; + label = value+' – '+value2; + } else { + label = value; + } + + if(picker.isInRange([value], max, min) || (value2 && picker.isInRange([value2], max, min))){ + options[add]('<option value="'+ (value+valueAdd) +'">'+ label +'</option>'); + return true; + } + }; + if(!valueAdd){ + valueAdd = ''; + } + while(i < 18 && (goUp || goDown)){ + i++; + if(goUp){ + temp = stepper.start - (i * stepper.step); + goUp = createOption(temp, 'unshift'); + } + if(goDown){ + temp = stepper.start + (i * stepper.step); + goDown = createOption(temp, 'push'); + } + + } + + return options; + }; + picker._genericSetFocus = function(element, _noFocus){ element = $(element || this.activeButton); if(!this.popover.openedByFocus && !_noFocus){ var that = this; var setFocus = function(noTrigger){ clearTimeout(that.timer); that.timer = setTimeout(function(){ if(element[0]){ - element[0].focus(); + element.trigger('focus'); if(noTrigger !== true && !element.is(':focus')){ setFocus(true); } } - }, that.popover.isVisible ? 99 : 360); + }, that.popover.isVisible ? 0 : 360); }; this.popover.activateElement(element); setFocus(); } }; @@ -2401,11 +2532,11 @@ show(); } else { popover.preventBlur(); } }, - mousedown: function(){ + mousedown: function(e){ mouseFocus = true; setTimeout(resetMouseFocus, 9); if(options.buttonOnly && popover.isVisible && popover.activeElement){ popover.openedByFocus = false; setTimeout(function(){ @@ -2559,35 +2690,45 @@ var sizeInput = function(data){ var init; var updateStyles = function(){ $(data.orig).removeClass('ws-important-hide'); $.style( data.orig, 'display', '' ); - var hasButtons, marginR, marginL; + var hasButtons, marginR, marginL, left, right, isRtl; var correctWidth = 0.8; if(!init || data.orig.offsetWidth){ hasButtons = data.buttonWrapper && data.buttonWrapper.filter(isVisible).length; - marginR = $.css( data.orig, 'marginRight'); - data.element.css({ - marginLeft: $.css( data.orig, 'marginLeft'), - marginRight: hasButtons ? 0 : marginR - }); + isRtl = hasButtons && data.buttonWrapper.css('direction') == 'rtl'; + if(isRtl){ + left = 'Right'; + right = 'Left'; + } else { + left = 'Left'; + right = 'Right'; + } + + marginR = $.css( data.orig, 'margin'+right); + + data.element + .css('margin'+left, $.css( data.orig, 'margin'+left)) + .css('margin'+right, hasButtons ? 0 : marginR) + ; + if(hasButtons){ - marginL = (parseInt(data.buttonWrapper.css('marginLeft'), 10) || 0); - data.element.css({paddingRight: ''}); + data.buttonWrapper[isRtl ? 'addClass' : 'removeClass']('ws-is-rtl'); + marginL = (parseInt(data.buttonWrapper.css('margin'+left), 10) || 0); + data.element.css('padding'+right, ''); if(marginL < 0){ marginR = (parseInt(marginR, 10) || 0) + ((data.buttonWrapper.outerWidth() + marginL) * -1); - data.buttonWrapper.css('marginRight', marginR); + data.buttonWrapper.css('margin'+right, marginR); data.element - .css({paddingRight: ''}) - .css({ - paddingRight: (parseInt( data.element.css('paddingRight'), 10) || 0) + data.buttonWrapper.outerWidth() - }) + .css('padding'+right, '') + .css('padding'+right, (parseInt( data.element.css('padding'+right), 10) || 0) + data.buttonWrapper.outerWidth()) ; } else { - data.buttonWrapper.css('marginRight', marginR); + data.buttonWrapper.css('margin'+right, marginR); correctWidth = data.buttonWrapper.outerWidth(true) + correctWidth; } } data.element.outerWidth( $(data.orig).outerWidth() - correctWidth ); @@ -2601,11 +2742,11 @@ var implementType = function(){ var type = $.prop(this, 'type'); - var i, opts, data, optsName, labels; + var i, opts, data, optsName, labels, cNames; if(inputTypes[type] && webshims.implement(this, 'inputwidgets')){ data = {}; optsName = type; labels = $(this).jProp('labels'); @@ -2639,22 +2780,43 @@ optsName = copyAttrs[i].replace(/^data\-/, ''); if(optsName == 'placeholder' || !opts[optsName]){ opts[optsName] = $.attr(this, copyAttrs[i]) || opts[optsName]; } } - - if(opts.onlyMonthDigits || (!opts.formatMonthNames && opts.monthSelect)){ - opts.formatMonthNames = 'monthDigits'; + if(opts.formatMonthNames){ + webshims.error('formatMonthNames was renamded to monthNames'); } + if(opts.onlyMonthDigits){ + opts.monthNames = 'monthDigits'; + } data.shim = inputTypes[type]._create(opts); - + webshims.addShadowDom(this, data.shim.element, { data: data.shim || {} }); data.shim.options.containerElements.push(data.shim.element[0]); + cNames = $.prop(this, 'className'); + if(opts.classes){ + cNames += ' '+opts.classes; + } + if(opts.splitInput || type == 'range'){ + cNames = cNames.replace('form-control', ''); + } + + data.shim.element.on('change input', stopPropagation).addClass(cNames); + + if(data.shim.buttonWrapper){ + + data.shim.buttonWrapper.addClass('input-button-size-'+(data.shim.buttonWrapper.children().filter(isVisible).length)); + + if(data.shim.buttonWrapper.filter(isVisible).length){ + data.shim.element.addClass('has-input-buttons'); + } + } + labelWidth($(this).getShadowFocusElement(), labels); $(this).on('change', function(e){ if(!stopCircular){ data.shim.value($.prop(this, 'value')); @@ -2681,19 +2843,18 @@ hasFocusTriggered = hasFocus; $(opts.orig).triggerHandler(hasFocus ? 'focus' : 'blur'); $(opts.orig).trigger(hasFocus ? 'focusin' : 'focusout'); } hasFocusTriggered = hasFocus; - }, 0); + }, 9); } }) ; })(); - - data.shim.element.on('change input', stopPropagation); + if(hasFormValidation){ $(opts.orig).on('firstinvalid', function(e){ if(!webshims.fromSubmit && isCheckValidity){return;} $(opts.orig).off('invalid.replacedwidgetbubble').on('invalid.replacedwidgetbubble', function(evt){ if(!evt.isDefaultPrevented()){ @@ -2704,17 +2865,10 @@ $(opts.orig).off('invalid.replacedwidgetbubble'); }); }); } - - if(data.shim.buttonWrapper && data.shim.buttonWrapper.filter(isVisible).length){ - data.shim.element.addClass('has-input-buttons'); - } - - data.shim.element.addClass($.prop(this, 'className')); - if(opts.calculateWidth){ sizeInput(data.shim); } else { $(this).addClass('ws-important-hide'); } @@ -2772,11 +2926,11 @@ ['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){ if(!modernizrInputTypes[name] || replace[name]){ extendType(name, { _create: function(opts, set){ - if(opts.monthSelect || opts.daySelect){ + if(opts.monthSelect || opts.daySelect || opts.yearSelect){ opts.splitInput = true; } if(opts.splitInput && !splitInputs[name]){ webshims.warn('splitInput not supported for '+ name); opts.splitInput = false; @@ -2791,10 +2945,9 @@ data = data.wsBaseWidget(opts).data('wsWidget'+name); } if(webshims.picker && webshims.picker[name]){ webshims.picker[name](data); } - data.buttonWrapper.addClass('input-button-size-'+(data.buttonWrapper.children().filter(isVisible).length)); return data; } }); } });