@hzab/hierarchical-statistics 0.0.3 → 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 CHANGED
@@ -1,4 +1,8 @@
1
- # @hzab/component-boilerplate@0.0.2
1
+ # @hzab/component-boilerplate@0.0.4
2
+ - fix: dependencies改成peerDependencies
3
+ - fix: 样式index.module.less改成index.less引入
4
+ - fix: 新增className外层类名传递
5
+ # @hzab/component-boilerplate@0.0.3
2
6
  - fix: 适配mobile的ItemRender自定义字段
3
7
  # @hzab/component-boilerplate@0.0.1
4
8
  组件初始化
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.4",
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" });
@@ -32,10 +33,10 @@ const InfiniteListUIMobile = (props: InfiniteListProps, ref: ForwardedRef<Infini
32
33
  fetchBreadData,
33
34
  }));
34
35
  return (
35
- <div className={styles["contain"]} style={style}>
36
+ <div className={`infinite-level-box ${className || ""}`} style={style}>
36
37
  <Spin spinning={loading}>
37
38
  {/* 面包屑导航 */}
38
- <div className={styles["breadcrumb-box-main"]}>
39
+ <div className="infinite-level-breadcrumb-position">
39
40
  <Breadcrumb
40
41
  terminal="mobile"
41
42
  readcrumbStyle={readcrumbStyle}
@@ -48,7 +49,7 @@ const InfiniteListUIMobile = (props: InfiniteListProps, ref: ForwardedRef<Infini
48
49
  {Slots?.fixRenderCenter && <Slots.fixRenderCenter></Slots.fixRenderCenter>}
49
50
  </div>
50
51
 
51
- <div className={styles["list-box-main"]} style={listStyle}>
52
+ <div className="infinite-level-list-box" style={listStyle}>
52
53
  {/* 移动端 */}
53
54
  <ListRender ref={listRef} model={listModal} {...listRenderProps} ItemRender={Slots.renderItem} />
54
55
  </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 styles from "../index.module.less";
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={styles["contain"]} style={style}>
45
+ <div className={`infinite-level-box ${className || ""}`} style={style}>
45
46
  <Spin spinning={loading}>
46
47
  {/* 面包屑导航 */}
47
- <div className={styles["breadcrumb-box-main"]}>
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
- .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
@@ -26,6 +26,8 @@ export interface InfiniteListInstance {
26
26
  listModal?: any;
27
27
  }
28
28
  export interface InfiniteListProps {
29
+ /** 添加外层类名 */
30
+ className?: string;
29
31
  /** 面包屑显示对应关联字段默认 value,label */
30
32
  fieldBreadcrumb?: FieldItem;
31
33
  /** 是否有首页,默认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,