victory-core 36.8.2 → 36.8.4
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 +181 -159
- package/dist/victory-core.min.js +1 -1
- package/es/types/callbacks.d.ts +4 -4
- package/es/victory-animation/util.d.ts +3 -3
- package/es/victory-animation/util.js +5 -3
- package/es/victory-animation/victory-animation.js +2 -2
- package/es/victory-label/victory-label.d.ts +1 -1
- package/es/victory-label/victory-label.js +7 -11
- package/es/victory-primitives/arc.d.ts +1 -1
- package/es/victory-primitives/arc.js +2 -2
- package/es/victory-primitives/background.d.ts +1 -1
- package/es/victory-primitives/background.js +2 -2
- package/es/victory-primitives/border.d.ts +1 -1
- package/es/victory-primitives/border.js +2 -2
- package/es/victory-primitives/line-segment.d.ts +1 -1
- package/es/victory-primitives/line-segment.js +2 -2
- package/es/victory-primitives/point.d.ts +1 -1
- package/es/victory-primitives/point.js +2 -2
- package/es/victory-primitives/whisker.d.ts +1 -1
- package/es/victory-primitives/whisker.js +16 -17
- package/es/victory-util/add-events.js +7 -6
- package/es/victory-util/axis.js +2 -2
- package/es/victory-util/common-props.d.ts +1 -0
- package/es/victory-util/data.js +14 -9
- package/es/victory-util/domain.js +15 -15
- package/es/victory-util/events.d.ts +3 -3
- package/es/victory-util/events.js +17 -20
- package/es/victory-util/helpers.js +5 -5
- package/es/victory-util/immutable.js +4 -2
- package/es/victory-util/label-helpers.d.ts +1 -1
- package/es/victory-util/label-helpers.js +11 -12
- package/es/victory-util/selection.js +1 -2
- package/es/victory-util/timer.js +1 -2
- package/es/victory-util/transitions.js +37 -26
- package/es/victory-util/user-props.d.ts +6 -0
- package/es/victory-util/user-props.js +12 -1
- package/es/victory-util/wrapper.js +14 -14
- package/lib/types/callbacks.d.ts +4 -4
- package/lib/victory-animation/util.d.ts +3 -3
- package/lib/victory-animation/util.js +5 -3
- package/lib/victory-animation/victory-animation.js +2 -2
- package/lib/victory-label/victory-label.d.ts +1 -1
- package/lib/victory-label/victory-label.js +7 -11
- package/lib/victory-primitives/arc.d.ts +1 -1
- package/lib/victory-primitives/arc.js +2 -2
- package/lib/victory-primitives/background.d.ts +1 -1
- package/lib/victory-primitives/background.js +2 -2
- package/lib/victory-primitives/border.d.ts +1 -1
- package/lib/victory-primitives/border.js +2 -2
- package/lib/victory-primitives/line-segment.d.ts +1 -1
- package/lib/victory-primitives/line-segment.js +2 -2
- package/lib/victory-primitives/point.d.ts +1 -1
- package/lib/victory-primitives/point.js +2 -2
- package/lib/victory-primitives/whisker.d.ts +1 -1
- package/lib/victory-primitives/whisker.js +16 -17
- package/lib/victory-util/add-events.js +7 -6
- package/lib/victory-util/axis.js +2 -2
- package/lib/victory-util/common-props.d.ts +1 -0
- package/lib/victory-util/data.js +14 -9
- package/lib/victory-util/domain.js +15 -15
- package/lib/victory-util/events.d.ts +3 -3
- package/lib/victory-util/events.js +17 -20
- package/lib/victory-util/helpers.js +5 -5
- package/lib/victory-util/immutable.js +4 -2
- package/lib/victory-util/label-helpers.d.ts +1 -1
- package/lib/victory-util/label-helpers.js +11 -11
- package/lib/victory-util/selection.js +1 -2
- package/lib/victory-util/timer.js +1 -2
- package/lib/victory-util/transitions.js +32 -26
- package/lib/victory-util/user-props.d.ts +6 -0
- package/lib/victory-util/user-props.js +13 -0
- package/lib/victory-util/wrapper.js +16 -14
- package/package.json +2 -2
- package/src/types/callbacks.ts +8 -5
- package/src/victory-animation/util.ts +5 -3
- package/src/victory-animation/victory-animation.tsx +3 -2
- package/src/victory-label/victory-label.tsx +18 -17
- package/src/victory-primitives/arc.tsx +2 -2
- package/src/victory-primitives/background.tsx +2 -2
- package/src/victory-primitives/border.tsx +2 -2
- package/src/victory-primitives/line-segment.tsx +2 -2
- package/src/victory-primitives/point.tsx +2 -2
- package/src/victory-primitives/whisker.tsx +5 -5
- package/src/victory-util/add-events.tsx +10 -9
- package/src/victory-util/axis.tsx +6 -2
- package/src/victory-util/common-props.tsx +1 -0
- package/src/victory-util/data.ts +12 -8
- package/src/victory-util/domain.ts +15 -15
- package/src/victory-util/events.ts +23 -31
- package/src/victory-util/helpers.ts +5 -5
- package/src/victory-util/immutable.ts +3 -2
- package/src/victory-util/label-helpers.ts +6 -10
- package/src/victory-util/selection.ts +3 -2
- package/src/victory-util/timer.ts +1 -2
- package/src/victory-util/transitions.ts +31 -22
- package/src/victory-util/user-props.ts +14 -0
- package/src/victory-util/wrapper.tsx +17 -22
|
@@ -102,11 +102,12 @@ export function getDataFromChildren(props, childComponents) {
|
|
|
102
102
|
const iteratee = (child, childName, parent) => {
|
|
103
103
|
const childProps = assign({}, child.props, parentProps);
|
|
104
104
|
let childData;
|
|
105
|
+
let childElement = child;
|
|
105
106
|
if (!Data.isDataComponent(child)) {
|
|
106
107
|
return null;
|
|
107
108
|
} else if (child.type && isFunction(child.type.getData)) {
|
|
108
|
-
|
|
109
|
-
childData =
|
|
109
|
+
childElement = parent ? React.cloneElement(child, parent.props) : child;
|
|
110
|
+
childData = childElement.type.getData(childProps);
|
|
110
111
|
} else {
|
|
111
112
|
childData = Data.getData(childProps);
|
|
112
113
|
}
|
|
@@ -135,8 +136,10 @@ export function getData(props, childComponents) {
|
|
|
135
136
|
if (props.data) {
|
|
136
137
|
return Data.getData(props);
|
|
137
138
|
}
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
return getDataFromChildren(
|
|
140
|
+
props,
|
|
141
|
+
childComponents || React.Children.toArray(props.children),
|
|
142
|
+
);
|
|
140
143
|
}
|
|
141
144
|
|
|
142
145
|
export function getWidth(props, groupLength?, seriesLength?) {
|
|
@@ -145,12 +148,12 @@ export function getWidth(props, groupLength?, seriesLength?) {
|
|
|
145
148
|
? Helpers.getRange(props, "y")
|
|
146
149
|
: Helpers.getRange(props, "x");
|
|
147
150
|
const extent = Math.abs(range[1] - range[0]);
|
|
148
|
-
|
|
151
|
+
const seriesLengthValue =
|
|
149
152
|
seriesLength !== undefined
|
|
150
153
|
? seriesLength
|
|
151
154
|
: (Array.isArray(datasets[0]) && datasets[0].length) || 1;
|
|
152
|
-
|
|
153
|
-
const bars =
|
|
155
|
+
const groupLengthValue = groupLength || datasets.length;
|
|
156
|
+
const bars = groupLengthValue * seriesLengthValue;
|
|
154
157
|
const barRatio = 0.5;
|
|
155
158
|
return Math.round((barRatio * extent) / bars);
|
|
156
159
|
}
|
|
@@ -241,10 +244,10 @@ export function getDomainFromChildren(props, axis, childComponents) {
|
|
|
241
244
|
}
|
|
242
245
|
|
|
243
246
|
export function getDomain(props, axis, childComponents) {
|
|
244
|
-
|
|
247
|
+
const children = childComponents || React.Children.toArray(props.children);
|
|
245
248
|
|
|
246
249
|
const propsDomain = Domain.getDomainFromProps(props, axis);
|
|
247
|
-
const domainPadding = getDefaultDomainPadding(props, axis,
|
|
250
|
+
const domainPadding = getDefaultDomainPadding(props, axis, children);
|
|
248
251
|
let domain;
|
|
249
252
|
|
|
250
253
|
if (propsDomain) {
|
|
@@ -256,7 +259,7 @@ export function getDomain(props, axis, childComponents) {
|
|
|
256
259
|
const dataDomain = dataset
|
|
257
260
|
? Domain.getDomainFromData(props, axis, dataset)!
|
|
258
261
|
: [];
|
|
259
|
-
const childDomain = getDomainFromChildren(props, axis,
|
|
262
|
+
const childDomain = getDomainFromChildren(props, axis, children);
|
|
260
263
|
const min =
|
|
261
264
|
minDomain || Collection.getMinValue([...dataDomain, ...childDomain]);
|
|
262
265
|
const max =
|
|
@@ -428,20 +431,12 @@ export function getCategoryAndAxisStringsFromChildren(
|
|
|
428
431
|
}
|
|
429
432
|
|
|
430
433
|
export function getStringsFromChildren(props, childComponents) {
|
|
431
|
-
|
|
434
|
+
const children = childComponents || React.Children.toArray(props.children);
|
|
432
435
|
|
|
433
|
-
const xStrings = getCategoryAndAxisStringsFromChildren(
|
|
434
|
-
|
|
435
|
-
"x",
|
|
436
|
-
childComponents,
|
|
437
|
-
);
|
|
438
|
-
const yStrings = getCategoryAndAxisStringsFromChildren(
|
|
439
|
-
props,
|
|
440
|
-
"y",
|
|
441
|
-
childComponents,
|
|
442
|
-
);
|
|
436
|
+
const xStrings = getCategoryAndAxisStringsFromChildren(props, "x", children);
|
|
437
|
+
const yStrings = getCategoryAndAxisStringsFromChildren(props, "y", children);
|
|
443
438
|
|
|
444
|
-
const dataStrings = getStringsFromData(
|
|
439
|
+
const dataStrings = getStringsFromData(children);
|
|
445
440
|
|
|
446
441
|
return {
|
|
447
442
|
x: uniq(flatten([...xStrings, ...dataStrings.x])),
|