From a8578e28030872f7b8a7198142698aa1051cb457 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 24 Nov 2021 15:28:53 +0100 Subject: [PATCH] [core] Notifications can now be dismissed without triggering a reject --- package.json | 2 +- quasar.conf.js | 1 + src/components/Notification.vue | 63 +++++++++++++++++++++++---------- src/layouts/MainLayout.vue | 2 +- 4 files changed, 47 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index a88259f..a9f30bc 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "quasar": "^2.3.3" }, "devDependencies": { - "@flaschengeist/types": "^1.0.0-alpha.5", + "@flaschengeist/types": "^1.0.0-alpha.6", "@quasar/app": "^3.2.3", "@quasar/extras": "^1.12.1", "@types/node": "^14.17.34", diff --git a/quasar.conf.js b/quasar.conf.js index 2602cf5..76f7aac 100644 --- a/quasar.conf.js +++ b/quasar.conf.js @@ -132,6 +132,7 @@ module.exports = configure(function (/* ctx */) { plugins: [ 'LocalStorage', 'SessionStorage', + 'Dialog', 'Loading', 'Notify', 'LoadingBar' diff --git a/src/components/Notification.vue b/src/components/Notification.vue index f7ac317..949d531 100644 --- a/src/components/Notification.vue +++ b/src/components/Notification.vue @@ -1,34 +1,53 @@ @@ -63,13 +82,19 @@ export default defineComponent({ else emit('remove', props.modelValue.id); } - function remove() { + function reject() { if (typeof props.modelValue.reject === 'function') void props.modelValue.reject().finally(() => emit('remove', props.modelValue.id)); else emit('remove', props.modelValue.id); } - return { accept, click, dateString, remove }; + function dismiss() { + if (typeof props.modelValue.dismiss === 'function') + void props.modelValue.dismiss().finally(() => emit('remove', props.modelValue.id)); + else emit('remove', props.modelValue.id); + } + + return { accept, click, dateString, dismiss, reject }; }, }); diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 889a6a5..646e42e 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -18,7 +18,7 @@ {{ notifications.length }} - +