content
stringlengths
29
370k
--- title: "DropdownComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## DropdownComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/components/dropdown/dropdown.component.ts" sourceLine="28" packageName="@vendure/admin-ui" /> Used for building dropdown menus. *Example* ```HTML <vdr-dropdown> <button class="btn btn-outline" vdrDropdownTrigger> <clr-icon shape="plus"></clr-icon> Select type </button> <vdr-dropdown-menu vdrPosition="bottom-left"> <button *ngFor="let typeName of allTypes" type="button" vdrDropdownItem (click)="selectType(typeName)" > typeName </button> </vdr-dropdown-menu> </vdr-dropdown> ``` ```ts title="Signature" class DropdownComponent { isOpen = false; public trigger: ElementRef; @Input() manualToggle = false; onClick() => ; toggleOpen() => ; onOpenChange(callback: (isOpen: boolean) => void) => ; setTriggerElement(elementRef: ElementRef) => ; } ``` <div className="members-wrapper"> ### isOpen <MemberInfo kind="property" type={``} /> ### trigger <MemberInfo kind="property" type={`ElementRef`} /> ### manualToggle <MemberInfo kind="property" type={``} /> ### onClick <MemberInfo kind="method" type={`() => `} /> ### toggleOpen <MemberInfo kind="method" type={`() => `} /> ### onOpenChange <MemberInfo kind="method" type={`(callback: (isOpen: boolean) =&#62; void) => `} /> ### setTriggerElement <MemberInfo kind="method" type={`(elementRef: ElementRef) => `} /> </div>
--- title: "FacetValueSelectorComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## FacetValueSelectorComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/components/facet-value-selector/facet-value-selector.component.ts" sourceLine="42" packageName="@vendure/admin-ui" /> A form control for selecting facet values. *Example* ```HTML <vdr-facet-value-selector [facets]="facets" (selectedValuesChange)="selectedValues = $event" ></vdr-facet-value-selector> ``` The `facets` input should be provided from the parent component like this: *Example* ```ts this.facets = this.dataService .facet.getAllFacets() .mapSingle(data => data.facets.items); ``` ```ts title="Signature" class FacetValueSelectorComponent implements OnInit, OnDestroy, ControlValueAccessor { @Output() selectedValuesChange = new EventEmitter<FacetValueFragment[]>(); @Input() readonly = false; @Input() transformControlValueAccessorValue: (value: FacetValueFragment[]) => any[] = value => value; searchInput$ = new Subject<string>(); searchLoading = false; searchResults$: Observable<FacetValueFragment[]>; selectedIds$ = new Subject<string[]>(); onChangeFn: (val: any) => void; onTouchFn: () => void; disabled = false; value: Array<string | FacetValueFragment>; constructor(dataService: DataService, changeDetectorRef: ChangeDetectorRef) ngOnInit() => void; ngOnDestroy() => ; onChange(selected: FacetValueFragment[]) => ; registerOnChange(fn: any) => ; registerOnTouched(fn: any) => ; setDisabledState(isDisabled: boolean) => void; focus() => ; writeValue(obj: string | FacetValueFragment[] | Array<string | number> | null) => void; } ``` * Implements: <code>OnInit</code>, <code>OnDestroy</code>, <code>ControlValueAccessor</code> <div className="members-wrapper"> ### selectedValuesChange <MemberInfo kind="property" type={``} /> ### readonly <MemberInfo kind="property" type={``} /> ### transformControlValueAccessorValue <MemberInfo kind="property" type={`(value: FacetValueFragment[]) =&#62; any[]`} /> ### searchInput$ <MemberInfo kind="property" type={``} /> ### searchLoading <MemberInfo kind="property" type={``} /> ### searchResults$ <MemberInfo kind="property" type={`Observable&#60;FacetValueFragment[]&#62;`} /> ### selectedIds$ <MemberInfo kind="property" type={``} /> ### onChangeFn <MemberInfo kind="property" type={`(val: any) =&#62; void`} /> ### onTouchFn <MemberInfo kind="property" type={`() =&#62; void`} /> ### disabled <MemberInfo kind="property" type={``} /> ### value <MemberInfo kind="property" type={`Array&#60;string | FacetValueFragment&#62;`} /> ### constructor <MemberInfo kind="method" type={`(dataService: <a href='/reference/admin-ui-api/services/data-service#dataservice'>DataService</a>, changeDetectorRef: ChangeDetectorRef) => FacetValueSelectorComponent`} /> ### ngOnInit <MemberInfo kind="method" type={`() => void`} /> ### ngOnDestroy <MemberInfo kind="method" type={`() => `} /> ### onChange <MemberInfo kind="method" type={`(selected: FacetValueFragment[]) => `} /> ### registerOnChange <MemberInfo kind="method" type={`(fn: any) => `} /> ### registerOnTouched <MemberInfo kind="method" type={`(fn: any) => `} /> ### setDisabledState <MemberInfo kind="method" type={`(isDisabled: boolean) => void`} /> ### focus <MemberInfo kind="method" type={`() => `} /> ### writeValue <MemberInfo kind="method" type={`(obj: string | FacetValueFragment[] | Array&#60;string | number&#62; | null) => void`} /> </div>
--- title: "Components" isDefaultIndex: true generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; import DocCardList from '@theme/DocCardList'; <DocCardList />
--- title: "ObjectTreeComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## ObjectTreeComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/components/object-tree/object-tree.component.ts" sourceLine="22" packageName="@vendure/admin-ui" /> This component displays a plain JavaScript object as an expandable tree. *Example* ```HTML <vdr-object-tree [value]="payment.metadata"></vdr-object-tree> ``` ```ts title="Signature" class ObjectTreeComponent implements OnChanges { @Input() value: { [key: string]: any } | string; @Input() isArrayItem = false; depth: number; expanded: boolean; valueIsArray: boolean; entries: Array<{ key: string; value: any }>; constructor(parent: ObjectTreeComponent) ngOnChanges() => ; isObject(value: any) => boolean; } ``` * Implements: <code>OnChanges</code> <div className="members-wrapper"> ### value <MemberInfo kind="property" type={`{ [key: string]: any } | string`} /> ### isArrayItem <MemberInfo kind="property" type={``} /> ### depth <MemberInfo kind="property" type={`number`} /> ### expanded <MemberInfo kind="property" type={`boolean`} /> ### valueIsArray <MemberInfo kind="property" type={`boolean`} /> ### entries <MemberInfo kind="property" type={`Array&#60;{ key: string; value: any }&#62;`} /> ### constructor <MemberInfo kind="method" type={`(parent: <a href='/reference/admin-ui-api/components/object-tree-component#objecttreecomponent'>ObjectTreeComponent</a>) => ObjectTreeComponent`} /> ### ngOnChanges <MemberInfo kind="method" type={`() => `} /> ### isObject <MemberInfo kind="method" type={`(value: any) => boolean`} /> </div>
--- title: "OrderStateLabelComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## OrderStateLabelComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/components/order-state-label/order-state-label.component.ts" sourceLine="13" packageName="@vendure/admin-ui" /> Displays the state of an order in a colored chip. *Example* ```HTML <vdr-order-state-label [state]="order.state"></vdr-order-state-label> ``` ```ts title="Signature" class OrderStateLabelComponent { @Input() state: string; chipColorType: void } ``` <div className="members-wrapper"> ### state <MemberInfo kind="property" type={`string`} /> ### chipColorType <MemberInfo kind="property" type={``} /> </div>
--- title: "ProductVariantSelectorComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## ProductVariantSelectorComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/components/product-variant-selector/product-variant-selector.component.ts" sourceLine="21" packageName="@vendure/admin-ui" /> A component for selecting product variants via an autocomplete-style select input. *Example* ```HTML <vdr-product-variant-selector (productSelected)="selectResult($event)"></vdr-product-selector> ``` ```ts title="Signature" class ProductVariantSelectorComponent implements OnInit { searchInput$ = new Subject<string>(); searchLoading = false; searchResults$: Observable<ProductSelectorSearchQuery['search']['items']>; @Output() productSelected = new EventEmitter<ProductSelectorSearchQuery['search']['items'][number]>(); constructor(dataService: DataService) ngOnInit() => void; selectResult(product?: ProductSelectorSearchQuery['search']['items'][number]) => ; } ``` * Implements: <code>OnInit</code> <div className="members-wrapper"> ### searchInput$ <MemberInfo kind="property" type={``} /> ### searchLoading <MemberInfo kind="property" type={``} /> ### searchResults$ <MemberInfo kind="property" type={`Observable&#60;ProductSelectorSearchQuery['search']['items']&#62;`} /> ### productSelected <MemberInfo kind="property" type={``} /> ### constructor <MemberInfo kind="method" type={`(dataService: <a href='/reference/admin-ui-api/services/data-service#dataservice'>DataService</a>) => ProductVariantSelectorComponent`} /> ### ngOnInit <MemberInfo kind="method" type={`() => void`} /> ### selectResult <MemberInfo kind="method" type={`(product?: ProductSelectorSearchQuery['search']['items'][number]) => `} /> </div>
--- title: "RichTextEditorComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## RichTextEditorComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/components/rich-text-editor/rich-text-editor.component.ts" sourceLine="32" packageName="@vendure/admin-ui" /> A rich text (HTML) editor based on Prosemirror (https://prosemirror.net/) *Example* ```HTML <vdr-rich-text-editor [(ngModel)]="description" label="Description" ></vdr-rich-text-editor> ``` ```ts title="Signature" class RichTextEditorComponent implements ControlValueAccessor, AfterViewInit, OnDestroy { @Input() label: string; @HostBinding('class.readonly') _readonly = false; onChange: (val: any) => void; onTouch: () => void; constructor(changeDetector: ChangeDetectorRef, prosemirrorService: ProsemirrorService, viewContainerRef: ViewContainerRef, contextMenuService: ContextMenuService) menuElement: HTMLDivElement | null ngAfterViewInit() => ; ngOnDestroy() => ; registerOnChange(fn: any) => ; registerOnTouched(fn: any) => ; setDisabledState(isDisabled: boolean) => ; writeValue(value: any) => ; } ``` * Implements: <code>ControlValueAccessor</code>, <code>AfterViewInit</code>, <code>OnDestroy</code> <div className="members-wrapper"> ### label <MemberInfo kind="property" type={`string`} /> ### _readonly <MemberInfo kind="property" type={``} /> ### onChange <MemberInfo kind="property" type={`(val: any) =&#62; void`} /> ### onTouch <MemberInfo kind="property" type={`() =&#62; void`} /> ### constructor <MemberInfo kind="method" type={`(changeDetector: ChangeDetectorRef, prosemirrorService: ProsemirrorService, viewContainerRef: ViewContainerRef, contextMenuService: ContextMenuService) => RichTextEditorComponent`} /> ### menuElement <MemberInfo kind="property" type={`HTMLDivElement | null`} /> ### ngAfterViewInit <MemberInfo kind="method" type={`() => `} /> ### ngOnDestroy <MemberInfo kind="method" type={`() => `} /> ### registerOnChange <MemberInfo kind="method" type={`(fn: any) => `} /> ### registerOnTouched <MemberInfo kind="method" type={`(fn: any) => `} /> ### setDisabledState <MemberInfo kind="method" type={`(isDisabled: boolean) => `} /> ### writeValue <MemberInfo kind="method" type={`(value: any) => `} /> </div>
--- title: "ZoneSelectorComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## ZoneSelectorComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/components/zone-selector/zone-selector.component.ts" sourceLine="40" packageName="@vendure/admin-ui" /> A form control for selecting zones. ```ts title="Signature" class ZoneSelectorComponent implements ControlValueAccessor { @Output() selectedValuesChange = new EventEmitter<Zone>(); @Input() readonly = false; @Input() transformControlValueAccessorValue: (value: Zone | undefined) => any = value => value?.id; selectedId$ = new Subject<string>(); onChangeFn: (val: any) => void; onTouchFn: () => void; disabled = false; value: string | Zone; zones$ = this.dataService .query(GetZoneSelectorListDocument, { options: { take: 999 } }, 'cache-first') .mapSingle(result => result.zones.items); constructor(dataService: DataService, changeDetectorRef: ChangeDetectorRef) onChange(selected: Zone) => ; registerOnChange(fn: any) => ; registerOnTouched(fn: any) => ; setDisabledState(isDisabled: boolean) => void; focus() => ; writeValue(obj: string | Zone | null) => void; } ``` * Implements: <code>ControlValueAccessor</code> <div className="members-wrapper"> ### selectedValuesChange <MemberInfo kind="property" type={``} /> ### readonly <MemberInfo kind="property" type={``} /> ### transformControlValueAccessorValue <MemberInfo kind="property" type={`(value: <a href='/reference/typescript-api/entities/zone#zone'>Zone</a> | undefined) =&#62; any`} /> ### selectedId$ <MemberInfo kind="property" type={``} /> ### onChangeFn <MemberInfo kind="property" type={`(val: any) =&#62; void`} /> ### onTouchFn <MemberInfo kind="property" type={`() =&#62; void`} /> ### disabled <MemberInfo kind="property" type={``} /> ### value <MemberInfo kind="property" type={`string | <a href='/reference/typescript-api/entities/zone#zone'>Zone</a>`} /> ### zones$ <MemberInfo kind="property" type={``} /> ### constructor <MemberInfo kind="method" type={`(dataService: <a href='/reference/admin-ui-api/services/data-service#dataservice'>DataService</a>, changeDetectorRef: ChangeDetectorRef) => ZoneSelectorComponent`} /> ### onChange <MemberInfo kind="method" type={`(selected: <a href='/reference/typescript-api/entities/zone#zone'>Zone</a>) => `} /> ### registerOnChange <MemberInfo kind="method" type={`(fn: any) => `} /> ### registerOnTouched <MemberInfo kind="method" type={`(fn: any) => `} /> ### setDisabledState <MemberInfo kind="method" type={`(isDisabled: boolean) => void`} /> ### focus <MemberInfo kind="method" type={`() => `} /> ### writeValue <MemberInfo kind="method" type={`(obj: string | <a href='/reference/typescript-api/entities/zone#zone'>Zone</a> | null) => void`} /> </div>
--- title: "CustomDetailComponentConfig" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## CustomDetailComponentConfig <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/custom-detail-component/custom-detail-component-types.ts" sourceLine="25" packageName="@vendure/admin-ui" /> Configures a <a href='/reference/admin-ui-api/custom-detail-components/custom-detail-component#customdetailcomponent'>CustomDetailComponent</a> to be placed in the given location. ```ts title="Signature" interface CustomDetailComponentConfig { locationId: CustomDetailComponentLocationId; component: Type<CustomDetailComponent>; providers?: Provider[]; } ``` <div className="members-wrapper"> ### locationId <MemberInfo kind="property" type={`<a href='/reference/admin-ui-api/custom-detail-components/custom-detail-component-location-id#customdetailcomponentlocationid'>CustomDetailComponentLocationId</a>`} /> ### component <MemberInfo kind="property" type={`Type&#60;<a href='/reference/admin-ui-api/custom-detail-components/custom-detail-component#customdetailcomponent'>CustomDetailComponent</a>&#62;`} /> ### providers <MemberInfo kind="property" type={`Provider[]`} /> </div>
--- title: "CustomDetailComponentLocationId" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## CustomDetailComponentLocationId <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/common/component-registry-types.ts" sourceLine="114" packageName="@vendure/admin-ui" /> The valid locations for embedding a <a href='/reference/admin-ui-api/custom-detail-components/custom-detail-component#customdetailcomponent'>CustomDetailComponent</a>. ```ts title="Signature" type CustomDetailComponentLocationId = | 'administrator-profile' | 'administrator-detail' | 'channel-detail' | 'collection-detail' | 'country-detail' | 'customer-detail' | 'customer-group-detail' | 'draft-order-detail' | 'facet-detail' | 'global-settings-detail' | 'order-detail' | 'payment-method-detail' | 'product-detail' | 'product-variant-detail' | 'promotion-detail' | 'seller-detail' | 'shipping-method-detail' | 'stock-location-detail' | 'tax-category-detail' | 'tax-rate-detail' | 'zone-detail' ```
--- title: "CustomDetailComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## CustomDetailComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/custom-detail-component/custom-detail-component-types.ts" sourceLine="14" packageName="@vendure/admin-ui" /> CustomDetailComponents allow any arbitrary Angular components to be embedded in entity detail pages of the Admin UI. ```ts title="Signature" interface CustomDetailComponent { entity$: Observable<any>; detailForm: UntypedFormGroup; } ``` <div className="members-wrapper"> ### entity$ <MemberInfo kind="property" type={`Observable&#60;any&#62;`} /> ### detailForm <MemberInfo kind="property" type={`UntypedFormGroup`} /> </div>
--- title: "Custom Detail Components" isDefaultIndex: true generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; import DocCardList from '@theme/DocCardList'; <DocCardList />
--- title: "RegisterCustomDetailComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## registerCustomDetailComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/extension/register-custom-detail-component.ts" sourceLine="57" packageName="@vendure/admin-ui" /> Registers a <a href='/reference/admin-ui-api/custom-detail-components/custom-detail-component#customdetailcomponent'>CustomDetailComponent</a> to be placed in a given location. This allows you to embed any type of custom Angular component in the entity detail pages of the Admin UI. *Example* ```ts import { Component, OnInit } from '@angular/core'; import { switchMap } from 'rxjs'; import { FormGroup } from '@angular/forms'; import { CustomFieldConfig } from '@vendure/common/lib/generated-types'; import { DataService, SharedModule, CustomDetailComponent, registerCustomDetailComponent, GetProductWithVariants } from '@vendure/admin-ui/core'; @Component({ template: `{{ extraInfo$ | async | json }}`, standalone: true, imports: [SharedModule], }) export class ProductInfoComponent implements CustomDetailComponent, OnInit { // These two properties are provided by Vendure and will vary // depending on the particular detail page you are embedding this // component into. entity$: Observable<GetProductWithVariants.Product> detailForm: FormGroup; extraInfo$: Observable<any>; constructor(private cmsDataService: CmsDataService) {} ngOnInit() { this.extraInfo$ = this.entity$.pipe( switchMap(entity => this.cmsDataService.getDataFor(entity.id)) ); } } export default [ registerCustomDetailComponent({ locationId: 'product-detail', component: ProductInfoComponent, }), ]; ``` ```ts title="Signature" function registerCustomDetailComponent(config: CustomDetailComponentConfig): Provider ``` Parameters ### config <MemberInfo kind="parameter" type={`<a href='/reference/admin-ui-api/custom-detail-components/custom-detail-component-config#customdetailcomponentconfig'>CustomDetailComponentConfig</a>`} />
--- title: "CustomerHistoryEntryComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## CustomerHistoryEntryComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/custom-history-entry-component/history-entry-component-types.ts" sourceLine="64" packageName="@vendure/admin-ui" since="1.9.0" /> Used to implement a <a href='/reference/admin-ui-api/custom-history-entry-components/history-entry-component#historyentrycomponent'>HistoryEntryComponent</a> which requires access to the Customer object. ```ts title="Signature" interface CustomerHistoryEntryComponent extends HistoryEntryComponent { customer: CustomerFragment; } ``` * Extends: <code><a href='/reference/admin-ui-api/custom-history-entry-components/history-entry-component#historyentrycomponent'>HistoryEntryComponent</a></code> <div className="members-wrapper"> ### customer <MemberInfo kind="property" type={`CustomerFragment`} /> </div>
--- title: "HistoryEntryComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## HistoryEntryComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/custom-history-entry-component/history-entry-component-types.ts" sourceLine="16" packageName="@vendure/admin-ui" since="1.9.0" /> This interface should be implemented by components intended to display a history entry in the Order or Customer history timeline. If the component needs access to the Order or Customer object itself, you should implement <a href='/reference/admin-ui-api/custom-history-entry-components/order-history-entry-component#orderhistoryentrycomponent'>OrderHistoryEntryComponent</a> or <a href='/reference/admin-ui-api/custom-history-entry-components/customer-history-entry-component#customerhistoryentrycomponent'>CustomerHistoryEntryComponent</a> respectively. ```ts title="Signature" interface HistoryEntryComponent { entry: TimelineHistoryEntry; getDisplayType: (entry: TimelineHistoryEntry) => TimelineDisplayType; isFeatured: (entry: TimelineHistoryEntry) => boolean; getName?: (entry: TimelineHistoryEntry) => string | undefined; getIconShape?: (entry: TimelineHistoryEntry) => string | string[] | undefined; } ``` <div className="members-wrapper"> ### entry <MemberInfo kind="property" type={`TimelineHistoryEntry`} /> The HistoryEntry data. ### getDisplayType <MemberInfo kind="property" type={`(entry: TimelineHistoryEntry) =&#62; TimelineDisplayType`} /> Defines whether this entry is highlighted with a "success", "error" etc. color. ### isFeatured <MemberInfo kind="property" type={`(entry: TimelineHistoryEntry) =&#62; boolean`} /> Featured entries are always expanded. Non-featured entries start of collapsed and can be clicked to expand. ### getName <MemberInfo kind="property" type={`(entry: TimelineHistoryEntry) =&#62; string | undefined`} /> Returns the name of the person who did this action. For example, it could be the Customer's name or "Administrator". ### getIconShape <MemberInfo kind="property" type={`(entry: TimelineHistoryEntry) =&#62; string | string[] | undefined`} /> Optional Clarity icon shape to display with the entry. Examples: `'note'`, `['success-standard', 'is-solid']` </div>
--- title: "HistoryEntryConfig" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## HistoryEntryConfig <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/custom-history-entry-component/history-entry-component-types.ts" sourceLine="75" packageName="@vendure/admin-ui" since="1.9.0" /> Configuration for registering a custom <a href='/reference/admin-ui-api/custom-history-entry-components/history-entry-component#historyentrycomponent'>HistoryEntryComponent</a>. ```ts title="Signature" interface HistoryEntryConfig { type: string; component: Type<HistoryEntryComponent>; } ``` <div className="members-wrapper"> ### type <MemberInfo kind="property" type={`string`} /> The type should correspond to the custom HistoryEntryType string. ### component <MemberInfo kind="property" type={`Type&#60;<a href='/reference/admin-ui-api/custom-history-entry-components/history-entry-component#historyentrycomponent'>HistoryEntryComponent</a>&#62;`} /> The component to be rendered for this history entry type. </div>
--- title: "Custom History Entry Components" isDefaultIndex: true generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; import DocCardList from '@theme/DocCardList'; <DocCardList />
--- title: "OrderHistoryEntryComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## OrderHistoryEntryComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/custom-history-entry-component/history-entry-component-types.ts" sourceLine="53" packageName="@vendure/admin-ui" since="1.9.0" /> Used to implement a <a href='/reference/admin-ui-api/custom-history-entry-components/history-entry-component#historyentrycomponent'>HistoryEntryComponent</a> which requires access to the Order object. ```ts title="Signature" interface OrderHistoryEntryComponent extends HistoryEntryComponent { order: OrderDetailFragment; } ``` * Extends: <code><a href='/reference/admin-ui-api/custom-history-entry-components/history-entry-component#historyentrycomponent'>HistoryEntryComponent</a></code> <div className="members-wrapper"> ### order <MemberInfo kind="property" type={`OrderDetailFragment`} /> </div>
--- title: "RegisterHistoryEntryComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## registerHistoryEntryComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/extension/register-history-entry-component.ts" sourceLine="68" packageName="@vendure/admin-ui" since="1.9.0" /> Registers a <a href='/reference/admin-ui-api/custom-history-entry-components/history-entry-component#historyentrycomponent'>HistoryEntryComponent</a> for displaying history entries in the Order/Customer history timeline. *Example* ```ts import { Component } from '@angular/core'; import { CustomerFragment, CustomerHistoryEntryComponent, registerHistoryEntryComponent, SharedModule, TimelineDisplayType, TimelineHistoryEntry, } from '@vendure/admin-ui/core'; @Component({ selector: 'tax-id-verification-component', template: ` <div *ngIf="entry.data.valid"> Tax ID <strong>{{ entry.data.taxId }}</strong> was verified <vdr-history-entry-detail *ngIf="entry.data"> <vdr-object-tree [value]="entry.data"></vdr-object-tree> </vdr-history-entry-detail> </div> <div *ngIf="entry.data.valid">Tax ID {{ entry.data.taxId }} could not be verified</div> `, standalone: true, imports: [SharedModule], }) class TaxIdHistoryEntryComponent implements CustomerHistoryEntryComponent { entry: TimelineHistoryEntry; customer: CustomerFragment; getDisplayType(entry: TimelineHistoryEntry): TimelineDisplayType { return entry.data.valid ? 'success' : 'error'; } getName(entry: TimelineHistoryEntry): string { return 'Tax ID Verification Plugin'; } isFeatured(entry: TimelineHistoryEntry): boolean { return true; } getIconShape(entry: TimelineHistoryEntry) { return entry.data.valid ? 'check-circle' : 'exclamation-circle'; } } export default [ registerHistoryEntryComponent({ type: 'CUSTOMER_TAX_ID_VERIFICATION', component: TaxIdHistoryEntryComponent, }), ]; ``` ```ts title="Signature" function registerHistoryEntryComponent(config: HistoryEntryConfig): Provider ``` Parameters ### config <MemberInfo kind="parameter" type={`<a href='/reference/admin-ui-api/custom-history-entry-components/history-entry-config#historyentryconfig'>HistoryEntryConfig</a>`} />
--- title: "Default Inputs" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## BooleanFormInputComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/boolean-form-input/boolean-form-input.component.ts" sourceLine="14" packageName="@vendure/admin-ui" /> A checkbox input. The default input component for `boolean` fields. ```ts title="Signature" class BooleanFormInputComponent implements FormInputComponent { static readonly id: DefaultFormComponentId = 'boolean-form-input'; readonly: boolean; formControl: UntypedFormControl; config: DefaultFormComponentConfig<'boolean-form-input'>; } ``` * Implements: <code><a href='/reference/admin-ui-api/custom-input-components/form-input-component#forminputcomponent'>FormInputComponent</a></code> <div className="members-wrapper"> ### id <MemberInfo kind="property" type={`<a href='/reference/typescript-api/configurable-operation-def/default-form-component-id#defaultformcomponentid'>DefaultFormComponentId</a>`} /> ### readonly <MemberInfo kind="property" type={`boolean`} /> ### formControl <MemberInfo kind="property" type={`UntypedFormControl`} /> ### config <MemberInfo kind="property" type={`DefaultFormComponentConfig&#60;'boolean-form-input'&#62;`} /> </div> ## HtmlEditorFormInputComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/code-editor-form-input/html-editor-form-input.component.ts" sourceLine="23" packageName="@vendure/admin-ui" /> A JSON editor input with syntax highlighting and error detection. Works well with `text` type fields. ```ts title="Signature" class HtmlEditorFormInputComponent extends BaseCodeEditorFormInputComponent implements FormInputComponent, AfterViewInit, OnInit { static readonly id: DefaultFormComponentId = 'html-editor-form-input'; constructor(changeDetector: ChangeDetectorRef) ngOnInit() => ; } ``` * Extends: <code>BaseCodeEditorFormInputComponent</code> * Implements: <code><a href='/reference/admin-ui-api/custom-input-components/form-input-component#forminputcomponent'>FormInputComponent</a></code>, <code>AfterViewInit</code>, <code>OnInit</code> <div className="members-wrapper"> ### id <MemberInfo kind="property" type={`<a href='/reference/typescript-api/configurable-operation-def/default-form-component-id#defaultformcomponentid'>DefaultFormComponentId</a>`} /> ### constructor <MemberInfo kind="method" type={`(changeDetector: ChangeDetectorRef) => HtmlEditorFormInputComponent`} /> ### ngOnInit <MemberInfo kind="method" type={`() => `} /> </div> ## JsonEditorFormInputComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/code-editor-form-input/json-editor-form-input.component.ts" sourceLine="33" packageName="@vendure/admin-ui" /> A JSON editor input with syntax highlighting and error detection. Works well with `text` type fields. ```ts title="Signature" class JsonEditorFormInputComponent extends BaseCodeEditorFormInputComponent implements FormInputComponent, AfterViewInit, OnInit { static readonly id: DefaultFormComponentId = 'json-editor-form-input'; constructor(changeDetector: ChangeDetectorRef) ngOnInit() => ; } ``` * Extends: <code>BaseCodeEditorFormInputComponent</code> * Implements: <code><a href='/reference/admin-ui-api/custom-input-components/form-input-component#forminputcomponent'>FormInputComponent</a></code>, <code>AfterViewInit</code>, <code>OnInit</code> <div className="members-wrapper"> ### id <MemberInfo kind="property" type={`<a href='/reference/typescript-api/configurable-operation-def/default-form-component-id#defaultformcomponentid'>DefaultFormComponentId</a>`} /> ### constructor <MemberInfo kind="method" type={`(changeDetector: ChangeDetectorRef) => JsonEditorFormInputComponent`} /> ### ngOnInit <MemberInfo kind="method" type={`() => `} /> </div> ## CombinationModeFormInputComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/combination-mode-form-input/combination-mode-form-input.component.ts" sourceLine="17" packageName="@vendure/admin-ui" /> A special input used to display the "Combination mode" AND/OR toggle. ```ts title="Signature" class CombinationModeFormInputComponent implements FormInputComponent, OnInit { static readonly id: DefaultFormComponentId = 'combination-mode-form-input'; readonly: boolean; formControl: UntypedFormControl; config: DefaultFormComponentConfig<'combination-mode-form-input'>; selectable$: Observable<boolean>; constructor(configurableInputComponent: ConfigurableInputComponent) ngOnInit() => ; setCombinationModeAnd() => ; setCombinationModeOr() => ; } ``` * Implements: <code><a href='/reference/admin-ui-api/custom-input-components/form-input-component#forminputcomponent'>FormInputComponent</a></code>, <code>OnInit</code> <div className="members-wrapper"> ### id <MemberInfo kind="property" type={`<a href='/reference/typescript-api/configurable-operation-def/default-form-component-id#defaultformcomponentid'>DefaultFormComponentId</a>`} /> ### readonly <MemberInfo kind="property" type={`boolean`} /> ### formControl <MemberInfo kind="property" type={`UntypedFormControl`} /> ### config <MemberInfo kind="property" type={`DefaultFormComponentConfig&#60;'combination-mode-form-input'&#62;`} /> ### selectable$ <MemberInfo kind="property" type={`Observable&#60;boolean&#62;`} /> ### constructor <MemberInfo kind="method" type={`(configurableInputComponent: ConfigurableInputComponent) => CombinationModeFormInputComponent`} /> ### ngOnInit <MemberInfo kind="method" type={`() => `} /> ### setCombinationModeAnd <MemberInfo kind="method" type={`() => `} /> ### setCombinationModeOr <MemberInfo kind="method" type={`() => `} /> </div> ## CurrencyFormInputComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/currency-form-input/currency-form-input.component.ts" sourceLine="17" packageName="@vendure/admin-ui" /> An input for monetary values. Should be used with `int` type fields. ```ts title="Signature" class CurrencyFormInputComponent implements FormInputComponent { static readonly id: DefaultFormComponentId = 'currency-form-input'; @Input() readonly: boolean; formControl: UntypedFormControl; currencyCode$: Observable<CurrencyCode>; config: DefaultFormComponentConfig<'currency-form-input'>; constructor(dataService: DataService) } ``` * Implements: <code><a href='/reference/admin-ui-api/custom-input-components/form-input-component#forminputcomponent'>FormInputComponent</a></code> <div className="members-wrapper"> ### id <MemberInfo kind="property" type={`<a href='/reference/typescript-api/configurable-operation-def/default-form-component-id#defaultformcomponentid'>DefaultFormComponentId</a>`} /> ### readonly <MemberInfo kind="property" type={`boolean`} /> ### formControl <MemberInfo kind="property" type={`UntypedFormControl`} /> ### currencyCode$ <MemberInfo kind="property" type={`Observable&#60;<a href='/reference/typescript-api/common/currency-code#currencycode'>CurrencyCode</a>&#62;`} /> ### config <MemberInfo kind="property" type={`DefaultFormComponentConfig&#60;'currency-form-input'&#62;`} /> ### constructor <MemberInfo kind="method" type={`(dataService: <a href='/reference/admin-ui-api/services/data-service#dataservice'>DataService</a>) => CurrencyFormInputComponent`} /> </div> ## CustomerGroupFormInputComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/customer-group-form-input/customer-group-form-input.component.ts" sourceLine="20" packageName="@vendure/admin-ui" /> Allows the selection of a Customer via an autocomplete select input. Should be used with `ID` type fields which represent Customer IDs. ```ts title="Signature" class CustomerGroupFormInputComponent implements FormInputComponent, OnInit { static readonly id: DefaultFormComponentId = 'customer-group-form-input'; @Input() readonly: boolean; formControl: FormControl<string | { id: string }>; customerGroups$: Observable<GetCustomerGroupsQuery['customerGroups']['items']>; config: DefaultFormComponentConfig<'customer-group-form-input'>; constructor(dataService: DataService) ngOnInit() => ; selectGroup(group: ItemOf<GetCustomerGroupsQuery, 'customerGroups'>) => ; compareWith(o1: T, o2: T) => ; } ``` * Implements: <code><a href='/reference/admin-ui-api/custom-input-components/form-input-component#forminputcomponent'>FormInputComponent</a></code>, <code>OnInit</code> <div className="members-wrapper"> ### id <MemberInfo kind="property" type={`<a href='/reference/typescript-api/configurable-operation-def/default-form-component-id#defaultformcomponentid'>DefaultFormComponentId</a>`} /> ### readonly <MemberInfo kind="property" type={`boolean`} /> ### formControl <MemberInfo kind="property" type={`FormControl&#60;string | { id: string }&#62;`} /> ### customerGroups$ <MemberInfo kind="property" type={`Observable&#60;GetCustomerGroupsQuery['customerGroups']['items']&#62;`} /> ### config <MemberInfo kind="property" type={`DefaultFormComponentConfig&#60;'customer-group-form-input'&#62;`} /> ### constructor <MemberInfo kind="method" type={`(dataService: <a href='/reference/admin-ui-api/services/data-service#dataservice'>DataService</a>) => CustomerGroupFormInputComponent`} /> ### ngOnInit <MemberInfo kind="method" type={`() => `} /> ### selectGroup <MemberInfo kind="method" type={`(group: ItemOf&#60;GetCustomerGroupsQuery, 'customerGroups'&#62;) => `} /> ### compareWith <MemberInfo kind="method" type={`(o1: T, o2: T) => `} /> </div> ## DateFormInputComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/date-form-input/date-form-input.component.ts" sourceLine="14" packageName="@vendure/admin-ui" /> Allows selection of a datetime. Default input for `datetime` type fields. ```ts title="Signature" class DateFormInputComponent implements FormInputComponent { static readonly id: DefaultFormComponentId = 'date-form-input'; @Input() readonly: boolean; formControl: UntypedFormControl; config: DefaultFormComponentConfig<'date-form-input'>; min: void max: void yearRange: void } ``` * Implements: <code><a href='/reference/admin-ui-api/custom-input-components/form-input-component#forminputcomponent'>FormInputComponent</a></code> <div className="members-wrapper"> ### id <MemberInfo kind="property" type={`<a href='/reference/typescript-api/configurable-operation-def/default-form-component-id#defaultformcomponentid'>DefaultFormComponentId</a>`} /> ### readonly <MemberInfo kind="property" type={`boolean`} /> ### formControl <MemberInfo kind="property" type={`UntypedFormControl`} /> ### config <MemberInfo kind="property" type={`DefaultFormComponentConfig&#60;'date-form-input'&#62;`} /> ### min <MemberInfo kind="property" type={``} /> ### max <MemberInfo kind="property" type={``} /> ### yearRange <MemberInfo kind="property" type={``} /> </div> ## FacetValueFormInputComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/facet-value-form-input/facet-value-form-input.component.ts" sourceLine="16" packageName="@vendure/admin-ui" /> Allows the selection of multiple FacetValues via an autocomplete select input. Should be used with `ID` type **list** fields which represent FacetValue IDs. ```ts title="Signature" class FacetValueFormInputComponent implements FormInputComponent { static readonly id: DefaultFormComponentId = 'facet-value-form-input'; readonly isListInput = true; readonly: boolean; formControl: UntypedFormControl; config: InputComponentConfig; valueTransformFn = (values: FacetValueFragment[]) => { const isUsedInConfigArg = this.config.__typename === 'ConfigArgDefinition'; if (isUsedInConfigArg) { return JSON.stringify(values.map(s => s.id)); } else { return values; } }; } ``` * Implements: <code><a href='/reference/admin-ui-api/custom-input-components/form-input-component#forminputcomponent'>FormInputComponent</a></code> <div className="members-wrapper"> ### id <MemberInfo kind="property" type={`<a href='/reference/typescript-api/configurable-operation-def/default-form-component-id#defaultformcomponentid'>DefaultFormComponentId</a>`} /> ### isListInput <MemberInfo kind="property" type={``} /> ### readonly <MemberInfo kind="property" type={`boolean`} /> ### formControl <MemberInfo kind="property" type={`UntypedFormControl`} /> ### config <MemberInfo kind="property" type={`InputComponentConfig`} /> ### valueTransformFn <MemberInfo kind="property" type={``} /> </div> ## NumberFormInputComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/number-form-input/number-form-input.component.ts" sourceLine="14" packageName="@vendure/admin-ui" /> Displays a number input. Default input for `int` and `float` type fields. ```ts title="Signature" class NumberFormInputComponent implements FormInputComponent { static readonly id: DefaultFormComponentId = 'number-form-input'; @Input() readonly: boolean; formControl: UntypedFormControl; config: DefaultFormComponentConfig<'number-form-input'>; prefix: void suffix: void min: void max: void step: void } ``` * Implements: <code><a href='/reference/admin-ui-api/custom-input-components/form-input-component#forminputcomponent'>FormInputComponent</a></code> <div className="members-wrapper"> ### id <MemberInfo kind="property" type={`<a href='/reference/typescript-api/configurable-operation-def/default-form-component-id#defaultformcomponentid'>DefaultFormComponentId</a>`} /> ### readonly <MemberInfo kind="property" type={`boolean`} /> ### formControl <MemberInfo kind="property" type={`UntypedFormControl`} /> ### config <MemberInfo kind="property" type={`DefaultFormComponentConfig&#60;'number-form-input'&#62;`} /> ### prefix <MemberInfo kind="property" type={``} /> ### suffix <MemberInfo kind="property" type={``} /> ### min <MemberInfo kind="property" type={``} /> ### max <MemberInfo kind="property" type={``} /> ### step <MemberInfo kind="property" type={``} /> </div> ## PasswordFormInputComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/password-form-input/password-form-input.component.ts" sourceLine="14" packageName="@vendure/admin-ui" /> Displays a password text input. Should be used with `string` type fields. ```ts title="Signature" class PasswordFormInputComponent implements FormInputComponent { static readonly id: DefaultFormComponentId = 'password-form-input'; readonly: boolean; formControl: UntypedFormControl; config: InputComponentConfig; } ``` * Implements: <code><a href='/reference/admin-ui-api/custom-input-components/form-input-component#forminputcomponent'>FormInputComponent</a></code> <div className="members-wrapper"> ### id <MemberInfo kind="property" type={`<a href='/reference/typescript-api/configurable-operation-def/default-form-component-id#defaultformcomponentid'>DefaultFormComponentId</a>`} /> ### readonly <MemberInfo kind="property" type={`boolean`} /> ### formControl <MemberInfo kind="property" type={`UntypedFormControl`} /> ### config <MemberInfo kind="property" type={`InputComponentConfig`} /> </div> ## ProductSelectorFormInputComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/product-selector-form-input/product-selector-form-input.component.ts" sourceLine="20" packageName="@vendure/admin-ui" /> Allows the selection of multiple ProductVariants via an autocomplete select input. Should be used with `ID` type **list** fields which represent ProductVariant IDs. ```ts title="Signature" class ProductSelectorFormInputComponent implements FormInputComponent, OnInit { static readonly id: DefaultFormComponentId = 'product-selector-form-input'; readonly isListInput = true; readonly: boolean; formControl: FormControl<Array<string | { id: string }>>; config: DefaultFormComponentUiConfig<'product-selector-form-input'>; selection$: Observable<Array<GetProductVariantQuery['productVariant']>>; constructor(dataService: DataService) ngOnInit() => ; addProductVariant(product: ProductSelectorSearchQuery['search']['items'][number]) => ; removeProductVariant(id: string) => ; } ``` * Implements: <code><a href='/reference/admin-ui-api/custom-input-components/form-input-component#forminputcomponent'>FormInputComponent</a></code>, <code>OnInit</code> <div className="members-wrapper"> ### id <MemberInfo kind="property" type={`<a href='/reference/typescript-api/configurable-operation-def/default-form-component-id#defaultformcomponentid'>DefaultFormComponentId</a>`} /> ### isListInput <MemberInfo kind="property" type={``} /> ### readonly <MemberInfo kind="property" type={`boolean`} /> ### formControl <MemberInfo kind="property" type={`FormControl&#60;Array&#60;string | { id: string }&#62;&#62;`} /> ### config <MemberInfo kind="property" type={`DefaultFormComponentUiConfig&#60;'product-selector-form-input'&#62;`} /> ### selection$ <MemberInfo kind="property" type={`Observable&#60;Array&#60;GetProductVariantQuery['productVariant']&#62;&#62;`} /> ### constructor <MemberInfo kind="method" type={`(dataService: <a href='/reference/admin-ui-api/services/data-service#dataservice'>DataService</a>) => ProductSelectorFormInputComponent`} /> ### ngOnInit <MemberInfo kind="method" type={`() => `} /> ### addProductVariant <MemberInfo kind="method" type={`(product: ProductSelectorSearchQuery['search']['items'][number]) => `} /> ### removeProductVariant <MemberInfo kind="method" type={`(id: string) => `} /> </div> ## RelationFormInputComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/relation-form-input/relation-form-input.component.ts" sourceLine="17" packageName="@vendure/admin-ui" /> The default input component for `relation` type custom fields. Allows the selection of a ProductVariant, Product, Customer or Asset. For other entity types, a custom implementation will need to be defined. See <a href='/reference/admin-ui-api/custom-input-components/register-form-input-component#registerforminputcomponent'>registerFormInputComponent</a>. ```ts title="Signature" class RelationFormInputComponent implements FormInputComponent { static readonly id: DefaultFormComponentId = 'relation-form-input'; @Input() readonly: boolean; formControl: UntypedFormControl; config: RelationCustomFieldConfig; } ``` * Implements: <code><a href='/reference/admin-ui-api/custom-input-components/form-input-component#forminputcomponent'>FormInputComponent</a></code> <div className="members-wrapper"> ### id <MemberInfo kind="property" type={`<a href='/reference/typescript-api/configurable-operation-def/default-form-component-id#defaultformcomponentid'>DefaultFormComponentId</a>`} /> ### readonly <MemberInfo kind="property" type={`boolean`} /> ### formControl <MemberInfo kind="property" type={`UntypedFormControl`} /> ### config <MemberInfo kind="property" type={`RelationCustomFieldConfig`} /> </div> ## RichTextFormInputComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/rich-text-form-input/rich-text-form-input.component.ts" sourceLine="14" packageName="@vendure/admin-ui" /> Uses the <a href='/reference/admin-ui-api/components/rich-text-editor-component#richtexteditorcomponent'>RichTextEditorComponent</a> as in input for `text` type fields. ```ts title="Signature" class RichTextFormInputComponent implements FormInputComponent { static readonly id: DefaultFormComponentId = 'rich-text-form-input'; readonly: boolean; formControl: UntypedFormControl; config: DefaultFormComponentConfig<'rich-text-form-input'>; } ``` * Implements: <code><a href='/reference/admin-ui-api/custom-input-components/form-input-component#forminputcomponent'>FormInputComponent</a></code> <div className="members-wrapper"> ### id <MemberInfo kind="property" type={`<a href='/reference/typescript-api/configurable-operation-def/default-form-component-id#defaultformcomponentid'>DefaultFormComponentId</a>`} /> ### readonly <MemberInfo kind="property" type={`boolean`} /> ### formControl <MemberInfo kind="property" type={`UntypedFormControl`} /> ### config <MemberInfo kind="property" type={`DefaultFormComponentConfig&#60;'rich-text-form-input'&#62;`} /> </div> ## SelectFormInputComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/select-form-input/select-form-input.component.ts" sourceLine="18" packageName="@vendure/admin-ui" /> Uses a select input to allow the selection of a string value. Should be used with `string` type fields with options. ```ts title="Signature" class SelectFormInputComponent implements FormInputComponent, OnInit { static readonly id: DefaultFormComponentId = 'select-form-input'; @Input() readonly: boolean; formControl: UntypedFormControl; config: DefaultFormComponentConfig<'select-form-input'> & CustomFieldConfigFragment; uiLanguage$: Observable<LanguageCode>; options: void constructor(dataService: DataService) ngOnInit() => ; trackByFn(index: number, item: any) => ; } ``` * Implements: <code><a href='/reference/admin-ui-api/custom-input-components/form-input-component#forminputcomponent'>FormInputComponent</a></code>, <code>OnInit</code> <div className="members-wrapper"> ### id <MemberInfo kind="property" type={`<a href='/reference/typescript-api/configurable-operation-def/default-form-component-id#defaultformcomponentid'>DefaultFormComponentId</a>`} /> ### readonly <MemberInfo kind="property" type={`boolean`} /> ### formControl <MemberInfo kind="property" type={`UntypedFormControl`} /> ### config <MemberInfo kind="property" type={`DefaultFormComponentConfig&#60;'select-form-input'&#62; &#38; CustomFieldConfigFragment`} /> ### uiLanguage$ <MemberInfo kind="property" type={`Observable&#60;<a href='/reference/typescript-api/common/language-code#languagecode'>LanguageCode</a>&#62;`} /> ### options <MemberInfo kind="property" type={``} /> ### constructor <MemberInfo kind="method" type={`(dataService: <a href='/reference/admin-ui-api/services/data-service#dataservice'>DataService</a>) => SelectFormInputComponent`} /> ### ngOnInit <MemberInfo kind="method" type={`() => `} /> ### trackByFn <MemberInfo kind="method" type={`(index: number, item: any) => `} /> </div> ## TextFormInputComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/text-form-input/text-form-input.component.ts" sourceLine="14" packageName="@vendure/admin-ui" /> Uses a regular text form input. This is the default input for `string` and `localeString` type fields. ```ts title="Signature" class TextFormInputComponent implements FormInputComponent { static readonly id: DefaultFormComponentId = 'text-form-input'; readonly: boolean; formControl: UntypedFormControl; config: DefaultFormComponentConfig<'text-form-input'>; prefix: void suffix: void } ``` * Implements: <code><a href='/reference/admin-ui-api/custom-input-components/form-input-component#forminputcomponent'>FormInputComponent</a></code> <div className="members-wrapper"> ### id <MemberInfo kind="property" type={`<a href='/reference/typescript-api/configurable-operation-def/default-form-component-id#defaultformcomponentid'>DefaultFormComponentId</a>`} /> ### readonly <MemberInfo kind="property" type={`boolean`} /> ### formControl <MemberInfo kind="property" type={`UntypedFormControl`} /> ### config <MemberInfo kind="property" type={`DefaultFormComponentConfig&#60;'text-form-input'&#62;`} /> ### prefix <MemberInfo kind="property" type={``} /> ### suffix <MemberInfo kind="property" type={``} /> </div> ## TextareaFormInputComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/textarea-form-input/textarea-form-input.component.ts" sourceLine="14" packageName="@vendure/admin-ui" /> Uses textarea form input. This is the default input for `text` type fields. ```ts title="Signature" class TextareaFormInputComponent implements FormInputComponent { static readonly id: DefaultFormComponentId = 'textarea-form-input'; readonly: boolean; formControl: UntypedFormControl; config: DefaultFormComponentConfig<'textarea-form-input'>; spellcheck: boolean } ``` * Implements: <code><a href='/reference/admin-ui-api/custom-input-components/form-input-component#forminputcomponent'>FormInputComponent</a></code> <div className="members-wrapper"> ### id <MemberInfo kind="property" type={`<a href='/reference/typescript-api/configurable-operation-def/default-form-component-id#defaultformcomponentid'>DefaultFormComponentId</a>`} /> ### readonly <MemberInfo kind="property" type={`boolean`} /> ### formControl <MemberInfo kind="property" type={`UntypedFormControl`} /> ### config <MemberInfo kind="property" type={`DefaultFormComponentConfig&#60;'textarea-form-input'&#62;`} /> ### spellcheck <MemberInfo kind="property" type={`boolean`} /> </div>
--- title: "FormInputComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## FormInputComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/common/component-registry-types.ts" sourceLine="11" packageName="@vendure/admin-ui" /> This interface should be implemented by any component being used as a custom input. For example, inputs for custom fields, or for configurable arguments. ```ts title="Signature" interface FormInputComponent<C = InputComponentConfig> { isListInput?: boolean; readonly: boolean; formControl: FormControl; config: C; } ``` <div className="members-wrapper"> ### isListInput <MemberInfo kind="property" type={`boolean`} /> Should be set to `true` if this component is designed to handle lists. If `true` then the formControl value will be an array of all the values in the list. ### readonly <MemberInfo kind="property" type={`boolean`} /> This is set by the Admin UI when consuming this component, indicating that the component should be rendered in a read-only state. ### formControl <MemberInfo kind="property" type={`FormControl`} /> This controls the actual value of the form item. The current value is available as `this.formControl.value`, and an Observable stream of value changes is available as `this.formControl.valueChanges`. To update the value, use `.setValue(val)` and then `.markAsDirty()`. Full documentation can be found in the [Angular docs](https://angular.io/api/forms/FormControl). ### config <MemberInfo kind="property" type={`C`} /> The `config` property contains the full configuration object of the custom field or configurable argument. </div>
--- title: "Custom Input Components" isDefaultIndex: true generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; import DocCardList from '@theme/DocCardList'; <DocCardList />
--- title: "RegisterFormInputComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## registerFormInputComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/extension/register-form-input-component.ts" sourceLine="53" packageName="@vendure/admin-ui" /> Registers a custom FormInputComponent which can be used to control the argument inputs of a <a href='/reference/typescript-api/configurable-operation-def/#configurableoperationdef'>ConfigurableOperationDef</a> (e.g. CollectionFilter, ShippingMethod etc.) or for a custom field. *Example* ```ts title="providers.ts" import { registerFormInputComponent } from '@vendure/admin-ui/core'; export default [ // highlight-next-line registerFormInputComponent('my-custom-input', MyCustomFieldControl), ]; ``` This input component can then be used in a custom field: *Example* ```ts title="src/vendure-config.ts" import { VendureConfig } from '@vendure/core'; const config: VendureConfig = { // ... customFields: { ProductVariant: [ { name: 'rrp', type: 'int', // highlight-next-line ui: { component: 'my-custom-input' }, }, ] } } ``` or with an argument of a <a href='/reference/typescript-api/configurable-operation-def/#configurableoperationdef'>ConfigurableOperationDef</a>: *Example* ```ts args: { rrp: { type: 'int', ui: { component: 'my-custom-input' } }, } ``` ```ts title="Signature" function registerFormInputComponent(id: string, component: Type<FormInputComponent>): FactoryProvider ``` Parameters ### id <MemberInfo kind="parameter" type={`string`} /> ### component <MemberInfo kind="parameter" type={`Type&#60;<a href='/reference/admin-ui-api/custom-input-components/form-input-component#forminputcomponent'>FormInputComponent</a>&#62;`} />
--- title: "CustomColumnComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## CustomColumnComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/components/data-table-2/data-table-custom-component.service.ts" sourceLine="44" packageName="@vendure/admin-ui" /> Components which are to be used to render custom cells in a data table should implement this interface. The `rowItem` property is the data object for the row, e.g. the `Product` object if used in the `product-list` table. ```ts title="Signature" interface CustomColumnComponent { rowItem: any; } ``` <div className="members-wrapper"> ### rowItem <MemberInfo kind="property" type={`any`} /> </div>
--- title: "DataTableComponentConfig" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## DataTableComponentConfig <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/components/data-table-2/data-table-custom-component.service.ts" sourceLine="54" packageName="@vendure/admin-ui" /> Configures a <a href='/reference/admin-ui-api/custom-detail-components/custom-detail-component#customdetailcomponent'>CustomDetailComponent</a> to be placed in the given location. ```ts title="Signature" interface DataTableComponentConfig { tableId: DataTableLocationId; columnId: DataTableColumnId; component: Type<CustomColumnComponent>; providers?: Provider[]; } ``` <div className="members-wrapper"> ### tableId <MemberInfo kind="property" type={`DataTableLocationId`} /> The location in the UI where the custom component should be placed. ### columnId <MemberInfo kind="property" type={`DataTableColumnId`} /> The column in the table where the custom component should be placed. ### component <MemberInfo kind="property" type={`Type&#60;<a href='/reference/admin-ui-api/custom-table-components/custom-column-component#customcolumncomponent'>CustomColumnComponent</a>&#62;`} /> The component to render in the table cell. This component should implement the <a href='/reference/admin-ui-api/custom-table-components/custom-column-component#customcolumncomponent'>CustomColumnComponent</a> interface. ### providers <MemberInfo kind="property" type={`Provider[]`} /> </div>
--- title: "Custom Table Components" isDefaultIndex: true generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; import DocCardList from '@theme/DocCardList'; <DocCardList />
--- title: "RegisterDataTableComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## registerDataTableComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/extension/register-data-table-component.ts" sourceLine="45" packageName="@vendure/admin-ui" /> Allows you to override the default component used to render the data of a particular column in a DataTable. The component should implement the {@link CustomDataTableColumnComponent} interface. The tableId and columnId can be determined by pressing `ctrl + u` when running the Admin UI in dev mode. *Example* ```ts title="components/custom-table.component.ts" import { Component, Input } from '@angular/core'; import { CustomColumnComponent } from '@vendure/admin-ui/core'; @Component({ selector: 'custom-slug-component', template: ` <a [href]="'https://example.com/products/' + rowItem.slug" target="_blank">{{ rowItem.slug }}</a> `, standalone: true, }) export class CustomTableComponent implements CustomColumnComponent { @Input() rowItem: any; } ``` ```ts title="providers.ts" import { registerDataTableComponent } from '@vendure/admin-ui/core'; import { CustomTableComponent } from './components/custom-table.component'; export default [ registerDataTableComponent({ component: CustomTableComponent, tableId: 'product-list', columnId: 'slug', }), ]; ``` ```ts title="Signature" function registerDataTableComponent(config: DataTableComponentConfig): void ``` Parameters ### config <MemberInfo kind="parameter" type={`<a href='/reference/admin-ui-api/custom-table-components/data-table-component-config#datatablecomponentconfig'>DataTableComponentConfig</a>`} />
--- title: "DashboardWidgetConfig" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## DashboardWidgetConfig <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/dashboard-widget/dashboard-widget-types.ts" sourceLine="11" packageName="@vendure/admin-ui" /> A configuration object for a dashboard widget. ```ts title="Signature" interface DashboardWidgetConfig { loadComponent: () => Promise<Type<any>> | Type<any>; title?: string; supportedWidths?: DashboardWidgetWidth[]; requiresPermissions?: string[]; } ``` <div className="members-wrapper"> ### loadComponent <MemberInfo kind="property" type={`() =&#62; Promise&#60;Type&#60;any&#62;&#62; | Type&#60;any&#62;`} /> Used to specify the widget component. Supports both eager- and lazy-loading. *Example* ```ts // eager-loading loadComponent: () => MyWidgetComponent, // lazy-loading loadComponent: () => import('./path-to/widget.component').then(m => m.MyWidgetComponent), ``` ### title <MemberInfo kind="property" type={`string`} /> The title of the widget. Can be a translation token as it will get passed through the `translate` pipe. ### supportedWidths <MemberInfo kind="property" type={`DashboardWidgetWidth[]`} /> The supported widths of the widget, in terms of a Bootstrap-style 12-column grid. If omitted, then it is assumed the widget supports all widths. ### requiresPermissions <MemberInfo kind="property" type={`string[]`} /> If set, the widget will only be displayed if the current user has all the specified permissions. </div>
--- title: "Dashboard Widgets" isDefaultIndex: true generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; import DocCardList from '@theme/DocCardList'; <DocCardList />
--- title: "RegisterDashboardWidget" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## registerDashboardWidget <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/extension/register-dashboard-widget.ts" sourceLine="16" packageName="@vendure/admin-ui" /> Registers a dashboard widget. Once registered, the widget can be set as part of the default (using <a href='/reference/admin-ui-api/dashboard-widgets/set-dashboard-widget-layout#setdashboardwidgetlayout'>setDashboardWidgetLayout</a>). ```ts title="Signature" function registerDashboardWidget(id: string, config: DashboardWidgetConfig): FactoryProvider ``` Parameters ### id <MemberInfo kind="parameter" type={`string`} /> ### config <MemberInfo kind="parameter" type={`<a href='/reference/admin-ui-api/dashboard-widgets/dashboard-widget-config#dashboardwidgetconfig'>DashboardWidgetConfig</a>`} />
--- title: "SetDashboardWidgetLayout" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## setDashboardWidgetLayout <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/extension/register-dashboard-widget.ts" sourceLine="33" packageName="@vendure/admin-ui" /> Sets the default widget layout for the Admin UI dashboard. ```ts title="Signature" function setDashboardWidgetLayout(layoutDef: WidgetLayoutDefinition): FactoryProvider ``` Parameters ### layoutDef <MemberInfo kind="parameter" type={`<a href='/reference/admin-ui-api/dashboard-widgets/widget-layout-definition#widgetlayoutdefinition'>WidgetLayoutDefinition</a>`} />
--- title: "WidgetLayoutDefinition" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## WidgetLayoutDefinition <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/dashboard-widget/dashboard-widget-types.ts" sourceLine="51" packageName="@vendure/admin-ui" /> A configuration object for the default dashboard widget layout. ```ts title="Signature" type WidgetLayoutDefinition = Array<{ id: string; width: DashboardWidgetWidth }> ```
--- title: "Directives" weight: 10 date: 2023-07-14T16:57:51.265Z showtoc: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> # directives
--- title: "IfMultichannelDirective" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## IfMultichannelDirective <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/directives/if-multichannel.directive.ts" sourceLine="21" packageName="@vendure/admin-ui" /> Structural directive that displays the given element if the Vendure instance has multiple channels configured. *Example* ```html <div *vdrIfMultichannel class="channel-selector"> <!-- ... --> </ng-container> ``` ```ts title="Signature" class IfMultichannelDirective extends IfDirectiveBase<[]> { constructor(_viewContainer: ViewContainerRef, templateRef: TemplateRef<any>, dataService: DataService) } ``` * Extends: <code>IfDirectiveBase&#60;[]&#62;</code> <div className="members-wrapper"> ### constructor <MemberInfo kind="method" type={`(_viewContainer: ViewContainerRef, templateRef: TemplateRef&#60;any&#62;, dataService: <a href='/reference/admin-ui-api/services/data-service#dataservice'>DataService</a>) => IfMultichannelDirective`} /> </div>
--- title: "IfPermissionsDirective" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## IfPermissionsDirective <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/directives/if-permissions.directive.ts" sourceLine="26" packageName="@vendure/admin-ui" /> Conditionally shows/hides templates based on the current active user having the specified permission. Based on the ngIf source. Also support "else" templates: *Example* ```html <button *vdrIfPermissions="'DeleteCatalog'; else unauthorized">Delete Product</button> <ng-template #unauthorized>Not allowed!</ng-template> ``` The permission can be a single string, or an array. If an array is passed, then _all_ of the permissions must match (logical AND) ```ts title="Signature" class IfPermissionsDirective extends IfDirectiveBase<Array<Permission[] | null>> { constructor(_viewContainer: ViewContainerRef, templateRef: TemplateRef<any>, changeDetectorRef: ChangeDetectorRef, permissionsService: PermissionsService) } ``` * Extends: <code>IfDirectiveBase&#60;Array&#60;<a href='/reference/typescript-api/common/permission#permission'>Permission</a>[] | null&#62;&#62;</code> <div className="members-wrapper"> ### constructor <MemberInfo kind="method" type={`(_viewContainer: ViewContainerRef, templateRef: TemplateRef&#60;any&#62;, changeDetectorRef: ChangeDetectorRef, permissionsService: PermissionsService) => IfPermissionsDirective`} /> </div>
--- title: "Directives" isDefaultIndex: true generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; import DocCardList from '@theme/DocCardList'; <DocCardList />
--- title: "List Detail Views" weight: 10 date: 2023-07-14T16:57:51.042Z showtoc: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> # list-detail-views
--- title: "BaseDetailComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## BaseDetailComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/common/base-detail.component.ts" sourceLine="57" packageName="@vendure/admin-ui" /> A base class for entity detail views. It should be used in conjunction with the <a href='/reference/admin-ui-api/list-detail-views/base-entity-resolver#baseentityresolver'>BaseEntityResolver</a>. *Example* ```ts @Component({ selector: 'app-my-entity', templateUrl: './my-entity.component.html', styleUrls: ['./my-entity.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, }) export class GlobalSettingsComponent extends BaseDetailComponent<MyEntityFragment> implements OnInit { detailForm: FormGroup; constructor( router: Router, route: ActivatedRoute, serverConfigService: ServerConfigService, protected dataService: DataService, private formBuilder: FormBuilder, ) { super(route, router, serverConfigService, dataService); this.detailForm = this.formBuilder.group({ name: [''], }); } protected setFormValues(entity: MyEntityFragment, languageCode: LanguageCode): void { this.detailForm.patchValue({ name: entity.name, }); } } ``` ```ts title="Signature" class BaseDetailComponent<Entity extends { id: string; updatedAt?: string }> implements DeactivateAware { entity$: Observable<Entity>; availableLanguages$: Observable<LanguageCode[]>; languageCode$: Observable<LanguageCode>; languageCode: LanguageCode; isNew$: Observable<boolean>; id: string; abstract detailForm: UntypedFormGroup; protected destroy$ = new Subject<void>(); constructor(route: ActivatedRoute, router: Router, serverConfigService: ServerConfigService, dataService: DataService, permissionsService: PermissionsService) init() => ; setUpStreams() => ; destroy() => ; setLanguage(code: LanguageCode) => ; canDeactivate() => boolean; setFormValues(entity: Entity, languageCode: LanguageCode) => void; setCustomFieldFormValues(customFields: CustomFieldConfig[], formGroup: AbstractControl | null, entity: T, currentTranslation?: TranslationOf<T>) => ; getCustomFieldConfig(key: Exclude<keyof CustomFields, '__typename'>) => CustomFieldConfig[]; setQueryParam(key: string, value: any) => ; } ``` * Implements: <code>DeactivateAware</code> <div className="members-wrapper"> ### entity$ <MemberInfo kind="property" type={`Observable&#60;Entity&#62;`} /> ### availableLanguages$ <MemberInfo kind="property" type={`Observable&#60;<a href='/reference/typescript-api/common/language-code#languagecode'>LanguageCode</a>[]&#62;`} /> ### languageCode$ <MemberInfo kind="property" type={`Observable&#60;<a href='/reference/typescript-api/common/language-code#languagecode'>LanguageCode</a>&#62;`} /> ### languageCode <MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/language-code#languagecode'>LanguageCode</a>`} /> ### isNew$ <MemberInfo kind="property" type={`Observable&#60;boolean&#62;`} /> ### id <MemberInfo kind="property" type={`string`} /> ### detailForm <MemberInfo kind="property" type={`UntypedFormGroup`} /> ### destroy$ <MemberInfo kind="property" type={``} /> ### constructor <MemberInfo kind="method" type={`(route: ActivatedRoute, router: Router, serverConfigService: ServerConfigService, dataService: <a href='/reference/admin-ui-api/services/data-service#dataservice'>DataService</a>, permissionsService: PermissionsService) => BaseDetailComponent`} /> ### init <MemberInfo kind="method" type={`() => `} /> ### setUpStreams <MemberInfo kind="method" type={`() => `} /> ### destroy <MemberInfo kind="method" type={`() => `} /> ### setLanguage <MemberInfo kind="method" type={`(code: <a href='/reference/typescript-api/common/language-code#languagecode'>LanguageCode</a>) => `} /> ### canDeactivate <MemberInfo kind="method" type={`() => boolean`} /> ### setFormValues <MemberInfo kind="method" type={`(entity: Entity, languageCode: <a href='/reference/typescript-api/common/language-code#languagecode'>LanguageCode</a>) => void`} /> ### setCustomFieldFormValues <MemberInfo kind="method" type={`(customFields: <a href='/reference/typescript-api/custom-fields/custom-field-config#customfieldconfig'>CustomFieldConfig</a>[], formGroup: AbstractControl | null, entity: T, currentTranslation?: TranslationOf&#60;T&#62;) => `} /> ### getCustomFieldConfig <MemberInfo kind="method" type={`(key: Exclude&#60;keyof <a href='/reference/typescript-api/custom-fields/#customfields'>CustomFields</a>, '__typename'&#62;) => <a href='/reference/typescript-api/custom-fields/custom-field-config#customfieldconfig'>CustomFieldConfig</a>[]`} /> ### setQueryParam <MemberInfo kind="method" type={`(key: string, value: any) => `} /> </div>
--- title: "BaseEntityResolver" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## BaseEntityResolver <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/common/base-entity-resolver.ts" sourceLine="55" packageName="@vendure/admin-ui" /> A base resolver for an entity detail route. Resolves to an observable of the given entity, or a "blank" version if the route id equals "create". Should be used together with details views which extend the <a href='/reference/admin-ui-api/list-detail-views/base-detail-component#basedetailcomponent'>BaseDetailComponent</a>. *Example* ```ts @Injectable({ providedIn: 'root', }) export class MyEntityResolver extends BaseEntityResolver<MyEntityFragment> { constructor(router: Router, dataService: DataService) { super( router, { __typename: 'MyEntity', id: '', createdAt: '', updatedAt: '', name: '', }, id => dataService.query(GET_MY_ENTITY, { id }).mapStream(data => data.myEntity), ); } } ``` ```ts title="Signature" class BaseEntityResolver<T> { constructor(router: Router, emptyEntity: T, entityStream: (id: string) => Observable<T | null | undefined>) } ``` <div className="members-wrapper"> ### constructor <MemberInfo kind="method" type={`(router: Router, emptyEntity: T, entityStream: (id: string) =&#62; Observable&#60;T | null | undefined&#62;) => BaseEntityResolver`} /> </div>
--- title: "BaseListComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## BaseListComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/common/base-list.component.ts" sourceLine="40" packageName="@vendure/admin-ui" /> This is a base class which implements the logic required to fetch and manipulate a list of data from a query which returns a PaginatedList type. It is normally used in combination with the <a href='/reference/admin-ui-api/components/data-table2component#datatable2component'>DataTable2Component</a>. ```ts title="Signature" class BaseListComponent<ResultType, ItemType, VariableType extends Record<string, any> = any> implements OnInit, OnDestroy { searchTermControl = new FormControl(''); selectionManager = new SelectionManager<any>({ multiSelect: true, itemsAreEqual: (a, b) => a.id === b.id, additiveMode: true, }); result$: Observable<ResultType>; items$: Observable<ItemType[]>; totalItems$: Observable<number>; itemsPerPage$: Observable<number>; currentPage$: Observable<number>; protected destroy$ = new Subject<void>(); protected refresh$ = new BehaviorSubject<undefined>(undefined); constructor(router: Router, route: ActivatedRoute) setQueryFn(listQueryFn: ListQueryFn<ResultType>, mappingFn: MappingFn<ItemType, ResultType>, onPageChangeFn?: OnPageChangeFn<VariableType>, defaults?: { take: number; skip: number }) => ; refreshListOnChanges(streams: Array<Observable<any>>) => ; setPageNumber(page: number) => ; setItemsPerPage(perPage: number) => ; refresh() => ; setQueryParam(hash: { [key: string]: any }, options?: { replaceUrl?: boolean; queryParamsHandling?: QueryParamsHandling }) => ; setQueryParam(key: string, value: any, options?: { replaceUrl?: boolean; queryParamsHandling?: QueryParamsHandling }) => ; setQueryParam(keyOrHash: string | { [key: string]: any }, valueOrOptions?: any, maybeOptions?: { replaceUrl?: boolean; queryParamsHandling?: QueryParamsHandling }) => ; } ``` * Implements: <code>OnInit</code>, <code>OnDestroy</code> <div className="members-wrapper"> ### searchTermControl <MemberInfo kind="property" type={``} /> ### selectionManager <MemberInfo kind="property" type={``} /> ### result$ <MemberInfo kind="property" type={`Observable&#60;ResultType&#62;`} /> ### items$ <MemberInfo kind="property" type={`Observable&#60;ItemType[]&#62;`} /> ### totalItems$ <MemberInfo kind="property" type={`Observable&#60;number&#62;`} /> ### itemsPerPage$ <MemberInfo kind="property" type={`Observable&#60;number&#62;`} /> ### currentPage$ <MemberInfo kind="property" type={`Observable&#60;number&#62;`} /> ### destroy$ <MemberInfo kind="property" type={``} /> ### refresh$ <MemberInfo kind="property" type={``} /> ### constructor <MemberInfo kind="method" type={`(router: Router, route: ActivatedRoute) => BaseListComponent`} /> ### setQueryFn <MemberInfo kind="method" type={`(listQueryFn: ListQueryFn&#60;ResultType&#62;, mappingFn: MappingFn&#60;ItemType, ResultType&#62;, onPageChangeFn?: OnPageChangeFn&#60;VariableType&#62;, defaults?: { take: number; skip: number }) => `} /> Sets the fetch function for the list being implemented. ### refreshListOnChanges <MemberInfo kind="method" type={`(streams: Array&#60;Observable&#60;any&#62;&#62;) => `} /> Accepts a list of Observables which will trigger a refresh of the list when any of them emit. ### setPageNumber <MemberInfo kind="method" type={`(page: number) => `} /> Sets the current page number in the url. ### setItemsPerPage <MemberInfo kind="method" type={`(perPage: number) => `} /> Sets the number of items per page in the url. ### refresh <MemberInfo kind="method" type={`() => `} /> Re-fetch the current page of results. ### setQueryParam <MemberInfo kind="method" type={`(hash: { [key: string]: any }, options?: { replaceUrl?: boolean; queryParamsHandling?: QueryParamsHandling }) => `} /> ### setQueryParam <MemberInfo kind="method" type={`(key: string, value: any, options?: { replaceUrl?: boolean; queryParamsHandling?: QueryParamsHandling }) => `} /> ### setQueryParam <MemberInfo kind="method" type={`(keyOrHash: string | { [key: string]: any }, valueOrOptions?: any, maybeOptions?: { replaceUrl?: boolean; queryParamsHandling?: QueryParamsHandling }) => `} /> </div>
--- title: "DetailComponentWithResolver" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## detailComponentWithResolver <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/common/base-detail.component.ts" sourceLine="256" packageName="@vendure/admin-ui" /> A helper function for creating tabs that point to a <a href='/reference/admin-ui-api/list-detail-views/typed-base-detail-component#typedbasedetailcomponent'>TypedBaseDetailComponent</a>. This takes care of the route resolver parts so that the detail component automatically has access to the correct resolved detail data. *Example* ```ts @NgModule({ imports: [ReviewsSharedModule], declarations: [/* ... *\/], providers: [ registerPageTab({ location: 'product-detail', tab: 'Specs', route: 'specs', component: detailComponentWithResolver({ component: ProductSpecDetailComponent, query: GetProductSpecsDocument, entityKey: 'spec', }), }), ], }) export class ProductSpecsUiExtensionModule {} ``` ```ts title="Signature" function detailComponentWithResolver<T extends TypedDocumentNode<any, { id: string }>, Field extends keyof ResultOf<T>, R extends Field>(config: { component: Type<TypedBaseDetailComponent<T, Field>>; query: T; entityKey: R; getBreadcrumbs?: (entity: ResultOf<T>[R]) => BreadcrumbValue; variables?: T extends TypedDocumentNode<any, infer V> ? Omit<V, 'id'> : never; }): void ``` Parameters ### config <MemberInfo kind="parameter" type={`{ component: Type&#60;<a href='/reference/admin-ui-api/list-detail-views/typed-base-detail-component#typedbasedetailcomponent'>TypedBaseDetailComponent</a>&#60;T, Field&#62;&#62;; query: T; entityKey: R; getBreadcrumbs?: (entity: ResultOf&#60;T&#62;[R]) =&#62; BreadcrumbValue; variables?: T extends TypedDocumentNode&#60;any, infer V&#62; ? Omit&#60;V, 'id'&#62; : never; }`} />
--- title: "List Detail Views" isDefaultIndex: true generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; import DocCardList from '@theme/DocCardList'; <DocCardList />
--- title: "TypedBaseDetailComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## TypedBaseDetailComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/common/base-detail.component.ts" sourceLine="186" packageName="@vendure/admin-ui" /> A version of the <a href='/reference/admin-ui-api/list-detail-views/base-detail-component#basedetailcomponent'>BaseDetailComponent</a> which is designed to be used with a [TypedDocumentNode](https://the-guild.dev/graphql/codegen/plugins/typescript/typed-document-node). ```ts title="Signature" class TypedBaseDetailComponent<T extends TypedDocumentNode<any, any>, Field extends keyof ResultOf<T>> extends BaseDetailComponent<NonNullable<ResultOf<T>[Field]>> { protected result$: Observable<ResultOf<T>>; protected entity: ResultOf<T>[Field]; constructor() init() => ; } ``` * Extends: <code><a href='/reference/admin-ui-api/list-detail-views/base-detail-component#basedetailcomponent'>BaseDetailComponent</a>&#60;NonNullable&#60;ResultOf&#60;T&#62;[Field]&#62;&#62;</code> <div className="members-wrapper"> ### result$ <MemberInfo kind="property" type={`Observable&#60;ResultOf&#60;T&#62;&#62;`} /> ### entity <MemberInfo kind="property" type={`ResultOf&#60;T&#62;[Field]`} /> ### constructor <MemberInfo kind="method" type={`() => TypedBaseDetailComponent`} /> ### init <MemberInfo kind="method" type={`() => `} /> </div>
--- title: "TypedBaseListComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## TypedBaseListComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/common/base-list.component.ts" sourceLine="199" packageName="@vendure/admin-ui" /> A version of the <a href='/reference/admin-ui-api/list-detail-views/base-list-component#baselistcomponent'>BaseListComponent</a> which is designed to be used with a [TypedDocumentNode](https://the-guild.dev/graphql/codegen/plugins/typescript/typed-document-node). ```ts title="Signature" class TypedBaseListComponent<T extends TypedDocumentNode<any, Vars>, Field extends keyof ResultOf<T>, Vars extends { options: { filter: any; sort: any } } = VariablesOf<T>> extends BaseListComponent<ResultOf<T>, ItemOf<ResultOf<T>, Field>, VariablesOf<T>> implements OnInit { availableLanguages$: Observable<LanguageCode[]>; contentLanguage$: Observable<LanguageCode>; protected dataService = inject(DataService); protected router = inject(Router); protected serverConfigService = inject(ServerConfigService); protected permissionsService = inject(PermissionsService); constructor() configure(config: { document: T; getItems: (data: ResultOf<T>) => { items: Array<ItemOf<ResultOf<T>, Field>>; totalItems: number }; setVariables?: (skip: number, take: number) => VariablesOf<T>; refreshListOnChanges?: Array<Observable<any>>; }) => ; ngOnInit() => ; createFilterCollection() => DataTableFilterCollection<NonNullable<NonNullable<Vars['options']>['filter']>>; createSortCollection() => DataTableSortCollection<NonNullable<NonNullable<Vars['options']>['sort']>>; setLanguage(code: LanguageCode) => ; getCustomFieldConfig(key: Exclude<keyof CustomFields, '__typename'> | string) => CustomFieldConfig[]; } ``` * Extends: <code><a href='/reference/admin-ui-api/list-detail-views/base-list-component#baselistcomponent'>BaseListComponent</a>&#60;ResultOf&#60;T&#62;, ItemOf&#60;ResultOf&#60;T&#62;, Field&#62;, VariablesOf&#60;T&#62;&#62;</code> * Implements: <code>OnInit</code> <div className="members-wrapper"> ### availableLanguages$ <MemberInfo kind="property" type={`Observable&#60;<a href='/reference/typescript-api/common/language-code#languagecode'>LanguageCode</a>[]&#62;`} /> ### contentLanguage$ <MemberInfo kind="property" type={`Observable&#60;<a href='/reference/typescript-api/common/language-code#languagecode'>LanguageCode</a>&#62;`} /> ### dataService <MemberInfo kind="property" type={``} /> ### router <MemberInfo kind="property" type={``} /> ### serverConfigService <MemberInfo kind="property" type={``} /> ### permissionsService <MemberInfo kind="property" type={``} /> ### constructor <MemberInfo kind="method" type={`() => TypedBaseListComponent`} /> ### configure <MemberInfo kind="method" type={`(config: { document: T; getItems: (data: ResultOf&#60;T&#62;) =&#62; { items: Array&#60;ItemOf&#60;ResultOf&#60;T&#62;, Field&#62;&#62;; totalItems: number }; setVariables?: (skip: number, take: number) =&#62; VariablesOf&#60;T&#62;; refreshListOnChanges?: Array&#60;Observable&#60;any&#62;&#62;; }) => `} /> ### ngOnInit <MemberInfo kind="method" type={`() => `} /> ### createFilterCollection <MemberInfo kind="method" type={`() => DataTableFilterCollection&#60;NonNullable&#60;NonNullable&#60;Vars['options']&#62;['filter']&#62;&#62;`} /> ### createSortCollection <MemberInfo kind="method" type={`() => DataTableSortCollection&#60;NonNullable&#60;NonNullable&#60;Vars['options']&#62;['sort']&#62;&#62;`} /> ### setLanguage <MemberInfo kind="method" type={`(code: <a href='/reference/typescript-api/common/language-code#languagecode'>LanguageCode</a>) => `} /> ### getCustomFieldConfig <MemberInfo kind="method" type={`(key: Exclude&#60;keyof <a href='/reference/typescript-api/custom-fields/#customfields'>CustomFields</a>, '__typename'&#62; | string) => <a href='/reference/typescript-api/custom-fields/custom-field-config#customfieldconfig'>CustomFieldConfig</a>[]`} /> </div>
--- title: "Nav Menu" weight: 10 date: 2023-07-14T16:57:51.109Z showtoc: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> # nav-menu
--- title: "AddNavMenuItem" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## addNavMenuItem <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/extension/add-nav-menu-item.ts" sourceLine="68" packageName="@vendure/admin-ui" /> Add a menu item to an existing section specified by `sectionId`. The id of the section can be found by inspecting the DOM and finding the `data-section-id` attribute. Providing the `before` argument will move the item before any existing item with the specified id. If omitted (or if the name is not found) the item will be appended to the end of the section. This should be used in the NgModule `providers` array of your ui extension module. *Example* ```ts title="providers.ts" import { addNavMenuItem } from '@vendure/admin-ui/core'; export default [ addNavMenuItem({ id: 'reviews', label: 'Product Reviews', routerLink: ['/extensions/reviews'], icon: 'star', }, 'marketing'), ]; ``` ```ts title="Signature" function addNavMenuItem(config: NavMenuItem, sectionId: string, before?: string): Provider ``` Parameters ### config <MemberInfo kind="parameter" type={`<a href='/reference/admin-ui-api/nav-menu/nav-menu-item#navmenuitem'>NavMenuItem</a>`} /> ### sectionId <MemberInfo kind="parameter" type={`string`} /> ### before <MemberInfo kind="parameter" type={`string`} />
--- title: "AddNavMenuSection" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## addNavMenuSection <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/extension/add-nav-menu-item.ts" sourceLine="30" packageName="@vendure/admin-ui" /> Add a section to the main nav menu. Providing the `before` argument will move the section before any existing section with the specified id. If omitted (or if the id is not found) the section will be appended to the existing set of sections. This should be used in the NgModule `providers` array of your ui extension module. *Example* ```ts title="providers.ts" import { addNavMenuSection } from '@vendure/admin-ui/core'; export default [ addNavMenuSection({ id: 'reports', label: 'Reports', items: [{ // ... }], }, 'settings'), ]; ``` ```ts title="Signature" function addNavMenuSection(config: NavMenuSection, before?: string): Provider ``` Parameters ### config <MemberInfo kind="parameter" type={`<a href='/reference/admin-ui-api/nav-menu/nav-menu-section#navmenusection'>NavMenuSection</a>`} /> ### before <MemberInfo kind="parameter" type={`string`} />
--- title: "Nav Menu" isDefaultIndex: true generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; import DocCardList from '@theme/DocCardList'; <DocCardList />
--- title: "NavMenuItem" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## NavMenuItem <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/nav-builder/nav-builder-types.ts" sourceLine="37" packageName="@vendure/admin-ui" /> A NavMenuItem is a menu item in the main (left-hand side) nav bar. ```ts title="Signature" interface NavMenuItem { id: string; label: string; routerLink: RouterLinkDefinition; onClick?: (event: MouseEvent) => void; icon?: string; requiresPermission?: string | ((userPermissions: string[]) => boolean); statusBadge?: Observable<NavMenuBadge>; } ``` <div className="members-wrapper"> ### id <MemberInfo kind="property" type={`string`} /> ### label <MemberInfo kind="property" type={`string`} /> ### routerLink <MemberInfo kind="property" type={`<a href='/reference/admin-ui-api/action-bar/router-link-definition#routerlinkdefinition'>RouterLinkDefinition</a>`} /> ### onClick <MemberInfo kind="property" type={`(event: MouseEvent) =&#62; void`} /> ### icon <MemberInfo kind="property" type={`string`} /> ### requiresPermission <MemberInfo kind="property" type={`string | ((userPermissions: string[]) =&#62; boolean)`} /> ### statusBadge <MemberInfo kind="property" type={`Observable&#60;<a href='/reference/admin-ui-api/nav-menu/navigation-types#navmenubadge'>NavMenuBadge</a>&#62;`} /> </div>
--- title: "NavMenuSection" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## NavMenuSection <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/nav-builder/nav-builder-types.ts" sourceLine="57" packageName="@vendure/admin-ui" /> A NavMenuSection is a grouping of links in the main (left-hand side) nav bar. ```ts title="Signature" interface NavMenuSection { id: string; label: string; items: NavMenuItem[]; icon?: string; displayMode?: 'regular' | 'settings'; requiresPermission?: string | ((userPermissions: string[]) => boolean); collapsible?: boolean; collapsedByDefault?: boolean; } ``` <div className="members-wrapper"> ### id <MemberInfo kind="property" type={`string`} /> ### label <MemberInfo kind="property" type={`string`} /> ### items <MemberInfo kind="property" type={`<a href='/reference/admin-ui-api/nav-menu/nav-menu-item#navmenuitem'>NavMenuItem</a>[]`} /> ### icon <MemberInfo kind="property" type={`string`} /> ### displayMode <MemberInfo kind="property" type={`'regular' | 'settings'`} /> ### requiresPermission <MemberInfo kind="property" type={`string | ((userPermissions: string[]) =&#62; boolean)`} /> Control the display of this item based on the user permissions. Note: if you attempt to pass a <a href='/reference/typescript-api/auth/permission-definition#permissiondefinition'>PermissionDefinition</a> object, you will get a compilation error. Instead, pass the plain string version. For example, if the permission is defined as: ```ts export const MyPermission = new PermissionDefinition('ProductReview'); ``` then the generated permission strings will be: - `CreateProductReview` - `ReadProductReview` - `UpdateProductReview` - `DeleteProductReview` ### collapsible <MemberInfo kind="property" type={`boolean`} /> ### collapsedByDefault <MemberInfo kind="property" type={`boolean`} /> </div>
--- title: "Navigation Types" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## NavMenuBadge <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/nav-builder/nav-builder-types.ts" sourceLine="19" packageName="@vendure/admin-ui" /> A color-coded notification badge which will be displayed by the NavMenuItem's icon. ```ts title="Signature" interface NavMenuBadge { type: NavMenuBadgeType; propagateToSection?: boolean; } ``` <div className="members-wrapper"> ### type <MemberInfo kind="property" type={`NavMenuBadgeType`} /> ### propagateToSection <MemberInfo kind="property" type={`boolean`} /> If true, the badge will propagate to the NavMenuItem's parent section, displaying a notification badge next to the section name. </div>
--- title: "Pipes" weight: 10 date: 2023-07-14T16:57:51.325Z showtoc: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> # pipes
--- title: "AssetPreviewPipe" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## AssetPreviewPipe <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/pipes/asset-preview.pipe.ts" sourceLine="19" packageName="@vendure/admin-ui" /> Given an Asset object (an object with `preview` and optionally `focalPoint` properties), this pipe returns a string with query parameters designed to work with the image resize capabilities of the AssetServerPlugin. *Example* ```HTML <img [src]="asset | assetPreview:'tiny'" /> <img [src]="asset | assetPreview:150" /> ``` ```ts title="Signature" class AssetPreviewPipe implements PipeTransform { transform(asset?: AssetFragment, preset: string | number = 'thumb') => string; } ``` * Implements: <code>PipeTransform</code> <div className="members-wrapper"> ### transform <MemberInfo kind="method" type={`(asset?: AssetFragment, preset: string | number = 'thumb') => string`} /> </div>
--- title: "DurationPipe" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## DurationPipe <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/pipes/duration.pipe.ts" sourceLine="18" packageName="@vendure/admin-ui" /> Displays a number of milliseconds in a more human-readable format, e.g. "12ms", "33s", "2:03m" *Example* ```ts {{ timeInMs | duration }} ``` ```ts title="Signature" class DurationPipe implements PipeTransform { constructor(i18nService: I18nService) transform(value: number) => string; } ``` * Implements: <code>PipeTransform</code> <div className="members-wrapper"> ### constructor <MemberInfo kind="method" type={`(i18nService: <a href='/reference/typescript-api/common/i18n-service#i18nservice'>I18nService</a>) => DurationPipe`} /> ### transform <MemberInfo kind="method" type={`(value: number) => string`} /> </div>
--- title: "FileSizePipe" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## FileSizePipe <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/pipes/file-size.pipe.ts" sourceLine="14" packageName="@vendure/admin-ui" /> Formats a number into a human-readable file size string. *Example* ```ts {{ fileSizeInBytes | filesize }} ``` ```ts title="Signature" class FileSizePipe implements PipeTransform { transform(value: number, useSiUnits: = true) => any; } ``` * Implements: <code>PipeTransform</code> <div className="members-wrapper"> ### transform <MemberInfo kind="method" type={`(value: number, useSiUnits: = true) => any`} /> </div>
--- title: "HasPermissionPipe" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## HasPermissionPipe <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/pipes/has-permission.pipe.ts" sourceLine="16" packageName="@vendure/admin-ui" /> A pipe which checks the provided permission against all the permissions of the current user. Returns `true` if the current user has that permission. *Example* ```HTML <button [disabled]="!('UpdateCatalog' | hasPermission)">Save Changes</button> ``` ```ts title="Signature" class HasPermissionPipe implements PipeTransform, OnDestroy { constructor(permissionsService: PermissionsService, changeDetectorRef: ChangeDetectorRef) transform(input: string | string[]) => any; ngOnDestroy() => ; } ``` * Implements: <code>PipeTransform</code>, <code>OnDestroy</code> <div className="members-wrapper"> ### constructor <MemberInfo kind="method" type={`(permissionsService: PermissionsService, changeDetectorRef: ChangeDetectorRef) => HasPermissionPipe`} /> ### transform <MemberInfo kind="method" type={`(input: string | string[]) => any`} /> ### ngOnDestroy <MemberInfo kind="method" type={`() => `} /> </div>
--- title: "Pipes" isDefaultIndex: true generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; import DocCardList from '@theme/DocCardList'; <DocCardList />
--- title: "LocaleCurrencyNamePipe" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## LocaleCurrencyNamePipe <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/pipes/locale-currency-name.pipe.ts" sourceLine="18" packageName="@vendure/admin-ui" /> Displays a human-readable name for a given ISO 4217 currency code. *Example* ```HTML {{ order.currencyCode | localeCurrencyName }} ``` ```ts title="Signature" class LocaleCurrencyNamePipe extends LocaleBasePipe implements PipeTransform { constructor(dataService?: DataService, changeDetectorRef?: ChangeDetectorRef) transform(value: any, display: 'full' | 'symbol' | 'name' = 'full', locale?: unknown) => any; } ``` * Extends: <code>LocaleBasePipe</code> * Implements: <code>PipeTransform</code> <div className="members-wrapper"> ### constructor <MemberInfo kind="method" type={`(dataService?: <a href='/reference/admin-ui-api/services/data-service#dataservice'>DataService</a>, changeDetectorRef?: ChangeDetectorRef) => LocaleCurrencyNamePipe`} /> ### transform <MemberInfo kind="method" type={`(value: any, display: 'full' | 'symbol' | 'name' = 'full', locale?: unknown) => any`} /> </div>
--- title: "LocaleCurrencyPipe" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## LocaleCurrencyPipe <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/pipes/locale-currency.pipe.ts" sourceLine="20" packageName="@vendure/admin-ui" /> Formats a Vendure monetary value (in cents) into the correct format for the configured currency and display locale. *Example* ```HTML {{ variant.priceWithTax | localeCurrency }} ``` ```ts title="Signature" class LocaleCurrencyPipe extends LocaleBasePipe implements PipeTransform { readonly precisionFactor: number; constructor(currencyService: CurrencyService, dataService?: DataService, changeDetectorRef?: ChangeDetectorRef) transform(value: unknown, args: unknown[]) => string | unknown; } ``` * Extends: <code>LocaleBasePipe</code> * Implements: <code>PipeTransform</code> <div className="members-wrapper"> ### precisionFactor <MemberInfo kind="property" type={`number`} /> ### constructor <MemberInfo kind="method" type={`(currencyService: CurrencyService, dataService?: <a href='/reference/admin-ui-api/services/data-service#dataservice'>DataService</a>, changeDetectorRef?: ChangeDetectorRef) => LocaleCurrencyPipe`} /> ### transform <MemberInfo kind="method" type={`(value: unknown, args: unknown[]) => string | unknown`} /> </div>
--- title: "LocaleDatePipe" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## LocaleDatePipe <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/pipes/locale-date.pipe.ts" sourceLine="19" packageName="@vendure/admin-ui" /> A replacement of the Angular DatePipe which makes use of the Intl API to format dates according to the selected UI language. *Example* ```HTML {{ order.orderPlacedAt | localeDate }} ``` ```ts title="Signature" class LocaleDatePipe extends LocaleBasePipe implements PipeTransform { constructor(dataService?: DataService, changeDetectorRef?: ChangeDetectorRef) transform(value: unknown, args: unknown[]) => unknown; } ``` * Extends: <code>LocaleBasePipe</code> * Implements: <code>PipeTransform</code> <div className="members-wrapper"> ### constructor <MemberInfo kind="method" type={`(dataService?: <a href='/reference/admin-ui-api/services/data-service#dataservice'>DataService</a>, changeDetectorRef?: ChangeDetectorRef) => LocaleDatePipe`} /> ### transform <MemberInfo kind="method" type={`(value: unknown, args: unknown[]) => unknown`} /> </div>
--- title: "LocaleLanguageNamePipe" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## LocaleLanguageNamePipe <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/pipes/locale-language-name.pipe.ts" sourceLine="18" packageName="@vendure/admin-ui" /> Displays a human-readable name for a given ISO 639-1 language code. *Example* ```HTML {{ 'zh_Hant' | localeLanguageName }} ``` ```ts title="Signature" class LocaleLanguageNamePipe extends LocaleBasePipe implements PipeTransform { constructor(dataService?: DataService, changeDetectorRef?: ChangeDetectorRef) transform(value: any, locale?: unknown) => string; } ``` * Extends: <code>LocaleBasePipe</code> * Implements: <code>PipeTransform</code> <div className="members-wrapper"> ### constructor <MemberInfo kind="method" type={`(dataService?: <a href='/reference/admin-ui-api/services/data-service#dataservice'>DataService</a>, changeDetectorRef?: ChangeDetectorRef) => LocaleLanguageNamePipe`} /> ### transform <MemberInfo kind="method" type={`(value: any, locale?: unknown) => string`} /> </div>
--- title: "LocaleRegionNamePipe" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## LocaleRegionNamePipe <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/pipes/locale-region-name.pipe.ts" sourceLine="18" packageName="@vendure/admin-ui" /> Displays a human-readable name for a given region. *Example* ```HTML {{ 'GB' | localeRegionName }} ``` ```ts title="Signature" class LocaleRegionNamePipe extends LocaleBasePipe implements PipeTransform { constructor(dataService?: DataService, changeDetectorRef?: ChangeDetectorRef) transform(value: any, locale?: unknown) => string; } ``` * Extends: <code>LocaleBasePipe</code> * Implements: <code>PipeTransform</code> <div className="members-wrapper"> ### constructor <MemberInfo kind="method" type={`(dataService?: <a href='/reference/admin-ui-api/services/data-service#dataservice'>DataService</a>, changeDetectorRef?: ChangeDetectorRef) => LocaleRegionNamePipe`} /> ### transform <MemberInfo kind="method" type={`(value: any, locale?: unknown) => string`} /> </div>
--- title: "TimeAgoPipe" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## TimeAgoPipe <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/shared/pipes/time-ago.pipe.ts" sourceLine="18" packageName="@vendure/admin-ui" /> Converts a date into the format "3 minutes ago", "5 hours ago" etc. *Example* ```HTML {{ order.orderPlacedAt | timeAgo }} ``` ```ts title="Signature" class TimeAgoPipe implements PipeTransform { constructor(i18nService: I18nService) transform(value: string | Date, nowVal?: string | Date) => string; } ``` * Implements: <code>PipeTransform</code> <div className="members-wrapper"> ### constructor <MemberInfo kind="method" type={`(i18nService: <a href='/reference/typescript-api/common/i18n-service#i18nservice'>I18nService</a>) => TimeAgoPipe`} /> ### transform <MemberInfo kind="method" type={`(value: string | Date, nowVal?: string | Date) => string`} /> </div>
--- title: "Providers" weight: 10 date: 2023-07-14T16:57:51.079Z showtoc: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> # providers
--- title: "Providers" isDefaultIndex: true generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; import DocCardList from '@theme/DocCardList'; <DocCardList />
--- title: "ActionBar" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## ActionBar <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/react-components/ActionBar.tsx" sourceLine="22" packageName="@vendure/admin-ui" /> A container for the primary actions on a list or detail page *Example* ```ts import { ActionBar } from '@vendure/admin-ui/react'; export function MyComponent() { return ( <ActionBar leftContent={<div>Optional left content</div>}> <button className='button primary'>Primary action</button> </ActionBar> ); } ``` ```ts title="Signature" function ActionBar(props: PropsWithChildren<{ leftContent?: ReactNode }>): void ``` Parameters ### props <MemberInfo kind="parameter" type={`PropsWithChildren&#60;{ leftContent?: ReactNode }&#62;`} />
--- title: "Card" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## Card <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/react-components/Card.tsx" sourceLine="22" packageName="@vendure/admin-ui" /> A card component which can be used to group related content. *Example* ```ts import { Card } from '@vendure/admin-ui/react'; export function MyComponent() { return ( <Card title='My Title'> <p>Some content</p> </Card> ); } ``` ```ts title="Signature" function Card(props: PropsWithChildren<{ title?: string; paddingX?: boolean }>): void ``` Parameters ### props <MemberInfo kind="parameter" type={`PropsWithChildren&#60;{ title?: string; paddingX?: boolean }&#62;`} />
--- title: "CdsIcon" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## CdsIcon <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/react-components/CdsIcon.tsx" sourceLine="47" packageName="@vendure/admin-ui" /> A React wrapper for the Clarity UI icon component. *Example* ```ts import { userIcon } from '@cds/core/icon'; import { CdsIcon } from '@vendure/admin-ui/react'; registerCdsIcon(userIcon); export function MyComponent() { return <CdsIcon icon={userIcon} badge="warning" solid size="lg"></CdsIcon>; } ``` ```ts title="Signature" function CdsIcon(props: { icon: IconShapeTuple; className?: string } & Partial<CdsIconProps>): void ``` Parameters ### props <MemberInfo kind="parameter" type={`{ icon: IconShapeTuple; className?: string } &#38; Partial&#60;CdsIconProps&#62;`} />
--- title: "FormField" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## FormField <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/react-components/FormField.tsx" sourceLine="22" packageName="@vendure/admin-ui" /> A wrapper around form fields which provides a label, tooltip and error message. *Example* ```ts import { FormField } from '@vendure/admin-ui/react'; export function MyReactComponent() { return ( <FormField label="My field" tooltip="This is a tooltip" invalid errorMessage="This field is invalid"> <input type="text" /> </FormField> ); } ``` ```ts title="Signature" function FormField(props: PropsWithChildren<{ for?: string; label?: string; tooltip?: string; invalid?: boolean; errorMessage?: string; }>): void ``` Parameters ### props <MemberInfo kind="parameter" type={`PropsWithChildren&#60;{ for?: string; label?: string; tooltip?: string; invalid?: boolean; errorMessage?: string; }&#62;`} />
--- title: "React Components" isDefaultIndex: true generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; import DocCardList from '@theme/DocCardList'; <DocCardList />
--- title: "Link" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## Link <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/react-components/Link.tsx" sourceLine="22" packageName="@vendure/admin-ui" /> A React component which renders an anchor tag and navigates to the specified route when clicked. This is useful when you want to use a React component in a Vendure UI plugin which navigates to a route in the admin-ui. *Example* ```ts import { Link } from '@vendure/admin-ui/react'; export const MyReactComponent = () => { return <Link href="/extensions/my-extension">Go to my extension</Link>; } ``` ```ts title="Signature" function Link(props: PropsWithChildren<{ href: string; [props: string]: any }>): void ``` Parameters ### props <MemberInfo kind="parameter" type={`PropsWithChildren&#60;{ href: string; [props: string]: any }&#62;`} />
--- title: "PageBlock" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## PageBlock <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/react-components/PageBlock.tsx" sourceLine="22" packageName="@vendure/admin-ui" /> A container for page content which provides a consistent width and spacing. *Example* ```ts import { PageBlock } from '@vendure/admin-ui/react'; export function MyComponent() { return ( <PageBlock> ... </PageBlock> ); } ``` ```ts title="Signature" function PageBlock(props: PropsWithChildren): void ``` Parameters ### props <MemberInfo kind="parameter" type={`PropsWithChildren`} />
--- title: "PageDetailLayout" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## PageDetailLayout <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/react-components/PageDetailLayout.tsx" sourceLine="22" packageName="@vendure/admin-ui" /> A responsive container for detail views with a main content area and an optional sidebar. *Example* ```ts import { PageDetailLayout } from '@vendure/admin-ui/react'; export function MyComponent() { return ( <PageDetailLayout sidebar={<div>Sidebar content</div>}> <div>Main content</div> </PageDetailLayout> ); } ``` ```ts title="Signature" function PageDetailLayout(props: PropsWithChildren<{ sidebar?: ReactNode }>): void ``` Parameters ### props <MemberInfo kind="parameter" type={`PropsWithChildren&#60;{ sidebar?: ReactNode }&#62;`} />
--- title: "RichTextEditor" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## RichTextEditor <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/react-components/RichTextEditor.tsx" sourceLine="59" packageName="@vendure/admin-ui" /> A rich text editor component which uses ProseMirror (rich text editor) under the hood. *Example* ```ts import { RichTextEditor } from '@vendure/admin-ui/react'; import React from 'react'; export function MyComponent() { const onSubmit = async (e: React.FormEvent) => { e.preventDefault(); const form = new FormData(e.target as HTMLFormElement); const content = form.get("content"); console.log(content); }; return ( <form className="w-full" onSubmit={onSubmit}> <RichTextEditor name="content" readOnly={false} onMount={(e) => console.log("Mounted", e)} /> <button type="submit" className="btn btn-primary"> Submit </button> </form> ); } ```
--- title: "React Extensions" isDefaultIndex: true generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; import DocCardList from '@theme/DocCardList'; <DocCardList />
--- title: "ReactCustomDetailComponentConfig" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## ReactCustomDetailComponentConfig <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/register-react-custom-detail-component.ts" sourceLine="15" packageName="@vendure/admin-ui" /> Configures a React-based component to be placed in a detail page in the given location. ```ts title="Signature" interface ReactCustomDetailComponentConfig { locationId: CustomDetailComponentLocationId; component: ElementType; props?: Record<string, any>; } ``` <div className="members-wrapper"> ### locationId <MemberInfo kind="property" type={`<a href='/reference/admin-ui-api/custom-detail-components/custom-detail-component-location-id#customdetailcomponentlocationid'>CustomDetailComponentLocationId</a>`} /> The id of the detail page location in which to place the component. ### component <MemberInfo kind="property" type={`ElementType`} /> The React component to render. ### props <MemberInfo kind="property" type={`Record&#60;string, any&#62;`} /> Optional props to pass to the React component. </div>
--- title: "ReactDataTableComponentConfig" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## ReactDataTableComponentConfig <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/register-react-data-table-component.ts" sourceLine="19" packageName="@vendure/admin-ui" /> Configures a <a href='/reference/admin-ui-api/custom-detail-components/custom-detail-component#customdetailcomponent'>CustomDetailComponent</a> to be placed in the given location. ```ts title="Signature" interface ReactDataTableComponentConfig { tableId: DataTableLocationId; columnId: DataTableColumnId; component: ElementType; props?: Record<string, any>; } ``` <div className="members-wrapper"> ### tableId <MemberInfo kind="property" type={`DataTableLocationId`} /> The location in the UI where the custom component should be placed. ### columnId <MemberInfo kind="property" type={`DataTableColumnId`} /> The column in the table where the custom component should be placed. ### component <MemberInfo kind="property" type={`ElementType`} /> The component to render in the table cell. This component will receive the `rowItem` prop which is the data object for the row, e.g. the `Product` object if used in the `product-list` table. ### props <MemberInfo kind="property" type={`Record&#60;string, any&#62;`} /> Optional props to pass to the React component. </div>
--- title: "RegisterReactCustomDetailComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## registerReactCustomDetailComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/register-react-custom-detail-component.ts" sourceLine="40" packageName="@vendure/admin-ui" /> Registers a React component to be rendered in a detail page in the given location. Components used as custom detail components can make use of the <a href='/reference/admin-ui-api/react-hooks/use-detail-component-data#usedetailcomponentdata'>useDetailComponentData</a> hook. ```ts title="Signature" function registerReactCustomDetailComponent(config: ReactCustomDetailComponentConfig): void ``` Parameters ### config <MemberInfo kind="parameter" type={`<a href='/reference/admin-ui-api/react-extensions/react-custom-detail-component-config#reactcustomdetailcomponentconfig'>ReactCustomDetailComponentConfig</a>`} />
--- title: "RegisterReactDataTableComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## registerReactDataTableComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/register-react-data-table-component.ts" sourceLine="90" packageName="@vendure/admin-ui" /> Registers a React component to be rendered in a data table in the given location. The component will receive the `rowItem` prop which is the data object for the row, e.g. the `Product` object if used in the `product-list` table. *Example* ```ts title="components/SlugWithLink.tsx" import { ReactDataTableComponentProps } from '@vendure/admin-ui/react'; import React from 'react'; export function SlugWithLink({ rowItem }: ReactDataTableComponentProps<{ slug: string }>) { return ( <a href={`https://example.com/products/${rowItem.slug}`} target="_blank"> {rowItem.slug} </a> ); } ``` ```ts title="providers.ts" import { registerReactDataTableComponent } from '@vendure/admin-ui/react'; import { SlugWithLink } from './components/SlugWithLink'; export default [ registerReactDataTableComponent({ component: SlugWithLink, tableId: 'product-list', columnId: 'slug', props: { foo: 'bar', }, }), ]; ``` ```ts title="Signature" function registerReactDataTableComponent(config: ReactDataTableComponentConfig): void ``` Parameters ### config <MemberInfo kind="parameter" type={`<a href='/reference/admin-ui-api/react-extensions/react-data-table-component-config#reactdatatablecomponentconfig'>ReactDataTableComponentConfig</a>`} />
--- title: "RegisterReactFormInputComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## registerReactFormInputComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/register-react-form-input-component.ts" sourceLine="15" packageName="@vendure/admin-ui" /> Registers a React component to be used as a <a href='/reference/admin-ui-api/custom-input-components/form-input-component#forminputcomponent'>FormInputComponent</a>. ```ts title="Signature" function registerReactFormInputComponent(id: string, component: ElementType): FactoryProvider ``` Parameters ### id <MemberInfo kind="parameter" type={`string`} /> ### component <MemberInfo kind="parameter" type={`ElementType`} />
--- title: "RegisterReactRouteComponentOptions" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## RegisterReactRouteComponentOptions <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/register-react-route-component.ts" sourceLine="15" packageName="@vendure/admin-ui" /> Configuration for a React-based route component. ```ts title="Signature" type RegisterReactRouteComponentOptions<Entity extends { id: string; updatedAt?: string }, T extends DocumentNode | TypedDocumentNode<any, { id: string }>, Field extends keyof ResultOf<T>, R extends Field> = RegisterRouteComponentOptions<ElementType, Entity, T, Field, R> & { props?: Record<string, any>; } ```
--- title: "RegisterReactRouteComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## registerReactRouteComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/register-react-route-component.ts" sourceLine="30" packageName="@vendure/admin-ui" /> Registers a React component to be used as a route component. ```ts title="Signature" function registerReactRouteComponent<Entity extends { id: string; updatedAt?: string }, T extends DocumentNode | TypedDocumentNode<any, { id: string }>, Field extends keyof ResultOf<T>, R extends Field>(options: RegisterReactRouteComponentOptions<Entity, T, Field, R>): Route ``` Parameters ### options <MemberInfo kind="parameter" type={`<a href='/reference/admin-ui-api/react-extensions/register-react-route-component-options#registerreactroutecomponentoptions'>RegisterReactRouteComponentOptions</a>&#60;Entity, T, Field, R&#62;`} />
--- title: "React Hooks" isDefaultIndex: true generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; import DocCardList from '@theme/DocCardList'; <DocCardList />
--- title: "UseDetailComponentData" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## useDetailComponentData <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/react-hooks/use-detail-component-data.ts" sourceLine="34" packageName="@vendure/admin-ui" /> Provides the data available to React-based CustomDetailComponents. *Example* ```ts import { Card, useDetailComponentData } from '@vendure/admin-ui/react'; import React from 'react'; export function CustomDetailComponent(props: any) { const { entity, detailForm } = useDetailComponentData(); const updateName = () => { detailForm.get('name')?.setValue('New name'); detailForm.markAsDirty(); }; return ( <Card title={'Custom Detail Component'}> <button className="button" onClick={updateName}> Update name </button> <pre>{JSON.stringify(entity, null, 2)}</pre> </Card> ); } ``` ```ts title="Signature" function useDetailComponentData<T = any>(): void ```
--- title: "UseFormControl" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## useFormControl <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/react-hooks/use-form-control.ts" sourceLine="31" packageName="@vendure/admin-ui" /> Provides access to the current FormControl value and a method to update the value. *Example* ```ts import { useFormControl, ReactFormInputProps } from '@vendure/admin-ui/react'; import React from 'react'; export function ReactNumberInput({ readonly }: ReactFormInputProps) { const { value, setFormValue } = useFormControl(); const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => { setFormValue(val); }; return ( <div> <input readOnly={readonly} type="number" onChange={handleChange} value={value} /> </div> ); } ``` ```ts title="Signature" function useFormControl(): void ```
--- title: "UseInjector" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## useInjector <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/react-hooks/use-injector.ts" sourceLine="27" packageName="@vendure/admin-ui" /> Exposes the Angular injector which allows the injection of services into React components. *Example* ```ts import { useInjector } from '@vendure/admin-ui/react'; import { NotificationService } from '@vendure/admin-ui/core'; export const MyComponent = () => { const notificationService = useInjector(NotificationService); const handleClick = () => { notificationService.success('Hello world!'); }; // ... return <div>...</div>; } ``` ```ts title="Signature" function useInjector<T = any>(token: ProviderToken<T>): T ``` Parameters ### token <MemberInfo kind="parameter" type={`ProviderToken&#60;T&#62;`} />
--- title: "UseLazyQuery" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## useLazyQuery <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/react-hooks/use-query.ts" sourceLine="113" packageName="@vendure/admin-ui" since="2.2.0" /> A React hook which allows you to execute a GraphQL query. *Example* ```ts import { useLazyQuery } from '@vendure/admin-ui/react'; import { gql } from 'graphql-tag'; const GET_PRODUCT = gql` query GetProduct($id: ID!) { product(id: $id) { id name description } }`; type ProductResponse = { product: { name: string description: string } } export const MyComponent = () => { const [getProduct, { data, loading, error }] = useLazyQuery<ProductResponse>(GET_PRODUCT); const handleClick = () => { getProduct({ id: '1', }).then(result => { // do something with the result }); }; if (loading) return <div>Loading...</div>; if (error) return <div>Error! { error }</div>; return ( <div> <button onClick={handleClick}>Get product</button> {data && ( <div> <h1>{data.product.name}</h1> <p>{data.product.description}</p> </div>)} </div> ); }; ``` ```ts title="Signature" function useLazyQuery<T, V extends Record<string, any> = Record<string, any>>(query: DocumentNode | TypedDocumentNode<T, V>): void ``` Parameters ### query <MemberInfo kind="parameter" type={`DocumentNode | TypedDocumentNode&#60;T, V&#62;`} />
--- title: "UseMutation" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## useMutation <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/react-hooks/use-query.ts" sourceLine="169" packageName="@vendure/admin-ui" /> A React hook which allows you to execute a GraphQL mutation. *Example* ```ts import { useMutation } from '@vendure/admin-ui/react'; import { gql } from 'graphql-tag'; const UPDATE_PRODUCT = gql` mutation UpdateProduct($input: UpdateProductInput!) { updateProduct(input: $input) { id name } }`; export const MyComponent = () => { const [updateProduct, { data, loading, error }] = useMutation(UPDATE_PRODUCT); const handleClick = () => { updateProduct({ input: { id: '1', name: 'New name', }, }).then(result => { // do something with the result }); }; if (loading) return <div>Loading...</div>; if (error) return <div>Error! { error }</div>; return ( <div> <button onClick={handleClick}>Update product</button> {data && <div>Product updated!</div>} </div> ); }; ``` ```ts title="Signature" function useMutation<T, V extends Record<string, any> = Record<string, any>>(mutation: DocumentNode | TypedDocumentNode<T, V>): void ``` Parameters ### mutation <MemberInfo kind="parameter" type={`DocumentNode | TypedDocumentNode&#60;T, V&#62;`} />
--- title: "UsePageMetadata" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## usePageMetadata <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/react-hooks/use-page-metadata.ts" sourceLine="31" packageName="@vendure/admin-ui" /> Provides functions for setting the current page title and breadcrumb. *Example* ```ts import { usePageMetadata } from '@vendure/admin-ui/react'; import { useEffect } from 'react'; export const MyComponent = () => { const { setTitle, setBreadcrumb } = usePageMetadata(); useEffect(() => { setTitle('My Page'); setBreadcrumb([ { link: ['./parent'], label: 'Parent Page' }, { link: ['./'], label: 'This Page' }, ]); }, []); // ... return <div>...</div>; } ``` ```ts title="Signature" function usePageMetadata(): void ```
--- title: "UseQuery" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## useQuery <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/react-hooks/use-query.ts" sourceLine="43" packageName="@vendure/admin-ui" /> A React hook which provides access to the results of a GraphQL query. *Example* ```ts import { useQuery } from '@vendure/admin-ui/react'; import { gql } from 'graphql-tag'; const GET_PRODUCT = gql` query GetProduct($id: ID!) { product(id: $id) { id name description } }`; export const MyComponent = () => { const { data, loading, error } = useQuery(GET_PRODUCT, { id: '1' }); if (loading) return <div>Loading...</div>; if (error) return <div>Error! { error }</div>; return ( <div> <h1>{data.product.name}</h1> <p>{data.product.description}</p> </div> ); }; ``` ```ts title="Signature" function useQuery<T, V extends Record<string, any> = Record<string, any>>(query: DocumentNode | TypedDocumentNode<T, V>, variables?: V): void ``` Parameters ### query <MemberInfo kind="parameter" type={`DocumentNode | TypedDocumentNode&#60;T, V&#62;`} /> ### variables <MemberInfo kind="parameter" type={`V`} />
--- title: "UseRichTextEditor" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## useRichTextEditor <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/react-hooks/use-rich-text-editor.ts" sourceLine="40" packageName="@vendure/admin-ui" /> Provides access to the ProseMirror (rich text editor) instance. *Example* ```ts import { useRichTextEditor } from '@vendure/admin-ui/react'; import React from 'react'; export function Component() { const { ref, editor } = useRichTextEditor({ attributes: { class: '' }, onTextInput: (text) => console.log(text), isReadOnly: () => false, }); return <div className="w-full" ref={ref} /> } ```
--- title: "UseRouteParams" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## useRouteParams <GenerationInfo sourceFile="packages/admin-ui/src/lib/react/src/react-hooks/use-route-params.ts" sourceLine="23" packageName="@vendure/admin-ui" /> Provides access to the current route params and query params. *Example* ```ts import { useRouteParams } from '@vendure/admin-ui/react'; import React from 'react'; export function MyComponent() { const { params, queryParams } = useRouteParams(); // ... return <div>{ params.id }</div>; } ``` ```ts title="Signature" function useRouteParams(): void ```
--- title: "Routes" isDefaultIndex: true generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; import DocCardList from '@theme/DocCardList'; <DocCardList />
--- title: "RegisterRouteComponentOptions" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## RegisterRouteComponentOptions <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/extension/register-route-component.ts" sourceLine="19" packageName="@vendure/admin-ui" /> Configuration for a route component. ```ts title="Signature" type RegisterRouteComponentOptions<Component extends any | BaseDetailComponent<Entity>, Entity extends { id: string; updatedAt?: string }, T extends DocumentNode | TypedDocumentNode<any, { id: string }>, Field extends keyof ResultOf<T>, R extends Field> = { component: Type<Component> | Component; title?: string; breadcrumb?: BreadcrumbValue; path?: string; query?: T; getBreadcrumbs?: (entity: Exclude<ResultOf<T>[R], 'Query'>) => BreadcrumbValue; entityKey?: Component extends BaseDetailComponent<any> ? R : string; variables?: T extends TypedDocumentNode<any, infer V> ? Omit<V, 'id'> : never; routeConfig?: Route; } & (Component extends BaseDetailComponent<any> ? { entityKey: R } : unknown) ```
--- title: "RegisterRouteComponent" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## registerRouteComponent <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/extension/register-route-component.ts" sourceLine="77" packageName="@vendure/admin-ui" /> Registers an Angular standalone component to be rendered in a route. *Example* ```ts title="routes.ts" import { registerRouteComponent } from '@vendure/admin-ui/core'; import { registerReactRouteComponent } from '@vendure/admin-ui/react'; import { ProductReviewDetailComponent } from './components/product-review-detail/product-review-detail.component'; import { AllProductReviewsList } from './components/all-product-reviews-list/all-product-reviews-list.component'; import { GetReviewDetailDocument } from './generated-types'; export default [ registerRouteComponent({ path: '', component: AllProductReviewsList, breadcrumb: 'Product reviews', }), registerRouteComponent({ path: ':id', component: ProductReviewDetailComponent, query: GetReviewDetailDocument, entityKey: 'productReview', getBreadcrumbs: entity => [ { label: 'Product reviews', link: ['/extensions', 'product-reviews'], }, { label: `#${entity?.id} (${entity?.product.name})`, link: [], }, ], }), ]; ``` ```ts title="Signature" function registerRouteComponent<Component extends any | BaseDetailComponent<Entity>, Entity extends { id: string; updatedAt?: string }, T extends DocumentNode | TypedDocumentNode<any, { id: string }>, Field extends keyof ResultOf<T>, R extends Field>(options: RegisterRouteComponentOptions<Component, Entity, T, Field, R>): void ``` Parameters ### options <MemberInfo kind="parameter" type={`<a href='/reference/admin-ui-api/routes/register-route-component-options#registerroutecomponentoptions'>RegisterRouteComponentOptions</a>&#60;Component, Entity, T, Field, R&#62;`} />
--- title: "DataService" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## DataService <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/data/providers/data.service.ts" sourceLine="33" packageName="@vendure/admin-ui" /> Used to interact with the Admin API via GraphQL queries. Internally this service uses the Apollo Client, which means it maintains a normalized entity cache. For this reason, it is advisable to always select the `id` field of any entity, which will allow the returned data to be effectively cached. ```ts title="Signature" class DataService { query(query: DocumentNode | TypedDocumentNode<T, V>, variables?: V, fetchPolicy: WatchQueryFetchPolicy = 'cache-and-network') => QueryResult<T, V>; mutate(mutation: DocumentNode | TypedDocumentNode<T, V>, variables?: V, update?: MutationUpdaterFn<T>) => Observable<T>; } ``` <div className="members-wrapper"> ### query <MemberInfo kind="method" type={`(query: DocumentNode | TypedDocumentNode&#60;T, V&#62;, variables?: V, fetchPolicy: WatchQueryFetchPolicy = 'cache-and-network') => <a href='/reference/admin-ui-api/services/data-service#queryresult'>QueryResult</a>&#60;T, V&#62;`} /> Perform a GraphQL query. Returns a <a href='/reference/admin-ui-api/services/data-service#queryresult'>QueryResult</a> which allows further control over they type of result returned, e.g. stream of values, single value etc. *Example* ```ts const result$ = this.dataService.query(gql` query MyQuery($id: ID!) { product(id: $id) { id name slug } }, { id: 123 }, ).mapSingle(data => data.product); ``` ### mutate <MemberInfo kind="method" type={`(mutation: DocumentNode | TypedDocumentNode&#60;T, V&#62;, variables?: V, update?: MutationUpdaterFn&#60;T&#62;) => Observable&#60;T&#62;`} /> Perform a GraphQL mutation. *Example* ```ts const result$ = this.dataService.mutate(gql` mutation MyMutation($Codegen.UpdateEntityInput!) { updateEntity(input: $input) { id name } }, { Codegen.updateEntityInput }, ); ``` </div> ## QueryResult <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/data/query-result.ts" sourceLine="19" packageName="@vendure/admin-ui" /> This class wraps the Apollo Angular QueryRef object and exposes some getters for convenience. ```ts title="Signature" class QueryResult<T, V extends Record<string, any> = Record<string, any>> { constructor(queryRef: QueryRef<T, V>, apollo: Apollo) completed$ = new Subject<void>(); refetchOnChannelChange() => QueryResult<T, V>; single$: Observable<T> stream$: Observable<T> ref: QueryRef<T, V> mapSingle(mapFn: (item: T) => R) => Observable<R>; mapStream(mapFn: (item: T) => R) => Observable<R>; } ``` <div className="members-wrapper"> ### constructor <MemberInfo kind="method" type={`(queryRef: QueryRef&#60;T, V&#62;, apollo: Apollo) => QueryResult`} /> ### completed$ <MemberInfo kind="property" type={``} /> ### refetchOnChannelChange <MemberInfo kind="method" type={`() => <a href='/reference/admin-ui-api/services/data-service#queryresult'>QueryResult</a>&#60;T, V&#62;`} /> Re-fetch this query whenever the active Channel changes. ### single$ <MemberInfo kind="property" type={`Observable&#60;T&#62;`} /> Returns an Observable which emits a single result and then completes. ### stream$ <MemberInfo kind="property" type={`Observable&#60;T&#62;`} /> Returns an Observable which emits until unsubscribed. ### ref <MemberInfo kind="property" type={`QueryRef&#60;T, V&#62;`} /> ### mapSingle <MemberInfo kind="method" type={`(mapFn: (item: T) =&#62; R) => Observable&#60;R&#62;`} /> Returns a single-result Observable after applying the map function. ### mapStream <MemberInfo kind="method" type={`(mapFn: (item: T) =&#62; R) => Observable&#60;R&#62;`} /> Returns a multiple-result Observable after applying the map function. </div>
--- title: "Services" isDefaultIndex: true generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; import DocCardList from '@theme/DocCardList'; <DocCardList />
--- title: "ModalService" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## ModalService <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/modal/modal.service.ts" sourceLine="21" packageName="@vendure/admin-ui" /> This service is responsible for instantiating a ModalDialog component and embedding the specified component within. ```ts title="Signature" class ModalService { constructor(overlayHostService: OverlayHostService) fromComponent(component: Type<T> & Type<Dialog<R>>, options?: ModalOptions<T>) => Observable<R | undefined>; dialog(config: DialogConfig<T>) => Observable<T | undefined>; } ``` <div className="members-wrapper"> ### constructor <MemberInfo kind="method" type={`(overlayHostService: OverlayHostService) => ModalService`} /> ### fromComponent <MemberInfo kind="method" type={`(component: Type&#60;T&#62; &#38; Type&#60;<a href='/reference/admin-ui-api/services/modal-service#dialog'>Dialog</a>&#60;R&#62;&#62;, options?: <a href='/reference/admin-ui-api/services/modal-service#modaloptions'>ModalOptions</a>&#60;T&#62;) => Observable&#60;R | undefined&#62;`} /> Create a modal from a component. The component must implement the <a href='/reference/admin-ui-api/services/modal-service#dialog'>Dialog</a> interface. Additionally, the component should include templates for the title and the buttons to be displayed in the modal dialog. See example: *Example* ```ts class MyDialog implements Dialog { resolveWith: (result?: any) => void; okay() { doSomeWork().subscribe(result => { this.resolveWith(result); }) } cancel() { this.resolveWith(false); } } ``` *Example* ```html <ng-template vdrDialogTitle>Title of the modal</ng-template> <p> My Content </p> <ng-template vdrDialogButtons> <button type="button" class="btn" (click)="cancel()">Cancel</button> <button type="button" class="btn btn-primary" (click)="okay()">Okay</button> </ng-template> ``` ### dialog <MemberInfo kind="method" type={`(config: <a href='/reference/admin-ui-api/services/modal-service#dialogconfig'>DialogConfig</a>&#60;T&#62;) => Observable&#60;T | undefined&#62;`} /> Displays a modal dialog with the provided title, body and buttons. </div> ## Dialog <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/modal/modal.types.ts" sourceLine="9" packageName="@vendure/admin-ui" /> Any component intended to be used with the ModalService.fromComponent() method must implement this interface. ```ts title="Signature" interface Dialog<R = any> { resolveWith: (result?: R) => void; } ``` <div className="members-wrapper"> ### resolveWith <MemberInfo kind="property" type={`(result?: R) =&#62; void`} /> Function to be invoked in order to close the dialog when the action is complete. The Observable returned from the .fromComponent() method will emit the value passed to this method and then complete. </div> ## DialogConfig <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/modal/modal.types.ts" sourceLine="33" packageName="@vendure/admin-ui" /> Configures a generic modal dialog. ```ts title="Signature" interface DialogConfig<T> { title: string; body?: string; translationVars?: { [key: string]: string | number }; buttons: Array<DialogButtonConfig<T>>; size?: 'sm' | 'md' | 'lg' | 'xl'; } ``` <div className="members-wrapper"> ### title <MemberInfo kind="property" type={`string`} /> ### body <MemberInfo kind="property" type={`string`} /> ### translationVars <MemberInfo kind="property" type={`{ [key: string]: string | number }`} /> ### buttons <MemberInfo kind="property" type={`Array&#60;DialogButtonConfig&#60;T&#62;&#62;`} /> ### size <MemberInfo kind="property" type={`'sm' | 'md' | 'lg' | 'xl'`} /> </div> ## ModalOptions <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/modal/modal.types.ts" sourceLine="48" packageName="@vendure/admin-ui" /> Options to configure the behaviour of the modal. ```ts title="Signature" interface ModalOptions<T> { size?: 'sm' | 'md' | 'lg' | 'xl'; verticalAlign?: 'top' | 'center' | 'bottom'; closable?: boolean; locals?: Partial<T>; } ``` <div className="members-wrapper"> ### size <MemberInfo kind="property" type={`'sm' | 'md' | 'lg' | 'xl'`} /> Sets the width of the dialog ### verticalAlign <MemberInfo kind="property" type={`'top' | 'center' | 'bottom'`} /> Sets the vertical alignment of the dialog ### closable <MemberInfo kind="property" type={`boolean`} /> When true, the "x" icon is shown and clicking it or the mask will close the dialog ### locals <MemberInfo kind="property" type={`Partial&#60;T&#62;`} /> Values to be passed directly to the component being instantiated inside the dialog. </div>
--- title: "NotificationService" isDefaultIndex: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription'; ## NotificationService <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/notification/notification.service.ts" sourceLine="54" packageName="@vendure/admin-ui" /> Provides toast notification functionality. *Example* ```ts class MyComponent { constructor(private notificationService: NotificationService) {} save() { this.notificationService .success(_('asset.notify-create-assets-success'), { count: successCount, }); } } ```ts title="Signature" class NotificationService { constructor(i18nService: I18nService, resolver: ComponentFactoryResolver, overlayHostService: OverlayHostService) success(message: string, translationVars?: { [key: string]: string | number }) => void; info(message: string, translationVars?: { [key: string]: string | number }) => void; warning(message: string, translationVars?: { [key: string]: string | number }) => void; error(message: string, translationVars?: { [key: string]: string | number }) => void; notify(config: ToastConfig) => void; } ``` <div className="members-wrapper"> ### constructor <MemberInfo kind="method" type={`(i18nService: <a href='/reference/typescript-api/common/i18n-service#i18nservice'>I18nService</a>, resolver: ComponentFactoryResolver, overlayHostService: OverlayHostService) => NotificationService`} /> ### success <MemberInfo kind="method" type={`(message: string, translationVars?: { [key: string]: string | number }) => void`} /> Display a success toast notification ### info <MemberInfo kind="method" type={`(message: string, translationVars?: { [key: string]: string | number }) => void`} /> Display an info toast notification ### warning <MemberInfo kind="method" type={`(message: string, translationVars?: { [key: string]: string | number }) => void`} /> Display a warning toast notification ### error <MemberInfo kind="method" type={`(message: string, translationVars?: { [key: string]: string | number }) => void`} /> Display an error toast notification ### notify <MemberInfo kind="method" type={`(config: <a href='/reference/admin-ui-api/services/notification-service#toastconfig'>ToastConfig</a>) => void`} /> Display a toast notification. </div> ## NotificationType <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/notification/notification.service.ts" sourceLine="14" packageName="@vendure/admin-ui" /> The types of notification available. ```ts title="Signature" type NotificationType = 'info' | 'success' | 'error' | 'warning' ``` ## ToastConfig <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/notification/notification.service.ts" sourceLine="23" packageName="@vendure/admin-ui" /> Configuration for a toast notification. ```ts title="Signature" interface ToastConfig { message: string; translationVars?: { [key: string]: string | number }; type?: NotificationType; duration?: number; } ``` <div className="members-wrapper"> ### message <MemberInfo kind="property" type={`string`} /> ### translationVars <MemberInfo kind="property" type={`{ [key: string]: string | number }`} /> ### type <MemberInfo kind="property" type={`<a href='/reference/admin-ui-api/services/notification-service#notificationtype'>NotificationType</a>`} /> ### duration <MemberInfo kind="property" type={`number`} /> </div>
--- title: "Tabs" weight: 10 date: 2023-07-14T16:57:51.138Z showtoc: false generated: true --- <!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script --> # tabs