From 78d84cbaab3a45433d88c3926c48a710951ac225 Mon Sep 17 00:00:00 2001 From: lhbxs <596850703@qq.com> Date: Wed, 24 Jan 2024 16:01:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=90=8D=E7=A7=B0=20hideEmptyTable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/form-render/src/widgets/listTable/index.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/form-render/src/widgets/listTable/index.tsx b/packages/form-render/src/widgets/listTable/index.tsx index 993c9a5d8..f6194998b 100644 --- a/packages/form-render/src/widgets/listTable/index.tsx +++ b/packages/form-render/src/widgets/listTable/index.tsx @@ -18,7 +18,7 @@ interface ListTableProps { /* * 没有数据时是否隐藏表格 */ - hideTableWhenNoData?: boolean; + emptyHiddenTable?: boolean; [key: string]: any; }; @@ -61,8 +61,7 @@ const TableList: React.FC = (props) => { hideMove, hideAdd, hideOperate, - hideTableWhenNoData, - + hideEmptyTable, addItem, copyItem, moveItem, @@ -188,7 +187,7 @@ const TableList: React.FC = (props) => { }); } - const showTable = fields.length > 0 ? true : !hideTableWhenNoData; + const showTable = fields.length > 0 ? true : !hideEmptyTable; return (
From 789a7918c156f65551b510a6a2e75a95bec13c8a Mon Sep 17 00:00:00 2001 From: lhbxs <596850703@qq.com> Date: Wed, 24 Jan 2024 16:11:42 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/form-render/CHANGELOG.md | 3 +++ packages/form-render/package.json | 2 +- .../src/widgets/listTable/index.tsx | 2 +- .../src/widgets/listVirtual/index.tsx | 27 ++++++++++++------- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/packages/form-render/CHANGELOG.md b/packages/form-render/CHANGELOG.md index 31dc1f768..9f9a8589f 100644 --- a/packages/form-render/CHANGELOG.md +++ b/packages/form-render/CHANGELOG.md @@ -1,5 +1,8 @@ # 更新日志 +### 2.3.9 +- [+] TableList 增加 hideEmptyTable 属性 + ### 2.3.8 - [!] 修复 schema 多层嵌套下,getSchemaByPath 获取异常 diff --git a/packages/form-render/package.json b/packages/form-render/package.json index 1c6fdaac2..cdc69b5a1 100644 --- a/packages/form-render/package.json +++ b/packages/form-render/package.json @@ -1,6 +1,6 @@ { "name": "form-render", - "version": "2.3.8", + "version": "2.3.9", "description": "通过 JSON Schema 生成标准 Form,常用于自定义搭建配置界面生成", "keywords": [ "Form", diff --git a/packages/form-render/src/widgets/listTable/index.tsx b/packages/form-render/src/widgets/listTable/index.tsx index f6194998b..dc4a9a606 100644 --- a/packages/form-render/src/widgets/listTable/index.tsx +++ b/packages/form-render/src/widgets/listTable/index.tsx @@ -18,7 +18,7 @@ interface ListTableProps { /* * 没有数据时是否隐藏表格 */ - emptyHiddenTable?: boolean; + hideEmptyTable?: boolean; [key: string]: any; }; diff --git a/packages/form-render/src/widgets/listVirtual/index.tsx b/packages/form-render/src/widgets/listVirtual/index.tsx index 637e30657..af1eb0957 100644 --- a/packages/form-render/src/widgets/listVirtual/index.tsx +++ b/packages/form-render/src/widgets/listVirtual/index.tsx @@ -16,6 +16,10 @@ interface ListVirtualProps { delConfirmProps: any; renderCore: any; rootPath: any; + /* + * 没有数据时是否隐藏表格 + */ + hideEmptyTable?: boolean; [key: string]: any; }; @@ -58,6 +62,7 @@ const VirtualList: React.FC = (props) => { hideMove, hideAdd, hideOperate, + hideEmptyTable, addItem, copyItem, @@ -180,17 +185,21 @@ const VirtualList: React.FC = (props) => { }); } + const showTable = fields.length > 0 ? true : !hideEmptyTable; + return ( <> - + {showTable && ( +
+ )} {(!schema.max || fields.length < schema.max) && !hideAdd && (