UNPKG

@gravity-ui/graph

Version:

Modern graph editor component

47 lines (46 loc) 2.22 kB
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>>; $groups: import("@preact/signals-core").ReadonlySignal<GroupState[]>; $blockGroups: import("@preact/signals-core").ReadonlySignal<import("lodash").Dictionary<import("../..").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[]>; 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(groups: TGroup[]): void; protected getOrCreateGroupState(group: TGroup): GroupState; protected applyGroupsState(groups: GroupState[]): void; getGroupState(id: TGroupId): GroupState; 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[]; }