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