@functionalcms/svelte-components 4.10.49 → 4.11.0
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.
- package/dist/components/form/Form.svelte +10 -5
- package/dist/components/form/Form.svelte.d.ts +1 -0
- package/dist/components/layouts/TwoColumnsLayout.svelte +1 -1
- package/dist/components/layouts/TwoColumnsLayout.svelte.d.ts +2 -3
- package/dist/translations/translator.d.ts +1 -0
- package/dist/translations/translator.js +5 -0
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { Placement } from '../Styling.js';
|
|
8
8
|
import Button from './Button.svelte';
|
|
9
9
|
import { superForm } from 'sveltekit-superforms';
|
|
10
|
+
import { translator } from '../../translations/translator.ts';
|
|
10
11
|
|
|
11
12
|
interface FormButton {
|
|
12
13
|
label: string;
|
|
@@ -21,6 +22,7 @@
|
|
|
21
22
|
superform: Record<string, unknown>;
|
|
22
23
|
buttonPosition: Placement;
|
|
23
24
|
buttonsContainer: string;
|
|
25
|
+
translate: any;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
let {
|
|
@@ -29,10 +31,12 @@
|
|
|
29
31
|
superform = {},
|
|
30
32
|
action = '',
|
|
31
33
|
buttonsContainer = '',
|
|
32
|
-
buttonPosition = Placement.Bottom
|
|
34
|
+
buttonPosition = Placement.Bottom,
|
|
35
|
+
translate
|
|
33
36
|
}: Partial<Props> = $props();
|
|
34
37
|
|
|
35
38
|
const { form, enhance } = superForm(superform);
|
|
39
|
+
const t = translator(translate);
|
|
36
40
|
</script>
|
|
37
41
|
|
|
38
42
|
{#snippet renderButtons()}
|
|
@@ -55,22 +59,23 @@
|
|
|
55
59
|
<Switch
|
|
56
60
|
name={field.name}
|
|
57
61
|
id={field.name}
|
|
58
|
-
label={field.name}
|
|
62
|
+
label={t(field.name)}
|
|
59
63
|
isChecked={$form[field.name]}
|
|
60
64
|
/>
|
|
61
65
|
{:else if field.type === 'enum' && field.meta.type === 'select'}
|
|
62
66
|
<Select
|
|
63
67
|
name={field.name}
|
|
64
68
|
id={field.name}
|
|
65
|
-
label={field.name}
|
|
69
|
+
label={t(field.name)}
|
|
66
70
|
options={mapEntiresToOptions(field)}
|
|
67
71
|
singleSelected={$form[field.name]}
|
|
72
|
+
defaultOptionLabel={t('selectOption')}
|
|
68
73
|
/>
|
|
69
74
|
{:else if field.type === 'enum'}
|
|
70
75
|
<ChoiceInput
|
|
71
76
|
name={field.name}
|
|
72
77
|
id={field.name}
|
|
73
|
-
label={field.name}
|
|
78
|
+
label={t(field.name)}
|
|
74
79
|
type={field.meta.type}
|
|
75
80
|
options={mapEntiresToOptions(field)}
|
|
76
81
|
checkedOptions={[field.default]}
|
|
@@ -80,7 +85,7 @@
|
|
|
80
85
|
<Input
|
|
81
86
|
name={field.name}
|
|
82
87
|
id={field.name}
|
|
83
|
-
label={field.name}
|
|
88
|
+
label={t(field.name)}
|
|
84
89
|
type={field.meta.type}
|
|
85
90
|
isRequired={field.isRequired}
|
|
86
91
|
value={$form[field.name]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
2
|
+
declare const TwoColumnsLayout: import("svelte").Component<Partial<{
|
|
3
3
|
leftRender: Snippet;
|
|
4
4
|
rightRender: Snippet;
|
|
5
5
|
containerCss: string;
|
|
@@ -7,7 +7,6 @@ interface TwoColumnLayoutProps {
|
|
|
7
7
|
rightCss: string;
|
|
8
8
|
isFullWidth: boolean;
|
|
9
9
|
isFullHeight: boolean;
|
|
10
|
-
}
|
|
11
|
-
declare const TwoColumnsLayout: import("svelte").Component<TwoColumnLayoutProps, {}, "">;
|
|
10
|
+
}>, {}, "">;
|
|
12
11
|
type TwoColumnsLayout = ReturnType<typeof TwoColumnsLayout>;
|
|
13
12
|
export default TwoColumnsLayout;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const translator: (translations: any) => (key: string) => any;
|