@opentiny/tiny-robot 0.3.0-alpha.8 → 0.3.0-rc.0

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,64 +1,64 @@
1
- import { computed as I, ref as $, onUnmounted as Y, defineComponent as D, mergeModels as E, useModel as Z, createElementBlock as c, openBlock as r, withModifiers as M, createElementVNode as p, createVNode as F, unref as f, Fragment as L, renderList as A, normalizeClass as U, h as ee, createCommentVNode as C, createBlock as P, toDisplayString as x, withCtx as te, resolveDynamicComponent as O, watch as se } from "vue";
2
- import { y as ae, O as V, F as H, x as X, H as q, k as K, X as G, a as ne, p as re, C as oe, B as ie, D as j, M as 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 T = {
6
- image: G,
7
- pdf: K,
8
- word: q,
9
- excel: X,
10
- ppt: 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
+ ppt: q,
11
11
  folder: V,
12
- other: ae
12
+ other: re
13
13
  }, N = [
14
14
  {
15
15
  type: "image",
16
16
  matcher: (t) => {
17
- var s, o;
17
+ var n, u;
18
18
  if (typeof t != "string")
19
- return ((s = t.type) == null ? void 0 : s.startsWith("image/")) || !1;
20
- const n = ((o = t.split(".").pop()) == null ? void 0 : o.toLowerCase()) || "";
21
- return ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"].includes(n);
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: G
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: K
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 n = ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "";
37
- return ["doc", "docx"].includes(n);
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 n = ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "";
48
- return ["xls", "xlsx"].includes(n);
47
+ const s = ((n = t.split(".").pop()) == null ? void 0 : n.toLowerCase()) || "";
48
+ return ["xls", "xlsx"].includes(s);
49
49
  },
50
- icon: X
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 n = ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "";
59
- return ["ppt", "pptx"].includes(n);
58
+ const s = ((n = t.split(".").pop()) == null ? void 0 : n.toLowerCase()) || "";
59
+ return ["ppt", "pptx"].includes(s);
60
60
  },
61
- icon: H
61
+ icon: q
62
62
  },
63
63
  {
64
64
  type: "folder",
@@ -66,251 +66,251 @@ const T = {
66
66
  icon: V
67
67
  }
68
68
  ];
69
- function J(t = {}) {
70
- const { customIcons: n, fileMatchers: s } = t, o = () => {
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 (n != null && n[e])
75
- return n[e];
76
- const a = o().find((v) => v.type === e);
77
- return a != null && a.icon ? a.icon : T[e] ? T[e] : T.other;
78
- }), m = (e) => {
79
- const u = o();
80
- for (const a of u)
81
- if (a.matcher(e))
82
- return a.type;
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;
83
83
  return "other";
84
- }, h = () => Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15), w = (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", g = (e) => e.rawFile instanceof File, d = (e) => e.map((u) => {
85
- if (b(u))
86
- return _(u);
87
- if (g(u))
88
- return y(u);
89
- }), l = (e) => ({
90
- id: e.id || h(),
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
91
  name: e.name || "",
92
92
  status: e.status || "success",
93
93
  message: e.message || ""
94
- }), _ = (e) => {
95
- const u = l(e), a = e.url.split("/").pop() || "";
94
+ }), c = (e) => {
95
+ const a = h(e), r = e.url, _ = e.size, M = r.split("/").pop() || "";
96
96
  return {
97
- ...u,
98
- name: u.name || a,
99
- fileType: m(a),
100
- size: e.size,
101
- url: e.url
97
+ ...a,
98
+ name: a.name || M,
99
+ fileType: v(M),
100
+ size: _,
101
+ url: r
102
102
  };
103
- }, y = (e) => {
104
- const u = l(e), { rawFile: a } = e;
103
+ }, m = (e) => {
104
+ const a = h(e), r = e.rawFile;
105
105
  return {
106
- ...u,
107
- name: u.name || a.name,
108
- fileType: m(a),
109
- rawFile: a,
110
- 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
- detectFileType: m,
116
- generateID: h,
117
- formatFileSize: w,
118
- uploadAttachments: d,
115
+ detectFileType: v,
116
+ generateID: g,
117
+ formatFileSize: I,
118
+ normalizeAttachments: l,
119
119
  getIconComponent: i
120
120
  };
121
121
  }
