mand-mobile/docs/static/js/EnUSDocsComponentsFormSlide...

1 line
102 KiB
JavaScript
Raw Normal View History

2024-03-12 17:47:00 +08:00
webpackJsonp([87],{"+ODc":function(A,e,t){"use strict";function o(A,e,t){return e in A?Object.defineProperty(A,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):A[e]=t,A}Object.defineProperty(e,"__esModule",{value:!0});var a=t("1PFB"),s=function(A){return A&&A.__esModule?A:{default:A}}(a);e.default={name:"slider-demo",title:"\u6B65\u957F",titleEnUS:"Steps",components:o({},s.default.name,s.default),data:function(){return{bucket:10}}}},"1PFB":function(A,e,t){var o,a,s,n=Math.round;(function(){(function(n,d){a=[e,t("U6ik"),t("Lw9S")],o=d,s="function"==typeof o?o.apply(e,a):o,!(void 0!==s&&(A.exports=s))})(this,function(A){"use strict";Object.defineProperty(A,"__esModule",{value:!0}),A.default={name:"md-slider",props:{value:{type:[Array,Number],default:0},min:{type:Number,default:0},max:{type:Number,default:100},step:{type:Number,default:1},range:{type:Boolean,default:!1},format:{type:Function,default:function(A){return A}},disabled:{type:Boolean,default:!1}},data:function(){return{isDragging:!1,isDragingUpper:!1,values:[this.min,this.max],startDragMousePos:0,startVal:0}},watch:{value:{immediate:!0,handler:function(A){(Array.isArray(A)&&(A[0]!==this.values[0]||A[1]!==this.values[1])||A!==this.values[0])&&this.$_updateValue(A)}},disabled:function(A){A||this.$_stopDrag()}},computed:{lowerHandlePosition:function(){return 100*((this.values[0]-this.min)/(this.max-this.min))},upperHandlePosition:function(){return 100*((this.values[1]-this.min)/(this.max-this.min))},barStyle:function(){var A=this.range,e=this.values,t=this.min,o=this.max,a=this.lowerHandlePosition;return A?{width:100*((e[1]-e[0])/(o-t))+"%",left:a+"%"}:{width:100*((e[0]-t)/(o-t))+"%"}}},methods:{$_updateValue:function(A){var e=[];Array.isArray(A)?e=[A[0],A[1]]:e[0]=A,e[0]="number"==typeof e[0]?n((e[0]-this.min)/this.step)*this.step+this.min:this.values[0],e[1]="number"==typeof e[1]?n((e[1]-this.min)/this.step)*this.step+this.min:this.values[1],e[0]<this.min&&(e[0]=this.min),e[1]>this.max&&(e[1]=this.max),e[0]>e[1]&&(e[0]===this.values[0]?e[1]=e[0]:e[0]=e[1]),this.values[0]===e[0]&&this.values[1]===e[1]||(this.values=e,this.range?this.$emit("input",this.values):this.$emit("input",this.values[0]))},$_startLowerDrag:function(A){this.disabled||(A.preventDefault(),A.stopPropagation(),A=A.changedTouches?A.changedTouches[0]:A,this.startDragMousePos=A.pageX,this.startVal=this.values[0],this.isDragingUpper=!1,this.isDragging=!0,window.addEventListener("mousemove",this.$_onDrag),window.addEventListener("touchmove",this.$_onDrag),window.addEventListener("mouseup",this.$_onUp),window.addEventListener("touchend",this.$_onUp))},$_startUpperDrag:function(A){this.disabled||(A.preventDefault(),A.stopPropagation(),A=A.changedTouches?A.changedTouches[0]:A,this.startDragMousePos=A.pageX,this.startVal=this.values[1],this.isDragingUpper=!0,this.isDragging=!0,window.addEventListener("mousemove",this.$_onDrag),window.addEventListener("touchmove",this.$_onDrag),window.addEventListener("mouseup",this.$_onUp),window.addEventListener("touchend",this.$_onUp))},$_onDrag:function(A){var e=this;this.disabled||(A.preventDefault(),A.stopPropagation(),this.isDragging&&(A=A.changedTouches?A.changedTouches[0]:A,window.requestAnimationFrame(function(){var t=(A.pageX-e.startDragMousePos)/e.$el.offsetWidth*(e.max-e.min),o=e.startVal+t;e.isDragging&&(e.isDragingUpper?e.$_updateValue([null,o]):e.$_updateValue([o,null]))})))},$_onUp:function(A){A.preventDefault(),A.stopPropagation(),this.$_stopDrag()},$_stopDrag:function(){this.isDragging=!1,this.isDragingUpper=!1,window.removeEventListener("mousemove",this.$_onDrag),window.removeEventListener("touchmove",this.$_onDrag),window.removeEventListener("mouseup",this.$_onUp),window.removeEventListener("touchend",this.$_onUp)}}}})})(),A.exports.__esModule&&(A.exports=A.exports.default);var d="function"==typeof A.exports?A.exports.options:A.exports;d.render=function(){var A=this,e=A.$createElement,t=A._self._c||e;return t("div",{staticClass:"md-slider",class:{"is-disabled":A.disabled}},[A.range?[t("div",{staticClass:"md-slider-bar",style:A.barStyle}),A._v(" "