UNPKG

w-ui

Version:

A Vue.js 2.0 UI Toolkit for mobile

1 lines 18.7 kB
module.exports=function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=381)}({0:function(t,e){t.exports=function(t,e,n,i,r,a){var o,s=t=t||{},u=typeof t.default;"object"!==u&&"function"!==u||(o=t,s=t.default);var l="function"==typeof s?s.options:s;e&&(l.render=e.render,l.staticRenderFns=e.staticRenderFns,l._compiled=!0),n&&(l.functional=!0),r&&(l._scopeId=r);var c;if(a?(c=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},l._ssrRegister=c):i&&(c=i),c){var d=l.functional,f=d?l.render:l.beforeCreate;d?(l._injectStyles=c,l.render=function(t,e){return c.call(e),f(t,e)}):l.beforeCreate=f?[].concat(f,c):[c]}return{esModule:o,exports:s,options:l}}},1:function(t,e,n){"use strict";function i(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"function"==typeof btoa){var a=r(i);return[n].concat(i.sources.map(function(t){return"/*# sourceURL="+i.sourceRoot+t+" */"})).concat([a]).join("\n")}return[n].join("\n")}function r(t){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t))))+" */"}t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=i(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},r=0;r<this.length;r++){var a=this[r][0];"number"==typeof a&&(i[a]=!0)}for(r=0;r<t.length;r++){var o=t[r];"number"==typeof o[0]&&i[o[0]]||(n&&!o[2]?o[2]=n:n&&(o[2]="("+o[2]+") and ("+n+")"),e.push(o))}},e}},2:function(t,e,n){function i(t){for(var e=0;e<t.length;e++){var n=t[e],i=c[n.id];if(i){i.refs++;for(var r=0;r<i.parts.length;r++)i.parts[r](n.parts[r]);for(;r<n.parts.length;r++)i.parts.push(a(n.parts[r]));i.parts.length>n.parts.length&&(i.parts.length=n.parts.length)}else{for(var o=[],r=0;r<n.parts.length;r++)o.push(a(n.parts[r]));c[n.id]={id:n.id,refs:1,parts:o}}}}function r(){var t=document.createElement("style");return t.type="text/css",d.appendChild(t),t}function a(t){var e,n,i=document.querySelector("style["+g+'~="'+t.id+'"]');if(i){if(h)return v;i.parentNode.removeChild(i)}if(b){var a=p++;i=f||(f=r()),e=o.bind(null,i,a,!1),n=o.bind(null,i,a,!0)}else i=r(),e=s.bind(null,i),n=function(){i.parentNode.removeChild(i)};return e(t),function(i){if(i){if(i.css===t.css&&i.media===t.media&&i.sourceMap===t.sourceMap)return;e(t=i)}else n()}}function o(t,e,n,i){var r=n?"":i.css;if(t.styleSheet)t.styleSheet.cssText=x(e,r);else{var a=document.createTextNode(r),o=t.childNodes;o[e]&&t.removeChild(o[e]),o.length?t.insertBefore(a,o[e]):t.appendChild(a)}}function s(t,e){var n=e.css,i=e.media,r=e.sourceMap;if(i&&t.setAttribute("media",i),m.ssrId&&t.setAttribute(g,e.id),r&&(n+="\n/*# sourceURL="+r.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */"),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}var u="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!u)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var l=n(3),c={},d=u&&(document.head||document.getElementsByTagName("head")[0]),f=null,p=0,h=!1,v=function(){},m=null,g="data-vue-ssr-id",b="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());t.exports=function(t,e,n,r){h=n,m=r||{};var a=l(t,e);return i(a),function(e){for(var n=[],r=0;r<a.length;r++){var o=a[r],s=c[o.id];s.refs--,n.push(s)}e?(a=l(t,e),i(a)):a=[];for(var r=0;r<n.length;r++){var s=n[r];if(0===s.refs){for(var u=0;u<s.parts.length;u++)s.parts[u]();delete c[s.id]}}}};var x=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}()},3:function(t,e,n){"use strict";t.exports=function(t,e){for(var n=[],i={},r=0;r<e.length;r++){var a=e[r],o=a[0],s=a[1],u=a[2],l=a[3],c={id:t+":"+r,css:s,media:u,sourceMap:l};i[o]?i[o].parts.push(c):n.push(i[o]={id:o,parts:[c]})}return n}},317:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(385),r=function(t){return t&&t.__esModule?t:{default:t}}(i),a=n(5);e.default={name:"w-range",data:function(){return{ticks:[],pressed:!1,barL:0,barR:0,ratioA:0,ratioB:0,valA:0,valB:0,pressedA:!1,pressedB:!1,_sliderEl:null,_rect:null,_activeB:null,_timer:0,drag:!1,valueInner:this.value}},props:{color:String,disabled:Boolean,multi:Boolean,max:{type:Number,default:100},min:{type:Number,default:0},pin:Boolean,snaps:Boolean,step:{type:Number,default:1},value:[String,Number,Object]},computed:{modeClass:function(){return"range range-ios"},colorClass:function(){return this.color?"range-ios-"+this.color:""},ratio:function(){return this.multi?Math.min(this.ratioA,this.ratioB):this.ratioA},ratioUpper:function(){return this.multi?Math.max(this.ratioA,this.ratioB):0}},methods:{pointerDown:function(t){if(this.disabled)return!1;this.drag=!0,t.preventDefault(),t.stopPropagation();var e=this.pointerCoord(t),n=this._rect=this._sliderEl.getBoundingClientRect(),i=this.clamp(0,(e.x-n.left)/n.width,1);return this._activeB=Math.abs(i-this.ratioA)>Math.abs(i-this.ratioB),this.updateRange(e,n,!0),!0},pointerMove:function(t){if(!this.disabled&&this.drag){t.preventDefault(),t.stopPropagation();var e=this.pointerCoord(t);this.updateRange(e,this._rect,!0),this.$_emit()}},$_emit:function(){this.$emit("input",this.valueInner)},pointerUp:function(t){this.drag=!1,this.disabled||(t.preventDefault(),t.stopPropagation(),this.updateRange(this.pointerCoord(t),this._rect,!1))},pointerCoord:function(t){if(t){var e=t.changedTouches;if(e&&e.length>0){var n=e[0];return{x:n.clientX,y:n.clientY}}var i=t.pageX;if(void 0!==i)return{x:i,y:t.pageY}}return{x:0,y:0}},clamp:function(t,e,n){return Math.max(t,Math.min(e,n))},updateRange:function(t,e,n){var i=this.clamp(0,(t.x-e.left)/e.width,1),r=this.ratioToValue(i);if(this.snaps&&(i=this.valueToRatio(r)),this.pressed=n,this._activeB){if(this.pressedB=n,this.pressedA=!1,this.ratioB=i,r===this.valB)return!1;this.valB=r}else{if(this.pressedA=n,this.pressedB=!1,this.ratioA=i,r===this.valA)return!1;this.valA=r}return this.multi?(this.valueInner||(this.valueInner={}),this.valueInner.min=Math.min(this.valA,this.valB),this.valueInner.max=Math.max(this.valA,this.valB)):this.valueInner=this.valA,this.updateBar(),!0},ratioToValue:function(t){return t=Math.round((this.max-this.min)*t),t=Math.round(t/this.step)*this.step+this.min,this.clamp(this.min,t,this.max)},valueToRatio:function(t){return t=Math.round((t-this.min)/this.step)*this.step,t/=this.max-this.min,this.clamp(0,t,1)},updateBar:function(){var t=this.ratioA,e=this.ratioB;this.multi?(this.barL=100*Math.min(t,e)+"%",this.barR=100-100*Math.max(t,e)+"%"):(this.barL="",this.barR=100-100*t+"%"),this.updateTicks()},updateTicks:function(){var t=this.ticks,e=this.ratio;if(this.snaps&&t)if(this.multi){var n=this.ratioUpper;t.forEach(function(t){t.active=t.ratio>=e&&t.ratio<=n})}else t.forEach(function(t){t.active=t.ratio<=e})},createTicks:function(){this.snaps&&this.$nextTick(function(){this.ticks=[];for(var t=this.min;t<=this.max;t+=this.step){var e=this.valueToRatio(t);this.ticks.push({ratio:e,left:100*e+"%"})}this.updateTicks()})},initDOM:function(){this.itemComponent&&this.itemComponent.$el&&(0,a.addClass)(this.itemComponent.$el,"item-range"),this._sliderEl=this.$refs.slider},initData:function(){if(this.createTicks(),(0,a.isString)(this.valueInner)){var t=Math.round(this.valueInner);isNaN(t)?this.valueInner=0:this.valueInner=t}(0,a.isNumber)(this.valueInner)&&(this.ratioA=this.valueToRatio(this.valueInner)),(0,a.isObject)(this.valueInner)&&(this.valA=Math.min(this.valueInner.min,this.valueInner.max),this.valB=Math.max(this.valueInner.max,this.valueInner.min),this.ratioA=this.valueToRatio(this.valA),this.ratioB=this.valueToRatio(this.valB)),this.updateBar()}},created:function(){this.initData()},mounted:function(){var t=this;this.$nextTick(function(){t.initDOM()})},components:{RangeKnobHandle:r.default}}},318:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={name:"RangeKnobHandle",props:{ratio:{type:Number,default:0},val:{type:Number,default:0},pin:[Boolean],pressed:[Boolean],min:{type:Number,default:0},max:{type:Number,default:100},disabled:[Boolean]},computed:{left:function(){return 100*this.ratio+"%"},rangeKnobMin:function(){return this.val===this.min||void 0===this.val},rangeKnobMax:function(){return this.val===this.max}}}},381:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Range=void 0;var i=n(382),r=function(t){return t&&t.__esModule?t:{default:t}}(i);e.Range=r.default},382:function(t,e,n){"use strict";function i(t){u||n(383)}Object.defineProperty(e,"__esModule",{value:!0});var r=n(317),a=n.n(r);for(var o in r)"default"!==o&&function(t){n.d(e,t,function(){return r[t]})}(o);var s=n(387),u=!1,l=n(0),c=i,d=l(a.a,s.a,!1,c,null,null);d.options.__file="packages/range/src/range.vue",e.default=d.exports},383:function(t,e,n){var i=n(384);"string"==typeof i&&(i=[[t.i,i,""]]),i.locals&&(t.exports=i.locals);n(2)("6a88e0e4",i,!1,{})},384:function(t,e,n){e=t.exports=n(1)(!1),e.push([t.i,"\n.range-slider {\n position: relative;\n cursor: pointer;\n -webkit-box-flex: 1;\n -webkit-flex: 1;\n -ms-flex: 1;\n flex: 1;\n}\n.range-ios {\n width: 100%;\n padding: 8px 16px;\n}\n.range-ios.range-has-pin {\n padding-top: 20px;\n}\n.range-ios .range-slider {\n height: 42px;\n}\n.range-ios .range-bar {\n position: absolute;\n width: 100%;\n height: 1px;\n pointer-events: none;\n background: #bdbdbd;\n left: 0;\n top: 21px;\n border-radius: 1px;\n}\n.range-ios.range-pressed .range-bar-active {\n will-change: left, right;\n}\n.range-ios.range-pressed .range-knob-handle {\n will-change: left;\n}\n.range-ios .range-bar-active {\n bottom: 0;\n width: auto;\n background: #488aff;\n}\n.range-ios .range-knob-handle {\n position: absolute;\n width: 42px;\n height: 42px;\n left: 0;\n top: 21px;\n margin-left: -21px;\n margin-top: -21px;\n text-align: center;\n}\n.range-ios .range-knob {\n position: absolute;\n width: 28px;\n height: 28px;\n pointer-events: none;\n background: #fff;\n -webkit-box-shadow: 0 3px 1px rgba(0, 0, 0, .1), 0 4px 8px rgba(0, 0, 0, .13), 0 0 0 1px rgba(0, 0, 0, .02);\n box-shadow: 0 3px 1px rgba(0, 0, 0, .1), 0 4px 8px rgba(0, 0, 0, .13), 0 0 0 1px rgba(0, 0, 0, .02);\n left: 7px;\n top: 7px;\n border-radius: 50%;\n}\n.range-ios .range-tick {\n position: absolute;\n top: 17.5px;\n width: 1px;\n height: 8px;\n pointer-events: none;\n background: #bdbdbd;\n margin-left: -0.5px;\n border-radius: 0;\n}\n.range-ios .range-tick-active {\n background: #488aff;\n}\n.range-ios .range-pin {\n position: relative;\n top: -20px;\n display: inline-block;\n min-width: 28px;\n font-size: 12px;\n color: #000;\n background: transparent;\n -webkit-transition: -webkit-transform .12s ease;\n transition: -webkit-transform .12s ease;\n transition: transform .12s ease;\n transition: transform .12s ease, -webkit-transform .12s ease;\n text-align: center;\n border-radius: 50px;\n -webkit-transform: translate3d(0, 28px, 0) scale(0.01);\n transform: translate3d(0, 28px, 0) scale(0.01);\n padding: 8px;\n}\n.range-ios .range-knob-pressed .range-pin {\n -webkit-transform: translate3d(0, 0, 0) scale(1);\n transform: translate3d(0, 0, 0) scale(1);\n}\n.range-ios.range-disabled {\n opacity: 0.5;\n}\n",""])},385:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(318),r=n.n(i);for(var a in i)"default"!==a&&function(t){n.d(e,t,function(){return i[t]})}(a);var o=n(386),s=n(0),u=s(r.a,o.a,!1,null,null,null);u.options.__file="packages/range/src/range-knob-handle.vue",e.default=u.exports},386:function(t,e,n){"use strict";var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"range-knob-handle",class:{"range-knob-pressed":t.pressed,"range-knob-min":t.rangeKnobMin,"range-knob-max":t.rangeKnobMax},style:{left:t.left},attrs:{role:"slider"}},[t.pin?n("div",{staticClass:"range-pin",attrs:{role:"presentation"}},[t._v(t._s(t.val))]):t._e(),t._v(" "),n("div",{staticClass:"range-knob",attrs:{role:"presentation"}})])},r=[];i._withStripped=!0;var a={render:i,staticRenderFns:r};e.a=a},387:function(t,e,n){"use strict";var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"ion-range",class:[t.modeClass,t.colorClass,{"range-pressed":t.pressed},{"range-disabled":t.disabled},{"range-has-pin":t.pin}]},[n("div",{ref:"slider",staticClass:"range-slider",on:{mouseup:function(e){t.pointerUp(e)},touchend:function(e){t.pointerUp(e)},mousemove:function(e){t.pointerMove(e)},touchmove:function(e){t.pointerMove(e)},mousedown:function(e){t.pointerDown(e)},touchstart:function(e){t.pointerDown(e)}}},[t._l(t.ticks,function(t,e){return n("div",{key:"r_t_"+e,staticClass:"range-tick",class:{"range-tick-active":t.active},style:{left:t.left},attrs:{role:"presentation"}})}),t._v(" "),n("div",{staticClass:"range-bar",attrs:{role:"presentation"}}),t._v(" "),n("div",{ref:"bar",staticClass:"range-bar range-bar-active",style:{left:t.barL,right:t.barR},attrs:{role:"presentation"}}),t._v(" "),n("RangeKnobHandle",{attrs:{ratio:t.ratioA,val:t.valA,pin:t.pin,pressed:t.pressedA,min:t.min,max:t.max,disabled:t.disabled}}),t._v(" "),t.multi?n("RangeKnobHandle",{attrs:{ratio:t.ratioB,val:t.valB,pin:t.pin,pressed:t.pressedB,min:t.min,max:t.max,disabled:t.disabled}}):t._e()],2)])},r=[];i._withStripped=!0;var a={render:i,staticRenderFns:r};e.a=a},4:function(t,e){t.exports=require("vue")},5:function(t,e,n){"use strict";function i(t,e){if(!t||!e)return!1;if(-1!==e.indexOf(" "))throw new Error("className should not contain space.");return t.classList?t.classList.contains(e):(" "+t.className+" ").indexOf(" "+e+" ")>-1}function r(t,e){if(t){for(var n=t.className,r=(e||"").split(" "),a=0,o=r.length;a<o;a++){var s=r[a];s&&(t.classList?t.classList.add(s):i(t,s)||(n+=" "+s))}t.classList||(t.className=n)}}function a(t,e){if(t&&e){for(var n=e.split(" "),r=" "+t.className+" ",a=0,o=n.length;a<o;a++){var s=n[a];s&&(t.classList?t.classList.remove(s):i(t,s)&&(r=r.replace(" "+s+" "," ")))}t.classList||(t.className=x(r))}}function o(t,e,n){if(t&&e)if("object"===(void 0===e?"undefined":d(e)))for(var i in e)e.hasOwnProperty(i)&&o(t,i,e[i]);else e=y(e),"opacity"===e&&g<9?t.style.filter=isNaN(n)?"":"alpha(opacity="+100*n+")":t.style[e]=n}function s(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}function u(t,e){var n=t==window?document.body.offsetHeight:t.offsetHeight,i=t===window?0:t.getBoundingClientRect().top,r=e.getBoundingClientRect().top-i,a=r+e.offsetHeight;return r>=0&&r<n||a>0&&a<=n}function l(t){function e(n,i,r){if(n!==i){var a=n+r>i?i:n+r;n>i&&(a=n-r<i?i:n-r),t===window?window.scrollTo(a,a):t.scrollTop=a,window.requestAnimationFrame(function(){return e(a,i,r)})}}var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:500;window.requestAnimationFrame||(window.requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)});var a=Math.abs(n-i);e(n,i,Math.ceil(a/r*50))}function c(){return++b}Object.defineProperty(e,"__esModule",{value:!0}),e.isObject=e.isArray=e.isDate=e.isFunction=e.isNumber=e.isString=e.isBoolean=e.pageScroll=e.isIOS=e.getStyle=e.once=e.off=e.on=void 0;var d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.hasClass=i,e.addClass=r,e.removeClass=a,e.setStyle=o,e.getScrollview=s,e.checkInview=u,e.scrollTop=l,e.getZIndex=c;var f=n(4),p=function(t){return t&&t.__esModule?t:{default:t}}(f),h=p.default.prototype.$isServer,v=/([\:\-\_]+(.))/g,m=/^moz([A-Z])/,g=h?0:Number(document.documentMode),b=1e4,x=function(t){return(t||"").replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")},y=function(t){return t.replace(v,function(t,e,n,i){return i?n.toUpperCase():n}).replace(m,"Moz$1")},w=e.on=function(){return!h&&document.addEventListener?function(t,e,n){t&&e&&n&&t.addEventListener(e,n,!1)}:function(t,e,n){t&&e&&n&&t.attachEvent("on"+e,n)}}(),_=e.off=function(){return!h&&document.removeEventListener?function(t,e,n){t&&e&&t.removeEventListener(e,n,!1)}:function(t,e,n){t&&e&&t.detachEvent("on"+e,n)}}();e.once=function(t,e,n){w(t,e,function i(){n&&n.apply(this,arguments),_(t,e,i)})},e.getStyle=g<9?function(t,e){if(!h){if(!t||!e)return null;e=y(e),"float"===e&&(e="styleFloat");try{switch(e){case"opacity":try{return t.filters.item("alpha").opacity/100}catch(t){return 1}default:return t.style[e]||t.currentStyle?t.currentStyle[e]:null}}catch(n){return t.style[e]}}}:function(t,e){if(!h){if(!t||!e)return null;e=y(e),"float"===e&&(e="cssFloat");try{var n=document.defaultView.getComputedStyle(t,"");return t.style[e]||n?n[e]:null}catch(n){return t.style[e]}}},e.isIOS=!!(window.navigator&&window.navigator.userAgent||"").match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),e.pageScroll=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)}}}(),e.isBoolean=function(t){return"boolean"==typeof t},e.isString=function(t){return"string"==typeof t},e.isNumber=function(t){return"number"==typeof t},e.isFunction=function(t){return"function"==typeof t},e.isDate=function(t){return"date"===Object.prototype.toString.call(t).match(/^(\[object )(\w+)\]$/i)[2].toLowerCase()},e.isArray=Array.isArray,e.isObject=function(t){return"object"===(void 0===t?"undefined":d(t))}}});