Skip to content

Commit d9027aa

Browse files
authored
Merge pull request #1471 from alibaba/emptyOnly
feat: 修改字段名称 hideEmptyTable
2 parents 618bc0e + 789a791 commit d9027aa

File tree

4 files changed

+25
-14
lines changed

4 files changed

+25
-14
lines changed

packages/form-render/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# 更新日志
22

3+
### 2.3.9
4+
- [+] TableList 增加 hideEmptyTable 属性
5+
36
### 2.3.8
47
- [!] 修复 schema 多层嵌套下,getSchemaByPath 获取异常
58

packages/form-render/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "form-render",
3-
"version": "2.3.8",
3+
"version": "2.3.9",
44
"description": "通过 JSON Schema 生成标准 Form,常用于自定义搭建配置界面生成",
55
"keywords": [
66
"Form",

packages/form-render/src/widgets/listTable/index.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface ListTableProps {
1818
/*
1919
* 没有数据时是否隐藏表格
2020
*/
21-
hideTableWhenNoData?: boolean;
21+
hideEmptyTable?: boolean;
2222
[key: string]: any;
2323
};
2424

@@ -61,8 +61,7 @@ const TableList: React.FC<ListTableProps> = (props) => {
6161
hideMove,
6262
hideAdd,
6363
hideOperate,
64-
hideTableWhenNoData,
65-
64+
hideEmptyTable,
6665
addItem,
6766
copyItem,
6867
moveItem,
@@ -188,7 +187,7 @@ const TableList: React.FC<ListTableProps> = (props) => {
188187
});
189188
}
190189

191-
const showTable = fields.length > 0 ? true : !hideTableWhenNoData;
190+
const showTable = fields.length > 0 ? true : !hideEmptyTable;
192191

193192
return (
194193
<div className={classnames('fr-table-list', { 'fr-table-list-no-popover': !islidatePopover })}>

packages/form-render/src/widgets/listVirtual/index.tsx

+18-9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ interface ListVirtualProps {
1616
delConfirmProps: any;
1717
renderCore: any;
1818
rootPath: any;
19+
/*
20+
* 没有数据时是否隐藏表格
21+
*/
22+
hideEmptyTable?: boolean;
1923
[key: string]: any;
2024
};
2125

@@ -58,6 +62,7 @@ const VirtualList: React.FC<ListVirtualProps> = (props) => {
5862
hideMove,
5963
hideAdd,
6064
hideOperate,
65+
hideEmptyTable,
6166

6267
addItem,
6368
copyItem,
@@ -180,17 +185,21 @@ const VirtualList: React.FC<ListVirtualProps> = (props) => {
180185
});
181186
}
182187

188+
const showTable = fields.length > 0 ? true : !hideEmptyTable;
189+
183190
return (
184191
<>
185-
<Table
186-
className={classnames('fr-virtual-list', { 'fr-virtual-list-no-popover': !islidatePopover })}
187-
size='middle'
188-
columns={columns}
189-
dataSource={fields}
190-
pagination={false}
191-
scroll={{ y: scrollY }}
192-
components={vt}
193-
/>
192+
{showTable && (
193+
<Table
194+
className={classnames('fr-virtual-list', { 'fr-virtual-list-no-popover': !islidatePopover })}
195+
size='middle'
196+
columns={columns}
197+
dataSource={fields}
198+
pagination={false}
199+
scroll={{ y: scrollY }}
200+
components={vt}
201+
/>
202+
)}
194203
{(!schema.max || fields.length < schema.max) && !hideAdd && (
195204
<Button
196205
icon={<PlusOutlined />}

0 commit comments

Comments
 (0)