@xto/business 1.0.3 → 1.1.1

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.
package/es/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { defineComponent as N, ref as R, computed as L, openBlock as c, createElementBlock as d, normalizeClass as a, unref as t, createVNode as H, withCtx as E, Fragment as W, renderList as M, createBlock as I, withKeys as Q, createCommentVNode as B, createTextVNode as P, createElementVNode as u, renderSlot as K, toDisplayString as S, normalizeStyle as j, reactive as Y, withDirectives as D, vModelSelect as Z, watch as _, vShow as G, nextTick as ee } from "vue";
2
- import { useNamespace as F } from "@xto/core";
3
- import { Space as A, Button as q } from "@xto/base";
4
- import { Input as X } from "@xto/form";
5
- import { Pagination as te } from "@xto/data";
6
- const le = ["colspan"], ae = ["colspan"], ne = ["value"], ye = /* @__PURE__ */ N({
1
+ import { defineComponent as I, ref as q, computed as B, openBlock as o, createElementBlock as c, normalizeClass as s, unref as a, createVNode as M, withCtx as U, Fragment as E, renderList as z, createBlock as X, withKeys as J, createCommentVNode as x, createTextVNode as j, createElementVNode as e, renderSlot as F, toDisplayString as h, normalizeStyle as H, reactive as ee, withDirectives as K, vModelSelect as te, watch as Q, vShow as G, nextTick as Z, withModifiers as _, vModelText as le } from "vue";
2
+ import { useNamespace as A } from "@xto/core";
3
+ import { Space as O, Button as W } from "@xto/base";
4
+ import { Input as D } from "@xto/form";
5
+ import { Pagination as ae } from "@xto/data";
6
+ const se = ["colspan"], ne = ["colspan"], oe = ["value"], dt = /* @__PURE__ */ I({
7
7
  name: "XProTable",
8
8
  __name: "index",
9
9
  props: {
@@ -19,162 +19,162 @@ const le = ["colspan"], ae = ["colspan"], ne = ["value"], ye = /* @__PURE__ */ N
19
19
  indexLabel: { default: "#" }
20
20
  },
21
21
  emits: ["update:data", "update:currentPage", "update:pageSize", "search", "refresh", "reset"],
22
- setup(e, { emit: p }) {
23
- const o = e, n = p, l = F("pro-table"), s = R({});
24
- R([]), L({
25
- get: () => o.data,
26
- set: (i) => n("update:data", i)
22
+ setup(t, { emit: v }) {
23
+ const n = t, u = v, l = A("pro-table"), i = q({});
24
+ q([]), B({
25
+ get: () => n.data,
26
+ set: (r) => u("update:data", r)
27
27
  });
28
- const $ = (i) => {
29
- n("update:currentPage", i), n("search", { ...s.value, page: i });
30
- }, g = (i) => {
31
- n("update:pageSize", i), n("search", { ...s.value, pageSize: i });
32
- }, x = () => {
33
- n("search", s.value);
34
- }, v = () => {
35
- s.value = {}, n("reset"), n("search", {});
28
+ const $ = (r) => {
29
+ u("update:currentPage", r), u("search", { ...i.value, page: r });
30
+ }, b = (r) => {
31
+ u("update:pageSize", r), u("search", { ...i.value, pageSize: r });
32
+ }, T = () => {
33
+ u("search", i.value);
34
+ }, g = () => {
35
+ i.value = {}, u("reset"), u("search", {});
36
36
  }, y = () => {
37
- n("refresh");
38
- }, r = L(
39
- () => o.columns.filter((i) => i.search)
37
+ u("refresh");
38
+ }, d = B(
39
+ () => n.columns.filter((r) => r.search)
40
40
  );
41
- return (i, f) => (c(), d("div", {
42
- class: a(t(l).b())
41
+ return (r, m) => (o(), c("div", {
42
+ class: s(a(l).b())
43
43
  }, [
44
- r.value.length > 0 ? (c(), d("div", {
44
+ d.value.length > 0 ? (o(), c("div", {
45
45
  key: 0,
46
- class: a(t(l).e("search"))
46
+ class: s(a(l).e("search"))
47
47
  }, [
48
- H(t(A), null, {
49
- default: E(() => [
50
- (c(!0), d(W, null, M(r.value, (h) => (c(), d(W, {
51
- key: h.prop
48
+ M(a(O), null, {
49
+ default: U(() => [
50
+ (o(!0), c(E, null, z(d.value, (p) => (o(), c(E, {
51
+ key: p.prop
52
52
  }, [
53
- h.searchType === "input" || !h.searchType ? (c(), I(t(X), {
53
+ p.searchType === "input" || !p.searchType ? (o(), X(a(D), {
54
54
  key: 0,
55
- modelValue: s.value[h.prop],
56
- "onUpdate:modelValue": (b) => s.value[h.prop] = b,
57
- placeholder: `请输入${h.label}`,
55
+ modelValue: i.value[p.prop],
56
+ "onUpdate:modelValue": (V) => i.value[p.prop] = V,
57
+ placeholder: `请输入${p.label}`,
58
58
  clearable: "",
59
- onKeyup: Q(x, ["enter"])
60
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : B("", !0)
59
+ onKeyup: J(T, ["enter"])
60
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : x("", !0)
61
61
  ], 64))), 128)),
62
- H(t(q), {
62
+ M(a(W), {
63
63
  type: "primary",
64
- onClick: x
64
+ onClick: T
65
65
  }, {
66
- default: E(() => [...f[0] || (f[0] = [
67
- P("搜索", -1)
66
+ default: U(() => [...m[0] || (m[0] = [
67
+ j("搜索", -1)
68
68
  ])]),
69
69
  _: 1
70
70
  }),
71
- H(t(q), { onClick: v }, {
72
- default: E(() => [...f[1] || (f[1] = [
73
- P("重置", -1)
71
+ M(a(W), { onClick: g }, {
72
+ default: U(() => [...m[1] || (m[1] = [
73
+ j("重置", -1)
74
74
  ])]),
75
75
  _: 1
76
76
  }),
77
- H(t(q), { onClick: y }, {
78
- default: E(() => [...f[2] || (f[2] = [
79
- P("刷新", -1)
77
+ M(a(W), { onClick: y }, {
78
+ default: U(() => [...m[2] || (m[2] = [
79
+ j("刷新", -1)
80
80
  ])]),
81
81
  _: 1
82
82
  })
83
83
  ]),
84
84
  _: 1
85
85
  })
86
- ], 2)) : B("", !0),
87
- u("div", {
88
- class: a(t(l).e("toolbar"))
86
+ ], 2)) : x("", !0),
87
+ e("div", {
88
+ class: s(a(l).e("toolbar"))
89
89
  }, [
90
- H(t(A), null, {
91
- default: E(() => [
92
- K(i.$slots, "toolbar")
90
+ M(a(O), null, {
91
+ default: U(() => [
92
+ F(r.$slots, "toolbar")
93
93
  ]),
94
94
  _: 3
95
95
  })
96
96
  ], 2),
97
- u("div", {
98
- class: a(t(l).e("table-wrapper"))
97
+ e("div", {
98
+ class: s(a(l).e("table-wrapper"))
99
99
  }, [
100
- u("table", {
101
- class: a(t(l).e("table"))
100
+ e("table", {
101
+ class: s(a(l).e("table"))
102
102
  }, [
103
- u("thead", null, [
104
- u("tr", null, [
105
- e.selection ? (c(), d("th", {
103
+ e("thead", null, [
104
+ e("tr", null, [
105
+ t.selection ? (o(), c("th", {
106
106
  key: 0,
107
- class: a(t(l).e("selection"))
108
- }, [...f[3] || (f[3] = [
109
- u("input", { type: "checkbox" }, null, -1)
110
- ])], 2)) : B("", !0),
111
- e.index ? (c(), d("th", {
107
+ class: s(a(l).e("selection"))
108
+ }, [...m[3] || (m[3] = [
109
+ e("input", { type: "checkbox" }, null, -1)
110
+ ])], 2)) : x("", !0),
111
+ t.index ? (o(), c("th", {
112
112
  key: 1,
113
- class: a(t(l).e("index"))
114
- }, S(e.indexLabel), 3)) : B("", !0),
115
- (c(!0), d(W, null, M(e.columns, (h) => (c(), d("th", {
116
- key: h.prop,
117
- class: a(t(l).e("column")),
118
- style: j({
119
- width: h.width,
120
- minWidth: h.minWidth,
121
- textAlign: h.align || "left"
113
+ class: s(a(l).e("index"))
114
+ }, h(t.indexLabel), 3)) : x("", !0),
115
+ (o(!0), c(E, null, z(t.columns, (p) => (o(), c("th", {
116
+ key: p.prop,
117
+ class: s(a(l).e("column")),
118
+ style: H({
119
+ width: p.width,
120
+ minWidth: p.minWidth,
121
+ textAlign: p.align || "left"
122
122
  })
123
- }, S(h.label), 7))), 128))
123
+ }, h(p.label), 7))), 128))
124
124
  ])
125
125
  ]),
126
- u("tbody", null, [
127
- e.loading ? (c(), d("tr", {
126
+ e("tbody", null, [
127
+ t.loading ? (o(), c("tr", {
128
128
  key: 0,
129
- class: a(t(l).e("loading-row"))
129
+ class: s(a(l).e("loading-row"))
130
130
  }, [
131
- u("td", {
132
- colspan: e.columns.length + (e.selection ? 1 : 0) + (e.index ? 1 : 0)
131
+ e("td", {
132
+ colspan: t.columns.length + (t.selection ? 1 : 0) + (t.index ? 1 : 0)
133
133
  }, [
134
- u("div", {
135
- class: a(t(l).e("loading"))
134
+ e("div", {
135
+ class: s(a(l).e("loading"))
136
136
  }, " 加载中... ", 2)
137
- ], 8, le)
138
- ], 2)) : e.data.length === 0 ? (c(), d("tr", {
137
+ ], 8, se)
138
+ ], 2)) : t.data.length === 0 ? (o(), c("tr", {
139
139
  key: 1,
140
- class: a(t(l).e("empty-row"))
140
+ class: s(a(l).e("empty-row"))
141
141
  }, [
142
- u("td", {
143
- colspan: e.columns.length + (e.selection ? 1 : 0) + (e.index ? 1 : 0)
142
+ e("td", {
143
+ colspan: t.columns.length + (t.selection ? 1 : 0) + (t.index ? 1 : 0)
144
144
  }, [
145
- u("div", {
146
- class: a(t(l).e("empty"))
145
+ e("div", {
146
+ class: s(a(l).e("empty"))
147
147
  }, " 暂无数据 ", 2)
148
- ], 8, ae)
149
- ], 2)) : (c(!0), d(W, { key: 2 }, M(e.data, (h, b) => (c(), d("tr", {
150
- key: b,
151
- class: a(t(l).e("row"))
148
+ ], 8, ne)
149
+ ], 2)) : (o(!0), c(E, { key: 2 }, z(t.data, (p, V) => (o(), c("tr", {
150
+ key: V,
151
+ class: s(a(l).e("row"))
152
152
  }, [
153
- e.selection ? (c(), d("td", {
153
+ t.selection ? (o(), c("td", {
154
154
  key: 0,
155
- class: a(t(l).e("selection"))
155
+ class: s(a(l).e("selection"))
156
156
  }, [
157
- u("input", {
157
+ e("input", {
158
158
  type: "checkbox",
159
- value: h
160
- }, null, 8, ne)
161
- ], 2)) : B("", !0),
162
- e.index ? (c(), d("td", {
159
+ value: p
160
+ }, null, 8, oe)
161
+ ], 2)) : x("", !0),
162
+ t.index ? (o(), c("td", {
163
163
  key: 1,
164
- class: a(t(l).e("index"))
165
- }, S((e.currentPage - 1) * e.pageSize + b + 1), 3)) : B("", !0),
166
- (c(!0), d(W, null, M(e.columns, (C) => {
167
- var V;
168
- return c(), d("td", {
169
- key: C.prop,
170
- class: a(t(l).e("cell")),
171
- style: j({ textAlign: C.align || "left" })
164
+ class: s(a(l).e("index"))
165
+ }, h((t.currentPage - 1) * t.pageSize + V + 1), 3)) : x("", !0),
166
+ (o(!0), c(E, null, z(t.columns, (w) => {
167
+ var C;
168
+ return o(), c("td", {
169
+ key: w.prop,
170
+ class: s(a(l).e("cell")),
171
+ style: H({ textAlign: w.align || "left" })
172
172
  }, [
173
- K(i.$slots, (V = C.slots) == null ? void 0 : V.default, {
174
- row: h,
175
- column: C
173
+ F(r.$slots, (C = w.slots) == null ? void 0 : C.default, {
174
+ row: p,
175
+ column: w
176
176
  }, () => [
177
- P(S(C.formatter ? C.formatter(h, C, h[C.prop]) : h[C.prop]), 1)
177
+ j(h(w.formatter ? w.formatter(p, w, p[w.prop]) : p[w.prop]), 1)
178
178
  ])
179
179
  ], 6);
180
180
  }), 128))
@@ -182,22 +182,22 @@ const le = ["colspan"], ae = ["colspan"], ne = ["value"], ye = /* @__PURE__ */ N
182
182
  ])
183
183
  ], 2)
184
184
  ], 2),
185
- e.pagination ? (c(), d("div", {
185
+ t.pagination ? (o(), c("div", {
186
186
  key: 1,
187
- class: a(t(l).e("pagination"))
187
+ class: s(a(l).e("pagination"))
188
188
  }, [
189
- H(t(te), {
190
- total: e.total,
191
- "page-size": e.pageSize,
192
- "current-page": e.currentPage,
189
+ M(a(ae), {
190
+ total: t.total,
191
+ "page-size": t.pageSize,
192
+ "current-page": t.currentPage,
193
193
  layout: "total, sizes, prev, pager, next, jumper",
194
194
  onCurrentChange: $,
195
- onSizeChange: g
195
+ onSizeChange: b
196
196
  }, null, 8, ["total", "page-size", "current-page"])
197
- ], 2)) : B("", !0)
197
+ ], 2)) : x("", !0)
198
198
  ], 2));
199
199
  }
200
- }), se = ["onUpdate:modelValue"], oe = ["value"], be = /* @__PURE__ */ N({
200
+ }), ie = ["onUpdate:modelValue"], ce = ["value"], rt = /* @__PURE__ */ I({
201
201
  name: "XSearchForm",
202
202
  __name: "index",
203
203
  props: {
@@ -207,87 +207,87 @@ const le = ["colspan"], ae = ["colspan"], ne = ["value"], ye = /* @__PURE__ */ N
207
207
  labelPosition: { default: "right" }
208
208
  },
209
209
  emits: ["search", "reset"],
210
- setup(e, { emit: p }) {
211
- const o = e, n = p, l = F("search-form"), s = Y({});
212
- o.columns.forEach((v) => {
213
- v.defaultValue !== void 0 ? s[v.prop] = v.defaultValue : o.model[v.prop] !== void 0 && (s[v.prop] = o.model[v.prop]);
210
+ setup(t, { emit: v }) {
211
+ const n = t, u = v, l = A("search-form"), i = ee({});
212
+ n.columns.forEach((g) => {
213
+ g.defaultValue !== void 0 ? i[g.prop] = g.defaultValue : n.model[g.prop] !== void 0 && (i[g.prop] = n.model[g.prop]);
214
214
  });
215
215
  const $ = () => {
216
- n("search", { ...s });
217
- }, g = () => {
218
- o.columns.forEach((v) => {
219
- s[v.prop] = v.defaultValue;
220
- }), n("reset");
221
- }, x = L(() => ({
222
- width: typeof o.labelWidth == "number" ? `${o.labelWidth}px` : o.labelWidth
216
+ u("search", { ...i });
217
+ }, b = () => {
218
+ n.columns.forEach((g) => {
219
+ i[g.prop] = g.defaultValue;
220
+ }), u("reset");
221
+ }, T = B(() => ({
222
+ width: typeof n.labelWidth == "number" ? `${n.labelWidth}px` : n.labelWidth
223
223
  }));
224
- return (v, y) => (c(), d("div", {
225
- class: a(t(l).b())
224
+ return (g, y) => (o(), c("div", {
225
+ class: s(a(l).b())
226
226
  }, [
227
- u("div", {
228
- class: a(t(l).e("items"))
227
+ e("div", {
228
+ class: s(a(l).e("items"))
229
229
  }, [
230
- (c(!0), d(W, null, M(e.columns, (r) => (c(), d("div", {
231
- key: r.prop,
232
- class: a(t(l).e("item"))
230
+ (o(!0), c(E, null, z(t.columns, (d) => (o(), c("div", {
231
+ key: d.prop,
232
+ class: s(a(l).e("item"))
233
233
  }, [
234
- u("label", {
235
- class: a(t(l).e("label")),
236
- style: j(x.value)
237
- }, S(r.label), 7),
238
- u("div", {
239
- class: a(t(l).e("content"))
234
+ e("label", {
235
+ class: s(a(l).e("label")),
236
+ style: H(T.value)
237
+ }, h(d.label), 7),
238
+ e("div", {
239
+ class: s(a(l).e("content"))
240
240
  }, [
241
- r.type === "input" || !r.type ? (c(), I(t(X), {
241
+ d.type === "input" || !d.type ? (o(), X(a(D), {
242
242
  key: 0,
243
- modelValue: s[r.prop],
244
- "onUpdate:modelValue": (i) => s[r.prop] = i,
245
- placeholder: r.placeholder || `请输入${r.label}`,
243
+ modelValue: i[d.prop],
244
+ "onUpdate:modelValue": (r) => i[d.prop] = r,
245
+ placeholder: d.placeholder || `请输入${d.label}`,
246
246
  clearable: ""
247
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : r.type === "select" ? D((c(), d("select", {
247
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : d.type === "select" ? K((o(), c("select", {
248
248
  key: 1,
249
- "onUpdate:modelValue": (i) => s[r.prop] = i,
250
- class: a(t(l).e("select"))
249
+ "onUpdate:modelValue": (r) => i[d.prop] = r,
250
+ class: s(a(l).e("select"))
251
251
  }, [
252
- y[0] || (y[0] = u("option", { value: "" }, "请选择", -1)),
253
- (c(!0), d(W, null, M(r.options, (i) => (c(), d("option", {
254
- key: i.value,
255
- value: i.value
256
- }, S(i.label), 9, oe))), 128))
257
- ], 10, se)), [
258
- [Z, s[r.prop]]
259
- ]) : r.type === "date" ? (c(), I(t(X), {
252
+ y[0] || (y[0] = e("option", { value: "" }, "请选择", -1)),
253
+ (o(!0), c(E, null, z(d.options, (r) => (o(), c("option", {
254
+ key: r.value,
255
+ value: r.value
256
+ }, h(r.label), 9, ce))), 128))
257
+ ], 10, ie)), [
258
+ [te, i[d.prop]]
259
+ ]) : d.type === "date" ? (o(), X(a(D), {
260
260
  key: 2,
261
- modelValue: s[r.prop],
262
- "onUpdate:modelValue": (i) => s[r.prop] = i,
261
+ modelValue: i[d.prop],
262
+ "onUpdate:modelValue": (r) => i[d.prop] = r,
263
263
  type: "date",
264
- placeholder: r.placeholder || `请选择${r.label}`
265
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : (c(), I(t(X), {
264
+ placeholder: d.placeholder || `请选择${d.label}`
265
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : (o(), X(a(D), {
266
266
  key: 3,
267
- modelValue: s[r.prop],
268
- "onUpdate:modelValue": (i) => s[r.prop] = i,
269
- placeholder: r.placeholder || `请输入${r.label}`
267
+ modelValue: i[d.prop],
268
+ "onUpdate:modelValue": (r) => i[d.prop] = r,
269
+ placeholder: d.placeholder || `请输入${d.label}`
270
270
  }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"]))
271
271
  ], 2)
272
272
  ], 2))), 128))
273
273
  ], 2),
274
- u("div", {
275
- class: a(t(l).e("actions"))
274
+ e("div", {
275
+ class: s(a(l).e("actions"))
276
276
  }, [
277
- H(t(A), null, {
278
- default: E(() => [
279
- H(t(q), {
277
+ M(a(O), null, {
278
+ default: U(() => [
279
+ M(a(W), {
280
280
  type: "primary",
281
281
  onClick: $
282
282
  }, {
283
- default: E(() => [...y[1] || (y[1] = [
284
- P("搜索", -1)
283
+ default: U(() => [...y[1] || (y[1] = [
284
+ j("搜索", -1)
285
285
  ])]),
286
286
  _: 1
287
287
  }),
288
- H(t(q), { onClick: g }, {
289
- default: E(() => [...y[2] || (y[2] = [
290
- P("重置", -1)
288
+ M(a(W), { onClick: b }, {
289
+ default: U(() => [...y[2] || (y[2] = [
290
+ j("重置", -1)
291
291
  ])]),
292
292
  _: 1
293
293
  })
@@ -297,7 +297,7 @@ const le = ["colspan"], ae = ["colspan"], ne = ["value"], ye = /* @__PURE__ */ N
297
297
  ], 2)
298
298
  ], 2));
299
299
  }
300
- }), ke = /* @__PURE__ */ N({
300
+ }), ut = /* @__PURE__ */ I({
301
301
  name: "XStatistic",
302
302
  __name: "index",
303
303
  props: {
@@ -312,48 +312,48 @@ const le = ["colspan"], ae = ["colspan"], ne = ["value"], ye = /* @__PURE__ */ N
312
312
  titleColor: {},
313
313
  valueColor: {}
314
314
  },
315
- setup(e) {
316
- const p = e, o = F("statistic"), n = L(() => typeof p.value == "number" ? p.value.toFixed(p.precision) : p.value), l = L(() => [
317
- o.e("trend"),
318
- o.em("trend", p.trend)
319
- ]), s = L(() => p.trend === "up" ? "↑" : p.trend === "down" ? "↓" : "");
320
- return ($, g) => (c(), d("div", {
321
- class: a(t(o).b())
315
+ setup(t) {
316
+ const v = t, n = A("statistic"), u = B(() => typeof v.value == "number" ? v.value.toFixed(v.precision) : v.value), l = B(() => [
317
+ n.e("trend"),
318
+ n.em("trend", v.trend)
319
+ ]), i = B(() => v.trend === "up" ? "↑" : v.trend === "down" ? "↓" : "");
320
+ return ($, b) => (o(), c("div", {
321
+ class: s(a(n).b())
322
322
  }, [
323
- u("div", {
324
- class: a(t(o).e("title")),
325
- style: j({ color: e.titleColor })
326
- }, S(e.title), 7),
327
- u("div", {
328
- class: a(t(o).e("content"))
323
+ e("div", {
324
+ class: s(a(n).e("title")),
325
+ style: H({ color: t.titleColor })
326
+ }, h(t.title), 7),
327
+ e("div", {
328
+ class: s(a(n).e("content"))
329
329
  }, [
330
- e.prefix ? (c(), d("span", {
330
+ t.prefix ? (o(), c("span", {
331
331
  key: 0,
332
- class: a(t(o).e("prefix"))
333
- }, S(e.prefix), 3)) : B("", !0),
334
- u("span", {
335
- class: a(t(o).e("value")),
336
- style: j({ color: e.valueColor })
337
- }, S(n.value), 7),
338
- e.suffix ? (c(), d("span", {
332
+ class: s(a(n).e("prefix"))
333
+ }, h(t.prefix), 3)) : x("", !0),
334
+ e("span", {
335
+ class: s(a(n).e("value")),
336
+ style: H({ color: t.valueColor })
337
+ }, h(u.value), 7),
338
+ t.suffix ? (o(), c("span", {
339
339
  key: 1,
340
- class: a(t(o).e("suffix"))
341
- }, S(e.suffix), 3)) : B("", !0)
340
+ class: s(a(n).e("suffix"))
341
+ }, h(t.suffix), 3)) : x("", !0)
342
342
  ], 2),
343
- e.trend ? (c(), d("div", {
343
+ t.trend ? (o(), c("div", {
344
344
  key: 0,
345
- class: a(l.value)
345
+ class: s(l.value)
346
346
  }, [
347
- u("span", {
348
- class: a(t(o).e("trend-icon"))
349
- }, S(s.value), 3),
350
- u("span", {
351
- class: a(t(o).e("trend-value"))
352
- }, S(e.trendValue), 3)
353
- ], 2)) : B("", !0)
347
+ e("span", {
348
+ class: s(a(n).e("trend-icon"))
349
+ }, h(i.value), 3),
350
+ e("span", {
351
+ class: s(a(n).e("trend-value"))
352
+ }, h(t.trendValue), 3)
353
+ ], 2)) : x("", !0)
354
354
  ], 2));
355
355
  }
356
- }), $e = /* @__PURE__ */ N({
356
+ }), pt = /* @__PURE__ */ I({
357
357
  name: "XExport",
358
358
  __name: "index",
359
359
  props: {
@@ -362,146 +362,146 @@ const le = ["colspan"], ae = ["colspan"], ne = ["value"], ye = /* @__PURE__ */ N
362
362
  sheetName: { default: "Sheet1" },
363
363
  columns: { default: () => [] }
364
364
  },
365
- setup(e) {
366
- const p = e, o = R(!1), n = () => {
367
- if (p.data.length !== 0) {
368
- o.value = !0;
365
+ setup(t) {
366
+ const v = t, n = q(!1), u = () => {
367
+ if (v.data.length !== 0) {
368
+ n.value = !0;
369
369
  try {
370
- const l = p.columns.length > 0 ? p.columns.map((y) => y.title) : Object.keys(p.data[0]), s = p.columns.length > 0 ? p.columns.map((y) => y.key) : Object.keys(p.data[0]), $ = [
370
+ const l = v.columns.length > 0 ? v.columns.map((y) => y.title) : Object.keys(v.data[0]), i = v.columns.length > 0 ? v.columns.map((y) => y.key) : Object.keys(v.data[0]), $ = [
371
371
  l.join(","),
372
- ...p.data.map(
373
- (y) => s.map((r) => {
374
- const i = y[r];
375
- return typeof i == "string" && (i.includes(",") || i.includes('"')) ? `"${i.replace(/"/g, '""')}"` : i;
372
+ ...v.data.map(
373
+ (y) => i.map((d) => {
374
+ const r = y[d];
375
+ return typeof r == "string" && (r.includes(",") || r.includes('"')) ? `"${r.replace(/"/g, '""')}"` : r;
376
376
  }).join(",")
377
377
  )
378
378
  ].join(`
379
- `), g = new Blob([$], { type: "text/csv;charset=utf-8;" }), x = URL.createObjectURL(g), v = document.createElement("a");
380
- v.href = x, v.download = `${p.filename}.csv`, document.body.appendChild(v), v.click(), document.body.removeChild(v), URL.revokeObjectURL(x);
379
+ `), b = new Blob([$], { type: "text/csv;charset=utf-8;" }), T = URL.createObjectURL(b), g = document.createElement("a");
380
+ g.href = T, g.download = `${v.filename}.csv`, document.body.appendChild(g), g.click(), document.body.removeChild(g), URL.revokeObjectURL(T);
381
381
  } catch (l) {
382
382
  console.error("Export failed:", l);
383
383
  } finally {
384
- o.value = !1;
384
+ n.value = !1;
385
385
  }
386
386
  }
387
387
  };
388
- return (l, s) => (c(), I(t(q), {
389
- loading: o.value,
390
- onClick: n
388
+ return (l, i) => (o(), X(a(W), {
389
+ loading: n.value,
390
+ onClick: u
391
391
  }, {
392
- default: E(() => [...s[0] || (s[0] = [
393
- P("导出", -1)
392
+ default: U(() => [...i[0] || (i[0] = [
393
+ j("导出", -1)
394
394
  ])]),
395
- icon: E(() => [...s[1] || (s[1] = [
396
- P("📥", -1)
395
+ icon: U(() => [...i[1] || (i[1] = [
396
+ j("📥", -1)
397
397
  ])]),
398
398
  _: 1
399
399
  }, 8, ["loading"]));
400
400
  }
401
401
  });
402
- function J(e) {
403
- const p = {
402
+ function Y(t) {
403
+ const v = {
404
404
  "&": "&",
405
405
  "<": "&lt;",
406
406
  ">": "&gt;",
407
407
  '"': "&quot;",
408
408
  "'": "&#039;"
409
409
  };
410
- return e.replace(/[&<>"']/g, (o) => p[o]);
410
+ return t.replace(/[&<>"']/g, (n) => v[n]);
411
411
  }
412
- function z(e) {
413
- return e = e.replace(/`([^`]+)`/g, '<code class="md-code">$1</code>'), e = e.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>"), e = e.replace(/__([^_]+)__/g, "<strong>$1</strong>"), e = e.replace(/\*([^*]+)\*/g, "<em>$1</em>"), e = e.replace(/_([^_]+)_/g, "<em>$1</em>"), e = e.replace(/~~([^~]+)~~/g, "<del>$1</del>"), e = e.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2" target="_blank" class="md-link">$1</a>'), e = e.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, '<img src="$2" alt="$1" class="md-image" />'), e;
412
+ function R(t) {
413
+ return t = t.replace(/`([^`]+)`/g, '<code class="md-code">$1</code>'), t = t.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>"), t = t.replace(/__([^_]+)__/g, "<strong>$1</strong>"), t = t.replace(/\*([^*]+)\*/g, "<em>$1</em>"), t = t.replace(/_([^_]+)_/g, "<em>$1</em>"), t = t.replace(/~~([^~]+)~~/g, "<del>$1</del>"), t = t.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2" target="_blank" class="md-link">$1</a>'), t = t.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, '<img src="$2" alt="$1" class="md-image" />'), t;
414
414
  }
415
- function ie(e, p = {}) {
416
- const o = e.split(`
417
- `), n = [];
418
- let l = !1, s = "", $ = [], g = !1, x = "", v = !1, y = !1;
419
- const r = () => {
420
- g && (n.push(`</${x}>`), g = !1, x = "");
421
- }, i = () => {
422
- v && (n.push("</blockquote>"), v = !1);
423
- }, f = () => {
424
- y && (n.push("</table>"), y = !1);
415
+ function de(t, v = {}) {
416
+ const n = t.split(`
417
+ `), u = [];
418
+ let l = !1, i = "", $ = [], b = !1, T = "", g = !1, y = !1;
419
+ const d = () => {
420
+ b && (u.push(`</${T}>`), b = !1, T = "");
421
+ }, r = () => {
422
+ g && (u.push("</blockquote>"), g = !1);
423
+ }, m = () => {
424
+ y && (u.push("</table>"), y = !1);
425
425
  };
426
- for (let h = 0; h < o.length; h++) {
427
- let b = o[h];
428
- if (b.startsWith("```")) {
429
- l ? (n.push(`<pre class="md-code-block"><code class="language-${s}">${J($.join(`
430
- `))}</code></pre>`), l = !1, s = "", $ = []) : (r(), i(), f(), l = !0, s = b.slice(3).trim(), $ = []);
426
+ for (let p = 0; p < n.length; p++) {
427
+ let V = n[p];
428
+ if (V.startsWith("```")) {
429
+ l ? (u.push(`<pre class="md-code-block"><code class="language-${i}">${Y($.join(`
430
+ `))}</code></pre>`), l = !1, i = "", $ = []) : (d(), r(), m(), l = !0, i = V.slice(3).trim(), $ = []);
431
431
  continue;
432
432
  }
433
433
  if (l) {
434
- $.push(b);
434
+ $.push(V);
435
435
  continue;
436
436
  }
437
- if (b.trim().startsWith("|") && b.trim().endsWith("|")) {
438
- y || (r(), i(), y = !0, n.push('<table class="md-table">'));
439
- const m = b.trim().slice(1, -1).split("|").map((T) => T.trim());
440
- if (m.every((T) => /^[-:]+$/.test(T)))
437
+ if (V.trim().startsWith("|") && V.trim().endsWith("|")) {
438
+ y || (d(), r(), y = !0, u.push('<table class="md-table">'));
439
+ const f = V.trim().slice(1, -1).split("|").map((P) => P.trim());
440
+ if (f.every((P) => /^[-:]+$/.test(P)))
441
441
  continue;
442
- if ((h === 0 || h > 0 && !o[h - 1].trim().startsWith("|")) && h < o.length - 1) {
443
- const T = o[h + 1];
444
- if (T && T.trim().startsWith("|") && T.trim().endsWith("|") && T.trim().slice(1, -1).split("|").map((U) => U.trim()).every((U) => /^[-:]+$/.test(U))) {
445
- n.push("<thead><tr>"), m.forEach((U) => {
446
- n.push(`<th>${z(U)}</th>`);
447
- }), n.push("</tr></thead><tbody>");
442
+ if ((p === 0 || p > 0 && !n[p - 1].trim().startsWith("|")) && p < n.length - 1) {
443
+ const P = n[p + 1];
444
+ if (P && P.trim().startsWith("|") && P.trim().endsWith("|") && P.trim().slice(1, -1).split("|").map((L) => L.trim()).every((L) => /^[-:]+$/.test(L))) {
445
+ u.push("<thead><tr>"), f.forEach((L) => {
446
+ u.push(`<th>${R(L)}</th>`);
447
+ }), u.push("</tr></thead><tbody>");
448
448
  continue;
449
449
  }
450
450
  }
451
- n.push("<tr>"), m.forEach((T) => {
452
- n.push(`<td>${z(T)}</td>`);
453
- }), n.push("</tr>");
451
+ u.push("<tr>"), f.forEach((P) => {
452
+ u.push(`<td>${R(P)}</td>`);
453
+ }), u.push("</tr>");
454
454
  continue;
455
- } else y && (n.push("</tbody>"), f());
456
- if (!b.trim()) {
457
- r(), i(), f();
455
+ } else y && (u.push("</tbody>"), m());
456
+ if (!V.trim()) {
457
+ d(), r(), m();
458
458
  continue;
459
459
  }
460
- if (b.startsWith(">")) {
461
- r(), v || (n.push('<blockquote class="md-blockquote">'), v = !0);
462
- const m = b.replace(/^>\s?/, "");
463
- n.push(`<p>${z(m)}</p>`);
460
+ if (V.startsWith(">")) {
461
+ d(), g || (u.push('<blockquote class="md-blockquote">'), g = !0);
462
+ const f = V.replace(/^>\s?/, "");
463
+ u.push(`<p>${R(f)}</p>`);
464
464
  continue;
465
- } else v && i();
466
- const C = b.match(/^(#{1,6})\s+(.+)$/);
467
- if (C) {
468
- r();
469
- const m = C[1].length, w = z(C[2]);
470
- n.push(`<h${m} class="md-heading md-h${m}">${w}</h${m}>`);
465
+ } else g && r();
466
+ const w = V.match(/^(#{1,6})\s+(.+)$/);
467
+ if (w) {
468
+ d();
469
+ const f = w[1].length, S = R(w[2]);
470
+ u.push(`<h${f} class="md-heading md-h${f}">${S}</h${f}>`);
471
471
  continue;
472
472
  }
473
- if (/^[-*_]{3,}$/.test(b.trim())) {
474
- r(), n.push('<hr class="md-hr" />');
473
+ if (/^[-*_]{3,}$/.test(V.trim())) {
474
+ d(), u.push('<hr class="md-hr" />');
475
475
  continue;
476
476
  }
477
- const V = b.match(/^[-*+]\s+(.+)$/);
478
- if (V) {
479
- (!g || x !== "ul") && (r(), n.push('<ul class="md-list">'), g = !0, x = "ul"), n.push(`<li>${z(V[1])}</li>`);
477
+ const C = V.match(/^[-*+]\s+(.+)$/);
478
+ if (C) {
479
+ (!b || T !== "ul") && (d(), u.push('<ul class="md-list">'), b = !0, T = "ul"), u.push(`<li>${R(C[1])}</li>`);
480
480
  continue;
481
481
  }
482
- const k = b.match(/^(\d+)\.\s+(.+)$/);
482
+ const k = V.match(/^(\d+)\.\s+(.+)$/);
483
483
  if (k) {
484
- (!g || x !== "ol") && (r(), n.push('<ol class="md-list">'), g = !0, x = "ol"), n.push(`<li>${z(k[2])}</li>`);
484
+ (!b || T !== "ol") && (d(), u.push('<ol class="md-list">'), b = !0, T = "ol"), u.push(`<li>${R(k[2])}</li>`);
485
485
  continue;
486
486
  }
487
- r(), p.breaks !== !1 ? n.push(`<p class="md-paragraph">${z(b)}</p>`) : n.push(`<p class="md-paragraph">${z(b)}</p>`);
487
+ d(), v.breaks !== !1 ? u.push(`<p class="md-paragraph">${R(V)}</p>`) : u.push(`<p class="md-paragraph">${R(V)}</p>`);
488
488
  }
489
- return r(), i(), f(), l && n.push(`<pre class="md-code-block"><code>${J($.join(`
490
- `))}</code></pre>`), n.join(`
489
+ return d(), r(), m(), l && u.push(`<pre class="md-code-block"><code>${Y($.join(`
490
+ `))}</code></pre>`), u.join(`
491
491
  `);
492
492
  }
493
- function re(e) {
494
- const p = [];
495
- return e.split(`
496
- `).forEach((n, l) => {
497
- const s = n.match(/^(#{1,6})\s+(.+)$/);
498
- if (s) {
499
- const $ = s[1].length, g = s[2].trim(), x = `heading-${l}`;
500
- p.push({ level: $, text: g, id: x });
493
+ function re(t) {
494
+ const v = [];
495
+ return t.split(`
496
+ `).forEach((u, l) => {
497
+ const i = u.match(/^(#{1,6})\s+(.+)$/);
498
+ if (i) {
499
+ const $ = i[1].length, b = i[2].trim(), T = `heading-${l}`;
500
+ v.push({ level: $, text: b, id: T });
501
501
  }
502
- }), p;
502
+ }), v;
503
503
  }
504
- const ce = ["title", "disabled", "onClick"], ue = { key: 0 }, de = ["value", "placeholder", "disabled"], pe = ["innerHTML"], xe = /* @__PURE__ */ N({
504
+ const ue = ["title", "disabled", "onClick"], pe = { key: 0 }, he = ["value", "placeholder", "disabled"], me = ["innerHTML"], ht = /* @__PURE__ */ I({
505
505
  name: "XMarkdownEditor",
506
506
  __name: "index",
507
507
  props: {
@@ -514,148 +514,769 @@ const ce = ["title", "disabled", "onClick"], ue = { key: 0 }, de = ["value", "pl
514
514
  disabled: { type: Boolean, default: !1 }
515
515
  },
516
516
  emits: ["update:modelValue", "change"],
517
- setup(e, { emit: p }) {
518
- const o = e, n = p, l = F("markdown-editor"), s = R(o.modelValue), $ = R(), g = R(o.mode), x = L(() => ie(s.value)), v = L(() => re(s.value)), y = L(() => ({
519
- height: typeof o.height == "number" ? `${o.height}px` : o.height
517
+ setup(t, { emit: v }) {
518
+ const n = t, u = v, l = A("markdown-editor"), i = q(n.modelValue), $ = q(), b = q(n.mode), T = B(() => de(i.value)), g = B(() => re(i.value)), y = B(() => ({
519
+ height: typeof n.height == "number" ? `${n.height}px` : n.height
520
520
  }));
521
- _(() => o.modelValue, (V) => {
522
- s.value = V;
521
+ Q(() => n.modelValue, (C) => {
522
+ i.value = C;
523
523
  });
524
- const r = (V) => {
525
- const k = V.target.value;
526
- s.value = k, n("update:modelValue", k), n("change", k);
527
- }, i = (V) => {
528
- g.value = V;
529
- }, f = (V, k = "") => {
530
- if (!$.value || o.disabled) return;
531
- const m = $.value, w = m.selectionStart, T = m.selectionEnd, O = s.value.substring(w, T), U = s.value.substring(0, w) + V + O + k + s.value.substring(T);
532
- s.value = U, n("update:modelValue", U), n("change", U), ee(() => {
533
- m.focus(), m.setSelectionRange(w + V.length, w + V.length + O.length);
524
+ const d = (C) => {
525
+ const k = C.target.value;
526
+ i.value = k, u("update:modelValue", k), u("change", k);
527
+ }, r = (C) => {
528
+ b.value = C;
529
+ }, m = (C, k = "") => {
530
+ if (!$.value || n.disabled) return;
531
+ const f = $.value, S = f.selectionStart, P = f.selectionEnd, N = i.value.substring(S, P), L = i.value.substring(0, S) + C + N + k + i.value.substring(P);
532
+ i.value = L, u("update:modelValue", L), u("change", L), Z(() => {
533
+ f.focus(), f.setSelectionRange(S + C.length, S + C.length + N.length);
534
534
  });
535
- }, h = [
536
- { icon: "H1", title: "标题1", action: () => f("# ", "") },
537
- { icon: "H2", title: "标题2", action: () => f("## ", "") },
538
- { icon: "H3", title: "标题3", action: () => f("### ", "") },
535
+ }, p = [
536
+ { icon: "H1", title: "标题1", action: () => m("# ", "") },
537
+ { icon: "H2", title: "标题2", action: () => m("## ", "") },
538
+ { icon: "H3", title: "标题3", action: () => m("### ", "") },
539
539
  { type: "divider" },
540
- { icon: "B", title: "粗体", action: () => f("**", "**") },
541
- { icon: "I", title: "斜体", action: () => f("*", "*") },
542
- { icon: "S", title: "删除线", action: () => f("~~", "~~") },
540
+ { icon: "B", title: "粗体", action: () => m("**", "**") },
541
+ { icon: "I", title: "斜体", action: () => m("*", "*") },
542
+ { icon: "S", title: "删除线", action: () => m("~~", "~~") },
543
543
  { type: "divider" },
544
- { icon: "•", title: "无序列表", action: () => f("- ", "") },
545
- { icon: "1.", title: "有序列表", action: () => f("1. ", "") },
544
+ { icon: "•", title: "无序列表", action: () => m("- ", "") },
545
+ { icon: "1.", title: "有序列表", action: () => m("1. ", "") },
546
546
  { type: "divider" },
547
- { icon: "🔗", title: "链接", action: () => f("[", "](url)") },
548
- { icon: "🖼", title: "图片", action: () => f("![alt](", ")") },
549
- { icon: "</>", title: "代码", action: () => f("`", "`") },
547
+ { icon: "🔗", title: "链接", action: () => m("[", "](url)") },
548
+ { icon: "🖼", title: "图片", action: () => m("![alt](", ")") },
549
+ { icon: "</>", title: "代码", action: () => m("`", "`") },
550
550
  { type: "divider" },
551
- { icon: "—", title: "分割线", action: () => f(`
551
+ { icon: "—", title: "分割线", action: () => m(`
552
552
  ---
553
553
  `, "") },
554
- { icon: "□", title: "引用", action: () => f("> ", "") },
555
- { icon: "```", title: "代码块", action: () => f("\n```\n", "\n```\n") }
556
- ], b = L(() => [
554
+ { icon: "□", title: "引用", action: () => m("> ", "") },
555
+ { icon: "```", title: "代码块", action: () => m("\n```\n", "\n```\n") }
556
+ ], V = B(() => [
557
557
  l.b(),
558
- l.is("disabled", o.disabled),
559
- l.is(`mode-${g.value}`)
560
- ]), C = (V) => {
561
- if (g.value !== "split") return;
558
+ l.is("disabled", n.disabled),
559
+ l.is(`mode-${b.value}`)
560
+ ]), w = (C) => {
561
+ if (b.value !== "split") return;
562
562
  const k = document.querySelector(".x-markdown-editor__preview");
563
563
  if (!k) return;
564
- const m = V.target, w = m.scrollTop / (m.scrollHeight - m.clientHeight);
565
- k.scrollTop = w * (k.scrollHeight - k.clientHeight);
564
+ const f = C.target, S = f.scrollTop / (f.scrollHeight - f.clientHeight);
565
+ k.scrollTop = S * (k.scrollHeight - k.clientHeight);
566
566
  };
567
- return (V, k) => (c(), d("div", {
568
- class: a(b.value),
569
- style: j(y.value)
567
+ return (C, k) => (o(), c("div", {
568
+ class: s(V.value),
569
+ style: H(y.value)
570
570
  }, [
571
- e.showToolbar ? (c(), d("div", {
571
+ t.showToolbar ? (o(), c("div", {
572
572
  key: 0,
573
- class: a(t(l).e("toolbar"))
573
+ class: s(a(l).e("toolbar"))
574
574
  }, [
575
- u("div", {
576
- class: a(t(l).e("toolbar-left"))
575
+ e("div", {
576
+ class: s(a(l).e("toolbar-left"))
577
577
  }, [
578
- (c(), d(W, null, M(h, (m, w) => u("button", {
579
- key: w,
580
- class: a([t(l).e("toolbar-btn"), { "is-divider": m.type === "divider" }]),
581
- title: m.title,
582
- disabled: e.disabled,
583
- onClick: m.action
578
+ (o(), c(E, null, z(p, (f, S) => e("button", {
579
+ key: S,
580
+ class: s([a(l).e("toolbar-btn"), { "is-divider": f.type === "divider" }]),
581
+ title: f.title,
582
+ disabled: t.disabled,
583
+ onClick: f.action
584
584
  }, [
585
- m.type ? B("", !0) : (c(), d("span", ue, S(m.icon), 1))
586
- ], 10, ce)), 64))
585
+ f.type ? x("", !0) : (o(), c("span", pe, h(f.icon), 1))
586
+ ], 10, ue)), 64))
587
587
  ], 2),
588
- u("div", {
589
- class: a(t(l).e("toolbar-right"))
588
+ e("div", {
589
+ class: s(a(l).e("toolbar-right"))
590
590
  }, [
591
- u("button", {
592
- class: a([t(l).e("mode-btn"), { "is-active": g.value === "edit" }]),
593
- onClick: k[0] || (k[0] = (m) => i("edit"))
591
+ e("button", {
592
+ class: s([a(l).e("mode-btn"), { "is-active": b.value === "edit" }]),
593
+ onClick: k[0] || (k[0] = (f) => r("edit"))
594
594
  }, " 编辑 ", 2),
595
- u("button", {
596
- class: a([t(l).e("mode-btn"), { "is-active": g.value === "split" }]),
597
- onClick: k[1] || (k[1] = (m) => i("split"))
595
+ e("button", {
596
+ class: s([a(l).e("mode-btn"), { "is-active": b.value === "split" }]),
597
+ onClick: k[1] || (k[1] = (f) => r("split"))
598
598
  }, " 分屏 ", 2),
599
- u("button", {
600
- class: a([t(l).e("mode-btn"), { "is-active": g.value === "preview" }]),
601
- onClick: k[2] || (k[2] = (m) => i("preview"))
599
+ e("button", {
600
+ class: s([a(l).e("mode-btn"), { "is-active": b.value === "preview" }]),
601
+ onClick: k[2] || (k[2] = (f) => r("preview"))
602
602
  }, " 预览 ", 2)
603
603
  ], 2)
604
- ], 2)) : B("", !0),
605
- u("div", {
606
- class: a(t(l).e("body"))
604
+ ], 2)) : x("", !0),
605
+ e("div", {
606
+ class: s(a(l).e("body"))
607
607
  }, [
608
- e.showToc && v.value.length > 0 ? (c(), d("div", {
608
+ t.showToc && g.value.length > 0 ? (o(), c("div", {
609
609
  key: 0,
610
- class: a(t(l).e("toc"))
610
+ class: s(a(l).e("toc"))
611
611
  }, [
612
- u("div", {
613
- class: a(t(l).e("toc-title"))
612
+ e("div", {
613
+ class: s(a(l).e("toc-title"))
614
614
  }, "目录", 2),
615
- u("ul", {
616
- class: a(t(l).e("toc-list"))
615
+ e("ul", {
616
+ class: s(a(l).e("toc-list"))
617
617
  }, [
618
- (c(!0), d(W, null, M(v.value, (m, w) => (c(), d("li", {
619
- key: w,
620
- class: a(t(l).e("toc-item")),
621
- style: j({ paddingLeft: (m.level - 1) * 12 + "px" })
622
- }, S(m.text), 7))), 128))
618
+ (o(!0), c(E, null, z(g.value, (f, S) => (o(), c("li", {
619
+ key: S,
620
+ class: s(a(l).e("toc-item")),
621
+ style: H({ paddingLeft: (f.level - 1) * 12 + "px" })
622
+ }, h(f.text), 7))), 128))
623
623
  ], 2)
624
- ], 2)) : B("", !0),
625
- u("div", {
626
- class: a(t(l).e("content"))
624
+ ], 2)) : x("", !0),
625
+ e("div", {
626
+ class: s(a(l).e("content"))
627
627
  }, [
628
- D(u("div", {
629
- class: a(t(l).e("editor-wrapper"))
628
+ K(e("div", {
629
+ class: s(a(l).e("editor-wrapper"))
630
630
  }, [
631
- u("textarea", {
631
+ e("textarea", {
632
632
  ref_key: "editorRef",
633
633
  ref: $,
634
- class: a(t(l).e("editor")),
635
- value: s.value,
636
- placeholder: e.placeholder,
637
- disabled: e.disabled,
638
- onInput: r,
639
- onScroll: C
640
- }, null, 42, de)
634
+ class: s(a(l).e("editor")),
635
+ value: i.value,
636
+ placeholder: t.placeholder,
637
+ disabled: t.disabled,
638
+ onInput: d,
639
+ onScroll: w
640
+ }, null, 42, he)
641
641
  ], 2), [
642
- [G, g.value !== "preview"]
642
+ [G, b.value !== "preview"]
643
643
  ]),
644
- D(u("div", {
645
- class: a(t(l).e("preview")),
646
- innerHTML: x.value
647
- }, null, 10, pe), [
648
- [G, g.value !== "edit"]
644
+ K(e("div", {
645
+ class: s(a(l).e("preview")),
646
+ innerHTML: T.value
647
+ }, null, 10, me), [
648
+ [G, b.value !== "edit"]
649
649
  ])
650
650
  ], 2)
651
651
  ], 2)
652
652
  ], 6));
653
653
  }
654
+ }), fe = { class: "icon-text" }, ve = { class: "status-label" }, mt = /* @__PURE__ */ I({
655
+ name: "XAppCard",
656
+ __name: "index",
657
+ props: {
658
+ id: { default: "" },
659
+ name: { default: "" },
660
+ description: { default: "" },
661
+ icon: { default: "📱" },
662
+ iconBgColor: { default: "#409eff" },
663
+ status: { default: "draft" },
664
+ creator: { default: "" },
665
+ createTime: { default: "" },
666
+ category: { default: "" },
667
+ disabled: { type: Boolean, default: !1 }
668
+ },
669
+ emits: ["click", "edit", "delete", "publish"],
670
+ setup(t, { emit: v }) {
671
+ const n = t, u = v, l = A("app-card"), i = B(() => {
672
+ const d = {
673
+ published: { label: "已发布", color: "#67c23a", dotColor: "#67c23a" },
674
+ draft: { label: "草稿", color: "#909399", dotColor: "#909399" },
675
+ archived: { label: "已归档", color: "#f56c6c", dotColor: "#f56c6c" }
676
+ };
677
+ return d[n.status] || d.draft;
678
+ }), $ = B(() => [
679
+ l.b(),
680
+ l.m(n.status),
681
+ l.is("disabled", n.disabled)
682
+ ]), b = () => {
683
+ n.disabled || u("click", n.id);
684
+ }, T = (d) => {
685
+ d.stopPropagation(), n.disabled || u("edit", n.id);
686
+ }, g = (d) => {
687
+ d.stopPropagation(), n.disabled || u("delete", n.id);
688
+ }, y = (d) => {
689
+ d.stopPropagation(), n.disabled || u("publish", n.id);
690
+ };
691
+ return (d, r) => (o(), c("div", {
692
+ class: s($.value),
693
+ onClick: b
694
+ }, [
695
+ e("div", {
696
+ class: s(a(l).e("icon")),
697
+ style: H({ backgroundColor: t.iconBgColor })
698
+ }, [
699
+ e("span", fe, h(t.icon), 1)
700
+ ], 6),
701
+ e("div", {
702
+ class: s(a(l).e("status"))
703
+ }, [
704
+ e("span", {
705
+ class: "status-dot",
706
+ style: H({ backgroundColor: i.value.dotColor })
707
+ }, null, 4),
708
+ e("span", ve, h(i.value.label), 1)
709
+ ], 2),
710
+ e("div", {
711
+ class: s(a(l).e("info"))
712
+ }, [
713
+ e("div", {
714
+ class: s(a(l).e("name"))
715
+ }, h(t.name), 3),
716
+ t.description ? (o(), c("div", {
717
+ key: 0,
718
+ class: s(a(l).e("description"))
719
+ }, h(t.description), 3)) : x("", !0)
720
+ ], 2),
721
+ e("div", {
722
+ class: s(a(l).e("meta"))
723
+ }, [
724
+ t.creator ? (o(), c("span", {
725
+ key: 0,
726
+ class: s(a(l).e("creator"))
727
+ }, "创建者: " + h(t.creator), 3)) : x("", !0),
728
+ t.createTime ? (o(), c("span", {
729
+ key: 1,
730
+ class: s(a(l).e("time"))
731
+ }, h(t.createTime), 3)) : x("", !0)
732
+ ], 2),
733
+ e("div", {
734
+ class: s(a(l).e("actions"))
735
+ }, [
736
+ e("button", {
737
+ class: "action-btn",
738
+ title: "编辑",
739
+ onClick: T
740
+ }, " ✏️ "),
741
+ t.status === "draft" ? (o(), c("button", {
742
+ key: 0,
743
+ class: "action-btn",
744
+ title: "发布",
745
+ onClick: y
746
+ }, " 🚀 ")) : x("", !0),
747
+ e("button", {
748
+ class: "action-btn action-btn--danger",
749
+ title: "删除",
750
+ onClick: g
751
+ }, " 🗑️ ")
752
+ ], 2)
753
+ ], 2));
754
+ }
755
+ }), ge = ["disabled"], ye = { class: "role-icon" }, be = { class: "role-label" }, ke = {
756
+ key: 0,
757
+ class: "timestamp"
758
+ }, $e = {
759
+ key: 0,
760
+ class: "loading-indicator"
761
+ }, Ce = {
762
+ key: 0,
763
+ class: "text-content"
764
+ }, xe = {
765
+ key: 1,
766
+ class: "code-block"
767
+ }, we = { class: "code-header" }, Te = { class: "language" }, Ve = ["onClick"], Se = { class: "code-content" }, Be = ["placeholder", "disabled", "onKeydown"], Ee = ["disabled"], ft = /* @__PURE__ */ I({
768
+ name: "XChat",
769
+ __name: "index",
770
+ props: {
771
+ messages: { default: () => [] },
772
+ showInput: { type: Boolean, default: !0 },
773
+ placeholder: { default: "输入消息..." },
774
+ disabled: { type: Boolean, default: !1 },
775
+ loading: { type: Boolean, default: !1 },
776
+ maxHeight: { default: 400 },
777
+ showClear: { type: Boolean, default: !0 },
778
+ showTimestamp: { type: Boolean, default: !0 }
779
+ },
780
+ emits: ["send", "clear", "copy"],
781
+ setup(t, { emit: v }) {
782
+ const n = t, u = v, l = A("chat"), i = q(""), $ = q(null), b = B(() => [
783
+ l.b(),
784
+ l.is("disabled", n.disabled)
785
+ ]), T = B(() => ({ maxHeight: typeof n.maxHeight == "number" ? `${n.maxHeight}px` : n.maxHeight })), g = () => {
786
+ i.value.trim() && !n.disabled && !n.loading && (u("send", i.value.trim()), i.value = "");
787
+ }, y = () => {
788
+ u("clear");
789
+ }, d = async (w) => {
790
+ try {
791
+ await navigator.clipboard.writeText(w), u("copy", w);
792
+ } catch (C) {
793
+ console.error("复制失败:", C);
794
+ }
795
+ }, r = async () => {
796
+ await Z(), $.value && ($.value.scrollTop = $.value.scrollHeight);
797
+ };
798
+ Q(() => n.messages, () => {
799
+ r();
800
+ }, { deep: !0 });
801
+ const m = (w) => ({
802
+ user: "👤",
803
+ assistant: "🤖",
804
+ system: "⚙️"
805
+ })[w] || "💬", p = (w) => ({
806
+ user: "用户",
807
+ assistant: "AI助手",
808
+ system: "系统"
809
+ })[w] || "消息", V = (w) => {
810
+ const C = /```(\w+)?\n([\s\S]*?)```/g, k = [];
811
+ let f = 0, S;
812
+ for (; (S = C.exec(w)) !== null; )
813
+ S.index > f && k.push({
814
+ type: "text",
815
+ content: w.slice(f, S.index)
816
+ }), k.push({
817
+ type: "code",
818
+ content: S[2],
819
+ language: S[1] || "plaintext"
820
+ }), f = S.index + S[0].length;
821
+ return f < w.length && k.push({
822
+ type: "text",
823
+ content: w.slice(f)
824
+ }), k.length > 0 ? k : [{ type: "text", content: w }];
825
+ };
826
+ return (w, C) => (o(), c("div", {
827
+ class: s(b.value)
828
+ }, [
829
+ t.showClear ? (o(), c("div", {
830
+ key: 0,
831
+ class: s(a(l).e("toolbar"))
832
+ }, [
833
+ e("button", {
834
+ class: "clear-btn",
835
+ onClick: y,
836
+ disabled: t.disabled || t.messages.length === 0
837
+ }, " 🗑️ 清空对话 ", 8, ge)
838
+ ], 2)) : x("", !0),
839
+ e("div", {
840
+ ref_key: "messagesContainer",
841
+ ref: $,
842
+ class: s(a(l).e("messages")),
843
+ style: H(T.value)
844
+ }, [
845
+ t.messages.length === 0 ? (o(), c("div", {
846
+ key: 0,
847
+ class: s(a(l).e("empty"))
848
+ }, [...C[1] || (C[1] = [
849
+ e("span", { class: "empty-icon" }, "💬", -1),
850
+ e("span", { class: "empty-text" }, "暂无对话消息", -1)
851
+ ])], 2)) : x("", !0),
852
+ (o(!0), c(E, null, z(t.messages, (k) => (o(), c("div", {
853
+ key: k.id,
854
+ class: s([a(l).e("message"), a(l).em("message", k.role)])
855
+ }, [
856
+ e("div", {
857
+ class: s(a(l).e("message-header"))
858
+ }, [
859
+ e("span", ye, h(m(k.role)), 1),
860
+ e("span", be, h(p(k.role)), 1),
861
+ t.showTimestamp && k.timestamp ? (o(), c("span", ke, h(k.timestamp), 1)) : x("", !0)
862
+ ], 2),
863
+ e("div", {
864
+ class: s(a(l).e("message-content"))
865
+ }, [
866
+ k.loading ? (o(), c("span", $e, [...C[2] || (C[2] = [
867
+ e("span", { class: "dot" }, null, -1),
868
+ e("span", { class: "dot" }, null, -1),
869
+ e("span", { class: "dot" }, null, -1)
870
+ ])])) : (o(!0), c(E, { key: 1 }, z(V(k.content), (f, S) => (o(), c(E, { key: S }, [
871
+ f.type === "text" ? (o(), c("div", Ce, h(f.content), 1)) : (o(), c("div", xe, [
872
+ e("div", we, [
873
+ e("span", Te, h(f.language), 1),
874
+ e("button", {
875
+ class: "copy-btn",
876
+ onClick: (P) => d(f.content)
877
+ }, " 📋 复制 ", 8, Ve)
878
+ ]),
879
+ e("pre", Se, [
880
+ e("code", null, h(f.content), 1)
881
+ ])
882
+ ]))
883
+ ], 64))), 128))
884
+ ], 2)
885
+ ], 2))), 128))
886
+ ], 6),
887
+ t.showInput ? (o(), c("div", {
888
+ key: 1,
889
+ class: s(a(l).e("input"))
890
+ }, [
891
+ K(e("textarea", {
892
+ "onUpdate:modelValue": C[0] || (C[0] = (k) => i.value = k),
893
+ placeholder: t.placeholder,
894
+ disabled: t.disabled || t.loading,
895
+ class: "input-textarea",
896
+ onKeydown: J(_(g, ["ctrl"]), ["enter"]),
897
+ rows: "3"
898
+ }, null, 40, Be), [
899
+ [le, i.value]
900
+ ]),
901
+ e("button", {
902
+ class: "send-btn",
903
+ disabled: t.disabled || t.loading || !i.value.trim(),
904
+ onClick: g
905
+ }, h(t.loading ? "发送中..." : "发送"), 9, Ee)
906
+ ], 2)) : x("", !0)
907
+ ], 2));
908
+ }
909
+ }), Pe = { key: 0 }, He = { key: 1 }, ze = { class: "col-session-id" }, Ue = { class: "session-id" }, Ie = { class: "col-title" }, Le = { class: "col-message-count" }, Me = { class: "col-status" }, je = { class: "col-time" }, qe = { class: "col-actions" }, Ae = ["onClick"], Re = ["onClick"], We = { class: "pagination-info" }, Xe = { class: "pagination-controls" }, De = ["disabled"], Ke = { class: "pagination-current" }, Ne = ["disabled"], Oe = ["value"], vt = /* @__PURE__ */ I({
910
+ name: "XLogTable",
911
+ __name: "index",
912
+ props: {
913
+ data: { default: () => [] },
914
+ loading: { type: Boolean, default: !1 },
915
+ pagination: { default: void 0 },
916
+ showPagination: { type: Boolean, default: !0 }
917
+ },
918
+ emits: ["page-change", "size-change", "view-detail", "view-trace"],
919
+ setup(t, { emit: v }) {
920
+ const n = t, u = v, l = A("log-table"), i = (d) => ({
921
+ success: { label: "成功", color: "#67c23a" },
922
+ error: { label: "失败", color: "#f56c6c" },
923
+ running: { label: "运行中", color: "#409eff" }
924
+ })[d] || { label: "未知", color: "#909399" }, $ = B(() => [
925
+ l.b(),
926
+ l.is("loading", n.loading)
927
+ ]), b = (d) => {
928
+ u("page-change", d);
929
+ }, T = (d) => {
930
+ u("size-change", d);
931
+ }, g = (d) => {
932
+ u("view-detail", d);
933
+ }, y = (d) => {
934
+ u("view-trace", d);
935
+ };
936
+ return (d, r) => (o(), c("div", {
937
+ class: s($.value)
938
+ }, [
939
+ e("div", {
940
+ class: s(a(l).e("wrapper"))
941
+ }, [
942
+ e("table", null, [
943
+ r[4] || (r[4] = e("thead", null, [
944
+ e("tr", null, [
945
+ e("th", { class: "col-session-id" }, "会话ID"),
946
+ e("th", { class: "col-title" }, "会话标题"),
947
+ e("th", { class: "col-message-count" }, "消息数"),
948
+ e("th", { class: "col-status" }, "状态"),
949
+ e("th", { class: "col-time" }, "最新消息时间"),
950
+ e("th", { class: "col-actions" }, "操作")
951
+ ])
952
+ ], -1)),
953
+ e("tbody", null, [
954
+ t.loading ? (o(), c("tr", Pe, [
955
+ e("td", {
956
+ colspan: "6",
957
+ class: s(a(l).e("loading-cell"))
958
+ }, [...r[3] || (r[3] = [
959
+ e("span", { class: "loading-spinner" }, null, -1),
960
+ e("span", { class: "loading-text" }, "加载中...", -1)
961
+ ])], 2)
962
+ ])) : t.data.length === 0 ? (o(), c("tr", He, [
963
+ e("td", {
964
+ colspan: "6",
965
+ class: s(a(l).e("empty"))
966
+ }, " 暂无日志记录 ", 2)
967
+ ])) : x("", !0),
968
+ (o(!0), c(E, null, z(t.data, (m) => (o(), c("tr", {
969
+ key: m.id
970
+ }, [
971
+ e("td", ze, [
972
+ e("span", Ue, h(m.sessionId), 1)
973
+ ]),
974
+ e("td", Ie, h(m.title), 1),
975
+ e("td", Le, h(m.messageCount), 1),
976
+ e("td", Me, [
977
+ e("span", {
978
+ class: "status-tag",
979
+ style: H({ backgroundColor: i(m.status).color })
980
+ }, h(i(m.status).label), 5)
981
+ ]),
982
+ e("td", je, h(m.latestMessageTime), 1),
983
+ e("td", qe, [
984
+ e("button", {
985
+ class: "action-link",
986
+ onClick: (p) => g(m)
987
+ }, " 查看详情 ", 8, Ae),
988
+ e("button", {
989
+ class: "action-link",
990
+ onClick: (p) => y(m)
991
+ }, " 链路追踪 ", 8, Re)
992
+ ])
993
+ ]))), 128))
994
+ ])
995
+ ])
996
+ ], 2),
997
+ t.showPagination && t.pagination ? (o(), c("div", {
998
+ key: 0,
999
+ class: s(a(l).e("pagination"))
1000
+ }, [
1001
+ e("span", We, " 共 " + h(t.pagination.total) + " 条 ", 1),
1002
+ e("div", Xe, [
1003
+ e("button", {
1004
+ class: "pagination-btn",
1005
+ disabled: t.pagination.current <= 1,
1006
+ onClick: r[0] || (r[0] = (m) => b(t.pagination.current - 1))
1007
+ }, " 上一页 ", 8, De),
1008
+ e("span", Ke, "第 " + h(t.pagination.current) + " 页", 1),
1009
+ e("button", {
1010
+ class: "pagination-btn",
1011
+ disabled: t.pagination.current >= Math.ceil(t.pagination.total / t.pagination.pageSize),
1012
+ onClick: r[1] || (r[1] = (m) => b(t.pagination.current + 1))
1013
+ }, " 下一页 ", 8, Ne)
1014
+ ]),
1015
+ e("select", {
1016
+ class: "pagination-size-select",
1017
+ value: t.pagination.pageSize,
1018
+ onChange: r[2] || (r[2] = (m) => T(Number(m.target.value)))
1019
+ }, [...r[5] || (r[5] = [
1020
+ e("option", { value: "10" }, "10条/页", -1),
1021
+ e("option", { value: "20" }, "20条/页", -1),
1022
+ e("option", { value: "50" }, "50条/页", -1),
1023
+ e("option", { value: "100" }, "100条/页", -1)
1024
+ ])], 40, Oe)
1025
+ ], 2)) : x("", !0)
1026
+ ], 2));
1027
+ }
1028
+ }), Fe = ["onClick"], Ge = { class: "endpoint-path" }, Ye = { class: "endpoint-url" }, Je = { class: "endpoint-desc" }, Qe = { class: "param-name" }, Ze = { class: "param-type" }, _e = { class: "param-required" }, et = {
1029
+ key: 0,
1030
+ class: "required-tag"
1031
+ }, tt = {
1032
+ key: 1,
1033
+ class: "optional-tag"
1034
+ }, lt = { class: "param-default" }, at = { class: "param-desc" }, gt = /* @__PURE__ */ I({
1035
+ name: "XApiDoc",
1036
+ __name: "index",
1037
+ props: {
1038
+ baseUrl: { default: "https://api.example.com" },
1039
+ endpoints: { default: () => [] },
1040
+ showCurlExample: { type: Boolean, default: !0 },
1041
+ authType: { default: "apikey" },
1042
+ apiKeyPlaceholder: { default: "YOUR_API_KEY" }
1043
+ },
1044
+ emits: ["copy-curl"],
1045
+ setup(t, { emit: v }) {
1046
+ const n = t, u = v, l = A("api-doc"), i = q(n.endpoints[0] || null), $ = B(() => [
1047
+ l.b()
1048
+ ]), b = {
1049
+ GET: "#67c23a",
1050
+ POST: "#409eff",
1051
+ PUT: "#e6a23c",
1052
+ DELETE: "#f56c6c",
1053
+ PATCH: "#909399"
1054
+ }, T = (d) => {
1055
+ const r = d.method, m = `${n.baseUrl}${d.path}`;
1056
+ let p = `curl -X ${r} '${m}'`;
1057
+ return n.authType === "apikey" ? p += ` -H 'Authorization: ApiKey ${n.apiKeyPlaceholder}'` : n.authType === "bearer" ? p += ` -H 'Authorization: Bearer ${n.apiKeyPlaceholder}'` : n.authType === "basic" && (p += " -u 'username:password'"), r !== "GET" && (p += " -H 'Content-Type: application/json'"), d.requestBody && r !== "GET" && (p += ` -d '${d.requestBody}'`), p;
1058
+ }, g = async (d) => {
1059
+ try {
1060
+ await navigator.clipboard.writeText(d), u("copy-curl", d);
1061
+ } catch (r) {
1062
+ console.error("复制失败:", r);
1063
+ }
1064
+ }, y = (d) => {
1065
+ i.value = d;
1066
+ };
1067
+ return (d, r) => {
1068
+ var m;
1069
+ return o(), c("div", {
1070
+ class: s($.value)
1071
+ }, [
1072
+ e("div", {
1073
+ class: s(a(l).e("sidebar"))
1074
+ }, [
1075
+ e("div", {
1076
+ class: s(a(l).e("sidebar-header"))
1077
+ }, "API 端点", 2),
1078
+ e("div", {
1079
+ class: s(a(l).e("endpoint-list"))
1080
+ }, [
1081
+ (o(!0), c(E, null, z(t.endpoints, (p) => (o(), c("div", {
1082
+ key: `${p.method}-${p.path}`,
1083
+ class: s([a(l).e("endpoint-item"), { "is-active": i.value === p }]),
1084
+ onClick: (V) => y(p)
1085
+ }, [
1086
+ e("span", {
1087
+ class: "method-tag",
1088
+ style: H({ backgroundColor: b[p.method] })
1089
+ }, h(p.method), 5),
1090
+ e("span", Ge, h(p.path), 1)
1091
+ ], 10, Fe))), 128))
1092
+ ], 2)
1093
+ ], 2),
1094
+ e("div", {
1095
+ class: s(a(l).e("content"))
1096
+ }, [
1097
+ i.value ? (o(), c(E, { key: 0 }, [
1098
+ e("div", {
1099
+ class: s(a(l).e("header"))
1100
+ }, [
1101
+ e("span", {
1102
+ class: "method-badge",
1103
+ style: H({ backgroundColor: b[i.value.method] })
1104
+ }, h(i.value.method), 5),
1105
+ e("span", Ye, h(t.baseUrl) + h(i.value.path), 1),
1106
+ e("span", Je, h(i.value.description), 1)
1107
+ ], 2),
1108
+ (m = i.value.parameters) != null && m.length ? (o(), c("div", {
1109
+ key: 0,
1110
+ class: s(a(l).e("section"))
1111
+ }, [
1112
+ e("div", {
1113
+ class: s(a(l).e("section-title"))
1114
+ }, "请求参数", 2),
1115
+ e("table", {
1116
+ class: s(a(l).e("params-table"))
1117
+ }, [
1118
+ r[1] || (r[1] = e("thead", null, [
1119
+ e("tr", null, [
1120
+ e("th", null, "参数名"),
1121
+ e("th", null, "类型"),
1122
+ e("th", null, "必填"),
1123
+ e("th", null, "默认值"),
1124
+ e("th", null, "说明")
1125
+ ])
1126
+ ], -1)),
1127
+ e("tbody", null, [
1128
+ (o(!0), c(E, null, z(i.value.parameters, (p) => (o(), c("tr", {
1129
+ key: p.name
1130
+ }, [
1131
+ e("td", Qe, h(p.name), 1),
1132
+ e("td", Ze, h(p.type), 1),
1133
+ e("td", _e, [
1134
+ p.required ? (o(), c("span", et, "必填")) : (o(), c("span", tt, "可选"))
1135
+ ]),
1136
+ e("td", lt, h(p.defaultValue || "-"), 1),
1137
+ e("td", at, h(p.description), 1)
1138
+ ]))), 128))
1139
+ ])
1140
+ ], 2)
1141
+ ], 2)) : x("", !0),
1142
+ t.showCurlExample ? (o(), c("div", {
1143
+ key: 1,
1144
+ class: s(a(l).e("section"))
1145
+ }, [
1146
+ e("div", {
1147
+ class: s(a(l).e("section-title"))
1148
+ }, [
1149
+ r[2] || (r[2] = j(" curl 示例 ", -1)),
1150
+ e("button", {
1151
+ class: "copy-btn",
1152
+ onClick: r[0] || (r[0] = (p) => g(T(i.value)))
1153
+ }, " 📋 复制 ")
1154
+ ], 2),
1155
+ e("div", {
1156
+ class: s(a(l).e("code-block"))
1157
+ }, [
1158
+ e("pre", null, [
1159
+ e("code", null, h(T(i.value)), 1)
1160
+ ])
1161
+ ], 2)
1162
+ ], 2)) : x("", !0),
1163
+ i.value.requestBody ? (o(), c("div", {
1164
+ key: 2,
1165
+ class: s(a(l).e("section"))
1166
+ }, [
1167
+ e("div", {
1168
+ class: s(a(l).e("section-title"))
1169
+ }, "请求体示例", 2),
1170
+ e("div", {
1171
+ class: s(a(l).e("code-block"))
1172
+ }, [
1173
+ e("pre", null, [
1174
+ e("code", null, h(i.value.requestBody), 1)
1175
+ ])
1176
+ ], 2)
1177
+ ], 2)) : x("", !0),
1178
+ i.value.responseExample ? (o(), c("div", {
1179
+ key: 3,
1180
+ class: s(a(l).e("section"))
1181
+ }, [
1182
+ e("div", {
1183
+ class: s(a(l).e("section-title"))
1184
+ }, "响应示例", 2),
1185
+ e("div", {
1186
+ class: s(a(l).e("code-block"))
1187
+ }, [
1188
+ e("pre", null, [
1189
+ e("code", null, h(i.value.responseExample), 1)
1190
+ ])
1191
+ ], 2)
1192
+ ], 2)) : x("", !0)
1193
+ ], 64)) : (o(), c("div", {
1194
+ key: 1,
1195
+ class: s(a(l).e("empty"))
1196
+ }, " 请选择一个 API 端点查看详情 ", 2))
1197
+ ], 2)
1198
+ ], 2);
1199
+ };
1200
+ }
1201
+ }), yt = /* @__PURE__ */ I({
1202
+ name: "XVarTag",
1203
+ __name: "index",
1204
+ props: {
1205
+ name: { default: "" },
1206
+ type: { default: "string" },
1207
+ value: { default: void 0 },
1208
+ showValue: { type: Boolean, default: !1 },
1209
+ copyable: { type: Boolean, default: !1 },
1210
+ disabled: { type: Boolean, default: !1 },
1211
+ size: { default: "default" },
1212
+ showTypeIcon: { type: Boolean, default: !0 }
1213
+ },
1214
+ emits: ["click", "copy"],
1215
+ setup(t, { emit: v }) {
1216
+ const n = t, u = v, l = A("var-tag"), i = B(() => {
1217
+ const y = {
1218
+ string: { icon: "📝", color: "#409eff", label: "文本" },
1219
+ number: { icon: "🔢", color: "#67c23a", label: "数字" },
1220
+ boolean: { icon: "✓", color: "#e6a23c", label: "布尔" },
1221
+ object: { icon: "📦", color: "#909399", label: "对象" },
1222
+ array: { icon: "📚", color: "#909399", label: "数组" },
1223
+ file: { icon: "📁", color: "#f56c6c", label: "文件" }
1224
+ };
1225
+ return y[n.type] || y.string;
1226
+ }), $ = B(() => [
1227
+ l.b(),
1228
+ l.m(n.size),
1229
+ l.m(n.type),
1230
+ l.is("disabled", n.disabled),
1231
+ l.is("copyable", n.copyable)
1232
+ ]), b = B(() => n.value === void 0 || n.value === null ? "-" : n.type === "object" || n.type === "array" ? JSON.stringify(n.value) : String(n.value)), T = () => {
1233
+ n.disabled || u("click", n.name);
1234
+ }, g = async () => {
1235
+ if (!n.disabled && n.copyable)
1236
+ try {
1237
+ const y = n.showValue ? `${n.name}: ${b.value}` : n.name;
1238
+ await navigator.clipboard.writeText(y), u("copy", n.name, n.value);
1239
+ } catch (y) {
1240
+ console.error("复制失败:", y);
1241
+ }
1242
+ };
1243
+ return (y, d) => (o(), c("span", {
1244
+ class: s($.value),
1245
+ onClick: T
1246
+ }, [
1247
+ t.showTypeIcon ? (o(), c("span", {
1248
+ key: 0,
1249
+ class: s(a(l).e("icon"))
1250
+ }, h(i.value.icon), 3)) : x("", !0),
1251
+ e("span", {
1252
+ class: s(a(l).e("name"))
1253
+ }, h(t.name), 3),
1254
+ t.showValue ? (o(), c("span", {
1255
+ key: 1,
1256
+ class: s(a(l).e("value"))
1257
+ }, h(b.value), 3)) : x("", !0),
1258
+ t.showValue ? x("", !0) : (o(), c("span", {
1259
+ key: 2,
1260
+ class: s(a(l).e("type")),
1261
+ style: H({ color: i.value.color })
1262
+ }, h(i.value.label), 7)),
1263
+ t.copyable ? (o(), c("button", {
1264
+ key: 3,
1265
+ class: s(a(l).e("copy-btn")),
1266
+ onClick: _(g, ["stop"])
1267
+ }, " 📋 ", 2)) : x("", !0)
1268
+ ], 2));
1269
+ }
654
1270
  });
655
1271
  export {
656
- $e as Export,
657
- xe as MarkdownEditor,
658
- ye as ProTable,
659
- be as SearchForm,
660
- ke as Statistic
1272
+ gt as ApiDoc,
1273
+ mt as AppCard,
1274
+ ft as Chat,
1275
+ pt as Export,
1276
+ vt as LogTable,
1277
+ ht as MarkdownEditor,
1278
+ dt as ProTable,
1279
+ rt as SearchForm,
1280
+ ut as Statistic,
1281
+ yt as VarTag
661
1282
  };