@hkyhy/marsun-components-core 0.1.128 → 0.1.129
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/README.md +1 -0
- package/dist/components/Tools/Inbox/InboxBell/InboxBell.js +313 -291
- package/dist/components/Tools/Inbox/InboxBell/InboxBell.js.map +1 -1
- package/dist/components/Tools/Inbox/InboxBell/style.module.scss.js +52 -48
- package/dist/components/Tools/Inbox/InboxBell/style.module.scss.js.map +1 -1
- package/dist/marsun-components-core.css +1 -1
- package/dist/styles/global.css +1 -1
- package/package.json +1 -1
|
@@ -1,323 +1,345 @@
|
|
|
1
|
-
import { jsxs as m, jsx as
|
|
2
|
-
import { notification as
|
|
3
|
-
import
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
1
|
+
import { jsxs as m, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { notification as Me, Badge as Oe, Button as z, Drawer as Ie, Space as Te, Checkbox as ne, message as be } from "antd";
|
|
3
|
+
import P from "classnames";
|
|
4
|
+
import { forwardRef as He, useState as y, useRef as h, useMemo as we, useCallback as N, useImperativeHandle as Fe, useEffect as T } from "react";
|
|
5
|
+
import { createPortal as Ue } from "react-dom";
|
|
6
|
+
import { sanitizeInboxHtml as ze } from "../sanitizeInboxHtml.js";
|
|
7
|
+
import { INBOX_BADGE_REFRESH_EVENT as Ne } from "../requestInboxBadgeRefresh.js";
|
|
8
|
+
import { emphasizeQuoted as re } from "./emphasizeQuoted.js";
|
|
9
|
+
import { filterInboxActionsForHost as Ge, resolveInboxItemActions as Ke, isInboxButtonDriven as $e } from "./inboxItemActions.js";
|
|
10
|
+
import { inboxSceneLabel as Pt, isTerminalActionStatus as Rt, normalizeInboxActions as _t, resolveInboxSceneKey as At } from "./inboxItemActions.js";
|
|
11
|
+
import { loadInboxToastPrefs as je, shouldToastForMessageType as Ve, saveInboxToastPrefs as We } from "./toastPrefs.js";
|
|
12
|
+
import { DEFAULT_INBOX_TOAST_PREFS as Mt } from "./toastPrefs.js";
|
|
12
13
|
import r from "./style.module.scss.js";
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
const
|
|
14
|
+
import { Bell as Qe } from "../../../Icons/Bell.js";
|
|
15
|
+
import oe, { SEMANTIC_COLORS as D } from "../../../Tag/SemanticTag.js";
|
|
16
|
+
import Xe from "../../../StateBar/StateBar.js";
|
|
17
|
+
import Ye from "../../../SegmentedRadio/SegmentedRadio.js";
|
|
18
|
+
import Je from "../../../Layout/PageSpin/index.js";
|
|
19
|
+
import qe from "../../../Empty/Empty.js";
|
|
20
|
+
import Ze from "../../../VirtualScrollbar/VirtualScrollbar/index.js";
|
|
21
|
+
const et = 6e3, tt = [
|
|
21
22
|
{ key: "", label: "全部" },
|
|
22
23
|
{ key: "alert", label: "预警" },
|
|
23
24
|
{ key: "action", label: "行动" },
|
|
24
25
|
{ key: "remind", label: "提醒" }
|
|
25
|
-
],
|
|
26
|
+
], nt = {
|
|
26
27
|
alert: "预警",
|
|
27
28
|
action: "行动",
|
|
28
29
|
remind: "提醒"
|
|
29
|
-
},
|
|
30
|
-
function
|
|
31
|
-
const
|
|
32
|
-
return
|
|
30
|
+
}, rt = 300, ot = 1500, at = 72;
|
|
31
|
+
function Ee(d) {
|
|
32
|
+
const a = String(d || "").trim().toLowerCase();
|
|
33
|
+
return a ? nt[a] || a : "";
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
-
const
|
|
36
|
-
return
|
|
35
|
+
function Se(d) {
|
|
36
|
+
const a = String(d || "").trim().toLowerCase();
|
|
37
|
+
return a === "alert" ? D.DANGER : a === "action" ? D.PRIMARY : a === "remind" ? D.WARNING : D.DEFAULT;
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
-
return [
|
|
39
|
+
function lt(d) {
|
|
40
|
+
return [d.factory, d.variety, d.metric].map((a) => String(a || "").trim()).filter(Boolean).join(" · ");
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
-
return String(
|
|
42
|
+
function st(d) {
|
|
43
|
+
return String(d || "").trim() || D.DEFAULT;
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
+
function it(d) {
|
|
45
46
|
try {
|
|
46
|
-
const
|
|
47
|
-
if (!
|
|
48
|
-
const M = String(
|
|
49
|
-
return !M && !
|
|
47
|
+
const a = JSON.parse(d);
|
|
48
|
+
if (!a || typeof a != "object") return null;
|
|
49
|
+
const M = String(a.messageType || a.message_type || "").trim(), R = String(a.title || "").trim(), B = String(a.summary || "").trim();
|
|
50
|
+
return !M && !R && !B ? null : {
|
|
50
51
|
messageType: M || void 0,
|
|
51
|
-
title:
|
|
52
|
-
summary:
|
|
52
|
+
title: R || void 0,
|
|
53
|
+
summary: B || void 0
|
|
53
54
|
};
|
|
54
55
|
} catch {
|
|
55
56
|
return null;
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
|
-
const
|
|
59
|
-
fetchInbox:
|
|
59
|
+
const Bt = He(function({
|
|
60
|
+
fetchInbox: a,
|
|
60
61
|
markRead: M,
|
|
61
|
-
onNavigate:
|
|
62
|
-
pollMs:
|
|
63
|
-
locationKey:
|
|
64
|
-
pageSize:
|
|
65
|
-
className:
|
|
66
|
-
title:
|
|
62
|
+
onNavigate: R,
|
|
63
|
+
pollMs: B = 0,
|
|
64
|
+
locationKey: ae,
|
|
65
|
+
pageSize: E = 20,
|
|
66
|
+
className: Le,
|
|
67
|
+
title: ke = "站内信",
|
|
67
68
|
streamPath: G = "/api/v1/msg-center/inbox/stream",
|
|
68
69
|
getAccessToken: K,
|
|
69
|
-
onItemAction:
|
|
70
|
-
},
|
|
71
|
-
const [$,
|
|
72
|
-
|
|
73
|
-
const
|
|
70
|
+
onItemAction: le
|
|
71
|
+
}, Be) {
|
|
72
|
+
const [$, x] = y(!1), [se, ie] = y(!1), [j, ce] = y(""), [O, I] = y([]), [_, H] = y(0), [de, V] = y({}), [W, xe] = y(""), [F, Ce] = y("all"), [A, Pe] = y(() => je()), [Re, ue] = y(!1), [b, Q] = y(null), S = h(null), L = h(null), X = h(null), f = h(null), me = h(!1), fe = h(A);
|
|
73
|
+
fe.current = A;
|
|
74
|
+
const Y = h(1), J = h(!1), C = h(!1), U = we(
|
|
74
75
|
() => ({
|
|
75
76
|
messageType: W || void 0,
|
|
76
|
-
unreadOnly:
|
|
77
|
-
readOnly:
|
|
77
|
+
unreadOnly: F === "unread" || void 0,
|
|
78
|
+
readOnly: F === "read" || void 0
|
|
78
79
|
}),
|
|
79
|
-
[W,
|
|
80
|
-
),
|
|
81
|
-
|
|
80
|
+
[W, F]
|
|
81
|
+
), q = N(async () => {
|
|
82
|
+
ie(!0), ce(""), Y.current = 1, C.current = !1;
|
|
82
83
|
try {
|
|
83
|
-
const e = await
|
|
84
|
+
const e = await a({
|
|
84
85
|
currentPage: 1,
|
|
85
|
-
pageSize:
|
|
86
|
-
...
|
|
86
|
+
pageSize: E,
|
|
87
|
+
...U
|
|
87
88
|
}), t = (e == null ? void 0 : e.pageData) || [], n = typeof (e == null ? void 0 : e.total) == "number" ? e.total : t.length;
|
|
88
|
-
|
|
89
|
+
I(t), C.current = t.length > 0 && t.length < n, H(typeof (e == null ? void 0 : e.unreadTotal) == "number" ? e.unreadTotal : 0), V((e == null ? void 0 : e.unreadByMessageType) || {});
|
|
89
90
|
} catch (e) {
|
|
90
|
-
|
|
91
|
+
I([]), C.current = !1, ce(e instanceof Error ? e.message : String(e));
|
|
91
92
|
} finally {
|
|
92
|
-
|
|
93
|
+
ie(!1);
|
|
93
94
|
}
|
|
94
|
-
}, [
|
|
95
|
-
if (!(
|
|
96
|
-
|
|
95
|
+
}, [a, E, U]), pe = N(async () => {
|
|
96
|
+
if (!(J.current || !C.current)) {
|
|
97
|
+
J.current = !0, ue(!0);
|
|
97
98
|
try {
|
|
98
|
-
const e =
|
|
99
|
+
const e = Y.current + 1, t = await a({
|
|
99
100
|
currentPage: e,
|
|
100
|
-
pageSize:
|
|
101
|
-
...
|
|
102
|
-
}), n = (t == null ? void 0 : t.pageData) || [],
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
return
|
|
106
|
-
}), n.length && (
|
|
101
|
+
pageSize: E,
|
|
102
|
+
...U
|
|
103
|
+
}), n = (t == null ? void 0 : t.pageData) || [], l = typeof (t == null ? void 0 : t.total) == "number" ? t.total : 0;
|
|
104
|
+
I((i) => {
|
|
105
|
+
const s = new Set(i.map((p) => p.id)), u = n.filter((p) => (p == null ? void 0 : p.id) && !s.has(p.id)), v = u.length ? [...i, ...u] : i;
|
|
106
|
+
return C.current = u.length > 0 && (l > 0 ? v.length < l : u.length >= E), v;
|
|
107
|
+
}), n.length && (Y.current = e), typeof (t == null ? void 0 : t.unreadTotal) == "number" && H(t.unreadTotal), t != null && t.unreadByMessageType && V(t.unreadByMessageType);
|
|
107
108
|
} catch {
|
|
108
|
-
|
|
109
|
+
C.current = !1;
|
|
109
110
|
} finally {
|
|
110
|
-
|
|
111
|
+
J.current = !1, ue(!1);
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
|
-
}, [
|
|
114
|
+
}, [a, E, U]), _e = N(
|
|
114
115
|
(e) => {
|
|
115
116
|
const t = e.currentTarget;
|
|
116
|
-
t.scrollHeight - t.scrollTop - t.clientHeight <=
|
|
117
|
+
t.scrollHeight - t.scrollTop - t.clientHeight <= at && pe();
|
|
117
118
|
},
|
|
118
|
-
[
|
|
119
|
-
),
|
|
119
|
+
[pe]
|
|
120
|
+
), g = N(async () => {
|
|
120
121
|
try {
|
|
121
|
-
const e = await
|
|
122
|
-
|
|
122
|
+
const e = await a({ currentPage: 1, pageSize: E });
|
|
123
|
+
H(typeof (e == null ? void 0 : e.unreadTotal) == "number" ? e.unreadTotal : 0), V((e == null ? void 0 : e.unreadByMessageType) || {});
|
|
123
124
|
} catch {
|
|
124
125
|
}
|
|
125
|
-
}, [
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
) : null
|
|
145
|
-
] }),
|
|
146
|
-
message: /* @__PURE__ */ m("div", { className: r.toastHead, children: [
|
|
147
|
-
/* @__PURE__ */ a("span", { className: r.toastTitle, children: U(t) }),
|
|
148
|
-
o ? /* @__PURE__ */ a(
|
|
149
|
-
z,
|
|
150
|
-
{
|
|
151
|
-
color: te(e.messageType),
|
|
152
|
-
className: r.typeTag,
|
|
153
|
-
children: o
|
|
154
|
-
}
|
|
155
|
-
) : null
|
|
156
|
-
] }),
|
|
157
|
-
description: /* @__PURE__ */ m("div", { className: r.toastBody, children: [
|
|
158
|
-
n ? /* @__PURE__ */ a("div", { className: r.toastDesc, children: U(n) }) : null,
|
|
159
|
-
/* @__PURE__ */ a("div", { className: r.toastActions, children: /* @__PURE__ */ a(
|
|
160
|
-
F,
|
|
161
|
-
{
|
|
162
|
-
type: "primary",
|
|
163
|
-
size: "small",
|
|
164
|
-
onClick: (c) => {
|
|
165
|
-
c.stopPropagation(), i();
|
|
166
|
-
},
|
|
167
|
-
children: "查看"
|
|
168
|
-
}
|
|
169
|
-
) })
|
|
170
|
-
] }),
|
|
171
|
-
placement: "topRight",
|
|
172
|
-
duration: 6,
|
|
173
|
-
onClick: i
|
|
174
|
-
});
|
|
175
|
-
}, []), h = x(
|
|
126
|
+
}, [a, E]), Z = N(() => {
|
|
127
|
+
f.current != null && (window.clearTimeout(f.current), f.current = null), Q(null);
|
|
128
|
+
}, []), ye = N(() => {
|
|
129
|
+
Z(), x(!0);
|
|
130
|
+
}, [Z]), ge = N(() => {
|
|
131
|
+
const e = X.current;
|
|
132
|
+
if (X.current = null, !e || !Ve(fe.current, e.messageType)) return;
|
|
133
|
+
f.current != null && (window.clearTimeout(f.current), f.current = null);
|
|
134
|
+
const t = `inbox-badge-${e.messageType || "msg"}-${Date.now()}`;
|
|
135
|
+
Q({
|
|
136
|
+
key: t,
|
|
137
|
+
title: e.title || "新站内信",
|
|
138
|
+
summary: e.summary || "",
|
|
139
|
+
messageType: e.messageType
|
|
140
|
+
}), f.current = window.setTimeout(() => {
|
|
141
|
+
f.current = null, Q(null);
|
|
142
|
+
}, et);
|
|
143
|
+
}, []), w = N(
|
|
176
144
|
(e) => {
|
|
177
|
-
e && (
|
|
178
|
-
|
|
179
|
-
},
|
|
145
|
+
e && (X.current = e, ge()), L.current != null && window.clearTimeout(L.current), L.current = window.setTimeout(() => {
|
|
146
|
+
L.current = null, g();
|
|
147
|
+
}, ot);
|
|
180
148
|
},
|
|
181
|
-
[
|
|
149
|
+
[g, ge]
|
|
182
150
|
);
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}, [
|
|
186
|
-
if (
|
|
187
|
-
if (!
|
|
188
|
-
|
|
151
|
+
Fe(Be, () => ({ refreshBadge: g }), [g]), T(() => {
|
|
152
|
+
g();
|
|
153
|
+
}, [g]), T(() => {
|
|
154
|
+
if (ae !== void 0) {
|
|
155
|
+
if (!me.current) {
|
|
156
|
+
me.current = !0;
|
|
189
157
|
return;
|
|
190
158
|
}
|
|
191
|
-
|
|
159
|
+
w();
|
|
192
160
|
}
|
|
193
|
-
}, [
|
|
194
|
-
if (
|
|
161
|
+
}, [ae, w]), T(() => {
|
|
162
|
+
if (B <= 0) return;
|
|
195
163
|
const e = window.setInterval(() => {
|
|
196
|
-
|
|
197
|
-
},
|
|
164
|
+
g();
|
|
165
|
+
}, B);
|
|
198
166
|
return () => window.clearInterval(e);
|
|
199
|
-
}, [
|
|
167
|
+
}, [B, g]), T(() => {
|
|
200
168
|
const e = () => {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
},
|
|
169
|
+
S.current != null && window.clearTimeout(S.current), S.current = window.setTimeout(() => {
|
|
170
|
+
S.current = null, w();
|
|
171
|
+
}, rt);
|
|
204
172
|
}, t = () => {
|
|
205
173
|
document.visibilityState === "visible" && e();
|
|
206
174
|
};
|
|
207
175
|
return window.addEventListener("focus", e), document.addEventListener("visibilitychange", t), () => {
|
|
208
|
-
window.removeEventListener("focus", e), document.removeEventListener("visibilitychange", t),
|
|
176
|
+
window.removeEventListener("focus", e), document.removeEventListener("visibilitychange", t), S.current != null && (window.clearTimeout(S.current), S.current = null);
|
|
209
177
|
};
|
|
210
|
-
}, [
|
|
178
|
+
}, [w]), T(() => {
|
|
211
179
|
const e = (t) => {
|
|
212
180
|
const n = t.detail;
|
|
213
|
-
|
|
181
|
+
w((n == null ? void 0 : n.preview) || void 0);
|
|
214
182
|
};
|
|
215
|
-
return window.addEventListener(
|
|
216
|
-
}, [
|
|
217
|
-
|
|
183
|
+
return window.addEventListener(Ne, e), () => window.removeEventListener(Ne, e);
|
|
184
|
+
}, [w]), T(() => {
|
|
185
|
+
Me.destroy();
|
|
186
|
+
}, []), T(() => () => {
|
|
187
|
+
L.current != null && (window.clearTimeout(L.current), L.current = null), f.current != null && (window.clearTimeout(f.current), f.current = null);
|
|
218
188
|
}, []), T(() => {
|
|
219
189
|
if (G === !1 || typeof K != "function" || typeof window > "u" || typeof EventSource > "u") return;
|
|
220
190
|
const e = String(G || "/api/v1/msg-center/inbox/stream").trim();
|
|
221
|
-
let t = !1, n = null,
|
|
222
|
-
const
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
},
|
|
228
|
-
if (t ||
|
|
229
|
-
const
|
|
230
|
-
i += 1,
|
|
231
|
-
|
|
232
|
-
},
|
|
233
|
-
},
|
|
191
|
+
let t = !1, n = null, l = null, i = 0;
|
|
192
|
+
const s = (c) => {
|
|
193
|
+
const k = c, De = typeof (k == null ? void 0 : k.data) == "string" ? it(k.data) : null;
|
|
194
|
+
w(De);
|
|
195
|
+
}, u = () => {
|
|
196
|
+
l != null && (window.clearTimeout(l), l = null);
|
|
197
|
+
}, v = () => {
|
|
198
|
+
if (t || l != null) return;
|
|
199
|
+
const c = Math.min(3e4, 1e3 * 2 ** Math.min(i, 5));
|
|
200
|
+
i += 1, l = window.setTimeout(() => {
|
|
201
|
+
l = null, p();
|
|
202
|
+
}, c);
|
|
203
|
+
}, p = () => {
|
|
234
204
|
if (t) return;
|
|
235
|
-
const
|
|
236
|
-
if (!
|
|
237
|
-
|
|
205
|
+
const c = String(K() || "").trim();
|
|
206
|
+
if (!c) {
|
|
207
|
+
v();
|
|
238
208
|
return;
|
|
239
209
|
}
|
|
240
|
-
n && (n.removeEventListener("badge",
|
|
241
|
-
const
|
|
242
|
-
|
|
210
|
+
n && (n.removeEventListener("badge", s), n.removeEventListener("inbox", s), n.close(), n = null);
|
|
211
|
+
const k = new URL(e, window.location.origin);
|
|
212
|
+
k.searchParams.set("access_token", c);
|
|
243
213
|
try {
|
|
244
|
-
n = new EventSource(
|
|
214
|
+
n = new EventSource(k.toString());
|
|
245
215
|
} catch {
|
|
246
|
-
|
|
216
|
+
v();
|
|
247
217
|
return;
|
|
248
218
|
}
|
|
249
|
-
n.addEventListener("badge",
|
|
219
|
+
n.addEventListener("badge", s), n.addEventListener("inbox", s), n.onopen = () => {
|
|
250
220
|
i = 0;
|
|
251
221
|
}, n.onerror = () => {
|
|
252
|
-
t || (n == null || n.close(), n = null,
|
|
222
|
+
t || (n == null || n.close(), n = null, v());
|
|
253
223
|
};
|
|
254
224
|
};
|
|
255
|
-
return
|
|
256
|
-
t = !0,
|
|
225
|
+
return p(), () => {
|
|
226
|
+
t = !0, u(), n && (n.removeEventListener("badge", s), n.removeEventListener("inbox", s), n.close(), n = null);
|
|
257
227
|
};
|
|
258
|
-
}, [G, K,
|
|
259
|
-
$ &&
|
|
260
|
-
}, [$,
|
|
261
|
-
const
|
|
262
|
-
() =>
|
|
263
|
-
const t = e.key ?
|
|
228
|
+
}, [G, K, w]), T(() => {
|
|
229
|
+
$ && q();
|
|
230
|
+
}, [$, q]);
|
|
231
|
+
const Ae = we(
|
|
232
|
+
() => tt.map((e) => {
|
|
233
|
+
const t = e.key ? de[e.key] || 0 : _;
|
|
264
234
|
return {
|
|
265
235
|
key: e.key || "all",
|
|
266
236
|
label: t > 0 ? `${e.label} (${t})` : e.label
|
|
267
237
|
};
|
|
268
238
|
}),
|
|
269
|
-
[
|
|
270
|
-
),
|
|
271
|
-
|
|
272
|
-
const
|
|
273
|
-
return
|
|
239
|
+
[de, _]
|
|
240
|
+
), ee = (e, t) => {
|
|
241
|
+
Pe((n) => {
|
|
242
|
+
const l = { ...n, [e]: t };
|
|
243
|
+
return We(l), l;
|
|
274
244
|
});
|
|
275
|
-
},
|
|
245
|
+
}, te = async (e, t) => {
|
|
276
246
|
if (!e.read)
|
|
277
247
|
try {
|
|
278
|
-
await M(e.id),
|
|
279
|
-
} catch (
|
|
280
|
-
|
|
248
|
+
await M(e.id), I((l) => l.map((i) => i.id === e.id ? { ...i, read: !0 } : i)), H((l) => Math.max(0, l - 1));
|
|
249
|
+
} catch (l) {
|
|
250
|
+
be.error(l instanceof Error ? l.message : "标记已读失败");
|
|
281
251
|
return;
|
|
282
252
|
}
|
|
283
253
|
const n = String(e.href || "").trim();
|
|
284
254
|
if (n) {
|
|
285
|
-
if (
|
|
286
|
-
|
|
255
|
+
if (R) {
|
|
256
|
+
R(n, e), x(!1);
|
|
287
257
|
return;
|
|
288
258
|
}
|
|
289
|
-
n.startsWith("http://") || n.startsWith("https://") ? window.open(n, "_blank", "noopener,noreferrer") : window.location.assign(n),
|
|
259
|
+
n.startsWith("http://") || n.startsWith("https://") ? window.open(n, "_blank", "noopener,noreferrer") : window.location.assign(n), x(!1);
|
|
290
260
|
}
|
|
291
|
-
},
|
|
261
|
+
}, ve = async (e, t) => {
|
|
292
262
|
if (!t.disabled) {
|
|
293
|
-
if (
|
|
263
|
+
if (le) {
|
|
294
264
|
try {
|
|
295
|
-
await
|
|
265
|
+
await le(t.kind, e), x(!1), q(), g();
|
|
296
266
|
} catch (n) {
|
|
297
|
-
|
|
267
|
+
be.error(n instanceof Error ? n.message : "操作失败");
|
|
298
268
|
}
|
|
299
269
|
return;
|
|
300
270
|
}
|
|
301
|
-
await
|
|
271
|
+
await te(e);
|
|
302
272
|
}
|
|
303
|
-
};
|
|
304
|
-
return /* @__PURE__ */ m("div", { className:
|
|
305
|
-
/* @__PURE__ */
|
|
306
|
-
|
|
273
|
+
}, he = b ? Ee(b.messageType) : "";
|
|
274
|
+
return /* @__PURE__ */ m("div", { className: P(r.bellWrap, Le), children: [
|
|
275
|
+
/* @__PURE__ */ o(Oe, { count: _, size: "small", overflowCount: 99, offset: [-4, 4], children: /* @__PURE__ */ o(
|
|
276
|
+
z,
|
|
307
277
|
{
|
|
308
278
|
type: "text",
|
|
309
279
|
className: r.bellBtn,
|
|
310
|
-
icon: /* @__PURE__ */
|
|
311
|
-
"aria-label":
|
|
312
|
-
onClick: () =>
|
|
280
|
+
icon: /* @__PURE__ */ o(Qe, { size: 16, "aria-hidden": !0 }),
|
|
281
|
+
"aria-label": _ > 0 ? `站内信,${_} 条未读` : "站内信",
|
|
282
|
+
onClick: () => x(!0)
|
|
313
283
|
}
|
|
314
284
|
) }),
|
|
285
|
+
b && typeof document < "u" ? Ue(
|
|
286
|
+
/* @__PURE__ */ o("div", { className: r.toastHost, "data-testid": "inbox-live-toast-host", children: /* @__PURE__ */ m(
|
|
287
|
+
"div",
|
|
288
|
+
{
|
|
289
|
+
className: P("marsun-inbox-toast", r.toastNotice),
|
|
290
|
+
role: "alert",
|
|
291
|
+
"data-testid": "inbox-live-toast",
|
|
292
|
+
onClick: ye,
|
|
293
|
+
children: [
|
|
294
|
+
/* @__PURE__ */ o(
|
|
295
|
+
"button",
|
|
296
|
+
{
|
|
297
|
+
type: "button",
|
|
298
|
+
className: r.toastClose,
|
|
299
|
+
"aria-label": "关闭",
|
|
300
|
+
onClick: (e) => {
|
|
301
|
+
e.stopPropagation(), Z();
|
|
302
|
+
},
|
|
303
|
+
children: "×"
|
|
304
|
+
}
|
|
305
|
+
),
|
|
306
|
+
/* @__PURE__ */ m("div", { className: r.toastHead, children: [
|
|
307
|
+
/* @__PURE__ */ o("span", { className: r.toastTitle, children: re(b.title) }),
|
|
308
|
+
he ? /* @__PURE__ */ o(
|
|
309
|
+
oe,
|
|
310
|
+
{
|
|
311
|
+
color: Se(b.messageType),
|
|
312
|
+
className: r.typeTag,
|
|
313
|
+
children: he
|
|
314
|
+
}
|
|
315
|
+
) : null
|
|
316
|
+
] }),
|
|
317
|
+
/* @__PURE__ */ m("div", { className: r.toastBody, children: [
|
|
318
|
+
b.summary ? /* @__PURE__ */ o("div", { className: r.toastDesc, children: re(b.summary) }) : null,
|
|
319
|
+
/* @__PURE__ */ o("div", { className: r.toastActions, children: /* @__PURE__ */ o(
|
|
320
|
+
z,
|
|
321
|
+
{
|
|
322
|
+
type: "primary",
|
|
323
|
+
size: "small",
|
|
324
|
+
onClick: (e) => {
|
|
325
|
+
e.stopPropagation(), ye();
|
|
326
|
+
},
|
|
327
|
+
children: "查看"
|
|
328
|
+
}
|
|
329
|
+
) })
|
|
330
|
+
] })
|
|
331
|
+
]
|
|
332
|
+
},
|
|
333
|
+
b.key
|
|
334
|
+
) }),
|
|
335
|
+
document.body
|
|
336
|
+
) : null,
|
|
315
337
|
/* @__PURE__ */ m(
|
|
316
|
-
|
|
338
|
+
Ie,
|
|
317
339
|
{
|
|
318
|
-
title:
|
|
340
|
+
title: ke,
|
|
319
341
|
open: $,
|
|
320
|
-
onClose: () =>
|
|
342
|
+
onClose: () => x(!1),
|
|
321
343
|
size: 420,
|
|
322
344
|
destroyOnClose: !1,
|
|
323
345
|
className: r.drawer,
|
|
@@ -326,23 +348,23 @@ const vt = De(function({
|
|
|
326
348
|
body: { padding: "12px 16px" }
|
|
327
349
|
},
|
|
328
350
|
children: [
|
|
329
|
-
/* @__PURE__ */
|
|
330
|
-
|
|
351
|
+
/* @__PURE__ */ o(
|
|
352
|
+
Xe,
|
|
331
353
|
{
|
|
332
354
|
className: r.typeTabs,
|
|
333
355
|
size: "small",
|
|
334
356
|
activeKey: W || "all",
|
|
335
|
-
onChange: (e) =>
|
|
336
|
-
stateOption:
|
|
357
|
+
onChange: (e) => xe(e === "all" ? "" : e),
|
|
358
|
+
stateOption: Ae,
|
|
337
359
|
isInner: !0
|
|
338
360
|
}
|
|
339
361
|
),
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
|
|
362
|
+
/* @__PURE__ */ o("div", { className: r.filterRow, children: /* @__PURE__ */ o(
|
|
363
|
+
Ye,
|
|
342
364
|
{
|
|
343
365
|
size: "small",
|
|
344
|
-
value:
|
|
345
|
-
onChange: (e) =>
|
|
366
|
+
value: F,
|
|
367
|
+
onChange: (e) => Ce(e),
|
|
346
368
|
options: [
|
|
347
369
|
{ value: "all", label: "全部" },
|
|
348
370
|
{ value: "unread", label: "未读" },
|
|
@@ -351,116 +373,116 @@ const vt = De(function({
|
|
|
351
373
|
}
|
|
352
374
|
) }),
|
|
353
375
|
/* @__PURE__ */ m("div", { className: r.toastPrefs, "data-testid": "inbox-toast-prefs", children: [
|
|
354
|
-
/* @__PURE__ */
|
|
355
|
-
/* @__PURE__ */
|
|
356
|
-
/* @__PURE__ */ m(
|
|
357
|
-
/* @__PURE__ */
|
|
358
|
-
|
|
376
|
+
/* @__PURE__ */ o("div", { className: r.toastPrefsTitle, children: "消息提示" }),
|
|
377
|
+
/* @__PURE__ */ o("p", { className: r.toastPrefsHint, children: "本机浏览器偏好,非租户策略" }),
|
|
378
|
+
/* @__PURE__ */ m(Te, { size: 12, wrap: !0, children: [
|
|
379
|
+
/* @__PURE__ */ o(
|
|
380
|
+
ne,
|
|
359
381
|
{
|
|
360
|
-
checked:
|
|
361
|
-
onChange: (e) =>
|
|
382
|
+
checked: A.alert,
|
|
383
|
+
onChange: (e) => ee("alert", e.target.checked),
|
|
362
384
|
children: "预警弹出"
|
|
363
385
|
}
|
|
364
386
|
),
|
|
365
|
-
/* @__PURE__ */
|
|
366
|
-
|
|
387
|
+
/* @__PURE__ */ o(
|
|
388
|
+
ne,
|
|
367
389
|
{
|
|
368
|
-
checked:
|
|
369
|
-
onChange: (e) =>
|
|
390
|
+
checked: A.action,
|
|
391
|
+
onChange: (e) => ee("action", e.target.checked),
|
|
370
392
|
children: "行动弹出"
|
|
371
393
|
}
|
|
372
394
|
),
|
|
373
|
-
/* @__PURE__ */
|
|
374
|
-
|
|
395
|
+
/* @__PURE__ */ o(
|
|
396
|
+
ne,
|
|
375
397
|
{
|
|
376
|
-
checked:
|
|
377
|
-
onChange: (e) =>
|
|
398
|
+
checked: A.remind,
|
|
399
|
+
onChange: (e) => ee("remind", e.target.checked),
|
|
378
400
|
children: "提醒弹出"
|
|
379
401
|
}
|
|
380
402
|
)
|
|
381
403
|
] })
|
|
382
404
|
] }),
|
|
383
|
-
j ? /* @__PURE__ */
|
|
384
|
-
/* @__PURE__ */
|
|
385
|
-
|
|
405
|
+
j ? /* @__PURE__ */ o("p", { className: r.error, children: j }) : null,
|
|
406
|
+
/* @__PURE__ */ o("div", { className: P("inbox-bell-list-pane", r.listPane), children: /* @__PURE__ */ o(Je, { spinning: se && O.length === 0, children: !se && !j && O.length === 0 ? /* @__PURE__ */ o(qe, { description: "暂无站内信" }) : O.length === 0 ? null : /* @__PURE__ */ m(
|
|
407
|
+
Ze,
|
|
386
408
|
{
|
|
387
|
-
wrapperClassName:
|
|
409
|
+
wrapperClassName: P("inbox-bell-list-scroll", r.listScroll),
|
|
388
410
|
className: r.listViewport,
|
|
389
411
|
"data-testid": "inbox-bell-list-scroll",
|
|
390
|
-
onScroll:
|
|
412
|
+
onScroll: _e,
|
|
391
413
|
children: [
|
|
392
|
-
/* @__PURE__ */
|
|
393
|
-
const t =
|
|
394
|
-
|
|
395
|
-
),
|
|
396
|
-
return /* @__PURE__ */
|
|
414
|
+
/* @__PURE__ */ o("ul", { className: r.list, children: O.map((e) => {
|
|
415
|
+
const t = Ee(e.messageType), n = String(e.levelLabel || e.level || "").trim(), l = !!n, i = ze(e.bodyHtml), s = Ge(
|
|
416
|
+
Ke(e)
|
|
417
|
+
), u = $e(e), v = lt(e), p = !!s.primary;
|
|
418
|
+
return /* @__PURE__ */ o("li", { children: /* @__PURE__ */ m(
|
|
397
419
|
"div",
|
|
398
420
|
{
|
|
399
|
-
className:
|
|
421
|
+
className: P(
|
|
400
422
|
r.item,
|
|
401
423
|
!e.read && r.itemUnread,
|
|
402
|
-
|
|
424
|
+
u && r.itemStatic
|
|
403
425
|
),
|
|
404
|
-
role:
|
|
405
|
-
tabIndex:
|
|
406
|
-
onClick:
|
|
407
|
-
onKeyDown:
|
|
408
|
-
(
|
|
426
|
+
role: u ? void 0 : "button",
|
|
427
|
+
tabIndex: u ? void 0 : 0,
|
|
428
|
+
onClick: u ? void 0 : () => void te(e),
|
|
429
|
+
onKeyDown: u ? void 0 : (c) => {
|
|
430
|
+
(c.key === "Enter" || c.key === " ") && (c.preventDefault(), te(e));
|
|
409
431
|
},
|
|
410
432
|
children: [
|
|
411
433
|
/* @__PURE__ */ m("div", { className: r.itemHeader, children: [
|
|
412
434
|
/* @__PURE__ */ m("span", { className: r.itemHeaderLeft, children: [
|
|
413
|
-
/* @__PURE__ */
|
|
414
|
-
t ? /* @__PURE__ */
|
|
415
|
-
|
|
435
|
+
/* @__PURE__ */ o("span", { className: r.itemTitle, title: e.title || "(无标题)", children: e.title || "(无标题)" }),
|
|
436
|
+
t ? /* @__PURE__ */ o(
|
|
437
|
+
oe,
|
|
416
438
|
{
|
|
417
|
-
color:
|
|
439
|
+
color: Se(e.messageType),
|
|
418
440
|
className: r.typeTag,
|
|
419
441
|
children: t
|
|
420
442
|
}
|
|
421
443
|
) : null
|
|
422
444
|
] }),
|
|
423
|
-
/* @__PURE__ */
|
|
445
|
+
/* @__PURE__ */ o("span", { className: r.itemTime, children: e.createdAt || "" })
|
|
424
446
|
] }),
|
|
425
|
-
/* @__PURE__ */
|
|
447
|
+
/* @__PURE__ */ o("div", { className: r.itemBody, children: i ? /* @__PURE__ */ o(
|
|
426
448
|
"div",
|
|
427
449
|
{
|
|
428
450
|
className: r.itemBodyHtml,
|
|
429
451
|
dangerouslySetInnerHTML: { __html: i }
|
|
430
452
|
}
|
|
431
|
-
) : e.summary ? /* @__PURE__ */
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
453
|
+
) : e.summary ? /* @__PURE__ */ o("span", { className: r.itemSummary, children: re(e.summary) }) : null }),
|
|
454
|
+
v ? /* @__PURE__ */ o("span", { className: r.itemMeta, children: v }) : null,
|
|
455
|
+
l ? /* @__PURE__ */ o("div", { className: r.itemFooterTags, children: /* @__PURE__ */ o(
|
|
456
|
+
oe,
|
|
435
457
|
{
|
|
436
|
-
color:
|
|
458
|
+
color: st(e.levelColor),
|
|
437
459
|
className: r.typeTag,
|
|
438
460
|
children: n
|
|
439
461
|
}
|
|
440
462
|
) }) : null,
|
|
441
|
-
|
|
463
|
+
p && s.primary ? /* @__PURE__ */ o(
|
|
442
464
|
"div",
|
|
443
465
|
{
|
|
444
466
|
className: r.itemActions,
|
|
445
|
-
onClick: (
|
|
446
|
-
onKeyDown: (
|
|
447
|
-
children: /* @__PURE__ */ m(
|
|
448
|
-
/* @__PURE__ */
|
|
449
|
-
|
|
467
|
+
onClick: (c) => c.stopPropagation(),
|
|
468
|
+
onKeyDown: (c) => c.stopPropagation(),
|
|
469
|
+
children: /* @__PURE__ */ m(Te, { size: 8, wrap: !0, children: [
|
|
470
|
+
/* @__PURE__ */ o(
|
|
471
|
+
z,
|
|
450
472
|
{
|
|
451
473
|
size: "small",
|
|
452
474
|
type: "primary",
|
|
453
|
-
onClick: () => void
|
|
454
|
-
children:
|
|
475
|
+
onClick: () => void ve(e, s.primary),
|
|
476
|
+
children: s.primary.label
|
|
455
477
|
}
|
|
456
478
|
),
|
|
457
|
-
|
|
458
|
-
|
|
479
|
+
s.secondary ? /* @__PURE__ */ o(
|
|
480
|
+
z,
|
|
459
481
|
{
|
|
460
482
|
size: "small",
|
|
461
483
|
type: "link",
|
|
462
|
-
onClick: () => void
|
|
463
|
-
children:
|
|
484
|
+
onClick: () => void ve(e, s.secondary),
|
|
485
|
+
children: s.secondary.label
|
|
464
486
|
}
|
|
465
487
|
) : null
|
|
466
488
|
] })
|
|
@@ -470,7 +492,7 @@ const vt = De(function({
|
|
|
470
492
|
}
|
|
471
493
|
) }, e.id);
|
|
472
494
|
}) }),
|
|
473
|
-
|
|
495
|
+
Re ? /* @__PURE__ */ o("p", { className: P("inbox-bell-list-footer", r.listFooter), children: "加载中…" }) : null
|
|
474
496
|
]
|
|
475
497
|
}
|
|
476
498
|
) }) })
|
|
@@ -480,17 +502,17 @@ const vt = De(function({
|
|
|
480
502
|
] });
|
|
481
503
|
});
|
|
482
504
|
export {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
505
|
+
Mt as DEFAULT_INBOX_TOAST_PREFS,
|
|
506
|
+
Bt as default,
|
|
507
|
+
Ge as filterInboxActionsForHost,
|
|
508
|
+
Pt as inboxSceneLabel,
|
|
509
|
+
$e as isInboxButtonDriven,
|
|
510
|
+
Rt as isTerminalActionStatus,
|
|
511
|
+
je as loadInboxToastPrefs,
|
|
512
|
+
_t as normalizeInboxActions,
|
|
513
|
+
Ke as resolveInboxItemActions,
|
|
514
|
+
At as resolveInboxSceneKey,
|
|
515
|
+
We as saveInboxToastPrefs,
|
|
516
|
+
Ve as shouldToastForMessageType
|
|
495
517
|
};
|
|
496
518
|
//# sourceMappingURL=InboxBell.js.map
|