122
- const ce = (t, n) => {
123
- const s = document.createElement("iframe");
124
- if (s.style.display = "none", document.body.appendChild(s), t.startsWith("blob:") || t.startsWith("data:")) {
125
- const o = document.createElement("a");
126
- o.href = t, o.download = n, o.style.display = "none", document.body.appendChild(o), o.click(), document.body.removeChild(o);
122
+ const ce = (t, s) => {
123
+ if (t.startsWith("blob:") || t.startsWith("data:")) {
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
- document.body.removeChild(s);
129
129
  };
130
- function de(t, n) {
131
- const s = $([]), o = I(() => t.file.fileType === "image"), i = (d) => {
132
- const l = URL.createObjectURL(d);
133
- return s.value.push(l), l;
134
- }, m = () => {
135
- n("preview", t.file);
136
- }, h = (d) => {
137
- if (t.file.rawFile && !t.file.url) {
138
- const l = i(t.file.rawFile);
139
- ce(l, t.file.name || "");
130
+ function de(t, s) {
131
+ const n = R([]), u = C(() => t.file.fileType === "image"), i = (l) => {
132
+ const h = URL.createObjectURL(l);
133
+ return n.value.push(h), h;
134
+ }, v = (l) => {
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
+ const h = i(t.file.rawFile);
139
+ ce(h, t.file.name || t.file.rawFile.name);
140
140
  }
141
- n("download", { event: d, file: t.file });
142
- }, w = () => {
143
- n("remove", t.file);
141
+ }, I = () => {
142
+ s("remove", t.file);
144
143
  }, b = () => {
145
- n("retry", t.file);
146
- }, g = (d, l) => {
147
- l.stopPropagation(), d.handler && d.handler(t.file), d.type === "preview" ? m() : d.type === "download" ? h(l) : n("action", { action: d, file: t.file });
144
+ s("retry", t.file);
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 });
148
147
  };
149
148
  return Y(() => {
150
- s.value.forEach((d) => {
151
- URL.revokeObjectURL(d);
152
- }), s.value = [];
149
+ n.value.forEach((l) => {
150
+ URL.revokeObjectURL(l);
151
+ }), n.value = [];
153
152
  }), {
154
- isImage: o,
155
- handlePreview: m,
156
- downloadFile: h,
157
- handleRemove: w,
153
+ isImage: u,
154
+ handlePreview: v,
155
+ downloadFile: g,
156
+ handleRemove: I,
158
157
  handleRetry: b,
159
- handleCustomAction: g
158
+ handleCustomAction: w
160
159
  };
161
160
  }
162
- 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__ */ D({
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({
163
162
  __name: "ImagePreview",
164
- props: /* @__PURE__ */ E({
163
+ props: /* @__PURE__ */ W({
165
164
  images: {}
166
165
  }, {
167
166
  currentIndex: { required: !0 },
168
167
  currentIndexModifiers: {}
169
168
  }),
170
- emits: /* @__PURE__ */ E(["close"], ["update:currentIndex"]),
171
- setup(t, { emit: n }) {
172
- const s = t, o = n, i = Z(t, "currentIndex"), m = I(() => s.images[i.value]), h = () => {
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 = () => {
173
172
  i.value > 0 && i.value--;
174
- }, w = () => {
175
- i.value < s.images.length - 1 && i.value++;
176
- }, b = (d) => {
177
- i.value = d;
173
+ }, I = () => {
174
+ i.value < n.images.length - 1 && i.value++;
175
+ }, b = (l) => {
176
+ i.value = l;
178
177
  };
179
- function g() {
180
- o("close");
178
+ function w() {
179
+ u("close");
181
180
  }
182
- return (d, l) => {
183
- var _, y;
184
- return r(), c("div", {
181
+ return (l, h) => {
182
+ var c, m;
183
+ return o(), d("div", {
185
184
  class: "tr-image-preview",
186
- onClick: M(g, ["self"])
185
+ onClick: P(w, ["self"])
187
186
  }, [
188
187
  p("button", {
189
188
  class: "tr-image-preview__close",
190
- onClick: g
189
+ onClick: w
191
190
  }, [
192
- F(f(ne))
191
+ F(f(se))
193
192
  ]),
194
193
  p("div", ue, [
195
194
  p("button", {
196
195
  class: "tr-image-preview__nav tr-image-preview__nav--left",
197
- onClick: M(h, ["stop"]),
196
+ onClick: P(g, ["stop"]),
198
197
  disabled: i.value === 0
199
198
  }, [
200
- F(f(re))
199
+ F(f(ae))
201
200
  ], 8, fe),
202
201
  p("div", pe, [
203
202
  p("img", {
204
- src: (_ = m.value) == null ? void 0 : _.url,
205
- alt: (y = m.value) == null ? void 0 : y.name,
203
+ src: (c = v.value) == null ? void 0 : c.url,
204
+ alt: (m = v.value) == null ? void 0 : m.name,
206
205
  class: "tr-image-preview__image"
207
206
  }, null, 8, me)
208
207
  ]),
209
208
  p("button", {
210
209
  class: "tr-image-preview__nav tr-image-preview__nav--right",
211
- onClick: M(w, ["stop"]),
212
- disabled: i.value === d.images.length - 1
210
+ onClick: P(I, ["stop"]),
211
+ disabled: i.value === l.images.length - 1
213
212
  }, [
214
213
  F(f(oe))
215
214
  ], 8, _e)
216
215
  ]),
217
216
  p("div", ve, [
218
217
  p("div", he, [
219
- (r(!0), c(L, null, A(d.images, (e, u) => (r(), c("div", {
218
+ (o(!0), d(z, null, D(l.images, (e, a) => (o(), d("div", {
220
219
  key: e.id,
221
- class: U(["tr-image-preview__thumbnail", { "tr-image-preview__thumbnail--active": u === i.value }]),
222
- onClick: (a) => b(u)
220
+ class: U(["tr-image-preview__thumbnail", { "tr-image-preview__thumbnail--active": a === i.value }]),
221
+ onClick: (r) => b(a)
223
222
  }, [
224
223
  p("img", {
225
224
  src: e.url,
226
225
  alt: e.name
227
- }, null, 8, ge)
228
- ], 10, ye))), 128))
226
+ }, null, 8, ye)
227
+ ], 10, ge))), 128))
229
228
  ])
230
229
  ])
231
230
  ]);
232
231
  };
233
232
  }
234
- }), be = /* @__PURE__ */ S(we, [["__scopeId", "data-v-027af77c"]]);
235
- function ke(t, n, s = {}) {
236
- const o = $(!1), i = $([]), m = $(0), h = (l) => {
237
- m.value = l;
238
- }, w = (l) => {
239
- const _ = t.value.findIndex((y) => y.id === l.id);
240
- if (_ !== -1 && l.url && t.value.splice(_, 1, l), l.fileType === "image") {
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") {
241
240
  i.value = t.value.filter(
242
- (e) => e.fileType === "image" && e.status !== "error" && e.status !== "uploading"
241
+ (a) => a.fileType === "image" && a.status !== "error" && a.status !== "uploading"
243
242
  );
244
- const y = i.value.findIndex((e) => e.id === l.id);
245
- y !== -1 && (m.value = y, o.value = !0);
246
- } else
247
- n("preview", l);
248
- }, b = () => {
249
- o.value = !1;
250
- }, g = (l) => {
251
- s.onDownload ? s.onDownload(l) : n("download", l);
243
+ const e = i.value.findIndex((a) => a.id === c.id);
244
+ e !== -1 && (v.value = e, u.value = !0);
245
+ }
246
+ }, b = (c, m) => {
247
+ s("preview", c, m), !c.defaultPrevented && I(m);
248
+ }, w = () => {
249
+ u.value = !1;
250
+ }, l = (c, m) => {
251
+ n.onDownload ? n.onDownload(c, m) : s("download", c, m);
252
252
  };
253
253
  return {
254
254
  // 显示预览
255
- handlePreview: w,
255
+ handlePreview: b,
256
256
  // 渲染预览组件
257
- renderPreview: () => o.value ? ee(be, {
257
+ renderPreview: () => u.value ? ee(Ie, {
258
258
  images: i.value,
259
- currentIndex: m.value,
260
- "onUpdate:currentIndex": h,
261
- onClose: b,
262
- onDownload: g
259
+ currentIndex: v.value,
260
+ "onUpdate:currentIndex": g,
261
+ onClose: w,
262
+ onDownload: l
263
263
  }) : null
264
264
  };
265
265
  }
266
- function Ce(t, n) {
266
+ function ke(t, s) {
267
267
  return {
268
- actualListType: I(() => n && n !== "auto" ? n : 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
- }, $e = {
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
- }, Pe = {
283
+ }, Ue = {
284
284
  key: 0,
285
285
  class: "tr-file-card__status-icon--loading-text"
286
- }, Be = {
286
+ }, Le = {
287
287
  key: 2,
288
288
  class: "tr-file-card__default-container"
289
- }, Re = { class: "tr-file-card__icon-wrapper" }, Te = {
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
- }, De = {
292
+ }, Ae = {
293
293
  key: 0,
294
294
  class: "tr-file-card__status-icon tr-file-card__status-icon--loading"
295
- }, Le = { class: "tr-file-card__content" }, Ae = { class: "tr-file-card__info" }, Se = ["title"], ze = {
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
- }, Ee = {
298
+ }, We = {
299
299
  key: 0,
300
300
  class: "tr-file-card__status-success"
301
- }, je = { 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
304
  }, Oe = {
305
305
  key: 0,
306
306
  class: "tr-file-card__actions"
307
- }, Ve = ["href", "target", "onClick"], He = ["onClick"], Xe = {
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
- }, Ke = /* @__PURE__ */ D({
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: n }) {
326
- const s = t, o = n, { formatFileSize: i, getIconComponent: m } = J({
327
- customIcons: s.fileIcons,
328
- fileMatchers: s.fileMatchers
329
- }), { isImage: h, handlePreview: w, handleRemove: b, handleCustomAction: g, handleRetry: d } = de(s, o), l = I(() => m(s.file.fileType).value), _ = I(() => s.file.status === "uploading"), y = I(() => s.file.status === "success"), e = I(() => s.file.status === "error"), u = 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
- "tr-file-card--uploading": _.value,
333
+ "tr-file-card--uploading": c.value,
334
334
  "tr-file-card--error": e.value,
335
- "tr-file-card--success": y.value
335
+ "tr-file-card--success": m.value
336
336
  }
337
337
  ]);
338
- return (a, v) => {
339
- var z;
340
- return r(), c("div", {
341
- class: U(u.value),
342
- "data-file-type": a.file.fileType || "other",
343
- onClick: v[3] || (v[3] = (k) => a.variant === "picture" ? f(w)() : void 0)
338
+ return (r, _) => {
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)
344
344
  }, [
345
- a.disabled ? C("", !0) : (r(), c("button", {
345
+ r.disabled ? k("", !0) : (o(), d("button", {
346
346
  key: 0,
347
347
  class: "tr-file-card__close-btn",
348
- onClick: v[0] || (v[0] = M(
348
+ onClick: _[0] || (_[0] = P(
349
349
  //@ts-ignore
350
- (...k) => f(b) && f(b)(...k),
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" ? (r(), c("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
- y.value ? (r(), c("div", Me, v[4] || (v[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
- _.value || e.value ? (r(), c("div", $e, [
367
- _.value ? (r(), c("div", Ue, [
365
+ ]))) : k("", !0),
366
+ c.value || e.value ? (o(), d("div", Me, [
367
+ c.value ? (o(), d("div", Re, [
368
368
  F(f(j)),
369
- a.file.message ? (r(), c("span", Pe, x(a.file.message), 1)) : C("", !0)
370
- ])) : e.value ? (r(), P(f(le), {
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
- ])) : (r(), c("div", Be, [
380
+ })) : k("", !0)
381
+ ])) : k("", !0)
382
+ ])) : (o(), d("div", Le, [
383
383
  p("div", {
384
- class: U(["tr-file-card__icon", { "tr-file-card__icon--clickable": f(h) }]),
385
- onClick: v[1] || (v[1] = M((k) => f(h) ? f(w)() : 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", Re, [
388
- (r(), P(O(l.value), { class: "tr-file-card__file-icon" })),
389
- _.value || e.value ? (r(), c("div", Te, [
390
- _.value ? (r(), c("div", De, [
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
391
  F(f(j))
392
- ])) : e.value ? (r(), P(f(W), {
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", Le, [
400
- p("div", Ae, [
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, Se),
405
- a.showStatus ? (r(), c("div", ze, [
406
- y.value ? (r(), c("div", Ee, [
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
407
  p("div", je, [
408
- p("span", We, x(((z = a.file.fileType) == null ? void 0 : z.toUpperCase()) || "FILE"), 1),
409
- a.file.size ? (r(), c("span", Ne, x(f(i)(a.file.size)), 1)) : C("", !0)
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 ? (r(), c("div", Oe, [
412
- (r(!0), c(L, null, A(a.actions, (k, Q) => (r(), c("div", {
413
- key: Q,
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
- k.type === "download" ? (r(), c("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: f(h) ? "_blank" : "_self",
421
- onClick: (R) => f(g)(k, R)
422
- }, x(k.label), 9, Ve)) : (r(), c("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: U(`tr-file-card__action-btn--${k.type}`),
425
- onClick: (R) => f(g)(k, R)
426
- }, x(k.label), 11, He))
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
- ])) : _.value ? (r(), c("div", Xe, v[5] || (v[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 ? (r(), c("div", qe, [
432
- v[6] || (v[6] = p("span", { class: "tr-file-card__error-text" }, "上传失败", -1)),
431
+ ]))) : e.value ? (o(), d("div", Ge, [
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
- onClick: v[2] || (v[2] = //@ts-ignore
436
- (...k) => f(d) && f(d)(...k))
435
+ onClick: _[2] || (_[2] = //@ts-ignore
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
- }), Ge = /* @__PURE__ */ S(Ke, [["__scopeId", "data-v-194fe961"]]), Je = { class: "tr-attachments" }, Qe = /* @__PURE__ */ D({
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,63 +464,63 @@ 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: n }) {
468
- const s = t, o = n, i = $(s.items || []), { actualListType: m } = Ce(i, s.variant), { handlePreview: h, renderPreview: w } = ke(i, o, { enableDownload: !0 });
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
469
  function b(e) {
470
- if (s.disabled) return;
471
- const u = i.value.findIndex((a) => a.id === e.id);
472
- u !== -1 && (i.value.splice(u, 1), o("remove", e), o("update:items", i.value));
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 g(e) {
475
- o("download", e);
476
- }
477
- function d(e) {
478
- o("retry", e);
474
+ function w(e, a) {
475
+ u("download", e, a);
479
476
  }
480
477
  function l(e) {
481
- o("action", e);
478
+ u("retry", e);
479
+ }
480
+ function h(e) {
481
+ u("action", e);
482
482
  }
483
- const _ = I(() => s.wrap ? "wrap" : "no-wrap"), { uploadAttachments: y } = J({
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
- e && e.length > 0 && (i.value = y(e));
489
+ e && e.length > 0 && (i.value = m(e));
490
490
  },
491
491
  { deep: !0, immediate: !0 }
492
- ), (e, u) => (r(), c("div", Je, [
493
- i.value.length > 0 ? (r(), c("div", {
492
+ ), (e, a) => (o(), d("div", Qe, [
493
+ i.value.length > 0 ? (o(), d("div", {
494
494
  key: 0,
495
- class: U(["tr-attachments__file-list", _.value]),
496
- onClick: u[0] || (u[0] = M(() => {
495
+ class: U(["tr-attachments__file-list", c.value]),
496
+ onClick: a[0] || (a[0] = P(() => {
497
497
  }, ["stop"]))
498
498
  }, [
499
- (r(!0), c(L, null, A(i.value, (a) => (r(), P(Ge, {
500
- key: a.id,
501
- file: a,
502
- variant: f(m),
499
+ (o(!0), d(z, null, D(i.value, (r) => (o(), L(Je, {
500
+ key: r.id,
501
+ file: r,
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
508
  onRemove: b,
509
- onPreview: f(h),
510
- onDownload: g,
511
- onRetry: d,
512
- onAction: l
509
+ onPreview: f(g),
510
+ onDownload: w,
511
+ onRetry: l,
512
+ onAction: h
513
513
  }, null, 8, ["file", "variant", "file-icons", "disabled", "actions", "file-matchers", "onPreview"]))), 128))
514
- ], 2)) : C("", !0),
515
- (r(), P(O(f(w)())))
514
+ ], 2)) : k("", !0),
515
+ (o(), L(O(f(I)())))
516
516
  ]));
517
517
  }
518
- }), B = /* @__PURE__ */ S(Qe, [["__scopeId", "data-v-3b44a028"]]);
519
- B.name = "TrAttachments";
518
+ }), $ = /* @__PURE__ */ S(Xe, [["__scopeId", "data-v-e09559ac"]]);
519
+ $.name = "TrAttachments";
520
520
  const Ye = function(t) {
521
- t.component(B.name, B);
521
+ t.component($.name, $);
522
522
  };
523
- B.install = Ye;
523
+ $.install = Ye;
524
524
  export {
525
- B as default
525
+ $ as default
526
526
  };