/* * mobile-select v1.4.0 * Homepage: https://github.com/onlyhom/mobile-select * Released under the MIT License. * (c) 2017-present */ "use strict";function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(iter){if("undefined"!=typeof Symbol&&null!=iter[Symbol.iterator]||null!=iter["@@iterator"])return Array.from(iter)}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Map"===(n="Object"===n&&o.constructor?o.constructor.name:n)||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i0||"ontouchstart" in window)||(this.eventHandleMap.panel.event=["mousedown","mousemove","mouseup"]),this.registerEvents("add"),this.fixRowStyle(),t.autoFocus&&this.show()}}},{key:"checkTriggerAvailable",value:function(){var t=this.config;return this.trigger=t.trigger instanceof HTMLElement?t.trigger:document.querySelector(t.trigger),!!this.trigger||(l.log("error","trigger HTMLElement does not found on your document."),!1)}},{key:"getPositionByInitValue",value:function(){var o,_this2=this,_this$config=this.config,t=_this$config.keyMap,e=_this$config.connector,_this$config=_this$config.initValue,_this$config=(null==_this$config?void 0:_this$config.split(e))||[];return this.isJsonType?(o=null==(e=this.wheelsData[0])?void 0:e.data,_this$config.reduce(function(r,a){var u=null==o?void 0:o.findIndex(function(f){return f[t.value]==a});return r.push(u<0?0:u),o=null==(u=o[u])?void 0:u[t.childs],r},[])):_this$config.reduce(function(o,r,a){a=null==(a=null==(a=_this2.wheelsData[a])?void 0:a.data)?void 0:a.findIndex(function(m){return m==r});return o.push(a<0?0:a),o},[])}},{key:"getConnectedString",value:function(){for(var t="",e=0;e').concat(o,"")}else for(var _s2=0;_s2"+t[_s2]+"";return i}},{key:"renderComponent",value:function(t){this.mobileSelect=document.createElement("div"),this.mobileSelect.className="ms-mobile-select",this.mobileSelect.innerHTML='
\n
\n
\n
\n
'.concat(this.config.cancelBtnText,'
\n
').concat(this.config.title||"",'
\n
').concat(this.config.ensureBtnText,'
\n
\n
\n
\n
\n
\n
\n
\n
\n
'),document.body.appendChild(this.mobileSelect);for(var e="",i=0;i
    '))+this.getOptionsHtmlStr(t[i].data)+"
";this.mobileSelect.querySelector(".ms-wheels").innerHTML=e}},{key:"reRenderWheels",value:function(){var t=this.wheelList.length-this.displayJson.length;if(0'.concat(this.getOptionsHtmlStr(this.displayJson[_e4]),""),i.setAttribute("data-index",_e4.toString()),this.wheelsContain.appendChild(i))}},{key:"checkCascade",value:function(){var e,t=this.config.keyMap;if(this.isJsonType)for(var i=this.wheelsData[0].data,s=0;se.length)for(var s=this.sliderList.length-e.length,n=0;n=this.oversizeBorder&&(this.curDistance[n]=p,this.movePosition(s,this.curDistance[n]),null!=(r=(p=this.config).transitionEnd)&&r.call(p,this.getIndexArr(),this.getCurValue(),this),null!=(p=(r=this.config).onTransitionEnd)&&p.call(r,this.getCurValue(),this.getIndexArr(),this)):(this.updateCurDistance(s,n),this.curDistance[n]=this.fixPosition(this.curDistance[n]),this.curDistance[n]>2*this.optionHeight?this.curDistance[n]=2*this.optionHeight:this.curDistance[n]