@hw-component/table 1.10.16 → 1.10.17
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/HTableBody/Options/hooks.d.ts +6 -3
- package/es/HTableBody/Options/hooks.js +56 -29
- package/es/HTableBody/Options/index.js +8 -6
- package/es/HTableBody/Options/utils.d.ts +2 -2
- package/es/HTableBody/hooks/useColData.d.ts +3 -8
- package/es/HTableBody/hooks/useColData.js +51 -119
- package/es/HTableBody/hooks/useColMk.d.ts +3 -0
- package/es/HTableBody/hooks/useColMk.js +100 -0
- package/es/HTableBody/index.js +14 -18
- package/lib/HTableBody/Options/hooks.d.ts +6 -3
- package/lib/HTableBody/Options/hooks.js +56 -29
- package/lib/HTableBody/Options/index.js +7 -5
- package/lib/HTableBody/Options/utils.d.ts +2 -2
- package/lib/HTableBody/hooks/useColData.d.ts +3 -8
- package/lib/HTableBody/hooks/useColData.js +49 -118
- package/lib/HTableBody/hooks/useColMk.d.ts +3 -0
- package/lib/HTableBody/hooks/useColMk.js +103 -0
- package/lib/HTableBody/index.js +13 -17
- package/package.json +1 -1
- package/src/components/HTableBody/Options/hooks.tsx +39 -21
- package/src/components/HTableBody/Options/index.tsx +3 -3
- package/src/components/HTableBody/hooks/useColData.tsx +38 -110
- package/src/components/HTableBody/hooks/useColMk.ts +83 -0
- package/src/components/HTableBody/index.tsx +7 -10
- package/src/pages/Table/index.tsx +143 -104
|
@@ -10,7 +10,7 @@ import { useRef } from "react";
|
|
|
10
10
|
import { ColsSettingContent } from "./Content";
|
|
11
11
|
import { Title } from "./Title";
|
|
12
12
|
import type { IProps } from "./modal";
|
|
13
|
-
import {
|
|
13
|
+
import {useTreeValue} from "./hooks";
|
|
14
14
|
|
|
15
15
|
export default ({
|
|
16
16
|
reload,
|
|
@@ -29,7 +29,7 @@ export default ({
|
|
|
29
29
|
"hw-table-body-option-icon",
|
|
30
30
|
]);
|
|
31
31
|
const ref = useRef<HTMLDivElement>(null);
|
|
32
|
-
const checkKeys =
|
|
32
|
+
const {checkKeys,cols} = useTreeValue({ columns, colStatusValue });
|
|
33
33
|
const SizeItem = () => {
|
|
34
34
|
const MenuComponent = Menu as any;
|
|
35
35
|
const MenuItem = Menu.Item as any;
|
|
@@ -83,7 +83,7 @@ export default ({
|
|
|
83
83
|
<Popover
|
|
84
84
|
content={
|
|
85
85
|
<ColsSettingContent
|
|
86
|
-
columns={
|
|
86
|
+
columns={cols}
|
|
87
87
|
checkKeys={checkKeys}
|
|
88
88
|
onCheck={onChange}
|
|
89
89
|
onDrop={onDrop}
|
|
@@ -1,109 +1,11 @@
|
|
|
1
|
-
import { useHTableContext } from "
|
|
1
|
+
import { useHTableContext } from "../../context";
|
|
2
2
|
import { useEffect, useMemo, useState } from "react";
|
|
3
3
|
import type {
|
|
4
4
|
ConfigDataModal,
|
|
5
|
-
ConfigItemModal,
|
|
6
|
-
HRowSelection,
|
|
7
|
-
HTableInstance,
|
|
8
|
-
HTableProps,
|
|
9
5
|
} from "../../modal";
|
|
10
|
-
import { useClassName } from "@/components/hooks";
|
|
11
|
-
import { useHTableConfigContext } from "@/components/TableConfig";
|
|
12
|
-
import { textTypes } from "@/components/render/config";
|
|
13
|
-
import configRender from "@/components/render";
|
|
14
6
|
import type { ColumnsState } from "@ant-design/pro-table/es/container";
|
|
15
|
-
import { mkChangeValue, outColSetting } from "
|
|
7
|
+
import { mkChangeValue, outColSetting } from "../utils";
|
|
16
8
|
import type { ColumnsStateType } from "@ant-design/pro-table/es/typing";
|
|
17
|
-
import { radioSelectionCol, checkBoxSelectionCol } from "./colsMk";
|
|
18
|
-
|
|
19
|
-
const checkBoxMk = (rowSelection: HRowSelection) => {
|
|
20
|
-
const { type } = rowSelection;
|
|
21
|
-
if (type === "radio") {
|
|
22
|
-
return radioSelectionCol(rowSelection);
|
|
23
|
-
}
|
|
24
|
-
return checkBoxSelectionCol(rowSelection);
|
|
25
|
-
};
|
|
26
|
-
export const useCols = ({
|
|
27
|
-
configData,
|
|
28
|
-
rowSelection,
|
|
29
|
-
table,
|
|
30
|
-
bordered,
|
|
31
|
-
configItemRender,
|
|
32
|
-
}: HTableProps) => {
|
|
33
|
-
const trClassname = useClassName("hw-table-col-hr");
|
|
34
|
-
const [cols, setCols] = useState<ConfigDataModal>([]);
|
|
35
|
-
const { valueTypeConfig } = useHTableConfigContext({});
|
|
36
|
-
|
|
37
|
-
const itemClassNameMk = (children: any[], lastChildren: any[]) => {
|
|
38
|
-
const lastChildLen = (lastChildren as any[]).length;
|
|
39
|
-
const childLen = children.length;
|
|
40
|
-
return !childLen && !!lastChildLen ? trClassname : "";
|
|
41
|
-
};
|
|
42
|
-
const colChild = (children?: ConfigItemModal[]) => {
|
|
43
|
-
if (!children) {
|
|
44
|
-
return children;
|
|
45
|
-
}
|
|
46
|
-
return children.map((item) => {
|
|
47
|
-
return itemProvider(item);
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
function itemProvider(item: ConfigItemModal, lastItem?: ConfigItemModal) {
|
|
51
|
-
const { children: lastChildren = [] } = lastItem || {};
|
|
52
|
-
const {
|
|
53
|
-
valueType = "",
|
|
54
|
-
valueTypeProps = {},
|
|
55
|
-
className = "",
|
|
56
|
-
children = [],
|
|
57
|
-
} = item;
|
|
58
|
-
|
|
59
|
-
const trClassName = bordered
|
|
60
|
-
? ""
|
|
61
|
-
: itemClassNameMk(children as any[], lastChildren as any[]);
|
|
62
|
-
const itemType = valueType as string;
|
|
63
|
-
if (textTypes.indexOf(itemType) !== -1) {
|
|
64
|
-
const { ellipsis } = valueTypeProps;
|
|
65
|
-
return {
|
|
66
|
-
...item,
|
|
67
|
-
ellipsis: ellipsis,
|
|
68
|
-
className: `${className} ${trClassName}`,
|
|
69
|
-
render: configRender(item, table as HTableInstance, valueTypeConfig),
|
|
70
|
-
children: colChild(children),
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
...item,
|
|
76
|
-
className: `${className} ${trClassName}`,
|
|
77
|
-
render: configRender(item, table as HTableInstance, valueTypeConfig),
|
|
78
|
-
children: colChild(children),
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const changeConfigData = (data: ConfigDataModal) => {
|
|
83
|
-
const colsArray = data.filter((item) => {
|
|
84
|
-
return !item.hideInTable;
|
|
85
|
-
});
|
|
86
|
-
if (rowSelection !== false) {
|
|
87
|
-
colsArray.splice(0, 0, checkBoxMk(rowSelection || {}) as any);
|
|
88
|
-
}
|
|
89
|
-
return colsArray.map((item, index) => {
|
|
90
|
-
const lastItem = colsArray[index - 1];
|
|
91
|
-
const resultItem = itemProvider(item, lastItem);
|
|
92
|
-
return configItemRender ? configItemRender(resultItem) : resultItem;
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
useEffect(() => {
|
|
96
|
-
setCols(changeConfigData(configData));
|
|
97
|
-
}, [configData, table, rowSelection]);
|
|
98
|
-
const resetCols = () => {
|
|
99
|
-
setCols(changeConfigData(configData));
|
|
100
|
-
};
|
|
101
|
-
return {
|
|
102
|
-
cols,
|
|
103
|
-
setCols,
|
|
104
|
-
resetCols,
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
9
|
|
|
108
10
|
interface useColumnsStateTypeModal {
|
|
109
11
|
columnsState?: ColumnsStateType;
|
|
@@ -115,12 +17,8 @@ export const useColumnsStateType = ({
|
|
|
115
17
|
columns,
|
|
116
18
|
}: useColumnsStateTypeModal) => {
|
|
117
19
|
const { tableInstance } = useHTableContext();
|
|
118
|
-
const { persistenceType, persistenceKey, value, defaultValue, onChange } =
|
|
119
|
-
|
|
120
|
-
const [selfValue, setSelfValue] = useState<
|
|
121
|
-
Record<string, ColumnsState> | undefined
|
|
122
|
-
>(defaultValue);
|
|
123
|
-
|
|
20
|
+
const { persistenceType, persistenceKey, value, defaultValue, onChange } = columnsState || {};
|
|
21
|
+
const [selfValue, setSelfValue] = useState<Record<string, ColumnsState> | undefined>(defaultValue);
|
|
124
22
|
const initTableColsVal = useMemo(() => {
|
|
125
23
|
return selfValue || {};
|
|
126
24
|
}, []);
|
|
@@ -129,27 +27,57 @@ export const useColumnsStateType = ({
|
|
|
129
27
|
return outColSetting(columns, selfValue);
|
|
130
28
|
};
|
|
131
29
|
}, [selfValue]);
|
|
30
|
+
|
|
132
31
|
useEffect(() => {
|
|
133
32
|
setSelfValue(mkChangeValue(columnsState));
|
|
134
33
|
}, [value]);
|
|
135
34
|
|
|
35
|
+
const dropChange = (list:ConfigDataModal)=>{
|
|
36
|
+
setSelfValue((oldVal)=>{
|
|
37
|
+
const newValue={...oldVal};
|
|
38
|
+
let notMatchNum=0;
|
|
39
|
+
console.log(list,"li")
|
|
40
|
+
list.forEach((item,index) => {
|
|
41
|
+
const {dataIndex}=item;
|
|
42
|
+
if (!dataIndex){
|
|
43
|
+
notMatchNum+=1;
|
|
44
|
+
}
|
|
45
|
+
if (dataIndex){
|
|
46
|
+
const key=dataIndex as string;
|
|
47
|
+
const oldItemObj=newValue[key];
|
|
48
|
+
newValue[key] ={
|
|
49
|
+
...oldItemObj,
|
|
50
|
+
order:index-notMatchNum
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return newValue;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
136
57
|
const change = (keys: string[], notCheck: string[]) => {
|
|
137
58
|
const newObj = {};
|
|
59
|
+
const newValue={...selfValue};
|
|
60
|
+
keys.forEach((key) => {
|
|
61
|
+
const oldItem=newValue[key];
|
|
62
|
+
newObj[key] = {...oldItem,show: true };
|
|
63
|
+
})
|
|
138
64
|
notCheck.forEach((key) => {
|
|
139
|
-
|
|
65
|
+
const oldItem=newValue[key];
|
|
66
|
+
newObj[key] = {...oldItem, show: false };
|
|
140
67
|
});
|
|
141
68
|
setSelfValue(newObj);
|
|
142
69
|
onChange?.(newObj);
|
|
143
70
|
};
|
|
144
71
|
|
|
145
|
-
const
|
|
72
|
+
const resetCol = () => {
|
|
146
73
|
setSelfValue(initTableColsVal);
|
|
147
74
|
};
|
|
148
75
|
return {
|
|
149
76
|
persistenceType,
|
|
150
77
|
persistenceKey,
|
|
151
|
-
value:
|
|
78
|
+
value:selfValue,
|
|
152
79
|
onChange: change,
|
|
153
|
-
|
|
80
|
+
resetCol,
|
|
81
|
+
dropChange
|
|
154
82
|
};
|
|
155
83
|
}; //设置选项
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type {ConfigItemModal, HRowSelection, HTableInstance, HTableProps} from "../../modal";
|
|
2
|
+
import {useClassName} from "../../hooks";
|
|
3
|
+
import {useHTableConfigContext} from "../../TableConfig";
|
|
4
|
+
import {textTypes} from "../../render/config";
|
|
5
|
+
import configRender from "../../render";
|
|
6
|
+
import {useMemo} from "react";
|
|
7
|
+
import {checkBoxSelectionCol, radioSelectionCol} from "./colsMk";
|
|
8
|
+
|
|
9
|
+
const checkBoxMk = (rowSelection: HRowSelection) => {
|
|
10
|
+
const { type } = rowSelection;
|
|
11
|
+
if (type === "radio") {
|
|
12
|
+
return radioSelectionCol(rowSelection);
|
|
13
|
+
}
|
|
14
|
+
return checkBoxSelectionCol(rowSelection);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default ({
|
|
18
|
+
configData,
|
|
19
|
+
rowSelection,
|
|
20
|
+
table,
|
|
21
|
+
bordered,
|
|
22
|
+
configItemRender,
|
|
23
|
+
}: HTableProps)=>{
|
|
24
|
+
const trClassname = useClassName("hw-table-col-hr");
|
|
25
|
+
const { valueTypeConfig } = useHTableConfigContext({});
|
|
26
|
+
const itemClassNameMk = (children: any[], lastChildren: any[]) => {
|
|
27
|
+
const lastChildLen = (lastChildren as any[]).length;
|
|
28
|
+
const childLen = children.length;
|
|
29
|
+
return !childLen && !!lastChildLen ? trClassname : "";
|
|
30
|
+
};
|
|
31
|
+
const colChild = (children?: ConfigItemModal[]) => {
|
|
32
|
+
if (!children) {
|
|
33
|
+
return children;
|
|
34
|
+
}
|
|
35
|
+
return children.map((item) => {
|
|
36
|
+
return itemProvider(item);
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
function itemProvider(item: ConfigItemModal, lastItem?: ConfigItemModal) {
|
|
40
|
+
const { children: lastChildren = [] } = lastItem || {};
|
|
41
|
+
const {
|
|
42
|
+
valueType = "",
|
|
43
|
+
valueTypeProps = {},
|
|
44
|
+
className = "",
|
|
45
|
+
children = [],
|
|
46
|
+
} = item;
|
|
47
|
+
|
|
48
|
+
const trClassName = bordered
|
|
49
|
+
? ""
|
|
50
|
+
: itemClassNameMk(children as any[], lastChildren as any[]);
|
|
51
|
+
const itemType = valueType as string;
|
|
52
|
+
if (textTypes.indexOf(itemType) !== -1) {
|
|
53
|
+
const { ellipsis } = valueTypeProps;
|
|
54
|
+
return {
|
|
55
|
+
...item,
|
|
56
|
+
ellipsis: ellipsis,
|
|
57
|
+
className: `${className} ${trClassName}`,
|
|
58
|
+
render: configRender(item, table as HTableInstance, valueTypeConfig),
|
|
59
|
+
children: colChild(children),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
...item,
|
|
65
|
+
className: `${className} ${trClassName}`,
|
|
66
|
+
render: configRender(item, table as HTableInstance, valueTypeConfig),
|
|
67
|
+
children: colChild(children),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return useMemo(()=>{
|
|
71
|
+
const colsArray = configData.filter((item) => {
|
|
72
|
+
return !item.hideInTable;
|
|
73
|
+
});
|
|
74
|
+
if (rowSelection !== false) {
|
|
75
|
+
colsArray.splice(0, 0, checkBoxMk(rowSelection || {}) as any);
|
|
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
|
+
}
|
|
@@ -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";
|
|
@@ -17,7 +17,8 @@ import Options from "./Options";
|
|
|
17
17
|
import HeaderTitle from "./HeaderTitle";
|
|
18
18
|
import { errorDefaultRender, emptyDefaultRender } from "./defaultRender";
|
|
19
19
|
import type { HTableBodyProps } from "./modal";
|
|
20
|
-
import useRowClassName from "
|
|
20
|
+
import useRowClassName from "./hooks/useRowClassName";
|
|
21
|
+
import useColMk from "./hooks/useColMk";
|
|
21
22
|
|
|
22
23
|
export default (bodyProps: HTableBodyProps) => {
|
|
23
24
|
const {
|
|
@@ -77,15 +78,14 @@ export default (bodyProps: HTableBodyProps) => {
|
|
|
77
78
|
const { records } = data || {};
|
|
78
79
|
const tableInstance = table || contextTableInstance;
|
|
79
80
|
|
|
80
|
-
const
|
|
81
|
+
const cols = useColMk({
|
|
81
82
|
configData: bodyConfigData,
|
|
82
83
|
table: tableInstance,
|
|
83
84
|
rowSelection,
|
|
84
85
|
bordered,
|
|
85
86
|
configItemRender: tableConfigItemRender,
|
|
86
87
|
});
|
|
87
|
-
const { value, onChange,
|
|
88
|
-
useColumnsStateType({
|
|
88
|
+
const { value, onChange, resetCol,dropChange, ...selfColStatus } = useColumnsStateType({
|
|
89
89
|
columnsState,
|
|
90
90
|
columns: cols,
|
|
91
91
|
});
|
|
@@ -102,11 +102,8 @@ export default (bodyProps: HTableBodyProps) => {
|
|
|
102
102
|
setSizeChange={setCuSize}
|
|
103
103
|
colStatusValue={value || {}}
|
|
104
104
|
onChange={onChange}
|
|
105
|
-
reset={
|
|
106
|
-
|
|
107
|
-
resetCols();
|
|
108
|
-
}}
|
|
109
|
-
onDrop={setCols}
|
|
105
|
+
reset={resetCol}
|
|
106
|
+
onDrop={dropChange}
|
|
110
107
|
/>
|
|
111
108
|
);
|
|
112
109
|
const defaultOptionsNode = optionsRender
|
|
@@ -22,90 +22,90 @@ import { useRequest } from "ahooks";
|
|
|
22
22
|
import { useEffect, useState } from "react";
|
|
23
23
|
import TagsComponent from "@/components/render/TagsComponent";
|
|
24
24
|
|
|
25
|
-
const
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
label: "用户id",
|
|
51
|
-
value: "userId",
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
style: { width: 88 },
|
|
25
|
+
export const configData = ()=>{
|
|
26
|
+
return [
|
|
27
|
+
{
|
|
28
|
+
title: "订单编号",
|
|
29
|
+
dataIndex: "childOrderNo",
|
|
30
|
+
showSearch: true,
|
|
31
|
+
valueType: "copy",
|
|
32
|
+
width: 120,
|
|
33
|
+
searchType: "selectInput",
|
|
34
|
+
name: "selectInput",
|
|
35
|
+
itemProps: {
|
|
36
|
+
placeholder: "请输入",
|
|
37
|
+
selectProps: {
|
|
38
|
+
options: [
|
|
39
|
+
{
|
|
40
|
+
label: "订单编号",
|
|
41
|
+
value: "orderNo",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: "用户id",
|
|
45
|
+
value: "userId",
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
style: { width: 88 },
|
|
49
|
+
},
|
|
55
50
|
},
|
|
56
51
|
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
52
|
+
{
|
|
53
|
+
title: "短信接收手机号",
|
|
54
|
+
dataIndex: "mobileList",
|
|
55
|
+
width: 120,
|
|
56
|
+
searchType: "rangePicker",
|
|
57
|
+
showSearch: true,
|
|
58
|
+
shouldUpdate: (p, c) => {
|
|
59
|
+
return true;
|
|
60
|
+
},
|
|
66
61
|
},
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
62
|
+
{
|
|
63
|
+
title: "321312",
|
|
64
|
+
dataIndex: "img",
|
|
65
|
+
width: 120,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
title: "操作",
|
|
69
|
+
dataIndex: "op",
|
|
70
|
+
width: 120,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
title: "操作1",
|
|
74
|
+
dataIndex: "op1",
|
|
75
|
+
width: 120,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
title: "操作2",
|
|
79
|
+
dataIndex: "op2",
|
|
80
|
+
width: 120,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
title: "操作3",
|
|
84
|
+
dataIndex: "op3",
|
|
85
|
+
width: 120,
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
const listReq=(params)=>{
|
|
90
|
+
return new Promise(resolve => {
|
|
91
|
+
setTimeout(()=>{
|
|
92
|
+
const { current } = params;
|
|
93
|
+
const records = [];
|
|
94
|
+
for (let i = 0; i < 10; i += 1) {
|
|
95
|
+
records.push({
|
|
96
|
+
id: `${current}-${i}`,
|
|
97
|
+
lastPullGroupTime: 1760420231,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
resolve({
|
|
101
|
+
current: "1",
|
|
102
|
+
size: "10",
|
|
103
|
+
total: "100",
|
|
104
|
+
records,
|
|
105
|
+
});
|
|
106
|
+
},2000)
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
109
|
export default () => {
|
|
110
110
|
const hTable = useHTable();
|
|
111
111
|
const [width, setWidth] = useState(0);
|
|
@@ -142,9 +142,32 @@ export default () => {
|
|
|
142
142
|
size: "10",
|
|
143
143
|
current: "1",
|
|
144
144
|
});
|
|
145
|
-
const [
|
|
145
|
+
const [cols, setCols] = useState([
|
|
146
|
+
{
|
|
147
|
+
title: "操作1",
|
|
148
|
+
dataIndex: "op1",
|
|
149
|
+
width: 120,
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
title: "操作2",
|
|
153
|
+
dataIndex: "op2",
|
|
154
|
+
width: 120,
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
title: "操作3",
|
|
158
|
+
dataIndex: "op3",
|
|
159
|
+
width: 120,
|
|
160
|
+
},
|
|
161
|
+
]);
|
|
146
162
|
return (
|
|
147
163
|
<HFormConfigProvider>
|
|
164
|
+
<ProTable
|
|
165
|
+
columns={cols}
|
|
166
|
+
columnsState={{
|
|
167
|
+
persistenceKey:"text",
|
|
168
|
+
persistenceType:"localStorage"
|
|
169
|
+
}}
|
|
170
|
+
/>
|
|
148
171
|
<TagsComponent
|
|
149
172
|
data={["213123"]}
|
|
150
173
|
tooltip={() => {
|
|
@@ -162,8 +185,44 @@ export default () => {
|
|
|
162
185
|
获取
|
|
163
186
|
</div>
|
|
164
187
|
<HTableConfig defaultSelectedRowClassName={null}>
|
|
188
|
+
<div onClick={()=>{
|
|
189
|
+
setCols([
|
|
190
|
+
{
|
|
191
|
+
title: "操作1",
|
|
192
|
+
dataIndex: "op1",
|
|
193
|
+
width: 120,
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
title: "操作10",
|
|
197
|
+
dataIndex: "op10",
|
|
198
|
+
width: 120,
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
title: "操作2",
|
|
202
|
+
dataIndex: "op2",
|
|
203
|
+
width: 120,
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
title: "操作100",
|
|
207
|
+
dataIndex: "op100",
|
|
208
|
+
width: 120,
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
title: "操作3",
|
|
212
|
+
dataIndex: "op3",
|
|
213
|
+
width: 120,
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
title: "操作1000",
|
|
217
|
+
dataIndex: "op1000",
|
|
218
|
+
width: 120,
|
|
219
|
+
},
|
|
220
|
+
]);
|
|
221
|
+
}}>
|
|
222
|
+
点我修改
|
|
223
|
+
</div>
|
|
165
224
|
<HTable
|
|
166
|
-
configData={
|
|
225
|
+
configData={cols}
|
|
167
226
|
configItemRender={(d1) => {
|
|
168
227
|
console.log(d1);
|
|
169
228
|
return d1;
|
|
@@ -189,30 +248,10 @@ export default () => {
|
|
|
189
248
|
scroll={{
|
|
190
249
|
x: 1000,
|
|
191
250
|
}}
|
|
192
|
-
columnsState={{
|
|
193
|
-
persistenceKey: "test",
|
|
194
|
-
persistenceType: "localStorage",
|
|
195
|
-
}}
|
|
196
251
|
formInitValues={{
|
|
197
252
|
select: "orderNo",
|
|
198
253
|
}}
|
|
199
|
-
request={
|
|
200
|
-
const { current } = params;
|
|
201
|
-
const records = [];
|
|
202
|
-
for (let i = 0; i < 10; i += 1) {
|
|
203
|
-
records.push({
|
|
204
|
-
id: `${current}-${i}`,
|
|
205
|
-
lastPullGroupTime: 1760420231,
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
console.log(records);
|
|
209
|
-
return Promise.resolve({
|
|
210
|
-
current: "1",
|
|
211
|
-
size: "10",
|
|
212
|
-
total: "100",
|
|
213
|
-
records,
|
|
214
|
-
});
|
|
215
|
-
}}
|
|
254
|
+
request={listReq}
|
|
216
255
|
headerTitle={
|
|
217
256
|
<Space size={8}>
|
|
218
257
|
<Button
|