@donglegeyu/company-ui 2.16.0 → 2.17.1

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.
@@ -13,6 +13,8 @@ export interface CompanyAccountItem {
13
13
  domainName?: string;
14
14
  /** 是否当前登录账号(当前项右侧渲染对勾,不显示移除按钮) */
15
15
  current?: boolean;
16
+ /** 昵称右侧徽标(如未读数);数值超过 99 自动折叠为 99+ */
17
+ badge?: string | number;
16
18
  }
17
19
  export interface CompanyAccountSwitcherProps {
18
20
  /** 账号列表(受控数据,由业务侧注入) */
@@ -38,6 +38,7 @@ var CompanyAccountSwitcher = ({
38
38
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "account-switcher-list", children: list.map((account) => {
39
39
  const displayName = account.nickname || account.username || "";
40
40
  const subName = account.username || account.domainName || "";
41
+ const badgeText = account.badge === void 0 || account.badge === null || account.badge === "" ? "" : typeof account.badge === "number" ? account.badge > 99 ? "99+" : String(account.badge) : account.badge;
41
42
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
42
43
  "div",
43
44
  {
@@ -46,7 +47,10 @@ var CompanyAccountSwitcher = ({
46
47
  children: [
47
48
  account.avatar ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "account-switcher-avatar", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: account.avatar, alt: displayName || "avatar" }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "account-switcher-avatar", children: (displayName || "A").charAt(0) }),
48
49
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "account-switcher-info", children: [
49
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "account-switcher-nickname", children: displayName || "账号" }),
50
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "account-switcher-nickname", children: [
51
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "account-switcher-nickname-text", children: displayName || "账号" }),
52
+ badgeText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "account-switcher-badge", children: badgeText })
53
+ ] }),
50
54
  subName && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "account-switcher-sub", children: subName })
51
55
  ] }),
52
56
  account.current && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CheckOutlined, { className: "account-switcher-check" }),
@@ -8,6 +8,7 @@
8
8
  display: flex;
9
9
  flex-direction: column;
10
10
  gap: 2px;
11
+ margin-top: 4px;
11
12
  }
12
13
 
13
14
  .account-switcher-item {
@@ -55,6 +56,13 @@
55
56
  }
56
57
 
57
58
  .account-switcher-nickname {
59
+ display: flex;
60
+ align-items: center;
61
+ gap: 4px;
62
+ min-width: 0;
63
+ }
64
+
65
+ .account-switcher-nickname-text {
58
66
  font-size: 14px;
59
67
  line-height: 20px;
60
68
  color: var(--company-color-text, rgba(0, 0, 0, 0.88));
@@ -63,6 +71,17 @@
63
71
  white-space: nowrap;
64
72
  }
65
73
 
