@qynpm/ui 1.0.10 → 1.0.12

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