@duxweb/dvha-core 0.1.13 → 0.1.14

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 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Q=require("@vueuse/core"),R=require("lodash-es"),u=require("vue"),V=require("./upload/local.cjs");function W(l){const v=u.ref(!1),i=u.ref([]),d=u.ref(-1),f=u.ref(new Map),P=l.driver||V.createLocalUploadDriver(),A=u.computed(()=>{const{onProgress:e,onDataCallback:n,onCancel:a,onComplete:t,maxFileSize:c,maxFileCount:o,accept:s,multiple:r,autoUpload:m,options:S,onSuccess:U,onError:F,method:X,driver:Y,...J}=l;return J}),$=u.computed(()=>l.method||"POST"),b=u.computed(()=>{const e=i.value.length,n=i.value.reduce((o,s)=>o+(s.filesize||0),0);let a=0,t=0;return i.value.forEach((o,s)=>{var r;s<d.value?a+=o.filesize||0:s===d.value&&(a+=((r=o.progress)==null?void 0:r.loaded)||0)}),n>0&&(t=Math.round(a/n*100)),{index:d.value>=0?d.value+1:0,totalFiles:e,currentFile:i.value[d.value],totalPercent:t,totalLoaded:a,totalSize:n}}),w=e=>{if(e===0)return"0 Bytes";const n=1024,a=["Bytes","KB","MB","GB"],t=Math.floor(Math.log(e)/Math.log(n));return`${Number.parseFloat((e/n**t).toFixed(2))} ${a[t]}`},h=e=>{if(e===0)return"0 B/s";const n=1024,a=["B/s","KB/s","MB/s","GB/s"],t=Math.floor(Math.log(e)/Math.log(n));return`${Number.parseFloat((e/n**t).toFixed(2))} ${a[t]}`},x=()=>R.uniqueId("upload-"),I=async(e,n,a)=>{switch(n){case"file":{if(!(e instanceof File))throw new TypeError('Payload must be a File when type is "file"');return e}case"blob":{if(!(e instanceof Blob))throw new TypeError('Payload must be a Blob when type is "blob"');return new File([e],"blob-file",{type:e.type})}case"base64":{if(typeof e!="string")throw new TypeError('Payload must be a string when type is "base64"');const t=e.includes(",")?e.split(",")[1]:e,c=e.includes(",")?e.split(",")[0].split(":")[1].split(";")[0]:"application/octet-stream",o=atob(t),s=new Uint8Array(o.length);for(let m=0;m<o.length;m++)s[m]=o.charCodeAt(m);const r=new Blob([s],{type:c});return new File([r],"base64-file",{type:c})}case"arrayBuffer":{if(!(e instanceof ArrayBuffer))throw new TypeError('Payload must be ArrayBuffer when type is "arrayBuffer"');const t=new Blob([e]);return new File([t],"array-buffer-file",{type:"application/octet-stream"})}default:throw new Error(`Unsupported upload type: ${n}`)}},T=e=>{if(l.maxFileSize&&e.size>l.maxFileSize)throw new Error(`File size cannot exceed ${w(l.maxFileSize)}`);if(l.maxFileCount&&i.value.length>=l.maxFileCount)throw new Error(`File count cannot exceed ${l.maxFileCount}`)},k=async(e,n,a)=>{const t=await I(e,n);T(t);const c={id:x(),file:t,filename:t.name,filesize:t.size,filetype:t.type,filesizeText:w(t.size),status:"pending",progress:{loaded:0,total:t.size,percent:0,speed:0,speedText:h(0),remainingTime:0,uploadTime:0}};return i.value.push(c),c},g=(e,n)=>{const a=i.value.findIndex(t=>t.id===e);a!==-1&&(i.value[a]={...i.value[a],...n})},z=()=>{var n;i.value.every(a=>a.status!=="uploading")&&((n=l.onComplete)==null||n.call(l,i.value))},y=e=>{var a;const n=i.value.find(t=>t.id===e);if(!n||n.status!=="pending"&&n.status!=="uploading")return!1;if(n.status==="uploading"){const t=f.value.get(e);t&&(t.abort(),f.value.delete(e))}return g(e,{status:"cancelled"}),(a=l.onCancel)==null||a.call(l,e),z(),!0},q=e=>{e?e.forEach(n=>y(n)):i.value.forEach(n=>y(n.id))},D=async e=>{if(!e.file)throw new Error("File not found");T(e.file);const n=new AbortController;f.value.set(e.id,n);const a=Date.now();g(e.id,{status:"uploading"}),await P.upload(e.file,{...A.value,method:$.value,signal:n.signal,onUploadProgress:t=>{var F;const s=(Date.now()-a)/1e3,r=s>0?t.loaded/s:0,m=(t.total||0)-t.loaded,S=r>0?m/r:0,U={loaded:t.loaded,total:t.total,percent:t.percent||0,speed:Math.round(r),speedText:h(r),uploadTime:Math.round(s),remainingTime:Math.round(S)};g(e.id,{status:"uploading",progress:U}),(F=l.onProgress)==null||F.call(l,b.value)}}).then(t=>{var s,r;if(e.status==="cancelled")return;const c=((s=l.onDataCallback)==null?void 0:s.call(l,t,e))||{},o=Math.round((Date.now()-a)/1e3);g(e.id,{status:"success",data:t,...c,progress:{...e.progress,loaded:e.filesize||0,percent:100,speed:0,speedText:h(0),uploadTime:o,remainingTime:0}}),f.value.delete(e.id),(r=l.onSuccess)==null||r.call(l,t)}).catch(t=>{if(!(t.message==="canceled"||e.status==="cancelled"))throw g(e.id,{status:"error",error:t.message}),f.value.delete(e.id),t}).finally(()=>{z()})},C=async()=>{var n;const e=i.value.filter(a=>a.status==="pending");if(e.length!==0){v.value=!0;try{for(let a=0;a<e.length;a++){const t=e[a],c=i.value.findIndex(o=>o.id===t.id);d.value=c,await D(t)}}catch(a){throw(n=l.onError)==null||n.call(l,{status:(a==null?void 0:a.status)||500,message:(a==null?void 0:a.message)||"upload failed"}),a}finally{v.value=!1,d.value=-1}}},B=async(e,n="file")=>{var a;try{if(l.maxFileCount&&i.value.length+e.length>l.maxFileCount)throw new Error(`Adding ${e.length} files would exceed the maximum limit of ${l.maxFileCount}`);for(const t of e)await k(t,n)}catch(t){throw(a=l.onError)==null||a.call(l,{status:(t==null?void 0:t.status)||400,message:(t==null?void 0:t.message)||"Failed to add files"}),t}l.autoUpload&&C()},G=e=>{const n=e.map(a=>j(a));i.value.push(...n)},K=()=>{i.value.forEach(e=>{y(e.id)}),f.value.clear(),i.value=[],d.value=-1},E=e=>{const n=i.value.find(t=>t.id===e);if(n&&n.status==="uploading"){g(e,{status:"cancelled"});const t=f.value.get(e);if(!t)return;t.abort(),f.value.delete(e)}const a=i.value.findIndex(t=>t.id===e);a!==-1&&i.value.splice(a,1)},L=e=>{e?e.forEach(n=>E(n)):i.value.forEach(n=>E(n.id))},{files:N,open:O,reset:M}=Q.useFileDialog({accept:l.accept,multiple:l.multiple||!1}),j=e=>({id:x(),...e,filesizeText:e.filesize?w(e.filesize):void 0,status:e.url?"success":"pending",progress:{loaded:0,total:e.filesize||0,percent:e.url?100:0,speed:0,speedText:h(0),remainingTime:0,uploadTime:0}});u.watch(N,async e=>{if(e&&e.length>0){const n=Array.from(e);M(),await B(n,"file").catch(a=>{console.warn("Failed to add selected files:",a)})}});const H=u.computed(()=>i.value.filter(e=>e.status==="success").map(e=>({url:e.url,filename:e.filename,filesize:e.filesize,filetype:e.filetype})));return{isUploading:v,uploadFiles:i,dataFiles:H,progress:b,open:O,trigger:C,resetFiles:M,clearFiles:K,removeFiles:L,addFiles:B,addDataFiles:G,cancelFiles:q}}exports.useUpload=W;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Q=require("@vueuse/core"),R=require("lodash-es"),u=require("vue"),V=require("./upload/local.cjs");function W(l){const v=u.ref(!1),i=u.ref([]),d=u.ref(-1),f=u.ref(new Map),A=l.driver||V.createLocalUploadDriver(),$=u.computed(()=>{const{onProgress:e,onDataCallback:n,onCancel:a,onComplete:t,maxFileSize:c,maxFileCount:o,accept:s,multiple:r,autoUpload:m,options:U,onSuccess:P,onError:F,method:X,driver:Y,...J}=l;return J}),I=u.computed(()=>l.method||"POST"),b=u.computed(()=>{const e=i.value.length,n=i.value.reduce((o,s)=>o+(s.filesize||0),0);let a=0,t=0;return i.value.forEach((o,s)=>{var r;s<d.value?a+=o.filesize||0:s===d.value&&(a+=((r=o.progress)==null?void 0:r.loaded)||0)}),n>0&&(t=Math.round(a/n*100)),{index:d.value>=0?d.value+1:0,totalFiles:e,currentFile:i.value[d.value],totalPercent:t,totalLoaded:a,totalSize:n}}),w=e=>{if(e===0)return"0 Bytes";const n=1024,a=["Bytes","KB","MB","GB"],t=Math.floor(Math.log(e)/Math.log(n));return`${Number.parseFloat((e/n**t).toFixed(2))} ${a[t]}`},h=e=>{if(e===0)return"0 B/s";const n=1024,a=["B/s","KB/s","MB/s","GB/s"],t=Math.floor(Math.log(e)/Math.log(n));return`${Number.parseFloat((e/n**t).toFixed(2))} ${a[t]}`},x=()=>R.uniqueId("upload-"),k=async(e,n,a)=>{switch(n){case"file":{if(!(e instanceof File))throw new TypeError('Payload must be a File when type is "file"');return e}case"blob":{if(!(e instanceof Blob))throw new TypeError('Payload must be a Blob when type is "blob"');return new File([e],"blob-file",{type:e.type})}case"base64":{if(typeof e!="string")throw new TypeError('Payload must be a string when type is "base64"');const t=e.includes(",")?e.split(",")[1]:e,c=e.includes(",")?e.split(",")[0].split(":")[1].split(";")[0]:"application/octet-stream",o=atob(t),s=new Uint8Array(o.length);for(let m=0;m<o.length;m++)s[m]=o.charCodeAt(m);const r=new Blob([s],{type:c});return new File([r],"base64-file",{type:c})}case"arrayBuffer":{if(!(e instanceof ArrayBuffer))throw new TypeError('Payload must be ArrayBuffer when type is "arrayBuffer"');const t=new Blob([e]);return new File([t],"array-buffer-file",{type:"application/octet-stream"})}default:throw new Error(`Unsupported upload type: ${n}`)}},T=e=>{if(l.maxFileSize&&e.size>l.maxFileSize)throw new Error(`File size cannot exceed ${w(l.maxFileSize)}`);if(l.maxFileCount&&i.value.length>=l.maxFileCount)throw new Error(`File count cannot exceed ${l.maxFileCount}`)},q=async(e,n,a)=>{const t=await k(e,n);T(t);const c={id:x(),file:t,filename:t.name,filesize:t.size,filetype:t.type,filesizeText:w(t.size),status:"pending",progress:{loaded:0,total:t.size,percent:0,speed:0,speedText:h(0),remainingTime:0,uploadTime:0}};return i.value.push(c),c},g=(e,n)=>{const a=i.value.findIndex(t=>t.id===e);a!==-1&&(i.value[a]={...i.value[a],...n})},z=()=>{var n;i.value.every(a=>a.status!=="uploading")&&((n=l.onComplete)==null||n.call(l,i.value))},y=e=>{var a;const n=i.value.find(t=>t.id===e);if(!n||n.status!=="pending"&&n.status!=="uploading")return!1;if(n.status==="uploading"){const t=f.value.get(e);t&&(t.abort(),f.value.delete(e))}return g(e,{status:"cancelled"}),(a=l.onCancel)==null||a.call(l,e),z(),!0},D=e=>{e?e.forEach(n=>y(n)):i.value.forEach(n=>y(n.id))},G=async e=>{if(!e.file)throw new Error("File not found");T(e.file);const n=new AbortController;f.value.set(e.id,n);const a=Date.now();g(e.id,{status:"uploading"}),await A.upload(e.file,{...$.value,method:I.value,signal:n.signal,onUploadProgress:t=>{var F;const s=(Date.now()-a)/1e3,r=s>0?t.loaded/s:0,m=(t.total||0)-t.loaded,U=r>0?m/r:0,P={loaded:t.loaded,total:t.total,percent:t.percent||0,speed:Math.round(r),speedText:h(r),uploadTime:Math.round(s),remainingTime:Math.round(U)};g(e.id,{status:"uploading",progress:P}),(F=l.onProgress)==null||F.call(l,b.value)}}).then(t=>{var s,r;if(e.status==="cancelled")return;const c=((s=l.onDataCallback)==null?void 0:s.call(l,t,e))||{},o=Math.round((Date.now()-a)/1e3);g(e.id,{status:"success",data:t,...c,progress:{...e.progress,loaded:e.filesize||0,percent:100,speed:0,speedText:h(0),uploadTime:o,remainingTime:0}}),f.value.delete(e.id),(r=l.onSuccess)==null||r.call(l,t)}).catch(t=>{if(!(t.message==="canceled"||e.status==="cancelled"))throw g(e.id,{status:"error",error:t.message}),f.value.delete(e.id),t}).finally(()=>{z()})},C=async()=>{var n;const e=i.value.filter(a=>a.status==="pending");if(e.length!==0){v.value=!0;try{for(let a=0;a<e.length;a++){const t=e[a],c=i.value.findIndex(o=>o.id===t.id);d.value=c,await G(t)}}catch(a){throw(n=l.onError)==null||n.call(l,{status:(a==null?void 0:a.status)||500,message:(a==null?void 0:a.message)||"upload failed"}),a}finally{v.value=!1,d.value=-1}}},B=async(e,n="file")=>{var a;try{if(l.multiple||E(),!l.multiple&&e.length>1)throw new Error("Single file mode: only one file can be selected");if(l.maxFileCount&&i.value.length+e.length>l.maxFileCount)throw new Error(`Adding ${e.length} files would exceed the maximum limit of ${l.maxFileCount}`);for(const t of e)await q(t,n)}catch(t){throw(a=l.onError)==null||a.call(l,{status:(t==null?void 0:t.status)||400,message:(t==null?void 0:t.message)||"Failed to add files"}),t}l.autoUpload&&C()},K=e=>{const n=e.map(a=>j(a));i.value.push(...n)},E=()=>{i.value.forEach(e=>{y(e.id)}),f.value.clear(),i.value=[],d.value=-1},M=e=>{const n=i.value.find(t=>t.id===e);if(n&&n.status==="uploading"){g(e,{status:"cancelled"});const t=f.value.get(e);if(!t)return;t.abort(),f.value.delete(e)}const a=i.value.findIndex(t=>t.id===e);a!==-1&&i.value.splice(a,1)},L=e=>{e?e.forEach(n=>M(n)):i.value.forEach(n=>M(n.id))},{files:N,open:O,reset:S}=Q.useFileDialog({accept:l.accept,multiple:l.multiple||!1}),j=e=>({id:x(),...e,filesizeText:e.filesize?w(e.filesize):void 0,status:e.url?"success":"pending",progress:{loaded:0,total:e.filesize||0,percent:e.url?100:0,speed:0,speedText:h(0),remainingTime:0,uploadTime:0}});u.watch(N,async e=>{if(e&&e.length>0){const n=Array.from(e);S(),await B(n,"file").catch(a=>{console.warn("Failed to add selected files:",a)})}});const H=u.computed(()=>i.value.filter(e=>e.status==="success").map(e=>({url:e.url,filename:e.filename,filesize:e.filesize,filetype:e.filetype})));return{isUploading:v,uploadFiles:i,dataFiles:H,progress:b,open:O,trigger:C,resetFiles:S,clearFiles:E,removeFiles:L,addFiles:B,addDataFiles:K,cancelFiles:D}}exports.useUpload=W;
@@ -3,15 +3,15 @@ import { uniqueId as V } from "lodash-es";
3
3
  import { ref as g, computed as v, watch as W } from "vue";
