@hw-component/table 1.10.17 → 1.10.19
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/HTableBody/Options/Content.js +4 -1
- package/es/HTableBody/Options/Title.js +8 -2
- package/es/HTableBody/Options/hooks.d.ts +1 -1
- package/es/HTableBody/hooks/useColData.d.ts +2 -1
- package/es/HTableBody/hooks/useColData.js +20 -4
- package/es/HTableBody/hooks/useControl.js +4 -12
- package/es/HTableBody/utils.d.ts +0 -1
- package/es/HTableBody/utils.js +0 -2
- package/es/Table.js +18 -8
- package/es/TableCustomize.js +17 -7
- package/es/hooks/useReq.d.ts +15 -6
- package/es/hooks/useReq.js +34 -37
- package/es/modal.d.ts +1 -1
- package/lib/HTableBody/Options/Content.js +4 -1
- package/lib/HTableBody/Options/Title.js +8 -2
- package/lib/HTableBody/Options/hooks.d.ts +1 -1
- package/lib/HTableBody/hooks/useColData.d.ts +2 -1
- package/lib/HTableBody/hooks/useColData.js +19 -3
- package/lib/HTableBody/hooks/useControl.js +4 -12
- package/lib/HTableBody/utils.d.ts +0 -1
- package/lib/HTableBody/utils.js +0 -2
- package/lib/Table.js +18 -8
- package/lib/TableCustomize.js +17 -7
- package/lib/hooks/useReq.d.ts +15 -6
- package/lib/hooks/useReq.js +34 -37
- package/lib/modal.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/DialogTable/Content.tsx +1 -1
- package/src/components/EditTable/hooks.ts +28 -28
- package/src/components/EditTable/index.tsx +5 -3
- package/src/components/EditTable/modal.ts +1 -1
- package/src/components/HTableBody/Options/Content.tsx +4 -1
- package/src/components/HTableBody/Options/Title.tsx +8 -2
- package/src/components/HTableBody/Options/hooks.tsx +23 -22
- package/src/components/HTableBody/Options/index.tsx +2 -2
- package/src/components/HTableBody/Options/modal.d.ts +7 -2
- package/src/components/HTableBody/hooks/useColData.tsx +43 -30
- package/src/components/HTableBody/hooks/useColMk.ts +79 -74
- package/src/components/HTableBody/hooks/useControl.tsx +1 -4
- package/src/components/HTableBody/index.tsx +3 -2
- package/src/components/HTableBody/utils.ts +1 -7
- package/src/components/Table.tsx +18 -6
- package/src/components/TableCustomize.tsx +19 -6
- package/src/components/hooks/useReq.ts +23 -9
- package/src/components/modal.ts +1 -1
- package/src/pages/EditTable/index.tsx +1 -7
- package/src/pages/ModalEditTable/index.tsx +29 -27
- package/src/pages/Table/index.tsx +60 -52
|
@@ -1,83 +1,88 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type {
|
|
2
|
+
ConfigItemModal,
|
|
3
|
+
HRowSelection,
|
|
4
|
+
HTableInstance,
|
|
5
|
+
HTableProps,
|
|
6
|
+
} from "../../modal";
|
|
7
|
+
import { useClassName } from "../../hooks";
|
|
8
|
+
import { useHTableConfigContext } from "../../TableConfig";
|
|
9
|
+
import { textTypes } from "../../render/config";
|
|
5
10
|
import configRender from "../../render";
|
|
6
|
-
import {useMemo} from "react";
|
|
7
|
-
import {checkBoxSelectionCol, radioSelectionCol} from "./colsMk";
|
|
11
|
+
import { useMemo } from "react";
|
|
12
|
+
import { checkBoxSelectionCol, radioSelectionCol } from "./colsMk";
|
|
8
13
|
|
|
9
14
|
const checkBoxMk = (rowSelection: HRowSelection) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
const { type } = rowSelection;
|
|
16
|
+
if (type === "radio") {
|
|
17
|
+
return radioSelectionCol(rowSelection);
|
|
18
|
+
}
|
|
19
|
+
return checkBoxSelectionCol(rowSelection);
|
|
15
20
|
};
|
|
16
21
|
|
|
17
22
|
export default ({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
23
|
+
configData,
|
|
24
|
+
rowSelection,
|
|
25
|
+
table,
|
|
26
|
+
bordered,
|
|
27
|
+
configItemRender,
|
|
28
|
+
}: HTableProps) => {
|
|
29
|
+
const trClassname = useClassName("hw-table-col-hr");
|
|
30
|
+
const { valueTypeConfig } = useHTableConfigContext({});
|
|
31
|
+
const itemClassNameMk = (children: any[], lastChildren: any[]) => {
|
|
32
|
+
const lastChildLen = (lastChildren as any[]).length;
|
|
33
|
+
const childLen = children.length;
|
|
34
|
+
return !childLen && !!lastChildLen ? trClassname : "";
|
|
35
|
+
};
|
|
36
|
+
const colChild = (children?: ConfigItemModal[]) => {
|
|
37
|
+
if (!children) {
|
|
38
|
+
return children;
|
|
39
|
+
}
|
|
40
|
+
return children.map((item) => {
|
|
41
|
+
return itemProvider(item);
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
function itemProvider(item: ConfigItemModal, lastItem?: ConfigItemModal) {
|
|
45
|
+
const { children: lastChildren = [] } = lastItem || {};
|
|
46
|
+
const {
|
|
47
|
+
valueType = "",
|
|
48
|
+
valueTypeProps = {},
|
|
49
|
+
className = "",
|
|
50
|
+
children = [],
|
|
51
|
+
} = item;
|
|
47
52
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
const trClassName = bordered
|
|
54
|
+
? ""
|
|
55
|
+
: itemClassNameMk(children as any[], lastChildren as any[]);
|
|
56
|
+
const itemType = valueType as string;
|
|
57
|
+
if (textTypes.indexOf(itemType) !== -1) {
|
|
58
|
+
const { ellipsis } = valueTypeProps;
|
|
59
|
+
return {
|
|
60
|
+
...item,
|
|
61
|
+
ellipsis: ellipsis,
|
|
62
|
+
className: `${className} ${trClassName}`,
|
|
63
|
+
render: configRender(item, table as HTableInstance, valueTypeConfig),
|
|
64
|
+
children: colChild(children),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
62
67
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
return {
|
|
69
|
+
...item,
|
|
70
|
+
className: `${className} ${trClassName}`,
|
|
71
|
+
render: configRender(item, table as HTableInstance, valueTypeConfig),
|
|
72
|
+
children: colChild(children),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return useMemo(() => {
|
|
76
|
+
const colsArray = configData.filter((item) => {
|
|
77
|
+
return !item.hideInTable;
|
|
78
|
+
});
|
|
79
|
+
if (rowSelection !== false) {
|
|
80
|
+
colsArray.splice(0, 0, checkBoxMk(rowSelection || {}) as any);
|
|
69
81
|
}
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return colsArray.map((item, index) => {
|
|
78
|
-
const lastItem = colsArray[index - 1];
|
|
79
|
-
const resultItem = itemProvider(item, lastItem);
|
|
80
|
-
return configItemRender ? configItemRender(resultItem) : resultItem;
|
|
81
|
-
});
|
|
82
|
-
},[configData, table, rowSelection])
|
|
83
|
-
}
|
|
82
|
+
return colsArray.map((item, index) => {
|
|
83
|
+
const lastItem = colsArray[index - 1];
|
|
84
|
+
const resultItem = itemProvider(item, lastItem);
|
|
85
|
+
return configItemRender ? configItemRender(resultItem) : resultItem;
|
|
86
|
+
});
|
|
87
|
+
}, [configData, table, rowSelection]);
|
|
88
|
+
};
|
|
@@ -66,10 +66,7 @@ export const useTableChange = ({
|
|
|
66
66
|
const asc = typeof order === "undefined" ? undefined : order === "ascend";
|
|
67
67
|
tableInstance?.table.reloadWithParams({
|
|
68
68
|
current: 1,
|
|
69
|
-
|
|
70
|
-
asc,
|
|
71
|
-
...filtersMk(filters),
|
|
72
|
-
});
|
|
69
|
+
},filtersMk(filters),{orderByField,asc});
|
|
73
70
|
};
|
|
74
71
|
};
|
|
75
72
|
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
useSynchronousKeys,
|
|
6
6
|
useAlwaysShowAlert,
|
|
7
7
|
} from "./hooks/useControl";
|
|
8
|
-
import {
|
|
8
|
+
import { useColumnsStateType } from "./hooks/useColData";
|
|
9
9
|
import { useHTableContext } from "../context";
|
|
10
10
|
import React from "react";
|
|
11
11
|
import { ConfigProvider, Alert, Space } from "antd";
|
|
@@ -85,7 +85,8 @@ export default (bodyProps: HTableBodyProps) => {
|
|
|
85
85
|
bordered,
|
|
86
86
|
configItemRender: tableConfigItemRender,
|
|
87
87
|
});
|
|
88
|
-
const { value, onChange, resetCol,dropChange, ...selfColStatus } =
|
|
88
|
+
const { value, onChange, resetCol, dropChange, ...selfColStatus } =
|
|
89
|
+
useColumnsStateType({
|
|
89
90
|
columnsState,
|
|
90
91
|
columns: cols,
|
|
91
92
|
});
|
|
@@ -19,8 +19,7 @@ const strToJson = (str: string | null) => {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export const mkChangeValue = (columnsState?: ColumnsStateType) => {
|
|
22
|
-
const { persistenceType, persistenceKey, value
|
|
23
|
-
columnsState || {};
|
|
22
|
+
const { persistenceType, persistenceKey, value } = columnsState || {};
|
|
24
23
|
if (value) {
|
|
25
24
|
return value;
|
|
26
25
|
}
|
|
@@ -91,8 +90,3 @@ export const outColSetting = (
|
|
|
91
90
|
keys,
|
|
92
91
|
};
|
|
93
92
|
};
|
|
94
|
-
interface RowItemFnModal {}
|
|
95
|
-
|
|
96
|
-
export const rowItemFn = (action, record, index) => {
|
|
97
|
-
return typeof action === "function" ? action(record, index) : record[action];
|
|
98
|
-
};
|
package/src/components/Table.tsx
CHANGED
|
@@ -53,16 +53,26 @@ export default ({
|
|
|
53
53
|
table,
|
|
54
54
|
reload: (params) => {
|
|
55
55
|
rowSelectionReload();
|
|
56
|
-
return run(
|
|
56
|
+
return run({
|
|
57
|
+
params
|
|
58
|
+
});
|
|
57
59
|
},
|
|
58
60
|
changeRowData: rowOnChange,
|
|
59
61
|
dispatch,
|
|
60
|
-
reloadWithParams: (reloadParams = {}) => {
|
|
62
|
+
reloadWithParams: (reloadParams = {},filters?:any,sorter?:any) => {
|
|
61
63
|
rowSelectionReload();
|
|
62
|
-
return run({
|
|
64
|
+
return run({
|
|
65
|
+
params:reloadParams,
|
|
66
|
+
filters,
|
|
67
|
+
sorter
|
|
68
|
+
});
|
|
63
69
|
},
|
|
64
70
|
getTableParams: () => {
|
|
65
|
-
return
|
|
71
|
+
return {
|
|
72
|
+
... saveParams.oldParams,
|
|
73
|
+
...saveParams.filters,
|
|
74
|
+
...saveParams.sorter
|
|
75
|
+
}
|
|
66
76
|
},
|
|
67
77
|
selectedRowData,
|
|
68
78
|
dataSource: data,
|
|
@@ -74,8 +84,10 @@ export default ({
|
|
|
74
84
|
tableInstance={tableInstance}
|
|
75
85
|
onFinish={(value) => {
|
|
76
86
|
rowSelectionReload();
|
|
77
|
-
const { size } = saveParams.
|
|
78
|
-
return run({
|
|
87
|
+
const { size } = saveParams.oldParams as Record<string, any>;
|
|
88
|
+
return run({
|
|
89
|
+
params:{ ...value, current: 1, size }
|
|
90
|
+
});
|
|
79
91
|
}}
|
|
80
92
|
selectedRowData={selectedRowData}
|
|
81
93
|
rowOnChange={rowOnChange}
|
|
@@ -6,6 +6,7 @@ import type { IParamsModal } from "./hooks/useReq";
|
|
|
6
6
|
import useReq from "./hooks/useReq";
|
|
7
7
|
import useDispatch from "./hooks/useDispatch";
|
|
8
8
|
import React, { useState } from "react";
|
|
9
|
+
|
|
9
10
|
const Index: React.FC<HTableProps> = ({
|
|
10
11
|
request,
|
|
11
12
|
configData,
|
|
@@ -31,16 +32,26 @@ const Index: React.FC<HTableProps> = ({
|
|
|
31
32
|
table,
|
|
32
33
|
reload: (params) => {
|
|
33
34
|
rowOnChange([], []);
|
|
34
|
-
return run(
|
|
35
|
+
return run({
|
|
36
|
+
params
|
|
37
|
+
});
|
|
35
38
|
},
|
|
36
39
|
changeRowData: rowOnChange,
|
|
37
40
|
dispatch,
|
|
38
|
-
reloadWithParams: (reloadParams = {}) => {
|
|
41
|
+
reloadWithParams: (reloadParams = {},filters?:any,sorter?:any) => {
|
|
39
42
|
rowOnChange([], []);
|
|
40
|
-
return run({
|
|
43
|
+
return run({
|
|
44
|
+
params:{ ...saveParams.oldParams, ...reloadParams },
|
|
45
|
+
filters,
|
|
46
|
+
sorter
|
|
47
|
+
});
|
|
41
48
|
},
|
|
42
49
|
getTableParams: () => {
|
|
43
|
-
return
|
|
50
|
+
return {
|
|
51
|
+
... saveParams.oldParams,
|
|
52
|
+
...saveParams.filters,
|
|
53
|
+
...saveParams.sorter
|
|
54
|
+
}
|
|
44
55
|
},
|
|
45
56
|
selectedRowData,
|
|
46
57
|
dataSource: data,
|
|
@@ -57,10 +68,12 @@ const Index: React.FC<HTableProps> = ({
|
|
|
57
68
|
allSelectChange,
|
|
58
69
|
action,
|
|
59
70
|
configData,
|
|
60
|
-
params: saveParams.
|
|
71
|
+
params: saveParams.oldParams,
|
|
61
72
|
onFinish: (value) => {
|
|
62
73
|
rowOnChange([], []);
|
|
63
|
-
return run({
|
|
74
|
+
return run({
|
|
75
|
+
params:{ ...saveParams.oldParams, ...value, current: 1 }
|
|
76
|
+
});
|
|
64
77
|
},
|
|
65
78
|
onPageChange: tableInstance.table.reloadWithParams,
|
|
66
79
|
setSelectedRowData,
|
|
@@ -58,6 +58,13 @@ const useDataSource = ({ reload, dataSource }: IParamsModal) => {
|
|
|
58
58
|
dataSource: cpDataSource,
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
|
+
|
|
62
|
+
interface RequestParams {
|
|
63
|
+
params?:Record<string, any>;
|
|
64
|
+
filters?:any;
|
|
65
|
+
sorter?:any;
|
|
66
|
+
}
|
|
67
|
+
|
|
61
68
|
export default ({
|
|
62
69
|
request,
|
|
63
70
|
loading,
|
|
@@ -69,25 +76,32 @@ export default ({
|
|
|
69
76
|
}: IParamsModal) => {
|
|
70
77
|
const saveParams = useMemo(() => {
|
|
71
78
|
return {
|
|
72
|
-
|
|
79
|
+
oldParams: {},
|
|
80
|
+
filters:{},
|
|
81
|
+
sorter:{}
|
|
73
82
|
};
|
|
74
83
|
}, []);
|
|
75
84
|
const { reload: localReload, dataSource: localDataSource } = useDataSource({
|
|
76
85
|
reload,
|
|
77
86
|
dataSource,
|
|
78
87
|
});
|
|
79
|
-
const
|
|
88
|
+
const getReqParams=(reqParams?:RequestParams)=>{
|
|
89
|
+
const {params={},filters,sorter}=reqParams||{};
|
|
80
90
|
const { size = "10", current = "1", ...oParams } = params;
|
|
81
91
|
const requestParams = { size, current, ...oParams };
|
|
82
|
-
saveParams.
|
|
83
|
-
|
|
92
|
+
const cuFilters=filters||saveParams.filters;
|
|
93
|
+
const cuSorter=sorter||saveParams.sorter;
|
|
94
|
+
saveParams.oldParams = requestParams;
|
|
95
|
+
saveParams.filters = cuFilters;
|
|
96
|
+
saveParams.sorter = cuSorter;
|
|
97
|
+
return { ...requestParams,...cuFilters,...cuSorter }
|
|
98
|
+
}
|
|
99
|
+
const reloadFn = async (reqParams?:RequestParams) => {
|
|
100
|
+
return localReload(getReqParams(reqParams));
|
|
84
101
|
};
|
|
85
102
|
const resultAction = useRequest(
|
|
86
|
-
(
|
|
87
|
-
|
|
88
|
-
const reqParams = { size, current, ...oParams };
|
|
89
|
-
saveParams.old = reqParams;
|
|
90
|
-
return request?.(reqParams);
|
|
103
|
+
(reqParams?:RequestParams) => {
|
|
104
|
+
return request?.( getReqParams(reqParams));
|
|
91
105
|
},
|
|
92
106
|
{ manual: true }
|
|
93
107
|
);
|
package/src/components/modal.ts
CHANGED
|
@@ -129,7 +129,7 @@ export interface TableInstance {
|
|
|
129
129
|
reload: (params?: ParamsModal) => Promise<any>;
|
|
130
130
|
setSelectedRowData: (keys: React.Key[], data: any) => void;
|
|
131
131
|
dispatch: (key: string, params: any) => void;
|
|
132
|
-
reloadWithParams: (params?: ParamsModal) => Promise<any>;
|
|
132
|
+
reloadWithParams: (params?: ParamsModal,filters?:any,sorter?:any) => Promise<any>;
|
|
133
133
|
getParams: () => any;
|
|
134
134
|
getSelectedRowData: () => RowObj;
|
|
135
135
|
getTableSourceData: (full?: boolean) => any;
|
|
@@ -41,21 +41,21 @@ export default () => {
|
|
|
41
41
|
<HDwEditTable
|
|
42
42
|
title="编辑"
|
|
43
43
|
request={() => {
|
|
44
|
-
return new Promise(resolve => {
|
|
44
|
+
return new Promise((resolve) => {
|
|
45
45
|
setTimeout(() => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
},2000)
|
|
58
|
-
})
|
|
46
|
+
resolve({
|
|
47
|
+
records: [
|
|
48
|
+
{
|
|
49
|
+
id: "213213",
|
|
50
|
+
title: "100",
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
current: "1",
|
|
54
|
+
size: "10",
|
|
55
|
+
total: "10",
|
|
56
|
+
});
|
|
57
|
+
}, 2000);
|
|
58
|
+
});
|
|
59
59
|
}}
|
|
60
60
|
editTableProps={{
|
|
61
61
|
onAdd: async (data) => {},
|
|
@@ -69,28 +69,30 @@ export default () => {
|
|
|
69
69
|
title: "操作",
|
|
70
70
|
valueType: "option",
|
|
71
71
|
align: "center",
|
|
72
|
-
render: (text: any, record: any, _: any, action: any) =>{
|
|
73
|
-
return
|
|
74
|
-
|
|
72
|
+
render: (text: any, record: any, _: any, action: any) => {
|
|
73
|
+
return (
|
|
74
|
+
<>
|
|
75
|
+
<a
|
|
75
76
|
key="editable"
|
|
76
77
|
type={"link"}
|
|
77
78
|
onClick={() => {
|
|
78
79
|
action?.startEditable?.(record.id);
|
|
79
80
|
}}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
>
|
|
82
|
+
编辑
|
|
83
|
+
</a>
|
|
84
|
+
<a
|
|
84
85
|
key="editable"
|
|
85
86
|
type={"link"}
|
|
86
87
|
onClick={() => {
|
|
87
|
-
action.reload()
|
|
88
|
+
action.reload();
|
|
88
89
|
}}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
>
|
|
91
|
+
刷新
|
|
92
|
+
</a>
|
|
93
|
+
</>
|
|
94
|
+
);
|
|
95
|
+
},
|
|
94
96
|
},
|
|
95
97
|
]}
|
|
96
98
|
/>
|
|
@@ -19,10 +19,10 @@ import { HFormConfigProvider, HRangePicker } from "@hw-component/form";
|
|
|
19
19
|
import { SettingOutlined } from "@ant-design/icons";
|
|
20
20
|
import ProTable from "@ant-design/pro-table";
|
|
21
21
|
import { useRequest } from "ahooks";
|
|
22
|
-
import {
|
|
22
|
+
import {useEffect, useRef, useState} from "react";
|
|
23
23
|
import TagsComponent from "@/components/render/TagsComponent";
|
|
24
24
|
|
|
25
|
-
export const configData = ()=>{
|
|
25
|
+
export const configData = () => {
|
|
26
26
|
return [
|
|
27
27
|
{
|
|
28
28
|
title: "订单编号",
|
|
@@ -82,13 +82,15 @@ export const configData = ()=>{
|
|
|
82
82
|
{
|
|
83
83
|
title: "操作3",
|
|
84
84
|
dataIndex: "op3",
|
|
85
|
+
fixed: "right",
|
|
85
86
|
width: 120,
|
|
86
87
|
},
|
|
87
88
|
];
|
|
88
|
-
}
|
|
89
|
-
const listReq=(params)=>{
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
};
|
|
90
|
+
const listReq = (params) => {
|
|
91
|
+
console.log(params)
|
|
92
|
+
return new Promise((resolve) => {
|
|
93
|
+
setTimeout(() => {
|
|
92
94
|
const { current } = params;
|
|
93
95
|
const records = [];
|
|
94
96
|
for (let i = 0; i < 10; i += 1) {
|
|
@@ -103,9 +105,9 @@ const listReq=(params)=>{
|
|
|
103
105
|
total: "100",
|
|
104
106
|
records,
|
|
105
107
|
});
|
|
106
|
-
},2000)
|
|
107
|
-
})
|
|
108
|
-
}
|
|
108
|
+
}, 2000);
|
|
109
|
+
});
|
|
110
|
+
};
|
|
109
111
|
export default () => {
|
|
110
112
|
const hTable = useHTable();
|
|
111
113
|
const [width, setWidth] = useState(0);
|
|
@@ -136,6 +138,7 @@ export default () => {
|
|
|
136
138
|
}, 2000);
|
|
137
139
|
});
|
|
138
140
|
});
|
|
141
|
+
const ref=useRef();
|
|
139
142
|
const [dataSource, setDataSource] = useState({
|
|
140
143
|
records: [],
|
|
141
144
|
total: "100",
|
|
@@ -147,6 +150,7 @@ export default () => {
|
|
|
147
150
|
title: "操作1",
|
|
148
151
|
dataIndex: "op1",
|
|
149
152
|
width: 120,
|
|
153
|
+
sorter:true
|
|
150
154
|
},
|
|
151
155
|
{
|
|
152
156
|
title: "操作2",
|
|
@@ -157,16 +161,18 @@ export default () => {
|
|
|
157
161
|
title: "操作3",
|
|
158
162
|
dataIndex: "op3",
|
|
159
163
|
width: 120,
|
|
164
|
+
fixed: "right",
|
|
160
165
|
},
|
|
161
166
|
]);
|
|
162
167
|
return (
|
|
163
168
|
<HFormConfigProvider>
|
|
164
169
|
<ProTable
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
+
columns={cols}
|
|
171
|
+
actionRef={ref}
|
|
172
|
+
columnsState={{
|
|
173
|
+
persistenceKey: "text",
|
|
174
|
+
persistenceType: "localStorage",
|
|
175
|
+
}}
|
|
170
176
|
/>
|
|
171
177
|
<TagsComponent
|
|
172
178
|
data={["213123"]}
|
|
@@ -185,48 +191,53 @@ export default () => {
|
|
|
185
191
|
获取
|
|
186
192
|
</div>
|
|
187
193
|
<HTableConfig defaultSelectedRowClassName={null}>
|
|
188
|
-
<div
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
194
|
+
<div
|
|
195
|
+
onClick={() => {
|
|
196
|
+
setCols([
|
|
197
|
+
{
|
|
198
|
+
title: "操作1",
|
|
199
|
+
dataIndex: "op1",
|
|
200
|
+
width: 120,
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
title: "操作10",
|
|
204
|
+
dataIndex: "op10",
|
|
205
|
+
width: 120,
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
title: "操作2",
|
|
209
|
+
dataIndex: "op2",
|
|
210
|
+
width: 120,
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
title: "操作100",
|
|
214
|
+
dataIndex: "op100",
|
|
215
|
+
width: 120,
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
title: "操作3",
|
|
219
|
+
dataIndex: "op3",
|
|
220
|
+
width: 120,
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
title: "操作1000",
|
|
224
|
+
dataIndex: "op1000",
|
|
225
|
+
width: 120,
|
|
226
|
+
},
|
|
227
|
+
]);
|
|
228
|
+
}}
|
|
229
|
+
>
|
|
222
230
|
点我修改
|
|
223
231
|
</div>
|
|
224
232
|
<HTable
|
|
225
233
|
configData={cols}
|
|
226
234
|
configItemRender={(d1) => {
|
|
227
|
-
console.log(d1);
|
|
228
235
|
return d1;
|
|
229
236
|
}}
|
|
237
|
+
columnsState={{
|
|
238
|
+
persistenceKey: "test",
|
|
239
|
+
persistenceType: "localStorage",
|
|
240
|
+
}}
|
|
230
241
|
table={hTable}
|
|
231
242
|
labelWidth={88}
|
|
232
243
|
action={{
|
|
@@ -245,9 +256,6 @@ export default () => {
|
|
|
245
256
|
affixProps={{
|
|
246
257
|
target: () => document.querySelector(".body"),
|
|
247
258
|
}}
|
|
248
|
-
scroll={{
|
|
249
|
-
x: 1000,
|
|
250
|
-
}}
|
|
251
259
|
formInitValues={{
|
|
252
260
|
select: "orderNo",
|
|
253
261
|
}}
|