@qiqb/message-domain 0.0.0-stage → 0.1.3

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.
Files changed (57) hide show
  1. package/README.md +213 -2
  2. package/build/components/DefaultMessageReminderRenderer.d.ts +10 -0
  3. package/build/components/DefaultMessageReminderRenderer.js +29 -0
  4. package/build/components/MessageNavigation.d.ts +7 -0
  5. package/build/components/MessageNavigation.js +192 -0
  6. package/build/components/MessageReminderDisplay.d.ts +21 -0
  7. package/build/components/MessageReminderDisplay.js +353 -0
  8. package/build/components/MessageWorkspace.d.ts +14 -0
  9. package/build/components/MessageWorkspace.js +26 -0
  10. package/build/components/message-navigation.less +89 -0
  11. package/build/components/message-reminder-display.less +367 -0
  12. package/build/components/message-workspace.less +150 -0
  13. package/build/index.d.ts +20 -0
  14. package/build/index.js +17 -0
  15. package/build/pages/inbox/InboxPage.d.ts +2 -0
  16. package/build/pages/inbox/InboxPage.js +257 -0
  17. package/build/pages/inbox/inbox.less +293 -0
  18. package/build/pages/subscription/PersonalSubscriptionPage.d.ts +1 -0
  19. package/build/pages/subscription/PersonalSubscriptionPage.js +6 -0
  20. package/build/pages/subscription/RoleSubscriptionPage.d.ts +1 -0
  21. package/build/pages/subscription/RoleSubscriptionPage.js +5 -0
  22. package/build/pages/subscription/SubscriptionForm.d.ts +16 -0
  23. package/build/pages/subscription/SubscriptionForm.js +111 -0
  24. package/build/pages/subscription/SubscriptionPage.d.ts +5 -0
  25. package/build/pages/subscription/SubscriptionPage.js +273 -0
  26. package/build/pages/subscription/subscription-form.less +341 -0
  27. package/build/pages/subscription/subscription.less +250 -0
  28. package/build/pages/topic/TopicPage.d.ts +1 -0
  29. package/build/pages/topic/TopicPage.js +275 -0
  30. package/build/routes.cjs +38 -0
  31. package/build/routes.d.cts +22 -0
  32. package/build/routes.d.ts +22 -0
  33. package/build/routes.js +34 -0
  34. package/build/runtime/MessageReminderLayout.d.ts +14 -0
  35. package/build/runtime/MessageReminderLayout.js +25 -0
  36. package/build/runtime/MessageReminders.d.ts +16 -0
  37. package/build/runtime/MessageReminders.js +364 -0
  38. package/build/runtime/index.d.ts +77 -0
  39. package/build/runtime/index.js +103 -0
  40. package/build/runtime/message-reminder-layout.less +40 -0
  41. package/build/runtime/messageRealtime.d.ts +15 -0
  42. package/build/runtime/messageRealtime.js +99 -0
  43. package/build/runtime/reminderEvents.d.ts +18 -0
  44. package/build/runtime/reminderEvents.js +53 -0
  45. package/build/runtime/reminderOwnership.d.ts +35 -0
  46. package/build/runtime/reminderOwnership.js +135 -0
  47. package/build/runtime/reminderPresentation.d.ts +34 -0
  48. package/build/runtime/reminderPresentation.js +57 -0
  49. package/build/runtime/reminderQuery.d.ts +18 -0
  50. package/build/runtime/reminderQuery.js +33 -0
  51. package/build/runtime/reminderQueue.d.ts +25 -0
  52. package/build/runtime/reminderQueue.js +88 -0
  53. package/build/services/MessageController.d.ts +108 -0
  54. package/build/services/MessageController.js +42 -0
  55. package/build/types/index.d.ts +12 -0
  56. package/build/types/index.js +1 -0
  57. package/package.json +95 -4
@@ -0,0 +1,257 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { ArrowRightOutlined, CheckOutlined, InboxOutlined, ReadOutlined, ReloadOutlined, } from '@ant-design/icons';
3
+ import { Button, Drawer, Grid, Pagination, Segmented, Select, Skeleton, Space, Tag, } from 'antd';
4
+ import { useCallback, useEffect, useRef, useState } from 'react';
5
+ import MessageWorkspace, { useMessageTheme, } from '../../components/MessageWorkspace.js';
6
+ import { getMessageDomainRuntime, navigate, useLocation } from '../../runtime/index.js';
7
+ import { dispatchMessageReceiptRead, subscribeMessageReceiptRead, } from '../../runtime/reminderEvents.js';
8
+ import { getInboxMessage, getMessageTopics, getUnreadMessageCount, isInternalMessagePath, markInboxMessageRead, pageInboxMessages, showMessageError, } from '../../services/MessageController.js';
9
+ import './inbox.less';
10
+ const receiptId = (record) => record.receiptId || record.id;
11
+ function isExpired(record) {
12
+ return (!!record.expiresAt && new Date(record.expiresAt).getTime() <= Date.now());
13
+ }
14
+ /** 服务端本地时间不附带时区,按浏览器本地时间展示;无效值保留原文便于识别。 */
15
+ function formatTime(value, short = false) {
16
+ if (!value)
17
+ return '—';
18
+ const date = new Date(value.replace(' ', 'T'));
19
+ if (Number.isNaN(date.getTime()))
20
+ return value;
21
+ return date.toLocaleString('zh-CN', {
22
+ ...(short ? {} : { year: 'numeric' }),
23
+ month: '2-digit',
24
+ day: '2-digit',
25
+ hour: '2-digit',
26
+ minute: '2-digit',
27
+ hour12: false,
28
+ });
29
+ }
30
+ export default function InboxPage() {
31
+ const location = useLocation();
32
+ const confirmedReadAt = useRef(new Map());
33
+ const screens = Grid.useBreakpoint();
34
+ const compact = screens.md === false;
35
+ const messageTheme = useMessageTheme();
36
+ const mounted = useRef(true);
37
+ const readRequests = useRef(new Map());
38
+ const listVersion = useRef(0);
39
+ const detailVersion = useRef(0);
40
+ const countVersion = useRef(0);
41
+ const [query, setQuery] = useState({ current: 1, pageSize: 10 });
42
+ const [refreshKey, setRefreshKey] = useState(0);
43
+ const [records, setRecords] = useState([]);
44
+ const [topics, setTopics] = useState([]);
45
+ const [total, setTotal] = useState(0);
46
+ const [loading, setLoading] = useState(true);
47
+ const [listFailed, setListFailed] = useState(false);
48
+ const [unreadCount, setUnreadCount] = useState();
49
+ const [countLoading, setCountLoading] = useState(false);
50
+ const [detailId, setDetailId] = useState();
51
+ const [detail, setDetail] = useState();
52
+ const [detailLoading, setDetailLoading] = useState(false);
53
+ const [detailFailed, setDetailFailed] = useState(false);
54
+ const [busyIds, setBusyIds] = useState([]);
55
+ const topicName = (record) => topics.find((topic) => topic.code === record.topicCode)?.name ||
56
+ record.topicName ||
57
+ record.topicCode;
58
+ const refreshCount = useCallback(async () => {
59
+ if (!mounted.current)
60
+ return;
61
+ const version = ++countVersion.current;
62
+ setCountLoading(true);
63
+ try {
64
+ const { data } = await getUnreadMessageCount();
65
+ if (version === countVersion.current)
66
+ setUnreadCount(data?.count || 0);
67
+ }
68
+ catch (error) {
69
+ if (version === countVersion.current)
70
+ showMessageError(error, '加载未读数量失败');
71
+ }
72
+ finally {
73
+ if (version === countVersion.current)
74
+ setCountLoading(false);
75
+ }
76
+ }, []);
77
+ useEffect(() => {
78
+ void refreshCount();
79
+ }, [refreshCount]);
80
+ useEffect(() => {
81
+ let cancelled = false;
82
+ void getMessageTopics()
83
+ .then(({ data }) => {
84
+ if (!cancelled)
85
+ setTopics(data || []);
86
+ })
87
+ .catch((error) => {
88
+ if (!cancelled)
89
+ showMessageError(error, '加载消息主题失败');
90
+ });
91
+ return () => {
92
+ cancelled = true;
93
+ };
94
+ }, []);
95
+ useEffect(() => {
96
+ const version = ++listVersion.current;
97
+ setLoading(true);
98
+ setListFailed(false);
99
+ void pageInboxMessages({ ...query })
100
+ .then(({ data }) => {
101
+ if (version !== listVersion.current)
102
+ return;
103
+ const resultTotal = data?.total || 0;
104
+ // 未读列表中的最后一条被阅读后,退回有效页,避免留在空白分页上。
105
+ if (query.current > 1 &&
106
+ (query.current - 1) * query.pageSize >= resultTotal) {
107
+ setQuery((current) => ({
108
+ ...current,
109
+ current: Math.max(1, Math.ceil(resultTotal / current.pageSize)),
110
+ }));
111
+ return;
112
+ }
113
+ setRecords(data?.records || []);
114
+ setTotal(resultTotal);
115
+ })
116
+ .catch((error) => {
117
+ if (version !== listVersion.current)
118
+ return;
119
+ setListFailed(true);
120
+ showMessageError(error, '加载我的消息失败');
121
+ })
122
+ .finally(() => {
123
+ if (version === listVersion.current)
124
+ setLoading(false);
125
+ });
126
+ return () => {
127
+ ++listVersion.current;
128
+ };
129
+ }, [query, refreshKey]);
130
+ useEffect(() => {
131
+ mounted.current = true;
132
+ return () => {
133
+ // 页面卸载后不再让迟到的详情/数量请求回写状态。
134
+ mounted.current = false;
135
+ ++detailVersion.current;
136
+ ++countVersion.current;
137
+ };
138
+ }, []);
139
+ const refresh = () => {
140
+ setRefreshKey((value) => value + 1);
141
+ void refreshCount();
142
+ };
143
+ const markRead = (record) => {
144
+ if (!mounted.current)
145
+ return Promise.resolve();
146
+ const id = receiptId(record);
147
+ // 慢网下反复打开同一消息时共享在途确认;不同消息仍可独立阅读。
148
+ const pending = readRequests.current.get(id);
149
+ if (pending)
150
+ return pending;
151
+ setBusyIds((current) => [...current, id]);
152
+ const operation = (async () => {
153
+ try {
154
+ await markInboxMessageRead(id);
155
+ // 已发出的确认正常完成;页面离开后不再补发查询或提示上一页的错误。
156
+ if (!mounted.current)
157
+ return;
158
+ // 统一广播成功确认;全局提醒和本页列表同步,出现提醒本身不会调用这里。
159
+ dispatchMessageReceiptRead(id);
160
+ }
161
+ catch (error) {
162
+ if (mounted.current)
163
+ showMessageError(error, '标记已读失败,请重试');
164
+ }
165
+ finally {
166
+ readRequests.current.delete(id);
167
+ if (mounted.current)
168
+ setBusyIds((current) => current.filter((value) => value !== id));
169
+ }
170
+ })();
171
+ readRequests.current.set(id, operation);
172
+ return operation;
173
+ };
174
+ const loadDetail = async (id) => {
175
+ const version = ++detailVersion.current;
176
+ setDetailId(id);
177
+ setDetail(undefined);
178
+ setDetailLoading(true);
179
+ setDetailFailed(false);
180
+ try {
181
+ const { data } = await getInboxMessage(id);
182
+ if (version !== detailVersion.current)
183
+ return;
184
+ if (!data)
185
+ throw new Error('消息详情不存在');
186
+ // 迟到的旧详情不能覆盖已经完成的阅读确认,尤其是从全局提醒跳转的同一消息。
187
+ const confirmed = confirmedReadAt.current.get(id);
188
+ if (confirmed)
189
+ data.readAt = confirmed;
190
+ setDetail(data);
191
+ // 用户明确打开并且详情加载成功后,才确认阅读;切换筛选不会自动阅读消息。
192
+ if (!data.readAt)
193
+ await markRead(data);
194
+ }
195
+ catch (error) {
196
+ if (version === detailVersion.current) {
197
+ setDetailFailed(true);
198
+ showMessageError(error, '加载消息详情失败');
199
+ }
200
+ }
201
+ finally {
202
+ if (version === detailVersion.current)
203
+ setDetailLoading(false);
204
+ }
205
+ };
206
+ useEffect(() => {
207
+ const onRead = ({ id, readAt }) => {
208
+ confirmedReadAt.current.set(id, readAt);
209
+ setDetail((current) => current && receiptId(current) === id ? { ...current, readAt } : current);
210
+ setRecords((current) => current.map((record) => receiptId(record) === id ? { ...record, readAt } : record));
211
+ setRefreshKey((value) => value + 1);
212
+ void refreshCount();
213
+ };
214
+ return subscribeMessageReceiptRead(onRead);
215
+ }, [refreshCount]);
216
+ useEffect(() => {
217
+ const id = new URLSearchParams(location.search).get(getMessageDomainRuntime().receiptQueryParam);
218
+ if (id)
219
+ void loadDetail(id);
220
+ // URL 定位来自全局提醒;只有地址变化才加载,普通列表状态更新不能反复读取详情。
221
+ }, [location.search]);
222
+ const reader = (_jsx("section", { className: "qiqb-inbox-reader", "aria-label": "\u6D88\u606F\u8BE6\u60C5", "aria-busy": detailLoading, children: detailLoading && !detail ? (_jsx("div", { className: "qiqb-inbox-reader-body", children: _jsx(Skeleton, { active: true, title: { width: '60%' }, paragraph: { rows: 8 } }) })) : detail ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "qiqb-inbox-reader-top", children: [_jsxs(Space, { size: 8, wrap: true, children: [_jsx(Tag, { color: "blue", children: topicName(detail) }), _jsx("span", { className: "qiqb-message-caption", children: detail.sourceSystem.toUpperCase() })] }), _jsxs("span", { className: "qiqb-inbox-read-state", children: [detail.readAt ? (_jsxs(_Fragment, { children: [_jsx(CheckOutlined, {}), " \u5DF2\u8BFB"] })) : ('未读'), isExpired(detail) && _jsx(Tag, { children: "\u5DF2\u8FC7\u671F" })] })] }), _jsxs("div", { className: "qiqb-inbox-reader-body", children: [_jsx("h2", { children: detail.title }), _jsxs("div", { className: "qiqb-inbox-reader-time", children: ["\u6536\u5230\u4E8E ", formatTime(detail.createTime)] }), _jsx("div", { className: "qiqb-inbox-message-content", children: detail.content }), _jsxs("dl", { className: "qiqb-inbox-detail-meta", children: [_jsxs("div", { children: [_jsx("dt", { children: "\u53D1\u751F\u65F6\u95F4" }), _jsx("dd", { children: formatTime(detail.occurredAt) })] }), detail.businessType && (_jsxs("div", { children: [_jsx("dt", { children: "\u4E1A\u52A1\u7C7B\u578B" }), _jsx("dd", { children: detail.businessType })] })), detail.businessId && (_jsxs("div", { children: [_jsx("dt", { children: "\u4E1A\u52A1\u7F16\u53F7" }), _jsx("dd", { children: detail.businessId })] })), detail.expiresAt && (_jsxs("div", { children: [_jsx("dt", { children: "\u6709\u6548\u671F\u81F3" }), _jsx("dd", { children: formatTime(detail.expiresAt) })] }))] })] }), (isInternalMessagePath(detail.targetPath) || !detail.readAt) && (_jsx("div", { className: "qiqb-inbox-reader-footer", children: _jsxs(Space, { wrap: true, children: [isInternalMessagePath(detail.targetPath) && (_jsx(Button, { type: "primary", icon: _jsx(ArrowRightOutlined, {}), onClick: () => navigate(detail.targetPath), children: "\u67E5\u770B\u76F8\u5173\u4E1A\u52A1" })), !detail.readAt && (_jsx(Button, { icon: _jsx(CheckOutlined, {}), loading: busyIds.includes(receiptId(detail)), onClick: () => void markRead(detail), children: "\u6807\u8BB0\u5DF2\u8BFB" }))] }) }))] })) : (_jsxs("div", { className: "qiqb-message-state qiqb-inbox-reader-placeholder", children: [_jsx("span", { className: "qiqb-message-state-icon", children: _jsx(ReadOutlined, {}) }), _jsx("h3", { children: detailFailed ? '暂时无法打开这条消息' : '选择一条消息开始阅读' }), _jsx("p", { children: detailFailed
223
+ ? '消息详情加载失败,请重试。'
224
+ : '在左侧查看消息,阅读详情或前往相关业务。' }), detailFailed && detailId && (_jsx(Button, { onClick: () => void loadDetail(detailId), children: "\u91CD\u65B0\u52A0\u8F7D" }))] })) }));
225
+ return (_jsxs(MessageWorkspace, { title: "\u6211\u7684\u6D88\u606F", description: "\u96C6\u4E2D\u67E5\u770B\u4E1A\u52A1\u63D0\u9192\uFF0C\u53CA\u65F6\u8DDF\u8FDB\u4E0E\u4F60\u76F8\u5173\u7684\u6D88\u606F\u3002", icon: _jsx(InboxOutlined, {}), extra: _jsxs(_Fragment, { children: [_jsxs("span", { className: "qiqb-inbox-unread-summary", children: [_jsx("span", { children: "\u672A\u8BFB" }), _jsx("strong", { "aria-live": "polite", children: unreadCount === undefined ? '—' : unreadCount })] }), _jsx(Button, { icon: _jsx(ReloadOutlined, {}), loading: loading || countLoading, onClick: refresh, children: "\u5237\u65B0\u6D88\u606F" })] }), children: [_jsxs("div", { className: "qiqb-message-surface", children: [_jsxs("div", { className: "qiqb-message-toolbar", children: [_jsx(Segmented, { "aria-label": "\u7B5B\u9009\u9605\u8BFB\u72B6\u6001", value: query.unread === undefined
226
+ ? 'ALL'
227
+ : query.unread
228
+ ? 'UNREAD'
229
+ : 'READ', options: [
230
+ { label: '全部消息', value: 'ALL' },
231
+ { label: '未读', value: 'UNREAD' },
232
+ { label: '已读', value: 'READ' },
233
+ ], onChange: (value) => setQuery((current) => ({
234
+ ...current,
235
+ current: 1,
236
+ unread: value === 'ALL' ? undefined : value === 'UNREAD',
237
+ })) }), _jsx(Select, { className: "qiqb-message-filter-select", "aria-label": "\u7B5B\u9009\u6D88\u606F\u4E3B\u9898", placeholder: "\u5168\u90E8\u6D88\u606F\u4E3B\u9898", allowClear: true, showSearch: true, optionFilterProp: "label", value: query.topicCode, options: topics.map((topic) => ({
238
+ value: topic.code,
239
+ label: topic.name,
240
+ })), onChange: (topicCode) => setQuery((current) => ({ ...current, current: 1, topicCode })) })] }), _jsxs("div", { className: "qiqb-inbox-layout", children: [_jsxs("section", { className: "qiqb-inbox-list", "aria-label": "\u6D88\u606F\u5217\u8868", "aria-busy": loading, children: [_jsxs("div", { className: "qiqb-inbox-list-heading", children: [_jsx("span", { children: "\u6D88\u606F\u5217\u8868" }), _jsx("span", { className: "qiqb-message-caption", children: listFailed ? '加载失败' : total + ' 条消息' })] }), _jsx("div", { className: "qiqb-inbox-list-body", children: loading ? (_jsx("div", { className: "qiqb-inbox-list-skeleton", children: [0, 1, 2].map((key) => (_jsx(Skeleton, { active: true, title: true, paragraph: { rows: 2 } }, key))) })) : listFailed ? (_jsxs("div", { className: "qiqb-message-state", children: [_jsx("span", { className: "qiqb-message-state-icon", children: _jsx(InboxOutlined, {}) }), _jsx("h3", { children: "\u6D88\u606F\u52A0\u8F7D\u5931\u8D25" }), _jsx("p", { children: "\u8BF7\u91CD\u65B0\u52A0\u8F7D\u540E\u7EE7\u7EED\u67E5\u770B\u3002" }), _jsx(Button, { onClick: refresh, children: "\u91CD\u65B0\u52A0\u8F7D" })] })) : records.length ? (records.map((record) => (_jsxs("button", { type: "button", className: [
241
+ 'qiqb-inbox-item',
242
+ receiptId(record) === detailId ? 'is-selected' : '',
243
+ !record.readAt ? 'is-unread' : '',
244
+ ].join(' '), "aria-pressed": receiptId(record) === detailId, onClick: () => void loadDetail(receiptId(record)), children: [_jsxs("span", { className: "qiqb-inbox-item-heading", children: [_jsx("span", { className: "qiqb-inbox-item-topic", children: topicName(record) }), _jsx("time", { children: formatTime(record.createTime, true) })] }), _jsxs("span", { className: "qiqb-inbox-item-title", children: [!record.readAt && (_jsx("span", { className: "qiqb-inbox-unread-dot", "aria-label": "\u672A\u8BFB" })), record.title] }), _jsx("span", { className: "qiqb-inbox-item-preview", children: record.content || '点击查看消息详情' }), _jsxs("span", { className: "qiqb-inbox-item-footer", children: [_jsx("span", { children: record.sourceSystem.toUpperCase() }), _jsx("span", { children: isExpired(record)
245
+ ? '已过期'
246
+ : record.readAt
247
+ ? '已读'
248
+ : '未读' })] })] }, receiptId(record))))) : (_jsxs("div", { className: "qiqb-message-state", children: [_jsx("span", { className: "qiqb-message-state-icon", children: _jsx(InboxOutlined, {}) }), _jsx("h3", { children: query.unread === true
249
+ ? '未读消息已处理完'
250
+ : '这里还没有消息' }), _jsx("p", { children: query.topicCode || query.unread !== undefined
251
+ ? '试试切换阅读状态或消息主题。'
252
+ : '订阅感兴趣的主题后,新的消息会出现在这里。' })] })) }), total > 0 && !listFailed && (_jsx("div", { className: "qiqb-inbox-pagination", children: _jsx(Pagination, { size: "small", simple: true, current: query.current, pageSize: query.pageSize, total: total, showSizeChanger: false, onChange: (current) => setQuery((previous) => ({ ...previous, current })) }) }))] }), !compact && reader] })] }), _jsx(Drawer, { title: "\u9605\u8BFB\u6D88\u606F", open: compact && !!detailId, width: "100%", rootClassName: "qiqb-inbox-mobile", rootStyle: messageTheme, styles: { body: { padding: 0 } }, onClose: () => {
253
+ setDetailId(undefined);
254
+ ++detailVersion.current;
255
+ setDetailLoading(false);
256
+ }, children: _jsx("div", { className: "qiqb-message", children: reader }) })] }));
257
+ }
@@ -0,0 +1,293 @@
1
+ .qiqb-message {
2
+ .qiqb-inbox-unread-summary {
3
+ display: flex;
4
+ align-items: center;
5
+ gap: 8px;
6
+ color: var(--message-muted);
7
+ font-size: 13px;
8
+
9
+ strong {
10
+ display: inline-flex;
11
+ align-items: center;
12
+ justify-content: center;
13
+ min-width: 30px;
14
+ height: 28px;
15
+ padding: 0 8px;
16
+ color: var(--message-primary);
17
+ background: var(--message-primary-bg);
18
+ border-radius: 8px;
19
+ font-size: 15px;
20
+ font-variant-numeric: tabular-nums;
21
+ }
22
+ }
23
+
24
+ .qiqb-inbox-layout {
25
+ display: grid;
26
+ grid-template-columns: minmax(290px, 36%) minmax(0, 1fr);
27
+ height: clamp(520px, calc(100vh - 270px), 820px);
28
+ }
29
+
30
+ .qiqb-inbox-list {
31
+ display: flex;
32
+ min-width: 0;
33
+ min-height: 0;
34
+ flex-direction: column;
35
+ border-right: 1px solid var(--message-border);
36
+ }
37
+
38
+ .qiqb-inbox-list-heading {
39
+ display: flex;
40
+ flex-shrink: 0;
41
+ justify-content: space-between;
42
+ gap: 12px;
43
+ padding: 15px 20px;
44
+ font-size: 13px;
45
+ font-weight: 500;
46
+ border-bottom: 1px solid var(--message-border);
47
+ }
48
+
49
+ .qiqb-inbox-list-body {
50
+ flex: 1;
51
+ min-height: 0;
52
+ overflow: auto;
53
+ scrollbar-width: thin;
54
+ }
55
+
56
+ .qiqb-inbox-list-skeleton {
57
+ padding: 20px;
58
+
59
+ > div + div {
60
+ margin-top: 26px;
61
+ }
62
+ }
63
+
64
+ .qiqb-inbox-item {
65
+ display: flex;
66
+ width: 100%;
67
+ min-width: 0;
68
+ flex-direction: column;
69
+ gap: 8px;
70
+ padding: 18px 20px;
71
+ color: var(--message-text);
72
+ background: transparent;
73
+ border: 0;
74
+ border-bottom: 1px solid var(--message-border);
75
+ border-left: 3px solid transparent;
76
+ font: inherit;
77
+ text-align: left;
78
+ cursor: pointer;
79
+ transition: background 0.16s ease, border-color 0.16s ease;
80
+
81
+ &:hover {
82
+ background: var(--message-fill);
83
+ }
84
+
85
+ &:focus-visible {
86
+ outline: 2px solid var(--message-primary);
87
+ outline-offset: -3px;
88
+ }
89
+
90
+ &.is-selected {
91
+ background: var(--message-primary-bg);
92
+ border-left-color: var(--message-primary);
93
+ }
94
+
95
+ &.is-unread .qiqb-inbox-item-title {
96
+ font-weight: 600;
97
+ }
98
+ }
99
+
100
+ .qiqb-inbox-item-heading,
101
+ .qiqb-inbox-item-footer {
102
+ display: flex;
103
+ align-items: center;
104
+ justify-content: space-between;
105
+ gap: 12px;
106
+ color: var(--message-muted);
107
+ font-size: 11px;
108
+ line-height: 1.6;
109
+
110
+ time {
111
+ flex-shrink: 0;
112
+ font-variant-numeric: tabular-nums;
113
+ }
114
+ }
115
+
116
+ .qiqb-inbox-item-topic {
117
+ overflow: hidden;
118
+ color: var(--message-primary);
119
+ text-overflow: ellipsis;
120
+ white-space: nowrap;
121
+ }
122
+
123
+ .qiqb-inbox-item-title {
124
+ display: block;
125
+ overflow: hidden;
126
+ font-size: 14px;
127
+ line-height: 1.6;
128
+ text-overflow: ellipsis;
129
+ white-space: nowrap;
130
+ }
131
+
132
+ .qiqb-inbox-unread-dot {
133
+ display: inline-block;
134
+ width: 6px;
135
+ height: 6px;
136
+ margin: 0 7px 2px 0;
137
+ background: var(--message-primary);
138
+ border-radius: 50%;
139
+ }
140
+
141
+ .qiqb-inbox-item-preview {
142
+ display: -webkit-box;
143
+ overflow: hidden;
144
+ color: var(--message-muted);
145
+ font-size: 12px;
146
+ line-height: 1.8;
147
+ overflow-wrap: anywhere;
148
+ -webkit-line-clamp: 2;
149
+ -webkit-box-orient: vertical;
150
+ }
151
+
152
+ .qiqb-inbox-item-footer {
153
+ margin-top: 2px;
154
+ font-size: 10px;
155
+ letter-spacing: 0.3px;
156
+ }
157
+
158
+ .qiqb-inbox-pagination {
159
+ display: flex;
160
+ flex-shrink: 0;
161
+ justify-content: center;
162
+ padding: 14px 16px;
163
+ border-top: 1px solid var(--message-border);
164
+ }
165
+
166
+ .qiqb-inbox-reader {
167
+ display: flex;
168
+ min-width: 0;
169
+ min-height: 0;
170
+ flex-direction: column;
171
+ background: var(--message-surface);
172
+ }
173
+
174
+ .qiqb-inbox-reader-top {
175
+ display: flex;
176
+ flex-shrink: 0;
177
+ align-items: center;
178
+ justify-content: space-between;
179
+ flex-wrap: wrap;
180
+ gap: 12px;
181
+ padding: 18px 28px;
182
+ border-bottom: 1px solid var(--message-border);
183
+
184
+ .ant-tag {
185
+ margin-inline-end: 0;
186
+ }
187
+ }
188
+
189
+ .qiqb-inbox-read-state {
190
+ display: inline-flex;
191
+ align-items: center;
192
+ gap: 6px;
193
+ color: var(--message-muted);
194
+ font-size: 12px;
195
+ }
196
+
197
+ .qiqb-inbox-reader-body {
198
+ flex: 1;
199
+ min-height: 0;
200
+ overflow: auto;
201
+ padding: 28px 32px;
202
+
203
+ h2 {
204
+ margin: 0;
205
+ font-size: 22px;
206
+ font-weight: 600;
207
+ line-height: 1.6;
208
+ overflow-wrap: anywhere;
209
+ }
210
+ }
211
+
212
+ .qiqb-inbox-reader-time {
213
+ margin-top: 10px;
214
+ color: var(--message-muted);
215
+ font-size: 12px;
216
+ }
217
+
218
+ .qiqb-inbox-message-content {
219
+ min-height: 160px;
220
+ margin: 30px 0;
221
+ font-size: 14px;
222
+ line-height: 2;
223
+ white-space: pre-wrap;
224
+ overflow-wrap: anywhere;
225
+ }
226
+
227
+ .qiqb-inbox-detail-meta {
228
+ display: grid;
229
+ grid-template-columns: repeat(2, minmax(0, 1fr));
230
+ gap: 18px 24px;
231
+ margin: 0;
232
+ padding: 20px;
233
+ background: var(--message-fill);
234
+ border-radius: 8px;
235
+ font-size: 12px;
236
+
237
+ dt {
238
+ margin-bottom: 6px;
239
+ color: var(--message-muted);
240
+ }
241
+
242
+ dd {
243
+ margin: 0;
244
+ overflow-wrap: anywhere;
245
+ }
246
+ }
247
+
248
+ .qiqb-inbox-reader-footer {
249
+ flex-shrink: 0;
250
+ padding: 18px 32px;
251
+ border-top: 1px solid var(--message-border);
252
+ }
253
+
254
+ .qiqb-inbox-reader-placeholder {
255
+ flex: 1;
256
+ min-height: 500px;
257
+ }
258
+
259
+ @media (max-width: 767px) {
260
+ .qiqb-inbox-layout {
261
+ grid-template-columns: minmax(0, 1fr);
262
+ height: auto;
263
+ min-height: 440px;
264
+ }
265
+
266
+ .qiqb-inbox-list-body {
267
+ max-height: 65vh;
268
+ }
269
+
270
+ .qiqb-inbox-list {
271
+ border-right: 0;
272
+ }
273
+
274
+ .qiqb-inbox-reader-body {
275
+ padding: 24px 20px;
276
+ }
277
+
278
+ .qiqb-inbox-reader-top,
279
+ .qiqb-inbox-reader-footer {
280
+ padding: 16px 20px;
281
+ }
282
+
283
+ .qiqb-inbox-detail-meta {
284
+ grid-template-columns: minmax(0, 1fr);
285
+ }
286
+ }
287
+
288
+ @media (prefers-reduced-motion: reduce) {
289
+ .qiqb-inbox-item {
290
+ transition: none;
291
+ }
292
+ }
293
+ }
@@ -0,0 +1 @@
1
+ export default function PersonalSubscriptionPage(): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import SubscriptionPage from './SubscriptionPage.js';
3
+ // 个人订阅的账户归属由后端按当前登录账号确定,前端不提供任意账户选择入口。
4
+ export default function PersonalSubscriptionPage() {
5
+ return _jsx(SubscriptionPage, { scope: "PERSONAL" });
6
+ }
@@ -0,0 +1 @@
1
+ export default function RoleSubscriptionPage(): import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import SubscriptionPage from './SubscriptionPage.js';
3
+ export default function RoleSubscriptionPage() {
4
+ return _jsx(SubscriptionPage, { scope: "ROLE" });
5
+ }
@@ -0,0 +1,16 @@
1
+ import { MessageRole, MessageSubscription, MessageTopic, SubscriptionMetadata, SubscriptionScope } from '../../services/MessageController.js';
2
+ import './subscription-form.less';
3
+ interface Props {
4
+ scope: SubscriptionScope;
5
+ open: boolean;
6
+ record?: MessageSubscription;
7
+ topics: MessageTopic[];
8
+ roles: MessageRole[];
9
+ metadata?: SubscriptionMetadata;
10
+ canManage: boolean;
11
+ loading: boolean;
12
+ onClose: () => void;
13
+ onSuccess: () => void;
14
+ }
15
+ export default function SubscriptionForm({ scope, open, record, topics, roles, metadata, canManage, loading, onClose, onSuccess, }: Props): import("react").JSX.Element;
16
+ export {};