yc-component 0.1.15 → 0.1.16
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/style.css +1 -1
- package/dist/image-selector/components/YcImageSelectorDialog.d.ts.map +1 -1
- package/dist/image-selector/style.css +1 -1
- package/dist/index.css +1 -1
- package/dist/page-window/style.css +1 -1
- package/dist/yc-component.cjs.full.js +12 -12
- package/dist/yc-component.cjs.js +1 -1
- package/dist/yc-component.esm.full.js +186 -183
- package/dist/yc-component.esm.js +98 -95
- package/dist/yc-component.umd.full.js +16 -16
- package/dist/yc-component.umd.full.min.js +1 -1
- package/dist/yc-component.umd.js +2 -2
- package/dist/yc-component.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/yc-component.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ var Yt = Object.defineProperty;
|
|
|
2
2
|
var jt = (e, n, t) => n in e ? Yt(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
|
|
3
3
|
var tt = (e, n, t) => jt(e, typeof n != "symbol" ? n + "" : n, t);
|
|
4
4
|
import ut from "axios";
|
|
5
|
-
import { reactive as ct, defineComponent as de, computed as
|
|
5
|
+
import { reactive as ct, defineComponent as de, computed as $, ref as b, watch as ne, onMounted as Ke, onUnmounted as Ne, resolveComponent as B, resolveDirective as dt, openBlock as u, createBlock as M, withCtx as g, createElementVNode as T, createElementBlock as A, createVNode as m, withKeys as Gt, unref as w, createCommentVNode as P, createTextVNode as G, normalizeClass as fe, toDisplayString as D, Fragment as re, renderList as he, withDirectives as _e, renderSlot as ye, normalizeProps as ft, mergeProps as ze, withModifiers as Wt, nextTick as nt, render as qt, onBeforeUnmount as Ht, Transition as pt, normalizeStyle as ot, vShow as De, inject as Ye, Teleport as Jt, provide as Be, isRef as Xt } from "vue";
|
|
6
6
|
import { ElMessage as Q } from "element-plus";
|
|
7
7
|
import { Search as Qt, Upload as Zt, Check as mt, ArrowLeft as en, ArrowUpBold as tn, ArrowDownBold as nn, Switch as on, Close as gt, Refresh as lt, ArrowDown as ln, CircleCheck as an, CircleClose as sn, Remove as rn } from "@element-plus/icons-vue";
|
|
8
8
|
import { storeToRefs as un, defineStore as cn } from "pinia";
|
|
@@ -123,7 +123,10 @@ function wt(e = {}) {
|
|
|
123
123
|
const n = vn();
|
|
124
124
|
return yn(e), n;
|
|
125
125
|
}
|
|
126
|
-
const wn = { class: "yc-image-selector" }, Tn = {
|
|
126
|
+
const wn = { class: "yc-image-selector" }, Tn = {
|
|
127
|
+
key: 0,
|
|
128
|
+
class: "yc-image-selector__toolbar"
|
|
129
|
+
}, In = { class: "yc-image-selector__body" }, Cn = {
|
|
127
130
|
key: 0,
|
|
128
131
|
class: "yc-image-selector__aside"
|
|
129
132
|
}, Sn = ["onClick"], kn = {
|
|
@@ -136,10 +139,10 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
|
|
|
136
139
|
key: 0,
|
|
137
140
|
class: "yc-image-selector__order"
|
|
138
141
|
}, $n = ["title"], Ln = {
|
|
139
|
-
key:
|
|
142
|
+
key: 1,
|
|
140
143
|
class: "yc-image-selector__selected-bar"
|
|
141
144
|
}, Dn = { class: "yc-image-selector__selected-bar-label" }, Bn = { class: "yc-image-selector__selected-bar-list" }, Vn = ["onClick"], On = ["src", "alt"], Un = {
|
|
142
|
-
key:
|
|
145
|
+
key: 2,
|
|
143
146
|
class: "yc-image-selector__pagination"
|
|
144
147
|
}, Fn = {
|
|
145
148
|
key: 0,
|
|
@@ -189,7 +192,7 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
|
|
|
189
192
|
setup(a) {
|
|
190
193
|
return () => a.render(a.ctx);
|
|
191
194
|
}
|
|
192
|
-
}), o = e, s = n, d =
|
|
195
|
+
}), o = e, s = n, d = $(() => o.modelValue != null), v = b(!1), _ = b(null);
|
|
193
196
|
ne(
|
|
194
197
|
() => o.modelValue,
|
|
195
198
|
(a) => {
|
|
@@ -209,33 +212,33 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
|
|
|
209
212
|
},
|
|
210
213
|
{ immediate: !0 }
|
|
211
214
|
);
|
|
212
|
-
const y =
|
|
215
|
+
const y = $(
|
|
213
216
|
() => (d.value ? void 0 : q.options.title) ?? o.title ?? "选择图片"
|
|
214
|
-
), r =
|
|
217
|
+
), r = $(
|
|
215
218
|
() => (d.value ? void 0 : q.options.multiple) ?? o.multiple
|
|
216
|
-
), C =
|
|
219
|
+
), C = $(
|
|
217
220
|
() => (d.value ? void 0 : q.options.maxCount) ?? o.maxCount
|
|
218
|
-
), V =
|
|
221
|
+
), V = $(
|
|
219
222
|
() => (d.value ? void 0 : q.options.showModeSwitch) ?? o.showModeSwitch
|
|
220
|
-
), F =
|
|
223
|
+
), F = $(
|
|
221
224
|
() => (d.value ? void 0 : q.options.showCategories) ?? o.showCategories
|
|
222
|
-
), X =
|
|
225
|
+
), X = $(() => {
|
|
223
226
|
var a, l;
|
|
224
227
|
if ((a = o.categories) != null && a.length) return o.categories;
|
|
225
228
|
if (!d.value && ((l = q.options.categories) != null && l.length))
|
|
226
229
|
return q.options.categories;
|
|
227
|
-
}), O =
|
|
230
|
+
}), O = $(() => F.value ? X.value ?? ee.value : []), f = $(
|
|
228
231
|
() => (d.value ? void 0 : q.options.confirmOnSelect) ?? o.confirmOnSelect
|
|
229
232
|
), L = b("single"), H = [
|
|
230
233
|
{ label: "单选", value: "single" },
|
|
231
234
|
{ label: "多选", value: "multiple" }
|
|
232
|
-
], S =
|
|
235
|
+
], S = $(
|
|
233
236
|
() => V.value ? L.value === "multiple" : r.value
|
|
234
|
-
), U = b(""), N = b(""), h = b(1), k = b(0), Y = b(!1), j = b(!1), W = b([]), ee = b([]),
|
|
237
|
+
), U = b(""), N = b(""), h = b(1), k = b(0), Y = b(!1), j = b(!1), W = b([]), ee = b([]), E = b(/* @__PURE__ */ new Map()), oe = b(/* @__PURE__ */ new Map()), le = b(), te = b(), R = b(!1), z = $(() => [...E.value.values()]), Te = $(() => !!_.value || W.value.length === 0), Ie = $(() => ({
|
|
235
238
|
authState: _.value,
|
|
236
239
|
isEmpty: W.value.length === 0,
|
|
237
240
|
reload: me
|
|
238
|
-
})), Ce =
|
|
241
|
+
})), Ce = $(() => {
|
|
239
242
|
var l, x;
|
|
240
243
|
const a = z.value.length;
|
|
241
244
|
return f.value ? a ? `已选:${((l = z.value[0]) == null ? void 0 : l.name) || "1 张图片"}` : "单击图片即可完成选择" : a ? S.value ? `已选 ${a} / ${C.value} 张` : `已选:${((x = z.value[0]) == null ? void 0 : x.name) || "1 张图片"}` : S.value ? `多选模式:最多 ${C.value} 张` : "单选模式:请选择一张图片";
|
|
@@ -247,14 +250,14 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
|
|
|
247
250
|
function p(a) {
|
|
248
251
|
if (a === "single" && z.value.length > 1) {
|
|
249
252
|
const l = z.value[0];
|
|
250
|
-
|
|
253
|
+
E.value = /* @__PURE__ */ new Map([[J(l), l]]), Q.info("已切换为单选,仅保留第一张");
|
|
251
254
|
}
|
|
252
255
|
}
|
|
253
256
|
function c() {
|
|
254
257
|
L.value = r.value ? "multiple" : "single";
|
|
255
258
|
}
|
|
256
259
|
function K() {
|
|
257
|
-
|
|
260
|
+
E.value = /* @__PURE__ */ new Map();
|
|
258
261
|
}
|
|
259
262
|
function ue(a) {
|
|
260
263
|
return a[o.urlField];
|
|
@@ -263,7 +266,7 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
|
|
|
263
266
|
return a.id ?? a.url;
|
|
264
267
|
}
|
|
265
268
|
function Se(a) {
|
|
266
|
-
return
|
|
269
|
+
return E.value.has(J(a));
|
|
267
270
|
}
|
|
268
271
|
function qe(a, l) {
|
|
269
272
|
return a < l ? "portrait" : a > l ? "landscape" : "square";
|
|
@@ -286,7 +289,7 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
|
|
|
286
289
|
function Je(a) {
|
|
287
290
|
const l = /* @__PURE__ */ new Map();
|
|
288
291
|
if (!(a != null && a.length)) {
|
|
289
|
-
|
|
292
|
+
E.value = l;
|
|
290
293
|
return;
|
|
291
294
|
}
|
|
292
295
|
if (typeof a[0] == "string")
|
|
@@ -295,7 +298,7 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
|
|
|
295
298
|
else
|
|
296
299
|
for (const ie of a)
|
|
297
300
|
l.set(J(ie), ie);
|
|
298
|
-
|
|
301
|
+
E.value = l;
|
|
299
302
|
}
|
|
300
303
|
function Me(a) {
|
|
301
304
|
le.value = a.onConfirm, te.value = a.onCancel, Je(a.selected ?? o.selected);
|
|
@@ -351,26 +354,26 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
|
|
|
351
354
|
function Ze(a) {
|
|
352
355
|
const l = J(a);
|
|
353
356
|
if (S.value) {
|
|
354
|
-
if (
|
|
355
|
-
|
|
357
|
+
if (E.value.has(l)) {
|
|
358
|
+
E.value.delete(l), E.value = new Map(E.value);
|
|
356
359
|
return;
|
|
357
360
|
}
|
|
358
361
|
if (z.value.length >= C.value) {
|
|
359
362
|
Q.warning(`最多选择 ${C.value} 张图片`);
|
|
360
363
|
return;
|
|
361
364
|
}
|
|
362
|
-
|
|
365
|
+
E.value.set(l, a), E.value = new Map(E.value);
|
|
363
366
|
return;
|
|
364
367
|
}
|
|
365
|
-
if (
|
|
368
|
+
if (E.value.has(l)) {
|
|
366
369
|
if (f.value) {
|
|
367
370
|
nt(() => ke());
|
|
368
371
|
return;
|
|
369
372
|
}
|
|
370
|
-
|
|
373
|
+
E.value = /* @__PURE__ */ new Map();
|
|
371
374
|
return;
|
|
372
375
|
}
|
|
373
|
-
|
|
376
|
+
E.value = /* @__PURE__ */ new Map([[l, a]]), f.value && nt(() => ke());
|
|
374
377
|
}
|
|
375
378
|
async function Bt(a) {
|
|
376
379
|
if (!o.upload) {
|
|
@@ -381,8 +384,8 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
|
|
|
381
384
|
try {
|
|
382
385
|
const { resource: l } = await o.upload(a.file);
|
|
383
386
|
if (Q.success("上传成功"), _.value = null, S.value)
|
|
384
|
-
z.value.length < C.value && (
|
|
385
|
-
else if (
|
|
387
|
+
z.value.length < C.value && (E.value.set(J(l), l), E.value = new Map(E.value));
|
|
388
|
+
else if (E.value = /* @__PURE__ */ new Map([[J(l), l]]), f.value) {
|
|
386
389
|
ke();
|
|
387
390
|
return;
|
|
388
391
|
}
|
|
@@ -449,7 +452,7 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
|
|
|
449
452
|
onOpen: Vt
|
|
450
453
|
}, {
|
|
451
454
|
footer: g(() => [
|
|
452
|
-
f.value ? (u(),
|
|
455
|
+
f.value ? (u(), A("div", Nn, [
|
|
453
456
|
T("span", zn, D(Ce.value), 1),
|
|
454
457
|
m(ge, {
|
|
455
458
|
link: "",
|
|
@@ -461,7 +464,7 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
|
|
|
461
464
|
]),
|
|
462
465
|
_: 1
|
|
463
466
|
})
|
|
464
|
-
])) : (u(),
|
|
467
|
+
])) : (u(), A("div", Fn, [
|
|
465
468
|
T("span", Rn, D(Ce.value), 1),
|
|
466
469
|
T("div", Kn, [
|
|
467
470
|
m(ge, { onClick: et }, {
|
|
@@ -485,7 +488,7 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
|
|
|
485
488
|
]),
|
|
486
489
|
default: g(() => [
|
|
487
490
|
T("div", wn, [
|
|
488
|
-
|
|
491
|
+
_.value ? P("", !0) : (u(), A("div", Tn, [
|
|
489
492
|
m(ie, {
|
|
490
493
|
modelValue: U.value,
|
|
491
494
|
"onUpdate:modelValue": l[0] || (l[0] = (I) => U.value = I),
|
|
@@ -512,7 +515,7 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
|
|
|
512
515
|
options: H,
|
|
513
516
|
class: "yc-image-selector__mode",
|
|
514
517
|
onChange: p
|
|
515
|
-
}, null, 8, ["modelValue"])) :
|
|
518
|
+
}, null, 8, ["modelValue"])) : P("", !0),
|
|
516
519
|
e.showUpload && e.upload ? (u(), M(Ft, {
|
|
517
520
|
key: 1,
|
|
518
521
|
"show-file-list": !1,
|
|
@@ -539,24 +542,24 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
|
|
|
539
542
|
}, 8, ["loading"])
|
|
540
543
|
]),
|
|
541
544
|
_: 1
|
|
542
|
-
}, 8, ["accept", "disabled"])) :
|
|
543
|
-
]),
|
|
545
|
+
}, 8, ["accept", "disabled"])) : P("", !0)
|
|
546
|
+
])),
|
|
544
547
|
T("div", In, [
|
|
545
|
-
F.value ? (u(),
|
|
548
|
+
F.value && !_.value ? (u(), A("aside", Cn, [
|
|
546
549
|
T("div", {
|
|
547
550
|
class: fe(["yc-image-selector__category", { "is-active": N.value === "" }]),
|
|
548
551
|
onClick: l[2] || (l[2] = (I) => Qe(""))
|
|
549
552
|
}, D(e.categoryAllLabel), 3),
|
|
550
|
-
(u(!0),
|
|
553
|
+
(u(!0), A(re, null, he(O.value, (I) => (u(), A("div", {
|
|
551
554
|
key: I.id,
|
|
552
555
|
class: fe(["yc-image-selector__category", { "is-active": N.value === I.id }]),
|
|
553
556
|
onClick: (xe) => Qe(I.id)
|
|
554
557
|
}, [
|
|
555
558
|
T("span", null, D(I.name), 1),
|
|
556
|
-
I.count != null ? (u(),
|
|
559
|
+
I.count != null ? (u(), A("span", kn, D(I.count), 1)) : P("", !0)
|
|
557
560
|
], 10, Sn))), 128))
|
|
558
|
-
])) :
|
|
559
|
-
_e((u(),
|
|
561
|
+
])) : P("", !0),
|
|
562
|
+
_e((u(), A("div", xn, [
|
|
560
563
|
!Y.value && Te.value ? ye(a.$slots, "empty", ft(ze({ key: 0 }, Ie.value)), () => {
|
|
561
564
|
var I;
|
|
562
565
|
return [
|
|
@@ -569,8 +572,8 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
|
|
|
569
572
|
description: ((I = _.value) == null ? void 0 : I.message) || e.emptyText
|
|
570
573
|
}, null, 8, ["description"]))
|
|
571
574
|
];
|
|
572
|
-
}, !0) : Te.value ?
|
|
573
|
-
(u(!0),
|
|
575
|
+
}, !0) : Te.value ? P("", !0) : (u(), A("div", bn, [
|
|
576
|
+
(u(!0), A(re, null, he(W.value, (I) => (u(), A("div", {
|
|
574
577
|
key: String(I.id),
|
|
575
578
|
class: fe(["yc-image-selector__item", {
|
|
576
579
|
"is-selected": Se(I),
|
|
@@ -594,12 +597,12 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
|
|
|
594
597
|
"is-checkbox": S.value
|
|
595
598
|
}])
|
|
596
599
|
}, [
|
|
597
|
-
Se(I) && S.value ? (u(),
|
|
600
|
+
Se(I) && S.value ? (u(), A("span", Pn, D(i(I)), 1)) : Se(I) ? (u(), M(x, { key: 1 }, {
|
|
598
601
|
default: g(() => [
|
|
599
602
|
m(w(mt))
|
|
600
603
|
]),
|
|
601
604
|
_: 1
|
|
602
|
-
})) :
|
|
605
|
+
})) : P("", !0)
|
|
603
606
|
], 2)
|
|
604
607
|
]),
|
|
605
608
|
T("div", {
|
|
@@ -612,10 +615,10 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
|
|
|
612
615
|
[zt, Y.value]
|
|
613
616
|
])
|
|
614
617
|
]),
|
|
615
|
-
S.value && z.value.length ? (u(),
|
|
618
|
+
S.value && z.value.length ? (u(), A("div", Ln, [
|
|
616
619
|
T("span", Dn, "已选 " + D(z.value.length) + " 张", 1),
|
|
617
620
|
T("div", Bn, [
|
|
618
|
-
(u(!0),
|
|
621
|
+
(u(!0), A(re, null, he(z.value, (I) => (u(), A("div", {
|
|
619
622
|
key: String(I.id),
|
|
620
623
|
class: "yc-image-selector__selected-chip",
|
|
621
624
|
onClick: Wt((xe) => Ze(I), ["stop"])
|
|
@@ -637,8 +640,8 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
|
|
|
637
640
|
])]),
|
|
638
641
|
_: 1
|
|
639
642
|
})
|
|
640
|
-
])) :
|
|
641
|
-
k.value > 0 ? (u(),
|
|
643
|
+
])) : P("", !0),
|
|
644
|
+
k.value > 0 ? (u(), A("div", Un, [
|
|
642
645
|
m(Kt, {
|
|
643
646
|
"current-page": h.value,
|
|
644
647
|
"onUpdate:currentPage": l[3] || (l[3] = (I) => h.value = I),
|
|
@@ -648,7 +651,7 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
|
|
|
648
651
|
total: k.value,
|
|
649
652
|
onCurrentChange: Pe
|
|
650
653
|
}, null, 8, ["current-page", "page-size", "total"])
|
|
651
|
-
])) :
|
|
654
|
+
])) : P("", !0)
|
|
652
655
|
])
|
|
653
656
|
]),
|
|
654
657
|
_: 3
|
|
@@ -660,7 +663,7 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
|
|
|
660
663
|
for (const [o, s] of n)
|
|
661
664
|
t[o] = s;
|
|
662
665
|
return t;
|
|
663
|
-
}, Tt = /* @__PURE__ */ Ee(Yn, [["__scopeId", "data-v-
|
|
666
|
+
}, Tt = /* @__PURE__ */ Ee(Yn, [["__scopeId", "data-v-6d4e506a"]]);
|
|
664
667
|
function It() {
|
|
665
668
|
const { baseURL: e = "" } = Ae();
|
|
666
669
|
return ut.create({ baseURL: e, timeout: 3e4 });
|
|
@@ -733,11 +736,11 @@ const Jn = { class: "yc-page-window__header" }, Xn = { class: "yc-page-window__t
|
|
|
733
736
|
},
|
|
734
737
|
emits: ["update:visible", "update:type", "confirm", "close", "opened", "changeType", "prev", "next", "checkRow"],
|
|
735
738
|
setup(e, { expose: n, emit: t }) {
|
|
736
|
-
const o = e, s = t, d = b(!1), v =
|
|
739
|
+
const o = e, s = t, d = b(!1), v = $(() => o.loading || d.value), _ = $(() => o.type === "detail" ? "详情" : o.type === "edit" ? "编辑" : o.type === "add" ? "新增" : ""), y = $(
|
|
737
740
|
() => o.list.length > 0 && o.row != null
|
|
738
|
-
), r =
|
|
741
|
+
), r = $(
|
|
739
742
|
() => ["detail", "edit"].includes(o.type)
|
|
740
|
-
), C =
|
|
743
|
+
), C = $(() => o.type !== "detail");
|
|
741
744
|
function V() {
|
|
742
745
|
if (!o.row) return -1;
|
|
743
746
|
const S = o.rowKey, U = o.row[S];
|
|
@@ -801,7 +804,7 @@ const Jn = { class: "yc-page-window__header" }, Xn = { class: "yc-page-window__t
|
|
|
801
804
|
_: 1
|
|
802
805
|
}),
|
|
803
806
|
T("span", null, D(e.title) + D(_.value), 1),
|
|
804
|
-
y.value ? (u(),
|
|
807
|
+
y.value ? (u(), A("div", Qn, [
|
|
805
808
|
m(k, {
|
|
806
809
|
content: "上一条",
|
|
807
810
|
placement: "top"
|
|
@@ -850,7 +853,7 @@ const Jn = { class: "yc-page-window__header" }, Xn = { class: "yc-page-window__t
|
|
|
850
853
|
]),
|
|
851
854
|
_: 1
|
|
852
855
|
})
|
|
853
|
-
])) :
|
|
856
|
+
])) : P("", !0),
|
|
854
857
|
r.value ? (u(), M(h, {
|
|
855
858
|
key: 1,
|
|
856
859
|
text: "",
|
|
@@ -868,11 +871,11 @@ const Jn = { class: "yc-page-window__header" }, Xn = { class: "yc-page-window__t
|
|
|
868
871
|
G(" " + D(e.type === "detail" ? "切换编辑" : "切换详情"), 1)
|
|
869
872
|
]),
|
|
870
873
|
_: 1
|
|
871
|
-
}, 8, ["type"])) :
|
|
874
|
+
}, 8, ["type"])) : P("", !0)
|
|
872
875
|
]),
|
|
873
876
|
T("div", Zn, [
|
|
874
877
|
ye(S.$slots, "opera", {}, void 0, !0),
|
|
875
|
-
e.showButtons && C.value ? (u(),
|
|
878
|
+
e.showButtons && C.value ? (u(), A(re, { key: 0 }, [
|
|
876
879
|
m(h, {
|
|
877
880
|
text: "",
|
|
878
881
|
disabled: v.value,
|
|
@@ -906,20 +909,20 @@ const Jn = { class: "yc-page-window__header" }, Xn = { class: "yc-page-window__t
|
|
|
906
909
|
G(" " + D(e.confirmText), 1)
|
|
907
910
|
]),
|
|
908
911
|
_: 1
|
|
909
|
-
}, 8, ["loading", "disabled"])) :
|
|
910
|
-
], 64)) :
|
|
912
|
+
}, 8, ["loading", "disabled"])) : P("", !0)
|
|
913
|
+
], 64)) : P("", !0)
|
|
911
914
|
])
|
|
912
915
|
]),
|
|
913
|
-
_e((u(),
|
|
916
|
+
_e((u(), A("div", eo, [
|
|
914
917
|
m(Y, { class: "yc-page-window__scroll" }, {
|
|
915
918
|
default: g(() => [
|
|
916
|
-
e.visible ? (u(),
|
|
919
|
+
e.visible ? (u(), A("div", {
|
|
917
920
|
key: 0,
|
|
918
921
|
class: "yc-page-window__body",
|
|
919
922
|
style: ot({ minHeight: e.contentMinHeight })
|
|
920
923
|
}, [
|
|
921
924
|
ye(S.$slots, "default", {}, void 0, !0)
|
|
922
|
-
], 4)) :
|
|
925
|
+
], 4)) : P("", !0)
|
|
923
926
|
]),
|
|
924
927
|
_: 3
|
|
925
928
|
})
|
|
@@ -1161,9 +1164,9 @@ const Mt = cn("ycAiTask", () => {
|
|
|
1161
1164
|
function V(i) {
|
|
1162
1165
|
return y.add(i), () => y.delete(i);
|
|
1163
1166
|
}
|
|
1164
|
-
const F =
|
|
1167
|
+
const F = $(
|
|
1165
1168
|
() => e.value.filter((i) => se(i.status)).length
|
|
1166
|
-
), X =
|
|
1169
|
+
), X = $(() => e.value.filter((i) => i.status === "running").length), O = $(() => F.value > 0 ? "AI 处理中" : e.value.some((i) => i.status === "failed") ? "部分任务失败" : "AI 任务"), f = $(() => {
|
|
1167
1170
|
const i = e.value.length, p = F.value;
|
|
1168
1171
|
return i === 0 ? "暂无任务" : p > 0 ? `${p}/${i} 项任务进行中` : `${i} 项任务已完成`;
|
|
1169
1172
|
});
|
|
@@ -1207,9 +1210,9 @@ const Mt = cn("ycAiTask", () => {
|
|
|
1207
1210
|
W();
|
|
1208
1211
|
return;
|
|
1209
1212
|
}
|
|
1210
|
-
await Promise.all(i.map((p) =>
|
|
1213
|
+
await Promise.all(i.map((p) => E(p.id)));
|
|
1211
1214
|
}
|
|
1212
|
-
async function
|
|
1215
|
+
async function E(i) {
|
|
1213
1216
|
if (v.has(i)) return;
|
|
1214
1217
|
const p = e.value.find((c) => c.id === i);
|
|
1215
1218
|
if (!(!(p != null && p.runId) || !se(p.status))) {
|
|
@@ -1253,7 +1256,7 @@ const Mt = cn("ycAiTask", () => {
|
|
|
1253
1256
|
const i = yo();
|
|
1254
1257
|
i.length && (e.value = i.map(To), Re = i.length);
|
|
1255
1258
|
const p = e.value.filter((c) => c.runId && se(c.status));
|
|
1256
|
-
p.length && (await Promise.all(p.map((c) =>
|
|
1259
|
+
p.length && (await Promise.all(p.map((c) => E(c.id))), j());
|
|
1257
1260
|
for (const c of e.value)
|
|
1258
1261
|
c.status === "pending" && !c.runId && H(c.id, { status: "failed", summary: "页面刷新前未提交成功", finishedAt: Date.now() });
|
|
1259
1262
|
}
|
|
@@ -1286,7 +1289,7 @@ const Mt = cn("ycAiTask", () => {
|
|
|
1286
1289
|
status: "running",
|
|
1287
1290
|
progress: 10,
|
|
1288
1291
|
summary: "后端异步处理中…"
|
|
1289
|
-
}), S(i, `▶ 已提交 runId=${c}`), j(),
|
|
1292
|
+
}), S(i, `▶ 已提交 runId=${c}`), j(), E(i);
|
|
1290
1293
|
} catch (c) {
|
|
1291
1294
|
const K = c instanceof Error ? c.message : "提交失败";
|
|
1292
1295
|
H(i, {
|
|
@@ -1383,7 +1386,7 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
|
|
|
1383
1386
|
},
|
|
1384
1387
|
emits: ["update:modelValue", "submitted"],
|
|
1385
1388
|
setup(e, { emit: n }) {
|
|
1386
|
-
const t = e, o = n, s = We(), d =
|
|
1389
|
+
const t = e, o = n, s = We(), d = $(() => t.modelValue !== void 0), v = b(!1);
|
|
1387
1390
|
ne(
|
|
1388
1391
|
() => t.modelValue,
|
|
1389
1392
|
(h) => {
|
|
@@ -1413,7 +1416,7 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
|
|
|
1413
1416
|
}), Ne(() => {
|
|
1414
1417
|
globalThis.removeEventListener(Ue, _);
|
|
1415
1418
|
});
|
|
1416
|
-
const y =
|
|
1419
|
+
const y = $(
|
|
1417
1420
|
() => (d.value ? void 0 : ae.options.title) ?? t.title ?? "AI 生成"
|
|
1418
1421
|
), r = b({
|
|
1419
1422
|
freeText: t.freeText,
|
|
@@ -1469,8 +1472,8 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
|
|
|
1469
1472
|
}
|
|
1470
1473
|
const h = r.value.autoMatch, k = h ? void 0 : r.value.promptId;
|
|
1471
1474
|
if (!h && k == null) {
|
|
1472
|
-
const
|
|
1473
|
-
Q.warning(
|
|
1475
|
+
const E = t.showPromptSelect || t.showAutoMatch ? "请选择提示词或开启自动匹配" : "请通过 promptId 传入提示词,或设置 autoMatch 为 true";
|
|
1476
|
+
Q.warning(E);
|
|
1474
1477
|
return;
|
|
1475
1478
|
}
|
|
1476
1479
|
F.value = !0;
|
|
@@ -1484,7 +1487,7 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
|
|
|
1484
1487
|
d.value ? o("submitted", j) : (ee = (W = ae.options).onSubmitted) == null || ee.call(W, j), v.value = !1, F.value = !1, Q.success("已加入任务队列,可在任务面板查看进度");
|
|
1485
1488
|
}
|
|
1486
1489
|
return (h, k) => {
|
|
1487
|
-
const Y = B("el-switch"), j = B("el-form-item"), W = B("el-option"), ee = B("el-select"),
|
|
1490
|
+
const Y = B("el-switch"), j = B("el-form-item"), W = B("el-option"), ee = B("el-select"), E = B("el-input"), oe = B("el-form"), le = B("el-button"), te = B("el-dialog");
|
|
1488
1491
|
return u(), M(te, {
|
|
1489
1492
|
modelValue: v.value,
|
|
1490
1493
|
"onUpdate:modelValue": k[4] || (k[4] = (R) => v.value = R),
|
|
@@ -1507,7 +1510,7 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
|
|
|
1507
1510
|
G(D(e.taskListButtonText), 1)
|
|
1508
1511
|
]),
|
|
1509
1512
|
_: 1
|
|
1510
|
-
})) :
|
|
1513
|
+
})) : P("", !0),
|
|
1511
1514
|
T("div", bo, [
|
|
1512
1515
|
m(le, {
|
|
1513
1516
|
onClick: k[3] || (k[3] = (R) => v.value = !1)
|
|
@@ -1547,7 +1550,7 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
|
|
|
1547
1550
|
}, null, 8, ["modelValue"])
|
|
1548
1551
|
]),
|
|
1549
1552
|
_: 1
|
|
1550
|
-
}, 8, ["label"])) :
|
|
1553
|
+
}, 8, ["label"])) : P("", !0),
|
|
1551
1554
|
e.showPromptSelect ? (u(), M(j, {
|
|
1552
1555
|
key: 1,
|
|
1553
1556
|
label: e.promptLabel,
|
|
@@ -1564,7 +1567,7 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
|
|
|
1564
1567
|
loading: V.value
|
|
1565
1568
|
}, {
|
|
1566
1569
|
default: g(() => [
|
|
1567
|
-
(u(!0),
|
|
1570
|
+
(u(!0), A(re, null, he(C.value, (R) => (u(), M(W, {
|
|
1568
1571
|
key: R.id,
|
|
1569
1572
|
label: R.name,
|
|
1570
1573
|
value: R.id
|
|
@@ -1574,13 +1577,13 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
|
|
|
1574
1577
|
}, 8, ["modelValue", "placeholder", "loading"])
|
|
1575
1578
|
]),
|
|
1576
1579
|
_: 1
|
|
1577
|
-
}, 8, ["label", "required"])) :
|
|
1580
|
+
}, 8, ["label", "required"])) : P("", !0),
|
|
1578
1581
|
m(j, {
|
|
1579
1582
|
label: e.freeTextLabel,
|
|
1580
1583
|
required: ""
|
|
1581
1584
|
}, {
|
|
1582
1585
|
default: g(() => [
|
|
1583
|
-
m(
|
|
1586
|
+
m(E, {
|
|
1584
1587
|
modelValue: r.value.freeText,
|
|
1585
1588
|
"onUpdate:modelValue": k[2] || (k[2] = (R) => r.value.freeText = R),
|
|
1586
1589
|
type: "textarea",
|
|
@@ -1673,7 +1676,7 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
|
|
|
1673
1676
|
G(" 取消全部 ", -1)
|
|
1674
1677
|
])]),
|
|
1675
1678
|
_: 1
|
|
1676
|
-
})) :
|
|
1679
|
+
})) : P("", !0),
|
|
1677
1680
|
m(V, {
|
|
1678
1681
|
link: "",
|
|
1679
1682
|
onClick: r[1] || (r[1] = (f) => w(o).toggleMinimize())
|
|
@@ -1705,8 +1708,8 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
|
|
|
1705
1708
|
])
|
|
1706
1709
|
]),
|
|
1707
1710
|
T("div", Oo, [
|
|
1708
|
-
w(o).tasks.length ? (u(),
|
|
1709
|
-
(u(!0),
|
|
1711
|
+
w(o).tasks.length ? (u(), A("div", Uo, [
|
|
1712
|
+
(u(!0), A(re, null, he(w(o).tasks, (f) => (u(), A("div", {
|
|
1710
1713
|
key: f.id,
|
|
1711
1714
|
class: "ai-task-row"
|
|
1712
1715
|
}, [
|
|
@@ -1747,9 +1750,9 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
|
|
|
1747
1750
|
T("div", Ko, D(f.title), 1),
|
|
1748
1751
|
T("div", No, [
|
|
1749
1752
|
T("span", null, D(v(f.status)), 1),
|
|
1750
|
-
f.runId ? (u(),
|
|
1753
|
+
f.runId ? (u(), A("span", zo, " · #" + D(f.runId), 1)) : P("", !0)
|
|
1751
1754
|
]),
|
|
1752
|
-
f.summary ? (u(),
|
|
1755
|
+
f.summary ? (u(), A("div", Yo, D(f.summary), 1)) : P("", !0)
|
|
1753
1756
|
]),
|
|
1754
1757
|
T("div", jo, [
|
|
1755
1758
|
f.status === "running" || f.status === "pending" ? (u(), M(V, {
|
|
@@ -1763,7 +1766,7 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
|
|
|
1763
1766
|
G(" 取消 ", -1)
|
|
1764
1767
|
])]),
|
|
1765
1768
|
_: 1
|
|
1766
|
-
}, 8, ["onClick"])) :
|
|
1769
|
+
}, 8, ["onClick"])) : P("", !0),
|
|
1767
1770
|
f.status === "succeeded" && f.runId ? (u(), M(V, {
|
|
1768
1771
|
key: 1,
|
|
1769
1772
|
link: "",
|
|
@@ -1776,7 +1779,7 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
|
|
|
1776
1779
|
G(" 使用 ", -1)
|
|
1777
1780
|
])]),
|
|
1778
1781
|
_: 1
|
|
1779
|
-
}, 8, ["loading", "onClick"])) :
|
|
1782
|
+
}, 8, ["loading", "onClick"])) : P("", !0),
|
|
1780
1783
|
f.status !== "running" && f.status !== "pending" ? (u(), M(V, {
|
|
1781
1784
|
key: 2,
|
|
1782
1785
|
link: "",
|
|
@@ -1787,7 +1790,7 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
|
|
|
1787
1790
|
G(" 移除 ", -1)
|
|
1788
1791
|
])]),
|
|
1789
1792
|
_: 1
|
|
1790
|
-
}, 8, ["onClick"])) :
|
|
1793
|
+
}, 8, ["onClick"])) : P("", !0)
|
|
1791
1794
|
])
|
|
1792
1795
|
]))), 128))
|
|
1793
1796
|
])) : (u(), M(F, {
|
|
@@ -1796,7 +1799,7 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
|
|
|
1796
1799
|
"image-size": 64
|
|
1797
1800
|
}))
|
|
1798
1801
|
]),
|
|
1799
|
-
w(o).tasks.some((f) => f.status !== "running" && f.status !== "pending") ? (u(),
|
|
1802
|
+
w(o).tasks.some((f) => f.status !== "running" && f.status !== "pending") ? (u(), A("div", Go, [
|
|
1800
1803
|
m(V, {
|
|
1801
1804
|
link: "",
|
|
1802
1805
|
type: "info",
|
|
@@ -1807,7 +1810,7 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
|
|
|
1807
1810
|
])]),
|
|
1808
1811
|
_: 1
|
|
1809
1812
|
})
|
|
1810
|
-
])) :
|
|
1813
|
+
])) : P("", !0)
|
|
1811
1814
|
], 512), [
|
|
1812
1815
|
[De, w(o).panelVisible && !w(o).panelMinimized]
|
|
1813
1816
|
])
|
|
@@ -1826,13 +1829,13 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
|
|
|
1826
1829
|
m(w(lt))
|
|
1827
1830
|
]),
|
|
1828
1831
|
_: 1
|
|
1829
|
-
})) :
|
|
1832
|
+
})) : P("", !0),
|
|
1830
1833
|
T("span", null, D(w(o).panelSubtitle), 1),
|
|
1831
1834
|
w(o).runningCount > 0 ? (u(), M(O, {
|
|
1832
1835
|
key: 1,
|
|
1833
1836
|
value: w(o).runningCount,
|
|
1834
1837
|
class: "m-l-8"
|
|
1835
|
-
}, null, 8, ["value"])) :
|
|
1838
|
+
}, null, 8, ["value"])) : P("", !0)
|
|
1836
1839
|
], 512), [
|
|
1837
1840
|
[De, w(o).panelVisible && w(o).panelMinimized]
|
|
1838
1841
|
])
|
|
@@ -1864,7 +1867,7 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
|
|
|
1864
1867
|
setup(e, { emit: n }) {
|
|
1865
1868
|
const t = e, o = n, s = Mt();
|
|
1866
1869
|
Be(bt, s), Be(xt, St(s));
|
|
1867
|
-
const d =
|
|
1870
|
+
const d = $(() => {
|
|
1868
1871
|
const y = {
|
|
1869
1872
|
title: t.title,
|
|
1870
1873
|
freeText: t.freeText,
|
|
@@ -1892,8 +1895,8 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
|
|
|
1892
1895
|
s.hydrate(), v = s.onTaskFinish((y) => o("finish", y));
|
|
1893
1896
|
}), Ne(() => {
|
|
1894
1897
|
v == null || v();
|
|
1895
|
-
}), (y, r) => (u(),
|
|
1896
|
-
e.showDialog !== !1 ? (u(), M(Eo, ft(ze({ key: 0 }, d.value)), null, 16)) :
|
|
1898
|
+
}), (y, r) => (u(), A(re, null, [
|
|
1899
|
+
e.showDialog !== !1 ? (u(), M(Eo, ft(ze({ key: 0 }, d.value)), null, 16)) : P("", !0),
|
|
1897
1900
|
m(qo, { onUse: _ }),
|
|
1898
1901
|
ye(y.$slots, "default")
|
|
1899
1902
|
], 64));
|
|
@@ -1975,7 +1978,7 @@ const Pt = Xo(Jo), rl = /* @__PURE__ */ de({
|
|
|
1975
1978
|
function C(O, f) {
|
|
1976
1979
|
return O in d.value ? d.value[O] : f;
|
|
1977
1980
|
}
|
|
1978
|
-
const V =
|
|
1981
|
+
const V = $(() => ({
|
|
1979
1982
|
title: C("title", t.title),
|
|
1980
1983
|
multiple: C("multiple", t.multiple),
|
|
1981
1984
|
maxCount: C("maxCount", t.maxCount),
|
|
@@ -2005,7 +2008,7 @@ const Pt = Xo(Jo), rl = /* @__PURE__ */ de({
|
|
|
2005
2008
|
var O, f;
|
|
2006
2009
|
(f = (O = d.value).onCancel) == null || f.call(O), r(), _();
|
|
2007
2010
|
}
|
|
2008
|
-
return n({ openImageSelector: v, closeImageSelector: _ }), (O, f) => (u(),
|
|
2011
|
+
return n({ openImageSelector: v, closeImageSelector: _ }), (O, f) => (u(), A(re, null, [
|
|
2009
2012
|
e.showDialog !== !1 ? (u(), M(Tt, ze({
|
|
2010
2013
|
key: 0,
|
|
2011
2014
|
modelValue: w(s),
|
|
@@ -2013,7 +2016,7 @@ const Pt = Xo(Jo), rl = /* @__PURE__ */ de({
|
|
|
2013
2016
|
}, V.value, {
|
|
2014
2017
|
onConfirm: F,
|
|
2015
2018
|
onCancel: X
|
|
2016
|
-
}), null, 16, ["modelValue"])) :
|
|
2019
|
+
}), null, 16, ["modelValue"])) : P("", !0),
|
|
2017
2020
|
ye(O.$slots, "default")
|
|
2018
2021
|
], 64));
|
|
2019
2022
|
}
|