@qynpm/ui 1.0.8 → 1.0.11

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