@fe-free/core 2.8.4 → 2.8.6
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/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fe-free/core",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"author": "",
|
|
@@ -39,9 +39,10 @@
|
|
|
39
39
|
"react-syntax-highlighter": "^15.5.0",
|
|
40
40
|
"rehype-raw": "^7.0.0",
|
|
41
41
|
"remark-gfm": "^4.0.1",
|
|
42
|
+
"safe-stable-stringify": "^2.5.0",
|
|
42
43
|
"vanilla-jsoneditor": "^0.23.1",
|
|
43
44
|
"zustand": "^4.5.4",
|
|
44
|
-
"@fe-free/tool": "2.8.
|
|
45
|
+
"@fe-free/tool": "2.8.6"
|
|
45
46
|
},
|
|
46
47
|
"peerDependencies": {
|
|
47
48
|
"@ant-design/pro-components": "2.8.9",
|
|
@@ -17,6 +17,12 @@ interface ProFormListHelperProps<T> {
|
|
|
17
17
|
disabledDelete?: boolean;
|
|
18
18
|
readOnly?: boolean;
|
|
19
19
|
className?: string;
|
|
20
|
+
afterChildren?: (props: {
|
|
21
|
+
value?: T[];
|
|
22
|
+
item: T;
|
|
23
|
+
index: number;
|
|
24
|
+
onItemChange: (newItem: T) => void;
|
|
25
|
+
}) => React.ReactNode;
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
const emptyArr = [];
|
|
@@ -28,31 +34,43 @@ function ProFormListHelper<T = any>(props: ProFormListHelperProps<T>) {
|
|
|
28
34
|
<div className="flex flex-col gap-2">
|
|
29
35
|
{options.map((item, index) => {
|
|
30
36
|
return (
|
|
31
|
-
|
|
32
|
-
<div className="flex
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
<>
|
|
38
|
+
<div key={index} className="flex">
|
|
39
|
+
<div className="flex-1 overflow-hidden">
|
|
40
|
+
{props.children({
|
|
41
|
+
value: props.value,
|
|
42
|
+
item,
|
|
43
|
+
index,
|
|
44
|
+
onItemChange: (newItem) => {
|
|
45
|
+
const newOptions = [...options];
|
|
46
|
+
newOptions[index] = newItem;
|
|
47
|
+
props.onChange?.(newOptions);
|
|
48
|
+
},
|
|
49
|
+
})}
|
|
50
|
+
</div>
|
|
51
|
+
{!props.readOnly && !props.disabledDelete && (
|
|
52
|
+
<Button
|
|
53
|
+
icon={<DeleteOutlined />}
|
|
54
|
+
type="text"
|
|
55
|
+
onClick={() => {
|
|
56
|
+
const newOptions = [...options];
|
|
57
|
+
newOptions.splice(index, 1);
|
|
58
|
+
props.onChange?.(newOptions);
|
|
59
|
+
}}
|
|
60
|
+
/>
|
|
61
|
+
)}
|
|
43
62
|
</div>
|
|
44
|
-
{
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
</div>
|
|
63
|
+
{props.afterChildren?.({
|
|
64
|
+
value: props.value,
|
|
65
|
+
item,
|
|
66
|
+
index,
|
|
67
|
+
onItemChange: (newItem) => {
|
|
68
|
+
const newOptions = [...options];
|
|
69
|
+
newOptions[index] = newItem;
|
|
70
|
+
props.onChange?.(newOptions);
|
|
71
|
+
},
|
|
72
|
+
})}
|
|
73
|
+
</>
|
|
56
74
|
);
|
|
57
75
|
})}
|
|
58
76
|
</div>
|
|
@@ -2,6 +2,7 @@ import { Spin } from 'antd';
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import type { ReactNode } from 'react';
|
|
4
4
|
import { useImperativeHandle, useRef, useState } from 'react';
|
|
5
|
+
import stringify from 'safe-stable-stringify';
|
|
5
6
|
import { useGlobalInfiniteScroll } from '../ahooks/use_global_infinite_scroll';
|
|
6
7
|
|
|
7
8
|
interface ActionType {
|
|
@@ -60,6 +61,7 @@ const InfiniteListBase = <D, P>({
|
|
|
60
61
|
{
|
|
61
62
|
target: ref,
|
|
62
63
|
isNoMore: (d) => d?.nextId === undefined,
|
|
64
|
+
reloadDeps: [stringify(params || {})],
|
|
63
65
|
},
|
|
64
66
|
);
|
|
65
67
|
|