@donglegeyu/company-ui 2.6.0 → 2.8.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 +14 -17
- package/dist/cjs/template-components/CompanySidebar/FirstSidebar.d.ts +2 -1
- package/dist/cjs/template-components/CompanySidebar/FirstSidebar.js +2 -0
- package/dist/cjs/template-components/CompanySidebar/index.d.ts +3 -2
- package/dist/cjs/template-components/CompanySidebar/index.js +23 -11
- package/dist/cjs/template-components/CompanySidebar/index.scss +36 -0
- package/dist/cjs/template-components/TreeTableTemplate/index.d.ts +4 -0
- package/dist/cjs/template-components/TreeTableTemplate/index.js +43 -32
- package/dist/cjs/template-components/TreeTableTemplate/index.scss +25 -5
- package/dist/es/template-components/AdminLayoutTemplate/index.js +4 -10
- package/dist/es/template-components/CompanySidebar/FirstSidebar.d.ts +2 -1
- package/dist/es/template-components/CompanySidebar/FirstSidebar.js +4 -0
- package/dist/es/template-components/CompanySidebar/index.d.ts +3 -2
- package/dist/es/template-components/CompanySidebar/index.js +31 -13
- package/dist/es/template-components/CompanySidebar/index.scss +36 -0
- package/dist/es/template-components/TreeTableTemplate/index.d.ts +4 -0
- package/dist/es/template-components/TreeTableTemplate/index.js +37 -31
- package/dist/es/template-components/TreeTableTemplate/index.scss +25 -5
- package/package.json +1 -1
|
@@ -357,20 +357,19 @@ function AdminLayoutTemplate({
|
|
|
357
357
|
contentClassName,
|
|
358
358
|
contentStyle
|
|
359
359
|
}) {
|
|
360
|
-
var _a;
|
|
361
360
|
const effectiveFirstMenus = firstMenus ?? DEFAULT_FIRST_MENUS;
|
|
362
361
|
const effectiveSystemBottomMenus = systemBottomMenus ?? DEFAULT_SYSTEM_BOTTOM_MENUS;
|
|
363
362
|
const [initialActiveKey] = (0, import_react.useState)(() => {
|
|
364
|
-
var
|
|
363
|
+
var _a;
|
|
365
364
|
if (defaultActiveKey)
|
|
366
365
|
return defaultActiveKey;
|
|
367
366
|
const menu = defaultActiveFirstMenu ? businessMenus.find((m) => m.key === defaultActiveFirstMenu) : businessMenus[0];
|
|
368
|
-
return ((
|
|
367
|
+
return ((_a = findFirstLeaf((menu == null ? void 0 : menu.children) ?? [])) == null ? void 0 : _a.key) ?? (menu == null ? void 0 : menu.key) ?? "home";
|
|
369
368
|
});
|
|
370
369
|
const [internalDomainId, setInternalDomainId] = (0, import_react.useState)(
|
|
371
370
|
() => {
|
|
372
|
-
var
|
|
373
|
-
return defaultDomainId ?? ((
|
|
371
|
+
var _a;
|
|
372
|
+
return defaultDomainId ?? ((_a = domains[0]) == null ? void 0 : _a.id) ?? null;
|
|
374
373
|
}
|
|
375
374
|
);
|
|
376
375
|
const isDomainControlled = currentDomainId !== void 0;
|
|
@@ -383,8 +382,8 @@ function AdminLayoutTemplate({
|
|
|
383
382
|
const [favorites, setFavorites] = (0, import_react.useState)(defaultFavorites);
|
|
384
383
|
const [activeFirstMenu, setActiveFirstMenu] = (0, import_react.useState)(
|
|
385
384
|
() => {
|
|
386
|
-
var
|
|
387
|
-
return defaultActiveFirstMenu ?? ((
|
|
385
|
+
var _a;
|
|
386
|
+
return defaultActiveFirstMenu ?? ((_a = businessMenus[0]) == null ? void 0 : _a.key) ?? "home";
|
|
388
387
|
}
|
|
389
388
|
);
|
|
390
389
|
const [activeKey, setActiveKey] = (0, import_react.useState)(initialActiveKey);
|
|
@@ -420,7 +419,6 @@ function AdminLayoutTemplate({
|
|
|
420
419
|
const effectiveTabs = isTabsControlled ? tabs : internalTabs;
|
|
421
420
|
const isTabActiveControlled = activeTabKey !== void 0;
|
|
422
421
|
const effectiveActiveTabKey = isTabActiveControlled ? activeTabKey : internalActiveTabKey;
|
|
423
|
-
const secondMenus = ((_a = businessMenus.find((m) => m.key === activeFirstMenu)) == null ? void 0 : _a.children) ?? [];
|
|
424
422
|
const isHomeActive = homeTab ? effectiveActiveTabKey === homeTab.key : false;
|
|
425
423
|
const activePage = pages == null ? void 0 : pages.find((p) => p.key === effectiveActiveTabKey);
|
|
426
424
|
const content = isHomeActive ? homeContent ?? children : (activePage == null ? void 0 : activePage.component) ?? children;
|
|
@@ -440,11 +438,11 @@ function AdminLayoutTemplate({
|
|
|
440
438
|
return [
|
|
441
439
|
...home,
|
|
442
440
|
...effectiveTabs.map((tab) => {
|
|
443
|
-
var
|
|
441
|
+
var _a;
|
|
444
442
|
return {
|
|
445
443
|
key: tab.key,
|
|
446
444
|
label: typeof tab.label === "string" ? tab.label : tab.key,
|
|
447
|
-
capability: (
|
|
445
|
+
capability: (_a = pages == null ? void 0 : pages.find((page) => page.key === tab.key)) == null ? void 0 : _a.aiCapability
|
|
448
446
|
};
|
|
449
447
|
})
|
|
450
448
|
];
|
|
@@ -457,11 +455,11 @@ function AdminLayoutTemplate({
|
|
|
457
455
|
return () => document.removeEventListener("fullscreenchange", onFullscreenChange);
|
|
458
456
|
}, []);
|
|
459
457
|
const toggleFullscreen = (0, import_react.useCallback)(() => {
|
|
460
|
-
var
|
|
458
|
+
var _a;
|
|
461
459
|
if (document.fullscreenElement) {
|
|
462
460
|
void document.exitFullscreen();
|
|
463
461
|
} else {
|
|
464
|
-
void ((
|
|
462
|
+
void ((_a = rootRef.current) == null ? void 0 : _a.requestFullscreen());
|
|
465
463
|
}
|
|
466
464
|
}, []);
|
|
467
465
|
const systemMenuKeys = (0, import_react.useMemo)(
|
|
@@ -596,17 +594,17 @@ function AdminLayoutTemplate({
|
|
|
596
594
|
}, [homeTab, isTabActiveControlled, onActiveFirstMenuChange, onActiveTabChange]);
|
|
597
595
|
const handleFirstMenuSelect = (0, import_react.useCallback)(
|
|
598
596
|
(key) => {
|
|
599
|
-
var
|
|
597
|
+
var _a;
|
|
600
598
|
setActiveFirstMenu(key);
|
|
601
599
|
onActiveFirstMenuChange == null ? void 0 : onActiveFirstMenuChange(key);
|
|
602
|
-
const nextSecondMenus = ((
|
|
600
|
+
const nextSecondMenus = ((_a = businessMenus.find((m) => m.key === key)) == null ? void 0 : _a.children) ?? [];
|
|
603
601
|
setExpandedKeys(collectParentKeys(nextSecondMenus));
|
|
604
602
|
},
|
|
605
603
|
[businessMenus, onActiveFirstMenuChange]
|
|
606
604
|
);
|
|
607
605
|
const handleMenuClick = (0, import_react.useCallback)(
|
|
608
606
|
(menu) => {
|
|
609
|
-
var
|
|
607
|
+
var _a;
|
|
610
608
|
setActiveKey(menu.key);
|
|
611
609
|
const parentModule = businessMenus.find((m) => findMenuByKey(m.children ?? [], menu.key));
|
|
612
610
|
if (parentModule && parentModule.key !== activeFirstMenu) {
|
|
@@ -614,7 +612,7 @@ function AdminLayoutTemplate({
|
|
|
614
612
|
setExpandedKeys(collectParentKeys(parentModule.children ?? []));
|
|
615
613
|
onActiveFirstMenuChange == null ? void 0 : onActiveFirstMenuChange(parentModule.key);
|
|
616
614
|
}
|
|
617
|
-
if ((
|
|
615
|
+
if ((_a = menu.children) == null ? void 0 : _a.length)
|
|
618
616
|
return;
|
|
619
617
|
if (systemMenuKeys.has(menu.key)) {
|
|
620
618
|
if (homeTab && menu.key === homeTab.key) {
|
|
@@ -717,7 +715,6 @@ function AdminLayoutTemplate({
|
|
|
717
715
|
firstMenus: effectiveFirstMenus,
|
|
718
716
|
systemBottomMenus: effectiveSystemBottomMenus,
|
|
719
717
|
businessMenus,
|
|
720
|
-
secondMenus,
|
|
721
718
|
customNavMenus: effectiveCustomNavMenus,
|
|
722
719
|
onCustomNavUpdate: handleCustomNavUpdate,
|
|
723
720
|
favorites,
|
|
@@ -14,6 +14,7 @@ export interface FirstSidebarProps {
|
|
|
14
14
|
activeKey: string;
|
|
15
15
|
activeFirstMenu: string;
|
|
16
16
|
visibleMenuCount?: number;
|
|
17
|
+
bottomExtra?: React.ReactNode;
|
|
17
18
|
domainPopoverOpen: boolean;
|
|
18
19
|
adminPopoverOpen: boolean;
|
|
19
20
|
onDomainPopoverOpenChange: (open: boolean) => void;
|
|
@@ -26,4 +27,4 @@ export interface FirstSidebarProps {
|
|
|
26
27
|
onThemeSettings?: () => void;
|
|
27
28
|
onLogout?: () => void;
|
|
28
29
|
}
|
|
29
|
-
export default function FirstSidebar({ domains, currentDomainId, userInfo, logo, brandName, firstMenus, systemBottomMenus, businessMenus, customNavMenus, activeKey, activeFirstMenu, visibleMenuCount, domainPopoverOpen, adminPopoverOpen, onDomainPopoverOpenChange, onAdminPopoverOpenChange, onDomainChange, onMenuClick, onBusinessMenuEnter, onBusinessMenuLeave, onOpenMore, onThemeSettings, onLogout, }: FirstSidebarProps): import("react").JSX.Element;
|
|
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, onThemeSettings, onLogout, }: FirstSidebarProps): import("react").JSX.Element;
|
|
@@ -39,6 +39,7 @@ function FirstSidebar({
|
|
|
39
39
|
activeKey,
|
|
40
40
|
activeFirstMenu,
|
|
41
41
|
visibleMenuCount = 6,
|
|
42
|
+
bottomExtra,
|
|
42
43
|
domainPopoverOpen,
|
|
43
44
|
adminPopoverOpen,
|
|
44
45
|
onDomainPopoverOpenChange,
|
|
@@ -131,6 +132,7 @@ function FirstSidebar({
|
|
|
131
132
|
menu.iconNode || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_shared_components.SvgIcon, { name: menu.icon || "setting", className: "menu-icon" }),
|
|
132
133
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "menu-label", children: menu.label })
|
|
133
134
|
] }, menu.key)),
|
|
135
|
+
bottomExtra && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "bottom-extra", children: bottomExtra }),
|
|
134
136
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
135
137
|
import_basic_components.CompanyPopover,
|
|
136
138
|
{
|
|
@@ -13,7 +13,6 @@ export interface CompanySidebarProps {
|
|
|
13
13
|
firstMenus: SidebarMenuItem[];
|
|
14
14
|
systemBottomMenus: SidebarMenuItem[];
|
|
15
15
|
businessMenus: SidebarMenuItem[];
|
|
16
|
-
secondMenus: SidebarMenuItem[];
|
|
17
16
|
customNavMenus: SidebarMenuItem[];
|
|
18
17
|
onCustomNavUpdate: (selected: SidebarMenuItem[]) => void;
|
|
19
18
|
favorites: SidebarFavoriteItem[];
|
|
@@ -30,7 +29,9 @@ export interface CompanySidebarProps {
|
|
|
30
29
|
onSecondSidebarFixedChange: (fixed: boolean) => void;
|
|
31
30
|
visibleMenuCount?: number;
|
|
32
31
|
emptyImage?: string;
|
|
32
|
+
bottomExtra?: React.ReactNode;
|
|
33
|
+
onDomainPopoverOpenChange?: (open: boolean) => void;
|
|
33
34
|
onThemeSettings?: () => void;
|
|
34
35
|
onLogout?: () => void;
|
|
35
36
|
}
|
|
36
|
-
export default function CompanySidebar({ className, style, domains, currentDomainId, onDomainChange, userInfo, logo, brandName, firstMenus, systemBottomMenus, businessMenus,
|
|
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, onThemeSettings, onLogout, }: CompanySidebarProps): import("react").JSX.Element;
|
|
@@ -74,7 +74,6 @@ function CompanySidebar({
|
|
|
74
74
|
firstMenus,
|
|
75
75
|
systemBottomMenus,
|
|
76
76
|
businessMenus,
|
|
77
|
-
secondMenus,
|
|
78
77
|
customNavMenus,
|
|
79
78
|
onCustomNavUpdate,
|
|
80
79
|
favorites,
|
|
@@ -91,6 +90,8 @@ function CompanySidebar({
|
|
|
91
90
|
onSecondSidebarFixedChange,
|
|
92
91
|
visibleMenuCount = 6,
|
|
93
92
|
emptyImage,
|
|
93
|
+
bottomExtra,
|
|
94
|
+
onDomainPopoverOpenChange,
|
|
94
95
|
onThemeSettings,
|
|
95
96
|
onLogout
|
|
96
97
|
}) {
|
|
@@ -98,6 +99,7 @@ function CompanySidebar({
|
|
|
98
99
|
domainPopoverOpen: false,
|
|
99
100
|
adminPopoverOpen: false,
|
|
100
101
|
secondSidebarHovered: false,
|
|
102
|
+
hoverKey: null,
|
|
101
103
|
moreDrawerOpen: false,
|
|
102
104
|
customNavVisible: false,
|
|
103
105
|
localExpandedKeys: expandedKeys,
|
|
@@ -105,8 +107,15 @@ function CompanySidebar({
|
|
|
105
107
|
hasError: false
|
|
106
108
|
});
|
|
107
109
|
const resolvedBusinessMenus = (0, import_react.useMemo)(() => (0, import_menuIconMap.resolveMenuIcons)(businessMenus), [businessMenus]);
|
|
108
|
-
const resolvedSecondMenus = (0, import_react.useMemo)(() => (0, import_menuIconMap.resolveMenuIcons)(secondMenus), [secondMenus]);
|
|
109
110
|
const resolvedCustomNavMenus = (0, import_react.useMemo)(() => (0, import_menuIconMap.resolveMenuIcons)(customNavMenus), [customNavMenus]);
|
|
111
|
+
const displayFirstMenu = state.hoverKey ?? activeFirstMenu;
|
|
112
|
+
const displaySecondMenus = (0, import_react.useMemo)(
|
|
113
|
+
() => {
|
|
114
|
+
var _a;
|
|
115
|
+
return ((_a = resolvedBusinessMenus.find((m) => m.key === displayFirstMenu)) == null ? void 0 : _a.children) ?? [];
|
|
116
|
+
},
|
|
117
|
+
[resolvedBusinessMenus, displayFirstMenu]
|
|
118
|
+
);
|
|
110
119
|
const leafToFirstKeyMap = (0, import_react.useMemo)(() => buildLeafToFirstKeyMap(businessMenus), [businessMenus]);
|
|
111
120
|
const handleLeafMenuClick = (0, import_react.useCallback)(
|
|
112
121
|
(menu) => {
|
|
@@ -132,7 +141,7 @@ function CompanySidebar({
|
|
|
132
141
|
if (hideSidebarTimerRef.current)
|
|
133
142
|
clearTimeout(hideSidebarTimerRef.current);
|
|
134
143
|
hideSidebarTimerRef.current = setTimeout(() => {
|
|
135
|
-
setState((prev) => ({ ...prev, secondSidebarHovered: false }));
|
|
144
|
+
setState((prev) => ({ ...prev, secondSidebarHovered: false, hoverKey: null }));
|
|
136
145
|
}, 100);
|
|
137
146
|
}, [hideSidebarTimerRef]);
|
|
138
147
|
const cancelHideSidebar = (0, import_react.useCallback)(() => {
|
|
@@ -143,12 +152,11 @@ function CompanySidebar({
|
|
|
143
152
|
setState((prev) => ({ ...prev, secondSidebarHovered: true }));
|
|
144
153
|
}, [hideSidebarTimerRef]);
|
|
145
154
|
const handleBusinessMenuEnter = (0, import_react.useCallback)(
|
|
146
|
-
(
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
155
|
+
(menu) => {
|
|
156
|
+
setState((prev) => ({ ...prev, hoverKey: menu.key }));
|
|
157
|
+
cancelHideSidebar();
|
|
150
158
|
},
|
|
151
|
-
[
|
|
159
|
+
[cancelHideSidebar]
|
|
152
160
|
);
|
|
153
161
|
const handleBusinessMenuLeave = (0, import_react.useCallback)(() => {
|
|
154
162
|
delayHideSidebar();
|
|
@@ -218,9 +226,13 @@ function CompanySidebar({
|
|
|
218
226
|
activeKey,
|
|
219
227
|
activeFirstMenu,
|
|
220
228
|
visibleMenuCount,
|
|
229
|
+
bottomExtra,
|
|
221
230
|
domainPopoverOpen: state.domainPopoverOpen,
|
|
222
231
|
adminPopoverOpen: state.adminPopoverOpen,
|
|
223
|
-
onDomainPopoverOpenChange: (open) =>
|
|
232
|
+
onDomainPopoverOpenChange: (open) => {
|
|
233
|
+
setState((prev) => ({ ...prev, domainPopoverOpen: open }));
|
|
234
|
+
onDomainPopoverOpenChange == null ? void 0 : onDomainPopoverOpenChange(open);
|
|
235
|
+
},
|
|
224
236
|
onAdminPopoverOpenChange: (open) => setState((prev) => ({ ...prev, adminPopoverOpen: open })),
|
|
225
237
|
onDomainChange,
|
|
226
238
|
onMenuClick: handleFirstMenuClick,
|
|
@@ -234,11 +246,11 @@ function CompanySidebar({
|
|
|
234
246
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
235
247
|
import_SecondSidebar.default,
|
|
236
248
|
{
|
|
237
|
-
activeFirstMenu,
|
|
249
|
+
activeFirstMenu: displayFirstMenu,
|
|
238
250
|
activeKey,
|
|
239
251
|
secondSidebarHovered: state.secondSidebarHovered,
|
|
240
252
|
secondSidebarFixed,
|
|
241
|
-
secondMenus:
|
|
253
|
+
secondMenus: displaySecondMenus,
|
|
242
254
|
favorites: state.localFavorites,
|
|
243
255
|
expandedKeys: state.localExpandedKeys,
|
|
244
256
|
emptyImage,
|
|
@@ -179,6 +179,16 @@
|
|
|
179
179
|
align-self: stretch;
|
|
180
180
|
z-index: 5;
|
|
181
181
|
cursor: pointer;
|
|
182
|
+
|
|
183
|
+
&:hover {
|
|
184
|
+
.avatar {
|
|
185
|
+
background: rgba(255, 255, 255, 0.25);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.name {
|
|
189
|
+
color: #fff;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
182
192
|
}
|
|
183
193
|
|
|
184
194
|
.person-info .avatar {
|
|
@@ -195,6 +205,7 @@
|
|
|
195
205
|
background: rgba(255, 255, 255, 0.15);
|
|
196
206
|
color: #fff;
|
|
197
207
|
font-size: 10px;
|
|
208
|
+
transition: background 0.2s ease;
|
|
198
209
|
}
|
|
199
210
|
|
|
200
211
|
.person-info .name {
|
|
@@ -202,6 +213,7 @@
|
|
|
202
213
|
font-weight: normal;
|
|
203
214
|
line-height: 20px;
|
|
204
215
|
color: rgba(255, 255, 255, 0.65);
|
|
216
|
+
transition: color 0.25s ease;
|
|
205
217
|
overflow: hidden;
|
|
206
218
|
text-overflow: ellipsis;
|
|
207
219
|
white-space: nowrap;
|
|
@@ -225,6 +237,10 @@
|
|
|
225
237
|
&:hover:not(.active) {
|
|
226
238
|
color: #fff;
|
|
227
239
|
background: rgba(255, 255, 255, 0.08);
|
|
240
|
+
|
|
241
|
+
.menu-label {
|
|
242
|
+
color: #fff;
|
|
243
|
+
}
|
|
228
244
|
}
|
|
229
245
|
|
|
230
246
|
&.active {
|
|
@@ -261,6 +277,10 @@
|
|
|
261
277
|
&:hover:not(.active) {
|
|
262
278
|
color: #fff;
|
|
263
279
|
background: rgba(255, 255, 255, 0.08);
|
|
280
|
+
|
|
281
|
+
.menu-label {
|
|
282
|
+
color: #fff;
|
|
283
|
+
}
|
|
264
284
|
}
|
|
265
285
|
|
|
266
286
|
&.active {
|
|
@@ -322,6 +342,14 @@
|
|
|
322
342
|
transition: all 0.2s;
|
|
323
343
|
z-index: 5;
|
|
324
344
|
|
|
345
|
+
&:hover {
|
|
346
|
+
color: #fff;
|
|
347
|
+
|
|
348
|
+
.menu-label {
|
|
349
|
+
color: #fff;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
325
353
|
.menu-icon {
|
|
326
354
|
width: 16px;
|
|
327
355
|
height: 16px;
|
|
@@ -340,6 +368,14 @@
|
|
|
340
368
|
white-space: nowrap;
|
|
341
369
|
}
|
|
342
370
|
}
|
|
371
|
+
|
|
372
|
+
.bottom-extra {
|
|
373
|
+
width: 100%;
|
|
374
|
+
min-width: 0;
|
|
375
|
+
flex-shrink: 0;
|
|
376
|
+
color: rgba(255, 255, 255, 0.65);
|
|
377
|
+
font-size: 12px;
|
|
378
|
+
}
|
|
343
379
|
}
|
|
344
380
|
|
|
345
381
|
// ========== Domain Popover ==========
|
|
@@ -44,6 +44,10 @@ export interface TreeTableTemplateProps<T = Record<string, unknown>> extends Omi
|
|
|
44
44
|
onNodeEdit?: (key: string) => void;
|
|
45
45
|
/** 树节点 hover 操作:删除按钮回调 */
|
|
46
46
|
onNodeDelete?: (key: string) => void;
|
|
47
|
+
/** 左树底部「新增」按钮回调(不传则不显示按钮) */
|
|
48
|
+
onTreeAdd?: () => void;
|
|
49
|
+
/** 左树底部新增按钮文案 */
|
|
50
|
+
treeAddText?: string;
|
|
47
51
|
/** 左树面板初始宽度(支持拖拽调节) */
|
|
48
52
|
treeWidth?: number;
|
|
49
53
|
/** 左树面板最小宽度(拖拽下限) */
|
|
@@ -55,6 +55,8 @@ var TreeTableTemplate = (props) => {
|
|
|
55
55
|
onNodeAdd,
|
|
56
56
|
onNodeEdit,
|
|
57
57
|
onNodeDelete,
|
|
58
|
+
onTreeAdd,
|
|
59
|
+
treeAddText = "新增部门",
|
|
58
60
|
treeWidth = 232,
|
|
59
61
|
minTreeWidth = 200,
|
|
60
62
|
maxTreeWidth = 480,
|
|
@@ -207,40 +209,49 @@ var TreeTableTemplate = (props) => {
|
|
|
207
209
|
children: typeof node.title === "function" ? node.title(node) : node.title
|
|
208
210
|
}
|
|
209
211
|
),
|
|
210
|
-
hasNodeActions && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
] })
|
|
212
|
+
hasNodeActions && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ttt-tree-node-actions", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
213
|
+
import_basic_components.CompanyDropdown,
|
|
214
|
+
{
|
|
215
|
+
trigger: ["click"],
|
|
216
|
+
menu: {
|
|
217
|
+
items: [
|
|
218
|
+
...onNodeAdd ? [{ key: "add", icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.PlusOutlined, {}), label: "新增" }] : [],
|
|
219
|
+
...onNodeEdit ? [{ key: "edit", icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.EditOutlined, {}), label: "编辑" }] : [],
|
|
220
|
+
...onNodeDelete ? [{ key: "delete", icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.DeleteOutlined, {}), label: "删除" }] : []
|
|
221
|
+
],
|
|
222
|
+
onClick: ({ key }) => {
|
|
223
|
+
if (key === "add")
|
|
224
|
+
onNodeAdd == null ? void 0 : onNodeAdd(String(node.key));
|
|
225
|
+
else if (key === "edit")
|
|
226
|
+
onNodeEdit == null ? void 0 : onNodeEdit(String(node.key));
|
|
227
|
+
else if (key === "delete")
|
|
228
|
+
onNodeDelete == null ? void 0 : onNodeDelete(String(node.key));
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
232
|
+
import_basic_components.CompanyButton,
|
|
233
|
+
{
|
|
234
|
+
type: "text",
|
|
235
|
+
size: "small",
|
|
236
|
+
className: "ttt-tree-action-btn",
|
|
237
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.MoreOutlined, {}),
|
|
238
|
+
onClick: (e) => e.stopPropagation()
|
|
239
|
+
}
|
|
240
|
+
)
|
|
241
|
+
}
|
|
242
|
+
) })
|
|
242
243
|
] })
|
|
243
244
|
}
|
|
245
|
+
),
|
|
246
|
+
onTreeAdd && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
247
|
+
import_basic_components.CompanyButton,
|
|
248
|
+
{
|
|
249
|
+
block: true,
|
|
250
|
+
className: "ttt-tree-add-btn",
|
|
251
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.PlusOutlined, {}),
|
|
252
|
+
onClick: onTreeAdd,
|
|
253
|
+
children: treeAddText
|
|
254
|
+
}
|
|
244
255
|
)
|
|
245
256
|
] }),
|
|
246
257
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -90,8 +90,9 @@
|
|
|
90
90
|
overflow: hidden;
|
|
91
91
|
text-overflow: ellipsis;
|
|
92
92
|
white-space: nowrap;
|
|
93
|
-
margin-left:
|
|
94
|
-
padding:
|
|
93
|
+
margin-left: 9px;
|
|
94
|
+
padding-left: 4px;
|
|
95
|
+
padding-right: 0;
|
|
95
96
|
line-height: 28px;
|
|
96
97
|
border-radius: 6px;
|
|
97
98
|
transition: all var(--motion-duration-fast, 0.2s)
|
|
@@ -107,7 +108,7 @@
|
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
110
|
|
|
110
|
-
// 树节点:hover
|
|
111
|
+
// 树节点:hover 时在右侧显示「更多」操作按钮(点击弹出新增 / 编辑 / 删除下拉菜单)
|
|
111
112
|
.ttt-tree-node {
|
|
112
113
|
display: flex;
|
|
113
114
|
align-items: center;
|
|
@@ -126,19 +127,38 @@
|
|
|
126
127
|
display: none;
|
|
127
128
|
align-items: center;
|
|
128
129
|
flex-shrink: 0;
|
|
129
|
-
margin-right:
|
|
130
|
+
margin-right: 0;
|
|
130
131
|
|
|
131
132
|
.ttt-tree-action-btn {
|
|
132
|
-
//
|
|
133
|
+
// 压缩按钮内边距,避免挤占节点标题空间
|
|
133
134
|
padding-inline: 2px;
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
138
|
|
|
139
|
+
// 树节点内容容器:左内边距 8px → 4px(收紧文字与箭头间距),右内边距归零(选中背景/内容区贴齐右侧)
|
|
140
|
+
.ttt-tree-panel .ant-tree-node-content-wrapper {
|
|
141
|
+
padding-inline: 4px 0;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// 树展开/收起箭头(open/close/noop 状态统一):去掉 antd 默认 6px 右外边距,箭头与节点内容贴紧
|
|
145
|
+
.ttt-tree-panel .ant-tree-switcher {
|
|
146
|
+
margin-inline-end: 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
138
149
|
.ttt-tree-panel .ant-tree-node-content-wrapper:hover .ttt-tree-node-actions {
|
|
139
150
|
display: inline-flex;
|
|
140
151
|
}
|
|
141
152
|
|
|
153
|
+
// 左树底部「新增」按钮:树内容不超一屏时跟随内容,超一屏时吸底(sticky 原生行为,无需 JS 判断)
|
|
154
|
+
.ttt-tree-add-btn {
|
|
155
|
+
position: sticky;
|
|
156
|
+
bottom: 0;
|
|
157
|
+
z-index: 1;
|
|
158
|
+
margin-top: calc(var(--spacing-xs, 8) * 1px);
|
|
159
|
+
background: var(--color-bg-container);
|
|
160
|
+
}
|
|
161
|
+
|
|
142
162
|
// 右侧列表:复用 StatisticsListPage,隐藏其内置标题栏(页面标题由模板统一渲染)
|
|
143
163
|
.ttt-body > .statistics-list-page {
|
|
144
164
|
flex: 1;
|
|
@@ -441,7 +441,7 @@ function AiAssistantAside(_ref) {
|
|
|
441
441
|
* - 两种内容模式:pages 配置式(key 与菜单联动)或 children 兜底(直接放业务模板)
|
|
442
442
|
*/
|
|
443
443
|
export default function AdminLayoutTemplate(_ref2) {
|
|
444
|
-
var
|
|
444
|
+
var _activePage$component;
|
|
445
445
|
var className = _ref2.className,
|
|
446
446
|
style = _ref2.style,
|
|
447
447
|
logo = _ref2.logo,
|
|
@@ -596,11 +596,6 @@ export default function AdminLayoutTemplate(_ref2) {
|
|
|
596
596
|
var isTabActiveControlled = activeTabKey !== undefined;
|
|
597
597
|
var effectiveActiveTabKey = isTabActiveControlled ? activeTabKey : internalActiveTabKey;
|
|
598
598
|
|
|
599
|
-
// —— 二级菜单:由当前激活一级模块派生 ——
|
|
600
|
-
var secondMenus = (_businessMenus$find$c = (_businessMenus$find = businessMenus.find(function (m) {
|
|
601
|
-
return m.key === activeFirstMenu;
|
|
602
|
-
})) === null || _businessMenus$find === void 0 ? void 0 : _businessMenus$find.children) !== null && _businessMenus$find$c !== void 0 ? _businessMenus$find$c : [];
|
|
603
|
-
|
|
604
599
|
// —— 内容:pages 配置式优先,回落 children ——
|
|
605
600
|
var isHomeActive = homeTab ? effectiveActiveTabKey === homeTab.key : false;
|
|
606
601
|
var activePage = pages === null || pages === void 0 ? void 0 : pages.find(function (p) {
|
|
@@ -781,13 +776,13 @@ export default function AdminLayoutTemplate(_ref2) {
|
|
|
781
776
|
});
|
|
782
777
|
}, [homeTab, isTabActiveControlled, onActiveFirstMenuChange, onActiveTabChange]);
|
|
783
778
|
var handleFirstMenuSelect = useCallback(function (key) {
|
|
784
|
-
var _businessMenus$find$
|
|
779
|
+
var _businessMenus$find$c, _businessMenus$find;
|
|
785
780
|
setActiveFirstMenu(key);
|
|
786
781
|
onActiveFirstMenuChange === null || onActiveFirstMenuChange === void 0 || onActiveFirstMenuChange(key);
|
|
787
782
|
// 切换模块时自动展开二级菜单的父级分组
|
|
788
|
-
var nextSecondMenus = (_businessMenus$find$
|
|
783
|
+
var nextSecondMenus = (_businessMenus$find$c = (_businessMenus$find = businessMenus.find(function (m) {
|
|
789
784
|
return m.key === key;
|
|
790
|
-
})) === null || _businessMenus$
|
|
785
|
+
})) === null || _businessMenus$find === void 0 ? void 0 : _businessMenus$find.children) !== null && _businessMenus$find$c !== void 0 ? _businessMenus$find$c : [];
|
|
791
786
|
setExpandedKeys(collectParentKeys(nextSecondMenus));
|
|
792
787
|
}, [businessMenus, onActiveFirstMenuChange]);
|
|
793
788
|
var handleMenuClick = useCallback(function (menu) {
|
|
@@ -913,7 +908,6 @@ export default function AdminLayoutTemplate(_ref2) {
|
|
|
913
908
|
firstMenus: effectiveFirstMenus,
|
|
914
909
|
systemBottomMenus: effectiveSystemBottomMenus,
|
|
915
910
|
businessMenus: businessMenus,
|
|
916
|
-
secondMenus: secondMenus,
|
|
917
911
|
customNavMenus: effectiveCustomNavMenus,
|
|
918
912
|
onCustomNavUpdate: handleCustomNavUpdate,
|
|
919
913
|
favorites: favorites,
|
|
@@ -14,6 +14,7 @@ export interface FirstSidebarProps {
|
|
|
14
14
|
activeKey: string;
|
|
15
15
|
activeFirstMenu: string;
|
|
16
16
|
visibleMenuCount?: number;
|
|
17
|
+
bottomExtra?: React.ReactNode;
|
|
17
18
|
domainPopoverOpen: boolean;
|
|
18
19
|
adminPopoverOpen: boolean;
|
|
19
20
|
onDomainPopoverOpenChange: (open: boolean) => void;
|
|
@@ -26,4 +27,4 @@ export interface FirstSidebarProps {
|
|
|
26
27
|
onThemeSettings?: () => void;
|
|
27
28
|
onLogout?: () => void;
|
|
28
29
|
}
|
|
29
|
-
export default function FirstSidebar({ domains, currentDomainId, userInfo, logo, brandName, firstMenus, systemBottomMenus, businessMenus, customNavMenus, activeKey, activeFirstMenu, visibleMenuCount, domainPopoverOpen, adminPopoverOpen, onDomainPopoverOpenChange, onAdminPopoverOpenChange, onDomainChange, onMenuClick, onBusinessMenuEnter, onBusinessMenuLeave, onOpenMore, onThemeSettings, onLogout, }: FirstSidebarProps): import("react").JSX.Element;
|
|
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, onThemeSettings, onLogout, }: FirstSidebarProps): import("react").JSX.Element;
|
|
@@ -18,6 +18,7 @@ export default function FirstSidebar(_ref) {
|
|
|
18
18
|
activeFirstMenu = _ref.activeFirstMenu,
|
|
19
19
|
_ref$visibleMenuCount = _ref.visibleMenuCount,
|
|
20
20
|
visibleMenuCount = _ref$visibleMenuCount === void 0 ? 6 : _ref$visibleMenuCount,
|
|
21
|
+
bottomExtra = _ref.bottomExtra,
|
|
21
22
|
domainPopoverOpen = _ref.domainPopoverOpen,
|
|
22
23
|
adminPopoverOpen = _ref.adminPopoverOpen,
|
|
23
24
|
onDomainPopoverOpenChange = _ref.onDomainPopoverOpenChange,
|
|
@@ -166,6 +167,9 @@ export default function FirstSidebar(_ref) {
|
|
|
166
167
|
children: menu.label
|
|
167
168
|
})]
|
|
168
169
|
}, menu.key);
|
|
170
|
+
}), bottomExtra && /*#__PURE__*/_jsx("div", {
|
|
171
|
+
className: "bottom-extra",
|
|
172
|
+
children: bottomExtra
|
|
169
173
|
}), /*#__PURE__*/_jsx(CompanyPopover, {
|
|
170
174
|
open: adminPopoverOpen,
|
|
171
175
|
onOpenChange: onAdminPopoverOpenChange,
|
|
@@ -13,7 +13,6 @@ export interface CompanySidebarProps {
|
|
|
13
13
|
firstMenus: SidebarMenuItem[];
|
|
14
14
|
systemBottomMenus: SidebarMenuItem[];
|
|
15
15
|
businessMenus: SidebarMenuItem[];
|
|
16
|
-
secondMenus: SidebarMenuItem[];
|
|
17
16
|
customNavMenus: SidebarMenuItem[];
|
|
18
17
|
onCustomNavUpdate: (selected: SidebarMenuItem[]) => void;
|
|
19
18
|
favorites: SidebarFavoriteItem[];
|
|
@@ -30,7 +29,9 @@ export interface CompanySidebarProps {
|
|
|
30
29
|
onSecondSidebarFixedChange: (fixed: boolean) => void;
|
|
31
30
|
visibleMenuCount?: number;
|
|
32
31
|
emptyImage?: string;
|
|
32
|
+
bottomExtra?: React.ReactNode;
|
|
33
|
+
onDomainPopoverOpenChange?: (open: boolean) => void;
|
|
33
34
|
onThemeSettings?: () => void;
|
|
34
35
|
onLogout?: () => void;
|
|
35
36
|
}
|
|
36
|
-
export default function CompanySidebar({ className, style, domains, currentDomainId, onDomainChange, userInfo, logo, brandName, firstMenus, systemBottomMenus, businessMenus,
|
|
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, onThemeSettings, onLogout, }: CompanySidebarProps): import("react").JSX.Element;
|
|
@@ -48,6 +48,7 @@ function DefaultFallback() {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
export default function CompanySidebar(_ref) {
|
|
51
|
+
var _state$hoverKey;
|
|
51
52
|
var className = _ref.className,
|
|
52
53
|
style = _ref.style,
|
|
53
54
|
domains = _ref.domains,
|
|
@@ -60,7 +61,6 @@ export default function CompanySidebar(_ref) {
|
|
|
60
61
|
firstMenus = _ref.firstMenus,
|
|
61
62
|
systemBottomMenus = _ref.systemBottomMenus,
|
|
62
63
|
businessMenus = _ref.businessMenus,
|
|
63
|
-
secondMenus = _ref.secondMenus,
|
|
64
64
|
customNavMenus = _ref.customNavMenus,
|
|
65
65
|
onCustomNavUpdate = _ref.onCustomNavUpdate,
|
|
66
66
|
favorites = _ref.favorites,
|
|
@@ -78,12 +78,15 @@ export default function CompanySidebar(_ref) {
|
|
|
78
78
|
_ref$visibleMenuCount = _ref.visibleMenuCount,
|
|
79
79
|
visibleMenuCount = _ref$visibleMenuCount === void 0 ? 6 : _ref$visibleMenuCount,
|
|
80
80
|
emptyImage = _ref.emptyImage,
|
|
81
|
+
bottomExtra = _ref.bottomExtra,
|
|
82
|
+
_onDomainPopoverOpenChange = _ref.onDomainPopoverOpenChange,
|
|
81
83
|
onThemeSettings = _ref.onThemeSettings,
|
|
82
84
|
onLogout = _ref.onLogout;
|
|
83
85
|
var _useState = useState({
|
|
84
86
|
domainPopoverOpen: false,
|
|
85
87
|
adminPopoverOpen: false,
|
|
86
88
|
secondSidebarHovered: false,
|
|
89
|
+
hoverKey: null,
|
|
87
90
|
moreDrawerOpen: false,
|
|
88
91
|
customNavVisible: false,
|
|
89
92
|
localExpandedKeys: expandedKeys,
|
|
@@ -96,13 +99,20 @@ export default function CompanySidebar(_ref) {
|
|
|
96
99
|
var resolvedBusinessMenus = useMemo(function () {
|
|
97
100
|
return resolveMenuIcons(businessMenus);
|
|
98
101
|
}, [businessMenus]);
|
|
99
|
-
var resolvedSecondMenus = useMemo(function () {
|
|
100
|
-
return resolveMenuIcons(secondMenus);
|
|
101
|
-
}, [secondMenus]);
|
|
102
102
|
var resolvedCustomNavMenus = useMemo(function () {
|
|
103
103
|
return resolveMenuIcons(customNavMenus);
|
|
104
104
|
}, [customNavMenus]);
|
|
105
105
|
|
|
106
|
+
// hover 预切换:二级栏内容由内部 hoverKey 驱动(hover 期间预览悬浮项),activeFirstMenu 始终表示点击选中项
|
|
107
|
+
var displayFirstMenu = (_state$hoverKey = state.hoverKey) !== null && _state$hoverKey !== void 0 ? _state$hoverKey : activeFirstMenu;
|
|
108
|
+
// 二级栏内容直接由业务菜单树按 displayFirstMenu 派生,业务侧无需拼接 secondMenus
|
|
109
|
+
var displaySecondMenus = useMemo(function () {
|
|
110
|
+
var _resolvedBusinessMenu, _resolvedBusinessMenu2;
|
|
111
|
+
return (_resolvedBusinessMenu = (_resolvedBusinessMenu2 = resolvedBusinessMenus.find(function (m) {
|
|
112
|
+
return m.key === displayFirstMenu;
|
|
113
|
+
})) === null || _resolvedBusinessMenu2 === void 0 ? void 0 : _resolvedBusinessMenu2.children) !== null && _resolvedBusinessMenu !== void 0 ? _resolvedBusinessMenu : [];
|
|
114
|
+
}, [resolvedBusinessMenus, displayFirstMenu]);
|
|
115
|
+
|
|
106
116
|
// 叶子 key -> 一级菜单 key 反查表(业务菜单树全量)
|
|
107
117
|
var leafToFirstKeyMap = useMemo(function () {
|
|
108
118
|
return buildLeafToFirstKeyMap(businessMenus);
|
|
@@ -138,9 +148,11 @@ export default function CompanySidebar(_ref) {
|
|
|
138
148
|
var delayHideSidebar = useCallback(function () {
|
|
139
149
|
if (hideSidebarTimerRef.current) clearTimeout(hideSidebarTimerRef.current);
|
|
140
150
|
hideSidebarTimerRef.current = setTimeout(function () {
|
|
151
|
+
// 延迟隐藏时同步清空 hoverKey,避免预览内容残留
|
|
141
152
|
setState(function (prev) {
|
|
142
153
|
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
143
|
-
secondSidebarHovered: false
|
|
154
|
+
secondSidebarHovered: false,
|
|
155
|
+
hoverKey: null
|
|
144
156
|
});
|
|
145
157
|
});
|
|
146
158
|
}, 100);
|
|
@@ -156,11 +168,15 @@ export default function CompanySidebar(_ref) {
|
|
|
156
168
|
});
|
|
157
169
|
});
|
|
158
170
|
}, [hideSidebarTimerRef]);
|
|
159
|
-
var handleBusinessMenuEnter = useCallback(function (
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
171
|
+
var handleBusinessMenuEnter = useCallback(function (menu) {
|
|
172
|
+
// hover 预切换:仅更新内部 hoverKey,不改 activeFirstMenu(不污染业务 store),定时器竞态由 cancelHideSidebar 消化
|
|
173
|
+
setState(function (prev) {
|
|
174
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
175
|
+
hoverKey: menu.key
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
cancelHideSidebar();
|
|
179
|
+
}, [cancelHideSidebar]);
|
|
164
180
|
var handleBusinessMenuLeave = useCallback(function () {
|
|
165
181
|
delayHideSidebar();
|
|
166
182
|
}, [delayHideSidebar]);
|
|
@@ -229,14 +245,16 @@ export default function CompanySidebar(_ref) {
|
|
|
229
245
|
activeKey: activeKey,
|
|
230
246
|
activeFirstMenu: activeFirstMenu,
|
|
231
247
|
visibleMenuCount: visibleMenuCount,
|
|
248
|
+
bottomExtra: bottomExtra,
|
|
232
249
|
domainPopoverOpen: state.domainPopoverOpen,
|
|
233
250
|
adminPopoverOpen: state.adminPopoverOpen,
|
|
234
251
|
onDomainPopoverOpenChange: function onDomainPopoverOpenChange(open) {
|
|
235
|
-
|
|
252
|
+
setState(function (prev) {
|
|
236
253
|
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
237
254
|
domainPopoverOpen: open
|
|
238
255
|
});
|
|
239
256
|
});
|
|
257
|
+
_onDomainPopoverOpenChange === null || _onDomainPopoverOpenChange === void 0 || _onDomainPopoverOpenChange(open);
|
|
240
258
|
},
|
|
241
259
|
onAdminPopoverOpenChange: function onAdminPopoverOpenChange(open) {
|
|
242
260
|
return setState(function (prev) {
|
|
@@ -259,11 +277,11 @@ export default function CompanySidebar(_ref) {
|
|
|
259
277
|
onThemeSettings: onThemeSettings,
|
|
260
278
|
onLogout: onLogout
|
|
261
279
|
}), /*#__PURE__*/_jsx(SecondSidebar, {
|
|
262
|
-
activeFirstMenu:
|
|
280
|
+
activeFirstMenu: displayFirstMenu,
|
|
263
281
|
activeKey: activeKey,
|
|
264
282
|
secondSidebarHovered: state.secondSidebarHovered,
|
|
265
283
|
secondSidebarFixed: secondSidebarFixed,
|
|
266
|
-
secondMenus:
|
|
284
|
+
secondMenus: displaySecondMenus,
|
|
267
285
|
favorites: state.localFavorites,
|
|
268
286
|
expandedKeys: state.localExpandedKeys,
|
|
269
287
|
emptyImage: emptyImage,
|
|
@@ -179,6 +179,16 @@
|
|
|
179
179
|
align-self: stretch;
|
|
180
180
|
z-index: 5;
|
|
181
181
|
cursor: pointer;
|
|
182
|
+
|
|
183
|
+
&:hover {
|
|
184
|
+
.avatar {
|
|
185
|
+
background: rgba(255, 255, 255, 0.25);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.name {
|
|
189
|
+
color: #fff;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
182
192
|
}
|
|
183
193
|
|
|
184
194
|
.person-info .avatar {
|
|
@@ -195,6 +205,7 @@
|
|
|
195
205
|
background: rgba(255, 255, 255, 0.15);
|
|
196
206
|
color: #fff;
|
|
197
207
|
font-size: 10px;
|
|
208
|
+
transition: background 0.2s ease;
|
|
198
209
|
}
|
|
199
210
|
|
|
200
211
|
.person-info .name {
|
|
@@ -202,6 +213,7 @@
|
|
|
202
213
|
font-weight: normal;
|
|
203
214
|
line-height: 20px;
|
|
204
215
|
color: rgba(255, 255, 255, 0.65);
|
|
216
|
+
transition: color 0.25s ease;
|
|
205
217
|
overflow: hidden;
|
|
206
218
|
text-overflow: ellipsis;
|
|
207
219
|
white-space: nowrap;
|
|
@@ -225,6 +237,10 @@
|
|
|
225
237
|
&:hover:not(.active) {
|
|
226
238
|
color: #fff;
|
|
227
239
|
background: rgba(255, 255, 255, 0.08);
|
|
240
|
+
|
|
241
|
+
.menu-label {
|
|
242
|
+
color: #fff;
|
|
243
|
+
}
|
|
228
244
|
}
|
|
229
245
|
|
|
230
246
|
&.active {
|
|
@@ -261,6 +277,10 @@
|
|
|
261
277
|
&:hover:not(.active) {
|
|
262
278
|
color: #fff;
|
|
263
279
|
background: rgba(255, 255, 255, 0.08);
|
|
280
|
+
|
|
281
|
+
.menu-label {
|
|
282
|
+
color: #fff;
|
|
283
|
+
}
|
|
264
284
|
}
|
|
265
285
|
|
|
266
286
|
&.active {
|
|
@@ -322,6 +342,14 @@
|
|
|
322
342
|
transition: all 0.2s;
|
|
323
343
|
z-index: 5;
|
|
324
344
|
|
|
345
|
+
&:hover {
|
|
346
|
+
color: #fff;
|
|
347
|
+
|
|
348
|
+
.menu-label {
|
|
349
|
+
color: #fff;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
325
353
|
.menu-icon {
|
|
326
354
|
width: 16px;
|
|
327
355
|
height: 16px;
|
|
@@ -340,6 +368,14 @@
|
|
|
340
368
|
white-space: nowrap;
|
|
341
369
|
}
|
|
342
370
|
}
|
|
371
|
+
|
|
372
|
+
.bottom-extra {
|
|
373
|
+
width: 100%;
|
|
374
|
+
min-width: 0;
|
|
375
|
+
flex-shrink: 0;
|
|
376
|
+
color: rgba(255, 255, 255, 0.65);
|
|
377
|
+
font-size: 12px;
|
|
378
|
+
}
|
|
343
379
|
}
|
|
344
380
|
|
|
345
381
|
// ========== Domain Popover ==========
|
|
@@ -44,6 +44,10 @@ export interface TreeTableTemplateProps<T = Record<string, unknown>> extends Omi
|
|
|
44
44
|
onNodeEdit?: (key: string) => void;
|
|
45
45
|
/** 树节点 hover 操作:删除按钮回调 */
|
|
46
46
|
onNodeDelete?: (key: string) => void;
|
|
47
|
+
/** 左树底部「新增」按钮回调(不传则不显示按钮) */
|
|
48
|
+
onTreeAdd?: () => void;
|
|
49
|
+
/** 左树底部新增按钮文案 */
|
|
50
|
+
treeAddText?: string;
|
|
47
51
|
/** 左树面板初始宽度(支持拖拽调节) */
|
|
48
52
|
treeWidth?: number;
|
|
49
53
|
/** 左树面板最小宽度(拖拽下限) */
|
|
@@ -1,5 +1,5 @@
|
|
|
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
|
-
var _excluded = ["title", "titleExtra", "titleActions", "viewEndpoint", "treeData", "rootNode", "treeSearchPlaceholder", "defaultSelectedKey", "onTreeSelect", "onNodeAdd", "onNodeEdit", "onNodeDelete", "treeWidth", "minTreeWidth", "maxTreeWidth", "className", "style"];
|
|
2
|
+
var _excluded = ["title", "titleExtra", "titleActions", "viewEndpoint", "treeData", "rootNode", "treeSearchPlaceholder", "defaultSelectedKey", "onTreeSelect", "onNodeAdd", "onNodeEdit", "onNodeDelete", "onTreeAdd", "treeAddText", "treeWidth", "minTreeWidth", "maxTreeWidth", "className", "style"];
|
|
3
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
4
|
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."); }
|
|
5
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; } }
|
|
@@ -18,8 +18,8 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
18
18
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
19
19
|
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; }
|
|
20
20
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
21
|
-
import { PlusOutlined, EditOutlined, DeleteOutlined } from "@ant-design/icons";
|
|
22
|
-
import { CompanyButton,
|
|
21
|
+
import { MoreOutlined, PlusOutlined, EditOutlined, DeleteOutlined } from "@ant-design/icons";
|
|
22
|
+
import { CompanyButton, CompanyDropdown, CompanyInput, CompanyTree } from "../../basic-components";
|
|
23
23
|
import { PageTitle, SvgIcon } from "../../shared-components";
|
|
24
24
|
import { StatisticsListPage } from "../StatisticsListPage";
|
|
25
25
|
import { useCompanyToken } from "../../theme/useCompanyToken";
|
|
@@ -77,6 +77,9 @@ export var TreeTableTemplate = function TreeTableTemplate(props) {
|
|
|
77
77
|
onNodeAdd = props.onNodeAdd,
|
|
78
78
|
onNodeEdit = props.onNodeEdit,
|
|
79
79
|
onNodeDelete = props.onNodeDelete,
|
|
80
|
+
onTreeAdd = props.onTreeAdd,
|
|
81
|
+
_props$treeAddText = props.treeAddText,
|
|
82
|
+
treeAddText = _props$treeAddText === void 0 ? "新增部门" : _props$treeAddText,
|
|
80
83
|
_props$treeWidth = props.treeWidth,
|
|
81
84
|
treeWidth = _props$treeWidth === void 0 ? 232 : _props$treeWidth,
|
|
82
85
|
_props$minTreeWidth = props.minTreeWidth,
|
|
@@ -260,48 +263,51 @@ export var TreeTableTemplate = function TreeTableTemplate(props) {
|
|
|
260
263
|
className: "ttt-tree-node-label",
|
|
261
264
|
title: typeof node.title === "string" ? node.title : undefined,
|
|
262
265
|
children: typeof node.title === "function" ? node.title(node) : node.title
|
|
263
|
-
}), hasNodeActions && /*#__PURE__*/
|
|
266
|
+
}), hasNodeActions && /*#__PURE__*/_jsx("span", {
|
|
264
267
|
className: "ttt-tree-node-actions",
|
|
265
268
|
onClick: function onClick(e) {
|
|
266
269
|
return e.stopPropagation();
|
|
267
270
|
},
|
|
268
|
-
children:
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
271
|
+
children: /*#__PURE__*/_jsx(CompanyDropdown, {
|
|
272
|
+
trigger: ["click"],
|
|
273
|
+
menu: {
|
|
274
|
+
items: [].concat(_toConsumableArray(onNodeAdd ? [{
|
|
275
|
+
key: "add",
|
|
276
|
+
icon: /*#__PURE__*/_jsx(PlusOutlined, {}),
|
|
277
|
+
label: "新增"
|
|
278
|
+
}] : []), _toConsumableArray(onNodeEdit ? [{
|
|
279
|
+
key: "edit",
|
|
280
|
+
icon: /*#__PURE__*/_jsx(EditOutlined, {}),
|
|
281
|
+
label: "编辑"
|
|
282
|
+
}] : []), _toConsumableArray(onNodeDelete ? [{
|
|
283
|
+
key: "delete",
|
|
284
|
+
icon: /*#__PURE__*/_jsx(DeleteOutlined, {}),
|
|
285
|
+
label: "删除"
|
|
286
|
+
}] : [])),
|
|
287
|
+
onClick: function onClick(_ref) {
|
|
288
|
+
var key = _ref.key;
|
|
289
|
+
if (key === "add") onNodeAdd === null || onNodeAdd === void 0 || onNodeAdd(String(node.key));else if (key === "edit") onNodeEdit === null || onNodeEdit === void 0 || onNodeEdit(String(node.key));else if (key === "delete") onNodeDelete === null || onNodeDelete === void 0 || onNodeDelete(String(node.key));
|
|
277
290
|
}
|
|
278
|
-
}
|
|
279
|
-
}), onNodeEdit && /*#__PURE__*/_jsx(CompanyTooltip, {
|
|
280
|
-
title: "\u7F16\u8F91",
|
|
281
|
-
children: /*#__PURE__*/_jsx(CompanyButton, {
|
|
282
|
-
type: "text",
|
|
283
|
-
size: "small",
|
|
284
|
-
className: "ttt-tree-action-btn",
|
|
285
|
-
icon: /*#__PURE__*/_jsx(EditOutlined, {}),
|
|
286
|
-
onClick: function onClick() {
|
|
287
|
-
return onNodeEdit(String(node.key));
|
|
288
|
-
}
|
|
289
|
-
})
|
|
290
|
-
}), onNodeDelete && /*#__PURE__*/_jsx(CompanyTooltip, {
|
|
291
|
-
title: "\u5220\u9664",
|
|
291
|
+
},
|
|
292
292
|
children: /*#__PURE__*/_jsx(CompanyButton, {
|
|
293
293
|
type: "text",
|
|
294
294
|
size: "small",
|
|
295
295
|
className: "ttt-tree-action-btn",
|
|
296
|
-
icon: /*#__PURE__*/_jsx(
|
|
297
|
-
onClick: function onClick() {
|
|
298
|
-
return
|
|
296
|
+
icon: /*#__PURE__*/_jsx(MoreOutlined, {}),
|
|
297
|
+
onClick: function onClick(e) {
|
|
298
|
+
return e.stopPropagation();
|
|
299
299
|
}
|
|
300
300
|
})
|
|
301
|
-
})
|
|
301
|
+
})
|
|
302
302
|
})]
|
|
303
303
|
});
|
|
304
304
|
}
|
|
305
|
+
}), onTreeAdd && /*#__PURE__*/_jsx(CompanyButton, {
|
|
306
|
+
block: true,
|
|
307
|
+
className: "ttt-tree-add-btn",
|
|
308
|
+
icon: /*#__PURE__*/_jsx(PlusOutlined, {}),
|
|
309
|
+
onClick: onTreeAdd,
|
|
310
|
+
children: treeAddText
|
|
305
311
|
})]
|
|
306
312
|
}), /*#__PURE__*/_jsx(StatisticsListPage, _objectSpread(_objectSpread({}, listProps), {}, {
|
|
307
313
|
viewEndpoint: viewEndpoint,
|
|
@@ -90,8 +90,9 @@
|
|
|
90
90
|
overflow: hidden;
|
|
91
91
|
text-overflow: ellipsis;
|
|
92
92
|
white-space: nowrap;
|
|
93
|
-
margin-left:
|
|
94
|
-
padding:
|
|
93
|
+
margin-left: 9px;
|
|
94
|
+
padding-left: 4px;
|
|
95
|
+
padding-right: 0;
|
|
95
96
|
line-height: 28px;
|
|
96
97
|
border-radius: 6px;
|
|
97
98
|
transition: all var(--motion-duration-fast, 0.2s)
|
|
@@ -107,7 +108,7 @@
|
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
110
|
|
|
110
|
-
// 树节点:hover
|
|
111
|
+
// 树节点:hover 时在右侧显示「更多」操作按钮(点击弹出新增 / 编辑 / 删除下拉菜单)
|
|
111
112
|
.ttt-tree-node {
|
|
112
113
|
display: flex;
|
|
113
114
|
align-items: center;
|
|
@@ -126,19 +127,38 @@
|
|
|
126
127
|
display: none;
|
|
127
128
|
align-items: center;
|
|
128
129
|
flex-shrink: 0;
|
|
129
|
-
margin-right:
|
|
130
|
+
margin-right: 0;
|
|
130
131
|
|
|
131
132
|
.ttt-tree-action-btn {
|
|
132
|
-
//
|
|
133
|
+
// 压缩按钮内边距,避免挤占节点标题空间
|
|
133
134
|
padding-inline: 2px;
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
138
|
|
|
139
|
+
// 树节点内容容器:左内边距 8px → 4px(收紧文字与箭头间距),右内边距归零(选中背景/内容区贴齐右侧)
|
|
140
|
+
.ttt-tree-panel .ant-tree-node-content-wrapper {
|
|
141
|
+
padding-inline: 4px 0;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// 树展开/收起箭头(open/close/noop 状态统一):去掉 antd 默认 6px 右外边距,箭头与节点内容贴紧
|
|
145
|
+
.ttt-tree-panel .ant-tree-switcher {
|
|
146
|
+
margin-inline-end: 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
138
149
|
.ttt-tree-panel .ant-tree-node-content-wrapper:hover .ttt-tree-node-actions {
|
|
139
150
|
display: inline-flex;
|
|
140
151
|
}
|
|
141
152
|
|
|
153
|
+
// 左树底部「新增」按钮:树内容不超一屏时跟随内容,超一屏时吸底(sticky 原生行为,无需 JS 判断)
|
|
154
|
+
.ttt-tree-add-btn {
|
|
155
|
+
position: sticky;
|
|
156
|
+
bottom: 0;
|
|
157
|
+
z-index: 1;
|
|
158
|
+
margin-top: calc(var(--spacing-xs, 8) * 1px);
|
|
159
|
+
background: var(--color-bg-container);
|
|
160
|
+
}
|
|
161
|
+
|
|
142
162
|
// 右侧列表:复用 StatisticsListPage,隐藏其内置标题栏(页面标题由模板统一渲染)
|
|
143
163
|
.ttt-body > .statistics-list-page {
|
|
144
164
|
flex: 1;
|