@antv/g6-core
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -7,2 +7,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); } | ||
import { deepMix, each, mix, isBoolean, isPlainObject, clone } from '@antv/util'; | ||
import { cloneBesidesImg } from '../util/graphic'; | ||
var transform = ext.transform; | ||
@@ -399,6 +400,6 @@ var CLS_SHAPE_SUFFIX = '-shape'; | ||
// 所有生效的 state 的样式 | ||
var enableStatesStyle = clone(item.getCurrentStatesStyle()); | ||
var enableStatesStyle = cloneBesidesImg(item.getCurrentStatesStyle()); | ||
var model = item.getModel(); // 原始样式 | ||
var originStyle_1 = mix({}, model.style, clone(item.getOriginStyle())); | ||
var originStyle_1 = mix({}, model.style, cloneBesidesImg(item.getOriginStyle())); | ||
var keyShapeName_1 = shape.get('name'); // cloning shape.attr(), keys.forEach to avoid cloning the img attr, which leads to maximum clone heap #2383 | ||
@@ -413,3 +414,3 @@ // const keyShapeStyles = clone(shape.attr()) | ||
if (_typeof(attr) === 'object') { | ||
if (attr && _typeof(attr) === 'object') { | ||
keyShapeStyles_1[key] = clone(attr); | ||
@@ -416,0 +417,0 @@ } else { |
@@ -50,3 +50,3 @@ var subjectColor = 'rgb(95, 149, 255)'; | ||
export default { | ||
version: '0.0.7', | ||
version: '0.0.8', | ||
rootContainerClassName: 'root-container', | ||
@@ -53,0 +53,0 @@ nodeContainerClassName: 'node-container', |
@@ -104,2 +104,3 @@ import { each, isArray, isString } from '@antv/util'; | ||
each(this.currentBehaves, function (behave) { | ||
if (behave.delegate) behave.delegate.remove(); | ||
behave.unbind(graph); | ||
@@ -106,0 +107,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
/// <reference types="_gl-matrix@3.3.0@gl-matrix" /> | ||
/// <reference types="gl-matrix" /> | ||
import AbstractGraph from './graph/graph'; | ||
@@ -475,2 +475,3 @@ import Shape, { Arrow, Marker } from './element'; | ||
shouldRefreshEdge: (cfg: any) => any; | ||
cloneBesidesImg: (obj: any) => {}; | ||
uniqueId: (type: string) => string; | ||
@@ -477,0 +478,0 @@ formatPadding: (padding: import("./types").Padding) => number[]; |
@@ -206,2 +206,3 @@ import { __assign } from "tslib"; | ||
} else { | ||
// !name || name === keyShape | ||
var keyShapeStyle = self.getShapeStyleByName(); // 可优化,需要去除 child.attr 中其他 shape 名的对象 | ||
@@ -215,3 +216,8 @@ | ||
} else { | ||
originStyles_1[keyShapeName] = keyShapeStyle; | ||
// 若 keyShape 有 name 且 !name,这个图形不是 keyShape,给这个图形一个 name | ||
if (!name) { | ||
var shapeName = uniqueId('shape'); | ||
child.set('name', shapeName); | ||
originStyles_1[shapeName] = shapeType !== 'image' ? clone(child.attr()) : self.getShapeStyleByName(name); | ||
} else originStyles_1[keyShapeName] = keyShapeStyle; | ||
} | ||
@@ -218,0 +224,0 @@ } |
@@ -58,1 +58,2 @@ import { IGroup, BBox } from '@antv/g-base'; | ||
export declare const shouldRefreshEdge: (cfg: any) => any; | ||
export declare const cloneBesidesImg: (obj: any) => {}; |
@@ -6,3 +6,3 @@ import { __assign } from "tslib"; | ||
import letterAspectRatio from './letterAspectRatio'; | ||
import { isString, clone, isNumber } from '@antv/util'; | ||
import { isString, clone, isNumber, isObject } from '@antv/util'; | ||
var PI = Math.PI, | ||
@@ -652,2 +652,21 @@ sin = Math.sin, | ||
return refreshEdge; | ||
}; | ||
export var cloneBesidesImg = function cloneBesidesImg(obj) { | ||
var clonedObj = {}; | ||
Object.keys(obj).forEach(function (key1) { | ||
var obj2 = obj[key1]; | ||
if (isObject(obj2)) { | ||
var clonedObj2_1 = {}; | ||
Object.keys(obj2).forEach(function (key2) { | ||
var v = obj2[key2]; | ||
if (key2 === 'img' && !isString(v)) return; | ||
clonedObj2_1[key2] = clone(v); | ||
}); | ||
clonedObj[key1] = clonedObj2_1; | ||
} else { | ||
clonedObj[key1] = clone(obj2); | ||
} | ||
}); | ||
return clonedObj; | ||
}; |
@@ -1,2 +0,2 @@ | ||
/// <reference types="_gl-matrix@3.3.0@gl-matrix" /> | ||
/// <reference types="gl-matrix" /> | ||
import * as MathUtil from './math'; | ||
@@ -93,2 +93,3 @@ import { ext, mat3 } from '@antv/matrix-util'; | ||
shouldRefreshEdge: (cfg: any) => any; | ||
cloneBesidesImg: (obj: any) => {}; | ||
uniqueId: (type: string) => string; | ||
@@ -95,0 +96,0 @@ formatPadding: (padding: import("..").Padding) => number[]; |
@@ -16,2 +16,4 @@ "use strict"; | ||
var _graphic = require("../util/graphic"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -408,6 +410,6 @@ | ||
// 所有生效的 state 的样式 | ||
var enableStatesStyle = (0, _util.clone)(item.getCurrentStatesStyle()); | ||
var enableStatesStyle = (0, _graphic.cloneBesidesImg)(item.getCurrentStatesStyle()); | ||
var model = item.getModel(); // 原始样式 | ||
var originStyle_1 = (0, _util.mix)({}, model.style, (0, _util.clone)(item.getOriginStyle())); | ||
var originStyle_1 = (0, _util.mix)({}, model.style, (0, _graphic.cloneBesidesImg)(item.getOriginStyle())); | ||
var keyShapeName_1 = shape.get('name'); // cloning shape.attr(), keys.forEach to avoid cloning the img attr, which leads to maximum clone heap #2383 | ||
@@ -422,3 +424,3 @@ // const keyShapeStyles = clone(shape.attr()) | ||
if (_typeof(attr) === 'object') { | ||
if (attr && _typeof(attr) === 'object') { | ||
keyShapeStyles_1[key] = (0, _util.clone)(attr); | ||
@@ -425,0 +427,0 @@ } else { |
@@ -56,3 +56,3 @@ "use strict"; | ||
var _default = { | ||
version: '0.0.7', | ||
version: '0.0.8', | ||
rootContainerClassName: 'root-container', | ||
@@ -59,0 +59,0 @@ nodeContainerClassName: 'node-container', |
@@ -114,2 +114,3 @@ "use strict"; | ||
(0, _util.each)(this.currentBehaves, function (behave) { | ||
if (behave.delegate) behave.delegate.remove(); | ||
behave.unbind(graph); | ||
@@ -116,0 +117,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
/// <reference types="_gl-matrix@3.3.0@gl-matrix" /> | ||
/// <reference types="gl-matrix" /> | ||
import AbstractGraph from './graph/graph'; | ||
@@ -475,2 +475,3 @@ import Shape, { Arrow, Marker } from './element'; | ||
shouldRefreshEdge: (cfg: any) => any; | ||
cloneBesidesImg: (obj: any) => {}; | ||
uniqueId: (type: string) => string; | ||
@@ -477,0 +478,0 @@ formatPadding: (padding: import("./types").Padding) => number[]; |
@@ -221,2 +221,3 @@ "use strict"; | ||
} else { | ||
// !name || name === keyShape | ||
var keyShapeStyle = self.getShapeStyleByName(); // 可优化,需要去除 child.attr 中其他 shape 名的对象 | ||
@@ -230,3 +231,8 @@ | ||
} else { | ||
originStyles_1[keyShapeName] = keyShapeStyle; | ||
// 若 keyShape 有 name 且 !name,这个图形不是 keyShape,给这个图形一个 name | ||
if (!name) { | ||
var shapeName = (0, _base.uniqueId)('shape'); | ||
child.set('name', shapeName); | ||
originStyles_1[shapeName] = shapeType !== 'image' ? (0, _util.clone)(child.attr()) : self.getShapeStyleByName(name); | ||
} else originStyles_1[keyShapeName] = keyShapeStyle; | ||
} | ||
@@ -233,0 +239,0 @@ } |
@@ -58,1 +58,2 @@ import { IGroup, BBox } from '@antv/g-base'; | ||
export declare const shouldRefreshEdge: (cfg: any) => any; | ||
export declare const cloneBesidesImg: (obj: any) => {}; |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.shouldRefreshEdge = exports.getComboBBox = exports.reconstructTree = exports.plainCombosToTrees = exports.getTextSize = exports.getLetterWidth = exports.traverseTreeUp = exports.traverseTree = exports.getLabelPosition = exports.getLoopCfgs = exports.getBBox = void 0; | ||
exports.cloneBesidesImg = exports.shouldRefreshEdge = exports.getComboBBox = exports.reconstructTree = exports.plainCombosToTrees = exports.getTextSize = exports.getLetterWidth = exports.traverseTreeUp = exports.traverseTree = exports.getLabelPosition = exports.getLoopCfgs = exports.getBBox = void 0; | ||
@@ -703,2 +703,24 @@ var _tslib = require("tslib"); | ||
exports.shouldRefreshEdge = shouldRefreshEdge; | ||
exports.shouldRefreshEdge = shouldRefreshEdge; | ||
var cloneBesidesImg = function cloneBesidesImg(obj) { | ||
var clonedObj = {}; | ||
Object.keys(obj).forEach(function (key1) { | ||
var obj2 = obj[key1]; | ||
if ((0, _util.isObject)(obj2)) { | ||
var clonedObj2_1 = {}; | ||
Object.keys(obj2).forEach(function (key2) { | ||
var v = obj2[key2]; | ||
if (key2 === 'img' && !(0, _util.isString)(v)) return; | ||
clonedObj2_1[key2] = (0, _util.clone)(v); | ||
}); | ||
clonedObj[key1] = clonedObj2_1; | ||
} else { | ||
clonedObj[key1] = (0, _util.clone)(obj2); | ||
} | ||
}); | ||
return clonedObj; | ||
}; | ||
exports.cloneBesidesImg = cloneBesidesImg; |
@@ -1,2 +0,2 @@ | ||
/// <reference types="_gl-matrix@3.3.0@gl-matrix" /> | ||
/// <reference types="gl-matrix" /> | ||
import * as MathUtil from './math'; | ||
@@ -93,2 +93,3 @@ import { ext, mat3 } from '@antv/matrix-util'; | ||
shouldRefreshEdge: (cfg: any) => any; | ||
cloneBesidesImg: (obj: any) => {}; | ||
uniqueId: (type: string) => string; | ||
@@ -95,0 +96,0 @@ formatPadding: (padding: import("..").Padding) => number[]; |
{ | ||
"name": "@antv/g6-core", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "A Graph Visualization Framework in JavaScript", | ||
@@ -62,3 +62,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@antv/algorithm": "^0.0.6", | ||
"@antv/algorithm": "^0.0.7", | ||
"@antv/dom-util": "^2.0.1", | ||
@@ -65,0 +65,0 @@ "@antv/event-emitter": "~0.1.0", |
@@ -118,5 +118,14 @@ # G6: A Graph Visualization Framework in TypeScript. | ||
# run bootstrap to link the packages | ||
$ npm run bootstrap | ||
# build all the packages | ||
$ npm run build:all | ||
# run test case | ||
$ npm test | ||
$ npm run test | ||
# run lint | ||
$ npm run lint | ||
# run test case in watch mode | ||
@@ -149,3 +158,3 @@ npm test -- --watch ./tests/unit/algorithm/find-path-spec | ||
To become a contributor, please follow our [contributing guide](https://github.com/antvis/g6/blob/master/CONTRIBUTING.md). | ||
To become a contributor, please follow our [contributing guide](https://github.com/antvis/G6/blob/master/packages/g6/CONTRIBUTING.md). | ||
@@ -152,0 +161,0 @@ ## License |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1086561
32043
162
+ Added@antv/algorithm@0.0.7(transitive)
- Removed@antv/algorithm@0.0.6(transitive)
Updated@antv/algorithm@^0.0.7