Add compact setting to AttachmentField (#9052)

This commit is contained in:
melohagan 2022-12-15 13:59:03 +00:00 committed by GitHub
parent c18c8d5af4
commit f5c902fb57
3 changed files with 81 additions and 69 deletions

View File

@ -15,6 +15,7 @@
export let value = [] export let value = []
export let id = null export let id = null
export let disabled = false export let disabled = false
export let compact = false
export let fileSizeLimit = BYTES_IN_MB * 20 export let fileSizeLimit = BYTES_IN_MB * 20
export let processFiles = null export let processFiles = null
export let deleteAttachments = null export let deleteAttachments = null
@ -239,6 +240,7 @@
bind:this={fileInput} bind:this={fileInput}
on:change={handleFile} on:change={handleFile}
/> />
{#if !compact}
<svg <svg
class="spectrum-IllustratedMessage-illustration" class="spectrum-IllustratedMessage-illustration"
width="125" width="125"
@ -303,6 +305,7 @@
> >
Drag and drop your file Drag and drop your file
</h2> </h2>
{/if}
{#if !disabled} {#if !disabled}
<p <p
class="spectrum-Body spectrum-Body--sizeS spectrum-IllustratedMessage-description" class="spectrum-Body spectrum-Body--sizeS spectrum-IllustratedMessage-description"
@ -310,8 +313,10 @@
<label for={fieldId} class="spectrum-Link"> <label for={fieldId} class="spectrum-Link">
Select a file to upload Select a file to upload
</label> </label>
{#if !compact}
<br /> <br />
from your computer from your computer
{/if}
</p> </p>
{#if fileTags.length} {#if fileTags.length}
<Tags> <Tags>

View File

@ -3440,6 +3440,12 @@
} }
] ]
}, },
{
"type": "boolean",
"label": "Compact",
"key": "compact",
"defaultValue": false
},
{ {
"type": "boolean", "type": "boolean",
"label": "Disabled", "label": "Disabled",
@ -3785,7 +3791,6 @@
"defaultValue": false, "defaultValue": false,
"info": "Row selection is only compatible with internal or SQL tables" "info": "Row selection is only compatible with internal or SQL tables"
}, },
{ {
"section": true, "section": true,
"name": "On Row Click", "name": "On Row Click",

View File

@ -6,6 +6,7 @@
export let field export let field
export let label export let label
export let disabled = false export let disabled = false
export let compact = false
export let validation export let validation
export let extensions export let extensions
export let onChange export let onChange
@ -89,6 +90,7 @@
{handleTooManyFiles} {handleTooManyFiles}
{maximum} {maximum}
{extensions} {extensions}
{compact}
/> />
{/if} {/if}
</div> </div>
@ -96,6 +98,6 @@
<style> <style>
.minHeightWrapper { .minHeightWrapper {
min-height: 220px; min-height: 80px;
} }
</style> </style>