add all frontend files

This commit is contained in:
2026-01-17 15:16:36 -05:00
parent ff16ae7858
commit e40287e4aa
25704 changed files with 1935289 additions and 0 deletions

22
node_modules/@ant-design/react-slick/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2014 Kiran Abburi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

116
node_modules/@ant-design/react-slick/README.md generated vendored Normal file
View File

@@ -0,0 +1,116 @@
### @ant-design/react-slick
[![Backers on Open Collective](https://opencollective.com/react-slick/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/react-slick/sponsors/badge.svg)](#sponsors)
##### Carousel component built with React. It is a react port of [slick carousel](http://kenwheeler.github.io/slick/)
## [Documentation](http://react-slick.neostack.com)
### Installation
**npm**
```bash
npm install @ant-design/react-slick --save
```
**yarn**
```bash
yarn add @ant-design/react-slick
```
**Also install slick-carousel for css and font**
```bash
npm install slick-carousel
// Import css files
import "slick-carousel/slick/slick.css";
import "slick-carousel/slick/slick-theme.css";
```
or add cdn link in your html
```html
<link
rel="stylesheet"
type="text/css"
charset="UTF-8"
href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.css"
/>
<link
rel="stylesheet"
type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.min.css"
/>
```
### [PlayGround](https://stackblitz.com/edit/vitejs-vite-ownrun?file=src%2FImageSlider.jsx)
### Example
```js
import React from "react";
import Slider from "@ant-design/react-slick";
export default function SimpleSlider() {
var settings = {
dots: true,
infinite: true,
speed: 500,
slidesToShow: 1,
slidesToScroll: 1
};
return (
<Slider {...settings}>
<div>
<h3>1</h3>
</div>
<div>
<h3>2</h3>
</div>
<div>
<h3>3</h3>
</div>
<div>
<h3>4</h3>
</div>
<div>
<h3>5</h3>
</div>
<div>
<h3>6</h3>
</div>
</Slider>
);
}
```
### Props
For all available props, go [here](https://react-slick.neostack.com/docs/api/).
### Methods
For all available methods, go [here](https://react-slick.neostack.com/docs/api#methods)
### Development
Want to run demos locally
```bash
git clone https://github.com/ant-design/react-slick
cd react-slick
npm install
npm start
open http://localhost:8080
```
## Community
Join our [discord channel](https://discord.gg/z7stRE4Cyb) to discuss react-slick bugs and ask for help
## Contributing
Please see the [contributing guidelines](./CONTRIBUTING.md)

4109
node_modules/@ant-design/react-slick/dist/react-slick.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

122
node_modules/@ant-design/react-slick/es/arrows.js generated vendored Normal file
View File

@@ -0,0 +1,122 @@
"use strict";
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
import _isNativeReflectConstruct from "@babel/runtime/helpers/esm/isNativeReflectConstruct";
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/esm/inherits";
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
import React from "react";
import classnames from "classnames";
import { canGoNext } from "./utils/innerSliderUtils";
export var PrevArrow = /*#__PURE__*/function (_React$PureComponent) {
function PrevArrow() {
_classCallCheck(this, PrevArrow);
return _callSuper(this, PrevArrow, arguments);
}
_inherits(PrevArrow, _React$PureComponent);
return _createClass(PrevArrow, [{
key: "clickHandler",
value: function clickHandler(options, e) {
if (e) {
e.preventDefault();
}
this.props.clickHandler(options, e);
}
}, {
key: "render",
value: function render() {
var prevClasses = {
"slick-arrow": true,
"slick-prev": true
};
var prevHandler = this.clickHandler.bind(this, {
message: "previous"
});
if (!this.props.infinite && (this.props.currentSlide === 0 || this.props.slideCount <= this.props.slidesToShow)) {
prevClasses["slick-disabled"] = true;
prevHandler = null;
}
var prevArrowProps = {
key: "0",
"data-role": "none",
className: classnames(prevClasses),
style: {
display: "block"
},
onClick: prevHandler
};
var customProps = {
currentSlide: this.props.currentSlide,
slideCount: this.props.slideCount
};
var prevArrow;
if (this.props.prevArrow) {
prevArrow = /*#__PURE__*/React.cloneElement(this.props.prevArrow, _objectSpread(_objectSpread({}, prevArrowProps), customProps));
} else {
prevArrow = /*#__PURE__*/React.createElement("button", _extends({
key: "0",
type: "button"
}, prevArrowProps), " ", "Previous");
}
return prevArrow;
}
}]);
}(React.PureComponent);
export var NextArrow = /*#__PURE__*/function (_React$PureComponent2) {
function NextArrow() {
_classCallCheck(this, NextArrow);
return _callSuper(this, NextArrow, arguments);
}
_inherits(NextArrow, _React$PureComponent2);
return _createClass(NextArrow, [{
key: "clickHandler",
value: function clickHandler(options, e) {
if (e) {
e.preventDefault();
}
this.props.clickHandler(options, e);
}
}, {
key: "render",
value: function render() {
var nextClasses = {
"slick-arrow": true,
"slick-next": true
};
var nextHandler = this.clickHandler.bind(this, {
message: "next"
});
if (!canGoNext(this.props)) {
nextClasses["slick-disabled"] = true;
nextHandler = null;
}
var nextArrowProps = {
key: "1",
"data-role": "none",
className: classnames(nextClasses),
style: {
display: "block"
},
onClick: nextHandler
};
var customProps = {
currentSlide: this.props.currentSlide,
slideCount: this.props.slideCount
};
var nextArrow;
if (this.props.nextArrow) {
nextArrow = /*#__PURE__*/React.cloneElement(this.props.nextArrow, _objectSpread(_objectSpread({}, nextArrowProps), customProps));
} else {
nextArrow = /*#__PURE__*/React.createElement("button", _extends({
key: "1",
type: "button"
}, nextArrowProps), " ", "Next");
}
return nextArrow;
}
}]);
}(React.PureComponent);

View File

@@ -0,0 +1,63 @@
import React from "react";
var defaultProps = {
accessibility: true,
adaptiveHeight: false,
afterChange: null,
appendDots: function appendDots(dots) {
return /*#__PURE__*/React.createElement("ul", {
style: {
display: "block"
}
}, dots);
},
arrows: true,
autoplay: false,
autoplaySpeed: 3000,
beforeChange: null,
centerMode: false,
centerPadding: "50px",
className: "",
cssEase: "ease",
customPaging: function customPaging(i) {
return /*#__PURE__*/React.createElement("button", null, i + 1);
},
dots: false,
dotsClass: "slick-dots",
draggable: true,
easing: "linear",
edgeFriction: 0.35,
fade: false,
focusOnSelect: false,
infinite: true,
initialSlide: 0,
lazyLoad: null,
nextArrow: null,
onEdge: null,
onInit: null,
onLazyLoadError: null,
onReInit: null,
pauseOnDotsHover: false,
pauseOnFocus: false,
pauseOnHover: true,
prevArrow: null,
responsive: null,
rows: 1,
rtl: false,
slide: "div",
slidesPerRow: 1,
slidesToScroll: 1,
slidesToShow: 1,
speed: 500,
swipe: true,
swipeEvent: null,
swipeToSlide: false,
touchMove: true,
touchThreshold: 5,
useCSS: true,
useTransform: true,
variableWidth: false,
vertical: false,
waitForAnimate: true,
asNavFor: null
};
export default defaultProps;

88
node_modules/@ant-design/react-slick/es/dots.js generated vendored Normal file
View File

@@ -0,0 +1,88 @@
"use strict";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
import _isNativeReflectConstruct from "@babel/runtime/helpers/esm/isNativeReflectConstruct";
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/esm/inherits";
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
import React from "react";
import classnames from "classnames";
import { clamp } from "./utils/innerSliderUtils";
var getDotCount = function getDotCount(spec) {
var dots;
if (spec.infinite) {
dots = Math.ceil(spec.slideCount / spec.slidesToScroll);
} else {
dots = Math.ceil((spec.slideCount - spec.slidesToShow) / spec.slidesToScroll) + 1;
}
return dots;
};
export var Dots = /*#__PURE__*/function (_React$PureComponent) {
function Dots() {
_classCallCheck(this, Dots);
return _callSuper(this, Dots, arguments);
}
_inherits(Dots, _React$PureComponent);
return _createClass(Dots, [{
key: "clickHandler",
value: function clickHandler(options, e) {
// In Autoplay the focus stays on clicked button even after transition
// to next slide. That only goes away by click somewhere outside
e.preventDefault();
this.props.clickHandler(options);
}
}, {
key: "render",
value: function render() {
var _this$props = this.props,
onMouseEnter = _this$props.onMouseEnter,
onMouseOver = _this$props.onMouseOver,
onMouseLeave = _this$props.onMouseLeave,
infinite = _this$props.infinite,
slidesToScroll = _this$props.slidesToScroll,
slidesToShow = _this$props.slidesToShow,
slideCount = _this$props.slideCount,
currentSlide = _this$props.currentSlide;
var dotCount = getDotCount({
slideCount: slideCount,
slidesToScroll: slidesToScroll,
slidesToShow: slidesToShow,
infinite: infinite
});
var mouseEvents = {
onMouseEnter: onMouseEnter,
onMouseOver: onMouseOver,
onMouseLeave: onMouseLeave
};
var dots = [];
for (var i = 0; i < dotCount; i++) {
var _rightBound = (i + 1) * slidesToScroll - 1;
var rightBound = infinite ? _rightBound : clamp(_rightBound, 0, slideCount - 1);
var _leftBound = rightBound - (slidesToScroll - 1);
var leftBound = infinite ? _leftBound : clamp(_leftBound, 0, slideCount - 1);
var className = classnames({
"slick-active": infinite ? currentSlide >= leftBound && currentSlide <= rightBound : currentSlide === leftBound
});
var dotOptions = {
message: "dots",
index: i,
slidesToScroll: slidesToScroll,
currentSlide: currentSlide
};
var onClick = this.clickHandler.bind(this, dotOptions);
dots = dots.concat( /*#__PURE__*/React.createElement("li", {
key: i,
className: className
}, /*#__PURE__*/React.cloneElement(this.props.customPaging(i), {
onClick: onClick
})));
}
return /*#__PURE__*/React.cloneElement(this.props.appendDots(dots), _objectSpread({
className: this.props.dotsClass
}, mouseEvents));
}
}]);
}(React.PureComponent);

2
node_modules/@ant-design/react-slick/es/index.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import Slider from "./slider";
export default Slider;

View File

@@ -0,0 +1,32 @@
var initialState = {
animating: false,
autoplaying: null,
currentDirection: 0,
currentLeft: null,
currentSlide: 0,
direction: 1,
dragging: false,
edgeDragged: false,
initialized: false,
lazyLoadedList: [],
listHeight: null,
listWidth: null,
scrolling: false,
slideCount: null,
slideHeight: null,
slideWidth: null,
swipeLeft: null,
swiped: false,
// used by swipeEvent. differentites between touch and swipe.
swiping: false,
touchObject: {
startX: 0,
startY: 0,
curX: 0,
curY: 0
},
trackStyle: {},
trackWidth: 0,
targetSlide: 0
};
export default initialState;

687
node_modules/@ant-design/react-slick/es/inner-slider.js generated vendored Normal file
View File

@@ -0,0 +1,687 @@
"use strict";
import _typeof from "@babel/runtime/helpers/esm/typeof";
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
import _isNativeReflectConstruct from "@babel/runtime/helpers/esm/isNativeReflectConstruct";
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
var _excluded = ["animating"];
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
import React from "react";
import initialState from "./initial-state";
import { debounce } from "throttle-debounce";
import classnames from "classnames";
import { getOnDemandLazySlides, extractObject, initializedState, getHeight, canGoNext, slideHandler, changeSlide, keyHandler, swipeStart, swipeMove, swipeEnd, getPreClones, getPostClones, getTrackLeft, getTrackCSS } from "./utils/innerSliderUtils";
import { Track } from "./track";
import { Dots } from "./dots";
import { PrevArrow, NextArrow } from "./arrows";
import ResizeObserver from "resize-observer-polyfill";
export var InnerSlider = /*#__PURE__*/function (_React$Component) {
function InnerSlider(props) {
var _this;
_classCallCheck(this, InnerSlider);
_this = _callSuper(this, InnerSlider, [props]);
_defineProperty(_this, "listRefHandler", function (ref) {
return _this.list = ref;
});
_defineProperty(_this, "trackRefHandler", function (ref) {
return _this.track = ref;
});
_defineProperty(_this, "adaptHeight", function () {
if (_this.props.adaptiveHeight && _this.list) {
var elem = _this.list.querySelector("[data-index=\"".concat(_this.state.currentSlide, "\"]"));
_this.list.style.height = getHeight(elem) + "px";
}
});
_defineProperty(_this, "componentDidMount", function () {
_this.props.onInit && _this.props.onInit();
if (_this.props.lazyLoad) {
var slidesToLoad = getOnDemandLazySlides(_objectSpread(_objectSpread({}, _this.props), _this.state));
if (slidesToLoad.length > 0) {
_this.setState(function (prevState) {
return {
lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad)
};
});
if (_this.props.onLazyLoad) {
_this.props.onLazyLoad(slidesToLoad);
}
}
}
var spec = _objectSpread({
listRef: _this.list,
trackRef: _this.track
}, _this.props);
_this.updateState(spec, true, function () {
_this.adaptHeight();
_this.props.autoplay && _this.autoPlay("playing");
});
if (_this.props.lazyLoad === "progressive") {
_this.lazyLoadTimer = setInterval(_this.progressiveLazyLoad, 1000);
}
_this.ro = new ResizeObserver(function () {
if (_this.state.animating) {
_this.onWindowResized(false); // don't set trackStyle hence don't break animation
_this.callbackTimers.push(setTimeout(function () {
return _this.onWindowResized();
}, _this.props.speed));
} else {
_this.onWindowResized();
}
});
_this.ro.observe(_this.list);
document.querySelectorAll && Array.prototype.forEach.call(document.querySelectorAll(".slick-slide"), function (slide) {
slide.onfocus = _this.props.pauseOnFocus ? _this.onSlideFocus : null;
slide.onblur = _this.props.pauseOnFocus ? _this.onSlideBlur : null;
});
if (window.addEventListener) {
window.addEventListener("resize", _this.onWindowResized);
} else {
window.attachEvent("onresize", _this.onWindowResized);
}
});
_defineProperty(_this, "componentWillUnmount", function () {
if (_this.animationEndCallback) {
clearTimeout(_this.animationEndCallback);
}
if (_this.lazyLoadTimer) {
clearInterval(_this.lazyLoadTimer);
}
if (_this.callbackTimers.length) {
_this.callbackTimers.forEach(function (timer) {
return clearTimeout(timer);
});
_this.callbackTimers = [];
}
if (window.addEventListener) {
window.removeEventListener("resize", _this.onWindowResized);
} else {
window.detachEvent("onresize", _this.onWindowResized);
}
if (_this.autoplayTimer) {
clearInterval(_this.autoplayTimer);
}
_this.ro.disconnect();
});
_defineProperty(_this, "componentDidUpdate", function (prevProps) {
_this.checkImagesLoad();
_this.props.onReInit && _this.props.onReInit();
if (_this.props.lazyLoad) {
var slidesToLoad = getOnDemandLazySlides(_objectSpread(_objectSpread({}, _this.props), _this.state));
if (slidesToLoad.length > 0) {
_this.setState(function (prevState) {
return {
lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad)
};
});
if (_this.props.onLazyLoad) {
_this.props.onLazyLoad(slidesToLoad);
}
}
}
// if (this.props.onLazyLoad) {
// this.props.onLazyLoad([leftMostSlide])
// }
_this.adaptHeight();
var spec = _objectSpread(_objectSpread({
listRef: _this.list,
trackRef: _this.track
}, _this.props), _this.state);
var setTrackStyle = _this.didPropsChange(prevProps);
setTrackStyle && _this.updateState(spec, setTrackStyle, function () {
if (_this.state.currentSlide >= React.Children.count(_this.props.children)) {
_this.changeSlide({
message: "index",
index: React.Children.count(_this.props.children) - _this.props.slidesToShow,
currentSlide: _this.state.currentSlide
});
}
if (prevProps.autoplay !== _this.props.autoplay || prevProps.autoplaySpeed !== _this.props.autoplaySpeed) {
if (!prevProps.autoplay && _this.props.autoplay) {
_this.autoPlay("playing");
} else if (_this.props.autoplay) {
_this.autoPlay("update");
} else {
_this.pause("paused");
}
}
});
});
_defineProperty(_this, "onWindowResized", function (setTrackStyle) {
if (_this.debouncedResize) _this.debouncedResize.cancel();
_this.debouncedResize = debounce(50, function () {
return _this.resizeWindow(setTrackStyle);
});
_this.debouncedResize();
});
_defineProperty(_this, "resizeWindow", function () {
var setTrackStyle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
var isTrackMounted = Boolean(_this.track && _this.track.node);
// prevent warning: setting state on unmounted component (server side rendering)
if (!isTrackMounted) return;
var spec = _objectSpread(_objectSpread({
listRef: _this.list,
trackRef: _this.track
}, _this.props), _this.state);
_this.updateState(spec, setTrackStyle, function () {
if (_this.props.autoplay) _this.autoPlay("update");else _this.pause("paused");
});
// animating state should be cleared while resizing, otherwise autoplay stops working
_this.setState({
animating: false
});
clearTimeout(_this.animationEndCallback);
delete _this.animationEndCallback;
});
_defineProperty(_this, "updateState", function (spec, setTrackStyle, callback) {
var updatedState = initializedState(spec);
spec = _objectSpread(_objectSpread(_objectSpread({}, spec), updatedState), {}, {
slideIndex: updatedState.currentSlide
});
var targetLeft = getTrackLeft(spec);
spec = _objectSpread(_objectSpread({}, spec), {}, {
left: targetLeft
});
var trackStyle = getTrackCSS(spec);
if (setTrackStyle || React.Children.count(_this.props.children) !== React.Children.count(spec.children)) {
updatedState["trackStyle"] = trackStyle;
}
_this.setState(updatedState, callback);
});
_defineProperty(_this, "ssrInit", function () {
if (_this.props.variableWidth) {
var _trackWidth = 0,
_trackLeft = 0;
var childrenWidths = [];
var preClones = getPreClones(_objectSpread(_objectSpread(_objectSpread({}, _this.props), _this.state), {}, {
slideCount: _this.props.children.length
}));
var postClones = getPostClones(_objectSpread(_objectSpread(_objectSpread({}, _this.props), _this.state), {}, {
slideCount: _this.props.children.length
}));
_this.props.children.forEach(function (child) {
childrenWidths.push(child.props.style.width);
_trackWidth += child.props.style.width;
});
for (var i = 0; i < preClones; i++) {
_trackLeft += childrenWidths[childrenWidths.length - 1 - i];
_trackWidth += childrenWidths[childrenWidths.length - 1 - i];
}
for (var _i = 0; _i < postClones; _i++) {
_trackWidth += childrenWidths[_i];
}
for (var _i2 = 0; _i2 < _this.state.currentSlide; _i2++) {
_trackLeft += childrenWidths[_i2];
}
var _trackStyle = {
width: _trackWidth + "px",
left: -_trackLeft + "px"
};
if (_this.props.centerMode) {
var currentWidth = "".concat(childrenWidths[_this.state.currentSlide], "px");
_trackStyle.left = "calc(".concat(_trackStyle.left, " + (100% - ").concat(currentWidth, ") / 2 ) ");
}
return {
trackStyle: _trackStyle
};
}
var childrenCount = React.Children.count(_this.props.children);
var spec = _objectSpread(_objectSpread(_objectSpread({}, _this.props), _this.state), {}, {
slideCount: childrenCount
});
var slideCount = getPreClones(spec) + getPostClones(spec) + childrenCount;
var trackWidth = 100 / _this.props.slidesToShow * slideCount;
var slideWidth = 100 / slideCount;
var trackLeft = -slideWidth * (getPreClones(spec) + _this.state.currentSlide) * trackWidth / 100;
if (_this.props.centerMode) {
trackLeft += (100 - slideWidth * trackWidth / 100) / 2;
}
var trackStyle = {
width: trackWidth + "%",
left: trackLeft + "%"
};
return {
slideWidth: slideWidth + "%",
trackStyle: trackStyle
};
});
_defineProperty(_this, "checkImagesLoad", function () {
var images = _this.list && _this.list.querySelectorAll && _this.list.querySelectorAll(".slick-slide img") || [];
var imagesCount = images.length,
loadedCount = 0;
Array.prototype.forEach.call(images, function (image) {
var handler = function handler() {
return ++loadedCount && loadedCount >= imagesCount && _this.onWindowResized();
};
if (!image.onclick) {
image.onclick = function () {
return image.parentNode.focus();
};
} else {
var prevClickHandler = image.onclick;
image.onclick = function (e) {
prevClickHandler(e);
image.parentNode.focus();
};
}
if (!image.onload) {
if (_this.props.lazyLoad) {
image.onload = function () {
_this.adaptHeight();
_this.callbackTimers.push(setTimeout(_this.onWindowResized, _this.props.speed));
};
} else {
image.onload = handler;
image.onerror = function () {
handler();
_this.props.onLazyLoadError && _this.props.onLazyLoadError();
};
}
}
});
});
_defineProperty(_this, "progressiveLazyLoad", function () {
var slidesToLoad = [];
var spec = _objectSpread(_objectSpread({}, _this.props), _this.state);
for (var index = _this.state.currentSlide; index < _this.state.slideCount + getPostClones(spec); index++) {
if (_this.state.lazyLoadedList.indexOf(index) < 0) {
slidesToLoad.push(index);
break;
}
}
for (var _index = _this.state.currentSlide - 1; _index >= -getPreClones(spec); _index--) {
if (_this.state.lazyLoadedList.indexOf(_index) < 0) {
slidesToLoad.push(_index);
break;
}
}
if (slidesToLoad.length > 0) {
_this.setState(function (state) {
return {
lazyLoadedList: state.lazyLoadedList.concat(slidesToLoad)
};
});
if (_this.props.onLazyLoad) {
_this.props.onLazyLoad(slidesToLoad);
}
} else {
if (_this.lazyLoadTimer) {
clearInterval(_this.lazyLoadTimer);
delete _this.lazyLoadTimer;
}
}
});
_defineProperty(_this, "slideHandler", function (index) {
var dontAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var _this$props = _this.props,
asNavFor = _this$props.asNavFor,
beforeChange = _this$props.beforeChange,
onLazyLoad = _this$props.onLazyLoad,
speed = _this$props.speed,
afterChange = _this$props.afterChange;
// capture currentslide before state is updated
var currentSlide = _this.state.currentSlide;
var _slideHandler = slideHandler(_objectSpread(_objectSpread(_objectSpread({
index: index
}, _this.props), _this.state), {}, {
trackRef: _this.track,
useCSS: _this.props.useCSS && !dontAnimate
})),
state = _slideHandler.state,
nextState = _slideHandler.nextState;
if (!state) return;
beforeChange && beforeChange(currentSlide, state.currentSlide);
var slidesToLoad = state.lazyLoadedList.filter(function (value) {
return _this.state.lazyLoadedList.indexOf(value) < 0;
});
onLazyLoad && slidesToLoad.length > 0 && onLazyLoad(slidesToLoad);
if (!_this.props.waitForAnimate && _this.animationEndCallback) {
clearTimeout(_this.animationEndCallback);
afterChange && afterChange(currentSlide);
delete _this.animationEndCallback;
}
_this.setState(state, function () {
// asNavForIndex check is to avoid recursive calls of slideHandler in waitForAnimate=false mode
if (asNavFor && _this.asNavForIndex !== index) {
_this.asNavForIndex = index;
asNavFor.innerSlider.slideHandler(index);
}
if (!nextState) return;
_this.animationEndCallback = setTimeout(function () {
var animating = nextState.animating,
firstBatch = _objectWithoutProperties(nextState, _excluded);
_this.setState(firstBatch, function () {
_this.callbackTimers.push(setTimeout(function () {
return _this.setState({
animating: animating
});
}, 10));
afterChange && afterChange(state.currentSlide);
delete _this.animationEndCallback;
});
}, speed);
});
});
_defineProperty(_this, "changeSlide", function (options) {
var dontAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var spec = _objectSpread(_objectSpread({}, _this.props), _this.state);
var targetSlide = changeSlide(spec, options);
if (targetSlide !== 0 && !targetSlide) return;
if (dontAnimate === true) {
_this.slideHandler(targetSlide, dontAnimate);
} else {
_this.slideHandler(targetSlide);
}
_this.props.autoplay && _this.autoPlay("update");
if (_this.props.focusOnSelect) {
var nodes = _this.list.querySelectorAll(".slick-current");
nodes[0] && nodes[0].focus();
}
});
_defineProperty(_this, "clickHandler", function (e) {
if (_this.clickable === false) {
e.stopPropagation();
e.preventDefault();
}
_this.clickable = true;
});
_defineProperty(_this, "keyHandler", function (e) {
var dir = keyHandler(e, _this.props.accessibility, _this.props.rtl);
dir !== "" && _this.changeSlide({
message: dir
});
});
_defineProperty(_this, "selectHandler", function (options) {
_this.changeSlide(options);
});
_defineProperty(_this, "disableBodyScroll", function () {
var preventDefault = function preventDefault(e) {
e = e || window.event;
if (e.preventDefault) e.preventDefault();
e.returnValue = false;
};
window.ontouchmove = preventDefault;
});
_defineProperty(_this, "enableBodyScroll", function () {
window.ontouchmove = null;
});
_defineProperty(_this, "swipeStart", function (e) {
if (_this.props.verticalSwiping) {
_this.disableBodyScroll();
}
var state = swipeStart(e, _this.props.swipe, _this.props.draggable);
state !== "" && _this.setState(state);
});
_defineProperty(_this, "swipeMove", function (e) {
var state = swipeMove(e, _objectSpread(_objectSpread(_objectSpread({}, _this.props), _this.state), {}, {
trackRef: _this.track,
listRef: _this.list,
slideIndex: _this.state.currentSlide
}));
if (!state) return;
if (state["swiping"]) {
_this.clickable = false;
}
_this.setState(state);
});
_defineProperty(_this, "swipeEnd", function (e) {
var state = swipeEnd(e, _objectSpread(_objectSpread(_objectSpread({}, _this.props), _this.state), {}, {
trackRef: _this.track,
listRef: _this.list,
slideIndex: _this.state.currentSlide
}));
if (!state) return;
var triggerSlideHandler = state["triggerSlideHandler"];
delete state["triggerSlideHandler"];
_this.setState(state);
if (triggerSlideHandler === undefined) return;
_this.slideHandler(triggerSlideHandler);
if (_this.props.verticalSwiping) {
_this.enableBodyScroll();
}
});
_defineProperty(_this, "touchEnd", function (e) {
_this.swipeEnd(e);
_this.clickable = true;
});
_defineProperty(_this, "slickPrev", function () {
// this and fellow methods are wrapped in setTimeout
// to make sure initialize setState has happened before
// any of such methods are called
_this.callbackTimers.push(setTimeout(function () {
return _this.changeSlide({
message: "previous"
});
}, 0));
});
_defineProperty(_this, "slickNext", function () {
_this.callbackTimers.push(setTimeout(function () {
return _this.changeSlide({
message: "next"
});
}, 0));
});
_defineProperty(_this, "slickGoTo", function (slide) {
var dontAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
slide = Number(slide);
if (isNaN(slide)) return "";
_this.callbackTimers.push(setTimeout(function () {
return _this.changeSlide({
message: "index",
index: slide,
currentSlide: _this.state.currentSlide
}, dontAnimate);
}, 0));
});
_defineProperty(_this, "play", function () {
var nextIndex;
if (_this.props.rtl) {
nextIndex = _this.state.currentSlide - _this.props.slidesToScroll;
} else {
if (canGoNext(_objectSpread(_objectSpread({}, _this.props), _this.state))) {
nextIndex = _this.state.currentSlide + _this.props.slidesToScroll;
} else {
return false;
}
}
_this.slideHandler(nextIndex);
});
_defineProperty(_this, "autoPlay", function (playType) {
if (_this.autoplayTimer) {
clearInterval(_this.autoplayTimer);
}
var autoplaying = _this.state.autoplaying;
if (playType === "update") {
if (autoplaying === "hovered" || autoplaying === "focused" || autoplaying === "paused") {
return;
}
} else if (playType === "leave") {
if (autoplaying === "paused" || autoplaying === "focused") {
return;
}
} else if (playType === "blur") {
if (autoplaying === "paused" || autoplaying === "hovered") {
return;
}
}
_this.autoplayTimer = setInterval(_this.play, _this.props.autoplaySpeed + 50);
_this.setState({
autoplaying: "playing"
});
});
_defineProperty(_this, "pause", function (pauseType) {
if (_this.autoplayTimer) {
clearInterval(_this.autoplayTimer);
_this.autoplayTimer = null;
}
var autoplaying = _this.state.autoplaying;
if (pauseType === "paused") {
_this.setState({
autoplaying: "paused"
});
} else if (pauseType === "focused") {
if (autoplaying === "hovered" || autoplaying === "playing") {
_this.setState({
autoplaying: "focused"
});
}
} else {
// pauseType is 'hovered'
if (autoplaying === "playing") {
_this.setState({
autoplaying: "hovered"
});
}
}
});
_defineProperty(_this, "onDotsOver", function () {
return _this.props.autoplay && _this.pause("hovered");
});
_defineProperty(_this, "onDotsLeave", function () {
return _this.props.autoplay && _this.state.autoplaying === "hovered" && _this.autoPlay("leave");
});
_defineProperty(_this, "onTrackOver", function () {
return _this.props.autoplay && _this.pause("hovered");
});
_defineProperty(_this, "onTrackLeave", function () {
return _this.props.autoplay && _this.state.autoplaying === "hovered" && _this.autoPlay("leave");
});
_defineProperty(_this, "onSlideFocus", function () {
return _this.props.autoplay && _this.pause("focused");
});
_defineProperty(_this, "onSlideBlur", function () {
return _this.props.autoplay && _this.state.autoplaying === "focused" && _this.autoPlay("blur");
});
_defineProperty(_this, "render", function () {
var className = classnames("slick-slider", _this.props.className, {
"slick-vertical": _this.props.vertical,
"slick-initialized": true
});
var spec = _objectSpread(_objectSpread({}, _this.props), _this.state);
var trackProps = extractObject(spec, ["fade", "cssEase", "speed", "infinite", "centerMode", "focusOnSelect", "currentSlide", "lazyLoad", "lazyLoadedList", "rtl", "slideWidth", "slideHeight", "listHeight", "vertical", "slidesToShow", "slidesToScroll", "slideCount", "trackStyle", "variableWidth", "unslick", "centerPadding", "targetSlide", "useCSS"]);
var pauseOnHover = _this.props.pauseOnHover;
trackProps = _objectSpread(_objectSpread({}, trackProps), {}, {
onMouseEnter: pauseOnHover ? _this.onTrackOver : null,
onMouseLeave: pauseOnHover ? _this.onTrackLeave : null,
onMouseOver: pauseOnHover ? _this.onTrackOver : null,
focusOnSelect: _this.props.focusOnSelect && _this.clickable ? _this.selectHandler : null
});
var dots;
if (_this.props.dots === true && _this.state.slideCount >= _this.props.slidesToShow) {
var dotProps = extractObject(spec, ["dotsClass", "slideCount", "slidesToShow", "currentSlide", "slidesToScroll", "clickHandler", "children", "customPaging", "infinite", "appendDots"]);
var pauseOnDotsHover = _this.props.pauseOnDotsHover;
dotProps = _objectSpread(_objectSpread({}, dotProps), {}, {
clickHandler: _this.changeSlide,
onMouseEnter: pauseOnDotsHover ? _this.onDotsLeave : null,
onMouseOver: pauseOnDotsHover ? _this.onDotsOver : null,
onMouseLeave: pauseOnDotsHover ? _this.onDotsLeave : null
});
dots = /*#__PURE__*/React.createElement(Dots, dotProps);
}
var prevArrow, nextArrow;
var arrowProps = extractObject(spec, ["infinite", "centerMode", "currentSlide", "slideCount", "slidesToShow", "prevArrow", "nextArrow"]);
arrowProps.clickHandler = _this.changeSlide;
if (_this.props.arrows) {
prevArrow = /*#__PURE__*/React.createElement(PrevArrow, arrowProps);
nextArrow = /*#__PURE__*/React.createElement(NextArrow, arrowProps);
}
var verticalHeightStyle = null;
if (_this.props.vertical) {
verticalHeightStyle = {
height: _this.state.listHeight
};
}
var centerPaddingStyle = null;
if (_this.props.vertical === false) {
if (_this.props.centerMode === true) {
centerPaddingStyle = {
padding: "0px " + _this.props.centerPadding
};
}
} else {
if (_this.props.centerMode === true) {
centerPaddingStyle = {
padding: _this.props.centerPadding + " 0px"
};
}
}
var listStyle = _objectSpread(_objectSpread({}, verticalHeightStyle), centerPaddingStyle);
var touchMove = _this.props.touchMove;
var listProps = {
className: "slick-list",
style: listStyle,
onClick: _this.clickHandler,
onMouseDown: touchMove ? _this.swipeStart : null,
onMouseMove: _this.state.dragging && touchMove ? _this.swipeMove : null,
onMouseUp: touchMove ? _this.swipeEnd : null,
onMouseLeave: _this.state.dragging && touchMove ? _this.swipeEnd : null,
onTouchStart: touchMove ? _this.swipeStart : null,
onTouchMove: _this.state.dragging && touchMove ? _this.swipeMove : null,
onTouchEnd: touchMove ? _this.touchEnd : null,
onTouchCancel: _this.state.dragging && touchMove ? _this.swipeEnd : null,
onKeyDown: _this.props.accessibility ? _this.keyHandler : null
};
var innerSliderProps = {
className: className,
dir: "ltr",
style: _this.props.style
};
if (_this.props.unslick) {
listProps = {
className: "slick-list"
};
innerSliderProps = {
className: className,
style: _this.props.style
};
}
return /*#__PURE__*/React.createElement("div", innerSliderProps, !_this.props.unslick ? prevArrow : "", /*#__PURE__*/React.createElement("div", _extends({
ref: _this.listRefHandler
}, listProps), /*#__PURE__*/React.createElement(Track, _extends({
ref: _this.trackRefHandler
}, trackProps), _this.props.children)), !_this.props.unslick ? nextArrow : "", !_this.props.unslick ? dots : "");
});
_this.list = null;
_this.track = null;
_this.state = _objectSpread(_objectSpread({}, initialState), {}, {
currentSlide: _this.props.initialSlide,
targetSlide: _this.props.initialSlide ? _this.props.initialSlide : 0,
slideCount: React.Children.count(_this.props.children)
});
_this.callbackTimers = [];
_this.clickable = true;
_this.debouncedResize = null;
var ssrState = _this.ssrInit();
_this.state = _objectSpread(_objectSpread({}, _this.state), ssrState);
return _this;
}
_inherits(InnerSlider, _React$Component);
return _createClass(InnerSlider, [{
key: "didPropsChange",
value: function didPropsChange(prevProps) {
var setTrackStyle = false;
for (var _i3 = 0, _Object$keys = Object.keys(this.props); _i3 < _Object$keys.length; _i3++) {
var key = _Object$keys[_i3];
// eslint-disable-next-line no-prototype-builtins
if (!prevProps.hasOwnProperty(key)) {
setTrackStyle = true;
break;
}
if (_typeof(prevProps[key]) === "object" || typeof prevProps[key] === "function" || isNaN(prevProps[key])) {
continue;
}
if (prevProps[key] !== this.props[key]) {
setTrackStyle = true;
break;
}
}
return setTrackStyle || React.Children.count(this.props.children) !== React.Children.count(prevProps.children);
}
}]);
}(React.Component);

231
node_modules/@ant-design/react-slick/es/slider.js generated vendored Normal file
View File

@@ -0,0 +1,231 @@
"use strict";
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
import _isNativeReflectConstruct from "@babel/runtime/helpers/esm/isNativeReflectConstruct";
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
import React from "react";
import { InnerSlider } from "./inner-slider";
import json2mq from "json2mq";
import defaultProps from "./default-props";
import { canUseDOM, filterSettings } from "./utils/innerSliderUtils";
var Slider = /*#__PURE__*/function (_React$Component) {
function Slider(props) {
var _this;
_classCallCheck(this, Slider);
_this = _callSuper(this, Slider, [props]);
_defineProperty(_this, "innerSliderRefHandler", function (ref) {
return _this.innerSlider = ref;
});
_defineProperty(_this, "slickPrev", function () {
return _this.innerSlider.slickPrev();
});
_defineProperty(_this, "slickNext", function () {
return _this.innerSlider.slickNext();
});
_defineProperty(_this, "slickGoTo", function (slide) {
var dontAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
return _this.innerSlider.slickGoTo(slide, dontAnimate);
});
_defineProperty(_this, "slickPause", function () {
return _this.innerSlider.pause("paused");
});
_defineProperty(_this, "slickPlay", function () {
return _this.innerSlider.autoPlay("play");
});
_this.state = {
breakpoint: null
};
_this._responsiveMediaHandlers = [];
return _this;
}
_inherits(Slider, _React$Component);
return _createClass(Slider, [{
key: "media",
value: function media(query, handler) {
// javascript handler for css media query
var mql = window.matchMedia(query);
var listener = function listener(_ref) {
var matches = _ref.matches;
if (matches) {
handler();
}
};
mql.addListener(listener);
listener(mql);
this._responsiveMediaHandlers.push({
mql: mql,
query: query,
listener: listener
});
}
// handles responsive breakpoints
}, {
key: "componentDidMount",
value: function componentDidMount() {
var _this2 = this;
// performance monitoring
//if (process.env.NODE_ENV !== 'production') {
//const { whyDidYouUpdate } = require('why-did-you-update')
//whyDidYouUpdate(React)
//}
if (this.props.responsive) {
var breakpoints = this.props.responsive.map(function (breakpt) {
return breakpt.breakpoint;
});
// sort them in increasing order of their numerical value
breakpoints.sort(function (x, y) {
return x - y;
});
breakpoints.forEach(function (breakpoint, index) {
// media query for each breakpoint
var bQuery;
if (index === 0) {
bQuery = json2mq({
minWidth: 0,
maxWidth: breakpoint
});
} else {
bQuery = json2mq({
minWidth: breakpoints[index - 1] + 1,
maxWidth: breakpoint
});
}
// when not using server side rendering
canUseDOM() && _this2.media(bQuery, function () {
_this2.setState({
breakpoint: breakpoint
});
});
});
// Register media query for full screen. Need to support resize from small to large
// convert javascript object to media query string
var query = json2mq({
minWidth: breakpoints.slice(-1)[0]
});
canUseDOM() && this.media(query, function () {
_this2.setState({
breakpoint: null
});
});
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this._responsiveMediaHandlers.forEach(function (obj) {
obj.mql.removeListener(obj.listener);
});
}
}, {
key: "render",
value: function render() {
var _this3 = this;
var settings;
var newProps;
if (this.state.breakpoint) {
newProps = this.props.responsive.filter(function (resp) {
return resp.breakpoint === _this3.state.breakpoint;
});
settings = newProps[0].settings === "unslick" ? "unslick" : _objectSpread(_objectSpread(_objectSpread({}, defaultProps), this.props), newProps[0].settings);
} else {
settings = _objectSpread(_objectSpread({}, defaultProps), this.props);
}
// force scrolling by one if centerMode is on
if (settings.centerMode) {
if (settings.slidesToScroll > 1 && process.env.NODE_ENV !== "production") {
console.warn("slidesToScroll should be equal to 1 in centerMode, you are using ".concat(settings.slidesToScroll));
}
settings.slidesToScroll = 1;
}
// force showing one slide and scrolling by one if the fade mode is on
if (settings.fade) {
if (settings.slidesToShow > 1 && process.env.NODE_ENV !== "production") {
console.warn("slidesToShow should be equal to 1 when fade is true, you're using ".concat(settings.slidesToShow));
}
if (settings.slidesToScroll > 1 && process.env.NODE_ENV !== "production") {
console.warn("slidesToScroll should be equal to 1 when fade is true, you're using ".concat(settings.slidesToScroll));
}
settings.slidesToShow = 1;
settings.slidesToScroll = 1;
}
// makes sure that children is an array, even when there is only 1 child
var children = React.Children.toArray(this.props.children);
// Children may contain false or null, so we should filter them
// children may also contain string filled with spaces (in certain cases where we use jsx strings)
children = children.filter(function (child) {
if (typeof child === "string") {
return !!child.trim();
}
return !!child;
});
// rows and slidesPerRow logic is handled here
if (settings.variableWidth && (settings.rows > 1 || settings.slidesPerRow > 1)) {
console.warn("variableWidth is not supported in case of rows > 1 or slidesPerRow > 1");
settings.variableWidth = false;
}
var newChildren = [];
var currentWidth = null;
for (var i = 0; i < children.length; i += settings.rows * settings.slidesPerRow) {
var newSlide = [];
for (var j = i; j < i + settings.rows * settings.slidesPerRow; j += settings.slidesPerRow) {
var row = [];
for (var k = j; k < j + settings.slidesPerRow; k += 1) {
if (settings.variableWidth && children[k].props.style) {
currentWidth = children[k].props.style.width;
}
if (k >= children.length) break;
row.push( /*#__PURE__*/React.cloneElement(children[k], {
key: 100 * i + 10 * j + k,
tabIndex: -1,
style: {
width: "".concat(100 / settings.slidesPerRow, "%"),
display: "inline-block"
}
}));
}
newSlide.push( /*#__PURE__*/React.createElement("div", {
key: 10 * i + j
}, row));
}
if (settings.variableWidth) {
newChildren.push( /*#__PURE__*/React.createElement("div", {
key: i,
style: {
width: currentWidth
}
}, newSlide));
} else {
newChildren.push( /*#__PURE__*/React.createElement("div", {
key: i
}, newSlide));
}
}
if (settings === "unslick") {
var className = "regular slider " + (this.props.className || "");
return /*#__PURE__*/React.createElement("div", {
className: className
}, children);
} else if (newChildren.length <= settings.slidesToShow && !settings.infinite) {
settings.unslick = true;
}
return /*#__PURE__*/React.createElement(InnerSlider, _extends({
style: this.props.style,
ref: this.innerSliderRefHandler
}, filterSettings(settings)), newChildren);
}
}]);
}(React.Component);
export { Slider as default };

214
node_modules/@ant-design/react-slick/es/track.js generated vendored Normal file
View File

@@ -0,0 +1,214 @@
"use strict";
import _extends from "@babel/runtime/helpers/esm/extends";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
import _isNativeReflectConstruct from "@babel/runtime/helpers/esm/isNativeReflectConstruct";
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
import React from "react";
import classnames from "classnames";
import { lazyStartIndex, lazyEndIndex, getPreClones } from "./utils/innerSliderUtils";
// given specifications/props for a slide, fetch all the classes that need to be applied to the slide
var getSlideClasses = function getSlideClasses(spec) {
var slickActive, slickCenter, slickCloned;
var centerOffset, index;
if (spec.rtl) {
index = spec.slideCount - 1 - spec.index;
} else {
index = spec.index;
}
slickCloned = index < 0 || index >= spec.slideCount;
if (spec.centerMode) {
centerOffset = Math.floor(spec.slidesToShow / 2);
slickCenter = (index - spec.currentSlide) % spec.slideCount === 0;
if (index > spec.currentSlide - centerOffset - 1 && index <= spec.currentSlide + centerOffset) {
slickActive = true;
}
} else {
slickActive = spec.currentSlide <= index && index < spec.currentSlide + spec.slidesToShow;
}
var focusedSlide;
if (spec.targetSlide < 0) {
focusedSlide = spec.targetSlide + spec.slideCount;
} else if (spec.targetSlide >= spec.slideCount) {
focusedSlide = spec.targetSlide - spec.slideCount;
} else {
focusedSlide = spec.targetSlide;
}
var slickCurrent = index === focusedSlide;
return {
"slick-slide": true,
"slick-active": slickActive,
"slick-center": slickCenter,
"slick-cloned": slickCloned,
"slick-current": slickCurrent // dubious in case of RTL
};
};
var getSlideStyle = function getSlideStyle(spec) {
var style = {};
if (spec.variableWidth === undefined || spec.variableWidth === false) {
style.width = spec.slideWidth;
}
if (spec.fade) {
style.position = "relative";
if (spec.vertical && spec.slideHeight) {
style.top = -spec.index * parseInt(spec.slideHeight);
} else {
style.left = -spec.index * parseInt(spec.slideWidth);
}
style.opacity = spec.currentSlide === spec.index ? 1 : 0;
style.zIndex = spec.currentSlide === spec.index ? 999 : 998;
if (spec.useCSS) {
style.transition = "opacity " + spec.speed + "ms " + spec.cssEase + ", " + "visibility " + spec.speed + "ms " + spec.cssEase;
}
}
return style;
};
var getKey = function getKey(child, fallbackKey) {
return child.key + "-" + fallbackKey;
};
var renderSlides = function renderSlides(spec) {
var key;
var slides = [];
var preCloneSlides = [];
var postCloneSlides = [];
var childrenCount = React.Children.count(spec.children);
var startIndex = lazyStartIndex(spec);
var endIndex = lazyEndIndex(spec);
React.Children.forEach(spec.children, function (elem, index) {
var child;
var childOnClickOptions = {
message: "children",
index: index,
slidesToScroll: spec.slidesToScroll,
currentSlide: spec.currentSlide
};
// in case of lazyLoad, whether or not we want to fetch the slide
if (!spec.lazyLoad || spec.lazyLoad && spec.lazyLoadedList.indexOf(index) >= 0) {
child = elem;
} else {
child = /*#__PURE__*/React.createElement("div", null);
}
var childStyle = getSlideStyle(_objectSpread(_objectSpread({}, spec), {}, {
index: index
}));
var slideClass = child.props.className || "";
var slideClasses = getSlideClasses(_objectSpread(_objectSpread({}, spec), {}, {
index: index
}));
// push a cloned element of the desired slide
slides.push( /*#__PURE__*/React.cloneElement(child, {
key: "original" + getKey(child, index),
"data-index": index,
className: classnames(slideClasses, slideClass),
tabIndex: "-1",
"aria-hidden": !slideClasses["slick-active"],
style: _objectSpread(_objectSpread({
outline: "none"
}, child.props.style || {}), childStyle),
onClick: function onClick(e) {
child.props && child.props.onClick && child.props.onClick(e);
if (spec.focusOnSelect) {
spec.focusOnSelect(childOnClickOptions);
}
}
}));
// if slide needs to be precloned or postcloned
if (spec.infinite && childrenCount > 1 && spec.fade === false && !spec.unslick) {
var preCloneNo = childrenCount - index;
if (preCloneNo <= getPreClones(spec)) {
key = -preCloneNo;
if (key >= startIndex) {
child = elem;
}
slideClasses = getSlideClasses(_objectSpread(_objectSpread({}, spec), {}, {
index: key
}));
preCloneSlides.push( /*#__PURE__*/React.cloneElement(child, {
key: "precloned" + getKey(child, key),
"data-index": key,
tabIndex: "-1",
className: classnames(slideClasses, slideClass),
"aria-hidden": !slideClasses["slick-active"],
style: _objectSpread(_objectSpread({}, child.props.style || {}), childStyle),
onClick: function onClick(e) {
child.props && child.props.onClick && child.props.onClick(e);
if (spec.focusOnSelect) {
spec.focusOnSelect(childOnClickOptions);
}
}
}));
}
key = childrenCount + index;
if (key < endIndex) {
child = elem;
}
slideClasses = getSlideClasses(_objectSpread(_objectSpread({}, spec), {}, {
index: key
}));
postCloneSlides.push( /*#__PURE__*/React.cloneElement(child, {
key: "postcloned" + getKey(child, key),
"data-index": key,
tabIndex: "-1",
className: classnames(slideClasses, slideClass),
"aria-hidden": !slideClasses["slick-active"],
style: _objectSpread(_objectSpread({}, child.props.style || {}), childStyle),
onClick: function onClick(e) {
child.props && child.props.onClick && child.props.onClick(e);
if (spec.focusOnSelect) {
spec.focusOnSelect(childOnClickOptions);
}
}
}));
}
});
if (spec.rtl) {
return preCloneSlides.concat(slides, postCloneSlides).reverse();
} else {
return preCloneSlides.concat(slides, postCloneSlides);
}
};
export var Track = /*#__PURE__*/function (_React$PureComponent) {
function Track() {
var _this;
_classCallCheck(this, Track);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _callSuper(this, Track, [].concat(args));
_defineProperty(_this, "node", null);
_defineProperty(_this, "handleRef", function (ref) {
_this.node = ref;
});
return _this;
}
_inherits(Track, _React$PureComponent);
return _createClass(Track, [{
key: "render",
value: function render() {
var slides = renderSlides(this.props);
var _this$props = this.props,
onMouseEnter = _this$props.onMouseEnter,
onMouseOver = _this$props.onMouseOver,
onMouseLeave = _this$props.onMouseLeave;
var mouseEvents = {
onMouseEnter: onMouseEnter,
onMouseOver: onMouseOver,
onMouseLeave: onMouseLeave
};
return /*#__PURE__*/React.createElement("div", _extends({
ref: this.handleRef,
className: "slick-track",
style: this.props.trackStyle
}, mouseEvents), slides);
}
}]);
}(React.PureComponent);

View File

@@ -0,0 +1,755 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import React from "react";
import defaultProps from "../default-props";
export function clamp(number, lowerBound, upperBound) {
return Math.max(lowerBound, Math.min(number, upperBound));
}
export var safePreventDefault = function safePreventDefault(event) {
var passiveEvents = ["onTouchStart", "onTouchMove", "onWheel"];
if (!passiveEvents.includes(event._reactName)) {
event.preventDefault();
}
};
export var getOnDemandLazySlides = function getOnDemandLazySlides(spec) {
var onDemandSlides = [];
var startIndex = lazyStartIndex(spec);
var endIndex = lazyEndIndex(spec);
for (var slideIndex = startIndex; slideIndex < endIndex; slideIndex++) {
if (spec.lazyLoadedList.indexOf(slideIndex) < 0) {
onDemandSlides.push(slideIndex);
}
}
return onDemandSlides;
};
// return list of slides that need to be present
export var getRequiredLazySlides = function getRequiredLazySlides(spec) {
var requiredSlides = [];
var startIndex = lazyStartIndex(spec);
var endIndex = lazyEndIndex(spec);
for (var slideIndex = startIndex; slideIndex < endIndex; slideIndex++) {
requiredSlides.push(slideIndex);
}
return requiredSlides;
};
// startIndex that needs to be present
export var lazyStartIndex = function lazyStartIndex(spec) {
return spec.currentSlide - lazySlidesOnLeft(spec);
};
export var lazyEndIndex = function lazyEndIndex(spec) {
return spec.currentSlide + lazySlidesOnRight(spec);
};
export var lazySlidesOnLeft = function lazySlidesOnLeft(spec) {
return spec.centerMode ? Math.floor(spec.slidesToShow / 2) + (parseInt(spec.centerPadding) > 0 ? 1 : 0) : 0;
};
export var lazySlidesOnRight = function lazySlidesOnRight(spec) {
return spec.centerMode ? Math.floor((spec.slidesToShow - 1) / 2) + 1 + (parseInt(spec.centerPadding) > 0 ? 1 : 0) : spec.slidesToShow;
};
// get width of an element
export var getWidth = function getWidth(elem) {
return elem && elem.offsetWidth || 0;
};
export var getHeight = function getHeight(elem) {
return elem && elem.offsetHeight || 0;
};
export var getSwipeDirection = function getSwipeDirection(touchObject) {
var verticalSwiping = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var xDist, yDist, r, swipeAngle;
xDist = touchObject.startX - touchObject.curX;
yDist = touchObject.startY - touchObject.curY;
r = Math.atan2(yDist, xDist);
swipeAngle = Math.round(r * 180 / Math.PI);
if (swipeAngle < 0) {
swipeAngle = 360 - Math.abs(swipeAngle);
}
if (swipeAngle <= 45 && swipeAngle >= 0 || swipeAngle <= 360 && swipeAngle >= 315) {
return "left";
}
if (swipeAngle >= 135 && swipeAngle <= 225) {
return "right";
}
if (verticalSwiping === true) {
if (swipeAngle >= 35 && swipeAngle <= 135) {
return "up";
} else {
return "down";
}
}
return "vertical";
};
// whether or not we can go next
export var canGoNext = function canGoNext(spec) {
var canGo = true;
if (!spec.infinite) {
if (spec.centerMode && spec.currentSlide >= spec.slideCount - 1) {
canGo = false;
} else if (spec.slideCount <= spec.slidesToShow || spec.currentSlide >= spec.slideCount - spec.slidesToShow) {
canGo = false;
}
}
return canGo;
};
// given an object and a list of keys, return new object with given keys
export var extractObject = function extractObject(spec, keys) {
var newObject = {};
keys.forEach(function (key) {
return newObject[key] = spec[key];
});
return newObject;
};
// get initialized state
export var initializedState = function initializedState(spec) {
// spec also contains listRef, trackRef
var slideCount = React.Children.count(spec.children);
var listNode = spec.listRef;
var listWidth = Math.ceil(getWidth(listNode));
var trackNode = spec.trackRef && spec.trackRef.node;
var trackWidth = Math.ceil(getWidth(trackNode));
var slideWidth;
if (!spec.vertical) {
var centerPaddingAdj = spec.centerMode && parseInt(spec.centerPadding) * 2;
if (typeof spec.centerPadding === "string" && spec.centerPadding.slice(-1) === "%") {
centerPaddingAdj *= listWidth / 100;
}
slideWidth = Math.ceil((listWidth - centerPaddingAdj) / spec.slidesToShow);
} else {
slideWidth = listWidth;
}
var slideHeight = listNode && getHeight(listNode.querySelector('[data-index="0"]'));
var listHeight = slideHeight * spec.slidesToShow;
var currentSlide = spec.currentSlide === undefined ? spec.initialSlide : spec.currentSlide;
if (spec.rtl && spec.currentSlide === undefined) {
currentSlide = slideCount - 1 - spec.initialSlide;
}
var lazyLoadedList = spec.lazyLoadedList || [];
var slidesToLoad = getOnDemandLazySlides(_objectSpread(_objectSpread({}, spec), {}, {
currentSlide: currentSlide,
lazyLoadedList: lazyLoadedList
}));
lazyLoadedList = lazyLoadedList.concat(slidesToLoad);
var state = {
slideCount: slideCount,
slideWidth: slideWidth,
listWidth: listWidth,
trackWidth: trackWidth,
currentSlide: currentSlide,
slideHeight: slideHeight,
listHeight: listHeight,
lazyLoadedList: lazyLoadedList
};
if (spec.autoplaying === null && spec.autoplay) {
state["autoplaying"] = "playing";
}
return state;
};
export var slideHandler = function slideHandler(spec) {
var waitForAnimate = spec.waitForAnimate,
animating = spec.animating,
fade = spec.fade,
infinite = spec.infinite,
index = spec.index,
slideCount = spec.slideCount,
lazyLoad = spec.lazyLoad,
currentSlide = spec.currentSlide,
centerMode = spec.centerMode,
slidesToScroll = spec.slidesToScroll,
slidesToShow = spec.slidesToShow,
useCSS = spec.useCSS;
var lazyLoadedList = spec.lazyLoadedList;
if (waitForAnimate && animating) return {};
var animationSlide = index,
finalSlide,
animationLeft,
finalLeft;
var state = {},
nextState = {};
var targetSlide = infinite ? index : clamp(index, 0, slideCount - 1);
if (fade) {
if (!infinite && (index < 0 || index >= slideCount)) return {};
if (index < 0) {
animationSlide = index + slideCount;
} else if (index >= slideCount) {
animationSlide = index - slideCount;
}
if (lazyLoad && lazyLoadedList.indexOf(animationSlide) < 0) {
lazyLoadedList = lazyLoadedList.concat(animationSlide);
}
state = {
animating: true,
currentSlide: animationSlide,
lazyLoadedList: lazyLoadedList,
targetSlide: animationSlide
};
nextState = {
animating: false,
targetSlide: animationSlide
};
} else {
finalSlide = animationSlide;
if (animationSlide < 0) {
finalSlide = animationSlide + slideCount;
if (!infinite) finalSlide = 0;else if (slideCount % slidesToScroll !== 0) finalSlide = slideCount - slideCount % slidesToScroll;
} else if (!canGoNext(spec) && animationSlide > currentSlide) {
animationSlide = finalSlide = currentSlide;
} else if (centerMode && animationSlide >= slideCount) {
animationSlide = infinite ? slideCount : slideCount - 1;
finalSlide = infinite ? 0 : slideCount - 1;
} else if (animationSlide >= slideCount) {
finalSlide = animationSlide - slideCount;
if (!infinite) finalSlide = slideCount - slidesToShow;else if (slideCount % slidesToScroll !== 0) finalSlide = 0;
}
if (!infinite && animationSlide + slidesToShow >= slideCount) {
finalSlide = slideCount - slidesToShow;
}
animationLeft = getTrackLeft(_objectSpread(_objectSpread({}, spec), {}, {
slideIndex: animationSlide
}));
finalLeft = getTrackLeft(_objectSpread(_objectSpread({}, spec), {}, {
slideIndex: finalSlide
}));
if (!infinite) {
if (animationLeft === finalLeft) animationSlide = finalSlide;
animationLeft = finalLeft;
}
if (lazyLoad) {
lazyLoadedList = lazyLoadedList.concat(getOnDemandLazySlides(_objectSpread(_objectSpread({}, spec), {}, {
currentSlide: animationSlide
})));
}
if (!useCSS) {
state = {
currentSlide: finalSlide,
trackStyle: getTrackCSS(_objectSpread(_objectSpread({}, spec), {}, {
left: finalLeft
})),
lazyLoadedList: lazyLoadedList,
targetSlide: targetSlide
};
} else {
state = {
animating: true,
currentSlide: finalSlide,
trackStyle: getTrackAnimateCSS(_objectSpread(_objectSpread({}, spec), {}, {
left: animationLeft
})),
lazyLoadedList: lazyLoadedList,
targetSlide: targetSlide
};
nextState = {
animating: false,
currentSlide: finalSlide,
trackStyle: getTrackCSS(_objectSpread(_objectSpread({}, spec), {}, {
left: finalLeft
})),
swipeLeft: null,
targetSlide: targetSlide
};
}
}
return {
state: state,
nextState: nextState
};
};
export var changeSlide = function changeSlide(spec, options) {
var indexOffset, previousInt, slideOffset, unevenOffset, targetSlide;
var slidesToScroll = spec.slidesToScroll,
slidesToShow = spec.slidesToShow,
slideCount = spec.slideCount,
currentSlide = spec.currentSlide,
previousTargetSlide = spec.targetSlide,
lazyLoad = spec.lazyLoad,
infinite = spec.infinite;
unevenOffset = slideCount % slidesToScroll !== 0;
indexOffset = unevenOffset ? 0 : (slideCount - currentSlide) % slidesToScroll;
if (options.message === "previous") {
slideOffset = indexOffset === 0 ? slidesToScroll : slidesToShow - indexOffset;
targetSlide = currentSlide - slideOffset;
if (lazyLoad && !infinite) {
previousInt = currentSlide - slideOffset;
targetSlide = previousInt === -1 ? slideCount - 1 : previousInt;
}
if (!infinite) {
targetSlide = previousTargetSlide - slidesToScroll;
}
} else if (options.message === "next") {
slideOffset = indexOffset === 0 ? slidesToScroll : indexOffset;
targetSlide = currentSlide + slideOffset;
if (lazyLoad && !infinite) {
targetSlide = (currentSlide + slidesToScroll) % slideCount + indexOffset;
}
if (!infinite) {
targetSlide = previousTargetSlide + slidesToScroll;
}
} else if (options.message === "dots") {
// Click on dots
targetSlide = options.index * options.slidesToScroll;
} else if (options.message === "children") {
// Click on the slides
targetSlide = options.index;
if (infinite) {
var direction = siblingDirection(_objectSpread(_objectSpread({}, spec), {}, {
targetSlide: targetSlide
}));
if (targetSlide > options.currentSlide && direction === "left") {
targetSlide = targetSlide - slideCount;
} else if (targetSlide < options.currentSlide && direction === "right") {
targetSlide = targetSlide + slideCount;
}
}
} else if (options.message === "index") {
targetSlide = Number(options.index);
}
return targetSlide;
};
export var keyHandler = function keyHandler(e, accessibility, rtl) {
if (e.target.tagName.match("TEXTAREA|INPUT|SELECT") || !accessibility) return "";
if (e.keyCode === 37) return rtl ? "next" : "previous";
if (e.keyCode === 39) return rtl ? "previous" : "next";
return "";
};
export var swipeStart = function swipeStart(e, swipe, draggable) {
e.target.tagName === "IMG" && safePreventDefault(e);
if (!swipe || !draggable && e.type.indexOf("mouse") !== -1) return "";
return {
dragging: true,
touchObject: {
startX: e.touches ? e.touches[0].pageX : e.clientX,
startY: e.touches ? e.touches[0].pageY : e.clientY,
curX: e.touches ? e.touches[0].pageX : e.clientX,
curY: e.touches ? e.touches[0].pageY : e.clientY
}
};
};
export var swipeMove = function swipeMove(e, spec) {
// spec also contains, trackRef and slideIndex
var scrolling = spec.scrolling,
animating = spec.animating,
vertical = spec.vertical,
swipeToSlide = spec.swipeToSlide,
verticalSwiping = spec.verticalSwiping,
rtl = spec.rtl,
currentSlide = spec.currentSlide,
edgeFriction = spec.edgeFriction,
edgeDragged = spec.edgeDragged,
onEdge = spec.onEdge,
swiped = spec.swiped,
swiping = spec.swiping,
slideCount = spec.slideCount,
slidesToScroll = spec.slidesToScroll,
infinite = spec.infinite,
touchObject = spec.touchObject,
swipeEvent = spec.swipeEvent,
listHeight = spec.listHeight,
listWidth = spec.listWidth;
if (scrolling) return;
if (animating) return safePreventDefault(e);
if (vertical && swipeToSlide && verticalSwiping) safePreventDefault(e);
var swipeLeft,
state = {};
var curLeft = getTrackLeft(spec);
touchObject.curX = e.touches ? e.touches[0].pageX : e.clientX;
touchObject.curY = e.touches ? e.touches[0].pageY : e.clientY;
touchObject.swipeLength = Math.round(Math.sqrt(Math.pow(touchObject.curX - touchObject.startX, 2)));
var verticalSwipeLength = Math.round(Math.sqrt(Math.pow(touchObject.curY - touchObject.startY, 2)));
if (!verticalSwiping && !swiping && verticalSwipeLength > 10) {
return {
scrolling: true
};
}
if (verticalSwiping) touchObject.swipeLength = verticalSwipeLength;
var positionOffset = (!rtl ? 1 : -1) * (touchObject.curX > touchObject.startX ? 1 : -1);
if (verticalSwiping) positionOffset = touchObject.curY > touchObject.startY ? 1 : -1;
var dotCount = Math.ceil(slideCount / slidesToScroll);
var swipeDirection = getSwipeDirection(spec.touchObject, verticalSwiping);
var touchSwipeLength = touchObject.swipeLength;
if (!infinite) {
if (currentSlide === 0 && (swipeDirection === "right" || swipeDirection === "down") || currentSlide + 1 >= dotCount && (swipeDirection === "left" || swipeDirection === "up") || !canGoNext(spec) && (swipeDirection === "left" || swipeDirection === "up")) {
touchSwipeLength = touchObject.swipeLength * edgeFriction;
if (edgeDragged === false && onEdge) {
onEdge(swipeDirection);
state["edgeDragged"] = true;
}
}
}
if (!swiped && swipeEvent) {
swipeEvent(swipeDirection);
state["swiped"] = true;
}
if (!vertical) {
if (!rtl) {
swipeLeft = curLeft + touchSwipeLength * positionOffset;
} else {
swipeLeft = curLeft - touchSwipeLength * positionOffset;
}
} else {
swipeLeft = curLeft + touchSwipeLength * (listHeight / listWidth) * positionOffset;
}
if (verticalSwiping) {
swipeLeft = curLeft + touchSwipeLength * positionOffset;
}
state = _objectSpread(_objectSpread({}, state), {}, {
touchObject: touchObject,
swipeLeft: swipeLeft,
trackStyle: getTrackCSS(_objectSpread(_objectSpread({}, spec), {}, {
left: swipeLeft
}))
});
if (Math.abs(touchObject.curX - touchObject.startX) < Math.abs(touchObject.curY - touchObject.startY) * 0.8) {
return state;
}
if (touchObject.swipeLength > 10) {
state["swiping"] = true;
safePreventDefault(e);
}
return state;
};
export var swipeEnd = function swipeEnd(e, spec) {
var dragging = spec.dragging,
swipe = spec.swipe,
touchObject = spec.touchObject,
listWidth = spec.listWidth,
touchThreshold = spec.touchThreshold,
verticalSwiping = spec.verticalSwiping,
listHeight = spec.listHeight,
swipeToSlide = spec.swipeToSlide,
scrolling = spec.scrolling,
onSwipe = spec.onSwipe,
targetSlide = spec.targetSlide,
currentSlide = spec.currentSlide,
infinite = spec.infinite;
if (!dragging) {
if (swipe) safePreventDefault(e);
return {};
}
var minSwipe = verticalSwiping ? listHeight / touchThreshold : listWidth / touchThreshold;
var swipeDirection = getSwipeDirection(touchObject, verticalSwiping);
// reset the state of touch related state variables.
var state = {
dragging: false,
edgeDragged: false,
scrolling: false,
swiping: false,
swiped: false,
swipeLeft: null,
touchObject: {}
};
if (scrolling) {
return state;
}
if (!touchObject.swipeLength) {
return state;
}
if (touchObject.swipeLength > minSwipe) {
safePreventDefault(e);
if (onSwipe) {
onSwipe(swipeDirection);
}
var slideCount, newSlide;
var activeSlide = infinite ? currentSlide : targetSlide;
switch (swipeDirection) {
case "left":
case "up":
newSlide = activeSlide + getSlideCount(spec);
slideCount = swipeToSlide ? checkNavigable(spec, newSlide) : newSlide;
state["currentDirection"] = 0;
break;
case "right":
case "down":
newSlide = activeSlide - getSlideCount(spec);
slideCount = swipeToSlide ? checkNavigable(spec, newSlide) : newSlide;
state["currentDirection"] = 1;
break;
default:
slideCount = activeSlide;
}
state["triggerSlideHandler"] = slideCount;
} else {
// Adjust the track back to it's original position.
var currentLeft = getTrackLeft(spec);
state["trackStyle"] = getTrackAnimateCSS(_objectSpread(_objectSpread({}, spec), {}, {
left: currentLeft
}));
}
return state;
};
export var getNavigableIndexes = function getNavigableIndexes(spec) {
var max = spec.infinite ? spec.slideCount * 2 : spec.slideCount;
var breakpoint = spec.infinite ? spec.slidesToShow * -1 : 0;
var counter = spec.infinite ? spec.slidesToShow * -1 : 0;
var indexes = [];
while (breakpoint < max) {
indexes.push(breakpoint);
breakpoint = counter + spec.slidesToScroll;
counter += Math.min(spec.slidesToScroll, spec.slidesToShow);
}
return indexes;
};
export var checkNavigable = function checkNavigable(spec, index) {
var navigables = getNavigableIndexes(spec);
var prevNavigable = 0;
if (index > navigables[navigables.length - 1]) {
index = navigables[navigables.length - 1];
} else {
for (var n in navigables) {
if (index < navigables[n]) {
index = prevNavigable;
break;
}
prevNavigable = navigables[n];
}
}
return index;
};
export var getSlideCount = function getSlideCount(spec) {
var centerOffset = spec.centerMode ? spec.slideWidth * Math.floor(spec.slidesToShow / 2) : 0;
if (spec.swipeToSlide) {
var swipedSlide;
var slickList = spec.listRef;
var slides = slickList.querySelectorAll && slickList.querySelectorAll(".slick-slide") || [];
Array.from(slides).every(function (slide) {
if (!spec.vertical) {
if (slide.offsetLeft - centerOffset + getWidth(slide) / 2 > spec.swipeLeft * -1) {
swipedSlide = slide;
return false;
}
} else {
if (slide.offsetTop + getHeight(slide) / 2 > spec.swipeLeft * -1) {
swipedSlide = slide;
return false;
}
}
return true;
});
if (!swipedSlide) {
return 0;
}
var currentIndex = spec.rtl === true ? spec.slideCount - spec.currentSlide : spec.currentSlide;
var slidesTraversed = Math.abs(swipedSlide.dataset.index - currentIndex) || 1;
return slidesTraversed;
} else {
return spec.slidesToScroll;
}
};
export var checkSpecKeys = function checkSpecKeys(spec, keysArray) {
return (
// eslint-disable-next-line no-prototype-builtins
keysArray.reduce(function (value, key) {
return value && spec.hasOwnProperty(key);
}, true) ? null : console.error("Keys Missing:", spec)
);
};
export var getTrackCSS = function getTrackCSS(spec) {
checkSpecKeys(spec, ["left", "variableWidth", "slideCount", "slidesToShow", "slideWidth"]);
var trackWidth, trackHeight;
if (!spec.vertical) {
trackWidth = getTotalSlides(spec) * spec.slideWidth;
} else {
var trackChildren = spec.unslick ? spec.slideCount : spec.slideCount + 2 * spec.slidesToShow;
trackHeight = trackChildren * spec.slideHeight;
}
var style = {
opacity: 1,
transition: "",
WebkitTransition: ""
};
if (spec.useTransform) {
var WebkitTransform = !spec.vertical ? "translate3d(" + spec.left + "px, 0px, 0px)" : "translate3d(0px, " + spec.left + "px, 0px)";
var transform = !spec.vertical ? "translate3d(" + spec.left + "px, 0px, 0px)" : "translate3d(0px, " + spec.left + "px, 0px)";
var msTransform = !spec.vertical ? "translateX(" + spec.left + "px)" : "translateY(" + spec.left + "px)";
style = _objectSpread(_objectSpread({}, style), {}, {
WebkitTransform: WebkitTransform,
transform: transform,
msTransform: msTransform
});
} else {
if (spec.vertical) {
style["top"] = spec.left;
} else {
style["left"] = spec.left;
}
}
if (spec.fade) style = {
opacity: 1
};
if (trackWidth) style.width = trackWidth;
if (trackHeight) style.height = trackHeight;
// Fallback for IE8
if (window && !window.addEventListener && window.attachEvent) {
if (!spec.vertical) {
style.marginLeft = spec.left + "px";
} else {
style.marginTop = spec.left + "px";
}
}
return style;
};
export var getTrackAnimateCSS = function getTrackAnimateCSS(spec) {
checkSpecKeys(spec, ["left", "variableWidth", "slideCount", "slidesToShow", "slideWidth", "speed", "cssEase"]);
var style = getTrackCSS(spec);
// useCSS is true by default so it can be undefined
if (spec.useTransform) {
style.WebkitTransition = "-webkit-transform " + spec.speed + "ms " + spec.cssEase;
style.transition = "transform " + spec.speed + "ms " + spec.cssEase;
} else {
if (spec.vertical) {
style.transition = "top " + spec.speed + "ms " + spec.cssEase;
} else {
style.transition = "left " + spec.speed + "ms " + spec.cssEase;
}
}
return style;
};
export var getTrackLeft = function getTrackLeft(spec) {
if (spec.unslick) {
return 0;
}
checkSpecKeys(spec, ["slideIndex", "trackRef", "infinite", "centerMode", "slideCount", "slidesToShow", "slidesToScroll", "slideWidth", "listWidth", "variableWidth", "slideHeight"]);
var slideIndex = spec.slideIndex,
trackRef = spec.trackRef,
infinite = spec.infinite,
centerMode = spec.centerMode,
slideCount = spec.slideCount,
slidesToShow = spec.slidesToShow,
slidesToScroll = spec.slidesToScroll,
slideWidth = spec.slideWidth,
listWidth = spec.listWidth,
variableWidth = spec.variableWidth,
slideHeight = spec.slideHeight,
fade = spec.fade,
vertical = spec.vertical;
var slideOffset = 0;
var targetLeft;
var targetSlide;
var verticalOffset = 0;
if (fade || spec.slideCount === 1) {
return 0;
}
var slidesToOffset = 0;
if (infinite) {
slidesToOffset = -getPreClones(spec); // bring active slide to the beginning of visual area
// if next scroll doesn't have enough children, just reach till the end of original slides instead of shifting slidesToScroll children
if (slideCount % slidesToScroll !== 0 && slideIndex + slidesToScroll > slideCount) {
slidesToOffset = -(slideIndex > slideCount ? slidesToShow - (slideIndex - slideCount) : slideCount % slidesToScroll);
}
// shift current slide to center of the frame
if (centerMode) {
slidesToOffset += parseInt(slidesToShow / 2);
}
} else {
if (slideCount % slidesToScroll !== 0 && slideIndex + slidesToScroll > slideCount) {
slidesToOffset = slidesToShow - slideCount % slidesToScroll;
}
if (centerMode) {
slidesToOffset = parseInt(slidesToShow / 2);
}
}
slideOffset = slidesToOffset * slideWidth;
verticalOffset = slidesToOffset * slideHeight;
if (!vertical) {
targetLeft = slideIndex * slideWidth * -1 + slideOffset;
} else {
targetLeft = slideIndex * slideHeight * -1 + verticalOffset;
}
if (variableWidth === true) {
var targetSlideIndex;
var trackElem = trackRef && trackRef.node;
targetSlideIndex = slideIndex + getPreClones(spec);
targetSlide = trackElem && trackElem.childNodes[targetSlideIndex];
targetLeft = targetSlide ? targetSlide.offsetLeft * -1 : 0;
if (centerMode === true) {
targetSlideIndex = infinite ? slideIndex + getPreClones(spec) : slideIndex;
targetSlide = trackElem && trackElem.children[targetSlideIndex];
targetLeft = 0;
for (var slide = 0; slide < targetSlideIndex; slide++) {
targetLeft -= trackElem && trackElem.children[slide] && trackElem.children[slide].offsetWidth;
}
targetLeft -= parseInt(spec.centerPadding);
targetLeft += targetSlide && (listWidth - targetSlide.offsetWidth) / 2;
}
}
return targetLeft;
};
export var getPreClones = function getPreClones(spec) {
if (spec.unslick || !spec.infinite) {
return 0;
}
if (spec.variableWidth) {
return spec.slideCount;
}
return spec.slidesToShow + (spec.centerMode ? 1 : 0);
};
export var getPostClones = function getPostClones(spec) {
if (spec.unslick || !spec.infinite) {
return 0;
}
return spec.slideCount;
};
export var getTotalSlides = function getTotalSlides(spec) {
return spec.slideCount === 1 ? 1 : getPreClones(spec) + spec.slideCount + getPostClones(spec);
};
export var siblingDirection = function siblingDirection(spec) {
if (spec.targetSlide > spec.currentSlide) {
if (spec.targetSlide > spec.currentSlide + slidesOnRight(spec)) {
return "left";
}
return "right";
} else {
if (spec.targetSlide < spec.currentSlide - slidesOnLeft(spec)) {
return "right";
}
return "left";
}
};
export var slidesOnRight = function slidesOnRight(_ref) {
var slidesToShow = _ref.slidesToShow,
centerMode = _ref.centerMode,
rtl = _ref.rtl,
centerPadding = _ref.centerPadding;
// returns no of slides on the right of active slide
if (centerMode) {
var right = (slidesToShow - 1) / 2 + 1;
if (parseInt(centerPadding) > 0) right += 1;
if (rtl && slidesToShow % 2 === 0) right += 1;
return right;
}
if (rtl) {
return 0;
}
return slidesToShow - 1;
};
export var slidesOnLeft = function slidesOnLeft(_ref2) {
var slidesToShow = _ref2.slidesToShow,
centerMode = _ref2.centerMode,
rtl = _ref2.rtl,
centerPadding = _ref2.centerPadding;
// returns no of slides on the left of active slide
if (centerMode) {
var left = (slidesToShow - 1) / 2 + 1;
if (parseInt(centerPadding) > 0) left += 1;
if (!rtl && slidesToShow % 2 === 0) left += 1;
return left;
}
if (rtl) {
return slidesToShow - 1;
}
return 0;
};
export var canUseDOM = function canUseDOM() {
return !!(typeof window !== "undefined" && window.document && window.document.createElement);
};
export var validSettings = Object.keys(defaultProps);
export function filterSettings(settings) {
return validSettings.reduce(function (acc, settingName) {
if (settings.hasOwnProperty(settingName)) {
acc[settingName] = settings[settingName];
}
return acc;
}, {});
}

127
node_modules/@ant-design/react-slick/lib/arrows.js generated vendored Normal file
View File

@@ -0,0 +1,127 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PrevArrow = exports.NextArrow = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _isNativeReflectConstruct2 = _interopRequireDefault(require("@babel/runtime/helpers/isNativeReflectConstruct"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _react = _interopRequireDefault(require("react"));
var _classnames = _interopRequireDefault(require("classnames"));
var _innerSliderUtils = require("./utils/innerSliderUtils");
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, (0, _isNativeReflectConstruct2["default"])() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
var PrevArrow = exports.PrevArrow = /*#__PURE__*/function (_React$PureComponent) {
function PrevArrow() {
(0, _classCallCheck2["default"])(this, PrevArrow);
return _callSuper(this, PrevArrow, arguments);
}
(0, _inherits2["default"])(PrevArrow, _React$PureComponent);
return (0, _createClass2["default"])(PrevArrow, [{
key: "clickHandler",
value: function clickHandler(options, e) {
if (e) {
e.preventDefault();
}
this.props.clickHandler(options, e);
}
}, {
key: "render",
value: function render() {
var prevClasses = {
"slick-arrow": true,
"slick-prev": true
};
var prevHandler = this.clickHandler.bind(this, {
message: "previous"
});
if (!this.props.infinite && (this.props.currentSlide === 0 || this.props.slideCount <= this.props.slidesToShow)) {
prevClasses["slick-disabled"] = true;
prevHandler = null;
}
var prevArrowProps = {
key: "0",
"data-role": "none",
className: (0, _classnames["default"])(prevClasses),
style: {
display: "block"
},
onClick: prevHandler
};
var customProps = {
currentSlide: this.props.currentSlide,
slideCount: this.props.slideCount
};
var prevArrow;
if (this.props.prevArrow) {
prevArrow = /*#__PURE__*/_react["default"].cloneElement(this.props.prevArrow, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, prevArrowProps), customProps));
} else {
prevArrow = /*#__PURE__*/_react["default"].createElement("button", (0, _extends2["default"])({
key: "0",
type: "button"
}, prevArrowProps), " ", "Previous");
}
return prevArrow;
}
}]);
}(_react["default"].PureComponent);
var NextArrow = exports.NextArrow = /*#__PURE__*/function (_React$PureComponent2) {
function NextArrow() {
(0, _classCallCheck2["default"])(this, NextArrow);
return _callSuper(this, NextArrow, arguments);
}
(0, _inherits2["default"])(NextArrow, _React$PureComponent2);
return (0, _createClass2["default"])(NextArrow, [{
key: "clickHandler",
value: function clickHandler(options, e) {
if (e) {
e.preventDefault();
}
this.props.clickHandler(options, e);
}
}, {
key: "render",
value: function render() {
var nextClasses = {
"slick-arrow": true,
"slick-next": true
};
var nextHandler = this.clickHandler.bind(this, {
message: "next"
});
if (!(0, _innerSliderUtils.canGoNext)(this.props)) {
nextClasses["slick-disabled"] = true;
nextHandler = null;
}
var nextArrowProps = {
key: "1",
"data-role": "none",
className: (0, _classnames["default"])(nextClasses),
style: {
display: "block"
},
onClick: nextHandler
};
var customProps = {
currentSlide: this.props.currentSlide,
slideCount: this.props.slideCount
};
var nextArrow;
if (this.props.nextArrow) {
nextArrow = /*#__PURE__*/_react["default"].cloneElement(this.props.nextArrow, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, nextArrowProps), customProps));
} else {
nextArrow = /*#__PURE__*/_react["default"].createElement("button", (0, _extends2["default"])({
key: "1",
type: "button"
}, nextArrowProps), " ", "Next");
}
return nextArrow;
}
}]);
}(_react["default"].PureComponent);

View File

@@ -0,0 +1,70 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var defaultProps = {
accessibility: true,
adaptiveHeight: false,
afterChange: null,
appendDots: function appendDots(dots) {
return /*#__PURE__*/_react["default"].createElement("ul", {
style: {
display: "block"
}
}, dots);
},
arrows: true,
autoplay: false,
autoplaySpeed: 3000,
beforeChange: null,
centerMode: false,
centerPadding: "50px",
className: "",
cssEase: "ease",
customPaging: function customPaging(i) {
return /*#__PURE__*/_react["default"].createElement("button", null, i + 1);
},
dots: false,
dotsClass: "slick-dots",
draggable: true,
easing: "linear",
edgeFriction: 0.35,
fade: false,
focusOnSelect: false,
infinite: true,
initialSlide: 0,
lazyLoad: null,
nextArrow: null,
onEdge: null,
onInit: null,
onLazyLoadError: null,
onReInit: null,
pauseOnDotsHover: false,
pauseOnFocus: false,
pauseOnHover: true,
prevArrow: null,
responsive: null,
rows: 1,
rtl: false,
slide: "div",
slidesPerRow: 1,
slidesToScroll: 1,
slidesToShow: 1,
speed: 500,
swipe: true,
swipeEvent: null,
swipeToSlide: false,
touchMove: true,
touchThreshold: 5,
useCSS: true,
useTransform: true,
variableWidth: false,
vertical: false,
waitForAnimate: true,
asNavFor: null
};
var _default = exports["default"] = defaultProps;

93
node_modules/@ant-design/react-slick/lib/dots.js generated vendored Normal file
View File

@@ -0,0 +1,93 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Dots = void 0;
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _isNativeReflectConstruct2 = _interopRequireDefault(require("@babel/runtime/helpers/isNativeReflectConstruct"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _react = _interopRequireDefault(require("react"));
var _classnames = _interopRequireDefault(require("classnames"));
var _innerSliderUtils = require("./utils/innerSliderUtils");
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, (0, _isNativeReflectConstruct2["default"])() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
var getDotCount = function getDotCount(spec) {
var dots;
if (spec.infinite) {
dots = Math.ceil(spec.slideCount / spec.slidesToScroll);
} else {
dots = Math.ceil((spec.slideCount - spec.slidesToShow) / spec.slidesToScroll) + 1;
}
return dots;
};
var Dots = exports.Dots = /*#__PURE__*/function (_React$PureComponent) {
function Dots() {
(0, _classCallCheck2["default"])(this, Dots);
return _callSuper(this, Dots, arguments);
}
(0, _inherits2["default"])(Dots, _React$PureComponent);
return (0, _createClass2["default"])(Dots, [{
key: "clickHandler",
value: function clickHandler(options, e) {
// In Autoplay the focus stays on clicked button even after transition
// to next slide. That only goes away by click somewhere outside
e.preventDefault();
this.props.clickHandler(options);
}
}, {
key: "render",
value: function render() {
var _this$props = this.props,
onMouseEnter = _this$props.onMouseEnter,
onMouseOver = _this$props.onMouseOver,
onMouseLeave = _this$props.onMouseLeave,
infinite = _this$props.infinite,
slidesToScroll = _this$props.slidesToScroll,
slidesToShow = _this$props.slidesToShow,
slideCount = _this$props.slideCount,
currentSlide = _this$props.currentSlide;
var dotCount = getDotCount({
slideCount: slideCount,
slidesToScroll: slidesToScroll,
slidesToShow: slidesToShow,
infinite: infinite
});
var mouseEvents = {
onMouseEnter: onMouseEnter,
onMouseOver: onMouseOver,
onMouseLeave: onMouseLeave
};
var dots = [];
for (var i = 0; i < dotCount; i++) {
var _rightBound = (i + 1) * slidesToScroll - 1;
var rightBound = infinite ? _rightBound : (0, _innerSliderUtils.clamp)(_rightBound, 0, slideCount - 1);
var _leftBound = rightBound - (slidesToScroll - 1);
var leftBound = infinite ? _leftBound : (0, _innerSliderUtils.clamp)(_leftBound, 0, slideCount - 1);
var className = (0, _classnames["default"])({
"slick-active": infinite ? currentSlide >= leftBound && currentSlide <= rightBound : currentSlide === leftBound
});
var dotOptions = {
message: "dots",
index: i,
slidesToScroll: slidesToScroll,
currentSlide: currentSlide
};
var onClick = this.clickHandler.bind(this, dotOptions);
dots = dots.concat( /*#__PURE__*/_react["default"].createElement("li", {
key: i,
className: className
}, /*#__PURE__*/_react["default"].cloneElement(this.props.customPaging(i), {
onClick: onClick
})));
}
return /*#__PURE__*/_react["default"].cloneElement(this.props.appendDots(dots), (0, _objectSpread2["default"])({
className: this.props.dotsClass
}, mouseEvents));
}
}]);
}(_react["default"].PureComponent);

9
node_modules/@ant-design/react-slick/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _slider = _interopRequireDefault(require("./slider"));
var _default = exports["default"] = _slider["default"];

View File

@@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var initialState = {
animating: false,
autoplaying: null,
currentDirection: 0,
currentLeft: null,
currentSlide: 0,
direction: 1,
dragging: false,
edgeDragged: false,
initialized: false,
lazyLoadedList: [],
listHeight: null,
listWidth: null,
scrolling: false,
slideCount: null,
slideHeight: null,
slideWidth: null,
swipeLeft: null,
swiped: false,
// used by swipeEvent. differentites between touch and swipe.
swiping: false,
touchObject: {
startX: 0,
startY: 0,
curX: 0,
curY: 0
},
trackStyle: {},
trackWidth: 0,
targetSlide: 0
};
var _default = exports["default"] = initialState;

View File

@@ -0,0 +1,692 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.InnerSlider = void 0;
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _isNativeReflectConstruct2 = _interopRequireDefault(require("@babel/runtime/helpers/isNativeReflectConstruct"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _react = _interopRequireDefault(require("react"));
var _initialState = _interopRequireDefault(require("./initial-state"));
var _throttleDebounce = require("throttle-debounce");
var _classnames = _interopRequireDefault(require("classnames"));
var _innerSliderUtils = require("./utils/innerSliderUtils");
var _track = require("./track");
var _dots = require("./dots");
var _arrows = require("./arrows");
var _resizeObserverPolyfill = _interopRequireDefault(require("resize-observer-polyfill"));
var _excluded = ["animating"];
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, (0, _isNativeReflectConstruct2["default"])() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
var InnerSlider = exports.InnerSlider = /*#__PURE__*/function (_React$Component) {
function InnerSlider(props) {
var _this;
(0, _classCallCheck2["default"])(this, InnerSlider);
_this = _callSuper(this, InnerSlider, [props]);
(0, _defineProperty2["default"])(_this, "listRefHandler", function (ref) {
return _this.list = ref;
});
(0, _defineProperty2["default"])(_this, "trackRefHandler", function (ref) {
return _this.track = ref;
});
(0, _defineProperty2["default"])(_this, "adaptHeight", function () {
if (_this.props.adaptiveHeight && _this.list) {
var elem = _this.list.querySelector("[data-index=\"".concat(_this.state.currentSlide, "\"]"));
_this.list.style.height = (0, _innerSliderUtils.getHeight)(elem) + "px";
}
});
(0, _defineProperty2["default"])(_this, "componentDidMount", function () {
_this.props.onInit && _this.props.onInit();
if (_this.props.lazyLoad) {
var slidesToLoad = (0, _innerSliderUtils.getOnDemandLazySlides)((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _this.props), _this.state));
if (slidesToLoad.length > 0) {
_this.setState(function (prevState) {
return {
lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad)
};
});
if (_this.props.onLazyLoad) {
_this.props.onLazyLoad(slidesToLoad);
}
}
}
var spec = (0, _objectSpread2["default"])({
listRef: _this.list,
trackRef: _this.track
}, _this.props);
_this.updateState(spec, true, function () {
_this.adaptHeight();
_this.props.autoplay && _this.autoPlay("playing");
});
if (_this.props.lazyLoad === "progressive") {
_this.lazyLoadTimer = setInterval(_this.progressiveLazyLoad, 1000);
}
_this.ro = new _resizeObserverPolyfill["default"](function () {
if (_this.state.animating) {
_this.onWindowResized(false); // don't set trackStyle hence don't break animation
_this.callbackTimers.push(setTimeout(function () {
return _this.onWindowResized();
}, _this.props.speed));
} else {
_this.onWindowResized();
}
});
_this.ro.observe(_this.list);
document.querySelectorAll && Array.prototype.forEach.call(document.querySelectorAll(".slick-slide"), function (slide) {
slide.onfocus = _this.props.pauseOnFocus ? _this.onSlideFocus : null;
slide.onblur = _this.props.pauseOnFocus ? _this.onSlideBlur : null;
});
if (window.addEventListener) {
window.addEventListener("resize", _this.onWindowResized);
} else {
window.attachEvent("onresize", _this.onWindowResized);
}
});
(0, _defineProperty2["default"])(_this, "componentWillUnmount", function () {
if (_this.animationEndCallback) {
clearTimeout(_this.animationEndCallback);
}
if (_this.lazyLoadTimer) {
clearInterval(_this.lazyLoadTimer);
}
if (_this.callbackTimers.length) {
_this.callbackTimers.forEach(function (timer) {
return clearTimeout(timer);
});
_this.callbackTimers = [];
}
if (window.addEventListener) {
window.removeEventListener("resize", _this.onWindowResized);
} else {
window.detachEvent("onresize", _this.onWindowResized);
}
if (_this.autoplayTimer) {
clearInterval(_this.autoplayTimer);
}
_this.ro.disconnect();
});
(0, _defineProperty2["default"])(_this, "componentDidUpdate", function (prevProps) {
_this.checkImagesLoad();
_this.props.onReInit && _this.props.onReInit();
if (_this.props.lazyLoad) {
var slidesToLoad = (0, _innerSliderUtils.getOnDemandLazySlides)((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _this.props), _this.state));
if (slidesToLoad.length > 0) {
_this.setState(function (prevState) {
return {
lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad)
};
});
if (_this.props.onLazyLoad) {
_this.props.onLazyLoad(slidesToLoad);
}
}
}
// if (this.props.onLazyLoad) {
// this.props.onLazyLoad([leftMostSlide])
// }
_this.adaptHeight();
var spec = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
listRef: _this.list,
trackRef: _this.track
}, _this.props), _this.state);
var setTrackStyle = _this.didPropsChange(prevProps);
setTrackStyle && _this.updateState(spec, setTrackStyle, function () {
if (_this.state.currentSlide >= _react["default"].Children.count(_this.props.children)) {
_this.changeSlide({
message: "index",
index: _react["default"].Children.count(_this.props.children) - _this.props.slidesToShow,
currentSlide: _this.state.currentSlide
});
}
if (prevProps.autoplay !== _this.props.autoplay || prevProps.autoplaySpeed !== _this.props.autoplaySpeed) {
if (!prevProps.autoplay && _this.props.autoplay) {
_this.autoPlay("playing");
} else if (_this.props.autoplay) {
_this.autoPlay("update");
} else {
_this.pause("paused");
}
}
});
});
(0, _defineProperty2["default"])(_this, "onWindowResized", function (setTrackStyle) {
if (_this.debouncedResize) _this.debouncedResize.cancel();
_this.debouncedResize = (0, _throttleDebounce.debounce)(50, function () {
return _this.resizeWindow(setTrackStyle);
});
_this.debouncedResize();
});
(0, _defineProperty2["default"])(_this, "resizeWindow", function () {
var setTrackStyle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
var isTrackMounted = Boolean(_this.track && _this.track.node);
// prevent warning: setting state on unmounted component (server side rendering)
if (!isTrackMounted) return;
var spec = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
listRef: _this.list,
trackRef: _this.track
}, _this.props), _this.state);
_this.updateState(spec, setTrackStyle, function () {
if (_this.props.autoplay) _this.autoPlay("update");else _this.pause("paused");
});
// animating state should be cleared while resizing, otherwise autoplay stops working
_this.setState({
animating: false
});
clearTimeout(_this.animationEndCallback);
delete _this.animationEndCallback;
});
(0, _defineProperty2["default"])(_this, "updateState", function (spec, setTrackStyle, callback) {
var updatedState = (0, _innerSliderUtils.initializedState)(spec);
spec = (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, spec), updatedState), {}, {
slideIndex: updatedState.currentSlide
});
var targetLeft = (0, _innerSliderUtils.getTrackLeft)(spec);
spec = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, spec), {}, {
left: targetLeft
});
var trackStyle = (0, _innerSliderUtils.getTrackCSS)(spec);
if (setTrackStyle || _react["default"].Children.count(_this.props.children) !== _react["default"].Children.count(spec.children)) {
updatedState["trackStyle"] = trackStyle;
}
_this.setState(updatedState, callback);
});
(0, _defineProperty2["default"])(_this, "ssrInit", function () {
if (_this.props.variableWidth) {
var _trackWidth = 0,
_trackLeft = 0;
var childrenWidths = [];
var preClones = (0, _innerSliderUtils.getPreClones)((0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _this.props), _this.state), {}, {
slideCount: _this.props.children.length
}));
var postClones = (0, _innerSliderUtils.getPostClones)((0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _this.props), _this.state), {}, {
slideCount: _this.props.children.length
}));
_this.props.children.forEach(function (child) {
childrenWidths.push(child.props.style.width);
_trackWidth += child.props.style.width;
});
for (var i = 0; i < preClones; i++) {
_trackLeft += childrenWidths[childrenWidths.length - 1 - i];
_trackWidth += childrenWidths[childrenWidths.length - 1 - i];
}
for (var _i = 0; _i < postClones; _i++) {
_trackWidth += childrenWidths[_i];
}
for (var _i2 = 0; _i2 < _this.state.currentSlide; _i2++) {
_trackLeft += childrenWidths[_i2];
}
var _trackStyle = {
width: _trackWidth + "px",
left: -_trackLeft + "px"
};
if (_this.props.centerMode) {
var currentWidth = "".concat(childrenWidths[_this.state.currentSlide], "px");
_trackStyle.left = "calc(".concat(_trackStyle.left, " + (100% - ").concat(currentWidth, ") / 2 ) ");
}
return {
trackStyle: _trackStyle
};
}
var childrenCount = _react["default"].Children.count(_this.props.children);
var spec = (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _this.props), _this.state), {}, {
slideCount: childrenCount
});
var slideCount = (0, _innerSliderUtils.getPreClones)(spec) + (0, _innerSliderUtils.getPostClones)(spec) + childrenCount;
var trackWidth = 100 / _this.props.slidesToShow * slideCount;
var slideWidth = 100 / slideCount;
var trackLeft = -slideWidth * ((0, _innerSliderUtils.getPreClones)(spec) + _this.state.currentSlide) * trackWidth / 100;
if (_this.props.centerMode) {
trackLeft += (100 - slideWidth * trackWidth / 100) / 2;
}
var trackStyle = {
width: trackWidth + "%",
left: trackLeft + "%"
};
return {
slideWidth: slideWidth + "%",
trackStyle: trackStyle
};
});
(0, _defineProperty2["default"])(_this, "checkImagesLoad", function () {
var images = _this.list && _this.list.querySelectorAll && _this.list.querySelectorAll(".slick-slide img") || [];
var imagesCount = images.length,
loadedCount = 0;
Array.prototype.forEach.call(images, function (image) {
var handler = function handler() {
return ++loadedCount && loadedCount >= imagesCount && _this.onWindowResized();
};
if (!image.onclick) {
image.onclick = function () {
return image.parentNode.focus();
};
} else {
var prevClickHandler = image.onclick;
image.onclick = function (e) {
prevClickHandler(e);
image.parentNode.focus();
};
}
if (!image.onload) {
if (_this.props.lazyLoad) {
image.onload = function () {
_this.adaptHeight();
_this.callbackTimers.push(setTimeout(_this.onWindowResized, _this.props.speed));
};
} else {
image.onload = handler;
image.onerror = function () {
handler();
_this.props.onLazyLoadError && _this.props.onLazyLoadError();
};
}
}
});
});
(0, _defineProperty2["default"])(_this, "progressiveLazyLoad", function () {
var slidesToLoad = [];
var spec = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _this.props), _this.state);
for (var index = _this.state.currentSlide; index < _this.state.slideCount + (0, _innerSliderUtils.getPostClones)(spec); index++) {
if (_this.state.lazyLoadedList.indexOf(index) < 0) {
slidesToLoad.push(index);
break;
}
}
for (var _index = _this.state.currentSlide - 1; _index >= -(0, _innerSliderUtils.getPreClones)(spec); _index--) {
if (_this.state.lazyLoadedList.indexOf(_index) < 0) {
slidesToLoad.push(_index);
break;
}
}
if (slidesToLoad.length > 0) {
_this.setState(function (state) {
return {
lazyLoadedList: state.lazyLoadedList.concat(slidesToLoad)
};
});
if (_this.props.onLazyLoad) {
_this.props.onLazyLoad(slidesToLoad);
}
} else {
if (_this.lazyLoadTimer) {
clearInterval(_this.lazyLoadTimer);
delete _this.lazyLoadTimer;
}
}
});
(0, _defineProperty2["default"])(_this, "slideHandler", function (index) {
var dontAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var _this$props = _this.props,
asNavFor = _this$props.asNavFor,
beforeChange = _this$props.beforeChange,
onLazyLoad = _this$props.onLazyLoad,
speed = _this$props.speed,
afterChange = _this$props.afterChange;
// capture currentslide before state is updated
var currentSlide = _this.state.currentSlide;
var _slideHandler = (0, _innerSliderUtils.slideHandler)((0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({
index: index
}, _this.props), _this.state), {}, {
trackRef: _this.track,
useCSS: _this.props.useCSS && !dontAnimate
})),
state = _slideHandler.state,
nextState = _slideHandler.nextState;
if (!state) return;
beforeChange && beforeChange(currentSlide, state.currentSlide);
var slidesToLoad = state.lazyLoadedList.filter(function (value) {
return _this.state.lazyLoadedList.indexOf(value) < 0;
});
onLazyLoad && slidesToLoad.length > 0 && onLazyLoad(slidesToLoad);
if (!_this.props.waitForAnimate && _this.animationEndCallback) {
clearTimeout(_this.animationEndCallback);
afterChange && afterChange(currentSlide);
delete _this.animationEndCallback;
}
_this.setState(state, function () {
// asNavForIndex check is to avoid recursive calls of slideHandler in waitForAnimate=false mode
if (asNavFor && _this.asNavForIndex !== index) {
_this.asNavForIndex = index;
asNavFor.innerSlider.slideHandler(index);
}
if (!nextState) return;
_this.animationEndCallback = setTimeout(function () {
var animating = nextState.animating,
firstBatch = (0, _objectWithoutProperties2["default"])(nextState, _excluded);
_this.setState(firstBatch, function () {
_this.callbackTimers.push(setTimeout(function () {
return _this.setState({
animating: animating
});
}, 10));
afterChange && afterChange(state.currentSlide);
delete _this.animationEndCallback;
});
}, speed);
});
});
(0, _defineProperty2["default"])(_this, "changeSlide", function (options) {
var dontAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var spec = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _this.props), _this.state);
var targetSlide = (0, _innerSliderUtils.changeSlide)(spec, options);
if (targetSlide !== 0 && !targetSlide) return;
if (dontAnimate === true) {
_this.slideHandler(targetSlide, dontAnimate);
} else {
_this.slideHandler(targetSlide);
}
_this.props.autoplay && _this.autoPlay("update");
if (_this.props.focusOnSelect) {
var nodes = _this.list.querySelectorAll(".slick-current");
nodes[0] && nodes[0].focus();
}
});
(0, _defineProperty2["default"])(_this, "clickHandler", function (e) {
if (_this.clickable === false) {
e.stopPropagation();
e.preventDefault();
}
_this.clickable = true;
});
(0, _defineProperty2["default"])(_this, "keyHandler", function (e) {
var dir = (0, _innerSliderUtils.keyHandler)(e, _this.props.accessibility, _this.props.rtl);
dir !== "" && _this.changeSlide({
message: dir
});
});
(0, _defineProperty2["default"])(_this, "selectHandler", function (options) {
_this.changeSlide(options);
});
(0, _defineProperty2["default"])(_this, "disableBodyScroll", function () {
var preventDefault = function preventDefault(e) {
e = e || window.event;
if (e.preventDefault) e.preventDefault();
e.returnValue = false;
};
window.ontouchmove = preventDefault;
});
(0, _defineProperty2["default"])(_this, "enableBodyScroll", function () {
window.ontouchmove = null;
});
(0, _defineProperty2["default"])(_this, "swipeStart", function (e) {
if (_this.props.verticalSwiping) {
_this.disableBodyScroll();
}
var state = (0, _innerSliderUtils.swipeStart)(e, _this.props.swipe, _this.props.draggable);
state !== "" && _this.setState(state);
});
(0, _defineProperty2["default"])(_this, "swipeMove", function (e) {
var state = (0, _innerSliderUtils.swipeMove)(e, (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _this.props), _this.state), {}, {
trackRef: _this.track,
listRef: _this.list,
slideIndex: _this.state.currentSlide
}));
if (!state) return;
if (state["swiping"]) {
_this.clickable = false;
}
_this.setState(state);
});
(0, _defineProperty2["default"])(_this, "swipeEnd", function (e) {
var state = (0, _innerSliderUtils.swipeEnd)(e, (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _this.props), _this.state), {}, {
trackRef: _this.track,
listRef: _this.list,
slideIndex: _this.state.currentSlide
}));
if (!state) return;
var triggerSlideHandler = state["triggerSlideHandler"];
delete state["triggerSlideHandler"];
_this.setState(state);
if (triggerSlideHandler === undefined) return;
_this.slideHandler(triggerSlideHandler);
if (_this.props.verticalSwiping) {
_this.enableBodyScroll();
}
});
(0, _defineProperty2["default"])(_this, "touchEnd", function (e) {
_this.swipeEnd(e);
_this.clickable = true;
});
(0, _defineProperty2["default"])(_this, "slickPrev", function () {
// this and fellow methods are wrapped in setTimeout
// to make sure initialize setState has happened before
// any of such methods are called
_this.callbackTimers.push(setTimeout(function () {
return _this.changeSlide({
message: "previous"
});
}, 0));
});
(0, _defineProperty2["default"])(_this, "slickNext", function () {
_this.callbackTimers.push(setTimeout(function () {
return _this.changeSlide({
message: "next"
});
}, 0));
});
(0, _defineProperty2["default"])(_this, "slickGoTo", function (slide) {
var dontAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
slide = Number(slide);
if (isNaN(slide)) return "";
_this.callbackTimers.push(setTimeout(function () {
return _this.changeSlide({
message: "index",
index: slide,
currentSlide: _this.state.currentSlide
}, dontAnimate);
}, 0));
});
(0, _defineProperty2["default"])(_this, "play", function () {
var nextIndex;
if (_this.props.rtl) {
nextIndex = _this.state.currentSlide - _this.props.slidesToScroll;
} else {
if ((0, _innerSliderUtils.canGoNext)((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _this.props), _this.state))) {
nextIndex = _this.state.currentSlide + _this.props.slidesToScroll;
} else {
return false;
}
}
_this.slideHandler(nextIndex);
});
(0, _defineProperty2["default"])(_this, "autoPlay", function (playType) {
if (_this.autoplayTimer) {
clearInterval(_this.autoplayTimer);
}
var autoplaying = _this.state.autoplaying;
if (playType === "update") {
if (autoplaying === "hovered" || autoplaying === "focused" || autoplaying === "paused") {
return;
}
} else if (playType === "leave") {
if (autoplaying === "paused" || autoplaying === "focused") {
return;
}
} else if (playType === "blur") {
if (autoplaying === "paused" || autoplaying === "hovered") {
return;
}
}
_this.autoplayTimer = setInterval(_this.play, _this.props.autoplaySpeed + 50);
_this.setState({
autoplaying: "playing"
});
});
(0, _defineProperty2["default"])(_this, "pause", function (pauseType) {
if (_this.autoplayTimer) {
clearInterval(_this.autoplayTimer);
_this.autoplayTimer = null;
}
var autoplaying = _this.state.autoplaying;
if (pauseType === "paused") {
_this.setState({
autoplaying: "paused"
});
} else if (pauseType === "focused") {
if (autoplaying === "hovered" || autoplaying === "playing") {
_this.setState({
autoplaying: "focused"
});
}
} else {
// pauseType is 'hovered'
if (autoplaying === "playing") {
_this.setState({
autoplaying: "hovered"
});
}
}
});
(0, _defineProperty2["default"])(_this, "onDotsOver", function () {
return _this.props.autoplay && _this.pause("hovered");
});
(0, _defineProperty2["default"])(_this, "onDotsLeave", function () {
return _this.props.autoplay && _this.state.autoplaying === "hovered" && _this.autoPlay("leave");
});
(0, _defineProperty2["default"])(_this, "onTrackOver", function () {
return _this.props.autoplay && _this.pause("hovered");
});
(0, _defineProperty2["default"])(_this, "onTrackLeave", function () {
return _this.props.autoplay && _this.state.autoplaying === "hovered" && _this.autoPlay("leave");
});
(0, _defineProperty2["default"])(_this, "onSlideFocus", function () {
return _this.props.autoplay && _this.pause("focused");
});
(0, _defineProperty2["default"])(_this, "onSlideBlur", function () {
return _this.props.autoplay && _this.state.autoplaying === "focused" && _this.autoPlay("blur");
});
(0, _defineProperty2["default"])(_this, "render", function () {
var className = (0, _classnames["default"])("slick-slider", _this.props.className, {
"slick-vertical": _this.props.vertical,
"slick-initialized": true
});
var spec = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _this.props), _this.state);
var trackProps = (0, _innerSliderUtils.extractObject)(spec, ["fade", "cssEase", "speed", "infinite", "centerMode", "focusOnSelect", "currentSlide", "lazyLoad", "lazyLoadedList", "rtl", "slideWidth", "slideHeight", "listHeight", "vertical", "slidesToShow", "slidesToScroll", "slideCount", "trackStyle", "variableWidth", "unslick", "centerPadding", "targetSlide", "useCSS"]);
var pauseOnHover = _this.props.pauseOnHover;
trackProps = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, trackProps), {}, {
onMouseEnter: pauseOnHover ? _this.onTrackOver : null,
onMouseLeave: pauseOnHover ? _this.onTrackLeave : null,
onMouseOver: pauseOnHover ? _this.onTrackOver : null,
focusOnSelect: _this.props.focusOnSelect && _this.clickable ? _this.selectHandler : null
});
var dots;
if (_this.props.dots === true && _this.state.slideCount >= _this.props.slidesToShow) {
var dotProps = (0, _innerSliderUtils.extractObject)(spec, ["dotsClass", "slideCount", "slidesToShow", "currentSlide", "slidesToScroll", "clickHandler", "children", "customPaging", "infinite", "appendDots"]);
var pauseOnDotsHover = _this.props.pauseOnDotsHover;
dotProps = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, dotProps), {}, {
clickHandler: _this.changeSlide,
onMouseEnter: pauseOnDotsHover ? _this.onDotsLeave : null,
onMouseOver: pauseOnDotsHover ? _this.onDotsOver : null,
onMouseLeave: pauseOnDotsHover ? _this.onDotsLeave : null
});
dots = /*#__PURE__*/_react["default"].createElement(_dots.Dots, dotProps);
}
var prevArrow, nextArrow;
var arrowProps = (0, _innerSliderUtils.extractObject)(spec, ["infinite", "centerMode", "currentSlide", "slideCount", "slidesToShow", "prevArrow", "nextArrow"]);
arrowProps.clickHandler = _this.changeSlide;
if (_this.props.arrows) {
prevArrow = /*#__PURE__*/_react["default"].createElement(_arrows.PrevArrow, arrowProps);
nextArrow = /*#__PURE__*/_react["default"].createElement(_arrows.NextArrow, arrowProps);
}
var verticalHeightStyle = null;
if (_this.props.vertical) {
verticalHeightStyle = {
height: _this.state.listHeight
};
}
var centerPaddingStyle = null;
if (_this.props.vertical === false) {
if (_this.props.centerMode === true) {
centerPaddingStyle = {
padding: "0px " + _this.props.centerPadding
};
}
} else {
if (_this.props.centerMode === true) {
centerPaddingStyle = {
padding: _this.props.centerPadding + " 0px"
};
}
}
var listStyle = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, verticalHeightStyle), centerPaddingStyle);
var touchMove = _this.props.touchMove;
var listProps = {
className: "slick-list",
style: listStyle,
onClick: _this.clickHandler,
onMouseDown: touchMove ? _this.swipeStart : null,
onMouseMove: _this.state.dragging && touchMove ? _this.swipeMove : null,
onMouseUp: touchMove ? _this.swipeEnd : null,
onMouseLeave: _this.state.dragging && touchMove ? _this.swipeEnd : null,
onTouchStart: touchMove ? _this.swipeStart : null,
onTouchMove: _this.state.dragging && touchMove ? _this.swipeMove : null,
onTouchEnd: touchMove ? _this.touchEnd : null,
onTouchCancel: _this.state.dragging && touchMove ? _this.swipeEnd : null,
onKeyDown: _this.props.accessibility ? _this.keyHandler : null
};
var innerSliderProps = {
className: className,
dir: "ltr",
style: _this.props.style
};
if (_this.props.unslick) {
listProps = {
className: "slick-list"
};
innerSliderProps = {
className: className,
style: _this.props.style
};
}
return /*#__PURE__*/_react["default"].createElement("div", innerSliderProps, !_this.props.unslick ? prevArrow : "", /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
ref: _this.listRefHandler
}, listProps), /*#__PURE__*/_react["default"].createElement(_track.Track, (0, _extends2["default"])({
ref: _this.trackRefHandler
}, trackProps), _this.props.children)), !_this.props.unslick ? nextArrow : "", !_this.props.unslick ? dots : "");
});
_this.list = null;
_this.track = null;
_this.state = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _initialState["default"]), {}, {
currentSlide: _this.props.initialSlide,
targetSlide: _this.props.initialSlide ? _this.props.initialSlide : 0,
slideCount: _react["default"].Children.count(_this.props.children)
});
_this.callbackTimers = [];
_this.clickable = true;
_this.debouncedResize = null;
var ssrState = _this.ssrInit();
_this.state = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _this.state), ssrState);
return _this;
}
(0, _inherits2["default"])(InnerSlider, _React$Component);
return (0, _createClass2["default"])(InnerSlider, [{
key: "didPropsChange",
value: function didPropsChange(prevProps) {
var setTrackStyle = false;
for (var _i3 = 0, _Object$keys = Object.keys(this.props); _i3 < _Object$keys.length; _i3++) {
var key = _Object$keys[_i3];
// eslint-disable-next-line no-prototype-builtins
if (!prevProps.hasOwnProperty(key)) {
setTrackStyle = true;
break;
}
if ((0, _typeof2["default"])(prevProps[key]) === "object" || typeof prevProps[key] === "function" || isNaN(prevProps[key])) {
continue;
}
if (prevProps[key] !== this.props[key]) {
setTrackStyle = true;
break;
}
}
return setTrackStyle || _react["default"].Children.count(this.props.children) !== _react["default"].Children.count(prevProps.children);
}
}]);
}(_react["default"].Component);

