feat(persons): add type selector + title + conditional fields to edit form
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,11 @@ import { m } from '$lib/paraglide/messages.js';
|
||||
const TYPES = ['PERSON', 'INSTITUTION', 'GROUP', 'UNKNOWN'] as const;
|
||||
type PersonType = (typeof TYPES)[number];
|
||||
|
||||
let { value = 'PERSON', name = 'personType' }: { value?: string; name?: string } = $props();
|
||||
let {
|
||||
value = 'PERSON',
|
||||
name = 'personType',
|
||||
onchange
|
||||
}: { value?: string; name?: string; onchange?: (type: PersonType) => void } = $props();
|
||||
|
||||
let selected = $state<PersonType>(
|
||||
untrack(() => (TYPES.includes(value as PersonType) ? (value as PersonType) : 'PERSON'))
|
||||
@@ -21,6 +25,7 @@ const labels: Record<PersonType, () => string> = {
|
||||
|
||||
function select(type: PersonType) {
|
||||
selected = type;
|
||||
onchange?.(type);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user