@meethive/components 0.0.1
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/es/AutoComplete/AutoComplete.js +84 -0
- package/es/AutoComplete/index.js +7 -0
- package/es/BadgeStatus/Badge.js +51 -0
- package/es/BadgeStatus/color.js +14 -0
- package/es/BadgeStatus/index.js +8 -0
- package/es/CardSelect/CardSelect.js +141 -0
- package/es/CardSelect/index.js +7 -0
- package/es/CardSelect/style/index.js +29 -0
- package/es/CheckButton/CheckButton.js +122 -0
- package/es/CheckButton/index.js +7 -0
- package/es/CheckButton/style/index.js +44 -0
- package/es/ConfigProvider/ConfigProvider.js +73 -0
- package/es/ConfigProvider/context.js +26 -0
- package/es/ConfigProvider/index.js +9 -0
- package/es/DragModal/DragModal.js +212 -0
- package/es/DragModal/index.js +7 -0
- package/es/DragModal/style/index.js +86 -0
- package/es/EditTable/Body.js +189 -0
- package/es/EditTable/CellRender.js +12 -0
- package/es/EditTable/EditTable.js +434 -0
- package/es/EditTable/FormItem.js +169 -0
- package/es/EditTable/Group.js +204 -0
- package/es/EditTable/Header.js +63 -0
- package/es/EditTable/HeaderRender.js +12 -0
- package/es/EditTable/components/ContextMenu/Menu.js +86 -0
- package/es/EditTable/components/ContextMenu/index.js +96 -0
- package/es/EditTable/components/Search/Search.js +163 -0
- package/es/EditTable/components/Search/Sort.js +119 -0
- package/es/EditTable/components/Search/index.js +2 -0
- package/es/EditTable/consts.js +13 -0
- package/es/EditTable/context.js +88 -0
- package/es/EditTable/hooks/index.js +19 -0
- package/es/EditTable/hooks/useGroup.js +48 -0
- package/es/EditTable/hooks/useResizeObserver.js +27 -0
- package/es/EditTable/hooks/useValidate.js +112 -0
- package/es/EditTable/index.js +25 -0
- package/es/EditTable/props.js +60 -0
- package/es/EditTable/style/body.js +63 -0
- package/es/EditTable/style/form.js +33 -0
- package/es/EditTable/style/group.js +33 -0
- package/es/EditTable/style/header.js +72 -0
- package/es/EditTable/style/index.js +52 -0
- package/es/EditTable/style/menu.js +27 -0
- package/es/EditTable/style/table.js +46 -0
- package/es/EditTable/utils.js +110 -0
- package/es/Ellipsis/Ellipsis.js +148 -0
- package/es/Ellipsis/index.js +7 -0
- package/es/Ellipsis/style/index.js +26 -0
- package/es/Empty/Empty.js +63 -0
- package/es/Empty/image.js +3 -0
- package/es/Empty/index.js +7 -0
- package/es/FullPage/FullPage.js +19 -0
- package/es/FullPage/index.js +7 -0
- package/es/Icon/Icon.js +49 -0
- package/es/Icon/index.js +7 -0
- package/es/LocaleProvider/LocaleProvider.js +31 -0
- package/es/LocaleProvider/index.js +7 -0
- package/es/LocaleReciver/index.js +24 -0
- package/es/Markdown/Markdown.js +118 -0
- package/es/Markdown/index.js +7 -0
- package/es/PermissionButton/PermissionButton.js +118 -0
- package/es/PermissionButton/confirm.js +94 -0
- package/es/PermissionButton/index.js +9 -0
- package/es/PermissionButton/shared.js +1 -0
- package/es/ProLayout/Basic/BasicLayout.js +422 -0
- package/es/ProLayout/Basic/BasicLayoutStyle.js +51 -0
- package/es/ProLayout/Basic/Header.js +111 -0
- package/es/ProLayout/Basic/HeaderStyle.js +10 -0
- package/es/ProLayout/PageContainer/index.js +354 -0
- package/es/ProLayout/PageContainer/style.js +85 -0
- package/es/ProLayout/RouteContext.js +28 -0
- package/es/ProLayout/SiderMenu/BaseMenu.js +241 -0
- package/es/ProLayout/SiderMenu/SiderMenu.js +274 -0
- package/es/ProLayout/SiderMenu/index.js +2 -0
- package/es/ProLayout/SiderMenu/style.js +204 -0
- package/es/ProLayout/TopHeader/index.js +170 -0
- package/es/ProLayout/TopHeader/style.js +154 -0
- package/es/ProLayout/defaultSettings.js +113 -0
- package/es/ProLayout/index.js +10 -0
- package/es/ProLayout/style/index.js +14 -0
- package/es/ProLayout/util.js +58 -0
- package/es/ProTable/Alert.js +40 -0
- package/es/ProTable/Content.js +97 -0
- package/es/ProTable/Header.js +33 -0
- package/es/ProTable/Pagination.js +55 -0
- package/es/ProTable/ProTable.js +279 -0
- package/es/ProTable/hooks/index.js +2 -0
- package/es/ProTable/hooks/useTableInject.js +6 -0
- package/es/ProTable/hooks/useTableSelection.js +115 -0
- package/es/ProTable/index.js +8 -0
- package/es/ProTable/setting.js +138 -0
- package/es/ProTable/style/index.js +113 -0
- package/es/RadioButton/RadioButton.js +53 -0
- package/es/RadioButton/index.js +8 -0
- package/es/RadioButton/style/index.js +25 -0
- package/es/Scrollbar/Bar.js +76 -0
- package/es/Scrollbar/Scrollbar.js +161 -0
- package/es/Scrollbar/Thumb.js +150 -0
- package/es/Scrollbar/constants.js +1 -0
- package/es/Scrollbar/index.js +7 -0
- package/es/Scrollbar/scrollbarProps.js +100 -0
- package/es/Scrollbar/style/index.js +85 -0
- package/es/Scrollbar/thumbProps.js +10 -0
- package/es/Scrollbar/util.js +39 -0
- package/es/Search/Item.js +239 -0
- package/es/Search/Search.js +90 -0
- package/es/Search/hooks/index.js +117 -0
- package/es/Search/hooks/useRouteQuery.js +86 -0
- package/es/Search/hooks/useSearchItems.js +50 -0
- package/es/Search/hooks/useTermOptions.js +29 -0
- package/es/Search/index.js +10 -0
- package/es/Search/setting.js +245 -0
- package/es/Search/style/index.js +5 -0
- package/es/Search/style/item.js +40 -0
- package/es/Search/style/search.js +177 -0
- package/es/Search/util.js +270 -0
- package/es/Skeleton/Skeleton.js +27 -0
- package/es/Skeleton/components/DashBoardCard.js +27 -0
- package/es/Skeleton/components/DashBoardChart.js +27 -0
- package/es/Skeleton/components/Detail.js +27 -0
- package/es/Skeleton/components/Drawer.js +27 -0
- package/es/Skeleton/components/Item.js +54 -0
- package/es/Skeleton/components/List.js +27 -0
- package/es/Skeleton/components/ListCard.js +28 -0
- package/es/Skeleton/components/ListCardItem.js +20 -0
- package/es/Skeleton/components/ListTable.js +27 -0
- package/es/Skeleton/components/Page.js +26 -0
- package/es/Skeleton/components/Search.js +16 -0
- package/es/Skeleton/components/Tree.js +27 -0
- package/es/Skeleton/index.js +28 -0
- package/es/Skeleton/style/index.js +195 -0
- package/es/TimeFormat/TimeFormat.js +36 -0
- package/es/TimeFormat/index.js +7 -0
- package/es/Title/Title.js +26 -0
- package/es/Title/index.js +7 -0
- package/es/Title/style/index.js +34 -0
- package/es/ValueItem/ValueItem.js +113 -0
- package/es/ValueItem/index.js +7 -0
- package/es/ValueItem/util.js +17 -0
- package/es/VirtualTable/VirtualTable.js +271 -0
- package/es/VirtualTable/data.js +60 -0
- package/es/VirtualTable/index.js +7 -0
- package/es/VirtualTable/style/index.js +34 -0
- package/es/components.js +21 -0
- package/es/index.js +17 -0
- package/es/locale/en-US.js +120 -0
- package/es/locale/zh-CN.js +120 -0
- package/es/style/styleRegister.js +19 -0
- package/es/style/variable.js +4 -0
- package/es/style.js +1 -0
- package/es/utils/constants.js +10 -0
- package/lib/AutoComplete/AutoComplete.js +84 -0
- package/lib/AutoComplete/index.js +7 -0
- package/lib/BadgeStatus/Badge.js +51 -0
- package/lib/BadgeStatus/color.js +14 -0
- package/lib/BadgeStatus/index.js +8 -0
- package/lib/CardSelect/CardSelect.js +141 -0
- package/lib/CardSelect/index.js +7 -0
- package/lib/CardSelect/style/index.js +29 -0
- package/lib/CheckButton/CheckButton.js +122 -0
- package/lib/CheckButton/index.js +7 -0
- package/lib/CheckButton/style/index.js +44 -0
- package/lib/ConfigProvider/ConfigProvider.js +73 -0
- package/lib/ConfigProvider/context.js +26 -0
- package/lib/ConfigProvider/index.js +9 -0
- package/lib/DragModal/DragModal.js +212 -0
- package/lib/DragModal/index.js +7 -0
- package/lib/DragModal/style/index.js +86 -0
- package/lib/EditTable/Body.js +189 -0
- package/lib/EditTable/CellRender.js +12 -0
- package/lib/EditTable/EditTable.js +434 -0
- package/lib/EditTable/FormItem.js +169 -0
- package/lib/EditTable/Group.js +204 -0
- package/lib/EditTable/Header.js +63 -0
- package/lib/EditTable/HeaderRender.js +12 -0
- package/lib/EditTable/components/ContextMenu/Menu.js +86 -0
- package/lib/EditTable/components/ContextMenu/index.js +96 -0
- package/lib/EditTable/components/Search/Search.js +163 -0
- package/lib/EditTable/components/Search/Sort.js +119 -0
- package/lib/EditTable/components/Search/index.js +2 -0
- package/lib/EditTable/consts.js +13 -0
- package/lib/EditTable/context.js +88 -0
- package/lib/EditTable/hooks/index.js +19 -0
- package/lib/EditTable/hooks/useGroup.js +48 -0
- package/lib/EditTable/hooks/useResizeObserver.js +27 -0
- package/lib/EditTable/hooks/useValidate.js +112 -0
- package/lib/EditTable/index.js +25 -0
- package/lib/EditTable/props.js +60 -0
- package/lib/EditTable/style/body.js +63 -0
- package/lib/EditTable/style/form.js +33 -0
- package/lib/EditTable/style/group.js +33 -0
- package/lib/EditTable/style/header.js +72 -0
- package/lib/EditTable/style/index.js +52 -0
- package/lib/EditTable/style/menu.js +27 -0
- package/lib/EditTable/style/table.js +46 -0
- package/lib/EditTable/utils.js +110 -0
- package/lib/Ellipsis/Ellipsis.js +148 -0
- package/lib/Ellipsis/index.js +7 -0
- package/lib/Ellipsis/style/index.js +26 -0
- package/lib/Empty/Empty.js +63 -0
- package/lib/Empty/image.js +3 -0
- package/lib/Empty/index.js +7 -0
- package/lib/FullPage/FullPage.js +19 -0
- package/lib/FullPage/index.js +7 -0
- package/lib/Icon/Icon.js +49 -0
- package/lib/Icon/index.js +7 -0
- package/lib/LocaleProvider/LocaleProvider.js +31 -0
- package/lib/LocaleProvider/index.js +7 -0
- package/lib/LocaleReciver/index.js +24 -0
- package/lib/Markdown/Markdown.js +118 -0
- package/lib/Markdown/index.js +7 -0
- package/lib/PermissionButton/PermissionButton.js +118 -0
- package/lib/PermissionButton/confirm.js +94 -0
- package/lib/PermissionButton/index.js +9 -0
- package/lib/PermissionButton/shared.js +1 -0
- package/lib/ProLayout/Basic/BasicLayout.js +422 -0
- package/lib/ProLayout/Basic/BasicLayoutStyle.js +51 -0
- package/lib/ProLayout/Basic/Header.js +111 -0
- package/lib/ProLayout/Basic/HeaderStyle.js +10 -0
- package/lib/ProLayout/PageContainer/index.js +354 -0
- package/lib/ProLayout/PageContainer/style.js +85 -0
- package/lib/ProLayout/RouteContext.js +28 -0
- package/lib/ProLayout/SiderMenu/BaseMenu.js +241 -0
- package/lib/ProLayout/SiderMenu/SiderMenu.js +274 -0
- package/lib/ProLayout/SiderMenu/index.js +2 -0
- package/lib/ProLayout/SiderMenu/style.js +204 -0
- package/lib/ProLayout/TopHeader/index.js +170 -0
- package/lib/ProLayout/TopHeader/style.js +154 -0
- package/lib/ProLayout/defaultSettings.js +113 -0
- package/lib/ProLayout/index.js +10 -0
- package/lib/ProLayout/style/index.js +14 -0
- package/lib/ProLayout/util.js +58 -0
- package/lib/ProTable/Alert.js +40 -0
- package/lib/ProTable/Content.js +97 -0
- package/lib/ProTable/Header.js +33 -0
- package/lib/ProTable/Pagination.js +55 -0
- package/lib/ProTable/ProTable.js +279 -0
- package/lib/ProTable/hooks/index.js +2 -0
- package/lib/ProTable/hooks/useTableInject.js +6 -0
- package/lib/ProTable/hooks/useTableSelection.js +115 -0
- package/lib/ProTable/index.js +8 -0
- package/lib/ProTable/setting.js +138 -0
- package/lib/ProTable/style/index.js +113 -0
- package/lib/RadioButton/RadioButton.js +53 -0
- package/lib/RadioButton/index.js +8 -0
- package/lib/RadioButton/style/index.js +25 -0
- package/lib/Scrollbar/Bar.js +76 -0
- package/lib/Scrollbar/Scrollbar.js +161 -0
- package/lib/Scrollbar/Thumb.js +150 -0
- package/lib/Scrollbar/constants.js +1 -0
- package/lib/Scrollbar/index.js +7 -0
- package/lib/Scrollbar/scrollbarProps.js +100 -0
- package/lib/Scrollbar/style/index.js +85 -0
- package/lib/Scrollbar/thumbProps.js +10 -0
- package/lib/Scrollbar/util.js +39 -0
- package/lib/Search/Item.js +239 -0
- package/lib/Search/Search.js +90 -0
- package/lib/Search/hooks/index.js +117 -0
- package/lib/Search/hooks/useRouteQuery.js +86 -0
- package/lib/Search/hooks/useSearchItems.js +50 -0
- package/lib/Search/hooks/useTermOptions.js +29 -0
- package/lib/Search/index.js +10 -0
- package/lib/Search/setting.js +245 -0
- package/lib/Search/style/index.js +5 -0
- package/lib/Search/style/item.js +40 -0
- package/lib/Search/style/search.js +177 -0
- package/lib/Search/util.js +270 -0
- package/lib/Skeleton/Skeleton.js +27 -0
- package/lib/Skeleton/components/DashBoardCard.js +27 -0
- package/lib/Skeleton/components/DashBoardChart.js +27 -0
- package/lib/Skeleton/components/Detail.js +27 -0
- package/lib/Skeleton/components/Drawer.js +27 -0
- package/lib/Skeleton/components/Item.js +54 -0
- package/lib/Skeleton/components/List.js +27 -0
- package/lib/Skeleton/components/ListCard.js +28 -0
- package/lib/Skeleton/components/ListCardItem.js +20 -0
- package/lib/Skeleton/components/ListTable.js +27 -0
- package/lib/Skeleton/components/Page.js +26 -0
- package/lib/Skeleton/components/Search.js +16 -0
- package/lib/Skeleton/components/Tree.js +27 -0
- package/lib/Skeleton/index.js +28 -0
- package/lib/Skeleton/style/index.js +195 -0
- package/lib/TimeFormat/TimeFormat.js +36 -0
- package/lib/TimeFormat/index.js +7 -0
- package/lib/Title/Title.js +26 -0
- package/lib/Title/index.js +7 -0
- package/lib/Title/style/index.js +34 -0
- package/lib/ValueItem/ValueItem.js +113 -0
- package/lib/ValueItem/index.js +7 -0
- package/lib/ValueItem/util.js +17 -0
- package/lib/VirtualTable/VirtualTable.js +271 -0
- package/lib/VirtualTable/data.js +60 -0
- package/lib/VirtualTable/index.js +7 -0
- package/lib/VirtualTable/style/index.js +34 -0
- package/lib/components.js +21 -0
- package/lib/index.js +17 -0
- package/lib/locale/en-US.js +120 -0
- package/lib/locale/zh-CN.js +120 -0
- package/lib/style/styleRegister.js +19 -0
- package/lib/style/variable.js +4 -0
- package/lib/style.js +1 -0
- package/lib/utils/constants.js +10 -0
- package/package.json +164 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
import { defineComponent, computed, toRefs, unref } from 'vue'
|
|
3
|
+
import { withInstall } from 'ant-design-vue/es/_util/type'
|
|
4
|
+
import { Affix, Spin, PageHeader, Tabs, Button } from 'ant-design-vue'
|
|
5
|
+
import { pageHeaderProps } from 'ant-design-vue/es/page-header'
|
|
6
|
+
import { useRouteContext } from '../RouteContext'
|
|
7
|
+
import { getSlotVNode } from '../util'
|
|
8
|
+
import { LayoutType } from '../defaultSettings'
|
|
9
|
+
import { useLocaleReceiver } from '../../LocaleReciver'
|
|
10
|
+
import useProLayoutStyle from '../style'
|
|
11
|
+
|
|
12
|
+
export const pageHeaderTabConfig = {
|
|
13
|
+
/**
|
|
14
|
+
* @name tabs 的列表
|
|
15
|
+
*/
|
|
16
|
+
tabList: {
|
|
17
|
+
type: [Object, Function, Array],
|
|
18
|
+
default: () => undefined
|
|
19
|
+
},
|
|
20
|
+
/**
|
|
21
|
+
* @name 当前选中 tab 的 key
|
|
22
|
+
*/
|
|
23
|
+
tabActiveKey: String,
|
|
24
|
+
/**
|
|
25
|
+
* @name tab 上多余的区域
|
|
26
|
+
*/
|
|
27
|
+
tabBarExtraContent: {
|
|
28
|
+
type: [Object, Function],
|
|
29
|
+
default: () => undefined
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* @name tabs 的其他配置
|
|
33
|
+
*/
|
|
34
|
+
tabProps: {
|
|
35
|
+
type: Object,
|
|
36
|
+
default: () => undefined
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* @name 固定 PageHeader 到页面顶部
|
|
40
|
+
*/
|
|
41
|
+
fixedHeader: Boolean,
|
|
42
|
+
// events
|
|
43
|
+
onTabChange: Function,
|
|
44
|
+
pure: Boolean
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const pageContainerProps = {
|
|
48
|
+
...pageHeaderTabConfig,
|
|
49
|
+
...pageHeaderProps,
|
|
50
|
+
prefixCls: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: 'ant-pro'
|
|
53
|
+
},
|
|
54
|
+
title: {
|
|
55
|
+
type: [Object, String, Boolean, Function],
|
|
56
|
+
default: () => null
|
|
57
|
+
},
|
|
58
|
+
subTitle: {
|
|
59
|
+
type: [Object, String, Boolean, Function],
|
|
60
|
+
default: () => null
|
|
61
|
+
},
|
|
62
|
+
content: {
|
|
63
|
+
type: [Object, String, Boolean, Function],
|
|
64
|
+
default: () => null
|
|
65
|
+
},
|
|
66
|
+
extra: {
|
|
67
|
+
type: [Object, String, Boolean, Function],
|
|
68
|
+
default: () => null
|
|
69
|
+
},
|
|
70
|
+
extraContent: {
|
|
71
|
+
type: [Object, String, Boolean, Function],
|
|
72
|
+
default: () => null
|
|
73
|
+
},
|
|
74
|
+
header: {
|
|
75
|
+
type: [Object, String, Boolean, Function],
|
|
76
|
+
default: () => null
|
|
77
|
+
},
|
|
78
|
+
pageHeaderRender: {
|
|
79
|
+
type: [Object, Function, Boolean],
|
|
80
|
+
default: () => undefined
|
|
81
|
+
},
|
|
82
|
+
affixProps: {
|
|
83
|
+
type: [Object, Function]
|
|
84
|
+
},
|
|
85
|
+
ghost: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: () => false
|
|
88
|
+
},
|
|
89
|
+
loading: {
|
|
90
|
+
type: Boolean,
|
|
91
|
+
default: () => undefined
|
|
92
|
+
},
|
|
93
|
+
childrenFullHeight: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
default: () => true
|
|
96
|
+
},
|
|
97
|
+
pure: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
default: false
|
|
100
|
+
},
|
|
101
|
+
showBack: {
|
|
102
|
+
type: Boolean,
|
|
103
|
+
default: false
|
|
104
|
+
},
|
|
105
|
+
contentStyle: {
|
|
106
|
+
type: Object,
|
|
107
|
+
default: () => ({})
|
|
108
|
+
},
|
|
109
|
+
onBack: {
|
|
110
|
+
type: Function
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const renderFooter = (props) => {
|
|
115
|
+
const {
|
|
116
|
+
tabList,
|
|
117
|
+
tabActiveKey,
|
|
118
|
+
onTabChange,
|
|
119
|
+
tabBarExtraContent,
|
|
120
|
+
tabProps
|
|
121
|
+
} = props
|
|
122
|
+
|
|
123
|
+
const tabPane = (item) => {
|
|
124
|
+
return React.createElement('span', { class: item.class || `tab-pane-${item.key}`,}, item.tab)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (tabList && tabList.length) {
|
|
128
|
+
return (
|
|
129
|
+
React.createElement(Tabs, {
|
|
130
|
+
class: "page-container-tabs",
|
|
131
|
+
activeKey: tabActiveKey,
|
|
132
|
+
onChange: (key) => {
|
|
133
|
+
if (onTabChange) {
|
|
134
|
+
onTabChange(key)
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
tabBarExtraContent: tabBarExtraContent,
|
|
138
|
+
...tabProps,}
|
|
139
|
+
|
|
140
|
+
, tabList.map((item) => (
|
|
141
|
+
React.createElement(Tabs.TabPane, {
|
|
142
|
+
...item,
|
|
143
|
+
tab: tabPane(item),
|
|
144
|
+
key: item.key,}
|
|
145
|
+
)
|
|
146
|
+
))
|
|
147
|
+
)
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
return null
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const renderPageHeader = (content, extraContent, prefixedClassName) => {
|
|
154
|
+
if (!content && !extraContent) {
|
|
155
|
+
return null
|
|
156
|
+
}
|
|
157
|
+
return (
|
|
158
|
+
React.createElement('div', { class: `${prefixedClassName}-detail`,}
|
|
159
|
+
, React.createElement('div', { class: `${prefixedClassName}-main`,}
|
|
160
|
+
, React.createElement('div', { class: `${prefixedClassName}-row`,}
|
|
161
|
+
, content && (
|
|
162
|
+
React.createElement('div', { class: `${prefixedClassName}-content`,}
|
|
163
|
+
, typeof content === 'function' && content() || content
|
|
164
|
+
)
|
|
165
|
+
)
|
|
166
|
+
, extraContent && (
|
|
167
|
+
React.createElement('div', { class: `${prefixedClassName}-extraContent`,}
|
|
168
|
+
, typeof extraContent === 'function' && extraContent() || extraContent
|
|
169
|
+
)
|
|
170
|
+
)
|
|
171
|
+
)
|
|
172
|
+
)
|
|
173
|
+
)
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const ProPageHeader = (props) => {
|
|
178
|
+
const {
|
|
179
|
+
title,
|
|
180
|
+
tabList,
|
|
181
|
+
tabActiveKey,
|
|
182
|
+
content,
|
|
183
|
+
pageHeaderRender,
|
|
184
|
+
header,
|
|
185
|
+
extraContent,
|
|
186
|
+
prefixedClassName,
|
|
187
|
+
prefixCls,
|
|
188
|
+
fixedHeader: _,
|
|
189
|
+
showBack,
|
|
190
|
+
onBack,
|
|
191
|
+
...restProps
|
|
192
|
+
} = props
|
|
193
|
+
|
|
194
|
+
const value = useRouteContext()
|
|
195
|
+
const [contextLocale] = useLocaleReceiver('ProLayout')
|
|
196
|
+
|
|
197
|
+
if (pageHeaderRender === false) {
|
|
198
|
+
return null
|
|
199
|
+
}
|
|
200
|
+
if (pageHeaderRender) {
|
|
201
|
+
return pageHeaderRender({ ...props })
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
let pageHeaderTitle = title
|
|
205
|
+
if (!title && title !== false) {
|
|
206
|
+
pageHeaderTitle = (value ).title
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const unrefBreadcrumb = unref((value ).breadcrumb || {})
|
|
210
|
+
const breadcrumb = props.breadcrumb || {
|
|
211
|
+
...unrefBreadcrumb,
|
|
212
|
+
routes: unrefBreadcrumb.routes,
|
|
213
|
+
itemRender: unrefBreadcrumb.itemRender
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const backProps = {}
|
|
217
|
+
if (showBack) {
|
|
218
|
+
// @ts-ignore
|
|
219
|
+
backProps.backIcon = React.createElement(Button, null, contextLocale.value.pageContainer.back)
|
|
220
|
+
backProps.onBack = () => {
|
|
221
|
+
if (props.onBack) {
|
|
222
|
+
props.onBack()
|
|
223
|
+
} else {
|
|
224
|
+
_optionalChain([(value ), 'access', _2 => _2.back, 'optionalCall', _3 => _3()])
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const styles = (value ).layoutType === LayoutType.CARD
|
|
230
|
+
? {
|
|
231
|
+
padding: props.extra || props.subTitle || pageHeaderTitle || tabList || props.extraContent || props.showBack || props.title
|
|
232
|
+
? '16px 24px'
|
|
233
|
+
: '0px'
|
|
234
|
+
}
|
|
235
|
+
: {}
|
|
236
|
+
|
|
237
|
+
return (
|
|
238
|
+
React.createElement('div', { class: `${prefixedClassName}-wrap`,}
|
|
239
|
+
, React.createElement(PageHeader, {
|
|
240
|
+
style: styles,
|
|
241
|
+
...backProps,
|
|
242
|
+
...restProps,
|
|
243
|
+
title: pageHeaderTitle,
|
|
244
|
+
breadcrumb: (value ).layoutType === LayoutType.LIST ? breadcrumb : null,
|
|
245
|
+
footer: renderFooter({
|
|
246
|
+
...restProps,
|
|
247
|
+
tabList,
|
|
248
|
+
tabActiveKey
|
|
249
|
+
}),
|
|
250
|
+
prefixCls: prefixCls,}
|
|
251
|
+
|
|
252
|
+
, header || renderPageHeader(content, extraContent, prefixedClassName)
|
|
253
|
+
)
|
|
254
|
+
)
|
|
255
|
+
)
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const PageContainer = defineComponent({
|
|
259
|
+
name: 'JPageContainer',
|
|
260
|
+
inheritAttrs: false,
|
|
261
|
+
props: pageContainerProps ,
|
|
262
|
+
setup(props, { slots, attrs }) {
|
|
263
|
+
const {
|
|
264
|
+
loading,
|
|
265
|
+
affixProps,
|
|
266
|
+
ghost,
|
|
267
|
+
childrenFullHeight
|
|
268
|
+
} = toRefs(props)
|
|
269
|
+
|
|
270
|
+
const value = useRouteContext()
|
|
271
|
+
const getPrefixCls = (value ).getPrefixCls
|
|
272
|
+
const prefixCls = props.prefixCls || getPrefixCls()
|
|
273
|
+
|
|
274
|
+
const stylePrefixCls = computed(() => 'pro-layout')
|
|
275
|
+
const [wrapSSR, hashId] = useProLayoutStyle(stylePrefixCls)
|
|
276
|
+
|
|
277
|
+
const prefixedClassName = computed(() => `${prefixCls}-page-container`)
|
|
278
|
+
|
|
279
|
+
const classNames = computed(() => ({
|
|
280
|
+
[hashId.value]: true,
|
|
281
|
+
[prefixedClassName.value]: true,
|
|
282
|
+
[`${prefixCls}-page-container-ghost`]: ghost.value
|
|
283
|
+
}))
|
|
284
|
+
|
|
285
|
+
const headerDom = computed(() => {
|
|
286
|
+
// const tags = getSlotVNode<DefaultPropRender>(slots, props, 'tags');
|
|
287
|
+
const headerContent = getSlotVNode(slots, props, 'content')
|
|
288
|
+
const extra = getSlotVNode(slots, props, 'extra')
|
|
289
|
+
const extraContent = getSlotVNode(slots, props, 'extraContent')
|
|
290
|
+
const subTitle = getSlotVNode(slots, props, 'subTitle')
|
|
291
|
+
const title = getSlotVNode(slots, props, 'title')
|
|
292
|
+
// @ts-ignore
|
|
293
|
+
return (
|
|
294
|
+
React.createElement(ProPageHeader, {
|
|
295
|
+
...props,
|
|
296
|
+
prefixCls: undefined,
|
|
297
|
+
prefixedClassName: prefixedClassName.value,
|
|
298
|
+
ghost: ghost.value,
|
|
299
|
+
title: title,
|
|
300
|
+
subTitle: subTitle,
|
|
301
|
+
content: headerContent,
|
|
302
|
+
extra: extra,
|
|
303
|
+
extraContent: extraContent,}
|
|
304
|
+
)
|
|
305
|
+
)
|
|
306
|
+
})
|
|
307
|
+
|
|
308
|
+
return () => {
|
|
309
|
+
const { fixedHeader, pure } = props
|
|
310
|
+
|
|
311
|
+
return (
|
|
312
|
+
React.createElement(React.Fragment, null
|
|
313
|
+
, pure ? (
|
|
314
|
+
React.createElement('div', { class: classNames.value,}
|
|
315
|
+
, _optionalChain([slots, 'access', _4 => _4.default, 'optionalCall', _5 => _5()])
|
|
316
|
+
)
|
|
317
|
+
) : (
|
|
318
|
+
React.createElement('div', { class: classNames.value, style: { ...(attrs.style || {}) },}
|
|
319
|
+
, fixedHeader && headerDom.value ? (
|
|
320
|
+
React.createElement(Affix, {
|
|
321
|
+
...affixProps.value,
|
|
322
|
+
offsetTop: (value ).hasHeader && (value ).fixedHeader ? (value ).headerHeight : 0,}
|
|
323
|
+
|
|
324
|
+
, headerDom.value
|
|
325
|
+
)
|
|
326
|
+
) : (
|
|
327
|
+
headerDom.value
|
|
328
|
+
)
|
|
329
|
+
, React.createElement('div', { class: `${prefixedClassName.value}-grid-content`,}
|
|
330
|
+
, loading.value ? (
|
|
331
|
+
React.createElement(Spin, null )
|
|
332
|
+
) : slots.default ? (
|
|
333
|
+
React.createElement('div', null
|
|
334
|
+
, React.createElement('div', {
|
|
335
|
+
class: `${prefixedClassName.value}-children-content ${childrenFullHeight.value ? 'children-full-height' : ''} ${hashId.value}`,
|
|
336
|
+
style: { ...(props.contentStyle || {}) },}
|
|
337
|
+
|
|
338
|
+
, slots.default()
|
|
339
|
+
)
|
|
340
|
+
, (value ).hasFooterToolbar && (
|
|
341
|
+
React.createElement('div', { style: { height: 48, marginTop: 24 },} )
|
|
342
|
+
)
|
|
343
|
+
)
|
|
344
|
+
) : null
|
|
345
|
+
)
|
|
346
|
+
)
|
|
347
|
+
)
|
|
348
|
+
)
|
|
349
|
+
)
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
})
|
|
353
|
+
|
|
354
|
+
export default withInstall(PageContainer)
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export const genPageContainerStyle = (config) => {
|
|
2
|
+
const { token } = config
|
|
3
|
+
const proLayoutPageContainerCls = `${token.antCls}-pro-page-container`
|
|
4
|
+
|
|
5
|
+
return {
|
|
6
|
+
[`${proLayoutPageContainerCls}-children-content`]: {
|
|
7
|
+
margin: '24px 24px 0'
|
|
8
|
+
},
|
|
9
|
+
[`${proLayoutPageContainerCls}`]: {
|
|
10
|
+
[`${proLayoutPageContainerCls}-warp`]: {
|
|
11
|
+
backgroundColor: token.colorBgContainer,
|
|
12
|
+
[`${token.antCls}-tabs-bar`]: {
|
|
13
|
+
margin: 0
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
[`${proLayoutPageContainerCls}-ghost`]: {
|
|
17
|
+
[`${proLayoutPageContainerCls}-warp`]: {
|
|
18
|
+
backgroundColor: token.colorBgContainer
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
[`${proLayoutPageContainerCls}-main`]: {
|
|
23
|
+
[`${proLayoutPageContainerCls}-detail`]: {
|
|
24
|
+
display: 'flex'
|
|
25
|
+
},
|
|
26
|
+
[`${proLayoutPageContainerCls}-row`]: {
|
|
27
|
+
display: 'flex',
|
|
28
|
+
width: '100%'
|
|
29
|
+
},
|
|
30
|
+
[`${proLayoutPageContainerCls}-title-content`]: {
|
|
31
|
+
marginBottom: '16px'
|
|
32
|
+
},
|
|
33
|
+
[`${proLayoutPageContainerCls}-title,${proLayoutPageContainerCls}-content`]: {
|
|
34
|
+
flex: 'auto'
|
|
35
|
+
},
|
|
36
|
+
[`${proLayoutPageContainerCls}-extraContent,${proLayoutPageContainerCls}-main`]: {
|
|
37
|
+
flex: '0 1 auto'
|
|
38
|
+
},
|
|
39
|
+
[`${proLayoutPageContainerCls}-title`]: {
|
|
40
|
+
marginBottom: '16px'
|
|
41
|
+
},
|
|
42
|
+
[`${proLayoutPageContainerCls}-logo`]: {
|
|
43
|
+
marginBottom: '16px'
|
|
44
|
+
},
|
|
45
|
+
[`${proLayoutPageContainerCls}-extraContent`]: {
|
|
46
|
+
minWidth: '242px',
|
|
47
|
+
marginLeft: '88px',
|
|
48
|
+
textAlign: 'right'
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
[`@media screen and (max-width: ${token.screenXl}px)`]: {
|
|
52
|
+
[`${proLayoutPageContainerCls}-main`]: {
|
|
53
|
+
[`${proLayoutPageContainerCls}-extraContent`]: {
|
|
54
|
+
marginLeft: '44px'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
[`@media screen and (max-width: ${token.screenLG}px)`]: {
|
|
59
|
+
[`${proLayoutPageContainerCls}-main`]: {
|
|
60
|
+
[`${proLayoutPageContainerCls}-extraContent`]: {
|
|
61
|
+
marginLeft: '20px'
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
[`@media screen and (max-width: ${token.screenMD}px)`]: {
|
|
66
|
+
[`${proLayoutPageContainerCls}-main`]: {
|
|
67
|
+
[`${proLayoutPageContainerCls}-row`]: {
|
|
68
|
+
display: 'block'
|
|
69
|
+
},
|
|
70
|
+
[`${proLayoutPageContainerCls}-extraContent,${proLayoutPageContainerCls}-action`]: {
|
|
71
|
+
marginLeft: 0,
|
|
72
|
+
textAlign: 'left'
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
[`@media screen and (max-width: ${token.screenSM}px)`]: {
|
|
77
|
+
[`${proLayoutPageContainerCls}-detail`]: {
|
|
78
|
+
display: 'block'
|
|
79
|
+
},
|
|
80
|
+
[`${proLayoutPageContainerCls}-extraContent`]: {
|
|
81
|
+
marginLeft: 0
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { provide, reactive } from 'vue'
|
|
2
|
+
import { useContext } from '@meethive/hooks'
|
|
3
|
+
|
|
4
|
+
export const defaultPrefixCls = 'ant-pro'
|
|
5
|
+
|
|
6
|
+
export const getPrefixCls = (suffixCls, customizePrefixCls) => {
|
|
7
|
+
if (customizePrefixCls) return customizePrefixCls
|
|
8
|
+
return suffixCls ? `${defaultPrefixCls}-${suffixCls}` : defaultPrefixCls
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const defaultRouteContext = reactive({
|
|
12
|
+
getPrefixCls: getPrefixCls,
|
|
13
|
+
locale: (t) => {
|
|
14
|
+
return t
|
|
15
|
+
},
|
|
16
|
+
contentWidth: 'Fluid',
|
|
17
|
+
hasFooterToolbar: false
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
export const routeContextInjectKey = Symbol('jetlinks-route-context')
|
|
21
|
+
|
|
22
|
+
export const provideRouteContext = (value) => {
|
|
23
|
+
provide(routeContextInjectKey, value)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const useRouteContext = () => {
|
|
27
|
+
return useContext(routeContextInjectKey, defaultRouteContext)
|
|
28
|
+
}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
import { defineComponent, watchEffect, isVNode, resolveComponent, getCurrentInstance, withCtx, } from 'vue'
|
|
3
|
+
import { Menu } from 'ant-design-vue'
|
|
4
|
+
import { createFromIconfontCN } from '@ant-design/icons-vue'
|
|
5
|
+
import { defaultSettingProps } from '../defaultSettings'
|
|
6
|
+
import { defaultPrefixCls } from '../RouteContext'
|
|
7
|
+
import IconFont from '../../Icon'
|
|
8
|
+
import { regular } from '@meethive/utils'
|
|
9
|
+
|
|
10
|
+
let AntdIconFont = createFromIconfontCN({
|
|
11
|
+
scriptUrl: ''
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const LazyIcon = (props) => {
|
|
15
|
+
const { icon, iconUrl, prefixCls = defaultPrefixCls } = props
|
|
16
|
+
if (!icon) return null
|
|
17
|
+
if (isVNode(icon)) {
|
|
18
|
+
return icon
|
|
19
|
+
}
|
|
20
|
+
if (typeof icon === 'string' && icon !== '') {
|
|
21
|
+
if (regular.isUrl(icon) || regular.isImg(icon)) {
|
|
22
|
+
return (
|
|
23
|
+
React.createElement('img', {
|
|
24
|
+
src: icon,
|
|
25
|
+
alt: "icon",
|
|
26
|
+
class: `${prefixCls}-sider-menu-icon`,}
|
|
27
|
+
)
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
return iconUrl
|
|
31
|
+
? React.createElement(AntdIconFont, { type: icon,} )
|
|
32
|
+
: React.createElement(IconFont, { type: icon,} )
|
|
33
|
+
}
|
|
34
|
+
return null
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const baseMenuProps = {
|
|
38
|
+
...defaultSettingProps,
|
|
39
|
+
prefixCls: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: defaultPrefixCls
|
|
42
|
+
},
|
|
43
|
+
locale: {
|
|
44
|
+
type: [Function, Boolean],
|
|
45
|
+
default: (t) => t
|
|
46
|
+
},
|
|
47
|
+
menuData: {
|
|
48
|
+
type: Array,
|
|
49
|
+
default: () => []
|
|
50
|
+
},
|
|
51
|
+
mode: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: 'inline'
|
|
54
|
+
},
|
|
55
|
+
theme: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: 'dark'
|
|
58
|
+
},
|
|
59
|
+
collapsed: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: () => false
|
|
62
|
+
},
|
|
63
|
+
openKeys: {
|
|
64
|
+
type: Array,
|
|
65
|
+
default: () => undefined
|
|
66
|
+
},
|
|
67
|
+
selectedKeys: {
|
|
68
|
+
type: Array,
|
|
69
|
+
default: () => undefined
|
|
70
|
+
},
|
|
71
|
+
menuProps: {
|
|
72
|
+
type: Object,
|
|
73
|
+
default: () => null
|
|
74
|
+
},
|
|
75
|
+
menuItemRender: {
|
|
76
|
+
type: [Object, Function, Boolean],
|
|
77
|
+
default: () => undefined
|
|
78
|
+
},
|
|
79
|
+
subMenuItemRender: {
|
|
80
|
+
type: [Object, Function, Boolean],
|
|
81
|
+
default: () => undefined
|
|
82
|
+
},
|
|
83
|
+
onClick: [Function, Object]
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// MenuUtil class for recursive menu rendering (matching ES source)
|
|
87
|
+
class MenuUtil {
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
constructor(_props, ctx) {;MenuUtil.prototype.__init.call(this);MenuUtil.prototype.__init2.call(this);MenuUtil.prototype.__init3.call(this);
|
|
93
|
+
this.props = _props
|
|
94
|
+
this.ctx = ctx
|
|
95
|
+
this.RouterLink = resolveComponent('router-link')
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
__init() {this.getNavMenuItems = (menusData = []) => {
|
|
99
|
+
return menusData.map((item) => this.getSubMenuOrItem(item)).filter((item) => item)
|
|
100
|
+
}}
|
|
101
|
+
|
|
102
|
+
__init2() {this.getSubMenuOrItem = (item) => {
|
|
103
|
+
if (
|
|
104
|
+
Array.isArray(item.children) &&
|
|
105
|
+
item.children.length > 0 &&
|
|
106
|
+
!_optionalChain([item, 'access', _27 => _27.meta, 'optionalAccess', _28 => _28.hideInMenu]) &&
|
|
107
|
+
!_optionalChain([item, 'access', _29 => _29.meta, 'optionalAccess', _30 => _30.hideChildrenInMenu])
|
|
108
|
+
) {
|
|
109
|
+
if (this.props.subMenuItemRender) {
|
|
110
|
+
const subMenuItemRender = withCtx(this.props.subMenuItemRender, this.ctx)
|
|
111
|
+
return subMenuItemRender({
|
|
112
|
+
item,
|
|
113
|
+
children: this.getNavMenuItems(item.children)
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
const { prefixCls, locale } = this.props
|
|
117
|
+
const menuTitle = locale && locale(_optionalChain([item, 'access', _31 => _31.meta, 'optionalAccess', _32 => _32.title])) || _optionalChain([item, 'access', _33 => _33.meta, 'optionalAccess', _34 => _34.title])
|
|
118
|
+
const defaultTitle = _optionalChain([item, 'access', _35 => _35.meta, 'optionalAccess', _36 => _36.icon])
|
|
119
|
+
? React.createElement('span', { class: `${prefixCls}-menu-item`,}
|
|
120
|
+
, React.createElement('span', { class: `${prefixCls}-menu-item-title`,}, menuTitle)
|
|
121
|
+
)
|
|
122
|
+
: React.createElement('span', { class: `${prefixCls}-menu-item`,}, menuTitle)
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
React.createElement(Menu.SubMenu, {
|
|
126
|
+
title: defaultTitle,
|
|
127
|
+
key: item.key || item.path,
|
|
128
|
+
popupClassName: `${prefixCls}-menu-popup`,
|
|
129
|
+
icon: React.createElement(LazyIcon, { iconUrl: this.props.iconfontUrl, icon: _optionalChain([item, 'access', _37 => _37.meta, 'optionalAccess', _38 => _38.icon]),} ),}
|
|
130
|
+
|
|
131
|
+
, this.getNavMenuItems(item.children)
|
|
132
|
+
)
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const menuItemRender = this.props.menuItemRender && withCtx(this.props.menuItemRender, this.ctx)
|
|
137
|
+
const [title, icon] = this.getMenuItem(item)
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
menuItemRender &&
|
|
141
|
+
menuItemRender({
|
|
142
|
+
item,
|
|
143
|
+
title,
|
|
144
|
+
icon
|
|
145
|
+
})
|
|
146
|
+
) || (
|
|
147
|
+
React.createElement(Menu.Item, {
|
|
148
|
+
disabled: _optionalChain([item, 'access', _39 => _39.meta, 'optionalAccess', _40 => _40.disabled]),
|
|
149
|
+
danger: _optionalChain([item, 'access', _41 => _41.meta, 'optionalAccess', _42 => _42.danger]),
|
|
150
|
+
key: item.key || item.path,}
|
|
151
|
+
|
|
152
|
+
, title
|
|
153
|
+
)
|
|
154
|
+
)
|
|
155
|
+
}}
|
|
156
|
+
|
|
157
|
+
__init3() {this.getMenuItem = (item) => {
|
|
158
|
+
const meta = { ...item.meta }
|
|
159
|
+
const target = meta.target || null
|
|
160
|
+
const hasUrl = regular.isUrl(item.path)
|
|
161
|
+
const CustomTag = (target && 'a') || this.RouterLink
|
|
162
|
+
const routerProps = {
|
|
163
|
+
to: {
|
|
164
|
+
name: item.name,
|
|
165
|
+
...item.meta
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const attrs = hasUrl || target ? {
|
|
169
|
+
...item.meta,
|
|
170
|
+
href: item.path,
|
|
171
|
+
target: target
|
|
172
|
+
} : {}
|
|
173
|
+
const { prefixCls, locale } = this.props
|
|
174
|
+
const icon = _optionalChain([item, 'access', _43 => _43.meta, 'optionalAccess', _44 => _44.icon]) && (
|
|
175
|
+
React.createElement(LazyIcon, { iconUrl: this.props.iconfontUrl, icon: _optionalChain([item, 'access', _45 => _45.meta, 'optionalAccess', _46 => _46.icon]),} )
|
|
176
|
+
) || undefined
|
|
177
|
+
const menuTitle = locale && locale(_optionalChain([item, 'access', _47 => _47.meta, 'optionalAccess', _48 => _48.title])) || _optionalChain([item, 'access', _49 => _49.meta, 'optionalAccess', _50 => _50.title])
|
|
178
|
+
const defaultTitle = _optionalChain([item, 'access', _51 => _51.meta, 'optionalAccess', _52 => _52.icon])
|
|
179
|
+
? React.createElement(CustomTag, { ...attrs, ...routerProps, class: `${prefixCls}-menu-item`,}
|
|
180
|
+
, icon
|
|
181
|
+
, React.createElement('span', { class: `${prefixCls}-menu-item-title`,}, menuTitle)
|
|
182
|
+
)
|
|
183
|
+
: React.createElement(CustomTag, { ...attrs, ...routerProps, class: `${prefixCls}-menu-item`,}
|
|
184
|
+
, React.createElement('span', null, menuTitle)
|
|
185
|
+
)
|
|
186
|
+
return [defaultTitle, icon]
|
|
187
|
+
}}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export default defineComponent({
|
|
191
|
+
name: 'BaseMenu',
|
|
192
|
+
props: baseMenuProps ,
|
|
193
|
+
emits: ['update:openKeys', 'update:selectedKeys', 'click'],
|
|
194
|
+
setup(props, { emit }) {
|
|
195
|
+
const ctx = getCurrentInstance()
|
|
196
|
+
const menuUtil = new MenuUtil(props, ctx)
|
|
197
|
+
|
|
198
|
+
watchEffect(() => {
|
|
199
|
+
if (props.iconfontUrl) {
|
|
200
|
+
AntdIconFont = createFromIconfontCN({
|
|
201
|
+
scriptUrl: props.iconfontUrl
|
|
202
|
+
})
|
|
203
|
+
}
|
|
204
|
+
})
|
|
205
|
+
|
|
206
|
+
const handleOpenChange = (openKeys) => {
|
|
207
|
+
emit('update:openKeys', openKeys)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const handleSelect = (args) => {
|
|
211
|
+
// ignore https? link handle selectkeys
|
|
212
|
+
if (regular.isUrl(args.key)) {
|
|
213
|
+
return
|
|
214
|
+
}
|
|
215
|
+
emit('update:selectedKeys', args.selectedKeys)
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const handleClick = (args) => {
|
|
219
|
+
emit('click', args)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return () => {
|
|
223
|
+
return (
|
|
224
|
+
React.createElement(Menu, {
|
|
225
|
+
key: "Menu",
|
|
226
|
+
inlineIndent: 16,
|
|
227
|
+
mode: props.mode,
|
|
228
|
+
theme: props.theme,
|
|
229
|
+
openKeys: props.openKeys === false ? [] : props.openKeys,
|
|
230
|
+
selectedKeys: props.selectedKeys || [],
|
|
231
|
+
onOpenChange: handleOpenChange,
|
|
232
|
+
onSelect: handleSelect,
|
|
233
|
+
onClick: handleClick,
|
|
234
|
+
...props.menuProps,}
|
|
235
|
+
|
|
236
|
+
, menuUtil.getNavMenuItems(props.menuData)
|
|
237
|
+
)
|
|
238
|
+
)
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
})
|