@donglegeyu/company-ui 2.14.0 → 2.15.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/template-components/AdminLayoutTemplate/index.js +116 -21
- 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/index.scss +5 -0
- package/dist/es/template-components/AdminLayoutTemplate/index.js +110 -28
- 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/index.scss +5 -0
- package/package.json +1 -1
|
@@ -557,7 +557,7 @@ function AdminLayoutTemplate({
|
|
|
557
557
|
onTabClose == null ? void 0 : onTabClose(key, tab);
|
|
558
558
|
const currentActive = isTabActiveControlled ? activeTabKey : internalActiveTabKey;
|
|
559
559
|
if (currentActive === key) {
|
|
560
|
-
const neighbor = nextTabs[Math.max(0, index - 1)];
|
|
560
|
+
const neighbor = nextTabs[index] ?? nextTabs[Math.max(0, index - 1)];
|
|
561
561
|
const nextKey = (neighbor == null ? void 0 : neighbor.key) ?? (homeTab == null ? void 0 : homeTab.key);
|
|
562
562
|
if (nextKey) {
|
|
563
563
|
if (!isTabActiveControlled)
|
|
@@ -581,6 +581,39 @@ function AdminLayoutTemplate({
|
|
|
581
581
|
onActiveTabChange
|
|
582
582
|
]
|
|
583
583
|
);
|
|
584
|
+
const hasClosableOthers = (0, import_react.useMemo)(() => {
|
|
585
|
+
const currentTabs = isTabsControlled ? tabs : internalTabs;
|
|
586
|
+
const currentActive = isTabActiveControlled ? activeTabKey : internalActiveTabKey;
|
|
587
|
+
return currentTabs.some((t) => t.closable !== false && t.key !== currentActive);
|
|
588
|
+
}, [
|
|
589
|
+
isTabsControlled,
|
|
590
|
+
tabs,
|
|
591
|
+
internalTabs,
|
|
592
|
+
isTabActiveControlled,
|
|
593
|
+
activeTabKey,
|
|
594
|
+
internalActiveTabKey
|
|
595
|
+
]);
|
|
596
|
+
const closeOtherTabs = (0, import_react.useCallback)(() => {
|
|
597
|
+
const currentTabs = isTabsControlled ? tabs : internalTabs;
|
|
598
|
+
const currentActive = isTabActiveControlled ? activeTabKey : internalActiveTabKey;
|
|
599
|
+
const removed = currentTabs.filter((t) => t.closable !== false && t.key !== currentActive);
|
|
600
|
+
if (removed.length === 0)
|
|
601
|
+
return;
|
|
602
|
+
const nextTabs = currentTabs.filter((t) => t.closable === false || t.key === currentActive);
|
|
603
|
+
if (!isTabsControlled)
|
|
604
|
+
setInternalTabs(nextTabs);
|
|
605
|
+
onTabsChange == null ? void 0 : onTabsChange(nextTabs);
|
|
606
|
+
removed.forEach((t) => onTabClose == null ? void 0 : onTabClose(t.key, t));
|
|
607
|
+
}, [
|
|
608
|
+
isTabsControlled,
|
|
609
|
+
tabs,
|
|
610
|
+
internalTabs,
|
|
611
|
+
isTabActiveControlled,
|
|
612
|
+
activeTabKey,
|
|
613
|
+
internalActiveTabKey,
|
|
614
|
+
onTabsChange,
|
|
615
|
+
onTabClose
|
|
616
|
+
]);
|
|
584
617
|
const handleHomeClick = (0, import_react.useCallback)(() => {
|
|
585
618
|
if (!homeTab)
|
|
586
619
|
return;
|
|
@@ -652,6 +685,7 @@ function AdminLayoutTemplate({
|
|
|
652
685
|
[businessMenus, handleMenuClick]
|
|
653
686
|
);
|
|
654
687
|
const [moreOpen, setMoreOpen] = (0, import_react.useState)(false);
|
|
688
|
+
const { token } = import_antd.theme.useToken();
|
|
655
689
|
const tabActionExtra = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
656
690
|
tabExtra,
|
|
657
691
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -661,25 +695,86 @@ function AdminLayoutTemplate({
|
|
|
661
695
|
trigger: ["click"],
|
|
662
696
|
open: moreOpen,
|
|
663
697
|
onOpenChange: setMoreOpen,
|
|
664
|
-
popupRender: () =>
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
698
|
+
popupRender: () => (
|
|
699
|
+
// antd 6 Dropdown 弹层默认挂载 body,组件根注入的 CSS 变量无法继承,容器样式需 token 内联消费
|
|
700
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
701
|
+
"div",
|
|
702
|
+
{
|
|
703
|
+
className: "company-multi-tabs-more-popup",
|
|
704
|
+
style: {
|
|
705
|
+
display: "flex",
|
|
706
|
+
flexDirection: "column",
|
|
707
|
+
overflow: "hidden",
|
|
708
|
+
background: token.colorBgContainer,
|
|
709
|
+
borderRadius: token.borderRadiusLG,
|
|
710
|
+
boxShadow: token.boxShadowSecondary
|
|
711
|
+
},
|
|
712
|
+
children: [
|
|
713
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { maxHeight: 180, overflowY: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
714
|
+
import_basic_components.CompanyMenu,
|
|
715
|
+
{
|
|
716
|
+
selectedKeys: [effectiveActiveTabKey],
|
|
717
|
+
onClick: ({ key }) => {
|
|
718
|
+
setMoreOpen(false);
|
|
719
|
+
if (homeTab && key === homeTab.key) {
|
|
720
|
+
handleHomeClick();
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
const tab = effectiveTabs.find((t) => t.key === key);
|
|
724
|
+
if (tab)
|
|
725
|
+
handleTabChange(tab.key, tab);
|
|
726
|
+
},
|
|
727
|
+
items: [
|
|
728
|
+
...homeTab ? [{ key: homeTab.key, label: homeTab.label }] : [],
|
|
729
|
+
...effectiveTabs.map((t) => ({
|
|
730
|
+
key: t.key,
|
|
731
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
732
|
+
"span",
|
|
733
|
+
{
|
|
734
|
+
style: {
|
|
735
|
+
display: "flex",
|
|
736
|
+
alignItems: "center",
|
|
737
|
+
justifyContent: "space-between",
|
|
738
|
+
gap: token.marginXS
|
|
739
|
+
},
|
|
740
|
+
children: [
|
|
741
|
+
t.label,
|
|
742
|
+
t.closable !== false ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
743
|
+
import_shared_components.SvgIcon,
|
|
744
|
+
{
|
|
745
|
+
href: "close",
|
|
746
|
+
size: 12,
|
|
747
|
+
style: { color: token.colorTextSecondary, flexShrink: 0 },
|
|
748
|
+
onClick: (e) => {
|
|
749
|
+
e.stopPropagation();
|
|
750
|
+
handleCloseTab(t.key, t);
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
) : null
|
|
754
|
+
]
|
|
755
|
+
}
|
|
756
|
+
)
|
|
757
|
+
}))
|
|
758
|
+
]
|
|
759
|
+
}
|
|
760
|
+
) }),
|
|
761
|
+
hasClosableOthers ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
762
|
+
import_basic_components.CompanyMenu,
|
|
763
|
+
{
|
|
764
|
+
selectable: false,
|
|
765
|
+
onClick: () => {
|
|
766
|
+
setMoreOpen(false);
|
|
767
|
+
closeOtherTabs();
|
|
768
|
+
},
|
|
769
|
+
items: [
|
|
770
|
+
{ type: "divider" },
|
|
771
|
+
{ key: "__close_others__", label: "关闭其他页签" }
|
|
772
|
+
]
|
|
773
|
+
}
|
|
774
|
+
) : null
|
|
775
|
+
]
|
|
776
|
+
}
|
|
777
|
+
)
|
|
683
778
|
),
|
|
684
779
|
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
780
|
}
|
|
@@ -691,7 +786,7 @@ function AdminLayoutTemplate({
|
|
|
691
786
|
className: "admin-layout-tab-action",
|
|
692
787
|
"aria-label": isFullscreen ? "退出全屏" : "进入全屏",
|
|
693
788
|
onClick: toggleFullscreen,
|
|
694
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_shared_components.SvgIcon, { name: isFullscreen ? "
|
|
789
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_shared_components.SvgIcon, { name: isFullscreen ? "off-screen" : "full-screen", size: 16 })
|
|
695
790
|
}
|
|
696
791
|
),
|
|
697
792
|
aiEnabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AiAssistantTabSwitch, {}) : null
|
|
@@ -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
|
}
|
|
@@ -127,11 +127,37 @@ function CompanyMultiTabsInner(props) {
|
|
|
127
127
|
searchOptions,
|
|
128
128
|
searchPlaceholder,
|
|
129
129
|
onSearchSelect,
|
|
130
|
+
showFullscreen,
|
|
130
131
|
className,
|
|
131
132
|
style
|
|
132
133
|
} = props;
|
|
133
134
|
const { token } = import_antd.theme.useToken();
|
|
134
135
|
const showSearchEntry = Boolean(searchOptions == null ? void 0 : searchOptions.length);
|
|
136
|
+
const [isFullscreen, setIsFullscreen] = (0, import_react.useState)(false);
|
|
137
|
+
const fullscreenSupported = typeof document !== "undefined" && document.fullscreenEnabled;
|
|
138
|
+
(0, import_react.useEffect)(() => {
|
|
139
|
+
if (!showFullscreen)
|
|
140
|
+
return;
|
|
141
|
+
const onFullscreenChange = () => setIsFullscreen(Boolean(document.fullscreenElement));
|
|
142
|
+
document.addEventListener("fullscreenchange", onFullscreenChange);
|
|
143
|
+
return () => document.removeEventListener("fullscreenchange", onFullscreenChange);
|
|
144
|
+
}, [showFullscreen]);
|
|
145
|
+
const toggleFullscreen = (0, import_react.useCallback)(() => {
|
|
146
|
+
if (document.fullscreenElement) {
|
|
147
|
+
void document.exitFullscreen();
|
|
148
|
+
} else {
|
|
149
|
+
void document.documentElement.requestFullscreen();
|
|
150
|
+
}
|
|
151
|
+
}, []);
|
|
152
|
+
const [moreOpen, setMoreOpen] = (0, import_react.useState)(false);
|
|
153
|
+
const hasClosableOthers = tabs.some((t) => t.key !== activeKey && t.closable !== false);
|
|
154
|
+
const closeOtherTabs = (0, import_react.useCallback)(() => {
|
|
155
|
+
setMoreOpen(false);
|
|
156
|
+
tabs.forEach((t) => {
|
|
157
|
+
if (t.key !== activeKey && t.closable !== false)
|
|
158
|
+
onClose == null ? void 0 : onClose(t.key, t);
|
|
159
|
+
});
|
|
160
|
+
}, [tabs, activeKey, onClose]);
|
|
135
161
|
const handleTabClick = (0, import_react.useCallback)(
|
|
136
162
|
(tab) => {
|
|
137
163
|
if (tab.disabled)
|
|
@@ -143,9 +169,15 @@ function CompanyMultiTabsInner(props) {
|
|
|
143
169
|
const handleClose = (0, import_react.useCallback)(
|
|
144
170
|
(e, tab) => {
|
|
145
171
|
e.stopPropagation();
|
|
172
|
+
if (tab.key === activeKey) {
|
|
173
|
+
const idx = tabs.findIndex((t) => t.key === tab.key);
|
|
174
|
+
const neighbor = tabs[idx + 1] ?? tabs[idx - 1];
|
|
175
|
+
if (neighbor)
|
|
176
|
+
onChange == null ? void 0 : onChange(neighbor.key, neighbor);
|
|
177
|
+
}
|
|
146
178
|
onClose == null ? void 0 : onClose(tab.key, tab);
|
|
147
179
|
},
|
|
148
|
-
[onClose]
|
|
180
|
+
[tabs, activeKey, onChange, onClose]
|
|
149
181
|
);
|
|
150
182
|
const renderLabel = (0, import_react.useCallback)(
|
|
151
183
|
(tab) => {
|
|
@@ -155,6 +187,30 @@ function CompanyMultiTabsInner(props) {
|
|
|
155
187
|
},
|
|
156
188
|
[getItemLabel]
|
|
157
189
|
);
|
|
190
|
+
const listRef = (0, import_react.useRef)(null);
|
|
191
|
+
(0, import_react.useEffect)(() => {
|
|
192
|
+
var _a, _b;
|
|
193
|
+
const list = listRef.current;
|
|
194
|
+
if (!list)
|
|
195
|
+
return;
|
|
196
|
+
const activeEl = list.querySelector(".company-multi-tabs__item.is-active");
|
|
197
|
+
if (!activeEl)
|
|
198
|
+
return;
|
|
199
|
+
const listRect = list.getBoundingClientRect();
|
|
200
|
+
const itemRect = activeEl.getBoundingClientRect();
|
|
201
|
+
const RESERVE = 12;
|
|
202
|
+
if (itemRect.left < listRect.left) {
|
|
203
|
+
(_a = list.scrollTo) == null ? void 0 : _a.call(list, {
|
|
204
|
+
left: list.scrollLeft + (itemRect.left - listRect.left) - RESERVE,
|
|
205
|
+
behavior: "smooth"
|
|
206
|
+
});
|
|
207
|
+
} else if (itemRect.right > listRect.right) {
|
|
208
|
+
(_b = list.scrollTo) == null ? void 0 : _b.call(list, {
|
|
209
|
+
left: list.scrollLeft + (itemRect.right - listRect.right) + RESERVE,
|
|
210
|
+
behavior: "smooth"
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}, [activeKey, tabs, isHomeActive]);
|
|
158
214
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
159
215
|
"div",
|
|
160
216
|
{
|
|
@@ -192,7 +248,7 @@ function CompanyMultiTabsInner(props) {
|
|
|
192
248
|
onSelect: onSearchSelect
|
|
193
249
|
}
|
|
194
250
|
) : null,
|
|
195
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "company-multi-tabs__list", children: [
|
|
251
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "company-multi-tabs__list", ref: listRef, children: [
|
|
196
252
|
homeTab ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
197
253
|
"div",
|
|
198
254
|
{
|
|
@@ -220,7 +276,112 @@ function CompanyMultiTabsInner(props) {
|
|
|
220
276
|
);
|
|
221
277
|
})
|
|
222
278
|
] }),
|
|
223
|
-
extra ? /* @__PURE__ */ (0, import_jsx_runtime.
|
|
279
|
+
extra || showFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "company-multi-tabs__extra", children: [
|
|
280
|
+
extra,
|
|
281
|
+
showFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
282
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
283
|
+
import_basic_components.CompanyDropdown,
|
|
284
|
+
{
|
|
285
|
+
placement: "bottomRight",
|
|
286
|
+
trigger: ["click"],
|
|
287
|
+
open: moreOpen,
|
|
288
|
+
onOpenChange: setMoreOpen,
|
|
289
|
+
popupRender: () => (
|
|
290
|
+
// antd 6 Dropdown 弹层默认挂载 body,不在组件子树内,
|
|
291
|
+
// 组件根注入的 CSS 变量无法继承,弹层容器样式需用 token 内联消费
|
|
292
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
293
|
+
"div",
|
|
294
|
+
{
|
|
295
|
+
className: "company-multi-tabs-more-popup",
|
|
296
|
+
style: {
|
|
297
|
+
display: "flex",
|
|
298
|
+
flexDirection: "column",
|
|
299
|
+
overflow: "hidden",
|
|
300
|
+
background: token.colorBgContainer,
|
|
301
|
+
borderRadius: token.borderRadiusLG,
|
|
302
|
+
boxShadow: token.boxShadowSecondary
|
|
303
|
+
},
|
|
304
|
+
children: [
|
|
305
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { maxHeight: 180, overflowY: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
306
|
+
import_basic_components.CompanyMenu,
|
|
307
|
+
{
|
|
308
|
+
selectedKeys: [activeKey],
|
|
309
|
+
onClick: ({ key }) => {
|
|
310
|
+
setMoreOpen(false);
|
|
311
|
+
if (homeTab && key === homeTab.key) {
|
|
312
|
+
onHomeClick == null ? void 0 : onHomeClick();
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
const tab = tabs.find((t) => t.key === key);
|
|
316
|
+
if (tab)
|
|
317
|
+
onChange == null ? void 0 : onChange(tab.key, tab);
|
|
318
|
+
},
|
|
319
|
+
items: [
|
|
320
|
+
...homeTab ? [{ key: homeTab.key, label: homeTab.label }] : [],
|
|
321
|
+
...tabs.map((t) => ({
|
|
322
|
+
key: t.key,
|
|
323
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
324
|
+
"span",
|
|
325
|
+
{
|
|
326
|
+
style: {
|
|
327
|
+
display: "flex",
|
|
328
|
+
alignItems: "center",
|
|
329
|
+
justifyContent: "space-between",
|
|
330
|
+
gap: token.marginXS
|
|
331
|
+
},
|
|
332
|
+
children: [
|
|
333
|
+
t.label,
|
|
334
|
+
t.closable !== false ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
335
|
+
import_shared_components.SvgIcon,
|
|
336
|
+
{
|
|
337
|
+
href: "close",
|
|
338
|
+
size: 12,
|
|
339
|
+
style: {
|
|
340
|
+
color: token.colorTextSecondary,
|
|
341
|
+
flexShrink: 0
|
|
342
|
+
},
|
|
343
|
+
onClick: (e) => {
|
|
344
|
+
handleClose(e, t);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
) : null
|
|
348
|
+
]
|
|
349
|
+
}
|
|
350
|
+
)
|
|
351
|
+
}))
|
|
352
|
+
]
|
|
353
|
+
}
|
|
354
|
+
) }),
|
|
355
|
+
hasClosableOthers ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
356
|
+
import_basic_components.CompanyMenu,
|
|
357
|
+
{
|
|
358
|
+
selectable: false,
|
|
359
|
+
onClick: closeOtherTabs,
|
|
360
|
+
items: [
|
|
361
|
+
{ type: "divider" },
|
|
362
|
+
{ key: "__close_others__", label: "关闭其他页签" }
|
|
363
|
+
]
|
|
364
|
+
}
|
|
365
|
+
) : null
|
|
366
|
+
]
|
|
367
|
+
}
|
|
368
|
+
)
|
|
369
|
+
),
|
|
370
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "company-multi-tabs__action", "aria-label": "更多页签", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_shared_components.SvgIcon, { name: "more-one", size: 16 }) })
|
|
371
|
+
}
|
|
372
|
+
),
|
|
373
|
+
fullscreenSupported ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_basic_components.CompanyTooltip, { title: isFullscreen ? "退出全屏" : "全屏", mouseEnterDelay: 0.5, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
374
|
+
"button",
|
|
375
|
+
{
|
|
376
|
+
type: "button",
|
|
377
|
+
"aria-label": isFullscreen ? "退出全屏" : "进入全屏",
|
|
378
|
+
className: "company-multi-tabs__action",
|
|
379
|
+
onClick: toggleFullscreen,
|
|
380
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_shared_components.SvgIcon, { name: isFullscreen ? "off-screen" : "full-screen", size: 16 })
|
|
381
|
+
}
|
|
382
|
+
) }) : null
|
|
383
|
+
] }) : null
|
|
384
|
+
] }) : null
|
|
224
385
|
]
|
|
225
386
|
}
|
|
226
387
|
);
|
|
@@ -217,6 +217,30 @@
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
+
// —— 操作区最右侧内置动作按钮(更多页签下拉 / 全屏切换,showFullscreen 开启时渲染):样式对齐搜索入口 ——
|
|
221
|
+
&__action {
|
|
222
|
+
box-sizing: border-box;
|
|
223
|
+
width: 28px;
|
|
224
|
+
height: 28px;
|
|
225
|
+
display: flex;
|
|
226
|
+
align-items: center;
|
|
227
|
+
justify-content: center;
|
|
228
|
+
padding: 0;
|
|
229
|
+
border: none;
|
|
230
|
+
border-radius: var(--cmt-item-radius);
|
|
231
|
+
background: var(--cmt-item-bg);
|
|
232
|
+
color: var(--cmt-icon);
|
|
233
|
+
cursor: pointer;
|
|
234
|
+
transition:
|
|
235
|
+
background 0.2s,
|
|
236
|
+
color 0.2s;
|
|
237
|
+
|
|
238
|
+
&:hover {
|
|
239
|
+
background: var(--cmt-item-bg-hover);
|
|
240
|
+
color: var(--cmt-icon-hover);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
220
244
|
&__extra {
|
|
221
245
|
display: flex;
|
|
222
246
|
align-items: center;
|
|
@@ -225,3 +249,12 @@
|
|
|
225
249
|
flex-shrink: 0;
|
|
226
250
|
}
|
|
227
251
|
}
|
|
252
|
+
|
|
253
|
+
// —— 「更多页签」下拉弹层(antd 6 默认挂载 body,需顶层作用域块):
|
|
254
|
+
// 覆盖 antd Menu 根元素的四角圆角,圆角由外层投影容器统一裁剪(上 padding 保留 antd 默认 4px)。
|
|
255
|
+
// 提升特异性(0,2,0 > 0,1,0)自然胜出,不使用 !important。
|
|
256
|
+
.company-multi-tabs-more-popup {
|
|
257
|
+
.ant-dropdown-menu {
|
|
258
|
+
border-radius: 0;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
@@ -145,6 +145,10 @@
|
|
|
145
145
|
display: flex;
|
|
146
146
|
flex-direction: column;
|
|
147
147
|
overflow-y: auto;
|
|
148
|
+
|
|
149
|
+
/* 菜单滚到边界后截断滚动链:文档站页面可滚时避免穿透带动整个框架移动;
|
|
150
|
+
真实业务中框架占满视口、页面本身不滚,此属性无副作用 */
|
|
151
|
+
overscroll-behavior: contain;
|
|
148
152
|
padding: 0 8px;
|
|
149
153
|
gap: 4px;
|
|
150
154
|
}
|
|
@@ -482,6 +486,7 @@
|
|
|
482
486
|
.menu-list {
|
|
483
487
|
flex: 1;
|
|
484
488
|
overflow-y: auto;
|
|
489
|
+
overscroll-behavior: contain;
|
|
485
490
|
display: flex;
|
|
486
491
|
flex-direction: column;
|
|
487
492
|
|
|
@@ -747,11 +747,11 @@ export default function AdminLayoutTemplate(_ref2) {
|
|
|
747
747
|
if (!isTabsControlled) setInternalTabs(nextTabs);
|
|
748
748
|
onTabsChange === null || onTabsChange === void 0 || onTabsChange(nextTabs);
|
|
749
749
|
onTabClose === null || onTabClose === void 0 || onTabClose(key, tab);
|
|
750
|
-
// 关闭的是当前激活页签 →
|
|
750
|
+
// 关闭的是当前激活页签 → 切到相邻页签:优先右侧,无右侧则左侧,均无则回首页(对齐 CompanyMultiTabs)
|
|
751
751
|
var currentActive = isTabActiveControlled ? activeTabKey : internalActiveTabKey;
|
|
752
752
|
if (currentActive === key) {
|
|
753
|
-
var _neighbor$key;
|
|
754
|
-
var neighbor = nextTabs[Math.max(0, index - 1)];
|
|
753
|
+
var _nextTabs$index, _neighbor$key;
|
|
754
|
+
var neighbor = (_nextTabs$index = nextTabs[index]) !== null && _nextTabs$index !== void 0 ? _nextTabs$index : nextTabs[Math.max(0, index - 1)];
|
|
755
755
|
var nextKey = (_neighbor$key = neighbor === null || neighbor === void 0 ? void 0 : neighbor.key) !== null && _neighbor$key !== void 0 ? _neighbor$key : homeTab === null || homeTab === void 0 ? void 0 : homeTab.key;
|
|
756
756
|
if (nextKey) {
|
|
757
757
|
if (!isTabActiveControlled) setInternalActiveTabKey(nextKey);
|
|
@@ -763,6 +763,32 @@ export default function AdminLayoutTemplate(_ref2) {
|
|
|
763
763
|
}
|
|
764
764
|
}
|
|
765
765
|
}, [isTabsControlled, tabs, internalTabs, isTabActiveControlled, activeTabKey, internalActiveTabKey, homeTab, onTabsChange, onTabClose, onActiveTabChange]);
|
|
766
|
+
|
|
767
|
+
// 「关闭其他页签」:保留激活页签与不可关闭页签,一次性计算剩余列表(避免逐个关闭的陈旧闭包),逐个回调 onTabClose;
|
|
768
|
+
// 激活页签保留,无需切换激活态;首页激活时即关闭全部可关页签
|
|
769
|
+
var hasClosableOthers = useMemo(function () {
|
|
770
|
+
var currentTabs = isTabsControlled ? tabs : internalTabs;
|
|
771
|
+
var currentActive = isTabActiveControlled ? activeTabKey : internalActiveTabKey;
|
|
772
|
+
return currentTabs.some(function (t) {
|
|
773
|
+
return t.closable !== false && t.key !== currentActive;
|
|
774
|
+
});
|
|
775
|
+
}, [isTabsControlled, tabs, internalTabs, isTabActiveControlled, activeTabKey, internalActiveTabKey]);
|
|
776
|
+
var closeOtherTabs = useCallback(function () {
|
|
777
|
+
var currentTabs = isTabsControlled ? tabs : internalTabs;
|
|
778
|
+
var currentActive = isTabActiveControlled ? activeTabKey : internalActiveTabKey;
|
|
779
|
+
var removed = currentTabs.filter(function (t) {
|
|
780
|
+
return t.closable !== false && t.key !== currentActive;
|
|
781
|
+
});
|
|
782
|
+
if (removed.length === 0) return;
|
|
783
|
+
var nextTabs = currentTabs.filter(function (t) {
|
|
784
|
+
return t.closable === false || t.key === currentActive;
|
|
785
|
+
});
|
|
786
|
+
if (!isTabsControlled) setInternalTabs(nextTabs);
|
|
787
|
+
onTabsChange === null || onTabsChange === void 0 || onTabsChange(nextTabs);
|
|
788
|
+
removed.forEach(function (t) {
|
|
789
|
+
return onTabClose === null || onTabClose === void 0 ? void 0 : onTabClose(t.key, t);
|
|
790
|
+
});
|
|
791
|
+
}, [isTabsControlled, tabs, internalTabs, isTabActiveControlled, activeTabKey, internalActiveTabKey, onTabsChange, onTabClose]);
|
|
766
792
|
var handleHomeClick = useCallback(function () {
|
|
767
793
|
if (!homeTab) return;
|
|
768
794
|
var key = homeTab.key;
|
|
@@ -842,6 +868,9 @@ export default function AdminLayoutTemplate(_ref2) {
|
|
|
842
868
|
_useState28 = _slicedToArray(_useState27, 2),
|
|
843
869
|
moreOpen = _useState28[0],
|
|
844
870
|
setMoreOpen = _useState28[1];
|
|
871
|
+
// 下拉弹层容器样式(antd 6 弹层默认挂 body,组件根 CSS 变量无法继承,需 token 内联消费)
|
|
872
|
+
var _theme$useToken2 = theme.useToken(),
|
|
873
|
+
token = _theme$useToken2.token;
|
|
845
874
|
var tabActionExtra = /*#__PURE__*/_jsxs(_Fragment, {
|
|
846
875
|
children: [tabExtra, /*#__PURE__*/_jsx(CompanyDropdown, {
|
|
847
876
|
placement: "bottomRight",
|
|
@@ -849,30 +878,83 @@ export default function AdminLayoutTemplate(_ref2) {
|
|
|
849
878
|
open: moreOpen,
|
|
850
879
|
onOpenChange: setMoreOpen,
|
|
851
880
|
popupRender: function popupRender() {
|
|
852
|
-
return
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
881
|
+
return (
|
|
882
|
+
/*#__PURE__*/
|
|
883
|
+
// antd 6 Dropdown 弹层默认挂载 body,组件根注入的 CSS 变量无法继承,容器样式需 token 内联消费
|
|
884
|
+
_jsxs("div", {
|
|
885
|
+
className: "company-multi-tabs-more-popup",
|
|
886
|
+
style: {
|
|
887
|
+
display: "flex",
|
|
888
|
+
flexDirection: "column",
|
|
889
|
+
overflow: "hidden",
|
|
890
|
+
background: token.colorBgContainer,
|
|
891
|
+
borderRadius: token.borderRadiusLG,
|
|
892
|
+
boxShadow: token.boxShadowSecondary
|
|
893
|
+
},
|
|
894
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
895
|
+
style: {
|
|
896
|
+
maxHeight: 180,
|
|
897
|
+
overflowY: "auto"
|
|
898
|
+
},
|
|
899
|
+
children: /*#__PURE__*/_jsx(CompanyMenu, {
|
|
900
|
+
selectedKeys: [effectiveActiveTabKey],
|
|
901
|
+
onClick: function onClick(_ref7) {
|
|
902
|
+
var key = _ref7.key;
|
|
903
|
+
setMoreOpen(false);
|
|
904
|
+
if (homeTab && key === homeTab.key) {
|
|
905
|
+
handleHomeClick();
|
|
906
|
+
return;
|
|
907
|
+
}
|
|
908
|
+
var tab = effectiveTabs.find(function (t) {
|
|
909
|
+
return t.key === key;
|
|
910
|
+
});
|
|
911
|
+
if (tab) handleTabChange(tab.key, tab);
|
|
912
|
+
},
|
|
913
|
+
items: [].concat(_toConsumableArray(homeTab ? [{
|
|
914
|
+
key: homeTab.key,
|
|
915
|
+
label: homeTab.label
|
|
916
|
+
}] : []), _toConsumableArray(effectiveTabs.map(function (t) {
|
|
917
|
+
return {
|
|
918
|
+
key: t.key,
|
|
919
|
+
label: /*#__PURE__*/_jsxs("span", {
|
|
920
|
+
style: {
|
|
921
|
+
display: "flex",
|
|
922
|
+
alignItems: "center",
|
|
923
|
+
justifyContent: "space-between",
|
|
924
|
+
gap: token.marginXS
|
|
925
|
+
},
|
|
926
|
+
children: [t.label, t.closable !== false ? /*#__PURE__*/_jsx(SvgIcon, {
|
|
927
|
+
href: "close",
|
|
928
|
+
size: 12,
|
|
929
|
+
style: {
|
|
930
|
+
color: token.colorTextSecondary,
|
|
931
|
+
flexShrink: 0
|
|
932
|
+
},
|
|
933
|
+
onClick: function onClick(e) {
|
|
934
|
+
// 阻断冒泡:仅关闭页签,不触发整行的跳转与菜单收起
|
|
935
|
+
e.stopPropagation();
|
|
936
|
+
handleCloseTab(t.key, t);
|
|
937
|
+
}
|
|
938
|
+
}) : null]
|
|
939
|
+
})
|
|
940
|
+
};
|
|
941
|
+
})))
|
|
942
|
+
})
|
|
943
|
+
}), hasClosableOthers ? /*#__PURE__*/_jsx(CompanyMenu, {
|
|
944
|
+
selectable: false,
|
|
945
|
+
onClick: function onClick() {
|
|
946
|
+
setMoreOpen(false);
|
|
947
|
+
closeOtherTabs();
|
|
948
|
+
},
|
|
949
|
+
items: [{
|
|
950
|
+
type: "divider"
|
|
951
|
+
}, {
|
|
952
|
+
key: "__close_others__",
|
|
953
|
+
label: "关闭其他页签"
|
|
954
|
+
}]
|
|
955
|
+
}) : null]
|
|
956
|
+
})
|
|
957
|
+
);
|
|
876
958
|
},
|
|
877
959
|
children: /*#__PURE__*/_jsx("button", {
|
|
878
960
|
type: "button",
|
|
@@ -889,7 +971,7 @@ export default function AdminLayoutTemplate(_ref2) {
|
|
|
889
971
|
"aria-label": isFullscreen ? "退出全屏" : "进入全屏",
|
|
890
972
|
onClick: toggleFullscreen,
|
|
891
973
|
children: /*#__PURE__*/_jsx(SvgIcon, {
|
|
892
|
-
name: isFullscreen ? "
|
|
974
|
+
name: isFullscreen ? "off-screen" : "full-screen",
|
|
893
975
|
size: 16
|
|
894
976
|
})
|
|
895
977
|
}), aiEnabled ? /*#__PURE__*/_jsx(AiAssistantTabSwitch, {}) : null]
|
|
@@ -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
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
2
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
8
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -14,11 +18,12 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
|
14
18
|
import { theme } from "antd";
|
|
15
19
|
import { ConfigProvider } from "antd";
|
|
16
20
|
import { SvgIcon } from "../../shared-components";
|
|
17
|
-
import { CompanyTooltip } from "../../basic-components";
|
|
21
|
+
import { CompanyDropdown, CompanyMenu, CompanyTooltip } from "../../basic-components";
|
|
18
22
|
import { companyTheme } from "../../theme";
|
|
19
23
|
import "./index.scss";
|
|
20
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
25
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
22
27
|
function DefaultCloseIcon(_ref) {
|
|
23
28
|
var onClick = _ref.onClick;
|
|
24
29
|
return /*#__PURE__*/_jsx(CompanyTooltip, {
|
|
@@ -154,23 +159,106 @@ function CompanyMultiTabsInner(props) {
|
|
|
154
159
|
searchOptions = props.searchOptions,
|
|
155
160
|
searchPlaceholder = props.searchPlaceholder,
|
|
156
161
|
onSearchSelect = props.onSearchSelect,
|
|
162
|
+
showFullscreen = props.showFullscreen,
|
|
157
163
|
className = props.className,
|
|
158
164
|
style = props.style;
|
|
159
165
|
var _theme$useToken = theme.useToken(),
|
|
160
166
|
token = _theme$useToken.token;
|
|
161
167
|
var showSearchEntry = Boolean(searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.length);
|
|
168
|
+
|
|
169
|
+
// —— 浏览器全屏切换(showFullscreen 开启时展示):对 documentElement 请求全屏,
|
|
170
|
+
// 进入后浏览器导航隐藏、系统页面铺满;监听 fullscreenchange 同步图标(覆盖 Esc 退出场景)。
|
|
171
|
+
// 环境不支持全屏(如无 allowfullscreen 的 iframe)时不渲染按钮。
|
|
172
|
+
var _useState5 = useState(false),
|
|
173
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
174
|
+
isFullscreen = _useState6[0],
|
|
175
|
+
setIsFullscreen = _useState6[1];
|
|
176
|
+
var fullscreenSupported = typeof document !== "undefined" && document.fullscreenEnabled;
|
|
177
|
+
useEffect(function () {
|
|
178
|
+
if (!showFullscreen) return;
|
|
179
|
+
var onFullscreenChange = function onFullscreenChange() {
|
|
180
|
+
return setIsFullscreen(Boolean(document.fullscreenElement));
|
|
181
|
+
};
|
|
182
|
+
document.addEventListener("fullscreenchange", onFullscreenChange);
|
|
183
|
+
return function () {
|
|
184
|
+
return document.removeEventListener("fullscreenchange", onFullscreenChange);
|
|
185
|
+
};
|
|
186
|
+
}, [showFullscreen]);
|
|
187
|
+
var toggleFullscreen = useCallback(function () {
|
|
188
|
+
if (document.fullscreenElement) {
|
|
189
|
+
void document.exitFullscreen();
|
|
190
|
+
} else {
|
|
191
|
+
void document.documentElement.requestFullscreen();
|
|
192
|
+
}
|
|
193
|
+
}, []);
|
|
194
|
+
|
|
195
|
+
// —— 「更多页签」下拉(对齐 AdminLayoutTemplate 页签栏动作区):受控模式,
|
|
196
|
+
// popupRender 自定义渲染不会自动关闭,需菜单点击后手动收起。
|
|
197
|
+
var _useState7 = useState(false),
|
|
198
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
199
|
+
moreOpen = _useState8[0],
|
|
200
|
+
setMoreOpen = _useState8[1];
|
|
201
|
+
// 「关闭其他页签」:保留当前激活页签(首页激活时即全部可关页签),关闭其余带关闭按钮的页签。
|
|
202
|
+
var hasClosableOthers = tabs.some(function (t) {
|
|
203
|
+
return t.key !== activeKey && t.closable !== false;
|
|
204
|
+
});
|
|
205
|
+
var closeOtherTabs = useCallback(function () {
|
|
206
|
+
setMoreOpen(false);
|
|
207
|
+
tabs.forEach(function (t) {
|
|
208
|
+
if (t.key !== activeKey && t.closable !== false) onClose === null || onClose === void 0 || onClose(t.key, t);
|
|
209
|
+
});
|
|
210
|
+
}, [tabs, activeKey, onClose]);
|
|
162
211
|
var handleTabClick = useCallback(function (tab) {
|
|
163
212
|
if (tab.disabled) return;
|
|
164
213
|
onChange === null || onChange === void 0 || onChange(tab.key, tab);
|
|
165
214
|
}, [onChange]);
|
|
166
215
|
var handleClose = useCallback(function (e, tab) {
|
|
167
216
|
e.stopPropagation();
|
|
217
|
+
// 关闭当前激活页签时自动切换到相邻页签:优先右侧,无右侧则左侧(浏览器页签行为);
|
|
218
|
+
// 无相邻页签时仅回调 onClose,由业务方自行兜底
|
|
219
|
+
if (tab.key === activeKey) {
|
|
220
|
+
var _tabs;
|
|
221
|
+
var idx = tabs.findIndex(function (t) {
|
|
222
|
+
return t.key === tab.key;
|
|
223
|
+
});
|
|
224
|
+
var neighbor = (_tabs = tabs[idx + 1]) !== null && _tabs !== void 0 ? _tabs : tabs[idx - 1];
|
|
225
|
+
if (neighbor) onChange === null || onChange === void 0 || onChange(neighbor.key, neighbor);
|
|
226
|
+
}
|
|
168
227
|
onClose === null || onClose === void 0 || onClose(tab.key, tab);
|
|
169
|
-
}, [onClose]);
|
|
228
|
+
}, [tabs, activeKey, onChange, onClose]);
|
|
170
229
|
var renderLabel = useCallback(function (tab) {
|
|
171
230
|
if (getItemLabel) return getItemLabel(tab);
|
|
172
231
|
return tab.label;
|
|
173
232
|
}, [getItemLabel]);
|
|
233
|
+
var listRef = useRef(null);
|
|
234
|
+
|
|
235
|
+
// 激活页签自动滚入可视区:页签溢出后新开/切换页签(或点击首页)时,把高亮项平滑滚到可视范围内,
|
|
236
|
+
// 对齐 CompanySidebar 二级栏的 active 定位模式(DOM 提交后查 .is-active 再定位)。
|
|
237
|
+
// 激活项已完全可见时不动作,不打断用户手动滚动。
|
|
238
|
+
useEffect(function () {
|
|
239
|
+
var list = listRef.current;
|
|
240
|
+
if (!list) return;
|
|
241
|
+
var activeEl = list.querySelector(".company-multi-tabs__item.is-active");
|
|
242
|
+
if (!activeEl) return;
|
|
243
|
+
var listRect = list.getBoundingClientRect();
|
|
244
|
+
var itemRect = activeEl.getBoundingClientRect();
|
|
245
|
+
var RESERVE = 12; // 滚入后与可视区边缘的预留间距
|
|
246
|
+
if (itemRect.left < listRect.left) {
|
|
247
|
+
var _list$scrollTo;
|
|
248
|
+
// 激活项左缘在可视区外:左对齐并预留间隙
|
|
249
|
+
(_list$scrollTo = list.scrollTo) === null || _list$scrollTo === void 0 || _list$scrollTo.call(list, {
|
|
250
|
+
left: list.scrollLeft + (itemRect.left - listRect.left) - RESERVE,
|
|
251
|
+
behavior: "smooth"
|
|
252
|
+
});
|
|
253
|
+
} else if (itemRect.right > listRect.right) {
|
|
254
|
+
var _list$scrollTo2;
|
|
255
|
+
// 激活项右缘在可视区外:右缘贴齐可视区右缘并预留间隙
|
|
256
|
+
(_list$scrollTo2 = list.scrollTo) === null || _list$scrollTo2 === void 0 || _list$scrollTo2.call(list, {
|
|
257
|
+
left: list.scrollLeft + (itemRect.right - listRect.right) + RESERVE,
|
|
258
|
+
behavior: "smooth"
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}, [activeKey, tabs, isHomeActive]);
|
|
174
262
|
return /*#__PURE__*/_jsxs("div", {
|
|
175
263
|
className: "company-multi-tabs".concat(className ? " ".concat(className) : ""),
|
|
176
264
|
style: _objectSpread({
|
|
@@ -202,6 +290,7 @@ function CompanyMultiTabsInner(props) {
|
|
|
202
290
|
onSelect: onSearchSelect
|
|
203
291
|
}) : null, /*#__PURE__*/_jsxs("div", {
|
|
204
292
|
className: "company-multi-tabs__list",
|
|
293
|
+
ref: listRef,
|
|
205
294
|
children: [homeTab ? /*#__PURE__*/_jsxs("div", {
|
|
206
295
|
className: "company-multi-tabs__item company-multi-tabs__item--home".concat(isHomeActive ? " is-active" : ""),
|
|
207
296
|
onClick: onHomeClick,
|
|
@@ -226,9 +315,114 @@ function CompanyMultiTabsInner(props) {
|
|
|
226
315
|
}) : null]
|
|
227
316
|
}, tab.key);
|
|
228
317
|
})]
|
|
229
|
-
}), extra ? /*#__PURE__*/
|
|
318
|
+
}), extra || showFullscreen ? /*#__PURE__*/_jsxs("div", {
|
|
230
319
|
className: "company-multi-tabs__extra",
|
|
231
|
-
children: extra
|
|
320
|
+
children: [extra, showFullscreen ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
321
|
+
children: [/*#__PURE__*/_jsx(CompanyDropdown, {
|
|
322
|
+
placement: "bottomRight",
|
|
323
|
+
trigger: ["click"],
|
|
324
|
+
open: moreOpen,
|
|
325
|
+
onOpenChange: setMoreOpen,
|
|
326
|
+
popupRender: function popupRender() {
|
|
327
|
+
return (
|
|
328
|
+
/*#__PURE__*/
|
|
329
|
+
// antd 6 Dropdown 弹层默认挂载 body,不在组件子树内,
|
|
330
|
+
// 组件根注入的 CSS 变量无法继承,弹层容器样式需用 token 内联消费
|
|
331
|
+
_jsxs("div", {
|
|
332
|
+
className: "company-multi-tabs-more-popup",
|
|
333
|
+
style: {
|
|
334
|
+
display: "flex",
|
|
335
|
+
flexDirection: "column",
|
|
336
|
+
overflow: "hidden",
|
|
337
|
+
background: token.colorBgContainer,
|
|
338
|
+
borderRadius: token.borderRadiusLG,
|
|
339
|
+
boxShadow: token.boxShadowSecondary
|
|
340
|
+
},
|
|
341
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
342
|
+
style: {
|
|
343
|
+
maxHeight: 180,
|
|
344
|
+
overflowY: "auto"
|
|
345
|
+
},
|
|
346
|
+
children: /*#__PURE__*/_jsx(CompanyMenu, {
|
|
347
|
+
selectedKeys: [activeKey],
|
|
348
|
+
onClick: function onClick(_ref3) {
|
|
349
|
+
var key = _ref3.key;
|
|
350
|
+
setMoreOpen(false);
|
|
351
|
+
if (homeTab && key === homeTab.key) {
|
|
352
|
+
onHomeClick === null || onHomeClick === void 0 || onHomeClick();
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
var tab = tabs.find(function (t) {
|
|
356
|
+
return t.key === key;
|
|
357
|
+
});
|
|
358
|
+
if (tab) onChange === null || onChange === void 0 || onChange(tab.key, tab);
|
|
359
|
+
},
|
|
360
|
+
items: [].concat(_toConsumableArray(homeTab ? [{
|
|
361
|
+
key: homeTab.key,
|
|
362
|
+
label: homeTab.label
|
|
363
|
+
}] : []), _toConsumableArray(tabs.map(function (t) {
|
|
364
|
+
return {
|
|
365
|
+
key: t.key,
|
|
366
|
+
label: /*#__PURE__*/_jsxs("span", {
|
|
367
|
+
style: {
|
|
368
|
+
display: "flex",
|
|
369
|
+
alignItems: "center",
|
|
370
|
+
justifyContent: "space-between",
|
|
371
|
+
gap: token.marginXS
|
|
372
|
+
},
|
|
373
|
+
children: [t.label, t.closable !== false ? /*#__PURE__*/_jsx(SvgIcon, {
|
|
374
|
+
href: "close",
|
|
375
|
+
size: 12,
|
|
376
|
+
style: {
|
|
377
|
+
color: token.colorTextSecondary,
|
|
378
|
+
flexShrink: 0
|
|
379
|
+
},
|
|
380
|
+
onClick: function onClick(e) {
|
|
381
|
+
// 阻断冒泡:仅关闭页签,不触发整行的跳转与菜单收起
|
|
382
|
+
handleClose(e, t);
|
|
383
|
+
}
|
|
384
|
+
}) : null]
|
|
385
|
+
})
|
|
386
|
+
};
|
|
387
|
+
})))
|
|
388
|
+
})
|
|
389
|
+
}), hasClosableOthers ? /*#__PURE__*/_jsx(CompanyMenu, {
|
|
390
|
+
selectable: false,
|
|
391
|
+
onClick: closeOtherTabs,
|
|
392
|
+
items: [{
|
|
393
|
+
type: "divider"
|
|
394
|
+
}, {
|
|
395
|
+
key: "__close_others__",
|
|
396
|
+
label: "关闭其他页签"
|
|
397
|
+
}]
|
|
398
|
+
}) : null]
|
|
399
|
+
})
|
|
400
|
+
);
|
|
401
|
+
},
|
|
402
|
+
children: /*#__PURE__*/_jsx("button", {
|
|
403
|
+
type: "button",
|
|
404
|
+
className: "company-multi-tabs__action",
|
|
405
|
+
"aria-label": "\u66F4\u591A\u9875\u7B7E",
|
|
406
|
+
children: /*#__PURE__*/_jsx(SvgIcon, {
|
|
407
|
+
name: "more-one",
|
|
408
|
+
size: 16
|
|
409
|
+
})
|
|
410
|
+
})
|
|
411
|
+
}), fullscreenSupported ? /*#__PURE__*/_jsx(CompanyTooltip, {
|
|
412
|
+
title: isFullscreen ? "退出全屏" : "全屏",
|
|
413
|
+
mouseEnterDelay: 0.5,
|
|
414
|
+
children: /*#__PURE__*/_jsx("button", {
|
|
415
|
+
type: "button",
|
|
416
|
+
"aria-label": isFullscreen ? "退出全屏" : "进入全屏",
|
|
417
|
+
className: "company-multi-tabs__action",
|
|
418
|
+
onClick: toggleFullscreen,
|
|
419
|
+
children: /*#__PURE__*/_jsx(SvgIcon, {
|
|
420
|
+
name: isFullscreen ? "off-screen" : "full-screen",
|
|
421
|
+
size: 16
|
|
422
|
+
})
|
|
423
|
+
})
|
|
424
|
+
}) : null]
|
|
425
|
+
}) : null]
|
|
232
426
|
}) : null]
|
|
233
427
|
});
|
|
234
428
|
}
|
|
@@ -217,6 +217,30 @@
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
+
// —— 操作区最右侧内置动作按钮(更多页签下拉 / 全屏切换,showFullscreen 开启时渲染):样式对齐搜索入口 ——
|
|
221
|
+
&__action {
|
|
222
|
+
box-sizing: border-box;
|
|
223
|
+
width: 28px;
|
|
224
|
+
height: 28px;
|
|
225
|
+
display: flex;
|
|
226
|
+
align-items: center;
|
|
227
|
+
justify-content: center;
|
|
228
|
+
padding: 0;
|
|
229
|
+
border: none;
|
|
230
|
+
border-radius: var(--cmt-item-radius);
|
|
231
|
+
background: var(--cmt-item-bg);
|
|
232
|
+
color: var(--cmt-icon);
|
|
233
|
+
cursor: pointer;
|
|
234
|
+
transition:
|
|
235
|
+
background 0.2s,
|
|
236
|
+
color 0.2s;
|
|
237
|
+
|
|
238
|
+
&:hover {
|
|
239
|
+
background: var(--cmt-item-bg-hover);
|
|
240
|
+
color: var(--cmt-icon-hover);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
220
244
|
&__extra {
|
|
221
245
|
display: flex;
|
|
222
246
|
align-items: center;
|
|
@@ -225,3 +249,12 @@
|
|
|
225
249
|
flex-shrink: 0;
|
|
226
250
|
}
|
|
227
251
|
}
|
|
252
|
+
|
|
253
|
+
// —— 「更多页签」下拉弹层(antd 6 默认挂载 body,需顶层作用域块):
|
|
254
|
+
// 覆盖 antd Menu 根元素的四角圆角,圆角由外层投影容器统一裁剪(上 padding 保留 antd 默认 4px)。
|
|
255
|
+
// 提升特异性(0,2,0 > 0,1,0)自然胜出,不使用 !important。
|
|
256
|
+
.company-multi-tabs-more-popup {
|
|
257
|
+
.ant-dropdown-menu {
|
|
258
|
+
border-radius: 0;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
@@ -145,6 +145,10 @@
|
|
|
145
145
|
display: flex;
|
|
146
146
|
flex-direction: column;
|
|
147
147
|
overflow-y: auto;
|
|
148
|
+
|
|
149
|
+
/* 菜单滚到边界后截断滚动链:文档站页面可滚时避免穿透带动整个框架移动;
|
|
150
|
+
真实业务中框架占满视口、页面本身不滚,此属性无副作用 */
|
|
151
|
+
overscroll-behavior: contain;
|
|
148
152
|
padding: 0 8px;
|
|
149
153
|
gap: 4px;
|
|
150
154
|
}
|
|
@@ -482,6 +486,7 @@
|
|
|
482
486
|
.menu-list {
|
|
483
487
|
flex: 1;
|
|
484
488
|
overflow-y: auto;
|
|
489
|
+
overscroll-behavior: contain;
|
|
485
490
|
display: flex;
|
|
486
491
|
flex-direction: column;
|
|
487
492
|
|