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