@vendure/admin-ui 2.1.0-next.3 → 2.1.0-next.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/catalog/components/product-variant-list/product-variant-list-bulk-actions.d.ts +1 -2
  2. package/core/common/base-detail.component.d.ts +2 -2
  3. package/core/common/base-entity-resolver.d.ts +1 -1
  4. package/core/common/version.d.ts +1 -1
  5. package/core/components/base-nav/base-nav.component.d.ts +4 -2
  6. package/core/data/providers/data.service.d.ts +3 -3
  7. package/core/data/query-result.d.ts +1 -1
  8. package/core/extension/add-action-bar-item.d.ts +8 -15
  9. package/core/extension/add-nav-menu-item.d.ts +15 -23
  10. package/core/extension/register-bulk-action.d.ts +24 -28
  11. package/core/extension/register-custom-detail-component.d.ts +45 -0
  12. package/core/extension/register-data-table-component.d.ts +3 -2
  13. package/core/extension/register-form-input-component.d.ts +14 -13
  14. package/core/extension/register-history-entry-component.d.ts +55 -0
  15. package/core/extension/register-page-tab.d.ts +23 -0
  16. package/core/extension/register-route-component.d.ts +48 -2
  17. package/core/providers/bulk-action-registry/bulk-action-types.d.ts +2 -2
  18. package/core/providers/modal/modal.service.d.ts +1 -1
  19. package/core/providers/modal/modal.types.d.ts +3 -3
  20. package/core/providers/nav-builder/nav-builder-types.d.ts +29 -4
  21. package/core/providers/nav-builder/nav-builder.service.d.ts +3 -2
  22. package/core/providers/notification/notification.service.d.ts +4 -4
  23. package/core/providers/page/page.service.d.ts +1 -23
  24. package/core/public_api.d.ts +1 -0
  25. package/core/shared/components/action-bar-items/action-bar-items.component.d.ts +8 -3
  26. package/core/shared/components/asset-picker-dialog/asset-picker-dialog.component.d.ts +1 -1
  27. package/core/shared/components/asset-preview/asset-preview.component.d.ts +9 -1
  28. package/core/shared/components/asset-preview-dialog/asset-preview-dialog.component.d.ts +2 -0
  29. package/core/shared/components/data-table-2/data-table2.component.d.ts +1 -1
  30. package/core/shared/components/extension-host/host-external-frame.d.ts +1 -1
  31. package/core/shared/components/facet-value-selector/facet-value-selector.component.d.ts +1 -1
  32. package/core/shared/pipes/duration.pipe.d.ts +1 -1
  33. package/core/shared/pipes/file-size.pipe.d.ts +1 -1
  34. package/esm2022/catalog/components/asset-detail/asset-detail.component.mjs +1 -1
  35. package/esm2022/catalog/components/assets/assets.component.mjs +2 -2
  36. package/esm2022/catalog/components/create-product-variant-dialog/create-product-variant-dialog.component.mjs +1 -1
  37. package/esm2022/catalog/components/product-variant-list/product-variant-list-bulk-actions.mjs +1 -1
  38. package/esm2022/core/common/base-detail.component.mjs +3 -3
  39. package/esm2022/core/common/base-entity-resolver.mjs +3 -3
  40. package/esm2022/core/common/utilities/custom-field-default-value.mjs +3 -3
  41. package/esm2022/core/common/version.mjs +2 -2
  42. package/esm2022/core/components/base-nav/base-nav.component.mjs +17 -5
  43. package/esm2022/core/data/providers/data.service.mjs +4 -4
  44. package/esm2022/core/data/query-result.mjs +2 -2
  45. package/esm2022/core/extension/add-action-bar-item.mjs +9 -16
  46. package/esm2022/core/extension/add-nav-menu-item.mjs +16 -24
  47. package/esm2022/core/extension/register-bulk-action.mjs +25 -29
  48. package/esm2022/core/extension/register-custom-detail-component.mjs +46 -1
  49. package/esm2022/core/extension/register-data-table-component.mjs +4 -3
  50. package/esm2022/core/extension/register-form-input-component.mjs +15 -14
  51. package/esm2022/core/extension/register-history-entry-component.mjs +56 -1
  52. package/esm2022/core/extension/register-page-tab.mjs +36 -0
  53. package/esm2022/core/extension/register-route-component.mjs +44 -3
  54. package/esm2022/core/providers/bulk-action-registry/bulk-action-types.mjs +1 -1
  55. package/esm2022/core/providers/modal/modal.service.mjs +2 -2
  56. package/esm2022/core/providers/modal/modal.types.mjs +1 -1
  57. package/esm2022/core/providers/nav-builder/nav-builder-types.mjs +1 -1
  58. package/esm2022/core/providers/nav-builder/nav-builder.service.mjs +3 -3
  59. package/esm2022/core/providers/notification/notification.service.mjs +3 -3
  60. package/esm2022/core/providers/page/page.service.mjs +2 -36
  61. package/esm2022/core/public_api.mjs +2 -1
  62. package/esm2022/core/shared/components/action-bar/action-bar.component.mjs +2 -2
  63. package/esm2022/core/shared/components/action-bar-items/action-bar-items.component.mjs +32 -15
  64. package/esm2022/core/shared/components/asset-gallery/asset-gallery.component.mjs +2 -2
  65. package/esm2022/core/shared/components/asset-picker-dialog/asset-picker-dialog.component.mjs +2 -2
  66. package/esm2022/core/shared/components/asset-preview/asset-preview.component.mjs +36 -3
  67. package/esm2022/core/shared/components/asset-preview-dialog/asset-preview-dialog.component.mjs +4 -3
  68. package/esm2022/core/shared/components/data-table-2/data-table2.component.mjs +2 -2
  69. package/esm2022/core/shared/components/data-table-filters/data-table-filters.component.mjs +1 -1
  70. package/esm2022/core/shared/components/extension-host/host-external-frame.mjs +2 -2
  71. package/esm2022/core/shared/components/facet-value-selector/facet-value-selector.component.mjs +2 -2
  72. package/esm2022/core/shared/components/form-field/form-field.component.mjs +2 -2
  73. package/esm2022/core/shared/components/page-detail-layout/page-detail-layout.component.mjs +2 -2
  74. package/esm2022/core/shared/pipes/duration.pipe.mjs +2 -2
  75. package/esm2022/core/shared/pipes/file-size.pipe.mjs +2 -2
  76. package/esm2022/react/components/react-custom-column.component.mjs +3 -3
  77. package/esm2022/react/components/react-custom-detail.component.mjs +3 -3
  78. package/esm2022/react/components/react-form-input.component.mjs +3 -3
  79. package/esm2022/react/components/react-route.component.mjs +3 -3
  80. package/esm2022/react/public_api.mjs +7 -1
  81. package/esm2022/react/react-components/ActionBar.mjs +26 -0
  82. package/esm2022/react/react-components/CdsIcon.mjs +30 -0
  83. package/esm2022/react/react-components/FormField.mjs +28 -0
  84. package/esm2022/react/react-components/PageBlock.mjs +24 -0
  85. package/esm2022/react/react-components/PageDetailLayout.mjs +26 -0
  86. package/esm2022/react/react-hooks/use-detail-component-data.mjs +1 -1
  87. package/esm2022/react/react-hooks/use-route-params.mjs +39 -0
  88. package/esm2022/react/register-react-data-table-component.mjs +3 -1
  89. package/esm2022/react/register-react-route-component.mjs +1 -1
  90. package/esm2022/settings/components/tax-category-list/tax-category-list-bulk-actions.mjs +1 -1
  91. package/fesm2022/vendure-admin-ui-catalog.mjs +2 -2
  92. package/fesm2022/vendure-admin-ui-catalog.mjs.map +1 -1
  93. package/fesm2022/vendure-admin-ui-core.mjs +350 -164
  94. package/fesm2022/vendure-admin-ui-core.mjs.map +1 -1
  95. package/fesm2022/vendure-admin-ui-react.mjs +178 -11
  96. package/fesm2022/vendure-admin-ui-react.mjs.map +1 -1
  97. package/fesm2022/vendure-admin-ui-settings.mjs.map +1 -1
  98. package/package.json +19 -19
  99. package/react/public_api.d.ts +6 -0
  100. package/react/react-components/ActionBar.d.ts +23 -0
  101. package/react/react-components/CdsIcon.d.ts +45 -0
  102. package/react/react-components/FormField.d.ts +27 -0
  103. package/react/react-components/PageBlock.d.ts +21 -0
  104. package/react/react-components/PageDetailLayout.d.ts +23 -0
  105. package/react/react-hooks/use-detail-component-data.d.ts +2 -2
  106. package/react/react-hooks/use-route-params.d.ts +22 -0
  107. package/react/register-react-data-table-component.d.ts +2 -0
  108. package/react/register-react-route-component.d.ts +6 -0
