kn-cli 1.0.130 → 1.0.133
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 -1
- package/build/webpack.config.js +2 -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,146 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
import zhCN from 'antd/es/locale/zh_CN';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Form as AntdForm,
|
|
7
|
+
Input as AntdInput,
|
|
8
|
+
Button as AntdButton,
|
|
9
|
+
DatePicker as _DatePicker,
|
|
10
|
+
Alert,
|
|
11
|
+
Anchor,
|
|
12
|
+
Badge,
|
|
13
|
+
Card,
|
|
14
|
+
Checkbox,
|
|
15
|
+
Col,
|
|
16
|
+
ConfigProvider,
|
|
17
|
+
Drawer,
|
|
18
|
+
Dropdown,
|
|
19
|
+
Empty,
|
|
20
|
+
Image,
|
|
21
|
+
InputNumber,
|
|
22
|
+
Layout,
|
|
23
|
+
List,
|
|
24
|
+
Menu,
|
|
25
|
+
message,
|
|
26
|
+
Modal,
|
|
27
|
+
notification,
|
|
28
|
+
Pagination,
|
|
29
|
+
Popconfirm,
|
|
30
|
+
Popover,
|
|
31
|
+
Progress,
|
|
32
|
+
Radio,
|
|
33
|
+
Row,
|
|
34
|
+
Select as AntdSelect,
|
|
35
|
+
Space,
|
|
36
|
+
Spin,
|
|
37
|
+
Steps,
|
|
38
|
+
Switch,
|
|
39
|
+
Table,
|
|
40
|
+
Tabs,
|
|
41
|
+
Tag,
|
|
42
|
+
TimePicker,
|
|
43
|
+
Tooltip as AntdTooltip,
|
|
44
|
+
TreeSelect,
|
|
45
|
+
Upload,
|
|
46
|
+
AutoComplete,
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
} from "antd";
|
|
49
|
+
|
|
50
|
+
import Select from './select';
|
|
51
|
+
export {Select};
|
|
52
|
+
|
|
53
|
+
import Tooltip from './tooltip';
|
|
54
|
+
import AsyncButton from '../button';
|
|
55
|
+
|
|
56
|
+
export {AntdSelect}
|
|
57
|
+
export { AsyncButton as Button };
|
|
58
|
+
export {Alert}
|
|
59
|
+
export {Anchor}
|
|
60
|
+
export {Badge}
|
|
61
|
+
export {Card}
|
|
62
|
+
export {Checkbox}
|
|
63
|
+
export {Col}
|
|
64
|
+
export {ConfigProvider}
|
|
65
|
+
|
|
66
|
+
/**@type {*} */
|
|
67
|
+
const DatePicker = _DatePicker;
|
|
68
|
+
export {DatePicker}
|
|
69
|
+
export {Drawer}
|
|
70
|
+
export {Dropdown}
|
|
71
|
+
export {Empty}
|
|
72
|
+
export {Image}
|
|
73
|
+
export {InputNumber}
|
|
74
|
+
export {Layout}
|
|
75
|
+
export {List}
|
|
76
|
+
export {Menu}
|
|
77
|
+
export {message}
|
|
78
|
+
export {Modal}
|
|
79
|
+
export {notification}
|
|
80
|
+
export {Pagination}
|
|
81
|
+
export {Popconfirm}
|
|
82
|
+
export {Popover}
|
|
83
|
+
export {Progress}
|
|
84
|
+
export {Radio}
|
|
85
|
+
export {Row}
|
|
86
|
+
export {Space}
|
|
87
|
+
export {Spin}
|
|
88
|
+
export {Steps}
|
|
89
|
+
export {Switch}
|
|
90
|
+
export {Table}
|
|
91
|
+
export {Tabs}
|
|
92
|
+
export {Tag}
|
|
93
|
+
export {TimePicker}
|
|
94
|
+
export {Tooltip}
|
|
95
|
+
export {TreeSelect}
|
|
96
|
+
export {Upload}
|
|
97
|
+
export {AutoComplete}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
export {AntdTooltip}
|
|
101
|
+
export {AntdButton}
|
|
102
|
+
|
|
103
|
+
export {zhCN}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
const FormItem=(props,ref)=>{
|
|
108
|
+
const {validateFirst=true,children,...others} = props;
|
|
109
|
+
return <AntdForm.Item ref={ref||undefined} validateFirst={validateFirst} {...others}>{children}</AntdForm.Item>
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @type {*}
|
|
114
|
+
*/
|
|
115
|
+
const Form={...AntdForm}
|
|
116
|
+
// @ts-ignore
|
|
117
|
+
Form.Item = FormItem;
|
|
118
|
+
|
|
119
|
+
export {Form};
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
const Input=(props)=>{
|
|
124
|
+
const {children,type,...others} = props;
|
|
125
|
+
|
|
126
|
+
if(type=='hidden'){
|
|
127
|
+
return <AntdInput type={type} {...others}>{children}</AntdInput>
|
|
128
|
+
}
|
|
129
|
+
return <AntdInput allowClear {...others}>{children}</AntdInput>
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
Input.Group=AntdInput.Group;
|
|
133
|
+
Input.Search=AntdInput.Search;
|
|
134
|
+
Input.TextArea=AntdInput.TextArea;
|
|
135
|
+
Input.Password=AntdInput.Password;
|
|
136
|
+
|
|
137
|
+
export {Input};
|
|
138
|
+
|
|
139
|
+
const HiddenFormItem=(props)=>{
|
|
140
|
+
const {children,...others} = props;
|
|
141
|
+
return (
|
|
142
|
+
<AntdForm.Item {...others} noStyle><input type='hidden'/></AntdForm.Item>
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export {HiddenFormItem}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
AntdSelect,
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
} from "@/components/antd";
|
|
6
|
+
|
|
7
|
+
import { isMobile as isMobileFn } from '@/utils';
|
|
8
|
+
|
|
9
|
+
import styles from './index.module.less';
|
|
10
|
+
import Link from '@/components/link';
|
|
11
|
+
import { useMemo } from 'react';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 带全选、重置、已选功能的包装
|
|
15
|
+
*/
|
|
16
|
+
const Select=props=>{
|
|
17
|
+
const {mode,options:_options,children,value:_value,maxCount=Infinity,showAll,allValue, showSearch = true, antd5=false,...otherProps} = props;
|
|
18
|
+
const [searchValue,setSearchValue] = useState('')
|
|
19
|
+
const [value,setValue] = useState([]);
|
|
20
|
+
const [options,setOptions] = useState([]);
|
|
21
|
+
const [showChecked,setShowChecked] = useState(false);
|
|
22
|
+
const [isMobile] = useState(isMobileFn())
|
|
23
|
+
const Component=useMemo(()=>(AntdSelect),[]);
|
|
24
|
+
|
|
25
|
+
const getOptions=()=>{
|
|
26
|
+
return options;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const getOptionsByValue=(values)=>{
|
|
30
|
+
const valueSet = new Set(values.map(v=>`${v}`));
|
|
31
|
+
return options.filter(item=>valueSet.has(`${item.value}`));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const getSearchFilterOptions=()=>{
|
|
35
|
+
if(searchValue){
|
|
36
|
+
const valueSet = new Set((value||[]).map(v=>`${v}`));
|
|
37
|
+
let matchItems= options.filter(item=>{
|
|
38
|
+
let match=false;
|
|
39
|
+
if(props.filterOption){
|
|
40
|
+
match = props.filterOption(searchValue,item);
|
|
41
|
+
}else{
|
|
42
|
+
let keywords =searchValue.toLocaleLowerCase();
|
|
43
|
+
const {label} = item;
|
|
44
|
+
if( `${label}`.toLocaleLowerCase().indexOf(keywords) >=0 ){
|
|
45
|
+
match=true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if(match){
|
|
50
|
+
if( !valueSet.has(`${item.value}`) ){
|
|
51
|
+
match = false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return match;
|
|
55
|
+
})
|
|
56
|
+
return matchItems;
|
|
57
|
+
}else{
|
|
58
|
+
return options;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const isAllValueItem=(item)=>{
|
|
62
|
+
return item?.value == allValue
|
|
63
|
+
}
|
|
64
|
+
const onSelectAll=()=>{
|
|
65
|
+
let _values,_options;
|
|
66
|
+
let newValue=[];
|
|
67
|
+
const valueSet = new Set((value||[]).map(v=>`${v}`));
|
|
68
|
+
if(searchValue){
|
|
69
|
+
let matchItems= options.filter(item=>{
|
|
70
|
+
let match=false;
|
|
71
|
+
if(props.filterOption){
|
|
72
|
+
match = props.filterOption(searchValue,item);
|
|
73
|
+
}else{
|
|
74
|
+
let keywords =searchValue.toLocaleLowerCase();
|
|
75
|
+
const {label} = item;
|
|
76
|
+
if( `${label}`.toLocaleLowerCase().indexOf(keywords) >=0 ){
|
|
77
|
+
match=true;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if(match){
|
|
81
|
+
if( valueSet.has(`${item.value}`) ){
|
|
82
|
+
match = false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return match;
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
matchItems.forEach(item=>{
|
|
89
|
+
if(showAll){
|
|
90
|
+
if( isAllValueItem(item) ){
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
newValue.push(item.value);
|
|
95
|
+
});
|
|
96
|
+
if(newValue&&newValue.length>0){
|
|
97
|
+
if(maxCount && maxCount != Infinity){
|
|
98
|
+
let count = maxCount - value?.length;
|
|
99
|
+
if(count<=0){
|
|
100
|
+
newValue=[];
|
|
101
|
+
}else{
|
|
102
|
+
if(newValue.length > count){
|
|
103
|
+
newValue.splice(0,count);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}else{
|
|
109
|
+
if(maxCount && maxCount != Infinity){
|
|
110
|
+
let count = maxCount - value?.length;
|
|
111
|
+
if(count>0){
|
|
112
|
+
newValue=[];
|
|
113
|
+
let opts = getOptions();
|
|
114
|
+
for(let j=0;j<opts.length;j++){
|
|
115
|
+
if(count <=0 )break;
|
|
116
|
+
if( !valueSet.has(`${opts[j].value}`) ){
|
|
117
|
+
if(showAll){
|
|
118
|
+
if( isAllValueItem(opts[j]) ){
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
newValue.push(opts[j].value);
|
|
123
|
+
count--;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}else{
|
|
128
|
+
_values=[];
|
|
129
|
+
getOptions().forEach(item=>{
|
|
130
|
+
if(showAll){
|
|
131
|
+
if( isAllValueItem(item) ){
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
_values.push(item.value)
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
_values= _values || [...value,...newValue];
|
|
140
|
+
_options=getOptionsByValue(_values);
|
|
141
|
+
setValue(_values);
|
|
142
|
+
if(props.onChange){
|
|
143
|
+
props.onChange(_values,_options)
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const onDeSelectAll=()=>{
|
|
148
|
+
let _values,_options;
|
|
149
|
+
if(searchValue){
|
|
150
|
+
const valueSet = new Set((value||[]).map(v=>`${v}`));
|
|
151
|
+
let matchItems= options.filter(item=>{
|
|
152
|
+
let match=false;
|
|
153
|
+
if(props.filterOption){
|
|
154
|
+
match = props.filterOption(searchValue,item);
|
|
155
|
+
}else{
|
|
156
|
+
let keywords =searchValue.toLocaleLowerCase();
|
|
157
|
+
const {label} = item;
|
|
158
|
+
if( `${label}`.toLocaleLowerCase().indexOf(keywords) >=0 ){
|
|
159
|
+
match=true;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if(match){
|
|
163
|
+
if( !valueSet.has(`${item.value}`) ){
|
|
164
|
+
match = false;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return match;
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
const removeSet = new Set(matchItems.map(item=>`${item.value}`));
|
|
171
|
+
if(removeSet.size>0){
|
|
172
|
+
_values = (value||[]).filter(id=>!removeSet.has(`${id}`));
|
|
173
|
+
_options=getOptionsByValue(_values);
|
|
174
|
+
}
|
|
175
|
+
}else{
|
|
176
|
+
_values=[];
|
|
177
|
+
_options=[];
|
|
178
|
+
}
|
|
179
|
+
setValue(_values);
|
|
180
|
+
if(props.onChange){
|
|
181
|
+
props.onChange(_values,_options)
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const onShowChcked=()=>{
|
|
186
|
+
setShowChecked(v=>!v);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const tagRender = (props) => {
|
|
190
|
+
const { label, closable, onClose } = props;
|
|
191
|
+
return (
|
|
192
|
+
<span className="ant-select-selection-item">
|
|
193
|
+
{label}
|
|
194
|
+
</span>
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
useEffect(()=>{
|
|
199
|
+
if(_options){
|
|
200
|
+
setOptions(_options);
|
|
201
|
+
}
|
|
202
|
+
if(children){
|
|
203
|
+
let temp = children.map(item=>{
|
|
204
|
+
let req = {...item.props};
|
|
205
|
+
req.label=req.children;
|
|
206
|
+
return req;
|
|
207
|
+
});
|
|
208
|
+
setOptions(temp);
|
|
209
|
+
}
|
|
210
|
+
},[_options,children]);
|
|
211
|
+
|
|
212
|
+
useEffect(()=>{
|
|
213
|
+
if(_value != value){
|
|
214
|
+
setValue(_value||[]);
|
|
215
|
+
}
|
|
216
|
+
},[_value]);
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
const checkedValueSet = showChecked ? new Set((value||[]).map(v=>`${v}`)) : null;
|
|
220
|
+
return (
|
|
221
|
+
<Component
|
|
222
|
+
mode={mode}
|
|
223
|
+
autoClearSearchValue={isMobile ? true :false}
|
|
224
|
+
showSearch={isMobile ? false : showSearch}
|
|
225
|
+
{...otherProps}
|
|
226
|
+
tagRender={tagRender}
|
|
227
|
+
|
|
228
|
+
onDropdownVisibleChange={(open)=>{
|
|
229
|
+
if(!open){
|
|
230
|
+
setSearchValue('');
|
|
231
|
+
setShowChecked(false);
|
|
232
|
+
}
|
|
233
|
+
if(props.onDropdownVisibleChange)props.onDropdownVisibleChange(open);
|
|
234
|
+
}}
|
|
235
|
+
onSearch={(value)=>{
|
|
236
|
+
setSearchValue(value);
|
|
237
|
+
if(props.onSearch)props.onSearch(value);
|
|
238
|
+
}}
|
|
239
|
+
searchValue={searchValue}
|
|
240
|
+
dropdownRender={(node)=>{
|
|
241
|
+
if(props.dropdownRender)return props.dropdownRender(node);
|
|
242
|
+
if(mode=='multiple' || mode=='tags'){
|
|
243
|
+
let _options = getOptions();
|
|
244
|
+
if(!_options||_options.length < 5)return node;
|
|
245
|
+
|
|
246
|
+
let opers=[];
|
|
247
|
+
let rightOpers=[];
|
|
248
|
+
if(showChecked){
|
|
249
|
+
rightOpers.push(
|
|
250
|
+
<Link key='noShowChecked' className={styles.rightOpers} type='dark' onClick={onShowChcked}>返回</Link>
|
|
251
|
+
)
|
|
252
|
+
}else{
|
|
253
|
+
if(maxCount==Infinity || maxCount == undefined){
|
|
254
|
+
opers.push(<Link key='all' onClick={onSelectAll}>全选</Link>)
|
|
255
|
+
}
|
|
256
|
+
if(searchValue && value && value?.length >0 ){
|
|
257
|
+
let filterMatchItems = getSearchFilterOptions();
|
|
258
|
+
if(filterMatchItems.length>0){
|
|
259
|
+
opers.push(<Link key='reset' type='dark' onClick={onDeSelectAll}>重置</Link>)
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if(value&&value.length>0){
|
|
263
|
+
rightOpers.push(<Link key='showChecked' className={styles.rightOpers} type='dark' onClick={onShowChcked}>已选</Link>)
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return <>
|
|
267
|
+
{node}
|
|
268
|
+
{
|
|
269
|
+
opers?.length>0||rightOpers?.length>0?(
|
|
270
|
+
<div className={styles.opers}>
|
|
271
|
+
<div className={styles.left}>{opers}</div>
|
|
272
|
+
<div className={styles.right}>{rightOpers}</div>
|
|
273
|
+
</div>
|
|
274
|
+
):<></>
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
</>;
|
|
278
|
+
}else{
|
|
279
|
+
return node;
|
|
280
|
+
}
|
|
281
|
+
}}
|
|
282
|
+
options={showChecked?options.filter(item=>checkedValueSet.has(`${item.value}`)):options}
|
|
283
|
+
value={value}
|
|
284
|
+
onChange={(values,options)=>{
|
|
285
|
+
setValue(values);
|
|
286
|
+
if(props.onChange)props.onChange(values,options)
|
|
287
|
+
}}
|
|
288
|
+
/>
|
|
289
|
+
)
|
|
290
|
+
}
|
|
291
|
+
Select.Option = AntdSelect.Option;
|
|
292
|
+
Select.OptGroup = AntdSelect.OptGroup;
|
|
293
|
+
Select.SECRET_COMBOBOX_MODE_DO_NOT_USE = AntdSelect.SECRET_COMBOBOX_MODE_DO_NOT_USE;
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
export default Select;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@import '~@/_variable.module.less';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
.opers{
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: space-between;
|
|
8
|
+
column-gap: 12px;
|
|
9
|
+
padding:0px 8px;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height:40px;
|
|
12
|
+
border-top: 1px solid #DEE0E3;
|
|
13
|
+
.right,
|
|
14
|
+
.left{
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
column-gap: 12px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* antd 5 Table 主题配置
|
|
3
|
+
* 基于项目的 antd 4 样式定制(_antd.less)
|
|
4
|
+
*
|
|
5
|
+
* 主要特点:
|
|
6
|
+
* - 主色:#0974F2(项目自定义蓝色)
|
|
7
|
+
* - 表头背景:#F5F8FF(浅蓝色)
|
|
8
|
+
* - 斑马纹:奇数行 #F5F7FC
|
|
9
|
+
* - 悬停色:#E6F1FE(浅蓝色)
|
|
10
|
+
* - 边框色:#DEE0E3
|
|
11
|
+
* - 紧凑内边距:垂直4px,水平8px
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export const antd5TableTheme = {
|
|
15
|
+
token: {
|
|
16
|
+
// ===== 主色系(来自 _antd.less: @primary-color:#0974F2) =====
|
|
17
|
+
colorPrimary: '#0974F2', // 主色
|
|
18
|
+
colorPrimaryHover: '#3D92F5', // 主色悬停
|
|
19
|
+
colorPrimaryActive: '#0861D1', // 主色激活
|
|
20
|
+
|
|
21
|
+
// ===== 基础色彩 =====
|
|
22
|
+
colorSuccess: '#52c41a', // 成功色
|
|
23
|
+
colorWarning: '#faad14', // 警告色
|
|
24
|
+
colorError: '#ff4d4f', // 错误色
|
|
25
|
+
colorInfo: '#0974F2', // 信息色(使用主色)
|
|
26
|
+
colorTextBase: '#000000', // 基础文本色
|
|
27
|
+
colorBgBase: '#ffffff', // 基础背景色
|
|
28
|
+
colorBorder: '#DEE0E3', // 边框色(来自 @table-border-color)
|
|
29
|
+
|
|
30
|
+
// ===== 字体 =====
|
|
31
|
+
fontSize: 14, // 主字号
|
|
32
|
+
fontSizeSM: 12, // 小字号
|
|
33
|
+
fontSizeLG: 16, // 大字号
|
|
34
|
+
fontFamily: `-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'`,
|
|
35
|
+
lineHeight: 1.5715, // 行高
|
|
36
|
+
|
|
37
|
+
// ===== 圆角(来自 _antd.less) =====
|
|
38
|
+
borderRadius: 4, // 按钮圆角(@btn-border-radius-base:4px)
|
|
39
|
+
borderRadiusLG: 8, // 大圆角(@modal-border-radius:8px)
|
|
40
|
+
borderRadiusSM: 2, // 小圆角
|
|
41
|
+
|
|
42
|
+
// ===== 尺寸 =====
|
|
43
|
+
controlHeight: 32, // 控件高度
|
|
44
|
+
controlHeightSM: 24, // 小尺寸控件高度
|
|
45
|
+
controlHeightLG: 40, // 大尺寸控件高度
|
|
46
|
+
|
|
47
|
+
// ===== 边框 =====
|
|
48
|
+
lineWidth: 1,
|
|
49
|
+
lineType: 'solid',
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
components: {
|
|
53
|
+
Table: {
|
|
54
|
+
// ===== 表头样式(来自 _antd.less: @table-header-bg:#F5F8FF) =====
|
|
55
|
+
headerBg: '#F5F8FF', // 表头背景色(浅蓝色)
|
|
56
|
+
headerColor: 'rgba(0, 0, 0, 0.85)', // 表头文字颜色
|
|
57
|
+
headerSortActiveBg: '#E6F1FE', // 排序激活背景色
|
|
58
|
+
headerSortHoverBg: '#EDF4FF', // 排序悬停背景色
|
|
59
|
+
headerBorderRadius: 0, // 表头圆角(antd 4 默认无圆角)
|
|
60
|
+
fixedHeaderSortActiveBg: '#E6F1FE',
|
|
61
|
+
|
|
62
|
+
// ===== 表体样式 =====
|
|
63
|
+
// 悬停背景色(来自 _antd.less: line 47-50)
|
|
64
|
+
rowHoverBg: '#E6F1FE', // 行悬停背景色(浅蓝色)
|
|
65
|
+
|
|
66
|
+
// 选中行背景色
|
|
67
|
+
rowSelectedBg: '#E6F1FE', // 行选中背景色
|
|
68
|
+
rowSelectedHoverBg: '#D6E8FD', // 选中行悬停背景色
|
|
69
|
+
|
|
70
|
+
// 展开行背景色
|
|
71
|
+
rowExpandedBg: '#FAFBFC', // 展开行背景色
|
|
72
|
+
|
|
73
|
+
// ===== 边框和分割线(来自 _antd.less: @table-border-color:#DEE0E3) =====
|
|
74
|
+
borderColor: '#DEE0E3', // 边框颜色
|
|
75
|
+
headerSplitColor: '#DEE0E3', // 表头分割线颜色
|
|
76
|
+
|
|
77
|
+
// ===== 单元格内边距(来自 _antd.less: @table-padding-vertical:4px; @table-padding-horizontal:8px) =====
|
|
78
|
+
// small size(项目中使用 size="small")
|
|
79
|
+
cellPaddingBlockSM: 4, // 垂直内边距 4px
|
|
80
|
+
cellPaddingInlineSM: 8, // 水平内边距 8px
|
|
81
|
+
|
|
82
|
+
// middle size
|
|
83
|
+
cellPaddingBlockMD: 8, // 垂直内边距
|
|
84
|
+
cellPaddingInlineMD: 12, // 水平内边距
|
|
85
|
+
|
|
86
|
+
// large size
|
|
87
|
+
cellPaddingBlock: 12, // 垂直内边距
|
|
88
|
+
cellPaddingInline: 16, // 水平内边距
|
|
89
|
+
|
|
90
|
+
// ===== 表头特殊样式(来自 _antd.less: line 34-40) =====
|
|
91
|
+
// small size 表头内边距
|
|
92
|
+
headerPaddingBlockSM: 5, // 表头垂直内边距 5px
|
|
93
|
+
headerPaddingInlineSM: 8, // 表头水平内边距 8px
|
|
94
|
+
|
|
95
|
+
// ===== 字体 =====
|
|
96
|
+
cellFontSize: 14, // 单元格字号
|
|
97
|
+
cellFontSizeMD: 14,
|
|
98
|
+
cellFontSizeSM: 14,
|
|
99
|
+
headerFontSize: 14, // 表头字号
|
|
100
|
+
|
|
101
|
+
// 表头字重(来自 _antd.less: line 38: font-weight: normal)
|
|
102
|
+
// 注意:antd 5 没有直接的 headerFontWeight 配置,需要通过 CSS 覆盖
|
|
103
|
+
|
|
104
|
+
// ===== 固定列阴影 =====
|
|
105
|
+
fixedHeaderSortActiveBg: '#E6F1FE',
|
|
106
|
+
bodySortBg: '#F5F8FF',
|
|
107
|
+
|
|
108
|
+
// ===== 筛选器 =====
|
|
109
|
+
filterDropdownBg: '#ffffff',
|
|
110
|
+
filterDropdownMenuBg: '#ffffff',
|
|
111
|
+
|
|
112
|
+
// ===== 其他 =====
|
|
113
|
+
expandIconBg: '#ffffff',
|
|
114
|
+
selectionColumnWidth: 32, // 选择列宽度
|
|
115
|
+
stickyScrollBarBg: 'rgba(0, 0, 0, 0.35)', // 滚动条背景色
|
|
116
|
+
stickyScrollBarBorderRadius: 4,
|
|
117
|
+
|
|
118
|
+
// ===== 分页器间距(来自 _antd.less: line 41-43) =====
|
|
119
|
+
// 注意:这个需要通过额外的 CSS 处理,antd 5 没有直接配置项
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
// ===== 其他相关组件配置 =====
|
|
123
|
+
Pagination: {
|
|
124
|
+
// 分页器间距(来自 _antd.less: line 41-43: margin:6px 0 4px 0)
|
|
125
|
+
// 注意:需要通过 CSS 覆盖
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
Checkbox: {
|
|
129
|
+
// 复选框配置(来自 _antd.less: line 188-214)
|
|
130
|
+
borderRadiusSM: 4, // 圆角 4px
|
|
131
|
+
colorPrimary: '#2C93F5', // 选中色
|
|
132
|
+
colorPrimaryHover: '#3D92F5',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
// ===== 算法 =====
|
|
137
|
+
algorithm: undefined, // 使用默认算法
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* 额外的 CSS 样式(无法通过 theme 配置的部分)
|
|
142
|
+
* 需要在组件中通过 className 或 style 标签注入
|
|
143
|
+
*/
|
|
144
|
+
export const antd5TableExtraStyles = `
|
|
145
|
+
/* 斑马纹样式(来自 _antd.less: line 51-59) */
|
|
146
|
+
.ant-table-tbody > tr:nth-child(odd):not(.ant-table-row-selected) {
|
|
147
|
+
background-color: #F5F7FC;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* 固定列的斑马纹背景 */
|
|
151
|
+
.ant-table-tbody > tr:nth-child(odd):not(.ant-table-row-selected) .ant-table-cell-fix-left,
|
|
152
|
+
.ant-table-tbody > tr:nth-child(odd):not(.ant-table-row-selected) .ant-table-cell-fix-right {
|
|
153
|
+
background-color: #F5F7FC;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/* 表头字重为 normal(来自 _antd.less: line 38) */
|
|
157
|
+
.ant-table-small .ant-table-thead > tr > th {
|
|
158
|
+
font-weight: normal;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/* 分页器间距(来自 _antd.less: line 41-43) */
|
|
162
|
+
.ant-table-pagination.ant-pagination {
|
|
163
|
+
margin: 6px 0 4px 0;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/* 悬停样式优先级(来自 _antd.less: line 47-50) */
|
|
167
|
+
.ant-table-tbody > tr.ant-table-row:hover > td,
|
|
168
|
+
.ant-table-tbody > tr > td.ant-table-cell-row-hover {
|
|
169
|
+
background-color: #E6F1FE !important;
|
|
170
|
+
}
|
|
171
|
+
`;
|
|
172
|
+
|
|
173
|
+
export default antd5TableTheme;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ReactRender } from "@/components/react";
|
|
3
|
+
|
|
4
|
+
import { Modal } from "@/components/antd";
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import Popup from "@/components/popup";
|
|
7
|
+
import { LayoutLanguage } from "@/components/layout/provider";
|
|
8
|
+
import styles from './index.module.less';
|
|
9
|
+
import { useEffect } from "react";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 控制室 - 操作记录 - 事件内容详情
|
|
13
|
+
* @returns {JSX.Element}
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const Detail = (props) => {
|
|
17
|
+
const { destory,title,content } = props;
|
|
18
|
+
const onCancel = () => {
|
|
19
|
+
destory && destory(false);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const onOk = () => {
|
|
23
|
+
destory && destory(true);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
let isJsx = React.isValidElement(content)
|
|
27
|
+
|
|
28
|
+
const onEsc=(e)=>{
|
|
29
|
+
if (e.key.toLocaleLowerCase() === 'escape' || e.key.toLocaleLowerCase() === 'esc') {
|
|
30
|
+
onCancel();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
useEffect(()=>{
|
|
35
|
+
window.addEventListener('keyup',onEsc)
|
|
36
|
+
return ()=>{
|
|
37
|
+
window.removeEventListener('keyup',onEsc)
|
|
38
|
+
}
|
|
39
|
+
},[])
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Modal
|
|
43
|
+
maskClosable={true}
|
|
44
|
+
title={title||'详情'}
|
|
45
|
+
width={720}
|
|
46
|
+
open={true}
|
|
47
|
+
footer={false}
|
|
48
|
+
onCancel={onCancel}
|
|
49
|
+
onOk={onOk}
|
|
50
|
+
>
|
|
51
|
+
{
|
|
52
|
+
isJsx?<div className={styles.content}>{isJsx?content:''}</div>:<div className={styles.content} dangerouslySetInnerHTML={{__html:content}}></div>
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
</Modal>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const ShowDetail = (props = {}) => {
|
|
60
|
+
return new Promise((resolve) => {
|
|
61
|
+
let popup = Popup(resolve);
|
|
62
|
+
ReactRender(
|
|
63
|
+
<LayoutLanguage>
|
|
64
|
+
<Detail destory={popup.destory} {...props} />
|
|
65
|
+
</LayoutLanguage>,
|
|
66
|
+
popup.dom
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
export default ShowDetail;
|