Better handling of empty state in numeric field.
This commit is contained in:
parent
cb5d643839
commit
59d5cd453a
|
@ -4,7 +4,7 @@
|
|||
:ref="'tainacan-item-metadatum_id-' + itemMetadatum.metadatum.id + (itemMetadatum.parent_meta_id ? ('_parent_meta_id-' + itemMetadatum.parent_meta_id) : '')"
|
||||
:disabled="disabled"
|
||||
:placeholder="itemMetadatum.metadatum.placeholder ? itemMetadatum.metadatum.placeholder : ''"
|
||||
:model-value="Number(value)"
|
||||
:model-value="value === 0 || value ? Number(value) : null"
|
||||
lang="en"
|
||||
:min="getMin"
|
||||
:max="getMax"
|
||||
|
@ -51,6 +51,12 @@
|
|||
const inputRef = this.$refs['tainacan-item-metadatum_id-' + this.itemMetadatum.metadatum.id + (this.itemMetadatum.parent_meta_id ? ('_parent_meta_id-' + this.itemMetadatum.parent_meta_id) : '')];
|
||||
if ( inputRef && !inputRef.checkHtml5Validity())
|
||||
return;
|
||||
|
||||
// Allowing empty value as a state different of 0
|
||||
if ( value === null || value === undefined || value === '' )
|
||||
value = '';
|
||||
else
|
||||
value = Number(value);
|
||||
|
||||
this.$emit('update:value', value);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue