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

Add Initial Support For Creation in Choices Inputs #6163

Closed
wants to merge 21 commits into from

Conversation

djhi
Copy link
Collaborator

@djhi djhi commented Apr 13, 2021

  • Add support for creation in SelectInput
  • Add support for creation in AutocompleteInput
  • Check support for creation in ReferenceInput
  • Add support for creation in AutocompleteArrayInput
  • Check support for creation in ReferenceArrayInput
  • Add support for creation in SelectArrayInput
  • Tests
  • Documentation

ra-quick-create

ra-quick-create-autocomplete-modal-reference

ra-quick-create-autocompletearray-modal-reference

@djhi djhi added the WIP Work In Progress label Apr 13, 2021
@djhi djhi added RFR Ready For Review and removed WIP Work In Progress labels Apr 16, 2021
Copy link
Member

@fzaninotto fzaninotto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I think we're missing an option in ReferenceInput that would handle the creation automatically. But let' do that in another PR.

packages/ra-core/src/dataProvider/useGetMany.ts Outdated Show resolved Hide resolved
packages/ra-core/src/form/useChoices.ts Outdated Show resolved Hide resolved
expect(queryByRole('progressbar')).toBeNull();
});

test('should support creation of a new choice through the onCreate event', async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use it as previous

/>
);

expect(queryByRole('progressbar')).toBeNull();
});
});

test('should support creation of a new choice through the onCreate event', async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please test with 'it'

).not.toBeNull();
});

test('should support creation of a new choice through the onCreate event with a promise', async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

onCreate: (choice: any) => void;
onCancel: () => void;
}
export const useCreateSuggestion = () => useContext(CreateSuggestionContext);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad name, as it does not actually create anything

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have a better one?

Copy link
Collaborator Author

@djhi djhi Apr 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useCreateSuggestionContext ?

@djhi
Copy link
Collaborator Author

djhi commented Apr 27, 2021

Messed up my commits/rebase big time 😭

@djhi djhi closed this Apr 27, 2021
@djhi djhi deleted the quick-create-support branch April 27, 2021 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants