@gravity-ui/graph
Version:
Modern graph editor component
41 lines (40 loc) • 1.98 kB
TypeScript
import { Graph } from "../../graph";
import { ESelectionStrategy } from "../../utils/types/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>[]>>;
$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[];
setGroupSelection(group: GroupState | GroupState["id"], selected: boolean, params?: {
ignoreChanges?: boolean;
}): boolean;
protected computeSelectionChange(ids: TGroupId[], selected: boolean, strategy?: ESelectionStrategy): {
add: GroupState[];
removed: GroupState[];
list: GroupState[];
};
updateGroupsSelection(ids: TGroupId[], selected: boolean, strategy?: ESelectionStrategy): void;
resetSelection(): void;
protected getGroupStates(ids: GroupState["id"][]): GroupState[];
}