UBER-130: Fix expand/collapse on multiple levels (#3198)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2023-05-16 20:03:10 +07:00 committed by GitHub
parent 57b0975404
commit 55780b116a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -124,6 +124,7 @@
{viewOptionsConfig}
{selectedObjectIds}
level={0}
groupPersistKey={''}
{createItemDialog}
{createItemLabel}
on:check

View File

@ -56,6 +56,7 @@
}
export let listDiv: HTMLDivElement
export let selection: number | undefined = undefined
export let groupPersistKey: string
$: groupByKey = viewOptions.groupBy[level] ?? noCategory
let categories: CategoryType[] = []
@ -297,6 +298,7 @@
{config}
{itemModels}
{_class}
groupPersistKey={`${groupPersistKey}_${level}_${typeof category === 'object' ? category.name : category}`}
singleCat={level === 0 && categories.length === 1}
oneCat={viewOptions.groupBy.length === 1}
lastCat={i === categories.length - 1}
@ -357,6 +359,7 @@
{flatHeaders}
{props}
{level}
groupPersistKey={`${groupPersistKey}_${level}_${typeof category === 'object' ? category.name : category}`}
{initIndex}
{viewOptionsConfig}
{listDiv}

View File

@ -63,6 +63,7 @@
}
export let listDiv: HTMLDivElement
export let index: number
export let groupPersistKey: string
$: lastLevel = level + 1 >= viewOptions.groupBy.length
@ -72,9 +73,7 @@
$: initialLimit = !lastLevel ? undefined : singleCat ? singleCategoryLimit : defaultLimit
$: limit = initialLimit
$: categoryCollapseKey = `list_collapsing_${location.pathname}_${
typeof category === 'object' ? category.name : category
}`
$: categoryCollapseKey = `list_collapsing_${location.pathname}_${groupPersistKey}`
$: storedCollapseState = localStorage.getItem(categoryCollapseKey)
$: collapsed = storedCollapseState === 'true' || storedCollapseState === null
@ -402,6 +401,7 @@
{flatHeaders}
{props}
level={level + 1}
{groupPersistKey}
{viewOptionsConfig}
{listDiv}
dragItem