Skip to main content
Homepage
Explore
Search or go to…
/
Register
Sign in
Explore
Primary navigation
Project
L
leximpact-socio-fiscal-ui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Collapse sidebar
Snippets
Groups
Projects
Show more breadcrumbs
leximpact
Simulateur socio-fiscal
leximpact-socio-fiscal-ui
Commits
dcaec58e
Commit
dcaec58e
authored
7 months ago
by
David Smadja
Browse files
Options
Downloads
Patches
Plain Diff
Adjust scroll position when closing pinned sticky node
parent
74a58da5
No related branches found
No related tags found
1 merge request
!310
Resolve "Mettre en sticky l'arborescence des paramètres"
Pipeline
#20243
passed
7 months ago
Status:
Stage: build
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/lib/components/legislation_view/parameters/VariableReferredNodeParameter.svelte
+36
-1
36 additions, 1 deletion
...tion_view/parameters/VariableReferredNodeParameter.svelte
src/routes/+page.svelte
+3
-1
3 additions, 1 deletion
src/routes/+page.svelte
with
39 additions
and
2 deletions
src/lib/components/legislation_view/parameters/VariableReferredNodeParameter.svelte
+
36
−
1
View file @
dcaec58e
...
...
@@ -13,6 +13,7 @@
import
VariableReferredValueParameter
from
"
$lib/components/legislation_view/parameters/VariableReferredValueParameter.svelte
"
import
type
{
DisplayMode
}
from
"
$lib/displays
"
import
{
onMount
}
from
"
svelte
"
interface
Props
{
billParameter
:
NodeParameter
...
...
@@ -43,6 +44,8 @@
}:
Props
=
$props
()
let
openChildrenParameters
=
$state
(
true
)
let
lawDiv
:
HTMLDivElement
|
undefined
=
$state
()
let
stickyDiv
:
HTMLDivElement
|
undefined
=
$state
()
if
(
isOtherParametersSection
)
{
openChildrenParameters
=
false
...
...
@@ -96,12 +99,44 @@
yield
[
bothChild
,
lawChild
,
revaluationChild
,
billChild
]
}
}
onMount
(()
=>
{
lawDiv
=
document
.
getElementById
(
"
law-div
"
)
!
as
HTMLDivElement
})
function
isStickyActive
()
{
if
(
stickyDiv
)
{
const
lawHeader
=
document
.
getElementById
(
"
law-header
"
)
!
const
currentLawheaderBottom
=
lawHeader
.
getBoundingClientRect
().
bottom
const
stickyDivStyle
=
window
.
getComputedStyle
(
stickyDiv
)
const
stickyDivTop
=
parseInt
(
stickyDivStyle
.
top
,
10
)
const
currentStikyDivTop
=
stickyDiv
.
getBoundingClientRect
().
top
return
currentStikyDivTop
-
currentLawheaderBottom
<=
stickyDivTop
}
return
false
}
function
showHide
()
{
const
stickyWasActive
=
isStickyActive
()
openChildrenParameters
=
!
openChildrenParameters
if
(
stickyWasActive
&&
lawDiv
!==
undefined
&&
stickyDiv
!==
undefined
)
{
setTimeout
(()
=>
{
const
stickyDivStyle
=
window
.
getComputedStyle
(
stickyDiv
!
)
const
stickyDivTop
=
parseInt
(
stickyDivStyle
.
top
,
10
)
const
offsetToScroll
=
stickyDiv
!
.
offsetTop
-
lawDiv
!
.
offsetTop
-
stickyDivTop
lawDiv
!
.
scrollTop
=
offsetToScroll
},
0
)
}
}
</script>
<section
style=
"isolation: isolate;"
>
{
#if
depth
!==
0
}
{
@
const
top
=
(
depth
-
1
)
*
2
}
<div
bind:this=
{
stickyDiv
}
data-depth=
{
depth
}
class=
"sticky-element flex {depth === 1
? ''
...
...
@@ -110,7 +145,7 @@
>
<button
aria-label=
{
openChildrenParameters
?
"
fermer
"
:
"
ouvrir
"
}
onclick=
{
()
=>
(
openChildrenParameters
=
!
openChildrenParameters
)
}
onclick=
{
showHide
}
>
<iconify-icon
class=
"align-[-0.2rem] text-lg"
...
...
...
...
This diff is collapsed.
Click to expand it.
src/routes/+page.svelte
+
3
−
1
View file @
dcaec58e
...
...
@@ -932,7 +932,7 @@
<div
class=
"flex flex-1 overflow-x-hidden"
>
<!-- Panneau de gauche les zones éditables par l'utilisateur (amendement)-->
<section
class=
"flex min-w-0 flex-[1_0_100%]
overflow-y-scroll
bg-white shadow-lg transition-transform duration-500 ease-out-quart md:z-10 md:!h-full md:flex-[0_0_33.3%] md:translate-x-0 md:overflow-visible md:!p-0"
class=
"flex min-w-0 flex-[1_0_100%] bg-white shadow-lg transition-transform duration-500 ease-out-quart md:z-10 md:!h-full md:flex-[0_0_33.3%] md:translate-x-0 md:overflow-visible md:!p-0"
class:-translate-x-full=
{
!
mobileLawTab
}
class:
!
h-[calc(100vh-96px)]=
{
!
mobileLawTab
}
class:pb-24=
{
shared
.
testCasesIndex
.
length
===
1
&&
...
...
@@ -942,6 +942,7 @@
<div
class=
"flex min-h-full w-full flex-col"
>
<!-- Header (fixed) -->
<header
id=
"law-header"
class=
"flex w-screen items-center justify-between border-b border-black px-5 pb-2 pt-4 md:w-full md:px-5 2xl:pb-3 2xl:pt-5"
>
<!-- Titre -->
...
...
@@ -959,6 +960,7 @@
class=
"w-screen overflow-y-scroll bg-white px-2 pb-5 md:w-full"
out:fade=
{
{
duration
:
100
}}
in
:
fade
=
{{
delay
:
150
,
duration
:
150
}}
id
=
"
law-div
"
>
<!--
Vue
par
défaut
-
choix
de
dispositifs
-->
{
#if
displayMode
.
parametersVariableName
===
undefined
}
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment