Skip to main content

@headless-tree/core

Index

Async Data Loader/General

Other

Async Data Loader/General

AsyncDataLoaderFeatureDef

AsyncDataLoaderFeatureDef<T>: { config: { createLoadingItemData?: () => T; onLoadedChildren?: (itemId: string, childrenIds: string[]) => void; onLoadedItem?: (itemId: string, item: T) => void; rootItemId: string; setLoadingItemChildrens?: SetStateFn<string[]>; setLoadingItemData?: SetStateFn<string[]> }; hotkeys: SyncDataLoaderFeatureDef<T>[hotkeys]; itemInstance: SyncDataLoaderFeatureDef<T>[itemInstance] & { hasLoadedData: () => boolean; invalidateChildrenIds: (optimistic?: boolean) => Promise<void>; invalidateItemData: (optimistic?: boolean) => Promise<void>; isLoading: () => boolean; updateCachedChildrenIds: (childrenIds: string[], skipUpdateTree?: boolean) => void; updateCachedData: (data: T | undefined, skipUpdateTree?: boolean) => void }; state: { loadingItemChildrens: string[]; loadingItemData: string[] }; treeInstance: SyncDataLoaderFeatureDef<T>[treeInstance] & { loadChildrenIds: (itemId: string) => Promise<string[]>; loadItemData: (itemId: string) => Promise<T>; waitForItemChildrenLoaded: (itemId: string) => Promise<void>; waitForItemDataLoaded: (itemId: string) => Promise<void> } }

Type parameters

  • T

Type declaration

  • config: { createLoadingItemData?: () => T; onLoadedChildren?: (itemId: string, childrenIds: string[]) => void; onLoadedItem?: (itemId: string, item: T) => void; rootItemId: string; setLoadingItemChildrens?: SetStateFn<string[]>; setLoadingItemData?: SetStateFn<string[]> }
    • optionalcreateLoadingItemData?: () => T

      Will be called when HT retrieves item data for an item whose item data is asynchronously being loaded. Can be used to create placeholder data to use for rendering the tree item while it is loaded. If not defined, the tree item data will be null.

        • (): T
        • Returns T

    • optionalonLoadedChildren?: (itemId: string, childrenIds: string[]) => void
        • (itemId: string, childrenIds: string[]): void
        • Parameters

          • itemId: string
          • childrenIds: string[]

          Returns void

    • optionalonLoadedItem?: (itemId: string, item: T) => void
        • (itemId: string, item: T): void
        • Parameters

          • itemId: string
          • item: T

          Returns void

    • rootItemId: string
    • optionalsetLoadingItemChildrens?: SetStateFn<string[]>
    • optionalsetLoadingItemData?: SetStateFn<string[]>
  • hotkeys: SyncDataLoaderFeatureDef<T>[hotkeys]
  • itemInstance: SyncDataLoaderFeatureDef<T>[itemInstance] & { hasLoadedData: () => boolean; invalidateChildrenIds: (optimistic?: boolean) => Promise<void>; invalidateItemData: (optimistic?: boolean) => Promise<void>; isLoading: () => boolean; updateCachedChildrenIds: (childrenIds: string[], skipUpdateTree?: boolean) => void; updateCachedData: (data: T | undefined, skipUpdateTree?: boolean) => void }
  • state: { loadingItemChildrens: string[]; loadingItemData: string[] }
    • loadingItemChildrens: string[]
    • loadingItemData: string[]
  • treeInstance: SyncDataLoaderFeatureDef<T>[treeInstance] & { loadChildrenIds: (itemId: string) => Promise<string[]>; loadItemData: (itemId: string) => Promise<T>; waitForItemChildrenLoaded: (itemId: string) => Promise<void>; waitForItemDataLoaded: (itemId: string) => Promise<void> }

Other

AsyncDataLoaderFeatureHotkeys

AsyncDataLoaderFeatureHotkeys<T>: AsyncDataLoaderFeatureDef<T>[hotkeys]

Type parameters

  • T

CheckboxesFeatureDef

CheckboxesFeatureDef<T>: { config: { canCheckFolders?: boolean; propagateCheckedState?: boolean; setCheckedItems?: SetStateFn<string[]>; setLoadingCheckPropagationItems?: SetStateFn<string[]> }; hotkeys: never; itemInstance: { getCheckboxProps: () => Record<string, any>; getCheckedState: () => CheckedState; isLoadingCheckPropagation: () => boolean; setChecked: () => Promise<void>; setUnchecked: () => Promise<void>; toggleCheckedState: () => Promise<void> }; state: { checkedItems: string[]; loadingCheckPropagationItems: string[] }; treeInstance: { setCheckedItems: (checkedItems: string[]) => void } }

Type parameters

  • T

