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

1 line
24 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"\"use client\";\n\nimport * as React from 'react';\nimport DeleteOutlined from \"@ant-design/icons/es/icons/DeleteOutlined\";\nimport DownloadOutlined from \"@ant-design/icons/es/icons/DownloadOutlined\";\nimport EyeOutlined from \"@ant-design/icons/es/icons/EyeOutlined\";\nimport classNames from 'classnames';\nimport CSSMotion from 'rc-motion';\nimport { ConfigContext } from '../../config-provider';\nimport Progress from '../../progress';\nimport Tooltip from '../../tooltip';\nconst ListItem = /*#__PURE__*/React.forwardRef((_ref, ref) => {\n let {\n prefixCls,\n className,\n style,\n locale,\n listType,\n file,\n items,\n progress: progressProps,\n iconRender,\n actionIconRender,\n itemRender,\n isImgUrl,\n showPreviewIcon,\n showRemoveIcon,\n showDownloadIcon,\n previewIcon: customPreviewIcon,\n removeIcon: customRemoveIcon,\n downloadIcon: customDownloadIcon,\n extra: customExtra,\n onPreview,\n onDownload,\n onClose\n } = _ref;\n var _a, _b;\n // Status: which will ignore `removed` status\n const {\n status\n } = file;\n const [mergedStatus, setMergedStatus] = React.useState(status);\n React.useEffect(() => {\n if (status !== 'removed') {\n setMergedStatus(status);\n }\n }, [status]);\n // Delay to show the progress bar\n const [showProgress, setShowProgress] = React.useState(false);\n React.useEffect(() => {\n const timer = setTimeout(() => {\n setShowProgress(true);\n }, 300);\n return () => {\n clearTimeout(timer);\n };\n }, []);\n const iconNode = iconRender(file);\n let icon = /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-icon`\n }, iconNode);\n if (listType === 'picture' || listType === 'picture-card' || listType === 'picture-circle') {\n if (mergedStatus === 'uploading' || !file.thumbUrl && !file.url) {\n const uploadingClassName = classNames(`${prefixCls}-list-item-thumbnail`, {\n [`${prefixCls}-list-item-file`]: mergedStatus !== 'uploading'\n });\n icon = /*#__PURE__*/React.createElement(\"div\", {\n className: uploadingClassName\n }, iconNode);\n } else {\n const thumbnail = (isImgUrl === null || isImgUrl === void 0 ? void 0 : isImgUrl(file)) ? ( /*#__PURE__*/React.createElement(\"img\", {\n src: file.thumbUrl || file.url,\n alt: file.name,\n className: `${prefixCls}-list-item-image`,\n crossOrigin: file.crossOrigin\n })) : iconNode;\n const aClassName = classNames(`${prefixCls}-list-item-thumbnail`, {\n [`${prefixCls}-list-item-file`]: isImgUrl && !isImgUrl(file)\n });\n icon = /*#__PURE__*/React.createElement(\"a\", {\n className: aClassName,\n onClick: e => onPreview(file, e),\n href: file.url || file.thumbUrl,\n target: \"_blank\",\n rel: \"noopener noreferrer\"\n }, thumbnail);\n }\n }\n const listItemClassName = classNames(`${prefixCls}-list-item`, `${prefixCls}-list-item-${mergedStatus}`);\n const linkProps = typeof file.linkProps === 'string' ? JSON.parse(file.linkProps) : file.linkProps;\n const removeIcon = showRemoveIcon ? actionIconRender((typeof customRemoveIcon === 'function' ? customRemoveIcon(file) : customRemoveIcon) || ( /*#__PURE__*/React.createElement(DeleteOutlined, null)), () => onClose(file), prefixCls, locale.removeFile,\n // acceptUploadDisabled is true, only remove icon will follow Upload disabled prop\n // https://github.com/ant-design/ant-design/issues/46171\n true) : null;\n const downloadIcon = showDownloadIcon && mergedStatus === 'done' ? actionIconRender((typeof customDownloadIcon === 'function' ? customDownloadIcon(file) : customDownloadIcon) || /*#__PURE__*/React.createElement(DownloadOutlined, null), () => onDownload(file), prefixCls, locale.downloadFile) : null;\n const downloadOrDelete = listType !== 'picture-card' && listType !== 'picture-circle' && ( /*#__PURE__*/React.createElement(\"span\", {\n key: \"download-delete\",\n className: classNames(`${