@hzab/hierarchical-statistics 0.0.3 → 0.0.5

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
@@ -1,4 +1,10 @@
1
- # @hzab/component-boilerplate@0.0.2
1
+ # @hzab/component-boilerplate@0.0.5
2
+ - fix: 暴露面包屑回显数据breadcrumbData
3
+ # @hzab/component-boilerplate@0.0.4
4
+ - fix: dependencies改成peerDependencies
5
+ - fix: 样式index.module.less改成index.less引入
6
+ - fix: 新增className外层类名传递
7
+ # @hzab/component-boilerplate@0.0.3
2
8
  - fix: 适配mobile的ItemRender自定义字段
3
9
  # @hzab/component-boilerplate@0.0.1
4
10
  组件初始化
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hzab/hierarchical-statistics",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "",
5
5
  "main": "src",
6
6
  "scripts": {
@@ -46,9 +46,9 @@
46
46
  "prettier --write"
47
47
  ]
48
48
  },
49
- "dependencies": {
50
- "@hzab/data-model": "^1.7.5",
51
- "@hzab/headless-components": "^0.0.3",
52
- "@hzab/list-render-mobile": "^1.1.7"
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 styles from "../index.module.less";
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={`${styles["readcrumb-item"]}`} key={index}>
7
+ <div className="breadcrumb-item" key={index}>
11
8
  <span
12
- className={styles["title"]}
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={styles["separator"]} style={separatorStyle}>
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 styles from "../index.module.less";
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" });
@@ -30,12 +31,13 @@ const InfiniteListUIMobile = (props: InfiniteListProps, ref: ForwardedRef<Infini
30
31
  listModal,
31
32
  breadModel,
32
33
  fetchBreadData,
34
+ breadcrumbData,
33
35
  }));
34
36
  return (
35
- <div className={styles["contain"]} style={style}>
37
+ <div className={`infinite-level-box ${className || ""}`} style={style}>
36
38
  <Spin spinning={loading}>
37
39
  {/* 面包屑导航 */}
38
- <div className={styles["breadcrumb-box-main"]}>
40
+ <div className="infinite-level-breadcrumb-position">
39
41
  <Breadcrumb
40
42
  terminal="mobile"
41
43
  readcrumbStyle={readcrumbStyle}
@@ -48,7 +50,7 @@ const InfiniteListUIMobile = (props: InfiniteListProps, ref: ForwardedRef<Infini
48
50
  {Slots?.fixRenderCenter && <Slots.fixRenderCenter></Slots.fixRenderCenter>}
49
51
  </div>
50
52
 
51
- <div className={styles["list-box-main"]} style={listStyle}>
53
+ <div className="infinite-level-list-box" style={listStyle}>
52
54
  {/* 移动端 */}
53
55
  <ListRender ref={listRef} model={listModal} {...listRenderProps} ItemRender={Slots.renderItem} />
54
56
  </div>
@@ -4,11 +4,12 @@ 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 styles from "../index.module.less";
7
+ import "../index.less";
8
8
  const InfiniteListUIPc = (props: InfiniteListProps, ref: ForwardedRef<InfiniteListInstance>) => {
9
9
  const {
10
10
  states: {
11
11
  listModal,
12
+ breadModel,
12
13
  readcrumbStyle,
13
14
  separatorStyle,
14
15
  separator,
@@ -20,8 +21,9 @@ const InfiniteListUIPc = (props: InfiniteListProps, ref: ForwardedRef<InfiniteLi
20
21
  listStyle,
21
22
  listRef,
22
23
  virtualPagedListProps,
24
+ className,
23
25
  },
24
- actions: { handleSelectId, handleNodeClick, handleBreadcrumbClick },
26
+ actions: { handleSelectId, handleNodeClick, handleBreadcrumbClick, fetchBreadData },
25
27
  } = useInfiniteList({ ...props, terminal: "pc" });
26
28
 
27
29
  useImperativeHandle(ref, () => ({
@@ -29,6 +31,9 @@ const InfiniteListUIPc = (props: InfiniteListProps, ref: ForwardedRef<InfiniteLi
29
31
  handleSelectId,
30
32
  listRef: listRef?.current,
31
33
  listModal,
34
+ breadModel,
35
+ fetchBreadData,
36
+ breadcrumbData,
32
37
  }));
33
38
 
34
39
  const loadData = async (pageNum) => {
@@ -41,10 +46,10 @@ const InfiniteListUIPc = (props: InfiniteListProps, ref: ForwardedRef<InfiniteLi
41
46
  };
42
47
  };
43
48
  return (
44
- <div className={styles["contain"]} style={style}>
49
+ <div className={`infinite-level-box ${className || ""}`} style={style}>
45
50
  <Spin spinning={loading}>
46
51
  {/* 面包屑导航 */}
47
- <div className={styles["breadcrumb-box-main"]}>
52
+ <div className="infinite-level-breadcrumb-position">
48
53
  <Breadcrumb
49
54
  terminal="pc"
50
55
  readcrumbStyle={readcrumbStyle}
@@ -55,8 +60,7 @@ const InfiniteListUIPc = (props: InfiniteListProps, ref: ForwardedRef<InfiniteLi
55
60
  ></Breadcrumb>
56
61
  {Slots?.fixRenderCenter && <Slots.fixRenderCenter></Slots.fixRenderCenter>}
57
62
  </div>
58
-
59
- <div className={styles["list-box-main"]} style={listStyle}>
63
+ <div className="infinite-level-list-box" style={listStyle}>
60
64
  <VirtualPagedList
61
65
  key={selectedLoadIdNode}
62
66
  ref={listRef}
@@ -1,14 +1,14 @@
1
- .contain {
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-box-main {
7
+ .infinite-level-breadcrumb-position {
8
8
  position: sticky;
9
9
  top: 0px;
10
10
  z-index: 9;
11
- .readcrumb-box {
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
- .readcrumb-box-mobile::-webkit-scrollbar {
26
+ .breadcrumb-box-mobile::-webkit-scrollbar {
28
27
  display: none; /* 隐藏滚动条(适用于 Chrome/Edge/Safari) */
29
28
  }
30
29
  }
package/src/type.d.ts CHANGED
@@ -24,8 +24,15 @@ 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 {
34
+ /** 添加外层类名 */
35
+ className?: string;
29
36
  /** 面包屑显示对应关联字段默认 value,label */
30
37
  fieldBreadcrumb?: FieldItem;
31
38
  /** 是否有首页,默认false */
@@ -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,