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
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Modal, App } from '@/components/antd';
|
|
3
|
+
import Antd5Provider from '@/components/antd/antProvider';
|
|
4
|
+
import {ReactRender} from '@/components/react';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {Object} ShowModalConfig
|
|
9
|
+
* @property {React.ReactNode} content - Modal 内容(必填)
|
|
10
|
+
* @property {string} [title] - 标题
|
|
11
|
+
* @property {number} [width] - 宽度
|
|
12
|
+
* @property {Function} [onOk] - 确定回调,返回 Promise 可以控制关闭
|
|
13
|
+
* @property {Function} [onCancel] - 取消回调
|
|
14
|
+
* @property {boolean} [maskClosable] - 点击遮罩是否关闭
|
|
15
|
+
* @property {string} [okText] - 确定按钮文字
|
|
16
|
+
* @property {string} [cancelText] - 取消按钮文字
|
|
17
|
+
* @property {boolean} [hideOk] - 隐藏确定按钮
|
|
18
|
+
* @property {boolean} [hideCancel] - 隐藏取消按钮
|
|
19
|
+
* @property {Object} [modalProps] - 其他 antd Modal 属性
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 创建一个命令式调用的 Modal(推荐方式)
|
|
24
|
+
* 优点:
|
|
25
|
+
* - 自动继承主题配置
|
|
26
|
+
* - 代码更简洁
|
|
27
|
+
* - 符合 antd 5 最佳实践
|
|
28
|
+
* @param {ShowModalConfig} config - Modal 配置
|
|
29
|
+
* @returns {Promise<boolean>} 返回 Promise,resolve(true) 表示确定,resolve(false) 表示取消
|
|
30
|
+
* @example
|
|
31
|
+
* // 基础用法
|
|
32
|
+
* const result = await showModal({
|
|
33
|
+
* title: '编辑用户',
|
|
34
|
+
* content: <MyForm />,
|
|
35
|
+
* width: 600,
|
|
36
|
+
* });
|
|
37
|
+
*
|
|
38
|
+
* // 带表单验证
|
|
39
|
+
* const result = await showModal({
|
|
40
|
+
* title: '编辑用户',
|
|
41
|
+
* content: <MyForm ref={formRef} />,
|
|
42
|
+
* onOk: async () => {
|
|
43
|
+
* await formRef.current.validateFields();
|
|
44
|
+
* await saveData();
|
|
45
|
+
* }
|
|
46
|
+
* });
|
|
47
|
+
*/
|
|
48
|
+
export const showModal = (config) => {
|
|
49
|
+
return new Promise((resolve) => {
|
|
50
|
+
let root;
|
|
51
|
+
// 清理函数
|
|
52
|
+
const cleanup = () => {
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
root.unmount();
|
|
55
|
+
if (container.parentNode) {
|
|
56
|
+
container.parentNode.removeChild(container);
|
|
57
|
+
}
|
|
58
|
+
}, 300); // 等待动画结束
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// 渲染 Modal
|
|
62
|
+
const ModalWrapper = () => {
|
|
63
|
+
const [open, setOpen] = React.useState(true);
|
|
64
|
+
const [confirmLoading, setConfirmLoading] = React.useState(false);
|
|
65
|
+
// 自动创建 ref,注入给 content,content 可通过 useImperativeHandle 暴露 onOk
|
|
66
|
+
const contentRef = React.useRef(null);
|
|
67
|
+
|
|
68
|
+
const handleOk = async () => {
|
|
69
|
+
try {
|
|
70
|
+
setConfirmLoading(true);
|
|
71
|
+
if (config.onOk) {
|
|
72
|
+
await config.onOk();
|
|
73
|
+
} else if (contentRef.current?.onOk) {
|
|
74
|
+
await contentRef.current.onOk();
|
|
75
|
+
}
|
|
76
|
+
setConfirmLoading(false);
|
|
77
|
+
setOpen(false);
|
|
78
|
+
cleanup();
|
|
79
|
+
resolve(true);
|
|
80
|
+
} catch (error) {
|
|
81
|
+
setConfirmLoading(false);
|
|
82
|
+
// 如果 onOk 抛出错误,不关闭 Modal
|
|
83
|
+
console.error('Modal onOk error:', error);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const handleCancel = () => {
|
|
88
|
+
if (config.onCancel) {
|
|
89
|
+
config.onCancel();
|
|
90
|
+
}
|
|
91
|
+
setOpen(false);
|
|
92
|
+
cleanup();
|
|
93
|
+
resolve(false);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const content = React.isValidElement(config.content)
|
|
97
|
+
? React.cloneElement(config.content, { ref: contentRef })
|
|
98
|
+
: config.content;
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<Antd5Provider>
|
|
102
|
+
<Modal
|
|
103
|
+
title={config.title}
|
|
104
|
+
open={open}
|
|
105
|
+
onOk={handleOk}
|
|
106
|
+
onCancel={handleCancel}
|
|
107
|
+
width={config.width || 520}
|
|
108
|
+
maskClosable={config.maskClosable !== undefined ? config.maskClosable : false}
|
|
109
|
+
confirmLoading={confirmLoading}
|
|
110
|
+
okText={config.okText}
|
|
111
|
+
cancelText={config.cancelText}
|
|
112
|
+
okButtonProps={config.hideOk ? { style: { display: 'none' } } : undefined}
|
|
113
|
+
cancelButtonProps={config.hideCancel ? { style: { display: 'none' } } : undefined}
|
|
114
|
+
{...config.modalProps}
|
|
115
|
+
>
|
|
116
|
+
{content}
|
|
117
|
+
</Modal>
|
|
118
|
+
</Antd5Provider>
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// 创建容器
|
|
123
|
+
const container = document.createElement('div');
|
|
124
|
+
document.body.appendChild(container);
|
|
125
|
+
root = ReactRender(<ModalWrapper />,container)
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* 使用 App.useApp() 的 Modal(在组件内使用)
|
|
131
|
+
* 优点:
|
|
132
|
+
* - 自动继承主题
|
|
133
|
+
* - 更轻量
|
|
134
|
+
* - 不需要手动管理 DOM
|
|
135
|
+
* @example
|
|
136
|
+
* function MyComponent() {
|
|
137
|
+
* const { showModalInApp } = useModalHelper();
|
|
138
|
+
*
|
|
139
|
+
* const handleEdit = async () => {
|
|
140
|
+
* const result = await showModalInApp({
|
|
141
|
+
* title: '编辑',
|
|
142
|
+
* content: <MyForm />
|
|
143
|
+
* });
|
|
144
|
+
* };
|
|
145
|
+
* }
|
|
146
|
+
*/
|
|
147
|
+
export const useModalHelper = () => {
|
|
148
|
+
const { modal } = App.useApp();
|
|
149
|
+
|
|
150
|
+
const showModalInApp = (config) => {
|
|
151
|
+
return new Promise((resolve) => {
|
|
152
|
+
const modalInstance = modal.confirm({
|
|
153
|
+
title: config.title,
|
|
154
|
+
content: config.content,
|
|
155
|
+
width: config.width || 520,
|
|
156
|
+
icon: null,
|
|
157
|
+
okText: config.okText || '确定',
|
|
158
|
+
cancelText: config.cancelText || '取消',
|
|
159
|
+
maskClosable: config.maskClosable !== undefined ? config.maskClosable : false,
|
|
160
|
+
onOk: async () => {
|
|
161
|
+
try {
|
|
162
|
+
if (config.onOk) {
|
|
163
|
+
await config.onOk();
|
|
164
|
+
}
|
|
165
|
+
resolve(true);
|
|
166
|
+
} catch (error) {
|
|
167
|
+
console.error('Modal onOk error:', error);
|
|
168
|
+
return Promise.reject(error); // 阻止关闭
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
onCancel: () => {
|
|
172
|
+
if (config.onCancel) {
|
|
173
|
+
config.onCancel();
|
|
174
|
+
}
|
|
175
|
+
resolve(false);
|
|
176
|
+
},
|
|
177
|
+
...config.modalProps,
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
return { showModalInApp, modal };
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export default showModal;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AntdSpin } from '../';
|
|
3
|
+
import { ReactRender } from '@/components/react';
|
|
4
|
+
import styles from './index.module.less';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {Object} SpinExtraProps
|
|
8
|
+
* @property {boolean} [showMask=true] - 是否在目标范围内显示遮罩(rgba(0,0,0,.5))
|
|
9
|
+
* @property {boolean} [canTouch=false] - 是否允许点击穿透到下层 UI(默认关闭,即阻断点击)
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 扩展的 Spin 组件,支持遮罩和点击穿透控制
|
|
14
|
+
*
|
|
15
|
+
* 无 children 时等同于原始 antd Spin。
|
|
16
|
+
* 有 children 时在容器内叠加遮罩 + Spin 指示器。
|
|
17
|
+
*
|
|
18
|
+
* @param {import('antd').SpinProps & SpinExtraProps & { children?: React.ReactNode }} props
|
|
19
|
+
*/
|
|
20
|
+
const Spin = ({ children, showMask = true, canTouch = false, spinning = true, tip, ...rest }) => {
|
|
21
|
+
if (!children) {
|
|
22
|
+
return <AntdSpin spinning={spinning} tip={tip} {...rest} />;
|
|
23
|
+
}
|
|
24
|
+
return (
|
|
25
|
+
<div className={styles.container}>
|
|
26
|
+
{children}
|
|
27
|
+
{spinning && (
|
|
28
|
+
<div
|
|
29
|
+
className={styles.overlay}
|
|
30
|
+
data-mask={showMask || undefined}
|
|
31
|
+
data-can-touch={canTouch || undefined}
|
|
32
|
+
>
|
|
33
|
+
<div className={styles.spinWrap}>
|
|
34
|
+
<AntdSpin spinning {...rest} />
|
|
35
|
+
{tip && <div className={styles.tip}>{tip}</div>}
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
)}
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const FullSpin=({showMask=true,canTouch=false,tip})=>{
|
|
44
|
+
return (
|
|
45
|
+
<div
|
|
46
|
+
className={styles.fullOverlay}
|
|
47
|
+
data-mask={showMask || undefined}
|
|
48
|
+
data-can-touch={canTouch || undefined}
|
|
49
|
+
>
|
|
50
|
+
<div className={styles.spinWrap}>
|
|
51
|
+
<AntdSpin spinning />
|
|
52
|
+
{tip && <div className={styles.tip}>{tip}</div>}
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @typedef {Object} ShowLoadingOptions
|
|
59
|
+
* @property {boolean} [showMask=true] - 是否显示半透明遮罩
|
|
60
|
+
* @property {boolean} [canTouch=false] - 是否允许点击穿透
|
|
61
|
+
* @property {string} [tip] - 加载提示文字
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 激活覆盖整个页面的全屏 Loading
|
|
66
|
+
* @param {ShowLoadingOptions} [options]
|
|
67
|
+
* @returns {() => void} stop - 调用后关闭 Loading
|
|
68
|
+
* @example
|
|
69
|
+
* const stop = showLoading({ showMask: true });
|
|
70
|
+
* // ... 异步操作完成后
|
|
71
|
+
* stop();
|
|
72
|
+
*/
|
|
73
|
+
export const showLoading = (options = {}) => {
|
|
74
|
+
const { showMask = true, canTouch = false, tip } = options;
|
|
75
|
+
|
|
76
|
+
const container = document.createElement('div');
|
|
77
|
+
document.body.appendChild(container);
|
|
78
|
+
|
|
79
|
+
const root = ReactRender(
|
|
80
|
+
<FullSpin showMask={showMask} canTouch={canTouch} tip={tip}/>,
|
|
81
|
+
container
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
return () => {
|
|
85
|
+
root.unmount();
|
|
86
|
+
if (container.parentNode) {
|
|
87
|
+
container.parentNode.removeChild(container);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export default Spin;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.overlay {
|
|
8
|
+
position: absolute;
|
|
9
|
+
inset: 0;
|
|
10
|
+
z-index: 99;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
pointer-events: auto;
|
|
15
|
+
|
|
16
|
+
&[data-mask] {
|
|
17
|
+
background: rgba(0, 0, 0, 0.5);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&[data-can-touch] {
|
|
21
|
+
pointer-events: none;
|
|
22
|
+
|
|
23
|
+
// 穿透时 spin 指示器本身仍可见但不阻断事件
|
|
24
|
+
:global(.ant-spin) {
|
|
25
|
+
pointer-events: none;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.spinWrap {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
align-items: center;
|
|
34
|
+
gap: 8px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.tip {
|
|
38
|
+
color: rgba(255, 255, 255, 0.85);
|
|
39
|
+
font-size: 14px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.fullOverlay {
|
|
43
|
+
position: fixed;
|
|
44
|
+
inset: 0;
|
|
45
|
+
z-index: 9999;
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
pointer-events: auto;
|
|
50
|
+
|
|
51
|
+
&[data-mask] {
|
|
52
|
+
background: rgba(0, 0, 0, 0.5);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&[data-can-touch] {
|
|
56
|
+
pointer-events: none;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -12,11 +12,16 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
export const antd5TableTheme = {
|
|
15
|
+
cssVar:true,// 审查元素时使用CSS变量
|
|
15
16
|
token: {
|
|
16
17
|
// ===== 主色系(来自 _antd.less: @primary-color:#0974F2) =====
|
|
17
|
-
colorPrimary: '#
|
|
18
|
-
colorPrimaryHover: '#
|
|
19
|
-
|
|
18
|
+
colorPrimary: '#5B50FA', // 主色
|
|
19
|
+
colorPrimaryHover: '#887aff', // 主色悬停
|
|
20
|
+
colorPrimaryBg:'#E7E7FA', // 主色浅色背景色
|
|
21
|
+
colorPrimaryActive: '#3e39d4', // 主色激活
|
|
22
|
+
|
|
23
|
+
// ===== 链接色 =====
|
|
24
|
+
colorLink:'#5B50FA',
|
|
20
25
|
|
|
21
26
|
// ===== 基础色彩 =====
|
|
22
27
|
colorSuccess: '#52c41a', // 成功色
|
|
@@ -36,7 +41,7 @@ export const antd5TableTheme = {
|
|
|
36
41
|
|
|
37
42
|
// ===== 圆角(来自 _antd.less) =====
|
|
38
43
|
borderRadius: 4, // 按钮圆角(@btn-border-radius-base:4px)
|
|
39
|
-
borderRadiusLG:
|
|
44
|
+
borderRadiusLG: 4, // 大圆角(@modal-border-radius:8px)
|
|
40
45
|
borderRadiusSM: 2, // 小圆角
|
|
41
46
|
|
|
42
47
|
// ===== 尺寸 =====
|
|
@@ -52,7 +57,7 @@ export const antd5TableTheme = {
|
|
|
52
57
|
components: {
|
|
53
58
|
Table: {
|
|
54
59
|
// ===== 表头样式(来自 _antd.less: @table-header-bg:#F5F8FF) =====
|
|
55
|
-
headerBg: '#
|
|
60
|
+
headerBg: '#F2F3F5', // 表头背景色(浅蓝色)
|
|
56
61
|
headerColor: 'rgba(0, 0, 0, 0.85)', // 表头文字颜色
|
|
57
62
|
headerSortActiveBg: '#E6F1FE', // 排序激活背景色
|
|
58
63
|
headerSortHoverBg: '#EDF4FF', // 排序悬停背景色
|
|
@@ -127,9 +132,15 @@ export const antd5TableTheme = {
|
|
|
127
132
|
|
|
128
133
|
Checkbox: {
|
|
129
134
|
// 复选框配置(来自 _antd.less: line 188-214)
|
|
130
|
-
borderRadiusSM:
|
|
131
|
-
colorPrimary: '#
|
|
132
|
-
colorPrimaryHover: '#
|
|
135
|
+
borderRadiusSM: 2, // 圆角 4px
|
|
136
|
+
colorPrimary: '#5B50FA', // 选中色
|
|
137
|
+
colorPrimaryHover: '#887aff',
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
Menu: {
|
|
141
|
+
// 菜单组件配置(根据 UI 图优化)
|
|
142
|
+
itemBorderRadius: 4, // 选中项圆角
|
|
143
|
+
itemMarginInline: 16, // 内边距
|
|
133
144
|
},
|
|
134
145
|
},
|
|
135
146
|
|
|
@@ -1,70 +1,33 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { Modal } from "@/components/antd";
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
import Popup from "@/components/popup";
|
|
7
|
-
import { LayoutLanguage } from "@/components/layout/provider";
|
|
2
|
+
import { showModal } from "@/components/antd";
|
|
8
3
|
import styles from './index.module.less';
|
|
9
|
-
import { useEffect } from "react";
|
|
10
4
|
|
|
11
5
|
/**
|
|
12
6
|
* 控制室 - 操作记录 - 事件内容详情
|
|
13
7
|
* @returns {JSX.Element}
|
|
14
8
|
*/
|
|
15
9
|
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
);
|
|
10
|
+
const DetailContent = ({ content }) => {
|
|
11
|
+
const isJsx = React.isValidElement(content);
|
|
12
|
+
return isJsx
|
|
13
|
+
? <div className={styles.content}>{content}</div>
|
|
14
|
+
: <div className={styles.content} dangerouslySetInnerHTML={{ __html: content }} />;
|
|
57
15
|
};
|
|
58
16
|
|
|
59
17
|
const ShowDetail = (props = {}) => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
)
|
|
18
|
+
const { title, content } = props;
|
|
19
|
+
return showModal({
|
|
20
|
+
title: title || '详情',
|
|
21
|
+
width: 720,
|
|
22
|
+
maskClosable: true,
|
|
23
|
+
content: (
|
|
24
|
+
<DetailContent content={content} />
|
|
25
|
+
),
|
|
26
|
+
modalProps: {
|
|
27
|
+
footer: false,
|
|
28
|
+
keyboard: true,
|
|
29
|
+
},
|
|
68
30
|
});
|
|
69
31
|
};
|
|
32
|
+
|
|
70
33
|
export default ShowDetail;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-ignore
|
|
2
2
|
import React from 'react';
|
|
3
3
|
// @ts-ignore
|
|
4
|
-
import ReactJson from 'react18-json-view'
|
|
4
|
+
// import ReactJson from 'react18-json-view'
|
|
5
5
|
// import 'react18-json-view/src/style.css'
|
|
6
6
|
// @ts-ignore
|
|
7
7
|
import {Tooltip} from '@/components/antd';
|
|
@@ -22,7 +22,12 @@ export const DebugTableItem=(props)=>{
|
|
|
22
22
|
return props.children
|
|
23
23
|
}
|
|
24
24
|
const {children,item={}} = props;
|
|
25
|
-
return <Tooltip trigger='click' overlayClassName={styles.jsonView} color='white'
|
|
25
|
+
return <Tooltip trigger='click' overlayClassName={styles.jsonView} color='white'
|
|
26
|
+
// title={
|
|
27
|
+
// <div className={styles.jsonView}>
|
|
28
|
+
// <ReactJson src={item} />
|
|
29
|
+
// </div>}
|
|
30
|
+
>
|
|
26
31
|
{children}
|
|
27
32
|
</Tooltip>
|
|
28
33
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
|
-
import ReactDOM from 'react-dom';
|
|
4
3
|
|
|
5
4
|
const ErrorBoundary = props => {
|
|
6
5
|
const {children}= props;
|
|
@@ -13,10 +12,6 @@ const ErrorBoundary = props => {
|
|
|
13
12
|
if (error.name.toLowerCase() =='ChunkLoadError'.toLowerCase() ) {
|
|
14
13
|
setHasError(true);
|
|
15
14
|
onReload()
|
|
16
|
-
// ReactDOM.render(<h1>站点已更新,即将重新加载...</h1>, document.getElementById('main-view'));
|
|
17
|
-
// setTimeout(()=>{
|
|
18
|
-
// onReload()
|
|
19
|
-
// },2000)
|
|
20
15
|
}
|
|
21
16
|
};
|
|
22
17
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import styles from './index.module.less';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export const ExpandIcon=props=>{
|
|
9
|
+
const {expanded,onClick,className=''} = props;
|
|
10
|
+
if(expanded){
|
|
11
|
+
return <i className={`${styles.expanded} ${className}`} data-state='close' onClick={onClick} />
|
|
12
|
+
}
|
|
13
|
+
return <i className={`${styles.expanded} ${className}`} onClick={onClick} />;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export default ExpandIcon;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
.expanded{
|
|
4
|
+
display: inline-block;
|
|
5
|
+
background-image: url('~@/assets/images/expand.png');
|
|
6
|
+
background-size:100% 100%;
|
|
7
|
+
width: 20px;
|
|
8
|
+
height: 20px;
|
|
9
|
+
transition: background .3s ease-in-out;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
&:hover{
|
|
14
|
+
background-image: url('~@/assets/images/expand-hover.png');
|
|
15
|
+
}
|
|
16
|
+
&[data-state='close']{
|
|
17
|
+
background-image: url('~@/assets/images/unexpand.png');
|
|
18
|
+
&:hover{
|
|
19
|
+
background-image: url('~@/assets/images/unexpand-hover.png');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import styles from './index.module.less';
|
|
6
|
+
|
|
7
|
+
export const FullSizeIcon=props=>{
|
|
8
|
+
const {full=false,onClick,className=''} = props;
|
|
9
|
+
return <div className={`${styles.fullSize} ${className}`} onClick={onClick} ><i className={`${styles.icon}`} data-full={full} /></div>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export default FullSizeIcon;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
.fullSize{
|
|
4
|
+
position: relative;
|
|
5
|
+
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
width: 32px;
|
|
11
|
+
height: 32px;
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
border:1px solid #ccc;
|
|
14
|
+
|
|
15
|
+
.icon{
|
|
16
|
+
display: inline-block;
|
|
17
|
+
background-image: url('~@/assets/images/icon-full-size.png');
|
|
18
|
+
background-size:100% 100%;
|
|
19
|
+
width: 20px;
|
|
20
|
+
height: 20px;
|
|
21
|
+
&[data-full='true']{
|
|
22
|
+
background-image: url('~@/assets/images/icon-resize.png');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
import PlayVideo from "@/components/icon/playVideo";
|
|
3
|
+
export {PlayVideo};
|
|
4
|
+
|
|
5
|
+
import ExpandIcon from "@/components/icon/expand";
|
|
6
|
+
export {ExpandIcon};
|
|
7
|
+
|
|
8
|
+
import FullSizeIcon from "@/components/icon/fullSize";
|
|
9
|
+
export {FullSizeIcon};
|
|
3
10
|
|
|
4
11
|
import {
|
|
5
12
|
InfoCircleFilled,
|
|
@@ -124,5 +131,4 @@ export {
|
|
|
124
131
|
* @property {string} [className]
|
|
125
132
|
*/
|
|
126
133
|
|
|
127
|
-
export {PlayVideo};
|
|
128
134
|
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { Image,Button,Space } from '@/components/antd';
|
|
3
3
|
import { CloseOutlined } from '@ant-design/icons';
|
|
4
|
-
import
|
|
4
|
+
import showPopup from '@/components/popup';
|
|
5
5
|
// @ts-ignore
|
|
6
6
|
import styles from './index.module.less';
|
|
7
|
-
import { ReactRender } from '@/components/react';
|
|
8
7
|
|
|
9
8
|
const ModalPreview = (props) => {
|
|
10
|
-
const {
|
|
9
|
+
const { close, data=[] } = props;
|
|
11
10
|
const [current,setCurrent] = useState(0);
|
|
12
11
|
|
|
13
12
|
const onCancel = () => {
|
|
14
|
-
|
|
13
|
+
close && close();
|
|
15
14
|
};
|
|
16
15
|
const prePage = (e)=>{
|
|
17
16
|
e.stopPropagation();
|
|
@@ -74,12 +73,10 @@ const ModalPreview = (props) => {
|
|
|
74
73
|
};
|
|
75
74
|
|
|
76
75
|
const ShowPreview = (props = {}) => {
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
popup.dom
|
|
82
|
-
);
|
|
76
|
+
return showPopup({
|
|
77
|
+
content: <ModalPreview {...props} />,
|
|
78
|
+
showMask: false,
|
|
79
|
+
closeOnClick: false,
|
|
83
80
|
});
|
|
84
81
|
};
|
|
85
82
|
export default ShowPreview;
|