@glodon-aiot/agent-cli-ui 3.3.2-beta.15 → 3.3.2-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/AgentClientUI.mjs +119 -109
- package/dist/es/Dialog/AgentChat/HistoryItem/index.mjs +1 -1
- package/dist/es/Dialog/AgentChat/index.mjs +282 -269
- package/dist/es/Dialog/SessionList/index.mjs +35 -34
- package/dist/es/Dialog/index.mjs +101 -94
- package/dist/es/ReactTextGenerationUI/components/TextSiders/index.mjs +124 -120
- package/dist/es/components/FilePreview/index.mjs +26 -25
- package/dist/es/index.mjs +238 -211
- package/dist/es/packages/agent-cli-ui/package.json.mjs +3 -3
- package/dist/es/packages/react-components/dist/es/index.mjs +1 -1
- package/dist/es/src/style.css +1 -1
- package/dist/es/src/style10.css +1 -1
- package/dist/es/src/style11.css +1 -1
- package/dist/es/src/style12.css +1 -1
- package/dist/es/src/style13.css +1 -1
- package/dist/es/src/style14.css +1 -1
- package/dist/es/src/style15.css +1 -1
- package/dist/es/src/style16.css +1 -1
- package/dist/es/src/style17.css +1 -1
- package/dist/es/src/style18.css +1 -1
- package/dist/es/src/style19.css +1 -1
- package/dist/es/src/style20.css +1 -1
- package/dist/es/src/style21.css +1 -1
- package/dist/es/src/style22.css +1 -1
- package/dist/es/src/style23.css +1 -1
- package/dist/es/src/style24.css +1 -1
- package/dist/es/src/style25.css +1 -1
- package/dist/es/src/style26.css +1 -1
- package/dist/es/src/style27.css +1 -1
- package/dist/es/src/style28.css +1 -1
- package/dist/es/src/style29.css +1 -1
- package/dist/es/src/style3.css +1 -1
- package/dist/es/src/style30.css +1 -1
- package/dist/es/src/style31.css +1 -1
- package/dist/es/src/style5.css +1 -1
- package/dist/es/src/style6.css +1 -1
- package/dist/es/src/style7.css +1 -1
- package/dist/es/src/style8.css +1 -1
- package/dist/es/src/style9.css +1 -1
- package/dist/lib/index.css +1 -1
- package/dist/lib/index.js +30 -30
- package/dist/src/AgentClientUI.d.ts +10 -2
- package/dist/src/Dialog/SessionList/index.d.ts +1 -0
- package/dist/src/Dialog/index.d.ts +9 -1
- package/dist/src/index.d.ts +7 -2
- package/dist/src/types.d.ts +2 -1
- package/package.json +3 -3
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
var me = Object.defineProperty, ue = Object.defineProperties;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var
|
|
10
|
-
he.call(l,
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
var x = (
|
|
2
|
+
var fe = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var $ = Object.getOwnPropertySymbols;
|
|
4
|
+
var ge = Object.prototype.hasOwnProperty, he = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var j = (s, l, r) => l in s ? me(s, l, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[l] = r, S = (s, l) => {
|
|
6
|
+
for (var r in l || (l = {}))
|
|
7
|
+
ge.call(l, r) && j(s, r, l[r]);
|
|
8
|
+
if ($)
|
|
9
|
+
for (var r of $(l))
|
|
10
|
+
he.call(l, r) && j(s, r, l[r]);
|
|
11
|
+
return s;
|
|
12
|
+
}, z = (s, l) => ue(s, fe(l));
|
|
13
|
+
var A = (s, l, r) => new Promise((C, N) => {
|
|
14
|
+
var x = (f) => {
|
|
15
15
|
try {
|
|
16
|
-
|
|
17
|
-
} catch (
|
|
18
|
-
N(
|
|
16
|
+
I(r.next(f));
|
|
17
|
+
} catch (y) {
|
|
18
|
+
N(y);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, p = (f) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
23
|
-
} catch (
|
|
24
|
-
N(
|
|
22
|
+
I(r.throw(f));
|
|
23
|
+
} catch (y) {
|
|
24
|
+
N(y);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, I = (f) => f.done ? C(f.value) : Promise.resolve(f.value).then(x, p);
|
|
27
|
+
I((r = r.apply(s, l)).next());
|
|
28
28
|
});
|
|
29
|
-
import { jsxs as v, jsx as o, Fragment as
|
|
30
|
-
import { useState as
|
|
31
|
-
import { Form as
|
|
29
|
+
import { jsxs as v, jsx as o, Fragment as Ie } from "react/jsx-runtime";
|
|
30
|
+
import { useState as u, useRef as ye, useContext as ke, useEffect as b } from "react";
|
|
31
|
+
import { Form as R, Space as ve, Button as E, Input as J, message as q, notification as xe } from "antd";
|
|
32
32
|
import { v4 as Ce } from "uuid";
|
|
33
|
-
import
|
|
33
|
+
import we from "../../../context.mjs";
|
|
34
34
|
import U from "../../../components/Iconfont/index.mjs";
|
|
35
|
-
import
|
|
35
|
+
import Se from "../../../components/KnowledgeList/KnowledgeSelect/index.mjs";
|
|
36
36
|
import "../../../packages/react-components/dist/es/index.mjs";
|
|
37
|
-
import
|
|
38
|
-
import
|
|
37
|
+
import be from "../../../Dialog/AgentChat/HistoryItem/SessionRefer/index.mjs";
|
|
38
|
+
import Ne from "../../../node_modules/moment/dist/moment.mjs";
|
|
39
39
|
/* empty css */import { fetchEventSource as pe } from "../fetchEventSource/fetch.mjs";
|
|
40
|
-
import { Markdown as
|
|
41
|
-
const
|
|
42
|
-
application:
|
|
40
|
+
import { Markdown as Te } from "../../../packages/react-components/dist/es/components/Markdown/index.mjs";
|
|
41
|
+
const ze = ({
|
|
42
|
+
application: s,
|
|
43
43
|
sessionId: l
|
|
44
44
|
}) => {
|
|
45
|
-
const
|
|
46
|
-
service:
|
|
45
|
+
const r = s.id, [C, N] = u(""), [x, p] = u(""), [I, f] = u(), [y, w] = u(!1), B = ye(null), [D, W] = u([]), [T, H] = u([]), [G, K] = u(0), [Q, O] = u(), [c, P] = u(), [Y] = R.useForm(), [M, X] = u(!1), [V, Z] = u({}), [_, ee] = u(0), {
|
|
46
|
+
service: g,
|
|
47
47
|
agentClient: k,
|
|
48
|
-
beforeMessageSend:
|
|
49
|
-
popupContainer:
|
|
50
|
-
icon:
|
|
48
|
+
beforeMessageSend: Ae,
|
|
49
|
+
popupContainer: F,
|
|
50
|
+
icon: Pe,
|
|
51
51
|
token: ne,
|
|
52
52
|
apiUrl: te
|
|
53
|
-
} = ke(
|
|
53
|
+
} = ke(we), re = (n, a, m, e) => {
|
|
54
54
|
const t = {
|
|
55
55
|
messageId: Ce(),
|
|
56
56
|
content: "",
|
|
@@ -60,7 +60,7 @@ const Ee = ({
|
|
|
60
60
|
messageTime: "",
|
|
61
61
|
llmModel: "",
|
|
62
62
|
searchReference: []
|
|
63
|
-
},
|
|
63
|
+
}, d = z(S({}, m), {
|
|
64
64
|
stream: !0
|
|
65
65
|
});
|
|
66
66
|
pe(`${te}/chat/v2/chat?applicationId=${n}&sessionId=${a}`, {
|
|
@@ -69,30 +69,30 @@ const Ee = ({
|
|
|
69
69
|
Authorization: `Bearer ${ne}`,
|
|
70
70
|
"Content-Type": "application/json"
|
|
71
71
|
},
|
|
72
|
-
body: JSON.stringify(
|
|
72
|
+
body: JSON.stringify(d),
|
|
73
73
|
openWhenHidden: !0,
|
|
74
|
-
onopen(
|
|
75
|
-
return console.log("onopen"),
|
|
74
|
+
onopen(i) {
|
|
75
|
+
return console.log("onopen"), i.ok && e != null && e.onopen && e.onopen(), Promise.resolve();
|
|
76
76
|
},
|
|
77
|
-
onmessage(
|
|
78
|
-
if (!
|
|
77
|
+
onmessage(i) {
|
|
78
|
+
if (!i.id && !i.data && !i.event && !i.retry)
|
|
79
79
|
return;
|
|
80
|
-
if (!
|
|
81
|
-
t.content = t.content +
|
|
82
|
-
const
|
|
80
|
+
if (!i.data.includes('{"code": ')) {
|
|
81
|
+
t.content = t.content + i.data;
|
|
82
|
+
const L = {
|
|
83
83
|
content: t.content,
|
|
84
84
|
role: 1,
|
|
85
85
|
reference: t.reference,
|
|
86
86
|
messageId: t.messageId,
|
|
87
87
|
sessionId: a,
|
|
88
|
-
messageTime:
|
|
88
|
+
messageTime: Ne(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"),
|
|
89
89
|
searchReference: []
|
|
90
90
|
};
|
|
91
|
-
return (e == null ? void 0 : e.onmessage) && e.onmessage(
|
|
91
|
+
return (e == null ? void 0 : e.onmessage) && e.onmessage(L);
|
|
92
92
|
}
|
|
93
|
-
const
|
|
94
|
-
if (t.reference =
|
|
95
|
-
const
|
|
93
|
+
const h = JSON.parse(i.data);
|
|
94
|
+
if (t.reference = h.data.reference, t.messageTime = h.data.messageTime, t.messageId = h.data.messageId, t.llmModel = h.data.llmModel, t.content = h.data.content, t.code = h.code, h.code === 200) {
|
|
95
|
+
const L = {
|
|
96
96
|
code: t.code,
|
|
97
97
|
content: t.content,
|
|
98
98
|
role: 1,
|
|
@@ -102,10 +102,10 @@ const Ee = ({
|
|
|
102
102
|
messageTime: t.messageTime,
|
|
103
103
|
searchReference: []
|
|
104
104
|
};
|
|
105
|
-
e != null && e.onmessage && e.onmessage(
|
|
105
|
+
e != null && e.onmessage && e.onmessage(L);
|
|
106
106
|
} else
|
|
107
107
|
return xe.error({
|
|
108
|
-
message:
|
|
108
|
+
message: h.message
|
|
109
109
|
});
|
|
110
110
|
},
|
|
111
111
|
onerror() {
|
|
@@ -113,7 +113,7 @@ const Ee = ({
|
|
|
113
113
|
},
|
|
114
114
|
onclose() {
|
|
115
115
|
console.log("onclose");
|
|
116
|
-
const
|
|
116
|
+
const i = {
|
|
117
117
|
code: t.code,
|
|
118
118
|
content: t.content,
|
|
119
119
|
role: 1,
|
|
@@ -126,98 +126,102 @@ const Ee = ({
|
|
|
126
126
|
},
|
|
127
127
|
searchReference: []
|
|
128
128
|
};
|
|
129
|
-
e != null && e.onclose && e.onclose(
|
|
129
|
+
e != null && e.onclose && e.onclose(i);
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
132
|
};
|
|
133
133
|
b(() => {
|
|
134
|
-
if (!(
|
|
134
|
+
if (!(s != null && s.id))
|
|
135
135
|
return;
|
|
136
|
-
const n =
|
|
136
|
+
const n = s.arrange;
|
|
137
137
|
if (!(n != null && n.length))
|
|
138
138
|
return;
|
|
139
|
-
const
|
|
140
|
-
W(
|
|
141
|
-
const e =
|
|
139
|
+
const m = n[0].knowledges || [];
|
|
140
|
+
W(m), K(m.length);
|
|
141
|
+
const e = m.map((t) => t.id);
|
|
142
142
|
H(e);
|
|
143
|
-
}, [
|
|
144
|
-
if (!(
|
|
143
|
+
}, [s]), b(() => {
|
|
144
|
+
if (!(s != null && s.id) || !k)
|
|
145
145
|
return;
|
|
146
146
|
const n = k.questionContextMaxLength || 4e3;
|
|
147
|
-
ee(n),
|
|
148
|
-
}, [
|
|
149
|
-
const
|
|
150
|
-
if (!
|
|
147
|
+
ee(n), se();
|
|
148
|
+
}, [s, k]);
|
|
149
|
+
const se = () => A(void 0, null, function* () {
|
|
150
|
+
if (!g || !r)
|
|
151
151
|
return;
|
|
152
|
-
const n = yield
|
|
152
|
+
const n = yield g.postApplicationIdSession({
|
|
153
153
|
name: "AI 会话",
|
|
154
|
-
applicationId:
|
|
154
|
+
applicationId: r
|
|
155
155
|
});
|
|
156
156
|
debugger;
|
|
157
|
-
|
|
157
|
+
O(n);
|
|
158
158
|
});
|
|
159
159
|
b(() => {
|
|
160
|
-
|
|
160
|
+
r && (g == null || g.getApplicationIdPromptVariables(r, {
|
|
161
161
|
status: 1
|
|
162
162
|
}).then((n) => {
|
|
163
|
-
const
|
|
163
|
+
const m = n.filter((e) => e.key !== "query").map((e) => ({
|
|
164
164
|
id: e.id,
|
|
165
165
|
key: e.key,
|
|
166
166
|
name: e.name,
|
|
167
167
|
value: ""
|
|
168
168
|
}));
|
|
169
|
-
|
|
169
|
+
P(m);
|
|
170
170
|
}));
|
|
171
|
-
}, [
|
|
171
|
+
}, [g]), b(() => {
|
|
172
172
|
if (!c)
|
|
173
173
|
return;
|
|
174
174
|
const n = {};
|
|
175
175
|
c == null || c.map((a) => {
|
|
176
176
|
a.key && (n[a.key] = a.value);
|
|
177
|
-
}),
|
|
177
|
+
}), Y.setFieldsValue(S({}, n)), Z(n);
|
|
178
178
|
}, [c]);
|
|
179
179
|
const oe = (n, a) => {
|
|
180
180
|
}, ae = (n) => {
|
|
181
181
|
N(n.target.value);
|
|
182
|
-
}, ce = () =>
|
|
183
|
-
if (
|
|
182
|
+
}, ce = () => A(void 0, null, function* () {
|
|
183
|
+
if (w(!0), !r || !g || !k)
|
|
184
184
|
return;
|
|
185
|
-
for (const e in
|
|
186
|
-
|
|
187
|
-
getContainer: () => (
|
|
188
|
-
}),
|
|
185
|
+
for (const e in V)
|
|
186
|
+
V[e] || (w(!1), q.config({
|
|
187
|
+
getContainer: () => (F == null ? void 0 : F.current) || document.body
|
|
188
|
+
}), q.error("变量值不能为空"), q.config({
|
|
189
189
|
getContainer: void 0
|
|
190
190
|
}));
|
|
191
|
-
const n = yield
|
|
191
|
+
const n = yield g.postApplicationIdSession({
|
|
192
192
|
name: "AI 会话",
|
|
193
|
-
applicationId:
|
|
193
|
+
applicationId: r
|
|
194
194
|
});
|
|
195
195
|
debugger;
|
|
196
|
-
|
|
197
|
-
const a =
|
|
196
|
+
O(n);
|
|
197
|
+
const a = T == null ? void 0 : T.map((e) => e.toString()), m = {
|
|
198
198
|
content: C,
|
|
199
199
|
chatMode: 1,
|
|
200
200
|
knowledges: a,
|
|
201
|
-
promptVariables:
|
|
201
|
+
promptVariables: V
|
|
202
202
|
};
|
|
203
|
-
|
|
203
|
+
re(r, n.id, m, {
|
|
204
204
|
onmessage: (e) => {
|
|
205
|
-
|
|
206
|
-
},
|
|
207
|
-
onclose: (e) => {
|
|
208
|
-
S(!1), e.code == 200 && (w(e.content), u(e));
|
|
205
|
+
w(!0), f(void 0), p(e.content);
|
|
209
206
|
},
|
|
207
|
+
onclose: (e) => A(void 0, null, function* () {
|
|
208
|
+
if (w(!1), e.code == 200) {
|
|
209
|
+
p(e.content);
|
|
210
|
+
const t = yield Promise.all(e.reference.map((d) => g.getKnowledgeIdFileId(d.knowledgeId, d.docId)));
|
|
211
|
+
e.reference = e.reference.map((d, i) => S(S({}, d), t[i])), f(e);
|
|
212
|
+
}
|
|
213
|
+
}),
|
|
210
214
|
onerror: () => {
|
|
211
|
-
|
|
215
|
+
w(!1);
|
|
212
216
|
}
|
|
213
|
-
}), c &&
|
|
214
|
-
const t = e.filter((
|
|
215
|
-
const
|
|
216
|
-
return
|
|
217
|
+
}), c && g.getApplicationIdSessionIdPromptVariables(r, n.id).then((e) => {
|
|
218
|
+
const t = e.filter((d) => d.key !== "query").map((d) => {
|
|
219
|
+
const i = c.filter((h) => h.key === d.key);
|
|
220
|
+
return d.value = i[0].value, d;
|
|
217
221
|
});
|
|
218
|
-
Promise.all(t.map((
|
|
219
|
-
oe(
|
|
220
|
-
})),
|
|
222
|
+
Promise.all(t.map((d) => {
|
|
223
|
+
oe(d.id, d.value);
|
|
224
|
+
})), P(t);
|
|
221
225
|
});
|
|
222
226
|
});
|
|
223
227
|
b(() => {
|
|
@@ -227,13 +231,13 @@ const Ee = ({
|
|
|
227
231
|
n && (n.scrollTop = n.scrollHeight);
|
|
228
232
|
}, [x]);
|
|
229
233
|
const le = (n) => {
|
|
230
|
-
H(n),
|
|
234
|
+
H(n), K(n.length);
|
|
231
235
|
}, de = (n, a) => {
|
|
232
|
-
c && (c.map((
|
|
233
|
-
|
|
234
|
-
}),
|
|
236
|
+
c && (c.map((m) => {
|
|
237
|
+
m.id === n && (m.value = a.target.value);
|
|
238
|
+
}), P([...c]));
|
|
235
239
|
}, ie = () => {
|
|
236
|
-
X(!
|
|
240
|
+
X(!M);
|
|
237
241
|
};
|
|
238
242
|
return /* @__PURE__ */ v("div", {
|
|
239
243
|
className: "text-main",
|
|
@@ -244,9 +248,9 @@ const Ee = ({
|
|
|
244
248
|
children: [/* @__PURE__ */ o("div", {
|
|
245
249
|
className: "prompts-header",
|
|
246
250
|
children: /* @__PURE__ */ v(ve, {
|
|
247
|
-
children: [/* @__PURE__ */ o(
|
|
251
|
+
children: [/* @__PURE__ */ o(E, {
|
|
248
252
|
className: "prompts-btn",
|
|
249
|
-
icon:
|
|
253
|
+
icon: M ? /* @__PURE__ */ o(U, {
|
|
250
254
|
type: "icon-biaoge-shouqi"
|
|
251
255
|
}) : /* @__PURE__ */ o(U, {
|
|
252
256
|
type: "icon-biaoge-zhankai"
|
|
@@ -258,9 +262,9 @@ const Ee = ({
|
|
|
258
262
|
children: "文本生成设置"
|
|
259
263
|
})]
|
|
260
264
|
})
|
|
261
|
-
}), !
|
|
265
|
+
}), !M && (c != null && c.length ? /* @__PURE__ */ o(R, {
|
|
262
266
|
autoComplete: "off",
|
|
263
|
-
form:
|
|
267
|
+
form: Y,
|
|
264
268
|
labelWrap: !0,
|
|
265
269
|
labelAlign: "left",
|
|
266
270
|
labelCol: {
|
|
@@ -269,7 +273,7 @@ const Ee = ({
|
|
|
269
273
|
}
|
|
270
274
|
},
|
|
271
275
|
className: "prompts-form",
|
|
272
|
-
children: c == null ? void 0 : c.map((n) => /* @__PURE__ */ o(
|
|
276
|
+
children: c == null ? void 0 : c.map((n) => /* @__PURE__ */ o(R.Item, {
|
|
273
277
|
label: n.name,
|
|
274
278
|
name: n.key,
|
|
275
279
|
style: {
|
|
@@ -291,8 +295,8 @@ const Ee = ({
|
|
|
291
295
|
children: [/* @__PURE__ */ o("span", {
|
|
292
296
|
className: "header-title",
|
|
293
297
|
children: "文本生成输入"
|
|
294
|
-
}), D.length !== 0 && /* @__PURE__ */ o(
|
|
295
|
-
checkedValues:
|
|
298
|
+
}), D.length !== 0 && /* @__PURE__ */ o(Se, {
|
|
299
|
+
checkedValues: T,
|
|
296
300
|
currKnowledgeList: D,
|
|
297
301
|
selectCount: G,
|
|
298
302
|
onSelectChange: le,
|
|
@@ -314,13 +318,13 @@ const Ee = ({
|
|
|
314
318
|
onChange: ae,
|
|
315
319
|
value: C,
|
|
316
320
|
className: "left-input"
|
|
317
|
-
}), /* @__PURE__ */ o(
|
|
321
|
+
}), /* @__PURE__ */ o(E, {
|
|
318
322
|
type: "primary",
|
|
319
|
-
disabled: !C ||
|
|
323
|
+
disabled: !C || y,
|
|
320
324
|
onClick: ce,
|
|
321
325
|
className: "sider-btn",
|
|
322
|
-
loading:
|
|
323
|
-
children:
|
|
326
|
+
loading: y,
|
|
327
|
+
children: y ? "生成中" : "确认生成"
|
|
324
328
|
})]
|
|
325
329
|
})
|
|
326
330
|
})]
|
|
@@ -331,11 +335,11 @@ const Ee = ({
|
|
|
331
335
|
children: /* @__PURE__ */ o("div", {
|
|
332
336
|
className: "sider-text",
|
|
333
337
|
ref: B,
|
|
334
|
-
children: x ? /* @__PURE__ */ v(
|
|
335
|
-
children: [/* @__PURE__ */ o(
|
|
338
|
+
children: x ? /* @__PURE__ */ v(Ie, {
|
|
339
|
+
children: [/* @__PURE__ */ o(Te, {
|
|
336
340
|
children: x
|
|
337
|
-
}),
|
|
338
|
-
history:
|
|
341
|
+
}), I && (I == null ? void 0 : I.reference.length) !== 0 && /* @__PURE__ */ o(be, {
|
|
342
|
+
history: I,
|
|
339
343
|
docViewerUrl: ""
|
|
340
344
|
})]
|
|
341
345
|
}) : /* @__PURE__ */ o("div", {
|
|
@@ -350,5 +354,5 @@ const Ee = ({
|
|
|
350
354
|
});
|
|
351
355
|
};
|
|
352
356
|
export {
|
|
353
|
-
|
|
357
|
+
ze as default
|
|
354
358
|
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as x, jsx as o, Fragment as U } from "react/jsx-runtime";
|
|
2
2
|
import { useState as s, useEffect as n } from "react";
|
|
3
|
-
import { Image as k, Spin as E, Tooltip as
|
|
4
|
-
import { LoadingOutlined as
|
|
3
|
+
import { Image as k, Spin as E, Tooltip as P, Button as j } from "antd";
|
|
4
|
+
import { LoadingOutlined as z } from "@ant-design/icons";
|
|
5
5
|
import { AecKnowledgeFileStatus as F } from "@glodon-aiot/apis";
|
|
6
|
-
import
|
|
7
|
-
import { getBase64 as
|
|
6
|
+
import B from "../Iconfont/index.mjs";
|
|
7
|
+
import { getBase64 as I } from "../../utils/index.mjs";
|
|
8
8
|
/* empty css */const D = (i) => {
|
|
9
9
|
const {
|
|
10
|
-
className:
|
|
11
|
-
style:
|
|
10
|
+
className: N,
|
|
11
|
+
style: y,
|
|
12
12
|
id: r,
|
|
13
13
|
file: e,
|
|
14
14
|
actions: {
|
|
15
15
|
upload: l,
|
|
16
|
-
remove:
|
|
16
|
+
remove: g,
|
|
17
17
|
checkStatus: c
|
|
18
18
|
} = {},
|
|
19
|
-
onUrlChange:
|
|
19
|
+
onUrlChange: h,
|
|
20
20
|
onStatusChange: v
|
|
21
21
|
} = i, [f, u] = s(i.uploading), [w, S] = s(!1);
|
|
22
22
|
n(() => {
|
|
@@ -27,51 +27,52 @@ import { getBase64 as P } from "../../utils/index.mjs";
|
|
|
27
27
|
d(i.url);
|
|
28
28
|
}, [i.url]), n(() => {
|
|
29
29
|
l && e instanceof File && (m || f || (u(!0), l(e).then((t) => {
|
|
30
|
-
d(t),
|
|
30
|
+
d(t), h && h(t);
|
|
31
31
|
}).catch((t) => S(t)).finally(() => u(!1))));
|
|
32
32
|
}, [l, m, e]);
|
|
33
|
-
const [a,
|
|
33
|
+
const [a, p] = s(e instanceof File || e == null ? void 0 : e.status);
|
|
34
34
|
n(() => {
|
|
35
|
-
|
|
35
|
+
p(e instanceof File || e == null ? void 0 : e.status);
|
|
36
36
|
}, [e]);
|
|
37
|
-
const
|
|
37
|
+
const C = () => {
|
|
38
38
|
r && c && a === F.Processing && c(r).then((t) => {
|
|
39
|
-
t !== a && (a !== void 0 && v && v(t),
|
|
40
|
-
}).catch((t) =>
|
|
39
|
+
t !== a && (a !== void 0 && v && v(t), p(t));
|
|
40
|
+
}).catch((t) => p(F.Failed));
|
|
41
41
|
};
|
|
42
42
|
return n(() => {
|
|
43
|
-
|
|
43
|
+
C();
|
|
44
44
|
}, [r, c, a]), n(() => {
|
|
45
|
-
|
|
45
|
+
I(e).then((t) => {
|
|
46
46
|
d(t);
|
|
47
47
|
});
|
|
48
|
-
}, [e]), e ? /* @__PURE__ */
|
|
49
|
-
className: `file-preview ${
|
|
50
|
-
style:
|
|
48
|
+
}, [e]), e ? /* @__PURE__ */ x("div", {
|
|
49
|
+
className: `file-preview ${N}`,
|
|
50
|
+
style: y,
|
|
51
51
|
children: [/* @__PURE__ */ o(k, {
|
|
52
52
|
src: m,
|
|
53
53
|
className: "file-icon"
|
|
54
54
|
}), f && /* @__PURE__ */ o(E, {
|
|
55
55
|
className: "file-action file-process",
|
|
56
|
-
indicator: /* @__PURE__ */ o(
|
|
56
|
+
indicator: /* @__PURE__ */ o(z, {
|
|
57
57
|
style: {
|
|
58
58
|
fontSize: 16
|
|
59
59
|
},
|
|
60
60
|
spin: !0
|
|
61
61
|
})
|
|
62
|
-
}), !f &&
|
|
62
|
+
}), !f && g && /* @__PURE__ */ o(P, {
|
|
63
63
|
overlayClassName: "file-remove-tooltip",
|
|
64
64
|
title: "删除文件",
|
|
65
|
-
|
|
65
|
+
getPopupContainer: (t) => t.parentNode,
|
|
66
|
+
children: /* @__PURE__ */ o(j, {
|
|
66
67
|
className: "file-action file-remove",
|
|
67
|
-
icon: /* @__PURE__ */ o(
|
|
68
|
+
icon: /* @__PURE__ */ o(B, {
|
|
68
69
|
style: {
|
|
69
70
|
fontSize: "10px"
|
|
70
71
|
},
|
|
71
72
|
type: "icon-shanchu"
|
|
72
73
|
}),
|
|
73
74
|
onClick: () => {
|
|
74
|
-
|
|
75
|
+
g(e, r);
|
|
75
76
|
}
|
|
76
77
|
})
|
|
77
78
|
})]
|