diff --git a/frontend/src/components/AdminConfigValueEditor.vue b/frontend/src/components/AdminConfigValueEditor.vue index 74bf46f..fe4a758 100644 --- a/frontend/src/components/AdminConfigValueEditor.vue +++ b/frontend/src/components/AdminConfigValueEditor.vue @@ -9,6 +9,7 @@ import { import { computed, ref } from 'vue' import type { AdminConfiguratorStructure } from '@/types/admin' +import type { AdminConfiguratorDescribe } from '@/utils/adminConfiguratorDescription' export type AdminConfigEditorLabels = { addField: string @@ -19,6 +20,7 @@ export type AdminConfigEditorLabels = { convertToTable: string emptyList: string emptyTable: string + entry: string keyPlaceholder: string list: string remove: string @@ -39,12 +41,14 @@ const props = withDefaults( defineProps<{ ariaLabel?: string depth?: number + describe: AdminConfiguratorDescribe disabled?: boolean labels: AdminConfigEditorLabels modelValue: unknown + path?: string structure?: AdminConfiguratorStructure }>(), - { ariaLabel: '', depth: 0, disabled: false }, + { ariaLabel: '', depth: 0, disabled: false, path: '' }, ) const emit = defineEmits<{ 'update:modelValue': [value: unknown] }>() @@ -211,6 +215,18 @@ function toggleStructuredEntry(entry: string): void { expandedEntry.value = expandedEntry.value === entry ? null : entry } +function tableEntryPath(key: string): string { + return props.path ? `${props.path}.${key}` : key +} + +function listEntryPath(index: number): string { + return `${props.path || props.ariaLabel}[${index + 1}]` +} + +function mapValuePath(entry: SerializedMapEntry): string { + return props.path ? `${props.path}.${entry.key}` : String(entry.key) +} + function blankFromStructure(structure: AdminConfiguratorStructure): unknown { if (structure.kind === 'optionalString') return '' if (structure.kind === 'value') return blankValue(structure.valueType) @@ -493,12 +509,33 @@ function mapEntryStructure( :aria-expanded="expandedEntry === `list:${index}`" @click="toggleStructuredEntry(`list:${index}`)" > - {{ labels.list }} {{ index + 1 }} - {{ - structuredValueLabel(row, listStructure?.items[index]) - }} + + {{ labels.entry }} {{ index + 1 }} + + {{ + describe(listEntryPath(index), row, listStructure?.items[index]) + }} + + + {{ structuredValueLabel(row, listStructure?.items[index]) }} + + {{ labels.entry }} {{ index + 1 }} + + {{ + describe(listEntryPath(index), row, listStructure?.items[index]) + }} + + - {{ key }} + + {{ key }} + + {{ describe(tableEntryPath(key), value, tableFieldStructure(key)) }} + +