Add grid menu items to copy row ID and rev
This commit is contained in:
parent
c8da2d5717
commit
88c475e4cb
|
@ -1,5 +1,11 @@
|
||||||
<script>
|
<script>
|
||||||
import { clickOutside, Menu, MenuItem, notifications } from "@budibase/bbui"
|
import {
|
||||||
|
clickOutside,
|
||||||
|
Menu,
|
||||||
|
MenuItem,
|
||||||
|
Helpers,
|
||||||
|
notifications,
|
||||||
|
} from "@budibase/bbui"
|
||||||
import { getContext } from "svelte"
|
import { getContext } from "svelte"
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
@ -36,6 +42,11 @@
|
||||||
$focusedCellId = `${newRow._id}-${column}`
|
$focusedCellId = `${newRow._id}-${column}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const copyToClipboard = async value => {
|
||||||
|
await Helpers.copyToClipboard(value)
|
||||||
|
notifications.success("Copied to clipboard")
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if $menu.visible}
|
{#if $menu.visible}
|
||||||
|
@ -64,6 +75,22 @@
|
||||||
>
|
>
|
||||||
Edit row in modal
|
Edit row in modal
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem
|
||||||
|
icon="Copy"
|
||||||
|
disabled={!$focusedRow?._id}
|
||||||
|
on:click={() => copyToClipboard($focusedRow?._id)}
|
||||||
|
on:click={menu.actions.close}
|
||||||
|
>
|
||||||
|
Copy row _id
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem
|
||||||
|
icon="Copy"
|
||||||
|
disabled={!$focusedRow?._rev}
|
||||||
|
on:click={() => copyToClipboard($focusedRow?._rev)}
|
||||||
|
on:click={menu.actions.close}
|
||||||
|
>
|
||||||
|
Copy row _rev
|
||||||
|
</MenuItem>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon="Duplicate"
|
icon="Duplicate"
|
||||||
disabled={!$config.allowAddRows}
|
disabled={!$config.allowAddRows}
|
||||||
|
|
Loading…
Reference in New Issue