@qynpm/ui 1.0.10 → 1.0.12

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