victory-core 15.1.0 → 15.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/victory-core.js +2396 -2132
- package/dist/victory-core.min.js +8 -8
- package/lib/victory-label/victory-label.js +21 -17
- package/lib/victory-legend/victory-legend.js +100 -55
- package/lib/victory-primitives/area.js +18 -11
- package/lib/victory-primitives/bar.js +17 -6
- package/lib/victory-primitives/candle.js +7 -4
- package/lib/victory-primitives/clip-path.js +12 -7
- package/lib/victory-primitives/curve.js +14 -8
- package/lib/victory-primitives/error-bar.js +6 -3
- package/lib/victory-primitives/flyout.js +26 -7
- package/lib/victory-primitives/line.js +13 -10
- package/lib/victory-primitives/point.js +17 -7
- package/lib/victory-primitives/slice.js +14 -7
- package/lib/victory-primitives/voronoi.js +20 -11
- package/lib/victory-util/collection.js +4 -0
- package/lib/victory-util/data.js +9 -8
- package/package.json +6 -4
- package/src/victory-label/victory-label.js +17 -13
- package/src/victory-legend/victory-legend.js +109 -64
- package/src/victory-primitives/area.js +9 -2
- package/src/victory-primitives/bar.js +13 -2
- package/src/victory-primitives/candle.js +5 -2
- package/src/victory-primitives/clip-path.js +6 -1
- package/src/victory-primitives/curve.js +8 -2
- package/src/victory-primitives/error-bar.js +5 -2
- package/src/victory-primitives/flyout.js +21 -2
- package/src/victory-primitives/line.js +12 -9
- package/src/victory-primitives/point.js +12 -2
- package/src/victory-primitives/slice.js +9 -2
- package/src/victory-primitives/voronoi.js +11 -2
- package/src/victory-util/collection.js +4 -0
- package/src/victory-util/data.js +9 -8
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});var
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _jsxFileName="src/victory-primitives/flyout.js";var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();
|
|
2
2
|
var _react=require("react");var _react2=_interopRequireDefault(_react);
|
|
3
3
|
var _propTypes=require("prop-types");var _propTypes2=_interopRequireDefault(_propTypes);
|
|
4
|
-
|
|
5
4
|
var _helpers=require("../victory-util/helpers");var _helpers2=_interopRequireDefault(_helpers);
|
|
5
|
+
var _collection=require("../victory-util/collection");var _collection2=_interopRequireDefault(_collection);
|
|
6
6
|
var _commonProps=require("./common-props");var _commonProps2=_interopRequireDefault(_commonProps);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var
|
|
7
7
|
|
|
8
8
|
Flyout=function(_React$Component){_inherits(Flyout,_React$Component);function Flyout(){_classCallCheck(this,Flyout);return _possibleConstructorReturn(this,(Flyout.__proto__||Object.getPrototypeOf(Flyout)).apply(this,arguments));}_createClass(Flyout,[{key:"componentWillMount",value:function componentWillMount()
|
|
@@ -29,8 +29,27 @@ this.path=path;
|
|
|
29
29
|
}},{key:"shouldComponentUpdate",value:function shouldComponentUpdate(
|
|
30
30
|
|
|
31
31
|
nextProps){var _calculateAttributes2=
|
|
32
|
-
this.calculateAttributes(nextProps),style=_calculateAttributes2.style,path=_calculateAttributes2.path;
|
|
33
|
-
|
|
32
|
+
this.calculateAttributes(nextProps),style=_calculateAttributes2.style,path=_calculateAttributes2.path;var _props=
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
this.props,className=_props.className,cornerRadius=_props.cornerRadius,datum=_props.datum,dx=_props.dx,dy=_props.dy,height=_props.height,width=_props.width,orientation=_props.orientation,pointerLength=_props.pointerLength,pointerWidth=_props.pointerWidth,x=_props.x,y=_props.y;
|
|
37
|
+
if(!_collection2.default.allSetsEqual([
|
|
38
|
+
[className,nextProps.className],
|
|
39
|
+
[cornerRadius,nextProps.cornerRadius],
|
|
40
|
+
[dx,nextProps.dx],
|
|
41
|
+
[dy,nextProps.dy],
|
|
42
|
+
[x,nextProps.x],
|
|
43
|
+
[y,nextProps.y],
|
|
44
|
+
[height,nextProps.height],
|
|
45
|
+
[width,nextProps.width],
|
|
46
|
+
[orientation,nextProps.orientation],
|
|
47
|
+
[pointerLength,nextProps.pointerLength],
|
|
48
|
+
[pointerWidth,nextProps.pointerWidth],
|
|
49
|
+
[path,this.path],
|
|
50
|
+
[style,this.style],
|
|
51
|
+
[datum,nextProps.datum]]))
|
|
52
|
+
{
|
|
34
53
|
this.style=style;
|
|
35
54
|
this.path=path;
|
|
36
55
|
return true;
|
|
@@ -104,8 +123,8 @@ this.getHorizontalPath(props):this.getVerticalPath(props);
|
|
|
104
123
|
}},{key:"renderFlyout",value:function renderFlyout(
|
|
105
124
|
|
|
106
125
|
|
|
107
|
-
path,style,events){var
|
|
108
|
-
this.props,role=
|
|
126
|
+
path,style,events){var _props2=
|
|
127
|
+
this.props,role=_props2.role,shapeRendering=_props2.shapeRendering,className=_props2.className;
|
|
109
128
|
return(
|
|
110
129
|
_react2.default.createElement("path",_extends({
|
|
111
130
|
className:className,
|
|
@@ -113,7 +132,7 @@ d:path,
|
|
|
113
132
|
style:style,
|
|
114
133
|
shapeRendering:shapeRendering||"auto",
|
|
115
134
|
role:role||"presentation"},
|
|
116
|
-
events,{__source:{fileName:_jsxFileName,lineNumber:
|
|
135
|
+
events,{__source:{fileName:_jsxFileName,lineNumber:129}})));
|
|
117
136
|
|
|
118
137
|
|
|
119
138
|
}},{key:"render",value:function render()
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});var
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});var _assign2=require("lodash/assign");var _assign3=_interopRequireDefault(_assign2);var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _jsxFileName="src/victory-primitives/line.js";var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _react=require("react");var _react2=_interopRequireDefault(_react);
|
|
2
2
|
var _propTypes=require("prop-types");var _propTypes2=_interopRequireDefault(_propTypes);
|
|
3
3
|
var _helpers=require("../victory-util/helpers");var _helpers2=_interopRequireDefault(_helpers);
|
|
4
|
+
var _collection=require("../victory-util/collection");var _collection2=_interopRequireDefault(_collection);
|
|
4
5
|
|
|
5
6
|
var _commonProps=require("./common-props");var _commonProps2=_interopRequireDefault(_commonProps);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var
|
|
6
7
|
|
|
@@ -19,18 +20,20 @@ this.style=this.getStyle(this.props);
|
|
|
19
20
|
}},{key:"shouldComponentUpdate",value:function shouldComponentUpdate(
|
|
20
21
|
|
|
21
22
|
nextProps){var _props=
|
|
22
|
-
this.props,x1=_props.x1,x2=_props.x2,y1=_props.y1,y2=_props.y2;
|
|
23
|
+
this.props,className=_props.className,datum=_props.datum,x1=_props.x1,x2=_props.x2,y1=_props.y1,y2=_props.y2;
|
|
23
24
|
var style=this.getStyle(nextProps);
|
|
24
|
-
if(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
if(!_collection2.default.allSetsEqual([
|
|
26
|
+
[className,nextProps.className],
|
|
27
|
+
[x1,nextProps.x1],
|
|
28
|
+
[x2,nextProps.x2],
|
|
29
|
+
[y1,nextProps.y1],
|
|
30
|
+
[y2,nextProps.y2],
|
|
31
|
+
[style,this.style],
|
|
32
|
+
[datum,nextProps.datum]]))
|
|
33
|
+
{
|
|
30
34
|
this.style=style;
|
|
31
35
|
return true;
|
|
32
36
|
}
|
|
33
|
-
|
|
34
37
|
return false;
|
|
35
38
|
}},{key:"getStyle",value:function getStyle(
|
|
36
39
|
|
|
@@ -50,7 +53,7 @@ style:style,
|
|
|
50
53
|
role:role||"presentation",
|
|
51
54
|
shapeRendering:shapeRendering||"auto",
|
|
52
55
|
vectorEffect:"non-scaling-stroke"},
|
|
53
|
-
events,{__source:{fileName:_jsxFileName,lineNumber:
|
|
56
|
+
events,{__source:{fileName:_jsxFileName,lineNumber:49}})));
|
|
54
57
|
|
|
55
58
|
|
|
56
59
|
}},{key:"render",value:function render()
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});var
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _jsxFileName="src/victory-primitives/point.js";var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _react=require("react");var _react2=_interopRequireDefault(_react);
|
|
2
2
|
var _propTypes=require("prop-types");var _propTypes2=_interopRequireDefault(_propTypes);
|
|
3
3
|
var _helpers=require("../victory-util/helpers");var _helpers2=_interopRequireDefault(_helpers);
|
|
4
|
+
var _collection=require("../victory-util/collection");var _collection2=_interopRequireDefault(_collection);
|
|
4
5
|
var _pathHelpers=require("./path-helpers");var _pathHelpers2=_interopRequireDefault(_pathHelpers);
|
|
5
|
-
|
|
6
6
|
var _commonProps=require("./common-props");var _commonProps2=_interopRequireDefault(_commonProps);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var
|
|
7
7
|
|
|
8
8
|
Point=function(_React$Component){_inherits(Point,_React$Component);function Point(){_classCallCheck(this,Point);return _possibleConstructorReturn(this,(Point.__proto__||Object.getPrototypeOf(Point)).apply(this,arguments));}_createClass(Point,[{key:"componentWillMount",value:function componentWillMount()
|
|
@@ -30,8 +30,18 @@ this.path=path;
|
|
|
30
30
|
}},{key:"shouldComponentUpdate",value:function shouldComponentUpdate(
|
|
31
31
|
|
|
32
32
|
nextProps){var _calculateAttributes2=
|
|
33
|
-
this.calculateAttributes(nextProps),style=_calculateAttributes2.style,path=_calculateAttributes2.path;
|
|
34
|
-
|
|
33
|
+
this.calculateAttributes(nextProps),style=_calculateAttributes2.style,path=_calculateAttributes2.path;var _props=
|
|
34
|
+
this.props,className=_props.className,datum=_props.datum,x=_props.x,y=_props.y,size=_props.size,symbol=_props.symbol;
|
|
35
|
+
if(!_collection2.default.allSetsEqual([
|
|
36
|
+
[className,nextProps.className],
|
|
37
|
+
[x,nextProps.x],
|
|
38
|
+
[y,nextProps.y],
|
|
39
|
+
[size,nextProps.size],
|
|
40
|
+
[symbol,nextProps.symbol],
|
|
41
|
+
[path,this.path],
|
|
42
|
+
[style,this.style],
|
|
43
|
+
[datum,nextProps.datum]]))
|
|
44
|
+
{
|
|
35
45
|
this.style=style;
|
|
36
46
|
this.path=path;
|
|
37
47
|
return true;
|
|
@@ -64,8 +74,8 @@ return pathFunctions[symbol].call(null,x,y,size);
|
|
|
64
74
|
}},{key:"renderPoint",value:function renderPoint(
|
|
65
75
|
|
|
66
76
|
|
|
67
|
-
path,style,events){var
|
|
68
|
-
this.props,role=
|
|
77
|
+
path,style,events){var _props2=
|
|
78
|
+
this.props,role=_props2.role,shapeRendering=_props2.shapeRendering,className=_props2.className;
|
|
69
79
|
return(
|
|
70
80
|
_react2.default.createElement("path",_extends({},
|
|
71
81
|
events,{
|
|
@@ -73,7 +83,7 @@ d:path,
|
|
|
73
83
|
className:className,
|
|
74
84
|
role:role||"presentation",
|
|
75
85
|
shapeRendering:shapeRendering||"auto",
|
|
76
|
-
style:style,__source:{fileName:_jsxFileName,lineNumber:
|
|
86
|
+
style:style,__source:{fileName:_jsxFileName,lineNumber:80}})));
|
|
77
87
|
|
|
78
88
|
|
|
79
89
|
}},{key:"render",value:function render()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});var
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _jsxFileName="src/victory-primitives/slice.js";var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _react=require("react");var _react2=_interopRequireDefault(_react);
|
|
2
2
|
var _propTypes=require("prop-types");var _propTypes2=_interopRequireDefault(_propTypes);
|
|
3
3
|
var _helpers=require("../victory-util/helpers");var _helpers2=_interopRequireDefault(_helpers);
|
|
4
|
-
|
|
4
|
+
var _collection=require("../victory-util/collection");var _collection2=_interopRequireDefault(_collection);
|
|
5
5
|
var _commonProps=require("./common-props");var _commonProps2=_interopRequireDefault(_commonProps);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var
|
|
6
6
|
|
|
7
7
|
Slice=function(_React$Component){_inherits(Slice,_React$Component);function Slice(){_classCallCheck(this,Slice);return _possibleConstructorReturn(this,(Slice.__proto__||Object.getPrototypeOf(Slice)).apply(this,arguments));}_createClass(Slice,[{key:"componentWillMount",value:function componentWillMount()
|
|
@@ -19,8 +19,15 @@ this.path=path;
|
|
|
19
19
|
}},{key:"shouldComponentUpdate",value:function shouldComponentUpdate(
|
|
20
20
|
|
|
21
21
|
nextProps){var _calculateAttributes2=
|
|
22
|
-
this.calculateAttributes(nextProps),style=_calculateAttributes2.style,path=_calculateAttributes2.path;
|
|
23
|
-
|
|
22
|
+
this.calculateAttributes(nextProps),style=_calculateAttributes2.style,path=_calculateAttributes2.path;var _props=
|
|
23
|
+
this.props,className=_props.className,datum=_props.datum,slice=_props.slice;
|
|
24
|
+
if(!_collection2.default.allSetsEqual([
|
|
25
|
+
[className,nextProps.className],
|
|
26
|
+
[path,this.path],
|
|
27
|
+
[style,this.style],
|
|
28
|
+
[datum,nextProps.datum],
|
|
29
|
+
[slice,nextProps.slice]]))
|
|
30
|
+
{
|
|
24
31
|
this.style=style;
|
|
25
32
|
this.path=path;
|
|
26
33
|
return true;
|
|
@@ -37,8 +44,8 @@ path:pathFunction(slice)};
|
|
|
37
44
|
}},{key:"renderSlice",value:function renderSlice(
|
|
38
45
|
|
|
39
46
|
|
|
40
|
-
path,style,events){var
|
|
41
|
-
this.props,role=
|
|
47
|
+
path,style,events){var _props2=
|
|
48
|
+
this.props,role=_props2.role,shapeRendering=_props2.shapeRendering,className=_props2.className;
|
|
42
49
|
return(
|
|
43
50
|
_react2.default.createElement("path",_extends({
|
|
44
51
|
d:path,
|
|
@@ -46,7 +53,7 @@ className:className,
|
|
|
46
53
|
role:role||"presentation",
|
|
47
54
|
style:style,
|
|
48
55
|
shapeRendering:shapeRendering||"auto"},
|
|
49
|
-
events,{__source:{fileName:_jsxFileName,lineNumber:
|
|
56
|
+
events,{__source:{fileName:_jsxFileName,lineNumber:50}})));
|
|
50
57
|
|
|
51
58
|
|
|
52
59
|
}},{key:"render",value:function render()
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});var
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _jsxFileName="src/victory-primitives/voronoi.js";var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();
|
|
2
2
|
var _react=require("react");var _react2=_interopRequireDefault(_react);
|
|
3
3
|
var _propTypes=require("prop-types");var _propTypes2=_interopRequireDefault(_propTypes);
|
|
4
4
|
var _helpers=require("../victory-util/helpers");var _helpers2=_interopRequireDefault(_helpers);
|
|
5
|
-
|
|
5
|
+
var _collection=require("../victory-util/collection");var _collection2=_interopRequireDefault(_collection);
|
|
6
6
|
var _commonProps=require("./common-props");var _commonProps2=_interopRequireDefault(_commonProps);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var
|
|
7
7
|
|
|
8
8
|
Voronoi=function(_React$Component){_inherits(Voronoi,_React$Component);function Voronoi(){_classCallCheck(this,Voronoi);return _possibleConstructorReturn(this,(Voronoi.__proto__||Object.getPrototypeOf(Voronoi)).apply(this,arguments));}_createClass(Voronoi,[{key:"componentWillMount",value:function componentWillMount()
|
|
@@ -23,8 +23,17 @@ this.voronoi=voronoi;
|
|
|
23
23
|
}},{key:"shouldComponentUpdate",value:function shouldComponentUpdate(
|
|
24
24
|
|
|
25
25
|
nextProps){var _calculateAttributes2=
|
|
26
|
-
this.calculateAttributes(nextProps),style=_calculateAttributes2.style,circle=_calculateAttributes2.circle,voronoi=_calculateAttributes2.voronoi;
|
|
27
|
-
|
|
26
|
+
this.calculateAttributes(nextProps),style=_calculateAttributes2.style,circle=_calculateAttributes2.circle,voronoi=_calculateAttributes2.voronoi;var _props=
|
|
27
|
+
this.props,className=_props.className,x=_props.x,y=_props.y,datum=_props.datum;
|
|
28
|
+
if(!_collection2.default.allSetsEqual([
|
|
29
|
+
[className,nextProps.className],
|
|
30
|
+
[x,nextProps.x],
|
|
31
|
+
[y,nextProps.y],
|
|
32
|
+
[circle,this.circle],
|
|
33
|
+
[voronoi,this.voronoi],
|
|
34
|
+
[style,this.style],
|
|
35
|
+
[datum,nextProps.datum]]))
|
|
36
|
+
{
|
|
28
37
|
this.style=style;
|
|
29
38
|
this.circle=circle;
|
|
30
39
|
this.voronoi=voronoi;
|
|
@@ -62,8 +71,8 @@ size+", "+size+" 0 1,0 "+-size*2+",0";
|
|
|
62
71
|
|
|
63
72
|
paths,style,events){
|
|
64
73
|
var clipId=paths.circle&&"clipPath-"+Math.random();
|
|
65
|
-
var clipPath=paths.circle?"url(#"+clipId+")":undefined;var
|
|
66
|
-
this.props,role=
|
|
74
|
+
var clipPath=paths.circle?"url(#"+clipId+")":undefined;var _props2=
|
|
75
|
+
this.props,role=_props2.role,shapeRendering=_props2.shapeRendering,className=_props2.className;
|
|
67
76
|
var voronoiPath=
|
|
68
77
|
_react2.default.createElement("path",_extends({
|
|
69
78
|
d:paths.circle||paths.voronoi,
|
|
@@ -72,15 +81,15 @@ clipPath:clipPath,
|
|
|
72
81
|
style:style,
|
|
73
82
|
role:role||"presentation",
|
|
74
83
|
shapeRendering:shapeRendering||"auto"},
|
|
75
|
-
events,{__source:{fileName:_jsxFileName,lineNumber:
|
|
84
|
+
events,{__source:{fileName:_jsxFileName,lineNumber:77}}));
|
|
76
85
|
|
|
77
86
|
|
|
78
87
|
return paths.circle?
|
|
79
88
|
|
|
80
|
-
_react2.default.createElement("g",{__source:{fileName:_jsxFileName,lineNumber:
|
|
81
|
-
_react2.default.createElement("defs",{__source:{fileName:_jsxFileName,lineNumber:
|
|
82
|
-
_react2.default.createElement("clipPath",{id:clipId,__source:{fileName:_jsxFileName,lineNumber:
|
|
83
|
-
_react2.default.createElement("path",{d:paths.voronoi,className:className,__source:{fileName:_jsxFileName,lineNumber:
|
|
89
|
+
_react2.default.createElement("g",{__source:{fileName:_jsxFileName,lineNumber:89}},
|
|
90
|
+
_react2.default.createElement("defs",{__source:{fileName:_jsxFileName,lineNumber:90}},
|
|
91
|
+
_react2.default.createElement("clipPath",{id:clipId,__source:{fileName:_jsxFileName,lineNumber:91}},
|
|
92
|
+
_react2.default.createElement("path",{d:paths.voronoi,className:className,__source:{fileName:_jsxFileName,lineNumber:92}}))),
|
|
84
93
|
|
|
85
94
|
|
|
86
95
|
voronoiPath):
|
|
@@ -13,6 +13,10 @@ containsDates:function containsDates(collection){
|
|
|
13
13
|
return Array.isArray(collection)&&collection.some(function(value){return value instanceof Date;});
|
|
14
14
|
},
|
|
15
15
|
|
|
16
|
+
containsNumbers:function containsNumbers(collection){
|
|
17
|
+
return Array.isArray(collection)&&collection.some(function(value){return typeof value==="number";});
|
|
18
|
+
},
|
|
19
|
+
|
|
16
20
|
containsOnlyStrings:function containsOnlyStrings(collection){
|
|
17
21
|
return this.isNonEmptyArray(collection)&&
|
|
18
22
|
collection.every(function(value){return typeof value==="string";});
|
package/lib/victory-util/data.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports,"__esModule",{value:true});var _sortBy2=require("lodash/sortBy");var _sortBy3=_interopRequireDefault(_sortBy2);var _property2=require("lodash/property");var _property3=_interopRequireDefault(_property2);var _isFunction2=require("lodash/isFunction");var _isFunction3=_interopRequireDefault(_isFunction2);var _last2=require("lodash/last");var _last3=_interopRequireDefault(_last2);var _range2=require("lodash/range");var _range3=_interopRequireDefault(_range2);var _uniq2=require("lodash/uniq");var _uniq3=_interopRequireDefault(_uniq2);var _assign2=require("lodash/assign");var _assign3=_interopRequireDefault(_assign2);
|
|
2
2
|
var _helpers=require("./helpers");var _helpers2=_interopRequireDefault(_helpers);
|
|
3
3
|
var _collection=require("./collection");var _collection2=_interopRequireDefault(_collection);
|
|
4
|
-
var _log=require("./log");var _log2=_interopRequireDefault(_log);
|
|
5
4
|
var _scale=require("./scale");var _scale2=_interopRequireDefault(_scale);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++){arr2[i]=arr[i];}return arr2;}else{return Array.from(arr);}}exports.default=
|
|
6
5
|
|
|
7
6
|
{
|
|
@@ -14,7 +13,6 @@ getData:function getData(props){
|
|
|
14
13
|
var data=void 0;
|
|
15
14
|
if(props.data){
|
|
16
15
|
if(props.data.length<1){
|
|
17
|
-
_log2.default.warn("This is an empty dataset.");
|
|
18
16
|
return[];
|
|
19
17
|
}else{
|
|
20
18
|
data=this.formatData(props.data,props);
|
|
@@ -74,20 +72,23 @@ y:this.createStringMap(props,"y")};
|
|
|
74
72
|
|
|
75
73
|
var accessor={
|
|
76
74
|
x:_helpers2.default.createAccessor(props.x!==undefined?props.x:"x"),
|
|
77
|
-
y:_helpers2.default.createAccessor(props.y!==undefined?props.y:"y")
|
|
75
|
+
y:_helpers2.default.createAccessor(props.y!==undefined?props.y:"y"),
|
|
76
|
+
y0:_helpers2.default.createAccessor(props.y0!==undefined?props.y0:"y0")};
|
|
78
77
|
|
|
79
78
|
var data=dataset.map(function(datum,index){
|
|
80
79
|
var evaluatedX=datum._x!==undefined?datum._x:accessor.x(datum);
|
|
81
80
|
var evaluatedY=datum._y!==undefined?datum._y:accessor.y(datum);
|
|
81
|
+
var y0=datum._y0!==undefined?datum._y0:accessor.y0(datum);
|
|
82
82
|
var x=evaluatedX!==undefined?evaluatedX:index;
|
|
83
83
|
var y=evaluatedY!==undefined?evaluatedY:datum;
|
|
84
|
+
var originalValues=y0===undefined?{x:x,y:y}:{x:x,y:y,y0:y0};
|
|
85
|
+
var privateValues=y0===undefined?{_x:x,_y:y}:{_x:x,_y:y,_y0:y0};
|
|
84
86
|
return(0,_assign3.default)(
|
|
85
|
-
|
|
86
|
-
datum,
|
|
87
|
-
{_x:x,_y:y},
|
|
87
|
+
originalValues,datum,privateValues,
|
|
88
88
|
|
|
89
89
|
typeof x==="string"?{_x:stringMap.x[x],xName:x}:{},
|
|
90
|
-
typeof y==="string"?{_y:stringMap.y[y],yName:y}:{}
|
|
90
|
+
typeof y==="string"?{_y:stringMap.y[y],yName:y}:{},
|
|
91
|
+
typeof y0==="string"?{_y0:stringMap.y[y0],yName:y0}:{});
|
|
91
92
|
|
|
92
93
|
});
|
|
93
94
|
|
|
@@ -136,7 +137,7 @@ var rules=function rules(datum,axis){
|
|
|
136
137
|
return scaleType[axis]==="log"?datum["_"+axis]!==0:true;
|
|
137
138
|
};
|
|
138
139
|
return dataset.filter(function(datum){
|
|
139
|
-
return rules(datum,"x")&&rules(datum,"y");
|
|
140
|
+
return rules(datum,"x")&&rules(datum,"y")&&rules(datum,"y0");
|
|
140
141
|
});
|
|
141
142
|
},
|
|
142
143
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-core",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.2.0",
|
|
4
4
|
"description": "Victory Core",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"npm": ">=2.0.0"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"postinstall": "cd lib || builder run npm:postinstall",
|
|
21
20
|
"preversion": "builder run npm:preversion",
|
|
22
21
|
"postversion": "builder run npm:postversion",
|
|
23
22
|
"postpublish": "builder run npm:postpublish",
|
|
@@ -34,7 +33,7 @@
|
|
|
34
33
|
"lodash": "^4.17.4"
|
|
35
34
|
},
|
|
36
35
|
"devDependencies": {
|
|
37
|
-
"builder-victory-component-dev": "^4.0.
|
|
36
|
+
"builder-victory-component-dev": "^4.0.2",
|
|
38
37
|
"chai": "^3.5.0",
|
|
39
38
|
"enzyme": "^2.4.1",
|
|
40
39
|
"mocha": "^3.0.2",
|
|
@@ -45,7 +44,7 @@
|
|
|
45
44
|
"sinon": "^1.17.5",
|
|
46
45
|
"sinon-chai": "^2.8.0",
|
|
47
46
|
"builder": "^3.2.1",
|
|
48
|
-
"builder-victory-component": "^4.0.
|
|
47
|
+
"builder-victory-component": "^4.0.2"
|
|
49
48
|
},
|
|
50
49
|
"publishr": {
|
|
51
50
|
"dependencies": [
|
|
@@ -53,6 +52,9 @@
|
|
|
53
52
|
],
|
|
54
53
|
"files": {
|
|
55
54
|
".npmignore": ".npmignore.publishr"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"postinstall": ""
|
|
56
58
|
}
|
|
57
59
|
},
|
|
58
60
|
"_publishr": [
|
|
@@ -3,10 +3,11 @@ import React from "react";
|
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import VictoryPortal from "../victory-portal/victory-portal";
|
|
5
5
|
import CustomPropTypes from "../victory-util/prop-types";
|
|
6
|
+
import Collection from "../victory-util/collection";
|
|
6
7
|
import Helpers from "../victory-util/helpers";
|
|
7
8
|
import Style from "../victory-util/style";
|
|
8
9
|
import Log from "../victory-util/log";
|
|
9
|
-
import { assign, merge
|
|
10
|
+
import { assign, merge } from "lodash";
|
|
10
11
|
|
|
11
12
|
const defaultStyles = {
|
|
12
13
|
fill: "#252525",
|
|
@@ -100,18 +101,21 @@ export default class VictoryLabel extends React.Component {
|
|
|
100
101
|
shouldComponentUpdate(nextProps) {
|
|
101
102
|
const attrs = this.calculateAttributes(nextProps);
|
|
102
103
|
const { style, dx, dy, content, lineHeight, textAnchor, transform } = attrs;
|
|
103
|
-
const { x, y } = this.props;
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
104
|
+
const { angle, className, datum, x, y } = this.props;
|
|
105
|
+
if (!Collection.allSetsEqual([
|
|
106
|
+
[angle, nextProps.angle],
|
|
107
|
+
[className, nextProps.className],
|
|
108
|
+
[x, nextProps.x],
|
|
109
|
+
[y, nextProps.y],
|
|
110
|
+
[dx, this.dx],
|
|
111
|
+
[dy, this.dy],
|
|
112
|
+
[lineHeight, this.lineHeight],
|
|
113
|
+
[textAnchor, this.textAnchor],
|
|
114
|
+
[transform, this.transform],
|
|
115
|
+
[content, this.content],
|
|
116
|
+
[style, this.style],
|
|
117
|
+
[datum, nextProps.datum]
|
|
118
|
+
])) {
|
|
115
119
|
this.cacheAttributes(attrs);
|
|
116
120
|
return true;
|
|
117
121
|
}
|