mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Pass field context to interface-options in conditions (#19147)
Fixes #19145
This commit is contained in:
6
.changeset/breezy-emus-repair.md
Normal file
6
.changeset/breezy-emus-repair.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@directus/app': patch
|
||||
---
|
||||
|
||||
Fixed issue that caused interface options within conditions to operate against a different field context, making some
|
||||
options unavailable
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useExtension } from '@/composables/use-extension';
|
||||
import { ExtensionOptionsContext } from '@directus/types';
|
||||
import { isVueComponent } from '@directus/utils';
|
||||
import { computed, inject, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@@ -39,6 +40,7 @@ const props = defineProps<{
|
||||
interface?: string;
|
||||
collection?: string;
|
||||
disabled?: boolean;
|
||||
context?: ExtensionOptionsContext;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -73,32 +75,34 @@ const optionsFields = computed(() => {
|
||||
let optionsObjectOrArray;
|
||||
|
||||
if (typeof selectedInterface.value.options === 'function') {
|
||||
optionsObjectOrArray = selectedInterface.value.options({
|
||||
field: {
|
||||
type: 'unknown',
|
||||
},
|
||||
editing: '+',
|
||||
collection: props.collection,
|
||||
relations: {
|
||||
o2m: undefined,
|
||||
m2o: undefined,
|
||||
m2a: undefined,
|
||||
},
|
||||
collections: {
|
||||
related: undefined,
|
||||
junction: undefined,
|
||||
},
|
||||
fields: {
|
||||
corresponding: undefined,
|
||||
junctionCurrent: undefined,
|
||||
junctionRelated: undefined,
|
||||
sort: undefined,
|
||||
},
|
||||
items: {},
|
||||
localType: 'standard',
|
||||
autoGenerateJunctionRelation: false,
|
||||
saving: false,
|
||||
});
|
||||
optionsObjectOrArray = selectedInterface.value.options(
|
||||
props.context ?? {
|
||||
field: {
|
||||
type: 'unknown',
|
||||
},
|
||||
editing: '+',
|
||||
collection: props.collection,
|
||||
relations: {
|
||||
o2m: undefined,
|
||||
m2o: undefined,
|
||||
m2a: undefined,
|
||||
},
|
||||
collections: {
|
||||
related: undefined,
|
||||
junction: undefined,
|
||||
},
|
||||
fields: {
|
||||
corresponding: undefined,
|
||||
junctionCurrent: undefined,
|
||||
junctionRelated: undefined,
|
||||
sort: undefined,
|
||||
},
|
||||
items: {},
|
||||
localType: 'standard',
|
||||
autoGenerateJunctionRelation: false,
|
||||
saving: false,
|
||||
}
|
||||
);
|
||||
} else {
|
||||
optionsObjectOrArray = selectedInterface.value.options;
|
||||
}
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, unref } from 'vue';
|
||||
import { Field, DeepPartial } from '@directus/types';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useFieldDetailStore, syncFieldDetailStoreProperty } from '../store';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useExtension } from '@/composables/use-extension';
|
||||
import { DeepPartial, Field } from '@directus/types';
|
||||
import { isVueComponent } from '@directus/utils';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed, unref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { syncFieldDetailStoreProperty, useFieldDetailStore } from '../store';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -92,6 +92,7 @@ const repeaterFields = computed<DeepPartial<Field>[]>(() => [
|
||||
interface: 'system-interface-options',
|
||||
options: {
|
||||
interface: interfaceId.value,
|
||||
context: fieldDetailStore,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user