victory-brush-container 37.3.1 → 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 +8 -0
- package/dist/victory-brush-container.js +137 -96
- package/dist/victory-brush-container.min.js +1 -1
- package/es/brush-helpers.d.ts +0 -1
- package/es/brush-helpers.js +14 -18
- package/es/victory-brush-container.d.ts +41 -41
- package/es/victory-brush-container.js +5 -5
- package/lib/brush-helpers.d.ts +0 -1
- package/lib/brush-helpers.js +14 -18
- package/lib/victory-brush-container.d.ts +41 -41
- package/lib/victory-brush-container.js +5 -5
- package/package.json +6 -38
- package/src/brush-helpers.ts +4 -5
- package/src/victory-brush-container.tsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -287,7 +287,6 @@ const Helpers = {
|
|
|
287
287
|
return xMoved || yMoved;
|
|
288
288
|
}
|
|
289
289
|
},
|
|
290
|
-
// eslint-disable-next-line max-statements, complexity
|
|
291
290
|
onMouseDown(evt, targetProps) {
|
|
292
291
|
evt.preventDefault();
|
|
293
292
|
const {
|
|
@@ -380,7 +379,6 @@ const Helpers = {
|
|
|
380
379
|
})
|
|
381
380
|
}] : {};
|
|
382
381
|
},
|
|
383
|
-
// eslint-disable-next-line max-statements, complexity
|
|
384
382
|
onGlobalMouseMove(evt, targetProps) {
|
|
385
383
|
const {
|
|
386
384
|
scale,
|
|
@@ -467,13 +465,11 @@ const Helpers = {
|
|
|
467
465
|
}
|
|
468
466
|
return {};
|
|
469
467
|
},
|
|
470
|
-
// eslint-disable-next-line complexity
|
|
471
468
|
onGlobalMouseUp(evt, targetProps) {
|
|
472
469
|
// if a panning or selection has not been started, ignore the event
|
|
473
470
|
if (!targetProps.isPanning && !targetProps.isSelecting) {
|
|
474
471
|
return {};
|
|
475
472
|
}
|
|
476
|
-
// eslint-disable-line max-statements, complexity
|
|
477
473
|
const {
|
|
478
474
|
x1,
|
|
479
475
|
y1,
|
|
@@ -547,14 +543,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
547
543
|
/* harmony export */ "VictoryBrushContainer": function() { return /* binding */ VictoryBrushContainer; },
|
|
548
544
|
/* harmony export */ "useVictoryBrushContainer": function() { return /* binding */ useVictoryBrushContainer; }
|
|
549
545
|
/* harmony export */ });
|
|
550
|
-
/* harmony import */ var
|
|
551
|
-
/* harmony import */ var
|
|
552
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
|
|
553
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
|
|
546
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
547
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
554
548
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/rect.js");
|
|
555
549
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/selection.js");
|
|
556
550
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
|
|
557
551
|
/* harmony import */ var _brush_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./brush-helpers */ "./brush-helpers.ts");
|
|
552
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
|
|
553
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
558
554
|
/* harmony import */ var react_fast_compare__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-fast-compare */ "../../../node_modules/.pnpm/react-fast-compare@3.2.0/node_modules/react-fast-compare/index.js");
|
|
559
555
|
/* harmony import */ var react_fast_compare__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_fast_compare__WEBPACK_IMPORTED_MODULE_2__);
|
|
560
556
|
|
|
@@ -566,13 +562,13 @@ const VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS = {
|
|
|
566
562
|
allowDrag: true,
|
|
567
563
|
allowDraw: true,
|
|
568
564
|
allowResize: true,
|
|
569
|
-
brushComponent: /*#__PURE__*/
|
|
565
|
+
brushComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_3__.Rect, null),
|
|
570
566
|
brushStyle: {
|
|
571
567
|
stroke: "transparent",
|
|
572
568
|
fill: "black",
|
|
573
569
|
fillOpacity: 0.1
|
|
574
570
|
},
|
|
575
|
-
handleComponent: /*#__PURE__*/
|
|
571
|
+
handleComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_3__.Rect, null),
|
|
576
572
|
handleStyle: {
|
|
577
573
|
stroke: "transparent",
|
|
578
574
|
fill: "transparent"
|
|
@@ -600,14 +596,14 @@ const useVictoryBrushContainer = initialProps => {
|
|
|
600
596
|
} = props;
|
|
601
597
|
const brushComponentStyle = brushComponent.props && brushComponent.props.style;
|
|
602
598
|
const cursor = !props.allowDrag && !props.allowResize ? "auto" : "move";
|
|
603
|
-
return x[0] !== x[1] && y[0] !== y[1] ? /*#__PURE__*/
|
|
599
|
+
return x[0] !== x[1] && y[0] !== y[1] ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(brushComponent, {
|
|
604
600
|
key: `${name}-brush`,
|
|
605
601
|
width: Math.abs(x[1] - x[0]) || 1,
|
|
606
602
|
height: Math.abs(y[1] - y[0]) || 1,
|
|
607
603
|
x: Math.min(x[0], x[1]),
|
|
608
604
|
y: Math.min(y[0], y[1]),
|
|
609
605
|
cursor,
|
|
610
|
-
style:
|
|
606
|
+
style: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, brushComponentStyle, brushStyle)
|
|
611
607
|
}) : null;
|
|
612
608
|
};
|
|
613
609
|
const getCursorPointers = () => {
|
|
@@ -647,7 +643,7 @@ const useVictoryBrushContainer = initialProps => {
|
|
|
647
643
|
const width = Math.abs(x2 - x1) || 1;
|
|
648
644
|
const height = Math.abs(y2 - y1) || 1;
|
|
649
645
|
const handleComponentStyle = handleComponent.props && handleComponent.props.style || {};
|
|
650
|
-
const style =
|
|
646
|
+
const style = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, handleComponentStyle, handleStyle);
|
|
651
647
|
const cursors = getCursorPointers();
|
|
652
648
|
const yProps = {
|
|
653
649
|
style,
|
|
@@ -679,7 +675,7 @@ const useVictoryBrushContainer = initialProps => {
|
|
|
679
675
|
x: right.x1
|
|
680
676
|
}, xProps)
|
|
681
677
|
};
|
|
682
|
-
const handles = ["top", "bottom", "left", "right"].reduce((memo, curr) => handleProps[curr] ? memo.concat( /*#__PURE__*/
|
|
678
|
+
const handles = ["top", "bottom", "left", "right"].reduce((memo, curr) => handleProps[curr] ? memo.concat( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(handleComponent, Object.assign({
|
|
683
679
|
key: `${name}-handle-${curr}`
|
|
684
680
|
}, handleProps[curr]))) : memo, []);
|
|
685
681
|
return handles.length ? handles : null;
|
|
@@ -689,15 +685,15 @@ const useVictoryBrushContainer = initialProps => {
|
|
|
689
685
|
currentDomain,
|
|
690
686
|
cachedBrushDomain
|
|
691
687
|
} = props;
|
|
692
|
-
const brushDomain =
|
|
693
|
-
const domain = react_fast_compare__WEBPACK_IMPORTED_MODULE_2___default()(brushDomain, cachedBrushDomain) ?
|
|
688
|
+
const brushDomain = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, props.brushDomain, props.domain);
|
|
689
|
+
const domain = react_fast_compare__WEBPACK_IMPORTED_MODULE_2___default()(brushDomain, cachedBrushDomain) ? lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, currentDomain, brushDomain) : brushDomain;
|
|
694
690
|
const coordinates = victory_core__WEBPACK_IMPORTED_MODULE_5__.getDomainCoordinates(props, domain);
|
|
695
691
|
const selectBox = getSelectBox(coordinates);
|
|
696
692
|
return selectBox ? [selectBox, getHandles(domain)] : [];
|
|
697
693
|
};
|
|
698
694
|
return {
|
|
699
695
|
props,
|
|
700
|
-
children: [...
|
|
696
|
+
children: [...react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(children), ...getRect()]
|
|
701
697
|
};
|
|
702
698
|
};
|
|
703
699
|
const VictoryBrushContainer = initialProps => {
|
|
@@ -705,7 +701,7 @@ const VictoryBrushContainer = initialProps => {
|
|
|
705
701
|
props,
|
|
706
702
|
children
|
|
707
703
|
} = useVictoryBrushContainer(initialProps);
|
|
708
|
-
return /*#__PURE__*/
|
|
704
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_6__.VictoryContainer, props, children);
|
|
709
705
|
};
|
|
710
706
|
VictoryBrushContainer.role = "container";
|
|
711
707
|
VictoryBrushContainer.defaultEvents = initialProps => {
|
|
@@ -2855,16 +2851,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2855
2851
|
/* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
|
|
2856
2852
|
/* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
|
|
2857
2853
|
/* harmony export */ });
|
|
2858
|
-
/* harmony import */ var
|
|
2859
|
-
/* harmony import */ var
|
|
2860
|
-
/* harmony import */ var
|
|
2861
|
-
/* harmony import */ var
|
|
2854
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
2855
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
2856
|
+
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/uniqueId */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/uniqueId.js");
|
|
2857
|
+
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1__);
|
|
2862
2858
|
/* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
|
|
2863
2859
|
/* harmony import */ var _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../victory-util/user-props */ "../../victory-core/es/victory-util/user-props.js");
|
|
2864
2860
|
/* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
|
|
2865
2861
|
/* harmony import */ var _victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-portal/portal-outlet */ "../../victory-core/es/victory-portal/portal-outlet.js");
|
|
2866
2862
|
/* harmony import */ var _victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-portal/portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
|
|
2867
|
-
|
|
2868
2863
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
2869
2864
|
|
|
2870
2865
|
|
|
@@ -2872,9 +2867,10 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
2872
2867
|
|
|
2873
2868
|
|
|
2874
2869
|
|
|
2870
|
+
|
|
2875
2871
|
const defaultProps = {
|
|
2876
2872
|
className: "VictoryContainer",
|
|
2877
|
-
portalComponent: /*#__PURE__*/
|
|
2873
|
+
portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
|
|
2878
2874
|
portalZIndex: 99,
|
|
2879
2875
|
responsive: true,
|
|
2880
2876
|
role: "img"
|
|
@@ -2891,10 +2887,10 @@ function useVictoryContainer(initialProps) {
|
|
|
2891
2887
|
height,
|
|
2892
2888
|
responsive
|
|
2893
2889
|
} = props;
|
|
2894
|
-
const localContainerRef = (0,
|
|
2890
|
+
const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
2895
2891
|
|
|
2896
2892
|
// Generated ID stored in ref because it needs to persist across renders
|
|
2897
|
-
const generatedId = (0,
|
|
2893
|
+
const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default()("victory-container-"));
|
|
2898
2894
|
const containerId = props.containerId ?? generatedId.current;
|
|
2899
2895
|
const getIdForElement = elName => `${containerId}-${elName}`;
|
|
2900
2896
|
const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
|
|
@@ -2953,7 +2949,7 @@ const VictoryContainer = initialProps => {
|
|
|
2953
2949
|
containerRef,
|
|
2954
2950
|
localContainerRef
|
|
2955
2951
|
} = useVictoryContainer(initialProps);
|
|
2956
|
-
|
|
2952
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().useEffect(() => {
|
|
2957
2953
|
if (!events?.onWheel) return;
|
|
2958
2954
|
const handleWheel = e => e.preventDefault();
|
|
2959
2955
|
const container = localContainerRef?.current;
|
|
@@ -2963,21 +2959,21 @@ const VictoryContainer = initialProps => {
|
|
|
2963
2959
|
};
|
|
2964
2960
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2965
2961
|
}, []);
|
|
2966
|
-
return /*#__PURE__*/
|
|
2962
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
2967
2963
|
className: className,
|
|
2968
2964
|
style: {
|
|
2969
2965
|
...style,
|
|
2970
2966
|
width: responsive ? style?.width : dimensions.width,
|
|
2971
2967
|
height: responsive ? style?.height : dimensions.height,
|
|
2972
|
-
pointerEvents: "none",
|
|
2973
|
-
touchAction: "none",
|
|
2974
|
-
position: "relative"
|
|
2968
|
+
pointerEvents: style?.pointerEvents ?? "none",
|
|
2969
|
+
touchAction: style?.touchAction ?? "none",
|
|
2970
|
+
position: style?.position ?? "relative"
|
|
2975
2971
|
},
|
|
2976
2972
|
"data-ouia-component-id": ouiaId,
|
|
2977
2973
|
"data-ouia-component-type": ouiaType,
|
|
2978
2974
|
"data-ouia-safe": ouiaSafe,
|
|
2979
2975
|
ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_4__.mergeRefs)([localContainerRef, containerRef])
|
|
2980
|
-
}, /*#__PURE__*/
|
|
2976
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_5__.PortalProvider, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
|
|
2981
2977
|
width: width,
|
|
2982
2978
|
height: height,
|
|
2983
2979
|
tabIndex: tabIndex,
|
|
@@ -2990,11 +2986,11 @@ const VictoryContainer = initialProps => {
|
|
|
2990
2986
|
...dimensions,
|
|
2991
2987
|
pointerEvents: "all"
|
|
2992
2988
|
}
|
|
2993
|
-
}, userProps, events), title ? /*#__PURE__*/
|
|
2989
|
+
}, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("title", {
|
|
2994
2990
|
id: titleId
|
|
2995
|
-
}, title) : null, desc ? /*#__PURE__*/
|
|
2991
|
+
}, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("desc", {
|
|
2996
2992
|
id: descId
|
|
2997
|
-
}, desc) : null, children), /*#__PURE__*/
|
|
2993
|
+
}, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
2998
2994
|
style: {
|
|
2999
2995
|
...dimensions,
|
|
3000
2996
|
zIndex: portalZIndex,
|
|
@@ -3002,7 +2998,7 @@ const VictoryContainer = initialProps => {
|
|
|
3002
2998
|
top: 0,
|
|
3003
2999
|
left: 0
|
|
3004
3000
|
}
|
|
3005
|
-
}, /*#__PURE__*/
|
|
3001
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
|
|
3006
3002
|
as: portalComponent,
|
|
3007
3003
|
width: width,
|
|
3008
3004
|
height: height,
|
|
@@ -3274,41 +3270,45 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3274
3270
|
/* harmony export */ "reduceChildren": function() { return /* binding */ reduceChildren; },
|
|
3275
3271
|
/* harmony export */ "scalePoint": function() { return /* binding */ scalePoint; }
|
|
3276
3272
|
/* harmony export */ });
|
|
3277
|
-
/* harmony import */ var
|
|
3278
|
-
/* harmony import */ var
|
|
3279
|
-
/* harmony import */ var
|
|
3280
|
-
/* harmony import */ var
|
|
3281
|
-
/* harmony import */ var
|
|
3282
|
-
/* harmony import */ var
|
|
3283
|
-
/* harmony import */ var
|
|
3284
|
-
/* harmony import */ var
|
|
3285
|
-
|
|
3273
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
3274
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
3275
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
|
|
3276
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
3277
|
+
/* harmony import */ var lodash_property__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/property */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/property.js");
|
|
3278
|
+
/* harmony import */ var lodash_property__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_property__WEBPACK_IMPORTED_MODULE_2__);
|
|
3279
|
+
/* harmony import */ var lodash_pick__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash/pick */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/pick.js");
|
|
3280
|
+
/* harmony import */ var lodash_pick__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_pick__WEBPACK_IMPORTED_MODULE_3__);
|
|
3286
3281
|
|
|
3287
3282
|
|
|
3288
|
-
/* eslint-disable no-use-before-define */
|
|
3289
3283
|
|
|
3290
|
-
// Private Functions
|
|
3291
3284
|
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3285
|
+
/**
|
|
3286
|
+
* Determine the range of a cartesian axis
|
|
3287
|
+
*/
|
|
3288
|
+
function getCartesianRange(options) {
|
|
3289
|
+
const vertical = options.axis !== "x";
|
|
3296
3290
|
if (vertical) {
|
|
3297
|
-
return [
|
|
3291
|
+
return [options.height - options.padding.bottom, options.padding.top];
|
|
3298
3292
|
}
|
|
3299
|
-
return [padding.left,
|
|
3293
|
+
return [options.padding.left, options.width - options.padding.right];
|
|
3300
3294
|
}
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3295
|
+
|
|
3296
|
+
/**
|
|
3297
|
+
* Determine the range of a polar axis in radians
|
|
3298
|
+
*/
|
|
3299
|
+
function getPolarRange(options) {
|
|
3300
|
+
if (options.axis === "x") {
|
|
3301
|
+
const startAngle = degreesToRadians(options.startAngle || 0);
|
|
3302
|
+
const endAngle = degreesToRadians(options.endAngle || 360);
|
|
3305
3303
|
return [startAngle, endAngle];
|
|
3306
3304
|
}
|
|
3307
|
-
return [
|
|
3305
|
+
return [options.innerRadius || 0, getRadius({
|
|
3306
|
+
height: options.height,
|
|
3307
|
+
width: options.width,
|
|
3308
|
+
padding: options.padding
|
|
3309
|
+
})];
|
|
3308
3310
|
}
|
|
3309
3311
|
|
|
3310
|
-
// Exported Functions
|
|
3311
|
-
|
|
3312
3312
|
/**
|
|
3313
3313
|
* Creates an object composed of the inverted keys and values of object.
|
|
3314
3314
|
* If object contains duplicate values, subsequent values overwrite property assignments of previous values.
|
|
@@ -3345,8 +3345,11 @@ function omit(originalObject, ks) {
|
|
|
3345
3345
|
}
|
|
3346
3346
|
return newObject;
|
|
3347
3347
|
}
|
|
3348
|
+
|
|
3349
|
+
/**
|
|
3350
|
+
* Coalesce the x and y values from a data point
|
|
3351
|
+
*/
|
|
3348
3352
|
function getPoint(datum) {
|
|
3349
|
-
const exists = val => val !== undefined;
|
|
3350
3353
|
const {
|
|
3351
3354
|
_x,
|
|
3352
3355
|
_x1,
|
|
@@ -3357,16 +3360,20 @@ function getPoint(datum) {
|
|
|
3357
3360
|
_y0,
|
|
3358
3361
|
_voronoiY
|
|
3359
3362
|
} = datum;
|
|
3360
|
-
const defaultX =
|
|
3361
|
-
const defaultY =
|
|
3363
|
+
const defaultX = _x1 ?? _x;
|
|
3364
|
+
const defaultY = _y1 ?? _y;
|
|
3362
3365
|
const point = {
|
|
3363
|
-
x:
|
|
3364
|
-
x0:
|
|
3365
|
-
y:
|
|
3366
|
-
y0:
|
|
3366
|
+
x: _voronoiX ?? defaultX,
|
|
3367
|
+
x0: _x0 ?? _x,
|
|
3368
|
+
y: _voronoiY ?? defaultY,
|
|
3369
|
+
y0: _y0 ?? _y
|
|
3367
3370
|
};
|
|
3368
|
-
return
|
|
3371
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, point, datum);
|
|
3369
3372
|
}
|
|
3373
|
+
|
|
3374
|
+
/**
|
|
3375
|
+
* Scale a point based on the origin, direction, and given scale function
|
|
3376
|
+
*/
|
|
3370
3377
|
function scalePoint(props, datum) {
|
|
3371
3378
|
const {
|
|
3372
3379
|
scale,
|
|
@@ -3389,11 +3396,11 @@ function scalePoint(props, datum) {
|
|
|
3389
3396
|
y0: polar ? -y0 * Math.sin(x0) + origin.x : y0
|
|
3390
3397
|
};
|
|
3391
3398
|
}
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3399
|
+
|
|
3400
|
+
/**
|
|
3401
|
+
* Returns a padding value from a number or partial padding values
|
|
3402
|
+
*/
|
|
3403
|
+
function getPadding(padding) {
|
|
3397
3404
|
const paddingVal = typeof padding === "number" ? padding : 0;
|
|
3398
3405
|
const paddingObj = typeof padding === "object" ? padding : {};
|
|
3399
3406
|
return {
|
|
@@ -3403,6 +3410,10 @@ function getPadding(props, name) {
|
|
|
3403
3410
|
right: paddingObj.right || paddingVal
|
|
3404
3411
|
};
|
|
3405
3412
|
}
|
|
3413
|
+
|
|
3414
|
+
/**
|
|
3415
|
+
* Returns true if the component is defined as a tooltip
|
|
3416
|
+
*/
|
|
3406
3417
|
function isTooltip(component) {
|
|
3407
3418
|
const labelRole = component && component.type && component.type.role;
|
|
3408
3419
|
return labelRole === "tooltip";
|
|
@@ -3417,8 +3428,8 @@ function getDefaultStyles(props, role) {
|
|
|
3417
3428
|
return defaultStyles;
|
|
3418
3429
|
}
|
|
3419
3430
|
const tooltipStyle = theme.tooltip && theme.tooltip.style || {};
|
|
3420
|
-
const labelStyle =
|
|
3421
|
-
return
|
|
3431
|
+
const labelStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, tooltipStyle, defaultStyles.labels);
|
|
3432
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, {
|
|
3422
3433
|
labels: labelStyle
|
|
3423
3434
|
}, defaultStyles);
|
|
3424
3435
|
}
|
|
@@ -3426,7 +3437,7 @@ function getStyles(style, defaultStyles) {
|
|
|
3426
3437
|
const width = "100%";
|
|
3427
3438
|
const height = "100%";
|
|
3428
3439
|
if (!style) {
|
|
3429
|
-
return
|
|
3440
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({
|
|
3430
3441
|
parent: {
|
|
3431
3442
|
height,
|
|
3432
3443
|
width
|
|
@@ -3442,14 +3453,18 @@ function getStyles(style, defaultStyles) {
|
|
|
3442
3453
|
const defaultLabels = defaultStyles && defaultStyles.labels || {};
|
|
3443
3454
|
const defaultData = defaultStyles && defaultStyles.data || {};
|
|
3444
3455
|
return {
|
|
3445
|
-
parent:
|
|
3456
|
+
parent: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, parent, defaultParent, {
|
|
3446
3457
|
width,
|
|
3447
3458
|
height
|
|
3448
3459
|
}),
|
|
3449
|
-
labels:
|
|
3450
|
-
data:
|
|
3460
|
+
labels: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labels, defaultLabels),
|
|
3461
|
+
data: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, data, defaultData)
|
|
3451
3462
|
};
|
|
3452
3463
|
}
|
|
3464
|
+
|
|
3465
|
+
/**
|
|
3466
|
+
* Returns the value of a prop or accessor function with the given props
|
|
3467
|
+
*/
|
|
3453
3468
|
function evaluateProp(prop, props) {
|
|
3454
3469
|
return isFunction(prop) ? prop(props) : prop;
|
|
3455
3470
|
}
|
|
@@ -3471,19 +3486,28 @@ function degreesToRadians(degrees) {
|
|
|
3471
3486
|
function radiansToDegrees(radians) {
|
|
3472
3487
|
return typeof radians === "number" ? radians / (Math.PI / 180) : radians;
|
|
3473
3488
|
}
|
|
3474
|
-
|
|
3489
|
+
|
|
3490
|
+
/**
|
|
3491
|
+
* Get the maximum radius that will fit in the container
|
|
3492
|
+
*/
|
|
3493
|
+
function getRadius(options) {
|
|
3494
|
+
const {
|
|
3495
|
+
width,
|
|
3496
|
+
height,
|
|
3497
|
+
padding
|
|
3498
|
+
} = options;
|
|
3475
3499
|
const {
|
|
3476
3500
|
left,
|
|
3477
3501
|
right,
|
|
3478
3502
|
top,
|
|
3479
3503
|
bottom
|
|
3480
|
-
} =
|
|
3481
|
-
const {
|
|
3482
|
-
width,
|
|
3483
|
-
height
|
|
3484
|
-
} = props;
|
|
3504
|
+
} = padding;
|
|
3485
3505
|
return Math.min(width - left - right, height - top - bottom) / 2;
|
|
3486
3506
|
}
|
|
3507
|
+
|
|
3508
|
+
/**
|
|
3509
|
+
* Returns the origin for a polar chart within the padded area
|
|
3510
|
+
*/
|
|
3487
3511
|
function getPolarOrigin(props) {
|
|
3488
3512
|
const {
|
|
3489
3513
|
width,
|
|
@@ -3494,7 +3518,7 @@ function getPolarOrigin(props) {
|
|
|
3494
3518
|
bottom,
|
|
3495
3519
|
left,
|
|
3496
3520
|
right
|
|
3497
|
-
} = getPadding(props);
|
|
3521
|
+
} = getPadding(props.padding);
|
|
3498
3522
|
const radius = Math.min(width - left - right, height - top - bottom) / 2;
|
|
3499
3523
|
const offsetWidth = width / 2 + left - right;
|
|
3500
3524
|
const offsetHeight = height / 2 + top - bottom;
|
|
@@ -3503,13 +3527,30 @@ function getPolarOrigin(props) {
|
|
|
3503
3527
|
y: offsetHeight + radius > height ? radius + top - bottom : offsetHeight
|
|
3504
3528
|
};
|
|
3505
3529
|
}
|
|
3530
|
+
|
|
3531
|
+
/**
|
|
3532
|
+
* Determine the range of an axis based on the given props
|
|
3533
|
+
*/
|
|
3506
3534
|
function getRange(props, axis) {
|
|
3507
3535
|
if (props.range && props.range[axis]) {
|
|
3508
3536
|
return props.range[axis];
|
|
3509
3537
|
} else if (props.range && Array.isArray(props.range)) {
|
|
3510
3538
|
return props.range;
|
|
3511
3539
|
}
|
|
3512
|
-
return props.polar ? getPolarRange(
|
|
3540
|
+
return props.polar ? getPolarRange({
|
|
3541
|
+
axis,
|
|
3542
|
+
innerRadius: props.innerRadius,
|
|
3543
|
+
startAngle: props.startAngle,
|
|
3544
|
+
endAngle: props.endAngle,
|
|
3545
|
+
height: props.height,
|
|
3546
|
+
width: props.width,
|
|
3547
|
+
padding: getPadding(props.padding)
|
|
3548
|
+
}) : getCartesianRange({
|
|
3549
|
+
axis,
|
|
3550
|
+
height: props.height,
|
|
3551
|
+
width: props.width,
|
|
3552
|
+
padding: getPadding(props.padding)
|
|
3553
|
+
});
|
|
3513
3554
|
}
|
|
3514
3555
|
|
|
3515
3556
|
/**
|
|
@@ -3541,7 +3582,7 @@ function createAccessor(key) {
|
|
|
3541
3582
|
return x => x;
|
|
3542
3583
|
}
|
|
3543
3584
|
// otherwise, assume it is an array index, property key or path (_.property handles all three)
|
|
3544
|
-
return
|
|
3585
|
+
return lodash_property__WEBPACK_IMPORTED_MODULE_2___default()(key);
|
|
3545
3586
|
}
|
|
3546
3587
|
function modifyProps(props, fallbackProps, role) {
|
|
3547
3588
|
const theme = props.theme && props.theme[role] ? props.theme[role] : {};
|
|
@@ -3550,7 +3591,7 @@ function modifyProps(props, fallbackProps, role) {
|
|
|
3550
3591
|
const defaultObject = horizontal === undefined ? {} : {
|
|
3551
3592
|
horizontal
|
|
3552
3593
|
};
|
|
3553
|
-
return
|
|
3594
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()(defaultObject, props, themeProps, fallbackProps);
|
|
3554
3595
|
}
|
|
3555
3596
|
|
|
3556
3597
|
/**
|
|
@@ -3637,10 +3678,10 @@ initialMemo, combine) {
|
|
|
3637
3678
|
const childRole = child.type && child.type.role;
|
|
3638
3679
|
const childName = child.props.name || `${childRole}-${names[index]}`;
|
|
3639
3680
|
if (child.props && child.props.children) {
|
|
3640
|
-
const childProps = Object.assign({}, child.props,
|
|
3641
|
-
const nestedChildren = child.type && child.type.role === "stack" && isFunction(child.type.getChildren) ? child.type.getChildren(childProps) :
|
|
3642
|
-
const nestedChildProps = Object.assign({}, c.props,
|
|
3643
|
-
return /*#__PURE__*/
|
|
3681
|
+
const childProps = Object.assign({}, child.props, lodash_pick__WEBPACK_IMPORTED_MODULE_3___default()(parentProps, sharedProps));
|
|
3682
|
+
const nestedChildren = child.type && child.type.role === "stack" && isFunction(child.type.getChildren) ? child.type.getChildren(childProps) : react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(child.props.children).map(c => {
|
|
3683
|
+
const nestedChildProps = Object.assign({}, c.props, lodash_pick__WEBPACK_IMPORTED_MODULE_3___default()(childProps, sharedProps));
|
|
3684
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(c, nestedChildProps);
|
|
3644
3685
|
});
|
|
3645
3686
|
const childNames = nestedChildren.map((c, i) => `${childName}-${i}`);
|
|
3646
3687
|
const nestedResults = traverseChildren(nestedChildren, childNames, child);
|
|
@@ -3654,7 +3695,7 @@ initialMemo, combine) {
|
|
|
3654
3695
|
return newMemo;
|
|
3655
3696
|
}, initialMemo);
|
|
3656
3697
|
};
|
|
3657
|
-
const validChildren = children.filter(
|
|
3698
|
+
const validChildren = children.filter(react__WEBPACK_IMPORTED_MODULE_0__.isValidElement);
|
|
3658
3699
|
const childNames = validChildren.map((c, i) => i);
|
|
3659
3700
|
return traverseChildren(validChildren, childNames);
|
|
3660
3701
|
}
|
|
@@ -3674,10 +3715,10 @@ function isHorizontal(props) {
|
|
|
3674
3715
|
if (memo || childProps.horizontal || !childProps.children) {
|
|
3675
3716
|
return memo || childProps.horizontal;
|
|
3676
3717
|
}
|
|
3677
|
-
return traverseChildren(
|
|
3718
|
+
return traverseChildren(react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(childProps.children));
|
|
3678
3719
|
}, false);
|
|
3679
3720
|
};
|
|
3680
|
-
return traverseChildren(
|
|
3721
|
+
return traverseChildren(react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(props.children));
|
|
3681
3722
|
}
|
|
3682
3723
|
|
|
3683
3724
|
/***/ }),
|