@cqsjjb/jjb-react-admin-component 3.3.1-beta.4 → 3.3.1-beta.6
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/package.json +1 -1
- package/AMap/index.js +0 -372
- package/AdaptiveTree/index.js +0 -184
- package/BMap/index.js +0 -167
- package/ControlWrapper/index.js +0 -65
- package/ControlWrapper/index.less +0 -38
- package/Editor/index.js +0 -310
- package/ErrorBoundary/index.js +0 -35
- package/FileUploader/index.js +0 -312
- package/FormilyDescriptions/index.js +0 -313
- package/FormilyRenderer/index.js +0 -58
- package/ImageCropper/index.js +0 -116
- package/ImageUploader/index.js +0 -310
- package/ListDataContainer/index.js +0 -211
- package/MediaQuery/index.js +0 -42
- package/PageLayout/index.js +0 -60
- package/SearchForm/index.js +0 -95
- package/Table/index.js +0 -118
- package/TableAction/index.js +0 -30
package/PageLayout/index.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import React, { memo, useCallback } from 'react';
|
|
2
|
-
import { PageHeader } from '@ant-design/pro-layout';
|
|
3
|
-
import './index.less';
|
|
4
|
-
import { getPrefixCls } from '../tools/index.js';
|
|
5
|
-
const prefixCls = getPrefixCls();
|
|
6
|
-
const PageLayout = /*#__PURE__*/memo(props => {
|
|
7
|
-
const {
|
|
8
|
-
title,
|
|
9
|
-
extra,
|
|
10
|
-
style = {},
|
|
11
|
-
header,
|
|
12
|
-
footer,
|
|
13
|
-
history = {},
|
|
14
|
-
noStyle,
|
|
15
|
-
formLine,
|
|
16
|
-
formLineStyle,
|
|
17
|
-
noBorder = false,
|
|
18
|
-
previous = false,
|
|
19
|
-
children,
|
|
20
|
-
transparent,
|
|
21
|
-
contentStyle,
|
|
22
|
-
footerStyle,
|
|
23
|
-
pageHeaderStyle,
|
|
24
|
-
onBack,
|
|
25
|
-
'data-node-id': dataNodeId
|
|
26
|
-
} = props;
|
|
27
|
-
const containerClass = [`${prefixCls}-layout-container`, transparent && `${prefixCls}-layout-container-transparent`, noStyle && `${prefixCls}-layout-container-no-style`].filter(Boolean).join(' ');
|
|
28
|
-
const backHandler = useCallback(() => {
|
|
29
|
-
if (onBack) {
|
|
30
|
-
onBack();
|
|
31
|
-
} else if (previous) {
|
|
32
|
-
history.go(-1);
|
|
33
|
-
}
|
|
34
|
-
}, [onBack, previous, history]);
|
|
35
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
36
|
-
style: noBorder ? {
|
|
37
|
-
border: 'none',
|
|
38
|
-
...style
|
|
39
|
-
} : style,
|
|
40
|
-
className: containerClass,
|
|
41
|
-
"data-node-id": dataNodeId
|
|
42
|
-
}, !header ? /*#__PURE__*/React.createElement(PageHeader, {
|
|
43
|
-
title: title,
|
|
44
|
-
extra: extra,
|
|
45
|
-
style: pageHeaderStyle,
|
|
46
|
-
onBack: previous || onBack ? backHandler : undefined
|
|
47
|
-
}) : header, formLine && /*#__PURE__*/React.createElement("div", {
|
|
48
|
-
className: `${prefixCls}-layout-container-tools`,
|
|
49
|
-
style: formLineStyle
|
|
50
|
-
}, formLine), /*#__PURE__*/React.createElement("div", {
|
|
51
|
-
style: contentStyle,
|
|
52
|
-
className: `${prefixCls}-layout-container-content`
|
|
53
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
54
|
-
className: `${prefixCls}-layout-container-content-abs`
|
|
55
|
-
}, children)), footer && /*#__PURE__*/React.createElement("div", {
|
|
56
|
-
className: `${prefixCls}-lay-container-bottom`,
|
|
57
|
-
style: footerStyle
|
|
58
|
-
}, footer));
|
|
59
|
-
});
|
|
60
|
-
export default PageLayout;
|
package/SearchForm/index.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import React, { useState, useRef, useEffect } from 'react';
|
|
2
|
-
import { Form, Button, Space, Row, Col } from 'antd';
|
|
3
|
-
import { SearchOutlined, DoubleRightOutlined, UndoOutlined } from '@ant-design/icons';
|
|
4
|
-
const SearchForm = ({
|
|
5
|
-
form: externalForm,
|
|
6
|
-
style,
|
|
7
|
-
expand,
|
|
8
|
-
// 受控
|
|
9
|
-
defaultExpand = false,
|
|
10
|
-
// 内部默认展开
|
|
11
|
-
colSize = 3,
|
|
12
|
-
loading = false,
|
|
13
|
-
formLine = [],
|
|
14
|
-
initialValues = {},
|
|
15
|
-
onRef = () => {},
|
|
16
|
-
onReset = () => {},
|
|
17
|
-
onFinish = () => {},
|
|
18
|
-
onExpand
|
|
19
|
-
}) => {
|
|
20
|
-
const internalForm = useRef();
|
|
21
|
-
const form = externalForm || internalForm;
|
|
22
|
-
const [internalOpen, setInternalOpen] = useState(defaultExpand);
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
if (onRef) {
|
|
25
|
-
onRef(form);
|
|
26
|
-
}
|
|
27
|
-
}, [form, onRef]);
|
|
28
|
-
const isControlled = expand !== undefined;
|
|
29
|
-
const isOpen = isControlled ? expand : internalOpen;
|
|
30
|
-
const handleToggle = () => {
|
|
31
|
-
if (isControlled) {
|
|
32
|
-
onExpand && onExpand(!expand);
|
|
33
|
-
} else {
|
|
34
|
-
setInternalOpen(prev => {
|
|
35
|
-
const next = !prev;
|
|
36
|
-
onExpand && onExpand(next);
|
|
37
|
-
return next;
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
const getButtons = () => /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Button, {
|
|
42
|
-
type: "primary",
|
|
43
|
-
icon: /*#__PURE__*/React.createElement(SearchOutlined, null),
|
|
44
|
-
htmlType: "submit",
|
|
45
|
-
loading: loading
|
|
46
|
-
}, "\u67E5\u8BE2"), /*#__PURE__*/React.createElement(Button, {
|
|
47
|
-
icon: /*#__PURE__*/React.createElement(UndoOutlined, null),
|
|
48
|
-
loading: loading,
|
|
49
|
-
onClick: () => {
|
|
50
|
-
form.current.resetFields();
|
|
51
|
-
onReset(form.current.getFieldsValue());
|
|
52
|
-
}
|
|
53
|
-
}, "\u91CD\u7F6E"), formLine.length / colSize > 1 && /*#__PURE__*/React.createElement(Button, {
|
|
54
|
-
icon: /*#__PURE__*/React.createElement(DoubleRightOutlined, {
|
|
55
|
-
style: {
|
|
56
|
-
transform: isOpen ? 'rotate(-90deg)' : 'rotate(90deg)'
|
|
57
|
-
}
|
|
58
|
-
}),
|
|
59
|
-
onClick: handleToggle
|
|
60
|
-
}, isOpen ? '收起' : '展开'));
|
|
61
|
-
const groupsList = () => {
|
|
62
|
-
const arr = formLine.map(node => ({
|
|
63
|
-
show: true,
|
|
64
|
-
node
|
|
65
|
-
}));
|
|
66
|
-
if (isOpen || arr.length <= 3) {
|
|
67
|
-
return arr;
|
|
68
|
-
}
|
|
69
|
-
return arr.map((item, index) => index > 2 ? {
|
|
70
|
-
...item,
|
|
71
|
-
show: false
|
|
72
|
-
} : item);
|
|
73
|
-
};
|
|
74
|
-
const formItemList = groupsList();
|
|
75
|
-
if (formItemList.length === 0) return null;
|
|
76
|
-
return /*#__PURE__*/React.createElement(Form, {
|
|
77
|
-
ref: form,
|
|
78
|
-
style: style,
|
|
79
|
-
initialValues: initialValues,
|
|
80
|
-
onFinish: values => onFinish(values)
|
|
81
|
-
}, /*#__PURE__*/React.createElement(Row, {
|
|
82
|
-
gutter: [16, 16]
|
|
83
|
-
}, formItemList.map((item, index) => /*#__PURE__*/React.createElement(Col, {
|
|
84
|
-
key: index,
|
|
85
|
-
span: 24 / colSize,
|
|
86
|
-
style: {
|
|
87
|
-
display: item.show ? 'block' : 'none'
|
|
88
|
-
}
|
|
89
|
-
}, item.node)), /*#__PURE__*/React.createElement(Col, {
|
|
90
|
-
span: 24 / colSize
|
|
91
|
-
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
92
|
-
noStyle: true
|
|
93
|
-
}, getButtons()))));
|
|
94
|
-
};
|
|
95
|
-
export default SearchForm;
|
package/Table/index.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
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';
|
|
4
|
-
import { ProTable } from '@ant-design/pro-components';
|
|
5
|
-
import { useAntdResizableHeader } from 'use-antd-resizable-header';
|
|
6
|
-
import { antPrefix, setTableSize, getTableSize, getPersistenceKey } from './utils';
|
|
7
|
-
import './index.less';
|
|
8
|
-
require('use-antd-resizable-header/dist/style.css');
|
|
9
|
-
export default function TablePro(props) {
|
|
10
|
-
const prefix = antPrefix || 'ant';
|
|
11
|
-
const baseCls = `.${prefix}-table`;
|
|
12
|
-
const tableCls = `${baseCls}-wrapper`;
|
|
13
|
-
const tableBodyCls = `${baseCls}-body`;
|
|
14
|
-
const {
|
|
15
|
-
storeIndex
|
|
16
|
-
} = props;
|
|
17
|
-
const [size, setSize] = React.useState(getTableSize(storeIndex) || 'default');
|
|
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()));
|
|
28
|
-
|
|
29
|
-
// 初始化首次计算
|
|
30
|
-
setTimeout(() => calcTableHeight(), 500);
|
|
31
|
-
|
|
32
|
-
// 执行-监听-缩放
|
|
33
|
-
resizeObserver.observe(document.body);
|
|
34
|
-
// 执行-监听-DOM树是否发生变化
|
|
35
|
-
mutationObserver.observe(document.body, {
|
|
36
|
-
subtree: true,
|
|
37
|
-
childList: true
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
return () => {
|
|
41
|
-
if (mutationObserver && resizeObserver && enabledResizer) {
|
|
42
|
-
resizeObserver.unobserve(document.body);
|
|
43
|
-
mutationObserver.disconnect(document.body);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
}, []);
|
|
47
|
-
React.useEffect(() => {
|
|
48
|
-
setTableSize(size, storeIndex);
|
|
49
|
-
}, [size]);
|
|
50
|
-
|
|
51
|
-
// 计算高度
|
|
52
|
-
const calcTableHeight = () => {
|
|
53
|
-
try {
|
|
54
|
-
// table元素
|
|
55
|
-
const tableEl = document.querySelector(tableCls);
|
|
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));
|
|
67
|
-
}
|
|
68
|
-
} catch (e) {
|
|
69
|
-
window.console['error'](e);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
const {
|
|
73
|
-
components,
|
|
74
|
-
resizableColumns,
|
|
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({
|
|
92
|
-
ghost: true,
|
|
93
|
-
columnEmptyText: true,
|
|
94
|
-
size: size,
|
|
95
|
-
search: false,
|
|
96
|
-
scroll: scroll,
|
|
97
|
-
className: `${antPrefix}-gbs-pro-table`,
|
|
98
|
-
options: {
|
|
99
|
-
reload: false,
|
|
100
|
-
fullScreen: true,
|
|
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
|
|
117
|
-
})));
|
|
118
|
-
}
|
package/TableAction/index.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { tools } from '@cqsjjb/jjb-common-lib';
|
|
3
|
-
import { MoreOutlined } from '@ant-design/icons';
|
|
4
|
-
import { Dropdown, Space } from 'antd';
|
|
5
|
-
export default function TableAction({
|
|
6
|
-
maximum = 3,
|
|
7
|
-
children,
|
|
8
|
-
space,
|
|
9
|
-
icon: Icon = MoreOutlined,
|
|
10
|
-
placement = 'bottomRight',
|
|
11
|
-
// 下拉菜单位置,默认 bottomRight
|
|
12
|
-
trigger = ['hover'] // 下拉触发方式,默认 hover
|
|
13
|
-
}) {
|
|
14
|
-
// 将 children 统一成数组并过滤空值
|
|
15
|
-
const childArray = (tools.isArray(children) ? children : [].concat(children)).filter(Boolean);
|
|
16
|
-
const showArray = childArray.slice(0, maximum);
|
|
17
|
-
const hideArray = childArray.slice(maximum);
|
|
18
|
-
return /*#__PURE__*/React.createElement(Space, {
|
|
19
|
-
size: space
|
|
20
|
-
}, showArray, hideArray.length > 0 && /*#__PURE__*/React.createElement(Dropdown, {
|
|
21
|
-
menu: {
|
|
22
|
-
items: hideArray.map((child, index) => ({
|
|
23
|
-
key: index,
|
|
24
|
-
label: child
|
|
25
|
-
}))
|
|
26
|
-
},
|
|
27
|
-
placement: placement,
|
|
28
|
-
trigger: trigger
|
|
29
|
-
}, /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(Icon, null))));
|
|
30
|
-
}
|