74
+ .account-switcher-badge {
75
+ flex-shrink: 0;
76
+ padding: 0 4px;
77
+ border-radius: 8px;
78
+ background: var(--company-color-primary-bg, #fff1e6);
79
+ color: var(--company-color-primary, #f95914);
80
+ font-size: 12px;
81
+ line-height: 18px;
82
+ font-weight: 500;
83
+ }
84
+
66
85
  .account-switcher-sub {
67
86
  font-size: 12px;
68
87
  line-height: 18px;
@@ -35,6 +35,8 @@ export interface AdminLayoutTemplateProps {
35
35
  accountSwitcher?: React.ReactNode;
36
36
  /** 头像下拉自定义插槽:渲染在「切换账号」之后、「退出登录」之前(业务自定义入口区) */
37
37
  userMenuExtra?: React.ReactNode;
38
+ /** 「切换账号」入口与底部管理员行的徽标(如账号未读总数);数值超过 99 折叠为 99+ */
39
+ accountBadge?: string | number;
38
40
  /** 业务域列表(左侧导航顶部切换下拉) */
39
41
  domains?: SidebarDomain[];
40
42
  /** 当前业务域 id(受控;不传则组件内部管理) */
@@ -119,4 +121,4 @@ export interface AdminLayoutTemplateProps {
119
121
  * - 间距契约固化:内容区只做滚动容器(零间距),业务模板自带全部内边距与背景
120
122
  * - 两种内容模式:pages 配置式(key 与菜单联动)或 children 兜底(直接放业务模板)
121
123
  */
122
- export default function AdminLayoutTemplate({ className, style, logo, brandName, userInfo, onLogout, accountSwitcher, userMenuExtra, domains, currentDomainId, defaultDomainId, onDomainChange, businessMenus, firstMenus, systemBottomMenus, visibleMenuCount, emptyImage, customNavMenus, onCustomNavUpdate, defaultFavorites, onFavoritesChange, defaultActiveFirstMenu, defaultActiveKey, defaultSecondSidebarFixed, tabs, defaultTabs, activeTabKey, defaultActiveTabKey, onTabsChange, onActiveTabChange, onTabClose, homeTab, homeContent, tabSearch, tabSearchPlaceholder, tabExtra, aiAssistant, aiAssistantWidth, aiAssistantDefaultOpen, aiTransport, onMenuOpen, onActiveFirstMenuChange, pages, children, contentClassName, contentStyle, }: AdminLayoutTemplateProps): import("react").JSX.Element;
124
+ export default function AdminLayoutTemplate({ className, style, logo, brandName, userInfo, onLogout, accountSwitcher, userMenuExtra, accountBadge, domains, currentDomainId, defaultDomainId, onDomainChange, businessMenus, firstMenus, systemBottomMenus, visibleMenuCount, emptyImage, customNavMenus, onCustomNavUpdate, defaultFavorites, onFavoritesChange, defaultActiveFirstMenu, defaultActiveKey, defaultSecondSidebarFixed, tabs, defaultTabs, activeTabKey, defaultActiveTabKey, onTabsChange, onActiveTabChange, onTabClose, homeTab, homeContent, tabSearch, tabSearchPlaceholder, tabExtra, aiAssistant, aiAssistantWidth, aiAssistantDefaultOpen, aiTransport, onMenuOpen, onActiveFirstMenuChange, pages, children, contentClassName, contentStyle, }: AdminLayoutTemplateProps): import("react").JSX.Element;
@@ -319,6 +319,7 @@ function AdminLayoutTemplate({
319
319
  onLogout,
320
320
  accountSwitcher,
321
321
  userMenuExtra,
322
+ accountBadge,
322
323
  domains = [],
323
324
  currentDomainId,
324
325
  defaultDomainId,
@@ -829,6 +830,7 @@ function AdminLayoutTemplate({
829
830
  emptyImage,
830
831
  accountSwitcher,
831
832
  userMenuExtra,
833
+ accountBadge,
832
834
  onLogout
833
835
  }
834
836
  ),
@@ -28,6 +28,8 @@ export interface FirstSidebarProps {
28
28
  accountSwitcher?: React.ReactNode;
29
29
  /** 头像下拉自定义插槽:渲染在「切换账号」之后、「退出登录」之前(业务自定义入口区,如帮助中心等) */
30
30
  userMenuExtra?: React.ReactNode;
31
+ /** 「切换账号」入口与底部管理员行的徽标(如账号未读总数);数值超过 99 折叠为 99+ */
32
+ accountBadge?: string | number;
31
33
  onLogout?: () => void;
32
34
  }
33
- export default function FirstSidebar({ domains, currentDomainId, userInfo, logo, brandName, firstMenus, systemBottomMenus, businessMenus, customNavMenus, activeKey, activeFirstMenu, visibleMenuCount, bottomExtra, domainPopoverOpen, adminPopoverOpen, onDomainPopoverOpenChange, onAdminPopoverOpenChange, onDomainChange, onMenuClick, onBusinessMenuEnter, onBusinessMenuLeave, onOpenMore, accountSwitcher, userMenuExtra, onLogout, }: FirstSidebarProps): import("react").JSX.Element;
35
+ export default function FirstSidebar({ domains, currentDomainId, userInfo, logo, brandName, firstMenus, systemBottomMenus, businessMenus, customNavMenus, activeKey, activeFirstMenu, visibleMenuCount, bottomExtra, domainPopoverOpen, adminPopoverOpen, onDomainPopoverOpenChange, onAdminPopoverOpenChange, onDomainChange, onMenuClick, onBusinessMenuEnter, onBusinessMenuLeave, onOpenMore, accountSwitcher, accountBadge, userMenuExtra, onLogout, }: FirstSidebarProps): import("react").JSX.Element;
@@ -51,10 +51,12 @@ function FirstSidebar({
51
51
  onBusinessMenuLeave,
52
52
  onOpenMore,
53
53
  accountSwitcher,
54
+ accountBadge,
54
55
  userMenuExtra,
55
56
  onLogout
56
57
  }) {
57
58
  const hasMore = businessMenus.length > visibleMenuCount;
59
+ const accountBadgeText = accountBadge === void 0 || accountBadge === null || accountBadge === "" ? "" : typeof accountBadge === "number" ? accountBadge > 99 ? "99+" : String(accountBadge) : accountBadge;
58
60
  const [adminView, setAdminView] = (0, import_react.useState)("menu");
59
61
  const [prevAdminOpen, setPrevAdminOpen] = (0, import_react.useState)(adminPopoverOpen);
60
62
  if (prevAdminOpen !== adminPopoverOpen) {
@@ -180,7 +182,6 @@ function FirstSidebar({
180
182
  ]
181
183
  }
182
184
  ),
183
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "admin-popover-divider" }),
184
185
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
185
186
  "div",
186
187
  {
@@ -196,7 +197,8 @@ function FirstSidebar({
196
197
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "admin-popover-content", children: [
197
198
  accountSwitcher && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "admin-popover-item", onClick: () => setAdminView("accounts"), children: [
198
199
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_shared_components.SvgIcon, { name: "transfer-data", size: 20 }),
199
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "切换账号" })
200
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "切换账号" }),
201
+ accountBadgeText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "admin-popover-badge", children: accountBadgeText })
200
202
  ] }),
201
203
  userMenuExtra,
202
204
  (accountSwitcher || userMenuExtra) && onLogout && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "admin-popover-divider" }),
