@softwareone/spi-sv5-library 1.5.6 → 1.5.8
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.
|
@@ -18,16 +18,18 @@
|
|
|
18
18
|
type Schema = z.infer<typeof schema>;
|
|
19
19
|
|
|
20
20
|
interface Props {
|
|
21
|
+
id?: string;
|
|
21
22
|
initialData: Schema;
|
|
22
23
|
action: string;
|
|
23
24
|
schema: z.ZodObject;
|
|
24
25
|
extraData?: Record<string, string | number>;
|
|
25
26
|
onsuccess: (data?: Record<string, unknown>) => void;
|
|
26
27
|
onfailure?: (status: number | undefined, error: unknown) => void;
|
|
27
|
-
children
|
|
28
|
+
children?: Snippet;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
let {
|
|
32
|
+
id,
|
|
31
33
|
initialData,
|
|
32
34
|
action,
|
|
33
35
|
schema,
|
|
@@ -145,17 +147,17 @@
|
|
|
145
147
|
<Spinner show={isLoading} />
|
|
146
148
|
|
|
147
149
|
<form
|
|
148
|
-
id=
|
|
150
|
+
id={id ? `form-${id}` : 'form'}
|
|
149
151
|
method="POST"
|
|
150
152
|
action="?/{action}"
|
|
151
153
|
use:enhance
|
|
152
154
|
onsubmit={(event) => event.preventDefault()}
|
|
153
155
|
>
|
|
154
|
-
{@render children()}
|
|
156
|
+
{@render children?.()}
|
|
155
157
|
</form>
|
|
156
158
|
|
|
157
159
|
<style>
|
|
158
160
|
form {
|
|
159
161
|
width: 100%;
|
|
160
162
|
}
|
|
161
|
-
</style>
|
|
163
|
+
</style>
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { type Snippet } from 'svelte';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
declare const Form: import("svelte").Component<{
|
|
4
|
+
id?: string;
|
|
4
5
|
initialData: Record<string, unknown>;
|
|
5
6
|
action: string;
|
|
6
7
|
schema: z.ZodObject;
|
|
7
8
|
extraData?: Record<string, string | number>;
|
|
8
9
|
onsuccess: (data?: Record<string, unknown>) => void;
|
|
9
10
|
onfailure?: (status: number | undefined, error: unknown) => void;
|
|
10
|
-
children
|
|
11
|
+
children?: Snippet;
|
|
11
12
|
}, {}, "">;
|
|
12
13
|
type Form = ReturnType<typeof Form>;
|
|
13
14
|
export default Form;
|