342fb23d79a51f49e056a0f55bada0e5.json
26.5 KB
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport * as React from 'react';\nimport CSSMotion from 'rc-motion';\nimport classNames from 'classnames';\nimport EyeOutlined from '@ant-design/icons/EyeOutlined';\nimport DeleteOutlined from '@ant-design/icons/DeleteOutlined';\nimport DownloadOutlined from '@ant-design/icons/DownloadOutlined';\nimport Tooltip from '../../tooltip';\nimport Progress from '../../progress';\nvar ListItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {\n var _classNames3;\n\n var prefixCls = _ref.prefixCls,\n className = _ref.className,\n style = _ref.style,\n locale = _ref.locale,\n listType = _ref.listType,\n file = _ref.file,\n items = _ref.items,\n progressProps = _ref.progress,\n iconRender = _ref.iconRender,\n actionIconRender = _ref.actionIconRender,\n itemRender = _ref.itemRender,\n isImgUrl = _ref.isImgUrl,\n showPreviewIcon = _ref.showPreviewIcon,\n showRemoveIcon = _ref.showRemoveIcon,\n showDownloadIcon = _ref.showDownloadIcon,\n customRemoveIcon = _ref.removeIcon,\n customDownloadIcon = _ref.downloadIcon,\n onPreview = _ref.onPreview,\n onDownload = _ref.onDownload,\n onClose = _ref.onClose; // Delay to show the progress bar\n\n var _React$useState = React.useState(false),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n showProgress = _React$useState2[0],\n setShowProgress = _React$useState2[1];\n\n var progressRafRef = React.useRef();\n React.useEffect(function () {\n progressRafRef.current = setTimeout(function () {\n setShowProgress(true);\n }, 300);\n return function () {\n window.clearTimeout(progressRafRef.current);\n };\n }, []); // This is used for legacy span make scrollHeight the wrong value.\n // We will force these to be `display: block` with non `picture-card`\n\n var spanClassName = \"\".concat(prefixCls, \"-span\");\n var iconNode = iconRender(file);\n var icon = /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-text-icon\")\n }, iconNode);\n\n if (listType === 'picture' || listType === 'picture-card') {\n if (file.status === 'uploading' || !file.thumbUrl && !file.url) {\n var _classNames;\n\n var uploadingClassName = classNames((_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-list-item-thumbnail\"), true), _defineProperty(_classNames, \"\".concat(prefixCls, \"-list-item-file\"), file.status !== 'uploading'), _classNames));\n icon = /*#__PURE__*/React.createElement(\"div\", {\n className: uploadingClassName\n }, iconNode);\n } else {\n var _classNames2;\n\n var 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: \"\".concat(prefixCls, \"-list-item-image\")\n }) : iconNode;\n var aClassName = classNames((_classNames2 = {}, _defineProperty(_classNames2, \"\".concat(prefixCls, \"-list-item-thumbnail\"), true), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-list-item-file\"), isImgUrl && !isImgUrl(file)), _classNames2));\n icon = /*#__PURE__*/React.createElement(\"a\", {\n className: aClassName,\n onClick: function onClick(e) {\n return onPreview(file, e);\n },\n href: file.url || file.thumbUrl,\n target: \"_blank\",\n rel: \"noopener noreferrer\"\n }, thumbnail);\n }\n }\n\n var infoUploadingClass = classNames((_classNames3 = {}, _defineProperty(_classNames3, \"\".concat(prefixCls, \"-list-item\"), true), _defineProperty(_classNames3, \"\".concat(prefixCls, \"-list-item-\").concat(file.status), true), _defineProperty(_classNames3, \"\".concat(prefixCls, \"-list-item-list-type-\").concat(listType), true), _classNames3));\n var linkProps = typeof file.linkProps === 'string' ? JSON.parse(file.linkProps) : file.linkProps;\n var removeIcon = showRemoveIcon ? actionIconRender((typeof customRemoveIcon === 'function' ? customRemoveIcon(file) : customRemoveIcon) || /*#__PURE__*/React.createElement(DeleteOutlined, null), function () {\n return onClose(file);\n }, prefixCls, locale.removeFile) : null;\n var downloadIcon = showDownloadIcon && file.status === 'done' ? actionIconRender((typeof customDownloadIcon === 'function' ? customDownloadIcon(file) : customDownloadIcon) || /*#__PURE__*/React.createElement(DownloadOutlined, null), function () {\n return onDownload(file);\n }, prefixCls, locale.downloadFile) : null;\n var downloadOrDelete = listType !== 'picture-card' && /*#__PURE__*/React.createElement(\"span\", {\n key: \"download-delete\",\n className: classNames(\"\".concat(prefixCls, \"-list-item-card-actions\"), {\n picture: listType === 'picture'\n })\n }, downloadIcon, removeIcon);\n var listItemNameClass = classNames(\"\".concat(prefixCls, \"-list-item-name\"));\n var preview = file.url ? [/*#__PURE__*/React.createElement(\"a\", _extends({\n key: \"view\",\n target: \"_blank\",\n rel: \"noopener noreferrer\",\n className: listItemNameClass,\n title: file.name\n }, linkProps, {\n href: file.url,\n onClick: function onClick(e) {\n return onPreview(file, e);\n }\n }), file.name), downloadOrDelete] : [/*#__PURE__*/React.createElement(\"span\", {\n key: \"view\",\n className: listItemNameClass,\n onClick: function onClick(e) {\n return onPreview(file, e);\n },\n title: file.name\n }, file.name), downloadOrDelete];\n var previewStyle = {\n pointerEvents: 'none',\n opacity: 0.5\n };\n var previewIcon = showPreviewIcon ? /*#__PURE__*/React.createElement(\"a\", {\n href: file.url || file.thumbUrl,\n target: \"_blank\",\n rel: \"noopener noreferrer\",\n style: file.url || file.thumbUrl ? undefined : previewStyle,\n onClick: function onClick(e) {\n return onPreview(file, e);\n },\n title: locale.previewFile\n }, /*#__PURE__*/React.createElement(EyeOutlined, null)) : null;\n var actions = listType === 'picture-card' && file.status !== 'uploading' && /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-list-item-actions\")\n }, previewIcon, file.status === 'done' && downloadIcon, removeIcon);\n var message;\n\n if (file.response && typeof file.response === 'string') {\n message = file.response;\n } else {\n message = file.error && file.error.statusText || locale.uploadError;\n }\n\n var iconAndPreview = /*#__PURE__*/React.createElement(\"span\", {\n className: spanClassName\n }, icon, preview);\n var dom = /*#__PURE__*/React.createElement(\"div\", {\n className: infoUploadingClass\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-list-item-info\")\n }, iconAndPreview), actions, showProgress && /*#__PURE__*/React.createElement(CSSMotion, {\n motionName: \"fade\",\n visible: file.status === 'uploading'\n }, function (_ref2) {\n var motionClassName = _ref2.className; // show loading icon if upload progress listener is disabled\n\n var loadingProgress = 'percent' in file ? /*#__PURE__*/React.createElement(Progress, _extends({}, progressProps, {\n type: \"line\",\n percent: file.percent\n })) : null;\n return /*#__PURE__*/React.createElement(\"div\", {\n className: classNames(\"\".concat(prefixCls, \"-list-item-progress\"), motionClassName)\n }, loadingProgress);\n }));\n var listContainerNameClass = classNames(\"\".concat(prefixCls, \"-list-\").concat(listType, \"-container\"), className);\n var item = file.status === 'error' ? /*#__PURE__*/React.createElement(Tooltip, {\n title: message,\n getPopupContainer: function getPopupContainer(node) {\n return node.parentNode;\n }\n }, dom) : dom;\n return /*#__PURE__*/React.createElement(\"div\", {\n className: listContainerNameClass,\n style: style,\n ref: ref\n }, itemRender ? itemRender(item, file, items) : item);\n});\nexport default ListItem;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/upload/UploadList/ListItem.js"],"names":["_extends","_defineProperty","_slicedToArray","React","CSSMotion","classNames","EyeOutlined","DeleteOutlined","DownloadOutlined","Tooltip","Progress","ListItem","forwardRef","_ref","ref","_classNames3","prefixCls","className","style","locale","listType","file","items","progressProps","progress","iconRender","actionIconRender","itemRender","isImgUrl","showPreviewIcon","showRemoveIcon","showDownloadIcon","customRemoveIcon","removeIcon","customDownloadIcon","downloadIcon","onPreview","onDownload","onClose","_React$useState","useState","_React$useState2","showProgress","setShowProgress","progressRafRef","useRef","useEffect","current","setTimeout","window","clearTimeout","spanClassName","concat","iconNode","icon","createElement","status","thumbUrl","url","_classNames","uploadingClassName","_classNames2","thumbnail","src","alt","name","aClassName","onClick","e","href","target","rel","infoUploadingClass","linkProps","JSON","parse","removeFile","downloadFile","downloadOrDelete","key","picture","listItemNameClass","preview","title","previewStyle","pointerEvents","opacity","previewIcon","undefined","previewFile","actions","message","response","error","statusText","uploadError","iconAndPreview","dom","motionName","visible","_ref2","motionClassName","loadingProgress","type","percent","listContainerNameClass","item","getPopupContainer","node","parentNode"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,gCAArB;AACA,OAAOC,eAAP,MAA4B,uCAA5B;AACA,OAAOC,cAAP,MAA2B,sCAA3B;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,SAAP,MAAsB,WAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,WAAP,MAAwB,+BAAxB;AACA,OAAOC,cAAP,MAA2B,kCAA3B;AACA,OAAOC,gBAAP,MAA6B,oCAA7B;AACA,OAAOC,OAAP,MAAoB,eAApB;AACA,OAAOC,QAAP,MAAqB,gBAArB;AACA,IAAIC,QAAQ,GAAG,aAAaR,KAAK,CAACS,UAAN,CAAiB,UAAUC,IAAV,EAAgBC,GAAhB,EAAqB;AAChE,MAAIC,YAAJ;;AAEA,MAAIC,SAAS,GAAGH,IAAI,CAACG,SAArB;AAAA,MACIC,SAAS,GAAGJ,IAAI,CAACI,SADrB;AAAA,MAEIC,KAAK,GAAGL,IAAI,CAACK,KAFjB;AAAA,MAGIC,MAAM,GAAGN,IAAI,CAACM,MAHlB;AAAA,MAIIC,QAAQ,GAAGP,IAAI,CAACO,QAJpB;AAAA,MAKIC,IAAI,GAAGR,IAAI,CAACQ,IALhB;AAAA,MAMIC,KAAK,GAAGT,IAAI,CAACS,KANjB;AAAA,MAOIC,aAAa,GAAGV,IAAI,CAACW,QAPzB;AAAA,MAQIC,UAAU,GAAGZ,IAAI,CAACY,UARtB;AAAA,MASIC,gBAAgB,GAAGb,IAAI,CAACa,gBAT5B;AAAA,MAUIC,UAAU,GAAGd,IAAI,CAACc,UAVtB;AAAA,MAWIC,QAAQ,GAAGf,IAAI,CAACe,QAXpB;AAAA,MAYIC,eAAe,GAAGhB,IAAI,CAACgB,eAZ3B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pC,SAAV,EAAqB,QAArB,EAA+BoC,MAA/B,CAAsChC,QAAtC,EAAgD,YAAhD,CAAD,EAAgEH,SAAhE,CAAvC;AACA,MAAIyF,IAAI,GAAGrF,IAAI,CAACmC,MAAL,KAAgB,OAAhB,GAA0B,aAAarD,KAAK,CAACoD,aAAN,CAAoB9C,OAApB,EAA6B;AAC7E0E,IAAAA,KAAK,EAAEQ,OADsE;AAE7EgB,IAAAA,iBAAiB,EAAE,SAASA,iBAAT,CAA2BC,IAA3B,EAAiC;AAClD,aAAOA,IAAI,CAACC,UAAZ;AACD;AAJ4E,GAA7B,EAK/CZ,GAL+C,CAAvC,GAKDA,GALV;AAMA,SAAO,aAAa9F,KAAK,CAACoD,aAAN,CAAoB,KAApB,EAA2B;AAC7CtC,IAAAA,SAAS,EAAEwF,sBADkC;AAE7CvF,IAAAA,KAAK,EAAEA,KAFsC;AAG7CJ,IAAAA,GAAG,EAAEA;AAHwC,GAA3B,EAIjBa,UAAU,GAAGA,UAAU,CAAC+E,IAAD,EAAOrF,IAAP,EAAaC,KAAb,CAAb,GAAmCoF,IAJ5B,CAApB;AAKD,CAxK2B,CAA5B;AAyKA,eAAe/F,QAAf","sourcesContent":["import _extends from \"@babel/runtime/helpers/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport * as React from 'react';\nimport CSSMotion from 'rc-motion';\nimport classNames from 'classnames';\nimport EyeOutlined from '@ant-design/icons/EyeOutlined';\nimport DeleteOutlined from '@ant-design/icons/DeleteOutlined';\nimport DownloadOutlined from '@ant-design/icons/DownloadOutlined';\nimport Tooltip from '../../tooltip';\nimport Progress from '../../progress';\nvar ListItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {\n var _classNames3;\n\n var prefixCls = _ref.prefixCls,\n className = _ref.className,\n style = _ref.style,\n locale = _ref.locale,\n listType = _ref.listType,\n file = _ref.file,\n items = _ref.items,\n progressProps = _ref.progress,\n iconRender = _ref.iconRender,\n actionIconRender = _ref.actionIconRender,\n itemRender = _ref.itemRender,\n isImgUrl = _ref.isImgUrl,\n showPreviewIcon = _ref.showPreviewIcon,\n showRemoveIcon = _ref.showRemoveIcon,\n showDownloadIcon = _ref.showDownloadIcon,\n customRemoveIcon = _ref.removeIcon,\n customDownloadIcon = _ref.downloadIcon,\n onPreview = _ref.onPreview,\n onDownload = _ref.onDownload,\n onClose = _ref.onClose;\n\n // Delay to show the progress bar\n var _React$useState = React.useState(false),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n showProgress = _React$useState2[0],\n setShowProgress = _React$useState2[1];\n\n var progressRafRef = React.useRef();\n React.useEffect(function () {\n progressRafRef.current = setTimeout(function () {\n setShowProgress(true);\n }, 300);\n return function () {\n window.clearTimeout(progressRafRef.current);\n };\n }, []); // This is used for legacy span make scrollHeight the wrong value.\n // We will force these to be `display: block` with non `picture-card`\n\n var spanClassName = \"\".concat(prefixCls, \"-span\");\n var iconNode = iconRender(file);\n var icon = /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-text-icon\")\n }, iconNode);\n\n if (listType === 'picture' || listType === 'picture-card') {\n if (file.status === 'uploading' || !file.thumbUrl && !file.url) {\n var _classNames;\n\n var uploadingClassName = classNames((_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-list-item-thumbnail\"), true), _defineProperty(_classNames, \"\".concat(prefixCls, \"-list-item-file\"), file.status !== 'uploading'), _classNames));\n icon = /*#__PURE__*/React.createElement(\"div\", {\n className: uploadingClassName\n }, iconNode);\n } else {\n var _classNames2;\n\n var 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: \"\".concat(prefixCls, \"-list-item-image\")\n }) : iconNode;\n var aClassName = classNames((_classNames2 = {}, _defineProperty(_classNames2, \"\".concat(prefixCls, \"-list-item-thumbnail\"), true), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-list-item-file\"), isImgUrl && !isImgUrl(file)), _classNames2));\n icon = /*#__PURE__*/React.createElement(\"a\", {\n className: aClassName,\n onClick: function onClick(e) {\n return onPreview(file, e);\n },\n href: file.url || file.thumbUrl,\n target: \"_blank\",\n rel: \"noopener noreferrer\"\n }, thumbnail);\n }\n }\n\n var infoUploadingClass = classNames((_classNames3 = {}, _defineProperty(_classNames3, \"\".concat(prefixCls, \"-list-item\"), true), _defineProperty(_classNames3, \"\".concat(prefixCls, \"-list-item-\").concat(file.status), true), _defineProperty(_classNames3, \"\".concat(prefixCls, \"-list-item-list-type-\").concat(listType), true), _classNames3));\n var linkProps = typeof file.linkProps === 'string' ? JSON.parse(file.linkProps) : file.linkProps;\n var removeIcon = showRemoveIcon ? actionIconRender((typeof customRemoveIcon === 'function' ? customRemoveIcon(file) : customRemoveIcon) || /*#__PURE__*/React.createElement(DeleteOutlined, null), function () {\n return onClose(file);\n }, prefixCls, locale.removeFile) : null;\n var downloadIcon = showDownloadIcon && file.status === 'done' ? actionIconRender((typeof customDownloadIcon === 'function' ? customDownloadIcon(file) : customDownloadIcon) || /*#__PURE__*/React.createElement(DownloadOutlined, null), function () {\n return onDownload(file);\n }, prefixCls, locale.downloadFile) : null;\n var downloadOrDelete = listType !== 'picture-card' && /*#__PURE__*/React.createElement(\"span\", {\n key: \"download-delete\",\n className: classNames(\"\".concat(prefixCls, \"-list-item-card-actions\"), {\n picture: listType === 'picture'\n })\n }, downloadIcon, removeIcon);\n var listItemNameClass = classNames(\"\".concat(prefixCls, \"-list-item-name\"));\n var preview = file.url ? [/*#__PURE__*/React.createElement(\"a\", _extends({\n key: \"view\",\n target: \"_blank\",\n rel: \"noopener noreferrer\",\n className: listItemNameClass,\n title: file.name\n }, linkProps, {\n href: file.url,\n onClick: function onClick(e) {\n return onPreview(file, e);\n }\n }), file.name), downloadOrDelete] : [/*#__PURE__*/React.createElement(\"span\", {\n key: \"view\",\n className: listItemNameClass,\n onClick: function onClick(e) {\n return onPreview(file, e);\n },\n title: file.name\n }, file.name), downloadOrDelete];\n var previewStyle = {\n pointerEvents: 'none',\n opacity: 0.5\n };\n var previewIcon = showPreviewIcon ? /*#__PURE__*/React.createElement(\"a\", {\n href: file.url || file.thumbUrl,\n target: \"_blank\",\n rel: \"noopener noreferrer\",\n style: file.url || file.thumbUrl ? undefined : previewStyle,\n onClick: function onClick(e) {\n return onPreview(file, e);\n },\n title: locale.previewFile\n }, /*#__PURE__*/React.createElement(EyeOutlined, null)) : null;\n var actions = listType === 'picture-card' && file.status !== 'uploading' && /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-list-item-actions\")\n }, previewIcon, file.status === 'done' && downloadIcon, removeIcon);\n var message;\n\n if (file.response && typeof file.response === 'string') {\n message = file.response;\n } else {\n message = file.error && file.error.statusText || locale.uploadError;\n }\n\n var iconAndPreview = /*#__PURE__*/React.createElement(\"span\", {\n className: spanClassName\n }, icon, preview);\n var dom = /*#__PURE__*/React.createElement(\"div\", {\n className: infoUploadingClass\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-list-item-info\")\n }, iconAndPreview), actions, showProgress && /*#__PURE__*/React.createElement(CSSMotion, {\n motionName: \"fade\",\n visible: file.status === 'uploading'\n }, function (_ref2) {\n var motionClassName = _ref2.className;\n // show loading icon if upload progress listener is disabled\n var loadingProgress = 'percent' in file ? /*#__PURE__*/React.createElement(Progress, _extends({}, progressProps, {\n type: \"line\",\n percent: file.percent\n })) : null;\n return /*#__PURE__*/React.createElement(\"div\", {\n className: classNames(\"\".concat(prefixCls, \"-list-item-progress\"), motionClassName)\n }, loadingProgress);\n }));\n var listContainerNameClass = classNames(\"\".concat(prefixCls, \"-list-\").concat(listType, \"-container\"), className);\n var item = file.status === 'error' ? /*#__PURE__*/React.createElement(Tooltip, {\n title: message,\n getPopupContainer: function getPopupContainer(node) {\n return node.parentNode;\n }\n }, dom) : dom;\n return /*#__PURE__*/React.createElement(\"div\", {\n className: listContainerNameClass,\n style: style,\n ref: ref\n }, itemRender ? itemRender(item, file, items) : item);\n});\nexport default ListItem;"]},"metadata":{},"sourceType":"module"}