From 122c3aff1a9b833d3c5928332e1f65c60af22ca2 Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Fri, 5 Jan 2024 12:59:17 +0100 Subject: [PATCH] Improve datepicker interactions for item sidebar [SCI-9956] --- .../RepositoryItemSidebar.vue | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/javascript/vue/repository_item_sidebar/RepositoryItemSidebar.vue b/app/javascript/vue/repository_item_sidebar/RepositoryItemSidebar.vue index 7ad37b94c..9213d357a 100644 --- a/app/javascript/vue/repository_item_sidebar/RepositoryItemSidebar.vue +++ b/app/javascript/vue/repository_item_sidebar/RepositoryItemSidebar.vue @@ -308,7 +308,14 @@ export default { handleOutsideClick(event) { if (!this.isShowing) return; - const allowedSelectors = ['a', '.modal', '.label-printing-progress-modal', '.atwho-view']; + const allowedSelectors = [ + 'a', + '.modal', + '.dp__instance_calendar', + '.label-printing-progress-modal', + '.atwho-view' + ]; + const excludeSelectors = ['#myModuleRepositoryFullViewModal']; const isOutsideSidebar = !$(event.target).parents('#repository-item-sidebar-wrapper').length; @@ -348,7 +355,7 @@ export default { this.loadRepositoryRow(repositoryRowUrl); this.currentItemUrl = repositoryRowUrl; }, - loadRepositoryRow(repositoryRowUrl) { + loadRepositoryRow(repositoryRowUrl, scrollTop = 0) { this.dataLoading = true $.ajax({ method: 'GET', @@ -368,13 +375,17 @@ export default { this.dataLoading = false; this.$nextTick(() => { this.generateBarCode(this.defaultColumns.code); + + // if scrollTop was provided, scroll to it + this.$nextTick(() => { this.$refs.bodyWrapper.scrollTop = scrollTop; }); }); } }); }, reload() { if (this.isShowing) { - this.loadRepositoryRow(this.currentItemUrl); + // perserve scrollTop on reload + this.loadRepositoryRow(this.currentItemUrl, this.$refs.bodyWrapper.scrollTop); } }, showRepositoryAssignModal() {