@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.
- package/dist/_virtual/index.js +5 -5
- package/dist/_virtual/index2.js +5 -5
- package/dist/components/Tools/Inbox/InboxBell/InboxBell.d.ts +5 -4
- package/dist/components/Tools/Inbox/InboxBell/InboxBell.js +346 -292
- package/dist/components/Tools/Inbox/InboxBell/InboxBell.js.map +1 -1
- package/dist/components/Tools/Inbox/InboxBell/inboxItemActions.d.ts +10 -4
- package/dist/components/Tools/Inbox/InboxBell/inboxItemActions.js +44 -46
- package/dist/components/Tools/Inbox/InboxBell/inboxItemActions.js.map +1 -1
- package/dist/components/Tools/Inbox/InboxBell/index.d.ts +1 -1
- package/dist/components/Tools/Inbox/InboxBell/style.module.scss.js +66 -58
- package/dist/components/Tools/Inbox/InboxBell/style.module.scss.js.map +1 -1
- package/dist/components/Tools/Inbox/index.d.ts +1 -1
- package/dist/components/Tools/index.d.ts +1 -1
- package/dist/index.js +74 -73
- package/dist/marsun-components-core.css +1 -1
- package/dist/node_modules/@antv/g-lite/dist/index.esm.js +1 -1
- package/dist/node_modules/@antv/g2/esm/data/kde.js +1 -1
- package/dist/node_modules/eventemitter3/index.js +1 -1
- package/dist/styles/global.css +1 -1
- package/package.json +1 -1
|
@@ -1,134 +1,224 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import { sanitizeInboxHtml as
|
|
6
|
-
import { INBOX_BADGE_REFRESH_EVENT as
|
|
7
|
-
import { emphasizeQuoted as
|
|
8
|
-
import { filterInboxActionsForHost as
|
|
9
|
-
import { inboxSceneLabel as
|
|
10
|
-
import { loadInboxToastPrefs as
|
|
11
|
-
import { DEFAULT_INBOX_TOAST_PREFS as
|
|
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 {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
|
|
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
|
-
],
|
|
25
|
+
], Ve = {
|
|
25
26
|
alert: "预警",
|
|
26
27
|
action: "行动",
|
|
27
28
|
remind: "提醒"
|
|
28
|
-
},
|
|
29
|
-
function
|
|
30
|
-
const
|
|
31
|
-
return
|
|
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
|
|
34
|
-
const
|
|
35
|
-
return
|
|
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
|
|
38
|
-
return [
|
|
38
|
+
function Ye(d) {
|
|
39
|
+
return [d.factory, d.variety, d.metric].map((s) => String(s || "").trim()).filter(Boolean).join(" · ");
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
-
return String(
|
|
41
|
+
function Je(d) {
|
|
42
|
+
return String(d || "").trim() || R.DEFAULT;
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
+
function qe(d) {
|
|
44
45
|
try {
|
|
45
|
-
const
|
|
46
|
-
if (!
|
|
47
|
-
const
|
|
48
|
-
return !
|
|
49
|
-
messageType:
|
|
50
|
-
title:
|
|
51
|
-
summary:
|
|
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
|
|
58
|
-
fetchInbox:
|
|
59
|
-
markRead:
|
|
60
|
-
onNavigate:
|
|
61
|
-
pollMs:
|
|
62
|
-
locationKey:
|
|
63
|
-
pageSize:
|
|
64
|
-
className:
|
|
65
|
-
title:
|
|
66
|
-
streamPath:
|
|
67
|
-
getAccessToken:
|
|
68
|
-
onItemAction:
|
|
69
|
-
},
|
|
70
|
-
const [
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
|
|
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
|
|
83
|
+
const e = await s({
|
|
76
84
|
currentPage: 1,
|
|
77
|
-
pageSize:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
|
|
90
|
+
A([]), L.current = !1, oe(e instanceof Error ? e.message : String(e));
|
|
85
91
|
} finally {
|
|
86
|
-
|
|
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
|
-
}, [
|
|
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
|
|
91
|
-
|
|
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
|
-
}, [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
-
|
|
191
|
+
p();
|
|
104
192
|
}
|
|
105
|
-
}, [
|
|
106
|
-
if (
|
|
193
|
+
}, [te, p]), h(() => {
|
|
194
|
+
if (E <= 0) return;
|
|
107
195
|
const e = window.setInterval(() => {
|
|
108
|
-
|
|
109
|
-
},
|
|
196
|
+
f();
|
|
197
|
+
}, E);
|
|
110
198
|
return () => window.clearInterval(e);
|
|
111
|
-
}, [
|
|
199
|
+
}, [E, f]), h(() => {
|
|
112
200
|
const e = () => {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
},
|
|
116
|
-
},
|
|
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",
|
|
120
|
-
window.removeEventListener("focus", e), document.removeEventListener("visibilitychange",
|
|
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
|
-
}, [
|
|
210
|
+
}, [p]), h(() => {
|
|
123
211
|
const e = () => {
|
|
124
|
-
|
|
212
|
+
p();
|
|
125
213
|
};
|
|
126
|
-
return window.addEventListener(
|
|
127
|
-
}, [
|
|
128
|
-
|
|
129
|
-
|
|
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
|
|
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
|
|
140
|
-
i();
|
|
141
|
-
|
|
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",
|
|
233
|
+
return a.addEventListener("badge", l), a.addEventListener("inbox", l), a.onerror = () => {
|
|
192
234
|
a.close();
|
|
193
235
|
}, () => {
|
|
194
|
-
a.removeEventListener("badge",
|
|
236
|
+
a.removeEventListener("badge", l), a.removeEventListener("inbox", l), a.close();
|
|
195
237
|
};
|
|
196
|
-
}, [
|
|
197
|
-
|
|
198
|
-
}, [
|
|
199
|
-
const
|
|
200
|
-
() =>
|
|
201
|
-
const
|
|
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:
|
|
246
|
+
label: t > 0 ? `${e.label} (${t})` : e.label
|
|
205
247
|
};
|
|
206
248
|
}),
|
|
207
|
-
[
|
|
208
|
-
),
|
|
209
|
-
|
|
210
|
-
const a = { ...o, [e]:
|
|
211
|
-
return
|
|
249
|
+
[se, C]
|
|
250
|
+
), J = (e, t) => {
|
|
251
|
+
Se((o) => {
|
|
252
|
+
const a = { ...o, [e]: t };
|
|
253
|
+
return He(a), a;
|
|
212
254
|
});
|
|
213
|
-
},
|
|
255
|
+
}, q = async (e, t) => {
|
|
214
256
|
if (!e.read)
|
|
215
257
|
try {
|
|
216
|
-
await
|
|
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
|
-
|
|
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 (
|
|
224
|
-
|
|
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),
|
|
269
|
+
o.startsWith("http://") || o.startsWith("https://") ? window.open(o, "_blank", "noopener,noreferrer") : window.location.assign(o), S(!1);
|
|
228
270
|
}
|
|
229
|
-
},
|
|
230
|
-
if (!
|
|
231
|
-
if (
|
|
271
|
+
}, me = async (e, t) => {
|
|
272
|
+
if (!t.disabled) {
|
|
273
|
+
if (ne) {
|
|
232
274
|
try {
|
|
233
|
-
await
|
|
275
|
+
await ne(t.kind, e), S(!1), Y(), f();
|
|
234
276
|
} catch (o) {
|
|
235
|
-
|
|
277
|
+
ye.error(o instanceof Error ? o.message : "操作失败");
|
|
236
278
|
}
|
|
237
279
|
return;
|
|
238
280
|
}
|
|
239
|
-
await
|
|
281
|
+
await q(e);
|
|
240
282
|
}
|
|
241
283
|
};
|
|
242
|
-
return /* @__PURE__ */
|
|
243
|
-
/* @__PURE__ */
|
|
244
|
-
|
|
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__ */
|
|
249
|
-
"aria-label":
|
|
250
|
-
onClick: () =>
|
|
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__ */
|
|
254
|
-
|
|
295
|
+
/* @__PURE__ */ u(
|
|
296
|
+
Ce,
|
|
255
297
|
{
|
|
256
|
-
title:
|
|
257
|
-
open:
|
|
258
|
-
onClose: () =>
|
|
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__ */
|
|
268
|
-
|
|
309
|
+
/* @__PURE__ */ r(
|
|
310
|
+
Ue,
|
|
269
311
|
{
|
|
270
312
|
className: n.typeTabs,
|
|
271
313
|
size: "small",
|
|
272
|
-
activeKey:
|
|
273
|
-
onChange: (e) =>
|
|
274
|
-
stateOption:
|
|
314
|
+
activeKey: V || "all",
|
|
315
|
+
onChange: (e) => Ne(e === "all" ? "" : e),
|
|
316
|
+
stateOption: ke,
|
|
275
317
|
isInner: !0
|
|
276
318
|
}
|
|
277
319
|
),
|
|
278
|
-
/* @__PURE__ */
|
|
279
|
-
|
|
320
|
+
/* @__PURE__ */ r("div", { className: n.filterRow, children: /* @__PURE__ */ r(
|
|
321
|
+
ze,
|
|
280
322
|
{
|
|
281
323
|
size: "small",
|
|
282
|
-
value:
|
|
283
|
-
onChange: (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__ */
|
|
292
|
-
/* @__PURE__ */
|
|
293
|
-
/* @__PURE__ */
|
|
294
|
-
/* @__PURE__ */
|
|
295
|
-
/* @__PURE__ */
|
|
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:
|
|
299
|
-
onChange: (e) =>
|
|
340
|
+
checked: P.alert,
|
|
341
|
+
onChange: (e) => J("alert", e.target.checked),
|
|
300
342
|
children: "预警弹出"
|
|
301
343
|
}
|
|
302
344
|
),
|
|
303
|
-
/* @__PURE__ */
|
|
304
|
-
|
|
345
|
+
/* @__PURE__ */ r(
|
|
346
|
+
Z,
|
|
305
347
|
{
|
|
306
|
-
checked:
|
|
307
|
-
onChange: (e) =>
|
|
348
|
+
checked: P.action,
|
|
349
|
+
onChange: (e) => J("action", e.target.checked),
|
|
308
350
|
children: "行动弹出"
|
|
309
351
|
}
|
|
310
352
|
),
|
|
311
|
-
/* @__PURE__ */
|
|
312
|
-
|
|
353
|
+
/* @__PURE__ */ r(
|
|
354
|
+
Z,
|
|
313
355
|
{
|
|
314
|
-
checked:
|
|
315
|
-
onChange: (e) =>
|
|
356
|
+
checked: P.remind,
|
|
357
|
+
onChange: (e) => J("remind", e.target.checked),
|
|
316
358
|
children: "提醒弹出"
|
|
317
359
|
}
|
|
318
360
|
)
|
|
319
361
|
] })
|
|
320
362
|
] }),
|
|
321
|
-
|
|
322
|
-
/* @__PURE__ */
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
className:
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
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:
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
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
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
children: f.primary.label
|
|
416
|
+
color: Je(e.levelColor),
|
|
417
|
+
className: n.typeTag,
|
|
418
|
+
children: o
|
|
386
419
|
}
|
|
387
|
-
),
|
|
388
|
-
|
|
389
|
-
|
|
420
|
+
) }) : null,
|
|
421
|
+
y && c.primary ? /* @__PURE__ */ r(
|
|
422
|
+
"div",
|
|
390
423
|
{
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
children:
|
|
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
|
-
)
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
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
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
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
|