@hzab/hierarchical-statistics 0.0.6 → 1.0.0-beta1

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,3 +1,5 @@
1
+ # @hzab/component-boilerplate@0.1.0
2
+ - fix: 删掉@hzab/list-render-mobile
1
3
  # @hzab/component-boilerplate@0.0.6
2
4
  - fix: 修复跳转同路由,listRender参数依赖没有更新问题
3
5
  # @hzab/component-boilerplate@0.0.5
package/README.md CHANGED
@@ -11,8 +11,8 @@
11
11
  ## 示例
12
12
 
13
13
  ```jsx
14
- import InfiniteListUIPc from "@hzab/hierarchical-statistics/src/components/InfiniteListUiPc";
15
- <InfiniteListUIPc
14
+ import InfiniteListUi from "@hzab/hierarchical-statistics/src/components/InfiniteListUi";
15
+ <InfiniteListUi
16
16
  ref={listRef}
17
17
  style={{
18
18
  maxWidth: "400px",
@@ -47,7 +47,7 @@ import InfiniteListUIPc from "@hzab/hierarchical-statistics/src/components/Infin
47
47
  dynamicHeightMode: true,
48
48
  noMoreComponent: <div>没有更多数据了</div>,
49
49
  }}
50
- ></InfiniteListUIPc>
50
+ ></InfiniteListUi>
51
51
  ```
52
52
 
53
53
  ## API
@@ -58,7 +58,7 @@ import InfiniteListUIPc from "@hzab/hierarchical-statistics/src/components/Infin
58
58
  | -------------------- | ------------------------------| ----- | --------- | ----------------------------------- |
59
59
  | listModal | Object | 是 | - | 列表数据模型DataModel,必须包含getListApi |
60
60
  | breadModel | Object | 否 | - | 回显数据模型DataModel,必须包含getApi |
61
- | showHome | boolean | 否 | - | 是否显示面包屑首页 |
61
+ | showHome | Boolean | 否 | - | 是否显示面包屑首页 |
62
62
  | onNodeClick | function(item) | 否 | - | item点击事件 |
63
63
  | onNodeSelect | function(item) | 否 | - | item选中事件 |
64
64
  | onBreadcrumbClick | function(item) | 否 | - | 回显点击事件 |
@@ -70,13 +70,11 @@ import InfiniteListUIPc from "@hzab/hierarchical-statistics/src/components/Infin
70
70
  | listStyle | CSSProperties | 否 | - | 列表外层样式 |
71
71
  | readcrumbStyle | CSSProperties | 否 | - | 面包屑外层样式 |
72
72
  | separatorStyle | CSSProperties | 否 | - | 面包屑分割符样式 |
73
- | listRenderProps | Object | 否 | - | list-render-mobile 配置 |
74
73
  | virtualPagedListProps| Object | 否 | - | virtualPagedList 配置 |
75
74
  | separator | string | 否 | - | 分隔符 默认"-" |
76
75
  | Slots | Object | 是 | - | 插槽 |
77
76
 
78
77
 
79
-
80
78
  ### Slots
81
79
 
82
80
  | 参数 | 类型 | 必填 | 默认值 | 说明 |
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@hzab/hierarchical-statistics",
3
- "version": "0.0.6",
3
+ "version": "1.0.0-beta1",
4
4
  "description": "",
5
5
  "main": "src",
6
6
  "scripts": {
7
7
  "dev": "webpack serve -c ./config/webpack.config.js --env local",
8
8
  "build": "webpack -c ./config/webpack.config.js --env production",
9
+ "publish-beta": "npm publish --beta",
9
10
  "publish-patch": "npm version patch && npm publish --access public",
10
11
  "publish-minor": "npm version minor && npm publish --access public",
11
12
  "publish-major": "npm version major && npm publish --access public",
@@ -48,7 +49,6 @@
48
49
  },
49
50
  "peerDependencies": {
50
51
  "@hzab/data-model": ">=1.7.5",
51
- "@hzab/headless-components": ">=0.0.3",
52
- "@hzab/list-render-mobile": ">=1.1.7"
52
+ "@hzab/headless-components": ">=0.0.3"
53
53
  }
