@hkyhy/marsun-components-core 0.1.125 → 0.1.127

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