victory-bar 36.3.2 → 36.4.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/dist/victory-bar.js +16762 -17254
- package/dist/victory-bar.min.js +1 -1
- package/es/bar.js +6 -4
- package/es/path-helper-methods.js +18 -14
- package/es/victory-bar.js +107 -137
- package/lib/bar.js +6 -4
- package/lib/index.js +22 -22
- package/lib/path-helper-methods.js +22 -16
- package/lib/victory-bar.js +106 -137
- package/package.json +4 -4
- package/src/path-helper-methods.js +1 -1
package/es/bar.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _assign from "lodash/assign";
|
|
2
2
|
|
|
3
|
-
function
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
6
|
|
|
5
7
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
8
|
|
|
@@ -56,7 +58,7 @@ var Bar = function (props) {
|
|
|
56
58
|
cornerRadius = _props.cornerRadius;
|
|
57
59
|
var path = polar ? getPolarBarPath(props, cornerRadius) : getBarPath(props, barWidth, cornerRadius);
|
|
58
60
|
var defaultTransform = polar && origin ? "translate(".concat(origin.x, ", ").concat(origin.y, ")") : undefined;
|
|
59
|
-
return React.cloneElement(props.pathComponent, _objectSpread({}, props.events, {
|
|
61
|
+
return /*#__PURE__*/React.cloneElement(props.pathComponent, _objectSpread(_objectSpread({}, props.events), {}, {
|
|
60
62
|
"aria-label": props.ariaLabel,
|
|
61
63
|
style: style,
|
|
62
64
|
d: path,
|
|
@@ -71,7 +73,7 @@ var Bar = function (props) {
|
|
|
71
73
|
}));
|
|
72
74
|
};
|
|
73
75
|
|
|
74
|
-
Bar.propTypes = _objectSpread({}, CommonProps.primitiveProps, {
|
|
76
|
+
Bar.propTypes = _objectSpread(_objectSpread({}, CommonProps.primitiveProps), {}, {
|
|
75
77
|
alignment: PropTypes.oneOf(["start", "middle", "end"]),
|
|
76
78
|
barRatio: PropTypes.number,
|
|
77
79
|
barWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
|
|
@@ -94,7 +96,7 @@ Bar.propTypes = _objectSpread({}, CommonProps.primitiveProps, {
|
|
|
94
96
|
});
|
|
95
97
|
Bar.defaultProps = {
|
|
96
98
|
defaultBarWidth: 8,
|
|
97
|
-
pathComponent: React.createElement(Path, null),
|
|
99
|
+
pathComponent: /*#__PURE__*/React.createElement(Path, null),
|
|
98
100
|
role: "presentation",
|
|
99
101
|
shapeRendering: "auto"
|
|
100
102
|
};
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
function
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
2
4
|
|
|
3
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
6
|
|
|
5
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
7
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
+
|
|
9
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
|
|
11
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
12
|
|
|
7
|
-
function
|
|
13
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
14
|
|
|
9
|
-
function
|
|
15
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
16
|
|
|
11
|
-
function
|
|
17
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
12
18
|
|
|
13
|
-
import * as d3Shape from "d3-shape";
|
|
19
|
+
import * as d3Shape from "victory-vendor/d3-shape";
|
|
14
20
|
import { circle, point } from "./geometry-helper-methods";
|
|
15
21
|
|
|
16
22
|
var getPosition = function (props, width) {
|
|
@@ -62,7 +68,7 @@ var transformAngle = function (angle) {
|
|
|
62
68
|
export var getCustomBarPath = function (props, width) {
|
|
63
69
|
var getPath = props.getPath;
|
|
64
70
|
|
|
65
|
-
var propsWithCalculatedValues = _objectSpread({}, props, getPosition(props, width));
|
|
71
|
+
var propsWithCalculatedValues = _objectSpread(_objectSpread({}, props), getPosition(props, width));
|
|
66
72
|
|
|
67
73
|
return getPath(propsWithCalculatedValues);
|
|
68
74
|
};
|
|
@@ -399,8 +405,8 @@ export var getVerticalPolarBarPath = function (props, cornerRadius) {
|
|
|
399
405
|
leftOffset = isShort(rightMiddle) ? _defaultOffset : leftMiddle - 2;
|
|
400
406
|
}
|
|
401
407
|
|
|
402
|
-
moves = _toConsumableArray(rightMoves.slice(0, rightOffset))
|
|
403
|
-
coords = _toConsumableArray(rightCoords.slice(0, rightOffset))
|
|
408
|
+
moves = [].concat(_toConsumableArray(rightMoves.slice(0, rightOffset)), _toConsumableArray(leftMoves.slice(leftOffset)));
|
|
409
|
+
coords = [].concat(_toConsumableArray(rightCoords.slice(0, rightOffset)), _toConsumableArray(leftCoords.slice(leftOffset)));
|
|
404
410
|
}
|
|
405
411
|
|
|
406
412
|
var middle = moves.indexOf("L");
|
|
@@ -443,8 +449,8 @@ export var getVerticalPolarBarPath = function (props, cornerRadius) {
|
|
|
443
449
|
var shortPath = bottomRight > bottomLeft ? isShort(rightMoves, rightMiddle) : isShort(leftMoves, leftMiddle); // eslint-disable-next-line no-magic-numbers
|
|
444
450
|
|
|
445
451
|
var rightOffset = shortPath ? -1 : -3;
|
|
446
|
-
moves = _toConsumableArray(leftMoves.slice(0, leftMiddle + 2))
|
|
447
|
-
coords = _toConsumableArray(leftCoords.slice(0, leftMiddle + 2))
|
|
452
|
+
moves = [].concat(_toConsumableArray(leftMoves.slice(0, leftMiddle + 2)), _toConsumableArray(rightMoves.slice(rightOffset)));
|
|
453
|
+
coords = [].concat(_toConsumableArray(leftCoords.slice(0, leftMiddle + 2)), _toConsumableArray(rightCoords.slice(rightOffset)));
|
|
448
454
|
}
|
|
449
455
|
|
|
450
456
|
var middle = moves.indexOf("L");
|
|
@@ -460,9 +466,7 @@ export var getVerticalPolarBarPath = function (props, cornerRadius) {
|
|
|
460
466
|
|
|
461
467
|
var topPath = getTopPath();
|
|
462
468
|
var bottomPath = getBottomPath();
|
|
463
|
-
|
|
464
|
-
var moves = _toConsumableArray(topPath).concat(_toConsumableArray(bottomPath));
|
|
465
|
-
|
|
469
|
+
var moves = [].concat(_toConsumableArray(topPath), _toConsumableArray(bottomPath));
|
|
466
470
|
var path = moves.reduce(function (memo, move) {
|
|
467
471
|
memo += "".concat(move.command, " ").concat(move.coords.join());
|
|
468
472
|
return memo;
|
package/es/victory-bar.js
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
|
-
function
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
2
|
|
|
3
|
-
function
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
4
|
|
|
5
5
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
6
|
|
|
7
7
|
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); } }
|
|
8
8
|
|
|
9
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
9
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
10
|
+
|
|
11
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
12
|
+
|
|
13
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
14
|
+
|
|
15
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
16
|
|
|
11
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
17
|
+
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
12
18
|
|
|
13
19
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
14
20
|
|
|
15
|
-
function
|
|
21
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
22
|
+
|
|
23
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
24
|
+
|
|
25
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
26
|
|
|
17
27
|
import PropTypes from "prop-types";
|
|
18
28
|
import React from "react";
|
|
@@ -38,21 +48,21 @@ var defaultData = [{
|
|
|
38
48
|
y: 4
|
|
39
49
|
}];
|
|
40
50
|
|
|
41
|
-
var VictoryBar =
|
|
42
|
-
/*#__PURE__*/
|
|
43
|
-
function (_React$Component) {
|
|
51
|
+
var VictoryBar = /*#__PURE__*/function (_React$Component) {
|
|
44
52
|
_inherits(VictoryBar, _React$Component);
|
|
45
53
|
|
|
54
|
+
var _super = _createSuper(VictoryBar);
|
|
55
|
+
|
|
46
56
|
function VictoryBar() {
|
|
47
57
|
_classCallCheck(this, VictoryBar);
|
|
48
58
|
|
|
49
|
-
return
|
|
59
|
+
return _super.apply(this, arguments);
|
|
50
60
|
}
|
|
51
61
|
|
|
52
62
|
_createClass(VictoryBar, [{
|
|
53
63
|
key: "shouldAnimate",
|
|
54
|
-
// Overridden in native versions
|
|
55
|
-
|
|
64
|
+
value: // Overridden in native versions
|
|
65
|
+
function shouldAnimate() {
|
|
56
66
|
return !!this.props.animate;
|
|
57
67
|
}
|
|
58
68
|
}, {
|
|
@@ -67,7 +77,7 @@ function (_React$Component) {
|
|
|
67
77
|
}
|
|
68
78
|
|
|
69
79
|
var children = this.renderData(props);
|
|
70
|
-
var container = React.cloneElement(props.containerComponent, UserProps.getSafeUserProps(props));
|
|
80
|
+
var container = /*#__PURE__*/React.cloneElement(props.containerComponent, UserProps.getSafeUserProps(props));
|
|
71
81
|
return props.standalone ? this.renderContainer(container, children) : children;
|
|
72
82
|
}
|
|
73
83
|
}]);
|
|
@@ -75,136 +85,96 @@ function (_React$Component) {
|
|
|
75
85
|
return VictoryBar;
|
|
76
86
|
}(React.Component);
|
|
77
87
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
writable: true,
|
|
94
|
-
value: "bar"
|
|
95
|
-
});
|
|
96
|
-
Object.defineProperty(VictoryBar, "defaultTransitions", {
|
|
97
|
-
configurable: true,
|
|
98
|
-
enumerable: true,
|
|
99
|
-
writable: true,
|
|
100
|
-
value: {
|
|
101
|
-
onLoad: {
|
|
102
|
-
duration: 2000,
|
|
103
|
-
before: function () {
|
|
104
|
-
return {
|
|
105
|
-
_y: 0,
|
|
106
|
-
_y1: 0,
|
|
107
|
-
_y0: 0
|
|
108
|
-
};
|
|
109
|
-
},
|
|
110
|
-
after: function (datum) {
|
|
111
|
-
return {
|
|
112
|
-
_y: datum._y,
|
|
113
|
-
_y1: datum._y1,
|
|
114
|
-
_y0: datum._y0
|
|
115
|
-
};
|
|
116
|
-
}
|
|
88
|
+
_defineProperty(VictoryBar, "animationWhitelist", ["data", "domain", "height", "padding", "style", "width"]);
|
|
89
|
+
|
|
90
|
+
_defineProperty(VictoryBar, "displayName", "VictoryBar");
|
|
91
|
+
|
|
92
|
+
_defineProperty(VictoryBar, "role", "bar");
|
|
93
|
+
|
|
94
|
+
_defineProperty(VictoryBar, "defaultTransitions", {
|
|
95
|
+
onLoad: {
|
|
96
|
+
duration: 2000,
|
|
97
|
+
before: function () {
|
|
98
|
+
return {
|
|
99
|
+
_y: 0,
|
|
100
|
+
_y1: 0,
|
|
101
|
+
_y0: 0
|
|
102
|
+
};
|
|
117
103
|
},
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
104
|
+
after: function (datum) {
|
|
105
|
+
return {
|
|
106
|
+
_y: datum._y,
|
|
107
|
+
_y1: datum._y1,
|
|
108
|
+
_y0: datum._y0
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
onExit: {
|
|
113
|
+
duration: 500,
|
|
114
|
+
before: function () {
|
|
115
|
+
return {
|
|
116
|
+
_y: 0,
|
|
117
|
+
yOffset: 0
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
onEnter: {
|
|
122
|
+
duration: 500,
|
|
123
|
+
before: function () {
|
|
124
|
+
return {
|
|
125
|
+
_y: 0,
|
|
126
|
+
_y1: 0,
|
|
127
|
+
_y0: 0
|
|
128
|
+
};
|
|
126
129
|
},
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
_y0: 0
|
|
134
|
-
};
|
|
135
|
-
},
|
|
136
|
-
after: function (datum) {
|
|
137
|
-
return {
|
|
138
|
-
_y: datum._y,
|
|
139
|
-
_y1: datum._y1,
|
|
140
|
-
_y0: datum._y0
|
|
141
|
-
};
|
|
142
|
-
}
|
|
130
|
+
after: function (datum) {
|
|
131
|
+
return {
|
|
132
|
+
_y: datum._y,
|
|
133
|
+
_y1: datum._y1,
|
|
134
|
+
_y0: datum._y0
|
|
135
|
+
};
|
|
143
136
|
}
|
|
144
137
|
}
|
|
145
138
|
});
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
role: "presentation"
|
|
176
|
-
}),
|
|
177
|
-
labelComponent: React.createElement(VictoryLabel, null),
|
|
178
|
-
samples: 50,
|
|
179
|
-
sortOrder: "ascending",
|
|
180
|
-
standalone: true,
|
|
181
|
-
theme: VictoryTheme.grayscale
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
Object.defineProperty(VictoryBar, "getDomain", {
|
|
185
|
-
configurable: true,
|
|
186
|
-
enumerable: true,
|
|
187
|
-
writable: true,
|
|
188
|
-
value: Domain.getDomainWithZero
|
|
189
|
-
});
|
|
190
|
-
Object.defineProperty(VictoryBar, "getData", {
|
|
191
|
-
configurable: true,
|
|
192
|
-
enumerable: true,
|
|
193
|
-
writable: true,
|
|
194
|
-
value: Data.getData
|
|
195
|
-
});
|
|
196
|
-
Object.defineProperty(VictoryBar, "getBaseProps", {
|
|
197
|
-
configurable: true,
|
|
198
|
-
enumerable: true,
|
|
199
|
-
writable: true,
|
|
200
|
-
value: function (props) {
|
|
201
|
-
return getBaseProps(props, fallbackProps);
|
|
202
|
-
}
|
|
139
|
+
|
|
140
|
+
_defineProperty(VictoryBar, "propTypes", _objectSpread(_objectSpread(_objectSpread({}, CommonProps.baseProps), CommonProps.dataProps), {}, {
|
|
141
|
+
alignment: PropTypes.oneOf(["start", "middle", "end"]),
|
|
142
|
+
barRatio: PropTypes.number,
|
|
143
|
+
barWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
|
|
144
|
+
cornerRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.func, PropTypes.shape({
|
|
145
|
+
top: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
|
|
146
|
+
topLeft: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
|
|
147
|
+
topRight: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
|
|
148
|
+
bottom: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
|
|
149
|
+
bottomLeft: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
|
|
150
|
+
bottomRight: PropTypes.oneOfType([PropTypes.number, PropTypes.func])
|
|
151
|
+
})]),
|
|
152
|
+
getPath: PropTypes.func,
|
|
153
|
+
horizontal: PropTypes.bool
|
|
154
|
+
}));
|
|
155
|
+
|
|
156
|
+
_defineProperty(VictoryBar, "defaultProps", {
|
|
157
|
+
containerComponent: /*#__PURE__*/React.createElement(VictoryContainer, null),
|
|
158
|
+
data: defaultData,
|
|
159
|
+
dataComponent: /*#__PURE__*/React.createElement(Bar, null),
|
|
160
|
+
groupComponent: /*#__PURE__*/React.createElement("g", {
|
|
161
|
+
role: "presentation"
|
|
162
|
+
}),
|
|
163
|
+
labelComponent: /*#__PURE__*/React.createElement(VictoryLabel, null),
|
|
164
|
+
samples: 50,
|
|
165
|
+
sortOrder: "ascending",
|
|
166
|
+
standalone: true,
|
|
167
|
+
theme: VictoryTheme.grayscale
|
|
203
168
|
});
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
169
|
+
|
|
170
|
+
_defineProperty(VictoryBar, "getDomain", Domain.getDomainWithZero);
|
|
171
|
+
|
|
172
|
+
_defineProperty(VictoryBar, "getData", Data.getData);
|
|
173
|
+
|
|
174
|
+
_defineProperty(VictoryBar, "getBaseProps", function (props) {
|
|
175
|
+
return getBaseProps(props, fallbackProps);
|
|
209
176
|
});
|
|
177
|
+
|
|
178
|
+
_defineProperty(VictoryBar, "expectedComponents", ["dataComponent", "labelComponent", "groupComponent", "containerComponent"]);
|
|
179
|
+
|
|
210
180
|
export default addEvents(VictoryBar);
|
package/lib/bar.js
CHANGED
|
@@ -19,7 +19,9 @@ var _pathHelperMethods = require("./path-helper-methods");
|
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
22
|
-
function
|
|
22
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
|
+
|
|
24
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
25
|
|
|
24
26
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
27
|
|
|
@@ -74,7 +76,7 @@ var Bar = function (props) {
|
|
|
74
76
|
cornerRadius = _props.cornerRadius;
|
|
75
77
|
var path = polar ? (0, _pathHelperMethods.getPolarBarPath)(props, cornerRadius) : (0, _pathHelperMethods.getBarPath)(props, barWidth, cornerRadius);
|
|
76
78
|
var defaultTransform = polar && origin ? "translate(".concat(origin.x, ", ").concat(origin.y, ")") : undefined;
|
|
77
|
-
return _react.default.cloneElement(props.pathComponent, _objectSpread({}, props.events, {
|
|
79
|
+
return /*#__PURE__*/_react.default.cloneElement(props.pathComponent, _objectSpread(_objectSpread({}, props.events), {}, {
|
|
78
80
|
"aria-label": props.ariaLabel,
|
|
79
81
|
style: style,
|
|
80
82
|
d: path,
|
|
@@ -89,7 +91,7 @@ var Bar = function (props) {
|
|
|
89
91
|
}));
|
|
90
92
|
};
|
|
91
93
|
|
|
92
|
-
Bar.propTypes = _objectSpread({}, _victoryCore.CommonProps.primitiveProps, {
|
|
94
|
+
Bar.propTypes = _objectSpread(_objectSpread({}, _victoryCore.CommonProps.primitiveProps), {}, {
|
|
93
95
|
alignment: _propTypes.default.oneOf(["start", "middle", "end"]),
|
|
94
96
|
barRatio: _propTypes.default.number,
|
|
95
97
|
barWidth: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.func]),
|
|
@@ -112,7 +114,7 @@ Bar.propTypes = _objectSpread({}, _victoryCore.CommonProps.primitiveProps, {
|
|
|
112
114
|
});
|
|
113
115
|
Bar.defaultProps = {
|
|
114
116
|
defaultBarWidth: 8,
|
|
115
|
-
pathComponent: _react.default.createElement(_victoryCore.Path, null),
|
|
117
|
+
pathComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.Path, null),
|
|
116
118
|
role: "presentation",
|
|
117
119
|
shapeRendering: "auto"
|
|
118
120
|
};
|
package/lib/index.js
CHANGED
|
@@ -3,40 +3,40 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "Bar", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _bar.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "VictoryBar", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function () {
|
|
15
|
-
return
|
|
15
|
+
return _victoryBar.default;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
Object.defineProperty(exports, "
|
|
18
|
+
Object.defineProperty(exports, "getBarPath", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function () {
|
|
21
|
-
return
|
|
21
|
+
return _pathHelperMethods.getBarPath;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
Object.defineProperty(exports, "
|
|
24
|
+
Object.defineProperty(exports, "getBarPosition", {
|
|
25
25
|
enumerable: true,
|
|
26
26
|
get: function () {
|
|
27
|
-
return
|
|
27
|
+
return _helperMethods.getBarPosition;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
Object.defineProperty(exports, "
|
|
30
|
+
Object.defineProperty(exports, "getBarWidth", {
|
|
31
31
|
enumerable: true,
|
|
32
32
|
get: function () {
|
|
33
|
-
return
|
|
33
|
+
return _barHelperMethods.getBarWidth;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
-
Object.defineProperty(exports, "
|
|
36
|
+
Object.defineProperty(exports, "getCornerRadius", {
|
|
37
37
|
enumerable: true,
|
|
38
38
|
get: function () {
|
|
39
|
-
return
|
|
39
|
+
return _barHelperMethods.getCornerRadius;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "getCustomBarPath", {
|
|
@@ -45,34 +45,34 @@ Object.defineProperty(exports, "getCustomBarPath", {
|
|
|
45
45
|
return _pathHelperMethods.getCustomBarPath;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
-
Object.defineProperty(exports, "
|
|
48
|
+
Object.defineProperty(exports, "getHorizontalBarPath", {
|
|
49
49
|
enumerable: true,
|
|
50
50
|
get: function () {
|
|
51
|
-
return _pathHelperMethods.
|
|
51
|
+
return _pathHelperMethods.getHorizontalBarPath;
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
-
Object.defineProperty(exports, "
|
|
54
|
+
Object.defineProperty(exports, "getPolarBarPath", {
|
|
55
55
|
enumerable: true,
|
|
56
56
|
get: function () {
|
|
57
|
-
return _pathHelperMethods.
|
|
57
|
+
return _pathHelperMethods.getPolarBarPath;
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
-
Object.defineProperty(exports, "
|
|
60
|
+
Object.defineProperty(exports, "getStyle", {
|
|
61
61
|
enumerable: true,
|
|
62
62
|
get: function () {
|
|
63
|
-
return _barHelperMethods.
|
|
63
|
+
return _barHelperMethods.getStyle;
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
-
Object.defineProperty(exports, "
|
|
66
|
+
Object.defineProperty(exports, "getVerticalBarPath", {
|
|
67
67
|
enumerable: true,
|
|
68
68
|
get: function () {
|
|
69
|
-
return
|
|
69
|
+
return _pathHelperMethods.getVerticalBarPath;
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
Object.defineProperty(exports, "
|
|
72
|
+
Object.defineProperty(exports, "getVerticalPolarBarPath", {
|
|
73
73
|
enumerable: true,
|
|
74
74
|
get: function () {
|
|
75
|
-
return
|
|
75
|
+
return _pathHelperMethods.getVerticalPolarBarPath;
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
|
|
@@ -3,25 +3,33 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getVerticalPolarBarPath = exports.getVerticalBarPath = exports.getPolarBarPath = exports.getHorizontalBarPath = exports.getCustomBarPath = exports.getBarPath = void 0;
|
|
7
7
|
|
|
8
|
-
var d3Shape = _interopRequireWildcard(require("d3-shape"));
|
|
8
|
+
var d3Shape = _interopRequireWildcard(require("victory-vendor/d3-shape"));
|
|
9
9
|
|
|
10
10
|
var _geometryHelperMethods = require("./geometry-helper-methods");
|
|
11
11
|
|
|
12
|
-
function
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
13
|
|
|
14
|
-
function
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
+
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
19
|
|
|
16
20
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
21
|
|
|
18
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
22
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
23
|
+
|
|
24
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
25
|
|
|
20
|
-
function
|
|
26
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
27
|
|
|
22
|
-
function _iterableToArray(iter) { if (Symbol.iterator
|
|
28
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
23
29
|
|
|
24
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr))
|
|
30
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
31
|
+
|
|
32
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
25
33
|
|
|
26
34
|
var getPosition = function (props, width) {
|
|
27
35
|
var x = props.x,
|
|
@@ -72,7 +80,7 @@ var transformAngle = function (angle) {
|
|
|
72
80
|
var getCustomBarPath = function (props, width) {
|
|
73
81
|
var getPath = props.getPath;
|
|
74
82
|
|
|
75
|
-
var propsWithCalculatedValues = _objectSpread({}, props, getPosition(props, width));
|
|
83
|
+
var propsWithCalculatedValues = _objectSpread(_objectSpread({}, props), getPosition(props, width));
|
|
76
84
|
|
|
77
85
|
return getPath(propsWithCalculatedValues);
|
|
78
86
|
};
|
|
@@ -417,8 +425,8 @@ var getVerticalPolarBarPath = function (props, cornerRadius) {
|
|
|
417
425
|
leftOffset = isShort(rightMiddle) ? _defaultOffset : leftMiddle - 2;
|
|
418
426
|
}
|
|
419
427
|
|
|
420
|
-
moves = _toConsumableArray(rightMoves.slice(0, rightOffset))
|
|
421
|
-
coords = _toConsumableArray(rightCoords.slice(0, rightOffset))
|
|
428
|
+
moves = [].concat(_toConsumableArray(rightMoves.slice(0, rightOffset)), _toConsumableArray(leftMoves.slice(leftOffset)));
|
|
429
|
+
coords = [].concat(_toConsumableArray(rightCoords.slice(0, rightOffset)), _toConsumableArray(leftCoords.slice(leftOffset)));
|
|
422
430
|
}
|
|
423
431
|
|
|
424
432
|
var middle = moves.indexOf("L");
|
|
@@ -461,8 +469,8 @@ var getVerticalPolarBarPath = function (props, cornerRadius) {
|
|
|
461
469
|
var shortPath = bottomRight > bottomLeft ? isShort(rightMoves, rightMiddle) : isShort(leftMoves, leftMiddle); // eslint-disable-next-line no-magic-numbers
|
|
462
470
|
|
|
463
471
|
var rightOffset = shortPath ? -1 : -3;
|
|
464
|
-
moves = _toConsumableArray(leftMoves.slice(0, leftMiddle + 2))
|
|
465
|
-
coords = _toConsumableArray(leftCoords.slice(0, leftMiddle + 2))
|
|
472
|
+
moves = [].concat(_toConsumableArray(leftMoves.slice(0, leftMiddle + 2)), _toConsumableArray(rightMoves.slice(rightOffset)));
|
|
473
|
+
coords = [].concat(_toConsumableArray(leftCoords.slice(0, leftMiddle + 2)), _toConsumableArray(rightCoords.slice(rightOffset)));
|
|
466
474
|
}
|
|
467
475
|
|
|
468
476
|
var middle = moves.indexOf("L");
|
|
@@ -478,9 +486,7 @@ var getVerticalPolarBarPath = function (props, cornerRadius) {
|
|
|
478
486
|
|
|
479
487
|
var topPath = getTopPath();
|
|
480
488
|
var bottomPath = getBottomPath();
|
|
481
|
-
|
|
482
|
-
var moves = _toConsumableArray(topPath).concat(_toConsumableArray(bottomPath));
|
|
483
|
-
|
|
489
|
+
var moves = [].concat(_toConsumableArray(topPath), _toConsumableArray(bottomPath));
|
|
484
490
|
var path = moves.reduce(function (memo, move) {
|
|
485
491
|
memo += "".concat(move.command, " ").concat(move.coords.join());
|
|
486
492
|
return memo;
|