Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateGuesser / EditGuesser formId attribute to bind outher input elements #540

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/CreateGuesser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const IntrospectedCreateGuesser = ({
toolbar,
warnWhenUnsavedChanges,
sanitizeEmptyValues = true,
formId,
formComponent,
viewComponent,
children,
Expand Down Expand Up @@ -166,6 +167,7 @@ export const IntrospectedCreateGuesser = ({
return (
<Create resource={resource} component={viewComponent} {...props}>
<FormType
id={formId}
onSubmit={save}
mode={mode}
defaultValues={defaultValues}
Expand Down
2 changes: 2 additions & 0 deletions src/EditGuesser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const IntrospectedEditGuesser = ({
transform,
toolbar,
warnWhenUnsavedChanges,
formId,
formComponent,
viewComponent,
sanitizeEmptyValues = true,
Expand Down Expand Up @@ -202,6 +203,7 @@ export const IntrospectedEditGuesser = ({
component={viewComponent}
{...props}>
<FormType
id={formId}
onSubmit={mutationMode !== 'pessimistic' ? undefined : save}
mode={mode}
defaultValues={defaultValues}
Expand Down
3 changes: 3 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import type {
DeleteResult,
EditProps,
EmailFieldProps,
FormProps,
GET_LIST,
GET_MANY,
GET_MANY_REFERENCE,
Expand Down Expand Up @@ -371,6 +372,7 @@ type CreateFormProps = Omit<
CreateProps & SimpleFormProps & TabbedFormProps,
'children'
> &
Partial<PickRename<FormProps, 'id', 'formId'>> &
Partial<PickRename<CreateProps, 'component', 'viewComponent'>> &
Partial<
PickRename<SimpleFormProps & TabbedFormProps, 'component', 'formComponent'>
Expand All @@ -391,6 +393,7 @@ type EditFormProps = Omit<
'children'
> &
Partial<PickRename<EditProps, 'component', 'viewComponent'>> &
Partial<PickRename<FormProps, 'id', 'formId'>> &
Partial<
PickRename<SimpleFormProps & TabbedFormProps, 'component', 'formComponent'>
> & {
Expand Down