Creating List Views
The two most common type of components you'll be creating in your UI extensions are list components and detail components.
In Vendure, we have standardized the way you write these components so that your ui extensions can be made to fit seamlessly into the rest of the app.
The specific pattern described here is for Angular-based components. It is also possible to create list views using React components, but in that case you won't be able to use the built-in data table & other Angular-specific components.
Example: Creating a Product Reviews List
Let's say you have a plugin which adds a new entity to the database called ProductReview. You want to create a new list view in the Admin UI which displays all the reviews submitted.
Use the PaginatedList interface
To use the standardized list component, you need to make sure your plugin exposes this list in the GraphQL API following the PaginatedList interface:
See the Paginated Lists guide for details on how to implement this in your server plugin code.
Create the list component
The list component itself is an Angular component which extends the BaseListComponent or TypedBaseListComponent class.
This example assumes you have set up your project to use code generation as described in the GraphQL code generation guide.
Create the template
This is the standard layout for any list view. The main functionality is provided by the DataTable2Component.
Route config
Supporting custom fields
From Vendure v2.2, it is possible for your custom entities to support custom fields.
If you have set up your entity to support custom fields, and you want custom fields to be available in the Admin UI list view, you need to add the following to your list component:
and then add the vdr-dt2-custom-field-column component to your data table: