From d29f84b23263739e031e810eaaba3079851b29a5 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 28 Nov 2020 14:19:50 +0100 Subject: [PATCH] Add "close on change" event which only fires if the component closed and the value actually changed --- src/components/input/datepicker.vue | 8 +++++++- src/components/tasks/partials/reminders.vue | 4 ++-- src/views/tasks/TaskDetailView.vue | 6 +++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/components/input/datepicker.vue b/src/components/input/datepicker.vue index 417b10ab5..2e5d50a7f 100644 --- a/src/components/input/datepicker.vue +++ b/src/components/input/datepicker.vue @@ -122,6 +122,7 @@ export default { return { date: null, show: false, + changed: false, flatPickerConfig: { altFormat: 'j M Y H:i', @@ -170,6 +171,7 @@ export default { }, methods: { updateData() { + this.changed = true this.$emit('input', this.date) this.$emit('change', this.date) }, @@ -205,7 +207,11 @@ export default { }, close() { this.show = false - this.$emit('close') + this.$emit('close', this.changed) + if(this.changed) { + this.changed = false + this.$emit('close-on-change', this.changed) + } }, setDate(date) { if (this.date === null) { diff --git a/src/components/tasks/partials/reminders.vue b/src/components/tasks/partials/reminders.vue index 2d052eddd..f94ce3db0 100644 --- a/src/components/tasks/partials/reminders.vue +++ b/src/components/tasks/partials/reminders.vue @@ -9,7 +9,7 @@ @@ -18,7 +18,7 @@
diff --git a/src/views/tasks/TaskDetailView.vue b/src/views/tasks/TaskDetailView.vue index 3e4498ec2..4eb54fc09 100644 --- a/src/views/tasks/TaskDetailView.vue +++ b/src/views/tasks/TaskDetailView.vue @@ -49,7 +49,7 @@