@donglegeyu/company-ui 2.14.0 → 2.16.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 +34 -0
- package/dist/cjs/basic-components/CompanyAccountSwitcher/index.js +80 -0
- package/dist/cjs/basic-components/CompanyAccountSwitcher/index.scss +128 -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 +5 -3
- package/dist/cjs/template-components/AdminLayoutTemplate/index.js +120 -23
- package/dist/cjs/template-components/AdminLayoutTemplate/index.scss +13 -0
- package/dist/cjs/template-components/CompanyMultiTabs/index.d.ts +2 -0
- package/dist/cjs/template-components/CompanyMultiTabs/index.js +164 -3
- package/dist/cjs/template-components/CompanyMultiTabs/index.scss +33 -0
- package/dist/cjs/template-components/CompanySidebar/FirstSidebar.d.ts +5 -2
- package/dist/cjs/template-components/CompanySidebar/FirstSidebar.js +41 -6
- package/dist/cjs/template-components/CompanySidebar/index.d.ts +5 -2
- package/dist/cjs/template-components/CompanySidebar/index.js +4 -2
- package/dist/cjs/template-components/CompanySidebar/index.scss +24 -0
- package/dist/es/basic-components/CompanyAccountSwitcher/index.d.ts +34 -0
- package/dist/es/basic-components/CompanyAccountSwitcher/index.js +74 -0
- package/dist/es/basic-components/CompanyAccountSwitcher/index.scss +128 -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 +5 -3
- package/dist/es/template-components/AdminLayoutTemplate/index.js +114 -30
- package/dist/es/template-components/AdminLayoutTemplate/index.scss +13 -0
- package/dist/es/template-components/CompanyMultiTabs/index.d.ts +2 -0
- package/dist/es/template-components/CompanyMultiTabs/index.js +198 -4
- package/dist/es/template-components/CompanyMultiTabs/index.scss +33 -0
- package/dist/es/template-components/CompanySidebar/FirstSidebar.d.ts +5 -2
- package/dist/es/template-components/CompanySidebar/FirstSidebar.js +62 -9
- package/dist/es/template-components/CompanySidebar/index.d.ts +5 -2
- package/dist/es/template-components/CompanySidebar/index.js +4 -2
- package/dist/es/template-components/CompanySidebar/index.scss +24 -0
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
}
|
|
17
|
+
export interface CompanyAccountSwitcherProps {
|
|
18
|
+
/** 账号列表(受控数据,由业务侧注入) */
|
|
19
|
+
accounts: CompanyAccountItem[];
|
|
20
|
+
/** 点击账号项回调(业务侧执行切换登录) */
|
|
21
|
+
onSelectAccount?: (account: CompanyAccountItem) => void;
|
|
22
|
+
/** 点击「登录更多账号」回调;不传则不渲染该入口 */
|
|
23
|
+
onAddAccount?: () => void;
|
|
24
|
+
/** 移除账号回调;传入后非当前账号 hover 显示移除按钮 */
|
|
25
|
+
onRemoveAccount?: (account: CompanyAccountItem) => void;
|
|
26
|
+
className?: string;
|
|
27
|
+
style?: React.CSSProperties;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 通用账号切换面板(纯 UI 受控组件)。
|
|
31
|
+
* 渲染:账号列表(首字符头像 + 昵称 + 用户名/组织名,当前项打勾)+ 分隔线 + 「登录更多账号」。
|
|
32
|
+
* 数据与动作全部由业务侧通过 Props 注入,组件内不耦合任何登录/会话逻辑。
|
|
33
|
+
*/
|
|
34
|
+
export declare const CompanyAccountSwitcher: React.FC<CompanyAccountSwitcherProps>;
|
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
className: `account-switcher-item${account.current ? " current" : ""}`,
|
|
45
|
+
onClick: () => onSelectAccount == null ? void 0 : onSelectAccount(account),
|
|
46
|
+
children: [
|
|
47
|
+
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
|
+
/* @__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
|
+
subName && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "account-switcher-sub", children: subName })
|
|
51
|
+
] }),
|
|
52
|
+
account.current && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CheckOutlined, { className: "account-switcher-check" }),
|
|
53
|
+
onRemoveAccount && !account.current && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
54
|
+
import_icons.CloseOutlined,
|
|
55
|
+
{
|
|
56
|
+
className: "account-switcher-remove",
|
|
57
|
+
onClick: (e) => {
|
|
58
|
+
e.stopPropagation();
|
|
59
|
+
onRemoveAccount(account);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
account.id
|
|
66
|
+
);
|
|
67
|
+
}) }),
|
|
68
|
+
onAddAccount && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "account-switcher-divider" }),
|
|
70
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "account-switcher-add", onClick: onAddAccount, children: [
|
|
71
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.UserAddOutlined, {}),
|
|
72
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "登录更多账号" })
|
|
73
|
+
] })
|
|
74
|
+
] })
|
|
75
|
+
] });
|
|
76
|
+
};
|
|
77
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
+
0 && (module.exports = {
|
|
79
|
+
CompanyAccountSwitcher
|
|
80
|
+
});
|
|
@@ -0,0 +1,128 @@
|
|
|
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
|
+
}
|
|
12
|
+
|
|
13
|
+
.account-switcher-item {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: 10px;
|
|
17
|
+
padding: 4px;
|
|
18
|
+
border-radius: 4px;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
transition: background 0.2s;
|
|
21
|
+
|
|
22
|
+
/* 当前账号行间距更紧凑 */
|
|
23
|
+
&.current {
|
|
24
|
+
gap: 8px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&:hover {
|
|
28
|
+
background: var(--company-color-bg-light, #f5f5f5);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.account-switcher-avatar {
|
|
33
|
+
width: 28px;
|
|
34
|
+
height: 28px;
|
|
35
|
+
flex-shrink: 0;
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
border-radius: 50%;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
background: var(--company-color-primary-bg, #fff1e6);
|
|
42
|
+
color: var(--company-color-primary, #f95914);
|
|
43
|
+
font-size: 12px;
|
|
44
|
+
|
|
45
|
+
img {
|
|
46
|
+
width: 100%;
|
|
47
|
+
height: 100%;
|
|
48
|
+
object-fit: cover;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.account-switcher-info {
|
|
53
|
+
flex: 1;
|
|
54
|
+
min-width: 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.account-switcher-nickname {
|
|
58
|
+
font-size: 14px;
|
|
59
|
+
line-height: 20px;
|
|
60
|
+
color: var(--company-color-text, rgba(0, 0, 0, 0.88));
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
text-overflow: ellipsis;
|
|
63
|
+
white-space: nowrap;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.account-switcher-sub {
|
|
67
|
+
font-size: 12px;
|
|
68
|
+
line-height: 18px;
|
|
69
|
+
color: var(--company-color-text-tertiary, rgba(0, 0, 0, 0.45));
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
text-overflow: ellipsis;
|
|
72
|
+
white-space: nowrap;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.account-switcher-check {
|
|
76
|
+
flex-shrink: 0;
|
|
77
|
+
font-size: 14px;
|
|
78
|
+
color: var(--company-color-primary, #f95914);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.account-switcher-remove {
|
|
82
|
+
flex-shrink: 0;
|
|
83
|
+
font-size: 12px;
|
|
84
|
+
color: var(--company-color-text-quaternary, rgba(0, 0, 0, 0.25));
|
|
85
|
+
opacity: 0;
|
|
86
|
+
transition:
|
|
87
|
+
opacity 0.2s,
|
|
88
|
+
color 0.2s;
|
|
89
|
+
|
|
90
|
+
&:hover {
|
|
91
|
+
color: var(--company-color-error, #ff4d4f);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.account-switcher-item:hover .account-switcher-remove {
|
|
96
|
+
opacity: 1;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.account-switcher-divider {
|
|
100
|
+
height: 1px;
|
|
101
|
+
background: var(--company-color-border-secondary, #f0f0f0);
|
|
102
|
+
margin: 8px 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.account-switcher-add {
|
|
106
|
+
height: 32px;
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
padding: 4px 12px;
|
|
110
|
+
gap: 8px;
|
|
111
|
+
border-radius: 4px;
|
|
112
|
+
cursor: pointer;
|
|
113
|
+
transition: background 0.2s;
|
|
114
|
+
color: var(--company-color-text, rgba(0, 0, 0, 0.88));
|
|
115
|
+
|
|
116
|
+
&:hover {
|
|
117
|
+
background: var(--company-color-bg-light, #f5f5f5);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.anticon {
|
|
121
|
+
font-size: 16px;
|
|
122
|
+
color: var(--company-color-primary, #f95914);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
span {
|
|
126
|
+
font-size: 14px;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -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,10 @@ 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;
|
|
36
38
|
/** 业务域列表(左侧导航顶部切换下拉) */
|
|
37
39
|
domains?: SidebarDomain[];
|
|
38
40
|
/** 当前业务域 id(受控;不传则组件内部管理) */
|
|
@@ -117,4 +119,4 @@ export interface AdminLayoutTemplateProps {
|
|
|
117
119
|
* - 间距契约固化:内容区只做滚动容器(零间距),业务模板自带全部内边距与背景
|
|
118
120
|
* - 两种内容模式:pages 配置式(key 与菜单联动)或 children 兜底(直接放业务模板)
|
|
119
121
|
*/
|
|
120
|
-
export default function AdminLayoutTemplate({ className, style, logo, brandName, userInfo, onLogout,
|
|
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;
|
|
@@ -317,7 +317,8 @@ function AdminLayoutTemplate({
|
|
|
317
317
|
brandName,
|
|
318
318
|
userInfo,
|
|
319
319
|
onLogout,
|
|
320
|
-
|
|
320
|
+
accountSwitcher,
|
|
321
|
+
userMenuExtra,
|
|
321
322
|
domains = [],
|
|
322
323
|
currentDomainId,
|
|
323
324
|
defaultDomainId,
|
|
@@ -557,7 +558,7 @@ function AdminLayoutTemplate({
|
|
|
557
558
|
onTabClose == null ? void 0 : onTabClose(key, tab);
|
|
558
559
|
const currentActive = isTabActiveControlled ? activeTabKey : internalActiveTabKey;
|
|
559
560
|
if (currentActive === key) {
|
|
560
|
-
const neighbor = nextTabs[Math.max(0, index - 1)];
|
|
561
|
+
const neighbor = nextTabs[index] ?? nextTabs[Math.max(0, index - 1)];
|
|
561
562
|
const nextKey = (neighbor == null ? void 0 : neighbor.key) ?? (homeTab == null ? void 0 : homeTab.key);
|
|
562
563
|
if (nextKey) {
|
|
563
564
|
if (!isTabActiveControlled)
|
|
@@ -581,6 +582,39 @@ function AdminLayoutTemplate({
|
|
|
581
582
|
onActiveTabChange
|
|
582
583
|
]
|
|
583
584
|
);
|
|
585
|
+
const hasClosableOthers = (0, import_react.useMemo)(() => {
|
|
586
|
+
const currentTabs = isTabsControlled ? tabs : internalTabs;
|
|
587
|
+
const currentActive = isTabActiveControlled ? activeTabKey : internalActiveTabKey;
|
|
588
|
+
return currentTabs.some((t) => t.closable !== false && t.key !== currentActive);
|
|
589
|
+
}, [
|
|
590
|
+
isTabsControlled,
|
|
591
|
+
tabs,
|
|
592
|
+
internalTabs,
|
|
593
|
+
isTabActiveControlled,
|
|
594
|
+
activeTabKey,
|
|
595
|
+
internalActiveTabKey
|
|
596
|
+
]);
|
|
597
|
+
const closeOtherTabs = (0, import_react.useCallback)(() => {
|
|
598
|
+
const currentTabs = isTabsControlled ? tabs : internalTabs;
|
|
599
|
+
const currentActive = isTabActiveControlled ? activeTabKey : internalActiveTabKey;
|
|
600
|
+
const removed = currentTabs.filter((t) => t.closable !== false && t.key !== currentActive);
|
|
601
|
+
if (removed.length === 0)
|
|
602
|
+
return;
|
|
603
|
+
const nextTabs = currentTabs.filter((t) => t.closable === false || t.key === currentActive);
|
|
604
|
+
if (!isTabsControlled)
|
|
605
|
+
setInternalTabs(nextTabs);
|
|
606
|
+
onTabsChange == null ? void 0 : onTabsChange(nextTabs);
|
|
607
|
+
removed.forEach((t) => onTabClose == null ? void 0 : onTabClose(t.key, t));
|
|
608
|
+
}, [
|
|
609
|
+
isTabsControlled,
|
|
610
|
+
tabs,
|
|
611
|
+
internalTabs,
|
|
612
|
+
isTabActiveControlled,
|
|
613
|
+
activeTabKey,
|
|
614
|
+
internalActiveTabKey,
|
|
615
|
+
onTabsChange,
|
|
616
|
+
onTabClose
|
|
617
|
+
]);
|
|
584
618
|
const handleHomeClick = (0, import_react.useCallback)(() => {
|
|
585
619
|
if (!homeTab)
|
|
586
620
|
return;
|
|
@@ -652,6 +686,7 @@ function AdminLayoutTemplate({
|
|
|
652
686
|
[businessMenus, handleMenuClick]
|
|
653
687
|
);
|
|
654
688
|
const [moreOpen, setMoreOpen] = (0, import_react.useState)(false);
|
|
689
|
+
const { token } = import_antd.theme.useToken();
|
|
655
690
|
const tabActionExtra = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
656
691
|
tabExtra,
|
|
657
692
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -661,25 +696,86 @@ function AdminLayoutTemplate({
|
|
|
661
696
|
trigger: ["click"],
|
|
662
697
|
open: moreOpen,
|
|
663
698
|
onOpenChange: setMoreOpen,
|
|
664
|
-
popupRender: () =>
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
699
|
+
popupRender: () => (
|
|
700
|
+
// antd 6 Dropdown 弹层默认挂载 body,组件根注入的 CSS 变量无法继承,容器样式需 token 内联消费
|
|
701
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
702
|
+
"div",
|
|
703
|
+
{
|
|
704
|
+
className: "company-multi-tabs-more-popup",
|
|
705
|
+
style: {
|
|
706
|
+
display: "flex",
|
|
707
|
+
flexDirection: "column",
|
|
708
|
+
overflow: "hidden",
|
|
709
|
+
background: token.colorBgContainer,
|
|
710
|
+
borderRadius: token.borderRadiusLG,
|
|
711
|
+
boxShadow: token.boxShadowSecondary
|
|
712
|
+
},
|
|
713
|
+
children: [
|
|
714
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { maxHeight: 180, overflowY: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
715
|
+
import_basic_components.CompanyMenu,
|
|
716
|
+
{
|
|
717
|
+
selectedKeys: [effectiveActiveTabKey],
|
|
718
|
+
onClick: ({ key }) => {
|
|
719
|
+
setMoreOpen(false);
|
|
720
|
+
if (homeTab && key === homeTab.key) {
|
|
721
|
+
handleHomeClick();
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
const tab = effectiveTabs.find((t) => t.key === key);
|
|
725
|
+
if (tab)
|
|
726
|
+
handleTabChange(tab.key, tab);
|
|
727
|
+
},
|
|
728
|
+
items: [
|
|
729
|
+
...homeTab ? [{ key: homeTab.key, label: homeTab.label }] : [],
|
|
730
|
+
...effectiveTabs.map((t) => ({
|
|
731
|
+
key: t.key,
|
|
732
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
733
|
+
"span",
|
|
734
|
+
{
|
|
735
|
+
style: {
|
|
736
|
+
display: "flex",
|
|
737
|
+
alignItems: "center",
|
|
738
|
+
justifyContent: "space-between",
|
|
739
|
+
gap: token.marginXS
|
|
740
|
+
},
|
|
741
|
+
children: [
|
|
742
|
+
t.label,
|
|
743
|
+
t.closable !== false ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
744
|
+
import_shared_components.SvgIcon,
|
|
745
|
+
{
|
|
746
|
+
href: "close",
|
|
747
|
+
size: 12,
|
|
748
|
+
style: { color: token.colorTextSecondary, flexShrink: 0 },
|
|
749
|
+
onClick: (e) => {
|
|
750
|
+
e.stopPropagation();
|
|
751
|
+
handleCloseTab(t.key, t);
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
) : null
|
|
755
|
+
]
|
|
756
|
+
}
|
|
757
|
+
)
|
|
758
|
+
}))
|
|
759
|
+
]
|
|
760
|
+
}
|
|
761
|
+
) }),
|
|
762
|
+
hasClosableOthers ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
763
|
+
import_basic_components.CompanyMenu,
|
|
764
|
+
{
|
|
765
|
+
selectable: false,
|
|
766
|
+
onClick: () => {
|
|
767
|
+
setMoreOpen(false);
|
|
768
|
+
closeOtherTabs();
|
|
769
|
+
},
|
|
770
|
+
items: [
|
|
771
|
+
{ type: "divider" },
|
|
772
|
+
{ key: "__close_others__", label: "关闭其他页签" }
|
|
773
|
+
]
|
|
774
|
+
}
|
|
775
|
+
) : null
|
|
776
|
+
]
|
|
777
|
+
}
|
|
778
|
+
)
|
|
683
779
|
),
|
|
684
780
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "admin-layout-tab-action", "aria-label": "更多页签", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_shared_components.SvgIcon, { name: "more-one", size: 16 }) })
|
|
685
781
|
}
|
|
@@ -691,7 +787,7 @@ function AdminLayoutTemplate({
|
|
|
691
787
|
className: "admin-layout-tab-action",
|
|
692
788
|
"aria-label": isFullscreen ? "退出全屏" : "进入全屏",
|
|
693
789
|
onClick: toggleFullscreen,
|
|
694
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_shared_components.SvgIcon, { name: isFullscreen ? "
|
|
790
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_shared_components.SvgIcon, { name: isFullscreen ? "off-screen" : "full-screen", size: 16 })
|
|
695
791
|
}
|
|
696
792
|
),
|
|
697
793
|
aiEnabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AiAssistantTabSwitch, {}) : null
|
|
@@ -731,7 +827,8 @@ function AdminLayoutTemplate({
|
|
|
731
827
|
onSecondSidebarFixedChange: setSecondSidebarFixed,
|
|
732
828
|
visibleMenuCount,
|
|
733
829
|
emptyImage,
|
|
734
|
-
|
|
830
|
+
accountSwitcher,
|
|
831
|
+
userMenuExtra,
|
|
735
832
|
onLogout
|
|
736
833
|
}
|
|
737
834
|
),
|
|
@@ -80,10 +80,23 @@
|
|
|
80
80
|
flex: 1;
|
|
81
81
|
min-height: 0;
|
|
82
82
|
overflow: auto;
|
|
83
|
+
|
|
84
|
+
/* 框架内容区自成滚动域:滚到边界后滚轮停止在框架内部,不再穿透到外层页面,
|
|
85
|
+
避免「滚中间内容带动整个框架(左侧导航/页签栏)一起移动」;真实业务中框架
|
|
86
|
+
占满视口、页面本身不滚动,此属性无副作用 */
|
|
87
|
+
overscroll-behavior: contain;
|
|
83
88
|
display: flex;
|
|
84
89
|
flex-direction: column;
|
|
85
90
|
}
|
|
86
91
|
|
|
92
|
+
/* 表格体是框架内最常见的内部滚动域:SmartListTemplate 填满内容区时内容区自身零溢出、
|
|
93
|
+
不参与滚动链(规范:滚动链只包含「在滚动轴上可滚动」的祖先容器,零溢出容器会被跳过),
|
|
94
|
+
表格体滚到边界后滚轮会直接穿透到文档站页面,带动整个框架移动。在此截断滚动链。
|
|
95
|
+
仅作用于框架内部;独立使用 SmartListTemplate 时滚动链行为保持 antd 默认 */
|
|
96
|
+
.admin-layout-content .ant-table-body {
|
|
97
|
+
overscroll-behavior: contain;
|
|
98
|
+
}
|
|
99
|
+
|
|
87
100
|
/* AI 智能助手面板列:与主区(页签栏 + 内容区)并列的全高独立列,对齐设计稿 4 列布局
|
|
88
101
|
(一级导航 + 二级导航 + 主区自适应 + AI 面板列,面板列从页签栏顶部通到底,与主区间距为 0)。
|
|
89
102
|
宽度消费组件内注入的 --admin-ai-aside-width CSS 变量(拖拽手柄实时更新),无硬编码色值 */
|
|
@@ -36,6 +36,8 @@ export interface CompanyMultiTabsProps {
|
|
|
36
36
|
searchPlaceholder?: string;
|
|
37
37
|
/** 选中搜索项回调(选中后面板自动关闭) */
|
|
38
38
|
onSearchSelect?: (option: MultiTabSearchOption) => void;
|
|
39
|
+
/** 是否显示内置页签动作区(「更多页签」下拉 + 浏览器全屏切换;全屏后浏览器导航隐藏,Esc 或再次点击退出) */
|
|
40
|
+
showFullscreen?: boolean;
|
|
39
41
|
className?: string;
|
|
40
42
|
style?: React.CSSProperties;
|
|
41
43
|
}
|