Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 修改字段名称 hideEmptyTable #1471

Merged
merged 2 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/form-render/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# 更新日志

### 2.3.9
- [+] TableList 增加 hideEmptyTable 属性

### 2.3.8
- [!] 修复 schema 多层嵌套下,getSchemaByPath 获取异常

Expand Down
2 changes: 1 addition & 1 deletion packages/form-render/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "form-render",
"version": "2.3.8",
"version": "2.3.9",
"description": "通过 JSON Schema 生成标准 Form,常用于自定义搭建配置界面生成",
"keywords": [
"Form",
Expand Down
7 changes: 3 additions & 4 deletions packages/form-render/src/widgets/listTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface ListTableProps {
/*
* 没有数据时是否隐藏表格
*/
hideTableWhenNoData?: boolean;
hideEmptyTable?: boolean;
[key: string]: any;
};

Expand Down Expand Up @@ -61,8 +61,7 @@ const TableList: React.FC<ListTableProps> = (props) => {
hideMove,
hideAdd,
hideOperate,
hideTableWhenNoData,

hideEmptyTable,
addItem,
copyItem,
moveItem,
Expand Down Expand Up @@ -188,7 +187,7 @@ const TableList: React.FC<ListTableProps> = (props) => {
});
}

const showTable = fields.length > 0 ? true : !hideTableWhenNoData;
const showTable = fields.length > 0 ? true : !hideEmptyTable;

return (
<div className={classnames('fr-table-list', { 'fr-table-list-no-popover': !islidatePopover })}>
Expand Down
27 changes: 18 additions & 9 deletions packages/form-render/src/widgets/listVirtual/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ interface ListVirtualProps {
delConfirmProps: any;
renderCore: any;
rootPath: any;
/*
* 没有数据时是否隐藏表格
*/
hideEmptyTable?: boolean;
[key: string]: any;
};

Expand Down Expand Up @@ -58,6 +62,7 @@ const VirtualList: React.FC<ListVirtualProps> = (props) => {
hideMove,
hideAdd,
hideOperate,
hideEmptyTable,

addItem,
copyItem,
Expand Down Expand Up @@ -180,17 +185,21 @@ const VirtualList: React.FC<ListVirtualProps> = (props) => {
});
}

const showTable = fields.length > 0 ? true : !hideEmptyTable;

return (
<>
<Table
className={classnames('fr-virtual-list', { 'fr-virtual-list-no-popover': !islidatePopover })}
size='middle'
columns={columns}
dataSource={fields}
pagination={false}
scroll={{ y: scrollY }}
components={vt}
/>
{showTable && (
<Table
className={classnames('fr-virtual-list', { 'fr-virtual-list-no-popover': !islidatePopover })}
size='middle'
columns={columns}
dataSource={fields}
pagination={false}
scroll={{ y: scrollY }}
components={vt}
/>
)}
{(!schema.max || fields.length < schema.max) && !hideAdd && (
<Button
icon={<PlusOutlined />}
Expand Down
Loading