From cb5c33dcc9187ea8a275d3e27c17cdb0c93af397 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 2 Jul 2024 08:06:31 +0200 Subject: [PATCH] feat: rework VnInputTime and fix VnInputDate bugs --- src/components/VnTable/VnFilter.vue | 12 ++ src/components/common/VnInputDate.vue | 23 ++-- src/components/common/VnInputTime.vue | 168 ++++++++++++-------------- src/pages/Zone/Card/ZoneBasicData.vue | 2 +- 4 files changed, 99 insertions(+), 106 deletions(-) diff --git a/src/components/VnTable/VnFilter.vue b/src/components/VnTable/VnFilter.vue index 3d489cf73..9ce050fe9 100644 --- a/src/components/VnTable/VnFilter.vue +++ b/src/components/VnTable/VnFilter.vue @@ -7,6 +7,7 @@ import { useArrayData } from 'composables/useArrayData'; import VnSelect from 'components/common/VnSelect.vue'; import VnInput from 'components/common/VnInput.vue'; import VnInputDate from 'components/common/VnInputDate.vue'; +import VnInputTime from 'components/common/VnInputTime.vue'; import VnTableColumn from 'components/VnTable/VnColumn.vue'; const $props = defineProps({ @@ -75,6 +76,17 @@ const components = { }, forceAttrs, }, + time: { + component: markRaw(VnInputTime), + event: updateEvent, + attrs: { + ...defaultAttrs, + disable: !$props.isEditable, + }, + forceAttrs: { + label: $props.showLabel && $props.column.label, + }, + }, checkbox: { component: markRaw(QCheckbox), event: updateEvent, diff --git a/src/components/common/VnInputDate.vue b/src/components/common/VnInputDate.vue index 60fd67c0f..26df2e3ba 100644 --- a/src/components/common/VnInputDate.vue +++ b/src/components/common/VnInputDate.vue @@ -5,10 +5,6 @@ import { useI18n } from 'vue-i18n'; const model = defineModel({ type: String }); const $props = defineProps({ - readonly: { - type: Boolean, - default: false, - }, isOutlined: { type: Boolean, default: false, @@ -48,6 +44,7 @@ const formattedDate = computed({ return date.formatDate(new Date(model.value), dateFormat); }, set(value) { + if (value == model.value) return; let newDate; if (value) { // parse input @@ -97,12 +94,18 @@ watch( v-bind="{ ...$attrs, ...styleAttrs }" :class="{ required: $attrs.required }" :rules="$attrs.required ? [requiredFieldRule] : null" + :clearable="false" >