victory-legend 36.8.2 → 36.8.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 +6 -0
- package/dist/victory-legend.js +139 -122
- package/dist/victory-legend.min.js +1 -1
- package/es/helper-methods.d.ts +2 -2
- package/es/helper-methods.js +34 -34
- package/lib/helper-methods.d.ts +2 -2
- package/lib/helper-methods.js +31 -35
- package/package.json +2 -2
- package/src/helper-methods.ts +20 -18
package/CHANGELOG.md
CHANGED
package/dist/victory-legend.js
CHANGED
|
@@ -87,9 +87,9 @@ var getLabelStyles = function (props) {
|
|
|
87
87
|
});
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
-
var getStyles = function (props
|
|
90
|
+
var getStyles = function (props) {
|
|
91
|
+
var styleObject = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
91
92
|
var style = props.style || {};
|
|
92
|
-
styleObject = styleObject || {};
|
|
93
93
|
var parentStyleProps = {
|
|
94
94
|
height: "100%",
|
|
95
95
|
width: "100%"
|
|
@@ -212,12 +212,10 @@ var getOffset = function (datum, rowHeights, columnWidths) {
|
|
|
212
212
|
row = datum.row;
|
|
213
213
|
return {
|
|
214
214
|
x: lodash_range__WEBPACK_IMPORTED_MODULE_1___default()(column).reduce(function (memo, curr) {
|
|
215
|
-
memo
|
|
216
|
-
return memo;
|
|
215
|
+
return memo + columnWidths[curr];
|
|
217
216
|
}, 0),
|
|
218
217
|
y: lodash_range__WEBPACK_IMPORTED_MODULE_1___default()(row).reduce(function (memo, curr) {
|
|
219
|
-
memo
|
|
220
|
-
return memo;
|
|
218
|
+
return memo + rowHeights[curr];
|
|
221
219
|
}, 0)
|
|
222
220
|
};
|
|
223
221
|
};
|
|
@@ -301,12 +299,13 @@ var getBorderProps = function (props, contentHeight, contentWidth) {
|
|
|
301
299
|
};
|
|
302
300
|
};
|
|
303
301
|
|
|
304
|
-
var getDimensions = function (
|
|
305
|
-
var modifiedProps = victory_core__WEBPACK_IMPORTED_MODULE_8__.modifyProps(
|
|
306
|
-
|
|
307
|
-
var
|
|
308
|
-
|
|
309
|
-
|
|
302
|
+
var getDimensions = function (initialProps, fallbackProps) {
|
|
303
|
+
var modifiedProps = victory_core__WEBPACK_IMPORTED_MODULE_8__.modifyProps(initialProps, fallbackProps, "legend");
|
|
304
|
+
|
|
305
|
+
var props = lodash_assign__WEBPACK_IMPORTED_MODULE_5___default()({}, modifiedProps, getCalculatedValues(modifiedProps));
|
|
306
|
+
|
|
307
|
+
var title = props.title,
|
|
308
|
+
titleOrientation = props.titleOrientation;
|
|
310
309
|
var groupedData = groupData(props);
|
|
311
310
|
var columnWidths = getColumnWidths(props, groupedData);
|
|
312
311
|
var rowHeights = getRowHeights(props, groupedData);
|
|
@@ -319,26 +318,27 @@ var getDimensions = function (props, fallbackProps) {
|
|
|
319
318
|
width: titleOrientation === "left" || titleOrientation === "right" ? lodash_sum__WEBPACK_IMPORTED_MODULE_2___default()(columnWidths) + titleDimensions.width : Math.max(lodash_sum__WEBPACK_IMPORTED_MODULE_2___default()(columnWidths), titleDimensions.width)
|
|
320
319
|
};
|
|
321
320
|
};
|
|
322
|
-
var getBaseProps = function (
|
|
323
|
-
var modifiedProps = victory_core__WEBPACK_IMPORTED_MODULE_8__.modifyProps(
|
|
324
|
-
|
|
325
|
-
var
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
x =
|
|
340
|
-
|
|
341
|
-
y =
|
|
321
|
+
var getBaseProps = function (initialProps, fallbackProps) {
|
|
322
|
+
var modifiedProps = victory_core__WEBPACK_IMPORTED_MODULE_8__.modifyProps(initialProps, fallbackProps, "legend");
|
|
323
|
+
|
|
324
|
+
var props = lodash_assign__WEBPACK_IMPORTED_MODULE_5___default()({}, modifiedProps, getCalculatedValues(modifiedProps));
|
|
325
|
+
|
|
326
|
+
var data = props.data,
|
|
327
|
+
standalone = props.standalone,
|
|
328
|
+
theme = props.theme,
|
|
329
|
+
padding = props.padding,
|
|
330
|
+
style = props.style,
|
|
331
|
+
colorScale = props.colorScale,
|
|
332
|
+
gutter = props.gutter,
|
|
333
|
+
rowGutter = props.rowGutter,
|
|
334
|
+
borderPadding = props.borderPadding,
|
|
335
|
+
title = props.title,
|
|
336
|
+
titleOrientation = props.titleOrientation,
|
|
337
|
+
name = props.name,
|
|
338
|
+
_props$x = props.x,
|
|
339
|
+
x = _props$x === void 0 ? 0 : _props$x,
|
|
340
|
+
_props$y = props.y,
|
|
341
|
+
y = _props$y === void 0 ? 0 : _props$y;
|
|
342
342
|
var groupedData = groupData(props);
|
|
343
343
|
var columnWidths = getColumnWidths(props, groupedData);
|
|
344
344
|
var rowHeights = getRowHeights(props, groupedData);
|
|
@@ -362,7 +362,7 @@ var getBaseProps = function (props, fallbackProps) {
|
|
|
362
362
|
|
|
363
363
|
var borderProps = getBorderProps(props, height, width);
|
|
364
364
|
var titleProps = getTitleProps(props, borderProps);
|
|
365
|
-
var
|
|
365
|
+
var initialChildProps = {
|
|
366
366
|
parent: {
|
|
367
367
|
data: data,
|
|
368
368
|
standalone: standalone,
|
|
@@ -412,7 +412,7 @@ var getBaseProps = function (props, fallbackProps) {
|
|
|
412
412
|
labels: labelProps
|
|
413
413
|
};
|
|
414
414
|
return childProps;
|
|
415
|
-
},
|
|
415
|
+
}, initialChildProps);
|
|
416
416
|
};
|
|
417
417
|
|
|
418
418
|
/***/ }),
|
|
@@ -7168,12 +7168,12 @@ var interpolateFunction = function (a, b) {
|
|
|
7168
7168
|
* differs in that it uses our custom interpolators when interpolating the value of each property in
|
|
7169
7169
|
* an object. This allows the correct interpolation of nested objects, including styles
|
|
7170
7170
|
*
|
|
7171
|
-
* @param {any}
|
|
7172
|
-
* @param {any}
|
|
7171
|
+
* @param {any} startValue - Start value.
|
|
7172
|
+
* @param {any} endValue - End value.
|
|
7173
7173
|
* @returns {Function} An interpolation function.
|
|
7174
7174
|
*/
|
|
7175
7175
|
|
|
7176
|
-
var interpolateObject = function (
|
|
7176
|
+
var interpolateObject = function (startValue, endValue) {
|
|
7177
7177
|
var interpolateTypes = function (x, y) {
|
|
7178
7178
|
if (x === y || !isInterpolatable(x) || !isInterpolatable(y)) {
|
|
7179
7179
|
return interpolateImmediate(x, y);
|
|
@@ -7198,6 +7198,8 @@ var interpolateObject = function (a, b) {
|
|
|
7198
7198
|
|
|
7199
7199
|
var i = {};
|
|
7200
7200
|
var c = {};
|
|
7201
|
+
var a = startValue;
|
|
7202
|
+
var b = endValue;
|
|
7201
7203
|
var k;
|
|
7202
7204
|
|
|
7203
7205
|
if (a === null || typeof a !== "object") {
|
|
@@ -7365,8 +7367,8 @@ var VictoryAnimation = /*#__PURE__*/function (_React$Component) {
|
|
|
7365
7367
|
step can generate imprecise values, sometimes greater than 1
|
|
7366
7368
|
if this happens set the state to 1 and return, cancelling the timer
|
|
7367
7369
|
*/
|
|
7368
|
-
|
|
7369
|
-
var step =
|
|
7370
|
+
var animationDuration = duration !== undefined ? duration : _this.props.duration;
|
|
7371
|
+
var step = animationDuration ? elapsed / animationDuration : 1;
|
|
7370
7372
|
|
|
7371
7373
|
if (step >= 1) {
|
|
7372
7374
|
_this.setState({
|
|
@@ -7982,8 +7984,7 @@ var getStyles = function (style, props) {
|
|
|
7982
7984
|
}
|
|
7983
7985
|
|
|
7984
7986
|
var getSingleStyle = function (s) {
|
|
7985
|
-
|
|
7986
|
-
var baseStyles = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.evaluateStyle(s, props);
|
|
7987
|
+
var baseStyles = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.evaluateStyle(s ? lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, s, defaultStyles) : defaultStyles, props);
|
|
7987
7988
|
return lodash_assign__WEBPACK_IMPORTED_MODULE_2___default()({}, baseStyles, {
|
|
7988
7989
|
fontSize: getFontSize(baseStyles)
|
|
7989
7990
|
});
|
|
@@ -8187,22 +8188,19 @@ var getInlineXOffset = function (calculatedProps, textElements, index) {
|
|
|
8187
8188
|
switch (textAnchor) {
|
|
8188
8189
|
case "start":
|
|
8189
8190
|
return widths.reduce(function (memo, width, i) {
|
|
8190
|
-
|
|
8191
|
-
return memo;
|
|
8191
|
+
return i < index ? memo + width : memo;
|
|
8192
8192
|
}, 0);
|
|
8193
8193
|
|
|
8194
8194
|
case "end":
|
|
8195
8195
|
return widths.reduce(function (memo, width, i) {
|
|
8196
|
-
|
|
8197
|
-
return memo;
|
|
8196
|
+
return i > index ? memo - width : memo;
|
|
8198
8197
|
}, 0);
|
|
8199
8198
|
|
|
8200
8199
|
default:
|
|
8201
8200
|
// middle
|
|
8202
8201
|
return widths.reduce(function (memo, width, i) {
|
|
8203
8202
|
var offsetWidth = i < index ? width : 0;
|
|
8204
|
-
|
|
8205
|
-
return memo;
|
|
8203
|
+
return i === index ? memo + width / 2 : memo + offsetWidth;
|
|
8206
8204
|
}, centerOffset);
|
|
8207
8205
|
}
|
|
8208
8206
|
};
|
|
@@ -8404,8 +8402,8 @@ var defaultProps = {
|
|
|
8404
8402
|
// Magic number from d3.
|
|
8405
8403
|
lineHeight: 1
|
|
8406
8404
|
};
|
|
8407
|
-
var VictoryLabel = function (
|
|
8408
|
-
props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps),
|
|
8405
|
+
var VictoryLabel = function (initialProps) {
|
|
8406
|
+
var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
|
|
8409
8407
|
|
|
8410
8408
|
if (props.text === null || props.text === undefined) {
|
|
8411
8409
|
return null;
|
|
@@ -8426,7 +8424,7 @@ var VictoryLabel = function (props) {
|
|
|
8426
8424
|
fontSize: currentStyle.fontSize || defaultStyles.fontSize,
|
|
8427
8425
|
capHeight: capHeightPx,
|
|
8428
8426
|
text: line,
|
|
8429
|
-
//
|
|
8427
|
+
// TODO: This looks like a bug:
|
|
8430
8428
|
textSize: _victory_util_textsize__WEBPACK_IMPORTED_MODULE_12__.approximateTextSize(line, currentStyle),
|
|
8431
8429
|
lineHeight: currentLineHeight,
|
|
8432
8430
|
backgroundPadding: getSingleValue(backgroundPadding, i)
|
|
@@ -8840,8 +8838,8 @@ var defaultProps = {
|
|
|
8840
8838
|
role: "presentation",
|
|
8841
8839
|
shapeRendering: "auto"
|
|
8842
8840
|
};
|
|
8843
|
-
var Border = function (
|
|
8844
|
-
props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps),
|
|
8841
|
+
var Border = function (initialProps) {
|
|
8842
|
+
var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
|
|
8845
8843
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(props.rectComponent, _objectSpread(_objectSpread({}, props.events), {}, {
|
|
8846
8844
|
"aria-label": props.ariaLabel,
|
|
8847
8845
|
style: props.style,
|
|
@@ -9011,8 +9009,8 @@ var defaultProps = {
|
|
|
9011
9009
|
role: "presentation",
|
|
9012
9010
|
shapeRendering: "auto"
|
|
9013
9011
|
};
|
|
9014
|
-
var Point = function (
|
|
9015
|
-
props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps),
|
|
9012
|
+
var Point = function (initialProps) {
|
|
9013
|
+
var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
|
|
9016
9014
|
var userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_5__.getSafeUserProps(props);
|
|
9017
9015
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(props.pathComponent, _objectSpread(_objectSpread({}, props.events), {}, {
|
|
9018
9016
|
"aria-label": props.ariaLabel,
|
|
@@ -10325,8 +10323,7 @@ function addEvents(WrappedComponent) {
|
|
|
10325
10323
|
value: function applyExternalMutations(props, externalMutations) {
|
|
10326
10324
|
if (!lodash_isEmpty__WEBPACK_IMPORTED_MODULE_5___default()(externalMutations)) {
|
|
10327
10325
|
var callbacks = props.externalEventMutations.reduce(function (memo, mutation) {
|
|
10328
|
-
|
|
10329
|
-
return memo;
|
|
10326
|
+
return lodash_isFunction__WEBPACK_IMPORTED_MODULE_4___default()(mutation.callback) ? memo.concat(mutation.callback) : memo;
|
|
10330
10327
|
}, []);
|
|
10331
10328
|
var compiledCallbacks = callbacks.length ? function () {
|
|
10332
10329
|
callbacks.forEach(function (c) {
|
|
@@ -10381,8 +10378,8 @@ function addEvents(WrappedComponent) {
|
|
|
10381
10378
|
}, {
|
|
10382
10379
|
key: "getBaseProps",
|
|
10383
10380
|
value: function getBaseProps(props, getSharedEventState) {
|
|
10384
|
-
|
|
10385
|
-
var sharedParentState =
|
|
10381
|
+
var getSharedEventStateFunction = getSharedEventState || this.getSharedEventState.bind(this);
|
|
10382
|
+
var sharedParentState = getSharedEventStateFunction("parent", "parent");
|
|
10386
10383
|
var parentState = this.getEventState("parent", "parent");
|
|
10387
10384
|
|
|
10388
10385
|
var baseParentProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_7___default()({}, parentState, sharedParentState);
|
|
@@ -10481,13 +10478,15 @@ function addEvents(WrappedComponent) {
|
|
|
10481
10478
|
var dataKeys = lodash_without__WEBPACK_IMPORTED_MODULE_0___default()(this.dataKeys, "all");
|
|
10482
10479
|
|
|
10483
10480
|
var labelComponents = dataKeys.reduce(function (memo, key) {
|
|
10481
|
+
var newMemo = memo;
|
|
10482
|
+
|
|
10484
10483
|
var labelProps = _this8.getComponentProps(labelComponent, "labels", key);
|
|
10485
10484
|
|
|
10486
10485
|
if (labelProps && labelProps.text !== undefined && labelProps.text !== null) {
|
|
10487
|
-
|
|
10486
|
+
newMemo = newMemo.concat( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default().cloneElement(labelComponent, labelProps));
|
|
10488
10487
|
}
|
|
10489
10488
|
|
|
10490
|
-
return
|
|
10489
|
+
return newMemo;
|
|
10491
10490
|
}, []);
|
|
10492
10491
|
var dataProps = this.getComponentProps(dataComponent, "data", "all");
|
|
10493
10492
|
var children = [/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default().cloneElement(dataComponent, dataProps)].concat(_toConsumableArray(labelComponents));
|
|
@@ -10924,14 +10923,14 @@ function getScopedEvents(events, namespace, childType, baseProps) {
|
|
|
10924
10923
|
// eslint-disable-next-line no-invalid-this
|
|
10925
10924
|
|
|
10926
10925
|
|
|
10927
|
-
|
|
10926
|
+
var newBaseProps = baseProps || this.baseProps; // returns the original base props or base state of a given target element
|
|
10928
10927
|
|
|
10929
10928
|
var getTargetProps = function (identifier, type) {
|
|
10930
10929
|
var childName = identifier.childName,
|
|
10931
10930
|
target = identifier.target,
|
|
10932
10931
|
key = identifier.key; // eslint-disable-next-line no-invalid-this
|
|
10933
10932
|
|
|
10934
|
-
var baseType = type === "props" ?
|
|
10933
|
+
var baseType = type === "props" ? newBaseProps : _this2.state || {};
|
|
10935
10934
|
var base = childName === undefined || childName === null || !baseType[childName] ? baseType : baseType[childName];
|
|
10936
10935
|
return key === "parent" ? base.parent : base[key] && base[key][target];
|
|
10937
10936
|
}; // Returns the state object with the mutation caused by a given eventReturn
|
|
@@ -11019,8 +11018,7 @@ function getScopedEvents(events, namespace, childType, baseProps) {
|
|
|
11019
11018
|
|
|
11020
11019
|
var parseEventReturn = function (eventReturn, eventKey) {
|
|
11021
11020
|
return Array.isArray(eventReturn) ? eventReturn.reduce(function (memo, props) {
|
|
11022
|
-
|
|
11023
|
-
return memo;
|
|
11021
|
+
return lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()({}, memo, parseEvent(props, eventKey));
|
|
11024
11022
|
}, {}) : parseEvent(eventReturn, eventKey);
|
|
11025
11023
|
};
|
|
11026
11024
|
|
|
@@ -11106,9 +11104,10 @@ function getEventState(eventKey, namespace, childType) {
|
|
|
11106
11104
|
*/
|
|
11107
11105
|
// eslint-disable-next-line max-params
|
|
11108
11106
|
|
|
11109
|
-
function getExternalMutationsWithChildren(mutations
|
|
11110
|
-
baseProps =
|
|
11111
|
-
baseState =
|
|
11107
|
+
function getExternalMutationsWithChildren(mutations) {
|
|
11108
|
+
var baseProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
11109
|
+
var baseState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
11110
|
+
var childNames = arguments.length > 3 ? arguments[3] : undefined;
|
|
11112
11111
|
return childNames.reduce(function (memo, childName) {
|
|
11113
11112
|
var childState = baseState[childName];
|
|
11114
11113
|
var mutation = getExternalMutations(mutations, baseProps[childName], baseState[childName], childName);
|
|
@@ -11130,9 +11129,10 @@ function getExternalMutationsWithChildren(mutations, baseProps, baseState, child
|
|
|
11130
11129
|
*/
|
|
11131
11130
|
// eslint-disable-next-line max-params
|
|
11132
11131
|
|
|
11133
|
-
function getExternalMutations(mutations
|
|
11134
|
-
baseProps =
|
|
11135
|
-
baseState =
|
|
11132
|
+
function getExternalMutations(mutations) {
|
|
11133
|
+
var baseProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
11134
|
+
var baseState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
11135
|
+
var childName = arguments.length > 3 ? arguments[3] : undefined;
|
|
11136
11136
|
|
|
11137
11137
|
var eventKeys = lodash_keys__WEBPACK_IMPORTED_MODULE_0___default()(baseProps);
|
|
11138
11138
|
|
|
@@ -11198,8 +11198,7 @@ function getExternalMutation(mutations, baseProps, baseState, identifier) {
|
|
|
11198
11198
|
return false;
|
|
11199
11199
|
};
|
|
11200
11200
|
|
|
11201
|
-
|
|
11202
|
-
var scopedMutations = mutations;
|
|
11201
|
+
var scopedMutations = Array.isArray(mutations) ? mutations : [mutations];
|
|
11203
11202
|
|
|
11204
11203
|
if (identifier.childName) {
|
|
11205
11204
|
scopedMutations = mutations.filter(function (m) {
|
|
@@ -11238,13 +11237,10 @@ function getExternalMutation(mutations, baseProps, baseState, identifier) {
|
|
|
11238
11237
|
|
|
11239
11238
|
function getComponentEvents(props, components) {
|
|
11240
11239
|
var events = Array.isArray(components) && components.reduce(function (memo, componentName) {
|
|
11241
|
-
var _memo;
|
|
11242
|
-
|
|
11243
11240
|
var component = props[componentName];
|
|
11244
11241
|
var defaultEvents = component && component.type && component.type.defaultEvents;
|
|
11245
11242
|
var componentEvents = lodash_isFunction__WEBPACK_IMPORTED_MODULE_6___default()(defaultEvents) ? defaultEvents(component.props) : defaultEvents;
|
|
11246
|
-
|
|
11247
|
-
return memo;
|
|
11243
|
+
return Array.isArray(componentEvents) ? memo.concat.apply(memo, _toConsumableArray(componentEvents)) : memo;
|
|
11248
11244
|
}, []);
|
|
11249
11245
|
return events && events.length ? events : undefined;
|
|
11250
11246
|
}
|
|
@@ -11602,6 +11598,7 @@ function reduceChildren(children, iteratee) {
|
|
|
11602
11598
|
|
|
11603
11599
|
var traverseChildren = function (childArray, names, parent) {
|
|
11604
11600
|
return childArray.reduce(function (memo, child, index) {
|
|
11601
|
+
var newMemo = memo;
|
|
11605
11602
|
var childRole = child.type && child.type.role;
|
|
11606
11603
|
var childName = child.props.name || "".concat(childRole, "-").concat(names[index]);
|
|
11607
11604
|
|
|
@@ -11619,16 +11616,16 @@ function reduceChildren(children, iteratee) {
|
|
|
11619
11616
|
});
|
|
11620
11617
|
|
|
11621
11618
|
var nestedResults = traverseChildren(nestedChildren, _childNames, child);
|
|
11622
|
-
|
|
11619
|
+
newMemo = combine(newMemo, nestedResults);
|
|
11623
11620
|
} else {
|
|
11624
11621
|
var result = iteratee(child, childName, parent);
|
|
11625
11622
|
|
|
11626
11623
|
if (result) {
|
|
11627
|
-
|
|
11624
|
+
newMemo = combine(newMemo, result);
|
|
11628
11625
|
}
|
|
11629
11626
|
}
|
|
11630
11627
|
|
|
11631
|
-
return
|
|
11628
|
+
return newMemo;
|
|
11632
11629
|
}, initialMemo);
|
|
11633
11630
|
};
|
|
11634
11631
|
|
|
@@ -11654,8 +11651,7 @@ function isHorizontal(props) {
|
|
|
11654
11651
|
var childProps = child.props || {};
|
|
11655
11652
|
|
|
11656
11653
|
if (memo || childProps.horizontal || !childProps.children) {
|
|
11657
|
-
|
|
11658
|
-
return memo;
|
|
11654
|
+
return memo || childProps.horizontal;
|
|
11659
11655
|
}
|
|
11660
11656
|
|
|
11661
11657
|
return traverseChildren(react__WEBPACK_IMPORTED_MODULE_6___default().Children.toArray(childProps.children));
|
|
@@ -11688,12 +11684,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11688
11684
|
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
11689
11685
|
|
|
11690
11686
|
|
|
11691
|
-
/* eslint-disable no-use-before-define */
|
|
11692
|
-
|
|
11693
11687
|
|
|
11694
11688
|
// Private Functions
|
|
11695
|
-
function getVerticalAnchor(props
|
|
11696
|
-
datum =
|
|
11689
|
+
function getVerticalAnchor(props) {
|
|
11690
|
+
var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
11697
11691
|
var sign = datum._y >= 0 ? 1 : -1;
|
|
11698
11692
|
var labelStyle = props.style && props.style.labels || {};
|
|
11699
11693
|
|
|
@@ -11706,8 +11700,8 @@ function getVerticalAnchor(props, datum) {
|
|
|
11706
11700
|
return "middle";
|
|
11707
11701
|
}
|
|
11708
11702
|
|
|
11709
|
-
function getTextAnchor(props
|
|
11710
|
-
datum =
|
|
11703
|
+
function getTextAnchor(props) {
|
|
11704
|
+
var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
11711
11705
|
var style = props.style,
|
|
11712
11706
|
horizontal = props.horizontal;
|
|
11713
11707
|
var sign = datum._y >= 0 ? 1 : -1;
|
|
@@ -11722,14 +11716,14 @@ function getTextAnchor(props, datum) {
|
|
|
11722
11716
|
return sign >= 0 ? "start" : "end";
|
|
11723
11717
|
}
|
|
11724
11718
|
|
|
11725
|
-
function getAngle(props
|
|
11726
|
-
datum =
|
|
11719
|
+
function getAngle(props) {
|
|
11720
|
+
var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
11727
11721
|
var labelStyle = props.style && props.style.labels || {};
|
|
11728
11722
|
return datum.angle === undefined ? labelStyle.angle : datum.angle;
|
|
11729
11723
|
}
|
|
11730
11724
|
|
|
11731
|
-
function getPadding(props
|
|
11732
|
-
datum =
|
|
11725
|
+
function getPadding(props) {
|
|
11726
|
+
var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
11733
11727
|
var horizontal = props.horizontal,
|
|
11734
11728
|
style = props.style;
|
|
11735
11729
|
var labelStyle = style.labels || {};
|
|
@@ -11808,8 +11802,9 @@ function getPolarOrientation(degrees) {
|
|
|
11808
11802
|
} // Exported Functions
|
|
11809
11803
|
|
|
11810
11804
|
|
|
11811
|
-
function getText(props
|
|
11812
|
-
datum =
|
|
11805
|
+
function getText(props) {
|
|
11806
|
+
var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
11807
|
+
var index = arguments.length > 2 ? arguments[2] : undefined;
|
|
11813
11808
|
|
|
11814
11809
|
if (datum.label !== undefined) {
|
|
11815
11810
|
return datum.label;
|
|
@@ -13064,11 +13059,10 @@ var Timer = /*#__PURE__*/function () {
|
|
|
13064
13059
|
}, {
|
|
13065
13060
|
key: "subscribe",
|
|
13066
13061
|
value: function subscribe(callback, duration) {
|
|
13067
|
-
duration = this.shouldAnimate ? duration : 0;
|
|
13068
13062
|
var subscriptionID = this.subscribers.push({
|
|
13069
13063
|
startTime: (0,victory_vendor_d3_timer__WEBPACK_IMPORTED_MODULE_0__.now)(),
|
|
13070
13064
|
callback: callback,
|
|
13071
|
-
duration: duration
|
|
13065
|
+
duration: this.shouldAnimate ? duration : 0
|
|
13072
13066
|
});
|
|
13073
13067
|
this.activeSubscriptions++;
|
|
13074
13068
|
this.start();
|
|
@@ -13255,36 +13249,38 @@ function getInitialChildProps(animate, data) {
|
|
|
13255
13249
|
|
|
13256
13250
|
|
|
13257
13251
|
function getChildBeforeLoad(animate, child, data, cb) {
|
|
13258
|
-
|
|
13252
|
+
var newAnimate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
|
|
13259
13253
|
onEnd: cb
|
|
13260
13254
|
});
|
|
13261
13255
|
|
|
13262
|
-
if (
|
|
13256
|
+
if (newAnimate && newAnimate.onLoad && !newAnimate.onLoad.duration) {
|
|
13263
13257
|
return {
|
|
13264
|
-
animate:
|
|
13258
|
+
animate: newAnimate,
|
|
13265
13259
|
data: data
|
|
13266
13260
|
};
|
|
13267
13261
|
}
|
|
13268
13262
|
|
|
13269
|
-
var before =
|
|
13263
|
+
var before = newAnimate.onLoad && newAnimate.onLoad.before ? newAnimate.onLoad.before : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default()); // If nodes need to exit, transform them with the provided onLoad.before function.
|
|
13270
13264
|
|
|
13271
|
-
|
|
13265
|
+
var newData = data.map(function (datum, idx) {
|
|
13272
13266
|
return lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, before(datum, idx, data));
|
|
13273
13267
|
});
|
|
13274
13268
|
return {
|
|
13275
|
-
animate:
|
|
13276
|
-
data:
|
|
13269
|
+
animate: newAnimate,
|
|
13270
|
+
data: newData,
|
|
13277
13271
|
clipWidth: 0
|
|
13278
13272
|
};
|
|
13279
13273
|
} // eslint-disable-next-line max-params
|
|
13280
13274
|
|
|
13281
13275
|
|
|
13282
13276
|
function getChildOnLoad(animate, data, cb) {
|
|
13283
|
-
|
|
13277
|
+
var newAnimate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
|
|
13284
13278
|
onEnd: cb
|
|
13285
13279
|
});
|
|
13286
13280
|
|
|
13287
|
-
|
|
13281
|
+
var newData = data;
|
|
13282
|
+
|
|
13283
|
+
if (newAnimate && newAnimate.onLoad && !newAnimate.onLoad.duration) {
|
|
13288
13284
|
return {
|
|
13289
13285
|
animate: animate,
|
|
13290
13286
|
data: data
|
|
@@ -13293,12 +13289,12 @@ function getChildOnLoad(animate, data, cb) {
|
|
|
13293
13289
|
|
|
13294
13290
|
var after = animate.onLoad && animate.onLoad.after ? animate.onLoad.after : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default()); // If nodes need to exit, transform them with the provided onLoad.after function.
|
|
13295
13291
|
|
|
13296
|
-
|
|
13292
|
+
newData = data.map(function (datum, idx) {
|
|
13297
13293
|
return lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, after(datum, idx, data));
|
|
13298
13294
|
});
|
|
13299
13295
|
return {
|
|
13300
|
-
animate:
|
|
13301
|
-
data:
|
|
13296
|
+
animate: newAnimate,
|
|
13297
|
+
data: newData
|
|
13302
13298
|
};
|
|
13303
13299
|
} // eslint-disable-next-line max-params, max-len
|
|
13304
13300
|
|
|
@@ -13307,7 +13303,10 @@ function getChildPropsOnExit(animate, child, data, exitingNodes, cb) {
|
|
|
13307
13303
|
// Whether or not _this_ child has exiting nodes, we want the exit-
|
|
13308
13304
|
// transition for all children to have the same duration, delay, etc.
|
|
13309
13305
|
var onExit = animate && animate.onExit;
|
|
13310
|
-
|
|
13306
|
+
|
|
13307
|
+
var newAnimate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, onExit);
|
|
13308
|
+
|
|
13309
|
+
var newData = data;
|
|
13311
13310
|
|
|
13312
13311
|
if (exitingNodes) {
|
|
13313
13312
|
// After the exit transition occurs, trigger the animations for
|
|
@@ -13315,39 +13314,42 @@ function getChildPropsOnExit(animate, child, data, exitingNodes, cb) {
|
|
|
13315
13314
|
animate.onEnd = cb;
|
|
13316
13315
|
var before = animate.onExit && animate.onExit.before ? animate.onExit.before : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default()); // If nodes need to exit, transform them with the provided onExit.before function.
|
|
13317
13316
|
|
|
13318
|
-
|
|
13317
|
+
newData = data.map(function (datum, idx) {
|
|
13319
13318
|
var key = (datum.key || idx).toString();
|
|
13320
13319
|
return exitingNodes[key] ? lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, before(datum, idx, data)) : datum;
|
|
13321
13320
|
});
|
|
13322
13321
|
}
|
|
13323
13322
|
|
|
13324
13323
|
return {
|
|
13325
|
-
animate:
|
|
13326
|
-
data:
|
|
13324
|
+
animate: newAnimate,
|
|
13325
|
+
data: newData
|
|
13327
13326
|
};
|
|
13328
13327
|
} // eslint-disable-next-line max-params,max-len
|
|
13329
13328
|
|
|
13330
13329
|
|
|
13331
13330
|
function getChildPropsBeforeEnter(animate, child, data, enteringNodes, cb) {
|
|
13331
|
+
var newAnimate = animate;
|
|
13332
|
+
var newData = data;
|
|
13333
|
+
|
|
13332
13334
|
if (enteringNodes) {
|
|
13333
13335
|
// Perform a normal animation here, except - when it finishes - trigger
|
|
13334
13336
|
// the transition for entering nodes.
|
|
13335
|
-
|
|
13337
|
+
newAnimate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
|
|
13336
13338
|
onEnd: cb
|
|
13337
13339
|
});
|
|
13338
13340
|
var before = animate.onEnter && animate.onEnter.before ? animate.onEnter.before : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default()); // We want the entering nodes to be included in the transition target
|
|
13339
13341
|
// domain. However, we may not want these nodes to be displayed initially,
|
|
13340
13342
|
// so perform the `onEnter.before` transformation on each node.
|
|
13341
13343
|
|
|
13342
|
-
|
|
13344
|
+
newData = data.map(function (datum, idx) {
|
|
13343
13345
|
var key = (datum.key || idx).toString();
|
|
13344
13346
|
return enteringNodes[key] ? lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, before(datum, idx, data)) : datum;
|
|
13345
13347
|
});
|
|
13346
13348
|
}
|
|
13347
13349
|
|
|
13348
13350
|
return {
|
|
13349
|
-
animate:
|
|
13350
|
-
data:
|
|
13351
|
+
animate: newAnimate,
|
|
13352
|
+
data: newData
|
|
13351
13353
|
};
|
|
13352
13354
|
} // eslint-disable-next-line max-params, max-len
|
|
13353
13355
|
|
|
@@ -13356,23 +13358,26 @@ function getChildPropsOnEnter(animate, data, enteringNodes, cb) {
|
|
|
13356
13358
|
// Whether or not _this_ child has entering nodes, we want the entering-
|
|
13357
13359
|
// transition for all children to have the same duration, delay, etc.
|
|
13358
13360
|
var onEnter = animate && animate.onEnter;
|
|
13359
|
-
|
|
13361
|
+
|
|
13362
|
+
var newAnimate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, onEnter);
|
|
13363
|
+
|
|
13364
|
+
var newData = data;
|
|
13360
13365
|
|
|
13361
13366
|
if (enteringNodes) {
|
|
13362
13367
|
// Old nodes have been transitioned to their new values, and the
|
|
13363
13368
|
// domain should encompass the nodes that will now enter. So perform
|
|
13364
13369
|
// the `onEnter.after` transformation on each node.
|
|
13365
|
-
|
|
13366
|
-
var after =
|
|
13367
|
-
|
|
13370
|
+
newAnimate.onEnd = cb;
|
|
13371
|
+
var after = newAnimate.onEnter && newAnimate.onEnter.after ? newAnimate.onEnter.after : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default());
|
|
13372
|
+
newData = data.map(function (datum, idx) {
|
|
13368
13373
|
var key = getDatumKey(datum, idx);
|
|
13369
13374
|
return enteringNodes[key] ? lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, after(datum, idx, data)) : datum;
|
|
13370
13375
|
});
|
|
13371
13376
|
}
|
|
13372
13377
|
|
|
13373
13378
|
return {
|
|
13374
|
-
animate:
|
|
13375
|
-
data:
|
|
13379
|
+
animate: newAnimate,
|
|
13380
|
+
data: newData
|
|
13376
13381
|
};
|
|
13377
13382
|
}
|
|
13378
13383
|
/**
|
|
@@ -13538,6 +13543,7 @@ function getTransitionPropsFactory(props, state, setState) {
|
|
|
13538
13543
|
"use strict";
|
|
13539
13544
|
__webpack_require__.r(__webpack_exports__);
|
|
13540
13545
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
13546
|
+
/* harmony export */ "assert": () => (/* binding */ assert),
|
|
13541
13547
|
/* harmony export */ "getSafeUserProps": () => (/* binding */ getSafeUserProps),
|
|
13542
13548
|
/* harmony export */ "withSafeUserProps": () => (/* binding */ withSafeUserProps)
|
|
13543
13549
|
/* harmony export */ });
|
|
@@ -13618,6 +13624,18 @@ var testIfSafeProp = function (key) {
|
|
|
13618
13624
|
if (doesPropStartWith(key) || isExactMatch(key)) return true;
|
|
13619
13625
|
return false;
|
|
13620
13626
|
};
|
|
13627
|
+
/**
|
|
13628
|
+
* Asserts that value is not null or undefined, throwing an error if it is.
|
|
13629
|
+
* @param value The value to assert
|
|
13630
|
+
* @param message The error message to throw
|
|
13631
|
+
*/
|
|
13632
|
+
|
|
13633
|
+
|
|
13634
|
+
function assert(value, message) {
|
|
13635
|
+
if (value === undefined || value === null) {
|
|
13636
|
+
throw new Error(message);
|
|
13637
|
+
}
|
|
13638
|
+
}
|
|
13621
13639
|
/**
|
|
13622
13640
|
* getSafeUserProps - function that takes in a props object and removes any
|
|
13623
13641
|
* key-value entries that do not match filter strings in the USER_PROPS_SAFELIST
|
|
@@ -13627,7 +13645,6 @@ var testIfSafeProp = function (key) {
|
|
|
13627
13645
|
* @returns {Object}: object containing remaining acceptable props
|
|
13628
13646
|
*/
|
|
13629
13647
|
|
|
13630
|
-
|
|
13631
13648
|
var getSafeUserProps = function (props) {
|
|
13632
13649
|
var propsToFilter = _objectSpread({}, props);
|
|
13633
13650
|
|