Merge branch 'master' into allow-public-view-attachment-uploads

This commit is contained in:
Andrew Kingston 2025-03-07 14:57:48 +00:00 committed by GitHub
commit 51a31e035d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 77 additions and 1 deletions

View File

@ -43,7 +43,7 @@
const validateDescription = description => {
if (!description?.length) {
return "Please enter a name"
return "Please enter a description"
}
return null
}

View File

@ -0,0 +1,41 @@
<script>
import { Label, Checkbox } from "@budibase/bbui"
import DrawerBindableInput from "@/components/common/bindings/DrawerBindableInput.svelte"
export let parameters
export let bindings = []
</script>
<div class="root">
<Label>Text to copy</Label>
<DrawerBindableInput
title="Text to copy"
{bindings}
value={parameters.textToCopy}
on:change={e => (parameters.textToCopy = e.detail)}
/>
<Label />
<Checkbox text="Show notification" bind:value={parameters.showNotification} />
{#if parameters.showNotification}
<Label>Notification message</Label>
<DrawerBindableInput
title="Notification message"
{bindings}
value={parameters.notificationMessage}
placeholder="Copied to clipboard"
on:change={e => (parameters.notificationMessage = e.detail)}
/>
{/if}
</div>
<style>
.root {
display: grid;
column-gap: var(--spacing-l);
row-gap: var(--spacing-s);
grid-template-columns: 120px 1fr;
align-items: center;
max-width: 400px;
margin: 0 auto;
}
</style>

View File

@ -26,3 +26,4 @@ export { default as CloseModal } from "./CloseModal.svelte"
export { default as ClearRowSelection } from "./ClearRowSelection.svelte"
export { default as DownloadFile } from "./DownloadFile.svelte"
export { default as RowAction } from "./RowAction.svelte"
export { default as CopyToClipboard } from "./CopyToClipboard.svelte"

View File

@ -183,6 +183,17 @@
"name": "Row Action",
"type": "data",
"component": "RowAction"
},
{
"name": "Copy To Clipboard",
"type": "data",
"component": "CopyToClipboard",
"context": [
{
"label": "Copied text",
"value": "copied"
}
]
}
]
}

View File

@ -421,6 +421,28 @@ const showNotificationHandler = action => {
const promptUserHandler = () => {}
const copyToClipboardHandler = async action => {
const { textToCopy, showNotification, notificationMessage } =
action.parameters
if (!textToCopy) {
return
}
try {
await navigator.clipboard.writeText(textToCopy)
if (showNotification) {
const message = notificationMessage || "Copied to clipboard"
notificationStore.actions.success(message, true, 3000)
}
} catch (err) {
console.error("Failed to copy text: ", err)
notificationStore.actions.error("Failed to copy to clipboard")
}
return { copied: textToCopy }
}
const openSidePanelHandler = action => {
const { id } = action.parameters
if (id) {
@ -514,6 +536,7 @@ const handlerMap = {
["Close Modal"]: closeModalHandler,
["Download File"]: downloadFileHandler,
["Row Action"]: rowActionHandler,
["Copy To Clipboard"]: copyToClipboardHandler,
}
const confirmTextMap = {