@cqsjjb/jjb-react-admin-component 3.0.13 → 3.0.14
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/Table/index.js +1 -1
- package/Table/index.mjs +1 -1
- package/TableAction/index.d.ts +16 -0
- package/TableAction/index.js +22 -0
- package/TableAction/index.mjs +36 -0
- package/package.json +1 -1
package/Table/index.js
CHANGED
|
@@ -24,7 +24,7 @@ export default function TablePro(props) {
|
|
|
24
24
|
const tBodyNativeRect = tBody.getBoundingClientRect();
|
|
25
25
|
const tFooterAbsRect = getElementAbsRect(tFooter);
|
|
26
26
|
const tPaginationAbsRect = getElementAbsRect(tPagination);
|
|
27
|
-
const gap =
|
|
27
|
+
const gap = 38;
|
|
28
28
|
const height = window.innerHeight - (gap + tBodyNativeRect.y + tFooterAbsRect.absHeight + tPaginationAbsRect.absHeight);
|
|
29
29
|
setTableHeight(height);
|
|
30
30
|
}, 100);
|
package/Table/index.mjs
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { ComponentProps } from '../types';
|
|
4
|
+
|
|
5
|
+
interface TableActionProps extends ComponentProps {
|
|
6
|
+
// 每行最多显示多少个操作项,默认3
|
|
7
|
+
maximum?: number;
|
|
8
|
+
// 每个操作项之间的间距,默认8
|
|
9
|
+
space?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface TableActionFc extends React.FC<TableActionProps> {
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare const TableAction: TableActionFc;
|
|
16
|
+
export default TableAction;
|
|
@@ -0,0 +1,22 @@
|
|
|
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(props) {
|
|
6
|
+
const maximum = props.maximum || 3;
|
|
7
|
+
const children = tools.isArray(props.children) ? props.children : [].concat(props.children);
|
|
8
|
+
const showArray = children.slice(0, maximum);
|
|
9
|
+
const hideArray = children.slice(maximum);
|
|
10
|
+
return /*#__PURE__*/React.createElement(Space, {
|
|
11
|
+
size: props.space
|
|
12
|
+
}, showArray, hideArray.length !== 0 && /*#__PURE__*/React.createElement(Dropdown, {
|
|
13
|
+
menu: {
|
|
14
|
+
items: hideArray.map((record, index) => {
|
|
15
|
+
return {
|
|
16
|
+
key: index,
|
|
17
|
+
label: record
|
|
18
|
+
};
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
}, /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(MoreOutlined, null))));
|
|
22
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { tools } from '@cqsjjb/jjb-common-lib';
|
|
4
|
+
import { MoreOutlined } from '@ant-design/icons';
|
|
5
|
+
import { Dropdown, Space } from 'antd';
|
|
6
|
+
|
|
7
|
+
export default function TableAction(props) {
|
|
8
|
+
const maximum = props.maximum || 3;
|
|
9
|
+
const children = (tools.isArray(props.children)
|
|
10
|
+
? props.children
|
|
11
|
+
: [].concat(props.children));
|
|
12
|
+
const showArray = children.slice(0, maximum);
|
|
13
|
+
const hideArray = children.slice(maximum);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Space size={props.space}>
|
|
17
|
+
{showArray}
|
|
18
|
+
{hideArray.length !== 0 && (
|
|
19
|
+
<Dropdown
|
|
20
|
+
menu={{
|
|
21
|
+
items: hideArray.map((record, index) => {
|
|
22
|
+
return {
|
|
23
|
+
key: index,
|
|
24
|
+
label: record
|
|
25
|
+
};
|
|
26
|
+
})
|
|
27
|
+
}}
|
|
28
|
+
>
|
|
29
|
+
<a>
|
|
30
|
+
<MoreOutlined />
|
|
31
|
+
</a>
|
|
32
|
+
</Dropdown>
|
|
33
|
+
)}
|
|
34
|
+
</Space>
|
|
35
|
+
);
|
|
36
|
+
}
|