@gx-design-vue/create-gx-cli 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/main.js +1 -0
- package/template-design-pro/.editorconfig +19 -0
- package/template-design-pro/.env +2 -0
- package/template-design-pro/.env.development +18 -0
- package/template-design-pro/.env.pro +32 -0
- package/template-design-pro/.env.production +32 -0
- package/template-design-pro/.env.test +20 -0
- package/template-design-pro/.eslintignore +16 -0
- package/template-design-pro/.eslintrc.js +64 -0
- package/template-design-pro/.gitpod.yml +6 -0
- package/template-design-pro/.husky/pre-commit +4 -0
- package/template-design-pro/.prettierignore +9 -0
- package/template-design-pro/.stylelintignore +3 -0
- package/template-design-pro/.yarnclean +48 -0
- package/template-design-pro/LICENSE +21 -0
- package/template-design-pro/README.md +111 -0
- package/template-design-pro/build/constant.ts +6 -0
- package/template-design-pro/build/generate/generateModifyVars.ts +18 -0
- package/template-design-pro/build/getConfigFileName.ts +13 -0
- package/template-design-pro/build/script/buildConf.ts +44 -0
- package/template-design-pro/build/script/postBuild.ts +25 -0
- package/template-design-pro/build/script/reSetRootHtml.ts +20 -0
- package/template-design-pro/build/utils.ts +85 -0
- package/template-design-pro/build/vite/cdn.ts +7 -0
- package/template-design-pro/build/vite/optimizer.ts +22 -0
- package/template-design-pro/build/vite/plugin/autoImport.ts +18 -0
- package/template-design-pro/build/vite/plugin/compress.ts +35 -0
- package/template-design-pro/build/vite/plugin/hmr.ts +25 -0
- package/template-design-pro/build/vite/plugin/html.ts +47 -0
- package/template-design-pro/build/vite/plugin/index.ts +89 -0
- package/template-design-pro/build/vite/plugin/mock.ts +20 -0
- package/template-design-pro/build/vite/plugin/pwa.ts +37 -0
- package/template-design-pro/build/vite/plugin/styleImport.ts +129 -0
- package/template-design-pro/build/vite/plugin/visualizer.ts +17 -0
- package/template-design-pro/build/vite/plugin/vite-plugin-antd-theme/index.ts +24 -0
- package/template-design-pro/build/vite/plugin/vite-plugin-mock/createMockServer.ts +303 -0
- package/template-design-pro/build/vite/plugin/vite-plugin-mock/createProdMockServer.ts +93 -0
- package/template-design-pro/build/vite/plugin/vite-plugin-mock/index.ts +68 -0
- package/template-design-pro/build/vite/plugin/vite-plugin-mock/types.ts +30 -0
- package/template-design-pro/build/vite/plugin/vite-plugin-mock/utils.ts +26 -0
- package/template-design-pro/commitlint.config.js +32 -0
- package/template-design-pro/config/config.ts +14 -0
- package/template-design-pro/config/default/animate.ts +30 -0
- package/template-design-pro/config/default/defaultSettings.ts +75 -0
- package/template-design-pro/config/default/network.ts +16 -0
- package/template-design-pro/config/default/proxy.ts +26 -0
- package/template-design-pro/config/default/theme.ts +43 -0
- package/template-design-pro/config/default/themeColor.ts +62 -0
- package/template-design-pro/index.html +45 -0
- package/template-design-pro/jest.config.mjs +36 -0
- package/template-design-pro/mock/_createProductionServer.ts +19 -0
- package/template-design-pro/mock/_util.ts +55 -0
- package/template-design-pro/mock/controller/menu.ts +85 -0
- package/template-design-pro/mock/controller/notices.ts +114 -0
- package/template-design-pro/mock/system/dict.ts +60 -0
- package/template-design-pro/mock/system/user.ts +218 -0
- package/template-design-pro/package.json +151 -0
- package/template-design-pro/pnpm-lock.yaml +9913 -0
- package/template-design-pro/postcss.config.js +5 -0
- package/template-design-pro/prettier.config.js +18 -0
- package/template-design-pro/public/resource/css/index.css +171 -0
- 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 +5 -0
- 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 +47 -0
- 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 +69 -0
- package/template-design-pro/src/assets/logo.png +0 -0
- package/template-design-pro/src/assets/menu_font/iconfont.css +94 -0
- package/template-design-pro/src/assets/menu_font/iconfont.eot +0 -0
- package/template-design-pro/src/assets/menu_font/iconfont.js +1 -0
- package/template-design-pro/src/assets/menu_font/iconfont.json +142 -0
- package/template-design-pro/src/assets/menu_font/iconfont.svg +57 -0
- 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 +94 -0
- package/template-design-pro/src/common/global.ts +1 -0
- package/template-design-pro/src/components/GDesign/ProLayout/BasicLayout.less +80 -0
- package/template-design-pro/src/components/GDesign/ProLayout/BasicLayout.tsx +342 -0
- package/template-design-pro/src/components/GDesign/ProLayout/PageLoading.tsx +20 -0
- package/template-design-pro/src/components/GDesign/ProLayout/RenderTypings.ts +31 -0
- package/template-design-pro/src/components/GDesign/ProLayout/RouteContext.tsx +82 -0
- package/template-design-pro/src/components/GDesign/ProLayout/WrapContent.tsx +69 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalFooter/index.tsx +88 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalHeader/DefaultHeader.tsx +189 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalHeader/Header.less +8 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalHeader/index.tsx +105 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalHeader/props.ts +69 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalHeader/style.less +144 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/LogoContent/index.tsx +81 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/LogoContent/props.ts +29 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/MultiTab/index.tsx +384 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/MultiTab/props.ts +15 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/MultiTab/style.less +79 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/NoticeIcon/NoticeIcon.tsx +148 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/NoticeIcon/NoticeList.module.less +115 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/NoticeIcon/NoticeList.tsx +154 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/NoticeIcon/index.less +39 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/NoticeIcon/index.tsx +133 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/PageContainer/index.tsx +190 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/PageContainer/props.ts +48 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/PageContainer/style.less +128 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/PageContainer/typings.ts +0 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/AvatarDropdown.tsx +63 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/HeaderSearch.tsx +122 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/headerSearch.less +30 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/index.tsx +95 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/style.less +90 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/SettingDrawer/BlockCheckbox.tsx +70 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/SettingDrawer/LayoutSetting.tsx +107 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/SettingDrawer/ThemeColor.tsx +68 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/SettingDrawer/index.tsx +346 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/BaseMenu.tsx +224 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/SiderMenu.tsx +224 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/index.tsx +43 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/props.ts +112 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/style.less +262 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/typings.ts +44 -0
- package/template-design-pro/src/components/GDesign/ProLayout/default.less +2 -0
- package/template-design-pro/src/components/GDesign/ProLayout/defaultSettings.ts +121 -0
- package/template-design-pro/src/components/GDesign/ProLayout/hooks/context/index.ts +45 -0
- package/template-design-pro/src/components/GDesign/ProLayout/index.ts +43 -0
- package/template-design-pro/src/components/GDesign/ProLayout/props.ts +57 -0
- package/template-design-pro/src/components/GDesign/ProLayout/style.less +272 -0
- package/template-design-pro/src/components/GDesign/ProLayout/typings.ts +1 -0
- package/template-design-pro/src/components/GDesign/ProLayout/utils/getMenuData.ts +31 -0
- package/template-design-pro/src/components/GDesign/ProLayout/utils/index.ts +94 -0
- package/template-design-pro/src/components/GDesign/ProLayout/utils/isImg/index.ts +6 -0
- package/template-design-pro/src/components/GDesign/ProLayout/utils/isUrl/index.ts +5 -0
- package/template-design-pro/src/components/GDesign/Result/index.tsx +142 -0
- package/template-design-pro/src/components/GDesign/Result/style.less +140 -0
- package/template-design-pro/src/components/GDesign/Scrollbars/components/Bar/index.tsx +56 -0
- package/template-design-pro/src/components/GDesign/Scrollbars/components/Bar/props.ts +23 -0
- package/template-design-pro/src/components/GDesign/Scrollbars/components/Thumb/index.tsx +164 -0
- package/template-design-pro/src/components/GDesign/Scrollbars/components/Thumb/props.ts +11 -0
- package/template-design-pro/src/components/GDesign/Scrollbars/context.ts +10 -0
- package/template-design-pro/src/components/GDesign/Scrollbars/index.tsx +200 -0
- package/template-design-pro/src/components/GDesign/Scrollbars/props.ts +65 -0
- package/template-design-pro/src/components/GDesign/Scrollbars/style.less +85 -0
- package/template-design-pro/src/components/GDesign/Scrollbars/util.ts +40 -0
- package/template-design-pro/src/components/GDesign/utils/index.ts +7 -0
- package/template-design-pro/src/components/PageLoading/index.tsx +44 -0
- package/template-design-pro/src/components/PageTransition/index.vue +98 -0
- package/template-design-pro/src/components/index.ts +6 -0
- package/template-design-pro/src/core/ant-design/index.ts +14 -0
- package/template-design-pro/src/core/gx-admin-design/index.ts +7 -0
- package/template-design-pro/src/core/gx-admin-directives/index.ts +8 -0
- package/template-design-pro/src/core/gx-admin-directives/permission.ts +28 -0
- package/template-design-pro/src/core/gx-design/index.ts +7 -0
- package/template-design-pro/src/core/gx-pro-design/index.ts +10 -0
- package/template-design-pro/src/core/index.ts +27 -0
- package/template-design-pro/src/design/ant-design/index.less +4 -0
- package/template-design-pro/src/design/ant-design/layout.less +29 -0
- package/template-design-pro/src/design/ant-design/menu.less +55 -0
- package/template-design-pro/src/design/ant-design/table.less +67 -0
- package/template-design-pro/src/design/ant-design/tooltip.less +13 -0
- package/template-design-pro/src/design/color.less +1 -0
- package/template-design-pro/src/design/config.less +5 -0
- package/template-design-pro/src/design/index.less +41 -0
- package/template-design-pro/src/design/mixin.less +66 -0
- package/template-design-pro/src/design/normalize.less +390 -0
- package/template-design-pro/src/global.less +15 -0
- package/template-design-pro/src/hooks/core/index.ts +3 -0
- package/template-design-pro/src/hooks/core/useRequest/index.ts +70 -0
- package/template-design-pro/src/hooks/core/useRequest/typings.ts +0 -0
- package/template-design-pro/src/hooks/event/index.ts +3 -0
- package/template-design-pro/src/hooks/event/useClipboard.ts +14 -0
- package/template-design-pro/src/hooks/system/index.ts +5 -0
- package/template-design-pro/src/hooks/system/useDict.ts +62 -0
- package/template-design-pro/src/hooks/system/usePermissions.ts +39 -0
- package/template-design-pro/src/hooks/typings.ts +17 -0
- package/template-design-pro/src/layout/BasicLayout.vue +104 -0
- package/template-design-pro/src/layout/BlankLayout.vue +5 -0
- package/template-design-pro/src/layout/ContentView.vue +76 -0
- package/template-design-pro/src/layout/IframeView.vue +1 -0
- package/template-design-pro/src/layout/UserLayout.vue +7 -0
- package/template-design-pro/src/main.ts +34 -0
- package/template-design-pro/src/plugins/index.ts +3 -0
- package/template-design-pro/src/router/guard/index.ts +84 -0
- package/template-design-pro/src/router/guard/permissions.ts +73 -0
- package/template-design-pro/src/router/guard/stateGuard.ts +11 -0
- package/template-design-pro/src/router/helper/routeHelper.ts +244 -0
- package/template-design-pro/src/router/helper/utils.ts +19 -0
- package/template-design-pro/src/router/index.ts +30 -0
- package/template-design-pro/src/router/routes/index.ts +85 -0
- package/template-design-pro/src/router/routes/modules/workplace.ts +19 -0
- package/template-design-pro/src/services/common/index.ts +11 -0
- package/template-design-pro/src/services/controller/router.ts +10 -0
- package/template-design-pro/src/services/controller/user.ts +35 -0
- package/template-design-pro/src/services/system/dictData.ts +10 -0
- package/template-design-pro/src/services/system/notices.ts +9 -0
- package/template-design-pro/src/store/index.ts +32 -0
- package/template-design-pro/src/store/modules/dict.ts +27 -0
- package/template-design-pro/src/store/modules/permission.ts +19 -0
- package/template-design-pro/src/store/modules/routes.ts +110 -0
- package/template-design-pro/src/store/modules/settings.ts +102 -0
- package/template-design-pro/src/store/modules/tabsRouter.ts +73 -0
- package/template-design-pro/src/store/modules/user.ts +153 -0
- package/template-design-pro/src/utils/accessToken.ts +93 -0
- package/template-design-pro/src/utils/crypto.ts +39 -0
- package/template-design-pro/src/utils/env.ts +52 -0
- package/template-design-pro/src/utils/fetchFile.ts +79 -0
- package/template-design-pro/src/utils/index.ts +127 -0
- package/template-design-pro/src/utils/pageTitle.ts +17 -0
- package/template-design-pro/src/utils/request/XHR.ts +131 -0
- package/template-design-pro/src/utils/request/axiosCancel.ts +60 -0
- package/template-design-pro/src/utils/request/checkStatus.ts +26 -0
- package/template-design-pro/src/utils/request/index.ts +145 -0
- package/template-design-pro/src/utils/request/typings.ts +114 -0
- package/template-design-pro/src/utils/storage.ts +194 -0
- package/template-design-pro/src/utils/uploadFile.ts +26 -0
- package/template-design-pro/src/utils/util.ts +278 -0
- package/template-design-pro/src/utils/validate.ts +221 -0
- package/template-design-pro/src/views/Iframe/index.vue +76 -0
- package/template-design-pro/src/views/MenuOne/index.vue +15 -0
- package/template-design-pro/src/views/MenuTwo/index.vue +13 -0
- package/template-design-pro/src/views/exception/403/index.vue +9 -0
- package/template-design-pro/src/views/exception/404/index.vue +9 -0
- package/template-design-pro/src/views/user/login/index.vue +110 -0
- package/template-design-pro/src/views/user/login/style.less +38 -0
- package/template-design-pro/stylelint.config.js +106 -0
- package/template-design-pro/tests/__mocks__/fileMock.ts +1 -0
- package/template-design-pro/tests/__mocks__/styleMock.ts +1 -0
- package/template-design-pro/tests/__mocks__/workerMock.ts +5 -0
- package/template-design-pro/tests/server/README.md +15 -0
- package/template-design-pro/tests/server/controller/FileController.ts +18 -0
- package/template-design-pro/tests/server/controller/UserController.ts +15 -0
- package/template-design-pro/tests/server/ecosystem.config.js +18 -0
- package/template-design-pro/tests/server/index.ts +63 -0
- package/template-design-pro/tests/server/nodemon.json +8 -0
- package/template-design-pro/tests/server/package.json +36 -0
- package/template-design-pro/tests/server/routes.ts +23 -0
- package/template-design-pro/tests/server/service/FileService.ts +54 -0
- package/template-design-pro/tests/server/service/UserService.ts +25 -0
- package/template-design-pro/tests/server/tsconfig.json +15 -0
- package/template-design-pro/tests/server/utils.ts +9 -0
- package/template-design-pro/tests/server/yarn.lock +2955 -0
- package/template-design-pro/tests/test.spec.ts +16 -0
- package/template-design-pro/tsconfig.json +47 -0
- package/template-design-pro/types/auto-imports.d.ts +61 -0
- package/template-design-pro/types/config.d.ts +100 -0
- package/template-design-pro/types/global.d.ts +103 -0
- package/template-design-pro/types/gx-components.d.ts +24 -0
- package/template-design-pro/types/index.d.ts +13 -0
- package/template-design-pro/types/mock.d.ts +23 -0
- package/template-design-pro/types/module.d.ts +16 -0
- package/template-design-pro/types/response.d.ts +15 -0
- package/template-design-pro/types/route.d.ts +89 -0
- package/template-design-pro/vite.config.ts +136 -0
- package/template-design-pro/yarn.lock +9697 -0
package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/style.less
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
@import '../../default.less';
|
2
|
+
@import './headerSearch.less';
|
3
|
+
|
4
|
+
@pro-layout-header-right-prefix-cls: ~'@{gx-prefix-pro}-header-right';
|
5
|
+
|
6
|
+
@pro-header-hover-bg: rgba(0, 0, 0, 0.025);
|
7
|
+
|
8
|
+
.@{pro-layout-header-right-prefix-cls} {
|
9
|
+
&.ant-space {
|
10
|
+
display: flex;
|
11
|
+
float: right;
|
12
|
+
height: 48px;
|
13
|
+
margin-left: auto;
|
14
|
+
overflow: hidden;
|
15
|
+
}
|
16
|
+
|
17
|
+
.@{pro-layout-header-right-prefix-cls}-action {
|
18
|
+
display: flex;
|
19
|
+
align-items: center;
|
20
|
+
height: 48px;
|
21
|
+
padding-left: 12px;
|
22
|
+
cursor: pointer;
|
23
|
+
transition: all 0.3s;
|
24
|
+
|
25
|
+
> span {
|
26
|
+
vertical-align: middle;
|
27
|
+
}
|
28
|
+
|
29
|
+
&:hover {
|
30
|
+
background: @pro-header-hover-bg;
|
31
|
+
}
|
32
|
+
|
33
|
+
&:global(.opened) {
|
34
|
+
background: @pro-header-hover-bg;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
.@{pro-layout-header-right-prefix-cls}-account {
|
39
|
+
.@{pro-layout-header-right-prefix-cls}-avatar {
|
40
|
+
margin-right: 8px;
|
41
|
+
color: var(--ant-primary-color);
|
42
|
+
vertical-align: top;
|
43
|
+
background: rgba(255, 255, 255, 0.85);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
.@{pro-layout-header-right-prefix-cls}-search {
|
48
|
+
padding: 0 12px;
|
49
|
+
|
50
|
+
&:hover {
|
51
|
+
background: transparent;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
&-menu {
|
56
|
+
.anticon {
|
57
|
+
margin-right: 8px;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
.dark {
|
63
|
+
.@{pro-layout-header-right-prefix-cls}-action {
|
64
|
+
&:hover {
|
65
|
+
background: #252a3d;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
@media only screen and (max-width: @screen-md) {
|
71
|
+
.ant-divider-vertical {
|
72
|
+
vertical-align: unset;
|
73
|
+
}
|
74
|
+
|
75
|
+
.@{pro-layout-header-right-prefix-cls}-name {
|
76
|
+
display: none;
|
77
|
+
}
|
78
|
+
|
79
|
+
.@{pro-layout-header-right-prefix-cls} {
|
80
|
+
position: absolute;
|
81
|
+
top: 0;
|
82
|
+
right: 12px;
|
83
|
+
|
84
|
+
.@{pro-layout-header-right-prefix-cls}-account {
|
85
|
+
.@{pro-layout-header-right-prefix-cls}-avatar {
|
86
|
+
margin-right: 0;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
import { computed, defineComponent } from 'vue'
|
2
|
+
import { Tooltip } from 'ant-design-vue'
|
3
|
+
import { CheckOutlined } from '@ant-design/icons-vue'
|
4
|
+
import { PropTypes } from '@/utils'
|
5
|
+
|
6
|
+
const BlockCheckboxProps = {
|
7
|
+
value: PropTypes.string,
|
8
|
+
list: PropTypes.array,
|
9
|
+
className: PropTypes.string
|
10
|
+
}
|
11
|
+
|
12
|
+
const BlockCheckbox = defineComponent({
|
13
|
+
props: BlockCheckboxProps,
|
14
|
+
emits: ['change'],
|
15
|
+
setup(props, { emit }) {
|
16
|
+
const baseClassName = computed(() => `${props.className}-block-checbox`)
|
17
|
+
|
18
|
+
const items = computed(
|
19
|
+
() =>
|
20
|
+
props.list || [
|
21
|
+
{
|
22
|
+
key: 'side',
|
23
|
+
title: '侧边菜单布局'
|
24
|
+
},
|
25
|
+
{
|
26
|
+
key: 'mix',
|
27
|
+
title: '混合菜单布局'
|
28
|
+
},
|
29
|
+
{
|
30
|
+
key: 'simple',
|
31
|
+
title: '简单菜单布局'
|
32
|
+
}
|
33
|
+
]
|
34
|
+
)
|
35
|
+
|
36
|
+
const disableStyle = {
|
37
|
+
cursor: 'not-allowed'
|
38
|
+
}
|
39
|
+
|
40
|
+
const handleChange = (key: string) => {
|
41
|
+
emit('change', key)
|
42
|
+
}
|
43
|
+
|
44
|
+
return () => {
|
45
|
+
const { value } = props
|
46
|
+
return (
|
47
|
+
<div class={baseClassName.value} key={value} style={{ minHeight: '42px' }}>
|
48
|
+
{items.value.map((item: any) => (
|
49
|
+
<Tooltip title={item.title} key={item.title}>
|
50
|
+
<div
|
51
|
+
class={[`${baseClassName.value}-item`, `${baseClassName.value}-item-${item.key}`]}
|
52
|
+
style={item.disable && disableStyle}
|
53
|
+
onClick={() => !item.disabled && handleChange(item.key)}
|
54
|
+
>
|
55
|
+
<CheckOutlined
|
56
|
+
class={`${baseClassName.value}-selectIcon`}
|
57
|
+
style={{
|
58
|
+
display: value === item.key ? 'block' : 'none'
|
59
|
+
}}
|
60
|
+
/>
|
61
|
+
</div>
|
62
|
+
</Tooltip>
|
63
|
+
))}
|
64
|
+
</div>
|
65
|
+
)
|
66
|
+
}
|
67
|
+
}
|
68
|
+
})
|
69
|
+
|
70
|
+
export default BlockCheckbox
|
@@ -0,0 +1,107 @@
|
|
1
|
+
import { computed, defineComponent } from 'vue'
|
2
|
+
import { Switch, List, Tooltip, Select } from 'ant-design-vue'
|
3
|
+
import { PropTypes } from '@/utils'
|
4
|
+
|
5
|
+
const LayoutSettingProps = {
|
6
|
+
splitMenus: PropTypes.looseBool,
|
7
|
+
fixedHeader: PropTypes.looseBool,
|
8
|
+
fixSiderbar: PropTypes.looseBool,
|
9
|
+
layout: PropTypes.oneOf(['side', 'mix', 'simple']),
|
10
|
+
className: PropTypes.string
|
11
|
+
}
|
12
|
+
|
13
|
+
export const renderLayoutSettingItem = (item: any) => {
|
14
|
+
const action = { ...item.action }
|
15
|
+
return (
|
16
|
+
<Tooltip title={item.disabled ? item.disabledReason : ''} placement="left">
|
17
|
+
<List.Item actions={[action]}>
|
18
|
+
<span style={{ opacity: item.disabled ? 0.5 : 1 }}>{item.title}</span>
|
19
|
+
</List.Item>
|
20
|
+
</Tooltip>
|
21
|
+
)
|
22
|
+
}
|
23
|
+
|
24
|
+
const LayoutSetting = defineComponent({
|
25
|
+
props: LayoutSettingProps,
|
26
|
+
emits: ['change'],
|
27
|
+
setup(props, { emit }) {
|
28
|
+
const layoutList = computed(() => [
|
29
|
+
{
|
30
|
+
title: '内容区域宽度',
|
31
|
+
disabled: false,
|
32
|
+
action: (
|
33
|
+
<Select
|
34
|
+
value={props.layout === 'wide' ? 'wide' : 'mix'}
|
35
|
+
options={[
|
36
|
+
{
|
37
|
+
label: '定宽',
|
38
|
+
value: 'wide'
|
39
|
+
},
|
40
|
+
{
|
41
|
+
label: '流式',
|
42
|
+
value: 'mix'
|
43
|
+
}
|
44
|
+
]}
|
45
|
+
onChange={(value: any) => handleChange('layout', value)}
|
46
|
+
/>
|
47
|
+
)
|
48
|
+
},
|
49
|
+
{
|
50
|
+
title: '固定 Header',
|
51
|
+
disabled: props.layout === 'mix',
|
52
|
+
action: (
|
53
|
+
<Switch
|
54
|
+
size="small"
|
55
|
+
disabled={
|
56
|
+
props.layout === 'mix' || props.layout === 'simple' || props.layout === 'wide'
|
57
|
+
}
|
58
|
+
checked={!!props.fixedHeader}
|
59
|
+
onChange={(checked) => handleChange('fixedHeader', checked)}
|
60
|
+
/>
|
61
|
+
)
|
62
|
+
},
|
63
|
+
{
|
64
|
+
title: '固定侧边菜单',
|
65
|
+
disabled: props.layout === 'mix',
|
66
|
+
action: (
|
67
|
+
<Switch
|
68
|
+
size="small"
|
69
|
+
disabled={props.layout === 'mix' || props.layout === 'wide'}
|
70
|
+
checked={!!props.fixSiderbar}
|
71
|
+
onChange={(checked) => handleChange('fixSiderbar', checked)}
|
72
|
+
/>
|
73
|
+
)
|
74
|
+
},
|
75
|
+
{
|
76
|
+
title: '自动分割菜单',
|
77
|
+
disabled: props.layout === 'side',
|
78
|
+
action: (
|
79
|
+
<Switch
|
80
|
+
size="small"
|
81
|
+
disabled={
|
82
|
+
props.layout === 'side' || props.layout === 'simple' || props.layout === 'wide'
|
83
|
+
}
|
84
|
+
checked={!!props.splitMenus}
|
85
|
+
onChange={(checked) => handleChange('splitMenus', checked)}
|
86
|
+
/>
|
87
|
+
)
|
88
|
+
}
|
89
|
+
])
|
90
|
+
|
91
|
+
const handleChange = (type: string, value: boolean | string | number) => {
|
92
|
+
emit('change', { type, value })
|
93
|
+
}
|
94
|
+
|
95
|
+
return () => {
|
96
|
+
return (
|
97
|
+
<List
|
98
|
+
split={false}
|
99
|
+
dataSource={layoutList.value}
|
100
|
+
renderItem={({ item }) => renderLayoutSettingItem(item)}
|
101
|
+
/>
|
102
|
+
)
|
103
|
+
}
|
104
|
+
}
|
105
|
+
})
|
106
|
+
|
107
|
+
export default LayoutSetting
|
package/template-design-pro/src/components/GDesign/ProLayout/components/SettingDrawer/ThemeColor.tsx
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
import type { FunctionalComponent } from 'vue'
|
2
|
+
import { computed, defineComponent } from 'vue'
|
3
|
+
import { Tooltip, ConfigProvider } from 'ant-design-vue'
|
4
|
+
import { CheckOutlined } from '@ant-design/icons-vue'
|
5
|
+
import { PropTypes } from '@/utils'
|
6
|
+
|
7
|
+
const ThemeColorProps = {
|
8
|
+
title: PropTypes.string,
|
9
|
+
value: PropTypes.string,
|
10
|
+
colors: PropTypes.array,
|
11
|
+
className: PropTypes.string
|
12
|
+
}
|
13
|
+
|
14
|
+
const Tag: FunctionalComponent<{ color: string; check: boolean; className: string }> = ({
|
15
|
+
color,
|
16
|
+
check,
|
17
|
+
className
|
18
|
+
}) => {
|
19
|
+
return (
|
20
|
+
<div class={`${className}-block`} style={{ backgroundColor: color }}>
|
21
|
+
{check ? <CheckOutlined /> : null}
|
22
|
+
</div>
|
23
|
+
)
|
24
|
+
}
|
25
|
+
|
26
|
+
const ThemeColor = defineComponent({
|
27
|
+
props: ThemeColorProps,
|
28
|
+
emits: ['change'],
|
29
|
+
setup(props, { emit }) {
|
30
|
+
const baseClassName = computed(() => `${props.className}-theme-color`)
|
31
|
+
|
32
|
+
const handleChange = (key: string) => {
|
33
|
+
emit('change', key)
|
34
|
+
ConfigProvider.config({
|
35
|
+
theme: {
|
36
|
+
primaryColor: key
|
37
|
+
}
|
38
|
+
})
|
39
|
+
}
|
40
|
+
|
41
|
+
return () => {
|
42
|
+
const { value, title, colors = [], className } = props
|
43
|
+
return (
|
44
|
+
<div class={baseClassName.value} style={{ marginBottom: '24px' }}>
|
45
|
+
<h3 class={`${className}-title`}>{title}</h3>
|
46
|
+
<div class={`${baseClassName.value}-content`}>
|
47
|
+
{colors.map((item: any) => {
|
48
|
+
const check = value === item.color
|
49
|
+
return (
|
50
|
+
<Tooltip key={item.color} title={item.fileName}>
|
51
|
+
<Tag
|
52
|
+
className={className}
|
53
|
+
class={`${baseClassName.value}-block`}
|
54
|
+
color={item.color}
|
55
|
+
check={check}
|
56
|
+
onClick={() => handleChange(item.color)}
|
57
|
+
/>
|
58
|
+
</Tooltip>
|
59
|
+
)
|
60
|
+
})}
|
61
|
+
</div>
|
62
|
+
</div>
|
63
|
+
)
|
64
|
+
}
|
65
|
+
}
|
66
|
+
})
|
67
|
+
|
68
|
+
export default ThemeColor
|
package/template-design-pro/src/components/GDesign/ProLayout/components/SettingDrawer/index.tsx
ADDED
@@ -0,0 +1,346 @@
|
|
1
|
+
import type { FunctionalComponent, Ref } from 'vue'
|
2
|
+
import { defineComponent, reactive, ref, watch } from 'vue'
|
3
|
+
import { message, Drawer, List, Switch, Select, Button, Alert, Divider } from 'ant-design-vue'
|
4
|
+
import {
|
5
|
+
CloseOutlined,
|
6
|
+
SettingOutlined,
|
7
|
+
NotificationOutlined,
|
8
|
+
CopyOutlined
|
9
|
+
} from '@ant-design/icons-vue'
|
10
|
+
import config from '/config/config'
|
11
|
+
import { themeConfig } from '/config/default/themeColor'
|
12
|
+
import { PropTypes } from '@/utils'
|
13
|
+
import { useClipboard } from '@gx-admin/hooks/event'
|
14
|
+
import { getPrefixCls } from '@gx-design-vue/pro-utils'
|
15
|
+
import BlockCheckbox from './BlockCheckbox'
|
16
|
+
import ThemeColor from './ThemeColor'
|
17
|
+
import LayoutSetting, { renderLayoutSettingItem } from './LayoutSetting'
|
18
|
+
import { ProSettingsProps } from '../../defaultSettings'
|
19
|
+
|
20
|
+
const { defaultSettings, animate } = config
|
21
|
+
|
22
|
+
const { preset } = animate
|
23
|
+
|
24
|
+
export const settingDrawerProps = {
|
25
|
+
hideLoading: PropTypes.bool,
|
26
|
+
root: PropTypes.string.def(defaultSettings.viewScrollRoot),
|
27
|
+
settings: Object as PropType<ProSettingsProps>
|
28
|
+
}
|
29
|
+
|
30
|
+
const Body: FunctionalComponent<{ title: string; className: string }> = (
|
31
|
+
{ title = '', className = '' },
|
32
|
+
{ slots }
|
33
|
+
) => {
|
34
|
+
return (
|
35
|
+
<div style={{ marginBottom: '24px' }}>
|
36
|
+
<h3 class={`${className}-title`}>{title}</h3>
|
37
|
+
{slots.default?.()}
|
38
|
+
</div>
|
39
|
+
)
|
40
|
+
}
|
41
|
+
|
42
|
+
const updateTheme = (_: boolean, color?: string, hideMessageLoading?: boolean) => {
|
43
|
+
let hide: any = () => null
|
44
|
+
if (!hideMessageLoading) {
|
45
|
+
hide = message.loading('正在加载主题颜色')
|
46
|
+
}
|
47
|
+
|
48
|
+
document.documentElement.className = color
|
49
|
+
|
50
|
+
// 模拟加载主题
|
51
|
+
setTimeout(() => hide(), 500)
|
52
|
+
|
53
|
+
// localStorage.setItem('gx-theme', dark ? 'dark' : 'light')
|
54
|
+
}
|
55
|
+
|
56
|
+
const SettingDrawer = defineComponent({
|
57
|
+
props: settingDrawerProps,
|
58
|
+
emits: ['change'],
|
59
|
+
setup(props, { emit, slots }) {
|
60
|
+
const baseClassName = getPrefixCls({
|
61
|
+
suffixCls: 'setting-drawer',
|
62
|
+
isPor: true
|
63
|
+
})
|
64
|
+
|
65
|
+
const show: Ref<boolean> = ref(false)
|
66
|
+
|
67
|
+
const innerHeight: Ref<number> = ref(window.innerHeight)
|
68
|
+
|
69
|
+
watch(innerHeight, (value: number) => {
|
70
|
+
innerHeight.value = value
|
71
|
+
})
|
72
|
+
|
73
|
+
const iconStyle = reactive({
|
74
|
+
color: '#fff',
|
75
|
+
fontSize: 20
|
76
|
+
})
|
77
|
+
|
78
|
+
const genCopySettingJson = (settings) => JSON.stringify(settings)
|
79
|
+
|
80
|
+
const getThemeList = () => {
|
81
|
+
const themeList = [
|
82
|
+
{
|
83
|
+
key: 'light',
|
84
|
+
title: '亮色菜单风格'
|
85
|
+
},
|
86
|
+
{
|
87
|
+
key: 'dark',
|
88
|
+
title: '暗色菜单风格'
|
89
|
+
}
|
90
|
+
]
|
91
|
+
|
92
|
+
return {
|
93
|
+
themeList
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
const setShow = (flag: boolean) => {
|
98
|
+
show.value = flag
|
99
|
+
}
|
100
|
+
|
101
|
+
const changeSetting = (type: string, value: any, hideMessageLoading?: boolean) => {
|
102
|
+
if (type === 'primaryColor') {
|
103
|
+
updateTheme(value === 'realDark', value as string, !!hideMessageLoading)
|
104
|
+
}
|
105
|
+
|
106
|
+
emit('change', { type, value })
|
107
|
+
}
|
108
|
+
|
109
|
+
const { copy } = useClipboard('拷贝成功,请到 config/default/theme.js 中替换默认配置')
|
110
|
+
|
111
|
+
return () => {
|
112
|
+
const { root, settings, hideLoading } = props
|
113
|
+
|
114
|
+
const {
|
115
|
+
theme,
|
116
|
+
primaryColor,
|
117
|
+
layout,
|
118
|
+
splitMenus,
|
119
|
+
fixedHeader,
|
120
|
+
fixSiderbar,
|
121
|
+
showTabsBar,
|
122
|
+
fixedMultiTab,
|
123
|
+
showProgressBar,
|
124
|
+
animate
|
125
|
+
} = settings as ProSettingsProps
|
126
|
+
|
127
|
+
return (
|
128
|
+
<Drawer
|
129
|
+
visible={show.value}
|
130
|
+
width={300}
|
131
|
+
bodyStyle={{ padding: 0 }}
|
132
|
+
onClose={() => setShow(false)}
|
133
|
+
placement="right"
|
134
|
+
getContainer={document.querySelector(root) as HTMLInputElement}
|
135
|
+
style={{
|
136
|
+
zIndex: 1001
|
137
|
+
}}
|
138
|
+
handle={
|
139
|
+
<div class={`${baseClassName}-handle`} onClick={() => setShow(!show.value)}>
|
140
|
+
{show.value ? (
|
141
|
+
<CloseOutlined style={iconStyle} />
|
142
|
+
) : (
|
143
|
+
<SettingOutlined style={iconStyle} />
|
144
|
+
)}
|
145
|
+
</div>
|
146
|
+
}
|
147
|
+
>
|
148
|
+
<div style={{ height: `${innerHeight.value - 34 * 2}px` }}>
|
149
|
+
<g-bars>
|
150
|
+
<div class={`${baseClassName}-content`}>
|
151
|
+
<Body title="整体风格设置" className={baseClassName}>
|
152
|
+
<BlockCheckbox
|
153
|
+
className={baseClassName}
|
154
|
+
list={getThemeList().themeList}
|
155
|
+
value={theme}
|
156
|
+
onChange={(val) => {
|
157
|
+
changeSetting('theme', val, hideLoading)
|
158
|
+
}}
|
159
|
+
/>
|
160
|
+
</Body>
|
161
|
+
|
162
|
+
<ThemeColor
|
163
|
+
title="主题色"
|
164
|
+
className={baseClassName}
|
165
|
+
value={primaryColor}
|
166
|
+
colors={themeConfig}
|
167
|
+
onChange={(color) => {
|
168
|
+
changeSetting('primaryColor', color, hideLoading)
|
169
|
+
}}
|
170
|
+
/>
|
171
|
+
|
172
|
+
<Divider />
|
173
|
+
|
174
|
+
<Body title="导航模式" className={baseClassName}>
|
175
|
+
<BlockCheckbox
|
176
|
+
className={baseClassName}
|
177
|
+
value={layout}
|
178
|
+
onChange={(val) => {
|
179
|
+
changeSetting('layout', val, hideLoading)
|
180
|
+
}}
|
181
|
+
/>
|
182
|
+
</Body>
|
183
|
+
|
184
|
+
<LayoutSetting
|
185
|
+
splitMenus={splitMenus}
|
186
|
+
fixedHeader={fixedHeader}
|
187
|
+
fixSiderbar={fixSiderbar}
|
188
|
+
layout={layout}
|
189
|
+
onChange={({ type, value }) => {
|
190
|
+
changeSetting(type, value)
|
191
|
+
}}
|
192
|
+
/>
|
193
|
+
|
194
|
+
<Divider />
|
195
|
+
|
196
|
+
<Body title="其他设置" className={baseClassName}>
|
197
|
+
<List
|
198
|
+
split={false}
|
199
|
+
renderItem={({ item }) => renderLayoutSettingItem(item)}
|
200
|
+
dataSource={[
|
201
|
+
{
|
202
|
+
title: '多标签',
|
203
|
+
action: (
|
204
|
+
<Switch
|
205
|
+
size="small"
|
206
|
+
disabled={layout === 'simple'}
|
207
|
+
checked={!!showTabsBar}
|
208
|
+
onChange={(checked) => changeSetting('showTabsBar', checked)}
|
209
|
+
/>
|
210
|
+
)
|
211
|
+
},
|
212
|
+
{
|
213
|
+
title: '固定多标签',
|
214
|
+
action: (
|
215
|
+
<Switch
|
216
|
+
size="small"
|
217
|
+
disabled={layout === 'simple'}
|
218
|
+
checked={!!fixedMultiTab}
|
219
|
+
onChange={(checked) => changeSetting('fixedMultiTab', checked)}
|
220
|
+
/>
|
221
|
+
)
|
222
|
+
},
|
223
|
+
{
|
224
|
+
title: '顶部进度条',
|
225
|
+
action: (
|
226
|
+
<Switch
|
227
|
+
size="small"
|
228
|
+
checked={!!showProgressBar}
|
229
|
+
onChange={(checked) => changeSetting('showProgressBar', checked)}
|
230
|
+
/>
|
231
|
+
)
|
232
|
+
}
|
233
|
+
]}
|
234
|
+
/>
|
235
|
+
</Body>
|
236
|
+
|
237
|
+
<Divider />
|
238
|
+
|
239
|
+
<Body title="页面切换动画" className={baseClassName}>
|
240
|
+
<List
|
241
|
+
split={false}
|
242
|
+
renderItem={({ item }) => renderLayoutSettingItem(item)}
|
243
|
+
dataSource={[
|
244
|
+
{
|
245
|
+
title: '禁用动画',
|
246
|
+
action: (
|
247
|
+
<Switch
|
248
|
+
size="small"
|
249
|
+
checked={!animate?.disabled}
|
250
|
+
onChange={(checked) => changeSetting('showAnimate', checked)}
|
251
|
+
/>
|
252
|
+
)
|
253
|
+
},
|
254
|
+
{
|
255
|
+
title: '动画效果',
|
256
|
+
disabled: animate?.disabled,
|
257
|
+
action: (
|
258
|
+
<Select
|
259
|
+
value={animate?.name}
|
260
|
+
size="small"
|
261
|
+
disabled={animate?.disabled}
|
262
|
+
getPopupContainer={(trigger) => {
|
263
|
+
if (trigger && trigger.parentNode) {
|
264
|
+
return trigger.parentNode
|
265
|
+
}
|
266
|
+
return trigger
|
267
|
+
}}
|
268
|
+
onSelect={(value) => changeSetting('changeAnimateMode', value)}
|
269
|
+
style={{ width: '120px' }}
|
270
|
+
>
|
271
|
+
{preset.map((item: any) => (
|
272
|
+
<Select.Option value={item.name}>{item.alias}</Select.Option>
|
273
|
+
))}
|
274
|
+
</Select>
|
275
|
+
)
|
276
|
+
},
|
277
|
+
{
|
278
|
+
title: '动画方向',
|
279
|
+
disabled: animate?.disabled,
|
280
|
+
action: (
|
281
|
+
<Select
|
282
|
+
value={animate?.direction}
|
283
|
+
size="small"
|
284
|
+
disabled={animate?.disabled}
|
285
|
+
getPopupContainer={(trigger) => {
|
286
|
+
if (trigger && trigger.parentNode) {
|
287
|
+
return trigger.parentNode
|
288
|
+
}
|
289
|
+
return trigger
|
290
|
+
}}
|
291
|
+
onSelect={(value) => changeSetting('changeAnimateDirections', value)}
|
292
|
+
style={{ width: '120px' }}
|
293
|
+
>
|
294
|
+
{preset
|
295
|
+
.find((el: any) => el.name === animate?.name)
|
296
|
+
?.directions.map((item: any) => (
|
297
|
+
<Select.Option value={item}>{item}</Select.Option>
|
298
|
+
))}
|
299
|
+
</Select>
|
300
|
+
)
|
301
|
+
}
|
302
|
+
]}
|
303
|
+
/>
|
304
|
+
</Body>
|
305
|
+
|
306
|
+
<Divider />
|
307
|
+
|
308
|
+
<Alert
|
309
|
+
type="warning"
|
310
|
+
message={'配置栏只在开发环境用于预览,生产环境不会展现,请拷贝后手动修改配置文件'}
|
311
|
+
icon={<NotificationOutlined />}
|
312
|
+
showIcon
|
313
|
+
style={{ marginBottom: '16px' }}
|
314
|
+
/>
|
315
|
+
|
316
|
+
<Button
|
317
|
+
block
|
318
|
+
onClick={() => {
|
319
|
+
copy(genCopySettingJson({
|
320
|
+
primaryColor,
|
321
|
+
layout,
|
322
|
+
splitMenus,
|
323
|
+
fixedHeader,
|
324
|
+
fixSiderbar,
|
325
|
+
showTabsBar,
|
326
|
+
fixedMultiTab,
|
327
|
+
showProgressBar,
|
328
|
+
animate
|
329
|
+
}))
|
330
|
+
}}
|
331
|
+
>
|
332
|
+
<CopyOutlined />
|
333
|
+
拷贝设置
|
334
|
+
</Button>
|
335
|
+
|
336
|
+
<div class={`${baseClassName}-content-footer`}>{slots.default?.()}</div>
|
337
|
+
</div>
|
338
|
+
</g-bars>
|
339
|
+
</div>
|
340
|
+
</Drawer>
|
341
|
+
)
|
342
|
+
}
|
343
|
+
}
|
344
|
+
})
|
345
|
+
|
346
|
+
export default SettingDrawer
|