Show edit drawer as preview for disabled many to one (#13207)

Fixes #13201
This commit is contained in:
Rijk van Zanten
2022-05-10 10:56:49 -04:00
committed by GitHub
parent 51e90f6c4c
commit a9422b23e9

View File

@@ -18,16 +18,16 @@
</div>
</template>
<template v-if="!disabled" #append>
<template #append>
<template v-if="displayItem">
<v-icon v-tooltip="t('edit')" name="open_in_new" class="edit" @click.stop="editModalActive = true" />
<v-icon
v-if="updateAllowed"
v-tooltip="t('edit')"
name="open_in_new"
class="edit"
@click.stop="editModalActive = true"
v-if="!disabled"
v-tooltip="t('deselect')"
name="close"
class="deselect"
@click.stop="$emit('input', null)"
/>
<v-icon v-tooltip="t('deselect')" name="close" class="deselect" @click.stop="$emit('input', null)" />
</template>
<template v-else>
<v-icon
@@ -43,13 +43,13 @@
</v-input>
<drawer-item
v-if="!disabled"
v-model:active="editModalActive"
:collection="relationInfo.relatedCollection.collection"
:primary-key="currentPrimaryKey"
:edits="edits"
:circular-field="relationInfo.relation.meta?.one_field ?? undefined"
@input="update"
:disabled="!updateAllowed || disabled"
@input="onDrawerItemInput"
/>
<drawer-collection
@@ -175,6 +175,11 @@ function onPreviewClick() {
selectModalActive.value = true;
}
function onDrawerItemInput(event: any) {
if (props.disabled) return;
update(event);
}
const selection = computed<(number | string)[]>(() => {
const pkField = relationInfo.value?.relatedPrimaryKeyField.field;