Update delete rows button to be configurable
This commit is contained in:
parent
e8fa134c7c
commit
9a442cb0ce
|
@ -5,6 +5,7 @@
|
|||
|
||||
export let selectedRows
|
||||
export let deleteRows
|
||||
export let item = "row"
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
let modal
|
||||
|
@ -14,12 +15,14 @@
|
|||
modal?.hide()
|
||||
dispatch("updaterows")
|
||||
}
|
||||
|
||||
$: text = `${item}${selectedRows?.length === 1 ? "" : "s"}`
|
||||
</script>
|
||||
|
||||
<Button icon="Delete" size="s" primary quiet on:click={modal.show}>
|
||||
Delete
|
||||
{selectedRows.length}
|
||||
row(s)
|
||||
{text}
|
||||
</Button>
|
||||
<ConfirmDialog
|
||||
bind:this={modal}
|
||||
|
@ -29,5 +32,5 @@
|
|||
>
|
||||
Are you sure you want to delete
|
||||
{selectedRows.length}
|
||||
row{selectedRows.length > 1 ? "s" : ""}?
|
||||
{text}?
|
||||
</ConfirmDialog>
|
||||
|
|
|
@ -240,7 +240,12 @@
|
|||
<div class="controls-right">
|
||||
<Search bind:value={searchEmail} placeholder="Search email" />
|
||||
{#if selectedRows.length > 0}
|
||||
<DeleteRowsButton on:updaterows {selectedRows} {deleteRows} />
|
||||
<DeleteRowsButton
|
||||
item="user"
|
||||
on:updaterows
|
||||
{selectedRows}
|
||||
{deleteRows}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue