@qynpm/ui 1.0.2 → 1.0.5

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 (115) hide show
  1. package/README.md +228 -59
  2. package/dist/_virtual/_plugin-vue_export-helper.cjs +1 -0
  3. package/dist/_virtual/_plugin-vue_export-helper.mjs +9 -0
  4. package/dist/index.cjs +1 -1
  5. package/dist/index.mjs +21 -0
  6. package/dist/lib/dialog/index.vue.cjs +1 -0
  7. package/dist/{index-CibtL3Up.mjs → lib/dialog/index.vue.mjs} +12 -12
  8. package/dist/lib/dialog/index.vue3.cjs +1 -0
  9. package/dist/lib/dialog/index.vue3.mjs +5 -0
  10. package/dist/lib/index.cjs +1 -0
  11. package/dist/lib/index.mjs +53 -0
  12. package/dist/lib/qy-action-bar/index.vue.cjs +1 -0
  13. package/dist/lib/qy-action-bar/index.vue.mjs +7 -0
  14. package/dist/lib/qy-action-bar/index.vue2.cjs +1 -0
  15. package/dist/{index-DlwgfuD9.mjs → lib/qy-action-bar/index.vue2.mjs} +12 -12
  16. package/dist/lib/qy-form-section/index.vue.cjs +1 -0
  17. package/dist/lib/qy-form-section/index.vue.mjs +7 -0
  18. package/dist/lib/qy-form-section/index.vue2.cjs +1 -0
  19. package/dist/{index-Cuwe7RLf.mjs → lib/qy-form-section/index.vue2.mjs} +19 -20
  20. package/dist/lib/qy-input/index.vue.cjs +1 -0
  21. package/dist/{index-CEg8yYrg.mjs → lib/qy-input/index.vue.mjs} +8 -7
  22. package/dist/lib/qy-input/index.vue2.cjs +1 -0
  23. package/dist/lib/qy-input/index.vue2.mjs +4 -0
  24. package/dist/lib/qy-money-input/index.vue.cjs +1 -0
  25. package/dist/lib/qy-money-input/index.vue.mjs +171 -0
  26. package/dist/lib/qy-money-input/index.vue2.cjs +1 -0
  27. package/dist/lib/qy-money-input/index.vue2.mjs +4 -0
  28. package/dist/lib/qy-radio-group/index.vue.cjs +1 -0
  29. package/dist/lib/qy-radio-group/index.vue.mjs +90 -0
  30. package/dist/lib/qy-radio-group/index.vue2.cjs +1 -0
  31. package/dist/lib/qy-radio-group/index.vue2.mjs +4 -0
  32. package/dist/lib/qy-record-quote-search/index.vue.cjs +1 -0
  33. package/dist/lib/qy-record-quote-search/index.vue.mjs +7 -0
  34. package/dist/lib/qy-record-quote-search/index.vue2.cjs +1 -0
  35. package/dist/{index-BzzxlJ2O.mjs → lib/qy-record-quote-search/index.vue2.mjs} +68 -69
  36. package/dist/lib/qy-remote-select/index.vue.cjs +1 -0
  37. package/dist/lib/qy-remote-select/index.vue.mjs +214 -0
  38. package/dist/lib/qy-remote-select/index.vue2.cjs +1 -0
  39. package/dist/lib/qy-remote-select/index.vue2.mjs +4 -0
  40. package/dist/lib/qy-search-input/index.vue.cjs +1 -0
  41. package/dist/lib/qy-search-input/index.vue.mjs +7 -0
  42. package/dist/lib/qy-search-input/index.vue2.cjs +1 -0
  43. package/dist/{index-C02naY8D.mjs → lib/qy-search-input/index.vue2.mjs} +77 -77
  44. package/dist/lib/qy-select/index.vue.cjs +1 -0
  45. package/dist/lib/qy-select/index.vue.mjs +162 -0
  46. package/dist/lib/qy-select/index.vue2.cjs +1 -0
  47. package/dist/lib/qy-select/index.vue2.mjs +4 -0
  48. package/dist/lib/qy-voucher-upload/index.vue.cjs +1 -0
  49. package/dist/lib/qy-voucher-upload/index.vue.mjs +123 -0
  50. package/dist/lib/remark-image/index.vue.cjs +1 -0
  51. package/dist/lib/remark-image/index.vue.mjs +7 -0
  52. package/dist/lib/remark-image/index.vue2.cjs +1 -0
  53. package/dist/lib/remark-image/index.vue2.mjs +197 -0
  54. package/dist/lib/remark-image/utils.cjs +1 -0
  55. package/dist/lib/remark-image/utils.mjs +22 -0
  56. package/dist/lib/upload/index.vue.cjs +1 -0
  57. package/dist/lib/upload/index.vue.mjs +482 -0
  58. package/dist/lib/utils/auth.cjs +1 -0
  59. package/dist/lib/utils/auth.mjs +8 -0
  60. package/dist/lib/utils/install.cjs +1 -0
  61. package/dist/{install-CxBnxbuN.mjs → lib/utils/install.mjs} +2 -2
  62. package/dist/node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.cjs +1 -0
  63. package/dist/{js.cookie-tagl12-O.mjs → node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.mjs} +6 -6
  64. package/dist/qy-action-bar/index.cjs +1 -1
  65. package/dist/qy-action-bar/index.mjs +6 -0
  66. package/dist/qy-dialog/index.cjs +1 -1
  67. package/dist/qy-dialog/index.mjs +7 -0
  68. package/dist/qy-form-section/index.cjs +1 -1
  69. package/dist/qy-form-section/index.mjs +6 -0
  70. package/dist/qy-input/index.cjs +1 -1
  71. package/dist/qy-input/index.mjs +6 -0
  72. package/dist/qy-money-input/index.cjs +1 -0
  73. package/dist/qy-money-input/index.mjs +6 -0
  74. package/dist/qy-radio-group/index.cjs +1 -0
  75. package/dist/qy-radio-group/index.mjs +6 -0
  76. package/dist/qy-record-quote-search/index.cjs +1 -1
  77. package/dist/qy-record-quote-search/index.mjs +6 -0
  78. package/dist/qy-remark-image/index.cjs +2 -2
  79. package/dist/qy-remark-image/index.mjs +7 -0
  80. package/dist/qy-remote-select/index.cjs +1 -0
  81. package/dist/qy-remote-select/index.mjs +6 -0
  82. package/dist/qy-search-input/index.cjs +1 -1
  83. package/dist/qy-search-input/index.mjs +6 -0
  84. package/dist/qy-select/index.cjs +1 -1
  85. package/dist/qy-select/index.mjs +6 -0
  86. package/dist/qy-upload/index.cjs +1 -1
  87. package/dist/qy-upload/index.mjs +6 -0
  88. package/dist/qy-voucher-upload/index.cjs +1 -0
  89. package/dist/qy-voucher-upload/index.mjs +6 -0
  90. package/index.d.ts +20 -11
  91. package/package.json +36 -12
  92. package/qy-money-input/index.d.ts +12 -0
  93. package/qy-money-input/index.js +15 -0
  94. package/qy-radio-group/index.d.ts +12 -0
  95. package/qy-radio-group/index.js +15 -0
  96. package/qy-remote-select/index.d.ts +12 -0
  97. package/qy-remote-select/index.js +15 -0
  98. package/qy-voucher-upload/index.d.ts +12 -0
  99. package/qy-voucher-upload/index.js +15 -0
  100. package/dist/index-1ocyh-Ge.js +0 -1
  101. package/dist/index-BYAIkGVF.js +0 -1
  102. package/dist/index-BaU5rDMh.js +0 -1
  103. package/dist/index-BddPsC3s.mjs +0 -384
  104. package/dist/index-CzJWU89H.js +0 -1
  105. package/dist/index-DQ-EEZgS.js +0 -1
  106. package/dist/index-Dg93AsO_.mjs +0 -216
  107. package/dist/index-Djj-T8oy.mjs +0 -137
  108. package/dist/index-Do5SZ8yS.js +0 -1
  109. package/dist/index-DooOsQ9d.js +0 -1
  110. package/dist/index-DzX3lxdp.js +0 -1
  111. package/dist/index-tC70xKe_.js +0 -1
  112. package/dist/install-c8il9DQv.js +0 -1
  113. package/dist/js.cookie-XvHV2tha.js +0 -1
  114. package/dist/plugin-vue_export-helper-BHFhmbuH.js +0 -1
  115. package/dist/plugin-vue_export-helper-CHgC5LLL.mjs +0 -9
