@extclp/vexip-ui
Version:
A Vue 3 UI library, Highly customizability, full TypeScript, performance pretty good
114 lines (113 loc) • 3.72 kB
JavaScript
import { defineComponent as T, useSlots as k, computed as x, createElementBlock as f, openBlock as a, normalizeStyle as P, unref as e, normalizeClass as L, renderSlot as d, Fragment as S, renderList as $, createBlock as b, Transition as g, withCtx as c, createVNode as s, createSlots as A } from "vue";
import "../renderer/index.mjs";
import "../upload-file/index.mjs";
import { useProps as B, useNameHelper as C, emitEvent as v } from "@vexip-ui/config";
import { uploadListProps as D } from "./props.mjs";
import { uploadListTypes as N } from "./symbol.mjs";
import R from "./upload-file.vue2.mjs";
import p from "../renderer/renderer.mjs";
const J = /* @__PURE__ */ T({
name: "UploadList",
__name: "upload-list",
props: D,
setup(y) {
const t = B("uploadList", y, {
files: {
default: () => [],
static: !0
},
selectToAdd: !1,
iconRenderer: {
default: null,
isFunc: !0
},
type: {
default: "name",
validator: (o) => N.includes(o)
},
loadingText: null,
style: null,
precision: 2,
// 'canPreview' using UploadFile default
slots: () => ({})
}), m = k(), l = C("upload"), _ = x(() => l.ns("fade"));
function h(o) {
v(t.onDelete, o);
}
function w(o) {
v(t.onPreview, o);
}
return (o, E) => (a(), f("ul", {
class: L([e(l).be("files"), e(l).bs("vars"), e(t).inherit && e(l).bem("files", "inherit")]),
style: P(e(t).style)
}, [
(a(!0), f(S, null, $(e(t).files, (u) => (a(), b(g, {
key: u.id,
appear: "",
name: e(t).selectToAdd ? _.value : void 0
}, {
default: c(() => [
s(e(R), {
inherit: "",
file: u,
"icon-renderer": e(t).iconRenderer,
"list-type": e(t).type,
"loading-text": e(t).loadingText,
"select-to-add": e(t).selectToAdd,
precision: e(t).precision,
"can-preview": e(t).canPreview,
onDelete: h,
onPreview: w
}, A({ _: 2 }, [
m.item || e(t).slots.item ? {
name: "default",
fn: c(({ file: n, status: r, percentage: i }) => [
d(o.$slots, "item", {
file: n,
status: r,
percentage: i
}, () => [
s(e(p), {
renderer: e(t).slots.item,
data: {
file: n,
status: r,
percentage: i
}
}, null, 8, ["renderer", "data"])
])
]),
key: "0"
} : void 0,
m.icon || e(t).slots.icon ? {
name: "icon",
fn: c(({ file: n, status: r, percentage: i }) => [
d(o.$slots, "icon", {
file: n,
status: r,
percentage: i
}, () => [
s(e(p), {
renderer: e(t).slots.icon,
data: { file: n, status: r, percentage: i }
}, null, 8, ["renderer", "data"])
])
]),
key: "1"
} : void 0
]), 1032, ["file", "icon-renderer", "list-type", "loading-text", "select-to-add", "precision", "can-preview"])
]),
_: 2
}, 1032, ["name"]))), 128)),
d(o.$slots, "suffix", {}, () => [
s(e(p), {
renderer: e(t).slots.suffix
}, null, 8, ["renderer"])
])
], 6));
}
});
export {
J as default
};
//# sourceMappingURL=upload-list.vue2.mjs.map