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