@qynpm/ui 1.0.4 → 1.0.6

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 (93) hide show
  1. package/README.md +169 -0
  2. package/dist/index.cjs +2 -1
  3. package/dist/index.mjs +54 -15
  4. package/dist/qy-action-bar/index.cjs +1 -1
  5. package/dist/qy-action-bar/index.mjs +4 -4
  6. package/dist/qy-dialog/index.cjs +1 -1
  7. package/dist/qy-dialog/index.mjs +4 -4
  8. package/dist/qy-form-section/index.cjs +1 -1
  9. package/dist/qy-form-section/index.mjs +2 -2
  10. package/dist/qy-input/index.cjs +1 -1
  11. package/dist/qy-input/index.mjs +4 -4
  12. package/dist/qy-money-input/index.cjs +1 -0
  13. package/dist/qy-money-input/index.mjs +6 -0
  14. package/dist/qy-radio-group/index.cjs +1 -0
  15. package/dist/qy-radio-group/index.mjs +6 -0
  16. package/dist/qy-record-quote-search/index.cjs +1 -1
  17. package/dist/qy-record-quote-search/index.mjs +2 -2
  18. package/dist/qy-remark-image/index.cjs +1 -2
  19. package/dist/qy-remark-image/index.mjs +3 -4
  20. package/dist/qy-remote-select/index.cjs +1 -0
  21. package/dist/qy-remote-select/index.mjs +6 -0
  22. package/dist/qy-search-input/index.cjs +1 -1
  23. package/dist/qy-search-input/index.mjs +3 -3
  24. package/dist/qy-select/index.cjs +1 -1
  25. package/dist/qy-select/index.mjs +4 -4
  26. package/dist/qy-upload/index.cjs +1 -1
  27. package/dist/qy-upload/index.mjs +3 -3
  28. package/dist/qy-voucher-upload/index.cjs +1 -0
  29. package/dist/qy-voucher-upload/index.mjs +6 -0
  30. package/dist/shared/_plugin-vue_export-helper-BHFhmbuH.cjs +1 -0
  31. package/dist/shared/_plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
  32. package/dist/{lib/qy-action-bar/index.vue.mjs → shared/index-Bw9kVFsm.mjs} +13 -13
  33. package/dist/{lib/qy-record-quote-search/index.vue.mjs → shared/index-BzV4959-.mjs} +42 -43
  34. package/dist/{lib/qy-form-section/index.vue.mjs → shared/index-C0ADdL4S.mjs} +11 -12
  35. package/dist/shared/index-CBSjmD0C.mjs +217 -0
  36. package/dist/shared/index-CJb1S7CP.cjs +1 -0
  37. package/dist/shared/index-CO8lz02r.cjs +1 -0
  38. package/dist/shared/index-ClPxDFKd.cjs +1 -0
  39. package/dist/shared/index-CtOqRiaj.cjs +1 -0
  40. package/dist/shared/index-DXB7_Tb5.cjs +1 -0
  41. package/dist/shared/index-DeWkPj3O.mjs +484 -0
  42. package/dist/shared/index-PUYQxK94.mjs +123 -0
  43. package/dist/shared/index-UzZbxoqZ.cjs +1 -0
  44. package/dist/shared/index-a90QeEC4.cjs +1 -0
  45. package/dist/{lib/qy-search-input/index.vue.mjs → shared/index-wW02nNOp.mjs} +55 -55
  46. package/dist/shared/index.vue_vue_type_script_setup_true_lang-BcZg8D-y.mjs +214 -0
  47. package/dist/shared/index.vue_vue_type_script_setup_true_lang-BmeBeCu0.mjs +162 -0
  48. package/dist/shared/index.vue_vue_type_script_setup_true_lang-C85575cL.cjs +1 -0
  49. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DkYwdYdF.mjs +90 -0
  50. package/dist/shared/index.vue_vue_type_script_setup_true_lang-Do5SZ8yS.cjs +1 -0
  51. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DpZzyX5f.cjs +1 -0
  52. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DuUkOqwY.cjs +1 -0
  53. package/dist/{lib/qy-input/index.vue.mjs → shared/index.vue_vue_type_script_setup_true_lang-Dvh1BFaR.mjs} +8 -7
  54. package/dist/shared/index.vue_vue_type_script_setup_true_lang-RtfqJ73A.mjs +171 -0
  55. package/dist/shared/index.vue_vue_type_script_setup_true_lang-VVjCLNMD.cjs +1 -0
  56. package/dist/{lib/dialog/index.vue.mjs → shared/index.vue_vue_type_style_index_0_lang-DpIL_6vO.mjs} +24 -25
  57. package/dist/shared/index.vue_vue_type_style_index_0_lang-haqCjB5x.cjs +1 -0
  58. package/dist/{lib/utils/install.mjs → shared/install-CxBnxbuN.mjs} +2 -2
  59. package/dist/shared/install-c8il9DQv.cjs +1 -0
  60. package/dist/shared/js.cookie-CojEIxHg.cjs +1 -0
  61. package/dist/{node_modules/.pnpm/js-cookie@3.0.1/node_modules/js-cookie/dist/js.cookie.mjs → shared/js.cookie-OLEfuq_g.mjs} +16 -16
  62. package/index.d.ts +9 -0
  63. package/package.json +25 -1
  64. package/qy-money-input/index.d.ts +12 -0
  65. package/qy-money-input/index.js +15 -0
  66. package/qy-radio-group/index.d.ts +12 -0
  67. package/qy-radio-group/index.js +15 -0
  68. package/qy-remote-select/index.d.ts +12 -0
  69. package/qy-remote-select/index.js +15 -0
  70. package/qy-voucher-upload/index.d.ts +12 -0
  71. package/qy-voucher-upload/index.js +15 -0
  72. package/dist/_virtual/plugin-vue_export-helper.cjs +0 -1
  73. package/dist/_virtual/plugin-vue_export-helper.mjs +0 -9
  74. package/dist/lib/dialog/index.vue.cjs +0 -1
  75. package/dist/lib/index.cjs +0 -1
  76. package/dist/lib/index.mjs +0 -40
  77. package/dist/lib/qy-action-bar/index.vue.cjs +0 -1
  78. package/dist/lib/qy-form-section/index.vue.cjs +0 -1
  79. package/dist/lib/qy-input/index.vue.cjs +0 -1
  80. package/dist/lib/qy-record-quote-search/index.vue.cjs +0 -1
  81. package/dist/lib/qy-search-input/index.vue.cjs +0 -1
  82. package/dist/lib/qy-select/index.vue.cjs +0 -1
  83. package/dist/lib/qy-select/index.vue.mjs +0 -137
  84. package/dist/lib/remark-image/index.vue.cjs +0 -1
  85. package/dist/lib/remark-image/index.vue.mjs +0 -198
  86. package/dist/lib/remark-image/utils.cjs +0 -1
  87. package/dist/lib/remark-image/utils.mjs +0 -22
  88. package/dist/lib/upload/index.vue.cjs +0 -1
  89. package/dist/lib/upload/index.vue.mjs +0 -382
  90. package/dist/lib/utils/auth.cjs +0 -1
  91. package/dist/lib/utils/auth.mjs +0 -8
  92. package/dist/lib/utils/install.cjs +0 -1
  93. package/dist/node_modules/.pnpm/js-cookie@3.0.1/node_modules/js-cookie/dist/js.cookie.cjs +0 -1
