From 1ccf515509bb0366601a9731b0143519b0e286c0 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 15 Jul 2024 12:33:33 +0200 Subject: [PATCH 1/7] fix: editable columns --- src/components/VnTable/VnColumn.vue | 2 +- src/components/common/VnInputTime.vue | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/components/VnTable/VnColumn.vue b/src/components/VnTable/VnColumn.vue index da4687d32..3af58226f 100644 --- a/src/components/VnTable/VnColumn.vue +++ b/src/components/VnTable/VnColumn.vue @@ -78,7 +78,7 @@ const defaultComponents = { date: { component: markRaw(VnInputDate), attrs: { - readonly: true, + readonly: !$props.isEditable, disable: !$props.isEditable, style: 'min-width: 125px', class: 'fit', diff --git a/src/components/common/VnInputTime.vue b/src/components/common/VnInputTime.vue index def5dda51..a6c7f1db5 100644 --- a/src/components/common/VnInputTime.vue +++ b/src/components/common/VnInputTime.vue @@ -41,11 +41,16 @@ const formattedTime = computed({ let time = value; if (time) { if (time?.length > 5) time = dateToTime(time); + else { + time = time.padEnd(5, '0'); + if (!time.includes(':')) + time = time.substring(0, 2) + ':' + time.substring(3, 4); + } if (!props.timeOnly) { const hours = time.split(':'); const date = new Date(model.value); - date.setHours(hours[0], hours[1], 0); - time = date.toISOString(); + date.setHours(hours[0] ?? 0, hours[1] ?? 0, 0); + time = date?.toISOString(); } } model.value = time; @@ -74,6 +79,7 @@ watch( :class="{ required: $attrs.required }" style="min-width: 100px" :rules="$attrs.required ? [requiredFieldRule] : null" + @click="isPopupOpen = false" > @@ -114,3 +126,7 @@ watch( border-style: solid; } + + es: + Open time: Abrir tiempo + From ea3effd7f47810ee7a147ad884087c5ca816ce2c Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 15 Jul 2024 12:33:58 +0200 Subject: [PATCH 2/7] feat: VnInputDate & VnInputTime improviments --- src/components/VnTable/VnTable.vue | 2 +- src/components/common/VnInputDate.vue | 28 +++++++++++++++++++-------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index dc5410e93..97053184a 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -407,7 +407,7 @@ defineExpose({ diff --git a/src/components/common/VnInputDate.vue b/src/components/common/VnInputDate.vue index 72898483f..d8f41349a 100644 --- a/src/components/common/VnInputDate.vue +++ b/src/components/common/VnInputDate.vue @@ -44,12 +44,15 @@ const formattedDate = computed({ let newDate; if (value) { // parse input - if (value.includes('/') && value.length >= 10) { - if (value.at(2) == '/') value = value.split('/').reverse().join('/'); - value = date.formatDate( - new Date(value).toISOString(), - 'YYYY-MM-DDTHH:mm:ss.SSSZ' - ); + if (value.includes('/')) { + if (value.length == 6) value = value + new Date().getFullYear(); + if (value.length >= 10) { + if (value.at(2) == '/') value = value.split('/').reverse().join('/'); + value = date.formatDate( + new Date(value).toISOString(), + 'YYYY-MM-DDTHH:mm:ss.SSSZ' + ); + } } let ymd = value.split('-').map((e) => parseInt(e)); newDate = new Date(ymd[0], ymd[1] - 1, ymd[2]); @@ -107,7 +110,12 @@ watch( isPopupOpen = false; " /> - + - + + es: + Open date: Abrir fecha + From 39bf7e55c08560a122a639643139e25af695c1c8 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 15 Jul 2024 13:11:24 +0200 Subject: [PATCH 3/7] fix: e2e --- test/cypress/support/commands.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 38a23f71c..8708ac064 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -103,7 +103,9 @@ Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => { cy.get('.q-menu .q-item').contains(val).click(); break; case 'date': - cy.wrap(el).click(); + cy.get( + '[label="Birth"] > .q-field > .q-field__inner > .q-field__control > .q-field__append > .q-icon' + ).click(); cy.get(days) .eq(day ? day - 1 : 0) .click(); From 493081254d38af44ad12021d3dcca53e3e0ccfd8 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 16 Jul 2024 10:11:27 +0200 Subject: [PATCH 4/7] feat: improve to set time --- src/components/common/VnInputDate.vue | 4 ++-- src/components/common/VnInputTime.vue | 26 +++++++++++++++++++++++--- src/pages/Order/OrderLines.vue | 2 -- src/pages/Order/OrderList.vue | 1 - 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/components/common/VnInputDate.vue b/src/components/common/VnInputDate.vue index d8f41349a..6e57a8a53 100644 --- a/src/components/common/VnInputDate.vue +++ b/src/components/common/VnInputDate.vue @@ -54,8 +54,8 @@ const formattedDate = computed({ ); } } - let ymd = value.split('-').map((e) => parseInt(e)); - newDate = new Date(ymd[0], ymd[1] - 1, ymd[2]); + const [year, month, day] = value.split('-').map((e) => parseInt(e)); + newDate = new Date(year, month - 1, day); if (model.value) { const orgDate = model.value instanceof Date ? model.value : new Date(model.value); diff --git a/src/components/common/VnInputTime.vue b/src/components/common/VnInputTime.vue index a6c7f1db5..0971facf9 100644 --- a/src/components/common/VnInputTime.vue +++ b/src/components/common/VnInputTime.vue @@ -1,5 +1,5 @@