New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@antv/g6-core

Package Overview
Dependencies
Maintainers
34
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/g6-core - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

6

es/element/shapeBase.js

@@ -305,3 +305,3 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

} else if (labelStyle.background) {
var calculateBgStyle = this.getLabelBgStyleByPosition(label, cfg, labelCfg, group); // const labelBgStyle = Object.assign({}, labelBg.attr(), calculateBgStyle, cfgBgStyle);
var calculateBgStyle = this.getLabelBgStyleByPosition(label, cfg, labelCfg, group);

@@ -313,3 +313,5 @@ var labelBgStyle = __assign(__assign({}, calculateBgStyle), cfgBgStyle);

if (rotate) {
labelBg.rotateAtStart(rotate);
var bgRotateMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
bgRotateMatrix = transform(bgRotateMatrix, [['t', -labelBgStyle.x, -labelBgStyle.y], ['r', rotate], ['t', labelBgStyle.x, labelBgStyle.y]]);
labelBgStyle.matrix = bgRotateMatrix;
}

@@ -316,0 +318,0 @@

@@ -50,3 +50,3 @@ var subjectColor = 'rgb(95, 149, 255)';

export default {
version: '0.0.6',
version: '0.0.7',
rootContainerClassName: 'root-container',

@@ -53,0 +53,0 @@ nodeContainerClassName: 'node-container',

@@ -109,9 +109,7 @@ import { __assign } from "tslib";

if (source.getType && source.getType() === 'combo') {
model.isComboEdge = true;
graph.updateCombo(source);
model.isComboEdge = true; // graph.updateCombo(source as ICombo);
}
if (target.getType && target.getType() === 'combo') {
model.isComboEdge = true;
graph.updateCombo(target);
model.isComboEdge = true; // graph.updateCombo(target as ICombo);
}

@@ -184,2 +182,4 @@

ItemController.prototype.updateItem = function (item, cfg) {
var _a, _b;
var graph = this.graph;

@@ -261,7 +261,26 @@

item.update(cfg, isOnlyMove);
var edges = item.getEdges();
var edges_1 = item.getEdges();
var refreshEdge = shouldRefreshEdge(cfg);
if (refreshEdge) each(edges, function (edge) {
if (refreshEdge && type === NODE) each(edges_1, function (edge) {
edge.refresh();
});
});else if (refreshEdge && type === COMBO) {
var shapeFactory = item.get('shapeFactory');
var shapeType = model.type || 'circle';
var comboAnimate = model.animate === undefined || cfg.animate === undefined ? (_b = (_a = shapeFactory[shapeType]) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.animate : model.animate || cfg.animate;
if (comboAnimate) {
setTimeout(function () {
if (!item || item.destroyed) return;
var keyShape = item.getKeyShape();
if (!keyShape || keyShape.destroyed) return;
each(edges_1, function (edge) {
if (edge && !edge.destroyed) edge.refresh();
});
}, 201);
} else {
each(edges_1, function (edge) {
edge.refresh();
});
}
}
}

@@ -284,2 +303,4 @@

ItemController.prototype.updateCombo = function (combo, children) {
var _a, _b;
var graph = this.graph;

@@ -303,6 +324,23 @@

var length = combEdges.length;
var model = combo.getModel();
var shapeFactory = combo.get('shapeFactory');
var shapeType = model.type || 'circle';
var comboAnimate = model.animate === undefined ? (_b = (_a = shapeFactory[shapeType]) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.animate : model.animate;
for (var i = 0; i < length; i++) {
var edge = combEdges[i];
edge.refresh();
if (comboAnimate) {
setTimeout(function () {
if (!combo || combo.destroyed) return;
var keyShape = combo.getKeyShape();
if (!keyShape || keyShape.destroyed) return;
for (var i = 0; i < length; i++) {
var edge = combEdges[i];
if (edge && !edge.destroyed) edge.refresh();
}
}, 201);
} else {
for (var i = 0; i < length; i++) {
var edge = combEdges[i];
if (edge && !edge.destroyed) edge.refresh();
}
}

@@ -674,7 +712,11 @@ };

});
children_1.forEach(function (child) {
var childItem = graph.findById(child.id);
_this.changeItemVisibility(childItem, visible);
});
if (children_1) {
children_1.forEach(function (child) {
var childItem = graph.findById(child.id);
_this.changeItemVisibility(childItem, visible);
});
}
var edges = item.getEdges();

@@ -681,0 +723,0 @@ each(edges, function (edge) {

@@ -547,3 +547,3 @@ import EventEmitter from '@antv/event-emitter';

*/
on(eventName: string, callback: (e: IG6GraphEvent) => void, once?: boolean): this;
on<T = IG6GraphEvent>(eventName: string, callback: (e: T) => void, once?: boolean): this;
/**

@@ -550,0 +550,0 @@ * 销毁画布

@@ -1,3 +0,2 @@

/// <reference types="gl-matrix" />
import Behavior from './behavior';
/// <reference types="_gl-matrix@3.3.0@gl-matrix" />
import AbstractGraph from './graph/graph';

@@ -15,3 +14,3 @@ import Shape, { Arrow, Marker } from './element';

declare const registerCombo: typeof Shape.registerCombo;
declare const registerBehavior: typeof Behavior.registerBehavior;
declare const registerBehavior: (type: string, behavior: import("./types").BehaviorOption) => void;
declare const BaseGlobal: {

@@ -200,4 +199,4 @@ version: string;

};
export * from './types';
export { Arrow, Shape, Node, Edge, Combo, Hull, Marker, registerNode, registerCombo, AbstractGraph, Util, registerEdge, registerBehavior, AbstractLayout, AbstractEvent, BaseGlobal, };
export * from './types';
declare const _default: {

@@ -503,3 +502,3 @@ version: string;

registerCombo: typeof Shape.registerCombo;
registerBehavior: typeof Behavior.registerBehavior;
registerBehavior: (type: string, behavior: import("./types").BehaviorOption) => void;
Arrow: {

@@ -506,0 +505,0 @@ triangle: (width?: number, length?: number, d?: number) => string;

@@ -18,4 +18,4 @@ import Behavior from './behavior';

var BaseGlobal = Global;
export * from './types';
export { Arrow, Shape, Node, Edge, Combo, Hull, Marker, registerNode, registerCombo, AbstractGraph, Util, registerEdge, registerBehavior, AbstractLayout, AbstractEvent, BaseGlobal };
export * from './types';
export default {

@@ -22,0 +22,0 @@ version: Global.version,

import { Event as GraphEvent, ICanvas } from '@antv/g-base';
import { G6Event, IG6GraphEvent, IShapeBase, Item } from '../types';
import { G6Event, IG6GraphEvent, IShapeBase, Item, BehaviorOption } from '../types';
import { IAbstractGraph } from './graph';
export interface IBehavior {
registerBehavior: (type: string, behavior: BehaviorOption) => void;
hasBehavior: (type: string) => boolean;
getBehavior: (type: string) => any;
}
export interface IBehaviorOption {
type: string;

@@ -6,0 +11,0 @@ getEvents: () => {

@@ -485,3 +485,3 @@ import EventEmitter from '@antv/event-emitter';

*/
on: (eventName: string, callback: (e: IG6GraphEvent) => void, once?: boolean) => this;
on: <T = IG6GraphEvent>(eventName: string, callback: (e: T) => void, once?: boolean) => this;
/**

@@ -488,0 +488,0 @@ * 销毁画布

@@ -66,2 +66,3 @@ import { __assign, __extends } from "tslib";

Combo.prototype.calculateCanvasBBox = function () {
if (this.destroyed) return;
var keyShape = this.get('keyShape');

@@ -71,7 +72,8 @@ var group = this.get('group'); // 因为 group 可能会移动,所以必须通过父元素计算才能计算出正确的包围盒

var bbox = getBBox(keyShape, group);
bbox.x = bbox.minX;
bbox.y = bbox.minY;
bbox.centerX = (bbox.minX + bbox.maxX) / 2;
bbox.centerY = (bbox.minY + bbox.maxY) / 2;
var cacheSize = this.get(CACHE_SIZE);
var cacheBBox = this.get(CACHE_BBOX) || {};
var oriX = cacheBBox.x;
var oriY = cacheBBox.x;

@@ -100,2 +102,5 @@ if (cacheSize) {

bbox.x = bbox.minX;
bbox.y = bbox.minY;
if (bbox.x !== oriX || bbox.y !== oriY) this.set(CACHE_ANCHOR_POINTS, null);
return bbox;

@@ -102,0 +107,0 @@ };

import { __extends } from "tslib";
import { each, isNil, mix } from '@antv/util';
import { each, isNil } from '@antv/util';
import { distance, getCircleIntersectByPoint, getEllipseIntersectByPoint, getRectIntersectByPoint } from '../util/math';

@@ -140,4 +140,4 @@ import Item from './item';

if (itemType === 'combo') {
centerX = (bbox.maxX + bbox.minX) / 2;
centerY = (bbox.maxY + bbox.minY) / 2;
centerX = bbox.centerX || (bbox.maxX + bbox.minX) / 2;
centerY = bbox.centerY || (bbox.maxY + bbox.minY) / 2;
} else {

@@ -212,8 +212,7 @@ centerX = bbox.centerX;

each(points, function (pointArr, index) {
var point = mix({
var point = {
x: bbox_1.minX + pointArr[0] * bbox_1.width,
y: bbox_1.minY + pointArr[1] * bbox_1.height
}, pointArr[2], {
index: index
});
y: bbox_1.minY + pointArr[1] * bbox_1.height,
anchorIndex: index
};
anchorPoints.push(point);

@@ -220,0 +219,0 @@ });

@@ -129,2 +129,3 @@ import { IGroup, Event as GraphEvent, BBox, AnimateCfg, ICanvas, IShape } from '@antv/g-base';

functionParams?: any[];
relayout?: boolean;
shouldUpdate?: (e: IG6GraphEvent) => boolean;

@@ -131,0 +132,0 @@ shouldBegin?: (e: IG6GraphEvent) => boolean;

@@ -1,2 +0,2 @@

/// <reference types="gl-matrix" />
/// <reference types="_gl-matrix@3.3.0@gl-matrix" />
import * as MathUtil from './math';

@@ -3,0 +3,0 @@ import { ext, mat3 } from '@antv/matrix-util';

@@ -316,4 +316,3 @@ "use strict";

} else if (labelStyle.background) {
var calculateBgStyle = this.getLabelBgStyleByPosition(label, cfg, labelCfg, group); // const labelBgStyle = Object.assign({}, labelBg.attr(), calculateBgStyle, cfgBgStyle);
var calculateBgStyle = this.getLabelBgStyleByPosition(label, cfg, labelCfg, group);
var labelBgStyle = (0, _tslib.__assign)((0, _tslib.__assign)({}, calculateBgStyle), cfgBgStyle);

@@ -323,3 +322,5 @@ labelBg.resetMatrix();

if (rotate) {
labelBg.rotateAtStart(rotate);
var bgRotateMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
bgRotateMatrix = transform(bgRotateMatrix, [['t', -labelBgStyle.x, -labelBgStyle.y], ['r', rotate], ['t', labelBgStyle.x, labelBgStyle.y]]);
labelBgStyle.matrix = bgRotateMatrix;
}

@@ -326,0 +327,0 @@

@@ -56,3 +56,3 @@ "use strict";

var _default = {
version: '0.0.6',
version: '0.0.7',
rootContainerClassName: 'root-container',

@@ -59,0 +59,0 @@ nodeContainerClassName: 'node-container',

@@ -124,9 +124,7 @@ "use strict";

if (source.getType && source.getType() === 'combo') {
model.isComboEdge = true;
graph.updateCombo(source);
model.isComboEdge = true; // graph.updateCombo(source as ICombo);
}
if (target.getType && target.getType() === 'combo') {
model.isComboEdge = true;
graph.updateCombo(target);
model.isComboEdge = true; // graph.updateCombo(target as ICombo);
}

@@ -199,2 +197,4 @@

ItemController.prototype.updateItem = function (item, cfg) {
var _a, _b;
var graph = this.graph;

@@ -276,7 +276,26 @@

item.update(cfg, isOnlyMove);
var edges = item.getEdges();
var edges_1 = item.getEdges();
var refreshEdge = (0, _graphic.shouldRefreshEdge)(cfg);
if (refreshEdge) (0, _util.each)(edges, function (edge) {
if (refreshEdge && type === NODE) (0, _util.each)(edges_1, function (edge) {
edge.refresh();
});
});else if (refreshEdge && type === COMBO) {
var shapeFactory = item.get('shapeFactory');
var shapeType = model.type || 'circle';
var comboAnimate = model.animate === undefined || cfg.animate === undefined ? (_b = (_a = shapeFactory[shapeType]) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.animate : model.animate || cfg.animate;
if (comboAnimate) {
setTimeout(function () {
if (!item || item.destroyed) return;
var keyShape = item.getKeyShape();
if (!keyShape || keyShape.destroyed) return;
(0, _util.each)(edges_1, function (edge) {
if (edge && !edge.destroyed) edge.refresh();
});
}, 201);
} else {
(0, _util.each)(edges_1, function (edge) {
edge.refresh();
});
}
}
}

@@ -299,2 +318,4 @@

ItemController.prototype.updateCombo = function (combo, children) {
var _a, _b;
var graph = this.graph;

@@ -318,6 +339,23 @@

var length = combEdges.length;
var model = combo.getModel();
var shapeFactory = combo.get('shapeFactory');
var shapeType = model.type || 'circle';
var comboAnimate = model.animate === undefined ? (_b = (_a = shapeFactory[shapeType]) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.animate : model.animate;
for (var i = 0; i < length; i++) {
var edge = combEdges[i];
edge.refresh();
if (comboAnimate) {
setTimeout(function () {
if (!combo || combo.destroyed) return;
var keyShape = combo.getKeyShape();
if (!keyShape || keyShape.destroyed) return;
for (var i = 0; i < length; i++) {
var edge = combEdges[i];
if (edge && !edge.destroyed) edge.refresh();
}
}, 201);
} else {
for (var i = 0; i < length; i++) {
var edge = combEdges[i];
if (edge && !edge.destroyed) edge.refresh();
}
}

@@ -689,7 +727,11 @@ };

});
children_1.forEach(function (child) {
var childItem = graph.findById(child.id);
_this.changeItemVisibility(childItem, visible);
});
if (children_1) {
children_1.forEach(function (child) {
var childItem = graph.findById(child.id);
_this.changeItemVisibility(childItem, visible);
});
}
var edges = item.getEdges();

@@ -696,0 +738,0 @@ (0, _util.each)(edges, function (edge) {

@@ -547,3 +547,3 @@ import EventEmitter from '@antv/event-emitter';

*/
on(eventName: string, callback: (e: IG6GraphEvent) => void, once?: boolean): this;
on<T = IG6GraphEvent>(eventName: string, callback: (e: T) => void, once?: boolean): this;
/**

@@ -550,0 +550,0 @@ * 销毁画布

@@ -1,3 +0,2 @@

/// <reference types="gl-matrix" />
import Behavior from './behavior';
/// <reference types="_gl-matrix@3.3.0@gl-matrix" />
import AbstractGraph from './graph/graph';

@@ -15,3 +14,3 @@ import Shape, { Arrow, Marker } from './element';

declare const registerCombo: typeof Shape.registerCombo;
declare const registerBehavior: typeof Behavior.registerBehavior;
declare const registerBehavior: (type: string, behavior: import("./types").BehaviorOption) => void;
declare const BaseGlobal: {

@@ -200,4 +199,4 @@ version: string;

};
export * from './types';
export { Arrow, Shape, Node, Edge, Combo, Hull, Marker, registerNode, registerCombo, AbstractGraph, Util, registerEdge, registerBehavior, AbstractLayout, AbstractEvent, BaseGlobal, };
export * from './types';
declare const _default: {

@@ -503,3 +502,3 @@ version: string;

registerCombo: typeof Shape.registerCombo;
registerBehavior: typeof Behavior.registerBehavior;
registerBehavior: (type: string, behavior: import("./types").BehaviorOption) => void;
Arrow: {

@@ -506,0 +505,0 @@ triangle: (width?: number, length?: number, d?: number) => string;

import { Event as GraphEvent, ICanvas } from '@antv/g-base';
import { G6Event, IG6GraphEvent, IShapeBase, Item } from '../types';
import { G6Event, IG6GraphEvent, IShapeBase, Item, BehaviorOption } from '../types';
import { IAbstractGraph } from './graph';
export interface IBehavior {
registerBehavior: (type: string, behavior: BehaviorOption) => void;
hasBehavior: (type: string) => boolean;
getBehavior: (type: string) => any;
}
export interface IBehaviorOption {
type: string;

@@ -6,0 +11,0 @@ getEvents: () => {

@@ -485,3 +485,3 @@ import EventEmitter from '@antv/event-emitter';

*/
on: (eventName: string, callback: (e: IG6GraphEvent) => void, once?: boolean) => this;
on: <T = IG6GraphEvent>(eventName: string, callback: (e: T) => void, once?: boolean) => this;
/**

@@ -488,0 +488,0 @@ * 销毁画布

@@ -80,2 +80,3 @@ "use strict";

Combo.prototype.calculateCanvasBBox = function () {
if (this.destroyed) return;
var keyShape = this.get('keyShape');

@@ -85,7 +86,8 @@ var group = this.get('group'); // 因为 group 可能会移动,所以必须通过父元素计算才能计算出正确的包围盒

var bbox = (0, _graphic.getBBox)(keyShape, group);
bbox.x = bbox.minX;
bbox.y = bbox.minY;
bbox.centerX = (bbox.minX + bbox.maxX) / 2;
bbox.centerY = (bbox.minY + bbox.maxY) / 2;
var cacheSize = this.get(CACHE_SIZE);
var cacheBBox = this.get(CACHE_BBOX) || {};
var oriX = cacheBBox.x;
var oriY = cacheBBox.x;

@@ -114,2 +116,5 @@ if (cacheSize) {

bbox.x = bbox.minX;
bbox.y = bbox.minY;
if (bbox.x !== oriX || bbox.y !== oriY) this.set(CACHE_ANCHOR_POINTS, null);
return bbox;

@@ -116,0 +121,0 @@ };

@@ -153,4 +153,4 @@ "use strict";

if (itemType === 'combo') {
centerX = (bbox.maxX + bbox.minX) / 2;
centerY = (bbox.maxY + bbox.minY) / 2;
centerX = bbox.centerX || (bbox.maxX + bbox.minX) / 2;
centerY = bbox.centerY || (bbox.maxY + bbox.minY) / 2;
} else {

@@ -225,8 +225,7 @@ centerX = bbox.centerX;

(0, _util.each)(points, function (pointArr, index) {
var point = (0, _util.mix)({
var point = {
x: bbox_1.minX + pointArr[0] * bbox_1.width,
y: bbox_1.minY + pointArr[1] * bbox_1.height
}, pointArr[2], {
index: index
});
y: bbox_1.minY + pointArr[1] * bbox_1.height,
anchorIndex: index
};
anchorPoints.push(point);

@@ -233,0 +232,0 @@ });

@@ -129,2 +129,3 @@ import { IGroup, Event as GraphEvent, BBox, AnimateCfg, ICanvas, IShape } from '@antv/g-base';

functionParams?: any[];
relayout?: boolean;
shouldUpdate?: (e: IG6GraphEvent) => boolean;

@@ -131,0 +132,0 @@ shouldBegin?: (e: IG6GraphEvent) => boolean;

@@ -1,2 +0,2 @@

/// <reference types="gl-matrix" />
/// <reference types="_gl-matrix@3.3.0@gl-matrix" />
import * as MathUtil from './math';

@@ -3,0 +3,0 @@ import { ext, mat3 } from '@antv/matrix-util';

{
"name": "@antv/g6-core",
"version": "0.0.6",
"version": "0.0.7",
"description": "A Graph Visualization Framework in JavaScript",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc