@hkyhy/marsun-components-core 0.1.125 → 0.1.126

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