refine
refine copied to clipboard
feat: inferencer
This package provides series of components per each UI integration to generate list, show and edit pages for your resources. The fields and their representation are inferred from your resource's API response. Code is generated and presented with a preview and option to copy and edit in your project.
Note: It's highly advised to only use this package in development environments. While generating the sample code, multiple requests are made to the API and the result might not be the best application for your data.
Usage
Components for UI integrations are exported in sub directories. For example, to use the components for Ant Design integration, you can import them like this:
import { AntdListInferencer, AntdShowInferencer, AntdEditInferencer } from "@pankod/refine-inferencer/antd"
After importing the component, you can directly use it in <Refine/> component's resources prop.
<Refine
resources={[
{
name: "posts",
list: AntdListInferencer,
show: AntdShowInferencer,
edit: AntdEditInferencer,
}
]}
/>
Tip: Relation data is only handled if the resource is present in the resources array. For example, if you have a posts resource with a users relation, you need to add users resource to the resources array as well. Otherwise, inferencer will try to show the relation data as a simple field like string or a number.
To Do
- [ ] Update GitHub issue URL at feedback buttons
- [ ] Snapshot tests
- [ ] Unit testing for utilities
Test plan (required)
Not available yet.
Self Check before Merge
Please check all items below before review.
- [x] Corresponding issues are created/updated or not needed
- [x] Docs are updated/provided or not needed
- [x] Examples are updated/provided or not needed
- [x] TypeScript definitions are updated/provided or not needed
- [ ] Tests are updated/provided or not needed
- [x] Changesets are provided or not needed
🦋 Changeset detected
Latest commit: c350244c08edd71987eba525330671fd26697a8e
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Deploy Preview for refine-doc-live-previews ready!
| Name | Link |
|---|---|
| Latest commit | c350244c08edd71987eba525330671fd26697a8e |
| Latest deploy log | https://app.netlify.com/sites/refine-doc-live-previews/deploys/63805d9a677e1d0009f34f6f |
| Deploy Preview | https://deploy-preview-3027--refine-doc-live-previews.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.