@opentiny/tiny-robot 0.3.0-alpha.17 → 0.3.0-alpha.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,178 +1,178 @@
1
- import { computed as I, ref as U, onUnmounted as J, defineComponent as z, mergeModels as j, useModel as X, createElementBlock as d, openBlock as o, withModifiers as M, createElementVNode as p, createVNode as F, unref as f, Fragment as D, renderList as A, normalizeClass as L, h as ee, createCommentVNode as C, createBlock as R, toDisplayString as x, withCtx as te, resolveDynamicComponent as V, watch as se } from "vue";
2
- import { M as ae, H as O, j as q, Z as H, Q, T as Y, N as Z, x as re, h as ne, L as oe, Y as ie, E, W } from "../tiny-robot-svgs.js";
1
+ import { computed as C, ref as R, onUnmounted as Y, defineComponent as B, mergeModels as W, useModel as Z, createElementBlock as d, openBlock as o, withModifiers as P, createElementVNode as p, createVNode as F, unref as f, Fragment as z, renderList as D, normalizeClass as U, h as ee, createCommentVNode as k, createBlock as L, toDisplayString as x, withCtx as te, resolveDynamicComponent as O, watch as ne } from "vue";
2
+ import { IconFileOther as re, IconFileFolder as V, IconFilePpt as q, IconFileExcel as K, IconFileWord as G, IconFilePdf as H, IconFileImage as J, IconClose as se, IconArrowLeft as ae, IconArrowRight as oe, IconFileRemove as ie, IconImageLoading as j, IconImageWarning as E } from "@opentiny/tiny-robot-svgs";
3
3
  import { _ as S } from "../_plugin-vue_export-helper.js";
