import type { ComboData, EdgeData, NodeData } from '../spec/data';
import type { ID } from '../types';
export type DataID = {
nodes?: ID[];
edges?: ID[];
combos?: ID[];
};
export type NodeLikeData = NodeData | ComboData;
export type ElementDatum = NodeData | EdgeData | ComboData;
export type ElementData = NodeData[] | EdgeData[] | ComboData[];
/**
* 节点、边更新可选数据
*
* Node, edge update optional data
* @remarks
* 必须包含 id 字段,其他字段可选
*
* Must contain the id field, other fields are optional
*/
export type PartialNodeLikeData = Partial & Pick;
/**
* 边更新可选数据
*
* Edge update optional data
* @remarks
* 包含两种情况:
* 1. 必须包含 source、target 字段,其他字段可选
* 2. 必须包含 id 字段,其他字段可选
*
* Contains two cases:
* 1. Must contain the source and target fields, other fields are optional
* 2. Must contain the id field, other fields are optional
*/
export type PartialEdgeData = (Partial & Pick) | (Partial & Pick);
/**
* G6 数据更新可选数据
*
* G6 data update optional data
*/
export type PartialGraphData = {
nodes?: PartialNodeLikeData[];
edges?: PartialEdgeData[];
combos?: PartialNodeLikeData[];
};
/**
* 层级结构类别
*
* Hierarchy structure category
* @remarks
* G6 中树形层级结构和组合层级结构是相互独立的,分别对应不同的数据结构
* 一些 API 需要指定层级结构类别,例如 getAncestorsData、getParentData
*
* The tree hierarchy structure and the combo hierarchy structure in G6 are independent of each other, corresponding to different data structures
* Some APIs need to specify the hierarchy structure category, such as getAncestorsData, getParentData
*/
export type HierarchyKey = 'tree' | 'combo';