1 line
26 KiB
JSON
1 line
26 KiB
JSON
|
{"ast":null,"code":"\"use client\";\n\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport CheckCircleFilled from \"@ant-design/icons/es/icons/CheckCircleFilled\";\nimport CloseCircleFilled from \"@ant-design/icons/es/icons/CloseCircleFilled\";\nimport ExclamationCircleFilled from \"@ant-design/icons/es/icons/ExclamationCircleFilled\";\nimport InfoCircleFilled from \"@ant-design/icons/es/icons/InfoCircleFilled\";\nimport classNames from 'classnames';\nimport { CONTAINER_MAX_OFFSET } from '../_util/hooks/useZIndex';\nimport { getTransitionName } from '../_util/motion';\nimport { devUseWarning } from '../_util/warning';\nimport ConfigProvider from '../config-provider';\nimport { useLocale } from '../locale';\nimport useToken from '../theme/useToken';\nimport CancelBtn from './components/ConfirmCancelBtn';\nimport OkBtn from './components/ConfirmOkBtn';\nimport { ModalContextProvider } from './context';\nimport Modal from './Modal';\nimport Confirm from './style/confirm';\nexport function ConfirmContent(props) {\n const {\n prefixCls,\n icon,\n okText,\n cancelText,\n confirmPrefixCls,\n type,\n okCancel,\n footer,\n // Legacy for static function usage\n locale: staticLocale\n } = props,\n resetProps = __rest(props, [\"prefixCls\", \"icon\", \"okText\", \"cancelText\", \"confirmPrefixCls\", \"type\", \"okCancel\", \"footer\", \"locale\"]);\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning('Modal');\n process.env.NODE_ENV !== \"production\" ? warning(!(typeof icon === 'string' && icon.length > 2), 'breaking', `\\`icon\\` is using ReactNode instead of string naming in v4. Please check \\`${icon}\\` at https://ant.design/components/icon`) : void 0;\n }\n // Icon\n let mergedIcon = icon;\n // 支持传入{ icon: null }来隐藏`Modal.confirm`默认的Icon\n if (!icon && icon !== null) {\n switch (type) {\n case 'info':\n mergedIcon = /*#__PURE__*/React.createElement(InfoCircleFilled, null);\n break;\n case 'success':\n mergedIcon = /*#__PURE__*/React.createElement(CheckCircleFilled, null);\n break;\n case 'error':\n mergedIcon = /*#__PURE__*/React.createElement(CloseCircleFilled, null);\n break;\n default:\n mergedIcon = /*#__PURE__*/React.createElement(ExclamationCircleFilled, null);\n }\n }\n // 默认为 true,保持向下兼容\n const mergedOkCancel = okCancel !== null && okCancel !== void 0 ? okCancel : type === 'confirm';\n const autoFocusButton = props.autoFocusButton === null ? false : props.autoFocusButton || 'ok';\n const [locale] = useLocale('Modal');\n const mergedLocale = staticLocale || locale;\n // ================== Locale Text ==================\n const okTextLocale = okText || (mergedOkCancel ? mergedLocale === null || mergedLocale === void 0 ? void 0 : mergedLocale.okText : mergedLocale === null || mergedLocale === void 0 ? void 0 : mergedLocale.justOkText);\n const cancelTextLocale = cancelText || (mergedLocale === null || mergedLocale === void 0 ? void 0 : mergedLocale.cancelText);\n // ================= Context Value =================\n const btnCtxValue = Object.assign({\n autoFocusButton,\n cancelTextLocale,\n okTextLocale,\n mergedOkCancel\n }, resetProps);\n const btnCtxValueMemo = React.useMemo(() => btnCtxValue, _toConsumableArray(Object.values(btnCtxValue)));\n // ====================== Footer Origin Node ======================\n const footerOriginNode = /*#__PURE__*/React.createElement(React.Fr
|