victory-core 36.2.2 → 36.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/victory-core.js +14294 -14202
- package/dist/victory-core.min.js +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -0
- package/es/victory-accessible-group/victory-accessible-group.js +38 -40
- package/es/victory-animation/util.js +1 -1
- package/es/victory-animation/victory-animation.js +46 -48
- package/es/victory-clip-container/victory-clip-container.js +71 -73
- package/es/victory-container/victory-container.js +86 -94
- package/es/victory-label/victory-label.js +29 -24
- package/es/victory-portal/portal-context.js +1 -1
- package/es/victory-portal/portal.js +28 -26
- package/es/victory-portal/victory-portal.js +31 -41
- package/es/victory-primitives/arc.js +6 -4
- package/es/victory-primitives/background.js +8 -6
- package/es/victory-primitives/border.js +6 -4
- package/es/victory-primitives/circle.js +8 -4
- package/es/victory-primitives/clip-path.js +1 -1
- package/es/victory-primitives/line-segment.js +6 -4
- package/es/victory-primitives/line.js +8 -4
- package/es/victory-primitives/path.js +7 -3
- package/es/victory-primitives/point.js +6 -4
- package/es/victory-primitives/rect.js +8 -4
- package/es/victory-primitives/text.js +7 -3
- package/es/victory-primitives/tspan.js +1 -1
- package/es/victory-primitives/whisker.js +9 -7
- package/es/victory-transition/victory-transition.js +30 -32
- package/es/victory-util/add-events.js +327 -315
- package/es/victory-util/axis.js +12 -5
- package/es/victory-util/collection.js +8 -4
- package/es/victory-util/data.js +9 -5
- package/es/victory-util/domain.js +8 -4
- package/es/victory-util/events.js +8 -4
- package/es/victory-util/helpers.js +1 -1
- package/es/victory-util/hooks/use-animation-state.js +11 -5
- package/es/victory-util/line-helpers.js +1 -1
- package/es/victory-util/scale.js +19 -19
- package/es/victory-util/textsize.js +11 -7
- package/es/victory-util/timer-context.js +1 -1
- package/es/victory-util/timer.js +3 -5
- package/es/victory-util/user-props.js +110 -0
- package/es/victory-util/wrapper.js +18 -12
- package/lib/index.d.ts +1 -0
- package/lib/index.js +72 -58
- package/lib/victory-accessible-group/victory-accessible-group.js +38 -40
- package/lib/victory-animation/util.js +2 -2
- package/lib/victory-animation/victory-animation.js +49 -49
- package/lib/victory-clip-container/victory-clip-container.js +74 -74
- package/lib/victory-container/victory-container.js +90 -95
- package/lib/victory-label/victory-label.js +35 -27
- package/lib/victory-portal/portal-context.js +1 -1
- package/lib/victory-portal/portal.js +31 -27
- package/lib/victory-portal/victory-portal.js +34 -42
- package/lib/victory-primitives/arc.js +9 -5
- package/lib/victory-primitives/background.js +11 -7
- package/lib/victory-primitives/border.js +9 -5
- package/lib/victory-primitives/circle.js +8 -4
- package/lib/victory-primitives/clip-path.js +1 -1
- package/lib/victory-primitives/line-segment.js +9 -5
- package/lib/victory-primitives/line.js +8 -4
- package/lib/victory-primitives/path.js +7 -3
- package/lib/victory-primitives/point.js +9 -5
- package/lib/victory-primitives/rect.js +8 -4
- package/lib/victory-primitives/text.js +7 -3
- package/lib/victory-primitives/tspan.js +1 -1
- package/lib/victory-primitives/whisker.js +12 -8
- package/lib/victory-transition/victory-transition.js +33 -33
- package/lib/victory-util/add-events.js +328 -311
- package/lib/victory-util/axis.js +20 -11
- package/lib/victory-util/collection.js +11 -7
- package/lib/victory-util/common-props.js +4 -2
- package/lib/victory-util/data.js +13 -7
- package/lib/victory-util/default-transitions.js +1 -1
- package/lib/victory-util/domain.js +11 -5
- package/lib/victory-util/events.js +17 -11
- package/lib/victory-util/helpers.js +14 -14
- 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 -3
- package/lib/victory-util/label-helpers.js +6 -4
- package/lib/victory-util/line-helpers.js +4 -2
- package/lib/victory-util/prop-types.js +5 -3
- package/lib/victory-util/scale.js +24 -21
- package/lib/victory-util/selection.js +6 -4
- package/lib/victory-util/textsize.js +12 -8
- package/lib/victory-util/timer-context.js +1 -1
- package/lib/victory-util/timer.js +3 -5
- package/lib/victory-util/user-props.js +119 -0
- package/lib/victory-util/wrapper.js +31 -23
- package/package.json +4 -11
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/victory-animation/util.js +1 -1
- package/src/victory-animation/victory-animation.js +1 -1
- package/src/victory-container/victory-container.js +7 -1
- package/src/victory-label/victory-label.js +6 -6
- package/src/victory-util/add-events.js +6 -2
- package/src/victory-util/axis.js +3 -0
- package/src/victory-util/line-helpers.js +1 -1
- package/src/victory-util/scale.js +18 -9
- package/src/victory-util/timer.js +1 -1
- package/src/victory-util/user-props.js +81 -0
|
@@ -6,21 +6,31 @@ import _assign from "lodash/assign";
|
|
|
6
6
|
|
|
7
7
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
8
8
|
|
|
9
|
-
function
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
10
|
|
|
11
|
-
function
|
|
11
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
12
|
|
|
13
13
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
14
14
|
|
|
15
15
|
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); } }
|
|
16
16
|
|
|
17
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
17
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
18
|
+
|
|
19
|
+
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); }
|
|
20
|
+
|
|
21
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
22
|
+
|
|
23
|
+
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); }; }
|
|
18
24
|
|
|
19
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
25
|
+
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); }
|
|
20
26
|
|
|
21
27
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
22
28
|
|
|
23
|
-
function
|
|
29
|
+
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; } }
|
|
30
|
+
|
|
31
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
32
|
+
|
|
33
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
24
34
|
|
|
25
35
|
import React from "react";
|
|
26
36
|
import PropTypes from "prop-types";
|
|
@@ -29,18 +39,19 @@ import Portal from "../victory-portal/portal";
|
|
|
29
39
|
import PortalContext from "../victory-portal/portal-context";
|
|
30
40
|
import TimerContext from "../victory-util/timer-context";
|
|
31
41
|
import * as Helpers from "../victory-util/helpers";
|
|
42
|
+
import * as UserProps from "../victory-util/user-props";
|
|
32
43
|
|
|
33
|
-
var VictoryContainer =
|
|
34
|
-
/*#__PURE__*/
|
|
35
|
-
function (_React$Component) {
|
|
44
|
+
var VictoryContainer = /*#__PURE__*/function (_React$Component) {
|
|
36
45
|
_inherits(VictoryContainer, _React$Component);
|
|
37
46
|
|
|
47
|
+
var _super = _createSuper(VictoryContainer);
|
|
48
|
+
|
|
38
49
|
function VictoryContainer(props) {
|
|
39
50
|
var _this;
|
|
40
51
|
|
|
41
52
|
_classCallCheck(this, VictoryContainer);
|
|
42
53
|
|
|
43
|
-
_this =
|
|
54
|
+
_this = _super.call(this, props);
|
|
44
55
|
_this.containerId = !_isObject(props) || props.containerId === undefined ? _uniqueId("victory-container-") : props.containerId;
|
|
45
56
|
|
|
46
57
|
_this.savePortalRef = function (portal) {
|
|
@@ -108,11 +119,11 @@ function (_React$Component) {
|
|
|
108
119
|
var ouiaId = props.ouiaId,
|
|
109
120
|
ouiaSafe = props.ouiaSafe,
|
|
110
121
|
ouiaType = props.ouiaType;
|
|
111
|
-
return _objectSpread({}, ouiaId && {
|
|
122
|
+
return _objectSpread(_objectSpread(_objectSpread({}, ouiaId && {
|
|
112
123
|
"data-ouia-component-id": ouiaId
|
|
113
|
-
}, ouiaType && {
|
|
124
|
+
}), ouiaType && {
|
|
114
125
|
"data-ouia-component-type": ouiaType
|
|
115
|
-
}, ouiaSafe !== undefined && {
|
|
126
|
+
}), ouiaSafe !== undefined && {
|
|
116
127
|
"data-ouia-safe": ouiaSafe
|
|
117
128
|
});
|
|
118
129
|
}
|
|
@@ -164,44 +175,45 @@ function (_React$Component) {
|
|
|
164
175
|
preserveAspectRatio: svgProps.preserveAspectRatio,
|
|
165
176
|
style: portalSvgStyle
|
|
166
177
|
};
|
|
167
|
-
return React.createElement(PortalContext.Provider, {
|
|
178
|
+
return /*#__PURE__*/React.createElement(PortalContext.Provider, {
|
|
168
179
|
value: {
|
|
169
180
|
portalUpdate: this.portalUpdate,
|
|
170
181
|
portalRegister: this.portalRegister,
|
|
171
182
|
portalDeregister: this.portalDeregister
|
|
172
183
|
}
|
|
173
|
-
}, React.createElement("div", _extends({
|
|
184
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
174
185
|
style: _defaults({}, style, divStyle),
|
|
175
186
|
className: className,
|
|
176
187
|
ref: this.saveContainerRef
|
|
177
|
-
}, this.getOUIAProps(props)), React.createElement("svg", _extends({}, svgProps, {
|
|
188
|
+
}, this.getOUIAProps(props)), /*#__PURE__*/React.createElement("svg", _extends({}, svgProps, {
|
|
178
189
|
style: svgStyle
|
|
179
|
-
}), title ? React.createElement("title", {
|
|
190
|
+
}), title ? /*#__PURE__*/React.createElement("title", {
|
|
180
191
|
id: this.getIdForElement("title")
|
|
181
|
-
}, title) : null, desc ? React.createElement("desc", {
|
|
192
|
+
}, title) : null, desc ? /*#__PURE__*/React.createElement("desc", {
|
|
182
193
|
id: this.getIdForElement("desc")
|
|
183
|
-
}, desc) : null, children), React.createElement("div", {
|
|
194
|
+
}, desc) : null, children), /*#__PURE__*/React.createElement("div", {
|
|
184
195
|
style: portalDivStyle
|
|
185
|
-
}, React.cloneElement(portalComponent, _objectSpread({}, portalProps, {
|
|
196
|
+
}, /*#__PURE__*/React.cloneElement(portalComponent, _objectSpread(_objectSpread({}, portalProps), {}, {
|
|
186
197
|
ref: this.savePortalRef
|
|
187
198
|
})))));
|
|
188
199
|
}
|
|
189
200
|
}, {
|
|
190
201
|
key: "render",
|
|
191
202
|
value: function render() {
|
|
192
|
-
var
|
|
193
|
-
width =
|
|
194
|
-
height =
|
|
195
|
-
responsive =
|
|
196
|
-
events =
|
|
197
|
-
title =
|
|
198
|
-
desc =
|
|
199
|
-
tabIndex =
|
|
200
|
-
preserveAspectRatio =
|
|
201
|
-
role =
|
|
203
|
+
var _this$props = this.props,
|
|
204
|
+
width = _this$props.width,
|
|
205
|
+
height = _this$props.height,
|
|
206
|
+
responsive = _this$props.responsive,
|
|
207
|
+
events = _this$props.events,
|
|
208
|
+
title = _this$props.title,
|
|
209
|
+
desc = _this$props.desc,
|
|
210
|
+
tabIndex = _this$props.tabIndex,
|
|
211
|
+
preserveAspectRatio = _this$props.preserveAspectRatio,
|
|
212
|
+
role = _this$props.role;
|
|
202
213
|
var style = responsive ? this.props.style : Helpers.omit(this.props.style, ["height", "width"]);
|
|
214
|
+
var userProps = UserProps.getSafeUserProps(this.props);
|
|
203
215
|
|
|
204
|
-
var svgProps = _assign({
|
|
216
|
+
var svgProps = _assign(_objectSpread({
|
|
205
217
|
width: width,
|
|
206
218
|
height: height,
|
|
207
219
|
tabIndex: tabIndex,
|
|
@@ -210,7 +222,7 @@ function (_React$Component) {
|
|
|
210
222
|
"aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
|
|
211
223
|
viewBox: responsive ? "0 0 ".concat(width, " ").concat(height) : undefined,
|
|
212
224
|
preserveAspectRatio: responsive ? preserveAspectRatio : undefined
|
|
213
|
-
}, events);
|
|
225
|
+
}, userProps), events);
|
|
214
226
|
|
|
215
227
|
return this.renderContainer(this.props, svgProps, style);
|
|
216
228
|
}
|
|
@@ -219,69 +231,49 @@ function (_React$Component) {
|
|
|
219
231
|
return VictoryContainer;
|
|
220
232
|
}(React.Component);
|
|
221
233
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
234
|
+
_defineProperty(VictoryContainer, "displayName", "VictoryContainer");
|
|
235
|
+
|
|
236
|
+
_defineProperty(VictoryContainer, "role", "container");
|
|
237
|
+
|
|
238
|
+
_defineProperty(VictoryContainer, "propTypes", {
|
|
239
|
+
"aria-describedby": PropTypes.string,
|
|
240
|
+
"aria-labelledby": PropTypes.string,
|
|
241
|
+
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
|
242
|
+
className: PropTypes.string,
|
|
243
|
+
containerId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
244
|
+
containerRef: PropTypes.func,
|
|
245
|
+
desc: PropTypes.string,
|
|
246
|
+
events: PropTypes.object,
|
|
247
|
+
height: CustomPropTypes.nonNegative,
|
|
248
|
+
name: PropTypes.string,
|
|
249
|
+
origin: PropTypes.shape({
|
|
250
|
+
x: CustomPropTypes.nonNegative,
|
|
251
|
+
y: CustomPropTypes.nonNegative
|
|
252
|
+
}),
|
|
253
|
+
ouiaId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
254
|
+
ouiaSafe: PropTypes.bool,
|
|
255
|
+
ouiaType: PropTypes.string,
|
|
256
|
+
polar: PropTypes.bool,
|
|
257
|
+
portalComponent: PropTypes.element,
|
|
258
|
+
portalZIndex: CustomPropTypes.integer,
|
|
259
|
+
preserveAspectRatio: PropTypes.string,
|
|
260
|
+
responsive: PropTypes.bool,
|
|
261
|
+
role: PropTypes.string,
|
|
262
|
+
style: PropTypes.object,
|
|
263
|
+
tabIndex: PropTypes.number,
|
|
264
|
+
theme: PropTypes.object,
|
|
265
|
+
title: PropTypes.string,
|
|
266
|
+
width: CustomPropTypes.nonNegative
|
|
227
267
|
});
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
configurable: true,
|
|
236
|
-
enumerable: true,
|
|
237
|
-
writable: true,
|
|
238
|
-
value: {
|
|
239
|
-
"aria-describedby": PropTypes.string,
|
|
240
|
-
"aria-labelledby": PropTypes.string,
|
|
241
|
-
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
|
242
|
-
className: PropTypes.string,
|
|
243
|
-
containerId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
244
|
-
containerRef: PropTypes.func,
|
|
245
|
-
desc: PropTypes.string,
|
|
246
|
-
events: PropTypes.object,
|
|
247
|
-
height: CustomPropTypes.nonNegative,
|
|
248
|
-
name: PropTypes.string,
|
|
249
|
-
origin: PropTypes.shape({
|
|
250
|
-
x: CustomPropTypes.nonNegative,
|
|
251
|
-
y: CustomPropTypes.nonNegative
|
|
252
|
-
}),
|
|
253
|
-
ouiaId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
254
|
-
ouiaSafe: PropTypes.bool,
|
|
255
|
-
ouiaType: PropTypes.string,
|
|
256
|
-
polar: PropTypes.bool,
|
|
257
|
-
portalComponent: PropTypes.element,
|
|
258
|
-
portalZIndex: CustomPropTypes.integer,
|
|
259
|
-
preserveAspectRatio: PropTypes.string,
|
|
260
|
-
responsive: PropTypes.bool,
|
|
261
|
-
role: PropTypes.string,
|
|
262
|
-
style: PropTypes.object,
|
|
263
|
-
tabIndex: PropTypes.number,
|
|
264
|
-
theme: PropTypes.object,
|
|
265
|
-
title: PropTypes.string,
|
|
266
|
-
width: CustomPropTypes.nonNegative
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
Object.defineProperty(VictoryContainer, "defaultProps", {
|
|
270
|
-
configurable: true,
|
|
271
|
-
enumerable: true,
|
|
272
|
-
writable: true,
|
|
273
|
-
value: {
|
|
274
|
-
className: "VictoryContainer",
|
|
275
|
-
portalComponent: React.createElement(Portal, null),
|
|
276
|
-
portalZIndex: 99,
|
|
277
|
-
responsive: true,
|
|
278
|
-
role: "img"
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
Object.defineProperty(VictoryContainer, "contextType", {
|
|
282
|
-
configurable: true,
|
|
283
|
-
enumerable: true,
|
|
284
|
-
writable: true,
|
|
285
|
-
value: TimerContext
|
|
268
|
+
|
|
269
|
+
_defineProperty(VictoryContainer, "defaultProps", {
|
|
270
|
+
className: "VictoryContainer",
|
|
271
|
+
portalComponent: /*#__PURE__*/React.createElement(Portal, null),
|
|
272
|
+
portalZIndex: 99,
|
|
273
|
+
responsive: true,
|
|
274
|
+
role: "img"
|
|
286
275
|
});
|
|
276
|
+
|
|
277
|
+
_defineProperty(VictoryContainer, "contextType", TimerContext);
|
|
278
|
+
|
|
287
279
|
export { VictoryContainer as default };
|
|
@@ -2,31 +2,36 @@ import _isEmpty from "lodash/isEmpty";
|
|
|
2
2
|
import _defaults from "lodash/defaults";
|
|
3
3
|
import _assign from "lodash/assign";
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
|
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
8
|
|
|
7
9
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
10
|
|
|
9
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
11
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
10
12
|
|
|
11
|
-
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."); }
|
|
12
14
|
|
|
13
|
-
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); }
|
|
14
16
|
|
|
15
|
-
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; }
|
|
16
22
|
|
|
17
|
-
/*eslint no-magic-numbers: ["error", { "ignore": [-0.5, 0.5, 0, 1, 2] }]*/
|
|
18
|
-
import React from "react";
|
|
19
23
|
import PropTypes from "prop-types";
|
|
24
|
+
import React from "react";
|
|
20
25
|
import VictoryPortal from "../victory-portal/victory-portal";
|
|
21
26
|
import Rect from "../victory-primitives/rect";
|
|
22
|
-
import
|
|
27
|
+
import Text from "../victory-primitives/text";
|
|
28
|
+
import TSpan from "../victory-primitives/tspan";
|
|
23
29
|
import * as Helpers from "../victory-util/helpers";
|
|
24
30
|
import * as LabelHelpers from "../victory-util/label-helpers";
|
|
25
|
-
import * as Style from "../victory-util/style";
|
|
26
31
|
import * as Log from "../victory-util/log";
|
|
32
|
+
import * as CustomPropTypes from "../victory-util/prop-types";
|
|
33
|
+
import * as Style from "../victory-util/style";
|
|
27
34
|
import * as TextSize from "../victory-util/textsize";
|
|
28
|
-
import TSpan from "../victory-primitives/tspan";
|
|
29
|
-
import Text from "../victory-primitives/text";
|
|
30
35
|
var defaultStyles = {
|
|
31
36
|
fill: "#252525",
|
|
32
37
|
fontSize: 14,
|
|
@@ -274,7 +279,7 @@ var getFullBackground = function (calculatedProps, tspanValues) {
|
|
|
274
279
|
x: inline ? xCoordinate - backgroundPadding.left : xCoordinate + dx - backgroundPadding.left,
|
|
275
280
|
y: yCoordinate
|
|
276
281
|
};
|
|
277
|
-
return React.cloneElement(backgroundComponent, _defaults({}, backgroundComponent.props, backgroundProps));
|
|
282
|
+
return /*#__PURE__*/React.cloneElement(backgroundComponent, _defaults({}, backgroundComponent.props, backgroundProps));
|
|
278
283
|
};
|
|
279
284
|
|
|
280
285
|
var getInlineXOffset = function (calculatedProps, textElements, index) {
|
|
@@ -356,7 +361,7 @@ var getChildBackgrounds = function (calculatedProps, tspanValues) {
|
|
|
356
361
|
x: xCoord - padding.left,
|
|
357
362
|
y: yCoord
|
|
358
363
|
};
|
|
359
|
-
return React.cloneElement(backgroundComponent, _defaults({}, backgroundComponent.props, backgroundProps));
|
|
364
|
+
return /*#__PURE__*/React.cloneElement(backgroundComponent, _defaults({}, backgroundComponent.props, backgroundProps));
|
|
360
365
|
});
|
|
361
366
|
};
|
|
362
367
|
|
|
@@ -464,10 +469,10 @@ var renderLabel = function (calculatedProps, tspanValues) {
|
|
|
464
469
|
tspanComponent = calculatedProps.tspanComponent,
|
|
465
470
|
textComponent = calculatedProps.textComponent;
|
|
466
471
|
|
|
467
|
-
var textProps = _objectSpread({
|
|
472
|
+
var textProps = _objectSpread(_objectSpread({
|
|
468
473
|
"aria-label": ariaLabel,
|
|
469
474
|
key: "text"
|
|
470
|
-
}, events, {
|
|
475
|
+
}, events), {}, {
|
|
471
476
|
direction: direction,
|
|
472
477
|
dx: dx,
|
|
473
478
|
x: x,
|
|
@@ -491,9 +496,9 @@ var renderLabel = function (calculatedProps, tspanValues) {
|
|
|
491
496
|
style: currentStyle,
|
|
492
497
|
children: line
|
|
493
498
|
};
|
|
494
|
-
return React.cloneElement(tspanComponent, tspanProps);
|
|
499
|
+
return /*#__PURE__*/React.cloneElement(tspanComponent, tspanProps);
|
|
495
500
|
});
|
|
496
|
-
return React.cloneElement(textComponent, textProps, tspans);
|
|
501
|
+
return /*#__PURE__*/React.cloneElement(textComponent, textProps, tspans);
|
|
497
502
|
};
|
|
498
503
|
|
|
499
504
|
var VictoryLabel = function (props) {
|
|
@@ -528,11 +533,11 @@ var VictoryLabel = function (props) {
|
|
|
528
533
|
if (props.backgroundStyle) {
|
|
529
534
|
var backgroundElement = getBackgroundElement(calculatedProps, tspanValues);
|
|
530
535
|
var children = [backgroundElement, label];
|
|
531
|
-
var backgroundWithLabel = React.cloneElement(props.groupComponent, {}, children);
|
|
532
|
-
return props.renderInPortal ? React.createElement(VictoryPortal, null, backgroundWithLabel) : backgroundWithLabel;
|
|
536
|
+
var backgroundWithLabel = /*#__PURE__*/React.cloneElement(props.groupComponent, {}, children);
|
|
537
|
+
return props.renderInPortal ? /*#__PURE__*/React.createElement(VictoryPortal, null, backgroundWithLabel) : backgroundWithLabel;
|
|
533
538
|
}
|
|
534
539
|
|
|
535
|
-
return props.renderInPortal ? React.createElement(VictoryPortal, null, label) : label;
|
|
540
|
+
return props.renderInPortal ? /*#__PURE__*/React.createElement(VictoryPortal, null, label) : label;
|
|
536
541
|
};
|
|
537
542
|
|
|
538
543
|
VictoryLabel.displayName = "VictoryLabel";
|
|
@@ -583,11 +588,11 @@ VictoryLabel.propTypes = {
|
|
|
583
588
|
y: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
584
589
|
};
|
|
585
590
|
VictoryLabel.defaultProps = {
|
|
586
|
-
backgroundComponent: React.createElement(Rect, null),
|
|
587
|
-
groupComponent: React.createElement("g", null),
|
|
591
|
+
backgroundComponent: /*#__PURE__*/React.createElement(Rect, null),
|
|
592
|
+
groupComponent: /*#__PURE__*/React.createElement("g", null),
|
|
588
593
|
direction: "inherit",
|
|
589
|
-
textComponent: React.createElement(Text, null),
|
|
590
|
-
tspanComponent: React.createElement(TSpan, null),
|
|
594
|
+
textComponent: /*#__PURE__*/React.createElement(Text, null),
|
|
595
|
+
tspanComponent: /*#__PURE__*/React.createElement(TSpan, null),
|
|
591
596
|
capHeight: 0.71,
|
|
592
597
|
// Magic number from d3.
|
|
593
598
|
lineHeight: 1
|
|
@@ -4,29 +4,39 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
4
4
|
|
|
5
5
|
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); } }
|
|
6
6
|
|
|
7
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
8
|
|
|
9
|
-
function
|
|
9
|
+
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); }
|
|
10
10
|
|
|
11
|
-
function
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
+
|
|
13
|
+
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); }; }
|
|
14
|
+
|
|
15
|
+
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
12
16
|
|
|
13
17
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
14
18
|
|
|
19
|
+
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; } }
|
|
20
|
+
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
+
|
|
23
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
24
|
+
|
|
15
25
|
import React from "react";
|
|
16
26
|
import PropTypes from "prop-types";
|
|
17
27
|
import * as CustomPropTypes from "../victory-util/prop-types";
|
|
18
28
|
|
|
19
|
-
var Portal =
|
|
20
|
-
/*#__PURE__*/
|
|
21
|
-
function (_React$Component) {
|
|
29
|
+
var Portal = /*#__PURE__*/function (_React$Component) {
|
|
22
30
|
_inherits(Portal, _React$Component);
|
|
23
31
|
|
|
32
|
+
var _super = _createSuper(Portal);
|
|
33
|
+
|
|
24
34
|
function Portal(props) {
|
|
25
35
|
var _this;
|
|
26
36
|
|
|
27
37
|
_classCallCheck(this, Portal);
|
|
28
38
|
|
|
29
|
-
_this =
|
|
39
|
+
_this = _super.call(this, props);
|
|
30
40
|
_this.map = {};
|
|
31
41
|
_this.index = 1;
|
|
32
42
|
_this.portalUpdate = _this.portalUpdate.bind(_assertThisInitialized(_this));
|
|
@@ -59,7 +69,7 @@ function (_React$Component) {
|
|
|
59
69
|
|
|
60
70
|
return _keys(this.map).map(function (key) {
|
|
61
71
|
var el = _this2.map[key];
|
|
62
|
-
return el ? React.cloneElement(el, {
|
|
72
|
+
return el ? /*#__PURE__*/React.cloneElement(el, {
|
|
63
73
|
key: key
|
|
64
74
|
}) : el;
|
|
65
75
|
});
|
|
@@ -68,29 +78,21 @@ function (_React$Component) {
|
|
|
68
78
|
}, {
|
|
69
79
|
key: "render",
|
|
70
80
|
value: function render() {
|
|
71
|
-
return React.createElement("svg", this.props, this.getChildren());
|
|
81
|
+
return /*#__PURE__*/React.createElement("svg", this.props, this.getChildren());
|
|
72
82
|
}
|
|
73
83
|
}]);
|
|
74
84
|
|
|
75
85
|
return Portal;
|
|
76
86
|
}(React.Component);
|
|
77
87
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
enumerable: true,
|
|
87
|
-
writable: true,
|
|
88
|
-
value: {
|
|
89
|
-
className: PropTypes.string,
|
|
90
|
-
height: CustomPropTypes.nonNegative,
|
|
91
|
-
style: PropTypes.object,
|
|
92
|
-
viewBox: PropTypes.string,
|
|
93
|
-
width: CustomPropTypes.nonNegative
|
|
94
|
-
}
|
|
88
|
+
_defineProperty(Portal, "displayName", "Portal");
|
|
89
|
+
|
|
90
|
+
_defineProperty(Portal, "propTypes", {
|
|
91
|
+
className: PropTypes.string,
|
|
92
|
+
height: CustomPropTypes.nonNegative,
|
|
93
|
+
style: PropTypes.object,
|
|
94
|
+
viewBox: PropTypes.string,
|
|
95
|
+
width: CustomPropTypes.nonNegative
|
|
95
96
|
});
|
|
97
|
+
|
|
96
98
|
export { Portal as default };
|
|
@@ -4,13 +4,23 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
4
4
|
|
|
5
5
|
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); } }
|
|
6
6
|
|
|
7
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
8
|
|
|
9
|
-
function
|
|
9
|
+
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); }
|
|
10
|
+
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
+
|
|
13
|
+
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); }; }
|
|
14
|
+
|
|
15
|
+
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); }
|
|
10
16
|
|
|
11
17
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
12
18
|
|
|
13
|
-
function
|
|
19
|
+
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; } }
|
|
20
|
+
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
+
|
|
23
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
24
|
|
|
15
25
|
import React from "react";
|
|
16
26
|
import PropTypes from "prop-types";
|
|
@@ -18,15 +28,15 @@ import * as Log from "../victory-util/log";
|
|
|
18
28
|
import * as Helpers from "../victory-util/helpers";
|
|
19
29
|
import PortalContext from "./portal-context";
|
|
20
30
|
|
|
21
|
-
var VictoryPortal =
|
|
22
|
-
/*#__PURE__*/
|
|
23
|
-
function (_React$Component) {
|
|
31
|
+
var VictoryPortal = /*#__PURE__*/function (_React$Component) {
|
|
24
32
|
_inherits(VictoryPortal, _React$Component);
|
|
25
33
|
|
|
34
|
+
var _super = _createSuper(VictoryPortal);
|
|
35
|
+
|
|
26
36
|
function VictoryPortal() {
|
|
27
37
|
_classCallCheck(this, VictoryPortal);
|
|
28
38
|
|
|
29
|
-
return
|
|
39
|
+
return _super.apply(this, arguments);
|
|
30
40
|
}
|
|
31
41
|
|
|
32
42
|
_createClass(VictoryPortal, [{
|
|
@@ -83,7 +93,7 @@ function (_React$Component) {
|
|
|
83
93
|
|
|
84
94
|
var newProps = _defaults(standardProps, childProps, Helpers.omit(this.props, ["children", "groupComponent"]));
|
|
85
95
|
|
|
86
|
-
var child = children && React.cloneElement(children, newProps);
|
|
96
|
+
var child = children && /*#__PURE__*/React.cloneElement(children, newProps);
|
|
87
97
|
return this.renderPortal(child);
|
|
88
98
|
}
|
|
89
99
|
}]);
|
|
@@ -91,39 +101,19 @@ function (_React$Component) {
|
|
|
91
101
|
return VictoryPortal;
|
|
92
102
|
}(React.Component);
|
|
93
103
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
configurable: true,
|
|
102
|
-
enumerable: true,
|
|
103
|
-
writable: true,
|
|
104
|
-
value: "portal"
|
|
105
|
-
});
|
|
106
|
-
Object.defineProperty(VictoryPortal, "propTypes", {
|
|
107
|
-
configurable: true,
|
|
108
|
-
enumerable: true,
|
|
109
|
-
writable: true,
|
|
110
|
-
value: {
|
|
111
|
-
children: PropTypes.node,
|
|
112
|
-
groupComponent: PropTypes.element
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
Object.defineProperty(VictoryPortal, "defaultProps", {
|
|
116
|
-
configurable: true,
|
|
117
|
-
enumerable: true,
|
|
118
|
-
writable: true,
|
|
119
|
-
value: {
|
|
120
|
-
groupComponent: React.createElement("g", null)
|
|
121
|
-
}
|
|
104
|
+
_defineProperty(VictoryPortal, "displayName", "VictoryPortal");
|
|
105
|
+
|
|
106
|
+
_defineProperty(VictoryPortal, "role", "portal");
|
|
107
|
+
|
|
108
|
+
_defineProperty(VictoryPortal, "propTypes", {
|
|
109
|
+
children: PropTypes.node,
|
|
110
|
+
groupComponent: PropTypes.element
|
|
122
111
|
});
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
writable: true,
|
|
127
|
-
value: PortalContext
|
|
112
|
+
|
|
113
|
+
_defineProperty(VictoryPortal, "defaultProps", {
|
|
114
|
+
groupComponent: /*#__PURE__*/React.createElement("g", null)
|
|
128
115
|
});
|
|
116
|
+
|
|
117
|
+
_defineProperty(VictoryPortal, "contextType", PortalContext);
|
|
118
|
+
|
|
129
119
|
export { VictoryPortal as default };
|