Skip to content
Snippets Groups Projects
Commit 03012ade authored by David Smadja's avatar David Smadja
Browse files

Add button and mecanism

parent f85cd21c
No related branches found
No related tags found
1 merge request!329Permettre d'ouvrir / fermer tous les paramètres
......@@ -27,6 +27,7 @@
lawParameter: NodeParameter | undefined
name?: string | undefined
revaluationParameter: NodeParameter | undefined
openAllParameters: boolean | undefined
}
let {
......@@ -41,15 +42,24 @@
name = undefined,
revaluationParameter,
isOtherParametersSection = false,
openAllParameters,
}: Props = $props()
let openChildrenParameters = $state(true)
let forceOpenChildrenParameters: boolean = $state(false)
let openChildrenParameters = $derived(
forceOpenChildrenParameters
? true
: openAllParameters === false && depth !== 0
? false
: true,
)
$inspect({ openChildrenParameters })
let lawDiv: HTMLDivElement | undefined = $state()
let stickyDiv: HTMLDivElement | undefined = $state()
if (isOtherParametersSection) {
openChildrenParameters = false
}
// if (isOtherParametersSection) {
// openChildrenParameters = false
// }
function compareUsingOrder(
order: string[],
......@@ -112,7 +122,8 @@
function showHide() {
const stickyWasActive = isStickyActive()
openChildrenParameters = !openChildrenParameters
// openChildrenParameters = !openChildrenParameters
forceOpenChildrenParameters = !forceOpenChildrenParameters
if (stickyWasActive && lawDiv !== undefined && stickyDiv !== undefined) {
setTimeout(() => {
const stickyDivStyle = window.getComputedStyle(stickyDiv!)
......@@ -176,6 +187,7 @@
revaluationParameter={revaluationChild as
| NodeParameter
| undefined}
{openAllParameters}
/>
{:else if billChild.class === ParameterClass.Value}
<VariableReferredValueParameter
......
......@@ -146,9 +146,17 @@
),
),
)
let openOtherParameters = $state(true)
let openAllParameters = $state(true)
$inspect(openAllParameters)
</script>
<button
onclick={() => {
openAllParameters = !openAllParameters
}}
>{#if openAllParameters === false}Ouvrir tout{:else}Fermer tout{/if}</button
>
{#if billDecomposition !== undefined || billVariable !== undefined}
<div class="px-3">
<VariableHeader
......@@ -238,6 +246,7 @@
revaluationParameter={revaluationParameter as
| NodeParameter
| undefined}
{openAllParameters}
/>
{:else if billParameter.class === ParameterClass.Value}
<VariableReferredValueParameter
......@@ -277,12 +286,12 @@
{#if Object.keys(bothRootParameterById).length > 0}
<button
class=" w-full pr-4 pt-1 text-gray-600"
onclick={() => (openAllParameters = !openAllParameters)}
onclick={() => (openOtherParameters = !openOtherParameters)}
>
<div class="flex items-center font-serif">
<iconify-icon
class="mr-1 align-[-0.2rem] text-xl"
icon={openAllParameters
icon={openOtherParameters
? "ri-arrow-down-s-line"
: "ri-arrow-right-s-line"}
></iconify-icon>
......@@ -290,7 +299,7 @@
</div>
</button>
{#if openAllParameters}
{#if openOtherParameters}
<section class="mb-3 ml-2 border-l-2 pb-3 pl-0.5">
<ul>
{#each [...iterVariableRootParameters(bothRootParameterById, rootParameter, revaluationRootParameter, billRootParameter)] as [bothFilteredParameter, lawParameter, revaluationParameter, billParameter]}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment