victory-core 36.8.4 → 36.8.5
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 +8 -0
- package/dist/victory-core.js +684 -1046
- package/dist/victory-core.min.js +1 -1
- package/es/victory-clip-container/victory-clip-container.js +3 -6
- package/es/victory-container/victory-container.js +5 -13
- package/es/victory-label/victory-label.js +6 -7
- package/es/victory-primitives/arc.js +2 -4
- package/es/victory-primitives/background.js +1 -3
- package/es/victory-primitives/border.js +2 -4
- package/es/victory-primitives/line-segment.js +2 -4
- package/es/victory-primitives/point.js +1 -3
- package/es/victory-primitives/whisker.js +3 -5
- package/es/victory-theme/grayscale.js +24 -27
- package/es/victory-theme/material.js +27 -30
- package/es/victory-util/add-events.js +1 -2
- package/es/victory-util/axis.js +3 -6
- package/es/victory-util/data.js +5 -10
- package/es/victory-util/events.js +13 -14
- package/es/victory-util/helpers.d.ts +11 -0
- package/es/victory-util/helpers.js +34 -5
- package/es/victory-util/point-path-helpers.js +3 -3
- package/es/victory-util/textsize.js +1 -2
- package/es/victory-util/transitions.js +14 -20
- package/es/victory-util/wrapper.js +7 -10
- package/lib/victory-clip-container/victory-clip-container.js +3 -5
- package/lib/victory-container/victory-container.js +5 -7
- package/lib/victory-label/victory-label.js +6 -8
- package/lib/victory-primitives/arc.js +2 -4
- package/lib/victory-primitives/background.js +1 -3
- package/lib/victory-primitives/border.js +2 -4
- package/lib/victory-primitives/line-segment.js +2 -4
- package/lib/victory-primitives/point.js +1 -3
- package/lib/victory-primitives/whisker.js +3 -5
- package/lib/victory-theme/grayscale.js +24 -29
- package/lib/victory-theme/material.js +27 -32
- package/lib/victory-util/add-events.js +1 -3
- package/lib/victory-util/axis.js +3 -7
- package/lib/victory-util/data.js +5 -9
- package/lib/victory-util/events.js +13 -15
- package/lib/victory-util/helpers.d.ts +11 -0
- package/lib/victory-util/helpers.js +36 -4
- package/lib/victory-util/point-path-helpers.js +6 -3
- package/lib/victory-util/textsize.js +1 -3
- package/lib/victory-util/transitions.js +14 -16
- package/lib/victory-util/wrapper.js +7 -9
- package/package.json +2 -2
- package/src/victory-clip-container/victory-clip-container.tsx +4 -4
- package/src/victory-container/victory-container.tsx +6 -6
- package/src/victory-label/victory-label.tsx +7 -7
- package/src/victory-primitives/arc.tsx +2 -3
- package/src/victory-primitives/background.tsx +1 -2
- package/src/victory-primitives/border.tsx +2 -3
- package/src/victory-primitives/line-segment.tsx +2 -3
- package/src/victory-primitives/point.tsx +1 -2
- package/src/victory-primitives/whisker.tsx +3 -4
- package/src/victory-theme/grayscale.tsx +30 -25
- package/src/victory-theme/material.tsx +33 -28
- package/src/victory-util/add-events.tsx +1 -2
- package/src/victory-util/axis.tsx +3 -5
- package/src/victory-util/data.ts +7 -7
- package/src/victory-util/events.ts +23 -16
- package/src/victory-util/helpers.ts +34 -3
- package/src/victory-util/point-path-helpers.ts +3 -2
- package/src/victory-util/textsize.ts +2 -2
- package/src/victory-util/transitions.ts +22 -15
- package/src/victory-util/wrapper.tsx +11 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// http://www.pearsonified.com/2012/01/characters-per-line.php
|
|
2
2
|
/* eslint-disable no-magic-numbers */
|
|
3
|
-
import {
|
|
3
|
+
import { defaults, memoize } from "lodash";
|
|
4
4
|
|
|
5
5
|
// Based on measuring specific character widths
|
|
6
6
|
// as in the following example https://bl.ocks.org/tophtucker/62f93a4658387bb61e4510c37e2e97cf
|
|
@@ -189,7 +189,7 @@ export const convertLengthToPixels = (
|
|
|
189
189
|
const _prepareParams = (inputStyle, index) => {
|
|
190
190
|
const lineStyle = Array.isArray(inputStyle) ? inputStyle[index] : inputStyle;
|
|
191
191
|
const style = defaults({}, lineStyle, defaultStyle);
|
|
192
|
-
return assign({}, style, {
|
|
192
|
+
return Object.assign({}, style, {
|
|
193
193
|
fontFamily: style.fontFamily,
|
|
194
194
|
letterSpacing:
|
|
195
195
|
typeof style.letterSpacing === "number"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defaults, identity, keys } from "lodash";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { AnimatePropTypeInterface } from "../types/prop-types";
|
|
4
4
|
|
|
@@ -131,13 +131,15 @@ function getInitialChildProps(animate, data): TransitionProps {
|
|
|
131
131
|
const after =
|
|
132
132
|
animate.onEnter && animate.onEnter.after ? animate.onEnter.after : identity;
|
|
133
133
|
return {
|
|
134
|
-
data: data.map((datum, idx) =>
|
|
134
|
+
data: data.map((datum, idx) =>
|
|
135
|
+
Object.assign({}, datum, after(datum, idx, data)),
|
|
136
|
+
),
|
|
135
137
|
};
|
|
136
138
|
}
|
|
137
139
|
|
|
138
140
|
// eslint-disable-next-line max-params
|
|
139
141
|
function getChildBeforeLoad(animate, child, data, cb): TransitionProps {
|
|
140
|
-
const newAnimate = assign({}, animate, { onEnd: cb });
|
|
142
|
+
const newAnimate = Object.assign({}, animate, { onEnd: cb });
|
|
141
143
|
|
|
142
144
|
if (newAnimate && newAnimate.onLoad && !newAnimate.onLoad.duration) {
|
|
143
145
|
return { animate: newAnimate, data };
|
|
@@ -148,7 +150,7 @@ function getChildBeforeLoad(animate, child, data, cb): TransitionProps {
|
|
|
148
150
|
: identity;
|
|
149
151
|
// If nodes need to exit, transform them with the provided onLoad.before function.
|
|
150
152
|
const newData = data.map((datum, idx) => {
|
|
151
|
-
return assign({}, datum, before(datum, idx, data));
|
|
153
|
+
return Object.assign({}, datum, before(datum, idx, data));
|
|
152
154
|
});
|
|
153
155
|
|
|
154
156
|
return { animate: newAnimate, data: newData, clipWidth: 0 };
|
|
@@ -156,7 +158,7 @@ function getChildBeforeLoad(animate, child, data, cb): TransitionProps {
|
|
|
156
158
|
|
|
157
159
|
// eslint-disable-next-line max-params
|
|
158
160
|
function getChildOnLoad(animate, data, cb): TransitionProps {
|
|
159
|
-
const newAnimate = assign({}, animate, { onEnd: cb });
|
|
161
|
+
const newAnimate = Object.assign({}, animate, { onEnd: cb });
|
|
160
162
|
let newData = data;
|
|
161
163
|
|
|
162
164
|
if (newAnimate && newAnimate.onLoad && !newAnimate.onLoad.duration) {
|
|
@@ -166,7 +168,7 @@ function getChildOnLoad(animate, data, cb): TransitionProps {
|
|
|
166
168
|
animate.onLoad && animate.onLoad.after ? animate.onLoad.after : identity;
|
|
167
169
|
// If nodes need to exit, transform them with the provided onLoad.after function.
|
|
168
170
|
newData = data.map((datum, idx) => {
|
|
169
|
-
return assign({}, datum, after(datum, idx, data));
|
|
171
|
+
return Object.assign({}, datum, after(datum, idx, data));
|
|
170
172
|
});
|
|
171
173
|
|
|
172
174
|
return { animate: newAnimate, data: newData };
|
|
@@ -183,7 +185,7 @@ function getChildPropsOnExit(
|
|
|
183
185
|
// Whether or not _this_ child has exiting nodes, we want the exit-
|
|
184
186
|
// transition for all children to have the same duration, delay, etc.
|
|
185
187
|
const onExit = animate && animate.onExit;
|
|
186
|
-
const newAnimate = assign({}, animate, onExit);
|
|
188
|
+
const newAnimate = Object.assign({}, animate, onExit);
|
|
187
189
|
let newData = data;
|
|
188
190
|
|
|
189
191
|
if (exitingNodes) {
|
|
@@ -198,7 +200,7 @@ function getChildPropsOnExit(
|
|
|
198
200
|
newData = data.map((datum, idx) => {
|
|
199
201
|
const key = (datum.key || idx).toString();
|
|
200
202
|
return exitingNodes[key]
|
|
201
|
-
? assign({}, datum, before(datum, idx, data))
|
|
203
|
+
? Object.assign({}, datum, before(datum, idx, data))
|
|
202
204
|
: datum;
|
|
203
205
|
});
|
|
204
206
|
}
|
|
@@ -219,7 +221,7 @@ function getChildPropsBeforeEnter(
|
|
|
219
221
|
if (enteringNodes) {
|
|
220
222
|
// Perform a normal animation here, except - when it finishes - trigger
|
|
221
223
|
// the transition for entering nodes.
|
|
222
|
-
newAnimate = assign({}, animate, { onEnd: cb });
|
|
224
|
+
newAnimate = Object.assign({}, animate, { onEnd: cb });
|
|
223
225
|
const before =
|
|
224
226
|
animate.onEnter && animate.onEnter.before
|
|
225
227
|
? animate.onEnter.before
|
|
@@ -230,7 +232,7 @@ function getChildPropsBeforeEnter(
|
|
|
230
232
|
newData = data.map((datum, idx) => {
|
|
231
233
|
const key = (datum.key || idx).toString();
|
|
232
234
|
return enteringNodes[key]
|
|
233
|
-
? assign({}, datum, before(datum, idx, data))
|
|
235
|
+
? Object.assign({}, datum, before(datum, idx, data))
|
|
234
236
|
: datum;
|
|
235
237
|
});
|
|
236
238
|
}
|
|
@@ -248,7 +250,7 @@ function getChildPropsOnEnter(
|
|
|
248
250
|
// Whether or not _this_ child has entering nodes, we want the entering-
|
|
249
251
|
// transition for all children to have the same duration, delay, etc.
|
|
250
252
|
const onEnter = animate && animate.onEnter;
|
|
251
|
-
const newAnimate = assign({}, animate, onEnter);
|
|
253
|
+
const newAnimate = Object.assign({}, animate, onEnter);
|
|
252
254
|
let newData = data;
|
|
253
255
|
|
|
254
256
|
if (enteringNodes) {
|
|
@@ -263,7 +265,7 @@ function getChildPropsOnEnter(
|
|
|
263
265
|
newData = data.map((datum, idx) => {
|
|
264
266
|
const key = getDatumKey(datum, idx);
|
|
265
267
|
return enteringNodes[key]
|
|
266
|
-
? assign({}, datum, after(datum, idx, data))
|
|
268
|
+
? Object.assign({}, datum, after(datum, idx, data))
|
|
267
269
|
: datum;
|
|
268
270
|
});
|
|
269
271
|
}
|
|
@@ -392,7 +394,7 @@ export function getTransitionPropsFactory(props, state, setState) {
|
|
|
392
394
|
? transitionDurations.load
|
|
393
395
|
: getChildTransitionDuration(child, "onLoad");
|
|
394
396
|
const animation = { duration: load };
|
|
395
|
-
return onLoad(child, data, assign({}, animate, animation));
|
|
397
|
+
return onLoad(child, data, Object.assign({}, animate, animation));
|
|
396
398
|
} else if (nodesWillExit) {
|
|
397
399
|
const exitingNodes = childTransitions && childTransitions.exiting;
|
|
398
400
|
const exit =
|
|
@@ -401,7 +403,12 @@ export function getTransitionPropsFactory(props, state, setState) {
|
|
|
401
403
|
: getChildTransitionDuration(child, "onExit");
|
|
402
404
|
// if nodesWillExit, but this child has no exiting nodes, set a delay instead of a duration
|
|
403
405
|
const animation = exitingNodes ? { duration: exit } : { delay: exit };
|
|
404
|
-
return onExit(
|
|
406
|
+
return onExit(
|
|
407
|
+
exitingNodes,
|
|
408
|
+
child,
|
|
409
|
+
data,
|
|
410
|
+
Object.assign({}, animate, animation),
|
|
411
|
+
);
|
|
405
412
|
} else if (nodesWillEnter) {
|
|
406
413
|
const enteringNodes = childTransitions && childTransitions.entering;
|
|
407
414
|
const enter =
|
|
@@ -419,7 +426,7 @@ export function getTransitionPropsFactory(props, state, setState) {
|
|
|
419
426
|
enteringNodes,
|
|
420
427
|
child,
|
|
421
428
|
data,
|
|
422
|
-
assign({}, animate, animation),
|
|
429
|
+
Object.assign({}, animate, animation),
|
|
423
430
|
);
|
|
424
431
|
} else if (!state && animate && animate.onExit) {
|
|
425
432
|
// This is the initial render, and nodes may enter when props change. Because
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
assign,
|
|
3
2
|
defaults,
|
|
4
3
|
flatten,
|
|
5
4
|
isFunction,
|
|
@@ -100,7 +99,7 @@ export function getDataFromChildren(props, childComponents) {
|
|
|
100
99
|
});
|
|
101
100
|
|
|
102
101
|
const iteratee = (child, childName, parent) => {
|
|
103
|
-
const childProps = assign({}, child.props, parentProps);
|
|
102
|
+
const childProps = Object.assign({}, child.props, parentProps);
|
|
104
103
|
let childData;
|
|
105
104
|
let childElement = child;
|
|
106
105
|
if (!Data.isDataComponent(child)) {
|
|
@@ -113,7 +112,7 @@ export function getDataFromChildren(props, childComponents) {
|
|
|
113
112
|
}
|
|
114
113
|
stack += 1;
|
|
115
114
|
return childData.map((datum, index) =>
|
|
116
|
-
assign({ _stack: stack, _group: index }, datum),
|
|
115
|
+
Object.assign({ _stack: stack, _group: index }, datum),
|
|
117
116
|
);
|
|
118
117
|
};
|
|
119
118
|
|
|
@@ -222,11 +221,11 @@ export function getDomainFromChildren(props, axis, childComponents) {
|
|
|
222
221
|
categories,
|
|
223
222
|
};
|
|
224
223
|
const parentProps = parentData
|
|
225
|
-
? assign(baseParentProps, { data: parentData })
|
|
224
|
+
? Object.assign(baseParentProps, { data: parentData })
|
|
226
225
|
: baseParentProps;
|
|
227
226
|
|
|
228
227
|
const iteratee = (child) => {
|
|
229
|
-
const sharedProps = assign({}, child.props, parentProps);
|
|
228
|
+
const sharedProps = Object.assign({}, child.props, parentProps);
|
|
230
229
|
if (!Domain.isDomainComponent(child)) {
|
|
231
230
|
return null;
|
|
232
231
|
} else if (child.type && isFunction(child.type.getDomain)) {
|
|
@@ -266,7 +265,11 @@ export function getDomain(props, axis, childComponents) {
|
|
|
266
265
|
maxDomain || Collection.getMaxValue([...dataDomain, ...childDomain]);
|
|
267
266
|
domain = Domain.getDomainFromMinMax(min, max);
|
|
268
267
|
}
|
|
269
|
-
return Domain.formatDomain(
|
|
268
|
+
return Domain.formatDomain(
|
|
269
|
+
domain,
|
|
270
|
+
Object.assign({ domainPadding }, props),
|
|
271
|
+
axis,
|
|
272
|
+
);
|
|
270
273
|
}
|
|
271
274
|
|
|
272
275
|
export function getScale(props, axis, childComponents?) {
|
|
@@ -277,7 +280,7 @@ export function getScale(props, axis, childComponents?) {
|
|
|
277
280
|
? childComponents.slice(0)
|
|
278
281
|
: React.Children.toArray(props.children);
|
|
279
282
|
const iteratee = (child) => {
|
|
280
|
-
const sharedProps = assign({}, child.props, {
|
|
283
|
+
const sharedProps = Object.assign({}, child.props, {
|
|
281
284
|
horizontal: props.horizontal,
|
|
282
285
|
});
|
|
283
286
|
return Scale.getScaleType(sharedProps, axis);
|
|
@@ -347,7 +350,7 @@ export function getChildStyle(child, index, calculatedProps) {
|
|
|
347
350
|
const dataStyle = defaults(
|
|
348
351
|
{},
|
|
349
352
|
childStyle.data,
|
|
350
|
-
assign({}, dataWidth, style.data, defaultColor),
|
|
353
|
+
Object.assign({}, dataWidth, style.data, defaultColor),
|
|
351
354
|
);
|
|
352
355
|
const labelsStyle = defaults({}, childStyle.labels, style.labels);
|
|
353
356
|
return {
|