Replace bulk delete button with inline icons
This commit is contained in:
parent
b07e5095e9
commit
023cb2b83b
|
@ -70,7 +70,15 @@
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{#if $config.allowExpandRows}
|
{#if rowSelected && $config.allowDeleteRows}
|
||||||
|
<div class="delete" on:click={() => dispatch("request-bulk-delete")}>
|
||||||
|
<Icon
|
||||||
|
name="Delete"
|
||||||
|
size="S"
|
||||||
|
color="var(--spectrum-global-color-red-400)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{:else if $config.allowExpandRows}
|
||||||
<div
|
<div
|
||||||
class="expand"
|
class="expand"
|
||||||
class:visible={!disableExpand && (rowFocused || rowHovered)}
|
class:visible={!disableExpand && (rowFocused || rowHovered)}
|
||||||
|
@ -111,9 +119,12 @@
|
||||||
.number.visible {
|
.number.visible {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
.delete,
|
||||||
|
.expand {
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
.expand {
|
.expand {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
margin-right: 4px;
|
|
||||||
}
|
}
|
||||||
.expand :global(.spectrum-Icon) {
|
.expand :global(.spectrum-Icon) {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
@ -124,4 +135,11 @@
|
||||||
.expand.visible :global(.spectrum-Icon) {
|
.expand.visible :global(.spectrum-Icon) {
|
||||||
pointer-events: all;
|
pointer-events: all;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.delete:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.delete:hover :global(.spectrum-Icon) {
|
||||||
|
color: var(--spectrum-global-color-red-600) !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<script>
|
<script>
|
||||||
import { Modal, ModalContent, Button, notifications } from "@budibase/bbui"
|
import { Modal, ModalContent, notifications } from "@budibase/bbui"
|
||||||
import { getContext, onMount } from "svelte"
|
import { getContext, onMount } from "svelte"
|
||||||
|
|
||||||
const { selectedRows, rows, config, subscribe } = getContext("grid")
|
const { selectedRows, rows, subscribe } = getContext("grid")
|
||||||
|
|
||||||
let modal
|
let modal
|
||||||
|
|
||||||
|
@ -27,20 +27,6 @@
|
||||||
onMount(() => subscribe("request-bulk-delete", () => modal?.show()))
|
onMount(() => subscribe("request-bulk-delete", () => modal?.show()))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if selectedRowCount}
|
|
||||||
<div class="delete-button" data-ignore-click-outside="true">
|
|
||||||
<Button
|
|
||||||
icon="Delete"
|
|
||||||
size="M"
|
|
||||||
on:click={modal.show}
|
|
||||||
disabled={!$config.allowEditRows}
|
|
||||||
cta
|
|
||||||
>
|
|
||||||
Delete {selectedRowCount} row{selectedRowCount === 1 ? "" : "s"}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<Modal bind:this={modal}>
|
<Modal bind:this={modal}>
|
||||||
<ModalContent
|
<ModalContent
|
||||||
title="Delete rows"
|
title="Delete rows"
|
||||||
|
@ -53,14 +39,3 @@
|
||||||
row{selectedRowCount === 1 ? "" : "s"}?
|
row{selectedRowCount === 1 ? "" : "s"}?
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<style>
|
|
||||||
.delete-button :global(.spectrum-Button:not(:disabled)) {
|
|
||||||
background-color: var(--spectrum-global-color-red-400);
|
|
||||||
border-color: var(--spectrum-global-color-red-400);
|
|
||||||
}
|
|
||||||
.delete-button :global(.spectrum-Button:not(:disabled):hover) {
|
|
||||||
background-color: var(--spectrum-global-color-red-500);
|
|
||||||
border-color: var(--spectrum-global-color-red-500);
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -6,7 +6,7 @@
|
||||||
import { createEventManagers } from "../lib/events"
|
import { createEventManagers } from "../lib/events"
|
||||||
import { createAPIClient } from "../../../api"
|
import { createAPIClient } from "../../../api"
|
||||||
import { attachStores } from "../stores"
|
import { attachStores } from "../stores"
|
||||||
import DeleteButton from "../controls/DeleteButton.svelte"
|
import BulkDeleteHandler from "../controls/BulkDeleteHandler.svelte"
|
||||||
import BetaButton from "../controls/BetaButton.svelte"
|
import BetaButton from "../controls/BetaButton.svelte"
|
||||||
import GridBody from "./GridBody.svelte"
|
import GridBody from "./GridBody.svelte"
|
||||||
import ResizeOverlay from "../overlays/ResizeOverlay.svelte"
|
import ResizeOverlay from "../overlays/ResizeOverlay.svelte"
|
||||||
|
@ -118,7 +118,6 @@
|
||||||
<RowHeightButton />
|
<RowHeightButton />
|
||||||
</div>
|
</div>
|
||||||
<div class="controls-right">
|
<div class="controls-right">
|
||||||
<DeleteButton />
|
|
||||||
<UserAvatars />
|
<UserAvatars />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -146,6 +145,7 @@
|
||||||
<ProgressCircle />
|
<ProgressCircle />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
<BulkDeleteHandler />
|
||||||
<KeyboardManager />
|
<KeyboardManager />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue