Files
windmill/frontend/src/lib/components/Scrollable.svelte
T
7c36e554d7 feat(frontend): add quick access menu in flow editor (#4415)
* (frontend) add quick access menu in flow editor

* (frontend) add quick access menu in flow editor

* improve UI

* make design prettier

* add scroll effects

* improve loading preview

* change no items found

* prevent scroll using menu

* change user folder button

* set default integration icon

* reduce column width

* ajust font

* add defaults script button

* add shadow divider

* fix scroll

* add chevron

* Change toogle bar

* Add preprocessor menu

* add handler

* simplify scroll

* fix display

* fix minor issues

* delete useless log

* revert node tree changes

* merge main

* fix z-index issues

* iterate

* fix: improve allowed domains setting for sso

* chore(main): release 1.402.3 (#4458)

* chore(main): release 1.402.3

* Apply automatic changes

---------

Co-authored-by: rubenfiszel <rubenfiszel@users.noreply.github.com>

* improve allowed domains change handling

* send stats when renewing key if last >24h (#4430)

* feat: send stats when renewing key if last >24h

* nits

* fix: sqlx

* nit

* renewal reason

* stats reason

* update ee ref

* Update ee-repo-ref.txt

---------

Co-authored-by: Ruben Fiszel <ruben@windmill.dev>

* fix: skip one migration to avoid using md5 for azure support

* all

* all

* Apply automatic changes

* all

* done?

* nit

* nit

* nit

* nit

* nit noAi if prefilter is not all

* fix shadow

* fix error handler

* fix error handler

* Polishing default script settings

* all

* all

* full

* all

* add deno_core as features

* all

* remove warnings

* all

* npm check

* npm check

* new script script

* nits

* nits item 0

* nits item 0

---------

Co-authored-by: Guilhem Le Mouel <guilhem.le-mouel.ext@altran.com>
Co-authored-by: Ruben Fiszel <ruben@rubenfiszel.com>
Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
Co-authored-by: rubenfiszel <rubenfiszel@users.noreply.github.com>
Co-authored-by: HugoCasa <hugo@casademont.ch>
Co-authored-by: Guilhem <guilhem@mbp-de-windmill.home>
2024-10-03 14:15:01 +02:00

58 lines
1.4 KiB
Svelte

<script lang="ts">
import { onMount, onDestroy } from 'svelte'
import { twMerge } from 'tailwind-merge'
let isAtBottom: boolean = false
let isScrollable = false
export let scrollableClass: string = ''
export let shiftedShadow: boolean = false
let mutationObserver: MutationObserver
let el: HTMLDivElement
function handleScroll(event) {
const scrollableElement = event.target
isAtBottom =
scrollableElement.scrollTop + scrollableElement.offsetHeight >=
scrollableElement.scrollHeight - 2
}
function checkIfScrollable(el) {
return el.scrollHeight > el.clientHeight
}
function observeScrollability(el) {
isScrollable = checkIfScrollable(el)
mutationObserver = new MutationObserver(() => {
isScrollable = checkIfScrollable(el)
})
mutationObserver?.observe(el, { childList: true, subtree: true, characterData: true })
}
export function scrollIntoView(top: number) {
el.scrollTo({ top, behavior: 'smooth' })
}
onMount(() => {
observeScrollability(el)
})
onDestroy(() => {
mutationObserver?.disconnect()
})
</script>
<div class={twMerge('relative pb-1', scrollableClass)}>
<div bind:this={el} on:scroll={handleScroll} class="w-full h-full overflow-y-auto">
<slot />
</div>
{#if !isAtBottom && isScrollable}
<div
class="pointer-events-none absolute bottom-0 {shiftedShadow
? 'left-2'
: 'right-0'} h-14 w-full bg-gradient-to-t from-surface to-transparent"
/>
{/if}
</div>