kn-cli 1.0.133 → 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/shellUtil.sh +2 -2
- package/build/start.sh +3 -2
- 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,47 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
-
|
|
3
|
-
// @ts-ignore
|
|
4
|
-
import styles from './index.module.less';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const Badge=(props)=>{
|
|
8
|
-
const {dot=false,overflowCount=99,offset} = props;
|
|
9
|
-
/**
|
|
10
|
-
* @type {React.MutableRefObject<object>}
|
|
11
|
-
*/
|
|
12
|
-
const refDom = useRef();
|
|
13
|
-
|
|
14
|
-
const [myStyle,setStyle]=useState(()=>{
|
|
15
|
-
if(offset){
|
|
16
|
-
return {
|
|
17
|
-
marginLeft:`${offset[0]}px`,
|
|
18
|
-
marginTop:`${offset[1]}px`,
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const [count,setCount] = useState(0);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
useEffect(()=>{
|
|
26
|
-
let _count = props.count;
|
|
27
|
-
if(_count != count){
|
|
28
|
-
setCount(+_count);
|
|
29
|
-
}
|
|
30
|
-
})
|
|
31
|
-
const getCountText=()=>{
|
|
32
|
-
if(count > overflowCount){
|
|
33
|
-
return `${overflowCount}+`
|
|
34
|
-
}else{
|
|
35
|
-
let req = Math.max(0,count);
|
|
36
|
-
return `${req}`;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
let countLabel = getCountText();
|
|
40
|
-
return (
|
|
41
|
-
<div className={styles.wrap} data-hide={count <= 0}>
|
|
42
|
-
<div ref={refDom} style={myStyle} className={styles.badge} data-len={countLabel.length}>{countLabel}</div>
|
|
43
|
-
</div>
|
|
44
|
-
)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export default Badge;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
.wrap{
|
|
2
|
-
display: inline-flex;
|
|
3
|
-
position: relative;
|
|
4
|
-
&[data-hide='true']{
|
|
5
|
-
display: none;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
.hideBadge,
|
|
9
|
-
.badge{
|
|
10
|
-
display: inline-flex;
|
|
11
|
-
background-color: red;
|
|
12
|
-
border-radius: 100%;
|
|
13
|
-
color:white;
|
|
14
|
-
font-size: 12px;
|
|
15
|
-
font-weight: bold;
|
|
16
|
-
align-items: center;
|
|
17
|
-
justify-content: center;
|
|
18
|
-
line-height: 12px;
|
|
19
|
-
box-shadow: 0 0 0 1px #fff;
|
|
20
|
-
padding-bottom: 1px;
|
|
21
|
-
|
|
22
|
-
width: 16px;
|
|
23
|
-
height: 16px;
|
|
24
|
-
&[data-len='2']{
|
|
25
|
-
transform: scale(.9);
|
|
26
|
-
width: 26px;
|
|
27
|
-
height: 15px;
|
|
28
|
-
border-radius: 12px;
|
|
29
|
-
}
|
|
30
|
-
&[data-len='3']{
|
|
31
|
-
transform: scale(.9);
|
|
32
|
-
width: 34px;
|
|
33
|
-
height: 15px;
|
|
34
|
-
border-radius: 12px;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
.hideBadge{
|
|
38
|
-
position: absolute;
|
|
39
|
-
left:0;
|
|
40
|
-
top:0;
|
|
41
|
-
opacity: 0;
|
|
42
|
-
z-index: -1;
|
|
43
|
-
pointer-events: none;
|
|
44
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
import { BaseTable, useTablePipeline, features } from 'ali-react-table';
|
|
4
|
-
import { Pagination,Checkbox,Radio, Spin } from '@/components/antd';
|
|
5
|
-
import styles from './index.module.less';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* rowSelection 已实现功能
|
|
10
|
-
* @typedef RowSelection
|
|
11
|
-
* @property {string[]} selectedRowKeys - 已选项key
|
|
12
|
-
* @property {string} [type] - 多选/单选: checkbox | radio
|
|
13
|
-
* @property {(selectedRowKeys:string[], selectedRows:object[], info: { type:string })=>void} onChange
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* expandable 已实现功能
|
|
18
|
-
* @typedef Expandable
|
|
19
|
-
* @property {string[]} expandedRowKeys - 已展开的key
|
|
20
|
-
* @property {(rows:string[])=>void} [onExpandedRowsChange]
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* sorter 排序功能已实现
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* 合并表头-已完成
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* 行合并-已实现
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const AntdCompatibleTable = ({
|
|
37
|
-
columns,
|
|
38
|
-
dataSource,
|
|
39
|
-
rowKey = 'id',
|
|
40
|
-
pagination,
|
|
41
|
-
rowSelection,
|
|
42
|
-
expandable,
|
|
43
|
-
onChange:onTableChange,
|
|
44
|
-
loading
|
|
45
|
-
}) => {
|
|
46
|
-
|
|
47
|
-
const formatColumn=(col)=>{
|
|
48
|
-
let req={
|
|
49
|
-
title: col.title,
|
|
50
|
-
// name:col.name,
|
|
51
|
-
code: col.dataIndex || col.key ||undefined,
|
|
52
|
-
width: col.width,
|
|
53
|
-
defaultColumnWidth:col?.width||100,
|
|
54
|
-
lock: col.fixed?true:false,
|
|
55
|
-
side: col.fixed=='right'?'right':'left',
|
|
56
|
-
features:col?.sorter?{
|
|
57
|
-
sortable:col.sorter
|
|
58
|
-
}:undefined,
|
|
59
|
-
// 这里的适配支持了合并单元格
|
|
60
|
-
getCellProps: col.onCell ? (value, record, index) => col.onCell(record, index) : col.getCellProps,
|
|
61
|
-
render: col.render,
|
|
62
|
-
};
|
|
63
|
-
if(col.children){
|
|
64
|
-
req.children = col.children.map(child=>formatColumn(child));
|
|
65
|
-
}
|
|
66
|
-
if (col.onHeaderCell) {
|
|
67
|
-
// 执行 antd 的 onHeaderCell 拿到属性对象
|
|
68
|
-
const antdProps = col.onHeaderCell(col);
|
|
69
|
-
|
|
70
|
-
req.headerCellProps = {
|
|
71
|
-
...req.headerCellProps,
|
|
72
|
-
...antdProps,
|
|
73
|
-
// 合并 class 和 style
|
|
74
|
-
className: [req.headerCellProps?.className, antdProps.className].filter(Boolean).join(' '),
|
|
75
|
-
style: { ...req.headerCellProps?.style, ...antdProps.style },
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
return req;
|
|
79
|
-
}
|
|
80
|
-
const adaptedColumns = useMemo(() => {
|
|
81
|
-
return columns.map(col => (formatColumn(col)));
|
|
82
|
-
}, [columns]);
|
|
83
|
-
|
|
84
|
-
const pipelineProps = { components: { Checkbox,Radio } }
|
|
85
|
-
const pipeline = useTablePipeline(pipelineProps)
|
|
86
|
-
.input({ dataSource, columns: adaptedColumns })
|
|
87
|
-
.use(
|
|
88
|
-
features.columnResize({
|
|
89
|
-
fallbackSize: 40,
|
|
90
|
-
handleBackground: '#ddd',
|
|
91
|
-
handleHoverBackground: '#aaa',
|
|
92
|
-
handleActiveBackground: '#89bff7',
|
|
93
|
-
}),
|
|
94
|
-
)
|
|
95
|
-
.primaryKey(rowKey);
|
|
96
|
-
|
|
97
|
-
// 处理折叠
|
|
98
|
-
if (expandable) {
|
|
99
|
-
const {
|
|
100
|
-
expandedRowKeys,
|
|
101
|
-
onExpandedRowsChange,
|
|
102
|
-
} = expandable;
|
|
103
|
-
pipeline.use(
|
|
104
|
-
features.treeMode({
|
|
105
|
-
// 绑定展开的 keys
|
|
106
|
-
openKeys: expandedRowKeys,
|
|
107
|
-
// 状态变更回调
|
|
108
|
-
onChangeOpenKeys: (nextKeys, key, action) => {
|
|
109
|
-
if (onExpandedRowsChange) {
|
|
110
|
-
onExpandedRowsChange(nextKeys);
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
clickArea:'cell',
|
|
114
|
-
})
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// 处理可选项
|
|
119
|
-
if (rowSelection) {
|
|
120
|
-
const {
|
|
121
|
-
selectedRowKeys = [],
|
|
122
|
-
onChange,
|
|
123
|
-
getCheckboxProps,
|
|
124
|
-
type = 'checkbox', // checkbox 或 radio
|
|
125
|
-
} = rowSelection;
|
|
126
|
-
const isSingle = type=='radio';
|
|
127
|
-
const selectFeature = isSingle ? features.singleSelect : features.multiSelect;
|
|
128
|
-
const onChangeMulti=(nextKeys,key,keys,action) => {
|
|
129
|
-
if (onChange) {
|
|
130
|
-
const _nextKey = nextKeys
|
|
131
|
-
const nextRows = dataSource.filter((d) => _nextKey.includes(d[rowKey]));
|
|
132
|
-
let antdAction='';
|
|
133
|
-
switch(action){
|
|
134
|
-
case 'uncheck':
|
|
135
|
-
case 'check':{
|
|
136
|
-
antdAction='single';
|
|
137
|
-
if(keys?.length>1){
|
|
138
|
-
antdAction='multiple'
|
|
139
|
-
}
|
|
140
|
-
}break;
|
|
141
|
-
case 'check-all':
|
|
142
|
-
case 'uncheck-all':{
|
|
143
|
-
antdAction='all'
|
|
144
|
-
}break;
|
|
145
|
-
}
|
|
146
|
-
onChange(_nextKey, nextRows,{type:antdAction});
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
const onChangeSingle=(nextKeys) => {
|
|
150
|
-
if (onChange) {
|
|
151
|
-
let _nextKey = [nextKeys]
|
|
152
|
-
const nextRows = dataSource.filter((d) => _nextKey.includes(d[rowKey]));
|
|
153
|
-
let antdAction='single';
|
|
154
|
-
onChange(_nextKey, nextRows,{type:antdAction});
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
pipeline.use(
|
|
158
|
-
selectFeature({
|
|
159
|
-
// 绑定受控值
|
|
160
|
-
value: isSingle?(selectedRowKeys[0]??selectedRowKeys):selectedRowKeys,
|
|
161
|
-
// 状态变更回调
|
|
162
|
-
onChange: isSingle?onChangeSingle:onChangeMulti,
|
|
163
|
-
// 基础配置
|
|
164
|
-
clickArea: 'cell',
|
|
165
|
-
// 自定义选择列的属性
|
|
166
|
-
checkboxColumn: {
|
|
167
|
-
lock: true,
|
|
168
|
-
},
|
|
169
|
-
// 兼容禁用逻辑
|
|
170
|
-
isDisabled: (record,rowIdx) => {
|
|
171
|
-
const config = getCheckboxProps ? getCheckboxProps(record,rowIdx) : {disabled:false};
|
|
172
|
-
return config.disabled;
|
|
173
|
-
},
|
|
174
|
-
})
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
pipeline.use(
|
|
179
|
-
features.sort({
|
|
180
|
-
// mode: 'multiple' 或 'single',antd 默认是 single
|
|
181
|
-
mode: 'single',
|
|
182
|
-
// 这里的逻辑:检查列配置中是否有 sorter 属性
|
|
183
|
-
// ali-react-table 会自动处理带有 features.sort 标记的列
|
|
184
|
-
keepDataSource:true,
|
|
185
|
-
// 状态改变时的回调,对接 antd 的 onChange
|
|
186
|
-
onChangeSorts: (nextSorts) => {
|
|
187
|
-
if(onTableChange){
|
|
188
|
-
const transOrder={
|
|
189
|
-
'desc':'descend',
|
|
190
|
-
'asc':'ascend'
|
|
191
|
-
}
|
|
192
|
-
let sorts=[];
|
|
193
|
-
nextSorts.forEach(col=>{
|
|
194
|
-
if(!col.order)return false;
|
|
195
|
-
sorts.push(
|
|
196
|
-
{
|
|
197
|
-
field:col.code,
|
|
198
|
-
order:transOrder[col.order]||'',
|
|
199
|
-
}
|
|
200
|
-
)
|
|
201
|
-
})
|
|
202
|
-
onTableChange(pagination,null,sorts,{action:'sort'});
|
|
203
|
-
}
|
|
204
|
-
// if (onChange) {
|
|
205
|
-
// // 将 ali 的数据结构 [{ code, order }] 转换为 antd 风格的对象
|
|
206
|
-
// const sorter = nextSorts.length > 0 ? {
|
|
207
|
-
// field: nextSorts[0].code,
|
|
208
|
-
// order: nextSorts[0].order === 'asc' ? 'ascend' : 'descend'
|
|
209
|
-
// } : {};
|
|
210
|
-
|
|
211
|
-
// // 调用 antd 风格的 onChange(pagination, filters, sorter, extra)
|
|
212
|
-
// // 这里为了简化,只传 sorter
|
|
213
|
-
// onChange(null, null, sorter, { action: 'sort' });
|
|
214
|
-
// }
|
|
215
|
-
},
|
|
216
|
-
})
|
|
217
|
-
)
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
return (
|
|
221
|
-
<div className={styles.wrap} >
|
|
222
|
-
<BaseTable
|
|
223
|
-
{...pipeline.getProps()}
|
|
224
|
-
useVirtual={{
|
|
225
|
-
horizontal: true,
|
|
226
|
-
vertical: true,
|
|
227
|
-
}}
|
|
228
|
-
// 树形结构建议关闭简单的行高预估,或者设置一个合理的平均值
|
|
229
|
-
estimatedRowHeight={50}
|
|
230
|
-
className={styles.table}
|
|
231
|
-
/>
|
|
232
|
-
{
|
|
233
|
-
pagination?<Pagination {...pagination} className={styles.pagination} onChange={(current, pageSize)=>{
|
|
234
|
-
if(onTableChange){
|
|
235
|
-
onTableChange({...pagination,current,pageSize},null,null,{action:'paginate'})
|
|
236
|
-
}
|
|
237
|
-
}}/>:''
|
|
238
|
-
}
|
|
239
|
-
{
|
|
240
|
-
loading&&
|
|
241
|
-
<div className={styles.loading}>
|
|
242
|
-
<div className={styles.mask}/>
|
|
243
|
-
<Spin spinning/>
|
|
244
|
-
</div>
|
|
245
|
-
}
|
|
246
|
-
</div>
|
|
247
|
-
);
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
export default AntdCompatibleTable;
|
package/templates/template_admin_antd5/public/src/components/table/aliTable/index.module.less
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
// 1. 定义你的 Antd 风格变量(方便统一修改)
|
|
2
|
-
@antd-table-header-bg: red;
|
|
3
|
-
@antd-table-border-color: #f0f0f0;
|
|
4
|
-
@antd-table-row-hover-bg: #E6F1FE;
|
|
5
|
-
@antd-table-row-hover-bg: #F5F7FC;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@antd-font-size: 14px;
|
|
9
|
-
|
|
10
|
-
@table-bg:#fff;
|
|
11
|
-
@table-bg-hover:#E6F1FE;
|
|
12
|
-
@table-bg-light:#F5F7FC;
|
|
13
|
-
@table-border-color:#DEE0E3;
|
|
14
|
-
|
|
15
|
-
.loading{
|
|
16
|
-
position: absolute;
|
|
17
|
-
left:0;
|
|
18
|
-
top:0;
|
|
19
|
-
width: 100%;
|
|
20
|
-
height: 100%;
|
|
21
|
-
z-index: 500;
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
justify-content: center;
|
|
25
|
-
.mask{
|
|
26
|
-
position: absolute;
|
|
27
|
-
left:0;
|
|
28
|
-
top:0;
|
|
29
|
-
width: 100%;
|
|
30
|
-
height: 100%;
|
|
31
|
-
z-index: 1;
|
|
32
|
-
background-color: rgba(255,255,255,.5);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
.pagination{
|
|
36
|
-
display: flex;
|
|
37
|
-
justify-content: end;
|
|
38
|
-
margin-top:6px;
|
|
39
|
-
}
|
|
40
|
-
.wrap {
|
|
41
|
-
width:100%;
|
|
42
|
-
height:100%;
|
|
43
|
-
display: flex;
|
|
44
|
-
flex-direction: column;
|
|
45
|
-
.table{
|
|
46
|
-
width: 100%;
|
|
47
|
-
height: 100%;
|
|
48
|
-
overflow: auto;
|
|
49
|
-
}
|
|
50
|
-
// 这里的 .art-table 是库内置的类名
|
|
51
|
-
:global{
|
|
52
|
-
.resize-handle{
|
|
53
|
-
background-color: rgba(0,0,0,0);
|
|
54
|
-
height:50%;
|
|
55
|
-
width: 2px;
|
|
56
|
-
top:25%;
|
|
57
|
-
right:0px;
|
|
58
|
-
}
|
|
59
|
-
.art-table{
|
|
60
|
-
.art-table-header-cell:has(.resize-handle){
|
|
61
|
-
// border-right: 0;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
.art-table {
|
|
65
|
-
// 注入变量
|
|
66
|
-
--cell-padding:5px;
|
|
67
|
-
--line-height: 1.5715;
|
|
68
|
-
--font-size: 14px;
|
|
69
|
-
--row-height: 32px;
|
|
70
|
-
--header-row-height: 36px;
|
|
71
|
-
|
|
72
|
-
--lock-shadow: rgba(0, 0, 0, 0.2) 0 0 10px 0px;
|
|
73
|
-
--cell-border:1px solid @table-border-color;
|
|
74
|
-
--header-cell-border:1px solid @table-border-color;
|
|
75
|
-
|
|
76
|
-
--border-color: @table-border-color;
|
|
77
|
-
--color: rgba(0, 0, 0, 0.85);
|
|
78
|
-
--bgcolor: @table-bg;
|
|
79
|
-
--hover-bgcolor: @table-bg-hover;
|
|
80
|
-
--highlight-bgcolor: #fafafa;
|
|
81
|
-
--header-color: rgba(0, 0, 0, 0.85);
|
|
82
|
-
--header-bgcolor: @table-bg-light;
|
|
83
|
-
--header-hover-bgcolor: @table-bg-hover;
|
|
84
|
-
--header-highlight-bgcolor: @table-bg;
|
|
85
|
-
|
|
86
|
-
// 如果你想针对 400 列做特殊的边框处理
|
|
87
|
-
.art-table-header-cell, .art-table-cell {
|
|
88
|
-
border-right: 1px solid var(--border-color);
|
|
89
|
-
&:last-child {
|
|
90
|
-
border-right: none;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
.art-table-row:not(:hover).odd{
|
|
94
|
-
.art-table-cell{
|
|
95
|
-
background-color: @table-bg-light;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
th{font-weight: 500;}
|
|
99
|
-
th,td{
|
|
100
|
-
padding:4px 8px;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
import React,{useEffect} from 'react';
|
|
3
|
-
// @ts-ignore
|
|
4
|
-
import ReactDOM from 'react-dom';
|
|
5
|
-
|
|
6
|
-
// @ts-ignore
|
|
7
|
-
import Popup from '@/components/popup';
|
|
8
|
-
|
|
9
|
-
// @ts-ignore
|
|
10
|
-
import styles from './index.module.less';
|
|
11
|
-
|
|
12
|
-
const toastList=[];
|
|
13
|
-
const runNext=()=>{
|
|
14
|
-
let props = toastList[0];
|
|
15
|
-
if(props){
|
|
16
|
-
const {message,delay,resolve,position}=props;
|
|
17
|
-
let popup = Popup(resolve,{cantouch:true});
|
|
18
|
-
ReactDOM.render(
|
|
19
|
-
<Toast destory={popup.destory} message={message} delay={delay} position={position}/>,
|
|
20
|
-
popup.dom
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const Toast=props=>{
|
|
26
|
-
const {
|
|
27
|
-
message,
|
|
28
|
-
delay=1000*2,
|
|
29
|
-
destory,
|
|
30
|
-
position='top'
|
|
31
|
-
}=props;
|
|
32
|
-
useEffect(()=>{
|
|
33
|
-
setTimeout(()=>{
|
|
34
|
-
destory();
|
|
35
|
-
toastList.shift();
|
|
36
|
-
runNext();
|
|
37
|
-
},delay);
|
|
38
|
-
},[])
|
|
39
|
-
const ANITYPE={
|
|
40
|
-
'center':'animate__slideInDown',
|
|
41
|
-
'top':'animate__slideInDown',
|
|
42
|
-
'bottom':'animate__slideInUp'
|
|
43
|
-
}
|
|
44
|
-
return (
|
|
45
|
-
<section className={styles.wrap} data-position={position}>
|
|
46
|
-
<div className={styles.content+ ` ${ANITYPE[position]} animate__animated animate__fast`} dangerouslySetInnerHTML={{ __html:message }}>
|
|
47
|
-
</div>
|
|
48
|
-
</section>
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @typedef {object} ToastOptions
|
|
54
|
-
* @property {string} message - 吐司文案内容
|
|
55
|
-
* @property {number} [delay=2000] - 持续时间,毫秒
|
|
56
|
-
* @property {string} [position] - 显示位置,center|top|bottom
|
|
57
|
-
* @property {Function} [resolve] - 显示完毕的回调
|
|
58
|
-
*/
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* 显示一个吐司信息
|
|
62
|
-
* @param {ToastOptions|string} [props] - 文案内容或一个配置参数
|
|
63
|
-
* @returns { Promise }
|
|
64
|
-
*/
|
|
65
|
-
const ShowToast=props=>{
|
|
66
|
-
if(typeof props === 'string'){
|
|
67
|
-
props = {message:props}
|
|
68
|
-
}
|
|
69
|
-
return new Promise((resolve) => {
|
|
70
|
-
// @ts-ignore
|
|
71
|
-
props.resolve = resolve;
|
|
72
|
-
toastList.push(props);
|
|
73
|
-
if(toastList.length===1){
|
|
74
|
-
runNext();
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export default ShowToast;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
@import '~@/_variable.module.less';
|
|
2
|
-
|
|
3
|
-
.wrap{
|
|
4
|
-
position: fixed;
|
|
5
|
-
left:0;
|
|
6
|
-
top:0;
|
|
7
|
-
width:100%;
|
|
8
|
-
height:100%;
|
|
9
|
-
pointer-events: none;
|
|
10
|
-
display: flex;
|
|
11
|
-
justify-content: center;
|
|
12
|
-
align-items: center;
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
z-index:var(--z-toast);
|
|
15
|
-
&[data-position=top]{
|
|
16
|
-
justify-content: flex-start;
|
|
17
|
-
padding-top:80px;
|
|
18
|
-
}
|
|
19
|
-
&[data-position=bottom]{
|
|
20
|
-
justify-content: flex-end;
|
|
21
|
-
padding-bottom:80px;
|
|
22
|
-
}
|
|
23
|
-
.content{
|
|
24
|
-
min-height:30px;
|
|
25
|
-
min-width:60px;
|
|
26
|
-
|
|
27
|
-
background: rgba(0,0,0,.8);
|
|
28
|
-
opacity:.8;
|
|
29
|
-
border-radius: var(--radius-default);
|
|
30
|
-
padding:var(--padding-default);
|
|
31
|
-
|
|
32
|
-
display: flex;
|
|
33
|
-
flex-direction: column;
|
|
34
|
-
justify-content: center;
|
|
35
|
-
align-items: center;
|
|
36
|
-
|
|
37
|
-
font-size: 14px;
|
|
38
|
-
color: #FFFFFF;
|
|
39
|
-
text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.24);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
}
|