@gx-design-vue/create-gx-cli 0.0.5 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/cli.js +3 -3
- package/src/main.js +6 -1
- package/template-mobile-vant-cli/build/generateModifyVars.ts +7 -0
- package/template-mobile-vant-cli/build/script/postBuild.ts +0 -1
- package/{template-design-pro/src/components/GDesign/ProLayout/components/PageContainer/typings.ts → template-mobile-vant-cli/src/design/config.less} +0 -0
- package/template-mobile-vant-cli/types/components.d.ts +0 -2
- package/template-mobile-vant-cli/types/global.d.ts +3 -3
- package/template-mobile-vant-cli/types/module.d.ts +0 -2
- package/template-mobile-vant-cli/vite.config.ts +6 -7
- package/template-design-pro/.editorconfig +0 -19
- package/template-design-pro/.env +0 -2
- package/template-design-pro/.env.development +0 -18
- package/template-design-pro/.env.pro +0 -32
- package/template-design-pro/.env.production +0 -32
- package/template-design-pro/.env.test +0 -20
- package/template-design-pro/.eslintignore +0 -16
- package/template-design-pro/.eslintrc.js +0 -64
- package/template-design-pro/.gitpod.yml +0 -6
- package/template-design-pro/.husky/pre-commit +0 -4
- package/template-design-pro/.prettierignore +0 -9
- package/template-design-pro/.stylelintignore +0 -3
- package/template-design-pro/.yarnclean +0 -48
- package/template-design-pro/LICENSE +0 -21
- package/template-design-pro/README.md +0 -111
- package/template-design-pro/build/constant.ts +0 -6
- package/template-design-pro/build/generate/generateModifyVars.ts +0 -18
- package/template-design-pro/build/getConfigFileName.ts +0 -13
- package/template-design-pro/build/script/buildConf.ts +0 -44
- package/template-design-pro/build/script/postBuild.ts +0 -25
- package/template-design-pro/build/script/reSetRootHtml.ts +0 -20
- package/template-design-pro/build/utils.ts +0 -85
- package/template-design-pro/build/vite/cdn.ts +0 -7
- package/template-design-pro/build/vite/optimizer.ts +0 -22
- package/template-design-pro/build/vite/plugin/autoImport.ts +0 -18
- package/template-design-pro/build/vite/plugin/compress.ts +0 -35
- package/template-design-pro/build/vite/plugin/hmr.ts +0 -25
- package/template-design-pro/build/vite/plugin/html.ts +0 -47
- package/template-design-pro/build/vite/plugin/index.ts +0 -89
- package/template-design-pro/build/vite/plugin/mock.ts +0 -20
- package/template-design-pro/build/vite/plugin/pwa.ts +0 -37
- package/template-design-pro/build/vite/plugin/styleImport.ts +0 -129
- package/template-design-pro/build/vite/plugin/visualizer.ts +0 -17
- package/template-design-pro/build/vite/plugin/vite-plugin-antd-theme/index.ts +0 -24
- package/template-design-pro/build/vite/plugin/vite-plugin-mock/createMockServer.ts +0 -303
- package/template-design-pro/build/vite/plugin/vite-plugin-mock/createProdMockServer.ts +0 -93
- package/template-design-pro/build/vite/plugin/vite-plugin-mock/index.ts +0 -68
- package/template-design-pro/build/vite/plugin/vite-plugin-mock/types.ts +0 -30
- package/template-design-pro/build/vite/plugin/vite-plugin-mock/utils.ts +0 -26
- package/template-design-pro/commitlint.config.js +0 -32
- package/template-design-pro/config/config.ts +0 -14
- package/template-design-pro/config/default/animate.ts +0 -30
- package/template-design-pro/config/default/defaultSettings.ts +0 -75
- package/template-design-pro/config/default/network.ts +0 -16
- package/template-design-pro/config/default/proxy.ts +0 -26
- package/template-design-pro/config/default/theme.ts +0 -43
- package/template-design-pro/config/default/themeColor.ts +0 -62
- package/template-design-pro/index.html +0 -45
- package/template-design-pro/jest.config.mjs +0 -36
- package/template-design-pro/mock/_createProductionServer.ts +0 -19
- package/template-design-pro/mock/_util.ts +0 -55
- package/template-design-pro/mock/controller/menu.ts +0 -85
- package/template-design-pro/mock/controller/notices.ts +0 -114
- package/template-design-pro/mock/system/dict.ts +0 -60
- package/template-design-pro/mock/system/user.ts +0 -218
- package/template-design-pro/package.json +0 -151
- package/template-design-pro/pnpm-lock.yaml +0 -9913
- package/template-design-pro/postcss.config.js +0 -5
- package/template-design-pro/prettier.config.js +0 -18
- package/template-design-pro/public/resource/css/index.css +0 -171
- package/template-design-pro/public/resource/img/favicon.ico +0 -0
- package/template-design-pro/public/resource/img/logo.png +0 -0
- package/template-design-pro/public/resource/img/pro_icon.svg +0 -5
- package/template-design-pro/public/resource/img/pwa-192x192.png +0 -0
- package/template-design-pro/public/resource/img/pwa-512x512.png +0 -0
- package/template-design-pro/src/App.vue +0 -47
- package/template-design-pro/src/assets/error_images/403.png +0 -0
- package/template-design-pro/src/assets/error_images/404.png +0 -0
- package/template-design-pro/src/assets/error_images/cloud.png +0 -0
- package/template-design-pro/src/assets/login_images/login_background.svg +0 -69
- package/template-design-pro/src/assets/logo.png +0 -0
- package/template-design-pro/src/assets/menu_font/iconfont.css +0 -94
- package/template-design-pro/src/assets/menu_font/iconfont.eot +0 -0
- package/template-design-pro/src/assets/menu_font/iconfont.js +0 -1
- package/template-design-pro/src/assets/menu_font/iconfont.json +0 -142
- package/template-design-pro/src/assets/menu_font/iconfont.svg +0 -57
- package/template-design-pro/src/assets/menu_font/iconfont.ttf +0 -0
- package/template-design-pro/src/assets/menu_font/iconfont.woff +0 -0
- package/template-design-pro/src/assets/menu_font/iconfont.woff2 +0 -0
- package/template-design-pro/src/assets/menu_font/index.less +0 -94
- package/template-design-pro/src/common/global.ts +0 -1
- package/template-design-pro/src/components/GDesign/ProLayout/BasicLayout.less +0 -80
- package/template-design-pro/src/components/GDesign/ProLayout/BasicLayout.tsx +0 -342
- package/template-design-pro/src/components/GDesign/ProLayout/PageLoading.tsx +0 -20
- package/template-design-pro/src/components/GDesign/ProLayout/RenderTypings.ts +0 -31
- package/template-design-pro/src/components/GDesign/ProLayout/RouteContext.tsx +0 -82
- package/template-design-pro/src/components/GDesign/ProLayout/WrapContent.tsx +0 -69
- package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalFooter/index.tsx +0 -88
- package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalHeader/DefaultHeader.tsx +0 -189
- package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalHeader/Header.less +0 -8
- package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalHeader/index.tsx +0 -105
- package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalHeader/props.ts +0 -69
- package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalHeader/style.less +0 -144
- package/template-design-pro/src/components/GDesign/ProLayout/components/LogoContent/index.tsx +0 -81
- package/template-design-pro/src/components/GDesign/ProLayout/components/LogoContent/props.ts +0 -29
- package/template-design-pro/src/components/GDesign/ProLayout/components/MultiTab/index.tsx +0 -384
- package/template-design-pro/src/components/GDesign/ProLayout/components/MultiTab/props.ts +0 -15
- package/template-design-pro/src/components/GDesign/ProLayout/components/MultiTab/style.less +0 -79
- package/template-design-pro/src/components/GDesign/ProLayout/components/NoticeIcon/NoticeIcon.tsx +0 -148
- package/template-design-pro/src/components/GDesign/ProLayout/components/NoticeIcon/NoticeList.module.less +0 -115
- package/template-design-pro/src/components/GDesign/ProLayout/components/NoticeIcon/NoticeList.tsx +0 -154
- package/template-design-pro/src/components/GDesign/ProLayout/components/NoticeIcon/index.less +0 -39
- package/template-design-pro/src/components/GDesign/ProLayout/components/NoticeIcon/index.tsx +0 -133
- package/template-design-pro/src/components/GDesign/ProLayout/components/PageContainer/index.tsx +0 -190
- package/template-design-pro/src/components/GDesign/ProLayout/components/PageContainer/props.ts +0 -48
- package/template-design-pro/src/components/GDesign/ProLayout/components/PageContainer/style.less +0 -128
- package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/AvatarDropdown.tsx +0 -63
- package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/HeaderSearch.tsx +0 -122
- package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/headerSearch.less +0 -30
- package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/index.tsx +0 -95
- package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/style.less +0 -90
- package/template-design-pro/src/components/GDesign/ProLayout/components/SettingDrawer/BlockCheckbox.tsx +0 -70
- package/template-design-pro/src/components/GDesign/ProLayout/components/SettingDrawer/LayoutSetting.tsx +0 -107
- package/template-design-pro/src/components/GDesign/ProLayout/components/SettingDrawer/ThemeColor.tsx +0 -68
- package/template-design-pro/src/components/GDesign/ProLayout/components/SettingDrawer/index.tsx +0 -346
- package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/BaseMenu.tsx +0 -224
- package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/SiderMenu.tsx +0 -224
- package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/index.tsx +0 -43
- package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/props.ts +0 -112
- package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/style.less +0 -262
- package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/typings.ts +0 -44
- package/template-design-pro/src/components/GDesign/ProLayout/default.less +0 -2
- package/template-design-pro/src/components/GDesign/ProLayout/defaultSettings.ts +0 -121
- package/template-design-pro/src/components/GDesign/ProLayout/hooks/context/index.ts +0 -45
- package/template-design-pro/src/components/GDesign/ProLayout/index.ts +0 -43
- package/template-design-pro/src/components/GDesign/ProLayout/props.ts +0 -57
- package/template-design-pro/src/components/GDesign/ProLayout/style.less +0 -272
- package/template-design-pro/src/components/GDesign/ProLayout/typings.ts +0 -1
- package/template-design-pro/src/components/GDesign/ProLayout/utils/getMenuData.ts +0 -31
- package/template-design-pro/src/components/GDesign/ProLayout/utils/index.ts +0 -94
- package/template-design-pro/src/components/GDesign/ProLayout/utils/isImg/index.ts +0 -6
- package/template-design-pro/src/components/GDesign/ProLayout/utils/isUrl/index.ts +0 -5
- package/template-design-pro/src/components/GDesign/Result/index.tsx +0 -142
- package/template-design-pro/src/components/GDesign/Result/style.less +0 -140
- package/template-design-pro/src/components/GDesign/Scrollbars/components/Bar/index.tsx +0 -56
- package/template-design-pro/src/components/GDesign/Scrollbars/components/Bar/props.ts +0 -23
- package/template-design-pro/src/components/GDesign/Scrollbars/components/Thumb/index.tsx +0 -164
- package/template-design-pro/src/components/GDesign/Scrollbars/components/Thumb/props.ts +0 -11
- package/template-design-pro/src/components/GDesign/Scrollbars/context.ts +0 -10
- package/template-design-pro/src/components/GDesign/Scrollbars/index.tsx +0 -200
- package/template-design-pro/src/components/GDesign/Scrollbars/props.ts +0 -65
- package/template-design-pro/src/components/GDesign/Scrollbars/style.less +0 -85
- package/template-design-pro/src/components/GDesign/Scrollbars/util.ts +0 -40
- package/template-design-pro/src/components/GDesign/utils/index.ts +0 -7
- package/template-design-pro/src/components/PageLoading/index.tsx +0 -44
- package/template-design-pro/src/components/PageTransition/index.vue +0 -98
- package/template-design-pro/src/components/index.ts +0 -6
- package/template-design-pro/src/core/ant-design/index.ts +0 -14
- package/template-design-pro/src/core/gx-admin-design/index.ts +0 -7
- package/template-design-pro/src/core/gx-admin-directives/index.ts +0 -8
- package/template-design-pro/src/core/gx-admin-directives/permission.ts +0 -28
- package/template-design-pro/src/core/gx-design/index.ts +0 -7
- package/template-design-pro/src/core/gx-pro-design/index.ts +0 -10
- package/template-design-pro/src/core/index.ts +0 -27
- package/template-design-pro/src/design/ant-design/index.less +0 -4
- package/template-design-pro/src/design/ant-design/layout.less +0 -29
- package/template-design-pro/src/design/ant-design/menu.less +0 -55
- package/template-design-pro/src/design/ant-design/table.less +0 -67
- package/template-design-pro/src/design/ant-design/tooltip.less +0 -13
- package/template-design-pro/src/design/color.less +0 -1
- package/template-design-pro/src/design/config.less +0 -5
- package/template-design-pro/src/design/index.less +0 -41
- package/template-design-pro/src/design/mixin.less +0 -66
- package/template-design-pro/src/design/normalize.less +0 -390
- package/template-design-pro/src/global.less +0 -15
- package/template-design-pro/src/hooks/core/index.ts +0 -3
- package/template-design-pro/src/hooks/core/useRequest/index.ts +0 -70
- package/template-design-pro/src/hooks/core/useRequest/typings.ts +0 -0
- package/template-design-pro/src/hooks/event/index.ts +0 -3
- package/template-design-pro/src/hooks/event/useClipboard.ts +0 -14
- package/template-design-pro/src/hooks/system/index.ts +0 -5
- package/template-design-pro/src/hooks/system/useDict.ts +0 -62
- package/template-design-pro/src/hooks/system/usePermissions.ts +0 -39
- package/template-design-pro/src/hooks/typings.ts +0 -17
- package/template-design-pro/src/layout/BasicLayout.vue +0 -104
- package/template-design-pro/src/layout/BlankLayout.vue +0 -5
- package/template-design-pro/src/layout/ContentView.vue +0 -76
- package/template-design-pro/src/layout/IframeView.vue +0 -1
- package/template-design-pro/src/layout/UserLayout.vue +0 -7
- package/template-design-pro/src/main.ts +0 -34
- package/template-design-pro/src/plugins/index.ts +0 -3
- package/template-design-pro/src/router/guard/index.ts +0 -84
- package/template-design-pro/src/router/guard/permissions.ts +0 -73
- package/template-design-pro/src/router/guard/stateGuard.ts +0 -11
- package/template-design-pro/src/router/helper/routeHelper.ts +0 -244
- package/template-design-pro/src/router/helper/utils.ts +0 -19
- package/template-design-pro/src/router/index.ts +0 -30
- package/template-design-pro/src/router/routes/index.ts +0 -85
- package/template-design-pro/src/router/routes/modules/workplace.ts +0 -19
- package/template-design-pro/src/services/common/index.ts +0 -11
- package/template-design-pro/src/services/controller/router.ts +0 -10
- package/template-design-pro/src/services/controller/user.ts +0 -35
- package/template-design-pro/src/services/system/dictData.ts +0 -10
- package/template-design-pro/src/services/system/notices.ts +0 -9
- package/template-design-pro/src/store/index.ts +0 -32
- package/template-design-pro/src/store/modules/dict.ts +0 -27
- package/template-design-pro/src/store/modules/permission.ts +0 -19
- package/template-design-pro/src/store/modules/routes.ts +0 -110
- package/template-design-pro/src/store/modules/settings.ts +0 -102
- package/template-design-pro/src/store/modules/tabsRouter.ts +0 -73
- package/template-design-pro/src/store/modules/user.ts +0 -153
- package/template-design-pro/src/utils/accessToken.ts +0 -93
- package/template-design-pro/src/utils/crypto.ts +0 -39
- package/template-design-pro/src/utils/env.ts +0 -52
- package/template-design-pro/src/utils/fetchFile.ts +0 -79
- package/template-design-pro/src/utils/index.ts +0 -127
- package/template-design-pro/src/utils/pageTitle.ts +0 -17
- package/template-design-pro/src/utils/request/XHR.ts +0 -131
- package/template-design-pro/src/utils/request/axiosCancel.ts +0 -60
- package/template-design-pro/src/utils/request/checkStatus.ts +0 -26
- package/template-design-pro/src/utils/request/index.ts +0 -145
- package/template-design-pro/src/utils/request/typings.ts +0 -114
- package/template-design-pro/src/utils/storage.ts +0 -194
- package/template-design-pro/src/utils/uploadFile.ts +0 -26
- package/template-design-pro/src/utils/util.ts +0 -278
- package/template-design-pro/src/utils/validate.ts +0 -221
- package/template-design-pro/src/views/Iframe/index.vue +0 -76
- package/template-design-pro/src/views/MenuOne/index.vue +0 -15
- package/template-design-pro/src/views/MenuTwo/index.vue +0 -13
- package/template-design-pro/src/views/exception/403/index.vue +0 -9
- package/template-design-pro/src/views/exception/404/index.vue +0 -9
- package/template-design-pro/src/views/user/login/index.vue +0 -110
- package/template-design-pro/src/views/user/login/style.less +0 -38
- package/template-design-pro/stylelint.config.js +0 -106
- package/template-design-pro/tests/__mocks__/fileMock.ts +0 -1
- package/template-design-pro/tests/__mocks__/styleMock.ts +0 -1
- package/template-design-pro/tests/__mocks__/workerMock.ts +0 -5
- package/template-design-pro/tests/server/README.md +0 -15
- package/template-design-pro/tests/server/controller/FileController.ts +0 -18
- package/template-design-pro/tests/server/controller/UserController.ts +0 -15
- package/template-design-pro/tests/server/ecosystem.config.js +0 -18
- package/template-design-pro/tests/server/index.ts +0 -63
- package/template-design-pro/tests/server/nodemon.json +0 -8
- package/template-design-pro/tests/server/package.json +0 -36
- package/template-design-pro/tests/server/routes.ts +0 -23
- package/template-design-pro/tests/server/service/FileService.ts +0 -54
- package/template-design-pro/tests/server/service/UserService.ts +0 -25
- package/template-design-pro/tests/server/tsconfig.json +0 -15
- package/template-design-pro/tests/server/utils.ts +0 -9
- package/template-design-pro/tests/server/yarn.lock +0 -2955
- package/template-design-pro/tests/test.spec.ts +0 -16
- package/template-design-pro/tsconfig.json +0 -47
- package/template-design-pro/types/auto-imports.d.ts +0 -61
- package/template-design-pro/types/config.d.ts +0 -100
- package/template-design-pro/types/global.d.ts +0 -103
- package/template-design-pro/types/gx-components.d.ts +0 -24
- package/template-design-pro/types/index.d.ts +0 -13
- package/template-design-pro/types/mock.d.ts +0 -23
- package/template-design-pro/types/module.d.ts +0 -16
- package/template-design-pro/types/response.d.ts +0 -15
- package/template-design-pro/types/route.d.ts +0 -89
- package/template-design-pro/vite.config.ts +0 -136
- package/template-design-pro/yarn.lock +0 -9697
package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/BaseMenu.tsx
DELETED
@@ -1,224 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
defineComponent,
|
3
|
-
VNodeChild,
|
4
|
-
VNode,
|
5
|
-
computed,
|
6
|
-
isVNode,
|
7
|
-
resolveComponent,
|
8
|
-
ExtractPropTypes,
|
9
|
-
ConcreteComponent
|
10
|
-
} from 'vue'
|
11
|
-
import { useRouter } from 'vue-router'
|
12
|
-
import { Menu } from 'ant-design-vue'
|
13
|
-
import { createFromIconfontCN } from '@ant-design/icons-vue'
|
14
|
-
import { baseMenuProps } from './props'
|
15
|
-
import { defaultSettings } from '../../defaultSettings'
|
16
|
-
import { isImg, isUrl } from '../../utils'
|
17
|
-
|
18
|
-
export interface CustomMenuRender {
|
19
|
-
menuItemRender?: WithFalse<
|
20
|
-
(args: { item: AppRouteModule; title?: JSX.Element; icon?: JSX.Element }) => CustomRender
|
21
|
-
>
|
22
|
-
subMenuItemRender?: WithFalse<
|
23
|
-
(args: { item: AppRouteModule; children?: CustomRender[] }) => CustomRender
|
24
|
-
>
|
25
|
-
}
|
26
|
-
|
27
|
-
export type BaseMenuProps = ExtractPropTypes<typeof baseMenuProps>
|
28
|
-
|
29
|
-
const IconFont: any = (iconfontUrl) => {
|
30
|
-
return createFromIconfontCN({
|
31
|
-
scriptUrl: iconfontUrl || defaultSettings.iconfontUrl
|
32
|
-
})
|
33
|
-
}
|
34
|
-
|
35
|
-
const LazyIcon = (props: {
|
36
|
-
icon: VNodeChild | string
|
37
|
-
iconType?: number
|
38
|
-
iconfontUrl?: string
|
39
|
-
}) => {
|
40
|
-
const { icon, iconType, iconfontUrl } = props
|
41
|
-
if (!icon) {
|
42
|
-
return null
|
43
|
-
}
|
44
|
-
if (typeof icon === 'string' && icon !== '') {
|
45
|
-
if (isUrl(icon) || isImg(icon)) {
|
46
|
-
return <img src={icon} alt="icon" class={`gx-pro-sider-menu-icon customimg`} />
|
47
|
-
}
|
48
|
-
if (iconType === 1) {
|
49
|
-
return iconfontUrl ? <IconFont type={icon} /> : <i class={`iconfont ${icon} customicon`}></i>
|
50
|
-
}
|
51
|
-
}
|
52
|
-
if (isVNode(icon)) {
|
53
|
-
return icon
|
54
|
-
}
|
55
|
-
const DynamicIcon = resolveComponent(icon as string) as any
|
56
|
-
return (typeof LazyIcon === 'function' && <DynamicIcon />) || null
|
57
|
-
}
|
58
|
-
|
59
|
-
LazyIcon.props = {
|
60
|
-
icon: {
|
61
|
-
type: [String, Function, Object] as PropType<string | Function | VNode | JSX.Element>
|
62
|
-
},
|
63
|
-
iconType: Number,
|
64
|
-
iconfontUrl: String
|
65
|
-
}
|
66
|
-
|
67
|
-
export default defineComponent({
|
68
|
-
name: 'BaseMenu',
|
69
|
-
props: baseMenuProps,
|
70
|
-
emits: ['update:openKeys', 'update:selectedKeys', 'click'],
|
71
|
-
setup(props, { attrs, emit }) {
|
72
|
-
const router = useRouter()
|
73
|
-
const handleOpenChange = (openKeys: string[]): void => {
|
74
|
-
emit('update:openKeys', openKeys)
|
75
|
-
}
|
76
|
-
const handleSelect = (params: {
|
77
|
-
key: string | number
|
78
|
-
keyPath: string[] | number[]
|
79
|
-
item: VNodeChild | any
|
80
|
-
domEvent: MouseEvent
|
81
|
-
selectedKeys: string[]
|
82
|
-
}): void => {
|
83
|
-
emit('update:selectedKeys', params.selectedKeys)
|
84
|
-
}
|
85
|
-
const handleClick = (args: {
|
86
|
-
item: VNodeChild
|
87
|
-
key: string | number
|
88
|
-
keyPath: string | string[] | number | number[]
|
89
|
-
}) => {
|
90
|
-
emit('click', args)
|
91
|
-
}
|
92
|
-
const isTotargetLink = (meta: any, routerInfo: any) => {
|
93
|
-
const target = (meta.target || '') as string
|
94
|
-
const hasUrl = isUrl(target)
|
95
|
-
if (router.currentRoute.value?.fullPath !== routerInfo.to) {
|
96
|
-
if (hasUrl && target && meta.targetStatus === 1) {
|
97
|
-
window.open(target)
|
98
|
-
}
|
99
|
-
}
|
100
|
-
}
|
101
|
-
const RouterLink = resolveComponent('router-link') as ConcreteComponent
|
102
|
-
const getNavMenuItems = (menusData: AppRouteModule[] = []) => {
|
103
|
-
return menusData.map((item) => getSubMenuOrItem(item)).filter((item) => item)
|
104
|
-
}
|
105
|
-
const getSubMenuOrItem = (item: AppRouteModule): VNode => {
|
106
|
-
if (
|
107
|
-
Array.isArray(item.children) &&
|
108
|
-
item.children.length > 0 &&
|
109
|
-
!item?.meta?.hideInMenu &&
|
110
|
-
!item?.meta?.hideChildrenInMenu
|
111
|
-
) {
|
112
|
-
if (props.subMenuItemRender) {
|
113
|
-
return props.subMenuItemRender({
|
114
|
-
item,
|
115
|
-
children: getNavMenuItems(item.children)
|
116
|
-
}) as VNode
|
117
|
-
}
|
118
|
-
const menuTitle = item.meta?.title
|
119
|
-
const defaultTitle = item.meta?.icon ? (
|
120
|
-
<span class={`gx-pro-sider-menu-item`}>
|
121
|
-
<span class={`gx-pro-sider-menu-item-title`}>{menuTitle}</span>
|
122
|
-
</span>
|
123
|
-
) : (
|
124
|
-
<span class={`gx-pro-sider-menu-item`}>{menuTitle}</span>
|
125
|
-
)
|
126
|
-
|
127
|
-
const hasGroup = item.meta?.type === 'group'
|
128
|
-
|
129
|
-
const MenuComponent = hasGroup ? Menu.ItemGroup : Menu.SubMenu
|
130
|
-
|
131
|
-
return (
|
132
|
-
<MenuComponent
|
133
|
-
title={defaultTitle}
|
134
|
-
key={item.path}
|
135
|
-
icon={
|
136
|
-
hasGroup ? null : (
|
137
|
-
<LazyIcon
|
138
|
-
icon={item.meta?.icon}
|
139
|
-
iconfontUrl={props.iconfontUrl}
|
140
|
-
iconType={item.meta?.iconType}
|
141
|
-
/>
|
142
|
-
)
|
143
|
-
}
|
144
|
-
>
|
145
|
-
{getNavMenuItems(item.children)}
|
146
|
-
</MenuComponent>
|
147
|
-
)
|
148
|
-
}
|
149
|
-
|
150
|
-
const [title, icon] = getMenuItem(item)
|
151
|
-
|
152
|
-
return (
|
153
|
-
((props.menuItemRender && props.menuItemRender({ item, title, icon })) as VNode) || (
|
154
|
-
<Menu.Item
|
155
|
-
disabled={item.meta?.disabled}
|
156
|
-
danger={item.meta?.danger}
|
157
|
-
key={item.path}
|
158
|
-
icon={icon}
|
159
|
-
>
|
160
|
-
{title}
|
161
|
-
</Menu.Item>
|
162
|
-
)
|
163
|
-
)
|
164
|
-
}
|
165
|
-
const getMenuItem = (item: AppRouteModule) => {
|
166
|
-
const meta = { ...item.meta }
|
167
|
-
const CustomTag: any = meta.targetStatus === 1 && meta.target ? 'a' : RouterLink
|
168
|
-
const parames = { to: item.linkPath || item.path || '' }
|
169
|
-
if (parames.to === '/live/list/operation/:id') parames.to = '/live/list/operation/add'
|
170
|
-
|
171
|
-
const menuTitle = item.meta?.title
|
172
|
-
const defaultTitle = item.meta?.icon ? (
|
173
|
-
<CustomTag
|
174
|
-
{...parames}
|
175
|
-
class={`gx-pro-sider-menu-item`}
|
176
|
-
onClick={() => isTotargetLink(meta, parames)}
|
177
|
-
>
|
178
|
-
<span class={`gx-pro-sider-menu-item-title`}>{menuTitle}</span>
|
179
|
-
</CustomTag>
|
180
|
-
) : (
|
181
|
-
<CustomTag
|
182
|
-
{...parames}
|
183
|
-
class={`gx-pro-sider-menu-item`}
|
184
|
-
onClick={() => isTotargetLink(meta, parames)}
|
185
|
-
>
|
186
|
-
<span>{menuTitle}</span>
|
187
|
-
</CustomTag>
|
188
|
-
)
|
189
|
-
|
190
|
-
const icon =
|
191
|
-
(item.meta?.icon && (
|
192
|
-
<LazyIcon
|
193
|
-
icon={item.meta?.icon}
|
194
|
-
iconfontUrl={props.iconfontUrl}
|
195
|
-
iconType={item.meta?.iconType}
|
196
|
-
/>
|
197
|
-
)) ||
|
198
|
-
undefined
|
199
|
-
|
200
|
-
return [defaultTitle, icon]
|
201
|
-
}
|
202
|
-
const getMenuItems = computed(() => {
|
203
|
-
return getNavMenuItems(props.menuData)
|
204
|
-
})
|
205
|
-
return () => (
|
206
|
-
<Menu
|
207
|
-
key="Menu"
|
208
|
-
inlineIndent={16}
|
209
|
-
mode={props.mode}
|
210
|
-
theme={props.theme as 'dark' | 'light'}
|
211
|
-
openKeys={props.openKeys === false ? [] : props.openKeys}
|
212
|
-
selectedKeys={props.selectedKeys || []}
|
213
|
-
style={attrs.style}
|
214
|
-
class={attrs.class}
|
215
|
-
onOpenChange={handleOpenChange}
|
216
|
-
onSelect={handleSelect}
|
217
|
-
onClick={handleClick}
|
218
|
-
{...props.menuProps}
|
219
|
-
>
|
220
|
-
{getMenuItems.value}
|
221
|
-
</Menu>
|
222
|
-
)
|
223
|
-
}
|
224
|
-
})
|
package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/SiderMenu.tsx
DELETED
@@ -1,224 +0,0 @@
|
|
1
|
-
import type { FunctionalComponent as FC, ExtractPropTypes } from 'vue'
|
2
|
-
import { computed, unref } from 'vue'
|
3
|
-
import { Layout, Spin, Menu } from 'ant-design-vue'
|
4
|
-
import { MenuUnfoldOutlined, MenuFoldOutlined } from '@ant-design/icons-vue'
|
5
|
-
import BaseMenu from './BaseMenu'
|
6
|
-
import { siderMenuProps } from './props'
|
7
|
-
import LogoContent from '../LogoContent'
|
8
|
-
import { useRouteContext } from '../../RouteContext'
|
9
|
-
|
10
|
-
const { Sider } = Layout
|
11
|
-
|
12
|
-
const { Item } = Menu
|
13
|
-
|
14
|
-
export type SiderMenuProps = Partial<ExtractPropTypes<typeof siderMenuProps>>
|
15
|
-
|
16
|
-
export type PrivateSiderMenuProps = {
|
17
|
-
matchMenuKeys?: string[]
|
18
|
-
}
|
19
|
-
|
20
|
-
export const defaultRenderCollapsedButton = (collapsed?: boolean): CustomRender =>
|
21
|
-
collapsed ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />
|
22
|
-
|
23
|
-
const SiderMenu: FC<SiderMenuProps> = (props: SiderMenuProps) => {
|
24
|
-
const {
|
25
|
-
theme,
|
26
|
-
layout,
|
27
|
-
isMobile,
|
28
|
-
menuLoading,
|
29
|
-
breakpoint,
|
30
|
-
fixSiderbar,
|
31
|
-
collapsed,
|
32
|
-
siderWidth,
|
33
|
-
collapsedWidth = 48,
|
34
|
-
menuExtraRender = false,
|
35
|
-
menuContentRender = false,
|
36
|
-
menuFooterRender = false,
|
37
|
-
collapsedButtonRender = defaultRenderCollapsedButton,
|
38
|
-
links,
|
39
|
-
onCollapse,
|
40
|
-
onOpenKeys
|
41
|
-
} = props
|
42
|
-
|
43
|
-
const context = useRouteContext()
|
44
|
-
|
45
|
-
const baseClassName = context.getPrefixCls({
|
46
|
-
suffixCls: 'sider',
|
47
|
-
isPor: true
|
48
|
-
})
|
49
|
-
|
50
|
-
const hasContentWide = computed(() => props.layout === 'wide')
|
51
|
-
const hasSplitMenu = computed(() => props.layout === 'mix' && !props.isMobile && props.splitMenus)
|
52
|
-
const layoutSide = computed(() => layout === 'side' || layout === 'simple')
|
53
|
-
const sTheme = computed(
|
54
|
-
() => ((props.layout === 'mix' || hasContentWide.value) && 'light') || theme
|
55
|
-
)
|
56
|
-
const sSideWidth = computed(() => (props.collapsed ? props.collapsedWidth : props.siderWidth))
|
57
|
-
const classNames = computed(() => {
|
58
|
-
return [
|
59
|
-
baseClassName,
|
60
|
-
isMobile ? 'shadow' : null,
|
61
|
-
sTheme.value,
|
62
|
-
hasContentWide.value ? 'wide' : null,
|
63
|
-
fixSiderbar && props.layout !== 'wide' ? `${baseClassName}-fixed` : null
|
64
|
-
]
|
65
|
-
})
|
66
|
-
|
67
|
-
const handleSelect = ($event: string[]) => {
|
68
|
-
if (props.onSelect) {
|
69
|
-
if (unref(hasSplitMenu)) {
|
70
|
-
props.onSelect([context?.selectedKeys?.[0], ...$event])
|
71
|
-
return
|
72
|
-
}
|
73
|
-
props.onSelect($event)
|
74
|
-
}
|
75
|
-
}
|
76
|
-
|
77
|
-
if (hasSplitMenu.value && unref(context.flatMenuData).length === 0) {
|
78
|
-
return null
|
79
|
-
}
|
80
|
-
|
81
|
-
const defaultMenuDom = (
|
82
|
-
<BaseMenu
|
83
|
-
class={`${baseClassName}-menu`}
|
84
|
-
theme={sTheme.value}
|
85
|
-
mode="inline"
|
86
|
-
menuData={hasSplitMenu.value ? context.flatMenuData : context.menuData}
|
87
|
-
collapsed={props.collapsed}
|
88
|
-
openKeys={context.openKeys}
|
89
|
-
selectedKeys={context.selectedKeys}
|
90
|
-
menuItemRender={props.menuItemRender}
|
91
|
-
subMenuItemRender={props.subMenuItemRender}
|
92
|
-
onClick={props.onMenuClick}
|
93
|
-
style={{
|
94
|
-
width: '100%'
|
95
|
-
}}
|
96
|
-
{...{
|
97
|
-
'onUpdate:openKeys': ($event: string[]) => onOpenKeys && onOpenKeys($event),
|
98
|
-
'onUpdate:selectedKeys': handleSelect
|
99
|
-
}}
|
100
|
-
/>
|
101
|
-
)
|
102
|
-
|
103
|
-
const headerDom =
|
104
|
-
layoutSide.value || isMobile ? <LogoContent drawer={isMobile} {...props} /> : null
|
105
|
-
|
106
|
-
const extraDom = menuExtraRender && menuExtraRender(props)
|
107
|
-
|
108
|
-
const linksChild = computed(() => {
|
109
|
-
if (typeof links === 'function') return links?.()
|
110
|
-
return links
|
111
|
-
})
|
112
|
-
|
113
|
-
watch(
|
114
|
-
() => sTheme.value,
|
115
|
-
(val) => {
|
116
|
-
console.log(val)
|
117
|
-
}
|
118
|
-
)
|
119
|
-
|
120
|
-
return (
|
121
|
-
<>
|
122
|
-
{!!(hasSplitMenu.value ? context.flatMenuData : context.menuData).length && (
|
123
|
-
<>
|
124
|
-
{fixSiderbar && (
|
125
|
-
<div
|
126
|
-
style={{
|
127
|
-
width: `${sSideWidth.value}px`,
|
128
|
-
overflow: 'hidden',
|
129
|
-
flex: `0 0 ${sSideWidth.value}px`,
|
130
|
-
maxWidth: `${sSideWidth.value}px`,
|
131
|
-
minWidth: `${sSideWidth.value}px`,
|
132
|
-
transition: `background-color 0.3s, min-width 0.3s, max-width 0.3s cubic-bezier(0.645, 0.045, 0.355, 1)`
|
133
|
-
}}
|
134
|
-
/>
|
135
|
-
)}
|
136
|
-
<Sider
|
137
|
-
collapsible
|
138
|
-
trigger={null}
|
139
|
-
class={classNames.value}
|
140
|
-
style={{
|
141
|
-
overflow: 'hidden',
|
142
|
-
zIndex: fixSiderbar ? 101 : undefined,
|
143
|
-
paddingTop:
|
144
|
-
layoutSide.value || props.isMobile || hasContentWide.value
|
145
|
-
? 0
|
146
|
-
: `${props.headerHeight}px`,
|
147
|
-
top: props.layout === 'wide' ? `${props.headerHeight + 20}px` : undefined,
|
148
|
-
height:
|
149
|
-
props.layout === 'wide'
|
150
|
-
? `calc(100vh - ${props.headerHeight + 20 * 2}px)`
|
151
|
-
: undefined
|
152
|
-
}}
|
153
|
-
theme={sTheme.value}
|
154
|
-
breakpoint={breakpoint || undefined}
|
155
|
-
collapsed={collapsed}
|
156
|
-
width={siderWidth}
|
157
|
-
collapsedWidth={collapsedWidth}
|
158
|
-
onCollapse={(collapse) => {
|
159
|
-
if (props.isMobile) return
|
160
|
-
onCollapse?.(collapse)
|
161
|
-
}}
|
162
|
-
>
|
163
|
-
{menuLoading && (
|
164
|
-
<div class="gx-pro-sider-loading">
|
165
|
-
<Spin spinning={menuLoading} />
|
166
|
-
</div>
|
167
|
-
)}
|
168
|
-
{headerDom || null}
|
169
|
-
{extraDom && !props.collapsed && (
|
170
|
-
<div
|
171
|
-
class={{
|
172
|
-
[`${baseClassName}-extra`]: true,
|
173
|
-
[`${baseClassName}-extra-no-logo`]: !headerDom
|
174
|
-
}}
|
175
|
-
>
|
176
|
-
{extraDom}
|
177
|
-
</div>
|
178
|
-
)}
|
179
|
-
<div style="flex: 1 1 0%; overflow: hidden auto">
|
180
|
-
{(menuContentRender && menuContentRender(props, defaultMenuDom)) || defaultMenuDom}
|
181
|
-
</div>
|
182
|
-
{props.layout !== 'wide' && (
|
183
|
-
<div class={`${baseClassName}-links`}>
|
184
|
-
<Menu
|
185
|
-
theme={sTheme.value}
|
186
|
-
inlineIndent={16}
|
187
|
-
class={`${baseClassName}-link-menu`}
|
188
|
-
selectedKeys={[]}
|
189
|
-
openKeys={[]}
|
190
|
-
mode="inline"
|
191
|
-
>
|
192
|
-
{((linksChild.value || []) as any[]).map((node, index) => (
|
193
|
-
<Item class={`${baseClassName}-link`} key={index}>
|
194
|
-
{node}
|
195
|
-
</Item>
|
196
|
-
))}
|
197
|
-
{collapsedButtonRender && !isMobile && (
|
198
|
-
<Item
|
199
|
-
class={`${baseClassName}-collapsed-button`}
|
200
|
-
title={false}
|
201
|
-
key="collapsed"
|
202
|
-
onClick={() => {
|
203
|
-
if (onCollapse) {
|
204
|
-
onCollapse(!collapsed)
|
205
|
-
}
|
206
|
-
}}
|
207
|
-
>
|
208
|
-
{collapsedButtonRender(collapsed)}
|
209
|
-
</Item>
|
210
|
-
)}
|
211
|
-
</Menu>
|
212
|
-
</div>
|
213
|
-
)}
|
214
|
-
{menuFooterRender && (
|
215
|
-
<div class={`${baseClassName}-footer`}>{menuFooterRender(props)}</div>
|
216
|
-
)}
|
217
|
-
</Sider>
|
218
|
-
</>
|
219
|
-
)}
|
220
|
-
</>
|
221
|
-
)
|
222
|
-
}
|
223
|
-
|
224
|
-
export default SiderMenu
|
@@ -1,43 +0,0 @@
|
|
1
|
-
import type { FunctionalComponent as FC } from 'vue'
|
2
|
-
import { Drawer } from 'ant-design-vue'
|
3
|
-
import { siderMenuProps } from './props'
|
4
|
-
import SiderMenu, { SiderMenuProps, PrivateSiderMenuProps } from './SiderMenu'
|
5
|
-
|
6
|
-
export type SiderMenuWrapperProps = Partial<SiderMenuProps> & Partial<PrivateSiderMenuProps>
|
7
|
-
|
8
|
-
const SiderMenuWrapper: FC<SiderMenuWrapperProps> = (props, { attrs }) => {
|
9
|
-
return props.isMobile ? (
|
10
|
-
<Drawer
|
11
|
-
visible={!props.collapsed}
|
12
|
-
closable={false}
|
13
|
-
placement="left"
|
14
|
-
style={{
|
15
|
-
padding: 0,
|
16
|
-
height: '100vh'
|
17
|
-
}}
|
18
|
-
onClose={() => props.onCollapse && props.onCollapse(true)}
|
19
|
-
width={props.siderWidth}
|
20
|
-
bodyStyle={{
|
21
|
-
height: '100vh',
|
22
|
-
padding: 0,
|
23
|
-
display: 'flex',
|
24
|
-
flexDirection: 'row'
|
25
|
-
}}
|
26
|
-
>
|
27
|
-
<SiderMenu {...attrs} {...props} collapsed={props.isMobile ? false : props.collapsed} />
|
28
|
-
</Drawer>
|
29
|
-
) : (
|
30
|
-
<SiderMenu {...attrs} {...props} />
|
31
|
-
)
|
32
|
-
}
|
33
|
-
|
34
|
-
SiderMenuWrapper.inheritAttrs = false
|
35
|
-
SiderMenuWrapper.displayName = 'SiderMenuWrapper'
|
36
|
-
|
37
|
-
export {
|
38
|
-
SiderMenu,
|
39
|
-
// vue props
|
40
|
-
siderMenuProps
|
41
|
-
}
|
42
|
-
|
43
|
-
export default SiderMenuWrapper
|
@@ -1,112 +0,0 @@
|
|
1
|
-
import type { themeConfig, MenuTheme } from '/types/config'
|
2
|
-
import { PropTypes } from '@/utils'
|
3
|
-
import type { CustomMenuRender } from './BaseMenu'
|
4
|
-
import type { SiderProps, MenuMode } from './typings'
|
5
|
-
import logoContentProps from '../LogoContent/props'
|
6
|
-
import type { LinksRender, MenuExtraRender, MenuFooterRender } from '../../RenderTypings'
|
7
|
-
import { defaultSettingProps } from '../../defaultSettings'
|
8
|
-
import { HeaderLogoRender, MenuContentRender } from '../../RenderTypings'
|
9
|
-
|
10
|
-
export const baseMenuProps = {
|
11
|
-
...defaultSettingProps,
|
12
|
-
|
13
|
-
mode: {
|
14
|
-
type: String as PropType<MenuMode>,
|
15
|
-
default: 'inline'
|
16
|
-
},
|
17
|
-
menuData: {
|
18
|
-
type: Array as PropType<AppRouteModule[]>,
|
19
|
-
default: () => []
|
20
|
-
},
|
21
|
-
theme: {
|
22
|
-
type: String as PropType<MenuTheme>,
|
23
|
-
default: 'dark'
|
24
|
-
},
|
25
|
-
layout: {
|
26
|
-
type: String as PropType<themeConfig['layout']>,
|
27
|
-
default: 'mix'
|
28
|
-
},
|
29
|
-
collapsed: {
|
30
|
-
type: Boolean as PropType<boolean | undefined>,
|
31
|
-
default: () => false
|
32
|
-
},
|
33
|
-
openKeys: {
|
34
|
-
type: Array as PropType<WithFalse<string[]>>,
|
35
|
-
default: () => undefined
|
36
|
-
},
|
37
|
-
selectedKeys: {
|
38
|
-
type: Array as PropType<WithFalse<string[]>>,
|
39
|
-
default: () => undefined
|
40
|
-
},
|
41
|
-
menuProps: {
|
42
|
-
type: Object as PropType<Record<string, any>>,
|
43
|
-
default: () => null
|
44
|
-
},
|
45
|
-
menuItemRender: {
|
46
|
-
type: [ Function, Boolean ] as PropType<CustomMenuRender['menuItemRender']>,
|
47
|
-
default: () => false
|
48
|
-
},
|
49
|
-
subMenuItemRender: {
|
50
|
-
type: [ Function, Boolean ] as PropType<CustomMenuRender['subMenuItemRender']>,
|
51
|
-
default: () => false
|
52
|
-
},
|
53
|
-
onClick: [ Function, Object ] as PropType<(...args: any) => void>
|
54
|
-
}
|
55
|
-
|
56
|
-
export const siderMenuProps = {
|
57
|
-
...defaultSettingProps,
|
58
|
-
...baseMenuProps,
|
59
|
-
menuLoading: PropTypes.looseBool,
|
60
|
-
logo: logoContentProps.logo,
|
61
|
-
logoStyle: logoContentProps.logoStyle,
|
62
|
-
logoDirection: logoContentProps.logoDirection,
|
63
|
-
siderWidth: PropTypes.number.def(208),
|
64
|
-
headerHeight: PropTypes.number.def(48),
|
65
|
-
collapsedWidth: PropTypes.number.def(48),
|
66
|
-
links: {
|
67
|
-
type: [ Function, Object, Array ] as PropType<LinksRender>,
|
68
|
-
default: () => undefined
|
69
|
-
},
|
70
|
-
menuHeaderRender: {
|
71
|
-
type: [ Function, Object ] as PropType<HeaderLogoRender>,
|
72
|
-
default: () => undefined
|
73
|
-
},
|
74
|
-
menuFooterRender: {
|
75
|
-
type: [ Function, Object ] as PropType<MenuFooterRender>,
|
76
|
-
default: () => undefined
|
77
|
-
},
|
78
|
-
menuContentRender: {
|
79
|
-
type: [ Function, Object ] as PropType<MenuContentRender>,
|
80
|
-
default: () => undefined
|
81
|
-
},
|
82
|
-
menuExtraRender: {
|
83
|
-
type: [ Function, Object ] as PropType<MenuExtraRender>,
|
84
|
-
default: () => undefined
|
85
|
-
},
|
86
|
-
collapsedButtonRender: {
|
87
|
-
type: [ Function, Object, Boolean ] as PropType<WithFalse<(collapsed?: boolean) => CustomRender>>,
|
88
|
-
default: () => undefined
|
89
|
-
},
|
90
|
-
breakpoint: {
|
91
|
-
type: [ Object, Boolean ] as PropType<SiderProps['breakpoint'] | false>,
|
92
|
-
default: () => false
|
93
|
-
},
|
94
|
-
isMobile: PropTypes.looseBool,
|
95
|
-
matchMenuKeys: {
|
96
|
-
type: Array as PropType<string[]>,
|
97
|
-
default: () => []
|
98
|
-
},
|
99
|
-
|
100
|
-
// events
|
101
|
-
onMenuHeaderClick: PropTypes.func,
|
102
|
-
onMenuClick: PropTypes.func,
|
103
|
-
onCollapse: {
|
104
|
-
type: Function as PropType<(collapsed: boolean) => void>
|
105
|
-
},
|
106
|
-
onOpenKeys: {
|
107
|
-
type: Function as PropType<(openKeys: WithFalse<string[]>) => void>
|
108
|
-
},
|
109
|
-
onSelect: {
|
110
|
-
type: Function as PropType<(selectedKeys: WithFalse<string[]>) => void>
|
111
|
-
}
|
112
|
-
}
|