@lingshugroup/web-plus 1.5.1 → 1.6.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.
- package/lib/downloadFile/index.cjs +1 -0
- package/lib/downloadFile/index.js +12 -0
- package/lib/index/index.cjs +1 -1
- package/lib/index/index.js +20 -18
- package/lib/index/index.js.br +0 -0
- package/lib/index/index.js.gz +0 -0
- package/lib/index.css +1 -1
- package/lib/index.css.br +0 -0
- package/lib/index.css.gz +0 -0
- package/lib/packages/ls-components/components/_utils/utils/index.cjs +1 -1
- package/lib/packages/ls-components/components/_utils/utils/index.js +117 -64
- package/lib/packages/ls-components/components/_utils/utils/index.js.br +0 -0
- package/lib/packages/ls-components/components/_utils/utils/index.js.gz +0 -0
- package/lib/packages/ls-components/components/descriptions/Index.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/descriptions/Index.vue/index.js +1 -1
- package/lib/packages/ls-components/components/downloadFile/Index.vue/index.cjs +1 -0
- package/lib/packages/ls-components/components/downloadFile/Index.vue/index.js +94 -0
- package/lib/packages/ls-components/components/downloadFile/Index.vue/index.js.br +0 -0
- package/lib/packages/ls-components/components/downloadFile/Index.vue/index.js.gz +0 -0
- package/lib/packages/ls-components/components/downloadFile/Index.vue/index2.cjs +1 -0
- package/lib/packages/ls-components/components/downloadFile/Index.vue/index2.js +4 -0
- package/lib/packages/ls-components/components/downloadFile/types/index.cjs +1 -0
- package/lib/packages/ls-components/components/downloadFile/types/index.js +46 -0
- package/lib/packages/ls-components/components/form/Form.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/form/Form.vue/index.js +2 -2
- package/lib/packages/ls-components/components/form/Form.vue/index2.cjs +1 -1
- package/lib/packages/ls-components/components/form/Form.vue/index2.js +106 -108
- package/lib/packages/ls-components/components/form/Form.vue/index2.js.br +0 -0
- package/lib/packages/ls-components/components/form/Form.vue/index2.js.gz +0 -0
- package/lib/packages/ls-components/components/form/FormItem.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/form/FormItem.vue/index.js +2 -2
- package/lib/packages/ls-components/components/form/FormItem.vue/index2.cjs +1 -1
- package/lib/packages/ls-components/components/form/FormItem.vue/index2.js +282 -273
- package/lib/packages/ls-components/components/form/FormItem.vue/index2.js.br +0 -0
- package/lib/packages/ls-components/components/form/FormItem.vue/index2.js.gz +0 -0
- package/lib/packages/ls-components/components/index/index.cjs +1 -1
- package/lib/packages/ls-components/components/index/index.js +35 -33
- package/lib/packages/ls-components/components/index/index.js.br +0 -0
- package/lib/packages/ls-components/components/index/index.js.gz +0 -0
- package/lib/types/components/_utils/index.d.ts +2 -1
- package/lib/types/components/_utils/utils.d.ts +17 -0
- package/lib/types/components/downloadFile/Index.vue.d.ts +34 -0
- package/lib/types/components/downloadFile/index.d.ts +78 -0
- package/lib/types/components/downloadFile/types.d.ts +12 -0
- package/lib/types/components/form/Form.vue.d.ts +4 -2
- package/lib/types/components/form/index.d.ts +7 -2
- package/lib/types/components/list/List.vue.d.ts +7 -3
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.js +2 -0
- package/package.json +1 -1
package/lib/index.css.br
CHANGED
|
Binary file
|
package/lib/index.css.gz
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var C=Object.defineProperty;var s=(e,t)=>C(e,"name",{value:t,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function f(e){if(e===null)return!0;const t=typeof e;return!!(t==="undefined"||t==="string"&&(e=e.replace(/^\s*|\s*$/g,""),e==="")||t==="number"&&Number.isNaN(e)||t==="object"&&Object.keys(e).length===0)}s(f,"isEmpty");function a(e,t){try{const n=new Blob([e]),c=URL.createObjectURL(n),o=document.createElement("a");o.style.display="none",o.href=c,o.download=t,document.body.appendChild(o),o.click(),o.remove(),URL.revokeObjectURL(c)}catch{}}s(a,"exportFile");function d(e){if(f(e))return"";const t=e.lastIndexOf(".");return t>=0?e.substring(t):""}s(d,"getExtension");const h=s((e=[])=>{const t=[];return e.forEach(n=>{t.push(new Promise((c,o)=>{const r=document.createElement("script");r.id=n.id,r.src=n.src,document.body.appendChild(r),r.onload=function(){c({})},r.onerror=function(){r.remove(),o({})}}))}),Promise.all(t)},"loadJs"),b=s((e=[])=>{e.forEach(t=>{const n=document.getElementById(t.id);n&&n.remove()})},"removeJs"),p=s((e=[])=>{const t=[];return e.forEach(n=>{t.push(new Promise((c,o)=>{const r=document.createElement("link");r.id=n.id,r.rel="stylesheet",r.href=n.src,document.body.appendChild(r),r.onload=function(){c({})},r.onerror=function(){r.remove(),o({})}}))}),Promise.all(t)},"loadCss"),y=s((e=[])=>{e.forEach(t=>{const n=document.getElementById(t.id);n&&n.remove()})},"removeCss");function m(){return`#${Math.floor(Math.random()*16777215).toString(16).padStart(6,"0")}`}s(m,"getRandomHexColor");function u(e,t){return Number((Math.ceil(e*100)/100).toFixed(t||1))}s(u,"numberFixed");function M(e,t,n){const c=e,o=t;n=n||0,e=u(e,n),t=u(t,n);let r=u((e-t)/2,n);r=r==0?.1:r;let i=Math.ceil((e-t)/r);i=i==0?1:i,t<r&&(t=0);let l=u(r*i+t,n);return l<=c&&(l=u(l+r,n)),{aMax:l,aMin:t==0||t<o?t:u(t-r,n),aInterval:r}}s(M,"formatChartAxis");function g(e){try{return e=JSON.parse(e),e!==null&&typeof e=="object"?e.constructor===Object:!1}catch{return!1}}s(g,"isValidJSON");function E(e){const t=e.reduce((r,i)=>r+i.byteLength,0),n=new ArrayBuffer(t),c=new Uint8Array(n);let o=0;return e.forEach(r=>{c.set(new Uint8Array(r.file),o),o+=r.byteLength}),c}s(E,"mergeBuffer");function w(e){const t=window.atob(e),n=t.length,c=new Uint8Array(n);for(let o=0;o<n;o++)c[o]=t.charCodeAt(o);return new Uint8Array(c).buffer}s(w,"fileToBuffer");const v={isEmpty:f,exportFile:a,getExtension:d,loadJs:h,removeJs:b,loadCss:p,removeCss:y,getRandomHexColor:m,numberFixed:u,isValidJSON:g,mergeBuffer:E,fileToBuffer:w};exports.default=v;exports.exportFile=a;exports.fileToBuffer=w;exports.formatChartAxis=M;exports.getExtension=d;exports.getRandomHexColor=m;exports.isEmpty=f;exports.isValidJSON=g;exports.loadCss=p;exports.loadJs=h;exports.mergeBuffer=E;exports.numberFixed=u;exports.removeCss=y;exports.removeJs=b;
|
|
@@ -1,84 +1,137 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
function
|
|
4
|
-
if (
|
|
5
|
-
const
|
|
6
|
-
return !!(
|
|
1
|
+
var a = Object.defineProperty;
|
|
2
|
+
var s = (e, t) => a(e, "name", { value: t, configurable: !0 });
|
|
3
|
+
function f(e) {
|
|
4
|
+
if (e === null) return !0;
|
|
5
|
+
const t = typeof e;
|
|
6
|
+
return !!(t === "undefined" || t === "string" && (e = e.replace(/^\s*|\s*$/g, ""), e === "") || t === "number" && Number.isNaN(e) || t === "object" && Object.keys(e).length === 0);
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
s(f, "isEmpty");
|
|
9
|
+
function d(e, t) {
|
|
10
|
+
try {
|
|
11
|
+
const r = new Blob([e]), c = URL.createObjectURL(r), o = document.createElement("a");
|
|
12
|
+
o.style.display = "none", o.href = c, o.download = t, document.body.appendChild(o), o.click(), o.remove(), URL.revokeObjectURL(c);
|
|
13
|
+
} catch {
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
s(d, "exportFile");
|
|
17
|
+
function h(e) {
|
|
18
|
+
if (f(e)) return "";
|
|
19
|
+
const t = e.lastIndexOf(".");
|
|
20
|
+
return t >= 0 ? e.substring(t) : "";
|
|
21
|
+
}
|
|
22
|
+
s(h, "getExtension");
|
|
23
|
+
const b = /* @__PURE__ */ s((e = []) => {
|
|
24
|
+
const t = [];
|
|
25
|
+
return e.forEach((r) => {
|
|
26
|
+
t.push(
|
|
27
|
+
new Promise((c, o) => {
|
|
28
|
+
const n = document.createElement("script");
|
|
29
|
+
n.id = r.id, n.src = r.src, document.body.appendChild(n), n.onload = function() {
|
|
30
|
+
c({});
|
|
31
|
+
}, n.onerror = function() {
|
|
32
|
+
n.remove(), o({});
|
|
19
33
|
};
|
|
20
34
|
})
|
|
21
35
|
);
|
|
22
|
-
}), Promise.all(
|
|
23
|
-
}, "loadJs"),
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
36
|
+
}), Promise.all(t);
|
|
37
|
+
}, "loadJs"), p = /* @__PURE__ */ s((e = []) => {
|
|
38
|
+
e.forEach((t) => {
|
|
39
|
+
const r = document.getElementById(t.id);
|
|
40
|
+
r && r.remove();
|
|
27
41
|
});
|
|
28
|
-
}, "removeJs"),
|
|
29
|
-
const
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
new Promise((
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
|
|
42
|
+
}, "removeJs"), y = /* @__PURE__ */ s((e = []) => {
|
|
43
|
+
const t = [];
|
|
44
|
+
return e.forEach((r) => {
|
|
45
|
+
t.push(
|
|
46
|
+
new Promise((c, o) => {
|
|
47
|
+
const n = document.createElement("link");
|
|
48
|
+
n.id = r.id, n.rel = "stylesheet", n.href = r.src, document.body.appendChild(n), n.onload = function() {
|
|
49
|
+
c({});
|
|
50
|
+
}, n.onerror = function() {
|
|
51
|
+
n.remove(), o({});
|
|
38
52
|
};
|
|
39
53
|
})
|
|
40
54
|
);
|
|
41
|
-
}), Promise.all(
|
|
42
|
-
}, "loadCss"),
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
55
|
+
}), Promise.all(t);
|
|
56
|
+
}, "loadCss"), g = /* @__PURE__ */ s((e = []) => {
|
|
57
|
+
e.forEach((t) => {
|
|
58
|
+
const r = document.getElementById(t.id);
|
|
59
|
+
r && r.remove();
|
|
46
60
|
});
|
|
47
61
|
}, "removeCss");
|
|
48
|
-
function
|
|
49
|
-
return
|
|
62
|
+
function m() {
|
|
63
|
+
return `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`;
|
|
50
64
|
}
|
|
51
|
-
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
let
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
s(m, "getRandomHexColor");
|
|
66
|
+
function u(e, t) {
|
|
67
|
+
return Number((Math.ceil(e * 100) / 100).toFixed(t || 1));
|
|
68
|
+
}
|
|
69
|
+
s(u, "numberFixed");
|
|
70
|
+
function C(e, t, r) {
|
|
71
|
+
const c = e, o = t;
|
|
72
|
+
r = r || 0, e = u(e, r), t = u(t, r);
|
|
73
|
+
let n = u((e - t) / 2, r);
|
|
74
|
+
n = n == 0 ? 0.1 : n;
|
|
75
|
+
let i = Math.ceil((e - t) / n);
|
|
76
|
+
i = i == 0 ? 1 : i, t < n && (t = 0);
|
|
77
|
+
let l = u(n * i + t, r);
|
|
78
|
+
return l <= c && (l = u(l + n, r)), {
|
|
79
|
+
aMax: l,
|
|
80
|
+
aMin: t == 0 || t < o ? t : u(t - n, r),
|
|
81
|
+
aInterval: n
|
|
64
82
|
};
|
|
65
83
|
}
|
|
66
|
-
|
|
67
|
-
function
|
|
84
|
+
s(C, "formatChartAxis");
|
|
85
|
+
function w(e) {
|
|
68
86
|
try {
|
|
69
|
-
return
|
|
87
|
+
return e = JSON.parse(e), e !== null && typeof e == "object" ? e.constructor === Object : !1;
|
|
70
88
|
} catch {
|
|
71
89
|
return !1;
|
|
72
90
|
}
|
|
73
91
|
}
|
|
74
|
-
|
|
92
|
+
s(w, "isValidJSON");
|
|
93
|
+
function E(e) {
|
|
94
|
+
const t = e.reduce((n, i) => n + i.byteLength, 0), r = new ArrayBuffer(t), c = new Uint8Array(r);
|
|
95
|
+
let o = 0;
|
|
96
|
+
return e.forEach((n) => {
|
|
97
|
+
c.set(new Uint8Array(n.file), o), o += n.byteLength;
|
|
98
|
+
}), c;
|
|
99
|
+
}
|
|
100
|
+
s(E, "mergeBuffer");
|
|
101
|
+
function U(e) {
|
|
102
|
+
const t = window.atob(e), r = t.length, c = new Uint8Array(r);
|
|
103
|
+
for (let o = 0; o < r; o++)
|
|
104
|
+
c[o] = t.charCodeAt(o);
|
|
105
|
+
return new Uint8Array(c).buffer;
|
|
106
|
+
}
|
|
107
|
+
s(U, "fileToBuffer");
|
|
108
|
+
const M = {
|
|
109
|
+
isEmpty: f,
|
|
110
|
+
exportFile: d,
|
|
111
|
+
getExtension: h,
|
|
112
|
+
loadJs: b,
|
|
113
|
+
removeJs: p,
|
|
114
|
+
loadCss: y,
|
|
115
|
+
removeCss: g,
|
|
116
|
+
getRandomHexColor: m,
|
|
117
|
+
numberFixed: u,
|
|
118
|
+
isValidJSON: w,
|
|
119
|
+
mergeBuffer: E,
|
|
120
|
+
fileToBuffer: U
|
|
121
|
+
};
|
|
75
122
|
export {
|
|
76
|
-
|
|
77
|
-
d as
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
123
|
+
M as default,
|
|
124
|
+
d as exportFile,
|
|
125
|
+
U as fileToBuffer,
|
|
126
|
+
C as formatChartAxis,
|
|
127
|
+
h as getExtension,
|
|
128
|
+
m as getRandomHexColor,
|
|
129
|
+
f as isEmpty,
|
|
130
|
+
w as isValidJSON,
|
|
131
|
+
y as loadCss,
|
|
132
|
+
b as loadJs,
|
|
133
|
+
E as mergeBuffer,
|
|
134
|
+
u as numberFixed,
|
|
135
|
+
g as removeCss,
|
|
136
|
+
p as removeJs
|
|
84
137
|
};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=;/* empty css */;/* empty css */const t=,/* empty css */u=t.default(e.default,[["__scopeId","data-v-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=;/* empty css */;/* empty css */const t=,/* empty css */u=t.default(e.default,[["__scopeId","data-v-ca732d38"]]);exports.default=u;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./index2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../../../_virtual/_plugin-vue_export-helper/index.js";
|
|
4
|
-
const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
4
|
+
const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-ca732d38"]]);
|
|
5
5
|
export {
|
|
6
6
|
_ as default
|
|
7
7
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var M=Object.defineProperty;var s=(d,m)=>M(d,"name",{value:m,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});;/* empty css */;/* empty css */const e=require("vue"),T=,/* empty css */C=,/* empty css */j=,/* empty css */I=e.defineComponent({name:"LSDownloadFile"}),O=e.defineComponent({...I,props:C.lsDownloadProp,emits:C.emitNames,setup(d,{expose:m,emit:w}){const D=T.useNamespace("download-file").b(),n=d,g=w,o=e.ref({strokeWidth:15,striped:!0,stripedFlow:!0,percentage:0,duration:10}),v=e.ref([]),i=e.ref([]),a=e.ref([]),h=e.ref([]),l=e.ref([]),r=e.ref(0),k=e.computed(()=>n.maxErrorNum<=a.value.length),x=e.computed(()=>i.value.length===n.chunkTotal);function y(){E()}s(y,"start");function b(){i.value=[],a.value=[],h.value=[],o.value.status="",l.value=[],r.value=0}s(b,"reset");function P(){l.value=Array.from({length:n.chunkTotal},(t,u)=>u+1)}s(P,"initChunkQueue");function _(){return Math.ceil(i.value.length/n.chunkTotal*100)}s(_,"setPercentage");async function E(){r.value==0&&(b(),P()),o.value.percentage=_(),N()}s(E,"initDownload");async function N(){if(a.value.length>0){const t=Math.max(...a.value),u=n.initRequstNum-a.value.length||0;l.value=a.value.concat(Array.from({length:u},(f,p)=>p+t+1))}l.value.forEach(t=>{q(t)})}s(N,"downloadChunk");async function q(t){r.value++;const u=t-1;v.value[u]=new AbortController;const f=v.value[u].signal;return new Promise(async(p,R)=>{const A=n.chunkDataRequestParams?Object.assign(n.chunkDataRequestParams,{chunk:t}):{id:n.recordId,chunk:t};try{const c=await n.chunkDataRequest(Object.assign(A),n.chunkDataRequestConfig||{signal:f});r.value--,h.value[u]=c,i.value.includes(t)||i.value.push(t),o.value.percentage=_(),p(c)}catch(c){a.value.includes(t)||a.value.push(t),R(c)}finally{r.value===0&&a.value.length>0||k.value?(o.value.status="exception",g("onDownloadError",{errChunk:a.value}),n.cancelUploadInLimit&&v.value.forEach(c=>c.abort())):r.value!==0&&!k.value&&l.value.length!=n.chunkTotal?q(l.value.length):x.value&&(o.value.status="success",g("onDownloadSuccess",h.value))}})}return s(q,"chunkDataRequestFunc"),e.onUnmounted(()=>{v.value.forEach(t=>t.abort())}),m({start:y}),(t,u)=>{const f=j.ElProgress;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(D))},[e.createVNode(f,e.normalizeProps(e.guardReactiveProps(Object.assign(e.unref(o),t.$attrs))),null,16)],2)}}});exports.default=O;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
var j = Object.defineProperty;
|
|
2
|
+
var o = (f, p) => j(f, "name", { value: p, configurable: !0 });
|
|
3
|
+
/* empty css */
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { defineComponent as x, ref as s, computed as C, onUnmounted as F, openBlock as L, createElementBlock as M, normalizeClass as O, unref as D, createVNode as z, normalizeProps as B, guardReactiveProps as Q } from "vue";
|
|
6
|
+
import { useNamespace as S } from "../../_hooks/useNamespace/index.js";
|
|
7
|
+
import { lsDownloadProp as U, emitNames as V } from "../types/index.js";
|
|
8
|
+
import { ElProgress as W } from "../../../../../node_modules/.pnpm/element-plus@2.8.1_vue@3.5.13_typescript@5.5.4_/node_modules/element-plus/es/components/progress/index/index.js";
|
|
9
|
+
const $ = x({
|
|
10
|
+
name: "LSDownloadFile"
|
|
11
|
+
}), ae = /* @__PURE__ */ x({
|
|
12
|
+
...$,
|
|
13
|
+
props: U,
|
|
14
|
+
emits: V,
|
|
15
|
+
setup(f, { expose: p, emit: y }) {
|
|
16
|
+
const E = S("download-file").b(), a = f, g = y, u = s({
|
|
17
|
+
strokeWidth: 15,
|
|
18
|
+
striped: !0,
|
|
19
|
+
stripedFlow: !0,
|
|
20
|
+
percentage: 0,
|
|
21
|
+
duration: 10
|
|
22
|
+
}), v = s([]), i = s([]), t = s([]), d = s([]), l = s([]), r = s(0), k = C(() => a.maxErrorNum <= t.value.length), P = C(() => i.value.length === a.chunkTotal);
|
|
23
|
+
function b() {
|
|
24
|
+
N();
|
|
25
|
+
}
|
|
26
|
+
o(b, "start");
|
|
27
|
+
function R() {
|
|
28
|
+
i.value = [], t.value = [], d.value = [], u.value.status = "", l.value = [], r.value = 0;
|
|
29
|
+
}
|
|
30
|
+
o(R, "reset");
|
|
31
|
+
function q() {
|
|
32
|
+
l.value = Array.from({ length: a.chunkTotal }, (e, n) => n + 1);
|
|
33
|
+
}
|
|
34
|
+
o(q, "initChunkQueue");
|
|
35
|
+
function _() {
|
|
36
|
+
return Math.ceil(i.value.length / a.chunkTotal * 100);
|
|
37
|
+
}
|
|
38
|
+
o(_, "setPercentage");
|
|
39
|
+
async function N() {
|
|
40
|
+
r.value == 0 && (R(), q()), u.value.percentage = _(), A();
|
|
41
|
+
}
|
|
42
|
+
o(N, "initDownload");
|
|
43
|
+
async function A() {
|
|
44
|
+
if (t.value.length > 0) {
|
|
45
|
+
const e = Math.max(...t.value), n = a.initRequstNum - t.value.length || 0;
|
|
46
|
+
l.value = t.value.concat(Array.from({ length: n }, (m, h) => h + e + 1));
|
|
47
|
+
}
|
|
48
|
+
l.value.forEach((e) => {
|
|
49
|
+
w(e);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
o(A, "downloadChunk");
|
|
53
|
+
async function w(e) {
|
|
54
|
+
r.value++;
|
|
55
|
+
const n = e - 1;
|
|
56
|
+
v.value[n] = new AbortController();
|
|
57
|
+
const m = v.value[n].signal;
|
|
58
|
+
return new Promise(async (h, I) => {
|
|
59
|
+
const T = a.chunkDataRequestParams ? Object.assign(a.chunkDataRequestParams, { chunk: e }) : {
|
|
60
|
+
id: a.recordId,
|
|
61
|
+
chunk: e
|
|
62
|
+
};
|
|
63
|
+
try {
|
|
64
|
+
const c = await a.chunkDataRequest(
|
|
65
|
+
Object.assign(T),
|
|
66
|
+
a.chunkDataRequestConfig || {
|
|
67
|
+
signal: m
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
r.value--, d.value[n] = c, i.value.includes(e) || i.value.push(e), u.value.percentage = _(), h(c);
|
|
71
|
+
} catch (c) {
|
|
72
|
+
t.value.includes(e) || t.value.push(e), I(c);
|
|
73
|
+
} finally {
|
|
74
|
+
r.value === 0 && t.value.length > 0 || k.value ? (u.value.status = "exception", g("onDownloadError", {
|
|
75
|
+
errChunk: t.value
|
|
76
|
+
}), a.cancelUploadInLimit && v.value.forEach((c) => c.abort())) : r.value !== 0 && !k.value && l.value.length != a.chunkTotal ? w(l.value.length) : P.value && (u.value.status = "success", g("onDownloadSuccess", d.value));
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return o(w, "chunkDataRequestFunc"), F(() => {
|
|
81
|
+
v.value.forEach((e) => e.abort());
|
|
82
|
+
}), p({ start: b }), (e, n) => {
|
|
83
|
+
const m = W;
|
|
84
|
+
return L(), M("div", {
|
|
85
|
+
class: O(D(E))
|
|
86
|
+
}, [
|
|
87
|
+
z(m, B(Q(Object.assign(D(u), e.$attrs))), null, 16)
|
|
88
|
+
], 2);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
export {
|
|
93
|
+
ae as default
|
|
94
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index.cjs");exports.default=e.default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../_utils/runtime/index.cjs"),t=e.buildProps({recordId:{type:[String,Number],default:""},chunkTotal:{type:Number,default:0},chunkDataRequest:{type:Function,default:null},chunkDataRequestParams:{type:Object,default:null},chunkDataRequestConfig:{type:Object,default:null},initRequstNum:{type:Number,default:10},maxErrorNum:{type:Number,default:6},cancelUploadInLimit:{type:Boolean,default:!0}}),u=["onDownloadSuccess","onDownloadError"];exports.emitNames=u;exports.lsDownloadProp=t;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { buildProps as e } from "../../_utils/runtime/index.js";
|
|
2
|
+
const u = e({
|
|
3
|
+
// 数据记录id
|
|
4
|
+
recordId: {
|
|
5
|
+
type: [String, Number],
|
|
6
|
+
default: ""
|
|
7
|
+
},
|
|
8
|
+
// 下载分片总数量
|
|
9
|
+
chunkTotal: {
|
|
10
|
+
type: Number,
|
|
11
|
+
default: 0
|
|
12
|
+
},
|
|
13
|
+
// 分片下载请求
|
|
14
|
+
chunkDataRequest: {
|
|
15
|
+
type: Function,
|
|
16
|
+
default: null
|
|
17
|
+
},
|
|
18
|
+
// 分片下载请求参数
|
|
19
|
+
chunkDataRequestParams: {
|
|
20
|
+
type: Object,
|
|
21
|
+
default: null
|
|
22
|
+
},
|
|
23
|
+
chunkDataRequestConfig: {
|
|
24
|
+
type: Object,
|
|
25
|
+
default: null
|
|
26
|
+
},
|
|
27
|
+
// 初始请求数量
|
|
28
|
+
initRequstNum: {
|
|
29
|
+
type: Number,
|
|
30
|
+
default: 10
|
|
31
|
+
},
|
|
32
|
+
// 最大异常请求数
|
|
33
|
+
maxErrorNum: {
|
|
34
|
+
type: Number,
|
|
35
|
+
default: 6
|
|
36
|
+
},
|
|
37
|
+
// 超出上限是否取消上传
|
|
38
|
+
cancelUploadInLimit: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: !0
|
|
41
|
+
}
|
|
42
|
+
}), a = ["onDownloadSuccess", "onDownloadError"];
|
|
43
|
+
export {
|
|
44
|
+
a as emitNames,
|
|
45
|
+
u as lsDownloadProp
|
|
46
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=;/* empty css */;/* empty css */const t=,/* empty css */r=t.default(e.default,[["__scopeId","data-v-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=;/* empty css */;/* empty css */const t=,/* empty css */r=t.default(e.default,[["__scopeId","data-v-ac8f361f"]]);exports.default=r;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./index2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import r from "../../../../../_virtual/_plugin-vue_export-helper/index.js";
|
|
4
|
-
const
|
|
4
|
+
const a = /* @__PURE__ */ r(o, [["__scopeId", "data-v-ac8f361f"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
a as default
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var D=Object.defineProperty;var a=(k,b)=>D(k,"name",{value:b,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});;/* empty css */;/* empty css */;/* empty css */;/* empty css */;/* empty css */;/* empty css */;/* empty css */const e=require("vue"),$=,/* empty css */T=,/* empty css */A=,/* empty css */i=,/* empty css */I=,/* empty css */O=,/* empty css */U=,/* empty css */W=,/* empty css */E=,/* empty css */K=,/* empty css */M={class:"ls-form"},j=e.defineComponent({name:"LSForm"}),z=e.defineComponent({...j,props:T.lsFormProps,emits:["submit","reset","update:form-data","onChange","changeFormData"],setup(k,{expose:b,emit:P}){const y=k,f=P,V=e.useAttrs(),v=e.useSlots();function R(o){const r={};return o&&Object.entries(o).forEach(([n,d])=>{const m=n.replace(/-(\w)/g,(F,h)=>h.toUpperCase());r[m]=d}),r}a(R,"formatAttrs");const _=e.computed(()=>{const o=R(V);let r=y.buttonsLeft;const n={label:"",labelWidth:"0px"};return o&&o.hasOwnProperty("inline")&&(typeof o.inline=="boolean"&&o.inline===!1?r=y.buttonsLeft:r=!0,o.labelPosition==="top"&&(n.class="ls-form-item-buttons")),r||(n.label=" ",o.labelWidth?n.labelWidth=o.labelWidth:n.labelWidth="auto"),n}),s=e.ref(),w=["label","input","textarea","number","radio","checkbox","select","date","datetimerange","timePicker","timeSelect","cascader","multipleCascader","switch","inputRange","inputNumberRange","slot","itemSlot"];let l=e.reactive({});function B(o){o&&(o.resetFields(),f("reset",l))}a(B,"resetForm");async function q(o){o&&await o.validate((r,n)=>{r?f("submit",l):console.warn("error submit!",n)})}a(q,"submitForm");function N(){return new Promise((o,r)=>{if(!s.value)return o(!1);s.value.validate((n,d)=>{n?o(l):(console.warn("error submit!",d),r(d))})})}a(N,"validate");function u(o,r){I.default(l,o,r),f("changeFormData",r,o,l)}a(u,"updateFormData"),e.watch(()=>y.formData,o=>{l=o||{}},{deep:!0,immediate:!0});function S(o,r,n){f("onChange",o,r,n)}return a(S,"onChange"),b({FormRef:s,validate:N,submitForm:q,resetForm:B}),(o,r)=>{const n=O.ElCol,d=U.ElRow,m=W.ElButton,F=E.ElFormItem,h=E.ElForm,L=K.ElConfigProvider;return e.openBlock(),e.createElementBlock("div",M,[e.createVNode(L,{locale:e.unref(A.default),"value-on-clear":void 0,"empty-values":[void 0,null]},{default:e.withCtx(()=>[e.createVNode(h,e.mergeProps({ref_key:"FormRef",ref:s,"label-position":"left","require-asterisk-position":"right","label-width":"auto","hide-required-asterisk":!!o.read},o.$attrs,{model:e.unref(l),disabled:o.loading||o.disabled,class:[o.read&&o.hasDefReadStyle?"show-label":""]}),{default:e.withCtx(()=>[o.column>1?(e.openBlock(),e.createBlock(d,{key:0,gutter:10},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.formItems,(t,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t.prop},[t.hideColumn?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(n,{key:0,span:t.isRow?24:24/o.column},{default:e.withCtx(()=>[t.type==="slot"?e.renderSlot(o.$slots,t.slotKey||t.prop,{key:0,slotRow:{...t},value:e.unref(i.default)(e.unref(l),t.prop),updateFormData:u},void 0,!0):w.includes(t.type)?(e.openBlock(),e.createBlock($.default,e.mergeProps({key:1,"model-value":e.unref(i.default)(e.unref(l),t.prop),colon:o.colon,read:o.read,"label-empty":o.labelEmpty,index:g,ref_for:!0},t,{"onUpdate:modelValue":a(c=>u(t.prop,c),"onUpdate:modelValue"),onOnChange:S}),e.createSlots({_:2},[e.renderList(e.unref(v),(c,p)=>({name:p,fn:e.withCtx(C=>[e.renderSlot(o.$slots,p,e.mergeProps({ref_for:!0},C),void 0,!0)])}))]),1040,["model-value","colon","read","label-empty","index","onUpdate:modelValue"])):e.renderSlot(o.$slots,t.type,{key:2,slotRow:{...t},value:e.unref(i.default)(e.unref(l),t.prop),updateFormData:u},void 0,!0)]),_:2},1032,["span"]))],64))),128))]),_:3})):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(o.formItems,(t,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t.prop},[t.hideColumn?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.type==="slot"?e.renderSlot(o.$slots,t.slotKey||t.prop,{key:0,slotRow:{...t},value:e.unref(i.default)(e.unref(l),t.prop),updateFormData:u},void 0,!0):w.includes(t.type)?(e.openBlock(),e.createBlock($.default,e.mergeProps({key:1,"model-value":e.unref(i.default)(e.unref(l),t.prop),colon:o.colon,read:o.read,"label-empty":o.labelEmpty,index:g,ref_for:!0},t,{"onUpdate:modelValue":a(c=>u(t.prop,c),"onUpdate:modelValue"),onOnChange:S}),e.createSlots({_:2},[e.renderList(e.unref(v),(c,p)=>({name:p,fn:e.withCtx(C=>[e.renderSlot(o.$slots,p,e.mergeProps({ref_for:!0},C),void 0,!0)])}))]),1040,["model-value","colon","read","label-empty","index","onUpdate:modelValue"])):e.renderSlot(o.$slots,t.type,{key:2,slotRow:{...t},value:e.unref(i.default)(e.unref(l),t.prop),updateFormData:u},void 0,!0)],64))],64))),128)),e.renderSlot(o.$slots,"default",{},void 0,!0),o.showButtons?(e.openBlock(),e.createBlock(F,e.mergeProps({key:2},e.unref(_),{class:o.buttonsClass}),{default:e.withCtx(()=>[o.$slots["buttons-prepend"]?e.renderSlot(o.$slots,"buttons-prepend",{key:0},void 0,!0):e.createCommentVNode("",!0),o.showSubmit?(e.openBlock(),e.createBlock(m,{key:1,type:"primary",class:e.normalizeClass(o.confirmClassName),loading:o.loading&&o.showBtnLoading,onClick:r[0]||(r[0]=t=>q(s.value))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.confirmText),1)]),_:1},8,["class","loading"])):e.createCommentVNode("",!0),o.showReset?(e.openBlock(),e.createBlock(m,{key:2,onClick:r[1]||(r[1]=t=>B(s.value))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.resetText||"重置"),1)]),_:1})):e.createCommentVNode("",!0)]),_:3},16,["class"])):e.createCommentVNode("",!0)]),_:3},16,["hide-required-asterisk","model","disabled","class"])]),_:3},8,["locale"])])}}});exports.default=z;
|