@@ -1,5 +1,4 @@
1
- import { BulkAction, GetProductVariantListQuery, ItemOf } from '@vendure/admin-ui/core';
2
- import { ProductVariant } from 'package/core';
1
+ import { BulkAction, GetProductVariantListQuery, ItemOf, ProductVariant } from '@vendure/admin-ui/core';
3
2
  import { ProductVariantListComponent } from './product-variant-list.component';
4
3
  export declare const assignProductVariantsToChannelBulkAction: BulkAction<ItemOf<GetProductVariantListQuery, 'productVariants'>, ProductVariantListComponent>;
5
4
  export declare const removeProductVariantsFromChannelBulkAction: BulkAction<any, import("@vendure/admin-ui/core").BaseListComponent<any, any, any>>;
@@ -15,7 +15,7 @@ import { TranslationOf } from './utilities/find-translation';
15
15
  * {@link BaseEntityResolver}.
16
16
  *
17
17
  * @example
18
- * ```TypeScript
18
+ * ```ts
19
19
  * \@Component({
20
20
  * selector: 'app-my-entity',
21
21
  * templateUrl: './my-entity.component.html',
@@ -95,7 +95,7 @@ export declare abstract class TypedBaseDetailComponent<T extends TypedDocumentNo
95
95
  * correct resolved detail data.
96
96
  *
97
97
  * @example
98
- * ```TypeScript
98
+ * ```ts
99
99
  * \@NgModule({
100
100
  * imports: [ReviewsSharedModule],
101
101
  * declarations: [/* ... *\/],
@@ -12,7 +12,7 @@ export declare function createResolveData<T extends BaseEntityResolver<R>, R>(re
12
12
  * {@link BaseDetailComponent}.
13
13
  *
14
14
  * @example
15
- * ```TypeScript
15
+ * ```ts
16
16
  * \@Injectable({
17
17
  * providedIn: 'root',
18
18
  * })
@@ -1 +1 @@
1
- export declare const ADMIN_UI_VERSION = "2.1.0-next.3";
1
+ export declare const ADMIN_UI_VERSION = "2.1.0-next.5";
@@ -1,4 +1,4 @@
1
- import { OnDestroy, OnInit } from '@angular/core';
1
+ import { Injector, OnDestroy, OnInit } from '@angular/core';
2
2
  import { ActivatedRoute, Router } from '@angular/router';
3
3
  import { DataService } from '../../data/providers/data.service';
4
4
  import { HealthCheckService } from '../../providers/health-check/health-check.service';
@@ -13,7 +13,8 @@ export declare class BaseNavComponent implements OnInit, OnDestroy {
13
13
  protected healthCheckService: HealthCheckService;
14
14
  protected jobQueueService: JobQueueService;
15
15
  protected dataService: DataService;
16
- constructor(route: ActivatedRoute, router: Router, navBuilderService: NavBuilderService, healthCheckService: HealthCheckService, jobQueueService: JobQueueService, dataService: DataService);
16
+ protected injector: Injector;
17
+ constructor(route: ActivatedRoute, router: Router, navBuilderService: NavBuilderService, healthCheckService: HealthCheckService, jobQueueService: JobQueueService, dataService: DataService, injector: Injector);
17
18
  private userPermissions;
18
19
  private subscription;
19
20
  shouldDisplayLink(menuItem: Pick<NavMenuItem, 'requiresPermission'>): boolean | undefined;
@@ -21,6 +22,7 @@ export declare class BaseNavComponent implements OnInit, OnDestroy {
21
22
  ngOnDestroy(): void;
22
23
  getRouterLink(item: NavMenuItem): string[] | null;
23
24
  private defineNavMenu;
25
+ private createContext;
24
26
  static ɵfac: i0.ɵɵFactoryDeclaration<BaseNavComponent, never>;
25
27
  static ɵdir: i0.ɵɵDirectiveDeclaration<BaseNavComponent, "[vdrBaseNav]", never, {}, {}, never, never, false, never>;
26
28
  }
@@ -23,7 +23,7 @@ import * as i0 from "@angular/core";
23
23
  * advisable to always select the `id` field of any entity, which will allow the returned data
24
24
  * to be effectively cached.
25
25
  *
26
- * @docsCategory providers
26
+ * @docsCategory services
27
27
  * @docsPage DataService
28
28
  * @docsWeight 0
29
29
  */
@@ -48,7 +48,7 @@ export declare class DataService {
48
48
  * they type of result returned, e.g. stream of values, single value etc.
49
49
  *
50
50
  * @example
51
- * ```TypeScript
51
+ * ```ts
52
52
  * const result$ = this.dataService.query(gql`
53
53
  * query MyQuery($id: ID!) {
54
54
  * product(id: $id) {
@@ -67,7 +67,7 @@ export declare class DataService {
67
67
  * Perform a GraphQL mutation.
68
68
  *
69
69
  * @example
70
- * ```TypeScript
70
+ * ```ts
71
71
  * const result$ = this.dataService.mutate(gql`
72
72
  * mutation MyMutation($Codegen.UpdateEntityInput!) {
73
73
  * updateEntity(input: $input) {
@@ -5,7 +5,7 @@ import { Observable, Subject } from 'rxjs';
5
5
  * This class wraps the Apollo Angular QueryRef object and exposes some getters
6
6
  * for convenience.
7
7
  *
8
- * @docsCategory providers
8
+ * @docsCategory services
9
9
  * @docsPage DataService
10
10
  */
11
11
  export declare class QueryResult<T, V extends Record<string, any> = Record<string, any>> {
@@ -3,25 +3,18 @@ import { ActionBarItem } from '../providers/nav-builder/nav-builder-types';
3
3
  /**
4
4
  * @description
5
5
  * Adds a button to the ActionBar at the top right of each list or detail view. The locationId can
6
- * be determined by inspecting the DOM and finding the <vdr-action-bar> element and its
7
- * `data-location-id` attribute.
8
- *
9
- * This should be used in the NgModule `providers` array of your ui extension module.
6
+ * be determined by pressing `ctrl + u` when running the Admin UI in dev mode.
10
7
  *
11
8
  * @example
12
- * ```TypeScript
13
- * \@NgModule({
14
- * imports: [SharedModule],
15
- * providers: [
9
+ * ```ts title="providers.ts"
10
+ * export default [
16
11
  * addActionBarItem({
17
- * id: 'print-invoice'
18
- * label: 'Print Invoice',
19
- * locationId: 'order-detail',
20
- * routerLink: ['/extensions/invoicing'],
12
+ * id: 'print-invoice',
13
+ * label: 'Print Invoice',
14
+ * locationId: 'order-detail',
15
+ * routerLink: ['/extensions/invoicing'],
21
16
  * }),
22
- * ],
23
- * })
24
- * export class MyUiExtensionModule {}
17
+ * ];
25
18
  * ```
26
19
  * @docsCategory action-bar
27
20
  */
@@ -9,21 +9,17 @@ import { NavMenuItem, NavMenuSection } from '../providers/nav-builder/nav-builde
9
9
  * This should be used in the NgModule `providers` array of your ui extension module.
10
10
  *
11
11
  * @example
12
- * ```TypeScript
13
- * \@NgModule({
14
- * imports: [SharedModule],
15
- * providers: [
12
+ * ```ts title="providers.ts"
13
+ * export default [
16
14
  * addNavMenuSection({
17
- * id: 'reports',
18
- * label: 'Reports',
19
- * items: [{
20
- * // ...
21
- * }],
15
+ * id: 'reports',
16
+ * label: 'Reports',
17
+ * items: [{
18
+ * // ...
19
+ * }],
22
20
  * },
23
21
  * 'settings'),
24
- * ],
25
- * })
26
- * export class MyUiExtensionModule {}
22
+ * ];
27
23
  * ```
28
24
  * @docsCategory nav-menu
29
25
  */
@@ -39,20 +35,16 @@ export declare function addNavMenuSection(config: NavMenuSection, before?: strin
39
35
  * This should be used in the NgModule `providers` array of your ui extension module.
40
36
  *
41
37
  * @example
42
- * ```TypeScript
43
- * \@NgModule({
44
- * imports: [SharedModule],
45
- * providers: [
38
+ * ```ts title="providers.ts"
39
+ * export default [
46
40
  * addNavMenuItem({
47
- * id: 'reviews',
48
- * label: 'Product Reviews',
49
- * routerLink: ['/extensions/reviews'],
50
- * icon: 'star',
41
+ * id: 'reviews',
42
+ * label: 'Product Reviews',
43
+ * routerLink: ['/extensions/reviews'],
44
+ * icon: 'star',
51
45
  * },
52
46
  * 'marketing'),
53
- * ],
54
- * })
55
- * export class MyUiExtensionModule {}
47
+ * ];
56
48
  * ``
57
49
  *
58
50
  * @docsCategory nav-menu
@@ -13,39 +13,35 @@ import { BulkAction } from '../providers/bulk-action-registry/bulk-action-types'
13
13
  * translation via a custom service which integrates with the translation service's API.
14
14
  *
15
15
  * @example
16
- * ```TypeScript
17
- * import { NgModule } from '\@angular/core';
16
+ * ```ts title="providers.ts"
18
17
  * import { ModalService, registerBulkAction, SharedModule } from '\@vendure/admin-ui/core';
18
+ * import { ProductDataTranslationService } from './product-data-translation.service';
19
19
  *
20
- * \@NgModule({
21
- * imports: [SharedModule],
22
- * providers: [
20
+ * export default [
23
21
  * ProductDataTranslationService,
24
22
  * registerBulkAction({
25
- * location: 'product-list',
26
- * label: 'Send to translation service',
27
- * icon: 'language',
28
- * onClick: ({ injector, selection }) => {
29
- * const modalService = injector.get(ModalService);
30
- * const translationService = injector.get(ProductDataTranslationService);
31
- * modalService
32
- * .dialog({
33
- * title: `Send ${selection.length} products for translation?`,
34
- * buttons: [
35
- * { type: 'secondary', label: 'cancel' },
36
- * { type: 'primary', label: 'send', returnValue: true },
37
- * ],
38
- * })
39
- * .subscribe(response => {
40
- * if (response) {
41
- * translationService.sendForTranslation(selection.map(item => item.productId));
42
- * }
43
- * });
44
- * },
23
+ * location: 'product-list',
24
+ * label: 'Send to translation service',
25
+ * icon: 'language',
26
+ * onClick: ({ injector, selection }) => {
27
+ * const modalService = injector.get(ModalService);
28
+ * const translationService = injector.get(ProductDataTranslationService);
29
+ * modalService
30
+ * .dialog({
31
+ * title: `Send ${selection.length} products for translation?`,
32
+ * buttons: [
33
+ * { type: 'secondary', label: 'cancel' },
34
+ * { type: 'primary', label: 'send', returnValue: true },
35
+ * ],
36
+ * })
37
+ * .subscribe(response => {
38
+ * if (response) {
39
+ * translationService.sendForTranslation(selection.map(item => item.productId));
40
+ * }
41
+ * });
42
+ * },
45
43
  * }),
46
- * ],
47
- * })
48
- * export class MyUiExtensionModule {}
44
+ * ];
49
45
  * ```
50
46
  * @since 1.8.0
51
47
  * @docsCategory bulk-actions
@@ -5,6 +5,51 @@ import { CustomDetailComponentConfig } from '../providers/custom-detail-componen
5
5
  * Registers a {@link CustomDetailComponent} to be placed in a given location. This allows you
6
6
  * to embed any type of custom Angular component in the entity detail pages of the Admin UI.
7
7
  *
8
+ * @example
9
+ * ```ts
10
+ * import { Component, OnInit } from '\@angular/core';
11
+ * import { switchMap } from 'rxjs';
12
+ * import { FormGroup } from '\@angular/forms';
13
+ * import { CustomFieldConfig } from '\@vendure/common/lib/generated-types';
14
+ * import {
15
+ * DataService,
16
+ * SharedModule,
17
+ * CustomDetailComponent,
18
+ * registerCustomDetailComponent,
19
+ * GetProductWithVariants
20
+ * } from '\@vendure/admin-ui/core';
21
+ *
22
+ * \@Component({
23
+ * template: `{{ extraInfo$ | async | json }}`,
24
+ * standalone: true,
25
+ * imports: [SharedModule],
26
+ * })
27
+ * export class ProductInfoComponent implements CustomDetailComponent, OnInit {
28
+ * // These two properties are provided by Vendure and will vary
29
+ * // depending on the particular detail page you are embedding this
30
+ * // component into.
31
+ * entity$: Observable<GetProductWithVariants.Product>
32
+ * detailForm: FormGroup;
33
+ *
34
+ * extraInfo$: Observable<any>;
35
+ *
36
+ * constructor(private cmsDataService: CmsDataService) {}
37
+ *
38
+ * ngOnInit() {
39
+ * this.extraInfo$ = this.entity$.pipe(
40
+ * switchMap(entity => this.cmsDataService.getDataFor(entity.id))
41
+ * );
42
+ * }
43
+ * }
44
+ *
45
+ * export default [
46
+ * registerCustomDetailComponent({
47
+ * locationId: 'product-detail',
48
+ * component: ProductInfoComponent,
49
+ * }),
50
+ * ];
51
+ * ```
52
+ *
8
53
  * @docsCategory custom-detail-components
9
54
  */
10
55
  export declare function registerCustomDetailComponent(config: CustomDetailComponentConfig): Provider;
@@ -2,14 +2,15 @@ import { DataTableComponentConfig, DataTableCustomComponentService } from '../sh
2
2
  /**
3
3
  * @description
4
4
  * Allows you to override the default component used to render the data of a particular column in a DataTable.
5
- * The component should implement the {@link CustomDataTableColumnComponent} interface.
5
+ * The component should implement the {@link CustomDataTableColumnComponent} interface. The tableId and columnId can
6
+ * be determined by pressing `ctrl + u` when running the Admin UI in dev mode.
6
7
  *
7
8
  * @example
8
9
  * ```ts title="components/custom-table.component.ts"
9
10
  * import { Component, Input } from '\@angular/core';
10
11
  * import { CustomColumnComponent } from '\@vendure/admin-ui/core';
11
12
  *
12
- * @Component({
13
+ * \@Component({
13
14
  * selector: 'custom-slug-component',
14
15
  * template: `
15
16
  * <a [href]="'https://example.com/products/' + rowItem.slug" target="_blank">{{ rowItem.slug }}</a>
@@ -3,32 +3,33 @@ import { FormInputComponent } from '../common/component-registry-types';
3
3
  /**
4
4
  * @description
5
5
  * Registers a custom FormInputComponent which can be used to control the argument inputs
6
- * of a {@link ConfigurableOperationDef} (e.g. CollectionFilter, ShippingMethod etc) or for
6
+ * of a {@link ConfigurableOperationDef} (e.g. CollectionFilter, ShippingMethod etc.) or for
7
7
  * a custom field.
8
8
  *
9
9
  * @example
10
- * ```TypeScript
11
- * \@NgModule({
12
- * imports: [SharedModule],
13
- * declarations: [MyCustomFieldControl],
14
- * providers: [
15
- * registerFormInputComponent('my-custom-input', MyCustomFieldControl),
16
- * ],
17
- * })
18
- * export class MyUiExtensionModule {}
10
+ * ```ts title="providers.ts"
11
+ * import { registerFormInputComponent } from '\@vendure/admin-ui/core';
12
+ *
13
+ * export default [
14
+ * // highlight-next-line
15
+ * registerFormInputComponent('my-custom-input', MyCustomFieldControl),
16
+ * ];
19
17
  * ```
20
18
  *
21
19
  * This input component can then be used in a custom field:
22
20
  *
23
21
  * @example
24
- * ```TypeScript
25
- * const config = {
22
+ * ```ts title="src/vendure-config.ts"
23
+ * import { VendureConfig } from '\@vendure/core';
24
+ *
25
+ * const config: VendureConfig = {
26
26
  * // ...
27
27
  * customFields: {
28
28
  * ProductVariant: [
29
29
  * {
30
30
  * name: 'rrp',
31
31
  * type: 'int',
32
+ * // highlight-next-line
32
33
  * ui: { component: 'my-custom-input' },
33
34
  * },
34
35
  * ]
@@ -39,7 +40,7 @@ import { FormInputComponent } from '../common/component-registry-types';
39
40
  * or with an argument of a {@link ConfigurableOperationDef}:
40
41
  *
41
42
  * @example
42
- * ```TypeScript
43
+ * ```ts
43
44
  * args: {
44
45
  * rrp: { type: 'int', ui: { component: 'my-custom-input' } },
45
46
  * }
@@ -5,6 +5,61 @@ import { HistoryEntryConfig } from '../providers/custom-history-entry-component/
5
5
  * Registers a {@link HistoryEntryComponent} for displaying history entries in the Order/Customer
6
6
  * history timeline.
7
7
  *
8
+ * @example
9
+ * ```ts
10
+ * import { Component } from '\@angular/core';
11
+ * import {
12
+ * CustomerFragment,
13
+ * CustomerHistoryEntryComponent,
14
+ * registerHistoryEntryComponent,
15
+ * SharedModule,
16
+ * TimelineDisplayType,
17
+ * TimelineHistoryEntry,
18
+ * } from '\@vendure/admin-ui/core';
19
+ *
20
+ * \@Component({
21
+ * selector: 'tax-id-verification-component',
22
+ * template: `
23
+ * <div *ngIf="entry.data.valid">
24
+ * Tax ID <strong>{{ entry.data.taxId }}</strong> was verified
25
+ * <vdr-history-entry-detail *ngIf="entry.data">
26
+ * <vdr-object-tree [value]="entry.data"></vdr-object-tree>
27
+ * </vdr-history-entry-detail>
28
+ * </div>
29
+ * <div *ngIf="entry.data.valid">Tax ID {{ entry.data.taxId }} could not be verified</div>
30
+ * `,
31
+ * standalone: true,
32
+ * imports: [SharedModule],
33
+ * })
34
+ * class TaxIdHistoryEntryComponent implements CustomerHistoryEntryComponent {
35
+ * entry: TimelineHistoryEntry;
36
+ * customer: CustomerFragment;
37
+ *
38
+ * getDisplayType(entry: TimelineHistoryEntry): TimelineDisplayType {
39
+ * return entry.data.valid ? 'success' : 'error';
40
+ * }
41
+ *
42
+ * getName(entry: TimelineHistoryEntry): string {
43
+ * return 'Tax ID Verification Plugin';
44
+ * }
45
+ *
46
+ * isFeatured(entry: TimelineHistoryEntry): boolean {
47
+ * return true;
48
+ * }
49
+ *
50
+ * getIconShape(entry: TimelineHistoryEntry) {
51
+ * return entry.data.valid ? 'check-circle' : 'exclamation-circle';
52
+ * }
53
+ * }
54
+ *
55
+ * export default [
56
+ * registerHistoryEntryComponent({
57
+ * type: 'CUSTOMER_TAX_ID_VERIFICATION',
58
+ * component: TaxIdHistoryEntryComponent,
59
+ * }),
60
+ * ];
61
+ * ```
62
+ *
8
63
  * @since 1.9.0
9
64
  * @docsCategory custom-history-entry-components
10
65
  */
@@ -0,0 +1,23 @@
1
+ import { Provider } from '@angular/core';
2
+ import { PageTabConfig } from '../providers/page/page.service';
3
+ /**
4
+ * @description
5
+ * Add a tab to an existing list or detail page.
6
+ *
7
+ * @example
8
+ * ```ts title="providers.ts"
9
+ * import { registerPageTab } from '@vendure/admin-ui/core';
10
+ * import { DeletedProductListComponent } from './components/deleted-product-list/deleted-product-list.component';
11
+ *
12
+ * export default [
13
+ * registerPageTab({
14
+ * location: 'product-list',
15
+ * tab: 'Deleted Products',
16
+ * route: 'deleted',
17
+ * component: DeletedProductListComponent,
18
+ * }),
19
+ * ];
20
+ * ```
21
+ * @docsCategory tabs
22
+ */
23
+ export declare function registerPageTab(config: PageTabConfig): Provider;
@@ -5,7 +5,13 @@ import { DocumentNode } from 'graphql';
5
5
  import { BehaviorSubject, Observable } from 'rxjs';
6
6
  import { BaseDetailComponent } from '../common/base-detail.component';
7
7
  import { BreadcrumbValue } from '../providers/breadcrumb/breadcrumb.service';
8
- import { RouteComponent } from './components/route.component';
8
+ import { AngularRouteComponent } from './components/angular-route.component';
9
+ /**
10
+ * @description
11
+ * Configuration for a route component.
12
+ *
13
+ * @docsCategory routes
14
+ */
9
15
  export type RegisterRouteComponentOptions<Component extends any | BaseDetailComponent<Entity>, Entity extends {
10
16
  id: string;
11
17
  updatedAt?: string;
@@ -24,6 +30,46 @@ export type RegisterRouteComponentOptions<Component extends any | BaseDetailComp
24
30
  } & (Component extends BaseDetailComponent<Entity> ? {
25
31
  entityKey: R;
26
32
  } : unknown);
33
+ /**
34
+ * @description
35
+ * Registers an Angular standalone component to be rendered in a route.
36
+ *
37
+ * @example
38
+ * ```ts title="routes.ts"
39
+ * import { registerRouteComponent } from '\@vendure/admin-ui/core';
40
+ * import { registerReactRouteComponent } from '\@vendure/admin-ui/react';
41
+ *
42
+ * import { ProductReviewDetailComponent } from './components/product-review-detail/product-review-detail.component';
43
+ * import { AllProductReviewsList } from './components/all-product-reviews-list/all-product-reviews-list.component';
44
+ * import { GetReviewDetailDocument } from './generated-types';
45
+ *
46
+ * export default [
47
+ * registerRouteComponent({
48
+ * path: '',
49
+ * component: AllProductReviewsList,
50
+ * breadcrumb: 'Product reviews',
51
+ * }),
52
+ * registerRouteComponent({
53
+ * path: ':id',
54
+ * component: ProductReviewDetailComponent,
55
+ * query: GetReviewDetailDocument,
56
+ * entityKey: 'productReview',
57
+ * getBreadcrumbs: entity => [
58
+ * {
59
+ * label: 'Product reviews',
60
+ * link: ['/extensions', 'product-reviews'],
61
+ * },
62
+ * {
63
+ * label: `#${entity?.id} (${entity?.product.name})`,
64
+ * link: [],
65
+ * },
66
+ * ],
67
+ * }),
68
+ * ];
69
+ * ```
70
+ *
71
+ * @docsCategory routes
72
+ */
27
73
  export declare function registerRouteComponent<Component extends any | BaseDetailComponent<Entity>, Entity extends {
28
74
  id: string;
29
75
  updatedAt?: string;
@@ -39,7 +85,7 @@ export declare function registerRouteComponent<Component extends any | BaseDetai
39
85
  data: {
40
86
  breadcrumb: BehaviorSubject<BreadcrumbValue> | ((data: any) => any);
41
87
  };
42
- component: typeof RouteComponent;
88
+ component: typeof AngularRouteComponent;
43
89
  title?: string | Type<import("@angular/router").Resolve<string>> | ResolveFn<string> | undefined;
44
90
  path: string;
45
91
  pathMatch?: "prefix" | "full" | undefined;
@@ -111,7 +111,7 @@ export interface BulkAction<ItemType = any, ComponentType = any> {
111
111
  * running here.
112
112
  *
113
113
  * @example
114
- * ```TypeScript
114
+ * ```ts
115
115
  * import { registerBulkAction, DataService } from '\@vendure/admin-ui/core';
116
116
  *
117
117
  * registerBulkAction({
@@ -132,7 +132,7 @@ export interface BulkAction<ItemType = any, ComponentType = any> {
132
132
  * Control the display of this item based on the user permissions.
133
133
  *
134
134
  * @example
135
- * ```TypeScript
135
+ * ```ts
136
136
  * registerBulkAction({
137
137
  * // Can be specified as a simple string
138
138
  * requiresPermission: Permission.UpdateProduct,
@@ -8,7 +8,7 @@ import * as i0 from "@angular/core";
8
8
  * This service is responsible for instantiating a ModalDialog component and
9
9
  * embedding the specified component within.
10
10
  *
11
- * @docsCategory providers
11
+ * @docsCategory services
12
12
  * @docsPage ModalService
13
13
  * @docsWeight 0
14
14
  */
@@ -3,7 +3,7 @@
3
3
  * Any component intended to be used with the ModalService.fromComponent() method must implement
4
4
  * this interface.
5
5
  *
6
- * @docsCategory providers
6
+ * @docsCategory services
7
7
  * @docsPage ModalService
8
8
  */
9
9
  export interface Dialog<R = any> {
@@ -25,7 +25,7 @@ export interface DialogButtonConfig<T> {
25
25
  * @description
26
26
  * Configures a generic modal dialog.
27
27
  *
28
- * @docsCategory providers
28
+ * @docsCategory services
29
29
  * @docsPage ModalService
30
30
  */
31
31
  export interface DialogConfig<T> {
@@ -41,7 +41,7 @@ export interface DialogConfig<T> {
41
41
  * @description
42
42
  * Options to configure the behaviour of the modal.
43
43
  *
44
- * @docsCategory providers
44
+ * @docsCategory services
45
45
  * @docsPage ModalService
46
46
  */
47
47
  export interface ModalOptions<T> {
@@ -1,3 +1,4 @@
1
+ import { Injector } from '@angular/core';
1
2
  import { ActivatedRoute } from '@angular/router';
2
3
  import { Observable } from 'rxjs';
3
4
  import { ActionBarLocationId } from '../../common/component-registry-types';
@@ -64,15 +65,20 @@ export interface NavMenuSection {
64
65
  }
65
66
  /**
66
67
  * @description
67
- * Utilities available to the onClick handler of an ActionBarItem.
68
+ * Providers available to the onClick handler of an {@link ActionBarItem} or {@link NavMenuItem}.
68
69
  *
69
70
  * @docsCategory action-bar
70
71
  */
71
- export interface OnClickContext {
72
+ export interface ActionBarContext {
72
73
  route: ActivatedRoute;
74
+ injector: Injector;
73
75
  dataService: DataService;
74
76
  notificationService: NotificationService;
75
77
  }
78
+ export interface ActionBarButtonState {
79
+ disabled: boolean;
80
+ visible: boolean;
81
+ }
76
82
  /**
77
83
  * @description
78
84
  * A button in the ActionBar area at the top of one of the list or detail views.
@@ -83,12 +89,31 @@ export interface ActionBarItem {
83
89
  id: string;
84
90
  label: string;
85
91
  locationId: ActionBarLocationId;
92
+ /**
93
+ * @description
94
+ * Deprecated since v2.1.0 - use `buttonState` instead.
95
+ * @deprecated - use `buttonState` instead.
96
+ */
86
97
  disabled?: Observable<boolean>;
87
- onClick?: (event: MouseEvent, context: OnClickContext) => void;
98
+ /**
99
+ * @description
100
+ * A function which returns an observable of the button state, allowing you to
101
+ * dynamically enable/disable or show/hide the button.
102
+ *
103
+ * @since 2.1.0
104
+ */
105
+ buttonState?: (context: ActionBarContext) => Observable<ActionBarButtonState>;
106
+ onClick?: (event: MouseEvent, context: ActionBarContext) => void;
88
107
  routerLink?: RouterLinkDefinition;
89
108
  buttonColor?: 'primary' | 'success' | 'warning';
90
109
  buttonStyle?: 'solid' | 'outline' | 'link';
91
110
  icon?: string;
92
111
  requiresPermission?: string | string[];
93
112
  }
94
- export type RouterLinkDefinition = ((route: ActivatedRoute) => any[]) | any[];
113
+ /**
114
+ * @description
115
+ * A function which returns the router link for an {@link ActionBarItem} or {@link NavMenuItem}.
116
+ *
117
+ * @docsCategory action-bar
118
+ */
119
+ export type RouterLinkDefinition = ((route: ActivatedRoute, context: ActionBarContext) => any[]) | any[];