victory-core 36.3.2 → 36.5.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-core.js +15084 -15018
- package/dist/victory-core.min.js +1 -1
- package/es/index.d.ts +38 -941
- package/es/index.js +19 -28
- package/es/types.d.ts +33 -0
- package/es/types.js +1 -0
- package/es/victory-accessible-group/victory-accessible-group.d.ts +25 -0
- package/es/victory-accessible-group/victory-accessible-group.js +35 -45
- package/es/victory-animation/util.d.ts +66 -0
- package/es/victory-animation/util.js +3 -2
- package/es/victory-animation/victory-animation.d.ts +69 -0
- package/es/victory-animation/victory-animation.js +92 -102
- package/es/victory-clip-container/victory-clip-container.d.ts +76 -0
- package/es/victory-clip-container/victory-clip-container.js +75 -82
- package/es/victory-container/victory-container.d.ts +99 -0
- package/es/victory-container/victory-container.js +97 -107
- package/es/victory-label/victory-label.d.ts +61 -0
- package/es/victory-label/victory-label.js +43 -31
- package/es/victory-portal/portal-context.d.ts +11 -0
- package/es/victory-portal/portal-context.js +3 -4
- package/es/victory-portal/portal.d.ts +28 -0
- package/es/victory-portal/portal.js +44 -50
- package/es/victory-portal/victory-portal.d.ts +31 -0
- package/es/victory-portal/victory-portal.js +38 -47
- package/es/victory-primitives/arc.d.ts +21 -0
- package/es/victory-primitives/arc.js +9 -9
- package/es/victory-primitives/background.d.ts +22 -0
- package/es/victory-primitives/background.js +12 -12
- package/es/victory-primitives/border.d.ts +18 -0
- package/es/victory-primitives/border.js +9 -9
- package/es/victory-primitives/circle.d.ts +2 -0
- package/es/victory-primitives/circle.js +17 -10
- package/es/victory-primitives/clip-path.d.ts +14 -0
- package/es/victory-primitives/clip-path.js +6 -6
- package/es/victory-primitives/index.d.ts +14 -0
- package/es/victory-primitives/index.js +14 -0
- package/es/victory-primitives/line-segment.d.ts +19 -0
- package/es/victory-primitives/line-segment.js +9 -9
- package/es/victory-primitives/line.d.ts +2 -0
- package/es/victory-primitives/line.js +17 -10
- package/es/victory-primitives/path.d.ts +2 -0
- package/es/victory-primitives/path.js +15 -8
- package/es/victory-primitives/point.d.ts +21 -0
- package/es/victory-primitives/point.js +15 -23
- package/es/victory-primitives/rect.d.ts +2 -0
- package/es/victory-primitives/rect.js +17 -10
- package/es/victory-primitives/text.d.ts +16 -0
- package/es/victory-primitives/text.js +13 -8
- package/es/victory-primitives/tspan.d.ts +2 -0
- package/es/victory-primitives/tspan.js +7 -6
- package/es/victory-primitives/types.d.ts +7 -0
- package/es/victory-primitives/types.js +1 -0
- package/es/victory-primitives/whisker.d.ts +24 -0
- package/es/victory-primitives/whisker.js +12 -12
- package/es/victory-theme/grayscale.d.ts +2 -0
- package/es/victory-theme/grayscale.js +1 -1
- package/es/victory-theme/material.d.ts +2 -0
- package/es/victory-theme/material.js +1 -1
- package/es/victory-theme/victory-theme-definition.d.ts +244 -0
- package/es/victory-theme/victory-theme-definition.js +1 -0
- package/es/victory-theme/victory-theme.d.ts +5 -0
- package/es/victory-theme/victory-theme.js +6 -5
- package/es/victory-transition/victory-transition.d.ts +59 -0
- package/es/victory-transition/victory-transition.js +38 -44
- package/es/victory-util/add-events.js +328 -319
- package/es/victory-util/axis.js +12 -6
- package/es/victory-util/collection.js +7 -5
- package/es/victory-util/common-props.js +2 -2
- package/es/victory-util/data.js +8 -6
- package/es/victory-util/default-transitions.js +0 -1
- package/es/victory-util/domain.js +7 -5
- package/es/victory-util/events.js +8 -4
- package/es/victory-util/helpers.js +1 -3
- package/es/victory-util/hooks/use-animation-state.js +11 -5
- package/es/victory-util/immutable.js +0 -1
- package/es/victory-util/label-helpers.js +0 -2
- package/es/victory-util/line-helpers.js +1 -1
- package/es/victory-util/log.js +0 -1
- package/es/victory-util/point-path-helpers.d.ts +9 -0
- package/es/victory-util/point-path-helpers.js +59 -61
- package/es/victory-util/scale.js +19 -19
- package/es/victory-util/selection.d.ts +23 -0
- package/es/victory-util/selection.js +0 -2
- package/es/victory-util/style.js +0 -2
- package/es/victory-util/textsize.d.ts +8 -0
- package/es/victory-util/textsize.js +11 -7
- package/es/victory-util/timer-context.d.ts +11 -0
- package/es/victory-util/timer-context.js +1 -1
- package/es/victory-util/timer.d.ts +16 -0
- package/es/victory-util/timer.js +16 -13
- package/es/victory-util/types.d.ts +188 -0
- package/es/victory-util/types.js +1 -0
- package/es/victory-util/user-props.js +44 -4
- package/es/victory-util/wrapper.js +18 -12
- package/lib/index.d.ts +38 -941
- package/lib/index.js +201 -189
- package/lib/types.d.ts +33 -0
- package/lib/types.js +1 -0
- package/lib/victory-accessible-group/victory-accessible-group.d.ts +25 -0
- package/lib/victory-accessible-group/victory-accessible-group.js +37 -45
- package/lib/victory-animation/util.d.ts +66 -0
- package/lib/victory-animation/util.js +4 -3
- package/lib/victory-animation/victory-animation.d.ts +69 -0
- package/lib/victory-animation/victory-animation.js +97 -102
- package/lib/victory-clip-container/victory-clip-container.d.ts +76 -0
- package/lib/victory-clip-container/victory-clip-container.js +81 -82
- package/lib/victory-container/victory-container.d.ts +99 -0
- package/lib/victory-container/victory-container.js +102 -107
- package/lib/victory-label/victory-label.d.ts +61 -0
- package/lib/victory-label/victory-label.js +49 -32
- package/lib/victory-portal/portal-context.d.ts +11 -0
- package/lib/victory-portal/portal-context.js +4 -5
- package/lib/victory-portal/portal.d.ts +28 -0
- package/lib/victory-portal/portal.js +49 -50
- package/lib/victory-portal/victory-portal.d.ts +31 -0
- package/lib/victory-portal/victory-portal.js +43 -47
- package/lib/victory-primitives/arc.d.ts +21 -0
- package/lib/victory-primitives/arc.js +13 -10
- package/lib/victory-primitives/background.d.ts +22 -0
- package/lib/victory-primitives/background.js +16 -13
- package/lib/victory-primitives/border.d.ts +18 -0
- package/lib/victory-primitives/border.js +13 -10
- package/lib/victory-primitives/circle.d.ts +2 -0
- package/lib/victory-primitives/circle.js +17 -8
- package/lib/victory-primitives/clip-path.d.ts +14 -0
- package/lib/victory-primitives/clip-path.js +7 -5
- package/lib/victory-primitives/index.d.ts +14 -0
- package/lib/victory-primitives/index.js +187 -0
- package/lib/victory-primitives/line-segment.d.ts +19 -0
- package/lib/victory-primitives/line-segment.js +13 -10
- package/lib/victory-primitives/line.d.ts +2 -0
- package/lib/victory-primitives/line.js +17 -8
- package/lib/victory-primitives/path.d.ts +2 -0
- package/lib/victory-primitives/path.js +15 -6
- package/lib/victory-primitives/point.d.ts +21 -0
- package/lib/victory-primitives/point.js +21 -25
- package/lib/victory-primitives/rect.d.ts +2 -0
- package/lib/victory-primitives/rect.js +17 -8
- package/lib/victory-primitives/text.d.ts +16 -0
- package/lib/victory-primitives/text.js +14 -7
- package/lib/victory-primitives/tspan.d.ts +2 -0
- package/lib/victory-primitives/tspan.js +7 -4
- package/lib/victory-primitives/types.d.ts +7 -0
- package/lib/victory-primitives/types.js +1 -0
- package/lib/victory-primitives/whisker.d.ts +24 -0
- package/lib/victory-primitives/whisker.js +16 -13
- package/lib/victory-theme/grayscale.d.ts +2 -0
- package/lib/victory-theme/grayscale.js +3 -3
- package/lib/victory-theme/material.d.ts +2 -0
- package/lib/victory-theme/material.js +3 -3
- package/lib/victory-theme/victory-theme-definition.d.ts +244 -0
- package/lib/victory-theme/victory-theme-definition.js +1 -0
- package/lib/victory-theme/victory-theme.d.ts +5 -0
- package/lib/victory-theme/victory-theme.js +22 -8
- package/lib/victory-transition/victory-transition.d.ts +59 -0
- package/lib/victory-transition/victory-transition.js +43 -45
- package/lib/victory-util/add-events.js +326 -316
- package/lib/victory-util/axis.js +20 -11
- package/lib/victory-util/collection.js +10 -8
- package/lib/victory-util/common-props.js +6 -4
- package/lib/victory-util/data.js +13 -7
- package/lib/victory-util/default-transitions.js +1 -2
- package/lib/victory-util/domain.js +11 -5
- package/lib/victory-util/events.js +17 -11
- package/lib/victory-util/helpers.js +14 -16
- package/lib/victory-util/hooks/index.js +4 -4
- package/lib/victory-util/hooks/use-animation-state.js +14 -6
- package/lib/victory-util/immutable.js +3 -5
- package/lib/victory-util/label-helpers.js +6 -6
- package/lib/victory-util/line-helpers.js +4 -2
- package/lib/victory-util/log.js +0 -1
- package/lib/victory-util/point-path-helpers.d.ts +9 -0
- package/lib/victory-util/point-path-helpers.js +86 -73
- package/lib/victory-util/prop-types.js +5 -3
- package/lib/victory-util/scale.js +24 -21
- package/lib/victory-util/selection.d.ts +23 -0
- package/lib/victory-util/selection.js +5 -5
- package/lib/victory-util/style.js +0 -2
- package/lib/victory-util/textsize.d.ts +8 -0
- package/lib/victory-util/textsize.js +12 -8
- package/lib/victory-util/timer-context.d.ts +11 -0
- package/lib/victory-util/timer-context.js +1 -1
- package/lib/victory-util/timer.d.ts +16 -0
- package/lib/victory-util/timer.js +16 -13
- package/lib/victory-util/types.d.ts +188 -0
- package/lib/victory-util/types.js +1 -0
- package/lib/victory-util/user-props.js +53 -6
- package/lib/victory-util/wrapper.js +31 -23
- package/package.json +6 -13
- package/src/index.ts +42 -0
- package/src/types.ts +45 -0
- package/src/victory-accessible-group/{victory-accessible-group.js → victory-accessible-group.tsx} +10 -3
- package/src/victory-animation/{util.js → util.ts} +5 -4
- package/src/victory-animation/{victory-animation.js → victory-animation.tsx} +90 -13
- package/src/victory-clip-container/{victory-clip-container.js → victory-clip-container.tsx} +32 -6
- package/src/victory-container/{victory-container.js → victory-container.tsx} +70 -26
- package/src/victory-label/{victory-label.js → victory-label.tsx} +80 -19
- package/src/victory-portal/portal-context.ts +14 -0
- package/src/victory-portal/{portal.js → portal.tsx} +23 -12
- package/src/victory-portal/{victory-portal.js → victory-portal.tsx} +21 -6
- package/src/victory-primitives/{arc.js → arc.tsx} +15 -5
- package/src/victory-primitives/{background.js → background.tsx} +17 -7
- package/src/victory-primitives/{border.js → border.tsx} +12 -5
- package/src/victory-primitives/{circle.js → circle.tsx} +4 -3
- package/src/victory-primitives/clip-path.tsx +25 -0
- package/src/victory-primitives/index.ts +14 -0
- package/src/victory-primitives/{line-segment.js → line-segment.tsx} +13 -5
- package/src/victory-primitives/{line.js → line.tsx} +4 -3
- package/src/victory-primitives/{path.js → path.tsx} +4 -3
- package/src/victory-primitives/{point.js → point.tsx} +25 -20
- package/src/victory-primitives/{rect.js → rect.tsx} +4 -2
- package/src/victory-primitives/{text.js → text.tsx} +9 -3
- package/src/victory-primitives/tspan.tsx +7 -0
- package/src/victory-primitives/types.ts +19 -0
- package/src/victory-primitives/{whisker.js → whisker.tsx} +20 -7
- package/src/victory-theme/{grayscale.js → grayscale.tsx} +2 -1
- package/src/victory-theme/{material.js → material.tsx} +2 -1
- package/src/victory-theme/victory-theme-definition.ts +261 -0
- package/src/victory-theme/victory-theme.tsx +5 -0
- package/src/victory-transition/{victory-transition.js → victory-transition.tsx} +68 -19
- package/src/victory-util/add-events.js +7 -5
- package/src/victory-util/axis.js +3 -1
- package/src/victory-util/collection.js +0 -1
- package/src/victory-util/common-props.js +2 -2
- package/src/victory-util/data.js +0 -1
- package/src/victory-util/default-transitions.js +0 -1
- package/src/victory-util/domain.js +0 -1
- package/src/victory-util/events.js +1 -1
- package/src/victory-util/helpers.js +0 -1
- package/src/victory-util/immutable.js +0 -1
- package/src/victory-util/label-helpers.js +0 -1
- package/src/victory-util/line-helpers.js +1 -1
- package/src/victory-util/log.js +0 -1
- package/src/victory-util/point-path-helpers.ts +119 -0
- package/src/victory-util/prop-types.js +0 -1
- package/src/victory-util/scale.js +18 -10
- package/src/victory-util/selection.d.ts +23 -0
- package/src/victory-util/selection.js +0 -1
- package/src/victory-util/style.js +0 -1
- package/src/victory-util/textsize.d.ts +8 -0
- package/src/victory-util/{timer-context.js → timer-context.ts} +0 -0
- package/src/victory-util/{timer.js → timer.ts} +20 -5
- package/src/victory-util/transitions.js +0 -1
- package/src/victory-util/types.ts +247 -0
- package/src/victory-util/user-props.js +31 -1
- package/src/victory-util/wrapper.js +0 -1
- package/src/index.d.ts +0 -941
- package/src/index.js +0 -51
- package/src/victory-portal/portal-context.js +0 -10
- package/src/victory-primitives/clip-path.js +0 -18
- package/src/victory-primitives/tspan.js +0 -5
- package/src/victory-theme/victory-theme.js +0 -7
- package/src/victory-util/point-path-helpers.js +0 -121
|
@@ -29,34 +29,50 @@ var Events = _interopRequireWildcard(require("./events"));
|
|
|
29
29
|
|
|
30
30
|
var _reactFastCompare = _interopRequireDefault(require("react-fast-compare"));
|
|
31
31
|
|
|
32
|
-
var _victoryTransition =
|
|
32
|
+
var _victoryTransition = require("../victory-transition/victory-transition");
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
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); }
|
|
35
35
|
|
|
36
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; }
|
|
36
|
+
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; }
|
|
37
37
|
|
|
38
38
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
39
39
|
|
|
40
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
40
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
41
41
|
|
|
42
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
|
42
|
+
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."); }
|
|
43
43
|
|
|
44
|
-
function
|
|
44
|
+
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); }
|
|
45
45
|
|
|
46
|
-
function
|
|
46
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
47
|
+
|
|
48
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
49
|
+
|
|
50
|
+
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; }
|
|
47
51
|
|
|
48
52
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
49
53
|
|
|
50
54
|
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); } }
|
|
51
55
|
|
|
52
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
56
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
57
|
+
|
|
58
|
+
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); }
|
|
53
59
|
|
|
54
|
-
function
|
|
60
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
55
61
|
|
|
56
|
-
function
|
|
62
|
+
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); }; }
|
|
63
|
+
|
|
64
|
+
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); }
|
|
57
65
|
|
|
58
66
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
59
67
|
|
|
68
|
+
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; } }
|
|
69
|
+
|
|
70
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
71
|
+
|
|
72
|
+
// DISCLAIMER:
|
|
73
|
+
// This file is not currently tested, and it is first on the list of files
|
|
74
|
+
// to refactor in our current refactoring effort. Please do not make changes
|
|
75
|
+
// to this file without manual testing and/or refactoring and adding tests.
|
|
60
76
|
var datumHasXandY = function (datum) {
|
|
61
77
|
return !(0, _isNil2.default)(datum._x) && !(0, _isNil2.default)(datum._y);
|
|
62
78
|
}; // used for checking state changes. Expected components can be passed in via options
|
|
@@ -72,350 +88,344 @@ var defaultComponents = [{
|
|
|
72
88
|
}];
|
|
73
89
|
|
|
74
90
|
var _default = function _default(WrappedComponent, options) {
|
|
75
|
-
return (
|
|
76
|
-
|
|
77
|
-
function (_WrappedComponent) {
|
|
78
|
-
_inherits(addEvents, _WrappedComponent);
|
|
91
|
+
return /*#__PURE__*/function (_WrappedComponent) {
|
|
92
|
+
_inherits(addEvents, _WrappedComponent);
|
|
79
93
|
|
|
80
|
-
|
|
81
|
-
var _this;
|
|
94
|
+
var _super = _createSuper(addEvents);
|
|
82
95
|
|
|
83
|
-
|
|
96
|
+
function addEvents(props) {
|
|
97
|
+
var _this;
|
|
84
98
|
|
|
85
|
-
|
|
86
|
-
var getScopedEvents = Events.getScopedEvents.bind(_assertThisInitialized(_this));
|
|
87
|
-
var boundGetEvents = Events.getEvents.bind(_assertThisInitialized(_this));
|
|
88
|
-
_this.state = {};
|
|
99
|
+
_classCallCheck(this, addEvents);
|
|
89
100
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
101
|
+
_this = _super.call(this, props);
|
|
102
|
+
var getScopedEvents = Events.getScopedEvents.bind(_assertThisInitialized(_this));
|
|
103
|
+
var boundGetEvents = Events.getEvents.bind(_assertThisInitialized(_this));
|
|
104
|
+
_this.state = {};
|
|
93
105
|
|
|
94
|
-
|
|
106
|
+
_this.getEvents = function (p, target, eventKey) {
|
|
107
|
+
return boundGetEvents(p, target, eventKey, getScopedEvents);
|
|
108
|
+
};
|
|
95
109
|
|
|
96
|
-
|
|
110
|
+
_this.getEventState = Events.getEventState.bind(_assertThisInitialized(_this));
|
|
97
111
|
|
|
98
|
-
|
|
112
|
+
var calculatedValues = _this.getCalculatedValues(props);
|
|
99
113
|
|
|
100
|
-
|
|
101
|
-
_this.calculatedState = _this.getStateChanges(props);
|
|
102
|
-
_this.globalEvents = {};
|
|
103
|
-
_this.prevGlobalEventKeys = [];
|
|
104
|
-
_this.boundGlobalEvents = {};
|
|
105
|
-
return _this;
|
|
106
|
-
}
|
|
114
|
+
_this.cacheValues(calculatedValues);
|
|
107
115
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (animating || newMutation) {
|
|
116
|
-
this.cacheValues(this.getCalculatedValues(nextProps));
|
|
117
|
-
this.externalMutations = externalMutations;
|
|
118
|
-
this.applyExternalMutations(nextProps, externalMutations);
|
|
119
|
-
return true;
|
|
120
|
-
}
|
|
116
|
+
_this.externalMutations = _this.getExternalMutations(props);
|
|
117
|
+
_this.calculatedState = _this.getStateChanges(props);
|
|
118
|
+
_this.globalEvents = {};
|
|
119
|
+
_this.prevGlobalEventKeys = [];
|
|
120
|
+
_this.boundGlobalEvents = {};
|
|
121
|
+
return _this;
|
|
122
|
+
}
|
|
121
123
|
|
|
122
|
-
|
|
124
|
+
_createClass(addEvents, [{
|
|
125
|
+
key: "shouldComponentUpdate",
|
|
126
|
+
value: function shouldComponentUpdate(nextProps) {
|
|
127
|
+
var externalMutations = this.getExternalMutations(nextProps);
|
|
128
|
+
var animating = this.props.animating || this.props.animate;
|
|
129
|
+
var newMutation = !(0, _reactFastCompare.default)(externalMutations, this.externalMutations);
|
|
123
130
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
131
|
+
if (animating || newMutation) {
|
|
132
|
+
this.cacheValues(this.getCalculatedValues(nextProps));
|
|
133
|
+
this.externalMutations = externalMutations;
|
|
134
|
+
this.applyExternalMutations(nextProps, externalMutations);
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
128
137
|
|
|
129
|
-
|
|
130
|
-
this.cacheValues(this.getCalculatedValues(nextProps));
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
138
|
+
var calculatedState = this.getStateChanges(nextProps);
|
|
133
139
|
|
|
134
|
-
|
|
140
|
+
if (!(0, _reactFastCompare.default)(this.calculatedState, calculatedState)) {
|
|
141
|
+
this.cacheValues(this.getCalculatedValues(nextProps));
|
|
142
|
+
return true;
|
|
135
143
|
}
|
|
136
|
-
}, {
|
|
137
|
-
key: "componentDidMount",
|
|
138
|
-
value: function componentDidMount() {
|
|
139
|
-
var _this2 = this;
|
|
140
|
-
|
|
141
|
-
var globalEventKeys = (0, _keys2.default)(this.globalEvents);
|
|
142
|
-
globalEventKeys.forEach(function (key) {
|
|
143
|
-
return _this2.addGlobalListener(key);
|
|
144
|
-
});
|
|
145
|
-
this.prevGlobalEventKeys = globalEventKeys;
|
|
146
|
-
}
|
|
147
|
-
}, {
|
|
148
|
-
key: "componentDidUpdate",
|
|
149
|
-
value: function componentDidUpdate(prevProps) {
|
|
150
|
-
var _this3 = this;
|
|
151
|
-
|
|
152
|
-
var calculatedState = this.getStateChanges(prevProps);
|
|
153
|
-
this.calculatedState = calculatedState;
|
|
154
|
-
var globalEventKeys = (0, _keys2.default)(this.globalEvents);
|
|
155
|
-
var removedGlobalEventKeys = (0, _difference2.default)(this.prevGlobalEventKeys, globalEventKeys);
|
|
156
|
-
removedGlobalEventKeys.forEach(function (key) {
|
|
157
|
-
return _this3.removeGlobalListener(key);
|
|
158
|
-
});
|
|
159
|
-
var addedGlobalEventKeys = (0, _difference2.default)(globalEventKeys, this.prevGlobalEventKeys);
|
|
160
|
-
addedGlobalEventKeys.forEach(function (key) {
|
|
161
|
-
return _this3.addGlobalListener(key);
|
|
162
|
-
});
|
|
163
|
-
this.prevGlobalEventKeys = globalEventKeys;
|
|
164
|
-
}
|
|
165
|
-
}, {
|
|
166
|
-
key: "componentWillUnmount",
|
|
167
|
-
value: function componentWillUnmount() {
|
|
168
|
-
var _this4 = this;
|
|
169
144
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
}, {
|
|
175
|
-
key: "addGlobalListener",
|
|
176
|
-
value: function addGlobalListener(key) {
|
|
177
|
-
var _this5 = this;
|
|
178
|
-
|
|
179
|
-
var boundListener = function (event) {
|
|
180
|
-
var listener = _this5.globalEvents[key];
|
|
181
|
-
return listener && listener(Events.emulateReactEvent(event));
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
this.boundGlobalEvents[key] = boundListener;
|
|
185
|
-
window.addEventListener(Events.getGlobalEventNameFromKey(key), boundListener);
|
|
145
|
+
if (!(0, _reactFastCompare.default)(this.props, nextProps)) {
|
|
146
|
+
this.cacheValues(this.getCalculatedValues(nextProps));
|
|
147
|
+
return true;
|
|
186
148
|
}
|
|
187
|
-
}, {
|
|
188
|
-
key: "removeGlobalListener",
|
|
189
|
-
value: function removeGlobalListener(key) {
|
|
190
|
-
window.removeEventListener(Events.getGlobalEventNameFromKey(key), this.boundGlobalEvents[key]);
|
|
191
|
-
} // compile all state changes from own and parent state. Order doesn't matter, as any state
|
|
192
|
-
// state change should trigger a re-render
|
|
193
|
-
|
|
194
|
-
}, {
|
|
195
|
-
key: "getStateChanges",
|
|
196
|
-
value: function getStateChanges(props) {
|
|
197
|
-
var _this6 = this;
|
|
198
|
-
|
|
199
|
-
if (!this.hasEvents) {
|
|
200
|
-
return {};
|
|
201
|
-
}
|
|
202
149
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
key
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
var events = this.getAllEvents(props);
|
|
253
|
-
return {
|
|
254
|
-
componentEvents: componentEvents,
|
|
255
|
-
getSharedEventState: getSharedEventState,
|
|
256
|
-
baseProps: baseProps,
|
|
257
|
-
dataKeys: dataKeys,
|
|
258
|
-
hasEvents: hasEvents,
|
|
259
|
-
events: events
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
}, {
|
|
263
|
-
key: "getExternalMutations",
|
|
264
|
-
value: function getExternalMutations(props) {
|
|
265
|
-
var sharedEvents = props.sharedEvents,
|
|
266
|
-
externalEventMutations = props.externalEventMutations;
|
|
267
|
-
return (0, _isEmpty2.default)(externalEventMutations) || sharedEvents ? undefined : Events.getExternalMutations(externalEventMutations, this.baseProps, this.state);
|
|
268
|
-
}
|
|
269
|
-
}, {
|
|
270
|
-
key: "cacheValues",
|
|
271
|
-
value: function cacheValues(obj) {
|
|
272
|
-
var _this7 = this;
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
}, {
|
|
153
|
+
key: "componentDidMount",
|
|
154
|
+
value: function componentDidMount() {
|
|
155
|
+
var _this2 = this;
|
|
156
|
+
|
|
157
|
+
var globalEventKeys = (0, _keys2.default)(this.globalEvents);
|
|
158
|
+
globalEventKeys.forEach(function (key) {
|
|
159
|
+
return _this2.addGlobalListener(key);
|
|
160
|
+
});
|
|
161
|
+
this.prevGlobalEventKeys = globalEventKeys;
|
|
162
|
+
}
|
|
163
|
+
}, {
|
|
164
|
+
key: "componentDidUpdate",
|
|
165
|
+
value: function componentDidUpdate(prevProps) {
|
|
166
|
+
var _this3 = this;
|
|
167
|
+
|
|
168
|
+
var calculatedState = this.getStateChanges(prevProps);
|
|
169
|
+
this.calculatedState = calculatedState;
|
|
170
|
+
var globalEventKeys = (0, _keys2.default)(this.globalEvents);
|
|
171
|
+
var removedGlobalEventKeys = (0, _difference2.default)(this.prevGlobalEventKeys, globalEventKeys);
|
|
172
|
+
removedGlobalEventKeys.forEach(function (key) {
|
|
173
|
+
return _this3.removeGlobalListener(key);
|
|
174
|
+
});
|
|
175
|
+
var addedGlobalEventKeys = (0, _difference2.default)(globalEventKeys, this.prevGlobalEventKeys);
|
|
176
|
+
addedGlobalEventKeys.forEach(function (key) {
|
|
177
|
+
return _this3.addGlobalListener(key);
|
|
178
|
+
});
|
|
179
|
+
this.prevGlobalEventKeys = globalEventKeys;
|
|
180
|
+
}
|
|
181
|
+
}, {
|
|
182
|
+
key: "componentWillUnmount",
|
|
183
|
+
value: function componentWillUnmount() {
|
|
184
|
+
var _this4 = this;
|
|
185
|
+
|
|
186
|
+
this.prevGlobalEventKeys.forEach(function (key) {
|
|
187
|
+
return _this4.removeGlobalListener(key);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}, {
|
|
191
|
+
key: "addGlobalListener",
|
|
192
|
+
value: function addGlobalListener(key) {
|
|
193
|
+
var _this5 = this;
|
|
194
|
+
|
|
195
|
+
var boundListener = function (event) {
|
|
196
|
+
var listener = _this5.globalEvents[key];
|
|
197
|
+
return listener && listener(Events.emulateReactEvent(event));
|
|
198
|
+
};
|
|
273
199
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
200
|
+
this.boundGlobalEvents[key] = boundListener;
|
|
201
|
+
window.addEventListener(Events.getGlobalEventNameFromKey(key), boundListener);
|
|
202
|
+
}
|
|
203
|
+
}, {
|
|
204
|
+
key: "removeGlobalListener",
|
|
205
|
+
value: function removeGlobalListener(key) {
|
|
206
|
+
window.removeEventListener(Events.getGlobalEventNameFromKey(key), this.boundGlobalEvents[key]);
|
|
207
|
+
} // compile all state changes from own and parent state. Order doesn't matter, as any state
|
|
208
|
+
// state change should trigger a re-render
|
|
209
|
+
|
|
210
|
+
}, {
|
|
211
|
+
key: "getStateChanges",
|
|
212
|
+
value: function getStateChanges(props) {
|
|
213
|
+
var _this6 = this;
|
|
214
|
+
|
|
215
|
+
if (!this.hasEvents) {
|
|
216
|
+
return {};
|
|
289
217
|
}
|
|
290
|
-
}, {
|
|
291
|
-
key: "getAllEvents",
|
|
292
|
-
value: function getAllEvents(props) {
|
|
293
|
-
if (Array.isArray(this.componentEvents)) {
|
|
294
|
-
var _componentEvents;
|
|
295
218
|
|
|
296
|
-
|
|
297
|
-
}
|
|
219
|
+
var getState = function (key, type) {
|
|
220
|
+
var result = (0, _defaults2.default)({}, _this6.getEventState(key, type), _this6.getSharedEventState(key, type));
|
|
221
|
+
return (0, _isEmpty2.default)(result) ? undefined : result;
|
|
222
|
+
};
|
|
298
223
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
var name = this.props.name || WrappedComponent.role;
|
|
305
|
-
var key = this.dataKeys && this.dataKeys[index] || index;
|
|
306
|
-
var id = "".concat(name, "-").concat(type, "-").concat(key);
|
|
307
|
-
var baseProps = this.baseProps[key] && this.baseProps[key][type] || this.baseProps[key];
|
|
308
|
-
|
|
309
|
-
if (!baseProps && !this.hasEvents) {
|
|
224
|
+
options = options || {};
|
|
225
|
+
var components = options.components || defaultComponents;
|
|
226
|
+
var stateChanges = components.map(function (component) {
|
|
227
|
+
if (!props.standalone && component.name === "parent") {
|
|
228
|
+
// don't check for changes on parent props for non-standalone components
|
|
310
229
|
return undefined;
|
|
230
|
+
} else {
|
|
231
|
+
return component.index !== undefined ? getState(component.index, component.name) : _this6.dataKeys.map(function (key) {
|
|
232
|
+
return getState(key, component.name);
|
|
233
|
+
}).filter(Boolean);
|
|
311
234
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
235
|
+
}).filter(Boolean);
|
|
236
|
+
return stateChanges;
|
|
237
|
+
}
|
|
238
|
+
}, {
|
|
239
|
+
key: "applyExternalMutations",
|
|
240
|
+
value: function applyExternalMutations(props, externalMutations) {
|
|
241
|
+
if (!(0, _isEmpty2.default)(externalMutations)) {
|
|
242
|
+
var callbacks = props.externalEventMutations.reduce(function (memo, mutation) {
|
|
243
|
+
memo = (0, _isFunction2.default)(mutation.callback) ? memo.concat(mutation.callback) : memo;
|
|
244
|
+
return memo;
|
|
245
|
+
}, []);
|
|
246
|
+
var compiledCallbacks = callbacks.length ? function () {
|
|
247
|
+
callbacks.forEach(function (c) {
|
|
248
|
+
return c();
|
|
324
249
|
});
|
|
325
|
-
}
|
|
250
|
+
} : undefined;
|
|
251
|
+
this.setState(externalMutations, compiledCallbacks);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}, {
|
|
255
|
+
key: "getCalculatedValues",
|
|
256
|
+
value: function getCalculatedValues(props) {
|
|
257
|
+
var sharedEvents = props.sharedEvents;
|
|
258
|
+
var components = WrappedComponent.expectedComponents;
|
|
259
|
+
var componentEvents = Events.getComponentEvents(props, components);
|
|
260
|
+
var getSharedEventState = sharedEvents && (0, _isFunction2.default)(sharedEvents.getEventState) ? sharedEvents.getEventState : function () {
|
|
261
|
+
return undefined;
|
|
262
|
+
};
|
|
263
|
+
var baseProps = this.getBaseProps(props, getSharedEventState);
|
|
264
|
+
var dataKeys = (0, _keys2.default)(baseProps).filter(function (key) {
|
|
265
|
+
return key !== "parent";
|
|
266
|
+
});
|
|
267
|
+
var hasEvents = props.events || props.sharedEvents || componentEvents;
|
|
268
|
+
var events = this.getAllEvents(props);
|
|
269
|
+
return {
|
|
270
|
+
componentEvents: componentEvents,
|
|
271
|
+
getSharedEventState: getSharedEventState,
|
|
272
|
+
baseProps: baseProps,
|
|
273
|
+
dataKeys: dataKeys,
|
|
274
|
+
hasEvents: hasEvents,
|
|
275
|
+
events: events
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
}, {
|
|
279
|
+
key: "getExternalMutations",
|
|
280
|
+
value: function getExternalMutations(props) {
|
|
281
|
+
var sharedEvents = props.sharedEvents,
|
|
282
|
+
externalEventMutations = props.externalEventMutations;
|
|
283
|
+
return (0, _isEmpty2.default)(externalEventMutations) || sharedEvents ? undefined : Events.getExternalMutations(externalEventMutations, this.baseProps, this.state);
|
|
284
|
+
}
|
|
285
|
+
}, {
|
|
286
|
+
key: "cacheValues",
|
|
287
|
+
value: function cacheValues(obj) {
|
|
288
|
+
var _this7 = this;
|
|
289
|
+
|
|
290
|
+
(0, _keys2.default)(obj).forEach(function (key) {
|
|
291
|
+
_this7[key] = obj[key];
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
}, {
|
|
295
|
+
key: "getBaseProps",
|
|
296
|
+
value: function getBaseProps(props, getSharedEventState) {
|
|
297
|
+
getSharedEventState = getSharedEventState || this.getSharedEventState;
|
|
298
|
+
var sharedParentState = getSharedEventState("parent", "parent");
|
|
299
|
+
var parentState = this.getEventState("parent", "parent");
|
|
300
|
+
var baseParentProps = (0, _defaults2.default)({}, parentState, sharedParentState);
|
|
301
|
+
var parentPropsList = baseParentProps.parentControlledProps;
|
|
302
|
+
var parentProps = parentPropsList ? (0, _pick2.default)(baseParentProps, parentPropsList) : {};
|
|
303
|
+
var modifiedProps = (0, _defaults2.default)({}, parentProps, props);
|
|
304
|
+
return (0, _isFunction2.default)(WrappedComponent.getBaseProps) ? WrappedComponent.getBaseProps(modifiedProps) : {};
|
|
305
|
+
}
|
|
306
|
+
}, {
|
|
307
|
+
key: "getAllEvents",
|
|
308
|
+
value: function getAllEvents(props) {
|
|
309
|
+
if (Array.isArray(this.componentEvents)) {
|
|
310
|
+
var _this$componentEvents;
|
|
326
311
|
|
|
327
|
-
return (
|
|
312
|
+
return Array.isArray(props.events) ? (_this$componentEvents = this.componentEvents).concat.apply(_this$componentEvents, _toConsumableArray(props.events)) : this.componentEvents;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return props.events;
|
|
316
|
+
}
|
|
317
|
+
}, {
|
|
318
|
+
key: "getComponentProps",
|
|
319
|
+
value: function getComponentProps(component, type, index) {
|
|
320
|
+
var name = this.props.name || WrappedComponent.role;
|
|
321
|
+
var key = this.dataKeys && this.dataKeys[index] || index;
|
|
322
|
+
var id = "".concat(name, "-").concat(type, "-").concat(key);
|
|
323
|
+
var baseProps = this.baseProps[key] && this.baseProps[key][type] || this.baseProps[key];
|
|
324
|
+
|
|
325
|
+
if (!baseProps && !this.hasEvents) {
|
|
326
|
+
return undefined;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
if (this.hasEvents) {
|
|
330
|
+
var baseEvents = this.getEvents(this.props, type, key);
|
|
331
|
+
var componentProps = (0, _defaults2.default)({
|
|
328
332
|
index: index,
|
|
329
333
|
key: id
|
|
330
|
-
}, component.props, baseProps, {
|
|
334
|
+
}, this.getEventState(key, type), this.getSharedEventState(key, type), component.props, baseProps, {
|
|
331
335
|
id: id
|
|
332
336
|
});
|
|
337
|
+
var events = (0, _defaults2.default)({}, Events.getPartialEvents(baseEvents, key, componentProps), componentProps.events);
|
|
338
|
+
return (0, _assign2.default)({}, componentProps, {
|
|
339
|
+
events: events
|
|
340
|
+
});
|
|
333
341
|
}
|
|
334
|
-
}, {
|
|
335
|
-
key: "renderContainer",
|
|
336
|
-
value: function renderContainer(component, children) {
|
|
337
|
-
var isContainer = component.type && component.type.role === "container";
|
|
338
|
-
var parentProps = isContainer ? this.getComponentProps(component, "parent", "parent") : {};
|
|
339
|
-
|
|
340
|
-
if (parentProps.events) {
|
|
341
|
-
this.globalEvents = Events.getGlobalEvents(parentProps.events);
|
|
342
|
-
parentProps.events = Events.omitGlobalEvents(parentProps.events);
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
return _react.default.cloneElement(component, parentProps, children);
|
|
346
|
-
}
|
|
347
|
-
}, {
|
|
348
|
-
key: "animateComponent",
|
|
349
|
-
value: function animateComponent(props, defaultAnimationWhitelist) {
|
|
350
|
-
var animationWhitelist = props.animate && props.animate.animationWhitelist ? props.animate.animationWhitelist : defaultAnimationWhitelist;
|
|
351
|
-
return _react.default.createElement(_victoryTransition.default, {
|
|
352
|
-
animate: props.animate,
|
|
353
|
-
animationWhitelist: animationWhitelist
|
|
354
|
-
}, _react.default.createElement(this.constructor, props));
|
|
355
|
-
} // Used by `VictoryLine` and `VictoryArea`
|
|
356
|
-
|
|
357
|
-
}, {
|
|
358
|
-
key: "renderContinuousData",
|
|
359
|
-
value: function renderContinuousData(props) {
|
|
360
|
-
var _this8 = this;
|
|
361
|
-
|
|
362
|
-
var dataComponent = props.dataComponent,
|
|
363
|
-
labelComponent = props.labelComponent,
|
|
364
|
-
groupComponent = props.groupComponent;
|
|
365
|
-
var dataKeys = (0, _without2.default)(this.dataKeys, "all");
|
|
366
|
-
var labelComponents = dataKeys.reduce(function (memo, key) {
|
|
367
|
-
var labelProps = _this8.getComponentProps(labelComponent, "labels", key);
|
|
368
|
-
|
|
369
|
-
if (labelProps && labelProps.text !== undefined && labelProps.text !== null) {
|
|
370
|
-
memo = memo.concat(_react.default.cloneElement(labelComponent, labelProps));
|
|
371
|
-
}
|
|
372
342
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
343
|
+
return (0, _defaults2.default)({
|
|
344
|
+
index: index,
|
|
345
|
+
key: id
|
|
346
|
+
}, component.props, baseProps, {
|
|
347
|
+
id: id
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
}, {
|
|
351
|
+
key: "renderContainer",
|
|
352
|
+
value: function renderContainer(component, children) {
|
|
353
|
+
var isContainer = component.type && component.type.role === "container";
|
|
354
|
+
var parentProps = isContainer ? this.getComponentProps(component, "parent", "parent") : {};
|
|
355
|
+
|
|
356
|
+
if (parentProps.events) {
|
|
357
|
+
this.globalEvents = Events.getGlobalEvents(parentProps.events);
|
|
358
|
+
parentProps.events = Events.omitGlobalEvents(parentProps.events);
|
|
378
359
|
}
|
|
379
|
-
}, {
|
|
380
|
-
key: "renderData",
|
|
381
|
-
value: function renderData(props) {
|
|
382
|
-
var _this9 = this;
|
|
383
|
-
|
|
384
|
-
var shouldRenderDatum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : datumHasXandY;
|
|
385
|
-
var dataComponent = props.dataComponent,
|
|
386
|
-
labelComponent = props.labelComponent,
|
|
387
|
-
groupComponent = props.groupComponent;
|
|
388
|
-
var userProps = UserProps.getSafeUserProps(props);
|
|
389
|
-
var dataComponents = this.dataKeys.reduce(function (validDataComponents, _dataKey, index) {
|
|
390
|
-
var dataProps = _this9.getComponentProps(dataComponent, "data", index);
|
|
391
|
-
|
|
392
|
-
if (shouldRenderDatum(dataProps.datum)) {
|
|
393
|
-
validDataComponents.push(_react.default.cloneElement(dataComponent, dataProps));
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
return validDataComponents;
|
|
397
|
-
}, []);
|
|
398
|
-
var labelComponents = this.dataKeys.map(function (_dataKey, index) {
|
|
399
|
-
var labelProps = _this9.getComponentProps(labelComponent, "labels", index);
|
|
400
360
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
361
|
+
return /*#__PURE__*/_react.default.cloneElement(component, parentProps, children);
|
|
362
|
+
}
|
|
363
|
+
}, {
|
|
364
|
+
key: "animateComponent",
|
|
365
|
+
value: function animateComponent(props, defaultAnimationWhitelist) {
|
|
366
|
+
var animationWhitelist = props.animate && props.animate.animationWhitelist ? props.animate.animationWhitelist : defaultAnimationWhitelist;
|
|
367
|
+
return /*#__PURE__*/_react.default.createElement(_victoryTransition.VictoryTransition, {
|
|
368
|
+
animate: props.animate,
|
|
369
|
+
animationWhitelist: animationWhitelist
|
|
370
|
+
}, /*#__PURE__*/_react.default.createElement(this.constructor, props));
|
|
371
|
+
} // Used by `VictoryLine` and `VictoryArea`
|
|
372
|
+
|
|
373
|
+
}, {
|
|
374
|
+
key: "renderContinuousData",
|
|
375
|
+
value: function renderContinuousData(props) {
|
|
376
|
+
var _this8 = this;
|
|
377
|
+
|
|
378
|
+
var dataComponent = props.dataComponent,
|
|
379
|
+
labelComponent = props.labelComponent,
|
|
380
|
+
groupComponent = props.groupComponent;
|
|
381
|
+
var dataKeys = (0, _without2.default)(this.dataKeys, "all");
|
|
382
|
+
var labelComponents = dataKeys.reduce(function (memo, key) {
|
|
383
|
+
var labelProps = _this8.getComponentProps(labelComponent, "labels", key);
|
|
384
|
+
|
|
385
|
+
if (labelProps && labelProps.text !== undefined && labelProps.text !== null) {
|
|
386
|
+
memo = memo.concat( /*#__PURE__*/_react.default.cloneElement(labelComponent, labelProps));
|
|
387
|
+
}
|
|
404
388
|
|
|
405
|
-
|
|
406
|
-
|
|
389
|
+
return memo;
|
|
390
|
+
}, []);
|
|
391
|
+
var dataProps = this.getComponentProps(dataComponent, "data", "all");
|
|
392
|
+
var children = [/*#__PURE__*/_react.default.cloneElement(dataComponent, dataProps)].concat(_toConsumableArray(labelComponents));
|
|
393
|
+
return this.renderContainer(groupComponent, children);
|
|
394
|
+
}
|
|
395
|
+
}, {
|
|
396
|
+
key: "renderData",
|
|
397
|
+
value: function renderData(props) {
|
|
398
|
+
var _this9 = this;
|
|
399
|
+
|
|
400
|
+
var shouldRenderDatum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : datumHasXandY;
|
|
401
|
+
var dataComponent = props.dataComponent,
|
|
402
|
+
labelComponent = props.labelComponent,
|
|
403
|
+
groupComponent = props.groupComponent;
|
|
404
|
+
var dataComponents = this.dataKeys.reduce(function (validDataComponents, _dataKey, index) {
|
|
405
|
+
var dataProps = _this9.getComponentProps(dataComponent, "data", index);
|
|
406
|
+
|
|
407
|
+
if (shouldRenderDatum(dataProps.datum)) {
|
|
408
|
+
validDataComponents.push( /*#__PURE__*/_react.default.cloneElement(dataComponent, dataProps));
|
|
409
|
+
}
|
|
407
410
|
|
|
408
|
-
|
|
411
|
+
return validDataComponents;
|
|
412
|
+
}, []);
|
|
413
|
+
var labelComponents = this.dataKeys.map(function (_dataKey, index) {
|
|
414
|
+
var labelProps = _this9.getComponentProps(labelComponent, "labels", index);
|
|
409
415
|
|
|
410
|
-
|
|
416
|
+
if (labelProps.text !== undefined && labelProps.text !== null) {
|
|
417
|
+
return /*#__PURE__*/_react.default.cloneElement(labelComponent, labelProps);
|
|
418
|
+
}
|
|
411
419
|
|
|
412
|
-
return
|
|
413
|
-
}
|
|
414
|
-
|
|
420
|
+
return undefined;
|
|
421
|
+
}).filter(Boolean);
|
|
422
|
+
var children = [].concat(_toConsumableArray(dataComponents), _toConsumableArray(labelComponents));
|
|
423
|
+
return this.renderContainer(groupComponent, children);
|
|
424
|
+
}
|
|
425
|
+
}]);
|
|
415
426
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
);
|
|
427
|
+
return addEvents;
|
|
428
|
+
}(WrappedComponent);
|
|
419
429
|
};
|
|
420
430
|
|
|
421
431
|
exports.default = _default;
|