yc-component 0.1.10 → 0.1.12
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/dist/ai-task/components/AiUseDialog.d.ts +1 -1
- package/dist/ai-task/style.css +1 -1
- package/dist/image-selector/components/YcImageSelectorDialog.d.ts +2 -1
- package/dist/image-selector/components/YcImageSelectorDialog.d.ts.map +1 -1
- package/dist/image-selector/components/YcImageSelectorProvider.d.ts +3 -2
- package/dist/image-selector/components/YcImageSelectorProvider.d.ts.map +1 -1
- package/dist/image-selector/context.d.ts +2 -0
- package/dist/image-selector/context.d.ts.map +1 -1
- package/dist/image-selector/dialog-state.d.ts +1 -0
- package/dist/image-selector/dialog-state.d.ts.map +1 -1
- package/dist/image-selector/inject.d.ts +2 -0
- package/dist/image-selector/inject.d.ts.map +1 -1
- package/dist/image-selector/style.css +1 -1
- package/dist/image-selector/types/index.d.ts +5 -0
- package/dist/image-selector/types/index.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/page-window/style.css +1 -1
- package/dist/yc-component.cjs.full.js +20 -20
- package/dist/yc-component.cjs.js +2 -2
- package/dist/yc-component.esm.full.js +2110 -2104
- package/dist/yc-component.esm.js +554 -548
- package/dist/yc-component.umd.full.js +32 -32
- package/dist/yc-component.umd.full.min.js +1 -1
- package/dist/yc-component.umd.js +3 -3
- package/dist/yc-component.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/yc-component.esm.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import Ze from "axios";
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { ArrowLeft as
|
|
4
|
-
import { storeToRefs as
|
|
5
|
-
import { ElMessage as
|
|
6
|
-
const
|
|
2
|
+
import { defineComponent as ue, ref as k, computed as B, watch as te, onBeforeUnmount as Mt, resolveComponent as O, resolveDirective as et, openBlock as d, createBlock as M, Transition as tt, withCtx as p, withDirectives as ve, createElementVNode as _, normalizeStyle as He, createVNode as f, unref as h, toDisplayString as V, createElementBlock as A, createCommentVNode as P, createTextVNode as q, renderSlot as Ce, Fragment as ae, vShow as Ee, reactive as nt, inject as Oe, onMounted as Fe, onUnmounted as Ue, renderList as ge, Teleport as Et, normalizeClass as re, provide as $e, normalizeProps as $t, mergeProps as ot, withKeys as Pt, withModifiers as Lt, nextTick as Je, isRef as Dt } from "vue";
|
|
3
|
+
import { ArrowLeft as Bt, ArrowUpBold as Vt, ArrowDownBold as Ot, Switch as Ft, Close as at, Check as lt, Refresh as Xe, ArrowDown as Ut, CircleCheck as Rt, CircleClose as Kt, Remove as Nt, Search as zt, Upload as Yt } from "@element-plus/icons-vue";
|
|
4
|
+
import { storeToRefs as Wt, defineStore as jt } from "pinia";
|
|
5
|
+
import { ElMessage as Z } from "element-plus";
|
|
6
|
+
const Re = {
|
|
7
7
|
projectId: "default-project",
|
|
8
8
|
storageKey: "yc-ai-task-queue-v1"
|
|
9
9
|
};
|
|
10
|
-
let
|
|
11
|
-
function
|
|
12
|
-
|
|
10
|
+
let _e = { ...Re };
|
|
11
|
+
function Gt(e) {
|
|
12
|
+
_e = { ..._e, ...e };
|
|
13
13
|
}
|
|
14
14
|
function it() {
|
|
15
|
-
return
|
|
15
|
+
return _e;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
17
|
+
function qt() {
|
|
18
|
+
return _e.projectId ?? Re.projectId;
|
|
19
19
|
}
|
|
20
20
|
function st() {
|
|
21
|
-
return
|
|
21
|
+
return _e.storageKey ?? Re.storageKey;
|
|
22
22
|
}
|
|
23
|
-
let
|
|
24
|
-
function
|
|
25
|
-
|
|
23
|
+
let le = null;
|
|
24
|
+
function Ht() {
|
|
25
|
+
le = null;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
if (
|
|
27
|
+
function ce() {
|
|
28
|
+
if (le) return le;
|
|
29
29
|
const { baseURL: e, getToken: n, onUnauthorized: t } = it();
|
|
30
|
-
return
|
|
30
|
+
return le = Ze.create({
|
|
31
31
|
baseURL: e ?? "",
|
|
32
32
|
timeout: 6e4,
|
|
33
33
|
headers: { "Content-Type": "application/json" }
|
|
34
|
-
}),
|
|
34
|
+
}), le.interceptors.request.use((o) => {
|
|
35
35
|
const l = n == null ? void 0 : n();
|
|
36
36
|
return l && (o.headers.Authorization = `Bearer ${l}`), o;
|
|
37
|
-
}),
|
|
37
|
+
}), le.interceptors.response.use(
|
|
38
38
|
(o) => {
|
|
39
39
|
const l = o.data;
|
|
40
40
|
return (l == null ? void 0 : l.code) != null && l.code !== 200 ? Promise.reject(new Error(l.message || "请求失败")) : (o.data = (l == null ? void 0 : l.data) ?? l, o);
|
|
@@ -45,10 +45,10 @@ function de() {
|
|
|
45
45
|
const l = (S = (w = o.response) == null ? void 0 : w.data) == null ? void 0 : S.message;
|
|
46
46
|
return Promise.reject(new Error(l || o.message || "请求失败"));
|
|
47
47
|
}
|
|
48
|
-
),
|
|
48
|
+
), le;
|
|
49
49
|
}
|
|
50
|
-
async function
|
|
51
|
-
const o = (await
|
|
50
|
+
async function Jt(e, n) {
|
|
51
|
+
const o = (await ce().get(
|
|
52
52
|
`/yc-ai/workflows/runs/${e}/artifacts/${n}`,
|
|
53
53
|
{ transformResponse: [(l) => l] }
|
|
54
54
|
)).data;
|
|
@@ -61,16 +61,16 @@ async function Ht(e, n) {
|
|
|
61
61
|
return o;
|
|
62
62
|
}
|
|
63
63
|
let Pe = {};
|
|
64
|
-
function
|
|
64
|
+
function Xt(e) {
|
|
65
65
|
Pe = { ...Pe, ...e };
|
|
66
66
|
}
|
|
67
67
|
function Ke() {
|
|
68
68
|
return Pe;
|
|
69
69
|
}
|
|
70
|
-
const
|
|
70
|
+
const Qt = { class: "yc-page-window__header" }, Zt = { class: "yc-page-window__title" }, en = {
|
|
71
71
|
key: 0,
|
|
72
72
|
class: "yc-page-window__nav"
|
|
73
|
-
},
|
|
73
|
+
}, tn = { class: "yc-page-window__opera" }, nn = { class: "yc-page-window__content" }, on = /* @__PURE__ */ ue({
|
|
74
74
|
__name: "YcPageWindow",
|
|
75
75
|
props: {
|
|
76
76
|
visible: { type: Boolean },
|
|
@@ -90,31 +90,31 @@ const Xt = { class: "yc-page-window__header" }, Qt = { class: "yc-page-window__t
|
|
|
90
90
|
},
|
|
91
91
|
emits: ["update:visible", "update:type", "confirm", "close", "opened", "changeType", "prev", "next", "checkRow"],
|
|
92
92
|
setup(e, { expose: n, emit: t }) {
|
|
93
|
-
const o = e, l = t, g = k(!1), w =
|
|
93
|
+
const o = e, l = t, g = k(!1), w = B(() => o.loading || g.value), S = B(() => o.type === "detail" ? "详情" : o.type === "edit" ? "编辑" : o.type === "add" ? "新增" : ""), m = B(
|
|
94
94
|
() => o.list.length > 0 && o.row != null
|
|
95
|
-
), r =
|
|
95
|
+
), r = B(
|
|
96
96
|
() => ["detail", "edit"].includes(o.type)
|
|
97
|
-
),
|
|
98
|
-
function
|
|
97
|
+
), L = B(() => o.type !== "detail");
|
|
98
|
+
function U() {
|
|
99
99
|
if (!o.row) return -1;
|
|
100
|
-
const C = o.rowKey,
|
|
101
|
-
return o.list.findIndex((Y) => Y[C] ===
|
|
100
|
+
const C = o.rowKey, F = o.row[C];
|
|
101
|
+
return o.list.findIndex((Y) => Y[C] === F);
|
|
102
102
|
}
|
|
103
|
-
function
|
|
104
|
-
const
|
|
105
|
-
return
|
|
103
|
+
function E(C) {
|
|
104
|
+
const F = U();
|
|
105
|
+
return F < 0 ? !0 : C === "prev" ? F <= 0 : F >= o.list.length - 1;
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
const C =
|
|
107
|
+
function D() {
|
|
108
|
+
const C = U();
|
|
109
109
|
if (C <= 0) return;
|
|
110
|
-
const
|
|
111
|
-
l("checkRow",
|
|
110
|
+
const F = o.list[C - 1];
|
|
111
|
+
l("checkRow", F), l("prev", F);
|
|
112
112
|
}
|
|
113
113
|
function N() {
|
|
114
|
-
const C =
|
|
114
|
+
const C = U();
|
|
115
115
|
if (C < 0 || C >= o.list.length - 1) return;
|
|
116
|
-
const
|
|
117
|
-
l("checkRow",
|
|
116
|
+
const F = o.list[C + 1];
|
|
117
|
+
l("checkRow", F), l("next", F);
|
|
118
118
|
}
|
|
119
119
|
function y() {
|
|
120
120
|
const C = o.type === "detail" ? "edit" : "detail";
|
|
@@ -128,37 +128,37 @@ const Xt = { class: "yc-page-window__header" }, Qt = { class: "yc-page-window__t
|
|
|
128
128
|
g.value = !1, C && $();
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
|
-
return
|
|
131
|
+
return te(
|
|
132
132
|
() => o.visible,
|
|
133
133
|
(C) => {
|
|
134
134
|
C && l("opened");
|
|
135
135
|
}
|
|
136
|
-
),
|
|
136
|
+
), Mt(() => {
|
|
137
137
|
o.visible && $();
|
|
138
|
-
}), n({ closeWindow: $ }), (C,
|
|
139
|
-
const Y =
|
|
140
|
-
return
|
|
138
|
+
}), n({ closeWindow: $ }), (C, F) => {
|
|
139
|
+
const Y = O("el-icon"), v = O("el-button"), T = O("el-tooltip"), W = O("el-scrollbar"), H = et("loading");
|
|
140
|
+
return d(), M(tt, {
|
|
141
141
|
name: "yc-page-window-fade",
|
|
142
142
|
mode: "out-in"
|
|
143
143
|
}, {
|
|
144
144
|
default: p(() => [
|
|
145
|
-
|
|
145
|
+
ve(_("div", {
|
|
146
146
|
class: "yc-page-window",
|
|
147
147
|
style: He({ zIndex: e.zIndex })
|
|
148
148
|
}, [
|
|
149
|
-
_("div",
|
|
150
|
-
_("div",
|
|
149
|
+
_("div", Qt, [
|
|
150
|
+
_("div", Zt, [
|
|
151
151
|
f(Y, {
|
|
152
152
|
class: "yc-page-window__back",
|
|
153
153
|
onClick: $
|
|
154
154
|
}, {
|
|
155
155
|
default: p(() => [
|
|
156
|
-
f(h(
|
|
156
|
+
f(h(Bt))
|
|
157
157
|
]),
|
|
158
158
|
_: 1
|
|
159
159
|
}),
|
|
160
|
-
_("span", null,
|
|
161
|
-
m.value ? (
|
|
160
|
+
_("span", null, V(e.title) + V(S.value), 1),
|
|
161
|
+
m.value ? (d(), A("div", en, [
|
|
162
162
|
f(T, {
|
|
163
163
|
content: "上一条",
|
|
164
164
|
placement: "top"
|
|
@@ -167,13 +167,13 @@ const Xt = { class: "yc-page-window__header" }, Qt = { class: "yc-page-window__t
|
|
|
167
167
|
f(v, {
|
|
168
168
|
round: "",
|
|
169
169
|
text: "",
|
|
170
|
-
disabled:
|
|
171
|
-
onClick:
|
|
170
|
+
disabled: E("prev"),
|
|
171
|
+
onClick: D
|
|
172
172
|
}, {
|
|
173
173
|
default: p(() => [
|
|
174
174
|
f(Y, null, {
|
|
175
175
|
default: p(() => [
|
|
176
|
-
f(h(
|
|
176
|
+
f(h(Vt))
|
|
177
177
|
]),
|
|
178
178
|
_: 1
|
|
179
179
|
})
|
|
@@ -191,13 +191,13 @@ const Xt = { class: "yc-page-window__header" }, Qt = { class: "yc-page-window__t
|
|
|
191
191
|
f(v, {
|
|
192
192
|
round: "",
|
|
193
193
|
text: "",
|
|
194
|
-
disabled:
|
|
194
|
+
disabled: E("next"),
|
|
195
195
|
onClick: N
|
|
196
196
|
}, {
|
|
197
197
|
default: p(() => [
|
|
198
198
|
f(Y, null, {
|
|
199
199
|
default: p(() => [
|
|
200
|
-
f(h(
|
|
200
|
+
f(h(Ot))
|
|
201
201
|
]),
|
|
202
202
|
_: 1
|
|
203
203
|
})
|
|
@@ -208,7 +208,7 @@ const Xt = { class: "yc-page-window__header" }, Qt = { class: "yc-page-window__t
|
|
|
208
208
|
_: 1
|
|
209
209
|
})
|
|
210
210
|
])) : P("", !0),
|
|
211
|
-
r.value ? (
|
|
211
|
+
r.value ? (d(), M(v, {
|
|
212
212
|
key: 1,
|
|
213
213
|
text: "",
|
|
214
214
|
class: "yc-page-window__type-switch",
|
|
@@ -218,18 +218,18 @@ const Xt = { class: "yc-page-window__header" }, Qt = { class: "yc-page-window__t
|
|
|
218
218
|
default: p(() => [
|
|
219
219
|
f(Y, { class: "m-r-4" }, {
|
|
220
220
|
default: p(() => [
|
|
221
|
-
f(h(
|
|
221
|
+
f(h(Ft))
|
|
222
222
|
]),
|
|
223
223
|
_: 1
|
|
224
224
|
}),
|
|
225
|
-
q(" " +
|
|
225
|
+
q(" " + V(e.type === "detail" ? "切换编辑" : "切换详情"), 1)
|
|
226
226
|
]),
|
|
227
227
|
_: 1
|
|
228
228
|
}, 8, ["type"])) : P("", !0)
|
|
229
229
|
]),
|
|
230
|
-
_("div",
|
|
230
|
+
_("div", tn, [
|
|
231
231
|
Ce(C.$slots, "opera", {}, void 0, !0),
|
|
232
|
-
e.showButtons &&
|
|
232
|
+
e.showButtons && L.value ? (d(), A(ae, { key: 0 }, [
|
|
233
233
|
f(v, {
|
|
234
234
|
text: "",
|
|
235
235
|
disabled: w.value,
|
|
@@ -242,11 +242,11 @@ const Xt = { class: "yc-page-window__header" }, Qt = { class: "yc-page-window__t
|
|
|
242
242
|
]),
|
|
243
243
|
_: 1
|
|
244
244
|
}),
|
|
245
|
-
q(" " +
|
|
245
|
+
q(" " + V(e.cancelText), 1)
|
|
246
246
|
]),
|
|
247
247
|
_: 1
|
|
248
248
|
}, 8, ["disabled"]),
|
|
249
|
-
e.showConfirm ? (
|
|
249
|
+
e.showConfirm ? (d(), M(v, {
|
|
250
250
|
key: 0,
|
|
251
251
|
type: "primary",
|
|
252
252
|
loading: w.value,
|
|
@@ -260,17 +260,17 @@ const Xt = { class: "yc-page-window__header" }, Qt = { class: "yc-page-window__t
|
|
|
260
260
|
]),
|
|
261
261
|
_: 1
|
|
262
262
|
}),
|
|
263
|
-
q(" " +
|
|
263
|
+
q(" " + V(e.confirmText), 1)
|
|
264
264
|
]),
|
|
265
265
|
_: 1
|
|
266
266
|
}, 8, ["loading", "disabled"])) : P("", !0)
|
|
267
267
|
], 64)) : P("", !0)
|
|
268
268
|
])
|
|
269
269
|
]),
|
|
270
|
-
|
|
270
|
+
ve((d(), A("div", nn, [
|
|
271
271
|
f(W, { class: "yc-page-window__scroll" }, {
|
|
272
272
|
default: p(() => [
|
|
273
|
-
e.visible ? (
|
|
273
|
+
e.visible ? (d(), A("div", {
|
|
274
274
|
key: 0,
|
|
275
275
|
class: "yc-page-window__body",
|
|
276
276
|
style: He({ minHeight: e.contentMinHeight })
|
|
@@ -296,35 +296,35 @@ const Xt = { class: "yc-page-window__header" }, Qt = { class: "yc-page-window__t
|
|
|
296
296
|
for (const [o, l] of n)
|
|
297
297
|
t[o] = l;
|
|
298
298
|
return t;
|
|
299
|
-
}, Qe = /* @__PURE__ */ Se(
|
|
300
|
-
function
|
|
301
|
-
e != null && e.aiTask && (
|
|
299
|
+
}, Qe = /* @__PURE__ */ Se(on, [["__scopeId", "data-v-b3e784c3"]]);
|
|
300
|
+
function an(e) {
|
|
301
|
+
e != null && e.aiTask && (Gt(e.aiTask), Ht()), e != null && e.imageSelector && Xt(e.imageSelector);
|
|
302
302
|
}
|
|
303
|
-
function
|
|
303
|
+
function ln(e, n) {
|
|
304
304
|
(n == null ? void 0 : n.registerPageWindow) !== !1 && (e.component("YcPageWindow", Qe), e.component("SkyPageWindow", Qe));
|
|
305
305
|
}
|
|
306
|
-
const
|
|
306
|
+
const Do = {
|
|
307
307
|
install(e, n) {
|
|
308
|
-
|
|
308
|
+
an(n), ln(e, n);
|
|
309
309
|
}
|
|
310
310
|
}, Ae = "__YC_COMPONENT_AI_DIALOG__", Le = "yc-component:ai-dialog-open";
|
|
311
|
-
function
|
|
311
|
+
function sn() {
|
|
312
312
|
const e = globalThis;
|
|
313
313
|
return e[Ae] || (e[Ae] = nt({
|
|
314
314
|
visible: !1,
|
|
315
315
|
options: {}
|
|
316
316
|
})), e[Ae];
|
|
317
317
|
}
|
|
318
|
-
const
|
|
318
|
+
const ee = sn();
|
|
319
319
|
function Ne(e = {}) {
|
|
320
|
-
|
|
320
|
+
ee.options = { ...e }, ee.visible = !0, globalThis.dispatchEvent(
|
|
321
321
|
new CustomEvent(Le, { detail: { ...e } })
|
|
322
322
|
);
|
|
323
323
|
}
|
|
324
324
|
function rt() {
|
|
325
|
-
|
|
325
|
+
ee.visible = !1;
|
|
326
326
|
}
|
|
327
|
-
function
|
|
327
|
+
function Bo(e = {}) {
|
|
328
328
|
Ne(e);
|
|
329
329
|
}
|
|
330
330
|
function ut(e) {
|
|
@@ -337,7 +337,7 @@ function ut(e) {
|
|
|
337
337
|
activeCount: w,
|
|
338
338
|
panelTitle: S,
|
|
339
339
|
panelSubtitle: m
|
|
340
|
-
} =
|
|
340
|
+
} = Wt(e);
|
|
341
341
|
return {
|
|
342
342
|
tasks: n,
|
|
343
343
|
panelVisible: t,
|
|
@@ -364,19 +364,19 @@ function ut(e) {
|
|
|
364
364
|
onTaskFinish: (r) => e.onTaskFinish(r)
|
|
365
365
|
};
|
|
366
366
|
}
|
|
367
|
-
const
|
|
367
|
+
const rn = "__YC_AI_TASK_CTX_KEY__", un = "__YC_AI_TASK_STORE_KEY__";
|
|
368
368
|
function ct(e) {
|
|
369
369
|
const n = globalThis;
|
|
370
370
|
return n[e] || (n[e] = Symbol(e)), n[e];
|
|
371
371
|
}
|
|
372
|
-
const dt = ct(
|
|
372
|
+
const dt = ct(rn), ft = ct(un), cn = async (e) => (await ce().post(
|
|
373
373
|
"/yc-ai/workflows/runs",
|
|
374
374
|
e
|
|
375
|
-
)).data, pt = async (e) => (await
|
|
375
|
+
)).data, pt = async (e) => (await ce().get(`/yc-ai/workflows/runs/${e}`)).data, dn = (e) => ce().post(`/yc-ai/workflows/runs/${e}/cancel`), fn = (e, n) => ce().post(`/yc-ai/workflows/runs/${e}/client-continue`, n);
|
|
376
376
|
async function De(e, n) {
|
|
377
|
-
return
|
|
377
|
+
return Jt(e, n);
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function pn(e, n) {
|
|
380
380
|
const t = e.trim();
|
|
381
381
|
if (!t)
|
|
382
382
|
return n;
|
|
@@ -399,23 +399,23 @@ function fn(e, n) {
|
|
|
399
399
|
throw new Error(`自定义脚本执行失败: ${l instanceof Error ? l.message : String(l)}`);
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
|
-
async function
|
|
403
|
-
return (await
|
|
404
|
-
projectId:
|
|
402
|
+
async function mn(e) {
|
|
403
|
+
return (await cn({
|
|
404
|
+
projectId: qt(),
|
|
405
405
|
freeText: e.freeText,
|
|
406
406
|
promptId: e.promptId,
|
|
407
407
|
autoMatch: e.autoMatch
|
|
408
408
|
})).runId;
|
|
409
409
|
}
|
|
410
|
-
async function
|
|
410
|
+
async function gn(e, n) {
|
|
411
411
|
var o, l, g, w;
|
|
412
412
|
const t = await pt(e);
|
|
413
413
|
if (t.status === "WAITING_CLIENT" && t.waitingStepKey && t.waitingClientScript) {
|
|
414
414
|
(o = n == null ? void 0 : n.onProgress) == null || o.call(n, 60, `执行脚本:${t.waitingStepKey}`);
|
|
415
415
|
let S = {};
|
|
416
416
|
t.waitingArtifactId && (S = await De(e, t.waitingArtifactId));
|
|
417
|
-
const m =
|
|
418
|
-
return await
|
|
417
|
+
const m = pn(t.waitingClientScript, S);
|
|
418
|
+
return await fn(e, {
|
|
419
419
|
stepKey: t.waitingStepKey,
|
|
420
420
|
output: m ?? {}
|
|
421
421
|
}), null;
|
|
@@ -428,30 +428,30 @@ async function mn(e, n) {
|
|
|
428
428
|
}
|
|
429
429
|
return { phase: "SUCCEEDED", runId: e, result: {} };
|
|
430
430
|
}
|
|
431
|
-
return t.status === "FAILED" ? { phase: "FAILED", runId: e, errorMessage: t.errorMessage || "工作流失败" } : t.status === "CANCELLED" ? { phase: "FAILED", runId: e, errorMessage: "已取消" } : ((w = n == null ? void 0 : n.onProgress) == null || w.call(n,
|
|
431
|
+
return t.status === "FAILED" ? { phase: "FAILED", runId: e, errorMessage: t.errorMessage || "工作流失败" } : t.status === "CANCELLED" ? { phase: "FAILED", runId: e, errorMessage: "已取消" } : ((w = n == null ? void 0 : n.onProgress) == null || w.call(n, hn(t), yn(t)), null);
|
|
432
432
|
}
|
|
433
|
-
async function
|
|
433
|
+
async function vn(e) {
|
|
434
434
|
const n = await pt(e);
|
|
435
435
|
return n.status !== "SUCCEEDED" || !n.finalArtifactId ? null : await De(e, n.finalArtifactId);
|
|
436
436
|
}
|
|
437
|
-
async function
|
|
438
|
-
await
|
|
437
|
+
async function _n(e) {
|
|
438
|
+
await dn(e);
|
|
439
439
|
}
|
|
440
|
-
function
|
|
440
|
+
function hn(e) {
|
|
441
441
|
if (e.status === "PENDING") return 8;
|
|
442
442
|
const n = e.steps ?? [];
|
|
443
443
|
if (!n.length) return 35;
|
|
444
444
|
const t = n.filter((o) => o.status === "SUCCEEDED" || o.status === "SKIPPED").length;
|
|
445
445
|
return Math.min(90, Math.round(20 + t / n.length * 70));
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function yn(e) {
|
|
448
448
|
var t;
|
|
449
449
|
if (e.status === "PENDING") return "排队中…";
|
|
450
450
|
const n = (t = e.steps) == null ? void 0 : t.find((o) => o.status === "RUNNING");
|
|
451
451
|
return n ? `执行中:${n.stepKey}` : "后端处理中…";
|
|
452
452
|
}
|
|
453
453
|
const mt = 80;
|
|
454
|
-
function
|
|
454
|
+
function wn() {
|
|
455
455
|
try {
|
|
456
456
|
const e = localStorage.getItem(st());
|
|
457
457
|
if (!e) return [];
|
|
@@ -461,7 +461,7 @@ function yn() {
|
|
|
461
461
|
return [];
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function Tn(e) {
|
|
465
465
|
const n = e.slice(0, mt).map((t) => ({
|
|
466
466
|
id: t.id,
|
|
467
467
|
title: t.title,
|
|
@@ -478,66 +478,66 @@ function wn(e) {
|
|
|
478
478
|
}));
|
|
479
479
|
localStorage.setItem(st(), JSON.stringify(n));
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function In(e) {
|
|
482
482
|
return {
|
|
483
483
|
...e,
|
|
484
484
|
logs: e.runId ? [`ℹ 已从本地恢复,runId=${e.runId}`] : [],
|
|
485
485
|
result: void 0
|
|
486
486
|
};
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function oe(e) {
|
|
489
489
|
return e === "pending" || e === "running";
|
|
490
490
|
}
|
|
491
|
-
let Be = 0,
|
|
492
|
-
const
|
|
493
|
-
function
|
|
491
|
+
let Be = 0, me = null;
|
|
492
|
+
const Cn = 5e3;
|
|
493
|
+
function Sn() {
|
|
494
494
|
return Be += 1, `ai_task_${Date.now()}_${Be}`;
|
|
495
495
|
}
|
|
496
|
-
function
|
|
496
|
+
function kn(e, n = 28) {
|
|
497
497
|
const t = e.trim();
|
|
498
498
|
return t.length <= n ? t : `${t.slice(0, n)}…`;
|
|
499
499
|
}
|
|
500
|
-
const gt =
|
|
500
|
+
const gt = jt("ycAiTask", () => {
|
|
501
501
|
const e = k([]), n = k(!1), t = k(!1), o = k(!1), l = k({}), g = k(!1), w = /* @__PURE__ */ new Set(), S = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Set();
|
|
502
|
-
function r(a,
|
|
502
|
+
function r(a, u) {
|
|
503
503
|
return {
|
|
504
504
|
taskId: a.id,
|
|
505
505
|
runId: a.runId,
|
|
506
506
|
title: a.title,
|
|
507
507
|
freeText: a.freeText,
|
|
508
508
|
promptId: a.promptId,
|
|
509
|
-
result:
|
|
509
|
+
result: u,
|
|
510
510
|
finishedAt: a.finishedAt ?? Date.now()
|
|
511
511
|
};
|
|
512
512
|
}
|
|
513
|
-
function
|
|
514
|
-
var
|
|
515
|
-
const
|
|
516
|
-
if (!(
|
|
517
|
-
const
|
|
518
|
-
(
|
|
513
|
+
function L(a, u) {
|
|
514
|
+
var se;
|
|
515
|
+
const c = e.value.find((fe) => fe.id === a);
|
|
516
|
+
if (!(c != null && c.runId)) return;
|
|
517
|
+
const R = r(c, u);
|
|
518
|
+
(se = S.get(a)) == null || se(R), S.delete(a), m.forEach((fe) => fe(R));
|
|
519
519
|
}
|
|
520
|
-
function
|
|
520
|
+
function U(a) {
|
|
521
521
|
return m.add(a), () => m.delete(a);
|
|
522
522
|
}
|
|
523
|
-
const
|
|
524
|
-
() => e.value.filter((a) =>
|
|
525
|
-
),
|
|
526
|
-
const a = e.value.length,
|
|
527
|
-
return a === 0 ? "暂无任务" :
|
|
523
|
+
const E = B(
|
|
524
|
+
() => e.value.filter((a) => oe(a.status)).length
|
|
525
|
+
), D = B(() => e.value.filter((a) => a.status === "running").length), N = B(() => E.value > 0 ? "AI 处理中" : e.value.some((a) => a.status === "failed") ? "部分任务失败" : "AI 任务"), y = B(() => {
|
|
526
|
+
const a = e.value.length, u = E.value;
|
|
527
|
+
return a === 0 ? "暂无任务" : u > 0 ? `${u}/${a} 项任务进行中` : `${a} 项任务已完成`;
|
|
528
528
|
});
|
|
529
529
|
function $() {
|
|
530
|
-
|
|
530
|
+
Tn(e.value);
|
|
531
531
|
}
|
|
532
|
-
function z(a,
|
|
533
|
-
const
|
|
534
|
-
|
|
532
|
+
function z(a, u) {
|
|
533
|
+
const c = e.value.findIndex((R) => R.id === a);
|
|
534
|
+
c >= 0 && (e.value[c] = { ...e.value[c], ...u }, $());
|
|
535
535
|
}
|
|
536
|
-
function C(a,
|
|
537
|
-
const
|
|
538
|
-
|
|
536
|
+
function C(a, u) {
|
|
537
|
+
const c = e.value.find((R) => R.id === a);
|
|
538
|
+
c && (c.logs.unshift(u), c.logs.length > 20 && c.logs.pop());
|
|
539
539
|
}
|
|
540
|
-
function
|
|
540
|
+
function F() {
|
|
541
541
|
n.value = !0, t.value = !1;
|
|
542
542
|
}
|
|
543
543
|
function Y() {
|
|
@@ -553,73 +553,73 @@ const gt = Wt("ycAiTask", () => {
|
|
|
553
553
|
o.value = !1, rt();
|
|
554
554
|
}
|
|
555
555
|
function H() {
|
|
556
|
-
|
|
556
|
+
me || (me = setInterval(() => {
|
|
557
557
|
J();
|
|
558
|
-
},
|
|
558
|
+
}, Cn));
|
|
559
559
|
}
|
|
560
560
|
function x() {
|
|
561
|
-
|
|
561
|
+
E.value > 0 || me && (clearInterval(me), me = null);
|
|
562
562
|
}
|
|
563
563
|
async function J() {
|
|
564
|
-
const a = e.value.filter((
|
|
564
|
+
const a = e.value.filter((u) => u.runId && oe(u.status));
|
|
565
565
|
if (!a.length) {
|
|
566
566
|
x();
|
|
567
567
|
return;
|
|
568
568
|
}
|
|
569
|
-
await Promise.all(a.map((
|
|
569
|
+
await Promise.all(a.map((u) => X(u.id)));
|
|
570
570
|
}
|
|
571
571
|
async function X(a) {
|
|
572
572
|
if (w.has(a)) return;
|
|
573
|
-
const
|
|
574
|
-
if (!(!(
|
|
573
|
+
const u = e.value.find((c) => c.id === a);
|
|
574
|
+
if (!(!(u != null && u.runId) || !oe(u.status))) {
|
|
575
575
|
w.add(a);
|
|
576
576
|
try {
|
|
577
|
-
const
|
|
578
|
-
onProgress: (
|
|
577
|
+
const c = await gn(u.runId, {
|
|
578
|
+
onProgress: (R, se) => z(a, { progress: R, summary: se, status: "running" })
|
|
579
579
|
});
|
|
580
|
-
if (!
|
|
581
|
-
if (
|
|
582
|
-
const
|
|
580
|
+
if (!c) return;
|
|
581
|
+
if (c.phase === "SUCCEEDED") {
|
|
582
|
+
const R = c.result ?? {};
|
|
583
583
|
z(a, {
|
|
584
584
|
status: "succeeded",
|
|
585
585
|
progress: 100,
|
|
586
586
|
summary: "已完成",
|
|
587
|
-
result:
|
|
588
|
-
runId:
|
|
587
|
+
result: R,
|
|
588
|
+
runId: c.runId,
|
|
589
589
|
finishedAt: Date.now()
|
|
590
|
-
}),
|
|
590
|
+
}), L(a, R);
|
|
591
591
|
} else
|
|
592
592
|
z(a, {
|
|
593
|
-
status:
|
|
593
|
+
status: c.errorMessage === "已取消" ? "cancelled" : "failed",
|
|
594
594
|
progress: 100,
|
|
595
|
-
summary:
|
|
596
|
-
errorMessage:
|
|
597
|
-
runId:
|
|
595
|
+
summary: c.errorMessage || "失败",
|
|
596
|
+
errorMessage: c.errorMessage,
|
|
597
|
+
runId: c.runId,
|
|
598
598
|
finishedAt: Date.now()
|
|
599
599
|
});
|
|
600
600
|
x();
|
|
601
|
-
} catch (
|
|
602
|
-
const
|
|
603
|
-
C(a, `✗ ${
|
|
601
|
+
} catch (c) {
|
|
602
|
+
const R = c instanceof Error ? c.message : "同步失败";
|
|
603
|
+
C(a, `✗ ${R}`);
|
|
604
604
|
} finally {
|
|
605
605
|
w.delete(a);
|
|
606
606
|
}
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
|
-
async function
|
|
609
|
+
async function ne() {
|
|
610
610
|
if (g.value) return;
|
|
611
611
|
g.value = !0;
|
|
612
|
-
const a =
|
|
613
|
-
a.length && (e.value = a.map(
|
|
614
|
-
const
|
|
615
|
-
|
|
616
|
-
for (const
|
|
617
|
-
|
|
612
|
+
const a = wn();
|
|
613
|
+
a.length && (e.value = a.map(In), Be = a.length);
|
|
614
|
+
const u = e.value.filter((c) => c.runId && oe(c.status));
|
|
615
|
+
u.length && (await Promise.all(u.map((c) => X(c.id))), H());
|
|
616
|
+
for (const c of e.value)
|
|
617
|
+
c.status === "pending" && !c.runId && z(c.id, { status: "failed", summary: "页面刷新前未提交成功", finishedAt: Date.now() });
|
|
618
618
|
}
|
|
619
|
-
function
|
|
620
|
-
const
|
|
621
|
-
id:
|
|
622
|
-
title: a.title ??
|
|
619
|
+
function K(a) {
|
|
620
|
+
const u = Sn(), c = {
|
|
621
|
+
id: u,
|
|
622
|
+
title: a.title ?? kn(a.freeText),
|
|
623
623
|
freeText: a.freeText.trim(),
|
|
624
624
|
promptId: a.promptId,
|
|
625
625
|
autoMatch: a.autoMatch,
|
|
@@ -629,59 +629,59 @@ const gt = Wt("ycAiTask", () => {
|
|
|
629
629
|
createdAt: Date.now(),
|
|
630
630
|
logs: []
|
|
631
631
|
};
|
|
632
|
-
return e.value.unshift(
|
|
632
|
+
return e.value.unshift(c), $(), a.onFinish && S.set(u, a.onFinish), a.showPanel !== !1 && F(), ie(u), u;
|
|
633
633
|
}
|
|
634
|
-
async function
|
|
635
|
-
const
|
|
636
|
-
if (
|
|
634
|
+
async function ie(a) {
|
|
635
|
+
const u = e.value.find((c) => c.id === a);
|
|
636
|
+
if (u)
|
|
637
637
|
try {
|
|
638
|
-
const
|
|
639
|
-
freeText:
|
|
640
|
-
promptId:
|
|
641
|
-
autoMatch:
|
|
638
|
+
const c = await mn({
|
|
639
|
+
freeText: u.freeText,
|
|
640
|
+
promptId: u.promptId,
|
|
641
|
+
autoMatch: u.autoMatch
|
|
642
642
|
});
|
|
643
643
|
z(a, {
|
|
644
|
-
runId:
|
|
644
|
+
runId: c,
|
|
645
645
|
status: "running",
|
|
646
646
|
progress: 10,
|
|
647
647
|
summary: "后端异步处理中…"
|
|
648
|
-
}), C(a, `▶ 已提交 runId=${
|
|
649
|
-
} catch (
|
|
650
|
-
const
|
|
648
|
+
}), C(a, `▶ 已提交 runId=${c}`), H(), X(a);
|
|
649
|
+
} catch (c) {
|
|
650
|
+
const R = c instanceof Error ? c.message : "提交失败";
|
|
651
651
|
z(a, {
|
|
652
652
|
status: "failed",
|
|
653
653
|
progress: 100,
|
|
654
|
-
summary:
|
|
655
|
-
errorMessage:
|
|
654
|
+
summary: R,
|
|
655
|
+
errorMessage: R,
|
|
656
656
|
finishedAt: Date.now()
|
|
657
657
|
});
|
|
658
658
|
}
|
|
659
659
|
}
|
|
660
660
|
async function j(a) {
|
|
661
|
-
const
|
|
662
|
-
if (!(
|
|
663
|
-
if (
|
|
664
|
-
const
|
|
665
|
-
return
|
|
661
|
+
const u = e.value.find((R) => R.id === a);
|
|
662
|
+
if (!(u != null && u.runId)) return null;
|
|
663
|
+
if (u.result) return u.result;
|
|
664
|
+
const c = await vn(u.runId);
|
|
665
|
+
return c && z(a, { result: c }), c;
|
|
666
666
|
}
|
|
667
|
-
async function
|
|
668
|
-
const
|
|
669
|
-
if (
|
|
667
|
+
async function de(a) {
|
|
668
|
+
const u = e.value.find((c) => c.id === a);
|
|
669
|
+
if (u != null && u.runId && oe(u.status))
|
|
670
670
|
try {
|
|
671
|
-
await
|
|
671
|
+
await _n(u.runId);
|
|
672
672
|
} catch {
|
|
673
673
|
}
|
|
674
|
-
|
|
674
|
+
u && oe(u.status) && z(a, { status: "cancelled", summary: "已取消", finishedAt: Date.now() }), S.delete(a), x();
|
|
675
675
|
}
|
|
676
|
-
function
|
|
676
|
+
function he() {
|
|
677
677
|
for (const a of e.value)
|
|
678
|
-
|
|
678
|
+
oe(a.status) && de(a.id);
|
|
679
679
|
}
|
|
680
680
|
function ke() {
|
|
681
|
-
e.value = e.value.filter((a) =>
|
|
681
|
+
e.value = e.value.filter((a) => oe(a.status)), $();
|
|
682
682
|
}
|
|
683
|
-
function
|
|
684
|
-
|
|
683
|
+
function ye(a) {
|
|
684
|
+
de(a), S.delete(a), e.value = e.value.filter((u) => u.id !== a), $();
|
|
685
685
|
}
|
|
686
686
|
return {
|
|
687
687
|
tasks: e,
|
|
@@ -690,28 +690,28 @@ const gt = Wt("ycAiTask", () => {
|
|
|
690
690
|
dialogVisible: o,
|
|
691
691
|
dialogOptions: l,
|
|
692
692
|
hydrated: g,
|
|
693
|
-
runningCount:
|
|
694
|
-
activeCount:
|
|
693
|
+
runningCount: E,
|
|
694
|
+
activeCount: D,
|
|
695
695
|
panelTitle: N,
|
|
696
696
|
panelSubtitle: y,
|
|
697
|
-
hydrate:
|
|
698
|
-
showPanel:
|
|
697
|
+
hydrate: ne,
|
|
698
|
+
showPanel: F,
|
|
699
699
|
hidePanel: Y,
|
|
700
700
|
toggleMinimize: v,
|
|
701
701
|
openDialog: T,
|
|
702
702
|
closeDialog: W,
|
|
703
|
-
enqueue:
|
|
704
|
-
onTaskFinish:
|
|
703
|
+
enqueue: K,
|
|
704
|
+
onTaskFinish: U,
|
|
705
705
|
refreshActiveTasks: J,
|
|
706
706
|
loadTaskResult: j,
|
|
707
|
-
cancelTask:
|
|
708
|
-
cancelAll:
|
|
707
|
+
cancelTask: de,
|
|
708
|
+
cancelAll: he,
|
|
709
709
|
clearFinished: ke,
|
|
710
|
-
removeTask:
|
|
710
|
+
removeTask: ye
|
|
711
711
|
};
|
|
712
712
|
});
|
|
713
|
-
async function
|
|
714
|
-
return (await
|
|
713
|
+
async function xn(e) {
|
|
714
|
+
return (await ce().get("/yc-ai/ai/prompts", {
|
|
715
715
|
params: e ? { category: e } : {}
|
|
716
716
|
})).data;
|
|
717
717
|
}
|
|
@@ -719,7 +719,7 @@ function ze() {
|
|
|
719
719
|
const e = Oe(ft, null);
|
|
720
720
|
return e || gt();
|
|
721
721
|
}
|
|
722
|
-
const
|
|
722
|
+
const bn = { class: "ai-use-dialog__footer" }, An = { class: "ai-use-dialog__footer-actions" }, Mn = /* @__PURE__ */ ue({
|
|
723
723
|
__name: "AiUseDialog",
|
|
724
724
|
props: {
|
|
725
725
|
title: { default: "AI 生成" },
|
|
@@ -742,21 +742,21 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
742
742
|
},
|
|
743
743
|
emits: ["update:modelValue", "submitted"],
|
|
744
744
|
setup(e, { emit: n }) {
|
|
745
|
-
const t = e, o = n, l = ze(), g =
|
|
746
|
-
|
|
745
|
+
const t = e, o = n, l = ze(), g = B(() => t.modelValue !== void 0), w = k(!1);
|
|
746
|
+
te(
|
|
747
747
|
() => t.modelValue,
|
|
748
748
|
(v) => {
|
|
749
749
|
g.value && (w.value = !!v);
|
|
750
750
|
},
|
|
751
751
|
{ immediate: !0 }
|
|
752
|
-
),
|
|
752
|
+
), te(w, (v) => {
|
|
753
753
|
if (g.value) {
|
|
754
754
|
o("update:modelValue", v);
|
|
755
755
|
return;
|
|
756
756
|
}
|
|
757
|
-
|
|
758
|
-
}),
|
|
759
|
-
() =>
|
|
757
|
+
ee.visible = v, v || rt();
|
|
758
|
+
}), te(
|
|
759
|
+
() => ee.visible,
|
|
760
760
|
(v) => {
|
|
761
761
|
g.value || (w.value = v);
|
|
762
762
|
},
|
|
@@ -767,45 +767,45 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
767
767
|
const T = v.detail ?? {};
|
|
768
768
|
N(T), w.value = !0;
|
|
769
769
|
}
|
|
770
|
-
|
|
771
|
-
globalThis.addEventListener(Le, S), g.value || (w.value =
|
|
772
|
-
}),
|
|
770
|
+
Fe(() => {
|
|
771
|
+
globalThis.addEventListener(Le, S), g.value || (w.value = ee.visible);
|
|
772
|
+
}), Ue(() => {
|
|
773
773
|
globalThis.removeEventListener(Le, S);
|
|
774
774
|
});
|
|
775
|
-
const m =
|
|
776
|
-
() => (g.value ? void 0 :
|
|
775
|
+
const m = B(
|
|
776
|
+
() => (g.value ? void 0 : ee.options.title) ?? t.title ?? "AI 生成"
|
|
777
777
|
), r = k({
|
|
778
778
|
freeText: t.freeText,
|
|
779
779
|
promptId: t.promptId,
|
|
780
780
|
autoMatch: t.autoMatch
|
|
781
|
-
}),
|
|
781
|
+
}), L = k(t.prompts ? [...t.prompts] : []), U = k(!1), E = k(!1), D = k();
|
|
782
782
|
function N(v) {
|
|
783
783
|
var T, W;
|
|
784
|
-
r.value.freeText = v.freeText ?? t.freeText ?? "", r.value.promptId = v.promptId ?? t.promptId, r.value.autoMatch = v.autoMatch ?? t.autoMatch ?? !1,
|
|
784
|
+
r.value.freeText = v.freeText ?? t.freeText ?? "", r.value.promptId = v.promptId ?? t.promptId, r.value.autoMatch = v.autoMatch ?? t.autoMatch ?? !1, D.value = v.onFinish, (T = v.prompts) != null && T.length ? L.value = [...v.prompts] : (W = t.prompts) != null && W.length && (L.value = [...t.prompts]);
|
|
785
785
|
}
|
|
786
786
|
async function y() {
|
|
787
|
-
if (!(
|
|
788
|
-
|
|
787
|
+
if (!(L.value.length > 0)) {
|
|
788
|
+
U.value = !0;
|
|
789
789
|
try {
|
|
790
790
|
const v = it().listPrompts;
|
|
791
|
-
|
|
791
|
+
L.value = v ? await v() : await xn();
|
|
792
792
|
} catch {
|
|
793
|
-
|
|
793
|
+
Z.warning("加载提示词失败");
|
|
794
794
|
} finally {
|
|
795
|
-
|
|
795
|
+
U.value = !1;
|
|
796
796
|
}
|
|
797
797
|
}
|
|
798
798
|
}
|
|
799
799
|
function $() {
|
|
800
|
-
g.value ? N({}) : N(
|
|
800
|
+
g.value ? N({}) : N(ee.options), t.showPromptSelect && y();
|
|
801
801
|
}
|
|
802
|
-
|
|
802
|
+
te(
|
|
803
803
|
() => t.prompts,
|
|
804
804
|
(v) => {
|
|
805
|
-
v != null && v.length && (
|
|
805
|
+
v != null && v.length && (L.value = [...v]);
|
|
806
806
|
},
|
|
807
807
|
{ deep: !0 }
|
|
808
|
-
),
|
|
808
|
+
), te(
|
|
809
809
|
() => [t.freeText, t.promptId, t.autoMatch],
|
|
810
810
|
([v, T, W]) => {
|
|
811
811
|
w.value || (r.value.freeText = v ?? "", r.value.promptId = T, r.value.autoMatch = W ?? !1);
|
|
@@ -815,36 +815,36 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
815
815
|
r.value.autoMatch && (r.value.promptId = void 0);
|
|
816
816
|
}
|
|
817
817
|
function C() {
|
|
818
|
-
|
|
818
|
+
E.value = !1;
|
|
819
819
|
}
|
|
820
|
-
function
|
|
820
|
+
function F() {
|
|
821
821
|
l.showPanel();
|
|
822
822
|
}
|
|
823
823
|
async function Y() {
|
|
824
824
|
var x, J;
|
|
825
825
|
if (!r.value.freeText.trim()) {
|
|
826
|
-
|
|
826
|
+
Z.warning("请填写需求描述");
|
|
827
827
|
return;
|
|
828
828
|
}
|
|
829
829
|
const v = r.value.autoMatch, T = v ? void 0 : r.value.promptId;
|
|
830
830
|
if (!v && T == null) {
|
|
831
831
|
const X = t.showPromptSelect || t.showAutoMatch ? "请选择提示词或开启自动匹配" : "请通过 promptId 传入提示词,或设置 autoMatch 为 true";
|
|
832
|
-
|
|
832
|
+
Z.warning(X);
|
|
833
833
|
return;
|
|
834
834
|
}
|
|
835
|
-
|
|
836
|
-
const W = g.value ?
|
|
835
|
+
E.value = !0;
|
|
836
|
+
const W = g.value ? D.value : ee.options.onFinish, H = l.enqueue({
|
|
837
837
|
freeText: r.value.freeText.trim(),
|
|
838
838
|
promptId: T,
|
|
839
839
|
autoMatch: v && T == null ? !0 : void 0,
|
|
840
840
|
showPanel: !0,
|
|
841
841
|
onFinish: W
|
|
842
842
|
});
|
|
843
|
-
g.value ? o("submitted", H) : (J = (x =
|
|
843
|
+
g.value ? o("submitted", H) : (J = (x = ee.options).onSubmitted) == null || J.call(x, H), w.value = !1, E.value = !1, Z.success("已加入任务队列,可在任务面板查看进度");
|
|
844
844
|
}
|
|
845
845
|
return (v, T) => {
|
|
846
|
-
const W =
|
|
847
|
-
return
|
|
846
|
+
const W = O("el-switch"), H = O("el-form-item"), x = O("el-option"), J = O("el-select"), X = O("el-input"), ne = O("el-form"), K = O("el-button"), ie = O("el-dialog");
|
|
847
|
+
return d(), M(ie, {
|
|
848
848
|
modelValue: w.value,
|
|
849
849
|
"onUpdate:modelValue": T[4] || (T[4] = (j) => w.value = j),
|
|
850
850
|
title: m.value,
|
|
@@ -855,20 +855,20 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
855
855
|
onOpen: $
|
|
856
856
|
}, {
|
|
857
857
|
footer: p(() => [
|
|
858
|
-
_("div",
|
|
859
|
-
e.showTaskListButton ? (
|
|
858
|
+
_("div", bn, [
|
|
859
|
+
e.showTaskListButton ? (d(), M(K, {
|
|
860
860
|
key: 0,
|
|
861
861
|
link: "",
|
|
862
862
|
type: "primary",
|
|
863
|
-
onClick:
|
|
863
|
+
onClick: F
|
|
864
864
|
}, {
|
|
865
865
|
default: p(() => [
|
|
866
|
-
q(
|
|
866
|
+
q(V(e.taskListButtonText), 1)
|
|
867
867
|
]),
|
|
868
868
|
_: 1
|
|
869
869
|
})) : P("", !0),
|
|
870
|
-
_("div",
|
|
871
|
-
f(
|
|
870
|
+
_("div", An, [
|
|
871
|
+
f(K, {
|
|
872
872
|
onClick: T[3] || (T[3] = (j) => w.value = !1)
|
|
873
873
|
}, {
|
|
874
874
|
default: p(() => [...T[5] || (T[5] = [
|
|
@@ -876,13 +876,13 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
876
876
|
])]),
|
|
877
877
|
_: 1
|
|
878
878
|
}),
|
|
879
|
-
f(
|
|
879
|
+
f(K, {
|
|
880
880
|
type: "primary",
|
|
881
|
-
loading:
|
|
881
|
+
loading: E.value,
|
|
882
882
|
onClick: Y
|
|
883
883
|
}, {
|
|
884
884
|
default: p(() => [
|
|
885
|
-
q(
|
|
885
|
+
q(V(e.submitText), 1)
|
|
886
886
|
]),
|
|
887
887
|
_: 1
|
|
888
888
|
}, 8, ["loading"])
|
|
@@ -890,9 +890,9 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
890
890
|
])
|
|
891
891
|
]),
|
|
892
892
|
default: p(() => [
|
|
893
|
-
f(
|
|
893
|
+
f(ne, { "label-position": "top" }, {
|
|
894
894
|
default: p(() => [
|
|
895
|
-
e.showAutoMatch ? (
|
|
895
|
+
e.showAutoMatch ? (d(), M(H, {
|
|
896
896
|
key: 0,
|
|
897
897
|
label: e.autoMatchLabel
|
|
898
898
|
}, {
|
|
@@ -907,7 +907,7 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
907
907
|
]),
|
|
908
908
|
_: 1
|
|
909
909
|
}, 8, ["label"])) : P("", !0),
|
|
910
|
-
e.showPromptSelect ? (
|
|
910
|
+
e.showPromptSelect ? (d(), M(H, {
|
|
911
911
|
key: 1,
|
|
912
912
|
label: e.promptLabel,
|
|
913
913
|
required: !r.value.autoMatch
|
|
@@ -920,10 +920,10 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
920
920
|
clearable: "",
|
|
921
921
|
placeholder: r.value.autoMatch ? "留空则自动匹配" : "请选择提示词",
|
|
922
922
|
style: { width: "100%" },
|
|
923
|
-
loading:
|
|
923
|
+
loading: U.value
|
|
924
924
|
}, {
|
|
925
925
|
default: p(() => [
|
|
926
|
-
(
|
|
926
|
+
(d(!0), A(ae, null, ge(L.value, (j) => (d(), M(x, {
|
|
927
927
|
key: j.id,
|
|
928
928
|
label: j.name,
|
|
929
929
|
value: j.id
|
|
@@ -957,16 +957,16 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
957
957
|
}, 8, ["modelValue", "title", "width"]);
|
|
958
958
|
};
|
|
959
959
|
}
|
|
960
|
-
}),
|
|
960
|
+
}), En = /* @__PURE__ */ Se(Mn, [["__scopeId", "data-v-9aa82e83"]]), $n = { class: "ai-task-panel" }, Pn = { class: "ai-task-panel__header" }, Ln = { class: "ai-task-panel__header-left" }, Dn = { class: "ai-task-panel__titles" }, Bn = { class: "ai-task-panel__subtitle" }, Vn = { class: "ai-task-panel__title" }, On = { class: "ai-task-panel__header-actions" }, Fn = { class: "ai-task-panel__body" }, Un = {
|
|
961
961
|
key: 1,
|
|
962
962
|
class: "ai-task-list"
|
|
963
|
-
}, Rn = { class: "ai-task-row__icon" },
|
|
963
|
+
}, Rn = { class: "ai-task-row__icon" }, Kn = { class: "ai-task-row__main" }, Nn = { class: "ai-task-row__title" }, zn = { class: "ai-task-row__meta" }, Yn = { key: 0 }, Wn = {
|
|
964
964
|
key: 0,
|
|
965
965
|
class: "ai-task-row__summary"
|
|
966
|
-
},
|
|
966
|
+
}, jn = { class: "ai-task-row__ops" }, Gn = {
|
|
967
967
|
key: 0,
|
|
968
968
|
class: "ai-task-panel__footer"
|
|
969
|
-
},
|
|
969
|
+
}, qn = /* @__PURE__ */ ue({
|
|
970
970
|
__name: "AiTaskPanel",
|
|
971
971
|
emits: ["use"],
|
|
972
972
|
setup(e, { emit: n }) {
|
|
@@ -999,30 +999,30 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
999
999
|
}
|
|
1000
1000
|
}
|
|
1001
1001
|
return (m, r) => {
|
|
1002
|
-
const
|
|
1003
|
-
return
|
|
1002
|
+
const L = O("el-icon"), U = O("el-button"), E = O("el-empty"), D = O("el-progress"), N = O("el-badge");
|
|
1003
|
+
return d(), M(Et, { to: "body" }, [
|
|
1004
1004
|
f(tt, { name: "ai-panel-slide" }, {
|
|
1005
1005
|
default: p(() => [
|
|
1006
|
-
|
|
1007
|
-
_("div",
|
|
1008
|
-
_("div",
|
|
1006
|
+
ve(_("div", $n, [
|
|
1007
|
+
_("div", Pn, [
|
|
1008
|
+
_("div", Ln, [
|
|
1009
1009
|
_("div", {
|
|
1010
|
-
class:
|
|
1010
|
+
class: re(["ai-task-panel__icon", { spinning: h(o).activeCount > 0 }])
|
|
1011
1011
|
}, [
|
|
1012
|
-
f(
|
|
1012
|
+
f(L, null, {
|
|
1013
1013
|
default: p(() => [
|
|
1014
1014
|
f(h(Xe))
|
|
1015
1015
|
]),
|
|
1016
1016
|
_: 1
|
|
1017
1017
|
})
|
|
1018
1018
|
], 2),
|
|
1019
|
-
_("div",
|
|
1020
|
-
_("div",
|
|
1021
|
-
_("div",
|
|
1019
|
+
_("div", Dn, [
|
|
1020
|
+
_("div", Bn, V(h(o).panelSubtitle), 1),
|
|
1021
|
+
_("div", Vn, V(h(o).panelTitle), 1)
|
|
1022
1022
|
])
|
|
1023
1023
|
]),
|
|
1024
|
-
_("div",
|
|
1025
|
-
h(o).runningCount > 0 ? (
|
|
1024
|
+
_("div", On, [
|
|
1025
|
+
h(o).runningCount > 0 ? (d(), M(U, {
|
|
1026
1026
|
key: 0,
|
|
1027
1027
|
link: "",
|
|
1028
1028
|
type: "primary",
|
|
@@ -1033,12 +1033,12 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
1033
1033
|
])]),
|
|
1034
1034
|
_: 1
|
|
1035
1035
|
})) : P("", !0),
|
|
1036
|
-
f(
|
|
1036
|
+
f(U, {
|
|
1037
1037
|
link: "",
|
|
1038
1038
|
onClick: r[1] || (r[1] = (y) => h(o).toggleMinimize())
|
|
1039
1039
|
}, {
|
|
1040
1040
|
default: p(() => [
|
|
1041
|
-
f(
|
|
1041
|
+
f(L, null, {
|
|
1042
1042
|
default: p(() => [
|
|
1043
1043
|
f(h(Ut))
|
|
1044
1044
|
]),
|
|
@@ -1047,12 +1047,12 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
1047
1047
|
]),
|
|
1048
1048
|
_: 1
|
|
1049
1049
|
}),
|
|
1050
|
-
f(
|
|
1050
|
+
f(U, {
|
|
1051
1051
|
link: "",
|
|
1052
1052
|
onClick: r[2] || (r[2] = (y) => h(o).hidePanel())
|
|
1053
1053
|
}, {
|
|
1054
1054
|
default: p(() => [
|
|
1055
|
-
f(
|
|
1055
|
+
f(L, null, {
|
|
1056
1056
|
default: p(() => [
|
|
1057
1057
|
f(h(at))
|
|
1058
1058
|
]),
|
|
@@ -1063,14 +1063,14 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
1063
1063
|
})
|
|
1064
1064
|
])
|
|
1065
1065
|
]),
|
|
1066
|
-
_("div",
|
|
1067
|
-
h(o).tasks.length ? (
|
|
1068
|
-
(
|
|
1066
|
+
_("div", Fn, [
|
|
1067
|
+
h(o).tasks.length ? (d(), A("div", Un, [
|
|
1068
|
+
(d(!0), A(ae, null, ge(h(o).tasks, (y) => (d(), A("div", {
|
|
1069
1069
|
key: y.id,
|
|
1070
1070
|
class: "ai-task-row"
|
|
1071
1071
|
}, [
|
|
1072
1072
|
_("div", Rn, [
|
|
1073
|
-
y.status === "succeeded" ? (
|
|
1073
|
+
y.status === "succeeded" ? (d(), M(L, {
|
|
1074
1074
|
key: 0,
|
|
1075
1075
|
class: "ok"
|
|
1076
1076
|
}, {
|
|
@@ -1078,40 +1078,40 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
1078
1078
|
f(h(Rt))
|
|
1079
1079
|
]),
|
|
1080
1080
|
_: 1
|
|
1081
|
-
})) : y.status === "failed" ? (
|
|
1081
|
+
})) : y.status === "failed" ? (d(), M(L, {
|
|
1082
1082
|
key: 1,
|
|
1083
1083
|
class: "err"
|
|
1084
1084
|
}, {
|
|
1085
1085
|
default: p(() => [
|
|
1086
|
-
f(h(
|
|
1086
|
+
f(h(Kt))
|
|
1087
1087
|
]),
|
|
1088
1088
|
_: 1
|
|
1089
|
-
})) : y.status === "running" || y.status === "pending" ? (
|
|
1089
|
+
})) : y.status === "running" || y.status === "pending" ? (d(), M(D, {
|
|
1090
1090
|
key: 2,
|
|
1091
1091
|
type: "circle",
|
|
1092
1092
|
percentage: y.progress,
|
|
1093
1093
|
width: 36,
|
|
1094
1094
|
"stroke-width": 3
|
|
1095
|
-
}, null, 8, ["percentage"])) : (
|
|
1095
|
+
}, null, 8, ["percentage"])) : (d(), M(L, {
|
|
1096
1096
|
key: 3,
|
|
1097
1097
|
class: "muted"
|
|
1098
1098
|
}, {
|
|
1099
1099
|
default: p(() => [
|
|
1100
|
-
f(h(
|
|
1100
|
+
f(h(Nt))
|
|
1101
1101
|
]),
|
|
1102
1102
|
_: 1
|
|
1103
1103
|
}))
|
|
1104
1104
|
]),
|
|
1105
|
-
_("div",
|
|
1106
|
-
_("div",
|
|
1107
|
-
_("div",
|
|
1108
|
-
_("span", null,
|
|
1109
|
-
y.runId ? (
|
|
1105
|
+
_("div", Kn, [
|
|
1106
|
+
_("div", Nn, V(y.title), 1),
|
|
1107
|
+
_("div", zn, [
|
|
1108
|
+
_("span", null, V(w(y.status)), 1),
|
|
1109
|
+
y.runId ? (d(), A("span", Yn, " · #" + V(y.runId), 1)) : P("", !0)
|
|
1110
1110
|
]),
|
|
1111
|
-
y.summary ? (
|
|
1111
|
+
y.summary ? (d(), A("div", Wn, V(y.summary), 1)) : P("", !0)
|
|
1112
1112
|
]),
|
|
1113
|
-
_("div",
|
|
1114
|
-
y.status === "running" || y.status === "pending" ? (
|
|
1113
|
+
_("div", jn, [
|
|
1114
|
+
y.status === "running" || y.status === "pending" ? (d(), M(U, {
|
|
1115
1115
|
key: 0,
|
|
1116
1116
|
link: "",
|
|
1117
1117
|
type: "danger",
|
|
@@ -1123,7 +1123,7 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
1123
1123
|
])]),
|
|
1124
1124
|
_: 1
|
|
1125
1125
|
}, 8, ["onClick"])) : P("", !0),
|
|
1126
|
-
y.status === "succeeded" && y.runId ? (
|
|
1126
|
+
y.status === "succeeded" && y.runId ? (d(), M(U, {
|
|
1127
1127
|
key: 1,
|
|
1128
1128
|
link: "",
|
|
1129
1129
|
type: "primary",
|
|
@@ -1136,7 +1136,7 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
1136
1136
|
])]),
|
|
1137
1137
|
_: 1
|
|
1138
1138
|
}, 8, ["loading", "onClick"])) : P("", !0),
|
|
1139
|
-
y.status !== "running" && y.status !== "pending" ? (
|
|
1139
|
+
y.status !== "running" && y.status !== "pending" ? (d(), M(U, {
|
|
1140
1140
|
key: 2,
|
|
1141
1141
|
link: "",
|
|
1142
1142
|
size: "small",
|
|
@@ -1149,14 +1149,14 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
1149
1149
|
}, 8, ["onClick"])) : P("", !0)
|
|
1150
1150
|
])
|
|
1151
1151
|
]))), 128))
|
|
1152
|
-
])) : (
|
|
1152
|
+
])) : (d(), M(E, {
|
|
1153
1153
|
key: 0,
|
|
1154
1154
|
description: "暂无 AI 任务",
|
|
1155
1155
|
"image-size": 64
|
|
1156
1156
|
}))
|
|
1157
1157
|
]),
|
|
1158
|
-
h(o).tasks.some((y) => y.status !== "running" && y.status !== "pending") ? (
|
|
1159
|
-
f(
|
|
1158
|
+
h(o).tasks.some((y) => y.status !== "running" && y.status !== "pending") ? (d(), A("div", Gn, [
|
|
1159
|
+
f(U, {
|
|
1160
1160
|
link: "",
|
|
1161
1161
|
type: "info",
|
|
1162
1162
|
onClick: r[3] || (r[3] = (y) => h(o).clearFinished())
|
|
@@ -1173,11 +1173,11 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
1173
1173
|
]),
|
|
1174
1174
|
_: 1
|
|
1175
1175
|
}),
|
|
1176
|
-
|
|
1176
|
+
ve(_("div", {
|
|
1177
1177
|
class: "ai-task-panel-mini",
|
|
1178
1178
|
onClick: r[4] || (r[4] = (y) => h(o).toggleMinimize())
|
|
1179
1179
|
}, [
|
|
1180
|
-
h(o).activeCount > 0 ? (
|
|
1180
|
+
h(o).activeCount > 0 ? (d(), M(L, {
|
|
1181
1181
|
key: 0,
|
|
1182
1182
|
class: "spinning"
|
|
1183
1183
|
}, {
|
|
@@ -1186,8 +1186,8 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
1186
1186
|
]),
|
|
1187
1187
|
_: 1
|
|
1188
1188
|
})) : P("", !0),
|
|
1189
|
-
_("span", null,
|
|
1190
|
-
h(o).runningCount > 0 ? (
|
|
1189
|
+
_("span", null, V(h(o).panelSubtitle), 1),
|
|
1190
|
+
h(o).runningCount > 0 ? (d(), M(N, {
|
|
1191
1191
|
key: 1,
|
|
1192
1192
|
value: h(o).runningCount,
|
|
1193
1193
|
class: "m-l-8"
|
|
@@ -1198,7 +1198,7 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
1198
1198
|
]);
|
|
1199
1199
|
};
|
|
1200
1200
|
}
|
|
1201
|
-
}),
|
|
1201
|
+
}), Hn = /* @__PURE__ */ Se(qn, [["__scopeId", "data-v-812b3127"]]), Vo = /* @__PURE__ */ ue({
|
|
1202
1202
|
__name: "AiTaskProvider",
|
|
1203
1203
|
props: {
|
|
1204
1204
|
title: {},
|
|
@@ -1223,7 +1223,7 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
1223
1223
|
setup(e, { emit: n }) {
|
|
1224
1224
|
const t = e, o = n, l = gt();
|
|
1225
1225
|
$e(ft, l), $e(dt, ut(l));
|
|
1226
|
-
const g =
|
|
1226
|
+
const g = B(() => {
|
|
1227
1227
|
const m = {
|
|
1228
1228
|
title: t.title,
|
|
1229
1229
|
freeText: t.freeText,
|
|
@@ -1247,66 +1247,66 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
|
|
|
1247
1247
|
function S(m) {
|
|
1248
1248
|
o("use", m);
|
|
1249
1249
|
}
|
|
1250
|
-
return
|
|
1250
|
+
return Fe(() => {
|
|
1251
1251
|
l.hydrate(), w = l.onTaskFinish((m) => o("finish", m));
|
|
1252
|
-
}),
|
|
1252
|
+
}), Ue(() => {
|
|
1253
1253
|
w == null || w();
|
|
1254
|
-
}), (m, r) => (
|
|
1255
|
-
e.showDialog !== !1 ? (
|
|
1256
|
-
f(
|
|
1254
|
+
}), (m, r) => (d(), A(ae, null, [
|
|
1255
|
+
e.showDialog !== !1 ? (d(), M(En, $t(ot({ key: 0 }, g.value)), null, 16)) : P("", !0),
|
|
1256
|
+
f(Hn, { onUse: S }),
|
|
1257
1257
|
Ce(m.$slots, "default")
|
|
1258
1258
|
], 64));
|
|
1259
1259
|
}
|
|
1260
1260
|
});
|
|
1261
|
-
function
|
|
1261
|
+
function Oo() {
|
|
1262
1262
|
const e = Oe(dt, null);
|
|
1263
1263
|
return e || ut(ze());
|
|
1264
1264
|
}
|
|
1265
1265
|
const Me = "__YC_COMPONENT_IMAGE_SELECTOR__", Ve = "yc-component:image-selector-open";
|
|
1266
|
-
function
|
|
1266
|
+
function Jn() {
|
|
1267
1267
|
const e = globalThis;
|
|
1268
1268
|
return e[Me] || (e[Me] = nt({
|
|
1269
1269
|
visible: !1,
|
|
1270
1270
|
options: {}
|
|
1271
1271
|
})), e[Me];
|
|
1272
1272
|
}
|
|
1273
|
-
const G =
|
|
1274
|
-
function
|
|
1273
|
+
const G = Jn();
|
|
1274
|
+
function Xn(e = {}) {
|
|
1275
1275
|
G.options = { ...e }, G.visible = !0, globalThis.dispatchEvent(
|
|
1276
1276
|
new CustomEvent(Ve, { detail: { ...e } })
|
|
1277
1277
|
);
|
|
1278
1278
|
}
|
|
1279
|
-
function
|
|
1279
|
+
function Qn() {
|
|
1280
1280
|
G.visible = !1;
|
|
1281
1281
|
}
|
|
1282
|
-
function
|
|
1283
|
-
|
|
1282
|
+
function Zn(e = {}) {
|
|
1283
|
+
Xn(e);
|
|
1284
1284
|
}
|
|
1285
|
-
const
|
|
1285
|
+
const eo = { class: "yc-image-selector" }, to = { class: "yc-image-selector__toolbar" }, no = { class: "yc-image-selector__body" }, oo = {
|
|
1286
1286
|
key: 0,
|
|
1287
1287
|
class: "yc-image-selector__aside"
|
|
1288
|
-
},
|
|
1288
|
+
}, ao = ["onClick"], lo = {
|
|
1289
1289
|
key: 0,
|
|
1290
1290
|
class: "yc-image-selector__category-count"
|
|
1291
|
-
},
|
|
1291
|
+
}, io = { class: "yc-image-selector__main" }, so = {
|
|
1292
1292
|
key: 1,
|
|
1293
1293
|
class: "yc-image-selector__grid"
|
|
1294
|
-
},
|
|
1294
|
+
}, ro = ["onClick"], uo = { class: "yc-image-selector__thumb" }, co = ["src", "alt", "onLoad"], fo = {
|
|
1295
1295
|
key: 0,
|
|
1296
1296
|
class: "yc-image-selector__order"
|
|
1297
|
-
},
|
|
1297
|
+
}, po = ["title"], mo = {
|
|
1298
1298
|
key: 0,
|
|
1299
1299
|
class: "yc-image-selector__selected-bar"
|
|
1300
|
-
},
|
|
1300
|
+
}, go = { class: "yc-image-selector__selected-bar-label" }, vo = { class: "yc-image-selector__selected-bar-list" }, _o = ["onClick"], ho = ["src", "alt"], yo = {
|
|
1301
1301
|
key: 1,
|
|
1302
1302
|
class: "yc-image-selector__pagination"
|
|
1303
|
-
},
|
|
1303
|
+
}, wo = {
|
|
1304
1304
|
key: 0,
|
|
1305
1305
|
class: "yc-image-selector__footer"
|
|
1306
|
-
},
|
|
1306
|
+
}, To = { class: "yc-image-selector__selected-tip" }, Io = { class: "yc-image-selector__footer-actions" }, Co = {
|
|
1307
1307
|
key: 1,
|
|
1308
1308
|
class: "yc-image-selector__footer yc-image-selector__footer--quick"
|
|
1309
|
-
},
|
|
1309
|
+
}, So = { class: "yc-image-selector__selected-tip" }, ko = /* @__PURE__ */ ue({
|
|
1310
1310
|
__name: "YcImageSelectorDialog",
|
|
1311
1311
|
props: {
|
|
1312
1312
|
modelValue: { type: Boolean },
|
|
@@ -1327,268 +1327,272 @@ const Zn = { class: "yc-image-selector" }, eo = { class: "yc-image-selector__too
|
|
|
1327
1327
|
cancelText: { default: "取消" },
|
|
1328
1328
|
emptyText: { default: "暂无图片资源" },
|
|
1329
1329
|
getImages: {},
|
|
1330
|
-
upload: {}
|
|
1330
|
+
upload: {},
|
|
1331
|
+
urlField: { default: "url" }
|
|
1331
1332
|
},
|
|
1332
1333
|
emits: ["update:modelValue", "confirm", "cancel"],
|
|
1333
1334
|
setup(e, { emit: n }) {
|
|
1334
|
-
const t = e, o = n, l =
|
|
1335
|
-
|
|
1335
|
+
const t = e, o = n, l = B(() => t.modelValue !== void 0), g = k(!1);
|
|
1336
|
+
te(
|
|
1336
1337
|
() => t.modelValue,
|
|
1337
|
-
(
|
|
1338
|
-
l.value && (g.value = !!
|
|
1338
|
+
(i) => {
|
|
1339
|
+
l.value && (g.value = !!i);
|
|
1339
1340
|
},
|
|
1340
1341
|
{ immediate: !0 }
|
|
1341
|
-
),
|
|
1342
|
+
), te(g, (i) => {
|
|
1342
1343
|
if (l.value) {
|
|
1343
|
-
o("update:modelValue",
|
|
1344
|
+
o("update:modelValue", i);
|
|
1344
1345
|
return;
|
|
1345
1346
|
}
|
|
1346
|
-
G.visible =
|
|
1347
|
-
}),
|
|
1347
|
+
G.visible = i, i || Qn();
|
|
1348
|
+
}), te(
|
|
1348
1349
|
() => G.visible,
|
|
1349
|
-
(
|
|
1350
|
-
l.value || (g.value =
|
|
1350
|
+
(i) => {
|
|
1351
|
+
l.value || (g.value = i);
|
|
1351
1352
|
},
|
|
1352
1353
|
{ immediate: !0 }
|
|
1353
1354
|
);
|
|
1354
|
-
const w =
|
|
1355
|
+
const w = B(
|
|
1355
1356
|
() => (l.value ? void 0 : G.options.title) ?? t.title ?? "选择图片"
|
|
1356
|
-
), S =
|
|
1357
|
+
), S = B(
|
|
1357
1358
|
() => (l.value ? void 0 : G.options.multiple) ?? t.multiple
|
|
1358
|
-
), m =
|
|
1359
|
+
), m = B(
|
|
1359
1360
|
() => (l.value ? void 0 : G.options.maxCount) ?? t.maxCount
|
|
1360
|
-
), r =
|
|
1361
|
+
), r = B(
|
|
1361
1362
|
() => (l.value ? void 0 : G.options.showModeSwitch) ?? t.showModeSwitch
|
|
1362
|
-
),
|
|
1363
|
+
), L = B(
|
|
1363
1364
|
() => (l.value ? void 0 : G.options.showCategories) ?? t.showCategories
|
|
1364
|
-
),
|
|
1365
|
-
var
|
|
1366
|
-
if ((
|
|
1367
|
-
if (!l.value && ((
|
|
1365
|
+
), U = B(() => {
|
|
1366
|
+
var i, s;
|
|
1367
|
+
if ((i = t.categories) != null && i.length) return t.categories;
|
|
1368
|
+
if (!l.value && ((s = G.options.categories) != null && s.length))
|
|
1368
1369
|
return G.options.categories;
|
|
1369
|
-
}),
|
|
1370
|
+
}), E = B(() => L.value ? U.value ?? H.value : []), D = B(() => !!t.confirmOnSelect), N = k("single"), y = [
|
|
1370
1371
|
{ label: "单选", value: "single" },
|
|
1371
1372
|
{ label: "多选", value: "multiple" }
|
|
1372
|
-
], $ =
|
|
1373
|
+
], $ = B(
|
|
1373
1374
|
() => r.value ? N.value === "multiple" : S.value
|
|
1374
|
-
), z = k(""), C = k(""),
|
|
1375
|
-
var
|
|
1376
|
-
const
|
|
1377
|
-
return
|
|
1375
|
+
), z = k(""), C = k(""), F = k(1), Y = k(0), v = k(!1), T = k(!1), W = k([]), H = k([]), x = k(/* @__PURE__ */ new Map()), J = k(/* @__PURE__ */ new Map()), X = k(), ne = k(), K = B(() => [...x.value.values()]), ie = B(() => {
|
|
1376
|
+
var s, b;
|
|
1377
|
+
const i = K.value.length;
|
|
1378
|
+
return D.value ? i ? `已选:${((s = K.value[0]) == null ? void 0 : s.name) || "1 张图片"}` : "单击图片即可完成选择" : i ? $.value ? `已选 ${i} / ${m.value} 张` : `已选:${((b = K.value[0]) == null ? void 0 : b.name) || "1 张图片"}` : $.value ? `多选模式:最多 ${m.value} 张` : "单选模式:请选择一张图片";
|
|
1378
1379
|
});
|
|
1379
|
-
function j(
|
|
1380
|
-
const
|
|
1381
|
-
return
|
|
1380
|
+
function j(i) {
|
|
1381
|
+
const s = K.value.findIndex((b) => a(b) === a(i));
|
|
1382
|
+
return s >= 0 ? s + 1 : "";
|
|
1382
1383
|
}
|
|
1383
|
-
function
|
|
1384
|
-
if (
|
|
1385
|
-
const
|
|
1386
|
-
x.value = /* @__PURE__ */ new Map([[
|
|
1384
|
+
function de(i) {
|
|
1385
|
+
if (i === "single" && K.value.length > 1) {
|
|
1386
|
+
const s = K.value[0];
|
|
1387
|
+
x.value = /* @__PURE__ */ new Map([[a(s), s]]), Z.info("已切换为单选,仅保留第一张");
|
|
1387
1388
|
}
|
|
1388
1389
|
}
|
|
1389
|
-
function
|
|
1390
|
+
function he() {
|
|
1390
1391
|
N.value = S.value ? "multiple" : "single";
|
|
1391
1392
|
}
|
|
1392
1393
|
function ke() {
|
|
1393
1394
|
x.value = /* @__PURE__ */ new Map();
|
|
1394
1395
|
}
|
|
1395
|
-
function
|
|
1396
|
-
return
|
|
1396
|
+
function ye(i) {
|
|
1397
|
+
return i[t.urlField];
|
|
1398
|
+
}
|
|
1399
|
+
function a(i) {
|
|
1400
|
+
return i.id ?? i.url;
|
|
1397
1401
|
}
|
|
1398
|
-
function
|
|
1399
|
-
return x.value.has(
|
|
1402
|
+
function u(i) {
|
|
1403
|
+
return x.value.has(a(i));
|
|
1400
1404
|
}
|
|
1401
|
-
function
|
|
1402
|
-
return
|
|
1405
|
+
function c(i, s) {
|
|
1406
|
+
return i < s ? "portrait" : i > s ? "landscape" : "square";
|
|
1403
1407
|
}
|
|
1404
|
-
function
|
|
1405
|
-
const b =
|
|
1406
|
-
J.value.get(b) !==
|
|
1408
|
+
function R(i, s) {
|
|
1409
|
+
const b = a(i);
|
|
1410
|
+
J.value.get(b) !== s && (J.value.set(b, s), J.value = new Map(J.value));
|
|
1407
1411
|
}
|
|
1408
|
-
function
|
|
1409
|
-
const
|
|
1410
|
-
return
|
|
1412
|
+
function se(i) {
|
|
1413
|
+
const s = J.value.get(a(i));
|
|
1414
|
+
return s ? `yc-image-selector__img--${s}` : "";
|
|
1411
1415
|
}
|
|
1412
|
-
function
|
|
1413
|
-
const b =
|
|
1414
|
-
!(b != null && b.naturalWidth) || !(b != null && b.naturalHeight) ||
|
|
1416
|
+
function fe(i, s) {
|
|
1417
|
+
const b = i.target;
|
|
1418
|
+
!(b != null && b.naturalWidth) || !(b != null && b.naturalHeight) || R(s, c(b.naturalWidth, b.naturalHeight));
|
|
1415
1419
|
}
|
|
1416
|
-
function
|
|
1417
|
-
|
|
1420
|
+
function yt(i) {
|
|
1421
|
+
i.width && i.height && R(i, c(i.width, i.height));
|
|
1418
1422
|
}
|
|
1419
|
-
function Ye(
|
|
1420
|
-
const
|
|
1421
|
-
if (!(
|
|
1422
|
-
x.value =
|
|
1423
|
+
function Ye(i) {
|
|
1424
|
+
const s = /* @__PURE__ */ new Map();
|
|
1425
|
+
if (!(i != null && i.length)) {
|
|
1426
|
+
x.value = s;
|
|
1423
1427
|
return;
|
|
1424
1428
|
}
|
|
1425
|
-
if (typeof
|
|
1426
|
-
for (const
|
|
1427
|
-
|
|
1429
|
+
if (typeof i[0] == "string")
|
|
1430
|
+
for (const Q of i)
|
|
1431
|
+
s.set(Q, { id: Q, url: Q, name: Q.split("/").pop() });
|
|
1428
1432
|
else
|
|
1429
|
-
for (const
|
|
1430
|
-
|
|
1431
|
-
x.value =
|
|
1433
|
+
for (const Q of i)
|
|
1434
|
+
s.set(a(Q), Q);
|
|
1435
|
+
x.value = s;
|
|
1432
1436
|
}
|
|
1433
|
-
function xe(
|
|
1434
|
-
X.value =
|
|
1437
|
+
function xe(i) {
|
|
1438
|
+
X.value = i.onConfirm, ne.value = i.onCancel, Ye(i.selected ?? t.selected);
|
|
1435
1439
|
}
|
|
1436
|
-
function We(
|
|
1440
|
+
function We(i) {
|
|
1437
1441
|
if (l.value) return;
|
|
1438
|
-
const
|
|
1439
|
-
xe(
|
|
1442
|
+
const s = i.detail ?? {};
|
|
1443
|
+
xe(s), g.value = !0;
|
|
1440
1444
|
}
|
|
1441
|
-
|
|
1445
|
+
Fe(() => {
|
|
1442
1446
|
globalThis.addEventListener(Ve, We), l.value || (g.value = G.visible);
|
|
1443
|
-
}),
|
|
1447
|
+
}), Ue(() => {
|
|
1444
1448
|
globalThis.removeEventListener(Ve, We);
|
|
1445
1449
|
});
|
|
1446
1450
|
async function be() {
|
|
1447
|
-
var
|
|
1451
|
+
var i;
|
|
1448
1452
|
if (!t.getImages) {
|
|
1449
|
-
|
|
1453
|
+
Z.error("请通过 props.getImages 传入图片列表请求方法");
|
|
1450
1454
|
return;
|
|
1451
1455
|
}
|
|
1452
1456
|
v.value = !0;
|
|
1453
1457
|
try {
|
|
1454
|
-
const
|
|
1458
|
+
const s = await t.getImages({
|
|
1455
1459
|
keyword: z.value.trim() || void 0,
|
|
1456
|
-
category: C.value || void 0,
|
|
1457
|
-
page:
|
|
1460
|
+
category: L.value && C.value || void 0,
|
|
1461
|
+
page: F.value,
|
|
1458
1462
|
pageSize: t.pageSize
|
|
1459
1463
|
});
|
|
1460
|
-
W.value =
|
|
1461
|
-
for (const b of
|
|
1462
|
-
|
|
1463
|
-
!
|
|
1464
|
-
} catch (
|
|
1465
|
-
|
|
1464
|
+
W.value = s.list, Y.value = s.total;
|
|
1465
|
+
for (const b of s.list)
|
|
1466
|
+
yt(b);
|
|
1467
|
+
L.value && !U.value && ((i = s.categories) != null && i.length) && (H.value = s.categories);
|
|
1468
|
+
} catch (s) {
|
|
1469
|
+
Z.error(s instanceof Error ? s.message : "加载图片失败");
|
|
1466
1470
|
} finally {
|
|
1467
1471
|
v.value = !1;
|
|
1468
1472
|
}
|
|
1469
1473
|
}
|
|
1470
1474
|
function we() {
|
|
1471
|
-
|
|
1475
|
+
F.value = 1, be();
|
|
1472
1476
|
}
|
|
1473
|
-
function je(
|
|
1474
|
-
C.value !==
|
|
1477
|
+
function je(i) {
|
|
1478
|
+
C.value !== i && (C.value = i, we());
|
|
1475
1479
|
}
|
|
1476
|
-
function Ge(
|
|
1477
|
-
const
|
|
1480
|
+
function Ge(i) {
|
|
1481
|
+
const s = a(i);
|
|
1478
1482
|
if ($.value) {
|
|
1479
|
-
if (x.value.has(
|
|
1480
|
-
x.value.delete(
|
|
1483
|
+
if (x.value.has(s)) {
|
|
1484
|
+
x.value.delete(s), x.value = new Map(x.value);
|
|
1481
1485
|
return;
|
|
1482
1486
|
}
|
|
1483
|
-
if (
|
|
1484
|
-
|
|
1487
|
+
if (K.value.length >= m.value) {
|
|
1488
|
+
Z.warning(`最多选择 ${m.value} 张图片`);
|
|
1485
1489
|
return;
|
|
1486
1490
|
}
|
|
1487
|
-
x.value.set(
|
|
1491
|
+
x.value.set(s, i), x.value = new Map(x.value);
|
|
1488
1492
|
return;
|
|
1489
1493
|
}
|
|
1490
|
-
if (x.value.has(
|
|
1491
|
-
if (
|
|
1494
|
+
if (x.value.has(s)) {
|
|
1495
|
+
if (D.value) {
|
|
1492
1496
|
Je(() => Te());
|
|
1493
1497
|
return;
|
|
1494
1498
|
}
|
|
1495
1499
|
x.value = /* @__PURE__ */ new Map();
|
|
1496
1500
|
return;
|
|
1497
1501
|
}
|
|
1498
|
-
x.value = /* @__PURE__ */ new Map([[
|
|
1502
|
+
x.value = /* @__PURE__ */ new Map([[s, i]]), D.value && Je(() => Te());
|
|
1499
1503
|
}
|
|
1500
|
-
async function
|
|
1504
|
+
async function wt(i) {
|
|
1501
1505
|
if (!t.upload) {
|
|
1502
|
-
|
|
1506
|
+
Z.error("请通过 props.upload 传入图片上传方法");
|
|
1503
1507
|
return;
|
|
1504
1508
|
}
|
|
1505
1509
|
T.value = !0;
|
|
1506
1510
|
try {
|
|
1507
|
-
const { resource:
|
|
1508
|
-
if (
|
|
1509
|
-
|
|
1510
|
-
else if (x.value = /* @__PURE__ */ new Map([[
|
|
1511
|
+
const { resource: s } = await t.upload(i.file);
|
|
1512
|
+
if (Z.success("上传成功"), $.value)
|
|
1513
|
+
K.value.length < m.value && (x.value.set(a(s), s), x.value = new Map(x.value));
|
|
1514
|
+
else if (x.value = /* @__PURE__ */ new Map([[a(s), s]]), D.value) {
|
|
1511
1515
|
Te();
|
|
1512
1516
|
return;
|
|
1513
1517
|
}
|
|
1514
1518
|
we();
|
|
1515
|
-
} catch (
|
|
1516
|
-
|
|
1519
|
+
} catch (s) {
|
|
1520
|
+
Z.error(s instanceof Error ? s.message : "上传失败");
|
|
1517
1521
|
} finally {
|
|
1518
1522
|
T.value = !1;
|
|
1519
1523
|
}
|
|
1520
1524
|
}
|
|
1521
|
-
function wt() {
|
|
1522
|
-
z.value = "", C.value = "", U.value = 1, J.value = /* @__PURE__ */ new Map(), ye(), l.value ? xe({}) : xe(G.options), ye(), be();
|
|
1523
|
-
}
|
|
1524
1525
|
function Tt() {
|
|
1526
|
+
z.value = "", C.value = "", F.value = 1, H.value = [], J.value = /* @__PURE__ */ new Map(), he(), l.value ? xe({}) : xe(G.options), he(), be();
|
|
1527
|
+
}
|
|
1528
|
+
function It() {
|
|
1525
1529
|
T.value = !1;
|
|
1526
1530
|
}
|
|
1527
1531
|
function qe() {
|
|
1528
|
-
var
|
|
1529
|
-
(
|
|
1532
|
+
var i, s, b;
|
|
1533
|
+
(i = ne.value) == null || i.call(ne), l.value || (b = (s = G.options).onCancel) == null || b.call(s), o("cancel"), g.value = !1;
|
|
1530
1534
|
}
|
|
1531
1535
|
function Te() {
|
|
1532
|
-
var
|
|
1533
|
-
if (!
|
|
1534
|
-
|
|
1536
|
+
var s, b, Q;
|
|
1537
|
+
if (!K.value.length) {
|
|
1538
|
+
Z.warning("请选择图片");
|
|
1535
1539
|
return;
|
|
1536
1540
|
}
|
|
1537
|
-
const
|
|
1541
|
+
const i = [...K.value];
|
|
1538
1542
|
if (l.value) {
|
|
1539
|
-
o("confirm",
|
|
1543
|
+
o("confirm", i), g.value = !1;
|
|
1540
1544
|
return;
|
|
1541
1545
|
}
|
|
1542
|
-
(
|
|
1546
|
+
(s = X.value) == null || s.call(X, i), (Q = (b = G.options).onConfirm) == null || Q.call(b, i), o("confirm", i), g.value = !1;
|
|
1543
1547
|
}
|
|
1544
|
-
return
|
|
1548
|
+
return te(
|
|
1545
1549
|
() => t.selected,
|
|
1546
|
-
(
|
|
1547
|
-
g.value || Ye(
|
|
1550
|
+
(i) => {
|
|
1551
|
+
g.value || Ye(i);
|
|
1548
1552
|
},
|
|
1549
1553
|
{ deep: !0 }
|
|
1550
|
-
), (
|
|
1551
|
-
const b =
|
|
1552
|
-
return
|
|
1554
|
+
), (i, s) => {
|
|
1555
|
+
const b = O("el-icon"), Q = O("el-input"), Ct = O("el-segmented"), pe = O("el-button"), St = O("el-upload"), kt = O("el-empty"), xt = O("el-pagination"), bt = O("el-dialog"), At = et("loading");
|
|
1556
|
+
return d(), M(bt, {
|
|
1553
1557
|
modelValue: g.value,
|
|
1554
|
-
"onUpdate:modelValue":
|
|
1558
|
+
"onUpdate:modelValue": s[4] || (s[4] = (I) => g.value = I),
|
|
1555
1559
|
title: w.value,
|
|
1556
1560
|
width: e.width,
|
|
1557
1561
|
"append-to-body": "",
|
|
1558
1562
|
"destroy-on-close": "",
|
|
1559
1563
|
class: "yc-image-selector-dialog",
|
|
1560
|
-
onClosed:
|
|
1561
|
-
onOpen:
|
|
1564
|
+
onClosed: It,
|
|
1565
|
+
onOpen: Tt
|
|
1562
1566
|
}, {
|
|
1563
1567
|
footer: p(() => [
|
|
1564
|
-
|
|
1565
|
-
_("span",
|
|
1566
|
-
f(
|
|
1568
|
+
D.value ? (d(), A("div", Co, [
|
|
1569
|
+
_("span", So, V(ie.value), 1),
|
|
1570
|
+
f(pe, {
|
|
1567
1571
|
link: "",
|
|
1568
1572
|
type: "primary",
|
|
1569
1573
|
onClick: qe
|
|
1570
1574
|
}, {
|
|
1571
1575
|
default: p(() => [
|
|
1572
|
-
q(
|
|
1576
|
+
q(V(e.cancelText), 1)
|
|
1573
1577
|
]),
|
|
1574
1578
|
_: 1
|
|
1575
1579
|
})
|
|
1576
|
-
])) : (
|
|
1577
|
-
_("span",
|
|
1578
|
-
_("div",
|
|
1579
|
-
f(
|
|
1580
|
+
])) : (d(), A("div", wo, [
|
|
1581
|
+
_("span", To, V(ie.value), 1),
|
|
1582
|
+
_("div", Io, [
|
|
1583
|
+
f(pe, { onClick: qe }, {
|
|
1580
1584
|
default: p(() => [
|
|
1581
|
-
q(
|
|
1585
|
+
q(V(e.cancelText), 1)
|
|
1582
1586
|
]),
|
|
1583
1587
|
_: 1
|
|
1584
1588
|
}),
|
|
1585
|
-
f(
|
|
1589
|
+
f(pe, {
|
|
1586
1590
|
type: "primary",
|
|
1587
|
-
disabled: !
|
|
1591
|
+
disabled: !K.value.length,
|
|
1588
1592
|
onClick: Te
|
|
1589
1593
|
}, {
|
|
1590
1594
|
default: p(() => [
|
|
1591
|
-
q(
|
|
1595
|
+
q(V(e.confirmText), 1)
|
|
1592
1596
|
]),
|
|
1593
1597
|
_: 1
|
|
1594
1598
|
}, 8, ["disabled"])
|
|
@@ -1596,44 +1600,44 @@ const Zn = { class: "yc-image-selector" }, eo = { class: "yc-image-selector__too
|
|
|
1596
1600
|
]))
|
|
1597
1601
|
]),
|
|
1598
1602
|
default: p(() => [
|
|
1599
|
-
_("div",
|
|
1600
|
-
_("div",
|
|
1601
|
-
f(
|
|
1603
|
+
_("div", eo, [
|
|
1604
|
+
_("div", to, [
|
|
1605
|
+
f(Q, {
|
|
1602
1606
|
modelValue: z.value,
|
|
1603
|
-
"onUpdate:modelValue":
|
|
1607
|
+
"onUpdate:modelValue": s[0] || (s[0] = (I) => z.value = I),
|
|
1604
1608
|
clearable: "",
|
|
1605
1609
|
placeholder: "搜索图片名称",
|
|
1606
1610
|
class: "yc-image-selector__search",
|
|
1607
|
-
onKeyup:
|
|
1611
|
+
onKeyup: Pt(we, ["enter"]),
|
|
1608
1612
|
onClear: we
|
|
1609
1613
|
}, {
|
|
1610
1614
|
prefix: p(() => [
|
|
1611
1615
|
f(b, null, {
|
|
1612
1616
|
default: p(() => [
|
|
1613
|
-
f(h(
|
|
1617
|
+
f(h(zt))
|
|
1614
1618
|
]),
|
|
1615
1619
|
_: 1
|
|
1616
1620
|
})
|
|
1617
1621
|
]),
|
|
1618
1622
|
_: 1
|
|
1619
1623
|
}, 8, ["modelValue"]),
|
|
1620
|
-
r.value ? (
|
|
1624
|
+
r.value ? (d(), M(Ct, {
|
|
1621
1625
|
key: 0,
|
|
1622
1626
|
modelValue: N.value,
|
|
1623
|
-
"onUpdate:modelValue":
|
|
1627
|
+
"onUpdate:modelValue": s[1] || (s[1] = (I) => N.value = I),
|
|
1624
1628
|
options: y,
|
|
1625
1629
|
class: "yc-image-selector__mode",
|
|
1626
|
-
onChange:
|
|
1630
|
+
onChange: de
|
|
1627
1631
|
}, null, 8, ["modelValue"])) : P("", !0),
|
|
1628
|
-
e.showUpload && e.upload ? (
|
|
1632
|
+
e.showUpload && e.upload ? (d(), M(St, {
|
|
1629
1633
|
key: 1,
|
|
1630
1634
|
"show-file-list": !1,
|
|
1631
1635
|
accept: e.accept,
|
|
1632
|
-
"http-request":
|
|
1636
|
+
"http-request": wt,
|
|
1633
1637
|
disabled: T.value
|
|
1634
1638
|
}, {
|
|
1635
1639
|
default: p(() => [
|
|
1636
|
-
f(
|
|
1640
|
+
f(pe, {
|
|
1637
1641
|
type: "primary",
|
|
1638
1642
|
plain: "",
|
|
1639
1643
|
loading: T.value
|
|
@@ -1641,11 +1645,11 @@ const Zn = { class: "yc-image-selector" }, eo = { class: "yc-image-selector__too
|
|
|
1641
1645
|
default: p(() => [
|
|
1642
1646
|
f(b, { class: "m-r-4" }, {
|
|
1643
1647
|
default: p(() => [
|
|
1644
|
-
f(h(
|
|
1648
|
+
f(h(Yt))
|
|
1645
1649
|
]),
|
|
1646
1650
|
_: 1
|
|
1647
1651
|
}),
|
|
1648
|
-
|
|
1652
|
+
s[5] || (s[5] = q(" 上传图片 ", -1))
|
|
1649
1653
|
]),
|
|
1650
1654
|
_: 1
|
|
1651
1655
|
}, 8, ["loading"])
|
|
@@ -1653,51 +1657,51 @@ const Zn = { class: "yc-image-selector" }, eo = { class: "yc-image-selector__too
|
|
|
1653
1657
|
_: 1
|
|
1654
1658
|
}, 8, ["accept", "disabled"])) : P("", !0)
|
|
1655
1659
|
]),
|
|
1656
|
-
_("div",
|
|
1657
|
-
|
|
1660
|
+
_("div", no, [
|
|
1661
|
+
L.value ? (d(), A("aside", oo, [
|
|
1658
1662
|
_("div", {
|
|
1659
|
-
class:
|
|
1660
|
-
onClick:
|
|
1661
|
-
},
|
|
1662
|
-
(
|
|
1663
|
+
class: re(["yc-image-selector__category", { "is-active": C.value === "" }]),
|
|
1664
|
+
onClick: s[2] || (s[2] = (I) => je(""))
|
|
1665
|
+
}, V(e.categoryAllLabel), 3),
|
|
1666
|
+
(d(!0), A(ae, null, ge(E.value, (I) => (d(), A("div", {
|
|
1663
1667
|
key: I.id,
|
|
1664
|
-
class:
|
|
1668
|
+
class: re(["yc-image-selector__category", { "is-active": C.value === I.id }]),
|
|
1665
1669
|
onClick: (Ie) => je(I.id)
|
|
1666
1670
|
}, [
|
|
1667
|
-
_("span", null,
|
|
1668
|
-
I.count != null ? (
|
|
1669
|
-
], 10,
|
|
1671
|
+
_("span", null, V(I.name), 1),
|
|
1672
|
+
I.count != null ? (d(), A("span", lo, V(I.count), 1)) : P("", !0)
|
|
1673
|
+
], 10, ao))), 128))
|
|
1670
1674
|
])) : P("", !0),
|
|
1671
|
-
|
|
1672
|
-
!v.value && !W.value.length ? (
|
|
1675
|
+
ve((d(), A("div", io, [
|
|
1676
|
+
!v.value && !W.value.length ? (d(), M(kt, {
|
|
1673
1677
|
key: 0,
|
|
1674
1678
|
description: e.emptyText
|
|
1675
|
-
}, null, 8, ["description"])) : (
|
|
1676
|
-
(
|
|
1679
|
+
}, null, 8, ["description"])) : (d(), A("div", so, [
|
|
1680
|
+
(d(!0), A(ae, null, ge(W.value, (I) => (d(), A("div", {
|
|
1677
1681
|
key: String(I.id),
|
|
1678
|
-
class:
|
|
1679
|
-
"is-selected":
|
|
1682
|
+
class: re(["yc-image-selector__item", {
|
|
1683
|
+
"is-selected": u(I),
|
|
1680
1684
|
"is-single-mode": !$.value,
|
|
1681
1685
|
"is-multi-mode": $.value
|
|
1682
1686
|
}]),
|
|
1683
1687
|
onClick: (Ie) => Ge(I)
|
|
1684
1688
|
}, [
|
|
1685
|
-
_("div",
|
|
1689
|
+
_("div", uo, [
|
|
1686
1690
|
_("img", {
|
|
1687
|
-
src: I
|
|
1691
|
+
src: ye(I),
|
|
1688
1692
|
alt: I.name || "image",
|
|
1689
1693
|
loading: "lazy",
|
|
1690
|
-
class:
|
|
1691
|
-
onLoad: (Ie) =>
|
|
1692
|
-
}, null, 42,
|
|
1694
|
+
class: re(se(I)),
|
|
1695
|
+
onLoad: (Ie) => fe(Ie, I)
|
|
1696
|
+
}, null, 42, co),
|
|
1693
1697
|
_("div", {
|
|
1694
|
-
class:
|
|
1695
|
-
"is-checked":
|
|
1698
|
+
class: re(["yc-image-selector__indicator", {
|
|
1699
|
+
"is-checked": u(I),
|
|
1696
1700
|
"is-radio": !$.value,
|
|
1697
1701
|
"is-checkbox": $.value
|
|
1698
1702
|
}])
|
|
1699
1703
|
}, [
|
|
1700
|
-
|
|
1704
|
+
u(I) && $.value ? (d(), A("span", fo, V(j(I)), 1)) : u(I) ? (d(), M(b, { key: 1 }, {
|
|
1701
1705
|
default: p(() => [
|
|
1702
1706
|
f(h(lt))
|
|
1703
1707
|
]),
|
|
@@ -1708,43 +1712,43 @@ const Zn = { class: "yc-image-selector" }, eo = { class: "yc-image-selector__too
|
|
|
1708
1712
|
_("div", {
|
|
1709
1713
|
class: "yc-image-selector__meta",
|
|
1710
1714
|
title: I.name
|
|
1711
|
-
},
|
|
1712
|
-
], 10,
|
|
1715
|
+
}, V(I.name || "未命名"), 9, po)
|
|
1716
|
+
], 10, ro))), 128))
|
|
1713
1717
|
]))
|
|
1714
1718
|
])), [
|
|
1715
|
-
[
|
|
1719
|
+
[At, v.value]
|
|
1716
1720
|
])
|
|
1717
1721
|
]),
|
|
1718
|
-
$.value &&
|
|
1719
|
-
_("span",
|
|
1720
|
-
_("div",
|
|
1721
|
-
(
|
|
1722
|
+
$.value && K.value.length ? (d(), A("div", mo, [
|
|
1723
|
+
_("span", go, "已选 " + V(K.value.length) + " 张", 1),
|
|
1724
|
+
_("div", vo, [
|
|
1725
|
+
(d(!0), A(ae, null, ge(K.value, (I) => (d(), A("div", {
|
|
1722
1726
|
key: String(I.id),
|
|
1723
1727
|
class: "yc-image-selector__selected-chip",
|
|
1724
|
-
onClick:
|
|
1728
|
+
onClick: Lt((Ie) => Ge(I), ["stop"])
|
|
1725
1729
|
}, [
|
|
1726
1730
|
_("img", {
|
|
1727
|
-
src: I
|
|
1731
|
+
src: ye(I),
|
|
1728
1732
|
alt: I.name
|
|
1729
|
-
}, null, 8,
|
|
1730
|
-
|
|
1731
|
-
], 8,
|
|
1733
|
+
}, null, 8, ho),
|
|
1734
|
+
s[6] || (s[6] = _("span", { class: "yc-image-selector__selected-chip-remove" }, "×", -1))
|
|
1735
|
+
], 8, _o))), 128))
|
|
1732
1736
|
]),
|
|
1733
|
-
f(
|
|
1737
|
+
f(pe, {
|
|
1734
1738
|
link: "",
|
|
1735
1739
|
type: "primary",
|
|
1736
1740
|
onClick: ke
|
|
1737
1741
|
}, {
|
|
1738
|
-
default: p(() => [...
|
|
1742
|
+
default: p(() => [...s[7] || (s[7] = [
|
|
1739
1743
|
q("清空", -1)
|
|
1740
1744
|
])]),
|
|
1741
1745
|
_: 1
|
|
1742
1746
|
})
|
|
1743
1747
|
])) : P("", !0),
|
|
1744
|
-
Y.value > 0 ? (
|
|
1745
|
-
f(
|
|
1746
|
-
"current-page":
|
|
1747
|
-
"onUpdate:currentPage":
|
|
1748
|
+
Y.value > 0 ? (d(), A("div", yo, [
|
|
1749
|
+
f(xt, {
|
|
1750
|
+
"current-page": F.value,
|
|
1751
|
+
"onUpdate:currentPage": s[3] || (s[3] = (I) => F.value = I),
|
|
1748
1752
|
background: "",
|
|
1749
1753
|
layout: "total, prev, pager, next, jumper",
|
|
1750
1754
|
"page-size": e.pageSize,
|
|
@@ -1758,7 +1762,7 @@ const Zn = { class: "yc-image-selector" }, eo = { class: "yc-image-selector__too
|
|
|
1758
1762
|
}, 8, ["modelValue", "title", "width"]);
|
|
1759
1763
|
};
|
|
1760
1764
|
}
|
|
1761
|
-
}),
|
|
1765
|
+
}), xo = /* @__PURE__ */ Se(ko, [["__scopeId", "data-v-baf50ed2"]]);
|
|
1762
1766
|
function vt() {
|
|
1763
1767
|
const e = k(!1), n = k({});
|
|
1764
1768
|
function t(l = {}) {
|
|
@@ -1774,12 +1778,12 @@ function vt() {
|
|
|
1774
1778
|
closeImageSelector: o
|
|
1775
1779
|
};
|
|
1776
1780
|
}
|
|
1777
|
-
const
|
|
1778
|
-
function
|
|
1781
|
+
const bo = "__YC_IMAGE_SELECTOR_CTX_KEY__";
|
|
1782
|
+
function Ao(e) {
|
|
1779
1783
|
const n = globalThis;
|
|
1780
1784
|
return n[e] || (n[e] = Symbol(e)), n[e];
|
|
1781
1785
|
}
|
|
1782
|
-
const _t = bo
|
|
1786
|
+
const _t = Ao(bo), Fo = /* @__PURE__ */ ue({
|
|
1783
1787
|
__name: "YcImageSelectorProvider",
|
|
1784
1788
|
props: {
|
|
1785
1789
|
modelValue: { type: Boolean },
|
|
@@ -1801,15 +1805,16 @@ const _t = bo(xo), Oo = /* @__PURE__ */ ce({
|
|
|
1801
1805
|
emptyText: { default: "暂无图片资源" },
|
|
1802
1806
|
getImages: {},
|
|
1803
1807
|
upload: {},
|
|
1808
|
+
urlField: { default: "url" },
|
|
1804
1809
|
showDialog: { type: Boolean, default: !0 }
|
|
1805
1810
|
},
|
|
1806
1811
|
setup(e, { expose: n }) {
|
|
1807
1812
|
const t = e, o = vt(), { dialogVisible: l, dialogOptions: g, openImageSelector: w, closeImageSelector: S } = o;
|
|
1808
1813
|
$e(_t, o);
|
|
1809
|
-
function m(
|
|
1810
|
-
return
|
|
1814
|
+
function m(E, D) {
|
|
1815
|
+
return E in g.value ? g.value[E] : D;
|
|
1811
1816
|
}
|
|
1812
|
-
const r =
|
|
1817
|
+
const r = B(() => ({
|
|
1813
1818
|
title: m("title", t.title),
|
|
1814
1819
|
multiple: m("multiple", t.multiple),
|
|
1815
1820
|
maxCount: m("maxCount", t.maxCount),
|
|
@@ -1827,26 +1832,27 @@ const _t = bo(xo), Oo = /* @__PURE__ */ ce({
|
|
|
1827
1832
|
cancelText: t.cancelText,
|
|
1828
1833
|
emptyText: t.emptyText,
|
|
1829
1834
|
getImages: t.getImages,
|
|
1830
|
-
upload: t.upload
|
|
1835
|
+
upload: t.upload,
|
|
1836
|
+
urlField: t.urlField
|
|
1831
1837
|
}));
|
|
1832
|
-
function
|
|
1833
|
-
var
|
|
1834
|
-
(N = (
|
|
1838
|
+
function L(E) {
|
|
1839
|
+
var D, N;
|
|
1840
|
+
(N = (D = g.value).onConfirm) == null || N.call(D, E), S();
|
|
1835
1841
|
}
|
|
1836
|
-
function
|
|
1837
|
-
var
|
|
1838
|
-
(
|
|
1842
|
+
function U() {
|
|
1843
|
+
var E, D;
|
|
1844
|
+
(D = (E = g.value).onCancel) == null || D.call(E), S();
|
|
1839
1845
|
}
|
|
1840
|
-
return n({ openImageSelector: w, closeImageSelector: S }), (
|
|
1841
|
-
e.showDialog !== !1 ? (
|
|
1846
|
+
return n({ openImageSelector: w, closeImageSelector: S }), (E, D) => (d(), A(ae, null, [
|
|
1847
|
+
e.showDialog !== !1 ? (d(), M(xo, ot({
|
|
1842
1848
|
key: 0,
|
|
1843
1849
|
modelValue: h(l),
|
|
1844
|
-
"onUpdate:modelValue":
|
|
1850
|
+
"onUpdate:modelValue": D[0] || (D[0] = (N) => Dt(l) ? l.value = N : null)
|
|
1845
1851
|
}, r.value, {
|
|
1846
|
-
onConfirm:
|
|
1847
|
-
onCancel:
|
|
1852
|
+
onConfirm: L,
|
|
1853
|
+
onCancel: U
|
|
1848
1854
|
}), null, 16, ["modelValue"])) : P("", !0),
|
|
1849
|
-
Ce(
|
|
1855
|
+
Ce(E.$slots, "default")
|
|
1850
1856
|
], 64));
|
|
1851
1857
|
}
|
|
1852
1858
|
});
|
|
@@ -1860,7 +1866,7 @@ function Uo() {
|
|
|
1860
1866
|
const n = vt();
|
|
1861
1867
|
return {
|
|
1862
1868
|
openImageSelector: (t = {}) => {
|
|
1863
|
-
|
|
1869
|
+
Zn(t), n.openImageSelector(t);
|
|
1864
1870
|
},
|
|
1865
1871
|
closeImageSelector: () => n.closeImageSelector()
|
|
1866
1872
|
};
|
|
@@ -1880,7 +1886,7 @@ async function Ro(e) {
|
|
|
1880
1886
|
throw new Error("加载图片资源失败");
|
|
1881
1887
|
return o.data;
|
|
1882
1888
|
}
|
|
1883
|
-
async function
|
|
1889
|
+
async function Ko(e) {
|
|
1884
1890
|
const n = Ke().uploadImage;
|
|
1885
1891
|
if (n) return n(e);
|
|
1886
1892
|
const t = ht(), o = new FormData();
|
|
@@ -1895,37 +1901,37 @@ async function Fo(e) {
|
|
|
1895
1901
|
return l.data;
|
|
1896
1902
|
}
|
|
1897
1903
|
export {
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1904
|
+
Hn as AiTaskPanel,
|
|
1905
|
+
Vo as AiTaskProvider,
|
|
1906
|
+
En as AiUseDialog,
|
|
1901
1907
|
_t as IMAGE_SELECTOR_INJECT_KEY,
|
|
1902
|
-
|
|
1903
|
-
|
|
1908
|
+
xo as ImageSelectorDialog,
|
|
1909
|
+
Fo as ImageSelectorProvider,
|
|
1904
1910
|
Qe as SkyPageWindow,
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
+
Hn as YcAiTaskPanel,
|
|
1912
|
+
Vo as YcAiTaskProvider,
|
|
1913
|
+
En as YcAiUseDialog,
|
|
1914
|
+
Do as YcComponent,
|
|
1915
|
+
xo as YcImageSelectorDialog,
|
|
1916
|
+
Fo as YcImageSelectorProvider,
|
|
1911
1917
|
Qe as YcPageWindow,
|
|
1912
1918
|
vt as createImageSelectorApi,
|
|
1913
|
-
|
|
1919
|
+
Do as default,
|
|
1914
1920
|
Ro as fetchImages,
|
|
1915
1921
|
it as getAiTaskConfig,
|
|
1916
1922
|
Ke as getImageSelectorConfig,
|
|
1917
1923
|
rt as hideAiDialog,
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1924
|
+
Qn as hideImageSelectorDialog,
|
|
1925
|
+
an as installYcComponent,
|
|
1926
|
+
xn as listPrompts,
|
|
1927
|
+
Bo as openAiUseDialog,
|
|
1928
|
+
Zn as openImageSelector,
|
|
1929
|
+
Gt as setAiTaskConfig,
|
|
1930
|
+
Xt as setImageSelectorConfig,
|
|
1925
1931
|
Ne as showAiDialog,
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1932
|
+
Xn as showImageSelectorDialog,
|
|
1933
|
+
Ko as uploadImage,
|
|
1934
|
+
Oo as useAiTask,
|
|
1929
1935
|
gt as useAiTaskStore,
|
|
1930
1936
|
Uo as useImageSelector
|
|
1931
1937
|
};
|