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