@cqsjjb/jjb-react-admin-component 3.3.1-beta.6 → 3.3.1-beta.8

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.
@@ -0,0 +1,60 @@
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;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { ButtonProps } from 'antd';
3
+
4
+ export interface PhoneBoxProps {
5
+ /** 展示内容的URL */
6
+ iframeUrl?: string;
7
+ /** 是否显示空状态,默认false */
8
+ showEmpty?: boolean;
9
+ /** 大小,默认'normal' */
10
+ size?: 'normal' | 'small';
11
+ /** 右侧额外操作按钮 */
12
+ extraAction?: React.ReactNode;
13
+ /** 是否显示右侧的二维码预览,默认'false' */
14
+ showPerview?: string | boolean;
15
+ /** 刷新二维码URL的函数,不传时自动使用时间戳刷新二维码 */
16
+ fetchQrcodeUrl?: () => Promise<{ data: string }>;
17
+ }
18
+
19
+ declare const PhoneBox: React.FC<PhoneBoxProps>;
20
+
21
+ export default PhoneBox;
@@ -0,0 +1,200 @@
1
+ import React, { useEffect, useState, useRef } from 'react';
2
+ import { Empty, Space, message, Tooltip, Button, QRCode } from 'antd';
3
+ import { SyncOutlined } from '@ant-design/icons';
4
+ import './index.less';
5
+ export default props => {
6
+ const {
7
+ iframeUrl,
8
+ // 展示内容url
9
+ extraAction,
10
+ // 额外操作
11
+ showEmpty = false,
12
+ // 是否显示空状态
13
+ size = 'normal',
14
+ // 大小
15
+ showPerview = 'false',
16
+ // 是否显示二维码预览
17
+ fetchQrcodeUrl // 刷新二维码URL的函数
18
+ } = props;
19
+ const [currentTime, setCurrentTime] = useState(''); // 当前时间
20
+ const [qrcodeUrl, setQrcodeUrl] = useState(''); // 二维码URL
21
+ const [qrcodeVisible, setQrcodeVisible] = useState(false); // 二维码预览是否显示
22
+ const [isQrcodeExpire, setIsQrcodeExpire] = useState(false); // 二维码是否过期
23
+ const [qrcodeExpireTime, setQrcodeExpireTime] = useState(3); // 二维码剩余过期时间
24
+ const qrcodeButtonRef = useRef(null); // 扫码预览按钮dom
25
+ const currentRotate = useRef(0); // 刷新二维码icon旋转角度
26
+ const qrcodeTimerId = useRef(null); // 二维码三分钟过期定时器
27
+ const qrcodeExpireTimeUpdateTimerId = useRef(null); // 二维码过期时间更新定时器
28
+
29
+ useEffect(() => {
30
+ if (iframeUrl) {
31
+ setQrcodeUrl(iframeUrl);
32
+ }
33
+ }, [iframeUrl]);
34
+
35
+ // 点击外部区域(按钮、tooltip除外)关闭二维码预览
36
+ useEffect(() => {
37
+ const handleClickOutside = e => {
38
+ const button = qrcodeButtonRef.current;
39
+ const tooltip = document.querySelector('.micro-temp-tooltip');
40
+ if (button && !button.contains(e.target) && tooltip && !tooltip.contains(e.target)) {
41
+ setQrcodeVisible(false);
42
+ }
43
+ };
44
+ document.addEventListener('click', handleClickOutside);
45
+ return () => {
46
+ document.removeEventListener('click', handleClickOutside);
47
+ };
48
+ }, []);
49
+
50
+ // 手机上展示当前时间
51
+ useEffect(() => {
52
+ const formatHourMinute = date => {
53
+ const hours = String(date.getHours()).padStart(2, '0');
54
+ const minutes = String(date.getMinutes()).padStart(2, '0');
55
+ return `${hours}:${minutes}`;
56
+ };
57
+ setCurrentTime(formatHourMinute(new Date()));
58
+ const timer = setInterval(() => {
59
+ setCurrentTime(formatHourMinute(new Date()));
60
+ }, 60000);
61
+ return () => clearInterval(timer);
62
+ }, []);
63
+
64
+ // 清理二维码相关定时器
65
+ useEffect(() => {
66
+ return () => {
67
+ clearTimeout(qrcodeTimerId.current);
68
+ clearInterval(qrcodeExpireTimeUpdateTimerId.current);
69
+ };
70
+ }, []);
71
+
72
+ // 二维码过期状态定时器
73
+ const startQrcodeTimer = () => {
74
+ if (qrcodeTimerId.current) {
75
+ clearTimeout(qrcodeTimerId.current);
76
+ }
77
+ qrcodeTimerId.current = setTimeout(() => {
78
+ setIsQrcodeExpire(true);
79
+ }, 180000);
80
+ };
81
+
82
+ // 二维码过期时间定时器
83
+ const startQrcodeExpireTimeUpdateTimer = () => {
84
+ setQrcodeExpireTime(3);
85
+ if (qrcodeExpireTimeUpdateTimerId.current) {
86
+ clearInterval(qrcodeExpireTimeUpdateTimerId.current);
87
+ }
88
+ qrcodeExpireTimeUpdateTimerId.current = setInterval(() => {
89
+ setQrcodeExpireTime(prev => prev > 0 ? prev - 1 : 0);
90
+ }, 60000);
91
+ };
92
+ const getQrCodeUrl = () => {
93
+ if (fetchQrcodeUrl) {
94
+ fetchQrcodeUrl().then(res => {
95
+ setQrcodeUrl(res.data);
96
+ setIsQrcodeExpire(false); // 重置二维码过期状态
97
+ startQrcodeTimer(); // 启动过期状态定时器
98
+ startQrcodeExpireTimeUpdateTimer(); // 启动过期时间定时器
99
+ });
100
+ } else {
101
+ setQrcodeUrl(`${iframeUrl}?t=${Date.now()}`);
102
+ setIsQrcodeExpire(false); // 重置二维码过期状态
103
+ startQrcodeTimer(); // 启动过期状态定时器
104
+ startQrcodeExpireTimeUpdateTimer(); // 启动过期时间定时器
105
+ }
106
+ };
107
+ return /*#__PURE__*/React.createElement("div", {
108
+ className: `phone-box ${size === 'small' ? 'phone-box-small' : ''}`
109
+ }, /*#__PURE__*/React.createElement("img", {
110
+ alt: "",
111
+ src: require('~/assets/phone.png').default,
112
+ width: 356,
113
+ height: 720
114
+ }), /*#__PURE__*/React.createElement("div", {
115
+ className: "phone-content"
116
+ }, /*#__PURE__*/React.createElement("div", {
117
+ className: "phone-content-header"
118
+ }, /*#__PURE__*/React.createElement("div", {
119
+ className: "phone-header-time"
120
+ }, currentTime), /*#__PURE__*/React.createElement("img", {
121
+ src: require('~/assets/shexiang.png').default,
122
+ width: 76,
123
+ height: 23,
124
+ alt: ""
125
+ }), /*#__PURE__*/React.createElement(Space, {
126
+ className: "phone-header-status"
127
+ }, /*#__PURE__*/React.createElement("img", {
128
+ className: "status-xinhao",
129
+ src: require('~/assets/xinhao.png').default,
130
+ alt: ""
131
+ }), /*#__PURE__*/React.createElement("img", {
132
+ className: "status-wangluo",
133
+ src: require('~/assets/wangluo.png').default,
134
+ alt: ""
135
+ }), /*#__PURE__*/React.createElement("img", {
136
+ className: "status-dianchi",
137
+ src: require('~/assets/dianchi.png').default,
138
+ alt: ""
139
+ }))), showEmpty && !iframeUrl ? /*#__PURE__*/React.createElement("div", {
140
+ style: {
141
+ width: 316,
142
+ height: 625,
143
+ display: 'flex',
144
+ alignItems: 'center',
145
+ justifyContent: 'center'
146
+ }
147
+ }, /*#__PURE__*/React.createElement(Empty, {
148
+ description: "\u6682\u65E0\u5185\u5BB9"
149
+ })) : /*#__PURE__*/React.createElement("iframe", {
150
+ src: iframeUrl,
151
+ width: 316,
152
+ height: 625
153
+ })), /*#__PURE__*/React.createElement("div", {
154
+ className: "phone-box-action"
155
+ }, showPerview && /*#__PURE__*/React.createElement(Tooltip, {
156
+ open: qrcodeVisible,
157
+ placement: "bottom",
158
+ arrow: false,
159
+ color: "#FFF",
160
+ rootClassName: "qrcode-preview-tooltip",
161
+ title: /*#__PURE__*/React.createElement("div", {
162
+ className: "qrcode-preview-container"
163
+ }, /*#__PURE__*/React.createElement(QRCode, {
164
+ value: qrcodeUrl
165
+ }), isQrcodeExpire ? /*#__PURE__*/React.createElement("div", {
166
+ className: "qrcode-preview-container-expire-mask"
167
+ }, "\u4E8C\u7EF4\u7801\u8FC7\u671F") : '', /*#__PURE__*/React.createElement("div", {
168
+ className: "qrcode-preview-container-text"
169
+ }, "\u4E34\u65F6\u9884\u89C8\uFF0C", qrcodeExpireTime ? `${qrcodeExpireTime}分钟后失效` : '已失效'), /*#__PURE__*/React.createElement("a", {
170
+ onClick: () => {
171
+ getQrCodeUrl();
172
+ /** icon旋转动画 */
173
+ const icon = document.getElementById('qrcode-preview-container-icon');
174
+ if (!icon) return;
175
+ icon.classList.remove('icon-rotating');
176
+ // 强制重绘
177
+ void icon.offsetWidth;
178
+ icon.style.setProperty('--start-rotate', `${currentRotate.current}deg`);
179
+ icon.classList.add('icon-rotating');
180
+ setTimeout(() => {
181
+ currentRotate.current += 360;
182
+ icon.classList.remove('icon-rotating');
183
+ }, 300);
184
+ }
185
+ }, /*#__PURE__*/React.createElement(SyncOutlined, {
186
+ id: "qrcode-preview-container-icon",
187
+ style: {
188
+ marginRight: '4px'
189
+ }
190
+ }), "\u91CD\u65B0\u751F\u6210"))
191
+ }, /*#__PURE__*/React.createElement(Button, {
192
+ ref: qrcodeButtonRef,
193
+ onClick: () => {
194
+ setQrcodeVisible(!qrcodeVisible);
195
+ getQrCodeUrl();
196
+ },
197
+ color: "primary",
198
+ variant: "outlined"
199
+ }, "\u626B\u7801\u9884\u89C8")), extraAction));
200
+ };
@@ -0,0 +1,116 @@
1
+ .phone-box {
2
+ display: flex;
3
+ gap: 12px;
4
+ position: relative;
5
+ z-index: 1;
6
+
7
+ .phone-content {
8
+ position: absolute;
9
+ top: 17px;
10
+ left: 20px;
11
+ z-index: 2;
12
+ border-radius: 40px;
13
+ overflow: hidden;
14
+ background-color: #fff;
15
+
16
+ .phone-content-header {
17
+ height: 55px;
18
+ padding: 12px 24px;
19
+ display: flex;
20
+ align-items: center;
21
+ justify-content: space-between;
22
+
23
+ .phone-header-status {
24
+ .status-xinhao {
25
+ width: 20px;
26
+ height: 18px;
27
+ }
28
+
29
+ .status-wangluo {
30
+ width: 16px;
31
+ height: 14px;
32
+ }
33
+
34
+ .status-dianchi {
35
+ width: 24px;
36
+ height: 22px;
37
+ }
38
+ }
39
+
40
+ .phone-header-time {
41
+ font-size: 14px;
42
+ font-weight: 500;
43
+ color: #000;
44
+ width: 76px;
45
+ }
46
+ }
47
+
48
+ iframe {
49
+ border: none;
50
+ }
51
+ }
52
+
53
+ .phone-box-action {
54
+ position: absolute;
55
+ top: 0;
56
+ left: 456px;
57
+ display: flex;
58
+ flex-direction: column;
59
+ gap: 16px;
60
+ }
61
+ }
62
+
63
+ .qrcode-preview-container {
64
+ padding: 4px;
65
+ display: flex;
66
+ flex-direction: column;
67
+ gap: 8px;
68
+ align-items: center;
69
+ justify-content: center;
70
+ position: relative;
71
+ .qrcode-preview-container-expire-mask {
72
+ width: 160px;
73
+ height: 160px;
74
+ position: absolute;
75
+ top: 4px;
76
+ left: 4px;
77
+ background-color: rgba(255, 255, 255, 0.7);
78
+ display: flex;
79
+ align-items: center;
80
+ justify-content: center;
81
+ font-size: 16px;
82
+ border-radius: 6px;
83
+ }
84
+
85
+ .qrcode-preview-container-text {
86
+ font-size: 12px;
87
+ color: #00000066;
88
+ }
89
+
90
+ @keyframes rotate360 {
91
+ from {
92
+ transform: rotate(var(--start-rotate, 0deg));
93
+ }
94
+
95
+ to {
96
+ transform: rotate(calc(var(--start-rotate, 0deg) + 360deg));
97
+ }
98
+ }
99
+
100
+ .icon-rotating {
101
+ animation: rotate360 0.3s linear 1 forwards;
102
+ }
103
+ }
104
+
105
+ .qrcode-preview-tooltip {
106
+ margin-top: 16px;
107
+
108
+ .micro-temp-tooltip-inner {
109
+ border-radius: 12px;
110
+ padding: 16px 24px;
111
+ }
112
+ }
113
+
114
+ .phone-box-small {
115
+ transform: scale(0.5);
116
+ }
@@ -0,0 +1,95 @@
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 ADDED
@@ -0,0 +1,118 @@
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
+ }
@@ -0,0 +1,30 @@
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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cqsjjb/jjb-react-admin-component",
3
- "version": "3.3.1-beta.6",
3
+ "version": "3.3.1-beta.8",
4
4
  "description": "jjb-react-admin-组件库@new",
5
5
  "main": "index.js",
6
6
  "author": "jjb-front-team",