@orchidui/core 1.103.0 → 1.104.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,23 +1,23 @@
1
1
  import { ref as p } from "vue";
2
- const g = (u, n) => {
2
+ const E = (u, n) => {
3
3
  const d = n.split(","), f = u.name.split(".").pop().toLowerCase();
4
4
  return d.find((t) => t.includes(f));
5
5
  }, h = (u, n, d, f = !1) => {
6
- const t = p([]), c = p(!1), v = (l, o = !1) => {
7
- const e = [...l.target.files].filter((a) => {
8
- const s = !t.value.some((i) => i.fileName === a.name);
6
+ const t = p([]), c = p(!1), v = (l, a = !1) => {
7
+ const e = [...l.target.files].filter((o) => {
8
+ const s = !t.value.some((i) => i.fileName === o.name);
9
9
  if (s || n("fileExist"), f) {
10
- const i = g(a, d);
10
+ const i = E(o, d);
11
11
  return i || n("invalidFileType"), s && i;
12
12
  } else
13
13
  return s;
14
14
  });
15
- if (c.value = e.reduce((a, s) => a + s.size, 0) > u * 1024 * 1024, c.value) {
15
+ if (l.target && (l.target.value = ""), c.value = e.reduce((o, s) => o + s.size, 0) > u * 1024 * 1024, c.value) {
16
16
  n("onExceedMaxFileSize", e);
17
17
  return;
18
18
  }
19
- for (let a = 0; a < e.length; a++) {
20
- const s = e[a], i = new FileReader();
19
+ for (let o = 0; o < e.length; o++) {
20
+ const s = e[o], i = new FileReader();
21
21
  new FormData().append("file", s), t.value.unshift({
22
22
  file: s,
23
23
  fileName: s.name,
@@ -27,17 +27,17 @@ const g = (u, n) => {
27
27
  totalSize: 0,
28
28
  isLoaded: !1,
29
29
  extension: s.name.split(".").at(-1) || "png"
30
- }), n("update:modelValue", o ? t.value[0] : t.value), s && (F(i, a), i.readAsDataURL(s));
30
+ }), n("update:modelValue", a ? t.value[0] : t.value), s && (F(i, o), i.readAsDataURL(s));
31
31
  }
32
- }, r = (l, o, e) => {
32
+ }, r = (l, a, e) => {
33
33
  if (!l.type) return;
34
- const a = () => {
34
+ const o = () => {
35
35
  t.value[e].totalSize = l.total;
36
36
  }, s = () => {
37
- t.value[e].fileUrl = o.result, t.value[e].isLoaded = !0;
37
+ t.value[e].fileUrl = a.result, t.value[e].isLoaded = !0;
38
38
  };
39
39
  ({
40
- loadstart: a,
40
+ loadstart: o,
41
41
  loadend: s,
42
42
  load: s,
43
43
  progress: () => {
@@ -46,16 +46,16 @@ const g = (u, n) => {
46
46
  );
47
47
  }
48
48
  })[l.type]();
49
- }, F = (l, o) => {
50
- l.addEventListener("loadstart", (e) => r(e, l, o)), l.addEventListener("load", (e) => r(e, l, o)), l.addEventListener("loadend", (e) => r(e, l, o)), l.addEventListener("progress", (e) => r(e, l, o)), l.addEventListener("error", (e) => r(e, l, o)), l.addEventListener("abort", (e) => r(e, l, o));
49
+ }, F = (l, a) => {
50
+ l.addEventListener("loadstart", (e) => r(e, l, a)), l.addEventListener("load", (e) => r(e, l, a)), l.addEventListener("loadend", (e) => r(e, l, a)), l.addEventListener("progress", (e) => r(e, l, a)), l.addEventListener("error", (e) => r(e, l, a)), l.addEventListener("abort", (e) => r(e, l, a));
51
51
  };
52
52
  return {
53
53
  isErrorMaxSize: c,
54
54
  currentFiles: t,
55
55
  onChangeFile: v,
56
56
  onDeleteFile: (l) => {
57
- let o = t.value.find((e, a) => a === l);
58
- t.value = t.value.filter((e) => e !== o), n("onRemoveFile", o), n("update:modelValue", t.value.length > 0 ? t.value : null);
57
+ let a = t.value.find((e, o) => o === l);
58
+ t.value = t.value.filter((e) => e !== a), n("onRemoveFile", a), n("update:modelValue", t.value.length > 0 ? t.value : null);
59
59
  }
60
60
  };
61
61
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orchidui/core",
3
3
  "description": "Orchid UI, Library Vue 3 tailwind css",
4
- "version": "1.103.0",
4
+ "version": "1.104.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "vite build"