UNPKG

vue-ydui-gy

Version:

A mobile components Library with Vue2.js.

2 lines 13.3 kB
/*! vue-ydui-gy v1.0.4 by YDCSS (c) 2020 Licensed MIT */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ydui=e():t.ydui=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var a=n[o]={exports:{},id:o,loaded:!1};return t[o].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var n={};return e.m=t,e.c=n,e.p="/dist/",e(0)}({0:function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.TabPanel=e.Tab=void 0;var a=n(215),i=o(a),r=n(214),s=o(r);e.Tab=i.default,e.TabPanel=s.default},1:function(t,e){t.exports=function(t,e,n,o){var a,i=t=t||{},r=typeof t.default;"object"!==r&&"function"!==r||(a=t,i=t.default);var s="function"==typeof i?i.options:i;if(e&&(s.render=e.render,s.staticRenderFns=e.staticRenderFns),n&&(s._scopeId=n),o){var l=s.computed||(s.computed={});Object.keys(o).forEach(function(t){var e=o[t];l[t]=function(){return e}})}return{esModule:a,exports:i,options:s}}},2:function(t,e){t.exports=function(){var t=[];return t.toString=function(){for(var t=[],e=0;e<this.length;e++){var n=this[e];n[2]?t.push("@media "+n[2]+"{"+n[1]+"}"):t.push(n[1])}return t.join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var o={},a=0;a<this.length;a++){var i=this[a][0];"number"==typeof i&&(o[i]=!0)}for(a=0;a<e.length;a++){var r=e[a];"number"==typeof r[0]&&o[r[0]]||(n&&!r[2]?r[2]=n:n&&(r[2]="("+r[2]+") and ("+n+")"),t.push(r))}},t}},3:function(t,e,n){function o(t){for(var e=0;e<t.length;e++){var n=t[e],o=c[n.id];if(o){o.refs++;for(var a=0;a<o.parts.length;a++)o.parts[a](n.parts[a]);for(;a<n.parts.length;a++)o.parts.push(i(n.parts[a]));o.parts.length>n.parts.length&&(o.parts.length=n.parts.length)}else{for(var r=[],a=0;a<n.parts.length;a++)r.push(i(n.parts[a]));c[n.id]={id:n.id,refs:1,parts:r}}}}function a(){var t=document.createElement("style");return t.type="text/css",u.appendChild(t),t}function i(t){var e,n,o=document.querySelector('style[data-vue-ssr-id~="'+t.id+'"]');if(o){if(v)return b;o.parentNode.removeChild(o)}if(h){var i=p++;o=f||(f=a()),e=r.bind(null,o,i,!1),n=r.bind(null,o,i,!0)}else o=a(),e=s.bind(null,o),n=function(){o.parentNode.removeChild(o)};return e(t),function(o){if(o){if(o.css===t.css&&o.media===t.media&&o.sourceMap===t.sourceMap)return;e(t=o)}else n()}}function r(t,e,n,o){var a=n?"":o.css;if(t.styleSheet)t.styleSheet.cssText=g(e,a);else{var i=document.createTextNode(a),r=t.childNodes;r[e]&&t.removeChild(r[e]),r.length?t.insertBefore(i,r[e]):t.appendChild(i)}}function s(t,e){var n=e.css,o=e.media,a=e.sourceMap;if(o&&t.setAttribute("media",o),a&&(n+="\n/*# sourceURL="+a.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}var l="undefined"!=typeof document,d=n(4),c={},u=l&&(document.head||document.getElementsByTagName("head")[0]),f=null,p=0,v=!1,b=function(){},h="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());t.exports=function(t,e,n){v=n;var a=d(t,e);return o(a),function(e){for(var n=[],i=0;i<a.length;i++){var r=a[i],s=c[r.id];s.refs--,n.push(s)}e?(a=d(t,e),o(a)):a=[];for(var i=0;i<n.length;i++){var s=n[i];if(0===s.refs){for(var l=0;l<s.parts.length;l++)s.parts[l]();delete c[s.id]}}}};var g=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}()},4:function(t,e){t.exports=function(t,e){for(var n=[],o={},a=0;a<e.length;a++){var i=e[a],r=i[0],s=i[1],l=i[2],d=i[3],c={id:t+":"+a,css:s,media:l,sourceMap:d};o[r]?o[r].parts.push(c):n.push(o[r]={id:r,parts:[c]})}return n}},5:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){var t=function(t){t.preventDefault(),t.stopPropagation()},e=!1;return{lock:function(n){e||(e=!0,(n||document).addEventListener("touchmove",t))},unlock:function(n){e=!1,(n||document).removeEventListener("touchmove",t)}}}(),o=function(){return{lock:function(t){a&&d(t||document.body,"g-fix-ios-prevent-scroll")},unlock:function(t){a&&c(t||document.body,"g-fix-ios-prevent-scroll")}}}(),a=!!(window.navigator&&window.navigator.userAgent||"").match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),i=function(t){var e=/^#([a-fA-F0-9]){3}(([a-fA-F0-9]){3})?$/,n=/^[rR][gG][bB][aA]\(\s*((25[0-5]|2[0-4]\d|1?\d{1,2})\s*,\s*){3}\s*(\.|\d+\.)?\d+\s*\)$/,o=/^[rR][gG][bB]\(\s*((25[0-5]|2[0-4]\d|1?\d{1,2})\s*,\s*){2}(25[0-5]|2[0-4]\d|1?\d{1,2})\s*\)$/;return e.test(t)||n.test(t)||o.test(t)},r=function(t){for(var e=t;e&&"HTML"!==e.tagName&&"BODY"!==e.tagName&&1===e.nodeType;){var n=document.defaultView.getComputedStyle(e).overflowY;if("scroll"===n||"auto"===n)return e;e=e.parentNode}return window},s=function(t,e){var n=t===window?document.body.offsetHeight:t.offsetHeight,o=t===window?0:t.getBoundingClientRect().top,a=e.getBoundingClientRect().top-o,i=a+e.offsetHeight;return a>=0&&a<n||i>0&&i<=n},l=function(t,e){return e=e||"",!(0===e.replace(/\s/g,"").length||!t)&&new RegExp(" "+e+" ").test(" "+t.className+" ")},d=function(t,e){l(t,e)||(t.className=""===t.className?e:t.className+" "+e)},c=function(t,e){if(l(t,e)){for(var n=" "+t.className.replace(/[\t\r\n]/g,"")+" ";n.indexOf(" "+e+" ")>=0;)n=n.replace(" "+e+" "," ");t.className=n.replace(/^\s+|\s+$/g,"")}},u=function(t){function e(n,o,a){if(n===o)return void("function"==typeof i&&i());var r=n+a>o?o:n+a;n>o&&(r=n-a<o?o:n-a),t===window?window.scrollTo(r,r):t.scrollTop=r,window.requestAnimationFrame(function(){return e(r,o,a)})}var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments[2],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:500,i=arguments[4];window.requestAnimationFrame||(window.requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)});var r=Math.abs(n-o),s=Math.ceil(r/a*50);e(n,o,s)};e.pageScroll=n,e.preventScroll=o,e.isIOS=a,e.isColor=i,e.getScrollview=r,e.checkInview=s,e.addClass=d,e.removeClass=c,e.scrollTop=u},96:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(5);e.default={name:"yd-tab-panel",data:function(){return{isCurrent:!1}},props:{badge:String,badgeColor:{validator:function(t){return!t||(0,o.isColor)(t)},default:"#FFF"},badgeBgcolor:{validator:function(t){return!t||(0,o.isColor)(t)},default:"#F6514B"},badgeScale:{validator:function(t){return/^(\d*(.\d+)?)$/.test(t)},default:.7},dot:{type:Boolean,default:!1},dotColor:{validator:function(t){return!t||(0,o.isColor)(t)},default:"#F6514B"},label:String,active:Boolean,tabkey:[String,Number]},computed:{classes:function(){return this.$parent.activeIndex===this._uid||this.isCurrent?"yd-tab-active":""}},watch:{active:function(){this.$parent.init()},label:function(){this.$parent.init()},badge:function(){this.$parent.init()},badgeColor:function(){this.$parent.init()},badgeScale:function(){this.$parent.init()},badgeBgcolor:function(){this.$parent.init()},dot:function(){this.$parent.init()},dotColor:function(){this.$parent.init()}},mounted:function(){var t=this;this.$nextTick(function(){t.$parent.init()})}}},97:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(5);e.default={name:"yd-tab",data:function(){return{navList:[],activeIndex:this.value||0,index:0,width:"auto",currentIndex:0}},props:{value:Number,callback:Function,itemClick:Function,preventDefault:{type:Boolean,default:!0},bgColor:{validator:function(t){return!t||(0,o.isColor)(t)},default:"#FFF"},color:{validator:function(t){return!t||(0,o.isColor)(t)},default:"#585858"},fontSize:{validator:function(t){return/^(\.|\d+\.)?\d+(px|rem)$/.test(t)},default:".28rem"},height:{validator:function(t){return/^(\.|\d+\.)?\d+(px|rem)$/.test(t)},default:".85rem"},borderColor:{validator:function(t){return!t||(0,o.isColor)(t)},default:"#E4E4E4"},activeColor:{validator:function(t){return!t||(0,o.isColor)(t)},default:"#FF5E53"},horizontalScroll:{type:Boolean,default:!1}},watch:{value:function(t){var e=this,n=this.$children.filter(function(t){return"yd-tab-panel"===t.$options.name});t>=n.length-1&&(t=n.length-1),t<0&&(t=0),this.activeIndex=this.index=t>n.length-1?n.length-1:t;var o="";n.forEach(function(n,a){t===a?(e.$set(n,"isCurrent",!0),o=n.label,n.tabkey&&(t=n.tabkey)):e.$set(n,"isCurrent",!1)}),this.callback&&this.callback(o,t)}},methods:{init:function(){var t=this,e=this.$children.filter(function(t){return"yd-tab-panel"===t.$options.name});if(this.navList=[],e.forEach(function(n,o){t.navList.push({_uid:n._uid,label:n.label,tabkey:n.tabkey,badge:n.badge,badgeColor:n.badgeColor,badgeBgcolor:n.badgeBgcolor,badgeScale:n.badgeScale,dot:n.dot,dotColor:n.dotColor}),n.active||t.activeIndex===o?(t.activeIndex=t.index=n._uid,t.currentIndex=o):o>=e.length&&(t.activeIndex=t.index=e[0]._uid)}),this.horizontalScroll){var n=1;this.$nextTick(function(){var e=t.getChildNodes(t.$refs.navbox);e.forEach(function(t){n+=t.offsetWidth}),t.width=n+"px"})}},getChildNodes:function(t){if(!t)return[];for(var e=t.children||t.childNodes,n=[],o=0,a=e.length;o<a;o++)1===e[o].nodeType&&n.push(e[o]);return n},changeHandler:function(t,e,n,o){return this.preventDefault?(this.index!==n&&(this.activeIndex=this.index=n,this.$emit("input",e)),this.value||0===this.value||this.currentIndex===e||(o||(e=o),this.callback&&this.callback(t,e)),void(this.currentIndex=e)):void(this.itemClick&&this.itemClick(e))}}}},123:function(t,e,n){e=t.exports=n(2)(),e.push([t.id,'.yd-tab-box{overflow:auto;-webkit-overflow-scrolling:touch}.yd-tab-nav-nomal .yd-tab-nav{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.yd-tab-nav-nomal .yd-tab-nav .yd-tab-nav-item{width:1%;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}.yd-tab-nav-scoll .yd-tab-nav .yd-tab-nav-item{padding:0 20px;display:inline-block}.yd-tab-nav{position:relative;z-index:0}.yd-tab-nav:after{height:1px;position:absolute;z-index:3;bottom:0;left:0;content:"";width:100%;background-image:-webkit-gradient(linear,left bottom,left top,color-stop(50%,currentColor),color-stop(50%,transparent));background-image:-webkit-linear-gradient(bottom,currentColor 50%,transparent 0);background-image:linear-gradient(0deg,currentColor 50%,transparent 0)}.yd-tab-nav-item{text-align:center;height:100%;display:block;position:relative}.yd-tab-nav-item-label{color:inherit;display:inline-block;position:relative}.yd-tab-nav .yd-tab-active{color:currentColor}.yd-tab-nav .yd-tab-active:before{content:"";width:70%;height:2px;position:absolute;left:50%;bottom:0;margin-left:-35%;z-index:4;background-color:currentColor}.yd-tab-panel{position:relative;overflow:hidden}.yd-tab-panel-item{width:100%;position:absolute;top:0;overflow:hidden;-webkit-transform:translateX(-100%);transform:translateX(-100%)}.yd-tab-panel-item.yd-tab-active{position:relative;-webkit-transition:-webkit-transform .15s;transition:-webkit-transform .15s;transition:transform .15s;transition:transform .15s,-webkit-transform .15s;-webkit-transform:translateX(0);transform:translateX(0)}.yd-tab-panel-item.yd-tab-active~.yd-tab-panel-item{-webkit-transform:translateX(100%);transform:translateX(100%)}.yd-tab-badge{position:absolute;top:2px;z-index:9;line-height:0}.yd-tab-dot{position:absolute;top:-10px}.yd-tab-dot>i{display:inline-block;width:6px;height:6px;border-radius:100px}',""])},214:function(t,e,n){var o=n(1)(n(96),n(270),null,null);t.exports=o.exports},215:function(t,e,n){n(304);var o=n(1)(n(97),n(243),null,null);t.exports=o.exports},243:function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"yd-tab"},[n("div",{staticClass:"yd-tab-box",class:t.horizontalScroll?"yd-tab-nav-scoll":"yd-tab-nav-nomal",style:{backgroundColor:t.bgColor}},[n("ul",{directives:[{name:"show",rawName:"v-show",value:t.navList.length>0,expression:"navList.length > 0"}],ref:"navbox",staticClass:"yd-tab-nav",style:{color:t.borderColor,width:t.width,fontSize:t.fontSize}},t._l(t.navList,function(e,o){return n("li",{key:o,staticClass:"yd-tab-nav-item",class:e._uid==t.activeIndex||o===t.activeIndex?"yd-tab-active":"",style:{color:e._uid==t.activeIndex||o===t.activeIndex?t.activeColor:t.color,lineHeight:t.height},on:{click:function(n){return t.changeHandler(e.label,o,e._uid,e.tabkey)}}},[t._v("\n "+t._s(e.label)+"\n "),e.badge?n("span",{staticClass:"yd-tab-badge"},[n("yd-badge",{attrs:{scale:e.badgeScale,color:e.badgeColor,bgcolor:e.badgeBgcolor}},[t._v(t._s(e.badge))])],1):t._e(),t._v(" "),e.dot&&!e.badge?n("span",{staticClass:"yd-tab-dot"},[n("i",{style:{backgroundColor:e.dotColor}})]):t._e()])}),0)]),t._v(" "),n("div",{staticClass:"yd-tab-panel"},[t._t("default")],2)])},staticRenderFns:[]}},270:function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"yd-tab-panel-item",class:t.classes},[t._t("default")],2)},staticRenderFns:[]}},304:function(t,e,n){var o=n(123);"string"==typeof o&&(o=[[t.id,o,""]]),o.locals&&(t.exports=o.locals);n(3)("31324530",o,!0)}})});