Files
summercms/admin/src/components/form/FieldRenderer.vue
Jakub Zych 83fa2f7b2c feat(16.2-01): host plugin field type elements in the admin SPA
- loadFieldTypes fetches GET /field-types after sign-in, loads each script
  once and adds the styles as global links activateStyles never disables
- PluginField creates the type's element, sets the value property and the
  contract attributes, takes summer-change as the form value and never
  writes back a value the element just emitted
- rendererForField and isRegisteredField route any field with an element
  to PluginField in forms, previews and the save payload
- rebuilt modules/boardwalk/dist
2026-10-10 11:10:41 +02:00

28 lines
850 B
Vue

<script setup lang="ts">
import { computed } from 'vue'
import { rendererForField, type FieldControlProps } from './registry'
// Picks the control for the field from the registry (D-05; a plugin field
// type's element host when the field names an element) and forwards the
// shared control props and the value update.
const props = defineProps<FieldControlProps>()
const emit = defineEmits<{ 'update:modelValue': [value: unknown] }>()
const control = computed(() => rendererForField(props.field))
</script>
<template>
<component
:is="control"
:field="field"
:model-value="modelValue"
:control-id="controlId"
:invalid="invalid"
:described-by="describedBy"
:labels="labels"
:source="source"
:record-id="recordId"
@update:model-value="(value: unknown) => emit('update:modelValue', value)"
/>
</template>