kn-cli 1.0.131 → 1.0.134
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/build/shellUtil.sh +2 -2
- package/build/start.sh +3 -2
- package/build/vite.config.js +1 -1
- package/package.json +2 -1
- package/src/create.js +2 -0
- package/templates/template_admin_antd5/.vscode/settings.json +28 -0
- package/templates/template_admin_antd5/build.sh +8 -0
- package/templates/template_admin_antd5/cli.config.js +35 -0
- package/templates/template_admin_antd5/dev.sh +33 -0
- package/templates/template_admin_antd5/frontend_build.sh +48 -0
- package/templates/template_admin_antd5/init/prepare-commit-msg +5 -0
- package/templates/template_admin_antd5/init.sh +24 -0
- package/templates/template_admin_antd5/jsconfig.json +17 -0
- package/templates/template_admin_antd5/package.json +27 -0
- package/templates/template_admin_antd5/public/404.html +26 -0
- package/templates/template_admin_antd5/public/favicon.png +0 -0
- package/templates/template_admin_antd5/public/index.html +48 -0
- package/templates/template_admin_antd5/public/src/_antd.less +37 -0
- package/templates/template_admin_antd5/public/src/_mixin.module.less +79 -0
- package/templates/template_admin_antd5/public/src/_reset.module.less +134 -0
- package/templates/template_admin_antd5/public/src/_variable.module.less +85 -0
- package/templates/template_admin_antd5/public/src/assets/iconfont/iconfont.eot +0 -0
- package/templates/template_admin_antd5/public/src/assets/iconfont/iconfont.module.less +109 -0
- package/templates/template_admin_antd5/public/src/assets/iconfont/iconfont.svg +75 -0
- package/templates/template_admin_antd5/public/src/assets/iconfont/iconfont.ttf +0 -0
- package/templates/template_admin_antd5/public/src/assets/iconfont/iconfont.woff +0 -0
- package/templates/template_admin_antd5/public/src/assets/iconfont/iconfont.woff2 +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/arrow.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/avatar.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/icon-notice.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/icon-user.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/loadFail.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/loading.svg +40 -0
- package/templates/template_admin_antd5/public/src/assets/images/login/bg.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/login/logo.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/login/slogan.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/icon-dep-active.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/icon-dep.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/icon-log-active.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/icon-log.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/icon-loginlog-active.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/icon-loginlog.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/icon-role-active.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/icon-role.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/icon-user-active.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/icon-user.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/nav-toggle.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/slogan.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/noData.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/noSelect.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/permission/403.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/permission/404.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/permission/503.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/play.png +0 -0
- package/templates/template_admin_antd5/public/src/components/_table/column.jsx +47 -0
- package/templates/template_admin_antd5/public/src/components/_table/column.module.less +12 -0
- package/templates/template_admin_antd5/public/src/components/_table/index.jsx +71 -0
- package/templates/template_admin_antd5/public/src/components/_table/index.module.less +15 -0
- package/templates/template_admin_antd5/public/src/components/antd/antProvider.jsx +21 -0
- package/templates/template_admin_antd5/public/src/components/antd/index.jsx +146 -0
- package/templates/template_admin_antd5/public/src/components/antd/select/index.jsx +296 -0
- package/templates/template_admin_antd5/public/src/components/antd/select/index.module.less +21 -0
- package/templates/template_admin_antd5/public/src/components/antd/theme.js +173 -0
- package/templates/template_admin_antd5/public/src/components/antd/tooltip/detail/index.jsx +70 -0
- package/templates/template_admin_antd5/public/src/components/antd/tooltip/detail/index.module.less +12 -0
- package/templates/template_admin_antd5/public/src/components/antd/tooltip/index.jsx +69 -0
- package/templates/template_admin_antd5/public/src/components/antd/tooltip/index.module.less +28 -0
- package/templates/template_admin_antd5/public/src/components/auth/index.jsx +123 -0
- package/templates/template_admin_antd5/public/src/components/auth/index.module.less +7 -0
- package/templates/template_admin_antd5/public/src/components/auth/navCheck.jsx +27 -0
- package/templates/template_admin_antd5/public/src/components/badge/index.jsx +47 -0
- package/templates/template_admin_antd5/public/src/components/badge/index.module.less +44 -0
- package/templates/template_admin_antd5/public/src/components/button/index.jsx +17 -0
- package/templates/template_admin_antd5/public/src/components/debug/index.jsx +28 -0
- package/templates/template_admin_antd5/public/src/components/debug/index.module.less +10 -0
- package/templates/template_admin_antd5/public/src/components/empty/index.jsx +28 -0
- package/templates/template_admin_antd5/public/src/components/empty/index.module.less +20 -0
- package/templates/template_admin_antd5/public/src/components/error/index.jsx +39 -0
- package/templates/template_admin_antd5/public/src/components/icon/index.jsx +128 -0
- package/templates/template_admin_antd5/public/src/components/icon/playVideo/index.jsx +21 -0
- package/templates/template_admin_antd5/public/src/components/icon/playVideo/index.module.less +16 -0
- package/templates/template_admin_antd5/public/src/components/iconFont/index.jsx +20 -0
- package/templates/template_admin_antd5/public/src/components/iconFont/index.module.less +5 -0
- package/templates/template_admin_antd5/public/src/components/image/index.jsx +73 -0
- package/templates/template_admin_antd5/public/src/components/image/index.module.less +117 -0
- package/templates/template_admin_antd5/public/src/components/image/preview.jsx +85 -0
- package/templates/template_admin_antd5/public/src/components/layout/basic/index.jsx +49 -0
- package/templates/template_admin_antd5/public/src/components/layout/basic/index.module.less +76 -0
- package/templates/template_admin_antd5/public/src/components/layout/index.jsx +39 -0
- package/templates/template_admin_antd5/public/src/components/layout/index.module.less +63 -0
- package/templates/template_admin_antd5/public/src/components/layout/provider/index.jsx +32 -0
- package/templates/template_admin_antd5/public/src/components/leftMenu/index.jsx +106 -0
- package/templates/template_admin_antd5/public/src/components/leftMenu/index.module.less +42 -0
- package/templates/template_admin_antd5/public/src/components/link/index.jsx +39 -0
- package/templates/template_admin_antd5/public/src/components/link/index.module.less +11 -0
- package/templates/template_admin_antd5/public/src/components/menuIcon/index.jsx +33 -0
- package/templates/template_admin_antd5/public/src/components/menuIcon/index.module.less +49 -0
- package/templates/template_admin_antd5/public/src/components/page/pageLoading/index.jsx +51 -0
- package/templates/template_admin_antd5/public/src/components/page/pageLoading/index.module.less +29 -0
- package/templates/template_admin_antd5/public/src/components/popup/index.jsx +60 -0
- package/templates/template_admin_antd5/public/src/components/popup/index.module.less +18 -0
- package/templates/template_admin_antd5/public/src/components/react/index.jsx +13 -0
- package/templates/template_admin_antd5/public/src/components/resizeBox/index.jsx +144 -0
- package/templates/template_admin_antd5/public/src/components/resizeBox/index.module.css +90 -0
- package/templates/template_admin_antd5/public/src/components/select/defaultServicesSelect/index.jsx +182 -0
- package/templates/template_admin_antd5/public/src/components/select/dictSelect/index.jsx +84 -0
- package/templates/template_admin_antd5/public/src/components/select/index.jsx +7 -0
- package/templates/template_admin_antd5/public/src/components/select/useSelectList.jsx +217 -0
- package/templates/template_admin_antd5/public/src/components/table/aliTable/index.jsx +250 -0
- package/templates/template_admin_antd5/public/src/components/table/aliTable/index.module.less +105 -0
- package/templates/template_admin_antd5/public/src/components/table/column.jsx +128 -0
- package/templates/template_admin_antd5/public/src/components/table/column.module.less +50 -0
- package/templates/template_admin_antd5/public/src/components/table/imageTable/index.jsx +302 -0
- package/templates/template_admin_antd5/public/src/components/table/imageTable/index.module.less +196 -0
- package/templates/template_admin_antd5/public/src/components/table/imageTable/radio.jsx +15 -0
- package/templates/template_admin_antd5/public/src/components/table/imageTable/radio.module.less +18 -0
- package/templates/template_admin_antd5/public/src/components/table/index.jsx +475 -0
- package/templates/template_admin_antd5/public/src/components/table/index.module.less +133 -0
- package/templates/template_admin_antd5/public/src/components/text/index.jsx +98 -0
- package/templates/template_admin_antd5/public/src/components/text/index.module.less +13 -0
- package/templates/template_admin_antd5/public/src/components/toast/index.jsx +79 -0
- package/templates/template_admin_antd5/public/src/components/toast/index.module.less +43 -0
- package/templates/template_admin_antd5/public/src/components/topMenu/index.jsx +102 -0
- package/templates/template_admin_antd5/public/src/components/topMenu/index.module.less +89 -0
- package/templates/template_admin_antd5/public/src/components/topMenu/topBar/index.jsx +81 -0
- package/templates/template_admin_antd5/public/src/components/topMenu/topBar/index.module.less +97 -0
- package/templates/template_admin_antd5/public/src/components/video/index.jsx +96 -0
- package/templates/template_admin_antd5/public/src/components/video/index.module.less +132 -0
- package/templates/template_admin_antd5/public/src/components/video/preview.jsx +38 -0
- package/templates/template_admin_antd5/public/src/config.js +31 -0
- package/templates/template_admin_antd5/public/src/declarations.d.ts +1 -0
- package/templates/template_admin_antd5/public/src/dictionary/dictionary.js +289 -0
- package/templates/template_admin_antd5/public/src/dictionary/index.jsx +64 -0
- package/templates/template_admin_antd5/public/src/enum.js +41 -0
- package/templates/template_admin_antd5/public/src/hooks/index.jsx +29 -0
- package/templates/template_admin_antd5/public/src/hooks/useDebounceFn.jsx +33 -0
- package/templates/template_admin_antd5/public/src/hooks/useDelay.jsx +34 -0
- package/templates/template_admin_antd5/public/src/hooks/useEsc.jsx +98 -0
- package/templates/template_admin_antd5/public/src/hooks/useImageLoader.jsx +26 -0
- package/templates/template_admin_antd5/public/src/hooks/useInToView.jsx +58 -0
- package/templates/template_admin_antd5/public/src/hooks/useLoading.jsx +46 -0
- package/templates/template_admin_antd5/public/src/hooks/usePreload.jsx +67 -0
- package/templates/template_admin_antd5/public/src/hooks/useRouteMenu.jsx +263 -0
- package/templates/template_admin_antd5/public/src/hooks/useScrollTop.jsx +44 -0
- package/templates/template_admin_antd5/public/src/hooks/useSearch.jsx +163 -0
- package/templates/template_admin_antd5/public/src/hooks/useTableRowSelect.jsx +310 -0
- package/templates/template_admin_antd5/public/src/hooks/useThrottole.jsx +68 -0
- package/templates/template_admin_antd5/public/src/hooks/useTimer.jsx +42 -0
- package/templates/template_admin_antd5/public/src/hooks/useUpdate.jsx +16 -0
- package/templates/template_admin_antd5/public/src/hooks/useWatchServices.jsx +124 -0
- package/templates/template_admin_antd5/public/src/index.jsx +89 -0
- package/templates/template_admin_antd5/public/src/menuConfig/auth.jsx +92 -0
- package/templates/template_admin_antd5/public/src/menuConfig/dashboard.jsx +25 -0
- package/templates/template_admin_antd5/public/src/menuConfig/dna.jsx +76 -0
- package/templates/template_admin_antd5/public/src/menuConfig/index.jsx +17 -0
- package/templates/template_admin_antd5/public/src/mock/auth.js +33 -0
- package/templates/template_admin_antd5/public/src/mock/demo.js +122 -0
- package/templates/template_admin_antd5/public/src/mock/index.js +65 -0
- package/templates/template_admin_antd5/public/src/mock/utils.js +33 -0
- package/templates/template_admin_antd5/public/src/pages/antdComponents/index.jsx +142 -0
- package/templates/template_admin_antd5/public/src/pages/auth/user/create/index.jsx +47 -0
- package/templates/template_admin_antd5/public/src/pages/auth/user/create/index.module.less +6 -0
- package/templates/template_admin_antd5/public/src/pages/auth/user/dialog/index.jsx +96 -0
- package/templates/template_admin_antd5/public/src/pages/auth/user/index.jsx +214 -0
- package/templates/template_admin_antd5/public/src/pages/components/layout/index.jsx +75 -0
- package/templates/template_admin_antd5/public/src/pages/components/layout/index.module.less +78 -0
- package/templates/template_admin_antd5/public/src/pages/components/layout/titleBar/index.jsx +28 -0
- package/templates/template_admin_antd5/public/src/pages/components/layout/titleBar/index.module.less +44 -0
- package/templates/template_admin_antd5/public/src/pages/components/select/user.jsx +18 -0
- package/templates/template_admin_antd5/public/src/pages/demo/page1.jsx +21 -0
- package/templates/template_admin_antd5/public/src/pages/demo/page2.jsx +21 -0
- package/templates/template_admin_antd5/public/src/pages/demo/page3.jsx +21 -0
- package/templates/template_admin_antd5/public/src/pages/error/403.jsx +15 -0
- package/templates/template_admin_antd5/public/src/pages/error/404.jsx +15 -0
- package/templates/template_admin_antd5/public/src/pages/error/503.jsx +15 -0
- package/templates/template_admin_antd5/public/src/pages/error/permission.jsx +40 -0
- package/templates/template_admin_antd5/public/src/pages/error/permission.module.less +16 -0
- package/templates/template_admin_antd5/public/src/pages/home.jsx +90 -0
- package/templates/template_admin_antd5/public/src/pages/home.module.less +6 -0
- package/templates/template_admin_antd5/public/src/pages/login/index.jsx +113 -0
- package/templates/template_admin_antd5/public/src/pages/login/index.module.less +153 -0
- package/templates/template_admin_antd5/public/src/pages/pageTemplate.jsx +28 -0
- package/templates/template_admin_antd5/public/src/provider/app.jsx +201 -0
- package/templates/template_admin_antd5/public/src/provider/loading.jsx +47 -0
- package/templates/template_admin_antd5/public/src/provider/menu.jsx +161 -0
- package/templates/template_admin_antd5/public/src/provider/menu.module.less +35 -0
- package/templates/template_admin_antd5/public/src/route.jsx +127 -0
- package/templates/template_admin_antd5/public/src/services/demo.js +85 -0
- package/templates/template_admin_antd5/public/src/services/excel.js +43 -0
- package/templates/template_admin_antd5/public/src/services/http/index.js +155 -0
- package/templates/template_admin_antd5/public/src/services/index.js +126 -0
- package/templates/template_admin_antd5/public/src/services/interceptor/index.js +67 -0
- package/templates/template_admin_antd5/public/src/services/login.js +37 -0
- package/templates/template_admin_antd5/public/src/services/socket/index.jsx +99 -0
- package/templates/template_admin_antd5/public/src/services/token/index.js +41 -0
- package/templates/template_admin_antd5/public/src/type.js +67 -0
- package/templates/template_admin_antd5/public/src/utils/event.js +58 -0
- package/templates/template_admin_antd5/public/src/utils/format.js +135 -0
- package/templates/template_admin_antd5/public/src/utils/index.js +727 -0
- package/templates/template_admin_antd5/public/src/utils/menu.js +33 -0
- package/templates/template_admin_antd5/public/src/utils/rule.js +277 -0
- package/templates/template_admin_antd5/public/src/utils/storage.js +30 -0
- package/templates/template_admin_antd5/public/static/about.html +1 -0
- package/templates/template_admin_antd5/public/static/kssoLogin.html +22 -0
- package/templates/template_admin_antd5/readme.md +84 -0
- package/templates/template_admin_antd5/renamejstojsx.js +45 -0
- package/templates/template_admin_antd5/renameless.js +53 -0
- package/templates/template_admin_antd5/report.sh +25 -0
- package/templates/template_admin_antd5/shellUtil.sh +110 -0
- package/templates/template_admin_antd5/versionPublish.sh +16 -0
- package/templates/template_admin_antd5/webpack.api.js +105 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
@import '~@/_variable.module.less';
|
|
2
|
+
|
|
3
|
+
@import '~@/_mixin.module.less';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
.nav{
|
|
7
|
+
max-width: var(--nav-width);
|
|
8
|
+
min-width: var(--nav-min-width);
|
|
9
|
+
height:100%;
|
|
10
|
+
background-color: white;
|
|
11
|
+
transition: all .2s;
|
|
12
|
+
z-index: var(--z-nav-mobile);
|
|
13
|
+
overflow-y: auto;
|
|
14
|
+
border-right: 1px solid #DEE0E3;
|
|
15
|
+
.scrollBar;
|
|
16
|
+
&[data-nav-hide='true']{
|
|
17
|
+
display: none;
|
|
18
|
+
}
|
|
19
|
+
&[data-nav-mode='mobile']{
|
|
20
|
+
position: fixed;
|
|
21
|
+
z-index: var(--z-nav-mobile);
|
|
22
|
+
box-shadow: 0 0 20px #444;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
.iconUnread{
|
|
27
|
+
width: 6px;
|
|
28
|
+
height: 6px;
|
|
29
|
+
border-radius: 6px;
|
|
30
|
+
background-color: red;
|
|
31
|
+
position: absolute;
|
|
32
|
+
right: 0;
|
|
33
|
+
top: 0;
|
|
34
|
+
}
|
|
35
|
+
.menuLabel{
|
|
36
|
+
display: flex;
|
|
37
|
+
column-gap: 6px;
|
|
38
|
+
align-items: center;
|
|
39
|
+
font-size: inherit;
|
|
40
|
+
font-weight: inherit;
|
|
41
|
+
color:inherit;
|
|
42
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { openLink } from '@/utils';
|
|
5
|
+
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
import styles from './index.module.less';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 超链接组件
|
|
11
|
+
* @param {object} [props]
|
|
12
|
+
* @param {JSX.Element|string} [props.children] - 子组件
|
|
13
|
+
* @param {string} [props.className] - 扩展类样式名称
|
|
14
|
+
* @param {Function} [props.onClick] - 点击链接的回调
|
|
15
|
+
* @param {string} [props.href] - 跳转链接
|
|
16
|
+
* @param {string} [props.target] - 当target='_blank'时代表新窗口打开
|
|
17
|
+
*
|
|
18
|
+
* @returns {JSX.Element}
|
|
19
|
+
*/
|
|
20
|
+
const Link=(props)=>{
|
|
21
|
+
const {children,className='',onClick,href='',target=''} = props;
|
|
22
|
+
|
|
23
|
+
const onLink=()=>{
|
|
24
|
+
if(href){
|
|
25
|
+
if(target=='_blank'){
|
|
26
|
+
openLink(href);
|
|
27
|
+
// window.open(href);
|
|
28
|
+
}else{
|
|
29
|
+
location.href=href;
|
|
30
|
+
}
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if(onClick)onClick();
|
|
34
|
+
}
|
|
35
|
+
return (
|
|
36
|
+
<span onClick={onLink} className={`${styles.linkWrap} ${className}`}>{children}</span>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
export default React.memo(Link);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
import React,{ useState, useEffect } from 'react';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import styles from './index.module.less';
|
|
5
|
+
|
|
6
|
+
const MenuIcon=(props)=>{
|
|
7
|
+
|
|
8
|
+
const [icon,setIcon]= useState('');
|
|
9
|
+
const [iconActive,setIconActive]= useState('');
|
|
10
|
+
|
|
11
|
+
const getIcon= async (iconName)=>{
|
|
12
|
+
const req = await new Promise(resolve=>{
|
|
13
|
+
let iconActive =import(`@/assets/images/nav/${iconName}-active.png`);
|
|
14
|
+
let icon = import(`@/assets/images/nav/${iconName}.png`);
|
|
15
|
+
Promise.all([icon,iconActive]).then(values=>{
|
|
16
|
+
setIcon(values[0].default);
|
|
17
|
+
setIconActive(values[1].default)
|
|
18
|
+
})
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
useEffect(()=>{
|
|
22
|
+
getIcon(props.name);
|
|
23
|
+
},[])
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div className={styles.iconGroup}>
|
|
27
|
+
<img className={styles.icon} src={icon} />
|
|
28
|
+
<img className={styles.iconActive} src={iconActive} />
|
|
29
|
+
</div>
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
export default MenuIcon;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
.iconGroup{
|
|
5
|
+
width: 17px;
|
|
6
|
+
height: 100%;
|
|
7
|
+
margin-right: 12px;
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
margin-left:-12px;
|
|
11
|
+
|
|
12
|
+
img{width: 100%;}
|
|
13
|
+
.icon{
|
|
14
|
+
display: inline-block;
|
|
15
|
+
}
|
|
16
|
+
.iconActive{
|
|
17
|
+
display: none;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:global(.ant-menu-title-content){
|
|
22
|
+
font-size: 14px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:global(.ant-menu-submenu-selected),
|
|
26
|
+
:global(.ant-menu-item-selected),
|
|
27
|
+
:global(.ant-menu-submenu-active),
|
|
28
|
+
:global(.ant-menu-item-active){
|
|
29
|
+
.iconGroup .iconActive{
|
|
30
|
+
display: inline-block;
|
|
31
|
+
}
|
|
32
|
+
.iconGroup .icon{
|
|
33
|
+
display: none;
|
|
34
|
+
}
|
|
35
|
+
:global(.ant-menu-submenu-title .ant-menu-title-content),
|
|
36
|
+
:global(.ant-menu-item-selected .ant-menu-title-content){
|
|
37
|
+
font-weight: bold;
|
|
38
|
+
a{
|
|
39
|
+
font-weight: inherit;
|
|
40
|
+
color: #0974F2;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
:global(.ant-menu-submenu-arrow) {
|
|
44
|
+
color: #0974F2
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
:global(.ant-menu-inline.ant-menu-root .ant-menu-item > .ant-menu-title-content){
|
|
48
|
+
margin-left: -8px;
|
|
49
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React from 'react';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import ReactDOM from 'react-dom';
|
|
5
|
+
|
|
6
|
+
import Popup from '@/components/popup';
|
|
7
|
+
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
import imgLoading from '@/assets/images/loading.svg';
|
|
10
|
+
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
import CSS from './index.module.less';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 页面Loading状态
|
|
16
|
+
* @param {object} [props]
|
|
17
|
+
* @param {boolean} [props.visible=true] - 是否显示状态
|
|
18
|
+
*
|
|
19
|
+
* @returns {JSX.Element}
|
|
20
|
+
*/
|
|
21
|
+
const PageLoading = (props) => {
|
|
22
|
+
const {visible=true} = props;
|
|
23
|
+
if(!visible){
|
|
24
|
+
return <></>;
|
|
25
|
+
}
|
|
26
|
+
return (
|
|
27
|
+
<div className={CSS.wrap } >
|
|
28
|
+
<div className={CSS.box} data-show={visible}>
|
|
29
|
+
<img src={imgLoading} />
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 全屏置顶显示一个页面loading组件
|
|
37
|
+
* @param {object} [props]
|
|
38
|
+
* @param {boolean} [props.canTouch=false] - 是否允许用户点击屏幕穿透到下面的组件
|
|
39
|
+
*
|
|
40
|
+
* @returns {(string)=>void}
|
|
41
|
+
*/
|
|
42
|
+
export const ShowPageLoading=(props={canTouch:false})=>{
|
|
43
|
+
let popup = Popup(()=>{},{cantouch:props.canTouch});
|
|
44
|
+
ReactDOM.render(
|
|
45
|
+
<PageLoading visible={true} />,
|
|
46
|
+
popup.dom
|
|
47
|
+
);
|
|
48
|
+
return popup.destory;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default React.memo(PageLoading);
|
package/templates/template_admin_antd5/public/src/components/page/pageLoading/index.module.less
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.wrap {
|
|
2
|
+
position: fixed;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
left: 0;
|
|
6
|
+
top: 0;
|
|
7
|
+
z-index: 99;
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
align-items: center;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.box {
|
|
14
|
+
|
|
15
|
+
width: 80px;
|
|
16
|
+
height: 80px;
|
|
17
|
+
background: rgba(0,0,0,.3);
|
|
18
|
+
border-radius: 12px;
|
|
19
|
+
display: flex;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
align-items: center;
|
|
22
|
+
img{
|
|
23
|
+
display: block;
|
|
24
|
+
width:80%;
|
|
25
|
+
}
|
|
26
|
+
&[data-show=false]{
|
|
27
|
+
opacity: 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React from 'react';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import ReactDOM from 'react-dom';
|
|
5
|
+
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
import styles from './index.module.less';
|
|
8
|
+
styles;
|
|
9
|
+
|
|
10
|
+
export const popupList={
|
|
11
|
+
list:[],
|
|
12
|
+
remove:function(fn){
|
|
13
|
+
let list = popupList.list;
|
|
14
|
+
let idx = list.indexOf(fn);
|
|
15
|
+
if(idx>=0)list.splice(idx,1);
|
|
16
|
+
},
|
|
17
|
+
destroyAll:function(){
|
|
18
|
+
let list = popupList.list;
|
|
19
|
+
|
|
20
|
+
while(list.length>0){
|
|
21
|
+
let fn = list.shift();
|
|
22
|
+
fn(false);
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
add:function(fn){
|
|
26
|
+
popupList.list.push(fn);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 一个全屏置顶的遮罩层
|
|
32
|
+
* @param {(result)=>void} reslove - 遮罩层的关闭回调
|
|
33
|
+
* @param {Object} [options] - 参数
|
|
34
|
+
* @param {boolean} [options.cantouch=false] - 是否允许被点击穿透
|
|
35
|
+
* @param {boolean} [options.transparent=false] - 是否遮罩层完全透明
|
|
36
|
+
* @param {string} [options.className=''] - 扩展样式
|
|
37
|
+
*
|
|
38
|
+
*
|
|
39
|
+
* @returns { {dom:HTMLElement,destory:()=>void} }
|
|
40
|
+
*/
|
|
41
|
+
const Popup = (reslove,options) => {
|
|
42
|
+
let rootDom = document.createElement('div');
|
|
43
|
+
rootDom.className='popup-box';
|
|
44
|
+
if(options&&options.className)rootDom.className += ` ${options.className}`
|
|
45
|
+
if(options&&options.cantouch)rootDom.setAttribute('data-can-touch','1');
|
|
46
|
+
if(options&&options.transparent)rootDom.setAttribute('data-transparent','1');
|
|
47
|
+
|
|
48
|
+
let destory = (result) => {
|
|
49
|
+
popupList.remove(destory);
|
|
50
|
+
ReactDOM.unmountComponentAtNode(rootDom);
|
|
51
|
+
rootDom.parentNode.removeChild(rootDom);
|
|
52
|
+
if (reslove) reslove(result);
|
|
53
|
+
};
|
|
54
|
+
popupList.add(destory);
|
|
55
|
+
document.body.appendChild(rootDom);
|
|
56
|
+
return { dom: rootDom, destory };
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
export default Popup;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import ReactDOM from 'react-dom/client'; // 注意这里增加了 /client
|
|
2
|
+
|
|
3
|
+
export const ReactRender = (component, targetDom) => {
|
|
4
|
+
// 1. 创建 root
|
|
5
|
+
const root = ReactDOM.createRoot(targetDom);
|
|
6
|
+
// 2. 渲染组件
|
|
7
|
+
root.render(component);
|
|
8
|
+
|
|
9
|
+
// 建议:返回这个 root,以便将来可以手动卸载 root.unmount()
|
|
10
|
+
return root;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default { ReactRender };
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
2
|
+
import styles from './index.module.css';
|
|
3
|
+
|
|
4
|
+
const ResizableContainer = (props) => {
|
|
5
|
+
const { children, title = '', width: propWidth, height: propHeight, onResize } = props;
|
|
6
|
+
const [refreshKey, setRefreshKey] = useState(0);
|
|
7
|
+
const [containerSize, setContainerSize] = useState({ width: propWidth || 400, height: propHeight || 200 });
|
|
8
|
+
const [displaySize, setDisplaySize] = useState({ width: propWidth || 400, height: propHeight || 200 });
|
|
9
|
+
const [isEditing, setIsEditing] = useState(false);
|
|
10
|
+
const [editValue, setEditValue] = useState('');
|
|
11
|
+
const contentRef = useRef(null);
|
|
12
|
+
const wrapRef = useRef(null);
|
|
13
|
+
const refSize = useRef({ width: 0, height: 0 });
|
|
14
|
+
const inputRef = useRef(null);
|
|
15
|
+
const isManualResize = useRef(false);
|
|
16
|
+
|
|
17
|
+
// 同步外部传入的宽高
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (propWidth) {
|
|
20
|
+
setContainerSize(prev => ({ ...prev, width: propWidth }));
|
|
21
|
+
setDisplaySize(prev => ({ ...prev, width: propWidth }));
|
|
22
|
+
}
|
|
23
|
+
if (propHeight) {
|
|
24
|
+
setContainerSize(prev => ({ ...prev, height: propHeight }));
|
|
25
|
+
setDisplaySize(prev => ({ ...prev, height: propHeight }));
|
|
26
|
+
}
|
|
27
|
+
}, [propWidth, propHeight]);
|
|
28
|
+
|
|
29
|
+
// 监听容器大小变化(用户手动拖拽 resize 手柄时)
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (!wrapRef.current) return;
|
|
32
|
+
|
|
33
|
+
const observer = new ResizeObserver((entries) => {
|
|
34
|
+
// 如果是手动输入导致的尺寸变化,跳过
|
|
35
|
+
if (isManualResize.current) {
|
|
36
|
+
isManualResize.current = false;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const entry = entries[0];
|
|
41
|
+
// 使用 borderBoxSize 获取包含边框的尺寸
|
|
42
|
+
const newWidth = entry.borderBoxSize?.[0]?.inlineSize || entry.contentRect.width;
|
|
43
|
+
const newHeight = entry.borderBoxSize?.[0]?.blockSize || entry.contentRect.height;
|
|
44
|
+
|
|
45
|
+
if (refSize?.current?.width !== newWidth || refSize?.current?.height !== newHeight) {
|
|
46
|
+
refSize.current.width = newWidth;
|
|
47
|
+
refSize.current.height = newHeight;
|
|
48
|
+
setDisplaySize({ width: newWidth, height: newHeight });
|
|
49
|
+
if (onResize) {
|
|
50
|
+
onResize({ width: newWidth, height: newHeight });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
observer.observe(wrapRef.current);
|
|
56
|
+
return () => observer.disconnect();
|
|
57
|
+
}, [onResize]);
|
|
58
|
+
|
|
59
|
+
// 自动聚焦输入框
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (isEditing && inputRef.current) {
|
|
62
|
+
inputRef.current.focus();
|
|
63
|
+
inputRef.current.select();
|
|
64
|
+
}
|
|
65
|
+
}, [isEditing]);
|
|
66
|
+
|
|
67
|
+
// 双击显示输入框
|
|
68
|
+
const handleDoubleClick = useCallback(() => {
|
|
69
|
+
setEditValue(`${Math.round(displaySize.width)}x${Math.round(displaySize.height)}`);
|
|
70
|
+
setIsEditing(true);
|
|
71
|
+
}, [displaySize]);
|
|
72
|
+
|
|
73
|
+
// 处理输入变化
|
|
74
|
+
const handleInputChange = useCallback((e) => {
|
|
75
|
+
setEditValue(e.target.value);
|
|
76
|
+
}, []);
|
|
77
|
+
|
|
78
|
+
// 处理按键事件
|
|
79
|
+
const handleKeyDown = useCallback((e) => {
|
|
80
|
+
if (e.key === 'Enter') {
|
|
81
|
+
// 解析输入值
|
|
82
|
+
const match = editValue.match(/^\s*(\d+)\s*[xX×]\s*(\d+)\s*$/);
|
|
83
|
+
if (match) {
|
|
84
|
+
const newWidth = parseInt(match[1], 10);
|
|
85
|
+
const newHeight = parseInt(match[2], 10);
|
|
86
|
+
|
|
87
|
+
if (newWidth >= 100 && newHeight >= 100) {
|
|
88
|
+
// 标记为手动调整,避免 ResizeObserver 回调覆盖
|
|
89
|
+
isManualResize.current = true;
|
|
90
|
+
setContainerSize({ width: newWidth, height: newHeight });
|
|
91
|
+
setDisplaySize({ width: newWidth, height: newHeight });
|
|
92
|
+
refSize.current.width = newWidth;
|
|
93
|
+
refSize.current.height = newHeight;
|
|
94
|
+
if (onResize) {
|
|
95
|
+
onResize({ width: newWidth, height: newHeight });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
setIsEditing(false);
|
|
100
|
+
} else if (e.key === 'Escape') {
|
|
101
|
+
setIsEditing(false);
|
|
102
|
+
}
|
|
103
|
+
}, [editValue, onResize]);
|
|
104
|
+
|
|
105
|
+
// 失去焦点时取消编辑
|
|
106
|
+
const handleBlur = useCallback(() => {
|
|
107
|
+
setIsEditing(false);
|
|
108
|
+
}, []);
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<hgroup ref={wrapRef} className={styles.wrap} style={{ width: containerSize.width, height: containerSize.height }}>
|
|
112
|
+
<div className={styles.header}>
|
|
113
|
+
<p>{title}</p>
|
|
114
|
+
<div className={styles.sizeDisplay} onDoubleClick={handleDoubleClick} title="双击修改尺寸">
|
|
115
|
+
{isEditing ? (
|
|
116
|
+
<input
|
|
117
|
+
ref={inputRef}
|
|
118
|
+
className={styles.sizeInput}
|
|
119
|
+
value={editValue}
|
|
120
|
+
onChange={handleInputChange}
|
|
121
|
+
onKeyDown={handleKeyDown}
|
|
122
|
+
onBlur={handleBlur}
|
|
123
|
+
placeholder="宽x高"
|
|
124
|
+
/>
|
|
125
|
+
) : (
|
|
126
|
+
<span className={styles.sizeText}>{Math.round(displaySize.width)} x {Math.round(displaySize.height)}</span>
|
|
127
|
+
)}
|
|
128
|
+
</div>
|
|
129
|
+
<button
|
|
130
|
+
className={styles.refreshBtn}
|
|
131
|
+
onClick={() => setRefreshKey(k => k + 1)}
|
|
132
|
+
title="刷新"
|
|
133
|
+
>
|
|
134
|
+
↻
|
|
135
|
+
</button>
|
|
136
|
+
</div>
|
|
137
|
+
<div key={refreshKey} ref={contentRef} className={styles.content}>
|
|
138
|
+
{children}
|
|
139
|
+
</div>
|
|
140
|
+
</hgroup>
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export default ResizableContainer;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
|
|
2
|
+
.wrap{
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
width: 300px;
|
|
6
|
+
height: 300px;
|
|
7
|
+
padding: var(--padding-small);
|
|
8
|
+
border: 1px solid #d9d9d9;
|
|
9
|
+
border-radius: 4px;
|
|
10
|
+
background-color: transparent;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
resize: both;
|
|
13
|
+
min-width: 100px;
|
|
14
|
+
min-height: 100px;
|
|
15
|
+
gap: var(--padding-small);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.header{
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
gap: 8px;
|
|
23
|
+
|
|
24
|
+
&>p{
|
|
25
|
+
display: inline-block;
|
|
26
|
+
color:black;
|
|
27
|
+
background: #f0f0f0;
|
|
28
|
+
margin: 0;
|
|
29
|
+
padding: 2px 8px;
|
|
30
|
+
border-radius: 2px;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.sizeDisplay{
|
|
35
|
+
flex: 1;
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
user-select: none;
|
|
41
|
+
padding: 2px 8px;
|
|
42
|
+
border-radius: 2px;
|
|
43
|
+
transition: background 0.2s;
|
|
44
|
+
|
|
45
|
+
&:hover{
|
|
46
|
+
background: #e6f7ff;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.sizeText{
|
|
51
|
+
font-size: 12px;
|
|
52
|
+
color: #666;
|
|
53
|
+
font-family: monospace;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.sizeInput{
|
|
57
|
+
width: 100px;
|
|
58
|
+
padding: 2px 6px;
|
|
59
|
+
border: 1px solid #1890ff;
|
|
60
|
+
border-radius: 2px;
|
|
61
|
+
font-size: 12px;
|
|
62
|
+
font-family: monospace;
|
|
63
|
+
text-align: center;
|
|
64
|
+
outline: none;
|
|
65
|
+
|
|
66
|
+
&:focus{
|
|
67
|
+
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.refreshBtn{
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
padding: 2px 6px;
|
|
74
|
+
border: 1px solid #d9d9d9;
|
|
75
|
+
background: #fff;
|
|
76
|
+
border-radius: 2px;
|
|
77
|
+
font-size: 12px;
|
|
78
|
+
line-height: 1;
|
|
79
|
+
|
|
80
|
+
&:hover{
|
|
81
|
+
background: #f0f0f0;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.content{
|
|
86
|
+
flex: 1;
|
|
87
|
+
overflow: hidden;
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-direction: column;
|
|
90
|
+
}
|