@qynpm/ui 1.0.5 → 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 (117) hide show
  1. package/README.md +228 -228
  2. package/dist/index.cjs +2 -1
  3. package/dist/index.mjs +54 -19
  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 -5
  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 -1
  13. package/dist/qy-money-input/index.mjs +4 -4
  14. package/dist/qy-radio-group/index.cjs +1 -1
  15. package/dist/qy-radio-group/index.mjs +4 -4
  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 -1
  21. package/dist/qy-remote-select/index.mjs +4 -4
  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 -1
  29. package/dist/qy-voucher-upload/index.mjs +4 -4
  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.vue2.mjs → shared/index-Bw9kVFsm.mjs} +14 -13
  33. package/dist/{lib/qy-record-quote-search/index.vue2.mjs → shared/index-BzV4959-.mjs} +58 -57
  34. package/dist/{lib/qy-form-section/index.vue2.mjs → shared/index-C0ADdL4S.mjs} +20 -19
  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/{lib/upload/index.vue.mjs → shared/index-DeWkPj3O.mjs} +121 -119
  42. package/dist/{lib/qy-voucher-upload/index.vue.mjs → shared/index-PUYQxK94.mjs} +2 -2
  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.vue2.mjs → shared/index-wW02nNOp.mjs} +50 -49
  46. package/dist/{lib/qy-remote-select/index.vue.mjs → shared/index.vue_vue_type_script_setup_true_lang-BcZg8D-y.mjs} +2 -2
  47. package/dist/{lib/qy-select/index.vue.mjs → shared/index.vue_vue_type_script_setup_true_lang-BmeBeCu0.mjs} +1 -1
  48. package/dist/shared/index.vue_vue_type_script_setup_true_lang-C85575cL.cjs +1 -0
  49. package/dist/{lib/qy-radio-group/index.vue.mjs → shared/index.vue_vue_type_script_setup_true_lang-DkYwdYdF.mjs} +4 -4
  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} +7 -7
  54. package/dist/{lib/qy-money-input/index.vue.mjs → shared/index.vue_vue_type_script_setup_true_lang-RtfqJ73A.mjs} +24 -24
  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} +1 -1
  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.5/node_modules/js-cookie/dist/js.cookie.mjs → shared/js.cookie-OLEfuq_g.mjs} +13 -13
  62. package/index.d.ts +20 -20
  63. package/package.json +1 -1
  64. package/qy-money-input/index.d.ts +12 -12
  65. package/qy-money-input/index.js +15 -15
  66. package/qy-radio-group/index.d.ts +12 -12
  67. package/qy-radio-group/index.js +15 -15
  68. package/qy-remote-select/index.d.ts +12 -12
  69. package/qy-remote-select/index.js +15 -15
  70. package/qy-voucher-upload/index.d.ts +12 -12
  71. package/qy-voucher-upload/index.js +15 -15
  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/dialog/index.vue3.cjs +0 -1
  76. package/dist/lib/dialog/index.vue3.mjs +0 -5
  77. package/dist/lib/index.cjs +0 -1
  78. package/dist/lib/index.mjs +0 -53
  79. package/dist/lib/qy-action-bar/index.vue.cjs +0 -1
  80. package/dist/lib/qy-action-bar/index.vue.mjs +0 -7
  81. package/dist/lib/qy-action-bar/index.vue2.cjs +0 -1
  82. package/dist/lib/qy-form-section/index.vue.cjs +0 -1
  83. package/dist/lib/qy-form-section/index.vue.mjs +0 -7
  84. package/dist/lib/qy-form-section/index.vue2.cjs +0 -1
  85. package/dist/lib/qy-input/index.vue.cjs +0 -1
  86. package/dist/lib/qy-input/index.vue2.cjs +0 -1
  87. package/dist/lib/qy-input/index.vue2.mjs +0 -4
  88. package/dist/lib/qy-money-input/index.vue.cjs +0 -1
  89. package/dist/lib/qy-money-input/index.vue2.cjs +0 -1
  90. package/dist/lib/qy-money-input/index.vue2.mjs +0 -4
  91. package/dist/lib/qy-radio-group/index.vue.cjs +0 -1
  92. package/dist/lib/qy-radio-group/index.vue2.cjs +0 -1
  93. package/dist/lib/qy-radio-group/index.vue2.mjs +0 -4
  94. package/dist/lib/qy-record-quote-search/index.vue.cjs +0 -1
  95. package/dist/lib/qy-record-quote-search/index.vue.mjs +0 -7
  96. package/dist/lib/qy-record-quote-search/index.vue2.cjs +0 -1
  97. package/dist/lib/qy-remote-select/index.vue.cjs +0 -1
  98. package/dist/lib/qy-remote-select/index.vue2.cjs +0 -1
  99. package/dist/lib/qy-remote-select/index.vue2.mjs +0 -4
  100. package/dist/lib/qy-search-input/index.vue.cjs +0 -1
  101. package/dist/lib/qy-search-input/index.vue.mjs +0 -7
  102. package/dist/lib/qy-search-input/index.vue2.cjs +0 -1
  103. package/dist/lib/qy-select/index.vue.cjs +0 -1
  104. package/dist/lib/qy-select/index.vue2.cjs +0 -1
  105. package/dist/lib/qy-select/index.vue2.mjs +0 -4
  106. package/dist/lib/qy-voucher-upload/index.vue.cjs +0 -1
  107. package/dist/lib/remark-image/index.vue.cjs +0 -1
  108. package/dist/lib/remark-image/index.vue.mjs +0 -7
  109. package/dist/lib/remark-image/index.vue2.cjs +0 -1
  110. package/dist/lib/remark-image/index.vue2.mjs +0 -197
  111. package/dist/lib/remark-image/utils.cjs +0 -1
  112. package/dist/lib/remark-image/utils.mjs +0 -22
  113. package/dist/lib/upload/index.vue.cjs +0 -1
  114. package/dist/lib/utils/auth.cjs +0 -1
  115. package/dist/lib/utils/auth.mjs +0 -8
  116. package/dist/lib/utils/install.cjs +0 -1
  117. package/dist/node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.cjs +0 -1
@@ -1,15 +1,17 @@
1
- import { ElUpload as Le, ElIcon as Te, 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 Oe, normalizeClass as F, createVNode as b, createBlock as $e, createCommentVNode as h, withCtx as U, withModifiers as v, unref as ae, Fragment as N, createElementVNode as k, toDisplayString as R, createTextVNode as I } from "vue";
3
- import { Plus as Ae, InfoFilled as Me } from "@element-plus/icons-vue";
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
4
  import { ElMessage as S, ElLoading as Fe } from "element-plus";
5
- import { getToken as Ne } from "../utils/auth.mjs";
6
- /* empty css */
7
- /* empty css */
8
- import _e from "../../_virtual/_plugin-vue_export-helper.mjs";
9
- const Ee = { class: "qy-upload__hint" }, He = ["placeholder", "disabled"], We = ["src"], Xe = {
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 = {
10
12
  key: 1,
11
13
  class: "qy-upload__tip"
12
- }, Ke = { class: "error" }, Qe = { class: "error" }, Je = /* @__PURE__ */ Object.assign({
14
+ }, Je = { class: "error" }, Ge = { class: "error" }, Ye = /* @__PURE__ */ Object.assign({
13
15
  name: "QyUpload"
14
16
  }, {
15
17
  __name: "index",
@@ -73,13 +75,13 @@ const Ee = { class: "qy-upload__hint" }, He = ["placeholder", "disabled"], We =
73
75
  "remove"
74
76
  ],
75
77
  setup(r, { expose: ie, emit: oe }) {
76
- const a = r, y = oe, q = p(null), n = p([]), _ = p(null), se = p(null), B = [];
77
- let O = !1;
78
- const $ = p(!1), A = p([]), E = p(0), D = p(!1), H = p(""), W = p(""), j = /* @__PURE__ */ new Set(), P = p(!1), c = p(""), M = p(!1);
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);
79
81
  ze(() => {
80
- a.modelValue === void 0 && K(a.defaultValue);
82
+ a.modelValue === void 0 && W(a.defaultValue);
81
83
  });
82
- const ne = V(() => ({ large: "160px", default: "140px", small: "80px" })[a.size] ?? a.size), ue = V(() => a.disabled), re = V(
84
+ const se = V(() => ({ large: "160px", default: "140px", small: "80px" })[a.size] ?? a.size), ue = V(() => a.disabled), re = V(
83
85
  () => {
84
86
  var e;
85
87
  return a.isShowTip && (a.fileSize || ((e = x.value) == null ? void 0 : e.length));
@@ -89,7 +91,7 @@ const Ee = { class: "qy-upload__hint" }, He = ["placeholder", "disabled"], We =
89
91
  return (e = a.fileType) != null && e.length ? a.fileType.map((t) => t.toLowerCase()) : a.supportVideo ? ["mp4", "mov", "avi"] : ["jpg", "jpeg", "png", "gif", "webp"];
90
92
  }), z = V(() => {
91
93
  const e = a.supportVideo ? 1 : a.limit;
92
- return n.value.length >= e;
94
+ return s.value.length >= e;
93
95
  }), de = V(
94
96
  () => x.value.map((e) => `.${e}`).join(",")
95
97
  ), pe = V(() => ({
@@ -98,25 +100,25 @@ const Ee = { class: "qy-upload__hint" }, He = ["placeholder", "disabled"], We =
98
100
  "qy-upload--video": a.supportVideo,
99
101
  "qy-upload--without-text": !a.showText && !a.showPasteInput
100
102
  }));
101
- le(c, () => {
102
- O || L();
103
+ le(f, () => {
104
+ A || D();
103
105
  }), le(
104
106
  () => a.modelValue,
105
107
  (e) => {
106
- e !== void 0 && K(e);
108
+ e !== void 0 && W(e);
107
109
  },
108
110
  { immediate: !0, deep: !0 }
109
111
  );
110
- function X(e) {
112
+ function Q(e) {
111
113
  return Array.isArray(e) ? e.filter(Boolean) : e ? String(e).split(",").filter(Boolean) : [];
112
114
  }
113
- function fe(e) {
114
- return Array.isArray(e) ? { files: e, text: "" } : typeof e == "string" ? { files: X(e), text: "" } : e && typeof e == "object" ? {
115
- files: X(e.files),
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),
116
118
  text: e.text ?? ""
117
119
  } : { files: [], text: "" };
118
120
  }
119
- function ce(e = []) {
121
+ function fe(e = []) {
120
122
  return e.map((t, i) => ({
121
123
  name: String(t).split("/").pop() || `file-${i}`,
122
124
  url: t,
@@ -125,33 +127,33 @@ const Ee = { class: "qy-upload__hint" }, He = ["placeholder", "disabled"], We =
125
127
  }));
126
128
  }
127
129
  function me(e) {
128
- const t = new Set(e.map((l) => l.url)), i = n.value.filter(
130
+ const t = new Set(e.map((l) => l.url)), i = s.value.filter(
129
131
  (l) => l.status === "uploading" && !t.has(l.url)
130
132
  );
131
133
  return [...e, ...i];
132
134
  }
133
- function K(e) {
134
- const t = fe(e);
135
- O = !0, c.value = t.text, n.value = me(ce(t.files)), Ce(() => {
136
- O = !1;
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;
137
139
  });
138
140
  }
139
- function Q(e) {
141
+ function X(e) {
140
142
  return a.valueFormat === "array" ? e.files : a.valueFormat === "string" ? e.files.join(",") : e;
141
143
  }
142
144
  function ve() {
143
145
  var e;
144
- (e = _.value) == null || e.focus();
146
+ (e = N.value) == null || e.focus();
145
147
  }
146
148
  function ye(e) {
147
149
  e.target.value = "";
148
150
  }
149
- function L(e) {
150
- const l = { files: (e ?? n.value).filter((o) => o.status === "success" && o.url).map((o) => o.url), text: c.value };
151
- y("update:modelValue", Q(l)), y("change", l), a.callBack && a.callBack(l);
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);
152
154
  }
153
155
  function ge(e, t) {
154
- L(t), y("remove", e, t);
156
+ D(t), y("remove", e, t);
155
157
  }
156
158
  function xe(e) {
157
159
  var l;
@@ -165,42 +167,42 @@ const Ee = { class: "qy-upload__hint" }, He = ["placeholder", "disabled"], We =
165
167
  function J(e, t, i, l) {
166
168
  var ee, te;
167
169
  const o = a.api.startsWith("http") ? a.api : window.location.origin + a.api.replace(/^([^/])/, "/$1"), d = new FormData();
168
- d.append(a.name, e), a.extraData && Object.entries(a.extraData).forEach(([u, De]) => d.append(u, De));
169
- const s = new XMLHttpRequest();
170
- B.push(s);
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);
171
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({
172
174
  target: w,
173
175
  text: "上传中",
174
176
  background: "rgba(255,255,255,0.7)"
175
- }), f = () => {
176
- const u = B.indexOf(s);
177
- u !== -1 && B.splice(u, 1), C.close();
177
+ }), c = () => {
178
+ const u = U.indexOf(n);
179
+ u !== -1 && U.splice(u, 1), C.close();
178
180
  };
179
- s.open("POST", o);
180
- const Z = Ne(a.tokenKey);
181
- Z && s.setRequestHeader("Authorization", `Bearer ${Z}`), s.upload.onprogress = (u) => {
181
+ n.open("POST", o);
182
+ const Z = He(a.tokenKey);
183
+ Z && n.setRequestHeader("Authorization", `Bearer ${Z}`), n.upload.onprogress = (u) => {
182
184
  u.total > 0 && (t == null || t({ percent: u.loaded / u.total * 100 }));
183
- }, s.onload = () => {
184
- if (f(), s.status < 200 || s.status >= 300) {
185
- const u = `上传失败 (HTTP ${s.status})`;
186
- S.error(u), y("error", { msg: u, status: s.status }), l == null || l(new Error(u));
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));
187
189
  return;
188
190
  }
189
191
  try {
190
- const u = JSON.parse(s.responseText);
192
+ const u = JSON.parse(n.responseText);
191
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));
192
194
  } catch {
193
195
  S.error("上传失败,响应格式错误"), y("error", new Error("Response parse error")), l == null || l(new Error("Response parse error"));
194
196
  }
195
- }, s.onerror = () => {
196
- f(), S.error("上传失败,网络异常"), y("error", new Error("Network error")), l == null || l(new Error("Network error"));
197
- }, s.send(d);
197
+ }, n.onerror = () => {
198
+ c(), S.error("上传失败,网络异常"), y("error", new Error("Network error")), l == null || l(new Error("Network error"));
199
+ }, n.send(d);
198
200
  }
199
201
  function G(e) {
200
202
  return a.disabled ? !1 : xe(e);
201
203
  }
202
204
  function be(e, t) {
203
- const i = n.value.find(
205
+ const i = s.value.find(
204
206
  (l) => {
205
207
  var o;
206
208
  return l.uid === (e == null ? void 0 : e.uid) || ((o = l.raw) == null ? void 0 : o.uid) === (e == null ? void 0 : e.uid);
@@ -213,7 +215,7 @@ const Ee = { class: "qy-upload__hint" }, He = ["placeholder", "disabled"], We =
213
215
  e.file,
214
216
  e.onProgress,
215
217
  (t) => {
216
- be(e.file, t.url), e.onSuccess(t), L(), y("success", t);
218
+ be(e.file, t.url), e.onSuccess(t), D(), y("success", t);
217
219
  },
218
220
  (t) => e.onError(t)
219
221
  );
@@ -223,10 +225,10 @@ const Ee = { class: "qy-upload__hint" }, He = ["placeholder", "disabled"], We =
223
225
  if (!e.url) return;
224
226
  const t = ((l = e.url.split(".").pop()) == null ? void 0 : l.toLowerCase()) || "";
225
227
  if (["mp4", "mov", "avi", "webm"].includes(t)) {
226
- H.value = e.url, W.value = e.name || "视频预览", D.value = !0;
228
+ H.value = e.url, K.value = e.name || "视频预览", B.value = !0;
227
229
  return;
228
230
  }
229
- const i = n.value.filter(
231
+ const i = s.value.filter(
230
232
  (o) => {
231
233
  var d;
232
234
  return o.status === "success" && o.url && !["mp4", "mov", "avi", "webm"].includes(
@@ -234,17 +236,17 @@ const Ee = { class: "qy-upload__hint" }, He = ["placeholder", "disabled"], We =
234
236
  );
235
237
  }
236
238
  );
237
- A.value = i.map((o) => o.url), E.value = i.findIndex((o) => o.uid === e.uid) || 0, $.value = !0;
239
+ $.value = i.map((o) => o.url), E.value = i.findIndex((o) => o.uid === e.uid) || 0, O.value = !0;
238
240
  }
239
241
  function Ve() {
240
- $.value = !1, A.value = [];
242
+ O.value = !1, $.value = [];
241
243
  }
242
244
  function Y(e) {
243
245
  for (let t = 0; t < e.length; t++) {
244
246
  const i = e[t];
245
247
  if (!G(i)) continue;
246
248
  const l = Date.now() + t, o = URL.createObjectURL(i);
247
- j.add(o), n.value.push({
249
+ j.add(o), s.value.push({
248
250
  uid: l,
249
251
  name: i.name || `file-${l}`,
250
252
  status: "uploading",
@@ -253,18 +255,18 @@ const Ee = { class: "qy-upload__hint" }, He = ["placeholder", "disabled"], We =
253
255
  }), J(
254
256
  i,
255
257
  (d) => {
256
- const s = n.value.find((w) => w.uid === l);
257
- s && (s.percentage = d.percent);
258
+ const n = s.value.find((w) => w.uid === l);
259
+ n && (n.percentage = d.percent);
258
260
  },
259
261
  (d) => {
260
- const s = n.value.find((w) => w.uid === l);
261
- s && (s.status = "success", s.url = d.url, L(), y("success", d));
262
+ const n = s.value.find((w) => w.uid === l);
263
+ n && (n.status = "success", n.url = d.url, D(), y("success", d));
262
264
  },
263
- () => Be(l)
265
+ () => Ue(l)
264
266
  );
265
267
  }
266
268
  }
267
- function T(e) {
269
+ function L(e) {
268
270
  var l;
269
271
  if (a.disabled) return;
270
272
  const t = (l = e.clipboardData) == null ? void 0 : l.items;
@@ -273,8 +275,8 @@ const Ee = { class: "qy-upload__hint" }, He = ["placeholder", "disabled"], We =
273
275
  for (let o = 0; o < t.length; o++) {
274
276
  const d = t[o];
275
277
  if (d.kind === "file" && d.type.startsWith("image/")) {
276
- const s = d.getAsFile();
277
- s && i.push(s);
278
+ const n = d.getAsFile();
279
+ n && i.push(n);
278
280
  }
279
281
  }
280
282
  i.length && (e.preventDefault(), Y(i));
@@ -285,7 +287,7 @@ const Ee = { class: "qy-upload__hint" }, He = ["placeholder", "disabled"], We =
285
287
  function Se() {
286
288
  P.value = !1;
287
289
  }
288
- function Ue(e) {
290
+ function Te(e) {
289
291
  var i;
290
292
  if (P.value = !1, a.disabled || a.disableDrag || z.value) return;
291
293
  const t = Array.from(((i = e.dataTransfer) == null ? void 0 : i.files) || []).filter(
@@ -296,13 +298,13 @@ const Ee = { class: "qy-upload__hint" }, He = ["placeholder", "disabled"], We =
296
298
  );
297
299
  t.length && Y(t);
298
300
  }
299
- function Be(e) {
301
+ function Ue(e) {
300
302
  var i;
301
- const t = n.value.findIndex((l) => l.uid === e);
302
- t !== -1 && ((i = n.value[t].url) != null && i.startsWith("blob:") && (URL.revokeObjectURL(n.value[t].url), j.delete(n.value[t].url)), n.value.splice(t, 1));
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));
303
305
  }
304
306
  return Ie(() => {
305
- B.forEach((e) => e.abort()), B.length = 0, j.forEach((e) => URL.revokeObjectURL(e)), j.clear();
307
+ U.forEach((e) => e.abort()), U.length = 0, j.forEach((e) => URL.revokeObjectURL(e)), j.clear();
306
308
  }), ie({
307
309
  /** 主动打开文件选择框,供表单或快捷操作调用 */
308
310
  openFileDialog: () => {
@@ -310,33 +312,33 @@ const Ee = { class: "qy-upload__hint" }, He = ["placeholder", "disabled"], We =
310
312
  a.disabled || z.value || (t = (e = q.value) == null ? void 0 : e.$el.querySelector('input[type="file"]')) == null || t.click();
311
313
  },
312
314
  /** 获取已上传成功的文件 URL 列表 */
313
- getPathList: () => n.value.filter((e) => e.status === "success").map((e) => e.url),
315
+ getPathList: () => s.value.filter((e) => e.status === "success").map((e) => e.url),
314
316
  /** 清空文件和文字,并同步 change 事件 */
315
317
  clearFiles: () => {
316
- n.value = [], c.value = "", L();
318
+ s.value = [], f.value = "", D();
317
319
  },
318
320
  /** 获取完整值,结构与 change 事件保持一致 */
319
321
  getValue: () => ({
320
- files: n.value.filter((e) => e.status === "success" && e.url).map((e) => e.url),
321
- text: c.value
322
+ files: s.value.filter((e) => e.status === "success" && e.url).map((e) => e.url),
323
+ text: f.value
322
324
  }),
323
325
  /** 获取按 valueFormat 输出的值,便于外部不走 v-model 时读取 */
324
- getModelValue: () => Q({
325
- files: n.value.filter((e) => e.status === "success" && e.url).map((e) => e.url),
326
- text: c.value
326
+ getModelValue: () => X({
327
+ files: s.value.filter((e) => e.status === "success" && e.url).map((e) => e.url),
328
+ text: f.value
327
329
  })
328
330
  }), (e, t) => {
329
331
  var C;
330
- const i = Te, l = qe, o = Re, d = Le, s = je, w = Pe;
332
+ const i = Le, l = qe, o = Re, d = De, n = je, w = Pe;
331
333
  return m(), g("div", {
332
334
  class: F(["qy-upload", pe.value]),
333
- style: Oe({ "--qy-upload-size": ne.value })
335
+ style: Ae({ "--qy-upload-size": se.value })
334
336
  }, [
335
337
  b(d, {
336
338
  ref_key: "uploadRef",
337
339
  ref: q,
338
- "file-list": n.value,
339
- "onUpdate:fileList": t[6] || (t[6] = (f) => n.value = f),
340
+ "file-list": s.value,
341
+ "onUpdate:fileList": t[6] || (t[6] = (c) => s.value = c),
340
342
  action: "#",
341
343
  multiple: r.supportVideo ? !1 : r.multiple,
342
344
  limit: r.supportVideo ? 1 : r.limit,
@@ -348,58 +350,58 @@ const Ee = { class: "qy-upload__hint" }, He = ["placeholder", "disabled"], We =
348
350
  "on-preview": we,
349
351
  "on-remove": ge
350
352
  }, {
351
- default: U(() => [
353
+ default: T(() => [
352
354
  z.value ? h("", !0) : (m(), g("div", {
353
355
  key: 0,
354
356
  class: F(["qy-upload__trigger", { "is-dragover": P.value }]),
355
- onPaste: T,
357
+ onPaste: L,
356
358
  onDragover: v(ke, ["prevent"]),
357
359
  onDragleave: v(Se, ["prevent"]),
358
- onDrop: v(Ue, ["prevent"])
360
+ onDrop: v(Te, ["prevent"])
359
361
  }, [
360
362
  b(i, { class: "qy-upload__icon" }, {
361
- default: U(() => [
362
- b(ae(Ae))
363
+ default: T(() => [
364
+ b(ae($e))
363
365
  ]),
364
366
  _: 1
365
367
  }),
366
- r.supportVideo ? (m(), g(N, { key: 0 }, [
368
+ r.supportVideo ? (m(), g(_, { key: 0 }, [
367
369
  t[9] || (t[9] = k("span", { class: "qy-upload__label" }, "点击上传视频", -1)),
368
- k("span", Ee, "支持 " + R(x.value.join(" / ")) + ",不超过 " + R(r.fileSize) + "MB", 1)
370
+ k("span", Ke, "支持 " + R(x.value.join(" / ")) + ",不超过 " + R(r.fileSize) + "MB", 1)
369
371
  ], 64)) : h("", !0),
370
372
  r.showText ? (m(), g("div", {
371
373
  key: 1,
372
374
  class: "qy-upload__text",
373
375
  onClick: t[3] || (t[3] = v(() => {
374
376
  }, ["stop"])),
375
- onPaste: v(T, ["stop"])
377
+ onPaste: v(L, ["stop"])
376
378
  }, [
377
379
  b(o, {
378
380
  visible: M.value,
379
- "onUpdate:visible": t[2] || (t[2] = (f) => M.value = f),
381
+ "onUpdate:visible": t[2] || (t[2] = (c) => M.value = c),
380
382
  placement: "bottom-start",
381
383
  width: 220,
382
384
  trigger: "click",
383
385
  "popper-class": "qy-upload__text-popover",
384
386
  onAfterEnter: ve
385
387
  }, {
386
- reference: U(() => [
388
+ reference: T(() => [
387
389
  k("div", {
388
- class: F(["qy-upload__text-preview", { "is-placeholder": !c.value }])
389
- }, R(c.value || r.pastePlaceholder), 3)
390
+ class: F(["qy-upload__text-preview", { "is-placeholder": !f.value }])
391
+ }, R(f.value || r.pastePlaceholder), 3)
390
392
  ]),
391
- default: U(() => [
393
+ default: T(() => [
392
394
  b(l, {
393
395
  ref_key: "inputRef",
394
- ref: _,
395
- modelValue: c.value,
396
- "onUpdate:modelValue": t[0] || (t[0] = (f) => c.value = f),
396
+ ref: N,
397
+ modelValue: f.value,
398
+ "onUpdate:modelValue": t[0] || (t[0] = (c) => f.value = c),
397
399
  type: "textarea",
398
400
  autosize: { minRows: 2, maxRows: 5 },
399
401
  placeholder: r.pastePlaceholder,
400
402
  disabled: r.disabled,
401
- onBlur: t[1] || (t[1] = (f) => M.value = !1),
402
- onPaste: v(T, ["stop"])
403
+ onBlur: t[1] || (t[1] = (c) => M.value = !1),
404
+ onPaste: v(L, ["stop"])
403
405
  }, null, 8, ["modelValue", "placeholder", "disabled"])
404
406
  ]),
405
407
  _: 1
@@ -409,41 +411,41 @@ const Ee = { class: "qy-upload__hint" }, He = ["placeholder", "disabled"], We =
409
411
  class: "qy-upload__text",
410
412
  onClick: t[5] || (t[5] = v(() => {
411
413
  }, ["stop"])),
412
- onPaste: v(T, ["stop"])
414
+ onPaste: v(L, ["stop"])
413
415
  }, [
414
416
  k("input", {
415
417
  ref_key: "pasteInputRef",
416
- ref: se,
418
+ ref: ne,
417
419
  class: "qy-upload__paste-input",
418
420
  placeholder: r.pastePlaceholder,
419
421
  disabled: r.disabled,
420
- onPaste: v(T, ["stop"]),
422
+ onPaste: v(L, ["stop"]),
421
423
  onInput: ye,
422
424
  onClick: t[4] || (t[4] = v(() => {
423
425
  }, ["stop"]))
424
- }, null, 40, He)
426
+ }, null, 40, Qe)
425
427
  ], 32)) : h("", !0)
426
428
  ], 34))
427
429
  ]),
428
430
  _: 1
429
431
  }, 8, ["file-list", "multiple", "limit", "list-type", "accept", "disabled"]),
430
- $.value ? (m(), $e(s, {
432
+ O.value ? (m(), Oe(n, {
431
433
  key: 0,
432
- "url-list": A.value,
434
+ "url-list": $.value,
433
435
  "initial-index": E.value,
434
436
  onClose: Ve
435
437
  }, null, 8, ["url-list", "initial-index"])) : h("", !0),
436
438
  b(w, {
437
- modelValue: D.value,
438
- "onUpdate:modelValue": t[7] || (t[7] = (f) => D.value = f),
439
- title: W.value,
439
+ modelValue: B.value,
440
+ "onUpdate:modelValue": t[7] || (t[7] = (c) => B.value = c),
441
+ title: K.value,
440
442
  width: "640px",
441
443
  "append-to-body": "",
442
444
  "destroy-on-close": "",
443
- onClose: t[8] || (t[8] = (f) => D.value = !1)
445
+ onClose: t[8] || (t[8] = (c) => B.value = !1)
444
446
  }, {
445
- default: U(() => [
446
- D.value ? (m(), g("video", {
447
+ default: T(() => [
448
+ B.value ? (m(), g("video", {
447
449
  key: 0,
448
450
  src: H.value,
449
451
  controls: "",
@@ -455,20 +457,20 @@ const Ee = { class: "qy-upload__hint" }, He = ["placeholder", "disabled"], We =
455
457
  }, 8, ["modelValue", "title"]),
456
458
  re.value ? (m(), g("div", Xe, [
457
459
  b(i, null, {
458
- default: U(() => [
460
+ default: T(() => [
459
461
  b(ae(Me))
460
462
  ]),
461
463
  _: 1
462
464
  }),
463
465
  k("span", null, [
464
466
  t[12] || (t[12] = I(" 请上传 ", -1)),
465
- r.fileSize ? (m(), g(N, { key: 0 }, [
467
+ r.fileSize ? (m(), g(_, { key: 0 }, [
466
468
  t[10] || (t[10] = I("大小不超过 ", -1)),
467
- k("b", Ke, R(r.fileSize) + "MB", 1)
469
+ k("b", Je, R(r.fileSize) + "MB", 1)
468
470
  ], 64)) : h("", !0),
469
- (C = x.value) != null && C.length ? (m(), g(N, { key: 1 }, [
471
+ (C = x.value) != null && C.length ? (m(), g(_, { key: 1 }, [
470
472
  t[11] || (t[11] = I(",格式为 ", -1)),
471
- k("b", Qe, R(x.value.join("/")), 1)
473
+ k("b", Ge, R(x.value.join("/")), 1)
472
474
  ], 64)) : h("", !0),
473
475
  t[13] || (t[13] = I(" 的文件。 ", -1))
474
476
  ])
@@ -476,7 +478,7 @@ const Ee = { class: "qy-upload__hint" }, He = ["placeholder", "disabled"], We =
476
478
  ], 6);
477
479
  };
478
480
  }
479
- }), ot = /* @__PURE__ */ _e(Je, [["__scopeId", "data-v-1d6de9b6"]]);
481
+ }), ot = /* @__PURE__ */ Ne(Ye, [["__scopeId", "data-v-8b875cce"]]);
480
482
  export {
481
- ot as default
483
+ ot as Q
482
484
  };
@@ -1,5 +1,5 @@
1
1
  import { useAttrs as b, ref as k, createBlock as S, openBlock as V, mergeProps as x, unref as z } from "vue";
2
- import B from "../upload/index.vue.mjs";
2
+ import { Q as B } from "./index-DeWkPj3O.mjs";
3
3
  const w = /* @__PURE__ */ Object.assign({
4
4
  name: "QyVoucherUpload",
5
5
  inheritAttrs: !1
@@ -119,5 +119,5 @@ const w = /* @__PURE__ */ Object.assign({
119
119
  }
120
120
  });
121
121
  export {
122
- w as default
122
+ w as _
123
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;