4
4
  import { createLocalUploadDriver as X } from "./upload/local.js";
5
5
  function ne(l) {
6
- const w = g(!1), i = g([]), u = g(-1), d = g(/* @__PURE__ */ new Map()), A = l.driver || X(), $ = v(() => {
7
- const { onProgress: e, onDataCallback: n, onCancel: a, onComplete: t, maxFileSize: c, maxFileCount: o, accept: s, multiple: r, autoUpload: f, options: U, onSuccess: P, onError: x, method: Y, driver: Z, ...Q } = l;
6
+ const w = g(!1), i = g([]), u = g(-1), d = g(/* @__PURE__ */ new Map()), $ = l.driver || X(), I = v(() => {
7
+ const { onProgress: e, onDataCallback: n, onCancel: a, onComplete: t, maxFileSize: c, maxFileCount: s, accept: o, multiple: r, autoUpload: f, options: P, onSuccess: A, onError: x, method: Y, driver: Z, ...Q } = l;
8
8
  return Q;
9
- }), I = v(() => l.method || "POST"), b = v(() => {
10
- const e = i.value.length, n = i.value.reduce((o, s) => o + (s.filesize || 0), 0);
9
+ }), k = v(() => l.method || "POST"), b = v(() => {
10
+ const e = i.value.length, n = i.value.reduce((s, o) => s + (o.filesize || 0), 0);
11
11
  let a = 0, t = 0;
12
- return i.value.forEach((o, s) => {
12
+ return i.value.forEach((s, o) => {
13
13
  var r;
14
- s < u.value ? a += o.filesize || 0 : s === u.value && (a += ((r = o.progress) == null ? void 0 : r.loaded) || 0);
14
+ o < u.value ? a += s.filesize || 0 : o === u.value && (a += ((r = s.progress) == null ? void 0 : r.loaded) || 0);
15
15
  }), n > 0 && (t = Math.round(a / n * 100)), {
16
16
  index: u.value >= 0 ? u.value + 1 : 0,
17
17
  totalFiles: e,
@@ -30,7 +30,7 @@ function ne(l) {
30
30
  return "0 B/s";
31
31
  const n = 1024, a = ["B/s", "KB/s", "MB/s", "GB/s"], t = Math.floor(Math.log(e) / Math.log(n));
32
32
  return `${Number.parseFloat((e / n ** t).toFixed(2))} ${a[t]}`;
33
- }, T = () => V("upload-"), k = async (e, n, a) => {
33
+ }, T = () => V("upload-"), D = async (e, n, a) => {
34
34
  switch (n) {
35
35
  case "file": {
36
36
  if (!(e instanceof File))
@@ -45,10 +45,10 @@ function ne(l) {
45
45
  case "base64": {
46
46
  if (typeof e != "string")
47
47
  throw new TypeError('Payload must be a string when type is "base64"');
48
- const t = e.includes(",") ? e.split(",")[1] : e, c = e.includes(",") ? e.split(",")[0].split(":")[1].split(";")[0] : "application/octet-stream", o = atob(t), s = new Uint8Array(o.length);
49
- for (let f = 0; f < o.length; f++)
50
- s[f] = o.charCodeAt(f);
51
- const r = new Blob([s], { type: c });
48
+ const t = e.includes(",") ? e.split(",")[1] : e, c = e.includes(",") ? e.split(",")[0].split(":")[1].split(";")[0] : "application/octet-stream", s = atob(t), o = new Uint8Array(s.length);
49
+ for (let f = 0; f < s.length; f++)
50
+ o[f] = s.charCodeAt(f);
51
+ const r = new Blob([o], { type: c });
52
52
  return new File([r], "base64-file", { type: c });
53
53
  }
54
54
  case "arrayBuffer": {
@@ -65,8 +65,8 @@ function ne(l) {
65
65
  throw new Error(`File size cannot exceed ${y(l.maxFileSize)}`);
66
66
  if (l.maxFileCount && i.value.length >= l.maxFileCount)
67
67
  throw new Error(`File count cannot exceed ${l.maxFileCount}`);
68
- }, D = async (e, n, a) => {
69
- const t = await k(e, n);
68
+ }, G = async (e, n, a) => {
69
+ const t = await D(e, n);
70
70
  z(t);
71
71
  const c = {
72
72
  id: T(),
@@ -105,40 +105,40 @@ function ne(l) {
105
105
  return m(e, {
106
106
  status: "cancelled"
107
107
  }), (a = l.onCancel) == null || a.call(l, e), C(), !0;
108
- }, G = (e) => {
108
+ }, K = (e) => {
109
109
  e ? e.forEach((n) => F(n)) : i.value.forEach((n) => F(n.id));
110
- }, K = async (e) => {
110
+ }, L = async (e) => {
111
111
  if (!e.file)
112
112
  throw new Error("File not found");
113
113
  z(e.file);
114
114
  const n = new AbortController();
115
115
  d.value.set(e.id, n);
116
116
  const a = Date.now();
117
- m(e.id, { status: "uploading" }), await A.upload(e.file, {
118
- ...$.value,
119
- method: I.value,
117
+ m(e.id, { status: "uploading" }), await $.upload(e.file, {
118
+ ...I.value,
119
+ method: k.value,
120
120
  signal: n.signal,
121
121
  onUploadProgress: (t) => {
122
122
  var x;
123
- const s = (Date.now() - a) / 1e3, r = s > 0 ? t.loaded / s : 0, f = (t.total || 0) - t.loaded, U = r > 0 ? f / r : 0, P = {
123
+ const o = (Date.now() - a) / 1e3, r = o > 0 ? t.loaded / o : 0, f = (t.total || 0) - t.loaded, P = r > 0 ? f / r : 0, A = {
124
124
  loaded: t.loaded,
125
125
  total: t.total,
126
126
  percent: t.percent || 0,
127
127
  speed: Math.round(r),
128
128
  speedText: h(r),
129
- uploadTime: Math.round(s),
130
- remainingTime: Math.round(U)
129
+ uploadTime: Math.round(o),
130
+ remainingTime: Math.round(P)
131
131
  };
132
132
  m(e.id, {
133
133
  status: "uploading",
134
- progress: P
134
+ progress: A
135
135
  }), (x = l.onProgress) == null || x.call(l, b.value);
136
136
  }
137
137
  }).then((t) => {
138
- var s, r;
138
+ var o, r;
139
139
  if (e.status === "cancelled")
140
140
  return;
141
- const c = ((s = l.onDataCallback) == null ? void 0 : s.call(l, t, e)) || {}, o = Math.round((Date.now() - a) / 1e3);
141
+ const c = ((o = l.onDataCallback) == null ? void 0 : o.call(l, t, e)) || {}, s = Math.round((Date.now() - a) / 1e3);
142
142
  m(e.id, {
143
143
  status: "success",
144
144
  data: t,
@@ -149,7 +149,7 @@ function ne(l) {
149
149
  percent: 100,
150
150
  speed: 0,
151
151
  speedText: h(0),
152
- uploadTime: o,
152
+ uploadTime: s,
153
153
  remainingTime: 0
154
154
  }
155
155
  }), d.value.delete(e.id), (r = l.onSuccess) == null || r.call(l, t);
@@ -169,8 +169,8 @@ function ne(l) {
169
169
  w.value = !0;
170
170
  try {
171
171
  for (let a = 0; a < e.length; a++) {
172
- const t = e[a], c = i.value.findIndex((o) => o.id === t.id);
173
- u.value = c, await K(t);
172
+ const t = e[a], c = i.value.findIndex((s) => s.id === t.id);
173
+ u.value = c, await L(t);
174
174
  }
175
175
  } catch (a) {
176
176
  throw (n = l.onError) == null || n.call(l, {
@@ -184,10 +184,12 @@ function ne(l) {
184
184
  }, E = async (e, n = "file") => {
185
185
  var a;
186
186
  try {
187
+ if (l.multiple || M(), !l.multiple && e.length > 1)
188
+ throw new Error("Single file mode: only one file can be selected");
187
189
  if (l.maxFileCount && i.value.length + e.length > l.maxFileCount)
188
190
  throw new Error(`Adding ${e.length} files would exceed the maximum limit of ${l.maxFileCount}`);
189
191
  for (const t of e)
190
- await D(t, n);
192
+ await G(t, n);
191
193
  } catch (t) {
192
194
  throw (a = l.onError) == null || a.call(l, {
193
195
  status: (t == null ? void 0 : t.status) || 400,
@@ -195,14 +197,14 @@ function ne(l) {
195
197
  }), t;
196
198
  }
197
199
  l.autoUpload && B();
198
- }, L = (e) => {
200
+ }, N = (e) => {
199
201
  const n = e.map((a) => H(a));
200
202
  i.value.push(...n);
201
- }, N = () => {
203
+ }, M = () => {
202
204
  i.value.forEach((e) => {
203
205
  F(e.id);
204
206
  }), d.value.clear(), i.value = [], u.value = -1;
205
- }, M = (e) => {
207
+ }, S = (e) => {
206
208
  const n = i.value.find((t) => t.id === e);
207
209
  if (n && n.status === "uploading") {
208
210
  m(e, {
@@ -216,8 +218,8 @@ function ne(l) {
216
218
  const a = i.value.findIndex((t) => t.id === e);
217
219
  a !== -1 && i.value.splice(a, 1);
218
220
  }, q = (e) => {
219
- e ? e.forEach((n) => M(n)) : i.value.forEach((n) => M(n.id));
220
- }, { files: O, open: j, reset: S } = R({
221
+ e ? e.forEach((n) => S(n)) : i.value.forEach((n) => S(n.id));
222
+ }, { files: O, open: j, reset: U } = R({
221
223
  accept: l.accept,
222
224
  multiple: l.multiple || !1
223
225
  }), H = (e) => ({
@@ -238,7 +240,7 @@ function ne(l) {
238
240
  W(O, async (e) => {
239
241
  if (e && e.length > 0) {
240
242
  const n = Array.from(e);
241
- S(), await E(n, "file").catch((a) => {
243
+ U(), await E(n, "file").catch((a) => {
242
244
  console.warn("Failed to add selected files:", a);
243
245
  });
244
246
  }
@@ -256,12 +258,12 @@ function ne(l) {
256
258
  progress: b,
257
259
  open: j,
258
260
  trigger: B,
259
- resetFiles: S,
260
- clearFiles: N,
261
+ resetFiles: U,
262
+ clearFiles: M,
261
263
  removeFiles: q,
262
264
  addFiles: E,
263
- addDataFiles: L,
264
- cancelFiles: G
265
+ addDataFiles: N,
266
+ cancelFiles: K
265
267
  };
266
268
  }
267
269
  export {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@duxweb/dvha-core",
3
3
  "type": "module",
4
- "version": "0.1.13",
4
+ "version": "0.1.14",
5
5
  "author": "DuxWeb",
6
6
  "license": "MIT",
7
7
  "repository": {