@donglegeyu/company-ui 2.15.0 → 2.17.0
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/cjs/basic-components/CompanyAccountSwitcher/index.d.ts +36 -0
- package/dist/cjs/basic-components/CompanyAccountSwitcher/index.js +84 -0
- package/dist/cjs/basic-components/CompanyAccountSwitcher/index.scss +147 -0
- package/dist/cjs/basic-components/index.d.ts +1 -0
- package/dist/cjs/basic-components/index.js +2 -0
- package/dist/cjs/sidebar-config.js +4 -0
- package/dist/cjs/template-components/AdminLayoutTemplate/index.d.ts +7 -3
- package/dist/cjs/template-components/AdminLayoutTemplate/index.js +6 -2
- package/dist/cjs/template-components/CompanySidebar/FirstSidebar.d.ts +7 -2
- package/dist/cjs/template-components/CompanySidebar/FirstSidebar.js +45 -7
- package/dist/cjs/template-components/CompanySidebar/index.d.ts +7 -2
- package/dist/cjs/template-components/CompanySidebar/index.js +6 -2
- package/dist/cjs/template-components/CompanySidebar/index.scss +48 -1
- package/dist/es/basic-components/CompanyAccountSwitcher/index.d.ts +36 -0
- package/dist/es/basic-components/CompanyAccountSwitcher/index.js +82 -0
- package/dist/es/basic-components/CompanyAccountSwitcher/index.scss +147 -0
- package/dist/es/basic-components/index.d.ts +1 -0
- package/dist/es/basic-components/index.js +1 -0
- package/dist/es/sidebar-config.js +3 -0
- package/dist/es/template-components/AdminLayoutTemplate/index.d.ts +7 -3
- package/dist/es/template-components/AdminLayoutTemplate/index.js +6 -2
- package/dist/es/template-components/CompanySidebar/FirstSidebar.d.ts +7 -2
- package/dist/es/template-components/CompanySidebar/FirstSidebar.js +69 -9
- package/dist/es/template-components/CompanySidebar/index.d.ts +7 -2
- package/dist/es/template-components/CompanySidebar/index.js +6 -2
- package/dist/es/template-components/CompanySidebar/index.scss +48 -1
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import "./index.scss";
|
|
3
|
+
export interface CompanyAccountItem {
|
|
4
|
+
/** 账号唯一标识 */
|
|
5
|
+
id: string | number;
|
|
6
|
+
/** 昵称(展示名,缺省回退 username) */
|
|
7
|
+
nickname?: string;
|
|
8
|
+
/** 登录用户名 */
|
|
9
|
+
username?: string;
|
|
10
|
+
/** 头像图片地址;缺省渲染昵称首字符圆标 */
|
|
11
|
+
avatar?: string;
|
|
12
|
+
/** 所属组织 / 域名称(副标题兜底展示) */
|
|
13
|
+
domainName?: string;
|
|
14
|
+
/** 是否当前登录账号(当前项右侧渲染对勾,不显示移除按钮) */
|
|
15
|
+
current?: boolean;
|
|
16
|
+
/** 昵称右侧徽标(如未读数);数值超过 99 自动折叠为 99+ */
|
|
17
|
+
badge?: string | number;
|
|
18
|
+
}
|
|
19
|
+
export interface CompanyAccountSwitcherProps {
|
|
20
|
+
/** 账号列表(受控数据,由业务侧注入) */
|
|
21
|
+
accounts: CompanyAccountItem[];
|
|
22
|
+
/** 点击账号项回调(业务侧执行切换登录) */
|
|
23
|
+
onSelectAccount?: (account: CompanyAccountItem) => void;
|
|
24
|
+
/** 点击「登录更多账号」回调;不传则不渲染该入口 */
|
|
25
|
+
onAddAccount?: () => void;
|
|
26
|
+
/** 移除账号回调;传入后非当前账号 hover 显示移除按钮 */
|
|
27
|
+
onRemoveAccount?: (account: CompanyAccountItem) => void;
|
|
28
|
+
className?: string;
|
|
29
|
+
style?: React.CSSProperties;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 通用账号切换面板(纯 UI 受控组件)。
|
|
33
|
+
* 渲染:账号列表(首字符头像 + 昵称 + 用户名/组织名,当前项打勾)+ 分隔线 + 「登录更多账号」。
|
|
34
|
+
* 数据与动作全部由业务侧通过 Props 注入,组件内不耦合任何登录/会话逻辑。
|
|
35
|
+
*/
|
|
36
|
+
export declare const CompanyAccountSwitcher: React.FC<CompanyAccountSwitcherProps>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/basic-components/CompanyAccountSwitcher/index.tsx
|
|
20
|
+
var CompanyAccountSwitcher_exports = {};
|
|
21
|
+
__export(CompanyAccountSwitcher_exports, {
|
|
22
|
+
CompanyAccountSwitcher: () => CompanyAccountSwitcher
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(CompanyAccountSwitcher_exports);
|
|
25
|
+
var import_icons = require("@ant-design/icons");
|
|
26
|
+
var import_index = require("./index.scss");
|
|
27
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
+
var CompanyAccountSwitcher = ({
|
|
29
|
+
accounts,
|
|
30
|
+
onSelectAccount,
|
|
31
|
+
onAddAccount,
|
|
32
|
+
onRemoveAccount,
|
|
33
|
+
className,
|
|
34
|
+
style
|
|
35
|
+
}) => {
|
|
36
|
+
const list = accounts || [];
|
|
37
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `company-account-switcher${className ? ` ${className}` : ""}`, style, children: [
|
|
38
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "account-switcher-list", children: list.map((account) => {
|
|
39
|
+
const displayName = account.nickname || account.username || "";
|
|
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;
|
|
42
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
className: `account-switcher-item${account.current ? " current" : ""}`,
|
|
46
|
+
onClick: () => onSelectAccount == null ? void 0 : onSelectAccount(account),
|
|
47
|
+
children: [
|
|
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) }),
|
|
49
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "account-switcher-info", children: [
|
|
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
|
+
] }),
|
|
54
|
+
subName && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "account-switcher-sub", children: subName })
|
|
55
|
+
] }),
|
|
56
|
+
account.current && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CheckOutlined, { className: "account-switcher-check" }),
|
|
57
|
+
onRemoveAccount && !account.current && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
58
|
+
import_icons.CloseOutlined,
|
|
59
|
+
{
|
|
60
|
+
className: "account-switcher-remove",
|
|
61
|
+
onClick: (e) => {
|
|
62
|
+
e.stopPropagation();
|
|
63
|
+
onRemoveAccount(account);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
account.id
|
|
70
|
+
);
|
|
71
|
+
}) }),
|
|
72
|
+
onAddAccount && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
73
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "account-switcher-divider" }),
|
|
74
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "account-switcher-add", onClick: onAddAccount, children: [
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.UserAddOutlined, {}),
|
|
76
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "登录更多账号" })
|
|
77
|
+
] })
|
|
78
|
+
] })
|
|
79
|
+
] });
|
|
80
|
+
};
|
|
81
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
82
|
+
0 && (module.exports = {
|
|
83
|
+
CompanyAccountSwitcher
|
|
84
|
+
});
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// ========== Account Switcher ==========
|
|
2
|
+
// 与 CompanySidebar admin-popover 同风格族:hover 浅灰底 + 4px 圆角 + 1px 分隔线
|
|
3
|
+
.company-account-switcher {
|
|
4
|
+
min-width: 240px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.account-switcher-list {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: 2px;
|
|
11
|
+
margin-top: 4px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.account-switcher-item {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: 10px;
|
|
18
|
+
padding: 4px;
|
|
19
|
+
border-radius: 4px;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
transition: background 0.2s;
|
|
22
|
+
|
|
23
|
+
/* 当前账号行间距更紧凑 */
|
|
24
|
+
&.current {
|
|
25
|
+
gap: 8px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&:hover {
|
|
29
|
+
background: var(--company-color-bg-light, #f5f5f5);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.account-switcher-avatar {
|
|
34
|
+
width: 28px;
|
|
35
|
+
height: 28px;
|
|
36
|
+
flex-shrink: 0;
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
border-radius: 50%;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
background: var(--company-color-primary-bg, #fff1e6);
|
|
43
|
+
color: var(--company-color-primary, #f95914);
|
|
44
|
+
font-size: 12px;
|
|
45
|
+
|
|
46
|
+
img {
|
|
47
|
+
width: 100%;
|
|
48
|
+
height: 100%;
|
|
49
|
+
object-fit: cover;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.account-switcher-info {
|
|
54
|
+
flex: 1;
|
|
55
|
+
min-width: 0;
|
|
56
|
+
}
|
|
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 {
|
|
66
|
+
font-size: 14px;
|
|
67
|
+
line-height: 20px;
|
|
68
|
+
color: var(--company-color-text, rgba(0, 0, 0, 0.88));
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
text-overflow: ellipsis;
|
|
71
|
+
white-space: nowrap;
|
|
72
|
+
}
|
|
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
|
+
|
|
85
|
+
.account-switcher-sub {
|
|
86
|
+
font-size: 12px;
|
|
87
|
+
line-height: 18px;
|
|
88
|
+
color: var(--company-color-text-tertiary, rgba(0, 0, 0, 0.45));
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
text-overflow: ellipsis;
|
|
91
|
+
white-space: nowrap;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.account-switcher-check {
|
|
95
|
+
flex-shrink: 0;
|
|
96
|
+
font-size: 14px;
|
|
97
|
+
color: var(--company-color-primary, #f95914);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.account-switcher-remove {
|
|
101
|
+
flex-shrink: 0;
|
|
102
|
+
font-size: 12px;
|
|
103
|
+
color: var(--company-color-text-quaternary, rgba(0, 0, 0, 0.25));
|
|
104
|
+
opacity: 0;
|
|
105
|
+
transition:
|
|
106
|
+
opacity 0.2s,
|
|
107
|
+
color 0.2s;
|
|
108
|
+
|
|
109
|
+
&:hover {
|
|
110
|
+
color: var(--company-color-error, #ff4d4f);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.account-switcher-item:hover .account-switcher-remove {
|
|
115
|
+
opacity: 1;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.account-switcher-divider {
|
|
119
|
+
height: 1px;
|
|
120
|
+
background: var(--company-color-border-secondary, #f0f0f0);
|
|
121
|
+
margin: 8px 0;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.account-switcher-add {
|
|
125
|
+
height: 32px;
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
padding: 4px 12px;
|
|
129
|
+
gap: 8px;
|
|
130
|
+
border-radius: 4px;
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
transition: background 0.2s;
|
|
133
|
+
color: var(--company-color-text, rgba(0, 0, 0, 0.88));
|
|
134
|
+
|
|
135
|
+
&:hover {
|
|
136
|
+
background: var(--company-color-bg-light, #f5f5f5);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.anticon {
|
|
140
|
+
font-size: 16px;
|
|
141
|
+
color: var(--company-color-primary, #f95914);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
span {
|
|
145
|
+
font-size: 14px;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -16,6 +16,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
16
16
|
// src/basic-components/index.ts
|
|
17
17
|
var basic_components_exports = {};
|
|
18
18
|
module.exports = __toCommonJS(basic_components_exports);
|
|
19
|
+
__reExport(basic_components_exports, require("./CompanyAccountSwitcher"), module.exports);
|
|
19
20
|
__reExport(basic_components_exports, require("./CompanyActions"), module.exports);
|
|
20
21
|
__reExport(basic_components_exports, require("./CompanyAffix"), module.exports);
|
|
21
22
|
__reExport(basic_components_exports, require("./CompanyAlert"), module.exports);
|
|
@@ -107,6 +108,7 @@ __reExport(basic_components_exports, require("./CompanyWelcome"), module.exports
|
|
|
107
108
|
__reExport(basic_components_exports, require("./CompanyXProvider"), module.exports);
|
|
108
109
|
// Annotate the CommonJS export names for ESM import in node:
|
|
109
110
|
0 && (module.exports = {
|
|
111
|
+
...require("./CompanyAccountSwitcher"),
|
|
110
112
|
...require("./CompanyActions"),
|
|
111
113
|
...require("./CompanyAffix"),
|
|
112
114
|
...require("./CompanyAlert"),
|
|
@@ -217,6 +217,10 @@ var TEMPLATE_GROUPS = [
|
|
|
217
217
|
},
|
|
218
218
|
{ title: "操作按钮组 ActionCell", link: "/template-components/action-cell" },
|
|
219
219
|
{ title: "视图切换器 ViewSwitcher", link: "/template-components/view-switcher" },
|
|
220
|
+
{
|
|
221
|
+
title: "账号切换器 AccountSwitcher",
|
|
222
|
+
link: "/template-components/company-account-switcher"
|
|
223
|
+
},
|
|
220
224
|
{ title: "分组标题 SectionTitle", link: "/template-components/section-title" },
|
|
221
225
|
{ title: "页面标题 PageTitle", link: "/template-components/page-title" },
|
|
222
226
|
{ title: "多列表单 BaseInfoForm", link: "/template-components/base-info-form" },
|
|
@@ -31,8 +31,12 @@ export interface AdminLayoutTemplateProps {
|
|
|
31
31
|
userInfo?: SidebarUserInfo;
|
|
32
32
|
/** 退出登录回调 */
|
|
33
33
|
onLogout?: () => void;
|
|
34
|
-
/**
|
|
35
|
-
|
|
34
|
+
/** 切换账号面板内容(如 <CompanyAccountSwitcher/>);传入后头像下拉显示「切换账号」入口,点击后下拉内容切换为该面板(飞书式,非弹窗) */
|
|
35
|
+
accountSwitcher?: React.ReactNode;
|
|
36
|
+
/** 头像下拉自定义插槽:渲染在「切换账号」之后、「退出登录」之前(业务自定义入口区) */
|
|
37
|
+
userMenuExtra?: React.ReactNode;
|
|
38
|
+
/** 「切换账号」入口与底部管理员行的徽标(如账号未读总数);数值超过 99 折叠为 99+ */
|
|
39
|
+
accountBadge?: string | number;
|
|
36
40
|
/** 业务域列表(左侧导航顶部切换下拉) */
|
|
37
41
|
domains?: SidebarDomain[];
|
|
38
42
|
/** 当前业务域 id(受控;不传则组件内部管理) */
|
|
@@ -117,4 +121,4 @@ export interface AdminLayoutTemplateProps {
|
|
|
117
121
|
* - 间距契约固化:内容区只做滚动容器(零间距),业务模板自带全部内边距与背景
|
|
118
122
|
* - 两种内容模式:pages 配置式(key 与菜单联动)或 children 兜底(直接放业务模板)
|
|
119
123
|
*/
|
|
120
|
-
export default function AdminLayoutTemplate({ className, style, logo, brandName, userInfo, onLogout,
|
|
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;
|
|
@@ -317,7 +317,9 @@ function AdminLayoutTemplate({
|
|
|
317
317
|
brandName,
|
|
318
318
|
userInfo,
|
|
319
319
|
onLogout,
|
|
320
|
-
|
|
320
|
+
accountSwitcher,
|
|
321
|
+
userMenuExtra,
|
|
322
|
+
accountBadge,
|
|
321
323
|
domains = [],
|
|
322
324
|
currentDomainId,
|
|
323
325
|
defaultDomainId,
|
|
@@ -826,7 +828,9 @@ function AdminLayoutTemplate({
|
|
|
826
828
|
onSecondSidebarFixedChange: setSecondSidebarFixed,
|
|
827
829
|
visibleMenuCount,
|
|
828
830
|
emptyImage,
|
|
829
|
-
|
|
831
|
+
accountSwitcher,
|
|
832
|
+
userMenuExtra,
|
|
833
|
+
accountBadge,
|
|
830
834
|
onLogout
|
|
831
835
|
}
|
|
832
836
|
),
|
|
@@ -24,7 +24,12 @@ export interface FirstSidebarProps {
|
|
|
24
24
|
onBusinessMenuEnter: (menu: SidebarMenuItem, e: React.MouseEvent) => void;
|
|
25
25
|
onBusinessMenuLeave: (e: React.MouseEvent) => void;
|
|
26
26
|
onOpenMore: () => void;
|
|
27
|
-
|
|
27
|
+
/** 切换账号面板内容(如 <CompanyAccountSwitcher/>);传入后头像下拉显示「切换账号」入口,点击后下拉内容切换为该面板(飞书式,非弹窗) */
|
|
28
|
+
accountSwitcher?: React.ReactNode;
|
|
29
|
+
/** 头像下拉自定义插槽:渲染在「切换账号」之后、「退出登录」之前(业务自定义入口区,如帮助中心等) */
|
|
30
|
+
userMenuExtra?: React.ReactNode;
|
|
31
|
+
/** 「切换账号」入口与底部管理员行的徽标(如账号未读总数);数值超过 99 折叠为 99+ */
|
|
32
|
+
accountBadge?: string | number;
|
|
28
33
|
onLogout?: () => void;
|
|
29
34
|
}
|
|
30
|
-
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,
|
|
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;
|
|
@@ -50,10 +50,20 @@ function FirstSidebar({
|
|
|
50
50
|
onBusinessMenuEnter,
|
|
51
51
|
onBusinessMenuLeave,
|
|
52
52
|
onOpenMore,
|
|
53
|
-
|
|
53
|
+
accountSwitcher,
|
|
54
|
+
accountBadge,
|
|
55
|
+
userMenuExtra,
|
|
54
56
|
onLogout
|
|
55
57
|
}) {
|
|
56
58
|
const hasMore = businessMenus.length > visibleMenuCount;
|
|
59
|
+
const accountBadgeText = accountBadge === void 0 || accountBadge === null || accountBadge === "" ? "" : typeof accountBadge === "number" ? accountBadge > 99 ? "99+" : String(accountBadge) : accountBadge;
|
|
60
|
+
const [adminView, setAdminView] = (0, import_react.useState)("menu");
|
|
61
|
+
const [prevAdminOpen, setPrevAdminOpen] = (0, import_react.useState)(adminPopoverOpen);
|
|
62
|
+
if (prevAdminOpen !== adminPopoverOpen) {
|
|
63
|
+
setPrevAdminOpen(adminPopoverOpen);
|
|
64
|
+
if (!adminPopoverOpen)
|
|
65
|
+
setAdminView("menu");
|
|
66
|
+
}
|
|
57
67
|
const displayMenus = (() => {
|
|
58
68
|
if (Array.isArray(customNavMenus) && customNavMenus.length > 0) {
|
|
59
69
|
return customNavMenus.slice(0, visibleMenuCount);
|
|
@@ -159,12 +169,39 @@ function FirstSidebar({
|
|
|
159
169
|
onOpenChange: onAdminPopoverOpenChange,
|
|
160
170
|
trigger: "click",
|
|
161
171
|
placement: "rightBottom",
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
172
|
+
destroyOnHidden: true,
|
|
173
|
+
content: adminView === "accounts" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "admin-popover-content admin-popover-content--panel", children: [
|
|
174
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
175
|
+
"div",
|
|
176
|
+
{
|
|
177
|
+
className: "admin-popover-item admin-popover-back",
|
|
178
|
+
onClick: () => setAdminView("menu"),
|
|
179
|
+
children: [
|
|
180
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_shared_components.SvgIcon, { name: "left", size: 20 }),
|
|
181
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "切换账号" })
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
),
|
|
185
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
186
|
+
"div",
|
|
187
|
+
{
|
|
188
|
+
onClick: (e) => {
|
|
189
|
+
const target = e.target;
|
|
190
|
+
if (target.closest(".account-switcher-item, .account-switcher-add")) {
|
|
191
|
+
onAdminPopoverOpenChange(false);
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
children: accountSwitcher
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "admin-popover-content", children: [
|
|
198
|
+
accountSwitcher && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "admin-popover-item", onClick: () => setAdminView("accounts"), children: [
|
|
199
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_shared_components.SvgIcon, { name: "transfer-data", size: 20 }),
|
|
200
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "切换账号" }),
|
|
201
|
+
accountBadgeText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "admin-popover-badge", children: accountBadgeText })
|
|
166
202
|
] }),
|
|
167
|
-
|
|
203
|
+
userMenuExtra,
|
|
204
|
+
(accountSwitcher || userMenuExtra) && onLogout && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "admin-popover-divider" }),
|
|
168
205
|
onLogout && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "admin-popover-item", onClick: onLogout, children: [
|
|
169
206
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_shared_components.SvgIcon, { name: "logout", size: 20 }),
|
|
170
207
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "退出登录" })
|
|
@@ -172,7 +209,8 @@ function FirstSidebar({
|
|
|
172
209
|
] }),
|
|
173
210
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "person-info", children: [
|
|
174
211
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "avatar", children: (userInfo.nickname || userInfo.username || "A").charAt(0) }),
|
|
175
|
-
/* @__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 })
|
|
176
214
|
] })
|
|
177
215
|
}
|
|
178
216
|
)
|
|
@@ -31,7 +31,12 @@ export interface CompanySidebarProps {
|
|
|
31
31
|
emptyImage?: string;
|
|
32
32
|
bottomExtra?: React.ReactNode;
|
|
33
33
|
onDomainPopoverOpenChange?: (open: boolean) => void;
|
|
34
|
-
|
|
34
|
+
/** 切换账号面板内容(如 <CompanyAccountSwitcher/>);传入后头像下拉显示「切换账号」入口,点击后下拉内容切换为该面板(飞书式,非弹窗) */
|
|
35
|
+
accountSwitcher?: React.ReactNode;
|
|
36
|
+
/** 「切换账号」入口与底部管理员行的徽标(如账号未读总数,由业务侧汇总传入);数值超过 99 折叠为 99+ */
|
|
37
|
+
accountBadge?: string | number;
|
|
38
|
+
/** 头像下拉自定义插槽:渲染在「切换账号」之后、「退出登录」之前(业务自定义入口区,如帮助中心等) */
|
|
39
|
+
userMenuExtra?: React.ReactNode;
|
|
35
40
|
onLogout?: () => void;
|
|
36
41
|
}
|
|
37
|
-
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,
|
|
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;
|
|
@@ -92,7 +92,9 @@ function CompanySidebar({
|
|
|
92
92
|
emptyImage,
|
|
93
93
|
bottomExtra,
|
|
94
94
|
onDomainPopoverOpenChange,
|
|
95
|
-
|
|
95
|
+
accountSwitcher,
|
|
96
|
+
accountBadge,
|
|
97
|
+
userMenuExtra,
|
|
96
98
|
onLogout
|
|
97
99
|
}) {
|
|
98
100
|
const [state, setState] = (0, import_react.useState)({
|
|
@@ -266,7 +268,9 @@ function CompanySidebar({
|
|
|
266
268
|
onBusinessMenuEnter: handleBusinessMenuEnter,
|
|
267
269
|
onBusinessMenuLeave: handleBusinessMenuLeave,
|
|
268
270
|
onOpenMore: () => setState((prev) => ({ ...prev, moreDrawerOpen: !prev.moreDrawerOpen })),
|
|
269
|
-
|
|
271
|
+
accountSwitcher,
|
|
272
|
+
accountBadge,
|
|
273
|
+
userMenuExtra,
|
|
270
274
|
onLogout
|
|
271
275
|
}
|
|
272
276
|
),
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
display: flex;
|
|
162
162
|
flex-direction: column;
|
|
163
163
|
padding: 0 12px;
|
|
164
|
-
gap:
|
|
164
|
+
gap: 6px;
|
|
165
165
|
align-self: stretch;
|
|
166
166
|
z-index: 4;
|
|
167
167
|
}
|
|
@@ -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;
|
|
@@ -459,6 +475,37 @@
|
|
|
459
475
|
margin: 8px 0;
|
|
460
476
|
}
|
|
461
477
|
|
|
478
|
+
// 切换账号面板视图:气泡容器(.ant-popover-container,左右各 12px 内边距)总宽固定 200px,
|
|
479
|
+
// 内容区 176px;覆盖 CompanyAccountSwitcher 的 240px 最小宽度,让其铺满容器
|
|
480
|
+
.admin-popover-content--panel {
|
|
481
|
+
width: 176px;
|
|
482
|
+
|
|
483
|
+
.company-account-switcher {
|
|
484
|
+
width: 100%;
|
|
485
|
+
min-width: 0;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// 面板视图顶部的返回行(返回功能菜单):紧凑内边距与间距(覆盖 .admin-popover-item 的 38px / 4px 12px / 6px)
|
|
490
|
+
.admin-popover-back {
|
|
491
|
+
height: 32px;
|
|
492
|
+
padding: 4px;
|
|
493
|
+
gap: 4px;
|
|
494
|
+
color: var(--company-color-text-secondary, rgba(0, 0, 0, 0.65));
|
|
495
|
+
}
|
|
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
|
+
|
|
462
509
|
// ========== SecondSidebar 二级浅色侧栏 ==========
|
|
463
510
|
.company-sidebar-second {
|
|
464
511
|
width: 220px;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import "./index.scss";
|
|
3
|
+
export interface CompanyAccountItem {
|
|
4
|
+
/** 账号唯一标识 */
|
|
5
|
+
id: string | number;
|
|
6
|
+
/** 昵称(展示名,缺省回退 username) */
|
|
7
|
+
nickname?: string;
|
|
8
|
+
/** 登录用户名 */
|
|
9
|
+
username?: string;
|
|
10
|
+
/** 头像图片地址;缺省渲染昵称首字符圆标 */
|
|
11
|
+
avatar?: string;
|
|
12
|
+
/** 所属组织 / 域名称(副标题兜底展示) */
|
|
13
|
+
domainName?: string;
|
|
14
|
+
/** 是否当前登录账号(当前项右侧渲染对勾,不显示移除按钮) */
|
|
15
|
+
current?: boolean;
|
|
16
|
+
/** 昵称右侧徽标(如未读数);数值超过 99 自动折叠为 99+ */
|
|
17
|
+
badge?: string | number;
|
|
18
|
+
}
|
|
19
|
+
export interface CompanyAccountSwitcherProps {
|
|
20
|
+
/** 账号列表(受控数据,由业务侧注入) */
|
|
21
|
+
accounts: CompanyAccountItem[];
|
|
22
|
+
/** 点击账号项回调(业务侧执行切换登录) */
|
|
23
|
+
onSelectAccount?: (account: CompanyAccountItem) => void;
|
|
24
|
+
/** 点击「登录更多账号」回调;不传则不渲染该入口 */
|
|
25
|
+
onAddAccount?: () => void;
|
|
26
|
+
/** 移除账号回调;传入后非当前账号 hover 显示移除按钮 */
|
|
27
|
+
onRemoveAccount?: (account: CompanyAccountItem) => void;
|
|
28
|
+
className?: string;
|
|
29
|
+
style?: React.CSSProperties;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 通用账号切换面板(纯 UI 受控组件)。
|
|
33
|
+
* 渲染:账号列表(首字符头像 + 昵称 + 用户名/组织名,当前项打勾)+ 分隔线 + 「登录更多账号」。
|
|
34
|
+
* 数据与动作全部由业务侧通过 Props 注入,组件内不耦合任何登录/会话逻辑。
|
|
35
|
+
*/
|
|
36
|
+
export declare const CompanyAccountSwitcher: React.FC<CompanyAccountSwitcherProps>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { CheckOutlined, CloseOutlined, UserAddOutlined } from "@ant-design/icons";
|
|
2
|
+
import "./index.scss";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
6
|
+
/**
|
|
7
|
+
* 通用账号切换面板(纯 UI 受控组件)。
|
|
8
|
+
* 渲染:账号列表(首字符头像 + 昵称 + 用户名/组织名,当前项打勾)+ 分隔线 + 「登录更多账号」。
|
|
9
|
+
* 数据与动作全部由业务侧通过 Props 注入,组件内不耦合任何登录/会话逻辑。
|
|
10
|
+
*/
|
|
11
|
+
export var CompanyAccountSwitcher = function CompanyAccountSwitcher(_ref) {
|
|
12
|
+
var accounts = _ref.accounts,
|
|
13
|
+
onSelectAccount = _ref.onSelectAccount,
|
|
14
|
+
onAddAccount = _ref.onAddAccount,
|
|
15
|
+
onRemoveAccount = _ref.onRemoveAccount,
|
|
16
|
+
className = _ref.className,
|
|
17
|
+
style = _ref.style;
|
|
18
|
+
var list = accounts || [];
|
|
19
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
20
|
+
className: "company-account-switcher".concat(className ? " ".concat(className) : ""),
|
|
21
|
+
style: style,
|
|
22
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
23
|
+
className: "account-switcher-list",
|
|
24
|
+
children: list.map(function (account) {
|
|
25
|
+
var displayName = account.nickname || account.username || "";
|
|
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;
|
|
29
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
30
|
+
className: "account-switcher-item".concat(account.current ? " current" : ""),
|
|
31
|
+
onClick: function onClick() {
|
|
32
|
+
return onSelectAccount === null || onSelectAccount === void 0 ? void 0 : onSelectAccount(account);
|
|
33
|
+
},
|
|
34
|
+
children: [account.avatar ? /*#__PURE__*/_jsx("span", {
|
|
35
|
+
className: "account-switcher-avatar",
|
|
36
|
+
children: /*#__PURE__*/_jsx("img", {
|
|
37
|
+
src: account.avatar,
|
|
38
|
+
alt: displayName || "avatar"
|
|
39
|
+
})
|
|
40
|
+
}) : /*#__PURE__*/_jsx("span", {
|
|
41
|
+
className: "account-switcher-avatar",
|
|
42
|
+
children: (displayName || "A").charAt(0)
|
|
43
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
44
|
+
className: "account-switcher-info",
|
|
45
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
46
|
+
className: "account-switcher-nickname",
|
|
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
|
+
})]
|
|
54
|
+
}), subName && /*#__PURE__*/_jsx("div", {
|
|
55
|
+
className: "account-switcher-sub",
|
|
56
|
+
children: subName
|
|
57
|
+
})]
|
|
58
|
+
}), account.current && /*#__PURE__*/_jsx(CheckOutlined, {
|
|
59
|
+
className: "account-switcher-check"
|
|
60
|
+
}), onRemoveAccount && !account.current && /*#__PURE__*/_jsx(CloseOutlined, {
|
|
61
|
+
className: "account-switcher-remove",
|
|
62
|
+
onClick: function onClick(e) {
|
|
63
|
+
// 移除是独立意图:阻断账号项的选中冒泡
|
|
64
|
+
e.stopPropagation();
|
|
65
|
+
onRemoveAccount(account);
|
|
66
|
+
}
|
|
67
|
+
})]
|
|
68
|
+
}, account.id);
|
|
69
|
+
})
|
|
70
|
+
}), onAddAccount && /*#__PURE__*/_jsxs(_Fragment, {
|
|
71
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
72
|
+
className: "account-switcher-divider"
|
|
73
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
74
|
+
className: "account-switcher-add",
|
|
75
|
+
onClick: onAddAccount,
|
|
76
|
+
children: [/*#__PURE__*/_jsx(UserAddOutlined, {}), /*#__PURE__*/_jsx("span", {
|
|
77
|
+
children: "\u767B\u5F55\u66F4\u591A\u8D26\u53F7"
|
|
78
|
+
})]
|
|
79
|
+
})]
|
|
80
|
+
})]
|
|
81
|
+
});
|
|
82
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// ========== Account Switcher ==========
|
|
2
|
+
// 与 CompanySidebar admin-popover 同风格族:hover 浅灰底 + 4px 圆角 + 1px 分隔线
|
|
3
|
+
.company-account-switcher {
|
|
4
|
+
min-width: 240px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.account-switcher-list {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: 2px;
|
|
11
|
+
margin-top: 4px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.account-switcher-item {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: 10px;
|
|
18
|
+
padding: 4px;
|
|
19
|
+
border-radius: 4px;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
transition: background 0.2s;
|
|
22
|
+
|
|
23
|
+
/* 当前账号行间距更紧凑 */
|
|
24
|
+
&.current {
|
|
25
|
+
gap: 8px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&:hover {
|
|
29
|
+
background: var(--company-color-bg-light, #f5f5f5);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.account-switcher-avatar {
|
|
34
|
+
width: 28px;
|
|
35
|
+
height: 28px;
|
|
36
|
+
flex-shrink: 0;
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
border-radius: 50%;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
background: var(--company-color-primary-bg, #fff1e6);
|
|
43
|
+
color: var(--company-color-primary, #f95914);
|
|
44
|
+
font-size: 12px;
|
|
45
|
+
|
|
46
|
+
img {
|
|
47
|
+
width: 100%;
|
|
48
|
+
height: 100%;
|
|
49
|
+
object-fit: cover;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.account-switcher-info {
|
|
54
|
+
flex: 1;
|
|
55
|
+
min-width: 0;
|
|
56
|
+
}
|
|
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 {
|
|
66
|
+
font-size: 14px;
|
|
67
|
+
line-height: 20px;
|
|
68
|
+
color: var(--company-color-text, rgba(0, 0, 0, 0.88));
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
text-overflow: ellipsis;
|
|
71
|
+
white-space: nowrap;
|
|
72
|
+
}
|
|
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
|
+
|
|
85
|
+
.account-switcher-sub {
|
|
86
|
+
font-size: 12px;
|
|
87
|
+
line-height: 18px;
|
|
88
|
+
color: var(--company-color-text-tertiary, rgba(0, 0, 0, 0.45));
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
text-overflow: ellipsis;
|
|
91
|
+
white-space: nowrap;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.account-switcher-check {
|
|
95
|
+
flex-shrink: 0;
|
|
96
|
+
font-size: 14px;
|
|
97
|
+
color: var(--company-color-primary, #f95914);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.account-switcher-remove {
|
|
101
|
+
flex-shrink: 0;
|
|
102
|
+
font-size: 12px;
|
|
103
|
+
color: var(--company-color-text-quaternary, rgba(0, 0, 0, 0.25));
|
|
104
|
+
opacity: 0;
|
|
105
|
+
transition:
|
|
106
|
+
opacity 0.2s,
|
|
107
|
+
color 0.2s;
|
|
108
|
+
|
|
109
|
+
&:hover {
|
|
110
|
+
color: var(--company-color-error, #ff4d4f);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.account-switcher-item:hover .account-switcher-remove {
|
|
115
|
+
opacity: 1;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.account-switcher-divider {
|
|
119
|
+
height: 1px;
|
|
120
|
+
background: var(--company-color-border-secondary, #f0f0f0);
|
|
121
|
+
margin: 8px 0;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.account-switcher-add {
|
|
125
|
+
height: 32px;
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
padding: 4px 12px;
|
|
129
|
+
gap: 8px;
|
|
130
|
+
border-radius: 4px;
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
transition: background 0.2s;
|
|
133
|
+
color: var(--company-color-text, rgba(0, 0, 0, 0.88));
|
|
134
|
+
|
|
135
|
+
&:hover {
|
|
136
|
+
background: var(--company-color-bg-light, #f5f5f5);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.anticon {
|
|
140
|
+
font-size: 16px;
|
|
141
|
+
color: var(--company-color-primary, #f95914);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
span {
|
|
145
|
+
font-size: 14px;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -373,6 +373,9 @@ export var TEMPLATE_GROUPS = [{
|
|
|
373
373
|
}, {
|
|
374
374
|
title: "视图切换器 ViewSwitcher",
|
|
375
375
|
link: "/template-components/view-switcher"
|
|
376
|
+
}, {
|
|
377
|
+
title: "账号切换器 AccountSwitcher",
|
|
378
|
+
link: "/template-components/company-account-switcher"
|
|
376
379
|
}, {
|
|
377
380
|
title: "分组标题 SectionTitle",
|
|
378
381
|
link: "/template-components/section-title"
|
|
@@ -31,8 +31,12 @@ export interface AdminLayoutTemplateProps {
|
|
|
31
31
|
userInfo?: SidebarUserInfo;
|
|
32
32
|
/** 退出登录回调 */
|
|
33
33
|
onLogout?: () => void;
|
|
34
|
-
/**
|
|
35
|
-
|
|
34
|
+
/** 切换账号面板内容(如 <CompanyAccountSwitcher/>);传入后头像下拉显示「切换账号」入口,点击后下拉内容切换为该面板(飞书式,非弹窗) */
|
|
35
|
+
accountSwitcher?: React.ReactNode;
|
|
36
|
+
/** 头像下拉自定义插槽:渲染在「切换账号」之后、「退出登录」之前(业务自定义入口区) */
|
|
37
|
+
userMenuExtra?: React.ReactNode;
|
|
38
|
+
/** 「切换账号」入口与底部管理员行的徽标(如账号未读总数);数值超过 99 折叠为 99+ */
|
|
39
|
+
accountBadge?: string | number;
|
|
36
40
|
/** 业务域列表(左侧导航顶部切换下拉) */
|
|
37
41
|
domains?: SidebarDomain[];
|
|
38
42
|
/** 当前业务域 id(受控;不传则组件内部管理) */
|
|
@@ -117,4 +121,4 @@ export interface AdminLayoutTemplateProps {
|
|
|
117
121
|
* - 间距契约固化:内容区只做滚动容器(零间距),业务模板自带全部内边距与背景
|
|
118
122
|
* - 两种内容模式:pages 配置式(key 与菜单联动)或 children 兜底(直接放业务模板)
|
|
119
123
|
*/
|
|
120
|
-
export default function AdminLayoutTemplate({ className, style, logo, brandName, userInfo, onLogout,
|
|
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;
|
|
@@ -448,7 +448,9 @@ export default function AdminLayoutTemplate(_ref2) {
|
|
|
448
448
|
brandName = _ref2.brandName,
|
|
449
449
|
userInfo = _ref2.userInfo,
|
|
450
450
|
onLogout = _ref2.onLogout,
|
|
451
|
-
|
|
451
|
+
accountSwitcher = _ref2.accountSwitcher,
|
|
452
|
+
userMenuExtra = _ref2.userMenuExtra,
|
|
453
|
+
accountBadge = _ref2.accountBadge,
|
|
452
454
|
_ref2$domains = _ref2.domains,
|
|
453
455
|
domains = _ref2$domains === void 0 ? [] : _ref2$domains,
|
|
454
456
|
currentDomainId = _ref2.currentDomainId,
|
|
@@ -1006,7 +1008,9 @@ export default function AdminLayoutTemplate(_ref2) {
|
|
|
1006
1008
|
onSecondSidebarFixedChange: setSecondSidebarFixed,
|
|
1007
1009
|
visibleMenuCount: visibleMenuCount,
|
|
1008
1010
|
emptyImage: emptyImage,
|
|
1009
|
-
|
|
1011
|
+
accountSwitcher: accountSwitcher,
|
|
1012
|
+
userMenuExtra: userMenuExtra,
|
|
1013
|
+
accountBadge: accountBadge,
|
|
1010
1014
|
onLogout: onLogout
|
|
1011
1015
|
}), /*#__PURE__*/_jsxs("div", {
|
|
1012
1016
|
className: "admin-layout-main",
|
|
@@ -24,7 +24,12 @@ export interface FirstSidebarProps {
|
|
|
24
24
|
onBusinessMenuEnter: (menu: SidebarMenuItem, e: React.MouseEvent) => void;
|
|
25
25
|
onBusinessMenuLeave: (e: React.MouseEvent) => void;
|
|
26
26
|
onOpenMore: () => void;
|
|
27
|
-
|
|
27
|
+
/** 切换账号面板内容(如 <CompanyAccountSwitcher/>);传入后头像下拉显示「切换账号」入口,点击后下拉内容切换为该面板(飞书式,非弹窗) */
|
|
28
|
+
accountSwitcher?: React.ReactNode;
|
|
29
|
+
/** 头像下拉自定义插槽:渲染在「切换账号」之后、「退出登录」之前(业务自定义入口区,如帮助中心等) */
|
|
30
|
+
userMenuExtra?: React.ReactNode;
|
|
31
|
+
/** 「切换账号」入口与底部管理员行的徽标(如账号未读总数);数值超过 99 折叠为 99+ */
|
|
32
|
+
accountBadge?: string | number;
|
|
28
33
|
onLogout?: () => void;
|
|
29
34
|
}
|
|
30
|
-
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,
|
|
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;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
8
|
import { CompanyPopover } from "../../basic-components";
|
|
3
9
|
import { SvgIcon } from "../../shared-components";
|
|
4
10
|
import "./index.scss";
|
|
@@ -29,9 +35,29 @@ export default function FirstSidebar(_ref) {
|
|
|
29
35
|
onBusinessMenuEnter = _ref.onBusinessMenuEnter,
|
|
30
36
|
onBusinessMenuLeave = _ref.onBusinessMenuLeave,
|
|
31
37
|
onOpenMore = _ref.onOpenMore,
|
|
32
|
-
|
|
38
|
+
accountSwitcher = _ref.accountSwitcher,
|
|
39
|
+
accountBadge = _ref.accountBadge,
|
|
40
|
+
userMenuExtra = _ref.userMenuExtra,
|
|
33
41
|
onLogout = _ref.onLogout;
|
|
34
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;
|
|
45
|
+
// 头像下拉视图:menu=功能菜单,accounts=切换账号面板。同一气泡内切换内容(飞书式),
|
|
46
|
+
// 单一受控 Popover / 单一 open / 单一 portal,从结构上杜绝「菜单已关、面板残留」的双气泡同步问题
|
|
47
|
+
var _useState = useState("menu"),
|
|
48
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
49
|
+
adminView = _useState2[0],
|
|
50
|
+
setAdminView = _useState2[1];
|
|
51
|
+
var _useState3 = useState(adminPopoverOpen),
|
|
52
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
53
|
+
prevAdminOpen = _useState4[0],
|
|
54
|
+
setPrevAdminOpen = _useState4[1];
|
|
55
|
+
// 受控 open 翻为 false 的同一渲染拍内重置视图(React 官方 render 期派生模式):
|
|
56
|
+
// 关闭与视图重置原子提交,下次打开必从菜单进入,无 effect 时序竞态
|
|
57
|
+
if (prevAdminOpen !== adminPopoverOpen) {
|
|
58
|
+
setPrevAdminOpen(adminPopoverOpen);
|
|
59
|
+
if (!adminPopoverOpen) setAdminView("menu");
|
|
60
|
+
}
|
|
35
61
|
var displayMenus = function () {
|
|
36
62
|
if (Array.isArray(customNavMenus) && customNavMenus.length > 0) {
|
|
37
63
|
return customNavMenus.slice(0, visibleMenuCount);
|
|
@@ -196,19 +222,50 @@ export default function FirstSidebar(_ref) {
|
|
|
196
222
|
open: adminPopoverOpen,
|
|
197
223
|
onOpenChange: onAdminPopoverOpenChange,
|
|
198
224
|
trigger: "click",
|
|
199
|
-
placement: "rightBottom"
|
|
200
|
-
|
|
225
|
+
placement: "rightBottom"
|
|
226
|
+
// 关闭即销毁整个内容树(含账号面板):单一 portal,不存在失锚残留/漂移
|
|
227
|
+
,
|
|
228
|
+
destroyOnHidden: true,
|
|
229
|
+
content: adminView === "accounts" ? /*#__PURE__*/_jsxs("div", {
|
|
230
|
+
className: "admin-popover-content admin-popover-content--panel",
|
|
231
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
232
|
+
className: "admin-popover-item admin-popover-back",
|
|
233
|
+
onClick: function onClick() {
|
|
234
|
+
return setAdminView("menu");
|
|
235
|
+
},
|
|
236
|
+
children: [/*#__PURE__*/_jsx(SvgIcon, {
|
|
237
|
+
name: "left",
|
|
238
|
+
size: 20
|
|
239
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
240
|
+
children: "\u5207\u6362\u8D26\u53F7"
|
|
241
|
+
})]
|
|
242
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
243
|
+
onClick: function onClick(e) {
|
|
244
|
+
// 点选账号行 / 「登录更多账号」后整体收起气泡(业务回调由 accountSwitcher 内部触发)
|
|
245
|
+
var target = e.target;
|
|
246
|
+
if (target.closest(".account-switcher-item, .account-switcher-add")) {
|
|
247
|
+
onAdminPopoverOpenChange(false);
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
children: accountSwitcher
|
|
251
|
+
})]
|
|
252
|
+
}) : /*#__PURE__*/_jsxs("div", {
|
|
201
253
|
className: "admin-popover-content",
|
|
202
|
-
children: [
|
|
254
|
+
children: [accountSwitcher && /*#__PURE__*/_jsxs("div", {
|
|
203
255
|
className: "admin-popover-item",
|
|
204
|
-
onClick:
|
|
256
|
+
onClick: function onClick() {
|
|
257
|
+
return setAdminView("accounts");
|
|
258
|
+
},
|
|
205
259
|
children: [/*#__PURE__*/_jsx(SvgIcon, {
|
|
206
|
-
name: "
|
|
260
|
+
name: "transfer-data",
|
|
207
261
|
size: 20
|
|
208
262
|
}), /*#__PURE__*/_jsx("span", {
|
|
209
|
-
children: "\
|
|
263
|
+
children: "\u5207\u6362\u8D26\u53F7"
|
|
264
|
+
}), accountBadgeText && /*#__PURE__*/_jsx("span", {
|
|
265
|
+
className: "admin-popover-badge",
|
|
266
|
+
children: accountBadgeText
|
|
210
267
|
})]
|
|
211
|
-
}),
|
|
268
|
+
}), userMenuExtra, (accountSwitcher || userMenuExtra) && onLogout && /*#__PURE__*/_jsx("div", {
|
|
212
269
|
className: "admin-popover-divider"
|
|
213
270
|
}), onLogout && /*#__PURE__*/_jsxs("div", {
|
|
214
271
|
className: "admin-popover-item",
|
|
@@ -229,6 +286,9 @@ export default function FirstSidebar(_ref) {
|
|
|
229
286
|
}), /*#__PURE__*/_jsx("div", {
|
|
230
287
|
className: "name",
|
|
231
288
|
children: userInfo.nickname || userInfo.username || "admin"
|
|
289
|
+
}), accountBadgeText && /*#__PURE__*/_jsx("span", {
|
|
290
|
+
className: "person-info-badge",
|
|
291
|
+
children: accountBadgeText
|
|
232
292
|
})]
|
|
233
293
|
})
|
|
234
294
|
})]
|
|
@@ -31,7 +31,12 @@ export interface CompanySidebarProps {
|
|
|
31
31
|
emptyImage?: string;
|
|
32
32
|
bottomExtra?: React.ReactNode;
|
|
33
33
|
onDomainPopoverOpenChange?: (open: boolean) => void;
|
|
34
|
-
|
|
34
|
+
/** 切换账号面板内容(如 <CompanyAccountSwitcher/>);传入后头像下拉显示「切换账号」入口,点击后下拉内容切换为该面板(飞书式,非弹窗) */
|
|
35
|
+
accountSwitcher?: React.ReactNode;
|
|
36
|
+
/** 「切换账号」入口与底部管理员行的徽标(如账号未读总数,由业务侧汇总传入);数值超过 99 折叠为 99+ */
|
|
37
|
+
accountBadge?: string | number;
|
|
38
|
+
/** 头像下拉自定义插槽:渲染在「切换账号」之后、「退出登录」之前(业务自定义入口区,如帮助中心等) */
|
|
39
|
+
userMenuExtra?: React.ReactNode;
|
|
35
40
|
onLogout?: () => void;
|
|
36
41
|
}
|
|
37
|
-
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,
|
|
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;
|
|
@@ -80,7 +80,9 @@ export default function CompanySidebar(_ref) {
|
|
|
80
80
|
emptyImage = _ref.emptyImage,
|
|
81
81
|
bottomExtra = _ref.bottomExtra,
|
|
82
82
|
_onDomainPopoverOpenChange = _ref.onDomainPopoverOpenChange,
|
|
83
|
-
|
|
83
|
+
accountSwitcher = _ref.accountSwitcher,
|
|
84
|
+
accountBadge = _ref.accountBadge,
|
|
85
|
+
userMenuExtra = _ref.userMenuExtra,
|
|
84
86
|
onLogout = _ref.onLogout;
|
|
85
87
|
var _useState = useState({
|
|
86
88
|
domainPopoverOpen: false,
|
|
@@ -329,7 +331,9 @@ export default function CompanySidebar(_ref) {
|
|
|
329
331
|
});
|
|
330
332
|
});
|
|
331
333
|
},
|
|
332
|
-
|
|
334
|
+
accountSwitcher: accountSwitcher,
|
|
335
|
+
accountBadge: accountBadge,
|
|
336
|
+
userMenuExtra: userMenuExtra,
|
|
333
337
|
onLogout: onLogout
|
|
334
338
|
}), /*#__PURE__*/_jsx(SecondSidebar, {
|
|
335
339
|
activeFirstMenu: displayFirstMenu,
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
display: flex;
|
|
162
162
|
flex-direction: column;
|
|
163
163
|
padding: 0 12px;
|
|
164
|
-
gap:
|
|
164
|
+
gap: 6px;
|
|
165
165
|
align-self: stretch;
|
|
166
166
|
z-index: 4;
|
|
167
167
|
}
|
|
@@ -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;
|
|
@@ -459,6 +475,37 @@
|
|
|
459
475
|
margin: 8px 0;
|
|
460
476
|
}
|
|
461
477
|
|
|
478
|
+
// 切换账号面板视图:气泡容器(.ant-popover-container,左右各 12px 内边距)总宽固定 200px,
|
|
479
|
+
// 内容区 176px;覆盖 CompanyAccountSwitcher 的 240px 最小宽度,让其铺满容器
|
|
480
|
+
.admin-popover-content--panel {
|
|
481
|
+
width: 176px;
|
|
482
|
+
|
|
483
|
+
.company-account-switcher {
|
|
484
|
+
width: 100%;
|
|
485
|
+
min-width: 0;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// 面板视图顶部的返回行(返回功能菜单):紧凑内边距与间距(覆盖 .admin-popover-item 的 38px / 4px 12px / 6px)
|
|
490
|
+
.admin-popover-back {
|
|
491
|
+
height: 32px;
|
|
492
|
+
padding: 4px;
|
|
493
|
+
gap: 4px;
|
|
494
|
+
color: var(--company-color-text-secondary, rgba(0, 0, 0, 0.65));
|
|
495
|
+
}
|
|
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
|
+
|
|
462
509
|
// ========== SecondSidebar 二级浅色侧栏 ==========
|
|
463
510
|
.company-sidebar-second {
|
|
464
511
|
width: 220px;
|