@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.
@@ -1,328 +1,341 @@
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";
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 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 = [
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
- ], nt = {
26
+ ], lt = {
27
27
  alert: "预警",
28
28
  action: "行动",
29
29
  remind: "提醒"
30
- }, rt = 300, ot = 1500, at = 72;
31
- function Ee(d) {
32
- const a = String(d || "").trim().toLowerCase();
33
- return a ? nt[a] || a : "";
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 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;
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 lt(d) {
40
- return [d.factory, d.variety, d.metric].map((a) => String(a || "").trim()).filter(Boolean).join(" · ");
39
+ function dt(u) {
40
+ return [u.factory, u.variety, u.metric].map((o) => String(o || "").trim()).filter(Boolean).join(" · ");
41
41
  }
42
- function st(d) {
43
- return String(d || "").trim() || D.DEFAULT;
42
+ function ut(u) {
43
+ return String(u || "").trim() || A.DEFAULT;
44
44
  }
45
- function it(d) {
45
+ function mt(u) {
46
46
  try {
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
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 Bt = He(function({
60
- fetchInbox: a,
61
- markRead: M,
62
- onNavigate: R,
63
- pollMs: B = 0,
64
- locationKey: ae,
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: 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(
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: W || void 0,
77
+ messageType: Y || void 0,
77
78
  unreadOnly: F === "unread" || void 0,
78
79
  readOnly: F === "read" || void 0
79
80
  }),
80
- [W, F]
81
- ), q = N(async () => {
82
- ie(!0), ce(""), Y.current = 1, C.current = !1;
81
+ [Y, F]
82
+ ), G = N(async () => {
83
+ ue(!0), me(""), ee.current = 1, P.current = !1;
83
84
  try {
84
- const e = await a({
85
+ const e = await o({
85
86
  currentPage: 1,
86
87
  pageSize: E,
87
- ...U
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
- 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) || {});
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
- I([]), C.current = !1, ce(e instanceof Error ? e.message : String(e));
92
+ H([]), P.current = !1, me(e instanceof Error ? e.message : String(e));
92
93
  } finally {
93
- ie(!1);
94
+ ue(!1);
94
95
  }
95
- }, [a, E, U]), pe = N(async () => {
96
- if (!(J.current || !C.current)) {
97
- J.current = !0, ue(!0);
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 = Y.current + 1, t = await a({
100
+ const e = ee.current + 1, t = await o({
100
101
  currentPage: e,
101
102
  pageSize: E,
102
- ...U
103
+ ...z
103
104
  }), 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);
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
- C.current = !1;
110
+ P.current = !1;
110
111
  } finally {
111
- J.current = !1, ue(!1);
112
+ te.current = !1, pe(!1);
112
113
  }
113
114
  }
114
- }, [a, E, U]), _e = N(
115
+ }, [o, E, z]), Ae = N(
115
116
  (e) => {
116
117
  const t = e.currentTarget;
117
- t.scrollHeight - t.scrollTop - t.clientHeight <= at && pe();
118
+ t.scrollHeight - t.scrollTop - t.clientHeight <= ct && ve();
118
119
  },
119
- [pe]
120
+ [ve]
120
121
  ), g = N(async () => {
121
122
  try {
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
+ 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
- }, [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);
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
- Q({
136
+ q({
136
137
  key: t,
137
138
  title: e.title || "新站内信",
138
139
  summary: e.summary || "",
139
140
  messageType: e.messageType
140
- }), f.current = window.setTimeout(() => {
141
- f.current = null, Q(null);
142
- }, et);
141
+ }), p.current = window.setTimeout(() => {
142
+ p.current = null, q(null);
143
+ }, at);
143
144
  }, []), w = N(
144
145
  (e) => {
145
- e && (X.current = e, ge()), L.current != null && window.clearTimeout(L.current), L.current = window.setTimeout(() => {
146
- L.current = null, g();
147
- }, ot);
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, ge]
150
+ [g, be]
150
151
  );
151
- Fe(Be, () => ({ refreshBadge: g }), [g]), T(() => {
152
+ $e(Pe, () => ({ refreshBadge: g }), [g]), T(() => {
152
153
  g();
153
154
  }, [g]), T(() => {
154
- if (ae !== void 0) {
155
- if (!me.current) {
156
- me.current = !0;
155
+ if (ie !== void 0) {
156
+ if (!ge.current) {
157
+ ge.current = !0;
157
158
  return;
158
159
  }
159
160
  w();
160
161
  }
161
- }, [ae, w]), T(() => {
162
- if (B <= 0) return;
162
+ }, [ie, w]), T(() => {
163
+ if (K <= 0) return;
163
164
  const e = window.setInterval(() => {
164
165
  g();
165
- }, B);
166
+ }, K);
166
167
  return () => window.clearInterval(e);
167
- }, [B, g]), T(() => {
168
+ }, [K, g]), T(() => {
168
169
  const e = () => {
169
- S.current != null && window.clearTimeout(S.current), S.current = window.setTimeout(() => {
170
- S.current = null, w();
171
- }, rt);
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), S.current != null && (window.clearTimeout(S.current), S.current = null);
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(Ne, e), () => window.removeEventListener(Ne, e);
184
+ return window.addEventListener(Le, e), () => window.removeEventListener(Le, e);
184
185
  }, [w]), T(() => {
185
- Me.destroy();
186
+ Ue.destroy();
186
187
  }, []), T(() => () => {
187
- L.current != null && (window.clearTimeout(L.current), L.current = null), f.current != null && (window.clearTimeout(f.current), f.current = null);
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 (G === !1 || typeof K != "function" || typeof window > "u" || typeof EventSource > "u") return;
190
- const e = String(G || "/api/v1/msg-center/inbox/stream").trim();
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 k = c, De = typeof (k == null ? void 0 : k.data) == "string" ? it(k.data) : null;
194
- w(De);
195
- }, u = () => {
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
- }, v = () => {
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, p();
202
+ l = null, y();
202
203
  }, c);
203
- }, p = () => {
204
+ }, y = () => {
204
205
  if (t) return;
205
- const c = String(K() || "").trim();
206
+ const c = String(V() || "").trim();
206
207
  if (!c) {
207
- v();
208
+ h();
208
209
  return;
209
210
  }
210
211
  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);
212
+ const B = new URL(e, window.location.origin);
213
+ B.searchParams.set("access_token", c);
213
214
  try {
214
- n = new EventSource(k.toString());
215
+ n = new EventSource(B.toString());
215
216
  } catch {
216
- v();
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, v());
223
+ t || (n == null || n.close(), n = null, h());
223
224
  };
224
225
  };
225
- return p(), () => {
226
- t = !0, u(), n && (n.removeEventListener("badge", s), n.removeEventListener("inbox", s), n.close(), n = null);
226
+ return y(), () => {
227
+ t = !0, m(), n && (n.removeEventListener("badge", s), n.removeEventListener("inbox", s), n.close(), n = null);
227
228
  };
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 : _;
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
- [de, _]
240
- ), ee = (e, t) => {
241
- Pe((n) => {
240
+ [fe, S]
241
+ ), re = (e, t) => {
242
+ De((n) => {
242
243
  const l = { ...n, [e]: t };
243
- return We(l), l;
244
+ return Je(l), l;
244
245
  });
245
- }, te = async (e, t) => {
246
+ }, ae = async (e, t) => {
246
247
  if (!e.read)
247
248
  try {
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
+ 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
- be.error(l instanceof Error ? l.message : "标记已读失败");
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 (R) {
256
- R(n, e), x(!1);
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
- }, ve = async (e, t) => {
262
+ }, we = async (e, t) => {
262
263
  if (!t.disabled) {
263
- if (le) {
264
+ if (ce) {
264
265
  try {
265
- await le(t.kind, e), x(!1), q(), g();
266
+ await ce(t.kind, e), x(!1), G(), g();
266
267
  } catch (n) {
267
- be.error(n instanceof Error ? n.message : "操作失败");
268
+ $.error(n instanceof Error ? n.message : "操作失败");
268
269
  }
269
270
  return;
270
271
  }
271
- await te(e);
272
+ await ae(e);
272
273
  }
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,
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__ */ o(Qe, { size: 16, "aria-hidden": !0 }),
281
- "aria-label": _ > 0 ? `站内信,${_} 条未读` : "站内信",
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" ? Ue(
286
- /* @__PURE__ */ o("div", { className: r.toastHost, "data-testid": "inbox-live-toast-host", children: /* @__PURE__ */ m(
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: P("marsun-inbox-toast", r.toastNotice),
302
+ className: R("marsun-inbox-toast", r.toastNotice),
290
303
  role: "alert",
291
304
  "data-testid": "inbox-live-toast",
292
- onClick: ye,
305
+ onClick: Te,
293
306
  children: [
294
- /* @__PURE__ */ o(
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(), Z();
314
+ e.stopPropagation(), ne();
302
315
  },
303
316
  children: "×"
304
317
  }
305
318
  ),
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,
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: Se(b.messageType),
324
+ color: Be(b.messageType),
312
325
  className: r.typeTag,
313
- children: he
326
+ children: Ne
314
327
  }
315
328
  ) : null
316
329
  ] }),
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,
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(), ye();
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__ */ m(
338
- Ie,
350
+ /* @__PURE__ */ d(
351
+ ze,
339
352
  {
340
- title: ke,
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__ */ o(
352
- Xe,
364
+ /* @__PURE__ */ a(
365
+ Ze,
353
366
  {
354
367
  className: r.typeTabs,
355
368
  size: "small",
356
- activeKey: W || "all",
357
- onChange: (e) => xe(e === "all" ? "" : e),
358
- stateOption: Ae,
369
+ activeKey: Y || "all",
370
+ onChange: (e) => Re(e === "all" ? "" : e),
371
+ stateOption: Oe,
359
372
  isInner: !0
360
373
  }
361
374
  ),
362
- /* @__PURE__ */ o("div", { className: r.filterRow, children: /* @__PURE__ */ o(
363
- Ye,
364
- {
365
- size: "small",
366
- value: F,
367
- onChange: (e) => Ce(e),
368
- options: [
369
- { value: "all", label: "全部" },
370
- { value: "unread", label: "未读" },
371
- { value: "read", label: "已读" }
372
- ]
373
- }
374
- ) }),
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,
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: A.alert,
383
- onChange: (e) => ee("alert", e.target.checked),
410
+ checked: D.alert,
411
+ onChange: (e) => re("alert", e.target.checked),
384
412
  children: "预警弹出"
385
413
  }
386
414
  ),
387
- /* @__PURE__ */ o(
388
- ne,
415
+ /* @__PURE__ */ a(
416
+ oe,
389
417
  {
390
- checked: A.action,
391
- onChange: (e) => ee("action", e.target.checked),
418
+ checked: D.action,
419
+ onChange: (e) => re("action", e.target.checked),
392
420
  children: "行动弹出"
393
421
  }
394
422
  ),
395
- /* @__PURE__ */ o(
396
- ne,
423
+ /* @__PURE__ */ a(
424
+ oe,
397
425
  {
398
- checked: A.remind,
399
- onChange: (e) => ee("remind", e.target.checked),
426
+ checked: D.remind,
427
+ onChange: (e) => re("remind", e.target.checked),
400
428
  children: "提醒弹出"
401
429
  }
402
430
  )
403
431
  ] })
404
432
  ] }),
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,
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: P("inbox-bell-list-scroll", r.listScroll),
437
+ wrapperClassName: R("inbox-bell-list-scroll", r.listScroll),
410
438
  className: r.listViewport,
411
439
  "data-testid": "inbox-bell-list-scroll",
412
- onScroll: _e,
440
+ onScroll: Ae,
413
441
  children: [
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(
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: P(
449
+ className: R(
422
450
  r.item,
423
451
  !e.read && r.itemUnread,
424
- u && r.itemStatic
452
+ m && r.itemStatic
425
453
  ),
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));
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__ */ 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,
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: Se(e.messageType),
467
+ color: Be(e.messageType),
440
468
  className: r.typeTag,
441
469
  children: t
442
470
  }
443
471
  ) : null
444
472
  ] }),
445
- /* @__PURE__ */ o("span", { className: r.itemTime, children: e.createdAt || "" })
473
+ /* @__PURE__ */ a("span", { className: r.itemTime, children: e.createdAt || "" })
446
474
  ] }),
447
- /* @__PURE__ */ o("div", { className: r.itemBody, children: i ? /* @__PURE__ */ o(
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__ */ 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,
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: st(e.levelColor),
486
+ color: ut(e.levelColor),
459
487
  selected: !0,
460
488
  className: r.typeTag,
461
489
  children: n
462
490
  }
463
491
  ) }) : null,
464
- p && s.primary ? /* @__PURE__ */ o(
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__ */ m(Te, { size: 8, wrap: !0, children: [
471
- /* @__PURE__ */ o(
472
- z,
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 ve(e, s.primary),
504
+ onClick: () => void we(e, s.primary),
477
505
  children: s.primary.label
478
506
  }
479
507
  ),
480
- s.secondary ? /* @__PURE__ */ o(
481
- z,
508
+ s.secondary ? /* @__PURE__ */ a(
509
+ M,
482
510
  {
483
511
  size: "small",
484
512
  type: "link",
485
- onClick: () => void ve(e, s.secondary),
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
- Re ? /* @__PURE__ */ o("p", { className: P("inbox-bell-list-footer", r.listFooter), children: "加载中…" }) : null
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
- Mt as DEFAULT_INBOX_TOAST_PREFS,
507
- Bt as default,
508
- Ge as filterInboxActionsForHost,
509
- Pt as inboxSceneLabel,
510
- $e as isInboxButtonDriven,
511
- Rt as isTerminalActionStatus,
512
- je as loadInboxToastPrefs,
513
- _t as normalizeInboxActions,
514
- Ke as resolveInboxItemActions,
515
- At as resolveInboxSceneKey,
516
- We as saveInboxToastPrefs,
517
- Ve as shouldToastForMessageType
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