UNPKG

chenw-tool

Version:

React components using pure Bootstrap 5+ which does not contain any external style and script libraries.

140 lines (127 loc) 9.25 kB
/* * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). * This devtool is neither made for production nor for readable output files. * It uses "eval()" calls to create a separate source file in the browser devtools. * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) * or disable the default devtool with "devtool: false". * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("react")); else if(typeof define === 'function' && define.amd) define("myRadio", ["react"], factory); else if(typeof exports === 'object') exports["myRadio"] = factory(require("react")); else root["myRadio"] = factory(root["react"]); })(this, (__WEBPACK_EXTERNAL_MODULE_react__) => { return /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ /***/ "./src/Radio.scss": /*!************************!*\ !*** ./src/Radio.scss ***! \************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n//# sourceURL=webpack://myRadio/./src/Radio.scss?"); /***/ }), /***/ "./src/Radio.tsx": /*!***********************!*\ !*** ./src/Radio.tsx ***! \***********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Radio)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Radio_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Radio.scss */ \"./src/Radio.scss\");\n/* harmony import */ var _utils_cls__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils/cls */ \"../utils/cls.ts\");\n\n\n\nfunction Radio(_a) {\n var wrapperClassName = _a.wrapperClassName, label = _a.label, // 标题\n wrapperContentCalssName = _a.wrapperContentCalssName, radioList = _a.radioList, controlClassName = _a.controlClassName, groupName = _a.groupName, // radio的组名字\n defaultValue = _a.defaultValue, // 选中的值\n _b = _a.value, // 选中的值\n value = _b === void 0 ? \"value\" : _b, name = _a.name, radioChange = _a.radioChange, // 选择的回调\n _c = _a.type, // 选择的回调\n type = _c === void 0 ? \"block\" : _c;\n return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", { className: (0,_utils_cls__WEBPACK_IMPORTED_MODULE_2__.clsCombine)(\"radio-group__wrapper\", (0,_utils_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(wrapperClassName, \"mb-2 position-relative\")) },\n label ? (react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, typeof label === \"string\" ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"label\", null, label) : label)) : null,\n react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", { className: (0,_utils_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(wrapperContentCalssName, \"radio-group__content\") }, radioList.map(function (item, index) { return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", { className: type === \"inline\"\n ? \"form-check form-check-inline mb-0\"\n : \"form-check mb-0\", key: index },\n react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"input\", { className: (0,_utils_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(controlClassName, \"form-check-input\"), type: \"radio\", id: \"radio-group-\".concat(groupName, \"-\").concat(index), name: groupName, value: item[value], checked: defaultValue == item[value], onChange: function () {\n radioChange(item);\n } }),\n react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"label\", { className: \"form-check-label\", htmlFor: \"radio-group-\".concat(groupName, \"-\").concat(index) }, name ? item[name] : item.name))); }))));\n}\n\n\n//# sourceURL=webpack://myRadio/./src/Radio.tsx?"); /***/ }), /***/ "../utils/cls.ts": /*!***********************!*\ !*** ../utils/cls.ts ***! \***********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ clsCombine: () => (/* binding */ clsCombine),\n/* harmony export */ clsWrite: () => (/* binding */ clsWrite)\n/* harmony export */ });\nfunction clsWrite(s, defaultCls, targetCls) {\n if (s || s === \"\") {\n return targetCls !== undefined ? targetCls : s;\n }\n return defaultCls;\n}\nfunction clsCombine() {\n var classes = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n classes[_i] = arguments[_i];\n }\n return classes\n .map(function (cls) {\n if (typeof cls === \"string\") {\n return cls;\n }\n else if (typeof cls === \"object\" && cls !== null) {\n return Object.keys(cls)\n .filter(function (key) { return cls[key]; }) // 仅选择值为 true 的类名\n .join(\" \");\n }\n return \"\";\n })\n .filter(Boolean) // 过滤掉 falsy 值\n .join(\" \"); // 用空格连接\n}\n\n\n\n//# sourceURL=webpack://myRadio/../utils/cls.ts?"); /***/ }), /***/ "react": /*!************************!*\ !*** external "react" ***! \************************/ /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_MODULE_react__; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ /******/ /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module can't be inlined because the eval devtool is used. /******/ var __webpack_exports__ = __webpack_require__("./src/Radio.tsx"); /******/ /******/ return __webpack_exports__; /******/ })() ; });