@hw-component/table 1.10.25 → 1.10.26
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/.eslintcache +1 -1
- package/es/DialogTable/Content.d.ts +1 -1
- package/es/DialogTable/Content.js +3 -1
- package/es/DialogTable/DwEditTable.d.ts +1 -1
- package/es/DialogTable/DwEditTable.js +8 -13
- package/es/DialogTable/ModalEditTable.d.ts +1 -1
- package/es/DialogTable/ModalEditTable.js +8 -11
- package/es/DialogTable/hooks.d.ts +6 -1
- package/es/DialogTable/hooks.js +24 -1
- package/es/EditTable/hooks.d.ts +42 -46
- package/es/EditTable/hooks.js +10 -10
- package/es/EditTable/modal.d.ts +1 -1
- package/es/modal.d.ts +8 -1
- package/es/render/Text.d.ts +0 -1
- package/lib/DialogTable/Content.d.ts +1 -1
- package/lib/DialogTable/Content.js +3 -1
- package/lib/DialogTable/DwEditTable.d.ts +1 -1
- package/lib/DialogTable/DwEditTable.js +7 -12
- package/lib/DialogTable/ModalEditTable.d.ts +1 -1
- package/lib/DialogTable/ModalEditTable.js +7 -10
- package/lib/DialogTable/hooks.d.ts +6 -1
- package/lib/DialogTable/hooks.js +25 -0
- package/lib/EditTable/hooks.d.ts +42 -46
- package/lib/EditTable/hooks.js +10 -10
- package/lib/EditTable/modal.d.ts +1 -1
- package/lib/modal.d.ts +8 -1
- package/lib/render/Text.d.ts +0 -1
- package/package.json +1 -1
- package/src/components/DialogTable/Content.tsx +2 -0
- package/src/components/DialogTable/DwEditTable.tsx +11 -11
- package/src/components/DialogTable/ModalEditTable.tsx +6 -9
- package/src/components/DialogTable/hooks.ts +33 -1
- package/src/components/EditTable/hooks.ts +33 -41
- package/src/components/EditTable/index.tsx +15 -10
- package/src/components/EditTable/modal.ts +10 -7
- package/src/components/modal.ts +8 -1
- package/src/pages/EditTable/index.tsx +12 -10
- package/src/pages/ModalEditTable/index.tsx +17 -2
package/lib/modal.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { AffixProps } from "antd/lib/affix";
|
|
|
10
10
|
import type { OptionModal } from "./HTableBody/modal";
|
|
11
11
|
import type { DrawerProps } from "antd";
|
|
12
12
|
import type { IPaginationProps } from "./HTablePagination";
|
|
13
|
-
import { HEditTableProps } from "./EditTable/modal";
|
|
13
|
+
import { EditTableInstance, HEditTableProps } from "./EditTable/modal";
|
|
14
14
|
export interface RowObj {
|
|
15
15
|
keys?: React.Key[];
|
|
16
16
|
rowData?: any[];
|
|
@@ -124,9 +124,15 @@ export interface HDiaLogTableInstance {
|
|
|
124
124
|
hide: () => void;
|
|
125
125
|
params: any;
|
|
126
126
|
}
|
|
127
|
+
export interface HDiaLogEditTableInstance extends EditTableInstance {
|
|
128
|
+
show: (params?: DialogParamsModal) => void;
|
|
129
|
+
hide: () => void;
|
|
130
|
+
params: any;
|
|
131
|
+
}
|
|
127
132
|
export interface DwTableProps<T = HTableProps["configData"]> extends DrawerProps {
|
|
128
133
|
tableProps?: Omit<HTableProps, "configData" | "request">;
|
|
129
134
|
dialogTable?: HDiaLogTableInstance;
|
|
135
|
+
editDialogTable?: HDiaLogEditTableInstance;
|
|
130
136
|
params?: Record<string, any>;
|
|
131
137
|
configData?: T;
|
|
132
138
|
request?: HTableProps["request"];
|
|
@@ -137,6 +143,7 @@ export interface DwTableProps<T = HTableProps["configData"]> extends DrawerProps
|
|
|
137
143
|
export interface ModalTableProps<T = HTableProps["configData"]> extends Omit<ModalProps, "onOk"> {
|
|
138
144
|
tableProps?: Omit<HTableProps, "configData" | "request">;
|
|
139
145
|
dialogTable?: HDiaLogTableInstance;
|
|
146
|
+
editDialogTable?: HDiaLogEditTableInstance;
|
|
140
147
|
params?: Record<string, any>;
|
|
141
148
|
configData?: T;
|
|
142
149
|
request?: HTableProps["request"];
|
package/lib/render/Text.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -30,10 +30,12 @@ export const EditTableContent = ({
|
|
|
30
30
|
request,
|
|
31
31
|
contentRender,
|
|
32
32
|
dataSource,
|
|
33
|
+
editDialogTable,
|
|
33
34
|
}: ModalTableProps<ProColumns[]>) => {
|
|
34
35
|
const node = (
|
|
35
36
|
<EditTable
|
|
36
37
|
{...editTableProps}
|
|
38
|
+
table={editDialogTable}
|
|
37
39
|
configData={configData || []}
|
|
38
40
|
request={request}
|
|
39
41
|
pagination={{
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { Drawer } from "antd";
|
|
2
2
|
import type { DwTableProps } from "../modal";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
useCurrentTable,
|
|
5
|
+
useEditCurrentTable,
|
|
6
|
+
useTableProps,
|
|
7
|
+
useVisible,
|
|
8
|
+
} from "./hooks";
|
|
4
9
|
import { EditTableContent } from "./Content";
|
|
5
10
|
import { CloseOutlined } from "@ant-design/icons";
|
|
6
11
|
import { useClassName } from "../hooks";
|
|
@@ -10,7 +15,7 @@ export default ({
|
|
|
10
15
|
configData: configDataProps,
|
|
11
16
|
request: requestProps,
|
|
12
17
|
editTableProps = {},
|
|
13
|
-
|
|
18
|
+
editDialogTable,
|
|
14
19
|
visible = false,
|
|
15
20
|
bodyStyle = {},
|
|
16
21
|
onClose,
|
|
@@ -27,7 +32,7 @@ export default ({
|
|
|
27
32
|
configData: configDataProps,
|
|
28
33
|
request: requestProps,
|
|
29
34
|
});
|
|
30
|
-
const currentTable =
|
|
35
|
+
const currentTable = useEditCurrentTable({
|
|
31
36
|
show: (showParams) => {
|
|
32
37
|
if (showParams) {
|
|
33
38
|
setModalTableParams((oldParams) => {
|
|
@@ -60,7 +65,7 @@ export default ({
|
|
|
60
65
|
hide: () => {
|
|
61
66
|
setModalVisible(false);
|
|
62
67
|
},
|
|
63
|
-
|
|
68
|
+
editDialogTable,
|
|
64
69
|
});
|
|
65
70
|
const { configData, request, dataSource, title, params } = modalTableParams;
|
|
66
71
|
const req = request
|
|
@@ -91,18 +96,13 @@ export default ({
|
|
|
91
96
|
}
|
|
92
97
|
width={width}
|
|
93
98
|
bodyStyle={{ padding: 0, paddingBottom: 12, ...bodyStyle }}
|
|
94
|
-
afterVisibleChange={
|
|
95
|
-
if (!changeVisible) {
|
|
96
|
-
currentTable.form.resetFields();
|
|
97
|
-
}
|
|
98
|
-
afterVisibleChange?.(changeVisible);
|
|
99
|
-
}}
|
|
99
|
+
afterVisibleChange={afterVisibleChange}
|
|
100
100
|
>
|
|
101
101
|
<EditTableContent
|
|
102
102
|
contentRender={contentRender}
|
|
103
103
|
editTableProps={editTableProps}
|
|
104
104
|
configData={configData || []}
|
|
105
|
-
|
|
105
|
+
editDialogTable={currentTable}
|
|
106
106
|
request={req}
|
|
107
107
|
dataSource={dataSource}
|
|
108
108
|
/>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Modal } from "antd";
|
|
2
2
|
import type { ModalTableProps } from "../modal";
|
|
3
|
-
import {
|
|
3
|
+
import { useEditCurrentTable, useTableProps, useVisible } from "./hooks";
|
|
4
4
|
import { EditTableContent } from "./Content";
|
|
5
5
|
import { ProColumns } from "@ant-design/pro-table/lib/typing";
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ export default ({
|
|
|
8
8
|
configData: configDataProps,
|
|
9
9
|
request: requestProps,
|
|
10
10
|
editTableProps = {},
|
|
11
|
-
|
|
11
|
+
editDialogTable,
|
|
12
12
|
visible = false,
|
|
13
13
|
onCancel,
|
|
14
14
|
bodyStyle = {},
|
|
@@ -26,7 +26,7 @@ export default ({
|
|
|
26
26
|
request: requestProps,
|
|
27
27
|
}
|
|
28
28
|
);
|
|
29
|
-
const currentTable =
|
|
29
|
+
const currentTable = useEditCurrentTable({
|
|
30
30
|
show: (showParams) => {
|
|
31
31
|
if (showParams) {
|
|
32
32
|
setModalTableParams((oldParams) => {
|
|
@@ -59,7 +59,7 @@ export default ({
|
|
|
59
59
|
hide: () => {
|
|
60
60
|
setModalVisible(false);
|
|
61
61
|
},
|
|
62
|
-
|
|
62
|
+
editDialogTable,
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
const { configData, dataSource, request, title, params } = modalTableParams;
|
|
@@ -81,16 +81,13 @@ export default ({
|
|
|
81
81
|
title={title}
|
|
82
82
|
width={width}
|
|
83
83
|
bodyStyle={{ padding: "0px 0px 12px", ...bodyStyle }}
|
|
84
|
-
afterClose={
|
|
85
|
-
currentTable.form.resetFields();
|
|
86
|
-
afterClose?.();
|
|
87
|
-
}}
|
|
84
|
+
afterClose={afterClose}
|
|
88
85
|
>
|
|
89
86
|
<EditTableContent
|
|
90
87
|
contentRender={contentRender}
|
|
91
88
|
editTableProps={editTableProps}
|
|
92
89
|
configData={configData || []}
|
|
93
|
-
|
|
90
|
+
editDialogTable={currentTable}
|
|
94
91
|
request={req}
|
|
95
92
|
dataSource={dataSource}
|
|
96
93
|
/>
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import useHTable from "../hooks/useHTable";
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
3
|
HDiaLogTableInstance,
|
|
4
4
|
HOnDiaLogTableInstance,
|
|
5
5
|
ModalTableProps,
|
|
6
6
|
DialogParamsModal,
|
|
7
|
+
HDiaLogEditTableInstance,
|
|
7
8
|
} from "../modal";
|
|
8
9
|
import { useEffect, useMemo, useState } from "react";
|
|
10
|
+
import { useEditTable } from "../EditTable/hooks";
|
|
9
11
|
|
|
10
12
|
export const useHDialogTable = () => {
|
|
11
13
|
const tableInstance = useHTable();
|
|
@@ -18,10 +20,27 @@ export const useHDialogTable = () => {
|
|
|
18
20
|
} as HDiaLogTableInstance;
|
|
19
21
|
}, []);
|
|
20
22
|
};
|
|
23
|
+
|
|
24
|
+
export const useHDialogEditTable = () => {
|
|
25
|
+
const editTable = useEditTable();
|
|
26
|
+
return useMemo(() => {
|
|
27
|
+
return {
|
|
28
|
+
...editTable,
|
|
29
|
+
show: (params: DialogParamsModal) => {},
|
|
30
|
+
hide: () => {},
|
|
31
|
+
params: {},
|
|
32
|
+
} as HDiaLogEditTableInstance;
|
|
33
|
+
}, []);
|
|
34
|
+
};
|
|
35
|
+
|
|
21
36
|
interface ParamsModal extends HOnDiaLogTableInstance {
|
|
22
37
|
dialogTable?: HDiaLogTableInstance;
|
|
23
38
|
}
|
|
24
39
|
|
|
40
|
+
interface EditParamsModal extends HOnDiaLogTableInstance {
|
|
41
|
+
editDialogTable?: HDiaLogEditTableInstance;
|
|
42
|
+
}
|
|
43
|
+
|
|
25
44
|
type TablePropsModal<T> = Omit<ModalTableProps<T>, "tableProps">;
|
|
26
45
|
|
|
27
46
|
export function useTableProps<T>({
|
|
@@ -70,6 +89,19 @@ export const useCurrentTable = ({ show, hide, dialogTable }: ParamsModal) => {
|
|
|
70
89
|
}, []);
|
|
71
90
|
return dialogTableInstance;
|
|
72
91
|
};
|
|
92
|
+
export const useEditCurrentTable = ({
|
|
93
|
+
show,
|
|
94
|
+
hide,
|
|
95
|
+
editDialogTable,
|
|
96
|
+
}: EditParamsModal) => {
|
|
97
|
+
const cuDialogTableInstance = useHDialogEditTable();
|
|
98
|
+
const dialogTableInstance = editDialogTable || cuDialogTableInstance;
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
dialogTableInstance.show = show;
|
|
101
|
+
dialogTableInstance.hide = hide;
|
|
102
|
+
}, []);
|
|
103
|
+
return dialogTableInstance;
|
|
104
|
+
};
|
|
73
105
|
|
|
74
106
|
export const useVisible = (visible: boolean) => {
|
|
75
107
|
const [modalVisible, setModalVisible] = useState(false);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useRequest } from "ahooks";
|
|
2
|
-
import {EditTableInstance, HEditTableProps} from "./modal";
|
|
3
|
-
import
|
|
2
|
+
import { EditTableInstance, HEditTableProps } from "./modal";
|
|
3
|
+
import { MutableRefObject, useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import type { ActionType } from "@ant-design/pro-table";
|
|
5
5
|
import { EditableFormInstance } from "@ant-design/pro-table/lib/components/EditableTable";
|
|
6
6
|
import config from "../render/config";
|
|
@@ -61,53 +61,45 @@ export const useListRequest = ({
|
|
|
61
61
|
};
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
export const
|
|
65
|
-
const defaultActionRef = useRef<ActionType>();
|
|
66
|
-
const defaultTableRef = useRef<EditableFormInstance>();
|
|
67
|
-
const cuActionRef = (actionRef ||
|
|
68
|
-
defaultActionRef) as MutableRefObject<ActionType>;
|
|
69
|
-
const cuEditableFormRef = (editableFormRef ||
|
|
70
|
-
defaultTableRef) as MutableRefObject<EditableFormInstance>;
|
|
64
|
+
export const useEditTable = (): EditTableInstance => {
|
|
71
65
|
return {
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
reload: () => {
|
|
67
|
+
return Promise.resolve();
|
|
68
|
+
},
|
|
69
|
+
editableForm: {},
|
|
70
|
+
action: {},
|
|
74
71
|
};
|
|
75
72
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return Promise.resolve();
|
|
81
|
-
},
|
|
82
|
-
editableForm:{},
|
|
83
|
-
action:{}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
export const useCuEditTable=({table}:HEditTableProps)=>{
|
|
87
|
-
const cuTable=useEditTable();
|
|
88
|
-
return table||cuTable;
|
|
89
|
-
}
|
|
73
|
+
export const useCuEditTable = ({ table }: HEditTableProps) => {
|
|
74
|
+
const cuTable = useEditTable();
|
|
75
|
+
return table || cuTable;
|
|
76
|
+
};
|
|
90
77
|
|
|
91
78
|
interface EditTableInitParams {
|
|
92
|
-
table:EditTableInstance;
|
|
93
|
-
actionRef:MutableRefObject<ActionType | undefined>;
|
|
94
|
-
editableFormRef:MutableRefObject<EditableFormInstance | undefined>;
|
|
95
|
-
request:VoidFunction;
|
|
79
|
+
table: EditTableInstance;
|
|
80
|
+
actionRef: MutableRefObject<ActionType | undefined>;
|
|
81
|
+
editableFormRef: MutableRefObject<EditableFormInstance | undefined>;
|
|
82
|
+
request: VoidFunction;
|
|
96
83
|
}
|
|
97
84
|
|
|
98
|
-
export const useEditTableInit = ({
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
85
|
+
export const useEditTableInit = ({
|
|
86
|
+
table,
|
|
87
|
+
actionRef,
|
|
88
|
+
editableFormRef,
|
|
89
|
+
request,
|
|
90
|
+
}: EditTableInitParams) => {
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (!table) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
103
95
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
96
|
+
table.editableForm = editableFormRef?.current || {};
|
|
97
|
+
table.reload = () => {
|
|
98
|
+
request();
|
|
99
|
+
};
|
|
100
|
+
table.action = actionRef?.current || {};
|
|
101
|
+
}, [actionRef, editableFormRef, table]);
|
|
102
|
+
};
|
|
111
103
|
|
|
112
104
|
interface ColProps extends HEditTableProps {
|
|
113
105
|
reload: VoidFunction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {type ActionType, EditableProTable} from "@ant-design/pro-table";
|
|
1
|
+
import { type ActionType, EditableProTable } from "@ant-design/pro-table";
|
|
2
2
|
import { HEditTableProps } from "./modal";
|
|
3
3
|
import { useClassName } from "../hooks";
|
|
4
4
|
import HTablePagination from "../HTablePagination";
|
|
@@ -8,9 +8,14 @@ import {
|
|
|
8
8
|
errorDefaultRender,
|
|
9
9
|
} from "../HTableBody/defaultRender";
|
|
10
10
|
import { useHTableConfigContext } from "../TableConfig";
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
import {
|
|
12
|
+
useColsMk,
|
|
13
|
+
useCuEditTable,
|
|
14
|
+
useEditTableInit,
|
|
15
|
+
useListRequest,
|
|
16
|
+
} from "./hooks";
|
|
17
|
+
import React, { useRef } from "react";
|
|
18
|
+
import { EditableFormInstance } from "@ant-design/pro-table/lib/components/EditableTable";
|
|
14
19
|
|
|
15
20
|
export default ({
|
|
16
21
|
configData,
|
|
@@ -31,7 +36,7 @@ export default ({
|
|
|
31
36
|
table,
|
|
32
37
|
...props
|
|
33
38
|
}: HEditTableProps) => {
|
|
34
|
-
const cuTable=useCuEditTable({table});
|
|
39
|
+
const cuTable = useCuEditTable({ table });
|
|
35
40
|
const tableBody = useClassName("hw-table-body");
|
|
36
41
|
const { loading, data, error, run } = useListRequest({
|
|
37
42
|
request,
|
|
@@ -46,11 +51,11 @@ export default ({
|
|
|
46
51
|
const defaultEditableFormRef = useRef<EditableFormInstance>();
|
|
47
52
|
|
|
48
53
|
useEditTableInit({
|
|
49
|
-
|
|
50
|
-
editableFormRef:defaultEditableFormRef,
|
|
51
|
-
table:cuTable,
|
|
52
|
-
request:run
|
|
53
|
-
})
|
|
54
|
+
actionRef: defaultActionRef,
|
|
55
|
+
editableFormRef: defaultEditableFormRef,
|
|
56
|
+
table: cuTable,
|
|
57
|
+
request: run,
|
|
58
|
+
});
|
|
54
59
|
const columns = useColsMk({ configData, reload: run });
|
|
55
60
|
return (
|
|
56
61
|
<div className={tableBody} style={style}>
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
EditableFormInstance,
|
|
3
|
+
EditableProTableProps,
|
|
4
|
+
} from "@ant-design/pro-table/lib/components/EditableTable";
|
|
2
5
|
import { ParamsType } from "@ant-design/pro-provider";
|
|
3
6
|
import { IPaginationProps } from "../HTablePagination";
|
|
4
7
|
import { EmptyPageRender, ErrorPageRender } from "../modal";
|
|
5
|
-
import {ActionType, ProColumns} from "@ant-design/pro-table/lib/typing";
|
|
8
|
+
import { ActionType, ProColumns } from "@ant-design/pro-table/lib/typing";
|
|
6
9
|
|
|
7
10
|
export interface EditTableInstance {
|
|
8
|
-
editableForm:EditableFormInstance|{};
|
|
9
|
-
action:ActionType|{};
|
|
10
|
-
reload:()=>void;
|
|
11
|
+
editableForm: EditableFormInstance | {};
|
|
12
|
+
action: ActionType | {};
|
|
13
|
+
reload: () => void;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
export interface HEditTableProps<T = any>
|
|
@@ -21,7 +24,7 @@ export interface HEditTableProps<T = any>
|
|
|
21
24
|
EditableProTableProps<T, ParamsType>["recordCreatorProps"]
|
|
22
25
|
>;
|
|
23
26
|
dataSource?: any[];
|
|
24
|
-
request?: (params
|
|
27
|
+
request?: (params: Record<string, any>) => Promise<T>;
|
|
25
28
|
pagination?: IPaginationProps | false;
|
|
26
29
|
manual?: boolean;
|
|
27
30
|
emptyRender?: EmptyPageRender;
|
|
@@ -29,5 +32,5 @@ export interface HEditTableProps<T = any>
|
|
|
29
32
|
onAdd?: (data: T) => Promise<void>;
|
|
30
33
|
onEdit?: (data: T) => Promise<void>;
|
|
31
34
|
configData?: ProColumns<T>[];
|
|
32
|
-
table?:EditTableInstance;
|
|
35
|
+
table?: EditTableInstance;
|
|
33
36
|
}
|
package/src/components/modal.ts
CHANGED
|
@@ -13,7 +13,7 @@ import type { AffixProps } from "antd/lib/affix";
|
|
|
13
13
|
import type { OptionModal } from "./HTableBody/modal";
|
|
14
14
|
import type { DrawerProps } from "antd";
|
|
15
15
|
import type { IPaginationProps } from "./HTablePagination";
|
|
16
|
-
import { HEditTableProps } from "./EditTable/modal";
|
|
16
|
+
import { EditTableInstance, HEditTableProps } from "./EditTable/modal";
|
|
17
17
|
|
|
18
18
|
export interface RowObj {
|
|
19
19
|
keys?: React.Key[];
|
|
@@ -161,10 +161,16 @@ export interface HDiaLogTableInstance {
|
|
|
161
161
|
hide: () => void;
|
|
162
162
|
params: any;
|
|
163
163
|
}
|
|
164
|
+
export interface HDiaLogEditTableInstance extends EditTableInstance {
|
|
165
|
+
show: (params?: DialogParamsModal) => void;
|
|
166
|
+
hide: () => void;
|
|
167
|
+
params: any;
|
|
168
|
+
}
|
|
164
169
|
export interface DwTableProps<T = HTableProps["configData"]>
|
|
165
170
|
extends DrawerProps {
|
|
166
171
|
tableProps?: Omit<HTableProps, "configData" | "request">;
|
|
167
172
|
dialogTable?: HDiaLogTableInstance;
|
|
173
|
+
editDialogTable?: HDiaLogEditTableInstance;
|
|
168
174
|
params?: Record<string, any>;
|
|
169
175
|
configData?: T;
|
|
170
176
|
request?: HTableProps["request"];
|
|
@@ -177,6 +183,7 @@ export interface ModalTableProps<T = HTableProps["configData"]>
|
|
|
177
183
|
extends Omit<ModalProps, "onOk"> {
|
|
178
184
|
tableProps?: Omit<HTableProps, "configData" | "request">;
|
|
179
185
|
dialogTable?: HDiaLogTableInstance;
|
|
186
|
+
editDialogTable?: HDiaLogEditTableInstance;
|
|
180
187
|
params?: Record<string, any>;
|
|
181
188
|
configData?: T;
|
|
182
189
|
request?: HTableProps["request"];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HEditTable
|
|
1
|
+
import { HEditTable, useEditTable } from "@/components";
|
|
2
2
|
import { useRef, useState } from "react";
|
|
3
3
|
import type { ActionType } from "@ant-design/pro-table";
|
|
4
4
|
|
|
@@ -11,12 +11,16 @@ const dataSource = [
|
|
|
11
11
|
];
|
|
12
12
|
export default () => {
|
|
13
13
|
const [cuData, setCuData] = useState(dataSource);
|
|
14
|
-
const editTableInstance=useEditTable();
|
|
14
|
+
const editTableInstance = useEditTable();
|
|
15
15
|
return (
|
|
16
16
|
<div>
|
|
17
|
-
<div
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
<div
|
|
18
|
+
onClick={() => {
|
|
19
|
+
editTableInstance.reload();
|
|
20
|
+
}}
|
|
21
|
+
>
|
|
22
|
+
刷新
|
|
23
|
+
</div>
|
|
20
24
|
<HEditTable
|
|
21
25
|
table={editTableInstance}
|
|
22
26
|
onAdd={async (data) => {
|
|
@@ -28,11 +32,9 @@ export default () => {
|
|
|
28
32
|
setCuData(newData);
|
|
29
33
|
}}
|
|
30
34
|
onEdit={async (data) => {}}
|
|
31
|
-
request={()=>{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
35
|
+
request={() => {
|
|
36
|
+
console.log("fffff");
|
|
37
|
+
return {};
|
|
36
38
|
}}
|
|
37
39
|
configData={[
|
|
38
40
|
{ title: "标题", dataIndex: "title" },
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HDwEditTable, useHDialogTable } from "@/components";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
+
import { useHDialogEditTable } from "@/components/DialogTable/hooks";
|
|
3
4
|
|
|
4
5
|
const dataSource = [
|
|
5
6
|
{
|
|
@@ -26,7 +27,7 @@ const dataSource = [
|
|
|
26
27
|
];
|
|
27
28
|
|
|
28
29
|
export default () => {
|
|
29
|
-
const dialogTable =
|
|
30
|
+
const dialogTable = useHDialogEditTable();
|
|
30
31
|
const [cuData, setCuData] = useState(dataSource);
|
|
31
32
|
|
|
32
33
|
return (
|
|
@@ -40,6 +41,20 @@ export default () => {
|
|
|
40
41
|
</div>
|
|
41
42
|
<HDwEditTable
|
|
42
43
|
title="编辑"
|
|
44
|
+
contentRender={(node) => {
|
|
45
|
+
return (
|
|
46
|
+
<>
|
|
47
|
+
<div
|
|
48
|
+
onClick={() => {
|
|
49
|
+
dialogTable.reload();
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
点我
|
|
53
|
+
</div>
|
|
54
|
+
{node}
|
|
55
|
+
</>
|
|
56
|
+
);
|
|
57
|
+
}}
|
|
43
58
|
request={() => {
|
|
44
59
|
return new Promise((resolve) => {
|
|
45
60
|
setTimeout(() => {
|
|
@@ -61,7 +76,7 @@ export default () => {
|
|
|
61
76
|
onAdd: async (data) => {},
|
|
62
77
|
onEdit: async (data) => {},
|
|
63
78
|
}}
|
|
64
|
-
|
|
79
|
+
editDialogTable={dialogTable}
|
|
65
80
|
configData={[
|
|
66
81
|
{ title: "标题", dataIndex: "title" },
|
|
67
82
|
{ title: "标题2", dataIndex: "time", valueType: "date" },
|