diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index c0bb3fc0..d43e129c 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -4422,9 +4422,10 @@ None. ### Props -| Prop name | Required | Kind | Reactive | Type | Default value | Description | -| :------------------ | :------- | :--------------- | :------- | ---------------------------------------------- | --------------------------------------------------------------------------------------------------- | -------------------------------------- | -| formatTotalSelected | No | let | No | (totalSelected: number) => string | (totalSelected) => \`${totalSelected} item${totalSelected === 1 ? "" : "s"} selected\` | Override the total items selected text | +| Prop name | Required | Kind | Reactive | Type | Default value | Description | +| :------------------ | :------- | :--------------- | :------- | ---------------------------------------------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | +| formatTotalSelected | No | let | No | (totalSelected: number) => string | (totalSelected) => \`${totalSelected} item${totalSelected === 1 ? "" : "s"} selected\` | Override the total items selected text | +| active | No | let | No | boolean | false | Set to `true` to show the toolbar regardless of row selection | ### Slots diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index de37420f..e149ae27 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -13672,6 +13672,18 @@ "isRequired": false, "constant": false, "reactive": false + }, + { + "name": "active", + "kind": "let", + "description": "Set to `true` to show the toolbar regardless of row selection", + "type": "boolean", + "value": "false", + "isFunction": false, + "isFunctionDeclaration": false, + "isRequired": false, + "constant": false, + "reactive": false } ], "moduleExports": [], diff --git a/src/DataTable/ToolbarBatchActions.svelte b/src/DataTable/ToolbarBatchActions.svelte index 9f539412..d65e3801 100644 --- a/src/DataTable/ToolbarBatchActions.svelte +++ b/src/DataTable/ToolbarBatchActions.svelte @@ -10,6 +10,12 @@ export let formatTotalSelected = (totalSelected) => `${totalSelected} item${totalSelected === 1 ? "" : "s"} selected`; + /** + * Set to `true` to show the toolbar regardless of row selection + * @type {boolean} + */ + export let active = false; + import { onMount, getContext, createEventDispatcher } from "svelte"; import Button from "../Button/Button.svelte"; @@ -17,7 +23,7 @@ const dispatch = createEventDispatcher(); - $: showActions = batchSelectedIds.length > 0; + $: showActions = batchSelectedIds.length > 0 || active; const ctx = getContext("DataTable"); diff --git a/types/DataTable/ToolbarBatchActions.svelte.d.ts b/types/DataTable/ToolbarBatchActions.svelte.d.ts index f9dfa900..2778e7f6 100644 --- a/types/DataTable/ToolbarBatchActions.svelte.d.ts +++ b/types/DataTable/ToolbarBatchActions.svelte.d.ts @@ -8,6 +8,12 @@ export interface ToolbarBatchActionsProps * @default (totalSelected) => `${totalSelected} item${totalSelected === 1 ? "" : "s"} selected` */ formatTotalSelected?: (totalSelected: number) => string; + + /** + * Set to `true` to show the toolbar regardless of row selection + * @default false + */ + active?: boolean; } export default class ToolbarBatchActions extends SvelteComponentTyped<