|
|
@@ -1,7 +1,7 @@
|
|
|
---
|
|
|
title: "BulkAction"
|
|
|
weight: 10
|
|
|
-date: 2023-06-21T06:23:42.057Z
|
|
|
+date: 2023-07-14T16:57:51.079Z
|
|
|
showtoc: true
|
|
|
generated: true
|
|
|
---
|
|
|
@@ -15,8 +15,8 @@ generated: true
|
|
|
|
|
|
{{< generation-info sourceFile="packages/admin-ui/src/lib/core/src/providers/bulk-action-registry/bulk-action-types.ts" sourceLine="99" packageName="@vendure/admin-ui" since="1.8.0">}}
|
|
|
|
|
|
-Configures a bulk action which can be performed on all selected items in a list view.
|
|
|
-
|
|
|
+Configures a bulk action which can be performed on all selected items in a list view.
|
|
|
+
|
|
|
For a full example, see the <a href='/admin-ui-api/bulk-actions/register-bulk-action#registerbulkaction'>registerBulkAction</a> docs.
|
|
|
|
|
|
## Signature
|
|
|
@@ -25,8 +25,8 @@ For a full example, see the <a href='/admin-ui-api/bulk-actions/register-bulk-ac
|
|
|
interface BulkAction<ItemType = any, ComponentType = any> {
|
|
|
location: BulkActionLocationId;
|
|
|
label: string;
|
|
|
- getTranslationVars?: (
|
|
|
- context: BulkActionFunctionContext<ItemType, ComponentType>,
|
|
|
+ getTranslationVars?: (
|
|
|
+ context: BulkActionFunctionContext<ItemType, ComponentType>,
|
|
|
) => Record<string, string | number> | Promise<Record<string, string | number>>;
|
|
|
icon?: string;
|
|
|
iconClass?: string;
|
|
|
@@ -51,28 +51,28 @@ interface BulkAction<ItemType = any, ComponentType = any> {
|
|
|
|
|
|
### getTranslationVars
|
|
|
|
|
|
-{{< member-info kind="property" type="(
context: <a href='/admin-ui-api/bulk-actions/bulk-action#bulkactionfunctioncontext'>BulkActionFunctionContext</a><ItemType, ComponentType>,
) => Record<string, string | number> | Promise<Record<string, string | number>>" >}}
|
|
|
+{{< member-info kind="property" type="( context: <a href='/admin-ui-api/bulk-actions/bulk-action#bulkactionfunctioncontext'>BulkActionFunctionContext</a><ItemType, ComponentType>, ) => Record<string, string | number> | Promise<Record<string, string | number>>" >}}
|
|
|
|
|
|
-{{< member-description >}}An optional function that should resolve to a map of translation variables which can be
|
|
|
+{{< member-description >}}An optional function that should resolve to a map of translation variables which can be
|
|
|
used when translating the `label` string.{{< /member-description >}}
|
|
|
|
|
|
### icon
|
|
|
|
|
|
{{< member-info kind="property" type="string" >}}
|
|
|
|
|
|
-{{< member-description >}}A valid [Clarity Icons](https://core.clarity.design/foundation/icons/shapes/) icon shape, e.g.
|
|
|
+{{< member-description >}}A valid [Clarity Icons](https://core.clarity.design/foundation/icons/shapes/) icon shape, e.g.
|
|
|
"cog", "user", "info-standard".{{< /member-description >}}
|
|
|
|
|
|
### iconClass
|
|
|
|
|
|
{{< member-info kind="property" type="string" >}}
|
|
|
|
|
|
-{{< member-description >}}A class to be added to the icon element. Examples:
|
|
|
-
|
|
|
-- is-success
|
|
|
-- is-danger
|
|
|
-- is-warning
|
|
|
-- is-info
|
|
|
+{{< member-description >}}A class to be added to the icon element. Examples:
|
|
|
+
|
|
|
+- is-success
|
|
|
+- is-danger
|
|
|
+- is-warning
|
|
|
+- is-info
|
|
|
- is-highlight{{< /member-description >}}
|
|
|
|
|
|
### onClick
|
|
|
@@ -85,10 +85,10 @@ used when translating the `label` string.{{< /member-description >}}
|
|
|
|
|
|
{{< member-info kind="property" type="(context: <a href='/admin-ui-api/bulk-actions/bulk-action#bulkactionfunctioncontext'>BulkActionFunctionContext</a><ItemType, ComponentType>) => boolean | Promise<boolean>" >}}
|
|
|
|
|
|
-{{< member-description >}}A function that determines whether this bulk action item should be displayed in the menu.
|
|
|
-If not defined, the item will always be displayed.
|
|
|
-
|
|
|
-This function will be invoked each time the selection is changed, so try to avoid expensive code
|
|
|
+{{< member-description >}}A function that determines whether this bulk action item should be displayed in the menu.
|
|
|
+If not defined, the item will always be displayed.
|
|
|
+
|
|
|
+This function will be invoked each time the selection is changed, so try to avoid expensive code
|
|
|
running here.
|
|
|
|
|
|
*Example*
|
|
|
@@ -143,25 +143,25 @@ A valid location of a list view that supports the bulk actions API.
|
|
|
## Signature
|
|
|
|
|
|
```TypeScript
|
|
|
-type BulkActionLocationId = | 'product-list'
|
|
|
- | 'facet-list'
|
|
|
- | 'collection-list'
|
|
|
- | 'customer-list'
|
|
|
- | 'customer-group-list'
|
|
|
- | 'customer-group-members-list'
|
|
|
- | 'customer-group-members-picker-list'
|
|
|
- | 'promotion-list'
|
|
|
- | 'seller-list'
|
|
|
- | 'channel-list'
|
|
|
- | 'administrator-list'
|
|
|
- | 'role-list'
|
|
|
- | 'shipping-method-list'
|
|
|
- | 'stock-location-list'
|
|
|
- | 'payment-method-list'
|
|
|
- | 'tax-category-list'
|
|
|
- | 'tax-rate-list'
|
|
|
- | 'zone-list'
|
|
|
- | 'zone-members-list'
|
|
|
+type BulkActionLocationId = | 'product-list'
|
|
|
+ | 'facet-list'
|
|
|
+ | 'collection-list'
|
|
|
+ | 'customer-list'
|
|
|
+ | 'customer-group-list'
|
|
|
+ | 'customer-group-members-list'
|
|
|
+ | 'customer-group-members-picker-list'
|
|
|
+ | 'promotion-list'
|
|
|
+ | 'seller-list'
|
|
|
+ | 'channel-list'
|
|
|
+ | 'administrator-list'
|
|
|
+ | 'role-list'
|
|
|
+ | 'shipping-method-list'
|
|
|
+ | 'stock-location-list'
|
|
|
+ | 'payment-method-list'
|
|
|
+ | 'tax-category-list'
|
|
|
+ | 'tax-rate-list'
|
|
|
+ | 'zone-list'
|
|
|
+ | 'zone-members-list'
|
|
|
| string
|
|
|
```
|
|
|
</div>
|
|
|
@@ -172,7 +172,7 @@ type BulkActionLocationId = | 'product-list'
|
|
|
|
|
|
{{< generation-info sourceFile="packages/admin-ui/src/lib/core/src/providers/bulk-action-registry/bulk-action-types.ts" sourceLine="43" packageName="@vendure/admin-ui" since="1.8.0">}}
|
|
|
|
|
|
-This is the argument which gets passed to the `getTranslationVars` and `isVisible` functions
|
|
|
+This is the argument which gets passed to the `getTranslationVars` and `isVisible` functions
|
|
|
of the BulkAction definition.
|
|
|
|
|
|
## Signature
|
|
|
@@ -197,16 +197,16 @@ interface BulkActionFunctionContext<ItemType, ComponentType> {
|
|
|
|
|
|
{{< member-info kind="property" type="ComponentType" >}}
|
|
|
|
|
|
-{{< member-description >}}The component instance that is hosting the list view. For instance,
|
|
|
-`ProductListComponent`. This can be used to call methods on the instance,
|
|
|
-e.g. calling `hostComponent.refresh()` to force a list refresh after
|
|
|
+{{< member-description >}}The component instance that is hosting the list view. For instance,
|
|
|
+`ProductListComponent`. This can be used to call methods on the instance,
|
|
|
+e.g. calling `hostComponent.refresh()` to force a list refresh after
|
|
|
deleting the selected items.{{< /member-description >}}
|
|
|
|
|
|
### injector
|
|
|
|
|
|
{{< member-info kind="property" type="<a href='/typescript-api/common/injector#injector'>Injector</a>" >}}
|
|
|
|
|
|
-{{< member-description >}}The Angular [Injector](https://angular.io/api/core/Injector) which can be used
|
|
|
+{{< member-description >}}The Angular [Injector](https://angular.io/api/core/Injector) which can be used
|
|
|
to get service instances which might be needed in the click handler.{{< /member-description >}}
|
|
|
|
|
|
### route
|