Skip to content

Commit b376610

Browse files
Add new prop to define max rows in DndTable (#818)
* new prop to define max rows Signed-off-by: David BRAQUART <[email protected]> * change comment Signed-off-by: David BRAQUART <[email protected]> --------- Signed-off-by: David BRAQUART <[email protected]> Co-authored-by: Abdelsalem <[email protected]>
1 parent 1368409 commit b376610

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/components/dnd-table/dnd-table.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ interface DndTableProps {
200200
uploadButtonMessageId?: string;
201201
handleResetButton?: () => void;
202202
resetButtonMessageId?: string;
203+
maxRows?: number;
203204
}
204205

205206
export function DndTable(props: Readonly<DndTableProps>) {
@@ -224,6 +225,7 @@ export function DndTable(props: Readonly<DndTableProps>) {
224225
uploadButtonMessageId = undefined,
225226
handleResetButton = undefined,
226227
resetButtonMessageId = undefined,
228+
maxRows = MAX_ROWS_NUMBER,
227229
} = props;
228230
const intl = useIntl();
229231

@@ -259,16 +261,16 @@ export function DndTable(props: Readonly<DndTableProps>) {
259261
}
260262

261263
const addNewRows = (numberOfRows: number) => {
262-
// checking if not exceeding 100 steps
263-
if (currentRows.length + numberOfRows > MAX_ROWS_NUMBER) {
264+
// checking if not exceeding the max allowed
265+
if (currentRows.length + numberOfRows > maxRows) {
264266
setError(arrayFormName, {
265267
type: 'custom',
266268
message: intl.formatMessage(
267269
{
268270
id: 'MaximumRowNumberError',
269271
},
270272
{
271-
value: MAX_ROWS_NUMBER,
273+
value: maxRows,
272274
}
273275
),
274276
});

0 commit comments

Comments
 (0)