Skip to content

Commit 2ed7178

Browse files
committed
add on update transform target left
1 parent 4edd81e commit 2ed7178

File tree

3 files changed

+40
-6
lines changed

3 files changed

+40
-6
lines changed

dist/react-slick.js

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,8 +1124,14 @@ return /******/ (function(modules) { // webpackBootstrap
11241124
// getCSS function needs previously set state
11251125

11261126
if (this.props.onInitTargetLeft) {
1127-
targetLeft = this.props.onInitTargetLeft(targetLeft, slideCount, slideWidth, trackWidth);
1127+
console.warn('[onInitTargetLeft] deprecated from version 0.14.8. Use onTransformInitTargetLeft instead');
1128+
targetLeft = this.props.onInitTargetLeft({ targetLeft: targetLeft, slideCount: slideCount, slideWidth: slideWidth, trackWidth: trackWidth, listWidth: listWidth, listHeight: listHeight });
11281129
}
1130+
1131+
if (this.props.onTransformInitTargetLeft) {
1132+
targetLeft = this.props.onTransformInitTargetLeft({ targetLeft: targetLeft, slideCount: slideCount, slideWidth: slideWidth, trackWidth: trackWidth, listWidth: listWidth, listHeight: listHeight });
1133+
}
1134+
11291135
var trackStyle = (0, _trackHelper.getTrackCSS)((0, _objectAssign2.default)({ left: targetLeft }, props, this.state));
11301136

11311137
this.setState({ trackStyle: trackStyle });
@@ -1167,6 +1173,11 @@ return /******/ (function(modules) { // webpackBootstrap
11671173
slideIndex: this.state.currentSlide,
11681174
trackRef: this.track
11691175
}, props, this.state));
1176+
1177+
if (this.props.onTransformUpdateTargetLeft) {
1178+
targetLeft = this.props.onTransformUpdateTargetLeft({ targetLeft: targetLeft, slideCount: slideCount, slideWidth: slideWidth, trackWidth: trackWidth, listWidth: listWidth, listHeight: listHeight });
1179+
}
1180+
11701181
// getCSS function needs previously set state
11711182
var trackStyle = (0, _trackHelper.getTrackCSS)((0, _objectAssign2.default)({ left: targetLeft }, props, this.state));
11721183

@@ -1313,7 +1324,12 @@ return /******/ (function(modules) { // webpackBootstrap
13131324
if (this.props.useCSS === false) {
13141325

13151326
if (this.props.customCurrentSlideLeft) {
1316-
currentLeft = this.props.customCurrentSlideLeft(currentLeft, currentSlide, targetSlide);
1327+
console.warn('[customCurrentSlideLeft] deprecated from version 0.14.8. Use onTransformCurrentLeft instead');
1328+
currentLeft = this.props.customCurrentSlideLeft({ currentLeft: currentLeft, currentSlide: currentSlide, targetLeft: targetLeft, targetSlide: targetSlide });
1329+
}
1330+
1331+
if (this.props.onTransformCurrentLeft) {
1332+
currentLeft = this.props.onTransformCurrentLeft({ currentLeft: currentLeft, currentSlide: currentSlide, targetLeft: targetLeft, targetSlide: targetSlide });
13171333
}
13181334

13191335
this.setState({
@@ -1327,7 +1343,12 @@ return /******/ (function(modules) { // webpackBootstrap
13271343
} else {
13281344

13291345
if (this.props.customCurrentSlideLeft) {
1330-
currentLeft = this.props.customCurrentSlideLeft(currentLeft, currentSlide, targetSlide);
1346+
console.warn('[customCurrentSlideLeft] deprecated from version 0.14.8. Use onTransformCurrentLeft instead');
1347+
currentLeft = this.props.customCurrentSlideLeft({ currentLeft: currentLeft, currentSlide: currentSlide, targetLeft: targetLeft, targetSlide: targetSlide });
1348+
}
1349+
1350+
if (this.props.onTransformCurrentLeft) {
1351+
currentLeft = this.props.onTransformCurrentLeft({ currentLeft: currentLeft, currentSlide: currentSlide, targetLeft: targetLeft, targetSlide: targetSlide });
13311352
}
13321353

13331354
var nextStateChanges = {
@@ -1346,7 +1367,12 @@ return /******/ (function(modules) { // webpackBootstrap
13461367
};
13471368

13481369
if (this.props.customTargetSlideLeft) {
1349-
targetLeft = this.props.customTargetSlideLeft(targetLeft, currentSlide, targetSlide);
1370+
console.warn('[customTargetSlideLeft] deprecated from version 0.14.8. Use onTransformTargetLeft instead');
1371+
targetLeft = this.props.customTargetSlideLeft({ currentLeft: currentLeft, currentSlide: currentSlide, targetLeft: targetLeft, targetSlide: targetSlide });
1372+
}
1373+
1374+
if (this.props.onTransformTargetLeft) {
1375+
targetLeft = this.props.onTransformTargetLeft({ currentLeft: currentLeft, currentSlide: currentSlide, targetLeft: targetLeft, targetSlide: targetSlide });
13501376
}
13511377

13521378
this.setState({
@@ -1527,6 +1553,9 @@ return /******/ (function(modules) { // webpackBootstrap
15271553
customTargetSlideLeft: null,
15281554
customCurrentSlideLeft: null,
15291555
onInitTargetLeft: null,
1556+
onTransformTargetLeft: null,
1557+
onTransformCurrentLeft: null,
1558+
onTransformInitTargetLeft: null,
15301559
edgeEvent: null,
15311560
init: null,
15321561
swipeEvent: null,

0 commit comments

Comments
 (0)