enforce maxRows on Arrays and Blocks

This commit is contained in:
Elliot DeNolf
2020-10-09 10:04:33 -04:00
parent 6b6b503ef0
commit cd38d37242
2 changed files with 4 additions and 2 deletions

View File

@@ -180,6 +180,7 @@ const RenderArray = React.memo((props) => {
value,
readOnly,
minRows,
maxRows,
} = props;
return (
@@ -240,7 +241,7 @@ const RenderArray = React.memo((props) => {
</div>
)}
</Droppable>
{!readOnly && (
{(!readOnly && (rows.length < maxRows || maxRows === undefined)) && (
<div className={`${baseClass}__add-button-wrap`}>
<Button
onClick={() => addRow(value)}

View File

@@ -198,6 +198,7 @@ const RenderBlocks = React.memo((props) => {
blocks,
readOnly,
minRows,
maxRows,
} = props;
return (
@@ -282,7 +283,7 @@ const RenderBlocks = React.memo((props) => {
)}
</Droppable>
{!readOnly && (
{(!readOnly && (rows.length < maxRows || maxRows === undefined)) && (
<div className={`${baseClass}__add-button-wrap`}>
<Popup
buttonType="custom"