forked from verdnatura/salix-front
fix(VnInputDate & VnInputTime): fix clearable
This commit is contained in:
parent
af5314dac7
commit
739be5fe7c
|
@ -9,18 +9,14 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
emitDateFormat: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');
|
const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');
|
||||||
|
|
||||||
const dateFormat = 'DD/MM/YYYY';
|
const dateFormat = 'DD/MM/YYYY';
|
||||||
const isPopupOpen = ref(false);
|
const isPopupOpen = ref();
|
||||||
const hover = ref(false);
|
const hover = ref();
|
||||||
const mask = ref();
|
const mask = ref();
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -101,7 +97,7 @@ watch(
|
||||||
name="close"
|
name="close"
|
||||||
size="xs"
|
size="xs"
|
||||||
v-if="
|
v-if="
|
||||||
($attrs.clearable != undefined || $attrs.clearable) &&
|
($attrs.clearable == undefined || $attrs.clearable) &&
|
||||||
hover &&
|
hover &&
|
||||||
model &&
|
model &&
|
||||||
!$attrs.disable
|
!$attrs.disable
|
||||||
|
|
|
@ -20,6 +20,17 @@ const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');
|
||||||
const dateFormat = 'HH:mm';
|
const dateFormat = 'HH:mm';
|
||||||
const isPopupOpen = ref();
|
const isPopupOpen = ref();
|
||||||
const hover = ref();
|
const hover = ref();
|
||||||
|
|
||||||
|
const styleAttrs = computed(() => {
|
||||||
|
return props.isOutlined
|
||||||
|
? {
|
||||||
|
dense: true,
|
||||||
|
outlined: true,
|
||||||
|
rounded: true,
|
||||||
|
}
|
||||||
|
: {};
|
||||||
|
});
|
||||||
|
|
||||||
const formattedTime = computed({
|
const formattedTime = computed({
|
||||||
get() {
|
get() {
|
||||||
if (!model.value || model.value?.length <= 5) return model.value;
|
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) {
|
function dateToTime(newDate) {
|
||||||
return date.formatDate(new Date(newDate), dateFormat);
|
return date.formatDate(new Date(newDate), dateFormat);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +80,7 @@ watch(
|
||||||
name="close"
|
name="close"
|
||||||
size="xs"
|
size="xs"
|
||||||
v-if="
|
v-if="
|
||||||
($attrs.clearable != undefined || $attrs.clearable) &&
|
($attrs.clearable == undefined || $attrs.clearable) &&
|
||||||
hover &&
|
hover &&
|
||||||
model &&
|
model &&
|
||||||
!$attrs.disable
|
!$attrs.disable
|
||||||
|
|
|
@ -200,16 +200,10 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('lastEntries.since')"
|
:label="t('lastEntries.since')"
|
||||||
dense
|
dense
|
||||||
emit-date-format
|
|
||||||
v-model="from"
|
v-model="from"
|
||||||
class="q-mr-lg"
|
class="q-mr-lg"
|
||||||
/>
|
/>
|
||||||
<VnInputDate
|
<VnInputDate :label="t('lastEntries.to')" dense v-model="to" />
|
||||||
:label="t('lastEntries.to')"
|
|
||||||
dense
|
|
||||||
emit-date-format
|
|
||||||
v-model="to"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<QSpace />
|
<QSpace />
|
||||||
<div id="st-actions"></div>
|
<div id="st-actions"></div>
|
||||||
|
|
|
@ -192,7 +192,6 @@ const decrement = (paramsObj, key) => {
|
||||||
v-model="params.from"
|
v-model="params.from"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
is-outlined
|
is-outlined
|
||||||
emit-date-format
|
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
@ -203,7 +202,6 @@ const decrement = (paramsObj, key) => {
|
||||||
v-model="params.to"
|
v-model="params.to"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
is-outlined
|
is-outlined
|
||||||
emit-date-format
|
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
|
|
@ -169,7 +169,6 @@ const columns = computed(() => [
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('salesClientsTable.from')"
|
:label="t('salesClientsTable.from')"
|
||||||
dense
|
dense
|
||||||
emit-date-format
|
|
||||||
v-model="from"
|
v-model="from"
|
||||||
class="q-mr-lg"
|
class="q-mr-lg"
|
||||||
style="width: 150px"
|
style="width: 150px"
|
||||||
|
@ -177,7 +176,6 @@ const columns = computed(() => [
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('salesClientsTable.to')"
|
:label="t('salesClientsTable.to')"
|
||||||
dense
|
dense
|
||||||
emit-date-format
|
|
||||||
v-model="to"
|
v-model="to"
|
||||||
style="width: 150px"
|
style="width: 150px"
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue