mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
feat(toolbar-batch-actions): add active
prop to show toolbar (#1440)
Closes #1438
This commit is contained in:
parent
14a8376a81
commit
bc58c7b029
4 changed files with 30 additions and 5 deletions
|
@ -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) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue