mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Fix nested group key path for m2o fields
This commit is contained in:
@@ -6,14 +6,16 @@
|
||||
@click="$emit('add', field.key)"
|
||||
>
|
||||
<v-list-item-content>
|
||||
<v-text-overflow :text="field.name || formatTitle(field.field)" :highlight="search" />
|
||||
{{ field.key }}
|
||||
<!-- <v-text-overflow :text="field.name || formatTitle(field.field)" :highlight="search" /> -->
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
|
||||
<v-list-group v-else :clickable="!field.disabled" :value="field.key" @click="$emit('add', field.key)">
|
||||
<v-list-group v-else :clickable="!field.disabled" :value="field.path" @click="$emit('add', field.key)">
|
||||
<template #activator>
|
||||
<v-list-item-content>
|
||||
<v-text-overflow :text="field.name || formatTitle(field.field)" :highlight="search" />
|
||||
{{ field.key }}
|
||||
<!-- <v-text-overflow :text="field.name || formatTitle(field.field)" :highlight="search" /> -->
|
||||
</v-list-item-content>
|
||||
</template>
|
||||
|
||||
@@ -40,6 +42,7 @@ type FieldInfo = {
|
||||
field: string;
|
||||
name: string;
|
||||
key: string;
|
||||
path: string;
|
||||
disabled?: boolean;
|
||||
children?: FieldInfo[];
|
||||
};
|
||||
|
||||
@@ -10,6 +10,7 @@ export type FieldNode = {
|
||||
collection: string;
|
||||
relatedCollection?: string;
|
||||
key: string;
|
||||
path: string;
|
||||
children?: FieldNode[];
|
||||
group?: boolean;
|
||||
};
|
||||
@@ -71,7 +72,8 @@ export function useFieldTree(
|
||||
|
||||
function makeNode(field: Field, allFields: Field[], parent?: FieldNode): FieldNode | FieldNode[] {
|
||||
const relatedCollections = getRelatedCollections(field);
|
||||
const context = parent ? parent.key + '.' : '';
|
||||
const pathContext = parent ? parent.path + '.' : '';
|
||||
const keyContext = parent && !parent.group ? parent.key + '.' : '';
|
||||
|
||||
if (field?.meta?.special?.includes('group')) {
|
||||
const node: FieldNode = {
|
||||
@@ -79,7 +81,8 @@ export function useFieldTree(
|
||||
field: field.field,
|
||||
collection: field.collection,
|
||||
relatedCollection: undefined,
|
||||
key: context + field.field,
|
||||
key: field.field,
|
||||
path: pathContext + field.field,
|
||||
group: true,
|
||||
};
|
||||
|
||||
@@ -95,7 +98,8 @@ export function useFieldTree(
|
||||
field: field.field,
|
||||
collection: field.collection,
|
||||
relatedCollection: relatedCollections[0],
|
||||
key: context + field.field,
|
||||
key: keyContext + field.field,
|
||||
path: pathContext + field.field,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -105,7 +109,8 @@ export function useFieldTree(
|
||||
field: `${field.field}:${collection}`,
|
||||
collection: field.collection,
|
||||
relatedCollection: collection,
|
||||
key: context + `${field.field}:${collection}`,
|
||||
key: keyContext + `${field.field}:${collection}`,
|
||||
path: pathContext + `${field.field}:${collection}`,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user