yc-component 0.1.17 → 0.1.18
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/COMPONENTS.md +876 -0
- package/dist/ai-task/style.css +1 -1
- package/dist/button/YcButton.d.ts +93 -0
- package/dist/button/YcButton.d.ts.map +1 -0
- package/dist/button/index.d.ts +27 -0
- package/dist/button/index.d.ts.map +1 -0
- package/dist/button/normalize-permission.d.ts +10 -0
- package/dist/button/normalize-permission.d.ts.map +1 -0
- package/dist/config.d.ts +30 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/descriptions/YcDescriptions.d.ts +32 -0
- package/dist/descriptions/YcDescriptions.d.ts.map +1 -0
- package/dist/descriptions/index.d.ts +3 -0
- package/dist/descriptions/index.d.ts.map +1 -0
- package/dist/descriptions/types.d.ts +7 -0
- package/dist/descriptions/types.d.ts.map +1 -0
- package/dist/drawer/YcDrawer.d.ts +42 -0
- package/dist/drawer/YcDrawer.d.ts.map +1 -0
- package/dist/drawer/index.d.ts +2 -0
- package/dist/drawer/index.d.ts.map +1 -0
- package/dist/feedback/index.d.ts +21 -0
- package/dist/feedback/index.d.ts.map +1 -0
- package/dist/image-selector/components/YcImageSelectorDialog.d.ts.map +1 -1
- package/dist/image-selector/components/YcImageSelectorProvider.d.ts.map +1 -1
- package/dist/image-selector/index.d.ts +1 -1
- package/dist/image-selector/index.d.ts.map +1 -1
- package/dist/image-selector/style.css +1 -1
- package/dist/image-selector/types/index.d.ts +0 -9
- package/dist/image-selector/types/index.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/page/YcPage.d.ts +20 -0
- package/dist/page/YcPage.d.ts.map +1 -0
- package/dist/page/index.d.ts +2 -0
- package/dist/page/index.d.ts.map +1 -0
- package/dist/page-window/YcPageWindow.d.ts +1 -0
- package/dist/page-window/YcPageWindow.d.ts.map +1 -1
- package/dist/page-window/style.css +1 -1
- package/dist/permission/YcPermission.d.ts +29 -0
- package/dist/permission/YcPermission.d.ts.map +1 -0
- package/dist/permission/directive.d.ts +15 -0
- package/dist/permission/directive.d.ts.map +1 -0
- package/dist/permission/store.d.ts +29 -0
- package/dist/permission/store.d.ts.map +1 -0
- package/dist/permission/use-permission.d.ts +12 -0
- package/dist/permission/use-permission.d.ts.map +1 -0
- package/dist/plugin.d.ts +4 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/search/YcSearchForm.d.ts +21 -0
- package/dist/search/YcSearchForm.d.ts.map +1 -0
- package/dist/search/index.d.ts +3 -0
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/types.d.ts +13 -0
- package/dist/search/types.d.ts.map +1 -0
- package/dist/status/YcStatusTag.d.ts +14 -0
- package/dist/status/YcStatusTag.d.ts.map +1 -0
- package/dist/status/index.d.ts +3 -0
- package/dist/status/index.d.ts.map +1 -0
- package/dist/status/types.d.ts +7 -0
- package/dist/status/types.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/dist/table/YcTable.d.ts +107 -0
- package/dist/table/YcTable.d.ts.map +1 -0
- package/dist/table/columns.d.ts +6 -0
- package/dist/table/columns.d.ts.map +1 -0
- package/dist/table/index.d.ts +3 -0
- package/dist/table/index.d.ts.map +1 -0
- package/dist/table/types.d.ts +16 -0
- package/dist/table/types.d.ts.map +1 -0
- package/dist/upload/YcUpload.d.ts +33 -0
- package/dist/upload/YcUpload.d.ts.map +1 -0
- package/dist/upload/index.d.ts +3 -0
- package/dist/upload/index.d.ts.map +1 -0
- package/dist/upload/types.d.ts +6 -0
- package/dist/upload/types.d.ts.map +1 -0
- package/dist/utils/datetime.d.ts +3 -0
- package/dist/utils/datetime.d.ts.map +1 -0
- package/dist/yc-component.cjs.full.js +33 -26
- package/dist/yc-component.cjs.js +3 -3
- package/dist/yc-component.esm.full.js +37087 -6928
- package/dist/yc-component.esm.js +2318 -1169
- package/dist/yc-component.umd.full.js +53 -52
- package/dist/yc-component.umd.full.min.js +1 -1
- package/dist/yc-component.umd.js +4 -4
- package/dist/yc-component.umd.min.js +1 -1
- package/package.json +12 -6
package/dist/yc-component.esm.js
CHANGED
|
@@ -1,156 +1,170 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
import { reactive as
|
|
6
|
-
import { ElMessage as
|
|
7
|
-
import { Search as
|
|
8
|
-
import {
|
|
9
|
-
|
|
1
|
+
var _n = Object.defineProperty;
|
|
2
|
+
var wn = (e, n, t) => n in e ? _n(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
|
|
3
|
+
var St = (e, n, t) => wn(e, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import Vt from "axios";
|
|
5
|
+
import { reactive as mt, defineComponent as oe, computed as I, ref as x, watch as ue, onMounted as Me, onUnmounted as pt, resolveComponent as Q, resolveDirective as vt, openBlock as r, createBlock as V, withCtx as v, createElementVNode as k, createElementBlock as E, createVNode as h, withKeys as zt, unref as p, createCommentVNode as R, createTextVNode as X, normalizeClass as ye, toDisplayString as F, Fragment as ce, renderList as me, withDirectives as Ee, renderSlot as ee, normalizeProps as Lt, mergeProps as Ge, withModifiers as lt, nextTick as at, render as bn, onBeforeUnmount as gt, Transition as Ot, normalizeStyle as Ke, vShow as ot, getCurrentInstance as yt, provide as je, inject as qe, useAttrs as kn, createSlots as Yt, Teleport as Tn, isRef as Sn } from "vue";
|
|
6
|
+
import { ElMessage as de } from "element-plus";
|
|
7
|
+
import { Search as Cn, Upload as In, Check as Ut, ArrowLeft as An, ArrowUpBold as $n, ArrowDownBold as xn, Switch as En, Close as Rt, ArrowDown as Nt, Refresh as Ct, CircleCheck as Mn, CircleClose as Dn, Remove as Pn } from "@element-plus/icons-vue";
|
|
8
|
+
import { ElButton as Te } from "element-plus/es/components/button/index";
|
|
9
|
+
import { ElMessageBox as ht } from "element-plus/es/components/message-box/index";
|
|
10
|
+
import { ElDatePicker as It } from "element-plus/es/components/date-picker/index";
|
|
11
|
+
import { ElIcon as Bn } from "element-plus/es/components/icon/index";
|
|
12
|
+
import { ElInput as Vn } from "element-plus/es/components/input/index";
|
|
13
|
+
import { ElSelect as it, ElOption as be } from "element-plus/es/components/select/index";
|
|
14
|
+
import { ElEmpty as zn } from "element-plus/es/components/empty/index";
|
|
15
|
+
import { ElDialog as Ln } from "element-plus/es/components/dialog/index";
|
|
16
|
+
import { ElSwitch as At } from "element-plus/es/components/switch/index";
|
|
17
|
+
import { VxeTable as On, VxeColumn as $t, VxePager as Yn } from "vxe-table";
|
|
18
|
+
import { ElTag as Ft } from "element-plus/es/components/tag/index";
|
|
19
|
+
import { ElDrawer as Un } from "element-plus/es/components/drawer/index";
|
|
20
|
+
import { ElMessage as et } from "element-plus/es/components/message/index";
|
|
21
|
+
import { ElDescriptions as Rn, ElDescriptionsItem as Nn } from "element-plus/es/components/descriptions/index";
|
|
22
|
+
import { storeToRefs as Fn, defineStore as Kn } from "pinia";
|
|
23
|
+
const _t = {
|
|
10
24
|
projectId: "default-project",
|
|
11
25
|
storageKey: "yc-ai-task-queue-v1"
|
|
12
26
|
};
|
|
13
|
-
let
|
|
14
|
-
function
|
|
15
|
-
|
|
27
|
+
let Le = { ..._t };
|
|
28
|
+
function jn(e) {
|
|
29
|
+
Le = { ...Le, ...e };
|
|
16
30
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
31
|
+
function Kt() {
|
|
32
|
+
return Le;
|
|
19
33
|
}
|
|
20
|
-
function
|
|
21
|
-
return
|
|
34
|
+
function Wn() {
|
|
35
|
+
return Le.projectId ?? _t.projectId;
|
|
22
36
|
}
|
|
23
|
-
function
|
|
24
|
-
return
|
|
37
|
+
function jt() {
|
|
38
|
+
return Le.storageKey ?? _t.storageKey;
|
|
25
39
|
}
|
|
26
|
-
let
|
|
27
|
-
function
|
|
28
|
-
|
|
40
|
+
let ke = null;
|
|
41
|
+
function Hn() {
|
|
42
|
+
ke = null;
|
|
29
43
|
}
|
|
30
|
-
function
|
|
31
|
-
if (
|
|
32
|
-
const { baseURL: e, getToken: n, onUnauthorized: t } =
|
|
33
|
-
return
|
|
44
|
+
function De() {
|
|
45
|
+
if (ke) return ke;
|
|
46
|
+
const { baseURL: e, getToken: n, onUnauthorized: t } = Kt();
|
|
47
|
+
return ke = Vt.create({
|
|
34
48
|
baseURL: e ?? "",
|
|
35
49
|
timeout: 6e4,
|
|
36
50
|
headers: { "Content-Type": "application/json" }
|
|
37
|
-
}),
|
|
38
|
-
const
|
|
39
|
-
return
|
|
40
|
-
}),
|
|
41
|
-
(
|
|
42
|
-
const
|
|
43
|
-
return (
|
|
51
|
+
}), ke.interceptors.request.use((l) => {
|
|
52
|
+
const a = n == null ? void 0 : n();
|
|
53
|
+
return a && (l.headers.Authorization = `Bearer ${a}`), l;
|
|
54
|
+
}), ke.interceptors.response.use(
|
|
55
|
+
(l) => {
|
|
56
|
+
const a = l.data;
|
|
57
|
+
return (a == null ? void 0 : a.code) != null && a.code !== 200 ? Promise.reject(new Error(a.message || "请求失败")) : (l.data = (a == null ? void 0 : a.data) ?? a, l);
|
|
44
58
|
},
|
|
45
|
-
(
|
|
46
|
-
var
|
|
47
|
-
((
|
|
48
|
-
const
|
|
49
|
-
return Promise.reject(new Error(
|
|
59
|
+
(l) => {
|
|
60
|
+
var o, y, f;
|
|
61
|
+
((o = l.response) == null ? void 0 : o.status) === 401 && (t == null || t());
|
|
62
|
+
const a = (f = (y = l.response) == null ? void 0 : y.data) == null ? void 0 : f.message;
|
|
63
|
+
return Promise.reject(new Error(a || l.message || "请求失败"));
|
|
50
64
|
}
|
|
51
|
-
),
|
|
65
|
+
), ke;
|
|
52
66
|
}
|
|
53
|
-
async function
|
|
54
|
-
const
|
|
67
|
+
async function Gn(e, n) {
|
|
68
|
+
const l = (await De().get(
|
|
55
69
|
`/yc-ai/workflows/runs/${e}/artifacts/${n}`,
|
|
56
|
-
{ transformResponse: [(
|
|
70
|
+
{ transformResponse: [(a) => a] }
|
|
57
71
|
)).data;
|
|
58
|
-
if (typeof
|
|
72
|
+
if (typeof l == "string")
|
|
59
73
|
try {
|
|
60
|
-
return JSON.parse(
|
|
74
|
+
return JSON.parse(l);
|
|
61
75
|
} catch {
|
|
62
|
-
return
|
|
76
|
+
return l;
|
|
63
77
|
}
|
|
64
|
-
return
|
|
78
|
+
return l;
|
|
65
79
|
}
|
|
66
|
-
let
|
|
67
|
-
function
|
|
68
|
-
|
|
80
|
+
let st = {};
|
|
81
|
+
function qn(e) {
|
|
82
|
+
st = { ...st, ...e };
|
|
69
83
|
}
|
|
70
|
-
function
|
|
71
|
-
return
|
|
84
|
+
function Je() {
|
|
85
|
+
return st;
|
|
72
86
|
}
|
|
73
|
-
class
|
|
87
|
+
class We extends Error {
|
|
74
88
|
constructor(n = "Image selector cancelled") {
|
|
75
89
|
super(n), this.name = "ImageSelectorCancelledError";
|
|
76
90
|
}
|
|
77
91
|
}
|
|
78
|
-
class
|
|
79
|
-
constructor(t,
|
|
80
|
-
super(
|
|
92
|
+
class xt extends Error {
|
|
93
|
+
constructor(t, l) {
|
|
94
|
+
super(l || {
|
|
81
95
|
missing_token: "请先填写并保存云盘 Access Token",
|
|
82
96
|
unauthorized: "云盘 Access Token 无效或已过期",
|
|
83
97
|
valid_site: "请先在云盘配置有效站点",
|
|
84
98
|
unknown: "云盘鉴权失败"
|
|
85
99
|
}[t]);
|
|
86
|
-
|
|
100
|
+
St(this, "reason");
|
|
87
101
|
this.name = "ImageSelectorAuthError", this.reason = t;
|
|
88
102
|
}
|
|
89
103
|
}
|
|
90
|
-
let
|
|
91
|
-
function
|
|
92
|
-
return
|
|
93
|
-
|
|
104
|
+
let fe = null;
|
|
105
|
+
function Jn() {
|
|
106
|
+
return fe && (fe.reject(new We()), fe = null), new Promise((e, n) => {
|
|
107
|
+
fe = { resolve: e, reject: n };
|
|
94
108
|
});
|
|
95
109
|
}
|
|
96
|
-
function
|
|
97
|
-
|
|
110
|
+
function Xn(e) {
|
|
111
|
+
fe == null || fe.resolve(e), fe = null;
|
|
98
112
|
}
|
|
99
|
-
function
|
|
100
|
-
|
|
113
|
+
function Et() {
|
|
114
|
+
fe == null || fe.reject(new We()), fe = null;
|
|
101
115
|
}
|
|
102
|
-
const
|
|
103
|
-
function
|
|
116
|
+
const tt = "__YC_COMPONENT_IMAGE_SELECTOR__", rt = "yc-component:image-selector-open";
|
|
117
|
+
function Qn() {
|
|
104
118
|
const e = globalThis;
|
|
105
|
-
return e[
|
|
119
|
+
return e[tt] || (e[tt] = mt({
|
|
106
120
|
visible: !1,
|
|
107
121
|
options: {}
|
|
108
|
-
})), e[
|
|
122
|
+
})), e[tt];
|
|
109
123
|
}
|
|
110
|
-
const
|
|
111
|
-
function
|
|
112
|
-
|
|
113
|
-
new CustomEvent(
|
|
124
|
+
const se = Qn();
|
|
125
|
+
function Zn(e = {}) {
|
|
126
|
+
se.options = { ...e }, se.visible = !0, globalThis.dispatchEvent(
|
|
127
|
+
new CustomEvent(rt, { detail: { ...e } })
|
|
114
128
|
);
|
|
115
129
|
}
|
|
116
|
-
function
|
|
117
|
-
|
|
130
|
+
function Wt() {
|
|
131
|
+
se.visible = !1;
|
|
118
132
|
}
|
|
119
|
-
function
|
|
120
|
-
|
|
133
|
+
function Ht() {
|
|
134
|
+
Wt();
|
|
121
135
|
}
|
|
122
|
-
function
|
|
123
|
-
const n =
|
|
124
|
-
return
|
|
136
|
+
function Gt(e = {}) {
|
|
137
|
+
const n = Jn();
|
|
138
|
+
return Zn(e), n;
|
|
125
139
|
}
|
|
126
|
-
const
|
|
140
|
+
const el = { class: "yc-image-selector" }, tl = {
|
|
127
141
|
key: 0,
|
|
128
142
|
class: "yc-image-selector__toolbar"
|
|
129
|
-
},
|
|
143
|
+
}, nl = { class: "yc-image-selector__body" }, ll = {
|
|
130
144
|
key: 0,
|
|
131
145
|
class: "yc-image-selector__aside"
|
|
132
|
-
},
|
|
146
|
+
}, al = ["onClick"], ol = {
|
|
133
147
|
key: 0,
|
|
134
148
|
class: "yc-image-selector__category-count"
|
|
135
|
-
},
|
|
149
|
+
}, il = { class: "yc-image-selector__main" }, sl = {
|
|
136
150
|
key: 1,
|
|
137
151
|
class: "yc-image-selector__grid"
|
|
138
|
-
},
|
|
152
|
+
}, rl = ["onClick"], ul = { class: "yc-image-selector__thumb" }, cl = ["src", "alt", "onLoad"], dl = {
|
|
139
153
|
key: 0,
|
|
140
154
|
class: "yc-image-selector__order"
|
|
141
|
-
},
|
|
155
|
+
}, fl = ["title"], ml = {
|
|
142
156
|
key: 1,
|
|
143
157
|
class: "yc-image-selector__selected-bar"
|
|
144
|
-
},
|
|
158
|
+
}, pl = { class: "yc-image-selector__selected-bar-label" }, vl = { class: "yc-image-selector__selected-bar-list" }, gl = ["onClick"], yl = ["src", "alt"], hl = {
|
|
145
159
|
key: 2,
|
|
146
160
|
class: "yc-image-selector__pagination"
|
|
147
|
-
},
|
|
161
|
+
}, _l = {
|
|
148
162
|
key: 0,
|
|
149
163
|
class: "yc-image-selector__footer"
|
|
150
|
-
},
|
|
164
|
+
}, wl = { class: "yc-image-selector__selected-tip" }, bl = { class: "yc-image-selector__footer-actions" }, kl = {
|
|
151
165
|
key: 1,
|
|
152
166
|
class: "yc-image-selector__footer yc-image-selector__footer--quick"
|
|
153
|
-
},
|
|
167
|
+
}, Tl = { class: "yc-image-selector__selected-tip" }, Sl = /* @__PURE__ */ oe({
|
|
154
168
|
__name: "YcImageSelectorDialog",
|
|
155
169
|
props: {
|
|
156
170
|
modelValue: { type: [Boolean, null], default: null },
|
|
@@ -171,14 +185,13 @@ const Cn = { class: "yc-image-selector" }, Sn = {
|
|
|
171
185
|
cancelText: { default: "取消" },
|
|
172
186
|
emptyText: { default: "暂无图片资源" },
|
|
173
187
|
renderEmpty: {},
|
|
174
|
-
renderFooterExtra: {},
|
|
175
188
|
getImages: {},
|
|
176
189
|
upload: {},
|
|
177
190
|
urlField: { default: "url" }
|
|
178
191
|
},
|
|
179
192
|
emits: ["update:modelValue", "confirm", "cancel"],
|
|
180
193
|
setup(e, { emit: n }) {
|
|
181
|
-
const t =
|
|
194
|
+
const t = oe({
|
|
182
195
|
name: "YcImageSelectorRenderEmpty",
|
|
183
196
|
props: {
|
|
184
197
|
render: {
|
|
@@ -190,573 +203,534 @@ const Cn = { class: "yc-image-selector" }, Sn = {
|
|
|
190
203
|
required: !0
|
|
191
204
|
}
|
|
192
205
|
},
|
|
193
|
-
setup(
|
|
194
|
-
return () =>
|
|
195
|
-
}
|
|
196
|
-
}), o = ue({
|
|
197
|
-
name: "YcImageSelectorRenderFooterExtra",
|
|
198
|
-
props: {
|
|
199
|
-
render: {
|
|
200
|
-
type: Function,
|
|
201
|
-
required: !0
|
|
202
|
-
},
|
|
203
|
-
ctx: {
|
|
204
|
-
type: Object,
|
|
205
|
-
required: !0
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
setup(a) {
|
|
209
|
-
return () => a.render(a.ctx);
|
|
206
|
+
setup(d) {
|
|
207
|
+
return () => d.render(d.ctx);
|
|
210
208
|
}
|
|
211
|
-
}), l = e,
|
|
212
|
-
|
|
209
|
+
}), l = e, a = n, o = I(() => l.modelValue != null), y = x(!1), f = x(null);
|
|
210
|
+
ue(
|
|
213
211
|
() => l.modelValue,
|
|
214
|
-
(
|
|
215
|
-
|
|
212
|
+
(d) => {
|
|
213
|
+
o.value && (y.value = !!d);
|
|
216
214
|
},
|
|
217
215
|
{ immediate: !0 }
|
|
218
|
-
),
|
|
219
|
-
if (
|
|
220
|
-
|
|
216
|
+
), ue(y, (d) => {
|
|
217
|
+
if (o.value) {
|
|
218
|
+
a("update:modelValue", d);
|
|
221
219
|
return;
|
|
222
220
|
}
|
|
223
|
-
|
|
224
|
-
}),
|
|
225
|
-
() =>
|
|
226
|
-
(
|
|
227
|
-
|
|
221
|
+
se.visible = d, d || Wt();
|
|
222
|
+
}), ue(
|
|
223
|
+
() => se.visible,
|
|
224
|
+
(d) => {
|
|
225
|
+
o.value || (y.value = d);
|
|
228
226
|
},
|
|
229
227
|
{ immediate: !0 }
|
|
230
228
|
);
|
|
231
|
-
const
|
|
232
|
-
() => (
|
|
233
|
-
),
|
|
234
|
-
() => (
|
|
235
|
-
),
|
|
236
|
-
() => (
|
|
237
|
-
),
|
|
238
|
-
() => (
|
|
239
|
-
),
|
|
240
|
-
() => (
|
|
241
|
-
),
|
|
242
|
-
var
|
|
243
|
-
if ((
|
|
244
|
-
if (!
|
|
245
|
-
return
|
|
246
|
-
}),
|
|
247
|
-
() => (
|
|
248
|
-
), z =
|
|
229
|
+
const m = I(
|
|
230
|
+
() => (o.value ? void 0 : se.options.title) ?? l.title ?? "选择图片"
|
|
231
|
+
), i = I(
|
|
232
|
+
() => (o.value ? void 0 : se.options.multiple) ?? l.multiple
|
|
233
|
+
), $ = I(
|
|
234
|
+
() => (o.value ? void 0 : se.options.maxCount) ?? l.maxCount
|
|
235
|
+
), M = I(
|
|
236
|
+
() => (o.value ? void 0 : se.options.showModeSwitch) ?? l.showModeSwitch
|
|
237
|
+
), P = I(
|
|
238
|
+
() => (o.value ? void 0 : se.options.showCategories) ?? l.showCategories
|
|
239
|
+
), K = I(() => {
|
|
240
|
+
var d, u;
|
|
241
|
+
if ((d = l.categories) != null && d.length) return l.categories;
|
|
242
|
+
if (!o.value && ((u = se.options.categories) != null && u.length))
|
|
243
|
+
return se.options.categories;
|
|
244
|
+
}), O = I(() => P.value ? K.value ?? ie.value : []), _ = I(
|
|
245
|
+
() => (o.value ? void 0 : se.options.confirmOnSelect) ?? l.confirmOnSelect
|
|
246
|
+
), z = x("single"), B = [
|
|
249
247
|
{ label: "单选", value: "single" },
|
|
250
248
|
{ label: "多选", value: "multiple" }
|
|
251
|
-
],
|
|
252
|
-
() =>
|
|
253
|
-
),
|
|
254
|
-
authState:
|
|
255
|
-
isEmpty:
|
|
256
|
-
reload:
|
|
257
|
-
}))
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
message: a == null ? void 0 : a.message
|
|
262
|
-
}, H.value = [], K.value = 0, Q.value = [], Y.value = "", _.value = "", C.value = 1;
|
|
263
|
-
}
|
|
264
|
-
const f = P(() => ({
|
|
265
|
-
isAuthenticated: !p.value,
|
|
266
|
-
enterAuthSetup: s
|
|
267
|
-
})), d = P(() => {
|
|
268
|
-
var i, x;
|
|
269
|
-
const a = G.value.length;
|
|
270
|
-
return L.value ? a ? `已选:${((i = G.value[0]) == null ? void 0 : i.name) || "1 张图片"}` : "单击图片即可完成选择" : a ? M.value ? `已选 ${a} / ${D.value} 张` : `已选:${((x = G.value[0]) == null ? void 0 : x.name) || "1 张图片"}` : M.value ? `多选模式:最多 ${D.value} 张` : "单选模式:请选择一张图片";
|
|
249
|
+
], D = I(
|
|
250
|
+
() => M.value ? z.value === "multiple" : i.value
|
|
251
|
+
), G = x(""), L = x(""), S = x(1), g = x(0), Y = x(!1), Z = x(!1), N = x([]), ie = x([]), C = x(/* @__PURE__ */ new Map()), J = x(/* @__PURE__ */ new Map()), ne = x(), le = x(), H = x(!1), te = I(() => [...C.value.values()]), Se = I(() => !!f.value || N.value.length === 0), Ce = I(() => ({
|
|
252
|
+
authState: f.value,
|
|
253
|
+
isEmpty: N.value.length === 0,
|
|
254
|
+
reload: s
|
|
255
|
+
})), Ie = I(() => {
|
|
256
|
+
var u, W;
|
|
257
|
+
const d = te.value.length;
|
|
258
|
+
return _.value ? d ? `已选:${((u = te.value[0]) == null ? void 0 : u.name) || "1 张图片"}` : "单击图片即可完成选择" : d ? D.value ? `已选 ${d} / ${$.value} 张` : `已选:${((W = te.value[0]) == null ? void 0 : W.name) || "1 张图片"}` : D.value ? `多选模式:最多 ${$.value} 张` : "单选模式:请选择一张图片";
|
|
271
259
|
});
|
|
272
|
-
function
|
|
273
|
-
const
|
|
274
|
-
return
|
|
275
|
-
}
|
|
276
|
-
function
|
|
277
|
-
if (
|
|
278
|
-
const
|
|
279
|
-
|
|
260
|
+
function c(d) {
|
|
261
|
+
const u = te.value.findIndex((W) => ae(W) === ae(d));
|
|
262
|
+
return u >= 0 ? u + 1 : "";
|
|
263
|
+
}
|
|
264
|
+
function A(d) {
|
|
265
|
+
if (d === "single" && te.value.length > 1) {
|
|
266
|
+
const u = te.value[0];
|
|
267
|
+
C.value = /* @__PURE__ */ new Map([[ae(u), u]]), de.info("已切换为单选,仅保留第一张");
|
|
280
268
|
}
|
|
281
269
|
}
|
|
282
|
-
function
|
|
283
|
-
z.value =
|
|
270
|
+
function T() {
|
|
271
|
+
z.value = i.value ? "multiple" : "single";
|
|
284
272
|
}
|
|
285
|
-
function
|
|
286
|
-
|
|
273
|
+
function q() {
|
|
274
|
+
C.value = /* @__PURE__ */ new Map();
|
|
287
275
|
}
|
|
288
|
-
function
|
|
289
|
-
return
|
|
276
|
+
function ve(d) {
|
|
277
|
+
return d[l.urlField];
|
|
290
278
|
}
|
|
291
|
-
function
|
|
292
|
-
return
|
|
279
|
+
function ae(d) {
|
|
280
|
+
return d.id ?? d.url;
|
|
293
281
|
}
|
|
294
|
-
function
|
|
295
|
-
return
|
|
282
|
+
function Ae(d) {
|
|
283
|
+
return C.value.has(ae(d));
|
|
296
284
|
}
|
|
297
|
-
function
|
|
298
|
-
return
|
|
285
|
+
function Oe(d, u) {
|
|
286
|
+
return d < u ? "portrait" : d > u ? "landscape" : "square";
|
|
299
287
|
}
|
|
300
|
-
function
|
|
301
|
-
const
|
|
302
|
-
|
|
288
|
+
function $e(d, u) {
|
|
289
|
+
const W = ae(d);
|
|
290
|
+
J.value.get(W) !== u && (J.value.set(W, u), J.value = new Map(J.value));
|
|
303
291
|
}
|
|
304
|
-
function
|
|
305
|
-
const
|
|
306
|
-
return
|
|
292
|
+
function Xe(d) {
|
|
293
|
+
const u = J.value.get(ae(d));
|
|
294
|
+
return u ? `yc-image-selector__img--${u}` : "";
|
|
307
295
|
}
|
|
308
|
-
function
|
|
309
|
-
const
|
|
310
|
-
!(
|
|
296
|
+
function Qe(d, u) {
|
|
297
|
+
const W = d.target;
|
|
298
|
+
!(W != null && W.naturalWidth) || !(W != null && W.naturalHeight) || $e(u, Oe(W.naturalWidth, W.naturalHeight));
|
|
311
299
|
}
|
|
312
|
-
function
|
|
313
|
-
|
|
300
|
+
function Ze(d) {
|
|
301
|
+
d.width && d.height && $e(d, Oe(d.width, d.height));
|
|
314
302
|
}
|
|
315
|
-
function
|
|
316
|
-
const
|
|
317
|
-
if (!(
|
|
318
|
-
|
|
303
|
+
function Ye(d) {
|
|
304
|
+
const u = /* @__PURE__ */ new Map();
|
|
305
|
+
if (!(d != null && d.length)) {
|
|
306
|
+
C.value = u;
|
|
319
307
|
return;
|
|
320
308
|
}
|
|
321
|
-
if (typeof
|
|
322
|
-
for (const
|
|
323
|
-
|
|
309
|
+
if (typeof d[0] == "string")
|
|
310
|
+
for (const ge of d)
|
|
311
|
+
u.set(ge, { id: ge, url: ge, name: ge.split("/").pop() });
|
|
324
312
|
else
|
|
325
|
-
for (const
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
}
|
|
329
|
-
function
|
|
330
|
-
|
|
331
|
-
}
|
|
332
|
-
function
|
|
333
|
-
if (
|
|
334
|
-
const
|
|
335
|
-
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
globalThis.addEventListener(
|
|
339
|
-
}),
|
|
340
|
-
globalThis.removeEventListener(
|
|
313
|
+
for (const ge of d)
|
|
314
|
+
u.set(ae(ge), ge);
|
|
315
|
+
C.value = u;
|
|
316
|
+
}
|
|
317
|
+
function xe(d) {
|
|
318
|
+
ne.value = d.onConfirm, le.value = d.onCancel, Ye(d.selected ?? l.selected);
|
|
319
|
+
}
|
|
320
|
+
function Ue(d) {
|
|
321
|
+
if (o.value) return;
|
|
322
|
+
const u = d.detail ?? {};
|
|
323
|
+
xe(u), y.value = !0;
|
|
324
|
+
}
|
|
325
|
+
Me(() => {
|
|
326
|
+
globalThis.addEventListener(rt, Ue), o.value || (y.value = se.visible);
|
|
327
|
+
}), pt(() => {
|
|
328
|
+
globalThis.removeEventListener(rt, Ue);
|
|
341
329
|
});
|
|
342
|
-
async function
|
|
343
|
-
var
|
|
330
|
+
async function Pe() {
|
|
331
|
+
var d;
|
|
344
332
|
if (!l.getImages) {
|
|
345
|
-
|
|
333
|
+
de.error("请通过 props.getImages 传入图片列表请求方法");
|
|
346
334
|
return;
|
|
347
335
|
}
|
|
348
|
-
|
|
336
|
+
Y.value = !0, f.value = null;
|
|
349
337
|
try {
|
|
350
|
-
const
|
|
351
|
-
keyword:
|
|
352
|
-
category:
|
|
353
|
-
page:
|
|
338
|
+
const u = await l.getImages({
|
|
339
|
+
keyword: G.value.trim() || void 0,
|
|
340
|
+
category: P.value && L.value || void 0,
|
|
341
|
+
page: S.value,
|
|
354
342
|
pageSize: l.pageSize
|
|
355
343
|
});
|
|
356
|
-
|
|
357
|
-
for (const
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
} catch (
|
|
361
|
-
if (
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
reason:
|
|
365
|
-
message:
|
|
344
|
+
N.value = u.list, g.value = u.total;
|
|
345
|
+
for (const W of u.list)
|
|
346
|
+
Ze(W);
|
|
347
|
+
P.value && !K.value && ((d = u.categories) != null && d.length) && (ie.value = u.categories);
|
|
348
|
+
} catch (u) {
|
|
349
|
+
if (N.value = [], g.value = 0, u instanceof xt || (u == null ? void 0 : u.name) === "ImageSelectorAuthError") {
|
|
350
|
+
const W = u;
|
|
351
|
+
f.value = {
|
|
352
|
+
reason: W.reason || "unknown",
|
|
353
|
+
message: W.message
|
|
366
354
|
};
|
|
367
355
|
return;
|
|
368
356
|
}
|
|
369
|
-
|
|
357
|
+
de.error(u instanceof Error ? u.message : "加载图片失败");
|
|
370
358
|
} finally {
|
|
371
|
-
|
|
359
|
+
Y.value = !1;
|
|
372
360
|
}
|
|
373
361
|
}
|
|
374
|
-
function
|
|
375
|
-
|
|
362
|
+
function s() {
|
|
363
|
+
S.value = 1, Pe();
|
|
376
364
|
}
|
|
377
|
-
function
|
|
378
|
-
|
|
365
|
+
function w(d) {
|
|
366
|
+
L.value !== d && (L.value = d, s());
|
|
379
367
|
}
|
|
380
|
-
function
|
|
381
|
-
const
|
|
382
|
-
if (
|
|
383
|
-
if (
|
|
384
|
-
|
|
368
|
+
function b(d) {
|
|
369
|
+
const u = ae(d);
|
|
370
|
+
if (D.value) {
|
|
371
|
+
if (C.value.has(u)) {
|
|
372
|
+
C.value.delete(u), C.value = new Map(C.value);
|
|
385
373
|
return;
|
|
386
374
|
}
|
|
387
|
-
if (
|
|
388
|
-
|
|
375
|
+
if (te.value.length >= $.value) {
|
|
376
|
+
de.warning(`最多选择 ${$.value} 张图片`);
|
|
389
377
|
return;
|
|
390
378
|
}
|
|
391
|
-
|
|
379
|
+
C.value.set(u, d), C.value = new Map(C.value);
|
|
392
380
|
return;
|
|
393
381
|
}
|
|
394
|
-
if (
|
|
395
|
-
if (
|
|
396
|
-
|
|
382
|
+
if (C.value.has(u)) {
|
|
383
|
+
if (_.value) {
|
|
384
|
+
at(() => Re());
|
|
397
385
|
return;
|
|
398
386
|
}
|
|
399
|
-
|
|
387
|
+
C.value = /* @__PURE__ */ new Map();
|
|
400
388
|
return;
|
|
401
389
|
}
|
|
402
|
-
|
|
390
|
+
C.value = /* @__PURE__ */ new Map([[u, d]]), _.value && at(() => Re());
|
|
403
391
|
}
|
|
404
|
-
async function
|
|
392
|
+
async function j(d) {
|
|
405
393
|
if (!l.upload) {
|
|
406
|
-
|
|
394
|
+
de.error("请通过 props.upload 传入图片上传方法");
|
|
407
395
|
return;
|
|
408
396
|
}
|
|
409
|
-
|
|
397
|
+
Z.value = !0;
|
|
410
398
|
try {
|
|
411
|
-
const { resource:
|
|
412
|
-
if (
|
|
413
|
-
|
|
414
|
-
else if (
|
|
415
|
-
|
|
399
|
+
const { resource: u } = await l.upload(d.file);
|
|
400
|
+
if (de.success("上传成功"), f.value = null, D.value)
|
|
401
|
+
te.value.length < $.value && (C.value.set(ae(u), u), C.value = new Map(C.value));
|
|
402
|
+
else if (C.value = /* @__PURE__ */ new Map([[ae(u), u]]), _.value) {
|
|
403
|
+
Re();
|
|
416
404
|
return;
|
|
417
405
|
}
|
|
418
|
-
|
|
419
|
-
} catch (
|
|
420
|
-
if (
|
|
421
|
-
const
|
|
422
|
-
|
|
423
|
-
reason:
|
|
424
|
-
message:
|
|
425
|
-
},
|
|
406
|
+
s();
|
|
407
|
+
} catch (u) {
|
|
408
|
+
if (u instanceof xt || (u == null ? void 0 : u.name) === "ImageSelectorAuthError") {
|
|
409
|
+
const W = u;
|
|
410
|
+
f.value = {
|
|
411
|
+
reason: W.reason || "unknown",
|
|
412
|
+
message: W.message
|
|
413
|
+
}, N.value = [], g.value = 0;
|
|
426
414
|
return;
|
|
427
415
|
}
|
|
428
|
-
|
|
416
|
+
de.error(u instanceof Error ? u.message : "上传失败");
|
|
429
417
|
} finally {
|
|
430
|
-
|
|
418
|
+
Z.value = !1;
|
|
431
419
|
}
|
|
432
420
|
}
|
|
433
|
-
function
|
|
434
|
-
|
|
421
|
+
function re() {
|
|
422
|
+
H.value = !1, G.value = "", L.value = "", S.value = 1, ie.value = [], J.value = /* @__PURE__ */ new Map(), f.value = null, T(), o.value ? xe({}) : xe(se.options), T(), Pe();
|
|
435
423
|
}
|
|
436
|
-
function
|
|
437
|
-
|
|
424
|
+
function fn() {
|
|
425
|
+
Z.value = !1;
|
|
438
426
|
}
|
|
439
|
-
function
|
|
440
|
-
var
|
|
441
|
-
|
|
427
|
+
function Tt() {
|
|
428
|
+
var d;
|
|
429
|
+
H.value || (H.value = !0, (d = le.value) == null || d.call(le), o.value || Et(), a("cancel"), y.value = !1);
|
|
442
430
|
}
|
|
443
|
-
function
|
|
444
|
-
var
|
|
445
|
-
if (!
|
|
446
|
-
|
|
431
|
+
function Re() {
|
|
432
|
+
var u;
|
|
433
|
+
if (!te.value.length) {
|
|
434
|
+
de.warning("请选择图片");
|
|
447
435
|
return;
|
|
448
436
|
}
|
|
449
|
-
if (
|
|
450
|
-
|
|
451
|
-
const
|
|
452
|
-
if (
|
|
453
|
-
|
|
437
|
+
if (H.value) return;
|
|
438
|
+
H.value = !0;
|
|
439
|
+
const d = [...te.value];
|
|
440
|
+
if (o.value) {
|
|
441
|
+
a("confirm", d), y.value = !1;
|
|
454
442
|
return;
|
|
455
443
|
}
|
|
456
|
-
(
|
|
444
|
+
(u = ne.value) == null || u.call(ne, d), o.value || Xn(d), a("confirm", d), y.value = !1;
|
|
457
445
|
}
|
|
458
|
-
return
|
|
459
|
-
var
|
|
460
|
-
|
|
461
|
-
}),
|
|
446
|
+
return ue(y, (d, u) => {
|
|
447
|
+
var W;
|
|
448
|
+
u && !d && !H.value && ((W = le.value) == null || W.call(le), o.value || Et(), a("cancel"));
|
|
449
|
+
}), ue(
|
|
462
450
|
() => l.selected,
|
|
463
|
-
(
|
|
464
|
-
|
|
451
|
+
(d) => {
|
|
452
|
+
y.value || Ye(d);
|
|
465
453
|
},
|
|
466
454
|
{ deep: !0 }
|
|
467
|
-
), (
|
|
468
|
-
const
|
|
469
|
-
return
|
|
470
|
-
modelValue:
|
|
471
|
-
"onUpdate:modelValue":
|
|
472
|
-
title:
|
|
455
|
+
), (d, u) => {
|
|
456
|
+
const W = Q("el-icon"), ge = Q("el-input"), mn = Q("el-segmented"), Be = Q("el-button"), pn = Q("el-upload"), vn = Q("el-empty"), gn = Q("el-pagination"), yn = Q("el-dialog"), hn = vt("loading");
|
|
457
|
+
return r(), V(yn, {
|
|
458
|
+
modelValue: y.value,
|
|
459
|
+
"onUpdate:modelValue": u[4] || (u[4] = (U) => y.value = U),
|
|
460
|
+
title: m.value,
|
|
473
461
|
width: e.width,
|
|
474
462
|
"append-to-body": "",
|
|
475
463
|
"destroy-on-close": "",
|
|
476
464
|
class: "yc-image-selector-dialog",
|
|
477
|
-
onClosed:
|
|
478
|
-
onOpen:
|
|
465
|
+
onClosed: fn,
|
|
466
|
+
onOpen: re
|
|
479
467
|
}, {
|
|
480
|
-
footer:
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
l.renderFooterExtra && !p.value ? (u(), E(w(o), {
|
|
485
|
-
key: 0,
|
|
486
|
-
render: l.renderFooterExtra,
|
|
487
|
-
ctx: f.value
|
|
488
|
-
}, null, 8, ["render", "ctx"])) : b("", !0)
|
|
489
|
-
]),
|
|
490
|
-
m(_e, {
|
|
468
|
+
footer: v(() => [
|
|
469
|
+
_.value ? (r(), E("div", kl, [
|
|
470
|
+
k("span", Tl, F(Ie.value), 1),
|
|
471
|
+
h(Be, {
|
|
491
472
|
link: "",
|
|
492
473
|
type: "primary",
|
|
493
|
-
onClick:
|
|
474
|
+
onClick: Tt
|
|
494
475
|
}, {
|
|
495
|
-
default:
|
|
496
|
-
|
|
476
|
+
default: v(() => [
|
|
477
|
+
X(F(e.cancelText), 1)
|
|
497
478
|
]),
|
|
498
479
|
_: 1
|
|
499
480
|
})
|
|
500
|
-
])) : (
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
ctx: f.value
|
|
507
|
-
}, null, 8, ["render", "ctx"])) : b("", !0)
|
|
508
|
-
]),
|
|
509
|
-
T("div", jn, [
|
|
510
|
-
m(_e, { onClick: nt }, {
|
|
511
|
-
default: g(() => [
|
|
512
|
-
W(B(e.cancelText), 1)
|
|
481
|
+
])) : (r(), E("div", _l, [
|
|
482
|
+
k("span", wl, F(Ie.value), 1),
|
|
483
|
+
k("div", bl, [
|
|
484
|
+
h(Be, { onClick: Tt }, {
|
|
485
|
+
default: v(() => [
|
|
486
|
+
X(F(e.cancelText), 1)
|
|
513
487
|
]),
|
|
514
488
|
_: 1
|
|
515
489
|
}),
|
|
516
|
-
|
|
490
|
+
h(Be, {
|
|
517
491
|
type: "primary",
|
|
518
|
-
disabled: !
|
|
519
|
-
onClick:
|
|
492
|
+
disabled: !te.value.length,
|
|
493
|
+
onClick: Re
|
|
520
494
|
}, {
|
|
521
|
-
default:
|
|
522
|
-
|
|
495
|
+
default: v(() => [
|
|
496
|
+
X(F(e.confirmText), 1)
|
|
523
497
|
]),
|
|
524
498
|
_: 1
|
|
525
499
|
}, 8, ["disabled"])
|
|
526
500
|
])
|
|
527
501
|
]))
|
|
528
502
|
]),
|
|
529
|
-
default:
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
modelValue:
|
|
534
|
-
"onUpdate:modelValue":
|
|
503
|
+
default: v(() => [
|
|
504
|
+
k("div", el, [
|
|
505
|
+
f.value ? R("", !0) : (r(), E("div", tl, [
|
|
506
|
+
h(ge, {
|
|
507
|
+
modelValue: G.value,
|
|
508
|
+
"onUpdate:modelValue": u[0] || (u[0] = (U) => G.value = U),
|
|
535
509
|
clearable: "",
|
|
536
510
|
placeholder: "搜索图片名称",
|
|
537
511
|
class: "yc-image-selector__search",
|
|
538
|
-
onKeyup:
|
|
539
|
-
onClear:
|
|
512
|
+
onKeyup: zt(s, ["enter"]),
|
|
513
|
+
onClear: s
|
|
540
514
|
}, {
|
|
541
|
-
prefix:
|
|
542
|
-
|
|
543
|
-
default:
|
|
544
|
-
|
|
515
|
+
prefix: v(() => [
|
|
516
|
+
h(W, null, {
|
|
517
|
+
default: v(() => [
|
|
518
|
+
h(p(Cn))
|
|
545
519
|
]),
|
|
546
520
|
_: 1
|
|
547
521
|
})
|
|
548
522
|
]),
|
|
549
523
|
_: 1
|
|
550
524
|
}, 8, ["modelValue"]),
|
|
551
|
-
|
|
525
|
+
M.value ? (r(), V(mn, {
|
|
552
526
|
key: 0,
|
|
553
527
|
modelValue: z.value,
|
|
554
|
-
"onUpdate:modelValue":
|
|
555
|
-
options:
|
|
528
|
+
"onUpdate:modelValue": u[1] || (u[1] = (U) => z.value = U),
|
|
529
|
+
options: B,
|
|
556
530
|
class: "yc-image-selector__mode",
|
|
557
|
-
onChange:
|
|
558
|
-
}, null, 8, ["modelValue"])) :
|
|
559
|
-
e.showUpload && e.upload ? (
|
|
531
|
+
onChange: A
|
|
532
|
+
}, null, 8, ["modelValue"])) : R("", !0),
|
|
533
|
+
e.showUpload && e.upload ? (r(), V(pn, {
|
|
560
534
|
key: 1,
|
|
561
535
|
"show-file-list": !1,
|
|
562
536
|
accept: e.accept,
|
|
563
|
-
"http-request":
|
|
564
|
-
disabled:
|
|
537
|
+
"http-request": j,
|
|
538
|
+
disabled: Z.value
|
|
565
539
|
}, {
|
|
566
|
-
default:
|
|
567
|
-
|
|
540
|
+
default: v(() => [
|
|
541
|
+
h(Be, {
|
|
568
542
|
type: "primary",
|
|
569
543
|
plain: "",
|
|
570
|
-
loading:
|
|
544
|
+
loading: Z.value
|
|
571
545
|
}, {
|
|
572
|
-
default:
|
|
573
|
-
|
|
574
|
-
default:
|
|
575
|
-
|
|
546
|
+
default: v(() => [
|
|
547
|
+
h(W, { class: "m-r-4" }, {
|
|
548
|
+
default: v(() => [
|
|
549
|
+
h(p(In))
|
|
576
550
|
]),
|
|
577
551
|
_: 1
|
|
578
552
|
}),
|
|
579
|
-
|
|
553
|
+
u[5] || (u[5] = X(" 上传图片 ", -1))
|
|
580
554
|
]),
|
|
581
555
|
_: 1
|
|
582
556
|
}, 8, ["loading"])
|
|
583
557
|
]),
|
|
584
558
|
_: 1
|
|
585
|
-
}, 8, ["accept", "disabled"])) :
|
|
559
|
+
}, 8, ["accept", "disabled"])) : R("", !0)
|
|
586
560
|
])),
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
class:
|
|
591
|
-
onClick:
|
|
592
|
-
},
|
|
593
|
-
(
|
|
594
|
-
key:
|
|
595
|
-
class:
|
|
596
|
-
onClick: (
|
|
561
|
+
k("div", nl, [
|
|
562
|
+
P.value && !f.value ? (r(), E("aside", ll, [
|
|
563
|
+
k("div", {
|
|
564
|
+
class: ye(["yc-image-selector__category", { "is-active": L.value === "" }]),
|
|
565
|
+
onClick: u[2] || (u[2] = (U) => w(""))
|
|
566
|
+
}, F(e.categoryAllLabel), 3),
|
|
567
|
+
(r(!0), E(ce, null, me(O.value, (U) => (r(), E("div", {
|
|
568
|
+
key: U.id,
|
|
569
|
+
class: ye(["yc-image-selector__category", { "is-active": L.value === U.id }]),
|
|
570
|
+
onClick: (Ne) => w(U.id)
|
|
597
571
|
}, [
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
], 10,
|
|
601
|
-
])) :
|
|
602
|
-
|
|
603
|
-
!
|
|
604
|
-
var
|
|
572
|
+
k("span", null, F(U.name), 1),
|
|
573
|
+
U.count != null ? (r(), E("span", ol, F(U.count), 1)) : R("", !0)
|
|
574
|
+
], 10, al))), 128))
|
|
575
|
+
])) : R("", !0),
|
|
576
|
+
Ee((r(), E("div", il, [
|
|
577
|
+
!Y.value && Se.value ? ee(d.$slots, "empty", Lt(Ge({ key: 0 }, Ce.value)), () => {
|
|
578
|
+
var U;
|
|
605
579
|
return [
|
|
606
|
-
l.renderEmpty ? (
|
|
580
|
+
l.renderEmpty ? (r(), V(p(t), {
|
|
607
581
|
key: 0,
|
|
608
582
|
render: l.renderEmpty,
|
|
609
|
-
ctx:
|
|
610
|
-
}, null, 8, ["render", "ctx"])) : (
|
|
583
|
+
ctx: Ce.value
|
|
584
|
+
}, null, 8, ["render", "ctx"])) : (r(), V(vn, {
|
|
611
585
|
key: 1,
|
|
612
|
-
description: ((
|
|
586
|
+
description: ((U = f.value) == null ? void 0 : U.message) || e.emptyText
|
|
613
587
|
}, null, 8, ["description"]))
|
|
614
588
|
];
|
|
615
|
-
}, !0) :
|
|
616
|
-
(
|
|
617
|
-
key: String(
|
|
618
|
-
class:
|
|
619
|
-
"is-selected":
|
|
620
|
-
"is-single-mode": !
|
|
621
|
-
"is-multi-mode":
|
|
589
|
+
}, !0) : Se.value ? R("", !0) : (r(), E("div", sl, [
|
|
590
|
+
(r(!0), E(ce, null, me(N.value, (U) => (r(), E("div", {
|
|
591
|
+
key: String(U.id),
|
|
592
|
+
class: ye(["yc-image-selector__item", {
|
|
593
|
+
"is-selected": Ae(U),
|
|
594
|
+
"is-single-mode": !D.value,
|
|
595
|
+
"is-multi-mode": D.value
|
|
622
596
|
}]),
|
|
623
|
-
onClick: (
|
|
597
|
+
onClick: (Ne) => b(U)
|
|
624
598
|
}, [
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
src:
|
|
628
|
-
alt:
|
|
599
|
+
k("div", ul, [
|
|
600
|
+
k("img", {
|
|
601
|
+
src: ve(U),
|
|
602
|
+
alt: U.name || "image",
|
|
629
603
|
loading: "lazy",
|
|
630
|
-
class:
|
|
631
|
-
onLoad: (
|
|
632
|
-
}, null, 42,
|
|
633
|
-
|
|
634
|
-
class:
|
|
635
|
-
"is-checked":
|
|
636
|
-
"is-radio": !
|
|
637
|
-
"is-checkbox":
|
|
604
|
+
class: ye(Xe(U)),
|
|
605
|
+
onLoad: (Ne) => Qe(Ne, U)
|
|
606
|
+
}, null, 42, cl),
|
|
607
|
+
k("div", {
|
|
608
|
+
class: ye(["yc-image-selector__indicator", {
|
|
609
|
+
"is-checked": Ae(U),
|
|
610
|
+
"is-radio": !D.value,
|
|
611
|
+
"is-checkbox": D.value
|
|
638
612
|
}])
|
|
639
613
|
}, [
|
|
640
|
-
|
|
641
|
-
default:
|
|
642
|
-
|
|
614
|
+
Ae(U) && D.value ? (r(), E("span", dl, F(c(U)), 1)) : Ae(U) ? (r(), V(W, { key: 1 }, {
|
|
615
|
+
default: v(() => [
|
|
616
|
+
h(p(Ut))
|
|
643
617
|
]),
|
|
644
618
|
_: 1
|
|
645
|
-
})) :
|
|
619
|
+
})) : R("", !0)
|
|
646
620
|
], 2)
|
|
647
621
|
]),
|
|
648
|
-
|
|
622
|
+
k("div", {
|
|
649
623
|
class: "yc-image-selector__meta",
|
|
650
|
-
title:
|
|
651
|
-
},
|
|
652
|
-
], 10,
|
|
624
|
+
title: U.name
|
|
625
|
+
}, F(U.name || "未命名"), 9, fl)
|
|
626
|
+
], 10, rl))), 128))
|
|
653
627
|
]))
|
|
654
628
|
])), [
|
|
655
|
-
[
|
|
629
|
+
[hn, Y.value]
|
|
656
630
|
])
|
|
657
631
|
]),
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
(
|
|
662
|
-
key: String(
|
|
632
|
+
D.value && te.value.length ? (r(), E("div", ml, [
|
|
633
|
+
k("span", pl, "已选 " + F(te.value.length) + " 张", 1),
|
|
634
|
+
k("div", vl, [
|
|
635
|
+
(r(!0), E(ce, null, me(te.value, (U) => (r(), E("div", {
|
|
636
|
+
key: String(U.id),
|
|
663
637
|
class: "yc-image-selector__selected-chip",
|
|
664
|
-
onClick:
|
|
638
|
+
onClick: lt((Ne) => b(U), ["stop"])
|
|
665
639
|
}, [
|
|
666
|
-
|
|
667
|
-
src:
|
|
668
|
-
alt:
|
|
669
|
-
}, null, 8,
|
|
670
|
-
|
|
671
|
-
], 8,
|
|
640
|
+
k("img", {
|
|
641
|
+
src: ve(U),
|
|
642
|
+
alt: U.name
|
|
643
|
+
}, null, 8, yl),
|
|
644
|
+
u[6] || (u[6] = k("span", { class: "yc-image-selector__selected-chip-remove" }, "×", -1))
|
|
645
|
+
], 8, gl))), 128))
|
|
672
646
|
]),
|
|
673
|
-
|
|
647
|
+
h(Be, {
|
|
674
648
|
link: "",
|
|
675
649
|
type: "primary",
|
|
676
|
-
onClick:
|
|
650
|
+
onClick: q
|
|
677
651
|
}, {
|
|
678
|
-
default:
|
|
679
|
-
|
|
652
|
+
default: v(() => [...u[7] || (u[7] = [
|
|
653
|
+
X("清空", -1)
|
|
680
654
|
])]),
|
|
681
655
|
_: 1
|
|
682
656
|
})
|
|
683
|
-
])) :
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
"current-page":
|
|
687
|
-
"onUpdate:currentPage":
|
|
657
|
+
])) : R("", !0),
|
|
658
|
+
g.value > 0 ? (r(), E("div", hl, [
|
|
659
|
+
h(gn, {
|
|
660
|
+
"current-page": S.value,
|
|
661
|
+
"onUpdate:currentPage": u[3] || (u[3] = (U) => S.value = U),
|
|
688
662
|
background: "",
|
|
689
663
|
layout: "total, prev, pager, next, jumper",
|
|
690
664
|
"page-size": e.pageSize,
|
|
691
|
-
total:
|
|
692
|
-
onCurrentChange:
|
|
665
|
+
total: g.value,
|
|
666
|
+
onCurrentChange: Pe
|
|
693
667
|
}, null, 8, ["current-page", "page-size", "total"])
|
|
694
|
-
])) :
|
|
668
|
+
])) : R("", !0)
|
|
695
669
|
])
|
|
696
670
|
]),
|
|
697
671
|
_: 3
|
|
698
672
|
}, 8, ["modelValue", "title", "width"]);
|
|
699
673
|
};
|
|
700
674
|
}
|
|
701
|
-
}),
|
|
675
|
+
}), he = (e, n) => {
|
|
702
676
|
const t = e.__vccOpts || e;
|
|
703
|
-
for (const [
|
|
704
|
-
t[
|
|
677
|
+
for (const [l, a] of n)
|
|
678
|
+
t[l] = a;
|
|
705
679
|
return t;
|
|
706
|
-
},
|
|
707
|
-
function
|
|
708
|
-
const { baseURL: e = "" } =
|
|
709
|
-
return
|
|
680
|
+
}, qt = /* @__PURE__ */ he(Sl, [["__scopeId", "data-v-6d4e506a"]]);
|
|
681
|
+
function Jt() {
|
|
682
|
+
const { baseURL: e = "" } = Je();
|
|
683
|
+
return Vt.create({ baseURL: e, timeout: 3e4 });
|
|
710
684
|
}
|
|
711
|
-
async function
|
|
712
|
-
const n =
|
|
685
|
+
async function Cl(e) {
|
|
686
|
+
const n = Je().fetchImages;
|
|
713
687
|
if (n) return n(e);
|
|
714
|
-
const t =
|
|
688
|
+
const t = Jt(), { data: l } = await t.get(
|
|
715
689
|
"/yc-media/images",
|
|
716
690
|
{ params: e }
|
|
717
691
|
);
|
|
718
|
-
if (
|
|
692
|
+
if (l.code !== 200)
|
|
719
693
|
throw new Error("加载图片资源失败");
|
|
720
|
-
return
|
|
694
|
+
return l.data;
|
|
721
695
|
}
|
|
722
|
-
async function
|
|
723
|
-
const n =
|
|
696
|
+
async function Il(e) {
|
|
697
|
+
const n = Je().uploadImage;
|
|
724
698
|
if (n) return n(e);
|
|
725
|
-
const t =
|
|
726
|
-
|
|
727
|
-
const { data:
|
|
699
|
+
const t = Jt(), l = new FormData();
|
|
700
|
+
l.append("file", e);
|
|
701
|
+
const { data: a } = await t.post(
|
|
728
702
|
"/yc-media/images/upload",
|
|
729
|
-
|
|
703
|
+
l,
|
|
730
704
|
{ headers: { "Content-Type": "multipart/form-data" } }
|
|
731
705
|
);
|
|
732
|
-
if (
|
|
706
|
+
if (a.code !== 200)
|
|
733
707
|
throw new Error("上传图片失败");
|
|
734
|
-
return
|
|
708
|
+
return a.data;
|
|
735
709
|
}
|
|
736
|
-
const
|
|
737
|
-
function
|
|
710
|
+
const Mt = "__YC_IMAGE_SELECTOR_MOUNT__";
|
|
711
|
+
function Al(e) {
|
|
738
712
|
const n = globalThis;
|
|
739
|
-
if (n[
|
|
713
|
+
if (n[Mt] || typeof document > "u") return;
|
|
740
714
|
const t = document.createElement("div");
|
|
741
715
|
t.setAttribute("data-yc-image-selector-host", ""), document.body.appendChild(t);
|
|
742
|
-
const
|
|
743
|
-
getImages:
|
|
744
|
-
upload:
|
|
745
|
-
showUpload:
|
|
746
|
-
...
|
|
716
|
+
const l = Je().dialog ?? {}, a = h(qt, {
|
|
717
|
+
getImages: Cl,
|
|
718
|
+
upload: Il,
|
|
719
|
+
showUpload: l.showUpload ?? !0,
|
|
720
|
+
...l
|
|
747
721
|
});
|
|
748
|
-
|
|
722
|
+
a.appContext = e._context, bn(a, t), n[Mt] = !0;
|
|
749
723
|
}
|
|
750
|
-
function
|
|
751
|
-
e.config.globalProperties.openImageSelector =
|
|
724
|
+
function $l(e) {
|
|
725
|
+
e.config.globalProperties.openImageSelector = Gt, e.config.globalProperties.closeImageSelector = Ht;
|
|
752
726
|
}
|
|
753
|
-
function
|
|
754
|
-
|
|
727
|
+
function xl(e) {
|
|
728
|
+
Al(e), $l(e);
|
|
755
729
|
}
|
|
756
|
-
const
|
|
730
|
+
const El = { class: "yc-page-window__header" }, Ml = { class: "yc-page-window__title" }, Dl = {
|
|
757
731
|
key: 0,
|
|
758
732
|
class: "yc-page-window__nav"
|
|
759
|
-
},
|
|
733
|
+
}, Pl = { class: "yc-page-window__opera" }, Bl = { class: "yc-page-window__content" }, Vl = /* @__PURE__ */ oe({
|
|
760
734
|
__name: "YcPageWindow",
|
|
761
735
|
props: {
|
|
762
736
|
visible: { type: Boolean },
|
|
@@ -776,90 +750,94 @@ const to = { class: "yc-page-window__header" }, no = { class: "yc-page-window__t
|
|
|
776
750
|
},
|
|
777
751
|
emits: ["update:visible", "update:type", "confirm", "close", "opened", "changeType", "prev", "next", "checkRow"],
|
|
778
752
|
setup(e, { expose: n, emit: t }) {
|
|
779
|
-
const
|
|
780
|
-
() =>
|
|
781
|
-
),
|
|
782
|
-
() => ["detail", "edit"].includes(
|
|
783
|
-
),
|
|
784
|
-
function
|
|
785
|
-
if (!
|
|
786
|
-
const
|
|
787
|
-
return
|
|
788
|
-
}
|
|
789
|
-
function N($) {
|
|
790
|
-
const M = D();
|
|
791
|
-
return M < 0 ? !0 : $ === "prev" ? M <= 0 : M >= o.list.length - 1;
|
|
753
|
+
const l = e, a = t, o = x(!1), y = I(() => l.loading || o.value), f = I(() => l.type === "detail" ? "详情" : l.type === "edit" ? "编辑" : l.type === "add" ? "新增" : ""), m = I(
|
|
754
|
+
() => l.list.length > 0 && l.row != null
|
|
755
|
+
), i = I(
|
|
756
|
+
() => ["detail", "edit"].includes(l.type)
|
|
757
|
+
), $ = I(() => l.type !== "detail");
|
|
758
|
+
function M() {
|
|
759
|
+
if (!l.row) return -1;
|
|
760
|
+
const D = l.rowKey, G = l.row[D];
|
|
761
|
+
return l.list.findIndex((L) => L[D] === G);
|
|
792
762
|
}
|
|
793
|
-
function
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
-
const M = o.list[$ - 1];
|
|
797
|
-
l("checkRow", M), l("prev", M);
|
|
763
|
+
function P(D) {
|
|
764
|
+
const G = M();
|
|
765
|
+
return G < 0 ? !0 : D === "prev" ? G <= 0 : G >= l.list.length - 1;
|
|
798
766
|
}
|
|
799
|
-
function
|
|
800
|
-
const
|
|
801
|
-
if (
|
|
802
|
-
const
|
|
803
|
-
|
|
767
|
+
function K() {
|
|
768
|
+
const D = M();
|
|
769
|
+
if (D <= 0) return;
|
|
770
|
+
const G = l.list[D - 1];
|
|
771
|
+
a("checkRow", G), a("prev", G);
|
|
804
772
|
}
|
|
805
|
-
function
|
|
806
|
-
const
|
|
807
|
-
|
|
773
|
+
function O() {
|
|
774
|
+
const D = M();
|
|
775
|
+
if (D < 0 || D >= l.list.length - 1) return;
|
|
776
|
+
const G = l.list[D + 1];
|
|
777
|
+
a("checkRow", G), a("next", G);
|
|
808
778
|
}
|
|
809
|
-
function
|
|
810
|
-
l
|
|
779
|
+
function _() {
|
|
780
|
+
const D = l.type === "detail" ? "edit" : "detail";
|
|
781
|
+
a("update:type", D), a("changeType");
|
|
811
782
|
}
|
|
812
783
|
function z() {
|
|
813
|
-
|
|
814
|
-
|
|
784
|
+
a("update:visible", !1), a("close");
|
|
785
|
+
}
|
|
786
|
+
function B() {
|
|
787
|
+
o.value = !0, a("confirm", (D) => {
|
|
788
|
+
o.value = !1, D && z();
|
|
815
789
|
});
|
|
816
790
|
}
|
|
817
|
-
return
|
|
818
|
-
() =>
|
|
819
|
-
(
|
|
820
|
-
|
|
791
|
+
return ue(
|
|
792
|
+
() => l.visible,
|
|
793
|
+
(D) => {
|
|
794
|
+
D && a("opened");
|
|
821
795
|
}
|
|
822
|
-
),
|
|
823
|
-
|
|
824
|
-
}), n({ closeWindow:
|
|
825
|
-
const
|
|
826
|
-
return
|
|
796
|
+
), gt(() => {
|
|
797
|
+
l.visible && z();
|
|
798
|
+
}), n({ closeWindow: z }), (D, G) => {
|
|
799
|
+
const L = Q("el-icon"), S = Q("el-button"), g = Q("el-tooltip"), Y = Q("el-scrollbar"), Z = vt("loading");
|
|
800
|
+
return r(), V(Ot, {
|
|
827
801
|
name: "yc-page-window-fade",
|
|
828
802
|
mode: "out-in"
|
|
829
803
|
}, {
|
|
830
|
-
default:
|
|
831
|
-
|
|
804
|
+
default: v(() => [
|
|
805
|
+
Ee(k("div", {
|
|
832
806
|
class: "yc-page-window",
|
|
833
|
-
|
|
807
|
+
role: "dialog",
|
|
808
|
+
"aria-modal": "true",
|
|
809
|
+
style: Ke({ zIndex: e.zIndex })
|
|
834
810
|
}, [
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
811
|
+
k("div", El, [
|
|
812
|
+
k("div", Ml, [
|
|
813
|
+
h(L, {
|
|
838
814
|
class: "yc-page-window__back",
|
|
839
|
-
onClick:
|
|
815
|
+
onClick: z
|
|
840
816
|
}, {
|
|
841
|
-
default:
|
|
842
|
-
|
|
817
|
+
default: v(() => [
|
|
818
|
+
h(p(An))
|
|
843
819
|
]),
|
|
844
820
|
_: 1
|
|
845
821
|
}),
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
822
|
+
ee(D.$slots, "title", {}, () => [
|
|
823
|
+
k("span", null, F(e.title) + F(f.value), 1)
|
|
824
|
+
], !0),
|
|
825
|
+
m.value ? (r(), E("div", Dl, [
|
|
826
|
+
h(g, {
|
|
849
827
|
content: "上一条",
|
|
850
828
|
placement: "top"
|
|
851
829
|
}, {
|
|
852
|
-
default:
|
|
853
|
-
|
|
830
|
+
default: v(() => [
|
|
831
|
+
h(S, {
|
|
854
832
|
round: "",
|
|
855
833
|
text: "",
|
|
856
|
-
disabled:
|
|
857
|
-
onClick:
|
|
834
|
+
disabled: P("prev"),
|
|
835
|
+
onClick: K
|
|
858
836
|
}, {
|
|
859
|
-
default:
|
|
860
|
-
|
|
861
|
-
default:
|
|
862
|
-
|
|
837
|
+
default: v(() => [
|
|
838
|
+
h(L, null, {
|
|
839
|
+
default: v(() => [
|
|
840
|
+
h(p($n))
|
|
863
841
|
]),
|
|
864
842
|
_: 1
|
|
865
843
|
})
|
|
@@ -869,21 +847,21 @@ const to = { class: "yc-page-window__header" }, no = { class: "yc-page-window__t
|
|
|
869
847
|
]),
|
|
870
848
|
_: 1
|
|
871
849
|
}),
|
|
872
|
-
|
|
850
|
+
h(g, {
|
|
873
851
|
content: "下一条",
|
|
874
852
|
placement: "top"
|
|
875
853
|
}, {
|
|
876
|
-
default:
|
|
877
|
-
|
|
854
|
+
default: v(() => [
|
|
855
|
+
h(S, {
|
|
878
856
|
round: "",
|
|
879
857
|
text: "",
|
|
880
|
-
disabled:
|
|
881
|
-
onClick:
|
|
858
|
+
disabled: P("next"),
|
|
859
|
+
onClick: O
|
|
882
860
|
}, {
|
|
883
|
-
default:
|
|
884
|
-
|
|
885
|
-
default:
|
|
886
|
-
|
|
861
|
+
default: v(() => [
|
|
862
|
+
h(L, null, {
|
|
863
|
+
default: v(() => [
|
|
864
|
+
h(p(xn))
|
|
887
865
|
]),
|
|
888
866
|
_: 1
|
|
889
867
|
})
|
|
@@ -893,260 +871,1381 @@ const to = { class: "yc-page-window__header" }, no = { class: "yc-page-window__t
|
|
|
893
871
|
]),
|
|
894
872
|
_: 1
|
|
895
873
|
})
|
|
896
|
-
])) :
|
|
897
|
-
|
|
874
|
+
])) : R("", !0),
|
|
875
|
+
i.value ? (r(), V(S, {
|
|
898
876
|
key: 1,
|
|
899
877
|
text: "",
|
|
900
878
|
class: "yc-page-window__type-switch",
|
|
901
879
|
type: e.type === "detail" ? "primary" : "success",
|
|
902
|
-
onClick:
|
|
880
|
+
onClick: _
|
|
903
881
|
}, {
|
|
904
|
-
default:
|
|
905
|
-
|
|
906
|
-
default:
|
|
907
|
-
|
|
882
|
+
default: v(() => [
|
|
883
|
+
h(L, { class: "m-r-4" }, {
|
|
884
|
+
default: v(() => [
|
|
885
|
+
h(p(En))
|
|
908
886
|
]),
|
|
909
887
|
_: 1
|
|
910
888
|
}),
|
|
911
|
-
|
|
889
|
+
X(" " + F(e.type === "detail" ? "切换编辑" : "切换详情"), 1)
|
|
912
890
|
]),
|
|
913
891
|
_: 1
|
|
914
|
-
}, 8, ["type"])) :
|
|
892
|
+
}, 8, ["type"])) : R("", !0)
|
|
915
893
|
]),
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
e.showButtons &&
|
|
919
|
-
|
|
894
|
+
k("div", Pl, [
|
|
895
|
+
ee(D.$slots, "opera", {}, void 0, !0),
|
|
896
|
+
e.showButtons && $.value ? (r(), E(ce, { key: 0 }, [
|
|
897
|
+
h(S, {
|
|
920
898
|
text: "",
|
|
921
|
-
disabled:
|
|
922
|
-
onClick:
|
|
899
|
+
disabled: y.value,
|
|
900
|
+
onClick: z
|
|
923
901
|
}, {
|
|
924
|
-
default:
|
|
925
|
-
|
|
926
|
-
default:
|
|
927
|
-
|
|
902
|
+
default: v(() => [
|
|
903
|
+
h(L, { class: "m-r-4" }, {
|
|
904
|
+
default: v(() => [
|
|
905
|
+
h(p(Rt))
|
|
928
906
|
]),
|
|
929
907
|
_: 1
|
|
930
908
|
}),
|
|
931
|
-
|
|
909
|
+
X(" " + F(e.cancelText), 1)
|
|
932
910
|
]),
|
|
933
911
|
_: 1
|
|
934
912
|
}, 8, ["disabled"]),
|
|
935
|
-
e.showConfirm ? (
|
|
913
|
+
e.showConfirm ? (r(), V(S, {
|
|
936
914
|
key: 0,
|
|
937
915
|
type: "primary",
|
|
938
|
-
loading:
|
|
916
|
+
loading: y.value,
|
|
939
917
|
disabled: e.disabled,
|
|
940
|
-
onClick:
|
|
918
|
+
onClick: B
|
|
941
919
|
}, {
|
|
942
|
-
default:
|
|
943
|
-
|
|
944
|
-
default:
|
|
945
|
-
|
|
920
|
+
default: v(() => [
|
|
921
|
+
h(L, { class: "m-r-4" }, {
|
|
922
|
+
default: v(() => [
|
|
923
|
+
h(p(Ut))
|
|
946
924
|
]),
|
|
947
925
|
_: 1
|
|
948
926
|
}),
|
|
949
|
-
|
|
927
|
+
X(" " + F(e.confirmText), 1)
|
|
950
928
|
]),
|
|
951
929
|
_: 1
|
|
952
|
-
}, 8, ["loading", "disabled"])) :
|
|
953
|
-
], 64)) :
|
|
930
|
+
}, 8, ["loading", "disabled"])) : R("", !0)
|
|
931
|
+
], 64)) : R("", !0)
|
|
954
932
|
])
|
|
955
933
|
]),
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
default:
|
|
959
|
-
e.visible ? (
|
|
934
|
+
Ee((r(), E("div", Bl, [
|
|
935
|
+
h(Y, { class: "yc-page-window__scroll" }, {
|
|
936
|
+
default: v(() => [
|
|
937
|
+
e.visible ? (r(), E("div", {
|
|
960
938
|
key: 0,
|
|
961
939
|
class: "yc-page-window__body",
|
|
962
|
-
style:
|
|
940
|
+
style: Ke({ minHeight: e.contentMinHeight })
|
|
963
941
|
}, [
|
|
964
|
-
|
|
965
|
-
], 4)) :
|
|
942
|
+
ee(D.$slots, "default", {}, void 0, !0)
|
|
943
|
+
], 4)) : R("", !0)
|
|
966
944
|
]),
|
|
967
945
|
_: 3
|
|
968
946
|
})
|
|
969
947
|
])), [
|
|
970
|
-
[
|
|
948
|
+
[Z, y.value]
|
|
971
949
|
])
|
|
972
950
|
], 4), [
|
|
973
|
-
[
|
|
951
|
+
[ot, e.visible]
|
|
974
952
|
])
|
|
975
953
|
]),
|
|
976
954
|
_: 3
|
|
977
955
|
});
|
|
978
956
|
};
|
|
979
957
|
}
|
|
980
|
-
}),
|
|
981
|
-
|
|
982
|
-
|
|
958
|
+
}), Dt = /* @__PURE__ */ he(Vl, [["__scopeId", "data-v-cb0b7115"]]), zl = async (e) => {
|
|
959
|
+
try {
|
|
960
|
+
return await ht.confirm(e.content ?? "", e.title, {
|
|
961
|
+
confirmButtonText: e.confirmText ?? "确定",
|
|
962
|
+
cancelButtonText: e.cancelText ?? "取消",
|
|
963
|
+
type: "warning",
|
|
964
|
+
inputPlaceholder: e.requireInput,
|
|
965
|
+
inputValidator: e.requireInput ? (n) => n === e.requireInput || `请输入「${e.requireInput}」以确认` : void 0
|
|
966
|
+
}), !0;
|
|
967
|
+
} catch {
|
|
968
|
+
return !1;
|
|
969
|
+
}
|
|
970
|
+
}, Xt = {
|
|
971
|
+
permissionMode: "normal",
|
|
972
|
+
locale: "zh-CN",
|
|
973
|
+
superAdminBypass: !0,
|
|
974
|
+
deniedTip: "您没有该操作权限",
|
|
975
|
+
confirmHandler: zl
|
|
976
|
+
};
|
|
977
|
+
let He = { ...Xt };
|
|
978
|
+
function Ho(e) {
|
|
979
|
+
He = { ...He, ...e };
|
|
980
|
+
}
|
|
981
|
+
function we() {
|
|
982
|
+
return He;
|
|
983
|
+
}
|
|
984
|
+
function Go() {
|
|
985
|
+
He = { ...Xt };
|
|
986
|
+
}
|
|
987
|
+
function Qt(e) {
|
|
988
|
+
if (e == null) return [];
|
|
989
|
+
const n = Array.isArray(e) ? e : [e], t = [];
|
|
990
|
+
for (const l of n)
|
|
991
|
+
if (typeof l == "string")
|
|
992
|
+
for (const a of l.split(/[,,\s]+/)) {
|
|
993
|
+
const o = a.trim().replace(/^['"]+|['"]+$/g, "").trim();
|
|
994
|
+
o && !t.includes(o) && t.push(o);
|
|
995
|
+
}
|
|
996
|
+
return t;
|
|
997
|
+
}
|
|
998
|
+
const ut = Symbol("yc-permissions");
|
|
999
|
+
let ze = null;
|
|
1000
|
+
function Ll(e = {}) {
|
|
1001
|
+
let n = new Set(e.perms ?? []), t = e.superAdmin ?? !1;
|
|
1002
|
+
const l = x(0);
|
|
1003
|
+
function a(f) {
|
|
1004
|
+
const m = we();
|
|
1005
|
+
return m.permissionMode === "all" ? !0 : m.permissionMode === "none" ? !1 : ((f == null ? void 0 : f.superAdminBypass) ?? m.superAdminBypass) && t;
|
|
1006
|
+
}
|
|
1007
|
+
function o(f, m) {
|
|
1008
|
+
const i = we();
|
|
1009
|
+
return i.permissionMode === "all" ? !0 : i.permissionMode === "none" ? !1 : a(m) ? !0 : n.has(f);
|
|
1010
|
+
}
|
|
1011
|
+
return {
|
|
1012
|
+
version: l,
|
|
1013
|
+
has(f, m) {
|
|
1014
|
+
const i = Array.isArray(f) ? f : [f];
|
|
1015
|
+
return i.length === 0 ? !0 : i.some(($) => o($, m));
|
|
1016
|
+
},
|
|
1017
|
+
hasAny(f, m) {
|
|
1018
|
+
return f.length === 0 ? !0 : f.some((i) => o(i, m));
|
|
1019
|
+
},
|
|
1020
|
+
hasAll(f, m) {
|
|
1021
|
+
return f.length === 0 ? !0 : f.every((i) => o(i, m));
|
|
1022
|
+
},
|
|
1023
|
+
getPerms() {
|
|
1024
|
+
return [...n];
|
|
1025
|
+
},
|
|
1026
|
+
isSuperAdmin() {
|
|
1027
|
+
return t;
|
|
1028
|
+
},
|
|
1029
|
+
refresh(f) {
|
|
1030
|
+
f != null && f.perms && (n = new Set(f.perms)), (f == null ? void 0 : f.superAdmin) !== void 0 && (t = f.superAdmin), l.value += 1;
|
|
1031
|
+
}
|
|
1032
|
+
};
|
|
1033
|
+
}
|
|
1034
|
+
function qo(e, n) {
|
|
1035
|
+
return ze = e, n ? (n.provide(ut, e), e) : (yt() && je(ut, e), e);
|
|
1036
|
+
}
|
|
1037
|
+
function Jo(e) {
|
|
1038
|
+
ze = e;
|
|
1039
|
+
}
|
|
1040
|
+
function Zt() {
|
|
1041
|
+
return ze || (ze = Ll()), ze;
|
|
1042
|
+
}
|
|
1043
|
+
function Ol() {
|
|
1044
|
+
if (yt()) {
|
|
1045
|
+
const e = qe(ut, null);
|
|
1046
|
+
if (e) return e;
|
|
1047
|
+
}
|
|
1048
|
+
return Zt();
|
|
1049
|
+
}
|
|
1050
|
+
function wt() {
|
|
1051
|
+
const e = Ol(), n = I(() => (e.version.value, e.getPerms()));
|
|
1052
|
+
return {
|
|
1053
|
+
has: (t, l) => e.has(t, l),
|
|
1054
|
+
hasAny: (t, l) => e.hasAny(t, l),
|
|
1055
|
+
hasAll: (t, l) => e.hasAll(t, l),
|
|
1056
|
+
perms: n,
|
|
1057
|
+
version: e.version,
|
|
1058
|
+
refresh: (t) => e.refresh(t)
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1061
|
+
const Yl = /* @__PURE__ */ oe({
|
|
1062
|
+
name: "YcButton",
|
|
1063
|
+
inheritAttrs: !1,
|
|
1064
|
+
__name: "YcButton",
|
|
1065
|
+
props: {
|
|
1066
|
+
permission: {},
|
|
1067
|
+
permissionMode: { default: "any" },
|
|
1068
|
+
fallback: { default: "hide" },
|
|
1069
|
+
disabledTip: {},
|
|
1070
|
+
superAdminBypass: { type: Boolean, default: !0 },
|
|
1071
|
+
strict: { type: Boolean, default: !1 },
|
|
1072
|
+
type: { default: "default" },
|
|
1073
|
+
size: { default: "default" },
|
|
1074
|
+
plain: { type: Boolean, default: !1 },
|
|
1075
|
+
text: { type: Boolean, default: !1 },
|
|
1076
|
+
link: { type: Boolean, default: !1 },
|
|
1077
|
+
loading: { type: Boolean, default: !1 },
|
|
1078
|
+
disabled: { type: Boolean, default: !1 },
|
|
1079
|
+
icon: {},
|
|
1080
|
+
debounce: { default: 300 },
|
|
1081
|
+
confirm: {},
|
|
1082
|
+
audit: { type: [Boolean, Object] }
|
|
1083
|
+
},
|
|
1084
|
+
emits: ["click", "denied", "error", "confirm-cancel"],
|
|
1085
|
+
setup(e, { emit: n }) {
|
|
1086
|
+
const t = e, l = n, a = yt(), o = kn(), { hasAny: y, hasAll: f } = wt(), m = I(() => Qt(t.permission)), i = I(() => t.strict && m.value.length === 0), $ = I(() => {
|
|
1087
|
+
if (i.value) return !1;
|
|
1088
|
+
if (m.value.length === 0) return !0;
|
|
1089
|
+
const C = { superAdminBypass: t.superAdminBypass };
|
|
1090
|
+
return t.permissionMode === "all" ? f(m.value, C) : y(m.value, C);
|
|
1091
|
+
}), M = I(() => m.value.length > 0 && !$.value), P = I(() => i.value ? !1 : M.value ? t.fallback === "disable" : !0), K = I(() => M.value && t.fallback === "custom"), O = I(() => M.value && t.fallback === "disable"), _ = I(() => t.disabled || O.value), z = I(
|
|
1092
|
+
() => O.value ? t.disabledTip ?? we().deniedTip : void 0
|
|
1093
|
+
), B = I(() => typeof t.icon == "string" ? void 0 : t.icon), D = I(() => typeof t.icon == "string" ? t.icon : ""), G = I(() => {
|
|
1094
|
+
const { onClick: C, ...J } = o;
|
|
1095
|
+
return J;
|
|
1096
|
+
}), L = x(!1), S = x(0);
|
|
1097
|
+
function g() {
|
|
1098
|
+
var J;
|
|
1099
|
+
const C = (J = a == null ? void 0 : a.vnode.props) == null ? void 0 : J.onClick;
|
|
1100
|
+
return C ? (Array.isArray(C) ? C : [C]).filter(
|
|
1101
|
+
(ne) => typeof ne == "function"
|
|
1102
|
+
) : [];
|
|
1103
|
+
}
|
|
1104
|
+
function Y(C) {
|
|
1105
|
+
return typeof (C == null ? void 0 : C.then) == "function";
|
|
1106
|
+
}
|
|
1107
|
+
function Z() {
|
|
1108
|
+
if (!t.audit) return;
|
|
1109
|
+
const C = {
|
|
1110
|
+
action: typeof t.audit == "object" ? t.audit.action : m.value[0] ?? "click",
|
|
1111
|
+
resource: typeof t.audit == "object" ? t.audit.resource : void 0,
|
|
1112
|
+
codes: m.value,
|
|
1113
|
+
timestamp: Date.now()
|
|
1114
|
+
}, J = we().auditReporter;
|
|
1115
|
+
if (J)
|
|
1116
|
+
try {
|
|
1117
|
+
J(C);
|
|
1118
|
+
} catch {
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
async function N() {
|
|
1122
|
+
const C = t.confirm;
|
|
1123
|
+
if (!C) return !0;
|
|
1124
|
+
const J = typeof C == "string" ? { title: C } : C;
|
|
1125
|
+
return we().confirmHandler(J);
|
|
1126
|
+
}
|
|
1127
|
+
async function ie(C) {
|
|
1128
|
+
if (L.value) return;
|
|
1129
|
+
if (!$.value) {
|
|
1130
|
+
l("denied", {
|
|
1131
|
+
codes: m.value,
|
|
1132
|
+
reason: i.value ? "strict-empty" : "no-permission"
|
|
1133
|
+
});
|
|
1134
|
+
return;
|
|
1135
|
+
}
|
|
1136
|
+
if (_.value) return;
|
|
1137
|
+
const J = Date.now();
|
|
1138
|
+
if (t.debounce > 0 && J - S.value < t.debounce) return;
|
|
1139
|
+
if (S.value = J, t.confirm && !await N()) {
|
|
1140
|
+
l("confirm-cancel");
|
|
1141
|
+
return;
|
|
1142
|
+
}
|
|
1143
|
+
let ne;
|
|
1144
|
+
try {
|
|
1145
|
+
ne = g().map((H) => H(C));
|
|
1146
|
+
} catch (H) {
|
|
1147
|
+
l("error", H);
|
|
1148
|
+
return;
|
|
1149
|
+
}
|
|
1150
|
+
const le = ne.filter(Y);
|
|
1151
|
+
if (le.length > 0) {
|
|
1152
|
+
L.value = !0;
|
|
1153
|
+
try {
|
|
1154
|
+
await Promise.all(le);
|
|
1155
|
+
} catch (H) {
|
|
1156
|
+
L.value = !1, l("error", H);
|
|
1157
|
+
return;
|
|
1158
|
+
}
|
|
1159
|
+
L.value = !1;
|
|
1160
|
+
}
|
|
1161
|
+
Z();
|
|
1162
|
+
}
|
|
1163
|
+
return Me(() => {
|
|
1164
|
+
i.value ? l("denied", { codes: [], reason: "strict-empty" }) : M.value && l("denied", { codes: m.value, reason: "no-permission" });
|
|
1165
|
+
}), (C, J) => P.value ? (r(), V(p(Te), Ge({ key: 0 }, G.value, {
|
|
1166
|
+
type: e.type,
|
|
1167
|
+
size: e.size,
|
|
1168
|
+
plain: e.plain,
|
|
1169
|
+
text: e.text,
|
|
1170
|
+
link: e.link,
|
|
1171
|
+
icon: B.value,
|
|
1172
|
+
loading: e.loading || L.value,
|
|
1173
|
+
disabled: _.value,
|
|
1174
|
+
title: z.value,
|
|
1175
|
+
onClick: ie
|
|
1176
|
+
}), Yt({
|
|
1177
|
+
default: v(() => [
|
|
1178
|
+
ee(C.$slots, "default")
|
|
1179
|
+
]),
|
|
1180
|
+
_: 2
|
|
1181
|
+
}, [
|
|
1182
|
+
C.$slots.icon || D.value ? {
|
|
1183
|
+
name: "icon",
|
|
1184
|
+
fn: v(() => [
|
|
1185
|
+
ee(C.$slots, "icon", {}, () => [
|
|
1186
|
+
k("i", {
|
|
1187
|
+
class: ye(D.value)
|
|
1188
|
+
}, null, 2)
|
|
1189
|
+
])
|
|
1190
|
+
]),
|
|
1191
|
+
key: "0"
|
|
1192
|
+
} : void 0,
|
|
1193
|
+
C.$slots.loading ? {
|
|
1194
|
+
name: "loading",
|
|
1195
|
+
fn: v(() => [
|
|
1196
|
+
ee(C.$slots, "loading")
|
|
1197
|
+
]),
|
|
1198
|
+
key: "1"
|
|
1199
|
+
} : void 0
|
|
1200
|
+
]), 1040, ["type", "size", "plain", "text", "link", "icon", "loading", "disabled", "title"])) : K.value ? ee(C.$slots, "denied", {
|
|
1201
|
+
key: 1,
|
|
1202
|
+
codes: m.value
|
|
1203
|
+
}) : R("", !0);
|
|
1204
|
+
}
|
|
1205
|
+
}), Ul = Yl, Rl = { class: "yc-page" }, Nl = {
|
|
1206
|
+
key: 0,
|
|
1207
|
+
class: "yc-page__actions"
|
|
1208
|
+
}, Fl = { class: "yc-page__body" }, Kl = /* @__PURE__ */ oe({
|
|
1209
|
+
name: "YcPage",
|
|
1210
|
+
__name: "YcPage",
|
|
1211
|
+
setup(e) {
|
|
1212
|
+
return (n, t) => (r(), E("div", Rl, [
|
|
1213
|
+
n.$slots.actions ? (r(), E("div", Nl, [
|
|
1214
|
+
ee(n.$slots, "actions", {}, void 0, !0)
|
|
1215
|
+
])) : R("", !0),
|
|
1216
|
+
k("div", Fl, [
|
|
1217
|
+
ee(n.$slots, "default", {}, void 0, !0)
|
|
1218
|
+
])
|
|
1219
|
+
]));
|
|
1220
|
+
}
|
|
1221
|
+
}), jl = /* @__PURE__ */ he(Kl, [["__scopeId", "data-v-e4dbb85c"]]), Wl = { class: "yc-search" }, Hl = { class: "yc-search__actions" }, Gl = ["aria-expanded"], ql = /* @__PURE__ */ oe({
|
|
1222
|
+
name: "YcSearchForm",
|
|
1223
|
+
__name: "YcSearchForm",
|
|
1224
|
+
props: {
|
|
1225
|
+
modelValue: {},
|
|
1226
|
+
fields: {},
|
|
1227
|
+
visibleCount: { default: 2 }
|
|
1228
|
+
},
|
|
1229
|
+
emits: ["update:modelValue", "search", "reset"],
|
|
1230
|
+
setup(e, { emit: n }) {
|
|
1231
|
+
const t = e, l = (L, S) => {
|
|
1232
|
+
var g, Y;
|
|
1233
|
+
return ((Y = (g = we()).translate) == null ? void 0 : Y.call(g, L, S)) ?? S;
|
|
1234
|
+
}, a = n, o = mt({ ...t.modelValue }), y = x(!1), f = x(!1), m = x(4);
|
|
1235
|
+
let i;
|
|
1236
|
+
function $() {
|
|
1237
|
+
typeof window > "u" || (m.value = window.innerWidth > 1280 ? 4 : window.innerWidth > 900 ? 3 : window.innerWidth > 600 ? 2 : 1);
|
|
1238
|
+
}
|
|
1239
|
+
const M = I(() => Math.max(1, m.value - 1)), P = I(
|
|
1240
|
+
() => y.value || f.value ? t.fields : t.fields.slice(0, M.value)
|
|
1241
|
+
), K = I(() => t.fields.length >= m.value), O = I(
|
|
1242
|
+
() => y.value ? t.fields.length : Math.min(t.fields.length, M.value)
|
|
1243
|
+
), _ = I(() => {
|
|
1244
|
+
const L = Math.max(1, Math.ceil(O.value / m.value)), S = O.value > 0 && O.value % m.value === 0 ? 1 : 0, g = L + S;
|
|
1245
|
+
return g * 32 + (g - 1) * 12 + 4;
|
|
1246
|
+
});
|
|
1247
|
+
function z() {
|
|
1248
|
+
i && clearTimeout(i), y.value ? (y.value = !1, i = setTimeout(() => {
|
|
1249
|
+
f.value = !1, i = void 0;
|
|
1250
|
+
}, 300)) : (f.value = !0, y.value = !0);
|
|
1251
|
+
}
|
|
1252
|
+
ue(
|
|
1253
|
+
() => t.modelValue,
|
|
1254
|
+
(L) => {
|
|
1255
|
+
Object.keys(o).forEach((S) => {
|
|
1256
|
+
S in L || delete o[S];
|
|
1257
|
+
}), Object.assign(o, L);
|
|
1258
|
+
},
|
|
1259
|
+
{ deep: !0 }
|
|
1260
|
+
), ue(
|
|
1261
|
+
o,
|
|
1262
|
+
() => a("update:modelValue", { ...o }),
|
|
1263
|
+
{ deep: !0 }
|
|
1264
|
+
);
|
|
1265
|
+
function B() {
|
|
1266
|
+
const L = { ...o };
|
|
1267
|
+
a("update:modelValue", L), a("search", L);
|
|
1268
|
+
}
|
|
1269
|
+
function D() {
|
|
1270
|
+
B();
|
|
1271
|
+
}
|
|
1272
|
+
function G() {
|
|
1273
|
+
Object.keys(o).forEach((L) => delete o[L]), a("update:modelValue", {}), a("reset");
|
|
1274
|
+
}
|
|
1275
|
+
return Me(() => {
|
|
1276
|
+
$(), window.addEventListener("resize", $);
|
|
1277
|
+
}), gt(() => {
|
|
1278
|
+
window.removeEventListener("resize", $), i && clearTimeout(i);
|
|
1279
|
+
}), (L, S) => (r(), E("div", Wl, [
|
|
1280
|
+
k("div", {
|
|
1281
|
+
class: "yc-search__content",
|
|
1282
|
+
style: Ke({ height: `${_.value}px` })
|
|
1283
|
+
}, [
|
|
1284
|
+
k("div", {
|
|
1285
|
+
class: "yc-search__grid",
|
|
1286
|
+
style: Ke({ "--yc-search-columns": m.value })
|
|
1287
|
+
}, [
|
|
1288
|
+
(r(!0), E(ce, null, me(P.value, (g) => (r(), E("div", {
|
|
1289
|
+
key: g.name,
|
|
1290
|
+
class: "yc-search__field"
|
|
1291
|
+
}, [
|
|
1292
|
+
g.type === "select" ? (r(), V(p(it), {
|
|
1293
|
+
key: 0,
|
|
1294
|
+
modelValue: o[g.name],
|
|
1295
|
+
"onUpdate:modelValue": (Y) => o[g.name] = Y,
|
|
1296
|
+
placeholder: g.placeholder ?? g.label ?? "全部",
|
|
1297
|
+
"aria-label": g.label ?? g.name,
|
|
1298
|
+
clearable: "",
|
|
1299
|
+
onChange: D
|
|
1300
|
+
}, {
|
|
1301
|
+
default: v(() => [
|
|
1302
|
+
(r(!0), E(ce, null, me(g.options ?? [], (Y) => (r(), V(p(be), {
|
|
1303
|
+
key: String(Y.value),
|
|
1304
|
+
label: Y.label,
|
|
1305
|
+
value: Y.value
|
|
1306
|
+
}, null, 8, ["label", "value"]))), 128))
|
|
1307
|
+
]),
|
|
1308
|
+
_: 2
|
|
1309
|
+
}, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "aria-label"])) : g.type === "date" ? (r(), V(p(It), {
|
|
1310
|
+
key: 1,
|
|
1311
|
+
modelValue: o[g.name],
|
|
1312
|
+
"onUpdate:modelValue": (Y) => o[g.name] = Y,
|
|
1313
|
+
type: "date",
|
|
1314
|
+
"value-format": "YYYY-MM-DD",
|
|
1315
|
+
placeholder: g.placeholder ?? g.label ?? "选择日期",
|
|
1316
|
+
"aria-label": g.label ?? g.name,
|
|
1317
|
+
onChange: D
|
|
1318
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "aria-label"])) : g.type === "daterange" ? (r(), V(p(It), {
|
|
1319
|
+
key: 2,
|
|
1320
|
+
modelValue: o[g.name],
|
|
1321
|
+
"onUpdate:modelValue": (Y) => o[g.name] = Y,
|
|
1322
|
+
type: "daterange",
|
|
1323
|
+
"value-format": "YYYY-MM-DD",
|
|
1324
|
+
"range-separator": "至",
|
|
1325
|
+
"start-placeholder": g.placeholder ?? "开始日期",
|
|
1326
|
+
"end-placeholder": "结束日期",
|
|
1327
|
+
"aria-label": g.label ?? g.name,
|
|
1328
|
+
"unlink-panels": "",
|
|
1329
|
+
onChange: D
|
|
1330
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "start-placeholder", "aria-label"])) : (r(), V(p(Vn), {
|
|
1331
|
+
key: 3,
|
|
1332
|
+
modelValue: o[g.name],
|
|
1333
|
+
"onUpdate:modelValue": (Y) => o[g.name] = Y,
|
|
1334
|
+
placeholder: g.placeholder ?? g.label ?? "请输入",
|
|
1335
|
+
"aria-label": g.label ?? g.name,
|
|
1336
|
+
clearable: "",
|
|
1337
|
+
onKeyup: zt(B, ["enter"])
|
|
1338
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "aria-label"]))
|
|
1339
|
+
]))), 128))
|
|
1340
|
+
], 4),
|
|
1341
|
+
k("div", Hl, [
|
|
1342
|
+
h(p(Te), { onClick: G }, {
|
|
1343
|
+
default: v(() => [
|
|
1344
|
+
X(F(l("yc.search.reset", "重置")), 1)
|
|
1345
|
+
]),
|
|
1346
|
+
_: 1
|
|
1347
|
+
}),
|
|
1348
|
+
h(p(Te), {
|
|
1349
|
+
type: "primary",
|
|
1350
|
+
onClick: B
|
|
1351
|
+
}, {
|
|
1352
|
+
default: v(() => [
|
|
1353
|
+
X(F(l("yc.search.query", "查询")), 1)
|
|
1354
|
+
]),
|
|
1355
|
+
_: 1
|
|
1356
|
+
}),
|
|
1357
|
+
K.value ? (r(), E("button", {
|
|
1358
|
+
key: 0,
|
|
1359
|
+
type: "button",
|
|
1360
|
+
class: "yc-search__toggle",
|
|
1361
|
+
"aria-expanded": y.value,
|
|
1362
|
+
onClick: z
|
|
1363
|
+
}, [
|
|
1364
|
+
X(F(y.value ? l("yc.search.collapse", "收起") : l("yc.search.expand", "展开")) + " ", 1),
|
|
1365
|
+
h(p(Bn), {
|
|
1366
|
+
class: ye(["yc-search__chevron", { "is-up": y.value }])
|
|
1367
|
+
}, {
|
|
1368
|
+
default: v(() => [
|
|
1369
|
+
h(p(Nt))
|
|
1370
|
+
]),
|
|
1371
|
+
_: 1
|
|
1372
|
+
}, 8, ["class"])
|
|
1373
|
+
], 8, Gl)) : R("", !0)
|
|
1374
|
+
])
|
|
1375
|
+
], 4)
|
|
1376
|
+
]));
|
|
1377
|
+
}
|
|
1378
|
+
}), Jl = /* @__PURE__ */ he(ql, [["__scopeId", "data-v-852ecc66"]]);
|
|
1379
|
+
function Xl(e) {
|
|
1380
|
+
if (e == null || e === "") return "";
|
|
1381
|
+
if (typeof e == "number" && Number.isFinite(e)) {
|
|
1382
|
+
const a = e < 1e12 ? e * 1e3 : e;
|
|
1383
|
+
return Pt(new Date(a));
|
|
1384
|
+
}
|
|
1385
|
+
if (typeof e != "string") return String(e);
|
|
1386
|
+
const n = e.trim();
|
|
1387
|
+
if (!n) return "";
|
|
1388
|
+
const t = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}/.test(n) ? n.replace(" ", "T") : n, l = new Date(t);
|
|
1389
|
+
return Number.isNaN(l.getTime()) ? n : Pt(l);
|
|
1390
|
+
}
|
|
1391
|
+
function Pt(e) {
|
|
1392
|
+
const n = (t) => String(t).padStart(2, "0");
|
|
1393
|
+
return `${e.getFullYear()}-${n(e.getMonth() + 1)}-${n(e.getDate())} ${n(e.getHours())}:${n(e.getMinutes())}:${n(e.getSeconds())}`;
|
|
983
1394
|
}
|
|
984
|
-
function
|
|
985
|
-
|
|
1395
|
+
function Ql(e, n) {
|
|
1396
|
+
return e.filter((t) => !t.permission || n(t.permission));
|
|
986
1397
|
}
|
|
987
|
-
function
|
|
988
|
-
|
|
1398
|
+
function Zl(e, n) {
|
|
1399
|
+
if (e.formatter)
|
|
1400
|
+
return e.formatter(n);
|
|
1401
|
+
const t = n[e.key];
|
|
1402
|
+
return /(Time|At|Date)$/.test(e.key) ? Xl(t) || "" : t == null ? "" : String(t);
|
|
989
1403
|
}
|
|
990
|
-
const
|
|
1404
|
+
const ea = { class: "yc-table" }, ta = { class: "yc-table__toolbar-left" }, na = { class: "yc-table__toolbar-right" }, la = ["aria-label"], aa = { key: 1 }, oa = { class: "table-settings" }, ia = { class: "table-settings__bar" }, sa = { class: "table-settings__density" }, ra = ["onDragover", "onDragleave", "onDrop"], ua = { class: "table-settings__name" }, ca = { class: "table-settings__order" }, da = ["onDragstart"], fa = "yc:table-settings:", ma = /* @__PURE__ */ oe({
|
|
1405
|
+
name: "YcTable",
|
|
1406
|
+
__name: "YcTable",
|
|
1407
|
+
props: {
|
|
1408
|
+
columns: {},
|
|
1409
|
+
data: {},
|
|
1410
|
+
loading: { type: Boolean, default: !1 },
|
|
1411
|
+
rowKey: { default: "id" },
|
|
1412
|
+
total: {},
|
|
1413
|
+
pageNum: { default: 1 },
|
|
1414
|
+
pageSize: { default: 20 },
|
|
1415
|
+
pageSizes: { default: () => [10, 20, 50] },
|
|
1416
|
+
tree: { type: Boolean, default: !1 },
|
|
1417
|
+
height: { default: "auto" },
|
|
1418
|
+
treeConfig: { default: () => ({ children: "children", expandAll: !0 }) },
|
|
1419
|
+
highlightCurrentRow: { type: Boolean, default: !1 },
|
|
1420
|
+
showToolbar: { type: Boolean, default: !0 },
|
|
1421
|
+
selectable: { type: Boolean, default: !1 },
|
|
1422
|
+
selectionWidth: { default: 48 },
|
|
1423
|
+
showSettings: { type: Boolean, default: !0 },
|
|
1424
|
+
tableKey: { default: "" }
|
|
1425
|
+
},
|
|
1426
|
+
emits: ["update:pageNum", "update:pageSize", "page-change", "refresh", "current-change", "row-click", "selection-change"],
|
|
1427
|
+
setup(e, { expose: n, emit: t }) {
|
|
1428
|
+
const l = x(), a = x(), o = x(), y = x(), f = x("auto");
|
|
1429
|
+
let m;
|
|
1430
|
+
const i = I(() => M.height === "auto" ? f.value : M.height);
|
|
1431
|
+
function $() {
|
|
1432
|
+
var b, j;
|
|
1433
|
+
const s = a.value;
|
|
1434
|
+
if (!s) return;
|
|
1435
|
+
const w = s.clientHeight - (((b = o.value) == null ? void 0 : b.offsetHeight) ?? 0) - (((j = y.value) == null ? void 0 : j.offsetHeight) ?? 0) - 2;
|
|
1436
|
+
f.value = Math.max(120, w);
|
|
1437
|
+
}
|
|
1438
|
+
Me(async () => {
|
|
1439
|
+
await at(), $(), a.value && typeof ResizeObserver < "u" && (m = new ResizeObserver(() => $()), m.observe(a.value));
|
|
1440
|
+
}), gt(() => m == null ? void 0 : m.disconnect());
|
|
1441
|
+
const M = e, P = t, K = (s, w) => {
|
|
1442
|
+
var b, j;
|
|
1443
|
+
return ((j = (b = we()).translate) == null ? void 0 : j.call(b, s, w)) ?? w;
|
|
1444
|
+
}, { has: O } = wt(), _ = I(() => Ql(M.columns, (s) => O(s))), z = x(!1), B = x(g()), D = I(() => ({ default: 48, medium: 40, compact: 34 })[N.value.density]), G = I(() => ({ height: `${D.value}px`, padding: "0 10px" })), L = I(() => ({ height: `${D.value}px` }));
|
|
1445
|
+
function S() {
|
|
1446
|
+
const s = typeof window > "u" ? "default" : `${window.location.pathname}${window.location.hash}`;
|
|
1447
|
+
return `${fa}${M.tableKey || s}:${_.value.map((w) => w.key).join(",")}`;
|
|
1448
|
+
}
|
|
1449
|
+
function g() {
|
|
1450
|
+
return {
|
|
1451
|
+
order: _.value.map((s) => s.key),
|
|
1452
|
+
hidden: [],
|
|
1453
|
+
frozen: [],
|
|
1454
|
+
aligns: {},
|
|
1455
|
+
widths: {},
|
|
1456
|
+
density: "default"
|
|
1457
|
+
};
|
|
1458
|
+
}
|
|
1459
|
+
function Y(s) {
|
|
1460
|
+
const w = _.value.map((j) => j.key), b = [...s.order ?? []].filter((j) => w.includes(j));
|
|
1461
|
+
return w.forEach((j) => {
|
|
1462
|
+
b.includes(j) || b.push(j);
|
|
1463
|
+
}), {
|
|
1464
|
+
order: b,
|
|
1465
|
+
hidden: (s.hidden ?? []).filter((j) => w.includes(j)),
|
|
1466
|
+
frozen: (s.frozen ?? []).filter((j) => w.includes(j)),
|
|
1467
|
+
aligns: Object.fromEntries(Object.entries(s.aligns ?? {}).filter(([j]) => w.includes(j))),
|
|
1468
|
+
widths: Object.fromEntries(Object.entries(s.widths ?? {}).filter(([j, re]) => w.includes(j) && typeof re == "number")),
|
|
1469
|
+
density: s.density === "medium" || s.density === "compact" ? s.density : "default"
|
|
1470
|
+
};
|
|
1471
|
+
}
|
|
1472
|
+
function Z() {
|
|
1473
|
+
const s = g();
|
|
1474
|
+
if (typeof window > "u") return s;
|
|
1475
|
+
try {
|
|
1476
|
+
const w = localStorage.getItem(S());
|
|
1477
|
+
return w ? Y(JSON.parse(w)) : s;
|
|
1478
|
+
} catch {
|
|
1479
|
+
return s;
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
const N = x(Z());
|
|
1483
|
+
ue(() => _.value.map((s) => s.key).join(","), () => {
|
|
1484
|
+
N.value = Z();
|
|
1485
|
+
});
|
|
1486
|
+
const ie = I(() => {
|
|
1487
|
+
const s = new Map(_.value.map((b) => [b.key, b])), w = N.value.order.map((b) => s.get(b)).filter(Boolean);
|
|
1488
|
+
return _.value.forEach((b) => {
|
|
1489
|
+
N.value.order.includes(b.key) || w.push(b);
|
|
1490
|
+
}), w.filter((b) => !N.value.hidden.includes(b.key));
|
|
1491
|
+
}), C = I(() => {
|
|
1492
|
+
const s = new Map(_.value.map((w) => [w.key, w]));
|
|
1493
|
+
return B.value.order.map((w) => s.get(w)).filter(Boolean);
|
|
1494
|
+
}), J = I(() => JSON.stringify({
|
|
1495
|
+
order: N.value.order,
|
|
1496
|
+
hidden: N.value.hidden,
|
|
1497
|
+
frozen: N.value.frozen,
|
|
1498
|
+
aligns: N.value.aligns
|
|
1499
|
+
}));
|
|
1500
|
+
function ne() {
|
|
1501
|
+
typeof window > "u" || localStorage.setItem(S(), JSON.stringify(N.value));
|
|
1502
|
+
}
|
|
1503
|
+
function le(s) {
|
|
1504
|
+
return N.value.widths[s.key] ?? s.width;
|
|
1505
|
+
}
|
|
1506
|
+
function H(s) {
|
|
1507
|
+
return N.value.aligns[s.key] ?? s.align;
|
|
1508
|
+
}
|
|
1509
|
+
function te(s) {
|
|
1510
|
+
return N.value.frozen.includes(s);
|
|
1511
|
+
}
|
|
1512
|
+
function Se() {
|
|
1513
|
+
B.value = JSON.parse(JSON.stringify(N.value)), z.value = !0;
|
|
1514
|
+
}
|
|
1515
|
+
function Ce() {
|
|
1516
|
+
B.value = g();
|
|
1517
|
+
}
|
|
1518
|
+
function Ie(s, w) {
|
|
1519
|
+
B.value.aligns = { ...B.value.aligns, [s]: w };
|
|
1520
|
+
}
|
|
1521
|
+
function c(s, w) {
|
|
1522
|
+
B.value.hidden = w ? [...B.value.hidden, s] : B.value.hidden.filter((b) => b !== s);
|
|
1523
|
+
}
|
|
1524
|
+
function A(s, w) {
|
|
1525
|
+
B.value.frozen = w ? [...B.value.frozen, s] : B.value.frozen.filter((b) => b !== s);
|
|
1526
|
+
}
|
|
1527
|
+
const T = x(null), q = x(null);
|
|
1528
|
+
function ve(s, w) {
|
|
1529
|
+
T.value = s, q.value = s, w.dataTransfer && (w.dataTransfer.effectAllowed = "move", w.dataTransfer.setData("text/plain", String(s)));
|
|
1530
|
+
}
|
|
1531
|
+
function ae(s) {
|
|
1532
|
+
T.value !== null && T.value !== s && (q.value = s);
|
|
1533
|
+
}
|
|
1534
|
+
function Ae(s) {
|
|
1535
|
+
q.value === s && (q.value = T.value);
|
|
1536
|
+
}
|
|
1537
|
+
function Oe(s) {
|
|
1538
|
+
const w = T.value;
|
|
1539
|
+
if (w === null || w === s) {
|
|
1540
|
+
$e();
|
|
1541
|
+
return;
|
|
1542
|
+
}
|
|
1543
|
+
const b = [...B.value.order], [j] = b.splice(w, 1);
|
|
1544
|
+
b.splice(s, 0, j), B.value.order = b, $e();
|
|
1545
|
+
}
|
|
1546
|
+
function $e() {
|
|
1547
|
+
T.value = null, q.value = null;
|
|
1548
|
+
}
|
|
1549
|
+
function Xe() {
|
|
1550
|
+
N.value = Y(B.value), ne(), z.value = !1;
|
|
1551
|
+
}
|
|
1552
|
+
function Qe(s) {
|
|
1553
|
+
var b;
|
|
1554
|
+
const w = (b = s.column) == null ? void 0 : b.field;
|
|
1555
|
+
!w || !s.resizeWidth || (N.value = {
|
|
1556
|
+
...N.value,
|
|
1557
|
+
widths: { ...N.value.widths, [w]: Math.round(s.resizeWidth) }
|
|
1558
|
+
}, ne());
|
|
1559
|
+
}
|
|
1560
|
+
function Ze(s) {
|
|
1561
|
+
P("current-change", s.row, s.$event);
|
|
1562
|
+
}
|
|
1563
|
+
function Ye(s) {
|
|
1564
|
+
P("row-click", s.row, s.$event ?? s.event ?? new MouseEvent("click"));
|
|
1565
|
+
}
|
|
1566
|
+
function xe(s) {
|
|
1567
|
+
var w;
|
|
1568
|
+
P("selection-change", s.records ?? ((w = l.value) == null ? void 0 : w.getCheckboxRecords()) ?? []);
|
|
1569
|
+
}
|
|
1570
|
+
function Ue() {
|
|
1571
|
+
var s;
|
|
1572
|
+
(s = l.value) == null || s.clearCheckboxRow();
|
|
1573
|
+
}
|
|
1574
|
+
n({ clearSelection: Ue });
|
|
1575
|
+
function Pe(s) {
|
|
1576
|
+
if (s.pageSize !== M.pageSize) {
|
|
1577
|
+
P("update:pageSize", s.pageSize), P("page-change", { pageNum: 1, pageSize: s.pageSize });
|
|
1578
|
+
return;
|
|
1579
|
+
}
|
|
1580
|
+
P("update:pageNum", s.currentPage), P("page-change", { pageNum: s.currentPage, pageSize: s.pageSize });
|
|
1581
|
+
}
|
|
1582
|
+
return (s, w) => (r(), E("div", ea, [
|
|
1583
|
+
k("div", {
|
|
1584
|
+
ref_key: "panelRef",
|
|
1585
|
+
ref: a,
|
|
1586
|
+
class: "yc-table__panel"
|
|
1587
|
+
}, [
|
|
1588
|
+
e.showToolbar ? (r(), E("div", {
|
|
1589
|
+
key: 0,
|
|
1590
|
+
ref_key: "toolbarRef",
|
|
1591
|
+
ref: o,
|
|
1592
|
+
class: "yc-table__toolbar"
|
|
1593
|
+
}, [
|
|
1594
|
+
k("div", ta, [
|
|
1595
|
+
ee(s.$slots, "toolbar", {}, void 0, !0)
|
|
1596
|
+
]),
|
|
1597
|
+
k("div", na, [
|
|
1598
|
+
e.showSettings ? (r(), E("button", {
|
|
1599
|
+
key: 0,
|
|
1600
|
+
type: "button",
|
|
1601
|
+
class: "yc-table__gear",
|
|
1602
|
+
"aria-label": "表格设置",
|
|
1603
|
+
title: "表格设置",
|
|
1604
|
+
onClick: Se
|
|
1605
|
+
}, "⚙")) : R("", !0),
|
|
1606
|
+
ee(s.$slots, "toolbar-right", {}, () => [
|
|
1607
|
+
k("button", {
|
|
1608
|
+
type: "button",
|
|
1609
|
+
class: "yc-table__refresh",
|
|
1610
|
+
"aria-label": K("yc.table.refresh", "刷新表格"),
|
|
1611
|
+
onClick: w[0] || (w[0] = (b) => P("refresh"))
|
|
1612
|
+
}, "↻", 8, la)
|
|
1613
|
+
], !0)
|
|
1614
|
+
])
|
|
1615
|
+
], 512)) : R("", !0),
|
|
1616
|
+
(r(), V(p(On), {
|
|
1617
|
+
key: J.value,
|
|
1618
|
+
ref_key: "tableRef",
|
|
1619
|
+
ref: l,
|
|
1620
|
+
data: e.data,
|
|
1621
|
+
loading: e.loading,
|
|
1622
|
+
border: "none",
|
|
1623
|
+
"row-config": { keyField: e.rowKey, isHover: !0, isCurrent: e.highlightCurrentRow, height: D.value },
|
|
1624
|
+
"header-cell-style": G.value,
|
|
1625
|
+
"header-row-style": L.value,
|
|
1626
|
+
"column-config": { resizable: !0 },
|
|
1627
|
+
"show-overflow": !1,
|
|
1628
|
+
"tree-config": e.tree ? { children: "children", expandAll: !0, rowField: e.rowKey, ...e.treeConfig } : void 0,
|
|
1629
|
+
height: i.value,
|
|
1630
|
+
"checkbox-config": { highlight: !0 },
|
|
1631
|
+
onCurrentChange: Ze,
|
|
1632
|
+
onCellClick: Ye,
|
|
1633
|
+
onCheckboxChange: xe,
|
|
1634
|
+
onCheckboxAll: xe,
|
|
1635
|
+
onResizableChange: Qe
|
|
1636
|
+
}, {
|
|
1637
|
+
empty: v(() => [
|
|
1638
|
+
ee(s.$slots, "empty", {}, () => [
|
|
1639
|
+
h(p(zn), {
|
|
1640
|
+
description: K("yc.table.empty", "暂无数据"),
|
|
1641
|
+
"image-size": 72
|
|
1642
|
+
}, null, 8, ["description"])
|
|
1643
|
+
], !0)
|
|
1644
|
+
]),
|
|
1645
|
+
default: v(() => [
|
|
1646
|
+
e.selectable ? (r(), V(p($t), {
|
|
1647
|
+
key: 0,
|
|
1648
|
+
type: "checkbox",
|
|
1649
|
+
width: e.selectionWidth,
|
|
1650
|
+
align: "center"
|
|
1651
|
+
}, null, 8, ["width"])) : R("", !0),
|
|
1652
|
+
(r(!0), E(ce, null, me(ie.value, (b) => (r(), V(p($t), {
|
|
1653
|
+
key: b.key,
|
|
1654
|
+
field: b.key,
|
|
1655
|
+
title: b.label,
|
|
1656
|
+
width: le(b),
|
|
1657
|
+
"min-width": le(b) ? void 0 : b.minWidth,
|
|
1658
|
+
align: H(b),
|
|
1659
|
+
fixed: b.fixed ?? (te(b.key) ? "left" : void 0),
|
|
1660
|
+
"show-overflow": b.showOverflowTooltip === !1 ? !1 : "tooltip",
|
|
1661
|
+
"tree-node": b.treeNode
|
|
1662
|
+
}, {
|
|
1663
|
+
default: v(({ row: j }) => [
|
|
1664
|
+
s.$slots[`cell-${b.key}`] ? ee(s.$slots, `cell-${b.key}`, {
|
|
1665
|
+
key: 0,
|
|
1666
|
+
row: j,
|
|
1667
|
+
column: b
|
|
1668
|
+
}, void 0, !0) : (r(), E("span", aa, F(p(Zl)(b, j)), 1))
|
|
1669
|
+
]),
|
|
1670
|
+
_: 2
|
|
1671
|
+
}, 1032, ["field", "title", "width", "min-width", "align", "fixed", "show-overflow", "tree-node"]))), 128))
|
|
1672
|
+
]),
|
|
1673
|
+
_: 3
|
|
1674
|
+
}, 8, ["data", "loading", "row-config", "header-cell-style", "header-row-style", "tree-config", "height"])),
|
|
1675
|
+
e.total !== void 0 ? (r(), E("div", {
|
|
1676
|
+
key: 1,
|
|
1677
|
+
ref_key: "footerRef",
|
|
1678
|
+
ref: y,
|
|
1679
|
+
class: "yc-table__footer"
|
|
1680
|
+
}, [
|
|
1681
|
+
h(p(Yn), {
|
|
1682
|
+
"current-page": e.pageNum,
|
|
1683
|
+
"page-size": e.pageSize,
|
|
1684
|
+
"page-sizes": e.pageSizes,
|
|
1685
|
+
total: e.total,
|
|
1686
|
+
layouts: ["Total", "Sizes", "PrevPage", "Number", "NextPage"],
|
|
1687
|
+
onPageChange: Pe
|
|
1688
|
+
}, null, 8, ["current-page", "page-size", "page-sizes", "total"])
|
|
1689
|
+
], 512)) : R("", !0)
|
|
1690
|
+
], 512),
|
|
1691
|
+
h(p(Ln), {
|
|
1692
|
+
modelValue: z.value,
|
|
1693
|
+
"onUpdate:modelValue": w[3] || (w[3] = (b) => z.value = b),
|
|
1694
|
+
title: "表格设置",
|
|
1695
|
+
width: "780px",
|
|
1696
|
+
"append-to-body": "",
|
|
1697
|
+
class: "yc-table-settings"
|
|
1698
|
+
}, {
|
|
1699
|
+
footer: v(() => [
|
|
1700
|
+
h(p(Te), {
|
|
1701
|
+
onClick: w[2] || (w[2] = (b) => z.value = !1)
|
|
1702
|
+
}, {
|
|
1703
|
+
default: v(() => [...w[8] || (w[8] = [
|
|
1704
|
+
X("取消", -1)
|
|
1705
|
+
])]),
|
|
1706
|
+
_: 1
|
|
1707
|
+
}),
|
|
1708
|
+
h(p(Te), {
|
|
1709
|
+
type: "primary",
|
|
1710
|
+
onClick: Xe
|
|
1711
|
+
}, {
|
|
1712
|
+
default: v(() => [...w[9] || (w[9] = [
|
|
1713
|
+
X("保存", -1)
|
|
1714
|
+
])]),
|
|
1715
|
+
_: 1
|
|
1716
|
+
})
|
|
1717
|
+
]),
|
|
1718
|
+
default: v(() => [
|
|
1719
|
+
k("div", oa, [
|
|
1720
|
+
k("div", ia, [
|
|
1721
|
+
h(p(Te), {
|
|
1722
|
+
link: "",
|
|
1723
|
+
type: "primary",
|
|
1724
|
+
onClick: Ce
|
|
1725
|
+
}, {
|
|
1726
|
+
default: v(() => [...w[4] || (w[4] = [
|
|
1727
|
+
X("恢复初始状态", -1)
|
|
1728
|
+
])]),
|
|
1729
|
+
_: 1
|
|
1730
|
+
}),
|
|
1731
|
+
w[6] || (w[6] = k("span", { class: "table-settings__tip" }, "拖拽表头调整列宽;拖拽行首手柄调整列顺序", -1)),
|
|
1732
|
+
k("div", sa, [
|
|
1733
|
+
w[5] || (w[5] = k("span", null, "密度", -1)),
|
|
1734
|
+
h(p(it), {
|
|
1735
|
+
modelValue: B.value.density,
|
|
1736
|
+
"onUpdate:modelValue": w[1] || (w[1] = (b) => B.value.density = b),
|
|
1737
|
+
size: "small",
|
|
1738
|
+
style: { width: "96px" }
|
|
1739
|
+
}, {
|
|
1740
|
+
default: v(() => [
|
|
1741
|
+
h(p(be), {
|
|
1742
|
+
label: "默认",
|
|
1743
|
+
value: "default"
|
|
1744
|
+
}),
|
|
1745
|
+
h(p(be), {
|
|
1746
|
+
label: "中等",
|
|
1747
|
+
value: "medium"
|
|
1748
|
+
}),
|
|
1749
|
+
h(p(be), {
|
|
1750
|
+
label: "紧凑",
|
|
1751
|
+
value: "compact"
|
|
1752
|
+
})
|
|
1753
|
+
]),
|
|
1754
|
+
_: 1
|
|
1755
|
+
}, 8, ["modelValue"])
|
|
1756
|
+
])
|
|
1757
|
+
]),
|
|
1758
|
+
w[7] || (w[7] = k("div", { class: "table-settings__head" }, [
|
|
1759
|
+
k("span", null, "列名"),
|
|
1760
|
+
k("span", null, "对齐方式"),
|
|
1761
|
+
k("span", null, "隐藏列"),
|
|
1762
|
+
k("span", null, "冻结列"),
|
|
1763
|
+
k("span", null, "排序")
|
|
1764
|
+
], -1)),
|
|
1765
|
+
(r(!0), E(ce, null, me(C.value, (b, j) => (r(), E("div", {
|
|
1766
|
+
key: b.key,
|
|
1767
|
+
class: ye(["table-settings__row", { "is-dragging": T.value === j, "is-drag-over": q.value === j }]),
|
|
1768
|
+
onDragover: lt((re) => ae(j), ["prevent"]),
|
|
1769
|
+
onDragleave: (re) => Ae(j),
|
|
1770
|
+
onDrop: lt((re) => Oe(j), ["prevent"])
|
|
1771
|
+
}, [
|
|
1772
|
+
k("span", ua, F(b.label), 1),
|
|
1773
|
+
h(p(it), {
|
|
1774
|
+
"model-value": B.value.aligns[b.key] ?? b.align ?? "left",
|
|
1775
|
+
size: "small",
|
|
1776
|
+
"onUpdate:modelValue": (re) => Ie(b.key, re)
|
|
1777
|
+
}, {
|
|
1778
|
+
default: v(() => [
|
|
1779
|
+
h(p(be), {
|
|
1780
|
+
label: "左对齐",
|
|
1781
|
+
value: "left"
|
|
1782
|
+
}),
|
|
1783
|
+
h(p(be), {
|
|
1784
|
+
label: "居中",
|
|
1785
|
+
value: "center"
|
|
1786
|
+
}),
|
|
1787
|
+
h(p(be), {
|
|
1788
|
+
label: "右对齐",
|
|
1789
|
+
value: "right"
|
|
1790
|
+
})
|
|
1791
|
+
]),
|
|
1792
|
+
_: 1
|
|
1793
|
+
}, 8, ["model-value", "onUpdate:modelValue"]),
|
|
1794
|
+
h(p(At), {
|
|
1795
|
+
"model-value": B.value.hidden.includes(b.key),
|
|
1796
|
+
"onUpdate:modelValue": (re) => c(b.key, re)
|
|
1797
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"]),
|
|
1798
|
+
h(p(At), {
|
|
1799
|
+
"model-value": B.value.frozen.includes(b.key),
|
|
1800
|
+
"onUpdate:modelValue": (re) => A(b.key, re)
|
|
1801
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"]),
|
|
1802
|
+
k("div", ca, [
|
|
1803
|
+
k("span", {
|
|
1804
|
+
class: "table-settings__drag",
|
|
1805
|
+
draggable: "true",
|
|
1806
|
+
title: "拖动排序",
|
|
1807
|
+
"aria-label": "拖动排序",
|
|
1808
|
+
onDragstart: (re) => ve(j, re),
|
|
1809
|
+
onDragend: $e
|
|
1810
|
+
}, "⠿", 40, da)
|
|
1811
|
+
])
|
|
1812
|
+
], 42, ra))), 128))
|
|
1813
|
+
])
|
|
1814
|
+
]),
|
|
1815
|
+
_: 1
|
|
1816
|
+
}, 8, ["modelValue"])
|
|
1817
|
+
]));
|
|
1818
|
+
}
|
|
1819
|
+
}), pa = /* @__PURE__ */ he(ma, [["__scopeId", "data-v-4fd51399"]]), va = /* @__PURE__ */ oe({
|
|
1820
|
+
name: "YcStatusTag",
|
|
1821
|
+
__name: "YcStatusTag",
|
|
1822
|
+
props: {
|
|
1823
|
+
value: { type: [String, Number, Boolean, null] },
|
|
1824
|
+
options: {},
|
|
1825
|
+
fallbackLabel: {},
|
|
1826
|
+
effect: { default: "light" }
|
|
1827
|
+
},
|
|
1828
|
+
setup(e) {
|
|
1829
|
+
const n = e, t = I(() => {
|
|
1830
|
+
const l = n.options.find((o) => o.value === n.value);
|
|
1831
|
+
return l ? { label: l.label, type: l.type ?? "info" } : { label: n.fallbackLabel ?? (n.value === null || n.value === void 0 ? "-" : String(n.value)), type: "info" };
|
|
1832
|
+
});
|
|
1833
|
+
return (l, a) => (r(), V(p(Ft), {
|
|
1834
|
+
type: t.value.type,
|
|
1835
|
+
size: "small",
|
|
1836
|
+
effect: e.effect
|
|
1837
|
+
}, {
|
|
1838
|
+
default: v(() => [
|
|
1839
|
+
X(F(t.value.label), 1)
|
|
1840
|
+
]),
|
|
1841
|
+
_: 1
|
|
1842
|
+
}, 8, ["type", "effect"]));
|
|
1843
|
+
}
|
|
1844
|
+
}), ga = /* @__PURE__ */ oe({
|
|
1845
|
+
name: "YcPermission",
|
|
1846
|
+
__name: "YcPermission",
|
|
1847
|
+
props: {
|
|
1848
|
+
permission: {},
|
|
1849
|
+
mode: { default: "any" },
|
|
1850
|
+
superAdminBypass: { type: Boolean }
|
|
1851
|
+
},
|
|
1852
|
+
setup(e) {
|
|
1853
|
+
const n = e, { has: t, hasAll: l } = wt(), a = I(() => {
|
|
1854
|
+
const o = Array.isArray(n.permission) ? n.permission : [n.permission];
|
|
1855
|
+
if (o.length === 0) return !0;
|
|
1856
|
+
const y = { superAdminBypass: n.superAdminBypass };
|
|
1857
|
+
return n.mode === "all" ? l(o, y) : t(o, y);
|
|
1858
|
+
});
|
|
1859
|
+
return (o, y) => a.value ? ee(o.$slots, "default", { key: 0 }) : ee(o.$slots, "fallback", { key: 1 });
|
|
1860
|
+
}
|
|
1861
|
+
}), en = "data-yc-permission-hidden", tn = "yc-permission-disabled";
|
|
1862
|
+
function ya(e) {
|
|
1863
|
+
e.__ycPermissionDisplay === void 0 && (e.__ycPermissionDisplay = e.style.display), e.style.display = "none", e.setAttribute(en, "");
|
|
1864
|
+
}
|
|
1865
|
+
function ha(e) {
|
|
1866
|
+
e.__ycPermissionDisabled === void 0 && (e.__ycPermissionDisabled = e.hasAttribute("disabled")), e.__ycPermissionTitle === void 0 && (e.__ycPermissionTitle = e.getAttribute("title")), e.classList.add(tn), e.setAttribute("aria-disabled", "true"), e.setAttribute("disabled", "disabled"), e.__ycPermissionTitle === null && e.setAttribute("title", we().deniedTip);
|
|
1867
|
+
}
|
|
1868
|
+
function Fe(e) {
|
|
1869
|
+
e.classList.remove(tn), e.removeAttribute("aria-disabled"), e.removeAttribute(en), e.__ycPermissionDisplay !== void 0 && (e.style.display = e.__ycPermissionDisplay, delete e.__ycPermissionDisplay), e.__ycPermissionDisabled !== void 0 && (e.__ycPermissionDisabled ? e.setAttribute("disabled", "disabled") : e.removeAttribute("disabled"), delete e.__ycPermissionDisabled), e.__ycPermissionTitle !== void 0 && (e.__ycPermissionTitle === null ? e.removeAttribute("title") : e.setAttribute("title", e.__ycPermissionTitle), delete e.__ycPermissionTitle);
|
|
1870
|
+
}
|
|
1871
|
+
function Bt(e, n) {
|
|
1872
|
+
const t = Qt(n.value);
|
|
1873
|
+
if (t.length === 0) {
|
|
1874
|
+
Fe(e);
|
|
1875
|
+
return;
|
|
1876
|
+
}
|
|
1877
|
+
const l = Zt(), a = n.arg === "all" ? l.hasAll(t) : l.hasAny(t);
|
|
1878
|
+
if (n.modifiers.disable) {
|
|
1879
|
+
a ? Fe(e) : ha(e);
|
|
1880
|
+
return;
|
|
1881
|
+
}
|
|
1882
|
+
a ? Fe(e) : ya(e);
|
|
1883
|
+
}
|
|
1884
|
+
const _a = {
|
|
1885
|
+
mounted(e, n) {
|
|
1886
|
+
Bt(e, n);
|
|
1887
|
+
},
|
|
1888
|
+
updated(e, n) {
|
|
1889
|
+
Bt(e, n);
|
|
1890
|
+
},
|
|
1891
|
+
unmounted(e) {
|
|
1892
|
+
Fe(e);
|
|
1893
|
+
}
|
|
1894
|
+
}, wa = { class: "yc-drawer__body" }, ba = { class: "yc-drawer__footer" }, ka = /* @__PURE__ */ oe({
|
|
1895
|
+
name: "YcDrawer",
|
|
1896
|
+
__name: "YcDrawer",
|
|
1897
|
+
props: {
|
|
1898
|
+
modelValue: { type: Boolean },
|
|
1899
|
+
title: { default: "" },
|
|
1900
|
+
size: { default: "480px" },
|
|
1901
|
+
direction: { default: "rtl" },
|
|
1902
|
+
loading: { type: Boolean, default: !1 },
|
|
1903
|
+
destroyOnClose: { type: Boolean, default: !0 },
|
|
1904
|
+
closeOnClickModal: { type: Boolean, default: !1 }
|
|
1905
|
+
},
|
|
1906
|
+
emits: ["update:modelValue", "closed"],
|
|
1907
|
+
setup(e, { emit: n }) {
|
|
1908
|
+
const t = n;
|
|
1909
|
+
function l(a) {
|
|
1910
|
+
t("update:modelValue", a);
|
|
1911
|
+
}
|
|
1912
|
+
return (a, o) => {
|
|
1913
|
+
const y = vt("loading");
|
|
1914
|
+
return r(), V(p(Un), {
|
|
1915
|
+
"model-value": e.modelValue,
|
|
1916
|
+
title: e.title,
|
|
1917
|
+
size: e.size,
|
|
1918
|
+
direction: e.direction,
|
|
1919
|
+
"destroy-on-close": e.destroyOnClose,
|
|
1920
|
+
"close-on-click-modal": e.closeOnClickModal,
|
|
1921
|
+
"append-to-body": "",
|
|
1922
|
+
"onUpdate:modelValue": l,
|
|
1923
|
+
onClosed: o[0] || (o[0] = (f) => t("closed"))
|
|
1924
|
+
}, Yt({
|
|
1925
|
+
default: v(() => [
|
|
1926
|
+
Ee((r(), E("div", wa, [
|
|
1927
|
+
ee(a.$slots, "default", {}, void 0, !0)
|
|
1928
|
+
])), [
|
|
1929
|
+
[y, e.loading]
|
|
1930
|
+
])
|
|
1931
|
+
]),
|
|
1932
|
+
_: 2
|
|
1933
|
+
}, [
|
|
1934
|
+
a.$slots.footer ? {
|
|
1935
|
+
name: "footer",
|
|
1936
|
+
fn: v(() => [
|
|
1937
|
+
k("div", ba, [
|
|
1938
|
+
ee(a.$slots, "footer", {}, void 0, !0)
|
|
1939
|
+
])
|
|
1940
|
+
]),
|
|
1941
|
+
key: "0"
|
|
1942
|
+
} : void 0
|
|
1943
|
+
]), 1032, ["model-value", "title", "size", "direction", "destroy-on-close", "close-on-click-modal"]);
|
|
1944
|
+
};
|
|
1945
|
+
}
|
|
1946
|
+
}), Ta = /* @__PURE__ */ he(ka, [["__scopeId", "data-v-eb90cb41"]]), Sa = { class: "yc-upload" }, Ca = ["accept", "multiple"], Ia = {
|
|
1947
|
+
key: 0,
|
|
1948
|
+
class: "yc-upload__hint"
|
|
1949
|
+
}, Aa = {
|
|
1950
|
+
key: 1,
|
|
1951
|
+
class: "yc-upload__list"
|
|
1952
|
+
}, $a = /* @__PURE__ */ oe({
|
|
1953
|
+
name: "YcUpload",
|
|
1954
|
+
__name: "YcUpload",
|
|
1955
|
+
props: {
|
|
1956
|
+
modelValue: {},
|
|
1957
|
+
uploader: {},
|
|
1958
|
+
accept: { default: "" },
|
|
1959
|
+
multiple: { type: Boolean, default: !0 },
|
|
1960
|
+
limit: { default: 5 },
|
|
1961
|
+
maxSizeMb: { default: 20 },
|
|
1962
|
+
showList: { type: Boolean, default: !0 },
|
|
1963
|
+
buttonText: { default: "选择文件" },
|
|
1964
|
+
hint: { default: "" }
|
|
1965
|
+
},
|
|
1966
|
+
emits: ["update:modelValue", "uploaded"],
|
|
1967
|
+
setup(e, { emit: n }) {
|
|
1968
|
+
const t = e, l = n, a = x(), o = x(!1), y = I(() => t.hint ? t.hint : `最多 ${t.limit} 个,单个不超过 ${t.maxSizeMb}MB`);
|
|
1969
|
+
function f() {
|
|
1970
|
+
var M;
|
|
1971
|
+
(M = a.value) == null || M.click();
|
|
1972
|
+
}
|
|
1973
|
+
async function m(M) {
|
|
1974
|
+
const P = M.target, K = Array.from(P.files ?? []);
|
|
1975
|
+
if (P.value = "", K.length === 0) return;
|
|
1976
|
+
if (t.modelValue.length + K.length > t.limit) {
|
|
1977
|
+
et.warning(`最多上传 ${t.limit} 个文件`);
|
|
1978
|
+
return;
|
|
1979
|
+
}
|
|
1980
|
+
const O = K.find((z) => z.size > t.maxSizeMb * 1024 * 1024);
|
|
1981
|
+
if (O) {
|
|
1982
|
+
et.warning(`${O.name} 超过 ${t.maxSizeMb}MB 限制`);
|
|
1983
|
+
return;
|
|
1984
|
+
}
|
|
1985
|
+
o.value = !0;
|
|
1986
|
+
const _ = [...t.modelValue];
|
|
1987
|
+
try {
|
|
1988
|
+
for (const z of K) {
|
|
1989
|
+
const B = await t.uploader(z);
|
|
1990
|
+
_.push(B), l("uploaded", B);
|
|
1991
|
+
}
|
|
1992
|
+
l("update:modelValue", _);
|
|
1993
|
+
} catch (z) {
|
|
1994
|
+
et.error(z.message || "上传失败");
|
|
1995
|
+
} finally {
|
|
1996
|
+
o.value = !1;
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
function i(M) {
|
|
2000
|
+
l("update:modelValue", t.modelValue.filter((P) => P.id !== M));
|
|
2001
|
+
}
|
|
2002
|
+
function $(M) {
|
|
2003
|
+
if (!M) return "0 B";
|
|
2004
|
+
if (M < 1024) return `${M} B`;
|
|
2005
|
+
const P = ["KB", "MB", "GB"];
|
|
2006
|
+
let K = M / 1024, O = 0;
|
|
2007
|
+
for (; K >= 1024 && O < P.length - 1; )
|
|
2008
|
+
K /= 1024, O += 1;
|
|
2009
|
+
return `${K.toFixed(K >= 10 ? 0 : 1)} ${P[O]}`;
|
|
2010
|
+
}
|
|
2011
|
+
return (M, P) => (r(), E("div", Sa, [
|
|
2012
|
+
k("input", {
|
|
2013
|
+
ref_key: "inputRef",
|
|
2014
|
+
ref: a,
|
|
2015
|
+
class: "yc-upload__input",
|
|
2016
|
+
type: "file",
|
|
2017
|
+
accept: e.accept,
|
|
2018
|
+
multiple: e.multiple,
|
|
2019
|
+
onChange: m
|
|
2020
|
+
}, null, 40, Ca),
|
|
2021
|
+
h(p(Te), {
|
|
2022
|
+
loading: o.value,
|
|
2023
|
+
onClick: f
|
|
2024
|
+
}, {
|
|
2025
|
+
default: v(() => [
|
|
2026
|
+
X(F(e.buttonText), 1)
|
|
2027
|
+
]),
|
|
2028
|
+
_: 1
|
|
2029
|
+
}, 8, ["loading"]),
|
|
2030
|
+
y.value ? (r(), E("span", Ia, F(y.value), 1)) : R("", !0),
|
|
2031
|
+
e.showList && e.modelValue.length > 0 ? (r(), E("div", Aa, [
|
|
2032
|
+
(r(!0), E(ce, null, me(e.modelValue, (K) => (r(), V(p(Ft), {
|
|
2033
|
+
key: K.id,
|
|
2034
|
+
type: "info",
|
|
2035
|
+
closable: "",
|
|
2036
|
+
onClose: (O) => i(K.id)
|
|
2037
|
+
}, {
|
|
2038
|
+
default: v(() => [
|
|
2039
|
+
X(F(K.name) + "(" + F($(K.size)) + ") ", 1)
|
|
2040
|
+
]),
|
|
2041
|
+
_: 2
|
|
2042
|
+
}, 1032, ["onClose"]))), 128))
|
|
2043
|
+
])) : R("", !0)
|
|
2044
|
+
]));
|
|
2045
|
+
}
|
|
2046
|
+
}), xa = /* @__PURE__ */ he($a, [["__scopeId", "data-v-48329660"]]), Ea = /* @__PURE__ */ oe({
|
|
2047
|
+
name: "YcDescriptions",
|
|
2048
|
+
__name: "YcDescriptions",
|
|
2049
|
+
props: {
|
|
2050
|
+
items: {},
|
|
2051
|
+
column: { default: 2 },
|
|
2052
|
+
border: { type: Boolean, default: !0 },
|
|
2053
|
+
size: { default: "small" }
|
|
2054
|
+
},
|
|
2055
|
+
setup(e) {
|
|
2056
|
+
return (n, t) => (r(), V(p(Rn), {
|
|
2057
|
+
column: e.column,
|
|
2058
|
+
border: e.border,
|
|
2059
|
+
size: e.size
|
|
2060
|
+
}, {
|
|
2061
|
+
default: v(() => [
|
|
2062
|
+
(r(!0), E(ce, null, me(e.items, (l) => (r(), V(p(Nn), {
|
|
2063
|
+
key: l.key ?? l.label,
|
|
2064
|
+
label: l.label,
|
|
2065
|
+
span: l.span
|
|
2066
|
+
}, {
|
|
2067
|
+
default: v(() => [
|
|
2068
|
+
ee(n.$slots, l.key ? `value-${l.key}` : void 0, { item: l }, () => [
|
|
2069
|
+
X(F(l.value ?? "-"), 1)
|
|
2070
|
+
])
|
|
2071
|
+
]),
|
|
2072
|
+
_: 2
|
|
2073
|
+
}, 1032, ["label", "span"]))), 128)),
|
|
2074
|
+
ee(n.$slots, "default")
|
|
2075
|
+
]),
|
|
2076
|
+
_: 3
|
|
2077
|
+
}, 8, ["column", "border", "size"]));
|
|
2078
|
+
}
|
|
2079
|
+
});
|
|
2080
|
+
function Ma(e) {
|
|
2081
|
+
e != null && e.aiTask && (jn(e.aiTask), Hn()), e != null && e.imageSelector && qn(e.imageSelector);
|
|
2082
|
+
}
|
|
2083
|
+
function Da(e, n) {
|
|
2084
|
+
(n == null ? void 0 : n.registerComponents) !== !1 && (e.component("YcButton", Ul), e.component("YcPage", jl), e.component("YcSearchForm", Jl), e.component("YcTable", pa), e.component("YcStatusTag", va), e.component("YcPermission", ga), e.component("YcDrawer", Ta), e.component("YcUpload", xa), e.component("YcDescriptions", Ea)), (n == null ? void 0 : n.registerPageWindow) !== !1 && (e.component("YcPageWindow", Dt), e.component("SkyPageWindow", Dt)), (n == null ? void 0 : n.registerPermissionDirective) !== !1 && e.directive("permission", _a);
|
|
2085
|
+
}
|
|
2086
|
+
function Pa(e, n) {
|
|
2087
|
+
(n == null ? void 0 : n.registerImageSelector) !== !1 && xl(e);
|
|
2088
|
+
}
|
|
2089
|
+
const Xo = {
|
|
991
2090
|
install(e, n) {
|
|
992
|
-
|
|
2091
|
+
Ma(n), Da(e, n), Pa(e, n);
|
|
993
2092
|
}
|
|
994
|
-
},
|
|
995
|
-
function
|
|
2093
|
+
}, nt = "__YC_COMPONENT_AI_DIALOG__", ct = "yc-component:ai-dialog-open";
|
|
2094
|
+
function Ba() {
|
|
996
2095
|
const e = globalThis;
|
|
997
|
-
return e[
|
|
2096
|
+
return e[nt] || (e[nt] = mt({
|
|
998
2097
|
visible: !1,
|
|
999
2098
|
options: {}
|
|
1000
|
-
})), e[
|
|
2099
|
+
})), e[nt];
|
|
1001
2100
|
}
|
|
1002
|
-
const
|
|
1003
|
-
function
|
|
1004
|
-
|
|
1005
|
-
new CustomEvent(
|
|
2101
|
+
const pe = Ba();
|
|
2102
|
+
function bt(e = {}) {
|
|
2103
|
+
pe.options = { ...e }, pe.visible = !0, globalThis.dispatchEvent(
|
|
2104
|
+
new CustomEvent(ct, { detail: { ...e } })
|
|
1006
2105
|
);
|
|
1007
2106
|
}
|
|
1008
|
-
function
|
|
1009
|
-
|
|
2107
|
+
function nn() {
|
|
2108
|
+
pe.visible = !1;
|
|
1010
2109
|
}
|
|
1011
|
-
function
|
|
1012
|
-
|
|
2110
|
+
function Qo(e = {}) {
|
|
2111
|
+
bt(e);
|
|
1013
2112
|
}
|
|
1014
|
-
function
|
|
2113
|
+
function ln(e) {
|
|
1015
2114
|
const {
|
|
1016
2115
|
tasks: n,
|
|
1017
2116
|
panelVisible: t,
|
|
1018
|
-
panelMinimized:
|
|
1019
|
-
dialogVisible:
|
|
1020
|
-
runningCount:
|
|
1021
|
-
activeCount:
|
|
1022
|
-
panelTitle:
|
|
1023
|
-
panelSubtitle:
|
|
1024
|
-
} =
|
|
2117
|
+
panelMinimized: l,
|
|
2118
|
+
dialogVisible: a,
|
|
2119
|
+
runningCount: o,
|
|
2120
|
+
activeCount: y,
|
|
2121
|
+
panelTitle: f,
|
|
2122
|
+
panelSubtitle: m
|
|
2123
|
+
} = Fn(e);
|
|
1025
2124
|
return {
|
|
1026
2125
|
tasks: n,
|
|
1027
2126
|
panelVisible: t,
|
|
1028
|
-
panelMinimized:
|
|
1029
|
-
dialogVisible:
|
|
1030
|
-
runningCount:
|
|
1031
|
-
activeCount:
|
|
1032
|
-
panelTitle:
|
|
1033
|
-
panelSubtitle:
|
|
1034
|
-
openUseDialog: (
|
|
1035
|
-
|
|
2127
|
+
panelMinimized: l,
|
|
2128
|
+
dialogVisible: a,
|
|
2129
|
+
runningCount: o,
|
|
2130
|
+
activeCount: y,
|
|
2131
|
+
panelTitle: f,
|
|
2132
|
+
panelSubtitle: m,
|
|
2133
|
+
openUseDialog: (i) => {
|
|
2134
|
+
bt(i ?? {}), e.openDialog(i ?? {});
|
|
1036
2135
|
},
|
|
1037
2136
|
closeUseDialog: () => e.closeDialog(),
|
|
1038
2137
|
openTaskPanel: () => e.showPanel(),
|
|
1039
2138
|
hideTaskPanel: () => e.hidePanel(),
|
|
1040
2139
|
togglePanelMinimize: () => e.toggleMinimize(),
|
|
1041
|
-
submitTask: (
|
|
1042
|
-
cancelTask: (
|
|
2140
|
+
submitTask: (i) => e.enqueue(i),
|
|
2141
|
+
cancelTask: (i) => e.cancelTask(i),
|
|
1043
2142
|
cancelAll: () => e.cancelAll(),
|
|
1044
2143
|
clearFinished: () => e.clearFinished(),
|
|
1045
|
-
removeTask: (
|
|
1046
|
-
loadTaskResult: (
|
|
2144
|
+
removeTask: (i) => e.removeTask(i),
|
|
2145
|
+
loadTaskResult: (i) => e.loadTaskResult(i),
|
|
1047
2146
|
refreshTasks: () => e.refreshActiveTasks(),
|
|
1048
|
-
onTaskFinish: (
|
|
2147
|
+
onTaskFinish: (i) => e.onTaskFinish(i)
|
|
1049
2148
|
};
|
|
1050
2149
|
}
|
|
1051
|
-
const
|
|
1052
|
-
function
|
|
2150
|
+
const Va = "__YC_AI_TASK_CTX_KEY__", za = "__YC_AI_TASK_STORE_KEY__";
|
|
2151
|
+
function an(e) {
|
|
1053
2152
|
const n = globalThis;
|
|
1054
2153
|
return n[e] || (n[e] = Symbol(e)), n[e];
|
|
1055
2154
|
}
|
|
1056
|
-
const
|
|
2155
|
+
const on = an(Va), sn = an(za), La = async (e) => (await De().post(
|
|
1057
2156
|
"/yc-ai/workflows/runs",
|
|
1058
2157
|
e
|
|
1059
|
-
)).data,
|
|
1060
|
-
async function
|
|
1061
|
-
return
|
|
2158
|
+
)).data, rn = async (e) => (await De().get(`/yc-ai/workflows/runs/${e}`)).data, Oa = (e) => De().post(`/yc-ai/workflows/runs/${e}/cancel`), Ya = (e, n) => De().post(`/yc-ai/workflows/runs/${e}/client-continue`, n);
|
|
2159
|
+
async function dt(e, n) {
|
|
2160
|
+
return Gn(e, n);
|
|
1062
2161
|
}
|
|
1063
|
-
function
|
|
2162
|
+
function Ua(e, n) {
|
|
1064
2163
|
const t = e.trim();
|
|
1065
2164
|
if (!t)
|
|
1066
2165
|
return n;
|
|
1067
|
-
let
|
|
2166
|
+
let l;
|
|
1068
2167
|
try {
|
|
1069
|
-
t.includes("function") ?
|
|
2168
|
+
t.includes("function") ? l = new Function(
|
|
1070
2169
|
"result",
|
|
1071
2170
|
`
|
|
1072
2171
|
${t}
|
|
1073
2172
|
if (typeof handler === 'function') return handler(result);
|
|
1074
2173
|
throw new Error('请定义 function handler(result) { ... }');
|
|
1075
2174
|
`
|
|
1076
|
-
) :
|
|
1077
|
-
} catch (
|
|
1078
|
-
throw new Error(`自定义脚本语法错误: ${
|
|
2175
|
+
) : l = new Function("result", `return (${t})(result);`);
|
|
2176
|
+
} catch (a) {
|
|
2177
|
+
throw new Error(`自定义脚本语法错误: ${a instanceof Error ? a.message : String(a)}`);
|
|
1079
2178
|
}
|
|
1080
2179
|
try {
|
|
1081
|
-
return
|
|
1082
|
-
} catch (
|
|
1083
|
-
throw new Error(`自定义脚本执行失败: ${
|
|
2180
|
+
return l(n);
|
|
2181
|
+
} catch (a) {
|
|
2182
|
+
throw new Error(`自定义脚本执行失败: ${a instanceof Error ? a.message : String(a)}`);
|
|
1084
2183
|
}
|
|
1085
2184
|
}
|
|
1086
|
-
async function
|
|
1087
|
-
return (await
|
|
1088
|
-
projectId:
|
|
2185
|
+
async function Ra(e) {
|
|
2186
|
+
return (await La({
|
|
2187
|
+
projectId: Wn(),
|
|
1089
2188
|
freeText: e.freeText,
|
|
1090
2189
|
promptId: e.promptId,
|
|
1091
2190
|
autoMatch: e.autoMatch
|
|
1092
2191
|
})).runId;
|
|
1093
2192
|
}
|
|
1094
|
-
async function
|
|
1095
|
-
var
|
|
1096
|
-
const t = await
|
|
2193
|
+
async function Na(e, n) {
|
|
2194
|
+
var l, a, o, y;
|
|
2195
|
+
const t = await rn(e);
|
|
1097
2196
|
if (t.status === "WAITING_CLIENT" && t.waitingStepKey && t.waitingClientScript) {
|
|
1098
|
-
(
|
|
1099
|
-
let
|
|
1100
|
-
t.waitingArtifactId && (
|
|
1101
|
-
const
|
|
1102
|
-
return await
|
|
2197
|
+
(l = n == null ? void 0 : n.onProgress) == null || l.call(n, 60, `执行脚本:${t.waitingStepKey}`);
|
|
2198
|
+
let f = {};
|
|
2199
|
+
t.waitingArtifactId && (f = await dt(e, t.waitingArtifactId));
|
|
2200
|
+
const m = Ua(t.waitingClientScript, f);
|
|
2201
|
+
return await Ya(e, {
|
|
1103
2202
|
stepKey: t.waitingStepKey,
|
|
1104
|
-
output:
|
|
2203
|
+
output: m ?? {}
|
|
1105
2204
|
}), null;
|
|
1106
2205
|
}
|
|
1107
2206
|
if (t.status === "SUCCEEDED") {
|
|
1108
2207
|
if (t.finalArtifactId) {
|
|
1109
|
-
(
|
|
1110
|
-
const
|
|
1111
|
-
return (
|
|
2208
|
+
(a = n == null ? void 0 : n.onProgress) == null || a.call(n, 95, "加载结果…");
|
|
2209
|
+
const f = await dt(e, t.finalArtifactId);
|
|
2210
|
+
return (o = n == null ? void 0 : n.onProgress) == null || o.call(n, 100, "已完成"), { phase: "SUCCEEDED", runId: e, result: f };
|
|
1112
2211
|
}
|
|
1113
2212
|
return { phase: "SUCCEEDED", runId: e, result: {} };
|
|
1114
2213
|
}
|
|
1115
|
-
return t.status === "FAILED" ? { phase: "FAILED", runId: e, errorMessage: t.errorMessage || "工作流失败" } : t.status === "CANCELLED" ? { phase: "FAILED", runId: e, errorMessage: "已取消" } : ((
|
|
2214
|
+
return t.status === "FAILED" ? { phase: "FAILED", runId: e, errorMessage: t.errorMessage || "工作流失败" } : t.status === "CANCELLED" ? { phase: "FAILED", runId: e, errorMessage: "已取消" } : ((y = n == null ? void 0 : n.onProgress) == null || y.call(n, ja(t), Wa(t)), null);
|
|
1116
2215
|
}
|
|
1117
|
-
async function
|
|
1118
|
-
const n = await
|
|
1119
|
-
return n.status !== "SUCCEEDED" || !n.finalArtifactId ? null : await
|
|
2216
|
+
async function Fa(e) {
|
|
2217
|
+
const n = await rn(e);
|
|
2218
|
+
return n.status !== "SUCCEEDED" || !n.finalArtifactId ? null : await dt(e, n.finalArtifactId);
|
|
1120
2219
|
}
|
|
1121
|
-
async function
|
|
1122
|
-
await
|
|
2220
|
+
async function Ka(e) {
|
|
2221
|
+
await Oa(e);
|
|
1123
2222
|
}
|
|
1124
|
-
function
|
|
2223
|
+
function ja(e) {
|
|
1125
2224
|
if (e.status === "PENDING") return 8;
|
|
1126
2225
|
const n = e.steps ?? [];
|
|
1127
2226
|
if (!n.length) return 35;
|
|
1128
|
-
const t = n.filter((
|
|
2227
|
+
const t = n.filter((l) => l.status === "SUCCEEDED" || l.status === "SKIPPED").length;
|
|
1129
2228
|
return Math.min(90, Math.round(20 + t / n.length * 70));
|
|
1130
2229
|
}
|
|
1131
|
-
function
|
|
2230
|
+
function Wa(e) {
|
|
1132
2231
|
var t;
|
|
1133
2232
|
if (e.status === "PENDING") return "排队中…";
|
|
1134
|
-
const n = (t = e.steps) == null ? void 0 : t.find((
|
|
2233
|
+
const n = (t = e.steps) == null ? void 0 : t.find((l) => l.status === "RUNNING");
|
|
1135
2234
|
return n ? `执行中:${n.stepKey}` : "后端处理中…";
|
|
1136
2235
|
}
|
|
1137
|
-
const
|
|
1138
|
-
function
|
|
2236
|
+
const un = 80;
|
|
2237
|
+
function Ha() {
|
|
1139
2238
|
try {
|
|
1140
|
-
const e = localStorage.getItem(
|
|
2239
|
+
const e = localStorage.getItem(jt());
|
|
1141
2240
|
if (!e) return [];
|
|
1142
2241
|
const n = JSON.parse(e);
|
|
1143
|
-
return Array.isArray(n) ? n.filter((t) => t && t.id && t.createdAt).sort((t,
|
|
2242
|
+
return Array.isArray(n) ? n.filter((t) => t && t.id && t.createdAt).sort((t, l) => l.createdAt - t.createdAt).slice(0, un) : [];
|
|
1144
2243
|
} catch {
|
|
1145
2244
|
return [];
|
|
1146
2245
|
}
|
|
1147
2246
|
}
|
|
1148
|
-
function
|
|
1149
|
-
const n = e.slice(0,
|
|
2247
|
+
function Ga(e) {
|
|
2248
|
+
const n = e.slice(0, un).map((t) => ({
|
|
1150
2249
|
id: t.id,
|
|
1151
2250
|
title: t.title,
|
|
1152
2251
|
freeText: t.freeText,
|
|
@@ -1160,250 +2259,250 @@ function xo(e) {
|
|
|
1160
2259
|
createdAt: t.createdAt,
|
|
1161
2260
|
finishedAt: t.finishedAt
|
|
1162
2261
|
}));
|
|
1163
|
-
localStorage.setItem(
|
|
2262
|
+
localStorage.setItem(jt(), JSON.stringify(n));
|
|
1164
2263
|
}
|
|
1165
|
-
function
|
|
2264
|
+
function qa(e) {
|
|
1166
2265
|
return {
|
|
1167
2266
|
...e,
|
|
1168
2267
|
logs: e.runId ? [`ℹ 已从本地恢复,runId=${e.runId}`] : [],
|
|
1169
2268
|
result: void 0
|
|
1170
2269
|
};
|
|
1171
2270
|
}
|
|
1172
|
-
function
|
|
2271
|
+
function _e(e) {
|
|
1173
2272
|
return e === "pending" || e === "running";
|
|
1174
2273
|
}
|
|
1175
|
-
let
|
|
1176
|
-
const
|
|
1177
|
-
function
|
|
1178
|
-
return
|
|
2274
|
+
let ft = 0, Ve = null;
|
|
2275
|
+
const Ja = 5e3;
|
|
2276
|
+
function Xa() {
|
|
2277
|
+
return ft += 1, `ai_task_${Date.now()}_${ft}`;
|
|
1179
2278
|
}
|
|
1180
|
-
function
|
|
2279
|
+
function Qa(e, n = 28) {
|
|
1181
2280
|
const t = e.trim();
|
|
1182
2281
|
return t.length <= n ? t : `${t.slice(0, n)}…`;
|
|
1183
2282
|
}
|
|
1184
|
-
const
|
|
1185
|
-
const e =
|
|
1186
|
-
function
|
|
2283
|
+
const cn = Kn("ycAiTask", () => {
|
|
2284
|
+
const e = x([]), n = x(!1), t = x(!1), l = x(!1), a = x({}), o = x(!1), y = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Set();
|
|
2285
|
+
function i(c, A) {
|
|
1187
2286
|
return {
|
|
1188
|
-
taskId:
|
|
1189
|
-
runId:
|
|
1190
|
-
title:
|
|
1191
|
-
freeText:
|
|
1192
|
-
promptId:
|
|
1193
|
-
result:
|
|
1194
|
-
finishedAt:
|
|
2287
|
+
taskId: c.id,
|
|
2288
|
+
runId: c.runId,
|
|
2289
|
+
title: c.title,
|
|
2290
|
+
freeText: c.freeText,
|
|
2291
|
+
promptId: c.promptId,
|
|
2292
|
+
result: A,
|
|
2293
|
+
finishedAt: c.finishedAt ?? Date.now()
|
|
1195
2294
|
};
|
|
1196
2295
|
}
|
|
1197
|
-
function
|
|
1198
|
-
var
|
|
1199
|
-
const
|
|
1200
|
-
if (!(
|
|
1201
|
-
const
|
|
1202
|
-
(
|
|
2296
|
+
function $(c, A) {
|
|
2297
|
+
var ve;
|
|
2298
|
+
const T = e.value.find((ae) => ae.id === c);
|
|
2299
|
+
if (!(T != null && T.runId)) return;
|
|
2300
|
+
const q = i(T, A);
|
|
2301
|
+
(ve = f.get(c)) == null || ve(q), f.delete(c), m.forEach((ae) => ae(q));
|
|
1203
2302
|
}
|
|
1204
|
-
function
|
|
1205
|
-
return
|
|
2303
|
+
function M(c) {
|
|
2304
|
+
return m.add(c), () => m.delete(c);
|
|
1206
2305
|
}
|
|
1207
|
-
const
|
|
1208
|
-
() => e.value.filter((
|
|
1209
|
-
),
|
|
1210
|
-
const
|
|
1211
|
-
return
|
|
2306
|
+
const P = I(
|
|
2307
|
+
() => e.value.filter((c) => _e(c.status)).length
|
|
2308
|
+
), K = I(() => e.value.filter((c) => c.status === "running").length), O = I(() => P.value > 0 ? "AI 处理中" : e.value.some((c) => c.status === "failed") ? "部分任务失败" : "AI 任务"), _ = I(() => {
|
|
2309
|
+
const c = e.value.length, A = P.value;
|
|
2310
|
+
return c === 0 ? "暂无任务" : A > 0 ? `${A}/${c} 项任务进行中` : `${c} 项任务已完成`;
|
|
1212
2311
|
});
|
|
1213
|
-
function
|
|
1214
|
-
|
|
2312
|
+
function z() {
|
|
2313
|
+
Ga(e.value);
|
|
1215
2314
|
}
|
|
1216
|
-
function
|
|
1217
|
-
const
|
|
1218
|
-
|
|
2315
|
+
function B(c, A) {
|
|
2316
|
+
const T = e.value.findIndex((q) => q.id === c);
|
|
2317
|
+
T >= 0 && (e.value[T] = { ...e.value[T], ...A }, z());
|
|
1219
2318
|
}
|
|
1220
|
-
function
|
|
1221
|
-
const
|
|
1222
|
-
|
|
2319
|
+
function D(c, A) {
|
|
2320
|
+
const T = e.value.find((q) => q.id === c);
|
|
2321
|
+
T && (T.logs.unshift(A), T.logs.length > 20 && T.logs.pop());
|
|
1223
2322
|
}
|
|
1224
|
-
function
|
|
2323
|
+
function G() {
|
|
1225
2324
|
n.value = !0, t.value = !1;
|
|
1226
2325
|
}
|
|
1227
|
-
function
|
|
2326
|
+
function L() {
|
|
1228
2327
|
n.value = !1;
|
|
1229
2328
|
}
|
|
1230
|
-
function
|
|
2329
|
+
function S() {
|
|
1231
2330
|
t.value = !t.value;
|
|
1232
2331
|
}
|
|
1233
|
-
function
|
|
1234
|
-
|
|
2332
|
+
function g(c = {}) {
|
|
2333
|
+
a.value = { ...c }, l.value = !0, bt(c);
|
|
1235
2334
|
}
|
|
1236
|
-
function
|
|
1237
|
-
|
|
2335
|
+
function Y() {
|
|
2336
|
+
l.value = !1, nn();
|
|
1238
2337
|
}
|
|
1239
|
-
function
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
},
|
|
2338
|
+
function Z() {
|
|
2339
|
+
Ve || (Ve = setInterval(() => {
|
|
2340
|
+
ie();
|
|
2341
|
+
}, Ja));
|
|
1243
2342
|
}
|
|
1244
|
-
function
|
|
1245
|
-
|
|
2343
|
+
function N() {
|
|
2344
|
+
P.value > 0 || Ve && (clearInterval(Ve), Ve = null);
|
|
1246
2345
|
}
|
|
1247
|
-
async function
|
|
1248
|
-
const
|
|
1249
|
-
if (!
|
|
1250
|
-
|
|
2346
|
+
async function ie() {
|
|
2347
|
+
const c = e.value.filter((A) => A.runId && _e(A.status));
|
|
2348
|
+
if (!c.length) {
|
|
2349
|
+
N();
|
|
1251
2350
|
return;
|
|
1252
2351
|
}
|
|
1253
|
-
await Promise.all(
|
|
2352
|
+
await Promise.all(c.map((A) => C(A.id)));
|
|
1254
2353
|
}
|
|
1255
|
-
async function
|
|
1256
|
-
if (
|
|
1257
|
-
const
|
|
1258
|
-
if (!(!(
|
|
1259
|
-
|
|
2354
|
+
async function C(c) {
|
|
2355
|
+
if (y.has(c)) return;
|
|
2356
|
+
const A = e.value.find((T) => T.id === c);
|
|
2357
|
+
if (!(!(A != null && A.runId) || !_e(A.status))) {
|
|
2358
|
+
y.add(c);
|
|
1260
2359
|
try {
|
|
1261
|
-
const
|
|
1262
|
-
onProgress: (
|
|
2360
|
+
const T = await Na(A.runId, {
|
|
2361
|
+
onProgress: (q, ve) => B(c, { progress: q, summary: ve, status: "running" })
|
|
1263
2362
|
});
|
|
1264
|
-
if (!
|
|
1265
|
-
if (
|
|
1266
|
-
const
|
|
1267
|
-
|
|
2363
|
+
if (!T) return;
|
|
2364
|
+
if (T.phase === "SUCCEEDED") {
|
|
2365
|
+
const q = T.result ?? {};
|
|
2366
|
+
B(c, {
|
|
1268
2367
|
status: "succeeded",
|
|
1269
2368
|
progress: 100,
|
|
1270
2369
|
summary: "已完成",
|
|
1271
|
-
result:
|
|
1272
|
-
runId:
|
|
2370
|
+
result: q,
|
|
2371
|
+
runId: T.runId,
|
|
1273
2372
|
finishedAt: Date.now()
|
|
1274
|
-
}),
|
|
2373
|
+
}), $(c, q);
|
|
1275
2374
|
} else
|
|
1276
|
-
|
|
1277
|
-
status:
|
|
2375
|
+
B(c, {
|
|
2376
|
+
status: T.errorMessage === "已取消" ? "cancelled" : "failed",
|
|
1278
2377
|
progress: 100,
|
|
1279
|
-
summary:
|
|
1280
|
-
errorMessage:
|
|
1281
|
-
runId:
|
|
2378
|
+
summary: T.errorMessage || "失败",
|
|
2379
|
+
errorMessage: T.errorMessage,
|
|
2380
|
+
runId: T.runId,
|
|
1282
2381
|
finishedAt: Date.now()
|
|
1283
2382
|
});
|
|
1284
|
-
|
|
1285
|
-
} catch (
|
|
1286
|
-
const
|
|
1287
|
-
|
|
2383
|
+
N();
|
|
2384
|
+
} catch (T) {
|
|
2385
|
+
const q = T instanceof Error ? T.message : "同步失败";
|
|
2386
|
+
D(c, `✗ ${q}`);
|
|
1288
2387
|
} finally {
|
|
1289
|
-
|
|
2388
|
+
y.delete(c);
|
|
1290
2389
|
}
|
|
1291
2390
|
}
|
|
1292
2391
|
}
|
|
1293
|
-
async function
|
|
1294
|
-
if (
|
|
1295
|
-
|
|
1296
|
-
const
|
|
1297
|
-
|
|
1298
|
-
const
|
|
1299
|
-
|
|
1300
|
-
for (const
|
|
1301
|
-
|
|
2392
|
+
async function J() {
|
|
2393
|
+
if (o.value) return;
|
|
2394
|
+
o.value = !0;
|
|
2395
|
+
const c = Ha();
|
|
2396
|
+
c.length && (e.value = c.map(qa), ft = c.length);
|
|
2397
|
+
const A = e.value.filter((T) => T.runId && _e(T.status));
|
|
2398
|
+
A.length && (await Promise.all(A.map((T) => C(T.id))), Z());
|
|
2399
|
+
for (const T of e.value)
|
|
2400
|
+
T.status === "pending" && !T.runId && B(T.id, { status: "failed", summary: "页面刷新前未提交成功", finishedAt: Date.now() });
|
|
1302
2401
|
}
|
|
1303
|
-
function
|
|
1304
|
-
const
|
|
1305
|
-
id:
|
|
1306
|
-
title:
|
|
1307
|
-
freeText:
|
|
1308
|
-
promptId:
|
|
1309
|
-
autoMatch:
|
|
2402
|
+
function ne(c) {
|
|
2403
|
+
const A = Xa(), T = {
|
|
2404
|
+
id: A,
|
|
2405
|
+
title: c.title ?? Qa(c.freeText),
|
|
2406
|
+
freeText: c.freeText.trim(),
|
|
2407
|
+
promptId: c.promptId,
|
|
2408
|
+
autoMatch: c.autoMatch,
|
|
1310
2409
|
status: "pending",
|
|
1311
2410
|
progress: 0,
|
|
1312
2411
|
summary: "正在提交…",
|
|
1313
2412
|
createdAt: Date.now(),
|
|
1314
2413
|
logs: []
|
|
1315
2414
|
};
|
|
1316
|
-
return e.value.unshift(
|
|
2415
|
+
return e.value.unshift(T), z(), c.onFinish && f.set(A, c.onFinish), c.showPanel !== !1 && G(), le(A), A;
|
|
1317
2416
|
}
|
|
1318
|
-
async function
|
|
1319
|
-
const
|
|
1320
|
-
if (
|
|
2417
|
+
async function le(c) {
|
|
2418
|
+
const A = e.value.find((T) => T.id === c);
|
|
2419
|
+
if (A)
|
|
1321
2420
|
try {
|
|
1322
|
-
const
|
|
1323
|
-
freeText:
|
|
1324
|
-
promptId:
|
|
1325
|
-
autoMatch:
|
|
2421
|
+
const T = await Ra({
|
|
2422
|
+
freeText: A.freeText,
|
|
2423
|
+
promptId: A.promptId,
|
|
2424
|
+
autoMatch: A.autoMatch
|
|
1326
2425
|
});
|
|
1327
|
-
|
|
1328
|
-
runId:
|
|
2426
|
+
B(c, {
|
|
2427
|
+
runId: T,
|
|
1329
2428
|
status: "running",
|
|
1330
2429
|
progress: 10,
|
|
1331
2430
|
summary: "后端异步处理中…"
|
|
1332
|
-
}),
|
|
1333
|
-
} catch (
|
|
1334
|
-
const
|
|
1335
|
-
|
|
2431
|
+
}), D(c, `▶ 已提交 runId=${T}`), Z(), C(c);
|
|
2432
|
+
} catch (T) {
|
|
2433
|
+
const q = T instanceof Error ? T.message : "提交失败";
|
|
2434
|
+
B(c, {
|
|
1336
2435
|
status: "failed",
|
|
1337
2436
|
progress: 100,
|
|
1338
|
-
summary:
|
|
1339
|
-
errorMessage:
|
|
2437
|
+
summary: q,
|
|
2438
|
+
errorMessage: q,
|
|
1340
2439
|
finishedAt: Date.now()
|
|
1341
2440
|
});
|
|
1342
2441
|
}
|
|
1343
2442
|
}
|
|
1344
|
-
async function
|
|
1345
|
-
const
|
|
1346
|
-
if (!(
|
|
1347
|
-
if (
|
|
1348
|
-
const
|
|
1349
|
-
return
|
|
2443
|
+
async function H(c) {
|
|
2444
|
+
const A = e.value.find((q) => q.id === c);
|
|
2445
|
+
if (!(A != null && A.runId)) return null;
|
|
2446
|
+
if (A.result) return A.result;
|
|
2447
|
+
const T = await Fa(A.runId);
|
|
2448
|
+
return T && B(c, { result: T }), T;
|
|
1350
2449
|
}
|
|
1351
|
-
async function
|
|
1352
|
-
const
|
|
1353
|
-
if (
|
|
2450
|
+
async function te(c) {
|
|
2451
|
+
const A = e.value.find((T) => T.id === c);
|
|
2452
|
+
if (A != null && A.runId && _e(A.status))
|
|
1354
2453
|
try {
|
|
1355
|
-
await
|
|
2454
|
+
await Ka(A.runId);
|
|
1356
2455
|
} catch {
|
|
1357
2456
|
}
|
|
1358
|
-
|
|
2457
|
+
A && _e(A.status) && B(c, { status: "cancelled", summary: "已取消", finishedAt: Date.now() }), f.delete(c), N();
|
|
1359
2458
|
}
|
|
1360
|
-
function
|
|
1361
|
-
for (const
|
|
1362
|
-
|
|
2459
|
+
function Se() {
|
|
2460
|
+
for (const c of e.value)
|
|
2461
|
+
_e(c.status) && te(c.id);
|
|
1363
2462
|
}
|
|
1364
2463
|
function Ce() {
|
|
1365
|
-
e.value = e.value.filter((
|
|
2464
|
+
e.value = e.value.filter((c) => _e(c.status)), z();
|
|
1366
2465
|
}
|
|
1367
|
-
function
|
|
1368
|
-
|
|
2466
|
+
function Ie(c) {
|
|
2467
|
+
te(c), f.delete(c), e.value = e.value.filter((A) => A.id !== c), z();
|
|
1369
2468
|
}
|
|
1370
2469
|
return {
|
|
1371
2470
|
tasks: e,
|
|
1372
2471
|
panelVisible: n,
|
|
1373
2472
|
panelMinimized: t,
|
|
1374
|
-
dialogVisible:
|
|
1375
|
-
dialogOptions:
|
|
1376
|
-
hydrated:
|
|
1377
|
-
runningCount:
|
|
1378
|
-
activeCount:
|
|
1379
|
-
panelTitle:
|
|
1380
|
-
panelSubtitle:
|
|
1381
|
-
hydrate:
|
|
1382
|
-
showPanel:
|
|
1383
|
-
hidePanel:
|
|
1384
|
-
toggleMinimize:
|
|
1385
|
-
openDialog:
|
|
1386
|
-
closeDialog:
|
|
1387
|
-
enqueue:
|
|
1388
|
-
onTaskFinish:
|
|
1389
|
-
refreshActiveTasks:
|
|
1390
|
-
loadTaskResult:
|
|
1391
|
-
cancelTask:
|
|
1392
|
-
cancelAll:
|
|
2473
|
+
dialogVisible: l,
|
|
2474
|
+
dialogOptions: a,
|
|
2475
|
+
hydrated: o,
|
|
2476
|
+
runningCount: P,
|
|
2477
|
+
activeCount: K,
|
|
2478
|
+
panelTitle: O,
|
|
2479
|
+
panelSubtitle: _,
|
|
2480
|
+
hydrate: J,
|
|
2481
|
+
showPanel: G,
|
|
2482
|
+
hidePanel: L,
|
|
2483
|
+
toggleMinimize: S,
|
|
2484
|
+
openDialog: g,
|
|
2485
|
+
closeDialog: Y,
|
|
2486
|
+
enqueue: ne,
|
|
2487
|
+
onTaskFinish: M,
|
|
2488
|
+
refreshActiveTasks: ie,
|
|
2489
|
+
loadTaskResult: H,
|
|
2490
|
+
cancelTask: te,
|
|
2491
|
+
cancelAll: Se,
|
|
1393
2492
|
clearFinished: Ce,
|
|
1394
|
-
removeTask:
|
|
2493
|
+
removeTask: Ie
|
|
1395
2494
|
};
|
|
1396
2495
|
});
|
|
1397
|
-
async function
|
|
1398
|
-
return (await
|
|
2496
|
+
async function Za(e) {
|
|
2497
|
+
return (await De().get("/yc-ai/ai/prompts", {
|
|
1399
2498
|
params: e ? { category: e } : {}
|
|
1400
2499
|
})).data;
|
|
1401
2500
|
}
|
|
1402
|
-
function
|
|
1403
|
-
const e =
|
|
1404
|
-
return e ||
|
|
2501
|
+
function kt() {
|
|
2502
|
+
const e = qe(sn, null);
|
|
2503
|
+
return e || cn();
|
|
1405
2504
|
}
|
|
1406
|
-
const
|
|
2505
|
+
const eo = { class: "ai-use-dialog__footer" }, to = { class: "ai-use-dialog__footer-actions" }, no = /* @__PURE__ */ oe({
|
|
1407
2506
|
__name: "AiUseDialog",
|
|
1408
2507
|
props: {
|
|
1409
2508
|
title: { default: "AI 生成" },
|
|
@@ -1426,206 +2525,206 @@ const Po = { class: "ai-use-dialog__footer" }, $o = { class: "ai-use-dialog__foo
|
|
|
1426
2525
|
},
|
|
1427
2526
|
emits: ["update:modelValue", "submitted"],
|
|
1428
2527
|
setup(e, { emit: n }) {
|
|
1429
|
-
const t = e,
|
|
1430
|
-
|
|
2528
|
+
const t = e, l = n, a = kt(), o = I(() => t.modelValue !== void 0), y = x(!1);
|
|
2529
|
+
ue(
|
|
1431
2530
|
() => t.modelValue,
|
|
1432
|
-
(
|
|
1433
|
-
|
|
2531
|
+
(S) => {
|
|
2532
|
+
o.value && (y.value = !!S);
|
|
1434
2533
|
},
|
|
1435
2534
|
{ immediate: !0 }
|
|
1436
|
-
),
|
|
1437
|
-
if (
|
|
1438
|
-
|
|
2535
|
+
), ue(y, (S) => {
|
|
2536
|
+
if (o.value) {
|
|
2537
|
+
l("update:modelValue", S);
|
|
1439
2538
|
return;
|
|
1440
2539
|
}
|
|
1441
|
-
|
|
1442
|
-
}),
|
|
1443
|
-
() =>
|
|
1444
|
-
(
|
|
1445
|
-
|
|
2540
|
+
pe.visible = S, S || nn();
|
|
2541
|
+
}), ue(
|
|
2542
|
+
() => pe.visible,
|
|
2543
|
+
(S) => {
|
|
2544
|
+
o.value || (y.value = S);
|
|
1446
2545
|
},
|
|
1447
2546
|
{ immediate: !0 }
|
|
1448
2547
|
);
|
|
1449
|
-
function
|
|
1450
|
-
if (
|
|
1451
|
-
const
|
|
1452
|
-
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
globalThis.addEventListener(
|
|
1456
|
-
}),
|
|
1457
|
-
globalThis.removeEventListener(
|
|
2548
|
+
function f(S) {
|
|
2549
|
+
if (o.value) return;
|
|
2550
|
+
const g = S.detail ?? {};
|
|
2551
|
+
O(g), y.value = !0;
|
|
2552
|
+
}
|
|
2553
|
+
Me(() => {
|
|
2554
|
+
globalThis.addEventListener(ct, f), o.value || (y.value = pe.visible);
|
|
2555
|
+
}), pt(() => {
|
|
2556
|
+
globalThis.removeEventListener(ct, f);
|
|
1458
2557
|
});
|
|
1459
|
-
const
|
|
1460
|
-
() => (
|
|
1461
|
-
),
|
|
2558
|
+
const m = I(
|
|
2559
|
+
() => (o.value ? void 0 : pe.options.title) ?? t.title ?? "AI 生成"
|
|
2560
|
+
), i = x({
|
|
1462
2561
|
freeText: t.freeText,
|
|
1463
2562
|
promptId: t.promptId,
|
|
1464
2563
|
autoMatch: t.autoMatch
|
|
1465
|
-
}),
|
|
1466
|
-
function
|
|
1467
|
-
var
|
|
1468
|
-
|
|
1469
|
-
}
|
|
1470
|
-
async function
|
|
1471
|
-
if (!(
|
|
1472
|
-
|
|
2564
|
+
}), $ = x(t.prompts ? [...t.prompts] : []), M = x(!1), P = x(!1), K = x();
|
|
2565
|
+
function O(S) {
|
|
2566
|
+
var g, Y;
|
|
2567
|
+
i.value.freeText = S.freeText ?? t.freeText ?? "", i.value.promptId = S.promptId ?? t.promptId, i.value.autoMatch = S.autoMatch ?? t.autoMatch ?? !1, K.value = S.onFinish, (g = S.prompts) != null && g.length ? $.value = [...S.prompts] : (Y = t.prompts) != null && Y.length && ($.value = [...t.prompts]);
|
|
2568
|
+
}
|
|
2569
|
+
async function _() {
|
|
2570
|
+
if (!($.value.length > 0)) {
|
|
2571
|
+
M.value = !0;
|
|
1473
2572
|
try {
|
|
1474
|
-
const
|
|
1475
|
-
|
|
2573
|
+
const S = Kt().listPrompts;
|
|
2574
|
+
$.value = S ? await S() : await Za();
|
|
1476
2575
|
} catch {
|
|
1477
|
-
|
|
2576
|
+
de.warning("加载提示词失败");
|
|
1478
2577
|
} finally {
|
|
1479
|
-
|
|
2578
|
+
M.value = !1;
|
|
1480
2579
|
}
|
|
1481
2580
|
}
|
|
1482
2581
|
}
|
|
1483
|
-
function
|
|
1484
|
-
|
|
2582
|
+
function z() {
|
|
2583
|
+
o.value ? O({}) : O(pe.options), t.showPromptSelect && _();
|
|
1485
2584
|
}
|
|
1486
|
-
|
|
2585
|
+
ue(
|
|
1487
2586
|
() => t.prompts,
|
|
1488
|
-
(
|
|
1489
|
-
|
|
2587
|
+
(S) => {
|
|
2588
|
+
S != null && S.length && ($.value = [...S]);
|
|
1490
2589
|
},
|
|
1491
2590
|
{ deep: !0 }
|
|
1492
|
-
),
|
|
2591
|
+
), ue(
|
|
1493
2592
|
() => [t.freeText, t.promptId, t.autoMatch],
|
|
1494
|
-
([
|
|
1495
|
-
|
|
2593
|
+
([S, g, Y]) => {
|
|
2594
|
+
y.value || (i.value.freeText = S ?? "", i.value.promptId = g, i.value.autoMatch = Y ?? !1);
|
|
1496
2595
|
}
|
|
1497
2596
|
);
|
|
1498
|
-
function
|
|
1499
|
-
|
|
2597
|
+
function B() {
|
|
2598
|
+
i.value.autoMatch && (i.value.promptId = void 0);
|
|
1500
2599
|
}
|
|
1501
|
-
function
|
|
1502
|
-
|
|
2600
|
+
function D() {
|
|
2601
|
+
P.value = !1;
|
|
1503
2602
|
}
|
|
1504
|
-
function
|
|
1505
|
-
|
|
2603
|
+
function G() {
|
|
2604
|
+
a.showPanel();
|
|
1506
2605
|
}
|
|
1507
|
-
async function
|
|
1508
|
-
var
|
|
1509
|
-
if (!
|
|
1510
|
-
|
|
2606
|
+
async function L() {
|
|
2607
|
+
var N, ie;
|
|
2608
|
+
if (!i.value.freeText.trim()) {
|
|
2609
|
+
de.warning("请填写需求描述");
|
|
1511
2610
|
return;
|
|
1512
2611
|
}
|
|
1513
|
-
const
|
|
1514
|
-
if (!
|
|
1515
|
-
const
|
|
1516
|
-
|
|
2612
|
+
const S = i.value.autoMatch, g = S ? void 0 : i.value.promptId;
|
|
2613
|
+
if (!S && g == null) {
|
|
2614
|
+
const C = t.showPromptSelect || t.showAutoMatch ? "请选择提示词或开启自动匹配" : "请通过 promptId 传入提示词,或设置 autoMatch 为 true";
|
|
2615
|
+
de.warning(C);
|
|
1517
2616
|
return;
|
|
1518
2617
|
}
|
|
1519
|
-
|
|
1520
|
-
const
|
|
1521
|
-
freeText:
|
|
1522
|
-
promptId:
|
|
1523
|
-
autoMatch:
|
|
2618
|
+
P.value = !0;
|
|
2619
|
+
const Y = o.value ? K.value : pe.options.onFinish, Z = a.enqueue({
|
|
2620
|
+
freeText: i.value.freeText.trim(),
|
|
2621
|
+
promptId: g,
|
|
2622
|
+
autoMatch: S && g == null ? !0 : void 0,
|
|
1524
2623
|
showPanel: !0,
|
|
1525
|
-
onFinish:
|
|
2624
|
+
onFinish: Y
|
|
1526
2625
|
});
|
|
1527
|
-
|
|
1528
|
-
}
|
|
1529
|
-
return (
|
|
1530
|
-
const
|
|
1531
|
-
return
|
|
1532
|
-
modelValue:
|
|
1533
|
-
"onUpdate:modelValue":
|
|
1534
|
-
title:
|
|
2626
|
+
o.value ? l("submitted", Z) : (ie = (N = pe.options).onSubmitted) == null || ie.call(N, Z), y.value = !1, P.value = !1, de.success("已加入任务队列,可在任务面板查看进度");
|
|
2627
|
+
}
|
|
2628
|
+
return (S, g) => {
|
|
2629
|
+
const Y = Q("el-switch"), Z = Q("el-form-item"), N = Q("el-option"), ie = Q("el-select"), C = Q("el-input"), J = Q("el-form"), ne = Q("el-button"), le = Q("el-dialog");
|
|
2630
|
+
return r(), V(le, {
|
|
2631
|
+
modelValue: y.value,
|
|
2632
|
+
"onUpdate:modelValue": g[4] || (g[4] = (H) => y.value = H),
|
|
2633
|
+
title: m.value,
|
|
1535
2634
|
width: e.width,
|
|
1536
2635
|
"append-to-body": "",
|
|
1537
2636
|
class: "ai-use-dialog",
|
|
1538
|
-
onClosed:
|
|
1539
|
-
onOpen:
|
|
2637
|
+
onClosed: D,
|
|
2638
|
+
onOpen: z
|
|
1540
2639
|
}, {
|
|
1541
|
-
footer:
|
|
1542
|
-
|
|
1543
|
-
e.showTaskListButton ? (
|
|
2640
|
+
footer: v(() => [
|
|
2641
|
+
k("div", eo, [
|
|
2642
|
+
e.showTaskListButton ? (r(), V(ne, {
|
|
1544
2643
|
key: 0,
|
|
1545
2644
|
link: "",
|
|
1546
2645
|
type: "primary",
|
|
1547
|
-
onClick:
|
|
2646
|
+
onClick: G
|
|
1548
2647
|
}, {
|
|
1549
|
-
default:
|
|
1550
|
-
|
|
2648
|
+
default: v(() => [
|
|
2649
|
+
X(F(e.taskListButtonText), 1)
|
|
1551
2650
|
]),
|
|
1552
2651
|
_: 1
|
|
1553
|
-
})) :
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
onClick:
|
|
2652
|
+
})) : R("", !0),
|
|
2653
|
+
k("div", to, [
|
|
2654
|
+
h(ne, {
|
|
2655
|
+
onClick: g[3] || (g[3] = (H) => y.value = !1)
|
|
1557
2656
|
}, {
|
|
1558
|
-
default:
|
|
1559
|
-
|
|
2657
|
+
default: v(() => [...g[5] || (g[5] = [
|
|
2658
|
+
X("取消", -1)
|
|
1560
2659
|
])]),
|
|
1561
2660
|
_: 1
|
|
1562
2661
|
}),
|
|
1563
|
-
|
|
2662
|
+
h(ne, {
|
|
1564
2663
|
type: "primary",
|
|
1565
|
-
loading:
|
|
1566
|
-
onClick:
|
|
2664
|
+
loading: P.value,
|
|
2665
|
+
onClick: L
|
|
1567
2666
|
}, {
|
|
1568
|
-
default:
|
|
1569
|
-
|
|
2667
|
+
default: v(() => [
|
|
2668
|
+
X(F(e.submitText), 1)
|
|
1570
2669
|
]),
|
|
1571
2670
|
_: 1
|
|
1572
2671
|
}, 8, ["loading"])
|
|
1573
2672
|
])
|
|
1574
2673
|
])
|
|
1575
2674
|
]),
|
|
1576
|
-
default:
|
|
1577
|
-
|
|
1578
|
-
default:
|
|
1579
|
-
e.showAutoMatch ? (
|
|
2675
|
+
default: v(() => [
|
|
2676
|
+
h(J, { "label-position": "top" }, {
|
|
2677
|
+
default: v(() => [
|
|
2678
|
+
e.showAutoMatch ? (r(), V(Z, {
|
|
1580
2679
|
key: 0,
|
|
1581
2680
|
label: e.autoMatchLabel
|
|
1582
2681
|
}, {
|
|
1583
|
-
default:
|
|
1584
|
-
|
|
1585
|
-
modelValue:
|
|
1586
|
-
"onUpdate:modelValue":
|
|
2682
|
+
default: v(() => [
|
|
2683
|
+
h(Y, {
|
|
2684
|
+
modelValue: i.value.autoMatch,
|
|
2685
|
+
"onUpdate:modelValue": g[0] || (g[0] = (H) => i.value.autoMatch = H),
|
|
1587
2686
|
"active-text": "按需求自动选",
|
|
1588
2687
|
"inactive-text": "手动指定",
|
|
1589
|
-
onChange:
|
|
2688
|
+
onChange: B
|
|
1590
2689
|
}, null, 8, ["modelValue"])
|
|
1591
2690
|
]),
|
|
1592
2691
|
_: 1
|
|
1593
|
-
}, 8, ["label"])) :
|
|
1594
|
-
e.showPromptSelect ? (
|
|
2692
|
+
}, 8, ["label"])) : R("", !0),
|
|
2693
|
+
e.showPromptSelect ? (r(), V(Z, {
|
|
1595
2694
|
key: 1,
|
|
1596
2695
|
label: e.promptLabel,
|
|
1597
|
-
required: !
|
|
2696
|
+
required: !i.value.autoMatch
|
|
1598
2697
|
}, {
|
|
1599
|
-
default:
|
|
1600
|
-
|
|
1601
|
-
modelValue:
|
|
1602
|
-
"onUpdate:modelValue":
|
|
2698
|
+
default: v(() => [
|
|
2699
|
+
h(ie, {
|
|
2700
|
+
modelValue: i.value.promptId,
|
|
2701
|
+
"onUpdate:modelValue": g[1] || (g[1] = (H) => i.value.promptId = H),
|
|
1603
2702
|
filterable: "",
|
|
1604
2703
|
clearable: "",
|
|
1605
|
-
placeholder:
|
|
2704
|
+
placeholder: i.value.autoMatch ? "留空则自动匹配" : "请选择提示词",
|
|
1606
2705
|
style: { width: "100%" },
|
|
1607
|
-
loading:
|
|
2706
|
+
loading: M.value
|
|
1608
2707
|
}, {
|
|
1609
|
-
default:
|
|
1610
|
-
(
|
|
1611
|
-
key:
|
|
1612
|
-
label:
|
|
1613
|
-
value:
|
|
2708
|
+
default: v(() => [
|
|
2709
|
+
(r(!0), E(ce, null, me($.value, (H) => (r(), V(N, {
|
|
2710
|
+
key: H.id,
|
|
2711
|
+
label: H.name,
|
|
2712
|
+
value: H.id
|
|
1614
2713
|
}, null, 8, ["label", "value"]))), 128))
|
|
1615
2714
|
]),
|
|
1616
2715
|
_: 1
|
|
1617
2716
|
}, 8, ["modelValue", "placeholder", "loading"])
|
|
1618
2717
|
]),
|
|
1619
2718
|
_: 1
|
|
1620
|
-
}, 8, ["label", "required"])) :
|
|
1621
|
-
|
|
2719
|
+
}, 8, ["label", "required"])) : R("", !0),
|
|
2720
|
+
h(Z, {
|
|
1622
2721
|
label: e.freeTextLabel,
|
|
1623
2722
|
required: ""
|
|
1624
2723
|
}, {
|
|
1625
|
-
default:
|
|
1626
|
-
|
|
1627
|
-
modelValue:
|
|
1628
|
-
"onUpdate:modelValue":
|
|
2724
|
+
default: v(() => [
|
|
2725
|
+
h(C, {
|
|
2726
|
+
modelValue: i.value.freeText,
|
|
2727
|
+
"onUpdate:modelValue": g[2] || (g[2] = (H) => i.value.freeText = H),
|
|
1629
2728
|
type: "textarea",
|
|
1630
2729
|
rows: 4,
|
|
1631
2730
|
placeholder: e.freeTextPlaceholder
|
|
@@ -1641,104 +2740,104 @@ const Po = { class: "ai-use-dialog__footer" }, $o = { class: "ai-use-dialog__foo
|
|
|
1641
2740
|
}, 8, ["modelValue", "title", "width"]);
|
|
1642
2741
|
};
|
|
1643
2742
|
}
|
|
1644
|
-
}),
|
|
2743
|
+
}), lo = /* @__PURE__ */ he(no, [["__scopeId", "data-v-9aa82e83"]]), ao = { class: "ai-task-panel" }, oo = { class: "ai-task-panel__header" }, io = { class: "ai-task-panel__header-left" }, so = { class: "ai-task-panel__titles" }, ro = { class: "ai-task-panel__subtitle" }, uo = { class: "ai-task-panel__title" }, co = { class: "ai-task-panel__header-actions" }, fo = { class: "ai-task-panel__body" }, mo = {
|
|
1645
2744
|
key: 1,
|
|
1646
2745
|
class: "ai-task-list"
|
|
1647
|
-
},
|
|
2746
|
+
}, po = { class: "ai-task-row__icon" }, vo = { class: "ai-task-row__main" }, go = { class: "ai-task-row__title" }, yo = { class: "ai-task-row__meta" }, ho = { key: 0 }, _o = {
|
|
1648
2747
|
key: 0,
|
|
1649
2748
|
class: "ai-task-row__summary"
|
|
1650
|
-
},
|
|
2749
|
+
}, wo = { class: "ai-task-row__ops" }, bo = {
|
|
1651
2750
|
key: 0,
|
|
1652
2751
|
class: "ai-task-panel__footer"
|
|
1653
|
-
},
|
|
2752
|
+
}, ko = /* @__PURE__ */ oe({
|
|
1654
2753
|
__name: "AiTaskPanel",
|
|
1655
2754
|
emits: ["use"],
|
|
1656
2755
|
setup(e, { emit: n }) {
|
|
1657
|
-
const t = n,
|
|
2756
|
+
const t = n, l = kt(), a = x(null), o = {
|
|
1658
2757
|
pending: "等待中",
|
|
1659
2758
|
running: "执行中",
|
|
1660
2759
|
succeeded: "已完成",
|
|
1661
2760
|
failed: "失败",
|
|
1662
2761
|
cancelled: "已取消"
|
|
1663
2762
|
};
|
|
1664
|
-
function
|
|
1665
|
-
return
|
|
2763
|
+
function y(m) {
|
|
2764
|
+
return o[m] ?? m;
|
|
1666
2765
|
}
|
|
1667
|
-
async function
|
|
1668
|
-
|
|
2766
|
+
async function f(m) {
|
|
2767
|
+
a.value = m.id;
|
|
1669
2768
|
try {
|
|
1670
|
-
const
|
|
1671
|
-
if (!
|
|
2769
|
+
const i = m.result ?? await l.loadTaskResult(m.id);
|
|
2770
|
+
if (!i) return;
|
|
1672
2771
|
t("use", {
|
|
1673
|
-
taskId:
|
|
1674
|
-
runId:
|
|
1675
|
-
title:
|
|
1676
|
-
freeText:
|
|
1677
|
-
promptId:
|
|
1678
|
-
result:
|
|
1679
|
-
finishedAt:
|
|
2772
|
+
taskId: m.id,
|
|
2773
|
+
runId: m.runId,
|
|
2774
|
+
title: m.title,
|
|
2775
|
+
freeText: m.freeText,
|
|
2776
|
+
promptId: m.promptId,
|
|
2777
|
+
result: i,
|
|
2778
|
+
finishedAt: m.finishedAt ?? Date.now()
|
|
1680
2779
|
});
|
|
1681
2780
|
} finally {
|
|
1682
|
-
|
|
2781
|
+
a.value = null;
|
|
1683
2782
|
}
|
|
1684
2783
|
}
|
|
1685
|
-
return (
|
|
1686
|
-
const
|
|
1687
|
-
return
|
|
1688
|
-
|
|
1689
|
-
default:
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
class:
|
|
2784
|
+
return (m, i) => {
|
|
2785
|
+
const $ = Q("el-icon"), M = Q("el-button"), P = Q("el-empty"), K = Q("el-progress"), O = Q("el-badge");
|
|
2786
|
+
return r(), V(Tn, { to: "body" }, [
|
|
2787
|
+
h(Ot, { name: "ai-panel-slide" }, {
|
|
2788
|
+
default: v(() => [
|
|
2789
|
+
Ee(k("div", ao, [
|
|
2790
|
+
k("div", oo, [
|
|
2791
|
+
k("div", io, [
|
|
2792
|
+
k("div", {
|
|
2793
|
+
class: ye(["ai-task-panel__icon", { spinning: p(l).activeCount > 0 }])
|
|
1695
2794
|
}, [
|
|
1696
|
-
|
|
1697
|
-
default:
|
|
1698
|
-
|
|
2795
|
+
h($, null, {
|
|
2796
|
+
default: v(() => [
|
|
2797
|
+
h(p(Ct))
|
|
1699
2798
|
]),
|
|
1700
2799
|
_: 1
|
|
1701
2800
|
})
|
|
1702
2801
|
], 2),
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
2802
|
+
k("div", so, [
|
|
2803
|
+
k("div", ro, F(p(l).panelSubtitle), 1),
|
|
2804
|
+
k("div", uo, F(p(l).panelTitle), 1)
|
|
1706
2805
|
])
|
|
1707
2806
|
]),
|
|
1708
|
-
|
|
1709
|
-
|
|
2807
|
+
k("div", co, [
|
|
2808
|
+
p(l).runningCount > 0 ? (r(), V(M, {
|
|
1710
2809
|
key: 0,
|
|
1711
2810
|
link: "",
|
|
1712
2811
|
type: "primary",
|
|
1713
|
-
onClick:
|
|
2812
|
+
onClick: i[0] || (i[0] = (_) => p(l).cancelAll())
|
|
1714
2813
|
}, {
|
|
1715
|
-
default:
|
|
1716
|
-
|
|
2814
|
+
default: v(() => [...i[5] || (i[5] = [
|
|
2815
|
+
X(" 取消全部 ", -1)
|
|
1717
2816
|
])]),
|
|
1718
2817
|
_: 1
|
|
1719
|
-
})) :
|
|
1720
|
-
|
|
2818
|
+
})) : R("", !0),
|
|
2819
|
+
h(M, {
|
|
1721
2820
|
link: "",
|
|
1722
|
-
onClick:
|
|
2821
|
+
onClick: i[1] || (i[1] = (_) => p(l).toggleMinimize())
|
|
1723
2822
|
}, {
|
|
1724
|
-
default:
|
|
1725
|
-
|
|
1726
|
-
default:
|
|
1727
|
-
|
|
2823
|
+
default: v(() => [
|
|
2824
|
+
h($, null, {
|
|
2825
|
+
default: v(() => [
|
|
2826
|
+
h(p(Nt))
|
|
1728
2827
|
]),
|
|
1729
2828
|
_: 1
|
|
1730
2829
|
})
|
|
1731
2830
|
]),
|
|
1732
2831
|
_: 1
|
|
1733
2832
|
}),
|
|
1734
|
-
|
|
2833
|
+
h(M, {
|
|
1735
2834
|
link: "",
|
|
1736
|
-
onClick:
|
|
2835
|
+
onClick: i[2] || (i[2] = (_) => p(l).hidePanel())
|
|
1737
2836
|
}, {
|
|
1738
|
-
default:
|
|
1739
|
-
|
|
1740
|
-
default:
|
|
1741
|
-
|
|
2837
|
+
default: v(() => [
|
|
2838
|
+
h($, null, {
|
|
2839
|
+
default: v(() => [
|
|
2840
|
+
h(p(Rt))
|
|
1742
2841
|
]),
|
|
1743
2842
|
_: 1
|
|
1744
2843
|
})
|
|
@@ -1747,142 +2846,142 @@ const Po = { class: "ai-use-dialog__footer" }, $o = { class: "ai-use-dialog__foo
|
|
|
1747
2846
|
})
|
|
1748
2847
|
])
|
|
1749
2848
|
]),
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
(
|
|
1753
|
-
key:
|
|
2849
|
+
k("div", fo, [
|
|
2850
|
+
p(l).tasks.length ? (r(), E("div", mo, [
|
|
2851
|
+
(r(!0), E(ce, null, me(p(l).tasks, (_) => (r(), E("div", {
|
|
2852
|
+
key: _.id,
|
|
1754
2853
|
class: "ai-task-row"
|
|
1755
2854
|
}, [
|
|
1756
|
-
|
|
1757
|
-
|
|
2855
|
+
k("div", po, [
|
|
2856
|
+
_.status === "succeeded" ? (r(), V($, {
|
|
1758
2857
|
key: 0,
|
|
1759
2858
|
class: "ok"
|
|
1760
2859
|
}, {
|
|
1761
|
-
default:
|
|
1762
|
-
|
|
2860
|
+
default: v(() => [
|
|
2861
|
+
h(p(Mn))
|
|
1763
2862
|
]),
|
|
1764
2863
|
_: 1
|
|
1765
|
-
})) :
|
|
2864
|
+
})) : _.status === "failed" ? (r(), V($, {
|
|
1766
2865
|
key: 1,
|
|
1767
2866
|
class: "err"
|
|
1768
2867
|
}, {
|
|
1769
|
-
default:
|
|
1770
|
-
|
|
2868
|
+
default: v(() => [
|
|
2869
|
+
h(p(Dn))
|
|
1771
2870
|
]),
|
|
1772
2871
|
_: 1
|
|
1773
|
-
})) :
|
|
2872
|
+
})) : _.status === "running" || _.status === "pending" ? (r(), V(K, {
|
|
1774
2873
|
key: 2,
|
|
1775
2874
|
type: "circle",
|
|
1776
|
-
percentage:
|
|
2875
|
+
percentage: _.progress,
|
|
1777
2876
|
width: 36,
|
|
1778
2877
|
"stroke-width": 3
|
|
1779
|
-
}, null, 8, ["percentage"])) : (
|
|
2878
|
+
}, null, 8, ["percentage"])) : (r(), V($, {
|
|
1780
2879
|
key: 3,
|
|
1781
2880
|
class: "muted"
|
|
1782
2881
|
}, {
|
|
1783
|
-
default:
|
|
1784
|
-
|
|
2882
|
+
default: v(() => [
|
|
2883
|
+
h(p(Pn))
|
|
1785
2884
|
]),
|
|
1786
2885
|
_: 1
|
|
1787
2886
|
}))
|
|
1788
2887
|
]),
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
2888
|
+
k("div", vo, [
|
|
2889
|
+
k("div", go, F(_.title), 1),
|
|
2890
|
+
k("div", yo, [
|
|
2891
|
+
k("span", null, F(y(_.status)), 1),
|
|
2892
|
+
_.runId ? (r(), E("span", ho, " · #" + F(_.runId), 1)) : R("", !0)
|
|
1794
2893
|
]),
|
|
1795
|
-
|
|
2894
|
+
_.summary ? (r(), E("div", _o, F(_.summary), 1)) : R("", !0)
|
|
1796
2895
|
]),
|
|
1797
|
-
|
|
1798
|
-
|
|
2896
|
+
k("div", wo, [
|
|
2897
|
+
_.status === "running" || _.status === "pending" ? (r(), V(M, {
|
|
1799
2898
|
key: 0,
|
|
1800
2899
|
link: "",
|
|
1801
2900
|
type: "danger",
|
|
1802
2901
|
size: "small",
|
|
1803
|
-
onClick: (
|
|
2902
|
+
onClick: (z) => p(l).cancelTask(_.id)
|
|
1804
2903
|
}, {
|
|
1805
|
-
default:
|
|
1806
|
-
|
|
2904
|
+
default: v(() => [...i[6] || (i[6] = [
|
|
2905
|
+
X(" 取消 ", -1)
|
|
1807
2906
|
])]),
|
|
1808
2907
|
_: 1
|
|
1809
|
-
}, 8, ["onClick"])) :
|
|
1810
|
-
|
|
2908
|
+
}, 8, ["onClick"])) : R("", !0),
|
|
2909
|
+
_.status === "succeeded" && _.runId ? (r(), V(M, {
|
|
1811
2910
|
key: 1,
|
|
1812
2911
|
link: "",
|
|
1813
2912
|
type: "primary",
|
|
1814
2913
|
size: "small",
|
|
1815
|
-
loading:
|
|
1816
|
-
onClick: (
|
|
2914
|
+
loading: a.value === _.id,
|
|
2915
|
+
onClick: (z) => f(_)
|
|
1817
2916
|
}, {
|
|
1818
|
-
default:
|
|
1819
|
-
|
|
2917
|
+
default: v(() => [...i[7] || (i[7] = [
|
|
2918
|
+
X(" 使用 ", -1)
|
|
1820
2919
|
])]),
|
|
1821
2920
|
_: 1
|
|
1822
|
-
}, 8, ["loading", "onClick"])) :
|
|
1823
|
-
|
|
2921
|
+
}, 8, ["loading", "onClick"])) : R("", !0),
|
|
2922
|
+
_.status !== "running" && _.status !== "pending" ? (r(), V(M, {
|
|
1824
2923
|
key: 2,
|
|
1825
2924
|
link: "",
|
|
1826
2925
|
size: "small",
|
|
1827
|
-
onClick: (
|
|
2926
|
+
onClick: (z) => p(l).removeTask(_.id)
|
|
1828
2927
|
}, {
|
|
1829
|
-
default:
|
|
1830
|
-
|
|
2928
|
+
default: v(() => [...i[8] || (i[8] = [
|
|
2929
|
+
X(" 移除 ", -1)
|
|
1831
2930
|
])]),
|
|
1832
2931
|
_: 1
|
|
1833
|
-
}, 8, ["onClick"])) :
|
|
2932
|
+
}, 8, ["onClick"])) : R("", !0)
|
|
1834
2933
|
])
|
|
1835
2934
|
]))), 128))
|
|
1836
|
-
])) : (
|
|
2935
|
+
])) : (r(), V(P, {
|
|
1837
2936
|
key: 0,
|
|
1838
2937
|
description: "暂无 AI 任务",
|
|
1839
2938
|
"image-size": 64
|
|
1840
2939
|
}))
|
|
1841
2940
|
]),
|
|
1842
|
-
|
|
1843
|
-
|
|
2941
|
+
p(l).tasks.some((_) => _.status !== "running" && _.status !== "pending") ? (r(), E("div", bo, [
|
|
2942
|
+
h(M, {
|
|
1844
2943
|
link: "",
|
|
1845
2944
|
type: "info",
|
|
1846
|
-
onClick:
|
|
2945
|
+
onClick: i[3] || (i[3] = (_) => p(l).clearFinished())
|
|
1847
2946
|
}, {
|
|
1848
|
-
default:
|
|
1849
|
-
|
|
2947
|
+
default: v(() => [...i[9] || (i[9] = [
|
|
2948
|
+
X("清除已完成", -1)
|
|
1850
2949
|
])]),
|
|
1851
2950
|
_: 1
|
|
1852
2951
|
})
|
|
1853
|
-
])) :
|
|
2952
|
+
])) : R("", !0)
|
|
1854
2953
|
], 512), [
|
|
1855
|
-
[
|
|
2954
|
+
[ot, p(l).panelVisible && !p(l).panelMinimized]
|
|
1856
2955
|
])
|
|
1857
2956
|
]),
|
|
1858
2957
|
_: 1
|
|
1859
2958
|
}),
|
|
1860
|
-
|
|
2959
|
+
Ee(k("div", {
|
|
1861
2960
|
class: "ai-task-panel-mini",
|
|
1862
|
-
onClick:
|
|
2961
|
+
onClick: i[4] || (i[4] = (_) => p(l).toggleMinimize())
|
|
1863
2962
|
}, [
|
|
1864
|
-
|
|
2963
|
+
p(l).activeCount > 0 ? (r(), V($, {
|
|
1865
2964
|
key: 0,
|
|
1866
2965
|
class: "spinning"
|
|
1867
2966
|
}, {
|
|
1868
|
-
default:
|
|
1869
|
-
|
|
2967
|
+
default: v(() => [
|
|
2968
|
+
h(p(Ct))
|
|
1870
2969
|
]),
|
|
1871
2970
|
_: 1
|
|
1872
|
-
})) :
|
|
1873
|
-
|
|
1874
|
-
|
|
2971
|
+
})) : R("", !0),
|
|
2972
|
+
k("span", null, F(p(l).panelSubtitle), 1),
|
|
2973
|
+
p(l).runningCount > 0 ? (r(), V(O, {
|
|
1875
2974
|
key: 1,
|
|
1876
|
-
value:
|
|
2975
|
+
value: p(l).runningCount,
|
|
1877
2976
|
class: "m-l-8"
|
|
1878
|
-
}, null, 8, ["value"])) :
|
|
2977
|
+
}, null, 8, ["value"])) : R("", !0)
|
|
1879
2978
|
], 512), [
|
|
1880
|
-
[
|
|
2979
|
+
[ot, p(l).panelVisible && p(l).panelMinimized]
|
|
1881
2980
|
])
|
|
1882
2981
|
]);
|
|
1883
2982
|
};
|
|
1884
2983
|
}
|
|
1885
|
-
}),
|
|
2984
|
+
}), To = /* @__PURE__ */ he(ko, [["__scopeId", "data-v-812b3127"]]), Zo = /* @__PURE__ */ oe({
|
|
1886
2985
|
__name: "AiTaskProvider",
|
|
1887
2986
|
props: {
|
|
1888
2987
|
title: {},
|
|
@@ -1905,10 +3004,10 @@ const Po = { class: "ai-use-dialog__footer" }, $o = { class: "ai-use-dialog__foo
|
|
|
1905
3004
|
},
|
|
1906
3005
|
emits: ["finish", "use"],
|
|
1907
3006
|
setup(e, { emit: n }) {
|
|
1908
|
-
const t = e,
|
|
1909
|
-
|
|
1910
|
-
const
|
|
1911
|
-
const
|
|
3007
|
+
const t = e, l = n, a = cn();
|
|
3008
|
+
je(sn, a), je(on, ln(a));
|
|
3009
|
+
const o = I(() => {
|
|
3010
|
+
const m = {
|
|
1912
3011
|
title: t.title,
|
|
1913
3012
|
freeText: t.freeText,
|
|
1914
3013
|
promptId: t.promptId,
|
|
@@ -1925,61 +3024,61 @@ const Po = { class: "ai-use-dialog__footer" }, $o = { class: "ai-use-dialog__foo
|
|
|
1925
3024
|
taskListButtonText: t.taskListButtonText,
|
|
1926
3025
|
width: t.width
|
|
1927
3026
|
};
|
|
1928
|
-
return t.modelValue !== void 0 && (
|
|
3027
|
+
return t.modelValue !== void 0 && (m.modelValue = t.modelValue), m;
|
|
1929
3028
|
});
|
|
1930
|
-
let
|
|
1931
|
-
function
|
|
1932
|
-
|
|
1933
|
-
}
|
|
1934
|
-
return
|
|
1935
|
-
|
|
1936
|
-
}),
|
|
1937
|
-
|
|
1938
|
-
}), (
|
|
1939
|
-
e.showDialog !== !1 ? (
|
|
1940
|
-
|
|
1941
|
-
|
|
3029
|
+
let y;
|
|
3030
|
+
function f(m) {
|
|
3031
|
+
l("use", m);
|
|
3032
|
+
}
|
|
3033
|
+
return Me(() => {
|
|
3034
|
+
a.hydrate(), y = a.onTaskFinish((m) => l("finish", m));
|
|
3035
|
+
}), pt(() => {
|
|
3036
|
+
y == null || y();
|
|
3037
|
+
}), (m, i) => (r(), E(ce, null, [
|
|
3038
|
+
e.showDialog !== !1 ? (r(), V(lo, Lt(Ge({ key: 0 }, o.value)), null, 16)) : R("", !0),
|
|
3039
|
+
h(To, { onUse: f }),
|
|
3040
|
+
ee(m.$slots, "default")
|
|
1942
3041
|
], 64));
|
|
1943
3042
|
}
|
|
1944
3043
|
});
|
|
1945
|
-
function
|
|
1946
|
-
const e =
|
|
1947
|
-
return e || kt(
|
|
3044
|
+
function ei() {
|
|
3045
|
+
const e = qe(on, null);
|
|
3046
|
+
return e || ln(kt());
|
|
1948
3047
|
}
|
|
1949
|
-
function
|
|
1950
|
-
const e =
|
|
3048
|
+
function So() {
|
|
3049
|
+
const e = x(!1), n = x({});
|
|
1951
3050
|
let t = null;
|
|
1952
|
-
function
|
|
1953
|
-
t == null || t.resolve(
|
|
3051
|
+
function l(f) {
|
|
3052
|
+
t == null || t.resolve(f), t = null;
|
|
1954
3053
|
}
|
|
1955
|
-
function
|
|
1956
|
-
t == null || t.reject(new
|
|
3054
|
+
function a() {
|
|
3055
|
+
t == null || t.reject(new We()), t = null;
|
|
1957
3056
|
}
|
|
1958
|
-
function
|
|
1959
|
-
t && (t.reject(new
|
|
1960
|
-
const
|
|
1961
|
-
t = { resolve:
|
|
3057
|
+
function o(f = {}) {
|
|
3058
|
+
t && (t.reject(new We()), t = null);
|
|
3059
|
+
const m = new Promise((i, $) => {
|
|
3060
|
+
t = { resolve: i, reject: $ };
|
|
1962
3061
|
});
|
|
1963
|
-
return n.value = { ...
|
|
3062
|
+
return n.value = { ...f }, e.value = !0, m;
|
|
1964
3063
|
}
|
|
1965
|
-
function
|
|
3064
|
+
function y() {
|
|
1966
3065
|
e.value = !1;
|
|
1967
3066
|
}
|
|
1968
3067
|
return {
|
|
1969
3068
|
dialogVisible: e,
|
|
1970
3069
|
dialogOptions: n,
|
|
1971
|
-
openImageSelector:
|
|
1972
|
-
closeImageSelector:
|
|
1973
|
-
settlePendingConfirm:
|
|
1974
|
-
settlePendingCancel:
|
|
3070
|
+
openImageSelector: o,
|
|
3071
|
+
closeImageSelector: y,
|
|
3072
|
+
settlePendingConfirm: l,
|
|
3073
|
+
settlePendingCancel: a
|
|
1975
3074
|
};
|
|
1976
3075
|
}
|
|
1977
|
-
const
|
|
1978
|
-
function
|
|
3076
|
+
const Co = "__YC_IMAGE_SELECTOR_CTX_KEY__";
|
|
3077
|
+
function Io(e) {
|
|
1979
3078
|
const n = globalThis;
|
|
1980
3079
|
return n[e] || (n[e] = Symbol(e)), n[e];
|
|
1981
3080
|
}
|
|
1982
|
-
const
|
|
3081
|
+
const dn = Io(Co), ti = /* @__PURE__ */ oe({
|
|
1983
3082
|
__name: "YcImageSelectorProvider",
|
|
1984
3083
|
props: {
|
|
1985
3084
|
modelValue: { type: [Boolean, null] },
|
|
@@ -2000,115 +3099,165 @@ const Lt = nl(tl), pl = /* @__PURE__ */ ue({
|
|
|
2000
3099
|
cancelText: { default: "取消" },
|
|
2001
3100
|
emptyText: { default: "暂无图片资源" },
|
|
2002
3101
|
renderEmpty: {},
|
|
2003
|
-
renderFooterExtra: {},
|
|
2004
3102
|
getImages: {},
|
|
2005
3103
|
upload: {},
|
|
2006
3104
|
urlField: { default: "url" },
|
|
2007
3105
|
showDialog: { type: Boolean, default: !0 }
|
|
2008
3106
|
},
|
|
2009
3107
|
setup(e, { expose: n }) {
|
|
2010
|
-
const t = e,
|
|
2011
|
-
dialogVisible:
|
|
2012
|
-
dialogOptions:
|
|
2013
|
-
openImageSelector:
|
|
2014
|
-
closeImageSelector:
|
|
2015
|
-
settlePendingConfirm:
|
|
2016
|
-
settlePendingCancel:
|
|
2017
|
-
} =
|
|
2018
|
-
|
|
2019
|
-
function
|
|
2020
|
-
return
|
|
2021
|
-
}
|
|
2022
|
-
const
|
|
2023
|
-
title:
|
|
2024
|
-
multiple:
|
|
2025
|
-
maxCount:
|
|
2026
|
-
selected:
|
|
3108
|
+
const t = e, l = So(), {
|
|
3109
|
+
dialogVisible: a,
|
|
3110
|
+
dialogOptions: o,
|
|
3111
|
+
openImageSelector: y,
|
|
3112
|
+
closeImageSelector: f,
|
|
3113
|
+
settlePendingConfirm: m,
|
|
3114
|
+
settlePendingCancel: i
|
|
3115
|
+
} = l;
|
|
3116
|
+
je(dn, l);
|
|
3117
|
+
function $(O, _) {
|
|
3118
|
+
return O in o.value ? o.value[O] : _;
|
|
3119
|
+
}
|
|
3120
|
+
const M = I(() => ({
|
|
3121
|
+
title: $("title", t.title),
|
|
3122
|
+
multiple: $("multiple", t.multiple),
|
|
3123
|
+
maxCount: $("maxCount", t.maxCount),
|
|
3124
|
+
selected: $("selected", t.selected),
|
|
2027
3125
|
width: t.width,
|
|
2028
3126
|
pageSize: t.pageSize,
|
|
2029
3127
|
showUpload: t.showUpload,
|
|
2030
3128
|
accept: t.accept,
|
|
2031
|
-
showCategories:
|
|
2032
|
-
categories:
|
|
2033
|
-
categoryAllLabel:
|
|
2034
|
-
showModeSwitch:
|
|
2035
|
-
confirmOnSelect:
|
|
3129
|
+
showCategories: $("showCategories", t.showCategories),
|
|
3130
|
+
categories: $("categories", t.categories),
|
|
3131
|
+
categoryAllLabel: $("categoryAllLabel", t.categoryAllLabel),
|
|
3132
|
+
showModeSwitch: $("showModeSwitch", t.showModeSwitch),
|
|
3133
|
+
confirmOnSelect: $("confirmOnSelect", t.confirmOnSelect),
|
|
2036
3134
|
confirmText: t.confirmText,
|
|
2037
3135
|
cancelText: t.cancelText,
|
|
2038
3136
|
emptyText: t.emptyText,
|
|
2039
3137
|
renderEmpty: t.renderEmpty,
|
|
2040
|
-
renderFooterExtra: t.renderFooterExtra,
|
|
2041
3138
|
getImages: t.getImages,
|
|
2042
3139
|
upload: t.upload,
|
|
2043
3140
|
urlField: t.urlField
|
|
2044
3141
|
}));
|
|
2045
|
-
function
|
|
2046
|
-
var
|
|
2047
|
-
(
|
|
3142
|
+
function P(O) {
|
|
3143
|
+
var _, z;
|
|
3144
|
+
(z = (_ = o.value).onConfirm) == null || z.call(_, O), m(O), f();
|
|
2048
3145
|
}
|
|
2049
|
-
function
|
|
2050
|
-
var
|
|
2051
|
-
(
|
|
3146
|
+
function K() {
|
|
3147
|
+
var O, _;
|
|
3148
|
+
(_ = (O = o.value).onCancel) == null || _.call(O), i(), f();
|
|
2052
3149
|
}
|
|
2053
|
-
return n({ openImageSelector:
|
|
2054
|
-
e.showDialog !== !1 ? (
|
|
3150
|
+
return n({ openImageSelector: y, closeImageSelector: f }), (O, _) => (r(), E(ce, null, [
|
|
3151
|
+
e.showDialog !== !1 ? (r(), V(qt, Ge({
|
|
2055
3152
|
key: 0,
|
|
2056
|
-
modelValue:
|
|
2057
|
-
"onUpdate:modelValue":
|
|
2058
|
-
},
|
|
2059
|
-
onConfirm:
|
|
2060
|
-
onCancel:
|
|
2061
|
-
}), null, 16, ["modelValue"])) :
|
|
2062
|
-
|
|
3153
|
+
modelValue: p(a),
|
|
3154
|
+
"onUpdate:modelValue": _[0] || (_[0] = (z) => Sn(a) ? a.value = z : null)
|
|
3155
|
+
}, M.value, {
|
|
3156
|
+
onConfirm: P,
|
|
3157
|
+
onCancel: K
|
|
3158
|
+
}), null, 16, ["modelValue"])) : R("", !0),
|
|
3159
|
+
ee(O.$slots, "default")
|
|
2063
3160
|
], 64));
|
|
2064
3161
|
}
|
|
2065
3162
|
});
|
|
2066
|
-
function
|
|
2067
|
-
const e =
|
|
3163
|
+
function ni() {
|
|
3164
|
+
const e = qe(dn, null);
|
|
2068
3165
|
return e ? {
|
|
2069
3166
|
openImageSelector: (n = {}) => e.openImageSelector(n),
|
|
2070
3167
|
closeImageSelector: () => e.closeImageSelector()
|
|
2071
3168
|
} : {
|
|
2072
|
-
openImageSelector:
|
|
2073
|
-
closeImageSelector:
|
|
3169
|
+
openImageSelector: Gt,
|
|
3170
|
+
closeImageSelector: Ht
|
|
2074
3171
|
};
|
|
2075
3172
|
}
|
|
3173
|
+
async function li(e) {
|
|
3174
|
+
try {
|
|
3175
|
+
return await ht.confirm(e.message, e.title ?? "提示", {
|
|
3176
|
+
type: e.type ?? "warning",
|
|
3177
|
+
confirmButtonText: e.confirmText ?? "确定",
|
|
3178
|
+
cancelButtonText: e.cancelText ?? "取消",
|
|
3179
|
+
closeOnClickModal: !1
|
|
3180
|
+
}), !0;
|
|
3181
|
+
} catch {
|
|
3182
|
+
return !1;
|
|
3183
|
+
}
|
|
3184
|
+
}
|
|
3185
|
+
async function ai(e) {
|
|
3186
|
+
try {
|
|
3187
|
+
const { value: n } = await ht.prompt(e.message, e.title ?? "请输入", {
|
|
3188
|
+
inputType: e.inputType ?? "text",
|
|
3189
|
+
inputPlaceholder: e.placeholder,
|
|
3190
|
+
inputValue: e.defaultValue ?? "",
|
|
3191
|
+
confirmButtonText: e.confirmText ?? "确定",
|
|
3192
|
+
cancelButtonText: e.cancelText ?? "取消",
|
|
3193
|
+
closeOnClickModal: !1
|
|
3194
|
+
});
|
|
3195
|
+
return n ?? "";
|
|
3196
|
+
} catch {
|
|
3197
|
+
return null;
|
|
3198
|
+
}
|
|
3199
|
+
}
|
|
2076
3200
|
export {
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
3201
|
+
To as AiTaskPanel,
|
|
3202
|
+
Zo as AiTaskProvider,
|
|
3203
|
+
lo as AiUseDialog,
|
|
3204
|
+
dn as IMAGE_SELECTOR_INJECT_KEY,
|
|
3205
|
+
xt as ImageSelectorAuthError,
|
|
3206
|
+
We as ImageSelectorCancelledError,
|
|
3207
|
+
qt as ImageSelectorDialog,
|
|
3208
|
+
ti as ImageSelectorProvider,
|
|
3209
|
+
ut as PERMISSION_KEY,
|
|
3210
|
+
Dt as SkyPageWindow,
|
|
3211
|
+
To as YcAiTaskPanel,
|
|
3212
|
+
Zo as YcAiTaskProvider,
|
|
3213
|
+
lo as YcAiUseDialog,
|
|
3214
|
+
Ul as YcButton,
|
|
3215
|
+
Xo as YcComponent,
|
|
3216
|
+
Ea as YcDescriptions,
|
|
3217
|
+
Ta as YcDrawer,
|
|
3218
|
+
qt as YcImageSelectorDialog,
|
|
3219
|
+
ti as YcImageSelectorProvider,
|
|
3220
|
+
jl as YcPage,
|
|
3221
|
+
Dt as YcPageWindow,
|
|
3222
|
+
ga as YcPermission,
|
|
3223
|
+
Jl as YcSearchForm,
|
|
3224
|
+
va as YcStatusTag,
|
|
3225
|
+
pa as YcTable,
|
|
3226
|
+
xa as YcUpload,
|
|
3227
|
+
Ht as closeImageSelector,
|
|
3228
|
+
Ho as configureUi,
|
|
3229
|
+
So as createImageSelectorApi,
|
|
3230
|
+
Ll as createPermissionStore,
|
|
3231
|
+
Xo as default,
|
|
3232
|
+
Cl as fetchImages,
|
|
3233
|
+
Xl as formatDateTime,
|
|
3234
|
+
Zt as getActivePermissionStore,
|
|
3235
|
+
Kt as getAiTaskConfig,
|
|
3236
|
+
Je as getImageSelectorConfig,
|
|
3237
|
+
we as getUiConfig,
|
|
3238
|
+
nn as hideAiDialog,
|
|
3239
|
+
Wt as hideImageSelectorDialog,
|
|
3240
|
+
xl as installImageSelector,
|
|
3241
|
+
Ma as installYcComponent,
|
|
3242
|
+
Za as listPrompts,
|
|
3243
|
+
Qt as normalizePermission,
|
|
3244
|
+
Qo as openAiUseDialog,
|
|
3245
|
+
Gt as openImageSelector,
|
|
3246
|
+
_a as permissionDirective,
|
|
3247
|
+
qo as providePermission,
|
|
3248
|
+
Go as resetUiConfig,
|
|
3249
|
+
Ol as resolvePermissionStore,
|
|
3250
|
+
Jo as setActivePermissionStore,
|
|
3251
|
+
jn as setAiTaskConfig,
|
|
3252
|
+
qn as setImageSelectorConfig,
|
|
3253
|
+
bt as showAiDialog,
|
|
3254
|
+
Zn as showImageSelectorDialog,
|
|
3255
|
+
Il as uploadImage,
|
|
3256
|
+
ei as useAiTask,
|
|
3257
|
+
cn as useAiTaskStore,
|
|
3258
|
+
ni as useImageSelector,
|
|
3259
|
+
wt as usePermission,
|
|
3260
|
+
_a as vPermission,
|
|
3261
|
+
li as ycConfirm,
|
|
3262
|
+
ai as ycPrompt
|
|
2114
3263
|
};
|