@qynpm/ui 1.0.8 → 1.0.10

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 (72) hide show
  1. package/README.md +278 -29
  2. package/dist/index.cjs +2 -2
  3. package/dist/index.mjs +20 -17
  4. package/dist/qy-action-bar/index.cjs +1 -1
  5. package/dist/qy-action-bar/index.mjs +1 -1
  6. package/dist/qy-date-picker/index.cjs +1 -1
  7. package/dist/qy-date-picker/index.mjs +1 -1
  8. package/dist/qy-dialog/index.cjs +1 -1
  9. package/dist/qy-dialog/index.mjs +1 -1
  10. package/dist/qy-form-section/index.cjs +1 -1
  11. package/dist/qy-form-section/index.mjs +2 -2
  12. package/dist/{qy-voucher-upload → qy-image-upload}/index.cjs +1 -1
  13. package/dist/qy-image-upload/index.mjs +4 -0
  14. package/dist/qy-input/index.cjs +1 -1
  15. package/dist/qy-input/index.mjs +1 -1
  16. package/dist/qy-input-number/index.cjs +1 -1
  17. package/dist/qy-input-number/index.mjs +1 -1
  18. package/dist/qy-legacy-selection-dialog/index.cjs +1 -0
  19. package/dist/qy-legacy-selection-dialog/index.mjs +4 -0
  20. package/dist/qy-money-input/index.cjs +1 -1
  21. package/dist/qy-money-input/index.mjs +1 -1
  22. package/dist/qy-radio-group/index.cjs +1 -1
  23. package/dist/qy-radio-group/index.mjs +1 -1
  24. package/dist/qy-record-quote-search/index.cjs +1 -1
  25. package/dist/qy-record-quote-search/index.mjs +1 -1
  26. package/dist/qy-remark-image/index.cjs +1 -1
  27. package/dist/qy-remark-image/index.mjs +1 -1
  28. package/dist/qy-remote-select/index.cjs +1 -1
  29. package/dist/qy-remote-select/index.mjs +1 -1
  30. package/dist/qy-search-input/index.cjs +1 -1
  31. package/dist/qy-search-input/index.mjs +1 -1
  32. package/dist/qy-select/index.cjs +1 -1
  33. package/dist/qy-select/index.mjs +1 -1
  34. package/dist/qy-selection-dialog/index.cjs +1 -0
  35. package/dist/qy-selection-dialog/index.mjs +4 -0
  36. package/dist/qy-tree-select/index.cjs +1 -0
  37. package/dist/qy-tree-select/index.mjs +4 -0
  38. package/dist/qy-upload/index.cjs +1 -1
  39. package/dist/qy-upload/index.mjs +1 -1
  40. package/dist/shared/index-Bk5wZECl.cjs +1 -0
  41. package/dist/shared/index-CulYemoD.mjs +3904 -0
  42. package/index.d.ts +34 -28
  43. package/package.json +24 -6
  44. package/qy-action-bar/index.js +1 -1
  45. package/qy-date-picker/index.d.ts +5 -5
  46. package/qy-date-picker/index.js +1 -1
  47. package/qy-dialog/index.js +1 -1
  48. package/qy-form-section/index.js +1 -1
  49. package/qy-image-upload/index.d.ts +12 -0
  50. package/qy-image-upload/index.js +1 -0
  51. package/qy-input/index.js +1 -1
  52. package/qy-input-number/index.d.ts +5 -5
  53. package/qy-input-number/index.js +1 -1
  54. package/qy-legacy-selection-dialog/index.d.ts +5 -0
  55. package/qy-legacy-selection-dialog/index.js +1 -0
  56. package/qy-money-input/index.js +1 -1
  57. package/qy-radio-group/index.js +1 -1
  58. package/qy-record-quote-search/index.js +1 -1
  59. package/qy-remark-image/index.js +1 -1
  60. package/qy-remote-select/index.js +1 -1
  61. package/qy-search-input/index.js +1 -1
  62. package/qy-select/index.js +1 -1
  63. package/qy-selection-dialog/index.d.ts +5 -0
  64. package/qy-selection-dialog/index.js +1 -0
  65. package/qy-tree-select/index.d.ts +5 -0
  66. package/qy-tree-select/index.js +1 -0
  67. package/qy-upload/index.js +1 -1
  68. package/dist/qy-voucher-upload/index.mjs +0 -4
  69. package/dist/shared/index-C5EAafC0.cjs +0 -1
  70. package/dist/shared/index-DB0Fuuxi.mjs +0 -2784
  71. package/qy-voucher-upload/index.d.ts +0 -12
  72. package/qy-voucher-upload/index.js +0 -1
@@ -1,2784 +0,0 @@
1
- import { ElUpload as Bt, ElIcon as We, ElPopover as Ct, ElInput as zt, ElImageViewer as It, ElDialog as Ge } from "element-plus/es";
2
- import { ref as z, onMounted as De, computed as H, watch as ye, nextTick as Qe, onBeforeUnmount as Xe, createElementBlock as E, openBlock as b, normalizeStyle as Se, normalizeClass as de, createVNode as le, createBlock as ie, createCommentVNode as Z, withCtx as S, withModifiers as te, unref as _, Fragment as Ce, createElementVNode as U, toDisplayString as ne, createTextVNode as Ve, useAttrs as me, mergeProps as ue, defineComponent as ce, mergeModels as je, useSlots as Je, useModel as xt, watchEffect as Mt, h as Ke, onUnmounted as Ye, resolveComponent as Rt, withDirectives as et, createSlots as $e, renderSlot as I, vShow as tt, withKeys as Ue, renderList as lt, resolveDynamicComponent as qt, Comment as Tt, normalizeProps as Oe, guardReactiveProps as Ae } from "vue";
3
- import { Plus as Ft, InfoFilled as Dt } from "@element-plus/icons-vue";
4
- import { ElMessage as he, ElLoading as Qt, ElButton as Re, ElInput as Ee, ElPopover as Ut, ElUpload as Ot, ElInputNumber as At, ElDatePicker as Et, ElRadioButton as Pt, ElRadio as Lt, ElRadioGroup as _t, ElSelect as jt, ElOption as Kt, ElAutocomplete as Nt } from "element-plus";
5
- import Ht from "clsx";
6
- import { useBreakpoints as Zt, useDraggable as Wt } from "@vueuse/core";
7
- /*! js-cookie v3.0.5 | MIT */
8
- function Me(o) {
9
- for (var k = 1; k < arguments.length; k++) {
10
- var M = arguments[k];
11
- for (var e in M)
12
- o[e] = M[e];
13
- }
14
- return o;
15
- }
16
- var Gt = {
17
- read: function(o) {
18
- return o[0] === '"' && (o = o.slice(1, -1)), o.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
19
- },
20
- write: function(o) {
21
- return encodeURIComponent(o).replace(
22
- /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
23
- decodeURIComponent
24
- );
25
- }
26
- };
27
- function Fe(o, k) {
28
- function M(a, x, i) {
29
- if (!(typeof document > "u")) {
30
- i = Me({}, k, i), typeof i.expires == "number" && (i.expires = new Date(Date.now() + i.expires * 864e5)), i.expires && (i.expires = i.expires.toUTCString()), a = encodeURIComponent(a).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
31
- var c = "";
32
- for (var V in i)
33
- i[V] && (c += "; " + V, i[V] !== !0 && (c += "=" + i[V].split(";")[0]));
34
- return document.cookie = a + "=" + o.write(x, a) + c;
35
- }
36
- }
37
- function e(a) {
38
- if (!(typeof document > "u" || arguments.length && !a)) {
39
- for (var x = document.cookie ? document.cookie.split("; ") : [], i = {}, c = 0; c < x.length; c++) {
40
- var V = x[c].split("="), w = V.slice(1).join("=");
41
- try {
42
- var q = decodeURIComponent(V[0]);
43
- if (i[q] = o.read(w, q), a === q)
44
- break;
45
- } catch {
46
- }
47
- }
48
- return a ? i[a] : i;
49
- }
50
- }
51
- return Object.create(
52
- {
53
- set: M,
54
- get: e,
55
- remove: function(a, x) {
56
- M(
57
- a,
58
- "",
59
- Me({}, x, {
60
- expires: -1
61
- })
62
- );
63
- },
64
- withAttributes: function(a) {
65
- return Fe(this.converter, Me({}, this.attributes, a));
66
- },
67
- withConverter: function(a) {
68
- return Fe(Me({}, this.converter, a), this.attributes);
69
- }
70
- },
71
- {
72
- attributes: { value: Object.freeze(k) },
73
- converter: { value: Object.freeze(o) }
74
- }
75
- );
76
- }
77
- var at = Fe(Gt, { path: "/" });
78
- const Xt = "Admin-Token";
79
- function Jt(o = Xt) {
80
- return at.get(o);
81
- }
82
- const Be = (o, k) => {
83
- const M = o.__vccOpts || o;
84
- for (const [e, a] of k)
85
- M[e] = a;
86
- return M;
87
- }, Yt = { class: "qy-upload__hint" }, el = ["placeholder", "disabled"], tl = ["src"], ll = {
88
- key: 1,
89
- class: "qy-upload__tip"
90
- }, al = { class: "error" }, nl = { class: "error" }, ol = /* @__PURE__ */ Object.assign({
91
- name: "QyUpload"
92
- }, {
93
- __name: "index",
94
- props: {
95
- /**
96
- * 受控值。valueFormat 为 object 时结构为 { files, text },
97
- * array 时为 string[],string 时为逗号分隔 URL。
98
- */
99
- modelValue: { type: [Object, Array, String], default: void 0 },
100
- /**
101
- * 初始值,结构为 { files: '逗号分隔的URL', text: '文字内容' }
102
- * 非受控模式,仅初始化时读取一次
103
- */
104
- defaultValue: { type: Object, default: () => ({ files: "", text: "" }) },
105
- /** v-model 输出格式:object | array | string */
106
- valueFormat: { type: String, default: "object" },
107
- /** 是否显示底部文字备注区 */
108
- showText: { type: Boolean, default: !0 },
109
- /** 是否显示纯粘贴输入条,不保存文字,仅用于承接 Ctrl+V 图片 */
110
- showPasteInput: { type: Boolean, default: !1 },
111
- /** 文字区占位文案,也用于凭证上传的粘贴提示 */
112
- pastePlaceholder: { type: String, default: "输入文字" },
113
- /** 是否多选 */
114
- multiple: { type: Boolean, default: !0 },
115
- /** 是否禁用 */
116
- disabled: { type: Boolean, default: !1 },
117
- /** 允许的文件类型后缀(如 ['jpg', 'mp4']) */
118
- fileType: { type: Array, default: () => [] },
119
- /** 单个文件大小限制(MB) */
120
- fileSize: { type: Number, default: 10 },
121
- /** 文件数量限制 */
122
- limit: { type: Number, default: 9 },
123
- /** 是否显示格式/大小提示 */
124
- isShowTip: { type: Boolean, default: !1 },
125
- /** 接口路径 */
126
- api: { type: String, default: "/permission-api/common/uploads" },
127
- /** FormData 中文件字段名 */
128
- name: { type: String, default: "file" },
129
- /** token 读取 key,对应 utils/auth 中的存储字段 */
130
- tokenKey: { type: String, default: "Admin-Token" },
131
- /** 是否支持视频模式(强制 limit=1) */
132
- supportVideo: { type: Boolean, default: !1 },
133
- /**
134
- * 卡片尺寸
135
- * 预设:'large'(160px) | 'default'(140px) | 'small'(80px)
136
- * 自定义:任意 CSS 单位,如 '60px'、'8vw'
137
- */
138
- size: { type: String, default: "default" },
139
- /** 禁用拖拽(默认在触发区开启) */
140
- disableDrag: { type: Boolean, default: !1 },
141
- /** 成功回调(用于复杂业务联动) */
142
- callBack: { type: Function, default: null },
143
- /** 上传时附加的额外 FormData 字段 */
144
- extraData: { type: Object, default: () => ({}) }
145
- },
146
- emits: [
147
- "update:modelValue",
148
- "change",
149
- "success",
150
- "error",
151
- "remove"
152
- ],
153
- setup(o, { expose: k, emit: M }) {
154
- const e = o, a = M, x = z(null), i = z([]), c = z(null), V = z(null), w = [];
155
- let q = !1;
156
- const D = z(!1), m = z([]), Q = z(0), p = z(!1), T = z(""), g = z(""), R = /* @__PURE__ */ new Set(), L = z(!1), y = z(""), O = z(!1);
157
- De(() => {
158
- e.modelValue === void 0 && re(e.defaultValue);
159
- });
160
- const s = H(() => ({ large: "160px", default: "140px", small: "80px" })[e.size] ?? e.size), A = H(() => e.disabled), K = H(
161
- () => {
162
- var r;
163
- return e.isShowTip && (e.fileSize || ((r = u.value) == null ? void 0 : r.length));
164
- }
165
- ), u = H(() => {
166
- var r;
167
- return (r = e.fileType) != null && r.length ? e.fileType.map((f) => f.toLowerCase()) : e.supportVideo ? ["mp4", "mov", "avi"] : ["jpg", "jpeg", "png", "gif", "webp"];
168
- }), B = H(() => {
169
- const r = e.supportVideo ? 1 : e.limit;
170
- return i.value.length >= r;
171
- }), X = H(
172
- () => u.value.map((r) => `.${r}`).join(",")
173
- ), t = H(() => ({
174
- "qy-upload--reached-limit": B.value,
175
- "qy-upload--disabled": e.disabled,
176
- "qy-upload--video": e.supportVideo,
177
- "qy-upload--without-text": !e.showText && !e.showPasteInput
178
- }));
179
- ye(y, () => {
180
- q || j();
181
- }), ye(
182
- () => e.modelValue,
183
- (r) => {
184
- r !== void 0 && re(r);
185
- },
186
- { immediate: !0, deep: !0 }
187
- );
188
- function l(r) {
189
- return Array.isArray(r) ? r.filter(Boolean) : r ? String(r).split(",").filter(Boolean) : [];
190
- }
191
- function v(r) {
192
- return Array.isArray(r) ? { files: r, text: "" } : typeof r == "string" ? { files: l(r), text: "" } : r && typeof r == "object" ? {
193
- files: l(r.files),
194
- text: r.text ?? ""
195
- } : { files: [], text: "" };
196
- }
197
- function J(r = []) {
198
- return r.map((f, P) => ({
199
- name: String(f).split("/").pop() || `file-${P}`,
200
- url: f,
201
- status: "success",
202
- uid: Date.now() + P
203
- }));
204
- }
205
- function oe(r) {
206
- const f = new Set(r.map((C) => C.url)), P = i.value.filter(
207
- (C) => C.status === "uploading" && !f.has(C.url)
208
- );
209
- return [...r, ...P];
210
- }
211
- function re(r) {
212
- const f = v(r);
213
- q = !0, y.value = f.text, i.value = oe(J(f.files)), Qe(() => {
214
- q = !1;
215
- });
216
- }
217
- function F(r) {
218
- return e.valueFormat === "array" ? r.files : e.valueFormat === "string" ? r.files.join(",") : r;
219
- }
220
- function $() {
221
- var r;
222
- (r = c.value) == null || r.focus();
223
- }
224
- function d(r) {
225
- r.target.value = "";
226
- }
227
- function j(r) {
228
- const C = { files: (r ?? i.value).filter((N) => N.status === "success" && N.url).map((N) => N.url), text: y.value };
229
- a("update:modelValue", F(C)), a("change", C), e.callBack && e.callBack(C);
230
- }
231
- function Y(r, f) {
232
- j(f), a("remove", r, f);
233
- }
234
- function be(r) {
235
- var C;
236
- if (!(r.size / 1024 / 1024 < e.fileSize))
237
- return he.warning(`文件大小不能超过${e.fileSize}M`), !1;
238
- const P = ((C = r.name.split(".").pop()) == null ? void 0 : C.toLowerCase()) || "";
239
- return u.value.includes(P) ? !0 : (he.warning(
240
- `格式不支持,仅允许: ${u.value.join("/")}`
241
- ), !1);
242
- }
243
- function ke(r, f, P, C) {
244
- var Le, _e;
245
- const N = e.api.startsWith("http") ? e.api : window.location.origin + e.api.replace(/^([^/])/, "/$1"), ae = new FormData();
246
- ae.append(e.name, r), e.extraData && Object.entries(e.extraData).forEach(([ee, St]) => ae.append(ee, St));
247
- const G = new XMLHttpRequest();
248
- w.push(G);
249
- const we = ((Le = x.value) == null ? void 0 : Le.$el.querySelector(".el-upload--picture-card")) || ((_e = x.value) == null ? void 0 : _e.$el), xe = Qt.service({
250
- target: we,
251
- text: "上传中",
252
- background: "rgba(255,255,255,0.7)"
253
- }), pe = () => {
254
- const ee = w.indexOf(G);
255
- ee !== -1 && w.splice(ee, 1), xe.close();
256
- };
257
- G.open("POST", N);
258
- const Pe = Jt(e.tokenKey);
259
- Pe && G.setRequestHeader("Authorization", `Bearer ${Pe}`), G.upload.onprogress = (ee) => {
260
- ee.total > 0 && (f == null || f({ percent: ee.loaded / ee.total * 100 }));
261
- }, G.onload = () => {
262
- if (pe(), G.status < 200 || G.status >= 300) {
263
- const ee = `上传失败 (HTTP ${G.status})`;
264
- he.error(ee), a("error", { msg: ee, status: G.status }), C == null || C(new Error(ee));
265
- return;
266
- }
267
- try {
268
- const ee = JSON.parse(G.responseText);
269
- ee.code === 200 && ee.urls ? (he.success("上传成功"), P == null || P({ ...ee, url: ee.urls })) : (he.error(ee.msg || "上传失败"), a("error", ee), C == null || C(ee));
270
- } catch {
271
- he.error("上传失败,响应格式错误"), a("error", new Error("Response parse error")), C == null || C(new Error("Response parse error"));
272
- }
273
- }, G.onerror = () => {
274
- pe(), he.error("上传失败,网络异常"), a("error", new Error("Network error")), C == null || C(new Error("Network error"));
275
- }, G.send(ae);
276
- }
277
- function ve(r) {
278
- return e.disabled ? !1 : be(r);
279
- }
280
- function ze(r, f) {
281
- const P = i.value.find(
282
- (C) => {
283
- var N;
284
- return C.uid === (r == null ? void 0 : r.uid) || ((N = C.raw) == null ? void 0 : N.uid) === (r == null ? void 0 : r.uid);
285
- }
286
- );
287
- P && (P.url = f, P.status = "success");
288
- }
289
- function n(r) {
290
- ke(
291
- r.file,
292
- r.onProgress,
293
- (f) => {
294
- ze(r.file, f.url), r.onSuccess(f), j(), a("success", f);
295
- },
296
- (f) => r.onError(f)
297
- );
298
- }
299
- function h(r) {
300
- var C;
301
- if (!r.url) return;
302
- const f = ((C = r.url.split(".").pop()) == null ? void 0 : C.toLowerCase()) || "";
303
- if (["mp4", "mov", "avi", "webm"].includes(f)) {
304
- T.value = r.url, g.value = r.name || "视频预览", p.value = !0;
305
- return;
306
- }
307
- const P = i.value.filter(
308
- (N) => {
309
- var ae;
310
- return N.status === "success" && N.url && !["mp4", "mov", "avi", "webm"].includes(
311
- (ae = N.url.split(".").pop()) == null ? void 0 : ae.toLowerCase()
312
- );
313
- }
314
- );
315
- m.value = P.map((N) => N.url), Q.value = P.findIndex((N) => N.uid === r.uid) || 0, D.value = !0;
316
- }
317
- function W() {
318
- D.value = !1, m.value = [];
319
- }
320
- function fe(r) {
321
- for (let f = 0; f < r.length; f++) {
322
- const P = r[f];
323
- if (!ve(P)) continue;
324
- const C = Date.now() + f, N = URL.createObjectURL(P);
325
- R.add(N), i.value.push({
326
- uid: C,
327
- name: P.name || `file-${C}`,
328
- status: "uploading",
329
- percentage: 0,
330
- url: N
331
- }), ke(
332
- P,
333
- (ae) => {
334
- const G = i.value.find((we) => we.uid === C);
335
- G && (G.percentage = ae.percent);
336
- },
337
- (ae) => {
338
- const G = i.value.find((we) => we.uid === C);
339
- G && (G.status = "success", G.url = ae.url, j(), a("success", ae));
340
- },
341
- () => $t(C)
342
- );
343
- }
344
- }
345
- function ge(r) {
346
- var C;
347
- if (e.disabled) return;
348
- const f = (C = r.clipboardData) == null ? void 0 : C.items;
349
- if (!f) return;
350
- const P = [];
351
- for (let N = 0; N < f.length; N++) {
352
- const ae = f[N];
353
- if (ae.kind === "file" && ae.type.startsWith("image/")) {
354
- const G = ae.getAsFile();
355
- G && P.push(G);
356
- }
357
- }
358
- P.length && (r.preventDefault(), fe(P));
359
- }
360
- function Ie() {
361
- e.disabled || e.disableDrag || (L.value = !0);
362
- }
363
- function qe() {
364
- L.value = !1;
365
- }
366
- function Vt(r) {
367
- var P;
368
- if (L.value = !1, e.disabled || e.disableDrag || B.value) return;
369
- const f = Array.from(((P = r.dataTransfer) == null ? void 0 : P.files) || []).filter(
370
- (C) => {
371
- var N;
372
- return u.value.includes((N = C.name.split(".").pop()) == null ? void 0 : N.toLowerCase());
373
- }
374
- );
375
- f.length && fe(f);
376
- }
377
- function $t(r) {
378
- var P;
379
- const f = i.value.findIndex((C) => C.uid === r);
380
- f !== -1 && ((P = i.value[f].url) != null && P.startsWith("blob:") && (URL.revokeObjectURL(i.value[f].url), R.delete(i.value[f].url)), i.value.splice(f, 1));
381
- }
382
- return Xe(() => {
383
- w.forEach((r) => r.abort()), w.length = 0, R.forEach((r) => URL.revokeObjectURL(r)), R.clear();
384
- }), k({
385
- /** 主动打开文件选择框,供表单或快捷操作调用 */
386
- openFileDialog: () => {
387
- var r, f;
388
- e.disabled || B.value || (f = (r = x.value) == null ? void 0 : r.$el.querySelector('input[type="file"]')) == null || f.click();
389
- },
390
- /** 获取已上传成功的文件 URL 列表 */
391
- getPathList: () => i.value.filter((r) => r.status === "success").map((r) => r.url),
392
- /** 清空文件和文字,并同步 change 事件 */
393
- clearFiles: () => {
394
- i.value = [], y.value = "", j();
395
- },
396
- /** 获取完整值,结构与 change 事件保持一致 */
397
- getValue: () => ({
398
- files: i.value.filter((r) => r.status === "success" && r.url).map((r) => r.url),
399
- text: y.value
400
- }),
401
- /** 获取按 valueFormat 输出的值,便于外部不走 v-model 时读取 */
402
- getModelValue: () => F({
403
- files: i.value.filter((r) => r.status === "success" && r.url).map((r) => r.url),
404
- text: y.value
405
- })
406
- }), (r, f) => {
407
- var xe;
408
- const P = We, C = zt, N = Ct, ae = Bt, G = It, we = Ge;
409
- return b(), E("div", {
410
- class: de(["qy-upload", t.value]),
411
- style: Se({ "--qy-upload-size": s.value })
412
- }, [
413
- le(ae, {
414
- ref_key: "uploadRef",
415
- ref: x,
416
- "file-list": i.value,
417
- "onUpdate:fileList": f[6] || (f[6] = (pe) => i.value = pe),
418
- action: "#",
419
- multiple: o.supportVideo ? !1 : o.multiple,
420
- limit: o.supportVideo ? 1 : o.limit,
421
- "list-type": o.supportVideo ? "text" : "picture-card",
422
- accept: X.value,
423
- disabled: A.value,
424
- "http-request": n,
425
- "before-upload": ve,
426
- "on-preview": h,
427
- "on-remove": Y
428
- }, {
429
- default: S(() => [
430
- B.value ? Z("", !0) : (b(), E("div", {
431
- key: 0,
432
- class: de(["qy-upload__trigger", { "is-dragover": L.value }]),
433
- onPaste: ge,
434
- onDragover: te(Ie, ["prevent"]),
435
- onDragleave: te(qe, ["prevent"]),
436
- onDrop: te(Vt, ["prevent"])
437
- }, [
438
- le(P, { class: "qy-upload__icon" }, {
439
- default: S(() => [
440
- le(_(Ft))
441
- ]),
442
- _: 1
443
- }),
444
- o.supportVideo ? (b(), E(Ce, { key: 0 }, [
445
- f[9] || (f[9] = U("span", { class: "qy-upload__label" }, "点击上传视频", -1)),
446
- U("span", Yt, "支持 " + ne(u.value.join(" / ")) + ",不超过 " + ne(o.fileSize) + "MB", 1)
447
- ], 64)) : Z("", !0),
448
- o.showText ? (b(), E("div", {
449
- key: 1,
450
- class: "qy-upload__text",
451
- onClick: f[3] || (f[3] = te(() => {
452
- }, ["stop"])),
453
- onPaste: te(ge, ["stop"])
454
- }, [
455
- le(N, {
456
- visible: O.value,
457
- "onUpdate:visible": f[2] || (f[2] = (pe) => O.value = pe),
458
- placement: "bottom-start",
459
- width: 220,
460
- trigger: "click",
461
- "popper-class": "qy-upload__text-popover",
462
- onAfterEnter: $
463
- }, {
464
- reference: S(() => [
465
- U("div", {
466
- class: de(["qy-upload__text-preview", { "is-placeholder": !y.value }])
467
- }, ne(y.value || o.pastePlaceholder), 3)
468
- ]),
469
- default: S(() => [
470
- le(C, {
471
- ref_key: "inputRef",
472
- ref: c,
473
- modelValue: y.value,
474
- "onUpdate:modelValue": f[0] || (f[0] = (pe) => y.value = pe),
475
- type: "textarea",
476
- autosize: { minRows: 2, maxRows: 5 },
477
- placeholder: o.pastePlaceholder,
478
- disabled: o.disabled,
479
- onBlur: f[1] || (f[1] = (pe) => O.value = !1),
480
- onPaste: te(ge, ["stop"])
481
- }, null, 8, ["modelValue", "placeholder", "disabled"])
482
- ]),
483
- _: 1
484
- }, 8, ["visible"])
485
- ], 32)) : o.showPasteInput ? (b(), E("div", {
486
- key: 2,
487
- class: "qy-upload__text",
488
- onClick: f[5] || (f[5] = te(() => {
489
- }, ["stop"])),
490
- onPaste: te(ge, ["stop"])
491
- }, [
492
- U("input", {
493
- ref_key: "pasteInputRef",
494
- ref: V,
495
- class: "qy-upload__paste-input",
496
- placeholder: o.pastePlaceholder,
497
- disabled: o.disabled,
498
- onPaste: te(ge, ["stop"]),
499
- onInput: d,
500
- onClick: f[4] || (f[4] = te(() => {
501
- }, ["stop"]))
502
- }, null, 40, el)
503
- ], 32)) : Z("", !0)
504
- ], 34))
505
- ]),
506
- _: 1
507
- }, 8, ["file-list", "multiple", "limit", "list-type", "accept", "disabled"]),
508
- D.value ? (b(), ie(G, {
509
- key: 0,
510
- "url-list": m.value,
511
- "initial-index": Q.value,
512
- onClose: W
513
- }, null, 8, ["url-list", "initial-index"])) : Z("", !0),
514
- le(we, {
515
- modelValue: p.value,
516
- "onUpdate:modelValue": f[7] || (f[7] = (pe) => p.value = pe),
517
- title: g.value,
518
- width: "640px",
519
- "append-to-body": "",
520
- "destroy-on-close": "",
521
- onClose: f[8] || (f[8] = (pe) => p.value = !1)
522
- }, {
523
- default: S(() => [
524
- p.value ? (b(), E("video", {
525
- key: 0,
526
- src: T.value,
527
- controls: "",
528
- autoplay: "",
529
- style: { width: "100%", "max-height": "400px", "border-radius": "4px" }
530
- }, null, 8, tl)) : Z("", !0)
531
- ]),
532
- _: 1
533
- }, 8, ["modelValue", "title"]),
534
- K.value ? (b(), E("div", ll, [
535
- le(P, null, {
536
- default: S(() => [
537
- le(_(Dt))
538
- ]),
539
- _: 1
540
- }),
541
- U("span", null, [
542
- f[12] || (f[12] = Ve(" 请上传 ", -1)),
543
- o.fileSize ? (b(), E(Ce, { key: 0 }, [
544
- f[10] || (f[10] = Ve("大小不超过 ", -1)),
545
- U("b", al, ne(o.fileSize) + "MB", 1)
546
- ], 64)) : Z("", !0),
547
- (xe = u.value) != null && xe.length ? (b(), E(Ce, { key: 1 }, [
548
- f[11] || (f[11] = Ve(",格式为 ", -1)),
549
- U("b", nl, ne(u.value.join("/")), 1)
550
- ], 64)) : Z("", !0),
551
- f[13] || (f[13] = Ve(" 的文件。 ", -1))
552
- ])
553
- ])) : Z("", !0)
554
- ], 6);
555
- };
556
- }
557
- }), nt = /* @__PURE__ */ Be(ol, [["__scopeId", "data-v-8b875cce"]]), sl = /* @__PURE__ */ Object.assign({
558
- name: "QyVoucherUpload",
559
- inheritAttrs: !1
560
- }, {
561
- __name: "index",
562
- props: {
563
- /** 凭证图片 URL 数组。 */
564
- modelValue: { type: Array, default: () => [] },
565
- /** 上传接口路径。 */
566
- api: { type: String, default: "/permission-api/common/uploads" },
567
- /** 凭证上传沿用老业务字段名 files。 */
568
- name: { type: String, default: "files" },
569
- /** 是否多选。 */
570
- multiple: { type: Boolean, default: !0 },
571
- /** 是否禁用。 */
572
- disabled: { type: Boolean, default: !1 },
573
- /** 允许的文件类型后缀。 */
574
- fileType: { type: Array, default: () => [] },
575
- /** 单个文件大小限制(MB)。 */
576
- fileSize: { type: Number, default: 10 },
577
- /** 文件数量限制。 */
578
- limit: { type: Number, default: 9 },
579
- /** 是否显示格式/大小提示。 */
580
- isShowTip: { type: Boolean, default: !1 },
581
- /** token 读取 key。 */
582
- tokenKey: { type: String, default: "Admin-Token" },
583
- /** 是否支持视频模式。 */
584
- supportVideo: { type: Boolean, default: !1 },
585
- /** 凭证默认尺寸,贴近财审凭证里的紧凑图片格。 */
586
- size: { type: String, default: "90px" },
587
- /** 禁用拖拽。 */
588
- disableDrag: { type: Boolean, default: !1 },
589
- /** 成功回调。 */
590
- callBack: { type: Function, default: null },
591
- /** 上传时附加的额外 FormData 字段。 */
592
- extraData: { type: Object, default: () => ({}) },
593
- /** 凭证上传底部提示文案,默认对齐 CopyImgUpload 的旧交互。 */
594
- pastePlaceholder: { type: String, default: "粘贴图片上传" }
595
- },
596
- emits: [
597
- "update:modelValue",
598
- "change",
599
- "success",
600
- "error",
601
- "remove"
602
- ],
603
- setup(o, { expose: k, emit: M }) {
604
- const e = M, a = me(), x = z(null);
605
- function i(g) {
606
- return Array.isArray(g) ? g : [];
607
- }
608
- function c(g) {
609
- e("update:modelValue", i(g));
610
- }
611
- function V(g) {
612
- const R = i(g == null ? void 0 : g.files);
613
- e("change", R);
614
- }
615
- function w(g) {
616
- e("success", g);
617
- }
618
- function q(g) {
619
- e("error", g);
620
- }
621
- function D(g, R) {
622
- e("remove", g, R);
623
- }
624
- function m() {
625
- var g, R;
626
- (R = (g = x.value) == null ? void 0 : g.openFileDialog) == null || R.call(g);
627
- }
628
- function Q() {
629
- var g, R;
630
- return ((R = (g = x.value) == null ? void 0 : g.getPathList) == null ? void 0 : R.call(g)) || [];
631
- }
632
- function p() {
633
- var g, R;
634
- (R = (g = x.value) == null ? void 0 : g.clearFiles) == null || R.call(g);
635
- }
636
- function T() {
637
- return Q();
638
- }
639
- return k({
640
- openFileDialog: m,
641
- getPathList: Q,
642
- clearFiles: p,
643
- getValue: T
644
- }), (g, R) => (b(), ie(nt, ue({
645
- ref_key: "uploadRef",
646
- ref: x
647
- }, _(a), {
648
- "model-value": o.modelValue,
649
- "value-format": "array",
650
- api: o.api,
651
- name: o.name,
652
- multiple: o.multiple,
653
- disabled: o.disabled,
654
- "file-type": o.fileType,
655
- "file-size": o.fileSize,
656
- limit: o.limit,
657
- "is-show-tip": o.isShowTip,
658
- "token-key": o.tokenKey,
659
- "support-video": o.supportVideo,
660
- size: o.size,
661
- "disable-drag": o.disableDrag,
662
- "call-back": o.callBack,
663
- "extra-data": o.extraData,
664
- "show-text": !1,
665
- "show-paste-input": !0,
666
- "paste-placeholder": o.pastePlaceholder,
667
- "onUpdate:modelValue": c,
668
- onChange: V,
669
- onSuccess: w,
670
- onError: q,
671
- onRemove: D
672
- }), 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", "paste-placeholder"]));
673
- }
674
- }), rl = { class: "text-lg flex items-center pt-2 pl-[var(--content-padding)]" }, il = { key: 0 }, ul = { key: 1 }, dl = {
675
- key: 0,
676
- class: "icon-[material-symbols--square-outline-rounded]",
677
- role: "img",
678
- "aria-hidden": "true"
679
- }, cl = {
680
- key: 1,
681
- class: "icon-[tdesign--fullscreen-exit-1]",
682
- role: "img",
683
- "aria-hidden": "true"
684
- }, fl = {
685
- key: 0,
686
- class: "fixed -right-12 top-2 h-9 w-9 hover:bg-gray-600/80 transition-all"
687
- }, pl = { class: "flex justify-between h-[var(--footer-height)] px-[var(--content-padding)] items-center" }, ml = { class: "flex items-center justify-between w-full pl-1 pr-4 h-full ml-2" }, yl = { class: "flex items-center gap-2" }, gl = { class: "text-sm text-gray-700 truncate max-w-[200px]" }, hl = { class: "flex items-center gap-2" }, Ne = 5, Te = 2e3, vl = /* @__PURE__ */ ce({
688
- __name: "index",
689
- props: /* @__PURE__ */ je({
690
- layout: { type: [Array, String, Boolean], default: () => ["confirm", "cancel"] },
691
- fullscreen: { type: Boolean, default: !1 },
692
- showFullscreen: { type: Boolean, default: !1 },
693
- confirmProps: { default: () => ({}) },
694
- size: { default: "default" },
695
- zIndex: { default: 2e3 }
696
- }, {
697
- modelValue: { default: !0 },
698
- modelModifiers: {}
699
- }),
700
- emits: /* @__PURE__ */ je(["confirm", "cancel", "close", "opened", "ok"], ["update:modelValue"]),
701
- setup(o, { expose: k, emit: M }) {
702
- const e = o, a = Je(), x = z(!0), i = z(!1), c = z(Te), w = Zt({
703
- mobile: 0,
704
- tablet: 640,
705
- laptop: 1024,
706
- desktop: 1280
707
- }).isSmaller("tablet"), q = H(() => {
708
- if (Array.isArray(e.layout)) return e.layout;
709
- if (typeof e.layout == "string")
710
- return e.layout.split(",").map((F) => F.trim());
711
- }), D = H(() => ({
712
- CancelButton: le(J),
713
- ConfirmButton: le(v)
714
- })), m = H(() => a.footer || e.layout !== !1), Q = z(!1), p = z(
715
- e.showFullscreen && w ? !0 : e.fullscreen
716
- ), T = M, g = xt(o, "modelValue");
717
- Mt(() => {
718
- g.value && (Q.value = !1);
719
- }), k({});
720
- const R = me(), L = `qy-dialog-${Math.random().toString(36).slice(2, 11)}`, y = z(!1), O = z(null);
721
- window.minimizedCount || (window.minimizedCount = 0);
722
- const { x: s, y: A } = Wt(O, {
723
- initialValue: {
724
- x: 5,
725
- y: window.innerHeight - 100 - (window.minimizedCount || 0) * 60
726
- },
727
- onMove(F) {
728
- var $;
729
- ($ = O.value) == null || $.classList.add("dragging"), document.body.classList.add("qy-dialog--dragging"), s.value = Math.max(
730
- 0,
731
- Math.min(window.innerWidth - 300, F.x)
732
- ), A.value = Math.max(
733
- 0,
734
- Math.min(window.innerHeight - 50, F.y)
735
- );
736
- },
737
- onEnd() {
738
- var F;
739
- (F = O.value) == null || F.classList.remove("dragging"), document.body.classList.remove("qy-dialog--dragging");
740
- }
741
- }), K = H(() => ({
742
- transform: `translate(${s.value}px, ${A.value}px)`,
743
- willChange: "transform"
744
- }));
745
- function u(F) {
746
- const $ = F.target, { scrollTop: d, scrollHeight: j, clientHeight: Y } = $;
747
- x.value = d <= Ne, i.value = j - (d + Y) <= Ne;
748
- }
749
- function B() {
750
- document.querySelector(`.${L}.el-dialog`).addEventListener("scroll", u), oe(), T("opened");
751
- }
752
- function X() {
753
- p.value = !p.value, oe();
754
- }
755
- function t() {
756
- Q.value || (Q.value = !0, y.value = !1, g.value = !1, T("cancel"), T("close"));
757
- }
758
- function l(F) {
759
- e.showFullscreen && F.detail >= 2 && X();
760
- }
761
- function v() {
762
- return Ke(
763
- Re,
764
- {
765
- ..._(e.confirmProps),
766
- type: "primary",
767
- class: "dialog__footerBtn",
768
- onClick: () => {
769
- T("confirm"), T("ok");
770
- }
771
- },
772
- () => _(e.confirmProps).title || "确 认"
773
- );
774
- }
775
- function J() {
776
- return Ke(
777
- Re,
778
- { class: "dialog__footerBtn", onClick: () => t() },
779
- () => "取 消"
780
- );
781
- }
782
- De(() => {
783
- typeof window.qyDialogMaxZIndex > "u" && (window.qyDialogMaxZIndex = Te), oe();
784
- });
785
- function oe() {
786
- var ke;
787
- const F = Array.from(
788
- document.querySelectorAll(".el-overlay")
789
- ).filter((ve) => window.getComputedStyle(ve).display !== "none" && !ve.classList.contains("is-message")), $ = (ke = document.querySelector(`.${L}`)) == null ? void 0 : ke.closest(".el-overlay"), d = document.querySelector(
790
- `.${L}.el-dialog`
791
- );
792
- if (!$ || !d) return;
793
- const j = Te;
794
- window.qyDialogMaxZIndex = window.qyDialogMaxZIndex || j;
795
- const be = Math.max(
796
- window.qyDialogMaxZIndex,
797
- ...F.map(
798
- (ve) => parseInt(window.getComputedStyle(ve).zIndex || j.toString())
799
- )
800
- ) + 2;
801
- window.qyDialogMaxZIndex = be, Qe(() => {
802
- $.style.zIndex = be.toString(), d.style.zIndex = (be + 1).toString(), c.value = be + 1;
803
- });
804
- }
805
- Ye(() => {
806
- const F = document.querySelector(
807
- `.${L} .qy-dialog__wrapper-container`
808
- );
809
- F && F.removeEventListener("scroll", u), y.value && window.minimizedCount--;
810
- });
811
- function re() {
812
- var $;
813
- y.value = !y.value;
814
- const F = ($ = document.querySelector(`.${L}`)) == null ? void 0 : $.closest(".el-overlay");
815
- y.value ? (F.style.display = "none", window.minimizedCount++, A.value = window.innerHeight - 50 - (window.minimizedCount || 0) * 60) : (F.style.display = "block", window.minimizedCount--, oe());
816
- }
817
- return (F, $) => {
818
- const d = Rt("Close"), j = We, Y = Ge;
819
- return b(), E("div", null, [
820
- le(Y, ue({
821
- ref: "dialogRef",
822
- class: ["qy-dialog", [
823
- e.size === "small" && "[&_.el-dialog__header]:!hidden",
824
- L
825
- ]],
826
- "model-value": g.value,
827
- "align-center": "",
828
- "append-to-body": "",
829
- style: {
830
- "--el-dialog-padding-primary": 0
831
- },
832
- "show-close": !1,
833
- fullscreen: p.value,
834
- "z-index": c.value,
835
- onClosed: t,
836
- onOpened: B,
837
- draggable: ""
838
- }, _(R)), $e({
839
- header: S(() => [
840
- e.size === "default" ? (b(), E("div", {
841
- key: 0,
842
- style: Se({
843
- borderBottom: "1px solid",
844
- borderColor: x.value ? "transparent" : "var(--block-outline-color)",
845
- transition: "border-color .2s linear"
846
- }),
847
- class: "flex justify-between h-[var(--header-height)]",
848
- onDblclick: l
849
- }, [
850
- U("div", rl, [
851
- _(a).header ? _(a).header ? (b(), E("div", ul, [
852
- I(F.$slots, "header")
853
- ])) : Z("", !0) : (b(), E("span", il, ne(_(R).title), 1))
854
- ]),
855
- U("div", {
856
- class: "flex",
857
- onMousedown: $[3] || ($[3] = te(() => {
858
- }, ["stop"]))
859
- }, [
860
- e.size === "default" ? (b(), E("div", {
861
- key: 0,
862
- class: "qy-dialog__btn qy-dialog__btn--default",
863
- onClick: te(re, ["stop"]),
864
- onMousedown: $[0] || ($[0] = te(() => {
865
- }, ["stop"]))
866
- }, $[4] || ($[4] = [
867
- U("span", {
868
- class: "icon-[material-symbols--minimize] text-xl mb-3",
869
- role: "img",
870
- "aria-hidden": "true"
871
- }, null, -1)
872
- ]), 32)) : Z("", !0),
873
- e.showFullscreen ? (b(), E("div", {
874
- key: 1,
875
- class: "qy-dialog__btn qy-dialog__btn--default",
876
- onClick: te(X, ["stop"]),
877
- onMousedown: $[1] || ($[1] = te(() => {
878
- }, ["stop"]))
879
- }, [
880
- p.value ? (b(), E("span", cl)) : (b(), E("span", dl))
881
- ], 32)) : Z("", !0),
882
- U("div", {
883
- class: "qy-dialog__btn qy-dialog__btn--danger",
884
- onClick: te(t, ["stop"]),
885
- onMousedown: $[2] || ($[2] = te(() => {
886
- }, ["stop"]))
887
- }, $[5] || ($[5] = [
888
- U("span", {
889
- class: "icon-[ri--close-line] text-xl",
890
- role: "img",
891
- "aria-hidden": "true"
892
- }, null, -1)
893
- ]), 32)
894
- ], 32)
895
- ], 36)) : Z("", !0)
896
- ]),
897
- default: S(() => [
898
- U("div", {
899
- class: de(["qy-dialog__wrapper", _(Ht)(p.value && "qy-dialog__wrapper--fullscreen")]),
900
- style: Se({
901
- maxHeight: m.value ? "calc(100vh - var(--header-height) - var(--footer-height) - var(--sides-gap))" : "calc(100vh - var(--header-height) - var(--sides-gap))",
902
- padding: e.size === "small" ? "var(--small-content-padding)" : "var(--content-padding)"
903
- })
904
- }, [
905
- e.size === "small" ? (b(), E("div", fl, [
906
- le(j, {
907
- size: 36,
908
- class: "cursor-pointer text-gray-100 active:scale-75 rounded-sm transition-all",
909
- onClick: t
910
- }, {
911
- default: S(() => [
912
- le(d)
913
- ]),
914
- _: 1
915
- })
916
- ])) : Z("", !0),
917
- I(F.$slots, "default")
918
- ], 6)
919
- ]),
920
- _: 2
921
- }, [
922
- !F.$slots.footer && Array.isArray(q.value) ? {
923
- name: "footer",
924
- fn: S(() => [
925
- U("div", pl, [
926
- U("div", null, [
927
- I(F.$slots, "footer-left")
928
- ]),
929
- U("div", {
930
- class: de([{
931
- "qy-dialog__footer--outline": i.value
932
- }, "qy-dialog__footer flex items-center justify-end"])
933
- }, [
934
- q.value.includes("cancel") ? (b(), ie(J, { key: 0 })) : Z("", !0),
935
- q.value.includes("confirm") ? (b(), ie(v, { key: 1 })) : Z("", !0),
936
- I(F.$slots, "footer-append")
937
- ], 2)
938
- ])
939
- ]),
940
- key: "0"
941
- } : m.value ? {
942
- name: "footer",
943
- fn: S(() => [
944
- U("div", {
945
- class: de([{
946
- "qy-dialog__footer--outline": i.value
947
- }, "qy-dialog__footer px-[var(--content-padding)] min-h-[var(--footer-height)] flex items-center justify-end"])
948
- }, [
949
- I(F.$slots, "footer", {
950
- layouts: D.value,
951
- layoutsNode: Object.values(D.value)
952
- })
953
- ], 2)
954
- ]),
955
- key: "1"
956
- } : void 0
957
- ]), 1040, ["class", "model-value", "fullscreen", "z-index"]),
958
- et(U("div", {
959
- ref_key: "minimizedRef",
960
- ref: O,
961
- class: "fixed left-0 top-0 bg-white rounded shadow-lg cursor-pointer z-[9999] hover:bg-gray-50",
962
- style: Se([K.value, { width: "300px", height: "50px", "will-change": "transform" }])
963
- }, [
964
- U("div", ml, [
965
- U("div", yl, [
966
- $[6] || ($[6] = U("div", { class: "icon-[mdi--window-restore] text-gray-600" }, null, -1)),
967
- U("span", gl, ne(_(R).title), 1)
968
- ]),
969
- U("div", hl, [
970
- U("div", {
971
- class: "p-1 hover:bg-gray-200 rounded",
972
- onClick: te(re, ["stop"])
973
- }, $[7] || ($[7] = [
974
- U("div", { class: "icon-[mdi--window-maximize] text-gray-600" }, null, -1)
975
- ])),
976
- U("div", {
977
- class: "p-1 hover:bg-red-100 rounded",
978
- onClick: te(t, ["stop"])
979
- }, $[8] || ($[8] = [
980
- U("div", { class: "icon-[mdi--close] text-red-600" }, null, -1)
981
- ]))
982
- ])
983
- ])
984
- ], 4), [
985
- [tt, y.value]
986
- ])
987
- ]);
988
- };
989
- }
990
- });
991
- function He(o) {
992
- const k = o == null ? void 0 : o.match(/(\[url\:(.*?)\])(.*)/);
993
- return k ? {
994
- imageUrl: k[2],
995
- text: k[3]
996
- } : {
997
- imageUrl: "",
998
- text: o || ""
999
- };
1000
- }
1001
- function bl(o) {
1002
- const k = String(o || "").match(/(\[url\:.*?\])([\s\S]*)/);
1003
- return k ? k[2] : o;
1004
- }
1005
- function Ze(o, k) {
1006
- return k ? `[url:${k}]${o}` : o;
1007
- }
1008
- const kl = { class: "qy-remark-image__field" }, wl = { class: "qy-remark-image__upload-anchor" }, Vl = {
1009
- key: 0,
1010
- class: "icon-[line-md--loading-twotone-loop]",
1011
- role: "img",
1012
- "aria-hidden": "true"
1013
- }, $l = {
1014
- key: 1,
1015
- class: "icon-[ion--cloud-upload-outline]",
1016
- role: "img",
1017
- "aria-hidden": "true"
1018
- }, Sl = {
1019
- key: 2,
1020
- class: "icon-[ph--images-thin]",
1021
- role: "img",
1022
- "aria-hidden": "true"
1023
- }, Bl = { class: "qy-remark-image__popover" }, Cl = ["src"], zl = { class: "qy-remark-image__popover-footer" }, Il = /* @__PURE__ */ ce({
1024
- __name: "index",
1025
- props: {
1026
- defaultValue: { default: "" },
1027
- defaultImage: { default: "" },
1028
- rows: { default: 6 },
1029
- width: { default: "" },
1030
- autosize: { type: [Boolean, Object], default: !1 },
1031
- disabled: { type: Boolean, default: !1 },
1032
- placeholder: { default: "粘贴图片上传" },
1033
- type: { default: "textarea" },
1034
- api: { default: "/permission-api/common/uploads" },
1035
- tokenKey: { default: "Admin-Token" }
1036
- },
1037
- emits: ["change"],
1038
- setup(o, { expose: k, emit: M }) {
1039
- const e = o, a = M, x = me(), i = z(null), c = z(""), V = z(""), w = z(!1), q = H(
1040
- () => e.type === "text" ? "text" : "textarea"
1041
- ), D = H(() => {
1042
- if (e.width)
1043
- return {
1044
- width: typeof e.width == "number" ? `${e.width}px` : e.width
1045
- };
1046
- });
1047
- ye(
1048
- () => e.defaultValue,
1049
- (y) => {
1050
- const O = He(y || "");
1051
- c.value = O.text, V.value = O.imageUrl || e.defaultImage || "";
1052
- },
1053
- { immediate: !0 }
1054
- ), ye(
1055
- () => e.defaultImage,
1056
- (y) => {
1057
- y !== void 0 && !He(e.defaultValue || "").imageUrl && (V.value = y || "");
1058
- },
1059
- { immediate: !0 }
1060
- ), De(() => {
1061
- Qe(Q);
1062
- }), Ye(() => {
1063
- const y = m();
1064
- y && y.removeEventListener("paste", g);
1065
- });
1066
- function m() {
1067
- var y, O;
1068
- return ((y = i.value) == null ? void 0 : y.textarea) || ((O = i.value) == null ? void 0 : O.input) || null;
1069
- }
1070
- function Q() {
1071
- const y = m();
1072
- y && (y.removeEventListener("paste", g), y.addEventListener("paste", g));
1073
- }
1074
- function p(y) {
1075
- c.value = bl(y || "");
1076
- }
1077
- function T() {
1078
- V.value = "", L();
1079
- }
1080
- async function g(y) {
1081
- var A;
1082
- const s = Array.from(((A = y.clipboardData) == null ? void 0 : A.files) || []).find((K) => K.type.startsWith("image/"));
1083
- s && (y.preventDefault(), await R({
1084
- file: s,
1085
- onError: () => {
1086
- },
1087
- onProgress: () => {
1088
- },
1089
- onSuccess: () => {
1090
- }
1091
- }));
1092
- }
1093
- async function R(y) {
1094
- var O, s, A, K;
1095
- if (y.file.size > 51200 * 1e3)
1096
- return he.error("图片过大"), !1;
1097
- w.value = !0;
1098
- try {
1099
- const u = new FormData();
1100
- u.append("files", y.file);
1101
- const B = at.get(e.tokenKey), t = await (await fetch(e.api, {
1102
- method: "POST",
1103
- body: u,
1104
- credentials: "include",
1105
- headers: B ? { Authorization: `Bearer ${B}` } : void 0
1106
- })).json(), l = (t == null ? void 0 : t.urls) ?? ((O = t == null ? void 0 : t.data) == null ? void 0 : O.urls) ?? ((s = t == null ? void 0 : t.data) == null ? void 0 : s.url) ?? (t == null ? void 0 : t.url) ?? "";
1107
- return V.value = Array.isArray(l) ? l[0] : l, L(), he.success("上传图片成功"), (A = y.onSuccess) == null || A.call(y, t), !0;
1108
- } catch (u) {
1109
- return (K = y.onError) == null || K.call(y, u), he.error("上传失败"), !1;
1110
- } finally {
1111
- w.value = !1;
1112
- }
1113
- }
1114
- function L() {
1115
- a(
1116
- "change",
1117
- Ze(c.value || "", V.value || ""),
1118
- V.value || ""
1119
- );
1120
- }
1121
- return k({
1122
- deleteImage: T,
1123
- // 给表单保存或外部调试读取当前拆分值。
1124
- getValue: () => ({
1125
- text: c.value || "",
1126
- imageUrl: V.value || "",
1127
- value: Ze(c.value || "", V.value || "")
1128
- })
1129
- }), (y, O) => (b(), E("div", {
1130
- class: "qy-remark-image",
1131
- style: Se(D.value)
1132
- }, [
1133
- U("div", kl, [
1134
- le(_(Ee), ue({
1135
- ref_key: "inputRef",
1136
- ref: i,
1137
- "model-value": c.value,
1138
- type: q.value,
1139
- rows: y.rows,
1140
- autosize: y.autosize,
1141
- disabled: y.disabled,
1142
- placeholder: y.placeholder
1143
- }, _(x), {
1144
- "onUpdate:modelValue": p,
1145
- onBlur: L
1146
- }), null, 16, ["model-value", "type", "rows", "autosize", "disabled", "placeholder"]),
1147
- le(_(Ut), {
1148
- placement: "top-start",
1149
- width: 400,
1150
- trigger: "hover",
1151
- disabled: !V.value
1152
- }, {
1153
- reference: S(() => [
1154
- U("div", wl, [
1155
- le(_(Ot), {
1156
- disabled: w.value || y.disabled,
1157
- class: "qy-remark-image__upload",
1158
- "show-file-list": !1,
1159
- "http-request": R
1160
- }, {
1161
- default: S(() => [
1162
- w.value ? (b(), E("span", Vl)) : V.value ? (b(), E("span", Sl)) : (b(), E("span", $l))
1163
- ]),
1164
- _: 1
1165
- }, 8, ["disabled"])
1166
- ])
1167
- ]),
1168
- default: S(() => [
1169
- U("div", Bl, [
1170
- U("img", {
1171
- src: V.value,
1172
- class: "qy-remark-image__preview-img"
1173
- }, null, 8, Cl),
1174
- U("div", zl, [
1175
- O[1] || (O[1] = U("span", { class: "qy-remark-image__popover-tip" }, "再次点击按钮可更换图片", -1)),
1176
- le(_(Re), {
1177
- link: "",
1178
- size: "small",
1179
- type: "danger",
1180
- disabled: y.disabled,
1181
- onClick: T
1182
- }, {
1183
- default: S(() => O[0] || (O[0] = [
1184
- Ve(" 删除图片 ", -1)
1185
- ])),
1186
- _: 1,
1187
- __: [0]
1188
- }, 8, ["disabled"])
1189
- ])
1190
- ])
1191
- ]),
1192
- _: 1
1193
- }, 8, ["disabled"])
1194
- ])
1195
- ], 4));
1196
- }
1197
- }), xl = /* @__PURE__ */ Be(Il, [["__scopeId", "data-v-f8d38d88"]]), Ml = /* @__PURE__ */ ce({
1198
- name: "QyInput",
1199
- inheritAttrs: !1,
1200
- __name: "index",
1201
- props: {
1202
- modelValue: { default: "" },
1203
- removeSpace: { type: Boolean, default: !1 },
1204
- trimMode: { default: "none" }
1205
- },
1206
- emits: ["update:modelValue", "input", "change", "focus", "blur", "clear", "enter"],
1207
- setup(o, { expose: k, emit: M }) {
1208
- const e = o, a = M, x = me(), i = z(null), c = z(w(e.modelValue)), V = H(() => w(e.modelValue));
1209
- ye(
1210
- () => e.modelValue,
1211
- (l) => {
1212
- c.value = w(l);
1213
- }
1214
- );
1215
- function w(l) {
1216
- return l == null ? "" : String(l);
1217
- }
1218
- function q(l) {
1219
- return e.removeSpace ? l.replace(/\s+/g, "") : l;
1220
- }
1221
- function D(l, v) {
1222
- return e.trimMode !== v ? l : l.trim();
1223
- }
1224
- function m(l) {
1225
- return q(w(l));
1226
- }
1227
- function Q(l) {
1228
- c.value = l, a("update:modelValue", l);
1229
- }
1230
- function p(l) {
1231
- const v = m(l);
1232
- Q(v);
1233
- }
1234
- function T(l) {
1235
- c.value = w(l), a("input", w(l));
1236
- }
1237
- function g(l) {
1238
- const v = D(m(l), "change");
1239
- v !== w(e.modelValue) && Q(v), a("change", v);
1240
- }
1241
- function R(l) {
1242
- a("focus", l);
1243
- }
1244
- function L(l) {
1245
- const v = D(c.value, "blur");
1246
- v !== w(e.modelValue) && Q(v), a("blur", l);
1247
- }
1248
- function y() {
1249
- c.value = "", a("update:modelValue", ""), a("clear");
1250
- }
1251
- function O(l) {
1252
- a("enter", l);
1253
- }
1254
- function s() {
1255
- var l, v;
1256
- (v = (l = i.value) == null ? void 0 : l.focus) == null || v.call(l);
1257
- }
1258
- function A() {
1259
- var l, v;
1260
- (v = (l = i.value) == null ? void 0 : l.blur) == null || v.call(l);
1261
- }
1262
- function K() {
1263
- var l, v;
1264
- (v = (l = i.value) == null ? void 0 : l.select) == null || v.call(l);
1265
- }
1266
- function u() {
1267
- var l, v;
1268
- (v = (l = i.value) == null ? void 0 : l.clear) == null || v.call(l);
1269
- }
1270
- function B() {
1271
- var l, v;
1272
- (v = (l = i.value) == null ? void 0 : l.resizeTextarea) == null || v.call(l);
1273
- }
1274
- function X() {
1275
- var l;
1276
- return ((l = i.value) == null ? void 0 : l.input) || null;
1277
- }
1278
- function t() {
1279
- var l;
1280
- return ((l = i.value) == null ? void 0 : l.textarea) || null;
1281
- }
1282
- return k({
1283
- // 暴露 Element Plus 常用输入框方法,方便业务弹窗做聚焦、选中和 textarea 重算高度。
1284
- focus: s,
1285
- blur: A,
1286
- select: K,
1287
- clear: u,
1288
- resizeTextarea: B,
1289
- getNativeInput: X,
1290
- getTextarea: t
1291
- }), (l, v) => (b(), ie(_(Ee), ue({
1292
- ref_key: "inputRef",
1293
- ref: i
1294
- }, _(x), {
1295
- "model-value": V.value,
1296
- "onUpdate:modelValue": p,
1297
- onInput: T,
1298
- onChange: g,
1299
- onFocus: R,
1300
- onBlur: L,
1301
- onClear: y,
1302
- onKeydown: Ue(O, ["enter"])
1303
- }), $e({ _: 2 }, [
1304
- l.$slots.prefix ? {
1305
- name: "prefix",
1306
- fn: S(() => [
1307
- I(l.$slots, "prefix")
1308
- ]),
1309
- key: "0"
1310
- } : void 0,
1311
- l.$slots.suffix ? {
1312
- name: "suffix",
1313
- fn: S(() => [
1314
- I(l.$slots, "suffix")
1315
- ]),
1316
- key: "1"
1317
- } : void 0,
1318
- l.$slots.prepend ? {
1319
- name: "prepend",
1320
- fn: S(() => [
1321
- I(l.$slots, "prepend")
1322
- ]),
1323
- key: "2"
1324
- } : void 0,
1325
- l.$slots.append ? {
1326
- name: "append",
1327
- fn: S(() => [
1328
- I(l.$slots, "append")
1329
- ]),
1330
- key: "3"
1331
- } : void 0
1332
- ]), 1040, ["model-value"]));
1333
- }
1334
- }), Rl = /* @__PURE__ */ ce({
1335
- name: "QyInputNumber",
1336
- inheritAttrs: !1,
1337
- __name: "index",
1338
- props: {
1339
- modelValue: { default: void 0 },
1340
- min: { default: void 0 },
1341
- max: { default: void 0 },
1342
- step: { default: 1 },
1343
- stepStrictly: { type: Boolean, default: !1 },
1344
- precision: { default: void 0 },
1345
- controls: { type: Boolean, default: !0 },
1346
- controlsPosition: { default: "" },
1347
- placeholder: { default: "请输入数字" },
1348
- disabled: { type: Boolean, default: !1 },
1349
- size: { default: "default" }
1350
- },
1351
- emits: ["update:modelValue", "change", "focus", "blur"],
1352
- setup(o, { expose: k, emit: M }) {
1353
- const e = M, a = me(), x = z(null);
1354
- function i(m) {
1355
- e("update:modelValue", m);
1356
- }
1357
- function c(m, Q) {
1358
- e("change", m, Q);
1359
- }
1360
- function V(m) {
1361
- e("focus", m);
1362
- }
1363
- function w(m) {
1364
- e("blur", m);
1365
- }
1366
- function q() {
1367
- var m, Q;
1368
- (Q = (m = x.value) == null ? void 0 : m.focus) == null || Q.call(m);
1369
- }
1370
- function D() {
1371
- var m, Q;
1372
- (Q = (m = x.value) == null ? void 0 : m.blur) == null || Q.call(m);
1373
- }
1374
- return k({
1375
- focus: q,
1376
- blur: D
1377
- }), (m, Q) => (b(), ie(_(At), ue({
1378
- ref_key: "inputNumberRef",
1379
- ref: x
1380
- }, _(a), {
1381
- "model-value": m.modelValue,
1382
- min: m.min,
1383
- max: m.max,
1384
- step: m.step,
1385
- "step-strictly": m.stepStrictly,
1386
- precision: m.precision,
1387
- controls: m.controls,
1388
- "controls-position": m.controlsPosition,
1389
- placeholder: m.placeholder,
1390
- disabled: m.disabled,
1391
- size: m.size,
1392
- "onUpdate:modelValue": i,
1393
- onChange: c,
1394
- onFocus: V,
1395
- onBlur: w
1396
- }), null, 16, ["model-value", "min", "max", "step", "step-strictly", "precision", "controls", "controls-position", "placeholder", "disabled", "size"]));
1397
- }
1398
- }), ql = /* @__PURE__ */ ce({
1399
- name: "QyMoneyInput",
1400
- inheritAttrs: !1,
1401
- __name: "index",
1402
- props: {
1403
- modelValue: { default: "" },
1404
- precision: { default: 2 },
1405
- min: { default: void 0 },
1406
- max: { default: void 0 },
1407
- allowNegative: { type: Boolean, default: !1 },
1408
- formatTrigger: { default: "blur" },
1409
- emptyValue: { default: "" }
1410
- },
1411
- emits: ["update:modelValue", "input", "change", "focus", "blur", "clear", "enter"],
1412
- setup(o, { expose: k, emit: M }) {
1413
- const e = o, a = M, x = me(), i = z(null), c = z(w(e.modelValue)), V = H(() => w(e.modelValue));
1414
- ye(
1415
- () => e.modelValue,
1416
- (t) => {
1417
- c.value = w(t);
1418
- }
1419
- );
1420
- function w(t) {
1421
- return t == null ? "" : String(t);
1422
- }
1423
- function q(t) {
1424
- return Number.isFinite(t) ? Math.max(0, Math.floor(t)) : 2;
1425
- }
1426
- function D(t) {
1427
- const l = w(t);
1428
- let v = "", J = !1, oe = !1;
1429
- const re = q(e.precision);
1430
- for (let F = 0; F < l.length; F += 1) {
1431
- const $ = l[F];
1432
- if ($ >= "0" && $ <= "9") {
1433
- v += $;
1434
- continue;
1435
- }
1436
- if ($ === "." && re > 0 && !J) {
1437
- v += $, J = !0;
1438
- continue;
1439
- }
1440
- $ === "-" && e.allowNegative && F === 0 && !oe && (v += $, oe = !0);
1441
- }
1442
- if (re > 0 && J) {
1443
- const [F, $ = ""] = v.split(".");
1444
- return `${F}.${$.slice(0, re)}`;
1445
- }
1446
- return v;
1447
- }
1448
- function m(t) {
1449
- let l = t;
1450
- return typeof e.min == "number" && Number.isFinite(e.min) && (l = Math.max(l, e.min)), typeof e.max == "number" && Number.isFinite(e.max) && (l = Math.min(l, e.max)), l;
1451
- }
1452
- function Q(t) {
1453
- const l = D(t);
1454
- if (!l || l === "-" || l === ".")
1455
- return w(e.emptyValue);
1456
- const v = Number(l);
1457
- if (Number.isNaN(v)) return w(e.emptyValue);
1458
- const J = q(e.precision);
1459
- return m(v).toFixed(J);
1460
- }
1461
- function p(t) {
1462
- c.value = t, a("update:modelValue", t);
1463
- }
1464
- function T(t) {
1465
- const l = D(t);
1466
- p(l);
1467
- }
1468
- function g(t) {
1469
- const l = D(t);
1470
- c.value = l, a("input", l);
1471
- }
1472
- function R(t) {
1473
- const l = e.formatTrigger === "change" ? Q(t) : D(t);
1474
- l !== w(e.modelValue) && p(l), a("change", l);
1475
- }
1476
- function L(t) {
1477
- a("focus", t);
1478
- }
1479
- function y(t) {
1480
- if (e.formatTrigger === "blur") {
1481
- const l = Q(c.value);
1482
- l !== w(e.modelValue) && p(l);
1483
- }
1484
- a("blur", t);
1485
- }
1486
- function O() {
1487
- const t = w(e.emptyValue);
1488
- c.value = t, a("update:modelValue", t), a("clear");
1489
- }
1490
- function s(t) {
1491
- a("enter", t);
1492
- }
1493
- function A() {
1494
- var t, l;
1495
- (l = (t = i.value) == null ? void 0 : t.focus) == null || l.call(t);
1496
- }
1497
- function K() {
1498
- var t, l;
1499
- (l = (t = i.value) == null ? void 0 : t.blur) == null || l.call(t);
1500
- }
1501
- function u() {
1502
- var t, l;
1503
- (l = (t = i.value) == null ? void 0 : t.select) == null || l.call(t);
1504
- }
1505
- function B() {
1506
- var t, l;
1507
- (l = (t = i.value) == null ? void 0 : t.clear) == null || l.call(t);
1508
- }
1509
- function X() {
1510
- var t;
1511
- return ((t = i.value) == null ? void 0 : t.input) || null;
1512
- }
1513
- return k({
1514
- focus: A,
1515
- blur: K,
1516
- select: u,
1517
- clear: B,
1518
- getNativeInput: X
1519
- }), (t, l) => (b(), ie(_(Ee), ue({
1520
- ref_key: "inputRef",
1521
- ref: i
1522
- }, _(x), {
1523
- "model-value": V.value,
1524
- inputmode: "decimal",
1525
- "onUpdate:modelValue": T,
1526
- onInput: g,
1527
- onChange: R,
1528
- onFocus: L,
1529
- onBlur: y,
1530
- onClear: O,
1531
- onKeydown: Ue(s, ["enter"])
1532
- }), $e({ _: 2 }, [
1533
- t.$slots.prefix ? {
1534
- name: "prefix",
1535
- fn: S(() => [
1536
- I(t.$slots, "prefix")
1537
- ]),
1538
- key: "0"
1539
- } : void 0,
1540
- t.$slots.suffix ? {
1541
- name: "suffix",
1542
- fn: S(() => [
1543
- I(t.$slots, "suffix")
1544
- ]),
1545
- key: "1"
1546
- } : void 0,
1547
- t.$slots.prepend ? {
1548
- name: "prepend",
1549
- fn: S(() => [
1550
- I(t.$slots, "prepend")
1551
- ]),
1552
- key: "2"
1553
- } : void 0,
1554
- t.$slots.append ? {
1555
- name: "append",
1556
- fn: S(() => [
1557
- I(t.$slots, "append")
1558
- ]),
1559
- key: "3"
1560
- } : void 0
1561
- ]), 1040, ["model-value"]));
1562
- }
1563
- }), Tl = /* @__PURE__ */ ce({
1564
- name: "QyDatePicker",
1565
- inheritAttrs: !1,
1566
- __name: "index",
1567
- props: {
1568
- modelValue: { default: void 0 },
1569
- type: { default: "date" },
1570
- placeholder: { default: "请选择日期" },
1571
- startPlaceholder: { default: "开始时间" },
1572
- endPlaceholder: { default: "结束时间" },
1573
- rangeSeparator: { default: "-" },
1574
- format: { default: void 0 },
1575
- valueFormat: { default: void 0 },
1576
- defaultTime: { default: void 0 },
1577
- disabledDate: { type: Function, default: void 0 },
1578
- shortcuts: { default: void 0 },
1579
- clearable: { type: Boolean, default: !0 },
1580
- disabled: { type: Boolean, default: !1 },
1581
- size: { default: "default" },
1582
- teleported: { type: Boolean, default: !0 },
1583
- appendTo: { default: "body" },
1584
- popperClass: { default: "" },
1585
- normalizeRangeEndTime: { type: Boolean, default: !1 }
1586
- },
1587
- emits: ["update:modelValue", "change", "clear", "calendar-change", "panel-change", "visible-change", "focus", "blur"],
1588
- setup(o, { expose: k, emit: M }) {
1589
- const e = o, a = M, x = me(), i = z(null), c = H(
1590
- () => ["qy-date-picker__popper", e.popperClass].filter(Boolean).join(" ")
1591
- );
1592
- function V(u) {
1593
- return Array.isArray(u);
1594
- }
1595
- function w(u) {
1596
- const B = new Date(u);
1597
- return B.getHours() === 0 && B.getMinutes() === 0 && B.getSeconds() === 0 && B.setHours(23, 59, 59, 0), B;
1598
- }
1599
- function q(u) {
1600
- return /\s00:00:00$/.test(u) ? u.replace(/\s00:00:00$/, " 23:59:59") : /T00:00:00(?:\.000)?(?:Z|[+-]\d{2}:?\d{2})?$/.test(u) ? u.replace(
1601
- /T00:00:00(\.000)?(Z|[+-]\d{2}:?\d{2})?$/,
1602
- "T23:59:59$1$2"
1603
- ) : u;
1604
- }
1605
- function D(u) {
1606
- if (!e.normalizeRangeEndTime || !V(u) || u.length < 2)
1607
- return u;
1608
- const B = [...u], X = B[1];
1609
- return X instanceof Date ? B[1] = w(X) : typeof X == "string" && (B[1] = q(X)), B;
1610
- }
1611
- function m(u) {
1612
- a("update:modelValue", D(u));
1613
- }
1614
- function Q(u) {
1615
- a("change", D(u));
1616
- }
1617
- function p() {
1618
- a("clear");
1619
- }
1620
- function T(u) {
1621
- a("calendar-change", u);
1622
- }
1623
- function g(u, B, X) {
1624
- a("panel-change", u, B, X);
1625
- }
1626
- function R(u) {
1627
- a("visible-change", u);
1628
- }
1629
- function L(u) {
1630
- a("focus", u);
1631
- }
1632
- function y(u) {
1633
- a("blur", u);
1634
- }
1635
- function O() {
1636
- var u, B;
1637
- (B = (u = i.value) == null ? void 0 : u.focus) == null || B.call(u);
1638
- }
1639
- function s() {
1640
- var u, B;
1641
- (B = (u = i.value) == null ? void 0 : u.blur) == null || B.call(u);
1642
- }
1643
- function A() {
1644
- var u, B;
1645
- (B = (u = i.value) == null ? void 0 : u.handleOpen) == null || B.call(u);
1646
- }
1647
- function K() {
1648
- var u, B;
1649
- (B = (u = i.value) == null ? void 0 : u.handleClose) == null || B.call(u);
1650
- }
1651
- return k({
1652
- focus: O,
1653
- blur: s,
1654
- handleOpen: A,
1655
- handleClose: K
1656
- }), (u, B) => (b(), ie(_(Et), ue({
1657
- ref_key: "datePickerRef",
1658
- ref: i
1659
- }, _(x), {
1660
- "model-value": u.modelValue,
1661
- type: u.type,
1662
- placeholder: u.placeholder,
1663
- "start-placeholder": u.startPlaceholder,
1664
- "end-placeholder": u.endPlaceholder,
1665
- "range-separator": u.rangeSeparator,
1666
- format: u.format,
1667
- "value-format": u.valueFormat,
1668
- "default-time": u.defaultTime,
1669
- "disabled-date": u.disabledDate,
1670
- shortcuts: u.shortcuts,
1671
- clearable: u.clearable,
1672
- disabled: u.disabled,
1673
- size: u.size,
1674
- teleported: u.teleported,
1675
- "append-to": u.appendTo,
1676
- "popper-class": c.value,
1677
- "onUpdate:modelValue": m,
1678
- onChange: Q,
1679
- onClear: p,
1680
- onCalendarChange: T,
1681
- onPanelChange: g,
1682
- onVisibleChange: R,
1683
- onFocus: L,
1684
- onBlur: y
1685
- }), 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"]));
1686
- }
1687
- }), Fl = /* @__PURE__ */ ce({
1688
- name: "QyRadioGroup",
1689
- inheritAttrs: !1,
1690
- __name: "index",
1691
- props: {
1692
- modelValue: { type: [String, Number, Boolean, null], default: void 0 },
1693
- options: { default: () => [] },
1694
- labelKey: { default: "label" },
1695
- valueKey: { default: "value" },
1696
- disabledKey: { default: "disabled" },
1697
- disabled: { type: Boolean, default: !1 },
1698
- size: { default: "default" },
1699
- name: { default: void 0 },
1700
- type: { default: "radio" },
1701
- border: { type: Boolean, default: !1 }
1702
- },
1703
- emits: ["update:modelValue", "change"],
1704
- setup(o, { expose: k, emit: M }) {
1705
- const e = o, a = M, x = me(), i = z(null), c = H(
1706
- () => e.type === "button" ? Pt : Lt
1707
- ), V = H(
1708
- () => (e.options || []).map((p) => ({
1709
- raw: p,
1710
- label: (p == null ? void 0 : p[e.labelKey]) ?? (p == null ? void 0 : p.label) ?? (p == null ? void 0 : p.value) ?? "",
1711
- value: (p == null ? void 0 : p[e.valueKey]) ?? (p == null ? void 0 : p.value) ?? (p == null ? void 0 : p.label),
1712
- disabled: !!(p != null && p[e.disabledKey])
1713
- }))
1714
- );
1715
- function w(p) {
1716
- const T = {
1717
- value: p.value,
1718
- label: p.value,
1719
- disabled: p.disabled
1720
- };
1721
- return e.type === "button" ? T : {
1722
- ...T,
1723
- border: e.border
1724
- };
1725
- }
1726
- function q(p, T) {
1727
- return `${String(p.value ?? p.label ?? "")}-${T}`;
1728
- }
1729
- function D(p) {
1730
- a("update:modelValue", p);
1731
- }
1732
- function m(p) {
1733
- a("change", p);
1734
- }
1735
- function Q() {
1736
- return i.value;
1737
- }
1738
- return k({
1739
- getRadioGroupInstance: Q
1740
- }), (p, T) => (b(), ie(_(_t), ue({
1741
- ref_key: "radioGroupRef",
1742
- ref: i
1743
- }, _(x), {
1744
- "model-value": p.modelValue,
1745
- disabled: p.disabled,
1746
- size: p.size,
1747
- name: p.name,
1748
- "onUpdate:modelValue": D,
1749
- onChange: m
1750
- }), {
1751
- default: S(() => [
1752
- p.$slots.default ? I(p.$slots, "default", { key: 0 }) : (b(!0), E(Ce, { key: 1 }, lt(V.value, (g, R) => (b(), ie(qt(c.value), ue({
1753
- key: q(g, R)
1754
- }, { ref_for: !0 }, w(g)), {
1755
- default: S(() => [
1756
- I(p.$slots, "option", {
1757
- option: g.raw,
1758
- label: g.label,
1759
- value: g.value,
1760
- disabled: g.disabled
1761
- }, () => [
1762
- Ve(ne(g.label), 1)
1763
- ])
1764
- ]),
1765
- _: 2
1766
- }, 1040))), 128))
1767
- ]),
1768
- _: 3
1769
- }, 16, ["model-value", "disabled", "size", "name"]));
1770
- }
1771
- }), ot = /* @__PURE__ */ ce({
1772
- name: "QySelect",
1773
- inheritAttrs: !1,
1774
- __name: "index",
1775
- props: {
1776
- modelValue: { type: [String, Number, Boolean, Array, null], default: void 0 },
1777
- options: { default: () => [] },
1778
- labelKey: { default: "label" },
1779
- valueKey: { default: "value" },
1780
- disabledKey: { default: "disabled" },
1781
- placeholder: { default: "请选择" },
1782
- disabled: { type: Boolean, default: !1 },
1783
- clearable: { type: Boolean, default: !0 },
1784
- filterable: { type: Boolean, default: !1 },
1785
- multiple: { type: Boolean, default: !1 },
1786
- collapseTags: { type: Boolean, default: !1 },
1787
- collapseTagsTooltip: { type: Boolean, default: !1 },
1788
- autoSelectSingle: { type: Boolean, default: !1 },
1789
- size: { default: "default" },
1790
- teleported: { type: Boolean, default: !0 },
1791
- appendTo: { default: "body" },
1792
- fitInputWidth: { type: Boolean, default: !0 },
1793
- popperClass: { default: "" }
1794
- },
1795
- emits: ["update:modelValue", "change", "clear", "visible-change", "focus", "blur"],
1796
- setup(o, { expose: k, emit: M }) {
1797
- const e = o, a = M, x = me(), i = Je(), c = z(null), V = H(
1798
- () => ["qy-select__popper", e.popperClass].filter(Boolean).join(" ")
1799
- ), w = H(
1800
- () => (e.options || []).map((s) => ({
1801
- raw: s,
1802
- label: (s == null ? void 0 : s[e.labelKey]) ?? (s == null ? void 0 : s.label) ?? (s == null ? void 0 : s.value) ?? "",
1803
- value: (s == null ? void 0 : s[e.valueKey]) ?? (s == null ? void 0 : s.value) ?? (s == null ? void 0 : s.label),
1804
- disabled: !!(s != null && s[e.disabledKey])
1805
- }))
1806
- ), q = H(() => {
1807
- const s = i.default;
1808
- return s ? s().some((A) => A.type !== Tt) : !1;
1809
- });
1810
- function D(s) {
1811
- return Array.isArray(s) ? s.length === 0 : s === "" || s === null || s === void 0;
1812
- }
1813
- ye(
1814
- [
1815
- w,
1816
- () => e.modelValue,
1817
- () => e.autoSelectSingle,
1818
- () => e.disabled,
1819
- () => e.multiple
1820
- ],
1821
- ([s]) => {
1822
- if (!e.autoSelectSingle || e.disabled || !D(e.modelValue) || s.length !== 1) return;
1823
- const [A] = s;
1824
- if (A.disabled) return;
1825
- const K = e.multiple ? [A.value] : A.value;
1826
- a("update:modelValue", K), a("change", K);
1827
- },
1828
- { immediate: !0 }
1829
- );
1830
- function m(s, A) {
1831
- return `${String(s.value ?? s.label ?? "")}-${A}`;
1832
- }
1833
- function Q(s) {
1834
- a("update:modelValue", s);
1835
- }
1836
- function p(s) {
1837
- a("change", s);
1838
- }
1839
- function T() {
1840
- a("clear");
1841
- }
1842
- function g(s) {
1843
- a("visible-change", s);
1844
- }
1845
- function R(s) {
1846
- a("focus", s);
1847
- }
1848
- function L(s) {
1849
- a("blur", s);
1850
- }
1851
- function y() {
1852
- var s, A;
1853
- (A = (s = c.value) == null ? void 0 : s.focus) == null || A.call(s);
1854
- }
1855
- function O() {
1856
- var s, A;
1857
- (A = (s = c.value) == null ? void 0 : s.blur) == null || A.call(s);
1858
- }
1859
- return k({
1860
- // 仅暴露业务常用焦点方法,复杂下拉行为仍交给 Element Plus 自身处理。
1861
- focus: y,
1862
- blur: O
1863
- }), (s, A) => (b(), ie(_(jt), ue({
1864
- ref_key: "selectRef",
1865
- ref: c
1866
- }, _(x), {
1867
- "model-value": s.modelValue,
1868
- placeholder: s.placeholder,
1869
- disabled: s.disabled,
1870
- clearable: s.clearable,
1871
- filterable: s.filterable,
1872
- multiple: s.multiple,
1873
- "collapse-tags": s.collapseTags,
1874
- "collapse-tags-tooltip": s.collapseTagsTooltip,
1875
- size: s.size,
1876
- teleported: s.teleported,
1877
- "fit-input-width": s.fitInputWidth,
1878
- "popper-class": V.value,
1879
- "append-to": s.appendTo,
1880
- "onUpdate:modelValue": Q,
1881
- onChange: p,
1882
- onClear: T,
1883
- onVisibleChange: g,
1884
- onFocus: R,
1885
- onBlur: L
1886
- }), $e({
1887
- default: S(() => [
1888
- q.value ? I(s.$slots, "default", { key: 0 }) : (b(!0), E(Ce, { key: 1 }, lt(w.value, (K, u) => (b(), ie(_(Kt), {
1889
- key: m(K, u),
1890
- label: K.label,
1891
- value: K.value,
1892
- disabled: K.disabled
1893
- }, null, 8, ["label", "value", "disabled"]))), 128))
1894
- ]),
1895
- _: 2
1896
- }, [
1897
- s.$slots.prefix ? {
1898
- name: "prefix",
1899
- fn: S(() => [
1900
- I(s.$slots, "prefix")
1901
- ]),
1902
- key: "0"
1903
- } : void 0,
1904
- s.$slots.empty ? {
1905
- name: "empty",
1906
- fn: S(() => [
1907
- I(s.$slots, "empty")
1908
- ]),
1909
- key: "1"
1910
- } : void 0,
1911
- s.$slots.loading ? {
1912
- name: "loading",
1913
- fn: S(() => [
1914
- I(s.$slots, "loading")
1915
- ]),
1916
- key: "2"
1917
- } : void 0,
1918
- s.$slots.tag ? {
1919
- name: "tag",
1920
- fn: S((K) => [
1921
- I(s.$slots, "tag", Oe(Ae(K)))
1922
- ]),
1923
- key: "3"
1924
- } : void 0
1925
- ]), 1040, ["model-value", "placeholder", "disabled", "clearable", "filterable", "multiple", "collapse-tags", "collapse-tags-tooltip", "size", "teleported", "fit-input-width", "popper-class", "append-to"]));
1926
- }
1927
- }), Dl = /* @__PURE__ */ ce({
1928
- name: "QyRemoteSelect",
1929
- inheritAttrs: !1,
1930
- __name: "index",
1931
- props: {
1932
- modelValue: { type: [String, Number, Boolean, Array, null], default: void 0 },
1933
- fetchMethod: {},
1934
- defaultOptions: { default: () => [] },
1935
- labelKey: { default: "label" },
1936
- valueKey: { default: "value" },
1937
- disabledKey: { default: "disabled" },
1938
- placeholder: { default: "请选择" },
1939
- disabled: { type: Boolean, default: !1 },
1940
- clearable: { type: Boolean, default: !0 },
1941
- multiple: { type: Boolean, default: !1 },
1942
- collapseTags: { type: Boolean, default: !1 },
1943
- collapseTagsTooltip: { type: Boolean, default: !1 },
1944
- autoSelectSingle: { type: Boolean, default: !1 },
1945
- size: { default: "default" },
1946
- teleported: { type: Boolean, default: !0 },
1947
- appendTo: { default: "body" },
1948
- fitInputWidth: { type: Boolean, default: !0 },
1949
- popperClass: { default: "" },
1950
- debounce: { default: 300 },
1951
- minLength: { default: 1 },
1952
- remoteOnFocus: { type: Boolean, default: !1 },
1953
- remoteShowSuffix: { type: Boolean, default: !0 },
1954
- loading: { type: Boolean, default: !1 },
1955
- reserveSelectedOption: { type: Boolean, default: !0 }
1956
- },
1957
- emits: ["update:modelValue", "change", "clear", "visible-change", "focus", "blur", "options-change", "loading-change", "error"],
1958
- setup(o, { expose: k, emit: M }) {
1959
- const e = o, a = M, x = me(), i = z(null), c = z([]), V = z(/* @__PURE__ */ new Map()), w = z(!1), q = z("");
1960
- let D = 0, m = null;
1961
- const Q = H(() => e.loading || w.value), p = z(!1), T = H(() => {
1962
- const d = /* @__PURE__ */ new Map(), j = (Y) => {
1963
- d.set(g(Y), Y);
1964
- };
1965
- return e.defaultOptions.forEach(j), e.reserveSelectedOption && V.value.forEach((Y) => j(Y)), c.value.forEach(j), Array.from(d.values());
1966
- });
1967
- ye(
1968
- () => e.defaultOptions,
1969
- (d) => {
1970
- d.forEach(L);
1971
- },
1972
- { immediate: !0 }
1973
- ), ye(
1974
- () => e.modelValue,
1975
- () => {
1976
- T.value.forEach(L);
1977
- },
1978
- { immediate: !0 }
1979
- );
1980
- function g(d) {
1981
- return (d == null ? void 0 : d[e.valueKey]) ?? (d == null ? void 0 : d.value) ?? (d == null ? void 0 : d.label);
1982
- }
1983
- function R(d) {
1984
- return Array.isArray(e.modelValue) ? e.modelValue.includes(d) : e.modelValue === d;
1985
- }
1986
- function L(d) {
1987
- if (!e.reserveSelectedOption) return;
1988
- const j = g(d);
1989
- R(j) && V.value.set(j, d);
1990
- }
1991
- function y(d) {
1992
- return e.disabled ? !1 : d ? d.length >= e.minLength : e.remoteOnFocus;
1993
- }
1994
- function O(d) {
1995
- w.value !== d && (w.value = d, a("loading-change", d));
1996
- }
1997
- async function s(d) {
1998
- if (q.value = d, !y(d)) {
1999
- D += 1, c.value = [], O(!1), a("options-change", T.value);
2000
- return;
2001
- }
2002
- const j = ++D;
2003
- O(!0);
2004
- try {
2005
- const Y = await e.fetchMethod(d);
2006
- if (j !== D) return;
2007
- c.value = Array.isArray(Y) ? Y : [], c.value.forEach(L), a("options-change", T.value);
2008
- } catch (Y) {
2009
- if (j !== D) return;
2010
- c.value = [], a("error", Y), a("options-change", T.value);
2011
- } finally {
2012
- j === D && O(!1);
2013
- }
2014
- }
2015
- function A() {
2016
- p.value || (p.value = !0, s(""));
2017
- }
2018
- function K(d) {
2019
- m && (clearTimeout(m), m = null), m = setTimeout(() => {
2020
- s(d);
2021
- }, e.debounce);
2022
- }
2023
- function u() {
2024
- p.value = !0, s("");
2025
- }
2026
- function B() {
2027
- s(q.value);
2028
- }
2029
- function X(d) {
2030
- a("update:modelValue", d);
2031
- }
2032
- function t(d) {
2033
- T.value.forEach(L), a("change", d);
2034
- }
2035
- function l() {
2036
- a("clear");
2037
- }
2038
- function v(d) {
2039
- d && e.remoteOnFocus && !q.value && A(), a("visible-change", d);
2040
- }
2041
- function J(d) {
2042
- e.remoteOnFocus && !q.value && A(), a("focus", d);
2043
- }
2044
- function oe(d) {
2045
- a("blur", d);
2046
- }
2047
- function re() {
2048
- var d, j;
2049
- (j = (d = i.value) == null ? void 0 : d.focus) == null || j.call(d);
2050
- }
2051
- function F() {
2052
- var d, j;
2053
- (j = (d = i.value) == null ? void 0 : d.blur) == null || j.call(d);
2054
- }
2055
- function $() {
2056
- a("update:modelValue", e.multiple ? [] : ""), a("clear");
2057
- }
2058
- return Xe(() => {
2059
- m && clearTimeout(m);
2060
- }), k({
2061
- // 暴露远程选择常用控制方法,供弹窗打开后聚焦或请求失败后重试。
2062
- focus: re,
2063
- blur: F,
2064
- clear: $,
2065
- retryFetch: B,
2066
- fetchDefaultOptions: u
2067
- }), (d, j) => (b(), ie(ot, ue({
2068
- ref_key: "selectRef",
2069
- ref: i
2070
- }, _(x), {
2071
- "model-value": d.modelValue,
2072
- options: T.value,
2073
- "label-key": d.labelKey,
2074
- "value-key": d.valueKey,
2075
- "disabled-key": d.disabledKey,
2076
- placeholder: d.placeholder,
2077
- disabled: d.disabled,
2078
- clearable: d.clearable,
2079
- filterable: !0,
2080
- multiple: d.multiple,
2081
- "collapse-tags": d.collapseTags,
2082
- "collapse-tags-tooltip": d.collapseTagsTooltip,
2083
- "auto-select-single": d.autoSelectSingle,
2084
- size: d.size,
2085
- teleported: d.teleported,
2086
- "append-to": d.appendTo,
2087
- "fit-input-width": d.fitInputWidth,
2088
- "popper-class": d.popperClass,
2089
- remote: "",
2090
- "remote-show-suffix": d.remoteShowSuffix,
2091
- "remote-method": K,
2092
- loading: Q.value,
2093
- "onUpdate:modelValue": X,
2094
- onChange: t,
2095
- onClear: l,
2096
- onVisibleChange: v,
2097
- onFocus: J,
2098
- onBlur: oe
2099
- }), $e({
2100
- default: S(() => [
2101
- d.$slots.default ? I(d.$slots, "default", { key: 0 }) : Z("", !0)
2102
- ]),
2103
- _: 2
2104
- }, [
2105
- d.$slots.prefix ? {
2106
- name: "prefix",
2107
- fn: S(() => [
2108
- I(d.$slots, "prefix")
2109
- ]),
2110
- key: "0"
2111
- } : void 0,
2112
- d.$slots.empty ? {
2113
- name: "empty",
2114
- fn: S(() => [
2115
- I(d.$slots, "empty")
2116
- ]),
2117
- key: "1"
2118
- } : void 0,
2119
- d.$slots.loading ? {
2120
- name: "loading",
2121
- fn: S(() => [
2122
- I(d.$slots, "loading")
2123
- ]),
2124
- key: "2"
2125
- } : void 0,
2126
- d.$slots.tag ? {
2127
- name: "tag",
2128
- fn: S((Y) => [
2129
- I(d.$slots, "tag", Oe(Ae(Y)))
2130
- ]),
2131
- key: "3"
2132
- } : void 0
2133
- ]), 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"]));
2134
- }
2135
- }), Ql = { class: "qy-search-input__item" }, Ul = ["innerHTML"], Ol = {
2136
- key: 0,
2137
- class: "qy-search-input__item-description"
2138
- }, Al = /* @__PURE__ */ ce({
2139
- name: "QySearchInput",
2140
- inheritAttrs: !1,
2141
- __name: "index",
2142
- props: {
2143
- modelValue: { default: "" },
2144
- loading: { type: Boolean, default: !1 },
2145
- disabled: { type: Boolean, default: !1 },
2146
- placeholder: { default: "请输入搜索内容" },
2147
- removeSpace: { type: Boolean, default: !1 },
2148
- trimMode: { default: "none" },
2149
- clearable: { type: Boolean, default: !0 },
2150
- buttonText: { default: "搜索" },
2151
- buttonProps: { default: () => ({}) },
2152
- suggestions: { default: () => [] },
2153
- fetchSuggestions: { type: [Function, null], default: null },
2154
- fetchSuggestionsMethod: { type: [Function, null], default: null },
2155
- debounce: { default: 300 },
2156
- minLength: { default: 1 },
2157
- triggerOnFocus: { type: Boolean, default: !1 },
2158
- searchOnEnter: { type: Boolean, default: !0 },
2159
- searchOnSelect: { type: Boolean, default: !1 },
2160
- highlightKeyword: { type: Boolean, default: !0 },
2161
- teleported: { type: Boolean, default: !0 },
2162
- appendTo: { default: "body" },
2163
- popperClass: { default: "" },
2164
- fitInputWidth: { type: Boolean, default: !0 }
2165
- },
2166
- emits: ["update:modelValue", "search", "clear", "input", "change", "focus", "blur", "enter", "select", "visible-change", "suggestions-change", "error"],
2167
- setup(o, { expose: k, emit: M }) {
2168
- const e = o, a = M, x = me(), i = z(null), c = z(m(e.modelValue)), V = H(() => m(e.modelValue)), w = H(
2169
- () => ["qy-search-input__popper", e.popperClass].filter(Boolean).join(" ")
2170
- ), q = H(() => m(e.modelValue)), D = z("");
2171
- ye(
2172
- () => e.modelValue,
2173
- (n) => {
2174
- c.value = m(n);
2175
- }
2176
- );
2177
- function m(n) {
2178
- return n == null ? "" : String(n);
2179
- }
2180
- function Q(n) {
2181
- return e.removeSpace ? n.replace(/\s+/g, "") : n;
2182
- }
2183
- function p(n, h) {
2184
- return e.trimMode !== h ? n : n.trim();
2185
- }
2186
- function T(n) {
2187
- return Q(m(n));
2188
- }
2189
- function g(n) {
2190
- c.value = n, a("update:modelValue", n);
2191
- }
2192
- function R(n, h = "") {
2193
- return {
2194
- ...n,
2195
- label: n.label || n.value,
2196
- value: n.value || n.label,
2197
- description: n.description || h
2198
- };
2199
- }
2200
- function L(n = []) {
2201
- return n.flatMap((h) => {
2202
- if (Array.isArray(h.items)) {
2203
- const W = h;
2204
- return W.items.map((fe) => R(fe, W.groupLabel));
2205
- }
2206
- return R(h);
2207
- });
2208
- }
2209
- function y(n) {
2210
- const h = n.toLowerCase();
2211
- return (W) => [W.label, W.value, W.description].filter(Boolean).some((fe) => String(fe).toLowerCase().includes(h));
2212
- }
2213
- function O(n) {
2214
- return n ? n.length >= e.minLength : e.triggerOnFocus;
2215
- }
2216
- function s(n) {
2217
- a("suggestions-change", n), a("visible-change", n.length > 0);
2218
- }
2219
- async function A(n) {
2220
- if (!O(n))
2221
- return s([]), [];
2222
- if (e.fetchSuggestionsMethod) {
2223
- const fe = await new Promise((ge) => {
2224
- var Ie;
2225
- (Ie = e.fetchSuggestionsMethod) == null || Ie.call(e, n, (qe) => {
2226
- ge(L(qe));
2227
- });
2228
- });
2229
- return s(fe), fe;
2230
- }
2231
- if (e.fetchSuggestions) {
2232
- const fe = await e.fetchSuggestions(n), ge = L(Array.isArray(fe) ? fe : []);
2233
- return s(ge), ge;
2234
- }
2235
- const h = L(e.suggestions), W = n ? h.filter(y(n)) : h;
2236
- return s(W), W;
2237
- }
2238
- async function K(n, h) {
2239
- D.value = n;
2240
- try {
2241
- const W = await A(n);
2242
- h(W);
2243
- } catch (W) {
2244
- a("error", W), s([]), h([]);
2245
- }
2246
- }
2247
- function u() {
2248
- var n, h;
2249
- D.value && ((h = (n = i.value) == null ? void 0 : n.getData) == null || h.call(n, D.value));
2250
- }
2251
- function B(n) {
2252
- const h = T(n);
2253
- g(h);
2254
- }
2255
- function X(n) {
2256
- const h = T(n);
2257
- c.value = h, a("input", h);
2258
- }
2259
- function t(n) {
2260
- const h = p(T(n), "change");
2261
- h !== m(e.modelValue) && g(h), a("change", h);
2262
- }
2263
- function l(n) {
2264
- a("focus", n);
2265
- }
2266
- function v(n) {
2267
- const h = p(c.value, "blur");
2268
- h !== m(e.modelValue) && g(h), a("blur", n), a("visible-change", !1);
2269
- }
2270
- function J() {
2271
- c.value = "", a("update:modelValue", ""), a("clear"), s([]);
2272
- }
2273
- function oe(n) {
2274
- a("enter", n), e.searchOnEnter && re();
2275
- }
2276
- function re() {
2277
- a("search", m(e.modelValue));
2278
- }
2279
- function F(n) {
2280
- a("select", n), e.searchOnSelect && a("search", n.value);
2281
- }
2282
- function $(n) {
2283
- return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
2284
- }
2285
- function d(n) {
2286
- return n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2287
- }
2288
- function j(n) {
2289
- const h = $(n || "");
2290
- if (!e.highlightKeyword || !V.value) return h;
2291
- const W = d($(V.value));
2292
- return W ? h.replace(
2293
- new RegExp(`(${W})`, "ig"),
2294
- '<mark class="qy-search-input__mark">$1</mark>'
2295
- ) : h;
2296
- }
2297
- function Y() {
2298
- var n, h;
2299
- (h = (n = i.value) == null ? void 0 : n.focus) == null || h.call(n);
2300
- }
2301
- function be() {
2302
- var n, h;
2303
- (h = (n = i.value) == null ? void 0 : n.blur) == null || h.call(n);
2304
- }
2305
- function ke() {
2306
- var n, h, W;
2307
- (W = (h = (n = i.value) == null ? void 0 : n.inputRef) == null ? void 0 : h.select) == null || W.call(h);
2308
- }
2309
- function ve() {
2310
- var n, h;
2311
- (h = (n = i.value) == null ? void 0 : n.clear) == null || h.call(n);
2312
- }
2313
- function ze() {
2314
- var n, h;
2315
- (h = (n = i.value) == null ? void 0 : n.close) == null || h.call(n);
2316
- }
2317
- return k({
2318
- // 暴露搜索框常用控制方法,供弹窗打开后聚焦或失败后重试建议项。
2319
- focus: Y,
2320
- blur: be,
2321
- select: ke,
2322
- clear: ve,
2323
- closePanel: ze,
2324
- retryFetch: u
2325
- }), (n, h) => (b(), E("div", {
2326
- class: de(["qy-search-input", { "is-disabled": n.disabled }])
2327
- }, [
2328
- le(_(Nt), ue({
2329
- ref_key: "autocompleteRef",
2330
- ref: i
2331
- }, _(x), {
2332
- "model-value": q.value,
2333
- disabled: n.disabled,
2334
- placeholder: n.placeholder,
2335
- clearable: n.clearable,
2336
- debounce: n.debounce,
2337
- "fetch-suggestions": K,
2338
- "trigger-on-focus": n.triggerOnFocus,
2339
- teleported: n.teleported,
2340
- "fit-input-width": n.fitInputWidth,
2341
- "popper-class": w.value,
2342
- "append-to": n.appendTo,
2343
- "value-key": "value",
2344
- "onUpdate:modelValue": B,
2345
- onInput: X,
2346
- onChange: t,
2347
- onFocus: l,
2348
- onBlur: v,
2349
- onClear: J,
2350
- onSelect: F,
2351
- onKeydown: Ue(oe, ["enter"])
2352
- }), $e({
2353
- append: S(() => [
2354
- n.$slots.append ? I(n.$slots, "append", { key: 0 }, void 0, !0) : (b(), ie(_(Re), ue({ key: 1 }, n.buttonProps, {
2355
- loading: n.loading,
2356
- disabled: n.disabled,
2357
- onClick: re
2358
- }), {
2359
- default: S(() => [
2360
- Ve(ne(n.buttonText), 1)
2361
- ]),
2362
- _: 1
2363
- }, 16, ["loading", "disabled"]))
2364
- ]),
2365
- default: S(({ item: W }) => [
2366
- I(n.$slots, "item", {
2367
- item: W,
2368
- keyword: V.value
2369
- }, () => [
2370
- U("div", Ql, [
2371
- U("div", {
2372
- class: "qy-search-input__item-label",
2373
- innerHTML: j(W.label || W.value || "")
2374
- }, null, 8, Ul),
2375
- W.description ? (b(), E("div", Ol, ne(W.description), 1)) : Z("", !0)
2376
- ])
2377
- ], !0)
2378
- ]),
2379
- _: 2
2380
- }, [
2381
- n.$slots.prefix ? {
2382
- name: "prefix",
2383
- fn: S(() => [
2384
- I(n.$slots, "prefix", {}, void 0, !0)
2385
- ]),
2386
- key: "0"
2387
- } : void 0,
2388
- n.$slots.suffix ? {
2389
- name: "suffix",
2390
- fn: S(() => [
2391
- I(n.$slots, "suffix", {}, void 0, !0)
2392
- ]),
2393
- key: "1"
2394
- } : void 0,
2395
- n.$slots.prepend ? {
2396
- name: "prepend",
2397
- fn: S(() => [
2398
- I(n.$slots, "prepend", {}, void 0, !0)
2399
- ]),
2400
- key: "2"
2401
- } : void 0
2402
- ]), 1040, ["model-value", "disabled", "placeholder", "clearable", "debounce", "trigger-on-focus", "teleported", "fit-input-width", "popper-class", "append-to"])
2403
- ], 2));
2404
- }
2405
- }), st = /* @__PURE__ */ Be(Al, [["__scopeId", "data-v-f1f0e1f9"]]), El = { class: "qy-record-quote-search" }, Pl = {
2406
- key: 0,
2407
- class: "qy-record-quote-search__header"
2408
- }, Ll = {
2409
- key: 0,
2410
- class: "qy-record-quote-search__label"
2411
- }, _l = {
2412
- key: 1,
2413
- class: "qy-record-quote-search__description"
2414
- }, jl = /* @__PURE__ */ ce({
2415
- name: "QyRecordQuoteSearch",
2416
- inheritAttrs: !1,
2417
- __name: "index",
2418
- props: {
2419
- modelValue: { default: "" },
2420
- loading: { type: Boolean, default: !1 },
2421
- disabled: { type: Boolean, default: !1 },
2422
- placeholder: { default: "请输入报价单号" },
2423
- buttonText: { default: "查询报价单" },
2424
- autoNormalize: { type: Boolean, default: !0 },
2425
- showStatus: { type: Boolean, default: !0 },
2426
- status: { default: "default" },
2427
- statusText: { default: "" },
2428
- suggestions: { default: () => [] },
2429
- fetchSuggestions: { type: [Function, null], default: null },
2430
- fetchSuggestionsMethod: { type: [Function, null], default: null },
2431
- debounce: { default: 300 },
2432
- minLength: { default: 1 },
2433
- searchOnSelect: { type: Boolean, default: !0 },
2434
- searchMethod: { type: [Function, null], default: null },
2435
- extractMethod: { type: [Function, null], default: null },
2436
- normalizeMethod: { type: [Function, null], default: null },
2437
- label: { default: "报价单号" },
2438
- description: { default: "" },
2439
- trimMode: { default: "blur" }
2440
- },
2441
- emits: ["update:modelValue", "search", "clear", "normalize", "enter", "select", "error", "success"],
2442
- setup(o, { expose: k, emit: M }) {
2443
- const e = o, a = M, x = me(), i = z(null), c = z(!1), V = H(() => e.statusText || ""), w = H(() => e.loading || c.value);
2444
- function q(t) {
2445
- return t == null ? "" : String(t);
2446
- }
2447
- function D(t) {
2448
- const l = q(t).trim(), v = m(l), J = v.match(/BJ\d{8}[A-Z0-9]{4}/i);
2449
- return J ? J[0] : v;
2450
- }
2451
- function m(t) {
2452
- return q(t).replace(/\s+/g, "").trim().toUpperCase();
2453
- }
2454
- function Q(t) {
2455
- return e.extractMethod ? e.extractMethod(t) : D(t);
2456
- }
2457
- function p(t) {
2458
- return e.normalizeMethod ? e.normalizeMethod(t) : m(t);
2459
- }
2460
- function T(t, l) {
2461
- const v = q(t), J = Q(v), oe = e.autoNormalize ? p(J) : J;
2462
- return a("normalize", { rawValue: v, code: oe }), {
2463
- rawValue: v,
2464
- code: oe,
2465
- item: l
2466
- };
2467
- }
2468
- function g(t) {
2469
- a("update:modelValue", t);
2470
- }
2471
- async function R(t) {
2472
- if (a("search", t), !!e.searchMethod) {
2473
- c.value = !0;
2474
- try {
2475
- const l = await e.searchMethod(t);
2476
- a("success", l);
2477
- } catch (l) {
2478
- a("error", l);
2479
- } finally {
2480
- c.value = !1;
2481
- }
2482
- }
2483
- }
2484
- function L(t) {
2485
- const l = T(t);
2486
- l.code !== q(e.modelValue) && a("update:modelValue", l.code), R(l);
2487
- }
2488
- function y() {
2489
- a("clear");
2490
- }
2491
- function O(t) {
2492
- a("enter", t);
2493
- }
2494
- function s(t) {
2495
- if (a("select", t), !e.searchOnSelect) return;
2496
- const l = T(t.value, t);
2497
- l.code !== q(e.modelValue) && a("update:modelValue", l.code), R(l);
2498
- }
2499
- function A(t) {
2500
- a("error", t);
2501
- }
2502
- function K() {
2503
- var t, l;
2504
- (l = (t = i.value) == null ? void 0 : t.focus) == null || l.call(t);
2505
- }
2506
- function u() {
2507
- var t, l;
2508
- (l = (t = i.value) == null ? void 0 : t.blur) == null || l.call(t);
2509
- }
2510
- function B() {
2511
- var t, l;
2512
- (l = (t = i.value) == null ? void 0 : t.select) == null || l.call(t);
2513
- }
2514
- function X() {
2515
- var t, l;
2516
- (l = (t = i.value) == null ? void 0 : t.clear) == null || l.call(t);
2517
- }
2518
- return k({
2519
- focus: K,
2520
- blur: u,
2521
- select: B,
2522
- clear: X,
2523
- extractQuoteOrderCode: Q,
2524
- normalizeQuoteOrderCode: p
2525
- }), (t, l) => (b(), E("div", El, [
2526
- I(t.$slots, "label", {}, () => [
2527
- t.label || t.description ? (b(), E("div", Pl, [
2528
- t.label ? (b(), E("div", Ll, ne(t.label), 1)) : Z("", !0),
2529
- t.description ? (b(), E("div", _l, ne(t.description), 1)) : Z("", !0)
2530
- ])) : Z("", !0)
2531
- ], !0),
2532
- le(st, ue({
2533
- ref_key: "searchRef",
2534
- ref: i
2535
- }, _(x), {
2536
- "model-value": t.modelValue,
2537
- loading: w.value,
2538
- disabled: t.disabled,
2539
- placeholder: t.placeholder,
2540
- "remove-space": !0,
2541
- "trim-mode": t.trimMode,
2542
- "button-text": t.buttonText,
2543
- suggestions: t.suggestions,
2544
- "fetch-suggestions": t.fetchSuggestions,
2545
- "fetch-suggestions-method": t.fetchSuggestionsMethod,
2546
- debounce: t.debounce,
2547
- "min-length": t.minLength,
2548
- "search-on-select": !1,
2549
- "onUpdate:modelValue": g,
2550
- onSearch: L,
2551
- onClear: y,
2552
- onEnter: O,
2553
- onSelect: s,
2554
- onError: A
2555
- }), $e({ _: 2 }, [
2556
- t.$slots.prefix ? {
2557
- name: "prefix",
2558
- fn: S(() => [
2559
- I(t.$slots, "prefix", {}, void 0, !0)
2560
- ]),
2561
- key: "0"
2562
- } : void 0,
2563
- t.$slots.suffix ? {
2564
- name: "suffix",
2565
- fn: S(() => [
2566
- I(t.$slots, "suffix", {}, void 0, !0)
2567
- ]),
2568
- key: "1"
2569
- } : void 0,
2570
- t.$slots.item ? {
2571
- name: "item",
2572
- fn: S((v) => [
2573
- I(t.$slots, "item", Oe(Ae(v)), void 0, !0)
2574
- ]),
2575
- key: "2"
2576
- } : void 0,
2577
- t.$slots.empty ? {
2578
- name: "empty",
2579
- fn: S(() => [
2580
- I(t.$slots, "empty", {}, void 0, !0)
2581
- ]),
2582
- key: "3"
2583
- } : void 0,
2584
- t.$slots.loading ? {
2585
- name: "loading",
2586
- fn: S(() => [
2587
- I(t.$slots, "loading", {}, void 0, !0)
2588
- ]),
2589
- key: "4"
2590
- } : void 0
2591
- ]), 1040, ["model-value", "loading", "disabled", "placeholder", "trim-mode", "button-text", "suggestions", "fetch-suggestions", "fetch-suggestions-method", "debounce", "min-length"]),
2592
- t.showStatus && V.value ? I(t.$slots, "status", {
2593
- key: 0,
2594
- status: t.status,
2595
- statusText: V.value
2596
- }, () => [
2597
- U("div", {
2598
- class: de(["qy-record-quote-search__status", `is-${t.status}`])
2599
- }, ne(V.value), 3)
2600
- ], !0) : Z("", !0)
2601
- ]));
2602
- }
2603
- }), Kl = /* @__PURE__ */ Be(jl, [["__scopeId", "data-v-3a314f64"]]), Nl = { class: "qy-form-section__heading" }, Hl = {
2604
- key: 0,
2605
- class: "qy-form-section__title"
2606
- }, Zl = {
2607
- key: 0,
2608
- class: "qy-form-section__description"
2609
- }, Wl = { class: "qy-form-section__actions" }, Gl = /* @__PURE__ */ ce({
2610
- name: "QyFormSection",
2611
- __name: "index",
2612
- props: {
2613
- title: { default: "" },
2614
- description: { default: "" },
2615
- tip: { default: "" },
2616
- tipType: { default: "info" },
2617
- collapsible: { type: Boolean, default: !1 },
2618
- defaultExpanded: { type: Boolean, default: !0 },
2619
- bordered: { type: Boolean, default: !0 },
2620
- background: { default: "white" },
2621
- bodyClass: { default: "" },
2622
- headerClass: { default: "" }
2623
- },
2624
- emits: ["toggle"],
2625
- setup(o, { emit: k }) {
2626
- const M = o, e = k, a = z(M.defaultExpanded);
2627
- ye(
2628
- () => M.defaultExpanded,
2629
- (c) => {
2630
- a.value = c;
2631
- }
2632
- );
2633
- function x() {
2634
- M.collapsible && (a.value = !a.value, e("toggle", a.value));
2635
- }
2636
- function i() {
2637
- M.collapsible && x();
2638
- }
2639
- return (c, V) => (b(), E("section", {
2640
- class: de(["qy-form-section", [
2641
- `is-bg-${c.background}`,
2642
- {
2643
- "is-bordered": c.bordered,
2644
- "is-collapsible": c.collapsible
2645
- }
2646
- ]])
2647
- }, [
2648
- U("header", {
2649
- class: de(["qy-form-section__header", c.headerClass]),
2650
- onClick: i
2651
- }, [
2652
- U("div", Nl, [
2653
- I(c.$slots, "title", {}, () => [
2654
- c.title ? (b(), E("div", Hl, ne(c.title), 1)) : Z("", !0)
2655
- ], !0),
2656
- I(c.$slots, "description", {}, () => [
2657
- c.description ? (b(), E("div", Zl, ne(c.description), 1)) : Z("", !0)
2658
- ], !0)
2659
- ]),
2660
- U("div", Wl, [
2661
- I(c.$slots, "actions", {}, void 0, !0),
2662
- c.collapsible ? (b(), E("button", {
2663
- key: 0,
2664
- type: "button",
2665
- class: "qy-form-section__toggle",
2666
- onClick: te(x, ["stop"])
2667
- }, ne(a.value ? "收起" : "展开"), 1)) : Z("", !0)
2668
- ])
2669
- ], 2),
2670
- et(U("div", {
2671
- class: de(["qy-form-section__body", c.bodyClass])
2672
- }, [
2673
- I(c.$slots, "tip", {}, () => [
2674
- c.tip ? (b(), E("div", {
2675
- key: 0,
2676
- class: de(["qy-form-section__tip", `is-${c.tipType}`])
2677
- }, ne(c.tip), 3)) : Z("", !0)
2678
- ], !0),
2679
- I(c.$slots, "default", {}, void 0, !0)
2680
- ], 2), [
2681
- [tt, a.value]
2682
- ])
2683
- ], 2));
2684
- }
2685
- }), Xl = /* @__PURE__ */ Be(Gl, [["__scopeId", "data-v-8149aa01"]]), Jl = {
2686
- key: 0,
2687
- class: "qy-action-bar__left"
2688
- }, Yl = {
2689
- key: 1,
2690
- class: "qy-action-bar__center"
2691
- }, ea = {
2692
- key: 2,
2693
- class: "qy-action-bar__right"
2694
- }, ta = /* @__PURE__ */ ce({
2695
- name: "QyActionBar",
2696
- __name: "index",
2697
- props: {
2698
- sticky: { type: Boolean, default: !0 },
2699
- offsetBottom: { default: 0 },
2700
- bordered: { type: Boolean, default: !0 },
2701
- shadow: { type: Boolean, default: !1 },
2702
- wrap: { type: Boolean, default: !0 },
2703
- justify: { default: "between" },
2704
- background: { default: "#fff" }
2705
- },
2706
- setup(o) {
2707
- const k = o, M = H(() => ({
2708
- // offsetBottom 只负责业务偏移,安全区补偿由 CSS padding 处理。
2709
- bottom: `${k.offsetBottom}px`,
2710
- background: k.background
2711
- }));
2712
- return (e, a) => (b(), E("div", {
2713
- class: de(["qy-action-bar", [
2714
- `is-justify-${e.justify}`,
2715
- {
2716
- "is-sticky": e.sticky,
2717
- "is-bordered": e.bordered,
2718
- "is-shadow": e.shadow,
2719
- "is-wrap": e.wrap
2720
- }
2721
- ]]),
2722
- style: Se(M.value)
2723
- }, [
2724
- e.$slots.left ? (b(), E("div", Jl, [
2725
- I(e.$slots, "left", {}, void 0, !0)
2726
- ])) : Z("", !0),
2727
- e.$slots.default ? (b(), E("div", Yl, [
2728
- I(e.$slots, "default", {}, void 0, !0)
2729
- ])) : Z("", !0),
2730
- e.$slots.right ? (b(), E("div", ea, [
2731
- I(e.$slots, "right", {}, void 0, !0)
2732
- ])) : Z("", !0)
2733
- ], 6));
2734
- }
2735
- }), la = /* @__PURE__ */ Be(ta, [["__scopeId", "data-v-ecba8f49"]]);
2736
- function se(o, k = o == null ? void 0 : o.name) {
2737
- return k && (o.install = (M) => {
2738
- M.component(k, o);
2739
- }), o;
2740
- }
2741
- const rt = se(nt, "QyUpload"), it = se(sl, "QyVoucherUpload"), ut = se(vl, "QyDialog"), dt = se(xl, "QyRemarkImage"), ct = se(Ml, "QyInput"), ft = se(Rl, "QyInputNumber"), pt = se(ql, "QyMoneyInput"), mt = se(Tl, "QyDatePicker"), yt = se(Fl, "QyRadioGroup"), gt = se(Dl, "QyRemoteSelect"), ht = se(st, "QySearchInput"), vt = se(
2742
- Kl,
2743
- "QyRecordQuoteSearch"
2744
- ), bt = se(ot, "QySelect"), kt = se(Xl, "QyFormSection"), wt = se(la, "QyActionBar"), aa = (o) => {
2745
- o.component("QyDialog", ut), o.component("QyUpload", rt), o.component("QyVoucherUpload", it), o.component("QyRemarkImage", dt), o.component("QyInput", ct), o.component("QyInputNumber", ft), o.component("QyMoneyInput", pt), o.component("QyDatePicker", mt), o.component("QyRadioGroup", yt), o.component("QyRemoteSelect", gt), o.component("QySearchInput", ht), o.component("QyRecordQuoteSearch", vt), o.component("QySelect", bt), o.component("QyFormSection", kt), o.component("QyActionBar", wt);
2746
- }, da = {
2747
- install: aa,
2748
- QyUpload: rt,
2749
- QyVoucherUpload: it,
2750
- QyDialog: ut,
2751
- QyInput: ct,
2752
- QyInputNumber: ft,
2753
- QyMoneyInput: pt,
2754
- QyDatePicker: mt,
2755
- QyRadioGroup: yt,
2756
- QyRemoteSelect: gt,
2757
- QySearchInput: ht,
2758
- QyRecordQuoteSearch: vt,
2759
- QySelect: bt,
2760
- QyFormSection: kt,
2761
- QyActionBar: wt,
2762
- QyRemarkImage: dt
2763
- };
2764
- export {
2765
- rt as Q,
2766
- it as a,
2767
- ut as b,
2768
- ct as c,
2769
- ft as d,
2770
- pt as e,
2771
- mt as f,
2772
- yt as g,
2773
- gt as h,
2774
- ht as i,
2775
- vt as j,
2776
- bt as k,
2777
- kt as l,
2778
- wt as m,
2779
- dt as n,
2780
- bl as o,
2781
- He as p,
2782
- Ze as q,
2783
- da as r
2784
- };