@gravity-ui/graph
Version:
Modern graph editor component
47 lines (46 loc) • 2.32 kB
TypeScript
import { Graph } from "../../graph";
import { MultipleSelectionBucket } from "../../services/selection/MultipleSelectionBucket";
import { ESelectionStrategy } from "../../services/selection/types";
import { RootStore } from "../index";
import { GroupState, TGroup, TGroupId } from "./Group";
declare module "../../graphEvents" {
interface GraphEventsDefinitions {
"groups-selection-change": (event: SelectionEvent<TGroupId>) => void;
}
}
export declare class GroupsListStore {
rootStore: RootStore;
protected graph: Graph;
$groupsMap: import("@preact/signals-core").Signal<Map<string, GroupState<TGroup>>>;
$groups: import("@preact/signals-core").ReadonlySignal<GroupState<TGroup>[]>;
$blockGroups: import("@preact/signals-core").ReadonlySignal<import("lodash").Dictionary<import("../block/Block").BlockState<import("../..").TBlock>[]>>;
/**
* Bucket for managing group selection state
*/
readonly groupSelectionBucket: MultipleSelectionBucket<string, import("../../services/selection/types").TSelectionEntity>;
$selectedGroups: import("@preact/signals-core").ReadonlySignal<GroupState<TGroup>[]>;
constructor(rootStore: RootStore, graph: Graph);
protected updateGroupsMap(groups: Map<GroupState["id"], GroupState> | [GroupState["id"], GroupState][]): void;
addGroup(group: TGroup): string;
deleteGroups(groups: (TGroup["id"] | TGroup)[]): void;
updateGroups(groups: TGroup[]): void;
setGroups<T extends TGroup>(groups: T[]): void;
protected getOrCreateGroupState<T extends TGroup>(group: T): GroupState<TGroup>;
protected applyGroupsState(groups: GroupState[]): void;
getGroupState<T extends TGroup>(id: TGroupId): GroupState<T> | undefined;
getGroup(id: TGroupId): TGroup | undefined;
reset(): void;
toJSON(): TGroup[];
/**
* Updates group selection using the SelectionService
* @param ids Group IDs to update selection for
* @param selected Whether to select or deselect
* @param strategy The selection strategy to apply
*/
updateGroupsSelection(ids: TGroupId[], selected: boolean, strategy?: ESelectionStrategy): void;
/**
* Resets the selection for groups
*/
resetSelection(): void;
protected getGroupStates(ids: GroupState["id"][]): GroupState<TGroup>[];
}