comic-plus
Version:
<p align="center"> <img width="200px" src="./logo.png"/> </p>
150 lines (149 loc) • 5.95 kB
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const vue = require("vue");
const index = require("../../progress/index.js");
const index$1 = require("../../preview-image/index.js");
require("../../../icons/index.js");
const components = require("../../../icons/components/components.js");
const _hoisted_1 = { class: "progress" };
const _hoisted_2 = {
key: 1,
class: "cu-upload__pictures"
};
const _hoisted_3 = {
key: 0,
class: "progress"
};
const _hoisted_4 = {
key: 1,
class: "mask"
};
const _hoisted_5 = ["src"];
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
...{
name: "CuUploadList"
},
__name: "upload-list",
props: {
type: {
type: String,
required: true
},
previewList: Array,
uploadFileEnum: {
type: Object,
required: true
},
disabled: Boolean
},
emits: ["remove", "choose"],
setup(__props, { emit: __emit }) {
const icons = {
ready: components.Save,
uploading: components.Upload,
success: components.CheckOne,
fail: components.CloseOne
};
const props = __props;
const emit = __emit;
function previewImg(index2) {
var _a;
if (props.disabled) return;
index$1.preview(
(_a = props.previewList) == null ? void 0 : _a.map((v) => v.url),
index2
);
}
function remove(uid, index2) {
if (props.disabled) return;
emit("remove", uid, index2);
}
return (_ctx, _cache) => {
return __props.type === "list" ? (vue.openBlock(), vue.createBlock(vue.TransitionGroup, {
key: 0,
name: "list",
class: "cu-upload__list",
tag: "ul"
}, {
default: vue.withCtx(() => [
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.previewList, (file, index$12) => {
var _a, _b;
return vue.openBlock(), vue.createElementBlock("li", {
key: file.uid || file.name
}, [
vue.createElementVNode("span", null, [
file.uid && __props.uploadFileEnum[file.uid] ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(icons[__props.uploadFileEnum[file.uid].status]), {
key: 0,
class: vue.normalizeClass(__props.uploadFileEnum[file.uid].status)
}, null, 8, ["class"])) : (vue.openBlock(), vue.createBlock(vue.unref(components.CheckOne), {
key: 1,
class: "success"
}))
]),
vue.createElementVNode("span", {
class: vue.normalizeClass(["filename", (_a = __props.uploadFileEnum[file.uid]) == null ? void 0 : _a.status])
}, vue.toDisplayString(file.name), 3),
vue.createVNode(vue.unref(components.Delete), {
class: "delete",
onClick: ($event) => remove(file.uid, index$12)
}, null, 8, ["onClick"]),
vue.createElementVNode("span", _hoisted_1, [
((_b = __props.uploadFileEnum[file.uid]) == null ? void 0 : _b.status) === "uploading" ? (vue.openBlock(), vue.createBlock(vue.unref(index.CuProgress), {
key: 0,
progress: __props.uploadFileEnum[file.uid].progress,
style: { "margin-top": "4px" }
}, null, 8, ["progress"])) : vue.createCommentVNode("", true)
])
]);
}), 128))
]),
_: 1
})) : __props.type === "picture" ? (vue.openBlock(), vue.createElementBlock("ul", _hoisted_2, [
vue.createVNode(vue.TransitionGroup, { name: "list" }, {
default: vue.withCtx(() => [
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.previewList, (file, index$12) => {
var _a;
return vue.openBlock(), vue.createElementBlock("li", {
key: file.uid || file.name,
class: vue.normalizeClass((_a = __props.uploadFileEnum[file.uid]) == null ? void 0 : _a.status)
}, [
vue.createVNode(vue.Transition, { name: "cu-fade" }, {
default: vue.withCtx(() => {
var _a2;
return [
((_a2 = __props.uploadFileEnum[file.uid]) == null ? void 0 : _a2.status) === "uploading" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3, [
vue.createVNode(vue.unref(index.CuProgress), {
size: "100",
type: "success",
"bar-type": "circle",
progress: __props.uploadFileEnum[file.uid].progress || 0
}, null, 8, ["progress"])
])) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_4, [
vue.createVNode(vue.unref(components.ZoomIn), {
onClick: ($event) => previewImg(index$12)
}, null, 8, ["onClick"]),
vue.createVNode(vue.unref(components.Delete), {
onClick: ($event) => remove(file.uid, index$12)
}, null, 8, ["onClick"])
]))
];
}),
_: 2
}, 1024),
vue.createElementVNode("img", {
src: file.url,
alt: ""
}, null, 8, _hoisted_5)
], 2);
}), 128))
]),
_: 1
}),
vue.renderSlot(_ctx.$slots, "default", {}, () => [
_cache[0] || (_cache[0] = vue.createElementVNode("li", { class: "choose-slot" }, null, -1))
])
])) : vue.createCommentVNode("", true);
};
}
});
exports.default = _sfc_main;