@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.
Files changed (41) hide show
  1. package/es/HTableFooter/index.d.ts +1 -1
  2. package/es/ModalTable/hooks.d.ts +322 -0
  3. package/es/ModalTable/hooks.js +68 -0
  4. package/es/ModalTable/index.d.ts +3 -0
  5. package/es/ModalTable/index.js +88 -0
  6. package/es/Table.js +1 -1
  7. package/es/TableCustomize.js +4 -2
  8. package/es/hooks/useReq.d.ts +1 -1
  9. package/es/index.d.ts +2 -0
  10. package/es/index.js +2 -0
  11. package/es/modal.d.ts +22 -0
  12. package/lib/HTableFooter/index.d.ts +1 -1
  13. package/lib/ModalTable/hooks.d.ts +322 -0
  14. package/lib/ModalTable/hooks.js +72 -0
  15. package/lib/ModalTable/index.d.ts +3 -0
  16. package/lib/ModalTable/index.js +91 -0
  17. package/lib/Table.js +1 -1
  18. package/lib/TableCustomize.js +4 -2
  19. package/lib/hooks/useReq.d.ts +1 -1
  20. package/lib/index.d.ts +2 -0
  21. package/lib/index.js +4 -0
  22. package/lib/modal.d.ts +22 -0
  23. package/package.json +1 -1
  24. package/src/components/HTableBody/index.tsx +28 -12
  25. package/src/components/HTableFooter/index.tsx +27 -16
  26. package/src/components/HTableHeader/utils.ts +3 -3
  27. package/src/components/ModalTable/hooks.ts +56 -0
  28. package/src/components/ModalTable/index.tsx +68 -0
  29. package/src/components/Table.tsx +22 -21
  30. package/src/components/TableCustomize.tsx +6 -4
  31. package/src/components/context.ts +1 -1
  32. package/src/components/hooks/useCurrentTable.ts +1 -1
  33. package/src/components/hooks/useHTable.tsx +1 -1
  34. package/src/components/hooks/useReq.ts +36 -27
  35. package/src/components/hooks/useRowObj.ts +2 -2
  36. package/src/components/index.tsx +2 -0
  37. package/src/components/modal.ts +26 -4
  38. package/src/pages/ModalTable/index.tsx +95 -0
  39. package/src/pages/Table/index.tsx +14 -14
  40. package/src/pages/TableCustomize/index.tsx +28 -25
  41. 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
- console.log(selectedRowData);
28
- return <div>{name}</div>
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((params)=>{
28
- const { current = 1 } = params;
29
- console.log(params,"params")
30
- return new Promise((resolve, reject) => {
31
- setTimeout(() => {
32
- // reject(new Error("错误"));
33
- resolve({
34
- size: "10",
35
- current: current.toString(10),
36
- total: "100",
37
- records: [
38
- {
39
- id: 1,
40
- name: "111",
41
- },
42
- ],
43
- });
44
- }, 2000);
45
- });
46
- },{manual:true});
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;