1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

fix: scale on numeric fields that doesn't support it

This commit is contained in:
2022-01-27 09:12:01 +01:00
parent 745b55a942
commit 0cfd7938ee
3 changed files with 10 additions and 9 deletions

View File

@ -493,9 +493,10 @@ export default {
this.editingContent = this.localRow.enumValues;
this.originalContent = this.localRow.enumValues;
}
else if (this.localRow.numScale !== null && field === 'length') {
this.editingContent = `${content}, ${this.localRow.numScale}`;
this.originalContent = `${content}, ${this.localRow.numScale}`;
else if (this.fieldType.scale && field === 'length') {
const scale = this.localRow.numScale !== null ? this.localRow.numScale : 0;
this.editingContent = `${content}, ${scale}`;
this.originalContent = `${content}, ${scale}`;
}
else {
this.editingContent = content;
@ -519,10 +520,10 @@ export default {
if (this.editingField === 'name')
this.$emit('rename-field', { old: this.localRow[this.editingField], new: this.editingContent });
if (this.editingField === 'numLength' && this.localRow.numScale !== null && this.editingContent.includes(',')) {
if (this.editingField === 'numLength' && this.fieldType.scale) {
const [length, scale] = this.editingContent.split(',');
this.localRow.numLength = +length;
this.localRow.numScale = +scale;
this.localRow.numScale = scale ? +scale : null;
}
else
this.localRow[this.editingField] = this.editingContent;