mirror of
https://github.com/directus/directus.git
synced 2026-02-13 02:05:33 -05:00
* Add conditions field to directus_fields * Add conditions configuration * Apply conditional overrides * Handle conditions in nested groups * Fix reverse mutating conditions * Start on filter setup interface * Move field types/constants to shared * [WIP] Updated client side filter validation * Support logical operators in client validation step * Use new validation util in conditions check * Add nesting in filter seutp * Add filter rule setup configurator * Fixes that should've been done in the merge * Strip out filter-settings interface TBD in a new PR * Move browser to index
86 lines
1.8 KiB
Vue
86 lines
1.8 KiB
Vue
<template>
|
|
<v-notice v-if="!selectedInterface">
|
|
{{ t('select_interface') }}
|
|
</v-notice>
|
|
|
|
<v-notice v-else-if="!selectedInterface.options">
|
|
{{ t('no_options_available') }}
|
|
</v-notice>
|
|
|
|
<div v-else class="inset">
|
|
<v-form
|
|
v-if="Array.isArray(selectedInterface.options)"
|
|
:fields="selectedInterface.options"
|
|
primary-key="+"
|
|
:model-value="value"
|
|
@update:model-value="$emit('input', $event)"
|
|
/>
|
|
|
|
<component
|
|
:is="`interface-options-${selectedInterface.id}`"
|
|
v-else
|
|
:value="value"
|
|
@input="$emit('input', $event)"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { useI18n } from 'vue-i18n';
|
|
import { defineComponent, computed, inject, ref } from 'vue';
|
|
import { getInterfaces } from '@/interfaces';
|
|
import { InterfaceConfig } from '@directus/shared/types';
|
|
|
|
export default defineComponent({
|
|
props: {
|
|
value: {
|
|
type: Object,
|
|
default: null,
|
|
},
|
|
interfaceField: {
|
|
type: String,
|
|
default: null,
|
|
},
|
|
interface: {
|
|
type: String,
|
|
default: null,
|
|
},
|
|
},
|
|
emits: ['input'],
|
|
setup(props) {
|
|
const { t } = useI18n();
|
|
|
|
const { interfaces } = getInterfaces();
|
|
|
|
const values = inject('values', ref<Record<string, any>>({}));
|
|
|
|
const selectedInterface = computed(() => {
|
|
if (props.interface) {
|
|
return interfaces.value.find((inter: InterfaceConfig) => inter.id === props.interface);
|
|
}
|
|
|
|
if (!values.value[props.interfaceField]) return;
|
|
|
|
return interfaces.value.find((inter: InterfaceConfig) => inter.id === values.value[props.interfaceField]);
|
|
});
|
|
|
|
return { t, selectedInterface, values };
|
|
},
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.inset {
|
|
--form-horizontal-gap: 24px;
|
|
--form-vertical-gap: 24px;
|
|
|
|
padding: 12px;
|
|
border: var(--border-width) solid var(--border-normal);
|
|
border-radius: var(--border-radius);
|
|
|
|
:deep(.type-label) {
|
|
font-size: 1rem;
|
|
}
|
|
}
|
|
</style>
|