@@ -0,0 +1,484 @@
1
+ import { ElUpload as De, ElIcon as Le, ElPopover as Re, ElInput as qe, ElImageViewer as je, ElDialog as Pe } from "element-plus/es";
2
+ import { ref as p, onMounted as ze, computed as V, watch as le, nextTick as Ce, onBeforeUnmount as Ie, createElementBlock as g, openBlock as m, normalizeStyle as Ae, normalizeClass as F, createVNode as b, createBlock as Oe, createCommentVNode as h, withCtx as T, withModifiers as v, unref as ae, Fragment as _, createElementVNode as k, toDisplayString as R, createTextVNode as I } from "vue";
3
+ import { Plus as $e, InfoFilled as Me } from "@element-plus/icons-vue";
4
+ import { ElMessage as S, ElLoading as Fe } from "element-plus";
5
+ import { a as _e } from "./js.cookie-OLEfuq_g.mjs";
6
+ import { _ as Ne } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
7
+ const Ee = "Admin-Token";
8
+ function He(r = Ee) {
9
+ return _e.get(r);
10
+ }
11
+ const Ke = { class: "qy-upload__hint" }, Qe = ["placeholder", "disabled"], We = ["src"], Xe = {
12
+ key: 1,
13
+ class: "qy-upload__tip"
14
+ }, Je = { class: "error" }, Ge = { class: "error" }, Ye = /* @__PURE__ */ Object.assign({
15
+ name: "QyUpload"
16
+ }, {
17
+ __name: "index",
18
+ props: {
19
+ /**
20
+ * 受控值。valueFormat 为 object 时结构为 { files, text },
21
+ * array 时为 string[],string 时为逗号分隔 URL。
22
+ */
23
+ modelValue: { type: [Object, Array, String], default: void 0 },
24
+ /**
25
+ * 初始值,结构为 { files: '逗号分隔的URL', text: '文字内容' }
26
+ * 非受控模式,仅初始化时读取一次
27
+ */
28
+ defaultValue: { type: Object, default: () => ({ files: "", text: "" }) },
29
+ /** v-model 输出格式:object | array | string */
30
+ valueFormat: { type: String, default: "object" },
31
+ /** 是否显示底部文字备注区 */
32
+ showText: { type: Boolean, default: !0 },
33
+ /** 是否显示纯粘贴输入条,不保存文字,仅用于承接 Ctrl+V 图片 */
34
+ showPasteInput: { type: Boolean, default: !1 },
35
+ /** 文字区占位文案,也用于凭证上传的粘贴提示 */
36
+ pastePlaceholder: { type: String, default: "输入文字" },
37
+ /** 是否多选 */
38
+ multiple: { type: Boolean, default: !0 },
39
+ /** 是否禁用 */
40
+ disabled: { type: Boolean, default: !1 },
41
+ /** 允许的文件类型后缀(如 ['jpg', 'mp4']) */
42
+ fileType: { type: Array, default: () => [] },
43
+ /** 单个文件大小限制(MB) */
44
+ fileSize: { type: Number, default: 10 },
45
+ /** 文件数量限制 */
46
+ limit: { type: Number, default: 9 },
47
+ /** 是否显示格式/大小提示 */
48
+ isShowTip: { type: Boolean, default: !1 },
49
+ /** 接口路径 */
50
+ api: { type: String, default: "/permission-api/common/uploads" },
51
+ /** FormData 中文件字段名 */
52
+ name: { type: String, default: "file" },
53
+ /** token 读取 key,对应 utils/auth 中的存储字段 */
54
+ tokenKey: { type: String, default: "Admin-Token" },
55
+ /** 是否支持视频模式(强制 limit=1) */
56
+ supportVideo: { type: Boolean, default: !1 },
57
+ /**
58
+ * 卡片尺寸
59
+ * 预设:'large'(160px) | 'default'(140px) | 'small'(80px)
60
+ * 自定义:任意 CSS 单位,如 '60px'、'8vw'
61
+ */
62
+ size: { type: String, default: "default" },
63
+ /** 禁用拖拽(默认在触发区开启) */
64
+ disableDrag: { type: Boolean, default: !1 },
65
+ /** 成功回调(用于复杂业务联动) */
66
+ callBack: { type: Function, default: null },
67
+ /** 上传时附加的额外 FormData 字段 */
68
+ extraData: { type: Object, default: () => ({}) }
69
+ },
70
+ emits: [
71
+ "update:modelValue",
72
+ "change",
73
+ "success",
74
+ "error",
75
+ "remove"
76
+ ],
77
+ setup(r, { expose: ie, emit: oe }) {
78
+ const a = r, y = oe, q = p(null), s = p([]), N = p(null), ne = p(null), U = [];
79
+ let A = !1;
80
+ const O = p(!1), $ = p([]), E = p(0), B = p(!1), H = p(""), K = p(""), j = /* @__PURE__ */ new Set(), P = p(!1), f = p(""), M = p(!1);
81
+ ze(() => {
82
+ a.modelValue === void 0 && W(a.defaultValue);
83
+ });
84
+ const se = V(() => ({ large: "160px", default: "140px", small: "80px" })[a.size] ?? a.size), ue = V(() => a.disabled), re = V(
85
+ () => {
86
+ var e;
87
+ return a.isShowTip && (a.fileSize || ((e = x.value) == null ? void 0 : e.length));
88
+ }
89
+ ), x = V(() => {
90
+ var e;
91
+ return (e = a.fileType) != null && e.length ? a.fileType.map((t) => t.toLowerCase()) : a.supportVideo ? ["mp4", "mov", "avi"] : ["jpg", "jpeg", "png", "gif", "webp"];
92
+ }), z = V(() => {
93
+ const e = a.supportVideo ? 1 : a.limit;
94
+ return s.value.length >= e;
95
+ }), de = V(
96
+ () => x.value.map((e) => `.${e}`).join(",")
97
+ ), pe = V(() => ({
98
+ "qy-upload--reached-limit": z.value,
99
+ "qy-upload--disabled": a.disabled,
100
+ "qy-upload--video": a.supportVideo,
101
+ "qy-upload--without-text": !a.showText && !a.showPasteInput
102
+ }));
103
+ le(f, () => {
104
+ A || D();
105
+ }), le(
106
+ () => a.modelValue,
107
+ (e) => {
108
+ e !== void 0 && W(e);
109
+ },
110
+ { immediate: !0, deep: !0 }
111
+ );
112
+ function Q(e) {
113
+ return Array.isArray(e) ? e.filter(Boolean) : e ? String(e).split(",").filter(Boolean) : [];
114
+ }
115
+ function ce(e) {
116
+ return Array.isArray(e) ? { files: e, text: "" } : typeof e == "string" ? { files: Q(e), text: "" } : e && typeof e == "object" ? {
117
+ files: Q(e.files),
118
+ text: e.text ?? ""
119
+ } : { files: [], text: "" };
120
+ }
121
+ function fe(e = []) {
122
+ return e.map((t, i) => ({
123
+ name: String(t).split("/").pop() || `file-${i}`,
124
+ url: t,
125
+ status: "success",
126
+ uid: Date.now() + i
127
+ }));
128
+ }
129
+ function me(e) {
130
+ const t = new Set(e.map((l) => l.url)), i = s.value.filter(
131
+ (l) => l.status === "uploading" && !t.has(l.url)
132
+ );
133
+ return [...e, ...i];
134
+ }
135
+ function W(e) {
136
+ const t = ce(e);
137
+ A = !0, f.value = t.text, s.value = me(fe(t.files)), Ce(() => {
138
+ A = !1;
139
+ });
140
+ }
141
+ function X(e) {
142
+ return a.valueFormat === "array" ? e.files : a.valueFormat === "string" ? e.files.join(",") : e;
143
+ }
144
+ function ve() {
145
+ var e;
146
+ (e = N.value) == null || e.focus();
147
+ }
148
+ function ye(e) {
149
+ e.target.value = "";
150
+ }
151
+ function D(e) {
152
+ const l = { files: (e ?? s.value).filter((o) => o.status === "success" && o.url).map((o) => o.url), text: f.value };
153
+ y("update:modelValue", X(l)), y("change", l), a.callBack && a.callBack(l);
154
+ }
155
+ function ge(e, t) {
156
+ D(t), y("remove", e, t);
157
+ }
158
+ function xe(e) {
159
+ var l;
160
+ if (!(e.size / 1024 / 1024 < a.fileSize))
161
+ return S.warning(`文件大小不能超过${a.fileSize}M`), !1;
162
+ const i = ((l = e.name.split(".").pop()) == null ? void 0 : l.toLowerCase()) || "";
163
+ return x.value.includes(i) ? !0 : (S.warning(
164
+ `格式不支持,仅允许: ${x.value.join("/")}`
165
+ ), !1);
166
+ }
167
+ function J(e, t, i, l) {
168
+ var ee, te;
169
+ const o = a.api.startsWith("http") ? a.api : window.location.origin + a.api.replace(/^([^/])/, "/$1"), d = new FormData();
170
+ d.append(a.name, e), a.extraData && Object.entries(a.extraData).forEach(([u, Be]) => d.append(u, Be));
171
+ const n = new XMLHttpRequest();
172
+ U.push(n);
173
+ const w = ((ee = q.value) == null ? void 0 : ee.$el.querySelector(".el-upload--picture-card")) || ((te = q.value) == null ? void 0 : te.$el), C = Fe.service({
174
+ target: w,
175
+ text: "上传中",
176
+ background: "rgba(255,255,255,0.7)"
177
+ }), c = () => {
178
+ const u = U.indexOf(n);
179
+ u !== -1 && U.splice(u, 1), C.close();
180
+ };
181
+ n.open("POST", o);
182
+ const Z = He(a.tokenKey);
183
+ Z && n.setRequestHeader("Authorization", `Bearer ${Z}`), n.upload.onprogress = (u) => {
184
+ u.total > 0 && (t == null || t({ percent: u.loaded / u.total * 100 }));
185
+ }, n.onload = () => {
186
+ if (c(), n.status < 200 || n.status >= 300) {
187
+ const u = `上传失败 (HTTP ${n.status})`;
188
+ S.error(u), y("error", { msg: u, status: n.status }), l == null || l(new Error(u));
189
+ return;
190
+ }
191
+ try {
192
+ const u = JSON.parse(n.responseText);
193
+ u.code === 200 && u.urls ? (S.success("上传成功"), i == null || i({ ...u, url: u.urls })) : (S.error(u.msg || "上传失败"), y("error", u), l == null || l(u));
194
+ } catch {
195
+ S.error("上传失败,响应格式错误"), y("error", new Error("Response parse error")), l == null || l(new Error("Response parse error"));
196
+ }
197
+ }, n.onerror = () => {
198
+ c(), S.error("上传失败,网络异常"), y("error", new Error("Network error")), l == null || l(new Error("Network error"));
199
+ }, n.send(d);
200
+ }
201
+ function G(e) {
202
+ return a.disabled ? !1 : xe(e);
203
+ }
204
+ function be(e, t) {
205
+ const i = s.value.find(
206
+ (l) => {
207
+ var o;
208
+ return l.uid === (e == null ? void 0 : e.uid) || ((o = l.raw) == null ? void 0 : o.uid) === (e == null ? void 0 : e.uid);
209
+ }
210
+ );
211
+ i && (i.url = t, i.status = "success");
212
+ }
213
+ function he(e) {
214
+ J(
215
+ e.file,
216
+ e.onProgress,
217
+ (t) => {
218
+ be(e.file, t.url), e.onSuccess(t), D(), y("success", t);
219
+ },
220
+ (t) => e.onError(t)
221
+ );
222
+ }
223
+ function we(e) {
224
+ var l;
225
+ if (!e.url) return;
226
+ const t = ((l = e.url.split(".").pop()) == null ? void 0 : l.toLowerCase()) || "";
227
+ if (["mp4", "mov", "avi", "webm"].includes(t)) {
228
+ H.value = e.url, K.value = e.name || "视频预览", B.value = !0;
229
+ return;
230
+ }
231
+ const i = s.value.filter(
232
+ (o) => {
233
+ var d;
234
+ return o.status === "success" && o.url && !["mp4", "mov", "avi", "webm"].includes(
235
+ (d = o.url.split(".").pop()) == null ? void 0 : d.toLowerCase()
236
+ );
237
+ }
238
+ );
239
+ $.value = i.map((o) => o.url), E.value = i.findIndex((o) => o.uid === e.uid) || 0, O.value = !0;
240
+ }
241
+ function Ve() {
242
+ O.value = !1, $.value = [];
243
+ }
244
+ function Y(e) {
245
+ for (let t = 0; t < e.length; t++) {
246
+ const i = e[t];
247
+ if (!G(i)) continue;
248
+ const l = Date.now() + t, o = URL.createObjectURL(i);
249
+ j.add(o), s.value.push({
250
+ uid: l,
251
+ name: i.name || `file-${l}`,
252
+ status: "uploading",
253
+ percentage: 0,
254
+ url: o
255
+ }), J(
256
+ i,
257
+ (d) => {
258
+ const n = s.value.find((w) => w.uid === l);
259
+ n && (n.percentage = d.percent);
260
+ },
261
+ (d) => {
262
+ const n = s.value.find((w) => w.uid === l);
263
+ n && (n.status = "success", n.url = d.url, D(), y("success", d));
264
+ },
265
+ () => Ue(l)
266
+ );
267
+ }
268
+ }
269
+ function L(e) {
270
+ var l;
271
+ if (a.disabled) return;
272
+ const t = (l = e.clipboardData) == null ? void 0 : l.items;
273
+ if (!t) return;
274
+ const i = [];
275
+ for (let o = 0; o < t.length; o++) {
276
+ const d = t[o];
277
+ if (d.kind === "file" && d.type.startsWith("image/")) {
278
+ const n = d.getAsFile();
279
+ n && i.push(n);
280
+ }
281
+ }
282
+ i.length && (e.preventDefault(), Y(i));
283
+ }
284
+ function ke() {
285
+ a.disabled || a.disableDrag || (P.value = !0);
286
+ }
287
+ function Se() {
288
+ P.value = !1;
289
+ }
290
+ function Te(e) {
291
+ var i;
292
+ if (P.value = !1, a.disabled || a.disableDrag || z.value) return;
293
+ const t = Array.from(((i = e.dataTransfer) == null ? void 0 : i.files) || []).filter(
294
+ (l) => {
295
+ var o;
296
+ return x.value.includes((o = l.name.split(".").pop()) == null ? void 0 : o.toLowerCase());
297
+ }
298
+ );
299
+ t.length && Y(t);
300
+ }
301
+ function Ue(e) {
302
+ var i;
303
+ const t = s.value.findIndex((l) => l.uid === e);
304
+ t !== -1 && ((i = s.value[t].url) != null && i.startsWith("blob:") && (URL.revokeObjectURL(s.value[t].url), j.delete(s.value[t].url)), s.value.splice(t, 1));
305
+ }
306
+ return Ie(() => {
307
+ U.forEach((e) => e.abort()), U.length = 0, j.forEach((e) => URL.revokeObjectURL(e)), j.clear();
308
+ }), ie({
309
+ /** 主动打开文件选择框,供表单或快捷操作调用 */
310
+ openFileDialog: () => {
311
+ var e, t;
312
+ a.disabled || z.value || (t = (e = q.value) == null ? void 0 : e.$el.querySelector('input[type="file"]')) == null || t.click();
313
+ },
314
+ /** 获取已上传成功的文件 URL 列表 */
315
+ getPathList: () => s.value.filter((e) => e.status === "success").map((e) => e.url),
316
+ /** 清空文件和文字,并同步 change 事件 */
317
+ clearFiles: () => {
318
+ s.value = [], f.value = "", D();
319
+ },
320
+ /** 获取完整值,结构与 change 事件保持一致 */
321
+ getValue: () => ({
322
+ files: s.value.filter((e) => e.status === "success" && e.url).map((e) => e.url),
323
+ text: f.value
324
+ }),
325
+ /** 获取按 valueFormat 输出的值,便于外部不走 v-model 时读取 */
326
+ getModelValue: () => X({
327
+ files: s.value.filter((e) => e.status === "success" && e.url).map((e) => e.url),
328
+ text: f.value
329
+ })
330
+ }), (e, t) => {
331
+ var C;
332
+ const i = Le, l = qe, o = Re, d = De, n = je, w = Pe;
333
+ return m(), g("div", {
334
+ class: F(["qy-upload", pe.value]),
335
+ style: Ae({ "--qy-upload-size": se.value })
336
+ }, [
337
+ b(d, {
338
+ ref_key: "uploadRef",
339
+ ref: q,
340
+ "file-list": s.value,
341
+ "onUpdate:fileList": t[6] || (t[6] = (c) => s.value = c),
342
+ action: "#",
343
+ multiple: r.supportVideo ? !1 : r.multiple,
344
+ limit: r.supportVideo ? 1 : r.limit,
345
+ "list-type": r.supportVideo ? "text" : "picture-card",
346
+ accept: de.value,
347
+ disabled: ue.value,
348
+ "http-request": he,
349
+ "before-upload": G,
350
+ "on-preview": we,
351
+ "on-remove": ge
352
+ }, {
353
+ default: T(() => [
354
+ z.value ? h("", !0) : (m(), g("div", {
355
+ key: 0,
356
+ class: F(["qy-upload__trigger", { "is-dragover": P.value }]),
357
+ onPaste: L,
358
+ onDragover: v(ke, ["prevent"]),
359
+ onDragleave: v(Se, ["prevent"]),
360
+ onDrop: v(Te, ["prevent"])
361
+ }, [
362
+ b(i, { class: "qy-upload__icon" }, {
363
+ default: T(() => [
364
+ b(ae($e))
365
+ ]),
366
+ _: 1
367
+ }),
368
+ r.supportVideo ? (m(), g(_, { key: 0 }, [
369
+ t[9] || (t[9] = k("span", { class: "qy-upload__label" }, "点击上传视频", -1)),
370
+ k("span", Ke, "支持 " + R(x.value.join(" / ")) + ",不超过 " + R(r.fileSize) + "MB", 1)
371
+ ], 64)) : h("", !0),
372
+ r.showText ? (m(), g("div", {
373
+ key: 1,
374
+ class: "qy-upload__text",
375
+ onClick: t[3] || (t[3] = v(() => {
376
+ }, ["stop"])),
377
+ onPaste: v(L, ["stop"])
378
+ }, [
379
+ b(o, {
380
+ visible: M.value,
381
+ "onUpdate:visible": t[2] || (t[2] = (c) => M.value = c),
382
+ placement: "bottom-start",
383
+ width: 220,
384
+ trigger: "click",
385
+ "popper-class": "qy-upload__text-popover",
386
+ onAfterEnter: ve
387
+ }, {
388
+ reference: T(() => [
389
+ k("div", {
390
+ class: F(["qy-upload__text-preview", { "is-placeholder": !f.value }])
391
+ }, R(f.value || r.pastePlaceholder), 3)
392
+ ]),
393
+ default: T(() => [
394
+ b(l, {
395
+ ref_key: "inputRef",
396
+ ref: N,
397
+ modelValue: f.value,
398
+ "onUpdate:modelValue": t[0] || (t[0] = (c) => f.value = c),
399
+ type: "textarea",
400
+ autosize: { minRows: 2, maxRows: 5 },
401
+ placeholder: r.pastePlaceholder,
402
+ disabled: r.disabled,
403
+ onBlur: t[1] || (t[1] = (c) => M.value = !1),
404
+ onPaste: v(L, ["stop"])
405
+ }, null, 8, ["modelValue", "placeholder", "disabled"])
406
+ ]),
407
+ _: 1
408
+ }, 8, ["visible"])
409
+ ], 32)) : r.showPasteInput ? (m(), g("div", {
410
+ key: 2,
411
+ class: "qy-upload__text",
412
+ onClick: t[5] || (t[5] = v(() => {
413
+ }, ["stop"])),
414
+ onPaste: v(L, ["stop"])
415
+ }, [
416
+ k("input", {
417
+ ref_key: "pasteInputRef",
418
+ ref: ne,
419
+ class: "qy-upload__paste-input",
420
+ placeholder: r.pastePlaceholder,
421
+ disabled: r.disabled,
422
+ onPaste: v(L, ["stop"]),
423
+ onInput: ye,
424
+ onClick: t[4] || (t[4] = v(() => {
425
+ }, ["stop"]))
426
+ }, null, 40, Qe)
427
+ ], 32)) : h("", !0)
428
+ ], 34))
429
+ ]),
430
+ _: 1
431
+ }, 8, ["file-list", "multiple", "limit", "list-type", "accept", "disabled"]),
432
+ O.value ? (m(), Oe(n, {
433
+ key: 0,
434
+ "url-list": $.value,
435
+ "initial-index": E.value,
436
+ onClose: Ve
437
+ }, null, 8, ["url-list", "initial-index"])) : h("", !0),
438
+ b(w, {
439
+ modelValue: B.value,
440
+ "onUpdate:modelValue": t[7] || (t[7] = (c) => B.value = c),
441
+ title: K.value,
442
+ width: "640px",
443
+ "append-to-body": "",
444
+ "destroy-on-close": "",
445
+ onClose: t[8] || (t[8] = (c) => B.value = !1)
446
+ }, {
447
+ default: T(() => [
448
+ B.value ? (m(), g("video", {
449
+ key: 0,
450
+ src: H.value,
451
+ controls: "",
452
+ autoplay: "",
453
+ style: { width: "100%", "max-height": "400px", "border-radius": "4px" }
454
+ }, null, 8, We)) : h("", !0)
455
+ ]),
456
+ _: 1
457
+ }, 8, ["modelValue", "title"]),
458
+ re.value ? (m(), g("div", Xe, [
459
+ b(i, null, {
460
+ default: T(() => [
461
+ b(ae(Me))
462
+ ]),
463
+ _: 1
464
+ }),
465
+ k("span", null, [
466
+ t[12] || (t[12] = I(" 请上传 ", -1)),
467
+ r.fileSize ? (m(), g(_, { key: 0 }, [
468
+ t[10] || (t[10] = I("大小不超过 ", -1)),
469
+ k("b", Je, R(r.fileSize) + "MB", 1)
470
+ ], 64)) : h("", !0),
471
+ (C = x.value) != null && C.length ? (m(), g(_, { key: 1 }, [
472
+ t[11] || (t[11] = I(",格式为 ", -1)),
473
+ k("b", Ge, R(x.value.join("/")), 1)
474
+ ], 64)) : h("", !0),
475
+ t[13] || (t[13] = I(" 的文件。 ", -1))
476
+ ])
477
+ ])) : h("", !0)
478
+ ], 6);
479
+ };
480
+ }
481
+ }), ot = /* @__PURE__ */ Ne(Ye, [["__scopeId", "data-v-8b875cce"]]);
482
+ export {
483
+ ot as Q
484
+ };
@@ -0,0 +1,123 @@
1
+ import { useAttrs as b, ref as k, createBlock as S, openBlock as V, mergeProps as x, unref as z } from "vue";
2
+ import { Q as B } from "./index-DeWkPj3O.mjs";
3
+ const w = /* @__PURE__ */ Object.assign({
4
+ name: "QyVoucherUpload",
5
+ inheritAttrs: !1
6
+ }, {
7
+ __name: "index",
8
+ props: {
9
+ /** 凭证图片 URL 数组。 */
10
+ modelValue: { type: Array, default: () => [] },
11
+ /** 上传接口路径。 */
12
+ api: { type: String, default: "/permission-api/common/uploads" },
13
+ /** 凭证上传沿用老业务字段名 files。 */
14
+ name: { type: String, default: "files" },
15
+ /** 是否多选。 */
16
+ multiple: { type: Boolean, default: !0 },
17
+ /** 是否禁用。 */
18
+ disabled: { type: Boolean, default: !1 },
19
+ /** 允许的文件类型后缀。 */
20
+ fileType: { type: Array, default: () => [] },
21
+ /** 单个文件大小限制(MB)。 */
22
+ fileSize: { type: Number, default: 10 },
23
+ /** 文件数量限制。 */
24
+ limit: { type: Number, default: 9 },
25
+ /** 是否显示格式/大小提示。 */
26
+ isShowTip: { type: Boolean, default: !1 },
27
+ /** token 读取 key。 */
28
+ tokenKey: { type: String, default: "Admin-Token" },
29
+ /** 是否支持视频模式。 */
30
+ supportVideo: { type: Boolean, default: !1 },
31
+ /** 凭证默认尺寸,贴近财审凭证里的紧凑图片格。 */
32
+ size: { type: String, default: "90px" },
33
+ /** 禁用拖拽。 */
34
+ disableDrag: { type: Boolean, default: !1 },
35
+ /** 成功回调。 */
36
+ callBack: { type: Function, default: null },
37
+ /** 上传时附加的额外 FormData 字段。 */
38
+ extraData: { type: Object, default: () => ({}) },
39
+ /** 凭证上传底部提示文案,默认对齐 CopyImgUpload 的旧交互。 */
40
+ pastePlaceholder: { type: String, default: "粘贴图片上传" }
41
+ },
42
+ emits: [
43
+ "update:modelValue",
44
+ "change",
45
+ "success",
46
+ "error",
47
+ "remove"
48
+ ],
49
+ setup(a, { expose: u, emit: r }) {
50
+ const l = r, d = b(), i = k(null);
51
+ function n(e) {
52
+ return Array.isArray(e) ? e : [];
53
+ }
54
+ function s(e) {
55
+ l("update:modelValue", n(e));
56
+ }
57
+ function f(e) {
58
+ const t = n(e == null ? void 0 : e.files);
59
+ l("change", t);
60
+ }
61
+ function c(e) {
62
+ l("success", e);
63
+ }
64
+ function m(e) {
65
+ l("error", e);
66
+ }
67
+ function p(e, t) {
68
+ l("remove", e, t);
69
+ }
70
+ function y() {
71
+ var e, t;
72
+ (t = (e = i.value) == null ? void 0 : e.openFileDialog) == null || t.call(e);
73
+ }
74
+ function o() {
75
+ var e, t;
76
+ return ((t = (e = i.value) == null ? void 0 : e.getPathList) == null ? void 0 : t.call(e)) || [];
77
+ }
78
+ function h() {
79
+ var e, t;
80
+ (t = (e = i.value) == null ? void 0 : e.clearFiles) == null || t.call(e);
81
+ }
82
+ function g() {
83
+ return o();
84
+ }
85
+ return u({
86
+ openFileDialog: y,
87
+ getPathList: o,
88
+ clearFiles: h,
89
+ getValue: g
90
+ }), (e, t) => (V(), S(B, x({
91
+ ref_key: "uploadRef",
92
+ ref: i
93
+ }, z(d), {
94
+ "model-value": a.modelValue,
95
+ "value-format": "array",
96
+ api: a.api,
97
+ name: a.name,
98
+ multiple: a.multiple,
99
+ disabled: a.disabled,
100
+ "file-type": a.fileType,
101
+ "file-size": a.fileSize,
102
+ limit: a.limit,
103
+ "is-show-tip": a.isShowTip,
104
+ "token-key": a.tokenKey,
105
+ "support-video": a.supportVideo,
106
+ size: a.size,
107
+ "disable-drag": a.disableDrag,
108
+ "call-back": a.callBack,
109
+ "extra-data": a.extraData,
110
+ "show-text": !1,
111
+ "show-paste-input": !0,
112
+ "paste-placeholder": a.pastePlaceholder,
113
+ "onUpdate:modelValue": s,
114
+ onChange: f,
115
+ onSuccess: c,
116
+ onError: m,
117
+ onRemove: p
118
+ }), null, 16, ["model-value", "api", "name", "multiple", "disabled", "file-type", "file-size", "limit", "is-show-tip", "token-key", "support-video", "size", "disable-drag", "call-back", "extra-data", "paste-placeholder"]));
119
+ }
120
+ });
121
+ export {
122
+ w as _
123
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("vue"),i=require("element-plus"),U=require("./js.cookie-CojEIxHg.cjs"),P=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");function y(l){const n=l==null?void 0:l.match(/(\[url\:(.*?)\])(.*)/);return n?{imageUrl:n[2],text:n[3]}:{imageUrl:"",text:l||""}}function V(l){const n=String(l||"").match(/(\[url\:.*?\])([\s\S]*)/);return n?n[2]:l}function k(l,n){return n?`[url:${n}]${l}`:l}const S={class:"qy-remark-image__field"},T={class:"qy-remark-image__upload-anchor"},A={key:0,class:"icon-[line-md--loading-twotone-loop]",role:"img","aria-hidden":"true"},D={key:1,class:"icon-[ion--cloud-upload-outline]",role:"img","aria-hidden":"true"},L={key:2,class:"icon-[ph--images-thin]",role:"img","aria-hidden":"true"},M={class:"qy-remark-image__popover"},$=["src"],j={class:"qy-remark-image__popover-footer"},W=e.defineComponent({__name:"index",props:{defaultValue:{default:""},defaultImage:{default:""},rows:{default:6},width:{default:""},autosize:{type:[Boolean,Object],default:!1},disabled:{type:Boolean,default:!1},placeholder:{default:"粘贴图片上传"},type:{default:"textarea"},api:{default:"/permission-api/common/uploads"},tokenKey:{default:"Admin-Token"}},emits:["change"],setup(l,{expose:n,emit:q}){const o=l,B=q,I=e.useAttrs(),g=e.ref(null),u=e.ref(""),s=e.ref(""),m=e.ref(!1),N=e.computed(()=>o.type==="text"?"text":"textarea"),R=e.computed(()=>{if(o.width)return{width:typeof o.width=="number"?`${o.width}px`:o.width}});e.watch(()=>o.defaultValue,a=>{const t=y(a||"");u.value=t.text,s.value=t.imageUrl||o.defaultImage||""},{immediate:!0}),e.watch(()=>o.defaultImage,a=>{a!==void 0&&!y(o.defaultValue||"").imageUrl&&(s.value=a||"")},{immediate:!0}),e.onMounted(()=>{e.nextTick(z)}),e.onUnmounted(()=>{const a=w();a&&a.removeEventListener("paste",h)});function w(){var a,t;return((a=g.value)==null?void 0:a.textarea)||((t=g.value)==null?void 0:t.input)||null}function z(){const a=w();a&&(a.removeEventListener("paste",h),a.addEventListener("paste",h))}function C(a){u.value=V(a||"")}function E(){s.value="",v()}async function h(a){var c;const d=Array.from(((c=a.clipboardData)==null?void 0:c.files)||[]).find(f=>f.type.startsWith("image/"));d&&(a.preventDefault(),await b({file:d,onError:()=>{},onProgress:()=>{},onSuccess:()=>{}}))}async function b(a){var t,d,c,f;if(a.file.size>51200*1e3)return i.ElMessage.error("图片过大"),!1;m.value=!0;try{const p=new FormData;p.append("files",a.file);const x=U.api.get(o.tokenKey),r=await(await fetch(o.api,{method:"POST",body:p,credentials:"include",headers:x?{Authorization:`Bearer ${x}`}:void 0})).json(),_=(r==null?void 0:r.urls)??((t=r==null?void 0:r.data)==null?void 0:t.urls)??((d=r==null?void 0:r.data)==null?void 0:d.url)??(r==null?void 0:r.url)??"";return s.value=Array.isArray(_)?_[0]:_,v(),i.ElMessage.success("上传图片成功"),(c=a.onSuccess)==null||c.call(a,r),!0}catch(p){return(f=a.onError)==null||f.call(a,p),i.ElMessage.error("上传失败"),!1}finally{m.value=!1}}function v(){B("change",k(u.value||"",s.value||""),s.value||"")}return n({deleteImage:E,getValue:()=>({text:u.value||"",imageUrl:s.value||"",value:k(u.value||"",s.value||"")})}),(a,t)=>(e.openBlock(),e.createElementBlock("div",{class:"qy-remark-image",style:e.normalizeStyle(R.value)},[e.createElementVNode("div",S,[e.createVNode(e.unref(i.ElInput),e.mergeProps({ref_key:"inputRef",ref:g,"model-value":u.value,type:N.value,rows:a.rows,autosize:a.autosize,disabled:a.disabled,placeholder:a.placeholder},e.unref(I),{"onUpdate:modelValue":C,onBlur:v}),null,16,["model-value","type","rows","autosize","disabled","placeholder"]),e.createVNode(e.unref(i.ElPopover),{placement:"top-start",width:400,trigger:"hover",disabled:!s.value},{reference:e.withCtx(()=>[e.createElementVNode("div",T,[e.createVNode(e.unref(i.ElUpload),{disabled:m.value||a.disabled,class:"qy-remark-image__upload","show-file-list":!1,"http-request":b},{default:e.withCtx(()=>[m.value?(e.openBlock(),e.createElementBlock("span",A)):s.value?(e.openBlock(),e.createElementBlock("span",L)):(e.openBlock(),e.createElementBlock("span",D))]),_:1},8,["disabled"])])]),default:e.withCtx(()=>[e.createElementVNode("div",M,[e.createElementVNode("img",{src:s.value,class:"qy-remark-image__preview-img"},null,8,$),e.createElementVNode("div",j,[t[1]||(t[1]=e.createElementVNode("span",{class:"qy-remark-image__popover-tip"},"再次点击按钮可更换图片",-1)),e.createVNode(e.unref(i.ElButton),{link:"",size:"small",type:"danger",disabled:a.disabled,onClick:E},{default:e.withCtx(()=>t[0]||(t[0]=[e.createTextVNode(" 删除图片 ",-1)])),_:1,__:[0]},8,["disabled"])])])]),_:1},8,["disabled"])])],4))}}),F=P._export_sfc(W,[["__scopeId","data-v-f8d38d88"]]);exports.QyRemarkImage=F;exports.formatRemarkText=V;exports.parseRemarkText=y;exports.parseRemarkWithImage=k;
@@ -0,0 +1 @@
1
+ "use strict";const x=require("element-plus/es"),t=require("vue"),H=require("@element-plus/icons-vue"),g=require("element-plus"),ge=require("./js.cookie-CojEIxHg.cjs"),ye=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),xe="Admin-Token";function he(d=xe){return ge.api.get(d)}const Ve={class:"qy-upload__hint"},we=["placeholder","disabled"],be=["src"],ke={key:1,class:"qy-upload__tip"},Be={class:"error"},Ne={class:"error"},Se=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:K,emit:Q}){const o=d,m=Q,k=t.ref(null),r=t.ref([]),U=t.ref(null),W=t.ref(null),h=[];let T=!1;const q=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(""),M=t.ref(!1);t.onMounted(()=>{o.modelValue===void 0&&z(o.defaultValue)});const X=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,()=>{T||w()}),t.watch(()=>o.modelValue,e=>{e!==void 0&&z(e)},{immediate:!0,deep:!0});function j(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:j(e),text:""}:e&&typeof e=="object"?{files:j(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 z(e){const l=ee(e);T=!0,f.value=l.text,r.value=le(te(l.files)),t.nextTick(()=>{T=!1})}function P(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",P(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),C=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),C.close()};s.open("POST",n);const $=he(o.tokenKey);$&&s.setRequestHeader("Authorization",`Bearer ${$}`),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 A(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,q.value=!0}function de(){q.value=!1,D.value=[]}function O(e){for(let l=0;l<e.length;l++){const i=e[l];if(!A(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(),O(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&&O(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()}),K({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:()=>P({files:r.value.filter(e=>e.status==="success"&&e.url).map(e=>e.url),text:f.value})}),(e,l)=>{var C;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":X.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":A,"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",Ve,"支持 "+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:M.value,"onUpdate:visible":l[2]||(l[2]=p=>M.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=>M.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:W,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,we)],32)):t.createCommentVNode("",!0)],34))]),_:1},8,["file-list","multiple","limit","list-type","accept","disabled"]),q.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,be)):t.createCommentVNode("",!0)]),_:1},8,["modelValue","title"]),G.value?(t.openBlock(),t.createElementBlock("div",ke,[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),(C=v.value)!=null&&C.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[l[11]||(l[11]=t.createTextVNode(",格式为 ",-1)),t.createElementVNode("b",Ne,t.toDisplayString(v.value.join("/")),1)],64)):t.createCommentVNode("",!0),l[13]||(l[13]=t.createTextVNode(" 的文件。 ",-1))])])):t.createCommentVNode("",!0)],6)}}}),Ce=ye._export_sfc(Se,[["__scopeId","data-v-8b875cce"]]);exports.QyUpload=Ce;