@functionalcms/svelte-components 5.26.3 → 5.27.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -21,6 +21,12 @@
|
|
|
21
21
|
loading = 'Loading...',
|
|
22
22
|
error = 'An error occurred'
|
|
23
23
|
}: Props = $props();
|
|
24
|
+
|
|
25
|
+
function isEmpty(items: unknown): boolean {
|
|
26
|
+
if (Array.isArray(items)) return items.length === 0;
|
|
27
|
+
if (items && typeof items === 'object') return Object.keys(items).length === 0;
|
|
28
|
+
return !items;
|
|
29
|
+
}
|
|
24
30
|
</script>
|
|
25
31
|
|
|
26
32
|
{#await content}
|
|
@@ -37,7 +43,7 @@
|
|
|
37
43
|
</ButtonGroup>
|
|
38
44
|
</header>
|
|
39
45
|
<div>
|
|
40
|
-
{#if items
|
|
46
|
+
{#if !isEmpty(items)}
|
|
41
47
|
{@render children?.(items)}
|
|
42
48
|
{:else if empty}
|
|
43
49
|
{@render empty?.()}
|
|
@@ -173,6 +173,7 @@
|
|
|
173
173
|
|
|
174
174
|
{#snippet renderFile(field: FilePickerField)}
|
|
175
175
|
<Label class={field.labelClass}>{field.label}</Label>
|
|
176
|
+
{@const restProps = { }}
|
|
176
177
|
<Fileupload
|
|
177
178
|
id={field.id}
|
|
178
179
|
name={field.id}
|
|
@@ -181,6 +182,8 @@
|
|
|
181
182
|
disabled={field.disabled}
|
|
182
183
|
class={field.class}
|
|
183
184
|
multiple={field.multiple}
|
|
185
|
+
accept={field.isCamera ? 'image/*' : undefined}
|
|
186
|
+
capture={field.isCamera ? 'environment' : undefined}
|
|
184
187
|
/>
|
|
185
188
|
{/snippet}
|
|
186
189
|
|