rimecms 0.29.0 → 0.30.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/adapter-sqlite/area.server.js +8 -8
- package/dist/adapter-sqlite/generate-schema/column.server.d.ts +13 -0
- package/dist/adapter-sqlite/generate-schema/column.server.js +77 -0
- package/dist/adapter-sqlite/generate-schema/index.server.js +7 -12
- package/dist/adapter-sqlite/generate-schema/root.server.js +35 -39
- package/dist/adapter-sqlite/generate-schema/templates.server.d.ts +12 -0
- package/dist/adapter-sqlite/generate-schema/templates.server.js +19 -0
- package/dist/adapter-sqlite/index.server.d.ts +1 -2
- package/dist/adapter-sqlite/index.server.js +0 -2
- package/dist/adapter-sqlite/relations.server.js +6 -1
- package/dist/adapter-sqlite/util.server.d.ts +1 -6
- package/dist/adapter-sqlite/util.server.js +6 -0
- package/dist/adapter-sqlite/where.server.js +17 -16
- package/dist/adapter-sqlite/with.server.js +9 -9
- package/dist/core/collections/auth/fields.d.ts +2 -182
- package/dist/core/collections/config/augment-auth.server.js +1 -1
- package/dist/core/collections/config/augment-nested.server.js +1 -1
- package/dist/core/collections/config/augment-upload.js +2 -2
- package/dist/core/collections/config/augment-upload.server.js +4 -1
- package/dist/core/collections/operations/duplicate.js +30 -11
- package/dist/core/collections/operations/updateById.js +6 -5
- package/dist/core/collections/rest/duplicate.server.js +7 -3
- package/dist/core/collections/upload/disk/delete.server.d.ts +1 -1
- package/dist/core/collections/upload/disk/delete.server.js +48 -1
- package/dist/core/collections/upload/hooks/clean-up-files.server.js +2 -2
- package/dist/core/collections/upload/hooks/extract-path.server.d.ts +1 -1
- package/dist/core/collections/upload/hooks/extract-path.server.js +1 -1
- package/dist/core/collections/upload/hooks/process-file-upload.server.js +3 -3
- package/dist/core/config/server/validate.server.js +50 -30
- package/dist/core/config/shared/find-thumbnail.js +12 -12
- package/dist/core/config/shared/find-title.js +13 -13
- package/dist/core/config/shared/upload-directories.js +1 -1
- package/dist/core/constant.server.d.ts +1 -0
- package/dist/core/constant.server.js +2 -0
- package/dist/core/dev/cache/index.server.js +9 -9
- package/dist/core/dev/cli/build/index.js +2 -2
- package/dist/core/dev/cli/clear/index.server.js +2 -1
- package/dist/core/dev/cli/generate/index.server.js +3 -2
- package/dist/core/dev/cli/init/index.server.js +1 -1
- package/dist/core/dev/generate/routes/index.server.js +2 -2
- package/dist/core/dev/generate/types/index.server.js +17 -17
- package/dist/core/dev/vite/index.server.js +21 -5
- package/dist/core/fields/builders/boolean-builder.d.ts +3 -1
- package/dist/core/fields/builders/boolean-builder.js +3 -0
- package/dist/core/fields/builders/field-builder.d.ts +35 -2
- package/dist/core/fields/builders/field-builder.js +33 -2
- package/dist/core/fields/builders/form-field-builder.d.ts +71 -12
- package/dist/core/fields/builders/form-field-builder.js +96 -6
- package/dist/core/fields/builders/select-builder.d.ts +4 -1
- package/dist/core/fields/builders/select-builder.js +3 -0
- package/dist/core/fields/util.d.ts +8 -16
- package/dist/core/fields/util.js +49 -83
- package/dist/core/handlers/routes.server.js +16 -3
- package/dist/core/naming.d.ts +34 -0
- package/dist/core/naming.js +39 -0
- package/dist/core/operations/blocks/diff.server.js +1 -1
- package/dist/core/operations/blocks/extract.server.js +1 -1
- package/dist/core/operations/configMap/buildTreeMap.d.ts +3 -2
- package/dist/core/operations/configMap/buildTreeMap.js +1 -1
- package/dist/core/operations/configMap/index.d.ts +2 -1
- package/dist/core/operations/configMap/index.js +13 -13
- package/dist/core/operations/configMap/types.d.ts +2 -2
- package/dist/core/operations/hooks/before-read/process-document-fields.server.js +14 -17
- package/dist/core/operations/hooks/before-upsert/data-config-map.server.js +1 -1
- package/dist/core/operations/hooks/before-upsert/original-config-map.server.js +1 -1
- package/dist/core/operations/hooks/before-upsert/set-default-values.server.d.ts +2 -4
- package/dist/core/operations/hooks/before-upsert/set-default-values.server.js +10 -15
- package/dist/core/operations/hooks/before-upsert/validate-fields.server.js +49 -31
- package/dist/core/operations/relations/extract.server.js +5 -5
- package/dist/core/operations/shared/fallback-data-from-original.js +2 -2
- package/dist/core/operations/tree/diff.server.js +1 -1
- package/dist/core/operations/tree/extract.server.js +1 -1
- package/dist/core/plugins/cache/cache.server.js +3 -3
- package/dist/fields/blocks/component/AddBlockButton.svelte +7 -7
- package/dist/fields/blocks/component/AddBlockButton.svelte.d.ts +2 -2
- package/dist/fields/blocks/component/Blocks.svelte +6 -7
- package/dist/fields/blocks/component/props.d.ts +2 -2
- package/dist/fields/blocks/index.d.ts +1 -1
- package/dist/fields/blocks/index.js +3 -3
- package/dist/fields/blocks/index.server.js +1 -1
- package/dist/fields/checkbox/component/Checkbox.svelte +2 -2
- package/dist/fields/checkbox/component/props.d.ts +2 -2
- package/dist/fields/checkbox/index.server.d.ts +1 -2
- package/dist/fields/checkbox/index.server.js +1 -10
- package/dist/fields/combobox/component/ComboBox.svelte +3 -3
- package/dist/fields/combobox/component/props.d.ts +2 -2
- package/dist/fields/combobox/index.server.d.ts +1 -2
- package/dist/fields/combobox/index.server.js +2 -11
- package/dist/fields/component/index.d.ts +1 -1
- package/dist/fields/date/component/Date.svelte +4 -4
- package/dist/fields/date/component/Date.svelte.d.ts +2 -2
- package/dist/fields/date/index.d.ts +3 -1
- package/dist/fields/date/index.js +3 -0
- package/dist/fields/date/index.server.d.ts +1 -2
- package/dist/fields/date/index.server.js +1 -10
- package/dist/fields/email/component/Email.svelte +5 -6
- package/dist/fields/email/component/props.d.ts +2 -3
- package/dist/fields/email/index.d.ts +3 -2
- package/dist/fields/email/index.js +4 -1
- package/dist/fields/email/index.server.d.ts +0 -3
- package/dist/fields/email/index.server.js +0 -9
- package/dist/fields/group/component/Group.svelte +9 -15
- package/dist/fields/group/component/Group.svelte.d.ts +2 -2
- package/dist/fields/group/index.d.ts +4 -2
- package/dist/fields/group/index.server.js +2 -2
- package/dist/fields/index.server.d.ts +1 -4
- package/dist/fields/index.server.js +17 -13
- package/dist/fields/link/component/Link.svelte +5 -5
- package/dist/fields/link/component/props.d.ts +2 -2
- package/dist/fields/link/index.d.ts +4 -1
- package/dist/fields/link/index.js +9 -10
- package/dist/fields/link/runtime.d.ts +2 -0
- package/dist/fields/link/runtime.js +1 -0
- package/dist/fields/link/{index.server.d.ts → runtime.server.d.ts} +1 -2
- package/dist/fields/link/{index.server.js → runtime.server.js} +2 -11
- package/dist/fields/number/component/Number.svelte +6 -6
- package/dist/fields/number/component/props.d.ts +2 -2
- package/dist/fields/number/index.d.ts +4 -10
- package/dist/fields/number/index.js +3 -4
- package/dist/fields/number/index.server.d.ts +1 -2
- package/dist/fields/number/index.server.js +1 -10
- package/dist/fields/radio/component/Radio.svelte +6 -7
- package/dist/fields/radio/component/props.d.ts +2 -2
- package/dist/fields/radio/index.server.d.ts +1 -2
- package/dist/fields/radio/index.server.js +2 -11
- package/dist/fields/relation/component/Relation.svelte +18 -14
- package/dist/fields/relation/component/Relation.svelte.d.ts +2 -2
- package/dist/fields/relation/index.d.ts +7 -4
- package/dist/fields/relation/index.js +8 -47
- package/dist/fields/relation/runtime.d.ts +5 -0
- package/dist/fields/relation/runtime.js +4 -0
- package/dist/fields/relation/runtime.server.d.ts +8 -0
- package/dist/fields/relation/runtime.server.js +49 -0
- package/dist/fields/rich-text/component/RichText.svelte +5 -5
- package/dist/fields/rich-text/component/props.d.ts +2 -2
- package/dist/fields/rich-text/core/features/fields/fields.svelte +2 -2
- package/dist/fields/rich-text/index.d.ts +2 -0
- package/dist/fields/rich-text/index.js +3 -0
- package/dist/fields/rich-text/index.server.d.ts +1 -2
- package/dist/fields/rich-text/index.server.js +1 -10
- package/dist/fields/select/component/Select.svelte +16 -16
- package/dist/fields/select/component/props.d.ts +2 -2
- package/dist/fields/select/index.d.ts +2 -0
- package/dist/fields/select/index.js +3 -0
- package/dist/fields/select/index.server.d.ts +1 -2
- package/dist/fields/select/index.server.js +2 -17
- package/dist/fields/slug/component/Slug.svelte +14 -10
- package/dist/fields/slug/component/Slug.svelte.d.ts +2 -2
- package/dist/fields/slug/index.d.ts +5 -2
- package/dist/fields/slug/index.js +3 -0
- package/dist/fields/slug/index.server.d.ts +1 -2
- package/dist/fields/slug/index.server.js +1 -10
- package/dist/fields/tabs/component/Tabs.svelte +15 -15
- package/dist/fields/tabs/component/Tabs.svelte.d.ts +2 -2
- package/dist/fields/tabs/index.d.ts +4 -16
- package/dist/fields/tabs/index.js +1 -8
- package/dist/fields/tabs/index.server.js +3 -3
- package/dist/fields/text/component/Text.svelte +5 -5
- package/dist/fields/text/component/props.d.ts +2 -3
- package/dist/fields/text/index.d.ts +4 -10
- package/dist/fields/text/index.js +3 -4
- package/dist/fields/text/index.server.d.ts +1 -2
- package/dist/fields/text/index.server.js +1 -10
- package/dist/fields/textarea/component/TextArea.svelte +3 -3
- package/dist/fields/textarea/component/props.d.ts +2 -2
- package/dist/fields/textarea/index.d.ts +4 -1
- package/dist/fields/textarea/index.js +3 -0
- package/dist/fields/textarea/index.server.d.ts +1 -2
- package/dist/fields/textarea/index.server.js +1 -10
- package/dist/fields/time/component/Time.svelte +5 -5
- package/dist/fields/time/component/Time.svelte.d.ts +1 -1
- package/dist/fields/time/component/props.d.ts +2 -2
- package/dist/fields/time/index.d.ts +2 -0
- package/dist/fields/time/index.js +3 -0
- package/dist/fields/time/index.server.d.ts +1 -2
- package/dist/fields/time/index.server.js +1 -10
- package/dist/fields/toggle/component/Toggle.svelte +3 -3
- package/dist/fields/toggle/component/Toggle.svelte.d.ts +1 -1
- package/dist/fields/toggle/component/props.d.ts +2 -2
- package/dist/fields/toggle/index.d.ts +2 -1
- package/dist/fields/toggle/index.server.d.ts +1 -2
- package/dist/fields/toggle/index.server.js +1 -10
- package/dist/fields/tree/component/AddItemButton.svelte +1 -2
- package/dist/fields/tree/component/Tree.svelte +6 -6
- package/dist/fields/tree/component/TreeBlock.svelte +5 -12
- package/dist/fields/tree/component/props.d.ts +3 -3
- package/dist/fields/tree/index.d.ts +3 -1
- package/dist/fields/tree/index.js +2 -2
- package/dist/fields/types.d.ts +11 -5
- package/dist/panel/components/fields/FieldsPreview.svelte +4 -5
- package/dist/panel/components/fields/Hint.svelte +5 -4
- package/dist/panel/components/fields/Hint.svelte.d.ts +3 -2
- package/dist/panel/components/fields/Label.svelte +6 -11
- package/dist/panel/components/fields/Label.svelte.d.ts +3 -2
- package/dist/panel/components/fields/LabelFor.svelte +4 -4
- package/dist/panel/components/fields/LabelFor.svelte.d.ts +2 -1
- package/dist/panel/components/fields/RenderFields.svelte +11 -16
- package/dist/panel/components/fields/{root.svelte.d.ts → fieldset.svelte.d.ts} +1 -1
- package/dist/panel/components/fields/{root.svelte.js → fieldset.svelte.js} +1 -1
- package/dist/panel/components/fields/index.d.ts +5 -5
- package/dist/panel/components/fields/index.js +2 -2
- package/dist/panel/components/sections/document/AuthFooter.svelte +2 -7
- package/dist/panel/components/sections/live/LiveEditPanel.svelte +2 -2
- package/dist/panel/context/collection.svelte.js +9 -9
- package/dist/panel/context/documentForm.svelte.d.ts +8 -21
- package/dist/panel/context/documentForm.svelte.js +45 -52
- package/dist/panel/context/form.svelte.d.ts +4 -3
- package/dist/panel/context/form.svelte.js +14 -16
- package/dist/panel/pages/auth/fields.d.ts +4 -4
- package/dist/panel/pages/auth/fields.js +6 -22
- package/dist/panel/pages/auth/reset-password/ResetPassword.svelte +3 -10
- package/dist/util/doc.js +15 -17
- package/package.json +3 -2
- package/dist/fields/relation/index.server.d.ts +0 -4
- package/dist/fields/relation/index.server.js +0 -13
|
@@ -7,7 +7,7 @@ export declare class GroupFieldBuilder extends FormFieldBuilder<GroupField> {
|
|
|
7
7
|
constructor(name: string);
|
|
8
8
|
get component(): Component<{
|
|
9
9
|
path: string;
|
|
10
|
-
config:
|
|
10
|
+
config: GroupFieldBuilder;
|
|
11
11
|
form: import("../../panel").DocumentFormContext<import("../../types").GenericDoc>;
|
|
12
12
|
}, {}, "">;
|
|
13
13
|
label(label: string): this;
|
|
@@ -16,6 +16,7 @@ export declare class GroupFieldBuilder extends FormFieldBuilder<GroupField> {
|
|
|
16
16
|
preview(component: Component<FieldsPreviewProps>): this;
|
|
17
17
|
compile(): {
|
|
18
18
|
fields: ({
|
|
19
|
+
name: string;
|
|
19
20
|
type: string;
|
|
20
21
|
live?: boolean | undefined;
|
|
21
22
|
condition?: ((doc: any, siblings: any) => boolean) | undefined;
|
|
@@ -34,6 +35,7 @@ export declare class GroupFieldBuilder extends FormFieldBuilder<GroupField> {
|
|
|
34
35
|
value: any;
|
|
35
36
|
}> | null;
|
|
36
37
|
})[];
|
|
38
|
+
name: string;
|
|
37
39
|
type: "group";
|
|
38
40
|
live?: boolean;
|
|
39
41
|
condition?: (doc: any, siblings: any) => boolean;
|
|
@@ -46,7 +48,6 @@ export declare class GroupFieldBuilder extends FormFieldBuilder<GroupField> {
|
|
|
46
48
|
read: import("../types.js").FieldAccess;
|
|
47
49
|
update: import("../types.js").FieldAccess;
|
|
48
50
|
};
|
|
49
|
-
name: string;
|
|
50
51
|
hidden?: boolean;
|
|
51
52
|
validate?: import("../types.js").FieldValidationFunc<any>;
|
|
52
53
|
required?: boolean;
|
|
@@ -62,6 +63,7 @@ export declare class GroupFieldBuilder extends FormFieldBuilder<GroupField> {
|
|
|
62
63
|
};
|
|
63
64
|
defaultValue?: import("../types.js").DefaultValueFn<any> | unknown;
|
|
64
65
|
isEmpty: (value: unknown) => boolean;
|
|
66
|
+
_root?: boolean;
|
|
65
67
|
preview?: Component<FieldsPreviewProps>;
|
|
66
68
|
};
|
|
67
69
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { getFieldPrivateModule } from '../index.server.js';
|
|
2
2
|
export async function toType(group) {
|
|
3
3
|
const fieldsTypes = [];
|
|
4
|
-
for (const field of group.
|
|
4
|
+
for (const field of group.get.fields) {
|
|
5
5
|
const fieldServerMethods = await getFieldPrivateModule(field);
|
|
6
6
|
if (fieldServerMethods) {
|
|
7
7
|
const result = await Promise.resolve(fieldServerMethods.toType(field));
|
|
8
8
|
fieldsTypes.push(result);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
return group.
|
|
11
|
+
return group.get.fields.length ? `${group.name}: {${fieldsTypes.join(',\n\t')}}` : '';
|
|
12
12
|
}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import type { FieldBuilder } from '../core/fields/builders/field-builder.js';
|
|
2
2
|
export type ToType<T extends FieldBuilder<any> = FieldBuilder<any>> = (field: T) => Promise<string> | string;
|
|
3
|
-
export type ToSchema<T extends FieldBuilder<any> = FieldBuilder<any>> = (field: T, parentPath?: string) => string;
|
|
4
3
|
/**
|
|
5
4
|
* Dynamically imports the server-side module for a form field if it exists
|
|
6
5
|
* Returns the imported module or false if no server module is found or import fails
|
|
7
6
|
* @example
|
|
8
7
|
* const serverModule = await getFieldPrivateModule(fieldBuilder);
|
|
9
8
|
* if (serverModule) {
|
|
10
|
-
* serverModule.
|
|
11
|
-
* serverModule.toSchema({ name: 'title' })
|
|
9
|
+
* serverModule.toType(fieldBuilder)
|
|
12
10
|
* }
|
|
13
11
|
*/
|
|
14
12
|
export declare function getFieldPrivateModule(field: FieldBuilder<any>): Promise<{
|
|
15
13
|
toType: ToType;
|
|
16
|
-
toSchema: ToSchema;
|
|
17
14
|
} | null>;
|
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
import { existsSync } from 'fs';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
|
-
import { extname } from 'path';
|
|
3
|
+
import { dirname, extname, join } from 'path';
|
|
4
4
|
/**
|
|
5
|
-
* Converts a file URL to its corresponding server module path and checks if the file exists
|
|
6
|
-
*
|
|
5
|
+
* Converts a file URL to its corresponding server module path and checks if the file exists.
|
|
6
|
+
* Prefers a sibling `runtime.server.ts` (the generic per-field server-only file, also used to
|
|
7
|
+
* resolve `$rime/runtime` — see relation/ for the first user), falling back to the older
|
|
8
|
+
* `<basename>.server.ts` convention most fields still use. Tries both .ts and .js extensions
|
|
9
|
+
* either way.
|
|
7
10
|
* @example
|
|
8
|
-
* convertToServerModulePath('file:///path/to/
|
|
11
|
+
* convertToServerModulePath('file:///path/to/relation/index.ts') // '/path/to/relation/runtime.server.ts'
|
|
12
|
+
* convertToServerModulePath('file:///path/to/text/index.ts') // '/path/to/text/index.server.ts'
|
|
9
13
|
*/
|
|
10
14
|
function convertToServerModulePath(metaUrl) {
|
|
11
15
|
try {
|
|
12
16
|
// Convert file:// URL to file path
|
|
13
17
|
const filePath = fileURLToPath(metaUrl);
|
|
18
|
+
const dir = dirname(filePath);
|
|
14
19
|
// Get the filename without extension
|
|
15
20
|
const baseName = filePath.replace(extname(filePath), '');
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const candidates = [join(dir, 'runtime.server'), `${baseName}.server`];
|
|
22
|
+
for (const candidate of candidates) {
|
|
23
|
+
for (const ext of ['.ts', '.js']) {
|
|
24
|
+
const fullPath = `${candidate}${ext}`;
|
|
25
|
+
if (existsSync(fullPath)) {
|
|
26
|
+
return fullPath;
|
|
27
|
+
}
|
|
23
28
|
}
|
|
24
29
|
}
|
|
25
30
|
return null;
|
|
@@ -35,8 +40,7 @@ function convertToServerModulePath(metaUrl) {
|
|
|
35
40
|
* @example
|
|
36
41
|
* const serverModule = await getFieldPrivateModule(fieldBuilder);
|
|
37
42
|
* if (serverModule) {
|
|
38
|
-
* serverModule.
|
|
39
|
-
* serverModule.toSchema({ name: 'title' })
|
|
43
|
+
* serverModule.toType(fieldBuilder)
|
|
40
44
|
* }
|
|
41
45
|
*/
|
|
42
46
|
export async function getFieldPrivateModule(field) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { t__ } from '../../../core/i18n/index.js';
|
|
3
|
+
import { fieldset } from '../../../panel/components/fields/fieldset.svelte.js';
|
|
3
4
|
import { Field } from '../../../panel/components/fields/index.js';
|
|
4
|
-
import { root } from '../../../panel/components/fields/root.svelte.js';
|
|
5
5
|
import Button from '../../../panel/components/ui/button/button.svelte';
|
|
6
6
|
import * as DropdownMenu from '../../../panel/components/ui/dropdown-menu/index.js';
|
|
7
7
|
import { Input } from '../../../panel/components/ui/input/index.js';
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
const primitiveTypes = ['url', 'email', 'tel', 'anchor'];
|
|
34
34
|
const field = $derived(form.useField<Link>(path, config));
|
|
35
|
-
const linkTypes = $derived(config.types
|
|
35
|
+
const linkTypes = $derived(config.get.types);
|
|
36
36
|
const initial = $derived(path ? form.getRawValue<Link>(path) : null);
|
|
37
37
|
|
|
38
38
|
let initialLinkType = $derived(initial?.type || linkTypes[0]);
|
|
@@ -99,9 +99,9 @@
|
|
|
99
99
|
</script>
|
|
100
100
|
|
|
101
101
|
<fieldset
|
|
102
|
-
class="rz-link-field {config.className}"
|
|
103
|
-
data-compact={config.layout === 'compact' ? '' : null}
|
|
104
|
-
use:
|
|
102
|
+
class="rz-link-field {config.get.className}"
|
|
103
|
+
data-compact={config.get.layout === 'compact' ? '' : null}
|
|
104
|
+
use:fieldset={field}
|
|
105
105
|
>
|
|
106
106
|
<Field.Label {config} for={path || config.name} />
|
|
107
107
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { LinkFieldBuilder } from '../index.js';
|
|
3
3
|
export type LinkFieldProps = {
|
|
4
4
|
path: string;
|
|
5
|
-
config:
|
|
5
|
+
config: LinkFieldBuilder;
|
|
6
6
|
form: DocumentFormContext;
|
|
7
7
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DataType } from '../../core/fields/builders/form-field-builder.js';
|
|
1
2
|
import { FormFieldBuilder } from '../../core/fields/builders/form-field-builder.js';
|
|
2
3
|
import type { DefaultValueFn, FormField } from '../types.js';
|
|
3
4
|
import type { Link, LinkType } from './types.js';
|
|
@@ -10,9 +11,11 @@ export declare class LinkFieldBuilder extends FormFieldBuilder<LinkField> {
|
|
|
10
11
|
}, {}, "">;
|
|
11
12
|
layout(str: 'compact' | 'default'): this;
|
|
12
13
|
defaultValue(value: Link | DefaultValueFn<Link>): this;
|
|
14
|
+
get dataType(): DataType;
|
|
13
15
|
types(...values: LinkType[]): this;
|
|
14
16
|
static readonly sanitize: (link: unknown) => Link | undefined;
|
|
15
17
|
compile(): {
|
|
18
|
+
name: string;
|
|
16
19
|
type: "link";
|
|
17
20
|
live?: boolean | undefined;
|
|
18
21
|
condition?: ((doc: any, siblings: any) => boolean) | undefined;
|
|
@@ -25,7 +28,6 @@ export declare class LinkFieldBuilder extends FormFieldBuilder<LinkField> {
|
|
|
25
28
|
read: import("../types.js").FieldAccess;
|
|
26
29
|
update: import("../types.js").FieldAccess;
|
|
27
30
|
};
|
|
28
|
-
name: string;
|
|
29
31
|
hidden?: boolean | undefined;
|
|
30
32
|
validate?: import("../types.js").FieldValidationFunc<any> | undefined;
|
|
31
33
|
required?: boolean | undefined;
|
|
@@ -52,6 +54,7 @@ export declare class LinkFieldBuilder extends FormFieldBuilder<LinkField> {
|
|
|
52
54
|
url?: string | undefined;
|
|
53
55
|
} | undefined;
|
|
54
56
|
isEmpty: (value: unknown) => boolean;
|
|
57
|
+
_root?: boolean | undefined;
|
|
55
58
|
layout: "compact" | "default";
|
|
56
59
|
types: "tel"[] | "email"[] | "url"[] | "anchor"[];
|
|
57
60
|
} & {
|
|
@@ -3,6 +3,9 @@ import { sanitize } from '../../util/string.js';
|
|
|
3
3
|
import validate from '../../util/validate.js';
|
|
4
4
|
import Cell from './component/Cell.svelte';
|
|
5
5
|
import LinkComp from './component/Link.svelte';
|
|
6
|
+
// @ts-expect-error — resolved at build time by the rime Vite plugin to either
|
|
7
|
+
// relation/runtime.server.ts (real check) or relation/runtime.ts (client no-op)
|
|
8
|
+
import { populateRessourceURL } from '$rime/runtime';
|
|
6
9
|
export class LinkFieldBuilder extends FormFieldBuilder {
|
|
7
10
|
//
|
|
8
11
|
_metaUrl = import.meta.url;
|
|
@@ -13,16 +16,9 @@ export class LinkFieldBuilder extends FormFieldBuilder {
|
|
|
13
16
|
this.field.layout = 'default';
|
|
14
17
|
this.field.types = ['url'];
|
|
15
18
|
this.field.hooks = {
|
|
16
|
-
beforeSave: [LinkFieldBuilder.sanitize]
|
|
19
|
+
beforeSave: [LinkFieldBuilder.sanitize],
|
|
20
|
+
beforeRead: [populateRessourceURL]
|
|
17
21
|
};
|
|
18
|
-
if (import.meta.env.SSR && import.meta.url) {
|
|
19
|
-
import('./index.server.js').then((module) => {
|
|
20
|
-
this.field.hooks = {
|
|
21
|
-
...this.field.hooks,
|
|
22
|
-
beforeRead: [module.populateRessourceURL]
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
22
|
}
|
|
27
23
|
get component() {
|
|
28
24
|
return LinkComp;
|
|
@@ -38,6 +34,9 @@ export class LinkFieldBuilder extends FormFieldBuilder {
|
|
|
38
34
|
this.field.defaultValue = value;
|
|
39
35
|
return this;
|
|
40
36
|
}
|
|
37
|
+
get dataType() {
|
|
38
|
+
return 'json';
|
|
39
|
+
}
|
|
41
40
|
types(...values) {
|
|
42
41
|
this.field.types = values;
|
|
43
42
|
return this;
|
|
@@ -46,7 +45,7 @@ export class LinkFieldBuilder extends FormFieldBuilder {
|
|
|
46
45
|
if (!link)
|
|
47
46
|
return undefined;
|
|
48
47
|
// Sanitize only the value and url properties of the link, other properties are left as is
|
|
49
|
-
const isLinkValue = (v) => typeof
|
|
48
|
+
const isLinkValue = (v) => typeof v === 'object' && !Array.isArray(v) && 'value' in v;
|
|
50
49
|
if (isLinkValue(link)) {
|
|
51
50
|
return {
|
|
52
51
|
...link,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const populateRessourceURL = async (link) => link;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ToType } from '../index.server.js';
|
|
2
2
|
import type { FieldHook, LinkField } from '../types.js';
|
|
3
3
|
import type { LinkFieldBuilder } from './index.js';
|
|
4
|
-
export declare const toSchema: ToSchema<LinkFieldBuilder>;
|
|
5
4
|
export declare const toType: ToType<LinkFieldBuilder>;
|
|
6
5
|
export declare const populateRessourceURL: FieldHook<LinkField>;
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import { templateUniqueRequired } from '../../adapter-sqlite/generate-schema/templates.server.js';
|
|
2
|
-
import { getSchemaColumnNames } from '../../adapter-sqlite/generate-schema/util.server.js';
|
|
3
1
|
import { RimeError } from '../../core/errors/index.js';
|
|
4
2
|
import { logger } from '../../core/logger/index.server.js';
|
|
5
3
|
import { trycatch } from '../../util/function.js';
|
|
6
|
-
export const toSchema = (field, parentPath) => {
|
|
7
|
-
const { camel, snake } = getSchemaColumnNames({ name: field.name, parentPath });
|
|
8
|
-
const suffix = templateUniqueRequired(field.raw, typeof field.raw.defaultValue === 'object' ? field.raw.defaultValue : {});
|
|
9
|
-
if (field._generateSchema)
|
|
10
|
-
return field._generateSchema({ camel, snake, suffix });
|
|
11
|
-
return `${camel}: text('${snake}', { mode: 'json'})${suffix}`;
|
|
12
|
-
};
|
|
13
4
|
export const toType = (field) => {
|
|
14
|
-
return `${field.name}${field.
|
|
15
|
-
type: ${field.
|
|
5
|
+
return `${field.name}${field.get.required ? '' : '?'}: {
|
|
6
|
+
type: ${field.get.types.map((t) => `'${t}'`).join(' | ')};
|
|
16
7
|
value: string | null;
|
|
17
8
|
target: '_self' | '_blank';
|
|
18
9
|
url?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { fieldset } from '../../../panel/components/fields/fieldset.svelte.js';
|
|
2
3
|
import { Field } from '../../../panel/components/fields/index.js';
|
|
3
|
-
import { root } from '../../../panel/components/fields/root.svelte.js';
|
|
4
4
|
import { ChevronDown, ChevronUp } from '@lucide/svelte';
|
|
5
5
|
import './number.css';
|
|
6
6
|
import type { NumberFieldProps } from './props';
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
const field = $derived(form.useField<number>(path, config));
|
|
11
11
|
|
|
12
12
|
const decrease = () => {
|
|
13
|
-
const minValue = config.min ?? -Infinity;
|
|
13
|
+
const minValue = config.get.min ?? -Infinity;
|
|
14
14
|
field.value = Math.max((field.value || 0) - 1, minValue);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
const increase = () => {
|
|
18
|
-
const maxValue = config.max ?? Infinity;
|
|
18
|
+
const maxValue = config.get.max ?? Infinity;
|
|
19
19
|
field.value = Math.min((field.value || 0) + 1, maxValue);
|
|
20
20
|
};
|
|
21
21
|
</script>
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
</button>
|
|
27
27
|
{/snippet}
|
|
28
28
|
|
|
29
|
-
<fieldset class="rz-number-field {config.className || ''}" use:
|
|
29
|
+
<fieldset class="rz-number-field {config.get.className || ''}" use:fieldset={field}>
|
|
30
30
|
<Field.Label {config} for={path || config.name} />
|
|
31
31
|
<div class="rz-number-field__input-wrapper">
|
|
32
32
|
<input
|
|
33
33
|
class="rz-number-field__input"
|
|
34
|
-
min={config.min ?? undefined}
|
|
35
|
-
max={config.max ?? undefined}
|
|
34
|
+
min={config.get.min ?? undefined}
|
|
35
|
+
max={config.get.max ?? undefined}
|
|
36
36
|
bind:value={field.value}
|
|
37
37
|
type="number"
|
|
38
38
|
/>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { NumberFieldBuilder } from '../index.js';
|
|
3
3
|
export type NumberFieldProps = {
|
|
4
4
|
path: string;
|
|
5
|
-
config:
|
|
5
|
+
config: NumberFieldBuilder;
|
|
6
6
|
form: DocumentFormContext;
|
|
7
7
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DataType } from '../../core/fields/builders/form-field-builder.js';
|
|
1
2
|
import { FormFieldBuilder } from '../../core/fields/builders/form-field-builder.js';
|
|
2
3
|
import type { DefaultValueFn, FieldValidationFunc, FormField } from '../types.js';
|
|
3
4
|
export declare const number: (name: string) => NumberFieldBuilder;
|
|
@@ -8,7 +9,9 @@ export declare class NumberFieldBuilder extends FormFieldBuilder<NumberField> {
|
|
|
8
9
|
defaultValue(value: number | DefaultValueFn<number>): this;
|
|
9
10
|
min(value: number): this;
|
|
10
11
|
max(value: number): this;
|
|
12
|
+
get dataType(): DataType;
|
|
11
13
|
compile(): {
|
|
14
|
+
name: string;
|
|
12
15
|
type: "number";
|
|
13
16
|
live?: boolean | undefined;
|
|
14
17
|
condition?: ((doc: any, siblings: any) => boolean) | undefined;
|
|
@@ -21,7 +24,6 @@ export declare class NumberFieldBuilder extends FormFieldBuilder<NumberField> {
|
|
|
21
24
|
read: import("../types.js").FieldAccess;
|
|
22
25
|
update: import("../types.js").FieldAccess;
|
|
23
26
|
};
|
|
24
|
-
name: string;
|
|
25
27
|
hidden?: boolean | undefined;
|
|
26
28
|
validate?: (FieldValidationFunc<any, import("../../util/types").Dic> & FieldValidationFunc<NumberField>) | undefined;
|
|
27
29
|
required?: boolean | undefined;
|
|
@@ -43,16 +45,15 @@ export declare class NumberFieldBuilder extends FormFieldBuilder<NumberField> {
|
|
|
43
45
|
} | undefined;
|
|
44
46
|
defaultValue?: number | DefaultValueFn<number> | undefined;
|
|
45
47
|
isEmpty: (value: unknown) => boolean;
|
|
48
|
+
_root?: boolean | undefined;
|
|
46
49
|
min?: number | undefined;
|
|
47
50
|
max?: number | undefined;
|
|
48
|
-
_root?: boolean | undefined;
|
|
49
51
|
} & {
|
|
50
52
|
component: import("svelte").Component<any>;
|
|
51
53
|
cell?: import("svelte").Component<{
|
|
52
54
|
value: any;
|
|
53
55
|
}> | null;
|
|
54
56
|
};
|
|
55
|
-
_root(): this;
|
|
56
57
|
}
|
|
57
58
|
/****************************************************/
|
|
58
59
|
export type NumberField = FormField & {
|
|
@@ -61,11 +62,4 @@ export type NumberField = FormField & {
|
|
|
61
62
|
max?: number;
|
|
62
63
|
defaultValue?: number | DefaultValueFn<number>;
|
|
63
64
|
validate?: FieldValidationFunc<NumberField>;
|
|
64
|
-
/**
|
|
65
|
-
* Force the field to be on the root table
|
|
66
|
-
* usefull for fields that should not be versioned
|
|
67
|
-
* ex: _parent for nested structures should always be on the root table to prevent
|
|
68
|
-
* different versions to have different parents
|
|
69
|
-
*/
|
|
70
|
-
_root?: boolean;
|
|
71
65
|
};
|
|
@@ -36,14 +36,13 @@ export class NumberFieldBuilder extends FormFieldBuilder {
|
|
|
36
36
|
this.field.max = value;
|
|
37
37
|
return this;
|
|
38
38
|
}
|
|
39
|
+
get dataType() {
|
|
40
|
+
return 'number';
|
|
41
|
+
}
|
|
39
42
|
compile() {
|
|
40
43
|
if (!this.field.defaultValue) {
|
|
41
44
|
this.field.defaultValue = this.field.min || 0;
|
|
42
45
|
}
|
|
43
46
|
return super.compile();
|
|
44
47
|
}
|
|
45
|
-
_root() {
|
|
46
|
-
this.field._root = true;
|
|
47
|
-
return this;
|
|
48
|
-
}
|
|
49
48
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ToType } from '../index.server.js';
|
|
2
2
|
import type { NumberFieldBuilder } from './index.js';
|
|
3
|
-
export declare const toSchema: ToSchema<NumberFieldBuilder>;
|
|
4
3
|
export declare const toType: ToType<NumberFieldBuilder>;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import { templateUniqueRequired } from '../../adapter-sqlite/generate-schema/templates.server.js';
|
|
2
|
-
import { getSchemaColumnNames } from '../../adapter-sqlite/generate-schema/util.server.js';
|
|
3
|
-
export const toSchema = (field, parentPath) => {
|
|
4
|
-
const { camel, snake } = getSchemaColumnNames({ name: field.name, parentPath });
|
|
5
|
-
const suffix = templateUniqueRequired(field.raw, typeof field.raw.defaultValue === 'number' ? field.raw.defaultValue : 0);
|
|
6
|
-
if (field._generateSchema)
|
|
7
|
-
return field._generateSchema({ camel, snake, suffix });
|
|
8
|
-
return `${camel}: real('${snake}')${suffix}`;
|
|
9
|
-
};
|
|
10
1
|
export const toType = (field) => {
|
|
11
|
-
return `${field.name}${field.
|
|
2
|
+
return `${field.name}${field.get.required ? '' : '?'}: number`;
|
|
12
3
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { fieldset } from '../../../panel/components/fields/fieldset.svelte.js';
|
|
2
3
|
import { Field } from '../../../panel/components/fields/index.js';
|
|
3
|
-
import { root } from '../../../panel/components/fields/root.svelte.js';
|
|
4
4
|
import { Label } from '../../../panel/components/ui/label/index.js';
|
|
5
5
|
import * as RadioGroup from '../../../panel/components/ui/radio-group/index.js';
|
|
6
6
|
import * as RadioRowGroup from '../../../panel/components/ui/radio-row-group/index.js';
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
16
|
<fieldset
|
|
17
|
-
class="rz-field-radio rz-field-radio--{config.layout} {config.className || ''}"
|
|
18
|
-
use:
|
|
17
|
+
class="rz-field-radio rz-field-radio--{config.get.layout} {config.get.className || ''}"
|
|
18
|
+
use:fieldset={field}
|
|
19
19
|
>
|
|
20
20
|
<Field.Label {config} for={path || config.name} />
|
|
21
21
|
|
|
22
|
-
{#if config.layout === 'row'}
|
|
22
|
+
{#if config.get.layout === 'row'}
|
|
23
23
|
<RadioRowGroup.Root bind:value={field.value} disabled={!field.editable}>
|
|
24
|
-
{#each config.options as option, index (index)}
|
|
24
|
+
{#each config.get.options as option, index (index)}
|
|
25
25
|
<div class="rz-radio__option">
|
|
26
26
|
<RadioRowGroup.Item value={option.value} id="{fieldId}-{index}" class="rz-radio__input">
|
|
27
27
|
{option.label || capitalize(option.value)}
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
</RadioRowGroup.Root>
|
|
32
32
|
{:else}
|
|
33
33
|
<RadioGroup.Root bind:value={field.value} class="rz-radio" disabled={!field.editable}>
|
|
34
|
-
{#each config.options as option, index (index)}
|
|
34
|
+
{#each config.get.options as option, index (index)}
|
|
35
35
|
<div class="rz-radio__option">
|
|
36
36
|
<RadioGroup.Item value={option.value} id="{fieldId}-{index}" class="rz-radio__input" />
|
|
37
37
|
<Label class="rz-radio__label" for="{fieldId}-{index}">
|
|
@@ -50,7 +50,6 @@
|
|
|
50
50
|
.rz-field-radio:not(.rz-field-radio--row) {
|
|
51
51
|
display: flex;
|
|
52
52
|
flex-direction: column;
|
|
53
|
-
/*gap: var(--rz-size-2);*/
|
|
54
53
|
|
|
55
54
|
:global {
|
|
56
55
|
.rz-radio__input {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { RadioFieldBuilder } from '../index.js';
|
|
3
3
|
export type RadioFieldProps = {
|
|
4
4
|
path: string;
|
|
5
|
-
config:
|
|
5
|
+
config: RadioFieldBuilder;
|
|
6
6
|
form: DocumentFormContext;
|
|
7
7
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ToType } from '../index.server.js';
|
|
2
2
|
import type { RadioFieldBuilder } from './index.js';
|
|
3
|
-
export declare const toSchema: ToSchema<RadioFieldBuilder>;
|
|
4
3
|
export declare const toType: ToType<RadioFieldBuilder>;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import { templateUniqueRequired } from '../../adapter-sqlite/generate-schema/templates.server.js';
|
|
2
|
-
import { getSchemaColumnNames } from '../../adapter-sqlite/generate-schema/util.server.js';
|
|
3
|
-
export const toSchema = (field, parentPath) => {
|
|
4
|
-
const { camel, snake } = getSchemaColumnNames({ name: field.raw.name, parentPath });
|
|
5
|
-
const suffix = templateUniqueRequired(field.raw, typeof field.raw.defaultValue === 'string' ? field.raw.defaultValue : '');
|
|
6
|
-
if (field._generateSchema)
|
|
7
|
-
return field._generateSchema({ camel, snake, suffix });
|
|
8
|
-
return `${camel}: text('${snake}')${suffix}`;
|
|
9
|
-
};
|
|
10
1
|
export const toType = (field) => {
|
|
11
|
-
const optionsString = field.
|
|
12
|
-
return `${field.
|
|
2
|
+
const optionsString = field.get.options.map((option) => `'${option.value}'`).join(' | ');
|
|
3
|
+
return `${field.name}${field.get.required ? '' : '?'}: ${optionsString}`;
|
|
13
4
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { isUploadConfig } from '../../../core/collections/upload/util/config.js';
|
|
3
3
|
import type { GenericDoc } from '../../../core/types/doc.js';
|
|
4
|
+
import { fieldset } from '../../../panel/components/fields/fieldset.svelte.js';
|
|
4
5
|
import { Field } from '../../../panel/components/fields/index.js';
|
|
5
|
-
import { root } from '../../../panel/components/fields/root.svelte.js';
|
|
6
6
|
import { getCollectionContext } from '../../../panel/context/collection.svelte.js';
|
|
7
7
|
import { getConfigContext } from '../../../panel/context/config.svelte.js';
|
|
8
8
|
import { type DocumentFormContext } from '../../../panel/context/documentForm.svelte.js';
|
|
@@ -13,13 +13,17 @@
|
|
|
13
13
|
import { apiUrl } from '../../../util/index.js';
|
|
14
14
|
import { snapshot } from '../../../util/state.js';
|
|
15
15
|
import { getAPIProxyContext } from '../../../panel/context/api-proxy.svelte.js';
|
|
16
|
-
import type { Relation,
|
|
16
|
+
import type { Relation, RelationFieldBuilder } from '../index.js';
|
|
17
17
|
import Default from './default/Default.svelte';
|
|
18
18
|
import type { RelationFieldItem } from './types.js';
|
|
19
19
|
import Upload from './upload/Upload.svelte';
|
|
20
20
|
|
|
21
21
|
// Props
|
|
22
|
-
type Props = {
|
|
22
|
+
type Props = {
|
|
23
|
+
path: string;
|
|
24
|
+
config: RelationFieldBuilder;
|
|
25
|
+
form: DocumentFormContext | FormContext;
|
|
26
|
+
};
|
|
23
27
|
const { path, config, form }: Props = $props();
|
|
24
28
|
|
|
25
29
|
// Context
|
|
@@ -28,7 +32,7 @@
|
|
|
28
32
|
const APIProxy = getAPIProxyContext();
|
|
29
33
|
const field = $derived(form.useField(path, config));
|
|
30
34
|
// svelte-ignore state_referenced_locally
|
|
31
|
-
const relationConfig = getCollection(config.relationTo);
|
|
35
|
+
const relationConfig = getCollection(config.get.relationTo);
|
|
32
36
|
const relationCollectionCtx = getCollectionContext(relationConfig.slug);
|
|
33
37
|
|
|
34
38
|
let initialized = $state(false);
|
|
@@ -45,7 +49,7 @@
|
|
|
45
49
|
const nothingToSelect = $derived(initialItems.length === 0);
|
|
46
50
|
|
|
47
51
|
let isFull = $derived.by(() => {
|
|
48
|
-
if (!config.many) {
|
|
52
|
+
if (!config.get.many) {
|
|
49
53
|
if (selectedItems.length === 1) return true;
|
|
50
54
|
} else {
|
|
51
55
|
if (availableItems.length === 0 && selectedItems.length > 0) {
|
|
@@ -94,16 +98,16 @@
|
|
|
94
98
|
}
|
|
95
99
|
|
|
96
100
|
// Add custom query parameters if provided
|
|
97
|
-
if (config.query) {
|
|
98
|
-
if (typeof config.query === 'string') {
|
|
101
|
+
if (config.get.query) {
|
|
102
|
+
if (typeof config.get.query === 'string') {
|
|
99
103
|
// Parse the query string and add each parameter
|
|
100
|
-
const queryParams = new URLSearchParams(config.query);
|
|
104
|
+
const queryParams = new URLSearchParams(config.get.query);
|
|
101
105
|
queryParams.forEach((value, key) => {
|
|
102
106
|
url.searchParams.append(key, value);
|
|
103
107
|
});
|
|
104
|
-
} else if (typeof config.query === 'function') {
|
|
108
|
+
} else if (typeof config.get.query === 'function') {
|
|
105
109
|
// Parse the function result and add each parameter
|
|
106
|
-
const queryString = config.query(form.values);
|
|
110
|
+
const queryString = config.get.query(form.values);
|
|
107
111
|
const queryParams = new URLSearchParams(queryString);
|
|
108
112
|
queryParams.forEach((value, key) => {
|
|
109
113
|
url.searchParams.append(key, value);
|
|
@@ -159,12 +163,12 @@
|
|
|
159
163
|
const relations = selectedItems.map((item, index) => {
|
|
160
164
|
let relation: Omit<Relation, 'ownerId'> = {
|
|
161
165
|
id: item.id,
|
|
162
|
-
relationTo: config.relationTo,
|
|
166
|
+
relationTo: config.get.relationTo,
|
|
163
167
|
path,
|
|
164
168
|
position: index,
|
|
165
169
|
documentId: item.documentId
|
|
166
170
|
};
|
|
167
|
-
if (config.localized) {
|
|
171
|
+
if (config.get.localized) {
|
|
168
172
|
relation.locale = locale.code;
|
|
169
173
|
}
|
|
170
174
|
if ('isLive' in form && form.isLive) {
|
|
@@ -236,13 +240,13 @@
|
|
|
236
240
|
const RelationComponent = isRelationToUpload ? Upload : Default;
|
|
237
241
|
</script>
|
|
238
242
|
|
|
239
|
-
<fieldset class="rz-field-relation {config.className || ''}" use:
|
|
243
|
+
<fieldset class="rz-field-relation {config.get.className || ''}" use:fieldset={field}>
|
|
240
244
|
<Field.Label {config} for={path || config.name} />
|
|
241
245
|
<Field.Hint {config} />
|
|
242
246
|
|
|
243
247
|
<RelationComponent
|
|
244
248
|
{path}
|
|
245
|
-
many={!!config.many}
|
|
249
|
+
many={!!config.get.many}
|
|
246
250
|
hasError={!!field.error}
|
|
247
251
|
formNestedLevel={'nestedLevel' in form ? form.nestedLevel : 0}
|
|
248
252
|
readOnly={form.readOnly}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type DocumentFormContext } from '../../../panel/context/documentForm.svelte.js';
|
|
2
2
|
import type { FormContext } from '../../../panel/context/form.svelte.js';
|
|
3
|
-
import type { Relation,
|
|
3
|
+
import type { Relation, RelationFieldBuilder } from '../index.js';
|
|
4
4
|
type Props = {
|
|
5
5
|
path: string;
|
|
6
|
-
config:
|
|
6
|
+
config: RelationFieldBuilder;
|
|
7
7
|
form: DocumentFormContext | FormContext;
|
|
8
8
|
};
|
|
9
9
|
declare const Relation: import("svelte").Component<Props, {}, "">;
|