235
node_modules/@ant-design/react-slick/lib/slider.js generated vendored Normal file
View File

@@ -0,0 +1,235 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _isNativeReflectConstruct2 = _interopRequireDefault(require("@babel/runtime/helpers/isNativeReflectConstruct"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _react = _interopRequireDefault(require("react"));
var _innerSlider = require("./inner-slider");
var _json2mq = _interopRequireDefault(require("json2mq"));
var _defaultProps = _interopRequireDefault(require("./default-props"));
var _innerSliderUtils = require("./utils/innerSliderUtils");
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, (0, _isNativeReflectConstruct2["default"])() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
var Slider = exports["default"] = /*#__PURE__*/function (_React$Component) {
function Slider(props) {
var _this;
(0, _classCallCheck2["default"])(this, Slider);
_this = _callSuper(this, Slider, [props]);
(0, _defineProperty2["default"])(_this, "innerSliderRefHandler", function (ref) {
return _this.innerSlider = ref;
});
(0, _defineProperty2["default"])(_this, "slickPrev", function () {
return _this.innerSlider.slickPrev();
});
(0, _defineProperty2["default"])(_this, "slickNext", function () {
return _this.innerSlider.slickNext();
});
(0, _defineProperty2["default"])(_this, "slickGoTo", function (slide) {
var dontAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
return _this.innerSlider.slickGoTo(slide, dontAnimate);
});
(0, _defineProperty2["default"])(_this, "slickPause", function () {
return _this.innerSlider.pause("paused");
});
(0, _defineProperty2["default"])(_this, "slickPlay", function () {
return _this.innerSlider.autoPlay("play");
});
_this.state = {
breakpoint: null
};
_this._responsiveMediaHandlers = [];
return _this;
}
(0, _inherits2["default"])(Slider, _React$Component);
return (0, _createClass2["default"])(Slider, [{
key: "media",
value: function media(query, handler) {
// javascript handler for css media query
var mql = window.matchMedia(query);
var listener = function listener(_ref) {
var matches = _ref.matches;
if (matches) {
handler();
}
};
mql.addListener(listener);
listener(mql);
this._responsiveMediaHandlers.push({
mql: mql,
query: query,
listener: listener
});
}
// handles responsive breakpoints
}, {
key: "componentDidMount",
value: function componentDidMount() {
var _this2 = this;
// performance monitoring
//if (process.env.NODE_ENV !== 'production') {
//const { whyDidYouUpdate } = require('why-did-you-update')
//whyDidYouUpdate(React)
//}
if (this.props.responsive) {
var breakpoints = this.props.responsive.map(function (breakpt) {
return breakpt.breakpoint;
});
// sort them in increasing order of their numerical value
breakpoints.sort(function (x, y) {
return x - y;
});
breakpoints.forEach(function (breakpoint, index) {
// media query for each breakpoint
var bQuery;
if (index === 0) {
bQuery = (0, _json2mq["default"])({
minWidth: 0,
maxWidth: breakpoint
});
} else {
bQuery = (0, _json2mq["default"])({
minWidth: breakpoints[index - 1] + 1,
maxWidth: breakpoint
});
}
// when not using server side rendering
(0, _innerSliderUtils.canUseDOM)() && _this2.media(bQuery, function () {
_this2.setState({
breakpoint: breakpoint
});
});
});
// Register media query for full screen. Need to support resize from small to large
// convert javascript object to media query string
var query = (0, _json2mq["default"])({
minWidth: breakpoints.slice(-1)[0]
});
(0, _innerSliderUtils.canUseDOM)() && this.media(query, function () {
_this2.setState({
breakpoint: null
});
});
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this._responsiveMediaHandlers.forEach(function (obj) {
obj.mql.removeListener(obj.listener);
});
}
}, {
key: "render",
value: function render() {
var _this3 = this;
var settings;
var newProps;
if (this.state.breakpoint) {
newProps = this.props.responsive.filter(function (resp) {
return resp.breakpoint === _this3.state.breakpoint;
});
settings = newProps[0].settings === "unslick" ? "unslick" : (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _defaultProps["default"]), this.props), newProps[0].settings);
} else {
settings = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _defaultProps["default"]), this.props);
}
// force scrolling by one if centerMode is on
if (settings.centerMode) {
if (settings.slidesToScroll > 1 && process.env.NODE_ENV !== "production") {
console.warn("slidesToScroll should be equal to 1 in centerMode, you are using ".concat(settings.slidesToScroll));
}
settings.slidesToScroll = 1;
}
// force showing one slide and scrolling by one if the fade mode is on
if (settings.fade) {
if (settings.slidesToShow > 1 && process.env.NODE_ENV !== "production") {
console.warn("slidesToShow should be equal to 1 when fade is true, you're using ".concat(settings.slidesToShow));
}
if (settings.slidesToScroll > 1 && process.env.NODE_ENV !== "production") {
console.warn("slidesToScroll should be equal to 1 when fade is true, you're using ".concat(settings.slidesToScroll));
}
settings.slidesToShow = 1;
settings.slidesToScroll = 1;
}
// makes sure that children is an array, even when there is only 1 child
var children = _react["default"].Children.toArray(this.props.children);
// Children may contain false or null, so we should filter them
// children may also contain string filled with spaces (in certain cases where we use jsx strings)
children = children.filter(function (child) {
if (typeof child === "string") {
return !!child.trim();
}
return !!child;
});
// rows and slidesPerRow logic is handled here
if (settings.variableWidth && (settings.rows > 1 || settings.slidesPerRow > 1)) {
console.warn("variableWidth is not supported in case of rows > 1 or slidesPerRow > 1");
settings.variableWidth = false;
}
var newChildren = [];
var currentWidth = null;
for (var i = 0; i < children.length; i += settings.rows * settings.slidesPerRow) {
var newSlide = [];
for (var j = i; j < i + settings.rows * settings.slidesPerRow; j += settings.slidesPerRow) {
var row = [];
for (var k = j; k < j + settings.slidesPerRow; k += 1) {
if (settings.variableWidth && children[k].props.style) {
currentWidth = children[k].props.style.width;
}
if (k >= children.length) break;
row.push( /*#__PURE__*/_react["default"].cloneElement(children[k], {
key: 100 * i + 10 * j + k,
tabIndex: -1,
style: {
width: "".concat(100 / settings.slidesPerRow, "%"),
display: "inline-block"
}
}));
}
newSlide.push( /*#__PURE__*/_react["default"].createElement("div", {
key: 10 * i + j
}, row));
}
if (settings.variableWidth) {
newChildren.push( /*#__PURE__*/_react["default"].createElement("div", {
key: i,
style: {
width: currentWidth
}
}, newSlide));
} else {
newChildren.push( /*#__PURE__*/_react["default"].createElement("div", {
key: i
}, newSlide));
}
}
if (settings === "unslick") {
var className = "regular slider " + (this.props.className || "");
return /*#__PURE__*/_react["default"].createElement("div", {
className: className
}, children);
} else if (newChildren.length <= settings.slidesToShow && !settings.infinite) {
settings.unslick = true;
}
return /*#__PURE__*/_react["default"].createElement(_innerSlider.InnerSlider, (0, _extends2["default"])({
style: this.props.style,
ref: this.innerSliderRefHandler
}, (0, _innerSliderUtils.filterSettings)(settings)), newChildren);
}
}]);
}(_react["default"].Component);

