Updates compound child metadata communication.

This commit is contained in:
mateuswetah 2024-03-21 17:48:53 -03:00
parent 9543af5645
commit 4cfc213229
5 changed files with 11 additions and 8 deletions

View File

@ -223,7 +223,7 @@
</a>
<a
v-if="metadataSection.current_user_can_delete"
:disabled="metadataSection.metadata_object_list.length"
:disabled="metadataSection.metadata_object_list.length > 0"
:style="{ visibility: metadataSection.collection_id != collectionId || metadataSection.id === 'default_section' || metadataSection.metadata_object_list.length ? 'hidden' : 'visible' }"
@click.prevent="removeMetadataSection(metadataSection)">
<span

View File

@ -75,6 +75,7 @@
:is-focused="(focusedGroupMetadatum === groupIndex) && (focusedChildMetadatum === childIndex)"
:is-metadata-navigation="isMetadataNavigation"
:enumerate-metadatum="enumerateMetadatum ? ( enumerateMetadatum + ( childItemMetadataGroups.length > 1 ? ( '.' + (Number(groupIndex) + 1) ) : '' ) + '.' + (Number(childIndex) + 1) ) : false"
@input="($event) => $emitter.emit('updateValueFromCompound', $event)"
@change-collapse="onChangeCollapse($event, groupIndex, childIndex)"
@touchstart="isMetadataNavigation ? setMetadatumChildFocus({ groupIndex: groupIndex, childIndex: childIndex, scrollIntoView: false }): ''"
@mousedown="isMetadataNavigation ? setMetadatumChildFocus({ groupIndex: groupIndex, childIndex: childIndex, scrollIntoView: false }) : ''"

View File

@ -286,6 +286,7 @@
this.performValueChange();
}, 800),
performValueChange() {
// Compound metadata do not emit values, only their children.
if (this.metadatumComponent == 'tainacan-compound')
return;
@ -338,7 +339,6 @@
return;
}
}
// If none is the case, the value is update request is sent to the API
this.$emit('input', {
itemId: this.itemMetadatum.item.id,

View File

@ -3,9 +3,11 @@ import { mapActions } from 'vuex';
export const itemMetadataMixin = {
created() {
this.$emitter.on('removeCompoundGroup', this.removeItemMetadataGroup);
this.$emitter.on('updateValueFromCompound', this.updateItemMetadataValue);
},
beforeDestroy() {
this.$emitter.off('removeCompoundGroup', this.removeItemMetadataGroup);
this.$emitter.off('updateValueFromCompound', this.updateItemMetadataValue);
},
data () {
return {
@ -37,7 +39,7 @@ export const itemMetadataMixin = {
if (itemId) {
this.isUpdatingValues = true;;
this.isUpdatingValues = true;
if (values.length > 0 && values[0] && values[0].value) {
let onlyValues = values.map((aValueObject) => aValueObject.value);
@ -94,7 +96,7 @@ export const itemMetadataMixin = {
// In the item submission, we don't want to block submission or clear errors before a re-submission is performed,
// as the validation depends on a single server-side request. Thus, we do not update error arary here.
this.isUpdatingValues = false;;
this.isUpdatingValues = false;
}
/**
@ -115,7 +117,7 @@ export const itemMetadataMixin = {
},
removeItemMetadataGroup({ itemId, metadatumId, parentMetaId, parentMetadatum }) {
this.isUpdatingValues = true;;
this.isUpdatingValues = true;
if (itemId && metadatumId && parentMetaId) {

View File

@ -49,7 +49,7 @@
background-color: var(--tainacan-red1);
}
}
a[disabled] {
a[disabled="true"] {
opacity: 0.5;
user-select: none;
pointer-events: none;