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