UNPKG

5.33 kBJavaScriptView Raw
1module.exports=function(t){function e(s){if(n[s])return n[s].exports;var o=n[s]={i:s,l:!1,exports:{}};return t[s].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,s){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:s})},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="/dist/",e(e.s=310)}({0:function(t,e){t.exports=function(t,e,n,s,o,i){var a,r=t=t||{},u=typeof t.default;"object"!==u&&"function"!==u||(a=t,r=t.default);var h="function"==typeof r?r.options:r;e&&(h.render=e.render,h.staticRenderFns=e.staticRenderFns,h._compiled=!0),n&&(h.functional=!0),o&&(h._scopeId=o);var c;if(i?(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__),s&&s.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(i)},h._ssrRegister=c):s&&(c=s),c){var l=h.functional,d=l?h.render:h.beforeCreate;l?(h._injectStyles=c,h.render=function(t,e){return c.call(e),d(t,e)}):h.beforeCreate=d?[].concat(d,c):[c]}return{esModule:a,exports:r,options:h}}},104:function(t,e,n){"use strict";var s=n(18),o=n.n(s),i=null;e.a={name:"Swipeout",componentName:"Swipeout",props:{disabled:{type:Boolean,default:!1},open:{type:Boolean,default:!1},divider:{type:Boolean,default:!0}},watch:{open:function(t){this.setTranslateX(t?-this.$$touch.maxTranslateX:0)}},created:function(){this.$$touch={}},mounted:function(){this.init(),window.addEventListener("resize",this.init,!1)},beforeDestroy:function(){i===this&&(i=null),this.$$touch=null,window.removeEventListener("resize",this.init)},methods:{init:function(){var t=this,e=this.$el.querySelector(".vx-swipeout--action");this.$$touch.maxTranslateX=e.offsetWidth,this.$$touch.el=this.$el.querySelector(".vx-swipeout--inner"),requestAnimationFrame(function(){t.open&&t.setTranslateX(-t.$$touch.maxTranslateX,null,!1)})},setTranslateX:function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e=e||this.$$touch.el,i=t<0?this:null,e.style.webkitTransition=e.style.transition=n?"":"none",e.style.webkitTransform=e.style.transform="translate3d("+t+"px, 0, 0)"},handleTouchStart:function(t){if(!this.disabled){i&&i!==this&&i.handleAction();var e=0;if(this.$$touch.el){var n=this.$$touch.el.style.transform||this.$$touch.el.style.webkitTransform;n&&(n=n.replace("translate3d",""),e=-parseInt(n.match(/(\d+)/g)[0],10))}o()(this.$$touch,this.getPosition(t),{start:!0,currentTranslateX:e}),document.addEventListener("touchmove",this.handleTouchMove,!1),document.addEventListener("touchend",this.handleTouchEnd,!1),document.addEventListener("mousemove",this.handleTouchMove,!1),document.addEventListener("mouseup",this.handleTouchEnd,!1)}},handleTouchMove:function(t){var e=this.getPosition(t),n=e.pageY,s=e.pageX;this.$$touch.diffX=s-this.$$touch.pageX,this.$$touch.start&&Math.abs(n-this.$$touch.pageY)<Math.abs(s-this.$$touch.pageX)&&(this.$$touch.translateX=this.$$touch.diffX+this.$$touch.currentTranslateX,this.$$touch.translateX=this.$$touch.translateX>0?0:this.$$touch.translateX,Math.abs(this.$$touch.translateX)>this.$$touch.maxTranslateX&&(this.$$touch.translateX=this.$$touch.translateX>0?this.$$touch.maxTranslateX:-this.$$touch.maxTranslateX),this.setTranslateX(this.$$touch.translateX,this.$$touch.el,!1),t.stopPropagation(),t.preventDefault())},handleTouchEnd:function(t){var e=this;this.$$touch.start&&(this.$$touch.start=!1,0===this.$$touch.diffX?this.$emit("click",this.$el):(Math.abs(this.$$touch.diffX)>60?this.$$touch.translateX=this.$$touch.diffX<0?-this.$$touch.maxTranslateX:0:this.$$touch.translateX=this.$$touch.currentTranslateX,requestAnimationFrame(function(){e.setTranslateX(e.$$touch.translateX)}),this.$$touch.currentTranslateX!==this.$$touch.translateX&&this.$emit(0===this.$$touch.translateX?"close":"open")),this.$$touch.diffX=0,document.removeEventListener("touchmove",this.handleTouchMove),document.removeEventListener("touchend",this.handleTouchEnd),document.removeEventListener("mousemove",this.handleTouchMove),document.removeEventListener("mouseup",this.handleTouchEnd))},handleAction:function(){var t=this;requestAnimationFrame(function(){t.setTranslateX(0,0)}),this.$emit("close")},getPosition:function(t){return{pageX:t.changedTouches?t.changedTouches[0].pageX:t.pageX,pageY:t.changedTouches?t.changedTouches[0].pageY:t.pageY}}}}},18:function(t,e){t.exports=require("babel-runtime/core-js/object/assign")},202:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=n(104),o=n(203),i=n(0),a=i(s.a,o.a,!1,null,null,null);e.default=a.exports},203:function(t,e,n){"use strict";var s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:["vx-swipeout",{"is-divider":t.divider}],attrs:{onselectstart:"return false;"},on:{touchstart:t.handleTouchStart,mousedown:t.handleTouchStart}},[n("div",{staticClass:"vx-swipeout--inner"},[n("div",{staticClass:"vx-swipeout--content"},[t._t("default")],2),n("div",{staticClass:"vx-swipeout--action",on:{click:t.handleAction}},[t._t("action")],2)])])},o=[],i={render:s,staticRenderFns:o};e.a=i},310:function(t,e,n){t.exports=n(202)}});
\No newline at end of file