Skip to content
Snippets Groups Projects
Commit 2e1ba122 authored by Theo Lesage's avatar Theo Lesage Committed by Erwan Rouchet
Browse files

Do not trim values in user configuration list fields

parent 68520c30
No related branches found
No related tags found
1 merge request!1658Do not trim values in user configuration list fields
...@@ -96,7 +96,7 @@ export default defineComponent({ ...@@ -96,7 +96,7 @@ export default defineComponent({
cleanList () { cleanList () {
if (Array.isArray(this.validatedList)) { if (Array.isArray(this.validatedList)) {
return this.validatedList.filter((item) => { return this.validatedList.filter((item) => {
return String(item).trim().length > 0 return String(item).length > 0
}) })
} else return [] } else return []
}, },
...@@ -125,7 +125,7 @@ export default defineComponent({ ...@@ -125,7 +125,7 @@ export default defineComponent({
updateItem (i: number, newValue: string | number | boolean) { updateItem (i: number, newValue: string | number | boolean) {
if (this.newList[i] === newValue) return if (this.newList[i] === newValue) return
// Do not keep the last valid value in the list if the field is emptied // Do not keep the last valid value in the list if the field is emptied
if (!String(newValue).trim().length) { if (!String(newValue).length) {
(this.newList as (string | number | boolean)[]).splice(i, 1, newValue) (this.newList as (string | number | boolean)[]).splice(i, 1, newValue)
this.itemError[i] = null this.itemError[i] = null
} }
...@@ -134,7 +134,7 @@ export default defineComponent({ ...@@ -134,7 +134,7 @@ export default defineComponent({
}, },
validateFields () { validateFields () {
for (const [i, item] of this.newList.entries()) { for (const [i, item] of this.newList.entries()) {
if (String(item).trim().length && FIELDS[this.field.subtype].validate !== undefined) { if (String(item).length && FIELDS[this.field.subtype].validate !== undefined) {
try { try {
const validated = FIELDS[this.field.subtype].validate(item) const validated = FIELDS[this.field.subtype].validate(item)
this.itemError[i] = null this.itemError[i] = null
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment