@qynpm/ui 1.0.21 → 1.0.22

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