Sends empty string value when clearing date values #557

This commit is contained in:
mateuswetah 2021-06-07 10:23:57 -03:00
parent b2639bb2a5
commit 3a3986ba90
3 changed files with 5 additions and 6 deletions

View File

@ -57,7 +57,7 @@
},
methods: {
onInput: _.debounce(function ($event) {
// Emty dates don't need to be validated, they remove the metadata
// Empty dates don't need to be validated, they remove the metadata
if ($event.target.value != '') {
let dateISO = '';
@ -75,7 +75,7 @@
this.$emit('input', dateISO);
} else {
this.$emit('input', [null]);
this.$emit('input', '');
}
}, 300),
onBlur() {

View File

@ -180,7 +180,6 @@
// This routine avoids calling the API if the value did not changed
switch(this.itemMetadatum.value.constructor.name) {
// Multivalored Metadata requires checking the whole array
case 'Array': {
@ -188,11 +187,11 @@
let currentValues = [];
// An array of terms
if (this.values.length && this.values[0].constructor.name == 'Object')
if (this.values.length && this.values[0] && this.values[0].constructor.name == 'Object')
currentValues = this.values.map(term => term.value)
else
currentValues = this.values;
if (Array.isArray(currentValues)) {
for (let value of currentValues) {
let foundIndex = this.itemMetadatum.value.findIndex(element => value == element.id);

View File

@ -31,7 +31,7 @@ export const eventBusItemMetadata = new Vue({
this.$emit('isUpdatingValue', true);
if (values.length > 0 && values[0].value) {
if (values.length > 0 && values[0] && values[0].value) {
let onlyValues = values.map((aValueObject) => aValueObject.value);
values = onlyValues;
}