mgacn-commonsdk 1.3.4 → 1.3.6

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.
@@ -1,202 +1,58 @@
1
- import { Plus as it, Delete as ot, CircleCloseFilled as ut, Document as ct, Close as dt, CircleClose as ze, CircleCheck as pt, ArrowUp as ft, ArrowDown as ht } from "@element-plus/icons-vue";
2
- import { ElMessage as G, ElMessageBox as Ee } from "element-plus";
1
+ import { Plus as ot, Delete as ut, CircleCloseFilled as ct, Document as dt, Close as pt, CircleClose as We, CircleCheck as ft, ArrowUp as ht, ArrowDown as gt } from "@element-plus/icons-vue";
2
+ import { ElMessage as G, ElMessageBox as Ye } from "element-plus";
3
3
  import mt from "cropperjs";
4
- import * as Pe from "ali-oss";
5
- import { g as gt, _ as ae, o as yt, k as je, t as vt, l as bt, m as Ke, F as _t, n as wt, p as Ct, q as kt, r as Ut, u as St } from "./FilePreview-BfYgqJbP.js";
6
- import { i as cl, j as dl, c as pl, v as fl, w as hl, b as ml, x as gl, y as yl, a as vl, s as bl, z as _l } from "./FilePreview-BfYgqJbP.js";
7
- import { resolveComponent as $, openBlock as d, createElementBlock as y, createElementVNode as C, toDisplayString as B, createCommentVNode as V, createTextVNode as q, Fragment as ee, renderList as ne, normalizeStyle as fe, normalizeClass as W, createVNode as S, withCtx as N, withModifiers as ye, withDirectives as ue, vShow as ce, createBlock as D, computed as ve, ref as A, watch as le, onMounted as be, reactive as Te, nextTick as X, onBeforeUnmount as Se, withKeys as Be, unref as de, renderSlot as oe, mergeProps as De, createSlots as xt } from "vue";
8
- const Ft = Pe.default ?? Pe, We = "__MGACN_COMMONSDK_OSS_URL__";
9
- function Lt(e = "") {
10
- globalThis[We] = String(e || "").replace(/\/$/, "");
4
+ import { _ as Z, k as qe, u as Ge, t as be, l as E, m as ce, n as Je, p as vt, q as yt, r as se, v as _e, w as Ve, x as bt, y as Xe, z as _t, A as wt, B as Qe, F as xt, C as St, D as kt, E as Ut, G as Ct, H as Ft, I as Lt } from "./FilePreview-Dx4GAw4K.js";
5
+ import { i as fl, J as hl, j as gl, c as ml, K as vl, L as yl, M as bl, g as _l, N as wl, O as xl, b as Sl, P as kl, Q as Ul, R as Cl, S as Fl, o as Ll, T as Nl, a as Al, s as Rl, U as $l } from "./FilePreview-Dx4GAw4K.js";
6
+ import { resolveComponent as N, openBlock as d, createElementBlock as m, createElementVNode as b, toDisplayString as T, createCommentVNode as V, createTextVNode as q, Fragment as Q, renderList as te, normalizeStyle as de, normalizeClass as j, createVNode as S, withCtx as F, withModifiers as we, withDirectives as ae, vShow as oe, createBlock as B, mergeProps as Ne, computed as xe, ref as O, watch as ne, onMounted as Se, reactive as Ie, nextTick as J, onBeforeUnmount as Re, withKeys as Oe, unref as ue, renderSlot as ie, createSlots as Nt } from "vue";
7
+ let De = 0;
8
+ function Ze() {
9
+ return De += 1, `mg-img-${Date.now()}-${De}`;
11
10
  }
12
- function Ye() {
13
- return globalThis[We] || "";
14
- }
15
- function Oe(e) {
16
- return String(e).padStart(2, "0");
17
- }
18
- function Nt() {
19
- const e = /* @__PURE__ */ new Date();
20
- return `${e.getFullYear()}${Oe(e.getMonth() + 1)}${Oe(e.getDate())}`;
21
- }
22
- function qe(e = 10) {
23
- const t = "0123456789abcdefghijklmnopqrstuvwxyz";
24
- let n = "";
25
- for (let a = 0; a < e; a++)
26
- n += t[Math.floor(Math.random() * t.length)];
27
- return n;
28
- }
29
- function xe(e = "portal_cms") {
30
- return `${e}/${Nt()}/`;
31
- }
32
- function Ge(e) {
33
- return gt().getOssSts(e);
34
- }
35
- function $t(e = {}) {
36
- const t = e.accessKeyId || e.AccessKeyId || e.accessKeyID || "", n = e.accessKeySecret || e.AccessKeySecret || "", a = e.securityToken || e.SecurityToken || e.stsToken || e.token || "", l = e.bucketName || e.bucket || e.BucketName || "";
37
- let i = String(e.endPoint || e.endpoint || e.EndPoint || "").replace(/^https?:\/\//i, "").replace(/\/$/, "");
38
- l && i.startsWith(`${l}.`) && (i = i.slice(l.length + 1));
39
- const p = e.region || (i.startsWith("oss-") ? i.replace(/\.aliyuncs\.com.*$/i, "") : ""), m = String(e.ossUrl || e.domain || e.cdnDomain || "").replace(/\/$/, ""), _ = l && i ? `https://${l}.${i}` : Ye();
40
- return {
41
- accessKeyId: t,
42
- accessKeySecret: n,
43
- securityToken: a,
44
- bucketName: l,
45
- endPoint: i,
46
- region: p,
47
- ossUrl: m || _
48
- };
49
- }
50
- async function Fe(e = {}) {
51
- const { dir: t, foldName: n, getOss: a, ossinfo: l } = e, i = t || xe(n || "portal_cms"), p = l || (typeof a == "function" ? await a(i) : await Ge(i)), m = $t(p || {});
52
- if (!m.accessKeyId || !m.accessKeySecret || !m.bucketName)
53
- throw new Error("[mgacn-commonsdk] 获取 OSS STS 失败:凭证字段不完整");
54
- if (!m.securityToken)
55
- throw new Error("[mgacn-commonsdk] 获取 OSS STS 失败:缺少 securityToken");
56
- const _ = {
57
- bucket: m.bucketName,
58
- accessKeyId: m.accessKeyId,
59
- accessKeySecret: m.accessKeySecret,
60
- stsToken: m.securityToken,
61
- secure: !0,
62
- success_action_status: "200"
63
- };
64
- m.region && (_.region = m.region), m.endPoint && (_.endpoint = m.endPoint);
65
- const w = new Ft(_);
66
- return w.options.ossUrl = m.ossUrl || Ye(), w.options.uploadDir = i, w;
67
- }
68
- async function Xe(e = {}) {
69
- var J, Q;
70
- const { client: t, file: n, dir: a, foldName: l, fileName: i, onProgress: p } = e;
71
- if (!n)
72
- throw new Error("[mgacn-commonsdk] uploadToOss 缺少 file");
73
- const m = t || await Fe({ dir: a, foldName: l }), _ = a || m.options.uploadDir || xe(l);
74
- let w = i;
75
- if (!w) {
76
- const z = n.name || "file", g = z.lastIndexOf("."), b = g > -1 ? z.slice(g) : "";
77
- w = `${_}${qe(10)}${b}`;
78
- }
79
- const F = (z) => {
80
- typeof p == "function" && p(Math.min(100, Math.max(0, Math.floor(Number(z) * 100))));
81
- }, P = n.size > 1 * 1024 * 1024, f = {
82
- progress: async (z) => {
83
- F(z);
84
- }
85
- };
86
- let c;
87
- const u = async (z) => {
88
- const g = z ? { "x-oss-object-acl": "public-read" } : void 0;
89
- return P ? m.multipartUpload(w, n, {
90
- ...f,
91
- ...g ? { headers: g } : {}
92
- }) : m.put(w, n, {
93
- ...f,
94
- ...g ? { headers: g } : {}
95
- });
96
- };
97
- try {
98
- F(0.01), c = await u(!0);
99
- } catch {
100
- F(0.01), c = await u(!1);
101
- }
102
- const L = ((J = c == null ? void 0 : c.res) == null ? void 0 : J.statusCode) ?? ((Q = c == null ? void 0 : c.res) == null ? void 0 : Q.status);
103
- if (L && L !== 200)
104
- throw new Error("[mgacn-commonsdk] 上传失败");
105
- F(1);
106
- const M = (m.options.ossUrl || "").replace(/\/$/, ""), H = M ? `${M}/${w}` : w;
107
- let O = H;
108
- try {
109
- O = m.signatureUrl(w, { expires: 3600 * 24 });
110
- } catch {
111
- }
112
- return {
113
- name: w,
114
- url: H,
115
- previewUrl: O,
116
- raw: c,
117
- client: m
118
- };
119
- }
120
- function Mt(e = "", t = "") {
121
- const n = String(e || "").trim();
122
- if (!n) return "";
123
- if (!/^https?:\/\//i.test(n)) return n.replace(/^\//, "");
124
- try {
125
- const a = new URL(n);
126
- let l = decodeURIComponent(a.pathname.replace(/^\//, ""));
127
- if (t) {
128
- const i = String(t).replace(/\/$/, "");
129
- n.startsWith(`${i}/`) && (l = decodeURIComponent(n.slice(i.length + 1).split("?")[0]));
130
- }
131
- return l.split("?")[0];
132
- } catch {
133
- return "";
134
- }
135
- }
136
- async function Rt(e, t = {}) {
137
- const n = t.client || await Fe(t), a = Mt(e, n.options.ossUrl);
138
- if (!a) return e;
139
- try {
140
- return n.signatureUrl(a, { expires: t.expires || 3600 * 24 });
141
- } catch {
142
- return e;
143
- }
144
- }
145
- const Je = {
146
- methods: {
147
- getDir() {
148
- return xe(this.foldName || "portal_cms");
149
- },
150
- randomString: qe,
151
- getOss() {
152
- return Ge(this.getDir());
153
- },
154
- async createOssClient() {
155
- return Fe({
156
- dir: this.getDir(),
157
- getOss: () => this.getOss()
158
- });
159
- }
160
- }
161
- };
162
- let Ve = 0;
163
- function Qe() {
164
- return Ve += 1, `mg-img-${Date.now()}-${Ve}`;
165
- }
166
- function Pt(e) {
11
+ function At(e) {
167
12
  return Array.isArray(e) ? e.filter(Boolean) : e ? [e] : [];
168
13
  }
169
- function Ie(e) {
170
- return e.map((t) => ({
171
- uid: Qe(),
172
- url: t,
173
- status: "success",
174
- percent: 100,
175
- previewUrl: ""
176
- }));
14
+ function Ee(e, t = "private") {
15
+ return e.map((n) => {
16
+ const l = String(n || "").trim();
17
+ if (!l) return null;
18
+ const r = be(l, { bucketKind: t });
19
+ return r ? {
20
+ uid: Ze(),
21
+ url: r,
22
+ status: "success",
23
+ percent: 100,
24
+ previewUrl: E(l) ? l : ""
25
+ } : null;
26
+ }).filter(Boolean);
177
27
  }
178
28
  function ge(e = "") {
179
29
  return String(e).startsWith("blob:");
180
30
  }
181
- function Tt(e = "") {
182
- return /[?&](Expires|Signature|OSSAccessKeyId)=/i.test(String(e));
31
+ function Rt(e = "") {
32
+ return vt(e);
183
33
  }
184
- function Bt(e = "") {
34
+ function $t(e = "") {
185
35
  const t = e.lastIndexOf(".");
186
36
  return t > -1 ? e.slice(t + 1).toLowerCase() : "";
187
37
  }
188
- const Dt = {
38
+ const Mt = {
189
39
  name: "MgImageUpload",
190
- mixins: [Je],
191
- components: { CircleCloseFilled: ut, Delete: ot, Plus: it },
40
+ mixins: [qe],
41
+ components: { CircleCloseFilled: ct, Delete: ut, Plus: ot },
192
42
  props: {
193
- /** v-model 统一为 string[];入参兼容 string / string[] */
43
+ /** v-model 统一为 string[](存 object key;公共读可为永久 URL);入参兼容 string / string[] */
194
44
  modelValue: { type: [Array, String], default: () => [] },
195
45
  greyTips: String,
196
46
  otherTips: String,
197
47
  maxFileSize: { type: Number, default: 100 },
198
48
  fileNum: { type: Number, default: 1 },
199
49
  initFileList: { type: Array, default: () => [] },
50
+ /** private(默认)| public(富文本配图) */
51
+ bucketKind: {
52
+ type: String,
53
+ default: "private",
54
+ validator: (e) => ["private", "public"].includes(e)
55
+ },
200
56
  isCropper: Boolean,
201
57
  isDegree: Boolean,
202
58
  degree: { type: Number, default: 3 },
@@ -239,7 +95,7 @@ const Dt = {
239
95
  return this.accept.split(",").map((e) => e.replace(".", "").trim().toLowerCase()).filter(Boolean);
240
96
  },
241
97
  successUrls() {
242
- return this.fileList.filter((e) => e.status === "success").map((e) => e.url);
98
+ return this.fileList.filter((e) => e.status === "success" && e.url).map((e) => be(e.url, { bucketKind: this.bucketKind })).filter(Boolean);
243
99
  }
244
100
  },
245
101
  watch: {
@@ -253,24 +109,24 @@ const Dt = {
253
109
  deep: !0,
254
110
  immediate: !0,
255
111
  handler(e) {
256
- e != null && e.length && (this.replaceList(Ie(e)), this.ensureSignedPreviews());
112
+ e != null && e.length && (this.replaceList(Ee(e, this.bucketKind)), this.ensureSignedPreviews());
257
113
  }
258
114
  },
259
115
  modelValue: {
260
116
  immediate: !0,
261
117
  handler(e) {
262
- var i;
263
- if ((i = this.initFileList) != null && i.length) return;
264
- const t = Pt(e), n = this.successUrls;
265
- if (t.length === n.length && t.every((p, m) => p === n[m]))
118
+ var U;
119
+ if ((U = this.initFileList) != null && U.length) return;
120
+ const t = At(e), n = t.map((h) => be(h, { bucketKind: this.bucketKind })).filter(Boolean), l = this.successUrls;
121
+ if (n.length === l.length && n.every((h, C) => h === l[C]))
266
122
  return;
267
- const a = new Map(
268
- this.fileList.map((p) => [p.url, p.previewUrl]).filter(([p]) => p)
269
- ), l = Ie(t).map((p) => ({
270
- ...p,
271
- previewUrl: a.get(p.url) || ""
123
+ const r = new Map(
124
+ this.fileList.map((h) => [h.url, h.previewUrl]).filter(([h]) => h)
125
+ ), a = Ee(t, this.bucketKind).map((h) => ({
126
+ ...h,
127
+ previewUrl: h.previewUrl || r.get(h.url) || ""
272
128
  }));
273
- this.replaceList(l), this.ensureSignedPreviews();
129
+ this.replaceList(a), t.some((h, C) => String(h || "").trim() !== (n[C] || "")) && this.$nextTick(() => this.emitFile()), this.ensureSignedPreviews();
274
130
  }
275
131
  },
276
132
  cropImageUrl(e) {
@@ -299,28 +155,32 @@ const Dt = {
299
155
  ge(e.previewUrl) && URL.revokeObjectURL(e.previewUrl);
300
156
  });
301
157
  },
302
- /** 私有桶回显:给已有 url 补签名预览 */
158
+ /** 私有桶回显:仅 key、无签名预览时走平台批量续签(禁止依赖 STS GetObject) */
303
159
  async ensureSignedPreviews() {
304
160
  const e = this.fileList.filter(
305
- (t) => t.status === "success" && t.url && !ge(t.previewUrl) && !Tt(t.previewUrl || t.url)
161
+ (t) => t.status === "success" && t.url && !ge(t.previewUrl) && !E(t.previewUrl || "") && !Rt(t.previewUrl || t.url)
306
162
  );
307
163
  if (e.length)
308
164
  try {
309
- const t = await this.createOssClient();
310
- await Promise.all(
311
- e.map(async (n) => {
312
- const a = await Rt(n.url, { client: t });
313
- a && (n.previewUrl = a);
314
- })
315
- );
165
+ const t = e.map((a) => ce(a.url)).filter(Boolean);
166
+ if (!t.length) return;
167
+ const n = await Je({ keys: t.slice(0, 50) }), l = Array.isArray(n == null ? void 0 : n.items) ? n.items : [], r = Object.fromEntries(l.map((a) => [a.key, a.url]));
168
+ e.forEach((a) => {
169
+ const u = ce(a.url);
170
+ r[u] && (a.previewUrl = r[u]);
171
+ });
316
172
  } catch (t) {
317
- console.warn("[MgImageUpload] 生成预览签名失败", t);
173
+ console.warn("[MgImageUpload] 批量续签预览失败", t);
318
174
  }
319
175
  },
320
176
  emitFile() {
321
177
  const e = [...this.successUrls];
322
178
  this.$emit("update:modelValue", e), this.$emit("sendFile", e);
323
179
  },
180
+ /** 规范化单条入库地址(私有→key,公共读永久 URL 保留) */
181
+ toSaveUrl(e) {
182
+ return be(e, { bucketKind: this.bucketKind });
183
+ },
324
184
  openFilePicker() {
325
185
  const e = this.$refs.fileInput;
326
186
  e && (e.value = "", e.click());
@@ -355,18 +215,18 @@ const Dt = {
355
215
  onFileChange(e) {
356
216
  const t = [...e.target.files || []];
357
217
  if (!t.length) return;
358
- const n = this.dialogVisible || this.isCropper, a = this.fileNum - this.fileList.length;
359
- if (!n && t.length > a) {
218
+ const n = this.dialogVisible || this.isCropper, l = this.fileNum - this.fileList.length;
219
+ if (!n && t.length > l) {
360
220
  G.error(`文件数量不超过${this.fileNum}个`);
361
221
  return;
362
222
  }
363
- const l = [], i = [];
364
- if (t.forEach((p) => {
365
- this.acceptList.includes(Bt(p.name)) ? l.push(p) : i.push(p);
366
- }), i.length) {
367
- const p = i.map((m) => m.name).join(",");
368
- Ee.confirm(
369
- `已过滤以下 ${i.length} 个不符合要求的文件:<br/><p style="color:#f56c6c;font-size:12px;">${p}</p><br/>只接受:${this.acceptList.join("/")}`,
223
+ const r = [], a = [];
224
+ if (t.forEach((u) => {
225
+ this.acceptList.includes($t(u.name)) ? r.push(u) : a.push(u);
226
+ }), a.length) {
227
+ const u = a.map((U) => U.name).join(",");
228
+ Ye.confirm(
229
+ `已过滤以下 ${a.length} 个不符合要求的文件:<br/><p style="color:#f56c6c;font-size:12px;">${u}</p><br/>只接受:${this.acceptList.join("/")}`,
370
230
  "提示",
371
231
  {
372
232
  confirmButtonText: "确认",
@@ -377,22 +237,22 @@ const Dt = {
377
237
  ).catch(() => {
378
238
  });
379
239
  }
380
- if (l.length) {
240
+ if (r.length) {
381
241
  if (this.isCropper) {
382
- this.openCropper(l[0]);
242
+ this.openCropper(r[0]);
383
243
  return;
384
244
  }
385
- this.startUpload(l);
245
+ this.startUpload(r);
386
246
  }
387
247
  },
388
248
  openCropper(e) {
389
249
  const t = new FileReader();
390
250
  t.onloadend = (n) => {
391
- const a = n.target.result;
392
- this.cropImageUrl = a, this.dialogVisible = !0, this.$nextTick(() => {
251
+ const l = n.target.result;
252
+ this.cropImageUrl = l, this.dialogVisible = !0, this.$nextTick(() => {
393
253
  requestAnimationFrame(() => {
394
254
  if (this.cropper) {
395
- this.cropper.replace(a);
255
+ this.cropper.replace(l);
396
256
  return;
397
257
  }
398
258
  this.initCropper();
@@ -404,38 +264,46 @@ const Dt = {
404
264
  startUpload(e) {
405
265
  (this.resetFilelist || this.fileNum === 1) && this.replaceList([]);
406
266
  const t = this.maxFileSize * 1024 * 1024, n = [];
407
- return e.forEach((a) => {
408
- if (a.size > t) {
409
- G.error(`「${a.name}」超出 ${this.maxFileSize}MB 限制`);
267
+ return e.forEach((l) => {
268
+ if (l.size > t) {
269
+ G.error(`「${l.name}」超出 ${this.maxFileSize}MB 限制`);
410
270
  return;
411
271
  }
412
- const l = URL.createObjectURL(a), i = {
413
- uid: Qe(),
414
- url: l,
415
- previewUrl: l,
272
+ const r = URL.createObjectURL(l), a = {
273
+ uid: Ze(),
274
+ url: r,
275
+ previewUrl: r,
416
276
  status: "uploading",
417
277
  percent: 0,
418
- raw: a
278
+ raw: l
419
279
  };
420
- this.fileList.push(i), n.push(this.uploadOne(i));
280
+ this.fileList.push(a);
281
+ const u = this.fileList[this.fileList.length - 1];
282
+ n.push(this.uploadOne(u));
421
283
  }), Promise.all(n);
422
284
  },
423
285
  async uploadOne(e) {
424
- const t = e.previewUrl, n = (a) => {
425
- const l = Math.min(100, Math.max(0, Number(a) || 0));
426
- e.percent = l, this.$emit("progress", l, e.raw);
286
+ const t = e.previewUrl, n = (l) => {
287
+ const r = Math.min(100, Math.max(0, Math.round(Number(l) || 0)));
288
+ e.percent = r, this.$emit("progress", r, e.raw);
427
289
  };
428
290
  this.activeUploadCount += 1, this.$emit("update:uploading", !0);
429
291
  try {
430
292
  n(0);
431
- const a = await Xe({
293
+ const l = await Ge({
432
294
  file: e.raw,
433
295
  dir: this.getDir(),
296
+ bucketKind: this.bucketKind,
434
297
  onProgress: n
435
298
  });
436
- e.url = a.url, e.previewUrl = t || a.previewUrl || a.url, e.status = "success", n(100), e.raw = null, this.activeUploadCount = Math.max(0, this.activeUploadCount - 1), this.$emit("update:uploading", this.activeUploadCount > 0), this.emitFile(), this.$emit("success", a, e);
437
- } catch (a) {
438
- e.status = "fail", n(0), this.activeUploadCount = Math.max(0, this.activeUploadCount - 1), this.$emit("update:uploading", this.activeUploadCount > 0), G.error((a == null ? void 0 : a.message) || "上传失败"), this.$emit("error", a, e);
299
+ if (e.url = this.toSaveUrl(l.key || l.url) || l.key || l.url, e.previewUrl = l.previewUrl || "", ge(t))
300
+ try {
301
+ URL.revokeObjectURL(t);
302
+ } catch {
303
+ }
304
+ e.status = "success", n(100), e.raw = null, this.activeUploadCount = Math.max(0, this.activeUploadCount - 1), this.$emit("update:uploading", this.activeUploadCount > 0), this.emitFile(), this.$emit("success", { ...l, url: e.url }, e);
305
+ } catch (l) {
306
+ e.status = "fail", n(0), this.activeUploadCount = Math.max(0, this.activeUploadCount - 1), this.$emit("update:uploading", this.activeUploadCount > 0), G.error((l == null ? void 0 : l.message) || "上传失败"), this.$emit("error", l, e);
439
307
  }
440
308
  },
441
309
  initCropper() {
@@ -472,9 +340,9 @@ const Dt = {
472
340
  this.handleBack(), this.$nextTick(() => this.startUpload([t]));
473
341
  },
474
342
  base64ToFile(e) {
475
- const [t, n] = e.split(","), a = t.match(/:(.*?);/)[1], l = a.split("/")[1], i = atob(n), p = new Uint8Array(i.length);
476
- for (let m = 0; m < i.length; m++) p[m] = i.charCodeAt(m);
477
- return new File([p], `${Date.now()}.${l}`, { type: a });
343
+ const [t, n] = e.split(","), l = t.match(/:(.*?);/)[1], r = l.split("/")[1], a = atob(n), u = new Uint8Array(a.length);
344
+ for (let U = 0; U < a.length; U++) u[U] = a.charCodeAt(U);
345
+ return new File([u], `${Date.now()}.${r}`, { type: l });
478
346
  },
479
347
  handleBack() {
480
348
  this.cropImageUrl = "", this.dialogVisible = !1;
@@ -484,245 +352,263 @@ const Dt = {
484
352
  !t || t.status === "uploading" || (this.revokePreview(t), this.fileList.splice(e, 1), this.emitFile());
485
353
  }
486
354
  }
487
- }, Ot = { class: "upload-image-cropper" }, Vt = ["multiple", "accept"], It = {
355
+ }, Tt = { class: "upload-image-cropper" }, Pt = ["multiple", "accept"], Bt = {
488
356
  key: 0,
489
357
  class: "grey-tips"
490
- }, At = { key: 0 }, Ht = { class: "list-box" }, zt = {
358
+ }, Vt = { key: 0 }, It = { class: "list-box" }, Ot = {
491
359
  key: 0,
492
360
  class: "status-mask is-uploading"
493
- }, Et = { class: "progress-wrap" }, jt = { class: "percent-text" }, Kt = {
361
+ }, Dt = { class: "progress-wrap" }, Et = { class: "percent-text" }, Ht = {
494
362
  key: 1,
495
363
  class: "status-mask is-fail"
496
- }, Wt = ["onClick"], Yt = { class: "cropper-box" }, qt = ["src"], Gt = {
364
+ }, zt = ["onClick"], Kt = { class: "cropper-box" }, jt = ["src"], Wt = {
497
365
  key: 0,
498
366
  class: "cropper-placeholder"
499
- }, Xt = {
367
+ }, Yt = {
500
368
  key: 0,
501
369
  class: "btn-box btn-box--rotate"
502
- }, Jt = { class: "btn-box" };
503
- function Qt(e, t, n, a, l, i) {
504
- const p = $("el-image"), m = $("el-progress"), _ = $("CircleCloseFilled"), w = $("el-icon"), F = $("Delete"), P = $("Plus"), f = $("el-button"), c = $("el-dialog");
505
- return d(), y("div", Ot, [
506
- C("input", {
370
+ }, qt = { class: "btn-box" };
371
+ function Gt(e, t, n, l, r, a) {
372
+ const u = N("el-image"), U = N("el-progress"), h = N("CircleCloseFilled"), C = N("el-icon"), L = N("Delete"), P = N("Plus"), c = N("el-button"), _ = N("el-dialog");
373
+ return d(), m("div", Tt, [
374
+ b("input", {
507
375
  ref: "fileInput",
508
376
  type: "file",
509
377
  class: "file-input",
510
- multiple: i.multiple,
378
+ multiple: a.multiple,
511
379
  accept: n.accept,
512
- onChange: t[0] || (t[0] = (...u) => i.onFileChange && i.onFileChange(...u))
513
- }, null, 40, Vt),
514
- n.greyTips ? (d(), y("div", It, [
515
- n.otherTips ? (d(), y("div", At, B(n.otherTips), 1)) : V("", !0),
516
- q(" " + B(n.greyTips), 1)
380
+ onChange: t[0] || (t[0] = (...p) => a.onFileChange && a.onFileChange(...p))
381
+ }, null, 40, Pt),
382
+ n.greyTips ? (d(), m("div", Bt, [
383
+ n.otherTips ? (d(), m("div", Vt, T(n.otherTips), 1)) : V("", !0),
384
+ q(" " + T(n.greyTips), 1)
517
385
  ])) : V("", !0),
518
- C("div", Ht, [
519
- (d(!0), y(ee, null, ne(l.fileList, (u, L) => (d(), y("div", {
520
- key: u.uid,
521
- class: W(["image-box", [`is-${u.status}`]]),
522
- style: fe(n.imageStyle)
386
+ b("div", It, [
387
+ (d(!0), m(Q, null, te(r.fileList, (p, A) => (d(), m("div", {
388
+ key: p.uid,
389
+ class: j(["image-box", [`is-${p.status}`]]),
390
+ style: de(n.imageStyle)
523
391
  }, [
524
- S(p, {
525
- src: u.previewUrl || u.url,
392
+ S(u, {
393
+ src: p.previewUrl || p.url,
526
394
  fit: "cover",
527
395
  class: "img"
528
396
  }, null, 8, ["src"]),
529
- u.status === "uploading" ? (d(), y("div", zt, [
530
- C("div", Et, [
531
- S(m, {
397
+ p.status === "uploading" ? (d(), m("div", Ot, [
398
+ b("div", Dt, [
399
+ S(U, {
532
400
  type: "circle",
533
- percentage: u.percent,
401
+ percentage: p.percent,
534
402
  width: 30,
535
403
  "stroke-width": 3,
536
404
  "show-text": !1,
537
405
  color: "var(--mg-primary, #ff5722)"
538
406
  }, null, 8, ["percentage"]),
539
- C("span", jt, B(u.percent) + "%", 1)
407
+ b("span", Et, T(p.percent) + "%", 1)
540
408
  ])
541
- ])) : u.status === "fail" ? (d(), y("div", Kt, [
542
- S(w, {
409
+ ])) : p.status === "fail" ? (d(), m("div", Ht, [
410
+ S(C, {
543
411
  class: "fail-icon",
544
412
  size: 16
545
413
  }, {
546
- default: N(() => [
547
- S(_)
414
+ default: F(() => [
415
+ S(h)
548
416
  ]),
549
417
  _: 1
550
418
  }),
551
- t[5] || (t[5] = C("span", { class: "fail-text" }, "失败", -1)),
552
- S(w, {
419
+ t[5] || (t[5] = b("span", { class: "fail-text" }, "失败", -1)),
420
+ S(C, {
553
421
  class: "remove-icon",
554
422
  size: 14,
555
423
  title: "删除",
556
- onClick: ye((M) => i.removeImg(L), ["stop"])
424
+ onClick: we(($) => a.removeImg(A), ["stop"])
557
425
  }, {
558
- default: N(() => [
559
- S(F)
426
+ default: F(() => [
427
+ S(L)
560
428
  ]),
561
429
  _: 1
562
430
  }, 8, ["onClick"])
563
- ])) : (d(), y("div", {
431
+ ])) : (d(), m("div", {
564
432
  key: 2,
565
433
  class: "status-mask is-success",
566
- onClick: (M) => i.removeImg(L)
434
+ onClick: ($) => a.removeImg(A)
567
435
  }, [
568
- S(w, {
436
+ S(C, {
569
437
  class: "remove-icon",
570
438
  size: 16
571
439
  }, {
572
- default: N(() => [
573
- S(F)
440
+ default: F(() => [
441
+ S(L)
574
442
  ]),
575
443
  _: 1
576
444
  })
577
- ], 8, Wt))
445
+ ], 8, zt))
578
446
  ], 6))), 128)),
579
- ue(C("div", {
447
+ ae(b("div", {
580
448
  class: "image-box upload-btn",
581
- style: fe(n.imageStyle),
582
- onClick: t[1] || (t[1] = (...u) => i.handleUpload && i.handleUpload(...u))
449
+ style: de(n.imageStyle),
450
+ onClick: t[1] || (t[1] = (...p) => a.handleUpload && a.handleUpload(...p))
583
451
  }, [
584
- S(w, {
452
+ S(C, {
585
453
  class: "icon",
586
454
  size: 14
587
455
  }, {
588
- default: N(() => [
456
+ default: F(() => [
589
457
  S(P)
590
458
  ]),
591
459
  _: 1
592
460
  }),
593
- t[6] || (t[6] = C("div", null, "上传图片", -1))
461
+ t[6] || (t[6] = b("div", null, "上传图片", -1))
594
462
  ], 4), [
595
- [ce, i.showUploadBtn]
463
+ [oe, a.showUploadBtn]
596
464
  ])
597
465
  ]),
598
- S(c, {
599
- modelValue: l.dialogVisible,
600
- "onUpdate:modelValue": t[4] || (t[4] = (u) => l.dialogVisible = u),
466
+ S(_, {
467
+ modelValue: r.dialogVisible,
468
+ "onUpdate:modelValue": t[4] || (t[4] = (p) => r.dialogVisible = p),
601
469
  title: "裁剪图片",
602
470
  width: "650px",
603
471
  top: "5vh",
604
472
  "append-to-body": "",
605
473
  class: "mg-image-upload-dialog",
606
474
  "close-on-click-modal": !1,
607
- onClose: i.handleBack
475
+ onClose: a.handleBack
608
476
  }, {
609
- footer: N(() => [
610
- n.isDegree ? (d(), y("div", Xt, [
611
- S(f, {
612
- onClick: t[2] || (t[2] = (u) => i.rotate(-n.degree))
477
+ footer: F(() => [
478
+ n.isDegree ? (d(), m("div", Yt, [
479
+ S(c, {
480
+ onClick: t[2] || (t[2] = (p) => a.rotate(-n.degree))
613
481
  }, {
614
- default: N(() => [...t[7] || (t[7] = [
482
+ default: F(() => [...t[7] || (t[7] = [
615
483
  q("向左旋转", -1)
616
484
  ])]),
617
485
  _: 1
618
486
  }),
619
- S(f, {
620
- onClick: t[3] || (t[3] = (u) => i.rotate(n.degree))
487
+ S(c, {
488
+ onClick: t[3] || (t[3] = (p) => a.rotate(n.degree))
621
489
  }, {
622
- default: N(() => [...t[8] || (t[8] = [
490
+ default: F(() => [...t[8] || (t[8] = [
623
491
  q("向右旋转", -1)
624
492
  ])]),
625
493
  _: 1
626
494
  })
627
495
  ])) : V("", !0),
628
- C("div", Jt, [
629
- S(f, {
496
+ b("div", qt, [
497
+ S(c, {
630
498
  type: "primary",
631
- onClick: i.openFilePicker
499
+ onClick: a.openFilePicker
632
500
  }, {
633
- default: N(() => [
634
- q(B(l.cropImageUrl ? "重新上传" : "点击上传"), 1)
501
+ default: F(() => [
502
+ q(T(r.cropImageUrl ? "重新上传" : "点击上传"), 1)
635
503
  ]),
636
504
  _: 1
637
505
  }, 8, ["onClick"]),
638
- S(f, {
506
+ S(c, {
639
507
  type: "primary",
640
- onClick: i.confirmCrop
508
+ onClick: a.confirmCrop
641
509
  }, {
642
- default: N(() => [...t[9] || (t[9] = [
510
+ default: F(() => [...t[9] || (t[9] = [
643
511
  q("确定", -1)
644
512
  ])]),
645
513
  _: 1
646
514
  }, 8, ["onClick"])
647
515
  ])
648
516
  ]),
649
- default: N(() => [
650
- C("div", Yt, [
651
- ue(C("img", {
517
+ default: F(() => [
518
+ b("div", Kt, [
519
+ ae(b("img", {
652
520
  ref: "cropImage",
653
- src: l.cropImageUrl,
521
+ src: r.cropImageUrl,
654
522
  class: "cropper-img"
655
- }, null, 8, qt), [
656
- [ce, l.cropImageUrl]
523
+ }, null, 8, jt), [
524
+ [oe, r.cropImageUrl]
657
525
  ]),
658
- l.cropImageUrl ? V("", !0) : (d(), y("div", Gt, "请选择图片后进行裁剪"))
526
+ r.cropImageUrl ? V("", !0) : (d(), m("div", Wt, "请选择图片后进行裁剪"))
659
527
  ])
660
528
  ]),
661
529
  _: 1
662
530
  }, 8, ["modelValue", "onClose"])
663
531
  ]);
664
532
  }
665
- const Zt = /* @__PURE__ */ ae(Dt, [["render", Qt], ["__scopeId", "data-v-68531340"]]), en = ".mp4,.mov,.jpg,.jpeg,.m3u8,.png,.m4v,.doc,.docx,.xls,.xlsx,.pdf";
666
- let Ae = 0;
667
- function Le() {
668
- return Ae += 1, `mg-file-${Date.now()}-${Ae}`;
533
+ const Jt = /* @__PURE__ */ Z(Mt, [["render", Gt], ["__scopeId", "data-v-7df361ca"]]), Xt = ".mp4,.mov,.jpg,.jpeg,.m3u8,.png,.m4v,.doc,.docx,.xls,.xlsx,.pdf";
534
+ let He = 0;
535
+ function $e() {
536
+ return He += 1, `mg-file-${Date.now()}-${He}`;
669
537
  }
670
- function tn(e) {
538
+ function Qt(e) {
671
539
  return Array.isArray(e) ? e.filter(Boolean) : e ? [e] : [];
672
540
  }
673
- function nn(e) {
541
+ function Zt(e) {
674
542
  return Array.isArray(e) ? e.map((t) => {
675
- if (!t) return null;
676
- if (typeof t == "string")
677
- return { fileName: se(t), fileUrl: t };
678
- const n = t.fileUrl || t.url || "";
679
- return n ? {
680
- fileName: t.fileName || t.name || se(n),
681
- fileUrl: n
682
- } : null;
683
- }).filter(Boolean) : [];
543
+ const n = _e(t);
544
+ if (!n) return null;
545
+ const l = t && typeof t == "object" ? String(t.previewSrc || t.previewUrl || t.fileUrl || t.url || "").trim() : typeof t == "string" ? t.trim() : "", r = E(l) ? l : "";
546
+ return {
547
+ ...n,
548
+ previewSrc: r
549
+ };
550
+ }).filter((t) => t == null ? void 0 : t.fileUrl) : [];
684
551
  }
685
- function ln(e = [], t = []) {
686
- return e.length !== t.length ? !1 : e.every((n, a) => {
687
- const l = t[a];
688
- return n.fileUrl === l.fileUrl && n.fileName === l.fileName;
552
+ function en(e = [], t = []) {
553
+ return e.length !== t.length ? !1 : e.every((n, l) => {
554
+ const r = t[l];
555
+ return n.fileUrl === r.fileUrl && n.fileName === r.fileName;
689
556
  });
690
557
  }
691
- function se(e = "") {
558
+ function Ae(e = "") {
692
559
  try {
693
560
  return decodeURIComponent(String(e).split("?")[0]).split("/").filter(Boolean).pop() || "file";
694
561
  } catch {
695
562
  return "file";
696
563
  }
697
564
  }
698
- function He(e) {
699
- return e.map((t) => ({
700
- uid: Le(),
701
- name: se(t),
702
- url: t,
703
- status: "success",
704
- percent: 100,
705
- raw: null
706
- }));
565
+ function ze(e) {
566
+ return e.map((t) => {
567
+ const n = ce(t) || t;
568
+ return {
569
+ uid: $e(),
570
+ name: Ae(t),
571
+ url: n,
572
+ previewSrc: E(t) ? t : "",
573
+ status: "success",
574
+ percent: 100,
575
+ raw: null
576
+ };
577
+ });
578
+ }
579
+ function tn(e = []) {
580
+ return e.map((t) => {
581
+ const n = _e(t);
582
+ if (!n) return null;
583
+ const l = t && typeof t == "object" && (t.previewSrc || t.fileUrl || t.url) || "";
584
+ return {
585
+ uid: $e(),
586
+ id: n.id,
587
+ name: n.fileName,
588
+ url: n.fileUrl,
589
+ previewSrc: E(String(l)) ? String(l) : "",
590
+ status: "success",
591
+ percent: 100,
592
+ raw: null
593
+ };
594
+ }).filter(Boolean);
707
595
  }
708
- function sn(e = []) {
709
- return e.map((t) => ({
710
- uid: Le(),
711
- name: t.fileName || se(t.fileUrl),
712
- url: t.fileUrl,
713
- status: "success",
714
- percent: 100,
715
- raw: null
716
- }));
596
+ function Ke(e) {
597
+ const t = (e == null ? void 0 : e.previewSrc) || "";
598
+ if (t.startsWith("blob:"))
599
+ try {
600
+ URL.revokeObjectURL(t);
601
+ } catch {
602
+ }
717
603
  }
718
- function an(e = "") {
604
+ function nn(e = "") {
719
605
  const t = e.lastIndexOf(".");
720
606
  return t > -1 ? e.slice(t + 1).toLowerCase() : "";
721
607
  }
722
- const rn = {
608
+ const ln = {
723
609
  name: "MgFileUpload",
724
- mixins: [Je],
725
- components: { CircleCheck: pt, CircleClose: ze, Close: dt, Document: ct },
610
+ mixins: [qe],
611
+ components: { CircleCheck: ft, CircleClose: We, Close: pt, Document: dt },
726
612
  props: {
727
613
  /** v-model:valueFormat=url 时为 string[];valueFormat=file 时为 { fileName, fileUrl }[] */
728
614
  modelValue: { type: [Array, String], default: () => [] },
@@ -741,8 +627,14 @@ const rn = {
741
627
  initFileList: { type: Array, default: () => [] },
742
628
  /** 选满后是否清空再传 */
743
629
  resetFilelist: Boolean,
744
- accept: { type: String, default: en },
630
+ accept: { type: String, default: Xt },
745
631
  foldName: { type: String, default: "portal_cms" },
632
+ /** private(默认)| public(仅富文本配图等) */
633
+ bucketKind: {
634
+ type: String,
635
+ default: "private",
636
+ validator: (e) => ["private", "public"].includes(e)
637
+ },
746
638
  disabled: Boolean,
747
639
  buttonText: { type: String, default: "点击上传" },
748
640
  /** 是否展示默认「点击上传」按钮(为 false 时可由外部调用 openFilePicker) */
@@ -783,12 +675,18 @@ const rn = {
783
675
  },
784
676
  modelOutputValue() {
785
677
  const e = this.fileList.filter((t) => t.status === "success" && t.url);
786
- return this.valueFormat === "file" ? e.map((t) => ({
787
- fileName: t.name,
788
- fileUrl: t.url
789
- })) : e.map((t) => t.url);
678
+ return this.valueFormat === "file" ? e.map(
679
+ (t) => _e({
680
+ id: t.id,
681
+ fileName: t.name,
682
+ fileUrl: t.url
683
+ })
684
+ ).filter(Boolean) : e.map((t) => ce(t.url) || t.url);
790
685
  }
791
686
  },
687
+ beforeUnmount() {
688
+ this.fileList.forEach(Ke);
689
+ },
792
690
  watch: {
793
691
  hasPendingUpload: {
794
692
  immediate: !0,
@@ -800,26 +698,31 @@ const rn = {
800
698
  deep: !0,
801
699
  immediate: !0,
802
700
  handler(e) {
803
- e != null && e.length && (this.fileList = He(e));
701
+ e != null && e.length && (this.fileList = ze(e));
804
702
  }
805
703
  },
806
704
  modelValue: {
807
705
  immediate: !0,
808
706
  handler(e) {
809
- var a;
810
- if ((a = this.initFileList) != null && a.length || this.activeUploadCount > 0 || this.fileList.some((l) => l.status === "uploading"))
707
+ var l;
708
+ if ((l = this.initFileList) != null && l.length || this.activeUploadCount > 0 || this.fileList.some((r) => r.status === "uploading"))
811
709
  return;
812
710
  if (this.valueFormat === "file") {
813
- const l = nn(e);
814
- if (ln(l, this.settledFiles)) return;
815
- this.settledFiles = l.map((i) => ({ ...i })), this.fileList = sn(this.settledFiles);
711
+ const r = Zt(e);
712
+ if (en(r, this.settledFiles)) return;
713
+ this.settledFiles = r.map((u) => ({ ...u })), this.fileList = tn(this.settledFiles), Array.isArray(e) && (e.length !== r.length || e.some((u, U) => {
714
+ const h = typeof u == "string" ? u : (u == null ? void 0 : u.fileUrl) || (u == null ? void 0 : u.url) || "", C = r[U];
715
+ if (!C) return !0;
716
+ const L = typeof u == "object" ? u == null ? void 0 : u.id : void 0;
717
+ return ce(h) !== C.fileUrl || L != null && L !== "" && L !== C.id || E(h);
718
+ })) && this.$nextTick(() => this.emitFile());
816
719
  return;
817
720
  }
818
- const t = tn(e), n = this.successUrls;
819
- t.length === n.length && t.every((l, i) => l === n[i]) || (this.settledFiles = t.map((l) => ({
820
- fileName: se(l),
821
- fileUrl: l
822
- })), this.fileList = He(t));
721
+ const t = Qt(e), n = this.successUrls;
722
+ t.length === n.length && t.every((r, a) => r === n[a]) || (this.settledFiles = t.map((r) => ({
723
+ fileName: Ae(r),
724
+ fileUrl: r
725
+ })), this.fileList = ze(t));
823
726
  }
824
727
  }
825
728
  },
@@ -828,13 +731,20 @@ const rn = {
828
731
  return this.hasPendingUpload;
829
732
  },
830
733
  emitFile() {
831
- const e = this.valueFormat === "file" ? this.settledFiles.map((t) => ({ ...t })) : this.settledFiles.map((t) => t.fileUrl);
734
+ const e = this.valueFormat === "file" ? Ve(this.settledFiles) : Ve(this.settledFiles).map((t) => t.fileUrl);
832
735
  this.$emit("update:modelValue", e), this.$emit("sendFile", e);
833
736
  },
834
- rememberSettled(e, t) {
835
- t && (this.settledFiles.some((n) => n.fileUrl === t) || this.settledFiles.length >= this.fileNum || this.settledFiles.push({
836
- fileName: e || se(t),
737
+ rememberSettled(e, t, n = "", l, r) {
738
+ const a = _e({
739
+ id: r,
740
+ fileName: e,
837
741
  fileUrl: t
742
+ });
743
+ a && (this.settledFiles.some((u) => u.fileUrl === a.fileUrl) || this.settledFiles.length >= this.fileNum || this.settledFiles.push({
744
+ ...a,
745
+ // 仅组件内部缓存,emit 时会被 toOssSaveFiles 丢掉
746
+ previewSrc: n || "",
747
+ ...l != null ? { expireAt: l } : {}
838
748
  }));
839
749
  },
840
750
  openFilePicker() {
@@ -862,13 +772,13 @@ const rn = {
862
772
  G.error(`文件数量不超过${this.fileNum}个`);
863
773
  return;
864
774
  }
865
- const a = [], l = [];
866
- if (t.forEach((i) => {
867
- this.acceptList.includes(an(i.name)) ? a.push(i) : l.push(i);
868
- }), l.length) {
869
- const i = l.map((p) => p.name).join(",");
870
- Ee.confirm(
871
- `已过滤以下 ${l.length} 个不符合要求的文件:<br/><p style="color:#f56c6c;font-size:12px;">${i}</p><br/>只接受:${this.acceptList.join("/")}`,
775
+ const l = [], r = [];
776
+ if (t.forEach((a) => {
777
+ this.acceptList.includes(nn(a.name)) ? l.push(a) : r.push(a);
778
+ }), r.length) {
779
+ const a = r.map((u) => u.name).join(",");
780
+ Ye.confirm(
781
+ `已过滤以下 ${r.length} 个不符合要求的文件:<br/><p style="color:#f56c6c;font-size:12px;">${a}</p><br/>只接受:${this.acceptList.join("/")}`,
872
782
  "提示",
873
783
  {
874
784
  confirmButtonText: "确认",
@@ -879,161 +789,341 @@ const rn = {
879
789
  ).catch(() => {
880
790
  });
881
791
  }
882
- a.length && this.startUpload(a);
792
+ l.length && this.startUpload(l);
883
793
  },
884
794
  startUpload(e) {
885
795
  (this.resetFilelist || this.fileNum === 1) && (this.fileList = [], this.settledFiles = []);
886
796
  const t = this.maxFileSize * 1024 * 1024, n = [];
887
- return e.forEach((a) => {
888
- if (a.size > t) {
889
- G.error(`「${a.name}」超出 ${this.maxFileSize}MB 限制`);
797
+ return e.forEach((l) => {
798
+ if (l.size > t) {
799
+ G.error(`「${l.name}」超出 ${this.maxFileSize}MB 限制`);
890
800
  return;
891
801
  }
892
- const l = {
893
- uid: Le(),
894
- name: a.name,
802
+ const r = {
803
+ uid: $e(),
804
+ name: l.name,
895
805
  url: "",
806
+ previewSrc: "",
896
807
  status: "uploading",
897
808
  percent: 0,
898
- raw: a
809
+ raw: l
899
810
  };
900
- this.fileList.push(l), n.push(this.uploadOne(l));
811
+ this.fileList.push(r);
812
+ const a = this.fileList[this.fileList.length - 1];
813
+ n.push(this.uploadOne(a));
901
814
  }), Promise.all(n);
902
815
  },
903
816
  async uploadOne(e) {
904
817
  const t = (n) => {
905
- const a = Math.min(100, Math.max(0, Number(n) || 0));
906
- e.percent = a, this.$emit("progress", a, e.raw);
818
+ const l = Math.min(100, Math.max(0, Math.round(Number(n) || 0)));
819
+ e.percent = l, this.$emit("progress", l, e.raw);
907
820
  };
908
821
  this.activeUploadCount += 1, this.$emit("update:uploading", !0);
909
822
  try {
910
823
  t(0);
911
- const n = await Xe({
824
+ const n = await Ge({
912
825
  file: e.raw,
913
826
  dir: this.getDir(),
827
+ bucketKind: this.bucketKind,
914
828
  onProgress: t
915
829
  });
916
- e.url = n.url, e.name = e.name || se(n.url), e.status = "success", t(100);
917
- const a = e.raw;
918
- e.raw = null, this.fileList.some((l) => l === e || l.uid === e.uid) || this.fileList.push(e), this.rememberSettled(e.name, e.url), this.emitFile(), this.activeUploadCount = Math.max(0, this.activeUploadCount - 1), this.$emit("update:uploading", this.activeUploadCount > 0), this.$emit("success", n, { ...e, raw: a });
830
+ e.url = n.key || n.url, e.previewSrc = n.previewUrl || "", e.expireAt = n.expireAt, e.name = e.name || Ae(e.url), e.status = "success", t(100);
831
+ const l = e.raw;
832
+ e.raw = null, this.fileList.some((r) => r.uid === e.uid) || this.fileList.push(e), this.rememberSettled(e.name, e.url, e.previewSrc, e.expireAt), this.activeUploadCount = Math.max(0, this.activeUploadCount - 1), this.$emit("update:uploading", this.activeUploadCount > 0), this.emitFile(), this.$emit("success", n, { ...e, raw: l });
919
833
  } catch (n) {
920
834
  e.status = "fail", t(0), this.activeUploadCount = Math.max(0, this.activeUploadCount - 1), this.$emit("update:uploading", this.activeUploadCount > 0), G.error((n == null ? void 0 : n.message) || "上传失败"), this.$emit("error", n, e);
921
835
  }
922
836
  },
923
- onFileClick(e) {
924
- (e == null ? void 0 : e.status) !== "success" || !e.url || yt({
925
- src: e.url,
926
- name: e.name || ""
927
- });
837
+ async onFileClick(e) {
838
+ if ((e == null ? void 0 : e.status) !== "success") return;
839
+ const t = await yt(
840
+ {
841
+ fileUrl: e.previewSrc || e.url,
842
+ fileKey: e.url,
843
+ fileName: e.name,
844
+ expireAt: e.expireAt,
845
+ previewSrc: e.previewSrc
846
+ },
847
+ { forceResign: !0 }
848
+ );
849
+ t != null && t.src && (e.previewSrc = t.src, e.expireAt = se(t.src) || e.expireAt);
928
850
  },
929
851
  removeFile(e) {
930
852
  const t = this.fileList[e];
931
- !t || t.status === "uploading" || (this.fileList.splice(e, 1), t.url && (this.settledFiles = this.settledFiles.filter((n) => n.fileUrl !== t.url)), this.emitFile());
853
+ !t || t.status === "uploading" || (Ke(t), this.fileList.splice(e, 1), t.url && (this.settledFiles = this.settledFiles.filter((n) => n.fileUrl !== t.url)), this.emitFile());
932
854
  }
933
855
  }
934
- }, on = { class: "mg-file-upload" }, un = ["multiple", "accept", "disabled"], cn = {
856
+ }, rn = { class: "mg-file-upload" }, sn = ["multiple", "accept", "disabled"], an = {
935
857
  key: 1,
936
858
  class: "el-upload__tip"
937
- }, dn = {
859
+ }, on = {
938
860
  key: 2,
939
861
  class: "mg-file-list"
940
- }, pn = { class: "mg-file-item__row" }, fn = ["href", "target", "onClick"], hn = ["title"], mn = {
862
+ }, un = { class: "mg-file-item__row" }, cn = ["onClick"], dn = ["title"], pn = {
941
863
  key: 0,
942
864
  class: "mg-file-item__percent"
943
- }, gn = ["onClick"];
944
- function yn(e, t, n, a, l, i) {
945
- const p = $("el-button"), m = $("Document"), _ = $("el-icon"), w = $("CircleCheck"), F = $("CircleClose"), P = $("Close"), f = $("el-progress");
946
- return d(), y("div", on, [
947
- C("input", {
865
+ }, fn = ["onClick"], hn = {
866
+ key: 0,
867
+ class: "mg-file-item__progress",
868
+ "aria-hidden": "true"
869
+ };
870
+ function gn(e, t, n, l, r, a) {
871
+ const u = N("el-button"), U = N("Document"), h = N("el-icon"), C = N("CircleCheck"), L = N("CircleClose"), P = N("Close");
872
+ return d(), m("div", rn, [
873
+ b("input", {
948
874
  ref: "fileInput",
949
875
  type: "file",
950
876
  class: "file-input",
951
- multiple: i.multiple,
877
+ multiple: a.multiple,
952
878
  accept: n.accept,
953
879
  disabled: n.disabled,
954
- onChange: t[0] || (t[0] = (...c) => i.onFileChange && i.onFileChange(...c))
955
- }, null, 40, un),
956
- n.showButton ? (d(), D(p, {
880
+ onChange: t[0] || (t[0] = (...c) => a.onFileChange && a.onFileChange(...c))
881
+ }, null, 40, sn),
882
+ n.showButton ? (d(), B(u, {
957
883
  key: 0,
958
884
  type: "primary",
959
- disabled: n.disabled || !i.showUploadBtn,
960
- onClick: i.handleUpload
885
+ disabled: n.disabled || !a.showUploadBtn,
886
+ onClick: a.handleUpload
961
887
  }, {
962
- default: N(() => [
963
- q(B(n.buttonText), 1)
888
+ default: F(() => [
889
+ q(T(n.buttonText), 1)
964
890
  ]),
965
891
  _: 1
966
892
  }, 8, ["disabled", "onClick"])) : V("", !0),
967
- i.tipText ? (d(), y("div", cn, B(i.tipText), 1)) : V("", !0),
968
- n.showFileList ? (d(), y("ul", dn, [
969
- (d(!0), y(ee, null, ne(l.fileList, (c, u) => (d(), y("li", {
893
+ a.tipText ? (d(), m("div", an, T(a.tipText), 1)) : V("", !0),
894
+ n.showFileList ? (d(), m("ul", on, [
895
+ (d(!0), m(Q, null, te(r.fileList, (c, _) => (d(), m("li", {
970
896
  key: c.uid,
971
- class: W(["mg-file-item", [`is-${c.status}`]])
897
+ class: j(["mg-file-item", [`is-${c.status}`]])
972
898
  }, [
973
- C("div", pn, [
974
- C("a", {
899
+ b("div", un, [
900
+ b("a", {
975
901
  class: "mg-file-item__name",
976
- href: c.url || void 0,
977
- target: c.url ? "_blank" : void 0,
902
+ href: "javascript:;",
978
903
  rel: "noopener noreferrer",
979
- onClick: ye((L) => i.onFileClick(c), ["prevent"])
904
+ onClick: we((p) => a.onFileClick(c), ["prevent"])
980
905
  }, [
981
- S(_, { class: "mg-file-item__doc" }, {
982
- default: N(() => [
983
- S(m)
906
+ S(h, { class: "mg-file-item__doc" }, {
907
+ default: F(() => [
908
+ S(U)
984
909
  ]),
985
910
  _: 1
986
911
  }),
987
- C("span", {
912
+ b("span", {
988
913
  class: "mg-file-item__text",
989
914
  title: c.name
990
- }, B(c.name), 9, hn)
991
- ], 8, fn),
992
- c.status === "uploading" ? (d(), y("span", mn, B(c.percent) + "% ", 1)) : c.status === "success" ? (d(), D(_, {
915
+ }, T(c.name), 9, dn)
916
+ ], 8, cn),
917
+ c.status === "uploading" ? (d(), m("span", pn, T(c.percent) + "% ", 1)) : c.status === "success" ? (d(), B(h, {
993
918
  key: 1,
994
919
  class: "mg-file-item__status is-success"
995
920
  }, {
996
- default: N(() => [
997
- S(w)
921
+ default: F(() => [
922
+ S(C)
998
923
  ]),
999
924
  _: 1
1000
- })) : c.status === "fail" ? (d(), D(_, {
925
+ })) : c.status === "fail" ? (d(), B(h, {
1001
926
  key: 2,
1002
927
  class: "mg-file-item__status is-fail"
1003
928
  }, {
1004
- default: N(() => [
1005
- S(F)
929
+ default: F(() => [
930
+ S(L)
1006
931
  ]),
1007
932
  _: 1
1008
933
  })) : V("", !0),
1009
- c.status !== "uploading" ? (d(), y("button", {
934
+ c.status !== "uploading" ? (d(), m("button", {
1010
935
  key: 3,
1011
936
  type: "button",
1012
937
  class: "mg-file-item__remove",
1013
938
  title: "删除",
1014
- onClick: ye((L) => i.removeFile(u), ["stop"])
939
+ onClick: we((p) => a.removeFile(_), ["stop"])
1015
940
  }, [
1016
- S(_, { size: 14 }, {
1017
- default: N(() => [
941
+ S(h, { size: 14 }, {
942
+ default: F(() => [
1018
943
  S(P)
1019
944
  ]),
1020
945
  _: 1
1021
946
  })
1022
- ], 8, gn)) : V("", !0)
947
+ ], 8, fn)) : V("", !0)
1023
948
  ]),
1024
- c.status === "uploading" ? (d(), D(f, {
1025
- key: 0,
1026
- class: "mg-file-item__progress",
1027
- type: "line",
1028
- percentage: c.percent,
1029
- "stroke-width": 4,
1030
- "show-text": !1
1031
- }, null, 8, ["percentage"])) : V("", !0)
949
+ c.status === "uploading" ? (d(), m("div", hn, [
950
+ b("div", {
951
+ class: "mg-file-item__progress-inner",
952
+ style: de({ width: `${Math.min(100, Math.max(0, c.percent || 0))}%` })
953
+ }, null, 4)
954
+ ])) : V("", !0)
1032
955
  ], 2))), 128))
1033
956
  ])) : V("", !0)
1034
957
  ]);
1035
958
  }
1036
- const vn = /* @__PURE__ */ ae(rn, [["render", yn], ["__scopeId", "data-v-226ee184"]]), bn = {
959
+ const mn = /* @__PURE__ */ Z(ln, [["render", gn], ["__scopeId", "data-v-4cd4fc2a"]]), vn = 12e4, je = 5e3, yn = {
960
+ name: "MgOssImg",
961
+ inheritAttrs: !1,
962
+ props: {
963
+ src: { type: String, default: "" },
964
+ fileKey: { type: String, default: "" },
965
+ expireAt: { type: [Number, String], default: void 0 },
966
+ alt: { type: String, default: "" },
967
+ resign: { type: Function, default: null }
968
+ },
969
+ emits: ["load", "error", "resign"],
970
+ data() {
971
+ return {
972
+ innerSrc: "",
973
+ innerExpireAt: void 0,
974
+ retried: !1,
975
+ signing: !1,
976
+ renewTimer: null,
977
+ lastRenewAt: 0
978
+ };
979
+ },
980
+ computed: {
981
+ displaySrc() {
982
+ return this.innerSrc ? this.innerSrc : E(this.src) ? this.src : "";
983
+ },
984
+ resolveKey() {
985
+ const e = ce(this.src) || (E(this.src) ? "" : String(this.src || "").trim());
986
+ return e || String(this.fileKey || "").trim();
987
+ },
988
+ resolveExpireAt() {
989
+ return this.innerExpireAt != null ? Number(this.innerExpireAt) : this.expireAt != null && this.expireAt !== "" ? Number(this.expireAt) : se(this.innerSrc || this.src);
990
+ }
991
+ },
992
+ watch: {
993
+ src: {
994
+ immediate: !0,
995
+ handler() {
996
+ this.resetAndBootstrap();
997
+ }
998
+ },
999
+ fileKey() {
1000
+ this.retried = !1, !E(this.src) && !this.innerSrc && this.ensureSigned();
1001
+ },
1002
+ expireAt() {
1003
+ this.scheduleRenew();
1004
+ }
1005
+ },
1006
+ beforeUnmount() {
1007
+ this.clearRenewTimer();
1008
+ },
1009
+ methods: {
1010
+ onLoad() {
1011
+ this.$emit("load");
1012
+ },
1013
+ clearRenewTimer() {
1014
+ this.renewTimer != null && (clearTimeout(this.renewTimer), this.renewTimer = null);
1015
+ },
1016
+ resetAndBootstrap() {
1017
+ if (this.clearRenewTimer(), this.innerSrc = "", this.innerExpireAt = void 0, this.retried = !1, E(this.src)) {
1018
+ this.innerExpireAt = this.expireAt != null && this.expireAt !== "" ? Number(this.expireAt) : se(this.src), this.scheduleRenew();
1019
+ return;
1020
+ }
1021
+ this.ensureSigned();
1022
+ },
1023
+ /**
1024
+ * 计算下次续签等待时间:
1025
+ * - 已过期 → 立刻(受 MIN_RENEW_GAP 约束)
1026
+ * - 剩余 > lead → expireAt - lead
1027
+ * - 剩余 ≤ lead 但仍有效 → 剩余时间的一半(避免短 TTL 一挂载就狂打 batchSign)
1028
+ */
1029
+ calcRenewWaitMs(e) {
1030
+ if (e == null || Number.isNaN(Number(e))) return null;
1031
+ const t = Number(e) * 1e3 - Date.now();
1032
+ if (t <= 0) return 0;
1033
+ const n = t - vn;
1034
+ return n > 0 ? n : Math.max(t / 2, 1e3);
1035
+ },
1036
+ scheduleRenew() {
1037
+ this.clearRenewTimer();
1038
+ const e = this.resolveKey, t = this.resolveExpireAt;
1039
+ if (!e || t == null || Number.isNaN(t)) return;
1040
+ const n = this.calcRenewWaitMs(t);
1041
+ if (n != null) {
1042
+ if (n <= 0 && bt(t, 0)) {
1043
+ this.renewNow();
1044
+ return;
1045
+ }
1046
+ this.renewTimer = setTimeout(() => {
1047
+ this.renewTimer = null, this.renewNow();
1048
+ }, Math.max(n, 0));
1049
+ }
1050
+ },
1051
+ pickSignedUrl(e, t) {
1052
+ if (!e || !t) return { url: "", expireAt: void 0 };
1053
+ if (Array.isArray(e.items)) {
1054
+ const n = e.items.find((l) => l.key === t);
1055
+ return {
1056
+ url: (n == null ? void 0 : n.url) || "",
1057
+ expireAt: (n == null ? void 0 : n.expireAt) ?? e.expireAt
1058
+ };
1059
+ }
1060
+ return typeof e == "object" && e[t] ? { url: e[t], expireAt: e.expireAt } : { url: "", expireAt: void 0 };
1061
+ },
1062
+ async callResign(e) {
1063
+ return (typeof this.resign == "function" ? this.resign : (n) => Je({ keys: n }))([e]);
1064
+ },
1065
+ async renewNow() {
1066
+ const e = this.resolveKey;
1067
+ if (!e || this.signing) return;
1068
+ const t = Date.now() - this.lastRenewAt;
1069
+ if (t < je) {
1070
+ this.clearRenewTimer(), this.renewTimer = setTimeout(() => {
1071
+ this.renewTimer = null, this.renewNow();
1072
+ }, je - t);
1073
+ return;
1074
+ }
1075
+ this.signing = !0, this.lastRenewAt = Date.now();
1076
+ try {
1077
+ const n = await this.callResign(e), { url: l, expireAt: r } = this.pickSignedUrl(n, e);
1078
+ if (l && E(l)) {
1079
+ const a = l === this.innerSrc || l === this.src;
1080
+ this.innerSrc = l, this.innerExpireAt = r != null ? Number(r) : se(l), a || this.$emit("resign", { key: e, url: this.innerSrc, expireAt: this.innerExpireAt }), this.scheduleRenew();
1081
+ }
1082
+ } catch (n) {
1083
+ console.warn("[MgOssImg] 到期续签失败", n);
1084
+ } finally {
1085
+ this.signing = !1;
1086
+ }
1087
+ },
1088
+ async ensureSigned() {
1089
+ if (E(this.src) || this.signing) return;
1090
+ const e = this.resolveKey;
1091
+ if (e) {
1092
+ this.signing = !0, this.lastRenewAt = Date.now();
1093
+ try {
1094
+ const t = await this.callResign(e), { url: n, expireAt: l } = this.pickSignedUrl(t, e);
1095
+ n && E(n) && (this.innerSrc = n, this.innerExpireAt = l != null ? Number(l) : se(n), this.$emit("resign", { key: e, url: this.innerSrc, expireAt: this.innerExpireAt }), this.scheduleRenew());
1096
+ } catch (t) {
1097
+ console.warn("[MgOssImg] 预签名失败", t);
1098
+ } finally {
1099
+ this.signing = !1;
1100
+ }
1101
+ }
1102
+ },
1103
+ async onError(e) {
1104
+ if (this.$emit("error", e), this.retried || this.signing) return;
1105
+ const t = this.resolveKey;
1106
+ if (t) {
1107
+ this.retried = !0;
1108
+ try {
1109
+ const n = await this.callResign(t), { url: l, expireAt: r } = this.pickSignedUrl(n, t);
1110
+ l && E(l) && (this.innerSrc = l, this.innerExpireAt = r != null ? Number(r) : se(l), this.$emit("resign", { key: t, url: this.innerSrc, expireAt: this.innerExpireAt }), this.scheduleRenew());
1111
+ } catch (n) {
1112
+ console.warn("[MgOssImg] 裂图续签失败", n);
1113
+ }
1114
+ }
1115
+ }
1116
+ }
1117
+ }, bn = ["src", "alt"];
1118
+ function _n(e, t, n, l, r, a) {
1119
+ return d(), m("img", Ne({ class: "mg-oss-img" }, e.$attrs, {
1120
+ src: a.displaySrc,
1121
+ alt: n.alt,
1122
+ onError: t[0] || (t[0] = (...u) => a.onError && a.onError(...u)),
1123
+ onLoad: t[1] || (t[1] = (...u) => a.onLoad && a.onLoad(...u))
1124
+ }), null, 16, bn);
1125
+ }
1126
+ const wn = /* @__PURE__ */ Z(yn, [["render", _n], ["__scopeId", "data-v-5a56c5a2"]]), xn = {
1037
1127
  __name: "DateRangePicker",
1038
1128
  props: {
1039
1129
  start: {
@@ -1064,87 +1154,87 @@ const vn = /* @__PURE__ */ ae(rn, [["render", yn], ["__scopeId", "data-v-226ee18
1064
1154
  },
1065
1155
  emits: ["update:start", "update:end", "change"],
1066
1156
  setup(e, { emit: t }) {
1067
- const n = t, a = e;
1068
- function l(f) {
1069
- const c = new Date(f);
1070
- return c.setHours(0, 0, 0, 0), c;
1157
+ const n = t, l = e;
1158
+ function r(c) {
1159
+ const _ = new Date(c);
1160
+ return _.setHours(0, 0, 0, 0), _;
1071
1161
  }
1072
- function i(f) {
1073
- const c = new Date(f);
1074
- return c.setHours(23, 59, 59, 0), c;
1162
+ function a(c) {
1163
+ const _ = new Date(c);
1164
+ return _.setHours(23, 59, 59, 0), _;
1075
1165
  }
1076
- function p(f) {
1077
- const c = i(/* @__PURE__ */ new Date()), u = l(/* @__PURE__ */ new Date());
1078
- return f(u), [u, c];
1166
+ function u(c) {
1167
+ const _ = a(/* @__PURE__ */ new Date()), p = r(/* @__PURE__ */ new Date());
1168
+ return c(p), [p, _];
1079
1169
  }
1080
- const m = [
1170
+ const U = [
1081
1171
  {
1082
1172
  text: "七天内",
1083
- value: () => p((f) => {
1084
- f.setDate(f.getDate() - 6);
1173
+ value: () => u((c) => {
1174
+ c.setDate(c.getDate() - 6);
1085
1175
  })
1086
1176
  },
1087
1177
  {
1088
1178
  text: "一个月内",
1089
- value: () => p((f) => {
1090
- f.setMonth(f.getMonth() - 1);
1179
+ value: () => u((c) => {
1180
+ c.setMonth(c.getMonth() - 1);
1091
1181
  })
1092
1182
  },
1093
1183
  {
1094
1184
  text: "一年内",
1095
- value: () => p((f) => {
1096
- f.setFullYear(f.getFullYear() - 1);
1185
+ value: () => u((c) => {
1186
+ c.setFullYear(c.getFullYear() - 1);
1097
1187
  })
1098
1188
  }
1099
- ], _ = ve(() => {
1100
- var f;
1101
- if (a.showShortcuts)
1102
- return (f = a.shortcuts) != null && f.length ? a.shortcuts : m;
1103
- }), w = A([]);
1104
- function F(f, c) {
1105
- if (f && c) {
1106
- w.value = [f, c];
1189
+ ], h = xe(() => {
1190
+ var c;
1191
+ if (l.showShortcuts)
1192
+ return (c = l.shortcuts) != null && c.length ? l.shortcuts : U;
1193
+ }), C = O([]);
1194
+ function L(c, _) {
1195
+ if (c && _) {
1196
+ C.value = [c, _];
1107
1197
  return;
1108
1198
  }
1109
- w.value = [];
1199
+ C.value = [];
1110
1200
  }
1111
- le(
1112
- () => [a.start, a.end],
1113
- ([f, c]) => {
1114
- F(f, c);
1201
+ ne(
1202
+ () => [l.start, l.end],
1203
+ ([c, _]) => {
1204
+ L(c, _);
1115
1205
  }
1116
- ), be(() => {
1117
- F(a.start, a.end);
1206
+ ), Se(() => {
1207
+ L(l.start, l.end);
1118
1208
  });
1119
- function P(f) {
1120
- const c = Array.isArray(f) ? f[0] : "", u = Array.isArray(f) ? f[1] : "";
1121
- c && u ? (n("update:start", c), n("update:end", u)) : (n("update:start", ""), n("update:end", "")), n("change");
1209
+ function P(c) {
1210
+ const _ = Array.isArray(c) ? c[0] : "", p = Array.isArray(c) ? c[1] : "";
1211
+ _ && p ? (n("update:start", _), n("update:end", p)) : (n("update:start", ""), n("update:end", "")), n("change");
1122
1212
  }
1123
- return (f, c) => {
1124
- const u = $("el-date-picker");
1125
- return d(), D(u, {
1126
- modelValue: w.value,
1127
- "onUpdate:modelValue": c[0] || (c[0] = (L) => w.value = L),
1213
+ return (c, _) => {
1214
+ const p = N("el-date-picker");
1215
+ return d(), B(p, {
1216
+ modelValue: C.value,
1217
+ "onUpdate:modelValue": _[0] || (_[0] = (A) => C.value = A),
1128
1218
  type: e.type,
1129
1219
  "range-separator": "至",
1130
1220
  "start-placeholder": e.title ? `${e.title} 开始` : "开始",
1131
1221
  "end-placeholder": "结束",
1132
1222
  "value-format": e.valueFormat,
1133
1223
  "default-time": e.defaultTime,
1134
- shortcuts: _.value,
1224
+ shortcuts: h.value,
1135
1225
  class: "date-range-picker",
1136
1226
  onChange: P,
1137
1227
  clearable: e.canClearable
1138
1228
  }, null, 8, ["modelValue", "type", "start-placeholder", "value-format", "default-time", "shortcuts", "clearable"]);
1139
1229
  };
1140
1230
  }
1141
- }, Ze = /* @__PURE__ */ ae(bn, [["__scopeId", "data-v-0dfa12ab"]]), _n = { class: "common-search__body" }, wn = { class: "common-search__control-wrap" }, Cn = ["onKeyup"], kn = { class: "common-search__range-sep" }, Un = {
1231
+ }, et = /* @__PURE__ */ Z(xn, [["__scopeId", "data-v-0dfa12ab"]]), Sn = { class: "common-search__body" }, kn = { class: "common-search__control-wrap" }, Un = ["onKeyup"], Cn = { class: "common-search__range-sep" }, Fn = {
1142
1232
  key: 5,
1143
1233
  class: "common-search__range"
1144
- }, Sn = {
1234
+ }, Ln = {
1145
1235
  key: 0,
1146
1236
  class: "common-search__actions is-inline"
1147
- }, xn = { class: "common-search__actions-main" }, Fn = /* @__PURE__ */ Object.assign({ name: "MgSearchForm" }, {
1237
+ }, Nn = { class: "common-search__actions-main" }, An = /* @__PURE__ */ Object.assign({ name: "MgSearchForm" }, {
1148
1238
  __name: "SearchForm",
1149
1239
  props: {
1150
1240
  modelValue: { type: Object, default: () => ({}) },
@@ -1152,432 +1242,432 @@ const vn = /* @__PURE__ */ ae(rn, [["render", yn], ["__scopeId", "data-v-226ee18
1152
1242
  },
1153
1243
  emits: ["change", "search", "reset", "update:modelValue"],
1154
1244
  setup(e, { emit: t }) {
1155
- const n = e, a = t, l = A({}), i = Te({}), p = Te({});
1156
- let m = !1;
1157
- function _(s, o) {
1245
+ const n = e, l = t, r = O({}), a = Ie({}), u = Ie({});
1246
+ let U = !1;
1247
+ function h(s, o) {
1158
1248
  return JSON.stringify(s ?? {}) === JSON.stringify(o ?? {});
1159
1249
  }
1160
- const w = A(null), F = A(!1), P = A(!1), f = A(0), c = A(0), u = A(0), L = A(null);
1161
- let M = null, H = !1, O = !1;
1162
- const J = ve(() => {
1163
- if (!(!P.value || L.value == null))
1250
+ const C = O(null), L = O(!1), P = O(!1), c = O(0), _ = O(0), p = O(0), A = O(null);
1251
+ let $ = null, W = !1, D = !1;
1252
+ const pe = xe(() => {
1253
+ if (!(!P.value || A.value == null))
1164
1254
  return {
1165
- maxHeight: `${L.value}px`,
1255
+ maxHeight: `${A.value}px`,
1166
1256
  overflow: "hidden"
1167
1257
  };
1168
1258
  });
1169
- function Q(s = {}) {
1259
+ function fe(s = {}) {
1170
1260
  return String(s.label || s.title || "").trim();
1171
1261
  }
1172
- function z(s = {}) {
1173
- return String(s.tip || Q(s) || "").trim();
1262
+ function me(s = {}) {
1263
+ return String(s.tip || fe(s) || "").trim();
1174
1264
  }
1175
1265
  function g(s = "") {
1176
1266
  const o = String(s).trim();
1177
1267
  return !o || (/* @__PURE__ */ new Set(["全部", "或选择", "请输入或选择"])).has(o) ? "" : o.replace(/^请(输入|选择)/, "").trim() || o;
1178
1268
  }
1179
- function b(s = {}, o = "") {
1269
+ function y(s = {}, o = "") {
1180
1270
  if (s.placeholder != null && s.placeholder !== "") {
1181
- const U = g(s.placeholder);
1182
- if (U) return U;
1271
+ const x = g(s.placeholder);
1272
+ if (x) return x;
1183
1273
  }
1184
- const h = Q(s);
1185
- return h || g(o) || o;
1274
+ const f = fe(s);
1275
+ return f || g(o) || o;
1186
1276
  }
1187
- function T(s = {}, o = "min") {
1188
- const h = o === "min" ? s.minPlaceholder : s.maxPlaceholder, k = Q(s), U = o === "min" ? "最小值" : "最大值", R = /* @__PURE__ */ new Set(["最小", "最大", "最小值", "最大值"]);
1189
- return h != null && h !== "" ? k && R.has(String(h).trim()) ? `${k}${h}` : h : k ? `${k}${U}` : U;
1277
+ function M(s = {}, o = "min") {
1278
+ const f = o === "min" ? s.minPlaceholder : s.maxPlaceholder, w = fe(s), x = o === "min" ? "最小值" : "最大值", R = /* @__PURE__ */ new Set(["最小", "最大", "最小值", "最大值"]);
1279
+ return f != null && f !== "" ? w && R.has(String(f).trim()) ? `${w}${f}` : f : w ? `${w}${x}` : x;
1190
1280
  }
1191
- le(
1281
+ ne(
1192
1282
  () => n.modelValue,
1193
1283
  (s) => {
1194
- _(s, l.value) || (m = !0, l.value = { ...s || {} }, X(() => {
1195
- m = !1;
1284
+ h(s, r.value) || (U = !0, r.value = { ...s || {} }, J(() => {
1285
+ U = !1;
1196
1286
  }));
1197
1287
  },
1198
1288
  { deep: !0, immediate: !0 }
1199
- ), le(
1200
- l,
1289
+ ), ne(
1290
+ r,
1201
1291
  () => {
1202
- m || a("update:modelValue", { ...l.value });
1292
+ U || l("update:modelValue", { ...r.value });
1203
1293
  },
1204
1294
  { deep: !0 }
1205
- ), le(
1295
+ ), ne(
1206
1296
  () => n.itemList,
1207
1297
  () => {
1208
- F.value = !1, f.value = 0, X(() => ie());
1298
+ L.value = !1, c.value = 0, J(() => re());
1209
1299
  },
1210
1300
  { deep: !0 }
1211
- ), be(() => {
1212
- X(() => ie()), typeof ResizeObserver < "u" && (M = new ResizeObserver(() => {
1213
- !H && !O && ie();
1214
- }), w.value && M.observe(w.value)), window.addEventListener("resize", I);
1215
- }), Se(() => {
1216
- M == null || M.disconnect(), window.removeEventListener("resize", I);
1301
+ ), Se(() => {
1302
+ J(() => re()), typeof ResizeObserver < "u" && ($ = new ResizeObserver(() => {
1303
+ !W && !D && re();
1304
+ }), C.value && $.observe(C.value)), window.addEventListener("resize", I);
1305
+ }), Re(() => {
1306
+ $ == null || $.disconnect(), window.removeEventListener("resize", I);
1217
1307
  });
1218
1308
  function I() {
1219
- !H && !O && ie();
1309
+ !W && !D && re();
1220
1310
  }
1221
- function Z(s) {
1311
+ function X(s) {
1222
1312
  const o = n.itemList.length;
1223
1313
  if (!o) return !1;
1224
- const h = f.value > 0 ? f.value : o;
1225
- return s === Math.min(h, o) - 1;
1314
+ const f = c.value > 0 ? c.value : o;
1315
+ return s === Math.min(f, o) - 1;
1226
1316
  }
1227
- function x(s, o, h, k) {
1228
- let U = 1, R = s[o].offsetWidth;
1229
- for (let j = o + 1; j < s.length; j += 1) {
1230
- const K = s[j].offsetWidth;
1231
- R + k + K > h ? (U += 1, R = K) : R += k + K;
1317
+ function k(s, o, f, w) {
1318
+ let x = 1, R = s[o].offsetWidth;
1319
+ for (let z = o + 1; z < s.length; z += 1) {
1320
+ const K = s[z].offsetWidth;
1321
+ R + w + K > f ? (x += 1, R = K) : R += w + K;
1232
1322
  }
1233
- return U;
1323
+ return x;
1234
1324
  }
1235
- function re(s, o, h, k) {
1236
- let U = 0, R = 0;
1237
- for (let j = 0; j < s.length; j += 1) {
1238
- const K = s[j].offsetWidth, te = U === 0 ? K : U + k + K;
1239
- if (te + k + h <= o)
1240
- U = te, R = j + 1;
1325
+ function le(s, o, f, w) {
1326
+ let x = 0, R = 0;
1327
+ for (let z = 0; z < s.length; z += 1) {
1328
+ const K = s[z].offsetWidth, ee = x === 0 ? K : x + w + K;
1329
+ if (ee + w + f <= o)
1330
+ x = ee, R = z + 1;
1241
1331
  else
1242
1332
  break;
1243
1333
  }
1244
1334
  return R || 1;
1245
1335
  }
1246
- function E(s) {
1247
- const o = s.type === "number-range" || s.type === "numberRange", h = 360;
1336
+ function H(s) {
1337
+ const o = s.type === "number-range" || s.type === "numberRange", f = 360;
1248
1338
  if (!s.width) {
1249
1339
  if (o) {
1250
- const R = `${h}px`;
1340
+ const R = `${f}px`;
1251
1341
  return { width: R, minWidth: R };
1252
1342
  }
1253
1343
  return;
1254
1344
  }
1255
- let k = typeof s.width == "number" ? s.width : parseInt(String(s.width), 10);
1256
- const U = typeof s.width == "number" || Number.isFinite(k) ? `${k}px` : s.width;
1257
- return { width: U, minWidth: U };
1345
+ let w = typeof s.width == "number" ? s.width : parseInt(String(s.width), 10);
1346
+ const x = typeof s.width == "number" || Number.isFinite(w) ? `${w}px` : s.width;
1347
+ return { width: x, minWidth: x };
1258
1348
  }
1259
- function Ne(s, o) {
1349
+ function Me(s, o) {
1260
1350
  if (s == null) return "";
1261
1351
  if (typeof s != "object") return String(s);
1262
- const h = o.optionsLabel || "label";
1263
- return typeof h == "string" ? s[h] : Array.isArray(h) ? `${s[h[0]]}(${s[h[1]]})` : s.label;
1352
+ const f = o.optionsLabel || "label";
1353
+ return typeof f == "string" ? s[f] : Array.isArray(f) ? `${s[f[0]]}(${s[f[1]]})` : s.label;
1264
1354
  }
1265
- function he(s, o) {
1355
+ function ve(s, o) {
1266
1356
  return s == null || typeof s != "object" ? s : s[o.optionsValue || "value"];
1267
1357
  }
1268
- function _e(s) {
1358
+ function ke(s) {
1269
1359
  return {
1270
1360
  startKey: s.start || `${s.prop}Min`,
1271
1361
  endKey: s.end || `${s.prop}Max`
1272
1362
  };
1273
1363
  }
1274
- function $e(s, o = 2) {
1364
+ function Te(s, o = 2) {
1275
1365
  if (s == null || s === "") return;
1276
- const h = je(s, o);
1277
- if (h == null || h === "") return;
1278
- const k = Number(String(h).replace(/,/g, ""));
1279
- return Number.isFinite(k) ? k : void 0;
1366
+ const f = Xe(s, o);
1367
+ if (f == null || f === "") return;
1368
+ const w = Number(String(f).replace(/,/g, ""));
1369
+ return Number.isFinite(w) ? w : void 0;
1280
1370
  }
1281
- function we(s) {
1282
- const { startKey: o, endKey: h } = _e(s), k = s.precision ?? 2;
1283
- let U = $e(l.value[o], k), R = $e(l.value[h], k);
1284
- U != null && R != null && U > R && ([U, R] = [R, U]), l.value[o] = U, l.value[h] = R;
1285
- }
1286
- function tt(s) {
1287
- we(s), Y();
1371
+ function Ue(s) {
1372
+ const { startKey: o, endKey: f } = ke(s), w = s.precision ?? 2;
1373
+ let x = Te(r.value[o], w), R = Te(r.value[f], w);
1374
+ x != null && R != null && x > R && ([x, R] = [R, x]), r.value[o] = x, r.value[f] = R;
1288
1375
  }
1289
1376
  function nt(s) {
1290
- const { startKey: o, endKey: h } = _e(s), k = l.value[o], U = l.value[h];
1291
- return k != null && k !== "" || U != null && U !== "";
1377
+ Ue(s), Y();
1292
1378
  }
1293
1379
  function lt(s) {
1380
+ const { startKey: o, endKey: f } = ke(s), w = r.value[o], x = r.value[f];
1381
+ return w != null && w !== "" || x != null && x !== "";
1382
+ }
1383
+ function rt(s) {
1294
1384
  if (s.disabled) return;
1295
- const { startKey: o, endKey: h } = _e(s);
1296
- l.value[o] = void 0, l.value[h] = void 0, Y();
1385
+ const { startKey: o, endKey: f } = ke(s);
1386
+ r.value[o] = void 0, r.value[f] = void 0, Y();
1297
1387
  }
1298
1388
  async function st(s, o) {
1299
1389
  if (typeof s.remoteMethod == "function") {
1300
- p[s.prop] = !0;
1390
+ u[s.prop] = !0;
1301
1391
  try {
1302
- const h = await s.remoteMethod(o);
1303
- i[s.prop] = Array.isArray(h) ? h : [];
1392
+ const f = await s.remoteMethod(o);
1393
+ a[s.prop] = Array.isArray(f) ? f : [];
1304
1394
  } finally {
1305
- p[s.prop] = !1;
1395
+ u[s.prop] = !1;
1306
1396
  }
1307
1397
  }
1308
1398
  }
1309
1399
  function Ce(s) {
1310
- const o = s.style.maxHeight, h = s.style.overflow, k = s.style.transition;
1400
+ const o = s.style.maxHeight, f = s.style.overflow, w = s.style.transition;
1311
1401
  s.style.transition = "none", s.style.maxHeight = "none", s.style.overflow = "visible";
1312
- const U = s.scrollHeight;
1313
- return s.style.maxHeight = o, s.style.overflow = h, s.offsetHeight, s.style.transition = k, U;
1402
+ const x = s.scrollHeight;
1403
+ return s.style.maxHeight = o, s.style.overflow = f, s.offsetHeight, s.style.transition = w, x;
1314
1404
  }
1315
- function ie() {
1316
- const s = w.value;
1317
- if (!s || H || O) return;
1318
- H = !0;
1319
- const o = s.closest(".common-search"), h = Array.from(s.querySelectorAll(".common-search__field")), k = s.querySelector(".common-search__actions");
1320
- if (!h.length || !o) {
1321
- P.value = !1, c.value = 0, u.value = 0, L.value = null, f.value = 0, H = !1;
1405
+ function re() {
1406
+ const s = C.value;
1407
+ if (!s || W || D) return;
1408
+ W = !0;
1409
+ const o = s.closest(".common-search"), f = Array.from(s.querySelectorAll(".common-search__field")), w = s.querySelector(".common-search__actions");
1410
+ if (!f.length || !o) {
1411
+ P.value = !1, _.value = 0, p.value = 0, A.value = null, c.value = 0, W = !1;
1322
1412
  return;
1323
1413
  }
1324
- c.value = h[0].offsetHeight, u.value = Ce(s);
1325
- const U = 16, R = o.clientWidth, j = (k == null ? void 0 : k.offsetWidth) || 220, K = re(h, R, j, U);
1326
- let te = 1;
1327
- h.length > K && (te += x(h, K, R, U));
1328
- const pe = f.value;
1329
- f.value = K;
1330
- const r = te > 1, me = P.value;
1331
- P.value = r, r ? F.value ? L.value = null : L.value = c.value : (F.value = !1, L.value = null), H = !1, (me !== r || pe !== K) && X(() => ie());
1414
+ _.value = f[0].offsetHeight, p.value = Ce(s);
1415
+ const x = 16, R = o.clientWidth, z = (w == null ? void 0 : w.offsetWidth) || 220, K = le(f, R, z, x);
1416
+ let ee = 1;
1417
+ f.length > K && (ee += k(f, K, R, x));
1418
+ const he = c.value;
1419
+ c.value = K;
1420
+ const i = ee > 1, ye = P.value;
1421
+ P.value = i, i ? L.value ? A.value = null : A.value = _.value : (L.value = !1, A.value = null), W = !1, (ye !== i || he !== K) && J(() => re());
1332
1422
  }
1333
- function at() {
1334
- const s = w.value;
1335
- if (!s || O) return;
1336
- O = !0;
1337
- const o = s.getBoundingClientRect().height || c.value;
1338
- if (F.value)
1339
- L.value = o || Ce(s), F.value = !1, requestAnimationFrame(() => {
1423
+ function it() {
1424
+ const s = C.value;
1425
+ if (!s || D) return;
1426
+ D = !0;
1427
+ const o = s.getBoundingClientRect().height || _.value;
1428
+ if (L.value)
1429
+ A.value = o || Ce(s), L.value = !1, requestAnimationFrame(() => {
1340
1430
  requestAnimationFrame(() => {
1341
- L.value = c.value;
1431
+ A.value = _.value;
1342
1432
  });
1343
1433
  });
1344
1434
  else {
1345
- L.value = o;
1346
- const h = Ce(s);
1347
- u.value = h, F.value = !0, requestAnimationFrame(() => {
1435
+ A.value = o;
1436
+ const f = Ce(s);
1437
+ p.value = f, L.value = !0, requestAnimationFrame(() => {
1348
1438
  requestAnimationFrame(() => {
1349
- L.value = Math.max(h, c.value || 0);
1439
+ A.value = Math.max(f, _.value || 0);
1350
1440
  });
1351
1441
  });
1352
1442
  }
1353
1443
  window.setTimeout(() => {
1354
- O = !1, F.value && (L.value = null), ie();
1444
+ D = !1, L.value && (A.value = null), re();
1355
1445
  }, 380);
1356
1446
  }
1357
- function rt() {
1447
+ function at() {
1358
1448
  const s = {};
1359
1449
  return n.itemList.forEach((o) => {
1360
1450
  o.type === "daterange" || o.type === "dateRange" ? (s[o.start || o.startProp] = void 0, s[o.end || o.endProp] = void 0) : o.type === "number-range" || o.type === "numberRange" ? (s[o.start || `${o.prop}Min`] = void 0, s[o.end || `${o.prop}Max`] = void 0) : o.multiple ? s[o.prop] = [] : o.prop && (s[o.prop] = void 0);
1361
1451
  }), s;
1362
1452
  }
1363
- function Me() {
1364
- a("update:modelValue", { ...l.value });
1453
+ function Pe() {
1454
+ l("update:modelValue", { ...r.value });
1365
1455
  }
1366
1456
  function Y() {
1367
- Me(), a("change", { ...l.value }), a("search", { ...l.value });
1457
+ Pe(), l("change", { ...r.value }), l("search", { ...r.value });
1368
1458
  }
1369
- function Re() {
1370
- l.value = rt(), Me(), a("reset", { ...l.value }), a("change", { ...l.value });
1459
+ function Be() {
1460
+ r.value = at(), Pe(), l("reset", { ...r.value }), l("change", { ...r.value });
1371
1461
  }
1372
1462
  return (s, o) => {
1373
- const h = $("el-input"), k = $("el-option"), U = $("el-select"), R = $("el-input-number"), j = $("el-icon"), K = $("el-date-picker"), te = $("el-tooltip"), pe = $("el-button");
1374
- return ue((d(), y("div", {
1375
- class: W(["common-search", {
1463
+ const f = N("el-input"), w = N("el-option"), x = N("el-select"), R = N("el-input-number"), z = N("el-icon"), K = N("el-date-picker"), ee = N("el-tooltip"), he = N("el-button");
1464
+ return ae((d(), m("div", {
1465
+ class: j(["common-search", {
1376
1466
  "is-single-row": !P.value,
1377
1467
  "is-multi-row": P.value,
1378
- "is-expanded": P.value && F.value,
1379
- "is-collapsed": P.value && !F.value
1468
+ "is-expanded": P.value && L.value,
1469
+ "is-collapsed": P.value && !L.value
1380
1470
  }])
1381
1471
  }, [
1382
- C("div", _n, [
1383
- C("div", {
1472
+ b("div", Sn, [
1473
+ b("div", {
1384
1474
  ref_key: "fieldsRef",
1385
- ref: w,
1475
+ ref: C,
1386
1476
  class: "common-search__fields",
1387
- style: fe(J.value)
1477
+ style: de(pe.value)
1388
1478
  }, [
1389
- (d(!0), y(ee, null, ne(e.itemList, (r, me) => (d(), y(ee, {
1390
- key: r.prop || r.start || me
1479
+ (d(!0), m(Q, null, te(e.itemList, (i, ye) => (d(), m(Q, {
1480
+ key: i.prop || i.start || ye
1391
1481
  }, [
1392
- C("div", {
1393
- class: W(["common-search__field", [`is-${r.type}`, r.className]]),
1394
- style: fe(E(r))
1482
+ b("div", {
1483
+ class: j(["common-search__field", [`is-${i.type}`, i.className]]),
1484
+ style: de(H(i))
1395
1485
  }, [
1396
- S(te, {
1397
- content: z(r),
1398
- disabled: !z(r),
1486
+ S(ee, {
1487
+ content: me(i),
1488
+ disabled: !me(i),
1399
1489
  placement: "top",
1400
1490
  "show-after": 280
1401
1491
  }, {
1402
- default: N(() => [
1403
- C("div", wn, [
1404
- r.type === "input" || r.type === "text" ? (d(), D(h, {
1492
+ default: F(() => [
1493
+ b("div", kn, [
1494
+ i.type === "input" || i.type === "text" ? (d(), B(f, {
1405
1495
  key: 0,
1406
- modelValue: l.value[r.prop],
1407
- "onUpdate:modelValue": (v) => l.value[r.prop] = v,
1496
+ modelValue: r.value[i.prop],
1497
+ "onUpdate:modelValue": (v) => r.value[i.prop] = v,
1408
1498
  modelModifiers: { trim: !0 },
1409
1499
  clearable: "",
1410
- placeholder: b(r, "请输入"),
1411
- maxlength: r.maxlength || 200,
1412
- disabled: r.disabled,
1500
+ placeholder: y(i, "请输入"),
1501
+ maxlength: i.maxlength || 200,
1502
+ disabled: i.disabled,
1413
1503
  class: "common-search__control",
1414
- onKeyup: Be(Y, ["enter"]),
1504
+ onKeyup: Oe(Y, ["enter"]),
1415
1505
  onClear: Y
1416
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "maxlength", "disabled"])) : r.type === "select" ? (d(), D(U, {
1506
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "maxlength", "disabled"])) : i.type === "select" ? (d(), B(x, {
1417
1507
  key: 1,
1418
- modelValue: l.value[r.prop],
1419
- "onUpdate:modelValue": (v) => l.value[r.prop] = v,
1420
- placeholder: b(r, "请选择"),
1508
+ modelValue: r.value[i.prop],
1509
+ "onUpdate:modelValue": (v) => r.value[i.prop] = v,
1510
+ placeholder: y(i, "请选择"),
1421
1511
  clearable: "",
1422
- filterable: r.filterable !== !1,
1423
- multiple: r.multiple,
1424
- "collapse-tags": r.multiple,
1425
- "collapse-tags-tooltip": r.multiple,
1426
- disabled: r.disabled,
1512
+ filterable: i.filterable !== !1,
1513
+ multiple: i.multiple,
1514
+ "collapse-tags": i.multiple,
1515
+ "collapse-tags-tooltip": i.multiple,
1516
+ disabled: i.disabled,
1427
1517
  class: "common-search__control",
1428
1518
  onChange: Y
1429
1519
  }, {
1430
- default: N(() => [
1431
- (d(!0), y(ee, null, ne(r.options || [], (v, ke) => (d(), D(k, {
1432
- key: `${he(v, r)}-${ke}`,
1433
- label: Ne(v, r),
1434
- value: he(v, r),
1520
+ default: F(() => [
1521
+ (d(!0), m(Q, null, te(i.options || [], (v, Fe) => (d(), B(w, {
1522
+ key: `${ve(v, i)}-${Fe}`,
1523
+ label: Me(v, i),
1524
+ value: ve(v, i),
1435
1525
  disabled: typeof v == "object" && (v == null ? void 0 : v.disabled)
1436
1526
  }, null, 8, ["label", "value", "disabled"]))), 128))
1437
1527
  ]),
1438
1528
  _: 2
1439
- }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "filterable", "multiple", "collapse-tags", "collapse-tags-tooltip", "disabled"])) : r.type === "remote-select" || r.type === "remoteSelect" ? (d(), D(U, {
1529
+ }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "filterable", "multiple", "collapse-tags", "collapse-tags-tooltip", "disabled"])) : i.type === "remote-select" || i.type === "remoteSelect" ? (d(), B(x, {
1440
1530
  key: 2,
1441
- modelValue: l.value[r.prop],
1442
- "onUpdate:modelValue": (v) => l.value[r.prop] = v,
1443
- placeholder: b(r, "请输入关键词搜索"),
1531
+ modelValue: r.value[i.prop],
1532
+ "onUpdate:modelValue": (v) => r.value[i.prop] = v,
1533
+ placeholder: y(i, "请输入关键词搜索"),
1444
1534
  clearable: "",
1445
1535
  filterable: "",
1446
1536
  remote: "",
1447
- multiple: r.multiple,
1448
- "collapse-tags": r.multiple,
1449
- "collapse-tags-tooltip": r.multiple,
1537
+ multiple: i.multiple,
1538
+ "collapse-tags": i.multiple,
1539
+ "collapse-tags-tooltip": i.multiple,
1450
1540
  "reserve-keyword": !1,
1451
- "remote-method": (v) => st(r, v),
1452
- loading: !!p[r.prop],
1453
- disabled: r.disabled,
1541
+ "remote-method": (v) => st(i, v),
1542
+ loading: !!u[i.prop],
1543
+ disabled: i.disabled,
1454
1544
  class: "common-search__control",
1455
- onClear: (v) => i[r.prop] = [],
1545
+ onClear: (v) => a[i.prop] = [],
1456
1546
  onChange: Y
1457
1547
  }, {
1458
- default: N(() => [
1459
- (d(!0), y(ee, null, ne(i[r.prop] || r.options || [], (v, ke) => (d(), D(k, {
1460
- key: `${he(v, r)}-${ke}`,
1461
- label: Ne(v, r),
1462
- value: he(v, r),
1548
+ default: F(() => [
1549
+ (d(!0), m(Q, null, te(a[i.prop] || i.options || [], (v, Fe) => (d(), B(w, {
1550
+ key: `${ve(v, i)}-${Fe}`,
1551
+ label: Me(v, i),
1552
+ value: ve(v, i),
1463
1553
  disabled: typeof v == "object" && (v == null ? void 0 : v.disabled)
1464
1554
  }, null, 8, ["label", "value", "disabled"]))), 128))
1465
1555
  ]),
1466
1556
  _: 2
1467
- }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "multiple", "collapse-tags", "collapse-tags-tooltip", "remote-method", "loading", "disabled", "onClear"])) : r.type === "number-range" || r.type === "numberRange" ? (d(), y("div", {
1557
+ }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "multiple", "collapse-tags", "collapse-tags-tooltip", "remote-method", "loading", "disabled", "onClear"])) : i.type === "number-range" || i.type === "numberRange" ? (d(), m("div", {
1468
1558
  key: 3,
1469
1559
  class: "common-search__range common-search__range--number",
1470
- onKeyup: Be((v) => tt(r), ["enter"])
1560
+ onKeyup: Oe((v) => nt(i), ["enter"])
1471
1561
  }, [
1472
1562
  S(R, {
1473
- modelValue: l.value[r.start || `${r.prop}Min`],
1474
- "onUpdate:modelValue": (v) => l.value[r.start || `${r.prop}Min`] = v,
1563
+ modelValue: r.value[i.start || `${i.prop}Min`],
1564
+ "onUpdate:modelValue": (v) => r.value[i.start || `${i.prop}Min`] = v,
1475
1565
  controls: !1,
1476
- min: r.min,
1477
- max: r.max,
1478
- placeholder: T(r, "min"),
1479
- disabled: r.disabled,
1566
+ min: i.min,
1567
+ max: i.max,
1568
+ placeholder: M(i, "min"),
1569
+ disabled: i.disabled,
1480
1570
  class: "common-search__range-input",
1481
- onBlur: (v) => we(r)
1571
+ onBlur: (v) => Ue(i)
1482
1572
  }, null, 8, ["modelValue", "onUpdate:modelValue", "min", "max", "placeholder", "disabled", "onBlur"]),
1483
- C("span", kn, B(r.separator || "至"), 1),
1573
+ b("span", Cn, T(i.separator || "至"), 1),
1484
1574
  S(R, {
1485
- modelValue: l.value[r.end || `${r.prop}Max`],
1486
- "onUpdate:modelValue": (v) => l.value[r.end || `${r.prop}Max`] = v,
1575
+ modelValue: r.value[i.end || `${i.prop}Max`],
1576
+ "onUpdate:modelValue": (v) => r.value[i.end || `${i.prop}Max`] = v,
1487
1577
  controls: !1,
1488
- min: r.min,
1489
- max: r.max,
1490
- placeholder: T(r, "max"),
1491
- disabled: r.disabled,
1578
+ min: i.min,
1579
+ max: i.max,
1580
+ placeholder: M(i, "max"),
1581
+ disabled: i.disabled,
1492
1582
  class: "common-search__range-input",
1493
- onBlur: (v) => we(r)
1583
+ onBlur: (v) => Ue(i)
1494
1584
  }, null, 8, ["modelValue", "onUpdate:modelValue", "min", "max", "placeholder", "disabled", "onBlur"]),
1495
- r.clearable !== !1 && nt(r) ? (d(), D(j, {
1585
+ i.clearable !== !1 && lt(i) ? (d(), B(z, {
1496
1586
  key: 0,
1497
1587
  class: "common-search__range-clear",
1498
- onMousedown: o[0] || (o[0] = ye(() => {
1588
+ onMousedown: o[0] || (o[0] = we(() => {
1499
1589
  }, ["prevent"])),
1500
- onClick: (v) => lt(r)
1590
+ onClick: (v) => rt(i)
1501
1591
  }, {
1502
- default: N(() => [
1503
- S(de(ze))
1592
+ default: F(() => [
1593
+ S(ue(We))
1504
1594
  ]),
1505
1595
  _: 1
1506
1596
  }, 8, ["onClick"])) : V("", !0)
1507
- ], 40, Cn)) : r.type === "date" ? (d(), D(K, {
1597
+ ], 40, Un)) : i.type === "date" ? (d(), B(K, {
1508
1598
  key: 4,
1509
- modelValue: l.value[r.prop],
1510
- "onUpdate:modelValue": (v) => l.value[r.prop] = v,
1511
- type: r.dateType || "date",
1512
- placeholder: b(r, "年/月/日"),
1513
- "value-format": r.valueFormat || "YYYY-MM-DD",
1514
- format: r.format || "YYYY/MM/DD",
1515
- clearable: r.clearable !== !1,
1516
- disabled: r.disabled,
1599
+ modelValue: r.value[i.prop],
1600
+ "onUpdate:modelValue": (v) => r.value[i.prop] = v,
1601
+ type: i.dateType || "date",
1602
+ placeholder: y(i, "年/月/日"),
1603
+ "value-format": i.valueFormat || "YYYY-MM-DD",
1604
+ format: i.format || "YYYY/MM/DD",
1605
+ clearable: i.clearable !== !1,
1606
+ disabled: i.disabled,
1517
1607
  class: "common-search__control",
1518
1608
  onChange: Y
1519
- }, null, 8, ["modelValue", "onUpdate:modelValue", "type", "placeholder", "value-format", "format", "clearable", "disabled"])) : r.type === "daterange" || r.type === "dateRange" ? (d(), y("div", Un, [
1520
- S(Ze, {
1521
- start: l.value[r.start || r.startProp],
1522
- "onUpdate:start": (v) => l.value[r.start || r.startProp] = v,
1523
- end: l.value[r.end || r.endProp],
1524
- "onUpdate:end": (v) => l.value[r.end || r.endProp] = v,
1525
- title: r.label || r.title || "",
1526
- type: r.dateType || r.pickerType || "daterange",
1527
- "value-format": r.valueFormat || "YYYY-MM-DD HH:mm:ss",
1528
- format: r.format,
1529
- "show-shortcuts": r.showShortcuts !== !1,
1530
- shortcuts: r.shortcuts,
1531
- "can-clearable": r.clearable !== !1,
1609
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "type", "placeholder", "value-format", "format", "clearable", "disabled"])) : i.type === "daterange" || i.type === "dateRange" ? (d(), m("div", Fn, [
1610
+ S(et, {
1611
+ start: r.value[i.start || i.startProp],
1612
+ "onUpdate:start": (v) => r.value[i.start || i.startProp] = v,
1613
+ end: r.value[i.end || i.endProp],
1614
+ "onUpdate:end": (v) => r.value[i.end || i.endProp] = v,
1615
+ title: i.label || i.title || "",
1616
+ type: i.dateType || i.pickerType || "daterange",
1617
+ "value-format": i.valueFormat || "YYYY-MM-DD HH:mm:ss",
1618
+ format: i.format,
1619
+ "show-shortcuts": i.showShortcuts !== !1,
1620
+ shortcuts: i.shortcuts,
1621
+ "can-clearable": i.clearable !== !1,
1532
1622
  onChange: Y
1533
1623
  }, null, 8, ["start", "onUpdate:start", "end", "onUpdate:end", "title", "type", "value-format", "format", "show-shortcuts", "shortcuts", "can-clearable"])
1534
- ])) : oe(s.$slots, r.slotName || r.prop, {
1535
- item: r,
1536
- form: l.value
1624
+ ])) : ie(s.$slots, i.slotName || i.prop, {
1625
+ item: i,
1626
+ form: r.value
1537
1627
  }, void 0, !0, 6)
1538
1628
  ])
1539
1629
  ]),
1540
1630
  _: 2
1541
1631
  }, 1032, ["content", "disabled"])
1542
1632
  ], 6),
1543
- Z(me) ? (d(), y("div", Sn, [
1544
- C("div", xn, [
1545
- oe(s.$slots, "actions", {
1633
+ X(ye) ? (d(), m("div", Ln, [
1634
+ b("div", Nn, [
1635
+ ie(s.$slots, "actions", {
1546
1636
  search: Y,
1547
- reset: Re,
1548
- form: l.value
1637
+ reset: Be,
1638
+ form: r.value
1549
1639
  }, () => [
1550
- S(pe, {
1640
+ S(he, {
1551
1641
  class: "common-search__reset",
1552
- onClick: Re
1642
+ onClick: Be
1553
1643
  }, {
1554
- default: N(() => [...o[1] || (o[1] = [
1644
+ default: F(() => [...o[1] || (o[1] = [
1555
1645
  q("重置", -1)
1556
1646
  ])]),
1557
1647
  _: 1
1558
1648
  }),
1559
- S(pe, {
1649
+ S(he, {
1560
1650
  type: "primary",
1561
1651
  class: "common-search__submit",
1562
1652
  onClick: Y
1563
1653
  }, {
1564
- default: N(() => [...o[2] || (o[2] = [
1654
+ default: F(() => [...o[2] || (o[2] = [
1565
1655
  q(" 搜索 ", -1)
1566
1656
  ])]),
1567
1657
  _: 1
1568
1658
  })
1569
1659
  ], !0),
1570
- P.value ? (d(), D(pe, {
1660
+ P.value ? (d(), B(he, {
1571
1661
  key: 0,
1572
1662
  link: "",
1573
1663
  type: "primary",
1574
- onClick: at
1664
+ onClick: it
1575
1665
  }, {
1576
- default: N(() => [
1577
- q(B(F.value ? "收起" : "展开") + " ", 1),
1578
- S(j, { class: "el-icon--right" }, {
1579
- default: N(() => [
1580
- F.value ? (d(), D(de(ft), { key: 0 })) : (d(), D(de(ht), { key: 1 }))
1666
+ default: F(() => [
1667
+ q(T(L.value ? "收起" : "展开") + " ", 1),
1668
+ S(z, { class: "el-icon--right" }, {
1669
+ default: F(() => [
1670
+ L.value ? (d(), B(ue(ht), { key: 0 })) : (d(), B(ue(gt), { key: 1 }))
1581
1671
  ]),
1582
1672
  _: 1
1583
1673
  })
@@ -1590,11 +1680,11 @@ const vn = /* @__PURE__ */ ae(rn, [["render", yn], ["__scopeId", "data-v-226ee18
1590
1680
  ], 4)
1591
1681
  ])
1592
1682
  ], 2)), [
1593
- [ce, e.itemList.length]
1683
+ [oe, e.itemList.length]
1594
1684
  ]);
1595
1685
  };
1596
1686
  }
1597
- }), Ln = /* @__PURE__ */ ae(Fn, [["__scopeId", "data-v-006c1ace"]]), Nn = {
1687
+ }), Rn = /* @__PURE__ */ Z(An, [["__scopeId", "data-v-006c1ace"]]), $n = {
1598
1688
  name: "MgOverflowHid",
1599
1689
  props: {
1600
1690
  label: String,
@@ -1617,65 +1707,65 @@ const vn = /* @__PURE__ */ ae(rn, [["render", yn], ["__scopeId", "data-v-226ee18
1617
1707
  return n && n.length > t && (n = n.slice(0, t) + "..."), n;
1618
1708
  }
1619
1709
  }
1620
- }, $n = { class: "tableOverflowHid" }, Mn = ["innerHTML"], Rn = { class: "name-wrapper" }, Pn = ["innerHTML"], Tn = { key: 1 }, Bn = ["innerHTML"];
1621
- function Dn(e, t, n, a, l, i) {
1622
- const p = $("el-popover");
1623
- return d(), y("div", $n, [
1624
- n.value && n.value.length > n.maxLength ? (d(), D(p, {
1710
+ }, Mn = { class: "tableOverflowHid" }, Tn = ["innerHTML"], Pn = { class: "name-wrapper" }, Bn = ["innerHTML"], Vn = { key: 1 }, In = ["innerHTML"];
1711
+ function On(e, t, n, l, r, a) {
1712
+ const u = N("el-popover");
1713
+ return d(), m("div", Mn, [
1714
+ n.value && n.value.length > n.maxLength ? (d(), B(u, {
1625
1715
  key: 0,
1626
1716
  trigger: "hover",
1627
1717
  placement: "bottom",
1628
1718
  width: "400"
1629
1719
  }, {
1630
- reference: N(() => [
1631
- C("div", Rn, [
1632
- ue(C("span", {
1633
- class: W(n.labelClassName)
1634
- }, B(n.label) + ":", 3), [
1635
- [ce, n.label]
1720
+ reference: F(() => [
1721
+ b("div", Pn, [
1722
+ ae(b("span", {
1723
+ class: j(n.labelClassName)
1724
+ }, T(n.label) + ":", 3), [
1725
+ [oe, n.label]
1636
1726
  ]),
1637
- C("span", {
1638
- class: W(n.valueClassName),
1639
- innerHTML: i.cutString(n.value, n.maxLength)
1640
- }, null, 10, Pn)
1727
+ b("span", {
1728
+ class: j(n.valueClassName),
1729
+ innerHTML: a.cutString(n.value, n.maxLength)
1730
+ }, null, 10, Bn)
1641
1731
  ])
1642
1732
  ]),
1643
- default: N(() => [
1644
- ue(C("span", {
1645
- class: W(n.labelClassName)
1646
- }, B(n.label) + ":", 3), [
1647
- [ce, n.label]
1733
+ default: F(() => [
1734
+ ae(b("span", {
1735
+ class: j(n.labelClassName)
1736
+ }, T(n.label) + ":", 3), [
1737
+ [oe, n.label]
1648
1738
  ]),
1649
- C("span", { innerHTML: n.value }, null, 8, Mn)
1739
+ b("span", { innerHTML: n.value }, null, 8, Tn)
1650
1740
  ]),
1651
1741
  _: 1
1652
- })) : (d(), y("div", Tn, [
1653
- ue(C("span", {
1654
- class: W(n.labelClassName)
1655
- }, B(n.label) + ":", 3), [
1656
- [ce, n.label]
1742
+ })) : (d(), m("div", Vn, [
1743
+ ae(b("span", {
1744
+ class: j(n.labelClassName)
1745
+ }, T(n.label) + ":", 3), [
1746
+ [oe, n.label]
1657
1747
  ]),
1658
- C("span", {
1659
- class: W([n.valueClassName, "value"])
1748
+ b("span", {
1749
+ class: j([n.valueClassName, "value"])
1660
1750
  }, [
1661
- C("span", { innerHTML: n.value }, null, 8, Bn)
1751
+ b("span", { innerHTML: n.value }, null, 8, In)
1662
1752
  ], 2)
1663
1753
  ]))
1664
1754
  ]);
1665
1755
  }
1666
- const et = /* @__PURE__ */ ae(Nn, [["render", Dn], ["__scopeId", "data-v-ef86ea54"]]), On = { key: 0 }, Vn = { key: 1 }, In = {
1756
+ const tt = /* @__PURE__ */ Z($n, [["render", On], ["__scopeId", "data-v-ef86ea54"]]), Dn = { key: 0 }, En = { key: 1 }, Hn = {
1667
1757
  key: 2,
1668
1758
  class: "price-text"
1669
- }, An = {
1759
+ }, zn = {
1670
1760
  key: 3,
1671
1761
  class: "rate-text"
1672
- }, Hn = {
1762
+ }, Kn = {
1673
1763
  key: 4,
1674
1764
  class: "bold-text"
1675
- }, zn = {
1765
+ }, jn = {
1676
1766
  key: 0,
1677
1767
  class: "common-table__pagination"
1678
- }, En = { class: "common-table__pagination-left" }, jn = /* @__PURE__ */ Object.assign({ name: "MgDataTable" }, {
1768
+ }, Wn = { class: "common-table__pagination-left" }, Yn = /* @__PURE__ */ Object.assign({ name: "MgDataTable" }, {
1679
1769
  __name: "DataTable",
1680
1770
  props: {
1681
1771
  /** 列配置:el-table-column 属性 + slotName */
@@ -1748,111 +1838,111 @@ const et = /* @__PURE__ */ ae(Nn, [["render", Dn], ["__scopeId", "data-v-ef86ea5
1748
1838
  },
1749
1839
  emits: ["pageChange", "cellClick", "edit", "delete", "selectionChange"],
1750
1840
  setup(e, { expose: t, emit: n }) {
1751
- const a = e, l = n, i = A(null), p = A(null), m = A(360);
1752
- let _ = null;
1753
- const w = ve(() => {
1754
- if (a.fillHeight)
1755
- return m.value;
1756
- }), F = {
1841
+ const l = e, r = n, a = O(null), u = O(null), U = O(360);
1842
+ let h = null;
1843
+ const C = xe(() => {
1844
+ if (l.fillHeight)
1845
+ return U.value;
1846
+ }), L = {
1757
1847
  background: "var(--brand-secondary)",
1758
1848
  color: "var(--brand-text-regular)",
1759
1849
  fontWeight: 600,
1760
1850
  fontSize: "13px"
1761
- }, P = ve(() => ({
1762
- headerCellStyle: F,
1763
- ...a.tableBind
1851
+ }, P = xe(() => ({
1852
+ headerCellStyle: L,
1853
+ ...l.tableBind
1764
1854
  }));
1765
- function f(g) {
1766
- const { slotName: b, headerSlotName: T, maxLength: I, ...Z } = g || {};
1855
+ function c(g) {
1856
+ const { slotName: y, headerSlotName: M, maxLength: I, ...X } = g || {};
1767
1857
  return {
1768
- ...Z
1858
+ ...X
1769
1859
  };
1770
1860
  }
1771
- function c(g) {
1772
- return a.pagination ? (a.pagination.page - 1) * a.pagination.limit + g + 1 : g + 1;
1861
+ function _(g) {
1862
+ return l.pagination ? (l.pagination.page - 1) * l.pagination.limit + g + 1 : g + 1;
1773
1863
  }
1774
- function u() {
1775
- if (!a.fillHeight || !p.value) return;
1776
- const g = Math.max(120, Math.floor(p.value.clientHeight) - 2);
1777
- g > 0 && g !== m.value && (m.value = g, X(() => {
1778
- var b, T;
1779
- return (T = (b = i.value) == null ? void 0 : b.doLayout) == null ? void 0 : T.call(b);
1864
+ function p() {
1865
+ if (!l.fillHeight || !u.value) return;
1866
+ const g = Math.max(120, Math.floor(u.value.clientHeight) - 2);
1867
+ g > 0 && g !== U.value && (U.value = g, J(() => {
1868
+ var y, M;
1869
+ return (M = (y = a.value) == null ? void 0 : y.doLayout) == null ? void 0 : M.call(y);
1780
1870
  }));
1781
1871
  }
1782
- function L(g) {
1783
- var b;
1784
- l("pageChange", { page: (b = a.pagination) == null ? void 0 : b.page, limit: g });
1872
+ function A(g) {
1873
+ var y;
1874
+ r("pageChange", { page: (y = l.pagination) == null ? void 0 : y.page, limit: g });
1785
1875
  }
1786
- function M(g) {
1787
- var b;
1788
- l("pageChange", { page: g, limit: (b = a.pagination) == null ? void 0 : b.limit });
1876
+ function $(g) {
1877
+ var y;
1878
+ r("pageChange", { page: g, limit: (y = l.pagination) == null ? void 0 : y.limit });
1789
1879
  }
1790
- function H(g, b, T, I) {
1791
- l("cellClick", g, b, T, I), a.canCellClick && (b == null ? void 0 : b.label) !== "操作" && window.getSelection().toString();
1880
+ function W(g, y, M, I) {
1881
+ r("cellClick", g, y, M, I), l.canCellClick && (y == null ? void 0 : y.label) !== "操作" && window.getSelection().toString();
1792
1882
  }
1793
- function O(g, b, T) {
1794
- var Z, x, re;
1795
- if (!a.showSelection || (b == null ? void 0 : b.type) === "selection") return;
1796
- const I = T == null ? void 0 : T.target;
1797
- (Z = I == null ? void 0 : I.closest) != null && Z.call(I, "a, button, .el-button, .el-checkbox, .link-btn, input, textarea") || typeof a.selectable == "function" && !a.selectable(g, 0) || (re = (x = i.value) == null ? void 0 : x.toggleRowSelection) == null || re.call(x, g);
1883
+ function D(g, y, M) {
1884
+ var X, k, le;
1885
+ if (!l.showSelection || (y == null ? void 0 : y.type) === "selection") return;
1886
+ const I = M == null ? void 0 : M.target;
1887
+ (X = I == null ? void 0 : I.closest) != null && X.call(I, "a, button, .el-button, .el-checkbox, .link-btn, input, textarea") || typeof l.selectable == "function" && !l.selectable(g, 0) || (le = (k = a.value) == null ? void 0 : k.toggleRowSelection) == null || le.call(k, g);
1798
1888
  }
1799
- function J(g) {
1800
- l("selectionChange", g);
1889
+ function pe(g) {
1890
+ r("selectionChange", g);
1801
1891
  }
1802
- function Q() {
1803
- var g, b;
1804
- (b = (g = i.value) == null ? void 0 : g.clearSelection) == null || b.call(g);
1892
+ function fe() {
1893
+ var g, y;
1894
+ (y = (g = a.value) == null ? void 0 : g.clearSelection) == null || y.call(g);
1805
1895
  }
1806
- function z(g, b) {
1807
- var T, I;
1808
- (I = (T = i.value) == null ? void 0 : T.toggleRowSelection) == null || I.call(T, g, b);
1896
+ function me(g, y) {
1897
+ var M, I;
1898
+ (I = (M = a.value) == null ? void 0 : M.toggleRowSelection) == null || I.call(M, g, y);
1809
1899
  }
1810
- return t({ clearSelection: Q, toggleRowSelection: z }), be(() => {
1811
- !a.fillHeight || !p.value || (u(), _ = new ResizeObserver(() => {
1812
- requestAnimationFrame(u);
1813
- }), _.observe(p.value));
1814
- }), Se(() => {
1815
- _ == null || _.disconnect(), _ = null;
1816
- }), le(
1817
- () => a.dataList,
1900
+ return t({ clearSelection: fe, toggleRowSelection: me }), Se(() => {
1901
+ !l.fillHeight || !u.value || (p(), h = new ResizeObserver(() => {
1902
+ requestAnimationFrame(p);
1903
+ }), h.observe(u.value));
1904
+ }), Re(() => {
1905
+ h == null || h.disconnect(), h = null;
1906
+ }), ne(
1907
+ () => l.dataList,
1818
1908
  () => {
1819
- X(() => {
1820
- var g, b;
1821
- u(), (b = (g = i.value) == null ? void 0 : g.doLayout) == null || b.call(g);
1909
+ J(() => {
1910
+ var g, y;
1911
+ p(), (y = (g = a.value) == null ? void 0 : g.doLayout) == null || y.call(g);
1822
1912
  });
1823
1913
  }
1824
- ), le(
1825
- () => a.fillHeight,
1914
+ ), ne(
1915
+ () => l.fillHeight,
1826
1916
  (g) => {
1827
- g && X(() => {
1828
- u(), !_ && p.value && (_ = new ResizeObserver(() => {
1829
- requestAnimationFrame(u);
1830
- }), _.observe(p.value));
1917
+ g && J(() => {
1918
+ p(), !h && u.value && (h = new ResizeObserver(() => {
1919
+ requestAnimationFrame(p);
1920
+ }), h.observe(u.value));
1831
1921
  });
1832
1922
  }
1833
- ), (g, b) => {
1834
- const T = $("el-table-column"), I = $("el-table"), Z = $("el-pagination");
1835
- return d(), y("div", {
1836
- class: W(["common-table", { "is-fill-height": e.fillHeight }])
1923
+ ), (g, y) => {
1924
+ const M = N("el-table-column"), I = N("el-table"), X = N("el-pagination");
1925
+ return d(), m("div", {
1926
+ class: j(["common-table", { "is-fill-height": e.fillHeight }])
1837
1927
  }, [
1838
- C("div", {
1928
+ b("div", {
1839
1929
  ref_key: "mainRef",
1840
- ref: p,
1930
+ ref: u,
1841
1931
  class: "common-table__main"
1842
1932
  }, [
1843
- S(I, De({
1933
+ S(I, Ne({
1844
1934
  ref_key: "tableRef",
1845
- ref: i,
1935
+ ref: a,
1846
1936
  data: e.dataList,
1847
- height: w.value,
1937
+ height: C.value,
1848
1938
  class: { "common-pointer-table": e.canCellClick || e.showSelection }
1849
1939
  }, P.value, {
1850
- onCellClick: H,
1851
- onRowClick: O,
1852
- onSelectionChange: J
1940
+ onCellClick: W,
1941
+ onRowClick: D,
1942
+ onSelectionChange: pe
1853
1943
  }), {
1854
- default: N(() => [
1855
- e.showSelection ? (d(), D(T, {
1944
+ default: F(() => [
1945
+ e.showSelection ? (d(), B(M, {
1856
1946
  key: 0,
1857
1947
  type: "selection",
1858
1948
  width: e.selectionWidth,
@@ -1860,60 +1950,60 @@ const et = /* @__PURE__ */ ae(Nn, [["render", Dn], ["__scopeId", "data-v-ef86ea5
1860
1950
  selectable: e.selectable,
1861
1951
  fixed: "left"
1862
1952
  }, null, 8, ["width", "selectable"])) : V("", !0),
1863
- e.showIndex ? (d(), D(T, {
1953
+ e.showIndex ? (d(), B(M, {
1864
1954
  key: 1,
1865
1955
  type: "index",
1866
1956
  label: e.indexLabel,
1867
1957
  width: e.indexWidth,
1868
- index: c,
1958
+ index: _,
1869
1959
  align: "center"
1870
1960
  }, null, 8, ["label", "width"])) : V("", !0),
1871
- (d(!0), y(ee, null, ne(e.propList, (x, re) => (d(), D(T, De({
1872
- key: x.prop || x.slotName || re
1873
- }, { ref_for: !0 }, f(x)), xt({ _: 2 }, [
1874
- x.headerSlotName ? {
1961
+ (d(!0), m(Q, null, te(e.propList, (k, le) => (d(), B(M, Ne({
1962
+ key: k.prop || k.slotName || le
1963
+ }, { ref_for: !0 }, c(k)), Nt({ _: 2 }, [
1964
+ k.headerSlotName ? {
1875
1965
  name: "header",
1876
- fn: N(() => [
1877
- oe(g.$slots, x.headerSlotName, { column: x }, void 0, !0)
1966
+ fn: F(() => [
1967
+ ie(g.$slots, k.headerSlotName, { column: k }, void 0, !0)
1878
1968
  ]),
1879
1969
  key: "0"
1880
1970
  } : void 0,
1881
- x.slotName ? {
1971
+ k.slotName ? {
1882
1972
  name: "default",
1883
- fn: N((E) => [
1884
- x.slotName === "overtext" ? (d(), y("div", On, [
1885
- S(et, {
1886
- value: String(E.row[x.prop] ?? ""),
1887
- "max-length": x.maxLength || 18
1973
+ fn: F((H) => [
1974
+ k.slotName === "overtext" ? (d(), m("div", Dn, [
1975
+ S(tt, {
1976
+ value: String(H.row[k.prop] ?? ""),
1977
+ "max-length": k.maxLength || 18
1888
1978
  }, null, 8, ["value", "max-length"])
1889
- ])) : x.slotName === "whether" ? (d(), y("div", Vn, [
1890
- C("span", {
1891
- class: W({
1892
- "whether-yes": E.row[x.prop] == 1,
1893
- "whether-no": E.row[x.prop] == 0
1979
+ ])) : k.slotName === "whether" ? (d(), m("div", En, [
1980
+ b("span", {
1981
+ class: j({
1982
+ "whether-yes": H.row[k.prop] == 1,
1983
+ "whether-no": H.row[k.prop] == 0
1894
1984
  })
1895
- }, B(E.row[x.prop] == 0 ? "否" : E.row[x.prop] == 1 ? "是" : ""), 3)
1896
- ])) : x.slotName === "price" ? (d(), y("div", In, B(de(je)(E.row[x.prop], 2)), 1)) : x.slotName === "rate" ? (d(), y("div", An, B(de(vt)(E.row[x.prop], 2, "toPercentText")), 1)) : x.slotName === "boldtext" ? (d(), y("div", Hn, B(E.row[x.prop]), 1)) : oe(g.$slots, x.slotName, {
1897
- row: E.row,
1898
- index: E.$index,
1899
- column: x
1985
+ }, T(H.row[k.prop] == 0 ? "否" : H.row[k.prop] == 1 ? "是" : ""), 3)
1986
+ ])) : k.slotName === "price" ? (d(), m("div", Hn, T(ue(Xe)(H.row[k.prop], 2)), 1)) : k.slotName === "rate" ? (d(), m("div", zn, T(ue(_t)(H.row[k.prop], 2, "toPercentText")), 1)) : k.slotName === "boldtext" ? (d(), m("div", Kn, T(H.row[k.prop]), 1)) : ie(g.$slots, k.slotName, {
1987
+ row: H.row,
1988
+ index: H.$index,
1989
+ column: k
1900
1990
  }, () => [
1901
- q(B(de(bt)(E.row[x.prop])), 1)
1991
+ q(T(ue(wt)(H.row[k.prop])), 1)
1902
1992
  ], !0, 5)
1903
1993
  ]),
1904
1994
  key: "1"
1905
1995
  } : void 0
1906
1996
  ]), 1040))), 128)),
1907
- oe(g.$slots, "default", {}, void 0, !0)
1997
+ ie(g.$slots, "default", {}, void 0, !0)
1908
1998
  ]),
1909
1999
  _: 3
1910
2000
  }, 16, ["data", "height", "class"])
1911
2001
  ], 512),
1912
- e.pagination ? (d(), y("div", zn, [
1913
- C("div", En, [
1914
- oe(g.$slots, "pagination-left", {}, void 0, !0)
2002
+ e.pagination ? (d(), m("div", jn, [
2003
+ b("div", Wn, [
2004
+ ie(g.$slots, "pagination-left", {}, void 0, !0)
1915
2005
  ]),
1916
- S(Z, {
2006
+ S(X, {
1917
2007
  class: "common-table__pagination-right",
1918
2008
  background: "",
1919
2009
  "current-page": Number(e.pagination.page) || 1,
@@ -1921,17 +2011,17 @@ const et = /* @__PURE__ */ ae(Nn, [["render", Dn], ["__scopeId", "data-v-ef86ea5
1921
2011
  "page-sizes": e.pageSizes,
1922
2012
  total: Number(e.pagination.total) || 0,
1923
2013
  layout: e.paginationLayout,
1924
- onSizeChange: L,
1925
- onCurrentChange: M
2014
+ onSizeChange: A,
2015
+ onCurrentChange: $
1926
2016
  }, null, 8, ["current-page", "page-size", "page-sizes", "total", "layout"])
1927
2017
  ])) : V("", !0)
1928
2018
  ], 2);
1929
2019
  };
1930
2020
  }
1931
- }), Kn = /* @__PURE__ */ ae(jn, [["__scopeId", "data-v-dd7169fd"]]), Wn = ["aria-checked", "disabled", "onClick"], Yn = { class: "segmented__label" }, qn = {
2021
+ }), qn = /* @__PURE__ */ Z(Yn, [["__scopeId", "data-v-dd7169fd"]]), Gn = ["aria-checked", "disabled", "onClick"], Jn = { class: "segmented__label" }, Xn = {
1932
2022
  key: 0,
1933
2023
  class: "segmented__badge"
1934
- }, Gn = {
2024
+ }, Qn = {
1935
2025
  __name: "SegmentedControl",
1936
2026
  props: {
1937
2027
  modelValue: { type: [String, Number, Boolean], default: void 0 },
@@ -1940,162 +2030,179 @@ const et = /* @__PURE__ */ ae(Nn, [["render", Dn], ["__scopeId", "data-v-ef86ea5
1940
2030
  },
1941
2031
  emits: ["update:modelValue", "change"],
1942
2032
  setup(e, { emit: t }) {
1943
- const n = e, a = t, l = A(null), i = A([]), p = A(!1), m = A({
2033
+ const n = e, l = t, r = O(null), a = O([]), u = O(!1), U = O({
1944
2034
  width: "0px",
1945
2035
  transform: "translateX(0px)"
1946
2036
  });
1947
- let _ = null;
1948
- function w(u) {
1949
- return (u == null ? void 0 : u.count) != null || (u == null ? void 0 : u.badge) != null;
2037
+ let h = null;
2038
+ function C(p) {
2039
+ return (p == null ? void 0 : p.count) != null || (p == null ? void 0 : p.badge) != null;
1950
2040
  }
1951
- function F(u) {
1952
- return u.count != null ? u.count : u.badge;
2041
+ function L(p) {
2042
+ return p.count != null ? p.count : p.badge;
1953
2043
  }
1954
- function P(u, L) {
1955
- u && (i.value[L] = u);
2044
+ function P(p, A) {
2045
+ p && (a.value[A] = p);
1956
2046
  }
1957
- function f() {
1958
- const u = l.value;
1959
- if (!u) return;
1960
- const L = n.options.findIndex((J) => J.value === n.modelValue), M = i.value[L];
1961
- if (!M) {
1962
- m.value = { width: "0px", transform: "translateX(0px)" };
2047
+ function c() {
2048
+ const p = r.value;
2049
+ if (!p) return;
2050
+ const A = n.options.findIndex((pe) => pe.value === n.modelValue), $ = a.value[A];
2051
+ if (!$) {
2052
+ U.value = { width: "0px", transform: "translateX(0px)" };
1963
2053
  return;
1964
2054
  }
1965
- const H = u.getBoundingClientRect(), O = M.getBoundingClientRect();
1966
- m.value = {
1967
- width: `${O.width}px`,
1968
- transform: `translateX(${O.left - H.left}px)`
1969
- }, p.value = !0;
2055
+ const W = p.getBoundingClientRect(), D = $.getBoundingClientRect();
2056
+ U.value = {
2057
+ width: `${D.width}px`,
2058
+ transform: `translateX(${D.left - W.left}px)`
2059
+ }, u.value = !0;
1970
2060
  }
1971
- function c(u) {
1972
- u.disabled || (a("update:modelValue", u.value), a("change", u.value));
2061
+ function _(p) {
2062
+ p.disabled || (l("update:modelValue", p.value), l("change", p.value));
1973
2063
  }
1974
- return le(
2064
+ return ne(
1975
2065
  () => [n.modelValue, n.options],
1976
2066
  async () => {
1977
- await X(), f();
2067
+ await J(), c();
1978
2068
  },
1979
2069
  { deep: !0 }
1980
- ), be(async () => {
1981
- await X(), f(), typeof ResizeObserver < "u" && l.value && (_ = new ResizeObserver(() => f()), _.observe(l.value));
1982
- }), Se(() => {
1983
- _ == null || _.disconnect(), _ = null;
1984
- }), (u, L) => (d(), y("div", {
2070
+ ), Se(async () => {
2071
+ await J(), c(), typeof ResizeObserver < "u" && r.value && (h = new ResizeObserver(() => c()), h.observe(r.value));
2072
+ }), Re(() => {
2073
+ h == null || h.disconnect(), h = null;
2074
+ }), (p, A) => (d(), m("div", {
1985
2075
  ref_key: "rootRef",
1986
- ref: l,
2076
+ ref: r,
1987
2077
  class: "segmented",
1988
2078
  role: "radiogroup"
1989
2079
  }, [
1990
- C("div", {
1991
- class: W(["segmented__thumb", { "is-ready": p.value }]),
1992
- style: fe(m.value)
2080
+ b("div", {
2081
+ class: j(["segmented__thumb", { "is-ready": u.value }]),
2082
+ style: de(U.value)
1993
2083
  }, null, 6),
1994
- (d(!0), y(ee, null, ne(e.options, (M, H) => (d(), y("button", {
1995
- key: String(M.value),
2084
+ (d(!0), m(Q, null, te(e.options, ($, W) => (d(), m("button", {
2085
+ key: String($.value),
1996
2086
  ref_for: !0,
1997
- ref: (O) => P(O, H),
2087
+ ref: (D) => P(D, W),
1998
2088
  type: "button",
1999
- class: W(["segmented__item", { "is-active": e.modelValue === M.value }]),
2089
+ class: j(["segmented__item", { "is-active": e.modelValue === $.value }]),
2000
2090
  role: "radio",
2001
- "aria-checked": e.modelValue === M.value,
2002
- disabled: M.disabled,
2003
- onClick: (O) => c(M)
2091
+ "aria-checked": e.modelValue === $.value,
2092
+ disabled: $.disabled,
2093
+ onClick: (D) => _($)
2004
2094
  }, [
2005
- C("span", Yn, B(M.label), 1),
2006
- w(M) ? (d(), y("span", qn, B(F(M)), 1)) : V("", !0)
2007
- ], 10, Wn))), 128))
2095
+ b("span", Jn, T($.label), 1),
2096
+ C($) ? (d(), m("span", Xn, T(L($)), 1)) : V("", !0)
2097
+ ], 10, Gn))), 128))
2008
2098
  ], 512));
2009
2099
  }
2010
- }, Xn = /* @__PURE__ */ ae(Gn, [["__scopeId", "data-v-b7b0abe9"]]);
2011
- function Jn(e) {
2100
+ }, Zn = /* @__PURE__ */ Z(Qn, [["__scopeId", "data-v-b7b0abe9"]]);
2101
+ function el(e) {
2012
2102
  return e == null || e === "" ? [] : Array.isArray(e) ? e.map((t) => String(t).trim()).filter(Boolean) : String(e).split(",").map((t) => t.trim()).filter(Boolean);
2013
2103
  }
2014
- function Qn(e) {
2104
+ function tl(e) {
2015
2105
  if (!e.parentNode) {
2016
2106
  e.style.display = "none";
2017
2107
  return;
2018
2108
  }
2019
2109
  if ((typeof e.className == "string" ? e.className : "").includes("el-tab-pane") && e.id) {
2020
- const n = e.id.split("-")[1], a = n ? document.getElementById(`tab-${n}`) : null;
2021
- a && (a.style.display = "none");
2110
+ const n = e.id.split("-")[1], l = n ? document.getElementById(`tab-${n}`) : null;
2111
+ l && (l.style.display = "none");
2022
2112
  }
2023
2113
  e.parentNode.removeChild(e);
2024
2114
  }
2025
- function Ue(e, t, n, a = !1) {
2026
- const l = Jn(t.value);
2027
- if (!l.length) return;
2028
- let i = Ke(l, n);
2029
- a && (i = !i), i || Qn(e);
2115
+ function Le(e, t, n, l = !1) {
2116
+ const r = el(t.value);
2117
+ if (!r.length) return;
2118
+ let a = Qe(r, n);
2119
+ l && (a = !a), a || tl(e);
2030
2120
  }
2031
- function Zn(e) {
2121
+ function nl(e) {
2032
2122
  e.directive("hasPermission", {
2033
2123
  mounted(t, n) {
2034
- Ue(t, n, "and");
2124
+ Le(t, n, "and");
2035
2125
  }
2036
2126
  }), e.directive("hasAnyPermission", {
2037
2127
  mounted(t, n) {
2038
- Ue(t, n, "or");
2128
+ Le(t, n, "or");
2039
2129
  }
2040
2130
  }), e.directive("hasNoPermission", {
2041
2131
  mounted(t, n) {
2042
- Ue(t, n, "or", !0);
2132
+ Le(t, n, "or", !0);
2043
2133
  }
2044
2134
  });
2045
2135
  }
2046
- const el = {
2047
- MgImageUpload: Zt,
2048
- MgFileUpload: vn,
2049
- MgFilePreview: _t,
2050
- MgSearchForm: Ln,
2051
- MgDataTable: Kn,
2052
- MgDateRangePicker: Ze,
2053
- MgSegmentedControl: Xn,
2054
- MgOverflowHid: et
2055
- }, tl = (e, t = {}) => {
2056
- Object.entries(el).forEach(([l, i]) => {
2057
- e.component(i.name || l, i);
2058
- }), t.ossUrl && Lt(t.ossUrl), typeof t.getPermissions == "function" && wt(t.getPermissions), Zn(e);
2059
- const n = Ct(t), a = kt(n);
2060
- Ut(n), St(a), e.config.globalProperties.$request = n, e.config.globalProperties.$api = a, e.config.globalProperties.$hasPermission = Ke;
2061
- }, il = {
2062
- install: tl,
2136
+ const ll = {
2137
+ MgImageUpload: Jt,
2138
+ MgFileUpload: mn,
2139
+ MgFilePreview: xt,
2140
+ MgOssImg: wn,
2141
+ MgSearchForm: Rn,
2142
+ MgDataTable: qn,
2143
+ MgDateRangePicker: et,
2144
+ MgSegmentedControl: Zn,
2145
+ MgOverflowHid: tt
2146
+ }, rl = (e, t = {}) => {
2147
+ Object.entries(ll).forEach(([r, a]) => {
2148
+ e.component(a.name || r, a);
2149
+ }), t.ossUrl && St(t.ossUrl), typeof t.getPermissions == "function" && kt(t.getPermissions), nl(e);
2150
+ const n = Ut(t), l = Ct(n);
2151
+ Ft(n), Lt(l), e.config.globalProperties.$request = n, e.config.globalProperties.$api = l, e.config.globalProperties.$hasPermission = Qe;
2152
+ }, cl = {
2153
+ install: rl,
2063
2154
  version: "1.2.2"
2064
2155
  };
2065
2156
  export {
2066
- Kn as DataTable,
2067
- Ze as DateRangePicker,
2068
- cl as FILE_PREVIEW_ROUTE_PATH,
2069
- _t as FilePreview,
2070
- vn as FileUpload,
2071
- Zt as ImageUpload,
2072
- Ln as SearchForm,
2073
- Xn as SegmentedControl,
2074
- et as TableOverflowHid,
2075
- Je as aliOssMixin,
2076
- dl as buildFilePreviewHref,
2077
- pl as checkPermission,
2078
- kt as createApi,
2079
- Fe as createOssClient,
2080
- Ct as createRequest,
2081
- fl as createService,
2082
- il as default,
2083
- gt as getApi,
2084
- Ge as getOssSts,
2085
- hl as getPermissionGetter,
2086
- ml as getRequest,
2087
- gl as getSystemId,
2088
- yl as getUserId,
2089
- Ke as hasPermission,
2090
- tl as install,
2091
- Zn as installPermissionDirectives,
2092
- yt as openFilePreview,
2093
- St as setApi,
2094
- Lt as setDefaultOssUrl,
2095
- wt as setPermissionGetter,
2096
- Ut as setRequest,
2097
- vl as setSystemId,
2098
- bl as setUserId,
2099
- Xe as uploadToOss,
2100
- _l as utils
2157
+ qn as DataTable,
2158
+ et as DateRangePicker,
2159
+ fl as FILE_PREVIEW_ROUTE_PATH,
2160
+ xt as FilePreview,
2161
+ mn as FileUpload,
2162
+ Jt as ImageUpload,
2163
+ wn as OssImg,
2164
+ Rn as SearchForm,
2165
+ Zn as SegmentedControl,
2166
+ tt as TableOverflowHid,
2167
+ qe as aliOssMixin,
2168
+ Je as batchSign,
2169
+ hl as batchSignOss,
2170
+ gl as buildFilePreviewHref,
2171
+ ml as checkPermission,
2172
+ Ct as createApi,
2173
+ vl as createOssClient,
2174
+ yl as createOssResign,
2175
+ Ut as createRequest,
2176
+ bl as createService,
2177
+ cl as default,
2178
+ ce as extractObjectKey,
2179
+ _l as getApi,
2180
+ wl as getOssSts,
2181
+ xl as getPermissionGetter,
2182
+ Sl as getRequest,
2183
+ kl as getSystemId,
2184
+ Ul as getUploadSign,
2185
+ Cl as getUserId,
2186
+ Qe as hasPermission,
2187
+ rl as install,
2188
+ nl as installPermissionDirectives,
2189
+ bt as isExpiringSoon,
2190
+ E as isHttpUrl,
2191
+ vt as isSignedUrl,
2192
+ Fl as normalizeAttachFile,
2193
+ Ll as openFilePreview,
2194
+ yt as openOssFile,
2195
+ se as parseExpireAtFromUrl,
2196
+ Nl as resolveUploadPreviewUrl,
2197
+ Lt as setApi,
2198
+ St as setDefaultOssUrl,
2199
+ kt as setPermissionGetter,
2200
+ Ft as setRequest,
2201
+ Al as setSystemId,
2202
+ Rl as setUserId,
2203
+ _e as toOssSaveFile,
2204
+ Ve as toOssSaveFiles,
2205
+ be as toOssSaveUrl,
2206
+ Ge as uploadToOss,
2207
+ $l as utils
2101
2208
  };