218
node_modules/@ant-design/react-slick/lib/track.js generated vendored Normal file
View File

@@ -0,0 +1,218 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Track = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _isNativeReflectConstruct2 = _interopRequireDefault(require("@babel/runtime/helpers/isNativeReflectConstruct"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _react = _interopRequireDefault(require("react"));
var _classnames = _interopRequireDefault(require("classnames"));
var _innerSliderUtils = require("./utils/innerSliderUtils");
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, (0, _isNativeReflectConstruct2["default"])() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
// given specifications/props for a slide, fetch all the classes that need to be applied to the slide
var getSlideClasses = function getSlideClasses(spec) {
var slickActive, slickCenter, slickCloned;
var centerOffset, index;
if (spec.rtl) {
index = spec.slideCount - 1 - spec.index;
} else {
index = spec.index;
}
slickCloned = index < 0 || index >= spec.slideCount;
if (spec.centerMode) {
centerOffset = Math.floor(spec.slidesToShow / 2);
slickCenter = (index - spec.currentSlide) % spec.slideCount === 0;
if (index > spec.currentSlide - centerOffset - 1 && index <= spec.currentSlide + centerOffset) {
slickActive = true;
}
} else {
slickActive = spec.currentSlide <= index && index < spec.currentSlide + spec.slidesToShow;
}
var focusedSlide;
if (spec.targetSlide < 0) {
focusedSlide = spec.targetSlide + spec.slideCount;
} else if (spec.targetSlide >= spec.slideCount) {
focusedSlide = spec.targetSlide - spec.slideCount;
} else {
focusedSlide = spec.targetSlide;
}
var slickCurrent = index === focusedSlide;
return {
"slick-slide": true,
"slick-active": slickActive,
"slick-center": slickCenter,
"slick-cloned": slickCloned,
"slick-current": slickCurrent // dubious in case of RTL
};
};
var getSlideStyle = function getSlideStyle(spec) {
var style = {};
if (spec.variableWidth === undefined || spec.variableWidth === false) {
style.width = spec.slideWidth;
}
if (spec.fade) {
style.position = "relative";
if (spec.vertical && spec.slideHeight) {
style.top = -spec.index * parseInt(spec.slideHeight);
} else {
style.left = -spec.index * parseInt(spec.slideWidth);
}
style.opacity = spec.currentSlide === spec.index ? 1 : 0;
style.zIndex = spec.currentSlide === spec.index ? 999 : 998;
if (spec.useCSS) {
style.transition = "opacity " + spec.speed + "ms " + spec.cssEase + ", " + "visibility " + spec.speed + "ms " + spec.cssEase;
}
}
return style;
};
var getKey = function getKey(child, fallbackKey) {
return child.key + "-" + fallbackKey;
};
var renderSlides = function renderSlides(spec) {
var key;
var slides = [];
var preCloneSlides = [];
var postCloneSlides = [];
var childrenCount = _react["default"].Children.count(spec.children);
var startIndex = (0, _innerSliderUtils.lazyStartIndex)(spec);
var endIndex = (0, _innerSliderUtils.lazyEndIndex)(spec);
_react["default"].Children.forEach(spec.children, function (elem, index) {
var child;
var childOnClickOptions = {
message: "children",
index: index,
slidesToScroll: spec.slidesToScroll,
currentSlide: spec.currentSlide
};
// in case of lazyLoad, whether or not we want to fetch the slide
if (!spec.lazyLoad || spec.lazyLoad && spec.lazyLoadedList.indexOf(index) >= 0) {
child = elem;
} else {
child = /*#__PURE__*/_react["default"].createElement("div", null);
}
var childStyle = getSlideStyle((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, spec), {}, {
index: index
}));
var slideClass = child.props.className || "";
var slideClasses = getSlideClasses((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, spec), {}, {
index: index
}));
// push a cloned element of the desired slide
slides.push( /*#__PURE__*/_react["default"].cloneElement(child, {
key: "original" + getKey(child, index),
"data-index": index,
className: (0, _classnames["default"])(slideClasses, slideClass),
tabIndex: "-1",
"aria-hidden": !slideClasses["slick-active"],
style: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
outline: "none"
}, child.props.style || {}), childStyle),
onClick: function onClick(e) {
child.props && child.props.onClick && child.props.onClick(e);
if (spec.focusOnSelect) {
spec.focusOnSelect(childOnClickOptions);
}
}
}));
// if slide needs to be precloned or postcloned
if (spec.infinite && childrenCount > 1 && spec.fade === false && !spec.unslick) {
var preCloneNo = childrenCount - index;
if (preCloneNo <= (0, _innerSliderUtils.getPreClones)(spec)) {
key = -preCloneNo;
if (key >= startIndex) {
child = elem;
}
slideClasses = getSlideClasses((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, spec), {}, {
index: key
}));
preCloneSlides.push( /*#__PURE__*/_react["default"].cloneElement(child, {
key: "precloned" + getKey(child, key),
"data-index": key,
tabIndex: "-1",
className: (0, _classnames["default"])(slideClasses, slideClass),
"aria-hidden": !slideClasses["slick-active"],
style: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, child.props.style || {}), childStyle),
onClick: function onClick(e) {
child.props && child.props.onClick && child.props.onClick(e);
if (spec.focusOnSelect) {
spec.focusOnSelect(childOnClickOptions);
}
}
}));
}
key = childrenCount + index;
if (key < endIndex) {
child = elem;
}
slideClasses = getSlideClasses((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, spec), {}, {
index: key
}));
postCloneSlides.push( /*#__PURE__*/_react["default"].cloneElement(child, {
key: "postcloned" + getKey(child, key),
"data-index": key,
tabIndex: "-1",
className: (0, _classnames["default"])(slideClasses, slideClass),
"aria-hidden": !slideClasses["slick-active"],
style: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, child.props.style || {}), childStyle),
onClick: function onClick(e) {
child.props && child.props.onClick && child.props.onClick(e);
if (spec.focusOnSelect) {
spec.focusOnSelect(childOnClickOptions);
}
}
}));
}
});
if (spec.rtl) {
return preCloneSlides.concat(slides, postCloneSlides).reverse();
} else {
return preCloneSlides.concat(slides, postCloneSlides);
}
};
var Track = exports.Track = /*#__PURE__*/function (_React$PureComponent) {
function Track() {
var _this;
(0, _classCallCheck2["default"])(this, Track);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _callSuper(this, Track, [].concat(args));
(0, _defineProperty2["default"])(_this, "node", null);
(0, _defineProperty2["default"])(_this, "handleRef", function (ref) {
_this.node = ref;
});
return _this;
}
(0, _inherits2["default"])(Track, _React$PureComponent);
return (0, _createClass2["default"])(Track, [{
key: "render",
value: function render() {
var slides = renderSlides(this.props);
var _this$props = this.props,
onMouseEnter = _this$props.onMouseEnter,
onMouseOver = _this$props.onMouseOver,
onMouseLeave = _this$props.onMouseLeave;
var mouseEvents = {
onMouseEnter: onMouseEnter,
onMouseOver: onMouseOver,
onMouseLeave: onMouseLeave
};
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
ref: this.handleRef,
className: "slick-track",
style: this.props.trackStyle
}, mouseEvents), slides);
}
}]);
}(_react["default"].PureComponent);

