kn-cli 1.0.134 → 1.0.135
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/vite.config.js +1 -0
- package/package.json +1 -1
- package/templates/template_admin_antd5/package.json +3 -3
- package/templates/template_admin_antd5/public/src/_antd.less +4 -4
- package/templates/template_admin_antd5/public/src/_reset.module.less +1 -1
- package/templates/template_admin_antd5/public/src/_variable.module.less +5 -5
- package/templates/template_admin_antd5/public/src/assets/images/expand-hover.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/expand.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/icon-add.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/icon-full-size.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/icon-resize.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/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/nav/slogan.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/unexpand-hover.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/unexpand.png +0 -0
- package/templates/template_admin_antd5/public/src/components/antd/antProvider.jsx +16 -4
- package/templates/template_admin_antd5/public/src/components/antd/drawer/README.md +336 -0
- package/templates/template_admin_antd5/public/src/components/antd/drawer/index.jsx +264 -0
- package/templates/template_admin_antd5/public/src/components/antd/index.jsx +19 -7
- package/templates/template_admin_antd5/public/src/components/antd/index.module.less +26 -0
- package/templates/template_admin_antd5/public/src/components/antd/modal/README.md +324 -0
- package/templates/template_admin_antd5/public/src/components/antd/modal/index.jsx +185 -0
- package/templates/template_admin_antd5/public/src/components/antd/select/index.jsx +1 -1
- package/templates/template_admin_antd5/public/src/components/antd/spin/index.jsx +92 -0
- package/templates/template_admin_antd5/public/src/components/antd/spin/index.module.less +58 -0
- package/templates/template_admin_antd5/public/src/components/antd/theme.js +19 -8
- package/templates/template_admin_antd5/public/src/components/antd/tooltip/detail/index.jsx +19 -56
- package/templates/template_admin_antd5/public/src/components/debug/index.jsx +7 -2
- package/templates/template_admin_antd5/public/src/components/error/index.jsx +0 -5
- package/templates/template_admin_antd5/public/src/components/icon/expand/index.jsx +17 -0
- package/templates/template_admin_antd5/public/src/components/icon/expand/index.module.less +22 -0
- package/templates/template_admin_antd5/public/src/components/icon/fullSize/index.jsx +13 -0
- package/templates/template_admin_antd5/public/src/components/icon/fullSize/index.module.less +28 -0
- package/templates/template_admin_antd5/public/src/components/icon/index.jsx +7 -1
- package/templates/template_admin_antd5/public/src/components/image/preview.jsx +7 -10
- package/templates/template_admin_antd5/public/src/components/layout/basic/index.module.less +1 -1
- package/templates/template_admin_antd5/public/src/components/leftMenu/index.jsx +1 -2
- package/templates/template_admin_antd5/public/src/components/link/index.module.less +2 -2
- package/templates/template_admin_antd5/public/src/components/menuIcon/index.module.less +3 -3
- package/templates/template_admin_antd5/public/src/components/popup/index.jsx +91 -50
- package/templates/template_admin_antd5/public/src/components/popup/index.module.less +22 -15
- package/templates/template_admin_antd5/public/src/components/react/index.jsx +23 -9
- package/templates/template_admin_antd5/public/src/components/resizeBox/index.jsx +3 -3
- package/templates/template_admin_antd5/public/src/components/select/defaultServicesSelect/index.jsx +151 -40
- package/templates/template_admin_antd5/public/src/components/select/dictSelect/index.jsx +19 -3
- package/templates/template_admin_antd5/public/src/components/select/useSelectList.jsx +65 -65
- package/templates/template_admin_antd5/public/src/components/table/index.jsx +48 -327
- package/templates/template_admin_antd5/public/src/components/table/index.module.less +0 -110
- package/templates/template_admin_antd5/public/src/components/table/table/index.jsx +242 -0
- package/templates/template_admin_antd5/public/src/components/table/table/index.module.less +85 -0
- package/templates/template_admin_antd5/public/src/components/table/withPage.jsx +53 -0
- package/templates/template_admin_antd5/public/src/components/topMenu/index.jsx +46 -11
- package/templates/template_admin_antd5/public/src/components/topMenu/index.module.less +10 -7
- package/templates/template_admin_antd5/public/src/components/topMenu/popmenu/index.jsx +89 -0
- package/templates/template_admin_antd5/public/src/components/topMenu/popmenu/index.module.less +76 -0
- package/templates/template_admin_antd5/public/src/components/topMenu/topBar/index.module.less +4 -3
- package/templates/template_admin_antd5/public/src/components/video/index.jsx +1 -1
- package/templates/template_admin_antd5/public/src/components/video/preview.jsx +7 -10
- package/templates/template_admin_antd5/public/src/config.js +3 -0
- package/templates/template_admin_antd5/public/src/hooks/useLoading.jsx +2 -2
- package/templates/template_admin_antd5/public/src/index.jsx +2 -4
- package/templates/template_admin_antd5/public/src/mock/demo.js +3 -3
- package/templates/template_admin_antd5/public/src/pages/antdComponents/button/index.jsx +22 -0
- package/templates/template_admin_antd5/public/src/pages/antdComponents/check/index.jsx +12 -0
- package/templates/template_admin_antd5/public/src/pages/antdComponents/index.jsx +57 -114
- package/templates/template_admin_antd5/public/src/pages/antdComponents/index.module.less +5 -0
- package/templates/template_admin_antd5/public/src/pages/antdComponents/input/index.jsx +14 -0
- package/templates/template_admin_antd5/public/src/pages/antdComponents/loading/index.jsx +31 -0
- package/templates/template_admin_antd5/public/src/pages/antdComponents/message/index.jsx +102 -0
- package/templates/template_admin_antd5/public/src/pages/antdComponents/message/index.module.less +17 -0
- package/templates/template_admin_antd5/public/src/pages/antdComponents/radio/index.jsx +26 -0
- package/templates/template_admin_antd5/public/src/pages/antdComponents/select/index.jsx +13 -0
- package/templates/template_admin_antd5/public/src/pages/antdComponents/switch/index.jsx +12 -0
- package/templates/template_admin_antd5/public/src/pages/antdComponents/tableWithPage/index.jsx +70 -0
- package/templates/template_admin_antd5/public/src/pages/antdComponents/text/index.jsx +21 -0
- package/templates/template_admin_antd5/public/src/pages/auth/user/dialog/index.jsx +48 -75
- package/templates/template_admin_antd5/public/src/pages/auth/user/index.jsx +17 -23
- package/templates/template_admin_antd5/public/src/pages/lazyLoad/index.jsx +11 -0
- package/templates/template_admin_antd5/public/src/pages/login/index.jsx +8 -3
- package/templates/template_admin_antd5/public/src/pages/login/index.module.less +18 -10
- package/templates/template_admin_antd5/public/src/route.jsx +14 -9
- package/templates/template_admin_antd5/public/src/services/demo.js +38 -2
- package/templates/template_admin_antd5/public/src/services/interceptor/index.js +30 -3
- package/templates/template_admin_antd5/public/src/types/global.d.js +306 -0
- package/templates/template_admin_antd5/public/src/utils/format.js +1 -1
- package/templates/template_admin_antd5/public/src/utils/index.js +3 -3
- package/templates/template_admin_antd5/public/src/utils/moment.js +15 -0
- package/templates/template_admin_antd5/public/src/components/_table/column.jsx +0 -47
- package/templates/template_admin_antd5/public/src/components/_table/column.module.less +0 -12
- package/templates/template_admin_antd5/public/src/components/_table/index.jsx +0 -71
- package/templates/template_admin_antd5/public/src/components/_table/index.module.less +0 -15
- package/templates/template_admin_antd5/public/src/components/badge/index.jsx +0 -47
- package/templates/template_admin_antd5/public/src/components/badge/index.module.less +0 -44
- package/templates/template_admin_antd5/public/src/components/page/pageLoading/index.jsx +0 -51
- package/templates/template_admin_antd5/public/src/components/page/pageLoading/index.module.less +0 -29
- package/templates/template_admin_antd5/public/src/components/table/aliTable/index.jsx +0 -250
- package/templates/template_admin_antd5/public/src/components/table/aliTable/index.module.less +0 -105
- package/templates/template_admin_antd5/public/src/components/toast/index.jsx +0 -79
- package/templates/template_admin_antd5/public/src/components/toast/index.module.less +0 -43
- package/templates/template_admin_antd5/public/src/type.js +0 -67
- package/templates/template_admin_antd5/renamejstojsx.js +0 -45
- package/templates/template_admin_antd5/renameless.js +0 -53
- /package/templates/template_admin_antd5/public/src/components/{button → antd/button}/index.jsx +0 -0
- /package/templates/template_admin_antd5/public/src/components/resizeBox/{index.module.css → index.module.less} +0 -0
|
@@ -1,72 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
.tableScrollWrap{
|
|
4
|
-
flex:1;
|
|
5
|
-
height: 100%;
|
|
6
|
-
width: 100%;
|
|
7
|
-
overflow: auto;
|
|
8
|
-
position: relative;
|
|
9
|
-
&.sticky {
|
|
10
|
-
overflow: visible;
|
|
11
|
-
:global {
|
|
12
|
-
.ant-table-body:has(+ .ant-table-sticky-scroll) {
|
|
13
|
-
&::-webkit-scrollbar {
|
|
14
|
-
display: none;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
&[data-full='true']{
|
|
20
|
-
position: fixed;
|
|
21
|
-
width: 100%;
|
|
22
|
-
height: 100%;
|
|
23
|
-
z-index: 2;
|
|
24
|
-
padding:8px;
|
|
25
|
-
background-color: #fff;
|
|
26
|
-
left:0;
|
|
27
|
-
top:0;
|
|
28
|
-
z-index:9999;
|
|
29
|
-
}
|
|
30
|
-
.resizeTable{
|
|
31
|
-
position: absolute;
|
|
32
|
-
right:4px;
|
|
33
|
-
top:4px;
|
|
34
|
-
z-index: 20;
|
|
35
|
-
box-shadow: 0 0 2px #000;
|
|
36
|
-
}
|
|
37
|
-
.close{
|
|
38
|
-
font-size: 24px;
|
|
39
|
-
position: absolute;
|
|
40
|
-
right:16px;
|
|
41
|
-
top:16px;
|
|
42
|
-
z-index: 2;
|
|
43
|
-
}
|
|
44
|
-
:global {
|
|
45
|
-
.ant-table-selection-extra {
|
|
46
|
-
left: 18px;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
.footer{
|
|
51
|
-
width: 100%;
|
|
52
|
-
position: relative;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.tableWrap{
|
|
56
|
-
flex:1;
|
|
57
|
-
display: flex;
|
|
58
|
-
width: 100%;
|
|
59
|
-
flex-direction: column;
|
|
60
|
-
overflow: hidden;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.iconAdd{
|
|
64
|
-
background-image: url('~@/assets/images/icon-add.png');
|
|
65
|
-
background-size: contain;
|
|
66
|
-
width: 24px;
|
|
67
|
-
height:24px;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
3
|
.expanded{
|
|
71
4
|
background-image: url('~@/assets/images/expand.png');
|
|
72
5
|
background-size:100% 100%;
|
|
@@ -88,46 +21,3 @@
|
|
|
88
21
|
}
|
|
89
22
|
}
|
|
90
23
|
|
|
91
|
-
.fullSize{
|
|
92
|
-
position: relative;
|
|
93
|
-
|
|
94
|
-
display: flex;
|
|
95
|
-
align-items: center;
|
|
96
|
-
justify-content: center;
|
|
97
|
-
cursor: pointer;
|
|
98
|
-
width: 32px;
|
|
99
|
-
height: 32px;
|
|
100
|
-
border-radius: 4px;
|
|
101
|
-
border:1px solid #ccc;
|
|
102
|
-
|
|
103
|
-
.icon{
|
|
104
|
-
display: inline-block;
|
|
105
|
-
background-image: url('~@/assets/images/icon-full-size.png');
|
|
106
|
-
background-size:100% 100%;
|
|
107
|
-
width: 20px;
|
|
108
|
-
height: 20px;
|
|
109
|
-
&[data-full='true']{
|
|
110
|
-
background-image: url('~@/assets/images/icon-resize.png');
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
.loading{
|
|
120
|
-
position: absolute;
|
|
121
|
-
display: none;
|
|
122
|
-
left:0;
|
|
123
|
-
top:0;
|
|
124
|
-
width: 100%;
|
|
125
|
-
height: 100%;
|
|
126
|
-
background-color: rgba(255,255,255,.8);
|
|
127
|
-
z-index: 3;
|
|
128
|
-
&[data-show='true']{
|
|
129
|
-
display: flex;
|
|
130
|
-
justify-content: center;
|
|
131
|
-
align-items: center;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import React,{useCallback,useEffect,useRef,useState} from 'react';
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
import { Spin, Table } from "@/components/antd";
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import styles from './index.module.less';
|
|
6
|
+
|
|
7
|
+
import {useEsc} from '@/hooks';
|
|
8
|
+
import useDebounceFn from '@/hooks/useDebounceFn';
|
|
9
|
+
import { useLayoutEffect } from 'react';
|
|
10
|
+
import {SCROLL_CONFIG,PAGE_SIZE_LIST,FullSizeIcon} from '../';
|
|
11
|
+
|
|
12
|
+
const getDomHeight=dom=>{
|
|
13
|
+
if(!dom)return 0;
|
|
14
|
+
const rect = dom.getBoundingClientRect();
|
|
15
|
+
const style = window.getComputedStyle(dom);
|
|
16
|
+
const totalHeight = rect.height + parseFloat(style.marginTop) + parseFloat(style.marginBottom);
|
|
17
|
+
return totalHeight;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 页面公共Table组件
|
|
23
|
+
* @param {object} [props]
|
|
24
|
+
* @param {string|((item:object)=>string)} [props.rowKey] - Table主键
|
|
25
|
+
* @param {string} [props.className] - 自定义类名
|
|
26
|
+
* @param {boolean} [props.loading] - 是否加载中
|
|
27
|
+
* @param {Array} [props.columns] - 表格列
|
|
28
|
+
* @param {Array} [props.dataSource] - 数据数组
|
|
29
|
+
* @param {object} [props.pagination] - 分页器,参考配置项或 pagination 文档,设为 false 时不展示和进行分页
|
|
30
|
+
* @param {object} [props.scroll] - 表格是否可滚动
|
|
31
|
+
* @param {object} [props.page] - 表格数据,包括数据数组、分页参数、loading等
|
|
32
|
+
* @param {number} [props.minWidth] - 表格无数据时的最小宽度限制
|
|
33
|
+
* @param {*} [props.rowSelection] - 行配置
|
|
34
|
+
* @param {*} [props.expandable] - antd的展开配置
|
|
35
|
+
* @param {boolean} [props.sticky] - 表头是否吸附固定
|
|
36
|
+
* @param {string} [props.heightMode] - 高度适配模式,默认为无限向下拓展,'inWrap':最大高度不超过父容器
|
|
37
|
+
* @param {boolean} [props.fullScreen=false] - 是否全屏展示
|
|
38
|
+
* @param {()=>void} [props.onCancelFullScreen] - 退出全屏的回调
|
|
39
|
+
* @param {(column,index)=>object} [props.onHeaderRow] -
|
|
40
|
+
* @param {JSX.Element} [props.footer] - 表格底部额外的东西
|
|
41
|
+
* @param {string|number} [props.updateCount] - 用于强制刷新table
|
|
42
|
+
* @param {array} [props.sortDirections] - 排序的顺序
|
|
43
|
+
* @param {boolean} [props.virtual=false] - 是否开启虚拟滚动,如果开启scroll必须指定值
|
|
44
|
+
* @param {*} [props.onChange]
|
|
45
|
+
*
|
|
46
|
+
* @returns {JSX.Element}
|
|
47
|
+
*/
|
|
48
|
+
const AutoSizeTable = (props) => {
|
|
49
|
+
const {
|
|
50
|
+
rowKey='id',
|
|
51
|
+
loading,
|
|
52
|
+
columns,
|
|
53
|
+
dataSource,
|
|
54
|
+
pagination=false,
|
|
55
|
+
scroll,
|
|
56
|
+
minWidth=undefined,
|
|
57
|
+
sticky,
|
|
58
|
+
heightMode='default',
|
|
59
|
+
fullScreen=false,
|
|
60
|
+
onCancelFullScreen,
|
|
61
|
+
footer=null,
|
|
62
|
+
updateCount=0,
|
|
63
|
+
onChange:_onChange,
|
|
64
|
+
...others
|
|
65
|
+
} = props;
|
|
66
|
+
|
|
67
|
+
const domTheadName= `.ant5-table-thead`;
|
|
68
|
+
const domPagination='.ant5-pagination';
|
|
69
|
+
const escControl = useEsc({name:'table'});
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @type {React.MutableRefObject<object>}
|
|
73
|
+
*/
|
|
74
|
+
const refTable=useRef();
|
|
75
|
+
/**
|
|
76
|
+
* @type {React.MutableRefObject<object>}
|
|
77
|
+
*/
|
|
78
|
+
const refSelf = useRef();
|
|
79
|
+
/**
|
|
80
|
+
* @type {React.MutableRefObject<object>}
|
|
81
|
+
*/
|
|
82
|
+
const refFooter = useRef();
|
|
83
|
+
|
|
84
|
+
const [resize,setResize]=useState(0);
|
|
85
|
+
const refResize=useRef(()=>{
|
|
86
|
+
refSelf.current.setResize(1);
|
|
87
|
+
})
|
|
88
|
+
const [resizeLazy] = useDebounceFn(refResize.current,{wait:1000})
|
|
89
|
+
|
|
90
|
+
const paginationFn = useCallback(() => {
|
|
91
|
+
if(!pagination)return false;
|
|
92
|
+
// pagination=false时不分页
|
|
93
|
+
if (typeof pagination === 'boolean') {
|
|
94
|
+
return pagination;
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
showSizeChanger:true,
|
|
98
|
+
showQuickJumper:true,
|
|
99
|
+
pageSizeOptions: PAGE_SIZE_LIST,
|
|
100
|
+
showTotal: (total) => `总计${total}条`,
|
|
101
|
+
...pagination,
|
|
102
|
+
};
|
|
103
|
+
}, [pagination]);
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
const getList=useCallback(()=>{
|
|
107
|
+
return dataSource;
|
|
108
|
+
},[dataSource]);
|
|
109
|
+
|
|
110
|
+
const [scrollConfig,setScrollConfig] = useState(()=>{
|
|
111
|
+
const scrollConfig = scroll?{...SCROLL_CONFIG,...scroll}: {...SCROLL_CONFIG};
|
|
112
|
+
let list =getList();
|
|
113
|
+
// 当没数据时,列的宽度取minWidth
|
|
114
|
+
if(minWidth && (!list||list.length<=0) ){
|
|
115
|
+
scrollConfig.x = minWidth;
|
|
116
|
+
}
|
|
117
|
+
return scrollConfig;
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const onCancelFull=()=>{
|
|
121
|
+
if(fullScreen){
|
|
122
|
+
if(onCancelFullScreen){
|
|
123
|
+
onCancelFullScreen();
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const onChange=(pagination, filters, sorter, extra)=>{
|
|
129
|
+
if(_onChange){
|
|
130
|
+
_onChange(pagination, filters, sorter, extra)
|
|
131
|
+
}
|
|
132
|
+
if(pagination){
|
|
133
|
+
resizeLazy();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
refSelf.current={
|
|
138
|
+
onCancelFull,
|
|
139
|
+
setResize,
|
|
140
|
+
resize,
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
useEffect(()=>{
|
|
144
|
+
escControl.addEventListener(onCancelFull);
|
|
145
|
+
return ()=>{
|
|
146
|
+
escControl.removeEventListener(onCancelFull);
|
|
147
|
+
}
|
|
148
|
+
},[onCancelFull])
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
useLayoutEffect(()=>{
|
|
152
|
+
let list = getList();
|
|
153
|
+
let observer;
|
|
154
|
+
const scrollConfig = scroll?{...SCROLL_CONFIG,...scroll}: {...SCROLL_CONFIG};
|
|
155
|
+
// 当没数据时,列的宽度取minWidth
|
|
156
|
+
if(minWidth && (!list||list.length<=0) ){
|
|
157
|
+
scrollConfig.x = minWidth;
|
|
158
|
+
}
|
|
159
|
+
if(refTable?.current){
|
|
160
|
+
let dom = refTable.current;
|
|
161
|
+
let theadHeight= 0;
|
|
162
|
+
let pagationHeight= 0;
|
|
163
|
+
if(fullScreen || heightMode=='inWrap'){
|
|
164
|
+
const thead = dom.querySelector(domTheadName);
|
|
165
|
+
if(thead){
|
|
166
|
+
observer = new ResizeObserver((entries) => {
|
|
167
|
+
entries.forEach(entry => {
|
|
168
|
+
const height = entry.contentRect.height;
|
|
169
|
+
if(refSelf.current.resize != height){
|
|
170
|
+
refSelf.current.setResize(height)
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
observer.observe(thead);
|
|
175
|
+
theadHeight = getDomHeight(thead)+16;
|
|
176
|
+
}
|
|
177
|
+
if(pagination){
|
|
178
|
+
const _domPagination = dom.querySelector(domPagination);
|
|
179
|
+
pagationHeight= _domPagination?getDomHeight(_domPagination):28;
|
|
180
|
+
}
|
|
181
|
+
let maxHeight= dom.clientHeight;
|
|
182
|
+
let footerHeight = footer?getDomHeight(refFooter.current):0;
|
|
183
|
+
let h= maxHeight-(theadHeight+pagationHeight+footerHeight);
|
|
184
|
+
scrollConfig.y = h;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
setScrollConfig(scrollConfig)
|
|
188
|
+
if(observer){
|
|
189
|
+
return ()=>{
|
|
190
|
+
observer.disconnect();
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
},[dataSource,fullScreen,resize,updateCount])
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
useEffect(()=>{
|
|
198
|
+
const resize = ()=>{
|
|
199
|
+
resizeLazy();
|
|
200
|
+
}
|
|
201
|
+
window.addEventListener('resize',resize)
|
|
202
|
+
return ()=>{
|
|
203
|
+
window.removeEventListener('resize',resize);
|
|
204
|
+
}
|
|
205
|
+
},[])
|
|
206
|
+
|
|
207
|
+
return (
|
|
208
|
+
<section ref={refTable} className={`${styles.tableScrollWrap} ${sticky ? styles.sticky: ''}`} data-full={fullScreen}>
|
|
209
|
+
{
|
|
210
|
+
loading?
|
|
211
|
+
<Table
|
|
212
|
+
bordered
|
|
213
|
+
size="small"
|
|
214
|
+
columns={columns}
|
|
215
|
+
key='loading'
|
|
216
|
+
loading={true}
|
|
217
|
+
scroll={ scrollConfig }
|
|
218
|
+
/>:
|
|
219
|
+
<Table
|
|
220
|
+
rowKey={rowKey}
|
|
221
|
+
bordered
|
|
222
|
+
size="small"
|
|
223
|
+
columns={columns}
|
|
224
|
+
dataSource={getList()}
|
|
225
|
+
pagination={paginationFn()}
|
|
226
|
+
scroll={ scrollConfig }
|
|
227
|
+
sticky={sticky}
|
|
228
|
+
onChange={onChange}
|
|
229
|
+
{...others}
|
|
230
|
+
/>
|
|
231
|
+
}
|
|
232
|
+
{footer?<div className={styles.footer} ref={refFooter}>{footer}</div>:''}
|
|
233
|
+
<div className={styles.loading} data-show={ loading }><Spin /></div>
|
|
234
|
+
{
|
|
235
|
+
fullScreen?<FullSizeIcon className={styles.resizeTable} full={fullScreen} onClick={onCancelFull}/>:<></>
|
|
236
|
+
}
|
|
237
|
+
</section>
|
|
238
|
+
);
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
export default AutoSizeTable;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
.tableScrollWrap{
|
|
4
|
+
flex:1;
|
|
5
|
+
height: 100%;
|
|
6
|
+
width: 100%;
|
|
7
|
+
overflow: auto;
|
|
8
|
+
position: relative;
|
|
9
|
+
&.sticky {
|
|
10
|
+
overflow: visible;
|
|
11
|
+
// :global {
|
|
12
|
+
// .ant-table-body:has(+ .ant-table-sticky-scroll) {
|
|
13
|
+
// &::-webkit-scrollbar {
|
|
14
|
+
// display: none;
|
|
15
|
+
// }
|
|
16
|
+
// }
|
|
17
|
+
// }
|
|
18
|
+
}
|
|
19
|
+
&[data-full='true']{
|
|
20
|
+
position: fixed;
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
z-index: 2;
|
|
24
|
+
padding:8px;
|
|
25
|
+
background-color: #fff;
|
|
26
|
+
left:0;
|
|
27
|
+
top:0;
|
|
28
|
+
z-index:9999;
|
|
29
|
+
}
|
|
30
|
+
.resizeTable{
|
|
31
|
+
position: absolute;
|
|
32
|
+
right:4px;
|
|
33
|
+
top:4px;
|
|
34
|
+
z-index: 20;
|
|
35
|
+
box-shadow: 0 0 2px #000;
|
|
36
|
+
}
|
|
37
|
+
.close{
|
|
38
|
+
font-size: 24px;
|
|
39
|
+
position: absolute;
|
|
40
|
+
right:16px;
|
|
41
|
+
top:16px;
|
|
42
|
+
z-index: 2;
|
|
43
|
+
}
|
|
44
|
+
// :global {
|
|
45
|
+
// .ant-table-selection-extra {
|
|
46
|
+
// left: 18px;
|
|
47
|
+
// }
|
|
48
|
+
// }
|
|
49
|
+
}
|
|
50
|
+
.footer{
|
|
51
|
+
width: 100%;
|
|
52
|
+
position: relative;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.tableWrap{
|
|
56
|
+
flex:1;
|
|
57
|
+
display: flex;
|
|
58
|
+
width: 100%;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.iconAdd{
|
|
64
|
+
background-image: url('~@/assets/images/icon-add.png');
|
|
65
|
+
background-size: contain;
|
|
66
|
+
width: 24px;
|
|
67
|
+
height:24px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
.loading{
|
|
72
|
+
position: absolute;
|
|
73
|
+
display: none;
|
|
74
|
+
left:0;
|
|
75
|
+
top:0;
|
|
76
|
+
width: 100%;
|
|
77
|
+
height: 100%;
|
|
78
|
+
background-color: rgba(255,255,255,.8);
|
|
79
|
+
z-index: 3;
|
|
80
|
+
&[data-show='true']{
|
|
81
|
+
display: flex;
|
|
82
|
+
justify-content: center;
|
|
83
|
+
align-items: center;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Table from './table';
|
|
4
|
+
import {PAGE_SIZE_LIST} from './';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 通过usePaginationWithForm管理页面分页和查询的封装
|
|
9
|
+
* @param {*} props
|
|
10
|
+
*/
|
|
11
|
+
const WithPage=props=>{
|
|
12
|
+
const {page,pagination,...others}=props;
|
|
13
|
+
|
|
14
|
+
const getDataSource=()=>{
|
|
15
|
+
if(page){
|
|
16
|
+
if(page?.mode=='scrollLoad'){
|
|
17
|
+
return page.scrollData || [];
|
|
18
|
+
}else{
|
|
19
|
+
return page?.data?.[page?.pagination?.current - 1] ||[];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return []
|
|
24
|
+
}
|
|
25
|
+
const getPagination=()=>{
|
|
26
|
+
if( typeof pagination === 'boolean'){
|
|
27
|
+
return pagination;
|
|
28
|
+
}
|
|
29
|
+
const {current,pageSize,total} = page?.pagination;
|
|
30
|
+
|
|
31
|
+
const req= {
|
|
32
|
+
showSizeChanger:true,
|
|
33
|
+
showQuickJumper:true,
|
|
34
|
+
pageSizeOptions: PAGE_SIZE_LIST,
|
|
35
|
+
current,
|
|
36
|
+
pageSize,
|
|
37
|
+
total,
|
|
38
|
+
showTotal: (total) => `总计${total}条`,
|
|
39
|
+
...pagination,
|
|
40
|
+
};
|
|
41
|
+
return req;
|
|
42
|
+
}
|
|
43
|
+
return (
|
|
44
|
+
<Table
|
|
45
|
+
pagination={getPagination()}
|
|
46
|
+
dataSource={getDataSource()}
|
|
47
|
+
{...others}
|
|
48
|
+
/>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
export default WithPage;
|
|
52
|
+
|
|
53
|
+
|
|
@@ -3,15 +3,21 @@ import React, { useState,useEffect } from 'react';
|
|
|
3
3
|
// @ts-ignore
|
|
4
4
|
import { useNavigate } from 'react-router-dom';
|
|
5
5
|
|
|
6
|
+
|
|
6
7
|
import ProviderMenu from '@/provider/menu';
|
|
7
8
|
// @ts-ignore
|
|
8
9
|
import imgSlogan from '@/assets/images/nav/slogan.png';
|
|
9
10
|
|
|
10
11
|
import TopBar from './topBar';
|
|
11
|
-
import
|
|
12
|
+
import Popmenu from '@/components/topMenu/popmenu';
|
|
13
|
+
|
|
12
14
|
|
|
13
15
|
// @ts-ignore
|
|
14
16
|
import styles from './index.module.less';
|
|
17
|
+
import { useRef } from 'react';
|
|
18
|
+
|
|
19
|
+
import {DEBUG_ENV} from '@/config';
|
|
20
|
+
|
|
15
21
|
|
|
16
22
|
const TopSlogan=()=>{
|
|
17
23
|
const navigate = useNavigate();
|
|
@@ -19,12 +25,14 @@ const TopSlogan=()=>{
|
|
|
19
25
|
navigate('/')
|
|
20
26
|
}
|
|
21
27
|
return (
|
|
22
|
-
<div className={styles.
|
|
28
|
+
<div className={styles.topMenuSlogan} onClick={onHome}>
|
|
23
29
|
<img src={imgSlogan} />
|
|
24
30
|
{
|
|
25
31
|
// @ts-ignore
|
|
26
|
-
|
|
32
|
+
|
|
33
|
+
BUILD_ENV!='prod'?<span className={styles.version}>V{APP_VERSION}{BUILD_ENV=='localdebug'?DEBUG_ENV:BUILD_ENV}</span>:<></>
|
|
27
34
|
}
|
|
35
|
+
|
|
28
36
|
</div>
|
|
29
37
|
)
|
|
30
38
|
}
|
|
@@ -35,9 +43,12 @@ const TopMenu=(props)=>{
|
|
|
35
43
|
|
|
36
44
|
const [menus,setMenus]=useState([]);
|
|
37
45
|
const navigate = useNavigate();
|
|
38
|
-
|
|
46
|
+
const refMenus=useRef({})
|
|
39
47
|
const menuOpen= true;//app.nav.leftNavOpen;
|
|
40
|
-
|
|
48
|
+
/**
|
|
49
|
+
* @type {React.MutableRefObject<object>}
|
|
50
|
+
*/
|
|
51
|
+
const refPopmenu = useRef();
|
|
41
52
|
|
|
42
53
|
// // 推出登录
|
|
43
54
|
// const onAvatarClick = (e)=>{
|
|
@@ -52,8 +63,26 @@ const TopMenu=(props)=>{
|
|
|
52
63
|
const reload= async ()=>{
|
|
53
64
|
providerMenu.reload();
|
|
54
65
|
}
|
|
66
|
+
|
|
67
|
+
const onMouseEnter=(menu,key,e)=>{
|
|
68
|
+
const dom = refMenus.current[key];
|
|
69
|
+
const {offsetLeft,offsetTop,offsetHeight} = dom;
|
|
70
|
+
// console.log('mouse father enter')
|
|
71
|
+
if(refPopmenu?.current?.onMouseEnter){
|
|
72
|
+
refPopmenu.current.onMouseEnter(menu.children,{x:offsetLeft,y:offsetTop + offsetHeight + 4});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const onMouseLeave=(menu,key,e)=>{
|
|
77
|
+
// console.log('mouse father level')
|
|
78
|
+
if(refPopmenu?.current?.onMouseLeave){
|
|
79
|
+
refPopmenu.current.onMouseLeave();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
55
83
|
useEffect(()=>{
|
|
56
|
-
setMenus(providerMenu.topMenu)
|
|
84
|
+
setMenus(providerMenu.topMenu);
|
|
85
|
+
|
|
57
86
|
},[providerMenu.topMenu]);
|
|
58
87
|
|
|
59
88
|
useEffect(()=>{
|
|
@@ -73,28 +102,34 @@ const TopMenu=(props)=>{
|
|
|
73
102
|
<hgroup className={styles.leftGroup}>
|
|
74
103
|
<TopSlogan />
|
|
75
104
|
{
|
|
76
|
-
menus&&menus.length>
|
|
105
|
+
menus&&menus.length>0&&
|
|
77
106
|
menus.map((menu,idx)=>{
|
|
78
107
|
const {key,name:label,icon,msgCount}= menu;
|
|
79
108
|
const active = providerMenu.selectMenus.keys.includes(key);
|
|
80
109
|
return (
|
|
81
|
-
|
|
110
|
+
<a
|
|
111
|
+
href={'/#'+menu.url}
|
|
112
|
+
ref={(el) => (refMenus.current[key] = el)} // 动态分配 ref
|
|
113
|
+
onMouseEnter={onMouseEnter.bind(this,menu,key)}
|
|
114
|
+
onMouseLeave={onMouseLeave.bind(this,menu,key)}
|
|
82
115
|
key={key}
|
|
83
116
|
className={styles.menuItem}
|
|
84
117
|
data-checked={active}
|
|
85
|
-
onClick={onClickMenuItem.bind(this,menu)}
|
|
86
118
|
>
|
|
87
|
-
<span
|
|
119
|
+
<span>{label}</span>
|
|
88
120
|
{/* 未读标记 */}
|
|
89
121
|
<div className={styles.messageWrap}>
|
|
90
122
|
{msgCount>0?<i className={styles.iconUnread}/>:''}
|
|
91
123
|
</div>
|
|
92
|
-
</
|
|
124
|
+
</a>
|
|
93
125
|
)
|
|
94
126
|
})
|
|
95
127
|
}
|
|
96
128
|
</hgroup>
|
|
97
129
|
<TopBar />
|
|
130
|
+
<Popmenu ref={refPopmenu}
|
|
131
|
+
activeKeys={providerMenu.selectMenus.keys}
|
|
132
|
+
/>
|
|
98
133
|
</div>
|
|
99
134
|
)
|
|
100
135
|
}
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
@menuWidth:70px;
|
|
5
5
|
@openMenuWidth:128px;
|
|
6
6
|
|
|
7
|
-
.
|
|
8
|
-
width:
|
|
7
|
+
.topMenuSlogan{
|
|
8
|
+
width: 230px;
|
|
9
9
|
height: 100%;
|
|
10
10
|
display: flex;
|
|
11
11
|
align-items: center;
|
|
12
12
|
cursor: pointer;
|
|
13
13
|
img{
|
|
14
|
-
width:
|
|
14
|
+
width: 152px;
|
|
15
15
|
}
|
|
16
16
|
.version{
|
|
17
17
|
font-size: 12px;
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
.topMenu{
|
|
28
|
-
padding:0
|
|
28
|
+
padding:0 16px;
|
|
29
29
|
display: flex;
|
|
30
30
|
justify-content: space-between;
|
|
31
31
|
align-self: center;
|
|
@@ -36,11 +36,14 @@
|
|
|
36
36
|
display: flex;
|
|
37
37
|
height: 100%;
|
|
38
38
|
align-items: center;
|
|
39
|
+
column-gap: 8px;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
.menuItem{
|
|
42
43
|
position: relative;
|
|
43
|
-
width:
|
|
44
|
+
width: auto;
|
|
45
|
+
white-space: nowrap;
|
|
46
|
+
padding: 0 16px;
|
|
44
47
|
height: 100%;
|
|
45
48
|
|
|
46
49
|
display: flex;
|
|
@@ -59,11 +62,11 @@
|
|
|
59
62
|
color:inherit;
|
|
60
63
|
}
|
|
61
64
|
&[data-checked='true']{
|
|
62
|
-
background:
|
|
65
|
+
background: var(--theme-color-primary); // 使用 CSS 变量
|
|
63
66
|
font-weight: bold;
|
|
64
67
|
}
|
|
65
68
|
&:hover{
|
|
66
|
-
background-color:
|
|
69
|
+
background-color: var(--theme-color-primary);
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
}
|