mirror of
https://github.com/directus/directus.git
synced 2026-01-30 21:57:58 -05:00
Use dropdown for boolean default value
This commit is contained in:
@@ -52,7 +52,9 @@
|
||||
:disabled="item.disabled"
|
||||
@click="multiple ? null : $emit('input', item.value)"
|
||||
>
|
||||
<v-list-item-icon v-if="multiple === false && allowOther === false && itemIcon !== null && item.icon">
|
||||
<v-list-item-icon
|
||||
v-if="multiple === false && allowOther === false && itemIcon !== null && item.icon"
|
||||
>
|
||||
<v-icon :name="item.icon" />
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
@@ -119,8 +121,8 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, PropType, computed, toRefs, Ref } from '@vue/composition-api';
|
||||
import i18n from '@/lang';
|
||||
import { useCustomSelection, useCustomSelectionMultiple } from '@/composables/use-custom-selection';
|
||||
import i18n from '../../lang';
|
||||
import { useCustomSelection, useCustomSelectionMultiple } from '../../composables/use-custom-selection';
|
||||
|
||||
type Item = {
|
||||
text: string;
|
||||
@@ -150,7 +152,7 @@ export default defineComponent({
|
||||
default: null,
|
||||
},
|
||||
value: {
|
||||
type: [Array, String, Number] as PropType<InputValue>,
|
||||
type: [Array, String, Number, Boolean] as PropType<InputValue>,
|
||||
default: null,
|
||||
},
|
||||
multiple: {
|
||||
|
||||
@@ -110,12 +110,24 @@
|
||||
v-model="defaultValue"
|
||||
:placeholder="$t('add_a_default_value')"
|
||||
/>
|
||||
<v-checkbox
|
||||
<v-select
|
||||
v-else-if="fieldData.type === 'boolean'"
|
||||
class="monospace"
|
||||
v-model="defaultValue"
|
||||
:label="defaultValue ? $t('true') : $t('false')"
|
||||
block
|
||||
:items="[
|
||||
{
|
||||
text: 'true',
|
||||
value: true,
|
||||
},
|
||||
{
|
||||
text: 'false',
|
||||
value: false,
|
||||
},
|
||||
{
|
||||
text: 'NULL',
|
||||
value: null,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
<v-input
|
||||
v-else
|
||||
@@ -141,9 +153,9 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed } from '@vue/composition-api';
|
||||
import useSync from '@/composables/use-sync';
|
||||
import { types } from '@/types';
|
||||
import i18n from '@/lang';
|
||||
import useSync from '../../../../../../composables/use-sync';
|
||||
import { types } from '../../../../../../types';
|
||||
import i18n from '../../../../../../lang';
|
||||
import { state } from '../store';
|
||||
|
||||
export const fieldTypes = [
|
||||
@@ -403,6 +415,7 @@ export default defineComponent({
|
||||
|
||||
.monospace {
|
||||
--v-input-font-family: var(--family-monospace);
|
||||
--v-select-font-family: var(--family-monospace);
|
||||
}
|
||||
|
||||
.required {
|
||||
|
||||
Reference in New Issue
Block a user