View File

@@ -0,0 +1,766 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.checkSpecKeys = exports.checkNavigable = exports.changeSlide = exports.canUseDOM = exports.canGoNext = void 0;
exports.clamp = clamp;
exports.extractObject = void 0;
exports.filterSettings = filterSettings;
exports.validSettings = exports.swipeStart = exports.swipeMove = exports.swipeEnd = exports.slidesOnRight = exports.slidesOnLeft = exports.slideHandler = exports.siblingDirection = exports.safePreventDefault = exports.lazyStartIndex = exports.lazySlidesOnRight = exports.lazySlidesOnLeft = exports.lazyEndIndex = exports.keyHandler = exports.initializedState = exports.getWidth = exports.getTrackLeft = exports.getTrackCSS = exports.getTrackAnimateCSS = exports.getTotalSlides = exports.getSwipeDirection = exports.getSlideCount = exports.getRequiredLazySlides = exports.getPreClones = exports.getPostClones = exports.getOnDemandLazySlides = exports.getNavigableIndexes = exports.getHeight = void 0;
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _react = _interopRequireDefault(require("react"));
var _defaultProps = _interopRequireDefault(require("../default-props"));
function clamp(number, lowerBound, upperBound) {
return Math.max(lowerBound, Math.min(number, upperBound));
}
var safePreventDefault = exports.safePreventDefault = function safePreventDefault(event) {
var passiveEvents = ["onTouchStart", "onTouchMove", "onWheel"];
if (!passiveEvents.includes(event._reactName)) {
event.preventDefault();
}
};
var getOnDemandLazySlides = exports.getOnDemandLazySlides = function getOnDemandLazySlides(spec) {
var onDemandSlides = [];
var startIndex = lazyStartIndex(spec);
var endIndex = lazyEndIndex(spec);
for (var slideIndex = startIndex; slideIndex < endIndex; slideIndex++) {
if (spec.lazyLoadedList.indexOf(slideIndex) < 0) {
onDemandSlides.push(slideIndex);
}
}
return onDemandSlides;
};
// return list of slides that need to be present
var getRequiredLazySlides = exports.getRequiredLazySlides = function getRequiredLazySlides(spec) {
var requiredSlides = [];
var startIndex = lazyStartIndex(spec);
var endIndex = lazyEndIndex(spec);
for (var slideIndex = startIndex; slideIndex < endIndex; slideIndex++) {
requiredSlides.push(slideIndex);
}
return requiredSlides;
};
// startIndex that needs to be present
var lazyStartIndex = exports.lazyStartIndex = function lazyStartIndex(spec) {
return spec.currentSlide - lazySlidesOnLeft(spec);
};
var lazyEndIndex = exports.lazyEndIndex = function lazyEndIndex(spec) {
return spec.currentSlide + lazySlidesOnRight(spec);
};
var lazySlidesOnLeft = exports.lazySlidesOnLeft = function lazySlidesOnLeft(spec) {
return spec.centerMode ? Math.floor(spec.slidesToShow / 2) + (parseInt(spec.centerPadding) > 0 ? 1 : 0) : 0;
};
var lazySlidesOnRight = exports.lazySlidesOnRight = function lazySlidesOnRight(spec) {
return spec.centerMode ? Math.floor((spec.slidesToShow - 1) / 2) + 1 + (parseInt(spec.centerPadding) > 0 ? 1 : 0) : spec.slidesToShow;
};
// get width of an element
var getWidth = exports.getWidth = function getWidth(elem) {
return elem && elem.offsetWidth || 0;
};
var getHeight = exports.getHeight = function getHeight(elem) {
return elem && elem.offsetHeight || 0;
};
var getSwipeDirection = exports.getSwipeDirection = function getSwipeDirection(touchObject) {
var verticalSwiping = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var xDist, yDist, r, swipeAngle;
xDist = touchObject.startX - touchObject.curX;
yDist = touchObject.startY - touchObject.curY;
r = Math.atan2(yDist, xDist);
swipeAngle = Math.round(r * 180 / Math.PI);
if (swipeAngle < 0) {
swipeAngle = 360 - Math.abs(swipeAngle);
}
if (swipeAngle <= 45 && swipeAngle >= 0 || swipeAngle <= 360 && swipeAngle >= 315) {
return "left";
}
if (swipeAngle >= 135 && swipeAngle <= 225) {
return "right";
}
if (verticalSwiping === true) {
if (swipeAngle >= 35 && swipeAngle <= 135) {
return "up";
} else {
return "down";
}
}
return "vertical";
};
// whether or not we can go next
var canGoNext = exports.canGoNext = function canGoNext(spec) {
var canGo = true;
if (!spec.infinite) {
if (spec.centerMode && spec.currentSlide >= spec.slideCount - 1) {
canGo = false;
} else if (spec.slideCount <= spec.slidesToShow || spec.currentSlide >= spec.slideCount - spec.slidesToShow) {
canGo = false;
}
}
return canGo;
};
// given an object and a list of keys, return new object with given keys
var extractObject = exports.extractObject = function extractObject(spec, keys) {
var newObject = {};
keys.forEach(function (key) {
return newObject[key] = spec[key];
});
return newObject;
};
// get initialized state
var initializedState = exports.initializedState = function initializedState(spec) {
// spec also contains listRef, trackRef
var slideCount = _react["default"].Children.count(spec.children);
var listNode = spec.listRef;
var listWidth = Math.ceil(getWidth(listNode));
var trackNode = spec.trackRef && spec.trackRef.node;
var trackWidth = Math.ceil(getWidth(trackNode));
var slideWidth;
if (!spec.vertical) {
var centerPaddingAdj = spec.centerMode && parseInt(spec.centerPadding) * 2;
if (typeof spec.centerPadding === "string" && spec.centerPadding.slice(-1) === "%") {
centerPaddingAdj *= listWidth / 100;
}
slideWidth = Math.ceil((listWidth - centerPaddingAdj) / spec.slidesToShow);
} else {
slideWidth = listWidth;
}
var slideHeight = listNode && getHeight(listNode.querySelector('[data-index="0"]'));
var listHeight = slideHeight * spec.slidesToShow;
var currentSlide = spec.currentSlide === undefined ? spec.initialSlide : spec.currentSlide;
if (spec.rtl && spec.currentSlide === undefined) {
currentSlide = slideCount - 1 - spec.initialSlide;
}
var lazyLoadedList = spec.lazyLoadedList || [];
var slidesToLoad = getOnDemandLazySlides((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, spec), {}, {
currentSlide: currentSlide,
lazyLoadedList: lazyLoadedList
}));
lazyLoadedList = lazyLoadedList.concat(slidesToLoad);
var state = {
slideCount: slideCount,
slideWidth: slideWidth,
listWidth: listWidth,
trackWidth: trackWidth,
currentSlide: currentSlide,
slideHeight: slideHeight,
listHeight: listHeight,
lazyLoadedList: lazyLoadedList
};
if (spec.autoplaying === null && spec.autoplay) {
state["autoplaying"] = "playing";
}
return state;
};
var slideHandler = exports.slideHandler = function slideHandler(spec) {
var waitForAnimate = spec.waitForAnimate,
animating = spec.animating,
fade = spec.fade,
infinite = spec.infinite,
index = spec.index,
slideCount = spec.slideCount,
lazyLoad = spec.lazyLoad,
currentSlide = spec.currentSlide,
centerMode = spec.centerMode,
slidesToScroll = spec.slidesToScroll,
slidesToShow = spec.slidesToShow,
useCSS = spec.useCSS;
var lazyLoadedList = spec.lazyLoadedList;
if (waitForAnimate && animating) return {};
var animationSlide = index,
finalSlide,
animationLeft,
finalLeft;
var state = {},
nextState = {};
var targetSlide = infinite ? index : clamp(index, 0, slideCount - 1);
if (fade) {
if (!infinite && (index < 0 || index >= slideCount)) return {};
if (index < 0) {
animationSlide = index + slideCount;
} else if (index >= slideCount) {
animationSlide = index - slideCount;
}
if (lazyLoad && lazyLoadedList.indexOf(animationSlide) < 0) {
lazyLoadedList = lazyLoadedList.concat(animationSlide);
}
state = {
animating: true,
currentSlide: animationSlide,
lazyLoadedList: lazyLoadedList,
targetSlide: animationSlide
};
nextState = {
animating: false,
targetSlide: animationSlide
};
} else {
finalSlide = animationSlide;
if (animationSlide < 0) {
finalSlide = animationSlide + slideCount;
if (!infinite) finalSlide = 0;else if (slideCount % slidesToScroll !== 0) finalSlide = slideCount - slideCount % slidesToScroll;
} else if (!canGoNext(spec) && animationSlide > currentSlide) {
animationSlide = finalSlide = currentSlide;
} else if (centerMode && animationSlide >= slideCount) {
animationSlide = infinite ? slideCount : slideCount - 1;
finalSlide = infinite ? 0 : slideCount - 1;
} else if (animationSlide >= slideCount) {
finalSlide = animationSlide - slideCount;
if (!infinite) finalSlide = slideCount - slidesToShow;else if (slideCount % slidesToScroll !== 0) finalSlide = 0;
}
if (!infinite && animationSlide + slidesToShow >= slideCount) {
finalSlide = slideCount - slidesToShow;
}
animationLeft = getTrackLeft((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, spec), {}, {
slideIndex: animationSlide
}));
finalLeft = getTrackLeft((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, spec), {}, {
slideIndex: finalSlide
}));
if (!infinite) {
if (animationLeft === finalLeft) animationSlide = finalSlide;
animationLeft = finalLeft;
}
if (lazyLoad) {
lazyLoadedList = lazyLoadedList.concat(getOnDemandLazySlides((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, spec), {}, {
currentSlide: animationSlide
})));
}
if (!useCSS) {
state = {
currentSlide: finalSlide,
trackStyle: getTrackCSS((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, spec), {}, {
left: finalLeft
})),
lazyLoadedList: lazyLoadedList,
targetSlide: targetSlide
};
} else {
state = {
animating: true,
currentSlide: finalSlide,
trackStyle: getTrackAnimateCSS((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, spec), {}, {
left: animationLeft
})),
lazyLoadedList: lazyLoadedList,
targetSlide: targetSlide
};
nextState = {
animating: false,
currentSlide: finalSlide,
trackStyle: getTrackCSS((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, spec), {}, {
left: finalLeft
})),
swipeLeft: null,
targetSlide: targetSlide
};
}
}
return {
state: state,
nextState: nextState
};
};
var changeSlide = exports.changeSlide = function changeSlide(spec, options) {
var indexOffset, previousInt, slideOffset, unevenOffset, targetSlide;
var slidesToScroll = spec.slidesToScroll,
slidesToShow = spec.slidesToShow,
slideCount = spec.slideCount,
currentSlide = spec.currentSlide,
previousTargetSlide = spec.targetSlide,
lazyLoad = spec.lazyLoad,
infinite = spec.infinite;
unevenOffset = slideCount % slidesToScroll !== 0;
indexOffset = unevenOffset ? 0 : (slideCount - currentSlide) % slidesToScroll;
if (options.message === "previous") {
slideOffset = indexOffset === 0 ? slidesToScroll : slidesToShow - indexOffset;
targetSlide = currentSlide - slideOffset;
if (lazyLoad && !infinite) {
previousInt = currentSlide - slideOffset;
targetSlide = previousInt === -1 ? slideCount - 1 : previousInt;
}
if (!infinite) {
targetSlide = previousTargetSlide - slidesToScroll;
}
} else if (options.message === "next") {
slideOffset = indexOffset === 0 ? slidesToScroll : indexOffset;
targetSlide = currentSlide + slideOffset;
if (lazyLoad && !infinite) {
targetSlide = (currentSlide + slidesToScroll) % slideCount + indexOffset;
}
if (!infinite) {
targetSlide = previousTargetSlide + slidesToScroll;
}
} else if (options.message === "dots") {
// Click on dots
targetSlide = options.index * options.slidesToScroll;
} else if (options.message === "children") {
// Click on the slides
targetSlide = options.index;
if (infinite) {
var direction = siblingDirection((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, spec), {}, {
targetSlide: targetSlide
}));
if (targetSlide > options.currentSlide && direction === "left") {
targetSlide = targetSlide - slideCount;
} else if (targetSlide < options.currentSlide && direction === "right") {
targetSlide = targetSlide + slideCount;
}
}
} else if (options.message === "index") {
targetSlide = Number(options.index);
}
return targetSlide;
};
var keyHandler = exports.keyHandler = function keyHandler(e, accessibility, rtl) {
if (e.target.tagName.match("TEXTAREA|INPUT|SELECT") || !accessibility) return "";
if (e.keyCode === 37) return rtl ? "next" : "previous";
if (e.keyCode === 39) return rtl ? "previous" : "next";
return "";
};
var swipeStart = exports.swipeStart = function swipeStart(e, swipe, draggable) {
e.target.tagName === "IMG" && safePreventDefault(e);
if (!swipe || !draggable && e.type.indexOf("mouse") !== -1) return "";
return {
dragging: true,
touchObject: {
startX: e.touches ? e.touches[0].pageX : e.clientX,
startY: e.touches ? e.touches[0].pageY : e.clientY,
curX: e.touches ? e.touches[0].pageX : e.clientX,
curY: e.touches ? e.touches[0].pageY : e.clientY
}
};
};
var swipeMove = exports.swipeMove = function swipeMove(e, spec) {
// spec also contains, trackRef and slideIndex
var scrolling = spec.scrolling,
animating = spec.animating,
vertical = spec.vertical,
swipeToSlide = spec.swipeToSlide,
verticalSwiping = spec.verticalSwiping,
rtl = spec.rtl,
currentSlide = spec.currentSlide,
edgeFriction = spec.edgeFriction,
edgeDragged = spec.edgeDragged,
onEdge = spec.onEdge,
swiped = spec.swiped,
swiping = spec.swiping,
slideCount = spec.slideCount,
slidesToScroll = spec.slidesToScroll,
infinite = spec.infinite,
touchObject = spec.touchObject,
swipeEvent = spec.swipeEvent,
listHeight = spec.listHeight,
listWidth = spec.listWidth;
if (scrolling) return;
if (animating) return safePreventDefault(e);
if (vertical && swipeToSlide && verticalSwiping) safePreventDefault(e);
var swipeLeft,
state = {};
var curLeft = getTrackLeft(spec);
touchObject.curX = e.touches ? e.touches[0].pageX : e.clientX;
touchObject.curY = e.touches ? e.touches[0].pageY : e.clientY;
touchObject.swipeLength = Math.round(Math.sqrt(Math.pow(touchObject.curX - touchObject.startX, 2)));
var verticalSwipeLength = Math.round(Math.sqrt(Math.pow(touchObject.curY - touchObject.startY, 2)));
if (!verticalSwiping && !swiping && verticalSwipeLength > 10) {
return {
scrolling: true
};
}
if (verticalSwiping) touchObject.swipeLength = verticalSwipeLength;
var positionOffset = (!rtl ? 1 : -1) * (touchObject.curX > touchObject.startX ? 1 : -1);
if (verticalSwiping) positionOffset = touchObject.curY > touchObject.startY ? 1 : -1;
var dotCount = Math.ceil(slideCount / slidesToScroll);
var swipeDirection = getSwipeDirection(spec.touchObject, verticalSwiping);
var touchSwipeLength = touchObject.swipeLength;
if (!infinite) {
if (currentSlide === 0 && (swipeDirection === "right" || swipeDirection === "down") || currentSlide + 1 >= dotCount && (swipeDirection === "left" || swipeDirection === "up") || !canGoNext(spec) && (swipeDirection === "left" || swipeDirection === "up")) {
touchSwipeLength = touchObject.swipeLength * edgeFriction;
if (edgeDragged === false && onEdge) {
onEdge(swipeDirection);
state["edgeDragged"] = true;
}
}
}
if (!swiped && swipeEvent) {
swipeEvent(swipeDirection);
state["swiped"] = true;
}
if (!vertical) {
if (!rtl) {
swipeLeft = curLeft + touchSwipeLength * positionOffset;
} else {
swipeLeft = curLeft - touchSwipeLength * positionOffset;
}
} else {
swipeLeft = curLeft + touchSwipeLength * (listHeight / listWidth) * positionOffset;
}
if (verticalSwiping) {
swipeLeft = curLeft + touchSwipeLength * positionOffset;
}
state = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), {}, {
touchObject: touchObject,
swipeLeft: swipeLeft,
trackStyle: getTrackCSS((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, spec), {}, {
left: swipeLeft
}))
});
if (Math.abs(touchObject.curX - touchObject.startX) < Math.abs(touchObject.curY - touchObject.startY) * 0.8) {
return state;
}
if (touchObject.swipeLength > 10) {
state["swiping"] = true;
safePreventDefault(e);
}
return state;
};
var swipeEnd = exports.swipeEnd = function swipeEnd(e, spec) {
var dragging = spec.dragging,
swipe = spec.swipe,
touchObject = spec.touchObject,
listWidth = spec.listWidth,
touchThreshold = spec.touchThreshold,
verticalSwiping = spec.verticalSwiping,
listHeight = spec.listHeight,
swipeToSlide = spec.swipeToSlide,
scrolling = spec.scrolling,
onSwipe = spec.onSwipe,
targetSlide = spec.targetSlide,
currentSlide = spec.currentSlide,
infinite = spec.infinite;
if (!dragging) {
if (swipe) safePreventDefault(e);
return {};
}
var minSwipe = verticalSwiping ? listHeight / touchThreshold : listWidth / touchThreshold;
var swipeDirection = getSwipeDirection(touchObject, verticalSwiping);
// reset the state of touch related state variables.
var state = {
dragging: false,
edgeDragged: false,
scrolling: false,
swiping: false,
swiped: false,
swipeLeft: null,
touchObject: {}
};
if (scrolling) {
return state;
}
if (!touchObject.swipeLength) {
return state;
}
if (touchObject.swipeLength > minSwipe) {
safePreventDefault(e);
if (onSwipe) {
onSwipe(swipeDirection);
}
var slideCount, newSlide;
var activeSlide = infinite ? currentSlide : targetSlide;
switch (swipeDirection) {
case "left":
case "up":
newSlide = activeSlide + getSlideCount(spec);
slideCount = swipeToSlide ? checkNavigable(spec, newSlide) : newSlide;
state["currentDirection"] = 0;
break;
case "right":
case "down":
newSlide = activeSlide - getSlideCount(spec);
slideCount = swipeToSlide ? checkNavigable(spec, newSlide) : newSlide;
state["currentDirection"] = 1;
break;
default:
slideCount = activeSlide;
}
state["triggerSlideHandler"] = slideCount;
} else {
// Adjust the track back to it's original position.
var currentLeft = getTrackLeft(spec);
state["trackStyle"] = getTrackAnimateCSS((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, spec), {}, {
left: currentLeft
}));
}
return state;
};
var getNavigableIndexes = exports.getNavigableIndexes = function getNavigableIndexes(spec) {
var max = spec.infinite ? spec.slideCount * 2 : spec.slideCount;
var breakpoint = spec.infinite ? spec.slidesToShow * -1 : 0;
var counter = spec.infinite ? spec.slidesToShow * -1 : 0;
var indexes = [];
while (breakpoint < max) {
indexes.push(breakpoint);
breakpoint = counter + spec.slidesToScroll;
counter += Math.min(spec.slidesToScroll, spec.slidesToShow);
}
return indexes;
};
var checkNavigable = exports.checkNavigable = function checkNavigable(spec, index) {
var navigables = getNavigableIndexes(spec);
var prevNavigable = 0;
if (index > navigables[navigables.length - 1]) {
index = navigables[navigables.length - 1];
} else {
for (var n in navigables) {
if (index < navigables[n]) {
index = prevNavigable;
break;
}
prevNavigable = navigables[n];
}
}
return index;
};
var getSlideCount = exports.getSlideCount = function getSlideCount(spec) {
var centerOffset = spec.centerMode ? spec.slideWidth * Math.floor(spec.slidesToShow / 2) : 0;
if (spec.swipeToSlide) {
var swipedSlide;
var slickList = spec.listRef;
var slides = slickList.querySelectorAll && slickList.querySelectorAll(".slick-slide") || [];
Array.from(slides).every(function (slide) {
if (!spec.vertical) {
if (slide.offsetLeft - centerOffset + getWidth(slide) / 2 > spec.swipeLeft * -1) {
swipedSlide = slide;
return false;
}
} else {
if (slide.offsetTop + getHeight(slide) / 2 > spec.swipeLeft * -1) {
swipedSlide = slide;
return false;
}
}
return true;
});
if (!swipedSlide) {
return 0;
}
var currentIndex = spec.rtl === true ? spec.slideCount - spec.currentSlide : spec.currentSlide;
var slidesTraversed = Math.abs(swipedSlide.dataset.index - currentIndex) || 1;
return slidesTraversed;
} else {
return spec.slidesToScroll;
}
};
var checkSpecKeys = exports.checkSpecKeys = function checkSpecKeys(spec, keysArray) {
return (
// eslint-disable-next-line no-prototype-builtins
keysArray.reduce(function (value, key) {
return value && spec.hasOwnProperty(key);
}, true) ? null : console.error("Keys Missing:", spec)
);
};
var getTrackCSS = exports.getTrackCSS = function getTrackCSS(spec) {
checkSpecKeys(spec, ["left", "variableWidth", "slideCount", "slidesToShow", "slideWidth"]);
var trackWidth, trackHeight;
if (!spec.vertical) {
trackWidth = getTotalSlides(spec) * spec.slideWidth;
} else {
var trackChildren = spec.unslick ? spec.slideCount : spec.slideCount + 2 * spec.slidesToShow;
trackHeight = trackChildren * spec.slideHeight;
}
var style = {
opacity: 1,
transition: "",
WebkitTransition: ""
};
if (spec.useTransform) {
var WebkitTransform = !spec.vertical ? "translate3d(" + spec.left + "px, 0px, 0px)" : "translate3d(0px, " + spec.left + "px, 0px)";
var transform = !spec.vertical ? "translate3d(" + spec.left + "px, 0px, 0px)" : "translate3d(0px, " + spec.left + "px, 0px)";
var msTransform = !spec.vertical ? "translateX(" + spec.left + "px)" : "translateY(" + spec.left + "px)";
style = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, style), {}, {
WebkitTransform: WebkitTransform,
transform: transform,
msTransform: msTransform
});
} else {
if (spec.vertical) {
style["top"] = spec.left;
} else {
style["left"] = spec.left;
}
}
if (spec.fade) style = {
opacity: 1
};
if (trackWidth) style.width = trackWidth;
if (trackHeight) style.height = trackHeight;
// Fallback for IE8
if (window && !window.addEventListener && window.attachEvent) {
if (!spec.vertical) {
style.marginLeft = spec.left + "px";
} else {
style.marginTop = spec.left + "px";
}
}
return style;
};
var getTrackAnimateCSS = exports.getTrackAnimateCSS = function getTrackAnimateCSS(spec) {
checkSpecKeys(spec, ["left", "variableWidth", "slideCount", "slidesToShow", "slideWidth", "speed", "cssEase"]);
var style = getTrackCSS(spec);
// useCSS is true by default so it can be undefined
if (spec.useTransform) {
style.WebkitTransition = "-webkit-transform " + spec.speed + "ms " + spec.cssEase;
style.transition = "transform " + spec.speed + "ms " + spec.cssEase;
} else {
if (spec.vertical) {
style.transition = "top " + spec.speed + "ms " + spec.cssEase;
} else {
style.transition = "left " + spec.speed + "ms " + spec.cssEase;
}
}
return style;
};
var getTrackLeft = exports.getTrackLeft = function getTrackLeft(spec) {
if (spec.unslick) {
return 0;
}
checkSpecKeys(spec, ["slideIndex", "trackRef", "infinite", "centerMode", "slideCount", "slidesToShow", "slidesToScroll", "slideWidth", "listWidth", "variableWidth", "slideHeight"]);
var slideIndex = spec.slideIndex,
trackRef = spec.trackRef,
infinite = spec.infinite,
centerMode = spec.centerMode,
slideCount = spec.slideCount,
slidesToShow = spec.slidesToShow,
slidesToScroll = spec.slidesToScroll,
slideWidth = spec.slideWidth,
listWidth = spec.listWidth,
variableWidth = spec.variableWidth,
slideHeight = spec.slideHeight,
fade = spec.fade,
vertical = spec.vertical;
var slideOffset = 0;
var targetLeft;
var targetSlide;
var verticalOffset = 0;
if (fade || spec.slideCount === 1) {
return 0;
}
var slidesToOffset = 0;
if (infinite) {
slidesToOffset = -getPreClones(spec); // bring active slide to the beginning of visual area
// if next scroll doesn't have enough children, just reach till the end of original slides instead of shifting slidesToScroll children
if (slideCount % slidesToScroll !== 0 && slideIndex + slidesToScroll > slideCount) {
slidesToOffset = -(slideIndex > slideCount ? slidesToShow - (slideIndex - slideCount) : slideCount % slidesToScroll);
}
// shift current slide to center of the frame
if (centerMode) {
slidesToOffset += parseInt(slidesToShow / 2);
}
} else {
if (slideCount % slidesToScroll !== 0 && slideIndex + slidesToScroll > slideCount) {
slidesToOffset = slidesToShow - slideCount % slidesToScroll;
}
if (centerMode) {
slidesToOffset = parseInt(slidesToShow / 2);
}
}
slideOffset = slidesToOffset * slideWidth;
verticalOffset = slidesToOffset * slideHeight;
if (!vertical) {
targetLeft = slideIndex * slideWidth * -1 + slideOffset;
} else {
targetLeft = slideIndex * slideHeight * -1 + verticalOffset;
}
if (variableWidth === true) {
var targetSlideIndex;
var trackElem = trackRef && trackRef.node;
targetSlideIndex = slideIndex + getPreClones(spec);
targetSlide = trackElem && trackElem.childNodes[targetSlideIndex];
targetLeft = targetSlide ? targetSlide.offsetLeft * -1 : 0;
if (centerMode === true) {
targetSlideIndex = infinite ? slideIndex + getPreClones(spec) : slideIndex;
targetSlide = trackElem && trackElem.children[targetSlideIndex];
targetLeft = 0;
for (var slide = 0; slide < targetSlideIndex; slide++) {
targetLeft -= trackElem && trackElem.children[slide] && trackElem.children[slide].offsetWidth;
}
targetLeft -= parseInt(spec.centerPadding);
targetLeft += targetSlide && (listWidth - targetSlide.offsetWidth) / 2;
}
}
return targetLeft;
};
var getPreClones = exports.getPreClones = function getPreClones(spec) {
if (spec.unslick || !spec.infinite) {
return 0;
}
if (spec.variableWidth) {
return spec.slideCount;
}
return spec.slidesToShow + (spec.centerMode ? 1 : 0);
};
var getPostClones = exports.getPostClones = function getPostClones(spec) {
if (spec.unslick || !spec.infinite) {
return 0;
}
return spec.slideCount;
};
var getTotalSlides = exports.getTotalSlides = function getTotalSlides(spec) {
return spec.slideCount === 1 ? 1 : getPreClones(spec) + spec.slideCount + getPostClones(spec);
};
var siblingDirection = exports.siblingDirection = function siblingDirection(spec) {
if (spec.targetSlide > spec.currentSlide) {
if (spec.targetSlide > spec.currentSlide + slidesOnRight(spec)) {
return "left";
}
return "right";
} else {
if (spec.targetSlide < spec.currentSlide - slidesOnLeft(spec)) {
return "right";
}
return "left";
}
};
var slidesOnRight = exports.slidesOnRight = function slidesOnRight(_ref) {
var slidesToShow = _ref.slidesToShow,
centerMode = _ref.centerMode,
rtl = _ref.rtl,
centerPadding = _ref.centerPadding;
// returns no of slides on the right of active slide
if (centerMode) {
var right = (slidesToShow - 1) / 2 + 1;
if (parseInt(centerPadding) > 0) right += 1;
if (rtl && slidesToShow % 2 === 0) right += 1;
return right;
}
if (rtl) {
return 0;
}
return slidesToShow - 1;
};
var slidesOnLeft = exports.slidesOnLeft = function slidesOnLeft(_ref2) {
var slidesToShow = _ref2.slidesToShow,
centerMode = _ref2.centerMode,
rtl = _ref2.rtl,
centerPadding = _ref2.centerPadding;
// returns no of slides on the left of active slide
if (centerMode) {
var left = (slidesToShow - 1) / 2 + 1;
if (parseInt(centerPadding) > 0) left += 1;
if (!rtl && slidesToShow % 2 === 0) left += 1;
return left;
}
if (rtl) {
return slidesToShow - 1;
}
return 0;
};
var canUseDOM = exports.canUseDOM = function canUseDOM() {
return !!(typeof window !== "undefined" && window.document && window.document.createElement);
};
var validSettings = exports.validSettings = Object.keys(_defaultProps["default"]);
function filterSettings(settings) {
return validSettings.reduce(function (acc, settingName) {
if (settings.hasOwnProperty(settingName)) {
acc[settingName] = settings[settingName];
}
return acc;
}, {});
}

