@gx-design-vue/pro-layout-components 0.1.0-alpha.0 → 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.
Files changed (120) hide show
  1. package/dist/RightContent/Search/Panel.d.ts +16 -39
  2. package/dist/RightContent/Search/Panel.js +138 -134
  3. package/dist/RightContent/Search/index.d.ts +11 -47
  4. package/dist/RightContent/Search/index.js +117 -103
  5. package/dist/RightContent/Search/style.d.ts +4 -7
  6. package/dist/RightContent/Search/style.js +34 -30
  7. package/dist/RightContent/index.d.ts +4 -403
  8. package/dist/RightContent/index.js +162 -146
  9. package/dist/RightContent/interface.d.ts +84 -0
  10. package/dist/RightContent/interface.js +1 -0
  11. package/dist/RightContent/locale.d.ts +6 -0
  12. package/dist/RightContent/locale.js +18 -0
  13. package/dist/RightContent/style.d.ts +4 -7
  14. package/dist/RightContent/style.js +66 -65
  15. package/dist/RightContent/themeOptions.d.ts +6 -0
  16. package/dist/RightContent/themeOptions.js +34 -0
  17. package/dist/RightContent/utils.d.ts +24 -0
  18. package/dist/RightContent/utils.js +66 -0
  19. package/dist/index.d.ts +3 -7
  20. package/dist/index.js +2 -5
  21. package/dist/pro-layout-components.esm.js +897 -5867
  22. package/dist/pro-layout-components.js +1 -5
  23. package/dist/theme/augment.d.ts +10 -0
  24. package/dist/theme/augment.js +1 -0
  25. package/dist/theme/interface/components.d.ts +10 -0
  26. package/dist/theme/interface/components.js +1 -0
  27. package/global.d.ts +0 -1
  28. package/package.json +16 -18
  29. package/dist/AppsLogoComponents/AppLogoList.d.ts +0 -24
  30. package/dist/AppsLogoComponents/AppLogoList.js +0 -43
  31. package/dist/AppsLogoComponents/AppsLogo.d.ts +0 -10
  32. package/dist/AppsLogoComponents/AppsLogo.js +0 -12
  33. package/dist/AppsLogoComponents/DefaultContent.d.ts +0 -27
  34. package/dist/AppsLogoComponents/DefaultContent.js +0 -43
  35. package/dist/AppsLogoComponents/SimpleContent.d.ts +0 -38
  36. package/dist/AppsLogoComponents/SimpleContent.js +0 -63
  37. package/dist/AppsLogoComponents/index.d.ts +0 -32
  38. package/dist/AppsLogoComponents/index.js +0 -71
  39. package/dist/AppsLogoComponents/props.d.ts +0 -26
  40. package/dist/AppsLogoComponents/props.js +0 -12
  41. package/dist/AppsLogoComponents/style/default.d.ts +0 -6
  42. package/dist/AppsLogoComponents/style/default.js +0 -70
  43. package/dist/AppsLogoComponents/style/index.d.ts +0 -7
  44. package/dist/AppsLogoComponents/style/index.js +0 -60
  45. package/dist/AppsLogoComponents/style/simple.d.ts +0 -6
  46. package/dist/AppsLogoComponents/style/simple.js +0 -83
  47. package/dist/Icon/components/Paintbrush.d.ts +0 -6
  48. package/dist/Icon/components/Paintbrush.js +0 -21
  49. package/dist/Icon/components/Palette.d.ts +0 -6
  50. package/dist/Icon/components/Palette.js +0 -20
  51. package/dist/Icon/components/index.d.ts +0 -10
  52. package/dist/Icon/components/index.js +0 -11
  53. package/dist/Icon/index.d.ts +0 -37
  54. package/dist/Icon/index.js +0 -24
  55. package/dist/PageLock/Popup.d.ts +0 -43
  56. package/dist/PageLock/Popup.js +0 -68
  57. package/dist/PageLock/UserForm.d.ts +0 -42
  58. package/dist/PageLock/UserForm.js +0 -68
  59. package/dist/PageLock/index.d.ts +0 -52
  60. package/dist/PageLock/index.js +0 -92
  61. package/dist/PageLock/props.d.ts +0 -51
  62. package/dist/PageLock/props.js +0 -29
  63. package/dist/PageLock/style.d.ts +0 -7
  64. package/dist/PageLock/style.js +0 -108
  65. package/dist/PageLock/useFormState.d.ts +0 -16
  66. package/dist/PageLock/useFormState.js +0 -19
  67. package/dist/Paintbrush-EfUpNqey.js +0 -14
  68. package/dist/Palette-B5wq9KtV.js +0 -13
  69. package/dist/RightContent/Search/props.d.ts +0 -17
  70. package/dist/RightContent/Search/props.js +0 -15
  71. package/dist/RightContent/props.d.ts +0 -64
  72. package/dist/RightContent/props.js +0 -63
  73. package/dist/ThemeEditor/components/BlockCheckbox.d.ts +0 -39
  74. package/dist/ThemeEditor/components/BlockCheckbox.js +0 -42
  75. package/dist/ThemeEditor/components/RegionalChange.d.ts +0 -21
  76. package/dist/ThemeEditor/components/RegionalChange.js +0 -43
  77. package/dist/ThemeEditor/components/Setting/index.d.ts +0 -52
  78. package/dist/ThemeEditor/components/Setting/index.js +0 -125
  79. package/dist/ThemeEditor/components/SwitchTab/index.d.ts +0 -51
  80. package/dist/ThemeEditor/components/SwitchTab/index.js +0 -52
  81. package/dist/ThemeEditor/components/SwitchTab/style.d.ts +0 -6
  82. package/dist/ThemeEditor/components/SwitchTab/style.js +0 -54
  83. package/dist/ThemeEditor/components/Tokens/Colors/ColorSvg.d.ts +0 -7
  84. package/dist/ThemeEditor/components/Tokens/Colors/ColorSvg.js +0 -453
  85. package/dist/ThemeEditor/components/Tokens/Colors/Primary.d.ts +0 -7
  86. package/dist/ThemeEditor/components/Tokens/Colors/Primary.js +0 -58
  87. package/dist/ThemeEditor/components/Tokens/Colors/Side.d.ts +0 -7
  88. package/dist/ThemeEditor/components/Tokens/Colors/Side.js +0 -18
  89. package/dist/ThemeEditor/components/Tokens/Colors/index.d.ts +0 -7
  90. package/dist/ThemeEditor/components/Tokens/Colors/index.js +0 -15
  91. package/dist/ThemeEditor/components/Tokens/context.d.ts +0 -9
  92. package/dist/ThemeEditor/components/Tokens/context.js +0 -7
  93. package/dist/ThemeEditor/components/Tokens/index.d.ts +0 -45
  94. package/dist/ThemeEditor/components/Tokens/index.js +0 -69
  95. package/dist/ThemeEditor/components/Tokens/utils/config.d.ts +0 -10
  96. package/dist/ThemeEditor/components/Tokens/utils/config.js +0 -8
  97. package/dist/ThemeEditor/components/Trigger.d.ts +0 -21
  98. package/dist/ThemeEditor/components/Trigger.js +0 -46
  99. package/dist/ThemeEditor/context.d.ts +0 -14
  100. package/dist/ThemeEditor/context.js +0 -7
  101. package/dist/ThemeEditor/index.d.ts +0 -841
  102. package/dist/ThemeEditor/index.js +0 -165
  103. package/dist/ThemeEditor/props.d.ts +0 -57
  104. package/dist/ThemeEditor/props.js +0 -40
  105. package/dist/ThemeEditor/style/animate.d.ts +0 -9
  106. package/dist/ThemeEditor/style/animate.js +0 -38
  107. package/dist/ThemeEditor/style/index.d.ts +0 -10
  108. package/dist/ThemeEditor/style/index.js +0 -318
  109. package/dist/ThemeEditor/style/theme.d.ts +0 -6
  110. package/dist/ThemeEditor/style/theme.js +0 -71
  111. package/dist/ThemeEditor/utils/config.d.ts +0 -37
  112. package/dist/ThemeEditor/utils/config.js +0 -132
  113. package/dist/ThemeEditor/utils/index.d.ts +0 -9
  114. package/dist/ThemeEditor/utils/index.js +0 -64
  115. package/dist/hooks/useClockTime/index.d.ts +0 -11
  116. package/dist/hooks/useClockTime/index.js +0 -28
  117. package/dist/utils/index.d.ts +0 -2
  118. package/dist/utils/index.js +0 -3
  119. package/dist/utils/util.d.ts +0 -10
  120. package/dist/utils/util.js +0 -17
@@ -1,152 +1,168 @@
1
- import Icon_default from "../Icon/index.js";
2
- import { getRightContentProps } from "./props.js";
3
- import PageLock_default from "../PageLock/index.js";
4
- import { systemTheme } from "../ThemeEditor/utils/config.js";
5
- import Search_default from "./Search/index.js";
6
- import { useStyle } from "./style.js";
7
- import { Fragment, computed, createTextVNode, createVNode, defineComponent, isVNode, mergeProps, ref } from "vue";
8
- import { useMediaQuery, useState } from "@gx-design-vue/pro-hooks";
9
- import { getPrefixCls, getSlot, getSlotsProps, isBoolean, isFunction } from "@gx-design-vue/pro-utils";
10
- import { Avatar, Dropdown, Menu, MenuItem } from "ant-design-vue";
11
- import { useProLayoutContext } from "@gx-design-vue/pro-layout";
12
- import { CompressOutlined, ExpandOutlined, LockOutlined, LogoutOutlined, SettingOutlined, UserOutlined } from "@ant-design/icons-vue";
13
- import { toggleAnimateTheme, useThemeContext } from "@gx-design-vue/context";
14
- import { useColorMode, useDebounceFn, useFullscreen } from "@vueuse/core";
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
- function _isSlot(s) {
19
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
20
- }
21
- const GlobalRightContent = /* @__PURE__ */ defineComponent({
22
- name: "GlobalRightContent",
23
- props: getRightContentProps(),
24
- inheritAttrs: false,
25
- emits: {
26
- click: (type) => type.length > 0,
27
- logout: (callback) => typeof callback === "function"
28
- },
29
- slots: Object,
30
- setup(props, { slots }) {
31
- const { isFullscreen, toggle } = useFullscreen();
32
- const layoutContext = useProLayoutContext();
33
- const colSize = useMediaQuery();
34
- const { system } = useColorMode();
35
- const { setTheme, isDark, theme } = useThemeContext();
36
- const prefixCls = getPrefixCls({
37
- suffixCls: "global",
38
- isPor: true
39
- });
40
- const { wrapSSR, hashId } = useStyle(prefixCls);
41
- const toggleEl = ref();
42
- const [lock, openLock] = useState(false);
43
- const [rightSize, setRightSize] = useState("auto");
44
- const isMobile = computed(() => isBoolean(layoutContext?.isMobile?.value) ? layoutContext?.isMobile?.value : colSize.value === "sm" || colSize.value === "xs");
45
- const actions = computed(() => {
46
- if (props.actions === false) return {};
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
- function onClick(type) {
68
- if (isFunction(props.onClick)) props.onClick?.(type);
69
- }
70
- return () => {
71
- let _slot2;
72
- const slotsProps = getSlotsProps({
73
- slots,
74
- props,
75
- keys: [
76
- "dropdownRender",
77
- "dropdownMenuRender",
78
- "dropdownMenuExtraItemRender"
79
- ],
80
- render: true
81
- });
82
- const actionsRender = getSlot({
83
- slots,
84
- props,
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
- const FullScreenIcon = isFullscreen.value ? CompressOutlined : ExpandOutlined;
88
- return wrapSSR(createVNode("div", {
89
- "class": `${prefixCls}-right-content ${hashId.value}`.trim(),
90
- "style": {
91
- minWidth: rightSize.value,
92
- height: "100%"
93
- }
94
- }, [createVNode("div", { "style": { height: "100%" } }, [createVNode(ResizeObserver, {
95
- "key": "resize-observer",
96
- "onResize": ({ width }) => {
97
- setRightSizeDebounceFn(width);
98
- }
99
- }, { default: () => [createVNode("div", { "class": `${prefixCls}-header-actions ${hashId.value}`.trim() }, [slots.default?.() ?? createVNode(Fragment, null, [
100
- actions.value.search && !isMobile.value && createVNode(Search_default, {
101
- "dataSource": props.dataSource,
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 { RightContent_default as default };
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,6 @@
1
+ import { RightContentLocale } from "./interface.js";
2
+
3
+ //#region src/RightContent/locale.d.ts
4
+ declare const defaultLocale: RightContentLocale;
5
+ //#endregion
6
+ export { defaultLocale };
@@ -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 vue244 from "vue";
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
- declare function useStyle(componentCls: string): {
6
- wrapSSR: (node: ant_design_vue_es__util_type22.VueNode) => ant_design_vue_es__util_type22.VueNode;
7
- hashId: vue244.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 { useStyle };
7
+ export { ComponentToken, _default as default };
@@ -1,73 +1,74 @@
1
- import { setAlpha, unit, useStyle as useStyle$1 } from "@gx-design-vue/pro-provider";
2
-
1
+ import { proGenStyleHooks } from "@gx-design-vue/pro-provider";
3
2
  //#region src/RightContent/style.ts
4
- const genStyle = (token) => {
5
- return { [`${token.componentCls}`]: { "&-header-actions": {
6
- display: "flex",
7
- alignItems: "center",
8
- justifyContent: "flex-end",
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
- gap: token.paddingXS,
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
- height: 44,
50
- lineHeight: unit(44),
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
- paddingInlineStart: token.padding,
60
- paddingInlineEnd: token.padding,
61
- cursor: "pointer",
62
- color: token.layout?.header?.colorTextRightActionsItem
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
- function useStyle(componentCls) {
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 { useStyle };
74
+ export { style_default as default };
@@ -0,0 +1,6 @@
1
+ import { RightContentThemeOption } from "./interface.js";
2
+
3
+ //#region src/RightContent/themeOptions.d.ts
4
+ declare const defaultThemeOptions: RightContentThemeOption[];
5
+ //#endregion
6
+ export { defaultThemeOptions };
@@ -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 };