@qynpm/ui 1.0.19 → 1.0.22

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