131
node_modules/@ant-design/react-slick/package.json generated vendored Normal file
View File

@@ -0,0 +1,131 @@
{
"name": "@ant-design/react-slick",
"version": "1.1.2",
"description": " React port of slick carousel",
"main": "./lib",
"module": "./es",
"types": "./types.d.ts",
"files": [
"dist",
"lib",
"es",
"types.d.ts"
],
"scripts": {
"start": "NODE_OPTIONS=--openssl-legacy-provider gulp server",
"demo": "SINGLE_DEMO=true DEV_PORT=8000 NODE_OPTIONS=--openssl-legacy-provider gulp server",
"build-dev": "gulp clean && gulp copy && webpack",
"es": "ESMODULES=true babel ./src --out-dir ./es",
"lib": "babel ./src --out-dir ./lib",
"build": "NODE_OPTIONS=--openssl-legacy-provider npm run lib && NODE_OPTIONS=--openssl-legacy-provider npm run es && NODE_OPTIONS=--openssl-legacy-provider gulp dist",
"prepublishOnly": "npm run build && np --no-cleanup --no-publish",
"lint": "eslint src",
"gen": "node docs/scripts/generateExampleConfigs.js && node docs/scripts/generateExamples.js && xdg-open docs/jquery.html",
"precommit": "lint-staged",
"test": "jest",
"test-watch": "jest --watch",
"clear-jest": "jest --clearCache"
},
"author": "Kiran Abburi",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/ant-design/react-slick"
},
"keywords": [
"slick",
"carousel",
"Image slider",
"orbit",
"slider",
"react-component"
],
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.16.0",
"@babel/eslint-parser": "^7.16.3",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-transform-runtime": "^7.10.4",
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^14.3.0",
"autoprefixer": "^7.1.2",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^24.8.0",
"babel-loader": "^8.0.4",
"babel-preset-airbnb": "^5.0.0",
"css-loader": "^5.0.0",
"deepmerge": "^1.1.0",
"del": "^2.2.2",
"es5-shim": "^4.5.9",
"eslint": "^8.4.1",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-react": "^7.27.1",
"express": "^4.14.0",
"foundation-apps": "^1.2.0",
"gulp": "^4.0.0",
"husky": "^0.14.3",
"jest": "^28.1.3",
"jest-environment-jsdom": "^28.1.3",
"jquery": "^3.7.1",
"js-beautify": "^1.7.5",
"json-loader": "^0.5.4",
"lint-staged": "^12.1.2",
"np": "^8.0.4",
"opn": "^5.4.0",
"postcss-loader": "^1.3.3",
"prettier": "^2.1.2",
"raf": "^3.4.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"regenerator-runtime": "^0.14.1",
"sinon": "^2.1.0",
"slick-carousel": "^1.8.1",
"style-loader": "^0.16.1",
"uglifyjs-webpack-plugin": "^2.0.1",
"webpack": "^4.21.0",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.9",
"why-did-you-update": "^0.1.1"
},
"dependencies": {
"@babel/runtime": "^7.10.4",
"classnames": "^2.2.5",
"json2mq": "^0.2.0",
"resize-observer-polyfill": "^1.5.1",
"throttle-debounce": "^5.0.0"
},
"peerDependencies": {
"react": ">=16.9.0"
},
"lint-staged": {
"*.{js,json,md}": [
"prettier --write",
"git add"
]
},
"npmName": "@ant-design/react-slick",
"npmFileMap": [
{
"basePath": "/dist/",
"files": [
"*.js"
]
}
],
"bugs": {
"url": "https://github.com/ant-design/react-slick/issues"
},
"homepage": "https://react-slick.neostack.com",
"collective": {
"type": "opencollective",
"url": "https://opencollective.com/react-slick",
"logo": "https://opencollective.com/opencollective/logo.txt"
},
"publishConfig": {
"access": "public"
}
}

