diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index bcc834a6..979e8d35 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 3e2e91ce..8487cc64 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 eaee6f82..c58307cf 100644 --- a/src/DataTable/ToolbarBatchActions.svelte +++ b/src/DataTable/ToolbarBatchActions.svelte @@ -5,13 +5,19 @@ */ 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 } from "svelte"; import Button from "../Button/Button.svelte"; let batchSelectedIds = []; - $: showActions = batchSelectedIds.length > 0; + $: showActions = batchSelectedIds.length > 0 || active; const ctx = getContext("DataTable"); const unsubscribe = ctx.batchSelectedIds.subscribe((value) => { diff --git a/types/DataTable/ToolbarBatchActions.svelte.d.ts b/types/DataTable/ToolbarBatchActions.svelte.d.ts index 9cf7306b..8e6aa3b2 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<