victory-core 37.3.2 → 37.3.3
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/CHANGELOG.md +14 -0
- package/dist/victory-core.js +423 -371
- package/dist/victory-core.min.js +1 -1
- package/es/types/callbacks.d.ts +11 -11
- package/es/types/prop-types.d.ts +28 -28
- package/es/victory-animation/util.js +6 -6
- package/es/victory-animation/victory-animation.d.ts +3 -3
- package/es/victory-clip-container/victory-clip-container.d.ts +6 -1
- package/es/victory-clip-container/victory-clip-container.js +20 -12
- package/es/victory-container/victory-container.js +2 -2
- package/es/victory-label/victory-label.d.ts +3 -3
- package/es/victory-label/victory-label.js +12 -16
- package/es/victory-portal/victory-portal.js +4 -4
- package/es/victory-primitives/arc.js +2 -2
- package/es/victory-primitives/background.js +2 -2
- package/es/victory-primitives/border.js +2 -2
- package/es/victory-primitives/line-segment.js +2 -2
- package/es/victory-primitives/point.js +2 -2
- package/es/victory-primitives/tspan.d.ts +0 -1
- package/es/victory-primitives/types.d.ts +1 -1
- package/es/victory-primitives/whisker.d.ts +1 -1
- package/es/victory-primitives/whisker.js +2 -2
- package/es/victory-theme/types.d.ts +11 -11
- package/es/victory-transition/victory-transition.d.ts +1 -1
- package/es/victory-transition/victory-transition.js +7 -7
- package/es/victory-util/add-events.d.ts +8 -8
- package/es/victory-util/add-events.js +13 -13
- package/es/victory-util/axis.js +11 -11
- package/es/victory-util/data.js +16 -16
- package/es/victory-util/domain.js +13 -13
- package/es/victory-util/events.d.ts +4 -4
- package/es/victory-util/events.js +14 -14
- package/es/victory-util/helpers.d.ts +94 -19
- package/es/victory-util/helpers.js +95 -49
- package/es/victory-util/hooks/use-animation-state.d.ts +2 -2
- package/es/victory-util/hooks/use-animation-state.js +4 -4
- package/es/victory-util/label-helpers.d.ts +4 -3
- package/es/victory-util/label-helpers.js +3 -2
- package/es/victory-util/line-helpers.d.ts +1 -1
- package/es/victory-util/log.js +3 -2
- package/es/victory-util/merge-refs.d.ts +1 -1
- package/es/victory-util/scale.js +2 -2
- package/es/victory-util/selection.d.ts +3 -3
- package/es/victory-util/textsize.js +7 -5
- package/es/victory-util/timer.d.ts +1 -1
- package/es/victory-util/transitions.d.ts +1 -1
- package/es/victory-util/transitions.js +12 -12
- package/es/victory-util/type-helpers.d.ts +0 -1
- package/es/victory-util/type-helpers.js +0 -5
- package/es/victory-util/user-props.d.ts +2 -2
- package/es/victory-util/wrapper.js +12 -12
- package/lib/types/callbacks.d.ts +11 -11
- package/lib/types/prop-types.d.ts +28 -28
- package/lib/victory-animation/util.js +6 -6
- package/lib/victory-animation/victory-animation.d.ts +3 -3
- package/lib/victory-clip-container/victory-clip-container.d.ts +6 -1
- package/lib/victory-clip-container/victory-clip-container.js +20 -12
- package/lib/victory-container/victory-container.js +3 -3
- package/lib/victory-label/victory-label.d.ts +3 -3
- package/lib/victory-label/victory-label.js +12 -16
- package/lib/victory-portal/victory-portal.js +5 -5
- package/lib/victory-primitives/arc.js +2 -2
- package/lib/victory-primitives/background.js +2 -2
- package/lib/victory-primitives/border.js +2 -2
- package/lib/victory-primitives/line-segment.js +2 -2
- package/lib/victory-primitives/point.js +2 -2
- package/lib/victory-primitives/tspan.d.ts +0 -1
- package/lib/victory-primitives/types.d.ts +1 -1
- package/lib/victory-primitives/whisker.d.ts +1 -1
- package/lib/victory-primitives/whisker.js +2 -2
- package/lib/victory-theme/types.d.ts +11 -11
- package/lib/victory-transition/victory-transition.d.ts +1 -1
- package/lib/victory-transition/victory-transition.js +7 -7
- package/lib/victory-util/add-events.d.ts +8 -8
- package/lib/victory-util/add-events.js +13 -13
- package/lib/victory-util/axis.js +11 -11
- package/lib/victory-util/data.js +16 -16
- package/lib/victory-util/domain.js +13 -13
- package/lib/victory-util/events.d.ts +4 -4
- package/lib/victory-util/events.js +14 -14
- package/lib/victory-util/helpers.d.ts +94 -19
- package/lib/victory-util/helpers.js +96 -50
- package/lib/victory-util/hooks/use-animation-state.d.ts +2 -2
- package/lib/victory-util/hooks/use-animation-state.js +4 -4
- package/lib/victory-util/label-helpers.d.ts +4 -3
- package/lib/victory-util/label-helpers.js +3 -3
- package/lib/victory-util/line-helpers.d.ts +1 -1
- package/lib/victory-util/log.js +3 -2
- package/lib/victory-util/merge-refs.d.ts +1 -1
- package/lib/victory-util/scale.js +2 -2
- package/lib/victory-util/selection.d.ts +3 -3
- package/lib/victory-util/textsize.js +5 -5
- package/lib/victory-util/timer.d.ts +1 -1
- package/lib/victory-util/transitions.d.ts +1 -1
- package/lib/victory-util/transitions.js +12 -12
- package/lib/victory-util/type-helpers.d.ts +0 -1
- package/lib/victory-util/type-helpers.js +0 -6
- package/lib/victory-util/user-props.d.ts +2 -2
- package/lib/victory-util/wrapper.js +12 -12
- package/package.json +2 -30
- package/src/victory-animation/util.ts +3 -1
- package/src/victory-clip-container/victory-clip-container.tsx +26 -11
- package/src/victory-container/victory-container.tsx +1 -1
- package/src/victory-label/victory-label.tsx +5 -3
- package/src/victory-portal/victory-portal.tsx +3 -1
- package/src/victory-primitives/arc.tsx +1 -1
- package/src/victory-primitives/background.tsx +1 -1
- package/src/victory-primitives/border.tsx +1 -1
- package/src/victory-primitives/line-segment.tsx +1 -1
- package/src/victory-primitives/point.tsx +1 -1
- package/src/victory-primitives/whisker.tsx +1 -1
- package/src/victory-transition/victory-transition.tsx +4 -2
- package/src/victory-util/add-events.tsx +5 -2
- package/src/victory-util/axis.tsx +7 -3
- package/src/victory-util/data.ts +9 -10
- package/src/victory-util/domain.ts +8 -4
- package/src/victory-util/events.ts +4 -1
- package/src/victory-util/helpers.ts +155 -39
- package/src/victory-util/hooks/use-animation-state.ts +1 -1
- package/src/victory-util/label-helpers.ts +1 -1
- package/src/victory-util/log.ts +3 -2
- package/src/victory-util/scale.ts +1 -1
- package/src/victory-util/textsize.ts +2 -1
- package/src/victory-util/transitions.ts +3 -1
- package/src/victory-util/type-helpers.ts +0 -5
- package/src/victory-util/user-props.ts +1 -1
- package/src/victory-util/wrapper.tsx +5 -1
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getInitialTransitionState = getInitialTransitionState;
|
|
7
7
|
exports.getTransitionPropsFactory = getTransitionPropsFactory;
|
|
8
|
-
var _identity2 = _interopRequireDefault(require("lodash/identity"));
|
|
9
|
-
var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _defaults = _interopRequireDefault(require("lodash/defaults"));
|
|
10
|
+
var _identity = _interopRequireDefault(require("lodash/identity"));
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
function getDatumKey(datum, idx) {
|
|
13
13
|
return (datum.key || idx).toString();
|
|
@@ -116,7 +116,7 @@ function getInitialTransitionState(oldChildren, nextChildren) {
|
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
118
|
function getInitialChildProps(animate, data) {
|
|
119
|
-
const after = animate.onEnter && animate.onEnter.after ? animate.onEnter.after :
|
|
119
|
+
const after = animate.onEnter && animate.onEnter.after ? animate.onEnter.after : _identity.default;
|
|
120
120
|
return {
|
|
121
121
|
data: data.map((datum, idx) => Object.assign({}, datum, after(datum, idx, data)))
|
|
122
122
|
};
|
|
@@ -133,7 +133,7 @@ function getChildBeforeLoad(animate, child, data, cb) {
|
|
|
133
133
|
data
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
|
-
const before = newAnimate.onLoad && newAnimate.onLoad.before ? newAnimate.onLoad.before :
|
|
136
|
+
const before = newAnimate.onLoad && newAnimate.onLoad.before ? newAnimate.onLoad.before : _identity.default;
|
|
137
137
|
// If nodes need to exit, transform them with the provided onLoad.before function.
|
|
138
138
|
const newData = data.map((datum, idx) => {
|
|
139
139
|
return Object.assign({}, datum, before(datum, idx, data));
|
|
@@ -155,7 +155,7 @@ function getChildOnLoad(animate, data, cb) {
|
|
|
155
155
|
data
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
|
-
const after = animate.onLoad && animate.onLoad.after ? animate.onLoad.after :
|
|
158
|
+
const after = animate.onLoad && animate.onLoad.after ? animate.onLoad.after : _identity.default;
|
|
159
159
|
// If nodes need to exit, transform them with the provided onLoad.after function.
|
|
160
160
|
newData = data.map((datum, idx) => {
|
|
161
161
|
return Object.assign({}, datum, after(datum, idx, data));
|
|
@@ -177,7 +177,7 @@ function getChildPropsOnExit(animate, child, data, exitingNodes, cb) {
|
|
|
177
177
|
// After the exit transition occurs, trigger the animations for
|
|
178
178
|
// nodes that are neither exiting nor entering.
|
|
179
179
|
animate.onEnd = cb;
|
|
180
|
-
const before = animate.onExit && animate.onExit.before ? animate.onExit.before :
|
|
180
|
+
const before = animate.onExit && animate.onExit.before ? animate.onExit.before : _identity.default;
|
|
181
181
|
// If nodes need to exit, transform them with the provided onExit.before function.
|
|
182
182
|
newData = data.map((datum, idx) => {
|
|
183
183
|
const key = (datum.key || idx).toString();
|
|
@@ -200,7 +200,7 @@ function getChildPropsBeforeEnter(animate, child, data, enteringNodes, cb) {
|
|
|
200
200
|
newAnimate = Object.assign({}, animate, {
|
|
201
201
|
onEnd: cb
|
|
202
202
|
});
|
|
203
|
-
const before = animate.onEnter && animate.onEnter.before ? animate.onEnter.before :
|
|
203
|
+
const before = animate.onEnter && animate.onEnter.before ? animate.onEnter.before : _identity.default;
|
|
204
204
|
// We want the entering nodes to be included in the transition target
|
|
205
205
|
// domain. However, we may not want these nodes to be displayed initially,
|
|
206
206
|
// so perform the `onEnter.before` transformation on each node.
|
|
@@ -227,7 +227,7 @@ function getChildPropsOnEnter(animate, data, enteringNodes, cb) {
|
|
|
227
227
|
// domain should encompass the nodes that will now enter. So perform
|
|
228
228
|
// the `onEnter.after` transformation on each node.
|
|
229
229
|
newAnimate.onEnd = cb;
|
|
230
|
-
const after = newAnimate.onEnter && newAnimate.onEnter.after ? newAnimate.onEnter.after :
|
|
230
|
+
const after = newAnimate.onEnter && newAnimate.onEnter.after ? newAnimate.onEnter.after : _identity.default;
|
|
231
231
|
newData = data.map((datum, idx) => {
|
|
232
232
|
const key = getDatumKey(datum, idx);
|
|
233
233
|
return enteringNodes[key] ? Object.assign({}, datum, after(datum, idx, data)) : datum;
|
|
@@ -324,11 +324,11 @@ function getTransitionPropsFactory(props, state, setState) {
|
|
|
324
324
|
};
|
|
325
325
|
return function getTransitionProps(child, index) {
|
|
326
326
|
const data = getChildData(child) || [];
|
|
327
|
-
const animate = (0,
|
|
327
|
+
const animate = (0, _defaults.default)({}, props.animate, child.props.animate);
|
|
328
328
|
const defaultTransitions = child.props.polar ? child.type.defaultPolarTransitions || child.type.defaultTransitions : child.type.defaultTransitions;
|
|
329
|
-
animate.onExit = (0,
|
|
330
|
-
animate.onEnter = (0,
|
|
331
|
-
animate.onLoad = (0,
|
|
329
|
+
animate.onExit = (0, _defaults.default)({}, animate.onExit, defaultTransitions && defaultTransitions.onExit);
|
|
330
|
+
animate.onEnter = (0, _defaults.default)({}, animate.onEnter, defaultTransitions && defaultTransitions.onEnter);
|
|
331
|
+
animate.onLoad = (0, _defaults.default)({}, animate.onLoad, defaultTransitions && defaultTransitions.onLoad);
|
|
332
332
|
const childTransitions = childrenTransitions[index] || childrenTransitions[0];
|
|
333
333
|
if (!nodesDoneLoad) {
|
|
334
334
|
// should do onLoad animation
|
|
@@ -2,7 +2,6 @@ import { ForAxes, AxisType, Tuple, Datum, DatumValue } from "../types/prop-types
|
|
|
2
2
|
export declare function hasValueForAxis<T = unknown>(value: unknown | ForAxes<T>, axis: AxisType): value is ForAxes<T>;
|
|
3
3
|
export declare function isTuple<T = unknown>(value: unknown): value is Tuple<T>;
|
|
4
4
|
export declare function getValueForAxis<T = unknown>(value: T | ForAxes<T> | undefined, axis: AxisType): T | undefined;
|
|
5
|
-
export declare function isFunction<T = Function>(func?: unknown): func is T;
|
|
6
5
|
export declare function isDate(value: unknown): value is Date;
|
|
7
6
|
export declare function isKeyValueObject(datum: Datum): datum is {
|
|
8
7
|
[key: string]: DatumValue;
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getValueForAxis = getValueForAxis;
|
|
7
7
|
exports.hasValueForAxis = hasValueForAxis;
|
|
8
8
|
exports.isDate = isDate;
|
|
9
|
-
exports.isFunction = isFunction;
|
|
10
9
|
exports.isKeyValueObject = isKeyValueObject;
|
|
11
10
|
exports.isTuple = isTuple;
|
|
12
11
|
function hasValueForAxis(value, axis) {
|
|
@@ -24,11 +23,6 @@ function getValueForAxis(value, axis) {
|
|
|
24
23
|
}
|
|
25
24
|
return value;
|
|
26
25
|
}
|
|
27
|
-
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
29
|
-
function isFunction(func) {
|
|
30
|
-
return typeof func === "function";
|
|
31
|
-
}
|
|
32
26
|
function isDate(value) {
|
|
33
27
|
return value instanceof Date;
|
|
34
28
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
type SafeAttribute = string;
|
|
3
3
|
/**
|
|
4
4
|
* Asserts that value is not null or undefined, throwing an error if it is.
|
|
5
5
|
* @param value The value to assert
|
|
@@ -14,7 +14,7 @@ export declare function assert<T>(value: T, message?: string): asserts value is
|
|
|
14
14
|
* @param {Object} props: props to be filtered against USER_PROPS_SAFELIST
|
|
15
15
|
* @returns {Object}: object containing remaining acceptable props
|
|
16
16
|
*/
|
|
17
|
-
export declare const getSafeUserProps: <T>(props: T) => Record<SafeAttribute, string>;
|
|
17
|
+
export declare const getSafeUserProps: <T>(props: T extends Record<string, any> ? T : never) => Record<SafeAttribute, string>;
|
|
18
18
|
/**
|
|
19
19
|
* Wraps a component and adds safe user props
|
|
20
20
|
*
|
|
@@ -20,11 +20,11 @@ exports.getStringsFromChildrenCategories = getStringsFromChildrenCategories;
|
|
|
20
20
|
exports.getStringsFromData = getStringsFromData;
|
|
21
21
|
exports.getStyle = getStyle;
|
|
22
22
|
exports.getWidth = getWidth;
|
|
23
|
-
var _uniqBy2 = _interopRequireDefault(require("lodash/uniqBy"));
|
|
24
|
-
var _groupBy2 = _interopRequireDefault(require("lodash/groupBy"));
|
|
25
|
-
var _uniq2 = _interopRequireDefault(require("lodash/uniq"));
|
|
26
|
-
var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
|
|
27
23
|
var _react = _interopRequireDefault(require("react"));
|
|
24
|
+
var _defaults = _interopRequireDefault(require("lodash/defaults"));
|
|
25
|
+
var _uniq = _interopRequireDefault(require("lodash/uniq"));
|
|
26
|
+
var _groupBy = _interopRequireDefault(require("lodash/groupBy"));
|
|
27
|
+
var _uniqBy = _interopRequireDefault(require("lodash/uniqBy"));
|
|
28
28
|
var Axis = _interopRequireWildcard(require("./axis"));
|
|
29
29
|
var Style = _interopRequireWildcard(require("./style"));
|
|
30
30
|
var Data = _interopRequireWildcard(require("./data"));
|
|
@@ -133,10 +133,10 @@ function getDataFromChildren(props, childComponents) {
|
|
|
133
133
|
}, datum));
|
|
134
134
|
};
|
|
135
135
|
const stacked = children.filter(c => c.type && c.type.role === "stack").length;
|
|
136
|
-
const combine = (memo, val) => memo.concat((0,
|
|
136
|
+
const combine = (memo, val) => memo.concat((0, _uniqBy.default)(val, "_group"));
|
|
137
137
|
const datasets = Helpers.reduceChildren(children, iteratee, props, [], combine);
|
|
138
138
|
const group = stacked ? "_group" : "_stack";
|
|
139
|
-
return Object.values((0,
|
|
139
|
+
return Object.values((0, _groupBy.default)(datasets, group));
|
|
140
140
|
}
|
|
141
141
|
function getData(props, childComponents) {
|
|
142
142
|
if (props.data) {
|
|
@@ -263,7 +263,7 @@ function getScale(props, axis, childComponents) {
|
|
|
263
263
|
});
|
|
264
264
|
return Scale.getScaleType(sharedProps, axis);
|
|
265
265
|
};
|
|
266
|
-
const childScale = (0,
|
|
266
|
+
const childScale = (0, _uniq.default)(Helpers.reduceChildren(children, iteratee, props));
|
|
267
267
|
|
|
268
268
|
// default to linear scale if more than one uniq scale type is given by children
|
|
269
269
|
return childScale.length > 1 ? Scale.getScaleFromName("linear") : Scale.getScaleFromName(childScale[0]);
|
|
@@ -325,8 +325,8 @@ function getChildStyle(child, index, calculatedProps, theme) {
|
|
|
325
325
|
const dataWidth = role === "stack" ? {} : {
|
|
326
326
|
width: getWidth(calculatedProps)
|
|
327
327
|
};
|
|
328
|
-
const dataStyle = (0,
|
|
329
|
-
const labelsStyle = (0,
|
|
328
|
+
const dataStyle = (0, _defaults.default)({}, childStyle.data, Object.assign({}, dataWidth, style.data, defaultColor));
|
|
329
|
+
const labelsStyle = (0, _defaults.default)({}, childStyle.labels, style.labels);
|
|
330
330
|
return {
|
|
331
331
|
...childStyle,
|
|
332
332
|
parent: style.parent,
|
|
@@ -379,7 +379,7 @@ function getCategoryAndAxisStringsFromChildren(props, axis, childComponents) {
|
|
|
379
379
|
const axisComponent = Axis.getAxisComponent(childComponents, axis);
|
|
380
380
|
const axisStrings = axisComponent ? Data.getStringsFromAxes(axisComponent.props, axis) : [];
|
|
381
381
|
const categoryStrings = categories.length ? categories : getStringsFromChildrenCategories(childComponents, axis);
|
|
382
|
-
return (0,
|
|
382
|
+
return (0, _uniq.default)([...categoryStrings, ...axisStrings].flat());
|
|
383
383
|
}
|
|
384
384
|
function getStringsFromChildren(props, childComponents) {
|
|
385
385
|
const children = childComponents || _react.default.Children.toArray(props.children);
|
|
@@ -387,8 +387,8 @@ function getStringsFromChildren(props, childComponents) {
|
|
|
387
387
|
const yStrings = getCategoryAndAxisStringsFromChildren(props, "y", children);
|
|
388
388
|
const dataStrings = getStringsFromData(children);
|
|
389
389
|
return {
|
|
390
|
-
x: (0,
|
|
391
|
-
y: (0,
|
|
390
|
+
x: (0, _uniq.default)([...xStrings, ...dataStrings.x].flat()),
|
|
391
|
+
y: (0, _uniq.default)([...yStrings, ...dataStrings.y].flat())
|
|
392
392
|
};
|
|
393
393
|
}
|
|
394
394
|
function getCategories(props, childComponents, allStrings) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-core",
|
|
3
|
-
"version": "37.3.
|
|
3
|
+
"version": "37.3.3",
|
|
4
4
|
"description": "Victory Core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"lodash": "^4.17.21",
|
|
24
24
|
"react-fast-compare": "^3.2.0",
|
|
25
|
-
"victory-vendor": "37.3.
|
|
25
|
+
"victory-vendor": "37.3.3"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": ">=16.6.0"
|
|
@@ -180,32 +180,6 @@
|
|
|
180
180
|
"pnpm-lock.yaml"
|
|
181
181
|
]
|
|
182
182
|
},
|
|
183
|
-
"format": {
|
|
184
|
-
"command": "nps format:pkg",
|
|
185
|
-
"files": [
|
|
186
|
-
"src/**",
|
|
187
|
-
"*.json",
|
|
188
|
-
"../../.prettierignore",
|
|
189
|
-
"../../.prettierrc.json"
|
|
190
|
-
],
|
|
191
|
-
"output": [],
|
|
192
|
-
"packageLocks": [
|
|
193
|
-
"pnpm-lock.yaml"
|
|
194
|
-
]
|
|
195
|
-
},
|
|
196
|
-
"format:fix": {
|
|
197
|
-
"command": "pnpm run format || nps format:pkg:fix",
|
|
198
|
-
"files": [
|
|
199
|
-
"src/**",
|
|
200
|
-
"*.json",
|
|
201
|
-
"../../.prettierignore",
|
|
202
|
-
"../../.prettierrc.json"
|
|
203
|
-
],
|
|
204
|
-
"output": [],
|
|
205
|
-
"packageLocks": [
|
|
206
|
-
"pnpm-lock.yaml"
|
|
207
|
-
]
|
|
208
|
-
},
|
|
209
183
|
"lint": {
|
|
210
184
|
"command": "eslint src",
|
|
211
185
|
"files": [
|
|
@@ -267,8 +241,6 @@
|
|
|
267
241
|
"check": "wireit",
|
|
268
242
|
"types:check": "wireit",
|
|
269
243
|
"types:create": "wireit",
|
|
270
|
-
"format": "wireit",
|
|
271
|
-
"format:fix": "wireit",
|
|
272
244
|
"lint": "wireit",
|
|
273
245
|
"lint:fix": "wireit",
|
|
274
246
|
"jest": "wireit"
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import isPlainObject from "lodash/isPlainObject";
|
|
2
|
+
import orderBy from "lodash/orderBy";
|
|
3
|
+
|
|
1
4
|
import { interpolate } from "victory-vendor/d3-interpolate";
|
|
2
|
-
import { isPlainObject, orderBy } from "lodash";
|
|
3
5
|
|
|
4
6
|
export const isInterpolatable = function (obj) {
|
|
5
7
|
// d3 turns null into 0 and undefined into NaN, which we don't want.
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import defaults from "lodash/defaults";
|
|
3
|
+
import uniqueId from "lodash/uniqueId";
|
|
4
|
+
|
|
2
5
|
import * as Helpers from "../victory-util/helpers";
|
|
3
6
|
import * as UserProps from "../victory-util/user-props";
|
|
4
|
-
import { defaults, isObject, uniqueId } from "lodash";
|
|
5
7
|
import { ClipPath } from "../victory-primitives/clip-path";
|
|
6
8
|
import { Circle } from "../victory-primitives/circle";
|
|
7
9
|
import { Rect } from "../victory-primitives/rect";
|
|
@@ -29,7 +31,14 @@ export interface VictoryClipContainerProps {
|
|
|
29
31
|
translateY?: number;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
interface VictoryClipContainerState {
|
|
35
|
+
clipId?: number | string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class VictoryClipContainer extends React.Component<
|
|
39
|
+
VictoryClipContainerProps,
|
|
40
|
+
VictoryClipContainerState
|
|
41
|
+
> {
|
|
33
42
|
static displayName = "VictoryClipContainer";
|
|
34
43
|
static role = "container";
|
|
35
44
|
|
|
@@ -43,10 +52,18 @@ export class VictoryClipContainer extends React.Component<VictoryClipContainerPr
|
|
|
43
52
|
|
|
44
53
|
constructor(props: VictoryClipContainerProps) {
|
|
45
54
|
super(props);
|
|
46
|
-
this.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
55
|
+
this.state = {
|
|
56
|
+
clipId: props?.clipId,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// The clipId state is used to prevent hydration mismatches between the server and client (issue #2941).
|
|
61
|
+
// A better alternative would be to utilize React 18's useId hook instead of uniqueId, which would avoid needing state for this purpose.
|
|
62
|
+
// However, this component currently supports React 16 at the time of writing, so this workaround is necessary.
|
|
63
|
+
componentDidMount() {
|
|
64
|
+
if (!this.state.clipId) {
|
|
65
|
+
this.setState({ clipId: uniqueId("victory-clip-") });
|
|
66
|
+
}
|
|
50
67
|
}
|
|
51
68
|
|
|
52
69
|
calculateAttributes(props) {
|
|
@@ -58,7 +75,7 @@ export class VictoryClipContainer extends React.Component<VictoryClipContainerPr
|
|
|
58
75
|
translateX = 0,
|
|
59
76
|
translateY = 0,
|
|
60
77
|
} = props;
|
|
61
|
-
const clipPadding = Helpers.getPadding(
|
|
78
|
+
const clipPadding = Helpers.getPadding(props.clipPadding);
|
|
62
79
|
const radius = props.radius || Helpers.getRadius(props);
|
|
63
80
|
return {
|
|
64
81
|
x: (polar ? origin.x : translateX) - clipPadding.left,
|
|
@@ -141,9 +158,7 @@ export class VictoryClipContainer extends React.Component<VictoryClipContainerPr
|
|
|
141
158
|
rectComponent,
|
|
142
159
|
clipPathComponent,
|
|
143
160
|
} = props;
|
|
144
|
-
const { top, bottom, left, right } = Helpers.getPadding(
|
|
145
|
-
padding: props.clipPadding,
|
|
146
|
-
});
|
|
161
|
+
const { top, bottom, left, right } = Helpers.getPadding(props.clipPadding);
|
|
147
162
|
let child;
|
|
148
163
|
if (polar) {
|
|
149
164
|
const radius = props.radius || Helpers.getRadius(props);
|
|
@@ -201,6 +216,6 @@ export class VictoryClipContainer extends React.Component<VictoryClipContainerPr
|
|
|
201
216
|
translateX,
|
|
202
217
|
translateY,
|
|
203
218
|
});
|
|
204
|
-
return this.renderClippedGroup(clipProps, this.clipId);
|
|
219
|
+
return this.renderClippedGroup(clipProps, this.state.clipId);
|
|
205
220
|
}
|
|
206
221
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useRef } from "react";
|
|
2
|
-
import
|
|
2
|
+
import uniqueId from "lodash/uniqueId";
|
|
3
3
|
import { Portal } from "../victory-portal/portal";
|
|
4
4
|
import * as UserProps from "../victory-util/user-props";
|
|
5
5
|
import { OriginType } from "../victory-label/victory-label";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* eslint no-magic-numbers: ["error", { "ignore": [-0.5, 0.5, 0, 1, 2] }]*/
|
|
2
|
-
import { defaults, isEmpty } from "lodash";
|
|
3
2
|
import React from "react";
|
|
3
|
+
import defaults from "lodash/defaults";
|
|
4
|
+
import isEmpty from "lodash/isEmpty";
|
|
5
|
+
|
|
4
6
|
import { VictoryPortal } from "../victory-portal/victory-portal";
|
|
5
7
|
import { Rect } from "../victory-primitives/rect";
|
|
6
8
|
import { Text } from "../victory-primitives/text";
|
|
@@ -144,11 +146,11 @@ const getBackgroundPadding = (props) => {
|
|
|
144
146
|
if (props.backgroundPadding && Array.isArray(props.backgroundPadding)) {
|
|
145
147
|
return props.backgroundPadding.map((backgroundPadding) => {
|
|
146
148
|
const padding = Helpers.evaluateProp(backgroundPadding, props);
|
|
147
|
-
return Helpers.getPadding(
|
|
149
|
+
return Helpers.getPadding(padding);
|
|
148
150
|
});
|
|
149
151
|
}
|
|
150
152
|
const padding = Helpers.evaluateProp(props.backgroundPadding, props);
|
|
151
|
-
return Helpers.getPadding(
|
|
153
|
+
return Helpers.getPadding(padding);
|
|
152
154
|
};
|
|
153
155
|
|
|
154
156
|
const getLineHeight = (props) => {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import
|
|
2
|
+
import defaults from "lodash/defaults";
|
|
3
|
+
import uniqueId from "lodash/uniqueId";
|
|
4
|
+
|
|
3
5
|
import * as Log from "../victory-util/log";
|
|
4
6
|
import * as Helpers from "../victory-util/helpers";
|
|
5
7
|
import { usePortalContext } from "./portal-context";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint no-magic-numbers: ["error", { "ignore": [0, 1, 2, 180] }]*/
|
|
2
2
|
import React from "react";
|
|
3
|
-
import
|
|
3
|
+
import defaults from "lodash/defaults";
|
|
4
4
|
|
|
5
5
|
import * as Helpers from "../victory-util/helpers";
|
|
6
6
|
import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import defaults from "lodash/defaults";
|
|
3
|
+
import pick from "lodash/pick";
|
|
4
|
+
import isEqual from "react-fast-compare";
|
|
5
|
+
|
|
2
6
|
import { VictoryAnimation } from "../victory-animation/victory-animation";
|
|
3
7
|
import * as Collection from "../victory-util/collection";
|
|
4
8
|
import * as Helpers from "../victory-util/helpers";
|
|
5
9
|
import TimerContext from "../victory-util/timer-context";
|
|
6
10
|
import * as Transitions from "../victory-util/transitions";
|
|
7
|
-
import { defaults, pick } from "lodash";
|
|
8
|
-
import isEqual from "react-fast-compare";
|
|
9
11
|
import Timer from "../victory-util/timer";
|
|
10
12
|
|
|
11
13
|
type VictoryTransitionChild = React.ReactElement<
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
2
|
+
import defaults from "lodash/defaults";
|
|
3
|
+
import isEmpty from "lodash/isEmpty";
|
|
4
|
+
import pick from "lodash/pick";
|
|
5
|
+
|
|
3
6
|
import isEqual from "react-fast-compare";
|
|
4
7
|
|
|
5
8
|
import { VictoryLabelableProps } from "../types/prop-types";
|
|
@@ -54,7 +57,7 @@ export interface EventsMixinClass<TProps> {
|
|
|
54
57
|
): React.ReactElement;
|
|
55
58
|
cacheValues<TThis>(this: TThis, obj: Partial<TThis>): void;
|
|
56
59
|
getEventState: typeof Events.getEventState;
|
|
57
|
-
renderData(props: TProps);
|
|
60
|
+
renderData(props: TProps, shouldRenderDatum?: () => boolean);
|
|
58
61
|
renderContinuousData(props: TProps);
|
|
59
62
|
animateComponent(
|
|
60
63
|
props: TProps,
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
2
|
+
import defaults from "lodash/defaults";
|
|
3
|
+
import isObject from "lodash/isObject";
|
|
4
|
+
import uniq from "lodash/uniq";
|
|
5
|
+
import orderBy from "lodash/orderBy";
|
|
6
|
+
|
|
3
7
|
import * as Collection from "./collection";
|
|
4
8
|
import * as Domain from "./domain";
|
|
5
9
|
import * as Helpers from "./helpers";
|
|
@@ -214,8 +218,8 @@ function getTickArray(props) {
|
|
|
214
218
|
arr.forEach((t, index) => {
|
|
215
219
|
if (Array.isArray(domain)) {
|
|
216
220
|
if (
|
|
217
|
-
t >= Collection.getMinValue(domain) &&
|
|
218
|
-
t <= Collection.getMaxValue(domain)
|
|
221
|
+
t >= Collection.getMinValue(domain).valueOf() &&
|
|
222
|
+
t <= Collection.getMaxValue(domain).valueOf()
|
|
219
223
|
) {
|
|
220
224
|
newTickArray.push({
|
|
221
225
|
value: t,
|
package/src/victory-util/data.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "lodash";
|
|
2
|
+
import isEmpty from "lodash/isEmpty";
|
|
3
|
+
import isEqual from "lodash/isEqual";
|
|
4
|
+
import isPlainObject from "lodash/isPlainObject";
|
|
5
|
+
import isUndefined from "lodash/isUndefined";
|
|
6
|
+
import omitBy from "lodash/omitBy";
|
|
7
|
+
import orderBy from "lodash/orderBy";
|
|
8
|
+
import property from "lodash/property";
|
|
9
|
+
import uniq from "lodash/uniq";
|
|
10
|
+
|
|
12
11
|
import * as Helpers from "./helpers";
|
|
13
12
|
import * as Collection from "./collection";
|
|
14
13
|
import * as Scale from "./scale";
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
2
|
+
import isDate from "lodash/isDate";
|
|
3
|
+
import isPlainObject from "lodash/isPlainObject";
|
|
4
|
+
import sortedUniq from "lodash/sortedUniq";
|
|
5
|
+
|
|
3
6
|
import * as Data from "./data";
|
|
4
7
|
import * as Scale from "./scale";
|
|
5
8
|
import * as Helpers from "./helpers";
|
|
@@ -108,12 +111,13 @@ function padDomain(domain, props, axis) {
|
|
|
108
111
|
: props.singleQuadrantDomainPadding;
|
|
109
112
|
|
|
110
113
|
const addsQuadrants =
|
|
111
|
-
(min >= 0 && paddedDomain.min <= 0) ||
|
|
114
|
+
(min.valueOf() >= 0 && paddedDomain.min <= 0) ||
|
|
115
|
+
(max.valueOf() <= 0 && paddedDomain.max >= 0);
|
|
112
116
|
|
|
113
117
|
const adjust = (val, type) => {
|
|
114
118
|
const coerce =
|
|
115
|
-
(type === "min" && min >= 0 && val <= 0) ||
|
|
116
|
-
(type === "max" && max <= 0 && val >= 0);
|
|
119
|
+
(type === "min" && min.valueOf() >= 0 && val <= 0) ||
|
|
120
|
+
(type === "max" && max.valueOf() <= 0 && val >= 0);
|
|
117
121
|
return coerce ? 0 : val;
|
|
118
122
|
};
|
|
119
123
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import isEmpty from "lodash/isEmpty";
|
|
3
|
+
import pickBy from "lodash/pickBy";
|
|
4
|
+
import omitBy from "lodash/omitBy";
|
|
5
|
+
import uniq from "lodash/uniq";
|
|
2
6
|
|
|
3
|
-
import { isEmpty, pickBy, omitBy, uniq } from "lodash";
|
|
4
7
|
import type { EventMixinCalculatedValues } from "./add-events";
|
|
5
8
|
import { isFunction } from "./helpers";
|
|
6
9
|
|