Type declaration

  • config: { canCheckFolders?: boolean; propagateCheckedState?: boolean; setCheckedItems?: SetStateFn<string[]>; setLoadingCheckPropagationItems?: SetStateFn<string[]> }
    • optionalcanCheckFolders?: boolean
    • optionalpropagateCheckedState?: boolean
    • optionalsetCheckedItems?: SetStateFn<string[]>
    • optionalsetLoadingCheckPropagationItems?: SetStateFn<string[]>
  • hotkeys: never
  • itemInstance: { getCheckboxProps: () => Record<string, any>; getCheckedState: () => CheckedState; isLoadingCheckPropagation: () => boolean; setChecked: () => Promise<void>; setUnchecked: () => Promise<void>; toggleCheckedState: () => Promise<void> }
    • getCheckboxProps: () => Record<string, any>
        • (): Record<string, any>
        • Returns Record<string, any>

    • getCheckedState: () => CheckedState
    • isLoadingCheckPropagation: () => boolean
        • (): boolean
        • Returns boolean

    • setChecked: () => Promise<void>

      Will recursively load descendants if propagateCheckedState=true and async data loader is used. If not, this will return immediately.

        • (): Promise<void>
        • Returns Promise<void>

    • setUnchecked: () => Promise<void>

      Will recursively load descendants if propagateCheckedState=true and async data loader is used. If not, this will return immediately.

        • (): Promise<void>
        • Returns Promise<void>

    • toggleCheckedState: () => Promise<void>

      Will recursively load descendants if propagateCheckedState=true and async data loader is used. If not, this will return immediately.

        • (): Promise<void>
        • Returns Promise<void>

  • state: { checkedItems: string[]; loadingCheckPropagationItems: string[] }
    • checkedItems: string[]
    • loadingCheckPropagationItems: string[]
  • treeInstance: { setCheckedItems: (checkedItems: string[]) => void }
    • setCheckedItems: (checkedItems: string[]) => void
        • (checkedItems: string[]): void
        • Parameters

          • checkedItems: string[]

          Returns void

CheckboxesFeatureHotkeys

CheckboxesFeatureHotkeys<T>: CheckboxesFeatureDef<T>[hotkeys]

Type parameters

  • T

CustomHotkeysConfig

CustomHotkeysConfig<T>: Partial<Record<HotkeyName | `custom${string}`, Partial<HotkeyConfig<T>>>>

Type parameters

  • T

DragAndDropFeatureDef

DragAndDropFeatureDef<T>: { config: { canDrag?: (items: ItemInstance<T>[]) => boolean; canDragForeignDragObjectOver?: (dataTransfer: DataTransfer, target: DragTarget<T>) => boolean; canDrop?: (items: ItemInstance<T>[], target: DragTarget<T>) => boolean; canDropForeignDragObject?: (dataTransfer: DataTransfer, target: DragTarget<T>) => boolean; canReorder?: boolean; createForeignDragObject?: (items: ItemInstance<T>[]) => { data: any; dropEffect?: DataTransfer[dropEffect]; effectAllowed?: DataTransfer[effectAllowed]; format: string }; draggedItemOverwritesSelection?: boolean; indent?: number; onCompleteForeignDrop?: (items: ItemInstance<T>[]) => void; onDrop?: (items: ItemInstance<T>[], target: DragTarget<T>) => void | Promise<void>; onDropForeignDragObject?: (dataTransfer: DataTransfer, target: DragTarget<T>) => void | Promise<void>; openOnDropDelay?: number; reorderAreaPercentage?: number; seperateDragHandle?: boolean; setDndState?: SetStateFn<DndState<T> | undefined | null>; setDragImage?: (items: ItemInstance<T>[]) => { imgElement: Element; xOffset?: number; yOffset?: number } }; hotkeys: never; itemInstance: { getDragHandleProps: () => Record<string, any>; isDragTarget: () => boolean; isDragTargetAbove: () => boolean; isDragTargetBelow: () => boolean; isDraggingOver: () => boolean; isUnorderedDragTarget: () => boolean }; state: { dnd?: DndState<T> | null }; treeInstance: { getDragLineData: () => DragLineData | null; getDragLineStyle: (topOffset?: number, leftOffset?: number) => Record<string, any>; getDragTarget: () => DragTarget<T> | null } }

Type parameters

  • T

Type declaration

  • config: { canDrag?: (items: ItemInstance<T>[]) => boolean; canDragForeignDragObjectOver?: (dataTransfer: DataTransfer, target: DragTarget<T>) => boolean; canDrop?: (items: ItemInstance<T>[], target: DragTarget<T>) => boolean; canDropForeignDragObject?: (dataTransfer: DataTransfer, target: DragTarget<T>) => boolean; canReorder?: boolean; createForeignDragObject?: (items: ItemInstance<T>[]) => { data: any; dropEffect?: DataTransfer[dropEffect]; effectAllowed?: DataTransfer[effectAllowed]; format: string }; draggedItemOverwritesSelection?: boolean; indent?: number; onCompleteForeignDrop?: (items: ItemInstance<T>[]) => void; onDrop?: (items: ItemInstance<T>[], target: DragTarget<T>) => void | Promise<void>; onDropForeignDragObject?: (dataTransfer: DataTransfer, target: DragTarget<T>) => void | Promise<void>; openOnDropDelay?: number; reorderAreaPercentage?: number; seperateDragHandle?: boolean; setDndState?: SetStateFn<DndState<T> | undefined | null>; setDragImage?: (items: ItemInstance<T>[]) => { imgElement: Element; xOffset?: number; yOffset?: number } }
    • optionalcanDrag?: (items: ItemInstance<T>[]) => boolean
    • optionalcanDragForeignDragObjectOver?: (dataTransfer: DataTransfer, target: DragTarget<T>) => boolean

      Checks if a droppable visualization should be displayed when dragging a foreign object over a target. Since this is executed on a dragover event, dataTransfer.getData() is not available, so dataTransfer.effectAllowed or dataTransfer.types should be used instead. Before actually completing the drag, @{link canDropForeignDragObject} will be called by HT before applying the drop.

        • (dataTransfer: DataTransfer, target: DragTarget<T>): boolean
        • Parameters

          Returns boolean

    • optionalcanDrop?: (items: ItemInstance<T>[], target: DragTarget<T>) => boolean
    • optionalcanDropForeignDragObject?: (dataTransfer: DataTransfer, target: DragTarget<T>) => boolean

      Checks if a foreign drag object can be dropped on a target, validating that an actual drop can commence based on the data in the DataTransfer object.

        • (dataTransfer: DataTransfer, target: DragTarget<T>): boolean
        • Parameters

          Returns boolean

    • optionalcanReorder?: boolean
    • optionalcreateForeignDragObject?: (items: ItemInstance<T>[]) => { data: any; dropEffect?: DataTransfer[dropEffect]; effectAllowed?: DataTransfer[effectAllowed]; format: string }
        • (items: ItemInstance<T>[]): { data: any; dropEffect?: DataTransfer[dropEffect]; effectAllowed?: DataTransfer[effectAllowed]; format: string }
        • Parameters

          Returns { data: any; dropEffect?: DataTransfer[dropEffect]; effectAllowed?: DataTransfer[effectAllowed]; format: string }

          • data: any
          • optionaldropEffect?: DataTransfer[dropEffect]
          • optionaleffectAllowed?: DataTransfer[effectAllowed]
          • format: string
    • optionaldraggedItemOverwritesSelection?: boolean

      If true, the item that is dragged is not selected, the selected items will be overwritten to just the dragged item. Defaults to true

    • optionalindent?: number
    • optionalonCompleteForeignDrop?: (items: ItemInstance<T>[]) => void
    • optionalonDrop?: (items: ItemInstance<T>[], target: DragTarget<T>) => void | Promise<void>
    • optionalonDropForeignDragObject?: (dataTransfer: DataTransfer, target: DragTarget<T>) => void | Promise<void>
        • (dataTransfer: DataTransfer, target: DragTarget<T>): void | Promise<void>
        • Parameters

          Returns void | Promise<void>

    • optionalopenOnDropDelay?: number

      When dragging for this many ms on a closed folder, the folder will automatically open. Set to zero to disable.

    • optionalreorderAreaPercentage?: number

      Defines the size of the area at the top and bottom of an item where, when an item is dropped, the item willö be placed above or below the item within the same parent, as opposed to being placed inside the item. If canReorder is false, this is ignored.

    • optionalseperateDragHandle?: boolean

      If true, item.getProps() will not include drag event handlers. Use item.getDragHandleProps() on the handler element.

    • optionalsetDndState?: SetStateFn<DndState<T> | undefined | null>
    • optionalsetDragImage?: (items: ItemInstance<T>[]) => { imgElement: Element; xOffset?: number; yOffset?: number }
        • (items: ItemInstance<T>[]): { imgElement: Element; xOffset?: number; yOffset?: number }
        • Parameters

          Returns { imgElement: Element; xOffset?: number; yOffset?: number }

          • imgElement: Element
          • optionalxOffset?: number
          • optionalyOffset?: number
  • hotkeys: never
  • itemInstance: { getDragHandleProps: () => Record<string, any>; isDragTarget: () => boolean; isDragTargetAbove: () => boolean; isDragTargetBelow: () => boolean; isDraggingOver: () => boolean; isUnorderedDragTarget: () => boolean }
    • getDragHandleProps: () => Record<string, any>

      Note that item.getProps() already passes in all drag event handlers by default. Set seperateDragHandle to true to disable the default behavior and use this on the handler element instead.

        • (): Record<string, any>
        • Returns Record<string, any>

    • isDragTarget: () => boolean

      Checks if the user is dragging in a way which makes this the new parent of the dragged items, either by dragging on top of this item, or by dragging inbetween children of this item. See @{isUnorderedDragTarget} if the latter is undesirable.

        • (): boolean
        • Returns boolean

    • isDragTargetAbove: () => boolean
        • (): boolean
        • Returns boolean

    • isDragTargetBelow: () => boolean
        • (): boolean
        • Returns boolean

    • isDraggingOver: () => boolean
        • (): boolean
        • Returns boolean

    • isUnorderedDragTarget: () => boolean

      As opposed to @{isDragTarget}, this will not be true if the target is inbetween children of this item. This returns only true if the user is dragging directly on top of this item.

        • (): boolean
        • Returns boolean

  • state: { dnd?: DndState<T> | null }
  • treeInstance: { getDragLineData: () => DragLineData | null; getDragLineStyle: (topOffset?: number, leftOffset?: number) => Record<string, any>; getDragTarget: () => DragTarget<T> | null }
    • getDragLineData: () => DragLineData | null
    • getDragLineStyle: (topOffset?: number, leftOffset?: number) => Record<string, any>
        • (topOffset?: number, leftOffset?: number): Record<string, any>
        • Parameters

          • optionaltopOffset: number
          • optionalleftOffset: number

          Returns Record<string, any>

    • getDragTarget: () => DragTarget<T> | null

DragAndDropFeatureHotkeys

DragAndDropFeatureHotkeys<T>: DragAndDropFeatureDef<T>[hotkeys]

Type parameters

  • T

DragTarget

DragTarget<T>: { childIndex: number; dragLineIndex: number; dragLineLevel: number; insertionIndex: number; item: ItemInstance<T> } | { item: ItemInstance<T> }

Type parameters

  • T

EmptyFeatureDef

EmptyFeatureDef: { config: {}; hotkeys: never; itemInstance: {}; state: {}; treeInstance: {} }

