From d641a328eccf602ea616aed355fe636e9dd39e06 Mon Sep 17 00:00:00 2001 From: Thorsten Schau Date: Wed, 23 Aug 2023 13:21:02 +0200 Subject: [PATCH 1/2] dev try for search box --- shell/package.json | 4 ++-- shell/src/shared/molecules/Select/List.svelte | 18 ++++++++++-------- .../src/shared/molecules/Select/Select.svelte | 3 ++- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/shell/package.json b/shell/package.json index a3460c453..4e665e30a 100644 --- a/shell/package.json +++ b/shell/package.json @@ -95,7 +95,7 @@ "qr-scanner": "^1.4.2", "quill": "^1.3.7", "react-image-file-resizer": "^0.4.8", - "simplebar": "^5.3.9", + "simplebar": "^6.2.5", "string-replace-loader": "^3.1.0", "style-loader": "^3.3.1", "svelte-easy-crop": "^1.0.7", @@ -118,4 +118,4 @@ "browserslist": [ "defaults" ] -} \ No newline at end of file +} diff --git a/shell/src/shared/molecules/Select/List.svelte b/shell/src/shared/molecules/Select/List.svelte index 5a61bcd28..7017fc977 100644 --- a/shell/src/shared/molecules/Select/List.svelte +++ b/shell/src/shared/molecules/Select/List.svelte @@ -174,15 +174,17 @@ function handleKeyDown(e) { } function scrollToActiveItem(className) { - if (isVirtualList || !container) return; + let input = document.getElementById("dropdownSelectInput"); + input.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "start" }); + // if (isVirtualList || !container) return; - let offsetBounding; - const focusedElemBounding = container.querySelector(`.listItem .${className}`); - if (focusedElemBounding) { - offsetBounding = container.getBoundingClientRect().bottom - focusedElemBounding.getBoundingClientRect().bottom; - } + // let offsetBounding; + // const focusedElemBounding = container.querySelector(`.listItem .${className}`); + // if (focusedElemBounding) { + // offsetBounding = container.getBoundingClientRect().bottom - focusedElemBounding.getBoundingClientRect().bottom; + // } - container.scrollTop -= offsetBounding; + // container.scrollTop -= offsetBounding; } function isItemActive(item, selectedValue, optionIdentifier) { @@ -218,7 +220,7 @@ function isItemHover(hoverItemIndex, item, itemIndex, items) { {/if} {#if !isVirtualList} -
+
{#if items} {#each items as item, i} {#if item.isGroupHeader && !item.isSelectable} diff --git a/shell/src/shared/molecules/Select/Select.svelte b/shell/src/shared/molecules/Select/Select.svelte index 54b56f353..3942c539e 100644 --- a/shell/src/shared/molecules/Select/Select.svelte +++ b/shell/src/shared/molecules/Select/Select.svelte @@ -554,7 +554,7 @@ function handleWindowClick(event) { function handleClick() { if (isDisabled) return; isFocused = true; - // listOpen = !listOpen; + listOpen = !listOpen; } export function handleClear() { @@ -726,6 +726,7 @@ onDestroy(() => { class:h-12="{staticList !== true}">
Date: Wed, 23 Aug 2023 13:21:32 +0200 Subject: [PATCH 2/2] dev try for search box --- shell/src/shared/molecules/Select/List.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/src/shared/molecules/Select/List.svelte b/shell/src/shared/molecules/Select/List.svelte index 7017fc977..7ad45e501 100644 --- a/shell/src/shared/molecules/Select/List.svelte +++ b/shell/src/shared/molecules/Select/List.svelte @@ -175,7 +175,7 @@ function handleKeyDown(e) { function scrollToActiveItem(className) { let input = document.getElementById("dropdownSelectInput"); - input.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "start" }); + input.scrollIntoView(); // if (isVirtualList || !container) return; // let offsetBounding;