|
|
"use strict";
|
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[73220],{
|
|
|
|
|
|
/***/ 13321:
|
|
|
/*!***********************************************************************!*\
|
|
|
!*** ./src/pages/Classrooms/Lists/Video/Upload/index.tsx + 1 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 */ Video_Upload; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js
|
|
|
var regeneratorRuntime = __webpack_require__(17061);
|
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/asyncToGenerator.js
|
|
|
var asyncToGenerator = __webpack_require__(17156);
|
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/slicedToArray.js
|
|
|
var slicedToArray = __webpack_require__(27424);
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/objectWithoutProperties.js
|
|
|
var objectWithoutProperties = __webpack_require__(70215);
|
|
|
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(42122);
|
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/toConsumableArray.js
|
|
|
var toConsumableArray = __webpack_require__(861);
|
|
|
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
|
var react = __webpack_require__(67294);
|
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts + 8 modules
|
|
|
var _umi_production_exports = __webpack_require__(89214);
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/LeftOutlined.js + 1 modules
|
|
|
var LeftOutlined = __webpack_require__(6171);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/message/index.js + 4 modules
|
|
|
var message = __webpack_require__(2453);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/modal/index.js + 39 modules
|
|
|
var modal = __webpack_require__(72423);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/spin/index.js + 1 modules
|
|
|
var spin = __webpack_require__(57953);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/progress/index.js + 11 modules
|
|
|
var progress = __webpack_require__(69814);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/button/index.js
|
|
|
var es_button = __webpack_require__(71577);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input/index.js + 5 modules
|
|
|
var input = __webpack_require__(79531);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/row/index.js
|
|
|
var row = __webpack_require__(71230);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/checkbox/index.js + 3 modules
|
|
|
var es_checkbox = __webpack_require__(84567);
|
|
|
// EXTERNAL MODULE: ./src/assets/images/video/upload.png
|
|
|
var upload = __webpack_require__(59215);
|
|
|
// EXTERNAL MODULE: ./src/assets/images/video/upload_hover.png
|
|
|
var upload_hover = __webpack_require__(19213);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Video/Upload/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var Uploadmodules = ({"bg":"bg___A_od2","main":"main___f6Wx0","uploadTop":"uploadTop___Yx2Un","imgWrap":"imgWrap___S6ChW","defaultImg":"defaultImg___qUJQT","hoverImg":"hoverImg___pZT3G","uploadTitle":"uploadTitle___FLy1b","colorBlue":"colorBlue___HfgxM","uploadDescription":"uploadDescription___Cn5KA","description":"description___qbCxZ","colorOrange":"colorOrange___ZuvEg","fileMain":"fileMain___asNqA","fileWrap":"fileWrap___gPP0_","fileProgress":"fileProgress___xmdZ4","fileCancel":"fileCancel___ikgzZ","fileInputWrap":"fileInputWrap___mvunl","fileImgWrap":"fileImgWrap___zdrgz","fileInput":"fileInput___Tw2dZ","flexRowCenter":"flexRowCenter___pGglA","continueAdd":"continueAdd___SV9wg"});
|
|
|
// EXTERNAL MODULE: ./src/utils/aliyunUpload.ts
|
|
|
var aliyunUpload = __webpack_require__(77320);
|
|
|
// EXTERNAL MODULE: ./src/components/CoverUpload/index.tsx + 1 modules
|
|
|
var CoverUpload = __webpack_require__(93899);
|
|
|
// EXTERNAL MODULE: ./src/service/user.ts
|
|
|
var service_user = __webpack_require__(58839);
|
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
|
var util = __webpack_require__(29427);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(85893);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Video/Upload/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["user", "userDetail", "globalSetting", "loading", "dispatch"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var MAX_LENGTH = 30;
|
|
|
var MAX_FILE_SIZE = 1024;
|
|
|
var videoReducer = function videoReducer(state, action) {
|
|
|
var _state$videoList, _state$videoList2, _state$videoList3;
|
|
|
var uploadInfo = action.payload.uploadInfo;
|
|
|
switch (action.type) {
|
|
|
case 'addVideo':
|
|
|
// console.log(uploadInfo,{
|
|
|
// videoList: [...state.videoList, {
|
|
|
// videoId: uploadInfo.videoId,
|
|
|
// name: uploadInfo.file.name,
|
|
|
// size: uploadInfo.file.size,
|
|
|
// type: uploadInfo.file.type,
|
|
|
// fileHash: uploadInfo.fileHash,
|
|
|
// state: uploadInfo.state,
|
|
|
// loaded: 0,
|
|
|
// title: ''
|
|
|
// }]
|
|
|
// });
|
|
|
|
|
|
console.log("videoList: ", uploadInfo, uploadInfo.videoId, [].concat(toConsumableArray_default()(state.videoList), [{
|
|
|
name: uploadInfo.file.name,
|
|
|
size: uploadInfo.file.size,
|
|
|
type: uploadInfo.file.type,
|
|
|
filename: uploadInfo.file.name,
|
|
|
fileHash: uploadInfo.fileHash,
|
|
|
state: uploadInfo.state,
|
|
|
videoId: uploadInfo.videoId,
|
|
|
attachment_id: '',
|
|
|
loaded: 0,
|
|
|
title: ''
|
|
|
}]));
|
|
|
return {
|
|
|
videoList: [].concat(toConsumableArray_default()(state.videoList), [{
|
|
|
name: uploadInfo.file.name,
|
|
|
size: uploadInfo.file.size,
|
|
|
type: uploadInfo.file.type,
|
|
|
filename: uploadInfo.file.name,
|
|
|
fileHash: uploadInfo.fileHash,
|
|
|
state: uploadInfo.state,
|
|
|
videoId: uploadInfo.videoId,
|
|
|
attachment_id: '',
|
|
|
loaded: 0,
|
|
|
title: '',
|
|
|
allow_skip: true
|
|
|
}])
|
|
|
};
|
|
|
case 'removeVideo':
|
|
|
return {
|
|
|
videoList: state.videoList.filter(function (item) {
|
|
|
return item.name !== action.payload.name;
|
|
|
})
|
|
|
};
|
|
|
case 'removeAll':
|
|
|
return [];
|
|
|
case 'updateProgress':
|
|
|
return {
|
|
|
videoList: state.videoList.map(function (item) {
|
|
|
if (item.name === action.payload.uploadInfo.file.name) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, item), {
|
|
|
loaded: action.payload.progressPercent,
|
|
|
videoId: uploadInfo.videoId,
|
|
|
fileHash: uploadInfo.fileHash
|
|
|
});
|
|
|
}
|
|
|
return item;
|
|
|
})
|
|
|
};
|
|
|
case 'updateTitle':
|
|
|
return {
|
|
|
videoList: (_state$videoList = state.videoList) === null || _state$videoList === void 0 ? void 0 : _state$videoList.map(function (video) {
|
|
|
if (video.name === action.payload.item.name) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, video), {
|
|
|
title: action.payload.title
|
|
|
});
|
|
|
}
|
|
|
return video;
|
|
|
})
|
|
|
};
|
|
|
case 'updateImg':
|
|
|
return {
|
|
|
videoList: (_state$videoList2 = state.videoList) === null || _state$videoList2 === void 0 ? void 0 : _state$videoList2.map(function (video) {
|
|
|
if (video.name === action.payload.item.name) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, video), {
|
|
|
attachment_id: action.payload.attachment_id
|
|
|
});
|
|
|
}
|
|
|
return video;
|
|
|
})
|
|
|
};
|
|
|
case 'updateAllowSkip':
|
|
|
return {
|
|
|
videoList: (_state$videoList3 = state.videoList) === null || _state$videoList3 === void 0 ? void 0 : _state$videoList3.map(function (video) {
|
|
|
if (video.name === action.payload.item.name) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, video), {
|
|
|
allow_skip: action.payload.allow_skip
|
|
|
});
|
|
|
}
|
|
|
return video;
|
|
|
})
|
|
|
};
|
|
|
default:
|
|
|
return [];
|
|
|
}
|
|
|
};
|
|
|
var Upload = function Upload(_ref) {
|
|
|
var _state$videoList6;
|
|
|
var user = _ref.user,
|
|
|
userDetail = _ref.userDetail,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
dispatch = _ref.dispatch,
|
|
|
props = objectWithoutProperties_default()(_ref, _excluded);
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
var Location = (0,_umi_production_exports.useLocation)();
|
|
|
var _useSearchParams = (0,_umi_production_exports.useSearchParams)(),
|
|
|
_useSearchParams2 = slicedToArray_default()(_useSearchParams, 1),
|
|
|
searchParams = _useSearchParams2[0];
|
|
|
var _useState = (0,react.useState)(false),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
isLoading = _useState2[0],
|
|
|
setIsLoading = _useState2[1];
|
|
|
var _useReducer = (0,react.useReducer)(videoReducer, {
|
|
|
videoList: []
|
|
|
}),
|
|
|
_useReducer2 = slicedToArray_default()(_useReducer, 2),
|
|
|
state = _useReducer2[0],
|
|
|
stateDispatch = _useReducer2[1];
|
|
|
var uploader = (0,react.useRef)();
|
|
|
var files = (0,react.useRef)();
|
|
|
(0,react.useEffect)(function () {
|
|
|
window.addEventListener('beforeunload', handleBeforeunload);
|
|
|
return function () {
|
|
|
window.removeEventListener('beforeunload', handleBeforeunload);
|
|
|
};
|
|
|
}, []);
|
|
|
var handleBeforeunload = function handleBeforeunload(event) {
|
|
|
event.preventDefault();
|
|
|
event.returnValue = '';
|
|
|
};
|
|
|
var clearInput = function clearInput() {
|
|
|
var input = document.getElementById('fileUpload');
|
|
|
input.value = '';
|
|
|
};
|
|
|
var handleChangeUpload = function handleChangeUpload(e) {
|
|
|
var _user$userInfo, _user$userInfo2, _state$videoList4;
|
|
|
var file = e.target.files[0];
|
|
|
if (!file) {
|
|
|
clearInput();
|
|
|
return;
|
|
|
}
|
|
|
var name = file.name.toLowerCase();
|
|
|
if (name && name.indexOf('.avi') == -1 && name.indexOf('.flv') == -1 && name.indexOf('.f4v') == -1 && name.indexOf('.m4v') == -1 && name.indexOf('.mov') == -1 && name.indexOf('.mp4') == -1 && name.indexOf('.rmvb') == -1 && name.indexOf('.swf') == -1 && name.indexOf('.webm') == -1 && name.indexOf('.wmv') == -1) {
|
|
|
message/* default.info */.ZP.info("\u4E0D\u652F\u6301\u7684\u89C6\u9891\u683C\u5F0F");
|
|
|
clearInput();
|
|
|
return;
|
|
|
}
|
|
|
if (!((_user$userInfo = user.userInfo) !== null && _user$userInfo !== void 0 && _user$userInfo.admin || (_user$userInfo2 = user.userInfo) !== null && _user$userInfo2 !== void 0 && _user$userInfo2.business) && file.size > MAX_FILE_SIZE * 1024 * 1024) {
|
|
|
message/* default.info */.ZP.info("\u89C6\u9891\u5927\u5C0F\u8D85\u8FC7".concat(MAX_FILE_SIZE, "M"));
|
|
|
clearInput();
|
|
|
return;
|
|
|
}
|
|
|
if ((_state$videoList4 = state.videoList) !== null && _state$videoList4 !== void 0 && _state$videoList4.find(function (item) {
|
|
|
return item.name === file.name;
|
|
|
})) {
|
|
|
message/* default.info */.ZP.info("\u4F60\u4E0D\u80FD\u4E0A\u4F20\u540C\u4E00\u4E2A\u89C6\u9891\u6587\u4EF6\u540D\u79F0\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u3002");
|
|
|
clearInput();
|
|
|
return;
|
|
|
}
|
|
|
handleUpload(file);
|
|
|
};
|
|
|
var handleRemove = function handleRemove(name, isSuccess) {
|
|
|
modal/* default.confirm */.Z.confirm({
|
|
|
title: '提示',
|
|
|
centered: true,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "tc",
|
|
|
children: ["\u60A8\u786E\u8BA4\u8981", isSuccess ? '删除' : '取消上传', "\u8BE5\u89C6\u9891\u5417\uFF1F"]
|
|
|
}),
|
|
|
onOk: function onOk() {
|
|
|
clearInput();
|
|
|
stateDispatch({
|
|
|
type: 'removeVideo',
|
|
|
payload: {
|
|
|
name: name
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
var handleUpload = function handleUpload(file) {
|
|
|
var userData = '{"Vod":{}}';
|
|
|
setIsLoading(true);
|
|
|
if (uploader.current) {
|
|
|
uploader.current.addFile(file, null, null, null, userData);
|
|
|
return;
|
|
|
}
|
|
|
(0,aliyunUpload/* getUploader */.o)(params === null || params === void 0 ? void 0 : params.username, '', {
|
|
|
create: !uploader,
|
|
|
addFileSuccess: function addFileSuccess(uploadInfo) {
|
|
|
;
|
|
|
stateDispatch({
|
|
|
type: 'addVideo',
|
|
|
payload: {
|
|
|
uploadInfo: uploadInfo
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
onUploadProgress: function onUploadProgress(uploadInfo, totalSize, progress) {
|
|
|
var progressPercent = Math.ceil(progress * 100);
|
|
|
stateDispatch({
|
|
|
type: 'updateProgress',
|
|
|
payload: {
|
|
|
uploadInfo: uploadInfo,
|
|
|
progressPercent: progressPercent
|
|
|
}
|
|
|
});
|
|
|
clearInput();
|
|
|
},
|
|
|
onUploadFailed: function onUploadFailed(uploadInfo) {
|
|
|
message/* default.info */.ZP.info('视频云服务出现异常,请重新上传。');
|
|
|
},
|
|
|
onUploadEnd: function onUploadEnd(uploadInfo) {
|
|
|
setIsLoading(false);
|
|
|
},
|
|
|
onUploadSucceed: function onUploadSucceed(uploadInfo) {
|
|
|
setIsLoading(false);
|
|
|
console.log("files.current", files.current);
|
|
|
// files.current
|
|
|
},
|
|
|
|
|
|
onUploadError: function onUploadError(uploadInfo) {
|
|
|
setIsLoading(false);
|
|
|
},
|
|
|
gotUploader: function gotUploader(_uploader) {
|
|
|
_uploader.addFile(file, null, null, null, userData);
|
|
|
uploader.current = _uploader;
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
var handlePublish = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var _state$videoList5;
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
if ((_state$videoList5 = state.videoList) !== null && _state$videoList5 !== void 0 && _state$videoList5.length) {
|
|
|
_context.next = 3;
|
|
|
break;
|
|
|
}
|
|
|
message/* default.info */.ZP.info('请先上传视频');
|
|
|
return _context.abrupt("return");
|
|
|
case 3:
|
|
|
_context.next = 5;
|
|
|
return (0,service_user/* batchPublish */.dt)({
|
|
|
username: params.username,
|
|
|
videos: state.videoList.map(function (item) {
|
|
|
return {
|
|
|
video_id: item.videoId,
|
|
|
title: item.title,
|
|
|
filename: item.filename,
|
|
|
attachment_id: item.attachment_id,
|
|
|
course_id: params.coursesId,
|
|
|
category_id: searchParams.get("categoryId"),
|
|
|
allow_skip: item.allow_skip
|
|
|
};
|
|
|
})
|
|
|
});
|
|
|
case 5:
|
|
|
res = _context.sent;
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
(0,util/* trackEvent */.L9)(['教学课堂', '视频', '上传视频']);
|
|
|
_umi_production_exports.history.back();
|
|
|
dispatch({
|
|
|
type: 'classroomList/getClassroomLeftMenus',
|
|
|
payload: {
|
|
|
id: params.coursesId
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
case 7:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function handlePublish() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var hasFile = (_state$videoList6 = state.videoList) === null || _state$videoList6 === void 0 ? void 0 : _state$videoList6.length;
|
|
|
var renderUpload = function renderUpload() {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Uploadmodules.main,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Uploadmodules.uploadTop,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("label", {
|
|
|
htmlFor: "fileUpload",
|
|
|
className: Uploadmodules.imgWrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
className: Uploadmodules.defaultImg,
|
|
|
src: upload
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
className: Uploadmodules.hoverImg,
|
|
|
src: upload_hover
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Uploadmodules.uploadTitle,
|
|
|
children: "\u9009\u62E9\u60A8\u8981\u4E0A\u4F20\u7684\u89C6\u9891"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["\u4E0A\u4F20\u89C6\u9891\uFF0C\u5373\u8868\u793A\u60A8\u5DF2\u540C\u610F", /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
|
to: "/users/".concat(params === null || params === void 0 ? void 0 : params.username, "/videos/protocol"),
|
|
|
className: Uploadmodules.colorBlue,
|
|
|
children: "\u4E0A\u4F20\u5185\u5BB9\u534F\u8BAE"
|
|
|
}), "\uFF0C\u4E0D\u5F97\u4E0A\u4F20\u672A\u7ECF\u4ED6\u4EBA\u6388\u6743\u7684\u4F5C\u54C1"]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Uploadmodules.uploadDescription,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Uploadmodules.description,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u4E0A\u4F20\u8BF4\u660E\uFF1A\u76EE\u524D\u4E0D\u652F\u6301\u65AD\u70B9\u7EED\u4F20\uFF0C\u5355\u4E2A\u89C6\u9891\u6587\u4EF6\u6700\u5927\u9650\u52361G\uFF0C\u5355\u6B21\u6700\u591A\u652F\u63013\u4E2A\u89C6\u9891\u6587\u4EF6\u4E0A\u4F20 "
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u89C6\u9891\u89C4\u683C\uFF1Aavi\u3001flv\u3001f4v\u3001m4v\u3001mov\u3001mp4\u3001rmvb\u3001swf\u3001webm\u3001wmv "
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["\u6E29\u99A8\u63D0\u793A\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Uploadmodules.colorOrange,
|
|
|
children: "\u4E3A\u4E86\u66F4\u597D\u7684\u64AD\u653E\u4F53\u9A8C\uFF0C\u5EFA\u8BAE\u60A8\u4F18\u5148\u4E0A\u4F20MP4\u683C\u5F0F\u3002\u5982\u679C\u60A8\u662F\u81EA\u5DF1\u5F55\u5236\u89C6\u9891\uFF0C\u5EFA\u8BAE\u60A8\u4FDD\u5B58\u7684\u65F6\u5019\u5C06\u89C6\u9891\u7F16\u7801\u8BBE\u7F6E\u4E3AAVC(H264)"
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var renderFile = function renderFile() {
|
|
|
var _state$videoList7, _state$videoList8;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Uploadmodules.fileMain,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
|
|
|
spinning: isLoading,
|
|
|
children: (_state$videoList7 = state.videoList) === null || _state$videoList7 === void 0 ? void 0 : _state$videoList7.map(function (item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Uploadmodules.fileWrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [index + 1, ". ", item.name]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Uploadmodules.fileProgress,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(progress/* default */.Z, {
|
|
|
percent: item.loaded,
|
|
|
status: item.loaded == 100 ? "normal" : 'active'
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Uploadmodules.fileCancel,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "primary",
|
|
|
onClick: function onClick() {
|
|
|
return handleRemove(item.name, item.loaded == 100);
|
|
|
},
|
|
|
children: item.loaded === 100 ? '删除' : '取消上传'
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Uploadmodules.fileInputWrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "mr5",
|
|
|
children: "\u6807\u9898:"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
value: item.title,
|
|
|
onChange: function onChange(e) {
|
|
|
stateDispatch({
|
|
|
type: 'updateTitle',
|
|
|
payload: {
|
|
|
title: e.target.value,
|
|
|
item: item
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
className: Uploadmodules.fileInput,
|
|
|
placeholder: "\u6807\u9898\u652F\u6301\u6700\u591A".concat(MAX_LENGTH, "\u4E2A\u5B57\u7B26"),
|
|
|
maxLength: MAX_LENGTH,
|
|
|
addonAfter: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "c-light-black font12",
|
|
|
children: [String(item.title.length), "/", MAX_LENGTH]
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Uploadmodules.fileImgWrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
|
className: "mr5",
|
|
|
children: "\u4E0A\u4F20\u5C01\u9762\u56FE:"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(CoverUpload/* default */.Z, {
|
|
|
value: item === null || item === void 0 ? void 0 : item.attachment_id,
|
|
|
onChange: function onChange(e) {
|
|
|
stateDispatch({
|
|
|
type: 'updateImg',
|
|
|
payload: {
|
|
|
attachment_id: e,
|
|
|
item: item
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
className: "mt10",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "mr5",
|
|
|
children: "\u64AD\u653E\u8BBE\u7F6E:"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
className: "font14",
|
|
|
checked: item.allow_skip,
|
|
|
onChange: function onChange(e) {
|
|
|
stateDispatch({
|
|
|
type: 'updateAllowSkip',
|
|
|
payload: {
|
|
|
allow_skip: e.target.checked,
|
|
|
item: item
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
children: "\u5141\u8BB8\u5FEB\u8FDB\u64AD\u653E"
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt10",
|
|
|
children: ((_state$videoList8 = state.videoList) === null || _state$videoList8 === void 0 ? void 0 : _state$videoList8.length) <= 2 ? /*#__PURE__*/(0,jsx_runtime.jsx)("label", {
|
|
|
htmlFor: "fileUpload",
|
|
|
className: "".concat(Uploadmodules.continueAdd, " current"),
|
|
|
children: "\u7EE7\u7EED\u6DFB\u52A0"
|
|
|
}) : '提示:单次最多支持3个视频文件上传'
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Uploadmodules.description,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u4E0A\u4F20\u8BF4\u660E\uFF1A\u76EE\u524D\u4E0D\u652F\u6301\u65AD\u70B9\u7EED\u4F20\uFF0C\u5355\u4E2A\u89C6\u9891\u6587\u4EF6\u6700\u5927\u9650\u52361G\uFF0C\u5355\u6B21\u6700\u591A\u652F\u63013\u4E2A\u89C6\u9891\u6587\u4EF6\u4E0A\u4F20 "
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u89C6\u9891\u89C4\u683C\uFF1Aavi\u3001flv\u3001f4v\u3001m4v\u3001mov\u3001mp4\u3001rmvb\u3001swf\u3001webm\u3001wmv "
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["\u6E29\u99A8\u63D0\u793A\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Uploadmodules.colorOrange,
|
|
|
children: "\u4E3A\u4E86\u66F4\u597D\u7684\u64AD\u653E\u4F53\u9A8C\uFF0C\u5EFA\u8BAE\u60A8\u4F18\u5148\u4E0A\u4F20MP4\u683C\u5F0F\u3002\u5982\u679C\u60A8\u662F\u81EA\u5DF1\u5F55\u5236\u89C6\u9891\uFF0C\u5EFA\u8BAE\u60A8\u4FDD\u5B58\u7684\u65F6\u5019\u5C06\u89C6\u9891\u7F16\u7801\u8BBE\u7F6E\u4E3AAVC(H264)"
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Uploadmodules.flexRowCenter,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "primary",
|
|
|
onClick: handlePublish,
|
|
|
children: "\u7ACB\u5373\u53D1\u5E03"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "".concat(Uploadmodules.flexRowCenter, " mt10"),
|
|
|
children: ["\u4E0A\u4F20\u89C6\u9891\uFF0C\u5373\u8868\u793A\u60A8\u5DF2\u540C\u610F", /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
|
to: "/users/".concat(params === null || params === void 0 ? void 0 : params.username, "/videos/protocol"),
|
|
|
className: Uploadmodules.colorBlue,
|
|
|
children: "\u4E0A\u4F20\u5185\u5BB9\u534F\u8BAE"
|
|
|
}), "\uFF0C\u4E0D\u5F97\u4E0A\u4F20\u672A\u7ECF\u4ED6\u4EBA\u6388\u6743\u7684\u4F5C\u54C1"]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: Uploadmodules.bg,
|
|
|
style: {
|
|
|
width: '100%'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "mt5",
|
|
|
style: {
|
|
|
display: 'flex',
|
|
|
alignItems: "baseline"
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(LeftOutlined/* default */.Z, {
|
|
|
style: {
|
|
|
marginTop: '8px'
|
|
|
},
|
|
|
className: "current mr10 font16",
|
|
|
onClick: function onClick() {
|
|
|
_umi_production_exports.history.push("/classrooms/".concat(params.coursesId, "/video"));
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("h2", {
|
|
|
children: "\u4E0A\u4F20\u89C6\u9891"
|
|
|
})]
|
|
|
}), hasFile ? renderFile() : renderUpload(), /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
ref: files,
|
|
|
type: "file",
|
|
|
id: "fileUpload",
|
|
|
style: {
|
|
|
display: 'none'
|
|
|
},
|
|
|
onChange: handleChangeUpload,
|
|
|
accept: ".mkv, .flv, .f4v, .rmvb, .swf, video/mp4,video/x-m4v,video/flv,video/f4v,video/rmvb,video/swf,video/*"
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var Video_Upload = ((0,_umi_production_exports.connect)(function (_ref3) {
|
|
|
var user = _ref3.user,
|
|
|
userDetail = _ref3.userDetail,
|
|
|
loading = _ref3.loading,
|
|
|
globalSetting = _ref3.globalSetting;
|
|
|
return {
|
|
|
user: user,
|
|
|
userDetail: userDetail,
|
|
|
globalSetting: globalSetting,
|
|
|
loading: loading.models.index
|
|
|
};
|
|
|
})(Upload));
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 84567:
|
|
|
/*!************************************************************!*\
|
|
|
!*** ./node_modules/antd/es/checkbox/index.js + 3 modules ***!
|
|
|
\************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
"Z": function() { return /* binding */ es_checkbox; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
|
|
var classnames = __webpack_require__(94184);
|
|
|
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-checkbox/es/index.js + 5 modules
|
|
|
var es = __webpack_require__(95860);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
|
var react = __webpack_require__(67294);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/config-provider/context.js
|
|
|
var config_provider_context = __webpack_require__(53124);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/config-provider/DisabledContext.js
|
|
|
var DisabledContext = __webpack_require__(98866);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/form/context.js
|
|
|
var context = __webpack_require__(65223);
|
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/checkbox/GroupContext.js
|
|
|
|
|
|
const GroupContext = /*#__PURE__*/react.createContext(null);
|
|
|
/* harmony default export */ var checkbox_GroupContext = (GroupContext);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/checkbox/style/index.js
|
|
|
var checkbox_style = __webpack_require__(63185);
|
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/checkbox/Checkbox.js
|
|
|
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 InternalCheckbox = (props, ref) => {
|
|
|
var _a;
|
|
|
const {
|
|
|
prefixCls: customizePrefixCls,
|
|
|
className,
|
|
|
rootClassName,
|
|
|
children,
|
|
|
indeterminate = false,
|
|
|
style,
|
|
|
onMouseEnter,
|
|
|
onMouseLeave,
|
|
|
skipGroup = false,
|
|
|
disabled
|
|
|
} = props,
|
|
|
restProps = __rest(props, ["prefixCls", "className", "rootClassName", "children", "indeterminate", "style", "onMouseEnter", "onMouseLeave", "skipGroup", "disabled"]);
|
|
|
const {
|
|
|
getPrefixCls,
|
|
|
direction,
|
|
|
checkbox
|
|
|
} = react.useContext(config_provider_context/* ConfigContext */.E_);
|
|
|
const checkboxGroup = react.useContext(checkbox_GroupContext);
|
|
|
const {
|
|
|
isFormItemInput
|
|
|
} = react.useContext(context/* FormItemInputContext */.aM);
|
|
|
const contextDisabled = react.useContext(DisabledContext/* default */.Z);
|
|
|
const mergedDisabled = (_a = (checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.disabled) || disabled) !== null && _a !== void 0 ? _a : contextDisabled;
|
|
|
const prevValue = react.useRef(restProps.value);
|
|
|
react.useEffect(() => {
|
|
|
checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.registerValue(restProps.value);
|
|
|
false ? 0 : void 0;
|
|
|
}, []);
|
|
|
react.useEffect(() => {
|
|
|
if (skipGroup) {
|
|
|
return;
|
|
|
}
|
|
|
if (restProps.value !== prevValue.current) {
|
|
|
checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.cancelValue(prevValue.current);
|
|
|
checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.registerValue(restProps.value);
|
|
|
prevValue.current = restProps.value;
|
|
|
}
|
|
|
return () => checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.cancelValue(restProps.value);
|
|
|
}, [restProps.value]);
|
|
|
const prefixCls = getPrefixCls('checkbox', customizePrefixCls);
|
|
|
const [wrapSSR, hashId] = (0,checkbox_style/* default */.ZP)(prefixCls);
|
|
|
const checkboxProps = Object.assign({}, restProps);
|
|
|
if (checkboxGroup && !skipGroup) {
|
|
|
checkboxProps.onChange = function () {
|
|
|
if (restProps.onChange) {
|
|
|
restProps.onChange.apply(restProps, arguments);
|
|
|
}
|
|
|
if (checkboxGroup.toggleOption) {
|
|
|
checkboxGroup.toggleOption({
|
|
|
label: children,
|
|
|
value: restProps.value
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
checkboxProps.name = checkboxGroup.name;
|
|
|
checkboxProps.checked = checkboxGroup.value.includes(restProps.value);
|
|
|
}
|
|
|
const classString = classnames_default()(`${prefixCls}-wrapper`, {
|
|
|
[`${prefixCls}-rtl`]: direction === 'rtl',
|
|
|
[`${prefixCls}-wrapper-checked`]: checkboxProps.checked,
|
|
|
[`${prefixCls}-wrapper-disabled`]: mergedDisabled,
|
|
|
[`${prefixCls}-wrapper-in-form-item`]: isFormItemInput
|
|
|
}, checkbox === null || checkbox === void 0 ? void 0 : checkbox.className, className, rootClassName, hashId);
|
|
|
const checkboxClass = classnames_default()({
|
|
|
[`${prefixCls}-indeterminate`]: indeterminate
|
|
|
}, hashId);
|
|
|
const ariaChecked = indeterminate ? 'mixed' : undefined;
|
|
|
return wrapSSR(
|
|
|
/*#__PURE__*/
|
|
|
// eslint-disable-next-line jsx-a11y/label-has-associated-control
|
|
|
react.createElement("label", {
|
|
|
className: classString,
|
|
|
style: Object.assign(Object.assign({}, checkbox === null || checkbox === void 0 ? void 0 : checkbox.style), style),
|
|
|
onMouseEnter: onMouseEnter,
|
|
|
onMouseLeave: onMouseLeave
|
|
|
}, /*#__PURE__*/react.createElement(es/* default */.Z, Object.assign({
|
|
|
"aria-checked": ariaChecked
|
|
|
}, checkboxProps, {
|
|
|
prefixCls: prefixCls,
|
|
|
className: checkboxClass,
|
|
|
disabled: mergedDisabled,
|
|
|
ref: ref
|
|
|
})), children !== undefined && /*#__PURE__*/react.createElement("span", null, children)));
|
|
|
};
|
|
|
const Checkbox = /*#__PURE__*/react.forwardRef(InternalCheckbox);
|
|
|
if (false) {}
|
|
|
/* harmony default export */ var checkbox_Checkbox = (Checkbox);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
|
|
|
var toConsumableArray = __webpack_require__(74902);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/node_modules/rc-util/es/omit.js
|
|
|
var omit = __webpack_require__(10366);
|
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/checkbox/Group.js
|
|
|
|
|
|
var Group_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 InternalGroup = (props, ref) => {
|
|
|
const {
|
|
|
defaultValue,
|
|
|
children,
|
|
|
options = [],
|
|
|
prefixCls: customizePrefixCls,
|
|
|
className,
|
|
|
rootClassName,
|
|
|
style,
|
|
|
onChange
|
|
|
} = props,
|
|
|
restProps = Group_rest(props, ["defaultValue", "children", "options", "prefixCls", "className", "rootClassName", "style", "onChange"]);
|
|
|
const {
|
|
|
getPrefixCls,
|
|
|
direction
|
|
|
} = react.useContext(config_provider_context/* ConfigContext */.E_);
|
|
|
const [value, setValue] = react.useState(restProps.value || defaultValue || []);
|
|
|
const [registeredValues, setRegisteredValues] = react.useState([]);
|
|
|
react.useEffect(() => {
|
|
|
if ('value' in restProps) {
|
|
|
setValue(restProps.value || []);
|
|
|
}
|
|
|
}, [restProps.value]);
|
|
|
const memoOptions = react.useMemo(() => options.map(option => {
|
|
|
if (typeof option === 'string' || typeof option === 'number') {
|
|
|
return {
|
|
|
label: option,
|
|
|
value: option
|
|
|
};
|
|
|
}
|
|
|
return option;
|
|
|
}), [options]);
|
|
|
const cancelValue = val => {
|
|
|
setRegisteredValues(prevValues => prevValues.filter(v => v !== val));
|
|
|
};
|
|
|
const registerValue = val => {
|
|
|
setRegisteredValues(prevValues => [].concat((0,toConsumableArray/* default */.Z)(prevValues), [val]));
|
|
|
};
|
|
|
const toggleOption = option => {
|
|
|
const optionIndex = value.indexOf(option.value);
|
|
|
const newValue = (0,toConsumableArray/* default */.Z)(value);
|
|
|
if (optionIndex === -1) {
|
|
|
newValue.push(option.value);
|
|
|
} else {
|
|
|
newValue.splice(optionIndex, 1);
|
|
|
}
|
|
|
if (!('value' in restProps)) {
|
|
|
setValue(newValue);
|
|
|
}
|
|
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue.filter(val => registeredValues.includes(val)).sort((a, b) => {
|
|
|
const indexA = memoOptions.findIndex(opt => opt.value === a);
|
|
|
const indexB = memoOptions.findIndex(opt => opt.value === b);
|
|
|
return indexA - indexB;
|
|
|
}));
|
|
|
};
|
|
|
const prefixCls = getPrefixCls('checkbox', customizePrefixCls);
|
|
|
const groupPrefixCls = `${prefixCls}-group`;
|
|
|
const [wrapSSR, hashId] = (0,checkbox_style/* default */.ZP)(prefixCls);
|
|
|
const domProps = (0,omit/* default */.Z)(restProps, ['value', 'disabled']);
|
|
|
const childrenNode = options.length ? memoOptions.map(option => /*#__PURE__*/react.createElement(checkbox_Checkbox, {
|
|
|
prefixCls: prefixCls,
|
|
|
key: option.value.toString(),
|
|
|
disabled: 'disabled' in option ? option.disabled : restProps.disabled,
|
|
|
value: option.value,
|
|
|
checked: value.includes(option.value),
|
|
|
onChange: option.onChange,
|
|
|
className: `${groupPrefixCls}-item`,
|
|
|
style: option.style,
|
|
|
title: option.title
|
|
|
}, option.label)) : children;
|
|
|
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
|
const context = {
|
|
|
toggleOption,
|
|
|
value,
|
|
|
disabled: restProps.disabled,
|
|
|
name: restProps.name,
|
|
|
// https://github.com/ant-design/ant-design/issues/16376
|
|
|
registerValue,
|
|
|
cancelValue
|
|
|
};
|
|
|
const classString = classnames_default()(groupPrefixCls, {
|
|
|
[`${groupPrefixCls}-rtl`]: direction === 'rtl'
|
|
|
}, className, rootClassName, hashId);
|
|
|
return wrapSSR( /*#__PURE__*/react.createElement("div", Object.assign({
|
|
|
className: classString,
|
|
|
style: style
|
|
|
}, domProps, {
|
|
|
ref: ref
|
|
|
}), /*#__PURE__*/react.createElement(checkbox_GroupContext.Provider, {
|
|
|
value: context
|
|
|
}, childrenNode)));
|
|
|
};
|
|
|
|
|
|
const CheckboxGroup = /*#__PURE__*/react.forwardRef(InternalGroup);
|
|
|
/* harmony default export */ var Group = (/*#__PURE__*/react.memo(CheckboxGroup));
|
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/checkbox/index.js
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
|
|
const es_checkbox_Checkbox = checkbox_Checkbox;
|
|
|
es_checkbox_Checkbox.Group = Group;
|
|
|
es_checkbox_Checkbox.__ANT_CHECKBOX = true;
|
|
|
if (false) {}
|
|
|
/* harmony default export */ var es_checkbox = (es_checkbox_Checkbox);
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 63185:
|
|
|
/*!******************************************************!*\
|
|
|
!*** ./node_modules/antd/es/checkbox/style/index.js ***!
|
|
|
\******************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ "C2": function() { return /* binding */ getStyle; }
|
|
|
/* harmony export */ });
|
|
|
/* unused harmony export genCheckboxStyle */
|
|
|
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ 68024);
|
|
|
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ 14747);
|
|
|
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ 45503);
|
|
|
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ 67968);
|
|
|
|
|
|
|
|
|
|
|
|
// ============================== Motion ==============================
|
|
|
const antCheckboxEffect = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antCheckboxEffect', {
|
|
|
'0%': {
|
|
|
transform: 'scale(1)',
|
|
|
opacity: 0.5
|
|
|
},
|
|
|
'100%': {
|
|
|
transform: 'scale(1.6)',
|
|
|
opacity: 0
|
|
|
}
|
|
|
});
|
|
|
// ============================== Styles ==============================
|
|
|
const genCheckboxStyle = token => {
|
|
|
const {
|
|
|
checkboxCls
|
|
|
} = token;
|
|
|
const wrapperCls = `${checkboxCls}-wrapper`;
|
|
|
return [
|
|
|
// ===================== Basic =====================
|
|
|
{
|
|
|
// Group
|
|
|
[`${checkboxCls}-group`]: Object.assign(Object.assign({}, (0,_style__WEBPACK_IMPORTED_MODULE_1__/* .resetComponent */ .Wf)(token)), {
|
|
|
display: 'inline-flex',
|
|
|
flexWrap: 'wrap',
|
|
|
columnGap: token.marginXS,
|
|
|
// Group > Grid
|
|
|
[`> ${token.antCls}-row`]: {
|
|
|
flex: 1
|
|
|
}
|
|
|
}),
|
|
|
// Wrapper
|
|
|
[wrapperCls]: Object.assign(Object.assign({}, (0,_style__WEBPACK_IMPORTED_MODULE_1__/* .resetComponent */ .Wf)(token)), {
|
|
|
display: 'inline-flex',
|
|
|
alignItems: 'baseline',
|
|
|
cursor: 'pointer',
|
|
|
// Fix checkbox & radio in flex align #30260
|
|
|
'&:after': {
|
|
|
display: 'inline-block',
|
|
|
width: 0,
|
|
|
overflow: 'hidden',
|
|
|
content: "'\\a0'"
|
|
|
},
|
|
|
// Checkbox near checkbox
|
|
|
[`& + ${wrapperCls}`]: {
|
|
|
marginInlineStart: 0
|
|
|
},
|
|
|
[`&${wrapperCls}-in-form-item`]: {
|
|
|
'input[type="checkbox"]': {
|
|
|
width: 14,
|
|
|
height: 14 // FIXME: magic
|
|
|
}
|
|
|
}
|
|
|
}),
|
|
|
|
|
|
// Wrapper > Checkbox
|
|
|
[checkboxCls]: Object.assign(Object.assign({}, (0,_style__WEBPACK_IMPORTED_MODULE_1__/* .resetComponent */ .Wf)(token)), {
|
|
|
position: 'relative',
|
|
|
whiteSpace: 'nowrap',
|
|
|
lineHeight: 1,
|
|
|
cursor: 'pointer',
|
|
|
// To make alignment right when `controlHeight` is changed
|
|
|
// Ref: https://github.com/ant-design/ant-design/issues/41564
|
|
|
alignSelf: 'center',
|
|
|
// Wrapper > Checkbox > input
|
|
|
[`${checkboxCls}-input`]: {
|
|
|
position: 'absolute',
|
|
|
// Since baseline align will get additional space offset,
|
|
|
// we need to move input to top to make it align with text.
|
|
|
// Ref: https://github.com/ant-design/ant-design/issues/38926#issuecomment-1486137799
|
|
|
inset: 0,
|
|
|
zIndex: 1,
|
|
|
cursor: 'pointer',
|
|
|
opacity: 0,
|
|
|
margin: 0,
|
|
|
[`&:focus-visible + ${checkboxCls}-inner`]: Object.assign({}, (0,_style__WEBPACK_IMPORTED_MODULE_1__/* .genFocusOutline */ .oN)(token))
|
|
|
},
|
|
|
// Wrapper > Checkbox > inner
|
|
|
[`${checkboxCls}-inner`]: {
|
|
|
boxSizing: 'border-box',
|
|
|
position: 'relative',
|
|
|
top: 0,
|
|
|
insetInlineStart: 0,
|
|
|
display: 'block',
|
|
|
width: token.checkboxSize,
|
|
|
height: token.checkboxSize,
|
|
|
direction: 'ltr',
|
|
|
backgroundColor: token.colorBgContainer,
|
|
|
border: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`,
|
|
|
borderRadius: token.borderRadiusSM,
|
|
|
borderCollapse: 'separate',
|
|
|
transition: `all ${token.motionDurationSlow}`,
|
|
|
'&:after': {
|
|
|
boxSizing: 'border-box',
|
|
|
position: 'absolute',
|
|
|
top: '50%',
|
|
|
insetInlineStart: '21.5%',
|
|
|
display: 'table',
|
|
|
width: token.checkboxSize / 14 * 5,
|
|
|
height: token.checkboxSize / 14 * 8,
|
|
|
border: `${token.lineWidthBold}px solid ${token.colorWhite}`,
|
|
|
borderTop: 0,
|
|
|
borderInlineStart: 0,
|
|
|
transform: 'rotate(45deg) scale(0) translate(-50%,-50%)',
|
|
|
opacity: 0,
|
|
|
content: '""',
|
|
|
transition: `all ${token.motionDurationFast} ${token.motionEaseInBack}, opacity ${token.motionDurationFast}`
|
|
|
}
|
|
|
},
|
|
|
// Wrapper > Checkbox + Text
|
|
|
'& + span': {
|
|
|
paddingInlineStart: token.paddingXS,
|
|
|
paddingInlineEnd: token.paddingXS
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
// ===================== Hover =====================
|
|
|
{
|
|
|
// Wrapper
|
|
|
[`${wrapperCls}:hover ${checkboxCls}:after`]: {
|
|
|
visibility: 'visible'
|
|
|
},
|
|
|
// Wrapper & Wrapper > Checkbox
|
|
|
[`
|
|
|
${wrapperCls}:not(${wrapperCls}-disabled),
|
|
|
${checkboxCls}:not(${checkboxCls}-disabled)
|
|
|
`]: {
|
|
|
[`&:hover ${checkboxCls}-inner`]: {
|
|
|
borderColor: token.colorPrimary
|
|
|
}
|
|
|
},
|
|
|
[`${wrapperCls}:not(${wrapperCls}-disabled)`]: {
|
|
|
[`&:hover ${checkboxCls}-checked:not(${checkboxCls}-disabled) ${checkboxCls}-inner`]: {
|
|
|
backgroundColor: token.colorPrimaryHover,
|
|
|
borderColor: 'transparent'
|
|
|
},
|
|
|
[`&:hover ${checkboxCls}-checked:not(${checkboxCls}-disabled):after`]: {
|
|
|
borderColor: token.colorPrimaryHover
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
// ==================== Checked ====================
|
|
|
{
|
|
|
// Wrapper > Checkbox
|
|
|
[`${checkboxCls}-checked`]: {
|
|
|
[`${checkboxCls}-inner`]: {
|
|
|
backgroundColor: token.colorPrimary,
|
|
|
borderColor: token.colorPrimary,
|
|
|
'&:after': {
|
|
|
opacity: 1,
|
|
|
transform: 'rotate(45deg) scale(1) translate(-50%,-50%)',
|
|
|
transition: `all ${token.motionDurationMid} ${token.motionEaseOutBack} ${token.motionDurationFast}`
|
|
|
}
|
|
|
},
|
|
|
// Checked Effect
|
|
|
'&:after': {
|
|
|
position: 'absolute',
|
|
|
top: 0,
|
|
|
insetInlineStart: 0,
|
|
|
width: '100%',
|
|
|
height: '100%',
|
|
|
borderRadius: token.borderRadiusSM,
|
|
|
visibility: 'hidden',
|
|
|
border: `${token.lineWidthBold}px solid ${token.colorPrimary}`,
|
|
|
animationName: antCheckboxEffect,
|
|
|
animationDuration: token.motionDurationSlow,
|
|
|
animationTimingFunction: 'ease-in-out',
|
|
|
animationFillMode: 'backwards',
|
|
|
content: '""',
|
|
|
transition: `all ${token.motionDurationSlow}`
|
|
|
}
|
|
|
},
|
|
|
[`
|
|
|
${wrapperCls}-checked:not(${wrapperCls}-disabled),
|
|
|
${checkboxCls}-checked:not(${checkboxCls}-disabled)
|
|
|
`]: {
|
|
|
[`&:hover ${checkboxCls}-inner`]: {
|
|
|
backgroundColor: token.colorPrimaryHover,
|
|
|
borderColor: 'transparent'
|
|
|
},
|
|
|
[`&:hover ${checkboxCls}:after`]: {
|
|
|
borderColor: token.colorPrimaryHover
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
// ================= Indeterminate =================
|
|
|
{
|
|
|
[checkboxCls]: {
|
|
|
'&-indeterminate': {
|
|
|
// Wrapper > Checkbox > inner
|
|
|
[`${checkboxCls}-inner`]: {
|
|
|
backgroundColor: token.colorBgContainer,
|
|
|
borderColor: token.colorBorder,
|
|
|
'&:after': {
|
|
|
top: '50%',
|
|
|
insetInlineStart: '50%',
|
|
|
width: token.fontSizeLG / 2,
|
|
|
height: token.fontSizeLG / 2,
|
|
|
backgroundColor: token.colorPrimary,
|
|
|
border: 0,
|
|
|
transform: 'translate(-50%, -50%) scale(1)',
|
|
|
opacity: 1,
|
|
|
content: '""'
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
// ==================== Disable ====================
|
|
|
{
|
|
|
// Wrapper
|
|
|
[`${wrapperCls}-disabled`]: {
|
|
|
cursor: 'not-allowed'
|
|
|
},
|
|
|
// Wrapper > Checkbox
|
|
|
[`${checkboxCls}-disabled`]: {
|
|
|
// Wrapper > Checkbox > input
|
|
|
[`&, ${checkboxCls}-input`]: {
|
|
|
cursor: 'not-allowed',
|
|
|
// Disabled for native input to enable Tooltip event handler
|
|
|
// ref: https://github.com/ant-design/ant-design/issues/39822#issuecomment-1365075901
|
|
|
pointerEvents: 'none'
|
|
|
},
|
|
|
// Wrapper > Checkbox > inner
|
|
|
[`${checkboxCls}-inner`]: {
|
|
|
background: token.colorBgContainerDisabled,
|
|
|
borderColor: token.colorBorder,
|
|
|
'&:after': {
|
|
|
borderColor: token.colorTextDisabled
|
|
|
}
|
|
|
},
|
|
|
'&:after': {
|
|
|
display: 'none'
|
|
|
},
|
|
|
'& + span': {
|
|
|
color: token.colorTextDisabled
|
|
|
},
|
|
|
[`&${checkboxCls}-indeterminate ${checkboxCls}-inner::after`]: {
|
|
|
background: token.colorTextDisabled
|
|
|
}
|
|
|
}
|
|
|
}];
|
|
|
};
|
|
|
// ============================== Export ==============================
|
|
|
function getStyle(prefixCls, token) {
|
|
|
const checkboxToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__/* .merge */ .TS)(token, {
|
|
|
checkboxCls: `.${prefixCls}`,
|
|
|
checkboxSize: token.controlInteractiveSize
|
|
|
});
|
|
|
return [genCheckboxStyle(checkboxToken)];
|
|
|
}
|
|
|
/* harmony default export */ __webpack_exports__["ZP"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)('Checkbox', (token, _ref) => {
|
|
|
let {
|
|
|
prefixCls
|
|
|
} = _ref;
|
|
|
return [getStyle(prefixCls, token)];
|
|
|
}));
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 95860:
|
|
|
/*!**********************************************************!*\
|
|
|
!*** ./node_modules/rc-checkbox/es/index.js + 5 modules ***!
|
|
|
\**********************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
"Z": function() { return /* binding */ es; }
|
|
|
});
|
|
|
|
|
|
// UNUSED EXPORTS: Checkbox
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
|
|
var esm_extends = __webpack_require__(87462);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(1413);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
|
var defineProperty = __webpack_require__(4942);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
|
|
|
var slicedToArray = __webpack_require__(97685);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
|
|
|
var objectWithoutProperties = __webpack_require__(45987);
|
|
|
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
|
|
var classnames = __webpack_require__(94184);
|
|
|
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
|
var react = __webpack_require__(67294);
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-checkbox/node_modules/rc-util/es/hooks/useEvent.js
|
|
|
|
|
|
function useEvent(callback) {
|
|
|
var fnRef = react.useRef();
|
|
|
fnRef.current = callback;
|
|
|
var memoFn = react.useCallback(function () {
|
|
|
var _fnRef$current;
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
|
args[_key] = arguments[_key];
|
|
|
}
|
|
|
return (_fnRef$current = fnRef.current) === null || _fnRef$current === void 0 ? void 0 : _fnRef$current.call.apply(_fnRef$current, [fnRef].concat(args));
|
|
|
}, []);
|
|
|
return memoFn;
|
|
|
}
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-checkbox/node_modules/rc-util/es/Dom/canUseDom.js
|
|
|
function canUseDom() {
|
|
|
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
|
}
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-checkbox/node_modules/rc-util/es/hooks/useLayoutEffect.js
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* Wrap `React.useLayoutEffect` which will not throw warning message in test env
|
|
|
*/
|
|
|
var useInternalLayoutEffect = true && canUseDom() ? react.useLayoutEffect : react.useEffect;
|
|
|
var useLayoutEffect = function useLayoutEffect(callback, deps) {
|
|
|
var firstMountRef = react.useRef(true);
|
|
|
useInternalLayoutEffect(function () {
|
|
|
return callback(firstMountRef.current);
|
|
|
}, deps);
|
|
|
|
|
|
// We tell react that first mount has passed
|
|
|
useInternalLayoutEffect(function () {
|
|
|
firstMountRef.current = false;
|
|
|
return function () {
|
|
|
firstMountRef.current = true;
|
|
|
};
|
|
|
}, []);
|
|
|
};
|
|
|
var useLayoutUpdateEffect = function useLayoutUpdateEffect(callback, deps) {
|
|
|
useLayoutEffect(function (firstMount) {
|
|
|
if (!firstMount) {
|
|
|
return callback();
|
|
|
}
|
|
|
}, deps);
|
|
|
};
|
|
|
/* harmony default export */ var hooks_useLayoutEffect = ((/* unused pure expression or super */ null && (useLayoutEffect)));
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-checkbox/node_modules/rc-util/es/hooks/useState.js
|
|
|
|
|
|
|
|
|
/**
|
|
|
* Same as React.useState but `setState` accept `ignoreDestroy` param to not to setState after destroyed.
|
|
|
* We do not make this auto is to avoid real memory leak.
|
|
|
* Developer should confirm it's safe to ignore themselves.
|
|
|
*/
|
|
|
function useSafeState(defaultValue) {
|
|
|
var destroyRef = react.useRef(false);
|
|
|
var _React$useState = react.useState(defaultValue),
|
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 2),
|
|
|
value = _React$useState2[0],
|
|
|
setValue = _React$useState2[1];
|
|
|
react.useEffect(function () {
|
|
|
destroyRef.current = false;
|
|
|
return function () {
|
|
|
destroyRef.current = true;
|
|
|
};
|
|
|
}, []);
|
|
|
function safeSetState(updater, ignoreDestroy) {
|
|
|
if (ignoreDestroy && destroyRef.current) {
|
|
|
return;
|
|
|
}
|
|
|
setValue(updater);
|
|
|
}
|
|
|
return [value, safeSetState];
|
|
|
}
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-checkbox/node_modules/rc-util/es/hooks/useMergedState.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** We only think `undefined` is empty */
|
|
|
function hasValue(value) {
|
|
|
return value !== undefined;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Similar to `useState` but will use props value if provided.
|
|
|
* Note that internal use rc-util `useState` hook.
|
|
|
*/
|
|
|
function useMergedState(defaultStateValue, option) {
|
|
|
var _ref = option || {},
|
|
|
defaultValue = _ref.defaultValue,
|
|
|
value = _ref.value,
|
|
|
onChange = _ref.onChange,
|
|
|
postState = _ref.postState;
|
|
|
|
|
|
// ======================= Init =======================
|
|
|
var _useState = useSafeState(function () {
|
|
|
if (hasValue(value)) {
|
|
|
return value;
|
|
|
} else if (hasValue(defaultValue)) {
|
|
|
return typeof defaultValue === 'function' ? defaultValue() : defaultValue;
|
|
|
} else {
|
|
|
return typeof defaultStateValue === 'function' ? defaultStateValue() : defaultStateValue;
|
|
|
}
|
|
|
}),
|
|
|
_useState2 = (0,slicedToArray/* default */.Z)(_useState, 2),
|
|
|
innerValue = _useState2[0],
|
|
|
setInnerValue = _useState2[1];
|
|
|
var mergedValue = value !== undefined ? value : innerValue;
|
|
|
var postMergedValue = postState ? postState(mergedValue) : mergedValue;
|
|
|
|
|
|
// ====================== Change ======================
|
|
|
var onChangeFn = useEvent(onChange);
|
|
|
var _useState3 = useSafeState([mergedValue]),
|
|
|
_useState4 = (0,slicedToArray/* default */.Z)(_useState3, 2),
|
|
|
prevValue = _useState4[0],
|
|
|
setPrevValue = _useState4[1];
|
|
|
useLayoutUpdateEffect(function () {
|
|
|
var prev = prevValue[0];
|
|
|
if (innerValue !== prev) {
|
|
|
onChangeFn(innerValue, prev);
|
|
|
}
|
|
|
}, [prevValue]);
|
|
|
|
|
|
// Sync value back to `undefined` when it from control to un-control
|
|
|
useLayoutUpdateEffect(function () {
|
|
|
if (!hasValue(value)) {
|
|
|
setInnerValue(value);
|
|
|
}
|
|
|
}, [value]);
|
|
|
|
|
|
// ====================== Update ======================
|
|
|
var triggerChange = useEvent(function (updater, ignoreDestroy) {
|
|
|
setInnerValue(updater, ignoreDestroy);
|
|
|
setPrevValue([mergedValue], ignoreDestroy);
|
|
|
});
|
|
|
return [postMergedValue, triggerChange];
|
|
|
}
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-checkbox/es/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["prefixCls", "className", "style", "checked", "disabled", "defaultChecked", "type", "title", "onChange"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Checkbox = /*#__PURE__*/(0,react.forwardRef)(function (props, ref) {
|
|
|
var _classNames;
|
|
|
var _props$prefixCls = props.prefixCls,
|
|
|
prefixCls = _props$prefixCls === void 0 ? 'rc-checkbox' : _props$prefixCls,
|
|
|
className = props.className,
|
|
|
style = props.style,
|
|
|
checked = props.checked,
|
|
|
disabled = props.disabled,
|
|
|
_props$defaultChecked = props.defaultChecked,
|
|
|
defaultChecked = _props$defaultChecked === void 0 ? false : _props$defaultChecked,
|
|
|
_props$type = props.type,
|
|
|
type = _props$type === void 0 ? 'checkbox' : _props$type,
|
|
|
title = props.title,
|
|
|
onChange = props.onChange,
|
|
|
inputProps = (0,objectWithoutProperties/* default */.Z)(props, _excluded);
|
|
|
var inputRef = (0,react.useRef)(null);
|
|
|
var _useMergedState = useMergedState(defaultChecked, {
|
|
|
value: checked
|
|
|
}),
|
|
|
_useMergedState2 = (0,slicedToArray/* default */.Z)(_useMergedState, 2),
|
|
|
rawValue = _useMergedState2[0],
|
|
|
setRawValue = _useMergedState2[1];
|
|
|
(0,react.useImperativeHandle)(ref, function () {
|
|
|
return {
|
|
|
focus: function focus() {
|
|
|
var _inputRef$current;
|
|
|
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
|
},
|
|
|
blur: function blur() {
|
|
|
var _inputRef$current2;
|
|
|
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.blur();
|
|
|
},
|
|
|
input: inputRef.current
|
|
|
};
|
|
|
});
|
|
|
var classString = classnames_default()(prefixCls, className, (_classNames = {}, (0,defineProperty/* default */.Z)(_classNames, "".concat(prefixCls, "-checked"), rawValue), (0,defineProperty/* default */.Z)(_classNames, "".concat(prefixCls, "-disabled"), disabled), _classNames));
|
|
|
var handleChange = function handleChange(e) {
|
|
|
if (disabled) {
|
|
|
return;
|
|
|
}
|
|
|
if (!('checked' in props)) {
|
|
|
setRawValue(e.target.checked);
|
|
|
}
|
|
|
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
|
target: (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, props), {}, {
|
|
|
type: type,
|
|
|
checked: e.target.checked
|
|
|
}),
|
|
|
stopPropagation: function stopPropagation() {
|
|
|
e.stopPropagation();
|
|
|
},
|
|
|
preventDefault: function preventDefault() {
|
|
|
e.preventDefault();
|
|
|
},
|
|
|
nativeEvent: e.nativeEvent
|
|
|
});
|
|
|
};
|
|
|
return /*#__PURE__*/react.createElement("span", {
|
|
|
className: classString,
|
|
|
title: title,
|
|
|
style: style
|
|
|
}, /*#__PURE__*/react.createElement("input", (0,esm_extends/* default */.Z)({}, inputProps, {
|
|
|
className: "".concat(prefixCls, "-input"),
|
|
|
ref: inputRef,
|
|
|
onChange: handleChange,
|
|
|
disabled: disabled,
|
|
|
checked: !!rawValue,
|
|
|
type: type
|
|
|
})), /*#__PURE__*/react.createElement("span", {
|
|
|
className: "".concat(prefixCls, "-inner")
|
|
|
}));
|
|
|
});
|
|
|
/* harmony default export */ var es = (Checkbox);
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
}]); |