import { INode, NodeConfig } from '@antv/g6-core'; import { Util } from '../Common/util'; import { NodeLabelOption, NodeOption, Style } from '../options'; import { SourceNode } from '../sources'; import { ModelConstructor } from './modelConstructor'; import { SVLink } from './SVLink'; import { SVModel } from './SVModel'; import { SVNodeAppendage } from './SVNodeAppendage'; export class SVNode extends SVModel { public sourceId: string; public sourceNode: SourceNode; public links: { inDegree: SVLink[]; outDegree: SVLink[]; }; private label: string | string[]; private disable: boolean; public appendages: { [key: string]: SVNodeAppendage[] }; constructor( id: string, type: string, group: string, layout: string, sourceNode: SourceNode, label: string | string[], options: NodeOption ) { super(id, type, group, layout, 'node'); this.group = group; this.layout = layout; Object.keys(sourceNode).map(prop => { if (prop !== 'id') { this[prop] = sourceNode[prop]; } }); this.sourceNode = sourceNode; this.sourceId = sourceNode.id.toString(); this.links = { inDegree: [], outDegree: [] }; this.appendages = {}; this.sourceNode = sourceNode; this.label = label; this.G6ModelProps = this.generateG6ModelProps(options); } generateG6ModelProps(options: NodeOption): NodeConfig { const style = Util.objectClone