@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/Table/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import React, { useRef, useEffect, useState, useCallback } from 'react';
|
|
|
3
3
|
import { ProTable } from '@ant-design/pro-components';
|
|
4
4
|
import './index.less';
|
|
5
5
|
import { antPrefix } from './utils';
|
|
6
|
-
|
|
6
|
+
function TablePro(props) {
|
|
7
7
|
const prefix = antPrefix || 'ant';
|
|
8
8
|
const baseCls = `.${prefix}-table`;
|
|
9
9
|
const ref = useRef(null);
|
|
@@ -12,6 +12,9 @@ export default function TablePro(props) {
|
|
|
12
12
|
const tableFooterCls = `${baseCls}-footer`;
|
|
13
13
|
const {
|
|
14
14
|
enableAutoScrollY = true,
|
|
15
|
+
rowKey,
|
|
16
|
+
columns,
|
|
17
|
+
scroll,
|
|
15
18
|
options = {
|
|
16
19
|
reload: false,
|
|
17
20
|
density: true,
|
|
@@ -25,6 +28,23 @@ export default function TablePro(props) {
|
|
|
25
28
|
...restProps
|
|
26
29
|
} = props;
|
|
27
30
|
const [scrollY, setScrollY] = useState(undefined);
|
|
31
|
+
|
|
32
|
+
// 1. rowKey 兜底处理:如果没有 rowKey,使用数据索引下标
|
|
33
|
+
const finalRowKey = rowKey || ((record, index) => index);
|
|
34
|
+
|
|
35
|
+
// 3. scroll 处理:如果没有 scroll,设置 scroll={{ x: 1000 }},注意要合并 y 值
|
|
36
|
+
const finalScroll = React.useMemo(() => {
|
|
37
|
+
const baseScroll = scroll || {
|
|
38
|
+
x: 1000
|
|
39
|
+
};
|
|
40
|
+
if (enableAutoScrollY) {
|
|
41
|
+
return {
|
|
42
|
+
...baseScroll,
|
|
43
|
+
y: scrollY || 0
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return baseScroll;
|
|
47
|
+
}, [scroll, enableAutoScrollY, scrollY]);
|
|
28
48
|
const timerRef = useRef(null);
|
|
29
49
|
const calcTableScrollY = () => {
|
|
30
50
|
const tableBody = ref.current?.querySelector?.(tableBodyCls);
|
|
@@ -34,7 +54,7 @@ export default function TablePro(props) {
|
|
|
34
54
|
const tablePagination = ref.current?.querySelector?.(tablePaginationCls);
|
|
35
55
|
const tablePaginationRect = tablePagination?.getBoundingClientRect();
|
|
36
56
|
const tableFooterHeight = tableFooterRect?.height || 0;
|
|
37
|
-
const tablePaginationMargin = 16;
|
|
57
|
+
const tablePaginationMargin = 16 * 2;
|
|
38
58
|
const tablePaginationHeight = tablePaginationRect?.height || 0;
|
|
39
59
|
const border = 2;
|
|
40
60
|
const margin = 20;
|
|
@@ -54,46 +74,45 @@ export default function TablePro(props) {
|
|
|
54
74
|
}, []);
|
|
55
75
|
useEffect(() => {
|
|
56
76
|
if (!ref.current || !enableAutoScrollY) return;
|
|
57
|
-
|
|
58
77
|
// 创建 ResizeObserver 监听元素尺寸变化
|
|
59
|
-
const
|
|
78
|
+
const resizeObserver1 = new ResizeObserver(() => {
|
|
60
79
|
// 等待 table-pagination 元素生成后再计算
|
|
61
80
|
debouncedCalcScrollY();
|
|
62
81
|
});
|
|
63
82
|
const mutationObserver = new MutationObserver(() => {
|
|
64
83
|
debouncedCalcScrollY();
|
|
65
84
|
});
|
|
66
|
-
mutationObserver.observe(ref.current, {
|
|
85
|
+
mutationObserver.observe(ref.current.parentElement, {
|
|
67
86
|
childList: true,
|
|
68
87
|
subtree: true,
|
|
69
88
|
attributes: true
|
|
70
89
|
});
|
|
71
90
|
|
|
72
91
|
// 开始观察 ref.current 的尺寸变化
|
|
73
|
-
|
|
92
|
+
resizeObserver1.observe(ref.current);
|
|
74
93
|
return () => {
|
|
75
94
|
if (timerRef.current) {
|
|
76
95
|
clearTimeout(timerRef.current);
|
|
77
96
|
}
|
|
78
|
-
|
|
97
|
+
resizeObserver1.disconnect();
|
|
79
98
|
mutationObserver.disconnect();
|
|
80
99
|
};
|
|
81
100
|
}, [ref, enableAutoScrollY, debouncedCalcScrollY]);
|
|
82
101
|
return /*#__PURE__*/React.createElement("div", {
|
|
83
|
-
ref: ref
|
|
84
|
-
style: {
|
|
85
|
-
height: '100%'
|
|
86
|
-
}
|
|
102
|
+
ref: ref
|
|
87
103
|
}, /*#__PURE__*/React.createElement(ProTable, _extends({
|
|
88
104
|
ghost: true,
|
|
105
|
+
bordered: true,
|
|
106
|
+
defaultSize: "default",
|
|
89
107
|
columnEmptyText: true,
|
|
90
108
|
search: false,
|
|
91
|
-
scroll:
|
|
92
|
-
|
|
93
|
-
} : undefined,
|
|
109
|
+
scroll: finalScroll,
|
|
110
|
+
rowKey: finalRowKey,
|
|
94
111
|
className: `${antPrefix}-gbs-pro-table`,
|
|
95
112
|
options: options
|
|
96
113
|
}, restProps, {
|
|
97
|
-
columns:
|
|
114
|
+
columns: columns
|
|
98
115
|
})));
|
|
99
|
-
}
|
|
116
|
+
}
|
|
117
|
+
TablePro.displayName = 'TablePro';
|
|
118
|
+
export default TablePro;
|
package/TableAction/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { tools } from '@cqsjjb/jjb-common-lib';
|
|
3
2
|
import { Dropdown, Space } from 'antd';
|
|
4
|
-
|
|
3
|
+
import { EllipsisOutlined } from '@ant-design/icons';
|
|
4
|
+
function TableAction({
|
|
5
5
|
maximum = 3,
|
|
6
6
|
children,
|
|
7
7
|
space,
|
|
8
|
+
enabledIcon = true,
|
|
8
9
|
placement = 'bottomRight',
|
|
9
10
|
// 下拉菜单位置,默认 bottomRight
|
|
10
11
|
trigger = ['hover'] // 下拉触发方式,默认 hover
|
|
11
12
|
}) {
|
|
12
13
|
// 将 children 统一成数组并过滤空值
|
|
13
|
-
const childArray = (
|
|
14
|
+
const childArray = (Array.isArray(children) ? children : [].concat(children)).filter(Boolean);
|
|
14
15
|
const showArray = childArray.slice(0, maximum);
|
|
15
16
|
const hideArray = childArray.slice(maximum);
|
|
16
17
|
return /*#__PURE__*/React.createElement(Space, {
|
|
@@ -22,7 +23,9 @@ export default function TableAction({
|
|
|
22
23
|
label: child
|
|
23
24
|
}))
|
|
24
25
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, /*#__PURE__*/React.createElement("a", null, "\u66F4\u591A")));
|
|
28
|
-
}
|
|
26
|
+
trigger: trigger,
|
|
27
|
+
placement: placement
|
|
28
|
+
}, /*#__PURE__*/React.createElement("a", null, enabledIcon ? /*#__PURE__*/React.createElement(EllipsisOutlined, null) : /*#__PURE__*/React.createElement("span", null, "\u66F4\u591A"))));
|
|
29
|
+
}
|
|
30
|
+
TableAction.displayName = 'TableAction';
|
|
31
|
+
export default TableAction;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cqsjjb/jjb-react-admin-component",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.11",
|
|
4
4
|
"description": "jjb-react-admin-组件库@new",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "jjb-front-team",
|
|
@@ -13,12 +13,10 @@
|
|
|
13
13
|
"@ant-design/pro-layout": "latest",
|
|
14
14
|
"@cqsjjb-formily/renderer": "latest",
|
|
15
15
|
"@wangeditor-next/editor": "latest",
|
|
16
|
-
"axios": "^1.6.5",
|
|
17
16
|
"cropperjs": "^1.6.2",
|
|
18
17
|
"lodash": "^4.17.21",
|
|
19
18
|
"react-cropper": "2.3.3",
|
|
20
19
|
"spark-md5": "^3.0.2",
|
|
21
|
-
"styled-components": "^6.1.19"
|
|
22
|
-
"use-antd-resizable-header": "latest"
|
|
20
|
+
"styled-components": "^6.1.19"
|
|
23
21
|
}
|
|
24
22
|
}
|
package/tools/index.js
CHANGED
|
@@ -71,7 +71,7 @@ export function isHttpUrl(v) {
|
|
|
71
71
|
* @return {string}
|
|
72
72
|
*/
|
|
73
73
|
export function getPrefixCls() {
|
|
74
|
-
return
|
|
74
|
+
return process?.env?.app?.antd['ant-prefix'] || 'ant';
|
|
75
75
|
}
|
|
76
76
|
export function getAlgorithm() {
|
|
77
77
|
const value = document.documentElement.style.getPropertyValue(
|