@hzab/hierarchical-statistics 0.0.1 → 0.0.4
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 +6 -0
- package/README.md +7 -5
- package/package.json +5 -5
- package/src/components/Breadcrumb/index.tsx +5 -8
- package/src/components/InfiniteListUiMobile/index.tsx +6 -5
- package/src/components/InfiniteListUiPc/index.tsx +5 -5
- package/src/components/{index.module.less → index.less} +6 -7
- package/src/type.d.ts +2 -0
- package/src/use-infinite-list.ts +2 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
## 示例
|
|
12
12
|
|
|
13
13
|
```jsx
|
|
14
|
-
import
|
|
14
|
+
import InfiniteListUIPc from "@hzab/hierarchical-statistics/src/components/InfiniteListUiPc";
|
|
15
15
|
<InfiniteListUIPc
|
|
16
16
|
ref={listRef}
|
|
17
17
|
style={{
|
|
@@ -30,9 +30,7 @@ import { InfiniteListUIPc, InfiniteListUIMobile } from "@hzab/hierarchical-stati
|
|
|
30
30
|
value: "orgId",
|
|
31
31
|
label: "orgName",
|
|
32
32
|
}}
|
|
33
|
-
|
|
34
|
-
height: 300,
|
|
35
|
-
dynamicHeightMode: true,
|
|
33
|
+
Slots={{
|
|
36
34
|
renderItem: (record) => (
|
|
37
35
|
<div
|
|
38
36
|
onClick={() => {
|
|
@@ -42,7 +40,11 @@ import { InfiniteListUIPc, InfiniteListUIMobile } from "@hzab/hierarchical-stati
|
|
|
42
40
|
>
|
|
43
41
|
<div>{record?.orgName}</div>
|
|
44
42
|
</div>
|
|
45
|
-
)
|
|
43
|
+
)
|
|
44
|
+
}}
|
|
45
|
+
virtualPagedListProps={{
|
|
46
|
+
height: 300,
|
|
47
|
+
dynamicHeightMode: true,
|
|
46
48
|
noMoreComponent: <div>没有更多数据了</div>,
|
|
47
49
|
}}
|
|
48
50
|
></InfiniteListUIPc>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hzab/hierarchical-statistics",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src",
|
|
6
6
|
"scripts": {
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"prettier --write"
|
|
47
47
|
]
|
|
48
48
|
},
|
|
49
|
-
"
|
|
50
|
-
"@hzab/data-model": "
|
|
51
|
-
"@hzab/headless-components": "
|
|
52
|
-
"@hzab/list-render-mobile": "
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"@hzab/data-model": ">=1.7.5",
|
|
51
|
+
"@hzab/headless-components": ">=0.0.3",
|
|
52
|
+
"@hzab/list-render-mobile": ">=1.1.7"
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../index.less";
|
|
2
2
|
const BreadcrumbUI = (props: any) => {
|
|
3
3
|
const { readcrumbStyle, separatorStyle, separator, breadcrumbData, terminal, handleBreadcrumbClick } = props;
|
|
4
4
|
return (
|
|
5
|
-
<div
|
|
6
|
-
className={`${styles["readcrumb-box"]} ${terminal !== "pc" ? styles["readcrumb-box-mobile"] : null}`}
|
|
7
|
-
style={readcrumbStyle}
|
|
8
|
-
>
|
|
5
|
+
<div className={`breadcrumb-box ${terminal !== "pc" ? "breadcrumb-box-mobile" : ""}`} style={readcrumbStyle}>
|
|
9
6
|
{breadcrumbData.map((item, index) => (
|
|
10
|
-
<div className=
|
|
7
|
+
<div className="breadcrumb-item" key={index}>
|
|
11
8
|
<span
|
|
12
|
-
className=
|
|
9
|
+
className="breadcrumb-title"
|
|
13
10
|
style={{ color: breadcrumbData.length - 1 == index ? "#aeadad" : "#403ef5" }}
|
|
14
11
|
key={item?.value}
|
|
15
12
|
onClick={() => handleBreadcrumbClick(item, index)}
|
|
16
13
|
>
|
|
17
14
|
{item?.label}
|
|
18
15
|
</span>
|
|
19
|
-
<span className=
|
|
16
|
+
<span className="breadcrumb-separator" style={separatorStyle}>
|
|
20
17
|
{breadcrumbData?.length - 1 != index ? separator : ""}
|
|
21
18
|
</span>
|
|
22
19
|
</div>
|
|
@@ -4,7 +4,7 @@ import ListRender from "@hzab/list-render-mobile";
|
|
|
4
4
|
import { useInfiniteList } from "../../use-infinite-list";
|
|
5
5
|
import { InfiniteListProps, InfiniteListInstance } from "../../type";
|
|
6
6
|
import Breadcrumb from "../Breadcrumb";
|
|
7
|
-
import
|
|
7
|
+
import "../index.less";
|
|
8
8
|
const InfiniteListUIMobile = (props: InfiniteListProps, ref: ForwardedRef<InfiniteListInstance>) => {
|
|
9
9
|
const {
|
|
10
10
|
states: {
|
|
@@ -20,6 +20,7 @@ const InfiniteListUIMobile = (props: InfiniteListProps, ref: ForwardedRef<Infini
|
|
|
20
20
|
listRef,
|
|
21
21
|
listStyle,
|
|
22
22
|
breadModel,
|
|
23
|
+
className,
|
|
23
24
|
},
|
|
24
25
|
actions: { fetchBreadData, handleSelectId, handleNodeClick, handleBreadcrumbClick },
|
|
25
26
|
} = useInfiniteList({ ...props, terminal: "mobile" });
|
|
@@ -32,10 +33,10 @@ const InfiniteListUIMobile = (props: InfiniteListProps, ref: ForwardedRef<Infini
|
|
|
32
33
|
fetchBreadData,
|
|
33
34
|
}));
|
|
34
35
|
return (
|
|
35
|
-
<div className={
|
|
36
|
+
<div className={`infinite-level-box ${className || ""}`} style={style}>
|
|
36
37
|
<Spin spinning={loading}>
|
|
37
38
|
{/* 面包屑导航 */}
|
|
38
|
-
<div className=
|
|
39
|
+
<div className="infinite-level-breadcrumb-position">
|
|
39
40
|
<Breadcrumb
|
|
40
41
|
terminal="mobile"
|
|
41
42
|
readcrumbStyle={readcrumbStyle}
|
|
@@ -48,9 +49,9 @@ const InfiniteListUIMobile = (props: InfiniteListProps, ref: ForwardedRef<Infini
|
|
|
48
49
|
{Slots?.fixRenderCenter && <Slots.fixRenderCenter></Slots.fixRenderCenter>}
|
|
49
50
|
</div>
|
|
50
51
|
|
|
51
|
-
<div className=
|
|
52
|
+
<div className="infinite-level-list-box" style={listStyle}>
|
|
52
53
|
{/* 移动端 */}
|
|
53
|
-
<ListRender ref={listRef} model={listModal} {...listRenderProps}
|
|
54
|
+
<ListRender ref={listRef} model={listModal} {...listRenderProps} ItemRender={Slots.renderItem} />
|
|
54
55
|
</div>
|
|
55
56
|
</Spin>
|
|
56
57
|
</div>
|
|
@@ -4,7 +4,7 @@ import { ConfigProvider, Spin, Empty, Button } from "antd";
|
|
|
4
4
|
import { useInfiniteList } from "../../use-infinite-list";
|
|
5
5
|
import Breadcrumb from "../Breadcrumb";
|
|
6
6
|
import { InfiniteListProps, InfiniteListInstance } from "../../type";
|
|
7
|
-
import
|
|
7
|
+
import "../index.less";
|
|
8
8
|
const InfiniteListUIPc = (props: InfiniteListProps, ref: ForwardedRef<InfiniteListInstance>) => {
|
|
9
9
|
const {
|
|
10
10
|
states: {
|
|
@@ -20,6 +20,7 @@ const InfiniteListUIPc = (props: InfiniteListProps, ref: ForwardedRef<InfiniteLi
|
|
|
20
20
|
listStyle,
|
|
21
21
|
listRef,
|
|
22
22
|
virtualPagedListProps,
|
|
23
|
+
className,
|
|
23
24
|
},
|
|
24
25
|
actions: { handleSelectId, handleNodeClick, handleBreadcrumbClick },
|
|
25
26
|
} = useInfiniteList({ ...props, terminal: "pc" });
|
|
@@ -41,10 +42,10 @@ const InfiniteListUIPc = (props: InfiniteListProps, ref: ForwardedRef<InfiniteLi
|
|
|
41
42
|
};
|
|
42
43
|
};
|
|
43
44
|
return (
|
|
44
|
-
<div className={
|
|
45
|
+
<div className={`infinite-level-box ${className || ""}`} style={style}>
|
|
45
46
|
<Spin spinning={loading}>
|
|
46
47
|
{/* 面包屑导航 */}
|
|
47
|
-
<div className=
|
|
48
|
+
<div className="infinite-level-breadcrumb-position">
|
|
48
49
|
<Breadcrumb
|
|
49
50
|
terminal="pc"
|
|
50
51
|
readcrumbStyle={readcrumbStyle}
|
|
@@ -55,8 +56,7 @@ const InfiniteListUIPc = (props: InfiniteListProps, ref: ForwardedRef<InfiniteLi
|
|
|
55
56
|
></Breadcrumb>
|
|
56
57
|
{Slots?.fixRenderCenter && <Slots.fixRenderCenter></Slots.fixRenderCenter>}
|
|
57
58
|
</div>
|
|
58
|
-
|
|
59
|
-
<div className={styles["list-box-main"]} style={listStyle}>
|
|
59
|
+
<div className="infinite-level-list-box" style={listStyle}>
|
|
60
60
|
<VirtualPagedList
|
|
61
61
|
key={selectedLoadIdNode}
|
|
62
62
|
ref={listRef}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
.
|
|
1
|
+
.infinite-level-box {
|
|
2
2
|
-webkit-user-select: none; /* Safari */
|
|
3
3
|
-moz-user-select: none; /* Firefox */
|
|
4
4
|
-ms-user-select: none; /* IE/Edge */
|
|
5
5
|
user-select: none; /* Standard syntax */
|
|
6
6
|
}
|
|
7
|
-
.breadcrumb-
|
|
7
|
+
.infinite-level-breadcrumb-position {
|
|
8
8
|
position: sticky;
|
|
9
9
|
top: 0px;
|
|
10
10
|
z-index: 9;
|
|
11
|
-
.
|
|
11
|
+
.breadcrumb-box {
|
|
12
12
|
height: 40px;
|
|
13
13
|
width: 100%; /* 或者其他固定宽度 */
|
|
14
14
|
overflow: hidden; /* 隐藏水平滚动条 */
|
|
@@ -16,15 +16,14 @@
|
|
|
16
16
|
overflow-x: auto;
|
|
17
17
|
display: flex;
|
|
18
18
|
align-items: center;
|
|
19
|
-
|
|
20
|
-
> div {
|
|
19
|
+
.breadcrumb-item {
|
|
21
20
|
display: inline-block;
|
|
22
|
-
.separator {
|
|
21
|
+
.breadcrumb-separator {
|
|
23
22
|
margin: 0 4px;
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
|
-
.
|
|
26
|
+
.breadcrumb-box-mobile::-webkit-scrollbar {
|
|
28
27
|
display: none; /* 隐藏滚动条(适用于 Chrome/Edge/Safari) */
|
|
29
28
|
}
|
|
30
29
|
}
|
package/src/type.d.ts
CHANGED
package/src/use-infinite-list.ts
CHANGED
|
@@ -28,6 +28,7 @@ export function useInfiniteList(props: InfiniteListProps) {
|
|
|
28
28
|
listModal,
|
|
29
29
|
breadModel,
|
|
30
30
|
virtualPagedListProps,
|
|
31
|
+
className,
|
|
31
32
|
} = props;
|
|
32
33
|
const [loading, setLoading] = useState(false);
|
|
33
34
|
const [selectedLoadIdNode, setSelectedLoadIdNode] = useState<number | null>(null);
|
|
@@ -131,6 +132,7 @@ export function useInfiniteList(props: InfiniteListProps) {
|
|
|
131
132
|
virtualPagedListProps,
|
|
132
133
|
listModal,
|
|
133
134
|
breadModel,
|
|
135
|
+
className,
|
|
134
136
|
},
|
|
135
137
|
actions: {
|
|
136
138
|
handleSelectId,
|