@r2digisolutions/components 0.21.28 → 0.21.29
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.
|
@@ -17,7 +17,12 @@
|
|
|
17
17
|
label?: string;
|
|
18
18
|
hint?: string;
|
|
19
19
|
accept?: string;
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Form field name for the file input.
|
|
22
|
+
* Leave unset for picker-only usage (`bind:files` / `onchange`) so the input is
|
|
23
|
+
* ignored by parent remote forms. When set with `multiple`, a `[]` suffix is
|
|
24
|
+
* added automatically unless the name already ends with `[]`.
|
|
25
|
+
*/
|
|
21
26
|
name?: string;
|
|
22
27
|
/** Allow selecting more than one file (default true). */
|
|
23
28
|
multiple?: boolean;
|
|
@@ -40,7 +45,7 @@
|
|
|
40
45
|
label = 'Drop files here',
|
|
41
46
|
hint = 'or click to browse',
|
|
42
47
|
accept,
|
|
43
|
-
name
|
|
48
|
+
name,
|
|
44
49
|
multiple = true,
|
|
45
50
|
maxFiles,
|
|
46
51
|
disabled = false,
|
|
@@ -63,6 +68,13 @@
|
|
|
63
68
|
const previewUrls = new Set<string>();
|
|
64
69
|
|
|
65
70
|
const maxBytes = $derived(maxSizeMb * 1024 * 1024);
|
|
71
|
+
const inputName = $derived(
|
|
72
|
+
!name
|
|
73
|
+
? undefined
|
|
74
|
+
: multiple && !name.endsWith('[]')
|
|
75
|
+
? `${name}[]`
|
|
76
|
+
: name
|
|
77
|
+
);
|
|
66
78
|
|
|
67
79
|
function formatBytes(bytes: number): string {
|
|
68
80
|
if (bytes === 0) return '0 B';
|
|
@@ -263,7 +275,7 @@
|
|
|
263
275
|
<input
|
|
264
276
|
bind:this={inputEl}
|
|
265
277
|
id={inputId}
|
|
266
|
-
name={
|
|
278
|
+
name={inputName}
|
|
267
279
|
type="file"
|
|
268
280
|
class="sr-only"
|
|
269
281
|
aria-label={label}
|
|
@@ -8,7 +8,12 @@ interface DropZoneProps {
|
|
|
8
8
|
label?: string;
|
|
9
9
|
hint?: string;
|
|
10
10
|
accept?: string;
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Form field name for the file input.
|
|
13
|
+
* Leave unset for picker-only usage (`bind:files` / `onchange`) so the input is
|
|
14
|
+
* ignored by parent remote forms. When set with `multiple`, a `[]` suffix is
|
|
15
|
+
* added automatically unless the name already ends with `[]`.
|
|
16
|
+
*/
|
|
12
17
|
name?: string;
|
|
13
18
|
/** Allow selecting more than one file (default true). */
|
|
14
19
|
multiple?: boolean;
|