@hzab/hierarchical-statistics 0.0.4 → 0.0.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
|
@@ -21,6 +21,7 @@ const InfiniteListUIMobile = (props: InfiniteListProps, ref: ForwardedRef<Infini
|
|
|
21
21
|
listStyle,
|
|
22
22
|
breadModel,
|
|
23
23
|
className,
|
|
24
|
+
refreshKey,
|
|
24
25
|
},
|
|
25
26
|
actions: { fetchBreadData, handleSelectId, handleNodeClick, handleBreadcrumbClick },
|
|
26
27
|
} = useInfiniteList({ ...props, terminal: "mobile" });
|
|
@@ -31,6 +32,7 @@ const InfiniteListUIMobile = (props: InfiniteListProps, ref: ForwardedRef<Infini
|
|
|
31
32
|
listModal,
|
|
32
33
|
breadModel,
|
|
33
34
|
fetchBreadData,
|
|
35
|
+
breadcrumbData,
|
|
34
36
|
}));
|
|
35
37
|
return (
|
|
36
38
|
<div className={`infinite-level-box ${className || ""}`} style={style}>
|
|
@@ -51,7 +53,13 @@ const InfiniteListUIMobile = (props: InfiniteListProps, ref: ForwardedRef<Infini
|
|
|
51
53
|
|
|
52
54
|
<div className="infinite-level-list-box" style={listStyle}>
|
|
53
55
|
{/* 移动端 */}
|
|
54
|
-
<ListRender
|
|
56
|
+
<ListRender
|
|
57
|
+
key={refreshKey}
|
|
58
|
+
ref={listRef}
|
|
59
|
+
model={listModal}
|
|
60
|
+
{...listRenderProps}
|
|
61
|
+
ItemRender={Slots.renderItem}
|
|
62
|
+
/>
|
|
55
63
|
</div>
|
|
56
64
|
</Spin>
|
|
57
65
|
</div>
|
|
@@ -9,6 +9,7 @@ const InfiniteListUIPc = (props: InfiniteListProps, ref: ForwardedRef<InfiniteLi
|
|
|
9
9
|
const {
|
|
10
10
|
states: {
|
|
11
11
|
listModal,
|
|
12
|
+
breadModel,
|
|
12
13
|
readcrumbStyle,
|
|
13
14
|
separatorStyle,
|
|
14
15
|
separator,
|
|
@@ -21,8 +22,9 @@ const InfiniteListUIPc = (props: InfiniteListProps, ref: ForwardedRef<InfiniteLi
|
|
|
21
22
|
listRef,
|
|
22
23
|
virtualPagedListProps,
|
|
23
24
|
className,
|
|
25
|
+
refreshKey,
|
|
24
26
|
},
|
|
25
|
-
actions: { handleSelectId, handleNodeClick, handleBreadcrumbClick },
|
|
27
|
+
actions: { handleSelectId, handleNodeClick, handleBreadcrumbClick, fetchBreadData },
|
|
26
28
|
} = useInfiniteList({ ...props, terminal: "pc" });
|
|
27
29
|
|
|
28
30
|
useImperativeHandle(ref, () => ({
|
|
@@ -30,6 +32,9 @@ const InfiniteListUIPc = (props: InfiniteListProps, ref: ForwardedRef<InfiniteLi
|
|
|
30
32
|
handleSelectId,
|
|
31
33
|
listRef: listRef?.current,
|
|
32
34
|
listModal,
|
|
35
|
+
breadModel,
|
|
36
|
+
fetchBreadData,
|
|
37
|
+
breadcrumbData,
|
|
33
38
|
}));
|
|
34
39
|
|
|
35
40
|
const loadData = async (pageNum) => {
|
|
@@ -58,7 +63,7 @@ const InfiniteListUIPc = (props: InfiniteListProps, ref: ForwardedRef<InfiniteLi
|
|
|
58
63
|
</div>
|
|
59
64
|
<div className="infinite-level-list-box" style={listStyle}>
|
|
60
65
|
<VirtualPagedList
|
|
61
|
-
key={
|
|
66
|
+
key={refreshKey}
|
|
62
67
|
ref={listRef}
|
|
63
68
|
{...virtualPagedListProps}
|
|
64
69
|
renderItem={Slots.renderItem}
|
package/src/type.d.ts
CHANGED
|
@@ -24,6 +24,11 @@ export interface InfiniteListInstance {
|
|
|
24
24
|
handleSelectId?: (item: ListItem) => void;
|
|
25
25
|
listRef?: any;
|
|
26
26
|
listModal?: any;
|
|
27
|
+
breadModel?: any;
|
|
28
|
+
/** 面包屑回显数据 */
|
|
29
|
+
breadcrumbData?: any;
|
|
30
|
+
/** 面包屑数据请求方法 */
|
|
31
|
+
fetchBreadData?: () => Promise<void>;
|
|
27
32
|
}
|
|
28
33
|
export interface InfiniteListProps {
|
|
29
34
|
/** 添加外层类名 */
|
package/src/use-infinite-list.ts
CHANGED
|
@@ -36,6 +36,7 @@ export function useInfiniteList(props: InfiniteListProps) {
|
|
|
36
36
|
const [breadcrumbData, setBreadcrumbData] = useState<PathItem[]>(
|
|
37
37
|
showHome ? [{ value: 0, label: homeBreadcrumb }] : [],
|
|
38
38
|
);
|
|
39
|
+
const [refreshKey, setRefreshKey] = useState(1);
|
|
39
40
|
const listRef = useRef<any>(null);
|
|
40
41
|
|
|
41
42
|
/**
|
|
@@ -58,7 +59,7 @@ export function useInfiniteList(props: InfiniteListProps) {
|
|
|
58
59
|
label: item[fieldList.label],
|
|
59
60
|
},
|
|
60
61
|
]);
|
|
61
|
-
|
|
62
|
+
setRefreshKey((pre) => pre + 1);
|
|
62
63
|
};
|
|
63
64
|
|
|
64
65
|
/**
|
|
@@ -85,7 +86,7 @@ export function useInfiniteList(props: InfiniteListProps) {
|
|
|
85
86
|
listModal.query = { ...listModal.query, [parentField]: item.value };
|
|
86
87
|
setSelectedLoadIdNode(item.value);
|
|
87
88
|
setBreadcrumbData(breadcrumbData.slice(0, index + 1));
|
|
88
|
-
|
|
89
|
+
setRefreshKey((pre) => pre + 1);
|
|
89
90
|
};
|
|
90
91
|
|
|
91
92
|
/**
|
|
@@ -133,6 +134,7 @@ export function useInfiniteList(props: InfiniteListProps) {
|
|
|
133
134
|
listModal,
|
|
134
135
|
breadModel,
|
|
135
136
|
className,
|
|
137
|
+
refreshKey,
|
|
136
138
|
},
|
|
137
139
|
actions: {
|
|
138
140
|
handleSelectId,
|