@cqsjjb/jjb-react-admin-component 3.3.10 → 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/PageLayout/index.less +2 -2
- package/PhoneBox/index.js +23 -21
- package/SearchForm/index.d.ts +1 -3
- package/SearchForm/index.js +92 -19
- package/Table/README.md +1 -1
- package/Table/index.d.ts +64 -17
- package/Table/index.js +98 -98
- package/Table/index.less +7 -5
- package/TableAction/index.js +10 -9
- package/package.json +2 -4
- package/tools/index.js +1 -1
package/SearchForm/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
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); }
|
|
1
2
|
import React, { useState, useRef, useEffect } from 'react';
|
|
2
3
|
import { Form, Button, Space, Row, Col } from 'antd';
|
|
3
4
|
import { SearchOutlined, DoubleRightOutlined, UndoOutlined } from '@ant-design/icons';
|
|
@@ -8,7 +9,6 @@ const SearchForm = ({
|
|
|
8
9
|
// 受控
|
|
9
10
|
defaultExpand = false,
|
|
10
11
|
// 内部默认展开
|
|
11
|
-
colSize = 3,
|
|
12
12
|
loading = false,
|
|
13
13
|
formLine = [],
|
|
14
14
|
initialValues = {},
|
|
@@ -17,16 +17,48 @@ const SearchForm = ({
|
|
|
17
17
|
onFinish = () => {},
|
|
18
18
|
onExpand
|
|
19
19
|
}) => {
|
|
20
|
-
|
|
21
|
-
const
|
|
20
|
+
// 如果外部没有传入 form,使用 Form.useForm() 创建实例
|
|
21
|
+
const [internalFormInstance] = Form.useForm();
|
|
22
|
+
const internalFormRef = useRef(internalFormInstance);
|
|
23
|
+
|
|
24
|
+
// 判断外部传入的是 ref 还是 form 实例
|
|
25
|
+
// ref 对象有 current 属性,form 实例没有
|
|
26
|
+
const isExternalRef = externalForm && 'current' in externalForm;
|
|
27
|
+
|
|
28
|
+
// 警告:ref 用法将在后续版本中移除
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (isExternalRef) {
|
|
31
|
+
console.warn('[SearchForm] 警告:通过 ref 传入 form 的方式已废弃,将在后续版本中移除。' + '请使用 Form.useForm() 创建 form 实例并直接传入,例如:\n' + ' const [form] = Form.useForm();\n' + ' <SearchForm form={form} />');
|
|
32
|
+
}
|
|
33
|
+
}, [isExternalRef]);
|
|
34
|
+
|
|
35
|
+
// 获取实际的 form 实例(兼容 ref 和直接传入实例两种情况)
|
|
36
|
+
const getFormInstance = () => {
|
|
37
|
+
if (externalForm) {
|
|
38
|
+
return isExternalRef ? externalForm.current : externalForm;
|
|
39
|
+
}
|
|
40
|
+
return internalFormInstance;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// 兼容性处理:用于 form.current 访问方式的 ref
|
|
44
|
+
const formRef = externalForm && isExternalRef ? externalForm : internalFormRef;
|
|
45
|
+
|
|
46
|
+
// 更新内部 ref,确保 formRef.current 始终指向正确的实例
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (!isExternalRef && externalForm) {
|
|
49
|
+
// 如果外部传入的是实例,将其赋值给内部 ref 的 current
|
|
50
|
+
internalFormRef.current = externalForm;
|
|
51
|
+
}
|
|
52
|
+
}, [externalForm, isExternalRef]);
|
|
22
53
|
const [internalOpen, setInternalOpen] = useState(defaultExpand);
|
|
23
54
|
useEffect(() => {
|
|
24
55
|
if (onRef) {
|
|
25
|
-
onRef(
|
|
56
|
+
onRef(formRef);
|
|
26
57
|
}
|
|
27
|
-
}, [
|
|
58
|
+
}, [formRef, onRef]);
|
|
28
59
|
const isControlled = expand !== undefined;
|
|
29
60
|
const isOpen = isControlled ? expand : internalOpen;
|
|
61
|
+
// 展开/收起
|
|
30
62
|
const handleToggle = () => {
|
|
31
63
|
if (isControlled) {
|
|
32
64
|
onExpand && onExpand(!expand);
|
|
@@ -41,16 +73,17 @@ const SearchForm = ({
|
|
|
41
73
|
const getButtons = () => /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Button, {
|
|
42
74
|
type: "primary",
|
|
43
75
|
icon: /*#__PURE__*/React.createElement(SearchOutlined, null),
|
|
44
|
-
|
|
45
|
-
|
|
76
|
+
loading: loading,
|
|
77
|
+
htmlType: "submit"
|
|
46
78
|
}, "\u67E5\u8BE2"), /*#__PURE__*/React.createElement(Button, {
|
|
47
79
|
icon: /*#__PURE__*/React.createElement(UndoOutlined, null),
|
|
48
80
|
loading: loading,
|
|
49
81
|
onClick: () => {
|
|
50
|
-
|
|
51
|
-
|
|
82
|
+
const formInstance = getFormInstance();
|
|
83
|
+
formInstance.resetFields();
|
|
84
|
+
onReset(formInstance.getFieldsValue());
|
|
52
85
|
}
|
|
53
|
-
}, "\u91CD\u7F6E"), formLine.length
|
|
86
|
+
}, "\u91CD\u7F6E"), formLine.length > 2 && /*#__PURE__*/React.createElement(Button, {
|
|
54
87
|
icon: /*#__PURE__*/React.createElement(DoubleRightOutlined, {
|
|
55
88
|
style: {
|
|
56
89
|
transform: isOpen ? 'rotate(-90deg)' : 'rotate(90deg)'
|
|
@@ -58,38 +91,78 @@ const SearchForm = ({
|
|
|
58
91
|
}),
|
|
59
92
|
onClick: handleToggle
|
|
60
93
|
}, isOpen ? '收起' : '展开'));
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 处理 formLine,确保所有 Form.Item 都有 noStyle 属性
|
|
97
|
+
* @param {ReactNode[]} nodes - 表单节点数组
|
|
98
|
+
* @returns {ReactNode[]} - 处理后的节点数组
|
|
99
|
+
*/
|
|
100
|
+
const processFormLine = nodes => {
|
|
101
|
+
return nodes.map(node => {
|
|
102
|
+
// 检查是否是 Form.Item 组件
|
|
103
|
+
if (/*#__PURE__*/React.isValidElement(node) && node.type === Form.Item) {
|
|
104
|
+
// 如果没有 noStyle 属性,则克隆并添加
|
|
105
|
+
const control = React.Children.only(node.props.children);
|
|
106
|
+
return /*#__PURE__*/React.cloneElement(node, {
|
|
107
|
+
noStyle: true,
|
|
108
|
+
children: /*#__PURE__*/React.cloneElement(control, {
|
|
109
|
+
style: {
|
|
110
|
+
...(control.props.style || {}),
|
|
111
|
+
width: '100%'
|
|
112
|
+
},
|
|
113
|
+
allowClear: true,
|
|
114
|
+
...control.props
|
|
115
|
+
})
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return node;
|
|
119
|
+
});
|
|
120
|
+
};
|
|
61
121
|
const groupsList = () => {
|
|
62
|
-
|
|
122
|
+
// 先处理 formLine,确保所有 Form.Item 都有 noStyle
|
|
123
|
+
const processedFormLine = processFormLine(formLine);
|
|
124
|
+
const arr = processedFormLine.map(node => ({
|
|
63
125
|
show: true,
|
|
64
126
|
node
|
|
65
127
|
}));
|
|
66
|
-
if (isOpen || arr.length <=
|
|
128
|
+
if (isOpen || arr.length <= 2) {
|
|
67
129
|
return arr;
|
|
68
130
|
}
|
|
69
|
-
return arr.map((item, index) => index >
|
|
131
|
+
return arr.map((item, index) => index > 1 ? {
|
|
70
132
|
...item,
|
|
71
133
|
show: false
|
|
72
134
|
} : item);
|
|
73
135
|
};
|
|
74
136
|
const formItemList = groupsList();
|
|
75
137
|
if (formItemList.length === 0) return null;
|
|
76
|
-
return /*#__PURE__*/React.createElement(Form, {
|
|
77
|
-
ref:
|
|
138
|
+
return /*#__PURE__*/React.createElement(Form, _extends({}, externalForm && isExternalRef ? {
|
|
139
|
+
ref: externalForm
|
|
140
|
+
} : {
|
|
141
|
+
form: externalForm || internalFormInstance
|
|
142
|
+
}, {
|
|
78
143
|
style: style,
|
|
79
144
|
initialValues: initialValues,
|
|
80
145
|
onFinish: values => onFinish(values)
|
|
81
|
-
}, /*#__PURE__*/React.createElement(Row, {
|
|
146
|
+
}), /*#__PURE__*/React.createElement(Row, {
|
|
82
147
|
gutter: [16, 16]
|
|
83
148
|
}, formItemList.map((item, index) => /*#__PURE__*/React.createElement(Col, {
|
|
84
149
|
key: index,
|
|
85
|
-
span:
|
|
150
|
+
span: 8,
|
|
86
151
|
style: {
|
|
87
152
|
display: item.show ? 'block' : 'none'
|
|
88
153
|
}
|
|
89
154
|
}, item.node)), /*#__PURE__*/React.createElement(Col, {
|
|
90
|
-
span:
|
|
155
|
+
span: 8,
|
|
156
|
+
style: {
|
|
157
|
+
display: 'flex',
|
|
158
|
+
alignItems: 'flex-start'
|
|
159
|
+
}
|
|
91
160
|
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
92
|
-
noStyle: true
|
|
161
|
+
noStyle: true,
|
|
162
|
+
style: {
|
|
163
|
+
marginBottom: 0
|
|
164
|
+
}
|
|
93
165
|
}, getButtons()))));
|
|
94
166
|
};
|
|
167
|
+
SearchForm.displayName = 'SearchForm';
|
|
95
168
|
export default SearchForm;
|
package/Table/README.md
CHANGED
|
@@ -33,4 +33,4 @@ function App() {
|
|
|
33
33
|
| disabledResizer | 是否禁用内容区滚动,设置true自动将适配内容区滚动高度 | `boolean` | false |
|
|
34
34
|
| storeIndex | 当一个路由下存在多个表格的情况下 需要给每一个表格设置一个唯一存储索引 若没有设置则使用默认索引,请注意缓存数据会被覆盖 | `number` | - |
|
|
35
35
|
|
|
36
|
-
其他属性参考 https://ant-design.antgroup.com/components/table-cn#api
|
|
36
|
+
其他属性参考 https://ant-design.antgroup.com/components/table-cn#api
|
package/Table/index.d.ts
CHANGED
|
@@ -1,17 +1,64 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
// @ts-ignore
|
|
4
|
-
import type { TableProps } from 'antd';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import type { TableProps } from 'antd';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 列设置配置项
|
|
8
|
+
*/
|
|
9
|
+
export interface SettingOptionType {
|
|
10
|
+
/** 是否可拖拽排序 */
|
|
11
|
+
draggable?: boolean;
|
|
12
|
+
/** 是否显示复选框 */
|
|
13
|
+
checkable?: boolean;
|
|
14
|
+
/** 是否显示列表项选项 */
|
|
15
|
+
showListItemOption?: boolean;
|
|
16
|
+
/** 重置时是否恢复选中状态 */
|
|
17
|
+
checkedReset?: boolean;
|
|
18
|
+
/** 列表高度 */
|
|
19
|
+
listsHeight?: number;
|
|
20
|
+
/** 额外内容 */
|
|
21
|
+
extra?: React.ReactNode;
|
|
22
|
+
/** 子元素 */
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
/** 自定义设置图标 */
|
|
25
|
+
settingIcon?: React.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* ProTable options 配置项
|
|
30
|
+
*/
|
|
31
|
+
export interface OptionConfig {
|
|
32
|
+
/** 是否显示密度切换 */
|
|
33
|
+
density?: boolean;
|
|
34
|
+
/** 是否显示全屏按钮,或自定义函数 */
|
|
35
|
+
fullScreen?: boolean | ((e: React.MouseEvent<HTMLSpanElement>, action?: any) => void);
|
|
36
|
+
/** 是否显示刷新按钮,或自定义函数 */
|
|
37
|
+
reload?: boolean | ((e: React.MouseEvent<HTMLSpanElement>, action?: any) => void);
|
|
38
|
+
/** 列设置配置 */
|
|
39
|
+
setting?: boolean | SettingOptionType;
|
|
40
|
+
/** 搜索配置 */
|
|
41
|
+
search?: boolean | {
|
|
42
|
+
name?: string;
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
};
|
|
45
|
+
/** 自定义刷新图标 */
|
|
46
|
+
reloadIcon?: React.ReactNode;
|
|
47
|
+
/** 自定义密度图标 */
|
|
48
|
+
densityIcon?: React.ReactNode;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface OverTableProps extends TableProps {
|
|
52
|
+
// 当一个路由下存在多个表格的情况下 需要给每一个表格设置一个唯一存储索引 若没有设置则使用默认索引,请注意缓存数据会被覆盖
|
|
53
|
+
storeIndex?: string;
|
|
54
|
+
// 是否启用自动计算滚动高度,默认-true
|
|
55
|
+
enableAutoScrollY?: boolean;
|
|
56
|
+
// ProTable options 配置项
|
|
57
|
+
options?: OptionConfig | false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface TableFc extends React.FC<OverTableProps> {
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
declare const Table: TableFc;
|
|
64
|
+
export default Table;
|
package/Table/index.js
CHANGED
|
@@ -1,118 +1,118 @@
|
|
|
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
|
-
import React from 'react';
|
|
3
|
-
import { tools } from '@cqsjjb/jjb-common-lib';
|
|
2
|
+
import React, { useRef, useEffect, useState, useCallback } from 'react';
|
|
4
3
|
import { ProTable } from '@ant-design/pro-components';
|
|
5
|
-
import { useAntdResizableHeader } from 'use-antd-resizable-header';
|
|
6
|
-
import { antPrefix, setTableSize, getTableSize, getPersistenceKey } from './utils';
|
|
7
4
|
import './index.less';
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import { antPrefix } from './utils';
|
|
6
|
+
function TablePro(props) {
|
|
10
7
|
const prefix = antPrefix || 'ant';
|
|
11
8
|
const baseCls = `.${prefix}-table`;
|
|
12
|
-
const
|
|
9
|
+
const ref = useRef(null);
|
|
13
10
|
const tableBodyCls = `${baseCls}-body`;
|
|
11
|
+
const tablePaginationCls = `${baseCls}-pagination`;
|
|
12
|
+
const tableFooterCls = `${baseCls}-footer`;
|
|
14
13
|
const {
|
|
15
|
-
|
|
14
|
+
enableAutoScrollY = true,
|
|
15
|
+
rowKey,
|
|
16
|
+
columns,
|
|
17
|
+
scroll,
|
|
18
|
+
options = {
|
|
19
|
+
reload: false,
|
|
20
|
+
density: true,
|
|
21
|
+
fullScreen: true,
|
|
22
|
+
setting: {
|
|
23
|
+
checkedReset: true,
|
|
24
|
+
draggable: false,
|
|
25
|
+
checkable: true
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
...restProps
|
|
16
29
|
} = props;
|
|
17
|
-
const [
|
|
18
|
-
const [tableHeight, setTableHeight] = React.useState(0);
|
|
19
|
-
const persistenceKey = getPersistenceKey(storeIndex);
|
|
20
|
-
const enabledResizer = tools.isUndefined(props.disabledResizer);
|
|
21
|
-
React.useEffect(() => {
|
|
22
|
-
let mutationObserver, resizeObserver;
|
|
23
|
-
if (enabledResizer) {
|
|
24
|
-
// 监听-DOM树
|
|
25
|
-
mutationObserver = new MutationObserver(mutations => mutations.forEach(() => calcTableHeight()));
|
|
26
|
-
// 监听-缩放
|
|
27
|
-
resizeObserver = new ResizeObserver(entries => entries.forEach(() => calcTableHeight()));
|
|
30
|
+
const [scrollY, setScrollY] = useState(undefined);
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
// 1. rowKey 兜底处理:如果没有 rowKey,使用数据索引下标
|
|
33
|
+
const finalRowKey = rowKey || ((record, index) => index);
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
+
};
|
|
39
45
|
}
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
return baseScroll;
|
|
47
|
+
}, [scroll, enableAutoScrollY, scrollY]);
|
|
48
|
+
const timerRef = useRef(null);
|
|
49
|
+
const calcTableScrollY = () => {
|
|
50
|
+
const tableBody = ref.current?.querySelector?.(tableBodyCls);
|
|
51
|
+
const tableBodyRect = tableBody?.getBoundingClientRect();
|
|
52
|
+
const tableFooter = ref.current?.querySelector?.(tableFooterCls);
|
|
53
|
+
const tableFooterRect = tableFooter?.getBoundingClientRect();
|
|
54
|
+
const tablePagination = ref.current?.querySelector?.(tablePaginationCls);
|
|
55
|
+
const tablePaginationRect = tablePagination?.getBoundingClientRect();
|
|
56
|
+
const tableFooterHeight = tableFooterRect?.height || 0;
|
|
57
|
+
const tablePaginationMargin = 16 * 2;
|
|
58
|
+
const tablePaginationHeight = tablePaginationRect?.height || 0;
|
|
59
|
+
const border = 2;
|
|
60
|
+
const margin = 20;
|
|
61
|
+
const scrollY = window.innerHeight - tableBodyRect.top - tableFooterHeight - tablePaginationHeight - tablePaginationMargin - border - margin;
|
|
62
|
+
return scrollY;
|
|
63
|
+
};
|
|
64
|
+
const debouncedCalcScrollY = useCallback(() => {
|
|
65
|
+
if (timerRef.current) {
|
|
66
|
+
clearTimeout(timerRef.current);
|
|
67
|
+
}
|
|
68
|
+
timerRef.current = setTimeout(() => {
|
|
69
|
+
const height = calcTableScrollY();
|
|
70
|
+
if (height) {
|
|
71
|
+
setScrollY(height);
|
|
44
72
|
}
|
|
45
|
-
};
|
|
73
|
+
}, 150);
|
|
46
74
|
}, []);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
if (!ref.current || !enableAutoScrollY) return;
|
|
77
|
+
// 创建 ResizeObserver 监听元素尺寸变化
|
|
78
|
+
const resizeObserver1 = new ResizeObserver(() => {
|
|
79
|
+
// 等待 table-pagination 元素生成后再计算
|
|
80
|
+
debouncedCalcScrollY();
|
|
81
|
+
});
|
|
82
|
+
const mutationObserver = new MutationObserver(() => {
|
|
83
|
+
debouncedCalcScrollY();
|
|
84
|
+
});
|
|
85
|
+
mutationObserver.observe(ref.current.parentElement, {
|
|
86
|
+
childList: true,
|
|
87
|
+
subtree: true,
|
|
88
|
+
attributes: true
|
|
89
|
+
});
|
|
50
90
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
// table-body元素
|
|
57
|
-
const tableBodyEl = document.querySelector(tableBodyCls);
|
|
58
|
-
if (tableBodyEl && tableEl) {
|
|
59
|
-
// 获取table元素的矩形数据
|
|
60
|
-
const tableRect = tableEl.getBoundingClientRect();
|
|
61
|
-
// 获取table-body元素的矩形数据
|
|
62
|
-
const tableBodyRect = tableBodyEl.getBoundingClientRect();
|
|
63
|
-
// 获取底部的高度差
|
|
64
|
-
const bottomHeight = tableRect.bottom - tableBodyRect.bottom;
|
|
65
|
-
// 计算最终值
|
|
66
|
-
setTableHeight(innerHeight - tableBodyRect.top - bottomHeight - (window.__IN_BASE__ ? 38 : 22));
|
|
91
|
+
// 开始观察 ref.current 的尺寸变化
|
|
92
|
+
resizeObserver1.observe(ref.current);
|
|
93
|
+
return () => {
|
|
94
|
+
if (timerRef.current) {
|
|
95
|
+
clearTimeout(timerRef.current);
|
|
67
96
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
tableWidth,
|
|
76
|
-
resetColumns
|
|
77
|
-
// refresh
|
|
78
|
-
} = useAntdResizableHeader({
|
|
79
|
-
columns: props.columns,
|
|
80
|
-
columnsState: {
|
|
81
|
-
persistenceKey: persistenceKey.resizable,
|
|
82
|
-
persistenceType: 'localStorage'
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
const scroll = {
|
|
86
|
-
x: tableWidth
|
|
87
|
-
};
|
|
88
|
-
if (enabledResizer) {
|
|
89
|
-
scroll.y = tableHeight;
|
|
90
|
-
}
|
|
91
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ProTable, _extends({
|
|
97
|
+
resizeObserver1.disconnect();
|
|
98
|
+
mutationObserver.disconnect();
|
|
99
|
+
};
|
|
100
|
+
}, [ref, enableAutoScrollY, debouncedCalcScrollY]);
|
|
101
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
102
|
+
ref: ref
|
|
103
|
+
}, /*#__PURE__*/React.createElement(ProTable, _extends({
|
|
92
104
|
ghost: true,
|
|
105
|
+
bordered: true,
|
|
106
|
+
defaultSize: "default",
|
|
93
107
|
columnEmptyText: true,
|
|
94
|
-
size: size,
|
|
95
108
|
search: false,
|
|
96
|
-
scroll:
|
|
109
|
+
scroll: finalScroll,
|
|
110
|
+
rowKey: finalRowKey,
|
|
97
111
|
className: `${antPrefix}-gbs-pro-table`,
|
|
98
|
-
options:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
setting: {
|
|
102
|
-
checkedReset: true,
|
|
103
|
-
extra: /*#__PURE__*/React.createElement("a", {
|
|
104
|
-
className: `${antPrefix}-pro-table-column-setting-action-rest-button`,
|
|
105
|
-
onClick: resetColumns
|
|
106
|
-
}, "\u91CD\u7F6E\u5217\u5BBD")
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
components: components,
|
|
110
|
-
columnsState: {
|
|
111
|
-
persistenceKey: persistenceKey.columnState,
|
|
112
|
-
persistenceType: 'localStorage'
|
|
113
|
-
},
|
|
114
|
-
onSizeChange: setSize
|
|
115
|
-
}, props, {
|
|
116
|
-
columns: resizableColumns
|
|
112
|
+
options: options
|
|
113
|
+
}, restProps, {
|
|
114
|
+
columns: columns
|
|
117
115
|
})));
|
|
118
|
-
}
|
|
116
|
+
}
|
|
117
|
+
TablePro.displayName = 'TablePro';
|
|
118
|
+
export default TablePro;
|
package/Table/index.less
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
@com-prefix-cls: if(isdefined(@ant-prefix), @ant-prefix, ant);
|
|
2
|
+
|
|
3
|
+
.@{com-prefix-cls} {
|
|
2
4
|
&-gbs-pro-table {
|
|
3
|
-
.@{
|
|
5
|
+
.@{com-prefix-cls}-pro-card {
|
|
4
6
|
&-body {
|
|
5
|
-
.@{
|
|
7
|
+
.@{com-prefix-cls}-pro-table-list-toolbar {
|
|
6
8
|
&-container {
|
|
7
|
-
padding-
|
|
9
|
+
padding-block: 0;
|
|
8
10
|
}
|
|
9
11
|
}
|
|
10
12
|
}
|
|
11
13
|
}
|
|
12
14
|
}
|
|
13
|
-
}
|
|
15
|
+
}
|
package/TableAction/index.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { tools } from '@cqsjjb/jjb-common-lib';
|
|
3
|
-
import { MoreOutlined } from '@ant-design/icons';
|
|
4
2
|
import { Dropdown, Space } from 'antd';
|
|
5
|
-
|
|
3
|
+
import { EllipsisOutlined } from '@ant-design/icons';
|
|
4
|
+
function TableAction({
|
|
6
5
|
maximum = 3,
|
|
7
6
|
children,
|
|
8
7
|
space,
|
|
9
|
-
|
|
8
|
+
enabledIcon = true,
|
|
10
9
|
placement = 'bottomRight',
|
|
11
10
|
// 下拉菜单位置,默认 bottomRight
|
|
12
11
|
trigger = ['hover'] // 下拉触发方式,默认 hover
|
|
13
12
|
}) {
|
|
14
13
|
// 将 children 统一成数组并过滤空值
|
|
15
|
-
const childArray = (
|
|
14
|
+
const childArray = (Array.isArray(children) ? children : [].concat(children)).filter(Boolean);
|
|
16
15
|
const showArray = childArray.slice(0, maximum);
|
|
17
16
|
const hideArray = childArray.slice(maximum);
|
|
18
17
|
return /*#__PURE__*/React.createElement(Space, {
|
|
@@ -24,7 +23,9 @@ export default function TableAction({
|
|
|
24
23
|
label: child
|
|
25
24
|
}))
|
|
26
25
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(
|
|
30
|
-
}
|
|
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(
|