api-platform / admin

A beautiful and fully-featured administration interface builder for hypermedia APIs
https://api-platform.com/docs/admin/
MIT License
480 stars 130 forks source link

feat: allow to use tabbed components in guessers #476

Closed PawelSuwinski closed 1 year ago

PawelSuwinski commented 1 year ago

Extension that allows to use TabbedForm and TabbedShowLayout in place of SimpleForm and SimpleShowLayout. Based on presence of tabbed element (FormTab / Tab) appropriate type of form or show layout is choosen by guesser.

https://marmelab.com/react-admin/doc/4.0/TabbedForm.html https://marmelab.com/react-admin/doc/4.0/TabbedShowLayout.html

For example:

 <CreateGuesser {...props} >
      <FormTab label={"Tab 1"}>
        <InputGuesser source={"comments"} multiline  />
         (...)
      </FormTab>
     <FormTab label={"Tab 2"}>
         <InputGuesser source={"name"}
          (...)
      </FormTab>
</CreateGuesser>

Test case provided for ShowGuesser for that moment.

alanpoulain commented 1 year ago

Great! If you find some motivation/time, it would be great to add integration tests for the CreateGuesser and EditGuesser components too.

PawelSuwinski commented 1 year ago

If you find some motivation/time, it would be great to add integration tests for the CreateGuesser and EditGuesser components too.

Done, I added tests for Create/EditGuesser regarding this improvement (tabbed form). Closely based on ShowGuesser tests.

alanpoulain commented 1 year ago

Thank you @PawelSuwinski!