PromoCursed/node_modules/.cache/babel-loader/bd7ca7ce81d4a1e12914bc8801612637c9b667b260cb7a1dd0b1bd7d761b4320.json

1 line
21 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"\"use client\";\n\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 CloseOutlined from \"@ant-design/icons/es/icons/CloseOutlined\";\nimport classNames from 'classnames';\nimport Dialog from 'rc-dialog';\nimport ContextIsolator from '../_util/ContextIsolator';\nimport useClosable, { pickClosable } from '../_util/hooks/useClosable';\nimport { useZIndex } from '../_util/hooks/useZIndex';\nimport { getTransitionName } from '../_util/motion';\nimport { canUseDocElement } from '../_util/styleChecker';\nimport { devUseWarning } from '../_util/warning';\nimport zIndexContext from '../_util/zindexContext';\nimport { ConfigContext } from '../config-provider';\nimport useCSSVarCls from '../config-provider/hooks/useCSSVarCls';\nimport Skeleton from '../skeleton';\nimport { usePanelRef } from '../watermark/context';\nimport { Footer, renderCloseIcon } from './shared';\nimport useStyle from './style';\nlet mousePosition;\n// ref: https://github.com/ant-design/ant-design/issues/15795\nconst getClickPosition = e => {\n mousePosition = {\n x: e.pageX,\n y: e.pageY\n };\n // 100ms 内发生过点击事件,则从点击位置动画展示\n // 否则直接 zoom 展示\n // 这样可以兼容非点击方式展开\n setTimeout(() => {\n mousePosition = null;\n }, 100);\n};\n// 只有点击事件支持从鼠标位置动画展开\nif (canUseDocElement()) {\n document.documentElement.addEventListener('click', getClickPosition, true);\n}\nconst Modal = props => {\n var _a;\n const {\n getPopupContainer: getContextPopupContainer,\n getPrefixCls,\n direction,\n modal: modalContext\n } = React.useContext(ConfigContext);\n const handleCancel = e => {\n const {\n onCancel\n } = props;\n onCancel === null || onCancel === void 0 ? void 0 : onCancel(e);\n };\n const handleOk = e => {\n const {\n onOk\n } = props;\n onOk === null || onOk === void 0 ? void 0 : onOk(e);\n };\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning('Modal');\n [['visible', 'open'], ['bodyStyle', 'styles.body'], ['maskStyle', 'styles.mask']].forEach(_ref => {\n let [deprecatedName, newName] = _ref;\n warning.deprecated(!(deprecatedName in props), deprecatedName, newName);\n });\n }\n const {\n prefixCls: customizePrefixCls,\n className,\n rootClassName,\n open,\n wrapClassName,\n centered,\n getContainer,\n focusTriggerAfterClose = true,\n style,\n // Deprecated\n visible,\n width = 520,\n footer,\n classNames: modalClassNames,\n styles: modalStyles,\n children,\n loading\n } = props,\n restProps = __rest(props, [\"prefixCls\", \"className\", \"rootClassName\", \"open\", \"wrapClassName\", \"centered\", \"getContainer\", \"focusTriggerAfterClose\", \"style\", \"visible\", \"width\", \"footer\", \"classNames\", \"styles\", \"children\", \"loading\"]);\n const prefixCls = getPrefixCls('modal', customizePrefixCls);\n const rootPrefixCls = getPrefixCls();\n // Style\n const rootCls = useCSSVarCls(prefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, rootCls);\n const wrapClassNameExtended = classNames(wrapClassName, {\n [`${prefixCls}-centered`]: !!centered,\n [`${prefixCls}-wrap-rtl`]: direction === 'rtl'\n });\n const dialogFooter = footer !== null && !loading ? ( /*#__PURE__*/React.createElement(Footer, Object.assign({}, props, {\n onOk: handleOk,\n onCancel: handleCancel\n }))) : null;\n const [mergedClosable, mergedCloseIcon] = useClosable(pickClosable(props), pickClosable(modalContext),