@hkyhy/marsun-components-core 0.1.127 → 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 +356 -314
- 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/components/Tools/Inbox/index.d.ts +1 -0
- package/dist/components/Tools/Inbox/requestInboxBadgeRefresh.d.ts +11 -2
- package/dist/components/Tools/Inbox/requestInboxBadgeRefresh.js +10 -10
- package/dist/components/Tools/Inbox/requestInboxBadgeRefresh.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,328 +1,370 @@
|
|
|
1
|
-
import { jsxs 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 {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { Bell as
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
|
|
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";
|
|
13
|
+
import r from "./style.module.scss.js";
|
|
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 [d.factory, d.variety, d.metric].map((
|
|
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(d || "").trim() ||
|
|
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
|
|
49
|
-
return !
|
|
50
|
-
messageType:
|
|
51
|
-
title:
|
|
52
|
-
summary:
|
|
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 : {
|
|
51
|
+
messageType: M || void 0,
|
|
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:
|
|
60
|
-
markRead:
|
|
61
|
-
onNavigate:
|
|
62
|
-
pollMs:
|
|
63
|
-
locationKey:
|
|
64
|
-
pageSize:
|
|
65
|
-
className:
|
|
66
|
-
title:
|
|
67
|
-
streamPath:
|
|
68
|
-
getAccessToken:
|
|
69
|
-
onItemAction:
|
|
70
|
-
},
|
|
71
|
-
const [
|
|
72
|
-
|
|
73
|
-
const
|
|
59
|
+
const Bt = He(function({
|
|
60
|
+
fetchInbox: a,
|
|
61
|
+
markRead: M,
|
|
62
|
+
onNavigate: R,
|
|
63
|
+
pollMs: B = 0,
|
|
64
|
+
locationKey: ae,
|
|
65
|
+
pageSize: E = 20,
|
|
66
|
+
className: Le,
|
|
67
|
+
title: ke = "站内信",
|
|
68
|
+
streamPath: G = "/api/v1/msg-center/inbox/stream",
|
|
69
|
+
getAccessToken: K,
|
|
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
|
-
messageType:
|
|
76
|
-
unreadOnly:
|
|
77
|
-
readOnly:
|
|
76
|
+
messageType: W || void 0,
|
|
77
|
+
unreadOnly: F === "unread" || void 0,
|
|
78
|
+
readOnly: F === "read" || void 0
|
|
78
79
|
}),
|
|
79
|
-
[
|
|
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
|
-
...
|
|
87
|
-
}), t = (e == null ? void 0 : e.pageData) || [],
|
|
88
|
-
|
|
86
|
+
pageSize: E,
|
|
87
|
+
...U
|
|
88
|
+
}), t = (e == null ? void 0 : e.pageData) || [], n = typeof (e == null ? void 0 : e.total) == "number" ? e.total : t.length;
|
|
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
|
-
}),
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
return
|
|
106
|
-
}),
|
|
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
|
-
fe.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
) : null
|
|
145
|
-
] }),
|
|
146
|
-
message: /* @__PURE__ */ u("div", { className: n.toastHead, children: [
|
|
147
|
-
/* @__PURE__ */ r("span", { className: n.toastTitle, children: F(t) }),
|
|
148
|
-
a ? /* @__PURE__ */ r(
|
|
149
|
-
U,
|
|
150
|
-
{
|
|
151
|
-
color: ee(e.messageType),
|
|
152
|
-
className: n.typeTag,
|
|
153
|
-
children: a
|
|
154
|
-
}
|
|
155
|
-
) : null
|
|
156
|
-
] }),
|
|
157
|
-
description: /* @__PURE__ */ u("div", { className: n.toastBody, children: [
|
|
158
|
-
o ? /* @__PURE__ */ r("div", { className: n.toastDesc, children: F(o) }) : null,
|
|
159
|
-
/* @__PURE__ */ r("div", { className: n.toastActions, children: /* @__PURE__ */ r(
|
|
160
|
-
H,
|
|
161
|
-
{
|
|
162
|
-
type: "primary",
|
|
163
|
-
size: "small",
|
|
164
|
-
onClick: (i) => {
|
|
165
|
-
i.stopPropagation(), l();
|
|
166
|
-
},
|
|
167
|
-
children: "查看"
|
|
168
|
-
}
|
|
169
|
-
) })
|
|
170
|
-
] }),
|
|
171
|
-
placement: "topRight",
|
|
172
|
-
duration: 6,
|
|
173
|
-
onClick: l
|
|
174
|
-
});
|
|
175
|
-
}, []), p = k(
|
|
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
|
-
}, [
|
|
211
|
-
const e = () => {
|
|
212
|
-
|
|
178
|
+
}, [w]), T(() => {
|
|
179
|
+
const e = (t) => {
|
|
180
|
+
const n = t.detail;
|
|
181
|
+
w((n == null ? void 0 : n.preview) || void 0);
|
|
213
182
|
};
|
|
214
|
-
return window.addEventListener(
|
|
215
|
-
}, [
|
|
216
|
-
|
|
217
|
-
}, []),
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
if (!
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
const
|
|
231
|
-
|
|
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);
|
|
188
|
+
}, []), T(() => {
|
|
189
|
+
if (G === !1 || typeof K != "function" || typeof window > "u" || typeof EventSource > "u") return;
|
|
190
|
+
const e = String(G || "/api/v1/msg-center/inbox/stream").trim();
|
|
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 = () => {
|
|
204
|
+
if (t) return;
|
|
205
|
+
const c = String(K() || "").trim();
|
|
206
|
+
if (!c) {
|
|
207
|
+
v();
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
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);
|
|
213
|
+
try {
|
|
214
|
+
n = new EventSource(k.toString());
|
|
215
|
+
} catch {
|
|
216
|
+
v();
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
n.addEventListener("badge", s), n.addEventListener("inbox", s), n.onopen = () => {
|
|
220
|
+
i = 0;
|
|
221
|
+
}, n.onerror = () => {
|
|
222
|
+
t || (n == null || n.close(), n = null, v());
|
|
223
|
+
};
|
|
232
224
|
};
|
|
233
|
-
return
|
|
234
|
-
|
|
235
|
-
}, () => {
|
|
236
|
-
a.removeEventListener("badge", l), a.removeEventListener("inbox", l), a.close();
|
|
225
|
+
return p(), () => {
|
|
226
|
+
t = !0, u(), n && (n.removeEventListener("badge", s), n.removeEventListener("inbox", s), n.close(), n = null);
|
|
237
227
|
};
|
|
238
|
-
}, [
|
|
239
|
-
|
|
240
|
-
}, [
|
|
241
|
-
const
|
|
242
|
-
() =>
|
|
243
|
-
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 : _;
|
|
244
234
|
return {
|
|
245
235
|
key: e.key || "all",
|
|
246
236
|
label: t > 0 ? `${e.label} (${t})` : e.label
|
|
247
237
|
};
|
|
248
238
|
}),
|
|
249
|
-
[
|
|
250
|
-
),
|
|
251
|
-
|
|
252
|
-
const
|
|
253
|
-
return
|
|
239
|
+
[de, _]
|
|
240
|
+
), ee = (e, t) => {
|
|
241
|
+
Pe((n) => {
|
|
242
|
+
const l = { ...n, [e]: t };
|
|
243
|
+
return We(l), l;
|
|
254
244
|
});
|
|
255
|
-
},
|
|
245
|
+
}, te = async (e, t) => {
|
|
256
246
|
if (!e.read)
|
|
257
247
|
try {
|
|
258
|
-
await
|
|
259
|
-
} catch (
|
|
260
|
-
|
|
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 : "标记已读失败");
|
|
261
251
|
return;
|
|
262
252
|
}
|
|
263
|
-
const
|
|
264
|
-
if (
|
|
265
|
-
if (
|
|
266
|
-
|
|
253
|
+
const n = String(e.href || "").trim();
|
|
254
|
+
if (n) {
|
|
255
|
+
if (R) {
|
|
256
|
+
R(n, e), x(!1);
|
|
267
257
|
return;
|
|
268
258
|
}
|
|
269
|
-
|
|
259
|
+
n.startsWith("http://") || n.startsWith("https://") ? window.open(n, "_blank", "noopener,noreferrer") : window.location.assign(n), x(!1);
|
|
270
260
|
}
|
|
271
|
-
},
|
|
261
|
+
}, ve = async (e, t) => {
|
|
272
262
|
if (!t.disabled) {
|
|
273
|
-
if (
|
|
263
|
+
if (le) {
|
|
274
264
|
try {
|
|
275
|
-
await
|
|
276
|
-
} catch (
|
|
277
|
-
|
|
265
|
+
await le(t.kind, e), x(!1), q(), g();
|
|
266
|
+
} catch (n) {
|
|
267
|
+
be.error(n instanceof Error ? n.message : "操作失败");
|
|
278
268
|
}
|
|
279
269
|
return;
|
|
280
270
|
}
|
|
281
|
-
await
|
|
271
|
+
await te(e);
|
|
282
272
|
}
|
|
283
|
-
};
|
|
284
|
-
return /* @__PURE__ */
|
|
285
|
-
/* @__PURE__ */
|
|
286
|
-
|
|
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,
|
|
287
277
|
{
|
|
288
278
|
type: "text",
|
|
289
|
-
className:
|
|
290
|
-
icon: /* @__PURE__ */
|
|
291
|
-
"aria-label":
|
|
292
|
-
onClick: () =>
|
|
279
|
+
className: r.bellBtn,
|
|
280
|
+
icon: /* @__PURE__ */ o(Qe, { size: 16, "aria-hidden": !0 }),
|
|
281
|
+
"aria-label": _ > 0 ? `站内信,${_} 条未读` : "站内信",
|
|
282
|
+
onClick: () => x(!0)
|
|
293
283
|
}
|
|
294
284
|
) }),
|
|
295
|
-
|
|
296
|
-
|
|
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,
|
|
337
|
+
/* @__PURE__ */ m(
|
|
338
|
+
Ie,
|
|
297
339
|
{
|
|
298
|
-
title:
|
|
299
|
-
open:
|
|
300
|
-
onClose: () =>
|
|
340
|
+
title: ke,
|
|
341
|
+
open: $,
|
|
342
|
+
onClose: () => x(!1),
|
|
301
343
|
size: 420,
|
|
302
344
|
destroyOnClose: !1,
|
|
303
|
-
className:
|
|
345
|
+
className: r.drawer,
|
|
304
346
|
styles: {
|
|
305
347
|
header: { padding: "12px 16px" },
|
|
306
348
|
body: { padding: "12px 16px" }
|
|
307
349
|
},
|
|
308
350
|
children: [
|
|
309
|
-
/* @__PURE__ */
|
|
310
|
-
|
|
351
|
+
/* @__PURE__ */ o(
|
|
352
|
+
Xe,
|
|
311
353
|
{
|
|
312
|
-
className:
|
|
354
|
+
className: r.typeTabs,
|
|
313
355
|
size: "small",
|
|
314
|
-
activeKey:
|
|
315
|
-
onChange: (e) =>
|
|
316
|
-
stateOption:
|
|
356
|
+
activeKey: W || "all",
|
|
357
|
+
onChange: (e) => xe(e === "all" ? "" : e),
|
|
358
|
+
stateOption: Ae,
|
|
317
359
|
isInner: !0
|
|
318
360
|
}
|
|
319
361
|
),
|
|
320
|
-
/* @__PURE__ */
|
|
321
|
-
|
|
362
|
+
/* @__PURE__ */ o("div", { className: r.filterRow, children: /* @__PURE__ */ o(
|
|
363
|
+
Ye,
|
|
322
364
|
{
|
|
323
365
|
size: "small",
|
|
324
|
-
value:
|
|
325
|
-
onChange: (e) =>
|
|
366
|
+
value: F,
|
|
367
|
+
onChange: (e) => Ce(e),
|
|
326
368
|
options: [
|
|
327
369
|
{ value: "all", label: "全部" },
|
|
328
370
|
{ value: "unread", label: "未读" },
|
|
@@ -330,117 +372,117 @@ const gt = Pe(function({
|
|
|
330
372
|
]
|
|
331
373
|
}
|
|
332
374
|
) }),
|
|
333
|
-
/* @__PURE__ */
|
|
334
|
-
/* @__PURE__ */
|
|
335
|
-
/* @__PURE__ */
|
|
336
|
-
/* @__PURE__ */
|
|
337
|
-
/* @__PURE__ */
|
|
338
|
-
|
|
375
|
+
/* @__PURE__ */ m("div", { className: r.toastPrefs, "data-testid": "inbox-toast-prefs", children: [
|
|
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,
|
|
339
381
|
{
|
|
340
|
-
checked:
|
|
341
|
-
onChange: (e) =>
|
|
382
|
+
checked: A.alert,
|
|
383
|
+
onChange: (e) => ee("alert", e.target.checked),
|
|
342
384
|
children: "预警弹出"
|
|
343
385
|
}
|
|
344
386
|
),
|
|
345
|
-
/* @__PURE__ */
|
|
346
|
-
|
|
387
|
+
/* @__PURE__ */ o(
|
|
388
|
+
ne,
|
|
347
389
|
{
|
|
348
|
-
checked:
|
|
349
|
-
onChange: (e) =>
|
|
390
|
+
checked: A.action,
|
|
391
|
+
onChange: (e) => ee("action", e.target.checked),
|
|
350
392
|
children: "行动弹出"
|
|
351
393
|
}
|
|
352
394
|
),
|
|
353
|
-
/* @__PURE__ */
|
|
354
|
-
|
|
395
|
+
/* @__PURE__ */ o(
|
|
396
|
+
ne,
|
|
355
397
|
{
|
|
356
|
-
checked:
|
|
357
|
-
onChange: (e) =>
|
|
398
|
+
checked: A.remind,
|
|
399
|
+
onChange: (e) => ee("remind", e.target.checked),
|
|
358
400
|
children: "提醒弹出"
|
|
359
401
|
}
|
|
360
402
|
)
|
|
361
403
|
] })
|
|
362
404
|
] }),
|
|
363
|
-
|
|
364
|
-
/* @__PURE__ */
|
|
365
|
-
|
|
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,
|
|
366
408
|
{
|
|
367
|
-
wrapperClassName:
|
|
368
|
-
className:
|
|
409
|
+
wrapperClassName: P("inbox-bell-list-scroll", r.listScroll),
|
|
410
|
+
className: r.listViewport,
|
|
369
411
|
"data-testid": "inbox-bell-list-scroll",
|
|
370
|
-
onScroll:
|
|
412
|
+
onScroll: _e,
|
|
371
413
|
children: [
|
|
372
|
-
/* @__PURE__ */
|
|
373
|
-
const t =
|
|
374
|
-
|
|
375
|
-
),
|
|
376
|
-
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(
|
|
377
419
|
"div",
|
|
378
420
|
{
|
|
379
|
-
className:
|
|
380
|
-
|
|
381
|
-
!e.read &&
|
|
382
|
-
|
|
421
|
+
className: P(
|
|
422
|
+
r.item,
|
|
423
|
+
!e.read && r.itemUnread,
|
|
424
|
+
u && r.itemStatic
|
|
383
425
|
),
|
|
384
|
-
role:
|
|
385
|
-
tabIndex:
|
|
386
|
-
onClick:
|
|
387
|
-
onKeyDown:
|
|
388
|
-
(
|
|
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));
|
|
389
431
|
},
|
|
390
432
|
children: [
|
|
391
|
-
/* @__PURE__ */
|
|
392
|
-
/* @__PURE__ */
|
|
393
|
-
/* @__PURE__ */
|
|
394
|
-
t ? /* @__PURE__ */
|
|
395
|
-
|
|
433
|
+
/* @__PURE__ */ m("div", { className: r.itemHeader, children: [
|
|
434
|
+
/* @__PURE__ */ m("span", { className: r.itemHeaderLeft, children: [
|
|
435
|
+
/* @__PURE__ */ o("span", { className: r.itemTitle, title: e.title || "(无标题)", children: e.title || "(无标题)" }),
|
|
436
|
+
t ? /* @__PURE__ */ o(
|
|
437
|
+
oe,
|
|
396
438
|
{
|
|
397
|
-
color:
|
|
398
|
-
className:
|
|
439
|
+
color: Se(e.messageType),
|
|
440
|
+
className: r.typeTag,
|
|
399
441
|
children: t
|
|
400
442
|
}
|
|
401
443
|
) : null
|
|
402
444
|
] }),
|
|
403
|
-
/* @__PURE__ */
|
|
445
|
+
/* @__PURE__ */ o("span", { className: r.itemTime, children: e.createdAt || "" })
|
|
404
446
|
] }),
|
|
405
|
-
/* @__PURE__ */
|
|
447
|
+
/* @__PURE__ */ o("div", { className: r.itemBody, children: i ? /* @__PURE__ */ o(
|
|
406
448
|
"div",
|
|
407
449
|
{
|
|
408
|
-
className:
|
|
409
|
-
dangerouslySetInnerHTML: { __html:
|
|
450
|
+
className: r.itemBodyHtml,
|
|
451
|
+
dangerouslySetInnerHTML: { __html: i }
|
|
410
452
|
}
|
|
411
|
-
) : e.summary ? /* @__PURE__ */
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
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,
|
|
415
457
|
{
|
|
416
|
-
color:
|
|
417
|
-
className:
|
|
418
|
-
children:
|
|
458
|
+
color: st(e.levelColor),
|
|
459
|
+
className: r.typeTag,
|
|
460
|
+
children: n
|
|
419
461
|
}
|
|
420
462
|
) }) : null,
|
|
421
|
-
|
|
463
|
+
p && s.primary ? /* @__PURE__ */ o(
|
|
422
464
|
"div",
|
|
423
465
|
{
|
|
424
|
-
className:
|
|
425
|
-
onClick: (
|
|
426
|
-
onKeyDown: (
|
|
427
|
-
children: /* @__PURE__ */
|
|
428
|
-
/* @__PURE__ */
|
|
429
|
-
|
|
466
|
+
className: r.itemActions,
|
|
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,
|
|
430
472
|
{
|
|
431
473
|
size: "small",
|
|
432
474
|
type: "primary",
|
|
433
|
-
onClick: () => void
|
|
434
|
-
children:
|
|
475
|
+
onClick: () => void ve(e, s.primary),
|
|
476
|
+
children: s.primary.label
|
|
435
477
|
}
|
|
436
478
|
),
|
|
437
|
-
|
|
438
|
-
|
|
479
|
+
s.secondary ? /* @__PURE__ */ o(
|
|
480
|
+
z,
|
|
439
481
|
{
|
|
440
482
|
size: "small",
|
|
441
483
|
type: "link",
|
|
442
|
-
onClick: () => void
|
|
443
|
-
children:
|
|
484
|
+
onClick: () => void ve(e, s.secondary),
|
|
485
|
+
children: s.secondary.label
|
|
444
486
|
}
|
|
445
487
|
) : null
|
|
446
488
|
] })
|
|
@@ -450,7 +492,7 @@ const gt = Pe(function({
|
|
|
450
492
|
}
|
|
451
493
|
) }, e.id);
|
|
452
494
|
}) }),
|
|
453
|
-
|
|
495
|
+
Re ? /* @__PURE__ */ o("p", { className: P("inbox-bell-list-footer", r.listFooter), children: "加载中…" }) : null
|
|
454
496
|
]
|
|
455
497
|
}
|
|
456
498
|
) }) })
|
|
@@ -460,17 +502,17 @@ const gt = Pe(function({
|
|
|
460
502
|
] });
|
|
461
503
|
});
|
|
462
504
|
export {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
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
|
|
475
517
|
};
|
|
476
518
|
//# sourceMappingURL=InboxBell.js.map
|