@qynpm/ui 1.0.18 → 1.0.21

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 (52) hide show
  1. package/README.md +1 -1
  2. package/dist/index.cjs +2 -2
  3. package/dist/index.mjs +2 -2
  4. package/dist/qy-action-bar/index.cjs +1 -1
  5. package/dist/qy-action-bar/index.mjs +1 -1
  6. package/dist/qy-autocomplete/index.cjs +1 -1
  7. package/dist/qy-autocomplete/index.mjs +1 -1
  8. package/dist/qy-checkbox/index.cjs +1 -1
  9. package/dist/qy-checkbox/index.mjs +1 -1
  10. package/dist/qy-date-picker/index.cjs +1 -1
  11. package/dist/qy-date-picker/index.mjs +1 -1
  12. package/dist/qy-dialog/index.cjs +1 -1
  13. package/dist/qy-dialog/index.mjs +1 -1
  14. package/dist/qy-form-section/index.cjs +1 -1
  15. package/dist/qy-form-section/index.mjs +1 -1
  16. package/dist/qy-image/index.cjs +1 -1
  17. package/dist/qy-image/index.mjs +1 -1
  18. package/dist/qy-image-preview/index.cjs +1 -1
  19. package/dist/qy-image-preview/index.mjs +1 -1
  20. package/dist/qy-image-upload/index.cjs +1 -1
  21. package/dist/qy-image-upload/index.mjs +1 -1
  22. package/dist/qy-input/index.cjs +1 -1
  23. package/dist/qy-input/index.mjs +1 -1
  24. package/dist/qy-input-number/index.cjs +1 -1
  25. package/dist/qy-input-number/index.mjs +1 -1
  26. package/dist/qy-legacy-selection-dialog/index.cjs +1 -1
  27. package/dist/qy-legacy-selection-dialog/index.mjs +1 -1
  28. package/dist/qy-money-input/index.cjs +1 -1
  29. package/dist/qy-money-input/index.mjs +1 -1
  30. package/dist/qy-radio-group/index.cjs +1 -1
  31. package/dist/qy-radio-group/index.mjs +1 -1
  32. package/dist/qy-record-quote-search/index.cjs +1 -1
  33. package/dist/qy-record-quote-search/index.mjs +1 -1
  34. package/dist/qy-remark-image/index.cjs +1 -1
  35. package/dist/qy-remark-image/index.mjs +1 -1
  36. package/dist/qy-remote-select/index.cjs +1 -1
  37. package/dist/qy-remote-select/index.mjs +1 -1
  38. package/dist/qy-search-input/index.cjs +1 -1
  39. package/dist/qy-search-input/index.mjs +1 -1
  40. package/dist/qy-select/index.cjs +1 -1
  41. package/dist/qy-select/index.mjs +1 -1
  42. package/dist/qy-selection-dialog/index.cjs +1 -1
  43. package/dist/qy-selection-dialog/index.mjs +1 -1
  44. package/dist/qy-tree-select/index.cjs +1 -1
  45. package/dist/qy-tree-select/index.mjs +1 -1
  46. package/dist/qy-upload/index.cjs +1 -1
  47. package/dist/qy-upload/index.mjs +1 -1
  48. package/dist/shared/index-COjhEDRy.cjs +1 -0
  49. package/dist/shared/index-D6KfrXN6.mjs +4429 -0
  50. package/package.json +1 -1
  51. package/dist/shared/index-BycHYJ4s.cjs +0 -1
  52. package/dist/shared/index-D4tsKXQA.mjs +0 -4369
@@ -0,0 +1,4429 @@
1
+ import { ElUpload as nl, ElIcon as bt, ElPopover as ol, ElInput as rl, ElImageViewer as ul, ElDialog as wt, ElLoadingDirective as il } from "element-plus/es";
2
+ import { ref as Q, onMounted as lt, computed as F, watch as de, nextTick as Le, onBeforeUnmount as at, openBlock as S, createElementBlock as W, normalizeStyle as Me, normalizeClass as Ve, createVNode as Y, withCtx as k, withModifiers as ce, unref as C, Fragment as Ie, createElementVNode as G, toDisplayString as he, createCommentVNode as J, createBlock as le, createTextVNode as ve, h as Ye, createApp as sl, defineComponent as me, renderSlot as M, useAttrs as be, mergeProps as fe, useSlots as nt, useModel as dl, watchEffect as cl, onUnmounted as kt, resolveComponent as fl, createSlots as Pe, withDirectives as ot, vShow as St, mergeModels as ft, renderList as je, withKeys as Ne, resolveDynamicComponent as ml, Comment as pl, normalizeProps as Ke, guardReactiveProps as Ee, getCurrentInstance as yl, reactive as _e } from "vue";
3
+ import { Plus as gl, InfoFilled as hl, PictureFilled as mt } from "@element-plus/icons-vue";
4
+ import { ElMessage as xe, ElLoading as vl, ElImageViewer as xt, ElImage as bl, ElIcon as pt, ElButton as qe, ElSelect as rt, ElOption as ut, ElInput as Qe, ElPopover as wl, ElUpload as kl, ElInputNumber as Sl, ElDatePicker as xl, ElCheckbox as Vl, ElAutocomplete as Vt, ElRadioButton as Cl, ElRadio as $l, ElRadioGroup as Bl, ElTreeSelect as Ct, ElTag as yt, ElForm as $t, ElFormItem as Te, ElTable as zl, ElTableColumn as ql, ElPagination as Il } from "element-plus";
5
+ import { _ as Ae, w as ue } from "./install-DMq9RQ-h.mjs";
6
+ import Al from "clsx";
7
+ import { useBreakpoints as Rl, useDraggable as Tl } from "@vueuse/core";
8
+ import { M as Pl } from "./index-B4JNbDHG.mjs";
9
+ import { T as Fl } from "./index-BWIOoRpy.mjs";
10
+ /*! js-cookie v3.0.5 | MIT */
11
+ function Ze(t) {
12
+ for (var g = 1; g < arguments.length; g++) {
13
+ var b = arguments[g];
14
+ for (var e in b)
15
+ t[e] = b[e];
16
+ }
17
+ return t;
18
+ }
19
+ var Ml = {
20
+ read: function(t) {
21
+ return t[0] === '"' && (t = t.slice(1, -1)), t.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
22
+ },
23
+ write: function(t) {
24
+ return encodeURIComponent(t).replace(
25
+ /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
26
+ decodeURIComponent
27
+ );
28
+ }
29
+ };
30
+ function et(t, g) {
31
+ function b(a, A, r) {
32
+ if (!(typeof document > "u")) {
33
+ r = Ze({}, g, r), typeof r.expires == "number" && (r.expires = new Date(Date.now() + r.expires * 864e5)), r.expires && (r.expires = r.expires.toUTCString()), a = encodeURIComponent(a).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
34
+ var d = "";
35
+ for (var f in r)
36
+ r[f] && (d += "; " + f, r[f] !== !0 && (d += "=" + r[f].split(";")[0]));
37
+ return document.cookie = a + "=" + t.write(A, a) + d;
38
+ }
39
+ }
40
+ function e(a) {
41
+ if (!(typeof document > "u" || arguments.length && !a)) {
42
+ for (var A = document.cookie ? document.cookie.split("; ") : [], r = {}, d = 0; d < A.length; d++) {
43
+ var f = A[d].split("="), B = f.slice(1).join("=");
44
+ try {
45
+ var q = decodeURIComponent(f[0]);
46
+ if (r[q] = t.read(B, q), a === q)
47
+ break;
48
+ } catch {
49
+ }
50
+ }
51
+ return a ? r[a] : r;
52
+ }
53
+ }
54
+ return Object.create(
55
+ {
56
+ set: b,
57
+ get: e,
58
+ remove: function(a, A) {
59
+ b(
60
+ a,
61
+ "",
62
+ Ze({}, A, {
63
+ expires: -1
64
+ })
65
+ );
66
+ },
67
+ withAttributes: function(a) {
68
+ return et(this.converter, Ze({}, this.attributes, a));
69
+ },
70
+ withConverter: function(a) {
71
+ return et(Ze({}, this.converter, a), this.attributes);
72
+ }
73
+ },
74
+ {
75
+ attributes: { value: Object.freeze(g) },
76
+ converter: { value: Object.freeze(t) }
77
+ }
78
+ );
79
+ }
80
+ var Bt = et(Ml, { path: "/" });
81
+ const Ol = "Admin-Token";
82
+ function Ql(t = Ol) {
83
+ return Bt.get(t);
84
+ }
85
+ const Ul = { class: "qy-upload__hint" }, Dl = ["placeholder", "disabled"], Kl = ["src"], El = {
86
+ key: 1,
87
+ class: "qy-upload__tip"
88
+ }, Ll = { class: "error" }, jl = { class: "error" }, Nl = /* @__PURE__ */ Object.assign({
89
+ name: "QyUpload"
90
+ }, {
91
+ __name: "index",
92
+ props: {
93
+ /**
94
+ * 受控值。valueFormat 为 object 时结构为 { files, text },
95
+ * array 时为 string[],string 时为逗号分隔 URL。
96
+ */
97
+ modelValue: { type: [Object, Array, String], default: void 0 },
98
+ /**
99
+ * 初始值,结构为 { files: '逗号分隔的URL', text: '文字内容' }
100
+ * 非受控模式,仅初始化时读取一次
101
+ */
102
+ defaultValue: { type: Object, default: () => ({ files: "", text: "" }) },
103
+ /** v-model 输出格式:object | array | string */
104
+ valueFormat: { type: String, default: "object" },
105
+ /** 是否显示底部文字备注区 */
106
+ showText: { type: Boolean, default: !0 },
107
+ /** 是否显示纯粘贴输入条,不保存文字,仅用于承接 Ctrl+V 图片 */
108
+ showPasteInput: { type: Boolean, default: !1 },
109
+ /** 文字区占位文案,也用于凭证上传的粘贴提示 */
110
+ pastePlaceholder: { type: String, default: "输入文字" },
111
+ /** 是否多选 */
112
+ multiple: { type: Boolean, default: !0 },
113
+ /** 是否禁用 */
114
+ disabled: { type: Boolean, default: !1 },
115
+ /** 允许的文件类型后缀(如 ['jpg', 'mp4']) */
116
+ fileType: { type: Array, default: () => [] },
117
+ /** 单个文件大小限制(MB) */
118
+ fileSize: { type: Number, default: 10 },
119
+ /** 文件数量限制 */
120
+ limit: { type: Number, default: 9 },
121
+ /** 是否显示格式/大小提示 */
122
+ isShowTip: { type: Boolean, default: !1 },
123
+ /** 接口路径 */
124
+ api: { type: String, default: "/permission-api/common/uploads" },
125
+ /** FormData 中文件字段名 */
126
+ name: { type: String, default: "file" },
127
+ /** token 读取 key,对应 utils/auth 中的存储字段 */
128
+ tokenKey: { type: String, default: "Admin-Token" },
129
+ /** 是否支持视频模式(强制 limit=1) */
130
+ supportVideo: { type: Boolean, default: !1 },
131
+ /**
132
+ * 卡片尺寸
133
+ * 预设:'large'(160px) | 'default'(140px) | 'small'(80px)
134
+ * 自定义:任意 CSS 单位,如 '60px'、'8vw'
135
+ */
136
+ size: { type: String, default: "default" },
137
+ /** 禁用拖拽(默认在触发区开启) */
138
+ disableDrag: { type: Boolean, default: !1 },
139
+ /** 成功回调(用于复杂业务联动) */
140
+ callBack: { type: Function, default: null },
141
+ /** 上传时附加的额外 FormData 字段 */
142
+ extraData: { type: Object, default: () => ({}) },
143
+ /** 自定义上传请求,用于接入宿主项目 request / 鉴权 / baseURL。 */
144
+ uploadRequest: { type: Function, default: null }
145
+ },
146
+ emits: [
147
+ "update:modelValue",
148
+ "change",
149
+ "success",
150
+ "error",
151
+ "remove"
152
+ ],
153
+ setup(t, { expose: g, emit: b }) {
154
+ const e = t, a = b, A = Q(null), r = Q([]), d = Q(null), f = Q(null), B = [];
155
+ let q = !1;
156
+ const D = Q(!1), I = Q([]), R = Q(0), y = Q(!1), H = Q(""), T = Q(""), N = /* @__PURE__ */ new Set(), L = Q(!1), c = Q(""), x = Q(!1);
157
+ lt(() => {
158
+ e.modelValue === void 0 && $(e.defaultValue);
159
+ });
160
+ const u = F(() => ({ large: "160px", default: "140px", small: "80px" })[e.size] ?? e.size), Z = F(() => e.disabled), _ = F(
161
+ () => {
162
+ var n;
163
+ return e.isShowTip && (e.fileSize || ((n = w.value) == null ? void 0 : n.length));
164
+ }
165
+ ), w = F(() => {
166
+ var n;
167
+ return (n = e.fileType) != null && n.length ? e.fileType.map((s) => s.toLowerCase()) : e.supportVideo ? ["mp4", "mov", "avi"] : ["jpg", "jpeg", "png", "gif", "webp"];
168
+ }), v = F(() => {
169
+ const n = e.supportVideo ? 1 : e.limit;
170
+ return r.value.length >= n;
171
+ }), U = F(
172
+ () => w.value.map((n) => `.${n}`).join(",")
173
+ ), l = F(() => ({
174
+ "qy-upload--reached-limit": v.value,
175
+ "qy-upload--disabled": e.disabled,
176
+ "qy-upload--video": e.supportVideo,
177
+ "qy-upload--without-text": !e.showText && !e.showPasteInput
178
+ }));
179
+ de(c, () => {
180
+ q || ie();
181
+ }), de(
182
+ () => e.modelValue,
183
+ (n) => {
184
+ n !== void 0 && $(n);
185
+ },
186
+ { immediate: !0, deep: !0 }
187
+ );
188
+ function o(n) {
189
+ return Array.isArray(n) ? n.filter(Boolean) : n ? String(n).split(",").filter(Boolean) : [];
190
+ }
191
+ function P(n) {
192
+ return Array.isArray(n) ? { files: n, text: "" } : typeof n == "string" ? { files: o(n), text: "" } : n && typeof n == "object" ? {
193
+ files: o(n.files),
194
+ text: n.text ?? ""
195
+ } : { files: [], text: "" };
196
+ }
197
+ function oe(n = []) {
198
+ return n.map((s, K) => ({
199
+ name: String(s).split("/").pop() || `file-${K}`,
200
+ url: s,
201
+ status: "success",
202
+ uid: Date.now() + K
203
+ }));
204
+ }
205
+ function m(n) {
206
+ const s = new Set(n.map((E) => E.url)), K = r.value.filter(
207
+ (E) => E.status === "uploading" && !s.has(E.url)
208
+ );
209
+ return [...n, ...K];
210
+ }
211
+ function $(n) {
212
+ const s = P(n);
213
+ q = !0, c.value = s.text, r.value = m(oe(s.files)), Le(() => {
214
+ q = !1;
215
+ });
216
+ }
217
+ function j(n) {
218
+ return e.valueFormat === "array" ? n.files : e.valueFormat === "string" ? n.files.join(",") : n;
219
+ }
220
+ function z() {
221
+ var n;
222
+ (n = d.value) == null || n.focus();
223
+ }
224
+ function X(n) {
225
+ n.target.value = "";
226
+ }
227
+ function ie(n) {
228
+ const E = { files: (n ?? r.value).filter((ee) => ee.status === "success" && ee.url).map((ee) => ee.url), text: c.value };
229
+ a("update:modelValue", j(E)), a("change", E), e.callBack && e.callBack(E);
230
+ }
231
+ function ye(n, s) {
232
+ ie(s), a("remove", n, s);
233
+ }
234
+ function we(n) {
235
+ var K;
236
+ const s = (n == null ? void 0 : n.name) || "";
237
+ return s.includes(".") && ((K = s.split(".").pop()) == null ? void 0 : K.toLowerCase()) || "";
238
+ }
239
+ function $e(n) {
240
+ var ee, re, se;
241
+ const s = ((re = (ee = n == null ? void 0 : n.type) == null ? void 0 : ee.toLowerCase) == null ? void 0 : re.call(ee)) || "", K = {
242
+ "image/jpeg": ["jpg", "jpeg"],
243
+ "image/png": ["png"],
244
+ "image/gif": ["gif"],
245
+ "image/bmp": ["bmp"],
246
+ "image/webp": ["webp"],
247
+ "video/mp4": ["mp4"],
248
+ "video/quicktime": ["mov"],
249
+ "video/x-msvideo": ["avi"],
250
+ "video/webm": ["webm"]
251
+ };
252
+ if (K[s]) return K[s];
253
+ const E = (se = s.split("/")[1]) == null ? void 0 : se.split("+")[0];
254
+ return E ? [E] : [];
255
+ }
256
+ function V(n) {
257
+ const s = we(n), K = $e(n);
258
+ return [s, ...K].some(
259
+ (E) => w.value.includes(E)
260
+ );
261
+ }
262
+ function ae(n) {
263
+ return n.size / 1024 / 1024 < e.fileSize ? V(n) ? !0 : (xe.warning(
264
+ `格式不支持,仅允许: ${w.value.join("/")}`
265
+ ), !1) : (xe.warning(`文件大小不能超过${e.fileSize}M`), !1);
266
+ }
267
+ async function i(n, s, K, E) {
268
+ const ee = O(n);
269
+ try {
270
+ const re = await e.uploadRequest({
271
+ file: n,
272
+ formData: ee,
273
+ api: e.api,
274
+ name: e.name,
275
+ tokenKey: e.tokenKey,
276
+ extraData: e.extraData
277
+ }), se = ne(re);
278
+ if (!se) {
279
+ const ke = new Error("上传失败,未返回文件地址");
280
+ xe.error(ke.message), a("error", ke), K == null || K(ke);
281
+ return;
282
+ }
283
+ xe.success("上传成功"), s == null || s({ ...typeof re == "object" && re ? re : {}, url: se });
284
+ } catch (re) {
285
+ xe.error("上传失败"), a("error", re), K == null || K(re);
286
+ } finally {
287
+ E.close();
288
+ }
289
+ }
290
+ function O(n) {
291
+ const s = new FormData();
292
+ return s.append(e.name, n), e.extraData && Object.entries(e.extraData).forEach(([K, E]) => s.append(K, E)), s;
293
+ }
294
+ function ne(n) {
295
+ var E, ee;
296
+ if (typeof n == "string") return n;
297
+ const s = n || {}, K = s.urls ?? s.url ?? ((E = s.data) == null ? void 0 : E.urls) ?? ((ee = s.data) == null ? void 0 : ee.url) ?? "";
298
+ return Array.isArray(K) ? K[0] || "" : K || "";
299
+ }
300
+ function Ce(n, s, K, E) {
301
+ var dt, ct;
302
+ const ee = ((dt = A.value) == null ? void 0 : dt.$el.querySelector(".el-upload--picture-card")) || ((ct = A.value) == null ? void 0 : ct.$el), re = vl.service({
303
+ target: ee,
304
+ text: "上传中",
305
+ background: "rgba(255,255,255,0.7)"
306
+ });
307
+ if (e.uploadRequest) {
308
+ i(n, K, E, re);
309
+ return;
310
+ }
311
+ const se = e.api.startsWith("http") ? e.api : window.location.origin + e.api.replace(/^([^/])/, "/$1"), ke = O(n), Se = new XMLHttpRequest();
312
+ B.push(Se);
313
+ const ze = () => {
314
+ const ge = B.indexOf(Se);
315
+ ge !== -1 && B.splice(ge, 1), re.close();
316
+ };
317
+ Se.open("POST", se);
318
+ const st = Ql(e.tokenKey);
319
+ st && Se.setRequestHeader("Authorization", `Bearer ${st}`), Se.upload.onprogress = (ge) => {
320
+ ge.total > 0 && (s == null || s({ percent: ge.loaded / ge.total * 100 }));
321
+ }, Se.onload = () => {
322
+ if (ze(), Se.status < 200 || Se.status >= 300) {
323
+ const ge = `上传失败 (HTTP ${Se.status})`;
324
+ xe.error(ge), a("error", { msg: ge, status: Se.status }), E == null || E(new Error(ge));
325
+ return;
326
+ }
327
+ try {
328
+ const ge = JSON.parse(Se.responseText);
329
+ ge.code === 200 && ge.urls ? (xe.success("上传成功"), K == null || K({ ...ge, url: ge.urls })) : (xe.error(ge.msg || "上传失败"), a("error", ge), E == null || E(ge));
330
+ } catch {
331
+ xe.error("上传失败,响应格式错误"), a("error", new Error("Response parse error")), E == null || E(new Error("Response parse error"));
332
+ }
333
+ }, Se.onerror = () => {
334
+ ze(), xe.error("上传失败,网络异常"), a("error", new Error("Network error")), E == null || E(new Error("Network error"));
335
+ }, Se.send(ke);
336
+ }
337
+ function Be(n) {
338
+ return e.disabled ? !1 : ae(n);
339
+ }
340
+ function pe(n, s) {
341
+ const K = r.value.find(
342
+ (E) => {
343
+ var ee;
344
+ return E.uid === (n == null ? void 0 : n.uid) || ((ee = E.raw) == null ? void 0 : ee.uid) === (n == null ? void 0 : n.uid);
345
+ }
346
+ );
347
+ K && (K.url = s, K.status = "success");
348
+ }
349
+ function De(n) {
350
+ Ce(
351
+ n.file,
352
+ n.onProgress,
353
+ (s) => {
354
+ pe(n.file, s.url), n.onSuccess(s), ie(), a("success", s);
355
+ },
356
+ (s) => n.onError(s)
357
+ );
358
+ }
359
+ function He(n) {
360
+ var E;
361
+ if (!n.url) return;
362
+ const s = ((E = n.url.split(".").pop()) == null ? void 0 : E.toLowerCase()) || "";
363
+ if (["mp4", "mov", "avi", "webm"].includes(s)) {
364
+ H.value = n.url, T.value = n.name || "视频预览", y.value = !0;
365
+ return;
366
+ }
367
+ const K = r.value.filter(
368
+ (ee) => {
369
+ var re;
370
+ return ee.status === "success" && ee.url && !["mp4", "mov", "avi", "webm"].includes(
371
+ (re = ee.url.split(".").pop()) == null ? void 0 : re.toLowerCase()
372
+ );
373
+ }
374
+ );
375
+ I.value = K.map((ee) => ee.url), R.value = K.findIndex((ee) => ee.uid === n.uid) || 0, D.value = !0;
376
+ }
377
+ function Oe() {
378
+ D.value = !1, I.value = [];
379
+ }
380
+ function Ge(n, s) {
381
+ if (n.name && we(n)) return n;
382
+ const K = $e(n).find(
383
+ (E) => w.value.includes(E)
384
+ );
385
+ return K ? new File([n], `paste-${Date.now() + s}.${K}`, {
386
+ type: n.type,
387
+ lastModified: n.lastModified
388
+ }) : n;
389
+ }
390
+ function We(n) {
391
+ for (let s = 0; s < n.length; s++) {
392
+ const K = Ge(n[s], s);
393
+ if (!Be(K)) continue;
394
+ const E = Date.now() + s, ee = URL.createObjectURL(K);
395
+ N.add(ee), r.value.push({
396
+ uid: E,
397
+ name: K.name || `file-${E}`,
398
+ status: "uploading",
399
+ percentage: 0,
400
+ url: ee
401
+ }), Ce(
402
+ K,
403
+ (re) => {
404
+ const se = r.value.find((ke) => ke.uid === E);
405
+ se && (se.percentage = re.percent);
406
+ },
407
+ (re) => {
408
+ const se = r.value.find((ke) => ke.uid === E);
409
+ se && (se.status = "success", se.url = re.url, ie(), a("success", re));
410
+ },
411
+ () => te(E)
412
+ );
413
+ }
414
+ }
415
+ function Xe(n) {
416
+ const s = Array.from((n == null ? void 0 : n.files) || []).filter(
417
+ (re) => {
418
+ var se;
419
+ return (se = re.type) == null ? void 0 : se.startsWith("image/");
420
+ }
421
+ );
422
+ if (s.length) return s;
423
+ const K = n == null ? void 0 : n.items;
424
+ if (!K) return [];
425
+ const E = [], ee = /* @__PURE__ */ new Set();
426
+ for (let re = 0; re < K.length; re++) {
427
+ const se = K[re];
428
+ if (se.kind === "file" && se.type.startsWith("image/")) {
429
+ const ke = se.getAsFile();
430
+ ke && !ee.has(ke) && (ee.add(ke), E.push(ke));
431
+ }
432
+ }
433
+ return E;
434
+ }
435
+ function Fe(n) {
436
+ if (e.disabled) return;
437
+ const s = Xe(n.clipboardData);
438
+ s.length && (n.preventDefault(), We(s));
439
+ }
440
+ function Re() {
441
+ e.disabled || e.disableDrag || (L.value = !0);
442
+ }
443
+ function p() {
444
+ L.value = !1;
445
+ }
446
+ function h(n) {
447
+ var K;
448
+ if (L.value = !1, e.disabled || e.disableDrag || v.value) return;
449
+ const s = Array.from(((K = n.dataTransfer) == null ? void 0 : K.files) || []).filter(
450
+ (E) => {
451
+ var ee;
452
+ return w.value.includes((ee = E.name.split(".").pop()) == null ? void 0 : ee.toLowerCase());
453
+ }
454
+ );
455
+ s.length && We(s);
456
+ }
457
+ function te(n) {
458
+ var K;
459
+ const s = r.value.findIndex((E) => E.uid === n);
460
+ s !== -1 && ((K = r.value[s].url) != null && K.startsWith("blob:") && (URL.revokeObjectURL(r.value[s].url), N.delete(r.value[s].url)), r.value.splice(s, 1));
461
+ }
462
+ return at(() => {
463
+ B.forEach((n) => n.abort()), B.length = 0, N.forEach((n) => URL.revokeObjectURL(n)), N.clear();
464
+ }), g({
465
+ /** 主动打开文件选择框,供表单或快捷操作调用 */
466
+ openFileDialog: () => {
467
+ var n, s;
468
+ e.disabled || v.value || (s = (n = A.value) == null ? void 0 : n.$el.querySelector('input[type="file"]')) == null || s.click();
469
+ },
470
+ /** 获取已上传成功的文件 URL 列表 */
471
+ getPathList: () => r.value.filter((n) => n.status === "success").map((n) => n.url),
472
+ /** 清空文件和文字,并同步 change 事件 */
473
+ clearFiles: () => {
474
+ r.value = [], c.value = "", ie();
475
+ },
476
+ /** 获取完整值,结构与 change 事件保持一致 */
477
+ getValue: () => ({
478
+ files: r.value.filter((n) => n.status === "success" && n.url).map((n) => n.url),
479
+ text: c.value
480
+ }),
481
+ /** 获取按 valueFormat 输出的值,便于外部不走 v-model 时读取 */
482
+ getModelValue: () => j({
483
+ files: r.value.filter((n) => n.status === "success" && n.url).map((n) => n.url),
484
+ text: c.value
485
+ })
486
+ }), (n, s) => {
487
+ var Se;
488
+ const K = bt, E = rl, ee = ol, re = nl, se = ul, ke = wt;
489
+ return S(), W("div", {
490
+ class: Ve(["qy-upload", l.value]),
491
+ style: Me({ "--qy-upload-size": u.value })
492
+ }, [
493
+ Y(re, {
494
+ ref_key: "uploadRef",
495
+ ref: A,
496
+ "file-list": r.value,
497
+ "onUpdate:fileList": s[6] || (s[6] = (ze) => r.value = ze),
498
+ action: "#",
499
+ multiple: t.supportVideo ? !1 : t.multiple,
500
+ limit: t.supportVideo ? 1 : t.limit,
501
+ "list-type": t.supportVideo ? "text" : "picture-card",
502
+ accept: U.value,
503
+ disabled: Z.value,
504
+ "http-request": De,
505
+ "before-upload": Be,
506
+ "on-preview": He,
507
+ "on-remove": ye
508
+ }, {
509
+ default: k(() => [
510
+ v.value ? J("", !0) : (S(), W("div", {
511
+ key: 0,
512
+ class: Ve(["qy-upload__trigger", { "is-dragover": L.value }]),
513
+ onPaste: Fe,
514
+ onDragover: ce(Re, ["prevent"]),
515
+ onDragleave: ce(p, ["prevent"]),
516
+ onDrop: ce(h, ["prevent"])
517
+ }, [
518
+ Y(K, { class: "qy-upload__icon" }, {
519
+ default: k(() => [
520
+ Y(C(gl))
521
+ ]),
522
+ _: 1
523
+ }),
524
+ t.supportVideo ? (S(), W(Ie, { key: 0 }, [
525
+ s[9] || (s[9] = G("span", { class: "qy-upload__label" }, "点击上传视频", -1)),
526
+ G("span", Ul, "支持 " + he(w.value.join(" / ")) + ",不超过 " + he(t.fileSize) + "MB", 1)
527
+ ], 64)) : J("", !0),
528
+ t.showText ? (S(), W("div", {
529
+ key: 1,
530
+ class: "qy-upload__text",
531
+ onClick: s[3] || (s[3] = ce(() => {
532
+ }, ["stop"])),
533
+ onPaste: ce(Fe, ["stop"])
534
+ }, [
535
+ Y(ee, {
536
+ visible: x.value,
537
+ "onUpdate:visible": s[2] || (s[2] = (ze) => x.value = ze),
538
+ placement: "bottom-start",
539
+ width: 220,
540
+ trigger: "click",
541
+ "popper-class": "qy-upload__text-popover",
542
+ onAfterEnter: z
543
+ }, {
544
+ reference: k(() => [
545
+ G("div", {
546
+ class: Ve(["qy-upload__text-preview", { "is-placeholder": !c.value }])
547
+ }, he(c.value || t.pastePlaceholder), 3)
548
+ ]),
549
+ default: k(() => [
550
+ Y(E, {
551
+ ref_key: "inputRef",
552
+ ref: d,
553
+ modelValue: c.value,
554
+ "onUpdate:modelValue": s[0] || (s[0] = (ze) => c.value = ze),
555
+ type: "textarea",
556
+ autosize: { minRows: 2, maxRows: 5 },
557
+ placeholder: t.pastePlaceholder,
558
+ disabled: t.disabled,
559
+ onBlur: s[1] || (s[1] = (ze) => x.value = !1),
560
+ onPaste: ce(Fe, ["stop"])
561
+ }, null, 8, ["modelValue", "placeholder", "disabled"])
562
+ ]),
563
+ _: 1
564
+ }, 8, ["visible"])
565
+ ], 32)) : t.showPasteInput ? (S(), W("div", {
566
+ key: 2,
567
+ class: "qy-upload__text",
568
+ onClick: s[5] || (s[5] = ce(() => {
569
+ }, ["stop"])),
570
+ onPaste: ce(Fe, ["stop"])
571
+ }, [
572
+ G("input", {
573
+ ref_key: "pasteInputRef",
574
+ ref: f,
575
+ class: "qy-upload__paste-input",
576
+ placeholder: t.pastePlaceholder,
577
+ disabled: t.disabled,
578
+ onPaste: ce(Fe, ["stop"]),
579
+ onInput: X,
580
+ onClick: s[4] || (s[4] = ce(() => {
581
+ }, ["stop"]))
582
+ }, null, 40, Dl)
583
+ ], 32)) : J("", !0)
584
+ ], 34))
585
+ ]),
586
+ _: 1
587
+ }, 8, ["file-list", "multiple", "limit", "list-type", "accept", "disabled"]),
588
+ D.value ? (S(), le(se, {
589
+ key: 0,
590
+ "url-list": I.value,
591
+ "initial-index": R.value,
592
+ onClose: Oe
593
+ }, null, 8, ["url-list", "initial-index"])) : J("", !0),
594
+ Y(ke, {
595
+ modelValue: y.value,
596
+ "onUpdate:modelValue": s[7] || (s[7] = (ze) => y.value = ze),
597
+ title: T.value,
598
+ width: "640px",
599
+ "append-to-body": "",
600
+ "destroy-on-close": "",
601
+ onClose: s[8] || (s[8] = (ze) => y.value = !1)
602
+ }, {
603
+ default: k(() => [
604
+ y.value ? (S(), W("video", {
605
+ key: 0,
606
+ src: H.value,
607
+ controls: "",
608
+ autoplay: "",
609
+ style: { width: "100%", "max-height": "400px", "border-radius": "4px" }
610
+ }, null, 8, Kl)) : J("", !0)
611
+ ]),
612
+ _: 1
613
+ }, 8, ["modelValue", "title"]),
614
+ _.value ? (S(), W("div", El, [
615
+ Y(K, null, {
616
+ default: k(() => [
617
+ Y(C(hl))
618
+ ]),
619
+ _: 1
620
+ }),
621
+ G("span", null, [
622
+ s[12] || (s[12] = ve(" 请上传 ", -1)),
623
+ t.fileSize ? (S(), W(Ie, { key: 0 }, [
624
+ s[10] || (s[10] = ve("大小不超过 ", -1)),
625
+ G("b", Ll, he(t.fileSize) + "MB", 1)
626
+ ], 64)) : J("", !0),
627
+ (Se = w.value) != null && Se.length ? (S(), W(Ie, { key: 1 }, [
628
+ s[11] || (s[11] = ve(",格式为 ", -1)),
629
+ G("b", jl, he(w.value.join("/")), 1)
630
+ ], 64)) : J("", !0),
631
+ s[13] || (s[13] = ve(" 的文件。 ", -1))
632
+ ])
633
+ ])) : J("", !0)
634
+ ], 6);
635
+ };
636
+ }
637
+ }), zt = /* @__PURE__ */ Ae(Nl, [["__scopeId", "data-v-1e380be1"]]), Hl = {
638
+ w: 200,
639
+ h: 200,
640
+ q: 50
641
+ };
642
+ function Ue(t) {
643
+ const g = String(t || "").trim();
644
+ return g ? g.includes("ys.diansan.com") ? g.replace(/^http:\/\//, "https://").replace("ys.diansan.com", "admin.qiyinbz.com") : g : "";
645
+ }
646
+ function Wl(t, g = !0) {
647
+ const b = String(t || "").trim();
648
+ if (!b) return "";
649
+ const e = Ue(b);
650
+ if (!g) return e;
651
+ const a = It(g);
652
+ return b.includes("ys.diansan.com") ? `${e}?small=true&style=image/resize,h_${a.h},w_${a.w}` : `${e}?w=${a.w}`;
653
+ }
654
+ async function Zl(t, g = {}) {
655
+ const b = Ue(t);
656
+ if (!b) throw new Error("图片地址不能为空");
657
+ const e = g.compressor ?? !0;
658
+ if (!e)
659
+ return {
660
+ src: b,
661
+ source: "original"
662
+ };
663
+ const a = Wl(t, e), A = g.loadBlob ?? Xl, r = g.compressBlob ?? Jl;
664
+ try {
665
+ return await A(a), {
666
+ src: a,
667
+ source: "thumbnail"
668
+ };
669
+ } catch {
670
+ const d = await A(b);
671
+ return {
672
+ src: await r(d, It(e)),
673
+ source: "fallback"
674
+ };
675
+ }
676
+ }
677
+ function qt(t = {}) {
678
+ if (typeof document > "u") return { close() {
679
+ } };
680
+ const g = Gl(t.urlList, t.url);
681
+ if (!g.length) return { close() {
682
+ } };
683
+ const b = globalThis.__QY_IMAGE_PREVIEW_CREATE_APP__ ?? sl, e = document.createElement("div"), a = document.body.style.overflow;
684
+ let A = !1, r;
685
+ const d = () => {
686
+ var f;
687
+ A || (A = !0, document.body.style.overflow = a, (f = r == null ? void 0 : r.unmount) == null || f.call(r), e.parentNode && e.parentNode.removeChild(e));
688
+ };
689
+ return document.body.appendChild(e), document.body.style.overflow = "hidden", r = b({
690
+ setup() {
691
+ return () => Ye(xt, {
692
+ urlList: g,
693
+ initialIndex: t.initialIndex ?? 0,
694
+ hideOnClickModal: t.hideOnClickModal ?? !0,
695
+ teleport: "body",
696
+ onClose: d
697
+ });
698
+ }
699
+ }), r.mount(e), { close: d };
700
+ }
701
+ function It(t) {
702
+ return {
703
+ ...Hl,
704
+ ...typeof t == "object" ? t : {}
705
+ };
706
+ }
707
+ function Gl(t, g) {
708
+ return (Array.isArray(t) ? t : [g]).map((e) => Ue(e)).filter(Boolean);
709
+ }
710
+ async function Xl(t) {
711
+ const g = await fetch(t, { redirect: "follow" });
712
+ if (!g.ok) throw new Error(t);
713
+ return g.blob();
714
+ }
715
+ async function Jl(t, g) {
716
+ if (typeof document > "u" || typeof Image > "u")
717
+ return ea(t);
718
+ const b = URL.createObjectURL(t);
719
+ try {
720
+ const e = await Yl(b), a = document.createElement("canvas"), A = _l(e, g);
721
+ return a.width = Math.max(1, Math.round(e.naturalWidth * A)), a.height = Math.max(1, Math.round(e.naturalHeight * A)), a.getContext("2d").drawImage(e, 0, 0, a.width, a.height), a.toDataURL(t.type || "image/jpeg", g.q / 100);
722
+ } finally {
723
+ URL.revokeObjectURL(b);
724
+ }
725
+ }
726
+ function Yl(t) {
727
+ return new Promise((g, b) => {
728
+ const e = new Image();
729
+ e.onload = () => g(e), e.onerror = b, e.src = t;
730
+ });
731
+ }
732
+ function _l(t, g) {
733
+ const b = g.w ? g.w / t.naturalWidth : 1, e = g.h ? g.h / t.naturalHeight : 1;
734
+ return Math.min(1, b, e);
735
+ }
736
+ function ea(t) {
737
+ return new Promise((g, b) => {
738
+ const e = new FileReader();
739
+ e.onloadend = () => g(e.result), e.onerror = b, e.readAsDataURL(t);
740
+ });
741
+ }
742
+ const ta = { class: "qy-image__state qy-image__state--error" }, la = { class: "qy-image__state qy-image__state--empty" }, aa = /* @__PURE__ */ me({
743
+ name: "QyImage",
744
+ __name: "index",
745
+ props: {
746
+ src: { default: "" },
747
+ width: {},
748
+ height: {},
749
+ size: { default: 64 },
750
+ fit: { default: "cover" },
751
+ placeholder: { type: Boolean, default: !0 },
752
+ lazy: { type: Boolean, default: !0 },
753
+ compressor: { type: [Boolean, Object], default: !0 },
754
+ preview: { type: Boolean, default: !1 },
755
+ previewList: { default: () => [] },
756
+ initialIndex: { default: 0 }
757
+ },
758
+ emits: ["load", "error", "fallback", "preview"],
759
+ setup(t, { emit: g }) {
760
+ const b = t, e = g, a = Q(!1), A = Q("");
761
+ let r = 0;
762
+ const d = F(() => Ue(b.src)), f = F(() => ({
763
+ width: b.width ?? b.size,
764
+ height: b.height ?? b.size
765
+ })), B = F(() => ({
766
+ width: N(f.value.width),
767
+ height: N(f.value.height)
768
+ })), q = F(() => b.placeholder || a.value), D = F(() => b.preview && !!d.value), I = F(() => (b.previewList.length ? b.previewList : [b.src]).map((c) => Ue(c)).filter(Boolean));
769
+ de(
770
+ () => [b.src, b.compressor],
771
+ R,
772
+ {
773
+ immediate: !0,
774
+ deep: !0
775
+ }
776
+ );
777
+ async function R() {
778
+ const L = ++r;
779
+ if (A.value = "", a.value = !1, !!b.src)
780
+ try {
781
+ const c = await Zl(b.src, {
782
+ compressor: b.compressor
783
+ });
784
+ if (L !== r) return;
785
+ A.value = c.src, c.source === "fallback" && e("fallback", c.src);
786
+ } catch {
787
+ if (L !== r) return;
788
+ a.value = !1, A.value = d.value;
789
+ }
790
+ }
791
+ function y(L) {
792
+ e("load", L);
793
+ }
794
+ function H(L) {
795
+ a.value = !0, e("error", L);
796
+ }
797
+ function T() {
798
+ D.value && (qt({
799
+ urlList: I.value,
800
+ initialIndex: b.initialIndex
801
+ }), e("preview", d.value));
802
+ }
803
+ function N(L) {
804
+ return typeof L == "number" ? `${L}px` : L;
805
+ }
806
+ return (L, c) => (S(), W("div", {
807
+ class: Ve(["qy-image", { "qy-image--previewable": D.value }]),
808
+ style: Me(B.value),
809
+ onClick: T
810
+ }, [
811
+ A.value && !a.value ? (S(), le(C(bl), {
812
+ key: 0,
813
+ class: "qy-image__inner",
814
+ src: A.value,
815
+ fit: t.fit,
816
+ lazy: t.lazy,
817
+ onLoad: y,
818
+ onError: H
819
+ }, {
820
+ placeholder: k(() => [
821
+ M(L.$slots, "placeholder", {}, () => [
822
+ c[0] || (c[0] = G("div", { class: "qy-image__state" }, [
823
+ G("span", { class: "qy-image__loading" })
824
+ ], -1))
825
+ ], !0)
826
+ ]),
827
+ error: k(() => [
828
+ M(L.$slots, "error", {}, () => [
829
+ G("div", ta, [
830
+ Y(C(pt), { size: 20 }, {
831
+ default: k(() => [
832
+ Y(C(mt))
833
+ ]),
834
+ _: 1
835
+ })
836
+ ])
837
+ ], !0)
838
+ ]),
839
+ _: 3
840
+ }, 8, ["src", "fit", "lazy"])) : q.value ? M(L.$slots, "empty", { key: 1 }, () => [
841
+ G("div", la, [
842
+ Y(C(pt), { size: 20 }, {
843
+ default: k(() => [
844
+ Y(C(mt))
845
+ ]),
846
+ _: 1
847
+ })
848
+ ])
849
+ ], !0) : J("", !0)
850
+ ], 6));
851
+ }
852
+ }), na = /* @__PURE__ */ Ae(aa, [["__scopeId", "data-v-02c4930c"]]), oa = /* @__PURE__ */ me({
853
+ name: "QyImagePreview",
854
+ __name: "index",
855
+ props: {
856
+ open: { type: Boolean, default: !1 },
857
+ urlList: { default: () => [] },
858
+ initialIndex: { default: 0 },
859
+ hideOnClickModal: { type: Boolean, default: !0 }
860
+ },
861
+ emits: ["update:open", "close"],
862
+ setup(t, { emit: g }) {
863
+ const b = t, e = g;
864
+ let a = "";
865
+ const A = F(
866
+ () => b.urlList.map((f) => Ue(f)).filter(Boolean)
867
+ );
868
+ de(
869
+ () => b.open,
870
+ (f) => {
871
+ if (f) {
872
+ a = document.body.style.overflow, document.body.style.overflow = "hidden";
873
+ return;
874
+ }
875
+ d();
876
+ }
877
+ ), at(d);
878
+ function r() {
879
+ d(), e("update:open", !1), e("close");
880
+ }
881
+ function d() {
882
+ typeof document > "u" || (document.body.style.overflow = a);
883
+ }
884
+ return (f, B) => t.open && A.value.length ? (S(), le(C(xt), {
885
+ key: 0,
886
+ "url-list": A.value,
887
+ "initial-index": t.initialIndex,
888
+ "hide-on-click-modal": t.hideOnClickModal,
889
+ teleport: "body",
890
+ onClose: r
891
+ }, null, 8, ["url-list", "initial-index", "hide-on-click-modal"])) : J("", !0);
892
+ }
893
+ }), ra = /* @__PURE__ */ Object.assign({
894
+ name: "QyImageUpload",
895
+ inheritAttrs: !1
896
+ }, {
897
+ __name: "index",
898
+ props: {
899
+ /** 单图/单文件 URL;multiple=true 时为 URL 数组。 */
900
+ modelValue: { type: [String, Array], default: "" },
901
+ /** 上传接口路径。 */
902
+ api: { type: String, default: "/permission-api/common/uploads" },
903
+ /** FormData 中文件字段名。 */
904
+ name: { type: String, default: "files" },
905
+ /** 是否禁用。 */
906
+ disabled: { type: Boolean, default: !1 },
907
+ /** 是否多选;开启后 v-model 输出 string[]。 */
908
+ multiple: { type: Boolean, default: !1 },
909
+ /** 上传模式。voucher 用于承接旧 CopyImgUpload 的凭证图片场景。 */
910
+ mode: { type: String, default: "default" },
911
+ /** 是否启用凭证图片模式。 */
912
+ voucher: { type: Boolean, default: !1 },
913
+ /** 允许的文件类型后缀。 */
914
+ fileType: { type: Array, default: () => [] },
915
+ /** 单个文件大小限制(MB)。 */
916
+ fileSize: { type: Number, default: 10 },
917
+ /** 是否显示格式/大小提示。 */
918
+ isShowTip: { type: Boolean, default: !1 },
919
+ /** 文件数量限制;不传时单图为 1,多图为 9。 */
920
+ limit: { type: Number, default: void 0 },
921
+ /** token 读取 key。 */
922
+ tokenKey: { type: String, default: "Admin-Token" },
923
+ /** 是否为视频上传。 */
924
+ supportVideo: { type: Boolean, default: !1 },
925
+ /** 上传卡片尺寸。 */
926
+ size: { type: String, default: "128px" },
927
+ /** 禁用拖拽。 */
928
+ disableDrag: { type: Boolean, default: !1 },
929
+ /** 是否显示纯粘贴入口。 */
930
+ showPasteInput: { type: Boolean, default: !0 },
931
+ /** 粘贴入口提示文案。 */
932
+ pastePlaceholder: { type: String, default: "粘贴图片上传" },
933
+ /** 成功回调。 */
934
+ callBack: { type: Function, default: null },
935
+ /** 上传时附加的额外 FormData 字段。 */
936
+ extraData: { type: Object, default: () => ({}) },
937
+ /** 自定义上传请求,用于接入宿主项目 request / 鉴权 / baseURL。 */
938
+ uploadRequest: { type: Function, default: null }
939
+ },
940
+ emits: [
941
+ "update:modelValue",
942
+ "change",
943
+ "success",
944
+ "error",
945
+ "remove",
946
+ "updateImg"
947
+ ],
948
+ setup(t, { expose: g, emit: b }) {
949
+ const e = t, a = b, A = be(), r = Q(null), d = ["jpg", "jpeg", "png", "gif", "bmp", "webp"], f = F(
950
+ () => e.voucher || e.mode === "voucher"
951
+ ), B = F(() => Array.isArray(e.modelValue) ? e.modelValue.filter(Boolean) : e.modelValue ? String(e.modelValue).split(",").filter(Boolean) : []), q = F(() => e.supportVideo ? 1 : f.value ? e.limit ?? 30 : e.limit ?? (e.multiple ? 9 : 1)), D = F(() => {
952
+ var l;
953
+ return (l = e.fileType) != null && l.length ? e.fileType : f.value && !e.supportVideo ? d : [];
954
+ });
955
+ function I(l) {
956
+ return Array.isArray(l) ? l.filter(Boolean) : [];
957
+ }
958
+ function R(l) {
959
+ const o = I(l);
960
+ return e.multiple ? o : o[0] || "";
961
+ }
962
+ function y(l) {
963
+ a("update:modelValue", R(l));
964
+ }
965
+ function H(l) {
966
+ a("change", R(l == null ? void 0 : l.files));
967
+ }
968
+ function T(l) {
969
+ var oe, m;
970
+ if (typeof l == "string") return l;
971
+ const o = l || {}, P = o.url ?? o.urls ?? ((oe = o.data) == null ? void 0 : oe.url) ?? ((m = o.data) == null ? void 0 : m.urls) ?? "";
972
+ return Array.isArray(P) ? P[0] || "" : P || "";
973
+ }
974
+ function N(l) {
975
+ const o = T(l);
976
+ o && a("updateImg", o), a("success", U(), l);
977
+ }
978
+ function L(l) {
979
+ a("error", l);
980
+ }
981
+ function c(l, o) {
982
+ a("remove", l, o);
983
+ }
984
+ function x() {
985
+ var l, o;
986
+ (o = (l = r.value) == null ? void 0 : l.openFileDialog) == null || o.call(l);
987
+ }
988
+ function u() {
989
+ var l, o;
990
+ (o = (l = r.value) == null ? void 0 : l.clearFiles) == null || o.call(l);
991
+ }
992
+ function Z() {
993
+ var l, o;
994
+ return ((o = (l = r.value) == null ? void 0 : l.getPathList) == null ? void 0 : o.call(l)) || [];
995
+ }
996
+ const _ = F(() => Z()), w = F(() => Z());
997
+ function v() {
998
+ return Z();
999
+ }
1000
+ function U() {
1001
+ const l = Z();
1002
+ return e.multiple ? l : l[0] || "";
1003
+ }
1004
+ return g({
1005
+ openFileDialog: x,
1006
+ clearFiles: u,
1007
+ getPathList: Z,
1008
+ getFullPathList: v,
1009
+ fullPathList: _,
1010
+ pathList: w,
1011
+ getValue: U
1012
+ }), (l, o) => (S(), le(zt, fe({
1013
+ ref_key: "uploadRef",
1014
+ ref: r
1015
+ }, C(A), {
1016
+ "model-value": B.value,
1017
+ "value-format": "array",
1018
+ api: t.api,
1019
+ name: t.name,
1020
+ multiple: t.multiple,
1021
+ disabled: t.disabled,
1022
+ "file-type": D.value,
1023
+ "file-size": t.fileSize,
1024
+ limit: q.value,
1025
+ "is-show-tip": t.isShowTip,
1026
+ "token-key": t.tokenKey,
1027
+ "support-video": t.supportVideo,
1028
+ size: t.size,
1029
+ "disable-drag": t.disableDrag,
1030
+ "call-back": t.callBack,
1031
+ "extra-data": t.extraData,
1032
+ "upload-request": t.uploadRequest,
1033
+ "show-text": !1,
1034
+ "show-paste-input": t.showPasteInput,
1035
+ "paste-placeholder": t.pastePlaceholder,
1036
+ "onUpdate:modelValue": y,
1037
+ onChange: H,
1038
+ onSuccess: N,
1039
+ onError: L,
1040
+ onRemove: c
1041
+ }), 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", "upload-request", "show-paste-input", "paste-placeholder"]));
1042
+ }
1043
+ }), ua = { class: "text-lg flex items-center pt-2 pl-[var(--content-padding)]" }, ia = { key: 0 }, sa = { key: 1 }, da = {
1044
+ key: 0,
1045
+ class: "icon-[material-symbols--square-outline-rounded]",
1046
+ role: "img",
1047
+ "aria-hidden": "true"
1048
+ }, ca = {
1049
+ key: 1,
1050
+ class: "icon-[tdesign--fullscreen-exit-1]",
1051
+ role: "img",
1052
+ "aria-hidden": "true"
1053
+ }, fa = {
1054
+ key: 0,
1055
+ class: "fixed -right-12 top-2 h-9 w-9 hover:bg-gray-600/80 transition-all"
1056
+ }, ma = { class: "flex justify-between h-[var(--footer-height)] px-[var(--content-padding)] items-center" }, pa = { class: "flex items-center justify-between w-full pl-1 pr-4 h-full ml-2" }, ya = { class: "flex items-center gap-2" }, ga = { class: "text-sm text-gray-700 truncate max-w-[200px]" }, ha = { class: "flex items-center gap-2" }, gt = 5, Je = 2e3, tt = /* @__PURE__ */ me({
1057
+ __name: "index",
1058
+ props: /* @__PURE__ */ ft({
1059
+ layout: { type: [Array, String, Boolean], default: () => ["confirm", "cancel"] },
1060
+ fullscreen: { type: Boolean, default: !1 },
1061
+ showFullscreen: { type: Boolean, default: !1 },
1062
+ confirmProps: { default: () => ({}) },
1063
+ size: { default: "default" },
1064
+ zIndex: { default: 2e3 }
1065
+ }, {
1066
+ modelValue: { default: !0 },
1067
+ modelModifiers: {}
1068
+ }),
1069
+ emits: /* @__PURE__ */ ft(["confirm", "cancel", "close", "opened", "ok"], ["update:modelValue"]),
1070
+ setup(t, { expose: g, emit: b }) {
1071
+ const e = t, a = nt(), A = Q(!0), r = Q(!1), d = Q(Je), f = Q(null), q = Rl({
1072
+ mobile: 0,
1073
+ tablet: 640,
1074
+ laptop: 1024,
1075
+ desktop: 1280
1076
+ }).isSmaller("tablet"), D = F(() => {
1077
+ if (Array.isArray(e.layout)) return e.layout;
1078
+ if (typeof e.layout == "string")
1079
+ return e.layout.split(",").map((z) => z.trim());
1080
+ }), I = F(() => ({
1081
+ CancelButton: Y(m),
1082
+ ConfirmButton: Y(oe)
1083
+ })), R = F(() => a.footer || e.layout !== !1), y = Q(!1), H = Q(
1084
+ e.showFullscreen && q ? !0 : e.fullscreen
1085
+ ), T = b, N = dl(t, "modelValue");
1086
+ cl(() => {
1087
+ N.value && (y.value = !1);
1088
+ }), g({
1089
+ handleMinimize: j
1090
+ });
1091
+ const L = be(), c = `qy-dialog-${Math.random().toString(36).slice(2, 11)}`, x = Q(!1), u = Q(null);
1092
+ window.minimizedCount || (window.minimizedCount = 0);
1093
+ const { x: Z, y: _ } = Tl(u, {
1094
+ initialValue: {
1095
+ x: 5,
1096
+ y: window.innerHeight - 100 - (window.minimizedCount || 0) * 60
1097
+ },
1098
+ onMove(z) {
1099
+ var X;
1100
+ (X = u.value) == null || X.classList.add("dragging"), document.body.classList.add("qy-dialog--dragging"), Z.value = Math.max(
1101
+ 0,
1102
+ Math.min(window.innerWidth - 300, z.x)
1103
+ ), _.value = Math.max(
1104
+ 0,
1105
+ Math.min(window.innerHeight - 50, z.y)
1106
+ );
1107
+ },
1108
+ onEnd() {
1109
+ var z;
1110
+ (z = u.value) == null || z.classList.remove("dragging"), document.body.classList.remove("qy-dialog--dragging");
1111
+ }
1112
+ }), w = F(() => ({
1113
+ transform: `translate(${Z.value}px, ${_.value}px)`,
1114
+ willChange: "transform"
1115
+ }));
1116
+ function v(z) {
1117
+ const X = z.target, { scrollTop: ie, scrollHeight: ye, clientHeight: we } = X;
1118
+ A.value = ie <= gt, r.value = ye - (ie + we) <= gt;
1119
+ }
1120
+ function U() {
1121
+ const z = document.querySelector(`.${c}.el-dialog`);
1122
+ z && (f.value = z, z.addEventListener("scroll", v)), $(), T("opened");
1123
+ }
1124
+ function l() {
1125
+ H.value = !H.value, $();
1126
+ }
1127
+ function o() {
1128
+ y.value || (y.value = !0, x.value = !1, N.value = !1, T("cancel"), T("close"));
1129
+ }
1130
+ function P(z) {
1131
+ e.showFullscreen && z.detail >= 2 && l();
1132
+ }
1133
+ function oe() {
1134
+ return Ye(
1135
+ qe,
1136
+ {
1137
+ ...C(e.confirmProps),
1138
+ type: "primary",
1139
+ class: "dialog__footerBtn",
1140
+ onClick: () => {
1141
+ T("confirm"), T("ok");
1142
+ }
1143
+ },
1144
+ () => C(e.confirmProps).title || "确 认"
1145
+ );
1146
+ }
1147
+ function m() {
1148
+ return Ye(
1149
+ qe,
1150
+ { class: "dialog__footerBtn", onClick: () => o() },
1151
+ () => "取 消"
1152
+ );
1153
+ }
1154
+ lt(() => {
1155
+ typeof window.qyDialogMaxZIndex > "u" && (window.qyDialogMaxZIndex = Je), $();
1156
+ });
1157
+ function $() {
1158
+ var V;
1159
+ const z = Array.from(
1160
+ document.querySelectorAll(".el-overlay")
1161
+ ).filter((ae) => window.getComputedStyle(ae).display !== "none" && !ae.classList.contains("is-message")), X = (V = document.querySelector(`.${c}`)) == null ? void 0 : V.closest(".el-overlay"), ie = document.querySelector(
1162
+ `.${c}.el-dialog`
1163
+ );
1164
+ if (!X || !ie) return;
1165
+ const ye = Je;
1166
+ window.qyDialogMaxZIndex = window.qyDialogMaxZIndex || ye;
1167
+ const $e = Math.max(
1168
+ window.qyDialogMaxZIndex,
1169
+ ...z.map(
1170
+ (ae) => parseInt(window.getComputedStyle(ae).zIndex || ye.toString())
1171
+ )
1172
+ ) + 2;
1173
+ window.qyDialogMaxZIndex = $e, Le(() => {
1174
+ X.style.zIndex = $e.toString(), ie.style.zIndex = ($e + 1).toString(), d.value = $e + 1;
1175
+ });
1176
+ }
1177
+ kt(() => {
1178
+ var z;
1179
+ (z = f.value) == null || z.removeEventListener("scroll", v), x.value && window.minimizedCount--;
1180
+ });
1181
+ function j() {
1182
+ var X;
1183
+ x.value = !x.value;
1184
+ const z = (X = document.querySelector(`.${c}`)) == null ? void 0 : X.closest(".el-overlay");
1185
+ z && (x.value ? (z.style.display = "none", window.minimizedCount++, _.value = window.innerHeight - 50 - (window.minimizedCount || 0) * 60) : (z.style.display = "block", window.minimizedCount--, $()));
1186
+ }
1187
+ return (z, X) => {
1188
+ const ie = fl("Close"), ye = bt, we = wt;
1189
+ return S(), W("div", null, [
1190
+ Y(we, fe({
1191
+ ref: "dialogRef",
1192
+ class: ["qy-dialog", [
1193
+ e.size === "small" && "[&_.el-dialog__header]:!hidden",
1194
+ c
1195
+ ]],
1196
+ "model-value": N.value,
1197
+ "align-center": "",
1198
+ "append-to-body": "",
1199
+ style: {
1200
+ "--el-dialog-padding-primary": 0
1201
+ },
1202
+ "show-close": !1,
1203
+ fullscreen: H.value,
1204
+ "z-index": d.value,
1205
+ onClosed: o,
1206
+ onOpened: U,
1207
+ draggable: ""
1208
+ }, C(L)), Pe({
1209
+ header: k(() => [
1210
+ e.size === "default" ? (S(), W("div", {
1211
+ key: 0,
1212
+ style: Me({
1213
+ borderBottom: "1px solid",
1214
+ borderColor: A.value ? "transparent" : "var(--block-outline-color)",
1215
+ transition: "border-color .2s linear"
1216
+ }),
1217
+ class: "flex justify-between h-[var(--header-height)]",
1218
+ onDblclick: P
1219
+ }, [
1220
+ G("div", ua, [
1221
+ C(a).header ? C(a).header ? (S(), W("div", sa, [
1222
+ M(z.$slots, "header")
1223
+ ])) : J("", !0) : (S(), W("span", ia, he(C(L).title), 1))
1224
+ ]),
1225
+ G("div", {
1226
+ class: "flex",
1227
+ onMousedown: X[3] || (X[3] = ce(() => {
1228
+ }, ["stop"]))
1229
+ }, [
1230
+ e.size === "default" ? (S(), W("div", {
1231
+ key: 0,
1232
+ class: "qy-dialog__btn qy-dialog__btn--default",
1233
+ onClick: ce(j, ["stop"]),
1234
+ onMousedown: X[0] || (X[0] = ce(() => {
1235
+ }, ["stop"]))
1236
+ }, [...X[4] || (X[4] = [
1237
+ G("span", {
1238
+ class: "icon-[material-symbols--minimize] text-xl mb-3",
1239
+ role: "img",
1240
+ "aria-hidden": "true"
1241
+ }, null, -1)
1242
+ ])], 32)) : J("", !0),
1243
+ e.showFullscreen ? (S(), W("div", {
1244
+ key: 1,
1245
+ class: "qy-dialog__btn qy-dialog__btn--default",
1246
+ onClick: ce(l, ["stop"]),
1247
+ onMousedown: X[1] || (X[1] = ce(() => {
1248
+ }, ["stop"]))
1249
+ }, [
1250
+ H.value ? (S(), W("span", ca)) : (S(), W("span", da))
1251
+ ], 32)) : J("", !0),
1252
+ G("div", {
1253
+ class: "qy-dialog__btn qy-dialog__btn--danger",
1254
+ onClick: ce(o, ["stop"]),
1255
+ onMousedown: X[2] || (X[2] = ce(() => {
1256
+ }, ["stop"]))
1257
+ }, [...X[5] || (X[5] = [
1258
+ G("span", {
1259
+ class: "icon-[ri--close-line] text-xl",
1260
+ role: "img",
1261
+ "aria-hidden": "true"
1262
+ }, null, -1)
1263
+ ])], 32)
1264
+ ], 32)
1265
+ ], 36)) : J("", !0)
1266
+ ]),
1267
+ default: k(() => [
1268
+ G("div", {
1269
+ class: Ve(["qy-dialog__wrapper", C(Al)(H.value && "qy-dialog__wrapper--fullscreen")]),
1270
+ style: Me({
1271
+ maxHeight: R.value ? "calc(100vh - var(--header-height) - var(--footer-height) - var(--sides-gap))" : "calc(100vh - var(--header-height) - var(--sides-gap))",
1272
+ padding: e.size === "small" ? "var(--small-content-padding)" : "var(--content-padding)"
1273
+ })
1274
+ }, [
1275
+ e.size === "small" ? (S(), W("div", fa, [
1276
+ Y(ye, {
1277
+ size: 36,
1278
+ class: "cursor-pointer text-gray-100 active:scale-75 rounded-sm transition-all",
1279
+ onClick: o
1280
+ }, {
1281
+ default: k(() => [
1282
+ Y(ie)
1283
+ ]),
1284
+ _: 1
1285
+ })
1286
+ ])) : J("", !0),
1287
+ M(z.$slots, "default")
1288
+ ], 6)
1289
+ ]),
1290
+ _: 2
1291
+ }, [
1292
+ !z.$slots.footer && Array.isArray(D.value) ? {
1293
+ name: "footer",
1294
+ fn: k(() => [
1295
+ G("div", ma, [
1296
+ G("div", null, [
1297
+ M(z.$slots, "footer-left")
1298
+ ]),
1299
+ G("div", {
1300
+ class: Ve([{
1301
+ "qy-dialog__footer--outline": r.value
1302
+ }, "qy-dialog__footer flex items-center justify-end"])
1303
+ }, [
1304
+ D.value.includes("cancel") ? (S(), le(m, { key: 0 })) : J("", !0),
1305
+ D.value.includes("confirm") ? (S(), le(oe, { key: 1 })) : J("", !0),
1306
+ M(z.$slots, "footer-append")
1307
+ ], 2)
1308
+ ])
1309
+ ]),
1310
+ key: "0"
1311
+ } : R.value ? {
1312
+ name: "footer",
1313
+ fn: k(() => [
1314
+ G("div", {
1315
+ class: Ve([{
1316
+ "qy-dialog__footer--outline": r.value
1317
+ }, "qy-dialog__footer px-[var(--content-padding)] min-h-[var(--footer-height)] flex items-center justify-end"])
1318
+ }, [
1319
+ M(z.$slots, "footer", {
1320
+ layouts: I.value,
1321
+ layoutsNode: Object.values(I.value)
1322
+ })
1323
+ ], 2)
1324
+ ]),
1325
+ key: "1"
1326
+ } : void 0
1327
+ ]), 1040, ["class", "model-value", "fullscreen", "z-index"]),
1328
+ ot(G("div", {
1329
+ ref_key: "minimizedRef",
1330
+ ref: u,
1331
+ class: "fixed left-0 top-0 bg-white rounded shadow-lg cursor-pointer z-[9999] hover:bg-gray-50",
1332
+ style: Me([w.value, { width: "300px", height: "50px", "will-change": "transform" }])
1333
+ }, [
1334
+ G("div", pa, [
1335
+ G("div", ya, [
1336
+ X[6] || (X[6] = G("div", { class: "icon-[mdi--window-restore] text-gray-600" }, null, -1)),
1337
+ G("span", ga, he(C(L).title), 1)
1338
+ ]),
1339
+ G("div", ha, [
1340
+ G("div", {
1341
+ class: "p-1 hover:bg-gray-200 rounded",
1342
+ onClick: ce(j, ["stop"])
1343
+ }, [...X[7] || (X[7] = [
1344
+ G("div", { class: "icon-[mdi--window-maximize] text-gray-600" }, null, -1)
1345
+ ])]),
1346
+ G("div", {
1347
+ class: "p-1 hover:bg-red-100 rounded",
1348
+ onClick: ce(o, ["stop"])
1349
+ }, [...X[8] || (X[8] = [
1350
+ G("div", { class: "icon-[mdi--close] text-red-600" }, null, -1)
1351
+ ])])
1352
+ ])
1353
+ ])
1354
+ ], 4), [
1355
+ [St, x.value]
1356
+ ])
1357
+ ]);
1358
+ };
1359
+ }
1360
+ });
1361
+ function ht(t) {
1362
+ const g = t == null ? void 0 : t.match(/(\[url\:(.*?)\])(.*)/);
1363
+ return g ? {
1364
+ imageUrl: g[2],
1365
+ text: g[3]
1366
+ } : {
1367
+ imageUrl: "",
1368
+ text: t || ""
1369
+ };
1370
+ }
1371
+ function va(t) {
1372
+ const g = String(t || "").match(/(\[url\:.*?\])([\s\S]*)/);
1373
+ return g ? g[2] : t;
1374
+ }
1375
+ function vt(t, g) {
1376
+ return g ? `[url:${g}]${t}` : t;
1377
+ }
1378
+ const ba = { class: "qy-remark-image__field" }, wa = {
1379
+ key: 1,
1380
+ class: "qy-remark-image__divider"
1381
+ }, ka = { class: "qy-remark-image__upload-anchor" }, Sa = {
1382
+ key: 0,
1383
+ class: "icon-[line-md--loading-twotone-loop]",
1384
+ role: "img",
1385
+ "aria-hidden": "true"
1386
+ }, xa = {
1387
+ key: 1,
1388
+ class: "icon-[ion--cloud-upload-outline]",
1389
+ role: "img",
1390
+ "aria-hidden": "true"
1391
+ }, Va = {
1392
+ key: 2,
1393
+ class: "icon-[ph--images-thin]",
1394
+ role: "img",
1395
+ "aria-hidden": "true"
1396
+ }, Ca = { class: "qy-remark-image__popover" }, $a = ["src"], Ba = { class: "qy-remark-image__popover-footer" }, za = /* @__PURE__ */ me({
1397
+ __name: "index",
1398
+ props: {
1399
+ defaultValue: { default: "" },
1400
+ defaultImage: { default: "" },
1401
+ rows: { default: 6 },
1402
+ width: { default: "" },
1403
+ autosize: { type: [Boolean, Object], default: !1 },
1404
+ disabled: { type: Boolean, default: !1 },
1405
+ placeholder: { default: "粘贴图片上传" },
1406
+ type: { default: "textarea" },
1407
+ layout: { default: "default" },
1408
+ selectValue: { type: [String, Number, Boolean], default: "" },
1409
+ selectOptions: { default: () => [] },
1410
+ selectDisabled: { type: Boolean, default: !1 },
1411
+ api: { default: "/permission-api/common/uploads" },
1412
+ tokenKey: { default: "Admin-Token" },
1413
+ uploadName: { default: "files" },
1414
+ uploadRequest: {}
1415
+ },
1416
+ emits: ["change", "update:selectValue", "select-change"],
1417
+ setup(t, { expose: g, emit: b }) {
1418
+ const e = t, a = b, A = be(), r = Q(null), d = Q(""), f = Q(""), B = Q(!1), q = F(
1419
+ () => e.layout === "select-prefix"
1420
+ ), D = F(() => ({
1421
+ "qy-remark-image--select-prefix": q.value
1422
+ })), I = F(
1423
+ () => q.value || e.type === "text" ? "text" : "textarea"
1424
+ ), R = F(() => {
1425
+ if (e.width)
1426
+ return {
1427
+ width: typeof e.width == "number" ? `${e.width}px` : e.width
1428
+ };
1429
+ });
1430
+ de(
1431
+ () => e.defaultValue,
1432
+ (v) => {
1433
+ const U = ht(v || "");
1434
+ d.value = U.text, f.value = U.imageUrl || e.defaultImage || "";
1435
+ },
1436
+ { immediate: !0 }
1437
+ ), de(
1438
+ () => e.defaultImage,
1439
+ (v) => {
1440
+ v !== void 0 && !ht(e.defaultValue || "").imageUrl && (f.value = v || "");
1441
+ },
1442
+ { immediate: !0 }
1443
+ ), lt(() => {
1444
+ Le(H);
1445
+ }), kt(() => {
1446
+ const v = y();
1447
+ v && v.removeEventListener("paste", x);
1448
+ });
1449
+ function y() {
1450
+ var v, U;
1451
+ return ((v = r.value) == null ? void 0 : v.textarea) || ((U = r.value) == null ? void 0 : U.input) || null;
1452
+ }
1453
+ function H() {
1454
+ const v = y();
1455
+ v && (v.removeEventListener("paste", x), v.addEventListener("paste", x));
1456
+ }
1457
+ function T(v) {
1458
+ d.value = va(v || "");
1459
+ }
1460
+ function N(v) {
1461
+ a("update:selectValue", v), a("select-change", v);
1462
+ }
1463
+ function L() {
1464
+ f.value = "", w();
1465
+ }
1466
+ function c() {
1467
+ d.value = "", f.value = "", w();
1468
+ }
1469
+ async function x(v) {
1470
+ var o;
1471
+ const l = Array.from(((o = v.clipboardData) == null ? void 0 : o.files) || []).find((P) => P.type.startsWith("image/"));
1472
+ l && (v.preventDefault(), await u({
1473
+ file: l,
1474
+ onError: () => {
1475
+ },
1476
+ onProgress: () => {
1477
+ },
1478
+ onSuccess: () => {
1479
+ }
1480
+ }));
1481
+ }
1482
+ async function u(v) {
1483
+ var U, l;
1484
+ if (v.file.size > 51200 * 1e3)
1485
+ return xe.error("图片过大"), !1;
1486
+ B.value = !0;
1487
+ try {
1488
+ const o = await Z(v);
1489
+ return f.value = _(o), w(), xe.success("上传图片成功"), (U = v.onSuccess) == null || U.call(v, o), !0;
1490
+ } catch (o) {
1491
+ return (l = v.onError) == null || l.call(v, o), xe.error("上传失败"), !1;
1492
+ } finally {
1493
+ B.value = !1;
1494
+ }
1495
+ }
1496
+ async function Z(v) {
1497
+ const U = new FormData();
1498
+ if (U.append(e.uploadName, v.file), e.uploadRequest)
1499
+ return e.uploadRequest({
1500
+ file: v.file,
1501
+ formData: U,
1502
+ options: v,
1503
+ api: e.api,
1504
+ tokenKey: e.tokenKey
1505
+ });
1506
+ const l = Bt.get(e.tokenKey);
1507
+ return (await fetch(e.api, {
1508
+ method: "POST",
1509
+ body: U,
1510
+ credentials: "include",
1511
+ headers: l ? { Authorization: `Bearer ${l}` } : void 0
1512
+ })).json();
1513
+ }
1514
+ function _(v) {
1515
+ var o, P;
1516
+ if (typeof v == "string") return v;
1517
+ const U = v, l = (U == null ? void 0 : U.urls) ?? ((o = U == null ? void 0 : U.data) == null ? void 0 : o.urls) ?? ((P = U == null ? void 0 : U.data) == null ? void 0 : P.url) ?? (U == null ? void 0 : U.url) ?? "";
1518
+ return Array.isArray(l) ? l[0] || "" : l || "";
1519
+ }
1520
+ function w() {
1521
+ a(
1522
+ "change",
1523
+ vt(d.value || "", f.value || ""),
1524
+ f.value || ""
1525
+ );
1526
+ }
1527
+ return g({
1528
+ deleteImage: L,
1529
+ // 兼容旧 remarkImage,在表单 reset/clearFrom 时清空文字和图片。
1530
+ clearContent: c,
1531
+ // 给表单保存或外部调试读取当前拆分值。
1532
+ getValue: () => ({
1533
+ text: d.value || "",
1534
+ imageUrl: f.value || "",
1535
+ value: vt(d.value || "", f.value || "")
1536
+ })
1537
+ }), (v, U) => (S(), W("div", {
1538
+ class: Ve(["qy-remark-image", D.value]),
1539
+ style: Me(R.value)
1540
+ }, [
1541
+ G("div", ba, [
1542
+ q.value ? (S(), le(C(rt), {
1543
+ key: 0,
1544
+ class: "qy-remark-image__prefix-select",
1545
+ "model-value": t.selectValue,
1546
+ options: t.selectOptions,
1547
+ disabled: t.disabled || t.selectDisabled,
1548
+ size: "small",
1549
+ "onUpdate:modelValue": N
1550
+ }, {
1551
+ default: k(() => [
1552
+ (S(!0), W(Ie, null, je(t.selectOptions, (l) => (S(), le(C(ut), {
1553
+ key: String(l.value),
1554
+ label: l.label,
1555
+ value: l.value,
1556
+ disabled: l.disabled
1557
+ }, null, 8, ["label", "value", "disabled"]))), 128))
1558
+ ]),
1559
+ _: 1
1560
+ }, 8, ["model-value", "options", "disabled"])) : J("", !0),
1561
+ q.value ? (S(), W("span", wa)) : J("", !0),
1562
+ Y(C(Qe), fe({
1563
+ ref_key: "inputRef",
1564
+ ref: r,
1565
+ "model-value": d.value,
1566
+ type: I.value,
1567
+ rows: t.rows,
1568
+ autosize: t.autosize,
1569
+ disabled: t.disabled,
1570
+ placeholder: t.placeholder
1571
+ }, C(A), {
1572
+ "onUpdate:modelValue": T,
1573
+ onBlur: w
1574
+ }), null, 16, ["model-value", "type", "rows", "autosize", "disabled", "placeholder"]),
1575
+ Y(C(wl), {
1576
+ placement: "top-start",
1577
+ width: 400,
1578
+ trigger: "hover",
1579
+ disabled: !f.value
1580
+ }, {
1581
+ reference: k(() => [
1582
+ G("div", ka, [
1583
+ Y(C(kl), {
1584
+ disabled: B.value || t.disabled,
1585
+ class: "qy-remark-image__upload",
1586
+ "show-file-list": !1,
1587
+ "http-request": u
1588
+ }, {
1589
+ default: k(() => [
1590
+ B.value ? (S(), W("span", Sa)) : f.value ? (S(), W("span", Va)) : (S(), W("span", xa))
1591
+ ]),
1592
+ _: 1
1593
+ }, 8, ["disabled"])
1594
+ ])
1595
+ ]),
1596
+ default: k(() => [
1597
+ G("div", Ca, [
1598
+ G("img", {
1599
+ src: f.value,
1600
+ class: "qy-remark-image__preview-img"
1601
+ }, null, 8, $a),
1602
+ G("div", Ba, [
1603
+ U[1] || (U[1] = G("span", { class: "qy-remark-image__popover-tip" }, "再次点击按钮可更换图片", -1)),
1604
+ Y(C(qe), {
1605
+ link: "",
1606
+ size: "small",
1607
+ type: "danger",
1608
+ disabled: t.disabled,
1609
+ onClick: L
1610
+ }, {
1611
+ default: k(() => [...U[0] || (U[0] = [
1612
+ ve(" 删除图片 ", -1)
1613
+ ])]),
1614
+ _: 1
1615
+ }, 8, ["disabled"])
1616
+ ])
1617
+ ])
1618
+ ]),
1619
+ _: 1
1620
+ }, 8, ["disabled"])
1621
+ ])
1622
+ ], 6));
1623
+ }
1624
+ }), qa = /* @__PURE__ */ Ae(za, [["__scopeId", "data-v-3158c066"]]), Ia = /* @__PURE__ */ me({
1625
+ name: "QyInput",
1626
+ inheritAttrs: !1,
1627
+ __name: "index",
1628
+ props: {
1629
+ modelValue: { default: "" },
1630
+ removeSpace: { type: Boolean, default: !1 },
1631
+ trimMode: { default: "none" }
1632
+ },
1633
+ emits: ["update:modelValue", "input", "change", "focus", "blur", "clear", "enter"],
1634
+ setup(t, { expose: g, emit: b }) {
1635
+ const e = t, a = b, A = be(), r = Q(null), d = Q(B(e.modelValue)), f = F(() => B(e.modelValue));
1636
+ de(
1637
+ () => e.modelValue,
1638
+ (o) => {
1639
+ d.value = B(o);
1640
+ }
1641
+ );
1642
+ function B(o) {
1643
+ return o == null ? "" : String(o);
1644
+ }
1645
+ function q(o) {
1646
+ return e.removeSpace ? o.replace(/\s+/g, "") : o;
1647
+ }
1648
+ function D(o, P) {
1649
+ return e.trimMode !== P ? o : o.trim();
1650
+ }
1651
+ function I(o) {
1652
+ return q(B(o));
1653
+ }
1654
+ function R(o) {
1655
+ d.value = o, a("update:modelValue", o);
1656
+ }
1657
+ function y(o) {
1658
+ const P = I(o);
1659
+ R(P);
1660
+ }
1661
+ function H(o) {
1662
+ d.value = B(o), a("input", B(o));
1663
+ }
1664
+ function T(o) {
1665
+ const P = D(I(o), "change");
1666
+ P !== B(e.modelValue) && R(P), a("change", P);
1667
+ }
1668
+ function N(o) {
1669
+ a("focus", o);
1670
+ }
1671
+ function L(o) {
1672
+ const P = D(d.value, "blur");
1673
+ P !== B(e.modelValue) && R(P), a("blur", o);
1674
+ }
1675
+ function c() {
1676
+ d.value = "", a("update:modelValue", ""), a("clear");
1677
+ }
1678
+ function x(o) {
1679
+ a("enter", o);
1680
+ }
1681
+ function u() {
1682
+ var o, P;
1683
+ (P = (o = r.value) == null ? void 0 : o.focus) == null || P.call(o);
1684
+ }
1685
+ function Z() {
1686
+ var o, P;
1687
+ (P = (o = r.value) == null ? void 0 : o.blur) == null || P.call(o);
1688
+ }
1689
+ function _() {
1690
+ var o, P;
1691
+ (P = (o = r.value) == null ? void 0 : o.select) == null || P.call(o);
1692
+ }
1693
+ function w() {
1694
+ var o, P;
1695
+ (P = (o = r.value) == null ? void 0 : o.clear) == null || P.call(o);
1696
+ }
1697
+ function v() {
1698
+ var o, P;
1699
+ (P = (o = r.value) == null ? void 0 : o.resizeTextarea) == null || P.call(o);
1700
+ }
1701
+ function U() {
1702
+ var o;
1703
+ return ((o = r.value) == null ? void 0 : o.input) || null;
1704
+ }
1705
+ function l() {
1706
+ var o;
1707
+ return ((o = r.value) == null ? void 0 : o.textarea) || null;
1708
+ }
1709
+ return g({
1710
+ // 暴露 Element Plus 常用输入框方法,方便业务弹窗做聚焦、选中和 textarea 重算高度。
1711
+ focus: u,
1712
+ blur: Z,
1713
+ select: _,
1714
+ clear: w,
1715
+ resizeTextarea: v,
1716
+ getNativeInput: U,
1717
+ getTextarea: l
1718
+ }), (o, P) => (S(), le(C(Qe), fe({
1719
+ ref_key: "inputRef",
1720
+ ref: r
1721
+ }, C(A), {
1722
+ "model-value": f.value,
1723
+ "onUpdate:modelValue": y,
1724
+ onInput: H,
1725
+ onChange: T,
1726
+ onFocus: N,
1727
+ onBlur: L,
1728
+ onClear: c,
1729
+ onKeydown: Ne(x, ["enter"])
1730
+ }), Pe({ _: 2 }, [
1731
+ o.$slots.prefix ? {
1732
+ name: "prefix",
1733
+ fn: k(() => [
1734
+ M(o.$slots, "prefix")
1735
+ ]),
1736
+ key: "0"
1737
+ } : void 0,
1738
+ o.$slots.suffix ? {
1739
+ name: "suffix",
1740
+ fn: k(() => [
1741
+ M(o.$slots, "suffix")
1742
+ ]),
1743
+ key: "1"
1744
+ } : void 0,
1745
+ o.$slots.prepend ? {
1746
+ name: "prepend",
1747
+ fn: k(() => [
1748
+ M(o.$slots, "prepend")
1749
+ ]),
1750
+ key: "2"
1751
+ } : void 0,
1752
+ o.$slots.append ? {
1753
+ name: "append",
1754
+ fn: k(() => [
1755
+ M(o.$slots, "append")
1756
+ ]),
1757
+ key: "3"
1758
+ } : void 0
1759
+ ]), 1040, ["model-value"]));
1760
+ }
1761
+ }), Aa = /* @__PURE__ */ me({
1762
+ name: "QyInputNumber",
1763
+ inheritAttrs: !1,
1764
+ __name: "index",
1765
+ props: {
1766
+ modelValue: { default: void 0 },
1767
+ min: { default: void 0 },
1768
+ max: { default: void 0 },
1769
+ step: { default: 1 },
1770
+ stepStrictly: { type: Boolean, default: !1 },
1771
+ precision: { default: void 0 },
1772
+ controls: { type: Boolean, default: !0 },
1773
+ controlsPosition: { default: "" },
1774
+ placeholder: { default: "请输入数字" },
1775
+ disabled: { type: Boolean, default: !1 },
1776
+ size: { default: void 0 }
1777
+ },
1778
+ emits: ["update:modelValue", "change", "focus", "blur"],
1779
+ setup(t, { expose: g, emit: b }) {
1780
+ const e = b, a = be(), A = Q(null);
1781
+ function r(I) {
1782
+ e("update:modelValue", I);
1783
+ }
1784
+ function d(I, R) {
1785
+ e("change", I, R);
1786
+ }
1787
+ function f(I) {
1788
+ e("focus", I);
1789
+ }
1790
+ function B(I) {
1791
+ e("blur", I);
1792
+ }
1793
+ function q() {
1794
+ var I, R;
1795
+ (R = (I = A.value) == null ? void 0 : I.focus) == null || R.call(I);
1796
+ }
1797
+ function D() {
1798
+ var I, R;
1799
+ (R = (I = A.value) == null ? void 0 : I.blur) == null || R.call(I);
1800
+ }
1801
+ return g({
1802
+ focus: q,
1803
+ blur: D
1804
+ }), (I, R) => (S(), le(C(Sl), fe({
1805
+ ref_key: "inputNumberRef",
1806
+ ref: A
1807
+ }, C(a), {
1808
+ "model-value": t.modelValue,
1809
+ min: t.min,
1810
+ max: t.max,
1811
+ step: t.step,
1812
+ "step-strictly": t.stepStrictly,
1813
+ precision: t.precision,
1814
+ controls: t.controls,
1815
+ "controls-position": t.controlsPosition,
1816
+ placeholder: t.placeholder,
1817
+ disabled: t.disabled,
1818
+ size: t.size,
1819
+ "onUpdate:modelValue": r,
1820
+ onChange: d,
1821
+ onFocus: f,
1822
+ onBlur: B
1823
+ }), null, 16, ["model-value", "min", "max", "step", "step-strictly", "precision", "controls", "controls-position", "placeholder", "disabled", "size"]));
1824
+ }
1825
+ }), Ra = /* @__PURE__ */ me({
1826
+ name: "QyMoneyInput",
1827
+ inheritAttrs: !1,
1828
+ __name: "index",
1829
+ props: {
1830
+ modelValue: { default: "" },
1831
+ precision: { default: 2 },
1832
+ min: { default: void 0 },
1833
+ max: { default: void 0 },
1834
+ allowNegative: { type: Boolean, default: !1 },
1835
+ formatTrigger: { default: "blur" },
1836
+ emptyValue: { default: "" }
1837
+ },
1838
+ emits: ["update:modelValue", "input", "change", "focus", "blur", "clear", "enter"],
1839
+ setup(t, { expose: g, emit: b }) {
1840
+ const e = t, a = b, A = be(), r = Q(null), d = Q(B(e.modelValue)), f = F(() => B(e.modelValue));
1841
+ de(
1842
+ () => e.modelValue,
1843
+ (l) => {
1844
+ d.value = B(l);
1845
+ }
1846
+ );
1847
+ function B(l) {
1848
+ return l == null ? "" : String(l);
1849
+ }
1850
+ function q(l) {
1851
+ return Number.isFinite(l) ? Math.max(0, Math.floor(l)) : 2;
1852
+ }
1853
+ function D(l) {
1854
+ const o = B(l);
1855
+ let P = "", oe = !1, m = !1;
1856
+ const $ = q(e.precision);
1857
+ for (let j = 0; j < o.length; j += 1) {
1858
+ const z = o[j];
1859
+ if (z >= "0" && z <= "9") {
1860
+ P += z;
1861
+ continue;
1862
+ }
1863
+ if (z === "." && $ > 0 && !oe) {
1864
+ P += z, oe = !0;
1865
+ continue;
1866
+ }
1867
+ z === "-" && e.allowNegative && j === 0 && !m && (P += z, m = !0);
1868
+ }
1869
+ if ($ > 0 && oe) {
1870
+ const [j, z = ""] = P.split(".");
1871
+ return `${j}.${z.slice(0, $)}`;
1872
+ }
1873
+ return P;
1874
+ }
1875
+ function I(l) {
1876
+ let o = l;
1877
+ return typeof e.min == "number" && Number.isFinite(e.min) && (o = Math.max(o, e.min)), typeof e.max == "number" && Number.isFinite(e.max) && (o = Math.min(o, e.max)), o;
1878
+ }
1879
+ function R(l) {
1880
+ const o = D(l);
1881
+ if (!o || o === "-" || o === ".")
1882
+ return B(e.emptyValue);
1883
+ const P = Number(o);
1884
+ if (Number.isNaN(P)) return B(e.emptyValue);
1885
+ const oe = q(e.precision);
1886
+ return I(P).toFixed(oe);
1887
+ }
1888
+ function y(l) {
1889
+ d.value = l, a("update:modelValue", l);
1890
+ }
1891
+ function H(l) {
1892
+ const o = D(l);
1893
+ y(o);
1894
+ }
1895
+ function T(l) {
1896
+ const o = D(l);
1897
+ d.value = o, a("input", o);
1898
+ }
1899
+ function N(l) {
1900
+ const o = e.formatTrigger === "change" ? R(l) : D(l);
1901
+ o !== B(e.modelValue) && y(o), a("change", o);
1902
+ }
1903
+ function L(l) {
1904
+ a("focus", l);
1905
+ }
1906
+ function c(l) {
1907
+ if (e.formatTrigger === "blur") {
1908
+ const o = R(d.value);
1909
+ o !== B(e.modelValue) && y(o);
1910
+ }
1911
+ a("blur", l);
1912
+ }
1913
+ function x() {
1914
+ const l = B(e.emptyValue);
1915
+ d.value = l, a("update:modelValue", l), a("clear");
1916
+ }
1917
+ function u(l) {
1918
+ a("enter", l);
1919
+ }
1920
+ function Z() {
1921
+ var l, o;
1922
+ (o = (l = r.value) == null ? void 0 : l.focus) == null || o.call(l);
1923
+ }
1924
+ function _() {
1925
+ var l, o;
1926
+ (o = (l = r.value) == null ? void 0 : l.blur) == null || o.call(l);
1927
+ }
1928
+ function w() {
1929
+ var l, o;
1930
+ (o = (l = r.value) == null ? void 0 : l.select) == null || o.call(l);
1931
+ }
1932
+ function v() {
1933
+ var l, o;
1934
+ (o = (l = r.value) == null ? void 0 : l.clear) == null || o.call(l);
1935
+ }
1936
+ function U() {
1937
+ var l;
1938
+ return ((l = r.value) == null ? void 0 : l.input) || null;
1939
+ }
1940
+ return g({
1941
+ focus: Z,
1942
+ blur: _,
1943
+ select: w,
1944
+ clear: v,
1945
+ getNativeInput: U
1946
+ }), (l, o) => (S(), le(C(Qe), fe({
1947
+ ref_key: "inputRef",
1948
+ ref: r
1949
+ }, C(A), {
1950
+ "model-value": f.value,
1951
+ inputmode: "decimal",
1952
+ "onUpdate:modelValue": H,
1953
+ onInput: T,
1954
+ onChange: N,
1955
+ onFocus: L,
1956
+ onBlur: c,
1957
+ onClear: x,
1958
+ onKeydown: Ne(u, ["enter"])
1959
+ }), Pe({ _: 2 }, [
1960
+ l.$slots.prefix ? {
1961
+ name: "prefix",
1962
+ fn: k(() => [
1963
+ M(l.$slots, "prefix")
1964
+ ]),
1965
+ key: "0"
1966
+ } : void 0,
1967
+ l.$slots.suffix ? {
1968
+ name: "suffix",
1969
+ fn: k(() => [
1970
+ M(l.$slots, "suffix")
1971
+ ]),
1972
+ key: "1"
1973
+ } : void 0,
1974
+ l.$slots.prepend ? {
1975
+ name: "prepend",
1976
+ fn: k(() => [
1977
+ M(l.$slots, "prepend")
1978
+ ]),
1979
+ key: "2"
1980
+ } : void 0,
1981
+ l.$slots.append ? {
1982
+ name: "append",
1983
+ fn: k(() => [
1984
+ M(l.$slots, "append")
1985
+ ]),
1986
+ key: "3"
1987
+ } : void 0
1988
+ ]), 1040, ["model-value"]));
1989
+ }
1990
+ }), Ta = /* @__PURE__ */ me({
1991
+ name: "QyDatePicker",
1992
+ inheritAttrs: !1,
1993
+ __name: "index",
1994
+ props: {
1995
+ modelValue: { default: void 0 },
1996
+ type: { default: "date" },
1997
+ placeholder: { default: "请选择日期" },
1998
+ startPlaceholder: { default: "开始时间" },
1999
+ endPlaceholder: { default: "结束时间" },
2000
+ rangeSeparator: { default: "-" },
2001
+ format: { default: void 0 },
2002
+ valueFormat: { default: void 0 },
2003
+ defaultTime: { default: void 0 },
2004
+ disabledDate: { type: Function, default: void 0 },
2005
+ shortcuts: { default: void 0 },
2006
+ clearable: { type: Boolean, default: !0 },
2007
+ disabled: { type: Boolean, default: !1 },
2008
+ size: { default: void 0 },
2009
+ teleported: { type: Boolean, default: !0 },
2010
+ appendTo: { default: "body" },
2011
+ popperClass: { default: "" },
2012
+ normalizeRangeEndTime: { type: Boolean, default: !1 }
2013
+ },
2014
+ emits: ["update:modelValue", "change", "clear", "calendar-change", "panel-change", "visible-change", "focus", "blur"],
2015
+ setup(t, { expose: g, emit: b }) {
2016
+ const e = t, a = b, A = be(), r = Q(null), d = F(
2017
+ () => ["qy-date-picker__popper", e.popperClass].filter(Boolean).join(" ")
2018
+ );
2019
+ function f(w) {
2020
+ return Array.isArray(w);
2021
+ }
2022
+ function B(w) {
2023
+ const v = new Date(w);
2024
+ return v.getHours() === 0 && v.getMinutes() === 0 && v.getSeconds() === 0 && v.setHours(23, 59, 59, 0), v;
2025
+ }
2026
+ function q(w) {
2027
+ return /\s00:00:00$/.test(w) ? w.replace(/\s00:00:00$/, " 23:59:59") : /T00:00:00(?:\.000)?(?:Z|[+-]\d{2}:?\d{2})?$/.test(w) ? w.replace(
2028
+ /T00:00:00(\.000)?(Z|[+-]\d{2}:?\d{2})?$/,
2029
+ "T23:59:59$1$2"
2030
+ ) : w;
2031
+ }
2032
+ function D(w) {
2033
+ if (!e.normalizeRangeEndTime || !f(w) || w.length < 2)
2034
+ return w;
2035
+ const v = [...w], U = v[1];
2036
+ return U instanceof Date ? v[1] = B(U) : typeof U == "string" && (v[1] = q(U)), v;
2037
+ }
2038
+ function I(w) {
2039
+ a("update:modelValue", D(w));
2040
+ }
2041
+ function R(w) {
2042
+ a("change", D(w));
2043
+ }
2044
+ function y() {
2045
+ a("clear");
2046
+ }
2047
+ function H(w) {
2048
+ a("calendar-change", w);
2049
+ }
2050
+ function T(w, v, U) {
2051
+ a("panel-change", w, v, U);
2052
+ }
2053
+ function N(w) {
2054
+ a("visible-change", w);
2055
+ }
2056
+ function L(w) {
2057
+ a("focus", w);
2058
+ }
2059
+ function c(w) {
2060
+ a("blur", w);
2061
+ }
2062
+ function x() {
2063
+ var w, v;
2064
+ (v = (w = r.value) == null ? void 0 : w.focus) == null || v.call(w);
2065
+ }
2066
+ function u() {
2067
+ var w, v;
2068
+ (v = (w = r.value) == null ? void 0 : w.blur) == null || v.call(w);
2069
+ }
2070
+ function Z() {
2071
+ var w, v;
2072
+ (v = (w = r.value) == null ? void 0 : w.handleOpen) == null || v.call(w);
2073
+ }
2074
+ function _() {
2075
+ var w, v;
2076
+ (v = (w = r.value) == null ? void 0 : w.handleClose) == null || v.call(w);
2077
+ }
2078
+ return g({
2079
+ focus: x,
2080
+ blur: u,
2081
+ handleOpen: Z,
2082
+ handleClose: _
2083
+ }), (w, v) => (S(), le(C(xl), fe({
2084
+ ref_key: "datePickerRef",
2085
+ ref: r
2086
+ }, C(A), {
2087
+ "model-value": t.modelValue,
2088
+ type: t.type,
2089
+ placeholder: t.placeholder,
2090
+ "start-placeholder": t.startPlaceholder,
2091
+ "end-placeholder": t.endPlaceholder,
2092
+ "range-separator": t.rangeSeparator,
2093
+ format: t.format,
2094
+ "value-format": t.valueFormat,
2095
+ "default-time": t.defaultTime,
2096
+ "disabled-date": t.disabledDate,
2097
+ shortcuts: t.shortcuts,
2098
+ clearable: t.clearable,
2099
+ disabled: t.disabled,
2100
+ size: t.size,
2101
+ teleported: t.teleported,
2102
+ "append-to": t.appendTo,
2103
+ "popper-class": d.value,
2104
+ "onUpdate:modelValue": I,
2105
+ onChange: R,
2106
+ onClear: y,
2107
+ onCalendarChange: H,
2108
+ onPanelChange: T,
2109
+ onVisibleChange: N,
2110
+ onFocus: L,
2111
+ onBlur: c
2112
+ }), null, 16, ["model-value", "type", "placeholder", "start-placeholder", "end-placeholder", "range-separator", "format", "value-format", "default-time", "disabled-date", "shortcuts", "clearable", "disabled", "size", "teleported", "append-to", "popper-class"]));
2113
+ }
2114
+ }), Pa = /* @__PURE__ */ me({
2115
+ name: "QyCheckbox",
2116
+ inheritAttrs: !1,
2117
+ __name: "index",
2118
+ props: {
2119
+ modelValue: { type: [String, Number, Boolean], default: !1 },
2120
+ disabled: { type: Boolean, default: !1 },
2121
+ size: { default: void 0 },
2122
+ trueValue: { type: [String, Number, Boolean], default: !0 },
2123
+ falseValue: { type: [String, Number, Boolean], default: !1 }
2124
+ },
2125
+ emits: ["update:modelValue", "change", "focus", "blur"],
2126
+ setup(t, { expose: g, emit: b }) {
2127
+ const e = t, a = b, A = be(), r = Q(null), d = F(() => typeof e.trueValue == "boolean" && typeof e.falseValue == "boolean" ? {} : {
2128
+ trueValue: e.trueValue,
2129
+ falseValue: e.falseValue
2130
+ }), f = F(() => ({
2131
+ ...A,
2132
+ ...d.value
2133
+ }));
2134
+ function B(y) {
2135
+ a("update:modelValue", y);
2136
+ }
2137
+ function q(y) {
2138
+ a("change", y);
2139
+ }
2140
+ function D(y) {
2141
+ a("focus", y);
2142
+ }
2143
+ function I(y) {
2144
+ a("blur", y);
2145
+ }
2146
+ function R() {
2147
+ return r.value;
2148
+ }
2149
+ return g({
2150
+ getCheckboxInstance: R
2151
+ }), (y, H) => (S(), le(C(Vl), fe({
2152
+ ref_key: "checkboxRef",
2153
+ ref: r
2154
+ }, f.value, {
2155
+ "model-value": t.modelValue,
2156
+ disabled: t.disabled,
2157
+ size: t.size,
2158
+ "onUpdate:modelValue": B,
2159
+ onChange: q,
2160
+ onFocus: D,
2161
+ onBlur: I
2162
+ }), {
2163
+ default: k(() => [
2164
+ M(y.$slots, "default")
2165
+ ]),
2166
+ _: 3
2167
+ }, 16, ["model-value", "disabled", "size"]));
2168
+ }
2169
+ }), Fa = /* @__PURE__ */ me({
2170
+ name: "QyAutocomplete",
2171
+ inheritAttrs: !1,
2172
+ __name: "index",
2173
+ props: {
2174
+ modelValue: { default: "" },
2175
+ options: { default: () => [] },
2176
+ valueKey: { default: "value" },
2177
+ labelKey: { default: "label" },
2178
+ placeholder: { default: "请输入" },
2179
+ disabled: { type: Boolean, default: !1 },
2180
+ clearable: { type: Boolean, default: !0 },
2181
+ size: { default: void 0 },
2182
+ teleported: { type: Boolean, default: !0 },
2183
+ appendTo: { default: "body" },
2184
+ popperClass: { default: "" },
2185
+ filterMethod: { type: Function, default: void 0 }
2186
+ },
2187
+ emits: ["update:modelValue", "input", "change", "select", "focus", "blur", "clear"],
2188
+ setup(t, { expose: g, emit: b }) {
2189
+ const e = t, a = b, A = be(), r = Q(null), d = F(
2190
+ () => ["qy-autocomplete__popper", e.popperClass].filter(Boolean).join(" ")
2191
+ ), f = F(() => {
2192
+ const c = C(e.options);
2193
+ return (Array.isArray(c) ? c : C(c == null ? void 0 : c.value) || []).map((u) => ({
2194
+ ...u,
2195
+ value: (u == null ? void 0 : u[e.valueKey]) ?? (u == null ? void 0 : u.value) ?? (u == null ? void 0 : u[e.labelKey]) ?? (u == null ? void 0 : u.label) ?? ""
2196
+ }));
2197
+ });
2198
+ function B(c, x) {
2199
+ const u = String(c ?? ""), Z = f.value.filter((_) => e.filterMethod ? e.filterMethod(u, _) : u ? String(_.value ?? "").includes(u) : !0);
2200
+ x(Z);
2201
+ }
2202
+ function q(c) {
2203
+ a("update:modelValue", c);
2204
+ }
2205
+ function D(c) {
2206
+ a("input", c);
2207
+ }
2208
+ function I(c) {
2209
+ a("change", c);
2210
+ }
2211
+ function R(c) {
2212
+ a("select", c);
2213
+ }
2214
+ function y(c) {
2215
+ a("focus", c);
2216
+ }
2217
+ function H(c) {
2218
+ a("blur", c);
2219
+ }
2220
+ function T() {
2221
+ a("clear");
2222
+ }
2223
+ function N() {
2224
+ var c, x;
2225
+ (x = (c = r.value) == null ? void 0 : c.focus) == null || x.call(c);
2226
+ }
2227
+ function L() {
2228
+ var c, x;
2229
+ (x = (c = r.value) == null ? void 0 : c.blur) == null || x.call(c);
2230
+ }
2231
+ return g({
2232
+ querySearch: B,
2233
+ focus: N,
2234
+ blur: L
2235
+ }), (c, x) => (S(), le(C(Vt), fe({
2236
+ ref_key: "autocompleteRef",
2237
+ ref: r
2238
+ }, C(A), {
2239
+ "model-value": t.modelValue,
2240
+ "fetch-suggestions": B,
2241
+ placeholder: t.placeholder,
2242
+ disabled: t.disabled,
2243
+ clearable: t.clearable,
2244
+ size: t.size,
2245
+ teleported: t.teleported,
2246
+ "append-to": t.appendTo,
2247
+ "popper-class": d.value,
2248
+ "onUpdate:modelValue": q,
2249
+ onInput: D,
2250
+ onChange: I,
2251
+ onSelect: R,
2252
+ onFocus: y,
2253
+ onBlur: H,
2254
+ onClear: T
2255
+ }), null, 16, ["model-value", "placeholder", "disabled", "clearable", "size", "teleported", "append-to", "popper-class"]));
2256
+ }
2257
+ }), Ma = /* @__PURE__ */ me({
2258
+ name: "QyRadioGroup",
2259
+ inheritAttrs: !1,
2260
+ __name: "index",
2261
+ props: {
2262
+ modelValue: { type: [String, Number, Boolean, null], default: void 0 },
2263
+ options: { default: () => [] },
2264
+ labelKey: { default: "label" },
2265
+ valueKey: { default: "value" },
2266
+ disabledKey: { default: "disabled" },
2267
+ disabled: { type: Boolean, default: !1 },
2268
+ size: { default: void 0 },
2269
+ name: { default: void 0 },
2270
+ type: { default: "radio" },
2271
+ border: { type: Boolean, default: !1 }
2272
+ },
2273
+ emits: ["update:modelValue", "change"],
2274
+ setup(t, { expose: g, emit: b }) {
2275
+ const e = t, a = b, A = be(), r = Q(null), d = F(
2276
+ () => e.type === "button" ? Cl : $l
2277
+ ), f = F(
2278
+ () => (e.options || []).map((y) => ({
2279
+ raw: y,
2280
+ label: (y == null ? void 0 : y[e.labelKey]) ?? (y == null ? void 0 : y.label) ?? (y == null ? void 0 : y.value) ?? "",
2281
+ value: (y == null ? void 0 : y[e.valueKey]) ?? (y == null ? void 0 : y.value) ?? (y == null ? void 0 : y.label),
2282
+ disabled: !!(y != null && y[e.disabledKey])
2283
+ }))
2284
+ );
2285
+ function B(y) {
2286
+ const H = {
2287
+ value: y.value,
2288
+ label: y.value,
2289
+ disabled: y.disabled
2290
+ };
2291
+ return e.type === "button" ? H : {
2292
+ ...H,
2293
+ border: e.border
2294
+ };
2295
+ }
2296
+ function q(y, H) {
2297
+ return `${String(y.value ?? y.label ?? "")}-${H}`;
2298
+ }
2299
+ function D(y) {
2300
+ a("update:modelValue", y);
2301
+ }
2302
+ function I(y) {
2303
+ a("change", y);
2304
+ }
2305
+ function R() {
2306
+ return r.value;
2307
+ }
2308
+ return g({
2309
+ getRadioGroupInstance: R
2310
+ }), (y, H) => (S(), le(C(Bl), fe({
2311
+ ref_key: "radioGroupRef",
2312
+ ref: r
2313
+ }, C(A), {
2314
+ "model-value": t.modelValue,
2315
+ disabled: t.disabled,
2316
+ size: t.size,
2317
+ name: t.name,
2318
+ "onUpdate:modelValue": D,
2319
+ onChange: I
2320
+ }), {
2321
+ default: k(() => [
2322
+ y.$slots.default ? M(y.$slots, "default", { key: 0 }) : (S(!0), W(Ie, { key: 1 }, je(f.value, (T, N) => (S(), le(ml(d.value), fe({
2323
+ key: q(T, N)
2324
+ }, { ref_for: !0 }, B(T)), {
2325
+ default: k(() => [
2326
+ M(y.$slots, "option", {
2327
+ option: T.raw,
2328
+ label: T.label,
2329
+ value: T.value,
2330
+ disabled: T.disabled
2331
+ }, () => [
2332
+ ve(he(T.label), 1)
2333
+ ])
2334
+ ]),
2335
+ _: 2
2336
+ }, 1040))), 128))
2337
+ ]),
2338
+ _: 3
2339
+ }, 16, ["model-value", "disabled", "size", "name"]));
2340
+ }
2341
+ }), it = /* @__PURE__ */ me({
2342
+ name: "QySelect",
2343
+ inheritAttrs: !1,
2344
+ __name: "index",
2345
+ props: {
2346
+ modelValue: { type: [String, Number, Boolean, Array, null], default: void 0 },
2347
+ options: { default: () => [] },
2348
+ labelKey: { default: "label" },
2349
+ valueKey: { default: "value" },
2350
+ disabledKey: { default: "disabled" },
2351
+ placeholder: { default: "请选择" },
2352
+ disabled: { type: Boolean, default: !1 },
2353
+ clearable: { type: Boolean, default: !0 },
2354
+ filterable: { type: Boolean, default: !1 },
2355
+ multiple: { type: Boolean, default: !1 },
2356
+ collapseTags: { type: Boolean, default: !1 },
2357
+ collapseTagsTooltip: { type: Boolean, default: !1 },
2358
+ autoSelectSingle: { type: Boolean, default: !1 },
2359
+ size: { default: void 0 },
2360
+ teleported: { type: Boolean, default: !0 },
2361
+ appendTo: { default: "body" },
2362
+ fitInputWidth: { type: Boolean, default: !0 },
2363
+ popperClass: { default: "" }
2364
+ },
2365
+ emits: ["update:modelValue", "change", "clear", "visible-change", "focus", "blur"],
2366
+ setup(t, { expose: g, emit: b }) {
2367
+ const e = t, a = b, A = be(), r = nt(), d = Q(null), f = F(
2368
+ () => ["qy-select__popper", e.popperClass].filter(Boolean).join(" ")
2369
+ ), B = F(
2370
+ () => (e.options || []).map((u) => ({
2371
+ raw: u,
2372
+ label: (u == null ? void 0 : u[e.labelKey]) ?? (u == null ? void 0 : u.label) ?? (u == null ? void 0 : u.value) ?? "",
2373
+ value: (u == null ? void 0 : u[e.valueKey]) ?? (u == null ? void 0 : u.value) ?? (u == null ? void 0 : u.label),
2374
+ disabled: !!(u != null && u[e.disabledKey])
2375
+ }))
2376
+ ), q = F(() => {
2377
+ const u = r.default;
2378
+ return u ? u().some((Z) => Z.type !== pl) : !1;
2379
+ });
2380
+ function D(u) {
2381
+ return Array.isArray(u) ? u.length === 0 : u === "" || u === null || u === void 0;
2382
+ }
2383
+ de(
2384
+ [
2385
+ B,
2386
+ () => e.modelValue,
2387
+ () => e.autoSelectSingle,
2388
+ () => e.disabled,
2389
+ () => e.multiple
2390
+ ],
2391
+ ([u]) => {
2392
+ if (!e.autoSelectSingle || e.disabled || !D(e.modelValue) || u.length !== 1) return;
2393
+ const [Z] = u;
2394
+ if (Z.disabled) return;
2395
+ const _ = e.multiple ? [Z.value] : Z.value;
2396
+ a("update:modelValue", _), a("change", _);
2397
+ },
2398
+ { immediate: !0 }
2399
+ );
2400
+ function I(u, Z) {
2401
+ return `${String(u.value ?? u.label ?? "")}-${Z}`;
2402
+ }
2403
+ function R(u) {
2404
+ a("update:modelValue", u);
2405
+ }
2406
+ function y(u) {
2407
+ a("change", u);
2408
+ }
2409
+ function H() {
2410
+ a("clear");
2411
+ }
2412
+ function T(u) {
2413
+ a("visible-change", u);
2414
+ }
2415
+ function N(u) {
2416
+ a("focus", u);
2417
+ }
2418
+ function L(u) {
2419
+ a("blur", u);
2420
+ }
2421
+ function c() {
2422
+ var u, Z;
2423
+ (Z = (u = d.value) == null ? void 0 : u.focus) == null || Z.call(u);
2424
+ }
2425
+ function x() {
2426
+ var u, Z;
2427
+ (Z = (u = d.value) == null ? void 0 : u.blur) == null || Z.call(u);
2428
+ }
2429
+ return g({
2430
+ // 仅暴露业务常用焦点方法,复杂下拉行为仍交给 Element Plus 自身处理。
2431
+ focus: c,
2432
+ blur: x
2433
+ }), (u, Z) => (S(), le(C(rt), fe({
2434
+ ref_key: "selectRef",
2435
+ ref: d
2436
+ }, C(A), {
2437
+ "model-value": t.modelValue,
2438
+ placeholder: t.placeholder,
2439
+ disabled: t.disabled,
2440
+ clearable: t.clearable,
2441
+ filterable: t.filterable,
2442
+ multiple: t.multiple,
2443
+ "collapse-tags": t.collapseTags,
2444
+ "collapse-tags-tooltip": t.collapseTagsTooltip,
2445
+ size: t.size,
2446
+ teleported: t.teleported,
2447
+ "fit-input-width": t.fitInputWidth,
2448
+ "popper-class": f.value,
2449
+ "append-to": t.appendTo,
2450
+ "onUpdate:modelValue": R,
2451
+ onChange: y,
2452
+ onClear: H,
2453
+ onVisibleChange: T,
2454
+ onFocus: N,
2455
+ onBlur: L
2456
+ }), Pe({
2457
+ default: k(() => [
2458
+ q.value ? M(u.$slots, "default", { key: 0 }) : (S(!0), W(Ie, { key: 1 }, je(B.value, (_, w) => (S(), le(C(ut), {
2459
+ key: I(_, w),
2460
+ label: _.label,
2461
+ value: _.value,
2462
+ disabled: _.disabled
2463
+ }, null, 8, ["label", "value", "disabled"]))), 128))
2464
+ ]),
2465
+ _: 2
2466
+ }, [
2467
+ u.$slots.prefix ? {
2468
+ name: "prefix",
2469
+ fn: k(() => [
2470
+ M(u.$slots, "prefix")
2471
+ ]),
2472
+ key: "0"
2473
+ } : void 0,
2474
+ u.$slots.empty ? {
2475
+ name: "empty",
2476
+ fn: k(() => [
2477
+ M(u.$slots, "empty")
2478
+ ]),
2479
+ key: "1"
2480
+ } : void 0,
2481
+ u.$slots.loading ? {
2482
+ name: "loading",
2483
+ fn: k(() => [
2484
+ M(u.$slots, "loading")
2485
+ ]),
2486
+ key: "2"
2487
+ } : void 0,
2488
+ u.$slots.tag ? {
2489
+ name: "tag",
2490
+ fn: k((_) => [
2491
+ M(u.$slots, "tag", Ke(Ee(_)))
2492
+ ]),
2493
+ key: "3"
2494
+ } : void 0
2495
+ ]), 1040, ["model-value", "placeholder", "disabled", "clearable", "filterable", "multiple", "collapse-tags", "collapse-tags-tooltip", "size", "teleported", "fit-input-width", "popper-class", "append-to"]));
2496
+ }
2497
+ }), Oa = /* @__PURE__ */ me({
2498
+ name: "QyRemoteSelect",
2499
+ inheritAttrs: !1,
2500
+ __name: "index",
2501
+ props: {
2502
+ modelValue: { type: [String, Number, Boolean, Array, null], default: void 0 },
2503
+ fetchMethod: {},
2504
+ defaultOptions: { default: () => [] },
2505
+ labelKey: { default: "label" },
2506
+ valueKey: { default: "value" },
2507
+ disabledKey: { default: "disabled" },
2508
+ placeholder: { default: "请选择" },
2509
+ disabled: { type: Boolean, default: !1 },
2510
+ clearable: { type: Boolean, default: !0 },
2511
+ multiple: { type: Boolean, default: !1 },
2512
+ collapseTags: { type: Boolean, default: !1 },
2513
+ collapseTagsTooltip: { type: Boolean, default: !1 },
2514
+ autoSelectSingle: { type: Boolean, default: !1 },
2515
+ size: { default: void 0 },
2516
+ teleported: { type: Boolean, default: !0 },
2517
+ appendTo: { default: "body" },
2518
+ fitInputWidth: { type: Boolean, default: !0 },
2519
+ popperClass: { default: "" },
2520
+ debounce: { default: 300 },
2521
+ minLength: { default: 1 },
2522
+ remoteOnFocus: { type: Boolean, default: !1 },
2523
+ remoteShowSuffix: { type: Boolean, default: !0 },
2524
+ loading: { type: Boolean, default: !1 },
2525
+ reserveSelectedOption: { type: Boolean, default: !0 },
2526
+ allowCreate: { type: Boolean, default: !1 },
2527
+ commitOnBlur: { type: Boolean, default: !1 }
2528
+ },
2529
+ emits: ["update:modelValue", "change", "clear", "visible-change", "focus", "blur", "options-change", "loading-change", "error"],
2530
+ setup(t, { expose: g, emit: b }) {
2531
+ const e = t, a = b, A = be(), r = Q(null), d = Q([]), f = Q(/* @__PURE__ */ new Map()), B = Q(!1), q = Q(""), D = Q("");
2532
+ let I = 0, R = null;
2533
+ const y = F(() => e.loading || B.value), H = Q(!1), T = F(() => q.value !== ""), N = F(() => {
2534
+ if (T.value) return d.value;
2535
+ const V = /* @__PURE__ */ new Map(), ae = (i) => {
2536
+ V.set(L(i), i);
2537
+ };
2538
+ return e.defaultOptions.forEach(ae), e.reserveSelectedOption && f.value.forEach((i) => ae(i)), d.value.forEach(ae), Array.from(V.values());
2539
+ });
2540
+ de(
2541
+ () => e.defaultOptions,
2542
+ (V) => {
2543
+ V.forEach(x);
2544
+ },
2545
+ { immediate: !0 }
2546
+ ), de(
2547
+ () => e.modelValue,
2548
+ () => {
2549
+ N.value.forEach(x);
2550
+ },
2551
+ { immediate: !0 }
2552
+ );
2553
+ function L(V) {
2554
+ return (V == null ? void 0 : V[e.valueKey]) ?? (V == null ? void 0 : V.value) ?? (V == null ? void 0 : V.label);
2555
+ }
2556
+ function c(V) {
2557
+ return Array.isArray(e.modelValue) ? e.modelValue.includes(V) : e.modelValue === V;
2558
+ }
2559
+ function x(V) {
2560
+ if (!e.reserveSelectedOption) return;
2561
+ const ae = L(V);
2562
+ c(ae) && f.value.set(ae, V);
2563
+ }
2564
+ function u(V) {
2565
+ return e.disabled ? !1 : V ? V.length >= e.minLength : e.remoteOnFocus;
2566
+ }
2567
+ function Z(V) {
2568
+ B.value !== V && (B.value = V, a("loading-change", V));
2569
+ }
2570
+ async function _(V) {
2571
+ const ae = X(V), i = ++I;
2572
+ if (ie(ae), !u(ae)) {
2573
+ d.value = [], Z(!1), a("options-change", N.value);
2574
+ return;
2575
+ }
2576
+ Z(!0);
2577
+ try {
2578
+ const O = await e.fetchMethod(ae);
2579
+ if (i !== I) return;
2580
+ d.value = Array.isArray(O) ? O : [], d.value.forEach(x), a("options-change", N.value);
2581
+ } catch (O) {
2582
+ if (i !== I) return;
2583
+ d.value = [], a("error", O), a("options-change", N.value);
2584
+ } finally {
2585
+ i === I && Z(!1);
2586
+ }
2587
+ }
2588
+ function w() {
2589
+ H.value || (H.value = !0, _(""));
2590
+ }
2591
+ function v(V) {
2592
+ const ae = X(V);
2593
+ D.value = ae, I += 1, ie(ae), R && (clearTimeout(R), R = null), R = setTimeout(() => {
2594
+ _(ae);
2595
+ }, e.debounce);
2596
+ }
2597
+ function U() {
2598
+ H.value = !0, _("");
2599
+ }
2600
+ function l() {
2601
+ _(q.value);
2602
+ }
2603
+ function o(V) {
2604
+ D.value = "", a("update:modelValue", V);
2605
+ }
2606
+ function P(V) {
2607
+ D.value = "", N.value.forEach(x), a("change", V);
2608
+ }
2609
+ function oe() {
2610
+ D.value = "", a("clear");
2611
+ }
2612
+ function m(V) {
2613
+ V && e.remoteOnFocus && !q.value && w(), a("visible-change", V);
2614
+ }
2615
+ function $(V) {
2616
+ e.remoteOnFocus && !q.value && w(), a("focus", V);
2617
+ }
2618
+ function j(V) {
2619
+ z(), a("blur", V);
2620
+ }
2621
+ function z() {
2622
+ if (!e.allowCreate || !e.commitOnBlur || e.disabled) return;
2623
+ const V = D.value;
2624
+ V.trim() && (D.value = "", a("update:modelValue", V), a("change", V));
2625
+ }
2626
+ function X(V) {
2627
+ return String(V ?? "");
2628
+ }
2629
+ function ie(V) {
2630
+ q.value = V, d.value = [], a("options-change", N.value);
2631
+ }
2632
+ function ye() {
2633
+ var V, ae;
2634
+ (ae = (V = r.value) == null ? void 0 : V.focus) == null || ae.call(V);
2635
+ }
2636
+ function we() {
2637
+ var V, ae;
2638
+ (ae = (V = r.value) == null ? void 0 : V.blur) == null || ae.call(V);
2639
+ }
2640
+ function $e() {
2641
+ a("update:modelValue", e.multiple ? [] : ""), a("clear");
2642
+ }
2643
+ return at(() => {
2644
+ R && clearTimeout(R);
2645
+ }), g({
2646
+ // 暴露远程选择常用控制方法,供弹窗打开后聚焦或请求失败后重试。
2647
+ focus: ye,
2648
+ blur: we,
2649
+ clear: $e,
2650
+ retryFetch: l,
2651
+ fetchDefaultOptions: U
2652
+ }), (V, ae) => (S(), le(it, fe({
2653
+ ref_key: "selectRef",
2654
+ ref: r
2655
+ }, C(A), {
2656
+ "model-value": t.modelValue,
2657
+ options: N.value,
2658
+ "label-key": t.labelKey,
2659
+ "value-key": t.valueKey,
2660
+ "disabled-key": t.disabledKey,
2661
+ placeholder: t.placeholder,
2662
+ disabled: t.disabled,
2663
+ clearable: t.clearable,
2664
+ filterable: !0,
2665
+ multiple: t.multiple,
2666
+ "collapse-tags": t.collapseTags,
2667
+ "collapse-tags-tooltip": t.collapseTagsTooltip,
2668
+ "auto-select-single": t.autoSelectSingle,
2669
+ size: t.size,
2670
+ teleported: t.teleported,
2671
+ "append-to": t.appendTo,
2672
+ "fit-input-width": t.fitInputWidth,
2673
+ "popper-class": t.popperClass,
2674
+ remote: "",
2675
+ "remote-show-suffix": t.remoteShowSuffix,
2676
+ "remote-method": v,
2677
+ loading: y.value,
2678
+ "onUpdate:modelValue": o,
2679
+ onChange: P,
2680
+ onClear: oe,
2681
+ onVisibleChange: m,
2682
+ onFocus: $,
2683
+ onBlur: j
2684
+ }), Pe({
2685
+ default: k(() => [
2686
+ V.$slots.default ? M(V.$slots, "default", { key: 0 }) : J("", !0)
2687
+ ]),
2688
+ _: 2
2689
+ }, [
2690
+ V.$slots.prefix ? {
2691
+ name: "prefix",
2692
+ fn: k(() => [
2693
+ M(V.$slots, "prefix")
2694
+ ]),
2695
+ key: "0"
2696
+ } : void 0,
2697
+ V.$slots.empty ? {
2698
+ name: "empty",
2699
+ fn: k(() => [
2700
+ M(V.$slots, "empty")
2701
+ ]),
2702
+ key: "1"
2703
+ } : void 0,
2704
+ V.$slots.loading ? {
2705
+ name: "loading",
2706
+ fn: k(() => [
2707
+ M(V.$slots, "loading")
2708
+ ]),
2709
+ key: "2"
2710
+ } : void 0,
2711
+ V.$slots.tag ? {
2712
+ name: "tag",
2713
+ fn: k((i) => [
2714
+ M(V.$slots, "tag", Ke(Ee(i)))
2715
+ ]),
2716
+ key: "3"
2717
+ } : void 0
2718
+ ]), 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"]));
2719
+ }
2720
+ }), Qa = { class: "qy-search-input__item" }, Ua = ["innerHTML"], Da = {
2721
+ key: 0,
2722
+ class: "qy-search-input__item-description"
2723
+ }, Ka = /* @__PURE__ */ me({
2724
+ name: "QySearchInput",
2725
+ inheritAttrs: !1,
2726
+ __name: "index",
2727
+ props: {
2728
+ modelValue: { default: "" },
2729
+ loading: { type: Boolean, default: !1 },
2730
+ disabled: { type: Boolean, default: !1 },
2731
+ placeholder: { default: "请输入搜索内容" },
2732
+ removeSpace: { type: Boolean, default: !1 },
2733
+ trimMode: { default: "none" },
2734
+ clearable: { type: Boolean, default: !0 },
2735
+ showButton: { type: Boolean, default: !0 },
2736
+ buttonText: { default: "搜索" },
2737
+ buttonProps: { default: () => ({}) },
2738
+ suggestions: { default: () => [] },
2739
+ fetchSuggestions: { type: [Function, null], default: null },
2740
+ fetchSuggestionsMethod: { type: [Function, null], default: null },
2741
+ debounce: { default: 300 },
2742
+ minLength: { default: 1 },
2743
+ triggerOnFocus: { type: Boolean, default: !1 },
2744
+ searchOnEnter: { type: Boolean, default: !0 },
2745
+ searchOnSelect: { type: Boolean, default: !1 },
2746
+ highlightKeyword: { type: Boolean, default: !0 },
2747
+ teleported: { type: Boolean, default: !0 },
2748
+ appendTo: { default: "body" },
2749
+ popperClass: { default: "" },
2750
+ fitInputWidth: { type: Boolean, default: !0 }
2751
+ },
2752
+ emits: ["update:modelValue", "search", "clear", "input", "change", "focus", "blur", "enter", "select", "visible-change", "suggestions-change", "error"],
2753
+ setup(t, { expose: g, emit: b }) {
2754
+ const e = t, a = b, A = be(), r = Q(null), d = Q(I(e.modelValue)), f = F(() => I(e.modelValue)), B = F(
2755
+ () => ["qy-search-input__popper", e.popperClass].filter(Boolean).join(" ")
2756
+ ), q = F(() => I(e.modelValue)), D = Q("");
2757
+ de(
2758
+ () => e.modelValue,
2759
+ (i) => {
2760
+ d.value = I(i);
2761
+ }
2762
+ );
2763
+ function I(i) {
2764
+ return i == null ? "" : String(i);
2765
+ }
2766
+ function R(i) {
2767
+ return e.removeSpace ? i.replace(/\s+/g, "") : i;
2768
+ }
2769
+ function y(i, O) {
2770
+ return e.trimMode !== O ? i : i.trim();
2771
+ }
2772
+ function H(i) {
2773
+ return R(I(i));
2774
+ }
2775
+ function T(i) {
2776
+ d.value = i, a("update:modelValue", i);
2777
+ }
2778
+ function N(i, O = "") {
2779
+ return {
2780
+ ...i,
2781
+ label: i.label || i.value,
2782
+ value: i.value || i.label,
2783
+ description: i.description || O
2784
+ };
2785
+ }
2786
+ function L(i = []) {
2787
+ return i.flatMap((O) => {
2788
+ if (Array.isArray(O.items)) {
2789
+ const ne = O;
2790
+ return ne.items.map((Ce) => N(Ce, ne.groupLabel));
2791
+ }
2792
+ return N(O);
2793
+ });
2794
+ }
2795
+ function c(i) {
2796
+ const O = i.toLowerCase();
2797
+ return (ne) => [ne.label, ne.value, ne.description].filter(Boolean).some((Ce) => String(Ce).toLowerCase().includes(O));
2798
+ }
2799
+ function x(i) {
2800
+ return i ? i.length >= e.minLength : e.triggerOnFocus;
2801
+ }
2802
+ function u(i) {
2803
+ a("suggestions-change", i), a("visible-change", i.length > 0);
2804
+ }
2805
+ async function Z(i) {
2806
+ if (!x(i))
2807
+ return u([]), [];
2808
+ if (e.fetchSuggestionsMethod) {
2809
+ const Ce = await new Promise((Be) => {
2810
+ var pe;
2811
+ (pe = e.fetchSuggestionsMethod) == null || pe.call(e, i, (De) => {
2812
+ Be(L(De));
2813
+ });
2814
+ });
2815
+ return u(Ce), Ce;
2816
+ }
2817
+ if (e.fetchSuggestions) {
2818
+ const Ce = await e.fetchSuggestions(i), Be = L(Array.isArray(Ce) ? Ce : []);
2819
+ return u(Be), Be;
2820
+ }
2821
+ const O = L(e.suggestions), ne = i ? O.filter(c(i)) : O;
2822
+ return u(ne), ne;
2823
+ }
2824
+ async function _(i, O) {
2825
+ D.value = i;
2826
+ try {
2827
+ const ne = await Z(i);
2828
+ O(ne);
2829
+ } catch (ne) {
2830
+ a("error", ne), u([]), O([]);
2831
+ }
2832
+ }
2833
+ function w() {
2834
+ var i, O;
2835
+ D.value && ((O = (i = r.value) == null ? void 0 : i.getData) == null || O.call(i, D.value));
2836
+ }
2837
+ function v(i) {
2838
+ const O = H(i);
2839
+ T(O);
2840
+ }
2841
+ function U(i) {
2842
+ const O = H(i);
2843
+ d.value = O, a("input", O);
2844
+ }
2845
+ function l(i) {
2846
+ const O = y(H(i), "change");
2847
+ O !== I(e.modelValue) && T(O), a("change", O);
2848
+ }
2849
+ function o(i) {
2850
+ a("focus", i);
2851
+ }
2852
+ function P(i) {
2853
+ const O = y(d.value, "blur");
2854
+ O !== I(e.modelValue) && T(O), a("blur", i), a("visible-change", !1);
2855
+ }
2856
+ function oe() {
2857
+ d.value = "", a("update:modelValue", ""), a("clear"), u([]);
2858
+ }
2859
+ function m(i) {
2860
+ a("enter", i), e.searchOnEnter && $();
2861
+ }
2862
+ function $() {
2863
+ a("search", I(e.modelValue));
2864
+ }
2865
+ function j(i) {
2866
+ a("select", i), e.searchOnSelect && a("search", i.value);
2867
+ }
2868
+ function z(i) {
2869
+ return i.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
2870
+ }
2871
+ function X(i) {
2872
+ return i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2873
+ }
2874
+ function ie(i) {
2875
+ const O = z(i || "");
2876
+ if (!e.highlightKeyword || !f.value) return O;
2877
+ const ne = X(z(f.value));
2878
+ return ne ? O.replace(
2879
+ new RegExp(`(${ne})`, "ig"),
2880
+ '<mark class="qy-search-input__mark">$1</mark>'
2881
+ ) : O;
2882
+ }
2883
+ function ye() {
2884
+ var i, O;
2885
+ (O = (i = r.value) == null ? void 0 : i.focus) == null || O.call(i);
2886
+ }
2887
+ function we() {
2888
+ var i, O;
2889
+ (O = (i = r.value) == null ? void 0 : i.blur) == null || O.call(i);
2890
+ }
2891
+ function $e() {
2892
+ var i, O, ne;
2893
+ (ne = (O = (i = r.value) == null ? void 0 : i.inputRef) == null ? void 0 : O.select) == null || ne.call(O);
2894
+ }
2895
+ function V() {
2896
+ var i, O;
2897
+ (O = (i = r.value) == null ? void 0 : i.clear) == null || O.call(i);
2898
+ }
2899
+ function ae() {
2900
+ var i, O;
2901
+ (O = (i = r.value) == null ? void 0 : i.close) == null || O.call(i);
2902
+ }
2903
+ return g({
2904
+ // 暴露搜索框常用控制方法,供弹窗打开后聚焦或失败后重试建议项。
2905
+ focus: ye,
2906
+ blur: we,
2907
+ select: $e,
2908
+ clear: V,
2909
+ closePanel: ae,
2910
+ retryFetch: w
2911
+ }), (i, O) => (S(), W("div", {
2912
+ class: Ve(["qy-search-input", { "is-disabled": t.disabled }])
2913
+ }, [
2914
+ Y(C(Vt), fe({
2915
+ ref_key: "autocompleteRef",
2916
+ ref: r
2917
+ }, C(A), {
2918
+ "model-value": q.value,
2919
+ disabled: t.disabled,
2920
+ placeholder: t.placeholder,
2921
+ clearable: t.clearable,
2922
+ debounce: t.debounce,
2923
+ "fetch-suggestions": _,
2924
+ "trigger-on-focus": t.triggerOnFocus,
2925
+ teleported: t.teleported,
2926
+ "fit-input-width": t.fitInputWidth,
2927
+ "popper-class": B.value,
2928
+ "append-to": t.appendTo,
2929
+ "value-key": "value",
2930
+ "onUpdate:modelValue": v,
2931
+ onInput: U,
2932
+ onChange: l,
2933
+ onFocus: o,
2934
+ onBlur: P,
2935
+ onClear: oe,
2936
+ onSelect: j,
2937
+ onKeydown: Ne(m, ["enter"])
2938
+ }), Pe({
2939
+ default: k(({ item: ne }) => [
2940
+ M(i.$slots, "item", {
2941
+ item: ne,
2942
+ keyword: f.value
2943
+ }, () => [
2944
+ G("div", Qa, [
2945
+ G("div", {
2946
+ class: "qy-search-input__item-label",
2947
+ innerHTML: ie(ne.label || ne.value || "")
2948
+ }, null, 8, Ua),
2949
+ ne.description ? (S(), W("div", Da, he(ne.description), 1)) : J("", !0)
2950
+ ])
2951
+ ], !0)
2952
+ ]),
2953
+ _: 2
2954
+ }, [
2955
+ i.$slots.prefix ? {
2956
+ name: "prefix",
2957
+ fn: k(() => [
2958
+ M(i.$slots, "prefix", {}, void 0, !0)
2959
+ ]),
2960
+ key: "0"
2961
+ } : void 0,
2962
+ i.$slots.suffix ? {
2963
+ name: "suffix",
2964
+ fn: k(() => [
2965
+ M(i.$slots, "suffix", {}, void 0, !0)
2966
+ ]),
2967
+ key: "1"
2968
+ } : void 0,
2969
+ i.$slots.prepend ? {
2970
+ name: "prepend",
2971
+ fn: k(() => [
2972
+ M(i.$slots, "prepend", {}, void 0, !0)
2973
+ ]),
2974
+ key: "2"
2975
+ } : void 0,
2976
+ i.$slots.append || t.showButton ? {
2977
+ name: "append",
2978
+ fn: k(() => [
2979
+ i.$slots.append ? M(i.$slots, "append", { key: 0 }, void 0, !0) : (S(), le(C(qe), fe({ key: 1 }, t.buttonProps, {
2980
+ loading: t.loading,
2981
+ disabled: t.disabled,
2982
+ onClick: $
2983
+ }), {
2984
+ default: k(() => [
2985
+ ve(he(t.buttonText), 1)
2986
+ ]),
2987
+ _: 1
2988
+ }, 16, ["loading", "disabled"]))
2989
+ ]),
2990
+ key: "3"
2991
+ } : void 0
2992
+ ]), 1040, ["model-value", "disabled", "placeholder", "clearable", "debounce", "trigger-on-focus", "teleported", "fit-input-width", "popper-class", "append-to"])
2993
+ ], 2));
2994
+ }
2995
+ }), At = /* @__PURE__ */ Ae(Ka, [["__scopeId", "data-v-cd7f5dfc"]]), Ea = { class: "qy-record-quote-search" }, La = {
2996
+ key: 0,
2997
+ class: "qy-record-quote-search__header"
2998
+ }, ja = {
2999
+ key: 0,
3000
+ class: "qy-record-quote-search__label"
3001
+ }, Na = {
3002
+ key: 1,
3003
+ class: "qy-record-quote-search__description"
3004
+ }, Ha = /* @__PURE__ */ me({
3005
+ name: "QyRecordQuoteSearch",
3006
+ inheritAttrs: !1,
3007
+ __name: "index",
3008
+ props: {
3009
+ modelValue: { default: "" },
3010
+ loading: { type: Boolean, default: !1 },
3011
+ disabled: { type: Boolean, default: !1 },
3012
+ placeholder: { default: "请输入报价单号" },
3013
+ buttonText: { default: "查询报价单" },
3014
+ autoNormalize: { type: Boolean, default: !0 },
3015
+ showStatus: { type: Boolean, default: !0 },
3016
+ status: { default: "default" },
3017
+ statusText: { default: "" },
3018
+ suggestions: { default: () => [] },
3019
+ fetchSuggestions: { type: [Function, null], default: null },
3020
+ fetchSuggestionsMethod: { type: [Function, null], default: null },
3021
+ debounce: { default: 300 },
3022
+ minLength: { default: 1 },
3023
+ searchOnSelect: { type: Boolean, default: !0 },
3024
+ searchMethod: { type: [Function, null], default: null },
3025
+ extractMethod: { type: [Function, null], default: null },
3026
+ normalizeMethod: { type: [Function, null], default: null },
3027
+ label: { default: "报价单号" },
3028
+ description: { default: "" },
3029
+ trimMode: { default: "blur" }
3030
+ },
3031
+ emits: ["update:modelValue", "search", "clear", "normalize", "enter", "select", "error", "success"],
3032
+ setup(t, { expose: g, emit: b }) {
3033
+ const e = t, a = b, A = be(), r = Q(null), d = Q(!1), f = F(() => e.statusText || ""), B = F(() => e.loading || d.value);
3034
+ function q(l) {
3035
+ return l == null ? "" : String(l);
3036
+ }
3037
+ function D(l) {
3038
+ const o = q(l).trim(), P = I(o), oe = P.match(/BJ\d{8}[A-Z0-9]{4}/i);
3039
+ return oe ? oe[0] : P;
3040
+ }
3041
+ function I(l) {
3042
+ return q(l).replace(/\s+/g, "").trim().toUpperCase();
3043
+ }
3044
+ function R(l) {
3045
+ return e.extractMethod ? e.extractMethod(l) : D(l);
3046
+ }
3047
+ function y(l) {
3048
+ return e.normalizeMethod ? e.normalizeMethod(l) : I(l);
3049
+ }
3050
+ function H(l, o) {
3051
+ const P = q(l), oe = R(P), m = e.autoNormalize ? y(oe) : oe;
3052
+ return a("normalize", { rawValue: P, code: m }), {
3053
+ rawValue: P,
3054
+ code: m,
3055
+ item: o
3056
+ };
3057
+ }
3058
+ function T(l) {
3059
+ a("update:modelValue", l);
3060
+ }
3061
+ async function N(l) {
3062
+ if (a("search", l), !!e.searchMethod) {
3063
+ d.value = !0;
3064
+ try {
3065
+ const o = await e.searchMethod(l);
3066
+ a("success", o);
3067
+ } catch (o) {
3068
+ a("error", o);
3069
+ } finally {
3070
+ d.value = !1;
3071
+ }
3072
+ }
3073
+ }
3074
+ function L(l) {
3075
+ const o = H(l);
3076
+ o.code !== q(e.modelValue) && a("update:modelValue", o.code), N(o);
3077
+ }
3078
+ function c() {
3079
+ a("clear");
3080
+ }
3081
+ function x(l) {
3082
+ a("enter", l);
3083
+ }
3084
+ function u(l) {
3085
+ if (a("select", l), !e.searchOnSelect) return;
3086
+ const o = H(l.value, l);
3087
+ o.code !== q(e.modelValue) && a("update:modelValue", o.code), N(o);
3088
+ }
3089
+ function Z(l) {
3090
+ a("error", l);
3091
+ }
3092
+ function _() {
3093
+ var l, o;
3094
+ (o = (l = r.value) == null ? void 0 : l.focus) == null || o.call(l);
3095
+ }
3096
+ function w() {
3097
+ var l, o;
3098
+ (o = (l = r.value) == null ? void 0 : l.blur) == null || o.call(l);
3099
+ }
3100
+ function v() {
3101
+ var l, o;
3102
+ (o = (l = r.value) == null ? void 0 : l.select) == null || o.call(l);
3103
+ }
3104
+ function U() {
3105
+ var l, o;
3106
+ (o = (l = r.value) == null ? void 0 : l.clear) == null || o.call(l);
3107
+ }
3108
+ return g({
3109
+ focus: _,
3110
+ blur: w,
3111
+ select: v,
3112
+ clear: U,
3113
+ extractQuoteOrderCode: R,
3114
+ normalizeQuoteOrderCode: y
3115
+ }), (l, o) => (S(), W("div", Ea, [
3116
+ M(l.$slots, "label", {}, () => [
3117
+ t.label || t.description ? (S(), W("div", La, [
3118
+ t.label ? (S(), W("div", ja, he(t.label), 1)) : J("", !0),
3119
+ t.description ? (S(), W("div", Na, he(t.description), 1)) : J("", !0)
3120
+ ])) : J("", !0)
3121
+ ], !0),
3122
+ Y(At, fe({
3123
+ ref_key: "searchRef",
3124
+ ref: r
3125
+ }, C(A), {
3126
+ "model-value": t.modelValue,
3127
+ loading: B.value,
3128
+ disabled: t.disabled,
3129
+ placeholder: t.placeholder,
3130
+ "remove-space": !0,
3131
+ "trim-mode": t.trimMode,
3132
+ "button-text": t.buttonText,
3133
+ suggestions: t.suggestions,
3134
+ "fetch-suggestions": t.fetchSuggestions,
3135
+ "fetch-suggestions-method": t.fetchSuggestionsMethod,
3136
+ debounce: t.debounce,
3137
+ "min-length": t.minLength,
3138
+ "search-on-select": !1,
3139
+ "onUpdate:modelValue": T,
3140
+ onSearch: L,
3141
+ onClear: c,
3142
+ onEnter: x,
3143
+ onSelect: u,
3144
+ onError: Z
3145
+ }), Pe({ _: 2 }, [
3146
+ l.$slots.prefix ? {
3147
+ name: "prefix",
3148
+ fn: k(() => [
3149
+ M(l.$slots, "prefix", {}, void 0, !0)
3150
+ ]),
3151
+ key: "0"
3152
+ } : void 0,
3153
+ l.$slots.suffix ? {
3154
+ name: "suffix",
3155
+ fn: k(() => [
3156
+ M(l.$slots, "suffix", {}, void 0, !0)
3157
+ ]),
3158
+ key: "1"
3159
+ } : void 0,
3160
+ l.$slots.item ? {
3161
+ name: "item",
3162
+ fn: k((P) => [
3163
+ M(l.$slots, "item", Ke(Ee(P)), void 0, !0)
3164
+ ]),
3165
+ key: "2"
3166
+ } : void 0,
3167
+ l.$slots.empty ? {
3168
+ name: "empty",
3169
+ fn: k(() => [
3170
+ M(l.$slots, "empty", {}, void 0, !0)
3171
+ ]),
3172
+ key: "3"
3173
+ } : void 0,
3174
+ l.$slots.loading ? {
3175
+ name: "loading",
3176
+ fn: k(() => [
3177
+ M(l.$slots, "loading", {}, void 0, !0)
3178
+ ]),
3179
+ key: "4"
3180
+ } : void 0
3181
+ ]), 1040, ["model-value", "loading", "disabled", "placeholder", "trim-mode", "button-text", "suggestions", "fetch-suggestions", "fetch-suggestions-method", "debounce", "min-length"]),
3182
+ t.showStatus && f.value ? M(l.$slots, "status", {
3183
+ key: 0,
3184
+ status: t.status,
3185
+ statusText: f.value
3186
+ }, () => [
3187
+ G("div", {
3188
+ class: Ve(["qy-record-quote-search__status", `is-${t.status}`])
3189
+ }, he(f.value), 3)
3190
+ ], !0) : J("", !0)
3191
+ ]));
3192
+ }
3193
+ }), Wa = /* @__PURE__ */ Ae(Ha, [["__scopeId", "data-v-3a314f64"]]), Rt = /* @__PURE__ */ me({
3194
+ name: "QyTreeSelect",
3195
+ inheritAttrs: !1,
3196
+ __name: "index",
3197
+ props: {
3198
+ modelValue: { type: [String, Number, Boolean, Array, null], default: void 0 },
3199
+ options: { default: () => [] },
3200
+ data: { default: void 0 },
3201
+ labelKey: { default: "label" },
3202
+ valueKey: { default: "value" },
3203
+ childrenKey: { default: "children" },
3204
+ disabledKey: { default: "disabled" },
3205
+ props: { default: () => ({}) },
3206
+ placeholder: { default: "请选择" },
3207
+ disabled: { type: Boolean, default: !1 },
3208
+ clearable: { type: Boolean, default: !1 },
3209
+ filterable: { type: Boolean, default: !1 },
3210
+ multiple: { type: Boolean, default: !1 },
3211
+ collapseTags: { type: Boolean, default: !1 },
3212
+ collapseTagsTooltip: { type: Boolean, default: !1 },
3213
+ checkStrictly: { type: Boolean, default: !1 },
3214
+ defaultExpandAll: { type: Boolean, default: !1 },
3215
+ renderAfterExpand: { type: Boolean, default: !0 },
3216
+ size: { default: void 0 },
3217
+ teleported: { type: Boolean, default: !0 },
3218
+ appendTo: { default: void 0 },
3219
+ fitInputWidth: { type: Boolean, default: !1 },
3220
+ popperClass: { default: "" }
3221
+ },
3222
+ emits: ["update:modelValue", "change", "clear", "visible-change", "focus", "blur"],
3223
+ setup(t, { expose: g, emit: b }) {
3224
+ const e = t, a = b, A = be(), r = Q(null), d = F(
3225
+ () => ["qy-tree-select__popper", e.popperClass].filter(Boolean).join(" ")
3226
+ ), f = F(() => ({
3227
+ label: "label",
3228
+ value: "value",
3229
+ children: "children",
3230
+ disabled: "disabled",
3231
+ ...e.props
3232
+ })), B = F(
3233
+ () => {
3234
+ var c;
3235
+ return q((c = e.options) != null && c.length ? e.options : e.data || []);
3236
+ }
3237
+ );
3238
+ function q(c) {
3239
+ return c.map((x) => {
3240
+ const u = x == null ? void 0 : x[e.childrenKey];
3241
+ return {
3242
+ ...x,
3243
+ label: (x == null ? void 0 : x[e.labelKey]) ?? (x == null ? void 0 : x.label) ?? (x == null ? void 0 : x.value) ?? "",
3244
+ value: (x == null ? void 0 : x[e.valueKey]) ?? (x == null ? void 0 : x.value) ?? (x == null ? void 0 : x.label),
3245
+ disabled: !!(x != null && x[e.disabledKey]),
3246
+ children: Array.isArray(u) ? q(u) : u
3247
+ };
3248
+ });
3249
+ }
3250
+ function D(c) {
3251
+ a("update:modelValue", c);
3252
+ }
3253
+ function I(c) {
3254
+ a("change", c);
3255
+ }
3256
+ function R() {
3257
+ a("clear");
3258
+ }
3259
+ function y(c) {
3260
+ a("visible-change", c);
3261
+ }
3262
+ function H(c) {
3263
+ a("focus", c);
3264
+ }
3265
+ function T(c) {
3266
+ a("blur", c);
3267
+ }
3268
+ function N() {
3269
+ var c, x;
3270
+ (x = (c = r.value) == null ? void 0 : c.focus) == null || x.call(c);
3271
+ }
3272
+ function L() {
3273
+ var c, x;
3274
+ (x = (c = r.value) == null ? void 0 : c.blur) == null || x.call(c);
3275
+ }
3276
+ return g({
3277
+ // 暴露最常用的焦点控制;复杂树选择能力仍通过 attrs 透传给 Element Plus。
3278
+ focus: N,
3279
+ blur: L
3280
+ }), (c, x) => (S(), le(C(Ct), fe({
3281
+ ref_key: "treeSelectRef",
3282
+ ref: r
3283
+ }, C(A), {
3284
+ "model-value": t.modelValue,
3285
+ data: B.value,
3286
+ props: f.value,
3287
+ placeholder: t.placeholder,
3288
+ disabled: t.disabled,
3289
+ clearable: t.clearable,
3290
+ filterable: t.filterable,
3291
+ multiple: t.multiple,
3292
+ "collapse-tags": t.collapseTags,
3293
+ "collapse-tags-tooltip": t.collapseTagsTooltip,
3294
+ "check-strictly": t.checkStrictly,
3295
+ "default-expand-all": t.defaultExpandAll,
3296
+ "render-after-expand": t.renderAfterExpand,
3297
+ size: t.size,
3298
+ teleported: t.teleported,
3299
+ "append-to": t.appendTo,
3300
+ "fit-input-width": t.fitInputWidth,
3301
+ "popper-class": d.value,
3302
+ "onUpdate:modelValue": D,
3303
+ onChange: I,
3304
+ onClear: R,
3305
+ onVisibleChange: y,
3306
+ onFocus: H,
3307
+ onBlur: T
3308
+ }), Pe({ _: 2 }, [
3309
+ c.$slots.prefix ? {
3310
+ name: "prefix",
3311
+ fn: k(() => [
3312
+ M(c.$slots, "prefix")
3313
+ ]),
3314
+ key: "0"
3315
+ } : void 0,
3316
+ c.$slots.empty ? {
3317
+ name: "empty",
3318
+ fn: k(() => [
3319
+ M(c.$slots, "empty")
3320
+ ]),
3321
+ key: "1"
3322
+ } : void 0,
3323
+ c.$slots.tag ? {
3324
+ name: "tag",
3325
+ fn: k((u) => [
3326
+ M(c.$slots, "tag", Ke(Ee(u)))
3327
+ ]),
3328
+ key: "2"
3329
+ } : void 0,
3330
+ c.$slots.default ? {
3331
+ name: "default",
3332
+ fn: k((u) => [
3333
+ M(c.$slots, "default", Ke(Ee(u)))
3334
+ ]),
3335
+ key: "3"
3336
+ } : void 0
3337
+ ]), 1040, ["model-value", "data", "props", "placeholder", "disabled", "clearable", "filterable", "multiple", "collapse-tags", "collapse-tags-tooltip", "check-strictly", "default-expand-all", "render-after-expand", "size", "teleported", "append-to", "fit-input-width", "popper-class"]));
3338
+ }
3339
+ }), Za = { class: "qy-selection-dialog" }, Ga = { class: "qy-selection-dialog__main" }, Xa = {
3340
+ key: 0,
3341
+ class: "qy-selection-dialog__selected"
3342
+ }, Ja = { class: "qy-selection-dialog__selected-tags" }, Ya = {
3343
+ key: 0,
3344
+ class: "qy-selection-dialog__selected-actions"
3345
+ }, _a = {
3346
+ key: 1,
3347
+ class: "qy-selection-dialog__search-row"
3348
+ }, en = {
3349
+ key: 0,
3350
+ class: "qy-selection-dialog__toolbar"
3351
+ }, tn = {
3352
+ key: 2,
3353
+ class: "qy-selection-dialog__pagination"
3354
+ }, ln = { class: "qy-selection-dialog__paste-actions" }, an = /* @__PURE__ */ me({
3355
+ name: "QySelectionDialog",
3356
+ inheritAttrs: !1,
3357
+ __name: "index",
3358
+ props: {
3359
+ modelValue: { default: () => [] },
3360
+ open: { type: Boolean, default: !0 },
3361
+ title: { default: "选择数据" },
3362
+ width: { default: "1200px" },
3363
+ fetchMethod: { type: Function, default: void 0 },
3364
+ query: { type: Function, default: void 0 },
3365
+ responseFormatter: { type: Function, default: void 0 },
3366
+ selectionMode: { default: void 0 },
3367
+ selection: { default: "single" },
3368
+ selected: { default: () => [] },
3369
+ rowKey: { default: "id" },
3370
+ mainKey: { default: void 0 },
3371
+ labelKey: { default: "name" },
3372
+ tagName: { default: void 0 },
3373
+ searchKey: { default: "conditions" },
3374
+ queryParams: { default: () => ({}) },
3375
+ category: { type: [Array, Function, Boolean], default: !1 },
3376
+ categoryFormatter: { type: [Function, Array], default: void 0 },
3377
+ categoryOptions: { default: () => [] },
3378
+ categoryFetchMethod: { type: [Function, null], default: null },
3379
+ type: { type: [Array, Boolean], default: !1 },
3380
+ typeOptions: { default: () => [] },
3381
+ typeSelectionProps: { default: () => ({}) },
3382
+ typeSelectProps: { default: () => ({}) },
3383
+ tableProps: { default: () => ({}) },
3384
+ showSelected: { type: Boolean, default: !0 },
3385
+ showSearch: { type: Boolean, default: !0 },
3386
+ showPagination: { type: Boolean, default: !0 },
3387
+ showCopyPaste: { type: Boolean, default: !1 },
3388
+ append: { type: Boolean, default: !1 },
3389
+ showAppend: { type: Boolean, default: !1 },
3390
+ pageSizes: { default: () => [10, 20, 50, 100] }
3391
+ },
3392
+ emits: ["update:modelValue", "selection-change", "confirm", "submit", "cancel", "close", "append", "loaded"],
3393
+ setup(t, { expose: g, emit: b }) {
3394
+ const e = t, a = b, A = be(), r = nt(), d = yl(), f = Q(null), B = Q([]), q = Q([]), D = Q([]), I = Q(!1), R = Q(0), y = Q(!1), H = Q(""), T = _e({
3395
+ category: [],
3396
+ type: "",
3397
+ page: 1,
3398
+ pageSize: 10,
3399
+ ...e.searchKey ? { [e.searchKey]: "" } : {},
3400
+ ...e.queryParams
3401
+ }), N = F(() => e.selectionMode ? e.selectionMode : e.selection === "multi" ? "multiple" : e.selection), L = F(() => e.mainKey || e.rowKey), c = F(() => e.tagName || e.labelKey), x = F(() => e.typeOptions.length ? e.typeOptions : e.type || []), u = F(() => ({
3402
+ ...e.typeSelectionProps,
3403
+ ...e.typeSelectProps
3404
+ })), Z = F(() => e.tableProps || {}), _ = F(
3405
+ () => e.showSearch || !!A["search-visible"]
3406
+ ), w = F(() => e.showAppend || e.append), v = F(
3407
+ () => w.value || !!r.toolbar || !!r.bar
3408
+ ), U = F(() => e.fetchMethod || e.query), l = F(() => o() ? e.modelValue : e.selected);
3409
+ function o() {
3410
+ const p = (d == null ? void 0 : d.vnode.props) || {};
3411
+ return Object.prototype.hasOwnProperty.call(p, "modelValue") || Object.prototype.hasOwnProperty.call(p, "model-value") || Object.prototype.hasOwnProperty.call(p, "onUpdate:modelValue");
3412
+ }
3413
+ de(
3414
+ [() => e.modelValue, () => e.selected, () => e.open],
3415
+ () => {
3416
+ e.open && (q.value = Re(l.value), ne());
3417
+ },
3418
+ { immediate: !0, deep: !0 }
3419
+ ), de(
3420
+ [() => e.categoryOptions, () => e.category],
3421
+ (p) => {
3422
+ if (Array.isArray(e.category) && e.category.length) {
3423
+ D.value = e.category;
3424
+ return;
3425
+ }
3426
+ D.value = e.categoryOptions || [];
3427
+ },
3428
+ { immediate: !0 }
3429
+ ), de(y, (p) => {
3430
+ p || (H.value = "");
3431
+ });
3432
+ async function P() {
3433
+ q.value = Re(l.value), await oe(), await m(), ne();
3434
+ }
3435
+ async function oe() {
3436
+ const p = e.categoryFetchMethod || (typeof e.category == "function" ? e.category : null);
3437
+ if (!p) return;
3438
+ const h = await p();
3439
+ D.value = ye(h);
3440
+ }
3441
+ async function m() {
3442
+ if (U.value) {
3443
+ I.value = !0;
3444
+ try {
3445
+ const p = await U.value($e()), h = e.responseFormatter ? await e.responseFormatter(p) : p, { rows: te, total: n } = ie(h);
3446
+ return B.value = te, R.value = n, a("loaded", te), ne(), h;
3447
+ } finally {
3448
+ I.value = !1;
3449
+ }
3450
+ }
3451
+ }
3452
+ function $() {
3453
+ return T.page = 1, m();
3454
+ }
3455
+ function j() {
3456
+ return T.page = 1, m();
3457
+ }
3458
+ function z() {
3459
+ return Object.assign(T, {
3460
+ category: [],
3461
+ type: "",
3462
+ page: 1,
3463
+ pageSize: T.pageSize,
3464
+ ...e.searchKey ? { [e.searchKey]: "" } : {},
3465
+ ...e.queryParams
3466
+ }), m();
3467
+ }
3468
+ function X() {
3469
+ a("append");
3470
+ }
3471
+ function ie(p) {
3472
+ if (Array.isArray(p))
3473
+ return { rows: p, total: p.length };
3474
+ const h = p == null ? void 0 : p.data;
3475
+ if (Array.isArray(h))
3476
+ return { rows: h, total: (p == null ? void 0 : p.total) ?? h.length };
3477
+ const te = (p == null ? void 0 : p.records) || (p == null ? void 0 : p.rows) || (h == null ? void 0 : h.records) || [], n = (p == null ? void 0 : p.total) ?? (h == null ? void 0 : h.total) ?? te.length;
3478
+ return { rows: te, total: n };
3479
+ }
3480
+ function ye(p) {
3481
+ const h = (p == null ? void 0 : p.data) ?? p;
3482
+ if (!Array.isArray(h)) return [];
3483
+ if (typeof e.categoryFormatter == "function")
3484
+ return e.categoryFormatter(h);
3485
+ if (Array.isArray(e.categoryFormatter)) {
3486
+ const [te, n] = e.categoryFormatter;
3487
+ return h.map((s) => ({
3488
+ ...s,
3489
+ label: s[te],
3490
+ value: s[n],
3491
+ children: Array.isArray(s.children) ? we(s.children, te, n) : s.children
3492
+ }));
3493
+ }
3494
+ return h;
3495
+ }
3496
+ function we(p, h, te) {
3497
+ return p.map((n) => ({
3498
+ ...n,
3499
+ label: n[h],
3500
+ value: n[te],
3501
+ children: Array.isArray(n.children) ? we(n.children, h, te) : n.children
3502
+ }));
3503
+ }
3504
+ function $e() {
3505
+ const p = { ...e.queryParams, ...T };
3506
+ return e.searchKey && (p[e.searchKey] = String(p[e.searchKey] || "").trim()), p.category = V(), p;
3507
+ }
3508
+ function V() {
3509
+ if (Object.prototype.hasOwnProperty.call(e.queryParams, "category"))
3510
+ return e.queryParams.category;
3511
+ const p = T.category;
3512
+ return Array.isArray(p) ? p : p ? [p] : [];
3513
+ }
3514
+ function ae(p) {
3515
+ var h, te;
3516
+ if (N.value !== "none") {
3517
+ if (N.value === "single") {
3518
+ q.value = [p], (h = f.value) == null || h.setCurrentRow(p), Oe();
3519
+ return;
3520
+ }
3521
+ Ce(p) && ((te = f.value) == null || te.toggleRowSelection(p, !Be(p)));
3522
+ }
3523
+ }
3524
+ function i(p) {
3525
+ if (N.value !== "multiple") return;
3526
+ const h = new Set(B.value.map(pe)), te = new Set(p.map(pe));
3527
+ q.value = q.value.filter(
3528
+ (n) => !h.has(pe(n)) || te.has(pe(n))
3529
+ ), p.forEach((n) => {
3530
+ Be(n) || q.value.push(n);
3531
+ }), Oe();
3532
+ }
3533
+ function O(p) {
3534
+ var te, n;
3535
+ q.value = q.value.filter(
3536
+ (s) => pe(s) !== pe(p)
3537
+ );
3538
+ const h = B.value.find((s) => pe(s) === pe(p));
3539
+ h && (N.value === "multiple" ? (te = f.value) == null || te.toggleRowSelection(h, !1) : (n = f.value) == null || n.setCurrentRow()), Oe();
3540
+ }
3541
+ function ne() {
3542
+ Le(() => {
3543
+ var p;
3544
+ if (f.value) {
3545
+ if (N.value === "single") {
3546
+ const [h] = q.value, te = B.value.find(
3547
+ (n) => h && pe(n) === pe(h)
3548
+ );
3549
+ (p = f.value) == null || p.setCurrentRow(te);
3550
+ return;
3551
+ }
3552
+ N.value === "multiple" && B.value.forEach((h) => {
3553
+ var te;
3554
+ (te = f.value) == null || te.toggleRowSelection(h, Be(h));
3555
+ });
3556
+ }
3557
+ });
3558
+ }
3559
+ function Ce(p) {
3560
+ var te;
3561
+ const h = (te = Z.value) == null ? void 0 : te.selectable;
3562
+ return typeof h == "function" ? h(p) !== !1 : !0;
3563
+ }
3564
+ function Be(p) {
3565
+ return q.value.some((h) => pe(h) === pe(p));
3566
+ }
3567
+ function pe(p) {
3568
+ return He(p, L.value);
3569
+ }
3570
+ function De(p) {
3571
+ return He(p, c.value) ?? pe(p);
3572
+ }
3573
+ function He(p, h) {
3574
+ if (!(!p || !h))
3575
+ return h.split(".").reduce((te, n) => te == null ? void 0 : te[n], p);
3576
+ }
3577
+ function Oe() {
3578
+ const p = Re(q.value);
3579
+ a("selection-change", p);
3580
+ }
3581
+ function Ge() {
3582
+ const p = Re(q.value);
3583
+ a("update:modelValue", p), a("confirm", p), a("submit", { selection: p, rows: p, query: { ...T } });
3584
+ }
3585
+ function We() {
3586
+ q.value = Re(l.value), a("cancel"), a("close");
3587
+ }
3588
+ async function Xe() {
3589
+ var h;
3590
+ const p = JSON.stringify(q.value);
3591
+ await ((h = navigator.clipboard) == null ? void 0 : h.writeText(p)), xe.success("复制成功");
3592
+ }
3593
+ function Fe() {
3594
+ try {
3595
+ const p = JSON.parse(H.value);
3596
+ if (!Array.isArray(p)) {
3597
+ xe.error("粘贴内容需要是数组");
3598
+ return;
3599
+ }
3600
+ p.forEach((h) => {
3601
+ Be(h) || q.value.push(h);
3602
+ }), y.value = !1, Oe(), ne();
3603
+ } catch (p) {
3604
+ xe.error(`粘贴错误: ${(p == null ? void 0 : p.message) || "内容格式错误"}`);
3605
+ }
3606
+ }
3607
+ function Re(p = []) {
3608
+ return p.map((h) => ({ ...h }));
3609
+ }
3610
+ return g({
3611
+ search: $,
3612
+ handleSearch: m,
3613
+ handleQuerySearch: $,
3614
+ resetSearch: z,
3615
+ getTableRef: () => f.value,
3616
+ getTableData: () => B.value,
3617
+ getSelection: () => Re(q.value)
3618
+ }), (p, h) => {
3619
+ const te = il;
3620
+ return S(), le(tt, fe(C(A), {
3621
+ "model-value": t.open,
3622
+ title: t.title,
3623
+ width: t.width,
3624
+ "destroy-on-close": "",
3625
+ draggable: "",
3626
+ "align-center": "",
3627
+ "append-to-body": "",
3628
+ onOpened: P,
3629
+ onConfirm: Ge,
3630
+ onCancel: We
3631
+ }), {
3632
+ default: k(() => [
3633
+ G("div", Za, [
3634
+ M(p.$slots, "side", {}, void 0, !0),
3635
+ G("div", Ga, [
3636
+ t.showSelected ? (S(), W("div", Xa, [
3637
+ h[12] || (h[12] = G("span", { class: "qy-selection-dialog__selected-label" }, "已选项", -1)),
3638
+ G("div", Ja, [
3639
+ (S(!0), W(Ie, null, je(q.value, (n) => (S(), le(C(yt), {
3640
+ key: pe(n),
3641
+ closable: "",
3642
+ class: "qy-selection-dialog__selected-tag",
3643
+ onClose: (s) => O(n)
3644
+ }, {
3645
+ default: k(() => [
3646
+ ve(he(De(n)), 1)
3647
+ ]),
3648
+ _: 2
3649
+ }, 1032, ["onClose"]))), 128)),
3650
+ q.value.length ? J("", !0) : (S(), le(C(yt), {
3651
+ key: 0,
3652
+ type: "info"
3653
+ }, {
3654
+ default: k(() => [...h[9] || (h[9] = [
3655
+ ve("无", -1)
3656
+ ])]),
3657
+ _: 1
3658
+ }))
3659
+ ]),
3660
+ t.showCopyPaste ? (S(), W("div", Ya, [
3661
+ Y(C(qe), {
3662
+ size: "small",
3663
+ onClick: Xe
3664
+ }, {
3665
+ default: k(() => [...h[10] || (h[10] = [
3666
+ ve("复制", -1)
3667
+ ])]),
3668
+ _: 1
3669
+ }),
3670
+ Y(C(qe), {
3671
+ size: "small",
3672
+ onClick: h[0] || (h[0] = (n) => y.value = !0)
3673
+ }, {
3674
+ default: k(() => [...h[11] || (h[11] = [
3675
+ ve("粘贴", -1)
3676
+ ])]),
3677
+ _: 1
3678
+ })
3679
+ ])) : J("", !0)
3680
+ ])) : J("", !0),
3681
+ _.value ? (S(), W("div", _a, [
3682
+ Y(C($t), {
3683
+ class: "qy-selection-dialog__search",
3684
+ inline: "",
3685
+ model: T
3686
+ }, {
3687
+ default: k(() => [
3688
+ M(p.$slots, "search", {
3689
+ query: T,
3690
+ search: $,
3691
+ reset: z
3692
+ }, () => [
3693
+ D.value.length ? (S(), le(C(Te), {
3694
+ key: 0,
3695
+ label: "分类"
3696
+ }, {
3697
+ default: k(() => [
3698
+ Y(Rt, {
3699
+ modelValue: T.category,
3700
+ "onUpdate:modelValue": h[1] || (h[1] = (n) => T.category = n),
3701
+ class: "qy-selection-dialog__category",
3702
+ options: D.value,
3703
+ clearable: "",
3704
+ filterable: "",
3705
+ "check-strictly": "",
3706
+ "render-after-expand": !1,
3707
+ onChange: $
3708
+ }, null, 8, ["modelValue", "options"])
3709
+ ]),
3710
+ _: 1
3711
+ })) : J("", !0),
3712
+ x.value.length ? (S(), le(C(Te), {
3713
+ key: 1,
3714
+ label: "类型"
3715
+ }, {
3716
+ default: k(() => [
3717
+ Y(it, fe({
3718
+ modelValue: T.type,
3719
+ "onUpdate:modelValue": h[2] || (h[2] = (n) => T.type = n),
3720
+ class: "qy-selection-dialog__type",
3721
+ options: x.value,
3722
+ placeholder: "请选择类型",
3723
+ clearable: ""
3724
+ }, u.value, { onChange: $ }), null, 16, ["modelValue", "options"])
3725
+ ]),
3726
+ _: 1
3727
+ })) : J("", !0),
3728
+ t.searchKey ? (S(), le(C(Te), {
3729
+ key: 2,
3730
+ label: "搜索"
3731
+ }, {
3732
+ default: k(() => [
3733
+ Y(C(Qe), {
3734
+ modelValue: T[t.searchKey],
3735
+ "onUpdate:modelValue": h[3] || (h[3] = (n) => T[t.searchKey] = n),
3736
+ clearable: "",
3737
+ placeholder: "请输入",
3738
+ class: "qy-selection-dialog__search-input",
3739
+ onKeydown: Ne(ce($, ["prevent"]), ["enter"])
3740
+ }, null, 8, ["modelValue", "onKeydown"])
3741
+ ]),
3742
+ _: 1
3743
+ })) : J("", !0),
3744
+ Y(C(Te), null, {
3745
+ default: k(() => [
3746
+ Y(C(qe), {
3747
+ type: "primary",
3748
+ onClick: $
3749
+ }, {
3750
+ default: k(() => [...h[13] || (h[13] = [
3751
+ ve("查询", -1)
3752
+ ])]),
3753
+ _: 1
3754
+ }),
3755
+ Y(C(qe), { onClick: z }, {
3756
+ default: k(() => [...h[14] || (h[14] = [
3757
+ ve("重置", -1)
3758
+ ])]),
3759
+ _: 1
3760
+ })
3761
+ ]),
3762
+ _: 1
3763
+ })
3764
+ ], !0)
3765
+ ]),
3766
+ _: 3
3767
+ }, 8, ["model"]),
3768
+ v.value ? (S(), W("div", en, [
3769
+ w.value ? (S(), le(C(qe), {
3770
+ key: 0,
3771
+ type: "primary",
3772
+ onClick: X
3773
+ }, {
3774
+ default: k(() => [...h[15] || (h[15] = [
3775
+ ve(" 新增 ", -1)
3776
+ ])]),
3777
+ _: 1
3778
+ })) : J("", !0),
3779
+ M(p.$slots, "toolbar", {
3780
+ query: T,
3781
+ search: $
3782
+ }, void 0, !0),
3783
+ M(p.$slots, "bar", {
3784
+ query: T,
3785
+ search: $
3786
+ }, void 0, !0)
3787
+ ])) : J("", !0)
3788
+ ])) : J("", !0),
3789
+ ot((S(), le(C(zl), fe({
3790
+ ref_key: "tableRef",
3791
+ ref: f,
3792
+ data: B.value,
3793
+ "row-key": L.value,
3794
+ border: "",
3795
+ "highlight-current-row": "",
3796
+ "max-height": "550px"
3797
+ }, Z.value, {
3798
+ onSelectionChange: i,
3799
+ onRowClick: ae
3800
+ }), {
3801
+ default: k(() => {
3802
+ var n;
3803
+ return [
3804
+ N.value === "multiple" ? (S(), le(C(ql), {
3805
+ key: 0,
3806
+ type: "selection",
3807
+ "reserve-selection": "",
3808
+ width: "42",
3809
+ selectable: (n = Z.value) == null ? void 0 : n.selectable
3810
+ }, null, 8, ["selectable"])) : J("", !0),
3811
+ M(p.$slots, "columns", {}, void 0, !0),
3812
+ M(p.$slots, "cols", {}, void 0, !0)
3813
+ ];
3814
+ }),
3815
+ _: 3
3816
+ }, 16, ["data", "row-key"])), [
3817
+ [te, I.value]
3818
+ ]),
3819
+ t.showPagination && R.value > 0 ? (S(), W("div", tn, [
3820
+ Y(C(Il), {
3821
+ "current-page": T.page,
3822
+ "onUpdate:currentPage": h[4] || (h[4] = (n) => T.page = n),
3823
+ "page-size": T.pageSize,
3824
+ "onUpdate:pageSize": h[5] || (h[5] = (n) => T.pageSize = n),
3825
+ total: R.value,
3826
+ "page-sizes": t.pageSizes,
3827
+ layout: "total, sizes, prev, pager, next, jumper",
3828
+ onSizeChange: j,
3829
+ onCurrentChange: m
3830
+ }, null, 8, ["current-page", "page-size", "total", "page-sizes"])
3831
+ ])) : J("", !0)
3832
+ ])
3833
+ ]),
3834
+ Y(tt, {
3835
+ modelValue: y.value,
3836
+ "onUpdate:modelValue": h[8] || (h[8] = (n) => y.value = n),
3837
+ title: "粘贴数据",
3838
+ layout: !1,
3839
+ width: "560px"
3840
+ }, {
3841
+ default: k(() => [
3842
+ Y(C(Qe), {
3843
+ modelValue: H.value,
3844
+ "onUpdate:modelValue": h[6] || (h[6] = (n) => H.value = n),
3845
+ type: "textarea",
3846
+ rows: 8
3847
+ }, null, 8, ["modelValue"]),
3848
+ G("div", ln, [
3849
+ Y(C(qe), {
3850
+ onClick: h[7] || (h[7] = (n) => y.value = !1)
3851
+ }, {
3852
+ default: k(() => [...h[16] || (h[16] = [
3853
+ ve("取消", -1)
3854
+ ])]),
3855
+ _: 1
3856
+ }),
3857
+ Y(C(qe), {
3858
+ type: "primary",
3859
+ onClick: Fe
3860
+ }, {
3861
+ default: k(() => [...h[17] || (h[17] = [
3862
+ ve("确认", -1)
3863
+ ])]),
3864
+ _: 1
3865
+ })
3866
+ ])
3867
+ ]),
3868
+ _: 1
3869
+ }, 8, ["modelValue"])
3870
+ ]),
3871
+ _: 3
3872
+ }, 16, ["model-value", "title", "width"]);
3873
+ };
3874
+ }
3875
+ }), Tt = /* @__PURE__ */ Ae(an, [["__scopeId", "data-v-30377f54"]]), nn = /* @__PURE__ */ me({
3876
+ name: "QyLegacySelectionDialog",
3877
+ inheritAttrs: !1,
3878
+ __name: "index",
3879
+ props: {
3880
+ open: { type: Boolean, default: !0 },
3881
+ title: { default: "选择数据" },
3882
+ width: { default: "1200px" },
3883
+ query: { type: Function, default: void 0 },
3884
+ responseFormatter: { type: Function, default: void 0 },
3885
+ selection: { default: "single" },
3886
+ selected: { default: () => [] },
3887
+ mainKey: { default: "" },
3888
+ tagName: { default: "" },
3889
+ searchKey: { default: "conditions" },
3890
+ queryParams: { default: () => ({}) },
3891
+ category: { type: [Array, Function, Boolean], default: !1 },
3892
+ categoryFormatter: { type: [Function, Array], default: void 0 },
3893
+ type: { type: [Array, Boolean], default: !1 },
3894
+ typeSelectionProps: { default: () => ({}) },
3895
+ tableProps: { default: () => ({}) },
3896
+ append: { type: Boolean, default: !1 },
3897
+ delete: { type: Boolean, default: !1 },
3898
+ select: { default: null }
3899
+ },
3900
+ emits: ["close", "submit", "openDialog", "changeIndexShow"],
3901
+ setup(t, { expose: g, emit: b }) {
3902
+ const e = t, a = b, A = be(), r = Q(null), d = _e({
3903
+ category: [],
3904
+ code: "",
3905
+ ...e.searchKey ? { [e.searchKey]: "" } : {},
3906
+ page: 1,
3907
+ pageSize: 10,
3908
+ type: "",
3909
+ ...e.queryParams
3910
+ }), f = _e({
3911
+ total: 0,
3912
+ tableData: [],
3913
+ open: !1,
3914
+ selection: [],
3915
+ categories: [],
3916
+ types: [],
3917
+ tableRef: null,
3918
+ drag: !1,
3919
+ dialogOpen: !1,
3920
+ pasteData: "",
3921
+ pasteDataDialog: !1
3922
+ }), B = F(() => e.type || []), q = F(() => f.categories), D = async (m) => {
3923
+ if (!e.query) return { data: { records: [], total: 0 } };
3924
+ const $ = await e.query(u(m)), j = e.responseFormatter ? await e.responseFormatter($) : $;
3925
+ return f.total = P(j), j;
3926
+ };
3927
+ de(
3928
+ () => e.open,
3929
+ (m) => {
3930
+ f.open = m;
3931
+ },
3932
+ { immediate: !0 }
3933
+ ), de(
3934
+ B,
3935
+ (m) => {
3936
+ f.types = [...m];
3937
+ },
3938
+ { immediate: !0, deep: !0 }
3939
+ ), de(
3940
+ [() => e.selected, () => e.open],
3941
+ () => {
3942
+ e.open && (f.selection = oe(e.selected));
3943
+ },
3944
+ { immediate: !0, deep: !0 }
3945
+ ), de(
3946
+ () => e.queryParams,
3947
+ () => {
3948
+ Object.assign(d, e.queryParams);
3949
+ },
3950
+ { deep: !0 }
3951
+ ), de(
3952
+ () => f.pasteDataDialog,
3953
+ (m) => {
3954
+ m || (f.pasteData = "");
3955
+ }
3956
+ ), de(
3957
+ () => e.select,
3958
+ async () => {
3959
+ e.select && await x(e.select);
3960
+ },
3961
+ { deep: !0 }
3962
+ ), de(
3963
+ () => e.open,
3964
+ async (m) => {
3965
+ m && (f.dialogOpen = !1, await I());
3966
+ },
3967
+ { immediate: !0 }
3968
+ );
3969
+ async function I() {
3970
+ if (!e.category) {
3971
+ f.categories = [];
3972
+ return;
3973
+ }
3974
+ const m = typeof e.category == "function" ? await e.category() : e.category;
3975
+ f.categories = v(m);
3976
+ }
3977
+ async function R() {
3978
+ var m;
3979
+ return await Le(), (m = r.value) == null ? void 0 : m.handleQuerySearch();
3980
+ }
3981
+ function y(m) {
3982
+ f.selection = oe(m);
3983
+ }
3984
+ function H(m) {
3985
+ var $;
3986
+ f.tableData = m, f.tableRef = ($ = r.value) == null ? void 0 : $.getTableRef();
3987
+ }
3988
+ function T(m) {
3989
+ f.selection = oe(m), a("submit", f);
3990
+ }
3991
+ function N() {
3992
+ a("close");
3993
+ }
3994
+ function L() {
3995
+ f.dialogOpen = !0, a("openDialog");
3996
+ }
3997
+ function c(m) {
3998
+ a("changeIndexShow", m);
3999
+ }
4000
+ async function x(m) {
4001
+ if (!e.query || !e.searchKey || !e.mainKey) return;
4002
+ const $ = await e.query({
4003
+ ...d,
4004
+ [e.searchKey]: m[e.mainKey],
4005
+ category: []
4006
+ }), j = e.responseFormatter ? await e.responseFormatter($) : $, [z] = o(j);
4007
+ z && (e.selection === "multi" ? (f.selection = f.selection.filter(
4008
+ (X) => X[e.mainKey] !== z[e.mainKey]
4009
+ ), f.selection.push(z)) : f.selection = [z]);
4010
+ }
4011
+ function u(m = {}) {
4012
+ d.page = m.page ?? d.page, d.pageSize = m.pageSize ?? d.pageSize;
4013
+ const $ = {
4014
+ ...d,
4015
+ category: Z()
4016
+ };
4017
+ return e.searchKey && ($[e.searchKey] = String($[e.searchKey] || "").trim()), $;
4018
+ }
4019
+ function Z() {
4020
+ if (e.queryParams.category)
4021
+ return e.queryParams.category;
4022
+ const m = d.category;
4023
+ if (Array.isArray(m)) return m;
4024
+ if (!m) return [];
4025
+ const $ = _(f.categories, m);
4026
+ return $ ? w($) : [m];
4027
+ }
4028
+ function _(m, $) {
4029
+ for (const j of m || []) {
4030
+ if (j.value === $) return j;
4031
+ const z = _(j.children || [], $);
4032
+ if (z) return z;
4033
+ }
4034
+ }
4035
+ function w(m) {
4036
+ return [m.value, ...(m.children || []).flatMap(w)];
4037
+ }
4038
+ function v(m) {
4039
+ const $ = (m == null ? void 0 : m.data) ?? m;
4040
+ if (!Array.isArray($)) return [];
4041
+ if (typeof e.categoryFormatter == "function")
4042
+ return e.categoryFormatter($);
4043
+ if (Array.isArray(e.categoryFormatter)) {
4044
+ const [j, z] = e.categoryFormatter;
4045
+ return l(U($, z), j, z);
4046
+ }
4047
+ return $;
4048
+ }
4049
+ function U(m, $) {
4050
+ const j = m.map((X) => ({ ...X })), z = [];
4051
+ return j.forEach((X) => {
4052
+ const ie = X.parentCateCode;
4053
+ if (!ie) {
4054
+ z.push(X);
4055
+ return;
4056
+ }
4057
+ const ye = j.find((we) => we[$] === ie);
4058
+ ye ? (ye.children || (ye.children = [])).push(X) : z.push(X);
4059
+ }), z;
4060
+ }
4061
+ function l(m, $, j) {
4062
+ return m.map((z) => ({
4063
+ ...z,
4064
+ label: z[$],
4065
+ value: z[j],
4066
+ children: Array.isArray(z.children) ? l(z.children, $, j) : z.children
4067
+ }));
4068
+ }
4069
+ function o(m) {
4070
+ if (Array.isArray(m)) return m;
4071
+ const $ = m == null ? void 0 : m.data;
4072
+ return Array.isArray($) ? $ : (m == null ? void 0 : m.records) || (m == null ? void 0 : m.rows) || ($ == null ? void 0 : $.records) || [];
4073
+ }
4074
+ function P(m) {
4075
+ if (Array.isArray(m)) return m.length;
4076
+ const $ = o(m), j = m == null ? void 0 : m.data;
4077
+ return (m == null ? void 0 : m.total) ?? (Array.isArray(j) ? j.length : j == null ? void 0 : j.total) ?? $.length;
4078
+ }
4079
+ function oe(m = []) {
4080
+ return m.map(($) => ({ ...$ }));
4081
+ }
4082
+ return g({
4083
+ search: R,
4084
+ handleSearch: R,
4085
+ handleConditionChange: R,
4086
+ getTableRef: () => f.tableRef,
4087
+ getTableData: () => f.tableData,
4088
+ getSelection: () => oe(f.selection)
4089
+ }), (m, $) => (S(), W(Ie, null, [
4090
+ Y(Tt, fe({
4091
+ ref_key: "selectionDialogRef",
4092
+ ref: r
4093
+ }, C(A), {
4094
+ modelValue: f.selection,
4095
+ "onUpdate:modelValue": $[3] || ($[3] = (j) => f.selection = j),
4096
+ open: t.open,
4097
+ title: t.title,
4098
+ width: t.width,
4099
+ query: D,
4100
+ "response-formatter": t.responseFormatter,
4101
+ selection: t.selection,
4102
+ "row-key": t.mainKey,
4103
+ "label-key": t.tagName,
4104
+ "search-key": t.searchKey,
4105
+ "query-params": {},
4106
+ "category-options": q.value,
4107
+ "type-options": B.value,
4108
+ "type-select-props": t.typeSelectionProps,
4109
+ "table-props": t.tableProps,
4110
+ "show-copy-paste": !0,
4111
+ "show-append": t.append,
4112
+ onSelectionChange: y,
4113
+ onConfirm: T,
4114
+ onCancel: N,
4115
+ onAppend: L,
4116
+ onLoaded: H
4117
+ }), {
4118
+ side: k(() => [
4119
+ M(m.$slots, "side", {
4120
+ state: f,
4121
+ cate: f.categories,
4122
+ form: d,
4123
+ query: d,
4124
+ getData: R,
4125
+ search: R,
4126
+ changeIndexShow: c
4127
+ }, void 0, !0)
4128
+ ]),
4129
+ search: k(() => [
4130
+ Y(C($t), {
4131
+ inline: "",
4132
+ model: d
4133
+ }, {
4134
+ default: k(() => [
4135
+ f.categories.length ? (S(), le(C(Te), {
4136
+ key: 0,
4137
+ label: "分类"
4138
+ }, {
4139
+ default: k(() => [
4140
+ Y(C(Ct), {
4141
+ modelValue: d.category,
4142
+ "onUpdate:modelValue": $[0] || ($[0] = (j) => d.category = j),
4143
+ class: "qy-legacy-selection-dialog__category",
4144
+ data: f.categories,
4145
+ clearable: "",
4146
+ filterable: "",
4147
+ "check-strictly": "",
4148
+ "render-after-expand": !1,
4149
+ onChange: R
4150
+ }, null, 8, ["modelValue", "data"])
4151
+ ]),
4152
+ _: 1
4153
+ })) : J("", !0),
4154
+ B.value.length ? (S(), le(C(Te), {
4155
+ key: 1,
4156
+ label: "类型"
4157
+ }, {
4158
+ default: k(() => [
4159
+ Y(C(rt), fe({
4160
+ modelValue: d.type,
4161
+ "onUpdate:modelValue": $[1] || ($[1] = (j) => d.type = j),
4162
+ clearable: ""
4163
+ }, t.typeSelectionProps, { onChange: R }), {
4164
+ default: k(() => [
4165
+ (S(!0), W(Ie, null, je(B.value, (j) => (S(), le(C(ut), {
4166
+ key: j.value,
4167
+ label: j.label,
4168
+ value: j.value
4169
+ }, null, 8, ["label", "value"]))), 128))
4170
+ ]),
4171
+ _: 1
4172
+ }, 16, ["modelValue"])
4173
+ ]),
4174
+ _: 1
4175
+ })) : J("", !0),
4176
+ t.searchKey ? (S(), le(C(Te), {
4177
+ key: 2,
4178
+ label: "搜索"
4179
+ }, {
4180
+ default: k(() => [
4181
+ Y(C(Qe), {
4182
+ modelValue: d[t.searchKey],
4183
+ "onUpdate:modelValue": $[2] || ($[2] = (j) => d[t.searchKey] = j),
4184
+ clearable: "",
4185
+ class: "qy-legacy-selection-dialog__search-input",
4186
+ onKeydown: Ne(ce(R, ["prevent"]), ["enter"])
4187
+ }, null, 8, ["modelValue", "onKeydown"])
4188
+ ]),
4189
+ _: 1
4190
+ })) : J("", !0),
4191
+ Y(C(Te), null, {
4192
+ default: k(() => [
4193
+ Y(C(qe), {
4194
+ type: "primary",
4195
+ onClick: R
4196
+ }, {
4197
+ default: k(() => [...$[4] || ($[4] = [
4198
+ ve("查询", -1)
4199
+ ])]),
4200
+ _: 1
4201
+ })
4202
+ ]),
4203
+ _: 1
4204
+ })
4205
+ ]),
4206
+ _: 1
4207
+ }, 8, ["model"])
4208
+ ]),
4209
+ toolbar: k(() => [
4210
+ M(m.$slots, "bar", {
4211
+ query: d,
4212
+ search: R
4213
+ }, void 0, !0)
4214
+ ]),
4215
+ columns: k(() => [
4216
+ M(m.$slots, "cols", {}, void 0, !0),
4217
+ M(m.$slots, "columns", {}, void 0, !0)
4218
+ ]),
4219
+ _: 3
4220
+ }, 16, ["modelValue", "open", "title", "width", "response-formatter", "selection", "row-key", "label-key", "search-key", "category-options", "type-options", "type-select-props", "table-props", "show-append"]),
4221
+ M(m.$slots, "dialog", {
4222
+ state: f,
4223
+ form: d,
4224
+ getData: R
4225
+ }, void 0, !0)
4226
+ ], 64));
4227
+ }
4228
+ }), on = /* @__PURE__ */ Ae(nn, [["__scopeId", "data-v-b54ca11b"]]), rn = { class: "qy-form-section__heading" }, un = {
4229
+ key: 0,
4230
+ class: "qy-form-section__title"
4231
+ }, sn = {
4232
+ key: 0,
4233
+ class: "qy-form-section__description"
4234
+ }, dn = { class: "qy-form-section__actions" }, cn = /* @__PURE__ */ me({
4235
+ name: "QyFormSection",
4236
+ __name: "index",
4237
+ props: {
4238
+ title: { default: "" },
4239
+ description: { default: "" },
4240
+ tip: { default: "" },
4241
+ tipType: { default: "info" },
4242
+ collapsible: { type: Boolean, default: !1 },
4243
+ defaultExpanded: { type: Boolean, default: !0 },
4244
+ bordered: { type: Boolean, default: !0 },
4245
+ background: { default: "white" },
4246
+ bodyClass: { default: "" },
4247
+ headerClass: { default: "" }
4248
+ },
4249
+ emits: ["toggle"],
4250
+ setup(t, { emit: g }) {
4251
+ const b = t, e = g, a = Q(b.defaultExpanded);
4252
+ de(
4253
+ () => b.defaultExpanded,
4254
+ (d) => {
4255
+ a.value = d;
4256
+ }
4257
+ );
4258
+ function A() {
4259
+ b.collapsible && (a.value = !a.value, e("toggle", a.value));
4260
+ }
4261
+ function r() {
4262
+ b.collapsible && A();
4263
+ }
4264
+ return (d, f) => (S(), W("section", {
4265
+ class: Ve(["qy-form-section", [
4266
+ `is-bg-${t.background}`,
4267
+ {
4268
+ "is-bordered": t.bordered,
4269
+ "is-collapsible": t.collapsible
4270
+ }
4271
+ ]])
4272
+ }, [
4273
+ G("header", {
4274
+ class: Ve(["qy-form-section__header", t.headerClass]),
4275
+ onClick: r
4276
+ }, [
4277
+ G("div", rn, [
4278
+ M(d.$slots, "title", {}, () => [
4279
+ t.title ? (S(), W("div", un, he(t.title), 1)) : J("", !0)
4280
+ ], !0),
4281
+ M(d.$slots, "description", {}, () => [
4282
+ t.description ? (S(), W("div", sn, he(t.description), 1)) : J("", !0)
4283
+ ], !0)
4284
+ ]),
4285
+ G("div", dn, [
4286
+ M(d.$slots, "actions", {}, void 0, !0),
4287
+ t.collapsible ? (S(), W("button", {
4288
+ key: 0,
4289
+ type: "button",
4290
+ class: "qy-form-section__toggle",
4291
+ onClick: ce(A, ["stop"])
4292
+ }, he(a.value ? "收起" : "展开"), 1)) : J("", !0)
4293
+ ])
4294
+ ], 2),
4295
+ ot(G("div", {
4296
+ class: Ve(["qy-form-section__body", t.bodyClass])
4297
+ }, [
4298
+ M(d.$slots, "tip", {}, () => [
4299
+ t.tip ? (S(), W("div", {
4300
+ key: 0,
4301
+ class: Ve(["qy-form-section__tip", `is-${t.tipType}`])
4302
+ }, he(t.tip), 3)) : J("", !0)
4303
+ ], !0),
4304
+ M(d.$slots, "default", {}, void 0, !0)
4305
+ ], 2), [
4306
+ [St, a.value]
4307
+ ])
4308
+ ], 2));
4309
+ }
4310
+ }), fn = /* @__PURE__ */ Ae(cn, [["__scopeId", "data-v-8149aa01"]]), mn = {
4311
+ key: 0,
4312
+ class: "qy-action-bar__left"
4313
+ }, pn = {
4314
+ key: 1,
4315
+ class: "qy-action-bar__center"
4316
+ }, yn = {
4317
+ key: 2,
4318
+ class: "qy-action-bar__right"
4319
+ }, gn = /* @__PURE__ */ me({
4320
+ name: "QyActionBar",
4321
+ __name: "index",
4322
+ props: {
4323
+ sticky: { type: Boolean, default: !0 },
4324
+ offsetBottom: { default: 0 },
4325
+ bordered: { type: Boolean, default: !0 },
4326
+ shadow: { type: Boolean, default: !1 },
4327
+ wrap: { type: Boolean, default: !0 },
4328
+ justify: { default: "between" },
4329
+ background: { default: "#fff" }
4330
+ },
4331
+ setup(t) {
4332
+ const g = t, b = F(() => ({
4333
+ // offsetBottom 只负责业务偏移,安全区补偿由 CSS padding 处理。
4334
+ bottom: `${g.offsetBottom}px`,
4335
+ background: g.background
4336
+ }));
4337
+ return (e, a) => (S(), W("div", {
4338
+ class: Ve(["qy-action-bar", [
4339
+ `is-justify-${t.justify}`,
4340
+ {
4341
+ "is-sticky": t.sticky,
4342
+ "is-bordered": t.bordered,
4343
+ "is-shadow": t.shadow,
4344
+ "is-wrap": t.wrap
4345
+ }
4346
+ ]]),
4347
+ style: Me(b.value)
4348
+ }, [
4349
+ e.$slots.left ? (S(), W("div", mn, [
4350
+ M(e.$slots, "left", {}, void 0, !0)
4351
+ ])) : J("", !0),
4352
+ e.$slots.default ? (S(), W("div", pn, [
4353
+ M(e.$slots, "default", {}, void 0, !0)
4354
+ ])) : J("", !0),
4355
+ e.$slots.right ? (S(), W("div", yn, [
4356
+ M(e.$slots, "right", {}, void 0, !0)
4357
+ ])) : J("", !0)
4358
+ ], 6));
4359
+ }
4360
+ }), hn = /* @__PURE__ */ Ae(gn, [["__scopeId", "data-v-ecba8f49"]]), Pt = ue(zt, "QyUpload"), Ft = ue(na, "QyImage"), Mt = ue(oa, "QyImagePreview"), Ot = ue(ra, "QyImageUpload"), Qt = ue(tt, "QyDialog"), Ut = ue(qa, "QyRemarkImage"), Dt = ue(Ia, "QyInput"), Kt = ue(Aa, "QyInputNumber"), Et = ue(Ra, "QyMoneyInput"), Lt = ue(Ta, "QyDatePicker"), jt = ue(Pa, "QyCheckbox"), Nt = ue(Fa, "QyAutocomplete"), Ht = ue(Pl, "QyMenuActions"), Wt = ue(
4361
+ Fl,
4362
+ "QyTableColumnSettings"
4363
+ ), Zt = ue(Ma, "QyRadioGroup"), Gt = ue(Oa, "QyRemoteSelect"), Xt = ue(At, "QySearchInput"), Jt = ue(
4364
+ Wa,
4365
+ "QyRecordQuoteSearch"
4366
+ ), Yt = ue(it, "QySelect"), _t = ue(Rt, "QyTreeSelect"), el = ue(Tt, "QySelectionDialog"), tl = ue(
4367
+ on,
4368
+ "QyLegacySelectionDialog"
4369
+ ), ll = ue(fn, "QyFormSection"), al = ue(hn, "QyActionBar"), vn = (t) => {
4370
+ t.component("QyDialog", Qt), t.component("QyUpload", Pt), t.component("QyImage", Ft), t.component("QyImagePreview", Mt), t.component("QyImageUpload", Ot), t.component("QyRemarkImage", Ut), t.component("QyInput", Dt), t.component("QyInputNumber", Kt), t.component("QyMoneyInput", Et), t.component("QyDatePicker", Lt), t.component("QyCheckbox", jt), t.component("QyAutocomplete", Nt), t.component("QyMenuActions", Ht), t.component("QyTableColumnSettings", Wt), t.component("QyRadioGroup", Zt), t.component("QyRemoteSelect", Gt), t.component("QySearchInput", Xt), t.component("QyRecordQuoteSearch", Jt), t.component("QySelect", Yt), t.component("QyTreeSelect", _t), t.component("QySelectionDialog", el), t.component("QyLegacySelectionDialog", tl), t.component("QyFormSection", ll), t.component("QyActionBar", al);
4371
+ }, zn = {
4372
+ install: vn,
4373
+ QyUpload: Pt,
4374
+ QyImage: Ft,
4375
+ QyImagePreview: Mt,
4376
+ openQyImagePreview: qt,
4377
+ QyImageUpload: Ot,
4378
+ QyDialog: Qt,
4379
+ QyInput: Dt,
4380
+ QyInputNumber: Kt,
4381
+ QyMoneyInput: Et,
4382
+ QyDatePicker: Lt,
4383
+ QyCheckbox: jt,
4384
+ QyAutocomplete: Nt,
4385
+ QyMenuActions: Ht,
4386
+ QyTableColumnSettings: Wt,
4387
+ QyRadioGroup: Zt,
4388
+ QyRemoteSelect: Gt,
4389
+ QySearchInput: Xt,
4390
+ QyRecordQuoteSearch: Jt,
4391
+ QySelect: Yt,
4392
+ QyTreeSelect: _t,
4393
+ QySelectionDialog: el,
4394
+ QyLegacySelectionDialog: tl,
4395
+ QyFormSection: ll,
4396
+ QyActionBar: al,
4397
+ QyRemarkImage: Ut
4398
+ };
4399
+ export {
4400
+ ht as A,
4401
+ vt as B,
4402
+ al as Q,
4403
+ Nt as a,
4404
+ jt as b,
4405
+ Lt as c,
4406
+ Qt as d,
4407
+ ll as e,
4408
+ Ft as f,
4409
+ Mt as g,
4410
+ Ot as h,
4411
+ Dt as i,
4412
+ Kt as j,
4413
+ tl as k,
4414
+ Ht as l,
4415
+ Et as m,
4416
+ Zt as n,
4417
+ Jt as o,
4418
+ Ut as p,
4419
+ Gt as q,
4420
+ Xt as r,
4421
+ Yt as s,
4422
+ el as t,
4423
+ Wt as u,
4424
+ _t as v,
4425
+ Pt as w,
4426
+ zn as x,
4427
+ va as y,
4428
+ qt as z
4429
+ };