From 79d4eea33269f4e1564ff6e3e63b9b011c5f5053 Mon Sep 17 00:00:00 2001 From: mertmit Date: Fri, 24 Mar 2023 22:54:23 +0300 Subject: [PATCH] feat: undo/redo for show/hide all Signed-off-by: mertmit --- .../smartsheet/toolbar/FieldsMenu.vue | 42 ++++++++++++++++++- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue b/packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue index 07dc46b865..9c6670a33b 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue @@ -226,6 +226,44 @@ const toggleSystemFields = (e: CheckboxChangeEvent) => { }) } +const onShowAll = () => { + addUndo({ + undo: { + fn: async () => { + await hideAll() + }, + args: [], + }, + redo: { + fn: async () => { + await showAll() + }, + args: [], + }, + scope: activeView.value?.title, + }) + showAll() +} + +const onHideAll = () => { + addUndo({ + undo: { + fn: async () => { + await showAll() + }, + args: [], + }, + redo: { + fn: async () => { + await hideAll() + }, + args: [], + }, + scope: activeView.value?.title, + }) + hideAll() +} + useMenuCloseOnEsc(open) @@ -336,12 +374,12 @@ useMenuCloseOnEsc(open)
- + {{ $t('general.showAll') }} - + {{ $t('general.hideAll') }}