From 375654a2832761473cc02fabb9ffd44e5f53735c Mon Sep 17 00:00:00 2001 From: naegelin Date: Thu, 11 Aug 2022 13:33:54 -0400 Subject: [PATCH] feat(ToolbarBatchActions): Allow showing the toolbar even if there are no selected items. Fixes #1438. Maintains current behavior but allows for an over-ride to ensure the toolbarbatchactions bar does not close when the user has unselected all items. Example Useage: ``` .... ``` --- src/DataTable/ToolbarBatchActions.svelte | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/DataTable/ToolbarBatchActions.svelte b/src/DataTable/ToolbarBatchActions.svelte index eaee6f82..ac7a538d 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 ToolbarBatchActions regardless of row selection + * @type {boolean} + */ + export let show = false; + import { onMount, getContext } from "svelte"; import Button from "../Button/Button.svelte"; let batchSelectedIds = []; - $: showActions = batchSelectedIds.length > 0; + $: showActions = batchSelectedIds.length > 0 || show; const ctx = getContext("DataTable"); const unsubscribe = ctx.batchSelectedIds.subscribe((value) => {