@opentiny/tiny-robot 0.3.0-alpha.13 → 0.3.0-alpha.15

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 { defineComponent as $, useSlots as H, computed as i, ref as f, watch as T, nextTick as W, createElementBlock as _, openBlock as o, createBlock as v, createCommentVNode as R, Fragment as G, renderList as I, unref as h, withCtx as S, createElementVNode as w, resolveDynamicComponent as x, renderSlot as L, createVNode as E, Transition as j, withDirectives as q, normalizeClass as J, withModifiers as K, toDisplayString as Q, vShow as U } from "vue";
2
- import { N as Y } from "../tiny-robot-svgs.js";
1
+ import { defineComponent as $, useSlots as H, computed as i, ref as f, watch as T, nextTick as W, createElementBlock as _, openBlock as o, createBlock as v, createCommentVNode as N, Fragment as G, renderList as I, unref as h, withCtx as S, createElementVNode as w, resolveDynamicComponent as x, renderSlot as L, createVNode as E, Transition as j, withDirectives as q, normalizeClass as J, withModifiers as K, toDisplayString as Q, vShow as U } from "vue";
2
+ import { R as Y } from "../tiny-robot-svgs.js";
3
3
  import { T as M } from "../index2.js";
4
4
  import { o as Z, c as ee } from "../index3.js";
5
5
  import te from "../icon-button/index.js";
@@ -32,7 +32,7 @@ const ne = { class: "tr-action-group" }, re = ["onClick"], le = ["onClick"], ae
32
32
  );
33
33
  const A = (e) => {
34
34
  O("item-click", e), n.value = !1;
35
- }, B = f("placement-bottom"), { height: D } = ee(), N = () => {
35
+ }, B = f("placement-bottom"), { height: D } = ee(), R = () => {
36
36
  if (!d.value || !m.value)
37
37
  return "placement-bottom";
38
38
  const e = d.value.getBoundingClientRect(), a = m.value.getBoundingClientRect();
@@ -40,10 +40,10 @@ const ne = { class: "tr-action-group" }, re = ["onClick"], le = ["onClick"], ae
40
40
  };
41
41
  return T(n, (e) => {
42
42
  e && W(() => {
43
- N();
43
+ R();
44
44
  });
45
45
  }), T(D, () => {
46
- n.value && N();
46
+ n.value && R();
47
47
  }), (e, a) => (o(), _("div", ne, [
48
48
  (o(!0), _(G, null, I(V.value, (t, C) => {
49
49
  var c;
@@ -104,7 +104,7 @@ const ne = { class: "tr-action-group" }, re = ["onClick"], le = ["onClick"], ae
104
104
  return A((s = t.props) == null ? void 0 : s.name);
105
105
  }, ["stop"])
106
106
  }, [
107
- l.dropDownShowLabelOnly ? R("", !0) : (o(), v(x(t), { key: 0 })),
107
+ l.dropDownShowLabelOnly ? N("", !0) : (o(), v(x(t), { key: 0 })),
108
108
  w("span", ae, Q((c = t.props) == null ? void 0 : c.label), 1)
109
109
  ], 8, le);
110
110
  }), 128))
@@ -117,7 +117,7 @@ const ne = { class: "tr-action-group" }, re = ["onClick"], le = ["onClick"], ae
117
117
  ], 512)
118
118
  ]),
119
119
  _: 3
120
- }, 8, ["disabled"])) : R("", !0)
120
+ }, 8, ["disabled"])) : N("", !0)
121
121
  ]));
122
122
  }
