@qynpm/ui 1.0.35 → 1.0.36

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 (65) hide show
  1. package/README.md +63 -28
  2. package/dist/index.cjs +4 -3
  3. package/dist/index.mjs +60 -58
  4. package/dist/qy-action-bar/index.cjs +1 -1
  5. package/dist/qy-action-bar/index.mjs +1 -1
  6. package/dist/qy-dialog/index.cjs +1 -1
  7. package/dist/qy-dialog/index.mjs +1 -1
  8. package/dist/qy-drawer/index.cjs +1 -1
  9. package/dist/qy-drawer/index.mjs +1 -1
  10. package/dist/qy-file-picker/index.cjs +1 -1
  11. package/dist/qy-file-picker/index.mjs +1 -1
  12. package/dist/qy-form-section/index.cjs +1 -1
  13. package/dist/qy-form-section/index.mjs +1 -1
  14. package/dist/qy-image-upload/index.cjs +1 -1
  15. package/dist/qy-image-upload/index.mjs +1 -1
  16. package/dist/qy-input-number/index.cjs +1 -1
  17. package/dist/qy-input-number/index.mjs +1 -1
  18. package/dist/qy-input-tag/index.cjs +1 -0
  19. package/dist/qy-input-tag/index.mjs +7 -0
  20. package/dist/qy-legacy-selection-dialog/index.cjs +1 -1
  21. package/dist/qy-legacy-selection-dialog/index.mjs +1 -1
  22. package/dist/qy-money-input/index.cjs +1 -1
  23. package/dist/qy-money-input/index.mjs +5 -2
  24. package/dist/qy-record-quote-search/index.cjs +1 -1
  25. package/dist/qy-record-quote-search/index.mjs +1 -1
  26. package/dist/qy-remark-image/index.cjs +1 -1
  27. package/dist/qy-remark-image/index.mjs +1 -1
  28. package/dist/qy-remote-select/index.cjs +1 -1
  29. package/dist/qy-remote-select/index.mjs +1 -1
  30. package/dist/qy-search-input/index.cjs +1 -1
  31. package/dist/qy-search-input/index.mjs +1 -1
  32. package/dist/qy-selection-dialog/index.cjs +1 -1
  33. package/dist/qy-selection-dialog/index.mjs +1 -1
  34. package/dist/qy-upload/index.cjs +1 -1
  35. package/dist/qy-upload/index.mjs +5 -2
  36. package/dist/shared/index-BYX0biqw.mjs +766 -0
  37. package/dist/shared/index-BxxwEr52.mjs +107 -0
  38. package/dist/shared/index-C1i-hd-W.cjs +1 -0
  39. package/dist/shared/index-D654b42n.mjs +2754 -0
  40. package/dist/shared/index-DnNIseRJ.cjs +1 -0
  41. package/dist/shared/index-aIqtIYsu.cjs +1 -0
  42. package/dist/shared/index.vue_vue_type_script_setup_true_lang-BiIgNax-.cjs +1 -0
  43. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DIWWHODS.mjs +197 -0
  44. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DwFGEW4B.mjs +143 -0
  45. package/dist/shared/index.vue_vue_type_script_setup_true_lang-ccFLNRry.cjs +1 -0
  46. package/dist/shared/index.vue_vue_type_style_index_0_lang-B1FgJZbw.mjs +148 -0
  47. package/dist/shared/index.vue_vue_type_style_index_0_lang-DVXf-yUs.cjs +1 -0
  48. package/index.d.ts +82 -25
  49. package/package.json +489 -483
  50. package/qy-file-picker/index.d.ts +4 -1
  51. package/qy-image-preview/index.d.ts +0 -1
  52. package/qy-image-upload/index.d.ts +69 -12
  53. package/qy-input/index.d.ts +76 -18
  54. package/qy-input-number/index.d.ts +64 -30
  55. package/qy-input-tag/index.d.ts +69 -0
  56. package/qy-money-input/index.d.ts +87 -12
  57. package/qy-upload/index.d.ts +99 -5
  58. package/dist/shared/index-BekN1g_r.mjs +0 -3541
  59. package/dist/shared/index-BkX9xlbI.cjs +0 -1
  60. package/dist/shared/index-C_1KP3l9.mjs +0 -129
  61. package/dist/shared/index-Ce_hvR--.cjs +0 -1
  62. package/dist/shared/index.vue_vue_type_style_index_0_lang-B0CXLnL1.mjs +0 -132
  63. package/dist/shared/index.vue_vue_type_style_index_0_lang-DccRGtZE.cjs +0 -1
  64. /package/dist/shared/{index.vue_vue_type_script_setup_true_lang-q37rBg6Z.mjs → index.vue_vue_type_script_setup_true_lang-CGsXVhJy.mjs} +0 -0
  65. /package/dist/shared/{index.vue_vue_type_script_setup_true_lang-CglCPcj-.cjs → index.vue_vue_type_script_setup_true_lang-Dk83TGiU.cjs} +0 -0
