feat: refs #8258 added uppercase option to VnInput
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
PAU ROVIRA ROSALENY 2025-01-08 08:14:37 +01:00
parent 1e8e2aff72
commit dfd7ba9379
4 changed files with 22 additions and 7 deletions

View File

@ -42,6 +42,10 @@ const $props = defineProps({
type: Number,
default: null,
},
uppercase: {
type: Boolean,
default: false,
},
});
const vnInputRef = ref(null);
@ -50,6 +54,9 @@ const value = computed({
return $props.modelValue;
},
set(value) {
if ($props.uppercase && typeof value === 'string') {
value = value.toUpperCase();
}
if ($props.emptyToNull && value === '') value = null;
emit('update:modelValue', value);
},
@ -169,6 +176,7 @@ const handleInsertMode = (e) => {
</QInput>
</div>
</template>
<i18n>
en:
inputMin: Must be more than {value}
@ -179,8 +187,3 @@ const handleInsertMode = (e) => {
maxLength: El valor excede los {value} carácteres
inputMax: Debe ser menor a {value}
</i18n>
<style lang="scss">
.q-field__append {
padding-inline: 0;
}
</style>

View File

@ -50,6 +50,9 @@ const columns = computed(() => [
isTitle: true,
create: true,
columnClass: 'expand',
attrs: {
uppercase: true,
},
},
{
align: 'left',

View File

@ -24,8 +24,13 @@ const columns = computed(() => [
label: t('globals.name'),
name: 'socialName',
create: true,
attrs: {
uppercase: true,
},
columnFilter: {
name: 'search',
name: 'search',attrs: {
uppercase: false,
},
},
isTitle: true,
},

View File

@ -138,7 +138,11 @@ function uppercaseStreetModel(data) {
return {
get: () => (data.street ? data.street.toUpperCase() : ''),
set: (value) => {
data.street = value.toUpperCase();
if (value) {
data.street = value.toUpperCase();
} else {
data.street = null;
}
},
};
}