@hzab/list-render 1.12.1 → 1.12.2

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,7 @@
1
+ # @hzab/list-render@1.12.2
2
+
3
+ fix: card 模式无数据时显示优化
4
+
1
5
  # @hzab/list-render@1.12.1
2
6
 
3
7
  fix: card 模式添加 loading
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hzab/list-render",
3
- "version": "1.12.1",
3
+ "version": "1.12.2",
4
4
  "description": "",
5
5
  "main": "src",
6
6
  "scripts": {
@@ -1,11 +1,10 @@
1
1
  import { useEffect, useState, useMemo, useCallback, useRef } from "react";
2
- import { Table, Button, Popconfirm, Tooltip, Checkbox, Popover, Spin } from "antd";
2
+ import { Table, Button, Popconfirm, Tooltip, Checkbox, Popover, Spin, Empty } from "antd";
3
3
  import { QuestionCircleOutlined, FilterOutlined, SettingOutlined } from "@ant-design/icons";
4
4
  import _ from "lodash";
5
5
  import DetailRender from "@hzab/schema-descriptions";
6
6
  import { removeInTableFalseFields } from "../common/utils";
7
7
  import "./index.less";
8
- import { use } from "react";
9
8
 
10
9
  const scenario = "table-render";
11
10
 
@@ -105,20 +104,25 @@ function CardRender(props) {
105
104
 
106
105
  return (
107
106
  <Spin spinning={loading}>
108
- <div className="card-render-wrap" style={{ gridTemplateColumns: `repeat(${columns}, 1fr` }}>
109
- {props.list?.map((item, index) => {
110
- return (
111
- <div key={item["id"]} className="item-render-card">
112
- {props.hasAction !== false ? (
113
- <div className="item-render-card-title">{getColRender(item, index)}</div>
114
- ) : null}
115
- <div className="item-render-card-content">
116
- <ItemRender item={item} index={index} />
117
- </div>
118
- </div>
119
- );
120
- })}
121
- </div>
107
+ {
108
+ props.list?.length > 0 ?
109
+ <div className="card-render-wrap" style={{ gridTemplateColumns: `repeat(${columns}, 1fr` }}>
110
+ {props.list?.map((item, index) => {
111
+ return (
112
+ <div key={item["id"]} className="item-render-card">
113
+ {props.hasAction !== false ? (
114
+ <div className="item-render-card-title">{getColRender(item, index)}</div>
115
+ ) : null}
116
+ <div className="item-render-card-content">
117
+ <ItemRender item={item} index={index} />
118
+ </div>
119
+ </div>
120
+ );
121
+ })}
122
+ </div> : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE}></Empty>
123
+ }
124
+
125
+
122
126
  </Spin>
123
127
 
124
128
  );