Checks max values on taginput for user and taxonomy metadata type.
This commit is contained in:
parent
6df6af44ff
commit
1515f1cdac
|
@ -31,9 +31,8 @@
|
|||
:is-checkbox="getComponent == 'tainacan-taxonomy-checkbox'"
|
||||
@input="(selected) => valueComponent = selected"
|
||||
/>
|
||||
|
||||
<div
|
||||
v-if="displayCreateNewTerm && !isTermCreationPanelOpen"
|
||||
v-if="displayCreateNewTerm && !isTermCreationPanelOpen && (maxMultipleValues !== undefined ? (maxMultipleValues > valueComponent.length) : true)"
|
||||
class="add-new-term">
|
||||
<a
|
||||
@click="openTermCreationModal"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<template>
|
||||
<div class="block">
|
||||
<b-taginput
|
||||
expanded
|
||||
:disabled="disabled"
|
||||
|
@ -11,6 +10,7 @@
|
|||
@remove="emitRemove"
|
||||
v-model="selected"
|
||||
:data="labels"
|
||||
:maxtags="maxtags"
|
||||
field="label"
|
||||
:remove-on-keys="[]"
|
||||
:dropdown-position="isLastMetadatum ? 'top' :'auto'"
|
||||
|
@ -45,7 +45,6 @@
|
|||
</a>
|
||||
</template>
|
||||
</b-taginput>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
@input="onInput"
|
||||
@blur="onBlur"
|
||||
:data="options"
|
||||
:maxtags="maxtags != undefined ? maxtags : (itemMetadatum.metadatum.multiple == 'yes' || allowNew === true ? 100 : 1)"
|
||||
:maxtags="maxtags != undefined ? maxtags : (itemMetadatum.metadatum.multiple == 'yes' || allowNew === true ? (maxMultipleValues !== undefined ? maxMultipleValues : null) : 1)"
|
||||
autocomplete
|
||||
attached
|
||||
:placeholder="$i18n.get('instruction_type_search_users')"
|
||||
|
@ -72,6 +72,17 @@ export default {
|
|||
totalUsers: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
maxMultipleValues() {
|
||||
return (
|
||||
this.itemMetadatum &&
|
||||
this.itemMetadatum.metadatum &&
|
||||
this.itemMetadatum.metadatum.cardinality &&
|
||||
!isNaN(this.itemMetadatum.metadatum.cardinality) &&
|
||||
this.itemMetadatum.metadatum.cardinality > 1
|
||||
) ? this.itemMetadatum.metadatum.cardinality : undefined;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadCurrentUsers();
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue