Skip to content

Commit

Permalink
feat: make createRow optional in table input (#400)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaynethiessen committed Mar 26, 2024
1 parent a25b55e commit b3004de
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/controls/src/inputs/TableInput/TableInput.tsx
Expand Up @@ -24,7 +24,7 @@ interface TableInputProps<A extends DefaultTableType> {
values: A[];
columns: Column<A>[];
setFieldValue: (field: string, value: any, shouldValidate?: boolean | undefined) => void;
createRow: () => A;
createRow?: () => A;
tableProps?: TableProps;
headerRowProps?: HeaderGroupPropGetter<A>;
headerCellProps?: HeaderPropGetter<A>;
Expand Down Expand Up @@ -76,7 +76,9 @@ function TableInputTable<A extends DefaultTableType>(props: TableInputTableProps
setFieldValue(`${name}[${rowIndex}].${columnId}`, value);
},
addRow() {
arrayHelpers.push(createRow());
if (createRow) {
arrayHelpers.push(createRow());
}
},
arrayHelpers,
});
Expand Down

0 comments on commit b3004de

Please sign in to comment.