mirror of
https://github.com/directus/directus.git
synced 2026-01-24 04:58:08 -05:00
fix sortField selection (#16379)
This commit is contained in:
@@ -64,6 +64,7 @@
|
||||
<v-divider large :inline-title="false">{{ t('sort_field') }}</v-divider>
|
||||
<related-field-select
|
||||
v-model="sortField"
|
||||
:type-allow-list="['integer', 'bigInteger', 'float', 'decimal']"
|
||||
:disabled-fields="unsortableJunctionFields"
|
||||
:collection="junctionCollection"
|
||||
:placeholder="t('add_sort_field')"
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
<related-field-select
|
||||
v-model="sortField"
|
||||
:collection="junctionCollection"
|
||||
:type-allow-list="['integer', 'bigInteger', 'float', 'decimal']"
|
||||
:disabled-fields="unsortableJunctionFields"
|
||||
:placeholder="t('add_sort_field') + '...'"
|
||||
:nullable="true"
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<related-field-select
|
||||
v-model="sortField"
|
||||
:collection="relatedCollection"
|
||||
:type-allow-list="['integer', 'bigInteger', 'float', 'decimal']"
|
||||
:disabled-fields="unsortableJunctionFields"
|
||||
:placeholder="t('add_sort_field') + '...'"
|
||||
:nullable="true"
|
||||
@@ -142,7 +143,7 @@ export default defineComponent({
|
||||
const currentPrimaryKey = computed(() => fieldsStore.getPrimaryKeyFieldForCollection(collection.value!)?.field);
|
||||
|
||||
const unsortableJunctionFields = computed(() => {
|
||||
let fields = ['item', 'collection'];
|
||||
let fields = [];
|
||||
if (relatedCollection.value) {
|
||||
const relations = relationsStore.getRelationsForCollection(relatedCollection.value);
|
||||
fields.push(...relations.map((field) => field.field));
|
||||
|
||||
@@ -65,6 +65,10 @@ export default defineComponent({
|
||||
type: Array as PropType<string[]>,
|
||||
default: () => [],
|
||||
},
|
||||
typeAllowList: {
|
||||
type: Array as PropType<string[]>,
|
||||
default: () => [],
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: () => i18n.global.t('foreign_key') + '...',
|
||||
@@ -89,7 +93,8 @@ export default defineComponent({
|
||||
!field.schema ||
|
||||
!!field.schema?.is_primary_key ||
|
||||
props.disabledFields.includes(field.field) ||
|
||||
props.typeDenyList.includes(field.type),
|
||||
props.typeDenyList.includes(field.type) ||
|
||||
!props.typeAllowList.includes(field.type),
|
||||
}));
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user