@vunk/form 2.19.0 → 2.19.2

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