@@ -0,0 +1,107 @@
1
+ import { defineComponent as q, ref as p, computed as B, openBlock as c, createElementBlock as u, normalizeClass as g, createVNode as S, withCtx as I, createElementVNode as h, withModifiers as t, withKeys as y, toDisplayString as K, createCommentVNode as k } from "vue";
2
+ import { U as M } from "./index-BYX0biqw.mjs";
3
+ import { _ as N } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
4
+ const U = ["tabindex", "aria-disabled", "onClick", "onKeydown"], _ = { class: "qy-file-picker__label" }, E = {
5
+ key: 0,
6
+ class: "qy-file-picker__hint"
7
+ }, P = ["disabled"], R = /* @__PURE__ */ q({
8
+ name: "QyFilePicker",
9
+ __name: "index",
10
+ props: {
11
+ modelValue: { default: null },
12
+ extensions: { default: () => [] },
13
+ maxSizeMb: { default: 20 },
14
+ disabled: { type: Boolean, default: !1 },
15
+ drag: { type: Boolean, default: !0 },
16
+ placeholder: { default: "请选择文件" }
17
+ },
18
+ emits: ["update:modelValue", "change", "clear", "invalid"],
19
+ setup(e, { expose: x, emit: V }) {
20
+ const a = e, i = V, d = p(null), n = p(!1), D = B(() => a.modelValue ? [a.modelValue] : []);
21
+ let o = !1;
22
+ function C() {
23
+ var l;
24
+ a.disabled || (l = d.value) == null || l.openFileDialog();
25
+ }
26
+ function f() {
27
+ var l;
28
+ o = !0, (l = d.value) == null || l.clearFiles(), o = !1, i("update:modelValue", null), i("change", null), i("clear");
29
+ }
30
+ function F() {
31
+ a.disabled || f();
32
+ }
33
+ function m() {
34
+ !a.disabled && a.drag && (n.value = !0);
35
+ }
36
+ function b() {
37
+ n.value = !1;
38
+ }
39
+ function w(l) {
40
+ if (o) return;
41
+ const s = l[0] ?? null;
42
+ i("update:modelValue", s), i("change", s);
43
+ }
44
+ function z(l) {
45
+ i("invalid", l);
46
+ }
47
+ return x({
48
+ openFileDialog: C,
49
+ clear: f
50
+ }), (l, s) => (c(), u("div", {
51
+ class: g(["qy-file-picker", { "is-disabled": e.disabled, "is-dragover": n.value }])
52
+ }, [
53
+ S(M, {
54
+ ref_key: "uploadRef",
55
+ ref: d,
56
+ variant: "file-list",
57
+ "auto-upload": !1,
58
+ "selected-files": D.value,
59
+ "file-type": e.extensions,
60
+ "file-size": e.maxSizeMb,
61
+ disabled: e.disabled,
62
+ "disable-drag": !e.drag,
63
+ multiple: !1,
64
+ limit: 1,
65
+ "show-text": !1,
66
+ "show-paste-input": !1,
67
+ "onUpdate:selectedFiles": w,
68
+ onInvalid: z
69
+ }, {
70
+ trigger: I(({ open: r }) => {
71
+ var v;
72
+ return [
73
+ h("div", {
74
+ class: g(["qy-file-picker__dropzone", { "is-click-only": !e.drag }]),
75
+ role: "button",
76
+ tabindex: e.disabled ? -1 : 0,
77
+ "aria-disabled": e.disabled ? "true" : void 0,
78
+ onClick: r,
79
+ onKeydown: [
80
+ y(t(r, ["prevent"]), ["enter"]),
81
+ y(t(r, ["prevent"]), ["space"])
82
+ ],
83
+ onDragenter: t(m, ["prevent"]),
84
+ onDragover: t(m, ["prevent"]),
85
+ onDragleave: t(b, ["prevent"]),
86
+ onDrop: b
87
+ }, [
88
+ h("span", _, K(((v = e.modelValue) == null ? void 0 : v.name) || e.placeholder), 1),
89
+ e.drag ? (c(), u("span", E, " 点击选择或拖拽单个文件到此处 ")) : k("", !0)
90
+ ], 42, U)
91
+ ];
92
+ }),
93
+ _: 1
94
+ }, 8, ["selected-files", "file-type", "file-size", "disabled", "disable-drag"]),
95
+ e.modelValue ? (c(), u("button", {
96
+ key: 0,
97
+ class: "qy-file-picker__clear",
98
+ type: "button",
99
+ disabled: e.disabled,
100
+ onClick: t(F, ["stop"])
101
+ }, " 清空 ", 8, P)) : k("", !0)
102
+ ], 2));
103
+ }
104
+ }), G = /* @__PURE__ */ N(R, [["__scopeId", "data-v-71a5d74d"]]);
105
+ export {
106
+ G as F
107
+ };
@@ -0,0 +1 @@
1
+ "use strict";const C=require("element-plus"),l=require("vue"),de=require("@element-plus/icons-vue"),g=require("element-plus"),Le=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");/*! js-cookie v3.0.8 | MIT */function E(r){for(var x=1;x<arguments.length;x++){var k=arguments[x];for(var a in k)a!=="__proto__"&&(r[a]=k[a])}return r}var Ie={read:function(r){return r[0]==='"'&&(r=r.slice(1,-1)),r.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(r){return encodeURIComponent(r).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function H(r,x){function k(u,V,f){if(!(typeof document>"u")){f=E({},x,f),typeof f.expires=="number"&&(f.expires=new Date(Date.now()+f.expires*864e5)),f.expires&&(f.expires=f.expires.toUTCString()),u=encodeURIComponent(u).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var y="";for(var s in f)f[s]&&(y+="; "+s,f[s]!==!0&&(y+="="+f[s].split(";")[0]));return document.cookie=u+"="+r.write(V,u)+y}}function a(u){if(!(typeof document>"u"||arguments.length&&!u)){for(var V=document.cookie?document.cookie.split("; "):[],f={},y=0;y<V.length;y++){var s=V[y].split("="),S=s.slice(1).join("=");try{var b=decodeURIComponent(s[0]);if(b in f||(f[b]=r.read(S,b)),u===b)break}catch{}}return u?f[u]:f}}return Object.create({set:k,get:a,remove:function(u,V){k(u,"",E({},V,{expires:-1}))},withAttributes:function(u){return H(this.converter,E({},this.attributes,u))},withConverter:function(u){return H(E({},this.converter,u),this.attributes)}},{attributes:{value:Object.freeze(x)},converter:{value:Object.freeze(r)}})}var ce=H(Ie,{path:"/"});const Ae="Admin-Token";function Pe(r=Ae){return ce.get(r)}const _e=["accept","multiple","disabled"],Oe=["disabled"],$e={class:"qy-upload__hint"},Ke=["placeholder","disabled"],We=["src"],He={key:1,class:"qy-upload__tip"},Xe={class:"error"},Je={class:"error"},Qe=Object.assign({name:"QyUpload"},{__name:"index",props:{modelValue:{type:[Object,Array,String],default:void 0},selectedFiles:{type:Array,default:()=>[]},autoUpload:{type:Boolean,default:!0},variant:{type:String,default:"media-card"},defaultValue:{type:Object,default:()=>({files:"",text:""})},valueFormat:{type:String,default:"object"},showText:{type:Boolean,default:!0},showPasteInput:{type:Boolean,default:!1},pastePlaceholder:{type:String,default:"输入文字"},multiple:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},fileType:{type:Array,default:()=>[]},fileSize:{type:Number,default:10},limit:{type:Number,default:9},isShowTip:{type:Boolean,default:!1},api:{type:String,default:"/permission-api/common/uploads"},name:{type:String,default:"file"},tokenKey:{type:String,default:"Admin-Token"},supportVideo:{type:Boolean,default:!1},size:{type:String,default:"default"},disableDrag:{type:Boolean,default:!1},callBack:{type:Function,default:null},extraData:{type:Object,default:()=>({})},uploadRequest:{type:Function,default:null}},emits:["update:modelValue","update:selectedFiles","selectedFilesChange","change","success","error","remove","invalid"],setup(r,{expose:x,emit:k}){const a=r,u=k,V=l.ref(null),f=l.ref(null),y=l.ref(null),s=l.ref([]),S=l.ref(null),b=l.ref(null),U=[],X=new WeakMap;let L=Date.now(),I=!1;const A=l.ref(!1),P=l.ref([]),J=l.ref(0),B=l.ref(!1),Q=l.ref(""),G=l.ref(""),q=new Set,D=l.ref(!1),h=l.ref(""),_=l.ref(!1);l.onMounted(()=>{a.modelValue!==void 0||!a.autoUpload||ee(a.defaultValue)});const pe=l.computed(()=>({large:"160px",default:"140px",small:"80px"})[a.size]??a.size),T=l.computed(()=>a.disabled),fe=l.computed(()=>s.value.some(e=>e.status==="uploading")),me=l.computed(()=>a.variant==="file-list"||a.supportVideo?"text":"picture-card"),ve=l.computed(()=>a.supportVideo?1:!a.autoUpload&&!a.multiple?2:a.limit),ge=l.computed(()=>{var e;return a.isShowTip&&(a.fileSize||((e=w.value)==null?void 0:e.length))}),w=l.computed(()=>{var e;return(e=a.fileType)!=null&&e.length?a.fileType.map(t=>String(t).trim().replace(/^\./,"").toLowerCase()).filter(Boolean):a.variant==="file-list"?[]:a.supportVideo?["mp4","mov","avi"]:["jpg","jpeg","png","gif","webp"]}),j=l.computed(()=>{if(!a.autoUpload&&!a.multiple)return!1;const e=a.supportVideo?1:a.limit;return s.value.length>=e}),Y=l.computed(()=>w.value.map(e=>`.${e}`).join(",")),ye=l.computed(()=>({"qy-upload--reached-limit":j.value,"qy-upload--disabled":a.disabled,"qy-upload--video":a.supportVideo,"qy-upload--without-text":!a.showText&&!a.showPasteInput}));l.watch(h,()=>{I||F()}),l.watch(()=>a.modelValue,e=>{a.autoUpload&&e!==void 0&&ee(e)},{immediate:!0,deep:!0}),l.watch(()=>[a.autoUpload,a.selectedFiles],([e,t])=>{e||(s.value=R(t))},{immediate:!0,deep:!0});function Z(e){return Array.isArray(e)?e.filter(Boolean):e?String(e).split(",").filter(Boolean):[]}function he(e){return Array.isArray(e)?{files:e,text:""}:typeof e=="string"?{files:Z(e),text:""}:e&&typeof e=="object"?{files:Z(e.files),text:e.text??""}:{files:[],text:""}}function we(e=[]){return e.map((t,n)=>({name:String(t).split("/").pop()||`file-${n}`,url:t,status:"success",uid:Date.now()+n}))}function R(e=[]){return e.filter(Boolean).map((t,n)=>{const i=l.toRaw(t);return{name:i.name,raw:i,status:"ready",uid:xe(i,n)}})}function xe(e,t){if(e.uid!=null)return e.uid;const n=X.get(e);return n??(L+=t+1,X.set(e,L),L)}function O(e=s.value){return e.map(t=>{const n=t.raw??(t instanceof File?t:null);return n?l.toRaw(n):null}).filter(Boolean)}function z(e){u("update:selectedFiles",e),u("selectedFilesChange",e)}function Ve(e,t){if(a.autoUpload)return;const n=e==null?void 0:e.raw;if(n&&!$(n)){s.value=R(a.selectedFiles);return}const i=O(t);n&&!i.includes(n)&&i.push(n);const o=a.multiple?i:i.slice(-1);s.value=R(o),z(o)}function ke(e){const t=new Set(e.map(i=>i.url)),n=s.value.filter(i=>i.status==="uploading"&&!t.has(i.url));return[...e,...n]}function ee(e){const t=he(e);I=!0,h.value=t.text,s.value=ke(we(t.files)),l.nextTick(()=>{I=!1})}function te(e){return a.valueFormat==="array"?e.files:a.valueFormat==="string"?e.files.join(","):e}function be(){var e;(e=S.value)==null||e.focus()}function Ue(e){e.target.value=""}function F(e){const i={files:(e??s.value).filter(o=>o.status==="success"&&o.url).map(o=>o.url),text:h.value};u("update:modelValue",te(i)),u("change",i),a.callBack&&a.callBack(i)}function Ce(e,t){if(!a.autoUpload){const n=O(t);s.value=R(n),z(n),u("remove",e,t);return}F(t),u("remove",e,t)}function le(e){var n;const t=(e==null?void 0:e.name)||"";return t.includes(".")&&((n=t.split(".").pop())==null?void 0:n.toLowerCase())||""}function ne(e){var o,d,p;const t=((d=(o=e==null?void 0:e.type)==null?void 0:o.toLowerCase)==null?void 0:d.call(o))||"",n={"image/jpeg":["jpg","jpeg"],"image/png":["png"],"image/gif":["gif"],"image/bmp":["bmp"],"image/webp":["webp"],"video/mp4":["mp4"],"video/quicktime":["mov"],"video/x-msvideo":["avi"],"video/webm":["webm"]};if(n[t])return n[t];const i=(p=t.split("/")[1])==null?void 0:p.split("+")[0];return i?[i]:[]}function Be(e){if(!w.value.length)return!0;const t=le(e),n=ne(e);return[t,...n].some(i=>w.value.includes(i))}function $(e){if(a.fileSize>0&&e.size>a.fileSize*1024*1024){const n={code:"size",file:e,message:`文件大小不能超过${a.fileSize}M`};return g.ElMessage.warning(n.message),u("invalid",n),!1}if(!Be(e)){const n={code:"extension",file:e,message:`格式不支持,仅允许: ${w.value.join("/")}`};return g.ElMessage.warning(n.message),u("invalid",n),!1}return!0}async function Re(e,t,n,i){const o=ae(e);try{const d=await a.uploadRequest({file:e,formData:o,api:a.api,name:a.name,tokenKey:a.tokenKey,extraData:a.extraData}),p=Fe(d);if(!p){const c=new Error("上传失败,未返回文件地址");g.ElMessage.error(c.message),u("error",c),n==null||n(c);return}g.ElMessage.success("上传成功"),t==null||t({...typeof d=="object"&&d?d:{},url:p})}catch(d){g.ElMessage.error("上传失败"),u("error",d),n==null||n(d)}finally{i.close()}}function ae(e){const t=new FormData;return t.append(a.name,e),a.extraData&&Object.entries(a.extraData).forEach(([n,i])=>t.append(n,i)),t}function Fe(e){var i,o;if(typeof e=="string")return e;const t=e||{},n=t.urls??t.url??((i=t.data)==null?void 0:i.urls)??((o=t.data)==null?void 0:o.url)??"";return Array.isArray(n)?n[0]||"":n||""}function ie(e,t,n,i){const o=g.ElLoading.service({target:f.value,text:"上传中",background:"rgba(255,255,255,0.7)"});if(a.uploadRequest){Re(e,n,i,o);return}const d=a.api.startsWith("http")?a.api:window.location.origin+a.api.replace(/^([^/])/,"/$1"),p=ae(e),c=new XMLHttpRequest;U.push(c);const N=()=>{const m=U.indexOf(c);m!==-1&&U.splice(m,1),o.close()};c.open("POST",d);const v=Pe(a.tokenKey);v&&c.setRequestHeader("Authorization",`Bearer ${v}`),c.upload.onprogress=m=>{m.total>0&&(t==null||t({percent:m.loaded/m.total*100}))},c.onload=()=>{if(N(),c.status<200||c.status>=300){const m=`上传失败 (HTTP ${c.status})`;g.ElMessage.error(m),u("error",{msg:m,status:c.status}),i==null||i(new Error(m));return}try{const m=JSON.parse(c.responseText);m.code===200&&m.urls?(g.ElMessage.success("上传成功"),n==null||n({...m,url:m.urls})):(g.ElMessage.error(m.msg||"上传失败"),u("error",m),i==null||i(m))}catch{g.ElMessage.error("上传失败,响应格式错误"),u("error",new Error("Response parse error")),i==null||i(new Error("Response parse error"))}},c.onerror=()=>{N(),g.ElMessage.error("上传失败,网络异常"),u("error",new Error("Network error")),i==null||i(new Error("Network error"))},c.send(p)}function oe(e){return a.disabled?!1:$(e)}function Me(e,t){const n=s.value.find(i=>{var o;return i.uid===(e==null?void 0:e.uid)||((o=i.raw)==null?void 0:o.uid)===(e==null?void 0:e.uid)});n&&(n.url=t,n.status="success")}function Ne(e){ie(e.file,e.onProgress,t=>{Me(e.file,t.url),e.onSuccess(t),F(),u("success",t)},t=>e.onError(t))}function Se(e){var i;if(!e.url)return;const t=((i=e.url.split(".").pop())==null?void 0:i.toLowerCase())||"";if(["mp4","mov","avi","webm"].includes(t)){Q.value=e.url,G.value=e.name||"视频预览",B.value=!0;return}const n=s.value.filter(o=>{var d;return o.status==="success"&&o.url&&!["mp4","mov","avi","webm"].includes((d=o.url.split(".").pop())==null?void 0:d.toLowerCase())});P.value=n.map(o=>o.url),J.value=n.findIndex(o=>o.uid===e.uid)||0,A.value=!0}function qe(){A.value=!1,P.value=[]}function De(e,t){if(e.name&&le(e))return e;const n=ne(e).find(i=>w.value.includes(i));return n?new File([e],`paste-${Date.now()+t}.${n}`,{type:e.type,lastModified:e.lastModified}):e}function K(e){if(!a.autoUpload){const t=O(),n=e.filter(o=>$(o));if(!n.length)return;const i=a.multiple?[...t,...n].slice(0,a.limit):n.slice(-1);s.value=R(i),z(i);return}for(let t=0;t<e.length;t++){const n=De(e[t],t);if(!oe(n))continue;const i=Date.now()+t,o=URL.createObjectURL(n);q.add(o),s.value.push({uid:i,name:n.name||`file-${i}`,status:"uploading",percentage:0,url:o}),ie(n,d=>{const p=s.value.find(c=>c.uid===i);p&&(p.percentage=d.percent)},d=>{const p=s.value.find(c=>c.uid===i);p&&(p.status="success",p.url=d.url,F(),u("success",d))},()=>ze(i))}}function Te(e){const t=e.target,n=Array.from(t.files||[]);if(t.value="",a.disabled||!n.length)return;const i=a.supportVideo||!a.multiple?n.slice(0,1):n;K(i)}function je(e){const t=Array.from((e==null?void 0:e.files)||[]).filter(d=>{var p;return(p=d.type)==null?void 0:p.startsWith("image/")});if(t.length)return t;const n=e==null?void 0:e.items;if(!n)return[];const i=[],o=new Set;for(let d=0;d<n.length;d++){const p=n[d];if(p.kind==="file"&&p.type.startsWith("image/")){const c=p.getAsFile();c&&!o.has(c)&&(o.add(c),i.push(c))}}return i}function M(e){if(a.disabled)return;const t=je(e.clipboardData);t.length&&(e.preventDefault(),K(t))}function re(){a.disabled||a.disableDrag||(D.value=!0)}function se(){D.value=!1}function ue(e){var n;if(D.value=!1,a.disabled||a.disableDrag||j.value)return;const t=Array.from(((n=e.dataTransfer)==null?void 0:n.files)||[]);t.length&&K(t)}function ze(e){var n;const t=s.value.findIndex(i=>i.uid===e);t!==-1&&((n=s.value[t].url)!=null&&n.startsWith("blob:")&&(URL.revokeObjectURL(s.value[t].url),q.delete(s.value[t].url)),s.value.splice(t,1))}l.onBeforeUnmount(()=>{U.forEach(e=>e.abort()),U.length=0,q.forEach(e=>URL.revokeObjectURL(e)),q.clear()});function W(){var e;a.disabled||j.value||(e=y.value)==null||e.click()}function Ee(){s.value=[],h.value="",z([]),a.autoUpload&&F()}return x({openFileDialog:W,getPathList:()=>s.value.filter(e=>e.status==="success").map(e=>e.url),clearFiles:Ee,getValue:()=>({files:s.value.filter(e=>e.status==="success"&&e.url).map(e=>e.url),text:h.value}),getModelValue:()=>te({files:s.value.filter(e=>e.status==="success"&&e.url).map(e=>e.url),text:h.value})}),(e,t)=>{var N;const n=C.ElIcon,i=C.ElInput,o=C.ElPopover,d=C.ElUpload,p=C.ElImageViewer,c=C.ElDialog;return l.openBlock(),l.createElementBlock("div",{ref_key:"rootRef",ref:f,class:l.normalizeClass(["qy-upload",ye.value]),style:l.normalizeStyle({"--qy-upload-size":pe.value})},[l.createElementVNode("input",{ref_key:"nativeInputRef",ref:y,class:"qy-upload__native-input",type:"file",accept:Y.value,multiple:r.supportVideo?!1:r.multiple,disabled:T.value,onChange:Te},null,40,_e),l.createVNode(d,{ref_key:"uploadRef",ref:V,"file-list":s.value,"onUpdate:fileList":t[7]||(t[7]=v=>s.value=v),action:"#",multiple:r.supportVideo?!1:r.multiple,limit:ve.value,"auto-upload":r.autoUpload,"list-type":me.value,accept:Y.value,disabled:T.value,"http-request":Ne,"before-upload":oe,"on-change":Ve,"on-preview":Se,"on-remove":Ce},l.createSlots({default:l.withCtx(()=>[r.variant!=="file-list"&&!j.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["qy-upload__trigger",{"is-dragover":D.value}]),onPaste:M,onDragover:l.withModifiers(re,["prevent"]),onDragleave:l.withModifiers(se,["prevent"]),onDrop:l.withModifiers(ue,["prevent"])},[l.createVNode(n,{class:"qy-upload__icon"},{default:l.withCtx(()=>[l.createVNode(l.unref(de.Plus))]),_:1}),r.supportVideo?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[t[10]||(t[10]=l.createElementVNode("span",{class:"qy-upload__label"},"点击上传视频",-1)),l.createElementVNode("span",$e,"支持 "+l.toDisplayString(w.value.join(" / "))+",不超过 "+l.toDisplayString(r.fileSize)+"MB",1)],64)):l.createCommentVNode("",!0),r.showText?(l.openBlock(),l.createElementBlock("div",{key:1,class:"qy-upload__text",onClick:t[4]||(t[4]=l.withModifiers(()=>{},["stop"])),onPaste:l.withModifiers(M,["stop"])},[l.createVNode(o,{visible:_.value,"onUpdate:visible":t[3]||(t[3]=v=>_.value=v),placement:"bottom-start",width:220,trigger:"click","popper-class":"qy-upload__text-popover",onAfterEnter:be},{reference:l.withCtx(()=>[l.createElementVNode("div",{class:l.normalizeClass(["qy-upload__text-preview",{"is-placeholder":!h.value}])},l.toDisplayString(h.value||r.pastePlaceholder),3)]),default:l.withCtx(()=>[l.createVNode(i,{ref_key:"inputRef",ref:S,modelValue:h.value,"onUpdate:modelValue":t[1]||(t[1]=v=>h.value=v),type:"textarea",autosize:{minRows:2,maxRows:5},placeholder:r.pastePlaceholder,disabled:r.disabled,onBlur:t[2]||(t[2]=v=>_.value=!1),onPaste:l.withModifiers(M,["stop"])},null,8,["modelValue","placeholder","disabled"])]),_:1},8,["visible"])],32)):r.showPasteInput?(l.openBlock(),l.createElementBlock("div",{key:2,class:"qy-upload__text",onClick:t[6]||(t[6]=l.withModifiers(()=>{},["stop"])),onPaste:l.withModifiers(M,["stop"])},[l.createElementVNode("input",{ref_key:"pasteInputRef",ref:b,class:"qy-upload__paste-input",placeholder:r.pastePlaceholder,disabled:r.disabled,onPaste:l.withModifiers(M,["stop"]),onInput:Ue,onClick:t[5]||(t[5]=l.withModifiers(()=>{},["stop"]))},null,40,Ke)],32)):l.createCommentVNode("",!0)],34)):l.createCommentVNode("",!0)]),_:2},[r.variant==="file-list"?{name:"trigger",fn:l.withCtx(()=>[l.createElementVNode("div",{class:"qy-upload__file-trigger",onClick:t[0]||(t[0]=l.withModifiers(()=>{},["stop"])),onDragover:l.withModifiers(re,["prevent"]),onDragleave:l.withModifiers(se,["prevent"]),onDrop:l.withModifiers(ue,["prevent"])},[l.renderSlot(e.$slots,"trigger",{open:W,disabled:T.value,uploading:fe.value},()=>[l.createElementVNode("button",{class:"qy-upload__file-button",type:"button",disabled:T.value,onClick:W}," 选择文件 ",8,Oe)],!0)],32)]),key:"0"}:void 0]),1032,["file-list","multiple","limit","auto-upload","list-type","accept","disabled"]),A.value?(l.openBlock(),l.createBlock(p,{key:0,"url-list":P.value,"initial-index":J.value,onClose:qe},null,8,["url-list","initial-index"])):l.createCommentVNode("",!0),l.createVNode(c,{modelValue:B.value,"onUpdate:modelValue":t[8]||(t[8]=v=>B.value=v),title:G.value,width:"640px","append-to-body":"","destroy-on-close":"",onClose:t[9]||(t[9]=v=>B.value=!1)},{default:l.withCtx(()=>[B.value?(l.openBlock(),l.createElementBlock("video",{key:0,src:Q.value,controls:"",autoplay:"",style:{width:"100%","max-height":"400px","border-radius":"4px"}},null,8,We)):l.createCommentVNode("",!0)]),_:1},8,["modelValue","title"]),ge.value?(l.openBlock(),l.createElementBlock("div",He,[l.createVNode(n,null,{default:l.withCtx(()=>[l.createVNode(l.unref(de.InfoFilled))]),_:1}),l.createElementVNode("span",null,[t[13]||(t[13]=l.createTextVNode(" 请上传 ",-1)),r.fileSize?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[t[11]||(t[11]=l.createTextVNode("大小不超过 ",-1)),l.createElementVNode("b",Xe,l.toDisplayString(r.fileSize)+"MB",1)],64)):l.createCommentVNode("",!0),(N=w.value)!=null&&N.length?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[t[12]||(t[12]=l.createTextVNode(",格式为 ",-1)),l.createElementVNode("b",Je,l.toDisplayString(w.value.join("/")),1)],64)):l.createCommentVNode("",!0),t[14]||(t[14]=l.createTextVNode(" 的文件。 ",-1))])])):l.createCommentVNode("",!0)],6)}}}),Ge=Le._export_sfc(Qe,[["__scopeId","data-v-3f7a045b"]]);exports.Upload=Ge;exports.api=ce;