Files
NapCatQQ/.pnpm-store/v3/files/65/47cc0e30b245f2c2c06f277403074b4fef810444f9d6e279916d550bddf4affb898fe0eabff77fd9d9c3161229cb0f31209c355047c48be832ca26384c4414
T
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

42 lines
1.8 KiB
Plaintext

import { Collection, Key, Node, CollectionStateBase, DisabledBehavior, Expandable, MultipleSelection } from "@react-types/shared";
import { SelectionManager } from "@react-stately/selection";
export class TreeCollection<T> implements Collection<Node<T>> {
constructor(nodes: Iterable<Node<T>>, { expandedKeys }?: {
expandedKeys?: Set<Key>;
});
[Symbol.iterator](): IterableIterator<Node<T>>;
get size(): number;
getKeys(): IterableIterator<Key>;
getKeyBefore(key: Key): Key | null;
getKeyAfter(key: Key): Key | null;
getFirstKey(): Key | null;
getLastKey(): Key | null;
getItem(key: Key): Node<T> | null;
at(idx: number): Node<T> | null;
}
export interface TreeProps<T> extends CollectionStateBase<T>, Expandable, MultipleSelection {
/** Whether `disabledKeys` applies to all interactions, or only selection. */
disabledBehavior?: DisabledBehavior;
}
export interface TreeState<T> {
/** A collection of items in the tree. */
readonly collection: Collection<Node<T>>;
/** A set of keys for items that are disabled. */
readonly disabledKeys: Set<Key>;
/** A set of keys for items that are expanded. */
readonly expandedKeys: Set<Key>;
/** Toggles the expanded state for an item by its key. */
toggleKey(key: Key): void;
/** Replaces the set of expanded keys. */
setExpandedKeys(keys: Set<Key>): void;
/** A selection manager to read and update multiple selection state. */
readonly selectionManager: SelectionManager;
}
/**
* Provides state management for tree-like components. Handles building a collection
* of items from props, item expanded state, and manages multiple selection state.
*/
export function useTreeState<T extends object>(props: TreeProps<T>): TreeState<T>;
//# sourceMappingURL=types.d.ts.map