feat: relation field and picker
This commit is contained in:
1 parent
b45c99be3b
commit
37a77c9c22
92 files changed
+6826
-80
No files matched your search
@@ -6,6 +6,7 @@ import { useEntryForm } from '@/composables/useEntryForm'
|
||||
import { useEntryLoad } from '@/composables/useEntryLoad'
|
||||
import type { ContentEntry } from '@/lib/contentTypes'
|
||||
import type { MediaSummary } from '@/lib/mediaField'
|
||||
import type { RelationSummary } from '@/lib/relationField'
|
||||
import { resolveEditorPhase, type EntryTarget } from '@/lib/entryEditorState'
|
||||
import { buildData, issueFor, validateEntry } from '@/lib/entryForm'
|
||||
import { classifyRefusal, isGoneError, parseEntryRefusal } from '@/lib/entryServerError'
|
||||
@@ -92,7 +93,12 @@ export function useEntryDraft(typeKey: string, target: EntryTarget) {
|
||||
return null
|
||||
}
|
||||
failure.value = 'none'
|
||||
const issues = validateEntry(fields.value, form.values.value, form.images.value)
|
||||
const issues = validateEntry(
|
||||
fields.value,
|
||||
form.values.value,
|
||||
form.images.value,
|
||||
form.relations.value,
|
||||
)
|
||||
if (Object.keys(issues).length > 0) {
|
||||
form.reject(issues)
|
||||
focusToken.value++
|
||||
@@ -114,8 +120,13 @@ export function useEntryDraft(typeKey: string, target: EntryTarget) {
|
||||
}
|
||||
}
|
||||
|
||||
function change(key: string, value: unknown, image?: MediaSummary | null) {
|
||||
form.setValue(key, value, image)
|
||||
function change(
|
||||
key: string,
|
||||
value: unknown,
|
||||
image?: MediaSummary | null,
|
||||
summaries?: RelationSummary[],
|
||||
) {
|
||||
form.setValue(key, value, image, summaries)
|
||||
}
|
||||
|
||||
function reload() {
|
||||
|
||||
Reference in new issue
Block a user