123
123
  }), g = /* @__PURE__ */ oe(ce, [["__scopeId", "data-v-f8531261"]]), u = /* @__PURE__ */ $({
@@ -1,16 +1,16 @@
1
- import { computed as I, ref as U, onUnmounted as Y, defineComponent as B, mergeModels as j, useModel as Z, createElementBlock as d, openBlock as o, withModifiers as P, 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 N, watch as se } from "vue";
2
- import { m as ae, h as V, O as q, L as X, x as K, P as G, z as H, c as re, l as ne, o as oe, X as ie, k as E, F as O } from "../tiny-robot-svgs.js";
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";
3
3
  import { _ as S } from "../_plugin-vue_export-helper.js";
4
4
  import { T as le } from "../index2.js";
5
- const z = {
6
- image: H,
7
- pdf: G,
8
- word: K,
9
- excel: X,
5
+ const B = {
6
+ image: Z,
7
+ pdf: Y,
8
+ word: Q,
9
+ excel: H,
10
10
  ppt: q,
11
- folder: V,
11
+ folder: O,
12
12
  other: ae
13
- }, W = [
13
+ }, N = [
14
14
  {
15
15
  type: "image",
16
16
  matcher: (t) => {
@@ -20,12 +20,12 @@ const z = {
20
20
  const r = ((u = t.split(".").pop()) == null ? void 0 : u.toLowerCase()) || "";
21
21
  return ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"].includes(r);
22
22
  },
23
- icon: H
23
+ icon: Z
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: G
28
+ icon: Y
29
29
  },
30
30
  {
31
31
  type: "word",
@@ -36,7 +36,7 @@ const z = {
36
36
  const r = ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "";
37
37
  return ["doc", "docx"].includes(r);
38
38
  },
39
- icon: K
39
+ icon: Q
40
40
  },
41
41
  {
42
42
  type: "excel",
@@ -47,7 +47,7 @@ const z = {
47
47
  const r = ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "";
48
48
  return ["xls", "xlsx"].includes(r);
49
49
  },
50
- icon: X
50
+ icon: H
51
51
  },
52
52
  {
53
53
  type: "ppt",
@@ -63,18 +63,18 @@ const z = {
63
63
  {
64
64
  type: "folder",
65
65
  matcher: (t) => typeof t != "string" ? !1 : t.toLowerCase().endsWith("folder"),
66
- icon: V
66
+ icon: O
67
67
  }
68
68
  ];
69
- function J(t = {}) {
69
+ function K(t = {}) {
70
70
  const { customIcons: r, fileMatchers: s } = t, u = () => {
71
71
  let e = [];
72
- return s ? e = s.concat(W) : e = W, e;
72
+ return s ? e = s.concat(N) : e = N, e;
73
73
  }, i = (e = "other") => I(() => {
74
74
  if (r != null && r[e])
75
75
  return r[e];
76
76
  const a = u().find((_) => _.type === e);
77
- return a != null && a.icon ? a.icon : z[e] ? z[e] : z.other;
77
+ return a != null && a.icon ? a.icon : B[e] ? B[e] : B.other;
78
78
  }), v = (e) => {
79
79
  const n = u();
80
80
  for (const a of n)
@@ -92,11 +92,11 @@ function J(t = {}) {
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, M = a.split("/").pop() || "";
95
+ const n = h(e), a = e.url, _ = e.size, P = a.split("/").pop() || "";
96
96
  return {
97
97
  ...n,
98
- name: n.name || M,
99
- fileType: v(M),
98
+ name: n.name || P,
99
+ fileType: v(P),
100
100
  size: _,
101
101
  url: a
102
102
  };
@@ -145,7 +145,7 @@ function de(t, r) {
145
145
  }, w = (l, h) => {
146
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 });
147
147
  };
148
- return Y(() => {
148
+ return J(() => {
149
149
  s.value.forEach((l) => {
150
150
  URL.revokeObjectURL(l);
151
151
  }), s.value = [];
@@ -158,7 +158,7 @@ function de(t, r) {
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__ */ B({
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({
162
162
  __name: "ImagePreview",
163
163
  props: /* @__PURE__ */ j({
164
164
  images: {}
@@ -168,7 +168,7 @@ const ue = { class: "tr-image-preview__main" }, fe = ["disabled"], pe = { class:
168
168
  }),
169
169
  emits: /* @__PURE__ */ j(["close"], ["update:currentIndex"]),
170
170
  setup(t, { emit: r }) {
171
- const s = t, u = r, i = Z(t, "currentIndex"), v = I(() => s.images[i.value]), y = () => {
171
+ const s = t, u = r, i = X(t, "currentIndex"), v = I(() => s.images[i.value]), y = () => {
172
172
  i.value > 0 && i.value--;
173
173
  }, b = () => {
174
174
  i.value < s.images.length - 1 && i.value++;
@@ -182,7 +182,7 @@ 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: P(w, ["self"])
185
+ onClick: M(w, ["self"])
186
186
  }, [
187
187
  p("button", {
188
188
  class: "tr-image-preview__close",
@@ -193,7 +193,7 @@ const ue = { class: "tr-image-preview__main" }, fe = ["disabled"], pe = { class:
193
193
  p("div", ue, [
194
194
  p("button", {
195
195
  class: "tr-image-preview__nav tr-image-preview__nav--left",
196
- onClick: P(y, ["stop"]),
196
+ onClick: M(y, ["stop"]),
197
197
  disabled: i.value === 0
198
198
  }, [
199
199
  F(f(ne))
@@ -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: P(b, ["stop"]),
210
+ onClick: M(b, ["stop"]),
211
211
  disabled: i.value === l.images.length - 1
212
212
  }, [
213
213
  F(f(oe))
@@ -271,10 +271,10 @@ function Ce(t, r) {
271
271
  const Ie = ["data-file-type"], Fe = {
272
272
  key: 1,
273
273
  class: "tr-file-card__picture-container"
274
- }, xe = ["src", "alt"], Pe = {
274
+ }, xe = ["src", "alt"], Me = {
275
275
  key: 0,
276
276
  class: "tr-file-card__picture-overlay"
277
- }, Me = {
277
+ }, Pe = {
278
278
  key: 1,
279
279
  class: "tr-file-card__status-overlay tr-file-card__status-overlay--picture"
280
280
  }, Ue = {
@@ -286,31 +286,31 @@ const Ie = ["data-file-type"], Fe = {
286
286
  }, Re = {
287
287
  key: 2,
288
288
  class: "tr-file-card__default-container"
289
- }, $e = { class: "tr-file-card__icon-wrapper" }, Te = {
289
+ }, Te = { class: "tr-file-card__icon-wrapper" }, $e = {
290
290
  key: 0,
291
291
  class: "tr-file-card__status-overlay tr-file-card__status-overlay--icon"
292
- }, ze = {
292
+ }, Be = {
293
293
  key: 0,
294
294
  class: "tr-file-card__status-icon tr-file-card__status-icon--loading"
295
- }, Be = { class: "tr-file-card__content" }, De = { class: "tr-file-card__info" }, Ae = ["title"], Se = {
295
+ }, ze = { class: "tr-file-card__content" }, De = { class: "tr-file-card__info" }, Ae = ["title"], Se = {
296
296
  key: 0,
297
297
  class: "tr-file-card__status"
298
298
  }, je = {
299
299
  key: 0,
300
300
  class: "tr-file-card__status-success"
301
- }, Ee = { class: "tr-file-card__status-info" }, Oe = { class: "tr-file-card__file-type" }, We = {
301
+ }, Ee = { class: "tr-file-card__status-info" }, We = { class: "tr-file-card__file-type" }, Ne = {
302
302
  key: 0,
303
303
  class: "tr-file-card__file-size"
304
- }, Ne = {
304
+ }, Ve = {
305
305
  key: 0,
306
306
  class: "tr-file-card__actions"
307
- }, Ve = ["href", "target", "onClick"], qe = ["onClick"], Xe = {
307
+ }, Oe = ["href", "target", "onClick"], qe = ["onClick"], He = {
308
308
  key: 1,
309
309
  class: "tr-file-card__status-uploading"
310
- }, Ke = {
310
+ }, Qe = {
311
311
  key: 2,
312
312
  class: "tr-file-card__status-error"
313
- }, Ge = /* @__PURE__ */ B({
313
+ }, Ye = /* @__PURE__ */ z({
314
314
  __name: "FileCard",
315
315
  props: {
316
316
  file: {},
@@ -323,7 +323,7 @@ const Ie = ["data-file-type"], Fe = {
323
323
  },
324
324
  emits: ["remove", "preview", "action", "retry", "download"],
325
325
  setup(t, { emit: r }) {
326
- const s = t, u = r, { formatFileSize: i, getIconComponent: v } = J({
326
+ const s = t, u = r, { formatFileSize: i, getIconComponent: v } = K({
327
327
  customIcons: s.fileIcons,
328
328
  fileMatchers: s.fileMatchers
329
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(() => [
@@ -336,7 +336,7 @@ const Ie = ["data-file-type"], Fe = {
336
336
  }
337
337
  ]);
338
338
  return (a, _) => {
339
- var M;
339
+ var P;
340
340
  return o(), d("div", {
341
341
  class: L(n.value),
342
342
  "data-file-type": a.file.fileType || "other",
@@ -345,7 +345,7 @@ const Ie = ["data-file-type"], Fe = {
345
345
  a.disabled ? C("", !0) : (o(), d("button", {
346
346
  key: 0,
347
347
  class: "tr-file-card__close-btn",
348
- onClick: _[0] || (_[0] = P(
348
+ onClick: _[0] || (_[0] = M(
349
349
  //@ts-ignore
350
350
  (...g) => f(k) && f(k)(...g),
351
351
  ["stop"]
@@ -360,10 +360,10 @@ const Ie = ["data-file-type"], Fe = {
360
360
  alt: a.file.name,
361
361
  class: "tr-file-card__picture-img"
362
362
  }, null, 8, xe),
363
- m.value ? (o(), d("div", Pe, _[4] || (_[4] = [
363
+ m.value ? (o(), d("div", Me, _[4] || (_[4] = [
364
364
  p("span", { class: "tr-file-card__picture-overlay-text" }, "预览", -1)
365
365
  ]))) : C("", !0),
366
- c.value || e.value ? (o(), d("div", Me, [
366
+ c.value || e.value ? (o(), d("div", Pe, [
367
367
  c.value ? (o(), d("div", Ue, [
368
368
  F(f(E)),
369
369
  a.file.message ? (o(), d("span", Le, x(a.file.message), 1)) : C("", !0)
@@ -374,7 +374,7 @@ const Ie = ["data-file-type"], Fe = {
374
374
  effect: "light"
375
375
  }, {
376
376
  default: te(() => [
377
- F(f(O), { class: "tr-file-card__status-icon tr-file-card__status-icon--error" })
377
+ F(f(W), { class: "tr-file-card__status-icon tr-file-card__status-icon--error" })
378
378
  ]),
379
379
  _: 1
380
380
  })) : C("", !0)
@@ -382,21 +382,21 @@ const Ie = ["data-file-type"], Fe = {
382
382
  ])) : (o(), d("div", Re, [
383
383
  p("div", {
384
384
  class: L(["tr-file-card__icon", { "tr-file-card__icon--clickable": f(y) }]),
385
- onClick: _[1] || (_[1] = P((g) => f(y) ? f(b)(g) : null, ["stop"]))
385
+ onClick: _[1] || (_[1] = M((g) => f(y) ? f(b)(g) : null, ["stop"]))
386
386
  }, [
387
- p("div", $e, [
388
- (o(), R(N(h.value), { class: "tr-file-card__file-icon" })),
389
- c.value || e.value ? (o(), d("div", Te, [
390
- c.value ? (o(), d("div", ze, [
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
391
  F(f(E))
392
- ])) : e.value ? (o(), R(f(O), {
392
+ ])) : e.value ? (o(), R(f(W), {
393
393
  key: 1,
394
394
  class: "tr-file-card__status-icon tr-file-card__status-icon--error"
395
395
  })) : C("", !0)
396
396
  ])) : C("", !0)
397
397
  ])
398
398
  ], 2),
399
- p("div", Be, [
399
+ p("div", ze, [
400
400
  p("div", De, [
401
401
  p("div", {
402
402
  class: "tr-file-card__name",
@@ -405,12 +405,12 @@ const Ie = ["data-file-type"], Fe = {
405
405
  a.showStatus ? (o(), d("div", Se, [
406
406
  m.value ? (o(), d("div", je, [
407
407
  p("div", Ee, [
408
- p("span", Oe, x(((M = a.file.fileType) == null ? void 0 : M.toUpperCase()) || "FILE"), 1),
409
- a.file.size ? (o(), d("span", We, x(f(i)(a.file.size)), 1)) : C("", !0)
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)
410
410
  ]),
411
- a.actions ? (o(), d("div", Ne, [
412
- (o(!0), d(D, null, A(a.actions, (g, Q) => (o(), d("div", {
413
- key: Q,
411
+ a.actions ? (o(), d("div", Ve, [
412
+ (o(!0), d(D, null, A(a.actions, (g, G) => (o(), d("div", {
413
+ key: G,
414
414
  class: "tr-file-card__action-btn"
415
415
  }, [
416
416
  g.type === "download" ? (o(), d("a", {
@@ -418,17 +418,17 @@ const Ie = ["data-file-type"], Fe = {
418
418
  class: "tr-file-card__action-btn--download",
419
419
  href: a.file.url ?? "javascript:void(0)",
420
420
  target: a.file.url ? "_blank" : "_self",
421
- onClick: (T) => f(w)(g, T)
422
- }, x(g.label), 9, Ve)) : (o(), d("button", {
421
+ onClick: ($) => f(w)(g, $)
422
+ }, x(g.label), 9, Oe)) : (o(), d("button", {
423
423
  key: 1,
424
424
  class: L(`tr-file-card__action-btn--${g.type}`),
425
- onClick: (T) => f(w)(g, T)
425
+ onClick: ($) => f(w)(g, $)
426
426
  }, x(g.label), 11, qe))
427
427
  ]))), 128))
428
428
  ])) : C("", !0)
429
- ])) : c.value ? (o(), d("div", Xe, _[5] || (_[5] = [
429
+ ])) : c.value ? (o(), d("div", He, _[5] || (_[5] = [
430
430
  p("span", { class: "tr-file-card__uploading-text" }, "上传中...", -1)
431
- ]))) : e.value ? (o(), d("div", Ke, [
431
+ ]))) : e.value ? (o(), d("div", Qe, [
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",
@@ -443,7 +443,7 @@ const Ie = ["data-file-type"], Fe = {
443
443
  ], 10, Ie);
444
444
  };
445
445
  }
446
- }), He = /* @__PURE__ */ S(Ge, [["__scopeId", "data-v-06df896e"]]), Je = { class: "tr-attachments" }, Qe = /* @__PURE__ */ B({
446
+ }), Ze = /* @__PURE__ */ S(Ye, [["__scopeId", "data-v-06df896e"]]), Ke = { class: "tr-attachments" }, Ge = /* @__PURE__ */ z({
447
447
  __name: "index",
448
448
  props: {
449
449
  items: {},
@@ -480,7 +480,7 @@ 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 } = J({
483
+ const c = I(() => s.wrap ? "wrap" : "no-wrap"), { normalizeAttachments: m } = K({
484
484
  fileMatchers: s.fileMatchers
485
485
  });
486
486
  return se(
@@ -489,14 +489,14 @@ const Ie = ["data-file-type"], Fe = {
489
489
  e && e.length > 0 && (i.value = m(e));
490
490
  },
491
491
  { deep: !0, immediate: !0 }
492
- ), (e, n) => (o(), d("div", Je, [
492
+ ), (e, n) => (o(), d("div", Ke, [
493
493
  i.value.length > 0 ? (o(), d("div", {
494
494
  key: 0,
495
495
  class: L(["tr-attachments__file-list", c.value]),
496
- onClick: n[0] || (n[0] = P(() => {
496
+ onClick: n[0] || (n[0] = M(() => {
497
497
  }, ["stop"]))
498
498
  }, [
499
- (o(!0), d(D, null, A(i.value, (a) => (o(), R(He, {
499
+ (o(!0), d(D, null, A(i.value, (a) => (o(), R(Ze, {
500
500
  key: a.id,
501
501
  file: a,
502
502
  variant: f(v),
@@ -512,15 +512,15 @@ const Ie = ["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)) : C("", !0),
515
- (o(), R(N(f(b)())))
515
+ (o(), R(V(f(b)())))
516
516
  ]));
517
517
  }
518
- }), $ = /* @__PURE__ */ S(Qe, [["__scopeId", "data-v-e09559ac"]]);
519
- $.name = "TrAttachments";
520
- const Ye = function(t) {
521
- t.component($.name, $);
518
+ }), T = /* @__PURE__ */ S(Ge, [["__scopeId", "data-v-e09559ac"]]);
519
+ T.name = "TrAttachments";
520
+ const Je = function(t) {
521
+ t.component(T.name, T);
522
522
  };
523
- $.install = Ye;
523
+ T.install = Je;
524
524
  export {
525
- $ as default
525
+ T as default
526
526
  };