@opentiny/tiny-robot 0.3.0-rc.4 → 0.3.0-rc.6

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