1
0
Fork 0
mirror of synced 2024-10-02 01:56:57 +13:00

Max 1 file on single attachment

This commit is contained in:
Adria Navarro 2024-03-26 11:45:47 +01:00
parent ed228a2288
commit 6d5c47e0cc

View file

@ -20,6 +20,8 @@
$: isSingle = schema?.type === FieldType.ATTACHMENT_SINGLE $: isSingle = schema?.type === FieldType.ATTACHMENT_SINGLE
$: arrayValue = (value && !Array.isArray(value) ? [value] : value) || [] $: arrayValue = (value && !Array.isArray(value) ? [value] : value) || []
$: maximum = isSingle ? 1 : schema.constraints?.length?.maximum
$: editable = focused && !readonly $: editable = focused && !readonly
$: { $: {
if (!focused) { if (!focused) {
@ -111,7 +113,7 @@
value={arrayValue} value={arrayValue}
compact compact
on:change={onFileChange} on:change={onFileChange}
maximum={schema.constraints?.length?.maximum} {maximum}
{processFiles} {processFiles}
{deleteAttachments} {deleteAttachments}
{handleFileTooLarge} {handleFileTooLarge}