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.
NewEduCoderBuild/84894.async.js

749 lines
29 KiB

"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[84894],{
/***/ 84894:
/*!***************************************************!*\
!*** ./src/components/User/UnlockLogin/index.tsx ***!
\***************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js */ 10574);
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801);
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/asyncToGenerator.js */ 39343);
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js */ 11006);
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ 59301);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! antd */ 78241);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! antd */ 8591);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! antd */ 43418);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! antd */ 72315);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! antd */ 46400);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! antd */ 1056);
/* harmony import */ var _service_user__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/service/user */ 52138);
/* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! umi */ 66660);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
var inputStyle = {
height: 48,
borderRadius: 4
};
var LoginPopComponents = function LoginPopComponents(_ref) {
var dispatch = _ref.dispatch,
setType = _ref.setType,
data = _ref.data,
accountInfo = _ref.accountInfo,
open = _ref.open;
var _Form$useForm = antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.useForm(),
_Form$useForm2 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_Form$useForm, 1),
form = _Form$useForm2[0];
var _useSearchParams = (0,umi__WEBPACK_IMPORTED_MODULE_6__.useSearchParams)(),
_useSearchParams2 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useSearchParams, 1),
searchParams = _useSearchParams2[0];
var location = (0,umi__WEBPACK_IMPORTED_MODULE_6__.useLocation)();
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_4__.useState)(false),
_useState2 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState, 2),
openModal = _useState2[0],
setOpenModal = _useState2[1];
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_4__.useState)(''),
_useState4 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState3, 2),
errorValue = _useState4[0],
setErrorValue = _useState4[1];
var password = /^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$).{8,16}$/;
(0,react__WEBPACK_IMPORTED_MODULE_4__.useEffect)(function () {
setOpenModal(open);
}, [open]);
var columns = [{
title: 'IP地址',
dataIndex: 'ip',
key: 'ip',
render: function render(text) {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("span", {
className: text.indexOf("异常") > -1 || text.indexOf("登录") > -1 ? 'c-red' : 'c-green',
children: text
});
}
}, {
title: '浏览器',
dataIndex: 'browser',
key: 'browser',
render: function render(text) {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("span", {
className: text.indexOf("异常") > -1 || text.indexOf("登录") > -1 ? 'c-red' : 'c-green',
children: text
});
}
}, {
title: '上次登录时间',
dataIndex: 'last_login_time',
key: 'last_login_time'
}];
var dataSource = [{
"real_name": "edutest01",
"student_id": "test0001",
"last_login_time": "2023-05-20 13:53:10",
"ip": "ip地址正常",
"browser": "浏览器正常"
}];
var onFinish = /*#__PURE__*/function () {
var _ref2 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee() {
var res, from;
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return form.validateFields();
case 2:
_context.next = 4;
return (0,_service_user__WEBPACK_IMPORTED_MODULE_5__/* .LoginIn */ .Es)(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1___default()({}, accountInfo), form.getFieldValue()));
case 4:
res = _context.sent;
if (!res.status) {
_context.next = 12;
break;
}
if (!(res.status === -4)) {
_context.next = 10;
break;
}
dispatch({
type: 'user/showPopLogin',
payload: {
showPopLogin: false
}
});
dispatch({
type: 'user/setBindAccountModal',
payload: {
bindAccountModalVisible: true,
userInfoForBindAccountModal: res.user,
loginInfo: accountInfo
}
});
return _context.abrupt("return");
case 10:
setErrorValue(res === null || res === void 0 ? void 0 : res.message);
return _context.abrupt("return");
case 12:
setOpenModal(false);
if (res !== null && res !== void 0 && res.show) {
localStorage.setItem('extension-modal', 'exist');
localStorage.setItem('extension-date', res === null || res === void 0 ? void 0 : res.start_date);
} else {
localStorage.removeItem('extension-modal');
}
if (!(location.pathname === '/user/login' || location.pathname === '/login')) {
_context.next = 29;
break;
}
from = searchParams.get("form") || searchParams.get("back_url");
if (!from) {
_context.next = 20;
break;
}
window.location.href = decodeURIComponent(from);
_context.next = 27;
break;
case 20:
if (password.test(accountInfo.password)) {
_context.next = 25;
break;
}
antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .ZP.info('系统检测您的密码强度过低,请及时修改');
window.location.href = '/account/secure';
_context.next = 27;
break;
case 25:
window.location.reload();
return _context.abrupt("return");
case 27:
_context.next = 37;
break;
case 29:
if (password.test(accountInfo.password)) {
_context.next = 35;
break;
}
antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .ZP.info('系统检测您的密码强度过低,请及时修改');
umi__WEBPACK_IMPORTED_MODULE_6__.history.replace('/account/secure?active=3');
dispatch({
type: 'user/showPopLogin',
payload: {
showPopLogin: false
}
});
_context.next = 37;
break;
case 35:
window.location.reload();
return _context.abrupt("return");
case 37:
form.resetFields();
case 38:
case "end":
return _context.stop();
}
}, _callee);
}));
return function onFinish() {
return _ref2.apply(this, arguments);
};
}();
var handleClick = function handleClick() {
dispatch({
type: 'user/showPopLogin',
payload: {
showPopLogin: false
}
});
};
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z, {
title: "\u767B\u5F55\u63D0\u793A",
width: 600,
onOk: onFinish,
onCancel: function onCancel() {
return setOpenModal(false);
},
centered: true,
keyboard: false,
closable: false,
maskClosable: false,
open: openModal,
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("p", {
className: "tc",
children: "\u8BE5\u8D26\u53F7\u5DF2\u7ECF\u5B58\u5728\u5F02\u5E38\u60C5\u51B5\uFF0C\u82E5\u975E\u672C\u4EBA\u64CD\u4F5C\uFF0C\u8BF7\u8054\u7CFB\u76D1\u8003\u8001\u5E08\u8BF4\u660E\u60C5\u51B5\u3002"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div", {
className: "mt20",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z, {
pagination: {
hideOnSinglePage: true
},
dataSource: data || [],
columns: columns
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div", {
className: "mt20 mb20",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, {
message: "\u8BF7\u76D1\u8003\u8001\u5E08\u8F93\u5165\u7684\u8003\u8BD5\u89E3\u9501\u7801\uFF0C\u6388\u6743\u5F53\u524D\u5B66\u751F\u767B\u5F55\u5E73\u53F0\u3002",
type: "warning"
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, {
name: "global_state",
autoComplete: "off",
form: form,
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.Item, {
name: "unlock_key",
label: "\u8003\u8BD5\u89E3\u9501\u7801",
rules: [{
required: true,
message: '请输入解锁码'
}],
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.Password, {
autoComplete: "off"
})
})
})]
});
};
/* harmony default export */ __webpack_exports__.Z = ((0,umi__WEBPACK_IMPORTED_MODULE_6__.connect)(function (_ref3) {
var user = _ref3.user,
loading = _ref3.loading,
globalSetting = _ref3.globalSetting;
return {
user: user,
globalSetting: globalSetting,
loading: loading.models.index
};
})(LoginPopComponents));
/***/ }),
/***/ 46400:
/*!*********************************************************************!*\
!*** ./node_modules/_antd@5.9.0@antd/es/alert/index.js + 3 modules ***!
\*********************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ es_alert; }
});
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/CheckCircleFilled.js + 1 modules
var CheckCircleFilled = __webpack_require__(95934);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/CloseCircleFilled.js + 1 modules
var CloseCircleFilled = __webpack_require__(48796);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/CloseOutlined.js + 1 modules
var CloseOutlined = __webpack_require__(99174);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/ExclamationCircleFilled.js + 1 modules
var ExclamationCircleFilled = __webpack_require__(86850);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/InfoCircleFilled.js + 1 modules
var InfoCircleFilled = __webpack_require__(37748);
// 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-motion@2.9.0@rc-motion/es/index.js + 12 modules
var es = __webpack_require__(44516);
// EXTERNAL MODULE: ./node_modules/_rc-util@5.38.1@rc-util/es/pickAttrs.js
var pickAttrs = __webpack_require__(3286);
// 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/_util/reactNode.js
var reactNode = __webpack_require__(92343);
// 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/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);
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/alert/style/index.js
const genAlertTypeStyle = (bgColor, borderColor, iconColor, token, alertCls) => ({
backgroundColor: bgColor,
border: `${token.lineWidth}px ${token.lineType} ${borderColor}`,
[`${alertCls}-icon`]: {
color: iconColor
}
});
const genBaseStyle = token => {
const {
componentCls,
motionDurationSlow: duration,
marginXS,
marginSM,
fontSize,
fontSizeLG,
lineHeight,
borderRadiusLG: borderRadius,
motionEaseInOutCirc,
withDescriptionIconSize,
colorText,
colorTextHeading,
withDescriptionPadding,
defaultPadding
} = token;
return {
[componentCls]: Object.assign(Object.assign({}, (0,style/* resetComponent */.Wf)(token)), {
position: 'relative',
display: 'flex',
alignItems: 'center',
padding: defaultPadding,
wordWrap: 'break-word',
borderRadius,
[`&${componentCls}-rtl`]: {
direction: 'rtl'
},
[`${componentCls}-content`]: {
flex: 1,
minWidth: 0
},
[`${componentCls}-icon`]: {
marginInlineEnd: marginXS,
lineHeight: 0
},
[`&-description`]: {
display: 'none',
fontSize,
lineHeight
},
'&-message': {
color: colorTextHeading
},
[`&${componentCls}-motion-leave`]: {
overflow: 'hidden',
opacity: 1,
transition: `max-height ${duration} ${motionEaseInOutCirc}, opacity ${duration} ${motionEaseInOutCirc},
padding-top ${duration} ${motionEaseInOutCirc}, padding-bottom ${duration} ${motionEaseInOutCirc},
margin-bottom ${duration} ${motionEaseInOutCirc}`
},
[`&${componentCls}-motion-leave-active`]: {
maxHeight: 0,
marginBottom: '0 !important',
paddingTop: 0,
paddingBottom: 0,
opacity: 0
}
}),
[`${componentCls}-with-description`]: {
alignItems: 'flex-start',
padding: withDescriptionPadding,
[`${componentCls}-icon`]: {
marginInlineEnd: marginSM,
fontSize: withDescriptionIconSize,
lineHeight: 0
},
[`${componentCls}-message`]: {
display: 'block',
marginBottom: marginXS,
color: colorTextHeading,
fontSize: fontSizeLG
},
[`${componentCls}-description`]: {
display: 'block',
color: colorText
}
},
[`${componentCls}-banner`]: {
marginBottom: 0,
border: '0 !important',
borderRadius: 0
}
};
};
const genTypeStyle = token => {
const {
componentCls,
colorSuccess,
colorSuccessBorder,
colorSuccessBg,
colorWarning,
colorWarningBorder,
colorWarningBg,
colorError,
colorErrorBorder,
colorErrorBg,
colorInfo,
colorInfoBorder,
colorInfoBg
} = token;
return {
[componentCls]: {
'&-success': genAlertTypeStyle(colorSuccessBg, colorSuccessBorder, colorSuccess, token, componentCls),
'&-info': genAlertTypeStyle(colorInfoBg, colorInfoBorder, colorInfo, token, componentCls),
'&-warning': genAlertTypeStyle(colorWarningBg, colorWarningBorder, colorWarning, token, componentCls),
'&-error': Object.assign(Object.assign({}, genAlertTypeStyle(colorErrorBg, colorErrorBorder, colorError, token, componentCls)), {
[`${componentCls}-description > pre`]: {
margin: 0,
padding: 0
}
})
}
};
};
const genActionStyle = token => {
const {
componentCls,
iconCls,
motionDurationMid,
marginXS,
fontSizeIcon,
colorIcon,
colorIconHover
} = token;
return {
[componentCls]: {
[`&-action`]: {
marginInlineStart: marginXS
},
[`${componentCls}-close-icon`]: {
marginInlineStart: marginXS,
padding: 0,
overflow: 'hidden',
fontSize: fontSizeIcon,
lineHeight: `${fontSizeIcon}px`,
backgroundColor: 'transparent',
border: 'none',
outline: 'none',
cursor: 'pointer',
[`${iconCls}-close`]: {
color: colorIcon,
transition: `color ${motionDurationMid}`,
'&:hover': {
color: colorIconHover
}
}
},
'&-close-text': {
color: colorIcon,
transition: `color ${motionDurationMid}`,
'&:hover': {
color: colorIconHover
}
}
}
};
};
const genAlertStyle = token => [genBaseStyle(token), genTypeStyle(token), genActionStyle(token)];
/* harmony default export */ var alert_style = ((0,genComponentStyleHook/* default */.Z)('Alert', token => [genAlertStyle(token)], token => {
const paddingHorizontal = 12; // Fixed value here.
return {
withDescriptionIconSize: token.fontSizeHeading3,
defaultPadding: `${token.paddingContentVerticalSM}px ${paddingHorizontal}px`,
withDescriptionPadding: `${token.paddingMD}px ${token.paddingContentHorizontalLG}px`
};
}));
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/alert/Alert.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;
};
// CSSINJS
const iconMapFilled = {
success: CheckCircleFilled/* default */.Z,
info: InfoCircleFilled/* default */.Z,
error: CloseCircleFilled/* default */.Z,
warning: ExclamationCircleFilled/* default */.Z
};
const IconNode = props => {
const {
icon,
prefixCls,
type
} = props;
const iconType = iconMapFilled[type] || null;
if (icon) {
return (0,reactNode/* replaceElement */.wm)(icon, /*#__PURE__*/_react_17_0_2_react.createElement("span", {
className: `${prefixCls}-icon`
}, icon), () => ({
className: _classnames_2_3_2_classnames_default()(`${prefixCls}-icon`, {
[icon.props.className]: icon.props.className
})
}));
}
return /*#__PURE__*/_react_17_0_2_react.createElement(iconType, {
className: `${prefixCls}-icon`
});
};
const CloseIcon = props => {
const {
isClosable,
prefixCls,
closeIcon,
handleClose
} = props;
const mergedCloseIcon = closeIcon === true || closeIcon === undefined ? /*#__PURE__*/_react_17_0_2_react.createElement(CloseOutlined/* default */.Z, null) : closeIcon;
return isClosable ? /*#__PURE__*/_react_17_0_2_react.createElement("button", {
type: "button",
onClick: handleClose,
className: `${prefixCls}-close-icon`,
tabIndex: 0
}, mergedCloseIcon) : null;
};
const Alert = props => {
const {
description,
prefixCls: customizePrefixCls,
message,
banner,
className,
rootClassName,
style,
onMouseEnter,
onMouseLeave,
onClick,
afterClose,
showIcon,
closable,
closeText,
closeIcon,
action
} = props,
otherProps = __rest(props, ["description", "prefixCls", "message", "banner", "className", "rootClassName", "style", "onMouseEnter", "onMouseLeave", "onClick", "afterClose", "showIcon", "closable", "closeText", "closeIcon", "action"]);
const [closed, setClosed] = _react_17_0_2_react.useState(false);
if (false) {}
const ref = _react_17_0_2_react.useRef(null);
const {
getPrefixCls,
direction,
alert
} = _react_17_0_2_react.useContext(context/* ConfigContext */.E_);
const prefixCls = getPrefixCls('alert', customizePrefixCls);
const [wrapSSR, hashId] = alert_style(prefixCls);
const handleClose = e => {
var _a;
setClosed(true);
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props, e);
};
const type = _react_17_0_2_react.useMemo(() => {
if (props.type !== undefined) {
return props.type;
}
// banner mode defaults to 'warning'
return banner ? 'warning' : 'info';
}, [props.type, banner]);
// closeable when closeText or closeIcon is assigned
const isClosable = _react_17_0_2_react.useMemo(() => {
if (closeText) {
return true;
}
if (typeof closable === 'boolean') {
return closable;
}
// should be true when closeIcon is 0 or ''
return closeIcon !== false && closeIcon !== null && closeIcon !== undefined;
}, [closeText, closeIcon, closable]);
// banner mode defaults to Icon
const isShowIcon = banner && showIcon === undefined ? true : showIcon;
const alertCls = _classnames_2_3_2_classnames_default()(prefixCls, `${prefixCls}-${type}`, {
[`${prefixCls}-with-description`]: !!description,
[`${prefixCls}-no-icon`]: !isShowIcon,
[`${prefixCls}-banner`]: !!banner,
[`${prefixCls}-rtl`]: direction === 'rtl'
}, alert === null || alert === void 0 ? void 0 : alert.className, className, rootClassName, hashId);
const restProps = (0,pickAttrs/* default */.Z)(otherProps, {
aria: true,
data: true
});
return wrapSSR( /*#__PURE__*/_react_17_0_2_react.createElement(es["default"], {
visible: !closed,
motionName: `${prefixCls}-motion`,
motionAppear: false,
motionEnter: false,
onLeaveStart: node => ({
maxHeight: node.offsetHeight
}),
onLeaveEnd: afterClose
}, _ref => {
let {
className: motionClassName,
style: motionStyle
} = _ref;
return /*#__PURE__*/_react_17_0_2_react.createElement("div", Object.assign({
ref: ref,
"data-show": !closed,
className: _classnames_2_3_2_classnames_default()(alertCls, motionClassName),
style: Object.assign(Object.assign(Object.assign({}, alert === null || alert === void 0 ? void 0 : alert.style), style), motionStyle),
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave,
onClick: onClick,
role: "alert"
}, restProps), isShowIcon ? /*#__PURE__*/_react_17_0_2_react.createElement(IconNode, {
description: description,
icon: props.icon,
prefixCls: prefixCls,
type: type
}) : null, /*#__PURE__*/_react_17_0_2_react.createElement("div", {
className: `${prefixCls}-content`
}, message ? /*#__PURE__*/_react_17_0_2_react.createElement("div", {
className: `${prefixCls}-message`
}, message) : null, description ? /*#__PURE__*/_react_17_0_2_react.createElement("div", {
className: `${prefixCls}-description`
}, description) : null), action ? /*#__PURE__*/_react_17_0_2_react.createElement("div", {
className: `${prefixCls}-action`
}, action) : null, /*#__PURE__*/_react_17_0_2_react.createElement(CloseIcon, {
isClosable: isClosable,
prefixCls: prefixCls,
closeIcon: closeText || closeIcon,
handleClose: handleClose
}));
}));
};
if (false) {}
/* harmony default export */ var alert_Alert = (Alert);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/esm/classCallCheck.js
var classCallCheck = __webpack_require__(74809);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/esm/createClass.js
var createClass = __webpack_require__(57338);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/esm/inherits.js
var inherits = __webpack_require__(29161);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/esm/createSuper.js + 1 modules
var createSuper = __webpack_require__(24154);
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/alert/ErrorBoundary.js
"use client";
let ErrorBoundary = /*#__PURE__*/function (_React$Component) {
(0,inherits/* default */.Z)(ErrorBoundary, _React$Component);
var _super = (0,createSuper/* default */.Z)(ErrorBoundary);
function ErrorBoundary() {
var _this;
(0,classCallCheck/* default */.Z)(this, ErrorBoundary);
_this = _super.apply(this, arguments);
_this.state = {
error: undefined,
info: {
componentStack: ''
}
};
return _this;
}
(0,createClass/* default */.Z)(ErrorBoundary, [{
key: "componentDidCatch",
value: function componentDidCatch(error, info) {
this.setState({
error,
info
});
}
}, {
key: "render",
value: function render() {
const {
message,
description,
children
} = this.props;
const {
error,
info
} = this.state;
const componentStack = info && info.componentStack ? info.componentStack : null;
const errorMessage = typeof message === 'undefined' ? (error || '').toString() : message;
const errorDescription = typeof description === 'undefined' ? componentStack : description;
if (error) {
return /*#__PURE__*/_react_17_0_2_react.createElement(alert_Alert, {
type: "error",
message: errorMessage,
description: /*#__PURE__*/_react_17_0_2_react.createElement("pre", {
style: {
fontSize: '0.9em',
overflowX: 'auto'
}
}, errorDescription)
});
}
return children;
}
}]);
return ErrorBoundary;
}(_react_17_0_2_react.Component);
/* harmony default export */ var alert_ErrorBoundary = (ErrorBoundary);
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/alert/index.js
"use client";
const es_alert_Alert = alert_Alert;
es_alert_Alert.ErrorBoundary = alert_ErrorBoundary;
/* harmony default export */ var es_alert = (es_alert_Alert);
/***/ })
}]);