@@ -207,7 +209,8 @@ function FirstSidebar({
207
209
  ] }),
208
210
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "person-info", children: [
209
211
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "avatar", children: (userInfo.nickname || userInfo.username || "A").charAt(0) }),
210
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "name", children: userInfo.nickname || userInfo.username || "admin" })
212
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "name", children: userInfo.nickname || userInfo.username || "admin" }),
213
+ accountBadgeText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "person-info-badge", children: accountBadgeText })
211
214
  ] })
212
215
  }
213
216
  )
@@ -33,8 +33,10 @@ export interface CompanySidebarProps {
33
33
  onDomainPopoverOpenChange?: (open: boolean) => void;
34
34
  /** 切换账号面板内容(如 <CompanyAccountSwitcher/>);传入后头像下拉显示「切换账号」入口,点击后下拉内容切换为该面板(飞书式,非弹窗) */
35
35
  accountSwitcher?: React.ReactNode;
36
+ /** 「切换账号」入口与底部管理员行的徽标(如账号未读总数,由业务侧汇总传入);数值超过 99 折叠为 99+ */
37
+ accountBadge?: string | number;
36
38
  /** 头像下拉自定义插槽:渲染在「切换账号」之后、「退出登录」之前(业务自定义入口区,如帮助中心等) */
37
39
  userMenuExtra?: React.ReactNode;
38
40
  onLogout?: () => void;
39
41
  }
