coupon-admin/public/static/js/iPicker/iPicker.min.js

6 lines
24 KiB
JavaScript
Raw Normal View History

2021-11-29 09:32:48 +00:00
/*!
* iPicker v4.0.2
* Copyright (C) 2020-2021, ZG
* Released under the MIT license.
*/
!((e,i)=>{typeof exports==="object"&&typeof module!=="undefined"?module.exports=i():typeof define==="function"&&define.amd?define(i):(e=e||self,e.iPicker=i())})(typeof window!=="undefined"?window:this,e=>{"use strict";const i={type:e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),isCorrectObject:e=>!!(i.type(e)==="object"&&Object.keys(e).length),isCorrectNumber:(e,i)=>!!(Number.isSafeInteger(e)&&(!i?e>0:e>=0)),isFunction:e=>i.type(e)==="function",uid(e){const i=Math.random().toString(36).substr(2,10);return e?Symbol(i):i},delayTimer(e=0){return new Promise(i=>{const t=window.setTimeout(()=>{window.clearTimeout(t);i()},e)})},mergeParam(e={},t){const r={};for(const s in t){const n=e[s];if(i.type(n)==="object"){r[s]=i.mergeParam(n,t[s])}else{r[s]=n===0?n:n||t[s]}}return r}};const t=(()=>{function e(e){const i=e[0]?e.length:0;this.length=i;for(let t=0;t<i;t++){this[t]=e[t]}return this}e.prototype={each(e){for(let i=0,t=this.length;i<t;i++){e.call(this[i],i,this[i])}return this},get(e=0){return this[e]},click(e){return this.each(function(){this.addEventListener("click",function(i){e.call(this,i)})})},hasClass(e){return this[0].classList.contains(e)},addClass(e){return this.each(function(){for(const i of e.split(" ")){this.classList.add(i)}})},removeClass(e){return this.each(function(){for(const i of e.split(" ")){this.classList.remove(i)}})},toggleClass(e){return this.each(function(){for(const i of e.split(" ")){this.classList.toggle(i)}})},css(e,t){function r(e,i){return document.defaultView.getComputedStyle(e,null).getPropertyValue(i)}function s(e,i,t){e.style[i]=t}return typeof e==="string"&&!t?r(this[0],e):this.each(function(){if(e&&t){s(this,e,t)}if(i.isCorrectObject(e)&&!t){for(const i in e){s(this,i,e[i])}}})},html(e){return this.each(function(){this.innerHTML=e})},text(e){return this[0].textContent},val(e){return this.each(function(){this.value=e})},eq(e){if(typeof e==="number"){const i=[];if(e<this.length){i.push(this[e])}return t(i)}},index(){if(this[0]){let e=this[0];let i=0;while((e=e.previousSibling)!==null){e.nodeType===1&&i++}return i}},prev(){const e=[];this.each(function(){const i=this.previousElementSibling;i&&e.push(i)});return t(e)},next(){const e=[];this.each(function(){const i=this.nextElementSibling;i&&e.push(i)});return t(e)},nextAll(){const e=[];this.each(function(){let i=this.nextElementSibling;function r(){if(i){e.push(i);i=t(i).get().nextElementSibling;r()}}r()});return t(e)},parent(){const e=[];this.each(function(){e.push(this.parentNode)});return t(e)},find(e){const i=[];this.each(function(){const t=this.querySelectorAll(e);for(var r=0,s=t.length;r<s;r++){t[r].nodeType===1&&i.push(t[r])}});return t(i)},siblings:function(){const e=[];this.each(function(){const i=this.parentNode.children;for(let t=0,r=i.length;t<r;t++){if(i[t]!==this){e.push(i[t])}}});return t(e)},add(e){let i=this;const r=t(e);for(let e=0,t=r.length;e<t;e++){i[i.length]=r[e];i.length++}return i},data(e,i){return typeof e==="string"&&!i?this[0].dataset[e]:this.each(function(){if(e&&i){this.dataset[e]=i}else{for(const i in e){this.dataset[i]=e[i]}}})},remove(){return this.each(function(){this.parentNode&&this.parentNode.removeChild(this)})},show(){return this.each(function(){this.style.display="block"})},hide(){return this.each(function(){this.style.display="";if(t(this).css("display")!=="none"){this.style.display="none"}})}};return function(i){let t=[];if(typeof i==="string"){t=document.querySelectorAll(i)}if(i.nodeType||i===document){t.push(i)}else if(i.length>0&&i[0]&&i[0].nodeType){for(let e=0,r=i.length;e<r;e++){t.push(i[e])}}return new e(t)}})();const r={theme:"select",data:{props:{code:"code",name:"name"},source:null,when:null},level:3,radius:2,width:200,height:34,maxHeight:300,disabled:[],disabledItem:[],selected:[],selectedCallback:()=>{},placeholder:["省","市","区"],separator:"/",clearable:false,strict:false,onlyShowLastLevel:false,icon:"arrow",onClear:()=>{},onSelect:()=>{}};const s={originalElem:new WeakMap,options:new WeakMap,value:new WeakMap,id:new WeakMap,target:new Map};const n=new Map;const c="__i