@cqsjjb/jjb-react-admin-component 3.3.9 → 3.3.11
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/AMap/index.js +4 -2
- package/AdaptiveTree/index.js +107 -103
- package/BMap/index.js +6 -0
- package/ControlWrapper/index.js +11 -0
- package/Editor/index.js +1 -0
- package/ErrorBoundary/index.js +5 -3
- package/FileUploader/index.js +36 -35
- package/FormilyDescriptions/index.js +13 -3
- package/FormilyRenderer/index.js +1 -0
- package/ImageCropper/index.js +1 -0
- package/ImageUploader/index.js +1 -0
- package/Layout/README.md +41 -0
- package/Layout/index.d.ts +81 -0
- package/Layout/index.js +99 -0
- package/Layout/index.less +112 -0
- package/ListDataContainer/index.js +47 -48
- package/MediaQuery/index.js +9 -2
- package/PageLayout/index.js +11 -6
- package/PhoneBox/index.js +23 -21
- package/SearchForm/index.js +20 -11
- package/Table/index.js +35 -16
- package/TableAction/index.js +10 -7
- package/package.json +2 -4
- package/tools/index.js +1 -1
package/AMap/index.js
CHANGED
|
@@ -6,7 +6,7 @@ const _A_MAP_DEFAULT_POINT_ = {
|
|
|
6
6
|
lng: 116.397437,
|
|
7
7
|
lat: 39.909148
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
function AMap({
|
|
10
10
|
lng: propLng,
|
|
11
11
|
lat: propLat,
|
|
12
12
|
title = '高德地图',
|
|
@@ -369,4 +369,6 @@ export default function AMap({
|
|
|
369
369
|
status: "error",
|
|
370
370
|
title: "\u52A0\u8F7D\u5730\u56FE\u5931\u8D25\uFF0C\u7F3A\u5C11\u5FC5\u8981\u7684\u6587\u4EF6\uFF01"
|
|
371
371
|
}));
|
|
372
|
-
}
|
|
372
|
+
}
|
|
373
|
+
AMap.displayName = 'AMap';
|
|
374
|
+
export default AMap;
|
package/AdaptiveTree/index.js
CHANGED
|
@@ -1,113 +1,115 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
/**
|
|
3
|
-
* 自适应树组件
|
|
4
|
-
* @param {Object} props - 组件属性
|
|
5
|
-
* @param {Function} [props.titleAction] - 节点操作按钮生成函数
|
|
6
|
-
* @param {Object} node - 当前节点数据
|
|
7
|
-
* @returns {Array} 操作按钮配置数组,每项包含:
|
|
8
|
-
* @property {ReactNode} content - 按钮内容(文本或元素)
|
|
9
|
-
* @property {Function} onClick - 点击事件回调
|
|
10
|
-
* @param {Function} [props.titleIcon] - 节点标题图标生成函数
|
|
11
|
-
* @param {Object} node - 当前节点数据
|
|
12
|
-
* @returns {ReactNode} 图标元素(如 img、Icon 组件等)
|
|
13
|
-
*
|
|
14
|
-
* @note 说明:
|
|
15
|
-
* 1. 自动继承全局 Ant Design 前缀配置(window.process.env.app.antd['ant-prefix'])
|
|
16
|
-
* 2. 节点容器默认占满父元素空间,支持纵向滚动
|
|
17
|
-
* 3. 节点标题超长自动换行,且不会挤压标题图标和操作图标的空间
|
|
18
|
-
* 4. 节点选中时,返回的节点数据为当前节点及其所有父节点id(二维数组)、选中的节点数据(一维数组)
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* <AdaptiveTree
|
|
22
|
-
* treeData={[]}
|
|
23
|
-
* fieldNames={{
|
|
24
|
-
* title: 'name',
|
|
25
|
-
* key: 'id'
|
|
26
|
-
* }}
|
|
27
|
-
* titleAction={(node) => [
|
|
28
|
-
* {
|
|
29
|
-
* content: '添加',
|
|
30
|
-
* onClick: (node) => {
|
|
31
|
-
* console.warn("添加", node)
|
|
32
|
-
* }
|
|
33
|
-
* },
|
|
34
|
-
* {
|
|
35
|
-
* content: '编辑',
|
|
36
|
-
* onClick: (node) => {
|
|
37
|
-
* console.warn("编辑", node)
|
|
38
|
-
* }
|
|
39
|
-
* }
|
|
40
|
-
* ]}
|
|
41
|
-
* titleIcon={(node) => <FolderOpenOutlined />}
|
|
42
|
-
* />
|
|
43
|
-
*/
|
|
44
2
|
import React, { useState } from 'react';
|
|
45
|
-
import { Tree, Space } from "antd";
|
|
46
3
|
import { styled } from 'styled-components';
|
|
47
|
-
|
|
4
|
+
import { Tree, Space } from 'antd';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 自适应树组件
|
|
8
|
+
* @param {Object} props - 组件属性
|
|
9
|
+
* @param {Function} [props.titleAction] - 节点操作按钮生成函数
|
|
10
|
+
* @param {Object} node - 当前节点数据
|
|
11
|
+
* @returns {Array} 操作按钮配置数组,每项包含:
|
|
12
|
+
* @property {ReactNode} content - 按钮内容(文本或元素)
|
|
13
|
+
* @property {Function} onClick - 点击事件回调
|
|
14
|
+
* @param {Function} [props.titleIcon] - 节点标题图标生成函数
|
|
15
|
+
* @param {Object} node - 当前节点数据
|
|
16
|
+
* @returns {ReactNode} 图标元素(如 img、Icon 组件等)
|
|
17
|
+
*
|
|
18
|
+
* @note 说明:
|
|
19
|
+
* 1. 自动继承全局 Ant Design 前缀配置(window.process.env.app.antd['ant-prefix'])
|
|
20
|
+
* 2. 节点容器默认占满父元素空间,支持纵向滚动
|
|
21
|
+
* 3. 节点标题超长自动换行,且不会挤压标题图标和操作图标的空间
|
|
22
|
+
* 4. 节点选中时,返回的节点数据为当前节点及其所有父节点id(二维数组)、选中的节点数据(一维数组)
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* <AdaptiveTree
|
|
26
|
+
* treeData={[]}
|
|
27
|
+
* fieldNames={{
|
|
28
|
+
* title: 'name',
|
|
29
|
+
* key: 'id'
|
|
30
|
+
* }}
|
|
31
|
+
* titleAction={(node) => [
|
|
32
|
+
* {
|
|
33
|
+
* content: '添加',
|
|
34
|
+
* onClick: (node) => {
|
|
35
|
+
* console.warn("添加", node)
|
|
36
|
+
* }
|
|
37
|
+
* },
|
|
38
|
+
* {
|
|
39
|
+
* content: '编辑',
|
|
40
|
+
* onClick: (node) => {
|
|
41
|
+
* console.warn("编辑", node)
|
|
42
|
+
* }
|
|
43
|
+
* }
|
|
44
|
+
* ]}
|
|
45
|
+
* titleIcon={(node) => <FolderOpenOutlined />}
|
|
46
|
+
* />
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
function AdaptiveTree(props) {
|
|
48
50
|
const {
|
|
49
51
|
titleAction,
|
|
50
52
|
titleIcon,
|
|
51
53
|
draggable,
|
|
52
54
|
...rest
|
|
53
55
|
} = props;
|
|
54
|
-
const prefixCls =
|
|
56
|
+
const prefixCls = process.env.app.antd['ant-prefix'];
|
|
55
57
|
const [expandedKeys, setExpandedKeys] = useState([]);
|
|
56
58
|
const [selectedKeys, setSelectedKeys] = useState([]);
|
|
57
59
|
const StyledAntdComponents = styled.div`
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
.operation {
|
|
106
|
-
cursor: pointer;
|
|
107
|
-
white-space: nowrap;
|
|
108
|
-
}
|
|
60
|
+
.${prefixCls}-tree {
|
|
61
|
+
width: 100%;
|
|
62
|
+
height: 100%;
|
|
63
|
+
overflow-y: auto;
|
|
64
|
+
}
|
|
65
|
+
.${prefixCls}-tree-switcher {
|
|
66
|
+
align-items: flex-start !important;
|
|
67
|
+
padding-top: 13px;
|
|
68
|
+
}
|
|
69
|
+
.${prefixCls}-tree-checkbox {
|
|
70
|
+
margin-top: 11px;
|
|
71
|
+
margin-left: 4px;
|
|
72
|
+
align-self: flex-start;
|
|
73
|
+
}
|
|
74
|
+
.${prefixCls}-tree-treenode {
|
|
75
|
+
width: 100%;
|
|
76
|
+
display: flex;
|
|
77
|
+
.${prefixCls}-tree-node-content-wrapper {
|
|
78
|
+
flex: 1;
|
|
79
|
+
}
|
|
80
|
+
.${prefixCls}-tree-switcher {
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
justify-content: flex-end;
|
|
84
|
+
}
|
|
85
|
+
.${prefixCls}-tree-switcher::before {
|
|
86
|
+
display: none;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
.adaptive-tree-title {
|
|
90
|
+
width: 100%;
|
|
91
|
+
display: flex;
|
|
92
|
+
justify-content: space-between;
|
|
93
|
+
gap: 8px;
|
|
94
|
+
align-items: flex-start;
|
|
95
|
+
padding: 6px 0;
|
|
96
|
+
transition: none;
|
|
97
|
+
cursor: ${props?.draggable ? 'grab' : 'point'};
|
|
98
|
+
.title-left {
|
|
99
|
+
display: flex;
|
|
100
|
+
align-items: flex-start;
|
|
101
|
+
gap: 2px;
|
|
102
|
+
.icon {
|
|
103
|
+
width: 14px;
|
|
104
|
+
height: 14px;
|
|
109
105
|
}
|
|
110
|
-
|
|
106
|
+
}
|
|
107
|
+
.operation {
|
|
108
|
+
cursor: pointer;
|
|
109
|
+
white-space: nowrap;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
`;
|
|
111
113
|
|
|
112
114
|
// 获得指定索引的节点 ID
|
|
113
115
|
const getLevelIndexNodeIds = (targetIndexArr, key) => {
|
|
@@ -146,7 +148,7 @@ export default props => {
|
|
|
146
148
|
ids.push(result[0]);
|
|
147
149
|
nodes.push(result[1]);
|
|
148
150
|
});
|
|
149
|
-
console.warn(
|
|
151
|
+
console.warn('onCheck', ids, nodes);
|
|
150
152
|
props?.onCheck && props.onCheck(ids, nodes, info);
|
|
151
153
|
};
|
|
152
154
|
const titleRender = node => {
|
|
@@ -158,8 +160,8 @@ export default props => {
|
|
|
158
160
|
key: 'key'
|
|
159
161
|
};
|
|
160
162
|
return /*#__PURE__*/React.createElement("div", {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
+
key: node[key],
|
|
164
|
+
className: "adaptive-tree-title"
|
|
163
165
|
}, /*#__PURE__*/React.createElement("div", {
|
|
164
166
|
className: "title-left"
|
|
165
167
|
}, titleIcon ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -170,12 +172,12 @@ export default props => {
|
|
|
170
172
|
}
|
|
171
173
|
}, node[title])), /*#__PURE__*/React.createElement(Space, null, titleAction ? (titleAction(node) || []).map(item => {
|
|
172
174
|
return /*#__PURE__*/React.createElement("div", {
|
|
175
|
+
className: "operation",
|
|
173
176
|
onClick: e => {
|
|
174
177
|
e.stopPropagation();
|
|
175
178
|
e.preventDefault();
|
|
176
179
|
item.onClick && item.onClick(node);
|
|
177
|
-
}
|
|
178
|
-
className: "operation"
|
|
180
|
+
}
|
|
179
181
|
}, item?.content || '');
|
|
180
182
|
}) : ''));
|
|
181
183
|
};
|
|
@@ -198,4 +200,6 @@ export default props => {
|
|
|
198
200
|
selectedKeys: props?.selectedKeys || selectedKeys,
|
|
199
201
|
onSelect: onSelect
|
|
200
202
|
}, rest)));
|
|
201
|
-
}
|
|
203
|
+
}
|
|
204
|
+
AdaptiveTree.displayName = 'AdaptiveTree';
|
|
205
|
+
export default AdaptiveTree;
|
package/BMap/index.js
CHANGED
|
@@ -19,6 +19,11 @@ const BMap = ({
|
|
|
19
19
|
const GL = useRef(null);
|
|
20
20
|
const mapRef = useRef(null);
|
|
21
21
|
|
|
22
|
+
/** 显示弃用警告 */
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
console.warn('[BMap] 警告:该组件已弃用!请使用<AMap />组件替代!');
|
|
25
|
+
}, []);
|
|
26
|
+
|
|
22
27
|
/** 初始化地图 */
|
|
23
28
|
useEffect(() => {
|
|
24
29
|
if (typeof window.BMapGL === 'undefined') {
|
|
@@ -164,4 +169,5 @@ const BMap = ({
|
|
|
164
169
|
title: "\u52A0\u8F7D\u5730\u56FE\u5931\u8D25\uFF0C\u7F3A\u5C11\u5FC5\u8981\u7684\u6587\u4EF6\uFF01"
|
|
165
170
|
}));
|
|
166
171
|
};
|
|
172
|
+
BMap.displayName = 'BMap';
|
|
167
173
|
export default BMap;
|
package/ControlWrapper/index.js
CHANGED
|
@@ -33,29 +33,40 @@ function withLabel(WrappedComponent, extraProps = {}) {
|
|
|
33
33
|
|
|
34
34
|
// ============ 输入类 ============
|
|
35
35
|
const Input = withLabel(OriginInput);
|
|
36
|
+
Input.displayName = 'ControlWrapper.Input';
|
|
36
37
|
|
|
37
38
|
// ============ 选择类 ============
|
|
38
39
|
const Select = withLabel(OriginSelect, {
|
|
39
40
|
maxTagCount: 3
|
|
40
41
|
});
|
|
42
|
+
Select.displayName = 'ControlWrapper.Select';
|
|
41
43
|
const Cascader = withLabel(OriginCascader, {
|
|
42
44
|
maxTagCount: 3
|
|
43
45
|
});
|
|
46
|
+
Cascader.displayName = 'ControlWrapper.Cascader';
|
|
44
47
|
const TreeSelect = withLabel(OriginTreeSelect, {
|
|
45
48
|
showSearch: true,
|
|
46
49
|
allowClear: true,
|
|
47
50
|
showCheckedStrategy: OriginTreeSelect.SHOW_PARENT,
|
|
48
51
|
treeNodeFilterProp: 'title'
|
|
49
52
|
});
|
|
53
|
+
TreeSelect.displayName = 'ControlWrapper.TreeSelect';
|
|
50
54
|
|
|
51
55
|
// ============ 日期类 ============
|
|
52
56
|
const DatePicker = withLabel(OriginDatePicker);
|
|
57
|
+
DatePicker.displayName = 'ControlWrapper.DatePicker';
|
|
53
58
|
DatePicker.RangePicker = withLabel(OriginDatePicker.RangePicker);
|
|
59
|
+
DatePicker.RangePicker.displayName = 'ControlWrapper.RangePicker';
|
|
54
60
|
DatePicker.TimePicker = withLabel(OriginDatePicker.TimePicker);
|
|
61
|
+
DatePicker.TimePicker.displayName = 'ControlWrapper.TimePicker';
|
|
55
62
|
DatePicker.WeekPicker = withLabel(OriginDatePicker.WeekPicker);
|
|
63
|
+
DatePicker.WeekPicker.displayName = 'ControlWrapper.WeekPicker';
|
|
56
64
|
DatePicker.MonthPicker = withLabel(OriginDatePicker.MonthPicker);
|
|
65
|
+
DatePicker.MonthPicker.displayName = 'ControlWrapper.MonthPicker';
|
|
57
66
|
DatePicker.QuarterPicker = withLabel(OriginDatePicker.QuarterPicker);
|
|
67
|
+
DatePicker.QuarterPicker.displayName = 'ControlWrapper.QuarterPicker';
|
|
58
68
|
DatePicker.YearPicker = withLabel(OriginDatePicker.YearPicker);
|
|
69
|
+
DatePicker.YearPicker.displayName = 'ControlWrapper.YearPicker';
|
|
59
70
|
export default {
|
|
60
71
|
Input,
|
|
61
72
|
Select,
|
package/Editor/index.js
CHANGED
package/ErrorBoundary/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Result } from 'antd';
|
|
3
|
-
|
|
3
|
+
class ErrorBoundary extends React.Component {
|
|
4
4
|
state = {
|
|
5
5
|
hasError: false,
|
|
6
6
|
errorInfo: '',
|
|
@@ -16,8 +16,8 @@ export default class ErrorBoundary extends React.Component {
|
|
|
16
16
|
render() {
|
|
17
17
|
if (this.state.hasError) {
|
|
18
18
|
return /*#__PURE__*/React.createElement(Result, {
|
|
19
|
-
status: "error",
|
|
20
19
|
title: "\u62B1\u6B49\uFF0C\u5E94\u7528\u5185\u90E8\u53D1\u751F\u5F02\u5E38\u9519\u8BEF\u3002",
|
|
20
|
+
status: "error",
|
|
21
21
|
subTitle: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, this.state.errorInfo), /*#__PURE__*/React.createElement("div", {
|
|
22
22
|
style: {
|
|
23
23
|
width: 700,
|
|
@@ -32,4 +32,6 @@ export default class ErrorBoundary extends React.Component {
|
|
|
32
32
|
}
|
|
33
33
|
return this.props.children;
|
|
34
34
|
}
|
|
35
|
-
}
|
|
35
|
+
}
|
|
36
|
+
ErrorBoundary.displayName = 'ErrorBoundary';
|
|
37
|
+
export default ErrorBoundary;
|
package/FileUploader/index.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
2
|
import MD5 from 'spark-md5';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import { tools } from '@cqsjjb/jjb-common-lib';
|
|
4
5
|
import { Tooltip, Button, message } from 'antd';
|
|
5
6
|
import { DeleteOutlined, PaperClipOutlined } from '@ant-design/icons';
|
|
6
|
-
import { getAppKey, getToken, isHttpUrl } from '../tools/index.js';
|
|
7
|
-
import { tools } from '@cqsjjb/jjb-common-lib';
|
|
8
7
|
import './index.less';
|
|
8
|
+
import { getAppKey, getToken, isHttpUrl, getAntPrefix } from '../tools/index.js';
|
|
9
9
|
const {
|
|
10
10
|
toObject,
|
|
11
11
|
isPromise,
|
|
12
12
|
isFunction,
|
|
13
13
|
parseObject
|
|
14
14
|
} = tools;
|
|
15
|
-
const prefixCls =
|
|
15
|
+
const prefixCls = getAntPrefix();
|
|
16
16
|
class FileUploader extends React.Component {
|
|
17
17
|
state = {
|
|
18
18
|
loading: false
|
|
19
19
|
};
|
|
20
20
|
inputFile = /*#__PURE__*/React.createRef();
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* @description http配置
|
|
24
|
-
* @returns {{headers: object, fieldName: string, data: object, action: string, url: string}}
|
|
22
|
+
/**
|
|
23
|
+
* @description http配置
|
|
24
|
+
* @returns {{headers: object, fieldName: string, data: object, action: string, url: string}}
|
|
25
25
|
*/
|
|
26
26
|
get httpConfig() {
|
|
27
27
|
const {
|
|
@@ -46,9 +46,9 @@ class FileUploader extends React.Component {
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
/**
|
|
50
|
-
* @description 填充值
|
|
51
|
-
* @returns {string[]}
|
|
49
|
+
/**
|
|
50
|
+
* @description 填充值
|
|
51
|
+
* @returns {string[]}
|
|
52
52
|
*/
|
|
53
53
|
get value() {
|
|
54
54
|
const {
|
|
@@ -57,9 +57,9 @@ class FileUploader extends React.Component {
|
|
|
57
57
|
return Array.isArray(value) ? value : value ? [value] : [];
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
/**
|
|
61
|
-
* @description 获取禁用状态
|
|
62
|
-
* @return {boolean}
|
|
60
|
+
/**
|
|
61
|
+
* @description 获取禁用状态
|
|
62
|
+
* @return {boolean}
|
|
63
63
|
*/
|
|
64
64
|
get disabled() {
|
|
65
65
|
const {
|
|
@@ -78,11 +78,11 @@ class FileUploader extends React.Component {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
/**
|
|
82
|
-
* @description 验证文件类型
|
|
83
|
-
* @param fileType {string}
|
|
84
|
-
* @param accept {string}
|
|
85
|
-
* @returns {Promise<never>|Promise<void>}
|
|
81
|
+
/**
|
|
82
|
+
* @description 验证文件类型
|
|
83
|
+
* @param fileType {string}
|
|
84
|
+
* @param accept {string}
|
|
85
|
+
* @returns {Promise<never>|Promise<void>}
|
|
86
86
|
*/
|
|
87
87
|
verifyFileAccept(fileType, accept) {
|
|
88
88
|
const {
|
|
@@ -110,11 +110,11 @@ class FileUploader extends React.Component {
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
/**
|
|
114
|
-
* @description 验证文件大小
|
|
115
|
-
* @param fileSize {number}
|
|
116
|
-
* @param maxSize {number}
|
|
117
|
-
* @returns {Promise<never>|Promise<void>}
|
|
113
|
+
/**
|
|
114
|
+
* @description 验证文件大小
|
|
115
|
+
* @param fileSize {number}
|
|
116
|
+
* @param maxSize {number}
|
|
117
|
+
* @returns {Promise<never>|Promise<void>}
|
|
118
118
|
*/
|
|
119
119
|
verifyFileSize(fileSize, maxSize) {
|
|
120
120
|
const {
|
|
@@ -137,10 +137,10 @@ class FileUploader extends React.Component {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
/**
|
|
141
|
-
* @description 发起上传请求
|
|
142
|
-
* @param file {File}
|
|
143
|
-
* @returns {Promise<{url: string, fileName: string, respDesc: string}>}
|
|
140
|
+
/**
|
|
141
|
+
* @description 发起上传请求
|
|
142
|
+
* @param file {File}
|
|
143
|
+
* @returns {Promise<{url: string, fileName: string, respDesc: string}>}
|
|
144
144
|
*/
|
|
145
145
|
onFormRequest(file) {
|
|
146
146
|
const {
|
|
@@ -196,9 +196,9 @@ class FileUploader extends React.Component {
|
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
/**
|
|
200
|
-
* @description 回调
|
|
201
|
-
* @param value {string}
|
|
199
|
+
/**
|
|
200
|
+
* @description 回调
|
|
201
|
+
* @param value {string}
|
|
202
202
|
*/
|
|
203
203
|
onChange(value) {
|
|
204
204
|
const {
|
|
@@ -207,17 +207,17 @@ class FileUploader extends React.Component {
|
|
|
207
207
|
onChange && onChange(value || undefined);
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
/**
|
|
211
|
-
* @description 删除
|
|
212
|
-
* @param sup {number}
|
|
210
|
+
/**
|
|
211
|
+
* @description 删除
|
|
212
|
+
* @param sup {number}
|
|
213
213
|
*/
|
|
214
214
|
onDelete(sup) {
|
|
215
215
|
this.onChange(this.props.multiple ? this.value.filter((_, sub) => sub !== sup) : undefined);
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
/**
|
|
219
|
-
* @description 上传
|
|
220
|
-
* @param target {{files: FileList, value: any}}
|
|
218
|
+
/**
|
|
219
|
+
* @description 上传
|
|
220
|
+
* @param target {{files: FileList, value: any}}
|
|
221
221
|
*/
|
|
222
222
|
onUpload({
|
|
223
223
|
target
|
|
@@ -301,6 +301,7 @@ class FileUploader extends React.Component {
|
|
|
301
301
|
}));
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
|
+
FileUploader.displayName = 'FileUploader';
|
|
304
305
|
export default FileUploader;
|
|
305
306
|
export const getValueProps = value => ({
|
|
306
307
|
value: value ? {
|
|
@@ -6,7 +6,7 @@ import { Modal, Descriptions, Empty, Image, Tooltip, Spin, Table, Space, TreeSel
|
|
|
6
6
|
const formilyItemMargin = new Map([['small', 8], ['middle', 12], ['default', 16]]);
|
|
7
7
|
const IS_PDF_REG = /\.pdf$/;
|
|
8
8
|
const IS_VIDEO_REG = /\.(mp4|ogg|mkv|webm)$/;
|
|
9
|
-
|
|
9
|
+
function FormilyDescriptions({
|
|
10
10
|
schema,
|
|
11
11
|
values,
|
|
12
12
|
...props
|
|
@@ -34,6 +34,8 @@ export default function FormilyDescriptions({
|
|
|
34
34
|
dataSource: dataSource
|
|
35
35
|
}, props));
|
|
36
36
|
}
|
|
37
|
+
FormilyDescriptions.displayName = 'FormilyDescriptions';
|
|
38
|
+
export default FormilyDescriptions;
|
|
37
39
|
export function DescriptionsRender({
|
|
38
40
|
dataSource,
|
|
39
41
|
size = 'default',
|
|
@@ -73,6 +75,7 @@ export function DescriptionsRender({
|
|
|
73
75
|
});
|
|
74
76
|
});
|
|
75
77
|
}
|
|
78
|
+
DescriptionsRender.displayName = 'DescriptionsRender';
|
|
76
79
|
export function ItemRender({
|
|
77
80
|
data,
|
|
78
81
|
imageWidth,
|
|
@@ -89,7 +92,7 @@ export function ItemRender({
|
|
|
89
92
|
};
|
|
90
93
|
const renderContent = () => {
|
|
91
94
|
const systemStyle = props.systemStyle ? props.systemStyle(data.fieldCode) : {};
|
|
92
|
-
if (
|
|
95
|
+
if (Array.isArray(data.value)) {
|
|
93
96
|
if (tools.isStringArray(data.value) || tools.isNumberArray(data.value)) {
|
|
94
97
|
return /*#__PURE__*/React.createElement("div", {
|
|
95
98
|
style: systemStyle
|
|
@@ -146,6 +149,7 @@ export function ItemRender({
|
|
|
146
149
|
height: 350
|
|
147
150
|
})));
|
|
148
151
|
}
|
|
152
|
+
ItemRender.displayName = 'ItemRender';
|
|
149
153
|
export function RenderText({
|
|
150
154
|
value,
|
|
151
155
|
name,
|
|
@@ -205,6 +209,7 @@ export function RenderText({
|
|
|
205
209
|
name
|
|
206
210
|
}) : tools.textPlaceholder(text));
|
|
207
211
|
}
|
|
212
|
+
RenderText.displayName = 'RenderText';
|
|
208
213
|
export function RenderFileItem(props) {
|
|
209
214
|
const {
|
|
210
215
|
isImage,
|
|
@@ -240,6 +245,7 @@ export function RenderFileItem(props) {
|
|
|
240
245
|
name: name
|
|
241
246
|
})));
|
|
242
247
|
}
|
|
248
|
+
RenderFileItem.displayName = 'RenderFileItem';
|
|
243
249
|
export function RenderImage({
|
|
244
250
|
url,
|
|
245
251
|
imageWidth,
|
|
@@ -268,6 +274,7 @@ export function RenderImage({
|
|
|
268
274
|
} : imagePreview
|
|
269
275
|
}));
|
|
270
276
|
}
|
|
277
|
+
RenderImage.displayName = 'RenderImage';
|
|
271
278
|
export function RenderValidFile({
|
|
272
279
|
url,
|
|
273
280
|
name,
|
|
@@ -284,6 +291,7 @@ export function RenderValidFile({
|
|
|
284
291
|
onClick: handleClick
|
|
285
292
|
}, /*#__PURE__*/React.createElement(FileOutlined, null), name);
|
|
286
293
|
}
|
|
294
|
+
RenderValidFile.displayName = 'RenderValidFile';
|
|
287
295
|
export function RenderInvalidFile({
|
|
288
296
|
url,
|
|
289
297
|
name
|
|
@@ -298,6 +306,7 @@ export function RenderInvalidFile({
|
|
|
298
306
|
}
|
|
299
307
|
}, /*#__PURE__*/React.createElement(LinkOutlined, null), name);
|
|
300
308
|
}
|
|
309
|
+
RenderInvalidFile.displayName = 'RenderInvalidFile';
|
|
301
310
|
export function RenderTable({
|
|
302
311
|
columns,
|
|
303
312
|
dataSource,
|
|
@@ -343,4 +352,5 @@ export function RenderTable({
|
|
|
343
352
|
dataSource: dataSource,
|
|
344
353
|
style: systemStyle
|
|
345
354
|
});
|
|
346
|
-
}
|
|
355
|
+
}
|
|
356
|
+
RenderTable.displayName = 'RenderTable';
|
package/FormilyRenderer/index.js
CHANGED
package/ImageCropper/index.js
CHANGED
package/ImageUploader/index.js
CHANGED
package/Layout/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
页面布局组件
|
|
2
|
+
|
|
3
|
+
## 代码演示
|
|
4
|
+
|
|
5
|
+
```jsx
|
|
6
|
+
import { useState } from 'react';
|
|
7
|
+
import { Button } from 'antd';
|
|
8
|
+
import PageLayout from '@cqsjjb/jjb-react-admin-component/PageLayout';
|
|
9
|
+
|
|
10
|
+
function App() {
|
|
11
|
+
return (
|
|
12
|
+
<PageLayout title="用户中心">
|
|
13
|
+
|
|
14
|
+
</PageLayout>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## API
|
|
20
|
+
|
|
21
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
22
|
+
|-----------------|:-----------|:---------------:|------:|
|
|
23
|
+
| title | 页面标题 | `string` | - |
|
|
24
|
+
| extra | 右上角扩展 | `ReactNode` | - |
|
|
25
|
+
| header | 自定义头部 | `ReactNode` | - |
|
|
26
|
+
| footer | 自定义底部 | `ReactNode` | - |
|
|
27
|
+
| history | 路由历史对象 | `History` | - |
|
|
28
|
+
| noStyle | 去除所有样式 | `boolean` | false |
|
|
29
|
+
| noBorder | 取消边框 | `boolean` | false |
|
|
30
|
+
| formLine | form 表单行 | `ReactNode[]` | - |
|
|
31
|
+
| formLineStyle | form 表单行样式 | `CSSProperties` | - |
|
|
32
|
+
| previous | 显示返回上一页 | `boolean` | false |
|
|
33
|
+
| transparent | 背景透明 | `boolean` | false |
|
|
34
|
+
| contentStyle | 内容区样式 | `CSSProperties` | - |
|
|
35
|
+
| footerStyle | 底部样式 | `CSSProperties` | - |
|
|
36
|
+
| pageHeaderStyle | 头部样式 | `CSSProperties` | - |
|
|
37
|
+
| style | 自定义返回事件 | `CSSProperties` | - |
|
|
38
|
+
| onBack | 容器样式 | `() => void` | - |
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
注意:`previous`为`true`时`history`必传,否则点击返回无效。
|