94
node_modules/@ant-design/react-slick/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,94 @@
import * as React from "react";
type ComponentConstructor<TProps> =
| React.ComponentClass<TProps>
| React.FunctionComponent<TProps>;
export interface CustomArrowProps {
className?: string | undefined;
style?: React.CSSProperties | undefined;
onClick?: React.MouseEventHandler<any> | undefined;
currentSlide?: number | undefined;
slideCount?: number | undefined;
}
export interface ResponsiveObject {
breakpoint: number;
settings: "unslick" | Settings;
}
export interface InnerSlider {
list?: HTMLDivElement;
}
export type SwipeDirection = "left" | "down" | "right" | "up" | string;
export type LazyLoadTypes = "ondemand" | "progressive" | "anticipated";
export interface Settings {
accessibility?: boolean | undefined;
adaptiveHeight?: boolean | undefined;
afterChange?(currentSlide: number): void;
appendDots?(dots: React.ReactNode): React.JSX.Element;
arrows?: boolean | undefined;
asNavFor?: Slider | undefined;
autoplaySpeed?: number | undefined;
autoplay?: boolean | undefined;
beforeChange?(currentSlide: number, nextSlide: number): void;
centerMode?: boolean | undefined;
centerPadding?: string | undefined;
children?: React.ReactNode;
className?: string | undefined;
cssEase?: string | undefined;
customPaging?(index: number): React.JSX.Element;
dotsClass?: string | undefined;
dots?: boolean | undefined;
draggable?: boolean | undefined;
easing?: string | undefined;
edgeFriction?: number | undefined;
fade?: boolean | undefined;
focusOnSelect?: boolean | undefined;
infinite?: boolean | undefined;
initialSlide?: number | undefined;
lazyLoad?: LazyLoadTypes | undefined;
nextArrow?: React.JSX.Element | undefined;
onEdge?(swipeDirection: SwipeDirection): void;
onInit?(): void;
onLazyLoad?(slidesToLoad: number[]): void;
onReInit?(): void;
onSwipe?(swipeDirection: SwipeDirection): void;
pauseOnDotsHover?: boolean | undefined;
pauseOnFocus?: boolean | undefined;
pauseOnHover?: boolean | undefined;
prevArrow?: React.JSX.Element | undefined;
responsive?: ResponsiveObject[] | undefined;
rows?: number | undefined;
rtl?: boolean | undefined;
slide?: string | undefined;
slidesPerRow?: number | undefined;
slidesToScroll?: number | undefined;
slidesToShow?: number | undefined;
speed?: number | undefined;
swipeToSlide?: boolean | undefined;
swipe?: boolean | undefined;
swipeEvent?(swipeDirection: SwipeDirection): void;
touchMove?: boolean | undefined;
touchThreshold?: number | undefined;
useCSS?: boolean | undefined;
useTransform?: boolean | undefined;
variableWidth?: boolean | undefined;
vertical?: boolean | undefined;
verticalSwiping?: boolean | undefined;
waitForAnimate?: boolean | undefined;
}
declare class Slider extends React.Component<Settings, never> {
innerSlider?: InnerSlider | undefined;
slickNext(): void;
slickPause(): void;
slickPlay(): void;
slickPrev(): void;
slickGoTo(slideNumber: number, dontAnimate?: boolean): void;
}
export default Slider;