From 649c16fe137100f5dadd8f44014d757932cc64e3 Mon Sep 17 00:00:00 2001 From: Vyacheslav Tumanov Date: Fri, 21 Jun 2024 14:38:06 +0500 Subject: [PATCH] add single store for both popups and tooltip (#5808) Signed-off-by: Vyacheslav Tumanov --- packages/ui/src/components/Popup.svelte | 14 +++-- .../ui/src/components/PopupInstance.svelte | 4 +- .../ui/src/components/TooltipInstance.svelte | 22 ++++--- packages/ui/src/modals.ts | 5 ++ packages/ui/src/popups.ts | 63 +++++++++++-------- packages/ui/src/tooltips.ts | 33 +++++++--- packages/ui/src/types.ts | 1 + 7 files changed, 89 insertions(+), 53 deletions(-) create mode 100644 packages/ui/src/modals.ts diff --git a/packages/ui/src/components/Popup.svelte b/packages/ui/src/components/Popup.svelte index 451280a5b3..5f3d8bf0cb 100644 --- a/packages/ui/src/components/Popup.svelte +++ b/packages/ui/src/components/Popup.svelte @@ -13,7 +13,9 @@ // limitations under the License. --> -{#if $modal.length > 0} +{#if $popups.length > 0} {/if} -{#each $modal.filter((p) => p.dock !== true) as popup, i (popup.id)} +{#each $popups.filter((p) => p.dock !== true) as popup, i (popup.id)} modal.type === 'popup' && modal.id === popup.id) ?? i) + 10000} + top={$popups.length - 1 === i} close={popup.close} {contentPanel} overlay={popup.options.overlay} diff --git a/packages/ui/src/components/PopupInstance.svelte b/packages/ui/src/components/PopupInstance.svelte index 0bbe05a348..fa78c370ec 100644 --- a/packages/ui/src/components/PopupInstance.svelte +++ b/packages/ui/src/components/PopupInstance.svelte @@ -280,7 +280,7 @@ class:testing class:anim={(element === 'float' || element === 'centered') && !testing && !drag} bind:this={modalHTML} - style={`z-index: ${zIndex + 1};`} + style={`z-index: ${zIndex};`} style:top={options?.props?.top} style:bottom={options?.props?.bottom} style:left={options?.props?.left} @@ -331,7 +331,7 @@ class="modal-overlay" class:testing class:antiOverlay={options?.showOverlay && !drag} - style={`z-index: ${zIndex};`} + style={`z-index: ${zIndex - 1};`} on:click={handleOverlayClick} on:keydown|stopPropagation|preventDefault={() => {}} /> diff --git a/packages/ui/src/components/TooltipInstance.svelte b/packages/ui/src/components/TooltipInstance.svelte index d71ca225cd..16bca4ff76 100644 --- a/packages/ui/src/components/TooltipInstance.svelte +++ b/packages/ui/src/components/TooltipInstance.svelte @@ -15,7 +15,8 @@