Apply valid file types to AttachmentCell.

This commit is contained in:
Sam Rose 2023-10-27 16:46:30 +01:00
parent 2160f4e5e2
commit 6bb6f106d5
No known key found for this signature in database
3 changed files with 5 additions and 1 deletions

View File

@ -17,6 +17,7 @@
export let fileTags = [] export let fileTags = []
export let maximum = undefined export let maximum = undefined
export let compact = false export let compact = false
export let extensions = undefined
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
const onChange = e => { const onChange = e => {
@ -39,6 +40,7 @@
{fileTags} {fileTags}
{maximum} {maximum}
{compact} {compact}
{extensions}
on:change={onChange} on:change={onChange}
/> />
</Field> </Field>

View File

@ -2,6 +2,7 @@
import { onMount } from "svelte" import { onMount } from "svelte"
import { getContext } from "svelte" import { getContext } from "svelte"
import { Dropzone } from "@budibase/bbui" import { Dropzone } from "@budibase/bbui"
import { ValidFileExtensions } from "@budibase/shared-core"
export let value export let value
export let focused = false export let focused = false
@ -13,6 +14,7 @@
const { API, notifications } = getContext("grid") const { API, notifications } = getContext("grid")
const imageExtensions = ["png", "tiff", "gif", "raw", "jpg", "jpeg"] const imageExtensions = ["png", "tiff", "gif", "raw", "jpg", "jpeg"]
const validExtensions = ValidFileExtensions.map(ext => `.${ext}`).join(", ")
let isOpen = false let isOpen = false
@ -96,6 +98,7 @@
{value} {value}
compact compact
on:change={e => onChange(e.detail)} on:change={e => onChange(e.detail)}
extensions={validExtensions}
{processFiles} {processFiles}
{deleteAttachments} {deleteAttachments}
{handleFileTooLarge} {handleFileTooLarge}

View File

@ -96,7 +96,6 @@ export enum BuilderSocketEvent {
export const SocketSessionTTL = 60 export const SocketSessionTTL = 60
export const ValidQueryNameRegex = /^[^()]*$/ export const ValidQueryNameRegex = /^[^()]*$/
export const ValidColumnNameRegex = /^[_a-zA-Z0-9\s]*$/g export const ValidColumnNameRegex = /^[_a-zA-Z0-9\s]*$/g
export const ValidFileExtensions = [ export const ValidFileExtensions = [
"avif", "avif",
"css", "css",