mirror of
https://github.com/directus/directus.git
synced 2026-01-28 18:57:56 -05:00
Disable fields that are groups to be selected in field list (#12539)
* By default disable fields that are groups to be selected in field list, since they anyways can't be filtered on. * Don't include functions for group fields. Refactor FieldInfo to extend already defined FieldNode type Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
This commit is contained in:
@@ -58,17 +58,12 @@ export default {
|
||||
|
||||
<script lang="ts" setup>
|
||||
import formatTitle from '@directus/format-title';
|
||||
import { Type } from '@directus/shared/types';
|
||||
import { getFunctionsForType } from '@directus/shared/utils';
|
||||
import { FieldNode } from '@/composables/use-field-tree';
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
type FieldInfo = {
|
||||
field: string;
|
||||
name: string;
|
||||
key: string;
|
||||
path: string;
|
||||
type: Type;
|
||||
type FieldInfo = FieldNode & {
|
||||
disabled?: boolean;
|
||||
children?: FieldInfo[];
|
||||
};
|
||||
@@ -86,7 +81,7 @@ defineEmits(['add']);
|
||||
const { t } = useI18n();
|
||||
|
||||
const supportedFunctions = computed(() => {
|
||||
if (!props.includeFunctions) return [];
|
||||
if (!props.includeFunctions || props.field.group) return [];
|
||||
return getFunctionsForType(props.field.type);
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -72,7 +72,7 @@ const treeList = computed(() => {
|
||||
function setDisabled(
|
||||
field: typeof treeListOriginal.value[number]
|
||||
): typeof treeListOriginal.value[number] & { disabled: boolean } {
|
||||
let disabled = false;
|
||||
let disabled = field.group || false;
|
||||
|
||||
if (props.disabledFields?.includes(field.key)) disabled = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user