@prisma-cms/front-editor
Version:
54 lines • 3.96 kB
JavaScript
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable @typescript-eslint/no-unused-vars */
const react_1 = __importDefault(require("react"));
const Iterable_1 = __importDefault(require("../Connectors/Connector/ListView/Iterable"));
class Slider extends Iterable_1.default {
renderPanelView(content) {
return super.renderPanelView(content || react_1.default.createElement("div", { className: "editor-component--panel-icon" }, "Slider"));
}
renderChildren() {
const childs = super.renderChildren();
if (!childs) {
return childs;
}
const SlickSlider = require('react-slick').default;
return (react_1.default.createElement(SlickSlider, Object.assign({ key: "slick" }, this.getSliderProps()), childs));
}
getSliderProps() {
const _a = this.getComponentProps(this), { slidesToShow = 1 } = _a, other = __rest(_a, ["slidesToShow"]);
const childs = super.renderChildren();
return Object.assign({ ref: (slider) => (this.slider = slider),
// Fix issue https://github.com/akiran/react-slick/issues/1553
slidesToShow: childs.length > slidesToShow ? slidesToShow : childs.length }, other);
}
prepareRootElementProps(props) {
// TODO Fix this hell
const _a = super.prepareRootElementProps(props), { dots, dotsClass, speed, slidesToShow, slidesToScroll, slidesPerRow, accessibility, adaptiveHeight, arrows, autoplay, autoplaySpeed, centerMode, centerPadding, draggable, easing, fade, focusOnSelect, infinite, initialSlide, lazyLoad, pauseOnDotsHover, pauseOnFocus, pauseOnHover,
// ToDo Add array/json params
// responsive,
rows, slide, swipe, swipeToSlide, touchMove, touchThreshold, useCSS, useTransform, variableWidth, vertical, ObjectContext, items } = _a, other = __rest(_a, ["dots", "dotsClass", "speed", "slidesToShow", "slidesToScroll", "slidesPerRow", "accessibility", "adaptiveHeight", "arrows", "autoplay", "autoplaySpeed", "centerMode", "centerPadding", "draggable", "easing", "fade", "focusOnSelect", "infinite", "initialSlide", "lazyLoad", "pauseOnDotsHover", "pauseOnFocus", "pauseOnHover", "rows", "slide", "swipe", "swipeToSlide", "touchMove", "touchThreshold", "useCSS", "useTransform", "variableWidth", "vertical", "ObjectContext", "items"]);
return other;
}
}
Slider.defaultProps = Object.assign(Object.assign({}, Iterable_1.default.defaultProps), { dots: true, dotsClass: 'slick-dots', speed: 500, slidesToScroll: 1, slidesToShow: 1, slidesPerRow: 1, accessibility: false, adaptiveHeight: false, arrows: true, autoplay: false, autoplaySpeed: 3000, centerMode: false, centerPadding: 50, draggable: true, easing: 'linear', fade: false, focusOnSelect: false, infinite: true, initialSlide: 0, lazyLoad: undefined, pauseOnDotsHover: false, pauseOnFocus: false, pauseOnHover: true,
// ToDo Add array/json params
// responsive: array,
rows: 1, slide: 'div', swipe: true, swipeToSlide: false, touchMove: true, touchThreshold: 5, useCSS: true, useTransform: true, variableWidth: false, vertical: false, style: Object.assign(Object.assign({}, Iterable_1.default.defaultProps.style), { paddingBottom: 30 }) });
Slider.Name = 'Slider';
exports.default = Slider;
//# sourceMappingURL=index.js.map