Type declaration

  • config: {}
    • hotkeys: never
    • itemInstance: {}
      • state: {}
        • treeInstance: {}

          ExpandAllFeatureDef

          ExpandAllFeatureDef: { config: {}; hotkeys: expandSelected | collapseSelected; itemInstance: { collapseAll: () => void; expandAll: (cancelToken?: { current: boolean }) => Promise<void> }; state: {}; treeInstance: { collapseAll: () => void; expandAll: (cancelToken?: { current: boolean }) => Promise<void> } }

          Type declaration

          • config: {}
            • hotkeys: expandSelected | collapseSelected
            • itemInstance: { collapseAll: () => void; expandAll: (cancelToken?: { current: boolean }) => Promise<void> }
              • collapseAll: () => void
                  • (): void
                  • Returns void

              • expandAll: (cancelToken?: { current: boolean }) => Promise<void>
                  • (cancelToken?: { current: boolean }): Promise<void>
                  • Parameters

                    • optionalcancelToken: { current: boolean }

                    Returns Promise<void>

            • state: {}
              • treeInstance: { collapseAll: () => void; expandAll: (cancelToken?: { current: boolean }) => Promise<void> }
                • collapseAll: () => void
                    • (): void
                    • Returns void

                • expandAll: (cancelToken?: { current: boolean }) => Promise<void>
                    • (cancelToken?: { current: boolean }): Promise<void>
                    • Parameters

                      • optionalcancelToken: { current: boolean }

                      Returns Promise<void>

              ExpandAllFeatureHotkeys

              ExpandAllFeatureHotkeys: ExpandAllFeatureDef[hotkeys]

              FeatureDef

              FeatureDef: { config: any; hotkeys: string; itemInstance: any; state: any; treeInstance: any }

              Type declaration

              • config: any
              • hotkeys: string
              • itemInstance: any
              • state: any
              • treeInstance: any

              FeatureImplementation

              FeatureImplementation<T>: { deps?: string[]; getDefaultConfig?: (defaultConfig: Partial<TreeConfig<T>>, tree: TreeInstance<T>) => Partial<TreeConfig<T>>; getInitialState?: (initialState: Partial<TreeState<T>>, tree: TreeInstance<T>) => Partial<TreeState<T>>; hotkeys?: Partial<HotkeysConfig<T>>; itemInstance?: { [ key in keyof ItemInstance<T> ]?: (opts: ItemInstanceOpts<T, key>, ...args: Parameters<ItemInstance<T>[key]>) => void }; key?: string; onItemMount?: (instance: ItemInstance<T>, itemElement: HTMLElement, tree: TreeInstance<T>) => void; onItemUnmount?: (instance: ItemInstance<T>, itemElement: HTMLElement, tree: TreeInstance<T>) => void; onTreeMount?: (instance: TreeInstance<T>, treeElement: HTMLElement) => void; onTreeUnmount?: (instance: TreeInstance<T>, treeElement: HTMLElement) => void; overwrites?: string[]; stateHandlerNames?: Partial<Record<keyof TreeState<T>, keyof TreeConfig<T>>>; treeInstance?: { [ key in keyof TreeInstance<T> ]?: (opts: TreeInstanceOpts<key>, ...args: Parameters<TreeInstance<T>[key]>) => void } }

              Type parameters

              • T = any

              Type declaration

              HotkeyName

              HotkeyName: MergedFeatures<RegisteredFeatures<any>>[hotkeys]

              HotkeysConfig

              HotkeysConfig<T>: Record<HotkeyName, HotkeyConfig<T>>

              Type parameters

              • T

              HotkeysCoreFeatureDef

              HotkeysCoreFeatureDef<T>: { config: { hotkeys?: CustomHotkeysConfig<T>; ignoreHotkeysOnInputs?: boolean; onTreeHotkey?: (name: string, e: KeyboardEvent) => void }; hotkeys: never; itemInstance: {}; state: {}; treeInstance: {} }

              Type parameters

              • T

              Type declaration

              • config: { hotkeys?: CustomHotkeysConfig<T>; ignoreHotkeysOnInputs?: boolean; onTreeHotkey?: (name: string, e: KeyboardEvent) => void }
                • optionalhotkeys?: CustomHotkeysConfig<T>
                • optionalignoreHotkeysOnInputs?: boolean

                  Do not handle key inputs while an HTML input element is focused

                • optionalonTreeHotkey?: (name: string, e: KeyboardEvent) => void
                    • (name: string, e: KeyboardEvent): void
                    • Parameters

                      • name: string
                      • e: KeyboardEvent

                      Returns void

              • hotkeys: never
              • itemInstance: {}
                • state: {}
                  • treeInstance: {}

                    HotkeysCoreFeatureHotkeys

                    HotkeysCoreFeatureHotkeys<T>: HotkeysCoreFeatureDef<T>[hotkeys]

                    Type parameters

                    • T

                    InstanceBuilder

                    InstanceBuilder: <T>(features: FeatureImplementation[], instanceType: T, buildOpts: (self: any) => any) => [instance: InstanceTypeMap[T], finalize: () => void]

                    Type declaration

                      • <T>(features: FeatureImplementation[], instanceType: T, buildOpts: (self: any) => any): [instance: InstanceTypeMap[T], finalize: () => void]
                      • Type parameters

                        • T: keyof InstanceTypeMap

                        Parameters

                        Returns [instance: InstanceTypeMap[T], finalize: () => void]

                    ItemInstanceOpts

                    ItemInstanceOpts<T, Key>: { item: ItemInstance<T>; itemId: string; prev?: MayReturnNull<ItemInstance<T>[Key]>; tree: TreeInstance<T> }

                    Type parameters

                    Type declaration

                    KeyboardDragAndDropFeatureDef

                    KeyboardDragAndDropFeatureDef<T>: { config: { onStartKeyboardDrag?: (items: ItemInstance<T>[]) => void; setAssistiveDndState?: SetStateFn<AssistiveDndState | undefined | null> }; hotkeys: startDrag | cancelDrag | completeDrag | dragUp | dragDown; itemInstance: {}; state: { assistiveDndState?: AssistiveDndState | null }; treeInstance: { startKeyboardDrag: (items: ItemInstance<T>[]) => void; startKeyboardDragOnForeignObject: (dataTransfer: DataTransfer) => void; stopKeyboardDrag: () => void } }

                    Type parameters

                    • T

                    Type declaration

                    • config: { onStartKeyboardDrag?: (items: ItemInstance<T>[]) => void; setAssistiveDndState?: SetStateFn<AssistiveDndState | undefined | null> }
                    • hotkeys: startDrag | cancelDrag | completeDrag | dragUp | dragDown
                    • itemInstance: {}
                      • state: { assistiveDndState?: AssistiveDndState | null }
                      • treeInstance: { startKeyboardDrag: (items: ItemInstance<T>[]) => void; startKeyboardDragOnForeignObject: (dataTransfer: DataTransfer) => void; stopKeyboardDrag: () => void }
                        • startKeyboardDrag: (items: ItemInstance<T>[]) => void
                        • startKeyboardDragOnForeignObject: (dataTransfer: DataTransfer) => void
                            • (dataTransfer: DataTransfer): void
                            • Parameters

                              • dataTransfer: DataTransfer

                              Returns void

                        • stopKeyboardDrag: () => void
                            • (): void
                            • Returns void

                      KeyboardDragAndDropFeatureHotkeys

                      KeyboardDragAndDropFeatureHotkeys<T>: KeyboardDragAndDropFeatureDef<T>[hotkeys]

                      Type parameters

                      • T

                      MainFeatureDef

                      MainFeatureDef<T>: { config: { features?: FeatureImplementation<any>[]; initialState?: Partial<TreeState<T>>; instanceBuilder?: InstanceBuilder; setState?: SetStateFn<Partial<TreeState<T>>>; state?: Partial<TreeState<T>> }; hotkeys: never; itemInstance: { getElement: () => HTMLElement | undefined | null; getItemMeta: () => ItemMeta; registerElement: (element: HTMLElement | null) => void }; state: {}; treeInstance: { getConfig: () => TreeConfig<T>; getElement: () => HTMLElement | undefined | null; getHotkeyPresets: () => HotkeysConfig<T>; getItemInstance: (itemId: string) => ItemInstance<T>; getItems: () => ItemInstance<T>[]; getState: () => TreeState<T>; rebuildTree: () => void; registerElement: (element: HTMLElement | null) => void; scheduleRebuildTree: () => void; setConfig: SetStateFn<TreeConfig<T>>; setState: SetStateFn<TreeState<T>> } }

                      Type parameters

                      • T = any

                      Type declaration

                      MainFeatureHotkeys

                      MainFeatureHotkeys: MainFeatureDef[hotkeys]

                      PropMemoizationFeatureDef

                      PropMemoizationFeatureDef: { config: {}; hotkeys: never; itemInstance: {}; state: {}; treeInstance: {} }

                      Type declaration

                      • config: {}
                        • hotkeys: never
                        • itemInstance: {}
                          • state: {}
                            • treeInstance: {}

                              PropMemoizationHotkeys

                              PropMemoizationHotkeys: PropMemoizationFeatureDef[hotkeys]

                              ReactNativeFeatureDef

                              ReactNativeFeatureDef<T>: { config: { hotkeys?: CustomHotkeysConfig<T>; ignoreHotkeysOnInputs?: boolean; onTreeHotkey?: (name: string, e: KeyboardEvent) => void }; hotkeys: never; itemInstance: {}; state: {}; treeInstance: {} }

                              Type parameters

                              • T

                              Type declaration

                              • config: { hotkeys?: CustomHotkeysConfig<T>; ignoreHotkeysOnInputs?: boolean; onTreeHotkey?: (name: string, e: KeyboardEvent) => void }
                                • optionalhotkeys?: CustomHotkeysConfig<T>
                                • optionalignoreHotkeysOnInputs?: boolean
                                • optionalonTreeHotkey?: (name: string, e: KeyboardEvent) => void
                                    • (name: string, e: KeyboardEvent): void
                                    • Parameters

                                      • name: string
                                      • e: KeyboardEvent

                                      Returns void

                              • hotkeys: never
                              • itemInstance: {}
                                • state: {}
                                  • treeInstance: {}

                                    RegisteredFeatures

                                    Type parameters

                                    • T

                                    RenamingFeatureDef

                                    RenamingFeatureDef<T>: { config: { canRename?: (item: ItemInstance<T>) => boolean; onRename?: (item: ItemInstance<T>, value: string) => void; setRenamingItem?: SetStateFn<string | null | undefined>; setRenamingValue?: SetStateFn<string | undefined> }; hotkeys: renameItem | abortRenaming | completeRenaming; itemInstance: { canRename: () => boolean; getRenameInputProps: () => any; isRenaming: () => boolean; startRenaming: () => void }; state: { renamingItem?: string | null; renamingValue?: string }; treeInstance: { abortRenaming: () => void; completeRenaming: () => void; getRenamingItem: () => ItemInstance<T> | null; getRenamingValue: () => string; isRenamingItem: () => boolean } }

                                    Type parameters

                                    • T

                                    Type declaration

                                    • config: { canRename?: (item: ItemInstance<T>) => boolean; onRename?: (item: ItemInstance<T>, value: string) => void; setRenamingItem?: SetStateFn<string | null | undefined>; setRenamingValue?: SetStateFn<string | undefined> }
                                    • hotkeys: renameItem | abortRenaming | completeRenaming
                                    • itemInstance: { canRename: () => boolean; getRenameInputProps: () => any; isRenaming: () => boolean; startRenaming: () => void }
                                      • canRename: () => boolean
                                          • (): boolean
                                          • Returns boolean

                                      • getRenameInputProps: () => any
                                          • (): any
                                          • Returns any

                                      • isRenaming: () => boolean
                                          • (): boolean
                                          • Returns boolean

                                      • startRenaming: () => void
                                          • (): void
                                          • Returns void

                                    • state: { renamingItem?: string | null; renamingValue?: string }
                                      • optionalrenamingItem?: string | null
                                      • optionalrenamingValue?: string
                                    • treeInstance: { abortRenaming: () => void; completeRenaming: () => void; getRenamingItem: () => ItemInstance<T> | null; getRenamingValue: () => string; isRenamingItem: () => boolean }
                                      • abortRenaming: () => void
                                          • (): void
                                          • Returns void

                                      • completeRenaming: () => void
                                          • (): void
                                          • Returns void

                                      • getRenamingItem: () => ItemInstance<T> | null
                                      • getRenamingValue: () => string
                                          • (): string
                                          • Returns string

                                      • isRenamingItem: () => boolean
                                          • (): boolean
                                          • Returns boolean

                                    RenamingFeatureHotkeys

                                    RenamingFeatureHotkeys<T>: RenamingFeatureDef<T>[hotkeys]

                                    Type parameters

                                    • T

                                    SearchFeatureDef

                                    SearchFeatureDef<T>: { config: { isSearchMatchingItem?: (search: string, item: ItemInstance<T>) => boolean; onCloseSearch?: () => void; onOpenSearch?: () => void; setSearch?: SetStateFn<string | null> }; hotkeys: openSearch | closeSearch | submitSearch | nextSearchItem | previousSearchItem; itemInstance: { isMatchingSearch: () => boolean }; state: { search: string | null }; treeInstance: { closeSearch: () => void; getSearchInputElement: () => HTMLInputElement | null; getSearchInputElementProps: () => any; getSearchMatchingItems: () => ItemInstance<T>[]; getSearchValue: () => string; isSearchOpen: () => boolean; openSearch: (initialValue?: string) => void; registerSearchInputElement: (element: HTMLInputElement | null) => void; setSearch: (search: string | null) => void } }

                                    Type parameters

                                    • T

                                    Type declaration

                                    • config: { isSearchMatchingItem?: (search: string, item: ItemInstance<T>) => boolean; onCloseSearch?: () => void; onOpenSearch?: () => void; setSearch?: SetStateFn<string | null> }
                                      • optionalisSearchMatchingItem?: (search: string, item: ItemInstance<T>) => boolean
                                      • optionalonCloseSearch?: () => void
                                          • (): void
                                          • Returns void

                                      • optionalonOpenSearch?: () => void
                                          • (): void
                                          • Returns void

                                      • optionalsetSearch?: SetStateFn<string | null>
                                    • hotkeys: openSearch | closeSearch | submitSearch | nextSearchItem | previousSearchItem
                                    • itemInstance: { isMatchingSearch: () => boolean }
                                      • isMatchingSearch: () => boolean
                                          • (): boolean
                                          • Returns boolean

                                    • state: { search: string | null }
                                      • search: string | null
                                    • treeInstance: { closeSearch: () => void; getSearchInputElement: () => HTMLInputElement | null; getSearchInputElementProps: () => any; getSearchMatchingItems: () => ItemInstance<T>[]; getSearchValue: () => string; isSearchOpen: () => boolean; openSearch: (initialValue?: string) => void; registerSearchInputElement: (element: HTMLInputElement | null) => void; setSearch: (search: string | null) => void }
                                      • closeSearch: () => void
                                          • (): void
                                          • Returns void

                                      • getSearchInputElement: () => HTMLInputElement | null
                                          • (): HTMLInputElement | null
                                          • Returns HTMLInputElement | null

                                      • getSearchInputElementProps: () => any
                                          • (): any
                                          • Returns any

                                      • getSearchMatchingItems: () => ItemInstance<T>[]
                                      • getSearchValue: () => string
                                          • (): string
                                          • Returns string

                                      • isSearchOpen: () => boolean
                                          • (): boolean
                                          • Returns boolean

                                      • openSearch: (initialValue?: string) => void
                                          • (initialValue?: string): void
                                          • Parameters

                                            • optionalinitialValue: string

                                            Returns void

                                      • registerSearchInputElement: (element: HTMLInputElement | null) => void
                                          • (element: HTMLInputElement | null): void
                                          • Parameters

                                            • element: HTMLInputElement | null

                                            Returns void

                                      • setSearch: (search: string | null) => void
                                          • (search: string | null): void
                                          • Parameters

                                            • search: string | null

                                            Returns void

                                    SearchFeatureHotkeys

                                    SearchFeatureHotkeys<T>: SearchFeatureDef<T>[hotkeys]

                                    Type parameters

                                    • T

                                    SelectionFeatureDef

                                    SelectionFeatureDef<T>: { config: { setSelectedItems?: SetStateFn<string[]> }; hotkeys: toggleSelectedItem | selectUpwards | selectDownwards | selectAll; itemInstance: { deselect: () => void; isSelected: () => boolean; select: () => void; selectUpTo: (ctrl: boolean) => void; toggleSelect: () => void }; state: { selectedItems: string[] }; treeInstance: { getSelectedItems: () => ItemInstance<T>[]; setSelectedItems: (selectedItems: string[]) => void } }

                                    Type parameters

                                    • T

                                    Type declaration

                                    • config: { setSelectedItems?: SetStateFn<string[]> }
                                    • hotkeys: toggleSelectedItem | selectUpwards | selectDownwards | selectAll
                                    • itemInstance: { deselect: () => void; isSelected: () => boolean; select: () => void; selectUpTo: (ctrl: boolean) => void; toggleSelect: () => void }
                                      • deselect: () => void
                                          • (): void
                                          • Returns void

                                      • isSelected: () => boolean
                                          • (): boolean
                                          • Returns boolean

                                      • select: () => void
                                          • (): void
                                          • Returns void

                                      • selectUpTo: (ctrl: boolean) => void
                                          • (ctrl: boolean): void
                                          • Parameters

                                            • ctrl: boolean

                                            Returns void

                                      • toggleSelect: () => void
                                          • (): void
                                          • Returns void

                                    • state: { selectedItems: string[] }
                                      • selectedItems: string[]
                                    • treeInstance: { getSelectedItems: () => ItemInstance<T>[]; setSelectedItems: (selectedItems: string[]) => void }
                                      • getSelectedItems: () => ItemInstance<T>[]
                                      • setSelectedItems: (selectedItems: string[]) => void
                                          • (selectedItems: string[]): void
                                          • Parameters

                                            • selectedItems: string[]

                                            Returns void

                                    SelectionFeatureHotkeys

                                    SelectionFeatureHotkeys<T>: SelectionFeatureDef<T>[hotkeys]

                                    Type parameters

                                    • T

                                    SetStateFn

                                    SetStateFn<T>: (updaterOrValue: Updater<T>) => void

                                    Type parameters

                                    • T

                                    Type declaration

                                      • Parameters

                                        Returns void

                                    SyncDataLoaderFeatureDef

                                    SyncDataLoaderFeatureDef<T>: { config: { dataLoader: TreeDataLoader<T>; rootItemId: string }; hotkeys: never; itemInstance: { hasLoadedData: () => boolean; isLoading: () => boolean }; state: {}; treeInstance: { retrieveChildrenIds: (itemId: string, skipFetch?: boolean) => string[]; retrieveItemData: (itemId: string) => T } }

                                    Type parameters

                                    • T

                                    Type declaration

                                    • config: { dataLoader: TreeDataLoader<T>; rootItemId: string }
                                    • hotkeys: never
                                    • itemInstance: { hasLoadedData: () => boolean; isLoading: () => boolean }
                                      • hasLoadedData: () => boolean

                                        Returns true. Provided for consistency with async data loader

                                          • (): boolean
                                          • Returns boolean

                                      • isLoading: () => boolean

                                        Returns false. Provided for consistency with async data loader

                                          • (): boolean
                                          • Returns boolean

                                    • state: {}
                                      • treeInstance: { retrieveChildrenIds: (itemId: string, skipFetch?: boolean) => string[]; retrieveItemData: (itemId: string) => T }
                                        • retrieveChildrenIds: (itemId: string, skipFetch?: boolean) => string[]

                                          Retrieve children Ids. If an async data loader is used, skipFetch is set to true, and children have not been retrieved yet for this item, this will initiate fetching the children, and return an empty array. Once the children have loaded, a rerender will be triggered.

                                            • (itemId: string, skipFetch?: boolean): string[]
                                            • Parameters

                                              • itemId: string
                                              • optionalskipFetch: boolean

                                                Defaults to false.

                                              Returns string[]

                                        • retrieveItemData: (itemId: string) => T
                                            • (itemId: string): T
                                            • Parameters

                                              • itemId: string

                                              Returns T

                                      SyncDataLoaderFeatureHotkeys

                                      SyncDataLoaderFeatureHotkeys<T>: SyncDataLoaderFeatureDef<T>[hotkeys]

                                      Type parameters

                                      • T

                                      TreeDataLoader

                                      TreeDataLoader<T>: { getChildren: (itemId: string) => string[] | Promise<string[]>; getItem: (itemId: string) => T | Promise<T> } | { getChildrenWithData: (itemId: string) => { data: T; id: string }[] | Promise<{ data: T; id: string }[]>; getItem: (itemId: string) => T | Promise<T> }

                                      Type parameters

                                      • T

                                      TreeFeatureDef

                                      TreeFeatureDef<T>: { config: { getItemName: (item: ItemInstance<T>) => string; isItemFolder: (item: ItemInstance<T>) => boolean; onPrimaryAction?: (item: ItemInstance<T>) => void; scrollToItem?: (item: ItemInstance<T>) => void; setExpandedItems?: SetStateFn<string[]>; setFocusedItem?: SetStateFn<string | null> }; hotkeys: focusNextItem | focusPreviousItem | expandOrDown | collapseOrUp | focusFirstItem | focusLastItem; itemInstance: { collapse: () => void; equals: (other?: ItemInstance<any> | null) => boolean; expand: () => void; getChildren: () => ItemInstance<T>[]; getId: () => string; getIndexInParent: () => number; getItemAbove: () => ItemInstance<T> | undefined; getItemBelow: () => ItemInstance<T> | undefined; getItemData: () => T; getItemName: () => string; getKey: () => string; getParent: () => ItemInstance<T> | undefined; getProps: () => Record<string, any>; getTree: () => TreeInstance<T>; isDescendentOf: (parentId: string) => boolean; isExpanded: () => boolean; isFocused: () => boolean; isFolder: () => boolean; primaryAction: () => void; scrollTo: (scrollIntoViewArg?: boolean | ScrollIntoViewOptions) => Promise<void>; setFocused: () => void }; state: { expandedItems: string[]; focusedItem: string | null }; treeInstance: { focusNextItem: () => void; focusPreviousItem: () => void; getContainerProps: (treeLabel?: string) => Record<string, any>; getFocusedItem: () => ItemInstance<T>; getRootItem: () => ItemInstance<T>; updateDomFocus: () => void } }

                                      Type parameters

                                      • T

                                      Type declaration

                                      • config: { getItemName: (item: ItemInstance<T>) => string; isItemFolder: (item: ItemInstance<T>) => boolean; onPrimaryAction?: (item: ItemInstance<T>) => void; scrollToItem?: (item: ItemInstance<T>) => void; setExpandedItems?: SetStateFn<string[]>; setFocusedItem?: SetStateFn<string | null> }
                                      • hotkeys: focusNextItem | focusPreviousItem | expandOrDown | collapseOrUp | focusFirstItem | focusLastItem
                                      • itemInstance: { collapse: () => void; equals: (other?: ItemInstance<any> | null) => boolean; expand: () => void; getChildren: () => ItemInstance<T>[]; getId: () => string; getIndexInParent: () => number; getItemAbove: () => ItemInstance<T> | undefined; getItemBelow: () => ItemInstance<T> | undefined; getItemData: () => T; getItemName: () => string; getKey: () => string; getParent: () => ItemInstance<T> | undefined; getProps: () => Record<string, any>; getTree: () => TreeInstance<T>; isDescendentOf: (parentId: string) => boolean; isExpanded: () => boolean; isFocused: () => boolean; isFolder: () => boolean; primaryAction: () => void; scrollTo: (scrollIntoViewArg?: boolean | ScrollIntoViewOptions) => Promise<void>; setFocused: () => void }
                                        • collapse: () => void
                                            • (): void
                                            • Returns void

                                        • equals: (other?: ItemInstance<any> | null) => boolean
                                        • expand: () => void
                                            • (): void
                                            • Returns void

                                        • getChildren: () => ItemInstance<T>[]
                                        • getId: () => string
                                            • (): string
                                            • Returns string

                                        • getIndexInParent: () => number
                                            • (): number
                                            • Returns number

                                        • getItemAbove: () => ItemInstance<T> | undefined
                                        • getItemBelow: () => ItemInstance<T> | undefined
                                        • getItemData: () => T
                                            • (): T
                                            • Returns T

                                        • getItemName: () => string
                                            • (): string
                                            • Returns string

                                        • getKey: () => string
                                            • (): string
                                            • Returns string

                                        • getParent: () => ItemInstance<T> | undefined
                                        • getProps: () => Record<string, any>
                                            • (): Record<string, any>
                                            • Returns Record<string, any>

                                        • getTree: () => TreeInstance<T>
                                        • isDescendentOf: (parentId: string) => boolean
                                            • (parentId: string): boolean
                                            • Parameters

                                              • parentId: string

                                              Returns boolean

                                        • isExpanded: () => boolean
                                            • (): boolean
                                            • Returns boolean

                                        • isFocused: () => boolean
                                            • (): boolean
                                            • Returns boolean

                                        • isFolder: () => boolean
                                            • (): boolean
                                            • Returns boolean

                                        • primaryAction: () => void
                                            • (): void
                                            • Returns void

                                        • scrollTo: (scrollIntoViewArg?: boolean | ScrollIntoViewOptions) => Promise<void>
                                            • (scrollIntoViewArg?: boolean | ScrollIntoViewOptions): Promise<void>
                                            • Parameters

                                              • optionalscrollIntoViewArg: boolean | ScrollIntoViewOptions

                                              Returns Promise<void>

                                        • setFocused: () => void
                                            • (): void
                                            • Returns void

                                      • state: { expandedItems: string[]; focusedItem: string | null }
                                        • expandedItems: string[]
                                        • focusedItem: string | null
                                      • treeInstance: { focusNextItem: () => void; focusPreviousItem: () => void; getContainerProps: (treeLabel?: string) => Record<string, any>; getFocusedItem: () => ItemInstance<T>; getRootItem: () => ItemInstance<T>; updateDomFocus: () => void }
                                        • focusNextItem: () => void
                                            • (): void
                                            • Returns void

                                        • focusPreviousItem: () => void
                                            • (): void
                                            • Returns void

                                        • getContainerProps: (treeLabel?: string) => Record<string, any>

                                          Pass to the container rendering the tree children. The treeLabel parameter will be passed as aria-label parameter, and is recommended to be set.

                                            • (treeLabel?: string): Record<string, any>
                                            • Parameters

                                              • optionaltreeLabel: string

                                              Returns Record<string, any>

                                        • getFocusedItem: () => ItemInstance<T>
                                        • getRootItem: () => ItemInstance<T>
                                        • updateDomFocus: () => void
                                            • (): void
                                            • Returns void

                                      TreeFeatureHotkeys

                                      TreeFeatureHotkeys<T>: TreeFeatureDef<T>[hotkeys]

                                      Type parameters

                                      • T

                                      TreeInstanceOpts

                                      TreeInstanceOpts<Key>: { prev?: MayReturnNull<TreeInstance<any>[Key]>; tree: TreeInstance<any> }

                                      Type parameters

                                      Type declaration

                                      Updater

                                      Updater<T>: T | (old: T) => T

                                      Type parameters

                                      • T

                                      constasyncDataLoaderFeature

                                      asyncDataLoaderFeature: FeatureImplementation = ...

                                      constcheckboxesFeature

                                      checkboxesFeature: FeatureImplementation = ...

                                      constdragAndDropFeature

                                      dragAndDropFeature: FeatureImplementation = ...

                                      constexpandAllFeature

                                      expandAllFeature: FeatureImplementation = ...

                                      consthotkeysCoreFeature

                                      hotkeysCoreFeature: FeatureImplementation = ...

                                      constkeyboardDragAndDropFeature

                                      keyboardDragAndDropFeature: FeatureImplementation = ...

                                      constpropMemoizationFeature

                                      propMemoizationFeature: FeatureImplementation = ...

                                      constreactNativeFeature

                                      reactNativeFeature: FeatureImplementation = ...

                                      constrenamingFeature

                                      renamingFeature: FeatureImplementation = ...

                                      constsearchFeature

                                      searchFeature: FeatureImplementation = ...

                                      constselectionFeature

                                      selectionFeature: FeatureImplementation = ...

                                      constsyncDataLoaderFeature

                                      syncDataLoaderFeature: FeatureImplementation = ...