0
0
Fork 0

fix(VnInputDate & VnInputTime): fix clearable

This commit is contained in:
Alex Moreno 2024-07-02 13:49:29 +02:00
parent af5314dac7
commit 739be5fe7c
5 changed files with 16 additions and 29 deletions

View File

@ -9,18 +9,14 @@ const $props = defineProps({
type: Boolean,
default: false,
},
emitDateFormat: {
type: Boolean,
default: false,
},
});
const { t } = useI18n();
const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');
const dateFormat = 'DD/MM/YYYY';
const isPopupOpen = ref(false);
const hover = ref(false);
const isPopupOpen = ref();
const hover = ref();
const mask = ref();
onMounted(() => {
@ -101,7 +97,7 @@ watch(
name="close"
size="xs"
v-if="
($attrs.clearable != undefined || $attrs.clearable) &&
($attrs.clearable == undefined || $attrs.clearable) &&
hover &&
model &&
!$attrs.disable

View File

@ -20,6 +20,17 @@ const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');
const dateFormat = 'HH:mm';
const isPopupOpen = ref();
const hover = ref();
const styleAttrs = computed(() => {
return props.isOutlined
? {
dense: true,
outlined: true,
rounded: true,
}
: {};
});
const formattedTime = computed({
get() {
if (!model.value || model.value?.length <= 5) return model.value;
@ -41,16 +52,6 @@ const formattedTime = computed({
},
});
const styleAttrs = computed(() => {
return props.isOutlined
? {
dense: true,
outlined: true,
rounded: true,
}
: {};
});
function dateToTime(newDate) {
return date.formatDate(new Date(newDate), dateFormat);
}
@ -79,7 +80,7 @@ watch(
name="close"
size="xs"
v-if="
($attrs.clearable != undefined || $attrs.clearable) &&
($attrs.clearable == undefined || $attrs.clearable) &&
hover &&
model &&
!$attrs.disable

View File

@ -200,16 +200,10 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<VnInputDate
:label="t('lastEntries.since')"
dense
emit-date-format
v-model="from"
class="q-mr-lg"
/>
<VnInputDate
:label="t('lastEntries.to')"
dense
emit-date-format
v-model="to"
/>
<VnInputDate :label="t('lastEntries.to')" dense v-model="to" />
</div>
<QSpace />
<div id="st-actions"></div>

View File

@ -192,7 +192,6 @@ const decrement = (paramsObj, key) => {
v-model="params.from"
@update:model-value="searchFn()"
is-outlined
emit-date-format
/>
</QItemSection>
</QItem>
@ -203,7 +202,6 @@ const decrement = (paramsObj, key) => {
v-model="params.to"
@update:model-value="searchFn()"
is-outlined
emit-date-format
/>
</QItemSection>
</QItem>

View File

@ -169,7 +169,6 @@ const columns = computed(() => [
<VnInputDate
:label="t('salesClientsTable.from')"
dense
emit-date-format
v-model="from"
class="q-mr-lg"
style="width: 150px"
@ -177,7 +176,6 @@ const columns = computed(() => [
<VnInputDate
:label="t('salesClientsTable.to')"
dense
emit-date-format
v-model="to"
style="width: 150px"
/>