40
- export default function CompanySidebar({ className, style, domains, currentDomainId, onDomainChange, userInfo, logo, brandName, firstMenus, systemBottomMenus, businessMenus, customNavMenus, onCustomNavUpdate, favorites, onAddFavorite, onRemoveFavorite, onFavoritesReorder, activeFirstMenu, activeKey, onFirstMenuSelect, onMenuClick, expandedKeys, onExpandedKeysChange, secondSidebarFixed, onSecondSidebarFixedChange, visibleMenuCount, emptyImage, bottomExtra, onDomainPopoverOpenChange, accountSwitcher, userMenuExtra, onLogout, }: CompanySidebarProps): import("react").JSX.Element;
42
+ export default function CompanySidebar({ className, style, domains, currentDomainId, onDomainChange, userInfo, logo, brandName, firstMenus, systemBottomMenus, businessMenus, customNavMenus, onCustomNavUpdate, favorites, onAddFavorite, onRemoveFavorite, onFavoritesReorder, activeFirstMenu, activeKey, onFirstMenuSelect, onMenuClick, expandedKeys, onExpandedKeysChange, secondSidebarFixed, onSecondSidebarFixedChange, visibleMenuCount, emptyImage, bottomExtra, onDomainPopoverOpenChange, accountSwitcher, accountBadge, userMenuExtra, onLogout, }: CompanySidebarProps): import("react").JSX.Element;
@@ -93,6 +93,7 @@ function CompanySidebar({
93
93
  bottomExtra,
94
94
  onDomainPopoverOpenChange,
95
95
  accountSwitcher,
96
+ accountBadge,
96
97
  userMenuExtra,
97
98
  onLogout
98
99
  }) {
@@ -268,6 +269,7 @@ function CompanySidebar({
268
269
  onBusinessMenuLeave: handleBusinessMenuLeave,
269
270
  onOpenMore: () => setState((prev) => ({ ...prev, moreDrawerOpen: !prev.moreDrawerOpen })),
270
271
  accountSwitcher,
272
+ accountBadge,
271
273
  userMenuExtra,
272
274
  onLogout
273
275
  }
@@ -173,6 +173,8 @@
173
173
  z-index: 0;
174
174
  opacity: 0.2;
175
175
  background: rgba(255, 255, 255, 0.2);
176
+ padding-bottom: 0;
177
+ margin-bottom: 6px;
176
178
  }
177
179
 
178
180
  .person-info {
@@ -185,6 +187,7 @@
185
187
  align-self: stretch;
186
188
  z-index: 5;
187
189
  cursor: pointer;
190
+ padding-bottom: 6px;
188
191
 
189
192
  &:hover {
190
193
  .avatar {
@@ -225,6 +228,18 @@
225
228
  white-space: nowrap;
226
229
  }
227
230
 
231
+ .person-info-badge {
232
+ flex-shrink: 0;
233
+ margin-left: auto;
234
+ padding: 0 4px;
235
+ border-radius: 8px;
236
+ background: var(--company-color-primary, #f95914);
237
+ color: #fff;
238
+ font-size: 10px;
239
+ line-height: 16px;
240
+ font-weight: 500;
241
+ }
242
+
228
243
  .menu-item {
229
244
  display: flex;
230
245
  align-items: center;
@@ -344,6 +359,7 @@
344
359
  gap: 8px;
345
360
  align-self: stretch;
346
361
  cursor: pointer;
362
+ padding-bottom: 6px;
347
363
  color: rgba(255, 255, 255, 0.65);
348
364
  transition: all 0.2s;
349
365
  z-index: 5;
@@ -478,6 +494,18 @@
478
494
  color: var(--company-color-text-secondary, rgba(0, 0, 0, 0.65));
479
495
  }
480
496
 
497
+ // 「切换账号」菜单行的徽标:账号列表存在未读等数值时展示(汇总数由业务侧传入 accountBadge)
498
+ .admin-popover-badge {
499
+ flex-shrink: 0;
500
+ padding: 0 4px;
501
+ border-radius: 8px;
502
+ background: var(--company-color-primary-bg, #fff1e6);
503
+ color: var(--company-color-primary, #f95914);
504
+ font-size: 12px;
505
+ line-height: 18px;
506
+ font-weight: 500;
507
+ }
508
+
481
509
  // ========== SecondSidebar 二级浅色侧栏 ==========
482
510
  .company-sidebar-second {
483
511
  width: 220px;
@@ -13,6 +13,8 @@ export interface CompanyAccountItem {
13
13
  domainName?: string;
14
14
  /** 是否当前登录账号(当前项右侧渲染对勾,不显示移除按钮) */
15
15
  current?: boolean;
16
+ /** 昵称右侧徽标(如未读数);数值超过 99 自动折叠为 99+ */
17
+ badge?: string | number;
16
18
  }
17
19
  export interface CompanyAccountSwitcherProps {
18
20
  /** 账号列表(受控数据,由业务侧注入) */
@@ -24,6 +24,8 @@ export var CompanyAccountSwitcher = function CompanyAccountSwitcher(_ref) {
24
24
  children: list.map(function (account) {
25
25
  var displayName = account.nickname || account.username || "";
26
26
  var subName = account.username || account.domainName || "";
27
+ // 徽标文案:数值超过 99 折叠为 99+
28
+ var badgeText = account.badge === undefined || account.badge === null || account.badge === "" ? "" : typeof account.badge === "number" ? account.badge > 99 ? "99+" : String(account.badge) : account.badge;
27
29
  return /*#__PURE__*/_jsxs("div", {
28
30
  className: "account-switcher-item".concat(account.current ? " current" : ""),
29
31
  onClick: function onClick() {
@@ -40,9 +42,15 @@ export var CompanyAccountSwitcher = function CompanyAccountSwitcher(_ref) {
40
42
  children: (displayName || "A").charAt(0)
41
43
  }), /*#__PURE__*/_jsxs("div", {
42
44
  className: "account-switcher-info",
43
- children: [/*#__PURE__*/_jsx("div", {
45
+ children: [/*#__PURE__*/_jsxs("div", {
44
46
  className: "account-switcher-nickname",
45
- children: displayName || "账号"
47
+ children: [/*#__PURE__*/_jsx("span", {
48
+ className: "account-switcher-nickname-text",
49
+ children: displayName || "账号"
50
+ }), badgeText && /*#__PURE__*/_jsx("span", {
51
+ className: "account-switcher-badge",
52
+ children: badgeText
53
+ })]
46
54
  }), subName && /*#__PURE__*/_jsx("div", {
47
55
  className: "account-switcher-sub",
48
56
  children: subName
@@ -8,6 +8,7 @@
8
8
  display: flex;
9
9
  flex-direction: column;
10
10
  gap: 2px;
11
+ margin-top: 4px;
11
12
  }
12
13
 
13
14
  .account-switcher-item {
@@ -55,6 +56,13 @@
55
56
  }
56
57
 
57
58
  .account-switcher-nickname {
59
+ display: flex;
60
+ align-items: center;
61
+ gap: 4px;
62
+ min-width: 0;
63
+ }
64
+
65
+ .account-switcher-nickname-text {
58
66
  font-size: 14px;
59
67
  line-height: 20px;
60
68
  color: var(--company-color-text, rgba(0, 0, 0, 0.88));
@@ -63,6 +71,17 @@
63
71
  white-space: nowrap;
64
72
  }
65
73
 
74
+ .account-switcher-badge {
75
+ flex-shrink: 0;
76
+ padding: 0 4px;
77
+ border-radius: 8px;
78
+ background: var(--company-color-primary-bg, #fff1e6);
79
+ color: var(--company-color-primary, #f95914);
80
+ font-size: 12px;
81
+ line-height: 18px;
82
+ font-weight: 500;
83
+ }
84
+
66
85
  .account-switcher-sub {
67
86
  font-size: 12px;
68
87
  line-height: 18px;
@@ -35,6 +35,8 @@ export interface AdminLayoutTemplateProps {
35
35
  accountSwitcher?: React.ReactNode;
36
36
  /** 头像下拉自定义插槽:渲染在「切换账号」之后、「退出登录」之前(业务自定义入口区) */
37
37
  userMenuExtra?: React.ReactNode;
38
+ /** 「切换账号」入口与底部管理员行的徽标(如账号未读总数);数值超过 99 折叠为 99+ */
39
+ accountBadge?: string | number;
38
40
  /** 业务域列表(左侧导航顶部切换下拉) */
39
41
  domains?: SidebarDomain[];
40
42
  /** 当前业务域 id(受控;不传则组件内部管理) */
@@ -119,4 +121,4 @@ export interface AdminLayoutTemplateProps {
119
121
  * - 间距契约固化:内容区只做滚动容器(零间距),业务模板自带全部内边距与背景
120
122
  * - 两种内容模式:pages 配置式(key 与菜单联动)或 children 兜底(直接放业务模板)
121
123
  */
122
- export default function AdminLayoutTemplate({ className, style, logo, brandName, userInfo, onLogout, accountSwitcher, userMenuExtra, domains, currentDomainId, defaultDomainId, onDomainChange, businessMenus, firstMenus, systemBottomMenus, visibleMenuCount, emptyImage, customNavMenus, onCustomNavUpdate, defaultFavorites, onFavoritesChange, defaultActiveFirstMenu, defaultActiveKey, defaultSecondSidebarFixed, tabs, defaultTabs, activeTabKey, defaultActiveTabKey, onTabsChange, onActiveTabChange, onTabClose, homeTab, homeContent, tabSearch, tabSearchPlaceholder, tabExtra, aiAssistant, aiAssistantWidth, aiAssistantDefaultOpen, aiTransport, onMenuOpen, onActiveFirstMenuChange, pages, children, contentClassName, contentStyle, }: AdminLayoutTemplateProps): import("react").JSX.Element;
124
+ export default function AdminLayoutTemplate({ className, style, logo, brandName, userInfo, onLogout, accountSwitcher, userMenuExtra, accountBadge, domains, currentDomainId, defaultDomainId, onDomainChange, businessMenus, firstMenus, systemBottomMenus, visibleMenuCount, emptyImage, customNavMenus, onCustomNavUpdate, defaultFavorites, onFavoritesChange, defaultActiveFirstMenu, defaultActiveKey, defaultSecondSidebarFixed, tabs, defaultTabs, activeTabKey, defaultActiveTabKey, onTabsChange, onActiveTabChange, onTabClose, homeTab, homeContent, tabSearch, tabSearchPlaceholder, tabExtra, aiAssistant, aiAssistantWidth, aiAssistantDefaultOpen, aiTransport, onMenuOpen, onActiveFirstMenuChange, pages, children, contentClassName, contentStyle, }: AdminLayoutTemplateProps): import("react").JSX.Element;
@@ -450,6 +450,7 @@ export default function AdminLayoutTemplate(_ref2) {
450
450
  onLogout = _ref2.onLogout,
451
451
  accountSwitcher = _ref2.accountSwitcher,
452
452
  userMenuExtra = _ref2.userMenuExtra,
453
+ accountBadge = _ref2.accountBadge,
453
454
  _ref2$domains = _ref2.domains,
454
455
  domains = _ref2$domains === void 0 ? [] : _ref2$domains,
455
456
  currentDomainId = _ref2.currentDomainId,
@@ -1009,6 +1010,7 @@ export default function AdminLayoutTemplate(_ref2) {
1009
1010
  emptyImage: emptyImage,
1010
1011
  accountSwitcher: accountSwitcher,
1011
1012
  userMenuExtra: userMenuExtra,
1013
+ accountBadge: accountBadge,
1012
1014
  onLogout: onLogout
1013
1015
  }), /*#__PURE__*/_jsxs("div", {
1014
1016
  className: "admin-layout-main",
@@ -28,6 +28,8 @@ export interface FirstSidebarProps {
28
28
  accountSwitcher?: React.ReactNode;
29
29
  /** 头像下拉自定义插槽:渲染在「切换账号」之后、「退出登录」之前(业务自定义入口区,如帮助中心等) */
30
30
  userMenuExtra?: React.ReactNode;
31
+ /** 「切换账号」入口与底部管理员行的徽标(如账号未读总数);数值超过 99 折叠为 99+ */
32
+ accountBadge?: string | number;
31
33
  onLogout?: () => void;
32
34
  }
33
- export default function FirstSidebar({ domains, currentDomainId, userInfo, logo, brandName, firstMenus, systemBottomMenus, businessMenus, customNavMenus, activeKey, activeFirstMenu, visibleMenuCount, bottomExtra, domainPopoverOpen, adminPopoverOpen, onDomainPopoverOpenChange, onAdminPopoverOpenChange, onDomainChange, onMenuClick, onBusinessMenuEnter, onBusinessMenuLeave, onOpenMore, accountSwitcher, userMenuExtra, onLogout, }: FirstSidebarProps): import("react").JSX.Element;
35
+ export default function FirstSidebar({ domains, currentDomainId, userInfo, logo, brandName, firstMenus, systemBottomMenus, businessMenus, customNavMenus, activeKey, activeFirstMenu, visibleMenuCount, bottomExtra, domainPopoverOpen, adminPopoverOpen, onDomainPopoverOpenChange, onAdminPopoverOpenChange, onDomainChange, onMenuClick, onBusinessMenuEnter, onBusinessMenuLeave, onOpenMore, accountSwitcher, accountBadge, userMenuExtra, onLogout, }: FirstSidebarProps): import("react").JSX.Element;
@@ -36,9 +36,12 @@ export default function FirstSidebar(_ref) {
36
36
  onBusinessMenuLeave = _ref.onBusinessMenuLeave,
37
37
  onOpenMore = _ref.onOpenMore,
38
38
  accountSwitcher = _ref.accountSwitcher,
39
+ accountBadge = _ref.accountBadge,
39
40
  userMenuExtra = _ref.userMenuExtra,
40
41
  onLogout = _ref.onLogout;
41
42
  var hasMore = businessMenus.length > visibleMenuCount;
43
+ // 「切换账号」入口 / 底部管理员行的徽标文案:数值超过 99 折叠为 99+
44
+ var accountBadgeText = accountBadge === undefined || accountBadge === null || accountBadge === "" ? "" : typeof accountBadge === "number" ? accountBadge > 99 ? "99+" : String(accountBadge) : accountBadge;
42
45
  // 头像下拉视图:menu=功能菜单,accounts=切换账号面板。同一气泡内切换内容(飞书式),
43
46
  // 单一受控 Popover / 单一 open / 单一 portal,从结构上杜绝「菜单已关、面板残留」的双气泡同步问题
44
47
  var _useState = useState("menu"),
@@ -236,8 +239,6 @@ export default function FirstSidebar(_ref) {
236
239
  }), /*#__PURE__*/_jsx("span", {
237
240
  children: "\u5207\u6362\u8D26\u53F7"
238
241
  })]
239
- }), /*#__PURE__*/_jsx("div", {
240
- className: "admin-popover-divider"
241
242
  }), /*#__PURE__*/_jsx("div", {
242
243
  onClick: function onClick(e) {
243
244
  // 点选账号行 / 「登录更多账号」后整体收起气泡(业务回调由 accountSwitcher 内部触发)
@@ -260,6 +261,9 @@ export default function FirstSidebar(_ref) {
260
261
  size: 20
261
262
  }), /*#__PURE__*/_jsx("span", {
262
263
  children: "\u5207\u6362\u8D26\u53F7"
264
+ }), accountBadgeText && /*#__PURE__*/_jsx("span", {
265
+ className: "admin-popover-badge",
266
+ children: accountBadgeText
263
267
  })]
264
268
  }), userMenuExtra, (accountSwitcher || userMenuExtra) && onLogout && /*#__PURE__*/_jsx("div", {
265
269
  className: "admin-popover-divider"
@@ -282,6 +286,9 @@ export default function FirstSidebar(_ref) {
282
286
  }), /*#__PURE__*/_jsx("div", {
283
287
  className: "name",
284
288
  children: userInfo.nickname || userInfo.username || "admin"
289
+ }), accountBadgeText && /*#__PURE__*/_jsx("span", {
290
+ className: "person-info-badge",
291
+ children: accountBadgeText
285
292
  })]
286
293
  })
287
294
  })]
@@ -33,8 +33,10 @@ export interface CompanySidebarProps {
33
33
  onDomainPopoverOpenChange?: (open: boolean) => void;
34
34
  /** 切换账号面板内容(如 <CompanyAccountSwitcher/>);传入后头像下拉显示「切换账号」入口,点击后下拉内容切换为该面板(飞书式,非弹窗) */
35
35
  accountSwitcher?: React.ReactNode;
36
+ /** 「切换账号」入口与底部管理员行的徽标(如账号未读总数,由业务侧汇总传入);数值超过 99 折叠为 99+ */
37
+ accountBadge?: string | number;
36
38
  /** 头像下拉自定义插槽:渲染在「切换账号」之后、「退出登录」之前(业务自定义入口区,如帮助中心等) */
37
39
  userMenuExtra?: React.ReactNode;
38
40
  onLogout?: () => void;
39
41
  }
40
- export default function CompanySidebar({ className, style, domains, currentDomainId, onDomainChange, userInfo, logo, brandName, firstMenus, systemBottomMenus, businessMenus, customNavMenus, onCustomNavUpdate, favorites, onAddFavorite, onRemoveFavorite, onFavoritesReorder, activeFirstMenu, activeKey, onFirstMenuSelect, onMenuClick, expandedKeys, onExpandedKeysChange, secondSidebarFixed, onSecondSidebarFixedChange, visibleMenuCount, emptyImage, bottomExtra, onDomainPopoverOpenChange, accountSwitcher, userMenuExtra, onLogout, }: CompanySidebarProps): import("react").JSX.Element;
42
+ export default function CompanySidebar({ className, style, domains, currentDomainId, onDomainChange, userInfo, logo, brandName, firstMenus, systemBottomMenus, businessMenus, customNavMenus, onCustomNavUpdate, favorites, onAddFavorite, onRemoveFavorite, onFavoritesReorder, activeFirstMenu, activeKey, onFirstMenuSelect, onMenuClick, expandedKeys, onExpandedKeysChange, secondSidebarFixed, onSecondSidebarFixedChange, visibleMenuCount, emptyImage, bottomExtra, onDomainPopoverOpenChange, accountSwitcher, accountBadge, userMenuExtra, onLogout, }: CompanySidebarProps): import("react").JSX.Element;
@@ -81,6 +81,7 @@ export default function CompanySidebar(_ref) {
81
81
  bottomExtra = _ref.bottomExtra,
82
82
  _onDomainPopoverOpenChange = _ref.onDomainPopoverOpenChange,
83
83
  accountSwitcher = _ref.accountSwitcher,
84
+ accountBadge = _ref.accountBadge,
84
85
  userMenuExtra = _ref.userMenuExtra,
85
86
  onLogout = _ref.onLogout;
86
87
  var _useState = useState({
@@ -331,6 +332,7 @@ export default function CompanySidebar(_ref) {
331
332
  });
332
333
  },
333
334
  accountSwitcher: accountSwitcher,
335
+ accountBadge: accountBadge,
334
336
  userMenuExtra: userMenuExtra,
335
337
  onLogout: onLogout
336
338
  }), /*#__PURE__*/_jsx(SecondSidebar, {
@@ -173,6 +173,8 @@
173
173
  z-index: 0;
174
174
  opacity: 0.2;
175
175
  background: rgba(255, 255, 255, 0.2);
176
+ padding-bottom: 0;
177
+ margin-bottom: 6px;
176
178
  }
177
179
 
178
180
  .person-info {
@@ -185,6 +187,7 @@
185
187
  align-self: stretch;
186
188
  z-index: 5;
187
189
  cursor: pointer;
190
+ padding-bottom: 6px;
188
191
 
189
192
  &:hover {
190
193
  .avatar {
@@ -225,6 +228,18 @@
225
228
  white-space: nowrap;
226
229
  }
227
230
 
231
+ .person-info-badge {
232
+ flex-shrink: 0;
233
+ margin-left: auto;
234
+ padding: 0 4px;
235
+ border-radius: 8px;
236
+ background: var(--company-color-primary, #f95914);
237
+ color: #fff;
238
+ font-size: 10px;
239
+ line-height: 16px;
240
+ font-weight: 500;
241
+ }
242
+
228
243
  .menu-item {
229
244
  display: flex;
230
245
  align-items: center;
@@ -344,6 +359,7 @@
344
359
  gap: 8px;
345
360
  align-self: stretch;
346
361
  cursor: pointer;
362
+ padding-bottom: 6px;
347
363
  color: rgba(255, 255, 255, 0.65);
348
364
  transition: all 0.2s;
349
365
  z-index: 5;
@@ -478,6 +494,18 @@
478
494
  color: var(--company-color-text-secondary, rgba(0, 0, 0, 0.65));
479
495
  }
480
496
 
497
+ // 「切换账号」菜单行的徽标:账号列表存在未读等数值时展示(汇总数由业务侧传入 accountBadge)
498
+ .admin-popover-badge {
499
+ flex-shrink: 0;
500
+ padding: 0 4px;
501
+ border-radius: 8px;
502
+ background: var(--company-color-primary-bg, #fff1e6);
503
+ color: var(--company-color-primary, #f95914);
504
+ font-size: 12px;
505
+ line-height: 18px;
506
+ font-weight: 500;
507
+ }
508
+
481
509
  // ========== SecondSidebar 二级浅色侧栏 ==========
482
510
  .company-sidebar-second {
483
511
  width: 220px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@donglegeyu/company-ui",
3
- "version": "2.16.0",
3
+ "version": "2.17.1",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/es/index.js",
6
6
  "types": "dist/es/index.d.ts",