54
54
  }
@@ -1,8 +1,8 @@
1
1
  import "../index.less";
2
2
  const BreadcrumbUI = (props: any) => {
3
- const { readcrumbStyle, separatorStyle, separator, breadcrumbData, terminal, handleBreadcrumbClick } = props;
3
+ const { readcrumbStyle, separatorStyle, separator, breadcrumbData, handleBreadcrumbClick } = props;
4
4
  return (
5
- <div className={`breadcrumb-box ${terminal !== "pc" ? "breadcrumb-box-mobile" : ""}`} style={readcrumbStyle}>
5
+ <div className={`breadcrumb-box`} style={readcrumbStyle}>
6
6
  {breadcrumbData.map((item, index) => (
7
7
  <div className="breadcrumb-item" key={index}>
8
8
  <span
@@ -5,7 +5,7 @@ import { useInfiniteList } from "../../use-infinite-list";
5
5
  import Breadcrumb from "../Breadcrumb";
6
6
  import { InfiniteListProps, InfiniteListInstance } from "../../type";
7
7
  import "../index.less";
8
- const InfiniteListUIPc = (props: InfiniteListProps, ref: ForwardedRef<InfiniteListInstance>) => {
8
+ const InfiniteListUi = (props: InfiniteListProps, ref: ForwardedRef<InfiniteListInstance>) => {
9
9
  const {
10
10
  states: {
11
11
  listModal,
@@ -24,8 +24,8 @@ const InfiniteListUIPc = (props: InfiniteListProps, ref: ForwardedRef<InfiniteLi
24
24
  className,
25
25
  refreshKey,
26
26
  },
27
- actions: { handleSelectId, handleNodeClick, handleBreadcrumbClick, fetchBreadData },
28
- } = useInfiniteList({ ...props, terminal: "pc" });
27
+ actions: { handleSelectId, handleNodeClick, handleBreadcrumbClick, fetchBreadData, handleListRefresh },
28
+ } = useInfiniteList({ ...props });
29
29
 
30
30
  useImperativeHandle(ref, () => ({
31
31
  handleNodeClick,
@@ -35,6 +35,7 @@ const InfiniteListUIPc = (props: InfiniteListProps, ref: ForwardedRef<InfiniteLi
35
35
  breadModel,
36
36
  fetchBreadData,
37
37
  breadcrumbData,
38
+ handleListRefresh,
38
39
  }));
39
40
 
40
41
  const loadData = async (pageNum) => {
@@ -46,13 +47,13 @@ const InfiniteListUIPc = (props: InfiniteListProps, ref: ForwardedRef<InfiniteLi
46
47
  isMore: res?.pagination?.total > (pageNum - 1) * listModal.query.pageSize + res?.list?.length ? true : false,
47
48
  };
48
49
  };
50
+
49
51
  return (
50
52
  <div className={`infinite-level-box ${className || ""}`} style={style}>
51
53
  <Spin spinning={loading}>
52
54
  {/* 面包屑导航 */}
53
55
  <div className="infinite-level-breadcrumb-position">
54
56
  <Breadcrumb
55
- terminal="pc"
56
57
  readcrumbStyle={readcrumbStyle}
57
58
  separatorStyle={separatorStyle}
58
59
  separator={separator}
@@ -75,4 +76,4 @@ const InfiniteListUIPc = (props: InfiniteListProps, ref: ForwardedRef<InfiniteLi
75
76
  );
76
77
  };
77
78
 
78
- export default forwardRef<InfiniteListInstance, InfiniteListProps>(InfiniteListUIPc);
79
+ export default forwardRef<InfiniteListInstance, InfiniteListProps>(InfiniteListUi);
package/src/type.d.ts CHANGED
@@ -29,6 +29,8 @@ export interface InfiniteListInstance {
29
29
  breadcrumbData?: any;
30
30
  /** 面包屑数据请求方法 */
31
31
  fetchBreadData?: () => Promise<void>;
32
+ /** 列表刷新 */
33
+ handleListRefresh?: () => void;
32
34
  }
33
35
  export interface InfiniteListProps {
34
36
  /** 添加外层类名 */
@@ -58,8 +60,6 @@ export interface InfiniteListProps {
58
60
  separatorStyle?: object;
59
61
  /** 面包屑外层 自定义css 样式 */
60
62
  readcrumbStyle?: object;
61
- /** 设备是pc,还是mobile */
62
- terminal?: string;
63
63
  /** 列表外层 css 样式 */
64
64
  listStyle?: object;
65
65
  /** list modal */
@@ -111,6 +111,11 @@ export function useInfiniteList(props: InfiniteListProps) {
111
111
  setLoading(false);
112
112
  }
113
113
  };
114
+ /** 列表刷新 */
115
+ const handleListRefresh = async () => {
116
+ listModal.query = { ...listModal.query, pageNum: 1 };
117
+ setRefreshKey((pre) => pre + 1);
118
+ };
114
119
 
115
120
  useEffect(() => {
116
121
  fetchBreadData();
@@ -141,6 +146,7 @@ export function useInfiniteList(props: InfiniteListProps) {
141
146
  handleNodeClick,
142
147
  handleBreadcrumbClick,
143
148
  fetchBreadData,
149
+ handleListRefresh,
144
150
  },
145
151
  };
146
152
  }
@@ -1,69 +0,0 @@
1
- import { ForwardedRef, forwardRef, useImperativeHandle, useRef } from "react";
2
- import { ConfigProvider, Spin } from "antd";
3
- import ListRender from "@hzab/list-render-mobile";
4
- import { useInfiniteList } from "../../use-infinite-list";
5
- import { InfiniteListProps, InfiniteListInstance } from "../../type";
6
- import Breadcrumb from "../Breadcrumb";
7
- import "../index.less";
8
- const InfiniteListUIMobile = (props: InfiniteListProps, ref: ForwardedRef<InfiniteListInstance>) => {
9
- const {
10
- states: {
11
- readcrumbStyle,
12
- separatorStyle,
13
- separator,
14
- listRenderProps,
15
- style,
16
- listModal,
17
- breadcrumbData,
18
- Slots,
19
- loading,
20
- listRef,
21
- listStyle,
22
- breadModel,
23
- className,
24
- refreshKey,
25
- },
26
- actions: { fetchBreadData, handleSelectId, handleNodeClick, handleBreadcrumbClick },
27
- } = useInfiniteList({ ...props, terminal: "mobile" });
28
- useImperativeHandle(ref, () => ({
29
- handleNodeClick,
30
- handleSelectId,
31
- listRef: listRef?.current,
32
- listModal,
33
- breadModel,
34
- fetchBreadData,
35
- breadcrumbData,
36
- }));
37
- return (
38
- <div className={`infinite-level-box ${className || ""}`} style={style}>
39
- <Spin spinning={loading}>
40
- {/* 面包屑导航 */}
41
- <div className="infinite-level-breadcrumb-position">
42
- <Breadcrumb
43
- terminal="mobile"
44
- readcrumbStyle={readcrumbStyle}
45
- separatorStyle={separatorStyle}
46
- separator={separator}
47
- breadcrumbData={breadcrumbData}
48
- handleBreadcrumbClick={handleBreadcrumbClick}
49
- Slots={Slots}
50
- ></Breadcrumb>
51
- {Slots?.fixRenderCenter && <Slots.fixRenderCenter></Slots.fixRenderCenter>}
52
- </div>
53
-
54
- <div className="infinite-level-list-box" style={listStyle}>
55
- {/* 移动端 */}
56
- <ListRender
57
- key={refreshKey}
58
- ref={listRef}
59
- model={listModal}
60
- {...listRenderProps}
61
- ItemRender={Slots.renderItem}
62
- />
63
- </div>
64
- </Spin>
65
- </div>
66
- );
67
- };
68
-
69
- export default forwardRef<InfiniteListInstance, InfiniteListProps>(InfiniteListUIMobile);