"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const index = require("../../../hooks/use-locale/index.js");
const index$1 = require("../../../hooks/use-namespace/index.js");
const index$2 = require("../../icon/index.js");
const useFormCommonProps = require("../../form/src/hooks/use-form-common-props.js");
const index$4 = require("../../progress/index.js");
const uploadList = require("./upload-list.js");
const index$3 = require("../../../../../@element-plus/icons-vue/dist/index.js");
const Vue = require("vue");
const _hoisted_1 = [
  "tabindex",
  "aria-disabled",
  "onKeydown"
];
const _hoisted_2 = ["src", "crossorigin"];
const _hoisted_3 = ["onClick"];
const _hoisted_4 = ["title"];
const _hoisted_5 = ["onClick"];
const _hoisted_6 = ["onClick"];
var upload_list_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ Vue.defineComponent({
  name: "ElUploadList",
  __name: "upload-list",
  props: uploadList.uploadListProps,
  emits: uploadList.uploadListEmits,
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const { t } = index.useLocale();
    const nsUpload = index$1.useNamespace("upload");
    const nsIcon = index$1.useNamespace("icon");
    const nsList = index$1.useNamespace("list");
    const disabled = useFormCommonProps.useFormDisabled();
    const focusing = Vue.ref(false);
    const containerKls = Vue.computed(() => [
      nsUpload.b("list"),
      nsUpload.bm("list", props.listType),
      nsUpload.is("disabled", disabled.value)
    ]);
    const handleRemove = (file) => {
      emit("remove", file);
    };
    return (_ctx, _cache) => {
      return Vue.openBlock(), Vue.createBlock(Vue.TransitionGroup, {
        tag: "ul",
        class: Vue.normalizeClass(containerKls.value),
        name: Vue.unref(nsList).b()
      }, {
        default: Vue.withCtx(() => [(Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(__props.files, (file, index2) => {
          return Vue.openBlock(), Vue.createElementBlock("li", {
            key: file.uid || file.name,
            class: Vue.normalizeClass([
              Vue.unref(nsUpload).be("list", "item"),
              Vue.unref(nsUpload).is(file.status),
              { focusing: focusing.value }
            ]),
            tabindex: Vue.unref(disabled) ? void 0 : 0,
            "aria-disabled": Vue.unref(disabled),
            role: "button",
            onKeydown: Vue.withKeys(($event) => !Vue.unref(disabled) && handleRemove(file), ["delete"]),
            onFocus: _cache[0] || (_cache[0] = ($event) => focusing.value = true),
            onBlur: _cache[1] || (_cache[1] = ($event) => focusing.value = false),
            onClick: _cache[2] || (_cache[2] = ($event) => focusing.value = false)
          }, [Vue.renderSlot(_ctx.$slots, "default", {
            file,
            index: index2
          }, () => [
            __props.listType === "picture" || file.status !== "uploading" && __props.listType === "picture-card" ? (Vue.openBlock(), Vue.createElementBlock("img", {
              key: 0,
              class: Vue.normalizeClass(Vue.unref(nsUpload).be("list", "item-thumbnail")),
              src: file.url,
              crossorigin: __props.crossorigin,
              alt: ""
            }, null, 10, _hoisted_2)) : Vue.createCommentVNode("v-if", true),
            file.status === "uploading" || __props.listType !== "picture-card" ? (Vue.openBlock(), Vue.createElementBlock("div", {
              key: 1,
              class: Vue.normalizeClass(Vue.unref(nsUpload).be("list", "item-info"))
            }, [Vue.createElementVNode("a", {
              class: Vue.normalizeClass(Vue.unref(nsUpload).be("list", "item-name")),
              onClick: Vue.withModifiers(($event) => __props.handlePreview(file), ["prevent"])
            }, [Vue.createVNode(Vue.unref(index$2.ElIcon), { class: Vue.normalizeClass(Vue.unref(nsIcon).m("document")) }, {
              default: Vue.withCtx(() => [Vue.createVNode(Vue.unref(index$3.Document))]),
              _: 1
            }, 8, ["class"]), Vue.createElementVNode("span", {
              class: Vue.normalizeClass(Vue.unref(nsUpload).be("list", "item-file-name")),
              title: file.name
            }, Vue.toDisplayString(file.name), 11, _hoisted_4)], 10, _hoisted_3), file.status === "uploading" ? (Vue.openBlock(), Vue.createBlock(Vue.unref(index$4.ElProgress), {
              key: 0,
              type: __props.listType === "picture-card" ? "circle" : "line",
              "stroke-width": __props.listType === "picture-card" ? 6 : 2,
              percentage: Number(file.percentage),
              style: Vue.normalizeStyle(__props.listType === "picture-card" ? "" : "margin-top: 0.5rem")
            }, null, 8, [
              "type",
              "stroke-width",
              "percentage",
              "style"
            ])) : Vue.createCommentVNode("v-if", true)], 2)) : Vue.createCommentVNode("v-if", true),
            Vue.createElementVNode("label", { class: Vue.normalizeClass(Vue.unref(nsUpload).be("list", "item-status-label")) }, [__props.listType === "text" ? (Vue.openBlock(), Vue.createBlock(Vue.unref(index$2.ElIcon), {
              key: 0,
              class: Vue.normalizeClass([Vue.unref(nsIcon).m("upload-success"), Vue.unref(nsIcon).m("circle-check")])
            }, {
              default: Vue.withCtx(() => [Vue.createVNode(Vue.unref(index$3.CircleCheck))]),
              _: 1
            }, 8, ["class"])) : ["picture-card", "picture"].includes(__props.listType) ? (Vue.openBlock(), Vue.createBlock(Vue.unref(index$2.ElIcon), {
              key: 1,
              class: Vue.normalizeClass([Vue.unref(nsIcon).m("upload-success"), Vue.unref(nsIcon).m("check")])
            }, {
              default: Vue.withCtx(() => [Vue.createVNode(Vue.unref(index$3.Check))]),
              _: 1
            }, 8, ["class"])) : Vue.createCommentVNode("v-if", true)], 2),
            !Vue.unref(disabled) ? (Vue.openBlock(), Vue.createBlock(Vue.unref(index$2.ElIcon), {
              key: 2,
              class: Vue.normalizeClass(Vue.unref(nsIcon).m("close")),
              "aria-label": Vue.unref(t)("el.upload.delete"),
              role: "button",
              tabindex: "0",
              onClick: ($event) => handleRemove(file),
              onKeydown: Vue.withKeys(Vue.withModifiers(($event) => handleRemove(file), ["prevent"]), ["enter", "space"])
            }, {
              default: Vue.withCtx(() => [Vue.createVNode(Vue.unref(index$3.Close))]),
              _: 1
            }, 8, [
              "class",
              "aria-label",
              "onClick",
              "onKeydown"
            ])) : Vue.createCommentVNode("v-if", true),
            !Vue.unref(disabled) ? (Vue.openBlock(), Vue.createElementBlock("i", {
              key: 3,
              class: Vue.normalizeClass(Vue.unref(nsIcon).m("close-tip"))
            }, Vue.toDisplayString(Vue.unref(t)("el.upload.deleteTip")), 3)) : Vue.createCommentVNode("v-if", true),
            __props.listType === "picture-card" ? (Vue.openBlock(), Vue.createElementBlock("span", {
              key: 4,
              class: Vue.normalizeClass(Vue.unref(nsUpload).be("list", "item-actions"))
            }, [Vue.createElementVNode("span", {
              class: Vue.normalizeClass(Vue.unref(nsUpload).be("list", "item-preview")),
              onClick: ($event) => __props.handlePreview(file)
            }, [Vue.createVNode(Vue.unref(index$2.ElIcon), { class: Vue.normalizeClass(Vue.unref(nsIcon).m("zoom-in")) }, {
              default: Vue.withCtx(() => [Vue.createVNode(Vue.unref(index$3.ZoomIn))]),
              _: 1
            }, 8, ["class"])], 10, _hoisted_5), !Vue.unref(disabled) ? (Vue.openBlock(), Vue.createElementBlock("span", {
              key: 0,
              class: Vue.normalizeClass(Vue.unref(nsUpload).be("list", "item-delete")),
              onClick: ($event) => handleRemove(file)
            }, [Vue.createVNode(Vue.unref(index$2.ElIcon), { class: Vue.normalizeClass(Vue.unref(nsIcon).m("delete")) }, {
              default: Vue.withCtx(() => [Vue.createVNode(Vue.unref(index$3.Delete))]),
              _: 1
            }, 8, ["class"])], 10, _hoisted_6)) : Vue.createCommentVNode("v-if", true)], 2)) : Vue.createCommentVNode("v-if", true)
          ])], 42, _hoisted_1);
        }), 128)), Vue.renderSlot(_ctx.$slots, "append")]),
        _: 3
      }, 8, ["class", "name"]);
    };
  }
});
exports.default = upload_list_vue_vue_type_script_setup_true_lang_default;
