Przeglądaj źródła

docs(admin-ui): Add docs for detailComponentWithResolver

Michael Bromley 2 lat temu
rodzic
commit
1c8fa628ee

+ 28 - 0
packages/admin-ui/src/lib/core/src/common/base-detail.component.ts

@@ -212,6 +212,34 @@ export abstract class TypedBaseDetailComponent<
     }
     }
 }
 }
 
 
+/**
+ * @description
+ * A helper function for creating tabs that point to a {@link TypedBaseDetailComponent}. This takes
+ * care of the route resolver parts so that the detail component automatically has access to the
+ * correct resolved detail data.
+ *
+ * @example
+ * ```TypeScript
+ * \@NgModule({
+ *   imports: [ReviewsSharedModule],
+ *   declarations: [/* ... *\/],
+ *   providers: [
+ *     registerPageTab({
+ *       location: 'product-detail',
+ *       tab: 'Specs',
+ *       route: 'specs',
+ *       component: detailComponentWithResolver({
+ *         component: ProductSpecDetailComponent,
+ *         query: GetProductSpecsDocument,
+ *         entityKey: 'spec',
+ *       }),
+ *     }),
+ *   ],
+ * })
+ * export class ProductSpecsUiExtensionModule {}
+ * ```
+ * @docsCategory list-detail-views
+ */
 export function detailComponentWithResolver<
 export function detailComponentWithResolver<
     T extends TypedDocumentNode<any, { id: string }>,
     T extends TypedDocumentNode<any, { id: string }>,
     Field extends keyof ResultOf<T>,
     Field extends keyof ResultOf<T>,