forked from tsai/budibase
17 changed files with 183 additions and 58 deletions
Binary file not shown.
Binary file not shown.
@ -0,0 +1,34 @@ |
|||
<script> |
|||
import { TextButton, Icon, Modal, ModalContent } from "@budibase/bbui" |
|||
import CreateEditRowModal from "../modals/CreateEditRowModal.svelte" |
|||
|
|||
export let selectedRows |
|||
export let deleteRows |
|||
|
|||
let modal |
|||
|
|||
async function confirmDeletion() { |
|||
await deleteRows() |
|||
modal.hide() |
|||
} |
|||
</script> |
|||
|
|||
<div> |
|||
<TextButton small text on:click={modal.show}> |
|||
<Icon name="delete" /> |
|||
Delete |
|||
{selectedRows.length} |
|||
row(s) |
|||
</TextButton> |
|||
</div> |
|||
<Modal bind:this={modal}> |
|||
<ModalContent |
|||
red |
|||
confirmText="Delete" |
|||
onConfirm={confirmDeletion} |
|||
title="Confirm Row Deletion"> |
|||
Are you sure you want to delete these |
|||
{selectedRows.length} |
|||
rows? |
|||
</ModalContent> |
|||
</Modal> |
|||
@ -0,0 +1,42 @@ |
|||
<script> |
|||
import { backendUiStore } from "builderStore" |
|||
import { DropdownMenu, Icon, Modal } from "@budibase/bbui" |
|||
import * as api from "../api" |
|||
import { notifier } from "builderStore/store/notifications" |
|||
import ConfirmDialog from "components/common/ConfirmDialog.svelte" |
|||
|
|||
export let row |
|||
|
|||
let anchor |
|||
let dropdown |
|||
let confirmDeleteDialog |
|||
|
|||
function showDelete() { |
|||
confirmDeleteDialog.show() |
|||
} |
|||
|
|||
async function deleteRow() { |
|||
await api.deleteRow(row) |
|||
notifier.success("Row deleted") |
|||
backendUiStore.actions.rows.delete(row) |
|||
} |
|||
</script> |
|||
|
|||
<div on:click={showDelete}><i class="ri-delete-row" /></div> |
|||
<ConfirmDialog |
|||
bind:this={confirmDeleteDialog} |
|||
body={`Are you sure you wish to delete this row? Your data will be deleted and this action cannot be undone.`} |
|||
okText="Delete Row" |
|||
onOk={deleteRow} |
|||
title="Confirm Delete" /> |
|||
|
|||
<style> |
|||
.ri-delete-bin-line:hover { |
|||
cursor: pointer; |
|||
} |
|||
|
|||
div { |
|||
display: flex; |
|||
justify-content: center; |
|||
} |
|||
</style> |
|||
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue