mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
Merge pull request #1517 from rowyio/feat/auto-fill-table-id
ROWY-2110 fix broken table id prefill for table setup
This commit is contained in:
@@ -12,7 +12,7 @@ export interface ITableNameProps extends IShortTextComponentProps {
|
||||
|
||||
export default function TableName({ watchedField, ...props }: ITableNameProps) {
|
||||
const {
|
||||
field: { onChange, value },
|
||||
field: { onChange },
|
||||
useFormMethods: { control },
|
||||
disabled,
|
||||
} = props;
|
||||
@@ -25,12 +25,9 @@ export default function TableName({ watchedField, ...props }: ITableNameProps) {
|
||||
if (!touched && typeof watchedValue === "string" && !!watchedValue) {
|
||||
// if table name field is not touched, and watched value is valid, set table name to watched value
|
||||
onChange(startCase(watchedValue));
|
||||
} else if (typeof value === "string") {
|
||||
// otherwise if table name is valid, set watched value to table name
|
||||
onChange(startCase(value.trim()));
|
||||
}
|
||||
}
|
||||
}, [watchedValue, disabled, onChange, value]);
|
||||
}, [watchedValue, disabled]);
|
||||
|
||||
return <ShortTextComponent {...props} />;
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ export const tableSettings = (
|
||||
name: "name",
|
||||
label: "Table name",
|
||||
required: true,
|
||||
watchedField: "name",
|
||||
watchedField: "collection",
|
||||
assistiveText: "User-facing name for this table",
|
||||
autoFocus: true,
|
||||
gridCols: { xs: 12, sm: 6 },
|
||||
|
||||
Reference in New Issue
Block a user