feat: relation field and picker

This commit is contained in:
Florian Sylvain committed 2026-10-23 00:13:42 +02:00
1 parent b45c99be3b
commit 37a77c9c22
92 files changed
+6826 -80

No files matched your search

+9
View File
@@ -1,4 +1,5 @@
import { FIELD_TYPE_SPECS, FIELD_TYPES, type FieldType } from '@/lib/fieldTypes'
import { DEFAULT_RELATION_KIND, type RelationKind } from '@/lib/relationField'
export { FIELD_TYPES, type FieldType }
export type KeyMode = 'auto' | 'manual'
@@ -39,6 +40,8 @@ export interface BuilderField {
min: string
max: string
options: string[]
relationType: string
relationKind: RelationKind
saved: boolean
}
@@ -71,6 +74,8 @@ export function createField(uid: number, overrides: Partial<BuilderField> = {}):
min: '',
max: '',
options: [],
relationType: '',
relationKind: DEFAULT_RELATION_KIND,
saved: false,
...overrides,
}
@@ -111,6 +116,10 @@ export function supportsChoices(type: FieldType) {
return FIELD_TYPE_SPECS[type].supportsChoices
}
export function holdsRelation(type: FieldType) {
return FIELD_TYPE_SPECS[type].holdsRelation
}
export function supportsLimits(type: FieldType) {
return FIELD_TYPE_SPECS[type].supportsLimits
}