LVRS Storyboard Frame

components/navigation/HierarchyList.svx

Path: components/navigation/HierarchyList.svx

Last modified:

HierarchyList

위치: qml/components/navigation/HierarchyList.qml

HierarchyList는 중첩된 트리 데이터를 계층 행으로 렌더링하고 부모‐자식 깊이에서 들여쓰기를 계산합니다.

목적

  • 계층형 모델 데이터를 받아 눈에 보이는 행으로 평탄화하십시오.
  • 자식, 손자 및 더 깊은 노드에 대한 깊이 기반 들여쓰기를 지원합니다.
  • 트리 행에 대한 활성화, 확장 및 키보드 탐색을 제공합니다.

API

모델 입력:

  • model / treeModel
  • childrenRole(기본값: children)
  • labelRole(기본값: label)
  • iconNameRole(기본값: iconName)

공통 역할:

  • itemIdRole, itemKeyRole
  • iconSourceRole, iconGlyphRole
  • enabledRole, expandedRole, selectedRole, showChevronRole

레이아웃 토큰:

  • generatedIndentStep(기본값: 13)
  • generatedRowHeight(기본값: 28)
  • generatedItemWidth(기본값: 200)
  • generatedIconSize(기본값: 16)
  • generatedChevronSize(기본값: 16)

상태:

  • activeItem
  • activeItemId
  • activeItemKey
  • itemCount
  • visibleItemCount

방법:

  • activateById(itemId)
  • activateByKey(itemKey)
  • expandAll()
  • collapseAll(keepRootExpanded)

신호:

  • activeChanged(item, itemId, index)
  • expansionChanged(item, expanded, index)
  • ensureVisibleRequested(y, height)

사용법

import LVRS 1.0 as LV

LV.HierarchyList {
    model: [
        {
            label: "Root",
            iconName: "projectStructure",
            children: [
                {
                    label: "Child",
                    iconName: "viewMoreSymbolicDefault",
                    children: [
                        { label: "Grandchild", iconName: "viewMoreSymbolicBorderless" }
                    ]
                }
            ]
        }
    ]
}

계층 규칙

  • indentLevel는 중첩된 children의 깊이에서 파생되었습니다.
  • 첫 번째 레벨은 기본 왼쪽 패딩 8를 사용합니다.
  • 각 깊이 단계마다 13 ( 8 , 21 , 34 , 47 , ...).

실패 패턴

모델에서 역할 이름이 변경되었지만 *Role 속성와 일치하는 것이 업데이트되지 않으면 레이블/아이콘/자식이 비어 있는 것으로 표시될 수 있습니다. 모델 역할 이름과 HierarchyList 역할 바인딩을 항상 정렬하십시오.