@functionalcms/svelte-components 4.10.32 → 4.10.35
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.
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import Input from './Input.svelte';
|
|
5
5
|
import Select from './Select.svelte';
|
|
6
6
|
import Switch from './Switch.svelte';
|
|
7
|
-
import { Placement } from '../Styling.
|
|
7
|
+
import { Placement } from '../Styling.js';
|
|
8
8
|
import { addTransactionSupport } from 'ioredis/built/transaction.js';
|
|
9
9
|
import Button from './Button.svelte';
|
|
10
10
|
|
|
@@ -5,7 +5,7 @@ export interface Field {
|
|
|
5
5
|
meta: any;
|
|
6
6
|
isRequired: boolean;
|
|
7
7
|
}
|
|
8
|
-
export declare function serialize(schema: any):
|
|
8
|
+
export declare function serialize(schema: any): Promise<import("sveltekit-superforms").SuperValidated<{}, any, {}>>;
|
|
9
9
|
export declare function mapEntiresToOptions(field: Field): {
|
|
10
10
|
label: string;
|
|
11
11
|
value: string;
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { superValidate } from 'sveltekit-superforms';
|
|
2
|
+
import { yup } from 'sveltekit-superforms/adapters';
|
|
3
|
+
export async function serialize(schema) {
|
|
4
|
+
// const keys = schema._nodes.reverse();
|
|
5
|
+
// const fields: Array<Field> = keys.map((key: string) => {
|
|
6
|
+
// const field = schema.fields[key];
|
|
7
|
+
// const hasEntries = field._whitelist.size > 0;
|
|
8
|
+
// const isOptional = field.spec.optional ?? true;
|
|
9
|
+
// return {
|
|
10
|
+
// name: key,
|
|
11
|
+
// type: hasEntries ? "enum" : field.type,
|
|
12
|
+
// entries: hasEntries ? [...field._whitelist] : [],
|
|
13
|
+
// meta: field.spec.meta ?? {},
|
|
14
|
+
// isRequired: !isOptional,
|
|
15
|
+
// };
|
|
16
|
+
// });
|
|
17
|
+
// return fields;
|
|
18
|
+
const form = await superValidate(yup(schema));
|
|
19
|
+
return form;
|
|
16
20
|
}
|
|
17
21
|
export function mapEntiresToOptions(field) {
|
|
18
22
|
return (field?.entries?.map((entry) => ({
|