@hw-component/table 0.0.4-beta-v2 → 0.0.4-beta-v6
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/es/HTableFooter/index.d.ts +1 -1
- package/es/ModalTable/hooks.d.ts +322 -0
- package/es/ModalTable/hooks.js +68 -0
- package/es/ModalTable/index.d.ts +3 -0
- package/es/ModalTable/index.js +88 -0
- package/es/Table.js +1 -1
- package/es/TableCustomize.js +4 -2
- package/es/hooks/useReq.d.ts +1 -1
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -0
- package/es/modal.d.ts +22 -0
- package/lib/HTableFooter/index.d.ts +1 -1
- package/lib/ModalTable/hooks.d.ts +322 -0
- package/lib/ModalTable/hooks.js +72 -0
- package/lib/ModalTable/index.d.ts +3 -0
- package/lib/ModalTable/index.js +91 -0
- package/lib/Table.js +1 -1
- package/lib/TableCustomize.js +4 -2
- package/lib/hooks/useReq.d.ts +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +4 -0
- package/lib/modal.d.ts +22 -0
- package/package.json +1 -1
- package/src/components/HTableBody/index.tsx +28 -12
- package/src/components/HTableFooter/index.tsx +27 -16
- package/src/components/HTableHeader/utils.ts +3 -3
- package/src/components/ModalTable/hooks.ts +56 -0
- package/src/components/ModalTable/index.tsx +68 -0
- package/src/components/Table.tsx +22 -21
- package/src/components/TableCustomize.tsx +6 -4
- package/src/components/context.ts +1 -1
- package/src/components/hooks/useCurrentTable.ts +1 -1
- package/src/components/hooks/useHTable.tsx +1 -1
- package/src/components/hooks/useReq.ts +36 -27
- package/src/components/hooks/useRowObj.ts +2 -2
- package/src/components/index.tsx +2 -0
- package/src/components/modal.ts +26 -4
- package/src/pages/ModalTable/index.tsx +95 -0
- package/src/pages/Table/index.tsx +14 -14
- package/src/pages/TableCustomize/index.tsx +28 -25
- package/src/routes.tsx +6 -1
|
@@ -8,25 +8,25 @@ const configData = [
|
|
|
8
8
|
showSearch: true,
|
|
9
9
|
searchType: "select",
|
|
10
10
|
dataIndex: "name",
|
|
11
|
-
itemProps:{
|
|
12
|
-
options:[{label:"1",value:1}]
|
|
13
|
-
}
|
|
11
|
+
itemProps: {
|
|
12
|
+
options: [{ label: "1", value: 1 }],
|
|
13
|
+
},
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
title: "操作",
|
|
17
17
|
name: "aaa",
|
|
18
|
-
fixed:"right",
|
|
19
|
-
width:200,
|
|
18
|
+
fixed: "right",
|
|
19
|
+
width: 200,
|
|
20
20
|
showSearch: true,
|
|
21
|
-
render:()=>{
|
|
22
|
-
return <div>fff</div
|
|
23
|
-
}
|
|
21
|
+
render: () => {
|
|
22
|
+
return <div>fff</div>;
|
|
23
|
+
},
|
|
24
24
|
},
|
|
25
25
|
];
|
|
26
|
-
const Test=({name,selectedRowData})=>{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
26
|
+
const Test = ({ name, selectedRowData }) => {
|
|
27
|
+
console.log(selectedRowData);
|
|
28
|
+
return <div>{name}</div>;
|
|
29
|
+
};
|
|
30
30
|
export default () => {
|
|
31
31
|
const hTable = useHTable();
|
|
32
32
|
return (
|
|
@@ -35,9 +35,9 @@ export default () => {
|
|
|
35
35
|
configData={configData}
|
|
36
36
|
rowKey={"id"}
|
|
37
37
|
table={hTable}
|
|
38
|
-
scroll={{x:1000,y:100}}
|
|
38
|
+
scroll={{ x: 1000, y: 100 }}
|
|
39
39
|
rowSelection={false}
|
|
40
|
-
headerTitle={<Test name="321321"/>}
|
|
40
|
+
headerTitle={<Test name="321321" />}
|
|
41
41
|
actionRender={(allCheck, selectedRowKeys, xjTable) => {
|
|
42
42
|
console.log(allCheck, selectedRowKeys, xjTable);
|
|
43
43
|
return <Button>点我</Button>;
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
HTableFooter,
|
|
6
6
|
HTablePagination,
|
|
7
7
|
} from "../../components";
|
|
8
|
-
import {useRequest} from "ahooks";
|
|
9
|
-
import {Space} from "antd";
|
|
8
|
+
import { useRequest } from "ahooks";
|
|
9
|
+
import { Space } from "antd";
|
|
10
10
|
|
|
11
11
|
const configData = [
|
|
12
12
|
{
|
|
@@ -19,31 +19,34 @@ const configData = [
|
|
|
19
19
|
title: "操作",
|
|
20
20
|
name: "aaa",
|
|
21
21
|
showSearch: true,
|
|
22
|
-
fixed:"right",
|
|
22
|
+
fixed: "right",
|
|
23
23
|
searchType: "rangePicker",
|
|
24
24
|
},
|
|
25
25
|
];
|
|
26
26
|
export default () => {
|
|
27
|
-
const {run,loading,error,data}=useRequest(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
27
|
+
const { run, loading, error, data } = useRequest(
|
|
28
|
+
(params) => {
|
|
29
|
+
const { current = 1 } = params;
|
|
30
|
+
console.log(params, "params");
|
|
31
|
+
return new Promise((resolve, reject) => {
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
// reject(new Error("错误"));
|
|
34
|
+
resolve({
|
|
35
|
+
size: "10",
|
|
36
|
+
current: current.toString(10),
|
|
37
|
+
total: "100",
|
|
38
|
+
records: [
|
|
39
|
+
{
|
|
40
|
+
id: 1,
|
|
41
|
+
name: "111",
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
});
|
|
45
|
+
}, 2000);
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
{ manual: true }
|
|
49
|
+
);
|
|
47
50
|
return (
|
|
48
51
|
<TableCustomize
|
|
49
52
|
configData={configData}
|
|
@@ -52,9 +55,9 @@ export default () => {
|
|
|
52
55
|
dataSource={data}
|
|
53
56
|
reload={run}
|
|
54
57
|
>
|
|
55
|
-
<Space direction={"vertical"} style={{width:"100%"}}>
|
|
58
|
+
<Space direction={"vertical"} style={{ width: "100%" }}>
|
|
56
59
|
<HTableHeader />
|
|
57
|
-
<HTableBody pagination={false} scroll={{x:1000,y:100}}/>
|
|
60
|
+
<HTableBody pagination={false} scroll={{ x: 1000, y: 100 }} />
|
|
58
61
|
<HTablePagination />
|
|
59
62
|
<HTableFooter />
|
|
60
63
|
</Space>
|
package/src/routes.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { Navigate } from "react-router-dom";
|
|
3
3
|
import Table from "./pages/Table";
|
|
4
4
|
import TableCustomize from "./pages/TableCustomize";
|
|
5
|
-
|
|
5
|
+
import ModalTable from "./pages/ModalTable";
|
|
6
6
|
export interface RouteModal {
|
|
7
7
|
path?: string;
|
|
8
8
|
name?: string;
|
|
@@ -27,6 +27,11 @@ const routes: RouteModal[] = [
|
|
|
27
27
|
name: "tableCustomize",
|
|
28
28
|
element: <TableCustomize />,
|
|
29
29
|
},
|
|
30
|
+
{
|
|
31
|
+
path: "/modalTable",
|
|
32
|
+
name: "ModalTable",
|
|
33
|
+
element: <ModalTable />,
|
|
34
|
+
},
|
|
30
35
|
];
|
|
31
36
|
|
|
32
37
|
export default routes;
|