Split Edit and Add constraints

This commit is contained in:
Matthias 2023-05-07 09:16:25 +02:00
parent 727e1318cc
commit 8d5363d0f3
2 changed files with 14 additions and 8 deletions

View File

@ -2,6 +2,7 @@
<edit-value <edit-value
v-model="plotStore.plotConfigName" v-model="plotStore.plotConfigName"
:allow-edit="allowEdit" :allow-edit="allowEdit"
:allow-add="allowEdit"
editable-name="plot configuration" editable-name="plot configuration"
@rename="plotStore.renamePlotConfig" @rename="plotStore.renamePlotConfig"
@delete="plotStore.deletePlotConfig" @delete="plotStore.deletePlotConfig"

View File

@ -22,15 +22,16 @@
> >
<DeleteIcon :size="16" /> <DeleteIcon :size="16" />
</b-button> </b-button>
<b-button
size="sm"
:title="`Add new ${editableName}.`"
class="ms-1"
variant="primary"
@click="addNewClick"
><AddIcon :size="16" />
</b-button>
</template> </template>
<b-button
v-if="allowAdd && !(addNew || editing)"
size="sm"
:title="`Add new ${editableName}.`"
class="ms-1"
variant="primary"
@click="addNewClick"
><AddIcon :size="16" />
</b-button>
<template v-if="allowEdit && (addNew || editing)"> <template v-if="allowEdit && (addNew || editing)">
<b-button <b-button
size="sm" size="sm"
@ -66,6 +67,10 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
allowAdd: {
type: Boolean,
default: false,
},
editableName: { editableName: {
type: String, type: String,
required: true, required: true,