Skip to content

Commit

Permalink
Revert "Refactor DatePicker component to improve validation behavior"
Browse files Browse the repository at this point in the history
This reverts commit c2f3de4.
  • Loading branch information
4dr1en committed Oct 15, 2024
1 parent c2f3de4 commit 4d819c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
14 changes: 3 additions & 11 deletions packages/synapse-bridge/src/patterns/DatePicker/DatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { vMaska } from 'maska'
import {
type ComponentPublicInstance,
defineComponent,
nextTick,
type PropType,
} from 'vue'
import { VTextField } from 'vuetify/lib/components/index.mjs'
Expand Down Expand Up @@ -171,13 +172,6 @@ export default defineComponent({
this.calendarValue = [start.toDate(), end.toDate()]
}
},
rules() {
if (this.calendarValue) {
this.$nextTick(() => {
this.updateMessages()
})
}
},
},
methods: {
toggleCalendar() {
Expand All @@ -201,9 +195,7 @@ export default defineComponent({
},
handleFocusChange(focus: boolean) {
if (!focus) {
setTimeout(() => {
this.updateMessages()
}, 200) // avoid graphical glitch when the calendar is closed
this.updateMessages()
} else {
if (this.textFieldActivator || this.noIcon) {
if (!this.$refs.calendar) return
Expand All @@ -225,7 +217,7 @@ export default defineComponent({
if (!textField) return
this.validateWarning(this.internalValue)
await this.$nextTick()
await nextTick()
this.errorMessages = await textField.validate()
},
handleTextInput(date: string, updateCalendar: (s: string) => void) {
Expand Down
2 changes: 1 addition & 1 deletion packages/synapse-bridge/src/patterns/DatePicker/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const config = {
textField: {
hideDetails: 'auto',
persistentHint: true,
validateOn: 'submit',
validateOn: 'blur',
color: '#0C419A',
maxErrors: 5,
},
Expand Down

0 comments on commit 4d819c8

Please sign in to comment.