Merge pull request 'feat: #8258 added uppercase option to VnInput' (!1184) from 8258-uppercaseInputs into dev
gitea/salix-front/pipeline/head This commit looks good Details

Reviewed-on: #1184
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
PAU ROVIRA ROSALENY 2025-01-20 06:01:32 +00:00
commit c43a8d0a38
6 changed files with 56 additions and 5 deletions

View File

@ -42,10 +42,13 @@ const $props = defineProps({
type: Number, type: Number,
default: null, default: null,
}, },
uppercase: {
type: Boolean,
default: false,
},
}); });
const vnInputRef = ref(null); const vnInputRef = ref(null);
const showPassword = ref(false);
const value = computed({ const value = computed({
get() { get() {
return $props.modelValue; return $props.modelValue;
@ -117,6 +120,10 @@ const handleInsertMode = (e) => {
input.setSelectionRange(cursorPos + 1, cursorPos + 1); input.setSelectionRange(cursorPos + 1, cursorPos + 1);
}); });
}; };
const handleUppercase = () => {
value.value = value.value?.toUpperCase() || '';
};
</script> </script>
<template> <template>
@ -159,7 +166,16 @@ const handleInsertMode = (e) => {
emit('remove'); emit('remove');
} }
" "
></QIcon>
<QIcon
name="match_case"
size="xs"
v-if="!$attrs.disabled && !($attrs.readonly) && $props.uppercase"
@click="handleUppercase"
class="uppercase-icon"
/> />
<slot name="append" v-if="$slots.append && !$attrs.disabled" /> <slot name="append" v-if="$slots.append && !$attrs.disabled" />
<QIcon v-if="info" name="info"> <QIcon v-if="info" name="info">
<QTooltip max-width="350px"> <QTooltip max-width="350px">
@ -170,3 +186,14 @@ const handleInsertMode = (e) => {
</QInput> </QInput>
</div> </div>
</template> </template>
<i18n>
en:
inputMin: Must be more than {value}
maxLength: The value exceeds {value} characters
inputMax: Must be less than {value}
es:
inputMin: Debe ser mayor a {value}
maxLength: El valor excede los {value} carácteres
inputMax: Debe ser menor a {value}
</i18n>

View File

@ -44,6 +44,7 @@ function handleLocation(data, location) {
:required="true" :required="true"
:rules="validate('client.socialName')" :rules="validate('client.socialName')"
clearable clearable
uppercase="true"
v-model="data.socialName" v-model="data.socialName"
> >
<template #append> <template #append>

View File

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

View File

@ -92,6 +92,7 @@ function handleLocation(data, location) {
<VnInput <VnInput
v-model="data.name" v-model="data.name"
:label="t('supplier.fiscalData.name')" :label="t('supplier.fiscalData.name')"
uppercase="true"
clearable clearable
/> />
<VnInput <VnInput

View File

@ -5,6 +5,7 @@ import VnTable from 'components/VnTable/VnTable.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import SupplierListFilter from './SupplierListFilter.vue'; import SupplierListFilter from './SupplierListFilter.vue';
import VnInput from 'src/components/common/VnInput.vue';
const { t } = useI18n(); const { t } = useI18n();
const tableRef = ref(); const tableRef = ref();
@ -23,9 +24,14 @@ const columns = computed(() => [
align: 'left', align: 'left',
label: t('globals.name'), label: t('globals.name'),
name: 'socialName', name: 'socialName',
create: true, attrs: {
uppercase: true,
},
columnFilter: { columnFilter: {
name: 'search', name: 'search',
attrs: {
uppercase: false,
},
}, },
isTitle: true, isTitle: true,
}, },
@ -118,14 +124,18 @@ const columns = computed(() => [
formInitialData: {}, formInitialData: {},
mapper: (data) => { mapper: (data) => {
data.name = data.socialName; data.name = data.socialName;
delete data.socialName;
return data; return data;
}, },
}" }"
:right-search="false" :right-search="false"
order="id ASC" order="id ASC"
:columns="columns" :columns="columns"
/> >
<template #more-create-dialog="{ data }">
<VnInput :label="t('globals.name')" v-model="data.socialName" :uppercase="true" />
</template>
</VnTable>
</template> </template>
<i18n> <i18n>

View File

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