react-carousel-slider
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -31,2 +31,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
startPoint: 0, | ||
dragging: false, | ||
deltaX: 0, | ||
@@ -451,2 +452,4 @@ thrershold: 0, | ||
slideCon.style.transform = 'translateX(-' + this.slidingManner.movement + 'px)'; | ||
} else { | ||
return false; //for dragging | ||
} | ||
@@ -479,9 +482,13 @@ } | ||
CarouselSlider.prototype.handleTouchEnd = function handleTouchEnd(e) { | ||
this.slidingManner.sliding = false; | ||
if (Math.abs(this.touchEvent.touchStartX - e.changedTouches[0].clientX) > 20) { | ||
this.slidingManner.sliding = false; | ||
if (!this.slidingManner.sliding) { | ||
if (Math.abs(this.touchEvent.touchMovement) > this.dragEvent.threshold) { | ||
var direction = this.touchEvent.touchMovement > 0 ? 1 : -1; | ||
this.moveSlide(direction); | ||
var draggable = this.moveSlide(direction); | ||
if (draggable === false) { | ||
e.currentTarget.style.transition = 'transform 0.5s ease'; | ||
e.currentTarget.style.transform = 'translateX(-' + this.slidingManner.movement + 'px)'; | ||
} | ||
} else { | ||
@@ -505,15 +512,21 @@ e.currentTarget.style.transition = 'transform 0.5s ease'; | ||
this.slidingManner.sliding = true; | ||
e.currentTarget.style.transition = 'none'; | ||
this.dragEvent.startPoint = e.clientX; | ||
e.dataTransfer.setDragImage(this.dragEvent.disableDragImage, 1, 1); | ||
if (this.slidingManner.sliding === false && this.dragEvent.dragging === false) { | ||
this.slidingManner.sliding = true; //prevent auto sliding | ||
this.dragEvent.dragging = true; | ||
e.currentTarget.style.transition = 'none'; | ||
this.dragEvent.startPoint = e.clientX; | ||
e.dataTransfer.setDragImage(this.dragEvent.disableDragImage, 1, 1); | ||
} | ||
}; | ||
CarouselSlider.prototype.handleDragOver = function handleDragOver(e) { | ||
this.dragEvent.deltaX = this.dragEvent.startPoint - e.clientX; | ||
var dragMovement = this.slidingManner.movement + this.dragEvent.deltaX; | ||
e.currentTarget.style.transform = 'translateX(-' + dragMovement + 'px)'; | ||
e.dataTransfer.dropEffect = 'none'; // To eliminate green add button on chrome. | ||
e.dataTransfer.effectAllowed = 'none'; | ||
e.preventDefault(); | ||
if (this.dragEvent.dragging === true) { | ||
this.dragEvent.deltaX = this.dragEvent.startPoint - e.clientX; | ||
var dragMovement = this.slidingManner.movement + this.dragEvent.deltaX; | ||
e.currentTarget.style.transform = 'translateX(-' + dragMovement + 'px)'; | ||
} | ||
}; | ||
@@ -523,11 +536,20 @@ | ||
var direction = this.dragEvent.deltaX > 0 ? 1 : -1; | ||
this.slidingManner.sliding = false; | ||
if (Math.abs(this.dragEvent.deltaX) > this.dragEvent.threshold) { | ||
if (!this.slidingManner.sliding) { | ||
this.moveSlide(direction); | ||
if (this.dragEvent.dragging === true) { | ||
if (Math.abs(this.dragEvent.deltaX) > this.dragEvent.threshold) { | ||
this.slidingManner.sliding = false; | ||
if (!this.slidingManner.sliding) { | ||
var direction = this.dragEvent.deltaX > 0 ? 1 : -1; | ||
var draggable = this.moveSlide(direction); | ||
if (draggable === false) { | ||
e.currentTarget.style.transition = 'transform 0.5s ease'; | ||
e.currentTarget.style.transform = 'translateX(-' + this.slidingManner.movement + 'px)'; | ||
} | ||
} | ||
} else { | ||
e.currentTarget.style.transition = 'transform 0.5s ease'; | ||
e.currentTarget.style.transform = 'translateX(-' + this.slidingManner.movement + 'px)'; | ||
} | ||
} else { | ||
e.currentTarget.style.transition = 'transform 0.5s ease'; | ||
e.currentTarget.style.transform = 'translateX(-' + this.slidingManner.movement + 'px)'; | ||
this.dragEvent.startPoint = 0; | ||
this.dragEvent.deltaX = 0; | ||
this.dragEvent.dragging = false; | ||
} | ||
@@ -534,0 +556,0 @@ }; |
@@ -40,2 +40,3 @@ 'use strict'; | ||
startPoint: 0, | ||
dragging: false, | ||
deltaX: 0, | ||
@@ -460,2 +461,4 @@ thrershold: 0, | ||
slideCon.style.transform = 'translateX(-' + this.slidingManner.movement + 'px)'; | ||
} else { | ||
return false; //for dragging | ||
} | ||
@@ -488,9 +491,13 @@ } | ||
CarouselSlider.prototype.handleTouchEnd = function handleTouchEnd(e) { | ||
this.slidingManner.sliding = false; | ||
if (Math.abs(this.touchEvent.touchStartX - e.changedTouches[0].clientX) > 20) { | ||
this.slidingManner.sliding = false; | ||
if (!this.slidingManner.sliding) { | ||
if (Math.abs(this.touchEvent.touchMovement) > this.dragEvent.threshold) { | ||
var direction = this.touchEvent.touchMovement > 0 ? 1 : -1; | ||
this.moveSlide(direction); | ||
var draggable = this.moveSlide(direction); | ||
if (draggable === false) { | ||
e.currentTarget.style.transition = 'transform 0.5s ease'; | ||
e.currentTarget.style.transform = 'translateX(-' + this.slidingManner.movement + 'px)'; | ||
} | ||
} else { | ||
@@ -514,15 +521,21 @@ e.currentTarget.style.transition = 'transform 0.5s ease'; | ||
this.slidingManner.sliding = true; | ||
e.currentTarget.style.transition = 'none'; | ||
this.dragEvent.startPoint = e.clientX; | ||
e.dataTransfer.setDragImage(this.dragEvent.disableDragImage, 1, 1); | ||
if (this.slidingManner.sliding === false && this.dragEvent.dragging === false) { | ||
this.slidingManner.sliding = true; //prevent auto sliding | ||
this.dragEvent.dragging = true; | ||
e.currentTarget.style.transition = 'none'; | ||
this.dragEvent.startPoint = e.clientX; | ||
e.dataTransfer.setDragImage(this.dragEvent.disableDragImage, 1, 1); | ||
} | ||
}; | ||
CarouselSlider.prototype.handleDragOver = function handleDragOver(e) { | ||
this.dragEvent.deltaX = this.dragEvent.startPoint - e.clientX; | ||
var dragMovement = this.slidingManner.movement + this.dragEvent.deltaX; | ||
e.currentTarget.style.transform = 'translateX(-' + dragMovement + 'px)'; | ||
e.dataTransfer.dropEffect = 'none'; // To eliminate green add button on chrome. | ||
e.dataTransfer.effectAllowed = 'none'; | ||
e.preventDefault(); | ||
if (this.dragEvent.dragging === true) { | ||
this.dragEvent.deltaX = this.dragEvent.startPoint - e.clientX; | ||
var dragMovement = this.slidingManner.movement + this.dragEvent.deltaX; | ||
e.currentTarget.style.transform = 'translateX(-' + dragMovement + 'px)'; | ||
} | ||
}; | ||
@@ -532,11 +545,20 @@ | ||
var direction = this.dragEvent.deltaX > 0 ? 1 : -1; | ||
this.slidingManner.sliding = false; | ||
if (Math.abs(this.dragEvent.deltaX) > this.dragEvent.threshold) { | ||
if (!this.slidingManner.sliding) { | ||
this.moveSlide(direction); | ||
if (this.dragEvent.dragging === true) { | ||
if (Math.abs(this.dragEvent.deltaX) > this.dragEvent.threshold) { | ||
this.slidingManner.sliding = false; | ||
if (!this.slidingManner.sliding) { | ||
var direction = this.dragEvent.deltaX > 0 ? 1 : -1; | ||
var draggable = this.moveSlide(direction); | ||
if (draggable === false) { | ||
e.currentTarget.style.transition = 'transform 0.5s ease'; | ||
e.currentTarget.style.transform = 'translateX(-' + this.slidingManner.movement + 'px)'; | ||
} | ||
} | ||
} else { | ||
e.currentTarget.style.transition = 'transform 0.5s ease'; | ||
e.currentTarget.style.transform = 'translateX(-' + this.slidingManner.movement + 'px)'; | ||
} | ||
} else { | ||
e.currentTarget.style.transition = 'transform 0.5s ease'; | ||
e.currentTarget.style.transform = 'translateX(-' + this.slidingManner.movement + 'px)'; | ||
this.dragEvent.startPoint = 0; | ||
this.dragEvent.deltaX = 0; | ||
this.dragEvent.dragging = false; | ||
} | ||
@@ -543,0 +565,0 @@ }; |
{ | ||
"name": "react-carousel-slider", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "react-carousel-slider React component", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -127,2 +127,3 @@ /*! | ||
startPoint: 0, | ||
dragging: false, | ||
deltaX: 0, | ||
@@ -547,2 +548,4 @@ thrershold: 0, | ||
slideCon.style.transform = 'translateX(-' + this.slidingManner.movement + 'px)'; | ||
} else { | ||
return false; //for dragging | ||
} | ||
@@ -575,9 +578,13 @@ } | ||
CarouselSlider.prototype.handleTouchEnd = function handleTouchEnd(e) { | ||
this.slidingManner.sliding = false; | ||
if (Math.abs(this.touchEvent.touchStartX - e.changedTouches[0].clientX) > 20) { | ||
this.slidingManner.sliding = false; | ||
if (!this.slidingManner.sliding) { | ||
if (Math.abs(this.touchEvent.touchMovement) > this.dragEvent.threshold) { | ||
var direction = this.touchEvent.touchMovement > 0 ? 1 : -1; | ||
this.moveSlide(direction); | ||
var draggable = this.moveSlide(direction); | ||
if (draggable === false) { | ||
e.currentTarget.style.transition = 'transform 0.5s ease'; | ||
e.currentTarget.style.transform = 'translateX(-' + this.slidingManner.movement + 'px)'; | ||
} | ||
} else { | ||
@@ -601,15 +608,21 @@ e.currentTarget.style.transition = 'transform 0.5s ease'; | ||
this.slidingManner.sliding = true; | ||
e.currentTarget.style.transition = 'none'; | ||
this.dragEvent.startPoint = e.clientX; | ||
e.dataTransfer.setDragImage(this.dragEvent.disableDragImage, 1, 1); | ||
if (this.slidingManner.sliding === false && this.dragEvent.dragging === false) { | ||
this.slidingManner.sliding = true; //prevent auto sliding | ||
this.dragEvent.dragging = true; | ||
e.currentTarget.style.transition = 'none'; | ||
this.dragEvent.startPoint = e.clientX; | ||
e.dataTransfer.setDragImage(this.dragEvent.disableDragImage, 1, 1); | ||
} | ||
}; | ||
CarouselSlider.prototype.handleDragOver = function handleDragOver(e) { | ||
this.dragEvent.deltaX = this.dragEvent.startPoint - e.clientX; | ||
var dragMovement = this.slidingManner.movement + this.dragEvent.deltaX; | ||
e.currentTarget.style.transform = 'translateX(-' + dragMovement + 'px)'; | ||
e.dataTransfer.dropEffect = 'none'; // To eliminate green add button on chrome. | ||
e.dataTransfer.effectAllowed = 'none'; | ||
e.preventDefault(); | ||
if (this.dragEvent.dragging === true) { | ||
this.dragEvent.deltaX = this.dragEvent.startPoint - e.clientX; | ||
var dragMovement = this.slidingManner.movement + this.dragEvent.deltaX; | ||
e.currentTarget.style.transform = 'translateX(-' + dragMovement + 'px)'; | ||
} | ||
}; | ||
@@ -619,11 +632,20 @@ | ||
var direction = this.dragEvent.deltaX > 0 ? 1 : -1; | ||
this.slidingManner.sliding = false; | ||
if (Math.abs(this.dragEvent.deltaX) > this.dragEvent.threshold) { | ||
if (!this.slidingManner.sliding) { | ||
this.moveSlide(direction); | ||
if (this.dragEvent.dragging === true) { | ||
if (Math.abs(this.dragEvent.deltaX) > this.dragEvent.threshold) { | ||
this.slidingManner.sliding = false; | ||
if (!this.slidingManner.sliding) { | ||
var direction = this.dragEvent.deltaX > 0 ? 1 : -1; | ||
var draggable = this.moveSlide(direction); | ||
if (draggable === false) { | ||
e.currentTarget.style.transition = 'transform 0.5s ease'; | ||
e.currentTarget.style.transform = 'translateX(-' + this.slidingManner.movement + 'px)'; | ||
} | ||
} | ||
} else { | ||
e.currentTarget.style.transition = 'transform 0.5s ease'; | ||
e.currentTarget.style.transform = 'translateX(-' + this.slidingManner.movement + 'px)'; | ||
} | ||
} else { | ||
e.currentTarget.style.transition = 'transform 0.5s ease'; | ||
e.currentTarget.style.transform = 'translateX(-' + this.slidingManner.movement + 'px)'; | ||
this.dragEvent.startPoint = 0; | ||
this.dragEvent.deltaX = 0; | ||
this.dragEvent.dragging = false; | ||
} | ||
@@ -630,0 +652,0 @@ }; |
@@ -5,3 +5,3 @@ /*! | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.ReactCarouselSlider=e(require("react")):t.ReactCarouselSlider=e(t.React)}("undefined"!=typeof self?self:this,function(t){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var s=e[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),s=n.n(i),r=n(3);n.n(r);var o=function(t){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var i,s=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return s.slidingManner={currentSlide:1,slidesTotalWidth:0,initialMovement:0,movement:0,direction:1,cycle:0,sliding:!1,slideOrders:[[],[],[]]},s.dragEvent={startPoint:0,deltaX:0,thrershold:0,disableDragImage:(i=new Image,i.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",i)},s.calculateSlidesOrder=s.calculateSlidesOrder.bind(s),s.itemsReorder=s.itemsReorder.bind(s),s.movementReset=s.movementReset.bind(s),s.loadedCnt=0,s.imgsWidth={},s.mannerSetting={autoSliding:!1,circular:!0,duration:"0.5s",flag:!1,button:!0},s.mannerSetting=s.handleMannerSetting(),s.defaultSliderBoxStyle={height:"400px",width:"90%",background:"#EEEEEE",border:"none"},s.defaultSlideConStyle={height:"80%"},s.defaultItemsStyle={padding:"3px",background:"#FAFAFA",margin:"0px 40px"},s.buttonManner={hoverEvent:!1},s.defaultButtonSetStyle={},s.defaultButtonIconStyle={color:"white",background:"#757575",height:"30px",width:"30px",margin:"10px",fontSize:"20px",borderRadius:"2px",border:"none"},s.defaultBtnPosition={"top-left":!0,"top-right":!1,"middle-inside":!1,"middle-outside":!1,"bottom-right":!1,"bottom-left":!1,"bottom-beneath":!1},s.itemsMargin=s.props.itemsStyle&&s.props.itemsStyle.margin?parseInt(s.props.itemsStyle.margin.split(" ")[1].replace("px","")):parseInt(s.defaultItemsStyle.margin.split(" ")[1].replace("px","")),s.slideType=s.props.slideItems?"prop":s.props.slideCpnts?"cpnt":null,s.slideCnt="prop"===s.slideType?s.props.slideItems.length:"cpnt"===s.slideType?s.props.slideCpnts.length:0,s.slideEls="prop"===s.slideType?s.props.slideItems:"cpnt"===s.slideType?s.props.slideCpnts:null,s.touchEvent={touchMovement:0,touchStartX:0,beingTouched:!1},s.imgLoaded=s.imgLoaded.bind(s),s.nonImgLoaded=s.nonImgLoaded.bind(s),s.slideItemHandler=s.slideItemHandler.bind(s),s.initialSlideCon=s.initialSlideCon.bind(s),s.calMovement=s.calMovement.bind(s),s.autoSliding=s.autoSliding.bind(s),s.handleTouchStart=s.handleTouchStart.bind(s),s.handleTouchMove=s.handleTouchMove.bind(s),s.handleTouchEnd=s.handleTouchEnd.bind(s),s.handleButtonClick=s.handleButtonClick.bind(s),s.handleDragStart=s.handleDragStart.bind(s),s.handleDragStop=s.handleDragStop.bind(s),s.handleDragOver=s.handleDragOver.bind(s),s.setSliderBoxStyles=s.setSliderBoxStyles.bind(s),s.setItemsStyle=s.setItemsStyle.bind(s),s.setSlideConHeight=s.setSlideConHeight.bind(s),s.detectButtonPosition=s.detectButtonPosition.bind(s),s.allocateButtonSet=s.allocateButtonSet.bind(s),s.setLeftButtonStyle=s.setLeftButtonStyle.bind(s),s.setHoverEvent=s.setHoverEvent.bind(s),s.calculateSlidesOrder(),s}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentDidMount=function(){this.dragEvent.threshold=this.refs.sliderBox.offsetWidth>100?this.refs.sliderBox.offsetWidth/5:50},e.prototype.componentWillUnmount=function(){clearInterval(this.autoSlidingTimer)},e.prototype.handleMannerSetting=function(){return this.props.manner?Object.assign({},this.mannerSetting,this.props.manner):this.mannerSetting},e.prototype.handleBubbling=function(t){t.stopPropagation()},e.prototype.calculateSlidesOrder=function(){for(var t=[],e=[],n=[],i=-1*this.slideCnt;i<=2*this.slideCnt;i++)0!==i&&t.push(i);this.slidingManner.slideOrders[0]=t;for(var s=0;s<t.length;s++)s<2*this.slideCnt?n.push(t[s]):e.push(t[s]);this.slidingManner.slideOrders[1]=e.concat(n),e=[],n=[];for(var r=0;r<t.length;r++)r<this.slideCnt?n.push(t[r]):e.push(t[r]);this.slidingManner.slideOrders[2]=e.concat(n)},e.prototype.mobileDetect=function(){return!!/Mobi|Tablet|iPad|iPhone/.test(navigator.userAgent)},e.prototype.nonImgLoaded=function(t){var e="ref"+t;if(this.refs[e]){var n=this.setItemsStyle(),i=this.refs[e];for(var s in n)i.style[s]=n[s];this.loadedCnt+=1,this.imgsWidth[t]=i.offsetWidth,(!this.mannerSetting.circular&&1===t||this.mannerSetting.circular&&1===this.slideCnt)&&this.initialSlideCon(),this.mannerSetting.circular&&this.loadedCnt===3*this.slideCnt&&this.initialSlideCon()}},e.prototype.imgLoaded=function(t){var e="ref"+t;if(this.refs[e]){var n=0,i=0,s=0,r=this.setItemsStyle(),o=this.refs[e];for(var l in o.offsetWidth>=this.refs.sliderBox.offsetWidth&&(n=o.offsetHeight/o.offsetWidth,s=(i=this.refs.sliderBox.offsetWidth-2*this.itemsMargin)*n,r.height=s+"px",r.width=i+"px"),r)o.style[l]=r[l];this.loadedCnt+=1,this.imgsWidth[t]=o.offsetWidth,(!this.mannerSetting.circular&&1===t||this.mannerSetting.circular&&1===this.slideCnt)&&this.initialSlideCon(),this.mannerSetting.circular&&this.loadedCnt===3*this.slideCnt&&this.initialSlideCon()}},e.prototype.slideItemHandler=function(t,e){var n=this;switch(this.slideType){case"prop":var i=(t.imgSrc,s.a.createElement("img",{src:t.imgSrc})),r=t.des?s.a.createElement("p",{style:this.setTextBoxStyle()},t.des):null;return s.a.createElement("div",{className:"itemWrapper",style:{order:e},onError:function(){return n.nonImgLoaded(e)},onLoad:function(){return n.imgLoaded(e)},onClick:this.handleBubbling,ref:"ref"+e,key:"ref"+e},i,r);case"cpnt":return s.a.createElement("div",{className:"itemWrapper",style:{order:e},onError:function(){return n.nonImgLoaded(e)},onLoad:function(){return n.imgLoaded(e)},onClick:this.handleBubbling,ref:"ref"+e,key:"ref"+e},t)}},e.prototype.initialSlideCon=function(){var t=this,e=this.refs.slideCon;if(e.addEventListener("transitionend",function(){t.slidingManner.sliding=!1}),this.mannerSetting.circular&&1!==this.slideCnt){for(var n=0,i=1;i<this.slideCnt+1;i++)n+=parseInt(this.imgsWidth[i]);this.slidingManner.slidesTotalWidth=n+this.slideCnt*this.itemsMargin*2,this.slidingManner.initialMovement=this.slidingManner.slidesTotalWidth-(this.refs.sliderBox.offsetWidth-(this.imgsWidth[1]+2*this.itemsMargin))/2}else this.refs.sflag.style.flexBasis=this.refs.sliderBox.offsetWidth+"px",this.refs.eflag.style.flexBasis=this.refs.sliderBox.offsetWidth+"px",e.style.transition="transform "+this.mannerSetting.duration+" ease",this.slidingManner.initialMovement=(this.refs.sliderBox.offsetWidth-this.imgsWidth[1])/2+this.itemsMargin+this.imgsWidth[1];e.style.transform="translateX(-"+this.slidingManner.initialMovement+"px)",this.slidingManner.movement=this.slidingManner.movement+this.slidingManner.initialMovement,this.autoSliding()},e.prototype.autoSliding=function(){var t=this;if(this.mannerSetting.autoSliding&&1!==this.slideCnt){var e=this.mannerSetting.autoSliding.interval.slice(0,-1),n=1e3*parseInt(e);this.mannerSetting.circular?this.autoSlidingTimer=setInterval(function(){t.slidingManner.sliding||t.moveSlide(t.slidingManner.direction)},n):this.autoSlidingTimer=setInterval(function(){t.slidingManner.currentSlide===t.slideCnt?t.slidingManner.sliding||(t.slidingManner.direction=-1,t.moveSlide(t.slidingManner.direction)):1===t.slidingManner.currentSlide?t.slidingManner.sliding||(t.slidingManner.direction=1,t.moveSlide(t.slidingManner.direction)):t.slidingManner.sliding||t.moveSlide(t.slidingManner.direction)},n)}},e.prototype.itemsReorder=function(){for(var t=0;t<3*this.slideCnt;t++)t<this.slideCnt?this.refs["ref"+(t-this.slideCnt)].style.order=this.slidingManner.slideOrders[this.slidingManner.cycle][t]:this.refs["ref"+(t-this.slideCnt+1)].style.order=this.slidingManner.slideOrders[this.slidingManner.cycle][t]},e.prototype.movementReset=function(t){var e=this,n=setInterval(function(){if(!e.slidingManner.sliding){var i=e.refs.slideCon;i.style.transition="none",t>0?(i.style.transform="translateX(-"+e.slidingManner.initialMovement+"px)",e.slidingManner.movement=e.slidingManner.initialMovement):t<0&&(i.style.transform="translateX(-"+(e.slidingManner.movement+e.slidingManner.slidesTotalWidth)+"px)",e.slidingManner.movement=e.slidingManner.movement+e.slidingManner.slidesTotalWidth),clearInterval(n)}},25)},e.prototype.moveSlide=function(t){var e=this.mannerSetting.circular?3*this.slideCnt:this.slideCnt;if(this.loadedCnt===e){var n=0,i=this.refs.slideCon;this.mannerSetting.circular?(this.slidingManner.sliding=!0,i.style.transition="transform "+this.mannerSetting.duration+" ease",1===t?(n=this.calMovement(t),this.slidingManner.movement=this.slidingManner.movement+n,i.style.transform="translateX(-"+this.slidingManner.movement+"px)",this.slidingManner.currentSlide=this.slidingManner.currentSlide+1,this.slidingManner.currentSlide===this.slideCnt+1&&(this.slidingManner.currentSlide=1,this.slidingManner.cycle=2===this.slidingManner.cycle?0:this.slidingManner.cycle+1,this.itemsReorder(),this.movementReset(t))):-1===t&&(n=this.calMovement(t),this.slidingManner.movement=this.slidingManner.movement-n,i.style.transform="translateX(-"+this.slidingManner.movement+"px)",this.slidingManner.currentSlide=1===this.slidingManner.currentSlide?-1:this.slidingManner.currentSlide-1,-1===this.slidingManner.currentSlide&&(this.slidingManner.currentSlide=this.slideCnt,this.slidingManner.cycle=0===this.slidingManner.cycle?2:this.slidingManner.cycle-1,this.itemsReorder(),this.movementReset(t)))):(i.style.transition="transform "+this.mannerSetting.duration+" ease",1===t&&this.slidingManner.currentSlide<this.slideCnt?(this.slidingManner.sliding=!0,n=this.calMovement(t),this.slidingManner.currentSlide=this.slidingManner.currentSlide+1,this.slidingManner.movement=this.slidingManner.movement+n,i.style.transform="translateX(-"+this.slidingManner.movement+"px)"):-1===t&&this.slidingManner.currentSlide>1&&(this.slidingManner.sliding=!0,n=this.calMovement(t),this.slidingManner.currentSlide=this.slidingManner.currentSlide-1,this.slidingManner.movement=this.slidingManner.movement-n,i.style.transform="translateX(-"+this.slidingManner.movement+"px)"))}},e.prototype.calMovement=function(t){var e=1===t?1:1===this.slidingManner.currentSlide?-2:-1;return this.imgsWidth[this.slidingManner.currentSlide]/2+2*this.itemsMargin+this.imgsWidth[this.slidingManner.currentSlide+e]/2},e.prototype.handleTouchStart=function(t){this.slidingManner.sliding=!0,this.touchEvent.touchStartX=t.targetTouches[0].clientX,this.touchEvent.beingTouched=!0},e.prototype.handleTouchMove=function(t){if(this.slidingManner.sliding=!0,this.touchEvent.beingTouched){this.touchEvent.touchMovement=this.touchEvent.touchStartX-t.targetTouches[0].clientX;var e=this.slidingManner.movement+this.touchEvent.touchMovement;t.currentTarget.style.transform="translateX(-"+e+"px)"}},e.prototype.handleTouchEnd=function(t){if(this.slidingManner.sliding=!1,Math.abs(this.touchEvent.touchStartX-t.changedTouches[0].clientX)>20){if(!this.slidingManner.sliding)if(Math.abs(this.touchEvent.touchMovement)>this.dragEvent.threshold){var e=this.touchEvent.touchMovement>0?1:-1;this.moveSlide(e)}else t.currentTarget.style.transition="transform 0.5s ease",t.currentTarget.style.transform="translateX(-"+this.slidingManner.movement+"px)";this.touchEvent.touchStartX=0,this.touchEvent.beingTouched=!1}},e.prototype.handleButtonClick=function(t){this.slidingManner.sliding||this.moveSlide(t)},e.prototype.handleDragStart=function(t){this.slidingManner.sliding=!0,t.currentTarget.style.transition="none",this.dragEvent.startPoint=t.clientX,t.dataTransfer.setDragImage(this.dragEvent.disableDragImage,1,1)},e.prototype.handleDragOver=function(t){this.dragEvent.deltaX=this.dragEvent.startPoint-t.clientX;var e=this.slidingManner.movement+this.dragEvent.deltaX;t.currentTarget.style.transform="translateX(-"+e+"px)",t.dataTransfer.dropEffect="none",t.dataTransfer.effectAllowed="none",t.preventDefault()},e.prototype.handleDragStop=function(t){var e=this.dragEvent.deltaX>0?1:-1;this.slidingManner.sliding=!1,Math.abs(this.dragEvent.deltaX)>this.dragEvent.threshold?this.slidingManner.sliding||this.moveSlide(e):(t.currentTarget.style.transition="transform 0.5s ease",t.currentTarget.style.transform="translateX(-"+this.slidingManner.movement+"px)")},e.prototype.setTextBoxStyle=function(){if(this.props.textBoxStyle)return this.props.textBoxStyle},e.prototype.setItemsStyle=function(){if(this.props.itemsStyle){var t=JSON.parse(JSON.stringify(this.props.itemsStyle));return delete t.height,Object.assign({},this.defaultItemsStyle,t)}return JSON.parse(JSON.stringify(this.defaultItemsStyle))},e.prototype.setSlideConHeight=function(){return this.props.itemsStyle&&this.props.itemsStyle.height?{height:this.props.itemsStyle.height}:{height:this.defaultSlideConStyle.height}},e.prototype.detectButtonPosition=function(){var t=[],e=this.defaultBtnPosition;for(var n in this.props.buttonSetting&&this.props.buttonSetting.placeOn&&!1===e[this.props.buttonSetting.placeOn]&&(e[this.props.buttonSetting.placeOn]=!0),e)!0===e[n]&&(t=n.split("-"));var i=void 0;return i="left"!==t[1]&&"right"!==t[1]&&"inside"!==t[1],"middle"===t[0]?{separate:!0,outOfBox:i,vertical:t[0],horizontal:t[1]}:{separate:!1,outOfBox:i,vertical:t[0],horizontal:t[1]}},e.prototype.setRightButtonStyle=function(){var t=void 0;return t=this.defaultButtonIconStyle,this.props.buttonSetting&&this.props.buttonSetting.style&&this.props.buttonSetting.style.right&&(t=Object.assign({},this.defaultButtonIconStyle,this.props.buttonSetting.style.right)),t},e.prototype.setLeftButtonStyle=function(){var t=void 0;return t=this.defaultButtonIconStyle,this.props.buttonSetting&&this.props.buttonSetting.style&&this.props.buttonSetting.style.left&&(t=Object.assign({},this.defaultButtonIconStyle,this.props.buttonSetting.style.left)),t},e.prototype.allocateButtonSet=function(t){var e={};if(e=Object.assign({},this.defaultButtonSetStyle),!t.separate){switch(t.horizontal){case"beneath":break;case"left":e.position="absolute",e.left="0px";break;case"right":e.position="absolute",e.right="0px"}switch(t.vertical){case"top":e.position="absolute",e.top="0px";break;case"bottom":"beneath"!==t.horizontal&&(e.position="absolute",e.bottom="0px")}}return e},e.prototype.setSliderBoxStyles=function(){return this.props.sliderBoxStyle?Object.assign({},this.defaultSliderBoxStyle,this.props.sliderBoxStyle):this.defaultSliderBoxStyle},e.prototype.setHoverEvent=function(){if(this.props.buttonSetting&&(this.props.buttonSetting.hoverEvent?this.props.buttonSetting.hoverEvent:this.buttonManner.hoverEvent))return{opacity:0}},e.prototype.render=function(){var t=this,e=void 0,n=void 0,i=void 0,r=void 0,o=void 0,l=void 0,a=void 0,d=void 0,h=void 0,c=void 0,u=void 0;return this.slideCnt&&(this.mannerSetting.button&&(u=this.detectButtonPosition(),h=this.props.lBtnCpnt?this.props.lBtnCpnt:s.a.createElement("div",{className:"arrowBtn previous",style:this.setLeftButtonStyle()}),c=this.props.rBtnCpnt?this.props.rBtnCpnt:s.a.createElement("div",{className:"arrowBtn next",style:this.setRightButtonStyle()}),u.separate?(a=s.a.createElement("div",{className:"buttonWrapper left",style:this.setHoverEvent(),onClick:function(){return t.handleButtonClick(-1)}},h),d=s.a.createElement("div",{className:"buttonWrapper right",style:this.setHoverEvent(),onClick:function(){return t.handleButtonClick(1)}},c)):l=s.a.createElement("div",{className:"buttonSet",style:this.allocateButtonSet(u)},s.a.createElement("div",{className:"buttonWrapper",style:this.setHoverEvent(),onClick:function(){return t.handleButtonClick(-1)}},h),s.a.createElement("div",{className:"buttonWrapper",style:this.setHoverEvent(),onClick:function(){return t.handleButtonClick(1)}},c))),this.mannerSetting.circular&&this.slideCnt>1?n=(n=(n=this.slideEls.map(function(e,n){return t.slideItemHandler(e,n-t.slideCnt)})).concat(this.slideEls.map(function(e,n){return t.slideItemHandler(e,n+1)}))).concat(this.slideEls.map(function(e,n){return t.slideItemHandler(e,n+1+t.slideCnt)})):(this.mannerSetting.flag?(i=s.a.createElement("div",{className:"flag",ref:"sflag",style:{order:0},key:"sflag"}),r=s.a.createElement("div",{className:"flag",ref:"eflag",style:{order:this.slideCnt+1},key:"eflag"})):(i=s.a.createElement("div",{className:"flag",ref:"sflag",style:{background:"transparent",order:0},key:"sflag"}),r=s.a.createElement("div",{className:"flag",ref:"eflag",style:{background:"transparent",order:this.slideCnt+1},key:"eflag"})),(n=this.slideEls.map(function(e,n){return t.slideItemHandler(e,n+1)})).unshift(i),n.push(r)),o=this.mobileDetect()?s.a.createElement("div",{className:"slideCon",ref:"slideCon",style:this.setSlideConHeight(),onTouchStart:function(e){return t.handleTouchStart(e)},onTouchMove:function(e){return t.handleTouchMove(e)},onTouchEnd:function(e){return t.handleTouchEnd(e)}},n):s.a.createElement("div",{className:"slideCon",ref:"slideCon",onDragStart:function(e){return t.handleDragStart(e)},onDragEnd:function(e){return t.handleDragStop(e)},onDragOver:function(e){return t.handleDragOver(e)},style:this.setSlideConHeight()},n),e=this.mannerSetting.button?u.separate?u.outOfBox?s.a.createElement("div",{className:"sliderSet"},a,s.a.createElement("div",{className:"sliderBox",ref:"sliderBox",style:this.setSliderBoxStyles()},o),d):s.a.createElement("div",{className:"sliderBox",ref:"sliderBox",style:this.setSliderBoxStyles()},a,o,d):u.outOfBox?s.a.createElement("div",null,s.a.createElement("div",{className:"sliderBox",ref:"sliderBox",style:this.setSliderBoxStyles()},o),l):s.a.createElement("div",{className:"sliderBox",ref:"sliderBox",style:this.setSliderBoxStyles()},l,o):s.a.createElement("div",{className:"sliderSet"},s.a.createElement("div",{className:"sliderBox",ref:"sliderBox",style:this.setSliderBoxStyles()},o))),e},e}(i.Component);e.default=o},function(e,n){e.exports=t},function(t,e){}]).default}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.ReactCarouselSlider=e(require("react")):t.ReactCarouselSlider=e(t.React)}("undefined"!=typeof self?self:this,function(t){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var s=e[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),s=n.n(i),r=n(3);n.n(r);var o=function(t){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var i,s=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return s.slidingManner={currentSlide:1,slidesTotalWidth:0,initialMovement:0,movement:0,direction:1,cycle:0,sliding:!1,slideOrders:[[],[],[]]},s.dragEvent={startPoint:0,dragging:!1,deltaX:0,thrershold:0,disableDragImage:(i=new Image,i.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",i)},s.calculateSlidesOrder=s.calculateSlidesOrder.bind(s),s.itemsReorder=s.itemsReorder.bind(s),s.movementReset=s.movementReset.bind(s),s.loadedCnt=0,s.imgsWidth={},s.mannerSetting={autoSliding:!1,circular:!0,duration:"0.5s",flag:!1,button:!0},s.mannerSetting=s.handleMannerSetting(),s.defaultSliderBoxStyle={height:"400px",width:"90%",background:"#EEEEEE",border:"none"},s.defaultSlideConStyle={height:"80%"},s.defaultItemsStyle={padding:"3px",background:"#FAFAFA",margin:"0px 40px"},s.buttonManner={hoverEvent:!1},s.defaultButtonSetStyle={},s.defaultButtonIconStyle={color:"white",background:"#757575",height:"30px",width:"30px",margin:"10px",fontSize:"20px",borderRadius:"2px",border:"none"},s.defaultBtnPosition={"top-left":!0,"top-right":!1,"middle-inside":!1,"middle-outside":!1,"bottom-right":!1,"bottom-left":!1,"bottom-beneath":!1},s.itemsMargin=s.props.itemsStyle&&s.props.itemsStyle.margin?parseInt(s.props.itemsStyle.margin.split(" ")[1].replace("px","")):parseInt(s.defaultItemsStyle.margin.split(" ")[1].replace("px","")),s.slideType=s.props.slideItems?"prop":s.props.slideCpnts?"cpnt":null,s.slideCnt="prop"===s.slideType?s.props.slideItems.length:"cpnt"===s.slideType?s.props.slideCpnts.length:0,s.slideEls="prop"===s.slideType?s.props.slideItems:"cpnt"===s.slideType?s.props.slideCpnts:null,s.touchEvent={touchMovement:0,touchStartX:0,beingTouched:!1},s.imgLoaded=s.imgLoaded.bind(s),s.nonImgLoaded=s.nonImgLoaded.bind(s),s.slideItemHandler=s.slideItemHandler.bind(s),s.initialSlideCon=s.initialSlideCon.bind(s),s.calMovement=s.calMovement.bind(s),s.autoSliding=s.autoSliding.bind(s),s.handleTouchStart=s.handleTouchStart.bind(s),s.handleTouchMove=s.handleTouchMove.bind(s),s.handleTouchEnd=s.handleTouchEnd.bind(s),s.handleButtonClick=s.handleButtonClick.bind(s),s.handleDragStart=s.handleDragStart.bind(s),s.handleDragStop=s.handleDragStop.bind(s),s.handleDragOver=s.handleDragOver.bind(s),s.setSliderBoxStyles=s.setSliderBoxStyles.bind(s),s.setItemsStyle=s.setItemsStyle.bind(s),s.setSlideConHeight=s.setSlideConHeight.bind(s),s.detectButtonPosition=s.detectButtonPosition.bind(s),s.allocateButtonSet=s.allocateButtonSet.bind(s),s.setLeftButtonStyle=s.setLeftButtonStyle.bind(s),s.setHoverEvent=s.setHoverEvent.bind(s),s.calculateSlidesOrder(),s}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentDidMount=function(){this.dragEvent.threshold=this.refs.sliderBox.offsetWidth>100?this.refs.sliderBox.offsetWidth/5:50},e.prototype.componentWillUnmount=function(){clearInterval(this.autoSlidingTimer)},e.prototype.handleMannerSetting=function(){return this.props.manner?Object.assign({},this.mannerSetting,this.props.manner):this.mannerSetting},e.prototype.handleBubbling=function(t){t.stopPropagation()},e.prototype.calculateSlidesOrder=function(){for(var t=[],e=[],n=[],i=-1*this.slideCnt;i<=2*this.slideCnt;i++)0!==i&&t.push(i);this.slidingManner.slideOrders[0]=t;for(var s=0;s<t.length;s++)s<2*this.slideCnt?n.push(t[s]):e.push(t[s]);this.slidingManner.slideOrders[1]=e.concat(n),e=[],n=[];for(var r=0;r<t.length;r++)r<this.slideCnt?n.push(t[r]):e.push(t[r]);this.slidingManner.slideOrders[2]=e.concat(n)},e.prototype.mobileDetect=function(){return!!/Mobi|Tablet|iPad|iPhone/.test(navigator.userAgent)},e.prototype.nonImgLoaded=function(t){var e="ref"+t;if(this.refs[e]){var n=this.setItemsStyle(),i=this.refs[e];for(var s in n)i.style[s]=n[s];this.loadedCnt+=1,this.imgsWidth[t]=i.offsetWidth,(!this.mannerSetting.circular&&1===t||this.mannerSetting.circular&&1===this.slideCnt)&&this.initialSlideCon(),this.mannerSetting.circular&&this.loadedCnt===3*this.slideCnt&&this.initialSlideCon()}},e.prototype.imgLoaded=function(t){var e="ref"+t;if(this.refs[e]){var n=0,i=0,s=0,r=this.setItemsStyle(),o=this.refs[e];for(var a in o.offsetWidth>=this.refs.sliderBox.offsetWidth&&(n=o.offsetHeight/o.offsetWidth,s=(i=this.refs.sliderBox.offsetWidth-2*this.itemsMargin)*n,r.height=s+"px",r.width=i+"px"),r)o.style[a]=r[a];this.loadedCnt+=1,this.imgsWidth[t]=o.offsetWidth,(!this.mannerSetting.circular&&1===t||this.mannerSetting.circular&&1===this.slideCnt)&&this.initialSlideCon(),this.mannerSetting.circular&&this.loadedCnt===3*this.slideCnt&&this.initialSlideCon()}},e.prototype.slideItemHandler=function(t,e){var n=this;switch(this.slideType){case"prop":var i=(t.imgSrc,s.a.createElement("img",{src:t.imgSrc})),r=t.des?s.a.createElement("p",{style:this.setTextBoxStyle()},t.des):null;return s.a.createElement("div",{className:"itemWrapper",style:{order:e},onError:function(){return n.nonImgLoaded(e)},onLoad:function(){return n.imgLoaded(e)},onClick:this.handleBubbling,ref:"ref"+e,key:"ref"+e},i,r);case"cpnt":return s.a.createElement("div",{className:"itemWrapper",style:{order:e},onError:function(){return n.nonImgLoaded(e)},onLoad:function(){return n.imgLoaded(e)},onClick:this.handleBubbling,ref:"ref"+e,key:"ref"+e},t)}},e.prototype.initialSlideCon=function(){var t=this,e=this.refs.slideCon;if(e.addEventListener("transitionend",function(){t.slidingManner.sliding=!1}),this.mannerSetting.circular&&1!==this.slideCnt){for(var n=0,i=1;i<this.slideCnt+1;i++)n+=parseInt(this.imgsWidth[i]);this.slidingManner.slidesTotalWidth=n+this.slideCnt*this.itemsMargin*2,this.slidingManner.initialMovement=this.slidingManner.slidesTotalWidth-(this.refs.sliderBox.offsetWidth-(this.imgsWidth[1]+2*this.itemsMargin))/2}else this.refs.sflag.style.flexBasis=this.refs.sliderBox.offsetWidth+"px",this.refs.eflag.style.flexBasis=this.refs.sliderBox.offsetWidth+"px",e.style.transition="transform "+this.mannerSetting.duration+" ease",this.slidingManner.initialMovement=(this.refs.sliderBox.offsetWidth-this.imgsWidth[1])/2+this.itemsMargin+this.imgsWidth[1];e.style.transform="translateX(-"+this.slidingManner.initialMovement+"px)",this.slidingManner.movement=this.slidingManner.movement+this.slidingManner.initialMovement,this.autoSliding()},e.prototype.autoSliding=function(){var t=this;if(this.mannerSetting.autoSliding&&1!==this.slideCnt){var e=this.mannerSetting.autoSliding.interval.slice(0,-1),n=1e3*parseInt(e);this.mannerSetting.circular?this.autoSlidingTimer=setInterval(function(){t.slidingManner.sliding||t.moveSlide(t.slidingManner.direction)},n):this.autoSlidingTimer=setInterval(function(){t.slidingManner.currentSlide===t.slideCnt?t.slidingManner.sliding||(t.slidingManner.direction=-1,t.moveSlide(t.slidingManner.direction)):1===t.slidingManner.currentSlide?t.slidingManner.sliding||(t.slidingManner.direction=1,t.moveSlide(t.slidingManner.direction)):t.slidingManner.sliding||t.moveSlide(t.slidingManner.direction)},n)}},e.prototype.itemsReorder=function(){for(var t=0;t<3*this.slideCnt;t++)t<this.slideCnt?this.refs["ref"+(t-this.slideCnt)].style.order=this.slidingManner.slideOrders[this.slidingManner.cycle][t]:this.refs["ref"+(t-this.slideCnt+1)].style.order=this.slidingManner.slideOrders[this.slidingManner.cycle][t]},e.prototype.movementReset=function(t){var e=this,n=setInterval(function(){if(!e.slidingManner.sliding){var i=e.refs.slideCon;i.style.transition="none",t>0?(i.style.transform="translateX(-"+e.slidingManner.initialMovement+"px)",e.slidingManner.movement=e.slidingManner.initialMovement):t<0&&(i.style.transform="translateX(-"+(e.slidingManner.movement+e.slidingManner.slidesTotalWidth)+"px)",e.slidingManner.movement=e.slidingManner.movement+e.slidingManner.slidesTotalWidth),clearInterval(n)}},25)},e.prototype.moveSlide=function(t){var e=this.mannerSetting.circular?3*this.slideCnt:this.slideCnt;if(this.loadedCnt===e){var n=0,i=this.refs.slideCon;if(this.mannerSetting.circular)this.slidingManner.sliding=!0,i.style.transition="transform "+this.mannerSetting.duration+" ease",1===t?(n=this.calMovement(t),this.slidingManner.movement=this.slidingManner.movement+n,i.style.transform="translateX(-"+this.slidingManner.movement+"px)",this.slidingManner.currentSlide=this.slidingManner.currentSlide+1,this.slidingManner.currentSlide===this.slideCnt+1&&(this.slidingManner.currentSlide=1,this.slidingManner.cycle=2===this.slidingManner.cycle?0:this.slidingManner.cycle+1,this.itemsReorder(),this.movementReset(t))):-1===t&&(n=this.calMovement(t),this.slidingManner.movement=this.slidingManner.movement-n,i.style.transform="translateX(-"+this.slidingManner.movement+"px)",this.slidingManner.currentSlide=1===this.slidingManner.currentSlide?-1:this.slidingManner.currentSlide-1,-1===this.slidingManner.currentSlide&&(this.slidingManner.currentSlide=this.slideCnt,this.slidingManner.cycle=0===this.slidingManner.cycle?2:this.slidingManner.cycle-1,this.itemsReorder(),this.movementReset(t)));else if(i.style.transition="transform "+this.mannerSetting.duration+" ease",1===t&&this.slidingManner.currentSlide<this.slideCnt)this.slidingManner.sliding=!0,n=this.calMovement(t),this.slidingManner.currentSlide=this.slidingManner.currentSlide+1,this.slidingManner.movement=this.slidingManner.movement+n,i.style.transform="translateX(-"+this.slidingManner.movement+"px)";else{if(!(-1===t&&this.slidingManner.currentSlide>1))return!1;this.slidingManner.sliding=!0,n=this.calMovement(t),this.slidingManner.currentSlide=this.slidingManner.currentSlide-1,this.slidingManner.movement=this.slidingManner.movement-n,i.style.transform="translateX(-"+this.slidingManner.movement+"px)"}}},e.prototype.calMovement=function(t){var e=1===t?1:1===this.slidingManner.currentSlide?-2:-1;return this.imgsWidth[this.slidingManner.currentSlide]/2+2*this.itemsMargin+this.imgsWidth[this.slidingManner.currentSlide+e]/2},e.prototype.handleTouchStart=function(t){this.slidingManner.sliding=!0,this.touchEvent.touchStartX=t.targetTouches[0].clientX,this.touchEvent.beingTouched=!0},e.prototype.handleTouchMove=function(t){if(this.slidingManner.sliding=!0,this.touchEvent.beingTouched){this.touchEvent.touchMovement=this.touchEvent.touchStartX-t.targetTouches[0].clientX;var e=this.slidingManner.movement+this.touchEvent.touchMovement;t.currentTarget.style.transform="translateX(-"+e+"px)"}},e.prototype.handleTouchEnd=function(t){if(Math.abs(this.touchEvent.touchStartX-t.changedTouches[0].clientX)>20){if(this.slidingManner.sliding=!1,!this.slidingManner.sliding)if(Math.abs(this.touchEvent.touchMovement)>this.dragEvent.threshold){var e=this.touchEvent.touchMovement>0?1:-1;!1===this.moveSlide(e)&&(t.currentTarget.style.transition="transform 0.5s ease",t.currentTarget.style.transform="translateX(-"+this.slidingManner.movement+"px)")}else t.currentTarget.style.transition="transform 0.5s ease",t.currentTarget.style.transform="translateX(-"+this.slidingManner.movement+"px)";this.touchEvent.touchStartX=0,this.touchEvent.beingTouched=!1}},e.prototype.handleButtonClick=function(t){this.slidingManner.sliding||this.moveSlide(t)},e.prototype.handleDragStart=function(t){!1===this.slidingManner.sliding&&!1===this.dragEvent.dragging&&(this.slidingManner.sliding=!0,this.dragEvent.dragging=!0,t.currentTarget.style.transition="none",this.dragEvent.startPoint=t.clientX,t.dataTransfer.setDragImage(this.dragEvent.disableDragImage,1,1))},e.prototype.handleDragOver=function(t){if(t.dataTransfer.dropEffect="none",t.dataTransfer.effectAllowed="none",t.preventDefault(),!0===this.dragEvent.dragging){this.dragEvent.deltaX=this.dragEvent.startPoint-t.clientX;var e=this.slidingManner.movement+this.dragEvent.deltaX;t.currentTarget.style.transform="translateX(-"+e+"px)"}},e.prototype.handleDragStop=function(t){if(!0===this.dragEvent.dragging){if(Math.abs(this.dragEvent.deltaX)>this.dragEvent.threshold){if(this.slidingManner.sliding=!1,!this.slidingManner.sliding){var e=this.dragEvent.deltaX>0?1:-1;!1===this.moveSlide(e)&&(t.currentTarget.style.transition="transform 0.5s ease",t.currentTarget.style.transform="translateX(-"+this.slidingManner.movement+"px)")}}else t.currentTarget.style.transition="transform 0.5s ease",t.currentTarget.style.transform="translateX(-"+this.slidingManner.movement+"px)";this.dragEvent.startPoint=0,this.dragEvent.deltaX=0,this.dragEvent.dragging=!1}},e.prototype.setTextBoxStyle=function(){if(this.props.textBoxStyle)return this.props.textBoxStyle},e.prototype.setItemsStyle=function(){if(this.props.itemsStyle){var t=JSON.parse(JSON.stringify(this.props.itemsStyle));return delete t.height,Object.assign({},this.defaultItemsStyle,t)}return JSON.parse(JSON.stringify(this.defaultItemsStyle))},e.prototype.setSlideConHeight=function(){return this.props.itemsStyle&&this.props.itemsStyle.height?{height:this.props.itemsStyle.height}:{height:this.defaultSlideConStyle.height}},e.prototype.detectButtonPosition=function(){var t=[],e=this.defaultBtnPosition;for(var n in this.props.buttonSetting&&this.props.buttonSetting.placeOn&&!1===e[this.props.buttonSetting.placeOn]&&(e[this.props.buttonSetting.placeOn]=!0),e)!0===e[n]&&(t=n.split("-"));var i=void 0;return i="left"!==t[1]&&"right"!==t[1]&&"inside"!==t[1],"middle"===t[0]?{separate:!0,outOfBox:i,vertical:t[0],horizontal:t[1]}:{separate:!1,outOfBox:i,vertical:t[0],horizontal:t[1]}},e.prototype.setRightButtonStyle=function(){var t=void 0;return t=this.defaultButtonIconStyle,this.props.buttonSetting&&this.props.buttonSetting.style&&this.props.buttonSetting.style.right&&(t=Object.assign({},this.defaultButtonIconStyle,this.props.buttonSetting.style.right)),t},e.prototype.setLeftButtonStyle=function(){var t=void 0;return t=this.defaultButtonIconStyle,this.props.buttonSetting&&this.props.buttonSetting.style&&this.props.buttonSetting.style.left&&(t=Object.assign({},this.defaultButtonIconStyle,this.props.buttonSetting.style.left)),t},e.prototype.allocateButtonSet=function(t){var e={};if(e=Object.assign({},this.defaultButtonSetStyle),!t.separate){switch(t.horizontal){case"beneath":break;case"left":e.position="absolute",e.left="0px";break;case"right":e.position="absolute",e.right="0px"}switch(t.vertical){case"top":e.position="absolute",e.top="0px";break;case"bottom":"beneath"!==t.horizontal&&(e.position="absolute",e.bottom="0px")}}return e},e.prototype.setSliderBoxStyles=function(){return this.props.sliderBoxStyle?Object.assign({},this.defaultSliderBoxStyle,this.props.sliderBoxStyle):this.defaultSliderBoxStyle},e.prototype.setHoverEvent=function(){if(this.props.buttonSetting&&(this.props.buttonSetting.hoverEvent?this.props.buttonSetting.hoverEvent:this.buttonManner.hoverEvent))return{opacity:0}},e.prototype.render=function(){var t=this,e=void 0,n=void 0,i=void 0,r=void 0,o=void 0,a=void 0,l=void 0,d=void 0,h=void 0,c=void 0,u=void 0;return this.slideCnt&&(this.mannerSetting.button&&(u=this.detectButtonPosition(),h=this.props.lBtnCpnt?this.props.lBtnCpnt:s.a.createElement("div",{className:"arrowBtn previous",style:this.setLeftButtonStyle()}),c=this.props.rBtnCpnt?this.props.rBtnCpnt:s.a.createElement("div",{className:"arrowBtn next",style:this.setRightButtonStyle()}),u.separate?(l=s.a.createElement("div",{className:"buttonWrapper left",style:this.setHoverEvent(),onClick:function(){return t.handleButtonClick(-1)}},h),d=s.a.createElement("div",{className:"buttonWrapper right",style:this.setHoverEvent(),onClick:function(){return t.handleButtonClick(1)}},c)):a=s.a.createElement("div",{className:"buttonSet",style:this.allocateButtonSet(u)},s.a.createElement("div",{className:"buttonWrapper",style:this.setHoverEvent(),onClick:function(){return t.handleButtonClick(-1)}},h),s.a.createElement("div",{className:"buttonWrapper",style:this.setHoverEvent(),onClick:function(){return t.handleButtonClick(1)}},c))),this.mannerSetting.circular&&this.slideCnt>1?n=(n=(n=this.slideEls.map(function(e,n){return t.slideItemHandler(e,n-t.slideCnt)})).concat(this.slideEls.map(function(e,n){return t.slideItemHandler(e,n+1)}))).concat(this.slideEls.map(function(e,n){return t.slideItemHandler(e,n+1+t.slideCnt)})):(this.mannerSetting.flag?(i=s.a.createElement("div",{className:"flag",ref:"sflag",style:{order:0},key:"sflag"}),r=s.a.createElement("div",{className:"flag",ref:"eflag",style:{order:this.slideCnt+1},key:"eflag"})):(i=s.a.createElement("div",{className:"flag",ref:"sflag",style:{background:"transparent",order:0},key:"sflag"}),r=s.a.createElement("div",{className:"flag",ref:"eflag",style:{background:"transparent",order:this.slideCnt+1},key:"eflag"})),(n=this.slideEls.map(function(e,n){return t.slideItemHandler(e,n+1)})).unshift(i),n.push(r)),o=this.mobileDetect()?s.a.createElement("div",{className:"slideCon",ref:"slideCon",style:this.setSlideConHeight(),onTouchStart:function(e){return t.handleTouchStart(e)},onTouchMove:function(e){return t.handleTouchMove(e)},onTouchEnd:function(e){return t.handleTouchEnd(e)}},n):s.a.createElement("div",{className:"slideCon",ref:"slideCon",onDragStart:function(e){return t.handleDragStart(e)},onDragEnd:function(e){return t.handleDragStop(e)},onDragOver:function(e){return t.handleDragOver(e)},style:this.setSlideConHeight()},n),e=this.mannerSetting.button?u.separate?u.outOfBox?s.a.createElement("div",{className:"sliderSet"},l,s.a.createElement("div",{className:"sliderBox",ref:"sliderBox",style:this.setSliderBoxStyles()},o),d):s.a.createElement("div",{className:"sliderBox",ref:"sliderBox",style:this.setSliderBoxStyles()},l,o,d):u.outOfBox?s.a.createElement("div",null,s.a.createElement("div",{className:"sliderBox",ref:"sliderBox",style:this.setSliderBoxStyles()},o),a):s.a.createElement("div",{className:"sliderBox",ref:"sliderBox",style:this.setSliderBoxStyles()},a,o):s.a.createElement("div",{className:"sliderSet"},s.a.createElement("div",{className:"sliderBox",ref:"sliderBox",style:this.setSliderBoxStyles()},o))),e},e}(i.Component);e.default=o},function(e,n){e.exports=t},function(t,e){}]).default}); | ||
//# sourceMappingURL=react-carousel-slider.min.js.map |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
209122
2906