4
- import { T as le } from "../index2.js";
5
- const B = {
6
- image: Z,
7
- pdf: Y,
8
- word: Q,
9
- excel: H,
4
+ import { TinyTooltip as le } from "@opentiny/vue";
5
+ const A = {
6
+ image: J,
7
+ pdf: H,
8
+ word: G,
9
+ excel: K,
10
10
  ppt: q,
11
- folder: O,
12
- other: ae
11
+ folder: V,
12
+ other: re
13
13
  }, N = [
14
14
  {
15
15
  type: "image",
16
16
  matcher: (t) => {
17
- var s, u;
17
+ var n, u;
18
18
  if (typeof t != "string")
19
- return ((s = t.type) == null ? void 0 : s.startsWith("image/")) || !1;
20
- const r = ((u = t.split(".").pop()) == null ? void 0 : u.toLowerCase()) || "";
21
- return ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"].includes(r);
19
+ return ((n = t.type) == null ? void 0 : n.startsWith("image/")) || !1;
20
+ const s = ((u = t.split(".").pop()) == null ? void 0 : u.toLowerCase()) || "";
21
+ return ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"].includes(s);
22
22
  },
23
- icon: Z
23
+ icon: J
24
24
  },
25
25
  {
26
26
  type: "pdf",
27
27
  matcher: (t) => typeof t != "string" ? t.type === "application/pdf" : t.toLowerCase().endsWith(".pdf"),
28
- icon: Y
28
+ icon: H
29
29
  },
30
30
  {
31
31
  type: "word",
32
32
  matcher: (t) => {
33
- var s;
33
+ var n;
34
34
  if (typeof t != "string")
35
35
  return t.type === "application/msword" || t.type === "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
36
- const r = ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "";
37
- return ["doc", "docx"].includes(r);
36
+ const s = ((n = t.split(".").pop()) == null ? void 0 : n.toLowerCase()) || "";
37
+ return ["doc", "docx"].includes(s);
38
38
  },
39
- icon: Q
39
+ icon: G
40
40
  },
41
41
  {
42
42
  type: "excel",
43
43
  matcher: (t) => {
44
- var s;
44
+ var n;
45
45
  if (typeof t != "string")
46
46
  return t.type === "application/vnd.ms-excel" || t.type === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
47
- const r = ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "";
48
- return ["xls", "xlsx"].includes(r);
47
+ const s = ((n = t.split(".").pop()) == null ? void 0 : n.toLowerCase()) || "";
48
+ return ["xls", "xlsx"].includes(s);
49
49
  },
50
- icon: H
50
+ icon: K
51
51
  },
52
52
  {
53
53
  type: "ppt",
54
54
  matcher: (t) => {
55
- var s;
55
+ var n;
56
56
  if (typeof t != "string")
57
57
  return t.type === "application/vnd.ms-powerpoint" || t.type === "application/vnd.openxmlformats-officedocument.presentationml.presentation";
58
- const r = ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "";
59
- return ["ppt", "pptx"].includes(r);
58
+ const s = ((n = t.split(".").pop()) == null ? void 0 : n.toLowerCase()) || "";
59
+ return ["ppt", "pptx"].includes(s);
60
60
  },
61
61
  icon: q
62
62
  },
63
63
  {
64
64
  type: "folder",
65
65
  matcher: (t) => typeof t != "string" ? !1 : t.toLowerCase().endsWith("folder"),
66
- icon: O
66
+ icon: V
67
67
  }
68
68
  ];
69
- function K(t = {}) {
70
- const { customIcons: r, fileMatchers: s } = t, u = () => {
69
+ function Q(t = {}) {
70
+ const { customIcons: s, fileMatchers: n } = t, u = () => {
71
71
  let e = [];
72
- return s ? e = s.concat(N) : e = N, e;
73
- }, i = (e = "other") => I(() => {
74
- if (r != null && r[e])
75
- return r[e];
76
- const a = u().find((_) => _.type === e);
77
- return a != null && a.icon ? a.icon : B[e] ? B[e] : B.other;
72
+ return n ? e = n.concat(N) : e = N, e;
73
+ }, i = (e = "other") => C(() => {
74
+ if (s != null && s[e])
75
+ return s[e];
76
+ const r = u().find((_) => _.type === e);
77
+ return r != null && r.icon ? r.icon : A[e] ? A[e] : A.other;
78
78
  }), v = (e) => {
79
- const n = u();
80
- for (const a of n)
81
- if (a.matcher(e))
82
- return a.type;
79
+ const a = u();
80
+ for (const r of a)
81
+ if (r.matcher(e))
82
+ return r.type;
83
83
  return "other";
84
- }, y = () => Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15), b = (e) => e < 1024 ? e + " B" : e < 1024 * 1024 ? (e / 1024).toFixed(2) + " KB" : (e / (1024 * 1024)).toFixed(2) + " MB", k = (e) => typeof e.url == "string" && !!e.url && typeof e.size == "number", w = (e) => e.rawFile instanceof File, l = (e) => e.map((n) => {
85
- if (k(n))
86
- return c(n);
87
- if (w(n))
88
- return m(n);
84
+ }, g = () => Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15), I = (e) => e < 1024 ? e + " B" : e < 1024 * 1024 ? (e / 1024).toFixed(2) + " KB" : (e / (1024 * 1024)).toFixed(2) + " MB", b = (e) => typeof e.url == "string" && !!e.url && typeof e.size == "number", w = (e) => e.rawFile instanceof File, l = (e) => e.map((a) => {
85
+ if (b(a))
86
+ return c(a);
87
+ if (w(a))
88
+ return m(a);
89
89
  }), h = (e) => ({
90
- id: e.id || y(),
90
+ id: e.id || g(),
91
91
  name: e.name || "",
92
92
  status: e.status || "success",
93
93
  message: e.message || ""
94
94
  }), c = (e) => {
95
- const n = h(e), a = e.url, _ = e.size, P = a.split("/").pop() || "";
95
+ const a = h(e), r = e.url, _ = e.size, M = r.split("/").pop() || "";
96
96
  return {
97
- ...n,
98
- name: n.name || P,
99
- fileType: v(P),
97
+ ...a,
98
+ name: a.name || M,
99
+ fileType: v(M),
100
100
  size: _,
101
- url: a
101
+ url: r
102
102
  };
103
103
  }, m = (e) => {
104
- const n = h(e), a = e.rawFile;
104
+ const a = h(e), r = e.rawFile;
105
105
  return {
106
- ...n,
107
- name: n.name || a.name,
108
- fileType: v(a),
109
- rawFile: a,
110
- size: e.size || a.size,
106
+ ...a,
107
+ name: a.name || r.name,
108
+ fileType: v(r),
109
+ rawFile: r,
110
+ size: e.size || r.size,
111
111
  url: e.url
112
112
  };
113
113
  };
114
114
  return {
115
115
  detectFileType: v,
116
- generateID: y,
117
- formatFileSize: b,
116
+ generateID: g,
117
+ formatFileSize: I,
118
118
  normalizeAttachments: l,
119
119
  getIconComponent: i
120
120
  };
121
121
  }
122
- const ce = (t, r) => {
122
+ const ce = (t, s) => {
123
123
  if (t.startsWith("blob:") || t.startsWith("data:")) {
124
- const s = document.createElement("a");
125
- s.href = t, s.download = r, document.body.appendChild(s), requestAnimationFrame(() => {
126
- s.click(), document.body.removeChild(s), URL.revokeObjectURL(t);
124
+ const n = document.createElement("a");
125
+ n.href = t, n.download = s, document.body.appendChild(n), requestAnimationFrame(() => {
126
+ n.click(), document.body.removeChild(n), URL.revokeObjectURL(t);
127
127
  });
128
128
  }
129
129
  };
130
- function de(t, r) {
131
- const s = U([]), u = I(() => t.file.fileType === "image"), i = (l) => {
130
+ function de(t, s) {
131
+ const n = R([]), u = C(() => t.file.fileType === "image"), i = (l) => {
132
132
  const h = URL.createObjectURL(l);
133
- return s.value.push(h), h;
133
+ return n.value.push(h), h;
134
134
  }, v = (l) => {
135
- r("preview", l, t.file);
136
- }, y = (l) => {
137
- if (r("download", l, t.file), !l.defaultPrevented && t.file.rawFile && !t.file.url) {
135
+ s("preview", l, t.file);
136
+ }, g = (l) => {
137
+ if (s("download", l, t.file), !l.defaultPrevented && t.file.rawFile && !t.file.url) {
138
138
  const h = i(t.file.rawFile);
139
139
  ce(h, t.file.name || t.file.rawFile.name);
140
140
  }
141
+ }, I = () => {
142
+ s("remove", t.file);
141
143
  }, b = () => {
142
- r("remove", t.file);
143
- }, k = () => {
144
- r("retry", t.file);
144
+ s("retry", t.file);
145
145
  }, w = (l, h) => {
146
- h.stopPropagation(), l.handler && l.handler(t.file), l.type === "preview" ? v(h) : l.type === "download" ? y(h) : r("action", { action: l, file: t.file });
146
+ h.stopPropagation(), l.handler && l.handler(t.file), l.type === "preview" ? v(h) : l.type === "download" ? g(h) : s("action", { action: l, file: t.file });
147
147
  };
148
- return J(() => {
149
- s.value.forEach((l) => {
148
+ return Y(() => {
149
+ n.value.forEach((l) => {
150
150
  URL.revokeObjectURL(l);
151
- }), s.value = [];
151
+ }), n.value = [];
152
152
  }), {
153
153
  isImage: u,
154
154
  handlePreview: v,
155
- downloadFile: y,
156
- handleRemove: b,
157
- handleRetry: k,
155
+ downloadFile: g,
156
+ handleRemove: I,
157
+ handleRetry: b,
158
158
  handleCustomAction: w
159
159
  };
160
160
  }
161
- const ue = { class: "tr-image-preview__main" }, fe = ["disabled"], pe = { class: "tr-image-preview__content" }, me = ["src", "alt"], _e = ["disabled"], ve = { class: "tr-image-preview__footer" }, he = { class: "tr-image-preview__thumbnails" }, ye = ["onClick"], ge = ["src", "alt"], we = /* @__PURE__ */ z({
161
+ const ue = { class: "tr-image-preview__main" }, fe = ["disabled"], pe = { class: "tr-image-preview__content" }, me = ["src", "alt"], _e = ["disabled"], ve = { class: "tr-image-preview__footer" }, he = { class: "tr-image-preview__thumbnails" }, ge = ["onClick"], ye = ["src", "alt"], we = /* @__PURE__ */ B({
162
162
  __name: "ImagePreview",
163
- props: /* @__PURE__ */ j({
163
+ props: /* @__PURE__ */ W({
164
164
  images: {}
165
165
  }, {
166
166
  currentIndex: { required: !0 },
167
167
  currentIndexModifiers: {}
168
168
  }),
169
- emits: /* @__PURE__ */ j(["close"], ["update:currentIndex"]),
170
- setup(t, { emit: r }) {
171
- const s = t, u = r, i = X(t, "currentIndex"), v = I(() => s.images[i.value]), y = () => {
169
+ emits: /* @__PURE__ */ W(["close"], ["update:currentIndex"]),
170
+ setup(t, { emit: s }) {
171
+ const n = t, u = s, i = Z(t, "currentIndex"), v = C(() => n.images[i.value]), g = () => {
172
172
  i.value > 0 && i.value--;
173
- }, b = () => {
174
- i.value < s.images.length - 1 && i.value++;
175
- }, k = (l) => {
173
+ }, I = () => {
174
+ i.value < n.images.length - 1 && i.value++;
175
+ }, b = (l) => {
176
176
  i.value = l;
177
177
  };
178
178
  function w() {
@@ -182,21 +182,21 @@ const ue = { class: "tr-image-preview__main" }, fe = ["disabled"], pe = { class:
182
182
  var c, m;
183
183
  return o(), d("div", {
184
184
  class: "tr-image-preview",
185
- onClick: M(w, ["self"])
185
+ onClick: P(w, ["self"])
186
186
  }, [
187
187
  p("button", {
188
188
  class: "tr-image-preview__close",
189
189
  onClick: w
190
190
  }, [
191
- F(f(re))
191
+ F(f(se))
192
192
  ]),
193
193
  p("div", ue, [
194
194
  p("button", {
195
195
  class: "tr-image-preview__nav tr-image-preview__nav--left",
196
- onClick: M(y, ["stop"]),
196
+ onClick: P(g, ["stop"]),
197
197
  disabled: i.value === 0
198
198
  }, [
199
- F(f(ne))
199
+ F(f(ae))
200
200
  ], 8, fe),
201
201
  p("div", pe, [
202
202
  p("img", {
@@ -207,7 +207,7 @@ const ue = { class: "tr-image-preview__main" }, fe = ["disabled"], pe = { class:
207
207
  ]),
208
208
  p("button", {
209
209
  class: "tr-image-preview__nav tr-image-preview__nav--right",
210
- onClick: M(b, ["stop"]),
210
+ onClick: P(I, ["stop"]),
211
211
  disabled: i.value === l.images.length - 1
212
212
  }, [
213
213
  F(f(oe))
@@ -215,102 +215,102 @@ const ue = { class: "tr-image-preview__main" }, fe = ["disabled"], pe = { class:
215
215
  ]),
216
216
  p("div", ve, [
217
217
  p("div", he, [
218
- (o(!0), d(D, null, A(l.images, (e, n) => (o(), d("div", {
218
+ (o(!0), d(z, null, D(l.images, (e, a) => (o(), d("div", {
219
219
  key: e.id,
220
- class: L(["tr-image-preview__thumbnail", { "tr-image-preview__thumbnail--active": n === i.value }]),
221
- onClick: (a) => k(n)
220
+ class: U(["tr-image-preview__thumbnail", { "tr-image-preview__thumbnail--active": a === i.value }]),
221
+ onClick: (r) => b(a)
222
222
  }, [
223
223
  p("img", {
224
224
  src: e.url,
225
225
  alt: e.name
226
- }, null, 8, ge)
227
- ], 10, ye))), 128))
226
+ }, null, 8, ye)
227
+ ], 10, ge))), 128))
228
228
  ])
229
229
  ])
230
230
  ]);
231
231
  };
232
232
  }
233
- }), be = /* @__PURE__ */ S(we, [["__scopeId", "data-v-027af77c"]]);
234
- function ke(t, r, s = {}) {
235
- const u = U(!1), i = U([]), v = U(0), y = (c) => {
233
+ }), Ie = /* @__PURE__ */ S(we, [["__scopeId", "data-v-027af77c"]]);
234
+ function be(t, s, n = {}) {
235
+ const u = R(!1), i = R([]), v = R(0), g = (c) => {
236
236
  v.value = c;
237
- }, b = (c) => {
237
+ }, I = (c) => {
238
238
  const m = t.value.findIndex((e) => e.id === c.id);
239
239
  if (m !== -1 && c.url && t.value.splice(m, 1, c), c.fileType === "image") {
240
240
  i.value = t.value.filter(
241
- (n) => n.fileType === "image" && n.status !== "error" && n.status !== "uploading"
241
+ (a) => a.fileType === "image" && a.status !== "error" && a.status !== "uploading"
242
242
  );
243
- const e = i.value.findIndex((n) => n.id === c.id);
243
+ const e = i.value.findIndex((a) => a.id === c.id);
244
244
  e !== -1 && (v.value = e, u.value = !0);
245
245
  }
246
- }, k = (c, m) => {
247
- r("preview", c, m), !c.defaultPrevented && b(m);
246
+ }, b = (c, m) => {
247
+ s("preview", c, m), !c.defaultPrevented && I(m);
248
248
  }, w = () => {
249
249
  u.value = !1;
250
250
  }, l = (c, m) => {
251
- s.onDownload ? s.onDownload(c, m) : r("download", c, m);
251
+ n.onDownload ? n.onDownload(c, m) : s("download", c, m);
252
252
  };
253
253
  return {
254
254
  // 显示预览
255
- handlePreview: k,
255
+ handlePreview: b,
256
256
  // 渲染预览组件
257
- renderPreview: () => u.value ? ee(be, {
257
+ renderPreview: () => u.value ? ee(Ie, {
258
258
  images: i.value,
259
259
  currentIndex: v.value,
260
- "onUpdate:currentIndex": y,
260
+ "onUpdate:currentIndex": g,
261
261
  onClose: w,
262
262
  onDownload: l
263
263
  }) : null
264
264
  };
265
265
  }
266
- function Ce(t, r) {
266
+ function ke(t, s) {
267
267
  return {
268
- actualListType: I(() => r && r !== "auto" ? r : t.value.length === 0 ? "card" : t.value.every((i) => i.fileType === "image") ? "picture" : "card")
268
+ actualListType: C(() => s && s !== "auto" ? s : t.value.length === 0 ? "card" : t.value.every((i) => i.fileType === "image") ? "picture" : "card")
269
269
  };
270
270
  }
271
- const Ie = ["data-file-type"], Fe = {
271
+ const Ce = ["data-file-type"], Fe = {
272
272
  key: 1,
273
273
  class: "tr-file-card__picture-container"
274
- }, xe = ["src", "alt"], Me = {
274
+ }, xe = ["src", "alt"], Pe = {
275
275
  key: 0,
276
276
  class: "tr-file-card__picture-overlay"
277
- }, Pe = {
277
+ }, Me = {
278
278
  key: 1,
279
279
  class: "tr-file-card__status-overlay tr-file-card__status-overlay--picture"
280
- }, Ue = {
280
+ }, Re = {
281
281
  key: 0,
282
282
  class: "tr-file-card__status-icon tr-file-card__status-icon--loading"
283
- }, Le = {
283
+ }, Ue = {
284
284
  key: 0,
285
285
  class: "tr-file-card__status-icon--loading-text"
286
- }, Re = {
286
+ }, Le = {
287
287
  key: 2,
288
288
  class: "tr-file-card__default-container"
289
- }, Te = { class: "tr-file-card__icon-wrapper" }, $e = {
289
+ }, $e = { class: "tr-file-card__icon-wrapper" }, Te = {
290
290
  key: 0,
291
291
  class: "tr-file-card__status-overlay tr-file-card__status-overlay--icon"
292
- }, Be = {
292
+ }, Ae = {
293
293
  key: 0,
294
294
  class: "tr-file-card__status-icon tr-file-card__status-icon--loading"
295
- }, ze = { class: "tr-file-card__content" }, De = { class: "tr-file-card__info" }, Ae = ["title"], Se = {
295
+ }, Be = { class: "tr-file-card__content" }, ze = { class: "tr-file-card__info" }, De = ["title"], Se = {
296
296
  key: 0,
297
297
  class: "tr-file-card__status"
298
- }, je = {
298
+ }, We = {
299
299
  key: 0,
300
300
  class: "tr-file-card__status-success"
301
- }, Ee = { class: "tr-file-card__status-info" }, We = { class: "tr-file-card__file-type" }, Ne = {
301
+ }, je = { class: "tr-file-card__status-info" }, Ee = { class: "tr-file-card__file-type" }, Ne = {
302
302
  key: 0,
303
303
  class: "tr-file-card__file-size"
304
- }, Ve = {
304
+ }, Oe = {
305
305
  key: 0,
306
306
  class: "tr-file-card__actions"
307
- }, Oe = ["href", "target", "onClick"], qe = ["onClick"], He = {
307
+ }, Ve = ["href", "target", "onClick"], qe = ["onClick"], Ke = {
308
308
  key: 1,
309
309
  class: "tr-file-card__status-uploading"
310
- }, Qe = {
310
+ }, Ge = {
311
311
  key: 2,
312
312
  class: "tr-file-card__status-error"
313
- }, Ye = /* @__PURE__ */ z({
313
+ }, He = /* @__PURE__ */ B({
314
314
  __name: "FileCard",
315
315
  props: {
316
316
  file: {},
@@ -322,128 +322,128 @@ const Ie = ["data-file-type"], Fe = {
322
322
  fileMatchers: {}
323
323
  },
324
324
  emits: ["remove", "preview", "action", "retry", "download"],
325
- setup(t, { emit: r }) {
326
- const s = t, u = r, { formatFileSize: i, getIconComponent: v } = K({
327
- customIcons: s.fileIcons,
328
- fileMatchers: s.fileMatchers
329
- }), { isImage: y, handlePreview: b, handleRemove: k, handleCustomAction: w, handleRetry: l } = de(s, u), h = I(() => v(s.file.fileType).value), c = I(() => s.file.status === "uploading"), m = I(() => s.file.status === "success"), e = I(() => s.file.status === "error"), n = I(() => [
330
- s.variant === "picture" ? "tr-file-card--picture" : "tr-file-card",
331
- `tr-file-card--${s.file.fileType || "other"}`,
325
+ setup(t, { emit: s }) {
326
+ const n = t, u = s, { formatFileSize: i, getIconComponent: v } = Q({
327
+ customIcons: n.fileIcons,
328
+ fileMatchers: n.fileMatchers
329
+ }), { isImage: g, handlePreview: I, handleRemove: b, handleCustomAction: w, handleRetry: l } = de(n, u), h = C(() => v(n.file.fileType).value), c = C(() => n.file.status === "uploading"), m = C(() => n.file.status === "success"), e = C(() => n.file.status === "error"), a = C(() => [
330
+ n.variant === "picture" ? "tr-file-card--picture" : "tr-file-card",
331
+ `tr-file-card--${n.file.fileType || "other"}`,
332
332
  {
333
333
  "tr-file-card--uploading": c.value,
334
334
  "tr-file-card--error": e.value,
335
335
  "tr-file-card--success": m.value
336
336
  }
337
337
  ]);
338
- return (a, _) => {
339
- var P;
338
+ return (r, _) => {
339
+ var M;
340
340
  return o(), d("div", {
341
- class: L(n.value),
342
- "data-file-type": a.file.fileType || "other",
343
- onClick: _[3] || (_[3] = (g) => a.variant === "picture" ? f(b)(g) : void 0)
341
+ class: U(a.value),
342
+ "data-file-type": r.file.fileType || "other",
343
+ onClick: _[3] || (_[3] = (y) => r.variant === "picture" ? f(I)(y) : void 0)
344
344
  }, [
345
- a.disabled ? C("", !0) : (o(), d("button", {
345
+ r.disabled ? k("", !0) : (o(), d("button", {
346
346
  key: 0,
347
347
  class: "tr-file-card__close-btn",
348
- onClick: _[0] || (_[0] = M(
348
+ onClick: _[0] || (_[0] = P(
349
349
  //@ts-ignore
350
- (...g) => f(k) && f(k)(...g),
350
+ (...y) => f(b) && f(b)(...y),
351
351
  ["stop"]
352
352
  )),
353
353
  "aria-label": "移除文件"
354
354
  }, [
355
355
  F(f(ie))
356
356
  ])),
357
- a.variant === "picture" ? (o(), d("div", Fe, [
357
+ r.variant === "picture" ? (o(), d("div", Fe, [
358
358
  p("img", {
359
- src: a.file.url,
360
- alt: a.file.name,
359
+ src: r.file.url,
360
+ alt: r.file.name,
361
361
  class: "tr-file-card__picture-img"
362
362
  }, null, 8, xe),
363
- m.value ? (o(), d("div", Me, _[4] || (_[4] = [
363
+ m.value ? (o(), d("div", Pe, _[4] || (_[4] = [
364
364
  p("span", { class: "tr-file-card__picture-overlay-text" }, "预览", -1)
365
- ]))) : C("", !0),
366
- c.value || e.value ? (o(), d("div", Pe, [
367
- c.value ? (o(), d("div", Ue, [
368
- F(f(E)),
369
- a.file.message ? (o(), d("span", Le, x(a.file.message), 1)) : C("", !0)
370
- ])) : e.value ? (o(), R(f(le), {
365
+ ]))) : k("", !0),
366
+ c.value || e.value ? (o(), d("div", Me, [
367
+ c.value ? (o(), d("div", Re, [
368
+ F(f(j)),
369
+ r.file.message ? (o(), d("span", Ue, x(r.file.message), 1)) : k("", !0)
370
+ ])) : e.value ? (o(), L(f(le), {
371
371
  key: 1,
372
372
  content: "解析失败",
373
373
  placement: "top",
374
374
  effect: "light"
375
375
  }, {
376
376
  default: te(() => [
377
- F(f(W), { class: "tr-file-card__status-icon tr-file-card__status-icon--error" })
377
+ F(f(E), { class: "tr-file-card__status-icon tr-file-card__status-icon--error" })
378
378
  ]),
379
379
  _: 1
380
- })) : C("", !0)
381
- ])) : C("", !0)
382
- ])) : (o(), d("div", Re, [
380
+ })) : k("", !0)
381
+ ])) : k("", !0)
382
+ ])) : (o(), d("div", Le, [
383
383
  p("div", {
384
- class: L(["tr-file-card__icon", { "tr-file-card__icon--clickable": f(y) }]),
385
- onClick: _[1] || (_[1] = M((g) => f(y) ? f(b)(g) : null, ["stop"]))
384
+ class: U(["tr-file-card__icon", { "tr-file-card__icon--clickable": f(g) }]),
385
+ onClick: _[1] || (_[1] = P((y) => f(g) ? f(I)(y) : null, ["stop"]))
386
386
  }, [
387
- p("div", Te, [
388
- (o(), R(V(h.value), { class: "tr-file-card__file-icon" })),
389
- c.value || e.value ? (o(), d("div", $e, [
390
- c.value ? (o(), d("div", Be, [
391
- F(f(E))
392
- ])) : e.value ? (o(), R(f(W), {
387
+ p("div", $e, [
388
+ (o(), L(O(h.value), { class: "tr-file-card__file-icon" })),
389
+ c.value || e.value ? (o(), d("div", Te, [
390
+ c.value ? (o(), d("div", Ae, [
391
+ F(f(j))
392
+ ])) : e.value ? (o(), L(f(E), {
393
393
  key: 1,
394
394
  class: "tr-file-card__status-icon tr-file-card__status-icon--error"
395
- })) : C("", !0)
396
- ])) : C("", !0)
395
+ })) : k("", !0)
396
+ ])) : k("", !0)
397
397
  ])
398
398
  ], 2),
399
- p("div", ze, [
400
- p("div", De, [
399
+ p("div", Be, [
400
+ p("div", ze, [
401
401
  p("div", {
402
402
  class: "tr-file-card__name",
403
- title: a.file.name
404
- }, x(a.file.name), 9, Ae),
405
- a.showStatus ? (o(), d("div", Se, [
406
- m.value ? (o(), d("div", je, [
407
- p("div", Ee, [
408
- p("span", We, x(((P = a.file.fileType) == null ? void 0 : P.toUpperCase()) || "FILE"), 1),
409
- a.file.size ? (o(), d("span", Ne, x(f(i)(a.file.size)), 1)) : C("", !0)
403
+ title: r.file.name
404
+ }, x(r.file.name), 9, De),
405
+ r.showStatus ? (o(), d("div", Se, [
406
+ m.value ? (o(), d("div", We, [
407
+ p("div", je, [
408
+ p("span", Ee, x(((M = r.file.fileType) == null ? void 0 : M.toUpperCase()) || "FILE"), 1),
409
+ r.file.size ? (o(), d("span", Ne, x(f(i)(r.file.size)), 1)) : k("", !0)
410
410
  ]),
411
- a.actions ? (o(), d("div", Ve, [
412
- (o(!0), d(D, null, A(a.actions, (g, G) => (o(), d("div", {
413
- key: G,
411
+ r.actions ? (o(), d("div", Oe, [
412
+ (o(!0), d(z, null, D(r.actions, (y, X) => (o(), d("div", {
413
+ key: X,
414
414
  class: "tr-file-card__action-btn"
415
415
  }, [
416
- g.type === "download" ? (o(), d("a", {
416
+ y.type === "download" ? (o(), d("a", {
417
417
  key: 0,
418
418
  class: "tr-file-card__action-btn--download",
419
- href: a.file.url ?? "javascript:void(0)",
420
- target: a.file.url ? "_blank" : "_self",
421
- onClick: ($) => f(w)(g, $)
422
- }, x(g.label), 9, Oe)) : (o(), d("button", {
419
+ href: r.file.url ?? "javascript:void(0)",
420
+ target: r.file.url ? "_blank" : "_self",
421
+ onClick: (T) => f(w)(y, T)
422
+ }, x(y.label), 9, Ve)) : (o(), d("button", {
423
423
  key: 1,
424
- class: L(`tr-file-card__action-btn--${g.type}`),
425
- onClick: ($) => f(w)(g, $)
426
- }, x(g.label), 11, qe))
424
+ class: U(`tr-file-card__action-btn--${y.type}`),
425
+ onClick: (T) => f(w)(y, T)
426
+ }, x(y.label), 11, qe))
427
427
  ]))), 128))
428
- ])) : C("", !0)
429
- ])) : c.value ? (o(), d("div", He, _[5] || (_[5] = [
428
+ ])) : k("", !0)
429
+ ])) : c.value ? (o(), d("div", Ke, _[5] || (_[5] = [
430
430
  p("span", { class: "tr-file-card__uploading-text" }, "上传中...", -1)
431
- ]))) : e.value ? (o(), d("div", Qe, [
431
+ ]))) : e.value ? (o(), d("div", Ge, [
432
432
  _[6] || (_[6] = p("span", { class: "tr-file-card__error-text" }, "上传失败", -1)),
433
433
  p("button", {
434
434
  class: "tr-file-card__retry-btn",
435
435
  onClick: _[2] || (_[2] = //@ts-ignore
436
- (...g) => f(l) && f(l)(...g))
436
+ (...y) => f(l) && f(l)(...y))
437
437
  }, "重试")
438
- ])) : C("", !0)
439
- ])) : C("", !0)
438
+ ])) : k("", !0)
439
+ ])) : k("", !0)
440
440
  ])
441
441
  ])
442
442
  ]))
443
- ], 10, Ie);
443
+ ], 10, Ce);
444
444
  };
445
445
  }
446
- }), Ze = /* @__PURE__ */ S(Ye, [["__scopeId", "data-v-06df896e"]]), Ke = { class: "tr-attachments" }, Ge = /* @__PURE__ */ z({
446
+ }), Je = /* @__PURE__ */ S(He, [["__scopeId", "data-v-a569c028"]]), Qe = { class: "tr-attachments" }, Xe = /* @__PURE__ */ B({
447
447
  __name: "index",
448
448
  props: {
449
449
  items: {},
@@ -464,15 +464,15 @@ const Ie = ["data-file-type"], Fe = {
464
464
  fileMatchers: { default: () => [] }
465
465
  },
466
466
  emits: ["update:items", "remove", "download", "retry", "preview", "action"],
467
- setup(t, { emit: r }) {
468
- const s = t, u = r, i = U(s.items || []), { actualListType: v } = Ce(i, s.variant), { handlePreview: y, renderPreview: b } = ke(i, u, { enableDownload: !0 });
469
- function k(e) {
470
- if (s.disabled) return;
471
- const n = i.value.findIndex((a) => a.id === e.id);
472
- n !== -1 && (i.value.splice(n, 1), u("remove", e), u("update:items", i.value));
467
+ setup(t, { emit: s }) {
468
+ const n = t, u = s, i = R(n.items || []), { actualListType: v } = ke(i, n.variant), { handlePreview: g, renderPreview: I } = be(i, u, { enableDownload: !0 });
469
+ function b(e) {
470
+ if (n.disabled) return;
471
+ const a = i.value.findIndex((r) => r.id === e.id);
472
+ a !== -1 && (i.value.splice(a, 1), u("remove", e), u("update:items", i.value));
473
473
  }
474
- function w(e, n) {
475
- u("download", e, n);
474
+ function w(e, a) {
475
+ u("download", e, a);
476
476
  }
477
477
  function l(e) {
478
478
  u("retry", e);
@@ -480,47 +480,47 @@ const Ie = ["data-file-type"], Fe = {
480
480
  function h(e) {
481
481
  u("action", e);
482
482
  }
483
- const c = I(() => s.wrap ? "wrap" : "no-wrap"), { normalizeAttachments: m } = K({
484
- fileMatchers: s.fileMatchers
483
+ const c = C(() => n.wrap ? "wrap" : "no-wrap"), { normalizeAttachments: m } = Q({
484
+ fileMatchers: n.fileMatchers
485
485
  });
486
- return se(
487
- () => s.items,
486
+ return ne(
487
+ () => n.items,
488
488
  (e) => {
489
489
  e && e.length > 0 && (i.value = m(e));
490
490
  },
491
491
  { deep: !0, immediate: !0 }
492
- ), (e, n) => (o(), d("div", Ke, [
492
+ ), (e, a) => (o(), d("div", Qe, [
493
493
  i.value.length > 0 ? (o(), d("div", {
494
494
  key: 0,
495
- class: L(["tr-attachments__file-list", c.value]),
496
- onClick: n[0] || (n[0] = M(() => {
495
+ class: U(["tr-attachments__file-list", c.value]),
496
+ onClick: a[0] || (a[0] = P(() => {
497
497
  }, ["stop"]))
498
498
  }, [
499
- (o(!0), d(D, null, A(i.value, (a) => (o(), R(Ze, {
500
- key: a.id,
501
- file: a,
499
+ (o(!0), d(z, null, D(i.value, (r) => (o(), L(Je, {
500
+ key: r.id,
501
+ file: r,
502
502
  variant: f(v),
503
503
  "file-icons": e.fileIcons,
504
504
  disabled: e.disabled,
505
505
  actions: e.actions,
506
506
  "show-status": !0,
507
507
  "file-matchers": e.fileMatchers,
508
- onRemove: k,
509
- onPreview: f(y),
508
+ onRemove: b,
509
+ onPreview: f(g),
510
510
  onDownload: w,
511
511
  onRetry: l,
512
512
  onAction: h
513
513
  }, null, 8, ["file", "variant", "file-icons", "disabled", "actions", "file-matchers", "onPreview"]))), 128))
514
- ], 2)) : C("", !0),
515
- (o(), R(V(f(b)())))
514
+ ], 2)) : k("", !0),
515
+ (o(), L(O(f(I)())))
516
516
  ]));
517
517
  }
518
- }), T = /* @__PURE__ */ S(Ge, [["__scopeId", "data-v-e09559ac"]]);
519
- T.name = "TrAttachments";
520
- const Je = function(t) {
521
- t.component(T.name, T);
518
+ }), $ = /* @__PURE__ */ S(Xe, [["__scopeId", "data-v-e09559ac"]]);
519
+ $.name = "TrAttachments";
520
+ const Ye = function(t) {
521
+ t.component($.name, $);
522
522
  };
523
- T.install = Je;
523
+ $.install = Ye;
524
524
  export {
525
- T as default
525
+ $ as default
526
526
  };