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,
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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"
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue