@qynpm/ui 1.0.6 → 1.0.7

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 (76) hide show
  1. package/dist/index.cjs +2 -2
  2. package/dist/index.mjs +19 -54
  3. package/dist/qy-action-bar/index.cjs +1 -1
  4. package/dist/qy-action-bar/index.mjs +2 -4
  5. package/dist/qy-dialog/index.cjs +1 -1
  6. package/dist/qy-dialog/index.mjs +2 -4
  7. package/dist/qy-form-section/index.cjs +1 -1
  8. package/dist/qy-form-section/index.mjs +2 -4
  9. package/dist/qy-input/index.cjs +1 -1
  10. package/dist/qy-input/index.mjs +2 -4
  11. package/dist/qy-money-input/index.cjs +1 -1
  12. package/dist/qy-money-input/index.mjs +2 -4
  13. package/dist/qy-radio-group/index.cjs +1 -1
  14. package/dist/qy-radio-group/index.mjs +2 -4
  15. package/dist/qy-record-quote-search/index.cjs +1 -1
  16. package/dist/qy-record-quote-search/index.mjs +2 -4
  17. package/dist/qy-remark-image/index.cjs +1 -1
  18. package/dist/qy-remark-image/index.mjs +2 -4
  19. package/dist/qy-remote-select/index.cjs +1 -1
  20. package/dist/qy-remote-select/index.mjs +2 -4
  21. package/dist/qy-search-input/index.cjs +1 -1
  22. package/dist/qy-search-input/index.mjs +2 -4
  23. package/dist/qy-select/index.cjs +1 -1
  24. package/dist/qy-select/index.mjs +2 -4
  25. package/dist/qy-upload/index.cjs +1 -1
  26. package/dist/qy-upload/index.mjs +2 -4
  27. package/dist/qy-voucher-upload/index.cjs +1 -1
  28. package/dist/qy-voucher-upload/index.mjs +2 -4
  29. package/dist/shared/index-CbFvRxuh.mjs +2592 -0
  30. package/dist/shared/index-GDrnDY44.cjs +1 -0
  31. package/package.json +1 -1
  32. package/qy-action-bar/index.js +1 -4
  33. package/qy-dialog/index.js +1 -4
  34. package/qy-form-section/index.js +1 -4
  35. package/qy-input/index.js +1 -4
  36. package/qy-money-input/index.js +1 -15
  37. package/qy-radio-group/index.js +1 -15
  38. package/qy-record-quote-search/index.js +1 -4
  39. package/qy-remark-image/index.js +1 -4
  40. package/qy-remote-select/index.js +1 -15
  41. package/qy-search-input/index.js +1 -4
  42. package/qy-select/index.js +1 -4
  43. package/qy-upload/index.js +1 -4
  44. package/qy-voucher-upload/index.js +1 -15
  45. package/dist/shared/_plugin-vue_export-helper-BHFhmbuH.cjs +0 -1
  46. package/dist/shared/_plugin-vue_export-helper-CHgC5LLL.mjs +0 -9
  47. package/dist/shared/index-Bw9kVFsm.mjs +0 -56
  48. package/dist/shared/index-BzV4959-.mjs +0 -205
  49. package/dist/shared/index-C0ADdL4S.mjs +0 -88
  50. package/dist/shared/index-CBSjmD0C.mjs +0 -217
  51. package/dist/shared/index-CJb1S7CP.cjs +0 -1
  52. package/dist/shared/index-CO8lz02r.cjs +0 -1
  53. package/dist/shared/index-ClPxDFKd.cjs +0 -1
  54. package/dist/shared/index-CtOqRiaj.cjs +0 -1
  55. package/dist/shared/index-DXB7_Tb5.cjs +0 -1
  56. package/dist/shared/index-DeWkPj3O.mjs +0 -484
  57. package/dist/shared/index-PUYQxK94.mjs +0 -123
  58. package/dist/shared/index-UzZbxoqZ.cjs +0 -1
  59. package/dist/shared/index-a90QeEC4.cjs +0 -1
  60. package/dist/shared/index-wW02nNOp.mjs +0 -277
  61. package/dist/shared/index.vue_vue_type_script_setup_true_lang-BcZg8D-y.mjs +0 -214
  62. package/dist/shared/index.vue_vue_type_script_setup_true_lang-BmeBeCu0.mjs +0 -162
  63. package/dist/shared/index.vue_vue_type_script_setup_true_lang-C85575cL.cjs +0 -1
  64. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DkYwdYdF.mjs +0 -90
  65. package/dist/shared/index.vue_vue_type_script_setup_true_lang-Do5SZ8yS.cjs +0 -1
  66. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DpZzyX5f.cjs +0 -1
  67. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DuUkOqwY.cjs +0 -1
  68. package/dist/shared/index.vue_vue_type_script_setup_true_lang-Dvh1BFaR.mjs +0 -143
  69. package/dist/shared/index.vue_vue_type_script_setup_true_lang-RtfqJ73A.mjs +0 -171
  70. package/dist/shared/index.vue_vue_type_script_setup_true_lang-VVjCLNMD.cjs +0 -1
  71. package/dist/shared/index.vue_vue_type_style_index_0_lang-DpIL_6vO.mjs +0 -325
  72. package/dist/shared/index.vue_vue_type_style_index_0_lang-haqCjB5x.cjs +0 -1
  73. package/dist/shared/install-CxBnxbuN.mjs +0 -8
  74. package/dist/shared/install-c8il9DQv.cjs +0 -1
  75. package/dist/shared/js.cookie-CojEIxHg.cjs +0 -1
  76. package/dist/shared/js.cookie-OLEfuq_g.mjs +0 -74
@@ -0,0 +1,2592 @@
1
+ import { ElUpload as $t, ElIcon as We, ElPopover as St, ElInput as Bt, ElImageViewer as Ct, ElDialog as Ge } from "element-plus/es";
2
+ import { ref as B, onMounted as Ue, computed as H, watch as pe, nextTick as _e, onBeforeUnmount as Xe, createElementBlock as R, openBlock as v, normalizeStyle as Se, normalizeClass as ie, createVNode as te, createBlock as ce, createCommentVNode as N, withCtx as k, withModifiers as Y, unref as E, Fragment as Ce, createElementVNode as z, toDisplayString as ae, createTextVNode as Ve, useAttrs as ve, mergeProps as fe, defineComponent as me, mergeModels as je, useSlots as Je, useModel as xt, watchEffect as zt, h as Ke, onUnmounted as Ye, resolveComponent as It, withDirectives as et, createSlots as $e, renderSlot as $, vShow as tt, withKeys as Ae, renderList as lt, resolveDynamicComponent as qt, Comment as Mt, normalizeProps as Fe, guardReactiveProps as Qe } from "vue";
3
+ import { Plus as Rt, InfoFilled as Tt } from "@element-plus/icons-vue";
4
+ import { ElMessage as ge, ElLoading as Ot, ElButton as Me, ElInput as De, ElPopover as Ut, ElUpload as _t, ElRadioButton as At, ElRadio as Ft, ElRadioGroup as Qt, ElSelect as Dt, ElOption as Et, ElAutocomplete as Lt } from "element-plus";
5
+ import Pt from "clsx";
6
+ import { useBreakpoints as jt, useDraggable as Kt } from "@vueuse/core";
7
+ /*! js-cookie v3.0.5 | MIT */
8
+ function qe(o) {
9
+ for (var h = 1; h < arguments.length; h++) {
10
+ var I = arguments[h];
11
+ for (var e in I)
12
+ o[e] = I[e];
13
+ }
14
+ return o;
15
+ }
16
+ var Nt = {
17
+ read: function(o) {
18
+ return o[0] === '"' && (o = o.slice(1, -1)), o.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
19
+ },
20
+ write: function(o) {
21
+ return encodeURIComponent(o).replace(
22
+ /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
23
+ decodeURIComponent
24
+ );
25
+ }
26
+ };
27
+ function Oe(o, h) {
28
+ function I(n, T, r) {
29
+ if (!(typeof document > "u")) {
30
+ r = qe({}, h, r), typeof r.expires == "number" && (r.expires = new Date(Date.now() + r.expires * 864e5)), r.expires && (r.expires = r.expires.toUTCString()), n = encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
31
+ var c = "";
32
+ for (var S in r)
33
+ r[S] && (c += "; " + S, r[S] !== !0 && (c += "=" + r[S].split(";")[0]));
34
+ return document.cookie = n + "=" + o.write(T, n) + c;
35
+ }
36
+ }
37
+ function e(n) {
38
+ if (!(typeof document > "u" || arguments.length && !n)) {
39
+ for (var T = document.cookie ? document.cookie.split("; ") : [], r = {}, c = 0; c < T.length; c++) {
40
+ var S = T[c].split("="), b = S.slice(1).join("=");
41
+ try {
42
+ var O = decodeURIComponent(S[0]);
43
+ if (r[O] = o.read(b, O), n === O)
44
+ break;
45
+ } catch {
46
+ }
47
+ }
48
+ return n ? r[n] : r;
49
+ }
50
+ }
51
+ return Object.create(
52
+ {
53
+ set: I,
54
+ get: e,
55
+ remove: function(n, T) {
56
+ I(
57
+ n,
58
+ "",
59
+ qe({}, T, {
60
+ expires: -1
61
+ })
62
+ );
63
+ },
64
+ withAttributes: function(n) {
65
+ return Oe(this.converter, qe({}, this.attributes, n));
66
+ },
67
+ withConverter: function(n) {
68
+ return Oe(qe({}, this.converter, n), this.attributes);
69
+ }
70
+ },
71
+ {
72
+ attributes: { value: Object.freeze(h) },
73
+ converter: { value: Object.freeze(o) }
74
+ }
75
+ );
76
+ }
77
+ var at = Oe(Nt, { path: "/" });
78
+ const Ht = "Admin-Token";
79
+ function Zt(o = Ht) {
80
+ return at.get(o);
81
+ }
82
+ const Be = (o, h) => {
83
+ const I = o.__vccOpts || o;
84
+ for (const [e, n] of h)
85
+ I[e] = n;
86
+ return I;
87
+ }, Wt = { class: "qy-upload__hint" }, Gt = ["placeholder", "disabled"], Xt = ["src"], Jt = {
88
+ key: 1,
89
+ class: "qy-upload__tip"
90
+ }, Yt = { class: "error" }, el = { class: "error" }, tl = /* @__PURE__ */ Object.assign({
91
+ name: "QyUpload"
92
+ }, {
93
+ __name: "index",
94
+ props: {
95
+ /**
96
+ * 受控值。valueFormat 为 object 时结构为 { files, text },
97
+ * array 时为 string[],string 时为逗号分隔 URL。
98
+ */
99
+ modelValue: { type: [Object, Array, String], default: void 0 },
100
+ /**
101
+ * 初始值,结构为 { files: '逗号分隔的URL', text: '文字内容' }
102
+ * 非受控模式,仅初始化时读取一次
103
+ */
104
+ defaultValue: { type: Object, default: () => ({ files: "", text: "" }) },
105
+ /** v-model 输出格式:object | array | string */
106
+ valueFormat: { type: String, default: "object" },
107
+ /** 是否显示底部文字备注区 */
108
+ showText: { type: Boolean, default: !0 },
109
+ /** 是否显示纯粘贴输入条,不保存文字,仅用于承接 Ctrl+V 图片 */
110
+ showPasteInput: { type: Boolean, default: !1 },
111
+ /** 文字区占位文案,也用于凭证上传的粘贴提示 */
112
+ pastePlaceholder: { type: String, default: "输入文字" },
113
+ /** 是否多选 */
114
+ multiple: { type: Boolean, default: !0 },
115
+ /** 是否禁用 */
116
+ disabled: { type: Boolean, default: !1 },
117
+ /** 允许的文件类型后缀(如 ['jpg', 'mp4']) */
118
+ fileType: { type: Array, default: () => [] },
119
+ /** 单个文件大小限制(MB) */
120
+ fileSize: { type: Number, default: 10 },
121
+ /** 文件数量限制 */
122
+ limit: { type: Number, default: 9 },
123
+ /** 是否显示格式/大小提示 */
124
+ isShowTip: { type: Boolean, default: !1 },
125
+ /** 接口路径 */
126
+ api: { type: String, default: "/permission-api/common/uploads" },
127
+ /** FormData 中文件字段名 */
128
+ name: { type: String, default: "file" },
129
+ /** token 读取 key,对应 utils/auth 中的存储字段 */
130
+ tokenKey: { type: String, default: "Admin-Token" },
131
+ /** 是否支持视频模式(强制 limit=1) */
132
+ supportVideo: { type: Boolean, default: !1 },
133
+ /**
134
+ * 卡片尺寸
135
+ * 预设:'large'(160px) | 'default'(140px) | 'small'(80px)
136
+ * 自定义:任意 CSS 单位,如 '60px'、'8vw'
137
+ */
138
+ size: { type: String, default: "default" },
139
+ /** 禁用拖拽(默认在触发区开启) */
140
+ disableDrag: { type: Boolean, default: !1 },
141
+ /** 成功回调(用于复杂业务联动) */
142
+ callBack: { type: Function, default: null },
143
+ /** 上传时附加的额外 FormData 字段 */
144
+ extraData: { type: Object, default: () => ({}) }
145
+ },
146
+ emits: [
147
+ "update:modelValue",
148
+ "change",
149
+ "success",
150
+ "error",
151
+ "remove"
152
+ ],
153
+ setup(o, { expose: h, emit: I }) {
154
+ const e = o, n = I, T = B(null), r = B([]), c = B(null), S = B(null), b = [];
155
+ let O = !1;
156
+ const F = B(!1), q = B([]), L = B(0), f = B(!1), M = B(""), m = B(""), C = /* @__PURE__ */ new Set(), Q = B(!1), p = B(""), U = B(!1);
157
+ Ue(() => {
158
+ e.modelValue === void 0 && se(e.defaultValue);
159
+ });
160
+ const s = H(() => ({ large: "160px", default: "140px", small: "80px" })[e.size] ?? e.size), _ = H(() => e.disabled), j = H(
161
+ () => {
162
+ var i;
163
+ return e.isShowTip && (e.fileSize || ((i = K.value) == null ? void 0 : i.length));
164
+ }
165
+ ), K = H(() => {
166
+ var i;
167
+ return (i = e.fileType) != null && i.length ? e.fileType.map((d) => d.toLowerCase()) : e.supportVideo ? ["mp4", "mov", "avi"] : ["jpg", "jpeg", "png", "gif", "webp"];
168
+ }), ee = H(() => {
169
+ const i = e.supportVideo ? 1 : e.limit;
170
+ return r.value.length >= i;
171
+ }), oe = H(
172
+ () => K.value.map((i) => `.${i}`).join(",")
173
+ ), t = H(() => ({
174
+ "qy-upload--reached-limit": ee.value,
175
+ "qy-upload--disabled": e.disabled,
176
+ "qy-upload--video": e.supportVideo,
177
+ "qy-upload--without-text": !e.showText && !e.showPasteInput
178
+ }));
179
+ pe(p, () => {
180
+ O || D();
181
+ }), pe(
182
+ () => e.modelValue,
183
+ (i) => {
184
+ i !== void 0 && se(i);
185
+ },
186
+ { immediate: !0, deep: !0 }
187
+ );
188
+ function l(i) {
189
+ return Array.isArray(i) ? i.filter(Boolean) : i ? String(i).split(",").filter(Boolean) : [];
190
+ }
191
+ function g(i) {
192
+ return Array.isArray(i) ? { files: i, text: "" } : typeof i == "string" ? { files: l(i), text: "" } : i && typeof i == "object" ? {
193
+ files: l(i.files),
194
+ text: i.text ?? ""
195
+ } : { files: [], text: "" };
196
+ }
197
+ function G(i = []) {
198
+ return i.map((d, A) => ({
199
+ name: String(d).split("/").pop() || `file-${A}`,
200
+ url: d,
201
+ status: "success",
202
+ uid: Date.now() + A
203
+ }));
204
+ }
205
+ function ne(i) {
206
+ const d = new Set(i.map((V) => V.url)), A = r.value.filter(
207
+ (V) => V.status === "uploading" && !d.has(V.url)
208
+ );
209
+ return [...i, ...A];
210
+ }
211
+ function se(i) {
212
+ const d = g(i);
213
+ O = !0, p.value = d.text, r.value = ne(G(d.files)), _e(() => {
214
+ O = !1;
215
+ });
216
+ }
217
+ function x(i) {
218
+ return e.valueFormat === "array" ? i.files : e.valueFormat === "string" ? i.files.join(",") : i;
219
+ }
220
+ function w() {
221
+ var i;
222
+ (i = c.value) == null || i.focus();
223
+ }
224
+ function u(i) {
225
+ i.target.value = "";
226
+ }
227
+ function D(i) {
228
+ const V = { files: (i ?? r.value).filter((P) => P.status === "success" && P.url).map((P) => P.url), text: p.value };
229
+ n("update:modelValue", x(V)), n("change", V), e.callBack && e.callBack(V);
230
+ }
231
+ function X(i, d) {
232
+ D(d), n("remove", i, d);
233
+ }
234
+ function be(i) {
235
+ var V;
236
+ if (!(i.size / 1024 / 1024 < e.fileSize))
237
+ return ge.warning(`文件大小不能超过${e.fileSize}M`), !1;
238
+ const A = ((V = i.name.split(".").pop()) == null ? void 0 : V.toLowerCase()) || "";
239
+ return K.value.includes(A) ? !0 : (ge.warning(
240
+ `格式不支持,仅允许: ${K.value.join("/")}`
241
+ ), !1);
242
+ }
243
+ function we(i, d, A, V) {
244
+ var Le, Pe;
245
+ const P = e.api.startsWith("http") ? e.api : window.location.origin + e.api.replace(/^([^/])/, "/$1"), le = new FormData();
246
+ le.append(e.name, i), e.extraData && Object.entries(e.extraData).forEach(([J, Vt]) => le.append(J, Vt));
247
+ const W = new XMLHttpRequest();
248
+ b.push(W);
249
+ const ke = ((Le = T.value) == null ? void 0 : Le.$el.querySelector(".el-upload--picture-card")) || ((Pe = T.value) == null ? void 0 : Pe.$el), Ie = Ot.service({
250
+ target: ke,
251
+ text: "上传中",
252
+ background: "rgba(255,255,255,0.7)"
253
+ }), de = () => {
254
+ const J = b.indexOf(W);
255
+ J !== -1 && b.splice(J, 1), Ie.close();
256
+ };
257
+ W.open("POST", P);
258
+ const Ee = Zt(e.tokenKey);
259
+ Ee && W.setRequestHeader("Authorization", `Bearer ${Ee}`), W.upload.onprogress = (J) => {
260
+ J.total > 0 && (d == null || d({ percent: J.loaded / J.total * 100 }));
261
+ }, W.onload = () => {
262
+ if (de(), W.status < 200 || W.status >= 300) {
263
+ const J = `上传失败 (HTTP ${W.status})`;
264
+ ge.error(J), n("error", { msg: J, status: W.status }), V == null || V(new Error(J));
265
+ return;
266
+ }
267
+ try {
268
+ const J = JSON.parse(W.responseText);
269
+ J.code === 200 && J.urls ? (ge.success("上传成功"), A == null || A({ ...J, url: J.urls })) : (ge.error(J.msg || "上传失败"), n("error", J), V == null || V(J));
270
+ } catch {
271
+ ge.error("上传失败,响应格式错误"), n("error", new Error("Response parse error")), V == null || V(new Error("Response parse error"));
272
+ }
273
+ }, W.onerror = () => {
274
+ de(), ge.error("上传失败,网络异常"), n("error", new Error("Network error")), V == null || V(new Error("Network error"));
275
+ }, W.send(le);
276
+ }
277
+ function he(i) {
278
+ return e.disabled ? !1 : be(i);
279
+ }
280
+ function xe(i, d) {
281
+ const A = r.value.find(
282
+ (V) => {
283
+ var P;
284
+ return V.uid === (i == null ? void 0 : i.uid) || ((P = V.raw) == null ? void 0 : P.uid) === (i == null ? void 0 : i.uid);
285
+ }
286
+ );
287
+ A && (A.url = d, A.status = "success");
288
+ }
289
+ function a(i) {
290
+ we(
291
+ i.file,
292
+ i.onProgress,
293
+ (d) => {
294
+ xe(i.file, d.url), i.onSuccess(d), D(), n("success", d);
295
+ },
296
+ (d) => i.onError(d)
297
+ );
298
+ }
299
+ function y(i) {
300
+ var V;
301
+ if (!i.url) return;
302
+ const d = ((V = i.url.split(".").pop()) == null ? void 0 : V.toLowerCase()) || "";
303
+ if (["mp4", "mov", "avi", "webm"].includes(d)) {
304
+ M.value = i.url, m.value = i.name || "视频预览", f.value = !0;
305
+ return;
306
+ }
307
+ const A = r.value.filter(
308
+ (P) => {
309
+ var le;
310
+ return P.status === "success" && P.url && !["mp4", "mov", "avi", "webm"].includes(
311
+ (le = P.url.split(".").pop()) == null ? void 0 : le.toLowerCase()
312
+ );
313
+ }
314
+ );
315
+ q.value = A.map((P) => P.url), L.value = A.findIndex((P) => P.uid === i.uid) || 0, F.value = !0;
316
+ }
317
+ function Z() {
318
+ F.value = !1, q.value = [];
319
+ }
320
+ function re(i) {
321
+ for (let d = 0; d < i.length; d++) {
322
+ const A = i[d];
323
+ if (!he(A)) continue;
324
+ const V = Date.now() + d, P = URL.createObjectURL(A);
325
+ C.add(P), r.value.push({
326
+ uid: V,
327
+ name: A.name || `file-${V}`,
328
+ status: "uploading",
329
+ percentage: 0,
330
+ url: P
331
+ }), we(
332
+ A,
333
+ (le) => {
334
+ const W = r.value.find((ke) => ke.uid === V);
335
+ W && (W.percentage = le.percent);
336
+ },
337
+ (le) => {
338
+ const W = r.value.find((ke) => ke.uid === V);
339
+ W && (W.status = "success", W.url = le.url, D(), n("success", le));
340
+ },
341
+ () => kt(V)
342
+ );
343
+ }
344
+ }
345
+ function ye(i) {
346
+ var V;
347
+ if (e.disabled) return;
348
+ const d = (V = i.clipboardData) == null ? void 0 : V.items;
349
+ if (!d) return;
350
+ const A = [];
351
+ for (let P = 0; P < d.length; P++) {
352
+ const le = d[P];
353
+ if (le.kind === "file" && le.type.startsWith("image/")) {
354
+ const W = le.getAsFile();
355
+ W && A.push(W);
356
+ }
357
+ }
358
+ A.length && (i.preventDefault(), re(A));
359
+ }
360
+ function ze() {
361
+ e.disabled || e.disableDrag || (Q.value = !0);
362
+ }
363
+ function Re() {
364
+ Q.value = !1;
365
+ }
366
+ function wt(i) {
367
+ var A;
368
+ if (Q.value = !1, e.disabled || e.disableDrag || ee.value) return;
369
+ const d = Array.from(((A = i.dataTransfer) == null ? void 0 : A.files) || []).filter(
370
+ (V) => {
371
+ var P;
372
+ return K.value.includes((P = V.name.split(".").pop()) == null ? void 0 : P.toLowerCase());
373
+ }
374
+ );
375
+ d.length && re(d);
376
+ }
377
+ function kt(i) {
378
+ var A;
379
+ const d = r.value.findIndex((V) => V.uid === i);
380
+ d !== -1 && ((A = r.value[d].url) != null && A.startsWith("blob:") && (URL.revokeObjectURL(r.value[d].url), C.delete(r.value[d].url)), r.value.splice(d, 1));
381
+ }
382
+ return Xe(() => {
383
+ b.forEach((i) => i.abort()), b.length = 0, C.forEach((i) => URL.revokeObjectURL(i)), C.clear();
384
+ }), h({
385
+ /** 主动打开文件选择框,供表单或快捷操作调用 */
386
+ openFileDialog: () => {
387
+ var i, d;
388
+ e.disabled || ee.value || (d = (i = T.value) == null ? void 0 : i.$el.querySelector('input[type="file"]')) == null || d.click();
389
+ },
390
+ /** 获取已上传成功的文件 URL 列表 */
391
+ getPathList: () => r.value.filter((i) => i.status === "success").map((i) => i.url),
392
+ /** 清空文件和文字,并同步 change 事件 */
393
+ clearFiles: () => {
394
+ r.value = [], p.value = "", D();
395
+ },
396
+ /** 获取完整值,结构与 change 事件保持一致 */
397
+ getValue: () => ({
398
+ files: r.value.filter((i) => i.status === "success" && i.url).map((i) => i.url),
399
+ text: p.value
400
+ }),
401
+ /** 获取按 valueFormat 输出的值,便于外部不走 v-model 时读取 */
402
+ getModelValue: () => x({
403
+ files: r.value.filter((i) => i.status === "success" && i.url).map((i) => i.url),
404
+ text: p.value
405
+ })
406
+ }), (i, d) => {
407
+ var Ie;
408
+ const A = We, V = Bt, P = St, le = $t, W = Ct, ke = Ge;
409
+ return v(), R("div", {
410
+ class: ie(["qy-upload", t.value]),
411
+ style: Se({ "--qy-upload-size": s.value })
412
+ }, [
413
+ te(le, {
414
+ ref_key: "uploadRef",
415
+ ref: T,
416
+ "file-list": r.value,
417
+ "onUpdate:fileList": d[6] || (d[6] = (de) => r.value = de),
418
+ action: "#",
419
+ multiple: o.supportVideo ? !1 : o.multiple,
420
+ limit: o.supportVideo ? 1 : o.limit,
421
+ "list-type": o.supportVideo ? "text" : "picture-card",
422
+ accept: oe.value,
423
+ disabled: _.value,
424
+ "http-request": a,
425
+ "before-upload": he,
426
+ "on-preview": y,
427
+ "on-remove": X
428
+ }, {
429
+ default: k(() => [
430
+ ee.value ? N("", !0) : (v(), R("div", {
431
+ key: 0,
432
+ class: ie(["qy-upload__trigger", { "is-dragover": Q.value }]),
433
+ onPaste: ye,
434
+ onDragover: Y(ze, ["prevent"]),
435
+ onDragleave: Y(Re, ["prevent"]),
436
+ onDrop: Y(wt, ["prevent"])
437
+ }, [
438
+ te(A, { class: "qy-upload__icon" }, {
439
+ default: k(() => [
440
+ te(E(Rt))
441
+ ]),
442
+ _: 1
443
+ }),
444
+ o.supportVideo ? (v(), R(Ce, { key: 0 }, [
445
+ d[9] || (d[9] = z("span", { class: "qy-upload__label" }, "点击上传视频", -1)),
446
+ z("span", Wt, "支持 " + ae(K.value.join(" / ")) + ",不超过 " + ae(o.fileSize) + "MB", 1)
447
+ ], 64)) : N("", !0),
448
+ o.showText ? (v(), R("div", {
449
+ key: 1,
450
+ class: "qy-upload__text",
451
+ onClick: d[3] || (d[3] = Y(() => {
452
+ }, ["stop"])),
453
+ onPaste: Y(ye, ["stop"])
454
+ }, [
455
+ te(P, {
456
+ visible: U.value,
457
+ "onUpdate:visible": d[2] || (d[2] = (de) => U.value = de),
458
+ placement: "bottom-start",
459
+ width: 220,
460
+ trigger: "click",
461
+ "popper-class": "qy-upload__text-popover",
462
+ onAfterEnter: w
463
+ }, {
464
+ reference: k(() => [
465
+ z("div", {
466
+ class: ie(["qy-upload__text-preview", { "is-placeholder": !p.value }])
467
+ }, ae(p.value || o.pastePlaceholder), 3)
468
+ ]),
469
+ default: k(() => [
470
+ te(V, {
471
+ ref_key: "inputRef",
472
+ ref: c,
473
+ modelValue: p.value,
474
+ "onUpdate:modelValue": d[0] || (d[0] = (de) => p.value = de),
475
+ type: "textarea",
476
+ autosize: { minRows: 2, maxRows: 5 },
477
+ placeholder: o.pastePlaceholder,
478
+ disabled: o.disabled,
479
+ onBlur: d[1] || (d[1] = (de) => U.value = !1),
480
+ onPaste: Y(ye, ["stop"])
481
+ }, null, 8, ["modelValue", "placeholder", "disabled"])
482
+ ]),
483
+ _: 1
484
+ }, 8, ["visible"])
485
+ ], 32)) : o.showPasteInput ? (v(), R("div", {
486
+ key: 2,
487
+ class: "qy-upload__text",
488
+ onClick: d[5] || (d[5] = Y(() => {
489
+ }, ["stop"])),
490
+ onPaste: Y(ye, ["stop"])
491
+ }, [
492
+ z("input", {
493
+ ref_key: "pasteInputRef",
494
+ ref: S,
495
+ class: "qy-upload__paste-input",
496
+ placeholder: o.pastePlaceholder,
497
+ disabled: o.disabled,
498
+ onPaste: Y(ye, ["stop"]),
499
+ onInput: u,
500
+ onClick: d[4] || (d[4] = Y(() => {
501
+ }, ["stop"]))
502
+ }, null, 40, Gt)
503
+ ], 32)) : N("", !0)
504
+ ], 34))
505
+ ]),
506
+ _: 1
507
+ }, 8, ["file-list", "multiple", "limit", "list-type", "accept", "disabled"]),
508
+ F.value ? (v(), ce(W, {
509
+ key: 0,
510
+ "url-list": q.value,
511
+ "initial-index": L.value,
512
+ onClose: Z
513
+ }, null, 8, ["url-list", "initial-index"])) : N("", !0),
514
+ te(ke, {
515
+ modelValue: f.value,
516
+ "onUpdate:modelValue": d[7] || (d[7] = (de) => f.value = de),
517
+ title: m.value,
518
+ width: "640px",
519
+ "append-to-body": "",
520
+ "destroy-on-close": "",
521
+ onClose: d[8] || (d[8] = (de) => f.value = !1)
522
+ }, {
523
+ default: k(() => [
524
+ f.value ? (v(), R("video", {
525
+ key: 0,
526
+ src: M.value,
527
+ controls: "",
528
+ autoplay: "",
529
+ style: { width: "100%", "max-height": "400px", "border-radius": "4px" }
530
+ }, null, 8, Xt)) : N("", !0)
531
+ ]),
532
+ _: 1
533
+ }, 8, ["modelValue", "title"]),
534
+ j.value ? (v(), R("div", Jt, [
535
+ te(A, null, {
536
+ default: k(() => [
537
+ te(E(Tt))
538
+ ]),
539
+ _: 1
540
+ }),
541
+ z("span", null, [
542
+ d[12] || (d[12] = Ve(" 请上传 ", -1)),
543
+ o.fileSize ? (v(), R(Ce, { key: 0 }, [
544
+ d[10] || (d[10] = Ve("大小不超过 ", -1)),
545
+ z("b", Yt, ae(o.fileSize) + "MB", 1)
546
+ ], 64)) : N("", !0),
547
+ (Ie = K.value) != null && Ie.length ? (v(), R(Ce, { key: 1 }, [
548
+ d[11] || (d[11] = Ve(",格式为 ", -1)),
549
+ z("b", el, ae(K.value.join("/")), 1)
550
+ ], 64)) : N("", !0),
551
+ d[13] || (d[13] = Ve(" 的文件。 ", -1))
552
+ ])
553
+ ])) : N("", !0)
554
+ ], 6);
555
+ };
556
+ }
557
+ }), nt = /* @__PURE__ */ Be(tl, [["__scopeId", "data-v-8b875cce"]]), ll = /* @__PURE__ */ Object.assign({
558
+ name: "QyVoucherUpload",
559
+ inheritAttrs: !1
560
+ }, {
561
+ __name: "index",
562
+ props: {
563
+ /** 凭证图片 URL 数组。 */
564
+ modelValue: { type: Array, default: () => [] },
565
+ /** 上传接口路径。 */
566
+ api: { type: String, default: "/permission-api/common/uploads" },
567
+ /** 凭证上传沿用老业务字段名 files。 */
568
+ name: { type: String, default: "files" },
569
+ /** 是否多选。 */
570
+ multiple: { type: Boolean, default: !0 },
571
+ /** 是否禁用。 */
572
+ disabled: { type: Boolean, default: !1 },
573
+ /** 允许的文件类型后缀。 */
574
+ fileType: { type: Array, default: () => [] },
575
+ /** 单个文件大小限制(MB)。 */
576
+ fileSize: { type: Number, default: 10 },
577
+ /** 文件数量限制。 */
578
+ limit: { type: Number, default: 9 },
579
+ /** 是否显示格式/大小提示。 */
580
+ isShowTip: { type: Boolean, default: !1 },
581
+ /** token 读取 key。 */
582
+ tokenKey: { type: String, default: "Admin-Token" },
583
+ /** 是否支持视频模式。 */
584
+ supportVideo: { type: Boolean, default: !1 },
585
+ /** 凭证默认尺寸,贴近财审凭证里的紧凑图片格。 */
586
+ size: { type: String, default: "90px" },
587
+ /** 禁用拖拽。 */
588
+ disableDrag: { type: Boolean, default: !1 },
589
+ /** 成功回调。 */
590
+ callBack: { type: Function, default: null },
591
+ /** 上传时附加的额外 FormData 字段。 */
592
+ extraData: { type: Object, default: () => ({}) },
593
+ /** 凭证上传底部提示文案,默认对齐 CopyImgUpload 的旧交互。 */
594
+ pastePlaceholder: { type: String, default: "粘贴图片上传" }
595
+ },
596
+ emits: [
597
+ "update:modelValue",
598
+ "change",
599
+ "success",
600
+ "error",
601
+ "remove"
602
+ ],
603
+ setup(o, { expose: h, emit: I }) {
604
+ const e = I, n = ve(), T = B(null);
605
+ function r(m) {
606
+ return Array.isArray(m) ? m : [];
607
+ }
608
+ function c(m) {
609
+ e("update:modelValue", r(m));
610
+ }
611
+ function S(m) {
612
+ const C = r(m == null ? void 0 : m.files);
613
+ e("change", C);
614
+ }
615
+ function b(m) {
616
+ e("success", m);
617
+ }
618
+ function O(m) {
619
+ e("error", m);
620
+ }
621
+ function F(m, C) {
622
+ e("remove", m, C);
623
+ }
624
+ function q() {
625
+ var m, C;
626
+ (C = (m = T.value) == null ? void 0 : m.openFileDialog) == null || C.call(m);
627
+ }
628
+ function L() {
629
+ var m, C;
630
+ return ((C = (m = T.value) == null ? void 0 : m.getPathList) == null ? void 0 : C.call(m)) || [];
631
+ }
632
+ function f() {
633
+ var m, C;
634
+ (C = (m = T.value) == null ? void 0 : m.clearFiles) == null || C.call(m);
635
+ }
636
+ function M() {
637
+ return L();
638
+ }
639
+ return h({
640
+ openFileDialog: q,
641
+ getPathList: L,
642
+ clearFiles: f,
643
+ getValue: M
644
+ }), (m, C) => (v(), ce(nt, fe({
645
+ ref_key: "uploadRef",
646
+ ref: T
647
+ }, E(n), {
648
+ "model-value": o.modelValue,
649
+ "value-format": "array",
650
+ api: o.api,
651
+ name: o.name,
652
+ multiple: o.multiple,
653
+ disabled: o.disabled,
654
+ "file-type": o.fileType,
655
+ "file-size": o.fileSize,
656
+ limit: o.limit,
657
+ "is-show-tip": o.isShowTip,
658
+ "token-key": o.tokenKey,
659
+ "support-video": o.supportVideo,
660
+ size: o.size,
661
+ "disable-drag": o.disableDrag,
662
+ "call-back": o.callBack,
663
+ "extra-data": o.extraData,
664
+ "show-text": !1,
665
+ "show-paste-input": !0,
666
+ "paste-placeholder": o.pastePlaceholder,
667
+ "onUpdate:modelValue": c,
668
+ onChange: S,
669
+ onSuccess: b,
670
+ onError: O,
671
+ onRemove: F
672
+ }), 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"]));
673
+ }
674
+ }), al = { class: "text-lg flex items-center pt-2 pl-[var(--content-padding)]" }, nl = { key: 0 }, ol = { key: 1 }, sl = {
675
+ key: 0,
676
+ class: "icon-[material-symbols--square-outline-rounded]",
677
+ role: "img",
678
+ "aria-hidden": "true"
679
+ }, il = {
680
+ key: 1,
681
+ class: "icon-[tdesign--fullscreen-exit-1]",
682
+ role: "img",
683
+ "aria-hidden": "true"
684
+ }, ul = {
685
+ key: 0,
686
+ class: "fixed -right-12 top-2 h-9 w-9 hover:bg-gray-600/80 transition-all"
687
+ }, rl = { class: "flex justify-between h-[var(--footer-height)] px-[var(--content-padding)] items-center" }, dl = { class: "flex items-center justify-between w-full pl-1 pr-4 h-full ml-2" }, cl = { class: "flex items-center gap-2" }, fl = { class: "text-sm text-gray-700 truncate max-w-[200px]" }, pl = { class: "flex items-center gap-2" }, Ne = 5, Te = 2e3, ml = /* @__PURE__ */ me({
688
+ __name: "index",
689
+ props: /* @__PURE__ */ je({
690
+ layout: { type: [Array, String, Boolean], default: () => ["confirm", "cancel"] },
691
+ fullscreen: { type: Boolean, default: !1 },
692
+ showFullscreen: { type: Boolean, default: !1 },
693
+ confirmProps: { default: () => ({}) },
694
+ size: { default: "default" },
695
+ zIndex: { default: 2e3 }
696
+ }, {
697
+ modelValue: { default: !0 },
698
+ modelModifiers: {}
699
+ }),
700
+ emits: /* @__PURE__ */ je(["confirm", "cancel", "close", "opened", "ok"], ["update:modelValue"]),
701
+ setup(o, { expose: h, emit: I }) {
702
+ const e = o, n = Je(), T = B(!0), r = B(!1), c = B(Te), b = jt({
703
+ mobile: 0,
704
+ tablet: 640,
705
+ laptop: 1024,
706
+ desktop: 1280
707
+ }).isSmaller("tablet"), O = H(() => {
708
+ if (Array.isArray(e.layout)) return e.layout;
709
+ if (typeof e.layout == "string")
710
+ return e.layout.split(",").map((x) => x.trim());
711
+ }), F = H(() => ({
712
+ CancelButton: te(G),
713
+ ConfirmButton: te(g)
714
+ })), q = H(() => n.footer || e.layout !== !1), L = B(!1), f = B(
715
+ e.showFullscreen && b ? !0 : e.fullscreen
716
+ ), M = I, m = xt(o, "modelValue");
717
+ zt(() => {
718
+ m.value && (L.value = !1);
719
+ }), h({});
720
+ const C = ve(), Q = `qy-dialog-${Math.random().toString(36).slice(2, 11)}`, p = B(!1), U = B(null);
721
+ window.minimizedCount || (window.minimizedCount = 0);
722
+ const { x: s, y: _ } = Kt(U, {
723
+ initialValue: {
724
+ x: 5,
725
+ y: window.innerHeight - 100 - (window.minimizedCount || 0) * 60
726
+ },
727
+ onMove(x) {
728
+ var w;
729
+ (w = U.value) == null || w.classList.add("dragging"), document.body.classList.add("qy-dialog--dragging"), s.value = Math.max(
730
+ 0,
731
+ Math.min(window.innerWidth - 300, x.x)
732
+ ), _.value = Math.max(
733
+ 0,
734
+ Math.min(window.innerHeight - 50, x.y)
735
+ );
736
+ },
737
+ onEnd() {
738
+ var x;
739
+ (x = U.value) == null || x.classList.remove("dragging"), document.body.classList.remove("qy-dialog--dragging");
740
+ }
741
+ }), j = H(() => ({
742
+ transform: `translate(${s.value}px, ${_.value}px)`,
743
+ willChange: "transform"
744
+ }));
745
+ function K(x) {
746
+ const w = x.target, { scrollTop: u, scrollHeight: D, clientHeight: X } = w;
747
+ T.value = u <= Ne, r.value = D - (u + X) <= Ne;
748
+ }
749
+ function ee() {
750
+ document.querySelector(`.${Q}.el-dialog`).addEventListener("scroll", K), ne(), M("opened");
751
+ }
752
+ function oe() {
753
+ f.value = !f.value, ne();
754
+ }
755
+ function t() {
756
+ L.value || (L.value = !0, p.value = !1, m.value = !1, M("cancel"), M("close"));
757
+ }
758
+ function l(x) {
759
+ e.showFullscreen && x.detail >= 2 && oe();
760
+ }
761
+ function g() {
762
+ return Ke(
763
+ Me,
764
+ {
765
+ ...E(e.confirmProps),
766
+ type: "primary",
767
+ class: "dialog__footerBtn",
768
+ onClick: () => {
769
+ M("confirm"), M("ok");
770
+ }
771
+ },
772
+ () => E(e.confirmProps).title || "确 认"
773
+ );
774
+ }
775
+ function G() {
776
+ return Ke(
777
+ Me,
778
+ { class: "dialog__footerBtn", onClick: () => t() },
779
+ () => "取 消"
780
+ );
781
+ }
782
+ Ue(() => {
783
+ typeof window.qyDialogMaxZIndex > "u" && (window.qyDialogMaxZIndex = Te), ne();
784
+ });
785
+ function ne() {
786
+ var we;
787
+ const x = Array.from(
788
+ document.querySelectorAll(".el-overlay")
789
+ ).filter((he) => window.getComputedStyle(he).display !== "none" && !he.classList.contains("is-message")), w = (we = document.querySelector(`.${Q}`)) == null ? void 0 : we.closest(".el-overlay"), u = document.querySelector(
790
+ `.${Q}.el-dialog`
791
+ );
792
+ if (!w || !u) return;
793
+ const D = Te;
794
+ window.qyDialogMaxZIndex = window.qyDialogMaxZIndex || D;
795
+ const be = Math.max(
796
+ window.qyDialogMaxZIndex,
797
+ ...x.map(
798
+ (he) => parseInt(window.getComputedStyle(he).zIndex || D.toString())
799
+ )
800
+ ) + 2;
801
+ window.qyDialogMaxZIndex = be, _e(() => {
802
+ w.style.zIndex = be.toString(), u.style.zIndex = (be + 1).toString(), c.value = be + 1;
803
+ });
804
+ }
805
+ Ye(() => {
806
+ const x = document.querySelector(
807
+ `.${Q} .qy-dialog__wrapper-container`
808
+ );
809
+ x && x.removeEventListener("scroll", K), p.value && window.minimizedCount--;
810
+ });
811
+ function se() {
812
+ var w;
813
+ p.value = !p.value;
814
+ const x = (w = document.querySelector(`.${Q}`)) == null ? void 0 : w.closest(".el-overlay");
815
+ p.value ? (x.style.display = "none", window.minimizedCount++, _.value = window.innerHeight - 50 - (window.minimizedCount || 0) * 60) : (x.style.display = "block", window.minimizedCount--, ne());
816
+ }
817
+ return (x, w) => {
818
+ const u = It("Close"), D = We, X = Ge;
819
+ return v(), R("div", null, [
820
+ te(X, fe({
821
+ ref: "dialogRef",
822
+ class: ["qy-dialog", [
823
+ e.size === "small" && "[&_.el-dialog__header]:!hidden",
824
+ Q
825
+ ]],
826
+ "model-value": m.value,
827
+ "align-center": "",
828
+ "append-to-body": "",
829
+ style: {
830
+ "--el-dialog-padding-primary": 0
831
+ },
832
+ "show-close": !1,
833
+ fullscreen: f.value,
834
+ "z-index": c.value,
835
+ onClosed: t,
836
+ onOpened: ee,
837
+ draggable: ""
838
+ }, E(C)), $e({
839
+ header: k(() => [
840
+ e.size === "default" ? (v(), R("div", {
841
+ key: 0,
842
+ style: Se({
843
+ borderBottom: "1px solid",
844
+ borderColor: T.value ? "transparent" : "var(--block-outline-color)",
845
+ transition: "border-color .2s linear"
846
+ }),
847
+ class: "flex justify-between h-[var(--header-height)]",
848
+ onDblclick: l
849
+ }, [
850
+ z("div", al, [
851
+ E(n).header ? E(n).header ? (v(), R("div", ol, [
852
+ $(x.$slots, "header")
853
+ ])) : N("", !0) : (v(), R("span", nl, ae(E(C).title), 1))
854
+ ]),
855
+ z("div", {
856
+ class: "flex",
857
+ onMousedown: w[3] || (w[3] = Y(() => {
858
+ }, ["stop"]))
859
+ }, [
860
+ e.size === "default" ? (v(), R("div", {
861
+ key: 0,
862
+ class: "qy-dialog__btn qy-dialog__btn--default",
863
+ onClick: Y(se, ["stop"]),
864
+ onMousedown: w[0] || (w[0] = Y(() => {
865
+ }, ["stop"]))
866
+ }, w[4] || (w[4] = [
867
+ z("span", {
868
+ class: "icon-[material-symbols--minimize] text-xl mb-3",
869
+ role: "img",
870
+ "aria-hidden": "true"
871
+ }, null, -1)
872
+ ]), 32)) : N("", !0),
873
+ e.showFullscreen ? (v(), R("div", {
874
+ key: 1,
875
+ class: "qy-dialog__btn qy-dialog__btn--default",
876
+ onClick: Y(oe, ["stop"]),
877
+ onMousedown: w[1] || (w[1] = Y(() => {
878
+ }, ["stop"]))
879
+ }, [
880
+ f.value ? (v(), R("span", il)) : (v(), R("span", sl))
881
+ ], 32)) : N("", !0),
882
+ z("div", {
883
+ class: "qy-dialog__btn qy-dialog__btn--danger",
884
+ onClick: Y(t, ["stop"]),
885
+ onMousedown: w[2] || (w[2] = Y(() => {
886
+ }, ["stop"]))
887
+ }, w[5] || (w[5] = [
888
+ z("span", {
889
+ class: "icon-[ri--close-line] text-xl",
890
+ role: "img",
891
+ "aria-hidden": "true"
892
+ }, null, -1)
893
+ ]), 32)
894
+ ], 32)
895
+ ], 36)) : N("", !0)
896
+ ]),
897
+ default: k(() => [
898
+ z("div", {
899
+ class: ie(["qy-dialog__wrapper", E(Pt)(f.value && "qy-dialog__wrapper--fullscreen")]),
900
+ style: Se({
901
+ maxHeight: q.value ? "calc(100vh - var(--header-height) - var(--footer-height) - var(--sides-gap))" : "calc(100vh - var(--header-height) - var(--sides-gap))",
902
+ padding: e.size === "small" ? "var(--small-content-padding)" : "var(--content-padding)"
903
+ })
904
+ }, [
905
+ e.size === "small" ? (v(), R("div", ul, [
906
+ te(D, {
907
+ size: 36,
908
+ class: "cursor-pointer text-gray-100 active:scale-75 rounded-sm transition-all",
909
+ onClick: t
910
+ }, {
911
+ default: k(() => [
912
+ te(u)
913
+ ]),
914
+ _: 1
915
+ })
916
+ ])) : N("", !0),
917
+ $(x.$slots, "default")
918
+ ], 6)
919
+ ]),
920
+ _: 2
921
+ }, [
922
+ !x.$slots.footer && Array.isArray(O.value) ? {
923
+ name: "footer",
924
+ fn: k(() => [
925
+ z("div", rl, [
926
+ z("div", null, [
927
+ $(x.$slots, "footer-left")
928
+ ]),
929
+ z("div", {
930
+ class: ie([{
931
+ "qy-dialog__footer--outline": r.value
932
+ }, "qy-dialog__footer flex items-center justify-end"])
933
+ }, [
934
+ O.value.includes("cancel") ? (v(), ce(G, { key: 0 })) : N("", !0),
935
+ O.value.includes("confirm") ? (v(), ce(g, { key: 1 })) : N("", !0),
936
+ $(x.$slots, "footer-append")
937
+ ], 2)
938
+ ])
939
+ ]),
940
+ key: "0"
941
+ } : q.value ? {
942
+ name: "footer",
943
+ fn: k(() => [
944
+ z("div", {
945
+ class: ie([{
946
+ "qy-dialog__footer--outline": r.value
947
+ }, "qy-dialog__footer px-[var(--content-padding)] min-h-[var(--footer-height)] flex items-center justify-end"])
948
+ }, [
949
+ $(x.$slots, "footer", {
950
+ layouts: F.value,
951
+ layoutsNode: Object.values(F.value)
952
+ })
953
+ ], 2)
954
+ ]),
955
+ key: "1"
956
+ } : void 0
957
+ ]), 1040, ["class", "model-value", "fullscreen", "z-index"]),
958
+ et(z("div", {
959
+ ref_key: "minimizedRef",
960
+ ref: U,
961
+ class: "fixed left-0 top-0 bg-white rounded shadow-lg cursor-pointer z-[9999] hover:bg-gray-50",
962
+ style: Se([j.value, { width: "300px", height: "50px", "will-change": "transform" }])
963
+ }, [
964
+ z("div", dl, [
965
+ z("div", cl, [
966
+ w[6] || (w[6] = z("div", { class: "icon-[mdi--window-restore] text-gray-600" }, null, -1)),
967
+ z("span", fl, ae(E(C).title), 1)
968
+ ]),
969
+ z("div", pl, [
970
+ z("div", {
971
+ class: "p-1 hover:bg-gray-200 rounded",
972
+ onClick: Y(se, ["stop"])
973
+ }, w[7] || (w[7] = [
974
+ z("div", { class: "icon-[mdi--window-maximize] text-gray-600" }, null, -1)
975
+ ])),
976
+ z("div", {
977
+ class: "p-1 hover:bg-red-100 rounded",
978
+ onClick: Y(t, ["stop"])
979
+ }, w[8] || (w[8] = [
980
+ z("div", { class: "icon-[mdi--close] text-red-600" }, null, -1)
981
+ ]))
982
+ ])
983
+ ])
984
+ ], 4), [
985
+ [tt, p.value]
986
+ ])
987
+ ]);
988
+ };
989
+ }
990
+ });
991
+ function He(o) {
992
+ const h = o == null ? void 0 : o.match(/(\[url\:(.*?)\])(.*)/);
993
+ return h ? {
994
+ imageUrl: h[2],
995
+ text: h[3]
996
+ } : {
997
+ imageUrl: "",
998
+ text: o || ""
999
+ };
1000
+ }
1001
+ function yl(o) {
1002
+ const h = String(o || "").match(/(\[url\:.*?\])([\s\S]*)/);
1003
+ return h ? h[2] : o;
1004
+ }
1005
+ function Ze(o, h) {
1006
+ return h ? `[url:${h}]${o}` : o;
1007
+ }
1008
+ const gl = { class: "qy-remark-image__field" }, vl = { class: "qy-remark-image__upload-anchor" }, hl = {
1009
+ key: 0,
1010
+ class: "icon-[line-md--loading-twotone-loop]",
1011
+ role: "img",
1012
+ "aria-hidden": "true"
1013
+ }, bl = {
1014
+ key: 1,
1015
+ class: "icon-[ion--cloud-upload-outline]",
1016
+ role: "img",
1017
+ "aria-hidden": "true"
1018
+ }, wl = {
1019
+ key: 2,
1020
+ class: "icon-[ph--images-thin]",
1021
+ role: "img",
1022
+ "aria-hidden": "true"
1023
+ }, kl = { class: "qy-remark-image__popover" }, Vl = ["src"], $l = { class: "qy-remark-image__popover-footer" }, Sl = /* @__PURE__ */ me({
1024
+ __name: "index",
1025
+ props: {
1026
+ defaultValue: { default: "" },
1027
+ defaultImage: { default: "" },
1028
+ rows: { default: 6 },
1029
+ width: { default: "" },
1030
+ autosize: { type: [Boolean, Object], default: !1 },
1031
+ disabled: { type: Boolean, default: !1 },
1032
+ placeholder: { default: "粘贴图片上传" },
1033
+ type: { default: "textarea" },
1034
+ api: { default: "/permission-api/common/uploads" },
1035
+ tokenKey: { default: "Admin-Token" }
1036
+ },
1037
+ emits: ["change"],
1038
+ setup(o, { expose: h, emit: I }) {
1039
+ const e = o, n = I, T = ve(), r = B(null), c = B(""), S = B(""), b = B(!1), O = H(
1040
+ () => e.type === "text" ? "text" : "textarea"
1041
+ ), F = H(() => {
1042
+ if (e.width)
1043
+ return {
1044
+ width: typeof e.width == "number" ? `${e.width}px` : e.width
1045
+ };
1046
+ });
1047
+ pe(
1048
+ () => e.defaultValue,
1049
+ (p) => {
1050
+ const U = He(p || "");
1051
+ c.value = U.text, S.value = U.imageUrl || e.defaultImage || "";
1052
+ },
1053
+ { immediate: !0 }
1054
+ ), pe(
1055
+ () => e.defaultImage,
1056
+ (p) => {
1057
+ p !== void 0 && !He(e.defaultValue || "").imageUrl && (S.value = p || "");
1058
+ },
1059
+ { immediate: !0 }
1060
+ ), Ue(() => {
1061
+ _e(L);
1062
+ }), Ye(() => {
1063
+ const p = q();
1064
+ p && p.removeEventListener("paste", m);
1065
+ });
1066
+ function q() {
1067
+ var p, U;
1068
+ return ((p = r.value) == null ? void 0 : p.textarea) || ((U = r.value) == null ? void 0 : U.input) || null;
1069
+ }
1070
+ function L() {
1071
+ const p = q();
1072
+ p && (p.removeEventListener("paste", m), p.addEventListener("paste", m));
1073
+ }
1074
+ function f(p) {
1075
+ c.value = yl(p || "");
1076
+ }
1077
+ function M() {
1078
+ S.value = "", Q();
1079
+ }
1080
+ async function m(p) {
1081
+ var _;
1082
+ const s = Array.from(((_ = p.clipboardData) == null ? void 0 : _.files) || []).find((j) => j.type.startsWith("image/"));
1083
+ s && (p.preventDefault(), await C({
1084
+ file: s,
1085
+ onError: () => {
1086
+ },
1087
+ onProgress: () => {
1088
+ },
1089
+ onSuccess: () => {
1090
+ }
1091
+ }));
1092
+ }
1093
+ async function C(p) {
1094
+ var U, s, _, j;
1095
+ if (p.file.size > 51200 * 1e3)
1096
+ return ge.error("图片过大"), !1;
1097
+ b.value = !0;
1098
+ try {
1099
+ const K = new FormData();
1100
+ K.append("files", p.file);
1101
+ const ee = at.get(e.tokenKey), t = await (await fetch(e.api, {
1102
+ method: "POST",
1103
+ body: K,
1104
+ credentials: "include",
1105
+ headers: ee ? { Authorization: `Bearer ${ee}` } : void 0
1106
+ })).json(), l = (t == null ? void 0 : t.urls) ?? ((U = t == null ? void 0 : t.data) == null ? void 0 : U.urls) ?? ((s = t == null ? void 0 : t.data) == null ? void 0 : s.url) ?? (t == null ? void 0 : t.url) ?? "";
1107
+ return S.value = Array.isArray(l) ? l[0] : l, Q(), ge.success("上传图片成功"), (_ = p.onSuccess) == null || _.call(p, t), !0;
1108
+ } catch (K) {
1109
+ return (j = p.onError) == null || j.call(p, K), ge.error("上传失败"), !1;
1110
+ } finally {
1111
+ b.value = !1;
1112
+ }
1113
+ }
1114
+ function Q() {
1115
+ n(
1116
+ "change",
1117
+ Ze(c.value || "", S.value || ""),
1118
+ S.value || ""
1119
+ );
1120
+ }
1121
+ return h({
1122
+ deleteImage: M,
1123
+ // 给表单保存或外部调试读取当前拆分值。
1124
+ getValue: () => ({
1125
+ text: c.value || "",
1126
+ imageUrl: S.value || "",
1127
+ value: Ze(c.value || "", S.value || "")
1128
+ })
1129
+ }), (p, U) => (v(), R("div", {
1130
+ class: "qy-remark-image",
1131
+ style: Se(F.value)
1132
+ }, [
1133
+ z("div", gl, [
1134
+ te(E(De), fe({
1135
+ ref_key: "inputRef",
1136
+ ref: r,
1137
+ "model-value": c.value,
1138
+ type: O.value,
1139
+ rows: p.rows,
1140
+ autosize: p.autosize,
1141
+ disabled: p.disabled,
1142
+ placeholder: p.placeholder
1143
+ }, E(T), {
1144
+ "onUpdate:modelValue": f,
1145
+ onBlur: Q
1146
+ }), null, 16, ["model-value", "type", "rows", "autosize", "disabled", "placeholder"]),
1147
+ te(E(Ut), {
1148
+ placement: "top-start",
1149
+ width: 400,
1150
+ trigger: "hover",
1151
+ disabled: !S.value
1152
+ }, {
1153
+ reference: k(() => [
1154
+ z("div", vl, [
1155
+ te(E(_t), {
1156
+ disabled: b.value || p.disabled,
1157
+ class: "qy-remark-image__upload",
1158
+ "show-file-list": !1,
1159
+ "http-request": C
1160
+ }, {
1161
+ default: k(() => [
1162
+ b.value ? (v(), R("span", hl)) : S.value ? (v(), R("span", wl)) : (v(), R("span", bl))
1163
+ ]),
1164
+ _: 1
1165
+ }, 8, ["disabled"])
1166
+ ])
1167
+ ]),
1168
+ default: k(() => [
1169
+ z("div", kl, [
1170
+ z("img", {
1171
+ src: S.value,
1172
+ class: "qy-remark-image__preview-img"
1173
+ }, null, 8, Vl),
1174
+ z("div", $l, [
1175
+ U[1] || (U[1] = z("span", { class: "qy-remark-image__popover-tip" }, "再次点击按钮可更换图片", -1)),
1176
+ te(E(Me), {
1177
+ link: "",
1178
+ size: "small",
1179
+ type: "danger",
1180
+ disabled: p.disabled,
1181
+ onClick: M
1182
+ }, {
1183
+ default: k(() => U[0] || (U[0] = [
1184
+ Ve(" 删除图片 ", -1)
1185
+ ])),
1186
+ _: 1,
1187
+ __: [0]
1188
+ }, 8, ["disabled"])
1189
+ ])
1190
+ ])
1191
+ ]),
1192
+ _: 1
1193
+ }, 8, ["disabled"])
1194
+ ])
1195
+ ], 4));
1196
+ }
1197
+ }), Bl = /* @__PURE__ */ Be(Sl, [["__scopeId", "data-v-f8d38d88"]]), Cl = /* @__PURE__ */ me({
1198
+ name: "QyInput",
1199
+ inheritAttrs: !1,
1200
+ __name: "index",
1201
+ props: {
1202
+ modelValue: { default: "" },
1203
+ removeSpace: { type: Boolean, default: !1 },
1204
+ trimMode: { default: "none" }
1205
+ },
1206
+ emits: ["update:modelValue", "input", "change", "focus", "blur", "clear", "enter"],
1207
+ setup(o, { expose: h, emit: I }) {
1208
+ const e = o, n = I, T = ve(), r = B(null), c = B(b(e.modelValue)), S = H(() => b(e.modelValue));
1209
+ pe(
1210
+ () => e.modelValue,
1211
+ (l) => {
1212
+ c.value = b(l);
1213
+ }
1214
+ );
1215
+ function b(l) {
1216
+ return l == null ? "" : String(l);
1217
+ }
1218
+ function O(l) {
1219
+ return e.removeSpace ? l.replace(/\s+/g, "") : l;
1220
+ }
1221
+ function F(l, g) {
1222
+ return e.trimMode !== g ? l : l.trim();
1223
+ }
1224
+ function q(l) {
1225
+ return O(b(l));
1226
+ }
1227
+ function L(l) {
1228
+ c.value = l, n("update:modelValue", l);
1229
+ }
1230
+ function f(l) {
1231
+ const g = q(l);
1232
+ L(g);
1233
+ }
1234
+ function M(l) {
1235
+ c.value = b(l), n("input", b(l));
1236
+ }
1237
+ function m(l) {
1238
+ const g = F(q(l), "change");
1239
+ g !== b(e.modelValue) && L(g), n("change", g);
1240
+ }
1241
+ function C(l) {
1242
+ n("focus", l);
1243
+ }
1244
+ function Q(l) {
1245
+ const g = F(c.value, "blur");
1246
+ g !== b(e.modelValue) && L(g), n("blur", l);
1247
+ }
1248
+ function p() {
1249
+ c.value = "", n("update:modelValue", ""), n("clear");
1250
+ }
1251
+ function U(l) {
1252
+ n("enter", l);
1253
+ }
1254
+ function s() {
1255
+ var l, g;
1256
+ (g = (l = r.value) == null ? void 0 : l.focus) == null || g.call(l);
1257
+ }
1258
+ function _() {
1259
+ var l, g;
1260
+ (g = (l = r.value) == null ? void 0 : l.blur) == null || g.call(l);
1261
+ }
1262
+ function j() {
1263
+ var l, g;
1264
+ (g = (l = r.value) == null ? void 0 : l.select) == null || g.call(l);
1265
+ }
1266
+ function K() {
1267
+ var l, g;
1268
+ (g = (l = r.value) == null ? void 0 : l.clear) == null || g.call(l);
1269
+ }
1270
+ function ee() {
1271
+ var l, g;
1272
+ (g = (l = r.value) == null ? void 0 : l.resizeTextarea) == null || g.call(l);
1273
+ }
1274
+ function oe() {
1275
+ var l;
1276
+ return ((l = r.value) == null ? void 0 : l.input) || null;
1277
+ }
1278
+ function t() {
1279
+ var l;
1280
+ return ((l = r.value) == null ? void 0 : l.textarea) || null;
1281
+ }
1282
+ return h({
1283
+ // 暴露 Element Plus 常用输入框方法,方便业务弹窗做聚焦、选中和 textarea 重算高度。
1284
+ focus: s,
1285
+ blur: _,
1286
+ select: j,
1287
+ clear: K,
1288
+ resizeTextarea: ee,
1289
+ getNativeInput: oe,
1290
+ getTextarea: t
1291
+ }), (l, g) => (v(), ce(E(De), fe({
1292
+ ref_key: "inputRef",
1293
+ ref: r
1294
+ }, E(T), {
1295
+ "model-value": S.value,
1296
+ "onUpdate:modelValue": f,
1297
+ onInput: M,
1298
+ onChange: m,
1299
+ onFocus: C,
1300
+ onBlur: Q,
1301
+ onClear: p,
1302
+ onKeydown: Ae(U, ["enter"])
1303
+ }), $e({ _: 2 }, [
1304
+ l.$slots.prefix ? {
1305
+ name: "prefix",
1306
+ fn: k(() => [
1307
+ $(l.$slots, "prefix")
1308
+ ]),
1309
+ key: "0"
1310
+ } : void 0,
1311
+ l.$slots.suffix ? {
1312
+ name: "suffix",
1313
+ fn: k(() => [
1314
+ $(l.$slots, "suffix")
1315
+ ]),
1316
+ key: "1"
1317
+ } : void 0,
1318
+ l.$slots.prepend ? {
1319
+ name: "prepend",
1320
+ fn: k(() => [
1321
+ $(l.$slots, "prepend")
1322
+ ]),
1323
+ key: "2"
1324
+ } : void 0,
1325
+ l.$slots.append ? {
1326
+ name: "append",
1327
+ fn: k(() => [
1328
+ $(l.$slots, "append")
1329
+ ]),
1330
+ key: "3"
1331
+ } : void 0
1332
+ ]), 1040, ["model-value"]));
1333
+ }
1334
+ }), xl = /* @__PURE__ */ me({
1335
+ name: "QyMoneyInput",
1336
+ inheritAttrs: !1,
1337
+ __name: "index",
1338
+ props: {
1339
+ modelValue: { default: "" },
1340
+ precision: { default: 2 },
1341
+ min: { default: void 0 },
1342
+ max: { default: void 0 },
1343
+ allowNegative: { type: Boolean, default: !1 },
1344
+ formatTrigger: { default: "blur" },
1345
+ emptyValue: { default: "" }
1346
+ },
1347
+ emits: ["update:modelValue", "input", "change", "focus", "blur", "clear", "enter"],
1348
+ setup(o, { expose: h, emit: I }) {
1349
+ const e = o, n = I, T = ve(), r = B(null), c = B(b(e.modelValue)), S = H(() => b(e.modelValue));
1350
+ pe(
1351
+ () => e.modelValue,
1352
+ (t) => {
1353
+ c.value = b(t);
1354
+ }
1355
+ );
1356
+ function b(t) {
1357
+ return t == null ? "" : String(t);
1358
+ }
1359
+ function O(t) {
1360
+ return Number.isFinite(t) ? Math.max(0, Math.floor(t)) : 2;
1361
+ }
1362
+ function F(t) {
1363
+ const l = b(t);
1364
+ let g = "", G = !1, ne = !1;
1365
+ const se = O(e.precision);
1366
+ for (let x = 0; x < l.length; x += 1) {
1367
+ const w = l[x];
1368
+ if (w >= "0" && w <= "9") {
1369
+ g += w;
1370
+ continue;
1371
+ }
1372
+ if (w === "." && se > 0 && !G) {
1373
+ g += w, G = !0;
1374
+ continue;
1375
+ }
1376
+ w === "-" && e.allowNegative && x === 0 && !ne && (g += w, ne = !0);
1377
+ }
1378
+ if (se > 0 && G) {
1379
+ const [x, w = ""] = g.split(".");
1380
+ return `${x}.${w.slice(0, se)}`;
1381
+ }
1382
+ return g;
1383
+ }
1384
+ function q(t) {
1385
+ let l = t;
1386
+ return typeof e.min == "number" && Number.isFinite(e.min) && (l = Math.max(l, e.min)), typeof e.max == "number" && Number.isFinite(e.max) && (l = Math.min(l, e.max)), l;
1387
+ }
1388
+ function L(t) {
1389
+ const l = F(t);
1390
+ if (!l || l === "-" || l === ".")
1391
+ return b(e.emptyValue);
1392
+ const g = Number(l);
1393
+ if (Number.isNaN(g)) return b(e.emptyValue);
1394
+ const G = O(e.precision);
1395
+ return q(g).toFixed(G);
1396
+ }
1397
+ function f(t) {
1398
+ c.value = t, n("update:modelValue", t);
1399
+ }
1400
+ function M(t) {
1401
+ const l = F(t);
1402
+ f(l);
1403
+ }
1404
+ function m(t) {
1405
+ const l = F(t);
1406
+ c.value = l, n("input", l);
1407
+ }
1408
+ function C(t) {
1409
+ const l = e.formatTrigger === "change" ? L(t) : F(t);
1410
+ l !== b(e.modelValue) && f(l), n("change", l);
1411
+ }
1412
+ function Q(t) {
1413
+ n("focus", t);
1414
+ }
1415
+ function p(t) {
1416
+ if (e.formatTrigger === "blur") {
1417
+ const l = L(c.value);
1418
+ l !== b(e.modelValue) && f(l);
1419
+ }
1420
+ n("blur", t);
1421
+ }
1422
+ function U() {
1423
+ const t = b(e.emptyValue);
1424
+ c.value = t, n("update:modelValue", t), n("clear");
1425
+ }
1426
+ function s(t) {
1427
+ n("enter", t);
1428
+ }
1429
+ function _() {
1430
+ var t, l;
1431
+ (l = (t = r.value) == null ? void 0 : t.focus) == null || l.call(t);
1432
+ }
1433
+ function j() {
1434
+ var t, l;
1435
+ (l = (t = r.value) == null ? void 0 : t.blur) == null || l.call(t);
1436
+ }
1437
+ function K() {
1438
+ var t, l;
1439
+ (l = (t = r.value) == null ? void 0 : t.select) == null || l.call(t);
1440
+ }
1441
+ function ee() {
1442
+ var t, l;
1443
+ (l = (t = r.value) == null ? void 0 : t.clear) == null || l.call(t);
1444
+ }
1445
+ function oe() {
1446
+ var t;
1447
+ return ((t = r.value) == null ? void 0 : t.input) || null;
1448
+ }
1449
+ return h({
1450
+ focus: _,
1451
+ blur: j,
1452
+ select: K,
1453
+ clear: ee,
1454
+ getNativeInput: oe
1455
+ }), (t, l) => (v(), ce(E(De), fe({
1456
+ ref_key: "inputRef",
1457
+ ref: r
1458
+ }, E(T), {
1459
+ "model-value": S.value,
1460
+ inputmode: "decimal",
1461
+ "onUpdate:modelValue": M,
1462
+ onInput: m,
1463
+ onChange: C,
1464
+ onFocus: Q,
1465
+ onBlur: p,
1466
+ onClear: U,
1467
+ onKeydown: Ae(s, ["enter"])
1468
+ }), $e({ _: 2 }, [
1469
+ t.$slots.prefix ? {
1470
+ name: "prefix",
1471
+ fn: k(() => [
1472
+ $(t.$slots, "prefix")
1473
+ ]),
1474
+ key: "0"
1475
+ } : void 0,
1476
+ t.$slots.suffix ? {
1477
+ name: "suffix",
1478
+ fn: k(() => [
1479
+ $(t.$slots, "suffix")
1480
+ ]),
1481
+ key: "1"
1482
+ } : void 0,
1483
+ t.$slots.prepend ? {
1484
+ name: "prepend",
1485
+ fn: k(() => [
1486
+ $(t.$slots, "prepend")
1487
+ ]),
1488
+ key: "2"
1489
+ } : void 0,
1490
+ t.$slots.append ? {
1491
+ name: "append",
1492
+ fn: k(() => [
1493
+ $(t.$slots, "append")
1494
+ ]),
1495
+ key: "3"
1496
+ } : void 0
1497
+ ]), 1040, ["model-value"]));
1498
+ }
1499
+ }), zl = /* @__PURE__ */ me({
1500
+ name: "QyRadioGroup",
1501
+ inheritAttrs: !1,
1502
+ __name: "index",
1503
+ props: {
1504
+ modelValue: { type: [String, Number, Boolean, null], default: void 0 },
1505
+ options: { default: () => [] },
1506
+ labelKey: { default: "label" },
1507
+ valueKey: { default: "value" },
1508
+ disabledKey: { default: "disabled" },
1509
+ disabled: { type: Boolean, default: !1 },
1510
+ size: { default: "default" },
1511
+ name: { default: void 0 },
1512
+ type: { default: "radio" },
1513
+ border: { type: Boolean, default: !1 }
1514
+ },
1515
+ emits: ["update:modelValue", "change"],
1516
+ setup(o, { expose: h, emit: I }) {
1517
+ const e = o, n = I, T = ve(), r = B(null), c = H(
1518
+ () => e.type === "button" ? At : Ft
1519
+ ), S = H(
1520
+ () => (e.options || []).map((f) => ({
1521
+ raw: f,
1522
+ label: (f == null ? void 0 : f[e.labelKey]) ?? (f == null ? void 0 : f.label) ?? (f == null ? void 0 : f.value) ?? "",
1523
+ value: (f == null ? void 0 : f[e.valueKey]) ?? (f == null ? void 0 : f.value) ?? (f == null ? void 0 : f.label),
1524
+ disabled: !!(f != null && f[e.disabledKey])
1525
+ }))
1526
+ );
1527
+ function b(f) {
1528
+ const M = {
1529
+ value: f.value,
1530
+ label: f.value,
1531
+ disabled: f.disabled
1532
+ };
1533
+ return e.type === "button" ? M : {
1534
+ ...M,
1535
+ border: e.border
1536
+ };
1537
+ }
1538
+ function O(f, M) {
1539
+ return `${String(f.value ?? f.label ?? "")}-${M}`;
1540
+ }
1541
+ function F(f) {
1542
+ n("update:modelValue", f);
1543
+ }
1544
+ function q(f) {
1545
+ n("change", f);
1546
+ }
1547
+ function L() {
1548
+ return r.value;
1549
+ }
1550
+ return h({
1551
+ getRadioGroupInstance: L
1552
+ }), (f, M) => (v(), ce(E(Qt), fe({
1553
+ ref_key: "radioGroupRef",
1554
+ ref: r
1555
+ }, E(T), {
1556
+ "model-value": f.modelValue,
1557
+ disabled: f.disabled,
1558
+ size: f.size,
1559
+ name: f.name,
1560
+ "onUpdate:modelValue": F,
1561
+ onChange: q
1562
+ }), {
1563
+ default: k(() => [
1564
+ f.$slots.default ? $(f.$slots, "default", { key: 0 }) : (v(!0), R(Ce, { key: 1 }, lt(S.value, (m, C) => (v(), ce(qt(c.value), fe({
1565
+ key: O(m, C)
1566
+ }, { ref_for: !0 }, b(m)), {
1567
+ default: k(() => [
1568
+ $(f.$slots, "option", {
1569
+ option: m.raw,
1570
+ label: m.label,
1571
+ value: m.value,
1572
+ disabled: m.disabled
1573
+ }, () => [
1574
+ Ve(ae(m.label), 1)
1575
+ ])
1576
+ ]),
1577
+ _: 2
1578
+ }, 1040))), 128))
1579
+ ]),
1580
+ _: 3
1581
+ }, 16, ["model-value", "disabled", "size", "name"]));
1582
+ }
1583
+ }), ot = /* @__PURE__ */ me({
1584
+ name: "QySelect",
1585
+ inheritAttrs: !1,
1586
+ __name: "index",
1587
+ props: {
1588
+ modelValue: { type: [String, Number, Boolean, Array, null], default: void 0 },
1589
+ options: { default: () => [] },
1590
+ labelKey: { default: "label" },
1591
+ valueKey: { default: "value" },
1592
+ disabledKey: { default: "disabled" },
1593
+ placeholder: { default: "请选择" },
1594
+ disabled: { type: Boolean, default: !1 },
1595
+ clearable: { type: Boolean, default: !0 },
1596
+ filterable: { type: Boolean, default: !1 },
1597
+ multiple: { type: Boolean, default: !1 },
1598
+ collapseTags: { type: Boolean, default: !1 },
1599
+ collapseTagsTooltip: { type: Boolean, default: !1 },
1600
+ autoSelectSingle: { type: Boolean, default: !1 },
1601
+ size: { default: "default" },
1602
+ teleported: { type: Boolean, default: !0 },
1603
+ appendTo: { default: "body" },
1604
+ fitInputWidth: { type: Boolean, default: !0 },
1605
+ popperClass: { default: "" }
1606
+ },
1607
+ emits: ["update:modelValue", "change", "clear", "visible-change", "focus", "blur"],
1608
+ setup(o, { expose: h, emit: I }) {
1609
+ const e = o, n = I, T = ve(), r = Je(), c = B(null), S = H(
1610
+ () => ["qy-select__popper", e.popperClass].filter(Boolean).join(" ")
1611
+ ), b = H(
1612
+ () => (e.options || []).map((s) => ({
1613
+ raw: s,
1614
+ label: (s == null ? void 0 : s[e.labelKey]) ?? (s == null ? void 0 : s.label) ?? (s == null ? void 0 : s.value) ?? "",
1615
+ value: (s == null ? void 0 : s[e.valueKey]) ?? (s == null ? void 0 : s.value) ?? (s == null ? void 0 : s.label),
1616
+ disabled: !!(s != null && s[e.disabledKey])
1617
+ }))
1618
+ ), O = H(() => {
1619
+ const s = r.default;
1620
+ return s ? s().some((_) => _.type !== Mt) : !1;
1621
+ });
1622
+ function F(s) {
1623
+ return Array.isArray(s) ? s.length === 0 : s === "" || s === null || s === void 0;
1624
+ }
1625
+ pe(
1626
+ [
1627
+ b,
1628
+ () => e.modelValue,
1629
+ () => e.autoSelectSingle,
1630
+ () => e.disabled,
1631
+ () => e.multiple
1632
+ ],
1633
+ ([s]) => {
1634
+ if (!e.autoSelectSingle || e.disabled || !F(e.modelValue) || s.length !== 1) return;
1635
+ const [_] = s;
1636
+ if (_.disabled) return;
1637
+ const j = e.multiple ? [_.value] : _.value;
1638
+ n("update:modelValue", j), n("change", j);
1639
+ },
1640
+ { immediate: !0 }
1641
+ );
1642
+ function q(s, _) {
1643
+ return `${String(s.value ?? s.label ?? "")}-${_}`;
1644
+ }
1645
+ function L(s) {
1646
+ n("update:modelValue", s);
1647
+ }
1648
+ function f(s) {
1649
+ n("change", s);
1650
+ }
1651
+ function M() {
1652
+ n("clear");
1653
+ }
1654
+ function m(s) {
1655
+ n("visible-change", s);
1656
+ }
1657
+ function C(s) {
1658
+ n("focus", s);
1659
+ }
1660
+ function Q(s) {
1661
+ n("blur", s);
1662
+ }
1663
+ function p() {
1664
+ var s, _;
1665
+ (_ = (s = c.value) == null ? void 0 : s.focus) == null || _.call(s);
1666
+ }
1667
+ function U() {
1668
+ var s, _;
1669
+ (_ = (s = c.value) == null ? void 0 : s.blur) == null || _.call(s);
1670
+ }
1671
+ return h({
1672
+ // 仅暴露业务常用焦点方法,复杂下拉行为仍交给 Element Plus 自身处理。
1673
+ focus: p,
1674
+ blur: U
1675
+ }), (s, _) => (v(), ce(E(Dt), fe({
1676
+ ref_key: "selectRef",
1677
+ ref: c
1678
+ }, E(T), {
1679
+ "model-value": s.modelValue,
1680
+ placeholder: s.placeholder,
1681
+ disabled: s.disabled,
1682
+ clearable: s.clearable,
1683
+ filterable: s.filterable,
1684
+ multiple: s.multiple,
1685
+ "collapse-tags": s.collapseTags,
1686
+ "collapse-tags-tooltip": s.collapseTagsTooltip,
1687
+ size: s.size,
1688
+ teleported: s.teleported,
1689
+ "fit-input-width": s.fitInputWidth,
1690
+ "popper-class": S.value,
1691
+ "append-to": s.appendTo,
1692
+ "onUpdate:modelValue": L,
1693
+ onChange: f,
1694
+ onClear: M,
1695
+ onVisibleChange: m,
1696
+ onFocus: C,
1697
+ onBlur: Q
1698
+ }), $e({
1699
+ default: k(() => [
1700
+ O.value ? $(s.$slots, "default", { key: 0 }) : (v(!0), R(Ce, { key: 1 }, lt(b.value, (j, K) => (v(), ce(E(Et), {
1701
+ key: q(j, K),
1702
+ label: j.label,
1703
+ value: j.value,
1704
+ disabled: j.disabled
1705
+ }, null, 8, ["label", "value", "disabled"]))), 128))
1706
+ ]),
1707
+ _: 2
1708
+ }, [
1709
+ s.$slots.prefix ? {
1710
+ name: "prefix",
1711
+ fn: k(() => [
1712
+ $(s.$slots, "prefix")
1713
+ ]),
1714
+ key: "0"
1715
+ } : void 0,
1716
+ s.$slots.empty ? {
1717
+ name: "empty",
1718
+ fn: k(() => [
1719
+ $(s.$slots, "empty")
1720
+ ]),
1721
+ key: "1"
1722
+ } : void 0,
1723
+ s.$slots.loading ? {
1724
+ name: "loading",
1725
+ fn: k(() => [
1726
+ $(s.$slots, "loading")
1727
+ ]),
1728
+ key: "2"
1729
+ } : void 0,
1730
+ s.$slots.tag ? {
1731
+ name: "tag",
1732
+ fn: k((j) => [
1733
+ $(s.$slots, "tag", Fe(Qe(j)))
1734
+ ]),
1735
+ key: "3"
1736
+ } : void 0
1737
+ ]), 1040, ["model-value", "placeholder", "disabled", "clearable", "filterable", "multiple", "collapse-tags", "collapse-tags-tooltip", "size", "teleported", "fit-input-width", "popper-class", "append-to"]));
1738
+ }
1739
+ }), Il = /* @__PURE__ */ me({
1740
+ name: "QyRemoteSelect",
1741
+ inheritAttrs: !1,
1742
+ __name: "index",
1743
+ props: {
1744
+ modelValue: { type: [String, Number, Boolean, Array, null], default: void 0 },
1745
+ fetchMethod: {},
1746
+ defaultOptions: { default: () => [] },
1747
+ labelKey: { default: "label" },
1748
+ valueKey: { default: "value" },
1749
+ disabledKey: { default: "disabled" },
1750
+ placeholder: { default: "请选择" },
1751
+ disabled: { type: Boolean, default: !1 },
1752
+ clearable: { type: Boolean, default: !0 },
1753
+ multiple: { type: Boolean, default: !1 },
1754
+ collapseTags: { type: Boolean, default: !1 },
1755
+ collapseTagsTooltip: { type: Boolean, default: !1 },
1756
+ autoSelectSingle: { type: Boolean, default: !1 },
1757
+ size: { default: "default" },
1758
+ teleported: { type: Boolean, default: !0 },
1759
+ appendTo: { default: "body" },
1760
+ fitInputWidth: { type: Boolean, default: !0 },
1761
+ popperClass: { default: "" },
1762
+ debounce: { default: 300 },
1763
+ minLength: { default: 1 },
1764
+ remoteOnFocus: { type: Boolean, default: !1 },
1765
+ remoteShowSuffix: { type: Boolean, default: !0 },
1766
+ loading: { type: Boolean, default: !1 },
1767
+ reserveSelectedOption: { type: Boolean, default: !0 }
1768
+ },
1769
+ emits: ["update:modelValue", "change", "clear", "visible-change", "focus", "blur", "options-change", "loading-change", "error"],
1770
+ setup(o, { expose: h, emit: I }) {
1771
+ const e = o, n = I, T = ve(), r = B(null), c = B([]), S = B(/* @__PURE__ */ new Map()), b = B(!1), O = B("");
1772
+ let F = 0, q = null;
1773
+ const L = H(() => e.loading || b.value), f = B(!1), M = H(() => {
1774
+ const u = /* @__PURE__ */ new Map(), D = (X) => {
1775
+ u.set(m(X), X);
1776
+ };
1777
+ return e.defaultOptions.forEach(D), e.reserveSelectedOption && S.value.forEach((X) => D(X)), c.value.forEach(D), Array.from(u.values());
1778
+ });
1779
+ pe(
1780
+ () => e.defaultOptions,
1781
+ (u) => {
1782
+ u.forEach(Q);
1783
+ },
1784
+ { immediate: !0 }
1785
+ ), pe(
1786
+ () => e.modelValue,
1787
+ () => {
1788
+ M.value.forEach(Q);
1789
+ },
1790
+ { immediate: !0 }
1791
+ );
1792
+ function m(u) {
1793
+ return (u == null ? void 0 : u[e.valueKey]) ?? (u == null ? void 0 : u.value) ?? (u == null ? void 0 : u.label);
1794
+ }
1795
+ function C(u) {
1796
+ return Array.isArray(e.modelValue) ? e.modelValue.includes(u) : e.modelValue === u;
1797
+ }
1798
+ function Q(u) {
1799
+ if (!e.reserveSelectedOption) return;
1800
+ const D = m(u);
1801
+ C(D) && S.value.set(D, u);
1802
+ }
1803
+ function p(u) {
1804
+ return e.disabled ? !1 : u ? u.length >= e.minLength : e.remoteOnFocus;
1805
+ }
1806
+ function U(u) {
1807
+ b.value !== u && (b.value = u, n("loading-change", u));
1808
+ }
1809
+ async function s(u) {
1810
+ if (O.value = u, !p(u)) {
1811
+ F += 1, c.value = [], U(!1), n("options-change", M.value);
1812
+ return;
1813
+ }
1814
+ const D = ++F;
1815
+ U(!0);
1816
+ try {
1817
+ const X = await e.fetchMethod(u);
1818
+ if (D !== F) return;
1819
+ c.value = Array.isArray(X) ? X : [], c.value.forEach(Q), n("options-change", M.value);
1820
+ } catch (X) {
1821
+ if (D !== F) return;
1822
+ c.value = [], n("error", X), n("options-change", M.value);
1823
+ } finally {
1824
+ D === F && U(!1);
1825
+ }
1826
+ }
1827
+ function _() {
1828
+ f.value || (f.value = !0, s(""));
1829
+ }
1830
+ function j(u) {
1831
+ q && (clearTimeout(q), q = null), q = setTimeout(() => {
1832
+ s(u);
1833
+ }, e.debounce);
1834
+ }
1835
+ function K() {
1836
+ f.value = !0, s("");
1837
+ }
1838
+ function ee() {
1839
+ s(O.value);
1840
+ }
1841
+ function oe(u) {
1842
+ n("update:modelValue", u);
1843
+ }
1844
+ function t(u) {
1845
+ M.value.forEach(Q), n("change", u);
1846
+ }
1847
+ function l() {
1848
+ n("clear");
1849
+ }
1850
+ function g(u) {
1851
+ u && e.remoteOnFocus && !O.value && _(), n("visible-change", u);
1852
+ }
1853
+ function G(u) {
1854
+ e.remoteOnFocus && !O.value && _(), n("focus", u);
1855
+ }
1856
+ function ne(u) {
1857
+ n("blur", u);
1858
+ }
1859
+ function se() {
1860
+ var u, D;
1861
+ (D = (u = r.value) == null ? void 0 : u.focus) == null || D.call(u);
1862
+ }
1863
+ function x() {
1864
+ var u, D;
1865
+ (D = (u = r.value) == null ? void 0 : u.blur) == null || D.call(u);
1866
+ }
1867
+ function w() {
1868
+ n("update:modelValue", e.multiple ? [] : ""), n("clear");
1869
+ }
1870
+ return Xe(() => {
1871
+ q && clearTimeout(q);
1872
+ }), h({
1873
+ // 暴露远程选择常用控制方法,供弹窗打开后聚焦或请求失败后重试。
1874
+ focus: se,
1875
+ blur: x,
1876
+ clear: w,
1877
+ retryFetch: ee,
1878
+ fetchDefaultOptions: K
1879
+ }), (u, D) => (v(), ce(ot, fe({
1880
+ ref_key: "selectRef",
1881
+ ref: r
1882
+ }, E(T), {
1883
+ "model-value": u.modelValue,
1884
+ options: M.value,
1885
+ "label-key": u.labelKey,
1886
+ "value-key": u.valueKey,
1887
+ "disabled-key": u.disabledKey,
1888
+ placeholder: u.placeholder,
1889
+ disabled: u.disabled,
1890
+ clearable: u.clearable,
1891
+ filterable: !0,
1892
+ multiple: u.multiple,
1893
+ "collapse-tags": u.collapseTags,
1894
+ "collapse-tags-tooltip": u.collapseTagsTooltip,
1895
+ "auto-select-single": u.autoSelectSingle,
1896
+ size: u.size,
1897
+ teleported: u.teleported,
1898
+ "append-to": u.appendTo,
1899
+ "fit-input-width": u.fitInputWidth,
1900
+ "popper-class": u.popperClass,
1901
+ remote: "",
1902
+ "remote-show-suffix": u.remoteShowSuffix,
1903
+ "remote-method": j,
1904
+ loading: L.value,
1905
+ "onUpdate:modelValue": oe,
1906
+ onChange: t,
1907
+ onClear: l,
1908
+ onVisibleChange: g,
1909
+ onFocus: G,
1910
+ onBlur: ne
1911
+ }), $e({
1912
+ default: k(() => [
1913
+ u.$slots.default ? $(u.$slots, "default", { key: 0 }) : N("", !0)
1914
+ ]),
1915
+ _: 2
1916
+ }, [
1917
+ u.$slots.prefix ? {
1918
+ name: "prefix",
1919
+ fn: k(() => [
1920
+ $(u.$slots, "prefix")
1921
+ ]),
1922
+ key: "0"
1923
+ } : void 0,
1924
+ u.$slots.empty ? {
1925
+ name: "empty",
1926
+ fn: k(() => [
1927
+ $(u.$slots, "empty")
1928
+ ]),
1929
+ key: "1"
1930
+ } : void 0,
1931
+ u.$slots.loading ? {
1932
+ name: "loading",
1933
+ fn: k(() => [
1934
+ $(u.$slots, "loading")
1935
+ ]),
1936
+ key: "2"
1937
+ } : void 0,
1938
+ u.$slots.tag ? {
1939
+ name: "tag",
1940
+ fn: k((X) => [
1941
+ $(u.$slots, "tag", Fe(Qe(X)))
1942
+ ]),
1943
+ key: "3"
1944
+ } : void 0
1945
+ ]), 1040, ["model-value", "options", "label-key", "value-key", "disabled-key", "placeholder", "disabled", "clearable", "multiple", "collapse-tags", "collapse-tags-tooltip", "auto-select-single", "size", "teleported", "append-to", "fit-input-width", "popper-class", "remote-show-suffix", "loading"]));
1946
+ }
1947
+ }), ql = { class: "qy-search-input__item" }, Ml = ["innerHTML"], Rl = {
1948
+ key: 0,
1949
+ class: "qy-search-input__item-description"
1950
+ }, Tl = /* @__PURE__ */ me({
1951
+ name: "QySearchInput",
1952
+ inheritAttrs: !1,
1953
+ __name: "index",
1954
+ props: {
1955
+ modelValue: { default: "" },
1956
+ loading: { type: Boolean, default: !1 },
1957
+ disabled: { type: Boolean, default: !1 },
1958
+ placeholder: { default: "请输入搜索内容" },
1959
+ removeSpace: { type: Boolean, default: !1 },
1960
+ trimMode: { default: "none" },
1961
+ clearable: { type: Boolean, default: !0 },
1962
+ buttonText: { default: "搜索" },
1963
+ buttonProps: { default: () => ({}) },
1964
+ suggestions: { default: () => [] },
1965
+ fetchSuggestions: { type: [Function, null], default: null },
1966
+ fetchSuggestionsMethod: { type: [Function, null], default: null },
1967
+ debounce: { default: 300 },
1968
+ minLength: { default: 1 },
1969
+ triggerOnFocus: { type: Boolean, default: !1 },
1970
+ searchOnEnter: { type: Boolean, default: !0 },
1971
+ searchOnSelect: { type: Boolean, default: !1 },
1972
+ highlightKeyword: { type: Boolean, default: !0 },
1973
+ teleported: { type: Boolean, default: !0 },
1974
+ appendTo: { default: "body" },
1975
+ popperClass: { default: "" },
1976
+ fitInputWidth: { type: Boolean, default: !0 }
1977
+ },
1978
+ emits: ["update:modelValue", "search", "clear", "input", "change", "focus", "blur", "enter", "select", "visible-change", "suggestions-change", "error"],
1979
+ setup(o, { expose: h, emit: I }) {
1980
+ const e = o, n = I, T = ve(), r = B(null), c = B(q(e.modelValue)), S = H(() => q(e.modelValue)), b = H(
1981
+ () => ["qy-search-input__popper", e.popperClass].filter(Boolean).join(" ")
1982
+ ), O = H(() => q(e.modelValue)), F = B("");
1983
+ pe(
1984
+ () => e.modelValue,
1985
+ (a) => {
1986
+ c.value = q(a);
1987
+ }
1988
+ );
1989
+ function q(a) {
1990
+ return a == null ? "" : String(a);
1991
+ }
1992
+ function L(a) {
1993
+ return e.removeSpace ? a.replace(/\s+/g, "") : a;
1994
+ }
1995
+ function f(a, y) {
1996
+ return e.trimMode !== y ? a : a.trim();
1997
+ }
1998
+ function M(a) {
1999
+ return L(q(a));
2000
+ }
2001
+ function m(a) {
2002
+ c.value = a, n("update:modelValue", a);
2003
+ }
2004
+ function C(a, y = "") {
2005
+ return {
2006
+ ...a,
2007
+ label: a.label || a.value,
2008
+ value: a.value || a.label,
2009
+ description: a.description || y
2010
+ };
2011
+ }
2012
+ function Q(a = []) {
2013
+ return a.flatMap((y) => {
2014
+ if (Array.isArray(y.items)) {
2015
+ const Z = y;
2016
+ return Z.items.map((re) => C(re, Z.groupLabel));
2017
+ }
2018
+ return C(y);
2019
+ });
2020
+ }
2021
+ function p(a) {
2022
+ const y = a.toLowerCase();
2023
+ return (Z) => [Z.label, Z.value, Z.description].filter(Boolean).some((re) => String(re).toLowerCase().includes(y));
2024
+ }
2025
+ function U(a) {
2026
+ return a ? a.length >= e.minLength : e.triggerOnFocus;
2027
+ }
2028
+ function s(a) {
2029
+ n("suggestions-change", a), n("visible-change", a.length > 0);
2030
+ }
2031
+ async function _(a) {
2032
+ if (!U(a))
2033
+ return s([]), [];
2034
+ if (e.fetchSuggestionsMethod) {
2035
+ const re = await new Promise((ye) => {
2036
+ var ze;
2037
+ (ze = e.fetchSuggestionsMethod) == null || ze.call(e, a, (Re) => {
2038
+ ye(Q(Re));
2039
+ });
2040
+ });
2041
+ return s(re), re;
2042
+ }
2043
+ if (e.fetchSuggestions) {
2044
+ const re = await e.fetchSuggestions(a), ye = Q(Array.isArray(re) ? re : []);
2045
+ return s(ye), ye;
2046
+ }
2047
+ const y = Q(e.suggestions), Z = a ? y.filter(p(a)) : y;
2048
+ return s(Z), Z;
2049
+ }
2050
+ async function j(a, y) {
2051
+ F.value = a;
2052
+ try {
2053
+ const Z = await _(a);
2054
+ y(Z);
2055
+ } catch (Z) {
2056
+ n("error", Z), s([]), y([]);
2057
+ }
2058
+ }
2059
+ function K() {
2060
+ var a, y;
2061
+ F.value && ((y = (a = r.value) == null ? void 0 : a.getData) == null || y.call(a, F.value));
2062
+ }
2063
+ function ee(a) {
2064
+ const y = M(a);
2065
+ m(y);
2066
+ }
2067
+ function oe(a) {
2068
+ const y = M(a);
2069
+ c.value = y, n("input", y);
2070
+ }
2071
+ function t(a) {
2072
+ const y = f(M(a), "change");
2073
+ y !== q(e.modelValue) && m(y), n("change", y);
2074
+ }
2075
+ function l(a) {
2076
+ n("focus", a);
2077
+ }
2078
+ function g(a) {
2079
+ const y = f(c.value, "blur");
2080
+ y !== q(e.modelValue) && m(y), n("blur", a), n("visible-change", !1);
2081
+ }
2082
+ function G() {
2083
+ c.value = "", n("update:modelValue", ""), n("clear"), s([]);
2084
+ }
2085
+ function ne(a) {
2086
+ n("enter", a), e.searchOnEnter && se();
2087
+ }
2088
+ function se() {
2089
+ n("search", q(e.modelValue));
2090
+ }
2091
+ function x(a) {
2092
+ n("select", a), e.searchOnSelect && n("search", a.value);
2093
+ }
2094
+ function w(a) {
2095
+ return a.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
2096
+ }
2097
+ function u(a) {
2098
+ return a.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2099
+ }
2100
+ function D(a) {
2101
+ const y = w(a || "");
2102
+ if (!e.highlightKeyword || !S.value) return y;
2103
+ const Z = u(w(S.value));
2104
+ return Z ? y.replace(
2105
+ new RegExp(`(${Z})`, "ig"),
2106
+ '<mark class="qy-search-input__mark">$1</mark>'
2107
+ ) : y;
2108
+ }
2109
+ function X() {
2110
+ var a, y;
2111
+ (y = (a = r.value) == null ? void 0 : a.focus) == null || y.call(a);
2112
+ }
2113
+ function be() {
2114
+ var a, y;
2115
+ (y = (a = r.value) == null ? void 0 : a.blur) == null || y.call(a);
2116
+ }
2117
+ function we() {
2118
+ var a, y, Z;
2119
+ (Z = (y = (a = r.value) == null ? void 0 : a.inputRef) == null ? void 0 : y.select) == null || Z.call(y);
2120
+ }
2121
+ function he() {
2122
+ var a, y;
2123
+ (y = (a = r.value) == null ? void 0 : a.clear) == null || y.call(a);
2124
+ }
2125
+ function xe() {
2126
+ var a, y;
2127
+ (y = (a = r.value) == null ? void 0 : a.close) == null || y.call(a);
2128
+ }
2129
+ return h({
2130
+ // 暴露搜索框常用控制方法,供弹窗打开后聚焦或失败后重试建议项。
2131
+ focus: X,
2132
+ blur: be,
2133
+ select: we,
2134
+ clear: he,
2135
+ closePanel: xe,
2136
+ retryFetch: K
2137
+ }), (a, y) => (v(), R("div", {
2138
+ class: ie(["qy-search-input", { "is-disabled": a.disabled }])
2139
+ }, [
2140
+ te(E(Lt), fe({
2141
+ ref_key: "autocompleteRef",
2142
+ ref: r
2143
+ }, E(T), {
2144
+ "model-value": O.value,
2145
+ disabled: a.disabled,
2146
+ placeholder: a.placeholder,
2147
+ clearable: a.clearable,
2148
+ debounce: a.debounce,
2149
+ "fetch-suggestions": j,
2150
+ "trigger-on-focus": a.triggerOnFocus,
2151
+ teleported: a.teleported,
2152
+ "fit-input-width": a.fitInputWidth,
2153
+ "popper-class": b.value,
2154
+ "append-to": a.appendTo,
2155
+ "value-key": "value",
2156
+ "onUpdate:modelValue": ee,
2157
+ onInput: oe,
2158
+ onChange: t,
2159
+ onFocus: l,
2160
+ onBlur: g,
2161
+ onClear: G,
2162
+ onSelect: x,
2163
+ onKeydown: Ae(ne, ["enter"])
2164
+ }), $e({
2165
+ append: k(() => [
2166
+ a.$slots.append ? $(a.$slots, "append", { key: 0 }, void 0, !0) : (v(), ce(E(Me), fe({ key: 1 }, a.buttonProps, {
2167
+ loading: a.loading,
2168
+ disabled: a.disabled,
2169
+ onClick: se
2170
+ }), {
2171
+ default: k(() => [
2172
+ Ve(ae(a.buttonText), 1)
2173
+ ]),
2174
+ _: 1
2175
+ }, 16, ["loading", "disabled"]))
2176
+ ]),
2177
+ default: k(({ item: Z }) => [
2178
+ $(a.$slots, "item", {
2179
+ item: Z,
2180
+ keyword: S.value
2181
+ }, () => [
2182
+ z("div", ql, [
2183
+ z("div", {
2184
+ class: "qy-search-input__item-label",
2185
+ innerHTML: D(Z.label || Z.value || "")
2186
+ }, null, 8, Ml),
2187
+ Z.description ? (v(), R("div", Rl, ae(Z.description), 1)) : N("", !0)
2188
+ ])
2189
+ ], !0)
2190
+ ]),
2191
+ _: 2
2192
+ }, [
2193
+ a.$slots.prefix ? {
2194
+ name: "prefix",
2195
+ fn: k(() => [
2196
+ $(a.$slots, "prefix", {}, void 0, !0)
2197
+ ]),
2198
+ key: "0"
2199
+ } : void 0,
2200
+ a.$slots.suffix ? {
2201
+ name: "suffix",
2202
+ fn: k(() => [
2203
+ $(a.$slots, "suffix", {}, void 0, !0)
2204
+ ]),
2205
+ key: "1"
2206
+ } : void 0,
2207
+ a.$slots.prepend ? {
2208
+ name: "prepend",
2209
+ fn: k(() => [
2210
+ $(a.$slots, "prepend", {}, void 0, !0)
2211
+ ]),
2212
+ key: "2"
2213
+ } : void 0
2214
+ ]), 1040, ["model-value", "disabled", "placeholder", "clearable", "debounce", "trigger-on-focus", "teleported", "fit-input-width", "popper-class", "append-to"])
2215
+ ], 2));
2216
+ }
2217
+ }), st = /* @__PURE__ */ Be(Tl, [["__scopeId", "data-v-f1f0e1f9"]]), Ol = { class: "qy-record-quote-search" }, Ul = {
2218
+ key: 0,
2219
+ class: "qy-record-quote-search__header"
2220
+ }, _l = {
2221
+ key: 0,
2222
+ class: "qy-record-quote-search__label"
2223
+ }, Al = {
2224
+ key: 1,
2225
+ class: "qy-record-quote-search__description"
2226
+ }, Fl = /* @__PURE__ */ me({
2227
+ name: "QyRecordQuoteSearch",
2228
+ inheritAttrs: !1,
2229
+ __name: "index",
2230
+ props: {
2231
+ modelValue: { default: "" },
2232
+ loading: { type: Boolean, default: !1 },
2233
+ disabled: { type: Boolean, default: !1 },
2234
+ placeholder: { default: "请输入报价单号" },
2235
+ buttonText: { default: "查询报价单" },
2236
+ autoNormalize: { type: Boolean, default: !0 },
2237
+ showStatus: { type: Boolean, default: !0 },
2238
+ status: { default: "default" },
2239
+ statusText: { default: "" },
2240
+ suggestions: { default: () => [] },
2241
+ fetchSuggestions: { type: [Function, null], default: null },
2242
+ fetchSuggestionsMethod: { type: [Function, null], default: null },
2243
+ debounce: { default: 300 },
2244
+ minLength: { default: 1 },
2245
+ searchOnSelect: { type: Boolean, default: !0 },
2246
+ searchMethod: { type: [Function, null], default: null },
2247
+ extractMethod: { type: [Function, null], default: null },
2248
+ normalizeMethod: { type: [Function, null], default: null },
2249
+ label: { default: "报价单号" },
2250
+ description: { default: "" },
2251
+ trimMode: { default: "blur" }
2252
+ },
2253
+ emits: ["update:modelValue", "search", "clear", "normalize", "enter", "select", "error", "success"],
2254
+ setup(o, { expose: h, emit: I }) {
2255
+ const e = o, n = I, T = ve(), r = B(null), c = B(!1), S = H(() => e.statusText || ""), b = H(() => e.loading || c.value);
2256
+ function O(t) {
2257
+ return t == null ? "" : String(t);
2258
+ }
2259
+ function F(t) {
2260
+ const l = O(t).trim(), g = q(l), G = g.match(/BJ\d{8}[A-Z0-9]{4}/i);
2261
+ return G ? G[0] : g;
2262
+ }
2263
+ function q(t) {
2264
+ return O(t).replace(/\s+/g, "").trim().toUpperCase();
2265
+ }
2266
+ function L(t) {
2267
+ return e.extractMethod ? e.extractMethod(t) : F(t);
2268
+ }
2269
+ function f(t) {
2270
+ return e.normalizeMethod ? e.normalizeMethod(t) : q(t);
2271
+ }
2272
+ function M(t, l) {
2273
+ const g = O(t), G = L(g), ne = e.autoNormalize ? f(G) : G;
2274
+ return n("normalize", { rawValue: g, code: ne }), {
2275
+ rawValue: g,
2276
+ code: ne,
2277
+ item: l
2278
+ };
2279
+ }
2280
+ function m(t) {
2281
+ n("update:modelValue", t);
2282
+ }
2283
+ async function C(t) {
2284
+ if (n("search", t), !!e.searchMethod) {
2285
+ c.value = !0;
2286
+ try {
2287
+ const l = await e.searchMethod(t);
2288
+ n("success", l);
2289
+ } catch (l) {
2290
+ n("error", l);
2291
+ } finally {
2292
+ c.value = !1;
2293
+ }
2294
+ }
2295
+ }
2296
+ function Q(t) {
2297
+ const l = M(t);
2298
+ l.code !== O(e.modelValue) && n("update:modelValue", l.code), C(l);
2299
+ }
2300
+ function p() {
2301
+ n("clear");
2302
+ }
2303
+ function U(t) {
2304
+ n("enter", t);
2305
+ }
2306
+ function s(t) {
2307
+ if (n("select", t), !e.searchOnSelect) return;
2308
+ const l = M(t.value, t);
2309
+ l.code !== O(e.modelValue) && n("update:modelValue", l.code), C(l);
2310
+ }
2311
+ function _(t) {
2312
+ n("error", t);
2313
+ }
2314
+ function j() {
2315
+ var t, l;
2316
+ (l = (t = r.value) == null ? void 0 : t.focus) == null || l.call(t);
2317
+ }
2318
+ function K() {
2319
+ var t, l;
2320
+ (l = (t = r.value) == null ? void 0 : t.blur) == null || l.call(t);
2321
+ }
2322
+ function ee() {
2323
+ var t, l;
2324
+ (l = (t = r.value) == null ? void 0 : t.select) == null || l.call(t);
2325
+ }
2326
+ function oe() {
2327
+ var t, l;
2328
+ (l = (t = r.value) == null ? void 0 : t.clear) == null || l.call(t);
2329
+ }
2330
+ return h({
2331
+ focus: j,
2332
+ blur: K,
2333
+ select: ee,
2334
+ clear: oe,
2335
+ extractQuoteOrderCode: L,
2336
+ normalizeQuoteOrderCode: f
2337
+ }), (t, l) => (v(), R("div", Ol, [
2338
+ $(t.$slots, "label", {}, () => [
2339
+ t.label || t.description ? (v(), R("div", Ul, [
2340
+ t.label ? (v(), R("div", _l, ae(t.label), 1)) : N("", !0),
2341
+ t.description ? (v(), R("div", Al, ae(t.description), 1)) : N("", !0)
2342
+ ])) : N("", !0)
2343
+ ], !0),
2344
+ te(st, fe({
2345
+ ref_key: "searchRef",
2346
+ ref: r
2347
+ }, E(T), {
2348
+ "model-value": t.modelValue,
2349
+ loading: b.value,
2350
+ disabled: t.disabled,
2351
+ placeholder: t.placeholder,
2352
+ "remove-space": !0,
2353
+ "trim-mode": t.trimMode,
2354
+ "button-text": t.buttonText,
2355
+ suggestions: t.suggestions,
2356
+ "fetch-suggestions": t.fetchSuggestions,
2357
+ "fetch-suggestions-method": t.fetchSuggestionsMethod,
2358
+ debounce: t.debounce,
2359
+ "min-length": t.minLength,
2360
+ "search-on-select": !1,
2361
+ "onUpdate:modelValue": m,
2362
+ onSearch: Q,
2363
+ onClear: p,
2364
+ onEnter: U,
2365
+ onSelect: s,
2366
+ onError: _
2367
+ }), $e({ _: 2 }, [
2368
+ t.$slots.prefix ? {
2369
+ name: "prefix",
2370
+ fn: k(() => [
2371
+ $(t.$slots, "prefix", {}, void 0, !0)
2372
+ ]),
2373
+ key: "0"
2374
+ } : void 0,
2375
+ t.$slots.suffix ? {
2376
+ name: "suffix",
2377
+ fn: k(() => [
2378
+ $(t.$slots, "suffix", {}, void 0, !0)
2379
+ ]),
2380
+ key: "1"
2381
+ } : void 0,
2382
+ t.$slots.item ? {
2383
+ name: "item",
2384
+ fn: k((g) => [
2385
+ $(t.$slots, "item", Fe(Qe(g)), void 0, !0)
2386
+ ]),
2387
+ key: "2"
2388
+ } : void 0,
2389
+ t.$slots.empty ? {
2390
+ name: "empty",
2391
+ fn: k(() => [
2392
+ $(t.$slots, "empty", {}, void 0, !0)
2393
+ ]),
2394
+ key: "3"
2395
+ } : void 0,
2396
+ t.$slots.loading ? {
2397
+ name: "loading",
2398
+ fn: k(() => [
2399
+ $(t.$slots, "loading", {}, void 0, !0)
2400
+ ]),
2401
+ key: "4"
2402
+ } : void 0
2403
+ ]), 1040, ["model-value", "loading", "disabled", "placeholder", "trim-mode", "button-text", "suggestions", "fetch-suggestions", "fetch-suggestions-method", "debounce", "min-length"]),
2404
+ t.showStatus && S.value ? $(t.$slots, "status", {
2405
+ key: 0,
2406
+ status: t.status,
2407
+ statusText: S.value
2408
+ }, () => [
2409
+ z("div", {
2410
+ class: ie(["qy-record-quote-search__status", `is-${t.status}`])
2411
+ }, ae(S.value), 3)
2412
+ ], !0) : N("", !0)
2413
+ ]));
2414
+ }
2415
+ }), Ql = /* @__PURE__ */ Be(Fl, [["__scopeId", "data-v-3a314f64"]]), Dl = { class: "qy-form-section__heading" }, El = {
2416
+ key: 0,
2417
+ class: "qy-form-section__title"
2418
+ }, Ll = {
2419
+ key: 0,
2420
+ class: "qy-form-section__description"
2421
+ }, Pl = { class: "qy-form-section__actions" }, jl = /* @__PURE__ */ me({
2422
+ name: "QyFormSection",
2423
+ __name: "index",
2424
+ props: {
2425
+ title: { default: "" },
2426
+ description: { default: "" },
2427
+ tip: { default: "" },
2428
+ tipType: { default: "info" },
2429
+ collapsible: { type: Boolean, default: !1 },
2430
+ defaultExpanded: { type: Boolean, default: !0 },
2431
+ bordered: { type: Boolean, default: !0 },
2432
+ background: { default: "white" },
2433
+ bodyClass: { default: "" },
2434
+ headerClass: { default: "" }
2435
+ },
2436
+ emits: ["toggle"],
2437
+ setup(o, { emit: h }) {
2438
+ const I = o, e = h, n = B(I.defaultExpanded);
2439
+ pe(
2440
+ () => I.defaultExpanded,
2441
+ (c) => {
2442
+ n.value = c;
2443
+ }
2444
+ );
2445
+ function T() {
2446
+ I.collapsible && (n.value = !n.value, e("toggle", n.value));
2447
+ }
2448
+ function r() {
2449
+ I.collapsible && T();
2450
+ }
2451
+ return (c, S) => (v(), R("section", {
2452
+ class: ie(["qy-form-section", [
2453
+ `is-bg-${c.background}`,
2454
+ {
2455
+ "is-bordered": c.bordered,
2456
+ "is-collapsible": c.collapsible
2457
+ }
2458
+ ]])
2459
+ }, [
2460
+ z("header", {
2461
+ class: ie(["qy-form-section__header", c.headerClass]),
2462
+ onClick: r
2463
+ }, [
2464
+ z("div", Dl, [
2465
+ $(c.$slots, "title", {}, () => [
2466
+ c.title ? (v(), R("div", El, ae(c.title), 1)) : N("", !0)
2467
+ ], !0),
2468
+ $(c.$slots, "description", {}, () => [
2469
+ c.description ? (v(), R("div", Ll, ae(c.description), 1)) : N("", !0)
2470
+ ], !0)
2471
+ ]),
2472
+ z("div", Pl, [
2473
+ $(c.$slots, "actions", {}, void 0, !0),
2474
+ c.collapsible ? (v(), R("button", {
2475
+ key: 0,
2476
+ type: "button",
2477
+ class: "qy-form-section__toggle",
2478
+ onClick: Y(T, ["stop"])
2479
+ }, ae(n.value ? "收起" : "展开"), 1)) : N("", !0)
2480
+ ])
2481
+ ], 2),
2482
+ et(z("div", {
2483
+ class: ie(["qy-form-section__body", c.bodyClass])
2484
+ }, [
2485
+ $(c.$slots, "tip", {}, () => [
2486
+ c.tip ? (v(), R("div", {
2487
+ key: 0,
2488
+ class: ie(["qy-form-section__tip", `is-${c.tipType}`])
2489
+ }, ae(c.tip), 3)) : N("", !0)
2490
+ ], !0),
2491
+ $(c.$slots, "default", {}, void 0, !0)
2492
+ ], 2), [
2493
+ [tt, n.value]
2494
+ ])
2495
+ ], 2));
2496
+ }
2497
+ }), Kl = /* @__PURE__ */ Be(jl, [["__scopeId", "data-v-8149aa01"]]), Nl = {
2498
+ key: 0,
2499
+ class: "qy-action-bar__left"
2500
+ }, Hl = {
2501
+ key: 1,
2502
+ class: "qy-action-bar__center"
2503
+ }, Zl = {
2504
+ key: 2,
2505
+ class: "qy-action-bar__right"
2506
+ }, Wl = /* @__PURE__ */ me({
2507
+ name: "QyActionBar",
2508
+ __name: "index",
2509
+ props: {
2510
+ sticky: { type: Boolean, default: !0 },
2511
+ offsetBottom: { default: 0 },
2512
+ bordered: { type: Boolean, default: !0 },
2513
+ shadow: { type: Boolean, default: !1 },
2514
+ wrap: { type: Boolean, default: !0 },
2515
+ justify: { default: "between" },
2516
+ background: { default: "#fff" }
2517
+ },
2518
+ setup(o) {
2519
+ const h = o, I = H(() => ({
2520
+ // offsetBottom 只负责业务偏移,安全区补偿由 CSS padding 处理。
2521
+ bottom: `${h.offsetBottom}px`,
2522
+ background: h.background
2523
+ }));
2524
+ return (e, n) => (v(), R("div", {
2525
+ class: ie(["qy-action-bar", [
2526
+ `is-justify-${e.justify}`,
2527
+ {
2528
+ "is-sticky": e.sticky,
2529
+ "is-bordered": e.bordered,
2530
+ "is-shadow": e.shadow,
2531
+ "is-wrap": e.wrap
2532
+ }
2533
+ ]]),
2534
+ style: Se(I.value)
2535
+ }, [
2536
+ e.$slots.left ? (v(), R("div", Nl, [
2537
+ $(e.$slots, "left", {}, void 0, !0)
2538
+ ])) : N("", !0),
2539
+ e.$slots.default ? (v(), R("div", Hl, [
2540
+ $(e.$slots, "default", {}, void 0, !0)
2541
+ ])) : N("", !0),
2542
+ e.$slots.right ? (v(), R("div", Zl, [
2543
+ $(e.$slots, "right", {}, void 0, !0)
2544
+ ])) : N("", !0)
2545
+ ], 6));
2546
+ }
2547
+ }), Gl = /* @__PURE__ */ Be(Wl, [["__scopeId", "data-v-ecba8f49"]]);
2548
+ function ue(o, h = o == null ? void 0 : o.name) {
2549
+ return h && (o.install = (I) => {
2550
+ I.component(h, o);
2551
+ }), o;
2552
+ }
2553
+ const it = ue(nt, "QyUpload"), ut = ue(ll, "QyVoucherUpload"), rt = ue(ml, "QyDialog"), dt = ue(Bl, "QyRemarkImage"), ct = ue(Cl, "QyInput"), ft = ue(xl, "QyMoneyInput"), pt = ue(zl, "QyRadioGroup"), mt = ue(Il, "QyRemoteSelect"), yt = ue(st, "QySearchInput"), gt = ue(
2554
+ Ql,
2555
+ "QyRecordQuoteSearch"
2556
+ ), vt = ue(ot, "QySelect"), ht = ue(Kl, "QyFormSection"), bt = ue(Gl, "QyActionBar"), Xl = (o) => {
2557
+ o.component("QyDialog", rt), o.component("QyUpload", it), o.component("QyVoucherUpload", ut), o.component("QyRemarkImage", dt), o.component("QyInput", ct), o.component("QyMoneyInput", ft), o.component("QyRadioGroup", pt), o.component("QyRemoteSelect", mt), o.component("QySearchInput", yt), o.component("QyRecordQuoteSearch", gt), o.component("QySelect", vt), o.component("QyFormSection", ht), o.component("QyActionBar", bt);
2558
+ }, na = {
2559
+ install: Xl,
2560
+ QyUpload: it,
2561
+ QyVoucherUpload: ut,
2562
+ QyDialog: rt,
2563
+ QyInput: ct,
2564
+ QyMoneyInput: ft,
2565
+ QyRadioGroup: pt,
2566
+ QyRemoteSelect: mt,
2567
+ QySearchInput: yt,
2568
+ QyRecordQuoteSearch: gt,
2569
+ QySelect: vt,
2570
+ QyFormSection: ht,
2571
+ QyActionBar: bt,
2572
+ QyRemarkImage: dt
2573
+ };
2574
+ export {
2575
+ it as Q,
2576
+ ut as a,
2577
+ rt as b,
2578
+ ct as c,
2579
+ ft as d,
2580
+ pt as e,
2581
+ mt as f,
2582
+ yt as g,
2583
+ gt as h,
2584
+ vt as i,
2585
+ ht as j,
2586
+ bt as k,
2587
+ dt as l,
2588
+ yl as m,
2589
+ Ze as n,
2590
+ na as o,
2591
+ He as p
2592
+ };