You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1602 lines
62 KiB
1602 lines
62 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[91257],{
|
|
|
|
/***/ 46820:
|
|
/*!********************************************************************************************************!*\
|
|
!*** ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/SearchOutlined.js + 1 modules ***!
|
|
\********************************************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ icons_SearchOutlined; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/esm/extends.js
|
|
var esm_extends = __webpack_require__(26508);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons-svg@4.3.1@@ant-design/icons-svg/es/asn/SearchOutlined.js
|
|
// This icon file is generated automatically.
|
|
var SearchOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z" } }] }, "name": "search", "theme": "outlined" };
|
|
/* harmony default export */ var asn_SearchOutlined = (SearchOutlined);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/components/AntdIcon.js + 3 modules
|
|
var AntdIcon = __webpack_require__(91851);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/SearchOutlined.js
|
|
|
|
// GENERATE BY ./scripts/generate.ts
|
|
// DON NOT EDIT IT MANUALLY
|
|
|
|
|
|
|
|
|
|
var SearchOutlined_SearchOutlined = function SearchOutlined(props, ref) {
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
|
|
ref: ref,
|
|
icon: asn_SearchOutlined
|
|
}));
|
|
};
|
|
if (false) {}
|
|
/* harmony default export */ var icons_SearchOutlined = (/*#__PURE__*/_react_17_0_2_react.forwardRef(SearchOutlined_SearchOutlined));
|
|
|
|
/***/ }),
|
|
|
|
/***/ 13205:
|
|
/*!**********************************************************!*\
|
|
!*** ./src/components/Video/Modal/index.tsx + 1 modules ***!
|
|
\**********************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
K: function() { return /* binding */ VideoModal; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
|
|
var modal = __webpack_require__(43418);
|
|
// EXTERNAL MODULE: ./src/components/Video/Play/index.jsx + 1 modules
|
|
var Play = __webpack_require__(64716);
|
|
;// CONCATENATED MODULE: ./src/components/Video/Modal/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Modalmodules = ({"modal":"modal___LGwws","closeIcon":"closeIcon___vsUXI","wrap":"wrap___tDzbl","input":"input___aikQk"});
|
|
// EXTERNAL MODULE: ./node_modules/_js-base64@2.6.4@js-base64/base64.js
|
|
var base64 = __webpack_require__(24334);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
;// CONCATENATED MODULE: ./src/components/Video/Modal/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var VideoModal = function VideoModal(_ref) {
|
|
var visible = _ref.visible,
|
|
width = _ref.width,
|
|
videoId = _ref.videoId,
|
|
file_url = _ref.file_url,
|
|
course_id = _ref.course_id,
|
|
copyUrl = _ref.copyUrl,
|
|
_ref$toLog = _ref.toLog,
|
|
toLog = _ref$toLog === void 0 ? true : _ref$toLog,
|
|
_ref$logWatchHistory = _ref.logWatchHistory,
|
|
logWatchHistory = _ref$logWatchHistory === void 0 ? function () {} : _ref$logWatchHistory,
|
|
allow_skip = _ref.allow_skip,
|
|
_ref$onClose = _ref.onClose,
|
|
onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose,
|
|
_ref$autoPlay = _ref.autoPlay,
|
|
autoPlay = _ref$autoPlay === void 0 ? false : _ref$autoPlay,
|
|
_ref$onPlayEnded = _ref.onPlayEnded,
|
|
onPlayEnded = _ref$onPlayEnded === void 0 ? function () {} : _ref$onPlayEnded;
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(modal/* default */.Z, {
|
|
centered: true,
|
|
keyboard: false,
|
|
closable: false,
|
|
destroyOnClose: true,
|
|
open: visible,
|
|
title: null,
|
|
footer: null,
|
|
width: width,
|
|
className: Modalmodules.modal,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "".concat(Modalmodules.closeIcon, " iconfont icon-guanbi10"),
|
|
onClick: onClose
|
|
}), visible && /*#__PURE__*/(0,jsx_runtime.jsx)(Play/* default */.Z, {
|
|
onPlayEnded: onPlayEnded,
|
|
autoPlay: autoPlay,
|
|
allow_skip: allow_skip,
|
|
courseId: course_id,
|
|
src: file_url !== null && file_url !== void 0 && file_url.startsWith("http") ? file_url : base64.Base64.decode(file_url),
|
|
videoId: videoId,
|
|
toLog: toLog,
|
|
logWatchHistory: logWatchHistory
|
|
})]
|
|
});
|
|
};
|
|
|
|
/***/ }),
|
|
|
|
/***/ 57716:
|
|
/*!****************************************************************************!*\
|
|
!*** ./src/pages/Classrooms/Lists/ResourceRecommend/index.tsx + 3 modules ***!
|
|
\****************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
// ESM COMPAT FLAG
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
"default": function() { return /* binding */ Lists_ResourceRecommend; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js
|
|
var regeneratorRuntime = __webpack_require__(10574);
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__(26801);
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/asyncToGenerator.js
|
|
var asyncToGenerator = __webpack_require__(39343);
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js
|
|
var slicedToArray = __webpack_require__(11006);
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectWithoutProperties.js
|
|
var objectWithoutProperties = __webpack_require__(27161);
|
|
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts + 8 modules
|
|
var _umi_production_exports = __webpack_require__(7181);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
|
|
var message = __webpack_require__(8591);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/rate/index.js + 8 modules
|
|
var rate = __webpack_require__(19479);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/spin/index.js + 1 modules
|
|
var spin = __webpack_require__(71418);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/pagination/index.js + 10 modules
|
|
var pagination = __webpack_require__(41867);
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
var fetch = __webpack_require__(4781);
|
|
// EXTERNAL MODULE: ./src/utils/authority.ts
|
|
var authority = __webpack_require__(71633);
|
|
// EXTERNAL MODULE: ./src/components/NoData/index.tsx
|
|
var NoData = __webpack_require__(31917);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/card/index.js + 4 modules
|
|
var card = __webpack_require__(18889);
|
|
// EXTERNAL MODULE: ./src/assets/images/video/default.png
|
|
var video_default = __webpack_require__(55988);
|
|
// EXTERNAL MODULE: ./src/assets/images/video/play.png
|
|
var play = __webpack_require__(36193);
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/ResourceRecommend/components/Items/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Itemsmodules = ({"flex_box_center":"flex_box_center___riBIL","flex_space_between":"flex_space_between___QnIxq","flex_box_vertical_center":"flex_box_vertical_center___lDoLU","flex_box_center_end":"flex_box_center_end___cJ2F_","flex_box_column":"flex_box_column___PSzC7","wrap":"wrap___Mlk1H","mask":"mask___MVQfB","playIconWrap":"playIconWrap___QcDy0","playIcon":"playIcon___MXK2W","linkWrap":"linkWrap___rXjTB","link":"link___uEr60","imgWrap":"imgWrap___nCe4C","cardBottom":"cardBottom___CqJQC","bottomTitle":"bottomTitle___oTGoY","timeWrap":"timeWrap___ioirP","time":"time___hl75k","bottomActionWrap":"bottomActionWrap___RhhZY","peopleWrap":"peopleWrap___TwLjM","actionIcon":"actionIcon___BfAaN"});
|
|
// EXTERNAL MODULE: ./src/components/Video/Modal/index.tsx + 1 modules
|
|
var Modal = __webpack_require__(13205);
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
var env = __webpack_require__(26078);
|
|
// EXTERNAL MODULE: ./node_modules/_js-base64@2.6.4@js-base64/base64.js
|
|
var base64 = __webpack_require__(24334);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/ResourceRecommend/components/Items/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Items = function Items(_ref) {
|
|
var data = _ref.data,
|
|
params = _ref.params,
|
|
onSend = _ref.onSend;
|
|
var _useState = (0,_react_17_0_2_react.useState)(),
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
visible = _useState2[0],
|
|
setVisible = _useState2[1];
|
|
var _useState3 = (0,_react_17_0_2_react.useState)({}),
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
currentVideo = _useState4[0],
|
|
setCurrentVideo = _useState4[1];
|
|
var DEFAULT_VIDEO_WIDTH_IN_MD = "90%"; // 400
|
|
var DEFAULT_VIDEO_HEIGHT_IN_MD = "55%"; // 400
|
|
|
|
var handleVideoClick = function handleVideoClick(item) {
|
|
if (item.link) {
|
|
return;
|
|
}
|
|
setVisible(true);
|
|
setCurrentVideo({
|
|
videoId: item.id,
|
|
course_id: params['coursesId'],
|
|
file_url: item.play_url || item.file_url,
|
|
copyUrl: getCopyText(item.play_url || item.file_url, item.cover_url),
|
|
logWatchHistory: function logWatchHistory() {}
|
|
});
|
|
};
|
|
var getCopyText = function getCopyText(file_url, cover_url) {
|
|
var url = base64.Base64.decode(file_url);
|
|
if (file_url) {
|
|
return "<video src=\"".concat(url, "\" controls=\"true\" controlslist=\"nodownload\" width=\"").concat(DEFAULT_VIDEO_WIDTH_IN_MD, "\" height=\"").concat(DEFAULT_VIDEO_HEIGHT_IN_MD, "\" poster=\"").concat(cover_url, "\">\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 video \u6807\u7B7E\u3002</video>");
|
|
}
|
|
};
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
children: [data === null || data === void 0 ? void 0 : data.map(function (item, key) {
|
|
var _item$cover_url;
|
|
var imgUrl = item !== null && item !== void 0 && item.cover_url ? item !== null && item !== void 0 && (_item$cover_url = item.cover_url) !== null && _item$cover_url !== void 0 && _item$cover_url.includes('https') ? item.cover_url : env/* default */.Z.API_SERVER + item.cover_url : video_default;
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
className: Itemsmodules.wrap,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(card/* default */.Z, {
|
|
className: "animated fadeIn ".concat(Itemsmodules.cardWrap),
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
|
|
tip: "\u6B63\u5728\u8F6C\u7801\uFF0C\u8BF7\u7A0D\u7B49...",
|
|
spinning: !item.transcoded && !item.link,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
className: Itemsmodules.imgWrap,
|
|
onClick: function onClick() {
|
|
handleVideoClick(item);
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
src: imgUrl
|
|
}), item.link && /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
className: Itemsmodules.linkWrap,
|
|
href: item.link,
|
|
target: "_blank",
|
|
title: item.title,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Itemsmodules.link,
|
|
children: "\u5916\u94FE"
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Itemsmodules.mask
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Itemsmodules.playIconWrap,
|
|
children: !item.link && /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
className: Itemsmodules.playIcon,
|
|
src: play
|
|
})
|
|
})]
|
|
})]
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Itemsmodules.cardBottom,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
title: item.title,
|
|
className: Itemsmodules.bottomTitle,
|
|
children: item.title
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Itemsmodules.bottomActionWrap,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
children: ["\u8BFE\u7A0B\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
title: item.subject,
|
|
children: item.subject
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("b", {
|
|
onClick: function onClick() {
|
|
return onSend(item);
|
|
},
|
|
children: "\u4F7F\u7528\u89C6\u9891"
|
|
})]
|
|
})]
|
|
})]
|
|
})
|
|
}, item.id);
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Modal/* VideoModal */.K, objectSpread2_default()(objectSpread2_default()({}, currentVideo), {}, {
|
|
visible: visible,
|
|
width: 800,
|
|
onClose: function onClose() {
|
|
setVisible(false);
|
|
setCurrentVideo({});
|
|
}
|
|
}))]
|
|
});
|
|
};
|
|
/* harmony default export */ var components_Items = ((0,_umi_production_exports.connect)(function (_ref2) {
|
|
var classroomList = _ref2.classroomList;
|
|
return {
|
|
classroomList: classroomList
|
|
};
|
|
})(Items));
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/ResourceRecommend/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var ResourceRecommendmodules = ({"flex_box_center":"flex_box_center___p5F4p","flex_space_between":"flex_space_between___XpX93","flex_box_vertical_center":"flex_box_vertical_center___CZqxk","flex_box_center_end":"flex_box_center_end___CinPQ","flex_box_column":"flex_box_column___RMknq","wrap":"wrap___fNq3s","listWrap":"listWrap____pT8s","list":"list___xQ3gD","top":"top___KkWz1","bottom":"bottom___MTHH1","tag":"tag___Sj7ii","rate":"rate___RKAhp","videoWrap":"videoWrap___Kv7Tg"});
|
|
// EXTERNAL MODULE: ./src/pages/Classrooms/Lists/components/TabMenu/index.tsx + 1 modules
|
|
var TabMenu = __webpack_require__(79512);
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/ResourceRecommend/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["classroomList", "globalSetting", "user", "dispatch"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ResourceRecommend = function ResourceRecommend(_ref) {
|
|
var classroomList = _ref.classroomList,
|
|
globalSetting = _ref.globalSetting,
|
|
user = _ref.user,
|
|
dispatch = _ref.dispatch,
|
|
props = objectWithoutProperties_default()(_ref, _excluded);
|
|
var urlParams = (0,_umi_production_exports.useParams)();
|
|
var detailTopBanner = classroomList.detailTopBanner,
|
|
detailLeftMenus = classroomList.detailLeftMenus,
|
|
shareStatus = classroomList.shareStatus;
|
|
var _useState = (0,_react_17_0_2_react.useState)("1"),
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
currentKey = _useState2[0],
|
|
setCurrentKey = _useState2[1];
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(0),
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
total = _useState4[0],
|
|
setTotal = _useState4[1];
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(true),
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
loading = _useState6[0],
|
|
setLoading = _useState6[1];
|
|
var _useState7 = (0,_react_17_0_2_react.useState)([]),
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
list = _useState8[0],
|
|
setList = _useState8[1];
|
|
var _useState9 = (0,_react_17_0_2_react.useState)({
|
|
page: 1,
|
|
limit: 9,
|
|
order: 'random'
|
|
}),
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
params = _useState10[0],
|
|
setParams = _useState10[1];
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
params.page = 1;
|
|
dealGetList(params);
|
|
}, [currentKey]);
|
|
var getData = /*#__PURE__*/function () {
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(record) {
|
|
var res;
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
while (1) switch (_context.prev = _context.next) {
|
|
case 0:
|
|
setLoading(true);
|
|
_context.next = 3;
|
|
return (0,fetch/* default */.ZP)("/api/courses/".concat(urlParams === null || urlParams === void 0 ? void 0 : urlParams.coursesId, "/ilearning_resource.json"), {
|
|
method: 'get',
|
|
params: objectSpread2_default()({
|
|
type: 1
|
|
}, record)
|
|
});
|
|
case 3:
|
|
res = _context.sent;
|
|
if (res !== null && res !== void 0 && res.shixuns) {
|
|
setList((res === null || res === void 0 ? void 0 : res.shixuns) || []);
|
|
setTotal(res === null || res === void 0 ? void 0 : res.total_count);
|
|
}
|
|
setLoading(false);
|
|
case 6:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}, _callee);
|
|
}));
|
|
return function getData(_x) {
|
|
return _ref2.apply(this, arguments);
|
|
};
|
|
}();
|
|
var getVideoData = /*#__PURE__*/function () {
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(record) {
|
|
var res;
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
case 0:
|
|
setLoading(true);
|
|
_context2.next = 3;
|
|
return (0,fetch/* default */.ZP)("/api/courses/".concat(urlParams === null || urlParams === void 0 ? void 0 : urlParams.coursesId, "/ilearning_resource.json"), {
|
|
method: 'get',
|
|
params: objectSpread2_default()({
|
|
type: 2
|
|
}, record)
|
|
});
|
|
case 3:
|
|
res = _context2.sent;
|
|
if (res !== null && res !== void 0 && res.videos) {
|
|
setList((res === null || res === void 0 ? void 0 : res.videos) || []);
|
|
setTotal(res === null || res === void 0 ? void 0 : res.total_count);
|
|
}
|
|
setLoading(false);
|
|
case 6:
|
|
case "end":
|
|
return _context2.stop();
|
|
}
|
|
}, _callee2);
|
|
}));
|
|
return function getVideoData(_x2) {
|
|
return _ref3.apply(this, arguments);
|
|
};
|
|
}();
|
|
var dealGetList = function dealGetList(record) {
|
|
if (currentKey === '1') {
|
|
getData(record);
|
|
} else {
|
|
getVideoData(record);
|
|
}
|
|
};
|
|
var onMenuSelect = function onMenuSelect(v) {
|
|
setCurrentKey(v.key);
|
|
};
|
|
var Menus = [{
|
|
name: '实训资源推荐',
|
|
id: '1'
|
|
}, {
|
|
name: '视频资源推荐',
|
|
id: '2'
|
|
}];
|
|
var handleChange = function handleChange(page) {
|
|
params.page = page;
|
|
setParams(objectSpread2_default()({}, params));
|
|
if (currentKey === '1') {
|
|
getData(params);
|
|
} else {
|
|
getVideoData(params);
|
|
}
|
|
};
|
|
var handleSend = /*#__PURE__*/function () {
|
|
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(v) {
|
|
var res;
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
case 0:
|
|
_context3.next = 2;
|
|
return (0,fetch/* default */.ZP)("/api/shixuns/".concat(v.identifier, "/send_to_course.json"), {
|
|
method: 'post',
|
|
body: {
|
|
id: v.identifier,
|
|
identifier: v.identifier,
|
|
courses: [{
|
|
course_id: urlParams === null || urlParams === void 0 ? void 0 : urlParams.coursesId,
|
|
id: v.identifier,
|
|
identifier: v.identifier,
|
|
type: "normal",
|
|
is_use: 1,
|
|
is_copy: 0
|
|
}]
|
|
}
|
|
});
|
|
case 2:
|
|
res = _context3.sent;
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 1) {
|
|
dispatch({
|
|
type: 'classroomList/getClassroomLeftMenus',
|
|
payload: {
|
|
id: urlParams.coursesId
|
|
}
|
|
});
|
|
message/* default */.ZP.success('使用成功');
|
|
}
|
|
case 4:
|
|
case "end":
|
|
return _context3.stop();
|
|
}
|
|
}, _callee3);
|
|
}));
|
|
return function handleSend(_x3) {
|
|
return _ref4.apply(this, arguments);
|
|
};
|
|
}();
|
|
var handleVideoSend = /*#__PURE__*/function () {
|
|
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4(v) {
|
|
var subject_id, res;
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
case 0:
|
|
subject_id = 'jpl5vs26';
|
|
console.log(v);
|
|
_context4.next = 4;
|
|
return (0,fetch/* default */.ZP)("/api/paths/".concat(v === null || v === void 0 ? void 0 : v.subject_identifier, "/send_to_course.json"), {
|
|
method: 'post',
|
|
body: {
|
|
course_id: detailTopBanner === null || detailTopBanner === void 0 ? void 0 : detailTopBanner.course_id,
|
|
id: v === null || v === void 0 ? void 0 : v.subject_identifier,
|
|
stage_shixuns: [{
|
|
stage_shixun_id: v.stage_shixun_id,
|
|
is_copy: 0,
|
|
is_use: 1
|
|
}],
|
|
type: "video",
|
|
sync_catelog: 0
|
|
}
|
|
});
|
|
case 4:
|
|
res = _context4.sent;
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 1) {
|
|
dispatch({
|
|
type: 'classroomList/getClassroomLeftMenus',
|
|
payload: {
|
|
id: urlParams === null || urlParams === void 0 ? void 0 : urlParams.coursesId
|
|
}
|
|
});
|
|
message/* default */.ZP.success('使用成功');
|
|
}
|
|
case 6:
|
|
case "end":
|
|
return _context4.stop();
|
|
}
|
|
}, _callee4);
|
|
}));
|
|
return function handleVideoSend(_x4) {
|
|
return _ref5.apply(this, arguments);
|
|
};
|
|
}();
|
|
var renderList = function renderList() {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: ResourceRecommendmodules.listWrap,
|
|
children: list === null || list === void 0 ? void 0 : list.map(function (e, i) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: ResourceRecommendmodules.list,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: ResourceRecommendmodules.top,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
title: e.name,
|
|
children: e.name
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
onClick: function onClick() {
|
|
return handleSend(e);
|
|
},
|
|
children: "\u4F7F\u7528\u5B9E\u8BAD"
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: ResourceRecommendmodules.bottom,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: ResourceRecommendmodules.tag,
|
|
children: e === null || e === void 0 ? void 0 : e.author_name
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: ResourceRecommendmodules.tag,
|
|
children: e === null || e === void 0 ? void 0 : e.author_school_name
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: ResourceRecommendmodules.tag,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
children: "\u5173\u5361"
|
|
}), e === null || e === void 0 ? void 0 : e.challenges_count]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: ResourceRecommendmodules.tag,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
children: "\u5B66\u4E60\u4EBA\u6570"
|
|
}), e === null || e === void 0 ? void 0 : e.myshixuns_count]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: ResourceRecommendmodules.rate,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(rate/* default */.Z, {
|
|
allowHalf: true,
|
|
disabled: true,
|
|
defaultValue: e.score_info
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
className: "font14",
|
|
children: ["\xA0", e.score_info ? "".concat(e.score_info, "\u5206") : '5分']
|
|
})]
|
|
})]
|
|
})]
|
|
}, e.id);
|
|
})
|
|
});
|
|
};
|
|
var renderVideoList = function renderVideoList() {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: ResourceRecommendmodules.videoWrap,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(components_Items, {
|
|
params: urlParams,
|
|
dispatch: dispatch,
|
|
data: list,
|
|
onSend: handleVideoSend
|
|
})
|
|
});
|
|
};
|
|
var isAllow = !!(detailTopBanner !== null && detailTopBanner !== void 0 && detailTopBanner.sub_discipline_id);
|
|
console.log('detailTopBanner');
|
|
console.log(!!(detailTopBanner !== null && detailTopBanner !== void 0 && detailTopBanner.sub_discipline_id));
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
className: ResourceRecommendmodules.wrap,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(TabMenu/* default */.Z, {
|
|
isLoading: false,
|
|
tabDataSource: Menus,
|
|
isAdmin: (0,authority/* isAdmin */.GJ)(),
|
|
onTabMenuClick: onMenuSelect,
|
|
defaultSelectedKeys: [currentKey],
|
|
extraNode: (0,authority/* isAdmin */.GJ)() && isAllow && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
className: "c-blue font14 ml20 current",
|
|
onClick: function onClick(e) {
|
|
e.preventDefault();
|
|
dealGetList(params);
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "iconfont icon-huanyipi font14 mr5"
|
|
}), "\u6362\u4E00\u6279"]
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
|
|
spinning: loading,
|
|
children: total === 0 ? /*#__PURE__*/(0,jsx_runtime.jsx)(NoData/* default */.Z, {}) : currentKey === '1' ? renderList() : renderVideoList()
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(pagination/* default */.Z, {
|
|
hideOnSinglePage: true,
|
|
onChange: function onChange(page) {
|
|
return handleChange(page);
|
|
},
|
|
current: params.page,
|
|
pageSize: params.limit,
|
|
total: total,
|
|
showQuickJumper: true,
|
|
showSizeChanger: false,
|
|
showTotal: function showTotal(total) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
className: "mr10",
|
|
children: ["\u5171", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: "c-orange",
|
|
children: total
|
|
}), "\u6761\u6570\u636E"]
|
|
});
|
|
},
|
|
className: "tr pb20"
|
|
})]
|
|
});
|
|
};
|
|
/* harmony default export */ var Lists_ResourceRecommend = ((0,_umi_production_exports.connect)(function (_ref6) {
|
|
var classroomList = _ref6.classroomList,
|
|
user = _ref6.user,
|
|
globalSetting = _ref6.globalSetting;
|
|
return {
|
|
user: user,
|
|
classroomList: classroomList,
|
|
globalSetting: globalSetting
|
|
};
|
|
})(ResourceRecommend));
|
|
|
|
/***/ }),
|
|
|
|
/***/ 38854:
|
|
/*!************************************************************************!*\
|
|
!*** ./node_modules/_antd@5.9.0@antd/es/dropdown/index.js + 1 modules ***!
|
|
\************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ es_dropdown; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/dropdown/dropdown.js
|
|
var dropdown = __webpack_require__(91857);
|
|
// EXTERNAL MODULE: ./node_modules/_classnames@2.3.2@classnames/index.js
|
|
var _classnames_2_3_2_classnames = __webpack_require__(12124);
|
|
var _classnames_2_3_2_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_3_2_classnames);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/EllipsisOutlined.js + 1 modules
|
|
var EllipsisOutlined = __webpack_require__(93319);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
var es_button = __webpack_require__(3113);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/config-provider/context.js
|
|
var context = __webpack_require__(36355);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/space/index.js + 3 modules
|
|
var space = __webpack_require__(81327);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/space/Compact.js
|
|
var Compact = __webpack_require__(33234);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/dropdown/style/index.js + 1 modules
|
|
var style = __webpack_require__(47211);
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/dropdown/dropdown-button.js
|
|
"use client";
|
|
|
|
var __rest = undefined && undefined.__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;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const DropdownButton = props => {
|
|
const {
|
|
getPopupContainer: getContextPopupContainer,
|
|
getPrefixCls,
|
|
direction
|
|
} = _react_17_0_2_react.useContext(context/* ConfigContext */.E_);
|
|
const {
|
|
prefixCls: customizePrefixCls,
|
|
type = 'default',
|
|
danger,
|
|
disabled,
|
|
loading,
|
|
onClick,
|
|
htmlType,
|
|
children,
|
|
className,
|
|
menu,
|
|
arrow,
|
|
autoFocus,
|
|
overlay,
|
|
trigger,
|
|
align,
|
|
open,
|
|
onOpenChange,
|
|
placement,
|
|
getPopupContainer,
|
|
href,
|
|
icon = /*#__PURE__*/_react_17_0_2_react.createElement(EllipsisOutlined/* default */.Z, null),
|
|
title,
|
|
buttonsRender = buttons => buttons,
|
|
mouseEnterDelay,
|
|
mouseLeaveDelay,
|
|
overlayClassName,
|
|
overlayStyle,
|
|
destroyPopupOnHide,
|
|
dropdownRender
|
|
} = props,
|
|
restProps = __rest(props, ["prefixCls", "type", "danger", "disabled", "loading", "onClick", "htmlType", "children", "className", "menu", "arrow", "autoFocus", "overlay", "trigger", "align", "open", "onOpenChange", "placement", "getPopupContainer", "href", "icon", "title", "buttonsRender", "mouseEnterDelay", "mouseLeaveDelay", "overlayClassName", "overlayStyle", "destroyPopupOnHide", "dropdownRender"]);
|
|
const prefixCls = getPrefixCls('dropdown', customizePrefixCls);
|
|
const buttonPrefixCls = `${prefixCls}-button`;
|
|
const [wrapSSR, hashId] = (0,style/* default */.Z)(prefixCls);
|
|
const dropdownProps = {
|
|
menu,
|
|
arrow,
|
|
autoFocus,
|
|
align,
|
|
disabled,
|
|
trigger: disabled ? [] : trigger,
|
|
onOpenChange,
|
|
getPopupContainer: getPopupContainer || getContextPopupContainer,
|
|
mouseEnterDelay,
|
|
mouseLeaveDelay,
|
|
overlayClassName,
|
|
overlayStyle,
|
|
destroyPopupOnHide,
|
|
dropdownRender
|
|
};
|
|
const {
|
|
compactSize,
|
|
compactItemClassnames
|
|
} = (0,Compact/* useCompactItemContext */.ri)(prefixCls, direction);
|
|
const classes = _classnames_2_3_2_classnames_default()(buttonPrefixCls, compactItemClassnames, className, hashId);
|
|
if ('overlay' in props) {
|
|
dropdownProps.overlay = overlay;
|
|
}
|
|
if ('open' in props) {
|
|
dropdownProps.open = open;
|
|
}
|
|
if ('placement' in props) {
|
|
dropdownProps.placement = placement;
|
|
} else {
|
|
dropdownProps.placement = direction === 'rtl' ? 'bottomLeft' : 'bottomRight';
|
|
}
|
|
const leftButton = /*#__PURE__*/_react_17_0_2_react.createElement(es_button/* default */.ZP, {
|
|
type: type,
|
|
danger: danger,
|
|
disabled: disabled,
|
|
loading: loading,
|
|
onClick: onClick,
|
|
htmlType: htmlType,
|
|
href: href,
|
|
title: title
|
|
}, children);
|
|
const rightButton = /*#__PURE__*/_react_17_0_2_react.createElement(es_button/* default */.ZP, {
|
|
type: type,
|
|
danger: danger,
|
|
icon: icon
|
|
});
|
|
const [leftButtonToRender, rightButtonToRender] = buttonsRender([leftButton, rightButton]);
|
|
return wrapSSR( /*#__PURE__*/_react_17_0_2_react.createElement(space/* default */.Z.Compact, Object.assign({
|
|
className: classes,
|
|
size: compactSize,
|
|
block: true
|
|
}, restProps), leftButtonToRender, /*#__PURE__*/_react_17_0_2_react.createElement(dropdown/* default */.Z, Object.assign({}, dropdownProps), rightButtonToRender)));
|
|
};
|
|
DropdownButton.__ANT_BUTTON = true;
|
|
/* harmony default export */ var dropdown_button = (DropdownButton);
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/dropdown/index.js
|
|
"use client";
|
|
|
|
|
|
|
|
const Dropdown = dropdown/* default */.Z;
|
|
Dropdown.Button = dropdown_button;
|
|
/* harmony default export */ var es_dropdown = (Dropdown);
|
|
|
|
/***/ }),
|
|
|
|
/***/ 19479:
|
|
/*!********************************************************************!*\
|
|
!*** ./node_modules/_antd@5.9.0@antd/es/rate/index.js + 8 modules ***!
|
|
\********************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ rate; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/esm/extends.js
|
|
var esm_extends = __webpack_require__(26508);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons-svg@4.3.1@@ant-design/icons-svg/es/asn/StarFilled.js
|
|
// This icon file is generated automatically.
|
|
var StarFilled = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z" } }] }, "name": "star", "theme": "filled" };
|
|
/* harmony default export */ var asn_StarFilled = (StarFilled);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/components/AntdIcon.js + 3 modules
|
|
var AntdIcon = __webpack_require__(91851);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/StarFilled.js
|
|
|
|
// GENERATE BY ./scripts/generate.ts
|
|
// DON NOT EDIT IT MANUALLY
|
|
|
|
|
|
|
|
|
|
var StarFilled_StarFilled = function StarFilled(props, ref) {
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
|
|
ref: ref,
|
|
icon: asn_StarFilled
|
|
}));
|
|
};
|
|
if (false) {}
|
|
/* harmony default export */ var icons_StarFilled = (/*#__PURE__*/_react_17_0_2_react.forwardRef(StarFilled_StarFilled));
|
|
// EXTERNAL MODULE: ./node_modules/_classnames@2.3.2@classnames/index.js
|
|
var _classnames_2_3_2_classnames = __webpack_require__(12124);
|
|
var _classnames_2_3_2_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_3_2_classnames);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/esm/defineProperty.js
|
|
var defineProperty = __webpack_require__(80268);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
|
|
var slicedToArray = __webpack_require__(39718);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/esm/objectWithoutProperties.js
|
|
var objectWithoutProperties = __webpack_require__(26779);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.38.1@rc-util/es/hooks/useMergedState.js
|
|
var useMergedState = __webpack_require__(84381);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.38.1@rc-util/es/KeyCode.js
|
|
var KeyCode = __webpack_require__(84821);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.38.1@rc-util/es/pickAttrs.js
|
|
var pickAttrs = __webpack_require__(3286);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-rate@2.12.0@rc-rate/es/Star.js
|
|
|
|
|
|
|
|
function Star(props, ref) {
|
|
var disabled = props.disabled,
|
|
prefixCls = props.prefixCls,
|
|
character = props.character,
|
|
characterRender = props.characterRender,
|
|
index = props.index,
|
|
count = props.count,
|
|
value = props.value,
|
|
allowHalf = props.allowHalf,
|
|
focused = props.focused,
|
|
onHover = props.onHover,
|
|
onClick = props.onClick;
|
|
// =========================== Events ===========================
|
|
var onInternalHover = function onInternalHover(e) {
|
|
onHover(e, index);
|
|
};
|
|
var onInternalClick = function onInternalClick(e) {
|
|
onClick(e, index);
|
|
};
|
|
var onInternalKeyDown = function onInternalKeyDown(e) {
|
|
if (e.keyCode === KeyCode/* default */.Z.ENTER) {
|
|
onClick(e, index);
|
|
}
|
|
};
|
|
// =========================== Render ===========================
|
|
// >>>>> ClassName
|
|
var starValue = index + 1;
|
|
var classNameList = new Set([prefixCls]);
|
|
// TODO: Current we just refactor from CC to FC. This logic seems can be optimized.
|
|
if (value === 0 && index === 0 && focused) {
|
|
classNameList.add("".concat(prefixCls, "-focused"));
|
|
} else if (allowHalf && value + 0.5 >= starValue && value < starValue) {
|
|
classNameList.add("".concat(prefixCls, "-half"));
|
|
classNameList.add("".concat(prefixCls, "-active"));
|
|
if (focused) {
|
|
classNameList.add("".concat(prefixCls, "-focused"));
|
|
}
|
|
} else {
|
|
if (starValue <= value) {
|
|
classNameList.add("".concat(prefixCls, "-full"));
|
|
} else {
|
|
classNameList.add("".concat(prefixCls, "-zero"));
|
|
}
|
|
if (starValue === value && focused) {
|
|
classNameList.add("".concat(prefixCls, "-focused"));
|
|
}
|
|
}
|
|
// >>>>> Node
|
|
var characterNode = typeof character === 'function' ? character(props) : character;
|
|
var start = /*#__PURE__*/_react_17_0_2_react.createElement("li", {
|
|
className: _classnames_2_3_2_classnames_default()(Array.from(classNameList)),
|
|
ref: ref
|
|
}, /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
onClick: disabled ? null : onInternalClick,
|
|
onKeyDown: disabled ? null : onInternalKeyDown,
|
|
onMouseMove: disabled ? null : onInternalHover,
|
|
role: "radio",
|
|
"aria-checked": value > index ? 'true' : 'false',
|
|
"aria-posinset": index + 1,
|
|
"aria-setsize": count,
|
|
tabIndex: disabled ? -1 : 0
|
|
}, /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: "".concat(prefixCls, "-first")
|
|
}, characterNode), /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: "".concat(prefixCls, "-second")
|
|
}, characterNode)));
|
|
if (characterRender) {
|
|
start = characterRender(start, props);
|
|
}
|
|
return start;
|
|
}
|
|
/* harmony default export */ var es_Star = (/*#__PURE__*/_react_17_0_2_react.forwardRef(Star));
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-rate@2.12.0@rc-rate/es/useRefs.js
|
|
|
|
function useRefs() {
|
|
var nodeRef = _react_17_0_2_react.useRef({});
|
|
function getRef(index) {
|
|
return nodeRef.current[index];
|
|
}
|
|
function setRef(index) {
|
|
return function (node) {
|
|
nodeRef.current[index] = node;
|
|
};
|
|
}
|
|
return [getRef, setRef];
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-rate@2.12.0@rc-rate/es/util.js
|
|
function getScroll(w) {
|
|
var ret = w.pageXOffset;
|
|
var method = 'scrollLeft';
|
|
if (typeof ret !== 'number') {
|
|
var d = w.document;
|
|
// ie6,7,8 standard mode
|
|
ret = d.documentElement[method];
|
|
if (typeof ret !== 'number') {
|
|
// quirks mode
|
|
ret = d.body[method];
|
|
}
|
|
}
|
|
return ret;
|
|
}
|
|
function getClientPosition(elem) {
|
|
var x;
|
|
var y;
|
|
var doc = elem.ownerDocument;
|
|
var body = doc.body;
|
|
var docElem = doc && doc.documentElement;
|
|
var box = elem.getBoundingClientRect();
|
|
x = box.left;
|
|
y = box.top;
|
|
x -= docElem.clientLeft || body.clientLeft || 0;
|
|
y -= docElem.clientTop || body.clientTop || 0;
|
|
return {
|
|
left: x,
|
|
top: y
|
|
};
|
|
}
|
|
function getOffsetLeft(el) {
|
|
var pos = getClientPosition(el);
|
|
var doc = el.ownerDocument;
|
|
// Only IE use `parentWindow`
|
|
var w = doc.defaultView || doc.parentWindow;
|
|
pos.left += getScroll(w);
|
|
return pos.left;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-rate@2.12.0@rc-rate/es/Rate.js
|
|
|
|
|
|
|
|
|
|
var _excluded = ["prefixCls", "className", "defaultValue", "value", "count", "allowHalf", "allowClear", "character", "characterRender", "disabled", "direction", "tabIndex", "autoFocus", "onHoverChange", "onChange", "onFocus", "onBlur", "onKeyDown", "onMouseLeave"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Rate(props, ref) {
|
|
var _classNames;
|
|
var _props$prefixCls = props.prefixCls,
|
|
prefixCls = _props$prefixCls === void 0 ? 'rc-rate' : _props$prefixCls,
|
|
className = props.className,
|
|
defaultValue = props.defaultValue,
|
|
propValue = props.value,
|
|
_props$count = props.count,
|
|
count = _props$count === void 0 ? 5 : _props$count,
|
|
_props$allowHalf = props.allowHalf,
|
|
allowHalf = _props$allowHalf === void 0 ? false : _props$allowHalf,
|
|
_props$allowClear = props.allowClear,
|
|
allowClear = _props$allowClear === void 0 ? true : _props$allowClear,
|
|
_props$character = props.character,
|
|
character = _props$character === void 0 ? '★' : _props$character,
|
|
characterRender = props.characterRender,
|
|
disabled = props.disabled,
|
|
_props$direction = props.direction,
|
|
direction = _props$direction === void 0 ? 'ltr' : _props$direction,
|
|
_props$tabIndex = props.tabIndex,
|
|
tabIndex = _props$tabIndex === void 0 ? 0 : _props$tabIndex,
|
|
autoFocus = props.autoFocus,
|
|
onHoverChange = props.onHoverChange,
|
|
onChange = props.onChange,
|
|
onFocus = props.onFocus,
|
|
onBlur = props.onBlur,
|
|
onKeyDown = props.onKeyDown,
|
|
onMouseLeave = props.onMouseLeave,
|
|
restProps = (0,objectWithoutProperties/* default */.Z)(props, _excluded);
|
|
var _useRefs = useRefs(),
|
|
_useRefs2 = (0,slicedToArray/* default */.Z)(_useRefs, 2),
|
|
getStarRef = _useRefs2[0],
|
|
setStarRef = _useRefs2[1];
|
|
var rateRef = _react_17_0_2_react.useRef(null);
|
|
// ============================ Ref =============================
|
|
var triggerFocus = function triggerFocus() {
|
|
if (!disabled) {
|
|
var _rateRef$current;
|
|
(_rateRef$current = rateRef.current) === null || _rateRef$current === void 0 ? void 0 : _rateRef$current.focus();
|
|
}
|
|
};
|
|
_react_17_0_2_react.useImperativeHandle(ref, function () {
|
|
return {
|
|
focus: triggerFocus,
|
|
blur: function blur() {
|
|
if (!disabled) {
|
|
var _rateRef$current2;
|
|
(_rateRef$current2 = rateRef.current) === null || _rateRef$current2 === void 0 ? void 0 : _rateRef$current2.blur();
|
|
}
|
|
}
|
|
};
|
|
});
|
|
// =========================== Value ============================
|
|
var _useMergedState = (0,useMergedState/* default */.Z)(defaultValue || 0, {
|
|
value: propValue
|
|
}),
|
|
_useMergedState2 = (0,slicedToArray/* default */.Z)(_useMergedState, 2),
|
|
value = _useMergedState2[0],
|
|
setValue = _useMergedState2[1];
|
|
var _useMergedState3 = (0,useMergedState/* default */.Z)(null),
|
|
_useMergedState4 = (0,slicedToArray/* default */.Z)(_useMergedState3, 2),
|
|
cleanedValue = _useMergedState4[0],
|
|
setCleanedValue = _useMergedState4[1];
|
|
var getStarValue = function getStarValue(index, x) {
|
|
var reverse = direction === 'rtl';
|
|
var starValue = index + 1;
|
|
if (allowHalf) {
|
|
var starEle = getStarRef(index);
|
|
var leftDis = getOffsetLeft(starEle);
|
|
var width = starEle.clientWidth;
|
|
if (reverse && x - leftDis > width / 2) {
|
|
starValue -= 0.5;
|
|
} else if (!reverse && x - leftDis < width / 2) {
|
|
starValue -= 0.5;
|
|
}
|
|
}
|
|
return starValue;
|
|
};
|
|
// >>>>> Change
|
|
var changeValue = function changeValue(nextValue) {
|
|
setValue(nextValue);
|
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextValue);
|
|
};
|
|
// =========================== Focus ============================
|
|
var _React$useState = _react_17_0_2_react.useState(false),
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 2),
|
|
focused = _React$useState2[0],
|
|
setFocused = _React$useState2[1];
|
|
var onInternalFocus = function onInternalFocus() {
|
|
setFocused(true);
|
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
};
|
|
var onInternalBlur = function onInternalBlur() {
|
|
setFocused(false);
|
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
};
|
|
// =========================== Hover ============================
|
|
var _React$useState3 = _react_17_0_2_react.useState(null),
|
|
_React$useState4 = (0,slicedToArray/* default */.Z)(_React$useState3, 2),
|
|
hoverValue = _React$useState4[0],
|
|
setHoverValue = _React$useState4[1];
|
|
var onHover = function onHover(event, index) {
|
|
var nextHoverValue = getStarValue(index, event.pageX);
|
|
if (nextHoverValue !== cleanedValue) {
|
|
setHoverValue(nextHoverValue);
|
|
setCleanedValue(null);
|
|
}
|
|
onHoverChange === null || onHoverChange === void 0 ? void 0 : onHoverChange(nextHoverValue);
|
|
};
|
|
var onMouseLeaveCallback = function onMouseLeaveCallback(event) {
|
|
if (!disabled) {
|
|
setHoverValue(null);
|
|
setCleanedValue(null);
|
|
onHoverChange === null || onHoverChange === void 0 ? void 0 : onHoverChange(undefined);
|
|
}
|
|
if (event) {
|
|
onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave(event);
|
|
}
|
|
};
|
|
// =========================== Click ============================
|
|
var onClick = function onClick(event, index) {
|
|
var newValue = getStarValue(index, event.pageX);
|
|
var isReset = false;
|
|
if (allowClear) {
|
|
isReset = newValue === value;
|
|
}
|
|
onMouseLeaveCallback();
|
|
changeValue(isReset ? 0 : newValue);
|
|
setCleanedValue(isReset ? newValue : null);
|
|
};
|
|
var onInternalKeyDown = function onInternalKeyDown(event) {
|
|
var keyCode = event.keyCode;
|
|
var reverse = direction === 'rtl';
|
|
var nextValue = value;
|
|
if (keyCode === KeyCode/* default */.Z.RIGHT && nextValue < count && !reverse) {
|
|
if (allowHalf) {
|
|
nextValue += 0.5;
|
|
} else {
|
|
nextValue += 1;
|
|
}
|
|
changeValue(nextValue);
|
|
event.preventDefault();
|
|
} else if (keyCode === KeyCode/* default */.Z.LEFT && nextValue > 0 && !reverse) {
|
|
if (allowHalf) {
|
|
nextValue -= 0.5;
|
|
} else {
|
|
nextValue -= 1;
|
|
}
|
|
changeValue(nextValue);
|
|
event.preventDefault();
|
|
} else if (keyCode === KeyCode/* default */.Z.RIGHT && nextValue > 0 && reverse) {
|
|
if (allowHalf) {
|
|
nextValue -= 0.5;
|
|
} else {
|
|
nextValue -= 1;
|
|
}
|
|
changeValue(nextValue);
|
|
event.preventDefault();
|
|
} else if (keyCode === KeyCode/* default */.Z.LEFT && nextValue < count && reverse) {
|
|
if (allowHalf) {
|
|
nextValue += 0.5;
|
|
} else {
|
|
nextValue += 1;
|
|
}
|
|
changeValue(nextValue);
|
|
event.preventDefault();
|
|
}
|
|
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
};
|
|
// =========================== Effect ===========================
|
|
_react_17_0_2_react.useEffect(function () {
|
|
if (autoFocus && !disabled) {
|
|
triggerFocus();
|
|
}
|
|
}, []);
|
|
// =========================== Render ===========================
|
|
// >>> Star
|
|
var starNodes = new Array(count).fill(0).map(function (item, index) {
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(es_Star, {
|
|
ref: setStarRef(index),
|
|
index: index,
|
|
count: count,
|
|
disabled: disabled,
|
|
prefixCls: "".concat(prefixCls, "-star"),
|
|
allowHalf: allowHalf,
|
|
value: hoverValue === null ? value : hoverValue,
|
|
onClick: onClick,
|
|
onHover: onHover,
|
|
key: item || index,
|
|
character: character,
|
|
characterRender: characterRender,
|
|
focused: focused
|
|
});
|
|
});
|
|
var classString = _classnames_2_3_2_classnames_default()(prefixCls, className, (_classNames = {}, (0,defineProperty/* default */.Z)(_classNames, "".concat(prefixCls, "-disabled"), disabled), (0,defineProperty/* default */.Z)(_classNames, "".concat(prefixCls, "-rtl"), direction === 'rtl'), _classNames));
|
|
// >>> Node
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement("ul", (0,esm_extends/* default */.Z)({
|
|
className: classString,
|
|
onMouseLeave: onMouseLeaveCallback,
|
|
tabIndex: disabled ? -1 : tabIndex,
|
|
onFocus: disabled ? null : onInternalFocus,
|
|
onBlur: disabled ? null : onInternalBlur,
|
|
onKeyDown: disabled ? null : onInternalKeyDown,
|
|
ref: rateRef,
|
|
role: "radiogroup"
|
|
}, (0,pickAttrs/* default */.Z)(restProps, {
|
|
aria: true,
|
|
data: true,
|
|
attr: true
|
|
})), starNodes);
|
|
}
|
|
/* harmony default export */ var es_Rate = (/*#__PURE__*/_react_17_0_2_react.forwardRef(Rate));
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-rate@2.12.0@rc-rate/es/index.js
|
|
|
|
/* harmony default export */ var es = (es_Rate);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/config-provider/context.js
|
|
var context = __webpack_require__(36355);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tooltip/index.js + 3 modules
|
|
var tooltip = __webpack_require__(6848);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/style/index.js
|
|
var style = __webpack_require__(17313);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/genComponentStyleHook.js
|
|
var genComponentStyleHook = __webpack_require__(83116);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/statistic.js
|
|
var statistic = __webpack_require__(37613);
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/rate/style/index.js
|
|
"use client";
|
|
|
|
|
|
|
|
const genRateStarStyle = token => {
|
|
const {
|
|
componentCls
|
|
} = token;
|
|
return {
|
|
[`${componentCls}-star`]: {
|
|
position: 'relative',
|
|
display: 'inline-block',
|
|
color: 'inherit',
|
|
cursor: 'pointer',
|
|
'&:not(:last-child)': {
|
|
marginInlineEnd: token.marginXS
|
|
},
|
|
'> div': {
|
|
transition: `all ${token.motionDurationMid}, outline 0s`,
|
|
'&:hover': {
|
|
transform: token.starHoverScale
|
|
},
|
|
'&:focus': {
|
|
outline: 0
|
|
},
|
|
'&:focus-visible': {
|
|
outline: `${token.lineWidth}px dashed ${token.starColor}`,
|
|
transform: token.starHoverScale
|
|
}
|
|
},
|
|
'&-first, &-second': {
|
|
color: token.starBg,
|
|
transition: `all ${token.motionDurationMid}`,
|
|
userSelect: 'none',
|
|
[token.iconCls]: {
|
|
verticalAlign: 'middle'
|
|
}
|
|
},
|
|
'&-first': {
|
|
position: 'absolute',
|
|
top: 0,
|
|
insetInlineStart: 0,
|
|
width: '50%',
|
|
height: '100%',
|
|
overflow: 'hidden',
|
|
opacity: 0
|
|
},
|
|
[`&-half ${componentCls}-star-first, &-half ${componentCls}-star-second`]: {
|
|
opacity: 1
|
|
},
|
|
[`&-half ${componentCls}-star-first, &-full ${componentCls}-star-second`]: {
|
|
color: 'inherit'
|
|
}
|
|
}
|
|
};
|
|
};
|
|
const genRateRtlStyle = token => ({
|
|
[`&-rtl${token.componentCls}`]: {
|
|
direction: 'rtl'
|
|
}
|
|
});
|
|
const genRateStyle = token => {
|
|
const {
|
|
componentCls
|
|
} = token;
|
|
return {
|
|
[componentCls]: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (0,style/* resetComponent */.Wf)(token)), {
|
|
display: 'inline-block',
|
|
margin: 0,
|
|
padding: 0,
|
|
color: token.starColor,
|
|
fontSize: token.starSize,
|
|
lineHeight: 'unset',
|
|
listStyle: 'none',
|
|
outline: 'none',
|
|
// disable styles
|
|
[`&-disabled${componentCls} ${componentCls}-star`]: {
|
|
cursor: 'default',
|
|
'> div:hover': {
|
|
transform: 'scale(1)'
|
|
}
|
|
}
|
|
}), genRateStarStyle(token)), {
|
|
// text styles
|
|
[`+ ${componentCls}-text`]: {
|
|
display: 'inline-block',
|
|
marginInlineStart: token.marginXS,
|
|
fontSize: token.fontSize
|
|
}
|
|
}), genRateRtlStyle(token))
|
|
};
|
|
};
|
|
// ============================== Export ==============================
|
|
/* harmony default export */ var rate_style = ((0,genComponentStyleHook/* default */.Z)('Rate', token => {
|
|
const rateToken = (0,statistic/* merge */.TS)(token, {});
|
|
return [genRateStyle(rateToken)];
|
|
}, token => ({
|
|
starColor: token.yellow6,
|
|
starSize: token.controlHeightLG * 0.5,
|
|
starHoverScale: 'scale(1.1)',
|
|
starBg: token.colorFillContent
|
|
})));
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/rate/index.js
|
|
"use client";
|
|
|
|
var __rest = undefined && undefined.__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;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const rate_Rate = /*#__PURE__*/_react_17_0_2_react.forwardRef((props, ref) => {
|
|
const {
|
|
prefixCls,
|
|
className,
|
|
rootClassName,
|
|
style,
|
|
tooltips,
|
|
character = /*#__PURE__*/_react_17_0_2_react.createElement(icons_StarFilled, null)
|
|
} = props,
|
|
rest = __rest(props, ["prefixCls", "className", "rootClassName", "style", "tooltips", "character"]);
|
|
const characterRender = (node, _ref) => {
|
|
let {
|
|
index
|
|
} = _ref;
|
|
if (!tooltips) {
|
|
return node;
|
|
}
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(tooltip/* default */.Z, {
|
|
title: tooltips[index]
|
|
}, node);
|
|
};
|
|
const {
|
|
getPrefixCls,
|
|
direction,
|
|
rate
|
|
} = _react_17_0_2_react.useContext(context/* ConfigContext */.E_);
|
|
const ratePrefixCls = getPrefixCls('rate', prefixCls);
|
|
// Style
|
|
const [wrapSSR, hashId] = rate_style(ratePrefixCls);
|
|
const mergedStyle = Object.assign(Object.assign({}, rate === null || rate === void 0 ? void 0 : rate.style), style);
|
|
return wrapSSR( /*#__PURE__*/_react_17_0_2_react.createElement(es, Object.assign({
|
|
ref: ref,
|
|
character: character,
|
|
characterRender: characterRender
|
|
}, rest, {
|
|
className: _classnames_2_3_2_classnames_default()(className, rootClassName, hashId, rate === null || rate === void 0 ? void 0 : rate.className),
|
|
style: mergedStyle,
|
|
prefixCls: ratePrefixCls,
|
|
direction: direction
|
|
})));
|
|
});
|
|
if (false) {}
|
|
/* harmony default export */ var rate = (rate_Rate);
|
|
|
|
/***/ }),
|
|
|
|
/***/ 81327:
|
|
/*!*********************************************************************!*\
|
|
!*** ./node_modules/_antd@5.9.0@antd/es/space/index.js + 3 modules ***!
|
|
\*********************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ space; }
|
|
});
|
|
|
|
// UNUSED EXPORTS: SpaceContext
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./node_modules/_classnames@2.3.2@classnames/index.js
|
|
var _classnames_2_3_2_classnames = __webpack_require__(12124);
|
|
var _classnames_2_3_2_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_3_2_classnames);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.38.1@rc-util/es/Children/toArray.js
|
|
var toArray = __webpack_require__(45659);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/config-provider/context.js
|
|
var context = __webpack_require__(36355);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/space/Compact.js
|
|
var Compact = __webpack_require__(33234);
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/space/context.js
|
|
|
|
const SpaceContext = /*#__PURE__*/_react_17_0_2_react.createContext({
|
|
latestIndex: 0
|
|
});
|
|
const SpaceContextProvider = SpaceContext.Provider;
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/space/Item.js
|
|
"use client";
|
|
|
|
|
|
|
|
const Item = _ref => {
|
|
let {
|
|
className,
|
|
index,
|
|
children,
|
|
split,
|
|
style
|
|
} = _ref;
|
|
const {
|
|
latestIndex
|
|
} = _react_17_0_2_react.useContext(SpaceContext);
|
|
if (children === null || children === undefined) {
|
|
return null;
|
|
}
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: className,
|
|
style: style
|
|
}, children), index < latestIndex && split && /*#__PURE__*/_react_17_0_2_react.createElement("span", {
|
|
className: `${className}-split`
|
|
}, split));
|
|
};
|
|
/* harmony default export */ var space_Item = (Item);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/space/style/index.js + 1 modules
|
|
var space_style = __webpack_require__(2856);
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/space/utils.js
|
|
function isPresetSize(size) {
|
|
return ['small', 'middle', 'large'].includes(size);
|
|
}
|
|
function isValidGapNumber(size) {
|
|
if (!size) {
|
|
// The case of size = 0 is deliberately excluded here, because the default value of the gap attribute in CSS is 0, so if the user passes 0 in, we can directly ignore it.
|
|
return false;
|
|
}
|
|
return typeof size === 'number' && !Number.isNaN(size);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/space/index.js
|
|
"use client";
|
|
|
|
var __rest = undefined && undefined.__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;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Space = /*#__PURE__*/_react_17_0_2_react.forwardRef((props, ref) => {
|
|
var _a, _b;
|
|
const {
|
|
getPrefixCls,
|
|
space,
|
|
direction: directionConfig
|
|
} = _react_17_0_2_react.useContext(context/* ConfigContext */.E_);
|
|
const {
|
|
size = (space === null || space === void 0 ? void 0 : space.size) || 'small',
|
|
align,
|
|
className,
|
|
rootClassName,
|
|
children,
|
|
direction = 'horizontal',
|
|
prefixCls: customizePrefixCls,
|
|
split,
|
|
style,
|
|
wrap = false,
|
|
classNames: customClassNames,
|
|
styles
|
|
} = props,
|
|
otherProps = __rest(props, ["size", "align", "className", "rootClassName", "children", "direction", "prefixCls", "split", "style", "wrap", "classNames", "styles"]);
|
|
const [horizontalSize, verticalSize] = Array.isArray(size) ? size : [size, size];
|
|
const isPresetVerticalSize = isPresetSize(verticalSize);
|
|
const isPresetHorizontalSize = isPresetSize(horizontalSize);
|
|
const isValidVerticalSize = isValidGapNumber(verticalSize);
|
|
const isValidHorizontalSize = isValidGapNumber(horizontalSize);
|
|
const childNodes = (0,toArray/* default */.Z)(children, {
|
|
keepEmpty: true
|
|
});
|
|
const mergedAlign = align === undefined && direction === 'horizontal' ? 'center' : align;
|
|
const prefixCls = getPrefixCls('space', customizePrefixCls);
|
|
const [wrapSSR, hashId] = (0,space_style/* default */.Z)(prefixCls);
|
|
const cls = _classnames_2_3_2_classnames_default()(prefixCls, space === null || space === void 0 ? void 0 : space.className, hashId, `${prefixCls}-${direction}`, {
|
|
[`${prefixCls}-rtl`]: directionConfig === 'rtl',
|
|
[`${prefixCls}-align-${mergedAlign}`]: mergedAlign,
|
|
[`${prefixCls}-gap-row-${verticalSize}`]: isPresetVerticalSize,
|
|
[`${prefixCls}-gap-col-${horizontalSize}`]: isPresetHorizontalSize
|
|
}, className, rootClassName);
|
|
const itemClassName = _classnames_2_3_2_classnames_default()(`${prefixCls}-item`, (_a = customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.item) !== null && _a !== void 0 ? _a : (_b = space === null || space === void 0 ? void 0 : space.classNames) === null || _b === void 0 ? void 0 : _b.item);
|
|
// Calculate latest one
|
|
let latestIndex = 0;
|
|
const nodes = childNodes.map((child, i) => {
|
|
var _a, _b;
|
|
if (child !== null && child !== undefined) {
|
|
latestIndex = i;
|
|
}
|
|
const key = child && child.key || `${itemClassName}-${i}`;
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(space_Item, {
|
|
className: itemClassName,
|
|
key: key,
|
|
index: i,
|
|
split: split,
|
|
style: (_a = styles === null || styles === void 0 ? void 0 : styles.item) !== null && _a !== void 0 ? _a : (_b = space === null || space === void 0 ? void 0 : space.styles) === null || _b === void 0 ? void 0 : _b.item
|
|
}, child);
|
|
});
|
|
const spaceContext = _react_17_0_2_react.useMemo(() => ({
|
|
latestIndex
|
|
}), [latestIndex]);
|
|
// =========================== Render ===========================
|
|
if (childNodes.length === 0) {
|
|
return null;
|
|
}
|
|
const gapStyle = {};
|
|
if (wrap) {
|
|
gapStyle.flexWrap = 'wrap';
|
|
}
|
|
if (!isPresetHorizontalSize && isValidHorizontalSize) {
|
|
gapStyle.columnGap = horizontalSize;
|
|
}
|
|
if (!isPresetVerticalSize && isValidVerticalSize) {
|
|
gapStyle.rowGap = verticalSize;
|
|
}
|
|
return wrapSSR( /*#__PURE__*/_react_17_0_2_react.createElement("div", Object.assign({
|
|
ref: ref,
|
|
className: cls,
|
|
style: Object.assign(Object.assign(Object.assign({}, gapStyle), space === null || space === void 0 ? void 0 : space.style), style)
|
|
}, otherProps), /*#__PURE__*/_react_17_0_2_react.createElement(SpaceContextProvider, {
|
|
value: spaceContext
|
|
}, nodes)));
|
|
});
|
|
if (false) {}
|
|
const CompoundedSpace = Space;
|
|
CompoundedSpace.Compact = Compact/* default */.ZP;
|
|
/* harmony default export */ var space = (CompoundedSpace);
|
|
|
|
/***/ })
|
|
|
|
}]); |