@softwareone/spi-sv5-library 1.7.0 → 1.7.1
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.
|
@@ -170,7 +170,15 @@
|
|
|
170
170
|
{/snippet}
|
|
171
171
|
</Notification>
|
|
172
172
|
</section>
|
|
173
|
-
<Form
|
|
173
|
+
<Form
|
|
174
|
+
{action}
|
|
175
|
+
initialData={{ files }}
|
|
176
|
+
{schema}
|
|
177
|
+
{extraData}
|
|
178
|
+
enctype="multipart/form-data"
|
|
179
|
+
{onsuccess}
|
|
180
|
+
{onfailure}
|
|
181
|
+
>
|
|
174
182
|
{#snippet children()}
|
|
175
183
|
<h2 class="title">Upload file</h2>
|
|
176
184
|
<section class="drop-area">
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import { isEqual } from './helper.js';
|
|
17
17
|
|
|
18
18
|
type Schema = z.infer<typeof schema>;
|
|
19
|
+
type Enctype = 'application/x-www-form-urlencoded' | 'multipart/form-data';
|
|
19
20
|
|
|
20
21
|
interface Props {
|
|
21
22
|
id?: string;
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
action: string;
|
|
24
25
|
schema: z.ZodObject;
|
|
25
26
|
extraData?: Record<string, string | number>;
|
|
27
|
+
enctype?: Enctype;
|
|
26
28
|
onsuccess: (data?: Record<string, unknown>) => void;
|
|
27
29
|
onfailure?: (status: number | undefined, error: unknown) => void;
|
|
28
30
|
children?: Snippet;
|
|
@@ -34,6 +36,7 @@
|
|
|
34
36
|
action,
|
|
35
37
|
schema,
|
|
36
38
|
extraData,
|
|
39
|
+
enctype = 'application/x-www-form-urlencoded',
|
|
37
40
|
onsuccess,
|
|
38
41
|
onfailure = undefined,
|
|
39
42
|
children
|
|
@@ -150,6 +153,7 @@
|
|
|
150
153
|
id={id ? `form-${id}` : 'form'}
|
|
151
154
|
method="POST"
|
|
152
155
|
action="?/{action}"
|
|
156
|
+
{enctype}
|
|
153
157
|
use:enhance
|
|
154
158
|
onsubmit={(event) => event.preventDefault()}
|
|
155
159
|
>
|
|
@@ -6,6 +6,7 @@ declare const Form: import("svelte").Component<{
|
|
|
6
6
|
action: string;
|
|
7
7
|
schema: z.ZodObject;
|
|
8
8
|
extraData?: Record<string, string | number>;
|
|
9
|
+
enctype?: "application/x-www-form-urlencoded" | "multipart/form-data";
|
|
9
10
|
onsuccess: (data?: Record<string, unknown>) => void;
|
|
10
11
|
onfailure?: (status: number | undefined, error: unknown) => void;
|
|
11
12
|
children?: Snippet;
|