mp-colorui
Version:
MP ColorUI 是一款基于 Taro 框架并且联合 Color-UI CSS 库开发的多端 UI 组件库(支持小程序端和H5端)
388 lines (321 loc) • 23.1 kB
JavaScript
(wx["webpackJsonp"] = wx["webpackJsonp"] || []).push([["components/swiper/index"],{
/***/ "./node_modules/@tarojs/mini-runner/dist/loaders/wxTransformerLoader.js?!./src/components/swiper/index.tsx?taro&type=script&parse=COMPONENT&":
/*!************************************************************************************************************************************************************!*\
!*** ./node_modules/@tarojs/mini-runner/dist/loaders/wxTransformerLoader.js??ref--4-0!./src/components/swiper/index.tsx?taro&type=script&parse=COMPONENT& ***!
\************************************************************************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _taroWeapp = __webpack_require__(/*! @tarojs/taro-weapp */ "./node_modules/@tarojs/taro-weapp/index.js");
var _taroWeapp2 = _interopRequireDefault(_taroWeapp);
var _index = __webpack_require__(/*! ../../lib/index */ "./src/lib/index.ts");
__webpack_require__(/*! ./index.scss */ "./src/components/swiper/index.scss");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var ClSwiper = function (_Taro$Component) {
_inherits(ClSwiper, _Taro$Component);
function ClSwiper() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, ClSwiper);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = ClSwiper.__proto__ || Object.getPrototypeOf(ClSwiper)).call.apply(_ref, [this].concat(args))), _this), _this.$usedState = ["anonymousState__temp9", "anonymousState__temp10", "anonymousState__temp13", "anonymousState__temp14", "anonymousState__temp15", "anonymousState__temp16", "loopArray118", "loopArray119", "circular", "indicatorDots", "indicatorColor", "indicatorActiveColor", "interval", "duration", "autoplaySwiper", "list", "cur", "props"], _this.anonymousFunc1Map = {}, _this.anonymousFunc3Map = {}, _this.customComponents = [], _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(ClSwiper, [{
key: "_constructor",
value: function _constructor(props) {
_get(ClSwiper.prototype.__proto__ || Object.getPrototypeOf(ClSwiper.prototype), "_constructor", this).call(this, props);
this.$$refs = new _taroWeapp2.default.RefsArray();
}
}, {
key: "_createData",
value: function _createData() {
var _this2 = this;
this.__state = arguments[0] || this.state || {};
this.__props = arguments[1] || this.props || {};
var __isRunloopRef = arguments[2];
var __prefix = this.$prefix;
;
var props = this.__props;
var _useState = (0, _taroWeapp.useState)(props.list || []),
_useState2 = _slicedToArray(_useState, 2),
listState = _useState2[0],
setListState = _useState2[1];
(0, _taroWeapp.useEffect)(function () {
var list = props.list || [];
setListState(list.map(function (item) {
item.cu_swiper_id = (0, _index.generateId)();
return item;
}));
}, [props.list]);
var swiperTypeClassName = function swiperTypeClassName(type) {
return type ? type + "-swiper" : "screen-swiper";
};
var dotClassName = function dotClassName(type) {
return type === "round" ? type + "-dot" : "square-dot";
};
var duration = props.duration || 500;
var interval = props.interval || 5000;
var indicatorDots = !!props.indicatorDots;
var indicatorColor = props.indicatorColor || "#000";
var indicatorActiveColor = props.indicatorActiveColor || "#FFF";
var circular = !!props.circular;
var autoplay = function autoplay(autoplayData) {
return !!autoplayData;
};
var loop = function loop(loopData) {
return !!loopData;
};
var muted = function muted(mutedData) {
return !!mutedData;
};
var showPlayBtn = function showPlayBtn(showPlayBtnData) {
return !!showPlayBtnData;
};
var controls = function controls(controlsData) {
return !!controlsData;
};
var title = function title(titleData) {
return titleData;
};
var poster = function poster(posterData) {
return posterData;
};
var list = listState || [];
var autoplaySwiper = props.autoplay;
var _useState3 = (0, _taroWeapp.useState)(0),
_useState4 = _slicedToArray(_useState3, 2),
cur = _useState4[0],
setCur = _useState4[1];
var onChange = function onChange(e) {
var current = e.detail.current;
setCur(current);
props.onChange && props.onChange(current);
};
var onClick = function onClick(index) {
props.onClick && props.onClick(index);
};
// const onTouchMove = e => {}
// const onTouchStart = e => {}
// const onTouchEnd = e => {}
var renderClosureImg = function renderClosureImg(_$uid) {
return function (item) {
return {
item: item
};
};
};
var renderClosureVideo = function renderClosureVideo(_$uid) {
return function (item) {
var anonymousState__temp19 = autoplay(item.autoplay);
var anonymousState__temp20 = loop(item.loop);
var anonymousState__temp21 = muted(item.muted);
var anonymousState__temp22 = showPlayBtn(item.showPlayBtn);
var anonymousState__temp23 = controls(item.controls);
var anonymousState__temp24 = title(item.title);
var anonymousState__temp25 = poster(item.poster);
return {
anonymousState__temp19: anonymousState__temp19,
anonymousState__temp20: anonymousState__temp20,
anonymousState__temp21: anonymousState__temp21,
anonymousState__temp22: anonymousState__temp22,
anonymousState__temp23: anonymousState__temp23,
anonymousState__temp24: anonymousState__temp24,
anonymousState__temp25: anonymousState__temp25,
item: item
};
};
};
var anonymousState__temp9 = (0, _index.classNames)(dotClassName(props.dot) + " " + swiperTypeClassName(props.type), props.className);
var anonymousState__temp10 = (0, _taroWeapp.internal_inline_style)(Object.assign({}, props.style));
this.anonymousFunc0 = onChange;
var anonymousState__temp13 = (0, _index.classNames)(dotClassName(props.dot) + " " + swiperTypeClassName(props.type), props.className);
var anonymousState__temp14 = (0, _taroWeapp.internal_inline_style)(Object.assign({}, props.style));
this.anonymousFunc2 = onChange;
var anonymousState__temp15 = (0, _taroWeapp.pxTransform)(_index.isAliPay ? 70 * _index.screenPercent : 70);
var anonymousState__temp16 = (0, _taroWeapp.pxTransform)(_index.isAliPay ? 70 * _index.screenPercent : 70);
// const towerComponent = (
// <View className={swiperTypeClassName(props.type)} onTouchMove={onTouchMove} onTouchStart={onTouchStart} onTouchEnd={onTouchEnd}>
// <View className={`tower-item ${}`}></View>
// </View>
// );
var loopArray118 = list.map(function (item, index) {
item = {
$original: (0, _taroWeapp.internal_get_original)(item)
};
var $loopState__temp2 = item.$original.type !== "video" ? renderClosureImg(__prefix + "cgfzzzzzzz")(item.$original) : null;
var $loopState__temp4 = item.$original.type === "video" ? renderClosureVideo(__prefix + "cggzzzzzzz")(item.$original) : null;
var $loopState__temp12 = "key-" + index;
var _$indexKey = "cgjzz" + index;
_this2.anonymousFunc1Map[_$indexKey] = function () {
onClick(index);
};
return {
$loopState__temp2: $loopState__temp2,
$loopState__temp4: $loopState__temp4,
$loopState__temp12: $loopState__temp12,
_$indexKey: _$indexKey,
$original: item.$original
};
});
var loopArray119 = list.map(function (item, index) {
item = {
$original: (0, _taroWeapp.internal_get_original)(item)
};
var $loopState__temp6 = item.$original.type === "image" ? renderClosureImg(__prefix + "cghzzzzzzz")(item.$original) : null;
var $loopState__temp8 = item.$original.type === "video" ? renderClosureVideo(__prefix + "cgizzzzzzz")(item.$original) : null;
var $loopState__temp18 = "key-" + index;
var _$indexKey2 = "chazz" + index;
_this2.anonymousFunc3Map[_$indexKey2] = function () {
onClick(index);
};
return {
$loopState__temp6: $loopState__temp6,
$loopState__temp8: $loopState__temp8,
$loopState__temp18: $loopState__temp18,
_$indexKey2: _$indexKey2,
$original: item.$original
};
});
Object.assign(this.__state, {
anonymousState__temp9: anonymousState__temp9,
anonymousState__temp10: anonymousState__temp10,
anonymousState__temp13: anonymousState__temp13,
anonymousState__temp14: anonymousState__temp14,
anonymousState__temp15: anonymousState__temp15,
anonymousState__temp16: anonymousState__temp16,
loopArray118: loopArray118,
loopArray119: loopArray119,
circular: circular,
indicatorDots: indicatorDots,
indicatorColor: indicatorColor,
indicatorActiveColor: indicatorActiveColor,
interval: interval,
duration: duration,
autoplaySwiper: autoplaySwiper,
list: list,
cur: cur,
props: props
});
return this.__state;
}
}, {
key: "anonymousFunc0",
value: function anonymousFunc0(e) {
;
}
}, {
key: "anonymousFunc1",
value: function anonymousFunc1(_$indexKey) {
var _anonymousFunc1Map;
;
for (var _len2 = arguments.length, e = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
e[_key2 - 1] = arguments[_key2];
}
return this.anonymousFunc1Map[_$indexKey] && (_anonymousFunc1Map = this.anonymousFunc1Map)[_$indexKey].apply(_anonymousFunc1Map, e);
}
}, {
key: "anonymousFunc2",
value: function anonymousFunc2(e) {
;
}
}, {
key: "anonymousFunc3",
value: function anonymousFunc3(_$indexKey2) {
var _anonymousFunc3Map;
;
for (var _len3 = arguments.length, e = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
e[_key3 - 1] = arguments[_key3];
}
return this.anonymousFunc3Map[_$indexKey2] && (_anonymousFunc3Map = this.anonymousFunc3Map)[_$indexKey2].apply(_anonymousFunc3Map, e);
}
}]);
return ClSwiper;
}(_taroWeapp2.default.Component);
ClSwiper.$$events = ["anonymousFunc0", "anonymousFunc1", "anonymousFunc2", "anonymousFunc3"];
ClSwiper.multipleSlots = true;
ClSwiper.$$componentPath = "components/swiper/index";
ClSwiper.options = {
addGlobalClass: true
};
ClSwiper.defaultProps = {
autoplay: false,
type: "screen",
list: [],
dot: "square",
duration: 500,
onClick: function onClick() {},
indicatorDots: false,
indicatorColor: "#000",
indicatorActiveColor: "#FFF",
interval: 5000,
circular: false,
onChange: function onChange() {}
};
exports.default = ClSwiper;
Component(__webpack_require__(/*! @tarojs/taro-weapp */ "./node_modules/@tarojs/taro-weapp/index.js").default.createComponent(ClSwiper));
/***/ }),
/***/ "./node_modules/file-loader/dist/cjs.js?name=[path][name].wxml&context=/Users/jinbai/Documents/develop/github/mp-colorui-old/mp-colorui/src!./node_modules/@tarojs/mini-runner/dist/loaders/miniTemplateLoader.js!./node_modules/@tarojs/mini-runner/dist/loaders/wxTransformerLoader.js?!./src/components/swiper/index.tsx?taro&type=template&parse=COMPONENT&":
/*!*******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/file-loader/dist/cjs.js?name=[path][name].wxml&context=/Users/jinbai/Documents/develop/github/mp-colorui-old/mp-colorui/src!./node_modules/@tarojs/mini-runner/dist/loaders/miniTemplateLoader.js!./node_modules/@tarojs/mini-runner/dist/loaders/wxTransformerLoader.js??ref--4-0!./src/components/swiper/index.tsx?taro&type=template&parse=COMPONENT& ***!
\*******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__.p + "components/swiper/index.wxml";
/***/ }),
/***/ "./src/components/swiper/index.scss":
/*!******************************************!*\
!*** ./src/components/swiper/index.scss ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "./src/components/swiper/index.tsx":
/*!*****************************************!*\
!*** ./src/components/swiper/index.tsx ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _index_tsx_taro_type_template_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index.tsx?taro&type=template&parse=COMPONENT& */ "./src/components/swiper/index.tsx?taro&type=template&parse=COMPONENT&");
/* harmony import */ var _index_tsx_taro_type_script_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.tsx?taro&type=script&parse=COMPONENT& */ "./src/components/swiper/index.tsx?taro&type=script&parse=COMPONENT&");
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _index_tsx_taro_type_script_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_1__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _index_tsx_taro_type_script_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_1__[key]; }) }(__WEBPACK_IMPORT_KEY__));
/***/ }),
/***/ "./src/components/swiper/index.tsx?taro&type=script&parse=COMPONENT&":
/*!***************************************************************************!*\
!*** ./src/components/swiper/index.tsx?taro&type=script&parse=COMPONENT& ***!
\***************************************************************************/
/*! no static exports found */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_tarojs_mini_runner_dist_loaders_wxTransformerLoader_js_ref_4_0_index_tsx_taro_type_script_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/@tarojs/mini-runner/dist/loaders/wxTransformerLoader.js??ref--4-0!./index.tsx?taro&type=script&parse=COMPONENT& */ "./node_modules/@tarojs/mini-runner/dist/loaders/wxTransformerLoader.js?!./src/components/swiper/index.tsx?taro&type=script&parse=COMPONENT&");
/* harmony import */ var _node_modules_tarojs_mini_runner_dist_loaders_wxTransformerLoader_js_ref_4_0_index_tsx_taro_type_script_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_tarojs_mini_runner_dist_loaders_wxTransformerLoader_js_ref_4_0_index_tsx_taro_type_script_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_0__);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_tarojs_mini_runner_dist_loaders_wxTransformerLoader_js_ref_4_0_index_tsx_taro_type_script_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_tarojs_mini_runner_dist_loaders_wxTransformerLoader_js_ref_4_0_index_tsx_taro_type_script_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
/* harmony default export */ __webpack_exports__["default"] = (_node_modules_tarojs_mini_runner_dist_loaders_wxTransformerLoader_js_ref_4_0_index_tsx_taro_type_script_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_0___default.a);
/***/ }),
/***/ "./src/components/swiper/index.tsx?taro&type=template&parse=COMPONENT&":
/*!*****************************************************************************!*\
!*** ./src/components/swiper/index.tsx?taro&type=template&parse=COMPONENT& ***!
\*****************************************************************************/
/*! no static exports found */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_file_loader_dist_cjs_js_name_path_name_wxml_context_Users_jinbai_Documents_develop_github_mp_colorui_old_mp_colorui_src_node_modules_tarojs_mini_runner_dist_loaders_miniTemplateLoader_js_node_modules_tarojs_mini_runner_dist_loaders_wxTransformerLoader_js_ref_4_0_index_tsx_taro_type_template_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/file-loader/dist/cjs.js?name=[path][name].wxml&context=/Users/jinbai/Documents/develop/github/mp-colorui-old/mp-colorui/src!../../../node_modules/@tarojs/mini-runner/dist/loaders/miniTemplateLoader.js!../../../node_modules/@tarojs/mini-runner/dist/loaders/wxTransformerLoader.js??ref--4-0!./index.tsx?taro&type=template&parse=COMPONENT& */ "./node_modules/file-loader/dist/cjs.js?name=[path][name].wxml&context=/Users/jinbai/Documents/develop/github/mp-colorui-old/mp-colorui/src!./node_modules/@tarojs/mini-runner/dist/loaders/miniTemplateLoader.js!./node_modules/@tarojs/mini-runner/dist/loaders/wxTransformerLoader.js?!./src/components/swiper/index.tsx?taro&type=template&parse=COMPONENT&");
/* harmony import */ var _node_modules_file_loader_dist_cjs_js_name_path_name_wxml_context_Users_jinbai_Documents_develop_github_mp_colorui_old_mp_colorui_src_node_modules_tarojs_mini_runner_dist_loaders_miniTemplateLoader_js_node_modules_tarojs_mini_runner_dist_loaders_wxTransformerLoader_js_ref_4_0_index_tsx_taro_type_template_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_file_loader_dist_cjs_js_name_path_name_wxml_context_Users_jinbai_Documents_develop_github_mp_colorui_old_mp_colorui_src_node_modules_tarojs_mini_runner_dist_loaders_miniTemplateLoader_js_node_modules_tarojs_mini_runner_dist_loaders_wxTransformerLoader_js_ref_4_0_index_tsx_taro_type_template_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_0__);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_file_loader_dist_cjs_js_name_path_name_wxml_context_Users_jinbai_Documents_develop_github_mp_colorui_old_mp_colorui_src_node_modules_tarojs_mini_runner_dist_loaders_miniTemplateLoader_js_node_modules_tarojs_mini_runner_dist_loaders_wxTransformerLoader_js_ref_4_0_index_tsx_taro_type_template_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_file_loader_dist_cjs_js_name_path_name_wxml_context_Users_jinbai_Documents_develop_github_mp_colorui_old_mp_colorui_src_node_modules_tarojs_mini_runner_dist_loaders_miniTemplateLoader_js_node_modules_tarojs_mini_runner_dist_loaders_wxTransformerLoader_js_ref_4_0_index_tsx_taro_type_template_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
/***/ })
},[["./src/components/swiper/index.tsx","runtime","taro","vendors","common"]]]);