@gx-design-vue/pro-layout-components 0.1.0-alpha.1 → 0.1.0-alpha.2
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/RightContent/Search/Panel.d.ts +16 -39
- package/dist/RightContent/Search/Panel.js +138 -134
- package/dist/RightContent/Search/index.d.ts +11 -47
- package/dist/RightContent/Search/index.js +117 -103
- package/dist/RightContent/Search/style.d.ts +4 -7
- package/dist/RightContent/Search/style.js +34 -30
- package/dist/RightContent/index.d.ts +4 -403
- package/dist/RightContent/index.js +162 -146
- package/dist/RightContent/interface.d.ts +84 -0
- package/dist/RightContent/interface.js +1 -0
- package/dist/RightContent/locale.d.ts +6 -0
- package/dist/RightContent/locale.js +18 -0
- package/dist/RightContent/style.d.ts +4 -7
- package/dist/RightContent/style.js +66 -65
- package/dist/RightContent/themeOptions.d.ts +6 -0
- package/dist/RightContent/themeOptions.js +34 -0
- package/dist/RightContent/utils.d.ts +24 -0
- package/dist/RightContent/utils.js +66 -0
- package/dist/index.d.ts +3 -7
- package/dist/index.js +2 -5
- package/dist/pro-layout-components.esm.js +897 -5867
- package/dist/pro-layout-components.js +1 -5
- package/dist/theme/augment.d.ts +10 -0
- package/dist/theme/augment.js +1 -0
- package/dist/theme/interface/components.d.ts +10 -0
- package/dist/theme/interface/components.js +1 -0
- package/global.d.ts +0 -1
- package/package.json +15 -17
- package/dist/AppsLogoComponents/AppLogoList.d.ts +0 -24
- package/dist/AppsLogoComponents/AppLogoList.js +0 -43
- package/dist/AppsLogoComponents/AppsLogo.d.ts +0 -10
- package/dist/AppsLogoComponents/AppsLogo.js +0 -12
- package/dist/AppsLogoComponents/DefaultContent.d.ts +0 -27
- package/dist/AppsLogoComponents/DefaultContent.js +0 -43
- package/dist/AppsLogoComponents/SimpleContent.d.ts +0 -36
- package/dist/AppsLogoComponents/SimpleContent.js +0 -63
- package/dist/AppsLogoComponents/index.d.ts +0 -32
- package/dist/AppsLogoComponents/index.js +0 -71
- package/dist/AppsLogoComponents/props.d.ts +0 -26
- package/dist/AppsLogoComponents/props.js +0 -12
- package/dist/AppsLogoComponents/style/default.d.ts +0 -6
- package/dist/AppsLogoComponents/style/default.js +0 -70
- package/dist/AppsLogoComponents/style/index.d.ts +0 -7
- package/dist/AppsLogoComponents/style/index.js +0 -60
- package/dist/AppsLogoComponents/style/simple.d.ts +0 -6
- package/dist/AppsLogoComponents/style/simple.js +0 -83
- package/dist/Icon/components/Paintbrush.d.ts +0 -6
- package/dist/Icon/components/Paintbrush.js +0 -21
- package/dist/Icon/components/Palette.d.ts +0 -6
- package/dist/Icon/components/Palette.js +0 -20
- package/dist/Icon/components/index.d.ts +0 -10
- package/dist/Icon/components/index.js +0 -11
- package/dist/Icon/index.d.ts +0 -37
- package/dist/Icon/index.js +0 -24
- package/dist/PageLock/Popup.d.ts +0 -43
- package/dist/PageLock/Popup.js +0 -68
- package/dist/PageLock/UserForm.d.ts +0 -42
- package/dist/PageLock/UserForm.js +0 -68
- package/dist/PageLock/index.d.ts +0 -52
- package/dist/PageLock/index.js +0 -92
- package/dist/PageLock/props.d.ts +0 -51
- package/dist/PageLock/props.js +0 -29
- package/dist/PageLock/style.d.ts +0 -7
- package/dist/PageLock/style.js +0 -108
- package/dist/PageLock/useFormState.d.ts +0 -16
- package/dist/PageLock/useFormState.js +0 -19
- package/dist/Paintbrush-EfUpNqey.js +0 -14
- package/dist/Palette-B5wq9KtV.js +0 -13
- package/dist/RightContent/Search/props.d.ts +0 -17
- package/dist/RightContent/Search/props.js +0 -15
- package/dist/RightContent/props.d.ts +0 -64
- package/dist/RightContent/props.js +0 -63
- package/dist/ThemeEditor/components/BlockCheckbox.d.ts +0 -39
- package/dist/ThemeEditor/components/BlockCheckbox.js +0 -42
- package/dist/ThemeEditor/components/RegionalChange.d.ts +0 -21
- package/dist/ThemeEditor/components/RegionalChange.js +0 -43
- package/dist/ThemeEditor/components/Setting/index.d.ts +0 -52
- package/dist/ThemeEditor/components/Setting/index.js +0 -125
- package/dist/ThemeEditor/components/SwitchTab/index.d.ts +0 -51
- package/dist/ThemeEditor/components/SwitchTab/index.js +0 -52
- package/dist/ThemeEditor/components/SwitchTab/style.d.ts +0 -6
- package/dist/ThemeEditor/components/SwitchTab/style.js +0 -54
- package/dist/ThemeEditor/components/Tokens/Colors/ColorSvg.d.ts +0 -7
- package/dist/ThemeEditor/components/Tokens/Colors/ColorSvg.js +0 -453
- package/dist/ThemeEditor/components/Tokens/Colors/Primary.d.ts +0 -7
- package/dist/ThemeEditor/components/Tokens/Colors/Primary.js +0 -58
- package/dist/ThemeEditor/components/Tokens/Colors/Side.d.ts +0 -7
- package/dist/ThemeEditor/components/Tokens/Colors/Side.js +0 -18
- package/dist/ThemeEditor/components/Tokens/Colors/index.d.ts +0 -7
- package/dist/ThemeEditor/components/Tokens/Colors/index.js +0 -15
- package/dist/ThemeEditor/components/Tokens/context.d.ts +0 -9
- package/dist/ThemeEditor/components/Tokens/context.js +0 -7
- package/dist/ThemeEditor/components/Tokens/index.d.ts +0 -45
- package/dist/ThemeEditor/components/Tokens/index.js +0 -69
- package/dist/ThemeEditor/components/Tokens/utils/config.d.ts +0 -10
- package/dist/ThemeEditor/components/Tokens/utils/config.js +0 -8
- package/dist/ThemeEditor/components/Trigger.d.ts +0 -21
- package/dist/ThemeEditor/components/Trigger.js +0 -46
- package/dist/ThemeEditor/context.d.ts +0 -14
- package/dist/ThemeEditor/context.js +0 -7
- package/dist/ThemeEditor/index.d.ts +0 -841
- package/dist/ThemeEditor/index.js +0 -165
- package/dist/ThemeEditor/props.d.ts +0 -57
- package/dist/ThemeEditor/props.js +0 -40
- package/dist/ThemeEditor/style/animate.d.ts +0 -9
- package/dist/ThemeEditor/style/animate.js +0 -38
- package/dist/ThemeEditor/style/index.d.ts +0 -10
- package/dist/ThemeEditor/style/index.js +0 -318
- package/dist/ThemeEditor/style/theme.d.ts +0 -6
- package/dist/ThemeEditor/style/theme.js +0 -71
- package/dist/ThemeEditor/utils/config.d.ts +0 -37
- package/dist/ThemeEditor/utils/config.js +0 -132
- package/dist/ThemeEditor/utils/index.d.ts +0 -9
- package/dist/ThemeEditor/utils/index.js +0 -64
- package/dist/hooks/useClockTime/index.d.ts +0 -11
- package/dist/hooks/useClockTime/index.js +0 -28
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +0 -3
- package/dist/utils/util.d.ts +0 -10
- package/dist/utils/util.js +0 -17
|
@@ -1,152 +1,168 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import ResizeObserver from "ant-design-vue/es/vc-resize-observer";
|
|
16
|
-
|
|
1
|
+
import { defaultLocale } from "./locale.js";
|
|
2
|
+
import GSearchInput from "./Search/index.js";
|
|
3
|
+
import style_default from "./style.js";
|
|
4
|
+
import { defaultThemeOptions } from "./themeOptions.js";
|
|
5
|
+
import { Fragment, computed, createVNode, defineComponent, mergeProps, ref, watch } from "vue";
|
|
6
|
+
import { CompressOutlined, ExpandOutlined, LockOutlined, LogoutOutlined, SettingOutlined, UserOutlined } from "@antdv-next/icons";
|
|
7
|
+
import { useThemeContext } from "@gx-design-vue/context";
|
|
8
|
+
import { GIcon } from "@gx-design-vue/icon";
|
|
9
|
+
import { useInjectLayoutContext } from "@gx-design-vue/pro-layout";
|
|
10
|
+
import { classNames } from "@gx-design-vue/pro-utils";
|
|
11
|
+
import { useElementSize, useFullscreen } from "@vueuse/core";
|
|
12
|
+
import { Avatar, Dropdown } from "antdv-next";
|
|
13
|
+
import { useBaseConfig } from "antdv-next/config-provider/context";
|
|
14
|
+
import useCSSVarCls from "antdv-next/config-provider/hooks/useCSSVarCls";
|
|
17
15
|
//#region src/RightContent/index.tsx
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
lock: true,
|
|
49
|
-
theme: true,
|
|
50
|
-
search: true,
|
|
51
|
-
themeEditor: true,
|
|
52
|
-
fullScreen: true,
|
|
53
|
-
...props.actions
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
/** 减少一下渲染的次数 */
|
|
57
|
-
const setRightSizeDebounceFn = useDebounceFn(async (width) => {
|
|
58
|
-
setRightSize(width);
|
|
59
|
-
}, 160);
|
|
60
|
-
const changeTheme = (value) => {
|
|
61
|
-
const themeValue = value === "system" ? system.value : value;
|
|
62
|
-
if (toggleEl.value) toggleAnimateTheme(toggleEl.value, {
|
|
63
|
-
isDark: themeValue === "dark",
|
|
64
|
-
setTheme: () => setTheme(value)
|
|
65
|
-
});
|
|
16
|
+
const RightContent = /* @__PURE__ */ defineComponent((props, { emit, slots }) => {
|
|
17
|
+
const { isFullscreen, toggle: toggleFullscreen } = useFullscreen();
|
|
18
|
+
const layoutContext = useInjectLayoutContext();
|
|
19
|
+
const { setTheme, isDark, theme } = useThemeContext();
|
|
20
|
+
const { prefixCls } = useBaseConfig("pro-right-content");
|
|
21
|
+
const rootCls = useCSSVarCls(prefixCls);
|
|
22
|
+
const [hashId, cssVarCls] = style_default(prefixCls, rootCls);
|
|
23
|
+
const isMobile = computed(() => layoutContext?.isMobile.value ?? false);
|
|
24
|
+
const containerRef = ref();
|
|
25
|
+
const { width: containerWidth } = useElementSize(containerRef);
|
|
26
|
+
const minWidth = ref("auto");
|
|
27
|
+
const themeActionRef = ref();
|
|
28
|
+
watch(containerWidth, (newWidth) => {
|
|
29
|
+
minWidth.value = newWidth > 0 ? newWidth : "auto";
|
|
30
|
+
});
|
|
31
|
+
const lockOpen = ref(false);
|
|
32
|
+
const mergedLocale = computed(() => ({
|
|
33
|
+
...defaultLocale,
|
|
34
|
+
...props.locale
|
|
35
|
+
}));
|
|
36
|
+
const actions = computed(() => {
|
|
37
|
+
if (props.actions === false) return {};
|
|
38
|
+
return {
|
|
39
|
+
lock: true,
|
|
40
|
+
theme: true,
|
|
41
|
+
search: true,
|
|
42
|
+
themeEditor: true,
|
|
43
|
+
fullScreen: true,
|
|
44
|
+
...props.actions
|
|
66
45
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
key: "actionsRender"
|
|
46
|
+
});
|
|
47
|
+
const themeMenuItems = computed(() => {
|
|
48
|
+
return (props.themeOptions || defaultThemeOptions).map((item) => ({
|
|
49
|
+
key: item.value,
|
|
50
|
+
label: item.label()
|
|
51
|
+
}));
|
|
52
|
+
});
|
|
53
|
+
function handleThemeMenuClick(info) {
|
|
54
|
+
const value = info.key;
|
|
55
|
+
setTheme(value);
|
|
56
|
+
}
|
|
57
|
+
const userMenuItems = computed(() => {
|
|
58
|
+
const items = [];
|
|
59
|
+
if (actions.value.lock && slots.lock) {
|
|
60
|
+
items.push({
|
|
61
|
+
key: "lock",
|
|
62
|
+
icon: () => createVNode(LockOutlined, null, null),
|
|
63
|
+
label: mergedLocale.value.lockScreen
|
|
86
64
|
});
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
"disabledShortKey": props.shortsKey?.disabled,
|
|
103
|
-
"emptyProps": props.emptyProps
|
|
104
|
-
}, null),
|
|
105
|
-
actions.value.theme && createVNode("div", {
|
|
106
|
-
"ref": toggleEl,
|
|
107
|
-
"class": `${prefixCls}-header-actions-item ${prefixCls}-header-actions-theme ${hashId.value}`.trim()
|
|
108
|
-
}, [createVNode(Dropdown, {
|
|
109
|
-
"trigger": ["click"],
|
|
110
|
-
"placement": "bottomRight",
|
|
111
|
-
"overlay": createVNode(Menu, { "selectedKeys": [theme.value] }, _isSlot(_slot2 = systemTheme.map((item) => {
|
|
112
|
-
let _slot;
|
|
113
|
-
return createVNode(Menu.Item, {
|
|
114
|
-
"key": item.value,
|
|
115
|
-
"onClick": () => changeTheme(item.value)
|
|
116
|
-
}, _isSlot(_slot = item.label()) ? _slot : { default: () => [_slot] });
|
|
117
|
-
})) ? _slot2 : { default: () => [_slot2] })
|
|
118
|
-
}, { default: () => [createVNode(Icon_default, {
|
|
119
|
-
"class": `${prefixCls}-header-actions-icon ${hashId.value}`.trim(),
|
|
120
|
-
"type": isDark.value ? "moon" : "sunny"
|
|
121
|
-
}, null)] })]),
|
|
122
|
-
actions.value.themeEditor && !isMobile.value && createVNode("div", { "class": `${prefixCls}-header-actions-item ${hashId.value}`.trim() }, [createVNode(SettingOutlined, { "onClick": () => onClick("themeEditor") }, null)]),
|
|
123
|
-
actions.value.fullScreen && !isMobile.value && createVNode("div", { "class": `${prefixCls}-header-actions-item ${hashId.value}`.trim() }, [createVNode(FullScreenIcon, { "onClick": () => toggle() }, null)]),
|
|
124
|
-
actionsRender ? actionsRender?.([`${prefixCls}-header-actions-item`, hashId.value]) : null
|
|
125
|
-
]), createVNode(Dropdown, mergeProps({ "placement": "bottomRight" }, props.dropdownProps, { "overlay": slotsProps.dropdownMenuRender || createVNode(Menu, null, { default: () => [
|
|
126
|
-
slotsProps.dropdownMenuExtraItemRender,
|
|
127
|
-
actions.value.lock && createVNode(Fragment, null, [createVNode(MenuItem, {
|
|
128
|
-
"key": "lock",
|
|
129
|
-
"icon": createVNode(LockOutlined, null, null),
|
|
130
|
-
"onClick": () => openLock(true)
|
|
131
|
-
}, { default: () => [createTextVNode("锁定屏幕")] }), createVNode(Menu.Divider, null, null)]),
|
|
132
|
-
createVNode(MenuItem, {
|
|
133
|
-
"key": "logout",
|
|
134
|
-
"icon": createVNode(LogoutOutlined, null, null),
|
|
135
|
-
"onClick": () => props.onLogout?.()
|
|
136
|
-
}, { default: () => [createTextVNode("退出登录")] })
|
|
137
|
-
] }) }), { default: () => [slotsProps.dropdownRender || createVNode("div", { "class": `${prefixCls}-header-actions-avatar ${hashId.value}`.trim() }, [createVNode(Avatar, {
|
|
138
|
-
"size": 28,
|
|
139
|
-
"icon": createVNode(UserOutlined, null, null),
|
|
140
|
-
"src": props.avatar
|
|
141
|
-
}, null), props.name && createVNode("span", { "class": `${prefixCls}-header-actions-name ${hashId.value}`.trim() }, [props.name])])] })])] })]), createVNode(PageLock_default, {
|
|
142
|
-
"open": lock.value,
|
|
143
|
-
"name": props.name,
|
|
144
|
-
"onOpenChange": (val) => openLock(val)
|
|
145
|
-
}, null)]));
|
|
146
|
-
};
|
|
65
|
+
items.push({ type: "divider" });
|
|
66
|
+
}
|
|
67
|
+
items.push({
|
|
68
|
+
key: "logout",
|
|
69
|
+
icon: () => createVNode(LogoutOutlined, null, null),
|
|
70
|
+
label: mergedLocale.value.logout
|
|
71
|
+
});
|
|
72
|
+
return items;
|
|
73
|
+
});
|
|
74
|
+
function handleUserMenuClick(info) {
|
|
75
|
+
if (info.key === "lock") lockOpen.value = true;
|
|
76
|
+
else if (info.key === "logout") emit("logout");
|
|
77
|
+
}
|
|
78
|
+
function handleActionClick(type) {
|
|
79
|
+
emit("actionClick", type);
|
|
147
80
|
}
|
|
81
|
+
function handleLockOpenChange(val) {
|
|
82
|
+
lockOpen.value = val;
|
|
83
|
+
}
|
|
84
|
+
return () => {
|
|
85
|
+
const actionClassNames = [`${prefixCls.value}-header-actions-item`, hashId.value];
|
|
86
|
+
const FullScreenIcon = isFullscreen.value ? CompressOutlined : ExpandOutlined;
|
|
87
|
+
return createVNode("div", {
|
|
88
|
+
"ref": containerRef,
|
|
89
|
+
"class": classNames(prefixCls.value, hashId.value, cssVarCls.value, rootCls.value),
|
|
90
|
+
"style": {
|
|
91
|
+
minWidth: minWidth.value,
|
|
92
|
+
height: "100%"
|
|
93
|
+
}
|
|
94
|
+
}, [createVNode("div", { "style": { height: "100%" } }, [createVNode("div", { "class": classNames(`${prefixCls.value}-header-actions`, hashId.value) }, [slots.default ? slots.default() : createVNode(Fragment, null, [
|
|
95
|
+
actions.value.search && !isMobile.value && createVNode(GSearchInput, {
|
|
96
|
+
"dataSource": props.searchConfig?.dataSource,
|
|
97
|
+
"disabledShortKey": props.searchConfig?.disabledShortKey,
|
|
98
|
+
"searchHistoryKey": props.searchConfig?.historyKey,
|
|
99
|
+
"emptyProps": props.searchConfig?.emptyProps,
|
|
100
|
+
"locale": mergedLocale.value
|
|
101
|
+
}, null),
|
|
102
|
+
actions.value.theme && createVNode("div", {
|
|
103
|
+
"ref": themeActionRef,
|
|
104
|
+
"class": classNames(`${prefixCls.value}-header-actions-item`, `${prefixCls.value}-header-actions-theme`, hashId.value)
|
|
105
|
+
}, [createVNode(Dropdown, {
|
|
106
|
+
"trigger": ["click"],
|
|
107
|
+
"placement": "bottomRight",
|
|
108
|
+
"menu": {
|
|
109
|
+
items: themeMenuItems.value,
|
|
110
|
+
onClick: handleThemeMenuClick,
|
|
111
|
+
selectedKeys: [theme.value]
|
|
112
|
+
}
|
|
113
|
+
}, { default: () => [createVNode(GIcon, {
|
|
114
|
+
"class": classNames(`${prefixCls.value}-header-actions-icon`, hashId.value),
|
|
115
|
+
"type": isDark.value ? "Moon" : "Sunny"
|
|
116
|
+
}, null)] })]),
|
|
117
|
+
actions.value.themeEditor && !isMobile.value && createVNode("div", { "class": classNames(actionClassNames) }, [createVNode(SettingOutlined, { "onClick": () => handleActionClick("themeEditor") }, null)]),
|
|
118
|
+
actions.value.fullScreen && !isMobile.value && createVNode("div", { "class": classNames(actionClassNames) }, [createVNode(FullScreenIcon, { "onClick": () => toggleFullscreen() }, null)]),
|
|
119
|
+
slots.actionsRender?.(actionClassNames)
|
|
120
|
+
]), createVNode(Dropdown, mergeProps({ "placement": "bottomRight" }, props.dropdownProps, { "menu": slots.dropdownMenu ? void 0 : {
|
|
121
|
+
items: userMenuItems.value,
|
|
122
|
+
onClick: handleUserMenuClick
|
|
123
|
+
} }), { default: () => [slots.dropdownTrigger ? slots.dropdownTrigger() : createVNode("div", { "class": classNames(`${prefixCls.value}-header-actions-avatar`, hashId.value) }, [createVNode(Avatar, {
|
|
124
|
+
"size": 28,
|
|
125
|
+
"icon": createVNode(UserOutlined, null, null)
|
|
126
|
+
}, null), props.name && createVNode("span", { "class": classNames(`${prefixCls.value}-header-actions-name`, hashId.value) }, [props.name])])] })])]), slots.lock?.({
|
|
127
|
+
open: lockOpen.value,
|
|
128
|
+
onOpenChange: handleLockOpenChange
|
|
129
|
+
})]);
|
|
130
|
+
};
|
|
131
|
+
}, {
|
|
132
|
+
props: {
|
|
133
|
+
actions: {
|
|
134
|
+
type: [Object, Boolean],
|
|
135
|
+
required: false,
|
|
136
|
+
default: void 0
|
|
137
|
+
},
|
|
138
|
+
name: {
|
|
139
|
+
type: String,
|
|
140
|
+
required: false
|
|
141
|
+
},
|
|
142
|
+
avatar: {
|
|
143
|
+
type: String,
|
|
144
|
+
required: false
|
|
145
|
+
},
|
|
146
|
+
dropdownProps: {
|
|
147
|
+
type: Object,
|
|
148
|
+
required: false
|
|
149
|
+
},
|
|
150
|
+
themeOptions: {
|
|
151
|
+
type: Array,
|
|
152
|
+
required: false
|
|
153
|
+
},
|
|
154
|
+
searchConfig: {
|
|
155
|
+
type: Object,
|
|
156
|
+
required: false
|
|
157
|
+
},
|
|
158
|
+
locale: {
|
|
159
|
+
type: Object,
|
|
160
|
+
required: false
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
emits: ["logout", "actionClick"],
|
|
164
|
+
name: "RightContent",
|
|
165
|
+
inheritAttrs: false
|
|
148
166
|
});
|
|
149
|
-
var RightContent_default = GlobalRightContent;
|
|
150
|
-
|
|
151
167
|
//#endregion
|
|
152
|
-
export {
|
|
168
|
+
export { RightContent as default };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { VNodeChild } from "vue";
|
|
2
|
+
import { ThemeValue } from "@gx-design-vue/context";
|
|
3
|
+
import { LayoutMenuRoute } from "@gx-design-vue/pro-layout";
|
|
4
|
+
|
|
5
|
+
//#region src/RightContent/interface.d.ts
|
|
6
|
+
interface RightContentEmits {
|
|
7
|
+
'logout': () => void;
|
|
8
|
+
'actionClick': (type: string) => void;
|
|
9
|
+
}
|
|
10
|
+
interface RightContentEmitsProps {
|
|
11
|
+
onLogout?: RightContentEmits['logout'];
|
|
12
|
+
onActionClick?: RightContentEmits['actionClick'];
|
|
13
|
+
}
|
|
14
|
+
interface RightContentActionsConfig {
|
|
15
|
+
search?: boolean;
|
|
16
|
+
theme?: boolean;
|
|
17
|
+
themeEditor?: boolean;
|
|
18
|
+
fullScreen?: boolean;
|
|
19
|
+
lock?: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface RightContentThemeOption {
|
|
22
|
+
value: ThemeValue;
|
|
23
|
+
label: () => VNodeChild;
|
|
24
|
+
}
|
|
25
|
+
interface RightContentLocale {
|
|
26
|
+
searchPlaceholder?: string;
|
|
27
|
+
searchLabel?: string;
|
|
28
|
+
searchShortcutLabel?: string;
|
|
29
|
+
lockScreen?: string;
|
|
30
|
+
logout?: string;
|
|
31
|
+
noResult?: (keyword: string) => string;
|
|
32
|
+
noHistory?: string;
|
|
33
|
+
searchHistory?: string;
|
|
34
|
+
selectLabel?: string;
|
|
35
|
+
navigateLabel?: string;
|
|
36
|
+
lightTheme?: string;
|
|
37
|
+
darkTheme?: string;
|
|
38
|
+
autoTheme?: string;
|
|
39
|
+
}
|
|
40
|
+
interface SearchConfig {
|
|
41
|
+
/** 禁用键盘快捷键 (Cmd+K / Ctrl+K) */
|
|
42
|
+
disabledShortKey?: boolean;
|
|
43
|
+
/** 自定义搜索数据源;为空时使用 layout 菜单上下文 */
|
|
44
|
+
dataSource?: LayoutMenuRoute[];
|
|
45
|
+
/** localStorage key,用于持久化搜索历史 */
|
|
46
|
+
historyKey?: string;
|
|
47
|
+
/** 空状态 props */
|
|
48
|
+
emptyProps?: Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
interface RightContentProps extends RightContentEmitsProps {
|
|
51
|
+
/** 内置动作开关;传 false 关闭全部 */
|
|
52
|
+
actions?: RightContentActionsConfig | false;
|
|
53
|
+
/** 用户名 */
|
|
54
|
+
name?: string;
|
|
55
|
+
/** 用户头像 URL */
|
|
56
|
+
avatar?: string;
|
|
57
|
+
/** 透传给 antdv-next Dropdown 的额外 props */
|
|
58
|
+
dropdownProps?: Record<string, unknown>;
|
|
59
|
+
/** 自定义主题选项(覆盖默认的 亮色/深色/自动) */
|
|
60
|
+
themeOptions?: RightContentThemeOption[];
|
|
61
|
+
/** 搜索配置 */
|
|
62
|
+
searchConfig?: SearchConfig;
|
|
63
|
+
/** 国际化文本 */
|
|
64
|
+
locale?: RightContentLocale;
|
|
65
|
+
}
|
|
66
|
+
interface RightContentSlots {
|
|
67
|
+
/** 替换整个 actions 区域 */
|
|
68
|
+
default?: () => VNodeChild;
|
|
69
|
+
/** 额外 action 项(在 avatar dropdown 前) */
|
|
70
|
+
actionsRender?: (classNames: string[]) => VNodeChild;
|
|
71
|
+
/** 替换 avatar 触发器 */
|
|
72
|
+
dropdownTrigger?: () => VNodeChild;
|
|
73
|
+
/** 替换 dropdown 菜单内容 */
|
|
74
|
+
dropdownMenu?: () => VNodeChild;
|
|
75
|
+
/** dropdown 菜单顶部额外项 */
|
|
76
|
+
dropdownMenuExtra?: () => VNodeChild;
|
|
77
|
+
/** 锁屏内容(解耦 PageLock) */
|
|
78
|
+
lock?: (props: {
|
|
79
|
+
open: boolean;
|
|
80
|
+
onOpenChange: (val: boolean) => void;
|
|
81
|
+
}) => VNodeChild;
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { RightContentActionsConfig, RightContentEmits, RightContentEmitsProps, RightContentLocale, RightContentProps, RightContentSlots, RightContentThemeOption, SearchConfig };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/RightContent/locale.ts
|
|
2
|
+
const defaultLocale = {
|
|
3
|
+
searchPlaceholder: "搜索导航菜单",
|
|
4
|
+
searchLabel: "搜索",
|
|
5
|
+
searchShortcutLabel: "⌘ K",
|
|
6
|
+
lockScreen: "锁定屏幕",
|
|
7
|
+
logout: "退出登录",
|
|
8
|
+
noResult: (keyword) => `未找到搜索结果 "${keyword}"`,
|
|
9
|
+
noHistory: "没有搜索历史",
|
|
10
|
+
searchHistory: "搜索历史",
|
|
11
|
+
selectLabel: "选择",
|
|
12
|
+
navigateLabel: "导航",
|
|
13
|
+
lightTheme: "亮色",
|
|
14
|
+
darkTheme: "深色",
|
|
15
|
+
autoTheme: "自动"
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { defaultLocale };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as ant_design_vue_es__util_type22 from "ant-design-vue/es/_util/type";
|
|
1
|
+
import * as _$vue from "vue";
|
|
3
2
|
|
|
4
3
|
//#region src/RightContent/style.d.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
hashId: vue236.ComputedRef<string>;
|
|
8
|
-
};
|
|
4
|
+
type ComponentToken = Record<string, any>;
|
|
5
|
+
declare const _default: (prefixCls: _$vue.Ref<string>, rootCls?: _$vue.Ref<string | undefined>) => readonly [_$vue.Ref<string, string>, _$vue.ComputedRef<string | undefined>];
|
|
9
6
|
//#endregion
|
|
10
|
-
export {
|
|
7
|
+
export { ComponentToken, _default as default };
|
|
@@ -1,73 +1,74 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { proGenStyleHooks } from "@gx-design-vue/pro-provider";
|
|
3
2
|
//#region src/RightContent/style.ts
|
|
4
|
-
|
|
5
|
-
return
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
function withAlpha(color, alpha) {
|
|
4
|
+
return `color-mix(in srgb, ${color} ${alpha * 100}%, transparent)`;
|
|
5
|
+
}
|
|
6
|
+
const genRightContentStyle = (token) => {
|
|
7
|
+
return { [token.componentCls]: {
|
|
9
8
|
height: "100%",
|
|
10
|
-
|
|
11
|
-
"&-item": {
|
|
12
|
-
display: "inline-flex",
|
|
13
|
-
alignItems: "center",
|
|
14
|
-
justifyContent: "center",
|
|
15
|
-
paddingBlock: 0,
|
|
16
|
-
paddingInline: 2,
|
|
17
|
-
color: token.layout?.header?.colorTextRightActionsItem,
|
|
18
|
-
fontSize: 14,
|
|
19
|
-
cursor: "pointer",
|
|
20
|
-
borderRadius: token.borderRadius,
|
|
21
|
-
[`.anticon`]: {
|
|
22
|
-
color: token.layout?.header?.colorTextRightActionsItem,
|
|
23
|
-
transition: `color ${token.motionDurationMid}, background-color ${token.motionDurationMid}`,
|
|
24
|
-
"&:hover": { color: token.layout?.header?.colorTextRightActionsItemHover }
|
|
25
|
-
},
|
|
26
|
-
[`&${token.componentCls}-header-actions-theme`]: { [`${token.componentCls}-header-actions-icon`]: {
|
|
27
|
-
paddingInline: 4,
|
|
28
|
-
paddingBlock: 4,
|
|
29
|
-
fontSize: 18
|
|
30
|
-
} },
|
|
31
|
-
"> *": {
|
|
32
|
-
paddingInline: 6,
|
|
33
|
-
paddingBlock: 6,
|
|
34
|
-
borderRadius: token.borderRadius,
|
|
35
|
-
transition: `color ${token.motionDurationMid}, background-color ${token.motionDurationMid}`,
|
|
36
|
-
"&:hover": {
|
|
37
|
-
color: token.layout?.header?.colorTextRightActionsItemHover,
|
|
38
|
-
backgroundColor: token.layout?.header?.colorBgRightActionsItemHover
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
[`&>${token.antCls}-dropdown-trigger`]: {
|
|
43
|
-
color: token.colorTextTertiary,
|
|
44
|
-
paddingInline: 8,
|
|
45
|
-
paddingBlock: 8,
|
|
46
|
-
cursor: "pointer",
|
|
9
|
+
"&-header-actions": {
|
|
47
10
|
display: "flex",
|
|
48
11
|
alignItems: "center",
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
borderRadius: token.borderRadius,
|
|
52
|
-
"&:hover": { backgroundColor: setAlpha(token.colorTextBase, .03) }
|
|
53
|
-
},
|
|
54
|
-
"&-avatar": {
|
|
55
|
-
display: "inline-flex",
|
|
56
|
-
alignItems: "center",
|
|
57
|
-
justifyContent: "center",
|
|
12
|
+
justifyContent: "flex-end",
|
|
13
|
+
height: "100%",
|
|
58
14
|
gap: token.paddingXS,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
15
|
+
"&-item": {
|
|
16
|
+
display: "inline-flex",
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
justifyContent: "center",
|
|
19
|
+
paddingBlock: 0,
|
|
20
|
+
paddingInline: 2,
|
|
21
|
+
color: token.headerColorTextRightActionsItem,
|
|
22
|
+
fontSize: 14,
|
|
23
|
+
cursor: "pointer",
|
|
24
|
+
borderRadius: token.borderRadius,
|
|
25
|
+
[`.anticon`]: {
|
|
26
|
+
color: token.headerColorTextRightActionsItem,
|
|
27
|
+
transition: `color ${token.motionDurationMid}, background-color ${token.motionDurationMid}`,
|
|
28
|
+
"&:hover": { color: token.headerColorTextRightActionsItemHover }
|
|
29
|
+
},
|
|
30
|
+
[`&${token.componentCls}-header-actions-theme`]: { [`${token.componentCls}-header-actions-icon`]: {
|
|
31
|
+
paddingInline: 4,
|
|
32
|
+
paddingBlock: 4,
|
|
33
|
+
fontSize: 18
|
|
34
|
+
} },
|
|
35
|
+
"> *": {
|
|
36
|
+
paddingInline: 6,
|
|
37
|
+
paddingBlock: 6,
|
|
38
|
+
borderRadius: token.borderRadius,
|
|
39
|
+
transition: `color ${token.motionDurationMid}, background-color ${token.motionDurationMid}`,
|
|
40
|
+
"&:hover": {
|
|
41
|
+
color: token.headerColorTextRightActionsItemHover,
|
|
42
|
+
backgroundColor: token.headerColorBgRightActionsItemHover
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
[`&>${token.antCls}-dropdown-trigger`]: {
|
|
47
|
+
color: token.colorTextTertiary,
|
|
48
|
+
paddingInline: 8,
|
|
49
|
+
paddingBlock: 8,
|
|
50
|
+
cursor: "pointer",
|
|
51
|
+
display: "flex",
|
|
52
|
+
alignItems: "center",
|
|
53
|
+
height: 44,
|
|
54
|
+
lineHeight: "44px",
|
|
55
|
+
borderRadius: token.borderRadius,
|
|
56
|
+
"&:hover": { backgroundColor: withAlpha(token.colorTextBase, .03) }
|
|
57
|
+
},
|
|
58
|
+
"&-avatar": {
|
|
59
|
+
display: "inline-flex",
|
|
60
|
+
alignItems: "center",
|
|
61
|
+
justifyContent: "center",
|
|
62
|
+
gap: token.paddingXS,
|
|
63
|
+
paddingInlineStart: token.padding,
|
|
64
|
+
paddingInlineEnd: token.padding,
|
|
65
|
+
cursor: "pointer",
|
|
66
|
+
color: token.headerColorTextRightActionsItem
|
|
67
|
+
},
|
|
68
|
+
"&-name": { color: token.headerColorTextRightActionsItem }
|
|
63
69
|
}
|
|
64
|
-
} }
|
|
70
|
+
} };
|
|
65
71
|
};
|
|
66
|
-
|
|
67
|
-
return useStyle$1("RightContent", (token) => {
|
|
68
|
-
return [genStyle(token)];
|
|
69
|
-
}, componentCls);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
+
var style_default = proGenStyleHooks("ProRightContent", genRightContentStyle);
|
|
72
73
|
//#endregion
|
|
73
|
-
export {
|
|
74
|
+
export { style_default as default };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createVNode, h } from "vue";
|
|
2
|
+
import { DesktopOutlined } from "@antdv-next/icons";
|
|
3
|
+
import { GIcon } from "@gx-design-vue/icon";
|
|
4
|
+
//#region src/RightContent/themeOptions.tsx
|
|
5
|
+
const iconStyle = { fontSize: "15px" };
|
|
6
|
+
function labelWithIcon(icon, text) {
|
|
7
|
+
return () => createVNode("div", { "style": {
|
|
8
|
+
display: "flex",
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
gap: "6px"
|
|
11
|
+
} }, [typeof icon === "function" ? icon() : icon, text]);
|
|
12
|
+
}
|
|
13
|
+
const defaultThemeOptions = [
|
|
14
|
+
{
|
|
15
|
+
value: "light",
|
|
16
|
+
label: labelWithIcon(h(GIcon, {
|
|
17
|
+
type: "Moon",
|
|
18
|
+
style: iconStyle
|
|
19
|
+
}), "亮色")
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
value: "dark",
|
|
23
|
+
label: labelWithIcon(h(GIcon, {
|
|
24
|
+
type: "Sunny",
|
|
25
|
+
style: iconStyle
|
|
26
|
+
}), "深色")
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: "system",
|
|
30
|
+
label: labelWithIcon(h(DesktopOutlined, { style: iconStyle }), "自动")
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
//#endregion
|
|
34
|
+
export { defaultThemeOptions };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LayoutMenuRoute } from "@gx-design-vue/pro-layout";
|
|
2
|
+
|
|
3
|
+
//#region src/RightContent/utils.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* 根据指定字段对对象数组进行去重
|
|
6
|
+
*/
|
|
7
|
+
declare function uniqueByField<T>(arr: T[], key: keyof T): T[];
|
|
8
|
+
/**
|
|
9
|
+
* 获取文本的拼音首字母串(如 "你好世界" → "NHSJ")
|
|
10
|
+
*/
|
|
11
|
+
declare function getPinyinInitials(text: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* 判断菜单项名称是否匹配搜索关键词。
|
|
14
|
+
* 匹配策略:
|
|
15
|
+
* 1. 标题文本直接包含
|
|
16
|
+
* 2. 拼音首字母包含(如输入 "nh" 匹配 "你好")
|
|
17
|
+
*/
|
|
18
|
+
declare function matchSearchItem(title: string, keyword: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 从菜单数据源中搜索匹配项
|
|
21
|
+
*/
|
|
22
|
+
declare function searchMenuItems(dataSource: LayoutMenuRoute[], keyword: string): LayoutMenuRoute[];
|
|
23
|
+
//#endregion
|
|
24
|
+
export { getPinyinInitials, matchSearchItem, searchMenuItems, uniqueByField };
|