From 8619abdfb425dd901818a50c7ec8fe5f34d66e7b Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 28 Aug 2024 14:03:37 +0200 Subject: [PATCH 01/14] feat: change navBar buttons --- src/components/NavBar.vue | 8 ++++- src/components/common/RightMenu.vue | 2 +- src/pages/Customer/Card/CustomerBasicData.vue | 36 ++++++++++++++----- src/pages/Zone/Card/ZoneEvents.vue | 2 +- 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue index e80a293c6..00faaebc2 100644 --- a/src/components/NavBar.vue +++ b/src/components/NavBar.vue @@ -24,7 +24,13 @@ const pinnedModulesRef = ref(); diff --git a/src/pages/Zone/Card/ZoneEvents.vue b/src/pages/Zone/Card/ZoneEvents.vue index e4fe5ff22..45c976cb2 100644 --- a/src/pages/Zone/Card/ZoneEvents.vue +++ b/src/pages/Zone/Card/ZoneEvents.vue @@ -52,7 +52,7 @@ onUnmounted(() => (stateStore.rightDrawer = false)); @click="stateStore.toggleRightDrawer()" round dense - icon="menu" + icon="dock_to_left" > {{ t('globals.collapseMenu') }} From 72388af4184dc3b96edcff5899169287e28d4507 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 28 Aug 2024 14:04:48 +0200 Subject: [PATCH 02/14] feat: keyShortcut directive --- src/boot/keyShortcut.js | 32 ++++++++++++++++++++++++++++++++ src/boot/quasar.js | 2 ++ 2 files changed, 34 insertions(+) create mode 100644 src/boot/keyShortcut.js diff --git a/src/boot/keyShortcut.js b/src/boot/keyShortcut.js new file mode 100644 index 000000000..2d84dcc6d --- /dev/null +++ b/src/boot/keyShortcut.js @@ -0,0 +1,32 @@ +export default { + mounted: function (el, binding) { + const shortcut = binding.value ?? '+'; + + const { key, ctrl, alt, callback } = + typeof shortcut === 'string' + ? { + key: shortcut, + ctrl: true, + alt: true, + callback: () => + document.querySelector('button[shortcut="+"]')?.click(), + } + : binding.value; + + const handleKeydown = (event) => { + if (event.key === key && (!ctrl || event.ctrlKey) && (!alt || event.altKey)) { + callback(); + } + }; + + // Attach the event listener to the window + window.addEventListener('keydown', handleKeydown); + + el._handleKeydown = handleKeydown; + }, + unmounted: function (el) { + if (el._handleKeydown) { + window.removeEventListener('keydown', el._handleKeydown); + } + }, +}; diff --git a/src/boot/quasar.js b/src/boot/quasar.js index a8d9b7ad9..00dd2cd5e 100644 --- a/src/boot/quasar.js +++ b/src/boot/quasar.js @@ -1,6 +1,8 @@ import { boot } from 'quasar/wrappers'; import qFormMixin from './qformMixin'; +import keyShortcut from './keyShortcut'; export default boot(({ app }) => { app.mixin(qFormMixin); + app.directive('shortcut', keyShortcut); }); From 57c9035751936f7016494169726494e75ad349f3 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 28 Aug 2024 14:06:14 +0200 Subject: [PATCH 03/14] feat: add plus shortcut in VnTable --- src/components/VnTable/VnTable.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 6c77d44df..efa8df61c 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -281,6 +281,7 @@ defineExpose({ From 4880da8febbd9c9772ba70fb6ecbd4d3f0349858 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 29 Aug 2024 10:20:05 +0200 Subject: [PATCH 05/14] perf: add v-shortcut in VnCard --- src/components/common/VnCard.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/common/VnCard.vue b/src/components/common/VnCard.vue index a7fe651ad..921b41a4c 100644 --- a/src/components/common/VnCard.vue +++ b/src/components/common/VnCard.vue @@ -50,6 +50,7 @@ if (props.baseUrl) {