@vunk/form 2.19.20 → 2.19.21
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/components/ai-provider/index.cjs +1 -0
- package/components/ai-provider/index.d.ts +7 -0
- package/components/ai-provider/index.mjs +61 -0
- package/components/ai-provider/src/ctx.d.ts +8 -0
- package/components/ai-provider/src/index.vue.d.ts +23 -0
- package/components/ai-provider/src/types.d.ts +56 -0
- package/components/ai-provider/src/use.d.ts +3 -0
- package/components/api-tables-select/index.cjs +1 -1
- package/components/api-tables-select/index.mjs +1 -1
- package/components/api-tables-select/src/ctx.d.ts +57 -57
- package/components/api-tables-select/src/index.vue.d.ts +46 -419
- package/components/button/index.cjs +1 -1
- package/components/button/index.mjs +12 -12
- package/components/button/src/ctx.d.ts +7 -2
- package/components/button/src/index.vue.d.ts +36 -14
- package/components/card-input-collection/index.cjs +1 -1
- package/components/card-input-collection/index.mjs +136 -141
- package/components/card-input-collection/src/core.vue.d.ts +18 -7
- package/components/card-input-collection/src/ctx.d.ts +7 -2
- package/components/card-input-collection/src/index.vue.d.ts +18 -7
- package/components/cascader/index.cjs +1 -1
- package/components/cascader/index.mjs +38 -39
- package/components/cascader/src/ctx.d.ts +8 -3
- package/components/cascader/src/index.vue.d.ts +19 -8
- package/components/checkbox/src/ctx.d.ts +8 -3
- package/components/checkbox/src/index.vue.d.ts +43 -21
- package/components/{cloneDeep-DE0l40hv.mjs → cloneDeep-2YeQ7w2t.mjs} +10 -10
- package/components/cloneDeep-Btpy0oPF.js +1 -0
- package/components/collapse/index.cjs +1 -1
- package/components/collapse/index.mjs +19 -22
- package/components/collapse-item/index.cjs +1 -1
- package/components/collapse-item/index.mjs +21 -21
- package/components/collapse-item/src/index.vue.d.ts +2 -2
- package/components/color-picker/index.cjs +1 -1
- package/components/color-picker/index.mjs +26 -27
- package/components/color-picker/src/ctx.d.ts +7 -2
- package/components/color-picker/src/index.vue.d.ts +17 -6
- package/components/{style.css → components.css} +1 -1
- package/components/date-picker/index.cjs +1 -1
- package/components/date-picker/index.mjs +40 -41
- package/components/date-picker/src/ctx.d.ts +8 -3
- package/components/date-picker/src/index.vue.d.ts +17 -6
- package/components/date-picker-range/index.cjs +1 -1
- package/components/date-picker-range/index.mjs +17 -17
- package/components/date-picker-range/src/ctx.d.ts +14 -9
- package/components/date-picker-range/src/index.vue.d.ts +48 -26
- package/components/dialog/index.cjs +1 -1
- package/components/dialog/index.mjs +41 -52
- package/components/dialog/src/ctx.d.ts +1 -1
- package/components/dialog/src/index.vue.d.ts +1 -1
- package/components/dialog-input-collection/index.cjs +1 -1
- package/components/dialog-input-collection/index.mjs +124 -122
- package/components/dialog-input-collection/src/ctx.d.ts +7 -2
- package/components/dialog-input-collection/src/dialog-form.vue.d.ts +1 -1
- package/components/dialog-input-collection/src/index.vue.d.ts +17 -6
- package/components/download-plus/index.cjs +1 -1
- package/components/download-plus/index.mjs +193 -202
- package/components/download-plus/src/ctx.d.ts +7 -2
- package/components/download-plus/src/index.vue.d.ts +32 -10
- package/components/editable-text/index.cjs +1 -1
- package/components/editable-text/index.mjs +72 -75
- package/components/editable-text/src/ctx.d.ts +7 -2
- package/components/editable-text/src/index.vue.d.ts +18 -7
- package/components/el-slider/index.cjs +1 -1
- package/components/el-slider/index.mjs +230 -233
- package/components/el-slider/src/composables/index.cjs +1 -1
- package/components/el-slider/src/composables/index.mjs +1 -1
- package/components/el-slider/src/slider-core.vue.d.ts +3 -3
- package/components/esri-input-geojson/index.cjs +1 -5
- package/components/esri-input-geojson/index.mjs +59 -68
- package/components/esri-input-geojson/src/append.vue.d.ts +2 -2
- package/components/esri-input-geojson/src/ctx.d.ts +9 -4
- package/components/esri-input-geojson/src/index.vue.d.ts +65 -30
- package/components/fieldset/src/index.vue.d.ts +1 -1
- package/components/form/index.cjs +1 -1
- package/components/form/index.mjs +96 -101
- package/components/form/src/ctx.d.ts +2 -2
- package/components/form/src/index.vue.d.ts +4 -4
- package/components/form/src/use.d.ts +2 -2
- package/components/form-item/index.cjs +1 -1
- package/components/form-item/index.mjs +179 -107
- package/components/form-item/src/core.vue.d.ts +7 -3
- package/components/form-item/src/ctx.d.ts +7 -1
- package/components/form-item/src/index.vue.d.ts +13 -2
- package/components/form-item/src/use.d.ts +11 -0
- package/components/form-item-renderer/index.cjs +1 -1
- package/components/form-item-renderer/index.d.ts +1 -0
- package/components/form-item-renderer/index.mjs +85 -78
- package/components/form-item-renderer/src/use.d.ts +3 -0
- package/components/forms-provider/index.cjs +1 -1
- package/components/forms-provider/index.mjs +18 -21
- package/components/index-BIo_4rr_.mjs +18620 -0
- package/components/index-Bc7UifHG.js +1 -0
- package/components/index-D0D9ABpH.js +108 -0
- package/components/{index-CeHbpfCD.mjs → index-DCNYT7Wv.mjs} +0 -1
- package/components/information-collection/index.cjs +1 -1
- package/components/information-collection/index.mjs +32 -38
- package/components/information-collection/src/ctx.d.ts +7 -2
- package/components/information-collection/src/index.vue.d.ts +17 -6
- package/components/information-tag/index.cjs +1 -1
- package/components/information-tag/index.mjs +9 -12
- package/components/information-tag/src/index.vue.d.ts +1 -1
- package/components/input/index.cjs +1 -1
- package/components/input/index.mjs +27 -27
- package/components/input/src/ctx.d.ts +9 -4
- package/components/input/src/index.vue.d.ts +35 -13
- package/components/input-array/index.cjs +1 -1
- package/components/input-array/index.mjs +71 -74
- package/components/input-array/src/ctx.d.ts +7 -2
- package/components/input-array/src/index.vue.d.ts +18 -7
- package/components/input-collection/index.cjs +1 -1
- package/components/input-collection/index.mjs +121 -126
- package/components/input-collection/src/core.vue.d.ts +17 -6
- package/components/input-collection/src/ctx.d.ts +7 -2
- package/components/input-collection/src/index.vue.d.ts +17 -6
- package/components/input-file/src/index.vue.d.ts +19 -8
- package/components/input-link/index.cjs +1 -1
- package/components/input-link/index.mjs +1 -1
- package/components/input-link/src/ctx.d.ts +7 -2
- package/components/input-link/src/index.vue.d.ts +54 -21
- package/components/input-number/index.cjs +1 -1
- package/components/input-number/index.mjs +30 -33
- package/components/input-number/src/ctx.d.ts +8 -3
- package/components/input-number/src/index.vue.d.ts +33 -11
- package/components/input-tag/index.cjs +1 -1
- package/components/input-tag/index.mjs +24 -24
- package/components/input-tag/src/ctx.d.ts +9 -4
- package/components/input-tag/src/index.vue.d.ts +33 -11
- package/components/monaco-editor/src/ctx.d.ts +8 -3
- package/components/monaco-editor/src/index.vue.d.ts +38 -16
- package/components/radio/src/ctx.d.ts +7 -2
- package/components/radio/src/index.vue.d.ts +40 -18
- package/components/radio/src/wraper.vue.d.ts +22 -11
- package/components/renderer-data/index.cjs +1 -1
- package/components/renderer-data/index.mjs +14 -17
- package/components/select/index.cjs +1 -1
- package/components/select/index.mjs +167 -131
- package/components/select/src/core.vue.d.ts +96 -69
- package/components/select/src/ctx.d.ts +9 -4
- package/components/select/src/index.vue.d.ts +53 -42
- package/components/slider/index.cjs +1 -1
- package/components/slider/index.mjs +30 -31
- package/components/slider/src/ctx.d.ts +7 -2
- package/components/slider/src/index.vue.d.ts +18 -7
- package/components/switch/src/ctx.d.ts +7 -2
- package/components/switch/src/index.vue.d.ts +18 -7
- package/components/tables-select/index.cjs +1 -1
- package/components/tables-select/index.mjs +4 -4
- package/components/tables-select/src/ctx.d.ts +68 -68
- package/components/tables-select/src/index.vue.d.ts +52 -420
- package/components/template-instances-provider/index.cjs +1 -1
- package/components/template-instances-provider/index.mjs +11 -17
- package/components/templates-default/src/index.vue.d.ts +404 -185
- package/components/templates-esri/src/index.vue.d.ts +65 -30
- package/components/templates-variant/src/index.vue.d.ts +48 -26
- package/components/time-picker/index.cjs +1 -1
- package/components/time-picker/index.mjs +38 -39
- package/components/time-picker/src/ctx.d.ts +8 -3
- package/components/time-picker/src/index.vue.d.ts +17 -6
- package/components/upload/index.cjs +1 -1
- package/components/upload/index.mjs +244 -253
- package/components/upload/src/ctx.d.ts +8 -3
- package/components/upload/src/file.vue.d.ts +3 -3
- package/components/upload/src/index.vue.d.ts +37 -15
- package/components/upload/src/wraper.vue.d.ts +19 -8
- package/components/upload-plus/index.cjs +7 -15
- package/components/upload-plus/index.mjs +1879 -1897
- package/components/upload-plus/src/ctx.d.ts +7 -2
- package/components/upload-plus/src/index.vue.d.ts +18 -7
- package/components/use-watch-C3iIa2DX.js +1 -0
- package/components/use-watch-Dp64x0si.mjs +411 -0
- package/components/van-cascader/src/ctx.d.ts +7 -2
- package/components/van-cascader/src/index.vue.d.ts +19 -8
- package/components/var-datetime-picker/src/ctx.d.ts +7 -2
- package/components/var-datetime-picker/src/index.vue.d.ts +30 -8
- package/components/vditor/src/ctx.d.ts +7 -2
- package/components/vditor/src/index.vue.d.ts +41 -19
- package/composables/element-plus/index.cjs +1 -1
- package/composables/element-plus/index.mjs +10 -10
- package/composables/form-mitt/index.mjs +1 -1
- package/composables/index.cjs +1 -1
- package/composables/index.mjs +53 -53
- package/index.css +1 -1
- package/locale/index.cjs +1 -1
- package/locale/index.mjs +8 -5
- package/locale/lang/ar.d.ts +1 -0
- package/locale/lang/en.d.ts +1 -0
- package/locale/lang/zh-cn.d.ts +1 -0
- package/package.json +9 -1
- package/shared/element-plus/ctx.d.ts +16 -16
- package/shared/types/source/index.d.ts +5 -0
- package/shared/upload/index.cjs +1 -1
- package/shared/upload/index.mjs +166 -165
- package/components/cloneDeep-DaYwfXwD.js +0 -1
- package/components/index-BBriTmQP.js +0 -1
- package/components/use-watch-Bfrz9pv_.js +0 -1
- package/components/use-watch-t49wP7jy.mjs +0 -414
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const B=require("@vunk/form/components/form-item"),e=require("vue"),z=require("@skzz/platform/api/basic"),R=require("@skzz/platform/shared/fetch/platform"),I=require("element-plus"),N=require("@vunk/core/shared/utils-fetch"),T=require("../index-BNPcMpOO.js"),U=require("@vunk/core/composables"),E=require("../index-Bc7UifHG.js"),$=require("@vunk/core/shared/utils-class"),x=require("@vunk/form/composables/element-plus"),H=require("../_plugin-vue_export-helper-BHFhmbuH.js"),M={...B._VkfFormItemCtx.props,fileId:{type:String,default:""},url:{type:String,default:void 0},chunkSize:{type:Number,default:1024*1024*10},fileServiceType:{type:String,default:void 0},fileStatus:{type:String,default:void 0}},O={"update:fileStatus":null};var n=(t=>(t.wait="wait",t.doPause="doPause",t.pause="pause",t.doDownload="doDownload",t.downloading="downloading",t.error="error",t.done="done",t))(n||{});const q=new N.RestFetch({baseURL:R.restFetch.baseURL,presetRequestInit:t=>{const i=t.headers,w=T.getToken();return w&&i.set("Token",w),t}}),j=(t,i)=>new Promise((w,m)=>{const o=new XMLHttpRequest;let y=`${q.baseURL}/file/downloadByRange?fileId=${t.fileId}`;t.fileServiceType&&(y+=`&fileServiceType=${t.fileServiceType}`,o.setRequestHeader("fileServiceType",t.fileServiceType)),i?.onprogress&&(o.onprogress=i?.onprogress),o.open("GET",y,!0),o.responseType="blob",o.setRequestHeader("Token",T.getToken()),o.setRequestHeader("tenant","default"),o.setRequestHeader("application","platform"),o.setRequestHeader("Content-Range",`bytes=${t.start}-${t.end}`),o.setRequestHeader("Accept-Ranges","bytes"),o.onreadystatechange=g=>{const l=g.target;if(o.readyState===4)if(o.status===200||o.status===206){if(i?.xhrs){const k=i.xhrs.findIndex(a=>a===o);i.xhrs.splice(k,1)}w({data:l.response})}else o.status===500&&m(l.response)},o.onerror=()=>{m(o.response)};try{o.send()}catch(g){m(g)}i?.xhrs?.push(o)}),A=e.defineComponent({name:"VkfDownloadPlus",components:{VkfFormItem:B.VkfFormItem,ElButtonGroup:I.ElButtonGroup,ElButton:I.ElButton,ElInput:I.ElInput},props:M,emits:O,setup(t,{emit:i}){const w=B._VkfFormItemCtx.createBindProps(t),{tr:m}=x.useLocale();e.watchEffect(()=>{q.baseURL=t.url||R.restFetch.baseURL});const o=e.ref();y(),e.watch(()=>t.fileId,y);function y(){t.fileId&&z.rFile({fileId:t.fileId}).then(s=>{o.value=s})}const g=e.computed(()=>a.value===n.error?E.circle_close_filled_default:E.download_default),l=e.ref([]),k=e.ref([]),a=U.useModelComputed({default:n.wait,key:"fileStatus"},t,i),c=()=>{if(!o.value)return;const s=o.value.size,v=o.value.id,C=Math.ceil(s/t.chunkSize);l.value=Array.from({length:C},(p,r)=>{const d=r*t.chunkSize,h=Math.min(d+t.chunkSize,s)-1;let b={};return l.value[r]&&l.value[r].start===d&&l.value[r].end===h&&l.value[r].status===n.done&&(b=l.value[r]),{start:d,end:h,index:r,status:n.wait,fileId:v,fileServiceType:t.fileServiceType,progress:0,...b}}),a.value=n.downloading;const S=l.value.filter(p=>p.status===n.wait||p.status===n.error);F(S).then(()=>{const p=l.value.map(r=>r.data);return new Blob(p,{type:"application/octet-stream"})}).then(p=>{const r=URL.createObjectURL(p),d=document.createElement("a");d.href=r,d.download=o.value?.realName||m("vkf.downloadPlus.unknownFile","未知文件"),d.click(),URL.revokeObjectURL(r)}).then(()=>{a.value=n.done}).catch(()=>{a.value=n.error,I.ElMessage.error(m("vkf.downloadPlus.downloadFailed","下载失败"))})};e.watch(()=>a.value,s=>{s===n.doDownload&&c()});function F(s,v=4,C=10){return new Promise((S,p)=>{const r=s.length;let d=0;if(r===0)return S(void 0);const h=[],b=async()=>{for(;d<r&&v>0;){v--;const D=s.findIndex(u=>u.status===n.wait||u.status===n.error),f=s[D];f&&(f.status=n.downloading,j(f,{onprogress(u){f.progress=parseInt(u.loaded/u.total*100+"")},xhrs:k.value}).then(u=>{f.status=n.done,f.data=u.data,v++,d++}).then(()=>{d===r?S(void 0):b()}).catch(()=>{f.status=n.error;const u=f.index;if(typeof h[u]!="number"&&(h[u]=0),h[u]++,console.warn(u,f,h[u],"次报错"),f.progress=-1,h[u]>=C)return p();v++,b()}))}};b()})}const _=()=>{k.value.forEach(s=>{s.abort()}),k.value=[],a.value=n.pause};e.watch(()=>a.value,s=>{s===n.doPause&&_()}),e.onBeforeUnmount(()=>{_()});class L extends $.ToggleHandler{listener;constructor(v){super(),this.listener=v}add(){window.addEventListener("online",this.listener),this.removeHandler=()=>{window.removeEventListener("online",this.listener)}}}const P=new L(()=>{a.value===n.error&&(a.value=n.doDownload)});return P.add(),e.onBeforeUnmount(()=>{P.remove()}),{formItemBindProps:w,fileInfo:o,handleDownload:c,handlePause:_,Status:n,chunks:l,fileStatus:a,filePrefixIcon:g,tr:m}}}),G={class:"vkf-download-plus-main"},X={class:"vkf-download-plus-label"},J={key:0,class:"vkf-download-plus-cube-x"};function K(t,i,w,m,o,y){const g=e.resolveComponent("ElInput"),l=e.resolveComponent("el-button"),k=e.resolveComponent("el-button-group"),a=e.resolveComponent("VkfFormItem");return e.openBlock(),e.createBlock(a,e.mergeProps(t.formItemBindProps,{class:"vkf-download-plus"}),{default:e.withCtx(()=>[e.createElementVNode("div",G,[e.createElementVNode("label",X,[e.createVNode(g,{class:e.normalizeClass({"is-error":t.fileStatus===t.Status.error}),"prefix-icon":t.filePrefixIcon,"model-value":t.fileInfo?.realName,readonly:""},null,8,["class","prefix-icon","model-value"]),t.fileStatus===t.Status.downloading||t.fileStatus===t.Status.pause?(e.openBlock(),e.createElementBlock("div",J,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.chunks,c=>(e.openBlock(),e.createElementBlock("div",{key:c.fileId+"-"+c.index,class:e.normalizeClass(["vkf-download-plus-cube",{error:c.status==t.Status.error}]),style:e.normalizeStyle({width:100/t.chunks.length+"%"})},[e.createElementVNode("div",{class:e.normalizeClass({uploading:c.progress>0&&c.progress<100,success:c.progress==100}),style:e.normalizeStyle({height:c.progress+"%"})},null,6)],6))),128))])):e.createCommentVNode("",!0)]),e.createVNode(k,{class:"vkf-download-plus-btng"},{default:e.withCtx(()=>[t.fileStatus===t.Status.downloading?(e.openBlock(),e.createBlock(l,{key:0,type:"danger",onClick:t.handlePause},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.tr("vkf.common.pause","暂停")),1)]),_:1},8,["onClick"])):(e.openBlock(),e.createBlock(l,{key:1,type:"primary",onClick:t.handleDownload},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.tr("vkf.common.download","下载")),1)]),_:1},8,["onClick"]))]),_:1})])]),_:1},16)}const V=H._export_sfc(A,[["render",K]]),Q=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));exports.VkfDownloadPlus=V;exports.__VkfDownloadPlus=Q;exports.default=V;
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import { _ as me } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
16
|
-
const ve = {
|
|
17
|
-
...M.props,
|
|
1
|
+
import { _VkfFormItemCtx as q, VkfFormItem as G } from "@vunk/form/components/form-item";
|
|
2
|
+
import { defineComponent as X, watchEffect as J, ref as T, watch as C, computed as K, onBeforeUnmount as V, resolveComponent as I, openBlock as b, createBlock as L, mergeProps as Q, withCtx as _, createElementVNode as E, createVNode as U, normalizeClass as F, createElementBlock as B, Fragment as W, renderList as Y, normalizeStyle as $, createCommentVNode as Z, createTextVNode as z, toDisplayString as H } from "vue";
|
|
3
|
+
import { rFile as ee } from "@skzz/platform/api/basic";
|
|
4
|
+
import { restFetch as N } from "@skzz/platform/shared/fetch/platform";
|
|
5
|
+
import { ElInput as te, ElButton as oe, ElButtonGroup as ne, ElMessage as re } from "element-plus";
|
|
6
|
+
import { RestFetch as se } from "@vunk/core/shared/utils-fetch";
|
|
7
|
+
import { g as M } from "../index-DJv1MwwH.mjs";
|
|
8
|
+
import { useModelComputed as le } from "@vunk/core/composables";
|
|
9
|
+
import { b as ae, f as de } from "../index-DCNYT7Wv.mjs";
|
|
10
|
+
import { ToggleHandler as ie } from "@vunk/core/shared/utils-class";
|
|
11
|
+
import { useLocale as ue } from "@vunk/form/composables/element-plus";
|
|
12
|
+
import { _ as fe } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
13
|
+
const ce = {
|
|
14
|
+
...q.props,
|
|
18
15
|
fileId: {
|
|
19
16
|
type: String,
|
|
20
17
|
default: ""
|
|
@@ -42,164 +39,161 @@ const ve = {
|
|
|
42
39
|
type: String,
|
|
43
40
|
default: void 0
|
|
44
41
|
}
|
|
45
|
-
},
|
|
42
|
+
}, pe = {
|
|
46
43
|
"update:fileStatus": null
|
|
47
44
|
};
|
|
48
|
-
var
|
|
49
|
-
const
|
|
50
|
-
baseURL:
|
|
45
|
+
var o = /* @__PURE__ */ ((e) => (e.wait = "wait", e.doPause = "doPause", e.pause = "pause", e.doDownload = "doDownload", e.downloading = "downloading", e.error = "error", e.done = "done", e))(o || {});
|
|
46
|
+
const O = new se({
|
|
47
|
+
baseURL: N.baseURL,
|
|
51
48
|
presetRequestInit: (e) => {
|
|
52
|
-
const
|
|
53
|
-
return
|
|
49
|
+
const d = e.headers, h = M();
|
|
50
|
+
return h && d.set("Token", h), e;
|
|
54
51
|
}
|
|
55
|
-
}),
|
|
56
|
-
var y;
|
|
52
|
+
}), me = (e, d) => new Promise((h, p) => {
|
|
57
53
|
const t = new XMLHttpRequest();
|
|
58
|
-
let k = `${
|
|
59
|
-
e.fileServiceType && (k += `&fileServiceType=${e.fileServiceType}`, t.setRequestHeader("fileServiceType", e.fileServiceType)),
|
|
60
|
-
const
|
|
54
|
+
let k = `${O.baseURL}/file/downloadByRange?fileId=${e.fileId}`;
|
|
55
|
+
e.fileServiceType && (k += `&fileServiceType=${e.fileServiceType}`, t.setRequestHeader("fileServiceType", e.fileServiceType)), d?.onprogress && (t.onprogress = d?.onprogress), t.open("GET", k, !0), t.responseType = "blob", t.setRequestHeader("Token", M()), t.setRequestHeader("tenant", "default"), t.setRequestHeader("application", "platform"), t.setRequestHeader("Content-Range", `bytes=${e.start}-${e.end}`), t.setRequestHeader("Accept-Ranges", "bytes"), t.onreadystatechange = (w) => {
|
|
56
|
+
const r = w.target;
|
|
61
57
|
if (t.readyState === 4)
|
|
62
58
|
if (t.status === 200 || t.status === 206) {
|
|
63
|
-
if (
|
|
64
|
-
const
|
|
65
|
-
|
|
59
|
+
if (d?.xhrs) {
|
|
60
|
+
const g = d.xhrs.findIndex((l) => l === t);
|
|
61
|
+
d.xhrs.splice(g, 1);
|
|
66
62
|
}
|
|
67
|
-
|
|
68
|
-
data:
|
|
63
|
+
h({
|
|
64
|
+
data: r.response
|
|
69
65
|
});
|
|
70
|
-
} else t.status === 500 &&
|
|
66
|
+
} else t.status === 500 && p(r.response);
|
|
71
67
|
}, t.onerror = () => {
|
|
72
|
-
|
|
68
|
+
p(t.response);
|
|
73
69
|
};
|
|
74
70
|
try {
|
|
75
71
|
t.send();
|
|
76
|
-
} catch (
|
|
77
|
-
|
|
72
|
+
} catch (w) {
|
|
73
|
+
p(w);
|
|
78
74
|
}
|
|
79
|
-
|
|
80
|
-
}),
|
|
75
|
+
d?.xhrs?.push(t);
|
|
76
|
+
}), ve = X({
|
|
81
77
|
name: "VkfDownloadPlus",
|
|
82
78
|
components: {
|
|
83
|
-
VkfFormItem:
|
|
84
|
-
ElButtonGroup:
|
|
85
|
-
ElButton:
|
|
86
|
-
ElInput:
|
|
79
|
+
VkfFormItem: G,
|
|
80
|
+
ElButtonGroup: ne,
|
|
81
|
+
ElButton: oe,
|
|
82
|
+
ElInput: te
|
|
87
83
|
},
|
|
88
|
-
props:
|
|
89
|
-
emits:
|
|
90
|
-
setup(e, { emit:
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
84
|
+
props: ce,
|
|
85
|
+
emits: pe,
|
|
86
|
+
setup(e, { emit: d }) {
|
|
87
|
+
const h = q.createBindProps(e), { tr: p } = ue();
|
|
88
|
+
J(() => {
|
|
89
|
+
O.baseURL = e.url || N.baseURL;
|
|
94
90
|
});
|
|
95
|
-
const t =
|
|
96
|
-
k(),
|
|
91
|
+
const t = T();
|
|
92
|
+
k(), C(() => e.fileId, k);
|
|
97
93
|
function k() {
|
|
98
|
-
e.fileId &&
|
|
94
|
+
e.fileId && ee({
|
|
99
95
|
fileId: e.fileId
|
|
100
|
-
}).then((
|
|
101
|
-
t.value =
|
|
96
|
+
}).then((s) => {
|
|
97
|
+
t.value = s;
|
|
102
98
|
});
|
|
103
99
|
}
|
|
104
|
-
const
|
|
105
|
-
default:
|
|
100
|
+
const w = K(() => l.value === o.error ? ae : de), r = T([]), g = T([]), l = le({
|
|
101
|
+
default: o.wait,
|
|
106
102
|
key: "fileStatus"
|
|
107
|
-
}, e,
|
|
103
|
+
}, e, d), u = () => {
|
|
108
104
|
if (!t.value)
|
|
109
105
|
return;
|
|
110
|
-
const
|
|
111
|
-
r.value = Array.from({ length:
|
|
112
|
-
const i =
|
|
106
|
+
const s = t.value.size, m = t.value.id, P = Math.ceil(s / e.chunkSize);
|
|
107
|
+
r.value = Array.from({ length: P }, (c, n) => {
|
|
108
|
+
const i = n * e.chunkSize, v = Math.min(
|
|
113
109
|
i + e.chunkSize,
|
|
114
|
-
|
|
110
|
+
s
|
|
115
111
|
) - 1;
|
|
116
|
-
let
|
|
117
|
-
return r.value[
|
|
112
|
+
let y = {};
|
|
113
|
+
return r.value[n] && r.value[n].start === i && r.value[n].end === v && r.value[n].status === o.done && (y = r.value[n]), {
|
|
118
114
|
start: i,
|
|
119
|
-
end:
|
|
120
|
-
index:
|
|
121
|
-
status:
|
|
122
|
-
fileId:
|
|
115
|
+
end: v,
|
|
116
|
+
index: n,
|
|
117
|
+
status: o.wait,
|
|
118
|
+
fileId: m,
|
|
123
119
|
fileServiceType: e.fileServiceType,
|
|
124
120
|
progress: 0,
|
|
125
|
-
...
|
|
121
|
+
...y
|
|
126
122
|
};
|
|
127
|
-
}),
|
|
128
|
-
const
|
|
129
|
-
(
|
|
123
|
+
}), l.value = o.downloading;
|
|
124
|
+
const S = r.value.filter(
|
|
125
|
+
(c) => c.status === o.wait || c.status === o.error
|
|
130
126
|
);
|
|
131
|
-
|
|
132
|
-
const
|
|
127
|
+
x(S).then(() => {
|
|
128
|
+
const c = r.value.map((n) => n.data);
|
|
133
129
|
return new Blob(
|
|
134
|
-
|
|
130
|
+
c,
|
|
135
131
|
{ type: "application/octet-stream" }
|
|
136
132
|
);
|
|
137
|
-
}).then((
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
i.href = s, i.download = ((f = t.value) == null ? void 0 : f.realName) || v("vkf.downloadPlus.unknownFile", "未知文件"), i.click(), URL.revokeObjectURL(s);
|
|
133
|
+
}).then((c) => {
|
|
134
|
+
const n = URL.createObjectURL(c), i = document.createElement("a");
|
|
135
|
+
i.href = n, i.download = t.value?.realName || p("vkf.downloadPlus.unknownFile", "未知文件"), i.click(), URL.revokeObjectURL(n);
|
|
141
136
|
}).then(() => {
|
|
142
|
-
|
|
137
|
+
l.value = o.done;
|
|
143
138
|
}).catch(() => {
|
|
144
|
-
|
|
139
|
+
l.value = o.error, re.error(p("vkf.downloadPlus.downloadFailed", "下载失败"));
|
|
145
140
|
});
|
|
146
141
|
};
|
|
147
|
-
|
|
148
|
-
|
|
142
|
+
C(() => l.value, (s) => {
|
|
143
|
+
s === o.doDownload && u();
|
|
149
144
|
});
|
|
150
|
-
function
|
|
151
|
-
return new Promise((
|
|
152
|
-
const
|
|
145
|
+
function x(s, m = 4, P = 10) {
|
|
146
|
+
return new Promise((S, c) => {
|
|
147
|
+
const n = s.length;
|
|
153
148
|
let i = 0;
|
|
154
|
-
if (
|
|
155
|
-
return
|
|
156
|
-
const
|
|
157
|
-
for (; i <
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
(
|
|
161
|
-
),
|
|
162
|
-
|
|
163
|
-
onprogress(
|
|
164
|
-
|
|
149
|
+
if (n === 0)
|
|
150
|
+
return S(void 0);
|
|
151
|
+
const v = [], y = async () => {
|
|
152
|
+
for (; i < n && m > 0; ) {
|
|
153
|
+
m--;
|
|
154
|
+
const j = s.findIndex(
|
|
155
|
+
(a) => a.status === o.wait || a.status === o.error
|
|
156
|
+
), f = s[j];
|
|
157
|
+
f && (f.status = o.downloading, me(f, {
|
|
158
|
+
onprogress(a) {
|
|
159
|
+
f.progress = parseInt(a.loaded / a.total * 100 + "");
|
|
165
160
|
},
|
|
166
|
-
xhrs:
|
|
167
|
-
}).then((
|
|
168
|
-
|
|
161
|
+
xhrs: g.value
|
|
162
|
+
}).then((a) => {
|
|
163
|
+
f.status = o.done, f.data = a.data, m++, i++;
|
|
169
164
|
}).then(() => {
|
|
170
|
-
i ===
|
|
165
|
+
i === n ? S(void 0) : y();
|
|
171
166
|
}).catch(() => {
|
|
172
|
-
|
|
173
|
-
const
|
|
174
|
-
if (typeof
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
167
|
+
f.status = o.error;
|
|
168
|
+
const a = f.index;
|
|
169
|
+
if (typeof v[a] != "number" && (v[a] = 0), v[a]++, console.warn(
|
|
170
|
+
a,
|
|
171
|
+
f,
|
|
172
|
+
v[a],
|
|
178
173
|
"次报错"
|
|
179
|
-
),
|
|
180
|
-
return
|
|
181
|
-
|
|
174
|
+
), f.progress = -1, v[a] >= P)
|
|
175
|
+
return c();
|
|
176
|
+
m++, y();
|
|
182
177
|
}));
|
|
183
178
|
}
|
|
184
179
|
};
|
|
185
|
-
|
|
180
|
+
y();
|
|
186
181
|
});
|
|
187
182
|
}
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}),
|
|
183
|
+
const R = () => {
|
|
184
|
+
g.value.forEach((s) => {
|
|
185
|
+
s.abort();
|
|
186
|
+
}), g.value = [], l.value = o.pause;
|
|
192
187
|
};
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}),
|
|
196
|
-
|
|
188
|
+
C(() => l.value, (s) => {
|
|
189
|
+
s === o.doPause && R();
|
|
190
|
+
}), V(() => {
|
|
191
|
+
R();
|
|
197
192
|
});
|
|
198
|
-
class
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
this.listener = I;
|
|
193
|
+
class A extends ie {
|
|
194
|
+
listener;
|
|
195
|
+
constructor(m) {
|
|
196
|
+
super(), this.listener = m;
|
|
203
197
|
}
|
|
204
198
|
add() {
|
|
205
199
|
window.addEventListener("online", this.listener), this.removeHandler = () => {
|
|
@@ -207,100 +201,97 @@ const A = new de({
|
|
|
207
201
|
};
|
|
208
202
|
}
|
|
209
203
|
}
|
|
210
|
-
const
|
|
211
|
-
|
|
204
|
+
const D = new A(() => {
|
|
205
|
+
l.value === o.error && (l.value = o.doDownload);
|
|
212
206
|
});
|
|
213
|
-
return
|
|
214
|
-
|
|
207
|
+
return D.add(), V(() => {
|
|
208
|
+
D.remove();
|
|
215
209
|
}), {
|
|
216
|
-
formItemBindProps:
|
|
210
|
+
formItemBindProps: h,
|
|
217
211
|
fileInfo: t,
|
|
218
|
-
handleDownload:
|
|
219
|
-
handlePause:
|
|
220
|
-
Status:
|
|
212
|
+
handleDownload: u,
|
|
213
|
+
handlePause: R,
|
|
214
|
+
Status: o,
|
|
221
215
|
chunks: r,
|
|
222
|
-
fileStatus:
|
|
223
|
-
filePrefixIcon:
|
|
224
|
-
tr:
|
|
216
|
+
fileStatus: l,
|
|
217
|
+
filePrefixIcon: w,
|
|
218
|
+
tr: p
|
|
225
219
|
};
|
|
226
220
|
}
|
|
227
|
-
}),
|
|
221
|
+
}), he = { class: "vkf-download-plus-main" }, we = { class: "vkf-download-plus-label" }, ge = {
|
|
228
222
|
key: 0,
|
|
229
223
|
class: "vkf-download-plus-cube-x"
|
|
230
224
|
};
|
|
231
|
-
function
|
|
232
|
-
const
|
|
233
|
-
return
|
|
234
|
-
default:
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
225
|
+
function ke(e, d, h, p, t, k) {
|
|
226
|
+
const w = I("ElInput"), r = I("el-button"), g = I("el-button-group"), l = I("VkfFormItem");
|
|
227
|
+
return b(), L(l, Q(e.formItemBindProps, { class: "vkf-download-plus" }), {
|
|
228
|
+
default: _(() => [
|
|
229
|
+
E("div", he, [
|
|
230
|
+
E("label", we, [
|
|
231
|
+
U(w, {
|
|
232
|
+
class: F({
|
|
233
|
+
"is-error": e.fileStatus === e.Status.error
|
|
234
|
+
}),
|
|
235
|
+
"prefix-icon": e.filePrefixIcon,
|
|
236
|
+
"model-value": e.fileInfo?.realName,
|
|
237
|
+
readonly: ""
|
|
238
|
+
}, null, 8, ["class", "prefix-icon", "model-value"]),
|
|
239
|
+
e.fileStatus === e.Status.downloading || e.fileStatus === e.Status.pause ? (b(), B("div", ge, [
|
|
240
|
+
(b(!0), B(W, null, Y(e.chunks, (u) => (b(), B("div", {
|
|
241
|
+
key: u.fileId + "-" + u.index,
|
|
242
|
+
class: F(["vkf-download-plus-cube", {
|
|
243
|
+
error: u.status == e.Status.error
|
|
244
|
+
}]),
|
|
245
|
+
style: $({
|
|
246
|
+
width: 100 / e.chunks.length + "%"
|
|
247
|
+
})
|
|
248
|
+
}, [
|
|
249
|
+
E("div", {
|
|
250
|
+
class: F({
|
|
251
|
+
uploading: u.progress > 0 && u.progress < 100,
|
|
252
|
+
success: u.progress == 100
|
|
253
|
+
}),
|
|
254
|
+
style: $({
|
|
255
|
+
height: u.progress + "%"
|
|
255
256
|
})
|
|
256
|
-
},
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
257
|
+
}, null, 6)
|
|
258
|
+
], 6))), 128))
|
|
259
|
+
])) : Z("", !0)
|
|
260
|
+
]),
|
|
261
|
+
U(g, { class: "vkf-download-plus-btng" }, {
|
|
262
|
+
default: _(() => [
|
|
263
|
+
e.fileStatus === e.Status.downloading ? (b(), L(r, {
|
|
264
|
+
key: 0,
|
|
265
|
+
type: "danger",
|
|
266
|
+
onClick: e.handlePause
|
|
267
|
+
}, {
|
|
268
|
+
default: _(() => [
|
|
269
|
+
z(H(e.tr("vkf.common.pause", "暂停")), 1)
|
|
270
|
+
]),
|
|
271
|
+
_: 1
|
|
272
|
+
}, 8, ["onClick"])) : (b(), L(r, {
|
|
273
|
+
key: 1,
|
|
274
|
+
type: "primary",
|
|
275
|
+
onClick: e.handleDownload
|
|
276
|
+
}, {
|
|
277
|
+
default: _(() => [
|
|
278
|
+
z(H(e.tr("vkf.common.download", "下载")), 1)
|
|
279
|
+
]),
|
|
280
|
+
_: 1
|
|
281
|
+
}, 8, ["onClick"]))
|
|
268
282
|
]),
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
type: "danger",
|
|
274
|
-
onClick: e.handlePause
|
|
275
|
-
}, {
|
|
276
|
-
default: P(() => [
|
|
277
|
-
q(N(e.tr("vkf.common.pause", "暂停")), 1)
|
|
278
|
-
]),
|
|
279
|
-
_: 1
|
|
280
|
-
}, 8, ["onClick"])) : (S(), E(r, {
|
|
281
|
-
key: 1,
|
|
282
|
-
type: "primary",
|
|
283
|
-
onClick: e.handleDownload
|
|
284
|
-
}, {
|
|
285
|
-
default: P(() => [
|
|
286
|
-
q(N(e.tr("vkf.common.download", "下载")), 1)
|
|
287
|
-
]),
|
|
288
|
-
_: 1
|
|
289
|
-
}, 8, ["onClick"]))
|
|
290
|
-
]),
|
|
291
|
-
_: 1
|
|
292
|
-
})
|
|
293
|
-
])
|
|
294
|
-
];
|
|
295
|
-
}),
|
|
283
|
+
_: 1
|
|
284
|
+
})
|
|
285
|
+
])
|
|
286
|
+
]),
|
|
296
287
|
_: 1
|
|
297
288
|
}, 16);
|
|
298
289
|
}
|
|
299
|
-
const
|
|
290
|
+
const Be = /* @__PURE__ */ fe(ve, [["render", ke]]), De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
300
291
|
__proto__: null
|
|
301
292
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
302
293
|
export {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
294
|
+
Be as VkfDownloadPlus,
|
|
295
|
+
De as __VkfDownloadPlus,
|
|
296
|
+
Be as default
|
|
306
297
|
};
|
|
@@ -30,6 +30,8 @@ export declare const props: {
|
|
|
30
30
|
default: undefined;
|
|
31
31
|
};
|
|
32
32
|
required: import("element-plus/es/utils/index.mjs").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
33
|
+
error: StringConstructor;
|
|
34
|
+
prop: null;
|
|
33
35
|
labelPosition: {
|
|
34
36
|
type: PropType<"left" | "right" | "top" | "start" | "end">;
|
|
35
37
|
default: undefined;
|
|
@@ -67,12 +69,16 @@ export declare const props: {
|
|
|
67
69
|
type: BooleanConstructor;
|
|
68
70
|
default: boolean;
|
|
69
71
|
};
|
|
70
|
-
prop: null;
|
|
71
72
|
defaultModelValue: null;
|
|
72
73
|
labelTipProps: {
|
|
73
74
|
type: PropType<import("element-plus").UseTooltipProps>;
|
|
74
75
|
default: () => {};
|
|
75
76
|
};
|
|
77
|
+
ai: {
|
|
78
|
+
type: PropType<import("../../ai-provider").AiConfig>;
|
|
79
|
+
default: undefined;
|
|
80
|
+
};
|
|
81
|
+
aiOutput: null;
|
|
76
82
|
label: StringConstructor;
|
|
77
83
|
labelWidth: {
|
|
78
84
|
readonly type: PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>>;
|
|
@@ -86,7 +92,6 @@ export declare const props: {
|
|
|
86
92
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
87
93
|
__epPropKey: true;
|
|
88
94
|
};
|
|
89
|
-
error: StringConstructor;
|
|
90
95
|
validateStatus: {
|
|
91
96
|
readonly type: PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "" | "success" | "error" | "validating", unknown>>;
|
|
92
97
|
readonly required: false;
|