@@ -0,0 +1,197 @@
1
+ import { defineComponent as j, useAttrs as F, ref as f, computed as z, watch as I, onMounted as K, nextTick as M, onUnmounted as O, createElementBlock as p, openBlock as v, normalizeStyle as W, createElementVNode as i, createVNode as g, unref as d, mergeProps as $, withCtx as h, createTextVNode as G } from "vue";
2
+ import { ElMessage as b, ElInput as H, ElPopover as J, ElButton as Q, ElUpload as X } from "element-plus";
3
+ import Y from "../../node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.mjs";
4
+ import { parseRemarkText as V, parseRemarkWithImage as B, formatRemarkText as Z } from "./utils.mjs";
5
+ const ee = { class: "qy-remark-image__field" }, ae = { class: "qy-remark-image__upload-anchor" }, te = {
6
+ key: 0,
7
+ class: "icon-[line-md--loading-twotone-loop]",
8
+ role: "img",
9
+ "aria-hidden": "true"
10
+ }, re = {
11
+ key: 1,
12
+ class: "icon-[ion--cloud-upload-outline]",
13
+ role: "img",
14
+ "aria-hidden": "true"
15
+ }, le = {
16
+ key: 2,
17
+ class: "icon-[ph--images-thin]",
18
+ role: "img",
19
+ "aria-hidden": "true"
20
+ }, oe = { class: "qy-remark-image__popover" }, ie = ["src"], se = { class: "qy-remark-image__popover-footer" }, fe = /* @__PURE__ */ j({
21
+ __name: "index",
22
+ props: {
23
+ defaultValue: { default: "" },
24
+ defaultImage: { default: "" },
25
+ rows: { default: 6 },
26
+ width: { default: "" },
27
+ autosize: { type: [Boolean, Object], default: !1 },
28
+ disabled: { type: Boolean, default: !1 },
29
+ placeholder: { default: "粘贴图片上传" },
30
+ type: { default: "textarea" },
31
+ api: { default: "/permission-api/common/uploads" },
32
+ tokenKey: { default: "Admin-Token" }
33
+ },
34
+ emits: ["change"],
35
+ setup(U, { expose: A, emit: P }) {
36
+ const r = U, C = P, R = F(), y = f(null), o = f(""), l = f(""), u = f(!1), S = z(
37
+ () => r.type === "text" ? "text" : "textarea"
38
+ ), D = z(() => {
39
+ if (r.width)
40
+ return {
41
+ width: typeof r.width == "number" ? `${r.width}px` : r.width
42
+ };
43
+ });
44
+ I(
45
+ () => r.defaultValue,
46
+ (e) => {
47
+ const a = V(e || "");
48
+ o.value = a.text, l.value = a.imageUrl || r.defaultImage || "";
49
+ },
50
+ { immediate: !0 }
51
+ ), I(
52
+ () => r.defaultImage,
53
+ (e) => {
54
+ e !== void 0 && !V(r.defaultValue || "").imageUrl && (l.value = e || "");
55
+ },
56
+ { immediate: !0 }
57
+ ), K(() => {
58
+ M(L);
59
+ }), O(() => {
60
+ const e = x();
61
+ e && e.removeEventListener("paste", _);
62
+ });
63
+ function x() {
64
+ var e, a;
65
+ return ((e = y.value) == null ? void 0 : e.textarea) || ((a = y.value) == null ? void 0 : a.input) || null;
66
+ }
67
+ function L() {
68
+ const e = x();
69
+ e && (e.removeEventListener("paste", _), e.addEventListener("paste", _));
70
+ }
71
+ function N(e) {
72
+ o.value = Z(e || "");
73
+ }
74
+ function E() {
75
+ l.value = "", k();
76
+ }
77
+ async function _(e) {
78
+ var n;
79
+ const s = Array.from(((n = e.clipboardData) == null ? void 0 : n.files) || []).find((m) => m.type.startsWith("image/"));
80
+ s && (e.preventDefault(), await T({
81
+ file: s,
82
+ onError: () => {
83
+ },
84
+ onProgress: () => {
85
+ },
86
+ onSuccess: () => {
87
+ }
88
+ }));
89
+ }
90
+ async function T(e) {
91
+ var a, s, n, m;
92
+ if (e.file.size > 51200 * 1e3)
93
+ return b.error("图片过大"), !1;
94
+ u.value = !0;
95
+ try {
96
+ const c = new FormData();
97
+ c.append("files", e.file);
98
+ const q = Y.get(r.tokenKey), t = await (await fetch(r.api, {
99
+ method: "POST",
100
+ body: c,
101
+ credentials: "include",
102
+ headers: q ? { Authorization: `Bearer ${q}` } : void 0
103
+ })).json(), w = (t == null ? void 0 : t.urls) ?? ((a = t == null ? void 0 : t.data) == null ? void 0 : a.urls) ?? ((s = t == null ? void 0 : t.data) == null ? void 0 : s.url) ?? (t == null ? void 0 : t.url) ?? "";
104
+ return l.value = Array.isArray(w) ? w[0] : w, k(), b.success("上传图片成功"), (n = e.onSuccess) == null || n.call(e, t), !0;
105
+ } catch (c) {
106
+ return (m = e.onError) == null || m.call(e, c), b.error("上传失败"), !1;
107
+ } finally {
108
+ u.value = !1;
109
+ }
110
+ }
111
+ function k() {
112
+ C(
113
+ "change",
114
+ B(o.value || "", l.value || ""),
115
+ l.value || ""
116
+ );
117
+ }
118
+ return A({
119
+ deleteImage: E,
120
+ // 给表单保存或外部调试读取当前拆分值。
121
+ getValue: () => ({
122
+ text: o.value || "",
123
+ imageUrl: l.value || "",
124
+ value: B(o.value || "", l.value || "")
125
+ })
126
+ }), (e, a) => (v(), p("div", {
127
+ class: "qy-remark-image",
128
+ style: W(D.value)
129
+ }, [
130
+ i("div", ee, [
131
+ g(d(H), $({
132
+ ref_key: "inputRef",
133
+ ref: y,
134
+ "model-value": o.value,
135
+ type: S.value,
136
+ rows: e.rows,
137
+ autosize: e.autosize,
138
+ disabled: e.disabled,
139
+ placeholder: e.placeholder
140
+ }, d(R), {
141
+ "onUpdate:modelValue": N,
142
+ onBlur: k
143
+ }), null, 16, ["model-value", "type", "rows", "autosize", "disabled", "placeholder"]),
144
+ g(d(J), {
145
+ placement: "top-start",
146
+ width: 400,
147
+ trigger: "hover",
148
+ disabled: !l.value
149
+ }, {
150
+ reference: h(() => [
151
+ i("div", ae, [
152
+ g(d(X), {
153
+ disabled: u.value || e.disabled,
154
+ class: "qy-remark-image__upload",
155
+ "show-file-list": !1,
156
+ "http-request": T
157
+ }, {
158
+ default: h(() => [
159
+ u.value ? (v(), p("span", te)) : l.value ? (v(), p("span", le)) : (v(), p("span", re))
160
+ ]),
161
+ _: 1
162
+ }, 8, ["disabled"])
163
+ ])
164
+ ]),
165
+ default: h(() => [
166
+ i("div", oe, [
167
+ i("img", {
168
+ src: l.value,
169
+ class: "qy-remark-image__preview-img"
170
+ }, null, 8, ie),
171
+ i("div", se, [
172
+ a[1] || (a[1] = i("span", { class: "qy-remark-image__popover-tip" }, "再次点击按钮可更换图片", -1)),
173
+ g(d(Q), {
174
+ link: "",
175
+ size: "small",
176
+ type: "danger",
177
+ disabled: e.disabled,
178
+ onClick: E
179
+ }, {
180
+ default: h(() => a[0] || (a[0] = [
181
+ G(" 删除图片 ", -1)
182
+ ])),
183
+ _: 1,
184
+ __: [0]
185
+ }, 8, ["disabled"])
186
+ ])
187
+ ])
188
+ ]),
189
+ _: 1
190
+ }, 8, ["disabled"])
191
+ ])
192
+ ], 4));
193
+ }
194
+ });
195
+ export {
196
+ fe as default
197
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function e(t){const r=t==null?void 0:t.match(/(\[url\:(.*?)\])(.*)/);return r?{imageUrl:r[2],text:r[3]}:{imageUrl:"",text:t||""}}function a(t){const r=String(t||"").match(/(\[url\:.*?\])([\s\S]*)/);return r?r[2]:t}function n(t,r){return r?`[url:${r}]${t}`:t}exports.formatRemarkText=a;exports.parseRemarkText=e;exports.parseRemarkWithImage=n;
@@ -0,0 +1,22 @@
1
+ function r(t) {
2
+ const n = t == null ? void 0 : t.match(/(\[url\:(.*?)\])(.*)/);
3
+ return n ? {
4
+ imageUrl: n[2],
5
+ text: n[3]
6
+ } : {
7
+ imageUrl: "",
8
+ text: t || ""
9
+ };
10
+ }
11
+ function u(t) {
12
+ const n = String(t || "").match(/(\[url\:.*?\])([\s\S]*)/);
13
+ return n ? n[2] : t;
14
+ }
15
+ function c(t, n) {
16
+ return n ? `[url:${n}]${t}` : t;
17
+ }
18
+ export {
19
+ u as formatRemarkText,
20
+ r as parseRemarkText,
21
+ c as parseRemarkWithImage
22
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const x=require("element-plus/es"),t=require("vue"),H=require("@element-plus/icons-vue"),g=require("element-plus"),ge=require("../utils/auth.cjs");;/* empty css */;/* empty css */const ye=require("../../_virtual/_plugin-vue_export-helper.cjs"),xe={class:"qy-upload__hint"},he=["placeholder","disabled"],Ve=["src"],we={key:1,class:"qy-upload__tip"},be={class:"error"},ke={class:"error"},Be=Object.assign({name:"QyUpload"},{__name:"index",props:{modelValue:{type:[Object,Array,String],default:void 0},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:()=>({})}},emits:["update:modelValue","change","success","error","remove"],setup(d,{expose:W,emit:X}){const o=d,m=X,k=t.ref(null),r=t.ref([]),U=t.ref(null),K=t.ref(null),h=[];let C=!1;const M=t.ref(!1),D=t.ref([]),E=t.ref(0),V=t.ref(!1),L=t.ref(""),R=t.ref(""),B=new Set,N=t.ref(!1),f=t.ref(""),T=t.ref(!1);t.onMounted(()=>{o.modelValue===void 0&&j(o.defaultValue)});const Q=t.computed(()=>({large:"160px",default:"140px",small:"80px"})[o.size]??o.size),J=t.computed(()=>o.disabled),G=t.computed(()=>{var e;return o.isShowTip&&(o.fileSize||((e=v.value)==null?void 0:e.length))}),v=t.computed(()=>{var e;return(e=o.fileType)!=null&&e.length?o.fileType.map(l=>l.toLowerCase()):o.supportVideo?["mp4","mov","avi"]:["jpg","jpeg","png","gif","webp"]}),S=t.computed(()=>{const e=o.supportVideo?1:o.limit;return r.value.length>=e}),Y=t.computed(()=>v.value.map(e=>`.${e}`).join(",")),Z=t.computed(()=>({"qy-upload--reached-limit":S.value,"qy-upload--disabled":o.disabled,"qy-upload--video":o.supportVideo,"qy-upload--without-text":!o.showText&&!o.showPasteInput}));t.watch(f,()=>{C||w()}),t.watch(()=>o.modelValue,e=>{e!==void 0&&j(e)},{immediate:!0,deep:!0});function P(e){return Array.isArray(e)?e.filter(Boolean):e?String(e).split(",").filter(Boolean):[]}function ee(e){return Array.isArray(e)?{files:e,text:""}:typeof e=="string"?{files:P(e),text:""}:e&&typeof e=="object"?{files:P(e.files),text:e.text??""}:{files:[],text:""}}function te(e=[]){return e.map((l,i)=>({name:String(l).split("/").pop()||`file-${i}`,url:l,status:"success",uid:Date.now()+i}))}function le(e){const l=new Set(e.map(a=>a.url)),i=r.value.filter(a=>a.status==="uploading"&&!l.has(a.url));return[...e,...i]}function j(e){const l=ee(e);C=!0,f.value=l.text,r.value=le(te(l.files)),t.nextTick(()=>{C=!1})}function z(e){return o.valueFormat==="array"?e.files:o.valueFormat==="string"?e.files.join(","):e}function ae(){var e;(e=U.value)==null||e.focus()}function oe(e){e.target.value=""}function w(e){const a={files:(e??r.value).filter(n=>n.status==="success"&&n.url).map(n=>n.url),text:f.value};m("update:modelValue",z(a)),m("change",a),o.callBack&&o.callBack(a)}function ie(e,l){w(l),m("remove",e,l)}function ne(e){var a;if(!(e.size/1024/1024<o.fileSize))return g.ElMessage.warning(`文件大小不能超过${o.fileSize}M`),!1;const i=((a=e.name.split(".").pop())==null?void 0:a.toLowerCase())||"";return v.value.includes(i)?!0:(g.ElMessage.warning(`格式不支持,仅允许: ${v.value.join("/")}`),!1)}function I(e,l,i,a){var F,_;const n=o.api.startsWith("http")?o.api:window.location.origin+o.api.replace(/^([^/])/,"/$1"),c=new FormData;c.append(o.name,e),o.extraData&&Object.entries(o.extraData).forEach(([u,ve])=>c.append(u,ve));const s=new XMLHttpRequest;h.push(s);const y=((F=k.value)==null?void 0:F.$el.querySelector(".el-upload--picture-card"))||((_=k.value)==null?void 0:_.$el),q=g.ElLoading.service({target:y,text:"上传中",background:"rgba(255,255,255,0.7)"}),p=()=>{const u=h.indexOf(s);u!==-1&&h.splice(u,1),q.close()};s.open("POST",n);const A=ge.getToken(o.tokenKey);A&&s.setRequestHeader("Authorization",`Bearer ${A}`),s.upload.onprogress=u=>{u.total>0&&(l==null||l({percent:u.loaded/u.total*100}))},s.onload=()=>{if(p(),s.status<200||s.status>=300){const u=`上传失败 (HTTP ${s.status})`;g.ElMessage.error(u),m("error",{msg:u,status:s.status}),a==null||a(new Error(u));return}try{const u=JSON.parse(s.responseText);u.code===200&&u.urls?(g.ElMessage.success("上传成功"),i==null||i({...u,url:u.urls})):(g.ElMessage.error(u.msg||"上传失败"),m("error",u),a==null||a(u))}catch{g.ElMessage.error("上传失败,响应格式错误"),m("error",new Error("Response parse error")),a==null||a(new Error("Response parse error"))}},s.onerror=()=>{p(),g.ElMessage.error("上传失败,网络异常"),m("error",new Error("Network error")),a==null||a(new Error("Network error"))},s.send(c)}function O(e){return o.disabled?!1:ne(e)}function se(e,l){const i=r.value.find(a=>{var n;return a.uid===(e==null?void 0:e.uid)||((n=a.raw)==null?void 0:n.uid)===(e==null?void 0:e.uid)});i&&(i.url=l,i.status="success")}function re(e){I(e.file,e.onProgress,l=>{se(e.file,l.url),e.onSuccess(l),w(),m("success",l)},l=>e.onError(l))}function ue(e){var a;if(!e.url)return;const l=((a=e.url.split(".").pop())==null?void 0:a.toLowerCase())||"";if(["mp4","mov","avi","webm"].includes(l)){L.value=e.url,R.value=e.name||"视频预览",V.value=!0;return}const i=r.value.filter(n=>{var c;return n.status==="success"&&n.url&&!["mp4","mov","avi","webm"].includes((c=n.url.split(".").pop())==null?void 0:c.toLowerCase())});D.value=i.map(n=>n.url),E.value=i.findIndex(n=>n.uid===e.uid)||0,M.value=!0}function de(){M.value=!1,D.value=[]}function $(e){for(let l=0;l<e.length;l++){const i=e[l];if(!O(i))continue;const a=Date.now()+l,n=URL.createObjectURL(i);B.add(n),r.value.push({uid:a,name:i.name||`file-${a}`,status:"uploading",percentage:0,url:n}),I(i,c=>{const s=r.value.find(y=>y.uid===a);s&&(s.percentage=c.percent)},c=>{const s=r.value.find(y=>y.uid===a);s&&(s.status="success",s.url=c.url,w(),m("success",c))},()=>me(a))}}function b(e){var a;if(o.disabled)return;const l=(a=e.clipboardData)==null?void 0:a.items;if(!l)return;const i=[];for(let n=0;n<l.length;n++){const c=l[n];if(c.kind==="file"&&c.type.startsWith("image/")){const s=c.getAsFile();s&&i.push(s)}}i.length&&(e.preventDefault(),$(i))}function ce(){o.disabled||o.disableDrag||(N.value=!0)}function pe(){N.value=!1}function fe(e){var i;if(N.value=!1,o.disabled||o.disableDrag||S.value)return;const l=Array.from(((i=e.dataTransfer)==null?void 0:i.files)||[]).filter(a=>{var n;return v.value.includes((n=a.name.split(".").pop())==null?void 0:n.toLowerCase())});l.length&&$(l)}function me(e){var i;const l=r.value.findIndex(a=>a.uid===e);l!==-1&&((i=r.value[l].url)!=null&&i.startsWith("blob:")&&(URL.revokeObjectURL(r.value[l].url),B.delete(r.value[l].url)),r.value.splice(l,1))}return t.onBeforeUnmount(()=>{h.forEach(e=>e.abort()),h.length=0,B.forEach(e=>URL.revokeObjectURL(e)),B.clear()}),W({openFileDialog:()=>{var e,l;o.disabled||S.value||(l=(e=k.value)==null?void 0:e.$el.querySelector('input[type="file"]'))==null||l.click()},getPathList:()=>r.value.filter(e=>e.status==="success").map(e=>e.url),clearFiles:()=>{r.value=[],f.value="",w()},getValue:()=>({files:r.value.filter(e=>e.status==="success"&&e.url).map(e=>e.url),text:f.value}),getModelValue:()=>z({files:r.value.filter(e=>e.status==="success"&&e.url).map(e=>e.url),text:f.value})}),(e,l)=>{var q;const i=x.ElIcon,a=x.ElInput,n=x.ElPopover,c=x.ElUpload,s=x.ElImageViewer,y=x.ElDialog;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["qy-upload",Z.value]),style:t.normalizeStyle({"--qy-upload-size":Q.value})},[t.createVNode(c,{ref_key:"uploadRef",ref:k,"file-list":r.value,"onUpdate:fileList":l[6]||(l[6]=p=>r.value=p),action:"#",multiple:d.supportVideo?!1:d.multiple,limit:d.supportVideo?1:d.limit,"list-type":d.supportVideo?"text":"picture-card",accept:Y.value,disabled:J.value,"http-request":re,"before-upload":O,"on-preview":ue,"on-remove":ie},{default:t.withCtx(()=>[S.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["qy-upload__trigger",{"is-dragover":N.value}]),onPaste:b,onDragover:t.withModifiers(ce,["prevent"]),onDragleave:t.withModifiers(pe,["prevent"]),onDrop:t.withModifiers(fe,["prevent"])},[t.createVNode(i,{class:"qy-upload__icon"},{default:t.withCtx(()=>[t.createVNode(t.unref(H.Plus))]),_:1}),d.supportVideo?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[l[9]||(l[9]=t.createElementVNode("span",{class:"qy-upload__label"},"点击上传视频",-1)),t.createElementVNode("span",xe,"支持 "+t.toDisplayString(v.value.join(" / "))+",不超过 "+t.toDisplayString(d.fileSize)+"MB",1)],64)):t.createCommentVNode("",!0),d.showText?(t.openBlock(),t.createElementBlock("div",{key:1,class:"qy-upload__text",onClick:l[3]||(l[3]=t.withModifiers(()=>{},["stop"])),onPaste:t.withModifiers(b,["stop"])},[t.createVNode(n,{visible:T.value,"onUpdate:visible":l[2]||(l[2]=p=>T.value=p),placement:"bottom-start",width:220,trigger:"click","popper-class":"qy-upload__text-popover",onAfterEnter:ae},{reference:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["qy-upload__text-preview",{"is-placeholder":!f.value}])},t.toDisplayString(f.value||d.pastePlaceholder),3)]),default:t.withCtx(()=>[t.createVNode(a,{ref_key:"inputRef",ref:U,modelValue:f.value,"onUpdate:modelValue":l[0]||(l[0]=p=>f.value=p),type:"textarea",autosize:{minRows:2,maxRows:5},placeholder:d.pastePlaceholder,disabled:d.disabled,onBlur:l[1]||(l[1]=p=>T.value=!1),onPaste:t.withModifiers(b,["stop"])},null,8,["modelValue","placeholder","disabled"])]),_:1},8,["visible"])],32)):d.showPasteInput?(t.openBlock(),t.createElementBlock("div",{key:2,class:"qy-upload__text",onClick:l[5]||(l[5]=t.withModifiers(()=>{},["stop"])),onPaste:t.withModifiers(b,["stop"])},[t.createElementVNode("input",{ref_key:"pasteInputRef",ref:K,class:"qy-upload__paste-input",placeholder:d.pastePlaceholder,disabled:d.disabled,onPaste:t.withModifiers(b,["stop"]),onInput:oe,onClick:l[4]||(l[4]=t.withModifiers(()=>{},["stop"]))},null,40,he)],32)):t.createCommentVNode("",!0)],34))]),_:1},8,["file-list","multiple","limit","list-type","accept","disabled"]),M.value?(t.openBlock(),t.createBlock(s,{key:0,"url-list":D.value,"initial-index":E.value,onClose:de},null,8,["url-list","initial-index"])):t.createCommentVNode("",!0),t.createVNode(y,{modelValue:V.value,"onUpdate:modelValue":l[7]||(l[7]=p=>V.value=p),title:R.value,width:"640px","append-to-body":"","destroy-on-close":"",onClose:l[8]||(l[8]=p=>V.value=!1)},{default:t.withCtx(()=>[V.value?(t.openBlock(),t.createElementBlock("video",{key:0,src:L.value,controls:"",autoplay:"",style:{width:"100%","max-height":"400px","border-radius":"4px"}},null,8,Ve)):t.createCommentVNode("",!0)]),_:1},8,["modelValue","title"]),G.value?(t.openBlock(),t.createElementBlock("div",we,[t.createVNode(i,null,{default:t.withCtx(()=>[t.createVNode(t.unref(H.InfoFilled))]),_:1}),t.createElementVNode("span",null,[l[12]||(l[12]=t.createTextVNode(" 请上传 ",-1)),d.fileSize?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[l[10]||(l[10]=t.createTextVNode("大小不超过 ",-1)),t.createElementVNode("b",be,t.toDisplayString(d.fileSize)+"MB",1)],64)):t.createCommentVNode("",!0),(q=v.value)!=null&&q.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[l[11]||(l[11]=t.createTextVNode(",格式为 ",-1)),t.createElementVNode("b",ke,t.toDisplayString(v.value.join("/")),1)],64)):t.createCommentVNode("",!0),l[13]||(l[13]=t.createTextVNode(" 的文件。 ",-1))])])):t.createCommentVNode("",!0)],6)}}}),Ne=ye.default(Be,[["__scopeId","data-v-1d6de9b6"]]);exports.default=Ne;