UNPKG

mp-colorui

Version:

MP ColorUI 是一款基于 Taro 框架并且联合 Color-UI CSS 库开发的多端 UI 组件库(支持小程序端和H5端)

261 lines (207 loc) 17.3 kB
(wx["webpackJsonp"] = wx["webpackJsonp"] || []).push([["components/checkbox/h5/index"],{ /***/ "./node_modules/@tarojs/mini-runner/dist/loaders/wxTransformerLoader.js?!./src/components/checkbox/h5/index.tsx?taro&type=script&parse=COMPONENT&": /*!*****************************************************************************************************************************************************************!*\ !*** ./node_modules/@tarojs/mini-runner/dist/loaders/wxTransformerLoader.js??ref--4-0!./src/components/checkbox/h5/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 _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"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } 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 ClCheckboxH5 = function (_BaseComponent) { _inherits(ClCheckboxH5, _BaseComponent); function ClCheckboxH5() { var _ref; var _temp, _this, _ret; _classCallCheck(this, ClCheckboxH5); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = ClCheckboxH5.__proto__ || Object.getPrototypeOf(ClCheckboxH5)).call.apply(_ref, [this].concat(args))), _this), _this.$usedState = ["loopArray75", "directionClassName", "title", "colorClassName", "type", "list", "checkboxGroup", "color", "direction", "shape", "more"], _this.anonymousFunc0Map = {}, _this.customComponents = [], _temp), _possibleConstructorReturn(_this, _ret); } _createClass(ClCheckboxH5, [{ key: "_constructor", value: function _constructor() { _get(ClCheckboxH5.prototype.__proto__ || Object.getPrototypeOf(ClCheckboxH5.prototype), "_constructor", this).apply(this, arguments); this.state = { list: [] }; this.$$refs = new _taroWeapp2.default.RefsArray(); } }, { key: "componentDidUpdate", value: function componentDidUpdate(prevProps, prevState, snapshot) { var _this2 = this; if (prevProps.checkboxGroup !== this.props.checkboxGroup) { var currentCheckBox = this.props.checkboxGroup || []; this.setState({ list: currentCheckBox.map(function (checkbox) { var hasExit = _this2.state.list.find(function (item) { return item.key === checkbox.key; }); return hasExit ? Object.assign(hasExit, checkbox) : checkbox; }) }); } } }, { key: "componentDidMount", value: function componentDidMount() { this.setState({ list: this.props.checkboxGroup || [] }); } }, { key: "change", value: function change() { var arr = this.state.list.filter(function (item) { return item.checked; }).map(function (item) { return item.value || ""; }); this.props.onChange && this.props.onChange(arr); } }, { key: "_createData", value: function _createData() { var _this3 = this; this.__state = arguments[0] || this.state || {}; this.__props = arguments[1] || this.props || {}; var __isRunloopRef = arguments[2]; var __prefix = this.$prefix; ; var colorClassName = this.__props.color || "green"; var type = this.__props.type === "form" ? "form" : ""; var directionClassName = this.__props.direction === "horizontal" ? "flex" : ""; var title = this.__props.title; var loopArray75 = this.__state.list.map(function (item, __index0) { item = { $original: (0, _taroWeapp.internal_get_original)(item) }; var $loopState__temp2 = item.$original.key ? (0, _taroWeapp.internal_inline_style)({ lineHeight: "" + (0, _taroWeapp.pxTransform)(46), display: "inline-block", verticalAlign: "text-bottom" }) : null; var $loopState__temp4 = (0, _index.classNames)(["h5-checkbox-input", { round: _this3.__props.shape, checked: item.$original.checked, disabled: item.$original.disabled, more: _this3.__props.more }]); var _$indexKey = "bhgzz" + __index0; _this3.anonymousFunc0Map[_$indexKey] = function () { if (!item.$original.disabled) { var checkItem = _this3.__state.list && _this3.__state.list.find(function (has) { return has.value === item.$original.value; }); if (checkItem) { checkItem.checked = !item.$original.checked; }_this3.setState({ list: [].concat(_toConsumableArray(_this3.__state.list)) }); _this3.change(); } }; return { $loopState__temp2: $loopState__temp2, $loopState__temp4: $loopState__temp4, _$indexKey: _$indexKey, $original: item.$original }; }); Object.assign(this.__state, { loopArray75: loopArray75, directionClassName: directionClassName, title: title, colorClassName: colorClassName, type: type }); return this.__state; } }, { key: "anonymousFunc0", value: function anonymousFunc0(_$indexKey) { var _anonymousFunc0Map; ; for (var _len2 = arguments.length, e = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { e[_key2 - 1] = arguments[_key2]; } return this.anonymousFunc0Map[_$indexKey] && (_anonymousFunc0Map = this.anonymousFunc0Map)[_$indexKey].apply(_anonymousFunc0Map, e); } }]); return ClCheckboxH5; }(_taroWeapp.Component); ClCheckboxH5.$$events = ["anonymousFunc0"]; ClCheckboxH5.$$componentPath = "components/checkbox/h5/index"; ClCheckboxH5.options = { addGlobalClass: true }; ClCheckboxH5.defaultProps = { color: "green", type: "normal", shape: "normal", direction: "vertical", checkboxGroup: [], title: "" }; exports.default = ClCheckboxH5; Component(__webpack_require__(/*! @tarojs/taro-weapp */ "./node_modules/@tarojs/taro-weapp/index.js").default.createComponent(ClCheckboxH5)); /***/ }), /***/ "./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/checkbox/h5/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/checkbox/h5/index.tsx?taro&type=template&parse=COMPONENT& ***! \************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__.p + "components/checkbox/h5/index.wxml"; /***/ }), /***/ "./src/components/checkbox/h5/index.tsx": /*!**********************************************!*\ !*** ./src/components/checkbox/h5/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/checkbox/h5/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/checkbox/h5/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/checkbox/h5/index.tsx?taro&type=script&parse=COMPONENT&": /*!********************************************************************************!*\ !*** ./src/components/checkbox/h5/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/checkbox/h5/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/checkbox/h5/index.tsx?taro&type=template&parse=COMPONENT&": /*!**********************************************************************************!*\ !*** ./src/components/checkbox/h5/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/checkbox/h5/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/checkbox/h5/index.tsx","runtime","taro","vendors","common"]]]);