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.

0 lines
13 KiB

1 month ago
  1. {"ast":null,"code":"import { defineComponent, ref, computed, openBlock, createBlock, TransitionGroup, normalizeClass, unref, withCtx, createElementBlock, Fragment, renderList, withKeys, renderSlot, createCommentVNode, createElementVNode, withModifiers, createVNode, toDisplayString, normalizeStyle } from 'vue';\nimport { ElIcon } from '../../icon/index.mjs';\nimport { Document, CircleCheck, Check, Close, ZoomIn, Delete } from '@element-plus/icons-vue';\nimport { ElProgress } from '../../progress/index.mjs';\nimport { uploadListProps, uploadListEmits } from './upload-list.mjs';\nimport _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';\nimport { useLocale } from '../../../hooks/use-locale/index.mjs';\nimport { useNamespace } from '../../../hooks/use-namespace/index.mjs';\nimport { useFormDisabled } from '../../form/src/hooks/use-form-common-props.mjs';\nconst __default__ = defineComponent({\n name: \"ElUploadList\"\n});\nconst _sfc_main = /* @__PURE__ */defineComponent({\n ...__default__,\n props: uploadListProps,\n emits: uploadListEmits,\n setup(__props, {\n emit\n }) {\n const props = __props;\n const {\n t\n } = useLocale();\n const nsUpload = useNamespace(\"upload\");\n const nsIcon = useNamespace(\"icon\");\n const nsList = useNamespace(\"list\");\n const disabled = useFormDisabled();\n const focusing = ref(false);\n const containerKls = computed(() => [nsUpload.b(\"list\"), nsUpload.bm(\"list\", props.listType), nsUpload.is(\"disabled\", props.disabled)]);\n const handleRemove = file => {\n emit(\"remove\", file);\n };\n return (_ctx, _cache) => {\n return openBlock(), createBlock(TransitionGroup, {\n tag: \"ul\",\n class: normalizeClass(unref(containerKls)),\n name: unref(nsList).b()\n }, {\n default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.files, (file, index) => {\n return openBlock(), createElementBlock(\"li\", {\n key: file.uid || file.name,\n class: normalizeClass([unref(nsUpload).be(\"list\", \"item\"), unref(nsUpload).is(file.status), {\n focusing: focusing.value\n }]),\n tabindex: \"0\",\n onKeydown: withKeys($event => !unref(disabled) && handleRemove(file), [\"delete\"]),\n onFocus: $event => focusing.value = true,\n onBlur: $event => focusing.value = false,\n onClick: $event => focusing.value = false\n }, [renderSlot(_ctx.$slots, \"default\", {\n file,\n index\n }, () => [_ctx.listType === \"picture\" || file.status !== \"uploading\" && _ctx.listType === \"picture-card\" ? (openBlock(), createElementBlock(\"img\", {\n key: 0,\n class: normalizeClass(unref(nsUpload).be(\"list\", \"item-thumbnail\")),\n src: file.url,\n crossorigin: _ctx.crossorigin,\n alt: \"\"\n }, null, 10, [\"src\", \"crossorigin\"])) : createCommentVNode(\"v-if\", true), file.status === \"uploading\" || _ctx.listType !== \"picture-card\" ? (openBlock(), createElementBlock(\"div\", {\n key: 1,\n class: normalizeClass(unref(nsUpload).be(\"list\", \"item-info\"))\n }, [createElementVNode(\"a\", {\n class: normalizeClass(unref(nsUpload).be(\"list\", \"item-name\")),\n onClick: withModifiers($event => _ctx.handlePreview(file), [\"prevent\"])\n }, [createVNode(unref(ElIcon), {\n class: normalizeClass(unref(nsIcon).m(\"document\"))\n }, {\n default: withCtx(() => [createVNode(unref(Document))]),\n _: 1\n }, 8, [\"class\"]), createElementVNode(\"span\", {\n class: normalizeClass(unref(nsUpload).be(\"list\", \"item-file-name\")),\n title: file.name\n }, toDisplayString(file.name), 11, [\"title\"])], 10, [\"onClick\"]), file.status === \"uploading\" ? (openBlock(), createBlock(unref(ElProgress), {\n key: 0,\n type: _ctx.l