diff --git a/packages/form-render/src/widgets/listTable/index.tsx b/packages/form-render/src/widgets/listTable/index.tsx index d0bb69f22..993c9a5d8 100644 --- a/packages/form-render/src/widgets/listTable/index.tsx +++ b/packages/form-render/src/widgets/listTable/index.tsx @@ -15,6 +15,10 @@ interface ListTableProps { delConfirmProps: any; renderCore: any; rootPath: any; + /* + * 没有数据时是否隐藏表格 + */ + hideTableWhenNoData?: boolean; [key: string]: any; }; @@ -57,6 +61,7 @@ const TableList: React.FC = (props) => { hideMove, hideAdd, hideOperate, + hideTableWhenNoData, addItem, copyItem, @@ -141,19 +146,19 @@ const TableList: React.FC = (props) => { ...otherActionColumnProps, render: (_, field) => ( - }> + }> {!hideMove && ( <> - moveItem(field.name, field.name - 1)} - icon={} + icon={} {...moveUpBtnProps} /> - moveItem(field.name, field.name + 1)} - icon={} + icon={} {...moveDownBtnProps} /> @@ -164,16 +169,16 @@ const TableList: React.FC = (props) => { {...delConfirmProps} > } + icon={} btnType={operateBtnType} {...deleteBtnProps} /> )} {!hideCopy && ( - handleCopy(field.name)} - icon={} + icon={} {...copyBtnProps} /> )} @@ -183,17 +188,21 @@ const TableList: React.FC = (props) => { }); } + const showTable = fields.length > 0 ? true : !hideTableWhenNoData; + return (
- + {showTable && ( +
+ )} {(!schema.max || fields.length < schema.max) && !hideAdd && (