diff --git a/app/src/components/v-input/v-input.vue b/app/src/components/v-input/v-input.vue index 28e6e0c82a..5a922bed32 100644 --- a/app/src/components/v-input/v-input.vue +++ b/app/src/components/v-input/v-input.vue @@ -181,24 +181,28 @@ export default defineComponent({ function emitValue(event: InputEvent) { let value = (event.target as HTMLInputElement).value; - if (props.trim === true) { - value = value.trim(); - } + if (props.type === 'text') { + if (props.trim === true) { + value = value.trim(); + } - if (props.slug === true) { - const endsWithSpace = value.endsWith(' '); - value = slugify(value, { separator: props.slugSeparator }); - if (endsWithSpace) value += props.slugSeparator; - } + if (props.slug === true) { + const endsWithSpace = value.endsWith(' '); + value = slugify(value, { separator: props.slugSeparator }); + if (endsWithSpace) value += props.slugSeparator; + } - if (props.dbSafe === true) { - value = value.toLowerCase(); - value = value.replace(/\s/g, '_'); - // Replace é -> e etc - value = value.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); - } + if (props.dbSafe === true) { + value = value.toLowerCase(); + value = value.replace(/\s/g, '_'); + // Replace é -> e etc + value = value.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); + } - emit('input', value); + emit('input', value); + } else if (props.type === 'number') { + emit('input', Number(value)); + } } function stepUp() { @@ -209,7 +213,7 @@ export default defineComponent({ input.value.stepUp(); if (input.value.value) { - return emit('input', input.value.value); + return emit('input', Number(input.value.value)); } } @@ -221,7 +225,7 @@ export default defineComponent({ input.value.stepDown(); if (input.value.value) { - return emit('input', input.value.value); + return emit('input', Number(input.value.value)); } else { return emit('input', props.min || 0); } diff --git a/app/src/interfaces/numeric/index.ts b/app/src/interfaces/numeric/index.ts index ec5b13600a..1803e3356b 100644 --- a/app/src/interfaces/numeric/index.ts +++ b/app/src/interfaces/numeric/index.ts @@ -34,6 +34,9 @@ export default defineInterface(({ i18n }) => ({ width: 'half', interface: 'numeric', }, + schema: { + default_value: 1, + }, }, { field: 'placeholder', diff --git a/app/src/interfaces/numeric/numeric.vue b/app/src/interfaces/numeric/numeric.vue index 897f9cebbe..342f46afa9 100644 --- a/app/src/interfaces/numeric/numeric.vue +++ b/app/src/interfaces/numeric/numeric.vue @@ -25,7 +25,7 @@ import { defineComponent, PropType } from '@vue/composition-api'; export default defineComponent({ props: { value: { - type: [Number, String], + type: Number, default: null, }, disabled: { diff --git a/app/src/interfaces/text-input/text-input.vue b/app/src/interfaces/text-input/text-input.vue index c036812235..a966c608e1 100644 --- a/app/src/interfaces/text-input/text-input.vue +++ b/app/src/interfaces/text-input/text-input.vue @@ -6,7 +6,6 @@ :trim="trim" :type="masked ? 'password' : 'text'" :class="font" - :max="length" @input="$listeners.input" >